From: Cris Di Sclafani Date: Fri, 30 Oct 2020 17:07:02 +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=5ee5ed76796411bac2077d59764098a968e59b71;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 30ab127..bfb1bee 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-30T16:28:18.552Z", "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-30T16:58:24.965Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 588839a..26e6844 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-30T16:28:18.552Z", "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-30T16:58:24.965Z", "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 35acddf..b45601e 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 _0x79d8=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','contactManager','jscripty','urlForward'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x79d8,0x77));var _0x879d=function(_0x8fe28a,_0x344f7a){_0x8fe28a=_0x8fe28a-0x0;var _0xb5fae0=_0x79d8[_0x8fe28a];return _0xb5fae0;};'use strict';var Sequelize=require('sequelize');module[_0x879d('0x0')]={'name':{'type':Sequelize[_0x879d('0x1')],'get':function(_0x475b32){return this[_0x879d('0x2')](_0x879d('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x879d('0x4'),'integration','motionbar',_0x879d('0x5'),_0x879d('0x6'),'browser',_0x879d('0x7'),_0x879d('0x8')]],'msg':_0x879d('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x879d('0xa')](0x1000),'comment':_0x879d('0xb')},'data3':{'type':Sequelize[_0x879d('0xa')](0x1000),'comment':_0x879d('0xc')},'data4':{'type':Sequelize[_0x879d('0xa')](0x1000)},'data5':{'type':Sequelize[_0x879d('0xa')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x879d('0xd')]}}; \ No newline at end of file +var _0x0d99=['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]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser'];(function(_0x3cb827,_0x4c7d54){var _0x4802a2=function(_0x3b5faf){while(--_0x3b5faf){_0x3cb827['push'](_0x3cb827['shift']());}};_0x4802a2(++_0x4c7d54);}(_0x0d99,0x74));var _0x90d9=function(_0xea4f3d,_0x1ca466){_0xea4f3d=_0xea4f3d-0x0;var _0x550d16=_0x0d99[_0xea4f3d];return _0x550d16;};'use strict';var Sequelize=require('sequelize');module[_0x90d9('0x0')]={'name':{'type':Sequelize[_0x90d9('0x1')],'get':function(_0x74648a){return this[_0x90d9('0x2')](_0x90d9('0x3'));}},'action':{'type':Sequelize[_0x90d9('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x90d9('0x5'),_0x90d9('0x6'),'motionbar',_0x90d9('0x7'),_0x90d9('0x8'),_0x90d9('0x9'),_0x90d9('0xa'),'script']],'msg':_0x90d9('0xb')}},'comment':_0x90d9('0xb')},'data1':{'type':Sequelize[_0x90d9('0x4')](0x1000),'comment':_0x90d9('0xc')},'data2':{'type':Sequelize[_0x90d9('0x4')](0x1000),'comment':_0x90d9('0xd')},'data3':{'type':Sequelize[_0x90d9('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x90d9('0x4')](0x1000)},'data6':{'type':Sequelize[_0x90d9('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 786e933..7c949c8 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 _0xe3db=['html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','find','catch','destroy','Action'];(function(_0xbe972f,_0x4dd944){var _0x43ba76=function(_0x855e0b){while(--_0x855e0b){_0xbe972f['push'](_0xbe972f['shift']());}};_0x43ba76(++_0x4dd944);}(_0xe3db,0xc8));var _0xbe3d=function(_0x346891,_0x23a17c){_0x346891=_0x346891-0x0;var _0x5d19dc=_0xe3db[_0x346891];return _0x5d19dc;};'use strict';var pdf=require(_0xbe3d('0x0'));var emlformat=require(_0xbe3d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbe3d('0x2'));var jsonpatch=require(_0xbe3d('0x3'));var rp=require(_0xbe3d('0x4'));var moment=require(_0xbe3d('0x5'));var BPromise=require(_0xbe3d('0x6'));var Mustache=require(_0xbe3d('0x7'));var util=require(_0xbe3d('0x8'));var path=require(_0xbe3d('0x9'));var sox=require(_0xbe3d('0xa'));var csv=require(_0xbe3d('0xb'));var ejs=require(_0xbe3d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbe3d('0xd'));var crypto=require(_0xbe3d('0xe'));var jsforce=require(_0xbe3d('0xf'));var deskjs=require(_0xbe3d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbe3d('0x11'));var Papa=require(_0xbe3d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe3d('0x13'));var as=require(_0xbe3d('0x14'));var hardwareService=require(_0xbe3d('0x15'));var logger=require(_0xbe3d('0x16'))(_0xbe3d('0x17'));var utils=require(_0xbe3d('0x18'));var config=require(_0xbe3d('0x19'));var db=require(_0xbe3d('0x1a'))['db'];function respondWithStatusCode(_0x1ff83c,_0x276e4c){_0x276e4c=_0x276e4c||0xcc;return function(_0x4d25e7){if(_0x4d25e7){return _0x1ff83c[_0xbe3d('0x1b')](_0x276e4c);}return _0x1ff83c['status'](_0x276e4c)[_0xbe3d('0x1c')]();};}function respondWithResult(_0x177643,_0x399333){_0x399333=_0x399333||0xc8;return function(_0x1a142b){if(_0x1a142b){return _0x177643[_0xbe3d('0x1d')](_0x399333)[_0xbe3d('0x1e')](_0x1a142b);}};}function respondWithFilteredResult(_0x20b01f,_0x98ce08){return function(_0x2bb8c2){if(_0x2bb8c2){var _0x1e8ecc=_0x2bb8c2[_0xbe3d('0x1f')],_0x2a45ef=_0x98ce08['offset'],_0x196b9a=_0x98ce08[_0xbe3d('0x20')]+_0x98ce08[_0xbe3d('0x21')],_0x113b23;if(_0x196b9a>=_0x1e8ecc){_0x196b9a=_0x1e8ecc;_0x113b23=0xc8;}else{_0x113b23=0xce;}_0x20b01f[_0xbe3d('0x1d')](_0x113b23);return _0x20b01f[_0xbe3d('0x22')](_0xbe3d('0x23'),_0x2a45ef+'-'+_0x196b9a+'/'+_0x1e8ecc)[_0xbe3d('0x1e')](_0x2bb8c2);}return null;};}function patchUpdates(_0x1d2ccc){return function(_0x2b3db3){try{jsonpatch[_0xbe3d('0x24')](_0x2b3db3,_0x1d2ccc,!![]);}catch(_0x5f0b4b){return BPromise[_0xbe3d('0x25')](_0x5f0b4b);}return _0x2b3db3[_0xbe3d('0x26')]();};}function saveUpdates(_0x466c2a,_0x1c802f){return function(_0x316a83){if(_0x316a83){return _0x316a83[_0xbe3d('0x27')](_0x466c2a)[_0xbe3d('0x28')](function(_0x271a7e){return _0x271a7e;});}return null;};}function removeEntity(_0x431ba1,_0x37b211){return function(_0x2a44c0){if(_0x2a44c0){return _0x2a44c0['destroy']()[_0xbe3d('0x28')](function(){_0x431ba1[_0xbe3d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24501a,_0x4b755a){return function(_0x638959){if(!_0x638959){_0x24501a[_0xbe3d('0x1b')](0x194);}return _0x638959;};}function handleError(_0x4b87bc,_0x1f2cd0){_0x1f2cd0=_0x1f2cd0||0x1f4;return function(_0x297595){logger[_0xbe3d('0x29')](_0x297595[_0xbe3d('0x2a')]);if(_0x297595[_0xbe3d('0x2b')]){delete _0x297595[_0xbe3d('0x2b')];}_0x4b87bc[_0xbe3d('0x1d')](_0x1f2cd0)[_0xbe3d('0x2c')](_0x297595);};}exports[_0xbe3d('0x27')]=function(_0x4f41a7,_0x14a7f1){if(_0x4f41a7['body']['id']){delete _0x4f41a7[_0xbe3d('0x2d')]['id'];}return db['Action'][_0xbe3d('0x2e')]({'where':{'id':_0x4f41a7['params']['id']}})[_0xbe3d('0x28')](handleEntityNotFound(_0x14a7f1,null))[_0xbe3d('0x28')](saveUpdates(_0x4f41a7[_0xbe3d('0x2d')],null))[_0xbe3d('0x28')](respondWithResult(_0x14a7f1,null))[_0xbe3d('0x2f')](handleError(_0x14a7f1,null));};exports[_0xbe3d('0x30')]=function(_0x217bbe,_0x5e0810){return db[_0xbe3d('0x31')][_0xbe3d('0x2e')]({'where':{'id':_0x217bbe['params']['id']}})['then'](handleEntityNotFound(_0x5e0810,null))[_0xbe3d('0x28')](removeEntity(_0x5e0810,null))[_0xbe3d('0x2f')](handleError(_0x5e0810,null));}; \ No newline at end of file +var _0xabee=['catch','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','update','body','Action','find'];(function(_0x2b0275,_0x3fe1fe){var _0x43708e=function(_0x4f410c){while(--_0x4f410c){_0x2b0275['push'](_0x2b0275['shift']());}};_0x43708e(++_0x3fe1fe);}(_0xabee,0xf7));var _0xeabe=function(_0x5142b8,_0x1def06){_0x5142b8=_0x5142b8-0x0;var _0x4d3dde=_0xabee[_0x5142b8];return _0x4d3dde;};'use strict';var pdf=require(_0xeabe('0x0'));var emlformat=require(_0xeabe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeabe('0x2'));var jsonpatch=require(_0xeabe('0x3'));var rp=require(_0xeabe('0x4'));var moment=require(_0xeabe('0x5'));var BPromise=require(_0xeabe('0x6'));var Mustache=require(_0xeabe('0x7'));var util=require(_0xeabe('0x8'));var path=require(_0xeabe('0x9'));var sox=require('sox');var csv=require(_0xeabe('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xeabe('0xb'));var crypto=require(_0xeabe('0xc'));var jsforce=require(_0xeabe('0xd'));var deskjs=require(_0xeabe('0xe'));var toCsv=require(_0xeabe('0xa'));var querystring=require(_0xeabe('0xf'));var Papa=require('papaparse');var Redis=require(_0xeabe('0x10'));var authService=require(_0xeabe('0x11'));var qs=require(_0xeabe('0x12'));var as=require(_0xeabe('0x13'));var hardwareService=require(_0xeabe('0x14'));var logger=require(_0xeabe('0x15'))(_0xeabe('0x16'));var utils=require(_0xeabe('0x17'));var config=require(_0xeabe('0x18'));var db=require(_0xeabe('0x19'))['db'];function respondWithStatusCode(_0x319d8c,_0x3827af){_0x3827af=_0x3827af||0xcc;return function(_0x599fd7){if(_0x599fd7){return _0x319d8c[_0xeabe('0x1a')](_0x3827af);}return _0x319d8c[_0xeabe('0x1b')](_0x3827af)['end']();};}function respondWithResult(_0x47336c,_0x5321d8){_0x5321d8=_0x5321d8||0xc8;return function(_0x1078ae){if(_0x1078ae){return _0x47336c[_0xeabe('0x1b')](_0x5321d8)[_0xeabe('0x1c')](_0x1078ae);}};}function respondWithFilteredResult(_0x4edbd3,_0x238da4){return function(_0x5140be){if(_0x5140be){var _0x1d9226=_0x5140be[_0xeabe('0x1d')],_0x567227=_0x238da4[_0xeabe('0x1e')],_0x45727e=_0x238da4[_0xeabe('0x1e')]+_0x238da4[_0xeabe('0x1f')],_0xf64e76;if(_0x45727e>=_0x1d9226){_0x45727e=_0x1d9226;_0xf64e76=0xc8;}else{_0xf64e76=0xce;}_0x4edbd3[_0xeabe('0x1b')](_0xf64e76);return _0x4edbd3[_0xeabe('0x20')](_0xeabe('0x21'),_0x567227+'-'+_0x45727e+'/'+_0x1d9226)[_0xeabe('0x1c')](_0x5140be);}return null;};}function patchUpdates(_0x5a30de){return function(_0x4aab7e){try{jsonpatch[_0xeabe('0x22')](_0x4aab7e,_0x5a30de,!![]);}catch(_0x2c62aa){return BPromise[_0xeabe('0x23')](_0x2c62aa);}return _0x4aab7e[_0xeabe('0x24')]();};}function saveUpdates(_0x778637,_0x3ee427){return function(_0x3a47db){if(_0x3a47db){return _0x3a47db['update'](_0x778637)[_0xeabe('0x25')](function(_0x31d958){return _0x31d958;});}return null;};}function removeEntity(_0x3a239d,_0x2b5515){return function(_0x24ced8){if(_0x24ced8){return _0x24ced8[_0xeabe('0x26')]()[_0xeabe('0x25')](function(){_0x3a239d[_0xeabe('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e92eb,_0x607d58){return function(_0x59beb2){if(!_0x59beb2){_0x3e92eb[_0xeabe('0x1a')](0x194);}return _0x59beb2;};}function handleError(_0x422806,_0x3e9f90){_0x3e9f90=_0x3e9f90||0x1f4;return function(_0x29e81c){logger[_0xeabe('0x27')](_0x29e81c[_0xeabe('0x28')]);if(_0x29e81c[_0xeabe('0x29')]){delete _0x29e81c[_0xeabe('0x29')];}_0x422806[_0xeabe('0x1b')](_0x3e9f90)[_0xeabe('0x2a')](_0x29e81c);};}exports[_0xeabe('0x2b')]=function(_0x1078ff,_0x31828a){if(_0x1078ff[_0xeabe('0x2c')]['id']){delete _0x1078ff[_0xeabe('0x2c')]['id'];}return db[_0xeabe('0x2d')][_0xeabe('0x2e')]({'where':{'id':_0x1078ff['params']['id']}})[_0xeabe('0x25')](handleEntityNotFound(_0x31828a,null))['then'](saveUpdates(_0x1078ff[_0xeabe('0x2c')],null))[_0xeabe('0x25')](respondWithResult(_0x31828a,null))[_0xeabe('0x2f')](handleError(_0x31828a,null));};exports['destroy']=function(_0x5f2f38,_0x11db8c){return db[_0xeabe('0x2d')][_0xeabe('0x2e')]({'where':{'id':_0x5f2f38[_0xeabe('0x30')]['id']}})[_0xeabe('0x25')](handleEntityNotFound(_0x11db8c,null))[_0xeabe('0x25')](removeEntity(_0x11db8c,null))[_0xeabe('0x2f')](handleError(_0x11db8c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9be12ee..6720873 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 _0x8e96=['define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x8e96,0xfe));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x68e9('0x0'));var util=require(_0x68e9('0x1'));var logger=require(_0x68e9('0x2'))(_0x68e9('0x3'));var moment=require(_0x68e9('0x4'));var BPromise=require(_0x68e9('0x5'));var rp=require(_0x68e9('0x6'));var fs=require('fs');var path=require(_0x68e9('0x7'));var rimraf=require(_0x68e9('0x8'));var config=require(_0x68e9('0x9'));var attributes=require(_0x68e9('0xa'));module[_0x68e9('0xb')]=function(_0x1ddb5c,_0x273582){return _0x1ddb5c[_0x68e9('0xc')]('Action',attributes,{'tableName':_0x68e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ae=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Action','tools_actions'];(function(_0x3c5392,_0x3cbc73){var _0x4c08b8=function(_0x2cd6ba){while(--_0x2cd6ba){_0x3c5392['push'](_0x3c5392['shift']());}};_0x4c08b8(++_0x3cbc73);}(_0xe9ae,0x197));var _0xee9a=function(_0x55086c,_0x522a1e){_0x55086c=_0x55086c-0x0;var _0xd5453b=_0xe9ae[_0x55086c];return _0xd5453b;};'use strict';var _=require(_0xee9a('0x0'));var util=require('util');var logger=require(_0xee9a('0x1'))('api');var moment=require(_0xee9a('0x2'));var BPromise=require(_0xee9a('0x3'));var rp=require(_0xee9a('0x4'));var fs=require('fs');var path=require(_0xee9a('0x5'));var rimraf=require(_0xee9a('0x6'));var config=require(_0xee9a('0x7'));var attributes=require('./action.attributes');module[_0xee9a('0x8')]=function(_0x3958bb,_0x53d4ad){return _0x3958bb['define'](_0xee9a('0x9'),attributes,{'tableName':_0xee9a('0xa'),'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 9c6f7cd..da4f38b 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x19d7cf,_0x2b78ef){var _0x1057ea=function(_0x1aff93){while(--_0x1aff93){_0x19d7cf['push'](_0x19d7cf['shift']());}};_0x1057ea(++_0x2b78ef);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xcb91[_0x41c381];return _0x427981;};'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')]('Action,\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);});});} \ 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(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 165b396..d1d6ce8 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 _0x8238=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x450ad9,_0x1152f7){var _0x17e64e=function(_0x53efac){while(--_0x53efac){_0x450ad9['push'](_0x450ad9['shift']());}};_0x17e64e(++_0x1152f7);}(_0x8238,0x18b));var _0x8823=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x8238[_0x43a37c];return _0x5d1d40;};'use strict';var multer=require(_0x8823('0x0'));var util=require(_0x8823('0x1'));var path=require(_0x8823('0x2'));var timeout=require(_0x8823('0x3'));var express=require(_0x8823('0x4'));var router=express[_0x8823('0x5')]();var auth=require(_0x8823('0x6'));var interaction=require(_0x8823('0x7'));var config=require(_0x8823('0x8'));var controller=require(_0x8823('0x9'));router[_0x8823('0xa')](_0x8823('0xb'),auth[_0x8823('0xc')](),controller[_0x8823('0xd')]);router[_0x8823('0xe')](_0x8823('0xb'),auth[_0x8823('0xc')](),controller[_0x8823('0xf')]);module[_0x8823('0x10')]=router; \ No newline at end of file +var _0x9025=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','multer','util','path','express','Router','../../components/auth/service'];(function(_0x251628,_0x1a75e1){var _0x2ed8a0=function(_0x43247b){while(--_0x43247b){_0x251628['push'](_0x251628['shift']());}};_0x2ed8a0(++_0x1a75e1);}(_0x9025,0x1d3));var _0x5902=function(_0xc18b07,_0x1910f8){_0xc18b07=_0xc18b07-0x0;var _0x39115b=_0x9025[_0xc18b07];return _0x39115b;};'use strict';var multer=require(_0x5902('0x0'));var util=require(_0x5902('0x1'));var path=require(_0x5902('0x2'));var timeout=require('connect-timeout');var express=require(_0x5902('0x3'));var router=express[_0x5902('0x4')]();var auth=require(_0x5902('0x5'));var interaction=require(_0x5902('0x6'));var config=require(_0x5902('0x7'));var controller=require('./action.controller');router[_0x5902('0x8')](_0x5902('0x9'),auth[_0x5902('0xa')](),controller['update']);router['delete'](_0x5902('0x9'),auth[_0x5902('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5f3b5c0..0952115 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 _0xacb9=['sequelize','STRING','TEXT'];(function(_0x17c7f0,_0x1746d5){var _0x366efd=function(_0x489d0f){while(--_0x489d0f){_0x17c7f0['push'](_0x17c7f0['shift']());}};_0x366efd(++_0x1746d5);}(_0xacb9,0x66));var _0x9acb=function(_0x19cbcc,_0x44384e){_0x19cbcc=_0x19cbcc-0x0;var _0x44d405=_0xacb9[_0x19cbcc];return _0x44d405;};'use strict';var Sequelize=require(_0x9acb('0x0'));module['exports']={'name':{'type':Sequelize[_0x9acb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9acb('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9acb('0x2')]},'joins':{'type':Sequelize[_0x9acb('0x2')]}}; \ No newline at end of file +var _0x35b8=['exports','STRING','TEXT'];(function(_0x99f137,_0x27b9b9){var _0x285126=function(_0x4dfc9){while(--_0x4dfc9){_0x99f137['push'](_0x99f137['shift']());}};_0x285126(++_0x27b9b9);}(_0x35b8,0xcc));var _0x835b=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x35b8[_0x4c7b20];return _0x4872bd;};'use strict';var Sequelize=require('sequelize');module[_0x835b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x835b('0x1')]},'parent':{'type':Sequelize[_0x835b('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x835b('0x2')]},'joins':{'type':Sequelize[_0x835b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 05c9a7f..fa439f0 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 _0x53d5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','SUM(%s)','COUNT(%s)','MAX(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','Sequelize','AnalyticMetric','format','order','clone','SELECT','No\x20available\x20data','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','select','countTable','COUNT(*)','runReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport'];(function(_0xa1a05b,_0x59de8f){var _0x41155b=function(_0x201126){while(--_0x201126){_0xa1a05b['push'](_0xa1a05b['shift']());}};_0x41155b(++_0x59de8f);}(_0x53d5,0x1cc));var _0x553d=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x53d5[_0x12a554];return _0x244ba0;};'use strict';var pdf=require(_0x553d('0x0'));var emlformat=require(_0x553d('0x1'));var rimraf=require(_0x553d('0x2'));var zipdir=require(_0x553d('0x3'));var jsonpatch=require(_0x553d('0x4'));var rp=require(_0x553d('0x5'));var moment=require(_0x553d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x553d('0x7'));var util=require(_0x553d('0x8'));var path=require(_0x553d('0x9'));var sox=require(_0x553d('0xa'));var csv=require(_0x553d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xb'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var db=require(_0x553d('0x19'))['db'];var dbH=require(_0x553d('0x19'))[_0x553d('0x1a')];function respondWithStatusCode(_0x41f6c1,_0x4285c0){_0x4285c0=_0x4285c0||0xcc;return function(_0x44b9ee){if(_0x44b9ee){return _0x41f6c1[_0x553d('0x1b')](_0x4285c0);}return _0x41f6c1[_0x553d('0x1c')](_0x4285c0)[_0x553d('0x1d')]();};}function respondWithResult(_0x3cb13c,_0xd11e74){_0xd11e74=_0xd11e74||0xc8;return function(_0x52ded8){if(_0x52ded8){return _0x3cb13c[_0x553d('0x1c')](_0xd11e74)['json'](_0x52ded8);}};}function respondWithFilteredResult(_0x1d4f35,_0x2de0c1){return function(_0x12b505){if(_0x12b505){var _0x529b37=_0x12b505[_0x553d('0x1e')],_0x4e4f78=_0x2de0c1['offset'],_0x321038=_0x2de0c1[_0x553d('0x1f')]+_0x2de0c1[_0x553d('0x20')],_0x1cbce6;if(_0x321038>=_0x529b37){_0x321038=_0x529b37;_0x1cbce6=0xc8;}else{_0x1cbce6=0xce;}_0x1d4f35[_0x553d('0x1c')](_0x1cbce6);return _0x1d4f35[_0x553d('0x21')](_0x553d('0x22'),_0x4e4f78+'-'+_0x321038+'/'+_0x529b37)[_0x553d('0x23')](_0x12b505);}return null;};}function patchUpdates(_0x719651){return function(_0x19a984){try{jsonpatch[_0x553d('0x24')](_0x19a984,_0x719651,!![]);}catch(_0x861db3){return BPromise[_0x553d('0x25')](_0x861db3);}return _0x19a984['save']();};}function saveUpdates(_0x11bc86,_0x42cd9a){return function(_0x4c5f0f){if(_0x4c5f0f){return _0x4c5f0f[_0x553d('0x26')](_0x11bc86)[_0x553d('0x27')](function(_0x4d00e3){return _0x4d00e3;});}return null;};}function removeEntity(_0x5bbd2d,_0x4a6e0e){return function(_0x55fbe1){if(_0x55fbe1){return _0x55fbe1[_0x553d('0x28')]()['then'](function(){var _0x82dd3a=_0x55fbe1[_0x553d('0x29')]({'plain':!![]});var _0x2e4f1b=_0x553d('0x2a');return db[_0x553d('0x2b')]['destroy']({'where':{'type':_0x2e4f1b,'resourceId':_0x82dd3a['id']}})['then'](function(){return _0x55fbe1;});})[_0x553d('0x27')](function(){_0x5bbd2d['status'](0xcc)[_0x553d('0x1d')]();});}};}function handleEntityNotFound(_0x185b8a,_0x517a1c){return function(_0x677832){if(!_0x677832){_0x185b8a[_0x553d('0x1b')](0x194);}return _0x677832;};}function handleError(_0x2c4577,_0x5cda9e){_0x5cda9e=_0x5cda9e||0x1f4;return function(_0x1f3f5c){logger[_0x553d('0x2c')](_0x1f3f5c[_0x553d('0x2d')]);if(_0x1f3f5c['name']){delete _0x1f3f5c[_0x553d('0x2e')];}_0x2c4577[_0x553d('0x1c')](_0x5cda9e)[_0x553d('0x2f')](_0x1f3f5c);};}exports['index']=function(_0x37ddd7,_0x180a66){var _0xc3d157={},_0x5ce4ab={},_0x4315a9={'count':0x0,'rows':[]};var _0x4b70b3=_[_0x553d('0x30')](db[_0x553d('0x31')][_0x553d('0x32')],function(_0x615816){return{'name':_0x615816[_0x553d('0x33')],'type':_0x615816[_0x553d('0x34')][_0x553d('0x35')]};});_0x5ce4ab[_0x553d('0x36')]=_['map'](_0x4b70b3,_0x553d('0x2e'));_0x5ce4ab[_0x553d('0x37')]=_[_0x553d('0x38')](_0x37ddd7[_0x553d('0x37')]);_0x5ce4ab[_0x553d('0x39')]=_[_0x553d('0x3a')](_0x5ce4ab[_0x553d('0x36')],_0x5ce4ab[_0x553d('0x37')]);_0xc3d157['attributes']=_[_0x553d('0x3a')](_0x5ce4ab[_0x553d('0x36')],qs[_0x553d('0x3b')](_0x37ddd7['query'][_0x553d('0x3b')]));_0xc3d157[_0x553d('0x3c')]=_0xc3d157[_0x553d('0x3c')][_0x553d('0x3d')]?_0xc3d157[_0x553d('0x3c')]:_0x5ce4ab[_0x553d('0x36')];if(!_0x37ddd7[_0x553d('0x37')][_0x553d('0x3e')]('nolimit')){_0xc3d157['limit']=qs[_0x553d('0x20')](_0x37ddd7[_0x553d('0x37')]['limit']);_0xc3d157[_0x553d('0x1f')]=qs['offset'](_0x37ddd7['query'][_0x553d('0x1f')]);}_0xc3d157['order']=qs[_0x553d('0x3f')](_0x37ddd7['query'][_0x553d('0x3f')]);_0xc3d157[_0x553d('0x40')]=qs['filters'](_['pick'](_0x37ddd7[_0x553d('0x37')],_0x5ce4ab[_0x553d('0x39')]),_0x4b70b3);if(_0x37ddd7[_0x553d('0x37')][_0x553d('0x41')]){_0xc3d157['where']=_[_0x553d('0x42')](_0xc3d157[_0x553d('0x40')],{'$or':_['map'](_0x4b70b3,function(_0xfac8ee){if(_0xfac8ee['type']!==_0x553d('0x43')){var _0xa4e41e={};_0xa4e41e[_0xfac8ee[_0x553d('0x2e')]]={'$like':'%'+_0x37ddd7[_0x553d('0x37')]['filter']+'%'};return _0xa4e41e;}})});}_0xc3d157=_['merge']({},_0xc3d157,_0x37ddd7[_0x553d('0x44')]);var _0x40657a={'where':_0xc3d157[_0x553d('0x40')]};return db[_0x553d('0x31')][_0x553d('0x1e')](_0x40657a)[_0x553d('0x27')](function(_0x403f4a){_0x4315a9[_0x553d('0x1e')]=_0x403f4a;if(_0x37ddd7[_0x553d('0x37')][_0x553d('0x45')]){_0xc3d157['include']=[{'all':!![]}];}return db[_0x553d('0x31')][_0x553d('0x46')](_0xc3d157);})['then'](function(_0x3fce6f){_0x4315a9[_0x553d('0x47')]=_0x3fce6f;return _0x4315a9;})['then'](respondWithFilteredResult(_0x180a66,_0xc3d157))[_0x553d('0x48')](handleError(_0x180a66,null));};exports[_0x553d('0x49')]=function(_0x40bc7a,_0x103405){var _0x263169={'raw':![],'where':{'id':_0x40bc7a['params']['id']}},_0x29bb2a={};_0x29bb2a[_0x553d('0x36')]=_[_0x553d('0x38')](db[_0x553d('0x31')]['rawAttributes']);_0x29bb2a[_0x553d('0x37')]=_[_0x553d('0x38')](_0x40bc7a['query']);_0x29bb2a[_0x553d('0x39')]=_[_0x553d('0x3a')](_0x29bb2a[_0x553d('0x36')],_0x29bb2a[_0x553d('0x37')]);_0x263169[_0x553d('0x3c')]=_[_0x553d('0x3a')](_0x29bb2a[_0x553d('0x36')],qs[_0x553d('0x3b')](_0x40bc7a[_0x553d('0x37')]['fields']));_0x263169[_0x553d('0x3c')]=_0x263169['attributes'][_0x553d('0x3d')]?_0x263169['attributes']:_0x29bb2a[_0x553d('0x36')];if(_0x40bc7a[_0x553d('0x37')]['includeAll']){_0x263169[_0x553d('0x4a')]=[{'all':!![]}];}_0x263169=_[_0x553d('0x42')]({},_0x263169,_0x40bc7a[_0x553d('0x44')]);return db[_0x553d('0x31')][_0x553d('0x4b')](_0x263169)['then'](handleEntityNotFound(_0x103405,null))[_0x553d('0x27')](respondWithResult(_0x103405,null))['catch'](handleError(_0x103405,null));};exports[_0x553d('0x4c')]=function(_0x842722,_0x3bb264){return db[_0x553d('0x31')][_0x553d('0x4c')](_0x842722[_0x553d('0x4d')],{})[_0x553d('0x27')](function(_0x29259a){var _0x460a98=_0x842722[_0x553d('0x4e')][_0x553d('0x29')]({'plain':!![]});if(!_0x460a98)throw new Error(_0x553d('0x4f'));if(_0x460a98[_0x553d('0x50')]===_0x553d('0x4e')){var _0x1d07eb=_0x29259a[_0x553d('0x29')]({'plain':!![]});var _0x2dd4ce='Reports';return db[_0x553d('0x51')][_0x553d('0x4b')]({'where':{'name':_0x2dd4ce,'userProfileId':_0x460a98[_0x553d('0x52')]},'raw':!![]})[_0x553d('0x27')](function(_0x58a8ef){if(_0x58a8ef&&_0x58a8ef['autoAssociation']===0x0){return db[_0x553d('0x2b')][_0x553d('0x4c')]({'name':_0x1d07eb[_0x553d('0x2e')],'resourceId':_0x1d07eb['id'],'type':_0x553d('0x2a'),'sectionId':_0x58a8ef['id']},{})[_0x553d('0x27')](function(){return _0x29259a;});}else{return _0x29259a;}})[_0x553d('0x48')](function(_0x378823){logger[_0x553d('0x2c')](_0x553d('0x53'),_0x378823);throw _0x378823;});}return _0x29259a;})['then'](respondWithResult(_0x3bb264,0xc9))[_0x553d('0x48')](handleError(_0x3bb264,null));};exports[_0x553d('0x26')]=function(_0x24cf0c,_0x3eae07){if(_0x24cf0c['body']['id']){delete _0x24cf0c['body']['id'];}return db[_0x553d('0x31')][_0x553d('0x4b')]({'where':{'id':_0x24cf0c[_0x553d('0x54')]['id']}})[_0x553d('0x27')](handleEntityNotFound(_0x3eae07,null))[_0x553d('0x27')](saveUpdates(_0x24cf0c[_0x553d('0x4d')],null))[_0x553d('0x27')](respondWithResult(_0x3eae07,null))[_0x553d('0x48')](handleError(_0x3eae07,null));};exports['destroy']=function(_0x2402d5,_0x5a9540){return db[_0x553d('0x31')]['find']({'where':{'id':_0x2402d5[_0x553d('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a9540,null))['then'](removeEntity(_0x5a9540,null))[_0x553d('0x48')](handleError(_0x5a9540,null));};exports[_0x553d('0x55')]=function(_0x5c3c6f,_0x26f753){var _0x2d70e4=0xa;var _0x3333cc=['join',_0x553d('0x56'),_0x553d('0x57'),_0x553d('0x58')];var _0x5b2117={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x553d('0x59'),'MAX':'MAX(%s)','MIN':_0x553d('0x5a'),'AVG':_0x553d('0x5b'),'GROUP_CONCAT':_0x553d('0x5c'),'GROUP_CONCAT ASC':_0x553d('0x5d'),'GROUP_CONCAT DESC':_0x553d('0x5e')};var _0x50b4b8={'SEC_TO_TIME':_0x553d('0x5f'),'DATE':_0x553d('0x60'),'HOUR':_0x553d('0x61'),'ROUND':_0x553d('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3fc5be=function(_0x2107a1){return!_[_0x553d('0x63')]([_0x553d('0x64'),_0x553d('0x65'),_0x553d('0x66'),'IS\x20NOT\x20EMPTY'],_0x2107a1);};var _0x46bc00=function(_0x4512d4){if(!_0x4512d4||!_0x4512d4[_0x553d('0x67')][_0x553d('0x3d')]){return'';}for(var _0x5dfb14='(',_0x340593=0x0;_0x340593<_0x4512d4[_0x553d('0x67')][_0x553d('0x3d')];_0x340593+=0x1){_0x340593>0x0&&(_0x5dfb14+='\x20'+_0x4512d4[_0x553d('0x68')]+'\x20');_0x5dfb14+=_0x4512d4['rules'][_0x340593][_0x553d('0x69')]?_0x46bc00(_0x4512d4[_0x553d('0x67')][_0x340593]['group']):_0x4512d4[_0x553d('0x67')][_0x340593][_0x553d('0x6a')]+'\x20'+_0x4512d4[_0x553d('0x67')][_0x340593]['condition']+(_0x3fc5be(_0x4512d4[_0x553d('0x67')][_0x340593][_0x553d('0x6b')])?'\x20'+_0x4512d4[_0x553d('0x67')][_0x340593][_0x553d('0x6c')]:'');}return _0x5dfb14+')';};var _0xd47742={'where':{'id':_0x5c3c6f[_0x553d('0x54')]['id']}},_0x9ab505,_0x467e8e,_0x3d114f,_0x1e8a88,_0xedd062;_0xd47742=_[_0x553d('0x42')]({},_0xd47742,_0x5c3c6f[_0x553d('0x44')]);return db[_0x553d('0x31')][_0x553d('0x4b')](_0xd47742)[_0x553d('0x27')](function(_0x2e8d86){if(_0x2e8d86){_0x9ab505=_0x2e8d86;return _0x2e8d86[_0x553d('0x6d')]();}return null;})[_0x553d('0x27')](function(_0x360c16){if(_0x360c16){if(!_0x360c16[_0x553d('0x3d')]){throw new db['Sequelize'][(_0x553d('0x6e'))](_0x553d('0x6f'),0x193);}_0x467e8e=_0x360c16;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x553d('0x27')](function(_0xf6df3a){if(_0xf6df3a){_0x3d114f=_[_0x553d('0x70')](_0xf6df3a,'id');var _0x327e2d;var _0x308dcd=squel['select']();_0x308dcd[_0x553d('0x71')](_0x9ab505[_0x553d('0x72')]);for(var _0x421fb3=0x0;_0x421fb3<_0x467e8e[_0x553d('0x3d')];_0x421fb3+=0x1){_0x327e2d=_0x467e8e[_0x421fb3][_0x553d('0x73')]?_0x3d114f[_0x467e8e[_0x421fb3][_0x553d('0x73')]][_0x553d('0x74')]:_0x467e8e[_0x421fb3][_0x553d('0x6a')];_0x327e2d=_0x467e8e[_0x421fb3][_0x553d('0x75')]?_[_0x553d('0x76')](_0x5b2117[_0x467e8e[_0x421fb3]['function']],'%s',_0x327e2d):_0x327e2d;_0x327e2d=_0x467e8e[_0x421fb3]['format']?_[_0x553d('0x76')](_0x50b4b8[_0x467e8e[_0x421fb3]['format']],'%s',_0x327e2d):_0x327e2d;if(_0x467e8e[_0x421fb3][_0x553d('0x77')]){_0x308dcd[_0x553d('0x69')](_0x327e2d);}_0x467e8e[_0x421fb3]['orderBy']&&_0x308dcd['order'](_0x327e2d,_0x467e8e[_0x421fb3][_0x553d('0x78')]===_0x553d('0x79')?![]:!![]);_0x308dcd[_0x553d('0x6a')](_0x327e2d,_0x467e8e[_0x421fb3][_0x553d('0x7a')]||_0x327e2d);}if(_0x9ab505[_0x553d('0x7b')]){_0x9ab505[_0x553d('0x7b')]=JSON[_0x553d('0x7c')](_0x9ab505['joins']);for(var _0x12a111=0x0;_0x12a111<_0x9ab505['joins'][_0x553d('0x3d')];_0x12a111+=0x1){if(_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x34')]&&_[_0x553d('0x63')](_0x3333cc,_0x9ab505[_0x553d('0x7b')][_0x12a111]['type'])&&_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7d')]&&_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7e')]&&_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7f')]){_0x308dcd[_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x34')]](_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7e')],null,util['format'](_0x553d('0x80'),_0x9ab505[_0x553d('0x72')],_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7d')],_0x9ab505['joins'][_0x12a111]['foreignTable'],_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7f')]));}}}if(_0x9ab505['conditions']){_0x9ab505[_0x553d('0x81')]=JSON[_0x553d('0x7c')](_0x9ab505[_0x553d('0x81')]);_0x308dcd[_0x553d('0x40')](_0x46bc00(_0x9ab505[_0x553d('0x81')][_0x553d('0x69')]));}_0xedd062=_0x308dcd['clone']();_0x308dcd[_0x553d('0x20')](_0x2d70e4);_0x308dcd[_0x553d('0x1f')](0x0);logger[_0x553d('0x82')](_0x553d('0x83'),_0x308dcd[_0x553d('0x84')]());return db[_0x553d('0x85')][_0x553d('0x37')](_0x308dcd[_0x553d('0x84')](),{'type':db[_0x553d('0x85')][_0x553d('0x86')]['SELECT']});}})[_0x553d('0x27')](respondWithResult(_0x26f753,null))[_0x553d('0x48')](handleError(_0x26f753,null));};function runReport(_0x4f7c61,_0x1c2bcb,_0x25b48f){var _0x5c15c9=_0x1c2bcb['name'];var _0x7052e3=0xa;var _0x41e2ab=[_0x553d('0x87'),_0x553d('0x56'),_0x553d('0x57'),_0x553d('0x58')];var _0x52687d={'SUM':_0x553d('0x88'),'COUNT':_0x553d('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x553d('0x8a'),'MIN':_0x553d('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x553d('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4de36b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x553d('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x553d('0x62'),'UNIX_TIMESTAMP':_0x553d('0x8b')};var _0x54a149=function(_0x1cefaa){return!_[_0x553d('0x63')](['IS\x20NULL',_0x553d('0x65'),_0x553d('0x66'),_0x553d('0x8c')],_0x1cefaa);};var _0x36dbbe=function(_0x4b07cd){if(!_0x4b07cd||!_0x4b07cd['rules'][_0x553d('0x3d')]){return'';}for(var _0x2c64d8='(',_0x9141e1=0x0;_0x9141e1<_0x4b07cd['rules'][_0x553d('0x3d')];_0x9141e1+=0x1){_0x9141e1>0x0&&(_0x2c64d8+='\x20'+_0x4b07cd['operator']+'\x20');_0x2c64d8+=_0x4b07cd['rules'][_0x9141e1]['group']?_0x36dbbe(_0x4b07cd[_0x553d('0x67')][_0x9141e1]['group']):_0x4b07cd[_0x553d('0x67')][_0x9141e1][_0x553d('0x6a')]+'\x20'+_0x4b07cd[_0x553d('0x67')][_0x9141e1]['condition']+(_0x54a149(_0x4b07cd['rules'][_0x9141e1][_0x553d('0x6b')])?'\x20'+_0x4b07cd[_0x553d('0x67')][_0x9141e1][_0x553d('0x6c')]:'');}return _0x2c64d8+')';};var _0x5c934b={'where':{'id':_0x4f7c61['id']}},_0x13258d,_0x494746,_0x24a52b,_0xedb9c1,_0x22e9e9;_0x5c934b=_[_0x553d('0x42')]({},_0x5c934b,_0x25b48f);return db[_0x553d('0x31')][_0x553d('0x4b')](_0x5c934b)['then'](function(_0x4f6bbc){if(_0x4f6bbc){_0x13258d=_0x4f6bbc;return _0x4f6bbc[_0x553d('0x6d')]();}return null;})[_0x553d('0x27')](function(_0x2b0619){if(_0x2b0619){if(!_0x2b0619[_0x553d('0x3d')]){throw new db[(_0x553d('0x8d'))][(_0x553d('0x6e'))](_0x553d('0x6f'),0x193);}_0x494746=_0x2b0619;return db[_0x553d('0x8e')][_0x553d('0x46')]({'raw':!![]});}return null;})[_0x553d('0x27')](function(_0x4621e9){if(_0x4621e9){_0x24a52b=_['keyBy'](_0x4621e9,'id');var _0xcde992;var _0x3a5e94=squel['select']();_0x3a5e94[_0x553d('0x71')](_0x13258d[_0x553d('0x72')]);for(var _0x1424ee=0x0;_0x1424ee<_0x494746[_0x553d('0x3d')];_0x1424ee+=0x1){_0xcde992=_0x494746[_0x1424ee]['MetricId']?_0x24a52b[_0x494746[_0x1424ee][_0x553d('0x73')]]['metric']:_0x494746[_0x1424ee][_0x553d('0x6a')];_0xcde992=_0x494746[_0x1424ee][_0x553d('0x75')]?_['replace'](_0x52687d[_0x494746[_0x1424ee]['function']],'%s',_0xcde992):_0xcde992;_0xcde992=_0x494746[_0x1424ee]['format']?_[_0x553d('0x76')](_0x4de36b[_0x494746[_0x1424ee][_0x553d('0x8f')]],'%s',_0xcde992):_0xcde992;if(_0x494746[_0x1424ee][_0x553d('0x77')]){_0x3a5e94['group'](_0xcde992);}_0x494746[_0x1424ee][_0x553d('0x78')]&&_0x3a5e94[_0x553d('0x90')](_0xcde992,_0x494746[_0x1424ee][_0x553d('0x78')]==='DESC'?![]:!![]);_0x3a5e94['field'](_0xcde992,_0x494746[_0x1424ee][_0x553d('0x7a')]||_0xcde992);}if(_0x13258d[_0x553d('0x7b')]){_0x13258d[_0x553d('0x7b')]=JSON[_0x553d('0x7c')](_0x13258d[_0x553d('0x7b')]);for(var _0x110ca2=0x0;_0x110ca2<_0x13258d[_0x553d('0x7b')][_0x553d('0x3d')];_0x110ca2+=0x1){if(_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x34')]&&_[_0x553d('0x63')](_0x41e2ab,_0x13258d[_0x553d('0x7b')][_0x110ca2]['type'])&&_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7d')]&&_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7e')]&&_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7f')]){_0x3a5e94[_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x34')]](_0x13258d['joins'][_0x110ca2][_0x553d('0x7e')],null,util[_0x553d('0x8f')](_0x553d('0x80'),_0x13258d[_0x553d('0x72')],_0x13258d['joins'][_0x110ca2]['parentKey'],_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7e')],_0x13258d[_0x553d('0x7b')][_0x110ca2]['foreignKey']));}}}if(_0x13258d[_0x553d('0x81')]){_0x13258d[_0x553d('0x81')]=JSON['parse'](_0x13258d[_0x553d('0x81')]);_0x3a5e94[_0x553d('0x40')](_0x36dbbe(_0x13258d[_0x553d('0x81')][_0x553d('0x69')]));}_0x22e9e9=_0x3a5e94[_0x553d('0x91')]();_0x3a5e94['limit'](_0x7052e3);_0x3a5e94[_0x553d('0x1f')](0x0);logger[_0x553d('0x82')](_0x553d('0x83'),_0x3a5e94[_0x553d('0x84')]());return db[_0x553d('0x85')]['query'](_0x3a5e94[_0x553d('0x84')](),{'type':db[_0x553d('0x85')][_0x553d('0x86')][_0x553d('0x92')]});}})[_0x553d('0x27')](function(_0x2d8413){if(!_0x2d8413[_0x553d('0x3d')]){throw new db[(_0x553d('0x8d'))]['ValidationErrorItem'](_0x553d('0x93'),0xcc);}if(_0x1c2bcb[_0x553d('0x94')]===_0x553d('0x95')){return null;}var _0x2f4448=_[_0x553d('0x42')](_0x1c2bcb,{'name':_0x1c2bcb['fullPath']||_0x1c2bcb['name']||_0x13258d[_0x553d('0x2e')],'basename':_0x5c15c9,'savename':util[_0x553d('0x8f')]('%s-%s.%s',_0x1c2bcb[_0x553d('0x2e')]||_0x13258d['name'],require(_0x553d('0x96'))[_0x553d('0x97')](0x4),_0x1c2bcb['output']||_0x553d('0x98')),'reportId':_0x13258d['id'],'reportType':_0x553d('0x99')});return db[_0x553d('0x9a')]['create'](_0x2f4448,{'raw':!![]});})[_0x553d('0x27')](function(_0x57546f){if(_0x13258d[_0x553d('0x72')]===_0x553d('0x9b')){_0x22e9e9[_0x553d('0x40')](_0x13258d[_0x553d('0x72')]+_0x553d('0x9c'),_0x1c2bcb[_0x553d('0x9d')],_0x1c2bcb[_0x553d('0x9e')]);}else{_0x22e9e9[_0x553d('0x40')](_0x13258d[_0x553d('0x72')]+_0x553d('0x9f'),_0x1c2bcb[_0x553d('0x9d')],_0x1c2bcb[_0x553d('0x9e')]);}if(_0x57546f){logger[_0x553d('0xa0')](_0x553d('0xa1'),_0x22e9e9[_0x553d('0x84')]());require(_0x553d('0xa2'))[_0x553d('0xa3')](path[_0x553d('0x87')](__dirname,_0x553d('0xa4'),_0x57546f['output']),[_0x57546f['id'],_0x22e9e9[_0x553d('0x84')](),path[_0x553d('0x87')](__dirname,_0x553d('0xa5'),_0x57546f['savename']),_0x5c15c9]);return _0x57546f;}else{var _0x490b72=squel[_0x553d('0xa6')]();_0x490b72[_0x553d('0x71')]('('+_0x22e9e9['toString']()+')',_0x553d('0xa7'));_0x490b72['field'](_0x553d('0xa8'),'count');_0x22e9e9['limit'](_0x1c2bcb[_0x553d('0x20')]||_0x7052e3);_0x22e9e9['offset'](_0x1c2bcb['offset']||0x0);return dbH[_0x553d('0x85')][_0x553d('0x37')](_0x490b72['toString'](),{'type':dbH[_0x553d('0x85')][_0x553d('0x86')][_0x553d('0x92')]})[_0x553d('0x27')](function(_0x4b5a55){if(!_0x4b5a55[_0x553d('0x3d')]){_0xedb9c1=0x0;}else{_0xedb9c1=_0x4b5a55[0x0]['count']||0x0;}return dbH[_0x553d('0x85')]['query'](_0x22e9e9['toString'](),{'type':dbH['sequelize'][_0x553d('0x86')]['SELECT']});})[_0x553d('0x27')](function(_0x8e4533){return{'rows':_0x8e4533||[],'count':_0xedb9c1};});}});}exports['run']=function(_0x40b52a,_0x1aef80){return runReport(_0x40b52a[_0x553d('0x54')],_0x40b52a[_0x553d('0x37')],_0x40b52a[_0x553d('0x44')])[_0x553d('0x27')](respondWithResult(_0x1aef80,null))['catch'](handleError(_0x1aef80,null));};exports[_0x553d('0xa9')]=runReport;exports[_0x553d('0x37')]=function(_0x207517,_0x13d67a){var _0x36d0c7=0xa;var _0x456b27=[_0x553d('0x87'),_0x553d('0x56'),_0x553d('0x57'),_0x553d('0x58')];var _0x4174b1={'SUM':'SUM(%s)','COUNT':_0x553d('0x89'),'COUNT DISTINCT':_0x553d('0x59'),'MAX':_0x553d('0x8a'),'MIN':_0x553d('0x5a'),'AVG':_0x553d('0x5b'),'GROUP_CONCAT':_0x553d('0x5c'),'GROUP_CONCAT ASC':_0x553d('0x5d'),'GROUP_CONCAT DESC':_0x553d('0x5e')};var _0x42a164={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x553d('0x60'),'HOUR':_0x553d('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x86407=function(_0x16e5d7){return!_[_0x553d('0x63')]([_0x553d('0x64'),_0x553d('0x65'),_0x553d('0x66'),_0x553d('0x8c')],_0x16e5d7);};var _0x25c3a3=function(_0xaa9b48){if(!_0xaa9b48||!_0xaa9b48['rules']['length']){return'';}for(var _0x1da206='(',_0xcde81b=0x0;_0xcde81b<_0xaa9b48[_0x553d('0x67')]['length'];_0xcde81b+=0x1){_0xcde81b>0x0&&(_0x1da206+='\x20'+_0xaa9b48[_0x553d('0x68')]+'\x20');_0x1da206+=_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x69')]?_0x25c3a3(_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x69')]):_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x6a')]+'\x20'+_0xaa9b48[_0x553d('0x67')][_0xcde81b]['condition']+(_0x86407(_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x6b')])?'\x20'+_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x6c')]:'');}return _0x1da206+')';};var _0x3e9b25={'where':{'id':_0x207517[_0x553d('0x54')]['id']}},_0xd2590a,_0x4dff60,_0x4d34f7,_0x550dd6,_0x24b170;_0x3e9b25=_[_0x553d('0x42')]({},_0x3e9b25,_0x207517['options']);return db['AnalyticCustomReport']['find'](_0x3e9b25)[_0x553d('0x27')](function(_0x41b3b1){if(_0x41b3b1){_0xd2590a=_0x41b3b1;return _0x41b3b1[_0x553d('0x6d')]();}return null;})[_0x553d('0x27')](function(_0x5ac0a3){if(_0x5ac0a3){if(!_0x5ac0a3[_0x553d('0x3d')]){throw new db[(_0x553d('0x8d'))]['ValidationErrorItem'](_0x553d('0x6f'),0x193);}_0x4dff60=_0x5ac0a3;return db[_0x553d('0x8e')][_0x553d('0x46')]({'raw':!![]});}return null;})[_0x553d('0x27')](function(_0x2bf047){if(_0x2bf047){_0x4d34f7=_[_0x553d('0x70')](_0x2bf047,'id');var _0x40d1f0;var _0x3913b2=squel[_0x553d('0xa6')]();_0x3913b2['from'](_0xd2590a['table']);for(var _0x38efec=0x0;_0x38efec<_0x4dff60[_0x553d('0x3d')];_0x38efec+=0x1){_0x40d1f0=_0x4dff60[_0x38efec]['MetricId']?_0x4d34f7[_0x4dff60[_0x38efec]['MetricId']][_0x553d('0x74')]:_0x4dff60[_0x38efec][_0x553d('0x6a')];_0x40d1f0=_0x4dff60[_0x38efec][_0x553d('0x75')]?_[_0x553d('0x76')](_0x4174b1[_0x4dff60[_0x38efec][_0x553d('0x75')]],'%s',_0x40d1f0):_0x40d1f0;_0x40d1f0=_0x4dff60[_0x38efec]['format']?_[_0x553d('0x76')](_0x42a164[_0x4dff60[_0x38efec][_0x553d('0x8f')]],'%s',_0x40d1f0):_0x40d1f0;if(_0x4dff60[_0x38efec][_0x553d('0x77')]){_0x3913b2[_0x553d('0x69')](_0x40d1f0);}_0x4dff60[_0x38efec][_0x553d('0x78')]&&_0x3913b2[_0x553d('0x90')](_0x40d1f0,_0x4dff60[_0x38efec][_0x553d('0x78')]===_0x553d('0x79')?![]:!![]);_0x3913b2[_0x553d('0x6a')](_0x40d1f0,_0x4dff60[_0x38efec][_0x553d('0x7a')]||_0x40d1f0);}if(_0xd2590a[_0x553d('0x7b')]){_0xd2590a['joins']=JSON[_0x553d('0x7c')](_0xd2590a[_0x553d('0x7b')]);for(var _0x362eb4=0x0;_0x362eb4<_0xd2590a['joins'][_0x553d('0x3d')];_0x362eb4+=0x1){if(_0xd2590a[_0x553d('0x7b')][_0x362eb4]['type']&&_['includes'](_0x456b27,_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x34')])&&_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7d')]&&_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7e')]&&_0xd2590a['joins'][_0x362eb4]['foreignKey']){_0x3913b2[_0xd2590a[_0x553d('0x7b')][_0x362eb4]['type']](_0xd2590a[_0x553d('0x7b')][_0x362eb4]['foreignTable'],null,util['format'](_0x553d('0x80'),_0xd2590a[_0x553d('0x72')],_0xd2590a[_0x553d('0x7b')][_0x362eb4]['parentKey'],_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7e')],_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7f')]));}}}if(_0xd2590a[_0x553d('0x81')]){_0xd2590a['conditions']=JSON[_0x553d('0x7c')](_0xd2590a[_0x553d('0x81')]);_0x3913b2[_0x553d('0x40')](_0x25c3a3(_0xd2590a[_0x553d('0x81')][_0x553d('0x69')]));}_0x24b170=_0x3913b2[_0x553d('0x91')]();_0x3913b2[_0x553d('0x20')](_0x36d0c7);_0x3913b2[_0x553d('0x1f')](0x0);logger[_0x553d('0x82')]('Limited\x20Query:',_0x3913b2[_0x553d('0x84')]());return db[_0x553d('0x85')][_0x553d('0x37')](_0x3913b2[_0x553d('0x84')](),{'type':db[_0x553d('0x85')][_0x553d('0x86')][_0x553d('0x92')]});}})['then'](function(){return{'sql':_0x24b170[_0x553d('0x84')]()};})[_0x553d('0x27')](respondWithResult(_0x13d67a,null))[_0x553d('0x48')](handleError(_0x13d67a,null));}; \ No newline at end of file +var _0xf120=['%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20NOT\x20NULL','value','ValidationErrorItem','toString','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','from','run','runReport','COUNT(%s)','MAX(%s)','ROUND(%s)','groupBy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignKey'];(function(_0xac9b31,_0x525668){var _0x2bff6e=function(_0x38ee41){while(--_0x38ee41){_0xac9b31['push'](_0xac9b31['shift']());}};_0x2bff6e(++_0x525668);}(_0xf120,0x179));var _0x0f12=function(_0x3a008e,_0x1d71b5){_0x3a008e=_0x3a008e-0x0;var _0xcbb17a=_0xf120[_0x3a008e];return _0xcbb17a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f12('0x0'));var rimraf=require(_0x0f12('0x1'));var zipdir=require(_0x0f12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f12('0x3'));var moment=require(_0x0f12('0x4'));var BPromise=require(_0x0f12('0x5'));var Mustache=require('mustache');var util=require(_0x0f12('0x6'));var path=require(_0x0f12('0x7'));var sox=require(_0x0f12('0x8'));var csv=require(_0x0f12('0x9'));var ejs=require(_0x0f12('0xa'));var fs=require('fs');var _=require(_0x0f12('0xb'));var squel=require(_0x0f12('0xc'));var crypto=require(_0x0f12('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f12('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f12('0xf'));var Papa=require(_0x0f12('0x10'));var Redis=require(_0x0f12('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f12('0x12'));var hardwareService=require(_0x0f12('0x13'));var logger=require(_0x0f12('0x14'))(_0x0f12('0x15'));var utils=require(_0x0f12('0x16'));var config=require(_0x0f12('0x17'));var db=require(_0x0f12('0x18'))['db'];var dbH=require('../../mysqldb')[_0x0f12('0x19')];function respondWithStatusCode(_0x11a236,_0xb80905){_0xb80905=_0xb80905||0xcc;return function(_0x17960e){if(_0x17960e){return _0x11a236[_0x0f12('0x1a')](_0xb80905);}return _0x11a236[_0x0f12('0x1b')](_0xb80905)[_0x0f12('0x1c')]();};}function respondWithResult(_0x7f1ae7,_0x215a7a){_0x215a7a=_0x215a7a||0xc8;return function(_0x42b674){if(_0x42b674){return _0x7f1ae7[_0x0f12('0x1b')](_0x215a7a)[_0x0f12('0x1d')](_0x42b674);}};}function respondWithFilteredResult(_0xe61624,_0x27addc){return function(_0xeccb7c){if(_0xeccb7c){var _0x592617=_0xeccb7c[_0x0f12('0x1e')],_0x1db207=_0x27addc[_0x0f12('0x1f')],_0x4d9613=_0x27addc[_0x0f12('0x1f')]+_0x27addc[_0x0f12('0x20')],_0x1c67b6;if(_0x4d9613>=_0x592617){_0x4d9613=_0x592617;_0x1c67b6=0xc8;}else{_0x1c67b6=0xce;}_0xe61624[_0x0f12('0x1b')](_0x1c67b6);return _0xe61624['set'](_0x0f12('0x21'),_0x1db207+'-'+_0x4d9613+'/'+_0x592617)['json'](_0xeccb7c);}return null;};}function patchUpdates(_0x18d689){return function(_0x56c1f1){try{jsonpatch['apply'](_0x56c1f1,_0x18d689,!![]);}catch(_0x516d98){return BPromise[_0x0f12('0x22')](_0x516d98);}return _0x56c1f1[_0x0f12('0x23')]();};}function saveUpdates(_0x5e4af9,_0x10a325){return function(_0x4bfc5d){if(_0x4bfc5d){return _0x4bfc5d[_0x0f12('0x24')](_0x5e4af9)['then'](function(_0x9f283b){return _0x9f283b;});}return null;};}function removeEntity(_0x379851,_0x4f06bd){return function(_0xe19f64){if(_0xe19f64){return _0xe19f64[_0x0f12('0x25')]()[_0x0f12('0x26')](function(){var _0x3821dd=_0xe19f64[_0x0f12('0x27')]({'plain':!![]});var _0x59d65b=_0x0f12('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x59d65b,'resourceId':_0x3821dd['id']}})['then'](function(){return _0xe19f64;});})[_0x0f12('0x26')](function(){_0x379851[_0x0f12('0x1b')](0xcc)[_0x0f12('0x1c')]();});}};}function handleEntityNotFound(_0x13e737,_0x4aff64){return function(_0x310c03){if(!_0x310c03){_0x13e737[_0x0f12('0x1a')](0x194);}return _0x310c03;};}function handleError(_0xde0ddf,_0x5ca297){_0x5ca297=_0x5ca297||0x1f4;return function(_0x13baa0){logger[_0x0f12('0x29')](_0x13baa0[_0x0f12('0x2a')]);if(_0x13baa0['name']){delete _0x13baa0[_0x0f12('0x2b')];}_0xde0ddf[_0x0f12('0x1b')](_0x5ca297)[_0x0f12('0x2c')](_0x13baa0);};}exports[_0x0f12('0x2d')]=function(_0x1c7d2b,_0x5693e4){var _0x5531ed={},_0x343ae0={},_0x48d168={'count':0x0,'rows':[]};var _0x3516f8=_[_0x0f12('0x2e')](db[_0x0f12('0x2f')]['rawAttributes'],function(_0x12a575){return{'name':_0x12a575[_0x0f12('0x30')],'type':_0x12a575[_0x0f12('0x31')][_0x0f12('0x32')]};});_0x343ae0[_0x0f12('0x33')]=_[_0x0f12('0x2e')](_0x3516f8,'name');_0x343ae0[_0x0f12('0x34')]=_[_0x0f12('0x35')](_0x1c7d2b[_0x0f12('0x34')]);_0x343ae0['filters']=_[_0x0f12('0x36')](_0x343ae0[_0x0f12('0x33')],_0x343ae0[_0x0f12('0x34')]);_0x5531ed[_0x0f12('0x37')]=_['intersection'](_0x343ae0[_0x0f12('0x33')],qs[_0x0f12('0x38')](_0x1c7d2b[_0x0f12('0x34')][_0x0f12('0x38')]));_0x5531ed[_0x0f12('0x37')]=_0x5531ed[_0x0f12('0x37')][_0x0f12('0x39')]?_0x5531ed['attributes']:_0x343ae0[_0x0f12('0x33')];if(!_0x1c7d2b[_0x0f12('0x34')]['hasOwnProperty'](_0x0f12('0x3a'))){_0x5531ed[_0x0f12('0x20')]=qs['limit'](_0x1c7d2b[_0x0f12('0x34')][_0x0f12('0x20')]);_0x5531ed['offset']=qs[_0x0f12('0x1f')](_0x1c7d2b['query'][_0x0f12('0x1f')]);}_0x5531ed[_0x0f12('0x3b')]=qs[_0x0f12('0x3c')](_0x1c7d2b[_0x0f12('0x34')][_0x0f12('0x3c')]);_0x5531ed[_0x0f12('0x3d')]=qs[_0x0f12('0x3e')](_[_0x0f12('0x3f')](_0x1c7d2b[_0x0f12('0x34')],_0x343ae0[_0x0f12('0x3e')]),_0x3516f8);if(_0x1c7d2b['query'][_0x0f12('0x40')]){_0x5531ed[_0x0f12('0x3d')]=_[_0x0f12('0x41')](_0x5531ed['where'],{'$or':_['map'](_0x3516f8,function(_0x4ac39b){if(_0x4ac39b[_0x0f12('0x31')]!==_0x0f12('0x42')){var _0x4f2e94={};_0x4f2e94[_0x4ac39b['name']]={'$like':'%'+_0x1c7d2b[_0x0f12('0x34')][_0x0f12('0x40')]+'%'};return _0x4f2e94;}})});}_0x5531ed=_[_0x0f12('0x41')]({},_0x5531ed,_0x1c7d2b['options']);var _0x3ccb6e={'where':_0x5531ed[_0x0f12('0x3d')]};return db['AnalyticCustomReport'][_0x0f12('0x1e')](_0x3ccb6e)[_0x0f12('0x26')](function(_0x226be0){_0x48d168[_0x0f12('0x1e')]=_0x226be0;if(_0x1c7d2b[_0x0f12('0x34')][_0x0f12('0x43')]){_0x5531ed[_0x0f12('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x0f12('0x45')](_0x5531ed);})['then'](function(_0x3fdcce){_0x48d168[_0x0f12('0x46')]=_0x3fdcce;return _0x48d168;})['then'](respondWithFilteredResult(_0x5693e4,_0x5531ed))[_0x0f12('0x47')](handleError(_0x5693e4,null));};exports[_0x0f12('0x48')]=function(_0x249dd4,_0x496724){var _0x5dfe38={'raw':![],'where':{'id':_0x249dd4[_0x0f12('0x49')]['id']}},_0x2bd31d={};_0x2bd31d[_0x0f12('0x33')]=_[_0x0f12('0x35')](db['AnalyticCustomReport'][_0x0f12('0x4a')]);_0x2bd31d[_0x0f12('0x34')]=_[_0x0f12('0x35')](_0x249dd4[_0x0f12('0x34')]);_0x2bd31d['filters']=_[_0x0f12('0x36')](_0x2bd31d[_0x0f12('0x33')],_0x2bd31d['query']);_0x5dfe38['attributes']=_[_0x0f12('0x36')](_0x2bd31d[_0x0f12('0x33')],qs[_0x0f12('0x38')](_0x249dd4['query']['fields']));_0x5dfe38[_0x0f12('0x37')]=_0x5dfe38[_0x0f12('0x37')]['length']?_0x5dfe38[_0x0f12('0x37')]:_0x2bd31d['model'];if(_0x249dd4[_0x0f12('0x34')][_0x0f12('0x43')]){_0x5dfe38['include']=[{'all':!![]}];}_0x5dfe38=_['merge']({},_0x5dfe38,_0x249dd4[_0x0f12('0x4b')]);return db[_0x0f12('0x2f')][_0x0f12('0x4c')](_0x5dfe38)[_0x0f12('0x26')](handleEntityNotFound(_0x496724,null))[_0x0f12('0x26')](respondWithResult(_0x496724,null))[_0x0f12('0x47')](handleError(_0x496724,null));};exports[_0x0f12('0x4d')]=function(_0x33ce01,_0x5b265d){return db[_0x0f12('0x2f')]['create'](_0x33ce01[_0x0f12('0x4e')],{})['then'](function(_0x4add76){var _0xbbacc1=_0x33ce01['user'][_0x0f12('0x27')]({'plain':!![]});if(!_0xbbacc1)throw new Error(_0x0f12('0x4f'));if(_0xbbacc1[_0x0f12('0x50')]===_0x0f12('0x51')){var _0x4fb2c5=_0x4add76[_0x0f12('0x27')]({'plain':!![]});var _0x90f918=_0x0f12('0x52');return db[_0x0f12('0x53')]['find']({'where':{'name':_0x90f918,'userProfileId':_0xbbacc1['userProfileId']},'raw':!![]})[_0x0f12('0x26')](function(_0x2e3df7){if(_0x2e3df7&&_0x2e3df7[_0x0f12('0x54')]===0x0){return db[_0x0f12('0x55')][_0x0f12('0x4d')]({'name':_0x4fb2c5['name'],'resourceId':_0x4fb2c5['id'],'type':'CustomReports','sectionId':_0x2e3df7['id']},{})['then'](function(){return _0x4add76;});}else{return _0x4add76;}})[_0x0f12('0x47')](function(_0x7719ec){logger[_0x0f12('0x29')](_0x0f12('0x56'),_0x7719ec);throw _0x7719ec;});}return _0x4add76;})[_0x0f12('0x26')](respondWithResult(_0x5b265d,0xc9))[_0x0f12('0x47')](handleError(_0x5b265d,null));};exports[_0x0f12('0x24')]=function(_0x1c6993,_0x31ecc6){if(_0x1c6993[_0x0f12('0x4e')]['id']){delete _0x1c6993[_0x0f12('0x4e')]['id'];}return db['AnalyticCustomReport'][_0x0f12('0x4c')]({'where':{'id':_0x1c6993[_0x0f12('0x49')]['id']}})[_0x0f12('0x26')](handleEntityNotFound(_0x31ecc6,null))[_0x0f12('0x26')](saveUpdates(_0x1c6993['body'],null))['then'](respondWithResult(_0x31ecc6,null))[_0x0f12('0x47')](handleError(_0x31ecc6,null));};exports[_0x0f12('0x25')]=function(_0x48b37,_0x36d0f7){return db[_0x0f12('0x2f')][_0x0f12('0x4c')]({'where':{'id':_0x48b37[_0x0f12('0x49')]['id']}})[_0x0f12('0x26')](handleEntityNotFound(_0x36d0f7,null))['then'](removeEntity(_0x36d0f7,null))[_0x0f12('0x47')](handleError(_0x36d0f7,null));};exports[_0x0f12('0x57')]=function(_0x5a074f,_0x3c2148){var _0x2ea5ea=0xa;var _0x17054a=['join',_0x0f12('0x58'),_0x0f12('0x59'),_0x0f12('0x5a')];var _0x2ca6bb={'SUM':_0x0f12('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0f12('0x5c'),'MAX':'MAX(%s)','MIN':_0x0f12('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0f12('0x5e'),'GROUP_CONCAT ASC':_0x0f12('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3d9828={'SEC_TO_TIME':_0x0f12('0x60'),'DATE':'DATE(%s)','HOUR':_0x0f12('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0f12('0x62')};var _0x59cd88=function(_0x1d6bb6){return!_[_0x0f12('0x63')]([_0x0f12('0x64'),'IS\x20NOT\x20NULL',_0x0f12('0x65'),_0x0f12('0x66')],_0x1d6bb6);};var _0x2cc2d6=function(_0x5cf716){if(!_0x5cf716||!_0x5cf716[_0x0f12('0x67')][_0x0f12('0x39')]){return'';}for(var _0x5bd898='(',_0x155ead=0x0;_0x155ead<_0x5cf716[_0x0f12('0x67')]['length'];_0x155ead+=0x1){_0x155ead>0x0&&(_0x5bd898+='\x20'+_0x5cf716[_0x0f12('0x68')]+'\x20');_0x5bd898+=_0x5cf716[_0x0f12('0x67')][_0x155ead][_0x0f12('0x69')]?_0x2cc2d6(_0x5cf716[_0x0f12('0x67')][_0x155ead][_0x0f12('0x69')]):_0x5cf716[_0x0f12('0x67')][_0x155ead][_0x0f12('0x6a')]+'\x20'+_0x5cf716[_0x0f12('0x67')][_0x155ead][_0x0f12('0x6b')]+(_0x59cd88(_0x5cf716[_0x0f12('0x67')][_0x155ead][_0x0f12('0x6b')])?'\x20'+_0x5cf716[_0x0f12('0x67')][_0x155ead]['value']:'');}return _0x5bd898+')';};var _0x10f7c3={'where':{'id':_0x5a074f[_0x0f12('0x49')]['id']}},_0x361dd5,_0x4661d4,_0x1f6c14,_0x42dfe6,_0x5b11f5;_0x10f7c3=_[_0x0f12('0x41')]({},_0x10f7c3,_0x5a074f[_0x0f12('0x4b')]);return db['AnalyticCustomReport'][_0x0f12('0x4c')](_0x10f7c3)['then'](function(_0x1970b0){if(_0x1970b0){_0x361dd5=_0x1970b0;return _0x1970b0[_0x0f12('0x6c')]();}return null;})[_0x0f12('0x26')](function(_0x517cd5){if(_0x517cd5){if(!_0x517cd5['length']){throw new db[(_0x0f12('0x6d'))]['ValidationErrorItem'](_0x0f12('0x6e'),0x193);}_0x4661d4=_0x517cd5;return db[_0x0f12('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x0f12('0x26')](function(_0x3da48a){if(_0x3da48a){_0x1f6c14=_[_0x0f12('0x70')](_0x3da48a,'id');var _0x516ddb;var _0x9b9c76=squel[_0x0f12('0x71')]();_0x9b9c76['from'](_0x361dd5[_0x0f12('0x72')]);for(var _0x140dd9=0x0;_0x140dd9<_0x4661d4[_0x0f12('0x39')];_0x140dd9+=0x1){_0x516ddb=_0x4661d4[_0x140dd9][_0x0f12('0x73')]?_0x1f6c14[_0x4661d4[_0x140dd9][_0x0f12('0x73')]][_0x0f12('0x74')]:_0x4661d4[_0x140dd9][_0x0f12('0x6a')];_0x516ddb=_0x4661d4[_0x140dd9][_0x0f12('0x75')]?_[_0x0f12('0x76')](_0x2ca6bb[_0x4661d4[_0x140dd9][_0x0f12('0x75')]],'%s',_0x516ddb):_0x516ddb;_0x516ddb=_0x4661d4[_0x140dd9][_0x0f12('0x77')]?_['replace'](_0x3d9828[_0x4661d4[_0x140dd9][_0x0f12('0x77')]],'%s',_0x516ddb):_0x516ddb;if(_0x4661d4[_0x140dd9]['groupBy']){_0x9b9c76[_0x0f12('0x69')](_0x516ddb);}_0x4661d4[_0x140dd9][_0x0f12('0x78')]&&_0x9b9c76[_0x0f12('0x3b')](_0x516ddb,_0x4661d4[_0x140dd9]['orderBy']===_0x0f12('0x79')?![]:!![]);_0x9b9c76[_0x0f12('0x6a')](_0x516ddb,_0x4661d4[_0x140dd9][_0x0f12('0x7a')]||_0x516ddb);}if(_0x361dd5[_0x0f12('0x7b')]){_0x361dd5[_0x0f12('0x7b')]=JSON[_0x0f12('0x7c')](_0x361dd5[_0x0f12('0x7b')]);for(var _0x269746=0x0;_0x269746<_0x361dd5['joins'][_0x0f12('0x39')];_0x269746+=0x1){if(_0x361dd5[_0x0f12('0x7b')][_0x269746][_0x0f12('0x31')]&&_[_0x0f12('0x63')](_0x17054a,_0x361dd5[_0x0f12('0x7b')][_0x269746][_0x0f12('0x31')])&&_0x361dd5[_0x0f12('0x7b')][_0x269746][_0x0f12('0x7d')]&&_0x361dd5[_0x0f12('0x7b')][_0x269746]['foreignTable']&&_0x361dd5['joins'][_0x269746][_0x0f12('0x7e')]){_0x9b9c76[_0x361dd5[_0x0f12('0x7b')][_0x269746][_0x0f12('0x31')]](_0x361dd5[_0x0f12('0x7b')][_0x269746]['foreignTable'],null,util[_0x0f12('0x77')](_0x0f12('0x7f'),_0x361dd5[_0x0f12('0x72')],_0x361dd5['joins'][_0x269746][_0x0f12('0x7d')],_0x361dd5[_0x0f12('0x7b')][_0x269746][_0x0f12('0x80')],_0x361dd5[_0x0f12('0x7b')][_0x269746][_0x0f12('0x7e')]));}}}if(_0x361dd5[_0x0f12('0x81')]){_0x361dd5['conditions']=JSON[_0x0f12('0x7c')](_0x361dd5[_0x0f12('0x81')]);_0x9b9c76[_0x0f12('0x3d')](_0x2cc2d6(_0x361dd5['conditions'][_0x0f12('0x69')]));}_0x5b11f5=_0x9b9c76[_0x0f12('0x82')]();_0x9b9c76[_0x0f12('0x20')](_0x2ea5ea);_0x9b9c76[_0x0f12('0x1f')](0x0);logger[_0x0f12('0x83')](_0x0f12('0x84'),_0x9b9c76['toString']());return db[_0x0f12('0x85')][_0x0f12('0x34')](_0x9b9c76['toString'](),{'type':db[_0x0f12('0x85')][_0x0f12('0x86')][_0x0f12('0x87')]});}})[_0x0f12('0x26')](respondWithResult(_0x3c2148,null))[_0x0f12('0x47')](handleError(_0x3c2148,null));};function runReport(_0x66e786,_0x4295de,_0x147655){var _0x5a4449=_0x4295de['name'];var _0x14beb3=0xa;var _0x1782a9=[_0x0f12('0x88'),_0x0f12('0x58'),'right_join','cross_join'];var _0x45c028={'SUM':_0x0f12('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0f12('0x5c'),'MAX':'MAX(%s)','MIN':_0x0f12('0x5d'),'AVG':_0x0f12('0x89'),'GROUP_CONCAT':_0x0f12('0x5e'),'GROUP_CONCAT ASC':_0x0f12('0x5f'),'GROUP_CONCAT DESC':_0x0f12('0x8a')};var _0x5a3363={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0f12('0x8b'),'HOUR':_0x0f12('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0f12('0x62')};var _0x21764b=function(_0x130b70){return!_[_0x0f12('0x63')](['IS\x20NULL',_0x0f12('0x8c'),_0x0f12('0x65'),_0x0f12('0x66')],_0x130b70);};var _0x5ca7d5=function(_0x437d39){if(!_0x437d39||!_0x437d39[_0x0f12('0x67')]['length']){return'';}for(var _0xb9e69d='(',_0x10741f=0x0;_0x10741f<_0x437d39[_0x0f12('0x67')]['length'];_0x10741f+=0x1){_0x10741f>0x0&&(_0xb9e69d+='\x20'+_0x437d39['operator']+'\x20');_0xb9e69d+=_0x437d39[_0x0f12('0x67')][_0x10741f][_0x0f12('0x69')]?_0x5ca7d5(_0x437d39[_0x0f12('0x67')][_0x10741f][_0x0f12('0x69')]):_0x437d39[_0x0f12('0x67')][_0x10741f][_0x0f12('0x6a')]+'\x20'+_0x437d39[_0x0f12('0x67')][_0x10741f][_0x0f12('0x6b')]+(_0x21764b(_0x437d39[_0x0f12('0x67')][_0x10741f][_0x0f12('0x6b')])?'\x20'+_0x437d39['rules'][_0x10741f][_0x0f12('0x8d')]:'');}return _0xb9e69d+')';};var _0x1c0610={'where':{'id':_0x66e786['id']}},_0x404bc7,_0x3c7ac0,_0x322067,_0x3241c3,_0x6b25ac;_0x1c0610=_[_0x0f12('0x41')]({},_0x1c0610,_0x147655);return db[_0x0f12('0x2f')]['find'](_0x1c0610)['then'](function(_0x69764f){if(_0x69764f){_0x404bc7=_0x69764f;return _0x69764f[_0x0f12('0x6c')]();}return null;})[_0x0f12('0x26')](function(_0x45f94f){if(_0x45f94f){if(!_0x45f94f[_0x0f12('0x39')]){throw new db['Sequelize'][(_0x0f12('0x8e'))](_0x0f12('0x6e'),0x193);}_0x3c7ac0=_0x45f94f;return db['AnalyticMetric'][_0x0f12('0x45')]({'raw':!![]});}return null;})[_0x0f12('0x26')](function(_0x362830){if(_0x362830){_0x322067=_[_0x0f12('0x70')](_0x362830,'id');var _0x1cf783;var _0x2e96ee=squel[_0x0f12('0x71')]();_0x2e96ee['from'](_0x404bc7[_0x0f12('0x72')]);for(var _0x4d34da=0x0;_0x4d34da<_0x3c7ac0['length'];_0x4d34da+=0x1){_0x1cf783=_0x3c7ac0[_0x4d34da][_0x0f12('0x73')]?_0x322067[_0x3c7ac0[_0x4d34da][_0x0f12('0x73')]][_0x0f12('0x74')]:_0x3c7ac0[_0x4d34da][_0x0f12('0x6a')];_0x1cf783=_0x3c7ac0[_0x4d34da][_0x0f12('0x75')]?_['replace'](_0x45c028[_0x3c7ac0[_0x4d34da][_0x0f12('0x75')]],'%s',_0x1cf783):_0x1cf783;_0x1cf783=_0x3c7ac0[_0x4d34da][_0x0f12('0x77')]?_['replace'](_0x5a3363[_0x3c7ac0[_0x4d34da][_0x0f12('0x77')]],'%s',_0x1cf783):_0x1cf783;if(_0x3c7ac0[_0x4d34da]['groupBy']){_0x2e96ee['group'](_0x1cf783);}_0x3c7ac0[_0x4d34da][_0x0f12('0x78')]&&_0x2e96ee[_0x0f12('0x3b')](_0x1cf783,_0x3c7ac0[_0x4d34da][_0x0f12('0x78')]===_0x0f12('0x79')?![]:!![]);_0x2e96ee[_0x0f12('0x6a')](_0x1cf783,_0x3c7ac0[_0x4d34da]['alias']||_0x1cf783);}if(_0x404bc7[_0x0f12('0x7b')]){_0x404bc7[_0x0f12('0x7b')]=JSON[_0x0f12('0x7c')](_0x404bc7[_0x0f12('0x7b')]);for(var _0x5ac359=0x0;_0x5ac359<_0x404bc7['joins'][_0x0f12('0x39')];_0x5ac359+=0x1){if(_0x404bc7['joins'][_0x5ac359][_0x0f12('0x31')]&&_[_0x0f12('0x63')](_0x1782a9,_0x404bc7['joins'][_0x5ac359][_0x0f12('0x31')])&&_0x404bc7[_0x0f12('0x7b')][_0x5ac359][_0x0f12('0x7d')]&&_0x404bc7['joins'][_0x5ac359][_0x0f12('0x80')]&&_0x404bc7[_0x0f12('0x7b')][_0x5ac359][_0x0f12('0x7e')]){_0x2e96ee[_0x404bc7[_0x0f12('0x7b')][_0x5ac359]['type']](_0x404bc7[_0x0f12('0x7b')][_0x5ac359][_0x0f12('0x80')],null,util[_0x0f12('0x77')](_0x0f12('0x7f'),_0x404bc7[_0x0f12('0x72')],_0x404bc7[_0x0f12('0x7b')][_0x5ac359][_0x0f12('0x7d')],_0x404bc7[_0x0f12('0x7b')][_0x5ac359][_0x0f12('0x80')],_0x404bc7[_0x0f12('0x7b')][_0x5ac359][_0x0f12('0x7e')]));}}}if(_0x404bc7[_0x0f12('0x81')]){_0x404bc7['conditions']=JSON[_0x0f12('0x7c')](_0x404bc7[_0x0f12('0x81')]);_0x2e96ee[_0x0f12('0x3d')](_0x5ca7d5(_0x404bc7[_0x0f12('0x81')][_0x0f12('0x69')]));}_0x6b25ac=_0x2e96ee[_0x0f12('0x82')]();_0x2e96ee['limit'](_0x14beb3);_0x2e96ee[_0x0f12('0x1f')](0x0);logger['debug'](_0x0f12('0x84'),_0x2e96ee[_0x0f12('0x8f')]());return db['sequelize'][_0x0f12('0x34')](_0x2e96ee[_0x0f12('0x8f')](),{'type':db[_0x0f12('0x85')]['QueryTypes'][_0x0f12('0x87')]});}})[_0x0f12('0x26')](function(_0xa9d5b6){if(!_0xa9d5b6[_0x0f12('0x39')]){throw new db[(_0x0f12('0x6d'))][(_0x0f12('0x8e'))](_0x0f12('0x90'),0xcc);}if(_0x4295de[_0x0f12('0x91')]===_0x0f12('0x92')){return null;}var _0x373dd2=_[_0x0f12('0x41')](_0x4295de,{'name':_0x4295de[_0x0f12('0x93')]||_0x4295de[_0x0f12('0x2b')]||_0x404bc7[_0x0f12('0x2b')],'basename':_0x5a4449,'savename':util[_0x0f12('0x77')](_0x0f12('0x94'),_0x4295de['name']||_0x404bc7['name'],require(_0x0f12('0x95'))[_0x0f12('0x96')](0x4),_0x4295de[_0x0f12('0x91')]||'csv'),'reportId':_0x404bc7['id'],'reportType':_0x0f12('0x97')});return db[_0x0f12('0x98')][_0x0f12('0x4d')](_0x373dd2,{'raw':!![]});})['then'](function(_0x2735a3){if(_0x404bc7[_0x0f12('0x72')]==='cdr'){_0x6b25ac[_0x0f12('0x3d')](_0x404bc7[_0x0f12('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4295de['startDate'],_0x4295de[_0x0f12('0x99')]);}else{_0x6b25ac[_0x0f12('0x3d')](_0x404bc7['table']+_0x0f12('0x9a'),_0x4295de['startDate'],_0x4295de[_0x0f12('0x99')]);}if(_0x2735a3){logger[_0x0f12('0x9b')](_0x0f12('0x9c'),_0x6b25ac[_0x0f12('0x8f')]());require(_0x0f12('0x9d'))[_0x0f12('0x9e')](path[_0x0f12('0x88')](__dirname,'../../components/export/',_0x2735a3[_0x0f12('0x91')]),[_0x2735a3['id'],_0x6b25ac[_0x0f12('0x8f')](),path['join'](__dirname,_0x0f12('0x9f'),_0x2735a3[_0x0f12('0xa0')]),_0x5a4449]);return _0x2735a3;}else{var _0x31b6dc=squel[_0x0f12('0x71')]();_0x31b6dc[_0x0f12('0xa1')]('('+_0x6b25ac[_0x0f12('0x8f')]()+')','countTable');_0x31b6dc[_0x0f12('0x6a')]('COUNT(*)',_0x0f12('0x1e'));_0x6b25ac[_0x0f12('0x20')](_0x4295de['limit']||_0x14beb3);_0x6b25ac[_0x0f12('0x1f')](_0x4295de['offset']||0x0);return dbH[_0x0f12('0x85')][_0x0f12('0x34')](_0x31b6dc[_0x0f12('0x8f')](),{'type':dbH[_0x0f12('0x85')][_0x0f12('0x86')][_0x0f12('0x87')]})[_0x0f12('0x26')](function(_0x2ccec6){if(!_0x2ccec6['length']){_0x3241c3=0x0;}else{_0x3241c3=_0x2ccec6[0x0][_0x0f12('0x1e')]||0x0;}return dbH['sequelize']['query'](_0x6b25ac[_0x0f12('0x8f')](),{'type':dbH[_0x0f12('0x85')][_0x0f12('0x86')]['SELECT']});})[_0x0f12('0x26')](function(_0x299adf){return{'rows':_0x299adf||[],'count':_0x3241c3};});}});}exports[_0x0f12('0xa2')]=function(_0x27293f,_0x2cb537){return runReport(_0x27293f[_0x0f12('0x49')],_0x27293f['query'],_0x27293f[_0x0f12('0x4b')])['then'](respondWithResult(_0x2cb537,null))['catch'](handleError(_0x2cb537,null));};exports[_0x0f12('0xa3')]=runReport;exports[_0x0f12('0x34')]=function(_0x59336f,_0x2a5ba8){var _0x4e38b7=0xa;var _0x3c6ade=['join','left_join',_0x0f12('0x59'),'cross_join'];var _0x3488c0={'SUM':_0x0f12('0x5b'),'COUNT':_0x0f12('0xa4'),'COUNT DISTINCT':_0x0f12('0x5c'),'MAX':_0x0f12('0xa5'),'MIN':_0x0f12('0x5d'),'AVG':_0x0f12('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0f12('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x155dc2={'SEC_TO_TIME':_0x0f12('0x60'),'DATE':_0x0f12('0x8b'),'HOUR':_0x0f12('0x61'),'ROUND':_0x0f12('0xa6'),'UNIX_TIMESTAMP':_0x0f12('0x62')};var _0x136a05=function(_0x112b4b){return!_[_0x0f12('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x0f12('0x65'),_0x0f12('0x66')],_0x112b4b);};var _0x1cb885=function(_0x47a38c){if(!_0x47a38c||!_0x47a38c[_0x0f12('0x67')]['length']){return'';}for(var _0x5b5664='(',_0x221fd4=0x0;_0x221fd4<_0x47a38c['rules'][_0x0f12('0x39')];_0x221fd4+=0x1){_0x221fd4>0x0&&(_0x5b5664+='\x20'+_0x47a38c[_0x0f12('0x68')]+'\x20');_0x5b5664+=_0x47a38c['rules'][_0x221fd4][_0x0f12('0x69')]?_0x1cb885(_0x47a38c[_0x0f12('0x67')][_0x221fd4]['group']):_0x47a38c['rules'][_0x221fd4]['field']+'\x20'+_0x47a38c[_0x0f12('0x67')][_0x221fd4]['condition']+(_0x136a05(_0x47a38c['rules'][_0x221fd4][_0x0f12('0x6b')])?'\x20'+_0x47a38c[_0x0f12('0x67')][_0x221fd4]['value']:'');}return _0x5b5664+')';};var _0x18d3c0={'where':{'id':_0x59336f['params']['id']}},_0x32e1bb,_0x3fecc7,_0x1aba9f,_0x119be2,_0x1d5df9;_0x18d3c0=_[_0x0f12('0x41')]({},_0x18d3c0,_0x59336f[_0x0f12('0x4b')]);return db[_0x0f12('0x2f')][_0x0f12('0x4c')](_0x18d3c0)[_0x0f12('0x26')](function(_0x2b988f){if(_0x2b988f){_0x32e1bb=_0x2b988f;return _0x2b988f[_0x0f12('0x6c')]();}return null;})['then'](function(_0x2572cd){if(_0x2572cd){if(!_0x2572cd['length']){throw new db[(_0x0f12('0x6d'))][(_0x0f12('0x8e'))](_0x0f12('0x6e'),0x193);}_0x3fecc7=_0x2572cd;return db['AnalyticMetric'][_0x0f12('0x45')]({'raw':!![]});}return null;})[_0x0f12('0x26')](function(_0xa4e9cf){if(_0xa4e9cf){_0x1aba9f=_[_0x0f12('0x70')](_0xa4e9cf,'id');var _0x3a9188;var _0x2178bd=squel['select']();_0x2178bd['from'](_0x32e1bb[_0x0f12('0x72')]);for(var _0x5ba504=0x0;_0x5ba504<_0x3fecc7[_0x0f12('0x39')];_0x5ba504+=0x1){_0x3a9188=_0x3fecc7[_0x5ba504]['MetricId']?_0x1aba9f[_0x3fecc7[_0x5ba504]['MetricId']][_0x0f12('0x74')]:_0x3fecc7[_0x5ba504]['field'];_0x3a9188=_0x3fecc7[_0x5ba504][_0x0f12('0x75')]?_['replace'](_0x3488c0[_0x3fecc7[_0x5ba504][_0x0f12('0x75')]],'%s',_0x3a9188):_0x3a9188;_0x3a9188=_0x3fecc7[_0x5ba504][_0x0f12('0x77')]?_[_0x0f12('0x76')](_0x155dc2[_0x3fecc7[_0x5ba504][_0x0f12('0x77')]],'%s',_0x3a9188):_0x3a9188;if(_0x3fecc7[_0x5ba504][_0x0f12('0xa7')]){_0x2178bd[_0x0f12('0x69')](_0x3a9188);}_0x3fecc7[_0x5ba504][_0x0f12('0x78')]&&_0x2178bd[_0x0f12('0x3b')](_0x3a9188,_0x3fecc7[_0x5ba504][_0x0f12('0x78')]===_0x0f12('0x79')?![]:!![]);_0x2178bd[_0x0f12('0x6a')](_0x3a9188,_0x3fecc7[_0x5ba504][_0x0f12('0x7a')]||_0x3a9188);}if(_0x32e1bb[_0x0f12('0x7b')]){_0x32e1bb[_0x0f12('0x7b')]=JSON[_0x0f12('0x7c')](_0x32e1bb[_0x0f12('0x7b')]);for(var _0xa21284=0x0;_0xa21284<_0x32e1bb[_0x0f12('0x7b')][_0x0f12('0x39')];_0xa21284+=0x1){if(_0x32e1bb[_0x0f12('0x7b')][_0xa21284][_0x0f12('0x31')]&&_[_0x0f12('0x63')](_0x3c6ade,_0x32e1bb[_0x0f12('0x7b')][_0xa21284]['type'])&&_0x32e1bb[_0x0f12('0x7b')][_0xa21284]['parentKey']&&_0x32e1bb[_0x0f12('0x7b')][_0xa21284]['foreignTable']&&_0x32e1bb[_0x0f12('0x7b')][_0xa21284][_0x0f12('0x7e')]){_0x2178bd[_0x32e1bb[_0x0f12('0x7b')][_0xa21284][_0x0f12('0x31')]](_0x32e1bb[_0x0f12('0x7b')][_0xa21284][_0x0f12('0x80')],null,util[_0x0f12('0x77')]('%s.%s\x20=\x20%s.%s',_0x32e1bb[_0x0f12('0x72')],_0x32e1bb['joins'][_0xa21284][_0x0f12('0x7d')],_0x32e1bb[_0x0f12('0x7b')][_0xa21284][_0x0f12('0x80')],_0x32e1bb[_0x0f12('0x7b')][_0xa21284][_0x0f12('0x7e')]));}}}if(_0x32e1bb['conditions']){_0x32e1bb['conditions']=JSON[_0x0f12('0x7c')](_0x32e1bb[_0x0f12('0x81')]);_0x2178bd[_0x0f12('0x3d')](_0x1cb885(_0x32e1bb['conditions']['group']));}_0x1d5df9=_0x2178bd[_0x0f12('0x82')]();_0x2178bd['limit'](_0x4e38b7);_0x2178bd[_0x0f12('0x1f')](0x0);logger[_0x0f12('0x83')](_0x0f12('0x84'),_0x2178bd['toString']());return db['sequelize'][_0x0f12('0x34')](_0x2178bd[_0x0f12('0x8f')](),{'type':db[_0x0f12('0x85')][_0x0f12('0x86')]['SELECT']});}})[_0x0f12('0x26')](function(){return{'sql':_0x1d5df9[_0x0f12('0x8f')]()};})['then'](respondWithResult(_0x2a5ba8,null))['catch'](handleError(_0x2a5ba8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 06c8c03..904ba41 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 _0x1ab7=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x518e12,_0x3491ad){var _0x1da7ff=function(_0x528771){while(--_0x528771){_0x518e12['push'](_0x518e12['shift']());}};_0x1da7ff(++_0x3491ad);}(_0x1ab7,0x17d));var _0x71ab=function(_0x2d9da3,_0x63174d){_0x2d9da3=_0x2d9da3-0x0;var _0x2a8d6a=_0x1ab7[_0x2d9da3];return _0x2a8d6a;};'use strict';var _=require(_0x71ab('0x0'));var util=require(_0x71ab('0x1'));var logger=require(_0x71ab('0x2'))('api');var moment=require(_0x71ab('0x3'));var BPromise=require(_0x71ab('0x4'));var rp=require(_0x71ab('0x5'));var fs=require('fs');var path=require(_0x71ab('0x6'));var rimraf=require(_0x71ab('0x7'));var config=require(_0x71ab('0x8'));var attributes=require(_0x71ab('0x9'));module[_0x71ab('0xa')]=function(_0x5424b7,_0x4d8087){return _0x5424b7[_0x71ab('0xb')](_0x71ab('0xc'),attributes,{'tableName':_0x71ab('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb201=['../../config/logger','api','bluebird','request-promise','path','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb201,0x117));var _0x1b20=function(_0x41aa7e,_0x325838){_0x41aa7e=_0x41aa7e-0x0;var _0x314671=_0xb201[_0x41aa7e];return _0x314671;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var logger=require(_0x1b20('0x1'))(_0x1b20('0x2'));var moment=require('moment');var BPromise=require(_0x1b20('0x3'));var rp=require(_0x1b20('0x4'));var fs=require('fs');var path=require(_0x1b20('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b20('0x6'));module[_0x1b20('0x7')]=function(_0x5836c2,_0x14f112){return _0x5836c2['define'](_0x1b20('0x8'),attributes,{'tableName':_0x1b20('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index eea895f..ff0699f 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 _0xe788=['debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe788,0x1b7));var _0x8e78=function(_0xce80db,_0x199dd9){_0xce80db=_0xce80db-0x0;var _0x1fc16f=_0xe788[_0xce80db];return _0x1fc16f;};'use strict';var _=require('lodash');var util=require(_0x8e78('0x0'));var moment=require('moment');var BPromise=require(_0x8e78('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e78('0x2'));var db=require(_0x8e78('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8e78('0x4'));var client=jayson[_0x8e78('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a073b,_0x54c8a8,_0x3c25ce){return new BPromise(function(_0x410108,_0x155e47){return client[_0x8e78('0x6')](_0x5a073b,_0x3c25ce)[_0x8e78('0x7')](function(_0x3eb71){logger[_0x8e78('0x8')](_0x8e78('0x9'),_0x54c8a8,_0x8e78('0xa'));logger[_0x8e78('0xb')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x54c8a8,_0x8e78('0xa'),JSON[_0x8e78('0xc')](_0x3eb71));if(_0x3eb71[_0x8e78('0xd')]){if(_0x3eb71[_0x8e78('0xd')][_0x8e78('0xe')]===0x1f4){logger[_0x8e78('0xd')](_0x8e78('0x9'),_0x54c8a8,_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);return _0x155e47(_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);}logger[_0x8e78('0xd')](_0x8e78('0x9'),_0x54c8a8,_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);return _0x410108(_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);}else{logger[_0x8e78('0x8')](_0x8e78('0x9'),_0x54c8a8,_0x8e78('0xa'));_0x410108(_0x3eb71[_0x8e78('0x10')][_0x8e78('0xf')]);}})[_0x8e78('0x11')](function(_0x20a091){logger['error'](_0x8e78('0x9'),_0x54c8a8,_0x20a091);_0x155e47(_0x20a091);});});} \ No newline at end of file +var _0x0273=['client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xe22416,_0x1baa24){var _0x794ae2=function(_0x7818ec){while(--_0x7818ec){_0xe22416['push'](_0xe22416['shift']());}};_0x794ae2(++_0x1baa24);}(_0x0273,0xa8));var _0x3027=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0273[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x3027('0x0'));var moment=require(_0x3027('0x1'));var BPromise=require(_0x3027('0x2'));var rs=require(_0x3027('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3027('0x4'))(_0x3027('0x5'));var config=require(_0x3027('0x6'));var jayson=require(_0x3027('0x7'));var client=jayson[_0x3027('0x8')][_0x3027('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35afb2,_0x4c0765,_0x2f2378){return new BPromise(function(_0x60c0f5,_0x503f66){return client[_0x3027('0xa')](_0x35afb2,_0x2f2378)[_0x3027('0xb')](function(_0x541aca){logger['info'](_0x3027('0xc'),_0x4c0765,_0x3027('0xd'));logger[_0x3027('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4c0765,_0x3027('0xd'),JSON[_0x3027('0xf')](_0x541aca));if(_0x541aca[_0x3027('0x10')]){if(_0x541aca[_0x3027('0x10')][_0x3027('0x11')]===0x1f4){logger[_0x3027('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4c0765,_0x541aca[_0x3027('0x10')][_0x3027('0x12')]);return _0x503f66(_0x541aca[_0x3027('0x10')][_0x3027('0x12')]);}logger[_0x3027('0x10')](_0x3027('0xc'),_0x4c0765,_0x541aca['error'][_0x3027('0x12')]);return _0x60c0f5(_0x541aca[_0x3027('0x10')][_0x3027('0x12')]);}else{logger[_0x3027('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4c0765,'request\x20sent');_0x60c0f5(_0x541aca[_0x3027('0x14')][_0x3027('0x12')]);}})[_0x3027('0x15')](function(_0x92aa04){logger['error'](_0x3027('0xc'),_0x4c0765,_0x92aa04);_0x503f66(_0x92aa04);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 140c402..08e0ecb 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 _0xbf78=['../../config/environment','./analyticCustomReport.controller','get','index','show','isAuthenticated','preview','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xbf78,0xda));var _0x8bf7=function(_0x176820,_0x38d7e7){_0x176820=_0x176820-0x0;var _0x53a7f0=_0xbf78[_0x176820];return _0x53a7f0;};'use strict';var multer=require(_0x8bf7('0x0'));var util=require(_0x8bf7('0x1'));var path=require(_0x8bf7('0x2'));var timeout=require(_0x8bf7('0x3'));var express=require(_0x8bf7('0x4'));var router=express[_0x8bf7('0x5')]();var auth=require(_0x8bf7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8bf7('0x7'));var controller=require(_0x8bf7('0x8'));router[_0x8bf7('0x9')]('/',auth['isAuthenticated'](),controller[_0x8bf7('0xa')]);router[_0x8bf7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8bf7('0xb')]);router[_0x8bf7('0x9')]('/:id/preview',auth[_0x8bf7('0xc')](),controller[_0x8bf7('0xd')]);router[_0x8bf7('0x9')]('/:id/run',auth[_0x8bf7('0xc')](),controller[_0x8bf7('0xe')]);router['get'](_0x8bf7('0xf'),auth[_0x8bf7('0xc')](),controller[_0x8bf7('0x10')]);router[_0x8bf7('0x11')]('/',auth[_0x8bf7('0xc')](),controller[_0x8bf7('0x12')]);router[_0x8bf7('0x13')](_0x8bf7('0x14'),auth[_0x8bf7('0xc')](),controller[_0x8bf7('0x15')]);router[_0x8bf7('0x16')](_0x8bf7('0x14'),auth['isAuthenticated'](),controller[_0x8bf7('0x17')]);module[_0x8bf7('0x18')]=router; \ No newline at end of file +var _0x398b=['show','/:id/preview','/:id/run','post','create','put','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x43a51c,_0xfe6cb){var _0x2aa067=function(_0x258256){while(--_0x258256){_0x43a51c['push'](_0x43a51c['shift']());}};_0x2aa067(++_0xfe6cb);}(_0x398b,0x1e9));var _0xb398=function(_0x11731f,_0x2271b5){_0x11731f=_0x11731f-0x0;var _0x14587c=_0x398b[_0x11731f];return _0x14587c;};'use strict';var multer=require('multer');var util=require(_0xb398('0x0'));var path=require(_0xb398('0x1'));var timeout=require('connect-timeout');var express=require(_0xb398('0x2'));var router=express[_0xb398('0x3')]();var auth=require(_0xb398('0x4'));var interaction=require(_0xb398('0x5'));var config=require('../../config/environment');var controller=require(_0xb398('0x6'));router[_0xb398('0x7')]('/',auth[_0xb398('0x8')](),controller[_0xb398('0x9')]);router[_0xb398('0x7')](_0xb398('0xa'),auth[_0xb398('0x8')](),controller[_0xb398('0xb')]);router[_0xb398('0x7')](_0xb398('0xc'),auth[_0xb398('0x8')](),controller['preview']);router[_0xb398('0x7')](_0xb398('0xd'),auth[_0xb398('0x8')](),controller['run']);router[_0xb398('0x7')]('/:id/query',auth[_0xb398('0x8')](),controller['query']);router[_0xb398('0xe')]('/',auth['isAuthenticated'](),controller[_0xb398('0xf')]);router[_0xb398('0x10')](_0xb398('0xa'),auth[_0xb398('0x8')](),controller[_0xb398('0x11')]);router[_0xb398('0x12')](_0xb398('0xa'),auth[_0xb398('0x8')](),controller[_0xb398('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e9413c6..7200d3d 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 _0x5c56=['TEXT','sequelize','STRING'];(function(_0x1c31fc,_0x39514d){var _0x400ade=function(_0x32e2e1){while(--_0x32e2e1){_0x1c31fc['push'](_0x1c31fc['shift']());}};_0x400ade(++_0x39514d);}(_0x5c56,0x169));var _0x65c5=function(_0x293e45,_0x559614){_0x293e45=_0x293e45-0x0;var _0x4df8d8=_0x5c56[_0x293e45];return _0x4df8d8;};'use strict';var Sequelize=require(_0x65c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x65c5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x65c5('0x1')]},'parent':{'type':Sequelize[_0x65c5('0x1')]},'table':{'type':Sequelize[_0x65c5('0x1')]},'conditions':{'type':Sequelize[_0x65c5('0x2')]},'joins':{'type':Sequelize[_0x65c5('0x2')]}}; \ No newline at end of file +var _0x6081=['STRING','TEXT','sequelize','exports'];(function(_0x44f79f,_0x5a5ccf){var _0x413d35=function(_0x237f47){while(--_0x237f47){_0x44f79f['push'](_0x44f79f['shift']());}};_0x413d35(++_0x5a5ccf);}(_0x6081,0x176));var _0x1608=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6081[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1608('0x0'));module[_0x1608('0x1')]={'name':{'type':Sequelize[_0x1608('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x1608('0x2')]},'table':{'type':Sequelize[_0x1608('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x1608('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a685835..a3526bf 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 _0xe5ed=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','DefaultReports','end','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','getFields','keyBy','web','fullPath','%s-%s.%s','generate','output','csv','default','AnalyticExtractedReport','startDate','endDate','Run\x20Query:','fork','../../components/export/','../../files/reports','from','countTable','COUNT(*)','count','run','runReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1cc1f4,_0x1aecb8){var _0x16efd2=function(_0x50c4c4){while(--_0x50c4c4){_0x1cc1f4['push'](_0x1cc1f4['shift']());}};_0x16efd2(++_0x1aecb8);}(_0xe5ed,0x134));var _0xde5e=function(_0x38c3cd,_0x1e14dd){_0x38c3cd=_0x38c3cd-0x0;var _0x2afec4=_0xe5ed[_0x38c3cd];return _0x2afec4;};'use strict';var pdf=require(_0xde5e('0x0'));var emlformat=require(_0xde5e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xde5e('0x2'));var jsonpatch=require(_0xde5e('0x3'));var rp=require(_0xde5e('0x4'));var moment=require(_0xde5e('0x5'));var BPromise=require(_0xde5e('0x6'));var Mustache=require('mustache');var util=require(_0xde5e('0x7'));var path=require(_0xde5e('0x8'));var sox=require(_0xde5e('0x9'));var csv=require(_0xde5e('0xa'));var ejs=require(_0xde5e('0xb'));var fs=require('fs');var _=require(_0xde5e('0xc'));var squel=require(_0xde5e('0xd'));var crypto=require(_0xde5e('0xe'));var jsforce=require(_0xde5e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xde5e('0xa'));var querystring=require('querystring');var Papa=require(_0xde5e('0x10'));var Redis=require(_0xde5e('0x11'));var authService=require(_0xde5e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde5e('0x13'));var hardwareService=require(_0xde5e('0x14'));var logger=require(_0xde5e('0x15'))(_0xde5e('0x16'));var utils=require('../../config/utils');var config=require(_0xde5e('0x17'));var db=require(_0xde5e('0x18'))['db'];var dbH=require('../../mysqldb')[_0xde5e('0x19')];function respondWithStatusCode(_0x1ac059,_0x4c1983){_0x4c1983=_0x4c1983||0xcc;return function(_0x21172b){if(_0x21172b){return _0x1ac059[_0xde5e('0x1a')](_0x4c1983);}return _0x1ac059[_0xde5e('0x1b')](_0x4c1983)['end']();};}function respondWithResult(_0x189290,_0x2b61d6){_0x2b61d6=_0x2b61d6||0xc8;return function(_0x4da468){if(_0x4da468){return _0x189290[_0xde5e('0x1b')](_0x2b61d6)['json'](_0x4da468);}};}function respondWithFilteredResult(_0x5a9ba6,_0x461bea){return function(_0x57d32e){if(_0x57d32e){var _0x3e7af4=_0x57d32e['count'],_0x373a08=_0x461bea[_0xde5e('0x1c')],_0x539bc4=_0x461bea[_0xde5e('0x1c')]+_0x461bea[_0xde5e('0x1d')],_0x22c5bf;if(_0x539bc4>=_0x3e7af4){_0x539bc4=_0x3e7af4;_0x22c5bf=0xc8;}else{_0x22c5bf=0xce;}_0x5a9ba6[_0xde5e('0x1b')](_0x22c5bf);return _0x5a9ba6[_0xde5e('0x1e')](_0xde5e('0x1f'),_0x373a08+'-'+_0x539bc4+'/'+_0x3e7af4)[_0xde5e('0x20')](_0x57d32e);}return null;};}function patchUpdates(_0x539b03){return function(_0x3b6fbf){try{jsonpatch[_0xde5e('0x21')](_0x3b6fbf,_0x539b03,!![]);}catch(_0x533546){return BPromise[_0xde5e('0x22')](_0x533546);}return _0x3b6fbf[_0xde5e('0x23')]();};}function saveUpdates(_0xe46dbd,_0x195761){return function(_0x7495f8){if(_0x7495f8){return _0x7495f8[_0xde5e('0x24')](_0xe46dbd)[_0xde5e('0x25')](function(_0x59e51e){return _0x59e51e;});}return null;};}function removeEntity(_0x56a86c,_0x11c962){return function(_0x3fe3e7){if(_0x3fe3e7){return _0x3fe3e7['destroy']()['then'](function(){var _0x2b4024=_0x3fe3e7[_0xde5e('0x26')]({'plain':!![]});var _0x44e273=_0xde5e('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x44e273,'resourceId':_0x2b4024['id']}})[_0xde5e('0x25')](function(){return _0x3fe3e7;});})[_0xde5e('0x25')](function(){_0x56a86c[_0xde5e('0x1b')](0xcc)[_0xde5e('0x28')]();});}};}function handleEntityNotFound(_0x3c9cc9,_0x5a5212){return function(_0x482afe){if(!_0x482afe){_0x3c9cc9[_0xde5e('0x1a')](0x194);}return _0x482afe;};}function handleError(_0x1358f5,_0x59d9dc){_0x59d9dc=_0x59d9dc||0x1f4;return function(_0x2d75a0){logger[_0xde5e('0x29')](_0x2d75a0[_0xde5e('0x2a')]);if(_0x2d75a0['name']){delete _0x2d75a0[_0xde5e('0x2b')];}_0x1358f5['status'](_0x59d9dc)['send'](_0x2d75a0);};}exports[_0xde5e('0x2c')]=function(_0x2543fe,_0x5c395f){var _0x1e0a6a={},_0x1bb24b={},_0x4137c0={'count':0x0,'rows':[]};var _0x15ac8b=_[_0xde5e('0x2d')](db[_0xde5e('0x2e')][_0xde5e('0x2f')],function(_0x5b3b01){return{'name':_0x5b3b01['fieldName'],'type':_0x5b3b01['type'][_0xde5e('0x30')]};});_0x1bb24b[_0xde5e('0x31')]=_[_0xde5e('0x2d')](_0x15ac8b,_0xde5e('0x2b'));_0x1bb24b[_0xde5e('0x32')]=_[_0xde5e('0x33')](_0x2543fe[_0xde5e('0x32')]);_0x1bb24b[_0xde5e('0x34')]=_['intersection'](_0x1bb24b['model'],_0x1bb24b[_0xde5e('0x32')]);_0x1e0a6a['attributes']=_[_0xde5e('0x35')](_0x1bb24b[_0xde5e('0x31')],qs['fields'](_0x2543fe[_0xde5e('0x32')][_0xde5e('0x36')]));_0x1e0a6a[_0xde5e('0x37')]=_0x1e0a6a[_0xde5e('0x37')][_0xde5e('0x38')]?_0x1e0a6a['attributes']:_0x1bb24b[_0xde5e('0x31')];if(!_0x2543fe[_0xde5e('0x32')]['hasOwnProperty']('nolimit')){_0x1e0a6a[_0xde5e('0x1d')]=qs[_0xde5e('0x1d')](_0x2543fe['query'][_0xde5e('0x1d')]);_0x1e0a6a[_0xde5e('0x1c')]=qs['offset'](_0x2543fe['query']['offset']);}_0x1e0a6a[_0xde5e('0x39')]=qs[_0xde5e('0x3a')](_0x2543fe['query'][_0xde5e('0x3a')]);_0x1e0a6a['where']=qs[_0xde5e('0x34')](_['pick'](_0x2543fe[_0xde5e('0x32')],_0x1bb24b[_0xde5e('0x34')]),_0x15ac8b);if(_0x2543fe[_0xde5e('0x32')][_0xde5e('0x3b')]){_0x1e0a6a[_0xde5e('0x3c')]=_[_0xde5e('0x3d')](_0x1e0a6a[_0xde5e('0x3c')],{'$or':_[_0xde5e('0x2d')](_0x15ac8b,function(_0x49fcbb){if(_0x49fcbb[_0xde5e('0x3e')]!==_0xde5e('0x3f')){var _0x212676={};_0x212676[_0x49fcbb[_0xde5e('0x2b')]]={'$like':'%'+_0x2543fe[_0xde5e('0x32')][_0xde5e('0x3b')]+'%'};return _0x212676;}})});}_0x1e0a6a=_['merge']({},_0x1e0a6a,_0x2543fe[_0xde5e('0x40')]);var _0x46e208={'where':_0x1e0a6a[_0xde5e('0x3c')]};return db['AnalyticDefaultReport']['count'](_0x46e208)[_0xde5e('0x25')](function(_0x7a3b84){_0x4137c0['count']=_0x7a3b84;if(_0x2543fe[_0xde5e('0x32')][_0xde5e('0x41')]){_0x1e0a6a['include']=[{'all':!![]}];}return db[_0xde5e('0x2e')][_0xde5e('0x42')](_0x1e0a6a);})[_0xde5e('0x25')](function(_0x2f9363){_0x4137c0[_0xde5e('0x43')]=_0x2f9363;return _0x4137c0;})['then'](respondWithFilteredResult(_0x5c395f,_0x1e0a6a))['catch'](handleError(_0x5c395f,null));};exports[_0xde5e('0x44')]=function(_0x16bc4f,_0x38f3e5){var _0x5bc0c2={'raw':!![],'where':{'id':_0x16bc4f['params']['id']}},_0x206fe0={};_0x206fe0[_0xde5e('0x31')]=_[_0xde5e('0x33')](db[_0xde5e('0x2e')][_0xde5e('0x2f')]);_0x206fe0['query']=_[_0xde5e('0x33')](_0x16bc4f[_0xde5e('0x32')]);_0x206fe0[_0xde5e('0x34')]=_[_0xde5e('0x35')](_0x206fe0[_0xde5e('0x31')],_0x206fe0[_0xde5e('0x32')]);_0x5bc0c2[_0xde5e('0x37')]=_[_0xde5e('0x35')](_0x206fe0[_0xde5e('0x31')],qs[_0xde5e('0x36')](_0x16bc4f[_0xde5e('0x32')][_0xde5e('0x36')]));_0x5bc0c2[_0xde5e('0x37')]=_0x5bc0c2[_0xde5e('0x37')][_0xde5e('0x38')]?_0x5bc0c2['attributes']:_0x206fe0[_0xde5e('0x31')];if(_0x16bc4f[_0xde5e('0x32')][_0xde5e('0x41')]){_0x5bc0c2[_0xde5e('0x45')]=[{'all':!![]}];}_0x5bc0c2=_[_0xde5e('0x3d')]({},_0x5bc0c2,_0x16bc4f[_0xde5e('0x40')]);return db[_0xde5e('0x2e')]['find'](_0x5bc0c2)[_0xde5e('0x25')](handleEntityNotFound(_0x38f3e5,null))[_0xde5e('0x25')](respondWithResult(_0x38f3e5,null))[_0xde5e('0x46')](handleError(_0x38f3e5,null));};exports[_0xde5e('0x47')]=function(_0x45de89,_0x111246){return db[_0xde5e('0x2e')][_0xde5e('0x47')](_0x45de89['body'],{})[_0xde5e('0x25')](function(_0x8de5ed){var _0x3b5943=_0x45de89['user']['get']({'plain':!![]});if(!_0x3b5943)throw new Error(_0xde5e('0x48'));if(_0x3b5943['role']===_0xde5e('0x49')){var _0x5f3a84=_0x8de5ed[_0xde5e('0x26')]({'plain':!![]});var _0x80d5b1=_0xde5e('0x4a');return db[_0xde5e('0x4b')][_0xde5e('0x4c')]({'where':{'name':_0x80d5b1,'userProfileId':_0x3b5943[_0xde5e('0x4d')]},'raw':!![]})[_0xde5e('0x25')](function(_0x31d310){if(_0x31d310&&_0x31d310[_0xde5e('0x4e')]===0x0){return db[_0xde5e('0x4f')][_0xde5e('0x47')]({'name':_0x5f3a84['name'],'resourceId':_0x5f3a84['id'],'type':_0xde5e('0x27'),'sectionId':_0x31d310['id']},{})[_0xde5e('0x25')](function(){return _0x8de5ed;});}else{return _0x8de5ed;}})[_0xde5e('0x46')](function(_0x1fc2df){logger['error'](_0xde5e('0x50'),_0x1fc2df);throw _0x1fc2df;});}return _0x8de5ed;})['then'](respondWithResult(_0x111246,0xc9))[_0xde5e('0x46')](handleError(_0x111246,null));};exports[_0xde5e('0x24')]=function(_0x5d64da,_0x56e60c){if(_0x5d64da[_0xde5e('0x51')]['id']){delete _0x5d64da['body']['id'];}return db[_0xde5e('0x2e')][_0xde5e('0x4c')]({'where':{'id':_0x5d64da[_0xde5e('0x52')]['id']}})[_0xde5e('0x25')](handleEntityNotFound(_0x56e60c,null))[_0xde5e('0x25')](saveUpdates(_0x5d64da['body'],null))[_0xde5e('0x25')](respondWithResult(_0x56e60c,null))[_0xde5e('0x46')](handleError(_0x56e60c,null));};exports[_0xde5e('0x53')]=function(_0xfef2b8,_0x155417){return db[_0xde5e('0x2e')][_0xde5e('0x4c')]({'where':{'id':_0xfef2b8['params']['id']}})[_0xde5e('0x25')](handleEntityNotFound(_0x155417,null))[_0xde5e('0x25')](removeEntity(_0x155417,null))[_0xde5e('0x46')](handleError(_0x155417,null));};exports[_0xde5e('0x54')]=function(_0x3241cb,_0x168820){var _0x11cd6f=0xa;var _0x50e0ad=[_0xde5e('0x55'),_0xde5e('0x56'),_0xde5e('0x57'),_0xde5e('0x58')];var _0x13a313={'SUM':_0xde5e('0x59'),'COUNT':_0xde5e('0x5a'),'COUNT DISTINCT':_0xde5e('0x5b'),'MAX':_0xde5e('0x5c'),'MIN':'MIN(%s)','AVG':_0xde5e('0x5d'),'GROUP_CONCAT':_0xde5e('0x5e'),'GROUP_CONCAT ASC':_0xde5e('0x5f'),'GROUP_CONCAT DESC':_0xde5e('0x60')};var _0x3464b8={'SEC_TO_TIME':_0xde5e('0x61'),'DATE':_0xde5e('0x62'),'HOUR':_0xde5e('0x63'),'ROUND':_0xde5e('0x64'),'UNIX_TIMESTAMP':_0xde5e('0x65')};var _0x2ca0e7=function(_0x1a691f){return!_['includes']([_0xde5e('0x66'),_0xde5e('0x67'),_0xde5e('0x68'),_0xde5e('0x69')],_0x1a691f);};var _0x59f888=function(_0x5cc11f){if(!_0x5cc11f||!_0x5cc11f[_0xde5e('0x6a')][_0xde5e('0x38')]){return'';}for(var _0xac5ed5='(',_0xc847ec=0x0;_0xc847ec<_0x5cc11f[_0xde5e('0x6a')][_0xde5e('0x38')];_0xc847ec+=0x1){_0xc847ec>0x0&&(_0xac5ed5+='\x20'+_0x5cc11f[_0xde5e('0x6b')]+'\x20');_0xac5ed5+=_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6c')]?_0x59f888(_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6c')]):_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6d')]+'\x20'+_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6e')]+(_0x2ca0e7(_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6e')])?'\x20'+_0x5cc11f['rules'][_0xc847ec][_0xde5e('0x6f')]:'');}return _0xac5ed5+')';};var _0x5095b3={'where':{'id':_0x3241cb['params']['id']}},_0x525cde,_0x50c07e,_0x48c8c0,_0x5cead0,_0x4f6a3c;_0x5095b3=_['merge']({},_0x5095b3,_0x3241cb[_0xde5e('0x40')]);return db['AnalyticDefaultReport']['find'](_0x5095b3)['then'](function(_0x3761c5){if(_0x3761c5){_0x525cde=_0x3761c5;return _0x3761c5['getFields']();}return null;})[_0xde5e('0x25')](function(_0x3e7f2e){if(_0x3e7f2e){if(!_0x3e7f2e[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))][(_0xde5e('0x71'))](_0xde5e('0x72'),0x193);}_0x50c07e=_0x3e7f2e;return db[_0xde5e('0x73')][_0xde5e('0x42')]({'raw':!![]});}return null;})[_0xde5e('0x25')](function(_0x541dfa){if(_0x541dfa){_0x48c8c0=_['keyBy'](_0x541dfa,'id');var _0x576329;var _0x4de16c=squel[_0xde5e('0x74')]();_0x4de16c['from'](_0x525cde[_0xde5e('0x75')]);for(var _0x23ebc8=0x0;_0x23ebc8<_0x50c07e[_0xde5e('0x38')];_0x23ebc8+=0x1){_0x576329=_0x50c07e[_0x23ebc8][_0xde5e('0x76')]?_0x48c8c0[_0x50c07e[_0x23ebc8]['MetricId']][_0xde5e('0x77')]:_0x50c07e[_0x23ebc8][_0xde5e('0x6d')];_0x576329=_0x50c07e[_0x23ebc8]['function']?_['replace'](_0x13a313[_0x50c07e[_0x23ebc8][_0xde5e('0x78')]],'%s',_0x576329):_0x576329;_0x576329=_0x50c07e[_0x23ebc8][_0xde5e('0x79')]?_[_0xde5e('0x7a')](_0x3464b8[_0x50c07e[_0x23ebc8][_0xde5e('0x79')]],'%s',_0x576329):_0x576329;if(_0x50c07e[_0x23ebc8][_0xde5e('0x7b')]){_0x4de16c['group'](_0x576329);}_0x50c07e[_0x23ebc8][_0xde5e('0x7c')]&&_0x4de16c[_0xde5e('0x39')](_0x576329,_0x50c07e[_0x23ebc8]['orderBy']===_0xde5e('0x7d')?![]:!![]);_0x4de16c[_0xde5e('0x6d')](_0x576329,_0x50c07e[_0x23ebc8][_0xde5e('0x7e')]||_0x576329);}if(_0x525cde[_0xde5e('0x7f')]){_0x525cde[_0xde5e('0x7f')]=JSON[_0xde5e('0x80')](_0x525cde[_0xde5e('0x7f')]);for(var _0x1fe7a7=0x0;_0x1fe7a7<_0x525cde[_0xde5e('0x7f')]['length'];_0x1fe7a7+=0x1){if(_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['type']&&_['includes'](_0x50e0ad,_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['type'])&&_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['parentKey']&&_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x81')]&&_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x82')]){_0x4de16c[_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['type']](_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['foreignTable'],null,util[_0xde5e('0x79')](_0xde5e('0x83'),_0x525cde[_0xde5e('0x75')],_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x84')],_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['foreignTable'],_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x82')]));}}}if(_0x525cde[_0xde5e('0x85')]){_0x525cde['conditions']=JSON[_0xde5e('0x80')](_0x525cde[_0xde5e('0x85')]);_0x4de16c[_0xde5e('0x3c')](_0x59f888(_0x525cde[_0xde5e('0x85')][_0xde5e('0x6c')]));}_0x4f6a3c=_0x4de16c[_0xde5e('0x86')]();_0x4de16c[_0xde5e('0x1d')](_0x11cd6f);_0x4de16c[_0xde5e('0x1c')](0x0);logger[_0xde5e('0x87')](_0xde5e('0x88'),_0x4de16c[_0xde5e('0x89')]());return db[_0xde5e('0x8a')][_0xde5e('0x32')](_0x4de16c[_0xde5e('0x89')](),{'type':db[_0xde5e('0x8a')][_0xde5e('0x8b')][_0xde5e('0x8c')]});}})[_0xde5e('0x25')](respondWithResult(_0x168820,null))[_0xde5e('0x46')](handleError(_0x168820,null));};function runReport(_0x5c7365,_0x25306e,_0x2e28c7){var _0x1a00d3=_0x25306e[_0xde5e('0x2b')];var _0x486586=0xa;var _0xe875bd=[_0xde5e('0x55'),_0xde5e('0x56'),_0xde5e('0x57'),_0xde5e('0x58')];var _0x8c3520={'SUM':_0xde5e('0x59'),'COUNT':_0xde5e('0x5a'),'COUNT DISTINCT':_0xde5e('0x5b'),'MAX':'MAX(%s)','MIN':_0xde5e('0x8d'),'AVG':_0xde5e('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc288bc={'SEC_TO_TIME':_0xde5e('0x61'),'DATE':_0xde5e('0x62'),'HOUR':'HOUR(%s)','ROUND':_0xde5e('0x64'),'UNIX_TIMESTAMP':_0xde5e('0x65')};var _0x17c99e=function(_0x669dda){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xde5e('0x69')],_0x669dda);};var _0x594a4f=function(_0x5bd2da){if(!_0x5bd2da||!_0x5bd2da[_0xde5e('0x6a')][_0xde5e('0x38')]){return'';}for(var _0x2552e8='(',_0x311d92=0x0;_0x311d92<_0x5bd2da[_0xde5e('0x6a')][_0xde5e('0x38')];_0x311d92+=0x1){_0x311d92>0x0&&(_0x2552e8+='\x20'+_0x5bd2da[_0xde5e('0x6b')]+'\x20');_0x2552e8+=_0x5bd2da[_0xde5e('0x6a')][_0x311d92]['group']?_0x594a4f(_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6c')]):_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6d')]+'\x20'+_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6e')]+(_0x17c99e(_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6e')])?'\x20'+_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6f')]:'');}return _0x2552e8+')';};var _0x8cc6dd={'where':{'id':_0x5c7365['id']}},_0x48e5c1,_0x22d871,_0x5e8bf4,_0xb2f246,_0x31d0b5;_0x8cc6dd=_[_0xde5e('0x3d')]({},_0x8cc6dd,_0x2e28c7);return db['AnalyticDefaultReport'][_0xde5e('0x4c')](_0x8cc6dd)[_0xde5e('0x25')](function(_0x996903){if(_0x996903){_0x48e5c1=_0x996903;return _0x996903[_0xde5e('0x8e')]();}return null;})['then'](function(_0x3a876f){if(_0x3a876f){if(!_0x3a876f[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))]['ValidationErrorItem'](_0xde5e('0x72'),0x193);}_0x22d871=_0x3a876f;return db['AnalyticMetric'][_0xde5e('0x42')]({'raw':!![]});}return null;})[_0xde5e('0x25')](function(_0x4f6697){if(_0x4f6697){_0x5e8bf4=_[_0xde5e('0x8f')](_0x4f6697,'id');var _0x389e86;var _0x66b37a=squel[_0xde5e('0x74')]();_0x66b37a['from'](_0x48e5c1['table']);for(var _0x388045=0x0;_0x388045<_0x22d871[_0xde5e('0x38')];_0x388045+=0x1){_0x389e86=_0x22d871[_0x388045][_0xde5e('0x76')]?_0x5e8bf4[_0x22d871[_0x388045][_0xde5e('0x76')]]['metric']:_0x22d871[_0x388045][_0xde5e('0x6d')];_0x389e86=_0x22d871[_0x388045]['function']?_['replace'](_0x8c3520[_0x22d871[_0x388045][_0xde5e('0x78')]],'%s',_0x389e86):_0x389e86;_0x389e86=_0x22d871[_0x388045][_0xde5e('0x79')]?_[_0xde5e('0x7a')](_0xc288bc[_0x22d871[_0x388045][_0xde5e('0x79')]],'%s',_0x389e86):_0x389e86;if(_0x22d871[_0x388045][_0xde5e('0x7b')]){_0x66b37a['group'](_0x389e86);}_0x22d871[_0x388045][_0xde5e('0x7c')]&&_0x66b37a[_0xde5e('0x39')](_0x389e86,_0x22d871[_0x388045][_0xde5e('0x7c')]==='DESC'?![]:!![]);_0x66b37a['field'](_0x389e86,_0x22d871[_0x388045][_0xde5e('0x7e')]||_0x389e86);}if(_0x48e5c1[_0xde5e('0x7f')]){_0x48e5c1[_0xde5e('0x7f')]=JSON[_0xde5e('0x80')](_0x48e5c1['joins']);for(var _0x2028b6=0x0;_0x2028b6<_0x48e5c1[_0xde5e('0x7f')]['length'];_0x2028b6+=0x1){if(_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x3e')]&&_['includes'](_0xe875bd,_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x3e')])&&_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x84')]&&_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x81')]&&_0x48e5c1['joins'][_0x2028b6][_0xde5e('0x82')]){_0x66b37a[_0x48e5c1[_0xde5e('0x7f')][_0x2028b6]['type']](_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x81')],null,util[_0xde5e('0x79')](_0xde5e('0x83'),_0x48e5c1[_0xde5e('0x75')],_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x84')],_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x81')],_0x48e5c1['joins'][_0x2028b6][_0xde5e('0x82')]));}}}if(_0x48e5c1[_0xde5e('0x85')]){_0x48e5c1[_0xde5e('0x85')]=JSON[_0xde5e('0x80')](_0x48e5c1[_0xde5e('0x85')]);_0x66b37a[_0xde5e('0x3c')](_0x594a4f(_0x48e5c1['conditions']['group']));}_0x31d0b5=_0x66b37a[_0xde5e('0x86')]();_0x66b37a[_0xde5e('0x1d')](_0x486586);_0x66b37a['offset'](0x0);logger[_0xde5e('0x87')](_0xde5e('0x88'),_0x66b37a[_0xde5e('0x89')]());return db['sequelize']['query'](_0x66b37a[_0xde5e('0x89')](),{'type':db[_0xde5e('0x8a')][_0xde5e('0x8b')][_0xde5e('0x8c')]});}})[_0xde5e('0x25')](function(_0x464dbe){if(!_0x464dbe[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))][(_0xde5e('0x71'))]('No\x20available\x20data',0xcc);}if(_0x25306e['output']===_0xde5e('0x90')){return null;}var _0x3745ac=_[_0xde5e('0x3d')](_0x25306e,{'name':_0x25306e[_0xde5e('0x91')]||_0x25306e['name']||_0x48e5c1[_0xde5e('0x2b')],'basename':_0x1a00d3,'savename':util[_0xde5e('0x79')](_0xde5e('0x92'),_0x25306e['name']||_0x48e5c1['name'],require('randomstring')[_0xde5e('0x93')](0x4),_0x25306e[_0xde5e('0x94')]||_0xde5e('0x95')),'reportId':_0x48e5c1['id'],'reportType':_0xde5e('0x96')});return db[_0xde5e('0x97')][_0xde5e('0x47')](_0x3745ac,{'raw':!![]});})['then'](function(_0x378916){if(_0x48e5c1[_0xde5e('0x75')]==='cdr'){_0x31d0b5['where'](_0x48e5c1['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x25306e[_0xde5e('0x98')],_0x25306e[_0xde5e('0x99')]);}else{_0x31d0b5[_0xde5e('0x3c')](_0x48e5c1[_0xde5e('0x75')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x25306e[_0xde5e('0x98')],_0x25306e[_0xde5e('0x99')]);}if(_0x378916){logger['info'](_0xde5e('0x9a'),_0x31d0b5[_0xde5e('0x89')]());require('child_process')[_0xde5e('0x9b')](path[_0xde5e('0x55')](__dirname,_0xde5e('0x9c'),_0x378916[_0xde5e('0x94')]),[_0x378916['id'],_0x31d0b5[_0xde5e('0x89')](),path[_0xde5e('0x55')](__dirname,_0xde5e('0x9d'),_0x378916['savename']),_0x1a00d3]);return _0x378916;}else{var _0x1aeef5=squel[_0xde5e('0x74')]();_0x1aeef5[_0xde5e('0x9e')]('('+_0x31d0b5['toString']()+')',_0xde5e('0x9f'));_0x1aeef5['field'](_0xde5e('0xa0'),'count');_0x31d0b5['limit'](_0x25306e[_0xde5e('0x1d')]||_0x486586);_0x31d0b5['offset'](_0x25306e[_0xde5e('0x1c')]||0x0);return dbH['sequelize'][_0xde5e('0x32')](_0x1aeef5[_0xde5e('0x89')](),{'type':dbH[_0xde5e('0x8a')][_0xde5e('0x8b')][_0xde5e('0x8c')]})['then'](function(_0x46de48){if(!_0x46de48[_0xde5e('0x38')]){_0xb2f246=0x0;}else{_0xb2f246=_0x46de48[0x0][_0xde5e('0xa1')]||0x0;}return dbH['sequelize'][_0xde5e('0x32')](_0x31d0b5[_0xde5e('0x89')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xde5e('0x25')](function(_0x204bb5){return{'rows':_0x204bb5||[],'count':_0xb2f246};});}});}exports[_0xde5e('0xa2')]=function(_0x5878fd,_0x5ecf63){return runReport(_0x5878fd[_0xde5e('0x52')],_0x5878fd[_0xde5e('0x32')],_0x5878fd['options'])['then'](respondWithResult(_0x5ecf63,null))[_0xde5e('0x46')](handleError(_0x5ecf63,null));};exports[_0xde5e('0xa3')]=runReport;exports[_0xde5e('0x32')]=function(_0x49fa06,_0x55a599){var _0x1664c5=0xa;var _0x11fa98=['join',_0xde5e('0x56'),_0xde5e('0x57'),_0xde5e('0x58')];var _0x35e8fa={'SUM':_0xde5e('0x59'),'COUNT':_0xde5e('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xde5e('0x5c'),'MIN':_0xde5e('0x8d'),'AVG':_0xde5e('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xde5e('0x60')};var _0x32f718={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xde5e('0x63'),'ROUND':_0xde5e('0x64'),'UNIX_TIMESTAMP':_0xde5e('0x65')};var _0x536657=function(_0x2888ca){return!_['includes']([_0xde5e('0x66'),_0xde5e('0x67'),'IS\x20EMPTY',_0xde5e('0x69')],_0x2888ca);};var _0x599c26=function(_0x3d5d0a){if(!_0x3d5d0a||!_0x3d5d0a['rules'][_0xde5e('0x38')]){return'';}for(var _0x1044b3='(',_0x4b5865=0x0;_0x4b5865<_0x3d5d0a[_0xde5e('0x6a')]['length'];_0x4b5865+=0x1){_0x4b5865>0x0&&(_0x1044b3+='\x20'+_0x3d5d0a[_0xde5e('0x6b')]+'\x20');_0x1044b3+=_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6c')]?_0x599c26(_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6c')]):_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6d')]+'\x20'+_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6e')]+(_0x536657(_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865]['condition'])?'\x20'+_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865]['value']:'');}return _0x1044b3+')';};var _0x45cc53={'where':{'id':_0x49fa06[_0xde5e('0x52')]['id']}},_0x557d0f,_0x2135e3,_0x402af7,_0x279cc3,_0x5cd87c;_0x45cc53=_[_0xde5e('0x3d')]({},_0x45cc53,_0x49fa06[_0xde5e('0x40')]);return db['AnalyticDefaultReport']['find'](_0x45cc53)[_0xde5e('0x25')](function(_0xf424db){if(_0xf424db){_0x557d0f=_0xf424db;return _0xf424db[_0xde5e('0x8e')]();}return null;})[_0xde5e('0x25')](function(_0x27d6ca){if(_0x27d6ca){if(!_0x27d6ca[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))][(_0xde5e('0x71'))](_0xde5e('0x72'),0x193);}_0x2135e3=_0x27d6ca;return db[_0xde5e('0x73')][_0xde5e('0x42')]({'raw':!![]});}return null;})[_0xde5e('0x25')](function(_0x412e32){if(_0x412e32){_0x402af7=_['keyBy'](_0x412e32,'id');var _0x2f4ab0;var _0x1c7a80=squel['select']();_0x1c7a80[_0xde5e('0x9e')](_0x557d0f[_0xde5e('0x75')]);for(var _0x56b66b=0x0;_0x56b66b<_0x2135e3[_0xde5e('0x38')];_0x56b66b+=0x1){_0x2f4ab0=_0x2135e3[_0x56b66b][_0xde5e('0x76')]?_0x402af7[_0x2135e3[_0x56b66b]['MetricId']]['metric']:_0x2135e3[_0x56b66b][_0xde5e('0x6d')];_0x2f4ab0=_0x2135e3[_0x56b66b][_0xde5e('0x78')]?_[_0xde5e('0x7a')](_0x35e8fa[_0x2135e3[_0x56b66b]['function']],'%s',_0x2f4ab0):_0x2f4ab0;_0x2f4ab0=_0x2135e3[_0x56b66b][_0xde5e('0x79')]?_[_0xde5e('0x7a')](_0x32f718[_0x2135e3[_0x56b66b][_0xde5e('0x79')]],'%s',_0x2f4ab0):_0x2f4ab0;if(_0x2135e3[_0x56b66b][_0xde5e('0x7b')]){_0x1c7a80[_0xde5e('0x6c')](_0x2f4ab0);}_0x2135e3[_0x56b66b][_0xde5e('0x7c')]&&_0x1c7a80[_0xde5e('0x39')](_0x2f4ab0,_0x2135e3[_0x56b66b][_0xde5e('0x7c')]===_0xde5e('0x7d')?![]:!![]);_0x1c7a80[_0xde5e('0x6d')](_0x2f4ab0,_0x2135e3[_0x56b66b][_0xde5e('0x7e')]||_0x2f4ab0);}if(_0x557d0f[_0xde5e('0x7f')]){_0x557d0f[_0xde5e('0x7f')]=JSON[_0xde5e('0x80')](_0x557d0f[_0xde5e('0x7f')]);for(var _0x3399ec=0x0;_0x3399ec<_0x557d0f[_0xde5e('0x7f')][_0xde5e('0x38')];_0x3399ec+=0x1){if(_0x557d0f[_0xde5e('0x7f')][_0x3399ec]['type']&&_['includes'](_0x11fa98,_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x3e')])&&_0x557d0f['joins'][_0x3399ec][_0xde5e('0x84')]&&_0x557d0f[_0xde5e('0x7f')][_0x3399ec]['foreignTable']&&_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x82')]){_0x1c7a80[_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x3e')]](_0x557d0f[_0xde5e('0x7f')][_0x3399ec]['foreignTable'],null,util[_0xde5e('0x79')]('%s.%s\x20=\x20%s.%s',_0x557d0f[_0xde5e('0x75')],_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x84')],_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x81')],_0x557d0f['joins'][_0x3399ec][_0xde5e('0x82')]));}}}if(_0x557d0f[_0xde5e('0x85')]){_0x557d0f['conditions']=JSON[_0xde5e('0x80')](_0x557d0f['conditions']);_0x1c7a80[_0xde5e('0x3c')](_0x599c26(_0x557d0f[_0xde5e('0x85')][_0xde5e('0x6c')]));}_0x5cd87c=_0x1c7a80[_0xde5e('0x86')]();_0x1c7a80[_0xde5e('0x1d')](_0x1664c5);_0x1c7a80[_0xde5e('0x1c')](0x0);logger[_0xde5e('0x87')](_0xde5e('0x88'),_0x1c7a80[_0xde5e('0x89')]());return db[_0xde5e('0x8a')][_0xde5e('0x32')](_0x1c7a80[_0xde5e('0x89')](),{'type':db[_0xde5e('0x8a')]['QueryTypes'][_0xde5e('0x8c')]});}})[_0xde5e('0x25')](function(){return{'sql':_0x5cd87c[_0xde5e('0x89')]()};})[_0xde5e('0x25')](respondWithResult(_0x55a599,null))['catch'](handleError(_0x55a599,null));}; \ No newline at end of file +var _0x705a=['fullPath','randomstring','output','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','QueryTypes','runReport','left_join','MAX(%s)','ROUND(%s)','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','dbH','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','stack','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','show','params','include','options','find','create','user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','HOUR(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','web'];(function(_0x39f211,_0x3b551b){var _0x1c1f5c=function(_0x14278c){while(--_0x14278c){_0x39f211['push'](_0x39f211['shift']());}};_0x1c1f5c(++_0x3b551b);}(_0x705a,0xb1));var _0xa705=function(_0x941099,_0x47fb57){_0x941099=_0x941099-0x0;var _0x1b6ad6=_0x705a[_0x941099];return _0x1b6ad6;};'use strict';var pdf=require(_0xa705('0x0'));var emlformat=require(_0xa705('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa705('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa705('0x3'));var moment=require('moment');var BPromise=require(_0xa705('0x4'));var Mustache=require(_0xa705('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa705('0x6'));var squel=require('squel');var crypto=require(_0xa705('0x7'));var jsforce=require(_0xa705('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xa705('0x9'));var querystring=require(_0xa705('0xa'));var Papa=require('papaparse');var Redis=require(_0xa705('0xb'));var authService=require(_0xa705('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa705('0xd'));var hardwareService=require(_0xa705('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xa705('0xf'));var config=require('../../config/environment');var db=require(_0xa705('0x10'))['db'];var dbH=require(_0xa705('0x10'))[_0xa705('0x11')];function respondWithStatusCode(_0x8fe288,_0xd58555){_0xd58555=_0xd58555||0xcc;return function(_0x4f95ec){if(_0x4f95ec){return _0x8fe288['sendStatus'](_0xd58555);}return _0x8fe288[_0xa705('0x12')](_0xd58555)[_0xa705('0x13')]();};}function respondWithResult(_0x3a283a,_0x4878bc){_0x4878bc=_0x4878bc||0xc8;return function(_0x3f74ed){if(_0x3f74ed){return _0x3a283a[_0xa705('0x12')](_0x4878bc)[_0xa705('0x14')](_0x3f74ed);}};}function respondWithFilteredResult(_0x48315b,_0x4bb679){return function(_0x374077){if(_0x374077){var _0x513f83=_0x374077[_0xa705('0x15')],_0x4ffc62=_0x4bb679[_0xa705('0x16')],_0x1c1b82=_0x4bb679[_0xa705('0x16')]+_0x4bb679[_0xa705('0x17')],_0x505086;if(_0x1c1b82>=_0x513f83){_0x1c1b82=_0x513f83;_0x505086=0xc8;}else{_0x505086=0xce;}_0x48315b['status'](_0x505086);return _0x48315b[_0xa705('0x18')](_0xa705('0x19'),_0x4ffc62+'-'+_0x1c1b82+'/'+_0x513f83)['json'](_0x374077);}return null;};}function patchUpdates(_0x5466dc){return function(_0x1c94c7){try{jsonpatch[_0xa705('0x1a')](_0x1c94c7,_0x5466dc,!![]);}catch(_0x126838){return BPromise[_0xa705('0x1b')](_0x126838);}return _0x1c94c7[_0xa705('0x1c')]();};}function saveUpdates(_0x7cbeb2,_0x5a4d18){return function(_0x33c720){if(_0x33c720){return _0x33c720[_0xa705('0x1d')](_0x7cbeb2)[_0xa705('0x1e')](function(_0x9d6202){return _0x9d6202;});}return null;};}function removeEntity(_0xaff627,_0x1c50c1){return function(_0xd1ff52){if(_0xd1ff52){return _0xd1ff52['destroy']()[_0xa705('0x1e')](function(){var _0x4e3149=_0xd1ff52[_0xa705('0x1f')]({'plain':!![]});var _0x57284a=_0xa705('0x20');return db[_0xa705('0x21')][_0xa705('0x22')]({'where':{'type':_0x57284a,'resourceId':_0x4e3149['id']}})[_0xa705('0x1e')](function(){return _0xd1ff52;});})[_0xa705('0x1e')](function(){_0xaff627[_0xa705('0x12')](0xcc)[_0xa705('0x13')]();});}};}function handleEntityNotFound(_0x35c91f,_0x2e5aac){return function(_0x5b6d51){if(!_0x5b6d51){_0x35c91f[_0xa705('0x23')](0x194);}return _0x5b6d51;};}function handleError(_0x34eb24,_0x34e5d0){_0x34e5d0=_0x34e5d0||0x1f4;return function(_0x4d7f59){logger['error'](_0x4d7f59[_0xa705('0x24')]);if(_0x4d7f59[_0xa705('0x25')]){delete _0x4d7f59[_0xa705('0x25')];}_0x34eb24[_0xa705('0x12')](_0x34e5d0)[_0xa705('0x26')](_0x4d7f59);};}exports[_0xa705('0x27')]=function(_0x21390e,_0x89793e){var _0x4b1588={},_0x3d9583={},_0x5e2cc7={'count':0x0,'rows':[]};var _0x31ae1d=_['map'](db[_0xa705('0x28')][_0xa705('0x29')],function(_0x3bdcc2){return{'name':_0x3bdcc2[_0xa705('0x2a')],'type':_0x3bdcc2['type']['key']};});_0x3d9583[_0xa705('0x2b')]=_[_0xa705('0x2c')](_0x31ae1d,'name');_0x3d9583[_0xa705('0x2d')]=_[_0xa705('0x2e')](_0x21390e[_0xa705('0x2d')]);_0x3d9583[_0xa705('0x2f')]=_[_0xa705('0x30')](_0x3d9583[_0xa705('0x2b')],_0x3d9583[_0xa705('0x2d')]);_0x4b1588[_0xa705('0x31')]=_[_0xa705('0x30')](_0x3d9583[_0xa705('0x2b')],qs[_0xa705('0x32')](_0x21390e[_0xa705('0x2d')][_0xa705('0x32')]));_0x4b1588[_0xa705('0x31')]=_0x4b1588['attributes'][_0xa705('0x33')]?_0x4b1588[_0xa705('0x31')]:_0x3d9583[_0xa705('0x2b')];if(!_0x21390e[_0xa705('0x2d')][_0xa705('0x34')](_0xa705('0x35'))){_0x4b1588[_0xa705('0x17')]=qs[_0xa705('0x17')](_0x21390e[_0xa705('0x2d')][_0xa705('0x17')]);_0x4b1588[_0xa705('0x16')]=qs[_0xa705('0x16')](_0x21390e['query'][_0xa705('0x16')]);}_0x4b1588[_0xa705('0x36')]=qs[_0xa705('0x37')](_0x21390e[_0xa705('0x2d')][_0xa705('0x37')]);_0x4b1588['where']=qs[_0xa705('0x2f')](_[_0xa705('0x38')](_0x21390e['query'],_0x3d9583[_0xa705('0x2f')]),_0x31ae1d);if(_0x21390e[_0xa705('0x2d')][_0xa705('0x39')]){_0x4b1588['where']=_[_0xa705('0x3a')](_0x4b1588[_0xa705('0x3b')],{'$or':_[_0xa705('0x2c')](_0x31ae1d,function(_0x14bce9){if(_0x14bce9[_0xa705('0x3c')]!==_0xa705('0x3d')){var _0x485c24={};_0x485c24[_0x14bce9['name']]={'$like':'%'+_0x21390e['query'][_0xa705('0x39')]+'%'};return _0x485c24;}})});}_0x4b1588=_[_0xa705('0x3a')]({},_0x4b1588,_0x21390e['options']);var _0x2ccdf4={'where':_0x4b1588['where']};return db[_0xa705('0x28')]['count'](_0x2ccdf4)['then'](function(_0x31b490){_0x5e2cc7[_0xa705('0x15')]=_0x31b490;if(_0x21390e[_0xa705('0x2d')][_0xa705('0x3e')]){_0x4b1588['include']=[{'all':!![]}];}return db[_0xa705('0x28')]['findAll'](_0x4b1588);})[_0xa705('0x1e')](function(_0xec57e2){_0x5e2cc7['rows']=_0xec57e2;return _0x5e2cc7;})[_0xa705('0x1e')](respondWithFilteredResult(_0x89793e,_0x4b1588))['catch'](handleError(_0x89793e,null));};exports[_0xa705('0x3f')]=function(_0x239ec3,_0x31f564){var _0x3f1f90={'raw':!![],'where':{'id':_0x239ec3[_0xa705('0x40')]['id']}},_0x4f64c1={};_0x4f64c1[_0xa705('0x2b')]=_[_0xa705('0x2e')](db['AnalyticDefaultReport']['rawAttributes']);_0x4f64c1[_0xa705('0x2d')]=_['keys'](_0x239ec3[_0xa705('0x2d')]);_0x4f64c1[_0xa705('0x2f')]=_['intersection'](_0x4f64c1[_0xa705('0x2b')],_0x4f64c1[_0xa705('0x2d')]);_0x3f1f90[_0xa705('0x31')]=_['intersection'](_0x4f64c1[_0xa705('0x2b')],qs[_0xa705('0x32')](_0x239ec3[_0xa705('0x2d')]['fields']));_0x3f1f90[_0xa705('0x31')]=_0x3f1f90['attributes'][_0xa705('0x33')]?_0x3f1f90[_0xa705('0x31')]:_0x4f64c1[_0xa705('0x2b')];if(_0x239ec3['query'][_0xa705('0x3e')]){_0x3f1f90[_0xa705('0x41')]=[{'all':!![]}];}_0x3f1f90=_[_0xa705('0x3a')]({},_0x3f1f90,_0x239ec3[_0xa705('0x42')]);return db[_0xa705('0x28')][_0xa705('0x43')](_0x3f1f90)[_0xa705('0x1e')](handleEntityNotFound(_0x31f564,null))[_0xa705('0x1e')](respondWithResult(_0x31f564,null))['catch'](handleError(_0x31f564,null));};exports[_0xa705('0x44')]=function(_0x26a10b,_0x5494f5){return db[_0xa705('0x28')][_0xa705('0x44')](_0x26a10b['body'],{})[_0xa705('0x1e')](function(_0x51db0c){var _0x4a387a=_0x26a10b[_0xa705('0x45')]['get']({'plain':!![]});if(!_0x4a387a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a387a['role']==='user'){var _0x2faf1e=_0x51db0c[_0xa705('0x1f')]({'plain':!![]});var _0x5e355f=_0xa705('0x46');return db[_0xa705('0x47')]['find']({'where':{'name':_0x5e355f,'userProfileId':_0x4a387a[_0xa705('0x48')]},'raw':!![]})['then'](function(_0x5d6175){if(_0x5d6175&&_0x5d6175[_0xa705('0x49')]===0x0){return db[_0xa705('0x21')][_0xa705('0x44')]({'name':_0x2faf1e[_0xa705('0x25')],'resourceId':_0x2faf1e['id'],'type':_0xa705('0x20'),'sectionId':_0x5d6175['id']},{})['then'](function(){return _0x51db0c;});}else{return _0x51db0c;}})[_0xa705('0x4a')](function(_0x208586){logger[_0xa705('0x4b')](_0xa705('0x4c'),_0x208586);throw _0x208586;});}return _0x51db0c;})[_0xa705('0x1e')](respondWithResult(_0x5494f5,0xc9))[_0xa705('0x4a')](handleError(_0x5494f5,null));};exports[_0xa705('0x1d')]=function(_0x1ce876,_0x4366c3){if(_0x1ce876[_0xa705('0x4d')]['id']){delete _0x1ce876['body']['id'];}return db[_0xa705('0x28')][_0xa705('0x43')]({'where':{'id':_0x1ce876[_0xa705('0x40')]['id']}})['then'](handleEntityNotFound(_0x4366c3,null))[_0xa705('0x1e')](saveUpdates(_0x1ce876[_0xa705('0x4d')],null))['then'](respondWithResult(_0x4366c3,null))[_0xa705('0x4a')](handleError(_0x4366c3,null));};exports[_0xa705('0x22')]=function(_0x2f8caa,_0x49a6ea){return db[_0xa705('0x28')][_0xa705('0x43')]({'where':{'id':_0x2f8caa[_0xa705('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ea,null))[_0xa705('0x1e')](removeEntity(_0x49a6ea,null))[_0xa705('0x4a')](handleError(_0x49a6ea,null));};exports['preview']=function(_0x16be85,_0x572192){var _0x105073=0xa;var _0x44a27d=['join','left_join',_0xa705('0x4e'),_0xa705('0x4f')];var _0x22bb92={'SUM':_0xa705('0x50'),'COUNT':_0xa705('0x51'),'COUNT DISTINCT':_0xa705('0x52'),'MAX':'MAX(%s)','MIN':_0xa705('0x53'),'AVG':_0xa705('0x54'),'GROUP_CONCAT':_0xa705('0x55'),'GROUP_CONCAT ASC':_0xa705('0x56'),'GROUP_CONCAT DESC':_0xa705('0x57')};var _0x4a1a5f={'SEC_TO_TIME':_0xa705('0x58'),'DATE':_0xa705('0x59'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa705('0x5a')};var _0x246d05=function(_0x5898b8){return!_[_0xa705('0x5b')]([_0xa705('0x5c'),_0xa705('0x5d'),_0xa705('0x5e'),_0xa705('0x5f')],_0x5898b8);};var _0x49e9da=function(_0x470c7b){if(!_0x470c7b||!_0x470c7b['rules'][_0xa705('0x33')]){return'';}for(var _0x16c65e='(',_0x2facc5=0x0;_0x2facc5<_0x470c7b[_0xa705('0x60')][_0xa705('0x33')];_0x2facc5+=0x1){_0x2facc5>0x0&&(_0x16c65e+='\x20'+_0x470c7b[_0xa705('0x61')]+'\x20');_0x16c65e+=_0x470c7b[_0xa705('0x60')][_0x2facc5][_0xa705('0x62')]?_0x49e9da(_0x470c7b[_0xa705('0x60')][_0x2facc5][_0xa705('0x62')]):_0x470c7b['rules'][_0x2facc5][_0xa705('0x63')]+'\x20'+_0x470c7b['rules'][_0x2facc5]['condition']+(_0x246d05(_0x470c7b[_0xa705('0x60')][_0x2facc5][_0xa705('0x64')])?'\x20'+_0x470c7b['rules'][_0x2facc5][_0xa705('0x65')]:'');}return _0x16c65e+')';};var _0x39f4eb={'where':{'id':_0x16be85[_0xa705('0x40')]['id']}},_0x59dadf,_0x5a2446,_0x5c8b8a,_0x2dd742,_0x1fdd40;_0x39f4eb=_[_0xa705('0x3a')]({},_0x39f4eb,_0x16be85[_0xa705('0x42')]);return db[_0xa705('0x28')][_0xa705('0x43')](_0x39f4eb)[_0xa705('0x1e')](function(_0x2724dd){if(_0x2724dd){_0x59dadf=_0x2724dd;return _0x2724dd['getFields']();}return null;})[_0xa705('0x1e')](function(_0x3ba3ce){if(_0x3ba3ce){if(!_0x3ba3ce['length']){throw new db[(_0xa705('0x66'))][(_0xa705('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5a2446=_0x3ba3ce;return db[_0xa705('0x68')][_0xa705('0x69')]({'raw':!![]});}return null;})[_0xa705('0x1e')](function(_0x2608bf){if(_0x2608bf){_0x5c8b8a=_[_0xa705('0x6a')](_0x2608bf,'id');var _0x330326;var _0x5f1ea4=squel[_0xa705('0x6b')]();_0x5f1ea4[_0xa705('0x6c')](_0x59dadf[_0xa705('0x6d')]);for(var _0x417015=0x0;_0x417015<_0x5a2446[_0xa705('0x33')];_0x417015+=0x1){_0x330326=_0x5a2446[_0x417015][_0xa705('0x6e')]?_0x5c8b8a[_0x5a2446[_0x417015]['MetricId']][_0xa705('0x6f')]:_0x5a2446[_0x417015][_0xa705('0x63')];_0x330326=_0x5a2446[_0x417015][_0xa705('0x70')]?_[_0xa705('0x71')](_0x22bb92[_0x5a2446[_0x417015][_0xa705('0x70')]],'%s',_0x330326):_0x330326;_0x330326=_0x5a2446[_0x417015][_0xa705('0x72')]?_[_0xa705('0x71')](_0x4a1a5f[_0x5a2446[_0x417015][_0xa705('0x72')]],'%s',_0x330326):_0x330326;if(_0x5a2446[_0x417015][_0xa705('0x73')]){_0x5f1ea4['group'](_0x330326);}_0x5a2446[_0x417015][_0xa705('0x74')]&&_0x5f1ea4[_0xa705('0x36')](_0x330326,_0x5a2446[_0x417015][_0xa705('0x74')]===_0xa705('0x75')?![]:!![]);_0x5f1ea4[_0xa705('0x63')](_0x330326,_0x5a2446[_0x417015][_0xa705('0x76')]||_0x330326);}if(_0x59dadf['joins']){_0x59dadf[_0xa705('0x77')]=JSON[_0xa705('0x78')](_0x59dadf[_0xa705('0x77')]);for(var _0x474a63=0x0;_0x474a63<_0x59dadf[_0xa705('0x77')][_0xa705('0x33')];_0x474a63+=0x1){if(_0x59dadf[_0xa705('0x77')][_0x474a63][_0xa705('0x3c')]&&_[_0xa705('0x5b')](_0x44a27d,_0x59dadf[_0xa705('0x77')][_0x474a63]['type'])&&_0x59dadf[_0xa705('0x77')][_0x474a63][_0xa705('0x79')]&&_0x59dadf[_0xa705('0x77')][_0x474a63][_0xa705('0x7a')]&&_0x59dadf[_0xa705('0x77')][_0x474a63]['foreignKey']){_0x5f1ea4[_0x59dadf[_0xa705('0x77')][_0x474a63]['type']](_0x59dadf['joins'][_0x474a63][_0xa705('0x7a')],null,util[_0xa705('0x72')](_0xa705('0x7b'),_0x59dadf[_0xa705('0x6d')],_0x59dadf[_0xa705('0x77')][_0x474a63][_0xa705('0x79')],_0x59dadf[_0xa705('0x77')][_0x474a63][_0xa705('0x7a')],_0x59dadf['joins'][_0x474a63][_0xa705('0x7c')]));}}}if(_0x59dadf[_0xa705('0x7d')]){_0x59dadf[_0xa705('0x7d')]=JSON['parse'](_0x59dadf[_0xa705('0x7d')]);_0x5f1ea4[_0xa705('0x3b')](_0x49e9da(_0x59dadf[_0xa705('0x7d')]['group']));}_0x1fdd40=_0x5f1ea4[_0xa705('0x7e')]();_0x5f1ea4[_0xa705('0x17')](_0x105073);_0x5f1ea4['offset'](0x0);logger[_0xa705('0x7f')](_0xa705('0x80'),_0x5f1ea4[_0xa705('0x81')]());return db[_0xa705('0x82')][_0xa705('0x2d')](_0x5f1ea4[_0xa705('0x81')](),{'type':db[_0xa705('0x82')]['QueryTypes'][_0xa705('0x83')]});}})[_0xa705('0x1e')](respondWithResult(_0x572192,null))['catch'](handleError(_0x572192,null));};function runReport(_0x38edf1,_0x306f6a,_0x5999c0){var _0x51ca6f=_0x306f6a[_0xa705('0x25')];var _0x89f284=0xa;var _0x5aa887=[_0xa705('0x84'),'left_join','right_join',_0xa705('0x4f')];var _0x4be1fa={'SUM':_0xa705('0x50'),'COUNT':_0xa705('0x51'),'COUNT DISTINCT':_0xa705('0x52'),'MAX':'MAX(%s)','MIN':_0xa705('0x53'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa705('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4e74a0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa705('0x59'),'HOUR':_0xa705('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa705('0x5a')};var _0x51b87b=function(_0x39909b){return!_[_0xa705('0x5b')]([_0xa705('0x5c'),_0xa705('0x5d'),_0xa705('0x5e'),_0xa705('0x5f')],_0x39909b);};var _0x183611=function(_0x3929a7){if(!_0x3929a7||!_0x3929a7[_0xa705('0x60')]['length']){return'';}for(var _0x298588='(',_0x20b753=0x0;_0x20b753<_0x3929a7[_0xa705('0x60')][_0xa705('0x33')];_0x20b753+=0x1){_0x20b753>0x0&&(_0x298588+='\x20'+_0x3929a7[_0xa705('0x61')]+'\x20');_0x298588+=_0x3929a7['rules'][_0x20b753][_0xa705('0x62')]?_0x183611(_0x3929a7['rules'][_0x20b753]['group']):_0x3929a7[_0xa705('0x60')][_0x20b753][_0xa705('0x63')]+'\x20'+_0x3929a7['rules'][_0x20b753][_0xa705('0x64')]+(_0x51b87b(_0x3929a7['rules'][_0x20b753]['condition'])?'\x20'+_0x3929a7['rules'][_0x20b753][_0xa705('0x65')]:'');}return _0x298588+')';};var _0x42736c={'where':{'id':_0x38edf1['id']}},_0x451739,_0x565a58,_0x764e91,_0x21c6ba,_0x4fe699;_0x42736c=_[_0xa705('0x3a')]({},_0x42736c,_0x5999c0);return db[_0xa705('0x28')][_0xa705('0x43')](_0x42736c)[_0xa705('0x1e')](function(_0x47dd49){if(_0x47dd49){_0x451739=_0x47dd49;return _0x47dd49[_0xa705('0x86')]();}return null;})[_0xa705('0x1e')](function(_0x46ae34){if(_0x46ae34){if(!_0x46ae34[_0xa705('0x33')]){throw new db['Sequelize'][(_0xa705('0x67'))](_0xa705('0x87'),0x193);}_0x565a58=_0x46ae34;return db[_0xa705('0x68')][_0xa705('0x69')]({'raw':!![]});}return null;})['then'](function(_0x2e8e98){if(_0x2e8e98){_0x764e91=_[_0xa705('0x6a')](_0x2e8e98,'id');var _0x1f2f2e;var _0xbc33a9=squel[_0xa705('0x6b')]();_0xbc33a9[_0xa705('0x6c')](_0x451739[_0xa705('0x6d')]);for(var _0x4d81b2=0x0;_0x4d81b2<_0x565a58[_0xa705('0x33')];_0x4d81b2+=0x1){_0x1f2f2e=_0x565a58[_0x4d81b2]['MetricId']?_0x764e91[_0x565a58[_0x4d81b2][_0xa705('0x6e')]]['metric']:_0x565a58[_0x4d81b2]['field'];_0x1f2f2e=_0x565a58[_0x4d81b2][_0xa705('0x70')]?_['replace'](_0x4be1fa[_0x565a58[_0x4d81b2][_0xa705('0x70')]],'%s',_0x1f2f2e):_0x1f2f2e;_0x1f2f2e=_0x565a58[_0x4d81b2][_0xa705('0x72')]?_[_0xa705('0x71')](_0x4e74a0[_0x565a58[_0x4d81b2][_0xa705('0x72')]],'%s',_0x1f2f2e):_0x1f2f2e;if(_0x565a58[_0x4d81b2][_0xa705('0x73')]){_0xbc33a9['group'](_0x1f2f2e);}_0x565a58[_0x4d81b2][_0xa705('0x74')]&&_0xbc33a9['order'](_0x1f2f2e,_0x565a58[_0x4d81b2][_0xa705('0x74')]===_0xa705('0x75')?![]:!![]);_0xbc33a9[_0xa705('0x63')](_0x1f2f2e,_0x565a58[_0x4d81b2][_0xa705('0x76')]||_0x1f2f2e);}if(_0x451739[_0xa705('0x77')]){_0x451739[_0xa705('0x77')]=JSON['parse'](_0x451739[_0xa705('0x77')]);for(var _0x183cd2=0x0;_0x183cd2<_0x451739[_0xa705('0x77')]['length'];_0x183cd2+=0x1){if(_0x451739[_0xa705('0x77')][_0x183cd2][_0xa705('0x3c')]&&_[_0xa705('0x5b')](_0x5aa887,_0x451739[_0xa705('0x77')][_0x183cd2][_0xa705('0x3c')])&&_0x451739['joins'][_0x183cd2][_0xa705('0x79')]&&_0x451739['joins'][_0x183cd2]['foreignTable']&&_0x451739[_0xa705('0x77')][_0x183cd2][_0xa705('0x7c')]){_0xbc33a9[_0x451739['joins'][_0x183cd2][_0xa705('0x3c')]](_0x451739['joins'][_0x183cd2][_0xa705('0x7a')],null,util[_0xa705('0x72')](_0xa705('0x7b'),_0x451739[_0xa705('0x6d')],_0x451739[_0xa705('0x77')][_0x183cd2][_0xa705('0x79')],_0x451739[_0xa705('0x77')][_0x183cd2][_0xa705('0x7a')],_0x451739['joins'][_0x183cd2][_0xa705('0x7c')]));}}}if(_0x451739[_0xa705('0x7d')]){_0x451739[_0xa705('0x7d')]=JSON[_0xa705('0x78')](_0x451739[_0xa705('0x7d')]);_0xbc33a9[_0xa705('0x3b')](_0x183611(_0x451739[_0xa705('0x7d')]['group']));}_0x4fe699=_0xbc33a9[_0xa705('0x7e')]();_0xbc33a9['limit'](_0x89f284);_0xbc33a9[_0xa705('0x16')](0x0);logger[_0xa705('0x7f')](_0xa705('0x80'),_0xbc33a9[_0xa705('0x81')]());return db[_0xa705('0x82')][_0xa705('0x2d')](_0xbc33a9[_0xa705('0x81')](),{'type':db[_0xa705('0x82')]['QueryTypes'][_0xa705('0x83')]});}})['then'](function(_0x1f8a21){if(!_0x1f8a21['length']){throw new db['Sequelize'][(_0xa705('0x67'))]('No\x20available\x20data',0xcc);}if(_0x306f6a['output']===_0xa705('0x88')){return null;}var _0x47e830=_[_0xa705('0x3a')](_0x306f6a,{'name':_0x306f6a[_0xa705('0x89')]||_0x306f6a[_0xa705('0x25')]||_0x451739[_0xa705('0x25')],'basename':_0x51ca6f,'savename':util[_0xa705('0x72')]('%s-%s.%s',_0x306f6a[_0xa705('0x25')]||_0x451739[_0xa705('0x25')],require(_0xa705('0x8a'))['generate'](0x4),_0x306f6a[_0xa705('0x8b')]||_0xa705('0x8c')),'reportId':_0x451739['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0xa705('0x44')](_0x47e830,{'raw':!![]});})[_0xa705('0x1e')](function(_0xa2a698){if(_0x451739[_0xa705('0x6d')]==='cdr'){_0x4fe699[_0xa705('0x3b')](_0x451739['table']+_0xa705('0x8d'),_0x306f6a['startDate'],_0x306f6a[_0xa705('0x8e')]);}else{_0x4fe699[_0xa705('0x3b')](_0x451739[_0xa705('0x6d')]+_0xa705('0x8f'),_0x306f6a[_0xa705('0x90')],_0x306f6a['endDate']);}if(_0xa2a698){logger[_0xa705('0x91')](_0xa705('0x92'),_0x4fe699[_0xa705('0x81')]());require('child_process')[_0xa705('0x93')](path[_0xa705('0x84')](__dirname,_0xa705('0x94'),_0xa2a698[_0xa705('0x8b')]),[_0xa2a698['id'],_0x4fe699[_0xa705('0x81')](),path[_0xa705('0x84')](__dirname,_0xa705('0x95'),_0xa2a698[_0xa705('0x96')]),_0x51ca6f]);return _0xa2a698;}else{var _0x9d5e1a=squel[_0xa705('0x6b')]();_0x9d5e1a[_0xa705('0x6c')]('('+_0x4fe699['toString']()+')',_0xa705('0x97'));_0x9d5e1a['field']('COUNT(*)',_0xa705('0x15'));_0x4fe699[_0xa705('0x17')](_0x306f6a['limit']||_0x89f284);_0x4fe699[_0xa705('0x16')](_0x306f6a[_0xa705('0x16')]||0x0);return dbH[_0xa705('0x82')][_0xa705('0x2d')](_0x9d5e1a[_0xa705('0x81')](),{'type':dbH[_0xa705('0x82')][_0xa705('0x98')][_0xa705('0x83')]})[_0xa705('0x1e')](function(_0x329d9f){if(!_0x329d9f['length']){_0x21c6ba=0x0;}else{_0x21c6ba=_0x329d9f[0x0][_0xa705('0x15')]||0x0;}return dbH[_0xa705('0x82')][_0xa705('0x2d')](_0x4fe699[_0xa705('0x81')](),{'type':dbH[_0xa705('0x82')][_0xa705('0x98')][_0xa705('0x83')]});})[_0xa705('0x1e')](function(_0x117a21){return{'rows':_0x117a21||[],'count':_0x21c6ba};});}});}exports['run']=function(_0x408748,_0x5650db){return runReport(_0x408748[_0xa705('0x40')],_0x408748[_0xa705('0x2d')],_0x408748[_0xa705('0x42')])[_0xa705('0x1e')](respondWithResult(_0x5650db,null))['catch'](handleError(_0x5650db,null));};exports[_0xa705('0x99')]=runReport;exports['query']=function(_0x14d1b7,_0x498e8c){var _0x384de4=0xa;var _0x294928=[_0xa705('0x84'),_0xa705('0x9a'),'right_join',_0xa705('0x4f')];var _0x3e896d={'SUM':_0xa705('0x50'),'COUNT':_0xa705('0x51'),'COUNT DISTINCT':_0xa705('0x52'),'MAX':_0xa705('0x9b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xa705('0x55'),'GROUP_CONCAT ASC':_0xa705('0x56'),'GROUP_CONCAT DESC':_0xa705('0x57')};var _0x264695={'SEC_TO_TIME':_0xa705('0x58'),'DATE':_0xa705('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xa705('0x9c'),'UNIX_TIMESTAMP':_0xa705('0x5a')};var _0x13b342=function(_0x320296){return!_['includes']([_0xa705('0x5c'),_0xa705('0x5d'),_0xa705('0x5e'),_0xa705('0x5f')],_0x320296);};var _0x54cff0=function(_0xaf09e0){if(!_0xaf09e0||!_0xaf09e0[_0xa705('0x60')]['length']){return'';}for(var _0x3a4ed0='(',_0x589118=0x0;_0x589118<_0xaf09e0[_0xa705('0x60')]['length'];_0x589118+=0x1){_0x589118>0x0&&(_0x3a4ed0+='\x20'+_0xaf09e0[_0xa705('0x61')]+'\x20');_0x3a4ed0+=_0xaf09e0[_0xa705('0x60')][_0x589118][_0xa705('0x62')]?_0x54cff0(_0xaf09e0[_0xa705('0x60')][_0x589118][_0xa705('0x62')]):_0xaf09e0['rules'][_0x589118]['field']+'\x20'+_0xaf09e0[_0xa705('0x60')][_0x589118][_0xa705('0x64')]+(_0x13b342(_0xaf09e0['rules'][_0x589118][_0xa705('0x64')])?'\x20'+_0xaf09e0[_0xa705('0x60')][_0x589118][_0xa705('0x65')]:'');}return _0x3a4ed0+')';};var _0x250a92={'where':{'id':_0x14d1b7[_0xa705('0x40')]['id']}},_0xc0d68b,_0x237568,_0x5236b7,_0x1bd2f5,_0x4207ae;_0x250a92=_['merge']({},_0x250a92,_0x14d1b7[_0xa705('0x42')]);return db[_0xa705('0x28')][_0xa705('0x43')](_0x250a92)[_0xa705('0x1e')](function(_0x1cce3b){if(_0x1cce3b){_0xc0d68b=_0x1cce3b;return _0x1cce3b[_0xa705('0x86')]();}return null;})[_0xa705('0x1e')](function(_0x55b346){if(_0x55b346){if(!_0x55b346[_0xa705('0x33')]){throw new db['Sequelize'][(_0xa705('0x67'))](_0xa705('0x87'),0x193);}_0x237568=_0x55b346;return db[_0xa705('0x68')][_0xa705('0x69')]({'raw':!![]});}return null;})[_0xa705('0x1e')](function(_0x5a1bf8){if(_0x5a1bf8){_0x5236b7=_[_0xa705('0x6a')](_0x5a1bf8,'id');var _0x374763;var _0x5808fd=squel[_0xa705('0x6b')]();_0x5808fd[_0xa705('0x6c')](_0xc0d68b['table']);for(var _0x336f36=0x0;_0x336f36<_0x237568[_0xa705('0x33')];_0x336f36+=0x1){_0x374763=_0x237568[_0x336f36][_0xa705('0x6e')]?_0x5236b7[_0x237568[_0x336f36][_0xa705('0x6e')]][_0xa705('0x6f')]:_0x237568[_0x336f36][_0xa705('0x63')];_0x374763=_0x237568[_0x336f36][_0xa705('0x70')]?_[_0xa705('0x71')](_0x3e896d[_0x237568[_0x336f36][_0xa705('0x70')]],'%s',_0x374763):_0x374763;_0x374763=_0x237568[_0x336f36][_0xa705('0x72')]?_[_0xa705('0x71')](_0x264695[_0x237568[_0x336f36]['format']],'%s',_0x374763):_0x374763;if(_0x237568[_0x336f36][_0xa705('0x73')]){_0x5808fd[_0xa705('0x62')](_0x374763);}_0x237568[_0x336f36][_0xa705('0x74')]&&_0x5808fd[_0xa705('0x36')](_0x374763,_0x237568[_0x336f36][_0xa705('0x74')]===_0xa705('0x75')?![]:!![]);_0x5808fd['field'](_0x374763,_0x237568[_0x336f36][_0xa705('0x76')]||_0x374763);}if(_0xc0d68b[_0xa705('0x77')]){_0xc0d68b[_0xa705('0x77')]=JSON[_0xa705('0x78')](_0xc0d68b[_0xa705('0x77')]);for(var _0x53d510=0x0;_0x53d510<_0xc0d68b[_0xa705('0x77')]['length'];_0x53d510+=0x1){if(_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x3c')]&&_[_0xa705('0x5b')](_0x294928,_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x3c')])&&_0xc0d68b[_0xa705('0x77')][_0x53d510]['parentKey']&&_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x7a')]&&_0xc0d68b[_0xa705('0x77')][_0x53d510]['foreignKey']){_0x5808fd[_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x3c')]](_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x7a')],null,util['format'](_0xa705('0x7b'),_0xc0d68b[_0xa705('0x6d')],_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x79')],_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x7a')],_0xc0d68b[_0xa705('0x77')][_0x53d510][_0xa705('0x7c')]));}}}if(_0xc0d68b[_0xa705('0x7d')]){_0xc0d68b[_0xa705('0x7d')]=JSON[_0xa705('0x78')](_0xc0d68b[_0xa705('0x7d')]);_0x5808fd[_0xa705('0x3b')](_0x54cff0(_0xc0d68b[_0xa705('0x7d')][_0xa705('0x62')]));}_0x4207ae=_0x5808fd[_0xa705('0x7e')]();_0x5808fd['limit'](_0x384de4);_0x5808fd[_0xa705('0x16')](0x0);logger[_0xa705('0x7f')](_0xa705('0x80'),_0x5808fd[_0xa705('0x81')]());return db['sequelize']['query'](_0x5808fd[_0xa705('0x81')](),{'type':db[_0xa705('0x82')][_0xa705('0x98')][_0xa705('0x83')]});}})[_0xa705('0x1e')](function(){return{'sql':_0x4207ae[_0xa705('0x81')]()};})[_0xa705('0x1e')](respondWithResult(_0x498e8c,null))[_0xa705('0x4a')](handleError(_0x498e8c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 94d30ff..1308331 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 _0x326f=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x23a2ce,_0x4cc6bd){var _0x5f4552=function(_0x1bd2a3){while(--_0x1bd2a3){_0x23a2ce['push'](_0x23a2ce['shift']());}};_0x5f4552(++_0x4cc6bd);}(_0x326f,0xd1));var _0xf326=function(_0xbd90a2,_0x253135){_0xbd90a2=_0xbd90a2-0x0;var _0x35a02d=_0x326f[_0xbd90a2];return _0x35a02d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2170e4,_0x5b969e){var _0xec86f5=function(_0x44e53e){while(--_0x44e53e){_0x2170e4['push'](_0x2170e4['shift']());}};_0xec86f5(++_0x5b969e);}(_0x1967,0x173));var _0x7196=function(_0x402fc4,_0x2f1c2a){_0x402fc4=_0x402fc4-0x0;var _0x24fade=_0x1967[_0x402fc4];return _0x24fade;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index d352a3b..6f9b009 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 _0x2c54=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x53103d,_0x31a2e6){var _0x28d7cc=function(_0x4d8c85){while(--_0x4d8c85){_0x53103d['push'](_0x53103d['shift']());}};_0x28d7cc(++_0x31a2e6);}(_0x2c54,0x136));var _0x42c5=function(_0x17f918,_0x1099a9){_0x17f918=_0x17f918-0x0;var _0x556249=_0x2c54[_0x17f918];return _0x556249;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c5('0x3'));var fs=require('fs');var Redis=require(_0x42c5('0x4'));var db=require(_0x42c5('0x5'))['db'];var utils=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x42c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1959c1,_0x44516e,_0x38d528){return new BPromise(function(_0x134cb6,_0x14538f){return client[_0x42c5('0xa')](_0x1959c1,_0x38d528)[_0x42c5('0xb')](function(_0x3ca4de){logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,_0x42c5('0xe'));logger[_0x42c5('0xf')](_0x42c5('0x10'),_0x44516e,_0x42c5('0xe'),JSON[_0x42c5('0x11')](_0x3ca4de));if(_0x3ca4de[_0x42c5('0x12')]){if(_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x13')]===0x1f4){logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x14538f(_0x3ca4de['error']['message']);}logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x134cb6(_0x3ca4de['error'][_0x42c5('0x14')]);}else{logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,'request\x20sent');_0x134cb6(_0x3ca4de[_0x42c5('0x15')]['message']);}})['catch'](function(_0x466b47){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x44516e,_0x466b47);_0x14538f(_0x466b47);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0xfa959f,_0xcedc31){var _0x3151e5=function(_0x3d2a08){while(--_0x3d2a08){_0xfa959f['push'](_0xfa959f['shift']());}};_0x3151e5(++_0xcedc31);}(_0x96cc,0x16c));var _0xc96c=function(_0x2f6af4,_0x2875fc){_0x2f6af4=_0x2f6af4-0x0;var _0xa5f3be=_0x96cc[_0x2f6af4];return _0xa5f3be;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c827605..706209e 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 _0xc4cf=['/:id/preview','run','query','post','create','put','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x23e3e7,_0x93dea){var _0x123ecd=function(_0x3de24b){while(--_0x3de24b){_0x23e3e7['push'](_0x23e3e7['shift']());}};_0x123ecd(++_0x93dea);}(_0xc4cf,0x98));var _0xfc4c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xc4cf[_0x36ed48];return _0x51c63a;};'use strict';var multer=require('multer');var util=require(_0xfc4c('0x0'));var path=require(_0xfc4c('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc4c('0x2'));var router=express[_0xfc4c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfc4c('0x4'));var config=require(_0xfc4c('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xfc4c('0x6')]('/',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0x8')]);router[_0xfc4c('0x6')](_0xfc4c('0x9'),auth[_0xfc4c('0x7')](),controller['show']);router[_0xfc4c('0x6')](_0xfc4c('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0xfc4c('0x6')]('/:id/run',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0xb')]);router['get']('/:id/query',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0xc')]);router[_0xfc4c('0xd')]('/',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0xe')]);router[_0xfc4c('0xf')](_0xfc4c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xfc4c('0x10')](_0xfc4c('0x9'),auth[_0xfc4c('0x7')](),controller['destroy']);module[_0xfc4c('0x11')]=router; \ No newline at end of file +var _0x5f83=['./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','run','/:id/query','query','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2dfc6a,_0x3f5c18){var _0x11229e=function(_0x2758c2){while(--_0x2758c2){_0x2dfc6a['push'](_0x2dfc6a['shift']());}};_0x11229e(++_0x3f5c18);}(_0x5f83,0xeb));var _0x35f8=function(_0x41b21a,_0x4255e9){_0x41b21a=_0x41b21a-0x0;var _0x346898=_0x5f83[_0x41b21a];return _0x346898;};'use strict';var multer=require(_0x35f8('0x0'));var util=require('util');var path=require(_0x35f8('0x1'));var timeout=require(_0x35f8('0x2'));var express=require('express');var router=express[_0x35f8('0x3')]();var auth=require(_0x35f8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35f8('0x5'));router[_0x35f8('0x6')]('/',auth[_0x35f8('0x7')](),controller[_0x35f8('0x8')]);router['get'](_0x35f8('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x35f8('0xa'),auth[_0x35f8('0x7')](),controller[_0x35f8('0xb')]);router['get']('/:id/run',auth[_0x35f8('0x7')](),controller[_0x35f8('0xc')]);router['get'](_0x35f8('0xd'),auth[_0x35f8('0x7')](),controller[_0x35f8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x35f8('0xf')]);router[_0x35f8('0x10')]('/:id',auth[_0x35f8('0x7')](),controller[_0x35f8('0x11')]);router[_0x35f8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x35f8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0cded43..dc33cd8 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 _0x88a3=['ENUM','pdf','DATE','manual','scheduled','exports','STRING'];(function(_0x3ca6ef,_0x571897){var _0x51c58c=function(_0x3b95c7){while(--_0x3b95c7){_0x3ca6ef['push'](_0x3ca6ef['shift']());}};_0x51c58c(++_0x571897);}(_0x88a3,0x17f));var _0x388a=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0x88a3[_0x25f805];return _0xf6628f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x388a('0x0')]={'name':{'type':Sequelize[_0x388a('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x388a('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x388a('0x2')]('csv',_0x388a('0x3'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x388a('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x388a('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x388a('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x388a('0x2')](_0x388a('0x5'),_0x388a('0x6')),'allowNull':![],'defaultValue':_0x388a('0x5')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x388a('0x1')]}}; \ No newline at end of file +var _0x83b6=['scheduled','UNSIGNED','sequelize','moment','STRING','ENUM','xlsx','csv','DATE','manual'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x83b6,0x1ba));var _0x683b=function(_0x3d6989,_0x3bac20){_0x3d6989=_0x3d6989-0x0;var _0x150ae7=_0x83b6[_0x3d6989];return _0x150ae7;};'use strict';var Sequelize=require(_0x683b('0x0'));var moment=require(_0x683b('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x683b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x683b('0x3')]('csv','pdf',_0x683b('0x4')),'allowNull':![],'defaultValue':_0x683b('0x5')},'savename':{'type':Sequelize[_0x683b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x683b('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x683b('0x3')](_0x683b('0x7'),_0x683b('0x8')),'allowNull':![],'defaultValue':_0x683b('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x683b('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 726258d..276b9ec 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 _0xdf1e=['request-promise','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','then','destroy','get','ExtractedReports','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0xdf1e,0x154));var _0xedf1=function(_0x48aabe,_0x1d3ad3){_0x48aabe=_0x48aabe-0x0;var _0x174865=_0xdf1e[_0x48aabe];return _0x174865;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedf1('0x0'));var rimraf=require(_0xedf1('0x1'));var zipdir=require(_0xedf1('0x2'));var jsonpatch=require(_0xedf1('0x3'));var rp=require(_0xedf1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xedf1('0x5'));var path=require(_0xedf1('0x6'));var sox=require(_0xedf1('0x7'));var csv=require(_0xedf1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xedf1('0x9'));var squel=require('squel');var crypto=require(_0xedf1('0xa'));var jsforce=require(_0xedf1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xedf1('0x8'));var querystring=require(_0xedf1('0xc'));var Papa=require(_0xedf1('0xd'));var Redis=require('ioredis');var authService=require(_0xedf1('0xe'));var qs=require(_0xedf1('0xf'));var as=require(_0xedf1('0x10'));var hardwareService=require(_0xedf1('0x11'));var logger=require(_0xedf1('0x12'))('api');var utils=require(_0xedf1('0x13'));var config=require(_0xedf1('0x14'));var db=require(_0xedf1('0x15'))['db'];function respondWithStatusCode(_0x36c130,_0x1fb0ec){_0x1fb0ec=_0x1fb0ec||0xcc;return function(_0x56ee29){if(_0x56ee29){return _0x36c130[_0xedf1('0x16')](_0x1fb0ec);}return _0x36c130[_0xedf1('0x17')](_0x1fb0ec)['end']();};}function respondWithResult(_0x550a48,_0xd45e6e){_0xd45e6e=_0xd45e6e||0xc8;return function(_0x331e83){if(_0x331e83){return _0x550a48[_0xedf1('0x17')](_0xd45e6e)['json'](_0x331e83);}};}function respondWithFilteredResult(_0x44632f,_0x50fd06){return function(_0x1f9a9a){if(_0x1f9a9a){var _0x241c19=_0x1f9a9a[_0xedf1('0x18')],_0x1dcd68=_0x50fd06[_0xedf1('0x19')],_0x184e6d=_0x50fd06[_0xedf1('0x19')]+_0x50fd06[_0xedf1('0x1a')],_0xada7d4;if(_0x184e6d>=_0x241c19){_0x184e6d=_0x241c19;_0xada7d4=0xc8;}else{_0xada7d4=0xce;}_0x44632f['status'](_0xada7d4);return _0x44632f[_0xedf1('0x1b')]('Content-Range',_0x1dcd68+'-'+_0x184e6d+'/'+_0x241c19)['json'](_0x1f9a9a);}return null;};}function patchUpdates(_0xf0812f){return function(_0x237ddf){try{jsonpatch[_0xedf1('0x1c')](_0x237ddf,_0xf0812f,!![]);}catch(_0x21092a){return BPromise[_0xedf1('0x1d')](_0x21092a);}return _0x237ddf['save']();};}function saveUpdates(_0x1026da,_0x41ebd5){return function(_0x122982){if(_0x122982){return _0x122982['update'](_0x1026da)[_0xedf1('0x1e')](function(_0xe8b02c){return _0xe8b02c;});}return null;};}function removeEntity(_0x4ef19f,_0x4c6b0d){return function(_0x40d347){if(_0x40d347){return _0x40d347[_0xedf1('0x1f')]()[_0xedf1('0x1e')](function(){var _0x9be4ae=_0x40d347[_0xedf1('0x20')]({'plain':!![]});var _0x1b9a73=_0xedf1('0x21');return db['UserProfileResource'][_0xedf1('0x1f')]({'where':{'type':_0x1b9a73,'resourceId':_0x9be4ae['id']}})[_0xedf1('0x1e')](function(){return _0x40d347;});})[_0xedf1('0x1e')](function(){_0x4ef19f['status'](0xcc)[_0xedf1('0x22')]();});}};}function handleEntityNotFound(_0x5b057b,_0x4b0868){return function(_0xf7f66){if(!_0xf7f66){_0x5b057b[_0xedf1('0x16')](0x194);}return _0xf7f66;};}function handleError(_0x20e2e9,_0x2cada7){_0x2cada7=_0x2cada7||0x1f4;return function(_0x52c350){logger[_0xedf1('0x23')](_0x52c350[_0xedf1('0x24')]);if(_0x52c350[_0xedf1('0x25')]){delete _0x52c350[_0xedf1('0x25')];}_0x20e2e9[_0xedf1('0x17')](_0x2cada7)[_0xedf1('0x26')](_0x52c350);};}exports[_0xedf1('0x27')]=function(_0x452469,_0x23ee2f){var _0x4fd742={},_0x96ca00={},_0x556d3c={'count':0x0,'rows':[]};var _0x30d368=_[_0xedf1('0x28')](db[_0xedf1('0x29')][_0xedf1('0x2a')],function(_0x178a1b){return{'name':_0x178a1b[_0xedf1('0x2b')],'type':_0x178a1b[_0xedf1('0x2c')][_0xedf1('0x2d')]};});_0x96ca00[_0xedf1('0x2e')]=_[_0xedf1('0x28')](_0x30d368,_0xedf1('0x25'));_0x96ca00['query']=_[_0xedf1('0x2f')](_0x452469[_0xedf1('0x30')]);_0x96ca00['filters']=_[_0xedf1('0x31')](_0x96ca00['model'],_0x96ca00['query']);_0x4fd742[_0xedf1('0x32')]=_[_0xedf1('0x31')](_0x96ca00['model'],qs[_0xedf1('0x33')](_0x452469[_0xedf1('0x30')]['fields']));_0x4fd742[_0xedf1('0x32')]=_0x4fd742['attributes'][_0xedf1('0x34')]?_0x4fd742[_0xedf1('0x32')]:_0x96ca00[_0xedf1('0x2e')];if(!_0x452469['query'][_0xedf1('0x35')](_0xedf1('0x36'))){_0x4fd742[_0xedf1('0x1a')]=qs[_0xedf1('0x1a')](_0x452469['query'][_0xedf1('0x1a')]);_0x4fd742['offset']=qs[_0xedf1('0x19')](_0x452469['query'][_0xedf1('0x19')]);}_0x4fd742[_0xedf1('0x37')]=qs['sort'](_0x452469[_0xedf1('0x30')][_0xedf1('0x38')]);_0x4fd742['where']=qs[_0xedf1('0x39')](_['pick'](_0x452469[_0xedf1('0x30')],_0x96ca00[_0xedf1('0x39')]),_0x30d368);if(_0x452469[_0xedf1('0x30')]['filter']){_0x4fd742[_0xedf1('0x3a')]=_[_0xedf1('0x3b')](_0x4fd742[_0xedf1('0x3a')],{'$or':_[_0xedf1('0x28')](_0x30d368,function(_0x259c4d){if(_0x259c4d[_0xedf1('0x2c')]!==_0xedf1('0x3c')){var _0x2b0771={};_0x2b0771[_0x259c4d[_0xedf1('0x25')]]={'$like':'%'+_0x452469[_0xedf1('0x30')][_0xedf1('0x3d')]+'%'};return _0x2b0771;}})});}_0x4fd742=_['merge']({},_0x4fd742,_0x452469[_0xedf1('0x3e')]);var _0x824481={'where':_0x4fd742[_0xedf1('0x3a')]};return db[_0xedf1('0x29')][_0xedf1('0x18')](_0x824481)[_0xedf1('0x1e')](function(_0x41ea32){_0x556d3c[_0xedf1('0x18')]=_0x41ea32;if(_0x452469['query'][_0xedf1('0x3f')]){_0x4fd742['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xedf1('0x40')](_0x4fd742);})[_0xedf1('0x1e')](function(_0x11924c){_0x556d3c[_0xedf1('0x41')]=_0x11924c;return _0x556d3c;})[_0xedf1('0x1e')](respondWithFilteredResult(_0x23ee2f,_0x4fd742))[_0xedf1('0x42')](handleError(_0x23ee2f,null));};exports['show']=function(_0x2ec2f8,_0x363987){var _0x4bfecb={'raw':!![],'where':{'id':_0x2ec2f8[_0xedf1('0x43')]['id']}},_0x3eec93={};_0x3eec93['model']=_[_0xedf1('0x2f')](db[_0xedf1('0x29')][_0xedf1('0x2a')]);_0x3eec93[_0xedf1('0x30')]=_[_0xedf1('0x2f')](_0x2ec2f8[_0xedf1('0x30')]);_0x3eec93['filters']=_[_0xedf1('0x31')](_0x3eec93[_0xedf1('0x2e')],_0x3eec93[_0xedf1('0x30')]);_0x4bfecb[_0xedf1('0x32')]=_[_0xedf1('0x31')](_0x3eec93[_0xedf1('0x2e')],qs[_0xedf1('0x33')](_0x2ec2f8[_0xedf1('0x30')][_0xedf1('0x33')]));_0x4bfecb[_0xedf1('0x32')]=_0x4bfecb['attributes'][_0xedf1('0x34')]?_0x4bfecb[_0xedf1('0x32')]:_0x3eec93[_0xedf1('0x2e')];if(_0x2ec2f8['query'][_0xedf1('0x3f')]){_0x4bfecb[_0xedf1('0x44')]=[{'all':!![]}];}_0x4bfecb=_[_0xedf1('0x3b')]({},_0x4bfecb,_0x2ec2f8[_0xedf1('0x3e')]);return db[_0xedf1('0x29')][_0xedf1('0x45')](_0x4bfecb)[_0xedf1('0x1e')](handleEntityNotFound(_0x363987,null))[_0xedf1('0x1e')](respondWithResult(_0x363987,null))['catch'](handleError(_0x363987,null));};exports['create']=function(_0x1b5b7b,_0x50cde9){return db['AnalyticExtractedReport'][_0xedf1('0x46')](_0x1b5b7b[_0xedf1('0x47')],{})['then'](function(_0x72c7e9){var _0x286b71=_0x1b5b7b[_0xedf1('0x48')]['get']({'plain':!![]});if(!_0x286b71)throw new Error(_0xedf1('0x49'));if(_0x286b71['role']===_0xedf1('0x48')){var _0x407af8=_0x72c7e9['get']({'plain':!![]});var _0x3419d8=_0xedf1('0x21');return db['UserProfileSection'][_0xedf1('0x45')]({'where':{'name':_0x3419d8,'userProfileId':_0x286b71[_0xedf1('0x4a')]},'raw':!![]})[_0xedf1('0x1e')](function(_0x2f8b28){if(_0x2f8b28&&_0x2f8b28['autoAssociation']===0x0){return db[_0xedf1('0x4b')][_0xedf1('0x46')]({'name':_0x407af8['name'],'resourceId':_0x407af8['id'],'type':_0x2f8b28[_0xedf1('0x25')],'sectionId':_0x2f8b28['id']},{})[_0xedf1('0x1e')](function(){return _0x72c7e9;});}else{return _0x72c7e9;}})[_0xedf1('0x42')](function(_0x21e078){logger[_0xedf1('0x23')](_0xedf1('0x4c'),_0x21e078);throw _0x21e078;});}return _0x72c7e9;})[_0xedf1('0x1e')](respondWithResult(_0x50cde9,0xc9))['catch'](handleError(_0x50cde9,null));};exports['update']=function(_0x33abca,_0x136614){if(_0x33abca[_0xedf1('0x47')]['id']){delete _0x33abca['body']['id'];}return db[_0xedf1('0x29')][_0xedf1('0x45')]({'where':{'id':_0x33abca[_0xedf1('0x43')]['id']}})[_0xedf1('0x1e')](handleEntityNotFound(_0x136614,null))[_0xedf1('0x1e')](saveUpdates(_0x33abca[_0xedf1('0x47')],null))['then'](respondWithResult(_0x136614,null))[_0xedf1('0x42')](handleError(_0x136614,null));};exports[_0xedf1('0x1f')]=function(_0x3b7f7c,_0x22177d){return db[_0xedf1('0x29')][_0xedf1('0x45')]({'where':{'id':_0x3b7f7c[_0xedf1('0x43')]['id']}})[_0xedf1('0x1e')](handleEntityNotFound(_0x22177d,null))[_0xedf1('0x1e')](removeEntity(_0x22177d,null))[_0xedf1('0x42')](handleError(_0x22177d,null));};exports[_0xedf1('0x4d')]=function(_0x408eda,_0x212cff,_0x3a67e9){return db[_0xedf1('0x29')][_0xedf1('0x45')]({'where':{'id':_0x408eda[_0xedf1('0x43')]['id']},'attributes':[_0xedf1('0x25'),'basename','savename',_0xedf1('0x4e')],'raw':!![]})[_0xedf1('0x1e')](handleEntityNotFound(_0x212cff,null))[_0xedf1('0x1e')](function(_0x38bf08){if(_0x38bf08){if(!fs[_0xedf1('0x4f')](path['join'](config[_0xedf1('0x50')],_0xedf1('0x51'),_0x38bf08['savename']))){throw new db['Sequelize'][(_0xedf1('0x52'))](_0xedf1('0x53'));}if(_0x408eda[_0xedf1('0x30')]['exists']){return _0x212cff[_0xedf1('0x16')](0xc8);}return _0x212cff[_0xedf1('0x4d')](path['join'](config[_0xedf1('0x50')],'server/files/reports',_0x38bf08['savename']),util['format']('%s.%s',_0x38bf08[_0xedf1('0x54')]||_0x38bf08[_0xedf1('0x25')],_0x38bf08[_0xedf1('0x4e')][_0xedf1('0x55')]()));}})['catch'](handleError(_0x212cff,null));}; \ No newline at end of file +var _0x5327=['reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','rawAttributes','intersection','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','output','join','server/files/reports','Sequelize','ValidationError','exists','root','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range'];(function(_0x3c1676,_0x2ede5e){var _0x48fc10=function(_0x204c74){while(--_0x204c74){_0x3c1676['push'](_0x3c1676['shift']());}};_0x48fc10(++_0x2ede5e);}(_0x5327,0xea));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7532('0x0'));var emlformat=require(_0x7532('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7532('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7532('0x3'));var moment=require(_0x7532('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7532('0x5'));var util=require(_0x7532('0x6'));var path=require(_0x7532('0x7'));var sox=require(_0x7532('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7532('0x9'));var squel=require('squel');var crypto=require(_0x7532('0xa'));var jsforce=require(_0x7532('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7532('0xc'));var querystring=require(_0x7532('0xd'));var Papa=require(_0x7532('0xe'));var Redis=require(_0x7532('0xf'));var authService=require(_0x7532('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7532('0x11'));var hardwareService=require(_0x7532('0x12'));var logger=require(_0x7532('0x13'))(_0x7532('0x14'));var utils=require('../../config/utils');var config=require(_0x7532('0x15'));var db=require(_0x7532('0x16'))['db'];function respondWithStatusCode(_0xec4338,_0x8675b3){_0x8675b3=_0x8675b3||0xcc;return function(_0x584955){if(_0x584955){return _0xec4338[_0x7532('0x17')](_0x8675b3);}return _0xec4338[_0x7532('0x18')](_0x8675b3)[_0x7532('0x19')]();};}function respondWithResult(_0x5c590d,_0x198f79){_0x198f79=_0x198f79||0xc8;return function(_0x104824){if(_0x104824){return _0x5c590d[_0x7532('0x18')](_0x198f79)[_0x7532('0x1a')](_0x104824);}};}function respondWithFilteredResult(_0x2e874d,_0x189746){return function(_0xa1a243){if(_0xa1a243){var _0x4b0a02=_0xa1a243[_0x7532('0x1b')],_0x226a31=_0x189746[_0x7532('0x1c')],_0x5807c3=_0x189746[_0x7532('0x1c')]+_0x189746['limit'],_0x1ec9dd;if(_0x5807c3>=_0x4b0a02){_0x5807c3=_0x4b0a02;_0x1ec9dd=0xc8;}else{_0x1ec9dd=0xce;}_0x2e874d[_0x7532('0x18')](_0x1ec9dd);return _0x2e874d['set'](_0x7532('0x1d'),_0x226a31+'-'+_0x5807c3+'/'+_0x4b0a02)['json'](_0xa1a243);}return null;};}function patchUpdates(_0x11b53b){return function(_0x13c11e){try{jsonpatch['apply'](_0x13c11e,_0x11b53b,!![]);}catch(_0x14030d){return BPromise[_0x7532('0x1e')](_0x14030d);}return _0x13c11e[_0x7532('0x1f')]();};}function saveUpdates(_0x12d612,_0x37258f){return function(_0x53a916){if(_0x53a916){return _0x53a916[_0x7532('0x20')](_0x12d612)[_0x7532('0x21')](function(_0x4ced9e){return _0x4ced9e;});}return null;};}function removeEntity(_0x27c9df,_0x31433d){return function(_0x3c2932){if(_0x3c2932){return _0x3c2932[_0x7532('0x22')]()[_0x7532('0x21')](function(){var _0x5b14f1=_0x3c2932[_0x7532('0x23')]({'plain':!![]});var _0x4dd9c9=_0x7532('0x24');return db[_0x7532('0x25')]['destroy']({'where':{'type':_0x4dd9c9,'resourceId':_0x5b14f1['id']}})['then'](function(){return _0x3c2932;});})[_0x7532('0x21')](function(){_0x27c9df[_0x7532('0x18')](0xcc)[_0x7532('0x19')]();});}};}function handleEntityNotFound(_0xea2b4a,_0x5d82b8){return function(_0x1c17e4){if(!_0x1c17e4){_0xea2b4a[_0x7532('0x17')](0x194);}return _0x1c17e4;};}function handleError(_0x2d9043,_0x28521a){_0x28521a=_0x28521a||0x1f4;return function(_0x3883eb){logger[_0x7532('0x26')](_0x3883eb['stack']);if(_0x3883eb[_0x7532('0x27')]){delete _0x3883eb[_0x7532('0x27')];}_0x2d9043['status'](_0x28521a)['send'](_0x3883eb);};}exports[_0x7532('0x28')]=function(_0x4214f5,_0x54b3d0){var _0x1cc70d={},_0x5f28de={},_0x1d3b2b={'count':0x0,'rows':[]};var _0x9fdb1d=_[_0x7532('0x29')](db[_0x7532('0x2a')]['rawAttributes'],function(_0x27666e){return{'name':_0x27666e[_0x7532('0x2b')],'type':_0x27666e[_0x7532('0x2c')][_0x7532('0x2d')]};});_0x5f28de[_0x7532('0x2e')]=_[_0x7532('0x29')](_0x9fdb1d,'name');_0x5f28de[_0x7532('0x2f')]=_[_0x7532('0x30')](_0x4214f5[_0x7532('0x2f')]);_0x5f28de[_0x7532('0x31')]=_['intersection'](_0x5f28de['model'],_0x5f28de[_0x7532('0x2f')]);_0x1cc70d[_0x7532('0x32')]=_['intersection'](_0x5f28de[_0x7532('0x2e')],qs[_0x7532('0x33')](_0x4214f5[_0x7532('0x2f')]['fields']));_0x1cc70d[_0x7532('0x32')]=_0x1cc70d[_0x7532('0x32')]['length']?_0x1cc70d[_0x7532('0x32')]:_0x5f28de['model'];if(!_0x4214f5[_0x7532('0x2f')][_0x7532('0x34')](_0x7532('0x35'))){_0x1cc70d[_0x7532('0x36')]=qs[_0x7532('0x36')](_0x4214f5['query'][_0x7532('0x36')]);_0x1cc70d[_0x7532('0x1c')]=qs[_0x7532('0x1c')](_0x4214f5[_0x7532('0x2f')][_0x7532('0x1c')]);}_0x1cc70d['order']=qs[_0x7532('0x37')](_0x4214f5[_0x7532('0x2f')][_0x7532('0x37')]);_0x1cc70d[_0x7532('0x38')]=qs[_0x7532('0x31')](_['pick'](_0x4214f5['query'],_0x5f28de['filters']),_0x9fdb1d);if(_0x4214f5[_0x7532('0x2f')][_0x7532('0x39')]){_0x1cc70d['where']=_[_0x7532('0x3a')](_0x1cc70d[_0x7532('0x38')],{'$or':_[_0x7532('0x29')](_0x9fdb1d,function(_0x20d0d2){if(_0x20d0d2[_0x7532('0x2c')]!==_0x7532('0x3b')){var _0x2968cd={};_0x2968cd[_0x20d0d2['name']]={'$like':'%'+_0x4214f5[_0x7532('0x2f')][_0x7532('0x39')]+'%'};return _0x2968cd;}})});}_0x1cc70d=_[_0x7532('0x3a')]({},_0x1cc70d,_0x4214f5['options']);var _0xfba0f3={'where':_0x1cc70d[_0x7532('0x38')]};return db[_0x7532('0x2a')][_0x7532('0x1b')](_0xfba0f3)[_0x7532('0x21')](function(_0x37ef6f){_0x1d3b2b[_0x7532('0x1b')]=_0x37ef6f;if(_0x4214f5[_0x7532('0x2f')][_0x7532('0x3c')]){_0x1cc70d[_0x7532('0x3d')]=[{'all':!![]}];}return db[_0x7532('0x2a')]['findAll'](_0x1cc70d);})[_0x7532('0x21')](function(_0x15f009){_0x1d3b2b['rows']=_0x15f009;return _0x1d3b2b;})[_0x7532('0x21')](respondWithFilteredResult(_0x54b3d0,_0x1cc70d))[_0x7532('0x3e')](handleError(_0x54b3d0,null));};exports[_0x7532('0x3f')]=function(_0x4a12e4,_0x11a0c8){var _0x238e38={'raw':!![],'where':{'id':_0x4a12e4['params']['id']}},_0x9a76d0={};_0x9a76d0['model']=_[_0x7532('0x30')](db[_0x7532('0x2a')][_0x7532('0x40')]);_0x9a76d0[_0x7532('0x2f')]=_[_0x7532('0x30')](_0x4a12e4[_0x7532('0x2f')]);_0x9a76d0[_0x7532('0x31')]=_[_0x7532('0x41')](_0x9a76d0[_0x7532('0x2e')],_0x9a76d0[_0x7532('0x2f')]);_0x238e38[_0x7532('0x32')]=_[_0x7532('0x41')](_0x9a76d0[_0x7532('0x2e')],qs[_0x7532('0x33')](_0x4a12e4[_0x7532('0x2f')][_0x7532('0x33')]));_0x238e38['attributes']=_0x238e38[_0x7532('0x32')][_0x7532('0x42')]?_0x238e38[_0x7532('0x32')]:_0x9a76d0[_0x7532('0x2e')];if(_0x4a12e4[_0x7532('0x2f')][_0x7532('0x3c')]){_0x238e38[_0x7532('0x3d')]=[{'all':!![]}];}_0x238e38=_[_0x7532('0x3a')]({},_0x238e38,_0x4a12e4[_0x7532('0x43')]);return db[_0x7532('0x2a')]['find'](_0x238e38)[_0x7532('0x21')](handleEntityNotFound(_0x11a0c8,null))[_0x7532('0x21')](respondWithResult(_0x11a0c8,null))[_0x7532('0x3e')](handleError(_0x11a0c8,null));};exports[_0x7532('0x44')]=function(_0x40dd98,_0x30ab02){return db[_0x7532('0x2a')][_0x7532('0x44')](_0x40dd98['body'],{})[_0x7532('0x21')](function(_0x334af1){var _0x3c906f=_0x40dd98[_0x7532('0x45')][_0x7532('0x23')]({'plain':!![]});if(!_0x3c906f)throw new Error(_0x7532('0x46'));if(_0x3c906f[_0x7532('0x47')]==='user'){var _0x2212eb=_0x334af1[_0x7532('0x23')]({'plain':!![]});var _0xcc46de=_0x7532('0x24');return db[_0x7532('0x48')][_0x7532('0x49')]({'where':{'name':_0xcc46de,'userProfileId':_0x3c906f['userProfileId']},'raw':!![]})[_0x7532('0x21')](function(_0x405f85){if(_0x405f85&&_0x405f85[_0x7532('0x4a')]===0x0){return db[_0x7532('0x25')][_0x7532('0x44')]({'name':_0x2212eb[_0x7532('0x27')],'resourceId':_0x2212eb['id'],'type':_0x405f85[_0x7532('0x27')],'sectionId':_0x405f85['id']},{})[_0x7532('0x21')](function(){return _0x334af1;});}else{return _0x334af1;}})[_0x7532('0x3e')](function(_0x187c44){logger[_0x7532('0x26')](_0x7532('0x4b'),_0x187c44);throw _0x187c44;});}return _0x334af1;})[_0x7532('0x21')](respondWithResult(_0x30ab02,0xc9))[_0x7532('0x3e')](handleError(_0x30ab02,null));};exports['update']=function(_0x2e577f,_0x17fd89){if(_0x2e577f['body']['id']){delete _0x2e577f[_0x7532('0x4c')]['id'];}return db[_0x7532('0x2a')]['find']({'where':{'id':_0x2e577f[_0x7532('0x4d')]['id']}})[_0x7532('0x21')](handleEntityNotFound(_0x17fd89,null))[_0x7532('0x21')](saveUpdates(_0x2e577f[_0x7532('0x4c')],null))[_0x7532('0x21')](respondWithResult(_0x17fd89,null))[_0x7532('0x3e')](handleError(_0x17fd89,null));};exports[_0x7532('0x22')]=function(_0x1d6e22,_0x28311e){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1d6e22[_0x7532('0x4d')]['id']}})[_0x7532('0x21')](handleEntityNotFound(_0x28311e,null))['then'](removeEntity(_0x28311e,null))[_0x7532('0x3e')](handleError(_0x28311e,null));};exports[_0x7532('0x4e')]=function(_0x54ffe8,_0x49d5d0,_0x24795f){return db[_0x7532('0x2a')]['find']({'where':{'id':_0x54ffe8[_0x7532('0x4d')]['id']},'attributes':[_0x7532('0x27'),_0x7532('0x4f'),_0x7532('0x50'),_0x7532('0x51')],'raw':!![]})[_0x7532('0x21')](handleEntityNotFound(_0x49d5d0,null))[_0x7532('0x21')](function(_0x4d50fd){if(_0x4d50fd){if(!fs['existsSync'](path[_0x7532('0x52')](config['root'],_0x7532('0x53'),_0x4d50fd[_0x7532('0x50')]))){throw new db[(_0x7532('0x54'))][(_0x7532('0x55'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x54ffe8[_0x7532('0x2f')][_0x7532('0x56')]){return _0x49d5d0[_0x7532('0x17')](0xc8);}return _0x49d5d0[_0x7532('0x4e')](path[_0x7532('0x52')](config[_0x7532('0x57')],_0x7532('0x53'),_0x4d50fd[_0x7532('0x50')]),util['format']('%s.%s',_0x4d50fd[_0x7532('0x4f')]||_0x4d50fd[_0x7532('0x27')],_0x4d50fd[_0x7532('0x51')]['toLowerCase']()));}})['catch'](handleError(_0x49d5d0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 69a2152..7fac12a 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 _0xb2c4=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','moment','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb2c4,0x104));var _0x4b2c=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xb2c4[_0x339129];return _0x1570df;};'use strict';var _=require(_0x4b2c('0x0'));var util=require(_0x4b2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b2c('0x2'));var BPromise=require(_0x4b2c('0x3'));var rp=require(_0x4b2c('0x4'));var fs=require('fs');var path=require(_0x4b2c('0x5'));var rimraf=require('rimraf');var config=require(_0x4b2c('0x6'));var attributes=require(_0x4b2c('0x7'));module[_0x4b2c('0x8')]=function(_0x1e6bad,_0x398b0e){return _0x1e6bad[_0x4b2c('0x9')](_0x4b2c('0xa'),attributes,{'tableName':_0x4b2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcafa=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x30ef84,_0x127f85){var _0x14ae3=function(_0x56889a){while(--_0x56889a){_0x30ef84['push'](_0x30ef84['shift']());}};_0x14ae3(++_0x127f85);}(_0xcafa,0xfb));var _0xacaf=function(_0x43fa8f,_0x4f7417){_0x43fa8f=_0x43fa8f-0x0;var _0x1221a6=_0xcafa[_0x43fa8f];return _0x1221a6;};'use strict';var _=require(_0xacaf('0x0'));var util=require(_0xacaf('0x1'));var logger=require('../../config/logger')(_0xacaf('0x2'));var moment=require(_0xacaf('0x3'));var BPromise=require(_0xacaf('0x4'));var rp=require(_0xacaf('0x5'));var fs=require('fs');var path=require(_0xacaf('0x6'));var rimraf=require('rimraf');var config=require(_0xacaf('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0xacaf('0x8')]=function(_0x2fb1bf,_0x392405){return _0x2fb1bf[_0xacaf('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xacaf('0xa'),'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 4a3abfb..ed03294 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 _0x4763=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x145067,_0x3bcadb){var _0x2b4929=function(_0x4dac72){while(--_0x4dac72){_0x145067['push'](_0x145067['shift']());}};_0x2b4929(++_0x3bcadb);}(_0x4763,0xb9));var _0x3476=function(_0x161a36,_0x338da9){_0x161a36=_0x161a36-0x0;var _0x21ceea=_0x4763[_0x161a36];return _0x21ceea;};'use strict';var _=require(_0x3476('0x0'));var util=require(_0x3476('0x1'));var moment=require(_0x3476('0x2'));var BPromise=require(_0x3476('0x3'));var rs=require(_0x3476('0x4'));var fs=require('fs');var Redis=require(_0x3476('0x5'));var db=require(_0x3476('0x6'))['db'];var utils=require(_0x3476('0x7'));var logger=require(_0x3476('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3476('0x9'));var client=jayson[_0x3476('0xa')][_0x3476('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x592a62,_0x8a069a,_0x4fec5a){return new BPromise(function(_0x102f7b,_0x453c34){return client[_0x3476('0xc')](_0x592a62,_0x4fec5a)[_0x3476('0xd')](function(_0x190c88){logger[_0x3476('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8a069a,_0x3476('0xf'));logger['debug'](_0x3476('0x10'),_0x8a069a,_0x3476('0xf'),JSON[_0x3476('0x11')](_0x190c88));if(_0x190c88[_0x3476('0x12')]){if(_0x190c88[_0x3476('0x12')][_0x3476('0x13')]===0x1f4){logger[_0x3476('0x12')](_0x3476('0x14'),_0x8a069a,_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);return _0x453c34(_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);}logger[_0x3476('0x12')](_0x3476('0x14'),_0x8a069a,_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);return _0x102f7b(_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);}else{logger['info'](_0x3476('0x14'),_0x8a069a,_0x3476('0xf'));_0x102f7b(_0x190c88[_0x3476('0x16')][_0x3476('0x15')]);}})[_0x3476('0x17')](function(_0x155769){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x8a069a,_0x155769);_0x453c34(_0x155769);});});} \ No newline at end of file +var _0x2836=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x505df1,_0xafc616){var _0x2fb363=function(_0x1d1b53){while(--_0x1d1b53){_0x505df1['push'](_0x505df1['shift']());}};_0x2fb363(++_0xafc616);}(_0x2836,0x148));var _0x6283=function(_0x1d8610,_0x55d241){_0x1d8610=_0x1d8610-0x0;var _0x22c405=_0x2836[_0x1d8610];return _0x22c405;};'use strict';var _=require(_0x6283('0x0'));var util=require(_0x6283('0x1'));var moment=require('moment');var BPromise=require(_0x6283('0x2'));var rs=require(_0x6283('0x3'));var fs=require('fs');var Redis=require(_0x6283('0x4'));var db=require(_0x6283('0x5'))['db'];var utils=require(_0x6283('0x6'));var logger=require(_0x6283('0x7'))(_0x6283('0x8'));var config=require(_0x6283('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6283('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb723ac,_0x15d6f4,_0x5b5c84){return new BPromise(function(_0x434417,_0x10b6b0){return client[_0x6283('0xb')](_0xb723ac,_0x5b5c84)['then'](function(_0x5c984e){logger[_0x6283('0xc')](_0x6283('0xd'),_0x15d6f4,_0x6283('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x15d6f4,_0x6283('0xe'),JSON['stringify'](_0x5c984e));if(_0x5c984e[_0x6283('0xf')]){if(_0x5c984e[_0x6283('0xf')][_0x6283('0x10')]===0x1f4){logger[_0x6283('0xf')](_0x6283('0xd'),_0x15d6f4,_0x5c984e[_0x6283('0xf')][_0x6283('0x11')]);return _0x10b6b0(_0x5c984e['error']['message']);}logger[_0x6283('0xf')](_0x6283('0xd'),_0x15d6f4,_0x5c984e['error'][_0x6283('0x11')]);return _0x434417(_0x5c984e['error'][_0x6283('0x11')]);}else{logger[_0x6283('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x15d6f4,_0x6283('0xe'));_0x434417(_0x5c984e[_0x6283('0x12')][_0x6283('0x11')]);}})[_0x6283('0x13')](function(_0x21104a){logger[_0x6283('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x15d6f4,_0x21104a);_0x10b6b0(_0x21104a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1a31216..95a28e3 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 _0x750a=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy'];(function(_0x11d4f8,_0x35ebc7){var _0x4f349f=function(_0x43fdc8){while(--_0x43fdc8){_0x11d4f8['push'](_0x11d4f8['shift']());}};_0x4f349f(++_0x35ebc7);}(_0x750a,0x140));var _0xa750=function(_0x2f1477,_0x4857be){_0x2f1477=_0x2f1477-0x0;var _0x5ada87=_0x750a[_0x2f1477];return _0x5ada87;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['get']('/:id/download',auth[_0xa750('0x8')](),controller['download']);router[_0xa750('0xc')]('/',auth[_0xa750('0x8')](),controller['create']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa750('0xe')]('/:id',auth[_0xa750('0x8')](),controller[_0xa750('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1058=['/:id/download','isAuthenticated','download','post','create','put','delete','exports','multer','util','express','Router','./analyticExtractedReport.controller','index','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1058,0x148));var _0x8105=function(_0x572911,_0x11d671){_0x572911=_0x572911-0x0;var _0xda6d77=_0x1058[_0x572911];return _0xda6d77;};'use strict';var multer=require(_0x8105('0x0'));var util=require(_0x8105('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8105('0x2'));var router=express[_0x8105('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8105('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x8105('0x5')]);router[_0x8105('0x6')](_0x8105('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x8105('0x6')](_0x8105('0x8'),auth[_0x8105('0x9')](),controller[_0x8105('0xa')]);router[_0x8105('0xb')]('/',auth[_0x8105('0x9')](),controller[_0x8105('0xc')]);router[_0x8105('0xd')](_0x8105('0x7'),auth[_0x8105('0x9')](),controller['update']);router[_0x8105('0xe')](_0x8105('0x7'),auth[_0x8105('0x9')](),controller['destroy']);module[_0x8105('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ea3bd9a..2d4d441 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5f547a,_0x373527){var _0x412ad0=function(_0x28d9af){while(--_0x28d9af){_0x5f547a['push'](_0x5f547a['shift']());}};_0x412ad0(++_0x373527);}(_0x5fc3,0xa8));var _0x35fc=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x5fc3[_0xa4c85];return _0x172c1f;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x221d87,_0x2c548c){var _0x15a198=function(_0x58235c){while(--_0x58235c){_0x221d87['push'](_0x221d87['shift']());}};_0x15a198(++_0x2c548c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x5fc3[_0x35f7f5];return _0x5567a4;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 33c7d95..a23d0dc 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 _0x8ce1=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticFieldReport','includeAll','include','findAll','catch','params','keys','length','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x105afe,_0x108680){var _0xcbded=function(_0x85a3a8){while(--_0x85a3a8){_0x105afe['push'](_0x105afe['shift']());}};_0xcbded(++_0x108680);}(_0x8ce1,0x183));var _0x18ce=function(_0xc89c4d,_0x3a2aba){_0xc89c4d=_0xc89c4d-0x0;var _0x55fc31=_0x8ce1[_0xc89c4d];return _0x55fc31;};'use strict';var pdf=require(_0x18ce('0x0'));var emlformat=require(_0x18ce('0x1'));var rimraf=require(_0x18ce('0x2'));var zipdir=require(_0x18ce('0x3'));var jsonpatch=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var moment=require(_0x18ce('0x6'));var BPromise=require(_0x18ce('0x7'));var Mustache=require(_0x18ce('0x8'));var util=require(_0x18ce('0x9'));var path=require(_0x18ce('0xa'));var sox=require(_0x18ce('0xb'));var csv=require(_0x18ce('0xc'));var ejs=require(_0x18ce('0xd'));var fs=require('fs');var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xc'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var db=require(_0x18ce('0x1a'))['db'];function respondWithStatusCode(_0x249697,_0x5e8c23){_0x5e8c23=_0x5e8c23||0xcc;return function(_0xbd514b){if(_0xbd514b){return _0x249697[_0x18ce('0x1b')](_0x5e8c23);}return _0x249697[_0x18ce('0x1c')](_0x5e8c23)[_0x18ce('0x1d')]();};}function respondWithResult(_0x2158aa,_0x5daf04){_0x5daf04=_0x5daf04||0xc8;return function(_0x176797){if(_0x176797){return _0x2158aa[_0x18ce('0x1c')](_0x5daf04)[_0x18ce('0x1e')](_0x176797);}};}function respondWithFilteredResult(_0x3c40c4,_0x46e346){return function(_0x36b5da){if(_0x36b5da){var _0x17460e=_0x36b5da[_0x18ce('0x1f')],_0x4a934f=_0x46e346[_0x18ce('0x20')],_0x959ce=_0x46e346[_0x18ce('0x20')]+_0x46e346[_0x18ce('0x21')],_0x1357ef;if(_0x959ce>=_0x17460e){_0x959ce=_0x17460e;_0x1357ef=0xc8;}else{_0x1357ef=0xce;}_0x3c40c4['status'](_0x1357ef);return _0x3c40c4[_0x18ce('0x22')](_0x18ce('0x23'),_0x4a934f+'-'+_0x959ce+'/'+_0x17460e)[_0x18ce('0x1e')](_0x36b5da);}return null;};}function patchUpdates(_0x56644c){return function(_0x35e446){try{jsonpatch[_0x18ce('0x24')](_0x35e446,_0x56644c,!![]);}catch(_0xb3725c){return BPromise['reject'](_0xb3725c);}return _0x35e446[_0x18ce('0x25')]();};}function saveUpdates(_0x19084e,_0x5d22cd){return function(_0x29c1ab){if(_0x29c1ab){return _0x29c1ab[_0x18ce('0x26')](_0x19084e)[_0x18ce('0x27')](function(_0x392f6d){return _0x392f6d;});}return null;};}function removeEntity(_0x31b789,_0xd41f29){return function(_0x35abf9){if(_0x35abf9){return _0x35abf9[_0x18ce('0x28')]()[_0x18ce('0x27')](function(){_0x31b789['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d2299,_0x32e910){return function(_0x576ecc){if(!_0x576ecc){_0x5d2299[_0x18ce('0x1b')](0x194);}return _0x576ecc;};}function handleError(_0x1b7e0b,_0x3fe231){_0x3fe231=_0x3fe231||0x1f4;return function(_0x4fedbd){logger['error'](_0x4fedbd['stack']);if(_0x4fedbd[_0x18ce('0x29')]){delete _0x4fedbd[_0x18ce('0x29')];}_0x1b7e0b[_0x18ce('0x1c')](_0x3fe231)[_0x18ce('0x2a')](_0x4fedbd);};}exports[_0x18ce('0x2b')]=function(_0xc3cd4,_0x5583c6){var _0x5279f8={},_0x573e41={},_0x1ff3b1={'count':0x0,'rows':[]};var _0x3719a2=_[_0x18ce('0x2c')](db['AnalyticFieldReport'][_0x18ce('0x2d')],function(_0xf2683f){return{'name':_0xf2683f[_0x18ce('0x2e')],'type':_0xf2683f['type']['key']};});_0x573e41['model']=_[_0x18ce('0x2c')](_0x3719a2,_0x18ce('0x29'));_0x573e41['query']=_['keys'](_0xc3cd4[_0x18ce('0x2f')]);_0x573e41[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x573e41['model'],_0x573e41['query']);_0x5279f8[_0x18ce('0x32')]=_[_0x18ce('0x31')](_0x573e41[_0x18ce('0x33')],qs[_0x18ce('0x34')](_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x34')]));_0x5279f8[_0x18ce('0x32')]=_0x5279f8[_0x18ce('0x32')]['length']?_0x5279f8['attributes']:_0x573e41[_0x18ce('0x33')];if(!_0xc3cd4[_0x18ce('0x2f')]['hasOwnProperty'](_0x18ce('0x35'))){_0x5279f8['limit']=qs[_0x18ce('0x21')](_0xc3cd4['query'][_0x18ce('0x21')]);_0x5279f8[_0x18ce('0x20')]=qs[_0x18ce('0x20')](_0xc3cd4['query']['offset']);}_0x5279f8[_0x18ce('0x36')]=qs[_0x18ce('0x37')](_0xc3cd4['query']['sort']);_0x5279f8[_0x18ce('0x38')]=qs[_0x18ce('0x30')](_[_0x18ce('0x39')](_0xc3cd4[_0x18ce('0x2f')],_0x573e41[_0x18ce('0x30')]),_0x3719a2);if(_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x3a')]){_0x5279f8[_0x18ce('0x38')]=_[_0x18ce('0x3b')](_0x5279f8[_0x18ce('0x38')],{'$or':_[_0x18ce('0x2c')](_0x3719a2,function(_0x465f70){if(_0x465f70[_0x18ce('0x3c')]!=='VIRTUAL'){var _0x2e997b={};_0x2e997b[_0x465f70[_0x18ce('0x29')]]={'$like':'%'+_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x3a')]+'%'};return _0x2e997b;}})});}_0x5279f8=_[_0x18ce('0x3b')]({},_0x5279f8,_0xc3cd4[_0x18ce('0x3d')]);var _0x112954={'where':_0x5279f8[_0x18ce('0x38')]};return db[_0x18ce('0x3e')][_0x18ce('0x1f')](_0x112954)['then'](function(_0x590fb7){_0x1ff3b1[_0x18ce('0x1f')]=_0x590fb7;if(_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x3f')]){_0x5279f8[_0x18ce('0x40')]=[{'all':!![]}];}return db[_0x18ce('0x3e')][_0x18ce('0x41')](_0x5279f8);})[_0x18ce('0x27')](function(_0x59a821){_0x1ff3b1['rows']=_0x59a821;return _0x1ff3b1;})[_0x18ce('0x27')](respondWithFilteredResult(_0x5583c6,_0x5279f8))[_0x18ce('0x42')](handleError(_0x5583c6,null));};exports['show']=function(_0x34a3d9,_0x1ee4db){var _0x2941ce={'raw':![],'where':{'id':_0x34a3d9[_0x18ce('0x43')]['id']}},_0x361944={};_0x361944[_0x18ce('0x33')]=_[_0x18ce('0x44')](db[_0x18ce('0x3e')][_0x18ce('0x2d')]);_0x361944[_0x18ce('0x2f')]=_[_0x18ce('0x44')](_0x34a3d9[_0x18ce('0x2f')]);_0x361944['filters']=_[_0x18ce('0x31')](_0x361944[_0x18ce('0x33')],_0x361944[_0x18ce('0x2f')]);_0x2941ce[_0x18ce('0x32')]=_[_0x18ce('0x31')](_0x361944[_0x18ce('0x33')],qs[_0x18ce('0x34')](_0x34a3d9['query']['fields']));_0x2941ce[_0x18ce('0x32')]=_0x2941ce[_0x18ce('0x32')][_0x18ce('0x45')]?_0x2941ce[_0x18ce('0x32')]:_0x361944['model'];if(_0x34a3d9[_0x18ce('0x2f')][_0x18ce('0x3f')]){_0x2941ce[_0x18ce('0x40')]=[{'all':!![]}];}_0x2941ce=_['merge']({},_0x2941ce,_0x34a3d9['options']);return db[_0x18ce('0x3e')][_0x18ce('0x46')](_0x2941ce)['then'](handleEntityNotFound(_0x1ee4db,null))[_0x18ce('0x27')](respondWithResult(_0x1ee4db,null))[_0x18ce('0x42')](handleError(_0x1ee4db,null));};exports[_0x18ce('0x47')]=function(_0x11010f,_0x22cdf6){return db[_0x18ce('0x3e')][_0x18ce('0x47')](_0x11010f['body'],{})[_0x18ce('0x27')](respondWithResult(_0x22cdf6,0xc9))[_0x18ce('0x42')](handleError(_0x22cdf6,null));};exports[_0x18ce('0x48')]=function(_0x1e445d,_0x227fb6){return db[_0x18ce('0x3e')][_0x18ce('0x48')](_0x1e445d[_0x18ce('0x49')],{'raw':![],'individualHooks':!![]})[_0x18ce('0x27')](respondWithResult(_0x227fb6,0xc9))[_0x18ce('0x42')](handleError(_0x227fb6,null));};exports[_0x18ce('0x26')]=function(_0x3f9960,_0x37bbed){if(_0x3f9960[_0x18ce('0x49')]['id']){delete _0x3f9960['body']['id'];}return db[_0x18ce('0x3e')][_0x18ce('0x46')]({'where':{'id':_0x3f9960['params']['id']}})[_0x18ce('0x27')](handleEntityNotFound(_0x37bbed,null))['then'](saveUpdates(_0x3f9960[_0x18ce('0x49')],null))['then'](respondWithResult(_0x37bbed,null))[_0x18ce('0x42')](handleError(_0x37bbed,null));};exports[_0x18ce('0x28')]=function(_0x3d5b1b,_0xdfa85e){return db['AnalyticFieldReport'][_0x18ce('0x46')]({'where':{'id':_0x3d5b1b['params']['id']}})['then'](handleEntityNotFound(_0xdfa85e,null))[_0x18ce('0x27')](removeEntity(_0xdfa85e,null))[_0x18ce('0x42')](handleError(_0xdfa85e,null));};exports[_0x18ce('0x4a')]=function(_0x5f164a,_0x51266d){return db[_0x18ce('0x3e')][_0x18ce('0x28')]({'where':{'id':_0x5f164a[_0x18ce('0x2f')][_0x18ce('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x51266d,0xcc))['catch'](handleError(_0x51266d,null));};exports[_0x18ce('0x4c')]=function(_0x4b095c,_0x3833de,_0xf5eec5){return db[_0x18ce('0x4d')]['findOne']({'where':{'id':_0x4b095c[_0x18ce('0x43')]['id']}})[_0x18ce('0x27')](handleEntityNotFound(_0x3833de,null))[_0x18ce('0x27')](function(_0x59326d){if(_0x59326d){return db[_0x18ce('0x4e')][_0x18ce('0x4f')](function(_0x25bcb8){return db['AnalyticFieldReport'][_0x18ce('0x28')]({'where':{'CustomReportId':_0x4b095c[_0x18ce('0x43')]['id']},'transaction':_0x25bcb8})[_0x18ce('0x27')](function(_0x9fce1a){var _0x55161d=_['map'](_0x4b095c[_0x18ce('0x49')],function(_0x35a30f){delete _0x35a30f['id'];_0x35a30f[_0x18ce('0x50')]=_0x4b095c[_0x18ce('0x43')]['id'];return _0x35a30f;});return db[_0x18ce('0x3e')][_0x18ce('0x48')](_0x55161d,{'transaction':_0x25bcb8});});})[_0x18ce('0x27')](function(){return db['AnalyticFieldReport'][_0x18ce('0x41')]({'where':{'CustomReportId':_0x4b095c[_0x18ce('0x43')]['id']}});});}})['then'](respondWithResult(_0x3833de,null))[_0x18ce('0x42')](handleError(_0x3833de,null));}; \ No newline at end of file +var _0x4f88=['merge','VIRTUAL','filter','options','includeAll','rows','catch','params','find','body','bulkCreate','AnalyticFieldReport','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2d876e,_0x6cb88d){var _0x21fa1b=function(_0x546c8a){while(--_0x546c8a){_0x2d876e['push'](_0x2d876e['shift']());}};_0x21fa1b(++_0x6cb88d);}(_0x4f88,0xf3));var _0x84f8=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x4f88[_0x27bcf5];return _0x4ce4cf;};'use strict';var pdf=require(_0x84f8('0x0'));var emlformat=require(_0x84f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x84f8('0x2'));var jsonpatch=require(_0x84f8('0x3'));var rp=require(_0x84f8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84f8('0x5'));var util=require(_0x84f8('0x6'));var path=require(_0x84f8('0x7'));var sox=require(_0x84f8('0x8'));var csv=require(_0x84f8('0x9'));var ejs=require(_0x84f8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x84f8('0xb'));var crypto=require(_0x84f8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x84f8('0x9'));var querystring=require(_0x84f8('0xd'));var Papa=require(_0x84f8('0xe'));var Redis=require(_0x84f8('0xf'));var authService=require(_0x84f8('0x10'));var qs=require(_0x84f8('0x11'));var as=require(_0x84f8('0x12'));var hardwareService=require(_0x84f8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x84f8('0x14'));var config=require(_0x84f8('0x15'));var db=require(_0x84f8('0x16'))['db'];function respondWithStatusCode(_0x238c5d,_0xc8d4b3){_0xc8d4b3=_0xc8d4b3||0xcc;return function(_0x49812d){if(_0x49812d){return _0x238c5d[_0x84f8('0x17')](_0xc8d4b3);}return _0x238c5d[_0x84f8('0x18')](_0xc8d4b3)[_0x84f8('0x19')]();};}function respondWithResult(_0x3a3809,_0x25750c){_0x25750c=_0x25750c||0xc8;return function(_0x58d1e7){if(_0x58d1e7){return _0x3a3809[_0x84f8('0x18')](_0x25750c)[_0x84f8('0x1a')](_0x58d1e7);}};}function respondWithFilteredResult(_0x284427,_0x39f903){return function(_0x4c4d61){if(_0x4c4d61){var _0x15fc4a=_0x4c4d61[_0x84f8('0x1b')],_0x5ed4b3=_0x39f903['offset'],_0x4642e9=_0x39f903[_0x84f8('0x1c')]+_0x39f903[_0x84f8('0x1d')],_0x3862da;if(_0x4642e9>=_0x15fc4a){_0x4642e9=_0x15fc4a;_0x3862da=0xc8;}else{_0x3862da=0xce;}_0x284427[_0x84f8('0x18')](_0x3862da);return _0x284427[_0x84f8('0x1e')](_0x84f8('0x1f'),_0x5ed4b3+'-'+_0x4642e9+'/'+_0x15fc4a)[_0x84f8('0x1a')](_0x4c4d61);}return null;};}function patchUpdates(_0x53c7ca){return function(_0x12a29a){try{jsonpatch[_0x84f8('0x20')](_0x12a29a,_0x53c7ca,!![]);}catch(_0x20c99d){return BPromise['reject'](_0x20c99d);}return _0x12a29a['save']();};}function saveUpdates(_0x2e23e4,_0x5ecb0d){return function(_0x224909){if(_0x224909){return _0x224909[_0x84f8('0x21')](_0x2e23e4)[_0x84f8('0x22')](function(_0x38e39a){return _0x38e39a;});}return null;};}function removeEntity(_0x5ad055,_0x2e6da3){return function(_0x19193a){if(_0x19193a){return _0x19193a[_0x84f8('0x23')]()[_0x84f8('0x22')](function(){_0x5ad055['status'](0xcc)[_0x84f8('0x19')]();});}};}function handleEntityNotFound(_0x2d924a,_0x28a651){return function(_0x4a47f1){if(!_0x4a47f1){_0x2d924a[_0x84f8('0x17')](0x194);}return _0x4a47f1;};}function handleError(_0xc040a2,_0x230ea3){_0x230ea3=_0x230ea3||0x1f4;return function(_0xf7270a){logger[_0x84f8('0x24')](_0xf7270a['stack']);if(_0xf7270a[_0x84f8('0x25')]){delete _0xf7270a['name'];}_0xc040a2['status'](_0x230ea3)[_0x84f8('0x26')](_0xf7270a);};}exports[_0x84f8('0x27')]=function(_0x27fe17,_0x5b896e){var _0x18731d={},_0x454a11={},_0x550b29={'count':0x0,'rows':[]};var _0x2561ff=_[_0x84f8('0x28')](db['AnalyticFieldReport']['rawAttributes'],function(_0x2c08e1){return{'name':_0x2c08e1[_0x84f8('0x29')],'type':_0x2c08e1[_0x84f8('0x2a')][_0x84f8('0x2b')]};});_0x454a11['model']=_[_0x84f8('0x28')](_0x2561ff,_0x84f8('0x25'));_0x454a11[_0x84f8('0x2c')]=_[_0x84f8('0x2d')](_0x27fe17['query']);_0x454a11[_0x84f8('0x2e')]=_[_0x84f8('0x2f')](_0x454a11[_0x84f8('0x30')],_0x454a11[_0x84f8('0x2c')]);_0x18731d['attributes']=_['intersection'](_0x454a11['model'],qs[_0x84f8('0x31')](_0x27fe17[_0x84f8('0x2c')][_0x84f8('0x31')]));_0x18731d[_0x84f8('0x32')]=_0x18731d[_0x84f8('0x32')][_0x84f8('0x33')]?_0x18731d[_0x84f8('0x32')]:_0x454a11[_0x84f8('0x30')];if(!_0x27fe17[_0x84f8('0x2c')][_0x84f8('0x34')](_0x84f8('0x35'))){_0x18731d[_0x84f8('0x1d')]=qs[_0x84f8('0x1d')](_0x27fe17[_0x84f8('0x2c')][_0x84f8('0x1d')]);_0x18731d[_0x84f8('0x1c')]=qs['offset'](_0x27fe17[_0x84f8('0x2c')]['offset']);}_0x18731d[_0x84f8('0x36')]=qs[_0x84f8('0x37')](_0x27fe17['query'][_0x84f8('0x37')]);_0x18731d[_0x84f8('0x38')]=qs[_0x84f8('0x2e')](_['pick'](_0x27fe17[_0x84f8('0x2c')],_0x454a11['filters']),_0x2561ff);if(_0x27fe17['query']['filter']){_0x18731d[_0x84f8('0x38')]=_[_0x84f8('0x39')](_0x18731d[_0x84f8('0x38')],{'$or':_[_0x84f8('0x28')](_0x2561ff,function(_0x139a35){if(_0x139a35[_0x84f8('0x2a')]!==_0x84f8('0x3a')){var _0x3a54c2={};_0x3a54c2[_0x139a35[_0x84f8('0x25')]]={'$like':'%'+_0x27fe17[_0x84f8('0x2c')][_0x84f8('0x3b')]+'%'};return _0x3a54c2;}})});}_0x18731d=_[_0x84f8('0x39')]({},_0x18731d,_0x27fe17[_0x84f8('0x3c')]);var _0x472a05={'where':_0x18731d[_0x84f8('0x38')]};return db['AnalyticFieldReport'][_0x84f8('0x1b')](_0x472a05)[_0x84f8('0x22')](function(_0x2ff8c8){_0x550b29['count']=_0x2ff8c8;if(_0x27fe17[_0x84f8('0x2c')][_0x84f8('0x3d')]){_0x18731d['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x18731d);})[_0x84f8('0x22')](function(_0x2776fa){_0x550b29[_0x84f8('0x3e')]=_0x2776fa;return _0x550b29;})[_0x84f8('0x22')](respondWithFilteredResult(_0x5b896e,_0x18731d))[_0x84f8('0x3f')](handleError(_0x5b896e,null));};exports['show']=function(_0x2b1915,_0x5b007c){var _0x3cbcd7={'raw':![],'where':{'id':_0x2b1915[_0x84f8('0x40')]['id']}},_0x642aa8={};_0x642aa8['model']=_[_0x84f8('0x2d')](db['AnalyticFieldReport']['rawAttributes']);_0x642aa8[_0x84f8('0x2c')]=_['keys'](_0x2b1915[_0x84f8('0x2c')]);_0x642aa8[_0x84f8('0x2e')]=_[_0x84f8('0x2f')](_0x642aa8[_0x84f8('0x30')],_0x642aa8[_0x84f8('0x2c')]);_0x3cbcd7['attributes']=_[_0x84f8('0x2f')](_0x642aa8[_0x84f8('0x30')],qs[_0x84f8('0x31')](_0x2b1915[_0x84f8('0x2c')]['fields']));_0x3cbcd7[_0x84f8('0x32')]=_0x3cbcd7['attributes']['length']?_0x3cbcd7[_0x84f8('0x32')]:_0x642aa8[_0x84f8('0x30')];if(_0x2b1915[_0x84f8('0x2c')][_0x84f8('0x3d')]){_0x3cbcd7['include']=[{'all':!![]}];}_0x3cbcd7=_[_0x84f8('0x39')]({},_0x3cbcd7,_0x2b1915[_0x84f8('0x3c')]);return db['AnalyticFieldReport'][_0x84f8('0x41')](_0x3cbcd7)[_0x84f8('0x22')](handleEntityNotFound(_0x5b007c,null))[_0x84f8('0x22')](respondWithResult(_0x5b007c,null))[_0x84f8('0x3f')](handleError(_0x5b007c,null));};exports['create']=function(_0x475ef,_0x4e779){return db['AnalyticFieldReport']['create'](_0x475ef[_0x84f8('0x42')],{})[_0x84f8('0x22')](respondWithResult(_0x4e779,0xc9))[_0x84f8('0x3f')](handleError(_0x4e779,null));};exports[_0x84f8('0x43')]=function(_0x518ade,_0x363bd8){return db[_0x84f8('0x44')][_0x84f8('0x43')](_0x518ade[_0x84f8('0x42')],{'raw':![],'individualHooks':!![]})[_0x84f8('0x22')](respondWithResult(_0x363bd8,0xc9))[_0x84f8('0x3f')](handleError(_0x363bd8,null));};exports[_0x84f8('0x21')]=function(_0x2568ab,_0x342165){if(_0x2568ab[_0x84f8('0x42')]['id']){delete _0x2568ab[_0x84f8('0x42')]['id'];}return db[_0x84f8('0x44')][_0x84f8('0x41')]({'where':{'id':_0x2568ab[_0x84f8('0x40')]['id']}})[_0x84f8('0x22')](handleEntityNotFound(_0x342165,null))[_0x84f8('0x22')](saveUpdates(_0x2568ab[_0x84f8('0x42')],null))[_0x84f8('0x22')](respondWithResult(_0x342165,null))['catch'](handleError(_0x342165,null));};exports['destroy']=function(_0x53424f,_0x1f9453){return db['AnalyticFieldReport'][_0x84f8('0x41')]({'where':{'id':_0x53424f[_0x84f8('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f9453,null))[_0x84f8('0x22')](removeEntity(_0x1f9453,null))[_0x84f8('0x3f')](handleError(_0x1f9453,null));};exports[_0x84f8('0x45')]=function(_0x11d392,_0x4230bd){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x11d392[_0x84f8('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x84f8('0x22')](respondWithResult(_0x4230bd,0xcc))[_0x84f8('0x3f')](handleError(_0x4230bd,null));};exports[_0x84f8('0x46')]=function(_0x41c243,_0x33eca3,_0x86f8c7){return db[_0x84f8('0x47')][_0x84f8('0x48')]({'where':{'id':_0x41c243[_0x84f8('0x40')]['id']}})[_0x84f8('0x22')](handleEntityNotFound(_0x33eca3,null))[_0x84f8('0x22')](function(_0x50cc40){if(_0x50cc40){return db[_0x84f8('0x49')]['transaction'](function(_0x2b089c){return db[_0x84f8('0x44')][_0x84f8('0x23')]({'where':{'CustomReportId':_0x41c243[_0x84f8('0x40')]['id']},'transaction':_0x2b089c})[_0x84f8('0x22')](function(_0xac248b){var _0x15e25b=_['map'](_0x41c243[_0x84f8('0x42')],function(_0x14d212){delete _0x14d212['id'];_0x14d212['CustomReportId']=_0x41c243[_0x84f8('0x40')]['id'];return _0x14d212;});return db[_0x84f8('0x44')][_0x84f8('0x43')](_0x15e25b,{'transaction':_0x2b089c});});})[_0x84f8('0x22')](function(){return db[_0x84f8('0x44')][_0x84f8('0x4a')]({'where':{'CustomReportId':_0x41c243[_0x84f8('0x40')]['id']}});});}})['then'](respondWithResult(_0x33eca3,null))[_0x84f8('0x3f')](handleError(_0x33eca3,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1a4ad87..369ab1c 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 _0xd9f8=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','../../config/logger','api'];(function(_0x3deac5,_0x27c6bb){var _0x1d6898=function(_0x2347fe){while(--_0x2347fe){_0x3deac5['push'](_0x3deac5['shift']());}};_0x1d6898(++_0x27c6bb);}(_0xd9f8,0xed));var _0x8d9f=function(_0x4b67f5,_0x226f72){_0x4b67f5=_0x4b67f5-0x0;var _0x3a627a=_0xd9f8[_0x4b67f5];return _0x3a627a;};'use strict';var _=require(_0x8d9f('0x0'));var util=require('util');var logger=require(_0x8d9f('0x1'))(_0x8d9f('0x2'));var moment=require('moment');var BPromise=require(_0x8d9f('0x3'));var rp=require(_0x8d9f('0x4'));var fs=require('fs');var path=require(_0x8d9f('0x5'));var rimraf=require(_0x8d9f('0x6'));var config=require(_0x8d9f('0x7'));var attributes=require(_0x8d9f('0x8'));module[_0x8d9f('0x9')]=function(_0x31ba12,_0x4d073c){return _0x31ba12[_0x8d9f('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x8d9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e57=['analytics_report_fields','util','../../config/logger','api','moment','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e57,0xcd));var _0x71e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e57[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x71e5('0x0'));var logger=require(_0x71e5('0x1'))(_0x71e5('0x2'));var moment=require(_0x71e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x71e5('0x4'));var fs=require('fs');var path=require(_0x71e5('0x5'));var rimraf=require(_0x71e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x71e5('0x7'));module[_0x71e5('0x8')]=function(_0x2869c0,_0x2506e1){return _0x2869c0[_0x71e5('0x9')](_0x71e5('0xa'),attributes,{'tableName':_0x71e5('0xb'),'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 cef6c33..2a3e587 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 _0xea9b=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4be29e,_0x43f28a){var _0x52f7d1=function(_0xe6e6a9){while(--_0xe6e6a9){_0x4be29e['push'](_0x4be29e['shift']());}};_0x52f7d1(++_0x43f28a);}(_0xea9b,0x1e4));var _0xbea9=function(_0x6839e1,_0x424ff0){_0x6839e1=_0x6839e1-0x0;var _0x57cd23=_0xea9b[_0x6839e1];return _0x57cd23;};'use strict';var _=require(_0xbea9('0x0'));var util=require(_0xbea9('0x1'));var moment=require(_0xbea9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbea9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbea9('0x4'));var logger=require(_0xbea9('0x5'))('rpc');var config=require(_0xbea9('0x6'));var jayson=require(_0xbea9('0x7'));var client=jayson[_0xbea9('0x8')][_0xbea9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19cbd3,_0x5a88f2,_0x48ce83){return new BPromise(function(_0x3a4322,_0x57a7d1){return client[_0xbea9('0xa')](_0x19cbd3,_0x48ce83)[_0xbea9('0xb')](function(_0x436480){logger[_0xbea9('0xc')](_0xbea9('0xd'),_0x5a88f2,_0xbea9('0xe'));logger[_0xbea9('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5a88f2,_0xbea9('0xe'),JSON[_0xbea9('0x10')](_0x436480));if(_0x436480['error']){if(_0x436480[_0xbea9('0x11')][_0xbea9('0x12')]===0x1f4){logger[_0xbea9('0x11')](_0xbea9('0xd'),_0x5a88f2,_0x436480[_0xbea9('0x11')][_0xbea9('0x13')]);return _0x57a7d1(_0x436480[_0xbea9('0x11')]['message']);}logger['error'](_0xbea9('0xd'),_0x5a88f2,_0x436480[_0xbea9('0x11')][_0xbea9('0x13')]);return _0x3a4322(_0x436480[_0xbea9('0x11')][_0xbea9('0x13')]);}else{logger[_0xbea9('0xc')](_0xbea9('0xd'),_0x5a88f2,_0xbea9('0xe'));_0x3a4322(_0x436480[_0xbea9('0x14')][_0xbea9('0x13')]);}})[_0xbea9('0x15')](function(_0xce612a){logger['error'](_0xbea9('0xd'),_0x5a88f2,_0xce612a);_0x57a7d1(_0xce612a);});});} \ No newline at end of file +var _0xb343=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2f0755,_0x117f40){var _0x390bc6=function(_0x37862a){while(--_0x37862a){_0x2f0755['push'](_0x2f0755['shift']());}};_0x390bc6(++_0x117f40);}(_0xb343,0xc4));var _0x3b34=function(_0x3b9100,_0x3b19b8){_0x3b9100=_0x3b9100-0x0;var _0x395c2a=_0xb343[_0x3b9100];return _0x395c2a;};'use strict';var _=require('lodash');var util=require(_0x3b34('0x0'));var moment=require('moment');var BPromise=require(_0x3b34('0x1'));var rs=require(_0x3b34('0x2'));var fs=require('fs');var Redis=require(_0x3b34('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b34('0x4'));var logger=require(_0x3b34('0x5'))(_0x3b34('0x6'));var config=require(_0x3b34('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b34('0x8')][_0x3b34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41cfa4,_0x473710,_0x571db0){return new BPromise(function(_0x4e3c86,_0x1e5c1c){return client[_0x3b34('0xa')](_0x41cfa4,_0x571db0)[_0x3b34('0xb')](function(_0x17955b){logger['info'](_0x3b34('0xc'),_0x473710,_0x3b34('0xd'));logger[_0x3b34('0xe')](_0x3b34('0xf'),_0x473710,_0x3b34('0xd'),JSON[_0x3b34('0x10')](_0x17955b));if(_0x17955b[_0x3b34('0x11')]){if(_0x17955b[_0x3b34('0x11')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x473710,_0x17955b[_0x3b34('0x11')][_0x3b34('0x12')]);return _0x1e5c1c(_0x17955b[_0x3b34('0x11')]['message']);}logger[_0x3b34('0x11')](_0x3b34('0xc'),_0x473710,_0x17955b[_0x3b34('0x11')][_0x3b34('0x12')]);return _0x4e3c86(_0x17955b[_0x3b34('0x11')][_0x3b34('0x12')]);}else{logger[_0x3b34('0x13')](_0x3b34('0xc'),_0x473710,'request\x20sent');_0x4e3c86(_0x17955b['result']['message']);}})[_0x3b34('0x14')](function(_0x5605db){logger[_0x3b34('0x11')](_0x3b34('0xc'),_0x473710,_0x5605db);_0x1e5c1c(_0x5605db);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ef4f018..3f465a8 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 _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x3c2c2a,_0x2bce72){var _0xf1156b=function(_0x2d874e){while(--_0x2d874e){_0x3c2c2a['push'](_0x3c2c2a['shift']());}};_0xf1156b(++_0x2bce72);}(_0xe14b,0x93));var _0xbe14=function(_0x180237,_0xfd4959){_0x180237=_0x180237-0x0;var _0x56fa74=_0xe14b[_0x180237];return _0x56fa74;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file +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(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index bfe12de..e597ea6 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 _0xac4a=['exports','STRING','name','TEXT','sequelize'];(function(_0x2628cd,_0x46ee78){var _0x71580d=function(_0xe8cce5){while(--_0xe8cce5){_0x2628cd['push'](_0x2628cd['shift']());}};_0x71580d(++_0x46ee78);}(_0xac4a,0x13f));var _0xaac4=function(_0x3a01cf,_0x15f90c){_0x3a01cf=_0x3a01cf-0x0;var _0x5e4f5a=_0xac4a[_0x3a01cf];return _0x5e4f5a;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![],'unique':_0xaac4('0x3')},'table':{'type':Sequelize[_0xaac4('0x2')]},'metric':{'type':Sequelize[_0xaac4('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x336d=['name','TEXT','exports','STRING'];(function(_0x18e2ef,_0x10c907){var _0x483023=function(_0x476872){while(--_0x476872){_0x18e2ef['push'](_0x18e2ef['shift']());}};_0x483023(++_0x10c907);}(_0x336d,0xae));var _0xd336=function(_0x1d6b06,_0x4173ba){_0x1d6b06=_0x1d6b06-0x0;var _0x37dd35=_0x336d[_0x1d6b06];return _0x37dd35;};'use strict';var Sequelize=require('sequelize');module[_0xd336('0x0')]={'name':{'type':Sequelize[_0xd336('0x1')],'allowNull':![],'unique':_0xd336('0x2')},'table':{'type':Sequelize[_0xd336('0x1')]},'metric':{'type':Sequelize[_0xd336('0x3')]},'description':{'type':Sequelize[_0xd336('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 1306bc3..90d7409 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 _0x3c66=['../../config/utils','../../config/environment','end','status','offset','set','Content-Range','json','reject','then','get','Metrics','UserProfileResource','destroy','sendStatus','stack','name','send','map','AnalyticMetric','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3cb59b,_0x355c05){var _0xe3ee86=function(_0xcd563f){while(--_0xcd563f){_0x3cb59b['push'](_0x3cb59b['shift']());}};_0xe3ee86(++_0x355c05);}(_0x3c66,0x8b));var _0x63c6=function(_0x5ddefc,_0x2dd5ee){_0x5ddefc=_0x5ddefc-0x0;var _0x4315ed=_0x3c66[_0x5ddefc];return _0x4315ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63c6('0x0'));var jsonpatch=require(_0x63c6('0x1'));var rp=require(_0x63c6('0x2'));var moment=require(_0x63c6('0x3'));var BPromise=require(_0x63c6('0x4'));var Mustache=require(_0x63c6('0x5'));var util=require(_0x63c6('0x6'));var path=require(_0x63c6('0x7'));var sox=require(_0x63c6('0x8'));var csv=require(_0x63c6('0x9'));var ejs=require(_0x63c6('0xa'));var fs=require('fs');var _=require(_0x63c6('0xb'));var squel=require('squel');var crypto=require(_0x63c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63c6('0xd'));var toCsv=require(_0x63c6('0x9'));var querystring=require('querystring');var Papa=require(_0x63c6('0xe'));var Redis=require(_0x63c6('0xf'));var authService=require(_0x63c6('0x10'));var qs=require(_0x63c6('0x11'));var as=require(_0x63c6('0x12'));var hardwareService=require(_0x63c6('0x13'));var logger=require('../../config/logger')(_0x63c6('0x14'));var utils=require(_0x63c6('0x15'));var config=require(_0x63c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c58ee,_0x598a34){_0x598a34=_0x598a34||0xcc;return function(_0x528dc1){if(_0x528dc1){return _0x4c58ee['sendStatus'](_0x598a34);}return _0x4c58ee['status'](_0x598a34)[_0x63c6('0x17')]();};}function respondWithResult(_0x69911c,_0x1cd490){_0x1cd490=_0x1cd490||0xc8;return function(_0x9c3ab3){if(_0x9c3ab3){return _0x69911c[_0x63c6('0x18')](_0x1cd490)['json'](_0x9c3ab3);}};}function respondWithFilteredResult(_0x286eb8,_0x19fbb3){return function(_0x58ce24){if(_0x58ce24){var _0x2b835a=_0x58ce24['count'],_0x4b1964=_0x19fbb3[_0x63c6('0x19')],_0x50b819=_0x19fbb3[_0x63c6('0x19')]+_0x19fbb3['limit'],_0x1abfbd;if(_0x50b819>=_0x2b835a){_0x50b819=_0x2b835a;_0x1abfbd=0xc8;}else{_0x1abfbd=0xce;}_0x286eb8[_0x63c6('0x18')](_0x1abfbd);return _0x286eb8[_0x63c6('0x1a')](_0x63c6('0x1b'),_0x4b1964+'-'+_0x50b819+'/'+_0x2b835a)[_0x63c6('0x1c')](_0x58ce24);}return null;};}function patchUpdates(_0x16aa5e){return function(_0x48a8db){try{jsonpatch['apply'](_0x48a8db,_0x16aa5e,!![]);}catch(_0x491c80){return BPromise[_0x63c6('0x1d')](_0x491c80);}return _0x48a8db['save']();};}function saveUpdates(_0x569960,_0xb7ba4f){return function(_0x46c9b3){if(_0x46c9b3){return _0x46c9b3['update'](_0x569960)[_0x63c6('0x1e')](function(_0x2898e5){return _0x2898e5;});}return null;};}function removeEntity(_0x1bf63b,_0x3f9360){return function(_0x430a6e){if(_0x430a6e){return _0x430a6e['destroy']()[_0x63c6('0x1e')](function(){var _0x3d180e=_0x430a6e[_0x63c6('0x1f')]({'plain':!![]});var _0x35098c=_0x63c6('0x20');return db[_0x63c6('0x21')][_0x63c6('0x22')]({'where':{'type':_0x35098c,'resourceId':_0x3d180e['id']}})[_0x63c6('0x1e')](function(){return _0x430a6e;});})['then'](function(){_0x1bf63b[_0x63c6('0x18')](0xcc)[_0x63c6('0x17')]();});}};}function handleEntityNotFound(_0xee6da9,_0x59cd9f){return function(_0x52f9b1){if(!_0x52f9b1){_0xee6da9[_0x63c6('0x23')](0x194);}return _0x52f9b1;};}function handleError(_0x5575c1,_0x2a0ccf){_0x2a0ccf=_0x2a0ccf||0x1f4;return function(_0x4c23e8){logger['error'](_0x4c23e8[_0x63c6('0x24')]);if(_0x4c23e8[_0x63c6('0x25')]){delete _0x4c23e8[_0x63c6('0x25')];}_0x5575c1['status'](_0x2a0ccf)[_0x63c6('0x26')](_0x4c23e8);};}exports['index']=function(_0x1c6a20,_0x6c39e4){var _0x393424={},_0x47315c={},_0xe77aa8={'count':0x0,'rows':[]};var _0x6f36be=_[_0x63c6('0x27')](db[_0x63c6('0x28')]['rawAttributes'],function(_0x772b2f){return{'name':_0x772b2f[_0x63c6('0x29')],'type':_0x772b2f[_0x63c6('0x2a')][_0x63c6('0x2b')]};});_0x47315c['model']=_[_0x63c6('0x27')](_0x6f36be,'name');_0x47315c['query']=_[_0x63c6('0x2c')](_0x1c6a20[_0x63c6('0x2d')]);_0x47315c[_0x63c6('0x2e')]=_[_0x63c6('0x2f')](_0x47315c[_0x63c6('0x30')],_0x47315c[_0x63c6('0x2d')]);_0x393424[_0x63c6('0x31')]=_['intersection'](_0x47315c[_0x63c6('0x30')],qs['fields'](_0x1c6a20[_0x63c6('0x2d')]['fields']));_0x393424[_0x63c6('0x31')]=_0x393424['attributes'][_0x63c6('0x32')]?_0x393424['attributes']:_0x47315c['model'];if(!_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x33')](_0x63c6('0x34'))){_0x393424['limit']=qs[_0x63c6('0x35')](_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x35')]);_0x393424[_0x63c6('0x19')]=qs['offset'](_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x19')]);}_0x393424['order']=qs[_0x63c6('0x36')](_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x36')]);_0x393424[_0x63c6('0x37')]=qs[_0x63c6('0x2e')](_[_0x63c6('0x38')](_0x1c6a20[_0x63c6('0x2d')],_0x47315c[_0x63c6('0x2e')]),_0x6f36be);if(_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x39')]){_0x393424[_0x63c6('0x37')]=_[_0x63c6('0x3a')](_0x393424['where'],{'$or':_[_0x63c6('0x27')](_0x6f36be,function(_0x576d3a){if(_0x576d3a[_0x63c6('0x2a')]!==_0x63c6('0x3b')){var _0x4d7512={};_0x4d7512[_0x576d3a['name']]={'$like':'%'+_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x39')]+'%'};return _0x4d7512;}})});}_0x393424=_[_0x63c6('0x3a')]({},_0x393424,_0x1c6a20[_0x63c6('0x3c')]);var _0x357fd5={'where':_0x393424['where']};return db[_0x63c6('0x28')]['count'](_0x357fd5)['then'](function(_0x267b5c){_0xe77aa8[_0x63c6('0x3d')]=_0x267b5c;if(_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x3e')]){_0x393424[_0x63c6('0x3f')]=[{'all':!![]}];}return db[_0x63c6('0x28')][_0x63c6('0x40')](_0x393424);})[_0x63c6('0x1e')](function(_0x28f0e5){_0xe77aa8[_0x63c6('0x41')]=_0x28f0e5;return _0xe77aa8;})[_0x63c6('0x1e')](respondWithFilteredResult(_0x6c39e4,_0x393424))[_0x63c6('0x42')](handleError(_0x6c39e4,null));};exports[_0x63c6('0x43')]=function(_0x1e88d9,_0x1cb47c){var _0x1ebd6b={'raw':!![],'where':{'id':_0x1e88d9[_0x63c6('0x44')]['id']}},_0x6b1ec8={};_0x6b1ec8[_0x63c6('0x30')]=_['keys'](db[_0x63c6('0x28')]['rawAttributes']);_0x6b1ec8['query']=_['keys'](_0x1e88d9['query']);_0x6b1ec8[_0x63c6('0x2e')]=_[_0x63c6('0x2f')](_0x6b1ec8['model'],_0x6b1ec8[_0x63c6('0x2d')]);_0x1ebd6b['attributes']=_[_0x63c6('0x2f')](_0x6b1ec8[_0x63c6('0x30')],qs[_0x63c6('0x45')](_0x1e88d9[_0x63c6('0x2d')]['fields']));_0x1ebd6b[_0x63c6('0x31')]=_0x1ebd6b[_0x63c6('0x31')][_0x63c6('0x32')]?_0x1ebd6b[_0x63c6('0x31')]:_0x6b1ec8[_0x63c6('0x30')];if(_0x1e88d9[_0x63c6('0x2d')][_0x63c6('0x3e')]){_0x1ebd6b[_0x63c6('0x3f')]=[{'all':!![]}];}_0x1ebd6b=_['merge']({},_0x1ebd6b,_0x1e88d9[_0x63c6('0x3c')]);return db[_0x63c6('0x28')][_0x63c6('0x46')](_0x1ebd6b)['then'](handleEntityNotFound(_0x1cb47c,null))[_0x63c6('0x1e')](respondWithResult(_0x1cb47c,null))[_0x63c6('0x42')](handleError(_0x1cb47c,null));};exports[_0x63c6('0x47')]=function(_0x63b552,_0x41b4b0){return db['AnalyticMetric'][_0x63c6('0x47')](_0x63b552[_0x63c6('0x48')],{})['then'](function(_0x3fcba7){var _0x21a7e3=_0x63b552[_0x63c6('0x49')][_0x63c6('0x1f')]({'plain':!![]});if(!_0x21a7e3)throw new Error(_0x63c6('0x4a'));if(_0x21a7e3[_0x63c6('0x4b')]==='user'){var _0x114727=_0x3fcba7[_0x63c6('0x1f')]({'plain':!![]});var _0x224f27=_0x63c6('0x20');return db['UserProfileSection'][_0x63c6('0x46')]({'where':{'name':_0x224f27,'userProfileId':_0x21a7e3[_0x63c6('0x4c')]},'raw':!![]})['then'](function(_0x39b940){if(_0x39b940&&_0x39b940[_0x63c6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x114727[_0x63c6('0x25')],'resourceId':_0x114727['id'],'type':_0x39b940[_0x63c6('0x25')],'sectionId':_0x39b940['id']},{})[_0x63c6('0x1e')](function(){return _0x3fcba7;});}else{return _0x3fcba7;}})[_0x63c6('0x42')](function(_0x4b00a4){logger['error'](_0x63c6('0x4e'),_0x4b00a4);throw _0x4b00a4;});}return _0x3fcba7;})['then'](respondWithResult(_0x41b4b0,0xc9))[_0x63c6('0x42')](handleError(_0x41b4b0,null));};exports[_0x63c6('0x4f')]=function(_0x262f64,_0x248291){if(_0x262f64[_0x63c6('0x48')]['id']){delete _0x262f64['body']['id'];}return db[_0x63c6('0x28')][_0x63c6('0x46')]({'where':{'id':_0x262f64[_0x63c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x248291,null))['then'](saveUpdates(_0x262f64[_0x63c6('0x48')],null))[_0x63c6('0x1e')](respondWithResult(_0x248291,null))[_0x63c6('0x42')](handleError(_0x248291,null));};exports[_0x63c6('0x22')]=function(_0x41a057,_0x3c4665){return db[_0x63c6('0x28')]['find']({'where':{'id':_0x41a057[_0x63c6('0x44')]['id']}})[_0x63c6('0x1e')](handleEntityNotFound(_0x3c4665,null))[_0x63c6('0x1e')](removeEntity(_0x3c4665,null))[_0x63c6('0x42')](handleError(_0x3c4665,null));}; \ No newline at end of file +var _0x4024=['lodash','crypto','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','get','Metrics','UserProfileResource','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','catch','params','keys','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs'];(function(_0x47ad1a,_0x467d68){var _0x586211=function(_0x169364){while(--_0x169364){_0x47ad1a['push'](_0x47ad1a['shift']());}};_0x586211(++_0x467d68);}(_0x4024,0x89));var _0x4402=function(_0x56cdb3,_0x67287e){_0x56cdb3=_0x56cdb3-0x0;var _0x1f7b03=_0x4024[_0x56cdb3];return _0x1f7b03;};'use strict';var pdf=require(_0x4402('0x0'));var emlformat=require(_0x4402('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4402('0x2'));var jsonpatch=require(_0x4402('0x3'));var rp=require('request-promise');var moment=require(_0x4402('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4402('0x5'));var util=require(_0x4402('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4402('0x7'));var ejs=require(_0x4402('0x8'));var fs=require('fs');var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xd'));var logger=require('../../config/logger')(_0x4402('0xe'));var utils=require(_0x4402('0xf'));var config=require('../../config/environment');var db=require(_0x4402('0x10'))['db'];function respondWithStatusCode(_0x302c4d,_0xa819e9){_0xa819e9=_0xa819e9||0xcc;return function(_0x4c9032){if(_0x4c9032){return _0x302c4d[_0x4402('0x11')](_0xa819e9);}return _0x302c4d[_0x4402('0x12')](_0xa819e9)[_0x4402('0x13')]();};}function respondWithResult(_0x19d2f4,_0x248ad9){_0x248ad9=_0x248ad9||0xc8;return function(_0x31710c){if(_0x31710c){return _0x19d2f4[_0x4402('0x12')](_0x248ad9)[_0x4402('0x14')](_0x31710c);}};}function respondWithFilteredResult(_0x295ac5,_0x263a57){return function(_0x375166){if(_0x375166){var _0xc03f65=_0x375166[_0x4402('0x15')],_0x2a2ce8=_0x263a57[_0x4402('0x16')],_0x19fe7b=_0x263a57[_0x4402('0x16')]+_0x263a57[_0x4402('0x17')],_0xfd9853;if(_0x19fe7b>=_0xc03f65){_0x19fe7b=_0xc03f65;_0xfd9853=0xc8;}else{_0xfd9853=0xce;}_0x295ac5[_0x4402('0x12')](_0xfd9853);return _0x295ac5['set']('Content-Range',_0x2a2ce8+'-'+_0x19fe7b+'/'+_0xc03f65)[_0x4402('0x14')](_0x375166);}return null;};}function patchUpdates(_0x2a7afc){return function(_0x5681c5){try{jsonpatch[_0x4402('0x18')](_0x5681c5,_0x2a7afc,!![]);}catch(_0x192855){return BPromise['reject'](_0x192855);}return _0x5681c5[_0x4402('0x19')]();};}function saveUpdates(_0x4e0340,_0x55cc8c){return function(_0x1b9599){if(_0x1b9599){return _0x1b9599[_0x4402('0x1a')](_0x4e0340)[_0x4402('0x1b')](function(_0x49bc21){return _0x49bc21;});}return null;};}function removeEntity(_0x42509b,_0x57a25e){return function(_0x47ab54){if(_0x47ab54){return _0x47ab54[_0x4402('0x1c')]()[_0x4402('0x1b')](function(){var _0x110787=_0x47ab54[_0x4402('0x1d')]({'plain':!![]});var _0x258d10=_0x4402('0x1e');return db[_0x4402('0x1f')][_0x4402('0x1c')]({'where':{'type':_0x258d10,'resourceId':_0x110787['id']}})[_0x4402('0x1b')](function(){return _0x47ab54;});})['then'](function(){_0x42509b[_0x4402('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3733cd,_0x5ab28d){return function(_0x29f56b){if(!_0x29f56b){_0x3733cd[_0x4402('0x11')](0x194);}return _0x29f56b;};}function handleError(_0x5a43d0,_0x15c19f){_0x15c19f=_0x15c19f||0x1f4;return function(_0x4e9cb5){logger['error'](_0x4e9cb5[_0x4402('0x20')]);if(_0x4e9cb5[_0x4402('0x21')]){delete _0x4e9cb5[_0x4402('0x21')];}_0x5a43d0[_0x4402('0x12')](_0x15c19f)[_0x4402('0x22')](_0x4e9cb5);};}exports['index']=function(_0x41de44,_0x52e625){var _0x71da2f={},_0x1e2340={},_0x42dd32={'count':0x0,'rows':[]};var _0x48d20d=_[_0x4402('0x23')](db[_0x4402('0x24')][_0x4402('0x25')],function(_0x3f4bcb){return{'name':_0x3f4bcb[_0x4402('0x26')],'type':_0x3f4bcb[_0x4402('0x27')][_0x4402('0x28')]};});_0x1e2340[_0x4402('0x29')]=_[_0x4402('0x23')](_0x48d20d,_0x4402('0x21'));_0x1e2340[_0x4402('0x2a')]=_['keys'](_0x41de44[_0x4402('0x2a')]);_0x1e2340['filters']=_[_0x4402('0x2b')](_0x1e2340['model'],_0x1e2340[_0x4402('0x2a')]);_0x71da2f[_0x4402('0x2c')]=_[_0x4402('0x2b')](_0x1e2340[_0x4402('0x29')],qs[_0x4402('0x2d')](_0x41de44['query'][_0x4402('0x2d')]));_0x71da2f[_0x4402('0x2c')]=_0x71da2f[_0x4402('0x2c')]['length']?_0x71da2f[_0x4402('0x2c')]:_0x1e2340[_0x4402('0x29')];if(!_0x41de44['query'][_0x4402('0x2e')](_0x4402('0x2f'))){_0x71da2f[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x41de44[_0x4402('0x2a')][_0x4402('0x17')]);_0x71da2f[_0x4402('0x16')]=qs[_0x4402('0x16')](_0x41de44[_0x4402('0x2a')]['offset']);}_0x71da2f[_0x4402('0x30')]=qs[_0x4402('0x31')](_0x41de44[_0x4402('0x2a')]['sort']);_0x71da2f[_0x4402('0x32')]=qs[_0x4402('0x33')](_['pick'](_0x41de44['query'],_0x1e2340[_0x4402('0x33')]),_0x48d20d);if(_0x41de44[_0x4402('0x2a')][_0x4402('0x34')]){_0x71da2f[_0x4402('0x32')]=_['merge'](_0x71da2f['where'],{'$or':_['map'](_0x48d20d,function(_0x3a5e62){if(_0x3a5e62[_0x4402('0x27')]!==_0x4402('0x35')){var _0x3fd8ce={};_0x3fd8ce[_0x3a5e62['name']]={'$like':'%'+_0x41de44[_0x4402('0x2a')][_0x4402('0x34')]+'%'};return _0x3fd8ce;}})});}_0x71da2f=_[_0x4402('0x36')]({},_0x71da2f,_0x41de44['options']);var _0x2b92b7={'where':_0x71da2f['where']};return db[_0x4402('0x24')][_0x4402('0x15')](_0x2b92b7)['then'](function(_0x16ef2e){_0x42dd32['count']=_0x16ef2e;if(_0x41de44[_0x4402('0x2a')][_0x4402('0x37')]){_0x71da2f['include']=[{'all':!![]}];}return db[_0x4402('0x24')][_0x4402('0x38')](_0x71da2f);})[_0x4402('0x1b')](function(_0x23c43a){_0x42dd32['rows']=_0x23c43a;return _0x42dd32;})['then'](respondWithFilteredResult(_0x52e625,_0x71da2f))[_0x4402('0x39')](handleError(_0x52e625,null));};exports['show']=function(_0x3a589b,_0x2a6d78){var _0xb9cf85={'raw':!![],'where':{'id':_0x3a589b[_0x4402('0x3a')]['id']}},_0x2e2391={};_0x2e2391[_0x4402('0x29')]=_[_0x4402('0x3b')](db[_0x4402('0x24')][_0x4402('0x25')]);_0x2e2391[_0x4402('0x2a')]=_['keys'](_0x3a589b[_0x4402('0x2a')]);_0x2e2391[_0x4402('0x33')]=_['intersection'](_0x2e2391[_0x4402('0x29')],_0x2e2391[_0x4402('0x2a')]);_0xb9cf85['attributes']=_[_0x4402('0x2b')](_0x2e2391[_0x4402('0x29')],qs[_0x4402('0x2d')](_0x3a589b[_0x4402('0x2a')][_0x4402('0x2d')]));_0xb9cf85['attributes']=_0xb9cf85[_0x4402('0x2c')][_0x4402('0x3c')]?_0xb9cf85[_0x4402('0x2c')]:_0x2e2391[_0x4402('0x29')];if(_0x3a589b[_0x4402('0x2a')][_0x4402('0x37')]){_0xb9cf85[_0x4402('0x3d')]=[{'all':!![]}];}_0xb9cf85=_[_0x4402('0x36')]({},_0xb9cf85,_0x3a589b[_0x4402('0x3e')]);return db[_0x4402('0x24')][_0x4402('0x3f')](_0xb9cf85)['then'](handleEntityNotFound(_0x2a6d78,null))[_0x4402('0x1b')](respondWithResult(_0x2a6d78,null))['catch'](handleError(_0x2a6d78,null));};exports[_0x4402('0x40')]=function(_0x34ce00,_0x54e67a){return db[_0x4402('0x24')][_0x4402('0x40')](_0x34ce00[_0x4402('0x41')],{})[_0x4402('0x1b')](function(_0x4436b2){var _0x2503eb=_0x34ce00['user'][_0x4402('0x1d')]({'plain':!![]});if(!_0x2503eb)throw new Error(_0x4402('0x42'));if(_0x2503eb[_0x4402('0x43')]===_0x4402('0x44')){var _0x2b2ed3=_0x4436b2[_0x4402('0x1d')]({'plain':!![]});var _0x43cfbd=_0x4402('0x1e');return db[_0x4402('0x45')]['find']({'where':{'name':_0x43cfbd,'userProfileId':_0x2503eb['userProfileId']},'raw':!![]})['then'](function(_0x4c2d2e){if(_0x4c2d2e&&_0x4c2d2e[_0x4402('0x46')]===0x0){return db[_0x4402('0x1f')][_0x4402('0x40')]({'name':_0x2b2ed3[_0x4402('0x21')],'resourceId':_0x2b2ed3['id'],'type':_0x4c2d2e['name'],'sectionId':_0x4c2d2e['id']},{})[_0x4402('0x1b')](function(){return _0x4436b2;});}else{return _0x4436b2;}})[_0x4402('0x39')](function(_0x203b33){logger[_0x4402('0x47')](_0x4402('0x48'),_0x203b33);throw _0x203b33;});}return _0x4436b2;})[_0x4402('0x1b')](respondWithResult(_0x54e67a,0xc9))[_0x4402('0x39')](handleError(_0x54e67a,null));};exports['update']=function(_0x325b20,_0x2a8085){if(_0x325b20[_0x4402('0x41')]['id']){delete _0x325b20[_0x4402('0x41')]['id'];}return db[_0x4402('0x24')][_0x4402('0x3f')]({'where':{'id':_0x325b20['params']['id']}})[_0x4402('0x1b')](handleEntityNotFound(_0x2a8085,null))[_0x4402('0x1b')](saveUpdates(_0x325b20[_0x4402('0x41')],null))[_0x4402('0x1b')](respondWithResult(_0x2a8085,null))[_0x4402('0x39')](handleError(_0x2a8085,null));};exports[_0x4402('0x1c')]=function(_0x137d88,_0x5dbf62){return db['AnalyticMetric'][_0x4402('0x3f')]({'where':{'id':_0x137d88[_0x4402('0x3a')]['id']}})[_0x4402('0x1b')](handleEntityNotFound(_0x5dbf62,null))['then'](removeEntity(_0x5dbf62,null))['catch'](handleError(_0x5dbf62,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7fa53b9..709f459 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 _0x4243=['define','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./analyticMetric.attributes','exports'];(function(_0x487d4a,_0x49d74f){var _0x12fa91=function(_0x253b4f){while(--_0x253b4f){_0x487d4a['push'](_0x487d4a['shift']());}};_0x12fa91(++_0x49d74f);}(_0x4243,0x91));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var util=require('util');var logger=require(_0x3424('0x1'))(_0x3424('0x2'));var moment=require(_0x3424('0x3'));var BPromise=require(_0x3424('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3424('0x5'));var rimraf=require(_0x3424('0x6'));var config=require('../../config/environment');var attributes=require(_0x3424('0x7'));module[_0x3424('0x8')]=function(_0x2660b9,_0x4fead7){return _0x2660b9[_0x3424('0x9')]('AnalyticMetric',attributes,{'tableName':_0x3424('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a7=['../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x3d07a2,_0x34306c){var _0x1afa35=function(_0x4128ba){while(--_0x4128ba){_0x3d07a2['push'](_0x3d07a2['shift']());}};_0x1afa35(++_0x34306c);}(_0xf9a7,0xc5));var _0x7f9a=function(_0x4212ad,_0x2d4232){_0x4212ad=_0x4212ad-0x0;var _0x3b666d=_0xf9a7[_0x4212ad];return _0x3b666d;};'use strict';var _=require(_0x7f9a('0x0'));var util=require(_0x7f9a('0x1'));var logger=require('../../config/logger')(_0x7f9a('0x2'));var moment=require(_0x7f9a('0x3'));var BPromise=require(_0x7f9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f9a('0x5'));var rimraf=require(_0x7f9a('0x6'));var config=require(_0x7f9a('0x7'));var attributes=require(_0x7f9a('0x8'));module['exports']=function(_0x324542,_0x5c95dd){return _0x324542[_0x7f9a('0x9')](_0x7f9a('0xa'),attributes,{'tableName':_0x7f9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 80c2cae..43c3987 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 _0x028d=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x1db389,_0x5158cf){var _0x204699=function(_0x3d0404){while(--_0x3d0404){_0x1db389['push'](_0x1db389['shift']());}};_0x204699(++_0x5158cf);}(_0x028d,0x85));var _0xd028=function(_0x449120,_0x179535){_0x449120=_0x449120-0x0;var _0x4216b2=_0x028d[_0x449120];return _0x4216b2;};'use strict';var _=require(_0xd028('0x0'));var util=require(_0xd028('0x1'));var moment=require(_0xd028('0x2'));var BPromise=require('bluebird');var rs=require(_0xd028('0x3'));var fs=require('fs');var Redis=require(_0xd028('0x4'));var db=require(_0xd028('0x5'))['db'];var utils=require(_0xd028('0x6'));var logger=require(_0xd028('0x7'))(_0xd028('0x8'));var config=require(_0xd028('0x9'));var jayson=require(_0xd028('0xa'));var client=jayson[_0xd028('0xb')][_0xd028('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d4946,_0x4e4473,_0x4655de){return new BPromise(function(_0x5e4ccc,_0x1cab3f){return client[_0xd028('0xd')](_0x1d4946,_0x4655de)[_0xd028('0xe')](function(_0x1d5025){logger[_0xd028('0xf')](_0xd028('0x10'),_0x4e4473,'request\x20sent');logger[_0xd028('0x11')](_0xd028('0x12'),_0x4e4473,_0xd028('0x13'),JSON['stringify'](_0x1d5025));if(_0x1d5025[_0xd028('0x14')]){if(_0x1d5025[_0xd028('0x14')][_0xd028('0x15')]===0x1f4){logger[_0xd028('0x14')](_0xd028('0x10'),_0x4e4473,_0x1d5025[_0xd028('0x14')][_0xd028('0x16')]);return _0x1cab3f(_0x1d5025[_0xd028('0x14')][_0xd028('0x16')]);}logger[_0xd028('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x4e4473,_0x1d5025[_0xd028('0x14')][_0xd028('0x16')]);return _0x5e4ccc(_0x1d5025[_0xd028('0x14')]['message']);}else{logger[_0xd028('0xf')](_0xd028('0x10'),_0x4e4473,_0xd028('0x13'));_0x5e4ccc(_0x1d5025[_0xd028('0x17')]['message']);}})[_0xd028('0x18')](function(_0x5d7d9d){logger[_0xd028('0x14')](_0xd028('0x10'),_0x4e4473,_0x5d7d9d);_0x1cab3f(_0x5d7d9d);});});} \ No newline at end of file +var _0x4524=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xdfb0e5,_0x205b9a){var _0x2b24f2=function(_0x290a75){while(--_0x290a75){_0xdfb0e5['push'](_0xdfb0e5['shift']());}};_0x2b24f2(++_0x205b9a);}(_0x4524,0x16a));var _0x4452=function(_0x573819,_0x54c1d4){_0x573819=_0x573819-0x0;var _0x103e4a=_0x4524[_0x573819];return _0x103e4a;};'use strict';var _=require(_0x4452('0x0'));var util=require(_0x4452('0x1'));var moment=require('moment');var BPromise=require(_0x4452('0x2'));var rs=require(_0x4452('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4452('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4452('0x5'))(_0x4452('0x6'));var config=require(_0x4452('0x7'));var jayson=require(_0x4452('0x8'));var client=jayson[_0x4452('0x9')][_0x4452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6f5d,_0x1dbaf4,_0x2f2453){return new BPromise(function(_0x4589d9,_0x133518){return client[_0x4452('0xb')](_0x3a6f5d,_0x2f2453)[_0x4452('0xc')](function(_0x3c2aa0){logger['info'](_0x4452('0xd'),_0x1dbaf4,_0x4452('0xe'));logger[_0x4452('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1dbaf4,_0x4452('0xe'),JSON[_0x4452('0x10')](_0x3c2aa0));if(_0x3c2aa0['error']){if(_0x3c2aa0[_0x4452('0x11')][_0x4452('0x12')]===0x1f4){logger[_0x4452('0x11')](_0x4452('0xd'),_0x1dbaf4,_0x3c2aa0['error'][_0x4452('0x13')]);return _0x133518(_0x3c2aa0[_0x4452('0x11')][_0x4452('0x13')]);}logger[_0x4452('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1dbaf4,_0x3c2aa0[_0x4452('0x11')][_0x4452('0x13')]);return _0x4589d9(_0x3c2aa0['error']['message']);}else{logger['info'](_0x4452('0xd'),_0x1dbaf4,_0x4452('0xe'));_0x4589d9(_0x3c2aa0[_0x4452('0x14')][_0x4452('0x13')]);}})['catch'](function(_0x4a2635){logger['error'](_0x4452('0xd'),_0x1dbaf4,_0x4a2635);_0x133518(_0x4a2635);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 67b6bf1..d9782d0 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 _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x3e1e92,_0x1a8c2a){var _0xc32d72=function(_0x559b87){while(--_0x559b87){_0x3e1e92['push'](_0x3e1e92['shift']());}};_0xc32d72(++_0x1a8c2a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6d38[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x326f,0xd1));var _0xf326=function(_0x112eb0,_0x401288){_0x112eb0=_0x112eb0-0x0;var _0x181076=_0x326f[_0x112eb0];return _0x181076;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 46914fb..ff702d4 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 _0xdbcb=['TEXT','sequelize','exports'];(function(_0x28181a,_0x365a35){var _0x52da6f=function(_0x5194fd){while(--_0x5194fd){_0x28181a['push'](_0x28181a['shift']());}};_0x52da6f(++_0x365a35);}(_0xdbcb,0xdf));var _0xbdbc=function(_0x14806a,_0x14d122){_0x14806a=_0x14806a-0x0;var _0x12e125=_0xdbcb[_0x14806a];return _0x12e125;};'use strict';var Sequelize=require(_0xbdbc('0x0'));module[_0xbdbc('0x1')]={'tree':{'type':Sequelize[_0xbdbc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5c37=['exports','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5c37,0x64));var _0x75c3=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x5c37[_0x457b64];return _0x437111;};'use strict';var Sequelize=require('sequelize');module[_0x75c3('0x0')]={'tree':{'type':Sequelize[_0x75c3('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b7c1a23..830f78e 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 _0xf1dc=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5b4aae,_0x32a354){var _0x2698e2=function(_0x292b81){while(--_0x292b81){_0x5b4aae['push'](_0x5b4aae['shift']());}};_0x2698e2(++_0x32a354);}(_0xf1dc,0x1b8));var _0xcf1d=function(_0x344db7,_0x397fcf){_0x344db7=_0x344db7-0x0;var _0x31ff0b=_0xf1dc[_0x344db7];return _0x31ff0b;};'use strict';var pdf=require(_0xcf1d('0x0'));var emlformat=require(_0xcf1d('0x1'));var rimraf=require(_0xcf1d('0x2'));var zipdir=require(_0xcf1d('0x3'));var jsonpatch=require(_0xcf1d('0x4'));var rp=require(_0xcf1d('0x5'));var moment=require(_0xcf1d('0x6'));var BPromise=require(_0xcf1d('0x7'));var Mustache=require(_0xcf1d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xcf1d('0x9'));var csv=require('to-csv');var ejs=require(_0xcf1d('0xa'));var fs=require('fs');var _=require(_0xcf1d('0xb'));var squel=require(_0xcf1d('0xc'));var crypto=require(_0xcf1d('0xd'));var jsforce=require(_0xcf1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf1d('0xf'));var querystring=require(_0xcf1d('0x10'));var Papa=require(_0xcf1d('0x11'));var Redis=require(_0xcf1d('0x12'));var authService=require(_0xcf1d('0x13'));var qs=require(_0xcf1d('0x14'));var as=require(_0xcf1d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf1d('0x16'))(_0xcf1d('0x17'));var utils=require(_0xcf1d('0x18'));var config=require(_0xcf1d('0x19'));var db=require(_0xcf1d('0x1a'))['db'];function respondWithStatusCode(_0x432f0d,_0x155be1){_0x155be1=_0x155be1||0xcc;return function(_0x103476){if(_0x103476){return _0x432f0d[_0xcf1d('0x1b')](_0x155be1);}return _0x432f0d[_0xcf1d('0x1c')](_0x155be1)[_0xcf1d('0x1d')]();};}function respondWithResult(_0x51b61e,_0x2ba226){_0x2ba226=_0x2ba226||0xc8;return function(_0x1122ed){if(_0x1122ed){return _0x51b61e['status'](_0x2ba226)[_0xcf1d('0x1e')](_0x1122ed);}};}function respondWithFilteredResult(_0x240ef5,_0x10e1f0){return function(_0x26f443){if(_0x26f443){var _0x45ddb1=_0x26f443[_0xcf1d('0x1f')],_0x19bbf9=_0x10e1f0[_0xcf1d('0x20')],_0x15259e=_0x10e1f0[_0xcf1d('0x20')]+_0x10e1f0[_0xcf1d('0x21')],_0x19b880;if(_0x15259e>=_0x45ddb1){_0x15259e=_0x45ddb1;_0x19b880=0xc8;}else{_0x19b880=0xce;}_0x240ef5[_0xcf1d('0x1c')](_0x19b880);return _0x240ef5[_0xcf1d('0x22')]('Content-Range',_0x19bbf9+'-'+_0x15259e+'/'+_0x45ddb1)['json'](_0x26f443);}return null;};}function patchUpdates(_0x23504a){return function(_0x4e6afe){try{jsonpatch[_0xcf1d('0x23')](_0x4e6afe,_0x23504a,!![]);}catch(_0xc0f744){return BPromise[_0xcf1d('0x24')](_0xc0f744);}return _0x4e6afe[_0xcf1d('0x25')]();};}function saveUpdates(_0x2b191d,_0x3cbb65){return function(_0x399083){if(_0x399083){return _0x399083[_0xcf1d('0x26')](_0x2b191d)[_0xcf1d('0x27')](function(_0x33537b){return _0x33537b;});}return null;};}function removeEntity(_0x3e5efe,_0x12fe34){return function(_0x94cc8){if(_0x94cc8){return _0x94cc8['destroy']()[_0xcf1d('0x27')](function(){_0x3e5efe['status'](0xcc)[_0xcf1d('0x1d')]();});}};}function handleEntityNotFound(_0x638a6c,_0x4a2494){return function(_0x2ef185){if(!_0x2ef185){_0x638a6c['sendStatus'](0x194);}return _0x2ef185;};}function handleError(_0x259e28,_0x1208b5){_0x1208b5=_0x1208b5||0x1f4;return function(_0x548654){logger[_0xcf1d('0x28')](_0x548654['stack']);if(_0x548654[_0xcf1d('0x29')]){delete _0x548654[_0xcf1d('0x29')];}_0x259e28[_0xcf1d('0x1c')](_0x1208b5)['send'](_0x548654);};}exports[_0xcf1d('0x2a')]=function(_0xf847ea,_0x5bbd2b){var _0x48d198={},_0x3a3ef0={},_0x192fc4={'count':0x0,'rows':[]};var _0x4557bb=_[_0xcf1d('0x2b')](db[_0xcf1d('0x2c')][_0xcf1d('0x2d')],function(_0x54e20c){return{'name':_0x54e20c[_0xcf1d('0x2e')],'type':_0x54e20c[_0xcf1d('0x2f')][_0xcf1d('0x30')]};});_0x3a3ef0[_0xcf1d('0x31')]=_['map'](_0x4557bb,_0xcf1d('0x29'));_0x3a3ef0[_0xcf1d('0x32')]=_[_0xcf1d('0x33')](_0xf847ea[_0xcf1d('0x32')]);_0x3a3ef0[_0xcf1d('0x34')]=_[_0xcf1d('0x35')](_0x3a3ef0[_0xcf1d('0x31')],_0x3a3ef0[_0xcf1d('0x32')]);_0x48d198[_0xcf1d('0x36')]=_['intersection'](_0x3a3ef0['model'],qs['fields'](_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x37')]));_0x48d198[_0xcf1d('0x36')]=_0x48d198[_0xcf1d('0x36')][_0xcf1d('0x38')]?_0x48d198[_0xcf1d('0x36')]:_0x3a3ef0[_0xcf1d('0x31')];if(!_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x39')](_0xcf1d('0x3a'))){_0x48d198[_0xcf1d('0x21')]=qs[_0xcf1d('0x21')](_0xf847ea[_0xcf1d('0x32')]['limit']);_0x48d198[_0xcf1d('0x20')]=qs['offset'](_0xf847ea['query']['offset']);}_0x48d198[_0xcf1d('0x3b')]=qs['sort'](_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x3c')]);_0x48d198['where']=qs[_0xcf1d('0x34')](_['pick'](_0xf847ea[_0xcf1d('0x32')],_0x3a3ef0['filters']),_0x4557bb);if(_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x3d')]){_0x48d198[_0xcf1d('0x3e')]=_[_0xcf1d('0x3f')](_0x48d198[_0xcf1d('0x3e')],{'$or':_[_0xcf1d('0x2b')](_0x4557bb,function(_0x23e583){if(_0x23e583[_0xcf1d('0x2f')]!==_0xcf1d('0x40')){var _0x1c6a48={};_0x1c6a48[_0x23e583[_0xcf1d('0x29')]]={'$like':'%'+_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x3d')]+'%'};return _0x1c6a48;}})});}_0x48d198=_[_0xcf1d('0x3f')]({},_0x48d198,_0xf847ea['options']);var _0x13bf0d={'where':_0x48d198[_0xcf1d('0x3e')]};return db[_0xcf1d('0x2c')][_0xcf1d('0x1f')](_0x13bf0d)[_0xcf1d('0x27')](function(_0x4c508e){_0x192fc4[_0xcf1d('0x1f')]=_0x4c508e;if(_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x41')]){_0x48d198[_0xcf1d('0x42')]=[{'all':!![]}];}return db[_0xcf1d('0x2c')]['findAll'](_0x48d198);})['then'](function(_0x26f03f){_0x192fc4['rows']=_0x26f03f;return _0x192fc4;})[_0xcf1d('0x27')](respondWithFilteredResult(_0x5bbd2b,_0x48d198))[_0xcf1d('0x43')](handleError(_0x5bbd2b,null));};exports[_0xcf1d('0x44')]=function(_0x247fe1,_0x3e0276){var _0x4bdb38={'raw':!![],'where':{'id':_0x247fe1['params']['id']}},_0x4944e5={};_0x4944e5[_0xcf1d('0x31')]=_[_0xcf1d('0x33')](db['AnalyticTreeReport'][_0xcf1d('0x2d')]);_0x4944e5['query']=_[_0xcf1d('0x33')](_0x247fe1[_0xcf1d('0x32')]);_0x4944e5['filters']=_[_0xcf1d('0x35')](_0x4944e5[_0xcf1d('0x31')],_0x4944e5[_0xcf1d('0x32')]);_0x4bdb38[_0xcf1d('0x36')]=_[_0xcf1d('0x35')](_0x4944e5[_0xcf1d('0x31')],qs['fields'](_0x247fe1[_0xcf1d('0x32')][_0xcf1d('0x37')]));_0x4bdb38[_0xcf1d('0x36')]=_0x4bdb38[_0xcf1d('0x36')][_0xcf1d('0x38')]?_0x4bdb38[_0xcf1d('0x36')]:_0x4944e5[_0xcf1d('0x31')];if(_0x247fe1[_0xcf1d('0x32')]['includeAll']){_0x4bdb38[_0xcf1d('0x42')]=[{'all':!![]}];}_0x4bdb38=_[_0xcf1d('0x3f')]({},_0x4bdb38,_0x247fe1['options']);return db[_0xcf1d('0x2c')][_0xcf1d('0x45')](_0x4bdb38)[_0xcf1d('0x27')](handleEntityNotFound(_0x3e0276,null))[_0xcf1d('0x27')](respondWithResult(_0x3e0276,null))[_0xcf1d('0x43')](handleError(_0x3e0276,null));};exports[_0xcf1d('0x46')]=function(_0x57c47c,_0x5d6c84){return db[_0xcf1d('0x2c')][_0xcf1d('0x46')](_0x57c47c[_0xcf1d('0x47')],{})[_0xcf1d('0x27')](respondWithResult(_0x5d6c84,0xc9))['catch'](handleError(_0x5d6c84,null));};exports['update']=function(_0x398d3c,_0x20133c){if(_0x398d3c[_0xcf1d('0x47')]['id']){delete _0x398d3c[_0xcf1d('0x47')]['id'];}return db[_0xcf1d('0x2c')][_0xcf1d('0x45')]({'where':{'id':_0x398d3c[_0xcf1d('0x48')]['id']}})[_0xcf1d('0x27')](handleEntityNotFound(_0x20133c,null))['then'](saveUpdates(_0x398d3c[_0xcf1d('0x47')],null))['then'](respondWithResult(_0x20133c,null))['catch'](handleError(_0x20133c,null));};exports[_0xcf1d('0x49')]=function(_0x2db647,_0x1b900f){return db[_0xcf1d('0x2c')][_0xcf1d('0x45')]({'where':{'id':_0x2db647['params']['id']}})[_0xcf1d('0x27')](handleEntityNotFound(_0x1b900f,null))[_0xcf1d('0x27')](removeEntity(_0x1b900f,null))['catch'](handleError(_0x1b900f,null));}; \ No newline at end of file +var _0xbcfe=['to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','keys','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x165320,_0x2626f2){var _0x2dfda3=function(_0x33cd81){while(--_0x33cd81){_0x165320['push'](_0x165320['shift']());}};_0x2dfda3(++_0x2626f2);}(_0xbcfe,0x1b7));var _0xebcf=function(_0x49417a,_0x1d7efa){_0x49417a=_0x49417a-0x0;var _0x22badb=_0xbcfe[_0x49417a];return _0x22badb;};'use strict';var pdf=require(_0xebcf('0x0'));var emlformat=require(_0xebcf('0x1'));var rimraf=require(_0xebcf('0x2'));var zipdir=require(_0xebcf('0x3'));var jsonpatch=require(_0xebcf('0x4'));var rp=require('request-promise');var moment=require(_0xebcf('0x5'));var BPromise=require(_0xebcf('0x6'));var Mustache=require(_0xebcf('0x7'));var util=require(_0xebcf('0x8'));var path=require(_0xebcf('0x9'));var sox=require(_0xebcf('0xa'));var csv=require(_0xebcf('0xb'));var ejs=require(_0xebcf('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xebcf('0xd'));var crypto=require(_0xebcf('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xebcf('0xb'));var querystring=require(_0xebcf('0xf'));var Papa=require(_0xebcf('0x10'));var Redis=require('ioredis');var authService=require(_0xebcf('0x11'));var qs=require(_0xebcf('0x12'));var as=require(_0xebcf('0x13'));var hardwareService=require(_0xebcf('0x14'));var logger=require(_0xebcf('0x15'))(_0xebcf('0x16'));var utils=require(_0xebcf('0x17'));var config=require('../../config/environment');var db=require(_0xebcf('0x18'))['db'];function respondWithStatusCode(_0x2c503e,_0x9bc3c){_0x9bc3c=_0x9bc3c||0xcc;return function(_0xcc2b1a){if(_0xcc2b1a){return _0x2c503e[_0xebcf('0x19')](_0x9bc3c);}return _0x2c503e[_0xebcf('0x1a')](_0x9bc3c)[_0xebcf('0x1b')]();};}function respondWithResult(_0x43f3e0,_0x151560){_0x151560=_0x151560||0xc8;return function(_0x3236bc){if(_0x3236bc){return _0x43f3e0[_0xebcf('0x1a')](_0x151560)[_0xebcf('0x1c')](_0x3236bc);}};}function respondWithFilteredResult(_0x42dcfb,_0x4244eb){return function(_0x3365d9){if(_0x3365d9){var _0x29e6c0=_0x3365d9[_0xebcf('0x1d')],_0x3e40a8=_0x4244eb[_0xebcf('0x1e')],_0x5e1956=_0x4244eb[_0xebcf('0x1e')]+_0x4244eb[_0xebcf('0x1f')],_0x16378f;if(_0x5e1956>=_0x29e6c0){_0x5e1956=_0x29e6c0;_0x16378f=0xc8;}else{_0x16378f=0xce;}_0x42dcfb[_0xebcf('0x1a')](_0x16378f);return _0x42dcfb[_0xebcf('0x20')](_0xebcf('0x21'),_0x3e40a8+'-'+_0x5e1956+'/'+_0x29e6c0)[_0xebcf('0x1c')](_0x3365d9);}return null;};}function patchUpdates(_0x20d12e){return function(_0xdec3d7){try{jsonpatch[_0xebcf('0x22')](_0xdec3d7,_0x20d12e,!![]);}catch(_0x2e9c7c){return BPromise[_0xebcf('0x23')](_0x2e9c7c);}return _0xdec3d7[_0xebcf('0x24')]();};}function saveUpdates(_0x41741b,_0x151111){return function(_0x38fc7c){if(_0x38fc7c){return _0x38fc7c[_0xebcf('0x25')](_0x41741b)[_0xebcf('0x26')](function(_0x4e0360){return _0x4e0360;});}return null;};}function removeEntity(_0x41cfb9,_0xdbe276){return function(_0x26f4cc){if(_0x26f4cc){return _0x26f4cc['destroy']()[_0xebcf('0x26')](function(){_0x41cfb9['status'](0xcc)[_0xebcf('0x1b')]();});}};}function handleEntityNotFound(_0x3c8f0a,_0x3f572d){return function(_0x4423b1){if(!_0x4423b1){_0x3c8f0a[_0xebcf('0x19')](0x194);}return _0x4423b1;};}function handleError(_0x442706,_0x56bed1){_0x56bed1=_0x56bed1||0x1f4;return function(_0x12e14a){logger[_0xebcf('0x27')](_0x12e14a[_0xebcf('0x28')]);if(_0x12e14a[_0xebcf('0x29')]){delete _0x12e14a[_0xebcf('0x29')];}_0x442706[_0xebcf('0x1a')](_0x56bed1)['send'](_0x12e14a);};}exports[_0xebcf('0x2a')]=function(_0x2166e3,_0x1a9cff){var _0x943b6b={},_0xba4cd5={},_0x10e5b3={'count':0x0,'rows':[]};var _0x28fbf8=_['map'](db['AnalyticTreeReport'][_0xebcf('0x2b')],function(_0x355ab8){return{'name':_0x355ab8[_0xebcf('0x2c')],'type':_0x355ab8['type'][_0xebcf('0x2d')]};});_0xba4cd5[_0xebcf('0x2e')]=_[_0xebcf('0x2f')](_0x28fbf8,_0xebcf('0x29'));_0xba4cd5[_0xebcf('0x30')]=_['keys'](_0x2166e3[_0xebcf('0x30')]);_0xba4cd5[_0xebcf('0x31')]=_[_0xebcf('0x32')](_0xba4cd5['model'],_0xba4cd5['query']);_0x943b6b['attributes']=_[_0xebcf('0x32')](_0xba4cd5[_0xebcf('0x2e')],qs[_0xebcf('0x33')](_0x2166e3[_0xebcf('0x30')][_0xebcf('0x33')]));_0x943b6b[_0xebcf('0x34')]=_0x943b6b['attributes'][_0xebcf('0x35')]?_0x943b6b[_0xebcf('0x34')]:_0xba4cd5[_0xebcf('0x2e')];if(!_0x2166e3[_0xebcf('0x30')][_0xebcf('0x36')](_0xebcf('0x37'))){_0x943b6b[_0xebcf('0x1f')]=qs[_0xebcf('0x1f')](_0x2166e3[_0xebcf('0x30')][_0xebcf('0x1f')]);_0x943b6b[_0xebcf('0x1e')]=qs[_0xebcf('0x1e')](_0x2166e3[_0xebcf('0x30')][_0xebcf('0x1e')]);}_0x943b6b[_0xebcf('0x38')]=qs[_0xebcf('0x39')](_0x2166e3[_0xebcf('0x30')][_0xebcf('0x39')]);_0x943b6b['where']=qs[_0xebcf('0x31')](_[_0xebcf('0x3a')](_0x2166e3[_0xebcf('0x30')],_0xba4cd5[_0xebcf('0x31')]),_0x28fbf8);if(_0x2166e3['query'][_0xebcf('0x3b')]){_0x943b6b['where']=_['merge'](_0x943b6b[_0xebcf('0x3c')],{'$or':_[_0xebcf('0x2f')](_0x28fbf8,function(_0x49c22d){if(_0x49c22d['type']!==_0xebcf('0x3d')){var _0x5548d5={};_0x5548d5[_0x49c22d['name']]={'$like':'%'+_0x2166e3['query'][_0xebcf('0x3b')]+'%'};return _0x5548d5;}})});}_0x943b6b=_[_0xebcf('0x3e')]({},_0x943b6b,_0x2166e3[_0xebcf('0x3f')]);var _0x5b903b={'where':_0x943b6b[_0xebcf('0x3c')]};return db[_0xebcf('0x40')][_0xebcf('0x1d')](_0x5b903b)[_0xebcf('0x26')](function(_0x38fbea){_0x10e5b3[_0xebcf('0x1d')]=_0x38fbea;if(_0x2166e3[_0xebcf('0x30')][_0xebcf('0x41')]){_0x943b6b[_0xebcf('0x42')]=[{'all':!![]}];}return db[_0xebcf('0x40')][_0xebcf('0x43')](_0x943b6b);})['then'](function(_0x41b7a4){_0x10e5b3[_0xebcf('0x44')]=_0x41b7a4;return _0x10e5b3;})['then'](respondWithFilteredResult(_0x1a9cff,_0x943b6b))[_0xebcf('0x45')](handleError(_0x1a9cff,null));};exports[_0xebcf('0x46')]=function(_0x5c82b3,_0x38116c){var _0x101ac8={'raw':!![],'where':{'id':_0x5c82b3[_0xebcf('0x47')]['id']}},_0x266818={};_0x266818[_0xebcf('0x2e')]=_[_0xebcf('0x48')](db[_0xebcf('0x40')][_0xebcf('0x2b')]);_0x266818[_0xebcf('0x30')]=_['keys'](_0x5c82b3[_0xebcf('0x30')]);_0x266818[_0xebcf('0x31')]=_[_0xebcf('0x32')](_0x266818['model'],_0x266818['query']);_0x101ac8[_0xebcf('0x34')]=_[_0xebcf('0x32')](_0x266818[_0xebcf('0x2e')],qs[_0xebcf('0x33')](_0x5c82b3[_0xebcf('0x30')][_0xebcf('0x33')]));_0x101ac8[_0xebcf('0x34')]=_0x101ac8[_0xebcf('0x34')][_0xebcf('0x35')]?_0x101ac8['attributes']:_0x266818['model'];if(_0x5c82b3[_0xebcf('0x30')][_0xebcf('0x41')]){_0x101ac8[_0xebcf('0x42')]=[{'all':!![]}];}_0x101ac8=_['merge']({},_0x101ac8,_0x5c82b3[_0xebcf('0x3f')]);return db[_0xebcf('0x40')][_0xebcf('0x49')](_0x101ac8)[_0xebcf('0x26')](handleEntityNotFound(_0x38116c,null))['then'](respondWithResult(_0x38116c,null))[_0xebcf('0x45')](handleError(_0x38116c,null));};exports['create']=function(_0x2290ec,_0x2cbf93){return db['AnalyticTreeReport']['create'](_0x2290ec[_0xebcf('0x4a')],{})[_0xebcf('0x26')](respondWithResult(_0x2cbf93,0xc9))[_0xebcf('0x45')](handleError(_0x2cbf93,null));};exports[_0xebcf('0x25')]=function(_0x1ad7d0,_0xb690ca){if(_0x1ad7d0['body']['id']){delete _0x1ad7d0[_0xebcf('0x4a')]['id'];}return db[_0xebcf('0x40')][_0xebcf('0x49')]({'where':{'id':_0x1ad7d0[_0xebcf('0x47')]['id']}})[_0xebcf('0x26')](handleEntityNotFound(_0xb690ca,null))[_0xebcf('0x26')](saveUpdates(_0x1ad7d0[_0xebcf('0x4a')],null))[_0xebcf('0x26')](respondWithResult(_0xb690ca,null))[_0xebcf('0x45')](handleError(_0xb690ca,null));};exports['destroy']=function(_0x4e21f1,_0x38e20f){return db['AnalyticTreeReport'][_0xebcf('0x49')]({'where':{'id':_0x4e21f1[_0xebcf('0x47')]['id']}})[_0xebcf('0x26')](handleEntityNotFound(_0x38e20f,null))[_0xebcf('0x26')](removeEntity(_0x38e20f,null))[_0xebcf('0x45')](handleError(_0x38e20f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index be518bb..fc98917 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 _0x1422=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x309d2c,_0x3efb7b){var _0x44bdd4=function(_0x5d68d4){while(--_0x5d68d4){_0x309d2c['push'](_0x309d2c['shift']());}};_0x44bdd4(++_0x3efb7b);}(_0x1422,0x18c));var _0x2142=function(_0x3c2318,_0x3c3687){_0x3c2318=_0x3c2318-0x0;var _0x4fc71f=_0x1422[_0x3c2318];return _0x4fc71f;};'use strict';var _=require(_0x2142('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2142('0x1'));var moment=require(_0x2142('0x2'));var BPromise=require(_0x2142('0x3'));var rp=require(_0x2142('0x4'));var fs=require('fs');var path=require(_0x2142('0x5'));var rimraf=require(_0x2142('0x6'));var config=require(_0x2142('0x7'));var attributes=require(_0x2142('0x8'));module[_0x2142('0x9')]=function(_0x18d8a8,_0x38f0eb){return _0x18d8a8[_0x2142('0xa')](_0x2142('0xb'),attributes,{'tableName':_0x2142('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c0e=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x27ab51,_0xcb32ff){var _0x13b804=function(_0x321a71){while(--_0x321a71){_0x27ab51['push'](_0x27ab51['shift']());}};_0x13b804(++_0xcb32ff);}(_0x8c0e,0xb0));var _0xe8c0=function(_0x54444d,_0x317b8f){_0x54444d=_0x54444d-0x0;var _0x1630ae=_0x8c0e[_0x54444d];return _0x1630ae;};'use strict';var _=require(_0xe8c0('0x0'));var util=require(_0xe8c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe8c0('0x2'));var BPromise=require(_0xe8c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8c0('0x4'));var rimraf=require(_0xe8c0('0x5'));var config=require(_0xe8c0('0x6'));var attributes=require(_0xe8c0('0x7'));module[_0xe8c0('0x8')]=function(_0x3a7d43,_0x2c78e3){return _0x3a7d43[_0xe8c0('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xe8c0('0xa'),'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 ee14f4d..d330a15 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 _0x5d4a=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xce3950,_0x2aa683){var _0x163fbc=function(_0x5d9868){while(--_0x5d9868){_0xce3950['push'](_0xce3950['shift']());}};_0x163fbc(++_0x2aa683);}(_0x5d4a,0xfe));var _0xa5d4=function(_0x3ea266,_0x3dfa17){_0x3ea266=_0x3ea266-0x0;var _0x473fc0=_0x5d4a[_0x3ea266];return _0x473fc0;};'use strict';var _=require(_0xa5d4('0x0'));var util=require(_0xa5d4('0x1'));var moment=require(_0xa5d4('0x2'));var BPromise=require(_0xa5d4('0x3'));var rs=require(_0xa5d4('0x4'));var fs=require('fs');var Redis=require(_0xa5d4('0x5'));var db=require(_0xa5d4('0x6'))['db'];var utils=require(_0xa5d4('0x7'));var logger=require(_0xa5d4('0x8'))(_0xa5d4('0x9'));var config=require('../../config/environment');var jayson=require(_0xa5d4('0xa'));var client=jayson['client'][_0xa5d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552eb9,_0x1d7a61,_0x27a1e8){return new BPromise(function(_0x4f9bf6,_0x11df96){return client[_0xa5d4('0xc')](_0x552eb9,_0x27a1e8)['then'](function(_0x17c201){logger[_0xa5d4('0xd')](_0xa5d4('0xe'),_0x1d7a61,_0xa5d4('0xf'));logger[_0xa5d4('0x10')](_0xa5d4('0x11'),_0x1d7a61,_0xa5d4('0xf'),JSON['stringify'](_0x17c201));if(_0x17c201['error']){if(_0x17c201[_0xa5d4('0x12')]['code']===0x1f4){logger[_0xa5d4('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1d7a61,_0x17c201[_0xa5d4('0x12')]['message']);return _0x11df96(_0x17c201[_0xa5d4('0x12')]['message']);}logger[_0xa5d4('0x12')](_0xa5d4('0xe'),_0x1d7a61,_0x17c201[_0xa5d4('0x12')]['message']);return _0x4f9bf6(_0x17c201[_0xa5d4('0x12')]['message']);}else{logger[_0xa5d4('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1d7a61,_0xa5d4('0xf'));_0x4f9bf6(_0x17c201[_0xa5d4('0x13')]['message']);}})[_0xa5d4('0x14')](function(_0x3f2e84){logger[_0xa5d4('0x12')](_0xa5d4('0xe'),_0x1d7a61,_0x3f2e84);_0x11df96(_0x3f2e84);});});} \ No newline at end of file +var _0x83b6=['info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticTreeReport,\x20%s,\x20%s','message'];(function(_0x4a4d8e,_0x22a7a9){var _0x1a5cb4=function(_0xdcf2eb){while(--_0xdcf2eb){_0x4a4d8e['push'](_0x4a4d8e['shift']());}};_0x1a5cb4(++_0x22a7a9);}(_0x83b6,0x145));var _0x683b=function(_0x1ddc14,_0x2f7e41){_0x1ddc14=_0x1ddc14-0x0;var _0xb6ea8=_0x83b6[_0x1ddc14];return _0xb6ea8;};'use strict';var _=require(_0x683b('0x0'));var util=require(_0x683b('0x1'));var moment=require(_0x683b('0x2'));var BPromise=require('bluebird');var rs=require(_0x683b('0x3'));var fs=require('fs');var Redis=require(_0x683b('0x4'));var db=require(_0x683b('0x5'))['db'];var utils=require(_0x683b('0x6'));var logger=require('../../config/logger')(_0x683b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x683b('0x8')][_0x683b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39d46a,_0x18bd50,_0x40b823){return new BPromise(function(_0x55ff54,_0x206046){return client['request'](_0x39d46a,_0x40b823)['then'](function(_0x40a6ec){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x18bd50,_0x683b('0xa'));logger[_0x683b('0xb')](_0x683b('0xc'),_0x18bd50,_0x683b('0xa'),JSON[_0x683b('0xd')](_0x40a6ec));if(_0x40a6ec[_0x683b('0xe')]){if(_0x40a6ec[_0x683b('0xe')]['code']===0x1f4){logger[_0x683b('0xe')](_0x683b('0xf'),_0x18bd50,_0x40a6ec['error'][_0x683b('0x10')]);return _0x206046(_0x40a6ec['error'][_0x683b('0x10')]);}logger[_0x683b('0xe')](_0x683b('0xf'),_0x18bd50,_0x40a6ec[_0x683b('0xe')][_0x683b('0x10')]);return _0x55ff54(_0x40a6ec[_0x683b('0xe')][_0x683b('0x10')]);}else{logger[_0x683b('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0x18bd50,_0x683b('0xa'));_0x55ff54(_0x40a6ec[_0x683b('0x12')][_0x683b('0x10')]);}})['catch'](function(_0x1772f4){logger[_0x683b('0xe')](_0x683b('0xf'),_0x18bd50,_0x1772f4);_0x206046(_0x1772f4);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f0ee33c..dd5782d 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 _0xad87=['./analyticTreeReport.controller','isAuthenticated','index','get','post','put','/:id','update','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0xad87,0xf9));var _0x7ad8=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xad87[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x7ad8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7ad8('0x1'));var express=require(_0x7ad8('0x2'));var router=express[_0x7ad8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7ad8('0x4'));var config=require(_0x7ad8('0x5'));var controller=require(_0x7ad8('0x6'));router['get']('/',auth[_0x7ad8('0x7')](),controller[_0x7ad8('0x8')]);router[_0x7ad8('0x9')]('/:id',auth[_0x7ad8('0x7')](),controller['show']);router[_0x7ad8('0xa')]('/',auth[_0x7ad8('0x7')](),controller['create']);router[_0x7ad8('0xb')](_0x7ad8('0xc'),auth[_0x7ad8('0x7')](),controller[_0x7ad8('0xd')]);router['delete']('/:id',auth[_0x7ad8('0x7')](),controller[_0x7ad8('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa1fb=['express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3d810a,_0x352835){var _0x2c9252=function(_0x51e087){while(--_0x51e087){_0x3d810a['push'](_0x3d810a['shift']());}};_0x2c9252(++_0x352835);}(_0xa1fb,0xc3));var _0xba1f=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xa1fb[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0xba1f('0x0'));var util=require('util');var path=require(_0xba1f('0x1'));var timeout=require(_0xba1f('0x2'));var express=require(_0xba1f('0x3'));var router=express[_0xba1f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xba1f('0x5'));var config=require(_0xba1f('0x6'));var controller=require(_0xba1f('0x7'));router['get']('/',auth[_0xba1f('0x8')](),controller['index']);router['get']('/:id',auth[_0xba1f('0x8')](),controller[_0xba1f('0x9')]);router[_0xba1f('0xa')]('/',auth[_0xba1f('0x8')](),controller[_0xba1f('0xb')]);router[_0xba1f('0xc')](_0xba1f('0xd'),auth[_0xba1f('0x8')](),controller[_0xba1f('0xe')]);router[_0xba1f('0xf')](_0xba1f('0xd'),auth[_0xba1f('0x8')](),controller[_0xba1f('0x10')]);module[_0xba1f('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 94c3475..56ceca9 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 _0x72c9=['STRING'];(function(_0x565c9d,_0x1127c9){var _0x5036b9=function(_0x16aaed){while(--_0x16aaed){_0x565c9d['push'](_0x565c9d['shift']());}};_0x5036b9(++_0x1127c9);}(_0x72c9,0x1be));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x972c('0x0')]},'basename':{'type':Sequelize[_0x972c('0x0')]},'type':{'type':Sequelize[_0x972c('0x0')]}}; \ No newline at end of file +var _0x7ec0=['exports','STRING','sequelize'];(function(_0x466a1a,_0x37933b){var _0x577165=function(_0x4c97b9){while(--_0x4c97b9){_0x466a1a['push'](_0x466a1a['shift']());}};_0x577165(++_0x37933b);}(_0x7ec0,0x10d));var _0x07ec=function(_0xa7434c,_0x70ff84){_0xa7434c=_0xa7434c-0x0;var _0x398651=_0x7ec0[_0xa7434c];return _0x398651;};'use strict';var Sequelize=require(_0x07ec('0x0'));module[_0x07ec('0x1')]={'name':{'type':Sequelize[_0x07ec('0x2')]},'basename':{'type':Sequelize[_0x07ec('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9119746..3626a9f 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 _0x88db=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Attachment','findAll','rows','catch','show','params','find','clone','get','omit','updatedAt','body','file','originalname','basename','filename','download','findOne','root','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x18f1f6,_0x316d99){var _0x292635=function(_0x821524){while(--_0x821524){_0x18f1f6['push'](_0x18f1f6['shift']());}};_0x292635(++_0x316d99);}(_0x88db,0x13c));var _0xb88d=function(_0x37a41a,_0x3bb1ad){_0x37a41a=_0x37a41a-0x0;var _0x3382b0=_0x88db[_0x37a41a];return _0x3382b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb88d('0x0'));var rimraf=require(_0xb88d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb88d('0x2'));var moment=require(_0xb88d('0x3'));var BPromise=require(_0xb88d('0x4'));var Mustache=require(_0xb88d('0x5'));var util=require('util');var path=require(_0xb88d('0x6'));var sox=require(_0xb88d('0x7'));var csv=require(_0xb88d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb88d('0x9'));var squel=require('squel');var crypto=require(_0xb88d('0xa'));var jsforce=require(_0xb88d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb88d('0x8'));var querystring=require(_0xb88d('0xc'));var Papa=require(_0xb88d('0xd'));var Redis=require('ioredis');var authService=require(_0xb88d('0xe'));var qs=require(_0xb88d('0xf'));var as=require(_0xb88d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb88d('0x11'))(_0xb88d('0x12'));var utils=require(_0xb88d('0x13'));var config=require(_0xb88d('0x14'));var db=require(_0xb88d('0x15'))['db'];function respondWithStatusCode(_0x14b42f,_0x5a035d){_0x5a035d=_0x5a035d||0xcc;return function(_0x552886){if(_0x552886){return _0x14b42f['sendStatus'](_0x5a035d);}return _0x14b42f[_0xb88d('0x16')](_0x5a035d)[_0xb88d('0x17')]();};}function respondWithResult(_0x581312,_0x3fdc91){_0x3fdc91=_0x3fdc91||0xc8;return function(_0x578fd5){if(_0x578fd5){return _0x581312[_0xb88d('0x16')](_0x3fdc91)[_0xb88d('0x18')](_0x578fd5);}};}function respondWithFilteredResult(_0x434337,_0x306ead){return function(_0x44328a){if(_0x44328a){var _0x26e916=_0x44328a[_0xb88d('0x19')],_0xdd63ea=_0x306ead[_0xb88d('0x1a')],_0x4ad575=_0x306ead[_0xb88d('0x1a')]+_0x306ead[_0xb88d('0x1b')],_0x8d0e8f;if(_0x4ad575>=_0x26e916){_0x4ad575=_0x26e916;_0x8d0e8f=0xc8;}else{_0x8d0e8f=0xce;}_0x434337[_0xb88d('0x16')](_0x8d0e8f);return _0x434337[_0xb88d('0x1c')](_0xb88d('0x1d'),_0xdd63ea+'-'+_0x4ad575+'/'+_0x26e916)[_0xb88d('0x18')](_0x44328a);}return null;};}function patchUpdates(_0x5c31f8){return function(_0x256a6c){try{jsonpatch['apply'](_0x256a6c,_0x5c31f8,!![]);}catch(_0x103eff){return BPromise[_0xb88d('0x1e')](_0x103eff);}return _0x256a6c[_0xb88d('0x1f')]();};}function saveUpdates(_0x33e25b,_0x29bae9){return function(_0x4c532c){if(_0x4c532c){return _0x4c532c[_0xb88d('0x20')](_0x33e25b)[_0xb88d('0x21')](function(_0x39c71c){return _0x39c71c;});}return null;};}function removeEntity(_0x104ed1,_0x5c4b2f){return function(_0x36aa7f){if(_0x36aa7f){return _0x36aa7f[_0xb88d('0x22')]()[_0xb88d('0x21')](function(){_0x104ed1['status'](0xcc)[_0xb88d('0x17')]();});}};}function handleEntityNotFound(_0x513fad,_0x1275e4){return function(_0x50b303){if(!_0x50b303){_0x513fad[_0xb88d('0x23')](0x194);}return _0x50b303;};}function handleError(_0x301582,_0x5601a2){_0x5601a2=_0x5601a2||0x1f4;return function(_0x36bb92){logger[_0xb88d('0x24')](_0x36bb92[_0xb88d('0x25')]);if(_0x36bb92['name']){delete _0x36bb92['name'];}_0x301582[_0xb88d('0x16')](_0x5601a2)[_0xb88d('0x26')](_0x36bb92);};}exports[_0xb88d('0x27')]=function(_0xcc62cd,_0x41020b){var _0xc9089a={},_0x2375d5={},_0x1b4a8={'count':0x0,'rows':[]};var _0x3f32a9=_['map'](db['Attachment'][_0xb88d('0x28')],function(_0x1f2846){return{'name':_0x1f2846[_0xb88d('0x29')],'type':_0x1f2846[_0xb88d('0x2a')][_0xb88d('0x2b')]};});_0x2375d5[_0xb88d('0x2c')]=_[_0xb88d('0x2d')](_0x3f32a9,_0xb88d('0x2e'));_0x2375d5[_0xb88d('0x2f')]=_[_0xb88d('0x30')](_0xcc62cd['query']);_0x2375d5['filters']=_[_0xb88d('0x31')](_0x2375d5[_0xb88d('0x2c')],_0x2375d5['query']);_0xc9089a['attributes']=_[_0xb88d('0x31')](_0x2375d5[_0xb88d('0x2c')],qs[_0xb88d('0x32')](_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x32')]));_0xc9089a[_0xb88d('0x33')]=_0xc9089a['attributes'][_0xb88d('0x34')]?_0xc9089a['attributes']:_0x2375d5['model'];if(!_0xcc62cd['query'][_0xb88d('0x35')](_0xb88d('0x36'))){_0xc9089a[_0xb88d('0x1b')]=qs[_0xb88d('0x1b')](_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x1b')]);_0xc9089a[_0xb88d('0x1a')]=qs['offset'](_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x1a')]);}_0xc9089a[_0xb88d('0x37')]=qs[_0xb88d('0x38')](_0xcc62cd[_0xb88d('0x2f')]['sort']);_0xc9089a[_0xb88d('0x39')]=qs['filters'](_[_0xb88d('0x3a')](_0xcc62cd[_0xb88d('0x2f')],_0x2375d5['filters']),_0x3f32a9);if(_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x3b')]){_0xc9089a['where']=_[_0xb88d('0x3c')](_0xc9089a[_0xb88d('0x39')],{'$or':_[_0xb88d('0x2d')](_0x3f32a9,function(_0x429322){if(_0x429322[_0xb88d('0x2a')]!=='VIRTUAL'){var _0x590c0d={};_0x590c0d[_0x429322[_0xb88d('0x2e')]]={'$like':'%'+_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x3b')]+'%'};return _0x590c0d;}})});}_0xc9089a=_[_0xb88d('0x3c')]({},_0xc9089a,_0xcc62cd[_0xb88d('0x3d')]);var _0x4ce4f8={'where':_0xc9089a['where']};return db['Attachment']['count'](_0x4ce4f8)[_0xb88d('0x21')](function(_0x2d9ffa){_0x1b4a8[_0xb88d('0x19')]=_0x2d9ffa;if(_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x3e')]){_0xc9089a[_0xb88d('0x3f')]=[{'all':!![]}];}return db[_0xb88d('0x40')][_0xb88d('0x41')](_0xc9089a);})[_0xb88d('0x21')](function(_0x4ab7db){_0x1b4a8[_0xb88d('0x42')]=_0x4ab7db;return _0x1b4a8;})['then'](respondWithFilteredResult(_0x41020b,_0xc9089a))[_0xb88d('0x43')](handleError(_0x41020b,null));};exports[_0xb88d('0x44')]=function(_0x33f758,_0x4123a6){var _0x4821ae={'raw':!![],'where':{'id':_0x33f758[_0xb88d('0x45')]['id']}},_0x3952b1={};_0x3952b1[_0xb88d('0x2c')]=_['keys'](db[_0xb88d('0x40')]['rawAttributes']);_0x3952b1[_0xb88d('0x2f')]=_[_0xb88d('0x30')](_0x33f758[_0xb88d('0x2f')]);_0x3952b1['filters']=_[_0xb88d('0x31')](_0x3952b1['model'],_0x3952b1[_0xb88d('0x2f')]);_0x4821ae[_0xb88d('0x33')]=_[_0xb88d('0x31')](_0x3952b1['model'],qs[_0xb88d('0x32')](_0x33f758['query'][_0xb88d('0x32')]));_0x4821ae[_0xb88d('0x33')]=_0x4821ae[_0xb88d('0x33')][_0xb88d('0x34')]?_0x4821ae[_0xb88d('0x33')]:_0x3952b1[_0xb88d('0x2c')];if(_0x33f758[_0xb88d('0x2f')]['includeAll']){_0x4821ae[_0xb88d('0x3f')]=[{'all':!![]}];}_0x4821ae=_[_0xb88d('0x3c')]({},_0x4821ae,_0x33f758['options']);return db['Attachment'][_0xb88d('0x46')](_0x4821ae)[_0xb88d('0x21')](handleEntityNotFound(_0x4123a6,null))['then'](respondWithResult(_0x4123a6,null))[_0xb88d('0x43')](handleError(_0x4123a6,null));};exports[_0xb88d('0x47')]=function(_0x4a12a2,_0x223c5e){var _0x4724f5={'where':{'id':_0x4a12a2[_0xb88d('0x45')]['id']}},_0x456283={};_0x456283['model']=_[_0xb88d('0x30')](db[_0xb88d('0x40')]['rawAttributes']);_0x4724f5[_0xb88d('0x33')]=_['intersection'](_0x456283[_0xb88d('0x2c')],qs['fields'](_0x4a12a2[_0xb88d('0x2f')][_0xb88d('0x32')]));_0x4724f5[_0xb88d('0x33')]=_0x4724f5['attributes']['length']?_0x4724f5[_0xb88d('0x33')]:_0x456283[_0xb88d('0x2c')];if(_0x4a12a2['query'][_0xb88d('0x3e')]){_0x4724f5[_0xb88d('0x3f')]=[{'all':!![]}];}_0x4724f5=_[_0xb88d('0x3c')]({},_0x4724f5,_0x4a12a2[_0xb88d('0x3d')]);return db[_0xb88d('0x40')]['find'](_0x4724f5)[_0xb88d('0x21')](handleEntityNotFound(_0x223c5e,null))['then'](function(_0x15b7a9){if(_0x15b7a9){var _0x24e296=_0x15b7a9[_0xb88d('0x48')]({'plain':!![]});_0x24e296=qs[_0xb88d('0x49')](_0x24e296,['id','createdAt',_0xb88d('0x4a')]);_0x4a12a2[_0xb88d('0x4b')]=_[_0xb88d('0x49')](_0x4a12a2[_0xb88d('0x4b')],['id','createdAt',_0xb88d('0x4a')]);return db['Attachment']['create'](_['merge'](_0x24e296,_0x4a12a2[_0xb88d('0x4b')]),{'include':_0x4a12a2[_0xb88d('0x2f')][_0xb88d('0x3e')]?[{'all':!![]}]:undefined});}})[_0xb88d('0x21')](respondWithResult(_0x223c5e,0xc9))[_0xb88d('0x43')](handleError(_0x223c5e,null));};exports[_0xb88d('0x20')]=function(_0x9ebb2a,_0x4041ed){if(_0x9ebb2a[_0xb88d('0x4b')]['id']){delete _0x9ebb2a['body']['id'];}return db[_0xb88d('0x40')][_0xb88d('0x46')]({'where':{'id':_0x9ebb2a[_0xb88d('0x45')]['id']}})[_0xb88d('0x21')](handleEntityNotFound(_0x4041ed,null))[_0xb88d('0x21')](saveUpdates(_0x9ebb2a[_0xb88d('0x4b')],null))['then'](respondWithResult(_0x4041ed,null))[_0xb88d('0x43')](handleError(_0x4041ed,null));};exports[_0xb88d('0x22')]=function(_0x192d87,_0x268839){return db[_0xb88d('0x40')][_0xb88d('0x46')]({'where':{'id':_0x192d87[_0xb88d('0x45')]['id']}})[_0xb88d('0x21')](handleEntityNotFound(_0x268839,null))[_0xb88d('0x21')](removeEntity(_0x268839,null))[_0xb88d('0x43')](handleError(_0x268839,null));};exports['create']=function(_0x907f24,_0x34846b,_0x2faa3a){_0x907f24[_0xb88d('0x4b')][_0xb88d('0x2e')]=_0x907f24[_0xb88d('0x4c')][_0xb88d('0x4d')];_0x907f24[_0xb88d('0x4b')][_0xb88d('0x4e')]=_0x907f24[_0xb88d('0x4c')][_0xb88d('0x4f')];_0x907f24[_0xb88d('0x4b')][_0xb88d('0x2a')]=_0x907f24[_0xb88d('0x4c')]['mimetype'];return db[_0xb88d('0x40')]['create'](_0x907f24[_0xb88d('0x4b')])[_0xb88d('0x21')](respondWithResult(_0x34846b,0xc9))[_0xb88d('0x43')](handleError(_0x34846b,null));};exports[_0xb88d('0x50')]=function(_0x22b33f,_0x32f1e1,_0x3fca3){return db['Attachment'][_0xb88d('0x51')]({'where':{'id':_0x22b33f[_0xb88d('0x45')]['id']},'raw':!![]})[_0xb88d('0x21')](handleEntityNotFound(_0x32f1e1,null))[_0xb88d('0x21')](function(_0x42f1a6){if(_0x42f1a6){return _0x32f1e1['download'](path['join'](config[_0xb88d('0x52')],'server/files/attachments/',_0x42f1a6[_0xb88d('0x4e')]));}})[_0xb88d('0x43')](handleError(_0x32f1e1,null));}; \ No newline at end of file +var _0x5736=['ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','stack','name','send','Attachment','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','length','find','clone','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','filename','mimetype','findOne','download','join','root','server/files/attachments/','basename','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse'];(function(_0x8c64d1,_0x4d35e2){var _0xac7a6b=function(_0x3881d6){while(--_0x3881d6){_0x8c64d1['push'](_0x8c64d1['shift']());}};_0xac7a6b(++_0x4d35e2);}(_0x5736,0xef));var _0x6573=function(_0x3876d5,_0x147e2f){_0x3876d5=_0x3876d5-0x0;var _0x537df3=_0x5736[_0x3876d5];return _0x537df3;};'use strict';var pdf=require(_0x6573('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6573('0x1'));var zipdir=require(_0x6573('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6573('0x3'));var moment=require('moment');var BPromise=require(_0x6573('0x4'));var Mustache=require(_0x6573('0x5'));var util=require(_0x6573('0x6'));var path=require(_0x6573('0x7'));var sox=require(_0x6573('0x8'));var csv=require(_0x6573('0x9'));var ejs=require(_0x6573('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6573('0xb'));var crypto=require(_0x6573('0xc'));var jsforce=require(_0x6573('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6573('0x9'));var querystring=require(_0x6573('0xe'));var Papa=require(_0x6573('0xf'));var Redis=require(_0x6573('0x10'));var authService=require(_0x6573('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6573('0x12'))(_0x6573('0x13'));var utils=require(_0x6573('0x14'));var config=require('../../config/environment');var db=require(_0x6573('0x15'))['db'];function respondWithStatusCode(_0xdcf058,_0x6f2af2){_0x6f2af2=_0x6f2af2||0xcc;return function(_0x593cb1){if(_0x593cb1){return _0xdcf058[_0x6573('0x16')](_0x6f2af2);}return _0xdcf058[_0x6573('0x17')](_0x6f2af2)[_0x6573('0x18')]();};}function respondWithResult(_0x2b8fc0,_0x4fbadd){_0x4fbadd=_0x4fbadd||0xc8;return function(_0x33f5da){if(_0x33f5da){return _0x2b8fc0[_0x6573('0x17')](_0x4fbadd)[_0x6573('0x19')](_0x33f5da);}};}function respondWithFilteredResult(_0x362145,_0x311206){return function(_0x13a4f7){if(_0x13a4f7){var _0x4b46d8=_0x13a4f7[_0x6573('0x1a')],_0x1d42fe=_0x311206['offset'],_0x3ac657=_0x311206[_0x6573('0x1b')]+_0x311206[_0x6573('0x1c')],_0x16640b;if(_0x3ac657>=_0x4b46d8){_0x3ac657=_0x4b46d8;_0x16640b=0xc8;}else{_0x16640b=0xce;}_0x362145[_0x6573('0x17')](_0x16640b);return _0x362145[_0x6573('0x1d')](_0x6573('0x1e'),_0x1d42fe+'-'+_0x3ac657+'/'+_0x4b46d8)[_0x6573('0x19')](_0x13a4f7);}return null;};}function patchUpdates(_0x5e8c4a){return function(_0x3cfe93){try{jsonpatch['apply'](_0x3cfe93,_0x5e8c4a,!![]);}catch(_0x21afca){return BPromise['reject'](_0x21afca);}return _0x3cfe93[_0x6573('0x1f')]();};}function saveUpdates(_0xa9b7b6,_0x3183a5){return function(_0x1bc3b1){if(_0x1bc3b1){return _0x1bc3b1[_0x6573('0x20')](_0xa9b7b6)[_0x6573('0x21')](function(_0x49f3c6){return _0x49f3c6;});}return null;};}function removeEntity(_0x4ca2d7,_0x3f5457){return function(_0x204183){if(_0x204183){return _0x204183['destroy']()['then'](function(){_0x4ca2d7[_0x6573('0x17')](0xcc)[_0x6573('0x18')]();});}};}function handleEntityNotFound(_0x538905,_0x168c5a){return function(_0x327658){if(!_0x327658){_0x538905[_0x6573('0x16')](0x194);}return _0x327658;};}function handleError(_0x5b466d,_0x3bc9ac){_0x3bc9ac=_0x3bc9ac||0x1f4;return function(_0x3fb478){logger['error'](_0x3fb478[_0x6573('0x22')]);if(_0x3fb478[_0x6573('0x23')]){delete _0x3fb478[_0x6573('0x23')];}_0x5b466d[_0x6573('0x17')](_0x3bc9ac)[_0x6573('0x24')](_0x3fb478);};}exports['index']=function(_0x2a1cae,_0x550541){var _0x5395e8={},_0x2314b7={},_0x52a360={'count':0x0,'rows':[]};var _0xc5964f=_['map'](db[_0x6573('0x25')][_0x6573('0x26')],function(_0x20309e){return{'name':_0x20309e[_0x6573('0x27')],'type':_0x20309e[_0x6573('0x28')][_0x6573('0x29')]};});_0x2314b7[_0x6573('0x2a')]=_[_0x6573('0x2b')](_0xc5964f,'name');_0x2314b7[_0x6573('0x2c')]=_['keys'](_0x2a1cae[_0x6573('0x2c')]);_0x2314b7[_0x6573('0x2d')]=_[_0x6573('0x2e')](_0x2314b7[_0x6573('0x2a')],_0x2314b7[_0x6573('0x2c')]);_0x5395e8[_0x6573('0x2f')]=_[_0x6573('0x2e')](_0x2314b7[_0x6573('0x2a')],qs[_0x6573('0x30')](_0x2a1cae['query'][_0x6573('0x30')]));_0x5395e8[_0x6573('0x2f')]=_0x5395e8[_0x6573('0x2f')]['length']?_0x5395e8[_0x6573('0x2f')]:_0x2314b7[_0x6573('0x2a')];if(!_0x2a1cae[_0x6573('0x2c')][_0x6573('0x31')](_0x6573('0x32'))){_0x5395e8['limit']=qs['limit'](_0x2a1cae[_0x6573('0x2c')][_0x6573('0x1c')]);_0x5395e8[_0x6573('0x1b')]=qs[_0x6573('0x1b')](_0x2a1cae[_0x6573('0x2c')][_0x6573('0x1b')]);}_0x5395e8[_0x6573('0x33')]=qs[_0x6573('0x34')](_0x2a1cae[_0x6573('0x2c')]['sort']);_0x5395e8[_0x6573('0x35')]=qs[_0x6573('0x2d')](_[_0x6573('0x36')](_0x2a1cae[_0x6573('0x2c')],_0x2314b7['filters']),_0xc5964f);if(_0x2a1cae['query'][_0x6573('0x37')]){_0x5395e8[_0x6573('0x35')]=_[_0x6573('0x38')](_0x5395e8[_0x6573('0x35')],{'$or':_['map'](_0xc5964f,function(_0x1ef5ed){if(_0x1ef5ed['type']!==_0x6573('0x39')){var _0x37a4df={};_0x37a4df[_0x1ef5ed['name']]={'$like':'%'+_0x2a1cae[_0x6573('0x2c')][_0x6573('0x37')]+'%'};return _0x37a4df;}})});}_0x5395e8=_[_0x6573('0x38')]({},_0x5395e8,_0x2a1cae[_0x6573('0x3a')]);var _0x293e7f={'where':_0x5395e8['where']};return db[_0x6573('0x25')][_0x6573('0x1a')](_0x293e7f)['then'](function(_0xc9de7a){_0x52a360['count']=_0xc9de7a;if(_0x2a1cae['query'][_0x6573('0x3b')]){_0x5395e8[_0x6573('0x3c')]=[{'all':!![]}];}return db[_0x6573('0x25')][_0x6573('0x3d')](_0x5395e8);})['then'](function(_0x3e66b5){_0x52a360['rows']=_0x3e66b5;return _0x52a360;})[_0x6573('0x21')](respondWithFilteredResult(_0x550541,_0x5395e8))[_0x6573('0x3e')](handleError(_0x550541,null));};exports['show']=function(_0x3a1d47,_0x96114c){var _0x28bad6={'raw':!![],'where':{'id':_0x3a1d47[_0x6573('0x3f')]['id']}},_0x5604b0={};_0x5604b0['model']=_[_0x6573('0x40')](db[_0x6573('0x25')][_0x6573('0x26')]);_0x5604b0[_0x6573('0x2c')]=_[_0x6573('0x40')](_0x3a1d47[_0x6573('0x2c')]);_0x5604b0[_0x6573('0x2d')]=_[_0x6573('0x2e')](_0x5604b0['model'],_0x5604b0[_0x6573('0x2c')]);_0x28bad6[_0x6573('0x2f')]=_[_0x6573('0x2e')](_0x5604b0[_0x6573('0x2a')],qs[_0x6573('0x30')](_0x3a1d47['query'][_0x6573('0x30')]));_0x28bad6[_0x6573('0x2f')]=_0x28bad6[_0x6573('0x2f')][_0x6573('0x41')]?_0x28bad6[_0x6573('0x2f')]:_0x5604b0[_0x6573('0x2a')];if(_0x3a1d47[_0x6573('0x2c')][_0x6573('0x3b')]){_0x28bad6[_0x6573('0x3c')]=[{'all':!![]}];}_0x28bad6=_['merge']({},_0x28bad6,_0x3a1d47['options']);return db['Attachment'][_0x6573('0x42')](_0x28bad6)[_0x6573('0x21')](handleEntityNotFound(_0x96114c,null))[_0x6573('0x21')](respondWithResult(_0x96114c,null))[_0x6573('0x3e')](handleError(_0x96114c,null));};exports[_0x6573('0x43')]=function(_0xf4ddae,_0x2d60aa){var _0x45b7fe={'where':{'id':_0xf4ddae['params']['id']}},_0x46d3a5={};_0x46d3a5[_0x6573('0x2a')]=_['keys'](db['Attachment'][_0x6573('0x26')]);_0x45b7fe['attributes']=_[_0x6573('0x2e')](_0x46d3a5['model'],qs[_0x6573('0x30')](_0xf4ddae['query']['fields']));_0x45b7fe['attributes']=_0x45b7fe[_0x6573('0x2f')][_0x6573('0x41')]?_0x45b7fe[_0x6573('0x2f')]:_0x46d3a5['model'];if(_0xf4ddae[_0x6573('0x2c')][_0x6573('0x3b')]){_0x45b7fe[_0x6573('0x3c')]=[{'all':!![]}];}_0x45b7fe=_['merge']({},_0x45b7fe,_0xf4ddae['options']);return db[_0x6573('0x25')][_0x6573('0x42')](_0x45b7fe)[_0x6573('0x21')](handleEntityNotFound(_0x2d60aa,null))['then'](function(_0x221b21){if(_0x221b21){var _0x165875=_0x221b21[_0x6573('0x44')]({'plain':!![]});_0x165875=qs[_0x6573('0x45')](_0x165875,['id',_0x6573('0x46'),_0x6573('0x47')]);_0xf4ddae[_0x6573('0x48')]=_[_0x6573('0x45')](_0xf4ddae[_0x6573('0x48')],['id',_0x6573('0x46'),'updatedAt']);return db[_0x6573('0x25')][_0x6573('0x49')](_[_0x6573('0x38')](_0x165875,_0xf4ddae[_0x6573('0x48')]),{'include':_0xf4ddae[_0x6573('0x2c')][_0x6573('0x3b')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2d60aa,0xc9))[_0x6573('0x3e')](handleError(_0x2d60aa,null));};exports['update']=function(_0x297e51,_0x3edb8a){if(_0x297e51[_0x6573('0x48')]['id']){delete _0x297e51[_0x6573('0x48')]['id'];}return db[_0x6573('0x25')]['find']({'where':{'id':_0x297e51[_0x6573('0x3f')]['id']}})[_0x6573('0x21')](handleEntityNotFound(_0x3edb8a,null))[_0x6573('0x21')](saveUpdates(_0x297e51[_0x6573('0x48')],null))[_0x6573('0x21')](respondWithResult(_0x3edb8a,null))['catch'](handleError(_0x3edb8a,null));};exports[_0x6573('0x4a')]=function(_0x1713ef,_0x3075dd){return db[_0x6573('0x25')]['find']({'where':{'id':_0x1713ef[_0x6573('0x3f')]['id']}})[_0x6573('0x21')](handleEntityNotFound(_0x3075dd,null))[_0x6573('0x21')](removeEntity(_0x3075dd,null))[_0x6573('0x3e')](handleError(_0x3075dd,null));};exports[_0x6573('0x49')]=function(_0x17be45,_0x198664,_0x1826d7){_0x17be45[_0x6573('0x48')][_0x6573('0x23')]=_0x17be45[_0x6573('0x4b')][_0x6573('0x4c')];_0x17be45['body']['basename']=_0x17be45[_0x6573('0x4b')][_0x6573('0x4d')];_0x17be45[_0x6573('0x48')][_0x6573('0x28')]=_0x17be45[_0x6573('0x4b')][_0x6573('0x4e')];return db[_0x6573('0x25')][_0x6573('0x49')](_0x17be45['body'])[_0x6573('0x21')](respondWithResult(_0x198664,0xc9))['catch'](handleError(_0x198664,null));};exports['download']=function(_0x57de23,_0x458172,_0x172b48){return db[_0x6573('0x25')][_0x6573('0x4f')]({'where':{'id':_0x57de23[_0x6573('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x458172,null))[_0x6573('0x21')](function(_0x4fb632){if(_0x4fb632){return _0x458172[_0x6573('0x50')](path[_0x6573('0x51')](config[_0x6573('0x52')],_0x6573('0x53'),_0x4fb632[_0x6573('0x54')]));}})[_0x6573('0x3e')](handleError(_0x458172,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d2f5aca..1031a9f 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 _0xbdb7=['request-promise','path','rimraf','./attachment.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0xbdb7[_0x549928];return _0x941e27;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment'];(function(_0x72316c,_0x53aa68){var _0x434d48=function(_0x3dc405){while(--_0x3dc405){_0x72316c['push'](_0x72316c['shift']());}};_0x434d48(++_0x53aa68);}(_0x34e8,0x12c));var _0x834e=function(_0x3e2b19,_0x98a894){_0x3e2b19=_0x3e2b19-0x0;var _0x301216=_0x34e8[_0x3e2b19];return _0x301216;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index d867baf..b53b0e2 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 _0x5cf5=['../../config/environment','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Attachment','create','body','options','CreateAttachment','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x189626,_0x396521){var _0xbfc0f1=function(_0x33b433){while(--_0x33b433){_0x189626['push'](_0x189626['shift']());}};_0xbfc0f1(++_0x396521);}(_0x5cf5,0xae));var _0x55cf=function(_0x3dec58,_0x2fb4bb){_0x3dec58=_0x3dec58-0x0;var _0x25360c=_0x5cf5[_0x3dec58];return _0x25360c;};'use strict';var _=require('lodash');var util=require(_0x55cf('0x0'));var moment=require('moment');var BPromise=require(_0x55cf('0x1'));var rs=require(_0x55cf('0x2'));var fs=require('fs');var Redis=require(_0x55cf('0x3'));var db=require(_0x55cf('0x4'))['db'];var utils=require(_0x55cf('0x5'));var logger=require(_0x55cf('0x6'))(_0x55cf('0x7'));var config=require(_0x55cf('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c2de2,_0x24dff1,_0x401a38){return new BPromise(function(_0x4e6c04,_0xe33d50){return client['request'](_0x2c2de2,_0x401a38)[_0x55cf('0xa')](function(_0x2212f6){logger[_0x55cf('0xb')](_0x55cf('0xc'),_0x24dff1,_0x55cf('0xd'));logger[_0x55cf('0xe')](_0x55cf('0xf'),_0x24dff1,'request\x20sent',JSON[_0x55cf('0x10')](_0x2212f6));if(_0x2212f6[_0x55cf('0x11')]){if(_0x2212f6['error'][_0x55cf('0x12')]===0x1f4){logger[_0x55cf('0x11')]('Attachment,\x20%s,\x20%s',_0x24dff1,_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);return _0xe33d50(_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);}logger[_0x55cf('0x11')](_0x55cf('0xc'),_0x24dff1,_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);return _0x4e6c04(_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);}else{logger[_0x55cf('0xb')](_0x55cf('0xc'),_0x24dff1,'request\x20sent');_0x4e6c04(_0x2212f6[_0x55cf('0x14')][_0x55cf('0x13')]);}})['catch'](function(_0x3f0191){logger[_0x55cf('0x11')]('Attachment,\x20%s,\x20%s',_0x24dff1,_0x3f0191);_0xe33d50(_0x3f0191);});});}exports['CreateAttachment']=function(_0x339aa9){var _0x349902=this;return new Promise(function(_0x2a2bea,_0x549548){return db[_0x55cf('0x15')][_0x55cf('0x16')](_0x339aa9[_0x55cf('0x17')],{'raw':_0x339aa9[_0x55cf('0x18')]?_0x339aa9[_0x55cf('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x55cf('0xa')](function(_0x57d7cd){logger[_0x55cf('0xb')](_0x55cf('0x19'),_0x339aa9);logger[_0x55cf('0xe')]('CreateAttachment',_0x339aa9,JSON[_0x55cf('0x10')](_0x57d7cd));_0x2a2bea(_0x57d7cd);})['catch'](function(_0x5706a0){logger[_0x55cf('0x11')](_0x55cf('0x19'),_0x5706a0['message'],_0x339aa9);_0x549548(_0x349902[_0x55cf('0x11')](0x1f4,_0x5706a0[_0x55cf('0x13')]));});});}; \ No newline at end of file +var _0x9d69=['catch','Attachment','create','body','options','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x1836a4,_0x10f48b){var _0x2e6d60=function(_0x436ace){while(--_0x436ace){_0x1836a4['push'](_0x1836a4['shift']());}};_0x2e6d60(++_0x10f48b);}(_0x9d69,0x18c));var _0x99d6=function(_0x4c0d42,_0x1fdc54){_0x4c0d42=_0x4c0d42-0x0;var _0x3fdaee=_0x9d69[_0x4c0d42];return _0x3fdaee;};'use strict';var _=require(_0x99d6('0x0'));var util=require(_0x99d6('0x1'));var moment=require(_0x99d6('0x2'));var BPromise=require(_0x99d6('0x3'));var rs=require(_0x99d6('0x4'));var fs=require('fs');var Redis=require(_0x99d6('0x5'));var db=require(_0x99d6('0x6'))['db'];var utils=require(_0x99d6('0x7'));var logger=require(_0x99d6('0x8'))(_0x99d6('0x9'));var config=require(_0x99d6('0xa'));var jayson=require(_0x99d6('0xb'));var client=jayson[_0x99d6('0xc')][_0x99d6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2743d4,_0x916201,_0xe7af1b){return new BPromise(function(_0x54a92c,_0x451b47){return client[_0x99d6('0xe')](_0x2743d4,_0xe7af1b)[_0x99d6('0xf')](function(_0x2d0cd4){logger[_0x99d6('0x10')](_0x99d6('0x11'),_0x916201,_0x99d6('0x12'));logger[_0x99d6('0x13')](_0x99d6('0x14'),_0x916201,_0x99d6('0x12'),JSON['stringify'](_0x2d0cd4));if(_0x2d0cd4[_0x99d6('0x15')]){if(_0x2d0cd4[_0x99d6('0x15')]['code']===0x1f4){logger['error'](_0x99d6('0x11'),_0x916201,_0x2d0cd4['error'][_0x99d6('0x16')]);return _0x451b47(_0x2d0cd4['error'][_0x99d6('0x16')]);}logger[_0x99d6('0x15')](_0x99d6('0x11'),_0x916201,_0x2d0cd4[_0x99d6('0x15')]['message']);return _0x54a92c(_0x2d0cd4[_0x99d6('0x15')][_0x99d6('0x16')]);}else{logger[_0x99d6('0x10')]('Attachment,\x20%s,\x20%s',_0x916201,_0x99d6('0x12'));_0x54a92c(_0x2d0cd4[_0x99d6('0x17')]['message']);}})[_0x99d6('0x18')](function(_0x30c655){logger['error']('Attachment,\x20%s,\x20%s',_0x916201,_0x30c655);_0x451b47(_0x30c655);});});}exports['CreateAttachment']=function(_0x4cd0bf){var _0x40e61a=this;return new Promise(function(_0x50f68f,_0x17a376){return db[_0x99d6('0x19')][_0x99d6('0x1a')](_0x4cd0bf[_0x99d6('0x1b')],{'raw':_0x4cd0bf[_0x99d6('0x1c')]?_0x4cd0bf[_0x99d6('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x99d6('0xf')](function(_0x56fbae){logger[_0x99d6('0x10')](_0x99d6('0x1d'),_0x4cd0bf);logger[_0x99d6('0x13')](_0x99d6('0x1d'),_0x4cd0bf,JSON['stringify'](_0x56fbae));_0x50f68f(_0x56fbae);})[_0x99d6('0x18')](function(_0x104e7c){logger[_0x99d6('0x15')](_0x99d6('0x1d'),_0x104e7c['message'],_0x4cd0bf);_0x17a376(_0x40e61a[_0x99d6('0x15')](0x1f4,_0x104e7c[_0x99d6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dc2e175..e172fdc 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 _0x57b7=['show','/:id/download','download','/:id/clone','diskStorage','join','root','format','now','originalname','post','file','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','/:id'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x57b7,0x160));var _0x757b=function(_0x1b5216,_0x2cc215){_0x1b5216=_0x1b5216-0x0;var _0x17cf41=_0x57b7[_0x1b5216];return _0x17cf41;};'use strict';var multer=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var path=require(_0x757b('0x2'));var timeout=require(_0x757b('0x3'));var express=require(_0x757b('0x4'));var router=express[_0x757b('0x5')]();var auth=require(_0x757b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x757b('0x7'));var controller=require(_0x757b('0x8'));router[_0x757b('0x9')]('/',auth[_0x757b('0xa')](),controller['index']);router[_0x757b('0x9')](_0x757b('0xb'),auth[_0x757b('0xa')](),controller[_0x757b('0xc')]);router[_0x757b('0x9')](_0x757b('0xd'),auth[_0x757b('0xa')](),controller[_0x757b('0xe')]);router['post'](_0x757b('0xf'),auth[_0x757b('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x757b('0x10')]({'destination':function(_0x5a0164,_0x35be15,_0x4cd8a4){_0x4cd8a4(null,path[_0x757b('0x11')](config[_0x757b('0x12')],'server/files/attachments/'));},'filename':function(_0x2af9cb,_0xf94550,_0x5d6f0e){_0x5d6f0e(null,util[_0x757b('0x13')]('%s-%s',Date[_0x757b('0x14')](),_0xf94550[_0x757b('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x757b('0x16')]('/',upload['single'](_0x757b('0x17')),controller[_0x757b('0x18')]);router[_0x757b('0x19')]('/:id',auth[_0x757b('0xa')](),controller[_0x757b('0x1a')]);router['delete'](_0x757b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x757b('0x1b')]=router; \ No newline at end of file +var _0xfff0=['replace','create','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','index','/:id','show','/:id/download','download','post','isAuthenticated','clone','diskStorage','join','root','server/files/attachments/','format','now','originalname'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xfff0,0x139));var _0x0fff=function(_0x3a5bf5,_0x47dc02){_0x3a5bf5=_0x3a5bf5-0x0;var _0x5a934e=_0xfff0[_0x3a5bf5];return _0x5a934e;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require('../../config/environment');var controller=require(_0x0fff('0x6'));router[_0x0fff('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fff('0x8')]);router[_0x0fff('0x7')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xa')]);router['get'](_0x0fff('0xb'),auth['isAuthenticated'](),controller[_0x0fff('0xc')]);router[_0x0fff('0xd')]('/:id/clone',auth[_0x0fff('0xe')](),controller[_0x0fff('0xf')]);var upload=multer({'storage':multer[_0x0fff('0x10')]({'destination':function(_0x289e01,_0x209b6d,_0x20c88b){_0x20c88b(null,path[_0x0fff('0x11')](config[_0x0fff('0x12')],_0x0fff('0x13')));},'filename':function(_0x411ffc,_0x13f768,_0x5abecd){_0x5abecd(null,util[_0x0fff('0x14')]('%s-%s',Date[_0x0fff('0x15')](),_0x13f768[_0x0fff('0x16')][_0x0fff('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0fff('0xd')]('/',upload['single']('file'),controller[_0x0fff('0x18')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0fff('0x19')]);router[_0x0fff('0x1a')]('/:id',auth[_0x0fff('0xe')](),controller[_0x0fff('0x1b')]);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 b2007c2..966b2dc 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 _0x82c3=['admin','agent','disabled','blocked','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','email','callback','authenticate','use','clientID','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','value'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x82c3,0x1e5));var _0x382c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x82c3[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x382c('0x0'));var passport=require(_0x382c('0x1'));var GoogleStrategy=require(_0x382c('0x2'))['Strategy'];var moment=require(_0x382c('0x3'));var db=require(_0x382c('0x4'))['db'];var config=require(_0x382c('0x5'));var signToken=require(_0x382c('0x6'))[_0x382c('0x7')];var utils=require(_0x382c('0x8'));exports[_0x382c('0x9')]=passport['authenticate'](_0x382c('0xa'),{'failureRedirect':_0x382c('0xb'),'scope':['profile',_0x382c('0xc')],'session':![]});exports[_0x382c('0xd')]=passport[_0x382c('0xe')](_0x382c('0xa'),{'failureRedirect':_0x382c('0xb'),'session':![]});passport[_0x382c('0xf')](new GoogleStrategy({'clientID':config[_0x382c('0xa')]?config[_0x382c('0xa')][_0x382c('0x10')]:'id','clientSecret':config[_0x382c('0xa')]?config[_0x382c('0xa')]['clientSecret']:'secret','callbackURL':config[_0x382c('0xa')]?config[_0x382c('0xa')]['callbackURL']:''},function(_0x45bfba,_0x53d2b2,_0x57463c,_0x5b25d8){var _0x129346,_0x558dda;return db[_0x382c('0x11')][_0x382c('0x12')]({'where':{'id':0x1},'attributes':[_0x382c('0x13'),_0x382c('0x14')],'raw':!![]})[_0x382c('0x15')](function(_0x98967d){_0x129346=_0x98967d;return db[_0x382c('0x16')][_0x382c('0x17')]({'where':{'email':_['map'](_0x57463c['emails'],_0x382c('0x18')),'role':{'$or':[_0x382c('0x19'),'user',_0x382c('0x1a')]}}});})[_0x382c('0x15')](function(_0x44f03e){_0x558dda=_0x44f03e;if(_0x558dda){if(_0x558dda[_0x382c('0x1b')]){return _0x5b25d8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x129346['blockDuration']>0x0){if(_0x558dda[_0x382c('0x1c')]){if(moment(_0x558dda['blockedAt'])['add'](_0x129346[_0x382c('0x14')],_0x382c('0x1d'))>moment()){return _0x5b25d8(_0x382c('0x1e'));}else{return utils[_0x382c('0x1f')](_0x558dda,0x0,![],null)['then'](function(){return utils['getLicense'](_0x558dda);})[_0x382c('0x15')](function(){return _0x5b25d8(null,_0x558dda);});}}else{return utils[_0x382c('0x20')](_0x558dda)[_0x382c('0x15')](function(){return _0x5b25d8(null,_0x558dda);});}}else{return utils[_0x382c('0x20')](_0x558dda)['then'](function(){return _0x5b25d8(null,_0x558dda);});}}return _0x5b25d8(_0x382c('0x1e'));})[_0x382c('0x21')](function(_0xacb30b){_0x5b25d8(_0xacb30b);});})); \ No newline at end of file +var _0x6ebb=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','moment','../../mysqldb','signToken','../../config/utils','google','profile','email','callback','authenticate','use','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','User','map','value','admin','user','agent','then','blocked','add','minutes'];(function(_0x30f561,_0x36ce4b){var _0x17233e=function(_0x3428a1){while(--_0x3428a1){_0x30f561['push'](_0x30f561['shift']());}};_0x17233e(++_0x36ce4b);}(_0x6ebb,0x1c6));var _0xb6eb=function(_0x1283a7,_0x214231){_0x1283a7=_0x1283a7-0x0;var _0x24f5d8=_0x6ebb[_0x1283a7];return _0x24f5d8;};'use strict';var _=require(_0xb6eb('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0xb6eb('0x1'));var db=require(_0xb6eb('0x2'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0xb6eb('0x3')];var utils=require(_0xb6eb('0x4'));exports['login']=passport['authenticate'](_0xb6eb('0x5'),{'failureRedirect':'/login','scope':[_0xb6eb('0x6'),_0xb6eb('0x7')],'session':![]});exports[_0xb6eb('0x8')]=passport[_0xb6eb('0x9')](_0xb6eb('0x5'),{'failureRedirect':'/login','session':![]});passport[_0xb6eb('0xa')](new GoogleStrategy({'clientID':config[_0xb6eb('0x5')]?config[_0xb6eb('0x5')]['clientID']:'id','clientSecret':config[_0xb6eb('0x5')]?config['google']['clientSecret']:'secret','callbackURL':config[_0xb6eb('0x5')]?config['google'][_0xb6eb('0xb')]:''},function(_0x15d888,_0x498947,_0xd63484,_0x425d20){var _0x360837,_0x416d13;return db[_0xb6eb('0xc')][_0xb6eb('0xd')]({'where':{'id':0x1},'attributes':[_0xb6eb('0xe'),_0xb6eb('0xf')],'raw':!![]})['then'](function(_0x4a838d){_0x360837=_0x4a838d;return db[_0xb6eb('0x10')]['find']({'where':{'email':_[_0xb6eb('0x11')](_0xd63484['emails'],_0xb6eb('0x12')),'role':{'$or':[_0xb6eb('0x13'),_0xb6eb('0x14'),_0xb6eb('0x15')]}}});})[_0xb6eb('0x16')](function(_0x1da8b6){_0x416d13=_0x1da8b6;if(_0x416d13){if(_0x416d13['disabled']){return _0x425d20('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x360837[_0xb6eb('0xf')]>0x0){if(_0x416d13[_0xb6eb('0x17')]){if(moment(_0x416d13['blockedAt'])[_0xb6eb('0x18')](_0x360837[_0xb6eb('0xf')],_0xb6eb('0x19'))>moment()){return _0x425d20(_0xb6eb('0x1a'));}else{return utils[_0xb6eb('0x1b')](_0x416d13,0x0,![],null)[_0xb6eb('0x16')](function(){return utils['getLicense'](_0x416d13);})[_0xb6eb('0x16')](function(){return _0x425d20(null,_0x416d13);});}}else{return utils[_0xb6eb('0x1c')](_0x416d13)['then'](function(){return _0x425d20(null,_0x416d13);});}}else{return utils['getLicense'](_0x416d13)[_0xb6eb('0x16')](function(){return _0x425d20(null,_0x416d13);});}}return _0x425d20(_0xb6eb('0x1a'));})[_0xb6eb('0x1d')](function(_0x55de74){_0x425d20(_0x55de74);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 510b709..132b6f4 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 _0x261b=['login','setTokenCookie','exports','express','passport','get','callback'];(function(_0x154d1d,_0x32c6e7){var _0x5d2db0=function(_0x4bd51d){while(--_0x4bd51d){_0x154d1d['push'](_0x154d1d['shift']());}};_0x5d2db0(++_0x32c6e7);}(_0x261b,0x15a));var _0xb261=function(_0x1ee87e,_0x370081){_0x1ee87e=_0x1ee87e-0x0;var _0x3aaf74=_0x261b[_0x1ee87e];return _0x3aaf74;};'use strict';var express=require(_0xb261('0x0'));var passport=require(_0xb261('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xb261('0x2')]('/',controller['login']);router[_0xb261('0x2')]('/callback',controller[_0xb261('0x3')],authService['isMiddleware'],userController[_0xb261('0x4')],authService[_0xb261('0x5')]);module[_0xb261('0x6')]=router; \ No newline at end of file +var _0x03ce=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x03ce,0x1a1));var _0xe03c=function(_0x8f2919,_0x1f2a3b){_0x8f2919=_0x8f2919-0x0;var _0xfe7d=_0x03ce[_0x8f2919];return _0xfe7d;};'use strict';var express=require(_0xe03c('0x0'));var passport=require(_0xe03c('0x1'));var router=express[_0xe03c('0x2')]();var controller=require(_0xe03c('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xe03c('0x4'));router[_0xe03c('0x5')]('/',controller[_0xe03c('0x6')]);router['get'](_0xe03c('0x7'),controller[_0xe03c('0x8')],authService[_0xe03c('0x9')],userController[_0xe03c('0x6')],authService[_0xe03c('0xa')]);module[_0xe03c('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6d9e6a3..f365738 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 _0xb4c7=['json','online','Email\x20parameter\x20is\x20missing','generate','body','email','trim','User','find','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport','passport-local','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','blockedAt','loginAttempts','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','minutes','getLicense','catch','blocked','MailAccount','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','test','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0xb4c7,0x19c));var _0x7b4c=function(_0x6939e9,_0x1ea346){_0x6939e9=_0x6939e9-0x0;var _0x32f2dc=_0xb4c7[_0x6939e9];return _0x32f2dc;};'use strict';var util=require(_0x7b4c('0x0'));var passport=require(_0x7b4c('0x1'));var LocalStrategy=require(_0x7b4c('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require('moment');var db=require(_0x7b4c('0x3'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7b4c('0x4'));var client=jayson[_0x7b4c('0x5')][_0x7b4c('0x6')]({'port':0x232b});function localAuthenticate(_0x23ef23,_0x45631a,_0x390317,_0x5905c8){var _0x236939,_0x390d28;return db[_0x7b4c('0x7')][_0x7b4c('0x8')]({'where':{'id':0x1},'attributes':[_0x7b4c('0x9'),_0x7b4c('0xa')],'raw':!![]})['then'](function(_0x1660a7){_0x236939=_0x1660a7;return _0x23ef23[_0x7b4c('0x8')]({'attributes':['id',_0x7b4c('0xb'),_0x7b4c('0xc'),'salt','role','disabled','blocked',_0x7b4c('0xd'),_0x7b4c('0xe')],'where':{'name':_0x45631a,'role':{'$or':['admin',_0x7b4c('0xf'),_0x7b4c('0x10')]}}});})[_0x7b4c('0x11')](function(_0x24ba8c){if(!_0x24ba8c||_0x24ba8c&&_0x24ba8c[_0x7b4c('0xb')]!==_0x45631a){throw new Error(_0x7b4c('0x12'));}else{_0x390d28=_0x24ba8c;return _0x390d28;}})[_0x7b4c('0x11')](function(){_0x390d28['authenticate'](_0x390317,function(_0x2061c3,_0x411f28){var _0x2ed4a9=_0x390d28[_0x7b4c('0xe')]+0x1;if(_0x2061c3){return _0x5905c8(_0x2061c3);}else if(!_0x411f28){if(_0x390d28[_0x7b4c('0x13')]){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else if(_0x236939['allowedLoginAttempts']>0x0){if(_0x390d28['blocked']){if(_0x236939[_0x7b4c('0xa')]>0x0){if(moment(_0x390d28[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x236939[_0x7b4c('0xa')],'minutes')>moment()){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else{return utils[_0x7b4c('0x15')](_0x390d28,_0x2ed4a9,![],null)[_0x7b4c('0x11')](function(){return _0x5905c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{if(_0x2ed4a9>=_0x236939[_0x7b4c('0x9')]){return utils[_0x7b4c('0x15')](_0x390d28,0x0,!![],moment())['then'](function(){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});});}else{return utils[_0x7b4c('0x15')](_0x390d28,_0x2ed4a9,![],null)[_0x7b4c('0x11')](function(){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});});}}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{if(_0x390d28[_0x7b4c('0x13')]){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else if(_0x236939['allowedLoginAttempts']>0x0){if(_0x390d28['blocked']){if(_0x236939[_0x7b4c('0xa')]>0x0){if(moment(_0x390d28[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x236939['blockDuration'],_0x7b4c('0x16'))>moment()){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else{return utils[_0x7b4c('0x15')](_0x390d28,0x0,![],null)[_0x7b4c('0x11')](function(){return utils[_0x7b4c('0x17')](_0x390d28);})[_0x7b4c('0x11')](function(){return _0x5905c8(null,_0x390d28);});}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{return utils[_0x7b4c('0x15')](_0x390d28,0x0,![],null)['then'](function(){return utils[_0x7b4c('0x17')](_0x390d28);})['then'](function(){return _0x5905c8(null,_0x390d28);})[_0x7b4c('0x18')](function(_0x10066c){return _0x5905c8(null,![],_0x10066c);});}}else{if(_0x390d28[_0x7b4c('0x19')]){return _0x5905c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7b4c('0x17')](_0x390d28)[_0x7b4c('0x11')](function(){return _0x5905c8(null,_0x390d28);});}}}});})[_0x7b4c('0x18')](function(_0x4a2b36){return _0x5905c8(null,![],_0x4a2b36);});}function sendServiceMail(_0x3b52b1){return db[_0x7b4c('0x1a')]['find']({'where':{'service':!![]},'attributes':['id',_0x7b4c('0xb'),'email'],'include':[{'model':db[_0x7b4c('0x1b')],'as':_0x7b4c('0x1c')}]})['then'](function(_0x3d6ab1){if(!_0x3d6ab1){throw new Error(_0x7b4c('0x1d'));}var _0x504695={'tls':{'rejectUnauthorized':![]}};if(_0x3d6ab1['Smtp']['service']){_0x504695[_0x7b4c('0x1e')]=_0x3d6ab1[_0x7b4c('0x1c')]['service'];}else{_0x504695[_0x7b4c('0x1f')]=_0x3d6ab1['Smtp'][_0x7b4c('0x1f')];_0x504695[_0x7b4c('0x20')]=_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x20')];_0x504695[_0x7b4c('0x21')]=_0x3d6ab1[_0x7b4c('0x1c')]['secure'];}if(_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x22')]){_0x504695[_0x7b4c('0x23')]={'user':_0x3d6ab1['Smtp'][_0x7b4c('0xf')],'pass':_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x24')]};}var _0x5ab237={'account':_0x504695,'message':_[_0x7b4c('0x25')]({'from':util['format'](_0x7b4c('0x26'),_0x3d6ab1[_0x7b4c('0xb')],_0x3d6ab1['email']||_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0xf')])},_0x3b52b1)};return client['request'](_0x7b4c('0x27'),_0x5ab237);})[_0x7b4c('0x11')](function(_0x45e6db){if(_0x45e6db[_0x7b4c('0x28')]){throw new Error(util[_0x7b4c('0x29')](_0x7b4c('0x2a'),_0x45e6db[_0x7b4c('0x28')]['message']||JSON[_0x7b4c('0x2b')](_0x45e6db[_0x7b4c('0x28')])));}return!![];});}function handleError(_0x51b1af,_0x54a074,_0x309320){return _0x51b1af[_0x7b4c('0x2c')](_0x54a074||0x1f4)['send']({'message':_0x309320?_0x309320[_0x7b4c('0x2d')]||_0x309320:''});}function checkPasswordPattern(_0x3cf8a3,_0x4f44da,_0x33d650){if(_0x33d650){var _0x34f9a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34f9a8[_0x7b4c('0x2e')](_0x4f44da)){return _0x3cf8a3;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3cf8a3;}}exports['login']=function(_0xf08f83,_0x301b19,_0x443277){passport[_0x7b4c('0x2f')](_0x7b4c('0x30'),function(_0x58d9f7,_0x36bf10,_0x3b9bbe){var _0x29121a=_0x58d9f7||_0x3b9bbe;if(_0x29121a){return handleError(_0x301b19,0x191,_0x29121a);}if(!_0x36bf10){return handleError(_0x301b19,0x194,{'message':_0x7b4c('0x31')});}else{var _0x5f1bd9={'payload':{'id':_0x36bf10['id'],'role':_0x36bf10['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5f1bd9)[_0x7b4c('0x11')](function(_0x118209){_0x301b19[_0x7b4c('0x32')]({'id':_0x36bf10['id'],'token':_0x118209,'statusCall':'','isAlreadyLogged':_0x36bf10[_0x7b4c('0x33')]});});}})(_0xf08f83,_0x301b19,_0x443277);};exports['forgot']=function(_0x471229,_0x3107d1,_0x3f90f7){if(!_0x471229['body']['email']){return handleError(_0x3107d1,0x1f4,{'message':_0x7b4c('0x34')});}var _0x34574c=rs[_0x7b4c('0x35')]();_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')]=_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')][_0x7b4c('0x38')]()['toLowerCase']();var _0x589000;return db['Setting'][_0x7b4c('0x8')]({'where':{'id':0x1},'attributes':[_0x7b4c('0x9'),_0x7b4c('0xa')],'raw':!![]})[_0x7b4c('0x11')](function(_0x41da3b){_0x589000=_0x41da3b;return db[_0x7b4c('0x39')][_0x7b4c('0x3a')]({'where':{'email':_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')]}});})[_0x7b4c('0x11')](function(_0x27215e){if(!_0x27215e){throw new Error(_0x7b4c('0x3b'));}if(_0x27215e[_0x7b4c('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x27215e[_0x7b4c('0x19')]){if(moment(_0x27215e[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x589000['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x27215e[_0x7b4c('0x19')]=![];_0x27215e[_0x7b4c('0xd')]=null;}}_0x27215e[_0x7b4c('0x3c')]=_0x34574c;_0x27215e[_0x7b4c('0x3d')]=Date['now']()+0x36ee80;return _0x27215e[_0x7b4c('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7b4c('0x3f')+_0x7b4c('0x40')+_0x471229[_0x7b4c('0x41')][_0x7b4c('0x1f')]+_0x7b4c('0x42')+_0x34574c+'\x0a\x0a'+_0x7b4c('0x43')});})[_0x7b4c('0x11')](function(){_0x3107d1[_0x7b4c('0x2c')](0xc8)[_0x7b4c('0x44')]({'message':_0x7b4c('0x45')});})[_0x7b4c('0x18')](function(_0x5bc9fe){return handleError(_0x3107d1,0x1f4,_0x5bc9fe);});};exports[_0x7b4c('0x46')]=function(_0x18bbc0,_0x29ff26,_0x249c2a){var _0x2240f3;return db[_0x7b4c('0x39')][_0x7b4c('0x3a')]({'where':{'resetPasswordToken':_0x18bbc0[_0x7b4c('0x47')][_0x7b4c('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x7b4c('0x11')](function(_0x4b6126){_0x2240f3=_0x4b6126;if(!_0x2240f3){throw new Error(_0x7b4c('0x49'));}return db['Setting'][_0x7b4c('0x8')]({'attributes':['id',_0x7b4c('0x4a')]});})[_0x7b4c('0x11')](function(_0x1f9157){return checkPasswordPattern(_0x1f9157,_0x18bbc0[_0x7b4c('0x36')]['password'],_0x1f9157[_0x7b4c('0x4a')]);})[_0x7b4c('0x11')](function(){_0x2240f3[_0x7b4c('0xc')]=_0x18bbc0[_0x7b4c('0x36')]['password'];_0x2240f3[_0x7b4c('0x3c')]=null;_0x2240f3[_0x7b4c('0x3d')]=null;return _0x2240f3[_0x7b4c('0x3e')]();})[_0x7b4c('0x11')](function(){_0x29ff26[_0x7b4c('0x2c')](0xc8)[_0x7b4c('0x44')]({'message':_0x7b4c('0x4b')});})[_0x7b4c('0x18')](function(_0x4f4ee6){return handleError(_0x29ff26,0x1f4,_0x4f4ee6);});};passport[_0x7b4c('0x4c')](new LocalStrategy({'usernameField':'name','passwordField':_0x7b4c('0xc')},function(_0x127a2f,_0x1fe74e,_0x1ab2bb){return localAuthenticate(db[_0x7b4c('0x39')],_0x127a2f,_0x1fe74e,_0x1ab2bb);})); \ No newline at end of file +var _0x5f98=['catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','role','signToken','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','status','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','password','salt','disabled','blocked','blockedAt','user','agent','name','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','then','getLicense'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5f98,0x164));var _0x85f9=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5f98[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x85f9('0x0'));var passport=require('passport');var LocalStrategy=require(_0x85f9('0x1'))['Strategy'];var jayson=require(_0x85f9('0x2'));var _=require(_0x85f9('0x3'));var rs=require('randomstring');var moment=require(_0x85f9('0x4'));var db=require(_0x85f9('0x5'))['db'];var authService=require(_0x85f9('0x6'));var utils=require('../../config/utils');var client=jayson[_0x85f9('0x7')][_0x85f9('0x8')]({'port':0x232b});function localAuthenticate(_0x297538,_0x19f258,_0x53af03,_0x108712){var _0x2a36a2,_0x5cc552;return db[_0x85f9('0x9')][_0x85f9('0xa')]({'where':{'id':0x1},'attributes':[_0x85f9('0xb'),_0x85f9('0xc')],'raw':!![]})['then'](function(_0x13c3b2){_0x2a36a2=_0x13c3b2;return _0x297538[_0x85f9('0xa')]({'attributes':['id','name',_0x85f9('0xd'),_0x85f9('0xe'),'role',_0x85f9('0xf'),_0x85f9('0x10'),_0x85f9('0x11'),'loginAttempts'],'where':{'name':_0x19f258,'role':{'$or':['admin',_0x85f9('0x12'),_0x85f9('0x13')]}}});})['then'](function(_0x106c68){if(!_0x106c68||_0x106c68&&_0x106c68[_0x85f9('0x14')]!==_0x19f258){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5cc552=_0x106c68;return _0x5cc552;}})['then'](function(){_0x5cc552[_0x85f9('0x15')](_0x53af03,function(_0x23ad33,_0x547f86){var _0x1d1ecd=_0x5cc552[_0x85f9('0x16')]+0x1;if(_0x23ad33){return _0x108712(_0x23ad33);}else if(!_0x547f86){if(_0x5cc552[_0x85f9('0xf')]){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else if(_0x2a36a2[_0x85f9('0xb')]>0x0){if(_0x5cc552['blocked']){if(_0x2a36a2[_0x85f9('0xc')]>0x0){if(moment(_0x5cc552[_0x85f9('0x11')])[_0x85f9('0x18')](_0x2a36a2[_0x85f9('0xc')],_0x85f9('0x19'))>moment()){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else{return utils[_0x85f9('0x1a')](_0x5cc552,_0x1d1ecd,![],null)[_0x85f9('0x1b')](function(){return _0x108712(null,![],{'message':_0x85f9('0x17')});});}}else{return _0x108712(null,![],{'message':_0x85f9('0x17')});}}else{if(_0x1d1ecd>=_0x2a36a2['allowedLoginAttempts']){return utils['clearBlockUser'](_0x5cc552,0x0,!![],moment())[_0x85f9('0x1b')](function(){return _0x108712(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x85f9('0x1a')](_0x5cc552,_0x1d1ecd,![],null)[_0x85f9('0x1b')](function(){return _0x108712(null,![],{'message':_0x85f9('0x17')});});}}}else{return _0x108712(null,![],{'message':_0x85f9('0x17')});}}else{if(_0x5cc552[_0x85f9('0xf')]){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else if(_0x2a36a2[_0x85f9('0xb')]>0x0){if(_0x5cc552['blocked']){if(_0x2a36a2[_0x85f9('0xc')]>0x0){if(moment(_0x5cc552[_0x85f9('0x11')])[_0x85f9('0x18')](_0x2a36a2[_0x85f9('0xc')],_0x85f9('0x19'))>moment()){return _0x108712(null,![],{'message':_0x85f9('0x17')});}else{return utils[_0x85f9('0x1a')](_0x5cc552,0x0,![],null)[_0x85f9('0x1b')](function(){return utils[_0x85f9('0x1c')](_0x5cc552);})[_0x85f9('0x1b')](function(){return _0x108712(null,_0x5cc552);});}}else{return _0x108712(null,![],{'message':_0x85f9('0x17')});}}else{return utils['clearBlockUser'](_0x5cc552,0x0,![],null)[_0x85f9('0x1b')](function(){return utils['getLicense'](_0x5cc552);})[_0x85f9('0x1b')](function(){return _0x108712(null,_0x5cc552);})[_0x85f9('0x1d')](function(_0x22ceff){return _0x108712(null,![],_0x22ceff);});}}else{if(_0x5cc552[_0x85f9('0x10')]){return _0x108712(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x5cc552)['then'](function(){return _0x108712(null,_0x5cc552);});}}}});})[_0x85f9('0x1d')](function(_0x49e9a3){return _0x108712(null,![],_0x49e9a3);});}function sendServiceMail(_0x45b0f2){return db[_0x85f9('0x1e')][_0x85f9('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x85f9('0x14'),_0x85f9('0x20')],'include':[{'model':db[_0x85f9('0x21')],'as':_0x85f9('0x22')}]})[_0x85f9('0x1b')](function(_0x132526){if(!_0x132526){throw new Error(_0x85f9('0x23'));}var _0x3df7df={'tls':{'rejectUnauthorized':![]}};if(_0x132526[_0x85f9('0x22')][_0x85f9('0x24')]){_0x3df7df[_0x85f9('0x24')]=_0x132526[_0x85f9('0x22')][_0x85f9('0x24')];}else{_0x3df7df[_0x85f9('0x25')]=_0x132526[_0x85f9('0x22')]['host'];_0x3df7df[_0x85f9('0x26')]=_0x132526[_0x85f9('0x22')][_0x85f9('0x26')];_0x3df7df[_0x85f9('0x27')]=_0x132526[_0x85f9('0x22')]['secure'];}if(_0x132526[_0x85f9('0x22')][_0x85f9('0x28')]){_0x3df7df['auth']={'user':_0x132526[_0x85f9('0x22')][_0x85f9('0x12')],'pass':_0x132526['Smtp'][_0x85f9('0x29')]};}var _0x39f6b1={'account':_0x3df7df,'message':_[_0x85f9('0x2a')]({'from':util[_0x85f9('0x2b')](_0x85f9('0x2c'),_0x132526['name'],_0x132526[_0x85f9('0x20')]||_0x132526[_0x85f9('0x22')][_0x85f9('0x12')])},_0x45b0f2)};return client['request'](_0x85f9('0x2d'),_0x39f6b1);})[_0x85f9('0x1b')](function(_0x2f789b){if(_0x2f789b[_0x85f9('0x2e')]){throw new Error(util[_0x85f9('0x2b')](_0x85f9('0x2f'),_0x2f789b[_0x85f9('0x2e')][_0x85f9('0x30')]||JSON[_0x85f9('0x31')](_0x2f789b[_0x85f9('0x2e')])));}return!![];});}function handleError(_0x1d9bdb,_0x348bcf,_0xfd7523){return _0x1d9bdb['status'](_0x348bcf||0x1f4)[_0x85f9('0x32')]({'message':_0xfd7523?_0xfd7523[_0x85f9('0x30')]||_0xfd7523:''});}function checkPasswordPattern(_0x3c5f16,_0x2a0746,_0x1ec9ab){if(_0x1ec9ab){var _0x5524cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5524cb['test'](_0x2a0746)){return _0x3c5f16;}else{throw new Error(_0x85f9('0x33'));}}else{return _0x3c5f16;}}exports[_0x85f9('0x34')]=function(_0x176a76,_0x470c80,_0x1c636c){passport[_0x85f9('0x15')](_0x85f9('0x35'),function(_0x29fd4d,_0xe988a4,_0x302169){var _0x38ca6a=_0x29fd4d||_0x302169;if(_0x38ca6a){return handleError(_0x470c80,0x191,_0x38ca6a);}if(!_0xe988a4){return handleError(_0x470c80,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x24bfdb={'payload':{'id':_0xe988a4['id'],'role':_0xe988a4[_0x85f9('0x36')]},'options':{'expiresIn':0x15180}};return authService[_0x85f9('0x37')](_0x24bfdb)[_0x85f9('0x1b')](function(_0x117a23){_0x470c80['json']({'id':_0xe988a4['id'],'token':_0x117a23,'statusCall':'','isAlreadyLogged':_0xe988a4['online']});});}})(_0x176a76,_0x470c80,_0x1c636c);};exports[_0x85f9('0x38')]=function(_0xd4d78f,_0x1b5a9a,_0x4b92ba){if(!_0xd4d78f['body'][_0x85f9('0x20')]){return handleError(_0x1b5a9a,0x1f4,{'message':_0x85f9('0x39')});}var _0x4870b2=rs[_0x85f9('0x3a')]();_0xd4d78f[_0x85f9('0x3b')]['email']=_0xd4d78f['body'][_0x85f9('0x20')][_0x85f9('0x3c')]()[_0x85f9('0x3d')]();var _0x3c7a45;return db[_0x85f9('0x9')][_0x85f9('0xa')]({'where':{'id':0x1},'attributes':[_0x85f9('0xb'),_0x85f9('0xc')],'raw':!![]})[_0x85f9('0x1b')](function(_0x297750){_0x3c7a45=_0x297750;return db[_0x85f9('0x3e')][_0x85f9('0x1f')]({'where':{'email':_0xd4d78f[_0x85f9('0x3b')][_0x85f9('0x20')]}});})[_0x85f9('0x1b')](function(_0x250b4f){if(!_0x250b4f){throw new Error(_0x85f9('0x3f'));}if(_0x250b4f['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x250b4f['blocked']){if(moment(_0x250b4f[_0x85f9('0x11')])['add'](_0x3c7a45[_0x85f9('0xc')],_0x85f9('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x250b4f['blocked']=![];_0x250b4f['blockedAt']=null;}}_0x250b4f[_0x85f9('0x40')]=_0x4870b2;_0x250b4f['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x250b4f[_0x85f9('0x41')]();})[_0x85f9('0x1b')](function(){return sendServiceMail({'to':_0xd4d78f[_0x85f9('0x3b')]['email'],'subject':_0x85f9('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x85f9('0x43')+'http://'+_0xd4d78f[_0x85f9('0x44')][_0x85f9('0x25')]+_0x85f9('0x45')+_0x4870b2+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x85f9('0x1b')](function(){_0x1b5a9a[_0x85f9('0x46')](0xc8)[_0x85f9('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0x85f9('0x1d')](function(_0x2213b1){return handleError(_0x1b5a9a,0x1f4,_0x2213b1);});};exports['reset']=function(_0x4ac97c,_0x31afd9,_0x191e6c){var _0x510fae;return db[_0x85f9('0x3e')][_0x85f9('0x1f')]({'where':{'resetPasswordToken':_0x4ac97c[_0x85f9('0x47')][_0x85f9('0x48')],'resetPasswordExpires':{'$gt':Date[_0x85f9('0x49')]()}}})[_0x85f9('0x1b')](function(_0x78a7e3){_0x510fae=_0x78a7e3;if(!_0x510fae){throw new Error(_0x85f9('0x4a'));}return db['Setting'][_0x85f9('0xa')]({'attributes':['id','securePassword']});})[_0x85f9('0x1b')](function(_0x4b58e6){return checkPasswordPattern(_0x4b58e6,_0x4ac97c[_0x85f9('0x3b')][_0x85f9('0xd')],_0x4b58e6['securePassword']);})[_0x85f9('0x1b')](function(){_0x510fae[_0x85f9('0xd')]=_0x4ac97c['body'][_0x85f9('0xd')];_0x510fae['resetPasswordToken']=null;_0x510fae['resetPasswordExpires']=null;return _0x510fae[_0x85f9('0x41')]();})[_0x85f9('0x1b')](function(){_0x31afd9['status'](0xc8)[_0x85f9('0x32')]({'message':_0x85f9('0x4b')});})[_0x85f9('0x1d')](function(_0x40a26e){return handleError(_0x31afd9,0x1f4,_0x40a26e);});};passport[_0x85f9('0x4c')](new LocalStrategy({'usernameField':_0x85f9('0x14'),'passwordField':_0x85f9('0xd')},function(_0x3484be,_0x16e4b8,_0x57377c){return localAuthenticate(db[_0x85f9('0x3e')],_0x3484be,_0x16e4b8,_0x57377c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3f02cfc..252a3c9 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 _0xbbc3=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x514c5e,_0x8c0875){var _0x34c3e6=function(_0x3d78d2){while(--_0x3d78d2){_0x514c5e['push'](_0x514c5e['shift']());}};_0x34c3e6(++_0x8c0875);}(_0xbbc3,0x17d));var _0x3bbc=function(_0x3cb2b7,_0x2338b6){_0x3cb2b7=_0x3cb2b7-0x0;var _0xac954a=_0xbbc3[_0x3cb2b7];return _0xac954a;};'use strict';var express=require(_0x3bbc('0x0'));var router=express[_0x3bbc('0x1')]();var controller=require(_0x3bbc('0x2'));router[_0x3bbc('0x3')]('/',controller[_0x3bbc('0x4')]);router['post']('/forgot',controller[_0x3bbc('0x5')]);router[_0x3bbc('0x3')](_0x3bbc('0x6'),controller[_0x3bbc('0x7')]);module[_0x3bbc('0x8')]=router; \ No newline at end of file +var _0x2af4=['reset','exports','Router','./authLocal.controller','post','login','forgot','/reset/:token'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x2af4,0x9a));var _0x42af=function(_0x3d4c02,_0x3460fe){_0x3d4c02=_0x3d4c02-0x0;var _0x2c9a56=_0x2af4[_0x3d4c02];return _0x2c9a56;};'use strict';var express=require('express');var router=express[_0x42af('0x0')]();var controller=require(_0x42af('0x1'));router[_0x42af('0x2')]('/',controller[_0x42af('0x3')]);router['post']('/forgot',controller[_0x42af('0x4')]);router[_0x42af('0x2')](_0x42af('0x5'),controller[_0x42af('0x6')]);module[_0x42af('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 278be83..07caaf4 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 _0xf0e3=['INTEGER','sequelize','STRING'];(function(_0x1f3a44,_0xffe53f){var _0x4339df=function(_0x151bbe){while(--_0x151bbe){_0x1f3a44['push'](_0x1f3a44['shift']());}};_0x4339df(++_0xffe53f);}(_0xf0e3,0x6a));var _0x3f0e=function(_0x1876a7,_0x47ff27){_0x1876a7=_0x1876a7-0x0;var _0x3f5528=_0xf0e3[_0x1876a7];return _0x3f5528;};'use strict';var Sequelize=require(_0x3f0e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f0e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x3f0e('0x1')]},'description':{'type':Sequelize[_0x3f0e('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3f0e('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x26a8=['STRING','INTEGER','sequelize','exports'];(function(_0x26c272,_0x4de7a0){var _0xbc0b9c=function(_0x4d1edd){while(--_0x4d1edd){_0x26c272['push'](_0x26c272['shift']());}};_0xbc0b9c(++_0x4de7a0);}(_0x26a8,0xa6));var _0x826a=function(_0x28d745,_0x16f88b){_0x28d745=_0x28d745-0x0;var _0x14d5b3=_0x26a8[_0x28d745];return _0x14d5b3;};'use strict';var Sequelize=require(_0x826a('0x0'));module[_0x826a('0x1')]={'name':{'type':Sequelize[_0x826a('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x826a('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index eda81be..87f9d2e 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 _0x1000=['include','findAll','catch','keys','find','create','body','params','addConditions','Condition','ids','findOne','length','sort','getConditions','addActions','Action','omit','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x1b6195,_0x1d6d41){var _0x5f0498=function(_0x4ff152){while(--_0x4ff152){_0x1b6195['push'](_0x1b6195['shift']());}};_0x5f0498(++_0x1d6d41);}(_0x1000,0x1c1));var _0x0100=function(_0x4c82af,_0x362c51){_0x4c82af=_0x4c82af-0x0;var _0x21d4ec=_0x1000[_0x4c82af];return _0x21d4ec;};'use strict';var pdf=require(_0x0100('0x0'));var emlformat=require(_0x0100('0x1'));var rimraf=require(_0x0100('0x2'));var zipdir=require(_0x0100('0x3'));var jsonpatch=require(_0x0100('0x4'));var rp=require(_0x0100('0x5'));var moment=require(_0x0100('0x6'));var BPromise=require(_0x0100('0x7'));var Mustache=require(_0x0100('0x8'));var util=require(_0x0100('0x9'));var path=require(_0x0100('0xa'));var sox=require(_0x0100('0xb'));var csv=require('to-csv');var ejs=require(_0x0100('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0100('0xd'));var jsforce=require(_0x0100('0xe'));var deskjs=require(_0x0100('0xf'));var toCsv=require(_0x0100('0x10'));var querystring=require(_0x0100('0x11'));var Papa=require(_0x0100('0x12'));var Redis=require(_0x0100('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0100('0x14'));var as=require(_0x0100('0x15'));var hardwareService=require(_0x0100('0x16'));var logger=require(_0x0100('0x17'))('api');var utils=require(_0x0100('0x18'));var config=require(_0x0100('0x19'));var db=require(_0x0100('0x1a'))['db'];function respondWithStatusCode(_0x50d0c6,_0x3eb98d){_0x3eb98d=_0x3eb98d||0xcc;return function(_0xad4a22){if(_0xad4a22){return _0x50d0c6['sendStatus'](_0x3eb98d);}return _0x50d0c6[_0x0100('0x1b')](_0x3eb98d)[_0x0100('0x1c')]();};}function respondWithResult(_0x5b590,_0xa5ae46){_0xa5ae46=_0xa5ae46||0xc8;return function(_0x2c042b){if(_0x2c042b){return _0x5b590[_0x0100('0x1b')](_0xa5ae46)[_0x0100('0x1d')](_0x2c042b);}};}function respondWithFilteredResult(_0x1abcb7,_0x97360d){return function(_0x5a2be0){if(_0x5a2be0){var _0x1b5339=_0x5a2be0[_0x0100('0x1e')],_0xfa133=_0x97360d[_0x0100('0x1f')],_0x560c76=_0x97360d[_0x0100('0x1f')]+_0x97360d[_0x0100('0x20')],_0x2305a0;if(_0x560c76>=_0x1b5339){_0x560c76=_0x1b5339;_0x2305a0=0xc8;}else{_0x2305a0=0xce;}_0x1abcb7[_0x0100('0x1b')](_0x2305a0);return _0x1abcb7['set'](_0x0100('0x21'),_0xfa133+'-'+_0x560c76+'/'+_0x1b5339)[_0x0100('0x1d')](_0x5a2be0);}return null;};}function patchUpdates(_0x163e89){return function(_0x22bb91){try{jsonpatch[_0x0100('0x22')](_0x22bb91,_0x163e89,!![]);}catch(_0x222856){return BPromise[_0x0100('0x23')](_0x222856);}return _0x22bb91[_0x0100('0x24')]();};}function saveUpdates(_0x4bd1f0,_0x318246){return function(_0x19d42e){if(_0x19d42e){return _0x19d42e[_0x0100('0x25')](_0x4bd1f0)[_0x0100('0x26')](function(_0x101b00){return _0x101b00;});}return null;};}function removeEntity(_0x5efc06,_0x5ef6ba){return function(_0x2a20f4){if(_0x2a20f4){return _0x2a20f4[_0x0100('0x27')]()[_0x0100('0x26')](function(){_0x5efc06[_0x0100('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a15c,_0x50c8ff){return function(_0x53e103){if(!_0x53e103){_0x56a15c[_0x0100('0x28')](0x194);}return _0x53e103;};}function handleError(_0x5f5512,_0xc5d5a4){_0xc5d5a4=_0xc5d5a4||0x1f4;return function(_0x38e29e){logger[_0x0100('0x29')](_0x38e29e[_0x0100('0x2a')]);if(_0x38e29e[_0x0100('0x2b')]){delete _0x38e29e[_0x0100('0x2b')];}_0x5f5512['status'](_0xc5d5a4)[_0x0100('0x2c')](_0x38e29e);};}exports[_0x0100('0x2d')]=function(_0x4c0de7,_0x3beda9){var _0xc4f511={},_0x1899c6={},_0x50ad97={'count':0x0,'rows':[]};var _0x4a6876=_[_0x0100('0x2e')](db[_0x0100('0x2f')][_0x0100('0x30')],function(_0x1f89a9){return{'name':_0x1f89a9['fieldName'],'type':_0x1f89a9[_0x0100('0x31')][_0x0100('0x32')]};});_0x1899c6[_0x0100('0x33')]=_[_0x0100('0x2e')](_0x4a6876,'name');_0x1899c6['query']=_['keys'](_0x4c0de7[_0x0100('0x34')]);_0x1899c6[_0x0100('0x35')]=_['intersection'](_0x1899c6[_0x0100('0x33')],_0x1899c6['query']);_0xc4f511['attributes']=_[_0x0100('0x36')](_0x1899c6[_0x0100('0x33')],qs[_0x0100('0x37')](_0x4c0de7[_0x0100('0x34')]['fields']));_0xc4f511[_0x0100('0x38')]=_0xc4f511[_0x0100('0x38')]['length']?_0xc4f511['attributes']:_0x1899c6['model'];if(!_0x4c0de7[_0x0100('0x34')][_0x0100('0x39')](_0x0100('0x3a'))){_0xc4f511['limit']=qs[_0x0100('0x20')](_0x4c0de7['query'][_0x0100('0x20')]);_0xc4f511[_0x0100('0x1f')]=qs[_0x0100('0x1f')](_0x4c0de7[_0x0100('0x34')][_0x0100('0x1f')]);}_0xc4f511[_0x0100('0x3b')]=qs['sort'](_0x4c0de7[_0x0100('0x34')]['sort']);_0xc4f511[_0x0100('0x3c')]=qs['filters'](_[_0x0100('0x3d')](_0x4c0de7[_0x0100('0x34')],_0x1899c6[_0x0100('0x35')]),_0x4a6876);if(_0x4c0de7[_0x0100('0x34')][_0x0100('0x3e')]){_0xc4f511[_0x0100('0x3c')]=_[_0x0100('0x3f')](_0xc4f511[_0x0100('0x3c')],{'$or':_['map'](_0x4a6876,function(_0x35a256){if(_0x35a256[_0x0100('0x31')]!==_0x0100('0x40')){var _0x11e849={};_0x11e849[_0x35a256['name']]={'$like':'%'+_0x4c0de7[_0x0100('0x34')][_0x0100('0x3e')]+'%'};return _0x11e849;}})});}_0xc4f511=_[_0x0100('0x3f')]({},_0xc4f511,_0x4c0de7[_0x0100('0x41')]);var _0xcf18f6={'where':_0xc4f511[_0x0100('0x3c')]};return db[_0x0100('0x2f')]['count'](_0xcf18f6)['then'](function(_0x557dec){_0x50ad97[_0x0100('0x1e')]=_0x557dec;if(_0x4c0de7[_0x0100('0x34')][_0x0100('0x42')]){_0xc4f511[_0x0100('0x43')]=[{'all':!![]}];}return db[_0x0100('0x2f')][_0x0100('0x44')](_0xc4f511);})['then'](function(_0x4734b6){_0x50ad97['rows']=_0x4734b6;return _0x50ad97;})[_0x0100('0x26')](respondWithFilteredResult(_0x3beda9,_0xc4f511))[_0x0100('0x45')](handleError(_0x3beda9,null));};exports['show']=function(_0x37505f,_0x44740d){var _0x370b4f={'raw':![],'where':{'id':_0x37505f['params']['id']}},_0x5362c0={};_0x5362c0[_0x0100('0x33')]=_['keys'](db[_0x0100('0x2f')]['rawAttributes']);_0x5362c0[_0x0100('0x34')]=_[_0x0100('0x46')](_0x37505f['query']);_0x5362c0[_0x0100('0x35')]=_[_0x0100('0x36')](_0x5362c0['model'],_0x5362c0[_0x0100('0x34')]);_0x370b4f['attributes']=_['intersection'](_0x5362c0[_0x0100('0x33')],qs['fields'](_0x37505f['query']['fields']));_0x370b4f[_0x0100('0x38')]=_0x370b4f['attributes']['length']?_0x370b4f[_0x0100('0x38')]:_0x5362c0['model'];if(_0x37505f[_0x0100('0x34')][_0x0100('0x42')]){_0x370b4f['include']=[{'all':!![]}];}_0x370b4f=_[_0x0100('0x3f')]({},_0x370b4f,_0x37505f['options']);return db[_0x0100('0x2f')][_0x0100('0x47')](_0x370b4f)[_0x0100('0x26')](handleEntityNotFound(_0x44740d,null))[_0x0100('0x26')](respondWithResult(_0x44740d,null))[_0x0100('0x45')](handleError(_0x44740d,null));};exports[_0x0100('0x48')]=function(_0x5df47d,_0x44fc72){return db[_0x0100('0x2f')][_0x0100('0x48')](_0x5df47d[_0x0100('0x49')],{})[_0x0100('0x26')](respondWithResult(_0x44fc72,0xc9))[_0x0100('0x45')](handleError(_0x44fc72,null));};exports[_0x0100('0x25')]=function(_0x2e140f,_0xf284f4){if(_0x2e140f[_0x0100('0x49')]['id']){delete _0x2e140f[_0x0100('0x49')]['id'];}return db[_0x0100('0x2f')]['find']({'where':{'id':_0x2e140f[_0x0100('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf284f4,null))['then'](saveUpdates(_0x2e140f[_0x0100('0x49')],null))[_0x0100('0x26')](respondWithResult(_0xf284f4,null))['catch'](handleError(_0xf284f4,null));};exports['destroy']=function(_0x2416aa,_0x3e34f1){return db[_0x0100('0x2f')]['find']({'where':{'id':_0x2416aa[_0x0100('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e34f1,null))[_0x0100('0x26')](removeEntity(_0x3e34f1,null))[_0x0100('0x45')](handleError(_0x3e34f1,null));};exports[_0x0100('0x4b')]=function(_0x338e17,_0x52cbc7,_0x45e43c){return db[_0x0100('0x4c')][_0x0100('0x47')]({'where':{'id':_0x338e17['params']['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x52cbc7,null))[_0x0100('0x26')](function(_0x1c4c9a){if(_0x1c4c9a){return _0x1c4c9a[_0x0100('0x4b')](_0x338e17[_0x0100('0x49')][_0x0100('0x4d')],_['omit'](_0x338e17['body'],['ids','id'])||{});}})[_0x0100('0x26')](respondWithResult(_0x52cbc7,null))[_0x0100('0x45')](handleError(_0x52cbc7,null));};exports['getConditions']=function(_0xa07366,_0x3a448c,_0x5ae39b){var _0x4730d2={};var _0x120960={};var _0x3028bb;var _0x6314ac;return db['Automation'][_0x0100('0x4e')]({'where':{'id':_0xa07366[_0x0100('0x4a')]['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x3a448c,null))[_0x0100('0x26')](function(_0x54d526){if(_0x54d526){_0x3028bb=_0x54d526;_0x120960['model']=_[_0x0100('0x46')](db[_0x0100('0x4c')][_0x0100('0x30')]);_0x120960['query']=_[_0x0100('0x46')](_0xa07366[_0x0100('0x34')]);_0x120960[_0x0100('0x35')]=_[_0x0100('0x36')](_0x120960['model'],_0x120960[_0x0100('0x34')]);_0x4730d2[_0x0100('0x38')]=_[_0x0100('0x36')](_0x120960[_0x0100('0x33')],qs['fields'](_0xa07366['query']['fields']));_0x4730d2['attributes']=_0x4730d2[_0x0100('0x38')][_0x0100('0x4f')]?_0x4730d2['attributes']:_0x120960[_0x0100('0x33')];_0x4730d2[_0x0100('0x3b')]=qs[_0x0100('0x50')](_0xa07366[_0x0100('0x34')]['sort']);_0x4730d2['where']=qs['filters'](_['pick'](_0xa07366[_0x0100('0x34')],_0x120960[_0x0100('0x35')]));if(_0xa07366['query'][_0x0100('0x3e')]){_0x4730d2[_0x0100('0x3c')]=_[_0x0100('0x3f')](_0x4730d2[_0x0100('0x3c')],{'$or':_['map'](_0x4730d2[_0x0100('0x38')],function(_0x16f8c0){var _0x4a3a28={};_0x4a3a28[_0x16f8c0]={'$like':'%'+_0xa07366[_0x0100('0x34')][_0x0100('0x3e')]+'%'};return _0x4a3a28;})});}_0x4730d2=_['merge']({},_0x4730d2,_0xa07366['options']);return _0x3028bb[_0x0100('0x51')](_0x4730d2);}})[_0x0100('0x26')](function(_0x110dda){if(_0x110dda){_0x6314ac=_0x110dda[_0x0100('0x4f')];if(!_0xa07366[_0x0100('0x34')][_0x0100('0x39')](_0x0100('0x3a'))){_0x4730d2[_0x0100('0x20')]=qs['limit'](_0xa07366[_0x0100('0x34')][_0x0100('0x20')]);_0x4730d2[_0x0100('0x1f')]=qs[_0x0100('0x1f')](_0xa07366[_0x0100('0x34')]['offset']);}return _0x3028bb[_0x0100('0x51')](_0x4730d2);}})['then'](function(_0x4ea365){if(_0x4ea365){return _0x4ea365?{'count':_0x6314ac,'rows':_0x4ea365}:null;}})['then'](respondWithResult(_0x3a448c,null))[_0x0100('0x45')](handleError(_0x3a448c,null));};exports[_0x0100('0x52')]=function(_0x361f99,_0x2e27da,_0x3e29bb){return db[_0x0100('0x53')][_0x0100('0x47')]({'where':{'id':_0x361f99[_0x0100('0x4a')]['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x2e27da,null))['then'](function(_0x406ae2){if(_0x406ae2){return _0x406ae2['addActions'](_0x361f99[_0x0100('0x49')][_0x0100('0x4d')],_[_0x0100('0x54')](_0x361f99[_0x0100('0x49')],[_0x0100('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x2e27da,null))[_0x0100('0x45')](handleError(_0x2e27da,null));};exports[_0x0100('0x55')]=function(_0x315edb,_0x17c7ff,_0x181f44){var _0x3b818a={};var _0x19b21f={};var _0x456e61;var _0x1711a6;return db['Automation'][_0x0100('0x4e')]({'where':{'id':_0x315edb['params']['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x17c7ff,null))[_0x0100('0x26')](function(_0x4f098c){if(_0x4f098c){_0x456e61=_0x4f098c;_0x19b21f[_0x0100('0x33')]=_[_0x0100('0x46')](db[_0x0100('0x53')]['rawAttributes']);_0x19b21f['query']=_[_0x0100('0x46')](_0x315edb[_0x0100('0x34')]);_0x19b21f[_0x0100('0x35')]=_[_0x0100('0x36')](_0x19b21f[_0x0100('0x33')],_0x19b21f[_0x0100('0x34')]);_0x3b818a[_0x0100('0x38')]=_[_0x0100('0x36')](_0x19b21f[_0x0100('0x33')],qs['fields'](_0x315edb[_0x0100('0x34')][_0x0100('0x37')]));_0x3b818a[_0x0100('0x38')]=_0x3b818a[_0x0100('0x38')][_0x0100('0x4f')]?_0x3b818a[_0x0100('0x38')]:_0x19b21f[_0x0100('0x33')];_0x3b818a[_0x0100('0x3b')]=qs['sort'](_0x315edb['query'][_0x0100('0x50')]);_0x3b818a[_0x0100('0x3c')]=qs[_0x0100('0x35')](_[_0x0100('0x3d')](_0x315edb[_0x0100('0x34')],_0x19b21f['filters']));if(_0x315edb[_0x0100('0x34')][_0x0100('0x3e')]){_0x3b818a[_0x0100('0x3c')]=_[_0x0100('0x3f')](_0x3b818a[_0x0100('0x3c')],{'$or':_[_0x0100('0x2e')](_0x3b818a[_0x0100('0x38')],function(_0x581ce9){var _0x38d489={};_0x38d489[_0x581ce9]={'$like':'%'+_0x315edb['query'][_0x0100('0x3e')]+'%'};return _0x38d489;})});}_0x3b818a=_[_0x0100('0x3f')]({},_0x3b818a,_0x315edb[_0x0100('0x41')]);return _0x456e61[_0x0100('0x55')](_0x3b818a);}})[_0x0100('0x26')](function(_0xd40579){if(_0xd40579){_0x1711a6=_0xd40579['length'];if(!_0x315edb[_0x0100('0x34')][_0x0100('0x39')](_0x0100('0x3a'))){_0x3b818a['limit']=qs[_0x0100('0x20')](_0x315edb[_0x0100('0x34')][_0x0100('0x20')]);_0x3b818a[_0x0100('0x1f')]=qs[_0x0100('0x1f')](_0x315edb[_0x0100('0x34')][_0x0100('0x1f')]);}return _0x456e61[_0x0100('0x55')](_0x3b818a);}})[_0x0100('0x26')](function(_0x559864){if(_0x559864){return _0x559864?{'count':_0x1711a6,'rows':_0x559864}:null;}})['then'](respondWithResult(_0x17c7ff,null))[_0x0100('0x45')](handleError(_0x17c7ff,null));}; \ No newline at end of file +var _0x4cbb=['limit','set','reject','then','error','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','destroy','addConditions','Condition','omit','getConditions','pick','Action','addActions','ids','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x14ec9d,_0x45d283){var _0x3636df=function(_0x472568){while(--_0x472568){_0x14ec9d['push'](_0x14ec9d['shift']());}};_0x3636df(++_0x45d283);}(_0x4cbb,0x180));var _0xb4cb=function(_0x118439,_0x1907d9){_0x118439=_0x118439-0x0;var _0x209b67=_0x4cbb[_0x118439];return _0x209b67;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb4cb('0x0'));var rimraf=require(_0xb4cb('0x1'));var zipdir=require(_0xb4cb('0x2'));var jsonpatch=require(_0xb4cb('0x3'));var rp=require(_0xb4cb('0x4'));var moment=require(_0xb4cb('0x5'));var BPromise=require(_0xb4cb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb4cb('0x7'));var sox=require(_0xb4cb('0x8'));var csv=require('to-csv');var ejs=require(_0xb4cb('0x9'));var fs=require('fs');var _=require(_0xb4cb('0xa'));var squel=require(_0xb4cb('0xb'));var crypto=require(_0xb4cb('0xc'));var jsforce=require(_0xb4cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb4cb('0xe'));var querystring=require(_0xb4cb('0xf'));var Papa=require(_0xb4cb('0x10'));var Redis=require(_0xb4cb('0x11'));var authService=require(_0xb4cb('0x12'));var qs=require(_0xb4cb('0x13'));var as=require(_0xb4cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb4cb('0x15'));var utils=require(_0xb4cb('0x16'));var config=require(_0xb4cb('0x17'));var db=require(_0xb4cb('0x18'))['db'];function respondWithStatusCode(_0xe833d4,_0xe1ea34){_0xe1ea34=_0xe1ea34||0xcc;return function(_0x127f17){if(_0x127f17){return _0xe833d4[_0xb4cb('0x19')](_0xe1ea34);}return _0xe833d4[_0xb4cb('0x1a')](_0xe1ea34)[_0xb4cb('0x1b')]();};}function respondWithResult(_0x3ca5af,_0x1e1002){_0x1e1002=_0x1e1002||0xc8;return function(_0x39e2c7){if(_0x39e2c7){return _0x3ca5af[_0xb4cb('0x1a')](_0x1e1002)[_0xb4cb('0x1c')](_0x39e2c7);}};}function respondWithFilteredResult(_0x1d04ce,_0x3a1d7e){return function(_0x13ae52){if(_0x13ae52){var _0x5248a4=_0x13ae52[_0xb4cb('0x1d')],_0x1caff7=_0x3a1d7e[_0xb4cb('0x1e')],_0x584d2d=_0x3a1d7e[_0xb4cb('0x1e')]+_0x3a1d7e[_0xb4cb('0x1f')],_0x204388;if(_0x584d2d>=_0x5248a4){_0x584d2d=_0x5248a4;_0x204388=0xc8;}else{_0x204388=0xce;}_0x1d04ce['status'](_0x204388);return _0x1d04ce[_0xb4cb('0x20')]('Content-Range',_0x1caff7+'-'+_0x584d2d+'/'+_0x5248a4)[_0xb4cb('0x1c')](_0x13ae52);}return null;};}function patchUpdates(_0x4a725b){return function(_0x1f758b){try{jsonpatch['apply'](_0x1f758b,_0x4a725b,!![]);}catch(_0x1f1a9e){return BPromise[_0xb4cb('0x21')](_0x1f1a9e);}return _0x1f758b['save']();};}function saveUpdates(_0x579698,_0x36adc6){return function(_0x59676e){if(_0x59676e){return _0x59676e['update'](_0x579698)[_0xb4cb('0x22')](function(_0x12329e){return _0x12329e;});}return null;};}function removeEntity(_0x545f23,_0x1e82c8){return function(_0x2754dd){if(_0x2754dd){return _0x2754dd['destroy']()['then'](function(){_0x545f23[_0xb4cb('0x1a')](0xcc)[_0xb4cb('0x1b')]();});}};}function handleEntityNotFound(_0x3ef486,_0x4358bc){return function(_0x58d6d1){if(!_0x58d6d1){_0x3ef486[_0xb4cb('0x19')](0x194);}return _0x58d6d1;};}function handleError(_0xc118c8,_0x3599f1){_0x3599f1=_0x3599f1||0x1f4;return function(_0x5c6dce){logger[_0xb4cb('0x23')](_0x5c6dce['stack']);if(_0x5c6dce[_0xb4cb('0x24')]){delete _0x5c6dce['name'];}_0xc118c8['status'](_0x3599f1)[_0xb4cb('0x25')](_0x5c6dce);};}exports['index']=function(_0xbaee57,_0xa3fa28){var _0x531df5={},_0x280f7f={},_0x175df8={'count':0x0,'rows':[]};var _0x20ed75=_[_0xb4cb('0x26')](db['Automation']['rawAttributes'],function(_0x23519c){return{'name':_0x23519c[_0xb4cb('0x27')],'type':_0x23519c[_0xb4cb('0x28')][_0xb4cb('0x29')]};});_0x280f7f[_0xb4cb('0x2a')]=_[_0xb4cb('0x26')](_0x20ed75,'name');_0x280f7f[_0xb4cb('0x2b')]=_['keys'](_0xbaee57[_0xb4cb('0x2b')]);_0x280f7f[_0xb4cb('0x2c')]=_[_0xb4cb('0x2d')](_0x280f7f['model'],_0x280f7f[_0xb4cb('0x2b')]);_0x531df5[_0xb4cb('0x2e')]=_[_0xb4cb('0x2d')](_0x280f7f[_0xb4cb('0x2a')],qs[_0xb4cb('0x2f')](_0xbaee57[_0xb4cb('0x2b')][_0xb4cb('0x2f')]));_0x531df5[_0xb4cb('0x2e')]=_0x531df5['attributes'][_0xb4cb('0x30')]?_0x531df5[_0xb4cb('0x2e')]:_0x280f7f[_0xb4cb('0x2a')];if(!_0xbaee57[_0xb4cb('0x2b')][_0xb4cb('0x31')](_0xb4cb('0x32'))){_0x531df5['limit']=qs['limit'](_0xbaee57[_0xb4cb('0x2b')][_0xb4cb('0x1f')]);_0x531df5[_0xb4cb('0x1e')]=qs[_0xb4cb('0x1e')](_0xbaee57['query'][_0xb4cb('0x1e')]);}_0x531df5[_0xb4cb('0x33')]=qs['sort'](_0xbaee57['query'][_0xb4cb('0x34')]);_0x531df5[_0xb4cb('0x35')]=qs[_0xb4cb('0x2c')](_['pick'](_0xbaee57['query'],_0x280f7f[_0xb4cb('0x2c')]),_0x20ed75);if(_0xbaee57[_0xb4cb('0x2b')][_0xb4cb('0x36')]){_0x531df5[_0xb4cb('0x35')]=_[_0xb4cb('0x37')](_0x531df5[_0xb4cb('0x35')],{'$or':_[_0xb4cb('0x26')](_0x20ed75,function(_0x99553b){if(_0x99553b[_0xb4cb('0x28')]!==_0xb4cb('0x38')){var _0x1169d2={};_0x1169d2[_0x99553b['name']]={'$like':'%'+_0xbaee57[_0xb4cb('0x2b')][_0xb4cb('0x36')]+'%'};return _0x1169d2;}})});}_0x531df5=_[_0xb4cb('0x37')]({},_0x531df5,_0xbaee57[_0xb4cb('0x39')]);var _0x44aecc={'where':_0x531df5[_0xb4cb('0x35')]};return db[_0xb4cb('0x3a')][_0xb4cb('0x1d')](_0x44aecc)[_0xb4cb('0x22')](function(_0x4bc1f4){_0x175df8[_0xb4cb('0x1d')]=_0x4bc1f4;if(_0xbaee57[_0xb4cb('0x2b')][_0xb4cb('0x3b')]){_0x531df5[_0xb4cb('0x3c')]=[{'all':!![]}];}return db['Automation'][_0xb4cb('0x3d')](_0x531df5);})[_0xb4cb('0x22')](function(_0x350709){_0x175df8[_0xb4cb('0x3e')]=_0x350709;return _0x175df8;})[_0xb4cb('0x22')](respondWithFilteredResult(_0xa3fa28,_0x531df5))['catch'](handleError(_0xa3fa28,null));};exports[_0xb4cb('0x3f')]=function(_0x5245e9,_0x233677){var _0x5071ce={'raw':![],'where':{'id':_0x5245e9[_0xb4cb('0x40')]['id']}},_0x430468={};_0x430468['model']=_[_0xb4cb('0x41')](db[_0xb4cb('0x3a')][_0xb4cb('0x42')]);_0x430468[_0xb4cb('0x2b')]=_['keys'](_0x5245e9[_0xb4cb('0x2b')]);_0x430468[_0xb4cb('0x2c')]=_[_0xb4cb('0x2d')](_0x430468[_0xb4cb('0x2a')],_0x430468[_0xb4cb('0x2b')]);_0x5071ce[_0xb4cb('0x2e')]=_[_0xb4cb('0x2d')](_0x430468[_0xb4cb('0x2a')],qs[_0xb4cb('0x2f')](_0x5245e9[_0xb4cb('0x2b')][_0xb4cb('0x2f')]));_0x5071ce[_0xb4cb('0x2e')]=_0x5071ce[_0xb4cb('0x2e')][_0xb4cb('0x30')]?_0x5071ce[_0xb4cb('0x2e')]:_0x430468[_0xb4cb('0x2a')];if(_0x5245e9[_0xb4cb('0x2b')][_0xb4cb('0x3b')]){_0x5071ce[_0xb4cb('0x3c')]=[{'all':!![]}];}_0x5071ce=_[_0xb4cb('0x37')]({},_0x5071ce,_0x5245e9[_0xb4cb('0x39')]);return db[_0xb4cb('0x3a')][_0xb4cb('0x43')](_0x5071ce)['then'](handleEntityNotFound(_0x233677,null))[_0xb4cb('0x22')](respondWithResult(_0x233677,null))[_0xb4cb('0x44')](handleError(_0x233677,null));};exports[_0xb4cb('0x45')]=function(_0x3a536e,_0x1c023a){return db[_0xb4cb('0x3a')][_0xb4cb('0x45')](_0x3a536e[_0xb4cb('0x46')],{})['then'](respondWithResult(_0x1c023a,0xc9))[_0xb4cb('0x44')](handleError(_0x1c023a,null));};exports[_0xb4cb('0x47')]=function(_0x27ff73,_0x34b5f0){if(_0x27ff73[_0xb4cb('0x46')]['id']){delete _0x27ff73['body']['id'];}return db[_0xb4cb('0x3a')][_0xb4cb('0x43')]({'where':{'id':_0x27ff73[_0xb4cb('0x40')]['id']}})[_0xb4cb('0x22')](handleEntityNotFound(_0x34b5f0,null))['then'](saveUpdates(_0x27ff73[_0xb4cb('0x46')],null))[_0xb4cb('0x22')](respondWithResult(_0x34b5f0,null))[_0xb4cb('0x44')](handleError(_0x34b5f0,null));};exports[_0xb4cb('0x48')]=function(_0x4be946,_0x293cfd){return db[_0xb4cb('0x3a')][_0xb4cb('0x43')]({'where':{'id':_0x4be946[_0xb4cb('0x40')]['id']}})[_0xb4cb('0x22')](handleEntityNotFound(_0x293cfd,null))['then'](removeEntity(_0x293cfd,null))[_0xb4cb('0x44')](handleError(_0x293cfd,null));};exports[_0xb4cb('0x49')]=function(_0x15b074,_0x5360dc,_0x1a0071){return db[_0xb4cb('0x4a')][_0xb4cb('0x43')]({'where':{'id':_0x15b074['params']['id']}})[_0xb4cb('0x22')](handleEntityNotFound(_0x5360dc,null))[_0xb4cb('0x22')](function(_0x4b12ba){if(_0x4b12ba){return _0x4b12ba[_0xb4cb('0x49')](_0x15b074['body']['ids'],_[_0xb4cb('0x4b')](_0x15b074['body'],['ids','id'])||{});}})[_0xb4cb('0x22')](respondWithResult(_0x5360dc,null))['catch'](handleError(_0x5360dc,null));};exports[_0xb4cb('0x4c')]=function(_0x4f5a8d,_0xff2a57,_0xdc752a){var _0x559662={};var _0xb2d13={};var _0x1ade02;var _0x3bdfc8;return db[_0xb4cb('0x3a')]['findOne']({'where':{'id':_0x4f5a8d['params']['id']}})[_0xb4cb('0x22')](handleEntityNotFound(_0xff2a57,null))[_0xb4cb('0x22')](function(_0x4b1a21){if(_0x4b1a21){_0x1ade02=_0x4b1a21;_0xb2d13['model']=_['keys'](db[_0xb4cb('0x4a')][_0xb4cb('0x42')]);_0xb2d13[_0xb4cb('0x2b')]=_['keys'](_0x4f5a8d[_0xb4cb('0x2b')]);_0xb2d13[_0xb4cb('0x2c')]=_[_0xb4cb('0x2d')](_0xb2d13[_0xb4cb('0x2a')],_0xb2d13[_0xb4cb('0x2b')]);_0x559662[_0xb4cb('0x2e')]=_[_0xb4cb('0x2d')](_0xb2d13[_0xb4cb('0x2a')],qs['fields'](_0x4f5a8d[_0xb4cb('0x2b')][_0xb4cb('0x2f')]));_0x559662[_0xb4cb('0x2e')]=_0x559662[_0xb4cb('0x2e')][_0xb4cb('0x30')]?_0x559662['attributes']:_0xb2d13[_0xb4cb('0x2a')];_0x559662[_0xb4cb('0x33')]=qs['sort'](_0x4f5a8d[_0xb4cb('0x2b')]['sort']);_0x559662['where']=qs['filters'](_[_0xb4cb('0x4d')](_0x4f5a8d[_0xb4cb('0x2b')],_0xb2d13[_0xb4cb('0x2c')]));if(_0x4f5a8d[_0xb4cb('0x2b')][_0xb4cb('0x36')]){_0x559662[_0xb4cb('0x35')]=_[_0xb4cb('0x37')](_0x559662[_0xb4cb('0x35')],{'$or':_['map'](_0x559662[_0xb4cb('0x2e')],function(_0x30c720){var _0x384376={};_0x384376[_0x30c720]={'$like':'%'+_0x4f5a8d[_0xb4cb('0x2b')][_0xb4cb('0x36')]+'%'};return _0x384376;})});}_0x559662=_['merge']({},_0x559662,_0x4f5a8d[_0xb4cb('0x39')]);return _0x1ade02[_0xb4cb('0x4c')](_0x559662);}})[_0xb4cb('0x22')](function(_0x51c57c){if(_0x51c57c){_0x3bdfc8=_0x51c57c[_0xb4cb('0x30')];if(!_0x4f5a8d[_0xb4cb('0x2b')][_0xb4cb('0x31')](_0xb4cb('0x32'))){_0x559662['limit']=qs[_0xb4cb('0x1f')](_0x4f5a8d[_0xb4cb('0x2b')]['limit']);_0x559662[_0xb4cb('0x1e')]=qs['offset'](_0x4f5a8d[_0xb4cb('0x2b')]['offset']);}return _0x1ade02[_0xb4cb('0x4c')](_0x559662);}})[_0xb4cb('0x22')](function(_0x12d7ef){if(_0x12d7ef){return _0x12d7ef?{'count':_0x3bdfc8,'rows':_0x12d7ef}:null;}})['then'](respondWithResult(_0xff2a57,null))[_0xb4cb('0x44')](handleError(_0xff2a57,null));};exports['addActions']=function(_0x7c1b46,_0xdb2766,_0x1f8f56){return db[_0xb4cb('0x4e')][_0xb4cb('0x43')]({'where':{'id':_0x7c1b46[_0xb4cb('0x40')]['id']}})[_0xb4cb('0x22')](handleEntityNotFound(_0xdb2766,null))[_0xb4cb('0x22')](function(_0x401541){if(_0x401541){return _0x401541[_0xb4cb('0x4f')](_0x7c1b46[_0xb4cb('0x46')][_0xb4cb('0x50')],_[_0xb4cb('0x4b')](_0x7c1b46[_0xb4cb('0x46')],[_0xb4cb('0x50'),'id'])||{});}})['then'](respondWithResult(_0xdb2766,null))['catch'](handleError(_0xdb2766,null));};exports[_0xb4cb('0x51')]=function(_0x2a1949,_0x32c0ef,_0x3139b3){var _0x5c7734={};var _0x5b6913={};var _0x46eb6f;var _0x26a2ee;return db[_0xb4cb('0x3a')][_0xb4cb('0x52')]({'where':{'id':_0x2a1949[_0xb4cb('0x40')]['id']}})[_0xb4cb('0x22')](handleEntityNotFound(_0x32c0ef,null))[_0xb4cb('0x22')](function(_0x4a31b5){if(_0x4a31b5){_0x46eb6f=_0x4a31b5;_0x5b6913['model']=_[_0xb4cb('0x41')](db[_0xb4cb('0x4e')][_0xb4cb('0x42')]);_0x5b6913['query']=_[_0xb4cb('0x41')](_0x2a1949['query']);_0x5b6913['filters']=_[_0xb4cb('0x2d')](_0x5b6913[_0xb4cb('0x2a')],_0x5b6913['query']);_0x5c7734[_0xb4cb('0x2e')]=_[_0xb4cb('0x2d')](_0x5b6913[_0xb4cb('0x2a')],qs[_0xb4cb('0x2f')](_0x2a1949[_0xb4cb('0x2b')][_0xb4cb('0x2f')]));_0x5c7734[_0xb4cb('0x2e')]=_0x5c7734[_0xb4cb('0x2e')]['length']?_0x5c7734[_0xb4cb('0x2e')]:_0x5b6913[_0xb4cb('0x2a')];_0x5c7734[_0xb4cb('0x33')]=qs[_0xb4cb('0x34')](_0x2a1949[_0xb4cb('0x2b')][_0xb4cb('0x34')]);_0x5c7734['where']=qs[_0xb4cb('0x2c')](_['pick'](_0x2a1949[_0xb4cb('0x2b')],_0x5b6913[_0xb4cb('0x2c')]));if(_0x2a1949['query']['filter']){_0x5c7734[_0xb4cb('0x35')]=_['merge'](_0x5c7734[_0xb4cb('0x35')],{'$or':_[_0xb4cb('0x26')](_0x5c7734['attributes'],function(_0x544c7a){var _0x259cf9={};_0x259cf9[_0x544c7a]={'$like':'%'+_0x2a1949[_0xb4cb('0x2b')][_0xb4cb('0x36')]+'%'};return _0x259cf9;})});}_0x5c7734=_[_0xb4cb('0x37')]({},_0x5c7734,_0x2a1949['options']);return _0x46eb6f[_0xb4cb('0x51')](_0x5c7734);}})[_0xb4cb('0x22')](function(_0x3a4571){if(_0x3a4571){_0x26a2ee=_0x3a4571[_0xb4cb('0x30')];if(!_0x2a1949[_0xb4cb('0x2b')][_0xb4cb('0x31')](_0xb4cb('0x32'))){_0x5c7734['limit']=qs['limit'](_0x2a1949[_0xb4cb('0x2b')][_0xb4cb('0x1f')]);_0x5c7734[_0xb4cb('0x1e')]=qs[_0xb4cb('0x1e')](_0x2a1949[_0xb4cb('0x2b')][_0xb4cb('0x1e')]);}return _0x46eb6f[_0xb4cb('0x51')](_0x5c7734);}})[_0xb4cb('0x22')](function(_0x579c1b){if(_0x579c1b){return _0x579c1b?{'count':_0x26a2ee,'rows':_0x579c1b}:null;}})[_0xb4cb('0x22')](respondWithResult(_0x32c0ef,null))[_0xb4cb('0x44')](handleError(_0x32c0ef,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2e3c4aa..87bb4d6 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 _0xb458=['path','rimraf','./automation.attributes','define','Automation','tools_automations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x447029,_0x147609){var _0x533de8=function(_0x17586f){while(--_0x17586f){_0x447029['push'](_0x447029['shift']());}};_0x533de8(++_0x147609);}(_0xb458,0x103));var _0x8b45=function(_0x39b9b3,_0x3e9a66){_0x39b9b3=_0x39b9b3-0x0;var _0x4977c8=_0xb458[_0x39b9b3];return _0x4977c8;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeec6=['path','rimraf','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4e7c56,_0x39022f){var _0x255531=function(_0x321618){while(--_0x321618){_0x4e7c56['push'](_0x4e7c56['shift']());}};_0x255531(++_0x39022f);}(_0xeec6,0x1c2));var _0x6eec=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xeec6[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 399c438..613492e 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 _0xb7a7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','stringify','error','code','message','Automation,\x20%s,\x20%s','info'];(function(_0x22cd8c,_0x3a75f7){var _0x597bd9=function(_0x5a55bf){while(--_0x5a55bf){_0x22cd8c['push'](_0x22cd8c['shift']());}};_0x597bd9(++_0x3a75f7);}(_0xb7a7,0x98));var _0x7b7a=function(_0x4460ae,_0x1dfe5){_0x4460ae=_0x4460ae-0x0;var _0x51d9ff=_0xb7a7[_0x4460ae];return _0x51d9ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b7a('0x0'));var BPromise=require(_0x7b7a('0x1'));var rs=require(_0x7b7a('0x2'));var fs=require('fs');var Redis=require(_0x7b7a('0x3'));var db=require(_0x7b7a('0x4'))['db'];var utils=require(_0x7b7a('0x5'));var logger=require(_0x7b7a('0x6'))(_0x7b7a('0x7'));var config=require(_0x7b7a('0x8'));var jayson=require(_0x7b7a('0x9'));var client=jayson['client'][_0x7b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd368,_0x270c21,_0x1c21a5){return new BPromise(function(_0x550fdf,_0x4a56b9){return client['request'](_0x2dd368,_0x1c21a5)[_0x7b7a('0xb')](function(_0x544736){logger['info']('Automation,\x20%s,\x20%s',_0x270c21,_0x7b7a('0xc'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x270c21,_0x7b7a('0xc'),JSON[_0x7b7a('0xd')](_0x544736));if(_0x544736[_0x7b7a('0xe')]){if(_0x544736[_0x7b7a('0xe')][_0x7b7a('0xf')]===0x1f4){logger[_0x7b7a('0xe')]('Automation,\x20%s,\x20%s',_0x270c21,_0x544736[_0x7b7a('0xe')][_0x7b7a('0x10')]);return _0x4a56b9(_0x544736[_0x7b7a('0xe')]['message']);}logger[_0x7b7a('0xe')](_0x7b7a('0x11'),_0x270c21,_0x544736[_0x7b7a('0xe')][_0x7b7a('0x10')]);return _0x550fdf(_0x544736[_0x7b7a('0xe')]['message']);}else{logger[_0x7b7a('0x12')](_0x7b7a('0x11'),_0x270c21,_0x7b7a('0xc'));_0x550fdf(_0x544736['result'][_0x7b7a('0x10')]);}})['catch'](function(_0x354948){logger[_0x7b7a('0xe')](_0x7b7a('0x11'),_0x270c21,_0x354948);_0x4a56b9(_0x354948);});});} \ No newline at end of file +var _0xfc60=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x401286,_0x23a64b){var _0x3ac67d=function(_0x57cfa1){while(--_0x57cfa1){_0x401286['push'](_0x401286['shift']());}};_0x3ac67d(++_0x23a64b);}(_0xfc60,0xb3));var _0x0fc6=function(_0x49fa22,_0x3a8ccb){_0x49fa22=_0x49fa22-0x0;var _0x4af7a1=_0xfc60[_0x49fa22];return _0x4af7a1;};'use strict';var _=require(_0x0fc6('0x0'));var util=require(_0x0fc6('0x1'));var moment=require('moment');var BPromise=require(_0x0fc6('0x2'));var rs=require(_0x0fc6('0x3'));var fs=require('fs');var Redis=require(_0x0fc6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fc6('0x5'));var logger=require(_0x0fc6('0x6'))('rpc');var config=require(_0x0fc6('0x7'));var jayson=require(_0x0fc6('0x8'));var client=jayson[_0x0fc6('0x9')][_0x0fc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f3c0d,_0x5e4bb7,_0x12db30){return new BPromise(function(_0x292ee9,_0x183ea1){return client[_0x0fc6('0xb')](_0x4f3c0d,_0x12db30)['then'](function(_0x3768f9){logger[_0x0fc6('0xc')](_0x0fc6('0xd'),_0x5e4bb7,_0x0fc6('0xe'));logger[_0x0fc6('0xf')](_0x0fc6('0x10'),_0x5e4bb7,_0x0fc6('0xe'),JSON[_0x0fc6('0x11')](_0x3768f9));if(_0x3768f9[_0x0fc6('0x12')]){if(_0x3768f9['error'][_0x0fc6('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x5e4bb7,_0x3768f9[_0x0fc6('0x12')][_0x0fc6('0x14')]);return _0x183ea1(_0x3768f9[_0x0fc6('0x12')][_0x0fc6('0x14')]);}logger[_0x0fc6('0x12')](_0x0fc6('0xd'),_0x5e4bb7,_0x3768f9['error'][_0x0fc6('0x14')]);return _0x292ee9(_0x3768f9[_0x0fc6('0x12')][_0x0fc6('0x14')]);}else{logger[_0x0fc6('0xc')](_0x0fc6('0xd'),_0x5e4bb7,'request\x20sent');_0x292ee9(_0x3768f9[_0x0fc6('0x15')][_0x0fc6('0x14')]);}})[_0x0fc6('0x16')](function(_0x558523){logger[_0x0fc6('0x12')]('Automation,\x20%s,\x20%s',_0x5e4bb7,_0x558523);_0x183ea1(_0x558523);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 243f7a6..09a357c 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 _0xa4a9=['../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4fb73e,_0x17f37d){var _0x14de68=function(_0xf5eeed){while(--_0xf5eeed){_0x4fb73e['push'](_0x4fb73e['shift']());}};_0x14de68(++_0x17f37d);}(_0xa4a9,0x126));var _0x9a4a=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xa4a9[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x9a4a('0x0'));var util=require(_0x9a4a('0x1'));var path=require('path');var timeout=require(_0x9a4a('0x2'));var express=require(_0x9a4a('0x3'));var router=express[_0x9a4a('0x4')]();var auth=require(_0x9a4a('0x5'));var interaction=require(_0x9a4a('0x6'));var config=require(_0x9a4a('0x7'));var controller=require(_0x9a4a('0x8'));router[_0x9a4a('0x9')]('/',auth[_0x9a4a('0xa')](),controller[_0x9a4a('0xb')]);router[_0x9a4a('0x9')](_0x9a4a('0xc'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0xd')]);router[_0x9a4a('0x9')](_0x9a4a('0xe'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0xf')]);router[_0x9a4a('0x9')](_0x9a4a('0x10'),auth['isAuthenticated'](),controller[_0x9a4a('0x11')]);router[_0x9a4a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a4a('0x12')](_0x9a4a('0xe'),auth['isAuthenticated'](),controller[_0x9a4a('0x13')]);router[_0x9a4a('0x12')]('/:id/actions',auth[_0x9a4a('0xa')](),controller[_0x9a4a('0x14')]);router['put'](_0x9a4a('0xc'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0x15')]);router[_0x9a4a('0x16')](_0x9a4a('0xc'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0x17')]);module[_0x9a4a('0x18')]=router; \ No newline at end of file +var _0xea67=['post','create','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions'];(function(_0x3d6e69,_0x5abbf3){var _0x230335=function(_0x1ff08b){while(--_0x1ff08b){_0x3d6e69['push'](_0x3d6e69['shift']());}};_0x230335(++_0x5abbf3);}(_0xea67,0x1e9));var _0x7ea6=function(_0x2fc026,_0xdc4f7a){_0x2fc026=_0x2fc026-0x0;var _0x34d056=_0xea67[_0x2fc026];return _0x34d056;};'use strict';var multer=require(_0x7ea6('0x0'));var util=require(_0x7ea6('0x1'));var path=require(_0x7ea6('0x2'));var timeout=require(_0x7ea6('0x3'));var express=require(_0x7ea6('0x4'));var router=express[_0x7ea6('0x5')]();var auth=require(_0x7ea6('0x6'));var interaction=require(_0x7ea6('0x7'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x7ea6('0x8')]('/',auth[_0x7ea6('0x9')](),controller[_0x7ea6('0xa')]);router[_0x7ea6('0x8')](_0x7ea6('0xb'),auth[_0x7ea6('0x9')](),controller[_0x7ea6('0xc')]);router[_0x7ea6('0x8')](_0x7ea6('0xd'),auth['isAuthenticated'](),controller['getConditions']);router[_0x7ea6('0x8')](_0x7ea6('0xe'),auth['isAuthenticated'](),controller['getActions']);router[_0x7ea6('0xf')]('/',auth['isAuthenticated'](),controller[_0x7ea6('0x10')]);router['post'](_0x7ea6('0xd'),auth[_0x7ea6('0x9')](),controller[_0x7ea6('0x11')]);router[_0x7ea6('0xf')]('/:id/actions',auth[_0x7ea6('0x9')](),controller[_0x7ea6('0x12')]);router[_0x7ea6('0x13')](_0x7ea6('0xb'),auth['isAuthenticated'](),controller[_0x7ea6('0x14')]);router[_0x7ea6('0x15')](_0x7ea6('0xb'),auth[_0x7ea6('0x9')](),controller[_0x7ea6('0x16')]);module[_0x7ea6('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7b0977b..3608635 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 _0x3ecd=['ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name'];(function(_0xd10919,_0x2d66ab){var _0x3e88f4=function(_0x32dbae){while(--_0x32dbae){_0xd10919['push'](_0xd10919['shift']());}};_0x3e88f4(++_0x2d66ab);}(_0x3ecd,0x173));var _0xd3ec=function(_0x5b9f70,_0x28f96b){_0x5b9f70=_0x5b9f70-0x0;var _0x2ef954=_0x3ecd[_0x5b9f70];return _0x2ef954;};'use strict';var Sequelize=require('sequelize');module[_0xd3ec('0x0')]={'name':{'type':Sequelize[_0xd3ec('0x1')],'unique':_0xd3ec('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xd3ec('0x3')),'allowNull':![],'defaultValue':_0xd3ec('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd3ec('0x4')],'defaultValue':0x0,'comment':_0xd3ec('0x5')},'limitCalls':{'type':Sequelize[_0xd3ec('0x6')](0x4)[_0xd3ec('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd3ec('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd3ec('0xd')},'dialTimezone':{'type':Sequelize[_0xd3ec('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd3ec('0x1')],'defaultValue':_0xd3ec('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd3ec('0xf')](_0xd3ec('0x10'),_0xd3ec('0x11'),_0xd3ec('0x12')),'defaultValue':_0xd3ec('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd3ec('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd3ec('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd3ec('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd3ec('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd3ec('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd3ec('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd3ec('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd3ec('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd3ec('0xf')](_0xd3ec('0x1a'),'ASC'),'defaultValue':_0xd3ec('0x1a')},'dialPrefix':{'type':Sequelize[_0xd3ec('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd3ec('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3ec('0x1b')},'dialCutDigit':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3ec('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x5b7e=['name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING'];(function(_0x240df3,_0x515368){var _0x4a2815=function(_0x5ae814){while(--_0x5ae814){_0x240df3['push'](_0x240df3['shift']());}};_0x4a2815(++_0x515368);}(_0x5b7e,0x1ec));var _0xe5b7=function(_0x381e4e,_0x4d46c6){_0x381e4e=_0x381e4e-0x0;var _0x52fc95=_0x5b7e[_0x381e4e];return _0x52fc95;};'use strict';var Sequelize=require(_0xe5b7('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5b7('0x1')],'unique':_0xe5b7('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe5b7('0x3')](_0xe5b7('0x4')),'allowNull':![],'defaultValue':_0xe5b7('0x4')},'description':{'type':Sequelize[_0xe5b7('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe5b7('0x5')},'limitCalls':{'type':Sequelize[_0xe5b7('0x6')](0x4)[_0xe5b7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe5b7('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe5b7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)[_0xe5b7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b7('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'defaultValue':0x3,'comment':_0xe5b7('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b7('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe5b7('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe5b7('0x1')],'defaultValue':_0xe5b7('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xe5b7('0x3')](_0xe5b7('0x11'),_0xe5b7('0x12'),_0xe5b7('0x13')),'defaultValue':_0xe5b7('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe5b7('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xe5b7('0x6')](0x9)[_0xe5b7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xe5b7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe5b7('0x6')](0x9)[_0xe5b7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe5b7('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe5b7('0x6')](0x9)[_0xe5b7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe5b7('0x6')](0x9)[_0xe5b7('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe5b7('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe5b7('0x6')](0x9)[_0xe5b7('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe5b7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe5b7('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe5b7('0x6')](0x5)[_0xe5b7('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe5b7('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe5b7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe5b7('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xe5b7('0x1a'),_0xe5b7('0x1b')),'defaultValue':_0xe5b7('0x1a')},'dialPrefix':{'type':Sequelize[_0xe5b7('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe5b7('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe5b7('0x1c')},'dialCutDigit':{'type':Sequelize[_0xe5b7('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe5b7('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)[_0xe5b7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b7('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b7('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b7('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b7('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe5b7('0x6')](0x3)[_0xe5b7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe5b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b7('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3e765d6..ea9a0a4 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 _0x5559=['CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ContactId','select','field','phone','NOW()','scheduledAt','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','insert','push','sequelize','addBlackLists','cm_hopper_black','ListId\x20=\x20?','all','removeBlackLists','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','Campaign','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','clone','include','omit','createdAt','updatedAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','order','pick','CampaignId','getHopperHistories'];(function(_0x3eebe3,_0x3574d0){var _0x357678=function(_0x348cf0){while(--_0x348cf0){_0x3eebe3['push'](_0x3eebe3['shift']());}};_0x357678(++_0x3574d0);}(_0x5559,0x1b6));var _0x9555=function(_0x246bd0,_0x313a52){_0x246bd0=_0x246bd0-0x0;var _0x15f1e0=_0x5559[_0x246bd0];return _0x15f1e0;};'use strict';var pdf=require(_0x9555('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9555('0x1'));var zipdir=require(_0x9555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9555('0x3'));var moment=require('moment');var BPromise=require(_0x9555('0x4'));var Mustache=require(_0x9555('0x5'));var util=require('util');var path=require(_0x9555('0x6'));var sox=require(_0x9555('0x7'));var csv=require(_0x9555('0x8'));var ejs=require(_0x9555('0x9'));var fs=require('fs');var _=require(_0x9555('0xa'));var squel=require('squel');var crypto=require(_0x9555('0xb'));var jsforce=require(_0x9555('0xc'));var deskjs=require(_0x9555('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9555('0xe'));var Papa=require(_0x9555('0xf'));var Redis=require(_0x9555('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9555('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9555('0x12'));var logger=require(_0x9555('0x13'))(_0x9555('0x14'));var utils=require(_0x9555('0x15'));var config=require(_0x9555('0x16'));var db=require(_0x9555('0x17'))['db'];function respondWithStatusCode(_0x1bc8d7,_0x48d41f){_0x48d41f=_0x48d41f||0xcc;return function(_0x585986){if(_0x585986){return _0x1bc8d7[_0x9555('0x18')](_0x48d41f);}return _0x1bc8d7[_0x9555('0x19')](_0x48d41f)[_0x9555('0x1a')]();};}function respondWithResult(_0x146280,_0x2b5988){_0x2b5988=_0x2b5988||0xc8;return function(_0x54fa00){if(_0x54fa00){return _0x146280['status'](_0x2b5988)[_0x9555('0x1b')](_0x54fa00);}};}function respondWithFilteredResult(_0x4eda60,_0x1f52b2){return function(_0x484f0e){if(_0x484f0e){var _0x1dffbf=_0x484f0e[_0x9555('0x1c')],_0x2b6518=_0x1f52b2[_0x9555('0x1d')],_0x174f50=_0x1f52b2['offset']+_0x1f52b2[_0x9555('0x1e')],_0x345fe5;if(_0x174f50>=_0x1dffbf){_0x174f50=_0x1dffbf;_0x345fe5=0xc8;}else{_0x345fe5=0xce;}_0x4eda60[_0x9555('0x19')](_0x345fe5);return _0x4eda60[_0x9555('0x1f')](_0x9555('0x20'),_0x2b6518+'-'+_0x174f50+'/'+_0x1dffbf)[_0x9555('0x1b')](_0x484f0e);}return null;};}function patchUpdates(_0x38c734){return function(_0x1f8c4a){try{jsonpatch['apply'](_0x1f8c4a,_0x38c734,!![]);}catch(_0x2d3582){return BPromise[_0x9555('0x21')](_0x2d3582);}return _0x1f8c4a['save']();};}function saveUpdates(_0x780a60,_0x40b990){return function(_0x5776cc){if(_0x5776cc){return _0x5776cc['update'](_0x780a60)['then'](function(_0x266d9f){return _0x266d9f;});}return null;};}function removeEntity(_0x3acc2b,_0x1728ff){return function(_0x6432c7){if(_0x6432c7){return _0x6432c7[_0x9555('0x22')]()[_0x9555('0x23')](function(){var _0x40998a=_0x6432c7[_0x9555('0x24')]({'plain':!![]});var _0x35b192=_0x9555('0x25');return db[_0x9555('0x26')][_0x9555('0x22')]({'where':{'type':_0x35b192,'resourceId':_0x40998a['id']}})['then'](function(){return _0x6432c7;});})[_0x9555('0x23')](function(){_0x3acc2b[_0x9555('0x19')](0xcc)[_0x9555('0x1a')]();});}};}function handleEntityNotFound(_0x457ce8,_0xbfd949){return function(_0x15788e){if(!_0x15788e){_0x457ce8[_0x9555('0x18')](0x194);}return _0x15788e;};}function handleError(_0x5e0260,_0x2277d){_0x2277d=_0x2277d||0x1f4;return function(_0x614b56){logger[_0x9555('0x27')](_0x614b56[_0x9555('0x28')]);if(_0x614b56[_0x9555('0x29')]){delete _0x614b56['name'];}_0x5e0260['status'](_0x2277d)[_0x9555('0x2a')](_0x614b56);};}exports['index']=function(_0x93b12f,_0x57ef15){var _0x368209={},_0x5826e3={},_0x1127cc={'count':0x0,'rows':[]};var _0xc48367=_['map'](db[_0x9555('0x2b')][_0x9555('0x2c')],function(_0x2d7669){return{'name':_0x2d7669[_0x9555('0x2d')],'type':_0x2d7669[_0x9555('0x2e')]['key']};});_0x5826e3[_0x9555('0x2f')]=_[_0x9555('0x30')](_0xc48367,'name');_0x5826e3[_0x9555('0x31')]=_[_0x9555('0x32')](_0x93b12f[_0x9555('0x31')]);_0x5826e3[_0x9555('0x33')]=_['intersection'](_0x5826e3['model'],_0x5826e3[_0x9555('0x31')]);_0x368209[_0x9555('0x34')]=_[_0x9555('0x35')](_0x5826e3[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x93b12f[_0x9555('0x31')][_0x9555('0x36')]));_0x368209[_0x9555('0x34')]=_0x368209[_0x9555('0x34')][_0x9555('0x37')]?_0x368209[_0x9555('0x34')]:_0x5826e3[_0x9555('0x2f')];if(!_0x93b12f['query'][_0x9555('0x38')](_0x9555('0x39'))){_0x368209[_0x9555('0x1e')]=qs['limit'](_0x93b12f[_0x9555('0x31')][_0x9555('0x1e')]);_0x368209[_0x9555('0x1d')]=qs['offset'](_0x93b12f[_0x9555('0x31')][_0x9555('0x1d')]);}_0x368209['order']=qs[_0x9555('0x3a')](_0x93b12f[_0x9555('0x31')][_0x9555('0x3a')]);_0x368209[_0x9555('0x3b')]=qs[_0x9555('0x33')](_['pick'](_0x93b12f['query'],_0x5826e3[_0x9555('0x33')]),_0xc48367);if(_0x93b12f[_0x9555('0x31')][_0x9555('0x3c')]){_0x368209['where']=_[_0x9555('0x3d')](_0x368209[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0xc48367,function(_0x2054f7){if(_0x2054f7[_0x9555('0x2e')]!==_0x9555('0x3e')){var _0x15dd5c={};_0x15dd5c[_0x2054f7[_0x9555('0x29')]]={'$like':'%'+_0x93b12f['query'][_0x9555('0x3c')]+'%'};return _0x15dd5c;}})});}_0x368209=_[_0x9555('0x3d')]({},_0x368209,_0x93b12f['options']);var _0x959f1c={'where':_0x368209[_0x9555('0x3b')]};return db[_0x9555('0x2b')][_0x9555('0x1c')](_0x959f1c)[_0x9555('0x23')](function(_0x1fa2f1){_0x1127cc[_0x9555('0x1c')]=_0x1fa2f1;if(_0x93b12f[_0x9555('0x31')][_0x9555('0x3f')]){_0x368209['include']=[{'all':!![]}];}return db['Campaign'][_0x9555('0x40')](_0x368209);})['then'](function(_0x779bce){_0x1127cc['rows']=_0x779bce;return _0x1127cc;})[_0x9555('0x23')](respondWithFilteredResult(_0x57ef15,_0x368209))[_0x9555('0x41')](handleError(_0x57ef15,null));};exports['show']=function(_0x5c03c0,_0x342405){var _0x521107={'raw':![],'where':{'id':_0x5c03c0[_0x9555('0x42')]['id']}},_0x225daa={};_0x225daa['model']=_['keys'](db[_0x9555('0x2b')][_0x9555('0x2c')]);_0x225daa['query']=_[_0x9555('0x32')](_0x5c03c0[_0x9555('0x31')]);_0x225daa['filters']=_[_0x9555('0x35')](_0x225daa['model'],_0x225daa[_0x9555('0x31')]);_0x521107[_0x9555('0x34')]=_[_0x9555('0x35')](_0x225daa[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x5c03c0['query'][_0x9555('0x36')]));_0x521107[_0x9555('0x34')]=_0x521107[_0x9555('0x34')][_0x9555('0x37')]?_0x521107[_0x9555('0x34')]:_0x225daa[_0x9555('0x2f')];if(_0x5c03c0['query'][_0x9555('0x3f')]){_0x521107['include']=[{'all':!![]}];}_0x521107=_[_0x9555('0x3d')]({},_0x521107,_0x5c03c0[_0x9555('0x43')]);return db[_0x9555('0x2b')]['find'](_0x521107)[_0x9555('0x23')](handleEntityNotFound(_0x342405,null))[_0x9555('0x23')](respondWithResult(_0x342405,null))[_0x9555('0x41')](handleError(_0x342405,null));};exports[_0x9555('0x44')]=function(_0x16dfa0,_0x3d28b4){return db[_0x9555('0x2b')][_0x9555('0x44')](_0x16dfa0[_0x9555('0x45')],{})['then'](function(_0x40bb43){var _0x2dbeaf=_0x16dfa0['user']['get']({'plain':!![]});if(!_0x2dbeaf)throw new Error(_0x9555('0x46'));if(_0x2dbeaf['role']==='user'){var _0x16acb7=_0x40bb43['get']({'plain':!![]});var _0x59f038=_0x9555('0x25');return db[_0x9555('0x47')][_0x9555('0x48')]({'where':{'name':_0x59f038,'userProfileId':_0x2dbeaf[_0x9555('0x49')]},'raw':!![]})[_0x9555('0x23')](function(_0x4e8621){if(_0x4e8621&&_0x4e8621[_0x9555('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x16acb7[_0x9555('0x29')],'resourceId':_0x16acb7['id'],'type':_0x4e8621['name'],'sectionId':_0x4e8621['id']},{})[_0x9555('0x23')](function(){return _0x40bb43;});}else{return _0x40bb43;}})[_0x9555('0x41')](function(_0x34f375){logger[_0x9555('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34f375);throw _0x34f375;});}return _0x40bb43;})[_0x9555('0x23')](respondWithResult(_0x3d28b4,0xc9))[_0x9555('0x41')](handleError(_0x3d28b4,null));};exports[_0x9555('0x4b')]=function(_0x362c76,_0x36d9c5){var _0x5e0edc={'where':{'id':_0x362c76[_0x9555('0x42')]['id']}},_0x4ff75b={};_0x4ff75b[_0x9555('0x2f')]=_['keys'](db[_0x9555('0x2b')]['rawAttributes']);_0x5e0edc['attributes']=_[_0x9555('0x35')](_0x4ff75b[_0x9555('0x2f')],qs['fields'](_0x362c76[_0x9555('0x31')]['fields']));_0x5e0edc['attributes']=_0x5e0edc[_0x9555('0x34')][_0x9555('0x37')]?_0x5e0edc[_0x9555('0x34')]:_0x4ff75b[_0x9555('0x2f')];if(_0x362c76[_0x9555('0x31')][_0x9555('0x3f')]){_0x5e0edc[_0x9555('0x4c')]=[{'all':!![]}];}_0x5e0edc=_['merge']({},_0x5e0edc,_0x362c76[_0x9555('0x43')]);return db[_0x9555('0x2b')]['find'](_0x5e0edc)[_0x9555('0x23')](handleEntityNotFound(_0x36d9c5,null))['then'](function(_0x54afe5){if(_0x54afe5){var _0x4f790b=_0x54afe5[_0x9555('0x24')]({'plain':!![]});_0x4f790b=qs[_0x9555('0x4d')](_0x4f790b,['id',_0x9555('0x4e'),_0x9555('0x4f')]);_0x362c76[_0x9555('0x45')]=_[_0x9555('0x4d')](_0x362c76[_0x9555('0x45')],['id','createdAt','updatedAt']);return db[_0x9555('0x2b')][_0x9555('0x44')](_[_0x9555('0x3d')](_0x4f790b,_0x362c76[_0x9555('0x45')]),{'include':_0x362c76[_0x9555('0x31')][_0x9555('0x3f')]?[{'all':!![]}]:undefined})[_0x9555('0x23')](function(_0x139170){var _0x5e4dd1=_0x362c76[_0x9555('0x50')][_0x9555('0x24')]({'plain':!![]});if(!_0x5e4dd1)throw new Error(_0x9555('0x46'));if(_0x5e4dd1['role']===_0x9555('0x50')){var _0x2ff618=_0x139170['get']({'plain':!![]});var _0x48c9b7=_0x9555('0x25');return db[_0x9555('0x47')][_0x9555('0x48')]({'where':{'name':_0x48c9b7,'userProfileId':_0x5e4dd1[_0x9555('0x49')]},'raw':!![]})[_0x9555('0x23')](function(_0x4aeace){if(_0x4aeace&&_0x4aeace[_0x9555('0x4a')]===0x0){return db['UserProfileResource'][_0x9555('0x44')]({'name':_0x2ff618['name'],'resourceId':_0x2ff618['id'],'type':_0x4aeace['name'],'sectionId':_0x4aeace['id']},{})[_0x9555('0x23')](function(){return _0x139170;});}else{return _0x139170;}})[_0x9555('0x41')](function(_0x5e2137){logger[_0x9555('0x27')](_0x9555('0x51'),_0x5e2137);throw _0x5e2137;});}return _0x139170;});}})['then'](respondWithResult(_0x36d9c5,0xc9))['catch'](handleError(_0x36d9c5,null));};exports[_0x9555('0x52')]=function(_0x5ac172,_0x58940a){if(_0x5ac172[_0x9555('0x45')]['id']){delete _0x5ac172[_0x9555('0x45')]['id'];}return db['Campaign']['find']({'where':{'id':_0x5ac172[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x58940a,null))[_0x9555('0x23')](saveUpdates(_0x5ac172[_0x9555('0x45')],null))[_0x9555('0x23')](respondWithResult(_0x58940a,null))['catch'](handleError(_0x58940a,null));};exports[_0x9555('0x22')]=function(_0x2c91e7,_0x1440bc){return db[_0x9555('0x2b')][_0x9555('0x48')]({'where':{'id':_0x2c91e7[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x1440bc,null))[_0x9555('0x23')](removeEntity(_0x1440bc,null))[_0x9555('0x41')](handleError(_0x1440bc,null));};exports[_0x9555('0x53')]=function(_0x304099,_0x47c225,_0x48ee98){var _0x477507={'raw':!![],'where':{}};var _0x5c6a5f={};var _0x2f5c61={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x304099[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x47c225,null))[_0x9555('0x23')](function(_0x3c57d1){if(_0x3c57d1){_0x5c6a5f['model']=_[_0x9555('0x32')](db[_0x9555('0x55')][_0x9555('0x2c')]);_0x5c6a5f[_0x9555('0x31')]=_[_0x9555('0x32')](_0x304099[_0x9555('0x31')]);_0x5c6a5f[_0x9555('0x33')]=_[_0x9555('0x35')](_0x5c6a5f[_0x9555('0x2f')],_0x5c6a5f[_0x9555('0x31')]);_0x477507[_0x9555('0x34')]=_['intersection'](_0x5c6a5f[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x304099[_0x9555('0x31')]['fields']));_0x477507['attributes']=_0x477507[_0x9555('0x34')][_0x9555('0x37')]?_0x477507[_0x9555('0x34')]:_0x5c6a5f[_0x9555('0x2f')];if(!_0x304099[_0x9555('0x31')][_0x9555('0x38')](_0x9555('0x39'))){_0x477507[_0x9555('0x1e')]=qs[_0x9555('0x1e')](_0x304099['query'][_0x9555('0x1e')]);_0x477507['offset']=qs[_0x9555('0x1d')](_0x304099[_0x9555('0x31')]['offset']);}_0x477507[_0x9555('0x56')]=qs['sort'](_0x304099[_0x9555('0x31')][_0x9555('0x3a')]);_0x477507[_0x9555('0x3b')]=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x304099[_0x9555('0x31')],_0x5c6a5f[_0x9555('0x33')]));_0x477507[_0x9555('0x3b')][_0x9555('0x58')]=_0x3c57d1['id'];if(_0x304099[_0x9555('0x31')][_0x9555('0x3c')]){_0x477507[_0x9555('0x3b')]=_['merge'](_0x477507[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x477507[_0x9555('0x34')],function(_0x1bd86e){var _0x180680={};_0x180680[_0x1bd86e]={'$like':'%'+_0x304099['query'][_0x9555('0x3c')]+'%'};return _0x180680;})});}_0x477507=_[_0x9555('0x3d')]({},_0x477507,_0x304099[_0x9555('0x43')]);return db[_0x9555('0x55')][_0x9555('0x1c')]({'where':_0x477507[_0x9555('0x3b')]})[_0x9555('0x23')](function(_0x2d3eb1){_0x2f5c61[_0x9555('0x1c')]=_0x2d3eb1;if(_0x304099[_0x9555('0x31')][_0x9555('0x3f')]){_0x477507['include']=[{'all':!![]}];}return db[_0x9555('0x55')][_0x9555('0x40')](_0x477507);})[_0x9555('0x23')](function(_0x39e5e0){_0x2f5c61['rows']=_0x39e5e0;return _0x2f5c61;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x47c225,_0x477507))[_0x9555('0x41')](handleError(_0x47c225,null));};exports[_0x9555('0x59')]=function(_0x248c72,_0x1367f0,_0x27bc0c){var _0x39460c={'raw':!![],'where':{}};var _0x20d9d2={};var _0x5b0aa2={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x248c72['params']['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x1367f0,null))[_0x9555('0x23')](function(_0x9d8d49){if(_0x9d8d49){_0x20d9d2['model']=_[_0x9555('0x32')](db[_0x9555('0x5a')][_0x9555('0x2c')]);_0x20d9d2[_0x9555('0x31')]=_[_0x9555('0x32')](_0x248c72[_0x9555('0x31')]);_0x20d9d2[_0x9555('0x33')]=_['intersection'](_0x20d9d2[_0x9555('0x2f')],_0x20d9d2[_0x9555('0x31')]);_0x39460c[_0x9555('0x34')]=_[_0x9555('0x35')](_0x20d9d2[_0x9555('0x2f')],qs['fields'](_0x248c72['query'][_0x9555('0x36')]));_0x39460c[_0x9555('0x34')]=_0x39460c['attributes'][_0x9555('0x37')]?_0x39460c[_0x9555('0x34')]:_0x20d9d2[_0x9555('0x2f')];if(!_0x248c72['query'][_0x9555('0x38')](_0x9555('0x39'))){_0x39460c[_0x9555('0x1e')]=qs[_0x9555('0x1e')](_0x248c72[_0x9555('0x31')]['limit']);_0x39460c[_0x9555('0x1d')]=qs[_0x9555('0x1d')](_0x248c72[_0x9555('0x31')][_0x9555('0x1d')]);}_0x39460c['order']=qs['sort'](_0x248c72['query'][_0x9555('0x3a')]);_0x39460c[_0x9555('0x3b')]=qs['filters'](_[_0x9555('0x57')](_0x248c72['query'],_0x20d9d2[_0x9555('0x33')]));_0x39460c[_0x9555('0x3b')]['CampaignId']=_0x9d8d49['id'];if(_0x248c72['query'][_0x9555('0x3c')]){_0x39460c['where']=_[_0x9555('0x3d')](_0x39460c['where'],{'$or':_['map'](_0x39460c[_0x9555('0x34')],function(_0x193854){var _0x1223a3={};_0x1223a3[_0x193854]={'$like':'%'+_0x248c72['query'][_0x9555('0x3c')]+'%'};return _0x1223a3;})});}_0x39460c=_['merge']({},_0x39460c,_0x248c72[_0x9555('0x43')]);return db[_0x9555('0x5a')]['count']({'where':_0x39460c[_0x9555('0x3b')]})['then'](function(_0x33602c){_0x5b0aa2[_0x9555('0x1c')]=_0x33602c;if(_0x248c72[_0x9555('0x31')][_0x9555('0x3f')]){_0x39460c[_0x9555('0x4c')]=[{'all':!![]}];}return db[_0x9555('0x5a')]['findAll'](_0x39460c);})[_0x9555('0x23')](function(_0x4ac7ac){_0x5b0aa2[_0x9555('0x5b')]=_0x4ac7ac;return _0x5b0aa2;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x1367f0,_0x39460c))[_0x9555('0x41')](handleError(_0x1367f0,null));};exports[_0x9555('0x5c')]=function(_0x519fb1,_0x1b01c3,_0x2d158c){var _0x44cba7={'raw':!![],'where':{}};var _0x31e7ae={};var _0x27d892={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x519fb1['params']['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x1b01c3,null))[_0x9555('0x23')](function(_0x19e483){if(_0x19e483){_0x31e7ae[_0x9555('0x2f')]=_['keys'](db['CmHopperFinal'][_0x9555('0x2c')]);_0x31e7ae['query']=_[_0x9555('0x32')](_0x519fb1[_0x9555('0x31')]);_0x31e7ae[_0x9555('0x33')]=_[_0x9555('0x35')](_0x31e7ae[_0x9555('0x2f')],_0x31e7ae[_0x9555('0x31')]);_0x44cba7[_0x9555('0x34')]=_[_0x9555('0x35')](_0x31e7ae[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x519fb1['query'][_0x9555('0x36')]));_0x44cba7[_0x9555('0x34')]=_0x44cba7[_0x9555('0x34')][_0x9555('0x37')]?_0x44cba7[_0x9555('0x34')]:_0x31e7ae['model'];if(!_0x519fb1[_0x9555('0x31')][_0x9555('0x38')]('nolimit')){_0x44cba7['limit']=qs['limit'](_0x519fb1[_0x9555('0x31')][_0x9555('0x1e')]);_0x44cba7[_0x9555('0x1d')]=qs['offset'](_0x519fb1[_0x9555('0x31')][_0x9555('0x1d')]);}_0x44cba7[_0x9555('0x56')]=qs['sort'](_0x519fb1['query'][_0x9555('0x3a')]);_0x44cba7[_0x9555('0x3b')]=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x519fb1[_0x9555('0x31')],_0x31e7ae[_0x9555('0x33')]));_0x44cba7[_0x9555('0x3b')][_0x9555('0x58')]=_0x19e483['id'];if(_0x519fb1[_0x9555('0x31')][_0x9555('0x3c')]){_0x44cba7[_0x9555('0x3b')]=_['merge'](_0x44cba7['where'],{'$or':_[_0x9555('0x30')](_0x44cba7[_0x9555('0x34')],function(_0xc27ce6){var _0x21e22a={};_0x21e22a[_0xc27ce6]={'$like':'%'+_0x519fb1[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x21e22a;})});}_0x44cba7=_[_0x9555('0x3d')]({},_0x44cba7,_0x519fb1[_0x9555('0x43')]);return db[_0x9555('0x5d')]['count']({'where':_0x44cba7[_0x9555('0x3b')]})['then'](function(_0x4b7057){_0x27d892[_0x9555('0x1c')]=_0x4b7057;if(_0x519fb1[_0x9555('0x31')][_0x9555('0x3f')]){_0x44cba7[_0x9555('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9555('0x40')](_0x44cba7);})[_0x9555('0x23')](function(_0x38ed5d){_0x27d892[_0x9555('0x5b')]=_0x38ed5d;return _0x27d892;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x1b01c3,_0x44cba7))[_0x9555('0x41')](handleError(_0x1b01c3,null));};exports['getHopperBlacks']=function(_0x43dc3b,_0x3f00f5,_0x4f8736){var _0x276a63={'raw':!![],'where':{}};var _0x495cd5={};var _0x30977f={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x43dc3b['params']['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x3f00f5,null))['then'](function(_0x468e42){if(_0x468e42){_0x495cd5[_0x9555('0x2f')]=_[_0x9555('0x32')](db[_0x9555('0x5e')][_0x9555('0x2c')]);_0x495cd5[_0x9555('0x31')]=_[_0x9555('0x32')](_0x43dc3b[_0x9555('0x31')]);_0x495cd5[_0x9555('0x33')]=_['intersection'](_0x495cd5[_0x9555('0x2f')],_0x495cd5[_0x9555('0x31')]);_0x276a63['attributes']=_[_0x9555('0x35')](_0x495cd5[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x43dc3b[_0x9555('0x31')][_0x9555('0x36')]));_0x276a63['attributes']=_0x276a63[_0x9555('0x34')][_0x9555('0x37')]?_0x276a63['attributes']:_0x495cd5[_0x9555('0x2f')];if(!_0x43dc3b[_0x9555('0x31')][_0x9555('0x38')]('nolimit')){_0x276a63[_0x9555('0x1e')]=qs[_0x9555('0x1e')](_0x43dc3b[_0x9555('0x31')][_0x9555('0x1e')]);_0x276a63[_0x9555('0x1d')]=qs['offset'](_0x43dc3b[_0x9555('0x31')][_0x9555('0x1d')]);}_0x276a63[_0x9555('0x56')]=qs[_0x9555('0x3a')](_0x43dc3b[_0x9555('0x31')][_0x9555('0x3a')]);_0x276a63[_0x9555('0x3b')]=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x43dc3b[_0x9555('0x31')],_0x495cd5[_0x9555('0x33')]));_0x276a63['where']['CampaignId']=_0x468e42['id'];if(_0x43dc3b[_0x9555('0x31')][_0x9555('0x3c')]){_0x276a63['where']=_[_0x9555('0x3d')](_0x276a63[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x276a63[_0x9555('0x34')],function(_0x202a68){var _0x27d9c0={};_0x27d9c0[_0x202a68]={'$like':'%'+_0x43dc3b['query'][_0x9555('0x3c')]+'%'};return _0x27d9c0;})});}_0x276a63=_['merge']({},_0x276a63,_0x43dc3b[_0x9555('0x43')]);return db['CmHopperBlack']['count']({'where':_0x276a63[_0x9555('0x3b')]})[_0x9555('0x23')](function(_0x299739){_0x30977f[_0x9555('0x1c')]=_0x299739;if(_0x43dc3b[_0x9555('0x31')][_0x9555('0x3f')]){_0x276a63[_0x9555('0x4c')]=[{'all':!![]}];}return db[_0x9555('0x5e')][_0x9555('0x40')](_0x276a63);})[_0x9555('0x23')](function(_0x19b8e1){_0x30977f[_0x9555('0x5b')]=_0x19b8e1;return _0x30977f;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x3f00f5,_0x276a63))[_0x9555('0x41')](handleError(_0x3f00f5,null));};exports[_0x9555('0x5f')]=function(_0x1080c0,_0x731436,_0x21a536){var _0x3b6fe1={};var _0x5107d7={};var _0xf696d7;var _0x1ec9ff;return db[_0x9555('0x2b')]['findOne']({'where':{'id':_0x1080c0[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x731436,null))['then'](function(_0x555a2a){if(_0x555a2a){_0xf696d7=_0x555a2a;_0x5107d7[_0x9555('0x2f')]=_[_0x9555('0x32')](db[_0x9555('0x60')][_0x9555('0x2c')]);_0x5107d7['query']=_[_0x9555('0x32')](_0x1080c0[_0x9555('0x31')]);_0x5107d7[_0x9555('0x33')]=_[_0x9555('0x35')](_0x5107d7[_0x9555('0x2f')],_0x5107d7[_0x9555('0x31')]);_0x3b6fe1[_0x9555('0x34')]=_[_0x9555('0x35')](_0x5107d7['model'],qs[_0x9555('0x36')](_0x1080c0[_0x9555('0x31')]['fields']));_0x3b6fe1[_0x9555('0x34')]=_0x3b6fe1[_0x9555('0x34')]['length']?_0x3b6fe1['attributes']:_0x5107d7[_0x9555('0x2f')];_0x3b6fe1['order']=qs['sort'](_0x1080c0[_0x9555('0x31')][_0x9555('0x3a')]);_0x3b6fe1['where']=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x1080c0[_0x9555('0x31')],_0x5107d7[_0x9555('0x33')]));if(_0x1080c0[_0x9555('0x31')][_0x9555('0x3c')]){_0x3b6fe1['where']=_['merge'](_0x3b6fe1[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x3b6fe1['attributes'],function(_0x707ede){var _0x2c901f={};_0x2c901f[_0x707ede]={'$like':'%'+_0x1080c0[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x2c901f;})});}_0x3b6fe1=_[_0x9555('0x3d')]({},_0x3b6fe1,_0x1080c0[_0x9555('0x43')]);return _0xf696d7[_0x9555('0x5f')](_0x3b6fe1);}})[_0x9555('0x23')](function(_0x4847c5){if(_0x4847c5){_0x1ec9ff=_0x4847c5[_0x9555('0x37')];if(!_0x1080c0[_0x9555('0x31')][_0x9555('0x38')](_0x9555('0x39'))){_0x3b6fe1[_0x9555('0x1e')]=qs['limit'](_0x1080c0[_0x9555('0x31')]['limit']);_0x3b6fe1[_0x9555('0x1d')]=qs[_0x9555('0x1d')](_0x1080c0['query'][_0x9555('0x1d')]);}return _0xf696d7[_0x9555('0x5f')](_0x3b6fe1);}})[_0x9555('0x23')](function(_0x1ea8a4){if(_0x1ea8a4){return _0x1ea8a4?{'count':_0x1ec9ff,'rows':_0x1ea8a4}:null;}})[_0x9555('0x23')](respondWithResult(_0x731436,null))[_0x9555('0x41')](handleError(_0x731436,null));};exports[_0x9555('0x61')]=function(_0x3e7d74,_0x411d3a,_0x5c139f){var _0x4a30ce,_0x222954;return db[_0x9555('0x2b')][_0x9555('0x48')]({'where':{'id':_0x3e7d74['params']['id']}})['then'](handleEntityNotFound(_0x411d3a,null))[_0x9555('0x23')](function(_0x19f612){if(_0x19f612){_0x222954=_0x19f612;return _0x19f612[_0x9555('0x61')](_0x3e7d74[_0x9555('0x45')][_0x9555('0x62')],_[_0x9555('0x4d')](_0x3e7d74[_0x9555('0x45')],[_0x9555('0x62'),'id'])||{});}return null;})[_0x9555('0x63')](function(_0x570a5a){var _0x18e2fb;_0x4a30ce=_0x570a5a||[];var _0x4272e4=[];if(_0x570a5a){for(var _0x261e47=0x0;_0x261e47<_0x570a5a['length'];_0x261e47+=0x1){var _0x36e9cd=_0x570a5a[_0x261e47][_0x9555('0x24')]({'plain':!![]});_0x222954[_0x9555('0x64')]=_0x3e7d74['body']['dialCheckDuplicateType']?_0x3e7d74[_0x9555('0x45')][_0x9555('0x64')]:_0x222954[_0x9555('0x64')];switch(_0x222954[_0x9555('0x64')]){case _0x9555('0x65'):_0x18e2fb=squel['insert']()[_0x9555('0x66')](_0x9555('0x67'))[_0x9555('0x68')](['phone','scheduledAt',_0x9555('0x69'),'ListId',_0x9555('0x58'),_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x6c'),_0x9555('0x6c'))['field'](_0x9555('0x6d'),_0x9555('0x6e'))[_0x9555('0x6b')]('id',_0x9555('0x69'))['field'](_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')](),_0x9555('0x58'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4e'))['field'](_0x9555('0x6d'),'updatedAt')[_0x9555('0x72')](_0x9555('0x73'))[_0x9555('0x3b')](_0x9555('0x74'))[_0x9555('0x3b')]('ListId\x20=\x20?',_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')]())[_0x9555('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x9555('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9555('0x6a')]()['field'](_0x9555('0x75'))[_0x9555('0x72')](_0x9555('0x76'))['where'](_0x9555('0x77'),_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')]()))[_0x9555('0x3b')](_0x9555('0x78'),squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x79'))[_0x9555('0x72')](_0x9555('0x67'))[_0x9555('0x3b')]('CampaignId\x20=\x20?',_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')]())))[_0x9555('0x70')]();break;case _0x9555('0x7a'):_0x18e2fb=squel['insert']()[_0x9555('0x66')](_0x9555('0x67'))['fromQuery']([_0x9555('0x6c'),_0x9555('0x6e'),_0x9555('0x69'),_0x9555('0x71'),'CampaignId',_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()['field']('phone',_0x9555('0x6c'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x6e'))[_0x9555('0x6b')]('id','ContactId')[_0x9555('0x6b')](_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')](),_0x9555('0x58'))[_0x9555('0x6b')](_0x9555('0x6d'),'createdAt')[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4f'))[_0x9555('0x72')]('cm_contacts')[_0x9555('0x3b')](_0x9555('0x74'))['where']('ListId\x20=\x20?',_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')]())[_0x9555('0x3b')](_0x9555('0x7b'))[_0x9555('0x3b')](_0x9555('0x78'),squel[_0x9555('0x6a')]()['field'](_0x9555('0x79'))[_0x9555('0x72')](_0x9555('0x67'))[_0x9555('0x3b')](_0x9555('0x77'),_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')]())))[_0x9555('0x70')]();break;default:_0x18e2fb=squel[_0x9555('0x7c')]()[_0x9555('0x66')]('cm_hopper')[_0x9555('0x68')]([_0x9555('0x6c'),_0x9555('0x6e'),_0x9555('0x69'),_0x9555('0x71'),_0x9555('0x58'),_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x6c'),_0x9555('0x6c'))['field'](_0x9555('0x6d'),_0x9555('0x6e'))[_0x9555('0x6b')]('id',_0x9555('0x69'))['field'](_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')](),'CampaignId')['field'](_0x9555('0x6d'),_0x9555('0x4e'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4f'))[_0x9555('0x72')](_0x9555('0x73'))[_0x9555('0x3b')](_0x9555('0x74'))[_0x9555('0x3b')]('ListId\x20=\x20?',_0x36e9cd['CmListId']['toString']())['where'](_0x9555('0x7b')))[_0x9555('0x70')]();}_0x4272e4[_0x9555('0x7d')](db[_0x9555('0x7e')]['query'](_0x18e2fb));}return BPromise['all'](_0x4272e4);}})[_0x9555('0x23')](function(){return _0x4a30ce;})['then'](respondWithResult(_0x411d3a,null))['catch'](handleError(_0x411d3a,null));};exports['removeLists']=function(_0x28b233,_0x5cafb1,_0x41c3fc){return db[_0x9555('0x2b')][_0x9555('0x48')]({'where':{'id':_0x28b233[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x5cafb1,null))[_0x9555('0x23')](function(_0x5467b9){if(_0x5467b9){return _0x5467b9['removeLists'](_0x28b233[_0x9555('0x31')][_0x9555('0x62')]);}})['then'](function(_0x406e3d){if(_0x406e3d){return db[_0x9555('0x55')]['destroy']({'where':{'ListId':_0x28b233[_0x9555('0x31')][_0x9555('0x62')],'CampaignId':_0x28b233['params']['id']}})[_0x9555('0x23')](function(){return _0x406e3d;});}})[_0x9555('0x23')](respondWithStatusCode(_0x5cafb1,null))['catch'](handleError(_0x5cafb1,null));};exports['getBlackLists']=function(_0x40924a,_0x5792d4,_0x3892ac){var _0x38db97={'raw':!![],'where':{}};var _0x2b40d3={};var _0x4d96a3={'count':0x0,'rows':[]};return db['Campaign'][_0x9555('0x54')]({'where':{'id':_0x40924a[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x5792d4,null))[_0x9555('0x23')](function(_0x261a45){if(_0x261a45){_0x2b40d3['model']=_[_0x9555('0x32')](db['CmList'][_0x9555('0x2c')]);_0x2b40d3[_0x9555('0x31')]=_['keys'](_0x40924a[_0x9555('0x31')]);_0x2b40d3[_0x9555('0x33')]=_[_0x9555('0x35')](_0x2b40d3[_0x9555('0x2f')],_0x2b40d3[_0x9555('0x31')]);_0x38db97[_0x9555('0x34')]=_[_0x9555('0x35')](_0x2b40d3['model'],qs['fields'](_0x40924a['query'][_0x9555('0x36')]));_0x38db97[_0x9555('0x34')]=_0x38db97[_0x9555('0x34')][_0x9555('0x37')]?_0x38db97[_0x9555('0x34')]:_0x2b40d3[_0x9555('0x2f')];if(!_0x40924a[_0x9555('0x31')][_0x9555('0x38')](_0x9555('0x39'))){_0x38db97['limit']=qs[_0x9555('0x1e')](_0x40924a['query'][_0x9555('0x1e')]);_0x38db97['offset']=qs[_0x9555('0x1d')](_0x40924a[_0x9555('0x31')][_0x9555('0x1d')]);}_0x38db97[_0x9555('0x56')]=qs['sort'](_0x40924a[_0x9555('0x31')][_0x9555('0x3a')]);_0x38db97['where']=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x40924a[_0x9555('0x31')],_0x2b40d3[_0x9555('0x33')]));_0x38db97[_0x9555('0x3b')]['CampaignId']=_0x261a45['id'];if(_0x40924a['query'][_0x9555('0x3c')]){_0x38db97['where']=_[_0x9555('0x3d')](_0x38db97[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x38db97['attributes'],function(_0x59c7d9){var _0x8b3d03={};_0x8b3d03[_0x59c7d9]={'$like':'%'+_0x40924a[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x8b3d03;})});}_0x38db97=_[_0x9555('0x3d')]({},_0x38db97,_0x40924a['options']);return db[_0x9555('0x60')]['count']({'where':_0x38db97['where']})[_0x9555('0x23')](function(_0x174a7a){_0x4d96a3['count']=_0x174a7a;if(_0x40924a[_0x9555('0x31')][_0x9555('0x3f')]){_0x38db97[_0x9555('0x4c')]=[{'all':!![]}];}return db[_0x9555('0x60')]['findAll'](_0x38db97);})[_0x9555('0x23')](function(_0x3f7d59){_0x4d96a3['rows']=_0x3f7d59;return _0x4d96a3;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x5792d4,_0x38db97))[_0x9555('0x41')](handleError(_0x5792d4,null));};exports[_0x9555('0x7f')]=function(_0x1ec83f,_0x3967cc,_0x30561e){var _0x2ea255,_0x38f4c3;return db['Campaign'][_0x9555('0x48')]({'where':{'id':_0x1ec83f[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x3967cc,null))['then'](function(_0x162dcd){if(_0x162dcd){_0x38f4c3=_0x162dcd;return _0x162dcd[_0x9555('0x7f')](_0x1ec83f[_0x9555('0x45')]['ids'],_[_0x9555('0x4d')](_0x1ec83f[_0x9555('0x45')],[_0x9555('0x62'),'id'])||{});}return null;})['spread'](function(_0xb5fc31){var _0x44f023;_0x2ea255=_0xb5fc31||[];var _0x159c27=[];if(_0xb5fc31){for(var _0x53ce0a=0x0;_0x53ce0a<_0xb5fc31[_0x9555('0x37')];_0x53ce0a+=0x1){var _0x195257=_0xb5fc31[_0x53ce0a][_0x9555('0x24')]({'plain':!![]});_0x44f023=squel['insert']()[_0x9555('0x66')](_0x9555('0x80'))[_0x9555('0x68')]([_0x9555('0x6c'),_0x9555('0x69'),'ListId',_0x9555('0x58'),_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x6c'),_0x9555('0x6c'))[_0x9555('0x6b')]('id','ContactId')[_0x9555('0x6b')](_0x195257[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x1ec83f['params']['id'][_0x9555('0x70')](),_0x9555('0x58'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4e'))['field'](_0x9555('0x6d'),_0x9555('0x4f'))[_0x9555('0x72')](_0x9555('0x73'))[_0x9555('0x3b')](_0x9555('0x74'))[_0x9555('0x3b')](_0x9555('0x81'),_0x195257[_0x9555('0x6f')][_0x9555('0x70')]())[_0x9555('0x3b')](_0x9555('0x7b')))[_0x9555('0x70')]();_0x159c27[_0x9555('0x7d')](db[_0x9555('0x7e')][_0x9555('0x31')](_0x44f023));}return BPromise[_0x9555('0x82')](_0x159c27);}})['then'](function(){return _0x2ea255;})[_0x9555('0x23')](respondWithResult(_0x3967cc,null))[_0x9555('0x41')](handleError(_0x3967cc,null));};exports[_0x9555('0x83')]=function(_0x5b876e,_0x4150e1,_0x4f2e41){return db['Campaign'][_0x9555('0x48')]({'where':{'id':_0x5b876e[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x4150e1,null))['then'](function(_0x4b9300){if(_0x4b9300){return _0x4b9300[_0x9555('0x83')](_0x5b876e['query'][_0x9555('0x62')]);}})[_0x9555('0x23')](function(_0x474d37){if(_0x474d37){return db['CmHopperBlack'][_0x9555('0x22')]({'where':{'ListId':_0x5b876e[_0x9555('0x31')]['ids'],'CampaignId':_0x5b876e[_0x9555('0x42')]['id']}})[_0x9555('0x23')](function(){return _0x474d37;});}})[_0x9555('0x23')](respondWithStatusCode(_0x4150e1,null))[_0x9555('0x41')](handleError(_0x4150e1,null));}; \ No newline at end of file +var _0x1c75=['bluebird','mustache','util','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','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','name','send','index','Campaign','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','filter','merge','count','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','CmHopper','CmHopperHistory','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x1c75,0x82));var _0x51c7=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0x1c75[_0x4ba8c3];return _0xf65364;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51c7('0x0'));var zipdir=require(_0x51c7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51c7('0x2'));var moment=require(_0x51c7('0x3'));var BPromise=require(_0x51c7('0x4'));var Mustache=require(_0x51c7('0x5'));var util=require(_0x51c7('0x6'));var path=require('path');var sox=require(_0x51c7('0x7'));var csv=require(_0x51c7('0x8'));var ejs=require(_0x51c7('0x9'));var fs=require('fs');var _=require(_0x51c7('0xa'));var squel=require(_0x51c7('0xb'));var crypto=require('crypto');var jsforce=require(_0x51c7('0xc'));var deskjs=require(_0x51c7('0xd'));var toCsv=require(_0x51c7('0x8'));var querystring=require(_0x51c7('0xe'));var Papa=require(_0x51c7('0xf'));var Redis=require(_0x51c7('0x10'));var authService=require(_0x51c7('0x11'));var qs=require(_0x51c7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51c7('0x13'));var logger=require(_0x51c7('0x14'))(_0x51c7('0x15'));var utils=require(_0x51c7('0x16'));var config=require('../../config/environment');var db=require(_0x51c7('0x17'))['db'];function respondWithStatusCode(_0x1766bb,_0x3ddb08){_0x3ddb08=_0x3ddb08||0xcc;return function(_0x226747){if(_0x226747){return _0x1766bb[_0x51c7('0x18')](_0x3ddb08);}return _0x1766bb[_0x51c7('0x19')](_0x3ddb08)[_0x51c7('0x1a')]();};}function respondWithResult(_0x108a1a,_0x493aa9){_0x493aa9=_0x493aa9||0xc8;return function(_0x4145f2){if(_0x4145f2){return _0x108a1a['status'](_0x493aa9)[_0x51c7('0x1b')](_0x4145f2);}};}function respondWithFilteredResult(_0x1b3f3e,_0x433e75){return function(_0x8ad923){if(_0x8ad923){var _0x5c0d17=_0x8ad923['count'],_0x57532e=_0x433e75[_0x51c7('0x1c')],_0x26fd89=_0x433e75[_0x51c7('0x1c')]+_0x433e75[_0x51c7('0x1d')],_0x4662f9;if(_0x26fd89>=_0x5c0d17){_0x26fd89=_0x5c0d17;_0x4662f9=0xc8;}else{_0x4662f9=0xce;}_0x1b3f3e['status'](_0x4662f9);return _0x1b3f3e[_0x51c7('0x1e')]('Content-Range',_0x57532e+'-'+_0x26fd89+'/'+_0x5c0d17)[_0x51c7('0x1b')](_0x8ad923);}return null;};}function patchUpdates(_0x4c18bb){return function(_0xd75ad8){try{jsonpatch[_0x51c7('0x1f')](_0xd75ad8,_0x4c18bb,!![]);}catch(_0x86b728){return BPromise[_0x51c7('0x20')](_0x86b728);}return _0xd75ad8['save']();};}function saveUpdates(_0xa1e232,_0xb7babf){return function(_0x4e3060){if(_0x4e3060){return _0x4e3060[_0x51c7('0x21')](_0xa1e232)[_0x51c7('0x22')](function(_0x1d0b48){return _0x1d0b48;});}return null;};}function removeEntity(_0x22eedc,_0x30ba6e){return function(_0x5f2fac){if(_0x5f2fac){return _0x5f2fac[_0x51c7('0x23')]()['then'](function(){var _0x140d74=_0x5f2fac[_0x51c7('0x24')]({'plain':!![]});var _0x1c8ca6='IvrCampaigns';return db[_0x51c7('0x25')]['destroy']({'where':{'type':_0x1c8ca6,'resourceId':_0x140d74['id']}})[_0x51c7('0x22')](function(){return _0x5f2fac;});})['then'](function(){_0x22eedc[_0x51c7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30bf37,_0x362788){return function(_0x14907c){if(!_0x14907c){_0x30bf37[_0x51c7('0x18')](0x194);}return _0x14907c;};}function handleError(_0x4b8c94,_0xca144c){_0xca144c=_0xca144c||0x1f4;return function(_0x509085){logger['error'](_0x509085['stack']);if(_0x509085[_0x51c7('0x26')]){delete _0x509085['name'];}_0x4b8c94[_0x51c7('0x19')](_0xca144c)[_0x51c7('0x27')](_0x509085);};}exports[_0x51c7('0x28')]=function(_0x42ee4c,_0x41498f){var _0x49e963={},_0x14b33c={},_0x551da7={'count':0x0,'rows':[]};var _0x4c342c=_['map'](db[_0x51c7('0x29')][_0x51c7('0x2a')],function(_0x45e4f4){return{'name':_0x45e4f4[_0x51c7('0x2b')],'type':_0x45e4f4[_0x51c7('0x2c')]['key']};});_0x14b33c[_0x51c7('0x2d')]=_[_0x51c7('0x2e')](_0x4c342c,_0x51c7('0x26'));_0x14b33c[_0x51c7('0x2f')]=_['keys'](_0x42ee4c['query']);_0x14b33c['filters']=_['intersection'](_0x14b33c[_0x51c7('0x2d')],_0x14b33c[_0x51c7('0x2f')]);_0x49e963[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x14b33c[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x42ee4c[_0x51c7('0x2f')][_0x51c7('0x32')]));_0x49e963[_0x51c7('0x30')]=_0x49e963[_0x51c7('0x30')][_0x51c7('0x33')]?_0x49e963[_0x51c7('0x30')]:_0x14b33c['model'];if(!_0x42ee4c['query']['hasOwnProperty'](_0x51c7('0x34'))){_0x49e963[_0x51c7('0x1d')]=qs[_0x51c7('0x1d')](_0x42ee4c[_0x51c7('0x2f')]['limit']);_0x49e963['offset']=qs[_0x51c7('0x1c')](_0x42ee4c[_0x51c7('0x2f')][_0x51c7('0x1c')]);}_0x49e963[_0x51c7('0x35')]=qs[_0x51c7('0x36')](_0x42ee4c[_0x51c7('0x2f')][_0x51c7('0x36')]);_0x49e963['where']=qs[_0x51c7('0x37')](_[_0x51c7('0x38')](_0x42ee4c[_0x51c7('0x2f')],_0x14b33c[_0x51c7('0x37')]),_0x4c342c);if(_0x42ee4c[_0x51c7('0x2f')]['filter']){_0x49e963[_0x51c7('0x39')]=_['merge'](_0x49e963['where'],{'$or':_[_0x51c7('0x2e')](_0x4c342c,function(_0x2631e1){if(_0x2631e1[_0x51c7('0x2c')]!=='VIRTUAL'){var _0x1ed4c5={};_0x1ed4c5[_0x2631e1[_0x51c7('0x26')]]={'$like':'%'+_0x42ee4c[_0x51c7('0x2f')][_0x51c7('0x3a')]+'%'};return _0x1ed4c5;}})});}_0x49e963=_[_0x51c7('0x3b')]({},_0x49e963,_0x42ee4c['options']);var _0x54d78b={'where':_0x49e963['where']};return db[_0x51c7('0x29')][_0x51c7('0x3c')](_0x54d78b)[_0x51c7('0x22')](function(_0xb2fbbe){_0x551da7[_0x51c7('0x3c')]=_0xb2fbbe;if(_0x42ee4c[_0x51c7('0x2f')]['includeAll']){_0x49e963[_0x51c7('0x3d')]=[{'all':!![]}];}return db[_0x51c7('0x29')][_0x51c7('0x3e')](_0x49e963);})[_0x51c7('0x22')](function(_0x5e05f7){_0x551da7[_0x51c7('0x3f')]=_0x5e05f7;return _0x551da7;})['then'](respondWithFilteredResult(_0x41498f,_0x49e963))[_0x51c7('0x40')](handleError(_0x41498f,null));};exports[_0x51c7('0x41')]=function(_0x4041b2,_0x56b90d){var _0x2fedf2={'raw':![],'where':{'id':_0x4041b2[_0x51c7('0x42')]['id']}},_0x219968={};_0x219968[_0x51c7('0x2d')]=_[_0x51c7('0x43')](db[_0x51c7('0x29')][_0x51c7('0x2a')]);_0x219968[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x4041b2[_0x51c7('0x2f')]);_0x219968[_0x51c7('0x37')]=_[_0x51c7('0x31')](_0x219968[_0x51c7('0x2d')],_0x219968['query']);_0x2fedf2['attributes']=_[_0x51c7('0x31')](_0x219968[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x4041b2[_0x51c7('0x2f')][_0x51c7('0x32')]));_0x2fedf2[_0x51c7('0x30')]=_0x2fedf2[_0x51c7('0x30')]['length']?_0x2fedf2[_0x51c7('0x30')]:_0x219968['model'];if(_0x4041b2['query'][_0x51c7('0x44')]){_0x2fedf2[_0x51c7('0x3d')]=[{'all':!![]}];}_0x2fedf2=_[_0x51c7('0x3b')]({},_0x2fedf2,_0x4041b2[_0x51c7('0x45')]);return db[_0x51c7('0x29')][_0x51c7('0x46')](_0x2fedf2)[_0x51c7('0x22')](handleEntityNotFound(_0x56b90d,null))['then'](respondWithResult(_0x56b90d,null))[_0x51c7('0x40')](handleError(_0x56b90d,null));};exports[_0x51c7('0x47')]=function(_0x37d29b,_0x4d3b31){return db[_0x51c7('0x29')][_0x51c7('0x47')](_0x37d29b[_0x51c7('0x48')],{})[_0x51c7('0x22')](function(_0x26a0f9){var _0x58e5b5=_0x37d29b[_0x51c7('0x49')][_0x51c7('0x24')]({'plain':!![]});if(!_0x58e5b5)throw new Error(_0x51c7('0x4a'));if(_0x58e5b5[_0x51c7('0x4b')]===_0x51c7('0x49')){var _0x4be92c=_0x26a0f9['get']({'plain':!![]});var _0x228f2c=_0x51c7('0x4c');return db[_0x51c7('0x4d')][_0x51c7('0x46')]({'where':{'name':_0x228f2c,'userProfileId':_0x58e5b5[_0x51c7('0x4e')]},'raw':!![]})['then'](function(_0x3ac180){if(_0x3ac180&&_0x3ac180[_0x51c7('0x4f')]===0x0){return db[_0x51c7('0x25')]['create']({'name':_0x4be92c[_0x51c7('0x26')],'resourceId':_0x4be92c['id'],'type':_0x3ac180[_0x51c7('0x26')],'sectionId':_0x3ac180['id']},{})[_0x51c7('0x22')](function(){return _0x26a0f9;});}else{return _0x26a0f9;}})[_0x51c7('0x40')](function(_0x146922){logger[_0x51c7('0x50')](_0x51c7('0x51'),_0x146922);throw _0x146922;});}return _0x26a0f9;})[_0x51c7('0x22')](respondWithResult(_0x4d3b31,0xc9))[_0x51c7('0x40')](handleError(_0x4d3b31,null));};exports[_0x51c7('0x52')]=function(_0x577f75,_0x259323){var _0x290c4b={'where':{'id':_0x577f75['params']['id']}},_0x9050da={};_0x9050da['model']=_[_0x51c7('0x43')](db[_0x51c7('0x29')]['rawAttributes']);_0x290c4b[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x9050da[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x577f75['query'][_0x51c7('0x32')]));_0x290c4b[_0x51c7('0x30')]=_0x290c4b[_0x51c7('0x30')][_0x51c7('0x33')]?_0x290c4b[_0x51c7('0x30')]:_0x9050da[_0x51c7('0x2d')];if(_0x577f75[_0x51c7('0x2f')][_0x51c7('0x44')]){_0x290c4b['include']=[{'all':!![]}];}_0x290c4b=_['merge']({},_0x290c4b,_0x577f75[_0x51c7('0x45')]);return db[_0x51c7('0x29')]['find'](_0x290c4b)['then'](handleEntityNotFound(_0x259323,null))[_0x51c7('0x22')](function(_0x42a3f6){if(_0x42a3f6){var _0x5efae5=_0x42a3f6[_0x51c7('0x24')]({'plain':!![]});_0x5efae5=qs[_0x51c7('0x53')](_0x5efae5,['id','createdAt',_0x51c7('0x54')]);_0x577f75[_0x51c7('0x48')]=_[_0x51c7('0x53')](_0x577f75[_0x51c7('0x48')],['id',_0x51c7('0x55'),_0x51c7('0x54')]);return db[_0x51c7('0x29')]['create'](_[_0x51c7('0x3b')](_0x5efae5,_0x577f75[_0x51c7('0x48')]),{'include':_0x577f75[_0x51c7('0x2f')][_0x51c7('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x11924a){var _0x5dadb0=_0x577f75['user'][_0x51c7('0x24')]({'plain':!![]});if(!_0x5dadb0)throw new Error(_0x51c7('0x4a'));if(_0x5dadb0[_0x51c7('0x4b')]===_0x51c7('0x49')){var _0x168ed8=_0x11924a[_0x51c7('0x24')]({'plain':!![]});var _0x7e263c=_0x51c7('0x4c');return db[_0x51c7('0x4d')][_0x51c7('0x46')]({'where':{'name':_0x7e263c,'userProfileId':_0x5dadb0[_0x51c7('0x4e')]},'raw':!![]})['then'](function(_0x2fdedd){if(_0x2fdedd&&_0x2fdedd[_0x51c7('0x4f')]===0x0){return db[_0x51c7('0x25')][_0x51c7('0x47')]({'name':_0x168ed8[_0x51c7('0x26')],'resourceId':_0x168ed8['id'],'type':_0x2fdedd[_0x51c7('0x26')],'sectionId':_0x2fdedd['id']},{})[_0x51c7('0x22')](function(){return _0x11924a;});}else{return _0x11924a;}})[_0x51c7('0x40')](function(_0x57cfcf){logger[_0x51c7('0x50')](_0x51c7('0x51'),_0x57cfcf);throw _0x57cfcf;});}return _0x11924a;});}})['then'](respondWithResult(_0x259323,0xc9))[_0x51c7('0x40')](handleError(_0x259323,null));};exports[_0x51c7('0x21')]=function(_0x579d28,_0x2137f7){if(_0x579d28[_0x51c7('0x48')]['id']){delete _0x579d28['body']['id'];}return db['Campaign'][_0x51c7('0x46')]({'where':{'id':_0x579d28[_0x51c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x2137f7,null))[_0x51c7('0x22')](saveUpdates(_0x579d28[_0x51c7('0x48')],null))[_0x51c7('0x22')](respondWithResult(_0x2137f7,null))[_0x51c7('0x40')](handleError(_0x2137f7,null));};exports[_0x51c7('0x23')]=function(_0x20782f,_0x4ee77a){return db[_0x51c7('0x29')][_0x51c7('0x46')]({'where':{'id':_0x20782f[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x4ee77a,null))[_0x51c7('0x22')](removeEntity(_0x4ee77a,null))[_0x51c7('0x40')](handleError(_0x4ee77a,null));};exports[_0x51c7('0x56')]=function(_0x53180f,_0x5dce2f,_0x56a07a){var _0x479047={'raw':!![],'where':{}};var _0x3c299a={};var _0x49b87a={'count':0x0,'rows':[]};return db['Campaign'][_0x51c7('0x57')]({'where':{'id':_0x53180f[_0x51c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x5dce2f,null))['then'](function(_0x52132b){if(_0x52132b){_0x3c299a[_0x51c7('0x2d')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3c299a[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x53180f[_0x51c7('0x2f')]);_0x3c299a[_0x51c7('0x37')]=_[_0x51c7('0x31')](_0x3c299a[_0x51c7('0x2d')],_0x3c299a['query']);_0x479047[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x3c299a[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x53180f[_0x51c7('0x2f')][_0x51c7('0x32')]));_0x479047[_0x51c7('0x30')]=_0x479047['attributes'][_0x51c7('0x33')]?_0x479047[_0x51c7('0x30')]:_0x3c299a[_0x51c7('0x2d')];if(!_0x53180f[_0x51c7('0x2f')][_0x51c7('0x58')](_0x51c7('0x34'))){_0x479047['limit']=qs[_0x51c7('0x1d')](_0x53180f[_0x51c7('0x2f')][_0x51c7('0x1d')]);_0x479047[_0x51c7('0x1c')]=qs[_0x51c7('0x1c')](_0x53180f[_0x51c7('0x2f')][_0x51c7('0x1c')]);}_0x479047[_0x51c7('0x35')]=qs[_0x51c7('0x36')](_0x53180f[_0x51c7('0x2f')][_0x51c7('0x36')]);_0x479047['where']=qs[_0x51c7('0x37')](_['pick'](_0x53180f[_0x51c7('0x2f')],_0x3c299a[_0x51c7('0x37')]));_0x479047[_0x51c7('0x39')]['CampaignId']=_0x52132b['id'];if(_0x53180f[_0x51c7('0x2f')][_0x51c7('0x3a')]){_0x479047['where']=_[_0x51c7('0x3b')](_0x479047[_0x51c7('0x39')],{'$or':_[_0x51c7('0x2e')](_0x479047[_0x51c7('0x30')],function(_0x386d8e){var _0x13e34d={};_0x13e34d[_0x386d8e]={'$like':'%'+_0x53180f[_0x51c7('0x2f')][_0x51c7('0x3a')]+'%'};return _0x13e34d;})});}_0x479047=_[_0x51c7('0x3b')]({},_0x479047,_0x53180f['options']);return db[_0x51c7('0x59')][_0x51c7('0x3c')]({'where':_0x479047['where']})[_0x51c7('0x22')](function(_0xc9b3c4){_0x49b87a['count']=_0xc9b3c4;if(_0x53180f['query'][_0x51c7('0x44')]){_0x479047[_0x51c7('0x3d')]=[{'all':!![]}];}return db[_0x51c7('0x59')][_0x51c7('0x3e')](_0x479047);})[_0x51c7('0x22')](function(_0x1ae508){_0x49b87a['rows']=_0x1ae508;return _0x49b87a;});}})[_0x51c7('0x22')](respondWithFilteredResult(_0x5dce2f,_0x479047))['catch'](handleError(_0x5dce2f,null));};exports['getHopperHistories']=function(_0x1ea027,_0x325353,_0xe67016){var _0x1740b1={'raw':!![],'where':{}};var _0x3ca9a5={};var _0x6cf028={'count':0x0,'rows':[]};return db[_0x51c7('0x29')][_0x51c7('0x57')]({'where':{'id':_0x1ea027[_0x51c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x325353,null))[_0x51c7('0x22')](function(_0x1f3c3d){if(_0x1f3c3d){_0x3ca9a5['model']=_['keys'](db[_0x51c7('0x5a')][_0x51c7('0x2a')]);_0x3ca9a5[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x1ea027['query']);_0x3ca9a5[_0x51c7('0x37')]=_['intersection'](_0x3ca9a5[_0x51c7('0x2d')],_0x3ca9a5['query']);_0x1740b1[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x3ca9a5[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x1ea027['query'][_0x51c7('0x32')]));_0x1740b1[_0x51c7('0x30')]=_0x1740b1['attributes'][_0x51c7('0x33')]?_0x1740b1[_0x51c7('0x30')]:_0x3ca9a5[_0x51c7('0x2d')];if(!_0x1ea027['query'][_0x51c7('0x58')](_0x51c7('0x34'))){_0x1740b1[_0x51c7('0x1d')]=qs[_0x51c7('0x1d')](_0x1ea027[_0x51c7('0x2f')][_0x51c7('0x1d')]);_0x1740b1[_0x51c7('0x1c')]=qs[_0x51c7('0x1c')](_0x1ea027[_0x51c7('0x2f')]['offset']);}_0x1740b1[_0x51c7('0x35')]=qs[_0x51c7('0x36')](_0x1ea027[_0x51c7('0x2f')][_0x51c7('0x36')]);_0x1740b1[_0x51c7('0x39')]=qs[_0x51c7('0x37')](_[_0x51c7('0x38')](_0x1ea027['query'],_0x3ca9a5[_0x51c7('0x37')]));_0x1740b1[_0x51c7('0x39')]['CampaignId']=_0x1f3c3d['id'];if(_0x1ea027['query'][_0x51c7('0x3a')]){_0x1740b1[_0x51c7('0x39')]=_[_0x51c7('0x3b')](_0x1740b1[_0x51c7('0x39')],{'$or':_[_0x51c7('0x2e')](_0x1740b1[_0x51c7('0x30')],function(_0x4b14ed){var _0x3f1abb={};_0x3f1abb[_0x4b14ed]={'$like':'%'+_0x1ea027[_0x51c7('0x2f')][_0x51c7('0x3a')]+'%'};return _0x3f1abb;})});}_0x1740b1=_['merge']({},_0x1740b1,_0x1ea027[_0x51c7('0x45')]);return db[_0x51c7('0x5a')][_0x51c7('0x3c')]({'where':_0x1740b1[_0x51c7('0x39')]})[_0x51c7('0x22')](function(_0x4ec987){_0x6cf028[_0x51c7('0x3c')]=_0x4ec987;if(_0x1ea027['query']['includeAll']){_0x1740b1[_0x51c7('0x3d')]=[{'all':!![]}];}return db[_0x51c7('0x5a')]['findAll'](_0x1740b1);})[_0x51c7('0x22')](function(_0x1bffe1){_0x6cf028[_0x51c7('0x3f')]=_0x1bffe1;return _0x6cf028;});}})[_0x51c7('0x22')](respondWithFilteredResult(_0x325353,_0x1740b1))[_0x51c7('0x40')](handleError(_0x325353,null));};exports['getHopperFinals']=function(_0x3ade71,_0x5156cc,_0x551cf8){var _0x4b339d={'raw':!![],'where':{}};var _0x2de6e1={};var _0x28a00c={'count':0x0,'rows':[]};return db[_0x51c7('0x29')]['findOne']({'where':{'id':_0x3ade71[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x5156cc,null))['then'](function(_0x5dbaba){if(_0x5dbaba){_0x2de6e1['model']=_[_0x51c7('0x43')](db[_0x51c7('0x5b')][_0x51c7('0x2a')]);_0x2de6e1[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x3ade71[_0x51c7('0x2f')]);_0x2de6e1[_0x51c7('0x37')]=_[_0x51c7('0x31')](_0x2de6e1[_0x51c7('0x2d')],_0x2de6e1[_0x51c7('0x2f')]);_0x4b339d[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x2de6e1[_0x51c7('0x2d')],qs['fields'](_0x3ade71[_0x51c7('0x2f')][_0x51c7('0x32')]));_0x4b339d[_0x51c7('0x30')]=_0x4b339d[_0x51c7('0x30')][_0x51c7('0x33')]?_0x4b339d['attributes']:_0x2de6e1['model'];if(!_0x3ade71[_0x51c7('0x2f')][_0x51c7('0x58')]('nolimit')){_0x4b339d[_0x51c7('0x1d')]=qs[_0x51c7('0x1d')](_0x3ade71[_0x51c7('0x2f')]['limit']);_0x4b339d[_0x51c7('0x1c')]=qs[_0x51c7('0x1c')](_0x3ade71['query'][_0x51c7('0x1c')]);}_0x4b339d[_0x51c7('0x35')]=qs[_0x51c7('0x36')](_0x3ade71[_0x51c7('0x2f')][_0x51c7('0x36')]);_0x4b339d[_0x51c7('0x39')]=qs[_0x51c7('0x37')](_[_0x51c7('0x38')](_0x3ade71['query'],_0x2de6e1[_0x51c7('0x37')]));_0x4b339d[_0x51c7('0x39')][_0x51c7('0x5c')]=_0x5dbaba['id'];if(_0x3ade71[_0x51c7('0x2f')][_0x51c7('0x3a')]){_0x4b339d[_0x51c7('0x39')]=_['merge'](_0x4b339d[_0x51c7('0x39')],{'$or':_[_0x51c7('0x2e')](_0x4b339d[_0x51c7('0x30')],function(_0x497d04){var _0x374a00={};_0x374a00[_0x497d04]={'$like':'%'+_0x3ade71['query'][_0x51c7('0x3a')]+'%'};return _0x374a00;})});}_0x4b339d=_['merge']({},_0x4b339d,_0x3ade71[_0x51c7('0x45')]);return db[_0x51c7('0x5b')][_0x51c7('0x3c')]({'where':_0x4b339d['where']})[_0x51c7('0x22')](function(_0x6e1362){_0x28a00c[_0x51c7('0x3c')]=_0x6e1362;if(_0x3ade71[_0x51c7('0x2f')]['includeAll']){_0x4b339d[_0x51c7('0x3d')]=[{'all':!![]}];}return db[_0x51c7('0x5b')][_0x51c7('0x3e')](_0x4b339d);})[_0x51c7('0x22')](function(_0x2ea19b){_0x28a00c[_0x51c7('0x3f')]=_0x2ea19b;return _0x28a00c;});}})[_0x51c7('0x22')](respondWithFilteredResult(_0x5156cc,_0x4b339d))[_0x51c7('0x40')](handleError(_0x5156cc,null));};exports[_0x51c7('0x5d')]=function(_0x226654,_0x31f946,_0x1542b4){var _0x1b8a37={'raw':!![],'where':{}};var _0x54c2be={};var _0x4070f6={'count':0x0,'rows':[]};return db[_0x51c7('0x29')][_0x51c7('0x57')]({'where':{'id':_0x226654[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x31f946,null))[_0x51c7('0x22')](function(_0x2e2319){if(_0x2e2319){_0x54c2be[_0x51c7('0x2d')]=_[_0x51c7('0x43')](db[_0x51c7('0x5e')]['rawAttributes']);_0x54c2be[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x226654['query']);_0x54c2be[_0x51c7('0x37')]=_['intersection'](_0x54c2be[_0x51c7('0x2d')],_0x54c2be[_0x51c7('0x2f')]);_0x1b8a37[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x54c2be['model'],qs['fields'](_0x226654[_0x51c7('0x2f')][_0x51c7('0x32')]));_0x1b8a37[_0x51c7('0x30')]=_0x1b8a37[_0x51c7('0x30')][_0x51c7('0x33')]?_0x1b8a37[_0x51c7('0x30')]:_0x54c2be[_0x51c7('0x2d')];if(!_0x226654[_0x51c7('0x2f')]['hasOwnProperty']('nolimit')){_0x1b8a37['limit']=qs['limit'](_0x226654[_0x51c7('0x2f')]['limit']);_0x1b8a37[_0x51c7('0x1c')]=qs['offset'](_0x226654[_0x51c7('0x2f')]['offset']);}_0x1b8a37[_0x51c7('0x35')]=qs[_0x51c7('0x36')](_0x226654[_0x51c7('0x2f')]['sort']);_0x1b8a37['where']=qs['filters'](_['pick'](_0x226654['query'],_0x54c2be[_0x51c7('0x37')]));_0x1b8a37[_0x51c7('0x39')][_0x51c7('0x5c')]=_0x2e2319['id'];if(_0x226654[_0x51c7('0x2f')][_0x51c7('0x3a')]){_0x1b8a37[_0x51c7('0x39')]=_[_0x51c7('0x3b')](_0x1b8a37['where'],{'$or':_[_0x51c7('0x2e')](_0x1b8a37[_0x51c7('0x30')],function(_0x4c33fe){var _0x49827a={};_0x49827a[_0x4c33fe]={'$like':'%'+_0x226654[_0x51c7('0x2f')][_0x51c7('0x3a')]+'%'};return _0x49827a;})});}_0x1b8a37=_[_0x51c7('0x3b')]({},_0x1b8a37,_0x226654[_0x51c7('0x45')]);return db[_0x51c7('0x5e')][_0x51c7('0x3c')]({'where':_0x1b8a37['where']})[_0x51c7('0x22')](function(_0x2601cc){_0x4070f6['count']=_0x2601cc;if(_0x226654['query'][_0x51c7('0x44')]){_0x1b8a37['include']=[{'all':!![]}];}return db[_0x51c7('0x5e')]['findAll'](_0x1b8a37);})[_0x51c7('0x22')](function(_0x280066){_0x4070f6[_0x51c7('0x3f')]=_0x280066;return _0x4070f6;});}})['then'](respondWithFilteredResult(_0x31f946,_0x1b8a37))[_0x51c7('0x40')](handleError(_0x31f946,null));};exports['getLists']=function(_0x10305c,_0x2c490a,_0x218238){var _0x2c9b4e={};var _0x1270e1={};var _0xf6b169;var _0x46f89d;return db['Campaign'][_0x51c7('0x57')]({'where':{'id':_0x10305c[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x2c490a,null))[_0x51c7('0x22')](function(_0x2f1ed0){if(_0x2f1ed0){_0xf6b169=_0x2f1ed0;_0x1270e1[_0x51c7('0x2d')]=_[_0x51c7('0x43')](db[_0x51c7('0x5f')][_0x51c7('0x2a')]);_0x1270e1[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x10305c[_0x51c7('0x2f')]);_0x1270e1[_0x51c7('0x37')]=_['intersection'](_0x1270e1[_0x51c7('0x2d')],_0x1270e1[_0x51c7('0x2f')]);_0x2c9b4e[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x1270e1[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x10305c[_0x51c7('0x2f')][_0x51c7('0x32')]));_0x2c9b4e[_0x51c7('0x30')]=_0x2c9b4e[_0x51c7('0x30')][_0x51c7('0x33')]?_0x2c9b4e[_0x51c7('0x30')]:_0x1270e1['model'];_0x2c9b4e[_0x51c7('0x35')]=qs['sort'](_0x10305c[_0x51c7('0x2f')][_0x51c7('0x36')]);_0x2c9b4e[_0x51c7('0x39')]=qs['filters'](_[_0x51c7('0x38')](_0x10305c[_0x51c7('0x2f')],_0x1270e1['filters']));if(_0x10305c[_0x51c7('0x2f')]['filter']){_0x2c9b4e[_0x51c7('0x39')]=_[_0x51c7('0x3b')](_0x2c9b4e[_0x51c7('0x39')],{'$or':_[_0x51c7('0x2e')](_0x2c9b4e[_0x51c7('0x30')],function(_0x28f167){var _0xcac30f={};_0xcac30f[_0x28f167]={'$like':'%'+_0x10305c[_0x51c7('0x2f')][_0x51c7('0x3a')]+'%'};return _0xcac30f;})});}_0x2c9b4e=_[_0x51c7('0x3b')]({},_0x2c9b4e,_0x10305c[_0x51c7('0x45')]);return _0xf6b169[_0x51c7('0x60')](_0x2c9b4e);}})[_0x51c7('0x22')](function(_0x5bb6fc){if(_0x5bb6fc){_0x46f89d=_0x5bb6fc['length'];if(!_0x10305c['query']['hasOwnProperty'](_0x51c7('0x34'))){_0x2c9b4e[_0x51c7('0x1d')]=qs[_0x51c7('0x1d')](_0x10305c[_0x51c7('0x2f')][_0x51c7('0x1d')]);_0x2c9b4e[_0x51c7('0x1c')]=qs[_0x51c7('0x1c')](_0x10305c['query'][_0x51c7('0x1c')]);}return _0xf6b169['getLists'](_0x2c9b4e);}})['then'](function(_0x1b0f47){if(_0x1b0f47){return _0x1b0f47?{'count':_0x46f89d,'rows':_0x1b0f47}:null;}})[_0x51c7('0x22')](respondWithResult(_0x2c490a,null))[_0x51c7('0x40')](handleError(_0x2c490a,null));};exports['addLists']=function(_0x338479,_0x3f9488,_0x5ca7c6){var _0x398ca5,_0x1d73cf;return db[_0x51c7('0x29')][_0x51c7('0x46')]({'where':{'id':_0x338479['params']['id']}})['then'](handleEntityNotFound(_0x3f9488,null))[_0x51c7('0x22')](function(_0x413507){if(_0x413507){_0x1d73cf=_0x413507;return _0x413507[_0x51c7('0x61')](_0x338479[_0x51c7('0x48')][_0x51c7('0x62')],_[_0x51c7('0x53')](_0x338479[_0x51c7('0x48')],[_0x51c7('0x62'),'id'])||{});}return null;})[_0x51c7('0x63')](function(_0x1241e4){var _0xbd47f3;_0x398ca5=_0x1241e4||[];var _0x5995b0=[];if(_0x1241e4){for(var _0x25354a=0x0;_0x25354a<_0x1241e4[_0x51c7('0x33')];_0x25354a+=0x1){var _0x40d5e6=_0x1241e4[_0x25354a][_0x51c7('0x24')]({'plain':!![]});_0x1d73cf[_0x51c7('0x64')]=_0x338479['body']['dialCheckDuplicateType']?_0x338479[_0x51c7('0x48')][_0x51c7('0x64')]:_0x1d73cf[_0x51c7('0x64')];switch(_0x1d73cf[_0x51c7('0x64')]){case _0x51c7('0x65'):_0xbd47f3=squel[_0x51c7('0x66')]()[_0x51c7('0x67')](_0x51c7('0x68'))[_0x51c7('0x69')]([_0x51c7('0x6a'),_0x51c7('0x6b'),_0x51c7('0x6c'),_0x51c7('0x6d'),_0x51c7('0x5c'),_0x51c7('0x55'),_0x51c7('0x54')],squel[_0x51c7('0x6e')]()[_0x51c7('0x6f')](_0x51c7('0x6a'),_0x51c7('0x6a'))[_0x51c7('0x6f')](_0x51c7('0x70'),'scheduledAt')[_0x51c7('0x6f')]('id',_0x51c7('0x6c'))[_0x51c7('0x6f')](_0x40d5e6[_0x51c7('0x71')]['toString'](),_0x51c7('0x6d'))[_0x51c7('0x6f')](_0x338479[_0x51c7('0x42')]['id'][_0x51c7('0x72')](),_0x51c7('0x5c'))[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x55'))[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x54'))[_0x51c7('0x73')](_0x51c7('0x74'))[_0x51c7('0x39')](_0x51c7('0x75'))[_0x51c7('0x39')]('ListId\x20=\x20?',_0x40d5e6[_0x51c7('0x71')][_0x51c7('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x51c7('0x39')](_0x51c7('0x76'),squel['select']()['field'](_0x51c7('0x77'))['from'](_0x51c7('0x78'))[_0x51c7('0x39')](_0x51c7('0x79'),_0x338479[_0x51c7('0x42')]['id'][_0x51c7('0x72')]()))[_0x51c7('0x39')](_0x51c7('0x76'),squel['select']()[_0x51c7('0x6f')](_0x51c7('0x7a'))['from'](_0x51c7('0x68'))['where']('CampaignId\x20=\x20?',_0x338479[_0x51c7('0x42')]['id'][_0x51c7('0x72')]())))[_0x51c7('0x72')]();break;case _0x51c7('0x7b'):_0xbd47f3=squel[_0x51c7('0x66')]()[_0x51c7('0x67')](_0x51c7('0x68'))[_0x51c7('0x69')]([_0x51c7('0x6a'),_0x51c7('0x6b'),_0x51c7('0x6c'),_0x51c7('0x6d'),'CampaignId',_0x51c7('0x55'),_0x51c7('0x54')],squel['select']()[_0x51c7('0x6f')](_0x51c7('0x6a'),'phone')[_0x51c7('0x6f')]('NOW()',_0x51c7('0x6b'))[_0x51c7('0x6f')]('id',_0x51c7('0x6c'))[_0x51c7('0x6f')](_0x40d5e6[_0x51c7('0x71')][_0x51c7('0x72')](),'ListId')['field'](_0x338479['params']['id'][_0x51c7('0x72')](),_0x51c7('0x5c'))[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x55'))[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x54'))[_0x51c7('0x73')](_0x51c7('0x74'))['where'](_0x51c7('0x75'))['where'](_0x51c7('0x7c'),_0x40d5e6[_0x51c7('0x71')]['toString']())[_0x51c7('0x39')](_0x51c7('0x7d'))[_0x51c7('0x39')](_0x51c7('0x76'),squel['select']()[_0x51c7('0x6f')](_0x51c7('0x7a'))[_0x51c7('0x73')](_0x51c7('0x68'))[_0x51c7('0x39')](_0x51c7('0x79'),_0x338479[_0x51c7('0x42')]['id'][_0x51c7('0x72')]())))[_0x51c7('0x72')]();break;default:_0xbd47f3=squel['insert']()[_0x51c7('0x67')]('cm_hopper')[_0x51c7('0x69')](['phone',_0x51c7('0x6b'),_0x51c7('0x6c'),'ListId',_0x51c7('0x5c'),'createdAt',_0x51c7('0x54')],squel['select']()[_0x51c7('0x6f')](_0x51c7('0x6a'),'phone')[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x6b'))[_0x51c7('0x6f')]('id','ContactId')[_0x51c7('0x6f')](_0x40d5e6[_0x51c7('0x71')][_0x51c7('0x72')](),'ListId')[_0x51c7('0x6f')](_0x338479[_0x51c7('0x42')]['id']['toString'](),_0x51c7('0x5c'))[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x55'))['field'](_0x51c7('0x70'),_0x51c7('0x54'))[_0x51c7('0x73')](_0x51c7('0x74'))[_0x51c7('0x39')](_0x51c7('0x75'))[_0x51c7('0x39')](_0x51c7('0x7c'),_0x40d5e6['CmListId'][_0x51c7('0x72')]())[_0x51c7('0x39')](_0x51c7('0x7d')))[_0x51c7('0x72')]();}_0x5995b0[_0x51c7('0x7e')](db[_0x51c7('0x7f')]['query'](_0xbd47f3));}return BPromise[_0x51c7('0x80')](_0x5995b0);}})[_0x51c7('0x22')](function(){return _0x398ca5;})[_0x51c7('0x22')](respondWithResult(_0x3f9488,null))[_0x51c7('0x40')](handleError(_0x3f9488,null));};exports[_0x51c7('0x81')]=function(_0x9f9d8c,_0x370dd3,_0x2ff145){return db[_0x51c7('0x29')][_0x51c7('0x46')]({'where':{'id':_0x9f9d8c['params']['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x370dd3,null))[_0x51c7('0x22')](function(_0xf80898){if(_0xf80898){return _0xf80898[_0x51c7('0x81')](_0x9f9d8c[_0x51c7('0x2f')][_0x51c7('0x62')]);}})[_0x51c7('0x22')](function(_0x129c04){if(_0x129c04){return db[_0x51c7('0x59')][_0x51c7('0x23')]({'where':{'ListId':_0x9f9d8c[_0x51c7('0x2f')][_0x51c7('0x62')],'CampaignId':_0x9f9d8c[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](function(){return _0x129c04;});}})['then'](respondWithStatusCode(_0x370dd3,null))['catch'](handleError(_0x370dd3,null));};exports[_0x51c7('0x82')]=function(_0x197927,_0x1b93f7,_0x1ae918){var _0x16c99b={'raw':!![],'where':{}};var _0x449bb6={};var _0x254717={'count':0x0,'rows':[]};return db[_0x51c7('0x29')][_0x51c7('0x57')]({'where':{'id':_0x197927[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x1b93f7,null))['then'](function(_0x3fc5f4){if(_0x3fc5f4){_0x449bb6[_0x51c7('0x2d')]=_[_0x51c7('0x43')](db[_0x51c7('0x5f')][_0x51c7('0x2a')]);_0x449bb6[_0x51c7('0x2f')]=_[_0x51c7('0x43')](_0x197927[_0x51c7('0x2f')]);_0x449bb6[_0x51c7('0x37')]=_[_0x51c7('0x31')](_0x449bb6['model'],_0x449bb6[_0x51c7('0x2f')]);_0x16c99b[_0x51c7('0x30')]=_[_0x51c7('0x31')](_0x449bb6['model'],qs[_0x51c7('0x32')](_0x197927['query'][_0x51c7('0x32')]));_0x16c99b[_0x51c7('0x30')]=_0x16c99b[_0x51c7('0x30')][_0x51c7('0x33')]?_0x16c99b[_0x51c7('0x30')]:_0x449bb6['model'];if(!_0x197927[_0x51c7('0x2f')][_0x51c7('0x58')](_0x51c7('0x34'))){_0x16c99b['limit']=qs[_0x51c7('0x1d')](_0x197927[_0x51c7('0x2f')][_0x51c7('0x1d')]);_0x16c99b[_0x51c7('0x1c')]=qs[_0x51c7('0x1c')](_0x197927[_0x51c7('0x2f')][_0x51c7('0x1c')]);}_0x16c99b[_0x51c7('0x35')]=qs[_0x51c7('0x36')](_0x197927['query']['sort']);_0x16c99b['where']=qs[_0x51c7('0x37')](_[_0x51c7('0x38')](_0x197927['query'],_0x449bb6[_0x51c7('0x37')]));_0x16c99b[_0x51c7('0x39')]['CampaignId']=_0x3fc5f4['id'];if(_0x197927[_0x51c7('0x2f')][_0x51c7('0x3a')]){_0x16c99b[_0x51c7('0x39')]=_['merge'](_0x16c99b[_0x51c7('0x39')],{'$or':_['map'](_0x16c99b['attributes'],function(_0x2fb166){var _0x3f1d34={};_0x3f1d34[_0x2fb166]={'$like':'%'+_0x197927[_0x51c7('0x2f')][_0x51c7('0x3a')]+'%'};return _0x3f1d34;})});}_0x16c99b=_[_0x51c7('0x3b')]({},_0x16c99b,_0x197927[_0x51c7('0x45')]);return db[_0x51c7('0x5f')][_0x51c7('0x3c')]({'where':_0x16c99b['where']})[_0x51c7('0x22')](function(_0x28555e){_0x254717[_0x51c7('0x3c')]=_0x28555e;if(_0x197927['query'][_0x51c7('0x44')]){_0x16c99b[_0x51c7('0x3d')]=[{'all':!![]}];}return db[_0x51c7('0x5f')]['findAll'](_0x16c99b);})[_0x51c7('0x22')](function(_0xaa3698){_0x254717[_0x51c7('0x3f')]=_0xaa3698;return _0x254717;});}})['then'](respondWithFilteredResult(_0x1b93f7,_0x16c99b))['catch'](handleError(_0x1b93f7,null));};exports['addBlackLists']=function(_0x361324,_0x13b72a,_0x124d86){var _0x1471ba,_0x46b4f;return db['Campaign']['find']({'where':{'id':_0x361324[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x13b72a,null))[_0x51c7('0x22')](function(_0x579e39){if(_0x579e39){_0x46b4f=_0x579e39;return _0x579e39[_0x51c7('0x83')](_0x361324[_0x51c7('0x48')]['ids'],_[_0x51c7('0x53')](_0x361324[_0x51c7('0x48')],[_0x51c7('0x62'),'id'])||{});}return null;})[_0x51c7('0x63')](function(_0x2a5ce3){var _0x1e26e2;_0x1471ba=_0x2a5ce3||[];var _0x31847c=[];if(_0x2a5ce3){for(var _0x2c821e=0x0;_0x2c821e<_0x2a5ce3[_0x51c7('0x33')];_0x2c821e+=0x1){var _0x212906=_0x2a5ce3[_0x2c821e][_0x51c7('0x24')]({'plain':!![]});_0x1e26e2=squel['insert']()[_0x51c7('0x67')](_0x51c7('0x84'))[_0x51c7('0x69')]([_0x51c7('0x6a'),_0x51c7('0x6c'),_0x51c7('0x6d'),'CampaignId',_0x51c7('0x55'),'updatedAt'],squel[_0x51c7('0x6e')]()['field'](_0x51c7('0x6a'),_0x51c7('0x6a'))['field']('id',_0x51c7('0x6c'))['field'](_0x212906[_0x51c7('0x71')]['toString'](),_0x51c7('0x6d'))[_0x51c7('0x6f')](_0x361324[_0x51c7('0x42')]['id'][_0x51c7('0x72')](),_0x51c7('0x5c'))[_0x51c7('0x6f')](_0x51c7('0x70'),_0x51c7('0x55'))[_0x51c7('0x6f')]('NOW()',_0x51c7('0x54'))[_0x51c7('0x73')]('cm_contacts')[_0x51c7('0x39')](_0x51c7('0x75'))[_0x51c7('0x39')](_0x51c7('0x7c'),_0x212906[_0x51c7('0x71')][_0x51c7('0x72')]())[_0x51c7('0x39')](_0x51c7('0x7d')))['toString']();_0x31847c['push'](db[_0x51c7('0x7f')][_0x51c7('0x2f')](_0x1e26e2));}return BPromise[_0x51c7('0x80')](_0x31847c);}})['then'](function(){return _0x1471ba;})[_0x51c7('0x22')](respondWithResult(_0x13b72a,null))[_0x51c7('0x40')](handleError(_0x13b72a,null));};exports[_0x51c7('0x85')]=function(_0x46bb0a,_0x11fe79,_0xa5ab58){return db['Campaign'][_0x51c7('0x46')]({'where':{'id':_0x46bb0a[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](handleEntityNotFound(_0x11fe79,null))[_0x51c7('0x22')](function(_0x23b268){if(_0x23b268){return _0x23b268[_0x51c7('0x85')](_0x46bb0a['query']['ids']);}})[_0x51c7('0x22')](function(_0x157d80){if(_0x157d80){return db[_0x51c7('0x5e')][_0x51c7('0x23')]({'where':{'ListId':_0x46bb0a[_0x51c7('0x2f')][_0x51c7('0x62')],'CampaignId':_0x46bb0a[_0x51c7('0x42')]['id']}})[_0x51c7('0x22')](function(){return _0x157d80;});}})[_0x51c7('0x22')](respondWithStatusCode(_0x11fe79,null))[_0x51c7('0x40')](handleError(_0x11fe79,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1de9026..17551fc 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1d6ca0,_0x399b61){var _0x2482d7=function(_0x58d987){while(--_0x58d987){_0x1d6ca0['push'](_0x1d6ca0['shift']());}};_0x2482d7(++_0x399b61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xfdc4f4,_0x34aaa3){var _0x55beae=function(_0xf33a8d){while(--_0xf33a8d){_0xfdc4f4['push'](_0xfdc4f4['shift']());}};_0x55beae(++_0x34aaa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 771fa56..8f39a7d 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(_0x555058,_0x4ffaa0){var _0x1cf606=function(_0xfc65ba){while(--_0xfc65ba){_0x555058['push'](_0x555058['shift']());}};_0x1cf606(++_0x4ffaa0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x795571,_0x33581b){var _0x315ea9=function(_0x1f702e){while(--_0x1f702e){_0x795571['push'](_0x795571['shift']());}};_0x315ea9(++_0x33581b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 342e23d..d072ab4 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 _0x93f5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addBlackLists','delete','removeLists','removeBlackLists','exports','multer','connect-timeout'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x93f5,0x10c));var _0x593f=function(_0x373a97,_0x26a9cf){_0x373a97=_0x373a97-0x0;var _0x3bb6a9=_0x93f5[_0x373a97];return _0x3bb6a9;};'use strict';var multer=require(_0x593f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x593f('0x1'));var express=require(_0x593f('0x2'));var router=express[_0x593f('0x3')]();var auth=require(_0x593f('0x4'));var interaction=require(_0x593f('0x5'));var config=require(_0x593f('0x6'));var controller=require(_0x593f('0x7'));router[_0x593f('0x8')]('/',auth[_0x593f('0x9')](),controller[_0x593f('0xa')]);router[_0x593f('0x8')](_0x593f('0xb'),auth[_0x593f('0x9')](),controller[_0x593f('0xc')]);router['get'](_0x593f('0xd'),auth[_0x593f('0x9')](),controller[_0x593f('0xe')]);router[_0x593f('0x8')]('/:id/hopper_histories',auth[_0x593f('0x9')](),controller['getHopperHistories']);router[_0x593f('0x8')]('/:id/hopper_finals',auth[_0x593f('0x9')](),controller[_0x593f('0xf')]);router[_0x593f('0x8')]('/:id/hopper_black',auth[_0x593f('0x9')](),controller[_0x593f('0x10')]);router[_0x593f('0x8')]('/:id/lists',auth[_0x593f('0x9')](),controller[_0x593f('0x11')]);router['get'](_0x593f('0x12'),auth[_0x593f('0x9')](),controller[_0x593f('0x13')]);router[_0x593f('0x14')]('/',auth[_0x593f('0x9')](),controller[_0x593f('0x15')]);router[_0x593f('0x14')](_0x593f('0x16'),auth[_0x593f('0x9')](),controller[_0x593f('0x17')]);router[_0x593f('0x14')](_0x593f('0x18'),auth['isAuthenticated'](),controller['addLists']);router[_0x593f('0x14')](_0x593f('0x12'),auth[_0x593f('0x9')](),controller[_0x593f('0x19')]);router['put'](_0x593f('0xb'),auth[_0x593f('0x9')](),controller['update']);router['delete'](_0x593f('0xb'),auth[_0x593f('0x9')](),controller['destroy']);router[_0x593f('0x1a')](_0x593f('0x18'),auth[_0x593f('0x9')](),controller[_0x593f('0x1b')]);router[_0x593f('0x1a')]('/:id/blacklists',auth[_0x593f('0x9')](),controller[_0x593f('0x1c')]);module[_0x593f('0x1d')]=router; \ No newline at end of file +var _0x05a8=['delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','/:id','get','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','create','post','clone','/:id/lists','put'];(function(_0x321e6f,_0x154d5d){var _0x15c9f5=function(_0xdd88f2){while(--_0xdd88f2){_0x321e6f['push'](_0x321e6f['shift']());}};_0x15c9f5(++_0x154d5d);}(_0x05a8,0x1d6));var _0x805a=function(_0x3ac030,_0x4ec63c){_0x3ac030=_0x3ac030-0x0;var _0x388fd0=_0x05a8[_0x3ac030];return _0x388fd0;};'use strict';var multer=require(_0x805a('0x0'));var util=require(_0x805a('0x1'));var path=require(_0x805a('0x2'));var timeout=require(_0x805a('0x3'));var express=require(_0x805a('0x4'));var router=express[_0x805a('0x5')]();var auth=require(_0x805a('0x6'));var interaction=require(_0x805a('0x7'));var config=require('../../config/environment');var controller=require(_0x805a('0x8'));router['get']('/',auth[_0x805a('0x9')](),controller[_0x805a('0xa')]);router['get'](_0x805a('0xb'),auth[_0x805a('0x9')](),controller['show']);router[_0x805a('0xc')](_0x805a('0xd'),auth[_0x805a('0x9')](),controller[_0x805a('0xe')]);router['get'](_0x805a('0xf'),auth[_0x805a('0x9')](),controller['getHopperHistories']);router[_0x805a('0xc')](_0x805a('0x10'),auth[_0x805a('0x9')](),controller['getHopperFinals']);router[_0x805a('0xc')](_0x805a('0x11'),auth[_0x805a('0x9')](),controller[_0x805a('0x12')]);router[_0x805a('0xc')]('/:id/lists',auth[_0x805a('0x9')](),controller['getLists']);router[_0x805a('0xc')](_0x805a('0x13'),auth['isAuthenticated'](),controller[_0x805a('0x14')]);router['post']('/',auth[_0x805a('0x9')](),controller[_0x805a('0x15')]);router[_0x805a('0x16')]('/:id/clone',auth[_0x805a('0x9')](),controller[_0x805a('0x17')]);router[_0x805a('0x16')](_0x805a('0x18'),auth[_0x805a('0x9')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0x805a('0x9')](),controller['addBlackLists']);router[_0x805a('0x19')](_0x805a('0xb'),auth[_0x805a('0x9')](),controller['update']);router[_0x805a('0x1a')](_0x805a('0xb'),auth['isAuthenticated'](),controller[_0x805a('0x1b')]);router[_0x805a('0x1a')](_0x805a('0x18'),auth['isAuthenticated'](),controller[_0x805a('0x1c')]);router['delete']('/:id/blacklists',auth[_0x805a('0x9')](),controller[_0x805a('0x1d')]);module[_0x805a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 00c86ef..6db52f4 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 _0x66e6=['STRING','VIRTUAL','getDataValue','sequelize','exports','TEXT'];(function(_0x57a402,_0x40596b){var _0x753a36=function(_0x13b76b){while(--_0x13b76b){_0x57a402['push'](_0x57a402['shift']());}};_0x753a36(++_0x40596b);}(_0x66e6,0x135));var _0x666e=function(_0x161615,_0x4e5d22){_0x161615=_0x161615-0x0;var _0x5fc280=_0x66e6[_0x161615];return _0x5fc280;};'use strict';var Sequelize=require(_0x666e('0x0'));module[_0x666e('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x666e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x666e('0x3')]},'name':{'type':Sequelize[_0x666e('0x4')],'get':function(){return this[_0x666e('0x5')]('key');}}}; \ No newline at end of file +var _0x05a9=['VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x2ed834,_0x259f12){var _0x538d2d=function(_0x396a12){while(--_0x396a12){_0x2ed834['push'](_0x2ed834['shift']());}};_0x538d2d(++_0x259f12);}(_0x05a9,0x9e));var _0x905a=function(_0xb1d46d,_0x210916){_0xb1d46d=_0xb1d46d-0x0;var _0x5174f5=_0x05a9[_0xb1d46d];return _0x5174f5;};'use strict';var Sequelize=require(_0x905a('0x0'));module['exports']={'key':{'type':Sequelize[_0x905a('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x905a('0x1')]},'name':{'type':Sequelize[_0x905a('0x2')],'get':function(){return this[_0x905a('0x3')](_0x905a('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d695c9c..68cba0c 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 _0x9d64=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x14cf9d,_0x2cb74f){var _0x440d43=function(_0x2f48ed){while(--_0x2f48ed){_0x14cf9d['push'](_0x14cf9d['shift']());}};_0x440d43(++_0x2cb74f);}(_0x9d64,0x1b8));var _0x49d6=function(_0x20fdee,_0xd5d836){_0x20fdee=_0x20fdee-0x0;var _0x41bf2b=_0x9d64[_0x20fdee];return _0x41bf2b;};'use strict';var pdf=require(_0x49d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x49d6('0x1'));var zipdir=require(_0x49d6('0x2'));var jsonpatch=require(_0x49d6('0x3'));var rp=require(_0x49d6('0x4'));var moment=require(_0x49d6('0x5'));var BPromise=require(_0x49d6('0x6'));var Mustache=require(_0x49d6('0x7'));var util=require(_0x49d6('0x8'));var path=require(_0x49d6('0x9'));var sox=require(_0x49d6('0xa'));var csv=require(_0x49d6('0xb'));var ejs=require(_0x49d6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x49d6('0xd'));var crypto=require(_0x49d6('0xe'));var jsforce=require(_0x49d6('0xf'));var deskjs=require(_0x49d6('0x10'));var toCsv=require(_0x49d6('0xb'));var querystring=require(_0x49d6('0x11'));var Papa=require(_0x49d6('0x12'));var Redis=require(_0x49d6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x49d6('0x14'));var as=require(_0x49d6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x49d6('0x16'));var config=require(_0x49d6('0x17'));var db=require(_0x49d6('0x18'))['db'];function respondWithStatusCode(_0x39e5b5,_0x165218){_0x165218=_0x165218||0xcc;return function(_0x5e24a4){if(_0x5e24a4){return _0x39e5b5[_0x49d6('0x19')](_0x165218);}return _0x39e5b5[_0x49d6('0x1a')](_0x165218)['end']();};}function respondWithResult(_0x3c48dc,_0x41a99c){_0x41a99c=_0x41a99c||0xc8;return function(_0x181d11){if(_0x181d11){return _0x3c48dc[_0x49d6('0x1a')](_0x41a99c)['json'](_0x181d11);}};}function respondWithFilteredResult(_0x1d8d48,_0x4b18f0){return function(_0x3e975a){if(_0x3e975a){var _0x402f92=_0x3e975a[_0x49d6('0x1b')],_0x2d1a22=_0x4b18f0[_0x49d6('0x1c')],_0xb8a118=_0x4b18f0[_0x49d6('0x1c')]+_0x4b18f0[_0x49d6('0x1d')],_0x343df3;if(_0xb8a118>=_0x402f92){_0xb8a118=_0x402f92;_0x343df3=0xc8;}else{_0x343df3=0xce;}_0x1d8d48[_0x49d6('0x1a')](_0x343df3);return _0x1d8d48[_0x49d6('0x1e')](_0x49d6('0x1f'),_0x2d1a22+'-'+_0xb8a118+'/'+_0x402f92)[_0x49d6('0x20')](_0x3e975a);}return null;};}function patchUpdates(_0x2635bd){return function(_0x36d573){try{jsonpatch[_0x49d6('0x21')](_0x36d573,_0x2635bd,!![]);}catch(_0x38f531){return BPromise[_0x49d6('0x22')](_0x38f531);}return _0x36d573['save']();};}function saveUpdates(_0x217cfd,_0x196511){return function(_0x1ab03e){if(_0x1ab03e){return _0x1ab03e[_0x49d6('0x23')](_0x217cfd)[_0x49d6('0x24')](function(_0x13a166){return _0x13a166;});}return null;};}function removeEntity(_0x5f518c,_0x2772c5){return function(_0x4997da){if(_0x4997da){return _0x4997da[_0x49d6('0x25')]()[_0x49d6('0x24')](function(){var _0x53a98d=_0x4997da[_0x49d6('0x26')]({'plain':!![]});var _0x1ab64c='CannedAnswers';return db[_0x49d6('0x27')][_0x49d6('0x25')]({'where':{'type':_0x1ab64c,'resourceId':_0x53a98d['id']}})[_0x49d6('0x24')](function(){return _0x4997da;});})['then'](function(){_0x5f518c[_0x49d6('0x1a')](0xcc)[_0x49d6('0x28')]();});}};}function handleEntityNotFound(_0x2026b6,_0x4024b4){return function(_0x269b9a){if(!_0x269b9a){_0x2026b6[_0x49d6('0x19')](0x194);}return _0x269b9a;};}function handleError(_0x476d1f,_0x397932){_0x397932=_0x397932||0x1f4;return function(_0x32dda0){logger[_0x49d6('0x29')](_0x32dda0[_0x49d6('0x2a')]);if(_0x32dda0['name']){delete _0x32dda0[_0x49d6('0x2b')];}_0x476d1f['status'](_0x397932)[_0x49d6('0x2c')](_0x32dda0);};}exports[_0x49d6('0x2d')]=function(_0x4a97d2,_0x1f41e2){var _0x19447e={},_0x33846a={},_0x282a70={'count':0x0,'rows':[]};var _0x1272ef=_['map'](db[_0x49d6('0x2e')]['rawAttributes'],function(_0x3a0059){return{'name':_0x3a0059[_0x49d6('0x2f')],'type':_0x3a0059[_0x49d6('0x30')][_0x49d6('0x31')]};});_0x33846a[_0x49d6('0x32')]=_[_0x49d6('0x33')](_0x1272ef,'name');_0x33846a[_0x49d6('0x34')]=_[_0x49d6('0x35')](_0x4a97d2[_0x49d6('0x34')]);_0x33846a[_0x49d6('0x36')]=_[_0x49d6('0x37')](_0x33846a[_0x49d6('0x32')],_0x33846a['query']);_0x19447e[_0x49d6('0x38')]=_[_0x49d6('0x37')](_0x33846a[_0x49d6('0x32')],qs[_0x49d6('0x39')](_0x4a97d2[_0x49d6('0x34')]['fields']));_0x19447e['attributes']=_0x19447e[_0x49d6('0x38')][_0x49d6('0x3a')]?_0x19447e[_0x49d6('0x38')]:_0x33846a['model'];if(!_0x4a97d2['query'][_0x49d6('0x3b')](_0x49d6('0x3c'))){_0x19447e['limit']=qs['limit'](_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x1d')]);_0x19447e[_0x49d6('0x1c')]=qs['offset'](_0x4a97d2['query'][_0x49d6('0x1c')]);}_0x19447e[_0x49d6('0x3d')]=qs['sort'](_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x3e')]);_0x19447e['where']=qs['filters'](_[_0x49d6('0x3f')](_0x4a97d2[_0x49d6('0x34')],_0x33846a[_0x49d6('0x36')]),_0x1272ef);if(_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x40')]){_0x19447e[_0x49d6('0x41')]=_[_0x49d6('0x42')](_0x19447e['where'],{'$or':_['map'](_0x1272ef,function(_0x298d9b){if(_0x298d9b[_0x49d6('0x30')]!==_0x49d6('0x43')){var _0xa3fd34={};_0xa3fd34[_0x298d9b['name']]={'$like':'%'+_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x40')]+'%'};return _0xa3fd34;}})});}_0x19447e=_[_0x49d6('0x42')]({},_0x19447e,_0x4a97d2['options']);var _0x24f0a9={'where':_0x19447e[_0x49d6('0x41')]};return db[_0x49d6('0x2e')][_0x49d6('0x1b')](_0x24f0a9)[_0x49d6('0x24')](function(_0x10399d){_0x282a70[_0x49d6('0x1b')]=_0x10399d;if(_0x4a97d2[_0x49d6('0x34')]['includeAll']){_0x19447e[_0x49d6('0x44')]=[{'all':!![]}];}return db[_0x49d6('0x2e')][_0x49d6('0x45')](_0x19447e);})[_0x49d6('0x24')](function(_0x42557f){_0x282a70[_0x49d6('0x46')]=_0x42557f;return _0x282a70;})[_0x49d6('0x24')](respondWithFilteredResult(_0x1f41e2,_0x19447e))[_0x49d6('0x47')](handleError(_0x1f41e2,null));};exports[_0x49d6('0x48')]=function(_0x1d2b29,_0x7c1b00){var _0x495194={'raw':!![],'where':{'id':_0x1d2b29[_0x49d6('0x49')]['id']}},_0x985a84={};_0x985a84['model']=_[_0x49d6('0x35')](db[_0x49d6('0x2e')]['rawAttributes']);_0x985a84[_0x49d6('0x34')]=_[_0x49d6('0x35')](_0x1d2b29[_0x49d6('0x34')]);_0x985a84['filters']=_[_0x49d6('0x37')](_0x985a84[_0x49d6('0x32')],_0x985a84[_0x49d6('0x34')]);_0x495194['attributes']=_['intersection'](_0x985a84['model'],qs[_0x49d6('0x39')](_0x1d2b29[_0x49d6('0x34')]['fields']));_0x495194[_0x49d6('0x38')]=_0x495194['attributes'][_0x49d6('0x3a')]?_0x495194[_0x49d6('0x38')]:_0x985a84[_0x49d6('0x32')];if(_0x1d2b29[_0x49d6('0x34')]['includeAll']){_0x495194['include']=[{'all':!![]}];}_0x495194=_[_0x49d6('0x42')]({},_0x495194,_0x1d2b29[_0x49d6('0x4a')]);return db[_0x49d6('0x2e')][_0x49d6('0x4b')](_0x495194)[_0x49d6('0x24')](handleEntityNotFound(_0x7c1b00,null))[_0x49d6('0x24')](respondWithResult(_0x7c1b00,null))[_0x49d6('0x47')](handleError(_0x7c1b00,null));};exports[_0x49d6('0x23')]=function(_0x45e131,_0x42f3ef){if(_0x45e131[_0x49d6('0x4c')]['id']){delete _0x45e131['body']['id'];}return db[_0x49d6('0x2e')][_0x49d6('0x4b')]({'where':{'id':_0x45e131['params']['id']}})[_0x49d6('0x24')](handleEntityNotFound(_0x42f3ef,null))[_0x49d6('0x24')](saveUpdates(_0x45e131[_0x49d6('0x4c')],null))[_0x49d6('0x24')](respondWithResult(_0x42f3ef,null))[_0x49d6('0x47')](handleError(_0x42f3ef,null));};exports['destroy']=function(_0x56c8d3,_0x52e4f4){return db[_0x49d6('0x2e')]['find']({'where':{'id':_0x56c8d3[_0x49d6('0x49')]['id']}})[_0x49d6('0x24')](handleEntityNotFound(_0x52e4f4,null))['then'](removeEntity(_0x52e4f4,null))[_0x49d6('0x47')](handleError(_0x52e4f4,null));};exports[_0x49d6('0x4d')]=function(_0xdd05e,_0xdb4039){var _0x2a197b={'key':_0xdd05e[_0x49d6('0x4c')]['key']};if(_0xdd05e['body'][_0x49d6('0x4e')]){_0x2a197b[_0x49d6('0x4e')]=_0xdd05e[_0x49d6('0x4c')][_0x49d6('0x4e')];}else if(_0xdd05e[_0x49d6('0x4c')][_0x49d6('0x4f')]){_0x2a197b['SmsAccountId']=_0xdd05e['body'][_0x49d6('0x4f')];}else if(_0xdd05e['body'][_0x49d6('0x50')]){_0x2a197b['OpenchannelAccountId']=_0xdd05e[_0x49d6('0x4c')]['OpenchannelAccountId'];}else if(_0xdd05e['body'][_0x49d6('0x51')]){_0x2a197b[_0x49d6('0x51')]=_0xdd05e[_0x49d6('0x4c')][_0x49d6('0x51')];}return db[_0x49d6('0x2e')][_0x49d6('0x4b')]({'where':_0x2a197b})[_0x49d6('0x24')](function(_0x2b7906){if(_0x2b7906){throw new db[(_0x49d6('0x52'))][(_0x49d6('0x53'))](_0x49d6('0x54'));}return db[_0x49d6('0x2e')][_0x49d6('0x4d')](_0xdd05e[_0x49d6('0x4c')]);})['then'](function(_0x3a7173){var _0x2f8916=_0xdd05e['user'][_0x49d6('0x26')]({'plain':!![]});if(!_0x2f8916)throw new Error(_0x49d6('0x55'));if(_0x2f8916['role']===_0x49d6('0x56')){var _0x45e576=_0x3a7173[_0x49d6('0x26')]({'plain':!![]});return db[_0x49d6('0x57')][_0x49d6('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x2f8916[_0x49d6('0x58')]},'raw':!![]})[_0x49d6('0x24')](function(_0x3d35c2){if(_0x3d35c2&&_0x3d35c2[_0x49d6('0x59')]===0x0){return db[_0x49d6('0x27')][_0x49d6('0x4d')]({'name':_0x45e576['name'],'resourceId':_0x45e576['id'],'type':_0x3d35c2['name'],'sectionId':_0x3d35c2['id']},{})[_0x49d6('0x24')](function(){return _0x3a7173;});}else{return _0x3a7173;}})['catch'](function(_0x1c5d88){logger['error'](_0x49d6('0x5a'),_0x1c5d88);throw _0x1c5d88;});}return _0x3a7173;})[_0x49d6('0x24')](respondWithResult(_0xdb4039,0xc9))['catch'](handleError(_0xdb4039,null));}; \ No newline at end of file +var _0x620a=['CannedAnswer','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','apply','reject','update','then','destroy','get','CannedAnswers','error','name','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x620a,0x82));var _0xa620=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x620a[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa620('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa620('0x1'));var moment=require(_0xa620('0x2'));var BPromise=require(_0xa620('0x3'));var Mustache=require(_0xa620('0x4'));var util=require(_0xa620('0x5'));var path=require(_0xa620('0x6'));var sox=require(_0xa620('0x7'));var csv=require(_0xa620('0x8'));var ejs=require(_0xa620('0x9'));var fs=require('fs');var _=require(_0xa620('0xa'));var squel=require(_0xa620('0xb'));var crypto=require(_0xa620('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa620('0xd'));var toCsv=require(_0xa620('0x8'));var querystring=require(_0xa620('0xe'));var Papa=require(_0xa620('0xf'));var Redis=require(_0xa620('0x10'));var authService=require(_0xa620('0x11'));var qs=require(_0xa620('0x12'));var as=require(_0xa620('0x13'));var hardwareService=require(_0xa620('0x14'));var logger=require(_0xa620('0x15'))(_0xa620('0x16'));var utils=require(_0xa620('0x17'));var config=require(_0xa620('0x18'));var db=require(_0xa620('0x19'))['db'];function respondWithStatusCode(_0x51b622,_0x4dc275){_0x4dc275=_0x4dc275||0xcc;return function(_0x4836f0){if(_0x4836f0){return _0x51b622[_0xa620('0x1a')](_0x4dc275);}return _0x51b622['status'](_0x4dc275)[_0xa620('0x1b')]();};}function respondWithResult(_0x38f77e,_0x5b7f3a){_0x5b7f3a=_0x5b7f3a||0xc8;return function(_0x4fc750){if(_0x4fc750){return _0x38f77e[_0xa620('0x1c')](_0x5b7f3a)[_0xa620('0x1d')](_0x4fc750);}};}function respondWithFilteredResult(_0x11c914,_0x26e776){return function(_0x423bfe){if(_0x423bfe){var _0x5b2eaf=_0x423bfe[_0xa620('0x1e')],_0x547e84=_0x26e776['offset'],_0x5392a8=_0x26e776['offset']+_0x26e776[_0xa620('0x1f')],_0x3d6a27;if(_0x5392a8>=_0x5b2eaf){_0x5392a8=_0x5b2eaf;_0x3d6a27=0xc8;}else{_0x3d6a27=0xce;}_0x11c914[_0xa620('0x1c')](_0x3d6a27);return _0x11c914[_0xa620('0x20')]('Content-Range',_0x547e84+'-'+_0x5392a8+'/'+_0x5b2eaf)[_0xa620('0x1d')](_0x423bfe);}return null;};}function patchUpdates(_0x108386){return function(_0x67f6c4){try{jsonpatch[_0xa620('0x21')](_0x67f6c4,_0x108386,!![]);}catch(_0x13ea0c){return BPromise[_0xa620('0x22')](_0x13ea0c);}return _0x67f6c4['save']();};}function saveUpdates(_0x3e333a,_0x1b2241){return function(_0x29c72d){if(_0x29c72d){return _0x29c72d[_0xa620('0x23')](_0x3e333a)[_0xa620('0x24')](function(_0x267f81){return _0x267f81;});}return null;};}function removeEntity(_0x207801,_0x5821d8){return function(_0x1232ae){if(_0x1232ae){return _0x1232ae[_0xa620('0x25')]()[_0xa620('0x24')](function(){var _0x4a54cf=_0x1232ae[_0xa620('0x26')]({'plain':!![]});var _0x5ec005=_0xa620('0x27');return db['UserProfileResource'][_0xa620('0x25')]({'where':{'type':_0x5ec005,'resourceId':_0x4a54cf['id']}})['then'](function(){return _0x1232ae;});})[_0xa620('0x24')](function(){_0x207801[_0xa620('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a061c,_0x197531){return function(_0x27e261){if(!_0x27e261){_0x4a061c[_0xa620('0x1a')](0x194);}return _0x27e261;};}function handleError(_0x4e0bb4,_0x42c8a2){_0x42c8a2=_0x42c8a2||0x1f4;return function(_0x2dea48){logger[_0xa620('0x28')](_0x2dea48['stack']);if(_0x2dea48['name']){delete _0x2dea48[_0xa620('0x29')];}_0x4e0bb4[_0xa620('0x1c')](_0x42c8a2)['send'](_0x2dea48);};}exports[_0xa620('0x2a')]=function(_0x3082f4,_0x340806){var _0x30c17d={},_0x422f44={},_0x37e04f={'count':0x0,'rows':[]};var _0x48cdbc=_[_0xa620('0x2b')](db[_0xa620('0x2c')][_0xa620('0x2d')],function(_0x2ffd31){return{'name':_0x2ffd31[_0xa620('0x2e')],'type':_0x2ffd31['type'][_0xa620('0x2f')]};});_0x422f44['model']=_[_0xa620('0x2b')](_0x48cdbc,_0xa620('0x29'));_0x422f44[_0xa620('0x30')]=_[_0xa620('0x31')](_0x3082f4[_0xa620('0x30')]);_0x422f44['filters']=_[_0xa620('0x32')](_0x422f44[_0xa620('0x33')],_0x422f44['query']);_0x30c17d[_0xa620('0x34')]=_[_0xa620('0x32')](_0x422f44['model'],qs['fields'](_0x3082f4[_0xa620('0x30')][_0xa620('0x35')]));_0x30c17d[_0xa620('0x34')]=_0x30c17d['attributes'][_0xa620('0x36')]?_0x30c17d[_0xa620('0x34')]:_0x422f44[_0xa620('0x33')];if(!_0x3082f4[_0xa620('0x30')][_0xa620('0x37')]('nolimit')){_0x30c17d['limit']=qs['limit'](_0x3082f4['query'][_0xa620('0x1f')]);_0x30c17d['offset']=qs[_0xa620('0x38')](_0x3082f4['query'][_0xa620('0x38')]);}_0x30c17d[_0xa620('0x39')]=qs[_0xa620('0x3a')](_0x3082f4[_0xa620('0x30')]['sort']);_0x30c17d[_0xa620('0x3b')]=qs['filters'](_['pick'](_0x3082f4[_0xa620('0x30')],_0x422f44[_0xa620('0x3c')]),_0x48cdbc);if(_0x3082f4[_0xa620('0x30')][_0xa620('0x3d')]){_0x30c17d[_0xa620('0x3b')]=_[_0xa620('0x3e')](_0x30c17d[_0xa620('0x3b')],{'$or':_[_0xa620('0x2b')](_0x48cdbc,function(_0xe599b5){if(_0xe599b5[_0xa620('0x3f')]!==_0xa620('0x40')){var _0x16af45={};_0x16af45[_0xe599b5[_0xa620('0x29')]]={'$like':'%'+_0x3082f4[_0xa620('0x30')]['filter']+'%'};return _0x16af45;}})});}_0x30c17d=_[_0xa620('0x3e')]({},_0x30c17d,_0x3082f4[_0xa620('0x41')]);var _0x39b438={'where':_0x30c17d[_0xa620('0x3b')]};return db['CannedAnswer'][_0xa620('0x1e')](_0x39b438)[_0xa620('0x24')](function(_0x26b062){_0x37e04f[_0xa620('0x1e')]=_0x26b062;if(_0x3082f4[_0xa620('0x30')]['includeAll']){_0x30c17d[_0xa620('0x42')]=[{'all':!![]}];}return db[_0xa620('0x2c')][_0xa620('0x43')](_0x30c17d);})[_0xa620('0x24')](function(_0x497aab){_0x37e04f['rows']=_0x497aab;return _0x37e04f;})[_0xa620('0x24')](respondWithFilteredResult(_0x340806,_0x30c17d))[_0xa620('0x44')](handleError(_0x340806,null));};exports[_0xa620('0x45')]=function(_0x41cb96,_0x727073){var _0x5b99a0={'raw':!![],'where':{'id':_0x41cb96[_0xa620('0x46')]['id']}},_0x2ffa67={};_0x2ffa67[_0xa620('0x33')]=_[_0xa620('0x31')](db[_0xa620('0x2c')][_0xa620('0x2d')]);_0x2ffa67[_0xa620('0x30')]=_[_0xa620('0x31')](_0x41cb96['query']);_0x2ffa67[_0xa620('0x3c')]=_[_0xa620('0x32')](_0x2ffa67[_0xa620('0x33')],_0x2ffa67[_0xa620('0x30')]);_0x5b99a0[_0xa620('0x34')]=_[_0xa620('0x32')](_0x2ffa67['model'],qs['fields'](_0x41cb96[_0xa620('0x30')]['fields']));_0x5b99a0[_0xa620('0x34')]=_0x5b99a0[_0xa620('0x34')]['length']?_0x5b99a0[_0xa620('0x34')]:_0x2ffa67[_0xa620('0x33')];if(_0x41cb96[_0xa620('0x30')][_0xa620('0x47')]){_0x5b99a0[_0xa620('0x42')]=[{'all':!![]}];}_0x5b99a0=_[_0xa620('0x3e')]({},_0x5b99a0,_0x41cb96[_0xa620('0x41')]);return db['CannedAnswer'][_0xa620('0x48')](_0x5b99a0)['then'](handleEntityNotFound(_0x727073,null))['then'](respondWithResult(_0x727073,null))[_0xa620('0x44')](handleError(_0x727073,null));};exports['update']=function(_0x369054,_0x3b8cc0){if(_0x369054[_0xa620('0x49')]['id']){delete _0x369054[_0xa620('0x49')]['id'];}return db[_0xa620('0x2c')][_0xa620('0x48')]({'where':{'id':_0x369054[_0xa620('0x46')]['id']}})[_0xa620('0x24')](handleEntityNotFound(_0x3b8cc0,null))[_0xa620('0x24')](saveUpdates(_0x369054[_0xa620('0x49')],null))[_0xa620('0x24')](respondWithResult(_0x3b8cc0,null))['catch'](handleError(_0x3b8cc0,null));};exports['destroy']=function(_0x5248b2,_0x5aa92d){return db[_0xa620('0x2c')][_0xa620('0x48')]({'where':{'id':_0x5248b2['params']['id']}})[_0xa620('0x24')](handleEntityNotFound(_0x5aa92d,null))[_0xa620('0x24')](removeEntity(_0x5aa92d,null))[_0xa620('0x44')](handleError(_0x5aa92d,null));};exports[_0xa620('0x4a')]=function(_0x110eee,_0x3c4a64){var _0x29e169={'key':_0x110eee['body']['key']};if(_0x110eee[_0xa620('0x49')][_0xa620('0x4b')]){_0x29e169[_0xa620('0x4b')]=_0x110eee[_0xa620('0x49')][_0xa620('0x4b')];}else if(_0x110eee['body'][_0xa620('0x4c')]){_0x29e169[_0xa620('0x4c')]=_0x110eee[_0xa620('0x49')][_0xa620('0x4c')];}else if(_0x110eee[_0xa620('0x49')]['OpenchannelAccountId']){_0x29e169[_0xa620('0x4d')]=_0x110eee[_0xa620('0x49')][_0xa620('0x4d')];}else if(_0x110eee[_0xa620('0x49')]['ChatWebsiteId']){_0x29e169[_0xa620('0x4e')]=_0x110eee['body'][_0xa620('0x4e')];}return db[_0xa620('0x2c')][_0xa620('0x48')]({'where':_0x29e169})['then'](function(_0x11519a){if(_0x11519a){throw new db['Sequelize'][(_0xa620('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xa620('0x4a')](_0x110eee[_0xa620('0x49')]);})['then'](function(_0x20772f){var _0x3bab22=_0x110eee[_0xa620('0x50')]['get']({'plain':!![]});if(!_0x3bab22)throw new Error(_0xa620('0x51'));if(_0x3bab22[_0xa620('0x52')]===_0xa620('0x50')){var _0x5bccbe=_0x20772f[_0xa620('0x26')]({'plain':!![]});return db[_0xa620('0x53')][_0xa620('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x3bab22[_0xa620('0x54')]},'raw':!![]})[_0xa620('0x24')](function(_0x1eebd1){if(_0x1eebd1&&_0x1eebd1['autoAssociation']===0x0){return db[_0xa620('0x55')][_0xa620('0x4a')]({'name':_0x5bccbe['name'],'resourceId':_0x5bccbe['id'],'type':_0x1eebd1['name'],'sectionId':_0x1eebd1['id']},{})[_0xa620('0x24')](function(){return _0x20772f;});}else{return _0x20772f;}})[_0xa620('0x44')](function(_0x375c30){logger['error'](_0xa620('0x56'),_0x375c30);throw _0x375c30;});}return _0x20772f;})[_0xa620('0x24')](respondWithResult(_0x3c4a64,0xc9))[_0xa620('0x44')](handleError(_0x3c4a64,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9cd26a4..9065d51 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 _0x291c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x291c,0x137));var _0xc291=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x291c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var logger=require(_0xc291('0x2'))(_0xc291('0x3'));var moment=require(_0xc291('0x4'));var BPromise=require(_0xc291('0x5'));var rp=require(_0xc291('0x6'));var fs=require('fs');var path=require(_0xc291('0x7'));var rimraf=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var attributes=require(_0xc291('0xa'));module['exports']=function(_0x2c96a8,_0x5f2563){return _0x2c96a8['define'](_0xc291('0xb'),attributes,{'tableName':_0xc291('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc291('0xd'),'collate':_0xc291('0xe')});}; \ No newline at end of file +var _0x3c94=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x258c72,_0x3a1005){var _0x19d501=function(_0x5165e2){while(--_0x5165e2){_0x258c72['push'](_0x258c72['shift']());}};_0x19d501(++_0x3a1005);}(_0x3c94,0xcd));var _0x43c9=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0x3c94[_0x16ecad];return _0x313ff7;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var logger=require(_0x43c9('0x2'))(_0x43c9('0x3'));var moment=require(_0x43c9('0x4'));var BPromise=require(_0x43c9('0x5'));var rp=require(_0x43c9('0x6'));var fs=require('fs');var path=require(_0x43c9('0x7'));var rimraf=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var attributes=require(_0x43c9('0xa'));module[_0x43c9('0xb')]=function(_0x4fdfc2,_0x39c220){return _0x4fdfc2[_0x43c9('0xc')](_0x43c9('0xd'),attributes,{'tableName':_0x43c9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43c9('0xf'),'collate':_0x43c9('0x10')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index aa5c240..4482b13 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 _0xb6c2=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6c2,0x17a));var _0x2b6c=function(_0x365894,_0x352184){_0x365894=_0x365894-0x0;var _0x3e2edd=_0xb6c2[_0x365894];return _0x3e2edd;};'use strict';var _=require(_0x2b6c('0x0'));var util=require('util');var moment=require(_0x2b6c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b6c('0x2'));var fs=require('fs');var Redis=require(_0x2b6c('0x3'));var db=require(_0x2b6c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b6c('0x5'))(_0x2b6c('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b6c('0x7'));var client=jayson['client'][_0x2b6c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b671b,_0x5e5286,_0x33cb84){return new BPromise(function(_0x166d4d,_0xf84283){return client['request'](_0x4b671b,_0x33cb84)['then'](function(_0x38c52e){logger['info'](_0x2b6c('0x9'),_0x5e5286,_0x2b6c('0xa'));logger[_0x2b6c('0xb')](_0x2b6c('0xc'),_0x5e5286,_0x2b6c('0xa'),JSON[_0x2b6c('0xd')](_0x38c52e));if(_0x38c52e[_0x2b6c('0xe')]){if(_0x38c52e['error'][_0x2b6c('0xf')]===0x1f4){logger[_0x2b6c('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x5e5286,_0x38c52e[_0x2b6c('0xe')]['message']);return _0xf84283(_0x38c52e[_0x2b6c('0xe')][_0x2b6c('0x10')]);}logger[_0x2b6c('0xe')](_0x2b6c('0x9'),_0x5e5286,_0x38c52e['error']['message']);return _0x166d4d(_0x38c52e[_0x2b6c('0xe')][_0x2b6c('0x10')]);}else{logger[_0x2b6c('0x11')](_0x2b6c('0x9'),_0x5e5286,_0x2b6c('0xa'));_0x166d4d(_0x38c52e['result'][_0x2b6c('0x10')]);}})[_0x2b6c('0x12')](function(_0x14e8d1){logger[_0x2b6c('0xe')](_0x2b6c('0x9'),_0x5e5286,_0x14e8d1);_0xf84283(_0x14e8d1);});});} \ No newline at end of file +var _0xa87b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xa87b,0x91));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba87('0x0'));var util=require(_0xba87('0x1'));var moment=require(_0xba87('0x2'));var BPromise=require(_0xba87('0x3'));var rs=require(_0xba87('0x4'));var fs=require('fs');var Redis=require(_0xba87('0x5'));var db=require(_0xba87('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xba87('0x7'))('rpc');var config=require(_0xba87('0x8'));var jayson=require(_0xba87('0x9'));var client=jayson[_0xba87('0xa')][_0xba87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9c67f2,_0x4abf92,_0x23b0f4){return new BPromise(function(_0x2868ca,_0xb27e85){return client[_0xba87('0xc')](_0x9c67f2,_0x23b0f4)[_0xba87('0xd')](function(_0x258f06){logger[_0xba87('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x4abf92,_0xba87('0xf'));logger[_0xba87('0x10')](_0xba87('0x11'),_0x4abf92,_0xba87('0xf'),JSON[_0xba87('0x12')](_0x258f06));if(_0x258f06['error']){if(_0x258f06[_0xba87('0x13')][_0xba87('0x14')]===0x1f4){logger[_0xba87('0x13')](_0xba87('0x15'),_0x4abf92,_0x258f06[_0xba87('0x13')]['message']);return _0xb27e85(_0x258f06[_0xba87('0x13')][_0xba87('0x16')]);}logger[_0xba87('0x13')](_0xba87('0x15'),_0x4abf92,_0x258f06['error'][_0xba87('0x16')]);return _0x2868ca(_0x258f06[_0xba87('0x13')][_0xba87('0x16')]);}else{logger[_0xba87('0xe')](_0xba87('0x15'),_0x4abf92,_0xba87('0xf'));_0x2868ca(_0x258f06[_0xba87('0x17')][_0xba87('0x16')]);}})[_0xba87('0x18')](function(_0x161e33){logger['error'](_0xba87('0x15'),_0x4abf92,_0x161e33);_0xb27e85(_0x161e33);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 95f56a5..357137e 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 _0x3e48=['create','put','update','delete','destroy','exports','util','path','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x21398a,_0x2a677c){var _0x1d60cd=function(_0x1e4a56){while(--_0x1e4a56){_0x21398a['push'](_0x21398a['shift']());}};_0x1d60cd(++_0x2a677c);}(_0x3e48,0x86));var _0x83e4=function(_0x1d74ee,_0x37842b){_0x1d74ee=_0x1d74ee-0x0;var _0x308b1e=_0x3e48[_0x1d74ee];return _0x308b1e;};'use strict';var multer=require('multer');var util=require(_0x83e4('0x0'));var path=require(_0x83e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x83e4('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x83e4('0x3'));var controller=require('./cannedAnswer.controller');router[_0x83e4('0x4')]('/',auth[_0x83e4('0x5')](),controller[_0x83e4('0x6')]);router['get'](_0x83e4('0x7'),auth[_0x83e4('0x5')](),controller[_0x83e4('0x8')]);router[_0x83e4('0x9')]('/',auth[_0x83e4('0x5')](),controller[_0x83e4('0xa')]);router[_0x83e4('0xb')](_0x83e4('0x7'),auth['isAuthenticated'](),controller[_0x83e4('0xc')]);router[_0x83e4('0xd')](_0x83e4('0x7'),auth[_0x83e4('0x5')](),controller[_0x83e4('0xe')]);module[_0x83e4('0xf')]=router; \ No newline at end of file +var _0xe8ce=['put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0xe8ce,0xdc));var _0xee8c=function(_0x97d9cd,_0x23de5c){_0x97d9cd=_0x97d9cd-0x0;var _0xa5f7e2=_0xe8ce[_0x97d9cd];return _0xa5f7e2;};'use strict';var multer=require(_0xee8c('0x0'));var util=require(_0xee8c('0x1'));var path=require(_0xee8c('0x2'));var timeout=require('connect-timeout');var express=require(_0xee8c('0x3'));var router=express['Router']();var auth=require(_0xee8c('0x4'));var interaction=require(_0xee8c('0x5'));var config=require(_0xee8c('0x6'));var controller=require(_0xee8c('0x7'));router[_0xee8c('0x8')]('/',auth[_0xee8c('0x9')](),controller[_0xee8c('0xa')]);router[_0xee8c('0x8')](_0xee8c('0xb'),auth[_0xee8c('0x9')](),controller[_0xee8c('0xc')]);router[_0xee8c('0xd')]('/',auth[_0xee8c('0x9')](),controller['create']);router[_0xee8c('0xe')](_0xee8c('0xb'),auth[_0xee8c('0x9')](),controller['update']);router[_0xee8c('0xf')](_0xee8c('0xb'),auth[_0xee8c('0x9')](),controller[_0xee8c('0x10')]);module[_0xee8c('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 4e1281f..81cfcb8 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 _0x1549=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x528e64,_0x5f2d9f){var _0x22dd1e=function(_0x5cf6ad){while(--_0x5cf6ad){_0x528e64['push'](_0x528e64['shift']());}};_0x22dd1e(++_0x5f2d9f);}(_0x1549,0x192));var _0x9154=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x1549[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0x9154('0x0'));module[_0x9154('0x1')]={'calldate':{'type':Sequelize[_0x9154('0x2')],'allowNull':![],'defaultValue':_0x9154('0x3')},'clid':{'type':Sequelize[_0x9154('0x4')]},'src':{'type':Sequelize[_0x9154('0x4')]},'dst':{'type':Sequelize[_0x9154('0x4')]},'dcontext':{'type':Sequelize[_0x9154('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x9154('0x4')]},'lastapp':{'type':Sequelize[_0x9154('0x4')]},'lastdata':{'type':Sequelize[_0x9154('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9154('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9154('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9154('0x4')]},'userfield':{'type':Sequelize[_0x9154('0x4')]},'uniqueid':{'type':Sequelize[_0x9154('0x4')]},'linkedid':{'type':Sequelize[_0x9154('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9154('0x4')]},'type':{'type':Sequelize[_0x9154('0x4')]},'tag':{'type':Sequelize[_0x9154('0x4')]}}; \ No newline at end of file +var _0x61d0=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x61d0,0x121));var _0x061d=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0x61d0[_0x23ca3a];return _0x5c1aab;};'use strict';var Sequelize=require(_0x061d('0x0'));module[_0x061d('0x1')]={'calldate':{'type':Sequelize[_0x061d('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x061d('0x3')]},'dst':{'type':Sequelize[_0x061d('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x061d('0x3')]},'dstchannel':{'type':Sequelize[_0x061d('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x061d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x061d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x061d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x061d('0x3')]},'userfield':{'type':Sequelize[_0x061d('0x3')]},'uniqueid':{'type':Sequelize[_0x061d('0x3')]},'linkedid':{'type':Sequelize[_0x061d('0x3')]},'sequence':{'type':Sequelize[_0x061d('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x061d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f1458d1..24abdc0 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 _0x4103=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','limit','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','Cdr','count','includeAll','findAll','catch','show','params','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x28d506,_0x1144d2){var _0x252461=function(_0x1af38e){while(--_0x1af38e){_0x28d506['push'](_0x28d506['shift']());}};_0x252461(++_0x1144d2);}(_0x4103,0xc1));var _0x3410=function(_0x385b97,_0x478845){_0x385b97=_0x385b97-0x0;var _0x5b2363=_0x4103[_0x385b97];return _0x5b2363;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3410('0x0'));var rimraf=require(_0x3410('0x1'));var zipdir=require(_0x3410('0x2'));var jsonpatch=require(_0x3410('0x3'));var rp=require(_0x3410('0x4'));var moment=require(_0x3410('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3410('0x6'));var util=require(_0x3410('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3410('0x8'));var ejs=require(_0x3410('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3410('0xa'));var crypto=require(_0x3410('0xb'));var jsforce=require(_0x3410('0xc'));var deskjs=require(_0x3410('0xd'));var toCsv=require(_0x3410('0x8'));var querystring=require('querystring');var Papa=require(_0x3410('0xe'));var Redis=require(_0x3410('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3410('0x10'));var as=require(_0x3410('0x11'));var hardwareService=require(_0x3410('0x12'));var logger=require(_0x3410('0x13'))(_0x3410('0x14'));var utils=require(_0x3410('0x15'));var config=require('../../config/environment');var db=require(_0x3410('0x16'))['db'];function respondWithStatusCode(_0xa222ca,_0x397491){_0x397491=_0x397491||0xcc;return function(_0x1290b){if(_0x1290b){return _0xa222ca['sendStatus'](_0x397491);}return _0xa222ca[_0x3410('0x17')](_0x397491)[_0x3410('0x18')]();};}function respondWithResult(_0x2c053f,_0x1dd5d8){_0x1dd5d8=_0x1dd5d8||0xc8;return function(_0x46ddc6){if(_0x46ddc6){return _0x2c053f[_0x3410('0x17')](_0x1dd5d8)[_0x3410('0x19')](_0x46ddc6);}};}function respondWithFilteredResult(_0x5335bf,_0x1d9057){return function(_0x3ad2f7){if(_0x3ad2f7){var _0x535800=_0x3ad2f7['count'],_0x5bd7cc=_0x1d9057['offset'],_0x365093=_0x1d9057['offset']+_0x1d9057[_0x3410('0x1a')],_0x489c1b;if(_0x365093>=_0x535800){_0x365093=_0x535800;_0x489c1b=0xc8;}else{_0x489c1b=0xce;}_0x5335bf[_0x3410('0x17')](_0x489c1b);return _0x5335bf[_0x3410('0x1b')](_0x3410('0x1c'),_0x5bd7cc+'-'+_0x365093+'/'+_0x535800)[_0x3410('0x19')](_0x3ad2f7);}return null;};}function patchUpdates(_0x10b128){return function(_0x3e3b87){try{jsonpatch['apply'](_0x3e3b87,_0x10b128,!![]);}catch(_0x18ca58){return BPromise['reject'](_0x18ca58);}return _0x3e3b87[_0x3410('0x1d')]();};}function saveUpdates(_0x408132,_0x198278){return function(_0x4224ca){if(_0x4224ca){return _0x4224ca['update'](_0x408132)[_0x3410('0x1e')](function(_0x4a16d3){return _0x4a16d3;});}return null;};}function removeEntity(_0x4e25b6,_0x48985d){return function(_0x376c25){if(_0x376c25){return _0x376c25[_0x3410('0x1f')]()[_0x3410('0x1e')](function(){_0x4e25b6['status'](0xcc)[_0x3410('0x18')]();});}};}function handleEntityNotFound(_0x53db7c,_0x1b8813){return function(_0x3ef7a8){if(!_0x3ef7a8){_0x53db7c[_0x3410('0x20')](0x194);}return _0x3ef7a8;};}function handleError(_0xd0bf97,_0x1735cf){_0x1735cf=_0x1735cf||0x1f4;return function(_0x2d753c){logger[_0x3410('0x21')](_0x2d753c[_0x3410('0x22')]);if(_0x2d753c[_0x3410('0x23')]){delete _0x2d753c['name'];}_0xd0bf97['status'](_0x1735cf)[_0x3410('0x24')](_0x2d753c);};}exports[_0x3410('0x25')]=function(_0x3b4a0e,_0x5de0e7){var _0x2eda0a={},_0x2ac91f={},_0x2b4471={'count':0x0,'rows':[]};var _0x4210f0=_['map'](db['Cdr'][_0x3410('0x26')],function(_0x782e0){return{'name':_0x782e0[_0x3410('0x27')],'type':_0x782e0[_0x3410('0x28')][_0x3410('0x29')]};});_0x2ac91f[_0x3410('0x2a')]=_[_0x3410('0x2b')](_0x4210f0,'name');_0x2ac91f['query']=_[_0x3410('0x2c')](_0x3b4a0e[_0x3410('0x2d')]);_0x2ac91f[_0x3410('0x2e')]=_[_0x3410('0x2f')](_0x2ac91f['model'],_0x2ac91f[_0x3410('0x2d')]);_0x2eda0a[_0x3410('0x30')]=_['intersection'](_0x2ac91f[_0x3410('0x2a')],qs[_0x3410('0x31')](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x31')]));_0x2eda0a['attributes']=_0x2eda0a[_0x3410('0x30')][_0x3410('0x32')]?_0x2eda0a[_0x3410('0x30')]:_0x2ac91f[_0x3410('0x2a')];if(!_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x33')]('nolimit')){_0x2eda0a['limit']=qs['limit'](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x1a')]);_0x2eda0a[_0x3410('0x34')]=qs[_0x3410('0x34')](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x34')]);}_0x2eda0a['order']=qs[_0x3410('0x35')](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x35')]);_0x2eda0a[_0x3410('0x36')]=qs['filters'](_[_0x3410('0x37')](_0x3b4a0e['query'],_0x2ac91f['filters']),_0x4210f0);if(_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x38')]){_0x2eda0a['where']=_['merge'](_0x2eda0a['where'],{'$or':_[_0x3410('0x2b')](_0x4210f0,function(_0x5d6835){if(_0x5d6835[_0x3410('0x28')]!=='VIRTUAL'){var _0xad137c={};_0xad137c[_0x5d6835[_0x3410('0x23')]]={'$like':'%'+_0x3b4a0e['query']['filter']+'%'};return _0xad137c;}})});}_0x2eda0a=_['merge']({},_0x2eda0a,_0x3b4a0e['options']);var _0x575602={'where':_0x2eda0a['where']};return db[_0x3410('0x39')][_0x3410('0x3a')](_0x575602)[_0x3410('0x1e')](function(_0x2e6543){_0x2b4471[_0x3410('0x3a')]=_0x2e6543;if(_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x3b')]){_0x2eda0a['include']=[{'all':!![]}];}return db['Cdr'][_0x3410('0x3c')](_0x2eda0a);})[_0x3410('0x1e')](function(_0x305628){_0x2b4471['rows']=_0x305628;return _0x2b4471;})[_0x3410('0x1e')](respondWithFilteredResult(_0x5de0e7,_0x2eda0a))[_0x3410('0x3d')](handleError(_0x5de0e7,null));};exports[_0x3410('0x3e')]=function(_0x5038d8,_0x1cac8c){var _0x3083c6={'raw':!![],'where':{'id':_0x5038d8[_0x3410('0x3f')]['id']}},_0x5510b9={};_0x5510b9[_0x3410('0x2a')]=_['keys'](db[_0x3410('0x39')][_0x3410('0x26')]);_0x5510b9[_0x3410('0x2d')]=_[_0x3410('0x2c')](_0x5038d8[_0x3410('0x2d')]);_0x5510b9[_0x3410('0x2e')]=_[_0x3410('0x2f')](_0x5510b9['model'],_0x5510b9[_0x3410('0x2d')]);_0x3083c6[_0x3410('0x30')]=_[_0x3410('0x2f')](_0x5510b9[_0x3410('0x2a')],qs[_0x3410('0x31')](_0x5038d8[_0x3410('0x2d')][_0x3410('0x31')]));_0x3083c6[_0x3410('0x30')]=_0x3083c6[_0x3410('0x30')][_0x3410('0x32')]?_0x3083c6[_0x3410('0x30')]:_0x5510b9['model'];if(_0x5038d8[_0x3410('0x2d')][_0x3410('0x3b')]){_0x3083c6['include']=[{'all':!![]}];}_0x3083c6=_['merge']({},_0x3083c6,_0x5038d8[_0x3410('0x40')]);return db['Cdr']['find'](_0x3083c6)[_0x3410('0x1e')](handleEntityNotFound(_0x1cac8c,null))[_0x3410('0x1e')](respondWithResult(_0x1cac8c,null))['catch'](handleError(_0x1cac8c,null));};exports['create']=function(_0x29d0e7,_0x5a3c61){return db[_0x3410('0x39')][_0x3410('0x41')](_0x29d0e7[_0x3410('0x42')],{})[_0x3410('0x1e')](respondWithResult(_0x5a3c61,0xc9))['catch'](handleError(_0x5a3c61,null));};exports[_0x3410('0x43')]=function(_0xc8832c,_0x555d0e){if(_0xc8832c[_0x3410('0x42')]['id']){delete _0xc8832c[_0x3410('0x42')]['id'];}return db['Cdr'][_0x3410('0x44')]({'where':{'id':_0xc8832c['params']['id']}})[_0x3410('0x1e')](handleEntityNotFound(_0x555d0e,null))['then'](saveUpdates(_0xc8832c[_0x3410('0x42')],null))[_0x3410('0x1e')](respondWithResult(_0x555d0e,null))[_0x3410('0x3d')](handleError(_0x555d0e,null));};exports[_0x3410('0x1f')]=function(_0x32717a,_0x110956){return db[_0x3410('0x39')][_0x3410('0x44')]({'where':{'id':_0x32717a[_0x3410('0x3f')]['id']}})[_0x3410('0x1e')](handleEntityNotFound(_0x110956,null))[_0x3410('0x1e')](removeEntity(_0x110956,null))[_0x3410('0x3d')](handleError(_0x110956,null));};exports[_0x3410('0x45')]=function(_0x2b856f,_0x3dc152){return db[_0x3410('0x39')][_0x3410('0x45')]()[_0x3410('0x1e')](respondWithResult(_0x3dc152,null))[_0x3410('0x3d')](handleError(_0x3dc152,null));}; \ No newline at end of file +var _0xc4cf=['hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','count','findAll','rows','catch','show','params','keys','includeAll','include','options','find','create','body','describe','fast-json-patch','moment','bluebird','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','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc4cf,0xab));var _0xfc4c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xc4cf[_0x2adbeb];return _0x5e18a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc4c('0x0'));var rp=require('request-promise');var moment=require(_0xfc4c('0x1'));var BPromise=require(_0xfc4c('0x2'));var Mustache=require('mustache');var util=require(_0xfc4c('0x3'));var path=require(_0xfc4c('0x4'));var sox=require(_0xfc4c('0x5'));var csv=require(_0xfc4c('0x6'));var ejs=require(_0xfc4c('0x7'));var fs=require('fs');var _=require(_0xfc4c('0x8'));var squel=require('squel');var crypto=require(_0xfc4c('0x9'));var jsforce=require(_0xfc4c('0xa'));var deskjs=require(_0xfc4c('0xb'));var toCsv=require(_0xfc4c('0x6'));var querystring=require(_0xfc4c('0xc'));var Papa=require('papaparse');var Redis=require(_0xfc4c('0xd'));var authService=require(_0xfc4c('0xe'));var qs=require(_0xfc4c('0xf'));var as=require(_0xfc4c('0x10'));var hardwareService=require(_0xfc4c('0x11'));var logger=require(_0xfc4c('0x12'))(_0xfc4c('0x13'));var utils=require(_0xfc4c('0x14'));var config=require(_0xfc4c('0x15'));var db=require(_0xfc4c('0x16'))['db'];function respondWithStatusCode(_0x490e27,_0x54d176){_0x54d176=_0x54d176||0xcc;return function(_0x599f9a){if(_0x599f9a){return _0x490e27[_0xfc4c('0x17')](_0x54d176);}return _0x490e27[_0xfc4c('0x18')](_0x54d176)[_0xfc4c('0x19')]();};}function respondWithResult(_0x307fd2,_0x383ef4){_0x383ef4=_0x383ef4||0xc8;return function(_0x1621da){if(_0x1621da){return _0x307fd2[_0xfc4c('0x18')](_0x383ef4)['json'](_0x1621da);}};}function respondWithFilteredResult(_0x3cf2c1,_0x46d496){return function(_0x4daa86){if(_0x4daa86){var _0x4bc9d6=_0x4daa86['count'],_0x14f6b2=_0x46d496[_0xfc4c('0x1a')],_0x271755=_0x46d496[_0xfc4c('0x1a')]+_0x46d496['limit'],_0x4dfe3d;if(_0x271755>=_0x4bc9d6){_0x271755=_0x4bc9d6;_0x4dfe3d=0xc8;}else{_0x4dfe3d=0xce;}_0x3cf2c1['status'](_0x4dfe3d);return _0x3cf2c1['set'](_0xfc4c('0x1b'),_0x14f6b2+'-'+_0x271755+'/'+_0x4bc9d6)[_0xfc4c('0x1c')](_0x4daa86);}return null;};}function patchUpdates(_0xf57a0b){return function(_0x5a65e8){try{jsonpatch[_0xfc4c('0x1d')](_0x5a65e8,_0xf57a0b,!![]);}catch(_0x3ade0d){return BPromise[_0xfc4c('0x1e')](_0x3ade0d);}return _0x5a65e8[_0xfc4c('0x1f')]();};}function saveUpdates(_0x38faea,_0x5bd9fc){return function(_0x926574){if(_0x926574){return _0x926574[_0xfc4c('0x20')](_0x38faea)[_0xfc4c('0x21')](function(_0x23089b){return _0x23089b;});}return null;};}function removeEntity(_0x547d53,_0x596392){return function(_0x370322){if(_0x370322){return _0x370322[_0xfc4c('0x22')]()[_0xfc4c('0x21')](function(){_0x547d53[_0xfc4c('0x18')](0xcc)[_0xfc4c('0x19')]();});}};}function handleEntityNotFound(_0x2f9ddc,_0x4a7eaa){return function(_0x23ad94){if(!_0x23ad94){_0x2f9ddc[_0xfc4c('0x17')](0x194);}return _0x23ad94;};}function handleError(_0x1e704e,_0x460d83){_0x460d83=_0x460d83||0x1f4;return function(_0x2ba3c1){logger['error'](_0x2ba3c1['stack']);if(_0x2ba3c1[_0xfc4c('0x23')]){delete _0x2ba3c1[_0xfc4c('0x23')];}_0x1e704e[_0xfc4c('0x18')](_0x460d83)[_0xfc4c('0x24')](_0x2ba3c1);};}exports[_0xfc4c('0x25')]=function(_0x2d202f,_0x181a8e){var _0x2ecd4b={},_0x5b9e20={},_0x28079f={'count':0x0,'rows':[]};var _0x4fd830=_[_0xfc4c('0x26')](db[_0xfc4c('0x27')][_0xfc4c('0x28')],function(_0x2a1222){return{'name':_0x2a1222[_0xfc4c('0x29')],'type':_0x2a1222[_0xfc4c('0x2a')][_0xfc4c('0x2b')]};});_0x5b9e20[_0xfc4c('0x2c')]=_['map'](_0x4fd830,'name');_0x5b9e20[_0xfc4c('0x2d')]=_['keys'](_0x2d202f[_0xfc4c('0x2d')]);_0x5b9e20[_0xfc4c('0x2e')]=_[_0xfc4c('0x2f')](_0x5b9e20[_0xfc4c('0x2c')],_0x5b9e20[_0xfc4c('0x2d')]);_0x2ecd4b['attributes']=_[_0xfc4c('0x2f')](_0x5b9e20[_0xfc4c('0x2c')],qs[_0xfc4c('0x30')](_0x2d202f[_0xfc4c('0x2d')]['fields']));_0x2ecd4b[_0xfc4c('0x31')]=_0x2ecd4b[_0xfc4c('0x31')][_0xfc4c('0x32')]?_0x2ecd4b[_0xfc4c('0x31')]:_0x5b9e20[_0xfc4c('0x2c')];if(!_0x2d202f[_0xfc4c('0x2d')][_0xfc4c('0x33')](_0xfc4c('0x34'))){_0x2ecd4b[_0xfc4c('0x35')]=qs[_0xfc4c('0x35')](_0x2d202f[_0xfc4c('0x2d')][_0xfc4c('0x35')]);_0x2ecd4b[_0xfc4c('0x1a')]=qs[_0xfc4c('0x1a')](_0x2d202f[_0xfc4c('0x2d')][_0xfc4c('0x1a')]);}_0x2ecd4b[_0xfc4c('0x36')]=qs[_0xfc4c('0x37')](_0x2d202f[_0xfc4c('0x2d')][_0xfc4c('0x37')]);_0x2ecd4b[_0xfc4c('0x38')]=qs['filters'](_['pick'](_0x2d202f[_0xfc4c('0x2d')],_0x5b9e20[_0xfc4c('0x2e')]),_0x4fd830);if(_0x2d202f[_0xfc4c('0x2d')]['filter']){_0x2ecd4b[_0xfc4c('0x38')]=_[_0xfc4c('0x39')](_0x2ecd4b[_0xfc4c('0x38')],{'$or':_[_0xfc4c('0x26')](_0x4fd830,function(_0x19d316){if(_0x19d316['type']!==_0xfc4c('0x3a')){var _0x2ce8e1={};_0x2ce8e1[_0x19d316[_0xfc4c('0x23')]]={'$like':'%'+_0x2d202f[_0xfc4c('0x2d')][_0xfc4c('0x3b')]+'%'};return _0x2ce8e1;}})});}_0x2ecd4b=_[_0xfc4c('0x39')]({},_0x2ecd4b,_0x2d202f['options']);var _0x1dd684={'where':_0x2ecd4b[_0xfc4c('0x38')]};return db[_0xfc4c('0x27')][_0xfc4c('0x3c')](_0x1dd684)[_0xfc4c('0x21')](function(_0xb355bf){_0x28079f[_0xfc4c('0x3c')]=_0xb355bf;if(_0x2d202f[_0xfc4c('0x2d')]['includeAll']){_0x2ecd4b['include']=[{'all':!![]}];}return db[_0xfc4c('0x27')][_0xfc4c('0x3d')](_0x2ecd4b);})[_0xfc4c('0x21')](function(_0x138afd){_0x28079f[_0xfc4c('0x3e')]=_0x138afd;return _0x28079f;})[_0xfc4c('0x21')](respondWithFilteredResult(_0x181a8e,_0x2ecd4b))[_0xfc4c('0x3f')](handleError(_0x181a8e,null));};exports[_0xfc4c('0x40')]=function(_0x5866cb,_0x4dd314){var _0xa6f799={'raw':!![],'where':{'id':_0x5866cb[_0xfc4c('0x41')]['id']}},_0x11b883={};_0x11b883[_0xfc4c('0x2c')]=_[_0xfc4c('0x42')](db[_0xfc4c('0x27')][_0xfc4c('0x28')]);_0x11b883[_0xfc4c('0x2d')]=_['keys'](_0x5866cb[_0xfc4c('0x2d')]);_0x11b883['filters']=_['intersection'](_0x11b883[_0xfc4c('0x2c')],_0x11b883[_0xfc4c('0x2d')]);_0xa6f799[_0xfc4c('0x31')]=_[_0xfc4c('0x2f')](_0x11b883[_0xfc4c('0x2c')],qs['fields'](_0x5866cb[_0xfc4c('0x2d')][_0xfc4c('0x30')]));_0xa6f799[_0xfc4c('0x31')]=_0xa6f799['attributes'][_0xfc4c('0x32')]?_0xa6f799['attributes']:_0x11b883['model'];if(_0x5866cb['query'][_0xfc4c('0x43')]){_0xa6f799[_0xfc4c('0x44')]=[{'all':!![]}];}_0xa6f799=_[_0xfc4c('0x39')]({},_0xa6f799,_0x5866cb[_0xfc4c('0x45')]);return db[_0xfc4c('0x27')][_0xfc4c('0x46')](_0xa6f799)[_0xfc4c('0x21')](handleEntityNotFound(_0x4dd314,null))['then'](respondWithResult(_0x4dd314,null))[_0xfc4c('0x3f')](handleError(_0x4dd314,null));};exports['create']=function(_0xc7df7e,_0x290fa1){return db[_0xfc4c('0x27')][_0xfc4c('0x47')](_0xc7df7e[_0xfc4c('0x48')],{})['then'](respondWithResult(_0x290fa1,0xc9))[_0xfc4c('0x3f')](handleError(_0x290fa1,null));};exports[_0xfc4c('0x20')]=function(_0x39398a,_0x4e0ec1){if(_0x39398a[_0xfc4c('0x48')]['id']){delete _0x39398a['body']['id'];}return db[_0xfc4c('0x27')][_0xfc4c('0x46')]({'where':{'id':_0x39398a[_0xfc4c('0x41')]['id']}})[_0xfc4c('0x21')](handleEntityNotFound(_0x4e0ec1,null))[_0xfc4c('0x21')](saveUpdates(_0x39398a['body'],null))[_0xfc4c('0x21')](respondWithResult(_0x4e0ec1,null))[_0xfc4c('0x3f')](handleError(_0x4e0ec1,null));};exports[_0xfc4c('0x22')]=function(_0x5c5225,_0x41258c){return db[_0xfc4c('0x27')]['find']({'where':{'id':_0x5c5225[_0xfc4c('0x41')]['id']}})[_0xfc4c('0x21')](handleEntityNotFound(_0x41258c,null))[_0xfc4c('0x21')](removeEntity(_0x41258c,null))['catch'](handleError(_0x41258c,null));};exports[_0xfc4c('0x49')]=function(_0x473ad4,_0x515d96){return db[_0xfc4c('0x27')][_0xfc4c('0x49')]()[_0xfc4c('0x21')](respondWithResult(_0x515d96,null))[_0xfc4c('0x3f')](handleError(_0x515d96,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1beed9d..2356223 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 _0x3baf=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','moment','bluebird','./cdr.attributes','exports','define','Cdr'];(function(_0x27ffcc,_0x359062){var _0x3b1abf=function(_0x303894){while(--_0x303894){_0x27ffcc['push'](_0x27ffcc['shift']());}};_0x3b1abf(++_0x359062);}(_0x3baf,0x70));var _0xf3ba=function(_0x80d21a,_0x26fc3b){_0x80d21a=_0x80d21a-0x0;var _0x239369=_0x3baf[_0x80d21a];return _0x239369;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3ba('0x2'));var BPromise=require(_0xf3ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf3ba('0x4'));module[_0xf3ba('0x5')]=function(_0x3d3d1a,_0x51f035){return _0x3d3d1a[_0xf3ba('0x6')](_0xf3ba('0x7'),attributes,{'tableName':_0xf3ba('0x8'),'paranoid':![],'indexes':[{'name':_0xf3ba('0x9'),'fields':[_0xf3ba('0x9')]},{'name':'calldate','fields':[_0xf3ba('0xa')]},{'name':_0xf3ba('0xb'),'fields':[_0xf3ba('0xb')]},{'name':_0xf3ba('0xc'),'fields':[_0xf3ba('0xc')]},{'name':'src','fields':[_0xf3ba('0xd')]},{'name':_0xf3ba('0xe'),'fields':[_0xf3ba('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd57a=['dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cdr.attributes','exports','cdr','accountcode','calldate','disposition'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd57a,0x179));var _0xad57=function(_0x5a9aa9,_0x30c824){_0x5a9aa9=_0x5a9aa9-0x0;var _0x2f17bf=_0xd57a[_0x5a9aa9];return _0x2f17bf;};'use strict';var _=require('lodash');var util=require(_0xad57('0x0'));var logger=require(_0xad57('0x1'))(_0xad57('0x2'));var moment=require(_0xad57('0x3'));var BPromise=require(_0xad57('0x4'));var rp=require(_0xad57('0x5'));var fs=require('fs');var path=require(_0xad57('0x6'));var rimraf=require('rimraf');var config=require(_0xad57('0x7'));var attributes=require(_0xad57('0x8'));module[_0xad57('0x9')]=function(_0x25a992,_0x587fc0){return _0x25a992['define']('Cdr',attributes,{'tableName':_0xad57('0xa'),'paranoid':![],'indexes':[{'name':_0xad57('0xb'),'fields':[_0xad57('0xb')]},{'name':'calldate','fields':[_0xad57('0xc')]},{'name':'disposition','fields':[_0xad57('0xd')]},{'name':_0xad57('0xe'),'fields':[_0xad57('0xe')]},{'name':'src','fields':[_0xad57('0xf')]},{'name':'uniqueid','fields':[_0xad57('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 82b39ee..647308b 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 _0xe76b=['rpc','../../config/environment','client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x81ec48,_0x50f33d){var _0xe16980=function(_0x1a8eea){while(--_0x1a8eea){_0x81ec48['push'](_0x81ec48['shift']());}};_0xe16980(++_0x50f33d);}(_0xe76b,0xfe));var _0xbe76=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xe76b[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0xbe76('0x0'));var util=require('util');var moment=require(_0xbe76('0x1'));var BPromise=require(_0xbe76('0x2'));var rs=require(_0xbe76('0x3'));var fs=require('fs');var Redis=require(_0xbe76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe76('0x5'));var logger=require('../../config/logger')(_0xbe76('0x6'));var config=require(_0xbe76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbe76('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e0e84,_0x28ac0c,_0x2bb7b7){return new BPromise(function(_0x55ba02,_0x3ad248){return client['request'](_0x3e0e84,_0x2bb7b7)[_0xbe76('0x9')](function(_0x200896){logger[_0xbe76('0xa')](_0xbe76('0xb'),_0x28ac0c,_0xbe76('0xc'));logger['debug'](_0xbe76('0xd'),_0x28ac0c,_0xbe76('0xc'),JSON[_0xbe76('0xe')](_0x200896));if(_0x200896[_0xbe76('0xf')]){if(_0x200896[_0xbe76('0xf')][_0xbe76('0x10')]===0x1f4){logger[_0xbe76('0xf')](_0xbe76('0xb'),_0x28ac0c,_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);return _0x3ad248(_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);}logger[_0xbe76('0xf')](_0xbe76('0xb'),_0x28ac0c,_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);return _0x55ba02(_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);}else{logger['info'](_0xbe76('0xb'),_0x28ac0c,'request\x20sent');_0x55ba02(_0x200896[_0xbe76('0x12')][_0xbe76('0x11')]);}})[_0xbe76('0x13')](function(_0x4f7e12){logger[_0xbe76('0xf')](_0xbe76('0xb'),_0x28ac0c,_0x4f7e12);_0x3ad248(_0x4f7e12);});});} \ No newline at end of file +var _0x156b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x118014,_0x4aa892){var _0x51432c=function(_0x5a1a35){while(--_0x5a1a35){_0x118014['push'](_0x118014['shift']());}};_0x51432c(++_0x4aa892);}(_0x156b,0x114));var _0xb156=function(_0x337eeb,_0x4f17e9){_0x337eeb=_0x337eeb-0x0;var _0x2dfdd8=_0x156b[_0x337eeb];return _0x2dfdd8;};'use strict';var _=require(_0xb156('0x0'));var util=require(_0xb156('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb156('0x2'));var fs=require('fs');var Redis=require(_0xb156('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb156('0x4'));var logger=require(_0xb156('0x5'))(_0xb156('0x6'));var config=require(_0xb156('0x7'));var jayson=require(_0xb156('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a983,_0x4d0daa,_0x24a256){return new BPromise(function(_0x1337f8,_0x5456db){return client['request'](_0x23a983,_0x24a256)[_0xb156('0x9')](function(_0x7555b8){logger[_0xb156('0xa')](_0xb156('0xb'),_0x4d0daa,_0xb156('0xc'));logger[_0xb156('0xd')](_0xb156('0xe'),_0x4d0daa,'request\x20sent',JSON[_0xb156('0xf')](_0x7555b8));if(_0x7555b8[_0xb156('0x10')]){if(_0x7555b8[_0xb156('0x10')][_0xb156('0x11')]===0x1f4){logger['error'](_0xb156('0xb'),_0x4d0daa,_0x7555b8[_0xb156('0x10')]['message']);return _0x5456db(_0x7555b8[_0xb156('0x10')][_0xb156('0x12')]);}logger[_0xb156('0x10')](_0xb156('0xb'),_0x4d0daa,_0x7555b8[_0xb156('0x10')]['message']);return _0x1337f8(_0x7555b8['error'][_0xb156('0x12')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x4d0daa,_0xb156('0xc'));_0x1337f8(_0x7555b8['result'][_0xb156('0x12')]);}})[_0xb156('0x13')](function(_0x341340){logger[_0xb156('0x10')]('Cdr,\x20%s,\x20%s',_0x4d0daa,_0x341340);_0x5456db(_0x341340);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2f69bff..edd5980 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 _0x4ef2=['create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1cc5ac,_0x44fa9a){var _0x1bf3c0=function(_0xf3751f){while(--_0xf3751f){_0x1cc5ac['push'](_0x1cc5ac['shift']());}};_0x1bf3c0(++_0x44fa9a);}(_0x4ef2,0x16d));var _0x24ef=function(_0x1c2b30,_0x226b8a){_0x1c2b30=_0x1c2b30-0x0;var _0xb8f3c3=_0x4ef2[_0x1c2b30];return _0xb8f3c3;};'use strict';var multer=require(_0x24ef('0x0'));var util=require(_0x24ef('0x1'));var path=require(_0x24ef('0x2'));var timeout=require(_0x24ef('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x24ef('0x4'));var interaction=require(_0x24ef('0x5'));var config=require('../../config/environment');var controller=require(_0x24ef('0x6'));router[_0x24ef('0x7')]('/',auth[_0x24ef('0x8')](),controller[_0x24ef('0x9')]);router['get'](_0x24ef('0xa'),auth['isAuthenticated'](),controller[_0x24ef('0xb')]);router['get'](_0x24ef('0xc'),auth[_0x24ef('0x8')](),controller[_0x24ef('0xd')]);router[_0x24ef('0xe')]('/',auth['isAuthenticated'](),controller[_0x24ef('0xf')]);router[_0x24ef('0x10')]('/:id',auth[_0x24ef('0x8')](),controller[_0x24ef('0x11')]);router[_0x24ef('0x12')](_0x24ef('0xc'),auth[_0x24ef('0x8')](),controller['destroy']);module[_0x24ef('0x13')]=router; \ No newline at end of file +var _0xe909=['post','update','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0xe909,0x120));var _0x9e90=function(_0x29bda0,_0x304d2c){_0x29bda0=_0x29bda0-0x0;var _0x23eee0=_0xe909[_0x29bda0];return _0x23eee0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e90('0x0'));var timeout=require(_0x9e90('0x1'));var express=require('express');var router=express[_0x9e90('0x2')]();var auth=require(_0x9e90('0x3'));var interaction=require(_0x9e90('0x4'));var config=require(_0x9e90('0x5'));var controller=require('./cdr.controller');router[_0x9e90('0x6')]('/',auth[_0x9e90('0x7')](),controller[_0x9e90('0x8')]);router[_0x9e90('0x6')]('/describe',auth[_0x9e90('0x7')](),controller[_0x9e90('0x9')]);router[_0x9e90('0x6')](_0x9e90('0xa'),auth[_0x9e90('0x7')](),controller[_0x9e90('0xb')]);router[_0x9e90('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9e90('0xa'),auth[_0x9e90('0x7')](),controller[_0x9e90('0xd')]);router['delete'](_0x9e90('0xa'),auth['isAuthenticated'](),controller[_0x9e90('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e832288..94a9559 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 _0x6408=['TEXT','exports','INTEGER','STRING'];(function(_0x5c28cc,_0x23d0b4){var _0x580dec=function(_0x3633bf){while(--_0x3633bf){_0x5c28cc['push'](_0x5c28cc['shift']());}};_0x580dec(++_0x23d0b4);}(_0x6408,0x1d5));var _0x8640=function(_0x5bd1cb,_0x164492){_0x5bd1cb=_0x5bd1cb-0x0;var _0x4371d8=_0x6408[_0x5bd1cb];return _0x4371d8;};'use strict';var Sequelize=require('sequelize');module[_0x8640('0x0')]={'priority':{'type':Sequelize[_0x8640('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8640('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8640('0x3')]()},'description':{'type':Sequelize[_0x8640('0x2')]},'interval':{'type':Sequelize[_0x8640('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb8f1=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb8f1,0x1d1));var _0x1b8f=function(_0x5bd76a,_0x4ed51a){_0x5bd76a=_0x5bd76a-0x0;var _0x242f7a=_0xb8f1[_0x5bd76a];return _0x242f7a;};'use strict';var Sequelize=require(_0x1b8f('0x0'));module[_0x1b8f('0x1')]={'priority':{'type':Sequelize[_0x1b8f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1b8f('0x3')],'allowNull':![],'defaultValue':_0x1b8f('0x4')},'appdata':{'type':Sequelize[_0x1b8f('0x5')]()},'description':{'type':Sequelize[_0x1b8f('0x3')]},'interval':{'type':Sequelize[_0x1b8f('0x3')],'defaultValue':_0x1b8f('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index aa6e661..eff565e 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 _0xd397=['intersection','model','fields','attributes','length','includeAll','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','show','params','keys','ChatApplication','query','filters'];(function(_0x55b8dd,_0x2c756d){var _0x5d73f6=function(_0x50d6e0){while(--_0x50d6e0){_0x55b8dd['push'](_0x55b8dd['shift']());}};_0x5d73f6(++_0x2c756d);}(_0xd397,0xb0));var _0x7d39=function(_0xf473b5,_0x490528){_0xf473b5=_0xf473b5-0x0;var _0x1e43b4=_0xd397[_0xf473b5];return _0x1e43b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d39('0x1'));var jsonpatch=require(_0x7d39('0x2'));var rp=require(_0x7d39('0x3'));var moment=require(_0x7d39('0x4'));var BPromise=require(_0x7d39('0x5'));var Mustache=require(_0x7d39('0x6'));var util=require('util');var path=require(_0x7d39('0x7'));var sox=require(_0x7d39('0x8'));var csv=require(_0x7d39('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d39('0xa'));var squel=require(_0x7d39('0xb'));var crypto=require(_0x7d39('0xc'));var jsforce=require(_0x7d39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7d39('0x9'));var querystring=require(_0x7d39('0xe'));var Papa=require(_0x7d39('0xf'));var Redis=require('ioredis');var authService=require(_0x7d39('0x10'));var qs=require(_0x7d39('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7d39('0x12'));var config=require(_0x7d39('0x13'));var db=require(_0x7d39('0x14'))['db'];function respondWithStatusCode(_0x256347,_0x1d6107){_0x1d6107=_0x1d6107||0xcc;return function(_0x506770){if(_0x506770){return _0x256347[_0x7d39('0x15')](_0x1d6107);}return _0x256347[_0x7d39('0x16')](_0x1d6107)[_0x7d39('0x17')]();};}function respondWithResult(_0x1e930c,_0x93bebf){_0x93bebf=_0x93bebf||0xc8;return function(_0x14f11a){if(_0x14f11a){return _0x1e930c[_0x7d39('0x16')](_0x93bebf)['json'](_0x14f11a);}};}function respondWithFilteredResult(_0x500295,_0x279aa7){return function(_0x2bed49){if(_0x2bed49){var _0x23a04d=_0x2bed49[_0x7d39('0x18')],_0x31f720=_0x279aa7[_0x7d39('0x19')],_0x59ba75=_0x279aa7[_0x7d39('0x19')]+_0x279aa7[_0x7d39('0x1a')],_0x13f884;if(_0x59ba75>=_0x23a04d){_0x59ba75=_0x23a04d;_0x13f884=0xc8;}else{_0x13f884=0xce;}_0x500295['status'](_0x13f884);return _0x500295[_0x7d39('0x1b')](_0x7d39('0x1c'),_0x31f720+'-'+_0x59ba75+'/'+_0x23a04d)[_0x7d39('0x1d')](_0x2bed49);}return null;};}function patchUpdates(_0x1471e2){return function(_0x2b4271){try{jsonpatch['apply'](_0x2b4271,_0x1471e2,!![]);}catch(_0x285473){return BPromise[_0x7d39('0x1e')](_0x285473);}return _0x2b4271[_0x7d39('0x1f')]();};}function saveUpdates(_0xffb9d3,_0x2e7e0d){return function(_0x5455e8){if(_0x5455e8){return _0x5455e8[_0x7d39('0x20')](_0xffb9d3)['then'](function(_0x2714a6){return _0x2714a6;});}return null;};}function removeEntity(_0x2d18ce,_0x2c0b1e){return function(_0x44cdae){if(_0x44cdae){return _0x44cdae[_0x7d39('0x21')]()[_0x7d39('0x22')](function(){_0x2d18ce[_0x7d39('0x16')](0xcc)[_0x7d39('0x17')]();});}};}function handleEntityNotFound(_0x8ec04a,_0x1678d0){return function(_0x9e19c5){if(!_0x9e19c5){_0x8ec04a[_0x7d39('0x15')](0x194);}return _0x9e19c5;};}function handleError(_0x257452,_0x5bb40a){_0x5bb40a=_0x5bb40a||0x1f4;return function(_0x51e8aa){logger[_0x7d39('0x23')](_0x51e8aa[_0x7d39('0x24')]);if(_0x51e8aa[_0x7d39('0x25')]){delete _0x51e8aa[_0x7d39('0x25')];}_0x257452['status'](_0x5bb40a)['send'](_0x51e8aa);};}exports[_0x7d39('0x26')]=function(_0x2032a4,_0x1ab92a){var _0x426352={'raw':!![],'where':{'id':_0x2032a4[_0x7d39('0x27')]['id']}},_0xa10153={};_0xa10153['model']=_[_0x7d39('0x28')](db[_0x7d39('0x29')]['rawAttributes']);_0xa10153[_0x7d39('0x2a')]=_['keys'](_0x2032a4[_0x7d39('0x2a')]);_0xa10153[_0x7d39('0x2b')]=_[_0x7d39('0x2c')](_0xa10153[_0x7d39('0x2d')],_0xa10153[_0x7d39('0x2a')]);_0x426352['attributes']=_['intersection'](_0xa10153[_0x7d39('0x2d')],qs['fields'](_0x2032a4[_0x7d39('0x2a')][_0x7d39('0x2e')]));_0x426352['attributes']=_0x426352[_0x7d39('0x2f')][_0x7d39('0x30')]?_0x426352['attributes']:_0xa10153[_0x7d39('0x2d')];if(_0x2032a4['query'][_0x7d39('0x31')]){_0x426352['include']=[{'all':!![]}];}_0x426352=_[_0x7d39('0x32')]({},_0x426352,_0x2032a4[_0x7d39('0x33')]);return db[_0x7d39('0x29')][_0x7d39('0x34')](_0x426352)[_0x7d39('0x22')](handleEntityNotFound(_0x1ab92a,null))[_0x7d39('0x22')](respondWithResult(_0x1ab92a,null))[_0x7d39('0x35')](handleError(_0x1ab92a,null));};exports[_0x7d39('0x20')]=function(_0x3f9890,_0x1cac0c){if(_0x3f9890['body']['id']){delete _0x3f9890[_0x7d39('0x36')]['id'];}return db[_0x7d39('0x29')]['find']({'where':{'id':_0x3f9890[_0x7d39('0x27')]['id']}})[_0x7d39('0x22')](handleEntityNotFound(_0x1cac0c,null))[_0x7d39('0x22')](saveUpdates(_0x3f9890[_0x7d39('0x36')],null))[_0x7d39('0x22')](respondWithResult(_0x1cac0c,null))['catch'](handleError(_0x1cac0c,null));};exports[_0x7d39('0x21')]=function(_0x46f841,_0x62e3b1){return db['ChatApplication'][_0x7d39('0x34')]({'where':{'id':_0x46f841['params']['id']}})['then'](handleEntityNotFound(_0x62e3b1,null))[_0x7d39('0x22')](removeEntity(_0x62e3b1,null))['catch'](handleError(_0x62e3b1,null));}; \ No newline at end of file +var _0x5a41=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','end','error','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','model','fields','includeAll','merge','options','catch','body','params','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path'];(function(_0x3fa0b7,_0x381ac7){var _0x113f27=function(_0x2dde4d){while(--_0x2dde4d){_0x3fa0b7['push'](_0x3fa0b7['shift']());}};_0x113f27(++_0x381ac7);}(_0x5a41,0x13c));var _0x15a4=function(_0x4dccf2,_0x5cfcd7){_0x4dccf2=_0x4dccf2-0x0;var _0x12640e=_0x5a41[_0x4dccf2];return _0x12640e;};'use strict';var pdf=require(_0x15a4('0x0'));var emlformat=require(_0x15a4('0x1'));var rimraf=require(_0x15a4('0x2'));var zipdir=require(_0x15a4('0x3'));var jsonpatch=require(_0x15a4('0x4'));var rp=require(_0x15a4('0x5'));var moment=require(_0x15a4('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x15a4('0x7'));var sox=require(_0x15a4('0x8'));var csv=require(_0x15a4('0x9'));var ejs=require(_0x15a4('0xa'));var fs=require('fs');var _=require(_0x15a4('0xb'));var squel=require(_0x15a4('0xc'));var crypto=require(_0x15a4('0xd'));var jsforce=require(_0x15a4('0xe'));var deskjs=require(_0x15a4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x15a4('0x10'));var Papa=require('papaparse');var Redis=require(_0x15a4('0x11'));var authService=require(_0x15a4('0x12'));var qs=require(_0x15a4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x15a4('0x14'))('api');var utils=require(_0x15a4('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4045a2,_0x542ad2){_0x542ad2=_0x542ad2||0xcc;return function(_0x18871f){if(_0x18871f){return _0x4045a2[_0x15a4('0x16')](_0x542ad2);}return _0x4045a2[_0x15a4('0x17')](_0x542ad2)['end']();};}function respondWithResult(_0x4ee9e3,_0x11830b){_0x11830b=_0x11830b||0xc8;return function(_0xcee68f){if(_0xcee68f){return _0x4ee9e3[_0x15a4('0x17')](_0x11830b)[_0x15a4('0x18')](_0xcee68f);}};}function respondWithFilteredResult(_0x75d9e3,_0x1d5682){return function(_0x324c8c){if(_0x324c8c){var _0x38e9c4=_0x324c8c[_0x15a4('0x19')],_0x23cb0c=_0x1d5682[_0x15a4('0x1a')],_0x28ef47=_0x1d5682[_0x15a4('0x1a')]+_0x1d5682[_0x15a4('0x1b')],_0x4e5c06;if(_0x28ef47>=_0x38e9c4){_0x28ef47=_0x38e9c4;_0x4e5c06=0xc8;}else{_0x4e5c06=0xce;}_0x75d9e3[_0x15a4('0x17')](_0x4e5c06);return _0x75d9e3['set'](_0x15a4('0x1c'),_0x23cb0c+'-'+_0x28ef47+'/'+_0x38e9c4)[_0x15a4('0x18')](_0x324c8c);}return null;};}function patchUpdates(_0x21451e){return function(_0x2ea279){try{jsonpatch[_0x15a4('0x1d')](_0x2ea279,_0x21451e,!![]);}catch(_0x1f46aa){return BPromise['reject'](_0x1f46aa);}return _0x2ea279['save']();};}function saveUpdates(_0x18f5e6,_0x85c16){return function(_0x267621){if(_0x267621){return _0x267621[_0x15a4('0x1e')](_0x18f5e6)[_0x15a4('0x1f')](function(_0x556365){return _0x556365;});}return null;};}function removeEntity(_0x2d5adc,_0x1f938a){return function(_0x4e1486){if(_0x4e1486){return _0x4e1486[_0x15a4('0x20')]()[_0x15a4('0x1f')](function(){_0x2d5adc[_0x15a4('0x17')](0xcc)[_0x15a4('0x21')]();});}};}function handleEntityNotFound(_0x9a339f,_0x36935b){return function(_0x2c0f2d){if(!_0x2c0f2d){_0x9a339f[_0x15a4('0x16')](0x194);}return _0x2c0f2d;};}function handleError(_0x3bad29,_0xf973f2){_0xf973f2=_0xf973f2||0x1f4;return function(_0x3bb474){logger[_0x15a4('0x22')](_0x3bb474['stack']);if(_0x3bb474[_0x15a4('0x23')]){delete _0x3bb474['name'];}_0x3bad29[_0x15a4('0x17')](_0xf973f2)[_0x15a4('0x24')](_0x3bb474);};}exports[_0x15a4('0x25')]=function(_0x13a6e2,_0x1961f9){var _0x3ee92c={'raw':!![],'where':{'id':_0x13a6e2['params']['id']}},_0x3f5fbd={};_0x3f5fbd['model']=_[_0x15a4('0x26')](db[_0x15a4('0x27')][_0x15a4('0x28')]);_0x3f5fbd[_0x15a4('0x29')]=_[_0x15a4('0x26')](_0x13a6e2[_0x15a4('0x29')]);_0x3f5fbd[_0x15a4('0x2a')]=_[_0x15a4('0x2b')](_0x3f5fbd['model'],_0x3f5fbd[_0x15a4('0x29')]);_0x3ee92c[_0x15a4('0x2c')]=_['intersection'](_0x3f5fbd[_0x15a4('0x2d')],qs[_0x15a4('0x2e')](_0x13a6e2[_0x15a4('0x29')][_0x15a4('0x2e')]));_0x3ee92c[_0x15a4('0x2c')]=_0x3ee92c[_0x15a4('0x2c')]['length']?_0x3ee92c[_0x15a4('0x2c')]:_0x3f5fbd['model'];if(_0x13a6e2[_0x15a4('0x29')][_0x15a4('0x2f')]){_0x3ee92c['include']=[{'all':!![]}];}_0x3ee92c=_[_0x15a4('0x30')]({},_0x3ee92c,_0x13a6e2[_0x15a4('0x31')]);return db[_0x15a4('0x27')]['find'](_0x3ee92c)['then'](handleEntityNotFound(_0x1961f9,null))['then'](respondWithResult(_0x1961f9,null))[_0x15a4('0x32')](handleError(_0x1961f9,null));};exports[_0x15a4('0x1e')]=function(_0x6e5726,_0x586ca1){if(_0x6e5726[_0x15a4('0x33')]['id']){delete _0x6e5726[_0x15a4('0x33')]['id'];}return db[_0x15a4('0x27')]['find']({'where':{'id':_0x6e5726[_0x15a4('0x34')]['id']}})[_0x15a4('0x1f')](handleEntityNotFound(_0x586ca1,null))[_0x15a4('0x1f')](saveUpdates(_0x6e5726['body'],null))[_0x15a4('0x1f')](respondWithResult(_0x586ca1,null))[_0x15a4('0x32')](handleError(_0x586ca1,null));};exports['destroy']=function(_0x23bf64,_0x446167){return db[_0x15a4('0x27')][_0x15a4('0x35')]({'where':{'id':_0x23bf64[_0x15a4('0x34')]['id']}})['then'](handleEntityNotFound(_0x446167,null))['then'](removeEntity(_0x446167,null))[_0x15a4('0x32')](handleError(_0x446167,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 499e298..4f711a2 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 _0x989e=['../../config/logger','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','lodash'];(function(_0x306ce1,_0x51a3bc){var _0x1a9c67=function(_0x409b69){while(--_0x409b69){_0x306ce1['push'](_0x306ce1['shift']());}};_0x1a9c67(++_0x51a3bc);}(_0x989e,0x1ad));var _0xe989=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x989e[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0xe989('0x0'));var util=require('util');var logger=require(_0xe989('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe989('0x2'));var fs=require('fs');var path=require(_0xe989('0x3'));var rimraf=require(_0xe989('0x4'));var config=require(_0xe989('0x5'));var attributes=require(_0xe989('0x6'));module[_0xe989('0x7')]=function(_0x4c42ed,_0x607e0d){return _0x4c42ed[_0xe989('0x8')]('ChatApplication',attributes,{'tableName':_0xe989('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3067=['chat_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x4bb01e,_0x262d51){var _0x43b3b6=function(_0x4b994b){while(--_0x4b994b){_0x4bb01e['push'](_0x4bb01e['shift']());}};_0x43b3b6(++_0x262d51);}(_0x3067,0x1e3));var _0x7306=function(_0x35cc52,_0x1dbdd8){_0x35cc52=_0x35cc52-0x0;var _0x5a52f4=_0x3067[_0x35cc52];return _0x5a52f4;};'use strict';var _=require(_0x7306('0x0'));var util=require(_0x7306('0x1'));var logger=require(_0x7306('0x2'))('api');var moment=require(_0x7306('0x3'));var BPromise=require(_0x7306('0x4'));var rp=require(_0x7306('0x5'));var fs=require('fs');var path=require(_0x7306('0x6'));var rimraf=require('rimraf');var config=require(_0x7306('0x7'));var attributes=require(_0x7306('0x8'));module[_0x7306('0x9')]=function(_0x2adad1,_0x30deff){return _0x2adad1[_0x7306('0xa')]('ChatApplication',attributes,{'tableName':_0x7306('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7306('0xc'),'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 b71fe58..c0fcf67 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 _0xd056=['ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1a048d,_0x186b58){var _0x196ff4=function(_0x249410){while(--_0x249410){_0x1a048d['push'](_0x1a048d['shift']());}};_0x196ff4(++_0x186b58);}(_0xd056,0x142));var _0x6d05=function(_0x27f7a9,_0x41ad09){_0x27f7a9=_0x27f7a9-0x0;var _0x93555a=_0xd056[_0x27f7a9];return _0x93555a;};'use strict';var _=require('lodash');var util=require(_0x6d05('0x0'));var moment=require(_0x6d05('0x1'));var BPromise=require(_0x6d05('0x2'));var rs=require(_0x6d05('0x3'));var fs=require('fs');var Redis=require(_0x6d05('0x4'));var db=require(_0x6d05('0x5'))['db'];var utils=require(_0x6d05('0x6'));var logger=require('../../config/logger')(_0x6d05('0x7'));var config=require(_0x6d05('0x8'));var jayson=require(_0x6d05('0x9'));var client=jayson[_0x6d05('0xa')][_0x6d05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170ecd,_0x1824e8,_0x16b779){return new BPromise(function(_0x2305c8,_0x13ceef){return client[_0x6d05('0xc')](_0x170ecd,_0x16b779)['then'](function(_0x1c7bce){logger[_0x6d05('0xd')](_0x6d05('0xe'),_0x1824e8,'request\x20sent');logger[_0x6d05('0xf')](_0x6d05('0x10'),_0x1824e8,_0x6d05('0x11'),JSON[_0x6d05('0x12')](_0x1c7bce));if(_0x1c7bce[_0x6d05('0x13')]){if(_0x1c7bce[_0x6d05('0x13')][_0x6d05('0x14')]===0x1f4){logger['error'](_0x6d05('0xe'),_0x1824e8,_0x1c7bce[_0x6d05('0x13')][_0x6d05('0x15')]);return _0x13ceef(_0x1c7bce[_0x6d05('0x13')][_0x6d05('0x15')]);}logger[_0x6d05('0x13')](_0x6d05('0xe'),_0x1824e8,_0x1c7bce['error'][_0x6d05('0x15')]);return _0x2305c8(_0x1c7bce[_0x6d05('0x13')]['message']);}else{logger[_0x6d05('0xd')]('ChatApplication,\x20%s,\x20%s',_0x1824e8,_0x6d05('0x11'));_0x2305c8(_0x1c7bce[_0x6d05('0x16')][_0x6d05('0x15')]);}})[_0x6d05('0x17')](function(_0x16ae33){logger[_0x6d05('0x13')](_0x6d05('0xe'),_0x1824e8,_0x16ae33);_0x13ceef(_0x16ae33);});});} \ No newline at end of file +var _0xc10a=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','ChatApplication,\x20%s,\x20%s','message','catch','util','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc10a,0x1ab));var _0xac10=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xc10a[_0x3f3f40];return _0x403b7a;};'use strict';var _=require('lodash');var util=require(_0xac10('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac10('0x1'));var db=require(_0xac10('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xac10('0x3'))(_0xac10('0x4'));var config=require(_0xac10('0x5'));var jayson=require(_0xac10('0x6'));var client=jayson[_0xac10('0x7')][_0xac10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x208a91,_0x22fb5c,_0x497911){return new BPromise(function(_0x47b944,_0x3c5f26){return client['request'](_0x208a91,_0x497911)[_0xac10('0x9')](function(_0x1d2810){logger[_0xac10('0xa')]('ChatApplication,\x20%s,\x20%s',_0x22fb5c,_0xac10('0xb'));logger[_0xac10('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x22fb5c,_0xac10('0xb'),JSON[_0xac10('0xd')](_0x1d2810));if(_0x1d2810[_0xac10('0xe')]){if(_0x1d2810[_0xac10('0xe')]['code']===0x1f4){logger[_0xac10('0xe')](_0xac10('0xf'),_0x22fb5c,_0x1d2810[_0xac10('0xe')][_0xac10('0x10')]);return _0x3c5f26(_0x1d2810[_0xac10('0xe')][_0xac10('0x10')]);}logger[_0xac10('0xe')](_0xac10('0xf'),_0x22fb5c,_0x1d2810[_0xac10('0xe')][_0xac10('0x10')]);return _0x47b944(_0x1d2810['error'][_0xac10('0x10')]);}else{logger[_0xac10('0xa')](_0xac10('0xf'),_0x22fb5c,_0xac10('0xb'));_0x47b944(_0x1d2810['result'][_0xac10('0x10')]);}})[_0xac10('0x11')](function(_0x21ad27){logger[_0xac10('0xe')]('ChatApplication,\x20%s,\x20%s',_0x22fb5c,_0x21ad27);_0x3c5f26(_0x21ad27);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index aaf6ad1..58521f8 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 _0x477e=['isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x180ace,_0x33aba2){var _0x4bf2c2=function(_0x43aa40){while(--_0x43aa40){_0x180ace['push'](_0x180ace['shift']());}};_0x4bf2c2(++_0x33aba2);}(_0x477e,0xf5));var _0xe477=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x477e[_0x13b392];return _0x39db24;};'use strict';var multer=require(_0xe477('0x0'));var util=require(_0xe477('0x1'));var path=require(_0xe477('0x2'));var timeout=require(_0xe477('0x3'));var express=require(_0xe477('0x4'));var router=express[_0xe477('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe477('0x6'));var config=require(_0xe477('0x7'));var controller=require('./chatApplication.controller');router[_0xe477('0x8')](_0xe477('0x9'),auth[_0xe477('0xa')](),controller[_0xe477('0xb')]);router[_0xe477('0xc')]('/:id',auth[_0xe477('0xa')](),controller[_0xe477('0xd')]);router['delete']('/:id',auth[_0xe477('0xa')](),controller[_0xe477('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf2f5=['update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0xf2f5,0x179));var _0x5f2f=function(_0x4942d8,_0x548618){_0x4942d8=_0x4942d8-0x0;var _0x15fd09=_0xf2f5[_0x4942d8];return _0x15fd09;};'use strict';var multer=require(_0x5f2f('0x0'));var util=require('util');var path=require(_0x5f2f('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f2f('0x2'));var router=express[_0x5f2f('0x3')]();var auth=require(_0x5f2f('0x4'));var interaction=require(_0x5f2f('0x5'));var config=require(_0x5f2f('0x6'));var controller=require(_0x5f2f('0x7'));router[_0x5f2f('0x8')](_0x5f2f('0x9'),auth[_0x5f2f('0xa')](),controller[_0x5f2f('0xb')]);router[_0x5f2f('0xc')](_0x5f2f('0x9'),auth[_0x5f2f('0xa')](),controller[_0x5f2f('0xd')]);router['delete'](_0x5f2f('0x9'),auth[_0x5f2f('0xa')](),controller['destroy']);module[_0x5f2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6b07ec7..cce64b1 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 _0x3554=['exports','STRING','sequelize'];(function(_0x45fca3,_0x98e48){var _0xd50f35=function(_0x5e806d){while(--_0x5e806d){_0x45fca3['push'](_0x45fca3['shift']());}};_0xd50f35(++_0x98e48);}(_0x3554,0x176));var _0x4355=function(_0x1d08d2,_0x20b66f){_0x1d08d2=_0x1d08d2-0x0;var _0x3a988b=_0x3554[_0x1d08d2];return _0x3a988b;};'use strict';var Sequelize=require(_0x4355('0x0'));module[_0x4355('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4355('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x13c8=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4f3d39,_0x4342d6){var _0x485861=function(_0x2a5ebb){while(--_0x2a5ebb){_0x4f3d39['push'](_0x4f3d39['shift']());}};_0x485861(++_0x4342d6);}(_0x13c8,0x139));var _0x813c=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x13c8[_0xaf25ae];return _0x49732d;};'use strict';var Sequelize=require(_0x813c('0x0'));module[_0x813c('0x1')]={'name':{'type':Sequelize[_0x813c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x813c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 73666ce..1fbb6dd 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 _0x5107=['name','index','map','ChatGroup','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','create','body','find','destroy','describe','ChatInternalMessage','count','toInteger','omit','ids','findOne','User','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./chatGroup.socket','register','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','stack'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x5107,0x170));var _0x7510=function(_0x10f967,_0x28917b){_0x10f967=_0x10f967-0x0;var _0x4022e1=_0x5107[_0x10f967];return _0x4022e1;};'use strict';var pdf=require(_0x7510('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7510('0x1'));var jsonpatch=require(_0x7510('0x2'));var rp=require(_0x7510('0x3'));var moment=require(_0x7510('0x4'));var BPromise=require(_0x7510('0x5'));var Mustache=require(_0x7510('0x6'));var util=require(_0x7510('0x7'));var path=require(_0x7510('0x8'));var sox=require(_0x7510('0x9'));var csv=require(_0x7510('0xa'));var ejs=require(_0x7510('0xb'));var fs=require('fs');var _=require(_0x7510('0xc'));var squel=require(_0x7510('0xd'));var crypto=require(_0x7510('0xe'));var jsforce=require(_0x7510('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7510('0xa'));var querystring=require('querystring');var Papa=require(_0x7510('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7510('0x11'));var as=require(_0x7510('0x12'));var hardwareService=require(_0x7510('0x13'));var logger=require(_0x7510('0x14'))('api');var utils=require(_0x7510('0x15'));var config=require(_0x7510('0x16'));var db=require(_0x7510('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7510('0x18'),'port':0x18eb});var socket=require(_0x7510('0x19'))(new Redis(config[_0x7510('0x1a')]));require(_0x7510('0x1b'))[_0x7510('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7510('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3c0122,_0x1b1ab8,_0x186c75){if(_0x186c75){var _0x185496=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x185496['test'](_0x1b1ab8)){return _0x3c0122;}else{throw new db['Sequelize'][(_0x7510('0x1e'))](_0x7510('0x1f'));}}else{return _0x3c0122;}}function respondWithRpcPromise(_0x45fef5,_0x568caf,_0x3ae05c,_0x2af845){return new BPromise(function(_0x2e5aeb,_0x32e146){var _0x25096b=_0x2af845||client;return _0x25096b[_0x7510('0x20')](_0x45fef5,_0x3ae05c)[_0x7510('0x21')](function(_0x289547){logger[_0x7510('0x22')](_0x7510('0x23'),_0x568caf,'request\x20sent');logger[_0x7510('0x24')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x568caf,_0x7510('0x25'),JSON[_0x7510('0x26')](_0x289547));if(_0x289547[_0x7510('0x27')]){if(_0x289547[_0x7510('0x27')][_0x7510('0x28')]===0x1f4){logger[_0x7510('0x27')]('ChatGroup,\x20%s,\x20%s',_0x568caf,_0x289547[_0x7510('0x27')][_0x7510('0x29')]);return _0x32e146(_0x289547[_0x7510('0x27')][_0x7510('0x29')]);}logger[_0x7510('0x27')](_0x7510('0x23'),_0x568caf,_0x289547[_0x7510('0x27')][_0x7510('0x29')]);return _0x2e5aeb(_0x289547[_0x7510('0x27')]['message']);}else{logger[_0x7510('0x22')](_0x7510('0x23'),_0x568caf,_0x7510('0x25'));_0x2e5aeb(_0x289547[_0x7510('0x2a')][_0x7510('0x29')]);}})[_0x7510('0x2b')](function(_0x54b760){logger[_0x7510('0x27')](_0x7510('0x23'),_0x568caf,_0x54b760);_0x32e146(_0x54b760);});});}function respondWithStatusCode(_0x3e7c52,_0x567bf6){_0x567bf6=_0x567bf6||0xcc;return function(_0x56be33){if(_0x56be33){return _0x3e7c52[_0x7510('0x2c')](_0x567bf6);}return _0x3e7c52[_0x7510('0x2d')](_0x567bf6)[_0x7510('0x2e')]();};}function respondWithResult(_0x3b54e6,_0x18582c){_0x18582c=_0x18582c||0xc8;return function(_0x381131){if(_0x381131){return _0x3b54e6[_0x7510('0x2d')](_0x18582c)['json'](_0x381131);}};}function respondWithFilteredResult(_0x49ae98,_0x59bed2){return function(_0x3ef9b6){if(_0x3ef9b6){var _0x3a321b=_0x3ef9b6['count'],_0x9b6d1=_0x59bed2['offset'],_0x34bb3e=_0x59bed2[_0x7510('0x2f')]+_0x59bed2[_0x7510('0x30')],_0x1b5f9b;if(_0x34bb3e>=_0x3a321b){_0x34bb3e=_0x3a321b;_0x1b5f9b=0xc8;}else{_0x1b5f9b=0xce;}_0x49ae98[_0x7510('0x2d')](_0x1b5f9b);return _0x49ae98[_0x7510('0x31')](_0x7510('0x32'),_0x9b6d1+'-'+_0x34bb3e+'/'+_0x3a321b)[_0x7510('0x33')](_0x3ef9b6);}return null;};}function patchUpdates(_0x70c9){return function(_0x14f4b0){try{jsonpatch[_0x7510('0x34')](_0x14f4b0,_0x70c9,!![]);}catch(_0x2ef167){return BPromise[_0x7510('0x35')](_0x2ef167);}return _0x14f4b0['save']();};}function saveUpdates(_0x19960f,_0x2f78f2){return function(_0x157029){if(_0x157029){return _0x157029[_0x7510('0x36')](_0x19960f)[_0x7510('0x21')](function(_0x437016){return _0x437016;});}return null;};}function removeEntity(_0x196cb1,_0x5857a1){return function(_0x208be9){if(_0x208be9){return _0x208be9['destroy']()[_0x7510('0x21')](function(){_0x196cb1[_0x7510('0x2d')](0xcc)[_0x7510('0x2e')]();});}};}function handleEntityNotFound(_0x21522e,_0x1f1c2b){return function(_0x1d9729){if(!_0x1d9729){_0x21522e[_0x7510('0x2c')](0x194);}return _0x1d9729;};}function handleError(_0x11abd0,_0x1856de){_0x1856de=_0x1856de||0x1f4;return function(_0xda2e21){logger[_0x7510('0x27')](_0xda2e21[_0x7510('0x37')]);if(_0xda2e21[_0x7510('0x38')]){delete _0xda2e21['name'];}_0x11abd0['status'](_0x1856de)['send'](_0xda2e21);};}exports[_0x7510('0x39')]=function(_0xbb0ad3,_0x36b2b6){var _0x3342d5={},_0x3ee27a={},_0xbdc8ab={'count':0x0,'rows':[]};var _0x5ef298=_[_0x7510('0x3a')](db[_0x7510('0x3b')][_0x7510('0x3c')],function(_0x217372){return{'name':_0x217372[_0x7510('0x3d')],'type':_0x217372['type'][_0x7510('0x3e')]};});_0x3ee27a['model']=_['map'](_0x5ef298,_0x7510('0x38'));_0x3ee27a[_0x7510('0x3f')]=_['keys'](_0xbb0ad3['query']);_0x3ee27a[_0x7510('0x40')]=_['intersection'](_0x3ee27a[_0x7510('0x41')],_0x3ee27a[_0x7510('0x3f')]);_0x3342d5[_0x7510('0x42')]=_[_0x7510('0x43')](_0x3ee27a[_0x7510('0x41')],qs['fields'](_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x44')]));_0x3342d5[_0x7510('0x42')]=_0x3342d5[_0x7510('0x42')][_0x7510('0x45')]?_0x3342d5['attributes']:_0x3ee27a[_0x7510('0x41')];if(!_0xbb0ad3['query'][_0x7510('0x46')](_0x7510('0x47'))){_0x3342d5['limit']=qs[_0x7510('0x30')](_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x30')]);_0x3342d5[_0x7510('0x2f')]=qs[_0x7510('0x2f')](_0xbb0ad3['query'][_0x7510('0x2f')]);}_0x3342d5[_0x7510('0x48')]=qs['sort'](_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x49')]);_0x3342d5[_0x7510('0x4a')]=qs[_0x7510('0x40')](_[_0x7510('0x4b')](_0xbb0ad3[_0x7510('0x3f')],_0x3ee27a['filters']),_0x5ef298);if(_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x4c')]){_0x3342d5[_0x7510('0x4a')]=_['merge'](_0x3342d5['where'],{'$or':_['map'](_0x5ef298,function(_0x174a0a){if(_0x174a0a['type']!==_0x7510('0x4d')){var _0x808969={};_0x808969[_0x174a0a[_0x7510('0x38')]]={'$like':'%'+_0xbb0ad3['query'][_0x7510('0x4c')]+'%'};return _0x808969;}})});}_0x3342d5=_[_0x7510('0x4e')]({},_0x3342d5,_0xbb0ad3[_0x7510('0x4f')]);var _0x26b1e1={'where':_0x3342d5['where']};return db[_0x7510('0x3b')]['count'](_0x26b1e1)[_0x7510('0x21')](function(_0xc749e3){_0xbdc8ab['count']=_0xc749e3;if(_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x50')]){_0x3342d5[_0x7510('0x51')]=[{'all':!![]}];}return db[_0x7510('0x3b')][_0x7510('0x52')](_0x3342d5);})[_0x7510('0x21')](function(_0x45cf9f){_0xbdc8ab['rows']=_0x45cf9f;return _0xbdc8ab;})[_0x7510('0x21')](respondWithFilteredResult(_0x36b2b6,_0x3342d5))[_0x7510('0x2b')](handleError(_0x36b2b6,null));};exports[_0x7510('0x53')]=function(_0x29f49c,_0x1b4c0b){var _0x1282ca={'raw':!![],'where':{'id':_0x29f49c[_0x7510('0x54')]['id']}},_0x19f14f={};_0x19f14f[_0x7510('0x41')]=_[_0x7510('0x55')](db[_0x7510('0x3b')][_0x7510('0x3c')]);_0x19f14f[_0x7510('0x3f')]=_[_0x7510('0x55')](_0x29f49c[_0x7510('0x3f')]);_0x19f14f[_0x7510('0x40')]=_[_0x7510('0x43')](_0x19f14f['model'],_0x19f14f[_0x7510('0x3f')]);_0x1282ca[_0x7510('0x42')]=_[_0x7510('0x43')](_0x19f14f['model'],qs[_0x7510('0x44')](_0x29f49c['query'][_0x7510('0x44')]));_0x1282ca[_0x7510('0x42')]=_0x1282ca[_0x7510('0x42')][_0x7510('0x45')]?_0x1282ca[_0x7510('0x42')]:_0x19f14f[_0x7510('0x41')];if(_0x29f49c['query']['includeAll']){_0x1282ca[_0x7510('0x51')]=[{'all':!![]}];}_0x1282ca=_[_0x7510('0x4e')]({},_0x1282ca,_0x29f49c[_0x7510('0x4f')]);return db[_0x7510('0x3b')]['find'](_0x1282ca)[_0x7510('0x21')](handleEntityNotFound(_0x1b4c0b,null))[_0x7510('0x21')](respondWithResult(_0x1b4c0b,null))[_0x7510('0x2b')](handleError(_0x1b4c0b,null));};exports['create']=function(_0x10837f,_0x5310c0){return db[_0x7510('0x3b')][_0x7510('0x56')](_0x10837f[_0x7510('0x57')],{})[_0x7510('0x21')](respondWithResult(_0x5310c0,0xc9))[_0x7510('0x2b')](handleError(_0x5310c0,null));};exports[_0x7510('0x36')]=function(_0x5e2c05,_0x3190ab){if(_0x5e2c05[_0x7510('0x57')]['id']){delete _0x5e2c05['body']['id'];}return db[_0x7510('0x3b')][_0x7510('0x58')]({'where':{'id':_0x5e2c05[_0x7510('0x54')]['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x3190ab,null))['then'](saveUpdates(_0x5e2c05['body'],null))[_0x7510('0x21')](respondWithResult(_0x3190ab,null))[_0x7510('0x2b')](handleError(_0x3190ab,null));};exports[_0x7510('0x59')]=function(_0x3482ad,_0xd61358){return db[_0x7510('0x3b')]['find']({'where':{'id':_0x3482ad[_0x7510('0x54')]['id']}})[_0x7510('0x21')](handleEntityNotFound(_0xd61358,null))['then'](removeEntity(_0xd61358,null))[_0x7510('0x2b')](handleError(_0xd61358,null));};exports[_0x7510('0x5a')]=function(_0x4aa298,_0x4e12de){return db[_0x7510('0x3b')][_0x7510('0x5a')]()[_0x7510('0x21')](respondWithResult(_0x4e12de,null))[_0x7510('0x2b')](handleError(_0x4e12de,null));};exports['getUnread']=function(_0x3bec0a,_0x342f1c,_0x4381d0){return db[_0x7510('0x5b')][_0x7510('0x5c')]({'where':{'ChatGroupId':_0x3bec0a[_0x7510('0x54')]['id'],'ToId':_0x3bec0a['user']['id'],'read':![]}})[_0x7510('0x21')](function(_0x4f490a){return{'id':_[_0x7510('0x5d')](_0x3bec0a[_0x7510('0x54')]['id']),'count':_0x4f490a};})[_0x7510('0x21')](respondWithResult(_0x342f1c,null))['catch'](handleError(_0x342f1c,null));};exports['addMembers']=function(_0x300ad7,_0x38895f,_0x592f09){return db[_0x7510('0x3b')]['find']({'where':{'id':_0x300ad7['params']['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x38895f,null))[_0x7510('0x21')](function(_0xc868a3){if(_0xc868a3){return _0xc868a3['addMembers'](_0x300ad7['body']['ids'],_[_0x7510('0x5e')](_0x300ad7['body'],[_0x7510('0x5f'),'id'])||{});}})[_0x7510('0x21')](respondWithResult(_0x38895f,null))[_0x7510('0x2b')](handleError(_0x38895f,null));};exports['getMembers']=function(_0x4d4e8a,_0x3f3c7c,_0x203e97){var _0x94a10d={};var _0x242e7c={};var _0x20ee28;var _0x4e009f;return db[_0x7510('0x3b')][_0x7510('0x60')]({'where':{'id':_0x4d4e8a[_0x7510('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f3c7c,null))[_0x7510('0x21')](function(_0x21a347){if(_0x21a347){_0x20ee28=_0x21a347;_0x242e7c[_0x7510('0x41')]=_[_0x7510('0x55')](db[_0x7510('0x61')][_0x7510('0x3c')]);_0x242e7c[_0x7510('0x3f')]=_[_0x7510('0x55')](_0x4d4e8a[_0x7510('0x3f')]);_0x242e7c['filters']=_[_0x7510('0x43')](_0x242e7c[_0x7510('0x41')],_0x242e7c['query']);_0x94a10d[_0x7510('0x42')]=_['intersection'](_0x242e7c['model'],qs[_0x7510('0x44')](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x44')]));_0x94a10d[_0x7510('0x42')]=_0x94a10d['attributes']['length']?_0x94a10d[_0x7510('0x42')]:_0x242e7c[_0x7510('0x41')];_0x94a10d['order']=qs[_0x7510('0x49')](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x49')]);_0x94a10d[_0x7510('0x4a')]=qs[_0x7510('0x40')](_[_0x7510('0x4b')](_0x4d4e8a[_0x7510('0x3f')],_0x242e7c[_0x7510('0x40')]));if(_0x4d4e8a[_0x7510('0x3f')]['filter']){_0x94a10d[_0x7510('0x4a')]=_['merge'](_0x94a10d[_0x7510('0x4a')],{'$or':_[_0x7510('0x3a')](_0x94a10d[_0x7510('0x42')],function(_0x235202){var _0x5cc36b={};_0x5cc36b[_0x235202]={'$like':'%'+_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x4c')]+'%'};return _0x5cc36b;})});}_0x94a10d=_[_0x7510('0x4e')]({},_0x94a10d,_0x4d4e8a[_0x7510('0x4f')]);return _0x20ee28[_0x7510('0x62')](_0x94a10d);}})['then'](function(_0x3786f9){if(_0x3786f9){_0x4e009f=_0x3786f9[_0x7510('0x45')];if(!_0x4d4e8a[_0x7510('0x3f')]['hasOwnProperty'](_0x7510('0x47'))){_0x94a10d[_0x7510('0x30')]=qs['limit'](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x30')]);_0x94a10d['offset']=qs['offset'](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x2f')]);}return _0x20ee28['getMembers'](_0x94a10d);}})[_0x7510('0x21')](function(_0x52b028){if(_0x52b028){return _0x52b028?{'count':_0x4e009f,'rows':_0x52b028}:null;}})[_0x7510('0x21')](respondWithResult(_0x3f3c7c,null))['catch'](handleError(_0x3f3c7c,null));};exports[_0x7510('0x63')]=function(_0x253927,_0x273922,_0x5a7135){return db[_0x7510('0x3b')]['find']({'where':{'id':_0x253927['params']['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x273922,null))[_0x7510('0x21')](function(_0x382c8e){if(_0x382c8e){return _0x382c8e[_0x7510('0x63')](_0x253927[_0x7510('0x3f')][_0x7510('0x5f')]);}})[_0x7510('0x21')](respondWithStatusCode(_0x273922,null))[_0x7510('0x2b')](handleError(_0x273922,null));};exports[_0x7510('0x64')]=function(_0x5b9537,_0x1335d4,_0x17c2d0){if(_0x5b9537[_0x7510('0x57')]['id']){delete _0x5b9537[_0x7510('0x57')]['id'];}return db[_0x7510('0x3b')][_0x7510('0x58')]({'where':{'id':_0x5b9537['params']['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x1335d4,null))[_0x7510('0x21')](function(_0x1494d2){if(_0x1494d2){_0x5b9537['body'][_0x7510('0x65')]=_0x1494d2['id'];return db[_0x7510('0x5b')][_0x7510('0x56')](_0x5b9537[_0x7510('0x57')]);}})[_0x7510('0x21')](respondWithResult(_0x1335d4,null))[_0x7510('0x2b')](handleError(_0x1335d4,null));};exports[_0x7510('0x66')]=function(_0x4a8f0c,_0x3a1ea2,_0x2a5f98){var _0x5bed96={};var _0x504d9a={};var _0x23ed70;var _0x3c10a5;return db[_0x7510('0x3b')]['findOne']({'where':{'id':_0x4a8f0c[_0x7510('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a1ea2,null))[_0x7510('0x21')](function(_0x53c484){if(_0x53c484){_0x23ed70=_0x53c484;_0x504d9a[_0x7510('0x41')]=_[_0x7510('0x55')](db[_0x7510('0x5b')][_0x7510('0x3c')]);_0x504d9a[_0x7510('0x3f')]=_[_0x7510('0x55')](_0x4a8f0c[_0x7510('0x3f')]);_0x504d9a['filters']=_[_0x7510('0x43')](_0x504d9a[_0x7510('0x41')],_0x504d9a[_0x7510('0x3f')]);_0x5bed96[_0x7510('0x42')]=_[_0x7510('0x43')](_0x504d9a['model'],qs[_0x7510('0x44')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x44')]));_0x5bed96[_0x7510('0x42')]=_0x5bed96[_0x7510('0x42')]['length']?_0x5bed96[_0x7510('0x42')]:_0x504d9a[_0x7510('0x41')];_0x5bed96['order']=qs[_0x7510('0x49')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x49')]);_0x5bed96[_0x7510('0x4a')]=qs['filters'](_['pick'](_0x4a8f0c[_0x7510('0x3f')],_0x504d9a['filters']));if(_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x4c')]){_0x5bed96['where']=_[_0x7510('0x4e')](_0x5bed96[_0x7510('0x4a')],{'$or':_[_0x7510('0x3a')](_0x5bed96[_0x7510('0x42')],function(_0x5104ca){var _0x5a110d={};_0x5a110d[_0x5104ca]={'$like':'%'+_0x4a8f0c[_0x7510('0x3f')]['filter']+'%'};return _0x5a110d;})});}if(_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x67')]){var _0x511f9a=_0x4a8f0c['query']['$gte'][_0x7510('0x68')](',');var _0x5a5f4c={};_0x5a5f4c[_0x511f9a[0x0]]={'$gte':moment(_0x511f9a[0x1])['format'](_0x7510('0x69'))};_0x5bed96[_0x7510('0x4a')]=_['merge'](_0x5bed96[_0x7510('0x4a')],_0x5a5f4c);}_0x5bed96=_[_0x7510('0x4e')]({},_0x5bed96,_0x4a8f0c[_0x7510('0x4f')]);return _0x23ed70[_0x7510('0x66')](_0x5bed96);}})[_0x7510('0x21')](function(_0x35e96b){if(_0x35e96b){_0x3c10a5=_0x35e96b[_0x7510('0x45')];if(!_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x46')](_0x7510('0x47'))){_0x5bed96[_0x7510('0x30')]=qs[_0x7510('0x30')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x30')]);_0x5bed96[_0x7510('0x2f')]=qs[_0x7510('0x2f')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x2f')]);}return _0x23ed70[_0x7510('0x66')](_0x5bed96);}})[_0x7510('0x21')](function(_0x1c8671){if(_0x1c8671){return _0x1c8671?{'count':_0x3c10a5,'rows':_0x1c8671}:null;}})['then'](respondWithResult(_0x3a1ea2,null))[_0x7510('0x2b')](handleError(_0x3a1ea2,null));}; \ No newline at end of file +var _0xe63f=['describe','getUnread','ChatInternalMessage','user','addMembers','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','./chatGroup.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~!@#$%^&-_=+[{]}.','ChatGroup,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','update','destroy','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','then','includeAll','findAll','rows','show','params','create','body','find'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0xe63f,0xe5));var _0xfe63=function(_0x451f7f,_0x56fdd7){_0x451f7f=_0x451f7f-0x0;var _0x22fe20=_0xe63f[_0x451f7f];return _0x22fe20;};'use strict';var pdf=require(_0xfe63('0x0'));var emlformat=require(_0xfe63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe63('0x2'));var rp=require(_0xfe63('0x3'));var moment=require(_0xfe63('0x4'));var BPromise=require(_0xfe63('0x5'));var Mustache=require(_0xfe63('0x6'));var util=require(_0xfe63('0x7'));var path=require(_0xfe63('0x8'));var sox=require(_0xfe63('0x9'));var csv=require(_0xfe63('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfe63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe63('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfe63('0xd'));var Papa=require(_0xfe63('0xe'));var Redis=require(_0xfe63('0xf'));var authService=require(_0xfe63('0x10'));var qs=require(_0xfe63('0x11'));var as=require(_0xfe63('0x12'));var hardwareService=require(_0xfe63('0x13'));var logger=require(_0xfe63('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfe63('0x15'));var db=require('../../mysqldb')['db'];config[_0xfe63('0x16')]=_[_0xfe63('0x17')](config[_0xfe63('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe63('0x16')]));require(_0xfe63('0x18'))['register'](socket);var jayson=require(_0xfe63('0x19'));var client=jayson[_0xfe63('0x1a')][_0xfe63('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x53011c,_0x495dda,_0x11efb4){if(_0x11efb4){var _0x4eda44=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eda44[_0xfe63('0x1c')](_0x495dda)){return _0x53011c;}else{throw new db[(_0xfe63('0x1d'))][(_0xfe63('0x1e'))](_0xfe63('0x1f'));}}else{return _0x53011c;}}function respondWithRpcPromise(_0x5bbce7,_0x1f068c,_0x3a49de,_0x48bfa9){return new BPromise(function(_0x1ebac0,_0x575797){var _0x468617=_0x48bfa9||client;return _0x468617['request'](_0x5bbce7,_0x3a49de)['then'](function(_0x148d47){logger['info'](_0xfe63('0x20'),_0x1f068c,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1f068c,_0xfe63('0x21'),JSON['stringify'](_0x148d47));if(_0x148d47[_0xfe63('0x22')]){if(_0x148d47['error'][_0xfe63('0x23')]===0x1f4){logger[_0xfe63('0x22')](_0xfe63('0x20'),_0x1f068c,_0x148d47[_0xfe63('0x22')]['message']);return _0x575797(_0x148d47[_0xfe63('0x22')]['message']);}logger[_0xfe63('0x22')](_0xfe63('0x20'),_0x1f068c,_0x148d47[_0xfe63('0x22')]['message']);return _0x1ebac0(_0x148d47[_0xfe63('0x22')][_0xfe63('0x24')]);}else{logger[_0xfe63('0x25')](_0xfe63('0x20'),_0x1f068c,_0xfe63('0x21'));_0x1ebac0(_0x148d47[_0xfe63('0x26')]['message']);}})[_0xfe63('0x27')](function(_0xd252a0){logger[_0xfe63('0x22')](_0xfe63('0x20'),_0x1f068c,_0xd252a0);_0x575797(_0xd252a0);});});}function respondWithStatusCode(_0x38b0e1,_0x5035ba){_0x5035ba=_0x5035ba||0xcc;return function(_0x1edee8){if(_0x1edee8){return _0x38b0e1[_0xfe63('0x28')](_0x5035ba);}return _0x38b0e1[_0xfe63('0x29')](_0x5035ba)[_0xfe63('0x2a')]();};}function respondWithResult(_0x8f69e7,_0x11e1ed){_0x11e1ed=_0x11e1ed||0xc8;return function(_0x462ba9){if(_0x462ba9){return _0x8f69e7['status'](_0x11e1ed)[_0xfe63('0x2b')](_0x462ba9);}};}function respondWithFilteredResult(_0x209d21,_0x54de75){return function(_0x9feea8){if(_0x9feea8){var _0x344a09=_0x9feea8['count'],_0x49bce1=_0x54de75[_0xfe63('0x2c')],_0x40fb8d=_0x54de75[_0xfe63('0x2c')]+_0x54de75[_0xfe63('0x2d')],_0x45e922;if(_0x40fb8d>=_0x344a09){_0x40fb8d=_0x344a09;_0x45e922=0xc8;}else{_0x45e922=0xce;}_0x209d21['status'](_0x45e922);return _0x209d21['set'](_0xfe63('0x2e'),_0x49bce1+'-'+_0x40fb8d+'/'+_0x344a09)[_0xfe63('0x2b')](_0x9feea8);}return null;};}function patchUpdates(_0x55758a){return function(_0x1b7034){try{jsonpatch['apply'](_0x1b7034,_0x55758a,!![]);}catch(_0x3213a6){return BPromise[_0xfe63('0x2f')](_0x3213a6);}return _0x1b7034['save']();};}function saveUpdates(_0x309bd6,_0x4a144b){return function(_0x23a6a0){if(_0x23a6a0){return _0x23a6a0[_0xfe63('0x30')](_0x309bd6)['then'](function(_0x2537df){return _0x2537df;});}return null;};}function removeEntity(_0x3d3798,_0x1db0d2){return function(_0x7d761b){if(_0x7d761b){return _0x7d761b[_0xfe63('0x31')]()['then'](function(){_0x3d3798[_0xfe63('0x29')](0xcc)[_0xfe63('0x2a')]();});}};}function handleEntityNotFound(_0x58f619,_0x1fcdb8){return function(_0x150bd6){if(!_0x150bd6){_0x58f619['sendStatus'](0x194);}return _0x150bd6;};}function handleError(_0x1b55b4,_0x26715a){_0x26715a=_0x26715a||0x1f4;return function(_0x1200be){logger[_0xfe63('0x22')](_0x1200be[_0xfe63('0x32')]);if(_0x1200be[_0xfe63('0x33')]){delete _0x1200be[_0xfe63('0x33')];}_0x1b55b4[_0xfe63('0x29')](_0x26715a)[_0xfe63('0x34')](_0x1200be);};}exports['index']=function(_0x3617a8,_0x56aa96){var _0x8286eb={},_0x30af33={},_0x5cd543={'count':0x0,'rows':[]};var _0x240d7d=_[_0xfe63('0x35')](db[_0xfe63('0x36')][_0xfe63('0x37')],function(_0x2204fe){return{'name':_0x2204fe[_0xfe63('0x38')],'type':_0x2204fe[_0xfe63('0x39')][_0xfe63('0x3a')]};});_0x30af33[_0xfe63('0x3b')]=_['map'](_0x240d7d,'name');_0x30af33[_0xfe63('0x3c')]=_[_0xfe63('0x3d')](_0x3617a8['query']);_0x30af33[_0xfe63('0x3e')]=_[_0xfe63('0x3f')](_0x30af33['model'],_0x30af33[_0xfe63('0x3c')]);_0x8286eb[_0xfe63('0x40')]=_[_0xfe63('0x3f')](_0x30af33[_0xfe63('0x3b')],qs[_0xfe63('0x41')](_0x3617a8[_0xfe63('0x3c')][_0xfe63('0x41')]));_0x8286eb['attributes']=_0x8286eb[_0xfe63('0x40')][_0xfe63('0x42')]?_0x8286eb[_0xfe63('0x40')]:_0x30af33['model'];if(!_0x3617a8[_0xfe63('0x3c')]['hasOwnProperty'](_0xfe63('0x43'))){_0x8286eb['limit']=qs[_0xfe63('0x2d')](_0x3617a8[_0xfe63('0x3c')][_0xfe63('0x2d')]);_0x8286eb[_0xfe63('0x2c')]=qs[_0xfe63('0x2c')](_0x3617a8['query']['offset']);}_0x8286eb[_0xfe63('0x44')]=qs[_0xfe63('0x45')](_0x3617a8[_0xfe63('0x3c')][_0xfe63('0x45')]);_0x8286eb[_0xfe63('0x46')]=qs[_0xfe63('0x3e')](_[_0xfe63('0x47')](_0x3617a8[_0xfe63('0x3c')],_0x30af33['filters']),_0x240d7d);if(_0x3617a8[_0xfe63('0x3c')]['filter']){_0x8286eb[_0xfe63('0x46')]=_[_0xfe63('0x48')](_0x8286eb[_0xfe63('0x46')],{'$or':_[_0xfe63('0x35')](_0x240d7d,function(_0x244bb2){if(_0x244bb2[_0xfe63('0x39')]!==_0xfe63('0x49')){var _0x165ce2={};_0x165ce2[_0x244bb2['name']]={'$like':'%'+_0x3617a8[_0xfe63('0x3c')][_0xfe63('0x4a')]+'%'};return _0x165ce2;}})});}_0x8286eb=_['merge']({},_0x8286eb,_0x3617a8[_0xfe63('0x4b')]);var _0x41fbd0={'where':_0x8286eb['where']};return db[_0xfe63('0x36')][_0xfe63('0x4c')](_0x41fbd0)[_0xfe63('0x4d')](function(_0x3214a0){_0x5cd543['count']=_0x3214a0;if(_0x3617a8[_0xfe63('0x3c')][_0xfe63('0x4e')]){_0x8286eb['include']=[{'all':!![]}];}return db[_0xfe63('0x36')][_0xfe63('0x4f')](_0x8286eb);})[_0xfe63('0x4d')](function(_0x19c5f4){_0x5cd543[_0xfe63('0x50')]=_0x19c5f4;return _0x5cd543;})[_0xfe63('0x4d')](respondWithFilteredResult(_0x56aa96,_0x8286eb))[_0xfe63('0x27')](handleError(_0x56aa96,null));};exports[_0xfe63('0x51')]=function(_0x5b942f,_0x372a0b){var _0x22753e={'raw':!![],'where':{'id':_0x5b942f[_0xfe63('0x52')]['id']}},_0x5a1dd3={};_0x5a1dd3['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0x5a1dd3['query']=_[_0xfe63('0x3d')](_0x5b942f['query']);_0x5a1dd3['filters']=_[_0xfe63('0x3f')](_0x5a1dd3['model'],_0x5a1dd3['query']);_0x22753e[_0xfe63('0x40')]=_[_0xfe63('0x3f')](_0x5a1dd3['model'],qs[_0xfe63('0x41')](_0x5b942f[_0xfe63('0x3c')][_0xfe63('0x41')]));_0x22753e[_0xfe63('0x40')]=_0x22753e[_0xfe63('0x40')][_0xfe63('0x42')]?_0x22753e[_0xfe63('0x40')]:_0x5a1dd3[_0xfe63('0x3b')];if(_0x5b942f[_0xfe63('0x3c')][_0xfe63('0x4e')]){_0x22753e['include']=[{'all':!![]}];}_0x22753e=_[_0xfe63('0x48')]({},_0x22753e,_0x5b942f[_0xfe63('0x4b')]);return db[_0xfe63('0x36')]['find'](_0x22753e)[_0xfe63('0x4d')](handleEntityNotFound(_0x372a0b,null))[_0xfe63('0x4d')](respondWithResult(_0x372a0b,null))[_0xfe63('0x27')](handleError(_0x372a0b,null));};exports[_0xfe63('0x53')]=function(_0x40a736,_0x4df98f){return db[_0xfe63('0x36')][_0xfe63('0x53')](_0x40a736[_0xfe63('0x54')],{})[_0xfe63('0x4d')](respondWithResult(_0x4df98f,0xc9))['catch'](handleError(_0x4df98f,null));};exports[_0xfe63('0x30')]=function(_0x129161,_0x53ff6e){if(_0x129161[_0xfe63('0x54')]['id']){delete _0x129161[_0xfe63('0x54')]['id'];}return db[_0xfe63('0x36')][_0xfe63('0x55')]({'where':{'id':_0x129161[_0xfe63('0x52')]['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x53ff6e,null))[_0xfe63('0x4d')](saveUpdates(_0x129161[_0xfe63('0x54')],null))[_0xfe63('0x4d')](respondWithResult(_0x53ff6e,null))[_0xfe63('0x27')](handleError(_0x53ff6e,null));};exports[_0xfe63('0x31')]=function(_0x2fb6e3,_0x4700a7){return db[_0xfe63('0x36')][_0xfe63('0x55')]({'where':{'id':_0x2fb6e3[_0xfe63('0x52')]['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x4700a7,null))[_0xfe63('0x4d')](removeEntity(_0x4700a7,null))[_0xfe63('0x27')](handleError(_0x4700a7,null));};exports[_0xfe63('0x56')]=function(_0x5174ee,_0x2fae44){return db[_0xfe63('0x36')][_0xfe63('0x56')]()[_0xfe63('0x4d')](respondWithResult(_0x2fae44,null))[_0xfe63('0x27')](handleError(_0x2fae44,null));};exports[_0xfe63('0x57')]=function(_0x46ccab,_0x433f17,_0x3b1c3c){return db[_0xfe63('0x58')][_0xfe63('0x4c')]({'where':{'ChatGroupId':_0x46ccab[_0xfe63('0x52')]['id'],'ToId':_0x46ccab[_0xfe63('0x59')]['id'],'read':![]}})[_0xfe63('0x4d')](function(_0x16ad92){return{'id':_['toInteger'](_0x46ccab[_0xfe63('0x52')]['id']),'count':_0x16ad92};})['then'](respondWithResult(_0x433f17,null))[_0xfe63('0x27')](handleError(_0x433f17,null));};exports[_0xfe63('0x5a')]=function(_0x5e229d,_0x45bf11,_0x37a334){return db[_0xfe63('0x36')][_0xfe63('0x55')]({'where':{'id':_0x5e229d[_0xfe63('0x52')]['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x45bf11,null))[_0xfe63('0x4d')](function(_0xdab5a0){if(_0xdab5a0){return _0xdab5a0[_0xfe63('0x5a')](_0x5e229d[_0xfe63('0x54')]['ids'],_[_0xfe63('0x5b')](_0x5e229d[_0xfe63('0x54')],['ids','id'])||{});}})[_0xfe63('0x4d')](respondWithResult(_0x45bf11,null))[_0xfe63('0x27')](handleError(_0x45bf11,null));};exports[_0xfe63('0x5c')]=function(_0x1483b4,_0x675f8d,_0x1ec24c){var _0x435e75={};var _0x518d7a={};var _0x2f4c3e;var _0x2ca70e;return db[_0xfe63('0x36')][_0xfe63('0x5d')]({'where':{'id':_0x1483b4[_0xfe63('0x52')]['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x675f8d,null))[_0xfe63('0x4d')](function(_0xf89d85){if(_0xf89d85){_0x2f4c3e=_0xf89d85;_0x518d7a['model']=_[_0xfe63('0x3d')](db[_0xfe63('0x5e')][_0xfe63('0x37')]);_0x518d7a['query']=_[_0xfe63('0x3d')](_0x1483b4[_0xfe63('0x3c')]);_0x518d7a['filters']=_[_0xfe63('0x3f')](_0x518d7a[_0xfe63('0x3b')],_0x518d7a[_0xfe63('0x3c')]);_0x435e75[_0xfe63('0x40')]=_[_0xfe63('0x3f')](_0x518d7a[_0xfe63('0x3b')],qs[_0xfe63('0x41')](_0x1483b4['query'][_0xfe63('0x41')]));_0x435e75['attributes']=_0x435e75[_0xfe63('0x40')][_0xfe63('0x42')]?_0x435e75[_0xfe63('0x40')]:_0x518d7a[_0xfe63('0x3b')];_0x435e75[_0xfe63('0x44')]=qs[_0xfe63('0x45')](_0x1483b4[_0xfe63('0x3c')][_0xfe63('0x45')]);_0x435e75[_0xfe63('0x46')]=qs[_0xfe63('0x3e')](_['pick'](_0x1483b4[_0xfe63('0x3c')],_0x518d7a[_0xfe63('0x3e')]));if(_0x1483b4[_0xfe63('0x3c')][_0xfe63('0x4a')]){_0x435e75[_0xfe63('0x46')]=_[_0xfe63('0x48')](_0x435e75['where'],{'$or':_[_0xfe63('0x35')](_0x435e75[_0xfe63('0x40')],function(_0x23c872){var _0x31997d={};_0x31997d[_0x23c872]={'$like':'%'+_0x1483b4['query']['filter']+'%'};return _0x31997d;})});}_0x435e75=_[_0xfe63('0x48')]({},_0x435e75,_0x1483b4[_0xfe63('0x4b')]);return _0x2f4c3e[_0xfe63('0x5c')](_0x435e75);}})[_0xfe63('0x4d')](function(_0x26a070){if(_0x26a070){_0x2ca70e=_0x26a070[_0xfe63('0x42')];if(!_0x1483b4[_0xfe63('0x3c')][_0xfe63('0x5f')](_0xfe63('0x43'))){_0x435e75[_0xfe63('0x2d')]=qs['limit'](_0x1483b4['query'][_0xfe63('0x2d')]);_0x435e75[_0xfe63('0x2c')]=qs['offset'](_0x1483b4['query'][_0xfe63('0x2c')]);}return _0x2f4c3e[_0xfe63('0x5c')](_0x435e75);}})[_0xfe63('0x4d')](function(_0x1cefd4){if(_0x1cefd4){return _0x1cefd4?{'count':_0x2ca70e,'rows':_0x1cefd4}:null;}})['then'](respondWithResult(_0x675f8d,null))[_0xfe63('0x27')](handleError(_0x675f8d,null));};exports[_0xfe63('0x60')]=function(_0x4bed7a,_0x97ec85,_0xf2e29e){return db[_0xfe63('0x36')][_0xfe63('0x55')]({'where':{'id':_0x4bed7a[_0xfe63('0x52')]['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x97ec85,null))[_0xfe63('0x4d')](function(_0x4477d8){if(_0x4477d8){return _0x4477d8[_0xfe63('0x60')](_0x4bed7a[_0xfe63('0x3c')][_0xfe63('0x61')]);}})[_0xfe63('0x4d')](respondWithStatusCode(_0x97ec85,null))[_0xfe63('0x27')](handleError(_0x97ec85,null));};exports[_0xfe63('0x62')]=function(_0x4ae86c,_0x8f0718,_0xcb4ba){if(_0x4ae86c['body']['id']){delete _0x4ae86c['body']['id'];}return db['ChatGroup']['find']({'where':{'id':_0x4ae86c['params']['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x8f0718,null))['then'](function(_0x3d1490){if(_0x3d1490){_0x4ae86c['body'][_0xfe63('0x63')]=_0x3d1490['id'];return db[_0xfe63('0x58')][_0xfe63('0x53')](_0x4ae86c[_0xfe63('0x54')]);}})[_0xfe63('0x4d')](respondWithResult(_0x8f0718,null))['catch'](handleError(_0x8f0718,null));};exports[_0xfe63('0x64')]=function(_0x263214,_0x289bc6,_0x3b624c){var _0x41c94c={};var _0x149b2e={};var _0x263f63;var _0x45825f;return db[_0xfe63('0x36')][_0xfe63('0x5d')]({'where':{'id':_0x263214[_0xfe63('0x52')]['id']}})[_0xfe63('0x4d')](handleEntityNotFound(_0x289bc6,null))['then'](function(_0x154ab2){if(_0x154ab2){_0x263f63=_0x154ab2;_0x149b2e[_0xfe63('0x3b')]=_[_0xfe63('0x3d')](db['ChatInternalMessage']['rawAttributes']);_0x149b2e[_0xfe63('0x3c')]=_['keys'](_0x263214[_0xfe63('0x3c')]);_0x149b2e[_0xfe63('0x3e')]=_[_0xfe63('0x3f')](_0x149b2e[_0xfe63('0x3b')],_0x149b2e['query']);_0x41c94c['attributes']=_[_0xfe63('0x3f')](_0x149b2e['model'],qs[_0xfe63('0x41')](_0x263214[_0xfe63('0x3c')][_0xfe63('0x41')]));_0x41c94c[_0xfe63('0x40')]=_0x41c94c[_0xfe63('0x40')][_0xfe63('0x42')]?_0x41c94c[_0xfe63('0x40')]:_0x149b2e['model'];_0x41c94c[_0xfe63('0x44')]=qs[_0xfe63('0x45')](_0x263214[_0xfe63('0x3c')][_0xfe63('0x45')]);_0x41c94c[_0xfe63('0x46')]=qs[_0xfe63('0x3e')](_['pick'](_0x263214['query'],_0x149b2e[_0xfe63('0x3e')]));if(_0x263214[_0xfe63('0x3c')][_0xfe63('0x4a')]){_0x41c94c[_0xfe63('0x46')]=_[_0xfe63('0x48')](_0x41c94c[_0xfe63('0x46')],{'$or':_[_0xfe63('0x35')](_0x41c94c['attributes'],function(_0x4dba84){var _0x379ed2={};_0x379ed2[_0x4dba84]={'$like':'%'+_0x263214[_0xfe63('0x3c')][_0xfe63('0x4a')]+'%'};return _0x379ed2;})});}if(_0x263214[_0xfe63('0x3c')][_0xfe63('0x65')]){var _0x3d8519=_0x263214[_0xfe63('0x3c')]['$gte'][_0xfe63('0x66')](',');var _0x448a72={};_0x448a72[_0x3d8519[0x0]]={'$gte':moment(_0x3d8519[0x1])[_0xfe63('0x67')](_0xfe63('0x68'))};_0x41c94c[_0xfe63('0x46')]=_[_0xfe63('0x48')](_0x41c94c[_0xfe63('0x46')],_0x448a72);}_0x41c94c=_[_0xfe63('0x48')]({},_0x41c94c,_0x263214[_0xfe63('0x4b')]);return _0x263f63[_0xfe63('0x64')](_0x41c94c);}})[_0xfe63('0x4d')](function(_0x1c895f){if(_0x1c895f){_0x45825f=_0x1c895f[_0xfe63('0x42')];if(!_0x263214[_0xfe63('0x3c')]['hasOwnProperty']('nolimit')){_0x41c94c[_0xfe63('0x2d')]=qs[_0xfe63('0x2d')](_0x263214[_0xfe63('0x3c')][_0xfe63('0x2d')]);_0x41c94c[_0xfe63('0x2c')]=qs[_0xfe63('0x2c')](_0x263214['query'][_0xfe63('0x2c')]);}return _0x263f63[_0xfe63('0x64')](_0x41c94c);}})[_0xfe63('0x4d')](function(_0x22324f){if(_0x22324f){return _0x22324f?{'count':_0x45825f,'rows':_0x22324f}:null;}})['then'](respondWithResult(_0x289bc6,null))[_0xfe63('0x27')](handleError(_0x289bc6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 256be1d..caaca22 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0x187645,_0x5d77ed){var _0x177b32=function(_0x15f74a){while(--_0x15f74a){_0x187645['push'](_0x187645['shift']());}};_0x177b32(++_0x5d77ed);}(_0xb10b,0x12a));var _0xbb10=function(_0xa3d9a7,_0x1cf219){_0xa3d9a7=_0xa3d9a7-0x0;var _0x48080a=_0xb10b[_0xa3d9a7];return _0x48080a;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x2032,0xd9));var _0x2203=function(_0x104085,_0x317ed0){_0x104085=_0x104085-0x0;var _0x30b787=_0x2032[_0x104085];return _0x30b787;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2c81f17..750136b 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 _0xc03e=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','api','bluebird','path'];(function(_0x2ad406,_0x46ed34){var _0x254fcf=function(_0xcedceb){while(--_0xcedceb){_0x2ad406['push'](_0x2ad406['shift']());}};_0x254fcf(++_0x46ed34);}(_0xc03e,0x15a));var _0xec03=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xc03e[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','ChatGroup','chat_groups','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x47468e,_0x591016){var _0x100d42=function(_0x5030f0){while(--_0x5030f0){_0x47468e['push'](_0x47468e['shift']());}};_0x100d42(++_0x591016);}(_0x90b1,0x1bb));var _0x190b=function(_0x2236dc,_0x43c7f9){_0x2236dc=_0x2236dc-0x0;var _0x20583f=_0x90b1[_0x2236dc];return _0x20583f;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 4ad4641..7754e18 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 _0x1106=['defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x1106,0x1b0));var _0x6110=function(_0x1ebb6f,_0x3c28bb){_0x1ebb6f=_0x1ebb6f-0x0;var _0x99ca75=_0x1106[_0x1ebb6f];return _0x99ca75;};'use strict';var _=require(_0x6110('0x0'));var util=require(_0x6110('0x1'));var moment=require(_0x6110('0x2'));var BPromise=require(_0x6110('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6110('0x4'));var logger=require(_0x6110('0x5'))('rpc');var config=require(_0x6110('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6110('0x7')][_0x6110('0x8')]({'port':0x232a});config[_0x6110('0x9')]=_[_0x6110('0xa')](config[_0x6110('0x9')],{'host':_0x6110('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6110('0xc'))[_0x6110('0xd')](socket);function respondWithRpcPromise(_0x59df67,_0x400ecb,_0x19bc07){return new BPromise(function(_0x140f6e,_0xa08c05){return client[_0x6110('0xe')](_0x59df67,_0x19bc07)[_0x6110('0xf')](function(_0x3e3157){logger['info'](_0x6110('0x10'),_0x400ecb,'request\x20sent');logger['debug'](_0x6110('0x11'),_0x400ecb,_0x6110('0x12'),JSON[_0x6110('0x13')](_0x3e3157));if(_0x3e3157[_0x6110('0x14')]){if(_0x3e3157[_0x6110('0x14')][_0x6110('0x15')]===0x1f4){logger['error'](_0x6110('0x10'),_0x400ecb,_0x3e3157[_0x6110('0x14')][_0x6110('0x16')]);return _0xa08c05(_0x3e3157['error'][_0x6110('0x16')]);}logger[_0x6110('0x14')](_0x6110('0x10'),_0x400ecb,_0x3e3157[_0x6110('0x14')][_0x6110('0x16')]);return _0x140f6e(_0x3e3157[_0x6110('0x14')][_0x6110('0x16')]);}else{logger[_0x6110('0x17')](_0x6110('0x10'),_0x400ecb,'request\x20sent');_0x140f6e(_0x3e3157[_0x6110('0x18')][_0x6110('0x16')]);}})[_0x6110('0x19')](function(_0x51c650){logger['error'](_0x6110('0x10'),_0x400ecb,_0x51c650);_0xa08c05(_0x51c650);});});} \ No newline at end of file +var _0x7f18=['ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','ChatGroup,\x20%s,\x20%s','debug'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7f18,0x7d));var _0x87f1=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x7f18[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x87f1('0x0'));var util=require(_0x87f1('0x1'));var moment=require('moment');var BPromise=require(_0x87f1('0x2'));var rs=require(_0x87f1('0x3'));var fs=require('fs');var Redis=require(_0x87f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87f1('0x5'));var logger=require(_0x87f1('0x6'))(_0x87f1('0x7'));var config=require(_0x87f1('0x8'));var jayson=require(_0x87f1('0x9'));var client=jayson[_0x87f1('0xa')][_0x87f1('0xb')]({'port':0x232a});config[_0x87f1('0xc')]=_[_0x87f1('0xd')](config[_0x87f1('0xc')],{'host':_0x87f1('0xe'),'port':0x18eb});var socket=require(_0x87f1('0xf'))(new Redis(config[_0x87f1('0xc')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x45d5a6,_0x55f348,_0x37df5b){return new BPromise(function(_0x3461dc,_0x35dac2){return client['request'](_0x45d5a6,_0x37df5b)['then'](function(_0x30e899){logger[_0x87f1('0x10')](_0x87f1('0x11'),_0x55f348,'request\x20sent');logger[_0x87f1('0x12')](_0x87f1('0x13'),_0x55f348,_0x87f1('0x14'),JSON['stringify'](_0x30e899));if(_0x30e899[_0x87f1('0x15')]){if(_0x30e899[_0x87f1('0x15')]['code']===0x1f4){logger[_0x87f1('0x15')](_0x87f1('0x11'),_0x55f348,_0x30e899['error'][_0x87f1('0x16')]);return _0x35dac2(_0x30e899[_0x87f1('0x15')][_0x87f1('0x16')]);}logger[_0x87f1('0x15')](_0x87f1('0x11'),_0x55f348,_0x30e899['error'][_0x87f1('0x16')]);return _0x3461dc(_0x30e899[_0x87f1('0x15')][_0x87f1('0x16')]);}else{logger[_0x87f1('0x10')](_0x87f1('0x11'),_0x55f348,'request\x20sent');_0x3461dc(_0x30e899['result']['message']);}})[_0x87f1('0x17')](function(_0x698818){logger['error'](_0x87f1('0x11'),_0x55f348,_0x698818);_0x35dac2(_0x698818);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 413b165..9af4012 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 _0x5565=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x470516,_0x264108){var _0xdc5aa9=function(_0x990af2){while(--_0x990af2){_0x470516['push'](_0x470516['shift']());}};_0xdc5aa9(++_0x264108);}(_0x5565,0xec));var _0x5556=function(_0x2d5c4b,_0x14ee20){_0x2d5c4b=_0x2d5c4b-0x0;var _0x1d6300=_0x5565[_0x2d5c4b];return _0x1d6300;};'use strict';var ChatGroupEvents=require(_0x5556('0x0'));var events=[_0x5556('0x1'),_0x5556('0x2'),_0x5556('0x3')];function createListener(_0x2b9d86,_0x3e5a37){return function(_0x806f34){_0x3e5a37[_0x5556('0x4')](_0x2b9d86,_0x806f34);};}function removeListener(_0x35d420,_0x495256){return function(){ChatGroupEvents[_0x5556('0x5')](_0x35d420,_0x495256);};}exports[_0x5556('0x6')]=function(_0x497696){for(var _0x14ef8a=0x0,_0x539bd1=events[_0x5556('0x7')];_0x14ef8a<_0x539bd1;_0x14ef8a++){var _0x2997b6=events[_0x14ef8a];var _0x3445ef=createListener(_0x5556('0x8')+_0x2997b6,_0x497696);ChatGroupEvents['on'](_0x2997b6,_0x3445ef);}}; \ No newline at end of file +var _0xf070=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x18daa2,_0x5600fe){var _0x515b87=function(_0x3b18a9){while(--_0x3b18a9){_0x18daa2['push'](_0x18daa2['shift']());}};_0x515b87(++_0x5600fe);}(_0xf070,0x1a5));var _0x0f07=function(_0x262e7e,_0x4a399f){_0x262e7e=_0x262e7e-0x0;var _0x628e1a=_0xf070[_0x262e7e];return _0x628e1a;};'use strict';var ChatGroupEvents=require(_0x0f07('0x0'));var events=[_0x0f07('0x1'),'remove',_0x0f07('0x2')];function createListener(_0x116fd9,_0xb62d27){return function(_0xb85b11){_0xb62d27[_0x0f07('0x3')](_0x116fd9,_0xb85b11);};}function removeListener(_0xdd16bc,_0x16f099){return function(){ChatGroupEvents[_0x0f07('0x4')](_0xdd16bc,_0x16f099);};}exports[_0x0f07('0x5')]=function(_0x4ad134){for(var _0x5bab96=0x0,_0x82fba8=events[_0x0f07('0x6')];_0x5bab96<_0x82fba8;_0x5bab96++){var _0x175e17=events[_0x5bab96];var _0x1f1aa1=createListener(_0x0f07('0x7')+_0x175e17,_0x4ad134);ChatGroupEvents['on'](_0x175e17,_0x1f1aa1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ac663b7..86e5992 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 _0xfdd4=['/describe','describe','/:id','isAuthenticated','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get'];(function(_0x58ee3d,_0x3751ad){var _0xa6e391=function(_0x5c0996){while(--_0x5c0996){_0x58ee3d['push'](_0x58ee3d['shift']());}};_0xa6e391(++_0x3751ad);}(_0xfdd4,0x15f));var _0x4fdd=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xfdd4[_0x35b7ba];return _0x25ea5e;};'use strict';var multer=require(_0x4fdd('0x0'));var util=require(_0x4fdd('0x1'));var path=require(_0x4fdd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4fdd('0x3')]();var auth=require(_0x4fdd('0x4'));var interaction=require(_0x4fdd('0x5'));var config=require(_0x4fdd('0x6'));var controller=require(_0x4fdd('0x7'));router[_0x4fdd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4fdd('0x8')](_0x4fdd('0x9'),auth['isAuthenticated'](),controller[_0x4fdd('0xa')]);router[_0x4fdd('0x8')](_0x4fdd('0xb'),auth[_0x4fdd('0xc')](),controller['show']);router[_0x4fdd('0x8')]('/:id/unread',auth[_0x4fdd('0xc')](),controller[_0x4fdd('0xd')]);router['get'](_0x4fdd('0xe'),auth['isAuthenticated'](),controller[_0x4fdd('0xf')]);router[_0x4fdd('0x8')](_0x4fdd('0x10'),auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x11')]);router[_0x4fdd('0x12')]('/',auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x13')]);router[_0x4fdd('0x12')](_0x4fdd('0xe'),auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x14')]);router[_0x4fdd('0x12')](_0x4fdd('0x10'),auth[_0x4fdd('0xc')](),controller['addMessage']);router[_0x4fdd('0x15')]('/:id',auth[_0x4fdd('0xc')](),controller['update']);router[_0x4fdd('0x16')]('/:id',auth[_0x4fdd('0xc')](),controller['destroy']);router[_0x4fdd('0x16')]('/:id/members',auth[_0x4fdd('0xc')](),controller['removeMembers']);module[_0x4fdd('0x17')]=router; \ No newline at end of file +var _0x18bb=['../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','destroy','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x18bb,0xe9));var _0xb18b=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x18bb[_0x3cea78];return _0x33b66b;};'use strict';var multer=require(_0xb18b('0x0'));var util=require(_0xb18b('0x1'));var path=require(_0xb18b('0x2'));var timeout=require(_0xb18b('0x3'));var express=require(_0xb18b('0x4'));var router=express[_0xb18b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb18b('0x6'));var config=require(_0xb18b('0x7'));var controller=require(_0xb18b('0x8'));router[_0xb18b('0x9')]('/',auth['isAuthenticated'](),controller[_0xb18b('0xa')]);router[_0xb18b('0x9')](_0xb18b('0xb'),auth[_0xb18b('0xc')](),controller[_0xb18b('0xd')]);router['get'](_0xb18b('0xe'),auth['isAuthenticated'](),controller[_0xb18b('0xf')]);router[_0xb18b('0x9')](_0xb18b('0x10'),auth[_0xb18b('0xc')](),controller[_0xb18b('0x11')]);router['get']('/:id/members',auth[_0xb18b('0xc')](),controller[_0xb18b('0x12')]);router[_0xb18b('0x9')](_0xb18b('0x13'),auth[_0xb18b('0xc')](),controller[_0xb18b('0x14')]);router[_0xb18b('0x15')]('/',auth[_0xb18b('0xc')](),controller[_0xb18b('0x16')]);router[_0xb18b('0x15')]('/:id/members',auth[_0xb18b('0xc')](),controller['addMembers']);router[_0xb18b('0x15')](_0xb18b('0x13'),auth[_0xb18b('0xc')](),controller[_0xb18b('0x17')]);router[_0xb18b('0x18')]('/:id',auth[_0xb18b('0xc')](),controller[_0xb18b('0x19')]);router['delete'](_0xb18b('0xe'),auth[_0xb18b('0xc')](),controller[_0xb18b('0x1a')]);router[_0xb18b('0x1b')]('/:id/members',auth[_0xb18b('0xc')](),controller[_0xb18b('0x1c')]);module[_0xb18b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a1e6d9d..fa6e80a 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 _0xed42=['long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0xed42,0x146));var _0x2ed4=function(_0x31985d,_0x41283d){_0x31985d=_0x31985d-0x0;var _0x5b2017=_0xed42[_0x31985d];return _0x5b2017;};'use strict';var Sequelize=require(_0x2ed4('0x0'));module[_0x2ed4('0x1')]={'closed':{'type':Sequelize[_0x2ed4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2ed4('0x3')]},'ratingType':{'type':Sequelize[_0x2ed4('0x4')](_0x2ed4('0x5'),_0x2ed4('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x2ed4('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x2ed4('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2ed4('0x9')]},'disposition':{'type':Sequelize[_0x2ed4('0x8')]},'note':{'type':Sequelize[_0x2ed4('0x8')]},'browserName':{'type':Sequelize[_0x2ed4('0x8')]},'browserVersion':{'type':Sequelize[_0x2ed4('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2ed4('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x2ed4('0x8')]},'deviceType':{'type':Sequelize[_0x2ed4('0x8')]},'referer':{'type':Sequelize[_0x2ed4('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2ed4('0x7')](_0x2ed4('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x2ed4('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x2ed4('0x4')]('in',_0x2ed4('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2ed4('0x8')]},'customerPort':{'type':Sequelize[_0x2ed4('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x2ed4('0x7')]}}; \ No newline at end of file +var _0x3e9c=['INTEGER','ENUM','star','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN'];(function(_0x435f73,_0x2d1d9a){var _0x3d2529=function(_0x5000f1){while(--_0x5000f1){_0x435f73['push'](_0x435f73['shift']());}};_0x3d2529(++_0x2d1d9a);}(_0x3e9c,0xfa));var _0xc3e9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3e9c[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xc3e9('0x0'));module[_0xc3e9('0x1')]={'closed':{'type':Sequelize[_0xc3e9('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc3e9('0x3')]},'ratingType':{'type':Sequelize[_0xc3e9('0x4')](_0xc3e9('0x5'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc3e9('0x6')]},'pathTranscript':{'type':Sequelize[_0xc3e9('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc3e9('0x7')]},'disposition':{'type':Sequelize[_0xc3e9('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xc3e9('0x8')]},'browserVersion':{'type':Sequelize[_0xc3e9('0x8')]},'osName':{'type':Sequelize[_0xc3e9('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xc3e9('0x8')]},'deviceVendor':{'type':Sequelize[_0xc3e9('0x8')]},'deviceType':{'type':Sequelize[_0xc3e9('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xc3e9('0x8')]},'formData':{'type':Sequelize[_0xc3e9('0x6')](_0xc3e9('0x9'))},'read1stAt':{'type':Sequelize[_0xc3e9('0x7')]},'lastMsgAt':{'type':Sequelize[_0xc3e9('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xc3e9('0x4')]('in',_0xc3e9('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc3e9('0x8')]},'customerPort':{'type':Sequelize[_0xc3e9('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7cf9860..3eb4bdf 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 _0x323f=['some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','a.key','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','rawAttributes','includeAll','include','merge','options','create','body','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','out','user','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','download','join','root','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','CmContact','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','service','host','port','secure','authentication','auth','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','alias','addTags','setTags','omit','spread','emit','removeTags','unix','tmp','server','transcript-%d-%s.zip','firstName','attachments','Account','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','lastName','renderFile','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','key','model','name','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type'];(function(_0x3c603b,_0x36f6f1){var _0x322e5b=function(_0x433482){while(--_0x433482){_0x3c603b['push'](_0x3c603b['shift']());}};_0x322e5b(++_0x36f6f1);}(_0x323f,0x1ee));var _0xf323=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x323f[_0x5b561d];return _0x431060;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf323('0x1'));var jsonpatch=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require(_0xf323('0x5'));var Mustache=require(_0xf323('0x6'));var util=require(_0xf323('0x7'));var path=require(_0xf323('0x8'));var sox=require(_0xf323('0x9'));var csv=require(_0xf323('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0xa'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf323('0x1b')]=_[_0xf323('0x1c')](config[_0xf323('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf323('0x1d'))(new Redis(config[_0xf323('0x1b')]));require(_0xf323('0x1e'))[_0xf323('0x1f')](socket);var jayson=require(_0xf323('0x20'));var client=jayson[_0xf323('0x21')]['http']({'port':0x232b});var client9004=jayson['client'][_0xf323('0x22')]({'port':0x232c});function checkPasswordPattern(_0x447517,_0x38fd4c,_0x3858ee){if(_0x3858ee){var _0x3db58a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3db58a['test'](_0x38fd4c)){return _0x447517;}else{throw new db[(_0xf323('0x23'))][(_0xf323('0x24'))](_0xf323('0x25'));}}else{return _0x447517;}}function respondWithRpcPromise(_0x44671c,_0x49b115,_0x2db977,_0x272aec){return new BPromise(function(_0x1a459d,_0x41b2cb){var _0x5955ea=_0x272aec||client;return _0x5955ea[_0xf323('0x26')](_0x44671c,_0x2db977)[_0xf323('0x27')](function(_0x5baab2){logger[_0xf323('0x28')](_0xf323('0x29'),_0x49b115,_0xf323('0x2a'));logger[_0xf323('0x2b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x49b115,_0xf323('0x2a'),JSON[_0xf323('0x2c')](_0x5baab2));if(_0x5baab2[_0xf323('0x2d')]){if(_0x5baab2['error'][_0xf323('0x2e')]===0x1f4){logger[_0xf323('0x2d')](_0xf323('0x29'),_0x49b115,_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);return _0x41b2cb(_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);}logger[_0xf323('0x2d')](_0xf323('0x29'),_0x49b115,_0x5baab2['error'][_0xf323('0x2f')]);return _0x1a459d(_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);}else{logger[_0xf323('0x28')](_0xf323('0x29'),_0x49b115,_0xf323('0x2a'));_0x1a459d(_0x5baab2['result'][_0xf323('0x2f')]);}})['catch'](function(_0x1570d4){logger[_0xf323('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x49b115,_0x1570d4);_0x41b2cb(_0x1570d4);});});}function respondWithStatusCode(_0x46663b,_0x3c95ce){_0x3c95ce=_0x3c95ce||0xcc;return function(_0x2b6254){if(_0x2b6254){return _0x46663b[_0xf323('0x30')](_0x3c95ce);}return _0x46663b[_0xf323('0x31')](_0x3c95ce)['end']();};}function respondWithResult(_0x44c944,_0x34b536){_0x34b536=_0x34b536||0xc8;return function(_0x12c7d5){if(_0x12c7d5){return _0x44c944[_0xf323('0x31')](_0x34b536)[_0xf323('0x32')](_0x12c7d5);}};}function respondWithFilteredResult(_0x36bd3f,_0x17cb4d){return function(_0x1723b7){if(_0x1723b7){var _0x139adc=_0x1723b7[_0xf323('0x33')],_0x52300b=_0x17cb4d[_0xf323('0x34')],_0x3f23cf=_0x17cb4d[_0xf323('0x34')]+_0x17cb4d['limit'],_0x15187c;if(_0x3f23cf>=_0x139adc){_0x3f23cf=_0x139adc;_0x15187c=0xc8;}else{_0x15187c=0xce;}_0x36bd3f[_0xf323('0x31')](_0x15187c);return _0x36bd3f[_0xf323('0x35')](_0xf323('0x36'),_0x52300b+'-'+_0x3f23cf+'/'+_0x139adc)[_0xf323('0x32')](_0x1723b7);}return null;};}function patchUpdates(_0x3c849a){return function(_0x485cbf){try{jsonpatch[_0xf323('0x37')](_0x485cbf,_0x3c849a,!![]);}catch(_0x1a0d27){return BPromise[_0xf323('0x38')](_0x1a0d27);}return _0x485cbf[_0xf323('0x39')]();};}function saveUpdates(_0x4fc6bd,_0x17b4e6){return function(_0x5658db){if(_0x5658db){return _0x5658db[_0xf323('0x3a')](_0x4fc6bd)[_0xf323('0x27')](function(_0x4ff3c1){return _0x4ff3c1;});}return null;};}function removeEntity(_0x3dcac7,_0x47ba23){return function(_0x3c6a07){if(_0x3c6a07){return _0x3c6a07['destroy']()[_0xf323('0x27')](function(){_0x3dcac7['status'](0xcc)[_0xf323('0x3b')]();});}};}function handleEntityNotFound(_0x82a6ca,_0x4e0e51){return function(_0x4964a5){if(!_0x4964a5){_0x82a6ca['sendStatus'](0x194);}return _0x4964a5;};}function handleError(_0x8b24f2,_0x277a6c){_0x277a6c=_0x277a6c||0x1f4;return function(_0x79e636){logger[_0xf323('0x2d')](_0x79e636[_0xf323('0x3c')]);if(_0x79e636['name']){delete _0x79e636['name'];}_0x8b24f2['status'](_0x277a6c)[_0xf323('0x3d')](_0x79e636);};}function getInteractionUsers(_0x59fee2,_0x11d564){return new BPromise(function(_0x47e7a2,_0x431bc){try{if(_0x11d564[_0x59fee2['id']]){_0x59fee2[_0xf323('0x3e')]=_[_0xf323('0x3f')](_0x11d564[_0x59fee2['id']],function(_0x325fa9){return{'id':_0x325fa9['id'],'fullname':_0x325fa9[_0xf323('0x40')]};});}}catch(_0x48a6c4){_0x431bc(_0x48a6c4);}_0x47e7a2(_0x59fee2);});}function getInteractionTags(_0x3d8ddb,_0x3bbe02){return new BPromise(function(_0x408b66,_0x27ddcc){try{if(_0x3d8ddb[_0xf323('0x41')]){_0x3d8ddb[_0xf323('0x42')]=[];_0x3d8ddb[_0xf323('0x41')][_0xf323('0x43')](',')[_0xf323('0x44')](function(_0x13b8cb){_0x3d8ddb[_0xf323('0x42')][_0xf323('0x45')](_0x3bbe02[_0x13b8cb]);});}delete _0x3d8ddb[_0xf323('0x41')];}catch(_0x388d80){_0x27ddcc(_0x388d80);}_0x408b66(_0x3d8ddb);});}function updateChatInteraction(_0x2c89dd,_0x33b1b2,_0x5bb658){return new BPromise(function(_0x502114,_0x1818c4){return getInteractionUsers(_0x2c89dd,_0x5bb658)[_0xf323('0x27')](function(_0x2864f7){return getInteractionTags(_0x2864f7,_0x33b1b2);})[_0xf323('0x27')](function(_0xd9c79d){_0x502114(_0xd9c79d);})[_0xf323('0x46')](function(_0x2746e3){_0x1818c4(_0x2746e3);});});}exports[_0xf323('0x47')]=function(_0x1c0136,_0x320592){var _0x2c0854={},_0x247149={},_0x121599={'count':0x0,'rows':[]};var _0x48d4df=_[_0xf323('0x3f')](db['ChatInteraction']['rawAttributes'],function(_0x410792){return{'name':_0x410792['fieldName'],'type':_0x410792['type'][_0xf323('0x48')]};});_0x247149[_0xf323('0x49')]=_[_0xf323('0x3f')](_0x48d4df,_0xf323('0x4a'));_0x247149[_0xf323('0x4b')]=_[_0xf323('0x4c')](_0x1c0136[_0xf323('0x4b')]);_0x247149[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x247149[_0xf323('0x49')],_0x247149[_0xf323('0x4b')]);_0x2c0854['attributes']=_[_0xf323('0x4e')](_0x247149['model'],qs[_0xf323('0x4f')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x4f')]));_0x2c0854[_0xf323('0x50')]=_0x2c0854['attributes']['length']?_0x2c0854[_0xf323('0x50')]:_0x247149['model'];if(!_0x1c0136[_0xf323('0x4b')]['hasOwnProperty'](_0xf323('0x51'))){_0x2c0854[_0xf323('0x52')]=qs['limit'](_0x1c0136[_0xf323('0x4b')][_0xf323('0x52')]);_0x2c0854[_0xf323('0x34')]=qs[_0xf323('0x34')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x34')]);}_0x2c0854[_0xf323('0x53')]=qs[_0xf323('0x54')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x54')]);_0x2c0854[_0xf323('0x55')]=qs[_0xf323('0x4d')](_[_0xf323('0x56')](_0x1c0136['query'],_0x247149[_0xf323('0x4d')]),_0x48d4df);var _0x18ad3e=[];var _0x27b191=squel[_0xf323('0x57')]()[_0xf323('0x58')]('id')[_0xf323('0x58')]('name')[_0xf323('0x58')](_0xf323('0x59'))['from'](_0xf323('0x5a'));var _0x2909cf=squel['select']()['field'](_0xf323('0x5b'))[_0xf323('0x58')](_0xf323('0x5c'))[_0xf323('0x58')](_0xf323('0x5d'))[_0xf323('0x5e')](_0xf323('0x5f'),'ui')[_0xf323('0x60')]('users','u',_0xf323('0x61'));var _0x198a2b=squel[_0xf323('0x57')]()[_0xf323('0x5e')](_0xf323('0x62'),'i')[_0xf323('0x60')](_0xf323('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf323('0x60')](_0xf323('0x64'),'o',_0xf323('0x65'))[_0xf323('0x60')](_0xf323('0x66'),'a',_0xf323('0x67'))[_0xf323('0x60')](_0xf323('0x68'),'me',_0xf323('0x69'))['left_join'](_0xf323('0x6a'),'it',_0xf323('0x6b'))[_0xf323('0x60')]('tools_tags','t',_0xf323('0x6c'));var _0x2ad9d4=squel['expr']();var _0x2506fd=[];var _0x475f95=squel['expr']();var _0xee9a9;if(_0x1c0136[_0xf323('0x4b')]['search']){_0xee9a9=as[_0xf323('0x6d')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x6e')]);var _0x2db2b1=_0xee9a9[_0xf323('0x6f')];for(var _0x291e36=0x0;_0x291e36<_0xee9a9[_0xf323('0x70')][_0xf323('0x71')];_0x291e36++){var _0x2b164b=_0xee9a9['conditions'][_0x291e36];var _0xd1902b='i';var _0x31942f=_['find'](_0x48d4df,[_0xf323('0x4a'),_0x2b164b[_0xf323('0x58')]]);if(!_0x31942f){switch(_0x2b164b['field']){case _0xf323('0x72'):if(_0x2b164b[_0xf323('0x73')]==0x1){_0x198a2b[_0xf323('0x74')]('`'+_0x2b164b[_0xf323('0x58')]+'`\x20=\x200');}else{_0x198a2b[_0xf323('0x74')]('`'+_0x2b164b[_0xf323('0x58')]+_0xf323('0x75'));}break;case _0xf323('0x76'):if(_0x2b164b['operator']===_0xf323('0x77')){if(_0x2b164b[_0xf323('0x73')][_0xf323('0x43')]('\x20')[_0xf323('0x71')]>0x1){_0x2ad9d4[_0x2db2b1](_0xf323('0x78'),qs[_0xf323('0x79')](_0x2b164b[_0xf323('0x73')]),null);}else{var _0x1a91c8='%'+_0x2b164b[_0xf323('0x73')]+'%';_0x2ad9d4[_0x2db2b1](_0xf323('0x7a'),_0x1a91c8,_0x1a91c8,_0x1a91c8);}}else{_0x31942f=_[_0xf323('0x7b')](_0x48d4df,[_0xf323('0x4a'),_0xf323('0x7c')]);_0x2b164b[_0xf323('0x58')]=_0xf323('0x7c');_0x53b408=as['buildExpression'](_0xd1902b,_0x31942f['type'],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408[_0xf323('0x73')][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);}break;case _0xf323('0x7f'):var _0x550a6a=_0x2b164b[_0xf323('0x73')][_0xf323('0x43')](',')[_0xf323('0x3f')](function(_0x3add7c){return Number(_0x3add7c);});_0x550a6a['forEach'](function(_0x5e0382){_0x475f95['or'](_0xf323('0x80'),'%,'+_0x5e0382+',%');});_0x2506fd=_[_0xf323('0x81')](_0x2506fd,_0x550a6a);break;case _0xf323('0x82'):if(_0x2b164b[_0xf323('0x83')]===_0xf323('0x77')){_0x2ad9d4[_0x2db2b1](_0xf323('0x84'),'%'+_0x2b164b[_0xf323('0x73')]+'%',null);}else{_0x31942f=_['find'](_0x48d4df,['name',_0xf323('0x85')]);_0x2b164b[_0xf323('0x58')]=_0xf323('0x85');_0x53b408=as[_0xf323('0x86')](_0xd1902b,_0x31942f[_0xf323('0x87')],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408['value'][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')]['end']);}break;case'body':_0x53b408=as[_0xf323('0x86')]('me',null,_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408['value'][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);break;}}else{var _0x53b408=as[_0xf323('0x86')](_0xd1902b,_0x31942f['type'],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408['text'],_0x53b408[_0xf323('0x73')][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);}}}else{var _0x258e1a=_(_0x1c0136['query'])[_0xf323('0x4c')]()[_0xf323('0x3f')](function(_0x27a406){return _[_0xf323('0x88')](_0x48d4df,['name',_0x27a406])?_0x27a406:undefined;})[_0xf323('0x89')]()[_0xf323('0x73')]();if(!_[_0xf323('0x8a')](_0x258e1a)){_0x258e1a[_0xf323('0x44')](function(_0x4b8408){if(_0x4b8408===_0xf323('0x8b')){_0x198a2b[_0xf323('0x55')](_0xf323('0x8c'),[][_0xf323('0x8d')](_0x1c0136['query'][_0x4b8408]));}else if(_0x4b8408===_0xf323('0x8e')){var _0x36e7b9=JSON[_0xf323('0x8f')](_0x1c0136['query'][_0x4b8408])['$gte'];var _0x391ebe=JSON['parse'](_0x1c0136[_0xf323('0x4b')][_0x4b8408])[_0xf323('0x90')];_0x198a2b[_0xf323('0x55')](_0xf323('0x91'),_0x36e7b9,_0x391ebe);}else{if(_0x1c0136['query'][_0x4b8408]===_0xf323('0x92')){_0x198a2b[_0xf323('0x55')]('i.'+_0x4b8408+_0xf323('0x93'));}else{_0x198a2b[_0xf323('0x55')]('i.'+_0x4b8408+_0xf323('0x94'),_0x1c0136['query'][_0x4b8408]);}}});}if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x95')]){if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x95')]==0x1){_0x198a2b['having']('`unreadMessages`\x20=\x200');}else{_0x198a2b[_0xf323('0x74')](_0xf323('0x96'));}}if(_0x1c0136['query'][_0xf323('0x97')]){_0x2506fd=_['isArray'](_0x1c0136[_0xf323('0x4b')][_0xf323('0x97')])?_0x1c0136[_0xf323('0x4b')]['tag']:new Array(_0x1c0136[_0xf323('0x4b')][_0xf323('0x97')]);_0x2506fd['forEach'](function(_0x1400fe){_0x475f95['or'](_0xf323('0x80'),'%,'+_0x1400fe+',%');});}if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x98')]){var _0x249639=_0x1c0136['query'][_0xf323('0x98')][_0xf323('0x99')]('\x5c','\x5c\x5c')[_0xf323('0x99')]('\x27\x27',_0xf323('0x9a'));if(qs[_0xf323('0x9b')](_0x249639)){_0x2ad9d4['or']('i.id\x20LIKE\x20?',_0x249639+'%');}else{_0x2ad9d4['or'](_0xf323('0x9c'),qs['getFullTextValue'](_0x249639))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x249639+'%');}}}_0x198a2b['where'](_0x2ad9d4);_0x198a2b[_0xf323('0x9d')](_0xf323('0x9e'));var _0x2604a3={'type':db['Sequelize'][_0xf323('0x9f')][_0xf323('0xa0')],'raw':!![]};var _0x4d3478=_0x198a2b[_0xf323('0xa1')]();_0x4d3478[_0xf323('0x58')](_0xf323('0x9e'));_0x4d3478[_0xf323('0x58')](_0xf323('0xa2'),_0xf323('0x72'));if(_0x2c0854[_0xf323('0x53')]){_0x2c0854[_0xf323('0x53')]['forEach'](function(_0x31da2b){_0x198a2b[_0xf323('0x53')]('i.'+_0x31da2b[0x0],_0x31da2b[0x1]===_0xf323('0xa3')?![]:!![]);});}if(!_['isEmpty'](_0x2506fd)){_0x198a2b['having'](_0x475f95);_0x4d3478[_0xf323('0x55')](_0xf323('0xa4'),_0x2506fd);}BPromise[_0xf323('0xa5')]()[_0xf323('0x27')](function(){if(!_0xee9a9){if(_0x1c0136[_0xf323('0x4b')]['ChatWebsiteId']||_0x1c0136['query'][_0xf323('0xa6')])return;_0x4d3478[_0xf323('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x198a2b[_0xf323('0x55')](_0xf323('0xa7'));return;}return _0x1c0136['user'][_0xf323('0xa8')]({'attributes':['id'],'raw':!![]})[_0xf323('0x27')](function(_0x13d2ef){if(_[_0xf323('0x8a')](_0x13d2ef)){_0x4d3478['where'](_0xf323('0xa9'));_0x198a2b[_0xf323('0x55')](_0xf323('0xa9'));}else{_0x4d3478[_0xf323('0x55')](_0xf323('0x8c'),_[_0xf323('0x3f')](_0x13d2ef,'id'));_0x198a2b[_0xf323('0x55')](_0xf323('0x8c'),_[_0xf323('0x3f')](_0x13d2ef,'id'));}});})['then'](function(){db[_0xf323('0xaa')][_0xf323('0x4b')](_0x4d3478[_0xf323('0xab')](),_0x2604a3)['then'](function(_0x478491){_0x121599[_0xf323('0x33')]=_0x478491['length'];if(_0x121599['count']===0x0)return[];return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x27b191[_0xf323('0xab')](),_0x2604a3)['then'](function(_0x587a21){_0x18ad3e=_[_0xf323('0xac')](_0x587a21,'id');_0x2604a3=_['merge'](_0x2604a3,{'model':db[_0xf323('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x4f')]){_0x2c0854[_0xf323('0x50')]['forEach'](function(_0x18528a){_0x198a2b['field']('i.'+_0x18528a);});}else{_0x198a2b[_0xf323('0x58')](_0xf323('0xa2'),'unreadMessages');_0x198a2b[_0xf323('0x58')](_0xf323('0xae'),'Account.key');_0x198a2b[_0xf323('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x198a2b['field'](_0xf323('0xaf'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb0'),_0xf323('0xb1'));_0x198a2b[_0xf323('0x58')]('c.lastName',_0xf323('0xb2'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb3'),_0xf323('0xb4'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb5'),_0xf323('0xb6'));_0x198a2b[_0xf323('0x58')]('c.mobile',_0xf323('0xb7'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb8'),'Contact.fax');_0x198a2b['field']('o.fullname',_0xf323('0xb9'));_0x198a2b[_0xf323('0x58')](_0xf323('0xba'),_0xf323('0xbb'));_0x198a2b[_0xf323('0x58')](_0xf323('0xbc'),_0xf323('0x41'));}if(_0x2c0854[_0xf323('0x52')])_0x198a2b['limit'](_0x2c0854[_0xf323('0x52')]);if(_0x2c0854[_0xf323('0x34')])_0x198a2b[_0xf323('0x34')](_0x2c0854[_0xf323('0x34')]);return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x198a2b[_0xf323('0xab')](),_0x2604a3);})[_0xf323('0x27')](function(_0x44dffe){_0x2909cf['where'](_0xf323('0xbd'),_[_0xf323('0x3f')](_0x44dffe,'id'));return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x2909cf[_0xf323('0xab')](),_0x2604a3)[_0xf323('0x27')](function(_0x46c286){var _0x55bfa8=_[_0xf323('0xbe')](_0x46c286,_0xf323('0xbf'));var _0x1e79af=[];_0x44dffe[_0xf323('0x44')](function(_0x1ef7ba){_0x1e79af[_0xf323('0x45')](updateChatInteraction(_0x1ef7ba,_0x18ad3e,_0x55bfa8));});return BPromise[_0xf323('0xc0')](_0x1e79af);});});})[_0xf323('0x27')](function(_0x59283f){_0x121599['rows']=_0x59283f;return _0x121599;})[_0xf323('0x27')](respondWithFilteredResult(_0x320592,_0x2c0854));})[_0xf323('0x46')](handleError(_0x320592,null));};exports[_0xf323('0xc1')]=function(_0x1d534f,_0x4914da){var _0x53c9c5={'raw':![],'where':{'id':_0x1d534f[_0xf323('0xc2')]['id']}},_0x34003e={};_0x34003e[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xad')][_0xf323('0xc3')]);_0x34003e[_0xf323('0x4b')]=_['keys'](_0x1d534f['query']);_0x34003e['filters']=_['intersection'](_0x34003e[_0xf323('0x49')],_0x34003e['query']);_0x53c9c5[_0xf323('0x50')]=_[_0xf323('0x4e')](_0x34003e[_0xf323('0x49')],qs[_0xf323('0x4f')](_0x1d534f[_0xf323('0x4b')]['fields']));_0x53c9c5[_0xf323('0x50')]=_0x53c9c5[_0xf323('0x50')]['length']?_0x53c9c5['attributes']:_0x34003e[_0xf323('0x49')];if(_0x1d534f[_0xf323('0x4b')][_0xf323('0xc4')]){_0x53c9c5[_0xf323('0xc5')]=[{'all':!![]}];}_0x53c9c5=_[_0xf323('0xc6')]({},_0x53c9c5,_0x1d534f[_0xf323('0xc7')]);return db[_0xf323('0xad')][_0xf323('0x7b')](_0x53c9c5)['then'](handleEntityNotFound(_0x4914da,null))['then'](respondWithResult(_0x4914da,null))[_0xf323('0x46')](handleError(_0x4914da,null));};exports[_0xf323('0xc8')]=function(_0x2dffc1,_0x4ab7cb){return db[_0xf323('0xad')]['create'](_0x2dffc1['body'],{})[_0xf323('0x27')](respondWithResult(_0x4ab7cb,0xc9))[_0xf323('0x46')](handleError(_0x4ab7cb,null));};exports[_0xf323('0x3a')]=function(_0x225fc9,_0x47b370){if(_0x225fc9[_0xf323('0xc9')]['id']){delete _0x225fc9[_0xf323('0xc9')]['id'];}return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x225fc9[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x47b370,null))['then'](saveUpdates(_0x225fc9[_0xf323('0xc9')],null))[_0xf323('0x27')](respondWithResult(_0x47b370,null))[_0xf323('0x46')](handleError(_0x47b370,null));};exports[_0xf323('0xca')]=function(_0x3bd242,_0x208860){return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x3bd242[_0xf323('0xc2')]['id']}})['then'](handleEntityNotFound(_0x208860,null))[_0xf323('0x27')](removeEntity(_0x208860,null))[_0xf323('0x46')](handleError(_0x208860,null));};exports[_0xf323('0xcb')]=function(_0xcf3ca1,_0x2f99d9){return db['ChatInteraction'][_0xf323('0xcb')]()[_0xf323('0x27')](respondWithResult(_0x2f99d9,null))[_0xf323('0x46')](handleError(_0x2f99d9,null));};exports[_0xf323('0xcc')]=function(_0xd5d557,_0x2409c9){var _0x297107=_0xd5d557[_0xf323('0xc2')]['id'];var _0x57162c;var _0x2b75c4;var _0x23ec08;return db[_0xf323('0xad')][_0xf323('0xcd')]({'where':{'id':_0x297107}})[_0xf323('0x27')](function(_0x1f1e6d){_0x57162c=_0x1f1e6d;return db[_0xf323('0xce')][_0xf323('0xcd')]({'where':{'id':_0x1f1e6d[_0xf323('0x8b')]},'attributes':['id',_0xf323('0xcf'),'vidaooEscalation'],'raw':!![]});})[_0xf323('0x27')](function(_0x34d500){if(_0x34d500&&_0x34d500['vidaooApiKey']&&_0x34d500[_0xf323('0xd0')]){_0x2b75c4=_0x34d500;var _0x2a75dc={'rejectUnauthorized':![],'method':_0xf323('0xd1'),'uri':_0xf323('0xd2'),'headers':{'X-APIKEY':_0x34d500[_0xf323('0xcf')]},'body':{'name':_0xf323('0xd3')+_0x297107},'redirect':'follow','json':!![]};return rp(_0x2a75dc);}else{throw new db['Sequelize']['ValidationError'](_0xf323('0xd4'));}})[_0xf323('0x27')](function(_0x5f72f4){_0x23ec08=_0x5f72f4;if(_0x23ec08['id']){var _0x29206f={'body':_0x23ec08['join_url'],'ChatWebsiteId':_0x2b75c4['id'],'ChatInteractionId':_0x57162c['id'],'direction':_0xf323('0xd5'),'UserId':_0xd5d557[_0xf323('0xd6')]['id']};return db['ChatMessage'][_0xf323('0xc8')](_0x29206f,{});}else{throw new db[(_0xf323('0x23'))]['ValidationError'](_0xf323('0xd7'));}})[_0xf323('0x27')](function(){return _0x57162c[_0xf323('0xd8')]({'vidaooSessionId':_0x23ec08['id']});})[_0xf323('0x27')](respondWithResult(_0x2409c9,null))['catch'](handleError(_0x2409c9,null));};exports[_0xf323('0xd9')]=function(_0x33eaec,_0x44c50){if(_0x33eaec[_0xf323('0xc9')]['id']){delete _0x33eaec[_0xf323('0xc9')]['id'];}return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x33eaec[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x44c50,null))[_0xf323('0x27')](saveUpdates(_0x33eaec[_0xf323('0xc9')],null))[_0xf323('0x27')](respondWithResult(_0x44c50,null))[_0xf323('0x46')](handleError(_0x44c50,null));};exports['abandon']=function(_0x45368e,_0x32824f,_0x38c95a){if(_0x45368e[_0xf323('0xc9')]['id']){delete _0x45368e[_0xf323('0xc9')]['id'];}return db[_0xf323('0xad')]['find']({'where':{'id':_0x45368e[_0xf323('0xc2')]['id']}})['then'](function(_0x3c82b5){if(!_0x3c82b5){logger[_0xf323('0x2d')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xf323('0xda'),0x194,_0xf323('0xdb'));_0x32824f['sendStatus'](0x194);}else{if(_0x3c82b5['UserId']){throw new db[(_0xf323('0x23'))][(_0xf323('0x24'))](_0xf323('0xdc'));}}return _0x3c82b5;})[_0xf323('0x27')](function(_0x43db55){if(_0x43db55){return _0x43db55[_0xf323('0x3a')]({'closed':_0x45368e[_0xf323('0xc9')][_0xf323('0xdd')],'disposition':_0x45368e[_0xf323('0xc9')][_0xf323('0xde')]})['then'](function(_0x192e61){return _0x192e61;});}})[_0xf323('0x27')](function(_0x5487b0){return respondWithRpcPromise(_0xf323('0xdf'),'abandon',_0x45368e[_0xf323('0xc9')],client9004);})[_0xf323('0x27')](respondWithResult(_0x32824f,null))[_0xf323('0x46')](handleError(_0x32824f,null));};exports[_0xf323('0xe0')]=function(_0xaf34a7,_0x4316ba,_0x43d6e6){_0xaf34a7[_0xf323('0xc9')][_0xf323('0x4a')]=_0xaf34a7['file'][_0xf323('0xe1')];_0xaf34a7[_0xf323('0xc9')][_0xf323('0xe2')]=_0xaf34a7[_0xf323('0xe3')][_0xf323('0xe4')];_0xaf34a7[_0xf323('0xc9')][_0xf323('0x87')]=_0xaf34a7[_0xf323('0xe3')][_0xf323('0xe5')];return db[_0xf323('0xe6')][_0xf323('0xc8')](_0xaf34a7['body'])['then'](respondWithResult(_0x4316ba,0xc9))[_0xf323('0x46')](handleError(_0x4316ba,null));};exports[_0xf323('0xe7')]=function(_0x66b6c5,_0x21d723,_0x56e3e0){return db['ChatInteraction']['findOne']({'where':{'id':_0x66b6c5['params']['id']},'raw':!![]})[_0xf323('0x27')](handleEntityNotFound(_0x21d723,null))[_0xf323('0x27')](function(_0x310050){if(_0x310050){if(_0x310050[_0xf323('0xdd')]){return _0x21d723[_0xf323('0x31')](0x193)[_0xf323('0x32')]({'status':0x193,'message':'Unauthorized'});}return db[_0xf323('0xe6')][_0xf323('0xcd')]({'where':{'id':_0x66b6c5['query']['attachId']},'raw':!![]})[_0xf323('0x27')](handleEntityNotFound(_0x21d723,null));}})[_0xf323('0x27')](function(_0x3ef481){if(_0x3ef481){return _0x21d723[_0xf323('0xe8')](path[_0xf323('0xe9')](config[_0xf323('0xea')],'server/files/attachments/',_0x3ef481[_0xf323('0xe2')]));}})['catch'](handleError(_0x21d723,null));};exports['close']=function(_0x1123cc,_0x133040){var _0x34fac4=null;var _0x159080=null;var _0x34c2a2=null;var _0x48bc44=null;if(_0x1123cc[_0xf323('0xc9')]['id']){delete _0x1123cc[_0xf323('0xc9')]['id'];}if(_0x1123cc['body'][_0xf323('0xeb')]){_0x48bc44=path['join'](config['root'],_0xf323('0xec'),util['format'](_0xf323('0xed'),Date[_0xf323('0xee')]()));_0x1123cc[_0xf323('0xc9')]['pathTranscript']=_0x48bc44;}return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x1123cc['params']['id']},'include':[{'model':db[_0xf323('0xef')],'as':'Messages','include':[{'model':db[_0xf323('0x82')],'as':_0xf323('0x82')}]}]})[_0xf323('0x27')](handleEntityNotFound(_0x133040,null))[_0xf323('0x27')](saveUpdates(_0x1123cc[_0xf323('0xc9')],null))[_0xf323('0x27')](function(_0x222b46){if(_0x222b46){_0x34fac4=_0x222b46;return db[_0xf323('0xce')][_0xf323('0x7b')]({'where':{'id':_0x34fac4['ChatWebsiteId']}});}})[_0xf323('0x27')](function(_0x2a005b){if(_0x2a005b){_0x34c2a2=_0x2a005b;return db[_0xf323('0xf0')][_0xf323('0x7b')]({'where':{'id':_0x34fac4['ContactId']}});}})[_0xf323('0x27')](function(_0x3665f3){if(_0x3665f3){_0x159080=_0x3665f3;if(_0x48bc44){var _0x2b5870=null;for(var _0x304899=0x1;_0x304899<_0x34fac4['Messages'][_0xf323('0x71')];++_0x304899){_0x2b5870=_0x34fac4[_0xf323('0xf1')][_0x304899];var _0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2[_0xf323('0xf4')],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');var _0x3a6587=_0x1123cc[_0xf323('0xc9')][_0xf323('0xf6')]||util['format'](_0xf323('0xf3'),_0xf323('0xf7'),_0x2b5870[_0xf323('0x7c')]);switch(_0x34c2a2[_0xf323('0xf8')]){case'website_alias':_0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2['agentAlias'],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');break;case _0xf323('0xf9'):_0x2309d1=_0x2b5870['UserId']?_0x2b5870[_0xf323('0x82')]['alias']||_0x2b5870[_0xf323('0x82')][_0xf323('0x40')]:_0xf323('0xf5');break;case _0xf323('0xfa'):_0x2309d1=_0x2b5870[_0xf323('0x85')]?_0x2b5870[_0xf323('0x82')]['fullname']:_0xf323('0xf5');break;default:_0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2[_0xf323('0xf4')],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');}var _0x5af161=util[_0xf323('0xf2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2b5870[_0xf323('0x8e')])[_0xf323('0xf2')](_0xf323('0xfb')),_0x2b5870[_0xf323('0xfc')]==='in'?_0x3a6587:_0x2309d1,_0x2b5870[_0xf323('0xc9')]);if(!_0x2b5870[_0xf323('0xfd')]){fs[_0xf323('0xfe')](_0x48bc44,_0x5af161);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf323('0xff'),'raw':!![]}]});}}})[_0xf323('0x27')](function(_0x25bd4d){if(_0x25bd4d&&_0x25bd4d['Smtp']&&_0x1123cc['body']){var _0x1836a5={'tls':{'rejectUnauthorized':![]}};if(_0x25bd4d['Smtp'][_0xf323('0x100')]){_0x1836a5[_0xf323('0x100')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x100')];}else{_0x1836a5[_0xf323('0x101')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x101')];_0x1836a5[_0xf323('0x102')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x102')];_0x1836a5[_0xf323('0x103')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x103')];}if(_0x25bd4d[_0xf323('0xff')][_0xf323('0x104')]){_0x1836a5[_0xf323('0x105')]={'user':_0x25bd4d['Smtp'][_0xf323('0xd6')],'pass':_0x25bd4d[_0xf323('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf323('0x106'),{'account':_0x1836a5,'message':{'from':util['format'](_0xf323('0x107'),_0x25bd4d[_0xf323('0x4a')],_0x25bd4d['email']||_0x25bd4d[_0xf323('0xff')][_0xf323('0xd6')]),'to':_0x1123cc[_0xf323('0xc9')]['mailTranscript'],'subject':_0xf323('0x108'),'text':util['format'](_0xf323('0x109'),_0x1123cc[_0xf323('0xc9')][_0xf323('0xeb')]),'attachments':[{'path':_0x48bc44}]}})[_0xf323('0x27')](function(){return _0x34fac4;})[_0xf323('0x46')](function(_0x4068d7){console[_0xf323('0x2d')](_0x4068d7);});}else{return _0x34fac4;}})['then'](respondWithStatusCode(_0x133040,0xc8))[_0xf323('0x46')](handleError(_0x133040,null));};exports[_0xf323('0x10a')]=function(_0x1c5bcf,_0x406bd6,_0x28d50f){return db[_0xf323('0xef')]['find']({'where':{'id':_0x1c5bcf[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x406bd6,null))[_0xf323('0x27')](function(_0x305680){if(_0x305680){return _0x305680['addMessage'](_0x1c5bcf[_0xf323('0xc9')][_0xf323('0x10b')],_['omit'](_0x1c5bcf['body'],['ids','id'])||{});}})[_0xf323('0x27')](respondWithResult(_0x406bd6,null))[_0xf323('0x46')](handleError(_0x406bd6,null));};exports[_0xf323('0x10c')]=function(_0x2adc91,_0x51fc4f,_0x1e8abd){var _0x1f80af={'raw':![],'where':{}};var _0x92a2ff={};var _0x51b00e={'count':0x0,'rows':[]};return db[_0xf323('0xad')]['findOne']({'where':{'id':_0x2adc91[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x51fc4f,null))['then'](function(_0x3e9e09){if(_0x3e9e09){_0x92a2ff[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xef')][_0xf323('0xc3')]);_0x92a2ff[_0xf323('0x4b')]=_[_0xf323('0x4c')](_0x2adc91[_0xf323('0x4b')]);_0x92a2ff[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x92a2ff[_0xf323('0x49')],_0x92a2ff[_0xf323('0x4b')]);_0x1f80af[_0xf323('0x50')]=_[_0xf323('0x4e')](_0x92a2ff[_0xf323('0x49')],qs['fields'](_0x2adc91['query'][_0xf323('0x4f')]));_0x1f80af[_0xf323('0x50')]=_0x1f80af['attributes'][_0xf323('0x71')]?_0x1f80af['attributes']:_0x92a2ff[_0xf323('0x49')];if(!_0x2adc91['query'][_0xf323('0x10d')](_0xf323('0x51'))){_0x1f80af['limit']=qs[_0xf323('0x52')](_0x2adc91[_0xf323('0x4b')]['limit']);_0x1f80af['offset']=qs[_0xf323('0x34')](_0x2adc91[_0xf323('0x4b')][_0xf323('0x34')]);}_0x1f80af[_0xf323('0x53')]=qs[_0xf323('0x54')](_0x2adc91[_0xf323('0x4b')][_0xf323('0x54')]);_0x1f80af['where']=qs[_0xf323('0x4d')](_[_0xf323('0x56')](_0x2adc91[_0xf323('0x4b')],_0x92a2ff[_0xf323('0x4d')]));_0x1f80af[_0xf323('0x55')][_0xf323('0xbf')]=_0x3e9e09['id'];if(_0x2adc91['query'][_0xf323('0x98')]){_0x1f80af[_0xf323('0x55')]=_[_0xf323('0xc6')](_0x1f80af[_0xf323('0x55')],{'$or':_[_0xf323('0x3f')](_0x1f80af[_0xf323('0x50')],function(_0x60a04b){var _0x1cfee7={};_0x1cfee7[_0x60a04b]={'$like':'%'+_0x2adc91[_0xf323('0x4b')][_0xf323('0x98')]+'%'};return _0x1cfee7;})});}if(_0x2adc91[_0xf323('0x4b')][_0xf323('0x10e')]){var _0x475de5=_0x2adc91['query'][_0xf323('0x10e')][_0xf323('0x43')](',');var _0x4c8e1c={};_0x4c8e1c[_0x475de5[0x0]]={'$gte':moment(_0x475de5[0x1])[_0xf323('0xf2')](_0xf323('0x10f'))};_0x1f80af[_0xf323('0x55')]=_['merge'](_0x1f80af[_0xf323('0x55')],_0x4c8e1c);}_0x1f80af=_[_0xf323('0xc6')]({},_0x1f80af,_0x2adc91[_0xf323('0xc7')]);return db[_0xf323('0xef')][_0xf323('0x33')]({'where':_0x1f80af['where']})[_0xf323('0x27')](function(_0x52bcaf){_0x51b00e[_0xf323('0x33')]=_0x52bcaf;if(_0x2adc91[_0xf323('0x4b')][_0xf323('0xc4')]){_0x1f80af['include']=[{'all':!![]}];}return db[_0xf323('0xef')][_0xf323('0x110')](_0x1f80af);})[_0xf323('0x27')](function(_0x52ffbe){_0x51b00e[_0xf323('0x111')]=_0x52ffbe;return _0x51b00e;});}})['then'](respondWithFilteredResult(_0x51fc4f,_0x1f80af))['catch'](handleError(_0x51fc4f,null));};exports[_0xf323('0x112')]=function(_0x278588,_0x5a36ae,_0x36992a){var _0x2ca568={'where':{}},_0x3a0fa5={},_0x5e6d69={'count':0x0,'rows':[]};return db[_0xf323('0xad')][_0xf323('0xcd')]({'where':{'id':_0x278588['params']['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x5a36ae,null))['then'](function(_0x5aec46){if(_0x5aec46){_0x3a0fa5[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xef')]['rawAttributes']);_0x3a0fa5[_0xf323('0x4b')]=_['keys'](_0x278588[_0xf323('0x4b')]);_0x3a0fa5[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x3a0fa5['model'],_0x3a0fa5[_0xf323('0x4b')]);_0x2ca568['attributes']=_['intersection'](_0x3a0fa5['model'],qs[_0xf323('0x4f')](_0x278588[_0xf323('0x4b')][_0xf323('0x4f')]));_0x2ca568['attributes']=_0x2ca568['attributes'][_0xf323('0x71')]?_0x2ca568['attributes']:_0x3a0fa5['model'];if(!_0x278588[_0xf323('0x4b')]['hasOwnProperty'](_0xf323('0x51'))){_0x2ca568[_0xf323('0x52')]=qs[_0xf323('0x52')](_0x278588[_0xf323('0x4b')][_0xf323('0x52')]);_0x2ca568[_0xf323('0x34')]=qs[_0xf323('0x34')](_0x278588[_0xf323('0x4b')][_0xf323('0x34')]);}_0x2ca568['order']=qs[_0xf323('0x54')](_0x278588[_0xf323('0x4b')]['sort']);_0x2ca568[_0xf323('0x55')]=qs[_0xf323('0x4d')](_['pick'](_0x278588[_0xf323('0x4b')],_0x3a0fa5[_0xf323('0x4d')]));_0x2ca568[_0xf323('0x55')][_0xf323('0xbf')]=_0x5aec46['id'];if(_0x278588[_0xf323('0x4b')][_0xf323('0x98')]){_0x2ca568[_0xf323('0x55')]=_[_0xf323('0xc6')](_0x2ca568[_0xf323('0x55')],{'$or':_[_0xf323('0x3f')](_0x2ca568[_0xf323('0x50')],function(_0x28ac5d){var _0x4273c3={};_0x4273c3[_0x28ac5d]={'$like':'%'+_0x278588[_0xf323('0x4b')][_0xf323('0x98')]+'%'};return _0x4273c3;})});}_0x2ca568[_0xf323('0x55')][_0xf323('0xfd')]=![];if(_0x278588[_0xf323('0x4b')]['id']){_0x2ca568[_0xf323('0x55')]['id']={'$gt':_0x278588[_0xf323('0x4b')]['id']};}_0x2ca568=_['merge']({},_0x2ca568,_0x278588['options']);return db['ChatMessage'][_0xf323('0x33')]({'where':_0x2ca568['where']})[_0xf323('0x27')](function(_0x2d9822){_0x5e6d69[_0xf323('0x33')]=_0x2d9822;_0x2ca568[_0xf323('0xc5')]=[];if(_0x278588[_0xf323('0x4b')][_0xf323('0x113')]){_0x2ca568[_0xf323('0xc5')]['push']({'model':db[_0xf323('0x82')],'as':'User','attributes':['id',_0xf323('0x40'),_0xf323('0x114')]});}if(_0x278588['query'][_0xf323('0xc4')]){_0x2ca568[_0xf323('0xc5')]=[{'all':!![]}];}return db[_0xf323('0xef')][_0xf323('0x110')](_0x2ca568);})[_0xf323('0x27')](function(_0xeb3641){_0x5e6d69[_0xf323('0x111')]=_0xeb3641;return _0x5e6d69;});}})[_0xf323('0x27')](respondWithFilteredResult(_0x5a36ae,_0x2ca568))[_0xf323('0x46')](handleError(_0x5a36ae,null));};exports[_0xf323('0x115')]=function(_0x1ea2bc,_0x2bc841,_0xede2f5){return db[_0xf323('0xad')]['find']({'where':{'id':_0x1ea2bc[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x2bc841,null))[_0xf323('0x27')](function(_0x4685aa){if(_0x4685aa){return _0x4685aa[_0xf323('0x116')](_0x1ea2bc['body'][_0xf323('0x10b')],_[_0xf323('0x117')](_0x1ea2bc[_0xf323('0xc9')],[_0xf323('0x10b'),'id'])||{})[_0xf323('0x118')](function(){return db[_0xf323('0x7f')]['findAll']({'attributes':['id',_0xf323('0x4a'),_0xf323('0x59')],'where':{'id':_0x1ea2bc[_0xf323('0xc9')][_0xf323('0x10b')]}});})[_0xf323('0x27')](function(_0x22c859){socket[_0xf323('0x119')]('chatInteractionTags:save',{'id':Number(_0x1ea2bc[_0xf323('0xc2')]['id']),'tags':_0x22c859||[]});return{'id':Number(_0x1ea2bc[_0xf323('0xc2')]['id']),'tags':_0x22c859||[]};});}})[_0xf323('0x27')](respondWithResult(_0x2bc841,null))['catch'](handleError(_0x2bc841,null));};exports[_0xf323('0x11a')]=function(_0x5d1897,_0x46a215,_0x2c0eb0){return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x5d1897[_0xf323('0xc2')]['id']}})['then'](handleEntityNotFound(_0x46a215,null))[_0xf323('0x27')](function(_0x158624){if(_0x158624){return _0x158624[_0xf323('0x11a')](_0x5d1897[_0xf323('0x4b')][_0xf323('0x10b')]);}})['then'](respondWithStatusCode(_0x46a215,null))[_0xf323('0x46')](handleError(_0x46a215,null));};exports[_0xf323('0xe8')]=function(_0x32d6e6,_0x4902ad){var _0x110c46=moment()[_0xf323('0x11b')]()[_0xf323('0xab')]();var _0x45f6ea=path['join'](config['root'],'server','files',_0xf323('0x11c'));var _0xd80f1a=path[_0xf323('0xe9')](config['root'],_0xf323('0x11d'),'files','attachments');var _0x4125c2=path[_0xf323('0xe9')](_0x45f6ea,_0x110c46);var _0x2940da=util[_0xf323('0xf2')](_0xf323('0x11e'),_0x32d6e6['params']['id'],_0x110c46);var _0x5dc95e=path['join'](_0x45f6ea,_0x2940da);var _0x4ce60a=[];_0x4ce60a[_0xf323('0x45')]({'model':db[_0xf323('0x82')],'as':_0xf323('0x82'),'attributes':['id','fullname'],'raw':!![]});_0x4ce60a['push']({'model':db[_0xf323('0xf0')],'as':_0xf323('0x76'),'attributes':['id',_0xf323('0x11f'),'lastName'],'raw':!![]});if(_0x32d6e6[_0xf323('0x4b')][_0xf323('0x120')]){_0x4ce60a[_0xf323('0x45')]({'model':db[_0xf323('0xe6')],'as':_0xf323('0xe6'),'raw':!![]});}var _0x4437c4=[{'model':db[_0xf323('0xef')],'as':_0xf323('0xf1'),'attributes':['id','body',_0xf323('0x8e'),'direction','secret',_0xf323('0x95')],'include':_0x4ce60a}];_0x4437c4[_0xf323('0x45')]({'model':db[_0xf323('0xce')],'as':_0xf323('0x121'),'attributes':['id',_0xf323('0x4a')]});_0x4437c4['push']({'model':db[_0xf323('0x82')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x32d6e6['params']['id']},'include':_0x4437c4})[_0xf323('0x27')](handleEntityNotFound(_0x4902ad,null))[_0xf323('0x27')](function(_0x24c285){if(_0x24c285){var _0x6ba94a=_0x24c285['get']({'plain':!![]});fs[_0xf323('0x122')](_0x4125c2);var _0x45a36e={'format':'A4','border':_0xf323('0x123'),'header':{'height':_0xf323('0x124'),'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':_0xf323('0x125'),'contents':{'default':util[_0xf323('0xf2')](_0xf323('0x126'),util[_0xf323('0xf2')](_0xf323('0x127'),_0xf323('0x128'),_0x6ba94a['id']),moment()[_0xf323('0xf2')]('YYYY-MM-DD')['toString']())}}};var _0x159fa8={'channel':_0xf323('0x128'),'account':_0x6ba94a['Account'][_0xf323('0x4a')],'agent':_0x6ba94a[_0xf323('0x129')]?_0x6ba94a[_0xf323('0x129')]['fullname']:_0xf323('0x12a'),'createdAt':moment(_0x6ba94a['createdAt'])[_0xf323('0xf2')](_0xf323('0x10f'))['toString'](),'closedAt':_0x6ba94a[_0xf323('0xdd')]?moment(_0x6ba94a[_0xf323('0x12b')])[_0xf323('0xf2')](_0xf323('0x10f'))['toString']():'','disposition':_0x6ba94a['disposition'],'chatInfo':{'browser':_0x6ba94a[_0xf323('0x12c')],'os':_0x6ba94a['osName'],'referer':_0x6ba94a[_0xf323('0x12d')],'customerIp':_0x6ba94a[_0xf323('0x12e')],'customerPort':_0x6ba94a[_0xf323('0x12f')]?_0x6ba94a[_0xf323('0x12f')]:_0xf323('0x12a')},'messages':_(_0x6ba94a[_0xf323('0xf1')])[_0xf323('0x130')]()[_0xf323('0x98')]({'secret':![]})[_0xf323('0x3f')](function(_0x435051){if(_0x435051['Attachment']){var _0xdec264=path[_0xf323('0xe9')](_0xd80f1a,_0x435051[_0xf323('0xe6')]['basename']);if(fs[_0xf323('0x131')](_0xdec264)){fs['createReadStream'](_0xdec264)[_0xf323('0x132')](fs[_0xf323('0x133')](path[_0xf323('0xe9')](_0x4125c2,_0x435051[_0xf323('0xe6')]['basename'])));}}return{'date':moment(_0x435051[_0xf323('0x8e')])['format'](_0xf323('0x10f'))[_0xf323('0xab')](),'sender':_0x435051[_0xf323('0xfc')]===_0xf323('0xd5')?_0x435051['User']?_0x435051[_0xf323('0x82')][_0xf323('0x40')]:'System':_0x435051[_0xf323('0x76')][_0xf323('0x11f')]+(_0x435051[_0xf323('0x76')][_0xf323('0x134')]?'\x20'+_0x435051[_0xf323('0x76')][_0xf323('0x134')]:''),'body':_0x435051['Attachment']?_0x435051[_0xf323('0xe6')][_0xf323('0xe2')]:_0x435051['body'],'direction':_0x435051['direction']===_0xf323('0xd5')?'A':'C','secret':_0x435051[_0xf323('0xfd')],'read':_0x435051['read'],'attachment':_0x435051['Attachment']};})[_0xf323('0x73')]()};return ejs[_0xf323('0x135')](path['join'](config[_0xf323('0xea')],_0xf323('0x11d'),'views',_0xf323('0x136')),{'interaction':_0x159fa8})[_0xf323('0x27')](function(_0x4665a3){return new BPromise(function(_0x6432fc,_0x112d75){pdf[_0xf323('0xc8')](_0x4665a3,_0x45a36e)[_0xf323('0x137')](path['join'](_0x4125c2,'transcript-'+_0x6ba94a['id']+'-'+_0x110c46+'.pdf'),function(_0x29320e,_0xa2c54d){if(_0x29320e)return _0x112d75(_0x29320e);_0x6432fc(_0xa2c54d);});});})[_0xf323('0x27')](function(){return new BPromise(function(_0x3072e8,_0x4568eb){zipdir(_0x4125c2,{'saveTo':_0x5dc95e},function(_0x3bb14b,_0x5a60c4){if(_0x3bb14b)return _0x4568eb(_0x3bb14b);return _0x3072e8(_0x5a60c4);});})[_0xf323('0x27')](function(){return new BPromise(function(_0x31bb0e,_0x70872f){rimraf(_0x4125c2,function(_0x4b4435){if(_0x4b4435)_0x70872f(_0x4b4435);return _0x31bb0e();});});})[_0xf323('0x27')](function(){return _0x4902ad[_0xf323('0xe8')](_0x5dc95e,_0x2940da,function(_0x3625a2){if(_0x3625a2){console[_0xf323('0x138')](_0xf323('0x139'),_0x3625a2);}else{fs[_0xf323('0x13a')](_0x5dc95e);}});});});}else{return _0x4902ad['sendStatus'](0xc8);}})[_0xf323('0x46')](handleError(_0x4902ad,null));}; \ No newline at end of file +var _0x68b3=['text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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)','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','merge','Account.mandatoryDisposition','c.firstName','c.email','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','sequelize','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','rawAttributes','includeAll','create','update','describe','createVidaooSession','params','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','close','server/files/chat/upload/','transcript-%s.txt','now','Messages','ChatWebsite','CmContact','format','agentAlias','System','customer','Visitor','website_alias','%s%d','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','email','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','YYYY-MM-DD\x20HH:mm:ss','options','getMyMessages','include','includeAgent','alias','setTags','spread','findAll','chatInteractionTags:save','removeTags','files','server','transcript-%d-%s.zip','firstName','lastName','attachments','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Owner','N.A.','closedAt','disposition','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','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','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','stack','name','send','Users','map','Tags','TagIds','split','forEach','push','index','ChatInteraction','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','a.id\x20=\x20i.ChatWebsiteId','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x68b3,0x1d8));var _0x368b=function(_0x5cb434,_0x1e7784){_0x5cb434=_0x5cb434-0x0;var _0x2fb19e=_0x68b3[_0x5cb434];return _0x2fb19e;};'use strict';var pdf=require(_0x368b('0x0'));var emlformat=require(_0x368b('0x1'));var rimraf=require(_0x368b('0x2'));var zipdir=require(_0x368b('0x3'));var jsonpatch=require(_0x368b('0x4'));var rp=require('request-promise');var moment=require(_0x368b('0x5'));var BPromise=require(_0x368b('0x6'));var Mustache=require(_0x368b('0x7'));var util=require(_0x368b('0x8'));var path=require('path');var sox=require(_0x368b('0x9'));var csv=require(_0x368b('0xa'));var ejs=require(_0x368b('0xb'));var fs=require('fs');var _=require(_0x368b('0xc'));var squel=require(_0x368b('0xd'));var crypto=require(_0x368b('0xe'));var jsforce=require(_0x368b('0xf'));var deskjs=require(_0x368b('0x10'));var toCsv=require(_0x368b('0xa'));var querystring=require(_0x368b('0x11'));var Papa=require(_0x368b('0x12'));var Redis=require('ioredis');var authService=require(_0x368b('0x13'));var qs=require(_0x368b('0x14'));var as=require(_0x368b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x368b('0x16'))(_0x368b('0x17'));var utils=require(_0x368b('0x18'));var config=require('../../config/environment');var db=require(_0x368b('0x19'))['db'];config[_0x368b('0x1a')]=_['defaults'](config[_0x368b('0x1a')],{'host':_0x368b('0x1b'),'port':0x18eb});var socket=require(_0x368b('0x1c'))(new Redis(config[_0x368b('0x1a')]));require(_0x368b('0x1d'))['register'](socket);var jayson=require(_0x368b('0x1e'));var client=jayson[_0x368b('0x1f')]['http']({'port':0x232b});var client9004=jayson[_0x368b('0x1f')][_0x368b('0x20')]({'port':0x232c});function checkPasswordPattern(_0x30c245,_0x515350,_0x220cd5){if(_0x220cd5){var _0x392376=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x392376[_0x368b('0x21')](_0x515350)){return _0x30c245;}else{throw new db['Sequelize'][(_0x368b('0x22'))](_0x368b('0x23'));}}else{return _0x30c245;}}function respondWithRpcPromise(_0x1c2956,_0x540f57,_0x5d543e,_0x3e2e9f){return new BPromise(function(_0x27d2a0,_0x2c3cec){var _0x1e632a=_0x3e2e9f||client;return _0x1e632a[_0x368b('0x24')](_0x1c2956,_0x5d543e)['then'](function(_0x26447c){logger[_0x368b('0x25')](_0x368b('0x26'),_0x540f57,_0x368b('0x27'));logger[_0x368b('0x28')](_0x368b('0x29'),_0x540f57,_0x368b('0x27'),JSON[_0x368b('0x2a')](_0x26447c));if(_0x26447c['error']){if(_0x26447c[_0x368b('0x2b')][_0x368b('0x2c')]===0x1f4){logger[_0x368b('0x2b')](_0x368b('0x26'),_0x540f57,_0x26447c[_0x368b('0x2b')]['message']);return _0x2c3cec(_0x26447c[_0x368b('0x2b')][_0x368b('0x2d')]);}logger[_0x368b('0x2b')](_0x368b('0x26'),_0x540f57,_0x26447c[_0x368b('0x2b')][_0x368b('0x2d')]);return _0x27d2a0(_0x26447c[_0x368b('0x2b')][_0x368b('0x2d')]);}else{logger[_0x368b('0x25')](_0x368b('0x26'),_0x540f57,_0x368b('0x27'));_0x27d2a0(_0x26447c[_0x368b('0x2e')][_0x368b('0x2d')]);}})[_0x368b('0x2f')](function(_0x4636f4){logger[_0x368b('0x2b')](_0x368b('0x26'),_0x540f57,_0x4636f4);_0x2c3cec(_0x4636f4);});});}function respondWithStatusCode(_0x9f192e,_0x39ef94){_0x39ef94=_0x39ef94||0xcc;return function(_0x1e0e46){if(_0x1e0e46){return _0x9f192e[_0x368b('0x30')](_0x39ef94);}return _0x9f192e[_0x368b('0x31')](_0x39ef94)[_0x368b('0x32')]();};}function respondWithResult(_0x3c80b5,_0x5db0b4){_0x5db0b4=_0x5db0b4||0xc8;return function(_0x4af77a){if(_0x4af77a){return _0x3c80b5[_0x368b('0x31')](_0x5db0b4)[_0x368b('0x33')](_0x4af77a);}};}function respondWithFilteredResult(_0x3d1ceb,_0x152048){return function(_0x5d6ebf){if(_0x5d6ebf){var _0x12ae59=_0x5d6ebf[_0x368b('0x34')],_0x1f3ed3=_0x152048['offset'],_0x3699fe=_0x152048[_0x368b('0x35')]+_0x152048[_0x368b('0x36')],_0x1c68ca;if(_0x3699fe>=_0x12ae59){_0x3699fe=_0x12ae59;_0x1c68ca=0xc8;}else{_0x1c68ca=0xce;}_0x3d1ceb[_0x368b('0x31')](_0x1c68ca);return _0x3d1ceb[_0x368b('0x37')]('Content-Range',_0x1f3ed3+'-'+_0x3699fe+'/'+_0x12ae59)['json'](_0x5d6ebf);}return null;};}function patchUpdates(_0x5e98ac){return function(_0x152142){try{jsonpatch[_0x368b('0x38')](_0x152142,_0x5e98ac,!![]);}catch(_0x46e01c){return BPromise[_0x368b('0x39')](_0x46e01c);}return _0x152142[_0x368b('0x3a')]();};}function saveUpdates(_0x5e9895,_0xfade29){return function(_0x50ae22){if(_0x50ae22){return _0x50ae22['update'](_0x5e9895)[_0x368b('0x3b')](function(_0x1a8908){return _0x1a8908;});}return null;};}function removeEntity(_0x52b50b,_0x24ea25){return function(_0x242f03){if(_0x242f03){return _0x242f03['destroy']()[_0x368b('0x3b')](function(){_0x52b50b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b313,_0xe4994d){return function(_0x4d6f22){if(!_0x4d6f22){_0x51b313[_0x368b('0x30')](0x194);}return _0x4d6f22;};}function handleError(_0x1ad002,_0x3b00fe){_0x3b00fe=_0x3b00fe||0x1f4;return function(_0xd0f23f){logger[_0x368b('0x2b')](_0xd0f23f[_0x368b('0x3c')]);if(_0xd0f23f[_0x368b('0x3d')]){delete _0xd0f23f[_0x368b('0x3d')];}_0x1ad002['status'](_0x3b00fe)[_0x368b('0x3e')](_0xd0f23f);};}function getInteractionUsers(_0x1f60ea,_0x484cc6){return new BPromise(function(_0x221210,_0x12fd35){try{if(_0x484cc6[_0x1f60ea['id']]){_0x1f60ea[_0x368b('0x3f')]=_[_0x368b('0x40')](_0x484cc6[_0x1f60ea['id']],function(_0x248b2b){return{'id':_0x248b2b['id'],'fullname':_0x248b2b['fullname']};});}}catch(_0x24b993){_0x12fd35(_0x24b993);}_0x221210(_0x1f60ea);});}function getInteractionTags(_0x4287c6,_0x2a7f70){return new BPromise(function(_0x3e0210,_0x4e44d0){try{if(_0x4287c6['TagIds']){_0x4287c6[_0x368b('0x41')]=[];_0x4287c6[_0x368b('0x42')][_0x368b('0x43')](',')[_0x368b('0x44')](function(_0x248487){_0x4287c6[_0x368b('0x41')][_0x368b('0x45')](_0x2a7f70[_0x248487]);});}delete _0x4287c6[_0x368b('0x42')];}catch(_0x3a5254){_0x4e44d0(_0x3a5254);}_0x3e0210(_0x4287c6);});}function updateChatInteraction(_0x1c30ff,_0x5dde7f,_0x87ede1){return new BPromise(function(_0x179e46,_0x5a3ff1){return getInteractionUsers(_0x1c30ff,_0x87ede1)[_0x368b('0x3b')](function(_0x1ea901){return getInteractionTags(_0x1ea901,_0x5dde7f);})[_0x368b('0x3b')](function(_0x360a27){_0x179e46(_0x360a27);})['catch'](function(_0x490eb6){_0x5a3ff1(_0x490eb6);});});}exports[_0x368b('0x46')]=function(_0x4a0275,_0x91bb0b){var _0x1e8891={},_0x25beec={},_0x575e58={'count':0x0,'rows':[]};var _0x46a72f=_[_0x368b('0x40')](db[_0x368b('0x47')]['rawAttributes'],function(_0x4c9373){return{'name':_0x4c9373[_0x368b('0x48')],'type':_0x4c9373[_0x368b('0x49')]['key']};});_0x25beec[_0x368b('0x4a')]=_[_0x368b('0x40')](_0x46a72f,_0x368b('0x3d'));_0x25beec[_0x368b('0x4b')]=_[_0x368b('0x4c')](_0x4a0275[_0x368b('0x4b')]);_0x25beec[_0x368b('0x4d')]=_[_0x368b('0x4e')](_0x25beec[_0x368b('0x4a')],_0x25beec[_0x368b('0x4b')]);_0x1e8891[_0x368b('0x4f')]=_[_0x368b('0x4e')](_0x25beec[_0x368b('0x4a')],qs['fields'](_0x4a0275[_0x368b('0x4b')][_0x368b('0x50')]));_0x1e8891[_0x368b('0x4f')]=_0x1e8891[_0x368b('0x4f')][_0x368b('0x51')]?_0x1e8891['attributes']:_0x25beec['model'];if(!_0x4a0275[_0x368b('0x4b')][_0x368b('0x52')](_0x368b('0x53'))){_0x1e8891['limit']=qs[_0x368b('0x36')](_0x4a0275[_0x368b('0x4b')][_0x368b('0x36')]);_0x1e8891[_0x368b('0x35')]=qs[_0x368b('0x35')](_0x4a0275[_0x368b('0x4b')][_0x368b('0x35')]);}_0x1e8891[_0x368b('0x54')]=qs[_0x368b('0x55')](_0x4a0275[_0x368b('0x4b')]['sort']);_0x1e8891[_0x368b('0x56')]=qs['filters'](_[_0x368b('0x57')](_0x4a0275['query'],_0x25beec[_0x368b('0x4d')]),_0x46a72f);var _0x4b2d5f=[];var _0x456f19=squel[_0x368b('0x58')]()[_0x368b('0x59')]('id')[_0x368b('0x59')]('name')[_0x368b('0x59')](_0x368b('0x5a'))[_0x368b('0x5b')](_0x368b('0x5c'));var _0x424aa1=squel[_0x368b('0x58')]()[_0x368b('0x59')](_0x368b('0x5d'))[_0x368b('0x59')]('u.fullname')[_0x368b('0x59')](_0x368b('0x5e'))[_0x368b('0x5b')](_0x368b('0x5f'),'ui')[_0x368b('0x60')]('users','u',_0x368b('0x61'));var _0x1ddb6e=squel[_0x368b('0x58')]()[_0x368b('0x5b')](_0x368b('0x62'),'i')[_0x368b('0x60')](_0x368b('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x368b('0x60')]('chat_websites','a',_0x368b('0x64'))[_0x368b('0x60')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x368b('0x60')]('chat_interaction_has_tags','it',_0x368b('0x65'))[_0x368b('0x60')]('tools_tags','t',_0x368b('0x66'));var _0x8b2667=squel['expr']();var _0x212b68=[];var _0x4d590f=squel[_0x368b('0x67')]();var _0x359bc6;if(_0x4a0275[_0x368b('0x4b')][_0x368b('0x68')]){_0x359bc6=as['parseSearch'](_0x4a0275[_0x368b('0x4b')][_0x368b('0x68')]);var _0x670789=_0x359bc6[_0x368b('0x69')];for(var _0x49a634=0x0;_0x49a634<_0x359bc6[_0x368b('0x6a')]['length'];_0x49a634++){var _0xa320cc=_0x359bc6[_0x368b('0x6a')][_0x49a634];var _0x49a651='i';var _0x58a473=_[_0x368b('0x6b')](_0x46a72f,[_0x368b('0x3d'),_0xa320cc[_0x368b('0x59')]]);if(!_0x58a473){switch(_0xa320cc[_0x368b('0x59')]){case _0x368b('0x6c'):if(_0xa320cc['value']==0x1){_0x1ddb6e[_0x368b('0x6d')]('`'+_0xa320cc[_0x368b('0x59')]+'`\x20=\x200');}else{_0x1ddb6e[_0x368b('0x6d')]('`'+_0xa320cc[_0x368b('0x59')]+_0x368b('0x6e'));}break;case _0x368b('0x6f'):if(_0xa320cc['operator']===_0x368b('0x70')){if(_0xa320cc[_0x368b('0x71')][_0x368b('0x43')]('\x20')[_0x368b('0x51')]>0x1){_0x8b2667[_0x670789]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xa320cc['value']),null);}else{var _0x4b949f='%'+_0xa320cc[_0x368b('0x71')]+'%';_0x8b2667[_0x670789](_0x368b('0x72'),_0x4b949f,_0x4b949f,_0x4b949f);}}else{_0x58a473=_['find'](_0x46a72f,['name','ContactId']);_0xa320cc['field']='ContactId';_0x4f9018=as[_0x368b('0x73')](_0x49a651,_0x58a473[_0x368b('0x49')],_0xa320cc);_0x8b2667[_0x670789](_0x4f9018[_0x368b('0x74')],_0x4f9018['value'][_0x368b('0x75')],_0x4f9018['value']['end']);}break;case _0x368b('0x76'):var _0x3b4937=_0xa320cc[_0x368b('0x71')][_0x368b('0x43')](',')['map'](function(_0x2c4488){return Number(_0x2c4488);});_0x3b4937[_0x368b('0x44')](function(_0x20feff){_0x4d590f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20feff+',%');});_0x212b68=_[_0x368b('0x77')](_0x212b68,_0x3b4937);break;case _0x368b('0x78'):if(_0xa320cc['operator']===_0x368b('0x70')){_0x8b2667[_0x670789](_0x368b('0x79'),'%'+_0xa320cc['value']+'%',null);}else{_0x58a473=_[_0x368b('0x6b')](_0x46a72f,['name',_0x368b('0x7a')]);_0xa320cc[_0x368b('0x59')]='UserId';_0x4f9018=as[_0x368b('0x73')](_0x49a651,_0x58a473[_0x368b('0x49')],_0xa320cc);_0x8b2667[_0x670789](_0x4f9018[_0x368b('0x74')],_0x4f9018[_0x368b('0x71')][_0x368b('0x75')],_0x4f9018['value'][_0x368b('0x32')]);}break;case _0x368b('0x7b'):_0x4f9018=as[_0x368b('0x73')]('me',null,_0xa320cc);_0x8b2667[_0x670789](_0x4f9018[_0x368b('0x74')],_0x4f9018[_0x368b('0x71')][_0x368b('0x75')],_0x4f9018[_0x368b('0x71')][_0x368b('0x32')]);break;}}else{var _0x4f9018=as[_0x368b('0x73')](_0x49a651,_0x58a473[_0x368b('0x49')],_0xa320cc);_0x8b2667[_0x670789](_0x4f9018['text'],_0x4f9018[_0x368b('0x71')][_0x368b('0x75')],_0x4f9018[_0x368b('0x71')]['end']);}}}else{var _0x49ba44=_(_0x4a0275[_0x368b('0x4b')])[_0x368b('0x4c')]()[_0x368b('0x40')](function(_0xb7cef7){return _['some'](_0x46a72f,[_0x368b('0x3d'),_0xb7cef7])?_0xb7cef7:undefined;})['compact']()[_0x368b('0x71')]();if(!_[_0x368b('0x7c')](_0x49ba44)){_0x49ba44[_0x368b('0x44')](function(_0x59b02c){if(_0x59b02c===_0x368b('0x7d')){_0x1ddb6e[_0x368b('0x56')](_0x368b('0x7e'),[]['concat'](_0x4a0275['query'][_0x59b02c]));}else if(_0x59b02c==='createdAt'){var _0x7bca21=JSON[_0x368b('0x7f')](_0x4a0275[_0x368b('0x4b')][_0x59b02c])[_0x368b('0x80')];var _0x321112=JSON['parse'](_0x4a0275[_0x368b('0x4b')][_0x59b02c])[_0x368b('0x81')];_0x1ddb6e['where'](_0x368b('0x82'),_0x7bca21,_0x321112);}else{if(_0x4a0275['query'][_0x59b02c]==='null'){_0x1ddb6e[_0x368b('0x56')]('i.'+_0x59b02c+_0x368b('0x83'));}else{_0x1ddb6e[_0x368b('0x56')]('i.'+_0x59b02c+_0x368b('0x84'),_0x4a0275[_0x368b('0x4b')][_0x59b02c]);}}});}if(_0x4a0275[_0x368b('0x4b')][_0x368b('0x85')]){if(_0x4a0275[_0x368b('0x4b')][_0x368b('0x85')]==0x1){_0x1ddb6e[_0x368b('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x1ddb6e['having']('`unreadMessages`\x20>\x200');}}if(_0x4a0275['query'][_0x368b('0x86')]){_0x212b68=_['isArray'](_0x4a0275['query'][_0x368b('0x86')])?_0x4a0275[_0x368b('0x4b')][_0x368b('0x86')]:new Array(_0x4a0275[_0x368b('0x4b')][_0x368b('0x86')]);_0x212b68[_0x368b('0x44')](function(_0x67794e){_0x4d590f['or'](_0x368b('0x87'),'%,'+_0x67794e+',%');});}if(_0x4a0275['query'][_0x368b('0x88')]){var _0x99599c=_0x4a0275['query'][_0x368b('0x88')][_0x368b('0x89')]('\x5c','\x5c\x5c')[_0x368b('0x89')]('\x27\x27',_0x368b('0x8a'));if(qs[_0x368b('0x8b')](_0x99599c)){_0x8b2667['or'](_0x368b('0x8c'),_0x99599c+'%');}else{_0x8b2667['or'](_0x368b('0x8d'),qs[_0x368b('0x8e')](_0x99599c))['or'](_0x368b('0x8f'),_0x99599c+'%');}}}_0x1ddb6e[_0x368b('0x56')](_0x8b2667);_0x1ddb6e[_0x368b('0x90')](_0x368b('0x91'));var _0x26b234={'type':db[_0x368b('0x92')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2a8eea=_0x1ddb6e[_0x368b('0x93')]();_0x2a8eea[_0x368b('0x59')]('i.id');_0x2a8eea[_0x368b('0x59')](_0x368b('0x94'),_0x368b('0x6c'));if(_0x1e8891['order']){_0x1e8891[_0x368b('0x54')][_0x368b('0x44')](function(_0x5053b3){_0x1ddb6e[_0x368b('0x54')]('i.'+_0x5053b3[0x0],_0x5053b3[0x1]===_0x368b('0x95')?![]:!![]);});}if(!_[_0x368b('0x7c')](_0x212b68)){_0x1ddb6e['having'](_0x4d590f);_0x2a8eea['where'](_0x368b('0x96'),_0x212b68);}BPromise['resolve']()[_0x368b('0x3b')](function(){if(!_0x359bc6){if(_0x4a0275[_0x368b('0x4b')][_0x368b('0x7d')]||_0x4a0275[_0x368b('0x4b')]['journey'])return;_0x2a8eea[_0x368b('0x56')](_0x368b('0x97'));_0x1ddb6e[_0x368b('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x4a0275[_0x368b('0x98')][_0x368b('0x99')]({'attributes':['id'],'raw':!![]})[_0x368b('0x3b')](function(_0x252bbd){if(_['isEmpty'](_0x252bbd)){_0x2a8eea[_0x368b('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');_0x1ddb6e[_0x368b('0x56')](_0x368b('0x9a'));}else{_0x2a8eea[_0x368b('0x56')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x252bbd,'id'));_0x1ddb6e['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x368b('0x40')](_0x252bbd,'id'));}});})[_0x368b('0x3b')](function(){db['sequelize']['query'](_0x2a8eea[_0x368b('0x9b')](),_0x26b234)['then'](function(_0x197d3a){_0x575e58[_0x368b('0x34')]=_0x197d3a['length'];if(_0x575e58[_0x368b('0x34')]===0x0)return[];return db['sequelize'][_0x368b('0x4b')](_0x456f19['toString'](),_0x26b234)[_0x368b('0x3b')](function(_0x12cad7){_0x4b2d5f=_['keyBy'](_0x12cad7,'id');_0x26b234=_[_0x368b('0x9c')](_0x26b234,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a0275[_0x368b('0x4b')][_0x368b('0x50')]){_0x1e8891['attributes']['forEach'](function(_0x34e436){_0x1ddb6e['field']('i.'+_0x34e436);});}else{_0x1ddb6e['field'](_0x368b('0x94'),'unreadMessages');_0x1ddb6e['field']('a.key','Account.key');_0x1ddb6e[_0x368b('0x59')]('a.mandatoryDisposition',_0x368b('0x9d'));_0x1ddb6e[_0x368b('0x59')]('i.*');_0x1ddb6e[_0x368b('0x59')](_0x368b('0x9e'),'Contact.firstName');_0x1ddb6e[_0x368b('0x59')]('c.lastName','Contact.lastName');_0x1ddb6e[_0x368b('0x59')](_0x368b('0x9f'),'Contact.email');_0x1ddb6e[_0x368b('0x59')]('c.phone','Contact.phone');_0x1ddb6e[_0x368b('0x59')]('c.mobile',_0x368b('0xa0'));_0x1ddb6e['field']('c.fax',_0x368b('0xa1'));_0x1ddb6e['field'](_0x368b('0xa2'),_0x368b('0xa3'));_0x1ddb6e[_0x368b('0x59')](_0x368b('0xa4'),_0x368b('0xa5'));_0x1ddb6e[_0x368b('0x59')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x368b('0x42'));}if(_0x1e8891[_0x368b('0x36')])_0x1ddb6e[_0x368b('0x36')](_0x1e8891[_0x368b('0x36')]);if(_0x1e8891[_0x368b('0x35')])_0x1ddb6e['offset'](_0x1e8891[_0x368b('0x35')]);return db[_0x368b('0xa6')][_0x368b('0x4b')](_0x1ddb6e[_0x368b('0x9b')](),_0x26b234);})[_0x368b('0x3b')](function(_0x20ee9f){_0x424aa1[_0x368b('0x56')](_0x368b('0xa7'),_[_0x368b('0x40')](_0x20ee9f,'id'));return db[_0x368b('0xa6')][_0x368b('0x4b')](_0x424aa1[_0x368b('0x9b')](),_0x26b234)[_0x368b('0x3b')](function(_0x509092){var _0x4136e6=_[_0x368b('0xa8')](_0x509092,_0x368b('0xa9'));var _0x179c33=[];_0x20ee9f[_0x368b('0x44')](function(_0x2cf41b){_0x179c33[_0x368b('0x45')](updateChatInteraction(_0x2cf41b,_0x4b2d5f,_0x4136e6));});return BPromise[_0x368b('0xaa')](_0x179c33);});});})[_0x368b('0x3b')](function(_0x30e6c3){_0x575e58[_0x368b('0xab')]=_0x30e6c3;return _0x575e58;})[_0x368b('0x3b')](respondWithFilteredResult(_0x91bb0b,_0x1e8891));})[_0x368b('0x2f')](handleError(_0x91bb0b,null));};exports['show']=function(_0x2148a4,_0x31d21a){var _0x57de30={'raw':![],'where':{'id':_0x2148a4['params']['id']}},_0x5f0032={};_0x5f0032[_0x368b('0x4a')]=_['keys'](db['ChatInteraction'][_0x368b('0xac')]);_0x5f0032[_0x368b('0x4b')]=_[_0x368b('0x4c')](_0x2148a4[_0x368b('0x4b')]);_0x5f0032['filters']=_[_0x368b('0x4e')](_0x5f0032[_0x368b('0x4a')],_0x5f0032[_0x368b('0x4b')]);_0x57de30[_0x368b('0x4f')]=_[_0x368b('0x4e')](_0x5f0032[_0x368b('0x4a')],qs['fields'](_0x2148a4[_0x368b('0x4b')][_0x368b('0x50')]));_0x57de30[_0x368b('0x4f')]=_0x57de30[_0x368b('0x4f')][_0x368b('0x51')]?_0x57de30['attributes']:_0x5f0032[_0x368b('0x4a')];if(_0x2148a4['query'][_0x368b('0xad')]){_0x57de30['include']=[{'all':!![]}];}_0x57de30=_[_0x368b('0x9c')]({},_0x57de30,_0x2148a4['options']);return db[_0x368b('0x47')]['find'](_0x57de30)[_0x368b('0x3b')](handleEntityNotFound(_0x31d21a,null))[_0x368b('0x3b')](respondWithResult(_0x31d21a,null))['catch'](handleError(_0x31d21a,null));};exports[_0x368b('0xae')]=function(_0x11a086,_0x18167e){return db[_0x368b('0x47')][_0x368b('0xae')](_0x11a086[_0x368b('0x7b')],{})[_0x368b('0x3b')](respondWithResult(_0x18167e,0xc9))[_0x368b('0x2f')](handleError(_0x18167e,null));};exports[_0x368b('0xaf')]=function(_0xa6938a,_0x390fa2){if(_0xa6938a[_0x368b('0x7b')]['id']){delete _0xa6938a[_0x368b('0x7b')]['id'];}return db['ChatInteraction'][_0x368b('0x6b')]({'where':{'id':_0xa6938a['params']['id']}})[_0x368b('0x3b')](handleEntityNotFound(_0x390fa2,null))['then'](saveUpdates(_0xa6938a[_0x368b('0x7b')],null))[_0x368b('0x3b')](respondWithResult(_0x390fa2,null))[_0x368b('0x2f')](handleError(_0x390fa2,null));};exports['destroy']=function(_0x24c71c,_0x475234){return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0x24c71c['params']['id']}})[_0x368b('0x3b')](handleEntityNotFound(_0x475234,null))[_0x368b('0x3b')](removeEntity(_0x475234,null))[_0x368b('0x2f')](handleError(_0x475234,null));};exports[_0x368b('0xb0')]=function(_0x575b61,_0x486c46){return db['ChatInteraction'][_0x368b('0xb0')]()[_0x368b('0x3b')](respondWithResult(_0x486c46,null))[_0x368b('0x2f')](handleError(_0x486c46,null));};exports[_0x368b('0xb1')]=function(_0x7ce688,_0x121542){var _0x331839=_0x7ce688[_0x368b('0xb2')]['id'];var _0xaa6479;var _0x57ffb1;var _0x4da490;return db[_0x368b('0x47')][_0x368b('0xb3')]({'where':{'id':_0x331839}})[_0x368b('0x3b')](function(_0x81e72e){_0xaa6479=_0x81e72e;return db['ChatWebsite']['findOne']({'where':{'id':_0x81e72e[_0x368b('0x7d')]},'attributes':['id',_0x368b('0xb4'),'vidaooEscalation'],'raw':!![]});})[_0x368b('0x3b')](function(_0x3c0ebc){if(_0x3c0ebc&&_0x3c0ebc[_0x368b('0xb4')]&&_0x3c0ebc[_0x368b('0xb5')]){_0x57ffb1=_0x3c0ebc;var _0x4df73a={'rejectUnauthorized':![],'method':_0x368b('0xb6'),'uri':_0x368b('0xb7'),'headers':{'X-APIKEY':_0x3c0ebc[_0x368b('0xb4')]},'body':{'name':'MotionCWB:'+_0x331839},'redirect':'follow','json':!![]};return rp(_0x4df73a);}else{throw new db[(_0x368b('0x92'))]['ValidationError'](_0x368b('0xb8'));}})[_0x368b('0x3b')](function(_0x23856f){_0x4da490=_0x23856f;if(_0x4da490['id']){var _0x43ec0e={'body':_0x4da490[_0x368b('0xb9')],'ChatWebsiteId':_0x57ffb1['id'],'ChatInteractionId':_0xaa6479['id'],'direction':_0x368b('0xba'),'UserId':_0x7ce688[_0x368b('0x98')]['id']};return db[_0x368b('0xbb')][_0x368b('0xae')](_0x43ec0e,{});}else{throw new db[(_0x368b('0x92'))][(_0x368b('0x22'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x368b('0x3b')](function(){return _0xaa6479[_0x368b('0xbc')]({'vidaooSessionId':_0x4da490['id']});})[_0x368b('0x3b')](respondWithResult(_0x121542,null))['catch'](handleError(_0x121542,null));};exports[_0x368b('0xbd')]=function(_0x5b6c56,_0x184636){if(_0x5b6c56[_0x368b('0x7b')]['id']){delete _0x5b6c56['body']['id'];}return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0x5b6c56[_0x368b('0xb2')]['id']}})[_0x368b('0x3b')](handleEntityNotFound(_0x184636,null))[_0x368b('0x3b')](saveUpdates(_0x5b6c56[_0x368b('0x7b')],null))['then'](respondWithResult(_0x184636,null))[_0x368b('0x2f')](handleError(_0x184636,null));};exports['abandon']=function(_0x22805c,_0x2c4a5d,_0x2e594e){if(_0x22805c['body']['id']){delete _0x22805c[_0x368b('0x7b')]['id'];}return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0x22805c['params']['id']}})[_0x368b('0x3b')](function(_0x26e337){if(!_0x26e337){logger[_0x368b('0x2b')](_0x368b('0xbe'),_0x368b('0xbf'),0x194,_0x368b('0xc0'));_0x2c4a5d[_0x368b('0x30')](0x194);}else{if(_0x26e337[_0x368b('0x7a')]){throw new db[(_0x368b('0x92'))][(_0x368b('0x22'))](_0x368b('0xc1'));}}return _0x26e337;})['then'](function(_0xb2f4cd){if(_0xb2f4cd){return _0xb2f4cd['update']({'closed':_0x22805c[_0x368b('0x7b')][_0x368b('0xc2')],'disposition':_0x22805c[_0x368b('0x7b')]['disposition']})[_0x368b('0x3b')](function(_0x5c7863){return _0x5c7863;});}})[_0x368b('0x3b')](function(_0x49e400){return respondWithRpcPromise(_0x368b('0xc3'),_0x368b('0xbf'),_0x22805c[_0x368b('0x7b')],client9004);})['then'](respondWithResult(_0x2c4a5d,null))[_0x368b('0x2f')](handleError(_0x2c4a5d,null));};exports[_0x368b('0xc4')]=function(_0xb342e4,_0x6cd99c,_0x18ef5c){_0xb342e4[_0x368b('0x7b')]['name']=_0xb342e4['file'][_0x368b('0xc5')];_0xb342e4[_0x368b('0x7b')][_0x368b('0xc6')]=_0xb342e4[_0x368b('0xc7')][_0x368b('0xc8')];_0xb342e4[_0x368b('0x7b')]['type']=_0xb342e4['file'][_0x368b('0xc9')];return db[_0x368b('0xca')]['create'](_0xb342e4[_0x368b('0x7b')])['then'](respondWithResult(_0x6cd99c,0xc9))[_0x368b('0x2f')](handleError(_0x6cd99c,null));};exports[_0x368b('0xcb')]=function(_0x3ec82c,_0x3af1b0,_0x47353a){return db[_0x368b('0x47')]['findOne']({'where':{'id':_0x3ec82c[_0x368b('0xb2')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3af1b0,null))[_0x368b('0x3b')](function(_0x4b9522){if(_0x4b9522){if(_0x4b9522[_0x368b('0xc2')]){return _0x3af1b0['status'](0x193)['json']({'status':0x193,'message':_0x368b('0xcc')});}return db['Attachment'][_0x368b('0xb3')]({'where':{'id':_0x3ec82c[_0x368b('0x4b')][_0x368b('0xcd')]},'raw':!![]})[_0x368b('0x3b')](handleEntityNotFound(_0x3af1b0,null));}})[_0x368b('0x3b')](function(_0x41b455){if(_0x41b455){return _0x3af1b0[_0x368b('0xce')](path[_0x368b('0xcf')](config[_0x368b('0xd0')],_0x368b('0xd1'),_0x41b455[_0x368b('0xc6')]));}})[_0x368b('0x2f')](handleError(_0x3af1b0,null));};exports[_0x368b('0xd2')]=function(_0x28f26f,_0x5a43df){var _0x37a510=null;var _0x2f52f9=null;var _0x185bb6=null;var _0x55b248=null;if(_0x28f26f[_0x368b('0x7b')]['id']){delete _0x28f26f['body']['id'];}if(_0x28f26f[_0x368b('0x7b')]['mailTranscript']){_0x55b248=path[_0x368b('0xcf')](config[_0x368b('0xd0')],_0x368b('0xd3'),util['format'](_0x368b('0xd4'),Date[_0x368b('0xd5')]()));_0x28f26f[_0x368b('0x7b')]['pathTranscript']=_0x55b248;}return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0x28f26f[_0x368b('0xb2')]['id']},'include':[{'model':db[_0x368b('0xbb')],'as':_0x368b('0xd6'),'include':[{'model':db['User'],'as':_0x368b('0x78')}]}]})[_0x368b('0x3b')](handleEntityNotFound(_0x5a43df,null))['then'](saveUpdates(_0x28f26f[_0x368b('0x7b')],null))[_0x368b('0x3b')](function(_0xccff5a){if(_0xccff5a){_0x37a510=_0xccff5a;return db[_0x368b('0xd7')][_0x368b('0x6b')]({'where':{'id':_0x37a510[_0x368b('0x7d')]}});}})[_0x368b('0x3b')](function(_0x107b7b){if(_0x107b7b){_0x185bb6=_0x107b7b;return db[_0x368b('0xd8')][_0x368b('0x6b')]({'where':{'id':_0x37a510['ContactId']}});}})['then'](function(_0x5d9011){if(_0x5d9011){_0x2f52f9=_0x5d9011;if(_0x55b248){var _0x226de8=null;for(var _0x4dc01b=0x1;_0x4dc01b<_0x37a510[_0x368b('0xd6')][_0x368b('0x51')];++_0x4dc01b){_0x226de8=_0x37a510[_0x368b('0xd6')][_0x4dc01b];var _0x5bce06=_0x226de8[_0x368b('0x7a')]?util[_0x368b('0xd9')]('%s%d',_0x185bb6[_0x368b('0xda')],_0x226de8[_0x368b('0x7a')]):_0x368b('0xdb');var _0x1ab6f5=_0x28f26f[_0x368b('0x7b')][_0x368b('0xdc')]||util[_0x368b('0xd9')]('%s%d',_0x368b('0xdd'),_0x226de8['ContactId']);switch(_0x185bb6['agentIdentifier']){case _0x368b('0xde'):_0x5bce06=_0x226de8['UserId']?util[_0x368b('0xd9')](_0x368b('0xdf'),_0x185bb6[_0x368b('0xda')],_0x226de8[_0x368b('0x7a')]):_0x368b('0xdb');break;case _0x368b('0xe0'):_0x5bce06=_0x226de8['UserId']?_0x226de8[_0x368b('0x78')]['alias']||_0x226de8[_0x368b('0x78')][_0x368b('0xe1')]:_0x368b('0xdb');break;case'agent_fullname':_0x5bce06=_0x226de8[_0x368b('0x7a')]?_0x226de8[_0x368b('0x78')]['fullname']:_0x368b('0xdb');break;default:_0x5bce06=_0x226de8['UserId']?util[_0x368b('0xd9')](_0x368b('0xdf'),_0x185bb6['agentAlias'],_0x226de8['UserId']):_0x368b('0xdb');}var _0x4a8754=util[_0x368b('0xd9')](_0x368b('0xe2'),moment(_0x226de8[_0x368b('0xe3')])[_0x368b('0xd9')](_0x368b('0xe4')),_0x226de8[_0x368b('0xe5')]==='in'?_0x1ab6f5:_0x5bce06,_0x226de8[_0x368b('0x7b')]);if(!_0x226de8[_0x368b('0xe6')]){fs[_0x368b('0xe7')](_0x55b248,_0x4a8754);}}return db['MailAccount'][_0x368b('0xb3')]({'where':{'service':!![]},'include':[{'model':db[_0x368b('0xe8')],'as':_0x368b('0xe9'),'raw':!![]}]});}}})[_0x368b('0x3b')](function(_0x5a2b9e){if(_0x5a2b9e&&_0x5a2b9e[_0x368b('0xe9')]&&_0x28f26f[_0x368b('0x7b')]){var _0x281f03={'tls':{'rejectUnauthorized':![]}};if(_0x5a2b9e[_0x368b('0xe9')][_0x368b('0xea')]){_0x281f03[_0x368b('0xea')]=_0x5a2b9e[_0x368b('0xe9')][_0x368b('0xea')];}else{_0x281f03['host']=_0x5a2b9e[_0x368b('0xe9')][_0x368b('0xeb')];_0x281f03['port']=_0x5a2b9e[_0x368b('0xe9')][_0x368b('0xec')];_0x281f03[_0x368b('0xed')]=_0x5a2b9e[_0x368b('0xe9')][_0x368b('0xed')];}if(_0x5a2b9e['Smtp']['authentication']){_0x281f03[_0x368b('0xee')]={'user':_0x5a2b9e['Smtp'][_0x368b('0x98')],'pass':_0x5a2b9e[_0x368b('0xe9')][_0x368b('0xef')]};}return respondWithRpcPromise(_0x368b('0xf0'),_0x368b('0xf1'),{'account':_0x281f03,'message':{'from':util[_0x368b('0xd9')]('\x22%s\x22\x20<%s>',_0x5a2b9e[_0x368b('0x3d')],_0x5a2b9e[_0x368b('0xf2')]||_0x5a2b9e[_0x368b('0xe9')][_0x368b('0x98')]),'to':_0x28f26f['body'][_0x368b('0xf3')],'subject':'Mail\x20Transcript','text':util[_0x368b('0xd9')](_0x368b('0xf4'),_0x28f26f[_0x368b('0x7b')][_0x368b('0xf3')]),'attachments':[{'path':_0x55b248}]}})['then'](function(){return _0x37a510;})[_0x368b('0x2f')](function(_0x8f5427){console[_0x368b('0x2b')](_0x8f5427);});}else{return _0x37a510;}})['then'](respondWithStatusCode(_0x5a43df,0xc8))['catch'](handleError(_0x5a43df,null));};exports[_0x368b('0xf5')]=function(_0x25d07e,_0x19d475,_0x2964b8){return db[_0x368b('0xbb')][_0x368b('0x6b')]({'where':{'id':_0x25d07e[_0x368b('0xb2')]['id']}})[_0x368b('0x3b')](handleEntityNotFound(_0x19d475,null))['then'](function(_0x172172){if(_0x172172){return _0x172172['addMessage'](_0x25d07e[_0x368b('0x7b')][_0x368b('0xf6')],_['omit'](_0x25d07e[_0x368b('0x7b')],[_0x368b('0xf6'),'id'])||{});}})[_0x368b('0x3b')](respondWithResult(_0x19d475,null))['catch'](handleError(_0x19d475,null));};exports['getMessages']=function(_0xc4b426,_0x5cc02f,_0x3ba246){var _0x59538f={'raw':![],'where':{}};var _0x35d8dc={};var _0x14205c={'count':0x0,'rows':[]};return db[_0x368b('0x47')]['findOne']({'where':{'id':_0xc4b426[_0x368b('0xb2')]['id']}})['then'](handleEntityNotFound(_0x5cc02f,null))[_0x368b('0x3b')](function(_0xf330fa){if(_0xf330fa){_0x35d8dc['model']=_['keys'](db[_0x368b('0xbb')][_0x368b('0xac')]);_0x35d8dc['query']=_[_0x368b('0x4c')](_0xc4b426['query']);_0x35d8dc['filters']=_[_0x368b('0x4e')](_0x35d8dc[_0x368b('0x4a')],_0x35d8dc[_0x368b('0x4b')]);_0x59538f['attributes']=_[_0x368b('0x4e')](_0x35d8dc[_0x368b('0x4a')],qs['fields'](_0xc4b426[_0x368b('0x4b')]['fields']));_0x59538f[_0x368b('0x4f')]=_0x59538f[_0x368b('0x4f')]['length']?_0x59538f[_0x368b('0x4f')]:_0x35d8dc['model'];if(!_0xc4b426[_0x368b('0x4b')][_0x368b('0x52')](_0x368b('0x53'))){_0x59538f[_0x368b('0x36')]=qs[_0x368b('0x36')](_0xc4b426[_0x368b('0x4b')][_0x368b('0x36')]);_0x59538f[_0x368b('0x35')]=qs[_0x368b('0x35')](_0xc4b426[_0x368b('0x4b')][_0x368b('0x35')]);}_0x59538f[_0x368b('0x54')]=qs['sort'](_0xc4b426[_0x368b('0x4b')][_0x368b('0x55')]);_0x59538f[_0x368b('0x56')]=qs['filters'](_[_0x368b('0x57')](_0xc4b426[_0x368b('0x4b')],_0x35d8dc[_0x368b('0x4d')]));_0x59538f['where'][_0x368b('0xa9')]=_0xf330fa['id'];if(_0xc4b426[_0x368b('0x4b')][_0x368b('0x88')]){_0x59538f['where']=_[_0x368b('0x9c')](_0x59538f[_0x368b('0x56')],{'$or':_['map'](_0x59538f['attributes'],function(_0x4f1af7){var _0xd1d71f={};_0xd1d71f[_0x4f1af7]={'$like':'%'+_0xc4b426[_0x368b('0x4b')][_0x368b('0x88')]+'%'};return _0xd1d71f;})});}if(_0xc4b426['query'][_0x368b('0x80')]){var _0x5c02c8=_0xc4b426['query'][_0x368b('0x80')][_0x368b('0x43')](',');var _0x6fb766={};_0x6fb766[_0x5c02c8[0x0]]={'$gte':moment(_0x5c02c8[0x1])[_0x368b('0xd9')](_0x368b('0xf7'))};_0x59538f[_0x368b('0x56')]=_[_0x368b('0x9c')](_0x59538f[_0x368b('0x56')],_0x6fb766);}_0x59538f=_[_0x368b('0x9c')]({},_0x59538f,_0xc4b426[_0x368b('0xf8')]);return db[_0x368b('0xbb')][_0x368b('0x34')]({'where':_0x59538f[_0x368b('0x56')]})[_0x368b('0x3b')](function(_0x205e9c){_0x14205c['count']=_0x205e9c;if(_0xc4b426[_0x368b('0x4b')][_0x368b('0xad')]){_0x59538f['include']=[{'all':!![]}];}return db[_0x368b('0xbb')]['findAll'](_0x59538f);})[_0x368b('0x3b')](function(_0x2af132){_0x14205c[_0x368b('0xab')]=_0x2af132;return _0x14205c;});}})[_0x368b('0x3b')](respondWithFilteredResult(_0x5cc02f,_0x59538f))[_0x368b('0x2f')](handleError(_0x5cc02f,null));};exports[_0x368b('0xf9')]=function(_0x49e570,_0x291e24,_0x5c53c2){var _0x161823={'where':{}},_0x5b0471={},_0x6e6c9b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x368b('0xb3')]({'where':{'id':_0x49e570[_0x368b('0xb2')]['id']}})[_0x368b('0x3b')](handleEntityNotFound(_0x291e24,null))[_0x368b('0x3b')](function(_0xf148ef){if(_0xf148ef){_0x5b0471[_0x368b('0x4a')]=_[_0x368b('0x4c')](db[_0x368b('0xbb')][_0x368b('0xac')]);_0x5b0471['query']=_[_0x368b('0x4c')](_0x49e570['query']);_0x5b0471[_0x368b('0x4d')]=_[_0x368b('0x4e')](_0x5b0471['model'],_0x5b0471[_0x368b('0x4b')]);_0x161823[_0x368b('0x4f')]=_[_0x368b('0x4e')](_0x5b0471[_0x368b('0x4a')],qs[_0x368b('0x50')](_0x49e570['query']['fields']));_0x161823['attributes']=_0x161823['attributes']['length']?_0x161823[_0x368b('0x4f')]:_0x5b0471['model'];if(!_0x49e570[_0x368b('0x4b')][_0x368b('0x52')]('nolimit')){_0x161823[_0x368b('0x36')]=qs[_0x368b('0x36')](_0x49e570[_0x368b('0x4b')]['limit']);_0x161823[_0x368b('0x35')]=qs[_0x368b('0x35')](_0x49e570[_0x368b('0x4b')][_0x368b('0x35')]);}_0x161823[_0x368b('0x54')]=qs[_0x368b('0x55')](_0x49e570[_0x368b('0x4b')][_0x368b('0x55')]);_0x161823[_0x368b('0x56')]=qs['filters'](_['pick'](_0x49e570[_0x368b('0x4b')],_0x5b0471['filters']));_0x161823[_0x368b('0x56')]['ChatInteractionId']=_0xf148ef['id'];if(_0x49e570[_0x368b('0x4b')][_0x368b('0x88')]){_0x161823[_0x368b('0x56')]=_[_0x368b('0x9c')](_0x161823[_0x368b('0x56')],{'$or':_[_0x368b('0x40')](_0x161823[_0x368b('0x4f')],function(_0x398e91){var _0x44e4c4={};_0x44e4c4[_0x398e91]={'$like':'%'+_0x49e570[_0x368b('0x4b')][_0x368b('0x88')]+'%'};return _0x44e4c4;})});}_0x161823[_0x368b('0x56')][_0x368b('0xe6')]=![];if(_0x49e570['query']['id']){_0x161823[_0x368b('0x56')]['id']={'$gt':_0x49e570['query']['id']};}_0x161823=_['merge']({},_0x161823,_0x49e570[_0x368b('0xf8')]);return db[_0x368b('0xbb')][_0x368b('0x34')]({'where':_0x161823['where']})[_0x368b('0x3b')](function(_0xab911c){_0x6e6c9b['count']=_0xab911c;_0x161823[_0x368b('0xfa')]=[];if(_0x49e570[_0x368b('0x4b')][_0x368b('0xfb')]){_0x161823['include'][_0x368b('0x45')]({'model':db[_0x368b('0x78')],'as':_0x368b('0x78'),'attributes':['id','fullname',_0x368b('0xfc')]});}if(_0x49e570[_0x368b('0x4b')][_0x368b('0xad')]){_0x161823[_0x368b('0xfa')]=[{'all':!![]}];}return db[_0x368b('0xbb')]['findAll'](_0x161823);})[_0x368b('0x3b')](function(_0x5147fd){_0x6e6c9b['rows']=_0x5147fd;return _0x6e6c9b;});}})['then'](respondWithFilteredResult(_0x291e24,_0x161823))['catch'](handleError(_0x291e24,null));};exports['addTags']=function(_0x33268c,_0x4fe0a8,_0x53ca1a){return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0x33268c[_0x368b('0xb2')]['id']}})[_0x368b('0x3b')](handleEntityNotFound(_0x4fe0a8,null))[_0x368b('0x3b')](function(_0x24ce03){if(_0x24ce03){return _0x24ce03[_0x368b('0xfd')](_0x33268c[_0x368b('0x7b')]['ids'],_['omit'](_0x33268c[_0x368b('0x7b')],[_0x368b('0xf6'),'id'])||{})[_0x368b('0xfe')](function(){return db[_0x368b('0x76')][_0x368b('0xff')]({'attributes':['id',_0x368b('0x3d'),_0x368b('0x5a')],'where':{'id':_0x33268c[_0x368b('0x7b')][_0x368b('0xf6')]}});})[_0x368b('0x3b')](function(_0x9d7032){socket['emit'](_0x368b('0x100'),{'id':Number(_0x33268c[_0x368b('0xb2')]['id']),'tags':_0x9d7032||[]});return{'id':Number(_0x33268c['params']['id']),'tags':_0x9d7032||[]};});}})[_0x368b('0x3b')](respondWithResult(_0x4fe0a8,null))[_0x368b('0x2f')](handleError(_0x4fe0a8,null));};exports['removeTags']=function(_0xd6c4bb,_0x51ac2c,_0xcc36ae){return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0xd6c4bb[_0x368b('0xb2')]['id']}})['then'](handleEntityNotFound(_0x51ac2c,null))[_0x368b('0x3b')](function(_0x3eeb82){if(_0x3eeb82){return _0x3eeb82[_0x368b('0x101')](_0xd6c4bb[_0x368b('0x4b')][_0x368b('0xf6')]);}})[_0x368b('0x3b')](respondWithStatusCode(_0x51ac2c,null))[_0x368b('0x2f')](handleError(_0x51ac2c,null));};exports['download']=function(_0x1af3e4,_0x21aba7){var _0x4edf50=moment()['unix']()[_0x368b('0x9b')]();var _0x4ff590=path[_0x368b('0xcf')](config[_0x368b('0xd0')],'server',_0x368b('0x102'),'tmp');var _0x58d475=path['join'](config[_0x368b('0xd0')],_0x368b('0x103'),_0x368b('0x102'),'attachments');var _0x47fbb2=path[_0x368b('0xcf')](_0x4ff590,_0x4edf50);var _0x54b1f7=util[_0x368b('0xd9')](_0x368b('0x104'),_0x1af3e4[_0x368b('0xb2')]['id'],_0x4edf50);var _0x33417b=path['join'](_0x4ff590,_0x54b1f7);var _0x16fca8=[];_0x16fca8[_0x368b('0x45')]({'model':db['User'],'as':_0x368b('0x78'),'attributes':['id',_0x368b('0xe1')],'raw':!![]});_0x16fca8[_0x368b('0x45')]({'model':db[_0x368b('0xd8')],'as':_0x368b('0x6f'),'attributes':['id',_0x368b('0x105'),_0x368b('0x106')],'raw':!![]});if(_0x1af3e4[_0x368b('0x4b')][_0x368b('0x107')]){_0x16fca8['push']({'model':db[_0x368b('0xca')],'as':_0x368b('0xca'),'raw':!![]});}var _0x3a394c=[{'model':db[_0x368b('0xbb')],'as':_0x368b('0xd6'),'attributes':['id','body','createdAt','direction',_0x368b('0xe6'),_0x368b('0x85')],'include':_0x16fca8}];_0x3a394c['push']({'model':db[_0x368b('0xd7')],'as':_0x368b('0x108'),'attributes':['id','name']});_0x3a394c['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x368b('0xe1')]});return db[_0x368b('0x47')][_0x368b('0x6b')]({'where':{'id':_0x1af3e4[_0x368b('0xb2')]['id']},'include':_0x3a394c})[_0x368b('0x3b')](handleEntityNotFound(_0x21aba7,null))[_0x368b('0x3b')](function(_0xe3ef0f){if(_0xe3ef0f){var _0x54c0fb=_0xe3ef0f[_0x368b('0x109')]({'plain':!![]});fs['mkdirSync'](_0x47fbb2);var _0x10eba5={'format':'A4','border':_0x368b('0x10a'),'header':{'height':_0x368b('0x10b'),'contents':{'first':_0x368b('0x10c')}},'footer':{'height':_0x368b('0x10d'),'contents':{'default':util[_0x368b('0xd9')](_0x368b('0x10e'),util[_0x368b('0xd9')](_0x368b('0x10f'),_0x368b('0x110'),_0x54c0fb['id']),moment()['format'](_0x368b('0x111'))[_0x368b('0x9b')]())}}};var _0x915c02={'channel':_0x368b('0x110'),'account':_0x54c0fb['Account'][_0x368b('0x3d')],'agent':_0x54c0fb['Owner']?_0x54c0fb[_0x368b('0x112')][_0x368b('0xe1')]:_0x368b('0x113'),'createdAt':moment(_0x54c0fb[_0x368b('0xe3')])[_0x368b('0xd9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x368b('0x9b')](),'closedAt':_0x54c0fb[_0x368b('0xc2')]?moment(_0x54c0fb[_0x368b('0x114')])[_0x368b('0xd9')](_0x368b('0xf7'))[_0x368b('0x9b')]():'','disposition':_0x54c0fb[_0x368b('0x115')],'chatInfo':{'browser':_0x54c0fb[_0x368b('0x116')],'os':_0x54c0fb[_0x368b('0x117')],'referer':_0x54c0fb[_0x368b('0x118')],'customerIp':_0x54c0fb['customerIp'],'customerPort':_0x54c0fb['customerPort']?_0x54c0fb[_0x368b('0x119')]:_0x368b('0x113')},'messages':_(_0x54c0fb[_0x368b('0xd6')])[_0x368b('0x11a')]()['filter']({'secret':![]})[_0x368b('0x40')](function(_0x3743ed){if(_0x3743ed[_0x368b('0xca')]){var _0x85688f=path[_0x368b('0xcf')](_0x58d475,_0x3743ed['Attachment'][_0x368b('0xc6')]);if(fs[_0x368b('0x11b')](_0x85688f)){fs[_0x368b('0x11c')](_0x85688f)[_0x368b('0x11d')](fs[_0x368b('0x11e')](path['join'](_0x47fbb2,_0x3743ed[_0x368b('0xca')]['basename'])));}}return{'date':moment(_0x3743ed['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x368b('0x9b')](),'sender':_0x3743ed[_0x368b('0xe5')]===_0x368b('0xba')?_0x3743ed[_0x368b('0x78')]?_0x3743ed[_0x368b('0x78')][_0x368b('0xe1')]:_0x368b('0xdb'):_0x3743ed[_0x368b('0x6f')][_0x368b('0x105')]+(_0x3743ed[_0x368b('0x6f')]['lastName']?'\x20'+_0x3743ed[_0x368b('0x6f')][_0x368b('0x106')]:''),'body':_0x3743ed['Attachment']?_0x3743ed[_0x368b('0xca')][_0x368b('0xc6')]:_0x3743ed[_0x368b('0x7b')],'direction':_0x3743ed['direction']===_0x368b('0xba')?'A':'C','secret':_0x3743ed[_0x368b('0xe6')],'read':_0x3743ed[_0x368b('0x85')],'attachment':_0x3743ed[_0x368b('0xca')]};})[_0x368b('0x71')]()};return ejs['renderFile'](path[_0x368b('0xcf')](config[_0x368b('0xd0')],_0x368b('0x103'),_0x368b('0x11f'),_0x368b('0x120')),{'interaction':_0x915c02})[_0x368b('0x3b')](function(_0x12d3fa){return new BPromise(function(_0x1a53aa,_0x101812){pdf[_0x368b('0xae')](_0x12d3fa,_0x10eba5)[_0x368b('0x121')](path[_0x368b('0xcf')](_0x47fbb2,_0x368b('0x122')+_0x54c0fb['id']+'-'+_0x4edf50+_0x368b('0x123')),function(_0x28a8c2,_0x5965ae){if(_0x28a8c2)return _0x101812(_0x28a8c2);_0x1a53aa(_0x5965ae);});});})[_0x368b('0x3b')](function(){return new BPromise(function(_0x1c6390,_0x46fc82){zipdir(_0x47fbb2,{'saveTo':_0x33417b},function(_0x5bdbde,_0xcf865a){if(_0x5bdbde)return _0x46fc82(_0x5bdbde);return _0x1c6390(_0xcf865a);});})[_0x368b('0x3b')](function(){return new BPromise(function(_0x344201,_0x517c49){rimraf(_0x47fbb2,function(_0xa14fd9){if(_0xa14fd9)_0x517c49(_0xa14fd9);return _0x344201();});});})[_0x368b('0x3b')](function(){return _0x21aba7[_0x368b('0xce')](_0x33417b,_0x54b1f7,function(_0x5cc515){if(_0x5cc515){console[_0x368b('0x124')](_0x368b('0x125'),_0x5cc515);}else{fs['unlinkSync'](_0x33417b);}});});});}else{return _0x21aba7['sendStatus'](0xc8);}})[_0x368b('0x2f')](handleError(_0x21aba7,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ac0ee96..4cb46e5 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 _0xc7ce=['hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','then','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0xc7ce,0x18e));var _0xec7c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc7ce[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xec7c('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xec7c('0x1')];var ChatMessage=require(_0xec7c('0x2'))['db'][_0xec7c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xec7c('0x4')](0x0);var events={'afterCreate':_0xec7c('0x5'),'afterUpdate':_0xec7c('0x6'),'afterDestroy':_0xec7c('0x7')};function emitEvent(_0x5aecc4){return function(_0x4b9037,_0x18b845,_0x4cb5db){_0x4b9037['getUsers']({'attributes':['id'],'raw':!![]})[_0xec7c('0x8')](function(_0x4d6931){_0x4b9037['setDataValue']('Users',_0x4d6931['map'](function(_0x20b06c){return{'id':_0x20b06c['id']};}));return ChatMessage[_0xec7c('0x9')]({'where':{'ChatInteractionId':_0x4b9037['id'],'direction':'in','read':![]},'raw':!![]});})[_0xec7c('0x8')](function(_0x4c2caf){_0x4b9037[_0xec7c('0xa')](_0xec7c('0xb'),_0x4c2caf[_0xec7c('0xc')]);ChatInteractionEvents[_0xec7c('0xd')](_0x5aecc4+':'+_0x4b9037['id'],_0x4b9037);ChatInteractionEvents[_0xec7c('0xd')](_0x5aecc4,_0x4b9037);_0x4cb5db(null);})[_0xec7c('0xe')](_0x4cb5db(null));};}for(var e in events){if(events[_0xec7c('0xf')](e)){var event=events[e];ChatInteraction[_0xec7c('0x10')](e,emitEvent(event));}}module[_0xec7c('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x0a1c=['hook','exports','ChatInteraction','../../mysqldb','ChatMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty'];(function(_0x1da94d,_0x5291ed){var _0x20da12=function(_0x5250bf){while(--_0x5250bf){_0x1da94d['push'](_0x1da94d['shift']());}};_0x20da12(++_0x5291ed);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x0a1c[_0x319cb9];return _0x1735fc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xc0a1('0x0')];var ChatMessage=require(_0xc0a1('0x1'))['db'][_0xc0a1('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0a1('0x3'),'afterDestroy':_0xc0a1('0x4')};function emitEvent(_0x108afd){return function(_0x1df4bf,_0x3f1c7e,_0x3549cf){_0x1df4bf[_0xc0a1('0x5')]({'attributes':['id'],'raw':!![]})[_0xc0a1('0x6')](function(_0x1712cd){_0x1df4bf[_0xc0a1('0x7')](_0xc0a1('0x8'),_0x1712cd[_0xc0a1('0x9')](function(_0x14e116){return{'id':_0x14e116['id']};}));return ChatMessage[_0xc0a1('0xa')]({'where':{'ChatInteractionId':_0x1df4bf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc0a1('0x6')](function(_0xa025f6){_0x1df4bf[_0xc0a1('0x7')]('unreadMessages',_0xa025f6[_0xc0a1('0xb')]);ChatInteractionEvents[_0xc0a1('0xc')](_0x108afd+':'+_0x1df4bf['id'],_0x1df4bf);ChatInteractionEvents[_0xc0a1('0xc')](_0x108afd,_0x1df4bf);_0x3549cf(null);})['catch'](_0x3549cf(null));};}for(var e in events){if(events[_0xc0a1('0xd')](e)){var event=events[e];ChatInteraction[_0xc0a1('0xe')](e,emitEvent(event));}}module[_0xc0a1('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 336b129..cef5330 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 _0xe943=['chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xe943,0x1e7));var _0x3e94=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xe943[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x3e94('0x0'));var util=require(_0x3e94('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e94('0x2'));var rp=require(_0x3e94('0x3'));var fs=require('fs');var path=require(_0x3e94('0x4'));var rimraf=require(_0x3e94('0x5'));var config=require(_0x3e94('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x3e94('0x7')]=function(_0x3c10c5,_0x67a2d9){return _0x3c10c5[_0x3e94('0x8')]('ChatInteraction',attributes,{'tableName':_0x3e94('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d569e,_0x56768e,_0x3ed678){if(_0x3d569e[_0x3e94('0xa')](_0x3e94('0xb'))){_0x3d569e['closedAt']=moment()[_0x3e94('0xc')](_0x3e94('0xd'));}_0x3ed678(null,_0x3d569e);}},'charset':_0x3e94('0xe'),'collate':_0x3e94('0xf')});}; \ No newline at end of file +var _0x10b2=['utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x431613,_0x326fcf){var _0x526421=function(_0x46a9ff){while(--_0x46a9ff){_0x431613['push'](_0x431613['shift']());}};_0x526421(++_0x326fcf);}(_0x10b2,0x89));var _0x210b=function(_0x3d2c65,_0x1517e8){_0x3d2c65=_0x3d2c65-0x0;var _0x408d28=_0x10b2[_0x3d2c65];return _0x408d28;};'use strict';var _=require(_0x210b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x210b('0x1'));var moment=require('moment');var BPromise=require(_0x210b('0x2'));var rp=require(_0x210b('0x3'));var fs=require('fs');var path=require(_0x210b('0x4'));var rimraf=require(_0x210b('0x5'));var config=require(_0x210b('0x6'));var attributes=require(_0x210b('0x7'));module[_0x210b('0x8')]=function(_0x132dfc,_0x27d66d){return _0x132dfc[_0x210b('0x9')](_0x210b('0xa'),attributes,{'tableName':_0x210b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7449d8,_0x2c4c29,_0x5bc313){if(_0x7449d8['changed'](_0x210b('0xc'))){_0x7449d8['closedAt']=moment()[_0x210b('0xd')](_0x210b('0xe'));}_0x5bc313(null,_0x7449d8);}},'charset':_0x210b('0xf'),'collate':_0x210b('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7c9433d..cba434b 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 _0x8ee1=['register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes','limit','UpdateChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x8ee1,0x6f));var _0x18ee=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x8ee1[_0x5db99b];return _0x4b2d0e;};'use strict';var _=require(_0x18ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x18ee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18ee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x18ee('0x3'));var logger=require(_0x18ee('0x4'))(_0x18ee('0x5'));var config=require(_0x18ee('0x6'));var jayson=require(_0x18ee('0x7'));var client=jayson[_0x18ee('0x8')][_0x18ee('0x9')]({'port':0x232a});config[_0x18ee('0xa')]=_[_0x18ee('0xb')](config[_0x18ee('0xa')],{'host':_0x18ee('0xc'),'port':0x18eb});var socket=require(_0x18ee('0xd'))(new Redis(config[_0x18ee('0xa')]));require(_0x18ee('0xe'))[_0x18ee('0xf')](socket);function respondWithRpcPromise(_0x3d2b74,_0x116567,_0x30fcf6){return new BPromise(function(_0x470d5a,_0x4b9eb1){return client['request'](_0x3d2b74,_0x30fcf6)[_0x18ee('0x10')](function(_0x4dcbd4){logger[_0x18ee('0x11')](_0x18ee('0x12'),_0x116567,_0x18ee('0x13'));logger[_0x18ee('0x14')](_0x18ee('0x15'),_0x116567,_0x18ee('0x13'),JSON[_0x18ee('0x16')](_0x4dcbd4));if(_0x4dcbd4[_0x18ee('0x17')]){if(_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x18')]===0x1f4){logger['error'](_0x18ee('0x12'),_0x116567,_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);return _0x4b9eb1(_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);}logger[_0x18ee('0x17')](_0x18ee('0x12'),_0x116567,_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);return _0x470d5a(_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);}else{logger['info'](_0x18ee('0x12'),_0x116567,_0x18ee('0x13'));_0x470d5a(_0x4dcbd4[_0x18ee('0x1a')][_0x18ee('0x19')]);}})[_0x18ee('0x1b')](function(_0x4c5d28){logger[_0x18ee('0x17')](_0x18ee('0x12'),_0x116567,_0x4c5d28);_0x4b9eb1(_0x4c5d28);});});}exports['UpdateChatInteraction']=function(_0x1f2cbf){var _0x3e30eb=this;return new Promise(function(_0xf066ce,_0x5962e6){return db['ChatInteraction']['update'](_0x1f2cbf[_0x18ee('0x1c')],{'raw':_0x1f2cbf['options']?_0x1f2cbf[_0x18ee('0x1d')][_0x18ee('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2cbf[_0x18ee('0x1d')]?_0x1f2cbf['options'][_0x18ee('0x1f')]||null:null,'attributes':_0x1f2cbf['options']?_0x1f2cbf['options'][_0x18ee('0x20')]||null:null,'limit':_0x1f2cbf[_0x18ee('0x1d')]?_0x1f2cbf[_0x18ee('0x1d')][_0x18ee('0x21')]||null:null})['then'](function(_0x492c5b){logger['info'](_0x18ee('0x22'),_0x1f2cbf);logger[_0x18ee('0x14')](_0x18ee('0x22'),_0x1f2cbf,JSON['stringify'](_0x492c5b));_0xf066ce(_0x492c5b);})['catch'](function(_0x2d4523){logger['error'](_0x18ee('0x22'),_0x2d4523[_0x18ee('0x19')],_0x1f2cbf);_0x5962e6(_0x3e30eb[_0x18ee('0x17')](0x1f4,_0x2d4523['message']));});});};exports['AddTagsToChatInteraction']=function(_0x56b1db){return new Promise(function(_0x10016e,_0x7029e7){return db[_0x18ee('0x23')][_0x18ee('0x24')]({'where':_0x56b1db[_0x18ee('0x1d')]?_0x56b1db[_0x18ee('0x1d')]['where']||null:null})[_0x18ee('0x10')](function(_0x26e12f){if(_0x26e12f){return _0x26e12f[_0x18ee('0x25')](_0x56b1db['body'][_0x18ee('0x26')],_[_0x18ee('0x27')](_0x56b1db[_0x18ee('0x1c')],[_0x18ee('0x26'),'id'])||{});}})[_0x18ee('0x28')](function(_0x54e53e){logger[_0x18ee('0x11')](_0x18ee('0x29'),_0x56b1db);logger[_0x18ee('0x14')](_0x18ee('0x29'),_0x56b1db,JSON[_0x18ee('0x16')](_0x54e53e));_0x10016e(_0x54e53e);})[_0x18ee('0x1b')](function(_0x48429f){logger[_0x18ee('0x17')](_0x18ee('0x29'),_0x48429f[_0x18ee('0x19')],_0x56b1db);_0x7029e7(_this[_0x18ee('0x17')](0x1f4,_0x48429f[_0x18ee('0x19')]));});});}; \ No newline at end of file +var _0x4f4b=['options','raw','where','attributes','limit','AddTagsToChatInteraction','find','ids','omit','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body'];(function(_0xc941ea,_0x408c2e){var _0x3b0f27=function(_0x5a4233){while(--_0x5a4233){_0xc941ea['push'](_0xc941ea['shift']());}};_0x3b0f27(++_0x408c2e);}(_0x4f4b,0xf5));var _0xb4f4=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x4f4b[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require('lodash');var util=require(_0xb4f4('0x0'));var moment=require(_0xb4f4('0x1'));var BPromise=require(_0xb4f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4f4('0x4'))('rpc');var config=require(_0xb4f4('0x5'));var jayson=require(_0xb4f4('0x6'));var client=jayson[_0xb4f4('0x7')][_0xb4f4('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb4f4('0x9')],{'host':_0xb4f4('0xa'),'port':0x18eb});var socket=require(_0xb4f4('0xb'))(new Redis(config[_0xb4f4('0x9')]));require('./chatInteraction.socket')[_0xb4f4('0xc')](socket);function respondWithRpcPromise(_0xa9845f,_0x3fe26e,_0x25e526){return new BPromise(function(_0x2ef369,_0x242ae5){return client['request'](_0xa9845f,_0x25e526)[_0xb4f4('0xd')](function(_0x40ca2b){logger['info'](_0xb4f4('0xe'),_0x3fe26e,'request\x20sent');logger[_0xb4f4('0xf')](_0xb4f4('0x10'),_0x3fe26e,_0xb4f4('0x11'),JSON[_0xb4f4('0x12')](_0x40ca2b));if(_0x40ca2b['error']){if(_0x40ca2b[_0xb4f4('0x13')]['code']===0x1f4){logger[_0xb4f4('0x13')](_0xb4f4('0xe'),_0x3fe26e,_0x40ca2b['error'][_0xb4f4('0x14')]);return _0x242ae5(_0x40ca2b[_0xb4f4('0x13')][_0xb4f4('0x14')]);}logger[_0xb4f4('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x3fe26e,_0x40ca2b[_0xb4f4('0x13')][_0xb4f4('0x14')]);return _0x2ef369(_0x40ca2b[_0xb4f4('0x13')][_0xb4f4('0x14')]);}else{logger[_0xb4f4('0x15')](_0xb4f4('0xe'),_0x3fe26e,_0xb4f4('0x11'));_0x2ef369(_0x40ca2b[_0xb4f4('0x16')][_0xb4f4('0x14')]);}})[_0xb4f4('0x17')](function(_0x3ce668){logger[_0xb4f4('0x13')](_0xb4f4('0xe'),_0x3fe26e,_0x3ce668);_0x242ae5(_0x3ce668);});});}exports[_0xb4f4('0x18')]=function(_0x3fe747){var _0x529117=this;return new Promise(function(_0x196915,_0x5dd6a7){return db[_0xb4f4('0x19')][_0xb4f4('0x1a')](_0x3fe747[_0xb4f4('0x1b')],{'raw':_0x3fe747[_0xb4f4('0x1c')]?_0x3fe747[_0xb4f4('0x1c')][_0xb4f4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fe747[_0xb4f4('0x1c')]?_0x3fe747[_0xb4f4('0x1c')][_0xb4f4('0x1e')]||null:null,'attributes':_0x3fe747['options']?_0x3fe747[_0xb4f4('0x1c')][_0xb4f4('0x1f')]||null:null,'limit':_0x3fe747[_0xb4f4('0x1c')]?_0x3fe747[_0xb4f4('0x1c')][_0xb4f4('0x20')]||null:null})[_0xb4f4('0xd')](function(_0x1a8cbb){logger[_0xb4f4('0x15')]('UpdateChatInteraction',_0x3fe747);logger[_0xb4f4('0xf')](_0xb4f4('0x18'),_0x3fe747,JSON[_0xb4f4('0x12')](_0x1a8cbb));_0x196915(_0x1a8cbb);})[_0xb4f4('0x17')](function(_0x4db087){logger[_0xb4f4('0x13')](_0xb4f4('0x18'),_0x4db087[_0xb4f4('0x14')],_0x3fe747);_0x5dd6a7(_0x529117[_0xb4f4('0x13')](0x1f4,_0x4db087['message']));});});};exports[_0xb4f4('0x21')]=function(_0x436876){return new Promise(function(_0xb24f17,_0x55b054){return db[_0xb4f4('0x19')][_0xb4f4('0x22')]({'where':_0x436876['options']?_0x436876['options'][_0xb4f4('0x1e')]||null:null})[_0xb4f4('0xd')](function(_0x24ee51){if(_0x24ee51){return _0x24ee51['addTags'](_0x436876['body'][_0xb4f4('0x23')],_[_0xb4f4('0x24')](_0x436876[_0xb4f4('0x1b')],['ids','id'])||{});}})[_0xb4f4('0x25')](function(_0x2dbea0){logger[_0xb4f4('0x15')]('AddTags',_0x436876);logger[_0xb4f4('0xf')](_0xb4f4('0x26'),_0x436876,JSON[_0xb4f4('0x12')](_0x2dbea0));_0xb24f17(_0x2dbea0);})[_0xb4f4('0x17')](function(_0x27f341){logger[_0xb4f4('0x13')](_0xb4f4('0x26'),_0x27f341[_0xb4f4('0x14')],_0x436876);_0x55b054(_this[_0xb4f4('0x13')](0x1f4,_0x27f341['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 331aa6d..9eaced8 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 _0x3aea=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x3aea,0x101));var _0xa3ae=function(_0x13f13f,_0x31328f){_0x13f13f=_0x13f13f-0x0;var _0x49858a=_0x3aea[_0x13f13f];return _0x49858a;};'use strict';var ChatInteractionEvents=require(_0xa3ae('0x0'));var events=[_0xa3ae('0x1'),_0xa3ae('0x2'),_0xa3ae('0x3')];function createListener(_0x14582a,_0x40e1fa){return function(_0x5043ef){_0x40e1fa[_0xa3ae('0x4')](_0x14582a,_0x5043ef);};}function removeListener(_0x3a4161,_0x10e0f3){return function(){ChatInteractionEvents[_0xa3ae('0x5')](_0x3a4161,_0x10e0f3);};}exports['register']=function(_0x177c3e){for(var _0x4f9ea6=0x0,_0x4393a6=events[_0xa3ae('0x6')];_0x4f9ea6<_0x4393a6;_0x4f9ea6++){var _0x3bcbd8=events[_0x4f9ea6];var _0x1d7180=createListener(_0xa3ae('0x7')+_0x3bcbd8,_0x177c3e);ChatInteractionEvents['on'](_0x3bcbd8,_0x1d7180);}}; \ No newline at end of file +var _0x5cc8=['save','removeListener','chatInteraction:','./chatInteraction.events'];(function(_0x20b20f,_0x1a52bc){var _0x27f90c=function(_0x481321){while(--_0x481321){_0x20b20f['push'](_0x20b20f['shift']());}};_0x27f90c(++_0x1a52bc);}(_0x5cc8,0x11f));var _0x85cc=function(_0x45de1d,_0x3bee30){_0x45de1d=_0x45de1d-0x0;var _0x8df294=_0x5cc8[_0x45de1d];return _0x8df294;};'use strict';var ChatInteractionEvents=require(_0x85cc('0x0'));var events=[_0x85cc('0x1'),'remove','update'];function createListener(_0x19ff7e,_0x2ebc06){return function(_0x14313d){_0x2ebc06['emit'](_0x19ff7e,_0x14313d);};}function removeListener(_0x3367cf,_0x2466ec){return function(){ChatInteractionEvents[_0x85cc('0x2')](_0x3367cf,_0x2466ec);};}exports['register']=function(_0x2f421d){for(var _0x3c2bf6=0x0,_0x2593c5=events['length'];_0x3c2bf6<_0x2593c5;_0x3c2bf6++){var _0x22d463=events[_0x3c2bf6];var _0x2c9c04=createListener(_0x85cc('0x3')+_0x22d463,_0x2f421d);ChatInteractionEvents['on'](_0x22d463,_0x2c9c04);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c8f6e98..586185c 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 _0xef0f=['destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags','addTags','/:id','tracked','chat','chatinteraction:update','update','customUpdate','put','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy'];(function(_0x533b9b,_0x1f4612){var _0x2a96e3=function(_0x1ade52){while(--_0x1ade52){_0x533b9b['push'](_0x533b9b['shift']());}};_0x2a96e3(++_0x1f4612);}(_0xef0f,0x168));var _0xfef0=function(_0x3174a9,_0x19494b){_0x3174a9=_0x3174a9-0x0;var _0x22664a=_0xef0f[_0x3174a9];return _0x22664a;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var auth=require(_0xfef0('0x4'));var interaction=require(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var controller=require('./chatInteraction.controller');router[_0xfef0('0x7')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x9')]);router[_0xfef0('0x7')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller['describe']);router[_0xfef0('0x7')]('/:id',auth[_0xfef0('0xb')](),controller[_0xfef0('0xc')]);router[_0xfef0('0x7')](_0xfef0('0xd'),auth[_0xfef0('0xb')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x7')](_0xfef0('0xf'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x7')](_0xfef0('0x11'),auth[_0xfef0('0xb')](),controller[_0xfef0('0x12')]);router['get'](_0xfef0('0x13'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x14')]);router[_0xfef0('0x15')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x16')]);router[_0xfef0('0x15')]('/:id/vidaoo',auth[_0xfef0('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5acdd0,_0x118b8d,_0x284b6d){_0x284b6d(null,path[_0xfef0('0x17')](config[_0xfef0('0x18')],_0xfef0('0x19')));},'filename':function(_0x3f9a6c,_0x155833,_0x2887e6){_0x2887e6(null,util['format'](_0xfef0('0x1a'),Date[_0xfef0('0x1b')](),_0x155833[_0xfef0('0x1c')][_0xfef0('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfef0('0x15')]('/:id/attachment_upload',upload[_0xfef0('0x1e')]('file'),controller[_0xfef0('0x1f')]);router[_0xfef0('0x15')](_0xfef0('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xfef0('0x20')]);router['post'](_0xfef0('0x21'),auth[_0xfef0('0x8')](),interaction['tracked']('chat','chatinteraction:addtags'),controller[_0xfef0('0x22')]);router['put'](_0xfef0('0x23'),auth[_0xfef0('0x8')](),interaction[_0xfef0('0x24')](_0xfef0('0x25'),_0xfef0('0x26')),controller[_0xfef0('0x27')]);router['put']('/:id/custom_update',controller[_0xfef0('0x28')]);router[_0xfef0('0x29')](_0xfef0('0x2a'),auth[_0xfef0('0xb')](),controller[_0xfef0('0x2b')]);router[_0xfef0('0x29')](_0xfef0('0x2c'),controller[_0xfef0('0x2d')]);router[_0xfef0('0x2e')]('/:id',auth[_0xfef0('0x8')](),interaction[_0xfef0('0x24')](_0xfef0('0x25'),_0xfef0('0x2f')),controller[_0xfef0('0x30')]);router[_0xfef0('0x2e')](_0xfef0('0x21'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x31')]);module[_0xfef0('0x32')]=router; \ No newline at end of file +var _0xa486=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','customUpdate','/:id/abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','express'];(function(_0xde2f8c,_0xbb9408){var _0x3ee25c=function(_0x3ad9d5){while(--_0x3ad9d5){_0xde2f8c['push'](_0xde2f8c['shift']());}};_0x3ee25c(++_0xbb9408);}(_0xa486,0x17d));var _0x6a48=function(_0x289995,_0x344805){_0x289995=_0x289995-0x0;var _0x50c5ce=_0xa486[_0x289995];return _0x50c5ce;};'use strict';var multer=require(_0x6a48('0x0'));var util=require('util');var path=require(_0x6a48('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a48('0x2'));var router=express['Router']();var auth=require(_0x6a48('0x3'));var interaction=require(_0x6a48('0x4'));var config=require(_0x6a48('0x5'));var controller=require(_0x6a48('0x6'));router[_0x6a48('0x7')]('/',auth[_0x6a48('0x8')](),controller[_0x6a48('0x9')]);router[_0x6a48('0x7')](_0x6a48('0xa'),auth[_0x6a48('0x8')](),controller[_0x6a48('0xb')]);router[_0x6a48('0x7')](_0x6a48('0xc'),auth[_0x6a48('0xd')](),controller[_0x6a48('0xe')]);router[_0x6a48('0x7')]('/:id/attachment_download',auth[_0x6a48('0xd')](),controller['attachmentDownload']);router[_0x6a48('0x7')](_0x6a48('0xf'),auth[_0x6a48('0x8')](),controller[_0x6a48('0x10')]);router[_0x6a48('0x7')](_0x6a48('0x11'),auth[_0x6a48('0xd')](),controller[_0x6a48('0x12')]);router[_0x6a48('0x7')](_0x6a48('0x13'),auth[_0x6a48('0x8')](),controller[_0x6a48('0x14')]);router[_0x6a48('0x15')]('/',auth[_0x6a48('0x8')](),controller[_0x6a48('0x16')]);router[_0x6a48('0x15')](_0x6a48('0x17'),auth[_0x6a48('0x8')](),controller[_0x6a48('0x18')]);var upload=multer({'storage':multer[_0x6a48('0x19')]({'destination':function(_0x3315c1,_0x10867e,_0x231930){_0x231930(null,path[_0x6a48('0x1a')](config[_0x6a48('0x1b')],_0x6a48('0x1c')));},'filename':function(_0x41218a,_0x20cab5,_0x506bd2){_0x506bd2(null,util[_0x6a48('0x1d')](_0x6a48('0x1e'),Date[_0x6a48('0x1f')](),_0x20cab5[_0x6a48('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6a48('0x15')](_0x6a48('0x21'),upload[_0x6a48('0x22')]('file'),controller[_0x6a48('0x23')]);router[_0x6a48('0x15')](_0x6a48('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x6a48('0x24')]);router[_0x6a48('0x15')](_0x6a48('0x25'),auth[_0x6a48('0x8')](),interaction['tracked'](_0x6a48('0x26'),_0x6a48('0x27')),controller['addTags']);router['put'](_0x6a48('0xc'),auth[_0x6a48('0x8')](),interaction['tracked'](_0x6a48('0x26'),'chatinteraction:update'),controller['update']);router['put']('/:id/custom_update',controller[_0x6a48('0x28')]);router['put'](_0x6a48('0x29'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put']('/:id/close',controller[_0x6a48('0x2a')]);router[_0x6a48('0x2b')](_0x6a48('0xc'),auth[_0x6a48('0x8')](),interaction['tracked'](_0x6a48('0x26'),_0x6a48('0x2c')),controller[_0x6a48('0x2d')]);router[_0x6a48('0x2b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6a48('0x2e')]);module[_0x6a48('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 124af82..19fb50b 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x6ebfd,_0x2fcad1){var _0x2df645=function(_0x536ee8){while(--_0x536ee8){_0x6ebfd['push'](_0x6ebfd['shift']());}};_0x2df645(++_0x2fcad1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file +var _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x1a85,0x178));var _0x51a8=function(_0x5c23cc,_0x3bac85){_0x5c23cc=_0x5c23cc-0x0;var _0x1add2d=_0x1a85[_0x5c23cc];return _0x1add2d;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 15efb32..9087667 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 _0x0afb=['isEmpty','agent','resourceId','push','createdAt','ToId','read','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource'];(function(_0x20d571,_0x1f5ab2){var _0x323885=function(_0x5b8c5b){while(--_0x5b8c5b){_0x20d571['push'](_0x20d571['shift']());}};_0x323885(++_0x1f5ab2);}(_0x0afb,0x155));var _0xb0af=function(_0x4b3a79,_0x4abb5b){_0x4b3a79=_0x4b3a79-0x0;var _0x1a1756=_0x0afb[_0x4b3a79];return _0x1a1756;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb0af('0x0'));var zipdir=require(_0xb0af('0x1'));var jsonpatch=require(_0xb0af('0x2'));var rp=require(_0xb0af('0x3'));var moment=require(_0xb0af('0x4'));var BPromise=require(_0xb0af('0x5'));var Mustache=require(_0xb0af('0x6'));var util=require('util');var path=require(_0xb0af('0x7'));var sox=require(_0xb0af('0x8'));var csv=require(_0xb0af('0x9'));var ejs=require(_0xb0af('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb0af('0xb'));var jsforce=require(_0xb0af('0xc'));var deskjs=require(_0xb0af('0xd'));var toCsv=require(_0xb0af('0x9'));var querystring=require(_0xb0af('0xe'));var Papa=require(_0xb0af('0xf'));var Redis=require('ioredis');var authService=require(_0xb0af('0x10'));var qs=require(_0xb0af('0x11'));var as=require(_0xb0af('0x12'));var hardwareService=require(_0xb0af('0x13'));var logger=require('../../config/logger')(_0xb0af('0x14'));var utils=require('../../config/utils');var config=require(_0xb0af('0x15'));var db=require('../../mysqldb')['db'];config[_0xb0af('0x16')]=_[_0xb0af('0x17')](config[_0xb0af('0x16')],{'host':_0xb0af('0x18'),'port':0x18eb});var socket=require(_0xb0af('0x19'))(new Redis(config[_0xb0af('0x16')]));require('./chatInternalMessage.socket')[_0xb0af('0x1a')](socket);function respondWithStatusCode(_0x392ac7,_0x5986e0){_0x5986e0=_0x5986e0||0xcc;return function(_0xcadb33){if(_0xcadb33){return _0x392ac7[_0xb0af('0x1b')](_0x5986e0);}return _0x392ac7[_0xb0af('0x1c')](_0x5986e0)[_0xb0af('0x1d')]();};}function respondWithResult(_0x443954,_0x3f5177){_0x3f5177=_0x3f5177||0xc8;return function(_0x4cdcb8){if(_0x4cdcb8){return _0x443954[_0xb0af('0x1c')](_0x3f5177)[_0xb0af('0x1e')](_0x4cdcb8);}};}function respondWithFilteredResult(_0x2b869e,_0x51d266){return function(_0x335b6d){if(_0x335b6d){var _0x48c4e0=_0x335b6d['count'],_0x1cd808=_0x51d266[_0xb0af('0x1f')],_0x55a959=_0x51d266['offset']+_0x51d266[_0xb0af('0x20')],_0x5a69f9;if(_0x55a959>=_0x48c4e0){_0x55a959=_0x48c4e0;_0x5a69f9=0xc8;}else{_0x5a69f9=0xce;}_0x2b869e[_0xb0af('0x1c')](_0x5a69f9);return _0x2b869e[_0xb0af('0x21')](_0xb0af('0x22'),_0x1cd808+'-'+_0x55a959+'/'+_0x48c4e0)['json'](_0x335b6d);}return null;};}function patchUpdates(_0x416be7){return function(_0x32614d){try{jsonpatch[_0xb0af('0x23')](_0x32614d,_0x416be7,!![]);}catch(_0x4f2368){return BPromise['reject'](_0x4f2368);}return _0x32614d[_0xb0af('0x24')]();};}function saveUpdates(_0x1bf522,_0x650ba0){return function(_0x53d13d){if(_0x53d13d){return _0x53d13d[_0xb0af('0x25')](_0x1bf522)['then'](function(_0x1f600c){return _0x1f600c;});}return null;};}function removeEntity(_0xb95974,_0x258339){return function(_0x535b0f){if(_0x535b0f){return _0x535b0f[_0xb0af('0x26')]()[_0xb0af('0x27')](function(){_0xb95974[_0xb0af('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f47c8,_0x982182){return function(_0xfa2ccd){if(!_0xfa2ccd){_0x4f47c8[_0xb0af('0x1b')](0x194);}return _0xfa2ccd;};}function handleError(_0x2fa1ab,_0x305188){_0x305188=_0x305188||0x1f4;return function(_0x352e16){logger[_0xb0af('0x28')](_0x352e16[_0xb0af('0x29')]);if(_0x352e16[_0xb0af('0x2a')]){delete _0x352e16[_0xb0af('0x2a')];}_0x2fa1ab[_0xb0af('0x1c')](_0x305188)[_0xb0af('0x2b')](_0x352e16);};}exports['index']=function(_0x8f2d19,_0x496a3e){var _0x50394c={},_0x12bf92={},_0x2e5119={'count':0x0,'rows':[]};var _0x3de69b=_[_0xb0af('0x2c')](db[_0xb0af('0x2d')][_0xb0af('0x2e')],function(_0x2c2d98){return{'name':_0x2c2d98[_0xb0af('0x2f')],'type':_0x2c2d98[_0xb0af('0x30')][_0xb0af('0x31')]};});_0x12bf92[_0xb0af('0x32')]=_[_0xb0af('0x2c')](_0x3de69b,'name');_0x12bf92['query']=_[_0xb0af('0x33')](_0x8f2d19[_0xb0af('0x34')]);_0x12bf92[_0xb0af('0x35')]=_[_0xb0af('0x36')](_0x12bf92['model'],_0x12bf92[_0xb0af('0x34')]);_0x50394c[_0xb0af('0x37')]=_[_0xb0af('0x36')](_0x12bf92[_0xb0af('0x32')],qs[_0xb0af('0x38')](_0x8f2d19[_0xb0af('0x34')]['fields']));_0x50394c[_0xb0af('0x37')]=_0x50394c[_0xb0af('0x37')][_0xb0af('0x39')]?_0x50394c['attributes']:_0x12bf92[_0xb0af('0x32')];if(!_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x3a')](_0xb0af('0x3b'))){_0x50394c[_0xb0af('0x20')]=qs[_0xb0af('0x20')](_0x8f2d19[_0xb0af('0x34')]['limit']);_0x50394c[_0xb0af('0x1f')]=qs[_0xb0af('0x1f')](_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x1f')]);}_0x50394c[_0xb0af('0x3c')]=qs[_0xb0af('0x3d')](_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x3d')]);_0x50394c[_0xb0af('0x3e')]=qs['filters'](_[_0xb0af('0x3f')](_0x8f2d19['query'],_0x12bf92['filters']),_0x3de69b);if(_0x8f2d19['query'][_0xb0af('0x40')]){_0x50394c[_0xb0af('0x3e')]=_[_0xb0af('0x41')](_0x50394c['where'],{'$or':_[_0xb0af('0x2c')](_0x3de69b,function(_0x39c0d0){if(_0x39c0d0[_0xb0af('0x30')]!==_0xb0af('0x42')){var _0xaf3b2a={};_0xaf3b2a[_0x39c0d0[_0xb0af('0x2a')]]={'$like':'%'+_0x8f2d19[_0xb0af('0x34')]['filter']+'%'};return _0xaf3b2a;}})});}_0x50394c=_['merge']({},_0x50394c,_0x8f2d19[_0xb0af('0x43')]);var _0x2f0ac0={'where':_0x50394c[_0xb0af('0x3e')]};return db['ChatInternalMessage']['count'](_0x2f0ac0)[_0xb0af('0x27')](function(_0x3ead43){_0x2e5119[_0xb0af('0x44')]=_0x3ead43;if(_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x45')]){_0x50394c[_0xb0af('0x46')]=[{'all':!![]}];}return db[_0xb0af('0x2d')][_0xb0af('0x47')](_0x50394c);})[_0xb0af('0x27')](function(_0x1b0744){_0x2e5119[_0xb0af('0x48')]=_0x1b0744;return _0x2e5119;})['then'](respondWithFilteredResult(_0x496a3e,_0x50394c))[_0xb0af('0x49')](handleError(_0x496a3e,null));};exports['show']=function(_0x34d99c,_0x338ded){var _0x22faff={'raw':!![],'where':{'id':_0x34d99c[_0xb0af('0x4a')]['id']}},_0x4ebefa={};_0x4ebefa[_0xb0af('0x32')]=_[_0xb0af('0x33')](db[_0xb0af('0x2d')][_0xb0af('0x2e')]);_0x4ebefa[_0xb0af('0x34')]=_['keys'](_0x34d99c['query']);_0x4ebefa['filters']=_[_0xb0af('0x36')](_0x4ebefa['model'],_0x4ebefa[_0xb0af('0x34')]);_0x22faff['attributes']=_['intersection'](_0x4ebefa[_0xb0af('0x32')],qs['fields'](_0x34d99c['query'][_0xb0af('0x38')]));_0x22faff[_0xb0af('0x37')]=_0x22faff[_0xb0af('0x37')][_0xb0af('0x39')]?_0x22faff['attributes']:_0x4ebefa['model'];if(_0x34d99c['query']['includeAll']){_0x22faff[_0xb0af('0x46')]=[{'all':!![]}];}_0x22faff=_[_0xb0af('0x41')]({},_0x22faff,_0x34d99c[_0xb0af('0x43')]);return db[_0xb0af('0x2d')][_0xb0af('0x4b')](_0x22faff)[_0xb0af('0x27')](handleEntityNotFound(_0x338ded,null))[_0xb0af('0x27')](respondWithResult(_0x338ded,null))[_0xb0af('0x49')](handleError(_0x338ded,null));};exports[_0xb0af('0x4c')]=function(_0x268141,_0x155f77){return db['ChatInternalMessage'][_0xb0af('0x4c')](_0x268141[_0xb0af('0x4d')],{})['then'](respondWithResult(_0x155f77,0xc9))[_0xb0af('0x49')](handleError(_0x155f77,null));};exports[_0xb0af('0x25')]=function(_0x5434cb,_0x55efd7){if(_0x5434cb['body']['id']){delete _0x5434cb[_0xb0af('0x4d')]['id'];}return db[_0xb0af('0x2d')][_0xb0af('0x4b')]({'where':{'id':_0x5434cb[_0xb0af('0x4a')]['id']}})[_0xb0af('0x27')](handleEntityNotFound(_0x55efd7,null))['then'](saveUpdates(_0x5434cb[_0xb0af('0x4d')],null))[_0xb0af('0x27')](respondWithResult(_0x55efd7,null))[_0xb0af('0x49')](handleError(_0x55efd7,null));};exports[_0xb0af('0x26')]=function(_0x33b16e,_0x102f9f){return db['ChatInternalMessage'][_0xb0af('0x4b')]({'where':{'id':_0x33b16e[_0xb0af('0x4a')]['id']}})[_0xb0af('0x27')](handleEntityNotFound(_0x102f9f,null))[_0xb0af('0x27')](removeEntity(_0x102f9f,null))['catch'](handleError(_0x102f9f,null));};exports[_0xb0af('0x4e')]=function(_0xfb1a28,_0x429b14){return db[_0xb0af('0x2d')]['describe']()[_0xb0af('0x27')](respondWithResult(_0x429b14,null))[_0xb0af('0x49')](handleError(_0x429b14,null));};function wrapUser(_0x5e7e8f){return function(_0x5e245a){var _0x39f52f=_0x5e7e8f[_0xb0af('0x4f')]({'plain':!![]});_0x39f52f['messages']=[];if(_0x5e245a){_0x39f52f[_0xb0af('0x50')]=_0x5e245a['createdAt'];_0x39f52f[_0xb0af('0x51')]=_0x5e245a;}else{_0x39f52f[_0xb0af('0x50')]=moment(0x0)[_0xb0af('0x52')](_0xb0af('0x53'));_0x39f52f[_0xb0af('0x51')]={};}return _0x39f52f;};}exports[_0xb0af('0x54')]=function(_0x2becf3,_0x570fe7,_0x14b05b){var _0x5d8317=[];return db[_0xb0af('0x55')][_0xb0af('0x47')]({'where':{'role':['agent',_0xb0af('0x56'),_0xb0af('0x57')]},'attributes':['id',_0xb0af('0x58'),_0xb0af('0x2a'),_0xb0af('0x59'),_0xb0af('0x5a'),_0xb0af('0x5b'),_0xb0af('0x5c'),_0xb0af('0x5d'),_0xb0af('0x5e'),'showWebBar'],'order':qs[_0xb0af('0x3d')](_0xb0af('0x5f')),'include':[{'model':db[_0xb0af('0x60')],'as':_0xb0af('0x61'),'attributes':['id',_0xb0af('0x2a'),_0xb0af('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x5d8579){if(_0x5d8579){var _0x1bc9a3=_0x2becf3[_0xb0af('0x57')][_0xb0af('0x4f')]({'plain':!![]});if(!_0x1bc9a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bc9a3[_0xb0af('0x59')]===_0xb0af('0x57')){return db[_0xb0af('0x62')][_0xb0af('0x4b')]({'where':{'name':_0xb0af('0x63'),'userProfileId':_0x1bc9a3[_0xb0af('0x64')]},'raw':!![]})[_0xb0af('0x27')](function(_0x47216e){if(_0x47216e){if(_0x47216e[_0xb0af('0x65')]===0x0){return db[_0xb0af('0x66')][_0xb0af('0x47')]({'where':{'sectionId':_0x47216e['id']},'raw':!![]})[_0xb0af('0x27')](function(_0x292832){var _0x148fa9=[];if(_[_0xb0af('0x67')](_0x292832)){_0x148fa9=_[_0xb0af('0x40')](_0x5d8579,function(_0x4c87ca){if(_0x4c87ca['role']!==_0xb0af('0x68')){return _0x4c87ca;}});return _0x148fa9;}else{for(var _0x3d9f18=0x0;_0x3d9f18<_0x5d8579[_0xb0af('0x39')];_0x3d9f18++){var _0x56b79f=_0x5d8579[_0x3d9f18];if(_0x56b79f[_0xb0af('0x59')]===_0xb0af('0x68')){var _0x2f9a16=_[_0xb0af('0x4b')](_0x292832,function(_0x328cd4){return _0x328cd4[_0xb0af('0x69')]===_0x56b79f['id'];});if(_0x2f9a16)_0x148fa9[_0xb0af('0x6a')](_0x56b79f);}else{_0x148fa9[_0xb0af('0x6a')](_0x56b79f);}}return _0x148fa9;}});}else{return _0x5d8579;}}else{var _0x573997=_[_0xb0af('0x40')](_0x5d8579,function(_0x1fc3df){if(_0x1fc3df[_0xb0af('0x59')]!=='agent'){return _0x1fc3df;}});return _0x573997;}});}else{return _0x5d8579;}}})[_0xb0af('0x27')](function(_0x41a06f){var _0x358d0f=[];if(_0x41a06f){_0x5d8317=_0x41a06f;for(var _0x260a58=0x0;_0x260a58<_0x41a06f['length'];_0x260a58+=0x1){_0x5d8317[_0x260a58]['messages']=[];_0x358d0f['push'](db['ChatInternalMessage'][_0xb0af('0x4b')]({'where':{'FromId':[_0x2becf3['user']['id'],_0x41a06f[_0x260a58]['id']],'ToId':[_0x2becf3['user']['id'],_0x41a06f[_0x260a58]['id']],'ChatGroupId':null},'attributes':['id',_0xb0af('0x6b'),'FromId',_0xb0af('0x6c'),_0xb0af('0x6d'),_0xb0af('0x4d')],'order':qs[_0xb0af('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb0af('0x27')](wrapUser(_0x41a06f[_0x260a58])));}return BPromise[_0xb0af('0x6e')](_0x358d0f);}return[];})[_0xb0af('0x27')](function(_0x2ad91c){return{'rows':_0x2ad91c,'count':_0x2ad91c[_0xb0af('0x39')]};})[_0xb0af('0x27')](respondWithResult(_0x570fe7,null))[_0xb0af('0x49')](handleError(_0x570fe7,null));}; \ No newline at end of file +var _0xe78f=['where','VIRTUAL','merge','options','ChatInternalMessage','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','get','messages','createdAt','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','role','userpic','online','lastLoginAt','allowmessenger','-online','VoiceQueue','UserProfileSection','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','pick','filter'];(function(_0x403509,_0x113905){var _0x38711a=function(_0x3e96e6){while(--_0x3e96e6){_0x403509['push'](_0x403509['shift']());}};_0x38711a(++_0x113905);}(_0xe78f,0x15f));var _0xfe78=function(_0x1a5266,_0x30ac46){_0x1a5266=_0x1a5266-0x0;var _0x139a98=_0xe78f[_0x1a5266];return _0x139a98;};'use strict';var pdf=require(_0xfe78('0x0'));var emlformat=require(_0xfe78('0x1'));var rimraf=require(_0xfe78('0x2'));var zipdir=require(_0xfe78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe78('0x4'));var moment=require(_0xfe78('0x5'));var BPromise=require(_0xfe78('0x6'));var Mustache=require(_0xfe78('0x7'));var util=require('util');var path=require(_0xfe78('0x8'));var sox=require(_0xfe78('0x9'));var csv=require(_0xfe78('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe78('0xb'));var squel=require(_0xfe78('0xc'));var crypto=require(_0xfe78('0xd'));var jsforce=require(_0xfe78('0xe'));var deskjs=require(_0xfe78('0xf'));var toCsv=require(_0xfe78('0xa'));var querystring=require(_0xfe78('0x10'));var Papa=require(_0xfe78('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfe78('0x12'));var as=require(_0xfe78('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe78('0x14'))(_0xfe78('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xfe78('0x16')],{'host':_0xfe78('0x17'),'port':0x18eb});var socket=require(_0xfe78('0x18'))(new Redis(config[_0xfe78('0x16')]));require(_0xfe78('0x19'))['register'](socket);function respondWithStatusCode(_0x4a8b15,_0x5b4477){_0x5b4477=_0x5b4477||0xcc;return function(_0x2524b0){if(_0x2524b0){return _0x4a8b15['sendStatus'](_0x5b4477);}return _0x4a8b15[_0xfe78('0x1a')](_0x5b4477)['end']();};}function respondWithResult(_0x4aea2d,_0x1d83cd){_0x1d83cd=_0x1d83cd||0xc8;return function(_0x436999){if(_0x436999){return _0x4aea2d[_0xfe78('0x1a')](_0x1d83cd)[_0xfe78('0x1b')](_0x436999);}};}function respondWithFilteredResult(_0x5477bf,_0x58d07b){return function(_0x1fa9c9){if(_0x1fa9c9){var _0x176ca5=_0x1fa9c9[_0xfe78('0x1c')],_0x36a366=_0x58d07b[_0xfe78('0x1d')],_0x33e88e=_0x58d07b[_0xfe78('0x1d')]+_0x58d07b['limit'],_0x58ed73;if(_0x33e88e>=_0x176ca5){_0x33e88e=_0x176ca5;_0x58ed73=0xc8;}else{_0x58ed73=0xce;}_0x5477bf[_0xfe78('0x1a')](_0x58ed73);return _0x5477bf['set'](_0xfe78('0x1e'),_0x36a366+'-'+_0x33e88e+'/'+_0x176ca5)[_0xfe78('0x1b')](_0x1fa9c9);}return null;};}function patchUpdates(_0x405fae){return function(_0x1b006a){try{jsonpatch[_0xfe78('0x1f')](_0x1b006a,_0x405fae,!![]);}catch(_0x1b6735){return BPromise[_0xfe78('0x20')](_0x1b6735);}return _0x1b006a[_0xfe78('0x21')]();};}function saveUpdates(_0x13d780,_0x25fafb){return function(_0x3cb12a){if(_0x3cb12a){return _0x3cb12a['update'](_0x13d780)[_0xfe78('0x22')](function(_0x1513c3){return _0x1513c3;});}return null;};}function removeEntity(_0x3eca99,_0x5eea61){return function(_0x45f901){if(_0x45f901){return _0x45f901[_0xfe78('0x23')]()[_0xfe78('0x22')](function(){_0x3eca99[_0xfe78('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e443,_0x23ae1f){return function(_0x4779b7){if(!_0x4779b7){_0x14e443[_0xfe78('0x24')](0x194);}return _0x4779b7;};}function handleError(_0x940cb2,_0x686b8c){_0x686b8c=_0x686b8c||0x1f4;return function(_0x1c26fe){logger[_0xfe78('0x25')](_0x1c26fe[_0xfe78('0x26')]);if(_0x1c26fe['name']){delete _0x1c26fe[_0xfe78('0x27')];}_0x940cb2[_0xfe78('0x1a')](_0x686b8c)[_0xfe78('0x28')](_0x1c26fe);};}exports['index']=function(_0xdcba08,_0x870078){var _0x59d891={},_0x56cffd={},_0x17203c={'count':0x0,'rows':[]};var _0x484b5a=_[_0xfe78('0x29')](db['ChatInternalMessage'][_0xfe78('0x2a')],function(_0x2eb999){return{'name':_0x2eb999[_0xfe78('0x2b')],'type':_0x2eb999[_0xfe78('0x2c')]['key']};});_0x56cffd['model']=_[_0xfe78('0x29')](_0x484b5a,_0xfe78('0x27'));_0x56cffd[_0xfe78('0x2d')]=_['keys'](_0xdcba08[_0xfe78('0x2d')]);_0x56cffd[_0xfe78('0x2e')]=_[_0xfe78('0x2f')](_0x56cffd['model'],_0x56cffd[_0xfe78('0x2d')]);_0x59d891[_0xfe78('0x30')]=_['intersection'](_0x56cffd[_0xfe78('0x31')],qs['fields'](_0xdcba08[_0xfe78('0x2d')][_0xfe78('0x32')]));_0x59d891[_0xfe78('0x30')]=_0x59d891[_0xfe78('0x30')][_0xfe78('0x33')]?_0x59d891[_0xfe78('0x30')]:_0x56cffd[_0xfe78('0x31')];if(!_0xdcba08[_0xfe78('0x2d')]['hasOwnProperty'](_0xfe78('0x34'))){_0x59d891[_0xfe78('0x35')]=qs[_0xfe78('0x35')](_0xdcba08['query']['limit']);_0x59d891[_0xfe78('0x1d')]=qs[_0xfe78('0x1d')](_0xdcba08[_0xfe78('0x2d')][_0xfe78('0x1d')]);}_0x59d891['order']=qs['sort'](_0xdcba08['query'][_0xfe78('0x36')]);_0x59d891['where']=qs[_0xfe78('0x2e')](_[_0xfe78('0x37')](_0xdcba08[_0xfe78('0x2d')],_0x56cffd[_0xfe78('0x2e')]),_0x484b5a);if(_0xdcba08[_0xfe78('0x2d')][_0xfe78('0x38')]){_0x59d891['where']=_['merge'](_0x59d891[_0xfe78('0x39')],{'$or':_[_0xfe78('0x29')](_0x484b5a,function(_0x1b32f4){if(_0x1b32f4[_0xfe78('0x2c')]!==_0xfe78('0x3a')){var _0x3ca781={};_0x3ca781[_0x1b32f4[_0xfe78('0x27')]]={'$like':'%'+_0xdcba08[_0xfe78('0x2d')]['filter']+'%'};return _0x3ca781;}})});}_0x59d891=_[_0xfe78('0x3b')]({},_0x59d891,_0xdcba08[_0xfe78('0x3c')]);var _0x4ba781={'where':_0x59d891[_0xfe78('0x39')]};return db[_0xfe78('0x3d')][_0xfe78('0x1c')](_0x4ba781)[_0xfe78('0x22')](function(_0x5bc18e){_0x17203c[_0xfe78('0x1c')]=_0x5bc18e;if(_0xdcba08['query']['includeAll']){_0x59d891[_0xfe78('0x3e')]=[{'all':!![]}];}return db[_0xfe78('0x3d')][_0xfe78('0x3f')](_0x59d891);})['then'](function(_0x3e0a85){_0x17203c[_0xfe78('0x40')]=_0x3e0a85;return _0x17203c;})['then'](respondWithFilteredResult(_0x870078,_0x59d891))['catch'](handleError(_0x870078,null));};exports[_0xfe78('0x41')]=function(_0x3a2db0,_0x4aa36a){var _0x423215={'raw':!![],'where':{'id':_0x3a2db0[_0xfe78('0x42')]['id']}},_0x44ca06={};_0x44ca06[_0xfe78('0x31')]=_[_0xfe78('0x43')](db[_0xfe78('0x3d')][_0xfe78('0x2a')]);_0x44ca06['query']=_[_0xfe78('0x43')](_0x3a2db0['query']);_0x44ca06['filters']=_[_0xfe78('0x2f')](_0x44ca06[_0xfe78('0x31')],_0x44ca06[_0xfe78('0x2d')]);_0x423215[_0xfe78('0x30')]=_['intersection'](_0x44ca06[_0xfe78('0x31')],qs['fields'](_0x3a2db0['query'][_0xfe78('0x32')]));_0x423215[_0xfe78('0x30')]=_0x423215[_0xfe78('0x30')]['length']?_0x423215['attributes']:_0x44ca06[_0xfe78('0x31')];if(_0x3a2db0[_0xfe78('0x2d')][_0xfe78('0x44')]){_0x423215[_0xfe78('0x3e')]=[{'all':!![]}];}_0x423215=_['merge']({},_0x423215,_0x3a2db0['options']);return db[_0xfe78('0x3d')][_0xfe78('0x45')](_0x423215)['then'](handleEntityNotFound(_0x4aa36a,null))[_0xfe78('0x22')](respondWithResult(_0x4aa36a,null))[_0xfe78('0x46')](handleError(_0x4aa36a,null));};exports['create']=function(_0x17f937,_0x3daedc){return db[_0xfe78('0x3d')][_0xfe78('0x47')](_0x17f937[_0xfe78('0x48')],{})['then'](respondWithResult(_0x3daedc,0xc9))['catch'](handleError(_0x3daedc,null));};exports[_0xfe78('0x49')]=function(_0x3cdca8,_0x448b2d){if(_0x3cdca8['body']['id']){delete _0x3cdca8['body']['id'];}return db[_0xfe78('0x3d')][_0xfe78('0x45')]({'where':{'id':_0x3cdca8[_0xfe78('0x42')]['id']}})[_0xfe78('0x22')](handleEntityNotFound(_0x448b2d,null))[_0xfe78('0x22')](saveUpdates(_0x3cdca8['body'],null))['then'](respondWithResult(_0x448b2d,null))[_0xfe78('0x46')](handleError(_0x448b2d,null));};exports['destroy']=function(_0x3df663,_0x483592){return db[_0xfe78('0x3d')][_0xfe78('0x45')]({'where':{'id':_0x3df663[_0xfe78('0x42')]['id']}})[_0xfe78('0x22')](handleEntityNotFound(_0x483592,null))[_0xfe78('0x22')](removeEntity(_0x483592,null))[_0xfe78('0x46')](handleError(_0x483592,null));};exports[_0xfe78('0x4a')]=function(_0x3cafdf,_0x47e353){return db[_0xfe78('0x3d')][_0xfe78('0x4a')]()[_0xfe78('0x22')](respondWithResult(_0x47e353,null))[_0xfe78('0x46')](handleError(_0x47e353,null));};function wrapUser(_0x151a1f){return function(_0x1cb469){var _0x59ea86=_0x151a1f[_0xfe78('0x4b')]({'plain':!![]});_0x59ea86[_0xfe78('0x4c')]=[];if(_0x1cb469){_0x59ea86['lastMessageAt']=_0x1cb469[_0xfe78('0x4d')];_0x59ea86['lastMessage']=_0x1cb469;}else{_0x59ea86[_0xfe78('0x4e')]=moment(0x0)['format'](_0xfe78('0x4f'));_0x59ea86['lastMessage']={};}return _0x59ea86;};}exports['getUsers']=function(_0x25a119,_0x16706f,_0x37f2d0){var _0xe0f65f=[];return db[_0xfe78('0x50')][_0xfe78('0x3f')]({'where':{'role':[_0xfe78('0x51'),_0xfe78('0x52'),_0xfe78('0x53')]},'attributes':['id','fullname',_0xfe78('0x27'),_0xfe78('0x54'),_0xfe78('0x55'),'internal',_0xfe78('0x56'),_0xfe78('0x57'),_0xfe78('0x58'),'showWebBar'],'order':qs[_0xfe78('0x36')](_0xfe78('0x59')),'include':[{'model':db[_0xfe78('0x5a')],'as':'VoiceQueues','attributes':['id',_0xfe78('0x27'),_0xfe78('0x2c')],'through':{'attributes':[]}}]})['then'](function(_0x323c3d){if(_0x323c3d){var _0x1d5058=_0x25a119[_0xfe78('0x53')][_0xfe78('0x4b')]({'plain':!![]});if(!_0x1d5058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d5058[_0xfe78('0x54')]===_0xfe78('0x53')){return db[_0xfe78('0x5b')][_0xfe78('0x45')]({'where':{'name':'Agents','userProfileId':_0x1d5058[_0xfe78('0x5c')]},'raw':!![]})[_0xfe78('0x22')](function(_0x48e9d5){if(_0x48e9d5){if(_0x48e9d5[_0xfe78('0x5d')]===0x0){return db['UserProfileResource'][_0xfe78('0x3f')]({'where':{'sectionId':_0x48e9d5['id']},'raw':!![]})[_0xfe78('0x22')](function(_0x965c50){var _0x80da5a=[];if(_[_0xfe78('0x5e')](_0x965c50)){_0x80da5a=_[_0xfe78('0x38')](_0x323c3d,function(_0x5cd777){if(_0x5cd777[_0xfe78('0x54')]!==_0xfe78('0x51')){return _0x5cd777;}});return _0x80da5a;}else{for(var _0x4bdd1e=0x0;_0x4bdd1e<_0x323c3d[_0xfe78('0x33')];_0x4bdd1e++){var _0x1df130=_0x323c3d[_0x4bdd1e];if(_0x1df130[_0xfe78('0x54')]===_0xfe78('0x51')){var _0x318d7a=_[_0xfe78('0x45')](_0x965c50,function(_0x438dd5){return _0x438dd5[_0xfe78('0x5f')]===_0x1df130['id'];});if(_0x318d7a)_0x80da5a[_0xfe78('0x60')](_0x1df130);}else{_0x80da5a[_0xfe78('0x60')](_0x1df130);}}return _0x80da5a;}});}else{return _0x323c3d;}}else{var _0x1a897c=_[_0xfe78('0x38')](_0x323c3d,function(_0x4ec7a2){if(_0x4ec7a2[_0xfe78('0x54')]!==_0xfe78('0x51')){return _0x4ec7a2;}});return _0x1a897c;}});}else{return _0x323c3d;}}})[_0xfe78('0x22')](function(_0xb85653){var _0x17d5fb=[];if(_0xb85653){_0xe0f65f=_0xb85653;for(var _0x320095=0x0;_0x320095<_0xb85653['length'];_0x320095+=0x1){_0xe0f65f[_0x320095][_0xfe78('0x4c')]=[];_0x17d5fb[_0xfe78('0x60')](db[_0xfe78('0x3d')]['find']({'where':{'FromId':[_0x25a119[_0xfe78('0x53')]['id'],_0xb85653[_0x320095]['id']],'ToId':[_0x25a119['user']['id'],_0xb85653[_0x320095]['id']],'ChatGroupId':null},'attributes':['id',_0xfe78('0x4d'),_0xfe78('0x61'),_0xfe78('0x62'),_0xfe78('0x63'),_0xfe78('0x48')],'order':qs[_0xfe78('0x36')](_0xfe78('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfe78('0x22')](wrapUser(_0xb85653[_0x320095])));}return BPromise[_0xfe78('0x65')](_0x17d5fb);}return[];})[_0xfe78('0x22')](function(_0x478286){return{'rows':_0x478286,'count':_0x478286[_0xfe78('0x33')]};})[_0xfe78('0x22')](respondWithResult(_0x16706f,null))['catch'](handleError(_0x16706f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 90d4a63..825ff32 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 _0xb1d3=['update','remove','emit','exports','events','save'];(function(_0x4a3077,_0x395129){var _0x220e7d=function(_0x3a1f18){while(--_0x3a1f18){_0x4a3077['push'](_0x4a3077['shift']());}};_0x220e7d(++_0x395129);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x2c6559,_0x3a3d99){_0x2c6559=_0x2c6559-0x0;var _0x1a0f7e=_0xb1d3[_0x2c6559];return _0x1a0f7e;};'use strict';var EventEmitter=require(_0x3b1d('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b1d('0x1'),'afterUpdate':_0x3b1d('0x2'),'afterDestroy':_0x3b1d('0x3')};function emitEvent(_0x22b67a){return function(_0x5b94ab,_0x18e301,_0x32cd1d){ChatInternalMessageEvents[_0x3b1d('0x4')](_0x22b67a+':'+_0x5b94ab['id'],_0x5b94ab);ChatInternalMessageEvents[_0x3b1d('0x4')](_0x22b67a,_0x5b94ab);_0x32cd1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3b1d('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xcee8=['hasOwnProperty','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit'];(function(_0x3e5325,_0x55af33){var _0x5a1c63=function(_0x545694){while(--_0x545694){_0x3e5325['push'](_0x3e5325['shift']());}};_0x5a1c63(++_0x55af33);}(_0xcee8,0xb1));var _0x8cee=function(_0x174c20,_0x474b2){_0x174c20=_0x174c20-0x0;var _0x5ecaec=_0xcee8[_0x174c20];return _0x5ecaec;};'use strict';var EventEmitter=require(_0x8cee('0x0'));var ChatInternalMessage=require(_0x8cee('0x1'))['db'][_0x8cee('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8cee('0x3')](0x0);var events={'afterCreate':_0x8cee('0x4'),'afterUpdate':_0x8cee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x127360){return function(_0x4e4143,_0xffd42d,_0x1ec415){ChatInternalMessageEvents['emit'](_0x127360+':'+_0x4e4143['id'],_0x4e4143);ChatInternalMessageEvents[_0x8cee('0x6')](_0x127360,_0x4e4143);_0x1ec415(null);};}for(var e in events){if(events[_0x8cee('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b4b11f5..48e53c5 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 _0x9a98=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x9a98,0xd0));var _0x89a9=function(_0x1fe4b4,_0x38b356){_0x1fe4b4=_0x1fe4b4-0x0;var _0x457c07=_0x9a98[_0x1fe4b4];return _0x457c07;};'use strict';var _=require('lodash');var util=require(_0x89a9('0x0'));var logger=require(_0x89a9('0x1'))('api');var moment=require(_0x89a9('0x2'));var BPromise=require(_0x89a9('0x3'));var rp=require(_0x89a9('0x4'));var fs=require('fs');var path=require(_0x89a9('0x5'));var rimraf=require(_0x89a9('0x6'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x89a9('0x7')]=function(_0x444db5,_0xa02b63){return _0x444db5['define'](_0x89a9('0x8'),attributes,{'tableName':_0x89a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x89a9('0xa')});}; \ No newline at end of file +var _0x4f49=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5eca25,_0x212aad){var _0x27040b=function(_0x3139a9){while(--_0x3139a9){_0x5eca25['push'](_0x5eca25['shift']());}};_0x27040b(++_0x212aad);}(_0x4f49,0x142));var _0x94f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4f49[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x94f4('0x0'));var util=require(_0x94f4('0x1'));var logger=require(_0x94f4('0x2'))(_0x94f4('0x3'));var moment=require(_0x94f4('0x4'));var BPromise=require(_0x94f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x94f4('0x6'));var config=require(_0x94f4('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x94f4('0x8')]=function(_0x1b7b0b,_0x20500c){return _0x1b7b0b[_0x94f4('0x9')](_0x94f4('0xa'),attributes,{'tableName':_0x94f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x94f4('0xc'),'collate':_0x94f4('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 49df19e..45be40d 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 _0x9400=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x12a5a7,_0x3f04d4){var _0x5e868e=function(_0x221c26){while(--_0x221c26){_0x12a5a7['push'](_0x12a5a7['shift']());}};_0x5e868e(++_0x3f04d4);}(_0x9400,0x7e));var _0x0940=function(_0x3e9b6a,_0x325018){_0x3e9b6a=_0x3e9b6a-0x0;var _0x5da136=_0x9400[_0x3e9b6a];return _0x5da136;};'use strict';var _=require(_0x0940('0x0'));var util=require(_0x0940('0x1'));var moment=require(_0x0940('0x2'));var BPromise=require('bluebird');var rs=require(_0x0940('0x3'));var fs=require('fs');var Redis=require(_0x0940('0x4'));var db=require(_0x0940('0x5'))['db'];var utils=require(_0x0940('0x6'));var logger=require(_0x0940('0x7'))(_0x0940('0x8'));var config=require(_0x0940('0x9'));var jayson=require(_0x0940('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0940('0xb')]=_[_0x0940('0xc')](config[_0x0940('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0940('0xd'))(new Redis(config[_0x0940('0xb')]));require(_0x0940('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a59a7,_0x1587be,_0x2a52e7){return new BPromise(function(_0x521202,_0x3dea85){return client['request'](_0x2a59a7,_0x2a52e7)[_0x0940('0xf')](function(_0x47242e){logger['info'](_0x0940('0x10'),_0x1587be,_0x0940('0x11'));logger[_0x0940('0x12')](_0x0940('0x13'),_0x1587be,_0x0940('0x11'),JSON[_0x0940('0x14')](_0x47242e));if(_0x47242e[_0x0940('0x15')]){if(_0x47242e[_0x0940('0x15')]['code']===0x1f4){logger[_0x0940('0x15')](_0x0940('0x10'),_0x1587be,_0x47242e[_0x0940('0x15')]['message']);return _0x3dea85(_0x47242e[_0x0940('0x15')]['message']);}logger[_0x0940('0x15')](_0x0940('0x10'),_0x1587be,_0x47242e['error']['message']);return _0x521202(_0x47242e[_0x0940('0x15')][_0x0940('0x16')]);}else{logger[_0x0940('0x17')](_0x0940('0x10'),_0x1587be,_0x0940('0x11'));_0x521202(_0x47242e[_0x0940('0x18')][_0x0940('0x16')]);}})[_0x0940('0x19')](function(_0x4e4edf){logger[_0x0940('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x1587be,_0x4e4edf);_0x3dea85(_0x4e4edf);});});} \ No newline at end of file +var _0x36c1=['request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter'];(function(_0x4a5488,_0x5868a9){var _0x538364=function(_0x2265b3){while(--_0x2265b3){_0x4a5488['push'](_0x4a5488['shift']());}};_0x538364(++_0x5868a9);}(_0x36c1,0x1e7));var _0x136c=function(_0x36f797,_0x351603){_0x36f797=_0x36f797-0x0;var _0x44ba30=_0x36c1[_0x36f797];return _0x44ba30;};'use strict';var _=require(_0x136c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x136c('0x1'));var rs=require(_0x136c('0x2'));var fs=require('fs');var Redis=require(_0x136c('0x3'));var db=require(_0x136c('0x4'))['db'];var utils=require(_0x136c('0x5'));var logger=require(_0x136c('0x6'))('rpc');var config=require(_0x136c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x136c('0x8')][_0x136c('0x9')]({'port':0x232a});config[_0x136c('0xa')]=_[_0x136c('0xb')](config[_0x136c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x136c('0xc'))(new Redis(config[_0x136c('0xa')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x48d85f,_0x2dabdd,_0x32468d){return new BPromise(function(_0x10fef2,_0x426881){return client[_0x136c('0xd')](_0x48d85f,_0x32468d)[_0x136c('0xe')](function(_0x5b5c6a){logger[_0x136c('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x2dabdd,_0x136c('0x10'));logger[_0x136c('0x11')](_0x136c('0x12'),_0x2dabdd,'request\x20sent',JSON[_0x136c('0x13')](_0x5b5c6a));if(_0x5b5c6a[_0x136c('0x14')]){if(_0x5b5c6a['error']['code']===0x1f4){logger[_0x136c('0x14')](_0x136c('0x15'),_0x2dabdd,_0x5b5c6a[_0x136c('0x14')][_0x136c('0x16')]);return _0x426881(_0x5b5c6a[_0x136c('0x14')][_0x136c('0x16')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x2dabdd,_0x5b5c6a[_0x136c('0x14')][_0x136c('0x16')]);return _0x10fef2(_0x5b5c6a[_0x136c('0x14')][_0x136c('0x16')]);}else{logger[_0x136c('0xf')](_0x136c('0x15'),_0x2dabdd,_0x136c('0x10'));_0x10fef2(_0x5b5c6a[_0x136c('0x17')]['message']);}})[_0x136c('0x18')](function(_0x3abd03){logger[_0x136c('0x14')](_0x136c('0x15'),_0x2dabdd,_0x3abd03);_0x426881(_0x3abd03);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 30d6552..b0e7c8f 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 _0x4853=['save','update','emit','length','chatInternalMessage:'];(function(_0x2f7cdf,_0x3dd24b){var _0x34fa6d=function(_0x3c2007){while(--_0x3c2007){_0x2f7cdf['push'](_0x2f7cdf['shift']());}};_0x34fa6d(++_0x3dd24b);}(_0x4853,0x11d));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x3485('0x0'),'remove',_0x3485('0x1')];function createListener(_0x1ca548,_0x38f2de){return function(_0x2e51d9){_0x38f2de[_0x3485('0x2')](_0x1ca548,_0x2e51d9);};}function removeListener(_0xd1a964,_0x4ef6c0){return function(){ChatInternalMessageEvents['removeListener'](_0xd1a964,_0x4ef6c0);};}exports['register']=function(_0x249d2c){for(var _0x7512e3=0x0,_0x2442dd=events[_0x3485('0x3')];_0x7512e3<_0x2442dd;_0x7512e3++){var _0x41a183=events[_0x7512e3];var _0x29502b=createListener(_0x3485('0x4')+_0x41a183,_0x249d2c);ChatInternalMessageEvents['on'](_0x41a183,_0x29502b);}}; \ No newline at end of file +var _0x37b4=['remove','update','emit','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x312189,_0x50d133){var _0x4bcbdc=function(_0x1e3fc9){while(--_0x1e3fc9){_0x312189['push'](_0x312189['shift']());}};_0x4bcbdc(++_0x50d133);}(_0x37b4,0xef));var _0x437b=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0x37b4[_0x1261c2];return _0x3aabd2;};'use strict';var ChatInternalMessageEvents=require(_0x437b('0x0'));var events=['save',_0x437b('0x1'),_0x437b('0x2')];function createListener(_0xc42699,_0x5bc1e3){return function(_0x308d00){_0x5bc1e3[_0x437b('0x3')](_0xc42699,_0x308d00);};}function removeListener(_0x317df4,_0x3d353d){return function(){ChatInternalMessageEvents['removeListener'](_0x317df4,_0x3d353d);};}exports['register']=function(_0x1bab79){for(var _0x560099=0x0,_0x3c7dea=events['length'];_0x560099<_0x3c7dea;_0x560099++){var _0x226e3c=events[_0x560099];var _0x5df980=createListener(_0x437b('0x4')+_0x226e3c,_0x1bab79);ChatInternalMessageEvents['on'](_0x226e3c,_0x5df980);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b7bc82c..46d82e4 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 _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x58fca4,_0x55acce){var _0x5b9174=function(_0x2878a3){while(--_0x2878a3){_0x58fca4['push'](_0x58fca4['shift']());}};_0x5b9174(++_0x55acce);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file +var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x511d8e,_0x4ff491){var _0x17ae57=function(_0x5d2668){while(--_0x5d2668){_0x511d8e['push'](_0x511d8e['shift']());}};_0x17ae57(++_0x4ff491);}(_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')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('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 32a0a64..7335187 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 _0x105e=['medium','BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x6d83e5,_0x53c962){var _0x3f6c02=function(_0x1e56cf){while(--_0x1e56cf){_0x6d83e5['push'](_0x6d83e5['shift']());}};_0x3f6c02(++_0x53c962);}(_0x105e,0xd7));var _0xe105=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x105e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe105('0x0'));module['exports']={'body':{'type':Sequelize[_0xe105('0x1')](_0xe105('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe105('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe105('0x4')]('in',_0xe105('0x5')),'defaultValue':_0xe105('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe105('0x6')]}}; \ No newline at end of file +var _0x4e90=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x1c3676,_0x146ece){var _0x2ac5ae=function(_0x20f834){while(--_0x20f834){_0x1c3676['push'](_0x1c3676['shift']());}};_0x2ac5ae(++_0x146ece);}(_0x4e90,0x1c5));var _0x04e9=function(_0x75c01e,_0x17dabd){_0x75c01e=_0x75c01e-0x0;var _0x47dc5f=_0x4e90[_0x75c01e];return _0x47dc5f;};'use strict';var Sequelize=require(_0x04e9('0x0'));module[_0x04e9('0x1')]={'body':{'type':Sequelize[_0x04e9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x04e9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x04e9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x04e9('0x4')]('in',_0x04e9('0x5')),'defaultValue':_0x04e9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x04e9('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 39164dc..3ecb7d9 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 _0x5f36=['acceptmessage','parse','formData','chat-interactions','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatMessage.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','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','ChatMessage','include','findAll','rows','show','params','options','find','create','body','destroy','accept','chat','read','readAt','format','UserId','user','CmContact','Contact','get','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f36,0x8c));var _0x65f3=function(_0x1e9a97,_0x58cd90){_0x1e9a97=_0x1e9a97-0x0;var _0xcfc391=_0x5f36[_0x1e9a97];return _0xcfc391;};'use strict';var pdf=require(_0x65f3('0x0'));var emlformat=require(_0x65f3('0x1'));var rimraf=require(_0x65f3('0x2'));var zipdir=require(_0x65f3('0x3'));var jsonpatch=require(_0x65f3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x65f3('0x5'));var Mustache=require(_0x65f3('0x6'));var util=require(_0x65f3('0x7'));var path=require('path');var sox=require(_0x65f3('0x8'));var csv=require(_0x65f3('0x9'));var ejs=require(_0x65f3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65f3('0xb'));var crypto=require(_0x65f3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x65f3('0xd'));var toCsv=require(_0x65f3('0x9'));var querystring=require(_0x65f3('0xe'));var Papa=require(_0x65f3('0xf'));var Redis=require(_0x65f3('0x10'));var authService=require(_0x65f3('0x11'));var qs=require(_0x65f3('0x12'));var as=require(_0x65f3('0x13'));var hardwareService=require(_0x65f3('0x14'));var logger=require(_0x65f3('0x15'))(_0x65f3('0x16'));var utils=require(_0x65f3('0x17'));var config=require(_0x65f3('0x18'));var db=require('../../mysqldb')['db'];config[_0x65f3('0x19')]=_[_0x65f3('0x1a')](config[_0x65f3('0x19')],{'host':_0x65f3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x65f3('0x1c'))[_0x65f3('0x1d')](socket);var jayson=require(_0x65f3('0x1e'));var client=jayson[_0x65f3('0x1f')][_0x65f3('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x65f3('0x20')]({'port':0x232a});function checkPasswordPattern(_0x26fb2c,_0x2a1627,_0x2929f8){if(_0x2929f8){var _0x13b1b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13b1b0[_0x65f3('0x21')](_0x2a1627)){return _0x26fb2c;}else{throw new db[(_0x65f3('0x22'))][(_0x65f3('0x23'))](_0x65f3('0x24'));}}else{return _0x26fb2c;}}function respondWithRpcPromise(_0x5c78ff,_0x461a10,_0x28dc95,_0x3c2ff6){return new BPromise(function(_0x1afee8,_0x2a809a){var _0x3a4f95=_0x3c2ff6||client;return _0x3a4f95[_0x65f3('0x25')](_0x5c78ff,_0x28dc95)[_0x65f3('0x26')](function(_0x37c2ed){logger[_0x65f3('0x27')](_0x65f3('0x28'),_0x461a10,_0x65f3('0x29'));logger[_0x65f3('0x2a')](_0x65f3('0x2b'),_0x461a10,_0x65f3('0x29'),JSON[_0x65f3('0x2c')](_0x37c2ed));if(_0x37c2ed[_0x65f3('0x2d')]){if(_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2e')]===0x1f4){logger[_0x65f3('0x2d')](_0x65f3('0x28'),_0x461a10,_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2f')]);return _0x2a809a(_0x37c2ed[_0x65f3('0x2d')]['message']);}logger[_0x65f3('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x461a10,_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2f')]);return _0x1afee8(_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2f')]);}else{logger[_0x65f3('0x27')](_0x65f3('0x28'),_0x461a10,_0x65f3('0x29'));_0x1afee8(_0x37c2ed[_0x65f3('0x30')][_0x65f3('0x2f')]);}})[_0x65f3('0x31')](function(_0x49850c){logger[_0x65f3('0x2d')](_0x65f3('0x28'),_0x461a10,_0x49850c);_0x2a809a(_0x49850c);});});}function respondWithStatusCode(_0xa39a2d,_0x12dba5){_0x12dba5=_0x12dba5||0xcc;return function(_0x3690a1){if(_0x3690a1){return _0xa39a2d[_0x65f3('0x32')](_0x12dba5);}return _0xa39a2d[_0x65f3('0x33')](_0x12dba5)[_0x65f3('0x34')]();};}function respondWithResult(_0x3f7ae6,_0x146215){_0x146215=_0x146215||0xc8;return function(_0x1951b1){if(_0x1951b1){return _0x3f7ae6[_0x65f3('0x33')](_0x146215)['json'](_0x1951b1);}};}function respondWithFilteredResult(_0x3ca401,_0x433b08){return function(_0x348af4){if(_0x348af4){var _0x53a100=_0x348af4[_0x65f3('0x35')],_0x17d696=_0x433b08[_0x65f3('0x36')],_0x2adff6=_0x433b08[_0x65f3('0x36')]+_0x433b08[_0x65f3('0x37')],_0x474edc;if(_0x2adff6>=_0x53a100){_0x2adff6=_0x53a100;_0x474edc=0xc8;}else{_0x474edc=0xce;}_0x3ca401['status'](_0x474edc);return _0x3ca401[_0x65f3('0x38')]('Content-Range',_0x17d696+'-'+_0x2adff6+'/'+_0x53a100)['json'](_0x348af4);}return null;};}function patchUpdates(_0x2e30a4){return function(_0x4000dc){try{jsonpatch[_0x65f3('0x39')](_0x4000dc,_0x2e30a4,!![]);}catch(_0x2eb768){return BPromise[_0x65f3('0x3a')](_0x2eb768);}return _0x4000dc[_0x65f3('0x3b')]();};}function saveUpdates(_0x26d21f,_0x369c5b){return function(_0x585087){if(_0x585087){return _0x585087[_0x65f3('0x3c')](_0x26d21f)[_0x65f3('0x26')](function(_0x86e9fa){return _0x86e9fa;});}return null;};}function removeEntity(_0x13b0b4,_0x2954dd){return function(_0x1f5775){if(_0x1f5775){return _0x1f5775['destroy']()['then'](function(){_0x13b0b4[_0x65f3('0x33')](0xcc)[_0x65f3('0x34')]();});}};}function handleEntityNotFound(_0x4a548f,_0x1e30b7){return function(_0x23f432){if(!_0x23f432){_0x4a548f[_0x65f3('0x32')](0x194);}return _0x23f432;};}function handleError(_0x174de9,_0x3c31d3){_0x3c31d3=_0x3c31d3||0x1f4;return function(_0x46ac2c){logger[_0x65f3('0x2d')](_0x46ac2c[_0x65f3('0x3d')]);if(_0x46ac2c['name']){delete _0x46ac2c['name'];}_0x174de9[_0x65f3('0x33')](_0x3c31d3)[_0x65f3('0x3e')](_0x46ac2c);};}exports[_0x65f3('0x3f')]=function(_0x2a6e11,_0x470b45){var _0x2849e3={},_0x55769e={},_0x4a06ca={'count':0x0,'rows':[]};var _0x5a1371=_[_0x65f3('0x40')](db['ChatMessage'][_0x65f3('0x41')],function(_0xf56f4f){return{'name':_0xf56f4f[_0x65f3('0x42')],'type':_0xf56f4f[_0x65f3('0x43')][_0x65f3('0x44')]};});_0x55769e[_0x65f3('0x45')]=_[_0x65f3('0x40')](_0x5a1371,_0x65f3('0x46'));_0x55769e[_0x65f3('0x47')]=_[_0x65f3('0x48')](_0x2a6e11[_0x65f3('0x47')]);_0x55769e[_0x65f3('0x49')]=_[_0x65f3('0x4a')](_0x55769e[_0x65f3('0x45')],_0x55769e[_0x65f3('0x47')]);_0x2849e3['attributes']=_[_0x65f3('0x4a')](_0x55769e[_0x65f3('0x45')],qs[_0x65f3('0x4b')](_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x4b')]));_0x2849e3[_0x65f3('0x4c')]=_0x2849e3[_0x65f3('0x4c')][_0x65f3('0x4d')]?_0x2849e3[_0x65f3('0x4c')]:_0x55769e['model'];if(!_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x4e')](_0x65f3('0x4f'))){_0x2849e3[_0x65f3('0x37')]=qs[_0x65f3('0x37')](_0x2a6e11['query'][_0x65f3('0x37')]);_0x2849e3['offset']=qs[_0x65f3('0x36')](_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x36')]);}_0x2849e3[_0x65f3('0x50')]=qs[_0x65f3('0x51')](_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x51')]);_0x2849e3[_0x65f3('0x52')]=qs[_0x65f3('0x49')](_['pick'](_0x2a6e11['query'],_0x55769e['filters']),_0x5a1371);if(_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x53')]){_0x2849e3[_0x65f3('0x52')]=_['merge'](_0x2849e3[_0x65f3('0x52')],{'$or':_['map'](_0x5a1371,function(_0x12b8ca){if(_0x12b8ca[_0x65f3('0x43')]!==_0x65f3('0x54')){var _0x155fcb={};_0x155fcb[_0x12b8ca[_0x65f3('0x46')]]={'$like':'%'+_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x53')]+'%'};return _0x155fcb;}})});}_0x2849e3=_[_0x65f3('0x55')]({},_0x2849e3,_0x2a6e11['options']);var _0x12b2fc={'where':_0x2849e3[_0x65f3('0x52')]};return db[_0x65f3('0x56')][_0x65f3('0x35')](_0x12b2fc)['then'](function(_0x16a426){_0x4a06ca[_0x65f3('0x35')]=_0x16a426;if(_0x2a6e11[_0x65f3('0x47')]['includeAll']){_0x2849e3[_0x65f3('0x57')]=[{'all':!![]}];}return db['ChatMessage'][_0x65f3('0x58')](_0x2849e3);})[_0x65f3('0x26')](function(_0x218f27){_0x4a06ca[_0x65f3('0x59')]=_0x218f27;return _0x4a06ca;})[_0x65f3('0x26')](respondWithFilteredResult(_0x470b45,_0x2849e3))[_0x65f3('0x31')](handleError(_0x470b45,null));};exports[_0x65f3('0x5a')]=function(_0x10d58e,_0x39cbc2){var _0x5a0986={'raw':!![],'where':{'id':_0x10d58e[_0x65f3('0x5b')]['id']}},_0x1c57b2={};_0x1c57b2[_0x65f3('0x45')]=_['keys'](db[_0x65f3('0x56')][_0x65f3('0x41')]);_0x1c57b2[_0x65f3('0x47')]=_[_0x65f3('0x48')](_0x10d58e[_0x65f3('0x47')]);_0x1c57b2[_0x65f3('0x49')]=_[_0x65f3('0x4a')](_0x1c57b2[_0x65f3('0x45')],_0x1c57b2[_0x65f3('0x47')]);_0x5a0986[_0x65f3('0x4c')]=_['intersection'](_0x1c57b2[_0x65f3('0x45')],qs['fields'](_0x10d58e[_0x65f3('0x47')][_0x65f3('0x4b')]));_0x5a0986[_0x65f3('0x4c')]=_0x5a0986['attributes'][_0x65f3('0x4d')]?_0x5a0986[_0x65f3('0x4c')]:_0x1c57b2[_0x65f3('0x45')];if(_0x10d58e[_0x65f3('0x47')]['includeAll']){_0x5a0986[_0x65f3('0x57')]=[{'all':!![]}];}_0x5a0986=_[_0x65f3('0x55')]({},_0x5a0986,_0x10d58e[_0x65f3('0x5c')]);return db[_0x65f3('0x56')][_0x65f3('0x5d')](_0x5a0986)[_0x65f3('0x26')](handleEntityNotFound(_0x39cbc2,null))[_0x65f3('0x26')](respondWithResult(_0x39cbc2,null))[_0x65f3('0x31')](handleError(_0x39cbc2,null));};exports[_0x65f3('0x5e')]=function(_0xa274df,_0x32b504){return db[_0x65f3('0x56')][_0x65f3('0x5e')](_0xa274df[_0x65f3('0x5f')],{})[_0x65f3('0x26')](respondWithResult(_0x32b504,0xc9))[_0x65f3('0x31')](handleError(_0x32b504,null));};exports[_0x65f3('0x3c')]=function(_0x18f4c8,_0x5d6da4){if(_0x18f4c8['body']['id']){delete _0x18f4c8[_0x65f3('0x5f')]['id'];}return db[_0x65f3('0x56')][_0x65f3('0x5d')]({'where':{'id':_0x18f4c8[_0x65f3('0x5b')]['id']}})[_0x65f3('0x26')](handleEntityNotFound(_0x5d6da4,null))[_0x65f3('0x26')](saveUpdates(_0x18f4c8[_0x65f3('0x5f')],null))[_0x65f3('0x26')](respondWithResult(_0x5d6da4,null))[_0x65f3('0x31')](handleError(_0x5d6da4,null));};exports[_0x65f3('0x60')]=function(_0x58ca8f,_0x5a59ed){return db[_0x65f3('0x56')][_0x65f3('0x5d')]({'where':{'id':_0x58ca8f['params']['id']}})[_0x65f3('0x26')](handleEntityNotFound(_0x5a59ed,null))['then'](removeEntity(_0x5a59ed,null))[_0x65f3('0x31')](handleError(_0x5a59ed,null));};exports['describe']=function(_0x2d6d8a,_0x1b8e04){return db['ChatMessage']['describe']()[_0x65f3('0x26')](respondWithResult(_0x1b8e04,null))[_0x65f3('0x31')](handleError(_0x1b8e04,null));};var interaction_log=require(_0x65f3('0x15'))('chat-interactions');exports[_0x65f3('0x61')]=function(_0x5dfeeb,_0x4d0c1b,_0x513229){var _0x551829={'channel':_0x65f3('0x62')};if(_0x5dfeeb[_0x65f3('0x5f')]['id']){delete _0x5dfeeb[_0x65f3('0x5f')]['id'];}_0x5dfeeb['body'][_0x65f3('0x63')]=!![];_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x64')]=moment()[_0x65f3('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x66')]=_0x5dfeeb[_0x65f3('0x5f')]['UserId']||_0x5dfeeb[_0x65f3('0x67')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x5dfeeb['params']['id'],'UserId':null},'include':[{'model':db[_0x65f3('0x68')],'as':_0x65f3('0x69')}]})[_0x65f3('0x26')](handleEntityNotFound(_0x4d0c1b,null))[_0x65f3('0x26')](saveUpdates(_0x5dfeeb['body'],null))['then'](function(_0x93b302){if(_0x93b302){_0x551829[_0x65f3('0x2f')]=_0x93b302[_0x65f3('0x6a')]({'plain':!![]});return db['ChatInteraction'][_0x65f3('0x5d')]({'where':{'id':_0x93b302[_0x65f3('0x6b')]}});}return null;})[_0x65f3('0x26')](handleEntityNotFound(_0x4d0c1b,null))[_0x65f3('0x26')](function(_0x33ba35){if(_0x33ba35){return _0x33ba35[_0x65f3('0x3c')]({'UserId':_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x66')],'read1stAt':_['isNil'](_0x33ba35[_0x65f3('0x6c')])?moment()[_0x65f3('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x65f3('0x26')](function(_0x1c7cf8){if(_0x1c7cf8){_0x551829['interaction']=_0x1c7cf8[_0x65f3('0x6a')]({'plain':!![]});interaction_log[_0x65f3('0x27')](_0x65f3('0x6d'),_0x5dfeeb[_0x65f3('0x67')]['id'],_0x5dfeeb[_0x65f3('0x67')][_0x65f3('0x46')],_0x5dfeeb['user'][_0x65f3('0x6e')],_0x551829[_0x65f3('0x6f')]['id'],_0x5dfeeb[_0x65f3('0x5f')]?JSON[_0x65f3('0x2c')](_0x5dfeeb[_0x65f3('0x5f')]):_0x65f3('0x70'));return respondWithRpcPromise(_0x65f3('0x71'),'acceptMessage',_0x551829);}return null;})['then'](function(_0x3f49fa){if(_0x3f49fa){if(_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x72')]){_0x551829[_0x65f3('0x2f')][_0x65f3('0x73')]=util[_0x65f3('0x65')](_0x65f3('0x74'),_0x5dfeeb[_0x65f3('0x67')][_0x65f3('0x46')]);_0x551829['message'][_0x65f3('0x75')]=_0x551829[_0x65f3('0x75')];_0x551829[_0x65f3('0x2f')][_0x65f3('0x76')]=_0x65f3('0x61');return respondWithRpcPromise(_0x65f3('0x77'),_0x65f3('0x77'),{'event':_0x65f3('0x78'),'message':_['merge'](_0x551829[_0x65f3('0x2f')],JSON[_0x65f3('0x79')](_0x551829['interaction'][_0x65f3('0x7a')]))},client9002)[_0x65f3('0x26')](function(){return _0x551829;});}return _0x551829;}return null;})[_0x65f3('0x26')](respondWithResult(_0x4d0c1b,null))[_0x65f3('0x31')](handleError(_0x4d0c1b,null));};var interaction_log=require(_0x65f3('0x15'))(_0x65f3('0x7b'));exports[_0x65f3('0x3a')]=function(_0x4982ec,_0x231ff9,_0x368dd8){var _0x4f24b6={'agent':{},'channel':_0x65f3('0x62')};if(_0x4982ec[_0x65f3('0x5f')]['id']){delete _0x4982ec[_0x65f3('0x5f')]['id'];}_0x4982ec[_0x65f3('0x5f')][_0x65f3('0x66')]=_0x4982ec[_0x65f3('0x5f')][_0x65f3('0x66')]||_0x4982ec[_0x65f3('0x67')]['id'];_0x4f24b6[_0x65f3('0x7c')]['id']=_0x4982ec[_0x65f3('0x5f')][_0x65f3('0x66')];return db[_0x65f3('0x56')][_0x65f3('0x5d')]({'where':{'id':_0x4982ec[_0x65f3('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x231ff9,null))[_0x65f3('0x26')](function(_0xf0f87f){if(_0xf0f87f){_0x4f24b6['message']=_0xf0f87f[_0x65f3('0x6a')]({'plain':!![]});return db[_0x65f3('0x7d')][_0x65f3('0x5d')]({'where':{'id':_0xf0f87f[_0x65f3('0x6b')]}});}return null;})[_0x65f3('0x26')](handleEntityNotFound(_0x231ff9,null))[_0x65f3('0x26')](function(_0x28f7e0){if(_0x28f7e0){_0x4f24b6[_0x65f3('0x6f')]=_0x28f7e0[_0x65f3('0x6a')]({'plain':!![]});interaction_log[_0x65f3('0x27')](_0x65f3('0x7e'),_0x4982ec[_0x65f3('0x67')]['id'],_0x4982ec[_0x65f3('0x67')][_0x65f3('0x46')],_0x4982ec[_0x65f3('0x67')]['role'],_0x4f24b6[_0x65f3('0x6f')]['id'],_0x4982ec[_0x65f3('0x5f')]?JSON[_0x65f3('0x2c')](_0x4982ec['body']):_0x65f3('0x70'));return respondWithRpcPromise(_0x65f3('0x7f'),_0x65f3('0x80'),_0x4f24b6);}return null;})[_0x65f3('0x26')](function(_0x4818da){if(_0x4818da){_0x4818da[_0x65f3('0x2f')][_0x65f3('0x73')]=util[_0x65f3('0x65')](_0x65f3('0x74'),_0x4982ec[_0x65f3('0x67')]['name']);_0x4818da[_0x65f3('0x2f')][_0x65f3('0x75')]=_0x4f24b6[_0x65f3('0x75')];_0x4818da[_0x65f3('0x2f')][_0x65f3('0x76')]=_0x65f3('0x3a');respondWithRpcPromise(_0x65f3('0x77'),_0x65f3('0x77'),{'event':_0x65f3('0x81'),'message':_0x4818da['message']},client9002);return _0x4f24b6;}return null;})[_0x65f3('0x26')](respondWithResult(_0x231ff9,null))[_0x65f3('0x31')](handleError(_0x231ff9,null));}; \ No newline at end of file +var _0xe85f=['[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','agent','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','end','sendStatus','stack','name','send','index','ChatMessage','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','keys','merge','find','create','body','params','describe','chat-interactions','accept','chat','read','readAt','format','user','Contact','get','ChatInteraction','ChatInteractionId','UserId','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xe323bb,_0x1703c0){var _0x114089=function(_0x27d4cc){while(--_0x27d4cc){_0xe323bb['push'](_0xe323bb['shift']());}};_0x114089(++_0x1703c0);}(_0xe85f,0x18a));var _0xfe85=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xe85f[_0x42bdad];return _0x122626;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe85('0x0'));var rimraf=require(_0xfe85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe85('0x2'));var rp=require(_0xfe85('0x3'));var moment=require(_0xfe85('0x4'));var BPromise=require(_0xfe85('0x5'));var Mustache=require(_0xfe85('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfe85('0x7'));var csv=require(_0xfe85('0x8'));var ejs=require(_0xfe85('0x9'));var fs=require('fs');var _=require(_0xfe85('0xa'));var squel=require(_0xfe85('0xb'));var crypto=require(_0xfe85('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe85('0x8'));var querystring=require(_0xfe85('0xd'));var Papa=require('papaparse');var Redis=require(_0xfe85('0xe'));var authService=require(_0xfe85('0xf'));var qs=require(_0xfe85('0x10'));var as=require(_0xfe85('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe85('0x12'))(_0xfe85('0x13'));var utils=require(_0xfe85('0x14'));var config=require(_0xfe85('0x15'));var db=require(_0xfe85('0x16'))['db'];config[_0xfe85('0x17')]=_[_0xfe85('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe85('0x19'))(new Redis(config[_0xfe85('0x17')]));require(_0xfe85('0x1a'))[_0xfe85('0x1b')](socket);var jayson=require(_0xfe85('0x1c'));var client=jayson[_0xfe85('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xfe85('0x1d')][_0xfe85('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x37b95b,_0x506d52,_0x30699b){if(_0x30699b){var _0x3bda96=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3bda96['test'](_0x506d52)){return _0x37b95b;}else{throw new db[(_0xfe85('0x1f'))][(_0xfe85('0x20'))](_0xfe85('0x21'));}}else{return _0x37b95b;}}function respondWithRpcPromise(_0x1772af,_0x146394,_0x334601,_0x4875f3){return new BPromise(function(_0x4fa936,_0x3f7e3c){var _0x4a14d0=_0x4875f3||client;return _0x4a14d0[_0xfe85('0x22')](_0x1772af,_0x334601)[_0xfe85('0x23')](function(_0x33d3e8){logger[_0xfe85('0x24')](_0xfe85('0x25'),_0x146394,'request\x20sent');logger[_0xfe85('0x26')](_0xfe85('0x27'),_0x146394,_0xfe85('0x28'),JSON[_0xfe85('0x29')](_0x33d3e8));if(_0x33d3e8[_0xfe85('0x2a')]){if(_0x33d3e8[_0xfe85('0x2a')][_0xfe85('0x2b')]===0x1f4){logger[_0xfe85('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x146394,_0x33d3e8['error'][_0xfe85('0x2c')]);return _0x3f7e3c(_0x33d3e8[_0xfe85('0x2a')]['message']);}logger[_0xfe85('0x2a')](_0xfe85('0x25'),_0x146394,_0x33d3e8[_0xfe85('0x2a')][_0xfe85('0x2c')]);return _0x4fa936(_0x33d3e8['error'][_0xfe85('0x2c')]);}else{logger[_0xfe85('0x24')](_0xfe85('0x25'),_0x146394,_0xfe85('0x28'));_0x4fa936(_0x33d3e8['result'][_0xfe85('0x2c')]);}})[_0xfe85('0x2d')](function(_0x50a5cb){logger['error']('ChatMessage,\x20%s,\x20%s',_0x146394,_0x50a5cb);_0x3f7e3c(_0x50a5cb);});});}function respondWithStatusCode(_0x39f895,_0x238865){_0x238865=_0x238865||0xcc;return function(_0x34d8e3){if(_0x34d8e3){return _0x39f895['sendStatus'](_0x238865);}return _0x39f895['status'](_0x238865)['end']();};}function respondWithResult(_0x4c767f,_0x46032b){_0x46032b=_0x46032b||0xc8;return function(_0x4ff5f2){if(_0x4ff5f2){return _0x4c767f[_0xfe85('0x2e')](_0x46032b)[_0xfe85('0x2f')](_0x4ff5f2);}};}function respondWithFilteredResult(_0x195aea,_0x45eb2f){return function(_0x4bc6e9){if(_0x4bc6e9){var _0x19c8c6=_0x4bc6e9[_0xfe85('0x30')],_0x907e92=_0x45eb2f['offset'],_0x27d000=_0x45eb2f[_0xfe85('0x31')]+_0x45eb2f[_0xfe85('0x32')],_0x2623c7;if(_0x27d000>=_0x19c8c6){_0x27d000=_0x19c8c6;_0x2623c7=0xc8;}else{_0x2623c7=0xce;}_0x195aea[_0xfe85('0x2e')](_0x2623c7);return _0x195aea[_0xfe85('0x33')](_0xfe85('0x34'),_0x907e92+'-'+_0x27d000+'/'+_0x19c8c6)[_0xfe85('0x2f')](_0x4bc6e9);}return null;};}function patchUpdates(_0x4bd8d5){return function(_0x2517bf){try{jsonpatch['apply'](_0x2517bf,_0x4bd8d5,!![]);}catch(_0x2046a0){return BPromise[_0xfe85('0x35')](_0x2046a0);}return _0x2517bf['save']();};}function saveUpdates(_0x39130e,_0x3354f2){return function(_0x516f98){if(_0x516f98){return _0x516f98[_0xfe85('0x36')](_0x39130e)['then'](function(_0x28a935){return _0x28a935;});}return null;};}function removeEntity(_0x206294,_0x399339){return function(_0x30c5ab){if(_0x30c5ab){return _0x30c5ab[_0xfe85('0x37')]()[_0xfe85('0x23')](function(){_0x206294[_0xfe85('0x2e')](0xcc)[_0xfe85('0x38')]();});}};}function handleEntityNotFound(_0xf30d18,_0x41ee2a){return function(_0x23cf9b){if(!_0x23cf9b){_0xf30d18[_0xfe85('0x39')](0x194);}return _0x23cf9b;};}function handleError(_0x468590,_0x43fd38){_0x43fd38=_0x43fd38||0x1f4;return function(_0x90c8de){logger[_0xfe85('0x2a')](_0x90c8de[_0xfe85('0x3a')]);if(_0x90c8de[_0xfe85('0x3b')]){delete _0x90c8de['name'];}_0x468590[_0xfe85('0x2e')](_0x43fd38)[_0xfe85('0x3c')](_0x90c8de);};}exports[_0xfe85('0x3d')]=function(_0x42ade5,_0x4c98c1){var _0x3bbb25={},_0x33eff3={},_0x2f14fa={'count':0x0,'rows':[]};var _0x1909b4=_['map'](db[_0xfe85('0x3e')]['rawAttributes'],function(_0x5c885e){return{'name':_0x5c885e[_0xfe85('0x3f')],'type':_0x5c885e['type'][_0xfe85('0x40')]};});_0x33eff3[_0xfe85('0x41')]=_[_0xfe85('0x42')](_0x1909b4,_0xfe85('0x3b'));_0x33eff3[_0xfe85('0x43')]=_['keys'](_0x42ade5[_0xfe85('0x43')]);_0x33eff3['filters']=_[_0xfe85('0x44')](_0x33eff3[_0xfe85('0x41')],_0x33eff3[_0xfe85('0x43')]);_0x3bbb25[_0xfe85('0x45')]=_[_0xfe85('0x44')](_0x33eff3[_0xfe85('0x41')],qs[_0xfe85('0x46')](_0x42ade5[_0xfe85('0x43')][_0xfe85('0x46')]));_0x3bbb25['attributes']=_0x3bbb25['attributes'][_0xfe85('0x47')]?_0x3bbb25['attributes']:_0x33eff3['model'];if(!_0x42ade5[_0xfe85('0x43')][_0xfe85('0x48')](_0xfe85('0x49'))){_0x3bbb25[_0xfe85('0x32')]=qs[_0xfe85('0x32')](_0x42ade5['query'][_0xfe85('0x32')]);_0x3bbb25[_0xfe85('0x31')]=qs[_0xfe85('0x31')](_0x42ade5[_0xfe85('0x43')][_0xfe85('0x31')]);}_0x3bbb25[_0xfe85('0x4a')]=qs['sort'](_0x42ade5['query'][_0xfe85('0x4b')]);_0x3bbb25[_0xfe85('0x4c')]=qs['filters'](_[_0xfe85('0x4d')](_0x42ade5[_0xfe85('0x43')],_0x33eff3[_0xfe85('0x4e')]),_0x1909b4);if(_0x42ade5['query'][_0xfe85('0x4f')]){_0x3bbb25[_0xfe85('0x4c')]=_['merge'](_0x3bbb25[_0xfe85('0x4c')],{'$or':_[_0xfe85('0x42')](_0x1909b4,function(_0x2abfcf){if(_0x2abfcf[_0xfe85('0x50')]!==_0xfe85('0x51')){var _0x5a838f={};_0x5a838f[_0x2abfcf['name']]={'$like':'%'+_0x42ade5[_0xfe85('0x43')][_0xfe85('0x4f')]+'%'};return _0x5a838f;}})});}_0x3bbb25=_['merge']({},_0x3bbb25,_0x42ade5[_0xfe85('0x52')]);var _0x46d8ab={'where':_0x3bbb25[_0xfe85('0x4c')]};return db[_0xfe85('0x3e')][_0xfe85('0x30')](_0x46d8ab)[_0xfe85('0x23')](function(_0x2c97da){_0x2f14fa[_0xfe85('0x30')]=_0x2c97da;if(_0x42ade5[_0xfe85('0x43')][_0xfe85('0x53')]){_0x3bbb25[_0xfe85('0x54')]=[{'all':!![]}];}return db[_0xfe85('0x3e')][_0xfe85('0x55')](_0x3bbb25);})['then'](function(_0x54da39){_0x2f14fa['rows']=_0x54da39;return _0x2f14fa;})[_0xfe85('0x23')](respondWithFilteredResult(_0x4c98c1,_0x3bbb25))[_0xfe85('0x2d')](handleError(_0x4c98c1,null));};exports['show']=function(_0x1976e7,_0x2a2c22){var _0x3bb2e5={'raw':!![],'where':{'id':_0x1976e7['params']['id']}},_0x390841={};_0x390841[_0xfe85('0x41')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x390841[_0xfe85('0x43')]=_[_0xfe85('0x56')](_0x1976e7[_0xfe85('0x43')]);_0x390841[_0xfe85('0x4e')]=_[_0xfe85('0x44')](_0x390841[_0xfe85('0x41')],_0x390841[_0xfe85('0x43')]);_0x3bb2e5[_0xfe85('0x45')]=_[_0xfe85('0x44')](_0x390841['model'],qs[_0xfe85('0x46')](_0x1976e7[_0xfe85('0x43')]['fields']));_0x3bb2e5[_0xfe85('0x45')]=_0x3bb2e5[_0xfe85('0x45')]['length']?_0x3bb2e5[_0xfe85('0x45')]:_0x390841['model'];if(_0x1976e7[_0xfe85('0x43')][_0xfe85('0x53')]){_0x3bb2e5[_0xfe85('0x54')]=[{'all':!![]}];}_0x3bb2e5=_[_0xfe85('0x57')]({},_0x3bb2e5,_0x1976e7[_0xfe85('0x52')]);return db[_0xfe85('0x3e')][_0xfe85('0x58')](_0x3bb2e5)[_0xfe85('0x23')](handleEntityNotFound(_0x2a2c22,null))[_0xfe85('0x23')](respondWithResult(_0x2a2c22,null))[_0xfe85('0x2d')](handleError(_0x2a2c22,null));};exports[_0xfe85('0x59')]=function(_0x4d1f3c,_0x3d0d2e){return db[_0xfe85('0x3e')]['create'](_0x4d1f3c[_0xfe85('0x5a')],{})['then'](respondWithResult(_0x3d0d2e,0xc9))[_0xfe85('0x2d')](handleError(_0x3d0d2e,null));};exports[_0xfe85('0x36')]=function(_0x65937d,_0x19f854){if(_0x65937d['body']['id']){delete _0x65937d[_0xfe85('0x5a')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x65937d[_0xfe85('0x5b')]['id']}})[_0xfe85('0x23')](handleEntityNotFound(_0x19f854,null))[_0xfe85('0x23')](saveUpdates(_0x65937d['body'],null))[_0xfe85('0x23')](respondWithResult(_0x19f854,null))[_0xfe85('0x2d')](handleError(_0x19f854,null));};exports[_0xfe85('0x37')]=function(_0x1cd805,_0x54e7ef){return db['ChatMessage'][_0xfe85('0x58')]({'where':{'id':_0x1cd805['params']['id']}})[_0xfe85('0x23')](handleEntityNotFound(_0x54e7ef,null))[_0xfe85('0x23')](removeEntity(_0x54e7ef,null))['catch'](handleError(_0x54e7ef,null));};exports[_0xfe85('0x5c')]=function(_0x38c2bf,_0x187c26){return db[_0xfe85('0x3e')]['describe']()['then'](respondWithResult(_0x187c26,null))['catch'](handleError(_0x187c26,null));};var interaction_log=require(_0xfe85('0x12'))(_0xfe85('0x5d'));exports[_0xfe85('0x5e')]=function(_0x171fde,_0x3c692a,_0x4795ee){var _0x5bc4d8={'channel':_0xfe85('0x5f')};if(_0x171fde[_0xfe85('0x5a')]['id']){delete _0x171fde['body']['id'];}_0x171fde[_0xfe85('0x5a')][_0xfe85('0x60')]=!![];_0x171fde[_0xfe85('0x5a')][_0xfe85('0x61')]=moment()[_0xfe85('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x171fde[_0xfe85('0x5a')]['UserId']=_0x171fde[_0xfe85('0x5a')]['UserId']||_0x171fde[_0xfe85('0x63')]['id'];return db[_0xfe85('0x3e')][_0xfe85('0x58')]({'where':{'id':_0x171fde[_0xfe85('0x5b')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xfe85('0x64')}]})[_0xfe85('0x23')](handleEntityNotFound(_0x3c692a,null))[_0xfe85('0x23')](saveUpdates(_0x171fde['body'],null))[_0xfe85('0x23')](function(_0x284c71){if(_0x284c71){_0x5bc4d8[_0xfe85('0x2c')]=_0x284c71[_0xfe85('0x65')]({'plain':!![]});return db[_0xfe85('0x66')][_0xfe85('0x58')]({'where':{'id':_0x284c71[_0xfe85('0x67')]}});}return null;})[_0xfe85('0x23')](handleEntityNotFound(_0x3c692a,null))[_0xfe85('0x23')](function(_0x7b1aa1){if(_0x7b1aa1){return _0x7b1aa1['update']({'UserId':_0x171fde[_0xfe85('0x5a')][_0xfe85('0x68')],'read1stAt':_['isNil'](_0x7b1aa1['read1stAt'])?moment()['format'](_0xfe85('0x69')):undefined});}return null;})[_0xfe85('0x23')](function(_0x44f362){if(_0x44f362){_0x5bc4d8['interaction']=_0x44f362[_0xfe85('0x65')]({'plain':!![]});interaction_log[_0xfe85('0x24')](_0xfe85('0x6a'),_0x171fde['user']['id'],_0x171fde[_0xfe85('0x63')][_0xfe85('0x3b')],_0x171fde[_0xfe85('0x63')][_0xfe85('0x6b')],_0x5bc4d8['interaction']['id'],_0x171fde['body']?JSON['stringify'](_0x171fde[_0xfe85('0x5a')]):_0xfe85('0x6c'));return respondWithRpcPromise(_0xfe85('0x6d'),_0xfe85('0x6e'),_0x5bc4d8);}return null;})['then'](function(_0x98bd8){if(_0x98bd8){if(_0x171fde['body'][_0xfe85('0x6f')]){_0x5bc4d8[_0xfe85('0x2c')][_0xfe85('0x70')]=util[_0xfe85('0x62')]('SIP/%s',_0x171fde['user'][_0xfe85('0x3b')]);_0x5bc4d8[_0xfe85('0x2c')]['channel']=_0x5bc4d8[_0xfe85('0x71')];_0x5bc4d8[_0xfe85('0x2c')][_0xfe85('0x72')]=_0xfe85('0x5e');return respondWithRpcPromise(_0xfe85('0x73'),_0xfe85('0x73'),{'event':_0xfe85('0x74'),'message':_[_0xfe85('0x57')](_0x5bc4d8['message'],JSON['parse'](_0x5bc4d8['interaction'][_0xfe85('0x75')]))},client9002)[_0xfe85('0x23')](function(){return _0x5bc4d8;});}return _0x5bc4d8;}return null;})['then'](respondWithResult(_0x3c692a,null))[_0xfe85('0x2d')](handleError(_0x3c692a,null));};var interaction_log=require(_0xfe85('0x12'))(_0xfe85('0x5d'));exports[_0xfe85('0x35')]=function(_0x35cbaf,_0x436f8a,_0x4326da){var _0x250cf8={'agent':{},'channel':'chat'};if(_0x35cbaf[_0xfe85('0x5a')]['id']){delete _0x35cbaf['body']['id'];}_0x35cbaf['body'][_0xfe85('0x68')]=_0x35cbaf[_0xfe85('0x5a')][_0xfe85('0x68')]||_0x35cbaf[_0xfe85('0x63')]['id'];_0x250cf8[_0xfe85('0x76')]['id']=_0x35cbaf['body'][_0xfe85('0x68')];return db[_0xfe85('0x3e')][_0xfe85('0x58')]({'where':{'id':_0x35cbaf[_0xfe85('0x5b')]['id'],'UserId':null}})[_0xfe85('0x23')](handleEntityNotFound(_0x436f8a,null))['then'](function(_0x57fe6c){if(_0x57fe6c){_0x250cf8['message']=_0x57fe6c[_0xfe85('0x65')]({'plain':!![]});return db[_0xfe85('0x66')][_0xfe85('0x58')]({'where':{'id':_0x57fe6c[_0xfe85('0x67')]}});}return null;})[_0xfe85('0x23')](handleEntityNotFound(_0x436f8a,null))[_0xfe85('0x23')](function(_0x57fb0e){if(_0x57fb0e){_0x250cf8[_0xfe85('0x77')]=_0x57fb0e[_0xfe85('0x65')]({'plain':!![]});interaction_log[_0xfe85('0x24')](_0xfe85('0x78'),_0x35cbaf[_0xfe85('0x63')]['id'],_0x35cbaf[_0xfe85('0x63')][_0xfe85('0x3b')],_0x35cbaf[_0xfe85('0x63')][_0xfe85('0x6b')],_0x250cf8[_0xfe85('0x77')]['id'],_0x35cbaf[_0xfe85('0x5a')]?JSON[_0xfe85('0x29')](_0x35cbaf[_0xfe85('0x5a')]):_0xfe85('0x6c'));return respondWithRpcPromise(_0xfe85('0x79'),_0xfe85('0x7a'),_0x250cf8);}return null;})[_0xfe85('0x23')](function(_0x340a52){if(_0x340a52){_0x340a52[_0xfe85('0x2c')][_0xfe85('0x70')]=util[_0xfe85('0x62')](_0xfe85('0x7b'),_0x35cbaf[_0xfe85('0x63')][_0xfe85('0x3b')]);_0x340a52[_0xfe85('0x2c')]['channel']=_0x250cf8[_0xfe85('0x71')];_0x340a52[_0xfe85('0x2c')][_0xfe85('0x72')]=_0xfe85('0x35');respondWithRpcPromise(_0xfe85('0x73'),_0xfe85('0x73'),{'event':_0xfe85('0x7c'),'message':_0x340a52[_0xfe85('0x2c')]},client9002);return _0x250cf8;}return null;})['then'](respondWithResult(_0x436f8a,null))[_0xfe85('0x2d')](handleError(_0x436f8a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 883de11..3ac3305 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 _0x95d0=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x43b629,_0x3fcb3c){var _0x23f6f8=function(_0x384d52){while(--_0x384d52){_0x43b629['push'](_0x43b629['shift']());}};_0x23f6f8(++_0x3fcb3c);}(_0x95d0,0x17b));var _0x095d=function(_0x517172,_0x11273e){_0x517172=_0x517172-0x0;var _0x3c5770=_0x95d0[_0x517172];return _0x3c5770;};'use strict';var EventEmitter=require(_0x095d('0x0'));var ChatMessage=require(_0x095d('0x1'))['db'][_0x095d('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x095d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x095d('0x4')};function emitEvent(_0xb27d09){return function(_0x2b9a77,_0x260b4d,_0x366ca7){ChatMessageEvents[_0x095d('0x5')](_0xb27d09+':'+_0x2b9a77['id'],_0x2b9a77);ChatMessageEvents['emit'](_0xb27d09,_0x2b9a77);_0x366ca7(null);};}for(var e in events){if(events[_0x095d('0x6')](e)){var event=events[e];ChatMessage[_0x095d('0x7')](e,emitEvent(event));}}module[_0x095d('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xa63a=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x288184,_0x3e574a){var _0x1e54c1=function(_0x5e3be1){while(--_0x5e3be1){_0x288184['push'](_0x288184['shift']());}};_0x1e54c1(++_0x3e574a);}(_0xa63a,0x1a2));var _0xaa63=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0xa63a[_0x3df871];return _0x570f7b;};'use strict';var EventEmitter=require(_0xaa63('0x0'));var ChatMessage=require(_0xaa63('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaa63('0x2')](0x0);var events={'afterCreate':_0xaa63('0x3'),'afterUpdate':_0xaa63('0x4'),'afterDestroy':_0xaa63('0x5')};function emitEvent(_0x46440e){return function(_0x3c9320,_0x288308,_0x23ca23){ChatMessageEvents[_0xaa63('0x6')](_0x46440e+':'+_0x3c9320['id'],_0x3c9320);ChatMessageEvents[_0xaa63('0x6')](_0x46440e,_0x3c9320);_0x23ca23(null);};}for(var e in events){if(events[_0xaa63('0x7')](e)){var event=events[e];ChatMessage[_0xaa63('0x8')](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 6a689f2..897da95 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 _0x514f=['findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','api','moment','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction'];(function(_0x125c77,_0x5ae623){var _0x3b7a0=function(_0x6ed97d){while(--_0x6ed97d){_0x125c77['push'](_0x125c77['shift']());}};_0x3b7a0(++_0x5ae623);}(_0x514f,0xb6));var _0xf514=function(_0x4d4efb,_0x39c4fd){_0x4d4efb=_0x4d4efb-0x0;var _0x100eea=_0x514f[_0x4d4efb];return _0x100eea;};'use strict';var _=require(_0xf514('0x0'));var util=require(_0xf514('0x1'));var logger=require('../../config/logger')(_0xf514('0x2'));var moment=require(_0xf514('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf514('0x4'));var rimraf=require('rimraf');var config=require(_0xf514('0x5'));var attributes=require(_0xf514('0x6'));module[_0xf514('0x7')]=function(_0x310c8e,_0x3764b9){return _0x310c8e[_0xf514('0x8')](_0xf514('0x9'),attributes,{'tableName':_0xf514('0xa'),'paranoid':![],'indexes':[{'name':_0xf514('0xb'),'fields':['body'],'type':_0xf514('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x533e9d,_0x3ddfc0,_0xddebd6){var _0x268209=_0x310c8e['models'];var _0x38310b=_0x533e9d[_0xf514('0xd')]({'plain':!![]});if(_0x38310b[_0xf514('0xe')]['toLowerCase']()==='in'||_0x38310b[_0xf514('0xe')][_0xf514('0xf')]()===_0xf514('0x10')&&!_0x38310b[_0xf514('0x11')]&&!_[_0xf514('0x12')](_0x38310b[_0xf514('0x13')])){_0x268209[_0xf514('0x14')][_0xf514('0x15')]({'where':{'id':_0x38310b[_0xf514('0x16')]}})[_0xf514('0x17')](function(_0x1b1fce){if(_0x1b1fce){_0x1b1fce[_0xf514('0x18')]({'lastMsgAt':_0x38310b[_0xf514('0x19')],'lastMsgDirection':_0x38310b[_0xf514('0xe')][_0xf514('0xf')]()});}})[_0xf514('0x1a')](function(_0x467b75){console[_0xf514('0x1b')](_0x467b75);});}_0xddebd6();}},'charset':_0xf514('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbb13=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','then','update','createdAt'];(function(_0x1a6aaa,_0x39b1c5){var _0x52b6ca=function(_0x1dfe75){while(--_0x1dfe75){_0x1a6aaa['push'](_0x1a6aaa['shift']());}};_0x52b6ca(++_0x39b1c5);}(_0xbb13,0x126));var _0x3bb1=function(_0x50b01c,_0x304f9a){_0x50b01c=_0x50b01c-0x0;var _0x533245=_0xbb13[_0x50b01c];return _0x533245;};'use strict';var _=require(_0x3bb1('0x0'));var util=require(_0x3bb1('0x1'));var logger=require(_0x3bb1('0x2'))('api');var moment=require(_0x3bb1('0x3'));var BPromise=require(_0x3bb1('0x4'));var rp=require(_0x3bb1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bb1('0x6'));var attributes=require(_0x3bb1('0x7'));module[_0x3bb1('0x8')]=function(_0x1b9986,_0x6b9f8){return _0x1b9986[_0x3bb1('0x9')](_0x3bb1('0xa'),attributes,{'tableName':_0x3bb1('0xb'),'paranoid':![],'indexes':[{'name':_0x3bb1('0xc'),'fields':[_0x3bb1('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x278aa8,_0x56d1fa,_0x206e43){var _0x588380=_0x1b9986[_0x3bb1('0xe')];var _0x2825e3=_0x278aa8['get']({'plain':!![]});if(_0x2825e3[_0x3bb1('0xf')][_0x3bb1('0x10')]()==='in'||_0x2825e3[_0x3bb1('0xf')]['toLowerCase']()===_0x3bb1('0x11')&&!_0x2825e3[_0x3bb1('0x12')]&&!_[_0x3bb1('0x13')](_0x2825e3[_0x3bb1('0x14')])){_0x588380[_0x3bb1('0x15')]['findOne']({'where':{'id':_0x2825e3['ChatInteractionId']}})[_0x3bb1('0x16')](function(_0x5228b2){if(_0x5228b2){_0x5228b2[_0x3bb1('0x17')]({'lastMsgAt':_0x2825e3[_0x3bb1('0x18')],'lastMsgDirection':_0x2825e3[_0x3bb1('0xf')][_0x3bb1('0x10')]()});}})[_0x3bb1('0x19')](function(_0x5c8488){console[_0x3bb1('0x1a')](_0x5c8488);});}_0x206e43();}},'charset':_0x3bb1('0x1b'),'collate':_0x3bb1('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ce05b05..e0f9adf 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 _0x25cf=['CreateChatMessage','ChatMessage','create','options','info','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1e73fc,_0x533750){var _0xeceac4=function(_0x2c6dda){while(--_0x2c6dda){_0x1e73fc['push'](_0x1e73fc['shift']());}};_0xeceac4(++_0x533750);}(_0x25cf,0x17e));var _0xf25c=function(_0x1fd275,_0xcc9e18){_0x1fd275=_0x1fd275-0x0;var _0x2f7280=_0x25cf[_0x1fd275];return _0x2f7280;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var moment=require(_0xf25c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf25c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf25c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf25c('0x5'));var config=require(_0xf25c('0x6'));var jayson=require(_0xf25c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf25c('0x8')]=_[_0xf25c('0x9')](config[_0xf25c('0x8')],{'host':_0xf25c('0xa'),'port':0x18eb});var socket=require(_0xf25c('0xb'))(new Redis(config[_0xf25c('0x8')]));require(_0xf25c('0xc'))[_0xf25c('0xd')](socket);function respondWithRpcPromise(_0x157f53,_0x626e40,_0x251a38){return new BPromise(function(_0x533ba1,_0x4111ce){return client[_0xf25c('0xe')](_0x157f53,_0x251a38)[_0xf25c('0xf')](function(_0x2c946a){logger['info'](_0xf25c('0x10'),_0x626e40,_0xf25c('0x11'));logger[_0xf25c('0x12')](_0xf25c('0x13'),_0x626e40,'request\x20sent',JSON[_0xf25c('0x14')](_0x2c946a));if(_0x2c946a[_0xf25c('0x15')]){if(_0x2c946a[_0xf25c('0x15')]['code']===0x1f4){logger[_0xf25c('0x15')](_0xf25c('0x10'),_0x626e40,_0x2c946a[_0xf25c('0x15')]['message']);return _0x4111ce(_0x2c946a[_0xf25c('0x15')][_0xf25c('0x16')]);}logger[_0xf25c('0x15')](_0xf25c('0x10'),_0x626e40,_0x2c946a['error'][_0xf25c('0x16')]);return _0x533ba1(_0x2c946a['error'][_0xf25c('0x16')]);}else{logger['info'](_0xf25c('0x10'),_0x626e40,_0xf25c('0x11'));_0x533ba1(_0x2c946a[_0xf25c('0x17')]['message']);}})['catch'](function(_0x1ffd4b){logger['error'](_0xf25c('0x10'),_0x626e40,_0x1ffd4b);_0x4111ce(_0x1ffd4b);});});}exports[_0xf25c('0x18')]=function(_0x5c7734){var _0xcc12ec=this;return new Promise(function(_0x420f29,_0x3444b6){return db[_0xf25c('0x19')][_0xf25c('0x1a')](_0x5c7734['body'],{'raw':_0x5c7734[_0xf25c('0x1b')]?_0x5c7734[_0xf25c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf25c('0xf')](function(_0x249289){logger[_0xf25c('0x1c')]('CreateChatMessage',_0x5c7734);logger[_0xf25c('0x12')]('CreateChatMessage',_0x5c7734,JSON[_0xf25c('0x14')](_0x249289));_0x420f29(_0x249289);})['catch'](function(_0x4b81b4){logger[_0xf25c('0x15')](_0xf25c('0x18'),_0x4b81b4[_0xf25c('0x16')],_0x5c7734);_0x3444b6(_0xcc12ec['error'](0x1f4,_0x4b81b4['message']));});});}; \ No newline at end of file +var _0xbb88=['body','options','raw','CreateChatMessage','stringify','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatMessage,\x20%s,\x20%s','result','ChatMessage','create'];(function(_0x38d499,_0x1cbb6b){var _0x274b18=function(_0x488d64){while(--_0x488d64){_0x38d499['push'](_0x38d499['shift']());}};_0x274b18(++_0x1cbb6b);}(_0xbb88,0x171));var _0x8bb8=function(_0x4a1b1f,_0x245607){_0x4a1b1f=_0x4a1b1f-0x0;var _0x1ffdef=_0xbb88[_0x4a1b1f];return _0x1ffdef;};'use strict';var _=require(_0x8bb8('0x0'));var util=require(_0x8bb8('0x1'));var moment=require('moment');var BPromise=require(_0x8bb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bb8('0x3'))['db'];var utils=require(_0x8bb8('0x4'));var logger=require(_0x8bb8('0x5'))('rpc');var config=require(_0x8bb8('0x6'));var jayson=require(_0x8bb8('0x7'));var client=jayson[_0x8bb8('0x8')][_0x8bb8('0x9')]({'port':0x232a});config[_0x8bb8('0xa')]=_[_0x8bb8('0xb')](config[_0x8bb8('0xa')],{'host':_0x8bb8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bb8('0xa')]));require('./chatMessage.socket')[_0x8bb8('0xd')](socket);function respondWithRpcPromise(_0x5de0b3,_0x504bdf,_0x3fadb5){return new BPromise(function(_0x43e591,_0x2e057e){return client[_0x8bb8('0xe')](_0x5de0b3,_0x3fadb5)[_0x8bb8('0xf')](function(_0x3bfa63){logger[_0x8bb8('0x10')]('ChatMessage,\x20%s,\x20%s',_0x504bdf,_0x8bb8('0x11'));logger[_0x8bb8('0x12')](_0x8bb8('0x13'),_0x504bdf,_0x8bb8('0x11'),JSON['stringify'](_0x3bfa63));if(_0x3bfa63[_0x8bb8('0x14')]){if(_0x3bfa63['error'][_0x8bb8('0x15')]===0x1f4){logger[_0x8bb8('0x14')]('ChatMessage,\x20%s,\x20%s',_0x504bdf,_0x3bfa63[_0x8bb8('0x14')][_0x8bb8('0x16')]);return _0x2e057e(_0x3bfa63[_0x8bb8('0x14')][_0x8bb8('0x16')]);}logger[_0x8bb8('0x14')](_0x8bb8('0x17'),_0x504bdf,_0x3bfa63[_0x8bb8('0x14')][_0x8bb8('0x16')]);return _0x43e591(_0x3bfa63[_0x8bb8('0x14')][_0x8bb8('0x16')]);}else{logger[_0x8bb8('0x10')](_0x8bb8('0x17'),_0x504bdf,_0x8bb8('0x11'));_0x43e591(_0x3bfa63[_0x8bb8('0x18')][_0x8bb8('0x16')]);}})['catch'](function(_0x131436){logger[_0x8bb8('0x14')](_0x8bb8('0x17'),_0x504bdf,_0x131436);_0x2e057e(_0x131436);});});}exports['CreateChatMessage']=function(_0x336000){var _0xc8fb9a=this;return new Promise(function(_0x5e91e9,_0x42f8c8){return db[_0x8bb8('0x19')][_0x8bb8('0x1a')](_0x336000[_0x8bb8('0x1b')],{'raw':_0x336000[_0x8bb8('0x1c')]?_0x336000['options'][_0x8bb8('0x1d')]===undefined?!![]:![]:!![]})[_0x8bb8('0xf')](function(_0x1699ba){logger[_0x8bb8('0x10')](_0x8bb8('0x1e'),_0x336000);logger[_0x8bb8('0x12')](_0x8bb8('0x1e'),_0x336000,JSON[_0x8bb8('0x1f')](_0x1699ba));_0x5e91e9(_0x1699ba);})[_0x8bb8('0x20')](function(_0x19dbd6){logger[_0x8bb8('0x14')]('CreateChatMessage',_0x19dbd6['message'],_0x336000);_0x42f8c8(_0xc8fb9a[_0x8bb8('0x14')](0x1f4,_0x19dbd6[_0x8bb8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a477d20..f253435 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 _0x5d58=['register'];(function(_0x1966ad,_0x43f2f3){var _0x5d7637=function(_0x24b943){while(--_0x24b943){_0x1966ad['push'](_0x1966ad['shift']());}};_0x5d7637(++_0x43f2f3);}(_0x5d58,0x187));var _0x85d5=function(_0x1aa871,_0x11f9b8){_0x1aa871=_0x1aa871-0x0;var _0x26dc2c=_0x5d58[_0x1aa871];return _0x26dc2c;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){ChatMessageEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('chatMessage:'+_0x98c963,_0x2d457a);ChatMessageEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file +var _0x5d58=['register'];(function(_0x56618b,_0x15065a){var _0x4cdd7f=function(_0x35a0dd){while(--_0x35a0dd){_0x56618b['push'](_0x56618b['shift']());}};_0x4cdd7f(++_0x15065a);}(_0x5d58,0x187));var _0x85d5=function(_0x17d2c1,_0x5261ed){_0x17d2c1=_0x17d2c1-0x0;var _0x3e952d=_0x5d58[_0x17d2c1];return _0x3e952d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){ChatMessageEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('chatMessage:'+_0x98c963,_0x2d457a);ChatMessageEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0c7480d..ce609c5 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 _0x737b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','reject','delete','exports'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x737b,0x113));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb737('0x0'));var util=require(_0xb737('0x1'));var path=require(_0xb737('0x2'));var timeout=require(_0xb737('0x3'));var express=require(_0xb737('0x4'));var router=express[_0xb737('0x5')]();var auth=require(_0xb737('0x6'));var interaction=require(_0xb737('0x7'));var config=require('../../config/environment');var controller=require(_0xb737('0x8'));router[_0xb737('0x9')]('/',auth[_0xb737('0xa')](),controller[_0xb737('0xb')]);router[_0xb737('0x9')](_0xb737('0xc'),auth[_0xb737('0xa')](),controller[_0xb737('0xd')]);router[_0xb737('0x9')](_0xb737('0xe'),auth[_0xb737('0xa')](),controller[_0xb737('0xf')]);router[_0xb737('0x10')]('/',auth[_0xb737('0xa')](),interaction[_0xb737('0x11')]('chat',_0xb737('0x12')),controller[_0xb737('0x13')]);router[_0xb737('0x14')](_0xb737('0xe'),controller[_0xb737('0x15')]);router['put']('/:id/accept',auth[_0xb737('0xa')](),controller['accept']);router[_0xb737('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xb737('0x16')]);router[_0xb737('0x17')](_0xb737('0xe'),auth[_0xb737('0xa')](),controller['destroy']);module[_0xb737('0x18')]=router; \ No newline at end of file +var _0x783f=['/:id','isAuthenticated','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe'];(function(_0x4d81aa,_0x1cede4){var _0x332ee2=function(_0x46ce20){while(--_0x46ce20){_0x4d81aa['push'](_0x4d81aa['shift']());}};_0x332ee2(++_0x1cede4);}(_0x783f,0x102));var _0xf783=function(_0x5c92a7,_0x5d9b3d){_0x5c92a7=_0x5c92a7-0x0;var _0x38142b=_0x783f[_0x5c92a7];return _0x38142b;};'use strict';var multer=require(_0xf783('0x0'));var util=require(_0xf783('0x1'));var path=require(_0xf783('0x2'));var timeout=require(_0xf783('0x3'));var express=require('express');var router=express[_0xf783('0x4')]();var auth=require(_0xf783('0x5'));var interaction=require(_0xf783('0x6'));var config=require(_0xf783('0x7'));var controller=require('./chatMessage.controller');router[_0xf783('0x8')]('/',auth['isAuthenticated'](),controller[_0xf783('0x9')]);router[_0xf783('0x8')](_0xf783('0xa'),auth['isAuthenticated'](),controller[_0xf783('0xb')]);router[_0xf783('0x8')](_0xf783('0xc'),auth[_0xf783('0xd')](),controller[_0xf783('0xe')]);router[_0xf783('0xf')]('/',auth[_0xf783('0xd')](),interaction[_0xf783('0x10')](_0xf783('0x11'),_0xf783('0x12')),controller[_0xf783('0x13')]);router[_0xf783('0x14')](_0xf783('0xc'),controller[_0xf783('0x15')]);router[_0xf783('0x14')](_0xf783('0x16'),auth[_0xf783('0xd')](),controller[_0xf783('0x17')]);router[_0xf783('0x14')](_0xf783('0x18'),auth[_0xf783('0xd')](),controller['reject']);router['delete'](_0xf783('0xc'),auth[_0xf783('0xd')](),controller[_0xf783('0x19')]);module[_0xf783('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2b9f938..70be9e7 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 _0x6b57=['medium','sequelize'];(function(_0x5d316a,_0x513433){var _0x2f22c4=function(_0x2c8e14){while(--_0x2c8e14){_0x5d316a['push'](_0x5d316a['shift']());}};_0x2f22c4(++_0x513433);}(_0x6b57,0x189));var _0x76b5=function(_0x58d5c3,_0x15c603){_0x58d5c3=_0x58d5c3-0x0;var _0x429aa6=_0x6b57[_0x58d5c3];return _0x429aa6;};'use strict';var Sequelize=require(_0x76b5('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x76b5('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2c46=['sequelize','exports','TEXT','medium'];(function(_0x14e037,_0x147cc8){var _0x5722f4=function(_0xc72f9c){while(--_0xc72f9c){_0x14e037['push'](_0x14e037['shift']());}};_0x5722f4(++_0x147cc8);}(_0x2c46,0x170));var _0x62c4=function(_0x534ef8,_0x400abe){_0x534ef8=_0x534ef8-0x0;var _0x14637c=_0x2c46[_0x534ef8];return _0x14637c;};'use strict';var Sequelize=require(_0x62c4('0x0'));module[_0x62c4('0x1')]={'body':{'type':Sequelize[_0x62c4('0x2')](_0x62c4('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 f671137..15e5388 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 _0x3baf=['VIRTUAL','options','count','findAll','rows','show','params','keys','includeAll','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','error','stack','send','ChatOfflineMessage','rawAttributes','fieldName','type','name','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where'];(function(_0x3b1a35,_0x34bf56){var _0x1679ec=function(_0x5b8782){while(--_0x5b8782){_0x3b1a35['push'](_0x3b1a35['shift']());}};_0x1679ec(++_0x34bf56);}(_0x3baf,0xf7));var _0xf3ba=function(_0x283b97,_0x2dd687){_0x283b97=_0x283b97-0x0;var _0xe5cbb9=_0x3baf[_0x283b97];return _0xe5cbb9;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var db=require(_0xf3ba('0x1b'))['db'];function respondWithStatusCode(_0x46c2cf,_0x85939e){_0x85939e=_0x85939e||0xcc;return function(_0x26cefe){if(_0x26cefe){return _0x46c2cf[_0xf3ba('0x1c')](_0x85939e);}return _0x46c2cf[_0xf3ba('0x1d')](_0x85939e)[_0xf3ba('0x1e')]();};}function respondWithResult(_0x505b8d,_0x327675){_0x327675=_0x327675||0xc8;return function(_0x56816b){if(_0x56816b){return _0x505b8d[_0xf3ba('0x1d')](_0x327675)[_0xf3ba('0x1f')](_0x56816b);}};}function respondWithFilteredResult(_0x4717be,_0x1e2969){return function(_0x235c8a){if(_0x235c8a){var _0x53f848=_0x235c8a['count'],_0x301856=_0x1e2969[_0xf3ba('0x20')],_0x29e45b=_0x1e2969[_0xf3ba('0x20')]+_0x1e2969[_0xf3ba('0x21')],_0x13d899;if(_0x29e45b>=_0x53f848){_0x29e45b=_0x53f848;_0x13d899=0xc8;}else{_0x13d899=0xce;}_0x4717be[_0xf3ba('0x1d')](_0x13d899);return _0x4717be['set'](_0xf3ba('0x22'),_0x301856+'-'+_0x29e45b+'/'+_0x53f848)[_0xf3ba('0x1f')](_0x235c8a);}return null;};}function patchUpdates(_0x4e601c){return function(_0x479d65){try{jsonpatch[_0xf3ba('0x23')](_0x479d65,_0x4e601c,!![]);}catch(_0x2bd5b8){return BPromise[_0xf3ba('0x24')](_0x2bd5b8);}return _0x479d65['save']();};}function saveUpdates(_0x375bcf,_0x327723){return function(_0x35d6d4){if(_0x35d6d4){return _0x35d6d4[_0xf3ba('0x25')](_0x375bcf)[_0xf3ba('0x26')](function(_0x3480cb){return _0x3480cb;});}return null;};}function removeEntity(_0x168961,_0x4caf74){return function(_0x4e94a7){if(_0x4e94a7){return _0x4e94a7['destroy']()[_0xf3ba('0x26')](function(){_0x168961[_0xf3ba('0x1d')](0xcc)[_0xf3ba('0x1e')]();});}};}function handleEntityNotFound(_0x3b6404,_0x2cc01a){return function(_0x545ee1){if(!_0x545ee1){_0x3b6404['sendStatus'](0x194);}return _0x545ee1;};}function handleError(_0x37fdda,_0xd6c2da){_0xd6c2da=_0xd6c2da||0x1f4;return function(_0x5410a2){logger[_0xf3ba('0x27')](_0x5410a2[_0xf3ba('0x28')]);if(_0x5410a2['name']){delete _0x5410a2['name'];}_0x37fdda[_0xf3ba('0x1d')](_0xd6c2da)[_0xf3ba('0x29')](_0x5410a2);};}exports['index']=function(_0x18a4fb,_0x318817){var _0x15ac44={},_0x5a880e={},_0x29ed57={'count':0x0,'rows':[]};var _0x4e1708=_['map'](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')],function(_0x5b4e0d){return{'name':_0x5b4e0d[_0xf3ba('0x2c')],'type':_0x5b4e0d[_0xf3ba('0x2d')]['key']};});_0x5a880e['model']=_['map'](_0x4e1708,_0xf3ba('0x2e'));_0x5a880e[_0xf3ba('0x2f')]=_['keys'](_0x18a4fb[_0xf3ba('0x2f')]);_0x5a880e['filters']=_['intersection'](_0x5a880e[_0xf3ba('0x30')],_0x5a880e[_0xf3ba('0x2f')]);_0x15ac44[_0xf3ba('0x31')]=_[_0xf3ba('0x32')](_0x5a880e[_0xf3ba('0x30')],qs[_0xf3ba('0x33')](_0x18a4fb['query'][_0xf3ba('0x33')]));_0x15ac44['attributes']=_0x15ac44[_0xf3ba('0x31')][_0xf3ba('0x34')]?_0x15ac44['attributes']:_0x5a880e[_0xf3ba('0x30')];if(!_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x35')](_0xf3ba('0x36'))){_0x15ac44['limit']=qs[_0xf3ba('0x21')](_0x18a4fb['query']['limit']);_0x15ac44['offset']=qs[_0xf3ba('0x20')](_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x20')]);}_0x15ac44[_0xf3ba('0x37')]=qs[_0xf3ba('0x38')](_0x18a4fb['query'][_0xf3ba('0x38')]);_0x15ac44['where']=qs[_0xf3ba('0x39')](_['pick'](_0x18a4fb[_0xf3ba('0x2f')],_0x5a880e[_0xf3ba('0x39')]),_0x4e1708);if(_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x3a')]){_0x15ac44['where']=_[_0xf3ba('0x3b')](_0x15ac44[_0xf3ba('0x3c')],{'$or':_['map'](_0x4e1708,function(_0x3d844d){if(_0x3d844d[_0xf3ba('0x2d')]!==_0xf3ba('0x3d')){var _0x498570={};_0x498570[_0x3d844d[_0xf3ba('0x2e')]]={'$like':'%'+_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x3a')]+'%'};return _0x498570;}})});}_0x15ac44=_['merge']({},_0x15ac44,_0x18a4fb[_0xf3ba('0x3e')]);var _0x527092={'where':_0x15ac44[_0xf3ba('0x3c')]};return db['ChatOfflineMessage'][_0xf3ba('0x3f')](_0x527092)[_0xf3ba('0x26')](function(_0x1251b1){_0x29ed57[_0xf3ba('0x3f')]=_0x1251b1;if(_0x18a4fb[_0xf3ba('0x2f')]['includeAll']){_0x15ac44['include']=[{'all':!![]}];}return db[_0xf3ba('0x2a')][_0xf3ba('0x40')](_0x15ac44);})[_0xf3ba('0x26')](function(_0x433752){_0x29ed57[_0xf3ba('0x41')]=_0x433752;return _0x29ed57;})[_0xf3ba('0x26')](respondWithFilteredResult(_0x318817,_0x15ac44))['catch'](handleError(_0x318817,null));};exports[_0xf3ba('0x42')]=function(_0x4b9c9e,_0x42b805){var _0x239e2a={'raw':!![],'where':{'id':_0x4b9c9e[_0xf3ba('0x43')]['id']}},_0x2328d5={};_0x2328d5[_0xf3ba('0x30')]=_[_0xf3ba('0x44')](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')]);_0x2328d5['query']=_[_0xf3ba('0x44')](_0x4b9c9e[_0xf3ba('0x2f')]);_0x2328d5[_0xf3ba('0x39')]=_[_0xf3ba('0x32')](_0x2328d5[_0xf3ba('0x30')],_0x2328d5[_0xf3ba('0x2f')]);_0x239e2a[_0xf3ba('0x31')]=_['intersection'](_0x2328d5[_0xf3ba('0x30')],qs[_0xf3ba('0x33')](_0x4b9c9e['query'][_0xf3ba('0x33')]));_0x239e2a[_0xf3ba('0x31')]=_0x239e2a[_0xf3ba('0x31')][_0xf3ba('0x34')]?_0x239e2a[_0xf3ba('0x31')]:_0x2328d5[_0xf3ba('0x30')];if(_0x4b9c9e[_0xf3ba('0x2f')][_0xf3ba('0x45')]){_0x239e2a[_0xf3ba('0x46')]=[{'all':!![]}];}_0x239e2a=_[_0xf3ba('0x3b')]({},_0x239e2a,_0x4b9c9e[_0xf3ba('0x3e')]);return db[_0xf3ba('0x2a')][_0xf3ba('0x47')](_0x239e2a)[_0xf3ba('0x26')](handleEntityNotFound(_0x42b805,null))[_0xf3ba('0x26')](respondWithResult(_0x42b805,null))[_0xf3ba('0x48')](handleError(_0x42b805,null));};exports[_0xf3ba('0x49')]=function(_0x3afc3e,_0x4f251b){return db[_0xf3ba('0x2a')][_0xf3ba('0x49')](_0x3afc3e['body'],{})[_0xf3ba('0x26')](respondWithResult(_0x4f251b,0xc9))[_0xf3ba('0x48')](handleError(_0x4f251b,null));};exports[_0xf3ba('0x25')]=function(_0x36f476,_0x52ef61){if(_0x36f476['body']['id']){delete _0x36f476[_0xf3ba('0x4a')]['id'];}return db[_0xf3ba('0x2a')][_0xf3ba('0x47')]({'where':{'id':_0x36f476[_0xf3ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ef61,null))[_0xf3ba('0x26')](saveUpdates(_0x36f476[_0xf3ba('0x4a')],null))[_0xf3ba('0x26')](respondWithResult(_0x52ef61,null))['catch'](handleError(_0x52ef61,null));};exports[_0xf3ba('0x4b')]=function(_0x425304,_0x3dd531){return db[_0xf3ba('0x2a')][_0xf3ba('0x47')]({'where':{'id':_0x425304[_0xf3ba('0x43')]['id']}})[_0xf3ba('0x26')](handleEntityNotFound(_0x3dd531,null))[_0xf3ba('0x26')](removeEntity(_0x3dd531,null))[_0xf3ba('0x48')](handleError(_0x3dd531,null));};exports[_0xf3ba('0x4c')]=function(_0x534426,_0x5a30f9){return db[_0xf3ba('0x2a')][_0xf3ba('0x4c')]()[_0xf3ba('0x26')](respondWithResult(_0x5a30f9,null))['catch'](handleError(_0x5a30f9,null));}; \ No newline at end of file +var _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x239608,_0x40559a){var _0x285922=function(_0x22c71c){while(--_0x22c71c){_0x239608['push'](_0x239608['shift']());}};_0x285922(++_0x40559a);}(_0xe14b,0x93));var _0xbe14=function(_0x460956,_0x1d613d){_0x460956=_0x460956-0x0;var _0x3b99e6=_0xe14b[_0x460956];return _0x3b99e6;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['ChatOfflineMessage'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4fddcf8..2644092 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 _0xae77=['lodash','bluebird','request-promise','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x13a80b,_0x28ca68){var _0x4ddbe6=function(_0x4d0ab9){while(--_0x4d0ab9){_0x13a80b['push'](_0x13a80b['shift']());}};_0x4ddbe6(++_0x28ca68);}(_0xae77,0x1cc));var _0x7ae7=function(_0x55328,_0x56beb2){_0x55328=_0x55328-0x0;var _0x4216da=_0xae77[_0x55328];return _0x4216da;};'use strict';var _=require(_0x7ae7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7ae7('0x1'));var rp=require(_0x7ae7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ae7('0x3'));var attributes=require(_0x7ae7('0x4'));module[_0x7ae7('0x5')]=function(_0x4280b8,_0xf020f7){return _0x4280b8[_0x7ae7('0x6')]('ChatOfflineMessage',attributes,{'tableName':_0x7ae7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ae7('0x8'),'collate':_0x7ae7('0x9')});}; \ No newline at end of file +var _0x8f88=['request-promise','path','../../config/environment','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x8f88,0x152));var _0x88f8=function(_0x2c2390,_0x37ef1c){_0x2c2390=_0x2c2390-0x0;var _0x478b7e=_0x8f88[_0x2c2390];return _0x478b7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x88f8('0x0'));var moment=require(_0x88f8('0x1'));var BPromise=require(_0x88f8('0x2'));var rp=require(_0x88f8('0x3'));var fs=require('fs');var path=require(_0x88f8('0x4'));var rimraf=require('rimraf');var config=require(_0x88f8('0x5'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x46a38b,_0x58573a){return _0x46a38b[_0x88f8('0x6')](_0x88f8('0x7'),attributes,{'tableName':_0x88f8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88f8('0x9'),'collate':_0x88f8('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 86a9bec..f7acd77 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 _0x7155=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment'];(function(_0x21fded,_0x203183){var _0x5927de=function(_0x1e5762){while(--_0x1e5762){_0x21fded['push'](_0x21fded['shift']());}};_0x5927de(++_0x203183);}(_0x7155,0x1cd));var _0x5715=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7155[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5715('0x0'));var BPromise=require(_0x5715('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5715('0x2'));var db=require(_0x5715('0x3'))['db'];var utils=require(_0x5715('0x4'));var logger=require(_0x5715('0x5'))(_0x5715('0x6'));var config=require(_0x5715('0x7'));var jayson=require(_0x5715('0x8'));var client=jayson[_0x5715('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dc34a,_0x5de47a,_0x64cecc){return new BPromise(function(_0x150810,_0x464c7d){return client[_0x5715('0xa')](_0x5dc34a,_0x64cecc)[_0x5715('0xb')](function(_0x31212b){logger[_0x5715('0xc')](_0x5715('0xd'),_0x5de47a,_0x5715('0xe'));logger['debug'](_0x5715('0xf'),_0x5de47a,_0x5715('0xe'),JSON[_0x5715('0x10')](_0x31212b));if(_0x31212b['error']){if(_0x31212b[_0x5715('0x11')][_0x5715('0x12')]===0x1f4){logger[_0x5715('0x11')](_0x5715('0xd'),_0x5de47a,_0x31212b[_0x5715('0x11')][_0x5715('0x13')]);return _0x464c7d(_0x31212b['error'][_0x5715('0x13')]);}logger[_0x5715('0x11')](_0x5715('0xd'),_0x5de47a,_0x31212b['error'][_0x5715('0x13')]);return _0x150810(_0x31212b['error'][_0x5715('0x13')]);}else{logger[_0x5715('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5de47a,'request\x20sent');_0x150810(_0x31212b[_0x5715('0x14')][_0x5715('0x13')]);}})[_0x5715('0x15')](function(_0x2d5fd8){logger[_0x5715('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5de47a,_0x2d5fd8);_0x464c7d(_0x2d5fd8);});});} \ No newline at end of file +var _0x360b=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x446969,_0x17b7d3){var _0x43f3fb=function(_0x16ed46){while(--_0x16ed46){_0x446969['push'](_0x446969['shift']());}};_0x43f3fb(++_0x17b7d3);}(_0x360b,0x68));var _0xb360=function(_0xb85542,_0x4b90b7){_0xb85542=_0xb85542-0x0;var _0xf0df12=_0x360b[_0xb85542];return _0xf0df12;};'use strict';var _=require(_0xb360('0x0'));var util=require(_0xb360('0x1'));var moment=require(_0xb360('0x2'));var BPromise=require('bluebird');var rs=require(_0xb360('0x3'));var fs=require('fs');var Redis=require(_0xb360('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb360('0x5'));var logger=require(_0xb360('0x6'))(_0xb360('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb360('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc65374,_0x38b0e7,_0x1be650){return new BPromise(function(_0xf041f8,_0x41a5df){return client[_0xb360('0x9')](_0xc65374,_0x1be650)['then'](function(_0x4fbee4){logger[_0xb360('0xa')](_0xb360('0xb'),_0x38b0e7,_0xb360('0xc'));logger[_0xb360('0xd')](_0xb360('0xe'),_0x38b0e7,_0xb360('0xc'),JSON[_0xb360('0xf')](_0x4fbee4));if(_0x4fbee4['error']){if(_0x4fbee4[_0xb360('0x10')][_0xb360('0x11')]===0x1f4){logger[_0xb360('0x10')](_0xb360('0xb'),_0x38b0e7,_0x4fbee4[_0xb360('0x10')]['message']);return _0x41a5df(_0x4fbee4[_0xb360('0x10')]['message']);}logger[_0xb360('0x10')](_0xb360('0xb'),_0x38b0e7,_0x4fbee4[_0xb360('0x10')][_0xb360('0x12')]);return _0xf041f8(_0x4fbee4[_0xb360('0x10')][_0xb360('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x38b0e7,_0xb360('0xc'));_0xf041f8(_0x4fbee4[_0xb360('0x13')][_0xb360('0x12')]);}})[_0xb360('0x14')](function(_0x4781bf){logger[_0xb360('0x10')](_0xb360('0xb'),_0x38b0e7,_0x4781bf);_0x41a5df(_0x4781bf);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 06124c6..7a9fa91 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 _0x489f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2c42c8,_0x47255d){var _0x3625c1=function(_0x16ca1f){while(--_0x16ca1f){_0x2c42c8['push'](_0x2c42c8['shift']());}};_0x3625c1(++_0x47255d);}(_0x489f,0x74));var _0xf489=function(_0x168a88,_0x3cc193){_0x168a88=_0x168a88-0x0;var _0x40943b=_0x489f[_0x168a88];return _0x40943b;};'use strict';var multer=require(_0xf489('0x0'));var util=require(_0xf489('0x1'));var path=require(_0xf489('0x2'));var timeout=require(_0xf489('0x3'));var express=require(_0xf489('0x4'));var router=express['Router']();var auth=require(_0xf489('0x5'));var interaction=require(_0xf489('0x6'));var config=require(_0xf489('0x7'));var controller=require(_0xf489('0x8'));router[_0xf489('0x9')]('/',auth[_0xf489('0xa')](),controller['index']);router['get'](_0xf489('0xb'),auth[_0xf489('0xa')](),controller[_0xf489('0xc')]);router[_0xf489('0x9')](_0xf489('0xd'),auth[_0xf489('0xa')](),controller[_0xf489('0xe')]);router[_0xf489('0xf')]('/',auth[_0xf489('0xa')](),controller[_0xf489('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf489('0x11')](_0xf489('0xd'),auth[_0xf489('0xa')](),controller[_0xf489('0x12')]);module[_0xf489('0x13')]=router; \ No newline at end of file +var _0x5468=['path','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','show','create','put','update','delete','/:id','exports','multer','util'];(function(_0x5300e9,_0x4f2695){var _0x2410de=function(_0x165390){while(--_0x165390){_0x5300e9['push'](_0x5300e9['shift']());}};_0x2410de(++_0x4f2695);}(_0x5468,0x11e));var _0x8546=function(_0x259c99,_0x28fc7b){_0x259c99=_0x259c99-0x0;var _0x589fef=_0x5468[_0x259c99];return _0x589fef;};'use strict';var multer=require(_0x8546('0x0'));var util=require(_0x8546('0x1'));var path=require(_0x8546('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8546('0x3')]();var auth=require(_0x8546('0x4'));var interaction=require(_0x8546('0x5'));var config=require('../../config/environment');var controller=require(_0x8546('0x6'));router['get']('/',auth[_0x8546('0x7')](),controller['index']);router[_0x8546('0x8')](_0x8546('0x9'),auth[_0x8546('0x7')](),controller[_0x8546('0xa')]);router[_0x8546('0x8')]('/:id',auth[_0x8546('0x7')](),controller[_0x8546('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8546('0xc')]);router[_0x8546('0xd')]('/:id',auth[_0x8546('0x7')](),controller[_0x8546('0xe')]);router[_0x8546('0xf')](_0x8546('0x10'),auth[_0x8546('0x7')](),controller['destroy']);module[_0x8546('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 54602c0..c4baae2 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 _0x4c5f=['STRING','mouseOver','sequelize','exports'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x4c5f,0xe6));var _0xf4c5=function(_0x592dea,_0x410e09){_0x592dea=_0x592dea-0x0;var _0xaf3266=_0x4c5f[_0x592dea];return _0xaf3266;};'use strict';var Sequelize=require(_0xf4c5('0x0'));module[_0xf4c5('0x1')]={'name':{'type':Sequelize[_0xf4c5('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf4c5('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xf4c5('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1748=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x247902,_0x26d9ca){var _0x4f8697=function(_0x4d2dec){while(--_0x4d2dec){_0x247902['push'](_0x247902['shift']());}};_0x4f8697(++_0x26d9ca);}(_0x1748,0x146));var _0x8174=function(_0xec9511,_0x2497a0){_0xec9511=_0xec9511-0x0;var _0x3e2b4e=_0x1748[_0xec9511];return _0x3e2b4e;};'use strict';var Sequelize=require(_0x8174('0x0'));module[_0x8174('0x1')]={'name':{'type':Sequelize[_0x8174('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8174('0x3'),_0x8174('0x4')),'defaultValue':_0x8174('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8174('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b73d5db..95d33ec 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 _0x70e0=['mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0xe63b9d,_0x15c6c5){var _0x21d653=function(_0xaa126f){while(--_0xaa126f){_0xe63b9d['push'](_0xe63b9d['shift']());}};_0x21d653(++_0x15c6c5);}(_0x70e0,0x17b));var _0x070e=function(_0xe3762e,_0x4a49b9){_0xe3762e=_0xe3762e-0x0;var _0x4d6151=_0x70e0[_0xe3762e];return _0x4d6151;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file +var _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f3888b0..9f1d86b 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 _0x343c=['util','../../config/logger','api','bluebird','path','rimraf','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x343c,0x7e));var _0xc343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x343c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc343('0x0'));var logger=require(_0xc343('0x1'))(_0xc343('0x2'));var moment=require('moment');var BPromise=require(_0xc343('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc343('0x4'));var rimraf=require(_0xc343('0x5'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xc343('0x6')]=function(_0x21daaa,_0x12867b){return _0x21daaa['define'](_0xc343('0x7'),attributes,{'tableName':_0xc343('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc5=['chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','ChatProactiveAction'];(function(_0x56fb7d,_0x539ea1){var _0x3be1c3=function(_0x521d3f){while(--_0x521d3f){_0x56fb7d['push'](_0x56fb7d['shift']());}};_0x3be1c3(++_0x539ea1);}(_0x4fc5,0x123));var _0x54fc=function(_0x327e47,_0x1f69a3){_0x327e47=_0x327e47-0x0;var _0xd2b5cd=_0x4fc5[_0x327e47];return _0xd2b5cd;};'use strict';var _=require(_0x54fc('0x0'));var util=require(_0x54fc('0x1'));var logger=require(_0x54fc('0x2'))('api');var moment=require(_0x54fc('0x3'));var BPromise=require(_0x54fc('0x4'));var rp=require(_0x54fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54fc('0x6'));var config=require(_0x54fc('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x55336d,_0xf6b4ae){return _0x55336d['define'](_0x54fc('0x8'),attributes,{'tableName':_0x54fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index bbe2e58..609e76c 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 _0x45ca=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x203a3b,_0x58128b){var _0x1aaace=function(_0x40e645){while(--_0x40e645){_0x203a3b['push'](_0x203a3b['shift']());}};_0x1aaace(++_0x58128b);}(_0x45ca,0x122));var _0xa45c=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x45ca[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xa45c('0x0'));var util=require(_0xa45c('0x1'));var moment=require(_0xa45c('0x2'));var BPromise=require(_0xa45c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa45c('0x4'));var db=require(_0xa45c('0x5'))['db'];var utils=require(_0xa45c('0x6'));var logger=require(_0xa45c('0x7'))(_0xa45c('0x8'));var config=require(_0xa45c('0x9'));var jayson=require(_0xa45c('0xa'));var client=jayson[_0xa45c('0xb')][_0xa45c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e7aeb,_0xf76ecd,_0x282582){return new BPromise(function(_0x4c90a0,_0x332942){return client[_0xa45c('0xd')](_0x1e7aeb,_0x282582)['then'](function(_0x22bdc4){logger[_0xa45c('0xe')](_0xa45c('0xf'),_0xf76ecd,_0xa45c('0x10'));logger[_0xa45c('0x11')](_0xa45c('0x12'),_0xf76ecd,'request\x20sent',JSON[_0xa45c('0x13')](_0x22bdc4));if(_0x22bdc4[_0xa45c('0x14')]){if(_0x22bdc4[_0xa45c('0x14')][_0xa45c('0x15')]===0x1f4){logger[_0xa45c('0x14')](_0xa45c('0xf'),_0xf76ecd,_0x22bdc4[_0xa45c('0x14')][_0xa45c('0x16')]);return _0x332942(_0x22bdc4[_0xa45c('0x14')][_0xa45c('0x16')]);}logger['error'](_0xa45c('0xf'),_0xf76ecd,_0x22bdc4['error'][_0xa45c('0x16')]);return _0x4c90a0(_0x22bdc4['error'][_0xa45c('0x16')]);}else{logger[_0xa45c('0xe')](_0xa45c('0xf'),_0xf76ecd,_0xa45c('0x10'));_0x4c90a0(_0x22bdc4[_0xa45c('0x17')]['message']);}})['catch'](function(_0x3bd106){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xf76ecd,_0x3bd106);_0x332942(_0x3bd106);});});} \ No newline at end of file +var _0x1759=['catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x52f2e0,_0x17a399){var _0x3b5e74=function(_0x4671ee){while(--_0x4671ee){_0x52f2e0['push'](_0x52f2e0['shift']());}};_0x3b5e74(++_0x17a399);}(_0x1759,0x1ef));var _0x9175=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x1759[_0x478414];return _0x5eb6b9;};'use strict';var _=require('lodash');var util=require(_0x9175('0x0'));var moment=require(_0x9175('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9175('0x2'))['db'];var utils=require(_0x9175('0x3'));var logger=require(_0x9175('0x4'))(_0x9175('0x5'));var config=require('../../config/environment');var jayson=require(_0x9175('0x6'));var client=jayson['client'][_0x9175('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35af82,_0x2c7227,_0x18f086){return new BPromise(function(_0x2d6917,_0x29cb54){return client[_0x9175('0x8')](_0x35af82,_0x18f086)['then'](function(_0x344ebc){logger[_0x9175('0x9')](_0x9175('0xa'),_0x2c7227,_0x9175('0xb'));logger[_0x9175('0xc')](_0x9175('0xd'),_0x2c7227,_0x9175('0xb'),JSON[_0x9175('0xe')](_0x344ebc));if(_0x344ebc['error']){if(_0x344ebc[_0x9175('0xf')]['code']===0x1f4){logger[_0x9175('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c7227,_0x344ebc[_0x9175('0xf')][_0x9175('0x10')]);return _0x29cb54(_0x344ebc[_0x9175('0xf')][_0x9175('0x10')]);}logger['error'](_0x9175('0xa'),_0x2c7227,_0x344ebc[_0x9175('0xf')]['message']);return _0x2d6917(_0x344ebc['error'][_0x9175('0x10')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2c7227,_0x9175('0xb'));_0x2d6917(_0x344ebc[_0x9175('0x11')][_0x9175('0x10')]);}})[_0x9175('0x12')](function(_0x28b717){logger[_0x9175('0xf')](_0x9175('0xa'),_0x2c7227,_0x28b717);_0x29cb54(_0x28b717);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 06566aa..731d002 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 _0x3dff=['../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x3dff,0x1bc));var _0xf3df=function(_0x103216,_0x6fdbb7){_0x103216=_0x103216-0x0;var _0x5012f6=_0x3dff[_0x103216];return _0x5012f6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf3df('0x0'));var express=require('express');var router=express[_0xf3df('0x1')]();var auth=require(_0xf3df('0x2'));var interaction=require(_0xf3df('0x3'));var config=require(_0xf3df('0x4'));var controller=require(_0xf3df('0x5'));router[_0xf3df('0x6')](_0xf3df('0x7'),auth[_0xf3df('0x8')](),controller[_0xf3df('0x9')]);router[_0xf3df('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf3df('0xb')](_0xf3df('0x7'),auth['isAuthenticated'](),controller[_0xf3df('0xc')]);router[_0xf3df('0xd')](_0xf3df('0x7'),auth['isAuthenticated'](),controller[_0xf3df('0xe')]);module[_0xf3df('0xf')]=router; \ No newline at end of file +var _0x1979=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update'];(function(_0x307f13,_0x27e474){var _0x28eab2=function(_0x427d1d){while(--_0x427d1d){_0x307f13['push'](_0x307f13['shift']());}};_0x28eab2(++_0x27e474);}(_0x1979,0x156));var _0x9197=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x1979[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require('multer');var util=require(_0x9197('0x0'));var path=require(_0x9197('0x1'));var timeout=require(_0x9197('0x2'));var express=require(_0x9197('0x3'));var router=express[_0x9197('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9197('0x5'));var config=require(_0x9197('0x6'));var controller=require(_0x9197('0x7'));router[_0x9197('0x8')](_0x9197('0x9'),auth[_0x9197('0xa')](),controller[_0x9197('0xb')]);router[_0x9197('0xc')]('/',auth[_0x9197('0xa')](),controller['create']);router[_0x9197('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9197('0xe')]);router['delete'](_0x9197('0x9'),auth[_0x9197('0xa')](),controller[_0x9197('0xf')]);module[_0x9197('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b02c293..ae25c30 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 _0xdaab=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x3e31b3,_0x4bbc02){var _0x2d701b=function(_0x277b0f){while(--_0x277b0f){_0x3e31b3['push'](_0x3e31b3['shift']());}};_0x2d701b(++_0x4bbc02);}(_0xdaab,0x1b5));var _0xbdaa=function(_0x4cd727,_0x37335e){_0x4cd727=_0x4cd727-0x0;var _0x9f3a81=_0xdaab[_0x4cd727];return _0x9f3a81;};'use strict';var Sequelize=require('sequelize');module[_0xbdaa('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbdaa('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbdaa('0x2')]},'timeout':{'type':Sequelize[_0xbdaa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbdaa('0x4')](_0xbdaa('0x5'),_0xbdaa('0x6'),_0xbdaa('0x7'))}}; \ No newline at end of file +var _0x24ac=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x168358,_0x3f253e){var _0x52c54c=function(_0x433d4a){while(--_0x433d4a){_0x168358['push'](_0x168358['shift']());}};_0x52c54c(++_0x3f253e);}(_0x24ac,0x1a8));var _0xc24a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc24a('0x0'));module[_0xc24a('0x1')]={'name':{'type':Sequelize[_0xc24a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc24a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc24a('0x3')](_0xc24a('0x4'),_0xc24a('0x5'),_0xc24a('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 771974a..624d3cb 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 _0x23b2=['chatPause','updatedAt','createdAt','format','SIP','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','get','ChatQueues','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','User','agent'];(function(_0x487360,_0x3c8497){var _0x4c211a=function(_0x74696e){while(--_0x74696e){_0x487360['push'](_0x487360['shift']());}};_0x4c211a(++_0x3c8497);}(_0x23b2,0x15e));var _0x223b=function(_0x537744,_0x11afa7){_0x537744=_0x537744-0x0;var _0x2c999a=_0x23b2[_0x537744];return _0x2c999a;};'use strict';var pdf=require(_0x223b('0x0'));var emlformat=require(_0x223b('0x1'));var rimraf=require(_0x223b('0x2'));var zipdir=require(_0x223b('0x3'));var jsonpatch=require(_0x223b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x223b('0x5'));var Mustache=require(_0x223b('0x6'));var util=require(_0x223b('0x7'));var path=require(_0x223b('0x8'));var sox=require(_0x223b('0x9'));var csv=require(_0x223b('0xa'));var ejs=require(_0x223b('0xb'));var fs=require('fs');var _=require(_0x223b('0xc'));var squel=require(_0x223b('0xd'));var crypto=require('crypto');var jsforce=require(_0x223b('0xe'));var deskjs=require(_0x223b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x223b('0x10'));var authService=require(_0x223b('0x11'));var qs=require(_0x223b('0x12'));var as=require(_0x223b('0x13'));var hardwareService=require(_0x223b('0x14'));var logger=require('../../config/logger')(_0x223b('0x15'));var utils=require(_0x223b('0x16'));var config=require(_0x223b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x223b('0x18')](config[_0x223b('0x19')],{'host':_0x223b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x223b('0x19')]));require(_0x223b('0x1b'))[_0x223b('0x1c')](socket);var jayson=require(_0x223b('0x1d'));var client=jayson[_0x223b('0x1e')][_0x223b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x2bf46b,_0x4a2459,_0x4387b0){if(_0x4387b0){var _0x31cd1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31cd1f[_0x223b('0x20')](_0x4a2459)){return _0x2bf46b;}else{throw new db[(_0x223b('0x21'))][(_0x223b('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 _0x2bf46b;}}function respondWithRpcPromise(_0x56e5de,_0x1b6955,_0x8b27d6,_0x1bc457){return new BPromise(function(_0x598aec,_0x322d7c){var _0x14986a=_0x1bc457||client;return _0x14986a[_0x223b('0x23')](_0x56e5de,_0x8b27d6)['then'](function(_0x15cd9e){logger[_0x223b('0x24')](_0x223b('0x25'),_0x1b6955,_0x223b('0x26'));logger[_0x223b('0x27')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1b6955,_0x223b('0x26'),JSON['stringify'](_0x15cd9e));if(_0x15cd9e[_0x223b('0x28')]){if(_0x15cd9e['error']['code']===0x1f4){logger[_0x223b('0x28')](_0x223b('0x25'),_0x1b6955,_0x15cd9e['error']['message']);return _0x322d7c(_0x15cd9e['error'][_0x223b('0x29')]);}logger['error'](_0x223b('0x25'),_0x1b6955,_0x15cd9e[_0x223b('0x28')]['message']);return _0x598aec(_0x15cd9e['error']['message']);}else{logger[_0x223b('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1b6955,_0x223b('0x26'));_0x598aec(_0x15cd9e[_0x223b('0x2a')][_0x223b('0x29')]);}})[_0x223b('0x2b')](function(_0x4e110d){logger[_0x223b('0x28')](_0x223b('0x25'),_0x1b6955,_0x4e110d);_0x322d7c(_0x4e110d);});});}function respondWithStatusCode(_0x725309,_0xbb0ded){_0xbb0ded=_0xbb0ded||0xcc;return function(_0x1563d6){if(_0x1563d6){return _0x725309['sendStatus'](_0xbb0ded);}return _0x725309[_0x223b('0x2c')](_0xbb0ded)[_0x223b('0x2d')]();};}function respondWithResult(_0x3f0193,_0x260203){_0x260203=_0x260203||0xc8;return function(_0x5122a4){if(_0x5122a4){return _0x3f0193[_0x223b('0x2c')](_0x260203)[_0x223b('0x2e')](_0x5122a4);}};}function respondWithFilteredResult(_0xb9f096,_0x49fd83){return function(_0x3638cc){if(_0x3638cc){var _0x1cd36a=_0x3638cc['count'],_0x176fd2=_0x49fd83[_0x223b('0x2f')],_0x19f215=_0x49fd83[_0x223b('0x2f')]+_0x49fd83['limit'],_0x536f90;if(_0x19f215>=_0x1cd36a){_0x19f215=_0x1cd36a;_0x536f90=0xc8;}else{_0x536f90=0xce;}_0xb9f096['status'](_0x536f90);return _0xb9f096[_0x223b('0x30')](_0x223b('0x31'),_0x176fd2+'-'+_0x19f215+'/'+_0x1cd36a)['json'](_0x3638cc);}return null;};}function patchUpdates(_0x599d30){return function(_0x228fa2){try{jsonpatch['apply'](_0x228fa2,_0x599d30,!![]);}catch(_0x44a7a1){return BPromise[_0x223b('0x32')](_0x44a7a1);}return _0x228fa2[_0x223b('0x33')]();};}function saveUpdates(_0x1b3ba0,_0x1d469b){return function(_0x1aabc9){if(_0x1aabc9){return _0x1aabc9[_0x223b('0x34')](_0x1b3ba0)['then'](function(_0x4a8899){return _0x4a8899;});}return null;};}function removeEntity(_0x5d42f9,_0x1832dd){return function(_0x50e7c2){if(_0x50e7c2){return _0x50e7c2[_0x223b('0x35')]()[_0x223b('0x36')](function(){var _0x3fba14=_0x50e7c2[_0x223b('0x37')]({'plain':!![]});var _0xc3ed75=_0x223b('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0xc3ed75,'resourceId':_0x3fba14['id']}})[_0x223b('0x36')](function(){return _0x50e7c2;});})['then'](function(){_0x5d42f9[_0x223b('0x2c')](0xcc)[_0x223b('0x2d')]();});}};}function handleEntityNotFound(_0xbb435e,_0x291b15){return function(_0x5c44b2){if(!_0x5c44b2){_0xbb435e[_0x223b('0x39')](0x194);}return _0x5c44b2;};}function handleError(_0x562354,_0x3ad5ef){_0x3ad5ef=_0x3ad5ef||0x1f4;return function(_0x2664c9){logger['error'](_0x2664c9[_0x223b('0x3a')]);if(_0x2664c9['name']){delete _0x2664c9[_0x223b('0x3b')];}_0x562354['status'](_0x3ad5ef)[_0x223b('0x3c')](_0x2664c9);};}exports[_0x223b('0x3d')]=function(_0x34567d,_0x4f9daa){var _0x2a3cfd={},_0x28d18b={},_0x4b1ef5={'count':0x0,'rows':[]};var _0x10dfdf=_[_0x223b('0x3e')](db[_0x223b('0x3f')][_0x223b('0x40')],function(_0x4061f6){return{'name':_0x4061f6['fieldName'],'type':_0x4061f6['type'][_0x223b('0x41')]};});_0x28d18b[_0x223b('0x42')]=_[_0x223b('0x3e')](_0x10dfdf,_0x223b('0x3b'));_0x28d18b[_0x223b('0x43')]=_[_0x223b('0x44')](_0x34567d[_0x223b('0x43')]);_0x28d18b['filters']=_[_0x223b('0x45')](_0x28d18b['model'],_0x28d18b['query']);_0x2a3cfd['attributes']=_[_0x223b('0x45')](_0x28d18b[_0x223b('0x42')],qs['fields'](_0x34567d[_0x223b('0x43')][_0x223b('0x46')]));_0x2a3cfd[_0x223b('0x47')]=_0x2a3cfd[_0x223b('0x47')][_0x223b('0x48')]?_0x2a3cfd[_0x223b('0x47')]:_0x28d18b[_0x223b('0x42')];if(!_0x34567d[_0x223b('0x43')]['hasOwnProperty'](_0x223b('0x49'))){_0x2a3cfd[_0x223b('0x4a')]=qs[_0x223b('0x4a')](_0x34567d[_0x223b('0x43')][_0x223b('0x4a')]);_0x2a3cfd[_0x223b('0x2f')]=qs[_0x223b('0x2f')](_0x34567d[_0x223b('0x43')][_0x223b('0x2f')]);}_0x2a3cfd[_0x223b('0x4b')]=qs[_0x223b('0x4c')](_0x34567d['query'][_0x223b('0x4c')]);_0x2a3cfd['where']=qs[_0x223b('0x4d')](_[_0x223b('0x4e')](_0x34567d[_0x223b('0x43')],_0x28d18b['filters']),_0x10dfdf);if(_0x34567d[_0x223b('0x43')][_0x223b('0x4f')]){_0x2a3cfd[_0x223b('0x50')]=_[_0x223b('0x51')](_0x2a3cfd[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x10dfdf,function(_0x64743b){if(_0x64743b[_0x223b('0x52')]!==_0x223b('0x53')){var _0x3068ea={};_0x3068ea[_0x64743b['name']]={'$like':'%'+_0x34567d['query'][_0x223b('0x4f')]+'%'};return _0x3068ea;}})});}_0x2a3cfd=_[_0x223b('0x51')]({},_0x2a3cfd,_0x34567d[_0x223b('0x54')]);var _0x8d7de9={'where':_0x2a3cfd['where']};return db[_0x223b('0x3f')][_0x223b('0x55')](_0x8d7de9)[_0x223b('0x36')](function(_0x143548){_0x4b1ef5[_0x223b('0x55')]=_0x143548;if(_0x34567d[_0x223b('0x43')][_0x223b('0x56')]){_0x2a3cfd[_0x223b('0x57')]=[{'all':!![]}];}return db[_0x223b('0x3f')][_0x223b('0x58')](_0x2a3cfd);})['then'](function(_0x2bb2d4){_0x4b1ef5[_0x223b('0x59')]=_0x2bb2d4;return _0x4b1ef5;})[_0x223b('0x36')](respondWithFilteredResult(_0x4f9daa,_0x2a3cfd))[_0x223b('0x2b')](handleError(_0x4f9daa,null));};exports['show']=function(_0x42fd77,_0x5dff47){var _0x39e52c={'raw':!![],'where':{'id':_0x42fd77['params']['id']}},_0x58b313={};_0x58b313[_0x223b('0x42')]=_[_0x223b('0x44')](db[_0x223b('0x3f')][_0x223b('0x40')]);_0x58b313['query']=_[_0x223b('0x44')](_0x42fd77[_0x223b('0x43')]);_0x58b313['filters']=_[_0x223b('0x45')](_0x58b313['model'],_0x58b313[_0x223b('0x43')]);_0x39e52c[_0x223b('0x47')]=_[_0x223b('0x45')](_0x58b313['model'],qs[_0x223b('0x46')](_0x42fd77[_0x223b('0x43')]['fields']));_0x39e52c[_0x223b('0x47')]=_0x39e52c[_0x223b('0x47')][_0x223b('0x48')]?_0x39e52c[_0x223b('0x47')]:_0x58b313[_0x223b('0x42')];if(_0x42fd77[_0x223b('0x43')][_0x223b('0x56')]){_0x39e52c[_0x223b('0x57')]=[{'all':!![]}];}_0x39e52c=_[_0x223b('0x51')]({},_0x39e52c,_0x42fd77[_0x223b('0x54')]);return db[_0x223b('0x3f')]['find'](_0x39e52c)[_0x223b('0x36')](handleEntityNotFound(_0x5dff47,null))[_0x223b('0x36')](respondWithResult(_0x5dff47,null))['catch'](handleError(_0x5dff47,null));};exports[_0x223b('0x5a')]=function(_0x2cee91,_0x5147c0){return db[_0x223b('0x3f')]['create'](_0x2cee91[_0x223b('0x5b')],{})[_0x223b('0x36')](function(_0x51e992){var _0x5c55dc=_0x2cee91[_0x223b('0x5c')][_0x223b('0x37')]({'plain':!![]});if(!_0x5c55dc)throw new Error(_0x223b('0x5d'));if(_0x5c55dc[_0x223b('0x5e')]==='user'){var _0x3ff12d=_0x51e992[_0x223b('0x37')]({'plain':!![]});var _0x24693d=_0x223b('0x38');return db[_0x223b('0x5f')][_0x223b('0x60')]({'where':{'name':_0x24693d,'userProfileId':_0x5c55dc[_0x223b('0x61')]},'raw':!![]})[_0x223b('0x36')](function(_0x262c2b){if(_0x262c2b&&_0x262c2b['autoAssociation']===0x0){return db['UserProfileResource'][_0x223b('0x5a')]({'name':_0x3ff12d[_0x223b('0x3b')],'resourceId':_0x3ff12d['id'],'type':_0x262c2b[_0x223b('0x3b')],'sectionId':_0x262c2b['id']},{})[_0x223b('0x36')](function(){return _0x51e992;});}else{return _0x51e992;}})[_0x223b('0x2b')](function(_0x389660){logger[_0x223b('0x28')](_0x223b('0x62'),_0x389660);throw _0x389660;});}return _0x51e992;})[_0x223b('0x36')](respondWithResult(_0x5147c0,0xc9))[_0x223b('0x2b')](handleError(_0x5147c0,null));};exports[_0x223b('0x34')]=function(_0x4759f6,_0x262059){if(_0x4759f6[_0x223b('0x5b')]['id']){delete _0x4759f6[_0x223b('0x5b')]['id'];}return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x4759f6[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x262059,null))[_0x223b('0x36')](saveUpdates(_0x4759f6[_0x223b('0x5b')],null))[_0x223b('0x36')](respondWithResult(_0x262059,null))[_0x223b('0x2b')](handleError(_0x262059,null));};exports[_0x223b('0x35')]=function(_0x440d61,_0x467474){return db[_0x223b('0x3f')]['find']({'where':{'id':_0x440d61['params']['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x467474,null))[_0x223b('0x36')](removeEntity(_0x467474,null))[_0x223b('0x2b')](handleError(_0x467474,null));};exports['describe']=function(_0x310d00,_0x2f84f6){return db[_0x223b('0x3f')]['describe']()[_0x223b('0x36')](respondWithResult(_0x2f84f6,null))[_0x223b('0x2b')](handleError(_0x2f84f6,null));};exports['getMembers']=function(_0x2f14f5,_0x4a19b0,_0x5b6c36){var _0x4e08e3={'raw':!![],'where':{}},_0xf42ef4={},_0x2c6154;return db[_0x223b('0x3f')][_0x223b('0x64')]({'where':{'id':_0x2f14f5[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x4a19b0,null))[_0x223b('0x36')](function(_0x5d6ad1){if(_0x5d6ad1){_0x2c6154=_0x5d6ad1['get']({'plain':!![]});_0xf42ef4[_0x223b('0x42')]=_[_0x223b('0x44')](db[_0x223b('0x65')][_0x223b('0x40')]);_0xf42ef4[_0x223b('0x43')]=_['keys'](_0x2f14f5['query']);_0xf42ef4[_0x223b('0x4d')]=_[_0x223b('0x45')](_0xf42ef4[_0x223b('0x42')],_0xf42ef4[_0x223b('0x43')]);_0x4e08e3[_0x223b('0x47')]=_[_0x223b('0x45')](_0xf42ef4[_0x223b('0x42')],qs[_0x223b('0x46')](_0x2f14f5[_0x223b('0x43')][_0x223b('0x46')]));_0x4e08e3[_0x223b('0x47')]=_0x4e08e3[_0x223b('0x47')][_0x223b('0x48')]?_0x4e08e3[_0x223b('0x47')]:_0xf42ef4['model'];if(!_0x2f14f5['query'][_0x223b('0x66')]('nolimit')){_0x4e08e3['limit']=qs[_0x223b('0x4a')](_0x2f14f5[_0x223b('0x43')][_0x223b('0x4a')]);_0x4e08e3[_0x223b('0x2f')]=qs['offset'](_0x2f14f5[_0x223b('0x43')][_0x223b('0x2f')]);}_0x4e08e3[_0x223b('0x4b')]=qs[_0x223b('0x4c')](_0x2f14f5['query'][_0x223b('0x4c')]);_0x4e08e3[_0x223b('0x50')]=qs[_0x223b('0x4d')](_['pick'](_0x2f14f5['query'],_0xf42ef4['filters']));_0x4e08e3[_0x223b('0x50')][_0x223b('0x67')]=_0x5d6ad1['id'];if(_0x2f14f5[_0x223b('0x43')][_0x223b('0x4f')]){_0x4e08e3[_0x223b('0x50')]=_['merge'](_0x4e08e3[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x4e08e3[_0x223b('0x47')],function(_0x3f83bf){var _0x146fe4={};_0x146fe4[_0x3f83bf]={'$like':'%'+_0x2f14f5['query']['filter']+'%'};return _0x146fe4;})});}_0x4e08e3=_[_0x223b('0x51')]({},_0x4e08e3,_0x2f14f5[_0x223b('0x54')]);return db[_0x223b('0x65')][_0x223b('0x58')](_0x4e08e3);}})[_0x223b('0x36')](function(_0x51755c){if(_0x51755c){return db[_0x223b('0x68')]['findAndCountAll']({'where':{'id':_[_0x223b('0x3e')](_0x51755c,'UserId'),'role':_0x223b('0x69')},'attributes':['id','name',_0x223b('0x6a'),_0x223b('0x6b'),_0x223b('0x6c')]});}})[_0x223b('0x36')](function(_0x7e8b15){if(_0x7e8b15){return{'count':_0x7e8b15[_0x223b('0x55')],'rows':_[_0x223b('0x3e')](_0x7e8b15[_0x223b('0x59')],function(_0x44dff9){return{'membername':_0x44dff9[_0x223b('0x3b')],'UserId':_0x44dff9['id'],'queue_name':_0x2c6154[_0x223b('0x3b')],'ChatQueueId':_0x2c6154['id'],'interface':util[_0x223b('0x6d')]('%s/%s',_0x223b('0x6e'),_0x44dff9[_0x223b('0x3b')]),'penalty':0x0,'paused':_0x44dff9[_0x223b('0x6a')],'createdAt':_0x44dff9[_0x223b('0x6c')],'updatedAt':_0x44dff9[_0x223b('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a19b0,_0x4e08e3))[_0x223b('0x2b')](handleError(_0x4a19b0,null));};exports[_0x223b('0x6f')]=function(_0xfafece,_0x58c77a,_0x565962){var _0x1f57a9={};var _0x269fd6={};var _0x2f0ed7;var _0x28aa33;return db[_0x223b('0x3f')]['findOne']({'where':{'id':_0xfafece[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x58c77a,null))[_0x223b('0x36')](function(_0x2bf8ab){if(_0x2bf8ab){_0x2f0ed7=_0x2bf8ab;_0x269fd6[_0x223b('0x42')]=_[_0x223b('0x44')](db['Team'][_0x223b('0x40')]);_0x269fd6[_0x223b('0x43')]=_[_0x223b('0x44')](_0xfafece['query']);_0x269fd6[_0x223b('0x4d')]=_[_0x223b('0x45')](_0x269fd6[_0x223b('0x42')],_0x269fd6['query']);_0x1f57a9[_0x223b('0x47')]=_['intersection'](_0x269fd6[_0x223b('0x42')],qs[_0x223b('0x46')](_0xfafece['query'][_0x223b('0x46')]));_0x1f57a9['attributes']=_0x1f57a9[_0x223b('0x47')]['length']?_0x1f57a9['attributes']:_0x269fd6[_0x223b('0x42')];_0x1f57a9['order']=qs[_0x223b('0x4c')](_0xfafece['query'][_0x223b('0x4c')]);_0x1f57a9[_0x223b('0x50')]=qs[_0x223b('0x4d')](_[_0x223b('0x4e')](_0xfafece[_0x223b('0x43')],_0x269fd6['filters']));if(_0xfafece[_0x223b('0x43')][_0x223b('0x4f')]){_0x1f57a9['where']=_[_0x223b('0x51')](_0x1f57a9[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x1f57a9['attributes'],function(_0x1cbc28){var _0x1eda33={};_0x1eda33[_0x1cbc28]={'$like':'%'+_0xfafece['query'][_0x223b('0x4f')]+'%'};return _0x1eda33;})});}_0x1f57a9=_['merge']({},_0x1f57a9,_0xfafece[_0x223b('0x54')]);return _0x2f0ed7['getTeams'](_0x1f57a9);}})[_0x223b('0x36')](function(_0x399d6e){if(_0x399d6e){_0x28aa33=_0x399d6e['length'];if(!_0xfafece['query'][_0x223b('0x66')]('nolimit')){_0x1f57a9[_0x223b('0x4a')]=qs[_0x223b('0x4a')](_0xfafece[_0x223b('0x43')][_0x223b('0x4a')]);_0x1f57a9[_0x223b('0x2f')]=qs['offset'](_0xfafece[_0x223b('0x43')][_0x223b('0x2f')]);}return _0x2f0ed7[_0x223b('0x6f')](_0x1f57a9);}})[_0x223b('0x36')](function(_0x1dbf53){if(_0x1dbf53){return _0x1dbf53?{'count':_0x28aa33,'rows':_0x1dbf53}:null;}})[_0x223b('0x36')](respondWithResult(_0x58c77a,null))[_0x223b('0x2b')](handleError(_0x58c77a,null));};exports['addTeams']=function(_0x3c1005,_0x9dfcba,_0x52d7b5){var _0x4fdec5=_0x3c1005[_0x223b('0x5b')][_0x223b('0x70')];return db[_0x223b('0x71')][_0x223b('0x58')]({'where':{'id':_0x4fdec5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x223b('0x72'),'attributes':['id',_0x223b('0x3b'),_0x223b('0x73'),_0x223b('0x74'),_0x223b('0x75')],'raw':!![]}]})[_0x223b('0x36')](function(_0x53f430){if(_0x53f430){var _0x300a2e=_[_0x223b('0x76')](_0x53f430,function(_0x4dcc3c){var _0x28dd2e=_0x4dcc3c[_0x223b('0x37')]({'plain':!![]});return _0x28dd2e[_0x223b('0x72')];});return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x3c1005[_0x223b('0x63')]['id']}})[_0x223b('0x36')](function(_0x229197){return db[_0x223b('0x77')][_0x223b('0x78')](function(_0x658a78){return _0x229197[_0x223b('0x79')](_0x4fdec5,{'transaction':_0x658a78})['then'](function(){return BPromise[_0x223b('0x7a')](_0x300a2e,function(_0x312eb5){return db[_0x223b('0x65')][_0x223b('0x7b')]({'where':{'UserId':_0x312eb5['id'],'ChatQueueId':_0x3c1005[_0x223b('0x63')]['id']},'transaction':_0x658a78});});})[_0x223b('0x36')](function(){_0x300a2e[_0x223b('0x7c')](function(_0xeda2fd){socket[_0x223b('0x7d')](_0x223b('0x7e'),{'UserId':_0xeda2fd['id'],'ChatQueueId':_0x229197['id']});});});});});}})['then'](respondWithStatusCode(_0x9dfcba,null))[_0x223b('0x2b')](handleError(_0x9dfcba,null));};exports[_0x223b('0x7f')]=function(_0x293408,_0x28069c,_0xe79029){return db[_0x223b('0x71')][_0x223b('0x58')]({'where':{'id':_0x293408[_0x223b('0x43')][_0x223b('0x70')]},'attributes':['id'],'include':[{'model':db[_0x223b('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x223b('0x36')](handleEntityNotFound(_0x28069c,null))[_0x223b('0x36')](function(_0x17b423){var _0x47077b=_[_0x223b('0x3e')](_0x17b423,'id');var _0x1136d3=[];var _0x275ed8=[];var _0x5e9ee9=squel[_0x223b('0x80')]();_0x5e9ee9[_0x223b('0x81')]('tq.TeamId')[_0x223b('0x82')]('team_has_chat_queues','tq')[_0x223b('0x83')](_0x223b('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x223b('0x50')]('ChatQueueId\x20=\x20?',_0x293408[_0x223b('0x63')]['id']);for(var _0x1799c1=0x0;_0x1799c1<_0x17b423[_0x223b('0x48')];_0x1799c1+=0x1){let _0xa64683=_0x17b423[_0x1799c1];for(var _0x474fa2=0x0;_0x474fa2<_0xa64683[_0x223b('0x72')][_0x223b('0x48')];_0x474fa2+=0x1){let _0x4a7597=_0xa64683[_0x223b('0x72')][_0x474fa2];var _0x3dfc8c=_0x5e9ee9[_0x223b('0x85')]();_0x3dfc8c[_0x223b('0x50')](_0x223b('0x86'),_0x4a7597['id']);_0x275ed8[_0x223b('0x87')](db[_0x223b('0x77')][_0x223b('0x43')](_0x3dfc8c[_0x223b('0x88')](),{'type':db[_0x223b('0x77')][_0x223b('0x89')][_0x223b('0x8a')]})['then'](function(_0x9ae836){if(_0x9ae836[_0x223b('0x48')]===0x1){return _0x4a7597['id'];}else{var _0x44e9d0=_[_0x223b('0x8b')](_[_0x223b('0x3e')](_0x9ae836,_0x223b('0x8c')),function(_0x272fb0){return _[_0x223b('0x8d')](_0x47077b,_0x272fb0);});if(_0x44e9d0){return _0x4a7597['id'];}}}));}}return BPromise[_0x223b('0x8e')](_0x275ed8)['then'](function(_0x2eb8db){_0x1136d3=_(_0x1136d3)[_0x223b('0x8f')](_0x2eb8db)[_0x223b('0x90')]()[_0x223b('0x91')]();return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x293408[_0x223b('0x63')]['id']}})[_0x223b('0x36')](function(_0x4a9039){return db[_0x223b('0x77')][_0x223b('0x78')](function(_0x58bab9){return _0x4a9039[_0x223b('0x7f')](_0x293408[_0x223b('0x43')][_0x223b('0x70')],{'transaction':_0x58bab9})[_0x223b('0x36')](function(){if(!_['isEmpty'](_0x1136d3)){return _0x4a9039[_0x223b('0x92')](_0x1136d3,{'transaction':_0x58bab9});}})[_0x223b('0x36')](function(){_0x1136d3[_0x223b('0x7c')](function(_0x192260){socket[_0x223b('0x7d')]('userChatQueue:remove',{'UserId':_0x192260,'ChatQueueId':_0x4a9039['id']});});});});});});})[_0x223b('0x36')](respondWithStatusCode(_0x28069c,null))[_0x223b('0x2b')](handleError(_0x28069c,null));};exports[_0x223b('0x93')]=function(_0x5cd9f7,_0x4b0229,_0x25701f){return db[_0x223b('0x3f')]['find']({'where':{'id':_0x5cd9f7[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x4b0229,null))[_0x223b('0x36')](function(_0x45bd57){if(_0x45bd57){return _0x45bd57[_0x223b('0x93')](_0x5cd9f7[_0x223b('0x5b')][_0x223b('0x70')],_[_0x223b('0x94')](_0x5cd9f7[_0x223b('0x5b')],[_0x223b('0x70'),'id'])||{})['spread'](function(_0x1c207f){for(var _0x1c9faf=0x0;_0x1c9faf<_0x5cd9f7[_0x223b('0x5b')]['ids']['length'];_0x1c9faf+=0x1){socket[_0x223b('0x7d')](_0x223b('0x7e'),{'UserId':_0x5cd9f7[_0x223b('0x5b')]['ids'][_0x1c9faf],'ChatQueueId':_0x5cd9f7['params']['id']});}return _0x1c207f;});}})['then'](respondWithResult(_0x4b0229,null))['catch'](handleError(_0x4b0229,null));};exports['removeAgents']=function(_0x5e5e67,_0x29d898,_0x46c5f2){return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x5e5e67[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x29d898,null))[_0x223b('0x36')](function(_0x56afff){if(_0x56afff){return _0x56afff[_0x223b('0x92')](_0x5e5e67[_0x223b('0x43')][_0x223b('0x70')])[_0x223b('0x36')](function(){if(_[_0x223b('0x95')](_0x5e5e67[_0x223b('0x43')]['ids'])){for(var _0x2b5c89=0x0;_0x2b5c89<_0x5e5e67[_0x223b('0x43')][_0x223b('0x70')][_0x223b('0x48')];_0x2b5c89+=0x1){socket['emit'](_0x223b('0x96'),{'UserId':Number(_0x5e5e67['query']['ids'][_0x2b5c89]),'ChatQueueId':Number(_0x5e5e67[_0x223b('0x63')]['id'])});}}else{socket[_0x223b('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x5e5e67[_0x223b('0x43')][_0x223b('0x70')]),'ChatQueueId':Number(_0x5e5e67[_0x223b('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x29d898,null))['catch'](handleError(_0x29d898,null));};exports['getAgents']=function(_0x864799,_0x4ae963,_0x51274c){var _0x12ab72={};var _0x1253ed={};var _0x471079;var _0x27e0f5;return db[_0x223b('0x3f')][_0x223b('0x64')]({'where':{'id':_0x864799[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x4ae963,null))[_0x223b('0x36')](function(_0x12e5cc){if(_0x12e5cc){_0x471079=_0x12e5cc;_0x1253ed[_0x223b('0x42')]=_['keys'](db['User'][_0x223b('0x40')]);_0x1253ed[_0x223b('0x43')]=_[_0x223b('0x44')](_0x864799['query']);_0x1253ed[_0x223b('0x4d')]=_[_0x223b('0x45')](_0x1253ed[_0x223b('0x42')],_0x1253ed[_0x223b('0x43')]);_0x12ab72['attributes']=_['intersection'](_0x1253ed['model'],qs[_0x223b('0x46')](_0x864799[_0x223b('0x43')][_0x223b('0x46')]));_0x12ab72[_0x223b('0x47')]=_0x12ab72['attributes']['length']?_0x12ab72['attributes']:_0x1253ed[_0x223b('0x42')];_0x12ab72['order']=qs[_0x223b('0x4c')](_0x864799['query'][_0x223b('0x4c')]);_0x12ab72[_0x223b('0x50')]=qs[_0x223b('0x4d')](_[_0x223b('0x4e')](_0x864799[_0x223b('0x43')],_0x1253ed['filters']));if(_0x864799['query'][_0x223b('0x4f')]){_0x12ab72[_0x223b('0x50')]=_[_0x223b('0x51')](_0x12ab72[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x12ab72[_0x223b('0x47')],function(_0x502cc2){var _0x4a1c8c={};_0x4a1c8c[_0x502cc2]={'$like':'%'+_0x864799[_0x223b('0x43')][_0x223b('0x4f')]+'%'};return _0x4a1c8c;})});}_0x12ab72=_[_0x223b('0x51')]({},_0x12ab72,_0x864799[_0x223b('0x54')]);return _0x471079['getAgents'](_0x12ab72);}})['then'](function(_0x563db8){if(_0x563db8){_0x27e0f5=_0x563db8[_0x223b('0x48')];if(!_0x864799[_0x223b('0x43')][_0x223b('0x66')]('nolimit')){_0x12ab72[_0x223b('0x4a')]=qs['limit'](_0x864799[_0x223b('0x43')][_0x223b('0x4a')]);_0x12ab72['offset']=qs[_0x223b('0x2f')](_0x864799[_0x223b('0x43')][_0x223b('0x2f')]);}return _0x471079[_0x223b('0x97')](_0x12ab72);}})[_0x223b('0x36')](function(_0x2f6808){if(_0x2f6808){return _0x2f6808?{'count':_0x27e0f5,'rows':_0x2f6808}:null;}})[_0x223b('0x36')](respondWithResult(_0x4ae963,null))[_0x223b('0x2b')](handleError(_0x4ae963,null));}; \ No newline at end of file +var _0xd5d3=['save','ChatQueues','UserProfileResource','destroy','stack','name','index','map','ChatQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','include','findAll','rows','catch','params','rawAttributes','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','order','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','length','addTeams','ids','Agents','online','interface','flatMap','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','value','transaction','isEmpty','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x520cac,_0x12824c){var _0x5f1a80=function(_0x54c36f){while(--_0x54c36f){_0x520cac['push'](_0x520cac['shift']());}};_0x5f1a80(++_0x12824c);}(_0xd5d3,0x1a5));var _0x3d5d=function(_0x3ce2e2,_0x5333f4){_0x3ce2e2=_0x3ce2e2-0x0;var _0x1a6338=_0xd5d3[_0x3ce2e2];return _0x1a6338;};'use strict';var pdf=require(_0x3d5d('0x0'));var emlformat=require(_0x3d5d('0x1'));var rimraf=require(_0x3d5d('0x2'));var zipdir=require(_0x3d5d('0x3'));var jsonpatch=require(_0x3d5d('0x4'));var rp=require(_0x3d5d('0x5'));var moment=require('moment');var BPromise=require(_0x3d5d('0x6'));var Mustache=require(_0x3d5d('0x7'));var util=require(_0x3d5d('0x8'));var path=require(_0x3d5d('0x9'));var sox=require(_0x3d5d('0xa'));var csv=require(_0x3d5d('0xb'));var ejs=require(_0x3d5d('0xc'));var fs=require('fs');var _=require(_0x3d5d('0xd'));var squel=require(_0x3d5d('0xe'));var crypto=require(_0x3d5d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3d5d('0x10'));var toCsv=require(_0x3d5d('0xb'));var querystring=require(_0x3d5d('0x11'));var Papa=require(_0x3d5d('0x12'));var Redis=require(_0x3d5d('0x13'));var authService=require(_0x3d5d('0x14'));var qs=require(_0x3d5d('0x15'));var as=require(_0x3d5d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d5d('0x17'))(_0x3d5d('0x18'));var utils=require(_0x3d5d('0x19'));var config=require(_0x3d5d('0x1a'));var db=require('../../mysqldb')['db'];config[_0x3d5d('0x1b')]=_[_0x3d5d('0x1c')](config[_0x3d5d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d5d('0x1d'))(new Redis(config[_0x3d5d('0x1b')]));require(_0x3d5d('0x1e'))[_0x3d5d('0x1f')](socket);var jayson=require(_0x3d5d('0x20'));var client=jayson[_0x3d5d('0x21')][_0x3d5d('0x22')]({'port':0x232a});function checkPasswordPattern(_0x592d4a,_0x1a551b,_0x2e3c90){if(_0x2e3c90){var _0x25e4e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25e4e8[_0x3d5d('0x23')](_0x1a551b)){return _0x592d4a;}else{throw new db[(_0x3d5d('0x24'))][(_0x3d5d('0x25'))](_0x3d5d('0x26'));}}else{return _0x592d4a;}}function respondWithRpcPromise(_0x38fea6,_0x2e1333,_0x34d58d,_0x39db8c){return new BPromise(function(_0x445ba8,_0x1b2f51){var _0x5b05bb=_0x39db8c||client;return _0x5b05bb[_0x3d5d('0x27')](_0x38fea6,_0x34d58d)[_0x3d5d('0x28')](function(_0xd7edd4){logger[_0x3d5d('0x29')]('ChatQueue,\x20%s,\x20%s',_0x2e1333,_0x3d5d('0x2a'));logger['debug'](_0x3d5d('0x2b'),_0x2e1333,_0x3d5d('0x2a'),JSON['stringify'](_0xd7edd4));if(_0xd7edd4[_0x3d5d('0x2c')]){if(_0xd7edd4[_0x3d5d('0x2c')][_0x3d5d('0x2d')]===0x1f4){logger['error'](_0x3d5d('0x2e'),_0x2e1333,_0xd7edd4[_0x3d5d('0x2c')][_0x3d5d('0x2f')]);return _0x1b2f51(_0xd7edd4[_0x3d5d('0x2c')][_0x3d5d('0x2f')]);}logger[_0x3d5d('0x2c')](_0x3d5d('0x2e'),_0x2e1333,_0xd7edd4[_0x3d5d('0x2c')][_0x3d5d('0x2f')]);return _0x445ba8(_0xd7edd4[_0x3d5d('0x2c')]['message']);}else{logger['info'](_0x3d5d('0x2e'),_0x2e1333,'request\x20sent');_0x445ba8(_0xd7edd4[_0x3d5d('0x30')][_0x3d5d('0x2f')]);}})['catch'](function(_0x5c3c45){logger[_0x3d5d('0x2c')](_0x3d5d('0x2e'),_0x2e1333,_0x5c3c45);_0x1b2f51(_0x5c3c45);});});}function respondWithStatusCode(_0x47a9c1,_0x4eae81){_0x4eae81=_0x4eae81||0xcc;return function(_0x443356){if(_0x443356){return _0x47a9c1[_0x3d5d('0x31')](_0x4eae81);}return _0x47a9c1['status'](_0x4eae81)[_0x3d5d('0x32')]();};}function respondWithResult(_0x4b038e,_0x406184){_0x406184=_0x406184||0xc8;return function(_0x47e6ea){if(_0x47e6ea){return _0x4b038e[_0x3d5d('0x33')](_0x406184)[_0x3d5d('0x34')](_0x47e6ea);}};}function respondWithFilteredResult(_0x221270,_0x3ecfe1){return function(_0x15bdf3){if(_0x15bdf3){var _0x5d30b9=_0x15bdf3[_0x3d5d('0x35')],_0x56875a=_0x3ecfe1[_0x3d5d('0x36')],_0x2692de=_0x3ecfe1[_0x3d5d('0x36')]+_0x3ecfe1[_0x3d5d('0x37')],_0x4ff9a6;if(_0x2692de>=_0x5d30b9){_0x2692de=_0x5d30b9;_0x4ff9a6=0xc8;}else{_0x4ff9a6=0xce;}_0x221270[_0x3d5d('0x33')](_0x4ff9a6);return _0x221270[_0x3d5d('0x38')](_0x3d5d('0x39'),_0x56875a+'-'+_0x2692de+'/'+_0x5d30b9)['json'](_0x15bdf3);}return null;};}function patchUpdates(_0x1a3854){return function(_0x511009){try{jsonpatch[_0x3d5d('0x3a')](_0x511009,_0x1a3854,!![]);}catch(_0x53fa23){return BPromise['reject'](_0x53fa23);}return _0x511009[_0x3d5d('0x3b')]();};}function saveUpdates(_0x34b2a1,_0x468120){return function(_0x4a55dc){if(_0x4a55dc){return _0x4a55dc['update'](_0x34b2a1)[_0x3d5d('0x28')](function(_0x18cc64){return _0x18cc64;});}return null;};}function removeEntity(_0x1dd00f,_0x1dc66a){return function(_0x5d4eaf){if(_0x5d4eaf){return _0x5d4eaf['destroy']()[_0x3d5d('0x28')](function(){var _0x4dbb2b=_0x5d4eaf['get']({'plain':!![]});var _0x51e21e=_0x3d5d('0x3c');return db[_0x3d5d('0x3d')][_0x3d5d('0x3e')]({'where':{'type':_0x51e21e,'resourceId':_0x4dbb2b['id']}})[_0x3d5d('0x28')](function(){return _0x5d4eaf;});})[_0x3d5d('0x28')](function(){_0x1dd00f[_0x3d5d('0x33')](0xcc)[_0x3d5d('0x32')]();});}};}function handleEntityNotFound(_0x49d841,_0x1e7bdf){return function(_0x67f9d6){if(!_0x67f9d6){_0x49d841[_0x3d5d('0x31')](0x194);}return _0x67f9d6;};}function handleError(_0x29c277,_0x55818c){_0x55818c=_0x55818c||0x1f4;return function(_0x59ce71){logger['error'](_0x59ce71[_0x3d5d('0x3f')]);if(_0x59ce71[_0x3d5d('0x40')]){delete _0x59ce71[_0x3d5d('0x40')];}_0x29c277[_0x3d5d('0x33')](_0x55818c)['send'](_0x59ce71);};}exports[_0x3d5d('0x41')]=function(_0x500612,_0x334a32){var _0x4b1016={},_0x3fcd7b={},_0x148273={'count':0x0,'rows':[]};var _0x1ca06d=_[_0x3d5d('0x42')](db[_0x3d5d('0x43')]['rawAttributes'],function(_0x4aa223){return{'name':_0x4aa223[_0x3d5d('0x44')],'type':_0x4aa223[_0x3d5d('0x45')][_0x3d5d('0x46')]};});_0x3fcd7b[_0x3d5d('0x47')]=_[_0x3d5d('0x42')](_0x1ca06d,_0x3d5d('0x40'));_0x3fcd7b[_0x3d5d('0x48')]=_[_0x3d5d('0x49')](_0x500612['query']);_0x3fcd7b[_0x3d5d('0x4a')]=_[_0x3d5d('0x4b')](_0x3fcd7b[_0x3d5d('0x47')],_0x3fcd7b['query']);_0x4b1016['attributes']=_[_0x3d5d('0x4b')](_0x3fcd7b[_0x3d5d('0x47')],qs[_0x3d5d('0x4c')](_0x500612[_0x3d5d('0x48')][_0x3d5d('0x4c')]));_0x4b1016[_0x3d5d('0x4d')]=_0x4b1016[_0x3d5d('0x4d')]['length']?_0x4b1016[_0x3d5d('0x4d')]:_0x3fcd7b[_0x3d5d('0x47')];if(!_0x500612[_0x3d5d('0x48')][_0x3d5d('0x4e')](_0x3d5d('0x4f'))){_0x4b1016['limit']=qs[_0x3d5d('0x37')](_0x500612['query']['limit']);_0x4b1016[_0x3d5d('0x36')]=qs['offset'](_0x500612[_0x3d5d('0x48')][_0x3d5d('0x36')]);}_0x4b1016['order']=qs[_0x3d5d('0x50')](_0x500612[_0x3d5d('0x48')]['sort']);_0x4b1016['where']=qs[_0x3d5d('0x4a')](_[_0x3d5d('0x51')](_0x500612[_0x3d5d('0x48')],_0x3fcd7b[_0x3d5d('0x4a')]),_0x1ca06d);if(_0x500612['query']['filter']){_0x4b1016[_0x3d5d('0x52')]=_['merge'](_0x4b1016[_0x3d5d('0x52')],{'$or':_[_0x3d5d('0x42')](_0x1ca06d,function(_0x3f2c8c){if(_0x3f2c8c['type']!==_0x3d5d('0x53')){var _0x3daf35={};_0x3daf35[_0x3f2c8c[_0x3d5d('0x40')]]={'$like':'%'+_0x500612['query'][_0x3d5d('0x54')]+'%'};return _0x3daf35;}})});}_0x4b1016=_[_0x3d5d('0x55')]({},_0x4b1016,_0x500612['options']);var _0xda8ae7={'where':_0x4b1016[_0x3d5d('0x52')]};return db[_0x3d5d('0x43')][_0x3d5d('0x35')](_0xda8ae7)[_0x3d5d('0x28')](function(_0x317eff){_0x148273['count']=_0x317eff;if(_0x500612[_0x3d5d('0x48')]['includeAll']){_0x4b1016[_0x3d5d('0x56')]=[{'all':!![]}];}return db[_0x3d5d('0x43')][_0x3d5d('0x57')](_0x4b1016);})[_0x3d5d('0x28')](function(_0x4adabe){_0x148273[_0x3d5d('0x58')]=_0x4adabe;return _0x148273;})[_0x3d5d('0x28')](respondWithFilteredResult(_0x334a32,_0x4b1016))[_0x3d5d('0x59')](handleError(_0x334a32,null));};exports['show']=function(_0xe5d012,_0x40834a){var _0x5e02d8={'raw':!![],'where':{'id':_0xe5d012[_0x3d5d('0x5a')]['id']}},_0x1331fd={};_0x1331fd[_0x3d5d('0x47')]=_[_0x3d5d('0x49')](db['ChatQueue'][_0x3d5d('0x5b')]);_0x1331fd['query']=_[_0x3d5d('0x49')](_0xe5d012[_0x3d5d('0x48')]);_0x1331fd[_0x3d5d('0x4a')]=_[_0x3d5d('0x4b')](_0x1331fd[_0x3d5d('0x47')],_0x1331fd[_0x3d5d('0x48')]);_0x5e02d8[_0x3d5d('0x4d')]=_['intersection'](_0x1331fd[_0x3d5d('0x47')],qs[_0x3d5d('0x4c')](_0xe5d012[_0x3d5d('0x48')][_0x3d5d('0x4c')]));_0x5e02d8[_0x3d5d('0x4d')]=_0x5e02d8[_0x3d5d('0x4d')]['length']?_0x5e02d8[_0x3d5d('0x4d')]:_0x1331fd[_0x3d5d('0x47')];if(_0xe5d012['query']['includeAll']){_0x5e02d8['include']=[{'all':!![]}];}_0x5e02d8=_[_0x3d5d('0x55')]({},_0x5e02d8,_0xe5d012[_0x3d5d('0x5c')]);return db[_0x3d5d('0x43')][_0x3d5d('0x5d')](_0x5e02d8)[_0x3d5d('0x28')](handleEntityNotFound(_0x40834a,null))[_0x3d5d('0x28')](respondWithResult(_0x40834a,null))['catch'](handleError(_0x40834a,null));};exports[_0x3d5d('0x5e')]=function(_0x5dd6eb,_0x89d5a4){return db[_0x3d5d('0x43')][_0x3d5d('0x5e')](_0x5dd6eb['body'],{})['then'](function(_0x499ecc){var _0x63c8b3=_0x5dd6eb['user'][_0x3d5d('0x5f')]({'plain':!![]});if(!_0x63c8b3)throw new Error(_0x3d5d('0x60'));if(_0x63c8b3[_0x3d5d('0x61')]===_0x3d5d('0x62')){var _0x32a2eb=_0x499ecc[_0x3d5d('0x5f')]({'plain':!![]});var _0x3a1ba0=_0x3d5d('0x3c');return db[_0x3d5d('0x63')][_0x3d5d('0x5d')]({'where':{'name':_0x3a1ba0,'userProfileId':_0x63c8b3[_0x3d5d('0x64')]},'raw':!![]})['then'](function(_0x956103){if(_0x956103&&_0x956103[_0x3d5d('0x65')]===0x0){return db[_0x3d5d('0x3d')]['create']({'name':_0x32a2eb['name'],'resourceId':_0x32a2eb['id'],'type':_0x956103[_0x3d5d('0x40')],'sectionId':_0x956103['id']},{})[_0x3d5d('0x28')](function(){return _0x499ecc;});}else{return _0x499ecc;}})[_0x3d5d('0x59')](function(_0x2a912d){logger['error'](_0x3d5d('0x66'),_0x2a912d);throw _0x2a912d;});}return _0x499ecc;})['then'](respondWithResult(_0x89d5a4,0xc9))['catch'](handleError(_0x89d5a4,null));};exports['update']=function(_0x38bfff,_0x59be36){if(_0x38bfff[_0x3d5d('0x67')]['id']){delete _0x38bfff[_0x3d5d('0x67')]['id'];}return db[_0x3d5d('0x43')][_0x3d5d('0x5d')]({'where':{'id':_0x38bfff['params']['id']}})[_0x3d5d('0x28')](handleEntityNotFound(_0x59be36,null))[_0x3d5d('0x28')](saveUpdates(_0x38bfff[_0x3d5d('0x67')],null))['then'](respondWithResult(_0x59be36,null))[_0x3d5d('0x59')](handleError(_0x59be36,null));};exports['destroy']=function(_0x587d72,_0x3f2d45){return db[_0x3d5d('0x43')][_0x3d5d('0x5d')]({'where':{'id':_0x587d72['params']['id']}})[_0x3d5d('0x28')](handleEntityNotFound(_0x3f2d45,null))['then'](removeEntity(_0x3f2d45,null))[_0x3d5d('0x59')](handleError(_0x3f2d45,null));};exports['describe']=function(_0xd9591c,_0x27de46){return db['ChatQueue']['describe']()[_0x3d5d('0x28')](respondWithResult(_0x27de46,null))[_0x3d5d('0x59')](handleError(_0x27de46,null));};exports['getMembers']=function(_0x238e95,_0x12c7d9,_0x449512){var _0x598ca1={'raw':!![],'where':{}},_0x4cb32f={},_0x1327ba;return db[_0x3d5d('0x43')][_0x3d5d('0x68')]({'where':{'id':_0x238e95[_0x3d5d('0x5a')]['id']}})[_0x3d5d('0x28')](handleEntityNotFound(_0x12c7d9,null))[_0x3d5d('0x28')](function(_0x1ba457){if(_0x1ba457){_0x1327ba=_0x1ba457[_0x3d5d('0x5f')]({'plain':!![]});_0x4cb32f[_0x3d5d('0x47')]=_['keys'](db['UserChatQueue'][_0x3d5d('0x5b')]);_0x4cb32f[_0x3d5d('0x48')]=_[_0x3d5d('0x49')](_0x238e95['query']);_0x4cb32f[_0x3d5d('0x4a')]=_[_0x3d5d('0x4b')](_0x4cb32f[_0x3d5d('0x47')],_0x4cb32f['query']);_0x598ca1[_0x3d5d('0x4d')]=_[_0x3d5d('0x4b')](_0x4cb32f[_0x3d5d('0x47')],qs[_0x3d5d('0x4c')](_0x238e95[_0x3d5d('0x48')][_0x3d5d('0x4c')]));_0x598ca1['attributes']=_0x598ca1[_0x3d5d('0x4d')]['length']?_0x598ca1[_0x3d5d('0x4d')]:_0x4cb32f[_0x3d5d('0x47')];if(!_0x238e95[_0x3d5d('0x48')][_0x3d5d('0x4e')](_0x3d5d('0x4f'))){_0x598ca1['limit']=qs['limit'](_0x238e95[_0x3d5d('0x48')][_0x3d5d('0x37')]);_0x598ca1[_0x3d5d('0x36')]=qs[_0x3d5d('0x36')](_0x238e95['query'][_0x3d5d('0x36')]);}_0x598ca1[_0x3d5d('0x69')]=qs[_0x3d5d('0x50')](_0x238e95[_0x3d5d('0x48')][_0x3d5d('0x50')]);_0x598ca1[_0x3d5d('0x52')]=qs[_0x3d5d('0x4a')](_[_0x3d5d('0x51')](_0x238e95[_0x3d5d('0x48')],_0x4cb32f[_0x3d5d('0x4a')]));_0x598ca1[_0x3d5d('0x52')][_0x3d5d('0x6a')]=_0x1ba457['id'];if(_0x238e95[_0x3d5d('0x48')][_0x3d5d('0x54')]){_0x598ca1[_0x3d5d('0x52')]=_[_0x3d5d('0x55')](_0x598ca1[_0x3d5d('0x52')],{'$or':_[_0x3d5d('0x42')](_0x598ca1['attributes'],function(_0x1ae7b2){var _0x4a925b={};_0x4a925b[_0x1ae7b2]={'$like':'%'+_0x238e95[_0x3d5d('0x48')]['filter']+'%'};return _0x4a925b;})});}_0x598ca1=_['merge']({},_0x598ca1,_0x238e95[_0x3d5d('0x5c')]);return db[_0x3d5d('0x6b')][_0x3d5d('0x57')](_0x598ca1);}})[_0x3d5d('0x28')](function(_0x4382ad){if(_0x4382ad){return db[_0x3d5d('0x6c')][_0x3d5d('0x6d')]({'where':{'id':_[_0x3d5d('0x42')](_0x4382ad,_0x3d5d('0x6e')),'role':_0x3d5d('0x6f')},'attributes':['id',_0x3d5d('0x40'),_0x3d5d('0x70'),_0x3d5d('0x71'),_0x3d5d('0x72')]});}})[_0x3d5d('0x28')](function(_0x21f72e){if(_0x21f72e){return{'count':_0x21f72e[_0x3d5d('0x35')],'rows':_[_0x3d5d('0x42')](_0x21f72e['rows'],function(_0x29e1f8){return{'membername':_0x29e1f8[_0x3d5d('0x40')],'UserId':_0x29e1f8['id'],'queue_name':_0x1327ba[_0x3d5d('0x40')],'ChatQueueId':_0x1327ba['id'],'interface':util[_0x3d5d('0x73')](_0x3d5d('0x74'),_0x3d5d('0x75'),_0x29e1f8['name']),'penalty':0x0,'paused':_0x29e1f8[_0x3d5d('0x70')],'createdAt':_0x29e1f8[_0x3d5d('0x72')],'updatedAt':_0x29e1f8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d5d('0x28')](respondWithFilteredResult(_0x12c7d9,_0x598ca1))[_0x3d5d('0x59')](handleError(_0x12c7d9,null));};exports[_0x3d5d('0x76')]=function(_0x564b85,_0xd49817,_0x1e71fe){var _0x3209ea={};var _0x3f333e={};var _0x4e3607;var _0x353539;return db['ChatQueue'][_0x3d5d('0x68')]({'where':{'id':_0x564b85[_0x3d5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd49817,null))[_0x3d5d('0x28')](function(_0x32888f){if(_0x32888f){_0x4e3607=_0x32888f;_0x3f333e[_0x3d5d('0x47')]=_['keys'](db[_0x3d5d('0x77')][_0x3d5d('0x5b')]);_0x3f333e[_0x3d5d('0x48')]=_[_0x3d5d('0x49')](_0x564b85[_0x3d5d('0x48')]);_0x3f333e[_0x3d5d('0x4a')]=_[_0x3d5d('0x4b')](_0x3f333e[_0x3d5d('0x47')],_0x3f333e[_0x3d5d('0x48')]);_0x3209ea[_0x3d5d('0x4d')]=_[_0x3d5d('0x4b')](_0x3f333e[_0x3d5d('0x47')],qs[_0x3d5d('0x4c')](_0x564b85['query'][_0x3d5d('0x4c')]));_0x3209ea[_0x3d5d('0x4d')]=_0x3209ea['attributes'][_0x3d5d('0x78')]?_0x3209ea[_0x3d5d('0x4d')]:_0x3f333e['model'];_0x3209ea[_0x3d5d('0x69')]=qs[_0x3d5d('0x50')](_0x564b85[_0x3d5d('0x48')][_0x3d5d('0x50')]);_0x3209ea[_0x3d5d('0x52')]=qs[_0x3d5d('0x4a')](_[_0x3d5d('0x51')](_0x564b85[_0x3d5d('0x48')],_0x3f333e['filters']));if(_0x564b85[_0x3d5d('0x48')][_0x3d5d('0x54')]){_0x3209ea[_0x3d5d('0x52')]=_['merge'](_0x3209ea[_0x3d5d('0x52')],{'$or':_[_0x3d5d('0x42')](_0x3209ea[_0x3d5d('0x4d')],function(_0x525ba4){var _0x36e74b={};_0x36e74b[_0x525ba4]={'$like':'%'+_0x564b85[_0x3d5d('0x48')][_0x3d5d('0x54')]+'%'};return _0x36e74b;})});}_0x3209ea=_[_0x3d5d('0x55')]({},_0x3209ea,_0x564b85[_0x3d5d('0x5c')]);return _0x4e3607[_0x3d5d('0x76')](_0x3209ea);}})[_0x3d5d('0x28')](function(_0x1359d0){if(_0x1359d0){_0x353539=_0x1359d0[_0x3d5d('0x78')];if(!_0x564b85['query'][_0x3d5d('0x4e')](_0x3d5d('0x4f'))){_0x3209ea[_0x3d5d('0x37')]=qs['limit'](_0x564b85[_0x3d5d('0x48')][_0x3d5d('0x37')]);_0x3209ea[_0x3d5d('0x36')]=qs['offset'](_0x564b85[_0x3d5d('0x48')][_0x3d5d('0x36')]);}return _0x4e3607[_0x3d5d('0x76')](_0x3209ea);}})[_0x3d5d('0x28')](function(_0x2de06f){if(_0x2de06f){return _0x2de06f?{'count':_0x353539,'rows':_0x2de06f}:null;}})[_0x3d5d('0x28')](respondWithResult(_0xd49817,null))[_0x3d5d('0x59')](handleError(_0xd49817,null));};exports[_0x3d5d('0x79')]=function(_0x1b6ec5,_0x2c5814,_0x3432a2){var _0x3173b1=_0x1b6ec5['body'][_0x3d5d('0x7a')];return db[_0x3d5d('0x77')][_0x3d5d('0x57')]({'where':{'id':_0x3173b1},'attributes':['id'],'include':[{'model':db[_0x3d5d('0x6c')],'as':_0x3d5d('0x7b'),'attributes':['id','name',_0x3d5d('0x7c'),'voicePause',_0x3d5d('0x7d')],'raw':!![]}]})[_0x3d5d('0x28')](function(_0x2fe370){if(_0x2fe370){var _0x3e8e79=_[_0x3d5d('0x7e')](_0x2fe370,function(_0x57e8d1){var _0x15b064=_0x57e8d1['get']({'plain':!![]});return _0x15b064[_0x3d5d('0x7b')];});return db['ChatQueue'][_0x3d5d('0x5d')]({'where':{'id':_0x1b6ec5[_0x3d5d('0x5a')]['id']}})[_0x3d5d('0x28')](function(_0x47c4be){return db['sequelize']['transaction'](function(_0x230541){return _0x47c4be[_0x3d5d('0x79')](_0x3173b1,{'transaction':_0x230541})[_0x3d5d('0x28')](function(){return BPromise['each'](_0x3e8e79,function(_0x512315){return db[_0x3d5d('0x6b')][_0x3d5d('0x7f')]({'where':{'UserId':_0x512315['id'],'ChatQueueId':_0x1b6ec5[_0x3d5d('0x5a')]['id']},'transaction':_0x230541});});})['then'](function(){_0x3e8e79[_0x3d5d('0x80')](function(_0x5d960d){socket[_0x3d5d('0x81')]('userChatQueue:save',{'UserId':_0x5d960d['id'],'ChatQueueId':_0x47c4be['id']});});});});});}})[_0x3d5d('0x28')](respondWithStatusCode(_0x2c5814,null))[_0x3d5d('0x59')](handleError(_0x2c5814,null));};exports[_0x3d5d('0x82')]=function(_0x4db355,_0x3bb6e8,_0xe4534d){return db[_0x3d5d('0x77')]['findAll']({'where':{'id':_0x4db355[_0x3d5d('0x48')][_0x3d5d('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x3d5d('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3bb6e8,null))[_0x3d5d('0x28')](function(_0x48a897){var _0xc08e17=_[_0x3d5d('0x42')](_0x48a897,'id');var _0x32dd70=[];var _0x1a281f=[];var _0x2cd2af=squel[_0x3d5d('0x83')]();_0x2cd2af[_0x3d5d('0x84')](_0x3d5d('0x85'))[_0x3d5d('0x86')](_0x3d5d('0x87'),'tq')[_0x3d5d('0x88')](_0x3d5d('0x89'),'ut',_0x3d5d('0x8a'))[_0x3d5d('0x52')]('ChatQueueId\x20=\x20?',_0x4db355[_0x3d5d('0x5a')]['id']);for(var _0x10886e=0x0;_0x10886e<_0x48a897[_0x3d5d('0x78')];_0x10886e+=0x1){let _0x9730c4=_0x48a897[_0x10886e];for(var _0x45620c=0x0;_0x45620c<_0x9730c4['Agents'][_0x3d5d('0x78')];_0x45620c+=0x1){let _0x122371=_0x9730c4[_0x3d5d('0x7b')][_0x45620c];var _0x348ed2=_0x2cd2af[_0x3d5d('0x8b')]();_0x348ed2['where']('ut.UserId\x20=\x20?',_0x122371['id']);_0x1a281f[_0x3d5d('0x8c')](db[_0x3d5d('0x8d')][_0x3d5d('0x48')](_0x348ed2[_0x3d5d('0x8e')](),{'type':db[_0x3d5d('0x8d')][_0x3d5d('0x8f')]['SELECT']})[_0x3d5d('0x28')](function(_0x4406c5){if(_0x4406c5['length']===0x1){return _0x122371['id'];}else{var _0x2ba961=_[_0x3d5d('0x90')](_[_0x3d5d('0x42')](_0x4406c5,_0x3d5d('0x91')),function(_0x49f1c1){return _[_0x3d5d('0x92')](_0xc08e17,_0x49f1c1);});if(_0x2ba961){return _0x122371['id'];}}}));}}return BPromise[_0x3d5d('0x93')](_0x1a281f)[_0x3d5d('0x28')](function(_0x43b947){_0x32dd70=_(_0x32dd70)[_0x3d5d('0x94')](_0x43b947)['compact']()[_0x3d5d('0x95')]();return db['ChatQueue']['find']({'where':{'id':_0x4db355['params']['id']}})['then'](function(_0x14da90){return db[_0x3d5d('0x8d')][_0x3d5d('0x96')](function(_0x1a9882){return _0x14da90[_0x3d5d('0x82')](_0x4db355[_0x3d5d('0x48')][_0x3d5d('0x7a')],{'transaction':_0x1a9882})[_0x3d5d('0x28')](function(){if(!_[_0x3d5d('0x97')](_0x32dd70)){return _0x14da90['removeAgents'](_0x32dd70,{'transaction':_0x1a9882});}})[_0x3d5d('0x28')](function(){_0x32dd70[_0x3d5d('0x80')](function(_0x182b8f){socket['emit'](_0x3d5d('0x98'),{'UserId':_0x182b8f,'ChatQueueId':_0x14da90['id']});});});});});});})[_0x3d5d('0x28')](respondWithStatusCode(_0x3bb6e8,null))[_0x3d5d('0x59')](handleError(_0x3bb6e8,null));};exports[_0x3d5d('0x99')]=function(_0x4c36b2,_0xd9a553,_0x13901e){return db['ChatQueue'][_0x3d5d('0x5d')]({'where':{'id':_0x4c36b2['params']['id']}})[_0x3d5d('0x28')](handleEntityNotFound(_0xd9a553,null))['then'](function(_0x40e664){if(_0x40e664){return _0x40e664[_0x3d5d('0x99')](_0x4c36b2[_0x3d5d('0x67')][_0x3d5d('0x7a')],_[_0x3d5d('0x9a')](_0x4c36b2[_0x3d5d('0x67')],['ids','id'])||{})[_0x3d5d('0x9b')](function(_0x272082){for(var _0x55a61c=0x0;_0x55a61c<_0x4c36b2[_0x3d5d('0x67')][_0x3d5d('0x7a')][_0x3d5d('0x78')];_0x55a61c+=0x1){socket[_0x3d5d('0x81')](_0x3d5d('0x9c'),{'UserId':_0x4c36b2[_0x3d5d('0x67')][_0x3d5d('0x7a')][_0x55a61c],'ChatQueueId':_0x4c36b2[_0x3d5d('0x5a')]['id']});}return _0x272082;});}})[_0x3d5d('0x28')](respondWithResult(_0xd9a553,null))[_0x3d5d('0x59')](handleError(_0xd9a553,null));};exports[_0x3d5d('0x9d')]=function(_0x154ba0,_0x29109b,_0x1bb7e3){return db['ChatQueue'][_0x3d5d('0x5d')]({'where':{'id':_0x154ba0[_0x3d5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x29109b,null))[_0x3d5d('0x28')](function(_0x5e3b36){if(_0x5e3b36){return _0x5e3b36[_0x3d5d('0x9d')](_0x154ba0[_0x3d5d('0x48')]['ids'])[_0x3d5d('0x28')](function(){if(_[_0x3d5d('0x9e')](_0x154ba0[_0x3d5d('0x48')][_0x3d5d('0x7a')])){for(var _0x1a453f=0x0;_0x1a453f<_0x154ba0[_0x3d5d('0x48')][_0x3d5d('0x7a')][_0x3d5d('0x78')];_0x1a453f+=0x1){socket[_0x3d5d('0x81')](_0x3d5d('0x98'),{'UserId':Number(_0x154ba0[_0x3d5d('0x48')][_0x3d5d('0x7a')][_0x1a453f]),'ChatQueueId':Number(_0x154ba0[_0x3d5d('0x5a')]['id'])});}}else{socket[_0x3d5d('0x81')]('userChatQueue:remove',{'UserId':Number(_0x154ba0[_0x3d5d('0x48')][_0x3d5d('0x7a')]),'ChatQueueId':Number(_0x154ba0['params']['id'])});}});}})[_0x3d5d('0x28')](respondWithStatusCode(_0x29109b,null))[_0x3d5d('0x59')](handleError(_0x29109b,null));};exports[_0x3d5d('0x9f')]=function(_0x11c2ab,_0x5253a2,_0x2713d0){var _0xd52145={};var _0x19ef87={};var _0x54bea3;var _0x17b661;return db[_0x3d5d('0x43')][_0x3d5d('0x68')]({'where':{'id':_0x11c2ab[_0x3d5d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5253a2,null))[_0x3d5d('0x28')](function(_0x4a4b8c){if(_0x4a4b8c){_0x54bea3=_0x4a4b8c;_0x19ef87[_0x3d5d('0x47')]=_[_0x3d5d('0x49')](db[_0x3d5d('0x6c')]['rawAttributes']);_0x19ef87['query']=_[_0x3d5d('0x49')](_0x11c2ab[_0x3d5d('0x48')]);_0x19ef87['filters']=_[_0x3d5d('0x4b')](_0x19ef87[_0x3d5d('0x47')],_0x19ef87[_0x3d5d('0x48')]);_0xd52145[_0x3d5d('0x4d')]=_[_0x3d5d('0x4b')](_0x19ef87[_0x3d5d('0x47')],qs[_0x3d5d('0x4c')](_0x11c2ab[_0x3d5d('0x48')]['fields']));_0xd52145['attributes']=_0xd52145[_0x3d5d('0x4d')]['length']?_0xd52145['attributes']:_0x19ef87[_0x3d5d('0x47')];_0xd52145['order']=qs[_0x3d5d('0x50')](_0x11c2ab['query'][_0x3d5d('0x50')]);_0xd52145[_0x3d5d('0x52')]=qs[_0x3d5d('0x4a')](_[_0x3d5d('0x51')](_0x11c2ab[_0x3d5d('0x48')],_0x19ef87[_0x3d5d('0x4a')]));if(_0x11c2ab['query']['filter']){_0xd52145[_0x3d5d('0x52')]=_[_0x3d5d('0x55')](_0xd52145[_0x3d5d('0x52')],{'$or':_[_0x3d5d('0x42')](_0xd52145['attributes'],function(_0x557685){var _0x41b309={};_0x41b309[_0x557685]={'$like':'%'+_0x11c2ab[_0x3d5d('0x48')][_0x3d5d('0x54')]+'%'};return _0x41b309;})});}_0xd52145=_['merge']({},_0xd52145,_0x11c2ab[_0x3d5d('0x5c')]);return _0x54bea3[_0x3d5d('0x9f')](_0xd52145);}})[_0x3d5d('0x28')](function(_0xcb6d37){if(_0xcb6d37){_0x17b661=_0xcb6d37[_0x3d5d('0x78')];if(!_0x11c2ab['query'][_0x3d5d('0x4e')](_0x3d5d('0x4f'))){_0xd52145[_0x3d5d('0x37')]=qs[_0x3d5d('0x37')](_0x11c2ab[_0x3d5d('0x48')]['limit']);_0xd52145[_0x3d5d('0x36')]=qs['offset'](_0x11c2ab[_0x3d5d('0x48')][_0x3d5d('0x36')]);}return _0x54bea3['getAgents'](_0xd52145);}})[_0x3d5d('0x28')](function(_0x38a048){if(_0x38a048){return _0x38a048?{'count':_0x17b661,'rows':_0x38a048}:null;}})[_0x3d5d('0x28')](respondWithResult(_0x5253a2,null))[_0x3d5d('0x59')](handleError(_0x5253a2,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0ac3d7e..6edcf05 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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x150397,_0x258581){var _0x5cadab=function(_0x3052d6){while(--_0x3052d6){_0x150397['push'](_0x150397['shift']());}};_0x5cadab(++_0x258581);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x58381c,_0x3b9374){var _0x1a7440=function(_0x2bc7f1){while(--_0x2bc7f1){_0x58381c['push'](_0x58381c['shift']());}};_0x1a7440(++_0x3b9374);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 9961590..94a03dd 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 _0x9c1b=['define','ChatQueue','chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9c1b,0x153));var _0xb9c1=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0x9c1b[_0x5aece9];return _0x1c46d6;};'use strict';var _=require('lodash');var util=require(_0xb9c1('0x0'));var logger=require(_0xb9c1('0x1'))(_0xb9c1('0x2'));var moment=require('moment');var BPromise=require(_0xb9c1('0x3'));var rp=require(_0xb9c1('0x4'));var fs=require('fs');var path=require(_0xb9c1('0x5'));var rimraf=require(_0xb9c1('0x6'));var config=require(_0xb9c1('0x7'));var attributes=require('./chatQueue.attributes');module[_0xb9c1('0x8')]=function(_0x289d19,_0x4abfa1){return _0x289d19[_0xb9c1('0x9')](_0xb9c1('0xa'),attributes,{'tableName':_0xb9c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9216=['../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x25b444,_0x20da5e){var _0x425f88=function(_0xe4183e){while(--_0xe4183e){_0x25b444['push'](_0x25b444['shift']());}};_0x425f88(++_0x20da5e);}(_0x9216,0x1de));var _0x6921=function(_0x4d7530,_0xdee31){_0x4d7530=_0x4d7530-0x0;var _0x1afc9e=_0x9216[_0x4d7530];return _0x1afc9e;};'use strict';var _=require(_0x6921('0x0'));var util=require(_0x6921('0x1'));var logger=require('../../config/logger')(_0x6921('0x2'));var moment=require('moment');var BPromise=require(_0x6921('0x3'));var rp=require(_0x6921('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6921('0x5'));var config=require(_0x6921('0x6'));var attributes=require(_0x6921('0x7'));module[_0x6921('0x8')]=function(_0x1cc8f3,_0x118a48){return _0x1cc8f3['define'](_0x6921('0x9'),attributes,{'tableName':_0x6921('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index c4d6bfb..c535af1 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 _0x9660=['error','code','message','info','result','ChatQueue','options','raw','where','attributes','limit','include','model','map','GetChatQueue','ShowChatQueue','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xb61065,_0x159992){var _0x3f3fcb=function(_0x3aa3f4){while(--_0x3aa3f4){_0xb61065['push'](_0xb61065['shift']());}};_0x3f3fcb(++_0x159992);}(_0x9660,0x1f1));var _0x0966=function(_0x43ec56,_0x1a66cc){_0x43ec56=_0x43ec56-0x0;var _0x5ad932=_0x9660[_0x43ec56];return _0x5ad932;};'use strict';var _=require(_0x0966('0x0'));var util=require('util');var moment=require(_0x0966('0x1'));var BPromise=require(_0x0966('0x2'));var rs=require(_0x0966('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0966('0x4'))['db'];var utils=require(_0x0966('0x5'));var logger=require(_0x0966('0x6'))(_0x0966('0x7'));var config=require(_0x0966('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0966('0x9')][_0x0966('0xa')]({'port':0x232a});config[_0x0966('0xb')]=_[_0x0966('0xc')](config[_0x0966('0xb')],{'host':_0x0966('0xd'),'port':0x18eb});var socket=require(_0x0966('0xe'))(new Redis(config['redis']));require(_0x0966('0xf'))[_0x0966('0x10')](socket);function respondWithRpcPromise(_0x32907f,_0x205f0b,_0x8ece1c){return new BPromise(function(_0x2add4f,_0x3282ee){return client[_0x0966('0x11')](_0x32907f,_0x8ece1c)[_0x0966('0x12')](function(_0x8e557e){logger['info'](_0x0966('0x13'),_0x205f0b,_0x0966('0x14'));logger[_0x0966('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x205f0b,'request\x20sent',JSON[_0x0966('0x16')](_0x8e557e));if(_0x8e557e[_0x0966('0x17')]){if(_0x8e557e[_0x0966('0x17')][_0x0966('0x18')]===0x1f4){logger[_0x0966('0x17')](_0x0966('0x13'),_0x205f0b,_0x8e557e['error'][_0x0966('0x19')]);return _0x3282ee(_0x8e557e['error'][_0x0966('0x19')]);}logger[_0x0966('0x17')](_0x0966('0x13'),_0x205f0b,_0x8e557e[_0x0966('0x17')][_0x0966('0x19')]);return _0x2add4f(_0x8e557e['error'][_0x0966('0x19')]);}else{logger[_0x0966('0x1a')](_0x0966('0x13'),_0x205f0b,_0x0966('0x14'));_0x2add4f(_0x8e557e[_0x0966('0x1b')]['message']);}})['catch'](function(_0x27e6c3){logger[_0x0966('0x17')](_0x0966('0x13'),_0x205f0b,_0x27e6c3);_0x3282ee(_0x27e6c3);});});}exports['GetChatQueue']=function(_0x550310){var _0x5bd210=this;return new Promise(function(_0x4543e7,_0x1ae53c){return db[_0x0966('0x1c')]['findAll']({'raw':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x1e')]===undefined?!![]:![]:!![],'where':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x1f')]||null:null,'attributes':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x20')]||null:null,'limit':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x21')]||null:null,'include':_0x550310['options']?_0x550310[_0x0966('0x1d')][_0x0966('0x22')]?_['map'](_0x550310[_0x0966('0x1d')][_0x0966('0x22')],function(_0x325b78){return{'model':db[_0x325b78[_0x0966('0x23')]],'as':_0x325b78['as'],'attributes':_0x325b78[_0x0966('0x20')],'include':_0x325b78['include']?_[_0x0966('0x24')](_0x325b78[_0x0966('0x22')],function(_0x43dd51){return{'model':db[_0x43dd51[_0x0966('0x23')]],'as':_0x43dd51['as'],'attributes':_0x43dd51[_0x0966('0x20')],'include':_0x43dd51[_0x0966('0x22')]?_['map'](_0x43dd51[_0x0966('0x22')],function(_0x499699){return{'model':db[_0x499699[_0x0966('0x23')]],'as':_0x499699['as'],'attributes':_0x499699['attributes']};}):[]};}):[]};}):[]:[]})[_0x0966('0x12')](function(_0x123188){logger[_0x0966('0x1a')](_0x0966('0x25'),_0x550310);logger[_0x0966('0x15')](_0x0966('0x25'),_0x550310,JSON['stringify'](_0x123188));_0x4543e7(_0x123188);})['catch'](function(_0x504075){logger['error'](_0x0966('0x25'),_0x504075[_0x0966('0x19')],_0x550310);_0x1ae53c(_0x5bd210['error'](0x1f4,_0x504075[_0x0966('0x19')]));});});};exports[_0x0966('0x26')]=function(_0x463aa4){var _0x41642a=this;return new Promise(function(_0x5adbab,_0x724614){return db['ChatQueue']['find']({'raw':_0x463aa4[_0x0966('0x1d')]?_0x463aa4[_0x0966('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x463aa4['options']?_0x463aa4['options'][_0x0966('0x1f')]||null:null,'attributes':_0x463aa4['options']?_0x463aa4[_0x0966('0x1d')][_0x0966('0x20')]||null:null,'include':_0x463aa4[_0x0966('0x1d')]?_0x463aa4[_0x0966('0x1d')]['include']?_['map'](_0x463aa4[_0x0966('0x1d')][_0x0966('0x22')],function(_0x2c0545){return{'model':db[_0x2c0545[_0x0966('0x23')]],'as':_0x2c0545['as'],'attributes':_0x2c0545[_0x0966('0x20')],'include':_0x2c0545['include']?_[_0x0966('0x24')](_0x2c0545['include'],function(_0x8eb3aa){return{'model':db[_0x8eb3aa[_0x0966('0x23')]],'as':_0x8eb3aa['as'],'attributes':_0x8eb3aa['attributes'],'include':_0x8eb3aa['include']?_[_0x0966('0x24')](_0x8eb3aa[_0x0966('0x22')],function(_0x12cf4c){return{'model':db[_0x12cf4c[_0x0966('0x23')]],'as':_0x12cf4c['as'],'attributes':_0x12cf4c[_0x0966('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0966('0x12')](function(_0xe1d9ba){logger[_0x0966('0x1a')]('ShowChatQueue',_0x463aa4);logger[_0x0966('0x15')](_0x0966('0x26'),_0x463aa4,JSON['stringify'](_0xe1d9ba));_0x5adbab(_0xe1d9ba);})[_0x0966('0x27')](function(_0x435b75){logger[_0x0966('0x17')]('ShowChatQueue',_0x435b75[_0x0966('0x19')],_0x463aa4);_0x724614(_0x41642a['error'](0x1f4,_0x435b75[_0x0966('0x19')]));});});}; \ No newline at end of file +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(_0x499029,_0xa41dab){var _0xea8b32=function(_0x5f1782){while(--_0x5f1782){_0x499029['push'](_0x499029['shift']());}};_0xea8b32(++_0xa41dab);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x334ffd,_0x1233f6){_0x334ffd=_0x334ffd-0x0;var _0x3b73d3=_0x1cf6[_0x334ffd];return _0x3b73d3;};'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 diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 33bc6b1..f6da5e2 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(_0x59ee9c,_0x43f62d){var _0x44a2a8=function(_0x5b2c33){while(--_0x5b2c33){_0x59ee9c['push'](_0x59ee9c['shift']());}};_0x44a2a8(++_0x43f62d);}(_0xb10b,0x12a));var _0xbb10=function(_0x49684e,_0x9a24fb){_0x49684e=_0x49684e-0x0;var _0x54062f=_0xb10b[_0x49684e];return _0x54062f;};'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(_0x53a97a,_0x3135e8){var _0x3ff3ff=function(_0xc59fc1){while(--_0xc59fc1){_0x53a97a['push'](_0x53a97a['shift']());}};_0x3ff3ff(++_0x3135e8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x49b3c5,_0x3ddf83){_0x49b3c5=_0x49b3c5-0x0;var _0x13f73b=_0x5f2f[_0x49b3c5];return _0x13f73b;};'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 4d6e692..546a5ce 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 _0xe29f=['express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','connect-timeout'];(function(_0x397007,_0x133ceb){var _0x3cc47a=function(_0x5a9e7f){while(--_0x5a9e7f){_0x397007['push'](_0x397007['shift']());}};_0x3cc47a(++_0x133ceb);}(_0xe29f,0x132));var _0xfe29=function(_0xe78015,_0xd60f5d){_0xe78015=_0xe78015-0x0;var _0x3fa910=_0xe29f[_0xe78015];return _0x3fa910;};'use strict';var multer=require('multer');var util=require(_0xfe29('0x0'));var path=require('path');var timeout=require(_0xfe29('0x1'));var express=require(_0xfe29('0x2'));var router=express[_0xfe29('0x3')]();var auth=require(_0xfe29('0x4'));var interaction=require(_0xfe29('0x5'));var config=require('../../config/environment');var controller=require(_0xfe29('0x6'));router[_0xfe29('0x7')]('/',auth[_0xfe29('0x8')](),controller[_0xfe29('0x9')]);router[_0xfe29('0x7')](_0xfe29('0xa'),auth[_0xfe29('0x8')](),controller[_0xfe29('0xb')]);router['get'](_0xfe29('0xc'),auth[_0xfe29('0x8')](),controller[_0xfe29('0xd')]);router[_0xfe29('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xfe29('0xe')]);router[_0xfe29('0x7')](_0xfe29('0xf'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x10')]);router['get']('/:id/users',auth[_0xfe29('0x8')](),controller[_0xfe29('0x11')]);router[_0xfe29('0x12')]('/',auth[_0xfe29('0x8')](),controller[_0xfe29('0x13')]);router[_0xfe29('0x12')](_0xfe29('0xf'),auth[_0xfe29('0x8')](),controller['addTeams']);router[_0xfe29('0x12')](_0xfe29('0x14'),auth['isAuthenticated'](),controller[_0xfe29('0x15')]);router[_0xfe29('0x16')](_0xfe29('0xc'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x17')]);router[_0xfe29('0x18')](_0xfe29('0xc'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x19')]);router[_0xfe29('0x18')](_0xfe29('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xfe29('0x18')]('/:id/users',auth[_0xfe29('0x8')](),controller[_0xfe29('0x1a')]);module[_0xfe29('0x1b')]=router; \ No newline at end of file +var _0x45b2=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x291733,_0x5b5719){var _0x350029=function(_0x32af1d){while(--_0x32af1d){_0x291733['push'](_0x291733['shift']());}};_0x350029(++_0x5b5719);}(_0x45b2,0x13f));var _0x245b=function(_0x70dd2c,_0x4f81c6){_0x70dd2c=_0x70dd2c-0x0;var _0x1982ef=_0x45b2[_0x70dd2c];return _0x1982ef;};'use strict';var multer=require('multer');var util=require(_0x245b('0x0'));var path=require('path');var timeout=require(_0x245b('0x1'));var express=require('express');var router=express[_0x245b('0x2')]();var auth=require(_0x245b('0x3'));var interaction=require(_0x245b('0x4'));var config=require(_0x245b('0x5'));var controller=require(_0x245b('0x6'));router[_0x245b('0x7')]('/',auth[_0x245b('0x8')](),controller[_0x245b('0x9')]);router[_0x245b('0x7')](_0x245b('0xa'),auth[_0x245b('0x8')](),controller['describe']);router['get'](_0x245b('0xb'),auth['isAuthenticated'](),controller[_0x245b('0xc')]);router[_0x245b('0x7')](_0x245b('0xd'),auth[_0x245b('0x8')](),controller[_0x245b('0xe')]);router[_0x245b('0x7')](_0x245b('0xf'),auth[_0x245b('0x8')](),controller[_0x245b('0x10')]);router[_0x245b('0x7')](_0x245b('0x11'),auth['isAuthenticated'](),controller[_0x245b('0x12')]);router['post']('/',auth[_0x245b('0x8')](),controller[_0x245b('0x13')]);router[_0x245b('0x14')](_0x245b('0xf'),auth[_0x245b('0x8')](),controller[_0x245b('0x15')]);router['post']('/:id/users',auth[_0x245b('0x8')](),controller[_0x245b('0x16')]);router[_0x245b('0x17')](_0x245b('0xb'),auth[_0x245b('0x8')](),controller[_0x245b('0x18')]);router[_0x245b('0x19')](_0x245b('0xb'),auth[_0x245b('0x8')](),controller[_0x245b('0x1a')]);router[_0x245b('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x245b('0x1b')]);router[_0x245b('0x19')]('/:id/users',auth[_0x245b('0x8')](),controller[_0x245b('0x1c')]);module[_0x245b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5b5e656..ce8565e 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 _0xee7b=['moment','sequelize','exports','STRING','DATE'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xee7b,0x177));var _0xbee7=function(_0x522030,_0x3ed0ad){_0x522030=_0x522030-0x0;var _0x1b9d5b=_0xee7b[_0x522030];return _0x1b9d5b;};'use strict';var moment=require(_0xbee7('0x0'));var Sequelize=require(_0xbee7('0x1'));module[_0xbee7('0x2')]={'uniqueid':{'type':Sequelize[_0xbee7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbee7('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbee7('0x4')]},'acceptAt':{'type':Sequelize[_0xbee7('0x4')]},'exitAt':{'type':Sequelize[_0xbee7('0x4')]},'reason':{'type':Sequelize[_0xbee7('0x3')]}}; \ No newline at end of file +var _0xba0f=['sequelize','exports','STRING','DATE'];(function(_0x31154d,_0x375ed2){var _0x26ba70=function(_0x183ec8){while(--_0x183ec8){_0x31154d['push'](_0x31154d['shift']());}};_0x26ba70(++_0x375ed2);}(_0xba0f,0xbc));var _0xfba0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xba0f[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require(_0xfba0('0x0'));module[_0xfba0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfba0('0x2')]},'joinAt':{'type':Sequelize[_0xfba0('0x3')]},'leaveAt':{'type':Sequelize[_0xfba0('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfba0('0x3')]},'reason':{'type':Sequelize[_0xfba0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index d9e79bd..1e2838c 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 _0xe706=['catch','create','body','destroy','describe','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','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x250175,_0x19ba42){var _0x679d6f=function(_0x3fbce6){while(--_0x3fbce6){_0x250175['push'](_0x250175['shift']());}};_0x679d6f(++_0x19ba42);}(_0xe706,0xa3));var _0x6e70=function(_0x209581,_0x11f596){_0x209581=_0x209581-0x0;var _0x2fed45=_0xe706[_0x209581];return _0x2fed45;};'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={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['ChatQueueReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x41ba9d,_0x35a56d){var _0x4b97a0=function(_0x307a3e){while(--_0x307a3e){_0x41ba9d['push'](_0x41ba9d['shift']());}};_0x4b97a0(++_0x35a56d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['ChatQueueReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['ChatQueueReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ed7d1a1..88dadaa 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 _0xcdac=['path','rimraf','exports','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x46f4aa,_0x3086e6){var _0x197c3a=function(_0x5cf206){while(--_0x5cf206){_0x46f4aa['push'](_0x46f4aa['shift']());}};_0x197c3a(++_0x3086e6);}(_0xcdac,0x175));var _0xccda=function(_0x218e36,_0x3daecb){_0x218e36=_0x218e36-0x0;var _0x10eb6d=_0xcdac[_0x218e36];return _0x10eb6d;};'use strict';var _=require(_0xccda('0x0'));var util=require('util');var logger=require(_0xccda('0x1'))(_0xccda('0x2'));var moment=require(_0xccda('0x3'));var BPromise=require(_0xccda('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccda('0x5'));var rimraf=require(_0xccda('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueueReport.attributes');module[_0xccda('0x7')]=function(_0x307331,_0x59dfb3){return _0x307331['define']('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0xccda('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2109=['util','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','uniqueid'];(function(_0x13dd25,_0x5f0274){var _0x4663f7=function(_0x28b867){while(--_0x28b867){_0x13dd25['push'](_0x13dd25['shift']());}};_0x4663f7(++_0x5f0274);}(_0x2109,0x150));var _0x9210=function(_0xdd1908,_0x2e077e){_0xdd1908=_0xdd1908-0x0;var _0x48ab86=_0x2109[_0xdd1908];return _0x48ab86;};'use strict';var _=require('lodash');var util=require(_0x9210('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9210('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9210('0x2'));var config=require(_0x9210('0x3'));var attributes=require(_0x9210('0x4'));module[_0x9210('0x5')]=function(_0x5454de,_0x11863a){return _0x5454de['define']('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x9210('0x6'),'fields':[_0x9210('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4070dba..676910e 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 _0x3821=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','debug','UpdateChatQueueReport','update','raw','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d10f7,_0x36abd0){var _0x94c2f7=function(_0xcb5708){while(--_0xcb5708){_0x2d10f7['push'](_0x2d10f7['shift']());}};_0x94c2f7(++_0x36abd0);}(_0x3821,0x1c1));var _0x1382=function(_0x400bb4,_0x1b710e){_0x400bb4=_0x400bb4-0x0;var _0x4b1c24=_0x3821[_0x400bb4];return _0x4b1c24;};'use strict';var _=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var moment=require(_0x1382('0x2'));var BPromise=require('bluebird');var rs=require(_0x1382('0x3'));var fs=require('fs');var Redis=require(_0x1382('0x4'));var db=require(_0x1382('0x5'))['db'];var utils=require(_0x1382('0x6'));var logger=require(_0x1382('0x7'))('rpc');var config=require(_0x1382('0x8'));var jayson=require(_0x1382('0x9'));var client=jayson[_0x1382('0xa')][_0x1382('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aa3c0,_0x11b84e,_0x1e70e0){return new BPromise(function(_0x498673,_0xd74af4){return client[_0x1382('0xc')](_0x3aa3c0,_0x1e70e0)[_0x1382('0xd')](function(_0x42229e){logger[_0x1382('0xe')](_0x1382('0xf'),_0x11b84e,_0x1382('0x10'));logger['debug'](_0x1382('0x11'),_0x11b84e,_0x1382('0x10'),JSON[_0x1382('0x12')](_0x42229e));if(_0x42229e[_0x1382('0x13')]){if(_0x42229e['error'][_0x1382('0x14')]===0x1f4){logger[_0x1382('0x13')](_0x1382('0xf'),_0x11b84e,_0x42229e[_0x1382('0x13')][_0x1382('0x15')]);return _0xd74af4(_0x42229e['error'][_0x1382('0x15')]);}logger[_0x1382('0x13')](_0x1382('0xf'),_0x11b84e,_0x42229e[_0x1382('0x13')][_0x1382('0x15')]);return _0x498673(_0x42229e[_0x1382('0x13')][_0x1382('0x15')]);}else{logger[_0x1382('0xe')](_0x1382('0xf'),_0x11b84e,_0x1382('0x10'));_0x498673(_0x42229e['result'][_0x1382('0x15')]);}})[_0x1382('0x16')](function(_0x4c88cb){logger[_0x1382('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x11b84e,_0x4c88cb);_0xd74af4(_0x4c88cb);});});}exports[_0x1382('0x17')]=function(_0x42618d){var _0x486f7d=this;return new Promise(function(_0x3972d5,_0x144f74){return db[_0x1382('0x18')]['create'](_0x42618d[_0x1382('0x19')],{'raw':_0x42618d[_0x1382('0x1a')]?_0x42618d['options']['raw']===undefined?!![]:![]:!![]})[_0x1382('0xd')](function(_0x37ea46){logger[_0x1382('0xe')](_0x1382('0x17'),_0x42618d);logger[_0x1382('0x1b')](_0x1382('0x17'),_0x42618d,JSON['stringify'](_0x37ea46));_0x3972d5(_0x37ea46);})[_0x1382('0x16')](function(_0x2e5d0d){logger[_0x1382('0x13')]('CreateChatQueueReport',_0x2e5d0d['message'],_0x42618d);_0x144f74(_0x486f7d['error'](0x1f4,_0x2e5d0d[_0x1382('0x15')]));});});};exports[_0x1382('0x1c')]=function(_0x107a3f){var _0x34dc21=this;return new Promise(function(_0x597b8a,_0x59f19){return db[_0x1382('0x18')][_0x1382('0x1d')](_0x107a3f[_0x1382('0x19')],{'raw':_0x107a3f['options']?_0x107a3f[_0x1382('0x1a')][_0x1382('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x107a3f[_0x1382('0x1a')]?_0x107a3f[_0x1382('0x1a')][_0x1382('0x1f')]||null:null,'attributes':_0x107a3f['options']?_0x107a3f['options']['attributes']||null:null,'limit':_0x107a3f[_0x1382('0x1a')]?_0x107a3f[_0x1382('0x1a')][_0x1382('0x20')]||null:null})['then'](function(_0x1f119d){logger[_0x1382('0xe')](_0x1382('0x1c'),_0x107a3f);logger[_0x1382('0x1b')](_0x1382('0x1c'),_0x107a3f,JSON['stringify'](_0x1f119d));_0x597b8a(_0x1f119d);})[_0x1382('0x16')](function(_0x4b0836){logger[_0x1382('0x13')](_0x1382('0x1c'),_0x4b0836[_0x1382('0x15')],_0x107a3f);_0x59f19(_0x34dc21['error'](0x1f4,_0x4b0836[_0x1382('0x15')]));});});}; \ No newline at end of file +var _0xd9a4=['info','catch','ChatQueueReport','create','body','raw','CreateChatQueueReport','UpdateChatQueueReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b0135,_0x5e8c54){var _0x3ec7fd=function(_0x5a2006){while(--_0x5a2006){_0x4b0135['push'](_0x4b0135['shift']());}};_0x3ec7fd(++_0x5e8c54);}(_0xd9a4,0x136));var _0x4d9a=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xd9a4[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x4d9a('0x0'));var util=require(_0x4d9a('0x1'));var moment=require(_0x4d9a('0x2'));var BPromise=require(_0x4d9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d9a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d9a('0x5'))(_0x4d9a('0x6'));var config=require('../../config/environment');var jayson=require(_0x4d9a('0x7'));var client=jayson[_0x4d9a('0x8')][_0x4d9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x316d61,_0x46ceb4,_0x458eb6){return new BPromise(function(_0x2c7354,_0x3f7283){return client[_0x4d9a('0xa')](_0x316d61,_0x458eb6)[_0x4d9a('0xb')](function(_0x57f745){logger['info'](_0x4d9a('0xc'),_0x46ceb4,_0x4d9a('0xd'));logger[_0x4d9a('0xe')](_0x4d9a('0xf'),_0x46ceb4,_0x4d9a('0xd'),JSON[_0x4d9a('0x10')](_0x57f745));if(_0x57f745[_0x4d9a('0x11')]){if(_0x57f745[_0x4d9a('0x11')][_0x4d9a('0x12')]===0x1f4){logger[_0x4d9a('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x46ceb4,_0x57f745[_0x4d9a('0x11')][_0x4d9a('0x13')]);return _0x3f7283(_0x57f745[_0x4d9a('0x11')]['message']);}logger['error'](_0x4d9a('0xc'),_0x46ceb4,_0x57f745[_0x4d9a('0x11')][_0x4d9a('0x13')]);return _0x2c7354(_0x57f745['error'][_0x4d9a('0x13')]);}else{logger[_0x4d9a('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x46ceb4,_0x4d9a('0xd'));_0x2c7354(_0x57f745['result'][_0x4d9a('0x13')]);}})[_0x4d9a('0x15')](function(_0x3933ff){logger[_0x4d9a('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x46ceb4,_0x3933ff);_0x3f7283(_0x3933ff);});});}exports['CreateChatQueueReport']=function(_0x4bbf93){var _0x480291=this;return new Promise(function(_0xde6bd4,_0x3c70a4){return db[_0x4d9a('0x16')][_0x4d9a('0x17')](_0x4bbf93[_0x4d9a('0x18')],{'raw':_0x4bbf93['options']?_0x4bbf93['options'][_0x4d9a('0x19')]===undefined?!![]:![]:!![]})[_0x4d9a('0xb')](function(_0x3ee818){logger[_0x4d9a('0x14')](_0x4d9a('0x1a'),_0x4bbf93);logger[_0x4d9a('0xe')](_0x4d9a('0x1a'),_0x4bbf93,JSON[_0x4d9a('0x10')](_0x3ee818));_0xde6bd4(_0x3ee818);})[_0x4d9a('0x15')](function(_0x1a1849){logger[_0x4d9a('0x11')](_0x4d9a('0x1a'),_0x1a1849[_0x4d9a('0x13')],_0x4bbf93);_0x3c70a4(_0x480291[_0x4d9a('0x11')](0x1f4,_0x1a1849[_0x4d9a('0x13')]));});});};exports[_0x4d9a('0x1b')]=function(_0x5b2469){var _0x374cfc=this;return new Promise(function(_0x2146fd,_0x3dc481){return db[_0x4d9a('0x16')][_0x4d9a('0x1c')](_0x5b2469[_0x4d9a('0x18')],{'raw':_0x5b2469[_0x4d9a('0x1d')]?_0x5b2469[_0x4d9a('0x1d')][_0x4d9a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2469[_0x4d9a('0x1d')]?_0x5b2469[_0x4d9a('0x1d')][_0x4d9a('0x1e')]||null:null,'attributes':_0x5b2469[_0x4d9a('0x1d')]?_0x5b2469[_0x4d9a('0x1d')][_0x4d9a('0x1f')]||null:null,'limit':_0x5b2469[_0x4d9a('0x1d')]?_0x5b2469['options'][_0x4d9a('0x20')]||null:null})[_0x4d9a('0xb')](function(_0xbca9a5){logger[_0x4d9a('0x14')](_0x4d9a('0x1b'),_0x5b2469);logger[_0x4d9a('0xe')](_0x4d9a('0x1b'),_0x5b2469,JSON[_0x4d9a('0x10')](_0xbca9a5));_0x2146fd(_0xbca9a5);})[_0x4d9a('0x15')](function(_0x56a355){logger[_0x4d9a('0x11')]('UpdateChatQueueReport',_0x56a355[_0x4d9a('0x13')],_0x5b2469);_0x3dc481(_0x374cfc['error'](0x1f4,_0x56a355['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index b99b109..86dc53d 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 _0x92a5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x31081a,_0x5abeb6){var _0x2fb5ba=function(_0x48579c){while(--_0x48579c){_0x31081a['push'](_0x31081a['shift']());}};_0x2fb5ba(++_0x5abeb6);}(_0x92a5,0x12b));var _0x592a=function(_0x33fa54,_0x42fd34){_0x33fa54=_0x33fa54-0x0;var _0xd9f968=_0x92a5[_0x33fa54];return _0xd9f968;};'use strict';var multer=require(_0x592a('0x0'));var util=require(_0x592a('0x1'));var path=require(_0x592a('0x2'));var timeout=require(_0x592a('0x3'));var express=require(_0x592a('0x4'));var router=express[_0x592a('0x5')]();var auth=require(_0x592a('0x6'));var interaction=require(_0x592a('0x7'));var config=require(_0x592a('0x8'));var controller=require(_0x592a('0x9'));router[_0x592a('0xa')]('/',auth[_0x592a('0xb')](),controller[_0x592a('0xc')]);router[_0x592a('0xa')](_0x592a('0xd'),auth[_0x592a('0xb')](),controller[_0x592a('0xe')]);router[_0x592a('0xa')](_0x592a('0xf'),auth[_0x592a('0xb')](),controller[_0x592a('0x10')]);router['post']('/',auth[_0x592a('0xb')](),controller[_0x592a('0x11')]);router[_0x592a('0x12')](_0x592a('0xf'),auth[_0x592a('0xb')](),controller[_0x592a('0x13')]);router[_0x592a('0x14')](_0x592a('0xf'),auth[_0x592a('0xb')](),controller[_0x592a('0x15')]);module[_0x592a('0x16')]=router; \ No newline at end of file +var _0xdcab=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x467da9,_0x511e26){var _0x3cdb78=function(_0x85983){while(--_0x85983){_0x467da9['push'](_0x467da9['shift']());}};_0x3cdb78(++_0x511e26);}(_0xdcab,0x79));var _0xbdca=function(_0x46cd52,_0x4bfc02){_0x46cd52=_0x46cd52-0x0;var _0x2aa522=_0xdcab[_0x46cd52];return _0x2aa522;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbdca('0x0'));var timeout=require(_0xbdca('0x1'));var express=require(_0xbdca('0x2'));var router=express[_0xbdca('0x3')]();var auth=require(_0xbdca('0x4'));var interaction=require(_0xbdca('0x5'));var config=require(_0xbdca('0x6'));var controller=require(_0xbdca('0x7'));router[_0xbdca('0x8')]('/',auth[_0xbdca('0x9')](),controller['index']);router[_0xbdca('0x8')](_0xbdca('0xa'),auth[_0xbdca('0x9')](),controller[_0xbdca('0xb')]);router[_0xbdca('0x8')](_0xbdca('0xc'),auth[_0xbdca('0x9')](),controller[_0xbdca('0xd')]);router[_0xbdca('0xe')]('/',auth['isAuthenticated'](),controller[_0xbdca('0xf')]);router[_0xbdca('0x10')]('/:id',auth[_0xbdca('0x9')](),controller[_0xbdca('0x11')]);router[_0xbdca('0x12')](_0xbdca('0xc'),auth[_0xbdca('0x9')](),controller[_0xbdca('0x13')]);module[_0xbdca('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e18cf3f..e255723 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 _0x96bf=['STRING','ENUM','account','agent','queue','DATE','moment','sequelize','exports'];(function(_0x4e69f7,_0x2031af){var _0x67b5e2=function(_0x50b8b1){while(--_0x50b8b1){_0x4e69f7['push'](_0x4e69f7['shift']());}};_0x67b5e2(++_0x2031af);}(_0x96bf,0x1ad));var _0xf96b=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x96bf[_0x28e74e];return _0xb45ac1;};'use strict';var moment=require(_0xf96b('0x0'));var Sequelize=require(_0xf96b('0x1'));module[_0xf96b('0x2')]={'uniqueid':{'type':Sequelize[_0xf96b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf96b('0x4')](_0xf96b('0x5'),_0xf96b('0x6'),_0xf96b('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf96b('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x4ccc=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x46faa7,_0x1a0f99){var _0x428fd0=function(_0x3a620a){while(--_0x3a620a){_0x46faa7['push'](_0x46faa7['shift']());}};_0x428fd0(++_0x1a0f99);}(_0x4ccc,0x73));var _0xc4cc=function(_0x1f4dd5,_0x439ec1){_0x1f4dd5=_0x1f4dd5-0x0;var _0x2976d7=_0x4ccc[_0x1f4dd5];return _0x2976d7;};'use strict';var moment=require(_0xc4cc('0x0'));var Sequelize=require(_0xc4cc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc4cc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc4cc('0x3')](_0xc4cc('0x4'),_0xc4cc('0x5'),_0xc4cc('0x6')),'allowNull':![],'defaultValue':_0xc4cc('0x6')},'transferredAt':{'type':Sequelize[_0xc4cc('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc4cc('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 503eee6..2822290 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 _0x509f=['fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','ChatTransferReport','rawAttributes','type','key','model','query','attributes','intersection'];(function(_0x4322c6,_0x28f126){var _0x4e7537=function(_0x3cf272){while(--_0x3cf272){_0x4322c6['push'](_0x4322c6['shift']());}};_0x4e7537(++_0x28f126);}(_0x509f,0xe5));var _0xf509=function(_0x48cc4e,_0x3fd06a){_0x48cc4e=_0x48cc4e-0x0;var _0x5d6f9c=_0x509f[_0x48cc4e];return _0x5d6f9c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf509('0x0'));var rimraf=require(_0xf509('0x1'));var zipdir=require(_0xf509('0x2'));var jsonpatch=require(_0xf509('0x3'));var rp=require(_0xf509('0x4'));var moment=require(_0xf509('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf509('0x6'));var util=require(_0xf509('0x7'));var path=require('path');var sox=require(_0xf509('0x8'));var csv=require('to-csv');var ejs=require(_0xf509('0x9'));var fs=require('fs');var _=require(_0xf509('0xa'));var squel=require(_0xf509('0xb'));var crypto=require(_0xf509('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf509('0xd'));var querystring=require(_0xf509('0xe'));var Papa=require(_0xf509('0xf'));var Redis=require(_0xf509('0x10'));var authService=require(_0xf509('0x11'));var qs=require(_0xf509('0x12'));var as=require(_0xf509('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf509('0x14'));var utils=require(_0xf509('0x15'));var config=require(_0xf509('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x394c31,_0x4ee2ef){_0x4ee2ef=_0x4ee2ef||0xcc;return function(_0x5882b6){if(_0x5882b6){return _0x394c31['sendStatus'](_0x4ee2ef);}return _0x394c31[_0xf509('0x17')](_0x4ee2ef)['end']();};}function respondWithResult(_0x3f9a03,_0x43949f){_0x43949f=_0x43949f||0xc8;return function(_0x4b7c9d){if(_0x4b7c9d){return _0x3f9a03[_0xf509('0x17')](_0x43949f)[_0xf509('0x18')](_0x4b7c9d);}};}function respondWithFilteredResult(_0x3deebd,_0x35a450){return function(_0x940d00){if(_0x940d00){var _0x140624=_0x940d00['count'],_0x33a70e=_0x35a450[_0xf509('0x19')],_0x3434d0=_0x35a450[_0xf509('0x19')]+_0x35a450[_0xf509('0x1a')],_0x56b3e8;if(_0x3434d0>=_0x140624){_0x3434d0=_0x140624;_0x56b3e8=0xc8;}else{_0x56b3e8=0xce;}_0x3deebd['status'](_0x56b3e8);return _0x3deebd['set'](_0xf509('0x1b'),_0x33a70e+'-'+_0x3434d0+'/'+_0x140624)[_0xf509('0x18')](_0x940d00);}return null;};}function patchUpdates(_0x13460f){return function(_0x5e1243){try{jsonpatch[_0xf509('0x1c')](_0x5e1243,_0x13460f,!![]);}catch(_0x10a481){return BPromise[_0xf509('0x1d')](_0x10a481);}return _0x5e1243[_0xf509('0x1e')]();};}function saveUpdates(_0x7affa4,_0xc8e21a){return function(_0x4cb34a){if(_0x4cb34a){return _0x4cb34a[_0xf509('0x1f')](_0x7affa4)[_0xf509('0x20')](function(_0x2c06a2){return _0x2c06a2;});}return null;};}function removeEntity(_0x543c81,_0x28750e){return function(_0x4c2852){if(_0x4c2852){return _0x4c2852[_0xf509('0x21')]()['then'](function(){_0x543c81[_0xf509('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4572,_0xebd646){return function(_0x38413b){if(!_0x38413b){_0x5a4572[_0xf509('0x22')](0x194);}return _0x38413b;};}function handleError(_0x3ee925,_0x4bd90f){_0x4bd90f=_0x4bd90f||0x1f4;return function(_0x33d588){logger[_0xf509('0x23')](_0x33d588['stack']);if(_0x33d588[_0xf509('0x24')]){delete _0x33d588[_0xf509('0x24')];}_0x3ee925[_0xf509('0x17')](_0x4bd90f)[_0xf509('0x25')](_0x33d588);};}exports['index']=function(_0x24a60b,_0x1fe60a){var _0x478573={},_0x18a1ce={},_0x56aef5={'count':0x0,'rows':[]};var _0x2b04b9=_[_0xf509('0x26')](db[_0xf509('0x27')][_0xf509('0x28')],function(_0x3d4e6b){return{'name':_0x3d4e6b['fieldName'],'type':_0x3d4e6b[_0xf509('0x29')][_0xf509('0x2a')]};});_0x18a1ce[_0xf509('0x2b')]=_[_0xf509('0x26')](_0x2b04b9,_0xf509('0x24'));_0x18a1ce['query']=_['keys'](_0x24a60b['query']);_0x18a1ce['filters']=_['intersection'](_0x18a1ce[_0xf509('0x2b')],_0x18a1ce[_0xf509('0x2c')]);_0x478573[_0xf509('0x2d')]=_[_0xf509('0x2e')](_0x18a1ce[_0xf509('0x2b')],qs[_0xf509('0x2f')](_0x24a60b[_0xf509('0x2c')][_0xf509('0x2f')]));_0x478573[_0xf509('0x2d')]=_0x478573[_0xf509('0x2d')][_0xf509('0x30')]?_0x478573[_0xf509('0x2d')]:_0x18a1ce[_0xf509('0x2b')];if(!_0x24a60b[_0xf509('0x2c')][_0xf509('0x31')](_0xf509('0x32'))){_0x478573['limit']=qs[_0xf509('0x1a')](_0x24a60b[_0xf509('0x2c')][_0xf509('0x1a')]);_0x478573[_0xf509('0x19')]=qs[_0xf509('0x19')](_0x24a60b[_0xf509('0x2c')][_0xf509('0x19')]);}_0x478573['order']=qs[_0xf509('0x33')](_0x24a60b['query'][_0xf509('0x33')]);_0x478573[_0xf509('0x34')]=qs[_0xf509('0x35')](_[_0xf509('0x36')](_0x24a60b['query'],_0x18a1ce[_0xf509('0x35')]),_0x2b04b9);if(_0x24a60b[_0xf509('0x2c')][_0xf509('0x37')]){_0x478573[_0xf509('0x34')]=_[_0xf509('0x38')](_0x478573[_0xf509('0x34')],{'$or':_[_0xf509('0x26')](_0x2b04b9,function(_0xd8f10a){if(_0xd8f10a[_0xf509('0x29')]!==_0xf509('0x39')){var _0x34a574={};_0x34a574[_0xd8f10a[_0xf509('0x24')]]={'$like':'%'+_0x24a60b[_0xf509('0x2c')]['filter']+'%'};return _0x34a574;}})});}_0x478573=_[_0xf509('0x38')]({},_0x478573,_0x24a60b['options']);var _0x34bd75={'where':_0x478573[_0xf509('0x34')]};return db[_0xf509('0x27')]['count'](_0x34bd75)[_0xf509('0x20')](function(_0x47bf4a){_0x56aef5[_0xf509('0x3a')]=_0x47bf4a;if(_0x24a60b[_0xf509('0x2c')][_0xf509('0x3b')]){_0x478573[_0xf509('0x3c')]=[{'all':!![]}];}return db[_0xf509('0x27')]['findAll'](_0x478573);})[_0xf509('0x20')](function(_0xfc6d66){_0x56aef5['rows']=_0xfc6d66;return _0x56aef5;})[_0xf509('0x20')](respondWithFilteredResult(_0x1fe60a,_0x478573))[_0xf509('0x3d')](handleError(_0x1fe60a,null));};exports[_0xf509('0x3e')]=function(_0x86d523,_0x3c13f8){var _0x789b06={'raw':!![],'where':{'id':_0x86d523['params']['id']}},_0xa7c444={};_0xa7c444[_0xf509('0x2b')]=_['keys'](db['ChatTransferReport'][_0xf509('0x28')]);_0xa7c444[_0xf509('0x2c')]=_[_0xf509('0x3f')](_0x86d523[_0xf509('0x2c')]);_0xa7c444[_0xf509('0x35')]=_[_0xf509('0x2e')](_0xa7c444[_0xf509('0x2b')],_0xa7c444[_0xf509('0x2c')]);_0x789b06[_0xf509('0x2d')]=_['intersection'](_0xa7c444[_0xf509('0x2b')],qs[_0xf509('0x2f')](_0x86d523[_0xf509('0x2c')][_0xf509('0x2f')]));_0x789b06[_0xf509('0x2d')]=_0x789b06[_0xf509('0x2d')][_0xf509('0x30')]?_0x789b06[_0xf509('0x2d')]:_0xa7c444[_0xf509('0x2b')];if(_0x86d523[_0xf509('0x2c')][_0xf509('0x3b')]){_0x789b06[_0xf509('0x3c')]=[{'all':!![]}];}_0x789b06=_[_0xf509('0x38')]({},_0x789b06,_0x86d523['options']);return db[_0xf509('0x27')][_0xf509('0x40')](_0x789b06)[_0xf509('0x20')](handleEntityNotFound(_0x3c13f8,null))['then'](respondWithResult(_0x3c13f8,null))[_0xf509('0x3d')](handleError(_0x3c13f8,null));};exports[_0xf509('0x41')]=function(_0x2e5609,_0xfac99c){return db['ChatTransferReport'][_0xf509('0x41')](_0x2e5609['body'],{})[_0xf509('0x20')](respondWithResult(_0xfac99c,0xc9))[_0xf509('0x3d')](handleError(_0xfac99c,null));};exports[_0xf509('0x1f')]=function(_0x513727,_0x7d51da){if(_0x513727[_0xf509('0x42')]['id']){delete _0x513727[_0xf509('0x42')]['id'];}return db[_0xf509('0x27')]['find']({'where':{'id':_0x513727['params']['id']}})[_0xf509('0x20')](handleEntityNotFound(_0x7d51da,null))[_0xf509('0x20')](saveUpdates(_0x513727['body'],null))[_0xf509('0x20')](respondWithResult(_0x7d51da,null))[_0xf509('0x3d')](handleError(_0x7d51da,null));};exports[_0xf509('0x21')]=function(_0x13b24b,_0x5e4a72){return db['ChatTransferReport']['find']({'where':{'id':_0x13b24b[_0xf509('0x43')]['id']}})[_0xf509('0x20')](handleEntityNotFound(_0x5e4a72,null))[_0xf509('0x20')](removeEntity(_0x5e4a72,null))[_0xf509('0x3d')](handleError(_0x5e4a72,null));};exports[_0xf509('0x44')]=function(_0x1b9cc6,_0x574e46){return db[_0xf509('0x27')][_0xf509('0x44')]()[_0xf509('0x20')](respondWithResult(_0x574e46,null))[_0xf509('0x3d')](handleError(_0x574e46,null));}; \ No newline at end of file +var _0x6946=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','merge','options','ChatTransferReport','count','then','includeAll','include','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6946,0x1bb));var _0x6694=function(_0x2b39ad,_0x149888){_0x2b39ad=_0x2b39ad-0x0;var _0x18e421=_0x6946[_0x2b39ad];return _0x18e421;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6694('0x0'));var rimraf=require(_0x6694('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6694('0x2'));var rp=require('request-promise');var moment=require(_0x6694('0x3'));var BPromise=require(_0x6694('0x4'));var Mustache=require(_0x6694('0x5'));var util=require(_0x6694('0x6'));var path=require(_0x6694('0x7'));var sox=require(_0x6694('0x8'));var csv=require('to-csv');var ejs=require(_0x6694('0x9'));var fs=require('fs');var _=require(_0x6694('0xa'));var squel=require(_0x6694('0xb'));var crypto=require(_0x6694('0xc'));var jsforce=require(_0x6694('0xd'));var deskjs=require(_0x6694('0xe'));var toCsv=require(_0x6694('0xf'));var querystring=require(_0x6694('0x10'));var Papa=require(_0x6694('0x11'));var Redis=require(_0x6694('0x12'));var authService=require(_0x6694('0x13'));var qs=require(_0x6694('0x14'));var as=require(_0x6694('0x15'));var hardwareService=require(_0x6694('0x16'));var logger=require(_0x6694('0x17'))(_0x6694('0x18'));var utils=require(_0x6694('0x19'));var config=require(_0x6694('0x1a'));var db=require(_0x6694('0x1b'))['db'];function respondWithStatusCode(_0x21f665,_0x13882a){_0x13882a=_0x13882a||0xcc;return function(_0xfe1e28){if(_0xfe1e28){return _0x21f665[_0x6694('0x1c')](_0x13882a);}return _0x21f665[_0x6694('0x1d')](_0x13882a)['end']();};}function respondWithResult(_0x3e2d25,_0xda844f){_0xda844f=_0xda844f||0xc8;return function(_0x173105){if(_0x173105){return _0x3e2d25[_0x6694('0x1d')](_0xda844f)[_0x6694('0x1e')](_0x173105);}};}function respondWithFilteredResult(_0x14dd3e,_0x91d969){return function(_0x2c3c7a){if(_0x2c3c7a){var _0x52e391=_0x2c3c7a['count'],_0x1c46d7=_0x91d969[_0x6694('0x1f')],_0x4fa341=_0x91d969['offset']+_0x91d969['limit'],_0x53d26b;if(_0x4fa341>=_0x52e391){_0x4fa341=_0x52e391;_0x53d26b=0xc8;}else{_0x53d26b=0xce;}_0x14dd3e[_0x6694('0x1d')](_0x53d26b);return _0x14dd3e[_0x6694('0x20')](_0x6694('0x21'),_0x1c46d7+'-'+_0x4fa341+'/'+_0x52e391)['json'](_0x2c3c7a);}return null;};}function patchUpdates(_0x251961){return function(_0x4ee2ca){try{jsonpatch[_0x6694('0x22')](_0x4ee2ca,_0x251961,!![]);}catch(_0x161dce){return BPromise[_0x6694('0x23')](_0x161dce);}return _0x4ee2ca[_0x6694('0x24')]();};}function saveUpdates(_0xa3934d,_0x38e672){return function(_0x3c55cc){if(_0x3c55cc){return _0x3c55cc[_0x6694('0x25')](_0xa3934d)['then'](function(_0x352c6a){return _0x352c6a;});}return null;};}function removeEntity(_0x27b8b0,_0x2acea3){return function(_0x32ab1a){if(_0x32ab1a){return _0x32ab1a[_0x6694('0x26')]()['then'](function(){_0x27b8b0[_0x6694('0x1d')](0xcc)[_0x6694('0x27')]();});}};}function handleEntityNotFound(_0x3bfb1c,_0x3e809f){return function(_0x1a37d5){if(!_0x1a37d5){_0x3bfb1c[_0x6694('0x1c')](0x194);}return _0x1a37d5;};}function handleError(_0x4a0f71,_0x211209){_0x211209=_0x211209||0x1f4;return function(_0x347ecc){logger[_0x6694('0x28')](_0x347ecc[_0x6694('0x29')]);if(_0x347ecc[_0x6694('0x2a')]){delete _0x347ecc['name'];}_0x4a0f71['status'](_0x211209)[_0x6694('0x2b')](_0x347ecc);};}exports['index']=function(_0x1fd095,_0xdb810b){var _0x2b0530={},_0x321d3e={},_0x451580={'count':0x0,'rows':[]};var _0x141271=_[_0x6694('0x2c')](db['ChatTransferReport'][_0x6694('0x2d')],function(_0x42f9a4){return{'name':_0x42f9a4[_0x6694('0x2e')],'type':_0x42f9a4['type'][_0x6694('0x2f')]};});_0x321d3e['model']=_['map'](_0x141271,_0x6694('0x2a'));_0x321d3e[_0x6694('0x30')]=_[_0x6694('0x31')](_0x1fd095['query']);_0x321d3e[_0x6694('0x32')]=_[_0x6694('0x33')](_0x321d3e[_0x6694('0x34')],_0x321d3e[_0x6694('0x30')]);_0x2b0530[_0x6694('0x35')]=_['intersection'](_0x321d3e[_0x6694('0x34')],qs[_0x6694('0x36')](_0x1fd095[_0x6694('0x30')][_0x6694('0x36')]));_0x2b0530[_0x6694('0x35')]=_0x2b0530[_0x6694('0x35')][_0x6694('0x37')]?_0x2b0530[_0x6694('0x35')]:_0x321d3e[_0x6694('0x34')];if(!_0x1fd095[_0x6694('0x30')][_0x6694('0x38')](_0x6694('0x39'))){_0x2b0530[_0x6694('0x3a')]=qs['limit'](_0x1fd095[_0x6694('0x30')]['limit']);_0x2b0530[_0x6694('0x1f')]=qs['offset'](_0x1fd095[_0x6694('0x30')]['offset']);}_0x2b0530['order']=qs[_0x6694('0x3b')](_0x1fd095['query'][_0x6694('0x3b')]);_0x2b0530[_0x6694('0x3c')]=qs[_0x6694('0x32')](_[_0x6694('0x3d')](_0x1fd095[_0x6694('0x30')],_0x321d3e[_0x6694('0x32')]),_0x141271);if(_0x1fd095[_0x6694('0x30')][_0x6694('0x3e')]){_0x2b0530['where']=_['merge'](_0x2b0530[_0x6694('0x3c')],{'$or':_[_0x6694('0x2c')](_0x141271,function(_0xcde535){if(_0xcde535[_0x6694('0x3f')]!=='VIRTUAL'){var _0xae1dcf={};_0xae1dcf[_0xcde535['name']]={'$like':'%'+_0x1fd095[_0x6694('0x30')][_0x6694('0x3e')]+'%'};return _0xae1dcf;}})});}_0x2b0530=_[_0x6694('0x40')]({},_0x2b0530,_0x1fd095[_0x6694('0x41')]);var _0x229229={'where':_0x2b0530[_0x6694('0x3c')]};return db[_0x6694('0x42')][_0x6694('0x43')](_0x229229)[_0x6694('0x44')](function(_0x457086){_0x451580['count']=_0x457086;if(_0x1fd095[_0x6694('0x30')][_0x6694('0x45')]){_0x2b0530[_0x6694('0x46')]=[{'all':!![]}];}return db[_0x6694('0x42')]['findAll'](_0x2b0530);})['then'](function(_0x32ff83){_0x451580['rows']=_0x32ff83;return _0x451580;})[_0x6694('0x44')](respondWithFilteredResult(_0xdb810b,_0x2b0530))[_0x6694('0x47')](handleError(_0xdb810b,null));};exports['show']=function(_0x3ac1e1,_0x23388d){var _0x55f64c={'raw':!![],'where':{'id':_0x3ac1e1[_0x6694('0x48')]['id']}},_0xee0290={};_0xee0290['model']=_[_0x6694('0x31')](db[_0x6694('0x42')]['rawAttributes']);_0xee0290['query']=_[_0x6694('0x31')](_0x3ac1e1['query']);_0xee0290['filters']=_['intersection'](_0xee0290[_0x6694('0x34')],_0xee0290[_0x6694('0x30')]);_0x55f64c[_0x6694('0x35')]=_[_0x6694('0x33')](_0xee0290['model'],qs['fields'](_0x3ac1e1[_0x6694('0x30')][_0x6694('0x36')]));_0x55f64c[_0x6694('0x35')]=_0x55f64c[_0x6694('0x35')]['length']?_0x55f64c[_0x6694('0x35')]:_0xee0290['model'];if(_0x3ac1e1['query'][_0x6694('0x45')]){_0x55f64c[_0x6694('0x46')]=[{'all':!![]}];}_0x55f64c=_['merge']({},_0x55f64c,_0x3ac1e1[_0x6694('0x41')]);return db['ChatTransferReport'][_0x6694('0x49')](_0x55f64c)[_0x6694('0x44')](handleEntityNotFound(_0x23388d,null))[_0x6694('0x44')](respondWithResult(_0x23388d,null))[_0x6694('0x47')](handleError(_0x23388d,null));};exports[_0x6694('0x4a')]=function(_0x4067b1,_0x5ae9f1){return db[_0x6694('0x42')][_0x6694('0x4a')](_0x4067b1['body'],{})[_0x6694('0x44')](respondWithResult(_0x5ae9f1,0xc9))[_0x6694('0x47')](handleError(_0x5ae9f1,null));};exports[_0x6694('0x25')]=function(_0x44cafa,_0xe9e6a0){if(_0x44cafa['body']['id']){delete _0x44cafa[_0x6694('0x4b')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x44cafa[_0x6694('0x48')]['id']}})[_0x6694('0x44')](handleEntityNotFound(_0xe9e6a0,null))[_0x6694('0x44')](saveUpdates(_0x44cafa['body'],null))[_0x6694('0x44')](respondWithResult(_0xe9e6a0,null))[_0x6694('0x47')](handleError(_0xe9e6a0,null));};exports[_0x6694('0x26')]=function(_0x2d9b18,_0xf4a632){return db[_0x6694('0x42')]['find']({'where':{'id':_0x2d9b18[_0x6694('0x48')]['id']}})[_0x6694('0x44')](handleEntityNotFound(_0xf4a632,null))['then'](removeEntity(_0xf4a632,null))[_0x6694('0x47')](handleError(_0xf4a632,null));};exports[_0x6694('0x4c')]=function(_0x46dfab,_0x289221){return db[_0x6694('0x42')]['describe']()['then'](respondWithResult(_0x289221,null))[_0x6694('0x47')](handleError(_0x289221,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a9570cc..1e87e96 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 _0x4b84=['rimraf','../../config/environment','ChatTransferReport','uniqueid','lodash','util','moment','path'];(function(_0x5b4003,_0x3ab475){var _0x1f2643=function(_0x5dcd6e){while(--_0x5dcd6e){_0x5b4003['push'](_0x5b4003['shift']());}};_0x1f2643(++_0x3ab475);}(_0x4b84,0x1cc));var _0x44b8=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x4b84[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x44b8('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x34e8,0x12c));var _0x834e=function(_0xb68cd0,_0x55d7ac){_0xb68cd0=_0xb68cd0-0x0;var _0x513ade=_0x34e8[_0xb68cd0];return _0x513ade;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6fe8577..c8cc7ef 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 _0xeb59=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util'];(function(_0xf47939,_0x124b6a){var _0x5f1ec1=function(_0x58f724){while(--_0x58f724){_0xf47939['push'](_0xf47939['shift']());}};_0x5f1ec1(++_0x124b6a);}(_0xeb59,0x89));var _0x9eb5=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xeb59[_0x2e78e9];return _0x35aad4;};'use strict';var _=require('lodash');var util=require(_0x9eb5('0x0'));var moment=require(_0x9eb5('0x1'));var BPromise=require(_0x9eb5('0x2'));var rs=require(_0x9eb5('0x3'));var fs=require('fs');var Redis=require(_0x9eb5('0x4'));var db=require(_0x9eb5('0x5'))['db'];var utils=require(_0x9eb5('0x6'));var logger=require(_0x9eb5('0x7'))('rpc');var config=require(_0x9eb5('0x8'));var jayson=require(_0x9eb5('0x9'));var client=jayson[_0x9eb5('0xa')][_0x9eb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34e93a,_0x545fc4,_0x41dd37){return new BPromise(function(_0x2bff37,_0x57fbd5){return client[_0x9eb5('0xc')](_0x34e93a,_0x41dd37)[_0x9eb5('0xd')](function(_0x5835c4){logger[_0x9eb5('0xe')](_0x9eb5('0xf'),_0x545fc4,_0x9eb5('0x10'));logger[_0x9eb5('0x11')](_0x9eb5('0x12'),_0x545fc4,_0x9eb5('0x10'),JSON['stringify'](_0x5835c4));if(_0x5835c4['error']){if(_0x5835c4[_0x9eb5('0x13')][_0x9eb5('0x14')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x545fc4,_0x5835c4['error'][_0x9eb5('0x15')]);return _0x57fbd5(_0x5835c4[_0x9eb5('0x13')][_0x9eb5('0x15')]);}logger[_0x9eb5('0x13')](_0x9eb5('0xf'),_0x545fc4,_0x5835c4['error'][_0x9eb5('0x15')]);return _0x2bff37(_0x5835c4[_0x9eb5('0x13')][_0x9eb5('0x15')]);}else{logger[_0x9eb5('0xe')](_0x9eb5('0xf'),_0x545fc4,_0x9eb5('0x10'));_0x2bff37(_0x5835c4['result'][_0x9eb5('0x15')]);}})[_0x9eb5('0x16')](function(_0x3e85f3){logger[_0x9eb5('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x545fc4,_0x3e85f3);_0x57fbd5(_0x3e85f3);});});} \ No newline at end of file +var _0xcbb2=['../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0xcbb2,0x7e));var _0x2cbb=function(_0x1247cc,_0x4ea41a){_0x1247cc=_0x1247cc-0x0;var _0x4aa826=_0xcbb2[_0x1247cc];return _0x4aa826;};'use strict';var _=require(_0x2cbb('0x0'));var util=require(_0x2cbb('0x1'));var moment=require(_0x2cbb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cbb('0x3'))['db'];var utils=require(_0x2cbb('0x4'));var logger=require(_0x2cbb('0x5'))(_0x2cbb('0x6'));var config=require(_0x2cbb('0x7'));var jayson=require(_0x2cbb('0x8'));var client=jayson[_0x2cbb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x192895,_0x2a32ea,_0x427f72){return new BPromise(function(_0xe89a26,_0xde8347){return client['request'](_0x192895,_0x427f72)[_0x2cbb('0xa')](function(_0x511701){logger[_0x2cbb('0xb')](_0x2cbb('0xc'),_0x2a32ea,_0x2cbb('0xd'));logger['debug'](_0x2cbb('0xe'),_0x2a32ea,_0x2cbb('0xd'),JSON[_0x2cbb('0xf')](_0x511701));if(_0x511701[_0x2cbb('0x10')]){if(_0x511701[_0x2cbb('0x10')]['code']===0x1f4){logger['error'](_0x2cbb('0xc'),_0x2a32ea,_0x511701['error'][_0x2cbb('0x11')]);return _0xde8347(_0x511701['error'][_0x2cbb('0x11')]);}logger[_0x2cbb('0x10')](_0x2cbb('0xc'),_0x2a32ea,_0x511701[_0x2cbb('0x10')][_0x2cbb('0x11')]);return _0xe89a26(_0x511701[_0x2cbb('0x10')][_0x2cbb('0x11')]);}else{logger[_0x2cbb('0xb')](_0x2cbb('0xc'),_0x2a32ea,_0x2cbb('0xd'));_0xe89a26(_0x511701['result'][_0x2cbb('0x11')]);}})[_0x2cbb('0x12')](function(_0x82761e){logger[_0x2cbb('0x10')](_0x2cbb('0xc'),_0x2a32ea,_0x82761e);_0xde8347(_0x82761e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 082d52a..ba0383e 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 _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1410a9,_0x2d4289){var _0x43339d=function(_0x37df0e){while(--_0x37df0e){_0x1410a9['push'](_0x1410a9['shift']());}};_0x43339d(++_0x2d4289);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e0139,_0x4970a3){_0x1e0139=_0x1e0139-0x0;var _0xbfc2ba=_0xb10b[_0x1e0139];return _0xbfc2ba;};'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 ae3dff5..96f03ec 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 _0x1bce=['Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','STRING','address','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message'];(function(_0x32ee50,_0x564493){var _0x12a1b3=function(_0x3d6bc8){while(--_0x3d6bc8){_0x32ee50['push'](_0x32ee50['shift']());}};_0x12a1b3(++_0x564493);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xe1bc('0x0'));var rs=require(_0xe1bc('0x1'));module['exports']={'name':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'unique':_0xe1bc('0x3')},'description':{'type':Sequelize[_0xe1bc('0x2')]},'mapKey':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x4')},'mapKeyOffline':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x4')},'key':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':_0xe1bc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':_0xe1bc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe1bc('0x8')](_0xe1bc('0x9'),'squared'),'defaultValue':_0xe1bc('0x9')},'header_online':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0xb')},'download_transcript':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe1bc('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x10')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0x11')},'closingMessageButton':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x12')},'skipMessageButton':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x13')},'conditionAgreement':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x14')},'ratingType':{'type':Sequelize[_0xe1bc('0x8')](_0xe1bc('0x15'),_0xe1bc('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe1bc('0x17'),'variable':null,'config':{'placeholder':_0xe1bc('0x18'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xe1bc('0x17'),'props':{'title':_0xe1bc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe1bc('0x4'),'type':_0xe1bc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe1bc('0x19')](_0xe1bc('0x1a'))?JSON[_0xe1bc('0x1b')](this[_0xe1bc('0x19')](_0xe1bc('0x1a'))):{};},'set':function(_0x16631e){return this[_0xe1bc('0x1c')](_0xe1bc('0x1a'),JSON[_0xe1bc('0x1d')](_0x16631e));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe1bc('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xe1bc('0x4'),'type':'email'},'variable':null},{'type':_0xe1bc('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xe1bc('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xe1bc('0x19')]('offlineForm')?JSON['parse'](this[_0xe1bc('0x19')](_0xe1bc('0x20'))):{};},'set':function(_0x345da1){return this[_0xe1bc('0x1c')](_0xe1bc('0x20'),JSON[_0xe1bc('0x1d')](_0x345da1));}},'token':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':function(){return rs[_0xe1bc('0x21')]();}},'autoclose':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe1bc('0x2')]},'forwardOffline':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x22')},'waitingMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x24')},'skipUnmanaged':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x12')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe1bc('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe1bc('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe1bc('0xd')],'defaultValue':function(){return _0xe1bc('0x25');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0x26')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x27')},'verticalAlignment':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xe1bc('0x2')]},'customerAvatar':{'type':Sequelize[_0xe1bc('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':_0xe1bc('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe1bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe1bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x29')},'systemAvatar':{'type':Sequelize[_0xe1bc('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe1bc('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![],'comment':_0xe1bc('0x2a'),'set':function(_0x59bc1f){if(!_0x59bc1f)this[_0xe1bc('0x1c')]('mandatoryDispositionPauseId',null);this[_0xe1bc('0x1c')](_0xe1bc('0x2b'),_0x59bc1f);}},'vidaooEscalation':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8375=['stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','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:','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x8375,0xa8));var _0x5837=function(_0x48b8ad,_0x45eee0){_0x48b8ad=_0x48b8ad-0x0;var _0x4933fc=_0x8375[_0x48b8ad];return _0x4933fc;};'use strict';var Sequelize=require(_0x5837('0x0'));var rs=require(_0x5837('0x1'));module[_0x5837('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5837('0x3')],'allowNull':![],'unique':_0x5837('0x4')},'description':{'type':Sequelize[_0x5837('0x3')]},'mapKey':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x5')},'mapKeyOffline':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x5837('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x6')},'customerAlias':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5837('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5837('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5837('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5837('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x5837('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5837('0xa')](_0x5837('0xb'),_0x5837('0xc')),'defaultValue':_0x5837('0xb')},'header_online':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0xd')},'offline_chat_button':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0xe')},'header_offline':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x5837('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5837('0x10')]},'closingQuestion':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5837('0x14')},'closingMessage':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5837('0x16')},'conditionAgreement':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x17')},'ratingType':{'type':Sequelize[_0x5837('0xa')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x5837('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5837('0x18')]({'items':[{'type':_0x5837('0x19'),'variable':null,'config':{'placeholder':_0x5837('0x1a'),'type':_0x5837('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x5837('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5837('0x5'),'type':_0x5837('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5837('0x1c'))?JSON[_0x5837('0x1d')](this[_0x5837('0x1e')]('onlineForm')):{};},'set':function(_0x41f86a){return this[_0x5837('0x1f')](_0x5837('0x1c'),JSON['stringify'](_0x41f86a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5837('0x18')]({'items':[{'type':_0x5837('0x19'),'props':{'title':_0x5837('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5837('0x5'),'type':_0x5837('0x5')},'variable':null},{'type':_0x5837('0x20'),'config':{'placeholder':_0x5837('0x21')},'props':{'title':_0x5837('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5837('0x1e')](_0x5837('0x22'))?JSON[_0x5837('0x1d')](this[_0x5837('0x1e')](_0x5837('0x22'))):{};},'set':function(_0x228f1){return this[_0x5837('0x1f')](_0x5837('0x22'),JSON['stringify'](_0x228f1));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5837('0x23')]();}},'autoclose':{'type':Sequelize[_0x5837('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5837('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5837('0x3')]},'waitingTitle':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x5837('0x25')},'offlineMessageBody':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x5837('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5837('0x16')},'sendUnmanaged':{'type':Sequelize[_0x5837('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5837('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5837('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5837('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x5837('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5837('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x28')},'verticalAlignment':{'type':Sequelize[_0x5837('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5837('0x29')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5837('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5837('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5837('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5837('0x3')],'defaultValue':_0x5837('0x2b')},'systemAvatar':{'type':Sequelize[_0x5837('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5837('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![],'comment':_0x5837('0x2d'),'set':function(_0x31710b){if(!_0x31710b)this[_0x5837('0x1f')](_0x5837('0x2e'),null);this[_0x5837('0x1f')](_0x5837('0x2f'),_0x31710b);}},'vidaooEscalation':{'type':Sequelize[_0x5837('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5837('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0ca6bc9..106c902 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 _0xa116=['file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','../../config/license/util','custom','isNil','root','join','server/files/images/logos/','download','getAvatar','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','CmList','List','DESC','ChatApplication','Applications','account','applications','list','priority','asc','Contacts','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','lastName','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','hasOwnProperty','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','push','all','some','server/files/chat/iframe.js','remote','connection','replace','render','alignment','addApplications','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','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','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','get','end','stack','name','send','index','map','ChatWebsite','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filters','filter','merge','includeAll','findAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','options','create','body','user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','include','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic'];(function(_0xdd7981,_0x375aca){var _0xc705ae=function(_0xd8cb4d){while(--_0xd8cb4d){_0xdd7981['push'](_0xdd7981['shift']());}};_0xc705ae(++_0x375aca);}(_0xa116,0x1dd));var _0x6a11=function(_0x52ef6a,_0x544601){_0x52ef6a=_0x52ef6a-0x0;var _0x597102=_0xa116[_0x52ef6a];return _0x597102;};'use strict';var pdf=require(_0x6a11('0x0'));var emlformat=require(_0x6a11('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a11('0x3'));var moment=require(_0x6a11('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a11('0x5'));var util=require(_0x6a11('0x6'));var path=require(_0x6a11('0x7'));var sox=require(_0x6a11('0x8'));var csv=require('to-csv');var ejs=require(_0x6a11('0x9'));var fs=require('fs');var _=require(_0x6a11('0xa'));var squel=require(_0x6a11('0xb'));var crypto=require('crypto');var jsforce=require(_0x6a11('0xc'));var deskjs=require(_0x6a11('0xd'));var toCsv=require(_0x6a11('0xe'));var querystring=require(_0x6a11('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a11('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a11('0x11'));var hardwareService=require(_0x6a11('0x12'));var logger=require('../../config/logger')(_0x6a11('0x13'));var utils=require(_0x6a11('0x14'));var config=require('../../config/environment');var db=require(_0x6a11('0x15'))['db'];config[_0x6a11('0x16')]=_['defaults'](config[_0x6a11('0x16')],{'host':_0x6a11('0x17'),'port':0x18eb});var socket=require(_0x6a11('0x18'))(new Redis(config['redis']));require(_0x6a11('0x19'))[_0x6a11('0x1a')](socket);var jayson=require(_0x6a11('0x1b'));var client=jayson[_0x6a11('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x6a11('0x1c')][_0x6a11('0x1d')]({'port':0x232a});var client9003=jayson[_0x6a11('0x1c')][_0x6a11('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x559acb,_0x41728c,_0x129889){if(_0x129889){var _0x44a004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44a004[_0x6a11('0x1e')](_0x41728c)){return _0x559acb;}else{throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x21'));}}else{return _0x559acb;}}function respondWithRpcPromise(_0x4288ec,_0x273b0e,_0x1f8c99,_0x106e2e){return new BPromise(function(_0x13eebb,_0x483fe4){var _0x109b06=_0x106e2e||client;return _0x109b06[_0x6a11('0x22')](_0x4288ec,_0x1f8c99)[_0x6a11('0x23')](function(_0x2e31bb){logger[_0x6a11('0x24')](_0x6a11('0x25'),_0x273b0e,_0x6a11('0x26'));logger[_0x6a11('0x27')](_0x6a11('0x28'),_0x273b0e,_0x6a11('0x26'),JSON[_0x6a11('0x29')](_0x2e31bb));if(_0x2e31bb[_0x6a11('0x2a')]){if(_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2b')]===0x1f4){logger['error'](_0x6a11('0x25'),_0x273b0e,_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);return _0x483fe4(_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);}logger[_0x6a11('0x2a')](_0x6a11('0x25'),_0x273b0e,_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);return _0x13eebb(_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);}else{logger[_0x6a11('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x273b0e,_0x6a11('0x26'));_0x13eebb(_0x2e31bb[_0x6a11('0x2d')][_0x6a11('0x2c')]);}})[_0x6a11('0x2e')](function(_0x62984a){logger[_0x6a11('0x2a')](_0x6a11('0x25'),_0x273b0e,_0x62984a);_0x483fe4(_0x62984a);});});}function respondWithStatusCode(_0x565cdf,_0x20fa9e){_0x20fa9e=_0x20fa9e||0xcc;return function(_0x1928b3){if(_0x1928b3){return _0x565cdf[_0x6a11('0x2f')](_0x20fa9e);}return _0x565cdf[_0x6a11('0x30')](_0x20fa9e)['end']();};}function respondWithResult(_0x2d4790,_0x16e705){_0x16e705=_0x16e705||0xc8;return function(_0x45b7f7){if(_0x45b7f7){return _0x2d4790[_0x6a11('0x30')](_0x16e705)[_0x6a11('0x31')](_0x45b7f7);}};}function respondWithFilteredResult(_0x4cc6dd,_0x48f317){return function(_0x315df6){if(_0x315df6){var _0x4a1e5b=_0x315df6[_0x6a11('0x32')],_0x5139ce=_0x48f317[_0x6a11('0x33')],_0x35ec37=_0x48f317[_0x6a11('0x33')]+_0x48f317['limit'],_0x131f3a;if(_0x35ec37>=_0x4a1e5b){_0x35ec37=_0x4a1e5b;_0x131f3a=0xc8;}else{_0x131f3a=0xce;}_0x4cc6dd['status'](_0x131f3a);return _0x4cc6dd[_0x6a11('0x34')](_0x6a11('0x35'),_0x5139ce+'-'+_0x35ec37+'/'+_0x4a1e5b)[_0x6a11('0x31')](_0x315df6);}return null;};}function patchUpdates(_0xe99a9f){return function(_0x1c742c){try{jsonpatch['apply'](_0x1c742c,_0xe99a9f,!![]);}catch(_0x575fe5){return BPromise[_0x6a11('0x36')](_0x575fe5);}return _0x1c742c[_0x6a11('0x37')]();};}function saveUpdates(_0x21db49,_0x388e28){return function(_0x131337){if(_0x131337){return _0x131337[_0x6a11('0x38')](_0x21db49)[_0x6a11('0x23')](function(_0xd65e9a){return _0xd65e9a;});}return null;};}function removeEntity(_0xc7bb83,_0x264d38){return function(_0x420401){if(_0x420401){return _0x420401[_0x6a11('0x39')]()[_0x6a11('0x23')](function(){var _0x512ff0=_0x420401[_0x6a11('0x3a')]({'plain':!![]});var _0x436ba8='ChatWebsites';return db['UserProfileResource'][_0x6a11('0x39')]({'where':{'type':_0x436ba8,'resourceId':_0x512ff0['id']}})[_0x6a11('0x23')](function(){return _0x420401;});})['then'](function(){_0xc7bb83[_0x6a11('0x30')](0xcc)[_0x6a11('0x3b')]();});}};}function handleEntityNotFound(_0x57ab23,_0x399d77){return function(_0x582d88){if(!_0x582d88){_0x57ab23[_0x6a11('0x2f')](0x194);}return _0x582d88;};}function handleError(_0x41fcbe,_0x4b0e05){_0x4b0e05=_0x4b0e05||0x1f4;return function(_0x3b1d64){logger['error'](_0x3b1d64[_0x6a11('0x3c')]);if(_0x3b1d64[_0x6a11('0x3d')]){delete _0x3b1d64['name'];}_0x41fcbe[_0x6a11('0x30')](_0x4b0e05)[_0x6a11('0x3e')](_0x3b1d64);};}exports[_0x6a11('0x3f')]=function(_0x440c8e,_0x51d8d6){var _0x3879ec={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x47665e={},_0x2f19a0={'count':0x0,'rows':[]};var _0x123067=_[_0x6a11('0x40')](db[_0x6a11('0x41')]['rawAttributes'],function(_0x6ff130){return{'name':_0x6ff130[_0x6a11('0x42')],'type':_0x6ff130[_0x6a11('0x43')]['key']};});_0x47665e[_0x6a11('0x44')]=_[_0x6a11('0x40')](_0x123067,_0x6a11('0x3d'));_0x47665e[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x440c8e['query']);_0x47665e['filters']=_[_0x6a11('0x47')](_0x47665e[_0x6a11('0x44')],_0x47665e[_0x6a11('0x45')]);_0x3879ec['attributes']=_[_0x6a11('0x47')](_0x47665e[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x440c8e[_0x6a11('0x45')][_0x6a11('0x48')]));_0x3879ec[_0x6a11('0x49')]=_0x3879ec[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x3879ec['attributes']:_0x47665e['model'];if(!_0x440c8e[_0x6a11('0x45')]['hasOwnProperty'](_0x6a11('0x4b'))){_0x3879ec[_0x6a11('0x4c')]=qs[_0x6a11('0x4c')](_0x440c8e['query'][_0x6a11('0x4c')]);_0x3879ec[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x440c8e['query'][_0x6a11('0x33')]);}_0x3879ec['order']=qs[_0x6a11('0x4d')](_0x440c8e[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x3879ec[_0x6a11('0x4e')]=qs['filters'](_[_0x6a11('0x4f')](_0x440c8e['query'],_0x47665e[_0x6a11('0x50')]),_0x123067);if(_0x440c8e[_0x6a11('0x45')][_0x6a11('0x51')]){_0x3879ec['where']=_[_0x6a11('0x52')](_0x3879ec[_0x6a11('0x4e')],{'$or':_['map'](_0x123067,function(_0xf2068){if(_0xf2068[_0x6a11('0x43')]!=='VIRTUAL'){var _0x3d30ae={};_0x3d30ae[_0xf2068['name']]={'$like':'%'+_0x440c8e['query'][_0x6a11('0x51')]+'%'};return _0x3d30ae;}})});}_0x3879ec=_[_0x6a11('0x52')]({},_0x3879ec,_0x440c8e['options']);var _0x2df374={'where':_0x3879ec[_0x6a11('0x4e')]};return db[_0x6a11('0x41')][_0x6a11('0x32')](_0x2df374)[_0x6a11('0x23')](function(_0x275933){_0x2f19a0[_0x6a11('0x32')]=_0x275933;if(_0x440c8e[_0x6a11('0x45')][_0x6a11('0x53')]){_0x3879ec['include']=[{'all':!![]}];}return db[_0x6a11('0x41')][_0x6a11('0x54')](_0x3879ec);})[_0x6a11('0x23')](function(_0x98e2ea){_0x2f19a0[_0x6a11('0x55')]=_0x98e2ea;return _0x2f19a0;})[_0x6a11('0x23')](respondWithFilteredResult(_0x51d8d6,_0x3879ec))[_0x6a11('0x2e')](handleError(_0x51d8d6,null));};exports[_0x6a11('0x56')]=function(_0xf16eaf,_0x17f32e){var _0x40597c={'raw':![],'where':{'id':_0xf16eaf['params']['id']},'include':[{'model':db[_0x6a11('0x57')],'as':_0x6a11('0x58')}]},_0x497619={};_0x497619[_0x6a11('0x44')]=_[_0x6a11('0x46')](db['ChatWebsite'][_0x6a11('0x59')]);_0x497619['query']=_['keys'](_0xf16eaf[_0x6a11('0x45')]);_0x497619['filters']=_[_0x6a11('0x47')](_0x497619[_0x6a11('0x44')],_0x497619['query']);_0x40597c[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x497619[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0xf16eaf['query'][_0x6a11('0x48')]));_0x40597c['attributes']=_0x40597c['attributes'][_0x6a11('0x4a')]?_0x40597c[_0x6a11('0x49')]:_0x497619[_0x6a11('0x44')];if(_0xf16eaf[_0x6a11('0x45')]['includeAll']){_0x40597c['include']=[{'all':!![]}];}_0x40597c=_[_0x6a11('0x52')]({},_0x40597c,_0xf16eaf[_0x6a11('0x5a')]);return db[_0x6a11('0x41')]['find'](_0x40597c)[_0x6a11('0x23')](handleEntityNotFound(_0x17f32e,null))[_0x6a11('0x23')](respondWithResult(_0x17f32e,null))[_0x6a11('0x2e')](handleError(_0x17f32e,null));};exports[_0x6a11('0x5b')]=function(_0x4c2b4e,_0x286d65){return db[_0x6a11('0x41')][_0x6a11('0x5b')](_0x4c2b4e[_0x6a11('0x5c')],{})[_0x6a11('0x23')](function(_0x5a357c){var _0x270179=_0x4c2b4e[_0x6a11('0x5d')]['get']({'plain':!![]});if(!_0x270179)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x270179[_0x6a11('0x5e')]===_0x6a11('0x5d')){var _0x4d5282=_0x5a357c[_0x6a11('0x3a')]({'plain':!![]});var _0x3b9b41=_0x6a11('0x5f');return db[_0x6a11('0x60')]['find']({'where':{'name':_0x3b9b41,'userProfileId':_0x270179[_0x6a11('0x61')]},'raw':!![]})['then'](function(_0x24306e){if(_0x24306e&&_0x24306e[_0x6a11('0x62')]===0x0){return db[_0x6a11('0x63')][_0x6a11('0x5b')]({'name':_0x4d5282['name'],'resourceId':_0x4d5282['id'],'type':_0x24306e[_0x6a11('0x3d')],'sectionId':_0x24306e['id']},{})[_0x6a11('0x23')](function(){return _0x5a357c;});}else{return _0x5a357c;}})[_0x6a11('0x2e')](function(_0x3a1d5b){logger[_0x6a11('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a1d5b);throw _0x3a1d5b;});}return _0x5a357c;})[_0x6a11('0x23')](respondWithResult(_0x286d65,0xc9))['catch'](handleError(_0x286d65,null));};exports[_0x6a11('0x38')]=function(_0x384471,_0x238e06){if(_0x384471[_0x6a11('0x5c')]['id']){delete _0x384471[_0x6a11('0x5c')]['id'];}return db['ChatWebsite'][_0x6a11('0x64')]({'where':{'id':_0x384471[_0x6a11('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x6a11('0x58')}]})[_0x6a11('0x23')](handleEntityNotFound(_0x238e06,null))[_0x6a11('0x23')](saveUpdates(_0x384471[_0x6a11('0x5c')],null))[_0x6a11('0x23')](respondWithResult(_0x238e06,null))[_0x6a11('0x2e')](handleError(_0x238e06,null));};exports[_0x6a11('0x39')]=function(_0x1eb110,_0x1d45ac){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x1eb110[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x1d45ac,null))['then'](removeEntity(_0x1d45ac,null))[_0x6a11('0x2e')](handleError(_0x1d45ac,null));};exports[_0x6a11('0x66')]=function(_0x25328a,_0x4c4603){return db[_0x6a11('0x41')][_0x6a11('0x66')]()[_0x6a11('0x23')](respondWithResult(_0x4c4603,null))[_0x6a11('0x2e')](handleError(_0x4c4603,null));};exports[_0x6a11('0x67')]=function(_0x4f2748,_0x35409f,_0x4ee1fe){if(_0x4f2748[_0x6a11('0x5c')]['id']){delete _0x4f2748[_0x6a11('0x5c')]['id'];}return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x4f2748['params']['id']}})['then'](handleEntityNotFound(_0x35409f,null))[_0x6a11('0x23')](function(_0x2ec050){if(_0x2ec050){_0x4f2748[_0x6a11('0x5c')][_0x6a11('0x68')]=_0x2ec050['id'];return db[_0x6a11('0x69')][_0x6a11('0x5b')](_0x4f2748['body']);}})['then'](respondWithResult(_0x35409f,null))[_0x6a11('0x2e')](handleError(_0x35409f,null));};exports[_0x6a11('0x6a')]=function(_0x5aecdc,_0x47defc,_0x59580a){var _0x552413={'raw':![],'where':{}};var _0x24884a={};var _0x40e2e5={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x5aecdc[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x47defc,null))[_0x6a11('0x23')](function(_0x3ae472){if(_0x3ae472){_0x24884a[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0x69')][_0x6a11('0x59')]);_0x24884a[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x5aecdc[_0x6a11('0x45')]);_0x24884a['filters']=_['intersection'](_0x24884a['model'],_0x24884a[_0x6a11('0x45')]);_0x552413[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x24884a['model'],qs[_0x6a11('0x48')](_0x5aecdc['query']['fields']));_0x552413['attributes']=_0x552413[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x552413[_0x6a11('0x49')]:_0x24884a[_0x6a11('0x44')];if(!_0x5aecdc[_0x6a11('0x45')]['hasOwnProperty']('nolimit')){_0x552413[_0x6a11('0x4c')]=qs[_0x6a11('0x4c')](_0x5aecdc[_0x6a11('0x45')][_0x6a11('0x4c')]);_0x552413['offset']=qs[_0x6a11('0x33')](_0x5aecdc['query']['offset']);}_0x552413[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x5aecdc[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x552413[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x5aecdc[_0x6a11('0x45')],_0x24884a[_0x6a11('0x50')]));_0x552413[_0x6a11('0x4e')][_0x6a11('0x68')]=_0x3ae472['id'];if(_0x5aecdc['query'][_0x6a11('0x51')]){_0x552413[_0x6a11('0x4e')]=_['merge'](_0x552413[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x552413[_0x6a11('0x49')],function(_0x194754){var _0x1988ec={};_0x1988ec[_0x194754]={'$like':'%'+_0x5aecdc[_0x6a11('0x45')]['filter']+'%'};return _0x1988ec;})});}_0x552413=_['merge']({},_0x552413,_0x5aecdc[_0x6a11('0x5a')]);return db[_0x6a11('0x69')]['count']({'where':_0x552413[_0x6a11('0x4e')]})['then'](function(_0x5a9632){_0x40e2e5['count']=_0x5a9632;if(_0x5aecdc[_0x6a11('0x45')][_0x6a11('0x53')]){_0x552413[_0x6a11('0x6d')]=[{'all':!![]}];}return db[_0x6a11('0x69')][_0x6a11('0x54')](_0x552413);})[_0x6a11('0x23')](function(_0x18da79){_0x40e2e5['rows']=_0x18da79;return _0x40e2e5;});}})[_0x6a11('0x23')](respondWithFilteredResult(_0x47defc,_0x552413))['catch'](handleError(_0x47defc,null));};exports[_0x6a11('0x6e')]=function(_0x1f598a,_0x33a474,_0xa7460c){return db[_0x6a11('0x41')]['find']({'where':{'id':_0x1f598a['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x33a474,null))[_0x6a11('0x23')](function(_0x25e0d1){if(_0x25e0d1){return _0x25e0d1[_0x6a11('0x6e')](_0x1f598a[_0x6a11('0x45')][_0x6a11('0x6f')]);}})[_0x6a11('0x23')](respondWithStatusCode(_0x33a474,null))[_0x6a11('0x2e')](handleError(_0x33a474,null));};exports['addAnswer']=function(_0x55c7de,_0x48acb1,_0xff402c){if(_0x55c7de[_0x6a11('0x5c')]['id']){delete _0x55c7de[_0x6a11('0x5c')]['id'];}return db[_0x6a11('0x41')]['find']({'where':{'id':_0x55c7de[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x48acb1,null))[_0x6a11('0x23')](function(_0x3d44b9){if(_0x3d44b9){_0x55c7de['body'][_0x6a11('0x68')]=_0x3d44b9['id'];return db['CannedAnswer'][_0x6a11('0x5b')](_0x55c7de[_0x6a11('0x5c')]);}})['then'](respondWithResult(_0x48acb1,null))[_0x6a11('0x2e')](handleError(_0x48acb1,null));};exports[_0x6a11('0x70')]=function(_0x51c0d1,_0x38b17f,_0x2f847b){var _0x24f75e={'raw':![],'where':{}};var _0x166357={};var _0x9b450e={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x51c0d1[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x38b17f,null))['then'](function(_0x35c887){if(_0x35c887){_0x166357[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0x71')][_0x6a11('0x59')]);_0x166357['query']=_[_0x6a11('0x46')](_0x51c0d1[_0x6a11('0x45')]);_0x166357[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x166357['model'],_0x166357[_0x6a11('0x45')]);_0x24f75e['attributes']=_['intersection'](_0x166357[_0x6a11('0x44')],qs['fields'](_0x51c0d1[_0x6a11('0x45')]['fields']));_0x24f75e[_0x6a11('0x49')]=_0x24f75e[_0x6a11('0x49')]['length']?_0x24f75e['attributes']:_0x166357['model'];if(!_0x51c0d1['query']['hasOwnProperty'](_0x6a11('0x4b'))){_0x24f75e['limit']=qs[_0x6a11('0x4c')](_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x4c')]);_0x24f75e[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x33')]);}_0x24f75e[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x24f75e[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x51c0d1[_0x6a11('0x45')],_0x166357[_0x6a11('0x50')]));_0x24f75e['where'][_0x6a11('0x68')]=_0x35c887['id'];if(_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x51')]){_0x24f75e['where']=_[_0x6a11('0x52')](_0x24f75e[_0x6a11('0x4e')],{'$or':_['map'](_0x24f75e['attributes'],function(_0x1d1a15){var _0x69b72={};_0x69b72[_0x1d1a15]={'$like':'%'+_0x51c0d1[_0x6a11('0x45')]['filter']+'%'};return _0x69b72;})});}_0x24f75e=_[_0x6a11('0x52')]({},_0x24f75e,_0x51c0d1[_0x6a11('0x5a')]);return db[_0x6a11('0x71')][_0x6a11('0x32')]({'where':_0x24f75e['where']})[_0x6a11('0x23')](function(_0x47c78a){_0x9b450e['count']=_0x47c78a;if(_0x51c0d1[_0x6a11('0x45')]['includeAll']){_0x24f75e['include']=[{'all':!![]}];}return db[_0x6a11('0x71')][_0x6a11('0x54')](_0x24f75e);})[_0x6a11('0x23')](function(_0x54ba67){_0x9b450e[_0x6a11('0x55')]=_0x54ba67;return _0x9b450e;});}})['then'](respondWithFilteredResult(_0x38b17f,_0x24f75e))[_0x6a11('0x2e')](handleError(_0x38b17f,null));};exports[_0x6a11('0x72')]=function(_0xdf089a,_0x3c40a2,_0x397149){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0xdf089a[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x3c40a2,null))[_0x6a11('0x23')](function(_0x59fc6b){if(_0x59fc6b){return _0x59fc6b[_0x6a11('0x72')](_0xdf089a[_0x6a11('0x45')][_0x6a11('0x6f')]);}})['then'](respondWithStatusCode(_0x3c40a2,null))[_0x6a11('0x2e')](handleError(_0x3c40a2,null));};exports[_0x6a11('0x73')]=function(_0xeba92c,_0x2f0e75,_0x14c724){_0xeba92c[_0x6a11('0x5c')][_0x6a11('0x74')]=_0xeba92c[_0x6a11('0x75')][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0xeba92c[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x2f0e75,null))[_0x6a11('0x23')](saveUpdates(_0xeba92c['body'],null))[_0x6a11('0x23')](respondWithResult(_0x2f0e75,null))[_0x6a11('0x2e')](handleError(_0x2f0e75,null));};exports[_0x6a11('0x77')]=function(_0x3713f7,_0x1e8e60,_0x170ebc){_0x3713f7['body']['agentAvatar']=_0x3713f7['file'][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x3713f7['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x1e8e60,null))[_0x6a11('0x23')](saveUpdates(_0x3713f7[_0x6a11('0x5c')],null))['then'](respondWithResult(_0x1e8e60,null))[_0x6a11('0x2e')](handleError(_0x1e8e60,null));};exports[_0x6a11('0x78')]=function(_0x25befa,_0x2674c8,_0x251f27){_0x25befa[_0x6a11('0x5c')][_0x6a11('0x79')]=_0x25befa[_0x6a11('0x75')][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x25befa['params']['id']}})['then'](handleEntityNotFound(_0x2674c8,null))['then'](saveUpdates(_0x25befa['body'],null))['then'](respondWithResult(_0x2674c8,null))['catch'](handleError(_0x2674c8,null));};exports[_0x6a11('0x7a')]=function(_0x3cb73b,_0x587c5d,_0x7a0b8){_0x3cb73b[_0x6a11('0x5c')][_0x6a11('0x7b')]=_0x3cb73b['file'][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x3cb73b[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x587c5d,null))[_0x6a11('0x23')](saveUpdates(_0x3cb73b[_0x6a11('0x5c')],null))[_0x6a11('0x23')](respondWithResult(_0x587c5d,null))['catch'](handleError(_0x587c5d,null));};exports[_0x6a11('0x7c')]=function(_0x5ba127,_0x30b649,_0x3a4571){var _0x4242ce=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x42955b={'where':{'id':_0x5ba127['params']['id']},'attributes':['id',_0x6a11('0x74')],'raw':!![]};var _0x4aa5e4=![];return require(_0x6a11('0x7d'))['getLicense']()[_0x6a11('0x23')](function(_0x4a66fe){if(_0x4a66fe){_0x4aa5e4=_0x4a66fe[_0x6a11('0x7e')];}})[_0x6a11('0x23')](function(){return db[_0x6a11('0x41')][_0x6a11('0x64')](_0x42955b);})[_0x6a11('0x23')](handleEntityNotFound(_0x30b649,null))[_0x6a11('0x23')](function(_0x4514fe){if(_0x4514fe){if(!_[_0x6a11('0x7f')](_0x4514fe[_0x6a11('0x74')])){if(fs['existsSync'](path['join'](config[_0x6a11('0x80')],'server/files/images/logos/',_0x4514fe[_0x6a11('0x74')]))&&_0x4aa5e4){_0x4242ce=path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x82'),_0x4514fe[_0x6a11('0x74')]);}}return _0x30b649[_0x6a11('0x83')](_0x4242ce);}})[_0x6a11('0x2e')](handleError(_0x30b649,null));};exports[_0x6a11('0x84')]=function(_0x453acd,_0x399792,_0x330d03){var _0x4da06d=path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/images/avatars/default_avatar.png');var _0x3bd0e3={'where':{'id':_0x453acd[_0x6a11('0x65')]['id']},'attributes':['id',_0x6a11('0x85')],'raw':!![]};return db[_0x6a11('0x41')][_0x6a11('0x64')](_0x3bd0e3)['then'](handleEntityNotFound(_0x399792,null))[_0x6a11('0x23')](function(_0x4c73b0){if(_0x4c73b0){if(!_[_0x6a11('0x7f')](_0x4c73b0[_0x6a11('0x85')])){if(fs[_0x6a11('0x86')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/images/avatars/',_0x4c73b0[_0x6a11('0x85')]))){_0x4da06d=path['join'](config[_0x6a11('0x80')],_0x6a11('0x87'),_0x4c73b0['agentAvatar']);}}return _0x399792['download'](_0x4da06d);}})['catch'](handleError(_0x399792,null));};exports[_0x6a11('0x88')]=function(_0x14f406,_0x11b747,_0x28292f){var _0x294ace=path['join'](config[_0x6a11('0x80')],'server/files/images/avatars/customer_avatar.png');var _0x148236={'where':{'id':_0x14f406[_0x6a11('0x65')]['id']},'attributes':['id',_0x6a11('0x79'),_0x6a11('0x89')],'raw':!![]};return db[_0x6a11('0x41')]['find'](_0x148236)['then'](handleEntityNotFound(_0x11b747,null))[_0x6a11('0x23')](function(_0x428ef1){if(_0x428ef1){if(!_[_0x6a11('0x7f')](_0x428ef1[_0x6a11('0x79')])){if(fs[_0x6a11('0x86')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x87'),_0x428ef1[_0x6a11('0x79')]))&&_0x428ef1[_0x6a11('0x89')]){_0x294ace=path[_0x6a11('0x81')](config['root'],_0x6a11('0x87'),_0x428ef1['customerAvatar']);}}return _0x11b747['download'](_0x294ace);}})[_0x6a11('0x2e')](handleError(_0x11b747,null));};exports['getSystemAvatar']=function(_0x2f81ce,_0x513d56,_0x2d3db0){var _0x19ba39=path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x8a'));var _0x47f4a1={'where':{'id':_0x2f81ce[_0x6a11('0x65')]['id']},'attributes':['id',_0x6a11('0x7b')],'raw':!![]};return db[_0x6a11('0x41')][_0x6a11('0x64')](_0x47f4a1)[_0x6a11('0x23')](handleEntityNotFound(_0x513d56,null))[_0x6a11('0x23')](function(_0x40d32f){if(_0x40d32f){if(!_[_0x6a11('0x7f')](_0x40d32f['systemAvatar'])){if(fs[_0x6a11('0x86')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/images/avatars/',_0x40d32f[_0x6a11('0x7b')]))){_0x19ba39=path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x87'),_0x40d32f['systemAvatar']);}}return _0x513d56['download'](_0x19ba39);}})[_0x6a11('0x2e')](handleError(_0x513d56,null));};exports['notify']=function(_0x4c030a,_0x104118,_0x5974bd){var _0x3e88d9=require(_0x6a11('0x8b'));var _0x29323c=new _0x3e88d9();var _0x28b2e0=_0x29323c[_0x6a11('0x8c')](_0x4c030a[_0x6a11('0x8d')]['user-agent'])[_0x6a11('0x8e')]();var _0xbe964d={'body':_0x4c030a[_0x6a11('0x5c')],'channel':_0x6a11('0x8f')};var _0x3d2778=[];var _0x8bbe20=[];var _0x347ed3={};var _0xa23c90=![];return db[_0x6a11('0x90')][_0x6a11('0x66')]()['then'](function(_0x2f2f49){if(!_0x2f2f49){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x91'));}_0x3d2778=_[_0x6a11('0x92')](_[_0x6a11('0x46')](_0x2f2f49),[_0x6a11('0x93'),_0x6a11('0x94')]);_0x8bbe20=_[_0x6a11('0x92')](_[_0x6a11('0x46')](_0x2f2f49),['createdAt','updatedAt',_0x6a11('0x95'),_0x6a11('0x96')]);if(_0x4c030a[_0x6a11('0x5c')]['id']){delete _0x4c030a[_0x6a11('0x5c')]['id'];}if(_[_0x6a11('0x7f')](_0x4c030a['body'][_0x6a11('0x97')])){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))]('from\x20is\x20mandatory');}if(_[_0x6a11('0x7f')](_0x4c030a[_0x6a11('0x5c')]['body'])||_0x4c030a[_0x6a11('0x5c')][_0x6a11('0x5c')]===''){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x98'));}if(_[_0x6a11('0x7f')](_0x4c030a[_0x6a11('0x5c')]['mapKey'])){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x99')+_0x8bbe20);}if(!_[_0x6a11('0x9a')](_0x8bbe20,_0x4c030a[_0x6a11('0x5c')][_0x6a11('0x9b')])){throw new db[(_0x6a11('0x1f'))]['ValidationError'](_0x6a11('0x9c')+_0x8bbe20);}_0x347ed3[_0x4c030a['body'][_0x6a11('0x9b')]]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0x97')];})[_0x6a11('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4c030a['params']['id']},'include':[{'model':db[_0x6a11('0x9d')],'as':_0x6a11('0x9e'),'include':[{'model':db[_0x6a11('0x90')],'as':'Contacts','where':_0x347ed3,'limit':0x1,'order':[['updatedAt',_0x6a11('0x9f')]]}]},{'model':db[_0x6a11('0xa0')],'as':_0x6a11('0xa1')}]});})[_0x6a11('0x23')](handleEntityNotFound(_0x104118,null))[_0x6a11('0x23')](function(_0x270855){if(_0x270855&&_0x270855[_0x6a11('0x9e')]){_0xbe964d[_0x6a11('0xa2')]=_0x270855;_0xbe964d[_0x6a11('0xa3')]=_0x270855[_0x6a11('0xa1')];_0xbe964d[_0x6a11('0xa4')]=_0x270855[_0x6a11('0x9e')];_0xbe964d[_0x6a11('0xa3')]=_['orderBy'](_0xbe964d[_0x6a11('0xa3')],[_0x6a11('0xa5')],[_0x6a11('0xa6')]);if(_0xbe964d[_0x6a11('0xa2')][_0x6a11('0xa1')]){delete _0xbe964d[_0x6a11('0xa2')][_0x6a11('0xa1')];}if(_0xbe964d[_0x6a11('0xa2')]['List']&&_0xbe964d['account'][_0x6a11('0x9e')][_0x6a11('0xa7')][_0x6a11('0x4a')]){return _0xbe964d['account'][_0x6a11('0x9e')][_0x6a11('0xa7')][0x0];}var _0x261b8f=_[_0x6a11('0xa8')](_0x4c030a[_0x6a11('0x5c')],{'firstName':_0x4c030a['body']['from'],'ListId':_0x270855[_0x6a11('0x96')]});_0x261b8f[_0x4c030a['body'][_0x6a11('0x9b')]]=_0x4c030a[_0x6a11('0x5c')]['from'];return db['CmContact'][_0x6a11('0x5b')](_0x261b8f,{'fields':_0x3d2778,'raw':!![]});}})['then'](handleEntityNotFound(_0x104118,null))[_0x6a11('0x23')](function(_0x5c11bd){_0xbe964d['contact']=_0x5c11bd;var _0x894730=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xa9')];if(_0x4c030a[_0x6a11('0x8d')]['cf-connecting-ip']){_0x894730=_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xaa')];}else if(_0x4c030a['headers'][_0x6a11('0xab')]){_0x894730=_[_0x6a11('0xac')](_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xab')][_0x6a11('0xad')](','));}if(_0x5c11bd){var _0x34729b={'ContactId':_0x5c11bd['id'],'ChatWebsiteId':_0x4c030a[_0x6a11('0x65')]['id'],'from':(_0x5c11bd[_0x6a11('0xae')]||'')+'\x20'+(_0x5c11bd['lastName']||''),'customerIp':_0x894730,'customerPort':_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xaf')]?_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xaf')]:null,'referer':_0x4c030a['body'][_0x6a11('0xb0')],'browserName':_0x28b2e0[_0x6a11('0xb1')][_0x6a11('0x3d')]&&_0x28b2e0[_0x6a11('0xb1')][_0x6a11('0xb2')]?util[_0x6a11('0xb3')](_0x6a11('0xb4'),_0x28b2e0[_0x6a11('0xb1')][_0x6a11('0x3d')],_0x28b2e0['browser'][_0x6a11('0xb2')]):_0x6a11('0xb5'),'browserVersion':_0x28b2e0[_0x6a11('0xb1')]['version']||_0x6a11('0xb5'),'osName':util[_0x6a11('0xb3')](_0x6a11('0xb4'),_0x28b2e0['os'][_0x6a11('0x3d')],_0x28b2e0['os'][_0x6a11('0xb2')]),'osVersion':_0x28b2e0['os'][_0x6a11('0xb2')],'deviceModel':_0x28b2e0['device'][_0x6a11('0x44')]&&_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0xb7')]?util[_0x6a11('0xb3')](_0x6a11('0xb8'),_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0x44')],_0x28b2e0['device'][_0x6a11('0xb7')],_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0x43')]):null,'deviceVendor':_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0xb7')],'deviceType':_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0x43')],'formData':JSON[_0x6a11('0x29')](_0x4c030a[_0x6a11('0x5c')])};var _0x647031={'ChatWebsiteId':_0x4c030a[_0x6a11('0x65')]['id'],'closed':![]};if(_0x4c030a['body'][_0x6a11('0xb9')]){_0x647031[_0x6a11('0xb9')]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xb9')];return db[_0x6a11('0xba')][_0x6a11('0x64')]({'where':_0x647031})[_0x6a11('0x23')](function(_0x101dc9){if(_0x101dc9){return[_0x101dc9,![]];}_0x34729b[_0x6a11('0xb9')]=_0x4c030a['body']['threadId'];_0x34729b[_0x6a11('0xbb')]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xbb')];return db[_0x6a11('0xba')]['create'](_0x34729b)['then'](function(_0x596c9d){return[_0x596c9d,!![]];});});}_0x647031[_0x6a11('0xbc')]=_0x5c11bd['id'];if(_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xbd')]&&_0x4c030a['body'][_0x6a11('0xbd')]['id']){_0x647031['id']=_0x4c030a[_0x6a11('0x5c')]['interaction']['id'];return db[_0x6a11('0xba')]['find']({'where':_0x647031})['then'](function(_0x3effa6){if(_0x3effa6){return[_0x3effa6,![]];}return db[_0x6a11('0xba')][_0x6a11('0x5b')](_0x34729b)['then'](function(_0x225fb3){return[_0x225fb3,!![]];});});}return db[_0x6a11('0xba')]['create'](_0x34729b)[_0x6a11('0x23')](function(_0x466fe5){return[_0x466fe5,!![]];});}})[_0x6a11('0xbe')](function(_0x253f51,_0x26783e){if(_0x253f51){_0xa23c90=_0x26783e;if(!_0x26783e){var _0x1540b8={'from':(_0xbe964d[_0x6a11('0xbf')][_0x6a11('0xae')]||'')+'\x20'+(_0xbe964d[_0x6a11('0xbf')][_0x6a11('0xc0')]||'')};if(_0x4c030a[_0x6a11('0x5c')]['threadId']&&_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc1')]&&_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xb9')]!=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc1')]){_0x1540b8[_0x6a11('0xb9')]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc1')];}return _0x253f51[_0x6a11('0x38')](_0x1540b8);}else{return _0x253f51;}}})[_0x6a11('0x23')](function(_0xc9560b){_0xbe964d[_0x6a11('0xbd')]=_0xc9560b[_0x6a11('0x3a')]({'plain':!![]});_0xbe964d[_0x6a11('0xbd')][_0x6a11('0xc2')]=_0xa23c90;if(_0xbe964d[_0x6a11('0xbd')][_0x6a11('0xc2')]){if(_0xbe964d['account']['autoclose']){_0xbe964d[_0x6a11('0xa3')]['push']({'id':0x0,'priority':_0xbe964d[_0x6a11('0xa3')][_0x6a11('0x4a')]+0x1,'app':_0x6a11('0xc3'),'appdata':_0x6a11('0xc4'),'interval':'*,*,*,*'});}}return db[_0x6a11('0xc5')][_0x6a11('0x5b')]({'body':_0x4c030a['body'][_0x6a11('0x5c')],'ChatWebsiteId':_0x4c030a[_0x6a11('0x65')]['id'],'ChatInteractionId':_0xc9560b['id'],'direction':'in','ContactId':_0xbe964d[_0x6a11('0xbf')]['id'],'AttachmentId':_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc6')]});})[_0x6a11('0x23')](function(_0x144844){_0xbe964d[_0x6a11('0x2c')]=_0x144844;if(_0xbe964d[_0x6a11('0xbd')][_0x6a11('0xc7')]){return db[_0x6a11('0xc8')][_0x6a11('0x64')]({'attributes':['id',_0x6a11('0x3d')],'where':{'id':_0xbe964d[_0x6a11('0xbd')]['UserId']}})[_0x6a11('0x23')](function(_0x4899df){if(_0x4899df){_0xbe964d['applications'][_0x6a11('0xc9')]({'id':0x0,'priority':0x0,'app':_0x6a11('0xca'),'appdata':_0x4899df[_0x6a11('0x3d')]+','+(_0xbe964d[_0x6a11('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':_0x6a11('0xcb')});_0xbe964d[_0x6a11('0xcc')]=!![];}return respondWithRpcPromise(_0x6a11('0xcd'),_0x6a11('0xce'),_0xbe964d);});}return respondWithRpcPromise(_0x6a11('0xcd'),_0x6a11('0xce'),_0xbe964d);})[_0x6a11('0x23')](function(_0x3a8d61){respondWithRpcPromise(_0x6a11('0xcf'),_0x6a11('0xcf'),{'event':_0x6a11('0xd0'),'message':_0x3a8d61},client9002);return _0x3a8d61;})['then'](respondWithResult(_0x104118,null))[_0x6a11('0x2e')](handleError(_0x104118,null));};exports[_0x6a11('0xd1')]=function(_0x4b01c2,_0x20921e,_0x32f77a){var _0x18608d,_0x5e7f95,_0x1225ea;var _0x4f94c9=[];var _0xfd0c34=[];var _0x307785={};return db[_0x6a11('0x90')][_0x6a11('0x66')]()[_0x6a11('0x23')](function(_0x4e2e52){if(!_0x4e2e52){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))]('no\x20available\x20attributes');}_0xfd0c34=_[_0x6a11('0x92')](_[_0x6a11('0x46')](_0x4e2e52),['createdAt','updatedAt']);_0x4f94c9=_['difference'](_['keys'](_0x4e2e52),['createdAt','updatedAt','CompanyId',_0x6a11('0x96')]);if(_0x4b01c2['body']['id']){delete _0x4b01c2['body']['id'];}if(_[_0x6a11('0x7f')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x97')])){throw _0x20921e[_0x6a11('0x30')](0x1f4)[_0x6a11('0x3e')](new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0xd2')));}if(_[_0x6a11('0x7f')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x5c')])||_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x5c')]===''){throw _0x20921e[_0x6a11('0x30')](0x1f4)[_0x6a11('0x3e')](new db['Sequelize']['ValidationError'](_0x6a11('0x98')));}if(_[_0x6a11('0x7f')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0xd3')])){throw _0x20921e[_0x6a11('0x30')](0x1f4)[_0x6a11('0x3e')](new db['Sequelize'][(_0x6a11('0x20'))](_0x6a11('0xd4')+_0x4f94c9));}if(!_[_0x6a11('0x9a')](_0x4f94c9,_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0xd3')])){throw _0x20921e[_0x6a11('0x30')](0x1f4)['send'](new db[(_0x6a11('0x1f'))]['ValidationError'](_0x6a11('0xd5')+_0x4f94c9));}_0x307785[_0x4b01c2['body']['mapKeyOffline']]=_0x4b01c2[_0x6a11('0x5c')]['from'];})['then'](function(){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x4b01c2['params']['id']},'include':[{'model':db[_0x6a11('0x9d')],'as':_0x6a11('0x9e')}]});})['then'](handleEntityNotFound(_0x20921e,null))['then'](function(_0x4a8698){if(_0x4a8698&&_0x4a8698[_0x6a11('0x9e')]){_0x5e7f95=_0x4a8698;var _0x3be7fc=_['defaults'](_0x4b01c2[_0x6a11('0x5c')],{'firstName':_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x97')],'phone':_0x4b01c2[_0x6a11('0x5c')]['from'],'ListId':_0x4a8698[_0x6a11('0x96')]});_0x3be7fc[_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0xd3')]]=_0x4b01c2['body'][_0x6a11('0x97')];return db[_0x6a11('0x90')][_0x6a11('0xd6')]({'where':_0x307785,'defaults':_0x3be7fc});}})[_0x6a11('0xbe')](function(_0x32e022){if(_0x32e022){_0x1225ea=_0x32e022;var _0x5be1c0=fs[_0x6a11('0xd7')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/templates/chatOfflineMessage.ejs'),_0x6a11('0xd8'));var _0x51ea6a=ejs['render'](_0x5be1c0,{'body':_[_0x6a11('0xd9')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x5c')]),'bodyTitle':_0x5e7f95[_0x6a11('0xda')]});return db['ChatOfflineMessage'][_0x6a11('0x5b')]({'body':_0x51ea6a,'ContactId':_0x32e022['id'],'ChatWebsiteId':_0x5e7f95['id']});}})[_0x6a11('0x23')](function(_0x5010fa){if(_0x5010fa){_0x18608d=_0x5010fa;return db[_0x6a11('0xdb')][_0x6a11('0x6b')]({'where':{'service':!![]},'include':[{'model':db[_0x6a11('0xdc')],'as':_0x6a11('0xdd'),'raw':!![]}]});}})['then'](function(_0x5ed113){if(_0x5ed113&&_0x5ed113['Smtp']&&_0x5e7f95['forwardOfflineAddress']){var _0x5b6fa8={'tls':{'rejectUnauthorized':![]}};if(_0x5ed113[_0x6a11('0xdd')]['service']){_0x5b6fa8['service']=_0x5ed113[_0x6a11('0xdd')][_0x6a11('0xde')];}else{_0x5b6fa8[_0x6a11('0xdf')]=_0x5ed113['Smtp'][_0x6a11('0xdf')];_0x5b6fa8['port']=_0x5ed113['Smtp'][_0x6a11('0xe0')];_0x5b6fa8[_0x6a11('0xe1')]=_0x5ed113['Smtp'][_0x6a11('0xe1')];}if(_0x5ed113[_0x6a11('0xdd')][_0x6a11('0xe2')]){_0x5b6fa8[_0x6a11('0xe3')]={'user':_0x5ed113[_0x6a11('0xdd')][_0x6a11('0x5d')],'pass':_0x5ed113[_0x6a11('0xdd')][_0x6a11('0xe4')]};}return respondWithRpcPromise(_0x6a11('0xe5'),_0x6a11('0xe6'),{'account':_0x5b6fa8,'message':{'from':util[_0x6a11('0xb3')](_0x6a11('0xe7'),_0x5ed113[_0x6a11('0x3d')],_0x5ed113[_0x6a11('0xe8')]||_0x5ed113[_0x6a11('0xdd')][_0x6a11('0x5d')]),'to':_0x5e7f95[_0x6a11('0xe9')],'subject':_0x5e7f95[_0x6a11('0xea')],'text':_0x18608d[_0x6a11('0x5c')]}},client9003)['then'](function(){return _0x18608d;})['catch'](function(_0x222c9a){console[_0x6a11('0x2a')](_0x222c9a);});}})[_0x6a11('0x23')](function(){if(_0x18608d){return _0x18608d;}})['then'](respondWithResult(_0x20921e,null))[_0x6a11('0x2e')](handleError(_0x20921e,null));};exports[_0x6a11('0xeb')]=function(_0x47be27,_0x100070,_0x20d4d7){return db[_0x6a11('0xba')]['find']({'where':{'id':_0x47be27[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x100070,null))[_0x6a11('0x23')](function(_0x3a1d90){if(_0x3a1d90){return _0x3a1d90['addInteraction'](_0x47be27[_0x6a11('0x5c')][_0x6a11('0x6f')],_[_0x6a11('0xec')](_0x47be27['body'],[_0x6a11('0x6f'),'id'])||{});}})[_0x6a11('0x23')](respondWithResult(_0x100070,null))[_0x6a11('0x2e')](handleError(_0x100070,null));};exports[_0x6a11('0xed')]=function(_0x1a8385,_0x273303,_0x576c56){var _0x5d21fd={'raw':![],'where':{}};var _0x5d0942={};var _0x59b96b={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x1a8385[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x273303,null))[_0x6a11('0x23')](function(_0x35f7b9){if(_0x35f7b9){_0x5d0942[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0xba')][_0x6a11('0x59')]);_0x5d0942[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x1a8385['query']);_0x5d0942[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x5d0942[_0x6a11('0x44')],_0x5d0942['query']);_0x5d21fd['attributes']=_[_0x6a11('0x47')](_0x5d0942[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x1a8385[_0x6a11('0x45')]['fields']));_0x5d21fd['attributes']=_0x5d21fd[_0x6a11('0x49')]['length']?_0x5d21fd[_0x6a11('0x49')]:_0x5d0942['model'];if(!_0x1a8385[_0x6a11('0x45')][_0x6a11('0xee')](_0x6a11('0x4b'))){_0x5d21fd[_0x6a11('0x4c')]=qs['limit'](_0x1a8385['query'][_0x6a11('0x4c')]);_0x5d21fd[_0x6a11('0x33')]=qs['offset'](_0x1a8385[_0x6a11('0x45')][_0x6a11('0x33')]);}_0x5d21fd['order']=qs[_0x6a11('0x4d')](_0x1a8385[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x5d21fd[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x1a8385[_0x6a11('0x45')],_0x5d0942[_0x6a11('0x50')]));_0x5d21fd[_0x6a11('0x4e')][_0x6a11('0x68')]=_0x35f7b9['id'];if(_0x1a8385[_0x6a11('0x45')]['filter']){_0x5d21fd[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x5d21fd['where'],{'$or':_[_0x6a11('0x40')](_0x5d21fd[_0x6a11('0x49')],function(_0x31e99){var _0x5f4e00={};_0x5f4e00[_0x31e99]={'$like':'%'+_0x1a8385[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0x5f4e00;})});}_0x5d21fd=_[_0x6a11('0x52')]({},_0x5d21fd,_0x1a8385[_0x6a11('0x5a')]);return db['ChatInteraction']['count']({'where':_0x5d21fd[_0x6a11('0x4e')]})[_0x6a11('0x23')](function(_0x12f4ca){_0x59b96b[_0x6a11('0x32')]=_0x12f4ca;if(_0x1a8385[_0x6a11('0x45')]['includeAll']){_0x5d21fd[_0x6a11('0x6d')]=[{'model':db[_0x6a11('0x90')],'as':_0x6a11('0xef'),'required':![]},{'model':db[_0x6a11('0xc8')],'as':_0x6a11('0xf0'),'attributes':[_0x6a11('0x3d'),_0x6a11('0xf1'),_0x6a11('0xf2')],'required':![]},{'model':db[_0x6a11('0xf3')],'as':_0x6a11('0xf4'),'attributes':['id',_0x6a11('0x3d'),_0x6a11('0xf5')],'where':_0x1a8385[_0x6a11('0x45')][_0x6a11('0xf6')]?{'id':_0x1a8385[_0x6a11('0x45')][_0x6a11('0xf6')]}:undefined,'required':_0x1a8385[_0x6a11('0x45')]['tag']?!![]:![]}];}return db[_0x6a11('0xba')][_0x6a11('0x54')](_0x5d21fd);})[_0x6a11('0x23')](function(_0x32384e){_0x59b96b[_0x6a11('0x55')]=_0x32384e;return _0x59b96b;});}})[_0x6a11('0x23')](respondWithFilteredResult(_0x273303,_0x5d21fd))[_0x6a11('0x2e')](handleError(_0x273303,null));};function iftimePromise(_0x3cbe02,_0x468e49){return respondWithRpcPromise(_0x6a11('0xf7'),_0x6a11('0xf8'),{'command':_0x468e49[_0x6a11('0xf9')]?util[_0x6a11('0xb3')](_0x6a11('0xfa'),_0x3cbe02[_0x6a11('0xfb')],_0x468e49[_0x6a11('0xf9')]):util['format']('iftime\x20%s',_0x3cbe02[_0x6a11('0xfb')])},client9002)[_0x6a11('0x23')](function(_0x29e40a){var _0x5ca58c=_0x29e40a&&_0x29e40a['indexOf'](_0x6a11('0xfc'))>=0x0?!![]:![];logger[_0x6a11('0x24')](_0x6a11('0xfd'),_0x468e49['id'],_0x3cbe02['id'],_0x3cbe02[_0x6a11('0xfb')],_0x5ca58c?_0x6a11('0xfe'):_0x6a11('0xff'),_0x468e49[_0x6a11('0xf9')]?_0x468e49[_0x6a11('0xf9')]:_0x6a11('0x100'));return _0x5ca58c;})[_0x6a11('0x2e')](function(_0x5549cc){logger[_0x6a11('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x468e49['id'],_0x3cbe02['id'],_0x3cbe02[_0x6a11('0xfb')],util[_0x6a11('0x101')](_0x5549cc,{'showHidden':![],'depth':null}),_0x468e49[_0x6a11('0xf9')]?_0x468e49['timezone']:_0x6a11('0x100'));return![];});}exports[_0x6a11('0xf8')]=function(_0x6fa38a,_0x5f08f9,_0x4c8535){var _0xb4e136=0x0;var _0x365ae9=0x0;var _0x4f70c0=![];var _0x287626;var _0x33cb81;return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x6fa38a['params']['id']},'include':[{'model':db[_0x6a11('0x102')],'as':_0x6a11('0x102'),'include':[{'model':db[_0x6a11('0x102')],'as':_0x6a11('0x103'),'attributes':['id',_0x6a11('0xfb')],'raw':!![]}]}]})[_0x6a11('0x23')](handleEntityNotFound(_0x5f08f9,null))[_0x6a11('0x23')](function(_0x435084){if(_0x435084){_0x287626=_0x435084;return _0x435084[_0x6a11('0x104')]({'raw':!![]});}})[_0x6a11('0x23')](function(_0x4a2b9f){if(_0x287626){if(_0x4a2b9f){_0x33cb81=_0x4a2b9f;}}return require('../../config/license/util')[_0x6a11('0x105')]();})[_0x6a11('0x23')](function(_0x52cdc6){if(_0x52cdc6){_0x365ae9=_0x52cdc6[_0x6a11('0x106')];_0x4f70c0=_0x52cdc6[_0x6a11('0x7e')];}})[_0x6a11('0x23')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x6a11('0x23')](function(_0x225820){_0xb4e136=_0x225820;if(_0x365ae9&&_0x225820>_0x365ae9){return db[_0x6a11('0x107')][_0x6a11('0x6b')]({'where':{'id':0x1}})[_0x6a11('0x23')](function(_0x1b3a43){if(_0x1b3a43){_0x1b3a43['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x287626[_0x6a11('0x102')]&&_0x287626[_0x6a11('0x102')][_0x6a11('0x103')]){var _0x512c1b=[];for(var _0x223a77=0x0;_0x223a77<_0x287626[_0x6a11('0x102')]['Intervals'][_0x6a11('0x4a')];_0x223a77++){var _0x55f711=_0x287626[_0x6a11('0x102')][_0x6a11('0x103')][_0x223a77][_0x6a11('0x3a')]({'plain':!![]});_0x512c1b[_0x6a11('0x108')](iftimePromise(_0x55f711,_0x287626));}return BPromise[_0x6a11('0x109')](_0x512c1b)[_0x6a11('0x23')](function(_0x14a996){return _[_0x6a11('0x10a')](_0x14a996);});}else{return!![];}})['then'](function(_0x5f07da){var _0x1c0130=fs[_0x6a11('0xd7')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x10b')),'utf8');var _0x211c53={'remote':_0x287626[_0x6a11('0x10c')],'query':querystring['stringify'](_[_0x6a11('0x52')](_0x287626[_0x6a11('0x3a')]({'plain':!![]}),{'customerIp':_0x6fa38a[_0x6a11('0x8d')][_0x6a11('0xab')]||_0x6fa38a[_0x6a11('0x8d')]['x-real-ip']||_0x6fa38a[_0x6a11('0x10d')]['remoteAddress']||_0x6fa38a['ip'],'referer':_0x6fa38a['headers'][_0x6a11('0xb0')],'openedInteractions':_0xb4e136,'maxInteractions':_0x365ae9,'virtual':_0x4f70c0[_0x6a11('0x106')],'online':_0x5f07da,'custom':_0x4f70c0}))[_0x6a11('0x10e')](/'/g,'\x5c\x27')};_0x5f08f9[_0x6a11('0x3e')](ejs[_0x6a11('0x10f')](Mustache['render'](_0x1c0130,_0x211c53),{'proactiveActions':_0x33cb81,'alignment':_0x287626[_0x6a11('0x110')],'verticalAlignment':_0x287626['verticalAlignment'],'div_color':_0x287626['color'],'text_color':_0x287626['textColor']}));})['catch'](handleError(_0x5f08f9,null));};exports[_0x6a11('0x111')]=function(_0x472454,_0x25d8ef,_0xdae604){return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x472454[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x25d8ef,null))[_0x6a11('0x23')](function(_0x3dc4da){if(_0x3dc4da){return db[_0x6a11('0x112')][_0x6a11('0x113')](function(_0x497f8b){return db[_0x6a11('0xa0')][_0x6a11('0x39')]({'where':{'ChatWebsiteId':_0x472454[_0x6a11('0x65')]['id']},'transaction':_0x497f8b})[_0x6a11('0x23')](function(_0x26be69){var _0x19edc7=_[_0x6a11('0x40')](_0x472454['body'],function(_0x360a04){_0x360a04[_0x6a11('0x68')]=_0x472454[_0x6a11('0x65')]['id'];return _0x360a04;});return db[_0x6a11('0xa0')]['bulkCreate'](_0x19edc7,{'transaction':_0x497f8b});});})['then'](function(){return db[_0x6a11('0xa0')][_0x6a11('0x114')]({'where':{'ChatWebsiteId':_0x472454['params']['id']},'order':'priority'});});}})[_0x6a11('0x23')](respondWithResult(_0x25d8ef,null))['catch'](handleError(_0x25d8ef,null));};exports[_0x6a11('0x115')]=function(_0x142cde,_0x447fe3,_0x58d99a){var _0x392753={};var _0x148b36={};var _0x12675e;var _0x3e3641;return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x142cde['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x447fe3,null))[_0x6a11('0x23')](function(_0x28c21b){if(_0x28c21b){_0x12675e=_0x28c21b;_0x148b36[_0x6a11('0x44')]=_[_0x6a11('0x46')](db['ChatApplication'][_0x6a11('0x59')]);_0x148b36[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x142cde[_0x6a11('0x45')]);_0x148b36[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x148b36[_0x6a11('0x44')],_0x148b36[_0x6a11('0x45')]);_0x392753[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x148b36[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x142cde['query']['fields']));_0x392753[_0x6a11('0x49')]=_0x392753[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x392753[_0x6a11('0x49')]:_0x148b36[_0x6a11('0x44')];_0x392753[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x142cde['query'][_0x6a11('0x4d')]);_0x392753[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x142cde[_0x6a11('0x45')],_0x148b36['filters']));if(_0x142cde[_0x6a11('0x45')][_0x6a11('0x51')]){_0x392753[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x392753['where'],{'$or':_[_0x6a11('0x40')](_0x392753[_0x6a11('0x49')],function(_0x2813e2){var _0x56cfd5={};_0x56cfd5[_0x2813e2]={'$like':'%'+_0x142cde[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0x56cfd5;})});}_0x392753=_['merge']({},_0x392753,_0x142cde[_0x6a11('0x5a')]);return _0x12675e[_0x6a11('0x115')](_0x392753);}})[_0x6a11('0x23')](function(_0x506e31){if(_0x506e31){_0x3e3641=_0x506e31[_0x6a11('0x4a')];if(!_0x142cde[_0x6a11('0x45')][_0x6a11('0xee')](_0x6a11('0x4b'))){_0x392753['limit']=qs['limit'](_0x142cde['query'][_0x6a11('0x4c')]);_0x392753['offset']=qs[_0x6a11('0x33')](_0x142cde['query']['offset']);}return _0x12675e[_0x6a11('0x115')](_0x392753);}})['then'](function(_0x405cca){if(_0x405cca){return _0x405cca?{'count':_0x3e3641,'rows':_0x405cca}:null;}})[_0x6a11('0x23')](respondWithResult(_0x447fe3,null))[_0x6a11('0x2e')](handleError(_0x447fe3,null));};exports[_0x6a11('0x116')]=function(_0x4078d2,_0x5878c0,_0x160355){return db[_0x6a11('0x117')][_0x6a11('0x64')]({'where':{'id':_0x4078d2[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x5878c0,null))[_0x6a11('0x23')](function(_0x3d6492){if(_0x3d6492){return _0x3d6492[_0x6a11('0x116')](_0x4078d2[_0x6a11('0x5c')][_0x6a11('0x6f')],_[_0x6a11('0xec')](_0x4078d2[_0x6a11('0x5c')],[_0x6a11('0x6f'),'id'])||{});}})[_0x6a11('0x23')](respondWithResult(_0x5878c0,null))[_0x6a11('0x2e')](handleError(_0x5878c0,null));};exports[_0x6a11('0x104')]=function(_0x10e4cc,_0x1700c6,_0x1e6ee0){var _0x4d78e9={};var _0x4868ca={};var _0x1ffb2f;var _0x2a017e;return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x10e4cc[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x1700c6,null))['then'](function(_0x4b2b54){if(_0x4b2b54){_0x1ffb2f=_0x4b2b54;_0x4868ca[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0x118')][_0x6a11('0x59')]);_0x4868ca[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x10e4cc[_0x6a11('0x45')]);_0x4868ca['filters']=_[_0x6a11('0x47')](_0x4868ca['model'],_0x4868ca[_0x6a11('0x45')]);_0x4d78e9['attributes']=_['intersection'](_0x4868ca['model'],qs[_0x6a11('0x48')](_0x10e4cc[_0x6a11('0x45')]['fields']));_0x4d78e9['attributes']=_0x4d78e9[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x4d78e9[_0x6a11('0x49')]:_0x4868ca[_0x6a11('0x44')];_0x4d78e9[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x4d78e9['where']=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x10e4cc[_0x6a11('0x45')],_0x4868ca['filters']));if(_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x51')]){_0x4d78e9['where']=_[_0x6a11('0x52')](_0x4d78e9[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x4d78e9['attributes'],function(_0x4a789b){var _0x20a87d={};_0x20a87d[_0x4a789b]={'$like':'%'+_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0x20a87d;})});}_0x4d78e9=_[_0x6a11('0x52')]({},_0x4d78e9,_0x10e4cc[_0x6a11('0x5a')]);return _0x1ffb2f[_0x6a11('0x104')](_0x4d78e9);}})[_0x6a11('0x23')](function(_0x4d3b48){if(_0x4d3b48){_0x2a017e=_0x4d3b48['length'];if(!_0x10e4cc[_0x6a11('0x45')]['hasOwnProperty'](_0x6a11('0x4b'))){_0x4d78e9[_0x6a11('0x4c')]=qs['limit'](_0x10e4cc[_0x6a11('0x45')]['limit']);_0x4d78e9[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x33')]);}return _0x1ffb2f[_0x6a11('0x104')](_0x4d78e9);}})[_0x6a11('0x23')](function(_0x1c6fc3){if(_0x1c6fc3){return _0x1c6fc3?{'count':_0x2a017e,'rows':_0x1c6fc3}:null;}})[_0x6a11('0x23')](respondWithResult(_0x1700c6,null))[_0x6a11('0x2e')](handleError(_0x1700c6,null));};exports[_0x6a11('0x119')]=function(_0x2ff0cc,_0x423f40,_0x535193){var _0x1a1148=_0x2ff0cc[_0x6a11('0x45')][_0x6a11('0x11a')]===_0x6a11('0x11b')?_0x6a11('0x11c'):_0x6a11('0x11d');return db[_0x6a11('0x41')][_0x6a11('0x64')]({'attributes':['id',_0x1a1148],'where':{'id':_0x2ff0cc['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x423f40,null))[_0x6a11('0x23')](function(_0x4587d5){if(_0x4587d5){var _0x37b0bd=_0x4587d5[_0x1a1148];var _0x5b7364=_0x37b0bd&&_0x37b0bd['items']?_0x37b0bd[_0x6a11('0x11e')]:[];_0x423f40[_0x6a11('0x3e')]({'fromKey':_['isNil'](_0x37b0bd['fromKey'])?undefined:_0x37b0bd[_0x6a11('0x11f')],'count':_0x5b7364['length'],'rows':_0x5b7364});}})[_0x6a11('0x2e')](handleError(_0x423f40,null));};exports[_0x6a11('0x120')]=function(_0x56590a,_0x448381,_0x1d9f1e){var _0x3352b0={'raw':![],'where':{}};var _0x151141={};var _0x21550e={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x56590a[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x448381,null))['then'](function(_0x24a0d5){if(_0x24a0d5){_0x151141[_0x6a11('0x44')]=_[_0x6a11('0x46')](db['ChatOfflineMessage']['rawAttributes']);_0x151141[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x56590a[_0x6a11('0x45')]);_0x151141['filters']=_[_0x6a11('0x47')](_0x151141['model'],_0x151141[_0x6a11('0x45')]);_0x3352b0[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x151141[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x56590a[_0x6a11('0x45')]['fields']));_0x3352b0[_0x6a11('0x49')]=_0x3352b0[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x3352b0['attributes']:_0x151141[_0x6a11('0x44')];if(!_0x56590a[_0x6a11('0x45')]['hasOwnProperty'](_0x6a11('0x4b'))){_0x3352b0[_0x6a11('0x4c')]=qs[_0x6a11('0x4c')](_0x56590a['query'][_0x6a11('0x4c')]);_0x3352b0[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x56590a['query']['offset']);}_0x3352b0[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x56590a[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x3352b0[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_['pick'](_0x56590a['query'],_0x151141[_0x6a11('0x50')]));_0x3352b0[_0x6a11('0x4e')][_0x6a11('0x68')]=_0x24a0d5['id'];if(_0x56590a['query']['filter']){_0x3352b0[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x3352b0[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x3352b0[_0x6a11('0x49')],function(_0x4b7e99){var _0x5cf989={};_0x5cf989[_0x4b7e99]={'$like':'%'+_0x56590a['query']['filter']+'%'};return _0x5cf989;})});}_0x3352b0=_['merge']({},_0x3352b0,_0x56590a[_0x6a11('0x5a')]);return db[_0x6a11('0x121')]['count']({'where':_0x3352b0[_0x6a11('0x4e')]})[_0x6a11('0x23')](function(_0x35269c){_0x21550e['count']=_0x35269c;if(_0x56590a[_0x6a11('0x45')][_0x6a11('0x53')]){_0x3352b0[_0x6a11('0x6d')]=[{'all':!![]}];}else{_0x3352b0[_0x6a11('0x6d')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db['ChatOfflineMessage'][_0x6a11('0x54')](_0x3352b0);})[_0x6a11('0x23')](function(_0x38770e){_0x21550e[_0x6a11('0x55')]=_0x38770e;return _0x21550e;});}})[_0x6a11('0x23')](respondWithFilteredResult(_0x448381,_0x3352b0))[_0x6a11('0x2e')](handleError(_0x448381,null));};exports[_0x6a11('0x122')]=function(_0x3b85c8,_0x4885fb,_0xa2b10){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x3b85c8[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x4885fb,null))[_0x6a11('0x23')](function(_0x24438f){if(_0x24438f){return _0x24438f[_0x6a11('0x122')](_0x3b85c8[_0x6a11('0x5c')][_0x6a11('0x6f')],_[_0x6a11('0xec')](_0x3b85c8[_0x6a11('0x5c')],['ids','id'])||{})[_0x6a11('0xbe')](function(_0x213361){for(var _0x3dd89a=0x0;_0x3dd89a<_0x3b85c8[_0x6a11('0x5c')][_0x6a11('0x6f')]['length'];_0x3dd89a+=0x1){socket[_0x6a11('0x123')](_0x6a11('0x124'),{'UserId':_0x3b85c8[_0x6a11('0x5c')]['ids'][_0x3dd89a],'ChatWebsiteId':_0x3b85c8[_0x6a11('0x65')]['id']});}return _0x213361;});}})[_0x6a11('0x23')](respondWithResult(_0x4885fb,null))[_0x6a11('0x2e')](handleError(_0x4885fb,null));};exports[_0x6a11('0x125')]=function(_0xc83350,_0x5ea9f7,_0x1dd9d2){return db[_0x6a11('0x41')]['find']({'where':{'id':_0xc83350[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x5ea9f7,null))[_0x6a11('0x23')](function(_0x25ea5a){if(_0x25ea5a){return _0x25ea5a['removeAgents'](_0xc83350[_0x6a11('0x45')][_0x6a11('0x6f')])[_0x6a11('0x23')](function(){if(_[_0x6a11('0x126')](_0xc83350[_0x6a11('0x45')][_0x6a11('0x6f')])){for(var _0x381515=0x0;_0x381515<_0xc83350[_0x6a11('0x45')]['ids'][_0x6a11('0x4a')];_0x381515+=0x1){socket[_0x6a11('0x123')]('userChatWebsite:remove',{'UserId':Number(_0xc83350[_0x6a11('0x45')][_0x6a11('0x6f')][_0x381515]),'ChatWebsiteId':Number(_0xc83350[_0x6a11('0x65')]['id'])});}}else{socket['emit'](_0x6a11('0x127'),{'UserId':Number(_0xc83350[_0x6a11('0x45')]['ids']),'ChatWebsiteId':Number(_0xc83350[_0x6a11('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ea9f7,null))['catch'](handleError(_0x5ea9f7,null));};exports[_0x6a11('0x128')]=function(_0x36475f,_0x3d90c8,_0x15375a){var _0x49a98={};var _0x5bc55f={};var _0xd498f0;var _0x53346c;return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x36475f[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x3d90c8,null))['then'](function(_0x3614f1){if(_0x3614f1){_0xd498f0=_0x3614f1;_0x5bc55f[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0xc8')][_0x6a11('0x59')]);_0x5bc55f[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x36475f[_0x6a11('0x45')]);_0x5bc55f[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x5bc55f[_0x6a11('0x44')],_0x5bc55f[_0x6a11('0x45')]);_0x49a98[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x5bc55f[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x36475f[_0x6a11('0x45')][_0x6a11('0x48')]));_0x49a98['attributes']=_0x49a98[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x49a98['attributes']:_0x5bc55f[_0x6a11('0x44')];_0x49a98[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x36475f[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x49a98[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_['pick'](_0x36475f[_0x6a11('0x45')],_0x5bc55f[_0x6a11('0x50')]));if(_0x36475f[_0x6a11('0x45')]['filter']){_0x49a98[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x49a98[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x49a98[_0x6a11('0x49')],function(_0x30efba){var _0xc2b095={};_0xc2b095[_0x30efba]={'$like':'%'+_0x36475f[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0xc2b095;})});}_0x49a98=_[_0x6a11('0x52')]({},_0x49a98,_0x36475f[_0x6a11('0x5a')]);return _0xd498f0[_0x6a11('0x128')](_0x49a98);}})['then'](function(_0x365e73){if(_0x365e73){_0x53346c=_0x365e73[_0x6a11('0x4a')];if(!_0x36475f[_0x6a11('0x45')][_0x6a11('0xee')](_0x6a11('0x4b'))){_0x49a98[_0x6a11('0x4c')]=qs['limit'](_0x36475f[_0x6a11('0x45')]['limit']);_0x49a98[_0x6a11('0x33')]=qs['offset'](_0x36475f[_0x6a11('0x45')]['offset']);}return _0xd498f0['getAgents'](_0x49a98);}})[_0x6a11('0x23')](function(_0x2d2398){if(_0x2d2398){return _0x2d2398?{'count':_0x53346c,'rows':_0x2d2398}:null;}})['then'](respondWithResult(_0x3d90c8,null))[_0x6a11('0x2e')](handleError(_0x3d90c8,null));}; \ No newline at end of file +var _0x6ca9=['UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','ChatWebsiteId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','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','List','Contacts','DESC','ChatApplication','applications','Applications','list','orderBy','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','ContactId','interaction','spread','firstName','messageId','update','created','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Owner','fullname','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','utf8','remote','x-real-ip','render','alignment','verticalAlignment','color','textColor','addApplications','sequelize','transaction','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Contact','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','ValidationError','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatWebsite','include','findAll','show','params','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x4e434c,_0x1c4105){var _0x52bab1=function(_0x4f72c5){while(--_0x4f72c5){_0x4e434c['push'](_0x4e434c['shift']());}};_0x52bab1(++_0x1c4105);}(_0x6ca9,0xc4));var _0x96ca=function(_0x5c4164,_0xcd47fc){_0x5c4164=_0x5c4164-0x0;var _0x51f164=_0x6ca9[_0x5c4164];return _0x51f164;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x96ca('0x0'));var zipdir=require(_0x96ca('0x1'));var jsonpatch=require(_0x96ca('0x2'));var rp=require(_0x96ca('0x3'));var moment=require(_0x96ca('0x4'));var BPromise=require(_0x96ca('0x5'));var Mustache=require(_0x96ca('0x6'));var util=require(_0x96ca('0x7'));var path=require(_0x96ca('0x8'));var sox=require(_0x96ca('0x9'));var csv=require(_0x96ca('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x96ca('0xb'));var squel=require(_0x96ca('0xc'));var crypto=require(_0x96ca('0xd'));var jsforce=require(_0x96ca('0xe'));var deskjs=require(_0x96ca('0xf'));var toCsv=require(_0x96ca('0xa'));var querystring=require(_0x96ca('0x10'));var Papa=require(_0x96ca('0x11'));var Redis=require(_0x96ca('0x12'));var authService=require(_0x96ca('0x13'));var qs=require(_0x96ca('0x14'));var as=require(_0x96ca('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96ca('0x16'))(_0x96ca('0x17'));var utils=require('../../config/utils');var config=require(_0x96ca('0x18'));var db=require(_0x96ca('0x19'))['db'];config[_0x96ca('0x1a')]=_[_0x96ca('0x1b')](config[_0x96ca('0x1a')],{'host':_0x96ca('0x1c'),'port':0x18eb});var socket=require(_0x96ca('0x1d'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x96ca('0x1e')](socket);var jayson=require(_0x96ca('0x1f'));var client=jayson[_0x96ca('0x20')][_0x96ca('0x21')]({'port':0x232c});var client9002=jayson[_0x96ca('0x20')]['http']({'port':0x232a});var client9003=jayson[_0x96ca('0x20')][_0x96ca('0x21')]({'port':0x232b});function checkPasswordPattern(_0x151449,_0x6b864f,_0x2b87ac){if(_0x2b87ac){var _0x139b10=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x139b10['test'](_0x6b864f)){return _0x151449;}else{throw new db['Sequelize'][(_0x96ca('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 _0x151449;}}function respondWithRpcPromise(_0xa21696,_0x422c30,_0x59c015,_0x591ebb){return new BPromise(function(_0x4a391e,_0x126582){var _0x2fe077=_0x591ebb||client;return _0x2fe077['request'](_0xa21696,_0x59c015)[_0x96ca('0x23')](function(_0x56eeb4){logger[_0x96ca('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x422c30,_0x96ca('0x25'));logger[_0x96ca('0x26')](_0x96ca('0x27'),_0x422c30,_0x96ca('0x25'),JSON[_0x96ca('0x28')](_0x56eeb4));if(_0x56eeb4[_0x96ca('0x29')]){if(_0x56eeb4[_0x96ca('0x29')][_0x96ca('0x2a')]===0x1f4){logger[_0x96ca('0x29')](_0x96ca('0x2b'),_0x422c30,_0x56eeb4['error'][_0x96ca('0x2c')]);return _0x126582(_0x56eeb4['error'][_0x96ca('0x2c')]);}logger[_0x96ca('0x29')](_0x96ca('0x2b'),_0x422c30,_0x56eeb4[_0x96ca('0x29')][_0x96ca('0x2c')]);return _0x4a391e(_0x56eeb4['error'][_0x96ca('0x2c')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x422c30,_0x96ca('0x25'));_0x4a391e(_0x56eeb4['result'][_0x96ca('0x2c')]);}})[_0x96ca('0x2d')](function(_0x16f81d){logger[_0x96ca('0x29')](_0x96ca('0x2b'),_0x422c30,_0x16f81d);_0x126582(_0x16f81d);});});}function respondWithStatusCode(_0x1d8790,_0xbc09b0){_0xbc09b0=_0xbc09b0||0xcc;return function(_0x2d4e11){if(_0x2d4e11){return _0x1d8790[_0x96ca('0x2e')](_0xbc09b0);}return _0x1d8790[_0x96ca('0x2f')](_0xbc09b0)[_0x96ca('0x30')]();};}function respondWithResult(_0x3c1799,_0x3771ae){_0x3771ae=_0x3771ae||0xc8;return function(_0x2184b1){if(_0x2184b1){return _0x3c1799[_0x96ca('0x2f')](_0x3771ae)[_0x96ca('0x31')](_0x2184b1);}};}function respondWithFilteredResult(_0x225e60,_0x258387){return function(_0x248a33){if(_0x248a33){var _0x17972e=_0x248a33[_0x96ca('0x32')],_0x5ceabe=_0x258387[_0x96ca('0x33')],_0x286a3a=_0x258387[_0x96ca('0x33')]+_0x258387[_0x96ca('0x34')],_0x3f9752;if(_0x286a3a>=_0x17972e){_0x286a3a=_0x17972e;_0x3f9752=0xc8;}else{_0x3f9752=0xce;}_0x225e60[_0x96ca('0x2f')](_0x3f9752);return _0x225e60['set'](_0x96ca('0x35'),_0x5ceabe+'-'+_0x286a3a+'/'+_0x17972e)[_0x96ca('0x31')](_0x248a33);}return null;};}function patchUpdates(_0x35a173){return function(_0x2f8154){try{jsonpatch[_0x96ca('0x36')](_0x2f8154,_0x35a173,!![]);}catch(_0x500d67){return BPromise['reject'](_0x500d67);}return _0x2f8154[_0x96ca('0x37')]();};}function saveUpdates(_0x4a02ef,_0x53f160){return function(_0x2d2216){if(_0x2d2216){return _0x2d2216['update'](_0x4a02ef)[_0x96ca('0x23')](function(_0x44422d){return _0x44422d;});}return null;};}function removeEntity(_0x2685c3,_0x380883){return function(_0x1a09c2){if(_0x1a09c2){return _0x1a09c2['destroy']()[_0x96ca('0x23')](function(){var _0x5d594e=_0x1a09c2[_0x96ca('0x38')]({'plain':!![]});var _0x1a0e81=_0x96ca('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a0e81,'resourceId':_0x5d594e['id']}})['then'](function(){return _0x1a09c2;});})['then'](function(){_0x2685c3[_0x96ca('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d40e8,_0x5e7d3c){return function(_0x38efb0){if(!_0x38efb0){_0x5d40e8[_0x96ca('0x2e')](0x194);}return _0x38efb0;};}function handleError(_0x279ec4,_0x30644f){_0x30644f=_0x30644f||0x1f4;return function(_0x32be60){logger['error'](_0x32be60[_0x96ca('0x3a')]);if(_0x32be60[_0x96ca('0x3b')]){delete _0x32be60['name'];}_0x279ec4['status'](_0x30644f)[_0x96ca('0x3c')](_0x32be60);};}exports[_0x96ca('0x3d')]=function(_0x23d523,_0x141fec){var _0x561c82={'include':[{'model':db[_0x96ca('0x3e')],'as':_0x96ca('0x3f')}]},_0x11a181={},_0x4b9ec8={'count':0x0,'rows':[]};var _0x2fcd46=_[_0x96ca('0x40')](db['ChatWebsite'][_0x96ca('0x41')],function(_0x3e1f2d){return{'name':_0x3e1f2d[_0x96ca('0x42')],'type':_0x3e1f2d[_0x96ca('0x43')][_0x96ca('0x44')]};});_0x11a181[_0x96ca('0x45')]=_['map'](_0x2fcd46,_0x96ca('0x3b'));_0x11a181[_0x96ca('0x46')]=_[_0x96ca('0x47')](_0x23d523[_0x96ca('0x46')]);_0x11a181[_0x96ca('0x48')]=_[_0x96ca('0x49')](_0x11a181[_0x96ca('0x45')],_0x11a181['query']);_0x561c82[_0x96ca('0x4a')]=_[_0x96ca('0x49')](_0x11a181[_0x96ca('0x45')],qs[_0x96ca('0x4b')](_0x23d523[_0x96ca('0x46')][_0x96ca('0x4b')]));_0x561c82[_0x96ca('0x4a')]=_0x561c82[_0x96ca('0x4a')]['length']?_0x561c82['attributes']:_0x11a181[_0x96ca('0x45')];if(!_0x23d523[_0x96ca('0x46')][_0x96ca('0x4c')](_0x96ca('0x4d'))){_0x561c82[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x23d523[_0x96ca('0x46')]['limit']);_0x561c82[_0x96ca('0x33')]=qs[_0x96ca('0x33')](_0x23d523[_0x96ca('0x46')][_0x96ca('0x33')]);}_0x561c82[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x23d523[_0x96ca('0x46')][_0x96ca('0x4f')]);_0x561c82[_0x96ca('0x50')]=qs['filters'](_['pick'](_0x23d523[_0x96ca('0x46')],_0x11a181[_0x96ca('0x48')]),_0x2fcd46);if(_0x23d523[_0x96ca('0x46')][_0x96ca('0x51')]){_0x561c82[_0x96ca('0x50')]=_[_0x96ca('0x52')](_0x561c82[_0x96ca('0x50')],{'$or':_[_0x96ca('0x40')](_0x2fcd46,function(_0x271e2e){if(_0x271e2e['type']!==_0x96ca('0x53')){var _0x2afc13={};_0x2afc13[_0x271e2e[_0x96ca('0x3b')]]={'$like':'%'+_0x23d523[_0x96ca('0x46')]['filter']+'%'};return _0x2afc13;}})});}_0x561c82=_[_0x96ca('0x52')]({},_0x561c82,_0x23d523[_0x96ca('0x54')]);var _0x50e0bb={'where':_0x561c82[_0x96ca('0x50')]};return db[_0x96ca('0x55')][_0x96ca('0x32')](_0x50e0bb)[_0x96ca('0x23')](function(_0x35675c){_0x4b9ec8[_0x96ca('0x32')]=_0x35675c;if(_0x23d523['query']['includeAll']){_0x561c82[_0x96ca('0x56')]=[{'all':!![]}];}return db[_0x96ca('0x55')][_0x96ca('0x57')](_0x561c82);})[_0x96ca('0x23')](function(_0x2e547a){_0x4b9ec8['rows']=_0x2e547a;return _0x4b9ec8;})[_0x96ca('0x23')](respondWithFilteredResult(_0x141fec,_0x561c82))[_0x96ca('0x2d')](handleError(_0x141fec,null));};exports[_0x96ca('0x58')]=function(_0x968ffb,_0x215335){var _0x445980={'raw':![],'where':{'id':_0x968ffb[_0x96ca('0x59')]['id']},'include':[{'model':db[_0x96ca('0x3e')],'as':'mandatoryDispositionPause'}]},_0x8c9974={};_0x8c9974[_0x96ca('0x45')]=_[_0x96ca('0x47')](db[_0x96ca('0x55')]['rawAttributes']);_0x8c9974[_0x96ca('0x46')]=_[_0x96ca('0x47')](_0x968ffb[_0x96ca('0x46')]);_0x8c9974[_0x96ca('0x48')]=_['intersection'](_0x8c9974[_0x96ca('0x45')],_0x8c9974[_0x96ca('0x46')]);_0x445980[_0x96ca('0x4a')]=_['intersection'](_0x8c9974[_0x96ca('0x45')],qs[_0x96ca('0x4b')](_0x968ffb['query'][_0x96ca('0x4b')]));_0x445980[_0x96ca('0x4a')]=_0x445980[_0x96ca('0x4a')][_0x96ca('0x5a')]?_0x445980['attributes']:_0x8c9974[_0x96ca('0x45')];if(_0x968ffb[_0x96ca('0x46')][_0x96ca('0x5b')]){_0x445980[_0x96ca('0x56')]=[{'all':!![]}];}_0x445980=_[_0x96ca('0x52')]({},_0x445980,_0x968ffb['options']);return db['ChatWebsite']['find'](_0x445980)['then'](handleEntityNotFound(_0x215335,null))[_0x96ca('0x23')](respondWithResult(_0x215335,null))[_0x96ca('0x2d')](handleError(_0x215335,null));};exports[_0x96ca('0x5c')]=function(_0x53e9d8,_0x21f9f0){return db[_0x96ca('0x55')]['create'](_0x53e9d8['body'],{})['then'](function(_0x5840f9){var _0x4c6c6a=_0x53e9d8['user'][_0x96ca('0x38')]({'plain':!![]});if(!_0x4c6c6a)throw new Error(_0x96ca('0x5d'));if(_0x4c6c6a[_0x96ca('0x5e')]===_0x96ca('0x5f')){var _0x17d0c9=_0x5840f9[_0x96ca('0x38')]({'plain':!![]});var _0x53b172=_0x96ca('0x39');return db[_0x96ca('0x60')][_0x96ca('0x61')]({'where':{'name':_0x53b172,'userProfileId':_0x4c6c6a[_0x96ca('0x62')]},'raw':!![]})['then'](function(_0x52d047){if(_0x52d047&&_0x52d047['autoAssociation']===0x0){return db['UserProfileResource'][_0x96ca('0x5c')]({'name':_0x17d0c9[_0x96ca('0x3b')],'resourceId':_0x17d0c9['id'],'type':_0x52d047[_0x96ca('0x3b')],'sectionId':_0x52d047['id']},{})['then'](function(){return _0x5840f9;});}else{return _0x5840f9;}})['catch'](function(_0x44648f){logger[_0x96ca('0x29')](_0x96ca('0x63'),_0x44648f);throw _0x44648f;});}return _0x5840f9;})[_0x96ca('0x23')](respondWithResult(_0x21f9f0,0xc9))[_0x96ca('0x2d')](handleError(_0x21f9f0,null));};exports['update']=function(_0x15074c,_0x7c538a){if(_0x15074c[_0x96ca('0x64')]['id']){delete _0x15074c[_0x96ca('0x64')]['id'];}return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x15074c[_0x96ca('0x59')]['id']},'include':[{'model':db[_0x96ca('0x3e')],'as':_0x96ca('0x3f')}]})[_0x96ca('0x23')](handleEntityNotFound(_0x7c538a,null))[_0x96ca('0x23')](saveUpdates(_0x15074c[_0x96ca('0x64')],null))[_0x96ca('0x23')](respondWithResult(_0x7c538a,null))[_0x96ca('0x2d')](handleError(_0x7c538a,null));};exports[_0x96ca('0x65')]=function(_0x5176ea,_0x3863de){return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x5176ea['params']['id']}})['then'](handleEntityNotFound(_0x3863de,null))[_0x96ca('0x23')](removeEntity(_0x3863de,null))[_0x96ca('0x2d')](handleError(_0x3863de,null));};exports[_0x96ca('0x66')]=function(_0xaa4f81,_0x5c2852){return db[_0x96ca('0x55')][_0x96ca('0x66')]()[_0x96ca('0x23')](respondWithResult(_0x5c2852,null))[_0x96ca('0x2d')](handleError(_0x5c2852,null));};exports['addDisposition']=function(_0x505d87,_0xf1538c,_0x41f62e){if(_0x505d87[_0x96ca('0x64')]['id']){delete _0x505d87['body']['id'];}return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x505d87['params']['id']}})['then'](handleEntityNotFound(_0xf1538c,null))[_0x96ca('0x23')](function(_0xe670f9){if(_0xe670f9){_0x505d87[_0x96ca('0x64')][_0x96ca('0x67')]=_0xe670f9['id'];return db[_0x96ca('0x68')][_0x96ca('0x5c')](_0x505d87[_0x96ca('0x64')]);}})['then'](respondWithResult(_0xf1538c,null))[_0x96ca('0x2d')](handleError(_0xf1538c,null));};exports[_0x96ca('0x69')]=function(_0x35fe00,_0xf6fd7c,_0x4c96cf){var _0x15c596={'raw':![],'where':{}};var _0x2420ff={};var _0x547996={'count':0x0,'rows':[]};return db[_0x96ca('0x55')][_0x96ca('0x6a')]({'where':{'id':_0x35fe00[_0x96ca('0x59')]['id']}})['then'](handleEntityNotFound(_0xf6fd7c,null))[_0x96ca('0x23')](function(_0x5af61d){if(_0x5af61d){_0x2420ff[_0x96ca('0x45')]=_[_0x96ca('0x47')](db[_0x96ca('0x68')][_0x96ca('0x41')]);_0x2420ff[_0x96ca('0x46')]=_[_0x96ca('0x47')](_0x35fe00[_0x96ca('0x46')]);_0x2420ff[_0x96ca('0x48')]=_['intersection'](_0x2420ff[_0x96ca('0x45')],_0x2420ff[_0x96ca('0x46')]);_0x15c596[_0x96ca('0x4a')]=_[_0x96ca('0x49')](_0x2420ff['model'],qs['fields'](_0x35fe00[_0x96ca('0x46')][_0x96ca('0x4b')]));_0x15c596[_0x96ca('0x4a')]=_0x15c596[_0x96ca('0x4a')][_0x96ca('0x5a')]?_0x15c596['attributes']:_0x2420ff[_0x96ca('0x45')];if(!_0x35fe00[_0x96ca('0x46')][_0x96ca('0x4c')]('nolimit')){_0x15c596[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x35fe00[_0x96ca('0x46')]['limit']);_0x15c596[_0x96ca('0x33')]=qs[_0x96ca('0x33')](_0x35fe00[_0x96ca('0x46')][_0x96ca('0x33')]);}_0x15c596[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x35fe00[_0x96ca('0x46')][_0x96ca('0x4f')]);_0x15c596['where']=qs[_0x96ca('0x48')](_[_0x96ca('0x6b')](_0x35fe00[_0x96ca('0x46')],_0x2420ff[_0x96ca('0x48')]));_0x15c596[_0x96ca('0x50')][_0x96ca('0x67')]=_0x5af61d['id'];if(_0x35fe00[_0x96ca('0x46')][_0x96ca('0x51')]){_0x15c596[_0x96ca('0x50')]=_[_0x96ca('0x52')](_0x15c596[_0x96ca('0x50')],{'$or':_[_0x96ca('0x40')](_0x15c596[_0x96ca('0x4a')],function(_0x4ee48e){var _0x3c631b={};_0x3c631b[_0x4ee48e]={'$like':'%'+_0x35fe00[_0x96ca('0x46')][_0x96ca('0x51')]+'%'};return _0x3c631b;})});}_0x15c596=_['merge']({},_0x15c596,_0x35fe00[_0x96ca('0x54')]);return db[_0x96ca('0x68')][_0x96ca('0x32')]({'where':_0x15c596[_0x96ca('0x50')]})[_0x96ca('0x23')](function(_0x5a6dd8){_0x547996[_0x96ca('0x32')]=_0x5a6dd8;if(_0x35fe00['query'][_0x96ca('0x5b')]){_0x15c596['include']=[{'all':!![]}];}return db[_0x96ca('0x68')]['findAll'](_0x15c596);})[_0x96ca('0x23')](function(_0x86fb56){_0x547996[_0x96ca('0x6c')]=_0x86fb56;return _0x547996;});}})['then'](respondWithFilteredResult(_0xf6fd7c,_0x15c596))[_0x96ca('0x2d')](handleError(_0xf6fd7c,null));};exports[_0x96ca('0x6d')]=function(_0x23f156,_0x139b2e,_0x145f78){return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x23f156[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x139b2e,null))[_0x96ca('0x23')](function(_0x569484){if(_0x569484){return _0x569484['removeDispositions'](_0x23f156[_0x96ca('0x46')][_0x96ca('0x6e')]);}})['then'](respondWithStatusCode(_0x139b2e,null))[_0x96ca('0x2d')](handleError(_0x139b2e,null));};exports[_0x96ca('0x6f')]=function(_0x51cbfc,_0x5c7601,_0x39349f){if(_0x51cbfc[_0x96ca('0x64')]['id']){delete _0x51cbfc[_0x96ca('0x64')]['id'];}return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x51cbfc['params']['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x5c7601,null))[_0x96ca('0x23')](function(_0xb80f15){if(_0xb80f15){_0x51cbfc[_0x96ca('0x64')][_0x96ca('0x67')]=_0xb80f15['id'];return db[_0x96ca('0x70')][_0x96ca('0x5c')](_0x51cbfc[_0x96ca('0x64')]);}})[_0x96ca('0x23')](respondWithResult(_0x5c7601,null))['catch'](handleError(_0x5c7601,null));};exports['getAnswers']=function(_0x36948f,_0x48ecaa,_0x501e29){var _0xb2b5d3={'raw':![],'where':{}};var _0x4f650c={};var _0x4973b6={'count':0x0,'rows':[]};return db[_0x96ca('0x55')]['findOne']({'where':{'id':_0x36948f[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x48ecaa,null))[_0x96ca('0x23')](function(_0x35f3c1){if(_0x35f3c1){_0x4f650c[_0x96ca('0x45')]=_[_0x96ca('0x47')](db[_0x96ca('0x70')][_0x96ca('0x41')]);_0x4f650c['query']=_[_0x96ca('0x47')](_0x36948f[_0x96ca('0x46')]);_0x4f650c[_0x96ca('0x48')]=_[_0x96ca('0x49')](_0x4f650c[_0x96ca('0x45')],_0x4f650c['query']);_0xb2b5d3[_0x96ca('0x4a')]=_[_0x96ca('0x49')](_0x4f650c['model'],qs['fields'](_0x36948f[_0x96ca('0x46')][_0x96ca('0x4b')]));_0xb2b5d3[_0x96ca('0x4a')]=_0xb2b5d3[_0x96ca('0x4a')][_0x96ca('0x5a')]?_0xb2b5d3[_0x96ca('0x4a')]:_0x4f650c[_0x96ca('0x45')];if(!_0x36948f[_0x96ca('0x46')][_0x96ca('0x4c')]('nolimit')){_0xb2b5d3[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x36948f[_0x96ca('0x46')][_0x96ca('0x34')]);_0xb2b5d3[_0x96ca('0x33')]=qs[_0x96ca('0x33')](_0x36948f[_0x96ca('0x46')][_0x96ca('0x33')]);}_0xb2b5d3[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x36948f[_0x96ca('0x46')][_0x96ca('0x4f')]);_0xb2b5d3[_0x96ca('0x50')]=qs['filters'](_[_0x96ca('0x6b')](_0x36948f[_0x96ca('0x46')],_0x4f650c[_0x96ca('0x48')]));_0xb2b5d3[_0x96ca('0x50')][_0x96ca('0x67')]=_0x35f3c1['id'];if(_0x36948f[_0x96ca('0x46')][_0x96ca('0x51')]){_0xb2b5d3[_0x96ca('0x50')]=_[_0x96ca('0x52')](_0xb2b5d3['where'],{'$or':_[_0x96ca('0x40')](_0xb2b5d3['attributes'],function(_0x1e0f3c){var _0x3b5f56={};_0x3b5f56[_0x1e0f3c]={'$like':'%'+_0x36948f[_0x96ca('0x46')][_0x96ca('0x51')]+'%'};return _0x3b5f56;})});}_0xb2b5d3=_[_0x96ca('0x52')]({},_0xb2b5d3,_0x36948f['options']);return db[_0x96ca('0x70')]['count']({'where':_0xb2b5d3[_0x96ca('0x50')]})['then'](function(_0x1e2b0f){_0x4973b6[_0x96ca('0x32')]=_0x1e2b0f;if(_0x36948f[_0x96ca('0x46')]['includeAll']){_0xb2b5d3[_0x96ca('0x56')]=[{'all':!![]}];}return db[_0x96ca('0x70')][_0x96ca('0x57')](_0xb2b5d3);})[_0x96ca('0x23')](function(_0x134f63){_0x4973b6[_0x96ca('0x6c')]=_0x134f63;return _0x4973b6;});}})[_0x96ca('0x23')](respondWithFilteredResult(_0x48ecaa,_0xb2b5d3))['catch'](handleError(_0x48ecaa,null));};exports[_0x96ca('0x71')]=function(_0x2d5c59,_0x3fb96a,_0x353cd5){return db[_0x96ca('0x55')]['find']({'where':{'id':_0x2d5c59['params']['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x3fb96a,null))['then'](function(_0x4cbe3f){if(_0x4cbe3f){return _0x4cbe3f[_0x96ca('0x71')](_0x2d5c59[_0x96ca('0x46')]['ids']);}})[_0x96ca('0x23')](respondWithStatusCode(_0x3fb96a,null))['catch'](handleError(_0x3fb96a,null));};exports[_0x96ca('0x72')]=function(_0x48e2f7,_0x4fb7f2,_0x302071){_0x48e2f7[_0x96ca('0x64')][_0x96ca('0x73')]=_0x48e2f7['file'][_0x96ca('0x74')];return db[_0x96ca('0x55')]['find']({'where':{'id':_0x48e2f7[_0x96ca('0x59')]['id']}})['then'](handleEntityNotFound(_0x4fb7f2,null))[_0x96ca('0x23')](saveUpdates(_0x48e2f7['body'],null))['then'](respondWithResult(_0x4fb7f2,null))[_0x96ca('0x2d')](handleError(_0x4fb7f2,null));};exports[_0x96ca('0x75')]=function(_0x520130,_0x4103c3,_0x15d784){_0x520130[_0x96ca('0x64')][_0x96ca('0x76')]=_0x520130[_0x96ca('0x77')][_0x96ca('0x74')];return db['ChatWebsite']['find']({'where':{'id':_0x520130[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x4103c3,null))['then'](saveUpdates(_0x520130[_0x96ca('0x64')],null))['then'](respondWithResult(_0x4103c3,null))[_0x96ca('0x2d')](handleError(_0x4103c3,null));};exports[_0x96ca('0x78')]=function(_0x1e324d,_0x1e587c,_0x2c5fd8){_0x1e324d['body'][_0x96ca('0x79')]=_0x1e324d[_0x96ca('0x77')][_0x96ca('0x74')];return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x1e324d[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x1e587c,null))[_0x96ca('0x23')](saveUpdates(_0x1e324d[_0x96ca('0x64')],null))[_0x96ca('0x23')](respondWithResult(_0x1e587c,null))['catch'](handleError(_0x1e587c,null));};exports[_0x96ca('0x7a')]=function(_0x40d9fd,_0x493401,_0x5ddd9c){_0x40d9fd[_0x96ca('0x64')][_0x96ca('0x7b')]=_0x40d9fd['file'][_0x96ca('0x74')];return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x40d9fd[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x493401,null))[_0x96ca('0x23')](saveUpdates(_0x40d9fd[_0x96ca('0x64')],null))[_0x96ca('0x23')](respondWithResult(_0x493401,null))[_0x96ca('0x2d')](handleError(_0x493401,null));};exports['getLogo']=function(_0x506138,_0xdb179a,_0x8af87b){var _0x19ea24=path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],_0x96ca('0x7e'));var _0x30be0f={'where':{'id':_0x506138['params']['id']},'attributes':['id',_0x96ca('0x73')],'raw':!![]};var _0x59ca9c=![];return require(_0x96ca('0x7f'))[_0x96ca('0x80')]()[_0x96ca('0x23')](function(_0x340051){if(_0x340051){_0x59ca9c=_0x340051[_0x96ca('0x81')];}})[_0x96ca('0x23')](function(){return db['ChatWebsite'][_0x96ca('0x61')](_0x30be0f);})['then'](handleEntityNotFound(_0xdb179a,null))[_0x96ca('0x23')](function(_0x44e00f){if(_0x44e00f){if(!_[_0x96ca('0x82')](_0x44e00f[_0x96ca('0x73')])){if(fs[_0x96ca('0x83')](path['join'](config[_0x96ca('0x7d')],_0x96ca('0x84'),_0x44e00f[_0x96ca('0x73')]))&&_0x59ca9c){_0x19ea24=path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],_0x96ca('0x84'),_0x44e00f[_0x96ca('0x73')]);}}return _0xdb179a[_0x96ca('0x85')](_0x19ea24);}})[_0x96ca('0x2d')](handleError(_0xdb179a,null));};exports['getAvatar']=function(_0x1fea00,_0x38cb59,_0x5088a0){var _0x400795=path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],'server/files/images/avatars/default_avatar.png');var _0xb0214c={'where':{'id':_0x1fea00['params']['id']},'attributes':['id',_0x96ca('0x76')],'raw':!![]};return db[_0x96ca('0x55')]['find'](_0xb0214c)['then'](handleEntityNotFound(_0x38cb59,null))[_0x96ca('0x23')](function(_0x23122f){if(_0x23122f){if(!_[_0x96ca('0x82')](_0x23122f[_0x96ca('0x76')])){if(fs[_0x96ca('0x83')](path[_0x96ca('0x7c')](config['root'],_0x96ca('0x86'),_0x23122f[_0x96ca('0x76')]))){_0x400795=path['join'](config[_0x96ca('0x7d')],'server/files/images/avatars/',_0x23122f[_0x96ca('0x76')]);}}return _0x38cb59[_0x96ca('0x85')](_0x400795);}})[_0x96ca('0x2d')](handleError(_0x38cb59,null));};exports[_0x96ca('0x87')]=function(_0x4cf163,_0xed70bc,_0x7731dc){var _0x4cde99=path['join'](config[_0x96ca('0x7d')],_0x96ca('0x88'));var _0x1cdf94={'where':{'id':_0x4cf163[_0x96ca('0x59')]['id']},'attributes':['id',_0x96ca('0x79'),_0x96ca('0x89')],'raw':!![]};return db['ChatWebsite'][_0x96ca('0x61')](_0x1cdf94)[_0x96ca('0x23')](handleEntityNotFound(_0xed70bc,null))[_0x96ca('0x23')](function(_0x14b707){if(_0x14b707){if(!_[_0x96ca('0x82')](_0x14b707[_0x96ca('0x79')])){if(fs[_0x96ca('0x83')](path[_0x96ca('0x7c')](config['root'],_0x96ca('0x86'),_0x14b707['customerAvatar']))&&_0x14b707[_0x96ca('0x89')]){_0x4cde99=path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],'server/files/images/avatars/',_0x14b707['customerAvatar']);}}return _0xed70bc[_0x96ca('0x85')](_0x4cde99);}})['catch'](handleError(_0xed70bc,null));};exports[_0x96ca('0x8a')]=function(_0x1e5aab,_0x350cc4,_0x4a8f21){var _0x4c685d=path[_0x96ca('0x7c')](config['root'],_0x96ca('0x8b'));var _0x490c87={'where':{'id':_0x1e5aab[_0x96ca('0x59')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x96ca('0x55')][_0x96ca('0x61')](_0x490c87)[_0x96ca('0x23')](handleEntityNotFound(_0x350cc4,null))['then'](function(_0x1f8ade){if(_0x1f8ade){if(!_[_0x96ca('0x82')](_0x1f8ade['systemAvatar'])){if(fs[_0x96ca('0x83')](path['join'](config['root'],_0x96ca('0x86'),_0x1f8ade[_0x96ca('0x7b')]))){_0x4c685d=path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],_0x96ca('0x86'),_0x1f8ade[_0x96ca('0x7b')]);}}return _0x350cc4[_0x96ca('0x85')](_0x4c685d);}})[_0x96ca('0x2d')](handleError(_0x350cc4,null));};exports[_0x96ca('0x8c')]=function(_0x1114f7,_0x453514,_0x211bd4){var _0x5dfc16=require(_0x96ca('0x8d'));var _0x5f2717=new _0x5dfc16();var _0x3c183b=_0x5f2717[_0x96ca('0x8e')](_0x1114f7[_0x96ca('0x8f')][_0x96ca('0x90')])[_0x96ca('0x91')]();var _0x3503c3={'body':_0x1114f7[_0x96ca('0x64')],'channel':'chat'};var _0x250965=[];var _0x4aa859=[];var _0x654979={};var _0x3cb1ad=![];return db[_0x96ca('0x92')][_0x96ca('0x66')]()[_0x96ca('0x23')](function(_0x2e0949){if(!_0x2e0949){throw new db['Sequelize'][(_0x96ca('0x22'))](_0x96ca('0x93'));}_0x250965=_[_0x96ca('0x94')](_[_0x96ca('0x47')](_0x2e0949),[_0x96ca('0x95'),'updatedAt']);_0x4aa859=_[_0x96ca('0x94')](_[_0x96ca('0x47')](_0x2e0949),['createdAt',_0x96ca('0x96'),_0x96ca('0x97'),_0x96ca('0x98')]);if(_0x1114f7[_0x96ca('0x64')]['id']){delete _0x1114f7[_0x96ca('0x64')]['id'];}if(_[_0x96ca('0x82')](_0x1114f7[_0x96ca('0x64')][_0x96ca('0x99')])){throw new db[(_0x96ca('0x9a'))]['ValidationError'](_0x96ca('0x9b'));}if(_['isNil'](_0x1114f7[_0x96ca('0x64')]['body'])||_0x1114f7[_0x96ca('0x64')][_0x96ca('0x64')]===''){throw new db[(_0x96ca('0x9a'))][(_0x96ca('0x22'))](_0x96ca('0x9c'));}if(_[_0x96ca('0x82')](_0x1114f7[_0x96ca('0x64')][_0x96ca('0x9d')])){throw new db[(_0x96ca('0x9a'))][(_0x96ca('0x22'))](_0x96ca('0x9e')+_0x4aa859);}if(!_[_0x96ca('0x9f')](_0x4aa859,_0x1114f7[_0x96ca('0x64')][_0x96ca('0x9d')])){throw new db[(_0x96ca('0x9a'))][(_0x96ca('0x22'))](_0x96ca('0xa0')+_0x4aa859);}_0x654979[_0x1114f7[_0x96ca('0x64')][_0x96ca('0x9d')]]=_0x1114f7['body']['from'];})[_0x96ca('0x23')](function(){return db['ChatWebsite'][_0x96ca('0x61')]({'where':{'id':_0x1114f7[_0x96ca('0x59')]['id']},'include':[{'model':db[_0x96ca('0xa1')],'as':_0x96ca('0xa2'),'include':[{'model':db['CmContact'],'as':_0x96ca('0xa3'),'where':_0x654979,'limit':0x1,'order':[['updatedAt',_0x96ca('0xa4')]]}]},{'model':db[_0x96ca('0xa5')],'as':'Applications'}]});})[_0x96ca('0x23')](handleEntityNotFound(_0x453514,null))[_0x96ca('0x23')](function(_0x210100){if(_0x210100&&_0x210100[_0x96ca('0xa2')]){_0x3503c3['account']=_0x210100;_0x3503c3[_0x96ca('0xa6')]=_0x210100[_0x96ca('0xa7')];_0x3503c3[_0x96ca('0xa8')]=_0x210100['List'];_0x3503c3[_0x96ca('0xa6')]=_[_0x96ca('0xa9')](_0x3503c3[_0x96ca('0xa6')],['priority'],[_0x96ca('0xaa')]);if(_0x3503c3[_0x96ca('0xab')]['Applications']){delete _0x3503c3[_0x96ca('0xab')][_0x96ca('0xa7')];}if(_0x3503c3[_0x96ca('0xab')][_0x96ca('0xa2')]&&_0x3503c3[_0x96ca('0xab')][_0x96ca('0xa2')][_0x96ca('0xa3')]['length']){return _0x3503c3['account'][_0x96ca('0xa2')][_0x96ca('0xa3')][0x0];}var _0x141c75=_[_0x96ca('0x1b')](_0x1114f7[_0x96ca('0x64')],{'firstName':_0x1114f7['body'][_0x96ca('0x99')],'ListId':_0x210100[_0x96ca('0x98')]});_0x141c75[_0x1114f7[_0x96ca('0x64')]['mapKey']]=_0x1114f7[_0x96ca('0x64')]['from'];return db['CmContact'][_0x96ca('0x5c')](_0x141c75,{'fields':_0x250965,'raw':!![]});}})['then'](handleEntityNotFound(_0x453514,null))[_0x96ca('0x23')](function(_0x342818){_0x3503c3[_0x96ca('0xac')]=_0x342818;var _0x4c16a6=_0x1114f7[_0x96ca('0x64')][_0x96ca('0xad')];if(_0x1114f7[_0x96ca('0x8f')]['cf-connecting-ip']){_0x4c16a6=_0x1114f7['headers'][_0x96ca('0xae')];}else if(_0x1114f7['headers'][_0x96ca('0xaf')]){_0x4c16a6=_[_0x96ca('0xb0')](_0x1114f7[_0x96ca('0x8f')][_0x96ca('0xaf')]['split'](','));}if(_0x342818){var _0x98d7a7={'ContactId':_0x342818['id'],'ChatWebsiteId':_0x1114f7[_0x96ca('0x59')]['id'],'from':(_0x342818['firstName']||'')+'\x20'+(_0x342818[_0x96ca('0xb1')]||''),'customerIp':_0x4c16a6,'customerPort':_0x1114f7[_0x96ca('0x8f')]['x-real-port']?_0x1114f7[_0x96ca('0x8f')][_0x96ca('0xb2')]:null,'referer':_0x1114f7['body'][_0x96ca('0xb3')],'browserName':_0x3c183b[_0x96ca('0xb4')]['name']&&_0x3c183b[_0x96ca('0xb4')][_0x96ca('0xb5')]?util[_0x96ca('0xb6')](_0x96ca('0xb7'),_0x3c183b[_0x96ca('0xb4')][_0x96ca('0x3b')],_0x3c183b['browser']['version']):_0x96ca('0xb8'),'browserVersion':_0x3c183b[_0x96ca('0xb4')]['version']||'unknown','osName':util['format'](_0x96ca('0xb7'),_0x3c183b['os'][_0x96ca('0x3b')],_0x3c183b['os'][_0x96ca('0xb5')]),'osVersion':_0x3c183b['os'][_0x96ca('0xb5')],'deviceModel':_0x3c183b['device'][_0x96ca('0x45')]&&_0x3c183b[_0x96ca('0xb9')][_0x96ca('0xba')]?util[_0x96ca('0xb6')](_0x96ca('0xbb'),_0x3c183b[_0x96ca('0xb9')][_0x96ca('0x45')],_0x3c183b[_0x96ca('0xb9')][_0x96ca('0xba')],_0x3c183b['device']['type']):null,'deviceVendor':_0x3c183b['device'][_0x96ca('0xba')],'deviceType':_0x3c183b[_0x96ca('0xb9')][_0x96ca('0x43')],'formData':JSON[_0x96ca('0x28')](_0x1114f7[_0x96ca('0x64')])};var _0x5bdb38={'ChatWebsiteId':_0x1114f7[_0x96ca('0x59')]['id'],'closed':![]};if(_0x1114f7[_0x96ca('0x64')][_0x96ca('0xbc')]){_0x5bdb38[_0x96ca('0xbc')]=_0x1114f7[_0x96ca('0x64')]['threadId'];return db[_0x96ca('0xbd')][_0x96ca('0x61')]({'where':_0x5bdb38})[_0x96ca('0x23')](function(_0xa496dd){if(_0xa496dd){return[_0xa496dd,![]];}_0x98d7a7[_0x96ca('0xbc')]=_0x1114f7[_0x96ca('0x64')][_0x96ca('0xbc')];_0x98d7a7['externalUrl']=_0x1114f7[_0x96ca('0x64')]['externalUrl'];return db[_0x96ca('0xbd')]['create'](_0x98d7a7)[_0x96ca('0x23')](function(_0x1057c6){return[_0x1057c6,!![]];});});}_0x5bdb38[_0x96ca('0xbe')]=_0x342818['id'];if(_0x1114f7[_0x96ca('0x64')][_0x96ca('0xbf')]&&_0x1114f7[_0x96ca('0x64')][_0x96ca('0xbf')]['id']){_0x5bdb38['id']=_0x1114f7[_0x96ca('0x64')]['interaction']['id'];return db[_0x96ca('0xbd')][_0x96ca('0x61')]({'where':_0x5bdb38})['then'](function(_0x429a2d){if(_0x429a2d){return[_0x429a2d,![]];}return db[_0x96ca('0xbd')][_0x96ca('0x5c')](_0x98d7a7)[_0x96ca('0x23')](function(_0x2fee60){return[_0x2fee60,!![]];});});}return db[_0x96ca('0xbd')][_0x96ca('0x5c')](_0x98d7a7)['then'](function(_0x1dfbc4){return[_0x1dfbc4,!![]];});}})[_0x96ca('0xc0')](function(_0x2817de,_0x708cdd){if(_0x2817de){_0x3cb1ad=_0x708cdd;if(!_0x708cdd){var _0x2c3081={'from':(_0x3503c3['contact'][_0x96ca('0xc1')]||'')+'\x20'+(_0x3503c3[_0x96ca('0xac')][_0x96ca('0xb1')]||'')};if(_0x1114f7[_0x96ca('0x64')][_0x96ca('0xbc')]&&_0x1114f7['body'][_0x96ca('0xc2')]&&_0x1114f7[_0x96ca('0x64')][_0x96ca('0xbc')]!=_0x1114f7['body'][_0x96ca('0xc2')]){_0x2c3081['threadId']=_0x1114f7['body'][_0x96ca('0xc2')];}return _0x2817de[_0x96ca('0xc3')](_0x2c3081);}else{return _0x2817de;}}})[_0x96ca('0x23')](function(_0x1f213f){_0x3503c3[_0x96ca('0xbf')]=_0x1f213f['get']({'plain':!![]});_0x3503c3[_0x96ca('0xbf')][_0x96ca('0xc4')]=_0x3cb1ad;if(_0x3503c3[_0x96ca('0xbf')]['created']){if(_0x3503c3[_0x96ca('0xab')]['autoclose']){_0x3503c3['applications'][_0x96ca('0xc5')]({'id':0x0,'priority':_0x3503c3[_0x96ca('0xa6')][_0x96ca('0x5a')]+0x1,'app':_0x96ca('0xc6'),'appdata':_0x96ca('0xc7'),'interval':'*,*,*,*'});}}return db[_0x96ca('0xc8')]['create']({'body':_0x1114f7[_0x96ca('0x64')][_0x96ca('0x64')],'ChatWebsiteId':_0x1114f7[_0x96ca('0x59')]['id'],'ChatInteractionId':_0x1f213f['id'],'direction':'in','ContactId':_0x3503c3[_0x96ca('0xac')]['id'],'AttachmentId':_0x1114f7[_0x96ca('0x64')][_0x96ca('0xc9')]});})[_0x96ca('0x23')](function(_0x2cb3a5){_0x3503c3[_0x96ca('0x2c')]=_0x2cb3a5;if(_0x3503c3[_0x96ca('0xbf')][_0x96ca('0xca')]){return db[_0x96ca('0xcb')][_0x96ca('0x61')]({'attributes':['id',_0x96ca('0x3b')],'where':{'id':_0x3503c3[_0x96ca('0xbf')][_0x96ca('0xca')]}})[_0x96ca('0x23')](function(_0x571867){if(_0x571867){_0x3503c3[_0x96ca('0xa6')][_0x96ca('0xcc')]({'id':0x0,'priority':0x0,'app':_0x96ca('0xcd'),'appdata':_0x571867['name']+','+(_0x3503c3[_0x96ca('0xab')]['waitForTheAssignedAgent']||0xa),'interval':_0x96ca('0xce')});_0x3503c3['forcedOwnership']=!![];}return respondWithRpcPromise(_0x96ca('0xcf'),_0x96ca('0xd0'),_0x3503c3);});}return respondWithRpcPromise('Start',_0x96ca('0xd0'),_0x3503c3);})[_0x96ca('0x23')](function(_0xc395da){respondWithRpcPromise(_0x96ca('0xd1'),_0x96ca('0xd1'),{'event':_0x96ca('0x8c'),'message':_0xc395da},client9002);return _0xc395da;})[_0x96ca('0x23')](respondWithResult(_0x453514,null))[_0x96ca('0x2d')](handleError(_0x453514,null));};exports[_0x96ca('0xd2')]=function(_0x1d0312,_0x3e5f51,_0x3e74f8){var _0xd79573,_0x5aec32,_0x460d6e;var _0x2d1d8c=[];var _0x5dce40=[];var _0x2f4fe3={};return db['CmContact'][_0x96ca('0x66')]()[_0x96ca('0x23')](function(_0x1a62ef){if(!_0x1a62ef){throw new db[(_0x96ca('0x9a'))][(_0x96ca('0x22'))](_0x96ca('0x93'));}_0x5dce40=_[_0x96ca('0x94')](_[_0x96ca('0x47')](_0x1a62ef),[_0x96ca('0x95'),'updatedAt']);_0x2d1d8c=_[_0x96ca('0x94')](_[_0x96ca('0x47')](_0x1a62ef),[_0x96ca('0x95'),_0x96ca('0x96'),'CompanyId',_0x96ca('0x98')]);if(_0x1d0312['body']['id']){delete _0x1d0312['body']['id'];}if(_[_0x96ca('0x82')](_0x1d0312['body'][_0x96ca('0x99')])){throw _0x3e5f51[_0x96ca('0x2f')](0x1f4)[_0x96ca('0x3c')](new db[(_0x96ca('0x9a'))][(_0x96ca('0x22'))](_0x96ca('0x9b')));}if(_[_0x96ca('0x82')](_0x1d0312[_0x96ca('0x64')][_0x96ca('0x64')])||_0x1d0312[_0x96ca('0x64')]['body']===''){throw _0x3e5f51[_0x96ca('0x2f')](0x1f4)['send'](new db['Sequelize'][(_0x96ca('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x96ca('0x82')](_0x1d0312[_0x96ca('0x64')][_0x96ca('0xd3')])){throw _0x3e5f51['status'](0x1f4)[_0x96ca('0x3c')](new db['Sequelize'][(_0x96ca('0x22'))](_0x96ca('0xd4')+_0x2d1d8c));}if(!_[_0x96ca('0x9f')](_0x2d1d8c,_0x1d0312[_0x96ca('0x64')][_0x96ca('0xd3')])){throw _0x3e5f51[_0x96ca('0x2f')](0x1f4)[_0x96ca('0x3c')](new db['Sequelize']['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d1d8c));}_0x2f4fe3[_0x1d0312[_0x96ca('0x64')][_0x96ca('0xd3')]]=_0x1d0312[_0x96ca('0x64')][_0x96ca('0x99')];})[_0x96ca('0x23')](function(){return db[_0x96ca('0x55')]['find']({'where':{'id':_0x1d0312['params']['id']},'include':[{'model':db['CmList'],'as':'List'}]});})[_0x96ca('0x23')](handleEntityNotFound(_0x3e5f51,null))[_0x96ca('0x23')](function(_0x5aa20c){if(_0x5aa20c&&_0x5aa20c['List']){_0x5aec32=_0x5aa20c;var _0x5e1a74=_['defaults'](_0x1d0312['body'],{'firstName':_0x1d0312[_0x96ca('0x64')][_0x96ca('0x99')],'phone':_0x1d0312['body'][_0x96ca('0x99')],'ListId':_0x5aa20c['ListId']});_0x5e1a74[_0x1d0312['body']['mapKeyOffline']]=_0x1d0312[_0x96ca('0x64')]['from'];return db[_0x96ca('0x92')][_0x96ca('0xd5')]({'where':_0x2f4fe3,'defaults':_0x5e1a74});}})[_0x96ca('0xc0')](function(_0xe9c40b){if(_0xe9c40b){_0x460d6e=_0xe9c40b;var _0x5a56bb=fs['readFileSync'](path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],_0x96ca('0xd6')),'utf8');var _0x69116b=ejs['render'](_0x5a56bb,{'body':_['toPairs'](_0x1d0312['body'][_0x96ca('0x64')]),'bodyTitle':_0x5aec32[_0x96ca('0xd7')]});return db[_0x96ca('0xd8')]['create']({'body':_0x69116b,'ContactId':_0xe9c40b['id'],'ChatWebsiteId':_0x5aec32['id']});}})[_0x96ca('0x23')](function(_0xea1aa7){if(_0xea1aa7){_0xd79573=_0xea1aa7;return db[_0x96ca('0xd9')][_0x96ca('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0x96ca('0xda')],'as':'Smtp','raw':!![]}]});}})[_0x96ca('0x23')](function(_0x161afa){if(_0x161afa&&_0x161afa[_0x96ca('0xdb')]&&_0x5aec32[_0x96ca('0xdc')]){var _0x446d02={'tls':{'rejectUnauthorized':![]}};if(_0x161afa[_0x96ca('0xdb')][_0x96ca('0xdd')]){_0x446d02[_0x96ca('0xdd')]=_0x161afa[_0x96ca('0xdb')][_0x96ca('0xdd')];}else{_0x446d02['host']=_0x161afa[_0x96ca('0xdb')]['host'];_0x446d02[_0x96ca('0xde')]=_0x161afa['Smtp'][_0x96ca('0xde')];_0x446d02[_0x96ca('0xdf')]=_0x161afa['Smtp'][_0x96ca('0xdf')];}if(_0x161afa[_0x96ca('0xdb')][_0x96ca('0xe0')]){_0x446d02[_0x96ca('0xe1')]={'user':_0x161afa['Smtp'][_0x96ca('0x5f')],'pass':_0x161afa[_0x96ca('0xdb')][_0x96ca('0xe2')]};}return respondWithRpcPromise(_0x96ca('0xe3'),_0x96ca('0xe4'),{'account':_0x446d02,'message':{'from':util[_0x96ca('0xb6')](_0x96ca('0xe5'),_0x161afa[_0x96ca('0x3b')],_0x161afa[_0x96ca('0xe6')]||_0x161afa['Smtp']['user']),'to':_0x5aec32[_0x96ca('0xdc')],'subject':_0x5aec32['offlineMessageSubject'],'text':_0xd79573[_0x96ca('0x64')]}},client9003)[_0x96ca('0x23')](function(){return _0xd79573;})['catch'](function(_0xe7b6d2){console[_0x96ca('0x29')](_0xe7b6d2);});}})[_0x96ca('0x23')](function(){if(_0xd79573){return _0xd79573;}})[_0x96ca('0x23')](respondWithResult(_0x3e5f51,null))[_0x96ca('0x2d')](handleError(_0x3e5f51,null));};exports[_0x96ca('0xe7')]=function(_0x1bbb18,_0x2bcc2c,_0x2b9d58){return db[_0x96ca('0xbd')][_0x96ca('0x61')]({'where':{'id':_0x1bbb18[_0x96ca('0x59')]['id']}})['then'](handleEntityNotFound(_0x2bcc2c,null))['then'](function(_0x4aa26c){if(_0x4aa26c){return _0x4aa26c[_0x96ca('0xe7')](_0x1bbb18[_0x96ca('0x64')][_0x96ca('0x6e')],_[_0x96ca('0xe8')](_0x1bbb18[_0x96ca('0x64')],[_0x96ca('0x6e'),'id'])||{});}})[_0x96ca('0x23')](respondWithResult(_0x2bcc2c,null))[_0x96ca('0x2d')](handleError(_0x2bcc2c,null));};exports[_0x96ca('0xe9')]=function(_0x3f7299,_0x20cb34,_0x1ab432){var _0x1dc483={'raw':![],'where':{}};var _0x1c8bea={};var _0x4c0e52={'count':0x0,'rows':[]};return db[_0x96ca('0x55')][_0x96ca('0x6a')]({'where':{'id':_0x3f7299['params']['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x20cb34,null))[_0x96ca('0x23')](function(_0x5061cd){if(_0x5061cd){_0x1c8bea[_0x96ca('0x45')]=_['keys'](db['ChatInteraction'][_0x96ca('0x41')]);_0x1c8bea[_0x96ca('0x46')]=_[_0x96ca('0x47')](_0x3f7299['query']);_0x1c8bea[_0x96ca('0x48')]=_[_0x96ca('0x49')](_0x1c8bea[_0x96ca('0x45')],_0x1c8bea[_0x96ca('0x46')]);_0x1dc483[_0x96ca('0x4a')]=_[_0x96ca('0x49')](_0x1c8bea[_0x96ca('0x45')],qs[_0x96ca('0x4b')](_0x3f7299[_0x96ca('0x46')][_0x96ca('0x4b')]));_0x1dc483[_0x96ca('0x4a')]=_0x1dc483['attributes'][_0x96ca('0x5a')]?_0x1dc483[_0x96ca('0x4a')]:_0x1c8bea[_0x96ca('0x45')];if(!_0x3f7299['query'][_0x96ca('0x4c')]('nolimit')){_0x1dc483[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x3f7299[_0x96ca('0x46')]['limit']);_0x1dc483['offset']=qs['offset'](_0x3f7299[_0x96ca('0x46')]['offset']);}_0x1dc483[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x3f7299[_0x96ca('0x46')][_0x96ca('0x4f')]);_0x1dc483[_0x96ca('0x50')]=qs[_0x96ca('0x48')](_[_0x96ca('0x6b')](_0x3f7299[_0x96ca('0x46')],_0x1c8bea[_0x96ca('0x48')]));_0x1dc483['where'][_0x96ca('0x67')]=_0x5061cd['id'];if(_0x3f7299['query']['filter']){_0x1dc483[_0x96ca('0x50')]=_[_0x96ca('0x52')](_0x1dc483[_0x96ca('0x50')],{'$or':_[_0x96ca('0x40')](_0x1dc483[_0x96ca('0x4a')],function(_0x4dca04){var _0xc1e697={};_0xc1e697[_0x4dca04]={'$like':'%'+_0x3f7299[_0x96ca('0x46')]['filter']+'%'};return _0xc1e697;})});}_0x1dc483=_[_0x96ca('0x52')]({},_0x1dc483,_0x3f7299[_0x96ca('0x54')]);return db[_0x96ca('0xbd')][_0x96ca('0x32')]({'where':_0x1dc483[_0x96ca('0x50')]})['then'](function(_0x2b4f28){_0x4c0e52['count']=_0x2b4f28;if(_0x3f7299['query']['includeAll']){_0x1dc483['include']=[{'model':db[_0x96ca('0x92')],'as':'Contact','required':![]},{'model':db[_0x96ca('0xcb')],'as':_0x96ca('0xea'),'attributes':[_0x96ca('0x3b'),_0x96ca('0xeb'),'internal'],'required':![]},{'model':db[_0x96ca('0xec')],'as':_0x96ca('0xed'),'attributes':['id',_0x96ca('0x3b'),'color'],'where':_0x3f7299['query'][_0x96ca('0xee')]?{'id':_0x3f7299['query'][_0x96ca('0xee')]}:undefined,'required':_0x3f7299['query'][_0x96ca('0xee')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x1dc483);})[_0x96ca('0x23')](function(_0x2f3d52){_0x4c0e52[_0x96ca('0x6c')]=_0x2f3d52;return _0x4c0e52;});}})[_0x96ca('0x23')](respondWithFilteredResult(_0x20cb34,_0x1dc483))[_0x96ca('0x2d')](handleError(_0x20cb34,null));};function iftimePromise(_0x147318,_0x1f5b1f){return respondWithRpcPromise('Command',_0x96ca('0xef'),{'command':_0x1f5b1f[_0x96ca('0xf0')]?util[_0x96ca('0xb6')](_0x96ca('0xf1'),_0x147318[_0x96ca('0xf2')],_0x1f5b1f[_0x96ca('0xf0')]):util[_0x96ca('0xb6')](_0x96ca('0xf3'),_0x147318[_0x96ca('0xf2')])},client9002)['then'](function(_0x111089){var _0xf83c0f=_0x111089&&_0x111089[_0x96ca('0xf4')](_0x96ca('0xf5'))>=0x0?!![]:![];logger[_0x96ca('0x24')](_0x96ca('0xf6'),_0x1f5b1f['id'],_0x147318['id'],_0x147318['interval'],_0xf83c0f?_0x96ca('0xf7'):_0x96ca('0xf8'),_0x1f5b1f['timezone']?_0x1f5b1f[_0x96ca('0xf0')]:_0x96ca('0xf9'));return _0xf83c0f;})[_0x96ca('0x2d')](function(_0x2f7325){logger[_0x96ca('0x29')](_0x96ca('0xf6'),_0x1f5b1f['id'],_0x147318['id'],_0x147318[_0x96ca('0xf2')],util[_0x96ca('0xfa')](_0x2f7325,{'showHidden':![],'depth':null}),_0x1f5b1f[_0x96ca('0xf0')]?_0x1f5b1f['timezone']:_0x96ca('0xf9'));return![];});}exports[_0x96ca('0xef')]=function(_0x565898,_0xd0e661,_0x630cd3){var _0x520e8c=0x0;var _0x158c30=0x0;var _0x50bd7a=![];var _0x26bb77;var _0x27bf86;return db[_0x96ca('0x55')][_0x96ca('0x61')]({'where':{'id':_0x565898['params']['id']},'include':[{'model':db[_0x96ca('0xfb')],'as':_0x96ca('0xfb'),'include':[{'model':db['Interval'],'as':_0x96ca('0xfc'),'attributes':['id',_0x96ca('0xf2')],'raw':!![]}]}]})[_0x96ca('0x23')](handleEntityNotFound(_0xd0e661,null))[_0x96ca('0x23')](function(_0x5e6688){if(_0x5e6688){_0x26bb77=_0x5e6688;return _0x5e6688['getProactiveActions']({'raw':!![]});}})[_0x96ca('0x23')](function(_0xfdf3e2){if(_0x26bb77){if(_0xfdf3e2){_0x27bf86=_0xfdf3e2;}}return require(_0x96ca('0x7f'))[_0x96ca('0x80')]();})['then'](function(_0x47b9ad){if(_0x47b9ad){_0x158c30=_0x47b9ad[_0x96ca('0xfd')];_0x50bd7a=_0x47b9ad[_0x96ca('0x81')];}})[_0x96ca('0x23')](function(){return db[_0x96ca('0xbd')]['count']({'where':{'closed':![]}});})[_0x96ca('0x23')](function(_0x540e68){_0x520e8c=_0x540e68;if(_0x158c30&&_0x540e68>_0x158c30){return db['License']['findOne']({'where':{'id':0x1}})['then'](function(_0x3ccd97){if(_0x3ccd97){_0x3ccd97[_0x96ca('0xfe')](_0x96ca('0xff'));}});}})[_0x96ca('0x23')](function(){if(_0x26bb77['Interval']&&_0x26bb77[_0x96ca('0xfb')][_0x96ca('0xfc')]){var _0x2e17bc=[];for(var _0xf218e2=0x0;_0xf218e2<_0x26bb77[_0x96ca('0xfb')]['Intervals'][_0x96ca('0x5a')];_0xf218e2++){var _0x3c9554=_0x26bb77['Interval'][_0x96ca('0xfc')][_0xf218e2][_0x96ca('0x38')]({'plain':!![]});_0x2e17bc[_0x96ca('0xc5')](iftimePromise(_0x3c9554,_0x26bb77));}return BPromise[_0x96ca('0x100')](_0x2e17bc)[_0x96ca('0x23')](function(_0x482b49){return _[_0x96ca('0x101')](_0x482b49);});}else{return!![];}})[_0x96ca('0x23')](function(_0x1bd372){var _0x402191=fs[_0x96ca('0x102')](path[_0x96ca('0x7c')](config[_0x96ca('0x7d')],_0x96ca('0x103')),_0x96ca('0x104'));var _0x6e42e6={'remote':_0x26bb77[_0x96ca('0x105')],'query':querystring['stringify'](_[_0x96ca('0x52')](_0x26bb77[_0x96ca('0x38')]({'plain':!![]}),{'customerIp':_0x565898[_0x96ca('0x8f')][_0x96ca('0xaf')]||_0x565898['headers'][_0x96ca('0x106')]||_0x565898['connection']['remoteAddress']||_0x565898['ip'],'referer':_0x565898['headers'][_0x96ca('0xb3')],'openedInteractions':_0x520e8c,'maxInteractions':_0x158c30,'virtual':_0x50bd7a[_0x96ca('0xfd')],'online':_0x1bd372,'custom':_0x50bd7a}))['replace'](/'/g,'\x5c\x27')};_0xd0e661[_0x96ca('0x3c')](ejs[_0x96ca('0x107')](Mustache[_0x96ca('0x107')](_0x402191,_0x6e42e6),{'proactiveActions':_0x27bf86,'alignment':_0x26bb77[_0x96ca('0x108')],'verticalAlignment':_0x26bb77[_0x96ca('0x109')],'div_color':_0x26bb77[_0x96ca('0x10a')],'text_color':_0x26bb77[_0x96ca('0x10b')]}));})[_0x96ca('0x2d')](handleError(_0xd0e661,null));};exports[_0x96ca('0x10c')]=function(_0xf3ac8b,_0x1761a4,_0x15397a){return db['ChatWebsite'][_0x96ca('0x6a')]({'where':{'id':_0xf3ac8b[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x1761a4,null))[_0x96ca('0x23')](function(_0x408d94){if(_0x408d94){return db[_0x96ca('0x10d')][_0x96ca('0x10e')](function(_0xf3be4a){return db[_0x96ca('0xa5')][_0x96ca('0x65')]({'where':{'ChatWebsiteId':_0xf3ac8b[_0x96ca('0x59')]['id']},'transaction':_0xf3be4a})[_0x96ca('0x23')](function(_0x2894e2){var _0x45ee7a=_[_0x96ca('0x40')](_0xf3ac8b['body'],function(_0x4f1999){_0x4f1999[_0x96ca('0x67')]=_0xf3ac8b[_0x96ca('0x59')]['id'];return _0x4f1999;});return db[_0x96ca('0xa5')]['bulkCreate'](_0x45ee7a,{'transaction':_0xf3be4a});});})[_0x96ca('0x23')](function(){return db[_0x96ca('0xa5')][_0x96ca('0x10f')]({'where':{'ChatWebsiteId':_0xf3ac8b[_0x96ca('0x59')]['id']},'order':_0x96ca('0x110')});});}})['then'](respondWithResult(_0x1761a4,null))['catch'](handleError(_0x1761a4,null));};exports[_0x96ca('0x111')]=function(_0x44f0b1,_0x1401d8,_0x200f73){var _0x509166={};var _0x5dcbc1={};var _0x40838f;var _0x524cf9;return db[_0x96ca('0x55')][_0x96ca('0x6a')]({'where':{'id':_0x44f0b1[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x1401d8,null))[_0x96ca('0x23')](function(_0x3e0bf1){if(_0x3e0bf1){_0x40838f=_0x3e0bf1;_0x5dcbc1['model']=_[_0x96ca('0x47')](db[_0x96ca('0xa5')][_0x96ca('0x41')]);_0x5dcbc1[_0x96ca('0x46')]=_[_0x96ca('0x47')](_0x44f0b1[_0x96ca('0x46')]);_0x5dcbc1['filters']=_[_0x96ca('0x49')](_0x5dcbc1[_0x96ca('0x45')],_0x5dcbc1[_0x96ca('0x46')]);_0x509166[_0x96ca('0x4a')]=_['intersection'](_0x5dcbc1['model'],qs[_0x96ca('0x4b')](_0x44f0b1[_0x96ca('0x46')][_0x96ca('0x4b')]));_0x509166[_0x96ca('0x4a')]=_0x509166[_0x96ca('0x4a')][_0x96ca('0x5a')]?_0x509166['attributes']:_0x5dcbc1[_0x96ca('0x45')];_0x509166[_0x96ca('0x4e')]=qs['sort'](_0x44f0b1[_0x96ca('0x46')][_0x96ca('0x4f')]);_0x509166[_0x96ca('0x50')]=qs[_0x96ca('0x48')](_[_0x96ca('0x6b')](_0x44f0b1[_0x96ca('0x46')],_0x5dcbc1['filters']));if(_0x44f0b1[_0x96ca('0x46')][_0x96ca('0x51')]){_0x509166[_0x96ca('0x50')]=_[_0x96ca('0x52')](_0x509166[_0x96ca('0x50')],{'$or':_[_0x96ca('0x40')](_0x509166[_0x96ca('0x4a')],function(_0x4dd69f){var _0x1fe13f={};_0x1fe13f[_0x4dd69f]={'$like':'%'+_0x44f0b1[_0x96ca('0x46')]['filter']+'%'};return _0x1fe13f;})});}_0x509166=_[_0x96ca('0x52')]({},_0x509166,_0x44f0b1[_0x96ca('0x54')]);return _0x40838f[_0x96ca('0x111')](_0x509166);}})[_0x96ca('0x23')](function(_0x518ea4){if(_0x518ea4){_0x524cf9=_0x518ea4['length'];if(!_0x44f0b1[_0x96ca('0x46')][_0x96ca('0x4c')](_0x96ca('0x4d'))){_0x509166[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x44f0b1[_0x96ca('0x46')][_0x96ca('0x34')]);_0x509166[_0x96ca('0x33')]=qs[_0x96ca('0x33')](_0x44f0b1[_0x96ca('0x46')][_0x96ca('0x33')]);}return _0x40838f[_0x96ca('0x111')](_0x509166);}})[_0x96ca('0x23')](function(_0x3bd678){if(_0x3bd678){return _0x3bd678?{'count':_0x524cf9,'rows':_0x3bd678}:null;}})[_0x96ca('0x23')](respondWithResult(_0x1401d8,null))[_0x96ca('0x2d')](handleError(_0x1401d8,null));};exports[_0x96ca('0x112')]=function(_0xe1df76,_0x17062e,_0x349d5e){return db[_0x96ca('0x113')][_0x96ca('0x61')]({'where':{'id':_0xe1df76['params']['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x17062e,null))[_0x96ca('0x23')](function(_0x1b9a04){if(_0x1b9a04){return _0x1b9a04[_0x96ca('0x112')](_0xe1df76['body'][_0x96ca('0x6e')],_[_0x96ca('0xe8')](_0xe1df76[_0x96ca('0x64')],[_0x96ca('0x6e'),'id'])||{});}})[_0x96ca('0x23')](respondWithResult(_0x17062e,null))[_0x96ca('0x2d')](handleError(_0x17062e,null));};exports[_0x96ca('0x114')]=function(_0x41a6a3,_0x2ca612,_0x4446e8){var _0x1488fe={};var _0x1e31a8={};var _0x48303f;var _0x285cc0;return db[_0x96ca('0x55')][_0x96ca('0x6a')]({'where':{'id':_0x41a6a3[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x2ca612,null))[_0x96ca('0x23')](function(_0x16f076){if(_0x16f076){_0x48303f=_0x16f076;_0x1e31a8[_0x96ca('0x45')]=_[_0x96ca('0x47')](db[_0x96ca('0x115')]['rawAttributes']);_0x1e31a8[_0x96ca('0x46')]=_['keys'](_0x41a6a3[_0x96ca('0x46')]);_0x1e31a8[_0x96ca('0x48')]=_[_0x96ca('0x49')](_0x1e31a8['model'],_0x1e31a8[_0x96ca('0x46')]);_0x1488fe['attributes']=_[_0x96ca('0x49')](_0x1e31a8[_0x96ca('0x45')],qs[_0x96ca('0x4b')](_0x41a6a3[_0x96ca('0x46')][_0x96ca('0x4b')]));_0x1488fe[_0x96ca('0x4a')]=_0x1488fe[_0x96ca('0x4a')]['length']?_0x1488fe[_0x96ca('0x4a')]:_0x1e31a8[_0x96ca('0x45')];_0x1488fe[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x41a6a3[_0x96ca('0x46')][_0x96ca('0x4f')]);_0x1488fe[_0x96ca('0x50')]=qs['filters'](_[_0x96ca('0x6b')](_0x41a6a3[_0x96ca('0x46')],_0x1e31a8[_0x96ca('0x48')]));if(_0x41a6a3[_0x96ca('0x46')]['filter']){_0x1488fe['where']=_[_0x96ca('0x52')](_0x1488fe[_0x96ca('0x50')],{'$or':_['map'](_0x1488fe[_0x96ca('0x4a')],function(_0x11ade4){var _0xb4ec08={};_0xb4ec08[_0x11ade4]={'$like':'%'+_0x41a6a3[_0x96ca('0x46')][_0x96ca('0x51')]+'%'};return _0xb4ec08;})});}_0x1488fe=_[_0x96ca('0x52')]({},_0x1488fe,_0x41a6a3[_0x96ca('0x54')]);return _0x48303f['getProactiveActions'](_0x1488fe);}})[_0x96ca('0x23')](function(_0x2c8a0b){if(_0x2c8a0b){_0x285cc0=_0x2c8a0b['length'];if(!_0x41a6a3['query'][_0x96ca('0x4c')](_0x96ca('0x4d'))){_0x1488fe[_0x96ca('0x34')]=qs['limit'](_0x41a6a3[_0x96ca('0x46')][_0x96ca('0x34')]);_0x1488fe[_0x96ca('0x33')]=qs['offset'](_0x41a6a3[_0x96ca('0x46')]['offset']);}return _0x48303f['getProactiveActions'](_0x1488fe);}})[_0x96ca('0x23')](function(_0x1a4abb){if(_0x1a4abb){return _0x1a4abb?{'count':_0x285cc0,'rows':_0x1a4abb}:null;}})['then'](respondWithResult(_0x2ca612,null))[_0x96ca('0x2d')](handleError(_0x2ca612,null));};exports[_0x96ca('0x116')]=function(_0x13fb7b,_0x198484,_0x2e6c9b){var _0x31aab5=_0x13fb7b[_0x96ca('0x46')][_0x96ca('0x117')]===_0x96ca('0x118')?_0x96ca('0x119'):_0x96ca('0x11a');return db['ChatWebsite'][_0x96ca('0x61')]({'attributes':['id',_0x31aab5],'where':{'id':_0x13fb7b[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x198484,null))[_0x96ca('0x23')](function(_0xf523c8){if(_0xf523c8){var _0x174451=_0xf523c8[_0x31aab5];var _0x26216c=_0x174451&&_0x174451[_0x96ca('0x11b')]?_0x174451[_0x96ca('0x11b')]:[];_0x198484[_0x96ca('0x3c')]({'fromKey':_['isNil'](_0x174451[_0x96ca('0x11c')])?undefined:_0x174451[_0x96ca('0x11c')],'count':_0x26216c['length'],'rows':_0x26216c});}})[_0x96ca('0x2d')](handleError(_0x198484,null));};exports['getOfflineMessages']=function(_0x7bffdc,_0x239d3c,_0xf372a2){var _0x5d651f={'raw':![],'where':{}};var _0xf809b2={};var _0x5c0411={'count':0x0,'rows':[]};return db[_0x96ca('0x55')][_0x96ca('0x6a')]({'where':{'id':_0x7bffdc[_0x96ca('0x59')]['id']}})['then'](handleEntityNotFound(_0x239d3c,null))[_0x96ca('0x23')](function(_0x56de44){if(_0x56de44){_0xf809b2['model']=_[_0x96ca('0x47')](db[_0x96ca('0xd8')]['rawAttributes']);_0xf809b2[_0x96ca('0x46')]=_[_0x96ca('0x47')](_0x7bffdc[_0x96ca('0x46')]);_0xf809b2['filters']=_['intersection'](_0xf809b2[_0x96ca('0x45')],_0xf809b2[_0x96ca('0x46')]);_0x5d651f['attributes']=_['intersection'](_0xf809b2['model'],qs['fields'](_0x7bffdc['query']['fields']));_0x5d651f['attributes']=_0x5d651f[_0x96ca('0x4a')]['length']?_0x5d651f['attributes']:_0xf809b2[_0x96ca('0x45')];if(!_0x7bffdc[_0x96ca('0x46')][_0x96ca('0x4c')](_0x96ca('0x4d'))){_0x5d651f[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x7bffdc['query'][_0x96ca('0x34')]);_0x5d651f[_0x96ca('0x33')]=qs[_0x96ca('0x33')](_0x7bffdc[_0x96ca('0x46')][_0x96ca('0x33')]);}_0x5d651f[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x7bffdc[_0x96ca('0x46')][_0x96ca('0x4f')]);_0x5d651f['where']=qs[_0x96ca('0x48')](_[_0x96ca('0x6b')](_0x7bffdc[_0x96ca('0x46')],_0xf809b2[_0x96ca('0x48')]));_0x5d651f[_0x96ca('0x50')][_0x96ca('0x67')]=_0x56de44['id'];if(_0x7bffdc['query']['filter']){_0x5d651f['where']=_[_0x96ca('0x52')](_0x5d651f[_0x96ca('0x50')],{'$or':_[_0x96ca('0x40')](_0x5d651f[_0x96ca('0x4a')],function(_0x3a8a11){var _0x1acb8f={};_0x1acb8f[_0x3a8a11]={'$like':'%'+_0x7bffdc[_0x96ca('0x46')][_0x96ca('0x51')]+'%'};return _0x1acb8f;})});}_0x5d651f=_[_0x96ca('0x52')]({},_0x5d651f,_0x7bffdc['options']);return db[_0x96ca('0xd8')]['count']({'where':_0x5d651f[_0x96ca('0x50')]})[_0x96ca('0x23')](function(_0x3e28ef){_0x5c0411['count']=_0x3e28ef;if(_0x7bffdc[_0x96ca('0x46')][_0x96ca('0x5b')]){_0x5d651f['include']=[{'all':!![]}];}else{_0x5d651f[_0x96ca('0x56')]=[{'model':db[_0x96ca('0x92')],'as':_0x96ca('0x11d'),'required':![]}];}return db['ChatOfflineMessage'][_0x96ca('0x57')](_0x5d651f);})[_0x96ca('0x23')](function(_0x3d4c64){_0x5c0411['rows']=_0x3d4c64;return _0x5c0411;});}})[_0x96ca('0x23')](respondWithFilteredResult(_0x239d3c,_0x5d651f))[_0x96ca('0x2d')](handleError(_0x239d3c,null));};exports[_0x96ca('0x11e')]=function(_0x3ed29f,_0x8e3047,_0x3403f3){return db[_0x96ca('0x55')]['find']({'where':{'id':_0x3ed29f[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x8e3047,null))['then'](function(_0xb079b6){if(_0xb079b6){return _0xb079b6[_0x96ca('0x11e')](_0x3ed29f[_0x96ca('0x64')][_0x96ca('0x6e')],_[_0x96ca('0xe8')](_0x3ed29f[_0x96ca('0x64')],[_0x96ca('0x6e'),'id'])||{})[_0x96ca('0xc0')](function(_0x19c91f){for(var _0x48729d=0x0;_0x48729d<_0x3ed29f[_0x96ca('0x64')][_0x96ca('0x6e')][_0x96ca('0x5a')];_0x48729d+=0x1){socket[_0x96ca('0x11f')]('userChatWebsite:save',{'UserId':_0x3ed29f[_0x96ca('0x64')][_0x96ca('0x6e')][_0x48729d],'ChatWebsiteId':_0x3ed29f[_0x96ca('0x59')]['id']});}return _0x19c91f;});}})['then'](respondWithResult(_0x8e3047,null))[_0x96ca('0x2d')](handleError(_0x8e3047,null));};exports[_0x96ca('0x120')]=function(_0x157629,_0x48cf7f,_0x687047){return db[_0x96ca('0x55')]['find']({'where':{'id':_0x157629[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x48cf7f,null))[_0x96ca('0x23')](function(_0x566567){if(_0x566567){return _0x566567[_0x96ca('0x120')](_0x157629[_0x96ca('0x46')][_0x96ca('0x6e')])[_0x96ca('0x23')](function(){if(_[_0x96ca('0x121')](_0x157629[_0x96ca('0x46')][_0x96ca('0x6e')])){for(var _0x3cc74b=0x0;_0x3cc74b<_0x157629[_0x96ca('0x46')][_0x96ca('0x6e')]['length'];_0x3cc74b+=0x1){socket[_0x96ca('0x11f')](_0x96ca('0x122'),{'UserId':Number(_0x157629['query'][_0x96ca('0x6e')][_0x3cc74b]),'ChatWebsiteId':Number(_0x157629[_0x96ca('0x59')]['id'])});}}else{socket[_0x96ca('0x11f')](_0x96ca('0x122'),{'UserId':Number(_0x157629[_0x96ca('0x46')][_0x96ca('0x6e')]),'ChatWebsiteId':Number(_0x157629[_0x96ca('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x48cf7f,null))[_0x96ca('0x2d')](handleError(_0x48cf7f,null));};exports[_0x96ca('0x123')]=function(_0x5355d2,_0x1cd77,_0x2a0c0c){var _0x4c0a54={};var _0x5b594f={};var _0x2abf6b;var _0x55b047;return db['ChatWebsite'][_0x96ca('0x6a')]({'where':{'id':_0x5355d2[_0x96ca('0x59')]['id']}})[_0x96ca('0x23')](handleEntityNotFound(_0x1cd77,null))[_0x96ca('0x23')](function(_0x3abb1d){if(_0x3abb1d){_0x2abf6b=_0x3abb1d;_0x5b594f[_0x96ca('0x45')]=_[_0x96ca('0x47')](db[_0x96ca('0xcb')][_0x96ca('0x41')]);_0x5b594f[_0x96ca('0x46')]=_['keys'](_0x5355d2[_0x96ca('0x46')]);_0x5b594f[_0x96ca('0x48')]=_[_0x96ca('0x49')](_0x5b594f['model'],_0x5b594f[_0x96ca('0x46')]);_0x4c0a54[_0x96ca('0x4a')]=_[_0x96ca('0x49')](_0x5b594f['model'],qs[_0x96ca('0x4b')](_0x5355d2[_0x96ca('0x46')]['fields']));_0x4c0a54[_0x96ca('0x4a')]=_0x4c0a54[_0x96ca('0x4a')][_0x96ca('0x5a')]?_0x4c0a54[_0x96ca('0x4a')]:_0x5b594f['model'];_0x4c0a54[_0x96ca('0x4e')]=qs[_0x96ca('0x4f')](_0x5355d2[_0x96ca('0x46')]['sort']);_0x4c0a54[_0x96ca('0x50')]=qs[_0x96ca('0x48')](_[_0x96ca('0x6b')](_0x5355d2[_0x96ca('0x46')],_0x5b594f[_0x96ca('0x48')]));if(_0x5355d2[_0x96ca('0x46')][_0x96ca('0x51')]){_0x4c0a54['where']=_['merge'](_0x4c0a54[_0x96ca('0x50')],{'$or':_[_0x96ca('0x40')](_0x4c0a54[_0x96ca('0x4a')],function(_0x1d0e47){var _0x6cb5a={};_0x6cb5a[_0x1d0e47]={'$like':'%'+_0x5355d2[_0x96ca('0x46')][_0x96ca('0x51')]+'%'};return _0x6cb5a;})});}_0x4c0a54=_[_0x96ca('0x52')]({},_0x4c0a54,_0x5355d2[_0x96ca('0x54')]);return _0x2abf6b[_0x96ca('0x123')](_0x4c0a54);}})[_0x96ca('0x23')](function(_0x399148){if(_0x399148){_0x55b047=_0x399148[_0x96ca('0x5a')];if(!_0x5355d2['query'][_0x96ca('0x4c')]('nolimit')){_0x4c0a54[_0x96ca('0x34')]=qs[_0x96ca('0x34')](_0x5355d2[_0x96ca('0x46')][_0x96ca('0x34')]);_0x4c0a54[_0x96ca('0x33')]=qs[_0x96ca('0x33')](_0x5355d2[_0x96ca('0x46')][_0x96ca('0x33')]);}return _0x2abf6b['getAgents'](_0x4c0a54);}})['then'](function(_0x155409){if(_0x155409){return _0x155409?{'count':_0x55b047,'rows':_0x155409}:null;}})[_0x96ca('0x23')](respondWithResult(_0x1cd77,null))[_0x96ca('0x2d')](handleError(_0x1cd77,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 4247ec2..2fd96ae 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 _0x0d6a=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x286eb4,_0x5eecb2){var _0x22b5d8=function(_0xe264c4){while(--_0xe264c4){_0x286eb4['push'](_0x286eb4['shift']());}};_0x22b5d8(++_0x5eecb2);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x0d6a[_0x87b0ff];return _0x3bc0b2;};'use strict';var EventEmitter=require(_0xa0d6('0x0'));var ChatWebsite=require(_0xa0d6('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa0d6('0x2')](0x0);var events={'afterCreate':_0xa0d6('0x3'),'afterUpdate':_0xa0d6('0x4'),'afterDestroy':_0xa0d6('0x5')};function emitEvent(_0x71d654){return function(_0x236047,_0x344b8d,_0x3454b6){ChatWebsiteEvents[_0xa0d6('0x6')](_0x71d654+':'+_0x236047['id'],_0x236047);ChatWebsiteEvents[_0xa0d6('0x6')](_0x71d654,_0x236047);_0x3454b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xa0d6('0x7')](e,emitEvent(event));}}module[_0xa0d6('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3148=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x284258,_0x41159b){var _0x1231fc=function(_0x13683d){while(--_0x13683d){_0x284258['push'](_0x284258['shift']());}};_0x1231fc(++_0x41159b);}(_0x3148,0x1d3));var _0x8314=function(_0x23a216,_0x58097f){_0x23a216=_0x23a216-0x0;var _0x4d0c86=_0x3148[_0x23a216];return _0x4d0c86;};'use strict';var EventEmitter=require(_0x8314('0x0'));var ChatWebsite=require(_0x8314('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8314('0x2')](0x0);var events={'afterCreate':_0x8314('0x3'),'afterUpdate':_0x8314('0x4'),'afterDestroy':_0x8314('0x5')};function emitEvent(_0x58f818){return function(_0x35ee55,_0x41e9fd,_0x62c506){ChatWebsiteEvents[_0x8314('0x6')](_0x58f818+':'+_0x35ee55['id'],_0x35ee55);ChatWebsiteEvents[_0x8314('0x6')](_0x58f818,_0x35ee55);_0x62c506(null);};}for(var e in events){if(events[_0x8314('0x7')](e)){var event=events[e];ChatWebsite[_0x8314('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1e6ddd2..723acbb 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 _0xe3ed=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','lodash','util','../../config/logger'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0xe3ed,0x8d));var _0xde3e=function(_0x275d2a,_0x1829b3){_0x275d2a=_0x275d2a-0x0;var _0x51fa6e=_0xe3ed[_0x275d2a];return _0x51fa6e;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var logger=require(_0xde3e('0x2'))(_0xde3e('0x3'));var moment=require(_0xde3e('0x4'));var BPromise=require(_0xde3e('0x5'));var rp=require(_0xde3e('0x6'));var fs=require('fs');var path=require(_0xde3e('0x7'));var rimraf=require('rimraf');var config=require(_0xde3e('0x8'));var attributes=require(_0xde3e('0x9'));module['exports']=function(_0x3405cc,_0x5e9013){return _0x3405cc[_0xde3e('0xa')](_0xde3e('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed8a=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','ChatWebsite','chat_websites','lodash'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0xed8a,0xc5));var _0xaed8=function(_0x4001ce,_0x4d97be){_0x4001ce=_0x4001ce-0x0;var _0x37c881=_0xed8a[_0x4001ce];return _0x37c881;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var logger=require(_0xaed8('0x2'))(_0xaed8('0x3'));var moment=require('moment');var BPromise=require(_0xaed8('0x4'));var rp=require(_0xaed8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaed8('0x6'));var config=require(_0xaed8('0x7'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x347ca1,_0x7e6c5e){return _0x347ca1[_0xaed8('0x8')](_0xaed8('0x9'),attributes,{'tableName':_0xaed8('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 bd24862..d5ced45 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 _0xda2d=['error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2a6f7d,_0x350dbd){var _0x40f067=function(_0x1b521c){while(--_0x1b521c){_0x2a6f7d['push'](_0x2a6f7d['shift']());}};_0x40f067(++_0x350dbd);}(_0xda2d,0x102));var _0xdda2=function(_0x43c36f,_0x4b2584){_0x43c36f=_0x43c36f-0x0;var _0x36b325=_0xda2d[_0x43c36f];return _0x36b325;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});} \ No newline at end of file +var _0x2542=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x16410d,_0x2509e0){var _0x23fa1c=function(_0x3126f9){while(--_0x3126f9){_0x16410d['push'](_0x16410d['shift']());}};_0x23fa1c(++_0x2509e0);}(_0x2542,0x169));var _0x2254=function(_0x3e3164,_0x86fa76){_0x3e3164=_0x3e3164-0x0;var _0x198e7f=_0x2542[_0x3e3164];return _0x198e7f;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});config[_0x2254('0xb')]=_[_0x2254('0xc')](config[_0x2254('0xb')],{'host':_0x2254('0xd'),'port':0x18eb});var socket=require(_0x2254('0xe'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xf'))[_0x2254('0x10')](socket);function respondWithRpcPromise(_0x1ae415,_0x38fb2b,_0x5b1ab9){return new BPromise(function(_0x336e14,_0x2655ea){return client[_0x2254('0x11')](_0x1ae415,_0x5b1ab9)[_0x2254('0x12')](function(_0x575d58){logger['info'](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));logger[_0x2254('0x15')](_0x2254('0x16'),_0x38fb2b,_0x2254('0x14'),JSON[_0x2254('0x17')](_0x575d58));if(_0x575d58['error']){if(_0x575d58[_0x2254('0x18')][_0x2254('0x19')]===0x1f4){logger['error'](_0x2254('0x13'),_0x38fb2b,_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);return _0x2655ea(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}logger[_0x2254('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x38fb2b,_0x575d58[_0x2254('0x18')]['message']);return _0x336e14(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}else{logger[_0x2254('0x1b')](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));_0x336e14(_0x575d58[_0x2254('0x1c')]['message']);}})['catch'](function(_0x5ec98d){logger[_0x2254('0x18')](_0x2254('0x13'),_0x38fb2b,_0x5ec98d);_0x2655ea(_0x5ec98d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6ae3e8d..17d5631 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(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ed4e5,_0x1fe79f){_0x4ed4e5=_0x4ed4e5-0x0;var _0x3fdaea=_0x5f2f[_0x4ed4e5];return _0x3fdaea;};'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(_0x1a151a,_0x44325f){var _0x3ce862=function(_0x10aeed){while(--_0x10aeed){_0x1a151a['push'](_0x1a151a['shift']());}};_0x3ce862(++_0x44325f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x564f4c,_0x49da12){_0x564f4c=_0x564f4c-0x0;var _0x3b2d04=_0x5f2f[_0x564f4c];return _0x3b2d04;};'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 9872673..dd8a326 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 _0xa2f0=['/:id/users','addAgents','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','server/files/images/avatars/','format','addAvatar','now','addCustomerAvatar','/:id/notify','offline','addInteraction','addApplications','addProactiveActions'];(function(_0x2a30e4,_0x5dc2b9){var _0x15e52d=function(_0x45e617){while(--_0x45e617){_0x2a30e4['push'](_0x2a30e4['shift']());}};_0x15e52d(++_0x5dc2b9);}(_0xa2f0,0x82));var _0x0a2f=function(_0x399fd7,_0x212098){_0x399fd7=_0x399fd7-0x0;var _0x57f548=_0xa2f0[_0x399fd7];return _0x57f548;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a2f('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0a2f('0x1'));var interaction=require(_0x0a2f('0x2'));var config=require(_0x0a2f('0x3'));var controller=require(_0x0a2f('0x4'));router['get']('/',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x6')]);router[_0x0a2f('0x7')](_0x0a2f('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0a2f('0x9'),auth['isAuthenticated'](),controller[_0x0a2f('0xa')]);router['get'](_0x0a2f('0xb'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0xc')]);router[_0x0a2f('0x7')](_0x0a2f('0xd'),auth['isAuthenticated'](),controller[_0x0a2f('0xe')]);router[_0x0a2f('0x7')](_0x0a2f('0xf'),controller['getLogo']);router[_0x0a2f('0x7')](_0x0a2f('0x10'),controller['getAvatar']);router[_0x0a2f('0x7')](_0x0a2f('0x11'),controller[_0x0a2f('0x12')]);router[_0x0a2f('0x7')](_0x0a2f('0x13'),controller[_0x0a2f('0x14')]);router[_0x0a2f('0x7')](_0x0a2f('0x15'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x16')]);router[_0x0a2f('0x7')](_0x0a2f('0x17'),controller[_0x0a2f('0x18')]);router[_0x0a2f('0x7')](_0x0a2f('0x19'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x1a')]);router['get'](_0x0a2f('0x1b'),auth['isAuthenticated'](),controller[_0x0a2f('0x1c')]);router[_0x0a2f('0x7')]('/:id/fields',controller[_0x0a2f('0x1d')]);router[_0x0a2f('0x7')](_0x0a2f('0x1e'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x0a2f('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x0a2f('0x5')](),controller['create']);router[_0x0a2f('0x1f')]('/:id/dispositions',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x20')]);router[_0x0a2f('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0a2f('0x21')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0x6001d2,_0x5d33db,_0x291515){_0x291515(null,path[_0x0a2f('0x23')](config[_0x0a2f('0x24')],_0x0a2f('0x25')));},'filename':function(_0x789509,_0x2581b1,_0xf19694){_0xf19694(null,util['format'](_0x0a2f('0x26'),Date['now'](),_0x2581b1[_0x0a2f('0x27')]));}})});router[_0x0a2f('0x1f')](_0x0a2f('0xf'),upload[_0x0a2f('0x28')](_0x0a2f('0x29')),controller[_0x0a2f('0x2a')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0xad0919,_0x17ad6a,_0x25e3d0){_0x25e3d0(null,path[_0x0a2f('0x23')](config[_0x0a2f('0x24')],_0x0a2f('0x2b')));},'filename':function(_0x35f26d,_0x3979f3,_0x42fcf5){_0x42fcf5(null,util[_0x0a2f('0x2c')](_0x0a2f('0x26'),Date['now'](),_0x3979f3[_0x0a2f('0x27')]));}})});router[_0x0a2f('0x1f')](_0x0a2f('0x10'),upload['single'](_0x0a2f('0x29')),controller[_0x0a2f('0x2d')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0x3d64b3,_0x562e0e,_0x3883a8){_0x3883a8(null,path[_0x0a2f('0x23')](config[_0x0a2f('0x24')],_0x0a2f('0x2b')));},'filename':function(_0x200c12,_0x3a5e97,_0x576818){_0x576818(null,util[_0x0a2f('0x2c')](_0x0a2f('0x26'),Date[_0x0a2f('0x2e')](),_0x3a5e97[_0x0a2f('0x27')]));}})});router[_0x0a2f('0x1f')](_0x0a2f('0x11'),upload[_0x0a2f('0x28')](_0x0a2f('0x29')),controller[_0x0a2f('0x2f')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0x1eda7e,_0x279290,_0x515b67){_0x515b67(null,path[_0x0a2f('0x23')](config['root'],_0x0a2f('0x2b')));},'filename':function(_0x20be0e,_0x52e3d1,_0x2d7662){_0x2d7662(null,util[_0x0a2f('0x2c')]('%s-%s',Date['now'](),_0x52e3d1['originalname']));}})});router['post']('/:id/system_avatar',upload[_0x0a2f('0x28')]('file'),controller['addSystemAvatar']);router['post'](_0x0a2f('0x30'),controller['notify']);router['post']('/:id/offline',controller[_0x0a2f('0x31')]);router[_0x0a2f('0x1f')](_0x0a2f('0x15'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x32')]);router['post']('/:id/applications',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x33')]);router[_0x0a2f('0x1f')](_0x0a2f('0x1b'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x34')]);router['post'](_0x0a2f('0x35'),auth['isAuthenticated'](),controller[_0x0a2f('0x36')]);router['put'](_0x0a2f('0x9'),auth[_0x0a2f('0x5')](),controller['update']);router['delete'](_0x0a2f('0x9'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x37')]);router[_0x0a2f('0x38')](_0x0a2f('0xb'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x39')]);router[_0x0a2f('0x38')]('/:id/canned_answers',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x3a')]);router[_0x0a2f('0x38')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a2f('0x3b')]);module[_0x0a2f('0x3c')]=router; \ No newline at end of file +var _0xd61e=['destroy','removeAnswers','/:id/users','removeAgents','util','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','diskStorage','join','server/files/images/logos/','format','now','/:id/logo','single','file','addLogo','root','server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','originalname','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addAgents','put','update','delete'];(function(_0x4c5180,_0x179861){var _0x328f40=function(_0x43157c){while(--_0x43157c){_0x4c5180['push'](_0x4c5180['shift']());}};_0x328f40(++_0x179861);}(_0xd61e,0x1a1));var _0xed61=function(_0x21895c,_0x75b67d){_0x21895c=_0x21895c-0x0;var _0x25004a=_0xd61e[_0x21895c];return _0x25004a;};'use strict';var multer=require('multer');var util=require(_0xed61('0x0'));var path=require('path');var timeout=require(_0xed61('0x1'));var express=require(_0xed61('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed61('0x3'));var controller=require('./chatWebsite.controller');router[_0xed61('0x4')]('/',auth[_0xed61('0x5')](),controller[_0xed61('0x6')]);router[_0xed61('0x4')](_0xed61('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xed61('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xed61('0x8')]);router[_0xed61('0x4')](_0xed61('0x9'),auth[_0xed61('0x5')](),controller[_0xed61('0xa')]);router[_0xed61('0x4')](_0xed61('0xb'),auth['isAuthenticated'](),controller[_0xed61('0xc')]);router[_0xed61('0x4')]('/:id/logo',controller[_0xed61('0xd')]);router[_0xed61('0x4')]('/:id/avatar',controller[_0xed61('0xe')]);router[_0xed61('0x4')](_0xed61('0xf'),controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller['getSystemAvatar']);router['get'](_0xed61('0x10'),auth[_0xed61('0x5')](),controller[_0xed61('0x11')]);router[_0xed61('0x4')](_0xed61('0x12'),controller[_0xed61('0x13')]);router['get'](_0xed61('0x14'),auth[_0xed61('0x5')](),controller['getApplications']);router[_0xed61('0x4')](_0xed61('0x15'),auth[_0xed61('0x5')](),controller['getProactiveActions']);router[_0xed61('0x4')](_0xed61('0x16'),controller[_0xed61('0x17')]);router[_0xed61('0x4')](_0xed61('0x18'),auth[_0xed61('0x5')](),controller[_0xed61('0x19')]);router[_0xed61('0x4')]('/:id/users',auth[_0xed61('0x5')](),controller[_0xed61('0x1a')]);router[_0xed61('0x1b')]('/',auth['isAuthenticated'](),controller[_0xed61('0x1c')]);router['post'](_0xed61('0x9'),auth[_0xed61('0x5')](),controller['addDisposition']);router[_0xed61('0x1b')](_0xed61('0xb'),auth[_0xed61('0x5')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xed61('0x1d')]({'destination':function(_0x4b93f4,_0x760dca,_0x38b833){_0x38b833(null,path[_0xed61('0x1e')](config['root'],_0xed61('0x1f')));},'filename':function(_0x542419,_0x144c8d,_0x10c080){_0x10c080(null,util[_0xed61('0x20')]('%s-%s',Date[_0xed61('0x21')](),_0x144c8d['originalname']));}})});router['post'](_0xed61('0x22'),upload[_0xed61('0x23')](_0xed61('0x24')),controller[_0xed61('0x25')]);var upload=multer({'storage':multer[_0xed61('0x1d')]({'destination':function(_0x48f551,_0x31dc64,_0x2ed0b8){_0x2ed0b8(null,path[_0xed61('0x1e')](config[_0xed61('0x26')],_0xed61('0x27')));},'filename':function(_0x1b9260,_0x32f518,_0x4e003e){_0x4e003e(null,util[_0xed61('0x20')](_0xed61('0x28'),Date[_0xed61('0x21')](),_0x32f518['originalname']));}})});router['post'](_0xed61('0x29'),upload[_0xed61('0x23')](_0xed61('0x24')),controller[_0xed61('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x417a04,_0xc8b6e7,_0x412635){_0x412635(null,path[_0xed61('0x1e')](config[_0xed61('0x26')],_0xed61('0x27')));},'filename':function(_0x494ad0,_0x215665,_0x2510d4){_0x2510d4(null,util[_0xed61('0x20')](_0xed61('0x28'),Date[_0xed61('0x21')](),_0x215665[_0xed61('0x2b')]));}})});router[_0xed61('0x1b')](_0xed61('0xf'),upload[_0xed61('0x23')](_0xed61('0x24')),controller[_0xed61('0x2c')]);var upload=multer({'storage':multer[_0xed61('0x1d')]({'destination':function(_0x224d83,_0xfee75e,_0x8c80d0){_0x8c80d0(null,path['join'](config[_0xed61('0x26')],_0xed61('0x27')));},'filename':function(_0x3432f2,_0x4c18db,_0x3b9a61){_0x3b9a61(null,util[_0xed61('0x20')](_0xed61('0x28'),Date[_0xed61('0x21')](),_0x4c18db['originalname']));}})});router[_0xed61('0x1b')](_0xed61('0x2d'),upload[_0xed61('0x23')](_0xed61('0x24')),controller[_0xed61('0x2e')]);router[_0xed61('0x1b')](_0xed61('0x2f'),controller[_0xed61('0x30')]);router['post'](_0xed61('0x31'),controller[_0xed61('0x32')]);router[_0xed61('0x1b')](_0xed61('0x10'),auth[_0xed61('0x5')](),controller['addInteraction']);router[_0xed61('0x1b')](_0xed61('0x14'),auth[_0xed61('0x5')](),controller['addApplications']);router[_0xed61('0x1b')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xed61('0x1b')]('/:id/users',auth[_0xed61('0x5')](),controller[_0xed61('0x33')]);router[_0xed61('0x34')]('/:id',auth[_0xed61('0x5')](),controller[_0xed61('0x35')]);router[_0xed61('0x36')]('/:id',auth['isAuthenticated'](),controller[_0xed61('0x37')]);router[_0xed61('0x36')](_0xed61('0x9'),auth[_0xed61('0x5')](),controller['removeDispositions']);router[_0xed61('0x36')](_0xed61('0xb'),auth[_0xed61('0x5')](),controller[_0xed61('0x38')]);router[_0xed61('0x36')](_0xed61('0x39'),auth[_0xed61('0x5')](),controller[_0xed61('0x3a')]);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 0f5182e..b00bbbf 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 _0x90b5=['ENUM','AmazonAWS','Google','sequelize','STRING'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x90b5,0x139));var _0x590b=function(_0x17d89a,_0x483545){_0x17d89a=_0x17d89a-0x0;var _0x3ba40b=_0x90b5[_0x17d89a];return _0x3ba40b;};'use strict';var Sequelize=require(_0x590b('0x0'));module['exports']={'name':{'type':Sequelize[_0x590b('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x590b('0x2')](_0x590b('0x3'),_0x590b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe626=['ENUM','Google','sequelize','exports','STRING'];(function(_0x31c908,_0x36dc32){var _0x5bb4b1=function(_0x1b42a5){while(--_0x1b42a5){_0x31c908['push'](_0x31c908['shift']());}};_0x5bb4b1(++_0x36dc32);}(_0xe626,0x9d));var _0x6e62=function(_0x4f268f,_0x13275d){_0x4f268f=_0x4f268f-0x0;var _0x3d9fa9=_0xe626[_0x4f268f];return _0x3d9fa9;};'use strict';var Sequelize=require(_0x6e62('0x0'));module[_0x6e62('0x1')]={'name':{'type':Sequelize[_0x6e62('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6e62('0x3')]('AmazonAWS',_0x6e62('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x6e62('0x2')]},'data2':{'type':Sequelize[_0x6e62('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e457beb..3a8c5b0 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 _0x71a3=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','error','name','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','params','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71a3,0x150));var _0x371a=function(_0x2e4bbc,_0x3b0036){_0x2e4bbc=_0x2e4bbc-0x0;var _0x517b41=_0x71a3[_0x2e4bbc];return _0x517b41;};'use strict';var pdf=require(_0x371a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x371a('0x1'));var zipdir=require(_0x371a('0x2'));var jsonpatch=require(_0x371a('0x3'));var rp=require(_0x371a('0x4'));var moment=require(_0x371a('0x5'));var BPromise=require(_0x371a('0x6'));var Mustache=require(_0x371a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x371a('0x8'));var csv=require('to-csv');var ejs=require(_0x371a('0x9'));var fs=require('fs');var _=require(_0x371a('0xa'));var squel=require(_0x371a('0xb'));var crypto=require(_0x371a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x371a('0xd'));var querystring=require(_0x371a('0xe'));var Papa=require(_0x371a('0xf'));var Redis=require(_0x371a('0x10'));var authService=require(_0x371a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x371a('0x12'));var hardwareService=require(_0x371a('0x13'));var logger=require('../../config/logger')(_0x371a('0x14'));var utils=require('../../config/utils');var config=require(_0x371a('0x15'));var db=require(_0x371a('0x16'))['db'];function respondWithStatusCode(_0xac2808,_0x2d1b34){_0x2d1b34=_0x2d1b34||0xcc;return function(_0xc8789e){if(_0xc8789e){return _0xac2808[_0x371a('0x17')](_0x2d1b34);}return _0xac2808[_0x371a('0x18')](_0x2d1b34)[_0x371a('0x19')]();};}function respondWithResult(_0x8db71a,_0x8e0bf0){_0x8e0bf0=_0x8e0bf0||0xc8;return function(_0x376e86){if(_0x376e86){return _0x8db71a[_0x371a('0x18')](_0x8e0bf0)[_0x371a('0x1a')](_0x376e86);}};}function respondWithFilteredResult(_0x2f6930,_0x2f3943){return function(_0x56f40c){if(_0x56f40c){var _0x48e373=_0x56f40c[_0x371a('0x1b')],_0x327fcc=_0x2f3943[_0x371a('0x1c')],_0x2e5293=_0x2f3943[_0x371a('0x1c')]+_0x2f3943[_0x371a('0x1d')],_0xed16c7;if(_0x2e5293>=_0x48e373){_0x2e5293=_0x48e373;_0xed16c7=0xc8;}else{_0xed16c7=0xce;}_0x2f6930['status'](_0xed16c7);return _0x2f6930[_0x371a('0x1e')](_0x371a('0x1f'),_0x327fcc+'-'+_0x2e5293+'/'+_0x48e373)[_0x371a('0x1a')](_0x56f40c);}return null;};}function patchUpdates(_0x46798c){return function(_0x3bb1cc){try{jsonpatch['apply'](_0x3bb1cc,_0x46798c,!![]);}catch(_0x1392b6){return BPromise['reject'](_0x1392b6);}return _0x3bb1cc['save']();};}function saveUpdates(_0x4b0605,_0x214df6){return function(_0x2d625c){if(_0x2d625c){return _0x2d625c[_0x371a('0x20')](_0x4b0605)[_0x371a('0x21')](function(_0x33ee9f){return _0x33ee9f;});}return null;};}function removeEntity(_0x257707,_0xaf126c){return function(_0x554906){if(_0x554906){return _0x554906[_0x371a('0x22')]()['then'](function(){_0x257707['status'](0xcc)[_0x371a('0x19')]();});}};}function handleEntityNotFound(_0x3013fe,_0x23ee17){return function(_0x480e54){if(!_0x480e54){_0x3013fe[_0x371a('0x17')](0x194);}return _0x480e54;};}function handleError(_0x355203,_0x42880a){_0x42880a=_0x42880a||0x1f4;return function(_0x430cf1){logger[_0x371a('0x23')](_0x430cf1['stack']);if(_0x430cf1['name']){delete _0x430cf1[_0x371a('0x24')];}_0x355203[_0x371a('0x18')](_0x42880a)['send'](_0x430cf1);};}exports[_0x371a('0x25')]=function(_0xc55827,_0x32aca1){var _0x32216b={},_0x4b0d3a={},_0x351d3c={'count':0x0,'rows':[]};var _0x178d74=_[_0x371a('0x26')](db[_0x371a('0x27')]['rawAttributes'],function(_0x138b49){return{'name':_0x138b49[_0x371a('0x28')],'type':_0x138b49[_0x371a('0x29')][_0x371a('0x2a')]};});_0x4b0d3a[_0x371a('0x2b')]=_['map'](_0x178d74,_0x371a('0x24'));_0x4b0d3a[_0x371a('0x2c')]=_[_0x371a('0x2d')](_0xc55827[_0x371a('0x2c')]);_0x4b0d3a[_0x371a('0x2e')]=_['intersection'](_0x4b0d3a[_0x371a('0x2b')],_0x4b0d3a[_0x371a('0x2c')]);_0x32216b['attributes']=_[_0x371a('0x2f')](_0x4b0d3a[_0x371a('0x2b')],qs['fields'](_0xc55827[_0x371a('0x2c')][_0x371a('0x30')]));_0x32216b[_0x371a('0x31')]=_0x32216b['attributes']['length']?_0x32216b['attributes']:_0x4b0d3a['model'];if(!_0xc55827[_0x371a('0x2c')][_0x371a('0x32')](_0x371a('0x33'))){_0x32216b[_0x371a('0x1d')]=qs[_0x371a('0x1d')](_0xc55827[_0x371a('0x2c')][_0x371a('0x1d')]);_0x32216b['offset']=qs[_0x371a('0x1c')](_0xc55827[_0x371a('0x2c')][_0x371a('0x1c')]);}_0x32216b[_0x371a('0x34')]=qs[_0x371a('0x35')](_0xc55827[_0x371a('0x2c')][_0x371a('0x35')]);_0x32216b[_0x371a('0x36')]=qs[_0x371a('0x2e')](_[_0x371a('0x37')](_0xc55827['query'],_0x4b0d3a[_0x371a('0x2e')]),_0x178d74);if(_0xc55827[_0x371a('0x2c')][_0x371a('0x38')]){_0x32216b[_0x371a('0x36')]=_[_0x371a('0x39')](_0x32216b[_0x371a('0x36')],{'$or':_['map'](_0x178d74,function(_0x2e6bff){if(_0x2e6bff[_0x371a('0x29')]!==_0x371a('0x3a')){var _0x444d03={};_0x444d03[_0x2e6bff[_0x371a('0x24')]]={'$like':'%'+_0xc55827['query'][_0x371a('0x38')]+'%'};return _0x444d03;}})});}_0x32216b=_[_0x371a('0x39')]({},_0x32216b,_0xc55827[_0x371a('0x3b')]);var _0x5bd738={'where':_0x32216b['where']};return db[_0x371a('0x27')]['count'](_0x5bd738)[_0x371a('0x21')](function(_0x1c001d){_0x351d3c[_0x371a('0x1b')]=_0x1c001d;if(_0xc55827['query'][_0x371a('0x3c')]){_0x32216b[_0x371a('0x3d')]=[{'all':!![]}];}return db[_0x371a('0x27')][_0x371a('0x3e')](_0x32216b);})[_0x371a('0x21')](function(_0x272db7){_0x351d3c[_0x371a('0x3f')]=_0x272db7;return _0x351d3c;})[_0x371a('0x21')](respondWithFilteredResult(_0x32aca1,_0x32216b))[_0x371a('0x40')](handleError(_0x32aca1,null));};exports['show']=function(_0x50f63c,_0x52feeb){var _0x82faaa={'raw':!![],'where':{'id':_0x50f63c['params']['id']}},_0x4b690d={};_0x4b690d[_0x371a('0x2b')]=_[_0x371a('0x2d')](db[_0x371a('0x27')][_0x371a('0x41')]);_0x4b690d[_0x371a('0x2c')]=_[_0x371a('0x2d')](_0x50f63c[_0x371a('0x2c')]);_0x4b690d[_0x371a('0x2e')]=_[_0x371a('0x2f')](_0x4b690d[_0x371a('0x2b')],_0x4b690d[_0x371a('0x2c')]);_0x82faaa[_0x371a('0x31')]=_[_0x371a('0x2f')](_0x4b690d['model'],qs[_0x371a('0x30')](_0x50f63c['query'][_0x371a('0x30')]));_0x82faaa[_0x371a('0x31')]=_0x82faaa[_0x371a('0x31')]['length']?_0x82faaa[_0x371a('0x31')]:_0x4b690d[_0x371a('0x2b')];if(_0x50f63c[_0x371a('0x2c')][_0x371a('0x3c')]){_0x82faaa['include']=[{'all':!![]}];}_0x82faaa=_[_0x371a('0x39')]({},_0x82faaa,_0x50f63c['options']);return db[_0x371a('0x27')]['find'](_0x82faaa)['then'](handleEntityNotFound(_0x52feeb,null))['then'](respondWithResult(_0x52feeb,null))[_0x371a('0x40')](handleError(_0x52feeb,null));};exports['create']=function(_0x2ce2f3,_0x1abfdc){return db[_0x371a('0x27')][_0x371a('0x42')](_0x2ce2f3['body'],{})['then'](respondWithResult(_0x1abfdc,0xc9))[_0x371a('0x40')](handleError(_0x1abfdc,null));};exports[_0x371a('0x20')]=function(_0x215a8b,_0x30b810){if(_0x215a8b[_0x371a('0x43')]['id']){delete _0x215a8b[_0x371a('0x43')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x215a8b[_0x371a('0x44')]['id']}})[_0x371a('0x21')](handleEntityNotFound(_0x30b810,null))[_0x371a('0x21')](saveUpdates(_0x215a8b[_0x371a('0x43')],null))[_0x371a('0x21')](respondWithResult(_0x30b810,null))[_0x371a('0x40')](handleError(_0x30b810,null));};exports['destroy']=function(_0x19e1ec,_0x3dcc31){return db['CloudProvider'][_0x371a('0x45')]({'where':{'id':_0x19e1ec[_0x371a('0x44')]['id']}})[_0x371a('0x21')](handleEntityNotFound(_0x3dcc31,null))['then'](removeEntity(_0x3dcc31,null))[_0x371a('0x40')](handleError(_0x3dcc31,null));}; \ No newline at end of file +var _0x53e9=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','index','map','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CloudProvider','findAll','rows','catch','show','params','keys','length','find','create','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x53e9,0x101));var _0x953e=function(_0x4ee5a3,_0x2a7bc6){_0x4ee5a3=_0x4ee5a3-0x0;var _0x3e1b6e=_0x53e9[_0x4ee5a3];return _0x3e1b6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x953e('0x0'));var rimraf=require(_0x953e('0x1'));var zipdir=require(_0x953e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x953e('0x3'));var BPromise=require(_0x953e('0x4'));var Mustache=require(_0x953e('0x5'));var util=require(_0x953e('0x6'));var path=require(_0x953e('0x7'));var sox=require(_0x953e('0x8'));var csv=require(_0x953e('0x9'));var ejs=require(_0x953e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x953e('0xb'));var crypto=require('crypto');var jsforce=require(_0x953e('0xc'));var deskjs=require(_0x953e('0xd'));var toCsv=require(_0x953e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x953e('0xe'));var qs=require(_0x953e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x953e('0x10'));var logger=require(_0x953e('0x11'))('api');var utils=require(_0x953e('0x12'));var config=require(_0x953e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b8b66,_0x4ca3d3){_0x4ca3d3=_0x4ca3d3||0xcc;return function(_0x45790f){if(_0x45790f){return _0x4b8b66[_0x953e('0x14')](_0x4ca3d3);}return _0x4b8b66[_0x953e('0x15')](_0x4ca3d3)[_0x953e('0x16')]();};}function respondWithResult(_0x33cf9d,_0x2da24d){_0x2da24d=_0x2da24d||0xc8;return function(_0x122a93){if(_0x122a93){return _0x33cf9d['status'](_0x2da24d)[_0x953e('0x17')](_0x122a93);}};}function respondWithFilteredResult(_0x5ab7ff,_0x138448){return function(_0x1e6d89){if(_0x1e6d89){var _0x26da69=_0x1e6d89[_0x953e('0x18')],_0x43a3bf=_0x138448[_0x953e('0x19')],_0x3c2b78=_0x138448[_0x953e('0x19')]+_0x138448['limit'],_0x381b2d;if(_0x3c2b78>=_0x26da69){_0x3c2b78=_0x26da69;_0x381b2d=0xc8;}else{_0x381b2d=0xce;}_0x5ab7ff[_0x953e('0x15')](_0x381b2d);return _0x5ab7ff[_0x953e('0x1a')](_0x953e('0x1b'),_0x43a3bf+'-'+_0x3c2b78+'/'+_0x26da69)[_0x953e('0x17')](_0x1e6d89);}return null;};}function patchUpdates(_0x43f4bc){return function(_0x428ca5){try{jsonpatch[_0x953e('0x1c')](_0x428ca5,_0x43f4bc,!![]);}catch(_0x437f19){return BPromise[_0x953e('0x1d')](_0x437f19);}return _0x428ca5[_0x953e('0x1e')]();};}function saveUpdates(_0x5a8c47,_0x62bd35){return function(_0x260c96){if(_0x260c96){return _0x260c96['update'](_0x5a8c47)[_0x953e('0x1f')](function(_0x599825){return _0x599825;});}return null;};}function removeEntity(_0x4a6db6,_0x55c8c1){return function(_0x528755){if(_0x528755){return _0x528755[_0x953e('0x20')]()['then'](function(){_0x4a6db6[_0x953e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x128ead,_0x2e02bb){return function(_0x219b91){if(!_0x219b91){_0x128ead['sendStatus'](0x194);}return _0x219b91;};}function handleError(_0x11752f,_0x2232cc){_0x2232cc=_0x2232cc||0x1f4;return function(_0x3f1ca3){logger['error'](_0x3f1ca3['stack']);if(_0x3f1ca3['name']){delete _0x3f1ca3['name'];}_0x11752f[_0x953e('0x15')](_0x2232cc)['send'](_0x3f1ca3);};}exports[_0x953e('0x21')]=function(_0x269a40,_0x110fa7){var _0x40747b={},_0x866ce3={},_0x5350b3={'count':0x0,'rows':[]};var _0x2d083d=_[_0x953e('0x22')](db['CloudProvider'][_0x953e('0x23')],function(_0x590673){return{'name':_0x590673[_0x953e('0x24')],'type':_0x590673[_0x953e('0x25')]['key']};});_0x866ce3[_0x953e('0x26')]=_[_0x953e('0x22')](_0x2d083d,_0x953e('0x27'));_0x866ce3['query']=_['keys'](_0x269a40[_0x953e('0x28')]);_0x866ce3[_0x953e('0x29')]=_[_0x953e('0x2a')](_0x866ce3[_0x953e('0x26')],_0x866ce3[_0x953e('0x28')]);_0x40747b[_0x953e('0x2b')]=_[_0x953e('0x2a')](_0x866ce3[_0x953e('0x26')],qs['fields'](_0x269a40[_0x953e('0x28')][_0x953e('0x2c')]));_0x40747b[_0x953e('0x2b')]=_0x40747b[_0x953e('0x2b')]['length']?_0x40747b[_0x953e('0x2b')]:_0x866ce3[_0x953e('0x26')];if(!_0x269a40[_0x953e('0x28')][_0x953e('0x2d')]('nolimit')){_0x40747b[_0x953e('0x2e')]=qs[_0x953e('0x2e')](_0x269a40[_0x953e('0x28')][_0x953e('0x2e')]);_0x40747b[_0x953e('0x19')]=qs[_0x953e('0x19')](_0x269a40['query']['offset']);}_0x40747b['order']=qs[_0x953e('0x2f')](_0x269a40['query'][_0x953e('0x2f')]);_0x40747b[_0x953e('0x30')]=qs[_0x953e('0x29')](_[_0x953e('0x31')](_0x269a40[_0x953e('0x28')],_0x866ce3[_0x953e('0x29')]),_0x2d083d);if(_0x269a40['query'][_0x953e('0x32')]){_0x40747b[_0x953e('0x30')]=_[_0x953e('0x33')](_0x40747b[_0x953e('0x30')],{'$or':_[_0x953e('0x22')](_0x2d083d,function(_0xbb4c2b){if(_0xbb4c2b[_0x953e('0x25')]!==_0x953e('0x34')){var _0x497e56={};_0x497e56[_0xbb4c2b['name']]={'$like':'%'+_0x269a40['query']['filter']+'%'};return _0x497e56;}})});}_0x40747b=_['merge']({},_0x40747b,_0x269a40[_0x953e('0x35')]);var _0x495567={'where':_0x40747b['where']};return db['CloudProvider'][_0x953e('0x18')](_0x495567)[_0x953e('0x1f')](function(_0x434743){_0x5350b3[_0x953e('0x18')]=_0x434743;if(_0x269a40[_0x953e('0x28')][_0x953e('0x36')]){_0x40747b[_0x953e('0x37')]=[{'all':!![]}];}return db[_0x953e('0x38')][_0x953e('0x39')](_0x40747b);})[_0x953e('0x1f')](function(_0x3595f7){_0x5350b3[_0x953e('0x3a')]=_0x3595f7;return _0x5350b3;})['then'](respondWithFilteredResult(_0x110fa7,_0x40747b))[_0x953e('0x3b')](handleError(_0x110fa7,null));};exports[_0x953e('0x3c')]=function(_0x2fa7dd,_0x2adb44){var _0xbfafd8={'raw':!![],'where':{'id':_0x2fa7dd[_0x953e('0x3d')]['id']}},_0x1b1c6c={};_0x1b1c6c[_0x953e('0x26')]=_['keys'](db[_0x953e('0x38')][_0x953e('0x23')]);_0x1b1c6c[_0x953e('0x28')]=_[_0x953e('0x3e')](_0x2fa7dd['query']);_0x1b1c6c[_0x953e('0x29')]=_['intersection'](_0x1b1c6c[_0x953e('0x26')],_0x1b1c6c[_0x953e('0x28')]);_0xbfafd8[_0x953e('0x2b')]=_[_0x953e('0x2a')](_0x1b1c6c[_0x953e('0x26')],qs['fields'](_0x2fa7dd['query']['fields']));_0xbfafd8[_0x953e('0x2b')]=_0xbfafd8[_0x953e('0x2b')][_0x953e('0x3f')]?_0xbfafd8[_0x953e('0x2b')]:_0x1b1c6c[_0x953e('0x26')];if(_0x2fa7dd[_0x953e('0x28')][_0x953e('0x36')]){_0xbfafd8[_0x953e('0x37')]=[{'all':!![]}];}_0xbfafd8=_[_0x953e('0x33')]({},_0xbfafd8,_0x2fa7dd[_0x953e('0x35')]);return db['CloudProvider'][_0x953e('0x40')](_0xbfafd8)[_0x953e('0x1f')](handleEntityNotFound(_0x2adb44,null))[_0x953e('0x1f')](respondWithResult(_0x2adb44,null))[_0x953e('0x3b')](handleError(_0x2adb44,null));};exports[_0x953e('0x41')]=function(_0x2d745c,_0xc8c8d){return db[_0x953e('0x38')][_0x953e('0x41')](_0x2d745c['body'],{})[_0x953e('0x1f')](respondWithResult(_0xc8c8d,0xc9))[_0x953e('0x3b')](handleError(_0xc8c8d,null));};exports[_0x953e('0x42')]=function(_0x4e338b,_0x1751a7){if(_0x4e338b['body']['id']){delete _0x4e338b[_0x953e('0x43')]['id'];}return db[_0x953e('0x38')]['find']({'where':{'id':_0x4e338b['params']['id']}})[_0x953e('0x1f')](handleEntityNotFound(_0x1751a7,null))[_0x953e('0x1f')](saveUpdates(_0x4e338b[_0x953e('0x43')],null))[_0x953e('0x1f')](respondWithResult(_0x1751a7,null))['catch'](handleError(_0x1751a7,null));};exports['destroy']=function(_0x3eacda,_0x1180b7){return db[_0x953e('0x38')][_0x953e('0x40')]({'where':{'id':_0x3eacda[_0x953e('0x3d')]['id']}})[_0x953e('0x1f')](handleEntityNotFound(_0x1180b7,null))['then'](removeEntity(_0x1180b7,null))['catch'](handleError(_0x1180b7,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 00a1111..f617753 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 _0x91ab=['util','api','moment','bluebird','path','./cloudProvider.attributes','define','CloudProvider','lodash'];(function(_0x4af21e,_0x5da1e5){var _0xb733a7=function(_0x48bfa6){while(--_0x48bfa6){_0x4af21e['push'](_0x4af21e['shift']());}};_0xb733a7(++_0x5da1e5);}(_0x91ab,0x104));var _0xb91a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x91ab[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xb91a('0x0'));var util=require(_0xb91a('0x1'));var logger=require('../../config/logger')(_0xb91a('0x2'));var moment=require(_0xb91a('0x3'));var BPromise=require(_0xb91a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb91a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb91a('0x6'));module['exports']=function(_0x2c3892,_0xa42f31){return _0x2c3892[_0xb91a('0x7')](_0xb91a('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45ac=['cloud_providers','lodash','util','api','moment','bluebird','request-promise','rimraf','define','CloudProvider'];(function(_0x883fef,_0x3dbf96){var _0x7d9f20=function(_0xb98afe){while(--_0xb98afe){_0x883fef['push'](_0x883fef['shift']());}};_0x7d9f20(++_0x3dbf96);}(_0x45ac,0x10f));var _0xc45a=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x45ac[_0x5ca5bc];return _0x26ca86;};'use strict';var _=require(_0xc45a('0x0'));var util=require(_0xc45a('0x1'));var logger=require('../../config/logger')(_0xc45a('0x2'));var moment=require(_0xc45a('0x3'));var BPromise=require(_0xc45a('0x4'));var rp=require(_0xc45a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc45a('0x6'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x425863,_0x31f79f){return _0x425863[_0xc45a('0x7')](_0xc45a('0x8'),attributes,{'tableName':_0xc45a('0x9'),'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 e6e0026..305410f 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 _0xc91a=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x437167,_0x5070d3){var _0x4400ce=function(_0x2d848c){while(--_0x2d848c){_0x437167['push'](_0x437167['shift']());}};_0x4400ce(++_0x5070d3);}(_0xc91a,0x9a));var _0xac91=function(_0x170194,_0x351d4c){_0x170194=_0x170194-0x0;var _0xe390ea=_0xc91a[_0x170194];return _0xe390ea;};'use strict';var _=require(_0xac91('0x0'));var util=require(_0xac91('0x1'));var moment=require(_0xac91('0x2'));var BPromise=require('bluebird');var rs=require(_0xac91('0x3'));var fs=require('fs');var Redis=require(_0xac91('0x4'));var db=require(_0xac91('0x5'))['db'];var utils=require(_0xac91('0x6'));var logger=require('../../config/logger')(_0xac91('0x7'));var config=require(_0xac91('0x8'));var jayson=require(_0xac91('0x9'));var client=jayson[_0xac91('0xa')][_0xac91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f499,_0x2fad70,_0x4604f1){return new BPromise(function(_0x4a5e33,_0x25f496){return client[_0xac91('0xc')](_0x51f499,_0x4604f1)[_0xac91('0xd')](function(_0x472ee2){logger[_0xac91('0xe')](_0xac91('0xf'),_0x2fad70,_0xac91('0x10'));logger[_0xac91('0x11')](_0xac91('0x12'),_0x2fad70,_0xac91('0x10'),JSON['stringify'](_0x472ee2));if(_0x472ee2[_0xac91('0x13')]){if(_0x472ee2[_0xac91('0x13')][_0xac91('0x14')]===0x1f4){logger[_0xac91('0x13')](_0xac91('0xf'),_0x2fad70,_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);return _0x25f496(_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);}logger[_0xac91('0x13')](_0xac91('0xf'),_0x2fad70,_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);return _0x4a5e33(_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);}else{logger[_0xac91('0xe')](_0xac91('0xf'),_0x2fad70,_0xac91('0x10'));_0x4a5e33(_0x472ee2[_0xac91('0x16')][_0xac91('0x15')]);}})[_0xac91('0x17')](function(_0x76b2b2){logger[_0xac91('0x13')](_0xac91('0xf'),_0x2fad70,_0x76b2b2);_0x25f496(_0x76b2b2);});});} \ No newline at end of file +var _0x3abc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash'];(function(_0x40b396,_0x18a6c6){var _0x1f3cfd=function(_0x454fa5){while(--_0x454fa5){_0x40b396['push'](_0x40b396['shift']());}};_0x1f3cfd(++_0x18a6c6);}(_0x3abc,0x18e));var _0xc3ab=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x3abc[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0xc3ab('0x0'));var util=require('util');var moment=require(_0xc3ab('0x1'));var BPromise=require(_0xc3ab('0x2'));var rs=require(_0xc3ab('0x3'));var fs=require('fs');var Redis=require(_0xc3ab('0x4'));var db=require(_0xc3ab('0x5'))['db'];var utils=require(_0xc3ab('0x6'));var logger=require(_0xc3ab('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc3ab('0x8'));var client=jayson[_0xc3ab('0x9')][_0xc3ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fbefb,_0x15ed2e,_0x25f6e3){return new BPromise(function(_0x272c39,_0x23f27d){return client[_0xc3ab('0xb')](_0x3fbefb,_0x25f6e3)['then'](function(_0x3d0cdd){logger[_0xc3ab('0xc')](_0xc3ab('0xd'),_0x15ed2e,'request\x20sent');logger['debug'](_0xc3ab('0xe'),_0x15ed2e,'request\x20sent',JSON[_0xc3ab('0xf')](_0x3d0cdd));if(_0x3d0cdd[_0xc3ab('0x10')]){if(_0x3d0cdd[_0xc3ab('0x10')][_0xc3ab('0x11')]===0x1f4){logger['error'](_0xc3ab('0xd'),_0x15ed2e,_0x3d0cdd[_0xc3ab('0x10')]['message']);return _0x23f27d(_0x3d0cdd[_0xc3ab('0x10')][_0xc3ab('0x12')]);}logger[_0xc3ab('0x10')]('CloudProvider,\x20%s,\x20%s',_0x15ed2e,_0x3d0cdd[_0xc3ab('0x10')]['message']);return _0x272c39(_0x3d0cdd[_0xc3ab('0x10')][_0xc3ab('0x12')]);}else{logger[_0xc3ab('0xc')](_0xc3ab('0xd'),_0x15ed2e,_0xc3ab('0x13'));_0x272c39(_0x3d0cdd['result'][_0xc3ab('0x12')]);}})[_0xc3ab('0x14')](function(_0x3cc8ba){logger['error'](_0xc3ab('0xd'),_0x15ed2e,_0x3cc8ba);_0x23f27d(_0x3cc8ba);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a05d850..7d3caa5 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 _0x8c47=['/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','isAuthenticated','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c47,0xc6));var _0x78c4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8c47[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x78c4('0x0'));var util=require(_0x78c4('0x1'));var path=require(_0x78c4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78c4('0x3')]();var auth=require(_0x78c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78c4('0x5'));var controller=require(_0x78c4('0x6'));router[_0x78c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x78c4('0x8')]);router[_0x78c4('0x7')]('/:id',auth[_0x78c4('0x9')](),controller[_0x78c4('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x78c4('0xb')]);router['put'](_0x78c4('0xc'),auth[_0x78c4('0x9')](),controller['update']);router['delete'](_0x78c4('0xc'),auth['isAuthenticated'](),controller[_0x78c4('0xd')]);module[_0x78c4('0xe')]=router; \ No newline at end of file +var _0x4aa2=['index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2653ac,_0x338212){var _0x14a4ba=function(_0xccd7ed){while(--_0xccd7ed){_0x2653ac['push'](_0x2653ac['shift']());}};_0x14a4ba(++_0x338212);}(_0x4aa2,0x14c));var _0x24aa=function(_0x1b1f48,_0x395016){_0x1b1f48=_0x1b1f48-0x0;var _0x4a9a12=_0x4aa2[_0x1b1f48];return _0x4a9a12;};'use strict';var multer=require(_0x24aa('0x0'));var util=require(_0x24aa('0x1'));var path=require(_0x24aa('0x2'));var timeout=require(_0x24aa('0x3'));var express=require(_0x24aa('0x4'));var router=express[_0x24aa('0x5')]();var auth=require(_0x24aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24aa('0x7'));var controller=require('./cloudProvider.controller');router[_0x24aa('0x8')]('/',auth[_0x24aa('0x9')](),controller[_0x24aa('0xa')]);router[_0x24aa('0x8')](_0x24aa('0xb'),auth['isAuthenticated'](),controller[_0x24aa('0xc')]);router[_0x24aa('0xd')]('/',auth[_0x24aa('0x9')](),controller[_0x24aa('0xe')]);router['put'](_0x24aa('0xb'),auth['isAuthenticated'](),controller[_0x24aa('0xf')]);router[_0x24aa('0x10')](_0x24aa('0xb'),auth[_0x24aa('0x9')](),controller[_0x24aa('0x11')]);module[_0x24aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index dc663fc..28db97e 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 _0x7626=['exports','STRING','name','sequelize'];(function(_0x535b18,_0xebb0ca){var _0x1efba7=function(_0x2d4a38){while(--_0x2d4a38){_0x535b18['push'](_0x535b18['shift']());}};_0x1efba7(++_0xebb0ca);}(_0x7626,0x17f));var _0x6762=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7626[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x6762('0x0'));module[_0x6762('0x1')]={'name':{'type':Sequelize[_0x6762('0x2')],'unique':_0x6762('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6762('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x6762('0x2')]},'phone':{'type':Sequelize[_0x6762('0x2')]},'fax':{'type':Sequelize[_0x6762('0x2')]},'type':{'type':Sequelize[_0x6762('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6762('0x2')]},'country':{'type':Sequelize[_0x6762('0x2')]},'email':{'type':Sequelize[_0x6762('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6762('0x2')]},'sStreet':{'type':Sequelize[_0x6762('0x2')]},'sPostalCode':{'type':Sequelize[_0x6762('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x6762('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55b9=['exports','STRING','name','sequelize'];(function(_0x27dbe5,_0x2642d7){var _0x2e8b15=function(_0x2b9119){while(--_0x2b9119){_0x27dbe5['push'](_0x27dbe5['shift']());}};_0x2e8b15(++_0x2642d7);}(_0x55b9,0x1b3));var _0x955b=function(_0x24e3f5,_0x1ea2a6){_0x24e3f5=_0x24e3f5-0x0;var _0x1be336=_0x55b9[_0x24e3f5];return _0x1be336;};'use strict';var Sequelize=require(_0x955b('0x0'));module[_0x955b('0x1')]={'name':{'type':Sequelize[_0x955b('0x2')],'unique':_0x955b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x955b('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x955b('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x955b('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x955b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x955b('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x955b('0x2')]},'sCity':{'type':Sequelize[_0x955b('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x955b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9470a12..b978f98 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 _0x5189=['moment','bluebird','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','apply','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','where','merge','map','CmCompany','count','includeAll','findAll','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','getContacts','sort','pick','options','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2550ca,_0x5d385b){var _0x13bed4=function(_0x182491){while(--_0x182491){_0x2550ca['push'](_0x2550ca['shift']());}};_0x13bed4(++_0x5d385b);}(_0x5189,0x143));var _0x9518=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x5189[_0xbe40ad];return _0x50fac9;};'use strict';var pdf=require(_0x9518('0x0'));var emlformat=require(_0x9518('0x1'));var rimraf=require(_0x9518('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9518('0x3'));var rp=require(_0x9518('0x4'));var moment=require(_0x9518('0x5'));var BPromise=require(_0x9518('0x6'));var Mustache=require('mustache');var util=require(_0x9518('0x7'));var path=require('path');var sox=require(_0x9518('0x8'));var csv=require('to-csv');var ejs=require(_0x9518('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9518('0xa'));var crypto=require(_0x9518('0xb'));var jsforce=require(_0x9518('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9518('0xd'));var querystring=require(_0x9518('0xe'));var Papa=require(_0x9518('0xf'));var Redis=require('ioredis');var authService=require(_0x9518('0x10'));var qs=require(_0x9518('0x11'));var as=require(_0x9518('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9518('0x13'));var utils=require(_0x9518('0x14'));var config=require(_0x9518('0x15'));var db=require(_0x9518('0x16'))['db'];function respondWithStatusCode(_0x4dd9a8,_0x3e1597){_0x3e1597=_0x3e1597||0xcc;return function(_0x44d6a0){if(_0x44d6a0){return _0x4dd9a8[_0x9518('0x17')](_0x3e1597);}return _0x4dd9a8[_0x9518('0x18')](_0x3e1597)[_0x9518('0x19')]();};}function respondWithResult(_0x4e5510,_0x3202c0){_0x3202c0=_0x3202c0||0xc8;return function(_0x555ffa){if(_0x555ffa){return _0x4e5510['status'](_0x3202c0)[_0x9518('0x1a')](_0x555ffa);}};}function respondWithFilteredResult(_0x4966b2,_0x2de378){return function(_0x16f747){if(_0x16f747){var _0x1fd468=_0x16f747['count'],_0x9cacb1=_0x2de378[_0x9518('0x1b')],_0x5c089e=_0x2de378['offset']+_0x2de378['limit'],_0x11eaea;if(_0x5c089e>=_0x1fd468){_0x5c089e=_0x1fd468;_0x11eaea=0xc8;}else{_0x11eaea=0xce;}_0x4966b2[_0x9518('0x18')](_0x11eaea);return _0x4966b2[_0x9518('0x1c')]('Content-Range',_0x9cacb1+'-'+_0x5c089e+'/'+_0x1fd468)[_0x9518('0x1a')](_0x16f747);}return null;};}function patchUpdates(_0x146b1a){return function(_0x4b8ab7){try{jsonpatch[_0x9518('0x1d')](_0x4b8ab7,_0x146b1a,!![]);}catch(_0x516d38){return BPromise['reject'](_0x516d38);}return _0x4b8ab7[_0x9518('0x1e')]();};}function saveUpdates(_0xda71a4,_0x233bd4){return function(_0x50cebb){if(_0x50cebb){return _0x50cebb[_0x9518('0x1f')](_0xda71a4)['then'](function(_0x241400){return _0x241400;});}return null;};}function removeEntity(_0x3fb724,_0x9fb47e){return function(_0x45e98e){if(_0x45e98e){return _0x45e98e['destroy']()[_0x9518('0x20')](function(){var _0x549b20=_0x45e98e[_0x9518('0x21')]({'plain':!![]});var _0x4110d0=_0x9518('0x22');return db[_0x9518('0x23')][_0x9518('0x24')]({'where':{'type':_0x4110d0,'resourceId':_0x549b20['id']}})['then'](function(){return _0x45e98e;});})['then'](function(){_0x3fb724[_0x9518('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b49fa,_0x241bcd){return function(_0x33b76f){if(!_0x33b76f){_0x4b49fa['sendStatus'](0x194);}return _0x33b76f;};}function handleError(_0x2c94a9,_0x1cc1cb){_0x1cc1cb=_0x1cc1cb||0x1f4;return function(_0x929340){logger[_0x9518('0x25')](_0x929340[_0x9518('0x26')]);if(_0x929340[_0x9518('0x27')]){delete _0x929340[_0x9518('0x27')];}_0x2c94a9[_0x9518('0x18')](_0x1cc1cb)[_0x9518('0x28')](_0x929340);};}exports[_0x9518('0x29')]=function(_0x2f0682,_0x11e363){var _0x8d7799={},_0x379e14={},_0x59441d={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x9518('0x20')](function(_0x229056){_0x379e14['model']=_[_0x9518('0x2a')](_0x229056);_0x379e14[_0x9518('0x2b')]=_['keys'](_0x2f0682[_0x9518('0x2b')]);_0x379e14[_0x9518('0x2c')]=_[_0x9518('0x2d')](_0x379e14['model'],_0x379e14[_0x9518('0x2b')]);_0x8d7799[_0x9518('0x2e')]=_['intersection'](_0x379e14['model'],qs[_0x9518('0x2f')](_0x2f0682[_0x9518('0x2b')][_0x9518('0x2f')]));_0x8d7799[_0x9518('0x2e')]=_0x8d7799['attributes'][_0x9518('0x30')]?_0x8d7799['attributes']:_0x379e14[_0x9518('0x31')];if(!_0x2f0682[_0x9518('0x2b')][_0x9518('0x32')](_0x9518('0x33'))){_0x8d7799[_0x9518('0x34')]=qs[_0x9518('0x34')](_0x2f0682['query']['limit']);_0x8d7799['offset']=qs[_0x9518('0x1b')](_0x2f0682[_0x9518('0x2b')][_0x9518('0x1b')]);}_0x8d7799[_0x9518('0x35')]=qs['sort'](_0x2f0682['query']['sort']);_0x8d7799['where']=qs[_0x9518('0x2c')](_['pick'](_0x2f0682[_0x9518('0x2b')],_0x379e14[_0x9518('0x2c')]),_0x229056);if(_0x2f0682[_0x9518('0x2b')]['filter']){_0x8d7799[_0x9518('0x36')]=_[_0x9518('0x37')](_0x8d7799[_0x9518('0x36')],{'$or':_[_0x9518('0x38')](_0x8d7799[_0x9518('0x2e')],function(_0xbafe1e){var _0x3d6394={};_0x3d6394[_0xbafe1e]={'$like':'%'+_0x2f0682[_0x9518('0x2b')]['filter']+'%'};return _0x3d6394;})});}_0x8d7799=_[_0x9518('0x37')]({},_0x8d7799,_0x2f0682['options']);var _0x1c4e2c={'where':_0x8d7799[_0x9518('0x36')]};return db[_0x9518('0x39')][_0x9518('0x3a')](_0x1c4e2c)[_0x9518('0x20')](function(_0x195079){_0x59441d[_0x9518('0x3a')]=_0x195079;if(_0x2f0682['query'][_0x9518('0x3b')]){_0x8d7799['include']=[{'all':!![]}];}return db['CmCompany'][_0x9518('0x3c')](_0x8d7799);})['then'](function(_0x2d08ca){_0x59441d['rows']=_0x2d08ca;return _0x59441d;})[_0x9518('0x20')](respondWithFilteredResult(_0x11e363,_0x8d7799))['catch'](handleError(_0x11e363,null));})[_0x9518('0x3d')](handleError(_0x11e363,null));};exports[_0x9518('0x3e')]=function(_0x2e4a0b,_0x5205ce){var _0x275212={'raw':![],'where':{'id':_0x2e4a0b['params']['id']}},_0x1c282a={};_0x1c282a[_0x9518('0x31')]=_[_0x9518('0x2a')](db['CmCompany'][_0x9518('0x3f')]);_0x1c282a[_0x9518('0x2b')]=_[_0x9518('0x2a')](_0x2e4a0b['query']);_0x1c282a[_0x9518('0x2c')]=_[_0x9518('0x2d')](_0x1c282a['model'],_0x1c282a['query']);_0x275212[_0x9518('0x2e')]=_['intersection'](_0x1c282a[_0x9518('0x31')],qs[_0x9518('0x2f')](_0x2e4a0b[_0x9518('0x2b')]['fields']));_0x275212['attributes']=_0x275212[_0x9518('0x2e')][_0x9518('0x30')]?_0x275212[_0x9518('0x2e')]:_0x1c282a['model'];if(_0x2e4a0b[_0x9518('0x2b')]['includeAll']){_0x275212['include']=[{'all':!![]}];}_0x275212=_[_0x9518('0x37')]({},_0x275212,_0x2e4a0b['options']);return db[_0x9518('0x39')]['find'](_0x275212)[_0x9518('0x20')](handleEntityNotFound(_0x5205ce,null))[_0x9518('0x20')](respondWithResult(_0x5205ce,null))['catch'](handleError(_0x5205ce,null));};exports[_0x9518('0x40')]=function(_0x10dc4f,_0x1863aa){return db[_0x9518('0x39')]['create'](_0x10dc4f[_0x9518('0x41')],{})[_0x9518('0x20')](function(_0x5efd3d){var _0xa20460=_0x10dc4f[_0x9518('0x42')]['get']({'plain':!![]});if(!_0xa20460)throw new Error(_0x9518('0x43'));if(_0xa20460[_0x9518('0x44')]===_0x9518('0x42')){var _0x80fcfe=_0x5efd3d[_0x9518('0x21')]({'plain':!![]});var _0x5d1c89=_0x9518('0x22');return db['UserProfileSection'][_0x9518('0x45')]({'where':{'name':_0x5d1c89,'userProfileId':_0xa20460[_0x9518('0x46')]},'raw':!![]})[_0x9518('0x20')](function(_0x208e49){if(_0x208e49&&_0x208e49['autoAssociation']===0x0){return db[_0x9518('0x23')][_0x9518('0x40')]({'name':_0x80fcfe[_0x9518('0x27')],'resourceId':_0x80fcfe['id'],'type':_0x208e49[_0x9518('0x27')],'sectionId':_0x208e49['id']},{})['then'](function(){return _0x5efd3d;});}else{return _0x5efd3d;}})[_0x9518('0x3d')](function(_0x210249){logger[_0x9518('0x25')](_0x9518('0x47'),_0x210249);throw _0x210249;});}return _0x5efd3d;})[_0x9518('0x20')](respondWithResult(_0x1863aa,0xc9))[_0x9518('0x3d')](handleError(_0x1863aa,null));};exports['update']=function(_0x318e5d,_0x27e6c9){if(_0x318e5d[_0x9518('0x41')]['id']){delete _0x318e5d[_0x9518('0x41')]['id'];}return db[_0x9518('0x39')]['find']({'where':{'id':_0x318e5d[_0x9518('0x48')]['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x27e6c9,null))['then'](saveUpdates(_0x318e5d[_0x9518('0x41')],null))[_0x9518('0x20')](respondWithResult(_0x27e6c9,null))[_0x9518('0x3d')](handleError(_0x27e6c9,null));};exports[_0x9518('0x24')]=function(_0x5eb9b6,_0x5497b6){return db['CmCompany'][_0x9518('0x45')]({'where':{'id':_0x5eb9b6[_0x9518('0x48')]['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x5497b6,null))[_0x9518('0x20')](removeEntity(_0x5497b6,null))['catch'](handleError(_0x5497b6,null));};exports['describe']=function(_0x43d366,_0x50387e){return db['CmCompany'][_0x9518('0x49')]()[_0x9518('0x20')](respondWithResult(_0x50387e,null))['catch'](handleError(_0x50387e,null));};exports[_0x9518('0x4a')]=function(_0x4e8de7,_0x11ef0e,_0x2e5c08){return db[_0x9518('0x4b')]['find']({'where':{'id':_0x4e8de7[_0x9518('0x48')]['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x11ef0e,null))[_0x9518('0x20')](function(_0x3f293b){if(_0x3f293b){return _0x3f293b['addContacts'](_0x4e8de7[_0x9518('0x41')]['ids'],_[_0x9518('0x4c')](_0x4e8de7[_0x9518('0x41')],[_0x9518('0x4d'),'id'])||{});}})[_0x9518('0x20')](respondWithResult(_0x11ef0e,null))[_0x9518('0x3d')](handleError(_0x11ef0e,null));};exports[_0x9518('0x4e')]=function(_0x239b36,_0x482dae,_0x6795aa){var _0x4c92a9={};var _0x3d2abd={};var _0x4b5f4c;var _0x4c998b;return db[_0x9518('0x39')]['findOne']({'where':{'id':_0x239b36['params']['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x482dae,null))[_0x9518('0x20')](function(_0x4323e2){if(_0x4323e2){_0x4b5f4c=_0x4323e2;_0x3d2abd['model']=_['keys'](db[_0x9518('0x4b')]['rawAttributes']);_0x3d2abd[_0x9518('0x2b')]=_[_0x9518('0x2a')](_0x239b36[_0x9518('0x2b')]);_0x3d2abd[_0x9518('0x2c')]=_[_0x9518('0x2d')](_0x3d2abd[_0x9518('0x31')],_0x3d2abd[_0x9518('0x2b')]);_0x4c92a9[_0x9518('0x2e')]=_[_0x9518('0x2d')](_0x3d2abd['model'],qs[_0x9518('0x2f')](_0x239b36[_0x9518('0x2b')][_0x9518('0x2f')]));_0x4c92a9['attributes']=_0x4c92a9[_0x9518('0x2e')]['length']?_0x4c92a9[_0x9518('0x2e')]:_0x3d2abd['model'];_0x4c92a9[_0x9518('0x35')]=qs[_0x9518('0x4f')](_0x239b36[_0x9518('0x2b')][_0x9518('0x4f')]);_0x4c92a9[_0x9518('0x36')]=qs['filters'](_[_0x9518('0x50')](_0x239b36['query'],_0x3d2abd[_0x9518('0x2c')]));if(_0x239b36['query']['filter']){_0x4c92a9[_0x9518('0x36')]=_['merge'](_0x4c92a9[_0x9518('0x36')],{'$or':_['map'](_0x4c92a9[_0x9518('0x2e')],function(_0x5a2551){var _0x5d085f={};_0x5d085f[_0x5a2551]={'$like':'%'+_0x239b36[_0x9518('0x2b')]['filter']+'%'};return _0x5d085f;})});}_0x4c92a9=_[_0x9518('0x37')]({},_0x4c92a9,_0x239b36[_0x9518('0x51')]);return _0x4b5f4c['getContacts'](_0x4c92a9);}})[_0x9518('0x20')](function(_0x26096a){if(_0x26096a){_0x4c998b=_0x26096a['length'];if(!_0x239b36[_0x9518('0x2b')][_0x9518('0x32')](_0x9518('0x33'))){_0x4c92a9[_0x9518('0x34')]=qs[_0x9518('0x34')](_0x239b36['query']['limit']);_0x4c92a9[_0x9518('0x1b')]=qs[_0x9518('0x1b')](_0x239b36['query'][_0x9518('0x1b')]);}return _0x4b5f4c['getContacts'](_0x4c92a9);}})[_0x9518('0x20')](function(_0x1350a4){if(_0x1350a4){return _0x1350a4?{'count':_0x4c998b,'rows':_0x1350a4}:null;}})[_0x9518('0x20')](respondWithResult(_0x482dae,null))[_0x9518('0x3d')](handleError(_0x482dae,null));}; \ No newline at end of file +var _0xa9ef=['options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','omit','ids','getContacts','findOne','hasOwnProperty','html-pdf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','reject','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','count','includeAll','include','rows','catch','show','params','rawAttributes'];(function(_0xbb2b8b,_0x325cbe){var _0x65d0d3=function(_0x4444d2){while(--_0x4444d2){_0xbb2b8b['push'](_0xbb2b8b['shift']());}};_0x65d0d3(++_0x325cbe);}(_0xa9ef,0x155));var _0xfa9e=function(_0x546d39,_0x436507){_0x546d39=_0x546d39-0x0;var _0x24b39c=_0xa9ef[_0x546d39];return _0x24b39c;};'use strict';var pdf=require(_0xfa9e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa9e('0x1'));var rp=require('request-promise');var moment=require(_0xfa9e('0x2'));var BPromise=require(_0xfa9e('0x3'));var Mustache=require(_0xfa9e('0x4'));var util=require('util');var path=require(_0xfa9e('0x5'));var sox=require(_0xfa9e('0x6'));var csv=require(_0xfa9e('0x7'));var ejs=require(_0xfa9e('0x8'));var fs=require('fs');var _=require(_0xfa9e('0x9'));var squel=require(_0xfa9e('0xa'));var crypto=require(_0xfa9e('0xb'));var jsforce=require(_0xfa9e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfa9e('0x7'));var querystring=require('querystring');var Papa=require(_0xfa9e('0xd'));var Redis=require('ioredis');var authService=require(_0xfa9e('0xe'));var qs=require(_0xfa9e('0xf'));var as=require(_0xfa9e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa9e('0x11'))(_0xfa9e('0x12'));var utils=require(_0xfa9e('0x13'));var config=require(_0xfa9e('0x14'));var db=require(_0xfa9e('0x15'))['db'];function respondWithStatusCode(_0xcec2b4,_0x39be2a){_0x39be2a=_0x39be2a||0xcc;return function(_0x5662ad){if(_0x5662ad){return _0xcec2b4[_0xfa9e('0x16')](_0x39be2a);}return _0xcec2b4['status'](_0x39be2a)['end']();};}function respondWithResult(_0x48914e,_0x20e3a8){_0x20e3a8=_0x20e3a8||0xc8;return function(_0x1ad1dc){if(_0x1ad1dc){return _0x48914e['status'](_0x20e3a8)[_0xfa9e('0x17')](_0x1ad1dc);}};}function respondWithFilteredResult(_0x4e6a93,_0x2a899f){return function(_0x5ce9c5){if(_0x5ce9c5){var _0x5bb77a=_0x5ce9c5['count'],_0x4b52aa=_0x2a899f[_0xfa9e('0x18')],_0x40ca74=_0x2a899f[_0xfa9e('0x18')]+_0x2a899f[_0xfa9e('0x19')],_0x24a3b7;if(_0x40ca74>=_0x5bb77a){_0x40ca74=_0x5bb77a;_0x24a3b7=0xc8;}else{_0x24a3b7=0xce;}_0x4e6a93[_0xfa9e('0x1a')](_0x24a3b7);return _0x4e6a93[_0xfa9e('0x1b')](_0xfa9e('0x1c'),_0x4b52aa+'-'+_0x40ca74+'/'+_0x5bb77a)[_0xfa9e('0x17')](_0x5ce9c5);}return null;};}function patchUpdates(_0x4e2b){return function(_0x1c999a){try{jsonpatch['apply'](_0x1c999a,_0x4e2b,!![]);}catch(_0x31546a){return BPromise[_0xfa9e('0x1d')](_0x31546a);}return _0x1c999a['save']();};}function saveUpdates(_0x2f20c5,_0x34f93b){return function(_0x5ec544){if(_0x5ec544){return _0x5ec544[_0xfa9e('0x1e')](_0x2f20c5)[_0xfa9e('0x1f')](function(_0x4c0dfa){return _0x4c0dfa;});}return null;};}function removeEntity(_0x473f1a,_0x5add00){return function(_0x5c92dc){if(_0x5c92dc){return _0x5c92dc[_0xfa9e('0x20')]()[_0xfa9e('0x1f')](function(){var _0x1d0b00=_0x5c92dc[_0xfa9e('0x21')]({'plain':!![]});var _0x31b6b7=_0xfa9e('0x22');return db[_0xfa9e('0x23')][_0xfa9e('0x20')]({'where':{'type':_0x31b6b7,'resourceId':_0x1d0b00['id']}})[_0xfa9e('0x1f')](function(){return _0x5c92dc;});})['then'](function(){_0x473f1a[_0xfa9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x434860,_0x118c66){return function(_0x148b36){if(!_0x148b36){_0x434860[_0xfa9e('0x16')](0x194);}return _0x148b36;};}function handleError(_0x4004f2,_0x8f24e6){_0x8f24e6=_0x8f24e6||0x1f4;return function(_0x3a92b9){logger[_0xfa9e('0x24')](_0x3a92b9[_0xfa9e('0x25')]);if(_0x3a92b9['name']){delete _0x3a92b9[_0xfa9e('0x26')];}_0x4004f2['status'](_0x8f24e6)['send'](_0x3a92b9);};}exports['index']=function(_0x154cdc,_0x5bd9ed){var _0x210757={},_0x46c396={},_0x201953={'count':0x0,'rows':[]};return db[_0xfa9e('0x27')][_0xfa9e('0x28')]()[_0xfa9e('0x1f')](function(_0x1b22a6){_0x46c396[_0xfa9e('0x29')]=_[_0xfa9e('0x2a')](_0x1b22a6);_0x46c396[_0xfa9e('0x2b')]=_['keys'](_0x154cdc[_0xfa9e('0x2b')]);_0x46c396[_0xfa9e('0x2c')]=_[_0xfa9e('0x2d')](_0x46c396['model'],_0x46c396[_0xfa9e('0x2b')]);_0x210757[_0xfa9e('0x2e')]=_[_0xfa9e('0x2d')](_0x46c396[_0xfa9e('0x29')],qs['fields'](_0x154cdc[_0xfa9e('0x2b')][_0xfa9e('0x2f')]));_0x210757[_0xfa9e('0x2e')]=_0x210757[_0xfa9e('0x2e')][_0xfa9e('0x30')]?_0x210757['attributes']:_0x46c396[_0xfa9e('0x29')];if(!_0x154cdc['query']['hasOwnProperty'](_0xfa9e('0x31'))){_0x210757[_0xfa9e('0x19')]=qs[_0xfa9e('0x19')](_0x154cdc[_0xfa9e('0x2b')][_0xfa9e('0x19')]);_0x210757[_0xfa9e('0x18')]=qs['offset'](_0x154cdc[_0xfa9e('0x2b')][_0xfa9e('0x18')]);}_0x210757['order']=qs['sort'](_0x154cdc['query'][_0xfa9e('0x32')]);_0x210757[_0xfa9e('0x33')]=qs[_0xfa9e('0x2c')](_[_0xfa9e('0x34')](_0x154cdc[_0xfa9e('0x2b')],_0x46c396['filters']),_0x1b22a6);if(_0x154cdc[_0xfa9e('0x2b')][_0xfa9e('0x35')]){_0x210757['where']=_[_0xfa9e('0x36')](_0x210757[_0xfa9e('0x33')],{'$or':_[_0xfa9e('0x37')](_0x210757['attributes'],function(_0x5d20b6){var _0x54d9e9={};_0x54d9e9[_0x5d20b6]={'$like':'%'+_0x154cdc[_0xfa9e('0x2b')][_0xfa9e('0x35')]+'%'};return _0x54d9e9;})});}_0x210757=_[_0xfa9e('0x36')]({},_0x210757,_0x154cdc['options']);var _0x45659f={'where':_0x210757[_0xfa9e('0x33')]};return db['CmCompany'][_0xfa9e('0x38')](_0x45659f)[_0xfa9e('0x1f')](function(_0x7ecdd9){_0x201953[_0xfa9e('0x38')]=_0x7ecdd9;if(_0x154cdc[_0xfa9e('0x2b')][_0xfa9e('0x39')]){_0x210757[_0xfa9e('0x3a')]=[{'all':!![]}];}return db[_0xfa9e('0x27')]['findAll'](_0x210757);})['then'](function(_0x446f8c){_0x201953[_0xfa9e('0x3b')]=_0x446f8c;return _0x201953;})[_0xfa9e('0x1f')](respondWithFilteredResult(_0x5bd9ed,_0x210757))[_0xfa9e('0x3c')](handleError(_0x5bd9ed,null));})[_0xfa9e('0x3c')](handleError(_0x5bd9ed,null));};exports[_0xfa9e('0x3d')]=function(_0xed2611,_0x575fde){var _0x186cd8={'raw':![],'where':{'id':_0xed2611[_0xfa9e('0x3e')]['id']}},_0xf65e38={};_0xf65e38[_0xfa9e('0x29')]=_[_0xfa9e('0x2a')](db['CmCompany'][_0xfa9e('0x3f')]);_0xf65e38[_0xfa9e('0x2b')]=_['keys'](_0xed2611[_0xfa9e('0x2b')]);_0xf65e38['filters']=_[_0xfa9e('0x2d')](_0xf65e38[_0xfa9e('0x29')],_0xf65e38['query']);_0x186cd8[_0xfa9e('0x2e')]=_[_0xfa9e('0x2d')](_0xf65e38[_0xfa9e('0x29')],qs[_0xfa9e('0x2f')](_0xed2611[_0xfa9e('0x2b')][_0xfa9e('0x2f')]));_0x186cd8['attributes']=_0x186cd8[_0xfa9e('0x2e')][_0xfa9e('0x30')]?_0x186cd8[_0xfa9e('0x2e')]:_0xf65e38[_0xfa9e('0x29')];if(_0xed2611[_0xfa9e('0x2b')][_0xfa9e('0x39')]){_0x186cd8[_0xfa9e('0x3a')]=[{'all':!![]}];}_0x186cd8=_['merge']({},_0x186cd8,_0xed2611[_0xfa9e('0x40')]);return db['CmCompany'][_0xfa9e('0x41')](_0x186cd8)[_0xfa9e('0x1f')](handleEntityNotFound(_0x575fde,null))[_0xfa9e('0x1f')](respondWithResult(_0x575fde,null))[_0xfa9e('0x3c')](handleError(_0x575fde,null));};exports[_0xfa9e('0x42')]=function(_0x34237c,_0x130498){return db[_0xfa9e('0x27')][_0xfa9e('0x42')](_0x34237c[_0xfa9e('0x43')],{})[_0xfa9e('0x1f')](function(_0x40425){var _0x378682=_0x34237c[_0xfa9e('0x44')]['get']({'plain':!![]});if(!_0x378682)throw new Error(_0xfa9e('0x45'));if(_0x378682[_0xfa9e('0x46')]===_0xfa9e('0x44')){var _0x272318=_0x40425[_0xfa9e('0x21')]({'plain':!![]});var _0x5402a6=_0xfa9e('0x22');return db[_0xfa9e('0x47')][_0xfa9e('0x41')]({'where':{'name':_0x5402a6,'userProfileId':_0x378682[_0xfa9e('0x48')]},'raw':!![]})[_0xfa9e('0x1f')](function(_0x21d6f4){if(_0x21d6f4&&_0x21d6f4[_0xfa9e('0x49')]===0x0){return db[_0xfa9e('0x23')][_0xfa9e('0x42')]({'name':_0x272318[_0xfa9e('0x26')],'resourceId':_0x272318['id'],'type':_0x21d6f4[_0xfa9e('0x26')],'sectionId':_0x21d6f4['id']},{})[_0xfa9e('0x1f')](function(){return _0x40425;});}else{return _0x40425;}})[_0xfa9e('0x3c')](function(_0x4464d3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4464d3);throw _0x4464d3;});}return _0x40425;})[_0xfa9e('0x1f')](respondWithResult(_0x130498,0xc9))['catch'](handleError(_0x130498,null));};exports[_0xfa9e('0x1e')]=function(_0x332c54,_0x4e98ac){if(_0x332c54[_0xfa9e('0x43')]['id']){delete _0x332c54['body']['id'];}return db[_0xfa9e('0x27')][_0xfa9e('0x41')]({'where':{'id':_0x332c54[_0xfa9e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e98ac,null))[_0xfa9e('0x1f')](saveUpdates(_0x332c54[_0xfa9e('0x43')],null))[_0xfa9e('0x1f')](respondWithResult(_0x4e98ac,null))[_0xfa9e('0x3c')](handleError(_0x4e98ac,null));};exports[_0xfa9e('0x20')]=function(_0x7b3e19,_0x591e3b){return db[_0xfa9e('0x27')][_0xfa9e('0x41')]({'where':{'id':_0x7b3e19[_0xfa9e('0x3e')]['id']}})[_0xfa9e('0x1f')](handleEntityNotFound(_0x591e3b,null))[_0xfa9e('0x1f')](removeEntity(_0x591e3b,null))[_0xfa9e('0x3c')](handleError(_0x591e3b,null));};exports['describe']=function(_0x3dca8d,_0x27c427){return db[_0xfa9e('0x27')][_0xfa9e('0x28')]()[_0xfa9e('0x1f')](respondWithResult(_0x27c427,null))[_0xfa9e('0x3c')](handleError(_0x27c427,null));};exports[_0xfa9e('0x4a')]=function(_0x22b214,_0x19dba6,_0x565e6f){return db[_0xfa9e('0x4b')][_0xfa9e('0x41')]({'where':{'id':_0x22b214[_0xfa9e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19dba6,null))[_0xfa9e('0x1f')](function(_0x378bf6){if(_0x378bf6){return _0x378bf6[_0xfa9e('0x4a')](_0x22b214[_0xfa9e('0x43')]['ids'],_[_0xfa9e('0x4c')](_0x22b214[_0xfa9e('0x43')],[_0xfa9e('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x19dba6,null))[_0xfa9e('0x3c')](handleError(_0x19dba6,null));};exports[_0xfa9e('0x4e')]=function(_0x24ef46,_0x9af5a,_0x2086d3){var _0x1cc39e={};var _0x4b3049={};var _0x56f1a5;var _0x1a7d75;return db[_0xfa9e('0x27')][_0xfa9e('0x4f')]({'where':{'id':_0x24ef46[_0xfa9e('0x3e')]['id']}})[_0xfa9e('0x1f')](handleEntityNotFound(_0x9af5a,null))[_0xfa9e('0x1f')](function(_0x114d54){if(_0x114d54){_0x56f1a5=_0x114d54;_0x4b3049[_0xfa9e('0x29')]=_[_0xfa9e('0x2a')](db[_0xfa9e('0x4b')][_0xfa9e('0x3f')]);_0x4b3049[_0xfa9e('0x2b')]=_['keys'](_0x24ef46[_0xfa9e('0x2b')]);_0x4b3049[_0xfa9e('0x2c')]=_['intersection'](_0x4b3049[_0xfa9e('0x29')],_0x4b3049[_0xfa9e('0x2b')]);_0x1cc39e['attributes']=_['intersection'](_0x4b3049['model'],qs[_0xfa9e('0x2f')](_0x24ef46[_0xfa9e('0x2b')][_0xfa9e('0x2f')]));_0x1cc39e[_0xfa9e('0x2e')]=_0x1cc39e[_0xfa9e('0x2e')][_0xfa9e('0x30')]?_0x1cc39e[_0xfa9e('0x2e')]:_0x4b3049[_0xfa9e('0x29')];_0x1cc39e['order']=qs[_0xfa9e('0x32')](_0x24ef46[_0xfa9e('0x2b')]['sort']);_0x1cc39e['where']=qs[_0xfa9e('0x2c')](_[_0xfa9e('0x34')](_0x24ef46['query'],_0x4b3049[_0xfa9e('0x2c')]));if(_0x24ef46[_0xfa9e('0x2b')]['filter']){_0x1cc39e[_0xfa9e('0x33')]=_['merge'](_0x1cc39e['where'],{'$or':_[_0xfa9e('0x37')](_0x1cc39e[_0xfa9e('0x2e')],function(_0x1c6919){var _0x47bb59={};_0x47bb59[_0x1c6919]={'$like':'%'+_0x24ef46[_0xfa9e('0x2b')]['filter']+'%'};return _0x47bb59;})});}_0x1cc39e=_[_0xfa9e('0x36')]({},_0x1cc39e,_0x24ef46[_0xfa9e('0x40')]);return _0x56f1a5['getContacts'](_0x1cc39e);}})[_0xfa9e('0x1f')](function(_0x5667f3){if(_0x5667f3){_0x1a7d75=_0x5667f3[_0xfa9e('0x30')];if(!_0x24ef46['query'][_0xfa9e('0x50')]('nolimit')){_0x1cc39e['limit']=qs[_0xfa9e('0x19')](_0x24ef46[_0xfa9e('0x2b')][_0xfa9e('0x19')]);_0x1cc39e[_0xfa9e('0x18')]=qs[_0xfa9e('0x18')](_0x24ef46[_0xfa9e('0x2b')][_0xfa9e('0x18')]);}return _0x56f1a5['getContacts'](_0x1cc39e);}})[_0xfa9e('0x1f')](function(_0x2bc6ce){if(_0x2bc6ce){return _0x2bc6ce?{'count':_0x1a7d75,'rows':_0x2bc6ce}:null;}})['then'](respondWithResult(_0x9af5a,null))[_0xfa9e('0x3c')](handleError(_0x9af5a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4de4f65..3f2fdcb 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 _0x8053=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','bluebird'];(function(_0x59c6a1,_0x27b198){var _0x1f6560=function(_0x18a9b8){while(--_0x18a9b8){_0x59c6a1['push'](_0x59c6a1['shift']());}};_0x1f6560(++_0x27b198);}(_0x8053,0xa3));var _0x3805=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x8053[_0x5c1345];return _0x1c070d;};'use strict';var _=require('lodash');var util=require(_0x3805('0x0'));var logger=require(_0x3805('0x1'))(_0x3805('0x2'));var moment=require(_0x3805('0x3'));var BPromise=require(_0x3805('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3805('0x5'));var rimraf=require(_0x3805('0x6'));var config=require(_0x3805('0x7'));var attributes=require(_0x3805('0x8'));module[_0x3805('0x9')]=function(_0x1b27a0,_0x1eed0b){return _0x1b27a0[_0x3805('0xa')](_0x3805('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb63b=['CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xb63b,0x70));var _0xbb63=function(_0xd78108,_0x4702fd){_0xd78108=_0xd78108-0x0;var _0x3ebb14=_0xb63b[_0xd78108];return _0x3ebb14;};'use strict';var _=require('lodash');var util=require(_0xbb63('0x0'));var logger=require(_0xbb63('0x1'))(_0xbb63('0x2'));var moment=require('moment');var BPromise=require(_0xbb63('0x3'));var rp=require(_0xbb63('0x4'));var fs=require('fs');var path=require(_0xbb63('0x5'));var rimraf=require(_0xbb63('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb63('0x7'));module[_0xbb63('0x8')]=function(_0x3a12e6,_0x1fb713){return _0x3a12e6['define'](_0xbb63('0x9'),attributes,{'tableName':_0xbb63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index f28e9a5..934485f 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 _0x8e98=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x368755,_0x53ff2d){var _0x242683=function(_0x383f80){while(--_0x383f80){_0x368755['push'](_0x368755['shift']());}};_0x242683(++_0x53ff2d);}(_0x8e98,0x66));var _0x88e9=function(_0x2fccb1,_0x5099d4){_0x2fccb1=_0x2fccb1-0x0;var _0x562ce3=_0x8e98[_0x2fccb1];return _0x562ce3;};'use strict';var _=require(_0x88e9('0x0'));var util=require('util');var moment=require(_0x88e9('0x1'));var BPromise=require(_0x88e9('0x2'));var rs=require(_0x88e9('0x3'));var fs=require('fs');var Redis=require(_0x88e9('0x4'));var db=require(_0x88e9('0x5'))['db'];var utils=require(_0x88e9('0x6'));var logger=require(_0x88e9('0x7'))('rpc');var config=require(_0x88e9('0x8'));var jayson=require(_0x88e9('0x9'));var client=jayson[_0x88e9('0xa')][_0x88e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370cac,_0x159e89,_0x136d3a){return new BPromise(function(_0x439a35,_0x30a06e){return client[_0x88e9('0xc')](_0x370cac,_0x136d3a)['then'](function(_0x402599){logger[_0x88e9('0xd')](_0x88e9('0xe'),_0x159e89,_0x88e9('0xf'));logger[_0x88e9('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x159e89,_0x88e9('0xf'),JSON[_0x88e9('0x11')](_0x402599));if(_0x402599['error']){if(_0x402599[_0x88e9('0x12')][_0x88e9('0x13')]===0x1f4){logger[_0x88e9('0x12')]('CmCompany,\x20%s,\x20%s',_0x159e89,_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);return _0x30a06e(_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);}logger[_0x88e9('0x12')]('CmCompany,\x20%s,\x20%s',_0x159e89,_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);return _0x439a35(_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);}else{logger[_0x88e9('0xd')](_0x88e9('0xe'),_0x159e89,'request\x20sent');_0x439a35(_0x402599[_0x88e9('0x15')][_0x88e9('0x14')]);}})[_0x88e9('0x16')](function(_0x15c741){logger[_0x88e9('0x12')](_0x88e9('0xe'),_0x159e89,_0x15c741);_0x30a06e(_0x15c741);});});} \ No newline at end of file +var _0x6f20=['message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6f20,0x87));var _0x06f2=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x6f20[_0x16a637];return _0x25126d;};'use strict';var _=require('lodash');var util=require(_0x06f2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06f2('0x1'));var fs=require('fs');var Redis=require(_0x06f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x06f2('0x3'));var logger=require(_0x06f2('0x4'))('rpc');var config=require(_0x06f2('0x5'));var jayson=require(_0x06f2('0x6'));var client=jayson[_0x06f2('0x7')][_0x06f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f38d0,_0x5b6339,_0x4bd023){return new BPromise(function(_0x34b0ae,_0x47549a){return client[_0x06f2('0x9')](_0x3f38d0,_0x4bd023)[_0x06f2('0xa')](function(_0x5c09e7){logger[_0x06f2('0xb')](_0x06f2('0xc'),_0x5b6339,_0x06f2('0xd'));logger[_0x06f2('0xe')](_0x06f2('0xf'),_0x5b6339,_0x06f2('0xd'),JSON[_0x06f2('0x10')](_0x5c09e7));if(_0x5c09e7[_0x06f2('0x11')]){if(_0x5c09e7[_0x06f2('0x11')][_0x06f2('0x12')]===0x1f4){logger['error'](_0x06f2('0xc'),_0x5b6339,_0x5c09e7[_0x06f2('0x11')][_0x06f2('0x13')]);return _0x47549a(_0x5c09e7[_0x06f2('0x11')]['message']);}logger[_0x06f2('0x11')](_0x06f2('0xc'),_0x5b6339,_0x5c09e7['error'][_0x06f2('0x13')]);return _0x34b0ae(_0x5c09e7['error'][_0x06f2('0x13')]);}else{logger[_0x06f2('0xb')](_0x06f2('0xc'),_0x5b6339,_0x06f2('0xd'));_0x34b0ae(_0x5c09e7[_0x06f2('0x14')][_0x06f2('0x13')]);}})[_0x06f2('0x15')](function(_0x58e4e4){logger[_0x06f2('0x11')](_0x06f2('0xc'),_0x5b6339,_0x58e4e4);_0x47549a(_0x58e4e4);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 102b615..1f6aca2 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 _0xedd9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util'];(function(_0x3eab79,_0x3868a4){var _0x45fc2f=function(_0x2c53c6){while(--_0x2c53c6){_0x3eab79['push'](_0x3eab79['shift']());}};_0x45fc2f(++_0x3868a4);}(_0xedd9,0xfc));var _0x9edd=function(_0x53c58d,_0x592b13){_0x53c58d=_0x53c58d-0x0;var _0x5e514a=_0xedd9[_0x53c58d];return _0x5e514a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./cmCompany.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0xf')]('/:id/contacts',auth[_0x9edd('0x9')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x12')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x14')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0x15')]);module[_0x9edd('0x16')]=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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x55ca,0x126));var _0xa55c=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x55ca[_0x4aa838];return _0x3abff0;};'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 7beece4..29a92cc 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 _0x29b3=['DATE','NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x445d20,_0x39643f){var _0x26e5f2=function(_0x1f1e53){while(--_0x1f1e53){_0x445d20['push'](_0x445d20['shift']());}};_0x26e5f2(++_0x39643f);}(_0x29b3,0x9a));var _0x329b=function(_0x24b489,_0x478237){_0x24b489=_0x24b489-0x0;var _0x36215b=_0x29b3[_0x24b489];return _0x36215b;};'use strict';var _=require(_0x329b('0x0'));var Sequelize=require('sequelize');module[_0x329b('0x1')]={'firstName':{'type':Sequelize[_0x329b('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x329b('0x2')]},'street':{'type':Sequelize[_0x329b('0x2')]},'postalCode':{'type':Sequelize[_0x329b('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x329b('0x2')]},'dateOfBirth':{'type':Sequelize[_0x329b('0x2')]},'description':{'type':Sequelize[_0x329b('0x3')]},'phone':{'type':Sequelize[_0x329b('0x2')]},'mobile':{'type':Sequelize[_0x329b('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x329b('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x329b('0x2')]},'twitter':{'type':Sequelize[_0x329b('0x2')]},'skype':{'type':Sequelize[_0x329b('0x2')]},'teams':{'type':Sequelize[_0x329b('0x2')]},'viber':{'type':Sequelize[_0x329b('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x329b('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x329b('0x4')]},'priority':{'type':Sequelize[_0x329b('0x4')](0x2)[_0x329b('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x329b('0x6')],'defaultValue':Sequelize[_0x329b('0x7')]},'dialTimezone':{'type':Sequelize[_0x329b('0x2')]},'utcOffset':{'type':Sequelize[_0x329b('0x4')]}}; \ No newline at end of file +var _0xa0d1=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0xa0d1,0x144));var _0x1a0d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa0d1[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x1a0d('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x1a0d('0x1')]},'street':{'type':Sequelize[_0x1a0d('0x1')]},'postalCode':{'type':Sequelize[_0x1a0d('0x1')]},'city':{'type':Sequelize[_0x1a0d('0x1')]},'country':{'type':Sequelize[_0x1a0d('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a0d('0x2')]},'phone':{'type':Sequelize[_0x1a0d('0x1')]},'mobile':{'type':Sequelize[_0x1a0d('0x1')]},'fax':{'type':Sequelize[_0x1a0d('0x1')]},'email':{'type':Sequelize[_0x1a0d('0x1')]},'url':{'type':Sequelize[_0x1a0d('0x1')]},'facebook':{'type':Sequelize[_0x1a0d('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x1a0d('0x1')]},'teams':{'type':Sequelize[_0x1a0d('0x1')]},'viber':{'type':Sequelize[_0x1a0d('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1a0d('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1a0d('0x3')]},'priority':{'type':Sequelize[_0x1a0d('0x3')](0x2)[_0x1a0d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1a0d('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x1a0d('0x1')]},'utcOffset':{'type':Sequelize[_0x1a0d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a9f278f..491fc17 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 _0x4cbf=['[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','OpenchannelInteraction','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','duplicates','spread','show','color','$and','omit','cf_%d','pickBy','format','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','CmHopper','ContactId','includeAll','include','getHopperHistories','nolimit','rows','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','file','filename','chmodSync','0777','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','send','parse','meta','import','agent','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','index','CmContact','describe','keys','length','cf_','push','CmCustomField','findOne','trimStart','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','select','field','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','buildExpression','text','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','\x20=\x20?','isArray','tag','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','c.id','DESC','t.id\x20IN\x20?','resolve','some','User','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','count','merge','c.firstName','c.mobile','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','params','catch','tags','startsWith','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s'];(function(_0x420c2a,_0x3f89e5){var _0x3702ed=function(_0x3a946d){while(--_0x3a946d){_0x420c2a['push'](_0x420c2a['shift']());}};_0x3702ed(++_0x3f89e5);}(_0x4cbf,0x13c));var _0xf4cb=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x4cbf[_0xd1d19a];return _0x52a79d;};'use strict';var pdf=require(_0xf4cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf4cb('0x1'));var zipdir=require(_0xf4cb('0x2'));var jsonpatch=require(_0xf4cb('0x3'));var rp=require(_0xf4cb('0x4'));var moment=require(_0xf4cb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4cb('0x6'));var util=require(_0xf4cb('0x7'));var path=require(_0xf4cb('0x8'));var sox=require(_0xf4cb('0x9'));var csv=require(_0xf4cb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf4cb('0xb'));var squel=require(_0xf4cb('0xc'));var crypto=require(_0xf4cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf4cb('0xe'));var toCsv=require(_0xf4cb('0xa'));var querystring=require(_0xf4cb('0xf'));var Papa=require(_0xf4cb('0x10'));var Redis=require('ioredis');var authService=require(_0xf4cb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf4cb('0x12'));var hardwareService=require(_0xf4cb('0x13'));var logger=require(_0xf4cb('0x14'))(_0xf4cb('0x15'));var utils=require('../../config/utils');var config=require(_0xf4cb('0x16'));var db=require(_0xf4cb('0x17'))['db'];config[_0xf4cb('0x18')]=_[_0xf4cb('0x19')](config[_0xf4cb('0x18')],{'host':_0xf4cb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4cb('0x18')]));require(_0xf4cb('0x1b'))[_0xf4cb('0x1c')](socket);function respondWithStatusCode(_0x353b09,_0x314eb9){_0x314eb9=_0x314eb9||0xcc;return function(_0x945e4c){if(_0x945e4c){return _0x353b09[_0xf4cb('0x1d')](_0x314eb9);}return _0x353b09[_0xf4cb('0x1e')](_0x314eb9)[_0xf4cb('0x1f')]();};}function respondWithResult(_0x255edb,_0x433854){_0x433854=_0x433854||0xc8;return function(_0x59e06c){if(_0x59e06c){return _0x255edb[_0xf4cb('0x1e')](_0x433854)[_0xf4cb('0x20')](_0x59e06c);}};}function respondWithFilteredResult(_0x1e7d0f,_0xad2e1){return function(_0x4dcf2d){if(_0x4dcf2d){var _0x46550e=_0x4dcf2d['count'],_0x295551=_0xad2e1[_0xf4cb('0x21')],_0x1a2551=_0xad2e1[_0xf4cb('0x21')]+_0xad2e1['limit'],_0x17a6c4;if(_0x1a2551>=_0x46550e){_0x1a2551=_0x46550e;_0x17a6c4=0xc8;}else{_0x17a6c4=0xce;}_0x1e7d0f[_0xf4cb('0x1e')](_0x17a6c4);return _0x1e7d0f[_0xf4cb('0x22')](_0xf4cb('0x23'),_0x295551+'-'+_0x1a2551+'/'+_0x46550e)['json'](_0x4dcf2d);}return null;};}function patchUpdates(_0x1e986e){return function(_0x536cb6){try{jsonpatch[_0xf4cb('0x24')](_0x536cb6,_0x1e986e,!![]);}catch(_0x106a51){return BPromise['reject'](_0x106a51);}return _0x536cb6['save']();};}function saveUpdates(_0x4bc38b,_0x539be7){return function(_0x12b35c){if(_0x12b35c){return _0x12b35c[_0xf4cb('0x25')](_0x4bc38b)[_0xf4cb('0x26')](function(_0x7618a4){return _0x7618a4;});}return null;};}function removeEntity(_0x422365,_0x5bce06){return function(_0xeb2f04){if(_0xeb2f04){return _0xeb2f04[_0xf4cb('0x27')]()['then'](function(){_0x422365[_0xf4cb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21009d,_0x3d5e76){return function(_0x5eb65b){if(!_0x5eb65b){_0x21009d[_0xf4cb('0x1d')](0x194);}return _0x5eb65b;};}function handleError(_0x1b10df,_0x5c880d){_0x5c880d=_0x5c880d||0x1f4;return function(_0xc9015d){logger[_0xf4cb('0x28')](_0xc9015d[_0xf4cb('0x29')]);if(_0xc9015d[_0xf4cb('0x2a')]){delete _0xc9015d[_0xf4cb('0x2a')];}_0x1b10df[_0xf4cb('0x1e')](_0x5c880d)['send'](_0xc9015d);};}exports[_0xf4cb('0x2b')]=function(_0x3ae55b,_0x4aa719){var _0x39db54={},_0x171a51={},_0x1393db={'count':0x0,'rows':[]};return db[_0xf4cb('0x2c')][_0xf4cb('0x2d')]()[_0xf4cb('0x26')](function(_0x17b8e6){var _0xb8b65c=[];for(var _0x4da146=0x0;_0x4da1460x1){_0x315a1d['or'](_0xf4cb('0x6d'),qs[_0xf4cb('0x6e')](_0x21fcc1),null);}else{if(qs[_0xf4cb('0x6f')](_0x21fcc1)){_0x315a1d['or'](_0xf4cb('0x70'),_0x21fcc1+'%');_0x315a1d['or']('c.phone\x20LIKE\x20?',_0x21fcc1+'%');_0x315a1d['or'](_0xf4cb('0x71'),_0x21fcc1+'%');_0x315a1d['or'](_0xf4cb('0x72'),_0x21fcc1+'%');}else if(qs[_0xf4cb('0x73')](_0x21fcc1)){_0x315a1d['or'](_0xf4cb('0x74'),_0x21fcc1+'%');}else{_0x315a1d['or'](_0xf4cb('0x75'),'%'+_0x21fcc1+'%');_0x315a1d['or'](_0xf4cb('0x76'),'%'+_0x21fcc1+'%');_0x315a1d['or']('c.email\x20LIKE\x20?','%'+_0x21fcc1+'%');}}}}_0x599a8b[_0xf4cb('0x41')](_0x315a1d);_0x599a8b[_0xf4cb('0x77')]('c.id');var _0x38a906={'type':db[_0xf4cb('0x78')][_0xf4cb('0x79')][_0xf4cb('0x7a')],'raw':!![]};var _0x2141a3=_0x599a8b[_0xf4cb('0x7b')]()[_0xf4cb('0x44')](_0xf4cb('0x7c'));if(_0x39db54[_0xf4cb('0x3f')]){_0x39db54[_0xf4cb('0x3f')][_0xf4cb('0x58')](function(_0xd2502b){_0x599a8b['order']('c.'+_0xd2502b[0x0],_0xd2502b[0x1]===_0xf4cb('0x7d')?![]:!![]);});}if(!_[_0xf4cb('0x65')](_0x4534f2)){_0x599a8b['having'](_0x45a9f0);_0x2141a3[_0xf4cb('0x41')](_0xf4cb('0x7e'),_0x4534f2);}BPromise[_0xf4cb('0x7f')]()[_0xf4cb('0x26')](function(){if(_0x5457ab&&!_[_0xf4cb('0x80')](_0x5457ab[_0xf4cb('0x52')],['field',_0xf4cb('0x81')])){return _0x3ae55b[_0xf4cb('0x82')][_0xf4cb('0x83')]({'attributes':['id'],'raw':!![]})[_0xf4cb('0x26')](function(_0x202b2c){if(_[_0xf4cb('0x65')](_0x202b2c)){_0x2141a3[_0xf4cb('0x41')](_0xf4cb('0x84'));_0x599a8b['where'](_0xf4cb('0x84'));}else{_0x2141a3[_0xf4cb('0x41')](_0xf4cb('0x67'),_[_0xf4cb('0x57')](_0x202b2c,'id'));_0x599a8b[_0xf4cb('0x41')]('c.ListId\x20IN\x20?',_[_0xf4cb('0x57')](_0x202b2c,'id'));}});}else{return;}})[_0xf4cb('0x26')](function(){db[_0xf4cb('0x85')][_0xf4cb('0x38')](_0x2141a3[_0xf4cb('0x86')](),_0x38a906)[_0xf4cb('0x26')](function(_0x3fd469){_0x1393db[_0xf4cb('0x87')]=_0x3fd469['length'];if(_0x1393db['count']===0x0)return[];return db[_0xf4cb('0x85')]['query'](_0x43bea3[_0xf4cb('0x86')](),_0x38a906);})[_0xf4cb('0x26')](function(_0x5dc35e){_0x12f17d=_['keyBy'](_0x5dc35e,'id');_0x38a906=_[_0xf4cb('0x88')](_0x38a906,{'model':db[_0xf4cb('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ae55b[_0xf4cb('0x38')][_0xf4cb('0x3c')]){_0x39db54[_0xf4cb('0x3b')][_0xf4cb('0x58')](function(_0x28627e){_0x599a8b[_0xf4cb('0x44')]('c.'+_0x28627e);});}else{_0x599a8b[_0xf4cb('0x44')]('c.id');_0x599a8b[_0xf4cb('0x44')](_0xf4cb('0x89'));_0x599a8b[_0xf4cb('0x44')]('c.lastName');_0x599a8b['field']('c.phone');_0x599a8b[_0xf4cb('0x44')](_0xf4cb('0x8a'));_0x599a8b[_0xf4cb('0x44')]('c.fax');_0x599a8b[_0xf4cb('0x44')]('c.email');_0x599a8b['field'](_0xf4cb('0x8b'));_0x599a8b['field'](_0xf4cb('0x8c'));_0x599a8b[_0xf4cb('0x44')](_0xf4cb('0x8d'),_0xf4cb('0x8e'));}if(_0x39db54[_0xf4cb('0x3e')])_0x599a8b[_0xf4cb('0x3e')](_0x39db54[_0xf4cb('0x3e')]);if(_0x39db54[_0xf4cb('0x21')])_0x599a8b[_0xf4cb('0x21')](_0x39db54[_0xf4cb('0x21')]);return db[_0xf4cb('0x85')][_0xf4cb('0x38')](_0x599a8b[_0xf4cb('0x86')](),_0x38a906);})[_0xf4cb('0x26')](function(_0x42f7c2){_0x42f7c2[_0xf4cb('0x58')](function(_0x211c15){if(_0x211c15['TagIds']){_0x211c15['Tags']=[];_0x211c15[_0xf4cb('0x8e')][_0xf4cb('0x56')](',')['forEach'](function(_0x344655){_0x211c15[_0xf4cb('0x8f')][_0xf4cb('0x31')](_0x12f17d[_0x344655]);});}delete _0x211c15[_0xf4cb('0x8e')];});_0x1393db['rows']=_0x42f7c2;return _0x1393db;})[_0xf4cb('0x26')](respondWithFilteredResult(_0x4aa719,_0x39db54));});})['catch'](handleError(_0x4aa719,null));};exports[_0xf4cb('0x27')]=function(_0x1e7a20,_0x15818b){return db[_0xf4cb('0x2c')][_0xf4cb('0x53')]({'where':{'id':_0x1e7a20[_0xf4cb('0x90')]['id']}})['then'](handleEntityNotFound(_0x15818b,null))[_0xf4cb('0x26')](removeEntity(_0x15818b,null))[_0xf4cb('0x91')](handleError(_0x15818b,null));};exports[_0xf4cb('0x2d')]=function(_0x23a08c,_0x5d98b6){return db[_0xf4cb('0x2c')][_0xf4cb('0x2d')]()['then'](function(_0x451078){delete _0x451078[_0xf4cb('0x92')];for(var _0x5d1a89=0x0;_0x5d1a89=_0x12ce06){_0x3873b1=_0x12ce06;_0x20155a=0xc8;}else{_0x20155a=0xce;}_0x4387b0['status'](_0x20155a);return _0x4387b0[_0x87bc('0x1f')](_0x87bc('0x20'),_0x32d198+'-'+_0x3873b1+'/'+_0x12ce06)['json'](_0x42faf5);}return null;};}function patchUpdates(_0x16f8ef){return function(_0x19b4e1){try{jsonpatch['apply'](_0x19b4e1,_0x16f8ef,!![]);}catch(_0x3c2b19){return BPromise[_0x87bc('0x21')](_0x3c2b19);}return _0x19b4e1['save']();};}function saveUpdates(_0x5cdfcc,_0x38c9c9){return function(_0x475285){if(_0x475285){return _0x475285['update'](_0x5cdfcc)[_0x87bc('0x22')](function(_0x99f7e){return _0x99f7e;});}return null;};}function removeEntity(_0x161610,_0x12bdc6){return function(_0x113506){if(_0x113506){return _0x113506[_0x87bc('0x23')]()[_0x87bc('0x22')](function(){_0x161610[_0x87bc('0x1b')](0xcc)[_0x87bc('0x24')]();});}};}function handleEntityNotFound(_0x22ba3a,_0x13e6b4){return function(_0x138d1f){if(!_0x138d1f){_0x22ba3a[_0x87bc('0x1a')](0x194);}return _0x138d1f;};}function handleError(_0x136e1c,_0x1022d6){_0x1022d6=_0x1022d6||0x1f4;return function(_0x173fb9){logger['error'](_0x173fb9[_0x87bc('0x25')]);if(_0x173fb9[_0x87bc('0x26')]){delete _0x173fb9[_0x87bc('0x26')];}_0x136e1c['status'](_0x1022d6)['send'](_0x173fb9);};}exports[_0x87bc('0x27')]=function(_0x1640df,_0x542215){var _0xf0e9b4={},_0x274b7b={},_0x40a7fb={'count':0x0,'rows':[]};return db[_0x87bc('0x28')][_0x87bc('0x29')]()['then'](function(_0x3dd303){var _0x31eb99=[];for(var _0x9a04fe=0x0;_0x9a04fe0x1){_0x2e30dc['or'](_0x87bc('0x65'),qs['getFullTextValue'](_0x3e6971),null);}else{if(qs[_0x87bc('0x66')](_0x3e6971)){_0x2e30dc['or'](_0x87bc('0x67'),_0x3e6971+'%');_0x2e30dc['or']('c.phone\x20LIKE\x20?',_0x3e6971+'%');_0x2e30dc['or'](_0x87bc('0x68'),_0x3e6971+'%');_0x2e30dc['or']('c.fax\x20LIKE\x20?',_0x3e6971+'%');}else if(qs[_0x87bc('0x69')](_0x3e6971)){_0x2e30dc['or'](_0x87bc('0x6a'),_0x3e6971+'%');}else{_0x2e30dc['or'](_0x87bc('0x6b'),'%'+_0x3e6971+'%');_0x2e30dc['or'](_0x87bc('0x6c'),'%'+_0x3e6971+'%');_0x2e30dc['or']('c.email\x20LIKE\x20?','%'+_0x3e6971+'%');}}}}_0x5c387a[_0x87bc('0x3d')](_0x2e30dc);_0x5c387a['group'](_0x87bc('0x6d'));var _0x3e4744={'type':db[_0x87bc('0x6e')]['QueryTypes'][_0x87bc('0x6f')],'raw':!![]};var _0x5cf3a3=_0x5c387a[_0x87bc('0x70')]()[_0x87bc('0x3e')](_0x87bc('0x6d'));if(_0xf0e9b4[_0x87bc('0x71')]){_0xf0e9b4[_0x87bc('0x71')][_0x87bc('0x50')](function(_0x5bf9b5){_0x5c387a[_0x87bc('0x71')]('c.'+_0x5bf9b5[0x0],_0x5bf9b5[0x1]===_0x87bc('0x72')?![]:!![]);});}if(!_[_0x87bc('0x5b')](_0x27358f)){_0x5c387a['having'](_0x56c8fb);_0x5cf3a3[_0x87bc('0x3d')](_0x87bc('0x73'),_0x27358f);}BPromise[_0x87bc('0x74')]()['then'](function(){if(_0x3862d5&&!_[_0x87bc('0x75')](_0x3862d5['conditions'],[_0x87bc('0x3e'),'User'])){return _0x1640df[_0x87bc('0x76')][_0x87bc('0x77')]({'attributes':['id'],'raw':!![]})['then'](function(_0xa574f2){if(_[_0x87bc('0x5b')](_0xa574f2)){_0x5cf3a3[_0x87bc('0x3d')](_0x87bc('0x78'));_0x5c387a[_0x87bc('0x3d')](_0x87bc('0x78'));}else{_0x5cf3a3[_0x87bc('0x3d')](_0x87bc('0x5d'),_[_0x87bc('0x4f')](_0xa574f2,'id'));_0x5c387a[_0x87bc('0x3d')](_0x87bc('0x5d'),_[_0x87bc('0x4f')](_0xa574f2,'id'));}});}else{return;}})[_0x87bc('0x22')](function(){db['sequelize']['query'](_0x5cf3a3[_0x87bc('0x79')](),_0x3e4744)[_0x87bc('0x22')](function(_0x10a627){_0x40a7fb[_0x87bc('0x1d')]=_0x10a627[_0x87bc('0x38')];if(_0x40a7fb[_0x87bc('0x1d')]===0x0)return[];return db[_0x87bc('0x7a')]['query'](_0x374a56[_0x87bc('0x79')](),_0x3e4744);})[_0x87bc('0x22')](function(_0x45e83c){_0x3b9308=_['keyBy'](_0x45e83c,'id');_0x3e4744=_['merge'](_0x3e4744,{'model':db[_0x87bc('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1640df[_0x87bc('0x33')][_0x87bc('0x37')]){_0xf0e9b4[_0x87bc('0x36')][_0x87bc('0x50')](function(_0xa9a8aa){_0x5c387a[_0x87bc('0x3e')]('c.'+_0xa9a8aa);});}else{_0x5c387a[_0x87bc('0x3e')](_0x87bc('0x6d'));_0x5c387a['field'](_0x87bc('0x7b'));_0x5c387a[_0x87bc('0x3e')](_0x87bc('0x7c'));_0x5c387a['field'](_0x87bc('0x7d'));_0x5c387a['field']('c.mobile');_0x5c387a[_0x87bc('0x3e')](_0x87bc('0x7e'));_0x5c387a[_0x87bc('0x3e')]('c.email');_0x5c387a[_0x87bc('0x3e')](_0x87bc('0x7f'));_0x5c387a[_0x87bc('0x3e')]('c.deletedAt');_0x5c387a[_0x87bc('0x3e')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xf0e9b4[_0x87bc('0x3b')])_0x5c387a[_0x87bc('0x3b')](_0xf0e9b4[_0x87bc('0x3b')]);if(_0xf0e9b4[_0x87bc('0x1e')])_0x5c387a[_0x87bc('0x1e')](_0xf0e9b4[_0x87bc('0x1e')]);return db['sequelize'][_0x87bc('0x33')](_0x5c387a['toString'](),_0x3e4744);})[_0x87bc('0x22')](function(_0x53fa70){_0x53fa70[_0x87bc('0x50')](function(_0x28ee77){if(_0x28ee77[_0x87bc('0x80')]){_0x28ee77['Tags']=[];_0x28ee77[_0x87bc('0x80')][_0x87bc('0x4e')](',')[_0x87bc('0x50')](function(_0x2cf774){_0x28ee77[_0x87bc('0x81')][_0x87bc('0x2c')](_0x3b9308[_0x2cf774]);});}delete _0x28ee77[_0x87bc('0x80')];});_0x40a7fb['rows']=_0x53fa70;return _0x40a7fb;})[_0x87bc('0x22')](respondWithFilteredResult(_0x542215,_0xf0e9b4));});})[_0x87bc('0x82')](handleError(_0x542215,null));};exports[_0x87bc('0x23')]=function(_0x621466,_0x46abc4){return db[_0x87bc('0x28')][_0x87bc('0x4b')]({'where':{'id':_0x621466[_0x87bc('0x83')]['id']}})['then'](handleEntityNotFound(_0x46abc4,null))[_0x87bc('0x22')](removeEntity(_0x46abc4,null))[_0x87bc('0x82')](handleError(_0x46abc4,null));};exports[_0x87bc('0x29')]=function(_0x43ce42,_0x398aad){return db[_0x87bc('0x28')]['describe']()['then'](function(_0x2bea92){delete _0x2bea92['tags'];for(var _0x4964be=0x0;_0x4964be{}\s\\|]/g,'-');_0x47e5cf(null,util[_0x9da1('0x1d')](_0x9da1('0x1e'),path['basename'](_0xe56279['originalname'],path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])));}})});router[_0x9da1('0x13')]('/csv',upload[_0x9da1('0x21')](_0x9da1('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9da1('0x23')]({'destination':function(_0x3f5680,_0x534210,_0x2fd49c){_0x2fd49c(null,path[_0x9da1('0x18')](config['root'],_0x9da1('0x1a')));},'filename':function(_0x1d6af5,_0x55cd3d,_0x5c09ed){_0x55cd3d[_0x9da1('0x1b')]=_0x55cd3d[_0x9da1('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c09ed(null,util[_0x9da1('0x1d')]('%s-%s%s',path['basename'](_0x55cd3d['originalname'],path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])));}})});router['post'](_0x9da1('0x24'),upload['single'](_0x9da1('0x22')),controller[_0x9da1('0x25')]);router['post'](_0x9da1('0x26'),auth[_0x9da1('0x7')](),controller['import']);router[_0x9da1('0x27')](_0x9da1('0x28'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x29')]);router['delete']('/:id',auth[_0x9da1('0x7')](),controller[_0x9da1('0x2a')]);module[_0x9da1('0x2b')]=router; \ No newline at end of file +var _0x207c=['/upload','upload','/upload/:id','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','/describe','isAuthenticated','/:id','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','post','/merge','merge','/create_many','bulkCreate','setTags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','diskStorage'];(function(_0x44ab1a,_0x4ecd62){var _0x2cd9cc=function(_0x5b71b1){while(--_0x5b71b1){_0x44ab1a['push'](_0x44ab1a['shift']());}};_0x2cd9cc(++_0x4ecd62);}(_0x207c,0x1e8));var _0xc207=function(_0x3ae1a9,_0x3f6243){_0x3ae1a9=_0x3ae1a9-0x0;var _0x36b7e4=_0x207c[_0x3ae1a9];return _0x36b7e4;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['describe']);router[_0xc207('0x8')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0x8')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0x8')](_0xc207('0xe'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0xc207('0xf'),auth['isAuthenticated'](),controller[_0xc207('0x10')]);router[_0xc207('0x8')]('/:id/hopper_finals',auth[_0xc207('0xa')](),controller[_0xc207('0x11')]);router[_0xc207('0x8')](_0xc207('0x12'),auth[_0xc207('0xa')](),controller['getJscriptySessions']);router[_0xc207('0x13')](_0xc207('0x14'),auth[_0xc207('0xa')](),controller[_0xc207('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc207('0x13')](_0xc207('0x16'),auth[_0xc207('0xa')](),controller[_0xc207('0x17')]);router['post'](_0xc207('0xc'),auth[_0xc207('0xa')](),controller[_0xc207('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4129b8,_0x488cc0,_0x42c8ba){_0x42c8ba(null,path[_0xc207('0x19')](config[_0xc207('0x1a')],_0xc207('0x1b')));},'filename':function(_0xce0770,_0x2caec5,_0x35c0b0){_0x2caec5[_0xc207('0x1c')]=_0x2caec5[_0xc207('0x1c')][_0xc207('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x35c0b0(null,util[_0xc207('0x1e')](_0xc207('0x1f'),path[_0xc207('0x20')](_0x2caec5['originalname'],path[_0xc207('0x21')](_0x2caec5['originalname'])),Date[_0xc207('0x22')](),path[_0xc207('0x21')](_0x2caec5[_0xc207('0x1c')])));}})});router[_0xc207('0x13')](_0xc207('0x23'),upload[_0xc207('0x24')](_0xc207('0x25')),controller[_0xc207('0x26')]);var upload=multer({'storage':multer[_0xc207('0x27')]({'destination':function(_0x2385f7,_0x25c91e,_0x27df03){_0x27df03(null,path[_0xc207('0x19')](config[_0xc207('0x1a')],_0xc207('0x1b')));},'filename':function(_0x56a066,_0x1e1440,_0x5e0bd1){_0x1e1440['originalname']=_0x1e1440[_0xc207('0x1c')][_0xc207('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e0bd1(null,util[_0xc207('0x1e')](_0xc207('0x1f'),path[_0xc207('0x20')](_0x1e1440['originalname'],path[_0xc207('0x21')](_0x1e1440[_0xc207('0x1c')])),Date[_0xc207('0x22')](),path[_0xc207('0x21')](_0x1e1440[_0xc207('0x1c')])));}})});router[_0xc207('0x13')](_0xc207('0x28'),upload[_0xc207('0x24')](_0xc207('0x25')),controller[_0xc207('0x29')]);router[_0xc207('0x13')](_0xc207('0x2a'),auth[_0xc207('0xa')](),controller['import']);router[_0xc207('0x2b')](_0xc207('0xb'),auth[_0xc207('0xa')](),controller[_0xc207('0x2c')]);router[_0xc207('0x2d')](_0xc207('0xb'),auth['isAuthenticated'](),controller[_0xc207('0x2e')]);module[_0xc207('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 897ee37..60892ff 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 _0xdb70=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x518021,_0x58e940){var _0x1bc753=function(_0x4de6ea){while(--_0x4de6ea){_0x518021['push'](_0x518021['shift']());}};_0x1bc753(++_0x58e940);}(_0xdb70,0xa0));var _0x0db7=function(_0x2ffad6,_0x137196){_0x2ffad6=_0x2ffad6-0x0;var _0x31cfaa=_0xdb70[_0x2ffad6];return _0x31cfaa;};'use strict';var Sequelize=require(_0x0db7('0x0'));module[_0x0db7('0x1')]={'CmContactId':{'type':Sequelize[_0x0db7('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0db7('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0db7('0x3')],'defaultValue':_0x0db7('0x4')},'OrderBy':{'type':Sequelize[_0x0db7('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xa4bd=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xa4bd,0x1e4));var _0xda4b=function(_0x42c8a3,_0xd80dba){_0x42c8a3=_0x42c8a3-0x0;var _0xdec30e=_0xa4bd[_0x42c8a3];return _0xdec30e;};'use strict';var Sequelize=require(_0xda4b('0x0'));module[_0xda4b('0x1')]={'CmContactId':{'type':Sequelize[_0xda4b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xda4b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xda4b('0x3')],'defaultValue':_0xda4b('0x4')},'OrderBy':{'type':Sequelize[_0xda4b('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 b5ae268..fab7325 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 _0xef5a=['then','CmContactHasItems','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','CmContactHasItem','count','includeAll','findAll','rows','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','set','json','apply','reject','save','update'];(function(_0x7e29fa,_0x4cbf11){var _0x16b27c=function(_0x10a4ce){while(--_0x10a4ce){_0x7e29fa['push'](_0x7e29fa['shift']());}};_0x16b27c(++_0x4cbf11);}(_0xef5a,0x1e0));var _0xaef5=function(_0xc15a99,_0x47af96){_0xc15a99=_0xc15a99-0x0;var _0x9d4e28=_0xef5a[_0xc15a99];return _0x9d4e28;};'use strict';var pdf=require(_0xaef5('0x0'));var emlformat=require(_0xaef5('0x1'));var rimraf=require(_0xaef5('0x2'));var zipdir=require(_0xaef5('0x3'));var jsonpatch=require(_0xaef5('0x4'));var rp=require(_0xaef5('0x5'));var moment=require(_0xaef5('0x6'));var BPromise=require(_0xaef5('0x7'));var Mustache=require(_0xaef5('0x8'));var util=require('util');var path=require(_0xaef5('0x9'));var sox=require(_0xaef5('0xa'));var csv=require(_0xaef5('0xb'));var ejs=require(_0xaef5('0xc'));var fs=require('fs');var _=require(_0xaef5('0xd'));var squel=require(_0xaef5('0xe'));var crypto=require('crypto');var jsforce=require(_0xaef5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaef5('0xb'));var querystring=require(_0xaef5('0x10'));var Papa=require(_0xaef5('0x11'));var Redis=require(_0xaef5('0x12'));var authService=require(_0xaef5('0x13'));var qs=require(_0xaef5('0x14'));var as=require(_0xaef5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaef5('0x16'))(_0xaef5('0x17'));var utils=require(_0xaef5('0x18'));var config=require(_0xaef5('0x19'));var db=require(_0xaef5('0x1a'))['db'];function respondWithStatusCode(_0x518790,_0x4ec5fd){_0x4ec5fd=_0x4ec5fd||0xcc;return function(_0x55f600){if(_0x55f600){return _0x518790['sendStatus'](_0x4ec5fd);}return _0x518790[_0xaef5('0x1b')](_0x4ec5fd)['end']();};}function respondWithResult(_0x3b215f,_0x560b44){_0x560b44=_0x560b44||0xc8;return function(_0x28c9b8){if(_0x28c9b8){return _0x3b215f['status'](_0x560b44)['json'](_0x28c9b8);}};}function respondWithFilteredResult(_0x498c93,_0xce318a){return function(_0x1c33b5){if(_0x1c33b5){var _0x134fc9=_0x1c33b5['count'],_0x38b32e=_0xce318a[_0xaef5('0x1c')],_0x5983c0=_0xce318a[_0xaef5('0x1c')]+_0xce318a[_0xaef5('0x1d')],_0xf14be;if(_0x5983c0>=_0x134fc9){_0x5983c0=_0x134fc9;_0xf14be=0xc8;}else{_0xf14be=0xce;}_0x498c93[_0xaef5('0x1b')](_0xf14be);return _0x498c93[_0xaef5('0x1e')]('Content-Range',_0x38b32e+'-'+_0x5983c0+'/'+_0x134fc9)[_0xaef5('0x1f')](_0x1c33b5);}return null;};}function patchUpdates(_0x46b535){return function(_0x46da0c){try{jsonpatch[_0xaef5('0x20')](_0x46da0c,_0x46b535,!![]);}catch(_0x5accb3){return BPromise[_0xaef5('0x21')](_0x5accb3);}return _0x46da0c[_0xaef5('0x22')]();};}function saveUpdates(_0xd07e20,_0x27d37c){return function(_0x493c7d){if(_0x493c7d){return _0x493c7d[_0xaef5('0x23')](_0xd07e20)['then'](function(_0x2e881f){return _0x2e881f;});}return null;};}function removeEntity(_0xea66f2,_0x3c62fb){return function(_0x384497){if(_0x384497){return _0x384497['destroy']()[_0xaef5('0x24')](function(){var _0x47b28d=_0x384497['get']({'plain':!![]});var _0x32d62c=_0xaef5('0x25');return db[_0xaef5('0x26')][_0xaef5('0x27')]({'where':{'type':_0x32d62c,'resourceId':_0x47b28d['id']}})[_0xaef5('0x24')](function(){return _0x384497;});})[_0xaef5('0x24')](function(){_0xea66f2['status'](0xcc)[_0xaef5('0x28')]();});}};}function handleEntityNotFound(_0x10559c,_0x3465e7){return function(_0xb788a1){if(!_0xb788a1){_0x10559c[_0xaef5('0x29')](0x194);}return _0xb788a1;};}function handleError(_0x195283,_0x50e681){_0x50e681=_0x50e681||0x1f4;return function(_0x2fac49){logger[_0xaef5('0x2a')](_0x2fac49[_0xaef5('0x2b')]);if(_0x2fac49['name']){delete _0x2fac49[_0xaef5('0x2c')];}_0x195283['status'](_0x50e681)[_0xaef5('0x2d')](_0x2fac49);};}exports[_0xaef5('0x2e')]=function(_0x5d475f,_0x510b21){var _0x35b062={},_0x4ac506={},_0x102ef7={'count':0x0,'rows':[]};var _0x17e8a2=_[_0xaef5('0x2f')](db['CmContactHasItem'][_0xaef5('0x30')],function(_0x25e754){return{'name':_0x25e754['fieldName'],'type':_0x25e754[_0xaef5('0x31')][_0xaef5('0x32')]};});_0x4ac506[_0xaef5('0x33')]=_['map'](_0x17e8a2,'name');_0x4ac506[_0xaef5('0x34')]=_[_0xaef5('0x35')](_0x5d475f[_0xaef5('0x34')]);_0x4ac506[_0xaef5('0x36')]=_[_0xaef5('0x37')](_0x4ac506[_0xaef5('0x33')],_0x4ac506[_0xaef5('0x34')]);_0x35b062[_0xaef5('0x38')]=_[_0xaef5('0x37')](_0x4ac506[_0xaef5('0x33')],qs[_0xaef5('0x39')](_0x5d475f[_0xaef5('0x34')][_0xaef5('0x39')]));_0x35b062[_0xaef5('0x38')]=_0x35b062[_0xaef5('0x38')]['length']?_0x35b062[_0xaef5('0x38')]:_0x4ac506['model'];if(!_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3a')](_0xaef5('0x3b'))){_0x35b062['limit']=qs['limit'](_0x5d475f[_0xaef5('0x34')][_0xaef5('0x1d')]);_0x35b062['offset']=qs[_0xaef5('0x1c')](_0x5d475f[_0xaef5('0x34')]['offset']);}_0x35b062['order']=qs[_0xaef5('0x3c')](_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3c')]);_0x35b062[_0xaef5('0x3d')]=qs[_0xaef5('0x36')](_['pick'](_0x5d475f[_0xaef5('0x34')],_0x4ac506[_0xaef5('0x36')]),_0x17e8a2);if(_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3e')]){_0x35b062[_0xaef5('0x3d')]=_[_0xaef5('0x3f')](_0x35b062[_0xaef5('0x3d')],{'$or':_[_0xaef5('0x2f')](_0x17e8a2,function(_0x3fb390){if(_0x3fb390['type']!==_0xaef5('0x40')){var _0x20ec60={};_0x20ec60[_0x3fb390[_0xaef5('0x2c')]]={'$like':'%'+_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3e')]+'%'};return _0x20ec60;}})});}_0x35b062=_[_0xaef5('0x3f')]({},_0x35b062,_0x5d475f[_0xaef5('0x41')]);var _0x1ec58b={'where':_0x35b062[_0xaef5('0x3d')]};return db[_0xaef5('0x42')][_0xaef5('0x43')](_0x1ec58b)[_0xaef5('0x24')](function(_0x3f8706){_0x102ef7[_0xaef5('0x43')]=_0x3f8706;if(_0x5d475f[_0xaef5('0x34')][_0xaef5('0x44')]){_0x35b062['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xaef5('0x45')](_0x35b062);})[_0xaef5('0x24')](function(_0x5d81b5){_0x102ef7[_0xaef5('0x46')]=_0x5d81b5;return _0x102ef7;})[_0xaef5('0x24')](respondWithFilteredResult(_0x510b21,_0x35b062))[_0xaef5('0x47')](handleError(_0x510b21,null));};exports[_0xaef5('0x48')]=function(_0x2111aa,_0xa823e2){var _0x143da5={'raw':!![],'where':{'id':_0x2111aa['params']['id']}},_0x400d98={};_0x400d98[_0xaef5('0x33')]=_[_0xaef5('0x35')](db[_0xaef5('0x42')][_0xaef5('0x30')]);_0x400d98[_0xaef5('0x34')]=_[_0xaef5('0x35')](_0x2111aa['query']);_0x400d98[_0xaef5('0x36')]=_[_0xaef5('0x37')](_0x400d98['model'],_0x400d98[_0xaef5('0x34')]);_0x143da5[_0xaef5('0x38')]=_[_0xaef5('0x37')](_0x400d98[_0xaef5('0x33')],qs[_0xaef5('0x39')](_0x2111aa[_0xaef5('0x34')][_0xaef5('0x39')]));_0x143da5['attributes']=_0x143da5[_0xaef5('0x38')][_0xaef5('0x49')]?_0x143da5[_0xaef5('0x38')]:_0x400d98[_0xaef5('0x33')];if(_0x2111aa[_0xaef5('0x34')]['includeAll']){_0x143da5[_0xaef5('0x4a')]=[{'all':!![]}];}_0x143da5=_[_0xaef5('0x3f')]({},_0x143da5,_0x2111aa['options']);return db[_0xaef5('0x42')][_0xaef5('0x4b')](_0x143da5)['then'](handleEntityNotFound(_0xa823e2,null))[_0xaef5('0x24')](respondWithResult(_0xa823e2,null))[_0xaef5('0x47')](handleError(_0xa823e2,null));};exports[_0xaef5('0x4c')]=function(_0x401206,_0x5a2df9){return db[_0xaef5('0x42')][_0xaef5('0x4c')](_0x401206[_0xaef5('0x4d')],{})[_0xaef5('0x24')](function(_0x2ba783){var _0x2ed3ec=_0x401206[_0xaef5('0x4e')]['get']({'plain':!![]});if(!_0x2ed3ec)throw new Error(_0xaef5('0x4f'));if(_0x2ed3ec[_0xaef5('0x50')]===_0xaef5('0x4e')){var _0x26f4bb=_0x2ba783[_0xaef5('0x51')]({'plain':!![]});var _0x5126b9=_0xaef5('0x25');return db[_0xaef5('0x52')]['find']({'where':{'name':_0x5126b9,'userProfileId':_0x2ed3ec[_0xaef5('0x53')]},'raw':!![]})[_0xaef5('0x24')](function(_0x26e76c){if(_0x26e76c&&_0x26e76c['autoAssociation']===0x0){return db[_0xaef5('0x26')][_0xaef5('0x4c')]({'name':_0x26f4bb[_0xaef5('0x2c')],'resourceId':_0x26f4bb['id'],'type':_0x26e76c[_0xaef5('0x2c')],'sectionId':_0x26e76c['id']},{})[_0xaef5('0x24')](function(){return _0x2ba783;});}else{return _0x2ba783;}})[_0xaef5('0x47')](function(_0x3e695b){logger[_0xaef5('0x2a')](_0xaef5('0x54'),_0x3e695b);throw _0x3e695b;});}return _0x2ba783;})['then'](respondWithResult(_0x5a2df9,0xc9))[_0xaef5('0x47')](handleError(_0x5a2df9,null));};exports[_0xaef5('0x23')]=function(_0x1fc50f,_0x22a5b4){if(_0x1fc50f[_0xaef5('0x4d')]['id']){delete _0x1fc50f[_0xaef5('0x4d')]['id'];}return db[_0xaef5('0x42')]['find']({'where':{'id':_0x1fc50f[_0xaef5('0x55')]['id']}})['then'](handleEntityNotFound(_0x22a5b4,null))[_0xaef5('0x24')](saveUpdates(_0x1fc50f[_0xaef5('0x4d')],null))[_0xaef5('0x24')](respondWithResult(_0x22a5b4,null))[_0xaef5('0x47')](handleError(_0x22a5b4,null));};exports[_0xaef5('0x27')]=function(_0x433fcc,_0x83dc87){return db[_0xaef5('0x42')][_0xaef5('0x4b')]({'where':{'id':_0x433fcc[_0xaef5('0x55')]['id']}})['then'](handleEntityNotFound(_0x83dc87,null))[_0xaef5('0x24')](removeEntity(_0x83dc87,null))['catch'](handleError(_0x83dc87,null));}; \ No newline at end of file +var _0xe23b=['to-csv','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','status','end','json','count','offset','limit','set','apply','save','update','then','CmContactHasItems','destroy','sendStatus','error','stack','name','send','index','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','CmContactHasItem','includeAll','rows','show','include','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3f3fc0,_0x159820){var _0x52a339=function(_0x1d738d){while(--_0x1d738d){_0x3f3fc0['push'](_0x3f3fc0['shift']());}};_0x52a339(++_0x159820);}(_0xe23b,0x181));var _0xbe23=function(_0x751edd,_0x4dc970){_0x751edd=_0x751edd-0x0;var _0x350ab2=_0xe23b[_0x751edd];return _0x350ab2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbe23('0x0'));var rimraf=require(_0xbe23('0x1'));var zipdir=require(_0xbe23('0x2'));var jsonpatch=require(_0xbe23('0x3'));var rp=require('request-promise');var moment=require(_0xbe23('0x4'));var BPromise=require(_0xbe23('0x5'));var Mustache=require(_0xbe23('0x6'));var util=require(_0xbe23('0x7'));var path=require(_0xbe23('0x8'));var sox=require(_0xbe23('0x9'));var csv=require(_0xbe23('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbe23('0xb'));var crypto=require(_0xbe23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe23('0xd'));var toCsv=require(_0xbe23('0xa'));var querystring=require(_0xbe23('0xe'));var Papa=require(_0xbe23('0xf'));var Redis=require(_0xbe23('0x10'));var authService=require(_0xbe23('0x11'));var qs=require(_0xbe23('0x12'));var as=require(_0xbe23('0x13'));var hardwareService=require(_0xbe23('0x14'));var logger=require('../../config/logger')(_0xbe23('0x15'));var utils=require(_0xbe23('0x16'));var config=require(_0xbe23('0x17'));var db=require(_0xbe23('0x18'))['db'];function respondWithStatusCode(_0x3646d3,_0x25b636){_0x25b636=_0x25b636||0xcc;return function(_0x14d293){if(_0x14d293){return _0x3646d3['sendStatus'](_0x25b636);}return _0x3646d3[_0xbe23('0x19')](_0x25b636)[_0xbe23('0x1a')]();};}function respondWithResult(_0x50bfa3,_0x103ca2){_0x103ca2=_0x103ca2||0xc8;return function(_0x12a4aa){if(_0x12a4aa){return _0x50bfa3['status'](_0x103ca2)[_0xbe23('0x1b')](_0x12a4aa);}};}function respondWithFilteredResult(_0x3696d6,_0x5ae51a){return function(_0x211e6b){if(_0x211e6b){var _0x40bee3=_0x211e6b[_0xbe23('0x1c')],_0x5b8556=_0x5ae51a[_0xbe23('0x1d')],_0x7a780f=_0x5ae51a['offset']+_0x5ae51a[_0xbe23('0x1e')],_0x5a76e8;if(_0x7a780f>=_0x40bee3){_0x7a780f=_0x40bee3;_0x5a76e8=0xc8;}else{_0x5a76e8=0xce;}_0x3696d6[_0xbe23('0x19')](_0x5a76e8);return _0x3696d6[_0xbe23('0x1f')]('Content-Range',_0x5b8556+'-'+_0x7a780f+'/'+_0x40bee3)[_0xbe23('0x1b')](_0x211e6b);}return null;};}function patchUpdates(_0x4d13f6){return function(_0xc6e90e){try{jsonpatch[_0xbe23('0x20')](_0xc6e90e,_0x4d13f6,!![]);}catch(_0x19d025){return BPromise['reject'](_0x19d025);}return _0xc6e90e[_0xbe23('0x21')]();};}function saveUpdates(_0x430cad,_0x2d83bf){return function(_0x5b5c28){if(_0x5b5c28){return _0x5b5c28[_0xbe23('0x22')](_0x430cad)['then'](function(_0x1d38e9){return _0x1d38e9;});}return null;};}function removeEntity(_0x39331f,_0xc9a7a9){return function(_0x491e54){if(_0x491e54){return _0x491e54['destroy']()[_0xbe23('0x23')](function(){var _0x2df088=_0x491e54['get']({'plain':!![]});var _0x3cb25c=_0xbe23('0x24');return db['UserProfileResource'][_0xbe23('0x25')]({'where':{'type':_0x3cb25c,'resourceId':_0x2df088['id']}})[_0xbe23('0x23')](function(){return _0x491e54;});})[_0xbe23('0x23')](function(){_0x39331f[_0xbe23('0x19')](0xcc)[_0xbe23('0x1a')]();});}};}function handleEntityNotFound(_0xb481be,_0x4d59a4){return function(_0x2ca289){if(!_0x2ca289){_0xb481be[_0xbe23('0x26')](0x194);}return _0x2ca289;};}function handleError(_0x2a7d7d,_0x545077){_0x545077=_0x545077||0x1f4;return function(_0x329570){logger[_0xbe23('0x27')](_0x329570[_0xbe23('0x28')]);if(_0x329570['name']){delete _0x329570[_0xbe23('0x29')];}_0x2a7d7d[_0xbe23('0x19')](_0x545077)[_0xbe23('0x2a')](_0x329570);};}exports[_0xbe23('0x2b')]=function(_0x366ecc,_0x2db9f0){var _0x4fac0d={},_0x10f825={},_0x3089ce={'count':0x0,'rows':[]};var _0x50453f=_['map'](db['CmContactHasItem'][_0xbe23('0x2c')],function(_0x1078ff){return{'name':_0x1078ff['fieldName'],'type':_0x1078ff['type'][_0xbe23('0x2d')]};});_0x10f825[_0xbe23('0x2e')]=_['map'](_0x50453f,_0xbe23('0x29'));_0x10f825[_0xbe23('0x2f')]=_[_0xbe23('0x30')](_0x366ecc[_0xbe23('0x2f')]);_0x10f825['filters']=_[_0xbe23('0x31')](_0x10f825['model'],_0x10f825[_0xbe23('0x2f')]);_0x4fac0d[_0xbe23('0x32')]=_[_0xbe23('0x31')](_0x10f825[_0xbe23('0x2e')],qs[_0xbe23('0x33')](_0x366ecc[_0xbe23('0x2f')][_0xbe23('0x33')]));_0x4fac0d[_0xbe23('0x32')]=_0x4fac0d['attributes']['length']?_0x4fac0d['attributes']:_0x10f825[_0xbe23('0x2e')];if(!_0x366ecc['query'][_0xbe23('0x34')](_0xbe23('0x35'))){_0x4fac0d[_0xbe23('0x1e')]=qs[_0xbe23('0x1e')](_0x366ecc[_0xbe23('0x2f')][_0xbe23('0x1e')]);_0x4fac0d[_0xbe23('0x1d')]=qs['offset'](_0x366ecc[_0xbe23('0x2f')][_0xbe23('0x1d')]);}_0x4fac0d['order']=qs[_0xbe23('0x36')](_0x366ecc['query'][_0xbe23('0x36')]);_0x4fac0d[_0xbe23('0x37')]=qs[_0xbe23('0x38')](_[_0xbe23('0x39')](_0x366ecc['query'],_0x10f825[_0xbe23('0x38')]),_0x50453f);if(_0x366ecc['query'][_0xbe23('0x3a')]){_0x4fac0d[_0xbe23('0x37')]=_[_0xbe23('0x3b')](_0x4fac0d['where'],{'$or':_['map'](_0x50453f,function(_0xd77e87){if(_0xd77e87['type']!==_0xbe23('0x3c')){var _0xd741c3={};_0xd741c3[_0xd77e87[_0xbe23('0x29')]]={'$like':'%'+_0x366ecc['query'][_0xbe23('0x3a')]+'%'};return _0xd741c3;}})});}_0x4fac0d=_['merge']({},_0x4fac0d,_0x366ecc['options']);var _0x381285={'where':_0x4fac0d[_0xbe23('0x37')]};return db[_0xbe23('0x3d')][_0xbe23('0x1c')](_0x381285)[_0xbe23('0x23')](function(_0x5e063c){_0x3089ce[_0xbe23('0x1c')]=_0x5e063c;if(_0x366ecc['query'][_0xbe23('0x3e')]){_0x4fac0d['include']=[{'all':!![]}];}return db[_0xbe23('0x3d')]['findAll'](_0x4fac0d);})['then'](function(_0xa7b15c){_0x3089ce[_0xbe23('0x3f')]=_0xa7b15c;return _0x3089ce;})[_0xbe23('0x23')](respondWithFilteredResult(_0x2db9f0,_0x4fac0d))['catch'](handleError(_0x2db9f0,null));};exports[_0xbe23('0x40')]=function(_0x1b659a,_0x246cf9){var _0x5b3291={'raw':!![],'where':{'id':_0x1b659a['params']['id']}},_0x2fc4e8={};_0x2fc4e8['model']=_[_0xbe23('0x30')](db[_0xbe23('0x3d')][_0xbe23('0x2c')]);_0x2fc4e8[_0xbe23('0x2f')]=_['keys'](_0x1b659a[_0xbe23('0x2f')]);_0x2fc4e8[_0xbe23('0x38')]=_['intersection'](_0x2fc4e8[_0xbe23('0x2e')],_0x2fc4e8[_0xbe23('0x2f')]);_0x5b3291[_0xbe23('0x32')]=_[_0xbe23('0x31')](_0x2fc4e8['model'],qs[_0xbe23('0x33')](_0x1b659a[_0xbe23('0x2f')]['fields']));_0x5b3291[_0xbe23('0x32')]=_0x5b3291[_0xbe23('0x32')]['length']?_0x5b3291[_0xbe23('0x32')]:_0x2fc4e8[_0xbe23('0x2e')];if(_0x1b659a['query']['includeAll']){_0x5b3291[_0xbe23('0x41')]=[{'all':!![]}];}_0x5b3291=_[_0xbe23('0x3b')]({},_0x5b3291,_0x1b659a[_0xbe23('0x42')]);return db[_0xbe23('0x3d')][_0xbe23('0x43')](_0x5b3291)[_0xbe23('0x23')](handleEntityNotFound(_0x246cf9,null))['then'](respondWithResult(_0x246cf9,null))[_0xbe23('0x44')](handleError(_0x246cf9,null));};exports[_0xbe23('0x45')]=function(_0x3159e5,_0xa8a2b5){return db[_0xbe23('0x3d')][_0xbe23('0x45')](_0x3159e5[_0xbe23('0x46')],{})[_0xbe23('0x23')](function(_0x5870f1){var _0x53f0ae=_0x3159e5[_0xbe23('0x47')][_0xbe23('0x48')]({'plain':!![]});if(!_0x53f0ae)throw new Error(_0xbe23('0x49'));if(_0x53f0ae[_0xbe23('0x4a')]==='user'){var _0x282bd5=_0x5870f1[_0xbe23('0x48')]({'plain':!![]});var _0x1e1806=_0xbe23('0x24');return db[_0xbe23('0x4b')][_0xbe23('0x43')]({'where':{'name':_0x1e1806,'userProfileId':_0x53f0ae['userProfileId']},'raw':!![]})[_0xbe23('0x23')](function(_0x3e453f){if(_0x3e453f&&_0x3e453f[_0xbe23('0x4c')]===0x0){return db[_0xbe23('0x4d')][_0xbe23('0x45')]({'name':_0x282bd5[_0xbe23('0x29')],'resourceId':_0x282bd5['id'],'type':_0x3e453f['name'],'sectionId':_0x3e453f['id']},{})[_0xbe23('0x23')](function(){return _0x5870f1;});}else{return _0x5870f1;}})[_0xbe23('0x44')](function(_0x44f4a3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44f4a3);throw _0x44f4a3;});}return _0x5870f1;})['then'](respondWithResult(_0xa8a2b5,0xc9))[_0xbe23('0x44')](handleError(_0xa8a2b5,null));};exports['update']=function(_0x35f3be,_0x374a58){if(_0x35f3be[_0xbe23('0x46')]['id']){delete _0x35f3be[_0xbe23('0x46')]['id'];}return db[_0xbe23('0x3d')][_0xbe23('0x43')]({'where':{'id':_0x35f3be['params']['id']}})[_0xbe23('0x23')](handleEntityNotFound(_0x374a58,null))[_0xbe23('0x23')](saveUpdates(_0x35f3be['body'],null))['then'](respondWithResult(_0x374a58,null))[_0xbe23('0x44')](handleError(_0x374a58,null));};exports['destroy']=function(_0x229b63,_0xcab447){return db[_0xbe23('0x3d')][_0xbe23('0x43')]({'where':{'id':_0x229b63[_0xbe23('0x4e')]['id']}})[_0xbe23('0x23')](handleEntityNotFound(_0xcab447,null))[_0xbe23('0x23')](removeEntity(_0xcab447,null))[_0xbe23('0x44')](handleError(_0xcab447,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index fc9108c..c6d42b7 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 _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x4ab50c,_0x1185aa){var _0x45a39a=function(_0x2dd5a3){while(--_0x2dd5a3){_0x4ab50c['push'](_0x4ab50c['shift']());}};_0x45a39a(++_0x1185aa);}(_0x323f,0x1ee));var _0xf323=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x323f[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3906da,_0x2e3915){var _0x56e09c=function(_0x4d503e){while(--_0x4d503e){_0x3906da['push'](_0x3906da['shift']());}};_0x56e09c(++_0x2e3915);}(_0x7046,0x144));var _0x6704=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7046[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'cm_contact_has_items','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 49103f9..1ee2b2c 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 _0x26ae=['client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x26ae,0x73));var _0xe26a=function(_0x41e52a,_0x2de181){_0x41e52a=_0x41e52a-0x0;var _0x45c51d=_0x26ae[_0x41e52a];return _0x45c51d;};'use strict';var _=require(_0xe26a('0x0'));var util=require(_0xe26a('0x1'));var moment=require(_0xe26a('0x2'));var BPromise=require(_0xe26a('0x3'));var rs=require(_0xe26a('0x4'));var fs=require('fs');var Redis=require(_0xe26a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe26a('0x6'));var logger=require(_0xe26a('0x7'))(_0xe26a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe26a('0x9'));var client=jayson[_0xe26a('0xa')][_0xe26a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b560,_0x437063,_0x51e187){return new BPromise(function(_0x4adc60,_0x1ab7b8){return client[_0xe26a('0xc')](_0x56b560,_0x51e187)[_0xe26a('0xd')](function(_0x4c307c){logger[_0xe26a('0xe')](_0xe26a('0xf'),_0x437063,_0xe26a('0x10'));logger[_0xe26a('0x11')](_0xe26a('0x12'),_0x437063,_0xe26a('0x10'),JSON[_0xe26a('0x13')](_0x4c307c));if(_0x4c307c['error']){if(_0x4c307c[_0xe26a('0x14')][_0xe26a('0x15')]===0x1f4){logger['error'](_0xe26a('0xf'),_0x437063,_0x4c307c['error']['message']);return _0x1ab7b8(_0x4c307c[_0xe26a('0x14')][_0xe26a('0x16')]);}logger['error'](_0xe26a('0xf'),_0x437063,_0x4c307c[_0xe26a('0x14')][_0xe26a('0x16')]);return _0x4adc60(_0x4c307c[_0xe26a('0x14')][_0xe26a('0x16')]);}else{logger[_0xe26a('0xe')](_0xe26a('0xf'),_0x437063,'request\x20sent');_0x4adc60(_0x4c307c[_0xe26a('0x17')]['message']);}})[_0xe26a('0x18')](function(_0x38916a){logger['error'](_0xe26a('0xf'),_0x437063,_0x38916a);_0x1ab7b8(_0x38916a);});});} \ No newline at end of file +var _0xc910=['../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4dd0a7,_0xb4399f){var _0x487e9b=function(_0x355738){while(--_0x355738){_0x4dd0a7['push'](_0x4dd0a7['shift']());}};_0x487e9b(++_0xb4399f);}(_0xc910,0x109));var _0x0c91=function(_0x42f038,_0x242ecb){_0x42f038=_0x42f038-0x0;var _0xcfc343=_0xc910[_0x42f038];return _0xcfc343;};'use strict';var _=require(_0x0c91('0x0'));var util=require(_0x0c91('0x1'));var moment=require(_0x0c91('0x2'));var BPromise=require(_0x0c91('0x3'));var rs=require(_0x0c91('0x4'));var fs=require('fs');var Redis=require(_0x0c91('0x5'));var db=require(_0x0c91('0x6'))['db'];var utils=require(_0x0c91('0x7'));var logger=require(_0x0c91('0x8'))(_0x0c91('0x9'));var config=require(_0x0c91('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0c91('0xb')][_0x0c91('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xad809f,_0x2cd449,_0x143b03){return new BPromise(function(_0x57803d,_0x3a5df7){return client[_0x0c91('0xd')](_0xad809f,_0x143b03)[_0x0c91('0xe')](function(_0x313e6a){logger[_0x0c91('0xf')](_0x0c91('0x10'),_0x2cd449,_0x0c91('0x11'));logger[_0x0c91('0x12')](_0x0c91('0x13'),_0x2cd449,'request\x20sent',JSON[_0x0c91('0x14')](_0x313e6a));if(_0x313e6a['error']){if(_0x313e6a['error']['code']===0x1f4){logger[_0x0c91('0x15')](_0x0c91('0x10'),_0x2cd449,_0x313e6a[_0x0c91('0x15')]['message']);return _0x3a5df7(_0x313e6a['error'][_0x0c91('0x16')]);}logger[_0x0c91('0x15')](_0x0c91('0x10'),_0x2cd449,_0x313e6a[_0x0c91('0x15')][_0x0c91('0x16')]);return _0x57803d(_0x313e6a[_0x0c91('0x15')][_0x0c91('0x16')]);}else{logger[_0x0c91('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x2cd449,_0x0c91('0x11'));_0x57803d(_0x313e6a[_0x0c91('0x17')]['message']);}})[_0x0c91('0x18')](function(_0x4178d3){logger[_0x0c91('0x15')](_0x0c91('0x10'),_0x2cd449,_0x4178d3);_0x3a5df7(_0x4178d3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index f1b0759..8604b7f 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 _0x882a=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create'];(function(_0x464ee6,_0x498f85){var _0x34d7f0=function(_0x18683e){while(--_0x18683e){_0x464ee6['push'](_0x464ee6['shift']());}};_0x34d7f0(++_0x498f85);}(_0x882a,0x95));var _0xa882=function(_0x379a3d,_0x439b33){_0x379a3d=_0x379a3d-0x0;var _0x3acb8=_0x882a[_0x379a3d];return _0x3acb8;};'use strict';var multer=require(_0xa882('0x0'));var util=require('util');var path=require(_0xa882('0x1'));var timeout=require(_0xa882('0x2'));var express=require(_0xa882('0x3'));var router=express['Router']();var auth=require(_0xa882('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa882('0x5'));var controller=require(_0xa882('0x6'));router[_0xa882('0x7')]('/',auth[_0xa882('0x8')](),controller[_0xa882('0x9')]);router[_0xa882('0x7')]('/:id',auth[_0xa882('0x8')](),controller[_0xa882('0xa')]);router[_0xa882('0xb')]('/',auth[_0xa882('0x8')](),controller[_0xa882('0xc')]);router[_0xa882('0xd')](_0xa882('0xe'),auth[_0xa882('0x8')](),controller[_0xa882('0xf')]);router[_0xa882('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa882('0x11')]=router; \ No newline at end of file +var _0x4504=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete','exports','util','connect-timeout'];(function(_0x31d7c6,_0x449d6c){var _0x3805e1=function(_0x58e685){while(--_0x58e685){_0x31d7c6['push'](_0x31d7c6['shift']());}};_0x3805e1(++_0x449d6c);}(_0x4504,0xd0));var _0x4450=function(_0x173fa1,_0x49d291){_0x173fa1=_0x173fa1-0x0;var _0x1c8131=_0x4504[_0x173fa1];return _0x1c8131;};'use strict';var multer=require('multer');var util=require(_0x4450('0x0'));var path=require('path');var timeout=require(_0x4450('0x1'));var express=require(_0x4450('0x2'));var router=express[_0x4450('0x3')]();var auth=require(_0x4450('0x4'));var interaction=require(_0x4450('0x5'));var config=require(_0x4450('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x4450('0x7')]('/',auth[_0x4450('0x8')](),controller['index']);router[_0x4450('0x7')](_0x4450('0x9'),auth['isAuthenticated'](),controller[_0x4450('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4450('0xb')](_0x4450('0x9'),auth[_0x4450('0x8')](),controller[_0x4450('0xc')]);router[_0x4450('0xd')](_0x4450('0x9'),auth[_0x4450('0x8')](),controller['destroy']);module[_0x4450('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index be8b7aa..cc8b030 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 _0x5eac=['INTEGER','sequelize','exports'];(function(_0x19258b,_0x22e850){var _0x5be66a=function(_0x24e321){while(--_0x24e321){_0x19258b['push'](_0x19258b['shift']());}};_0x5be66a(++_0x22e850);}(_0x5eac,0x85));var _0xc5ea=function(_0x353ca6,_0x1bf806){_0x353ca6=_0x353ca6-0x0;var _0x314a39=_0x5eac[_0x353ca6];return _0x314a39;};'use strict';var Sequelize=require(_0xc5ea('0x0'));module[_0xc5ea('0x1')]={'CmContactId':{'type':Sequelize[_0xc5ea('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xc238=['exports','INTEGER'];(function(_0x511a1f,_0xe41713){var _0x577061=function(_0xc402c4){while(--_0xc402c4){_0x511a1f['push'](_0x511a1f['shift']());}};_0x577061(++_0xe41713);}(_0xc238,0x16c));var _0x8c23=function(_0x641711,_0x5c4912){_0x641711=_0x641711-0x0;var _0x3a6d79=_0xc238[_0x641711];return _0x3a6d79;};'use strict';var Sequelize=require('sequelize');module[_0x8c23('0x0')]={'CmContactId':{'type':Sequelize[_0x8c23('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'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 ed8c40e..dfeed08 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 _0x810d=['rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','get','CmContactHasPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasPhone','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x3d0979,_0xe0866a){var _0x1beb42=function(_0x506708){while(--_0x506708){_0x3d0979['push'](_0x3d0979['shift']());}};_0x1beb42(++_0xe0866a);}(_0x810d,0xf8));var _0xd810=function(_0x34252d,_0x4d1457){_0x34252d=_0x34252d-0x0;var _0x208e44=_0x810d[_0x34252d];return _0x208e44;};'use strict';var pdf=require(_0xd810('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd810('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd810('0x2'));var rp=require(_0xd810('0x3'));var moment=require(_0xd810('0x4'));var BPromise=require(_0xd810('0x5'));var Mustache=require(_0xd810('0x6'));var util=require('util');var path=require(_0xd810('0x7'));var sox=require(_0xd810('0x8'));var csv=require(_0xd810('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd810('0xa'));var crypto=require(_0xd810('0xb'));var jsforce=require(_0xd810('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd810('0x9'));var querystring=require('querystring');var Papa=require(_0xd810('0xd'));var Redis=require(_0xd810('0xe'));var authService=require(_0xd810('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd810('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd810('0x11'));var utils=require(_0xd810('0x12'));var config=require(_0xd810('0x13'));var db=require(_0xd810('0x14'))['db'];function respondWithStatusCode(_0x41c80e,_0x327291){_0x327291=_0x327291||0xcc;return function(_0x354242){if(_0x354242){return _0x41c80e[_0xd810('0x15')](_0x327291);}return _0x41c80e[_0xd810('0x16')](_0x327291)[_0xd810('0x17')]();};}function respondWithResult(_0x425c09,_0x40d384){_0x40d384=_0x40d384||0xc8;return function(_0x232226){if(_0x232226){return _0x425c09[_0xd810('0x16')](_0x40d384)[_0xd810('0x18')](_0x232226);}};}function respondWithFilteredResult(_0x383d99,_0x22acb3){return function(_0x2eaec0){if(_0x2eaec0){var _0x35d6c2=_0x2eaec0[_0xd810('0x19')],_0x4b02aa=_0x22acb3[_0xd810('0x1a')],_0x2ff163=_0x22acb3['offset']+_0x22acb3[_0xd810('0x1b')],_0x3b4fce;if(_0x2ff163>=_0x35d6c2){_0x2ff163=_0x35d6c2;_0x3b4fce=0xc8;}else{_0x3b4fce=0xce;}_0x383d99[_0xd810('0x16')](_0x3b4fce);return _0x383d99[_0xd810('0x1c')](_0xd810('0x1d'),_0x4b02aa+'-'+_0x2ff163+'/'+_0x35d6c2)['json'](_0x2eaec0);}return null;};}function patchUpdates(_0x47ac2c){return function(_0x125fb2){try{jsonpatch[_0xd810('0x1e')](_0x125fb2,_0x47ac2c,!![]);}catch(_0x30a93b){return BPromise[_0xd810('0x1f')](_0x30a93b);}return _0x125fb2['save']();};}function saveUpdates(_0x26d28a,_0xded8f1){return function(_0x34514e){if(_0x34514e){return _0x34514e['update'](_0x26d28a)[_0xd810('0x20')](function(_0x18aab8){return _0x18aab8;});}return null;};}function removeEntity(_0x58904c,_0x196889){return function(_0x597774){if(_0x597774){return _0x597774['destroy']()['then'](function(){var _0x4280c=_0x597774[_0xd810('0x21')]({'plain':!![]});var _0x375453=_0xd810('0x22');return db[_0xd810('0x23')][_0xd810('0x24')]({'where':{'type':_0x375453,'resourceId':_0x4280c['id']}})['then'](function(){return _0x597774;});})[_0xd810('0x20')](function(){_0x58904c['status'](0xcc)[_0xd810('0x17')]();});}};}function handleEntityNotFound(_0x4ad418,_0x83ce2b){return function(_0x3ffbca){if(!_0x3ffbca){_0x4ad418[_0xd810('0x15')](0x194);}return _0x3ffbca;};}function handleError(_0x283d84,_0x5af743){_0x5af743=_0x5af743||0x1f4;return function(_0x120422){logger[_0xd810('0x25')](_0x120422[_0xd810('0x26')]);if(_0x120422['name']){delete _0x120422[_0xd810('0x27')];}_0x283d84['status'](_0x5af743)[_0xd810('0x28')](_0x120422);};}exports[_0xd810('0x29')]=function(_0x3b8ad0,_0x451cbc){var _0xc96768={},_0x29026f={},_0x37c664={'count':0x0,'rows':[]};var _0xdbbfc=_[_0xd810('0x2a')](db[_0xd810('0x2b')]['rawAttributes'],function(_0x1e0842){return{'name':_0x1e0842['fieldName'],'type':_0x1e0842[_0xd810('0x2c')][_0xd810('0x2d')]};});_0x29026f[_0xd810('0x2e')]=_[_0xd810('0x2a')](_0xdbbfc,_0xd810('0x27'));_0x29026f[_0xd810('0x2f')]=_[_0xd810('0x30')](_0x3b8ad0[_0xd810('0x2f')]);_0x29026f[_0xd810('0x31')]=_['intersection'](_0x29026f['model'],_0x29026f[_0xd810('0x2f')]);_0xc96768[_0xd810('0x32')]=_[_0xd810('0x33')](_0x29026f['model'],qs['fields'](_0x3b8ad0['query'][_0xd810('0x34')]));_0xc96768[_0xd810('0x32')]=_0xc96768[_0xd810('0x32')][_0xd810('0x35')]?_0xc96768[_0xd810('0x32')]:_0x29026f[_0xd810('0x2e')];if(!_0x3b8ad0['query']['hasOwnProperty']('nolimit')){_0xc96768[_0xd810('0x1b')]=qs[_0xd810('0x1b')](_0x3b8ad0[_0xd810('0x2f')]['limit']);_0xc96768['offset']=qs[_0xd810('0x1a')](_0x3b8ad0['query'][_0xd810('0x1a')]);}_0xc96768[_0xd810('0x36')]=qs[_0xd810('0x37')](_0x3b8ad0[_0xd810('0x2f')][_0xd810('0x37')]);_0xc96768[_0xd810('0x38')]=qs[_0xd810('0x31')](_[_0xd810('0x39')](_0x3b8ad0[_0xd810('0x2f')],_0x29026f['filters']),_0xdbbfc);if(_0x3b8ad0[_0xd810('0x2f')][_0xd810('0x3a')]){_0xc96768[_0xd810('0x38')]=_[_0xd810('0x3b')](_0xc96768[_0xd810('0x38')],{'$or':_[_0xd810('0x2a')](_0xdbbfc,function(_0x2f4c36){if(_0x2f4c36[_0xd810('0x2c')]!==_0xd810('0x3c')){var _0x18a63e={};_0x18a63e[_0x2f4c36['name']]={'$like':'%'+_0x3b8ad0[_0xd810('0x2f')][_0xd810('0x3a')]+'%'};return _0x18a63e;}})});}_0xc96768=_[_0xd810('0x3b')]({},_0xc96768,_0x3b8ad0[_0xd810('0x3d')]);var _0x8b63c8={'where':_0xc96768[_0xd810('0x38')]};return db['CmContactHasPhone'][_0xd810('0x19')](_0x8b63c8)['then'](function(_0x880a3){_0x37c664[_0xd810('0x19')]=_0x880a3;if(_0x3b8ad0['query'][_0xd810('0x3e')]){_0xc96768[_0xd810('0x3f')]=[{'all':!![]}];}return db[_0xd810('0x2b')][_0xd810('0x40')](_0xc96768);})[_0xd810('0x20')](function(_0x35fc45){_0x37c664[_0xd810('0x41')]=_0x35fc45;return _0x37c664;})[_0xd810('0x20')](respondWithFilteredResult(_0x451cbc,_0xc96768))[_0xd810('0x42')](handleError(_0x451cbc,null));};exports[_0xd810('0x43')]=function(_0x22e551,_0x444e69){var _0x1b99ef={'raw':!![],'where':{'id':_0x22e551['params']['id']}},_0x2d0ab6={};_0x2d0ab6['model']=_['keys'](db['CmContactHasPhone'][_0xd810('0x44')]);_0x2d0ab6[_0xd810('0x2f')]=_['keys'](_0x22e551[_0xd810('0x2f')]);_0x2d0ab6['filters']=_[_0xd810('0x33')](_0x2d0ab6['model'],_0x2d0ab6[_0xd810('0x2f')]);_0x1b99ef[_0xd810('0x32')]=_[_0xd810('0x33')](_0x2d0ab6[_0xd810('0x2e')],qs['fields'](_0x22e551['query']['fields']));_0x1b99ef[_0xd810('0x32')]=_0x1b99ef[_0xd810('0x32')][_0xd810('0x35')]?_0x1b99ef[_0xd810('0x32')]:_0x2d0ab6['model'];if(_0x22e551[_0xd810('0x2f')][_0xd810('0x3e')]){_0x1b99ef['include']=[{'all':!![]}];}_0x1b99ef=_['merge']({},_0x1b99ef,_0x22e551[_0xd810('0x3d')]);return db[_0xd810('0x2b')][_0xd810('0x45')](_0x1b99ef)[_0xd810('0x20')](handleEntityNotFound(_0x444e69,null))[_0xd810('0x20')](respondWithResult(_0x444e69,null))['catch'](handleError(_0x444e69,null));};exports[_0xd810('0x46')]=function(_0x3a37a3,_0x2c8c26){return db['CmContactHasPhone'][_0xd810('0x46')](_0x3a37a3[_0xd810('0x47')],{})[_0xd810('0x20')](function(_0x4c00b7){var _0xa5bd09=_0x3a37a3[_0xd810('0x48')]['get']({'plain':!![]});if(!_0xa5bd09)throw new Error(_0xd810('0x49'));if(_0xa5bd09[_0xd810('0x4a')]==='user'){var _0x485fe9=_0x4c00b7[_0xd810('0x21')]({'plain':!![]});var _0x248eba=_0xd810('0x22');return db[_0xd810('0x4b')][_0xd810('0x45')]({'where':{'name':_0x248eba,'userProfileId':_0xa5bd09[_0xd810('0x4c')]},'raw':!![]})[_0xd810('0x20')](function(_0x3b5515){if(_0x3b5515&&_0x3b5515['autoAssociation']===0x0){return db[_0xd810('0x23')][_0xd810('0x46')]({'name':_0x485fe9[_0xd810('0x27')],'resourceId':_0x485fe9['id'],'type':_0x3b5515[_0xd810('0x27')],'sectionId':_0x3b5515['id']},{})[_0xd810('0x20')](function(){return _0x4c00b7;});}else{return _0x4c00b7;}})['catch'](function(_0x2200f7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2200f7);throw _0x2200f7;});}return _0x4c00b7;})[_0xd810('0x20')](respondWithResult(_0x2c8c26,0xc9))['catch'](handleError(_0x2c8c26,null));};exports[_0xd810('0x4d')]=function(_0x187cae,_0x57cbfd){if(_0x187cae[_0xd810('0x47')]['id']){delete _0x187cae[_0xd810('0x47')]['id'];}return db[_0xd810('0x2b')][_0xd810('0x45')]({'where':{'id':_0x187cae[_0xd810('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57cbfd,null))['then'](saveUpdates(_0x187cae[_0xd810('0x47')],null))['then'](respondWithResult(_0x57cbfd,null))['catch'](handleError(_0x57cbfd,null));};exports[_0xd810('0x24')]=function(_0xa02525,_0x109def){return db[_0xd810('0x2b')][_0xd810('0x45')]({'where':{'id':_0xa02525[_0xd810('0x4e')]['id']}})[_0xd810('0x20')](handleEntityNotFound(_0x109def,null))[_0xd810('0x20')](removeEntity(_0x109def,null))[_0xd810('0x42')](handleError(_0x109def,null));}; \ No newline at end of file +var _0xa084=['bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','CmContactHasPhones','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','CmContactHasPhone','includeAll','include','findAll','rows','show','params','rawAttributes','keys','options','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','update','html-pdf','rimraf','fast-json-patch','request-promise'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xa084,0x19b));var _0x4a08=function(_0x439c27,_0x2a6006){_0x439c27=_0x439c27-0x0;var _0x10de77=_0xa084[_0x439c27];return _0x10de77;};'use strict';var pdf=require(_0x4a08('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4a08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a08('0x2'));var rp=require(_0x4a08('0x3'));var moment=require('moment');var BPromise=require(_0x4a08('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4a08('0x5'));var sox=require(_0x4a08('0x6'));var csv=require(_0x4a08('0x7'));var ejs=require(_0x4a08('0x8'));var fs=require('fs');var _=require(_0x4a08('0x9'));var squel=require(_0x4a08('0xa'));var crypto=require(_0x4a08('0xb'));var jsforce=require(_0x4a08('0xc'));var deskjs=require(_0x4a08('0xd'));var toCsv=require(_0x4a08('0x7'));var querystring=require(_0x4a08('0xe'));var Papa=require(_0x4a08('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4a08('0x10'));var as=require(_0x4a08('0x11'));var hardwareService=require(_0x4a08('0x12'));var logger=require(_0x4a08('0x13'))(_0x4a08('0x14'));var utils=require(_0x4a08('0x15'));var config=require('../../config/environment');var db=require(_0x4a08('0x16'))['db'];function respondWithStatusCode(_0x117070,_0x5daf40){_0x5daf40=_0x5daf40||0xcc;return function(_0x236b8e){if(_0x236b8e){return _0x117070['sendStatus'](_0x5daf40);}return _0x117070[_0x4a08('0x17')](_0x5daf40)[_0x4a08('0x18')]();};}function respondWithResult(_0x26c063,_0x26a54a){_0x26a54a=_0x26a54a||0xc8;return function(_0x4beca4){if(_0x4beca4){return _0x26c063[_0x4a08('0x17')](_0x26a54a)[_0x4a08('0x19')](_0x4beca4);}};}function respondWithFilteredResult(_0x13cec1,_0x14063d){return function(_0x539890){if(_0x539890){var _0x1df5d1=_0x539890[_0x4a08('0x1a')],_0x5642f6=_0x14063d['offset'],_0x588cd4=_0x14063d[_0x4a08('0x1b')]+_0x14063d[_0x4a08('0x1c')],_0x39480d;if(_0x588cd4>=_0x1df5d1){_0x588cd4=_0x1df5d1;_0x39480d=0xc8;}else{_0x39480d=0xce;}_0x13cec1[_0x4a08('0x17')](_0x39480d);return _0x13cec1['set'](_0x4a08('0x1d'),_0x5642f6+'-'+_0x588cd4+'/'+_0x1df5d1)[_0x4a08('0x19')](_0x539890);}return null;};}function patchUpdates(_0xc92736){return function(_0x179758){try{jsonpatch[_0x4a08('0x1e')](_0x179758,_0xc92736,!![]);}catch(_0x5d30fa){return BPromise[_0x4a08('0x1f')](_0x5d30fa);}return _0x179758[_0x4a08('0x20')]();};}function saveUpdates(_0x4b1ea2,_0x55bc4d){return function(_0x3c6129){if(_0x3c6129){return _0x3c6129['update'](_0x4b1ea2)[_0x4a08('0x21')](function(_0x73e724){return _0x73e724;});}return null;};}function removeEntity(_0x15b3eb,_0x1c908b){return function(_0x8efc02){if(_0x8efc02){return _0x8efc02[_0x4a08('0x22')]()[_0x4a08('0x21')](function(){var _0x4195a1=_0x8efc02[_0x4a08('0x23')]({'plain':!![]});var _0x22faa5=_0x4a08('0x24');return db[_0x4a08('0x25')][_0x4a08('0x22')]({'where':{'type':_0x22faa5,'resourceId':_0x4195a1['id']}})['then'](function(){return _0x8efc02;});})[_0x4a08('0x21')](function(){_0x15b3eb[_0x4a08('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21956a,_0x1495bb){return function(_0x3dac61){if(!_0x3dac61){_0x21956a[_0x4a08('0x26')](0x194);}return _0x3dac61;};}function handleError(_0xda4e4b,_0x15ae1f){_0x15ae1f=_0x15ae1f||0x1f4;return function(_0x3b7500){logger[_0x4a08('0x27')](_0x3b7500[_0x4a08('0x28')]);if(_0x3b7500[_0x4a08('0x29')]){delete _0x3b7500[_0x4a08('0x29')];}_0xda4e4b['status'](_0x15ae1f)[_0x4a08('0x2a')](_0x3b7500);};}exports[_0x4a08('0x2b')]=function(_0x471f0e,_0x31fbb2){var _0x530975={},_0x5a9de7={},_0x56d5fe={'count':0x0,'rows':[]};var _0x5c65dd=_[_0x4a08('0x2c')](db['CmContactHasPhone']['rawAttributes'],function(_0x408474){return{'name':_0x408474[_0x4a08('0x2d')],'type':_0x408474['type']['key']};});_0x5a9de7[_0x4a08('0x2e')]=_[_0x4a08('0x2c')](_0x5c65dd,_0x4a08('0x29'));_0x5a9de7[_0x4a08('0x2f')]=_['keys'](_0x471f0e['query']);_0x5a9de7['filters']=_[_0x4a08('0x30')](_0x5a9de7[_0x4a08('0x2e')],_0x5a9de7[_0x4a08('0x2f')]);_0x530975[_0x4a08('0x31')]=_['intersection'](_0x5a9de7['model'],qs[_0x4a08('0x32')](_0x471f0e[_0x4a08('0x2f')][_0x4a08('0x32')]));_0x530975['attributes']=_0x530975[_0x4a08('0x31')][_0x4a08('0x33')]?_0x530975['attributes']:_0x5a9de7[_0x4a08('0x2e')];if(!_0x471f0e[_0x4a08('0x2f')][_0x4a08('0x34')](_0x4a08('0x35'))){_0x530975['limit']=qs[_0x4a08('0x1c')](_0x471f0e[_0x4a08('0x2f')]['limit']);_0x530975[_0x4a08('0x1b')]=qs[_0x4a08('0x1b')](_0x471f0e['query'][_0x4a08('0x1b')]);}_0x530975[_0x4a08('0x36')]=qs[_0x4a08('0x37')](_0x471f0e[_0x4a08('0x2f')][_0x4a08('0x37')]);_0x530975[_0x4a08('0x38')]=qs[_0x4a08('0x39')](_[_0x4a08('0x3a')](_0x471f0e[_0x4a08('0x2f')],_0x5a9de7[_0x4a08('0x39')]),_0x5c65dd);if(_0x471f0e[_0x4a08('0x2f')][_0x4a08('0x3b')]){_0x530975[_0x4a08('0x38')]=_[_0x4a08('0x3c')](_0x530975[_0x4a08('0x38')],{'$or':_[_0x4a08('0x2c')](_0x5c65dd,function(_0x1b3048){if(_0x1b3048['type']!==_0x4a08('0x3d')){var _0x4265c5={};_0x4265c5[_0x1b3048[_0x4a08('0x29')]]={'$like':'%'+_0x471f0e[_0x4a08('0x2f')][_0x4a08('0x3b')]+'%'};return _0x4265c5;}})});}_0x530975=_['merge']({},_0x530975,_0x471f0e['options']);var _0xd97290={'where':_0x530975[_0x4a08('0x38')]};return db[_0x4a08('0x3e')][_0x4a08('0x1a')](_0xd97290)[_0x4a08('0x21')](function(_0xba5ec){_0x56d5fe[_0x4a08('0x1a')]=_0xba5ec;if(_0x471f0e[_0x4a08('0x2f')][_0x4a08('0x3f')]){_0x530975[_0x4a08('0x40')]=[{'all':!![]}];}return db[_0x4a08('0x3e')][_0x4a08('0x41')](_0x530975);})[_0x4a08('0x21')](function(_0x1bbc18){_0x56d5fe[_0x4a08('0x42')]=_0x1bbc18;return _0x56d5fe;})[_0x4a08('0x21')](respondWithFilteredResult(_0x31fbb2,_0x530975))['catch'](handleError(_0x31fbb2,null));};exports[_0x4a08('0x43')]=function(_0x564700,_0x1d1447){var _0x567990={'raw':!![],'where':{'id':_0x564700[_0x4a08('0x44')]['id']}},_0x19b141={};_0x19b141[_0x4a08('0x2e')]=_['keys'](db['CmContactHasPhone'][_0x4a08('0x45')]);_0x19b141[_0x4a08('0x2f')]=_[_0x4a08('0x46')](_0x564700['query']);_0x19b141['filters']=_[_0x4a08('0x30')](_0x19b141[_0x4a08('0x2e')],_0x19b141[_0x4a08('0x2f')]);_0x567990[_0x4a08('0x31')]=_[_0x4a08('0x30')](_0x19b141['model'],qs[_0x4a08('0x32')](_0x564700['query']['fields']));_0x567990[_0x4a08('0x31')]=_0x567990['attributes'][_0x4a08('0x33')]?_0x567990[_0x4a08('0x31')]:_0x19b141['model'];if(_0x564700['query']['includeAll']){_0x567990[_0x4a08('0x40')]=[{'all':!![]}];}_0x567990=_['merge']({},_0x567990,_0x564700[_0x4a08('0x47')]);return db[_0x4a08('0x3e')][_0x4a08('0x48')](_0x567990)[_0x4a08('0x21')](handleEntityNotFound(_0x1d1447,null))[_0x4a08('0x21')](respondWithResult(_0x1d1447,null))[_0x4a08('0x49')](handleError(_0x1d1447,null));};exports['create']=function(_0x1cb230,_0xd6d61e){return db['CmContactHasPhone']['create'](_0x1cb230[_0x4a08('0x4a')],{})[_0x4a08('0x21')](function(_0x507107){var _0x8975c9=_0x1cb230[_0x4a08('0x4b')]['get']({'plain':!![]});if(!_0x8975c9)throw new Error(_0x4a08('0x4c'));if(_0x8975c9[_0x4a08('0x4d')]===_0x4a08('0x4b')){var _0xf612b1=_0x507107['get']({'plain':!![]});var _0x379ac8=_0x4a08('0x24');return db['UserProfileSection'][_0x4a08('0x48')]({'where':{'name':_0x379ac8,'userProfileId':_0x8975c9[_0x4a08('0x4e')]},'raw':!![]})[_0x4a08('0x21')](function(_0x46a046){if(_0x46a046&&_0x46a046[_0x4a08('0x4f')]===0x0){return db['UserProfileResource'][_0x4a08('0x50')]({'name':_0xf612b1['name'],'resourceId':_0xf612b1['id'],'type':_0x46a046[_0x4a08('0x29')],'sectionId':_0x46a046['id']},{})[_0x4a08('0x21')](function(){return _0x507107;});}else{return _0x507107;}})['catch'](function(_0x4e5157){logger[_0x4a08('0x27')](_0x4a08('0x51'),_0x4e5157);throw _0x4e5157;});}return _0x507107;})[_0x4a08('0x21')](respondWithResult(_0xd6d61e,0xc9))[_0x4a08('0x49')](handleError(_0xd6d61e,null));};exports[_0x4a08('0x52')]=function(_0x69665a,_0x1baad7){if(_0x69665a[_0x4a08('0x4a')]['id']){delete _0x69665a[_0x4a08('0x4a')]['id'];}return db['CmContactHasPhone'][_0x4a08('0x48')]({'where':{'id':_0x69665a[_0x4a08('0x44')]['id']}})[_0x4a08('0x21')](handleEntityNotFound(_0x1baad7,null))[_0x4a08('0x21')](saveUpdates(_0x69665a[_0x4a08('0x4a')],null))['then'](respondWithResult(_0x1baad7,null))[_0x4a08('0x49')](handleError(_0x1baad7,null));};exports[_0x4a08('0x22')]=function(_0x4c7158,_0x8143a2){return db[_0x4a08('0x3e')][_0x4a08('0x48')]({'where':{'id':_0x4c7158[_0x4a08('0x44')]['id']}})[_0x4a08('0x21')](handleEntityNotFound(_0x8143a2,null))[_0x4a08('0x21')](removeEntity(_0x8143a2,null))[_0x4a08('0x49')](handleError(_0x8143a2,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index d3d78ee..3e56c7b 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 _0x2eb8=['request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','cm_contact_has_phones','lodash','api','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2eb8,0x147));var _0x82eb=function(_0x5dec4e,_0x184e9b){_0x5dec4e=_0x5dec4e-0x0;var _0x240d25=_0x2eb8[_0x5dec4e];return _0x240d25;};'use strict';var _=require(_0x82eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x82eb('0x1'));var moment=require('moment');var BPromise=require(_0x82eb('0x2'));var rp=require(_0x82eb('0x3'));var fs=require('fs');var path=require(_0x82eb('0x4'));var rimraf=require(_0x82eb('0x5'));var config=require(_0x82eb('0x6'));var attributes=require(_0x82eb('0x7'));module[_0x82eb('0x8')]=function(_0x5025d2,_0x5c802a){return _0x5025d2['define'](_0x82eb('0x9'),attributes,{'tableName':_0x82eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3a6=['cm_contact_has_phones','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmContactHasPhone'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd3a6,0x181));var _0x6d3a=function(_0x341604,_0xa7bb93){_0x341604=_0x341604-0x0;var _0x2b6946=_0xd3a6[_0x341604];return _0x2b6946;};'use strict';var _=require(_0x6d3a('0x0'));var util=require('util');var logger=require(_0x6d3a('0x1'))(_0x6d3a('0x2'));var moment=require(_0x6d3a('0x3'));var BPromise=require(_0x6d3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d3a('0x5'));var rimraf=require(_0x6d3a('0x6'));var config=require(_0x6d3a('0x7'));var attributes=require('./cmContactHasPhone.attributes');module[_0x6d3a('0x8')]=function(_0x41951b,_0x536a70){return _0x41951b[_0x6d3a('0x9')](_0x6d3a('0xa'),attributes,{'tableName':_0x6d3a('0xb'),'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 8fa51e1..5ece8e3 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 _0xa9c0=['CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','client','http','request','CmContactHasPhone,\x20%s,\x20%s','debug'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xa9c0,0x19f));var _0x0a9c=function(_0x286c23,_0x55b89d){_0x286c23=_0x286c23-0x0;var _0x3a4027=_0xa9c0[_0x286c23];return _0x3a4027;};'use strict';var _=require('lodash');var util=require(_0x0a9c('0x0'));var moment=require(_0x0a9c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9c('0x3'));var logger=require(_0x0a9c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a9c('0x5')][_0x0a9c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x45ec54,_0x568b35,_0x51f1ff){return new BPromise(function(_0x2e9551,_0x430134){return client[_0x0a9c('0x7')](_0x45ec54,_0x51f1ff)['then'](function(_0x296b9b){logger['info'](_0x0a9c('0x8'),_0x568b35,'request\x20sent');logger[_0x0a9c('0x9')](_0x0a9c('0xa'),_0x568b35,'request\x20sent',JSON['stringify'](_0x296b9b));if(_0x296b9b[_0x0a9c('0xb')]){if(_0x296b9b['error'][_0x0a9c('0xc')]===0x1f4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b['error'][_0x0a9c('0xd')]);return _0x430134(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);return _0x2e9551(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}else{logger[_0x0a9c('0xe')](_0x0a9c('0x8'),_0x568b35,'request\x20sent');_0x2e9551(_0x296b9b[_0x0a9c('0xf')][_0x0a9c('0xd')]);}})[_0x0a9c('0x10')](function(_0x8066d4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x8066d4);_0x430134(_0x8066d4);});});} \ No newline at end of file +var _0x8294=['../../config/environment','client','http','then','CmContactHasPhone,\x20%s,\x20%s','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22c057,_0x11657b){var _0x1d1734=function(_0x401ce2){while(--_0x401ce2){_0x22c057['push'](_0x22c057['shift']());}};_0x1d1734(++_0x11657b);}(_0x8294,0x1c6));var _0x4829=function(_0x369302,_0x5c41f4){_0x369302=_0x369302-0x0;var _0x49621b=_0x8294[_0x369302];return _0x49621b;};'use strict';var _=require(_0x4829('0x0'));var util=require(_0x4829('0x1'));var moment=require('moment');var BPromise=require(_0x4829('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4829('0x3'))['db'];var utils=require(_0x4829('0x4'));var logger=require(_0x4829('0x5'))('rpc');var config=require(_0x4829('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4829('0x7')][_0x4829('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x396b85,_0x4c4125,_0x1dc608){return new BPromise(function(_0x2d51b1,_0x3a7e4b){return client['request'](_0x396b85,_0x1dc608)[_0x4829('0x9')](function(_0x298b45){logger['info'](_0x4829('0xa'),_0x4c4125,'request\x20sent');logger[_0x4829('0xb')](_0x4829('0xc'),_0x4c4125,_0x4829('0xd'),JSON[_0x4829('0xe')](_0x298b45));if(_0x298b45['error']){if(_0x298b45[_0x4829('0xf')][_0x4829('0x10')]===0x1f4){logger[_0x4829('0xf')](_0x4829('0xa'),_0x4c4125,_0x298b45[_0x4829('0xf')][_0x4829('0x11')]);return _0x3a7e4b(_0x298b45['error'][_0x4829('0x11')]);}logger[_0x4829('0xf')](_0x4829('0xa'),_0x4c4125,_0x298b45[_0x4829('0xf')][_0x4829('0x11')]);return _0x2d51b1(_0x298b45[_0x4829('0xf')][_0x4829('0x11')]);}else{logger['info'](_0x4829('0xa'),_0x4c4125,'request\x20sent');_0x2d51b1(_0x298b45[_0x4829('0x12')][_0x4829('0x11')]);}})[_0x4829('0x13')](function(_0x4caf54){logger['error'](_0x4829('0xa'),_0x4c4125,_0x4caf54);_0x3a7e4b(_0x4caf54);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 2cb78db..26c879d 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 _0xe1ca=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller'];(function(_0x176b19,_0x2270ca){var _0x1a1ac7=function(_0xda0598){while(--_0xda0598){_0x176b19['push'](_0x176b19['shift']());}};_0x1a1ac7(++_0x2270ca);}(_0xe1ca,0x12b));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xae1c('0x0'));var util=require(_0xae1c('0x1'));var path=require('path');var timeout=require(_0xae1c('0x2'));var express=require('express');var router=express[_0xae1c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xae1c('0x4'));var config=require(_0xae1c('0x5'));var controller=require(_0xae1c('0x6'));router[_0xae1c('0x7')]('/',auth[_0xae1c('0x8')](),controller[_0xae1c('0x9')]);router[_0xae1c('0x7')](_0xae1c('0xa'),auth[_0xae1c('0x8')](),controller[_0xae1c('0xb')]);router[_0xae1c('0xc')]('/',auth[_0xae1c('0x8')](),controller[_0xae1c('0xd')]);router[_0xae1c('0xe')](_0xae1c('0xa'),auth[_0xae1c('0x8')](),controller[_0xae1c('0xf')]);router['delete'](_0xae1c('0xa'),auth[_0xae1c('0x8')](),controller[_0xae1c('0x10')]);module[_0xae1c('0x11')]=router; \ No newline at end of file +var _0x81be=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','show','post','destroy','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81be,0x10a));var _0xe81b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x81be[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xe81b('0x0'));var util=require(_0xe81b('0x1'));var path=require(_0xe81b('0x2'));var timeout=require(_0xe81b('0x3'));var express=require(_0xe81b('0x4'));var router=express[_0xe81b('0x5')]();var auth=require(_0xe81b('0x6'));var interaction=require(_0xe81b('0x7'));var config=require(_0xe81b('0x8'));var controller=require(_0xe81b('0x9'));router[_0xe81b('0xa')]('/',auth[_0xe81b('0xb')](),controller[_0xe81b('0xc')]);router[_0xe81b('0xa')](_0xe81b('0xd'),auth[_0xe81b('0xb')](),controller[_0xe81b('0xe')]);router[_0xe81b('0xf')]('/',auth[_0xe81b('0xb')](),controller['create']);router['put']('/:id',auth[_0xe81b('0xb')](),controller['update']);router['delete'](_0xe81b('0xd'),auth[_0xe81b('0xb')](),controller[_0xe81b('0x10')]);module[_0xe81b('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b962c6a..c791cc9 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 _0x0623=['sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','values','stringify'];(function(_0x3af5e2,_0x44e9a){var _0x31c297=function(_0xd590de){while(--_0xd590de){_0x3af5e2['push'](_0x3af5e2['shift']());}};_0x31c297(++_0x44e9a);}(_0x0623,0x145));var _0x3062=function(_0x3edbeb,_0x12e9c9){_0x3edbeb=_0x3edbeb-0x0;var _0x139c27=_0x0623[_0x3edbeb];return _0x139c27;};'use strict';var Sequelize=require(_0x3062('0x0'));var _=require('lodash');module[_0x3062('0x1')]={'name':{'type':Sequelize[_0x3062('0x2')],'get':function(_0x21a7a9){return this[_0x3062('0x3')](_0x3062('0x4'));}},'alias':{'type':Sequelize[_0x3062('0x5')],'allowNull':![],'set':function(_0x347077){this[_0x3062('0x6')](_0x3062('0x4'),_0x347077?_0x347077:this[_0x3062('0x3')](_0x3062('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x3062('0x8')](_0x3062('0x9')),'get':function(){if(this[_0x3062('0x3')](_0x3062('0xa'))==='select'){return JSON['parse'](this[_0x3062('0x3')](_0x3062('0xb')));}else{return this['getDataValue'](_0x3062('0xb'));}},'set':function(_0x2a3e0d){if(Array['isArray'](_0x2a3e0d)){this[_0x3062('0x6')](_0x3062('0xb'),JSON[_0x3062('0xc')](_0x2a3e0d));}else{this[_0x3062('0x6')]('values',_0x2a3e0d);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe39e=['setDataValue','getDataValue','long','type','select','parse','values','stringify','BOOLEAN','sequelize','exports','alias','STRING'];(function(_0x34c8bf,_0x3c9a44){var _0x2c5a61=function(_0x3ccd72){while(--_0x3ccd72){_0x34c8bf['push'](_0x34c8bf['shift']());}};_0x2c5a61(++_0x3c9a44);}(_0xe39e,0x71));var _0xee39=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0xe39e[_0x48fb10];return _0x534251;};'use strict';var Sequelize=require(_0xee39('0x0'));var _=require('lodash');module[_0xee39('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x488290){return this['getDataValue'](_0xee39('0x2'));}},'alias':{'type':Sequelize[_0xee39('0x3')],'allowNull':![],'set':function(_0x3fd485){this[_0xee39('0x4')](_0xee39('0x2'),_0x3fd485?_0x3fd485:this[_0xee39('0x5')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xee39('0x6')),'get':function(){if(this['getDataValue'](_0xee39('0x7'))===_0xee39('0x8')){return JSON[_0xee39('0x9')](this[_0xee39('0x5')](_0xee39('0xa')));}else{return this['getDataValue'](_0xee39('0xa'));}},'set':function(_0x571b22){if(Array['isArray'](_0x571b22)){this[_0xee39('0x4')]('values',JSON[_0xee39('0xb')](_0x571b22));}else{this[_0xee39('0x4')](_0xee39('0xa'),_0x571b22);}}},'required':{'type':Sequelize[_0xee39('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 954036d..713050e 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 _0x1083=['ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmCustomField','includeAll','findAll','catch','show','include','find','body','params','create','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv'];(function(_0x452286,_0x4726da){var _0x2e6556=function(_0x4bb077){while(--_0x4bb077){_0x452286['push'](_0x452286['shift']());}};_0x2e6556(++_0x4726da);}(_0x1083,0x19b));var _0x3108=function(_0x14ea70,_0xb97bbd){_0x14ea70=_0x14ea70-0x0;var _0x1dbaff=_0x1083[_0x14ea70];return _0x1dbaff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3108('0x0'));var rimraf=require(_0x3108('0x1'));var zipdir=require(_0x3108('0x2'));var jsonpatch=require(_0x3108('0x3'));var rp=require(_0x3108('0x4'));var moment=require(_0x3108('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3108('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3108('0x7'));var csv=require(_0x3108('0x8'));var ejs=require(_0x3108('0x9'));var fs=require('fs');var _=require(_0x3108('0xa'));var squel=require(_0x3108('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3108('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3108('0xd'));var Papa=require(_0x3108('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3108('0xf'));var as=require(_0x3108('0x10'));var hardwareService=require(_0x3108('0x11'));var logger=require(_0x3108('0x12'))('api');var utils=require(_0x3108('0x13'));var config=require(_0x3108('0x14'));var db=require(_0x3108('0x15'))['db'];function respondWithStatusCode(_0x1a6622,_0xfc25e1){_0xfc25e1=_0xfc25e1||0xcc;return function(_0x2f15b9){if(_0x2f15b9){return _0x1a6622['sendStatus'](_0xfc25e1);}return _0x1a6622['status'](_0xfc25e1)[_0x3108('0x16')]();};}function respondWithResult(_0x2f33d0,_0x45a7a1){_0x45a7a1=_0x45a7a1||0xc8;return function(_0x30ad78){if(_0x30ad78){return _0x2f33d0[_0x3108('0x17')](_0x45a7a1)[_0x3108('0x18')](_0x30ad78);}};}function respondWithFilteredResult(_0x438531,_0x31d3db){return function(_0x5ed45e){if(_0x5ed45e){var _0x2db071=_0x5ed45e[_0x3108('0x19')],_0x357695=_0x31d3db[_0x3108('0x1a')],_0x14e2af=_0x31d3db[_0x3108('0x1a')]+_0x31d3db[_0x3108('0x1b')],_0xa49ea7;if(_0x14e2af>=_0x2db071){_0x14e2af=_0x2db071;_0xa49ea7=0xc8;}else{_0xa49ea7=0xce;}_0x438531[_0x3108('0x17')](_0xa49ea7);return _0x438531[_0x3108('0x1c')](_0x3108('0x1d'),_0x357695+'-'+_0x14e2af+'/'+_0x2db071)[_0x3108('0x18')](_0x5ed45e);}return null;};}function patchUpdates(_0x28b4e8){return function(_0x55a06e){try{jsonpatch['apply'](_0x55a06e,_0x28b4e8,!![]);}catch(_0x125f87){return BPromise['reject'](_0x125f87);}return _0x55a06e[_0x3108('0x1e')]();};}function saveUpdates(_0x4000a2,_0x2abc1c){return function(_0x2a4fbe){if(_0x2a4fbe){return _0x2a4fbe[_0x3108('0x1f')](_0x4000a2)['then'](function(_0x20a0d5){return _0x20a0d5;});}return null;};}function removeEntity(_0x519140,_0x241230){return function(_0x4d7ee2){if(_0x4d7ee2){return _0x4d7ee2[_0x3108('0x20')]()[_0x3108('0x21')](function(){_0x519140[_0x3108('0x17')](0xcc)[_0x3108('0x16')]();});}};}function handleEntityNotFound(_0x3c3230,_0x5c1628){return function(_0x1d2149){if(!_0x1d2149){_0x3c3230[_0x3108('0x22')](0x194);}return _0x1d2149;};}function handleError(_0x38e58d,_0x3df812){_0x3df812=_0x3df812||0x1f4;return function(_0x3ef26b){logger[_0x3108('0x23')](_0x3ef26b[_0x3108('0x24')]);if(_0x3ef26b[_0x3108('0x25')]){delete _0x3ef26b[_0x3108('0x25')];}_0x38e58d[_0x3108('0x17')](_0x3df812)[_0x3108('0x26')](_0x3ef26b);};}exports[_0x3108('0x27')]=function(_0x18ebd3,_0x2da18f){var _0x2caf60={},_0xddb697={},_0x135fbc={'count':0x0,'rows':[]};var _0x58bf51=_[_0x3108('0x28')](db['CmCustomField'][_0x3108('0x29')],function(_0x5b9f3c){return{'name':_0x5b9f3c[_0x3108('0x2a')],'type':_0x5b9f3c['type']['key']};});_0xddb697[_0x3108('0x2b')]=_[_0x3108('0x2c')](_[_0x3108('0x28')](_0x58bf51,'name'),[_0x3108('0x25')]);_0xddb697['query']=_[_0x3108('0x2d')](_0x18ebd3['query']);_0xddb697[_0x3108('0x2e')]=_[_0x3108('0x2f')](_0xddb697['model'],_0xddb697[_0x3108('0x30')]);_0x2caf60[_0x3108('0x31')]=_[_0x3108('0x2f')](_0xddb697[_0x3108('0x2b')],qs[_0x3108('0x32')](_0x18ebd3['query']['fields']));_0x2caf60[_0x3108('0x31')]=_0x2caf60[_0x3108('0x31')][_0x3108('0x33')]?_0x2caf60['attributes']:_0xddb697[_0x3108('0x2b')];if(!_0x18ebd3[_0x3108('0x30')]['hasOwnProperty'](_0x3108('0x34'))){_0x2caf60[_0x3108('0x1b')]=qs[_0x3108('0x1b')](_0x18ebd3[_0x3108('0x30')][_0x3108('0x1b')]);_0x2caf60[_0x3108('0x1a')]=qs['offset'](_0x18ebd3[_0x3108('0x30')][_0x3108('0x1a')]);}_0x2caf60[_0x3108('0x35')]=qs[_0x3108('0x36')](_0x18ebd3['query'][_0x3108('0x36')]);_0x2caf60['where']=qs['filters'](_[_0x3108('0x37')](_0x18ebd3[_0x3108('0x30')],_0xddb697[_0x3108('0x2e')]),_0x58bf51);if(_0x18ebd3[_0x3108('0x30')][_0x3108('0x38')]){_0x2caf60[_0x3108('0x39')]=_[_0x3108('0x3a')](_0x2caf60['where'],{'$or':_[_0x3108('0x28')](_0x58bf51,function(_0x476b4f){if(_0x476b4f['type']!==_0x3108('0x3b')){var _0xd2ded={};_0xd2ded[_0x476b4f['name']]={'$like':'%'+_0x18ebd3[_0x3108('0x30')][_0x3108('0x38')]+'%'};return _0xd2ded;}})});}_0x2caf60=_['merge']({},_0x2caf60,_0x18ebd3[_0x3108('0x3c')]);var _0x50e4bd={'where':_0x2caf60[_0x3108('0x39')]};return db[_0x3108('0x3d')][_0x3108('0x19')](_0x50e4bd)[_0x3108('0x21')](function(_0x35492c){_0x135fbc[_0x3108('0x19')]=_0x35492c;if(_0x18ebd3[_0x3108('0x30')][_0x3108('0x3e')]){_0x2caf60['include']=[{'all':!![]}];}return db[_0x3108('0x3d')][_0x3108('0x3f')](_0x2caf60);})[_0x3108('0x21')](function(_0x322732){_0x135fbc['rows']=_0x322732;return _0x135fbc;})['then'](respondWithFilteredResult(_0x2da18f,_0x2caf60))[_0x3108('0x40')](handleError(_0x2da18f,null));};exports[_0x3108('0x41')]=function(_0x3a6bb4,_0x3b101f){var _0x1667c6={'raw':!![],'where':{'id':_0x3a6bb4['params']['id']}},_0x10cf0e={};_0x10cf0e[_0x3108('0x2b')]=_['keys'](db[_0x3108('0x3d')][_0x3108('0x29')]);_0x10cf0e[_0x3108('0x30')]=_[_0x3108('0x2d')](_0x3a6bb4[_0x3108('0x30')]);_0x10cf0e[_0x3108('0x2e')]=_['intersection'](_0x10cf0e['model'],_0x10cf0e[_0x3108('0x30')]);_0x1667c6[_0x3108('0x31')]=_['intersection'](_0x10cf0e[_0x3108('0x2b')],qs[_0x3108('0x32')](_0x3a6bb4['query'][_0x3108('0x32')]));_0x1667c6[_0x3108('0x31')]=_0x1667c6[_0x3108('0x31')][_0x3108('0x33')]?_0x1667c6[_0x3108('0x31')]:_0x10cf0e[_0x3108('0x2b')];if(_0x3a6bb4[_0x3108('0x30')][_0x3108('0x3e')]){_0x1667c6[_0x3108('0x42')]=[{'all':!![]}];}_0x1667c6=_[_0x3108('0x3a')]({},_0x1667c6,_0x3a6bb4[_0x3108('0x3c')]);return db['CmCustomField'][_0x3108('0x43')](_0x1667c6)[_0x3108('0x21')](handleEntityNotFound(_0x3b101f,null))[_0x3108('0x21')](respondWithResult(_0x3b101f,null))[_0x3108('0x40')](handleError(_0x3b101f,null));};exports['update']=function(_0x413ca0,_0x5234d9){if(_0x413ca0[_0x3108('0x44')]['id']){delete _0x413ca0[_0x3108('0x44')]['id'];}return db[_0x3108('0x3d')][_0x3108('0x43')]({'where':{'id':_0x413ca0['params']['id']}})[_0x3108('0x21')](handleEntityNotFound(_0x5234d9,null))[_0x3108('0x21')](saveUpdates(_0x413ca0[_0x3108('0x44')],null))[_0x3108('0x21')](respondWithResult(_0x5234d9,null))[_0x3108('0x40')](handleError(_0x5234d9,null));};exports['destroy']=function(_0x36b22b,_0x402100){return db[_0x3108('0x3d')][_0x3108('0x43')]({'where':{'id':_0x36b22b[_0x3108('0x45')]['id']}})[_0x3108('0x21')](handleEntityNotFound(_0x402100,null))[_0x3108('0x21')](removeEntity(_0x402100,null))[_0x3108('0x40')](handleError(_0x402100,null));};exports[_0x3108('0x46')]=function(_0x421cb0,_0x14f74d){var _0x503f48;return db['sequelize']['transaction'](function(_0x53524a){return db[_0x3108('0x3d')]['create'](_0x421cb0['body'],{'transaction':_0x53524a})['then'](function(_0x3221bf){_0x503f48=_0x3221bf;var _0x47a3db={'type':db[_0x3108('0x47')][_0x3108('0x48')],'transaction':_0x53524a};switch(_0x421cb0[_0x3108('0x44')][_0x3108('0x49')]){case _0x3108('0x4a'):_0x47a3db[_0x3108('0x49')]=db['Sequelize'][_0x3108('0x48')];break;case'number':_0x47a3db[_0x3108('0x49')]=db[_0x3108('0x47')][_0x3108('0x4b')];break;case _0x3108('0x4c'):_0x47a3db['type']=db[_0x3108('0x47')][_0x3108('0x4d')];_0x47a3db['defaultValue']=![];break;default:}return db[_0x3108('0x4e')][_0x3108('0x4f')][_0x3108('0x50')](_0x3108('0x51'),util[_0x3108('0x52')](_0x3108('0x53'),_0x503f48['id']),_0x47a3db);})['then'](function(){return _0x503f48;});})[_0x3108('0x21')](respondWithResult(_0x14f74d,0xc9))['catch'](handleError(_0x14f74d,null));}; \ No newline at end of file +var _0x2e8f=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','save','then','destroy','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','update','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x7ea795,_0x62c69a){var _0x521100=function(_0x2351c0){while(--_0x2351c0){_0x7ea795['push'](_0x7ea795['shift']());}};_0x521100(++_0x62c69a);}(_0x2e8f,0x138));var _0xf2e8=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x2e8f[_0x21549c];return _0x426cbd;};'use strict';var pdf=require(_0xf2e8('0x0'));var emlformat=require(_0xf2e8('0x1'));var rimraf=require(_0xf2e8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2e8('0x3'));var rp=require(_0xf2e8('0x4'));var moment=require('moment');var BPromise=require(_0xf2e8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf2e8('0x6'));var sox=require(_0xf2e8('0x7'));var csv=require(_0xf2e8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2e8('0x9'));var squel=require('squel');var crypto=require(_0xf2e8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf2e8('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf2e8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf2e8('0xd'));var as=require(_0xf2e8('0xe'));var hardwareService=require(_0xf2e8('0xf'));var logger=require(_0xf2e8('0x10'))(_0xf2e8('0x11'));var utils=require(_0xf2e8('0x12'));var config=require(_0xf2e8('0x13'));var db=require(_0xf2e8('0x14'))['db'];function respondWithStatusCode(_0x1f7c04,_0x3c5217){_0x3c5217=_0x3c5217||0xcc;return function(_0x2478cf){if(_0x2478cf){return _0x1f7c04[_0xf2e8('0x15')](_0x3c5217);}return _0x1f7c04[_0xf2e8('0x16')](_0x3c5217)[_0xf2e8('0x17')]();};}function respondWithResult(_0x222776,_0xff8c1d){_0xff8c1d=_0xff8c1d||0xc8;return function(_0x2bb301){if(_0x2bb301){return _0x222776[_0xf2e8('0x16')](_0xff8c1d)['json'](_0x2bb301);}};}function respondWithFilteredResult(_0x3a3c14,_0x5386c7){return function(_0x51f3fd){if(_0x51f3fd){var _0x45fb18=_0x51f3fd[_0xf2e8('0x18')],_0x245a70=_0x5386c7[_0xf2e8('0x19')],_0x2f30b5=_0x5386c7[_0xf2e8('0x19')]+_0x5386c7[_0xf2e8('0x1a')],_0x3dd511;if(_0x2f30b5>=_0x45fb18){_0x2f30b5=_0x45fb18;_0x3dd511=0xc8;}else{_0x3dd511=0xce;}_0x3a3c14[_0xf2e8('0x16')](_0x3dd511);return _0x3a3c14['set'](_0xf2e8('0x1b'),_0x245a70+'-'+_0x2f30b5+'/'+_0x45fb18)[_0xf2e8('0x1c')](_0x51f3fd);}return null;};}function patchUpdates(_0x5c9710){return function(_0x3b273d){try{jsonpatch['apply'](_0x3b273d,_0x5c9710,!![]);}catch(_0x3c9c89){return BPromise['reject'](_0x3c9c89);}return _0x3b273d[_0xf2e8('0x1d')]();};}function saveUpdates(_0x371df7,_0x272ee1){return function(_0x5e8be0){if(_0x5e8be0){return _0x5e8be0['update'](_0x371df7)[_0xf2e8('0x1e')](function(_0x4a244f){return _0x4a244f;});}return null;};}function removeEntity(_0x142853,_0x1ec257){return function(_0x39d933){if(_0x39d933){return _0x39d933[_0xf2e8('0x1f')]()['then'](function(){_0x142853[_0xf2e8('0x16')](0xcc)[_0xf2e8('0x17')]();});}};}function handleEntityNotFound(_0x5a9d44,_0x10a267){return function(_0x5f2a3b){if(!_0x5f2a3b){_0x5a9d44[_0xf2e8('0x15')](0x194);}return _0x5f2a3b;};}function handleError(_0x27da38,_0x5a64b0){_0x5a64b0=_0x5a64b0||0x1f4;return function(_0x4c9352){logger['error'](_0x4c9352[_0xf2e8('0x20')]);if(_0x4c9352[_0xf2e8('0x21')]){delete _0x4c9352['name'];}_0x27da38[_0xf2e8('0x16')](_0x5a64b0)[_0xf2e8('0x22')](_0x4c9352);};}exports[_0xf2e8('0x23')]=function(_0x26d9ac,_0xe4f3b6){var _0x2d86f4={},_0x560e9c={},_0x20f3fe={'count':0x0,'rows':[]};var _0x8107f9=_[_0xf2e8('0x24')](db[_0xf2e8('0x25')]['rawAttributes'],function(_0x19725f){return{'name':_0x19725f[_0xf2e8('0x26')],'type':_0x19725f[_0xf2e8('0x27')][_0xf2e8('0x28')]};});_0x560e9c[_0xf2e8('0x29')]=_[_0xf2e8('0x2a')](_[_0xf2e8('0x24')](_0x8107f9,_0xf2e8('0x21')),[_0xf2e8('0x21')]);_0x560e9c[_0xf2e8('0x2b')]=_[_0xf2e8('0x2c')](_0x26d9ac[_0xf2e8('0x2b')]);_0x560e9c[_0xf2e8('0x2d')]=_[_0xf2e8('0x2e')](_0x560e9c[_0xf2e8('0x29')],_0x560e9c[_0xf2e8('0x2b')]);_0x2d86f4['attributes']=_[_0xf2e8('0x2e')](_0x560e9c[_0xf2e8('0x29')],qs[_0xf2e8('0x2f')](_0x26d9ac[_0xf2e8('0x2b')][_0xf2e8('0x2f')]));_0x2d86f4[_0xf2e8('0x30')]=_0x2d86f4[_0xf2e8('0x30')][_0xf2e8('0x31')]?_0x2d86f4[_0xf2e8('0x30')]:_0x560e9c[_0xf2e8('0x29')];if(!_0x26d9ac[_0xf2e8('0x2b')][_0xf2e8('0x32')](_0xf2e8('0x33'))){_0x2d86f4['limit']=qs['limit'](_0x26d9ac[_0xf2e8('0x2b')][_0xf2e8('0x1a')]);_0x2d86f4['offset']=qs[_0xf2e8('0x19')](_0x26d9ac[_0xf2e8('0x2b')][_0xf2e8('0x19')]);}_0x2d86f4[_0xf2e8('0x34')]=qs[_0xf2e8('0x35')](_0x26d9ac[_0xf2e8('0x2b')]['sort']);_0x2d86f4[_0xf2e8('0x36')]=qs[_0xf2e8('0x2d')](_['pick'](_0x26d9ac['query'],_0x560e9c['filters']),_0x8107f9);if(_0x26d9ac[_0xf2e8('0x2b')][_0xf2e8('0x37')]){_0x2d86f4['where']=_[_0xf2e8('0x38')](_0x2d86f4[_0xf2e8('0x36')],{'$or':_['map'](_0x8107f9,function(_0x1a41ee){if(_0x1a41ee[_0xf2e8('0x27')]!==_0xf2e8('0x39')){var _0x1f40eb={};_0x1f40eb[_0x1a41ee[_0xf2e8('0x21')]]={'$like':'%'+_0x26d9ac[_0xf2e8('0x2b')]['filter']+'%'};return _0x1f40eb;}})});}_0x2d86f4=_[_0xf2e8('0x38')]({},_0x2d86f4,_0x26d9ac['options']);var _0x3e0bff={'where':_0x2d86f4[_0xf2e8('0x36')]};return db[_0xf2e8('0x25')][_0xf2e8('0x18')](_0x3e0bff)['then'](function(_0x56d271){_0x20f3fe[_0xf2e8('0x18')]=_0x56d271;if(_0x26d9ac[_0xf2e8('0x2b')][_0xf2e8('0x3a')]){_0x2d86f4[_0xf2e8('0x3b')]=[{'all':!![]}];}return db[_0xf2e8('0x25')][_0xf2e8('0x3c')](_0x2d86f4);})[_0xf2e8('0x1e')](function(_0x5e226c){_0x20f3fe[_0xf2e8('0x3d')]=_0x5e226c;return _0x20f3fe;})[_0xf2e8('0x1e')](respondWithFilteredResult(_0xe4f3b6,_0x2d86f4))[_0xf2e8('0x3e')](handleError(_0xe4f3b6,null));};exports[_0xf2e8('0x3f')]=function(_0x5e6589,_0x1a386b){var _0x5032a6={'raw':!![],'where':{'id':_0x5e6589[_0xf2e8('0x40')]['id']}},_0x39819c={};_0x39819c['model']=_['keys'](db[_0xf2e8('0x25')][_0xf2e8('0x41')]);_0x39819c[_0xf2e8('0x2b')]=_['keys'](_0x5e6589['query']);_0x39819c[_0xf2e8('0x2d')]=_[_0xf2e8('0x2e')](_0x39819c[_0xf2e8('0x29')],_0x39819c[_0xf2e8('0x2b')]);_0x5032a6[_0xf2e8('0x30')]=_[_0xf2e8('0x2e')](_0x39819c['model'],qs[_0xf2e8('0x2f')](_0x5e6589[_0xf2e8('0x2b')][_0xf2e8('0x2f')]));_0x5032a6[_0xf2e8('0x30')]=_0x5032a6[_0xf2e8('0x30')]['length']?_0x5032a6['attributes']:_0x39819c[_0xf2e8('0x29')];if(_0x5e6589[_0xf2e8('0x2b')][_0xf2e8('0x3a')]){_0x5032a6[_0xf2e8('0x3b')]=[{'all':!![]}];}_0x5032a6=_[_0xf2e8('0x38')]({},_0x5032a6,_0x5e6589[_0xf2e8('0x42')]);return db[_0xf2e8('0x25')][_0xf2e8('0x43')](_0x5032a6)[_0xf2e8('0x1e')](handleEntityNotFound(_0x1a386b,null))['then'](respondWithResult(_0x1a386b,null))[_0xf2e8('0x3e')](handleError(_0x1a386b,null));};exports[_0xf2e8('0x44')]=function(_0x1e7652,_0x5a659f){if(_0x1e7652[_0xf2e8('0x45')]['id']){delete _0x1e7652[_0xf2e8('0x45')]['id'];}return db[_0xf2e8('0x25')][_0xf2e8('0x43')]({'where':{'id':_0x1e7652['params']['id']}})['then'](handleEntityNotFound(_0x5a659f,null))[_0xf2e8('0x1e')](saveUpdates(_0x1e7652[_0xf2e8('0x45')],null))[_0xf2e8('0x1e')](respondWithResult(_0x5a659f,null))[_0xf2e8('0x3e')](handleError(_0x5a659f,null));};exports[_0xf2e8('0x1f')]=function(_0x5b2bd9,_0x2c4a3c){return db[_0xf2e8('0x25')][_0xf2e8('0x43')]({'where':{'id':_0x5b2bd9['params']['id']}})[_0xf2e8('0x1e')](handleEntityNotFound(_0x2c4a3c,null))[_0xf2e8('0x1e')](removeEntity(_0x2c4a3c,null))[_0xf2e8('0x3e')](handleError(_0x2c4a3c,null));};exports[_0xf2e8('0x46')]=function(_0x262411,_0x4dbdfa){var _0xf503aa;return db[_0xf2e8('0x47')][_0xf2e8('0x48')](function(_0x40c56e){return db[_0xf2e8('0x25')][_0xf2e8('0x46')](_0x262411[_0xf2e8('0x45')],{'transaction':_0x40c56e})[_0xf2e8('0x1e')](function(_0x2dedb8){_0xf503aa=_0x2dedb8;var _0x2540aa={'type':db[_0xf2e8('0x49')][_0xf2e8('0x4a')],'transaction':_0x40c56e};switch(_0x262411[_0xf2e8('0x45')]['type']){case _0xf2e8('0x4b'):_0x2540aa[_0xf2e8('0x27')]=db[_0xf2e8('0x49')]['TEXT'];break;case _0xf2e8('0x4c'):_0x2540aa[_0xf2e8('0x27')]=db['Sequelize'][_0xf2e8('0x4d')];break;case _0xf2e8('0x4e'):_0x2540aa[_0xf2e8('0x27')]=db[_0xf2e8('0x49')]['BOOLEAN'];_0x2540aa['defaultValue']=![];break;default:}return db[_0xf2e8('0x47')]['queryInterface']['addColumn'](_0xf2e8('0x4f'),util[_0xf2e8('0x50')](_0xf2e8('0x51'),_0xf503aa['id']),_0x2540aa);})['then'](function(){return _0xf503aa;});})[_0xf2e8('0x1e')](respondWithResult(_0x4dbdfa,0xc9))['catch'](handleError(_0x4dbdfa,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9b3e894..b67847a 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 _0x0137=['./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0137,0x1d8));var _0x7013=function(_0x486eff,_0x5cb3b0){_0x486eff=_0x486eff-0x0;var _0x95293b=_0x0137[_0x486eff];return _0x95293b;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var attributes=require(_0x7013('0x9'));module[_0x7013('0xa')]=function(_0x50b822,_0x24cb85){return _0x50b822[_0x7013('0xb')]('CmCustomField',attributes,{'tableName':_0x7013('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1eba=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x551026,_0x4cfee5){var _0x399e25=function(_0x492dca){while(--_0x492dca){_0x551026['push'](_0x551026['shift']());}};_0x399e25(++_0x4cfee5);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x1eba[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'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 1842a21..d07655b 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 _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x29c6fa,_0x2772bf){var _0x50a582=function(_0x4e3c55){while(--_0x4e3c55){_0x29c6fa['push'](_0x29c6fa['shift']());}};_0x50a582(++_0x2772bf);}(_0x579c,0xda));var _0xc579=function(_0x5240b8,_0x5ecbfa){_0x5240b8=_0x5240b8-0x0;var _0x5d0ff5=_0x579c[_0x5240b8];return _0x5d0ff5;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file +var _0x8d0e=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x4e5c0b,_0x31e5a6){var _0x18c58f=function(_0x4db80c){while(--_0x4db80c){_0x4e5c0b['push'](_0x4e5c0b['shift']());}};_0x18c58f(++_0x31e5a6);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x375272,_0x4f523b){_0x375272=_0x375272-0x0;var _0x277497=_0x8d0e[_0x375272];return _0x277497;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('CmCustomField,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('CmCustomField,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f4b2c4a..10bacca 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 _0x326b=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','get'];(function(_0x2f6a03,_0x39377b){var _0x307eff=function(_0x2c4edd){while(--_0x2c4edd){_0x2f6a03['push'](_0x2f6a03['shift']());}};_0x307eff(++_0x39377b);}(_0x326b,0x1dc));var _0xb326=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0x326b[_0x556634];return _0x4429fd;};'use strict';var multer=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var path=require(_0xb326('0x2'));var timeout=require(_0xb326('0x3'));var express=require(_0xb326('0x4'));var router=express[_0xb326('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb326('0x6'));var config=require('../../config/environment');var controller=require(_0xb326('0x7'));router['get']('/',auth[_0xb326('0x8')](),controller['index']);router[_0xb326('0x9')](_0xb326('0xa'),auth[_0xb326('0x8')](),controller[_0xb326('0xb')]);router[_0xb326('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb326('0xd')](_0xb326('0xa'),auth[_0xb326('0x8')](),controller[_0xb326('0xe')]);router[_0xb326('0xf')](_0xb326('0xa'),auth[_0xb326('0x8')](),controller[_0xb326('0x10')]);module[_0xb326('0x11')]=router; \ No newline at end of file +var _0x73f5=['get','isAuthenticated','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x4ecc22,_0x164023){var _0x1984bc=function(_0x28da2d){while(--_0x28da2d){_0x4ecc22['push'](_0x4ecc22['shift']());}};_0x1984bc(++_0x164023);}(_0x73f5,0x1cb));var _0x573f=function(_0x4fd84d,_0x320744){_0x4fd84d=_0x4fd84d-0x0;var _0x909966=_0x73f5[_0x4fd84d];return _0x909966;};'use strict';var multer=require(_0x573f('0x0'));var util=require(_0x573f('0x1'));var path=require(_0x573f('0x2'));var timeout=require(_0x573f('0x3'));var express=require('express');var router=express[_0x573f('0x4')]();var auth=require(_0x573f('0x5'));var interaction=require(_0x573f('0x6'));var config=require(_0x573f('0x7'));var controller=require(_0x573f('0x8'));router[_0x573f('0x9')]('/',auth[_0x573f('0xa')](),controller['index']);router[_0x573f('0x9')]('/:id',auth[_0x573f('0xa')](),controller['show']);router[_0x573f('0xb')]('/',auth['isAuthenticated'](),controller[_0x573f('0xc')]);router[_0x573f('0xd')](_0x573f('0xe'),auth['isAuthenticated'](),controller[_0x573f('0xf')]);router['delete'](_0x573f('0xe'),auth[_0x573f('0xa')](),controller[_0x573f('0x10')]);module[_0x573f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 1f374a4..a2deab1 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 _0xc6ac=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4cab58,_0x2119a0){_0x4cab58=_0x4cab58-0x0;var _0x1fe4b4=_0xc6ac[_0x4cab58];return _0x1fe4b4;};'use strict';var moment=require(_0xcc6a('0x0'));var Sequelize=require(_0xcc6a('0x1'));module[_0xcc6a('0x2')]={'phone':{'type':Sequelize[_0xcc6a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xcc6a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xcc6a('0x5')],'defaultValue':moment()[_0xcc6a('0x6')](_0xcc6a('0x7'))},'countbusyretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcc6a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcc6a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcc6a('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xcc6a('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcc6a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcc6a('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xcc6a('0x8')],'unique':_0xcc6a('0xa')},'UserId':{'type':Sequelize[_0xcc6a('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xcc6a('0x8')],'unique':_0xcc6a('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcc6a('0x3')]}}; \ No newline at end of file +var _0x326f=['UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x326f,0xd1));var _0xf326=function(_0x23cc68,_0x2f5902){_0x23cc68=_0x23cc68-0x0;var _0x34259d=_0x326f[_0x23cc68];return _0x34259d;};'use strict';var moment=require(_0xf326('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xf326('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf326('0x3')],'defaultValue':moment()[_0xf326('0x4')](_0xf326('0x5'))},'countbusyretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf326('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xf326('0x6')](0x2)[_0xf326('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf326('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xf326('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf326('0x6')],'unique':_0xf326('0x8')},'CampaignId':{'type':Sequelize[_0xf326('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf326('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 61ca363..efa239b 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 _0x3214=['catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','rimraf','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','limit','update','destroy','error','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notILike','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','then','includeAll','include','findAll','rows','show','params','options','find'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3214,0x1e2));var _0x4321=function(_0x3a1206,_0x12e57e){_0x3a1206=_0x3a1206-0x0;var _0x19f68b=_0x3214[_0x3a1206];return _0x19f68b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4321('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4321('0x1'));var moment=require('moment');var BPromise=require(_0x4321('0x2'));var Mustache=require(_0x4321('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4321('0x4'));var ejs=require(_0x4321('0x5'));var fs=require('fs');var _=require(_0x4321('0x6'));var squel=require(_0x4321('0x7'));var crypto=require(_0x4321('0x8'));var jsforce=require(_0x4321('0x9'));var deskjs=require(_0x4321('0xa'));var toCsv=require(_0x4321('0x4'));var querystring=require(_0x4321('0xb'));var Papa=require('papaparse');var Redis=require(_0x4321('0xc'));var shared=require('../../config/environment');var authService=require(_0x4321('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4321('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4321('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4321('0x10'))['db'];function respondWithStatusCode(_0x4be403,_0x1b8410){_0x1b8410=_0x1b8410||0xcc;return function(_0x5cd361){if(_0x5cd361){return _0x4be403[_0x4321('0x11')](_0x1b8410);}return _0x4be403[_0x4321('0x12')](_0x1b8410)[_0x4321('0x13')]();};}function respondWithResult(_0x544cda,_0xb8aa9){_0xb8aa9=_0xb8aa9||0xc8;return function(_0x141bbf){if(_0x141bbf){return _0x544cda[_0x4321('0x12')](_0xb8aa9)[_0x4321('0x14')](_0x141bbf);}};}function respondWithFilteredResult(_0x28c8b8,_0x1592a6){return function(_0x20719d){if(_0x20719d){var _0x35ff95=_0x20719d[_0x4321('0x15')],_0x1764b0=_0x1592a6['offset'],_0x86aa26=_0x1592a6[_0x4321('0x16')]+_0x1592a6[_0x4321('0x17')],_0x356c32;if(_0x86aa26>=_0x35ff95){_0x86aa26=_0x35ff95;_0x356c32=0xc8;}else{_0x356c32=0xce;}_0x28c8b8[_0x4321('0x12')](_0x356c32);return _0x28c8b8['set']('Content-Range',_0x1764b0+'-'+_0x86aa26+'/'+_0x35ff95)[_0x4321('0x14')](_0x20719d);}return null;};}function patchUpdates(_0x3528aa){return function(_0x59b61b){try{jsonpatch['apply'](_0x59b61b,_0x3528aa,!![]);}catch(_0x353f7b){return BPromise['reject'](_0x353f7b);}return _0x59b61b['save']();};}function saveUpdates(_0x4377bd,_0x34b2f5){return function(_0x2373bf){if(_0x2373bf){return _0x2373bf[_0x4321('0x18')](_0x4377bd)['then'](function(_0x1aaa33){return _0x1aaa33;});}return null;};}function removeEntity(_0x1498d4,_0x273343){return function(_0x4411ca){if(_0x4411ca){return _0x4411ca[_0x4321('0x19')]()['then'](function(){_0x1498d4['status'](0xcc)[_0x4321('0x13')]();});}};}function handleEntityNotFound(_0x411ccf,_0xaf3183){return function(_0x5cca6d){if(!_0x5cca6d){_0x411ccf[_0x4321('0x11')](0x194);}return _0x5cca6d;};}function handleError(_0x46c720,_0x3f1933){_0x3f1933=_0x3f1933||0x1f4;return function(_0x5448e5){logger[_0x4321('0x1a')](_0x5448e5['stack']);if(_0x5448e5[_0x4321('0x1b')]){delete _0x5448e5[_0x4321('0x1b')];}_0x46c720[_0x4321('0x12')](_0x3f1933)['send'](_0x5448e5);};}exports[_0x4321('0x1c')]=function(_0xcc1111,_0x10a37f){var _0xd2978d={},_0x19562a={},_0x1ecb1b={'count':0x0,'rows':[]};var _0x1ace90=_['map'](db['CmHopper'][_0x4321('0x1d')],function(_0x35b8dd){return{'name':_0x35b8dd['fieldName'],'type':_0x35b8dd[_0x4321('0x1e')][_0x4321('0x1f')]};});_0x19562a[_0x4321('0x20')]=_[_0x4321('0x21')](_0x1ace90,_0x4321('0x1b'));_0x19562a[_0x4321('0x22')]=_[_0x4321('0x23')](_0xcc1111[_0x4321('0x22')]);_0x19562a[_0x4321('0x24')]=_[_0x4321('0x25')](_0x19562a[_0x4321('0x20')],_0x19562a[_0x4321('0x22')]);_0x19562a[_0x4321('0x24')]=_[_0x4321('0x26')](_0x19562a['filters'],['$and',_0x4321('0x27'),_0x4321('0x28'),_0x4321('0x29'),_0x4321('0x2a'),_0x4321('0x2b'),_0x4321('0x2c'),_0x4321('0x2d'),_0x4321('0x2e'),_0x4321('0x2f'),_0x4321('0x30'),_0x4321('0x31'),_0x4321('0x32'),_0x4321('0x33'),'$notLike','$iLike',_0x4321('0x34'),'$like','$overlap',_0x4321('0x35'),_0x4321('0x36'),_0x4321('0x37')]);_0xd2978d['attributes']=_[_0x4321('0x25')](_0x19562a[_0x4321('0x20')],qs[_0x4321('0x38')](_0xcc1111[_0x4321('0x22')][_0x4321('0x38')]));_0xd2978d[_0x4321('0x39')]=_0xd2978d[_0x4321('0x39')][_0x4321('0x3a')]?_0xd2978d[_0x4321('0x39')]:_0x19562a['model'];if(!_0xcc1111['query'][_0x4321('0x3b')](_0x4321('0x3c'))){_0xd2978d[_0x4321('0x17')]=qs[_0x4321('0x17')](_0xcc1111['query'][_0x4321('0x17')]);_0xd2978d[_0x4321('0x16')]=qs['offset'](_0xcc1111[_0x4321('0x22')]['offset']);}_0xd2978d[_0x4321('0x3d')]=qs['sort'](_0xcc1111[_0x4321('0x22')][_0x4321('0x3e')]);_0xd2978d[_0x4321('0x3f')]=qs[_0x4321('0x24')](_[_0x4321('0x40')](_0xcc1111[_0x4321('0x22')],_0x19562a[_0x4321('0x24')]),_0x1ace90);if(_0xcc1111[_0x4321('0x22')][_0x4321('0x41')]){_0xd2978d[_0x4321('0x3f')]=_[_0x4321('0x42')](_0xd2978d[_0x4321('0x3f')],{'$or':_[_0x4321('0x21')](_0x1ace90,function(_0x3da998){if(_0x3da998[_0x4321('0x1e')]!==_0x4321('0x43')){var _0x4d570a={};_0x4d570a[_0x3da998['name']]={'$like':'%'+_0xcc1111[_0x4321('0x22')][_0x4321('0x41')]+'%'};return _0x4d570a;}})});}_0xd2978d=_['merge']({},_0xd2978d,_0xcc1111['options']);var _0x106f93={'where':_0xd2978d[_0x4321('0x3f')]};return db[_0x4321('0x44')][_0x4321('0x15')](_0x106f93)[_0x4321('0x45')](function(_0x2195ee){_0x1ecb1b[_0x4321('0x15')]=_0x2195ee;if(_0xcc1111['query'][_0x4321('0x46')]){_0xd2978d[_0x4321('0x47')]=[{'all':!![]}];}return db[_0x4321('0x44')][_0x4321('0x48')](_0xd2978d);})[_0x4321('0x45')](function(_0x5bcbeb){_0x1ecb1b[_0x4321('0x49')]=_0x5bcbeb;return _0x1ecb1b;})[_0x4321('0x45')](respondWithFilteredResult(_0x10a37f,_0xd2978d))['catch'](handleError(_0x10a37f,null));};exports[_0x4321('0x4a')]=function(_0x440212,_0xcf171c){var _0x484191={'raw':!![],'where':{'id':_0x440212[_0x4321('0x4b')]['id']}},_0x238107={};_0x238107['model']=_[_0x4321('0x23')](db[_0x4321('0x44')]['rawAttributes']);_0x238107[_0x4321('0x22')]=_['keys'](_0x440212[_0x4321('0x22')]);_0x238107[_0x4321('0x24')]=_['intersection'](_0x238107[_0x4321('0x20')],_0x238107['query']);_0x484191[_0x4321('0x39')]=_[_0x4321('0x25')](_0x238107[_0x4321('0x20')],qs['fields'](_0x440212[_0x4321('0x22')]['fields']));_0x484191[_0x4321('0x39')]=_0x484191[_0x4321('0x39')]['length']?_0x484191[_0x4321('0x39')]:_0x238107['model'];if(_0x440212[_0x4321('0x22')][_0x4321('0x46')]){_0x484191['include']=[{'all':!![]}];}_0x484191=_[_0x4321('0x42')]({},_0x484191,_0x440212[_0x4321('0x4c')]);return db['CmHopper'][_0x4321('0x4d')](_0x484191)[_0x4321('0x45')](handleEntityNotFound(_0xcf171c,null))[_0x4321('0x45')](respondWithResult(_0xcf171c,null))[_0x4321('0x4e')](handleError(_0xcf171c,null));};exports[_0x4321('0x4f')]=function(_0x178ff1,_0x4399f3){return db[_0x4321('0x44')][_0x4321('0x4f')](_0x178ff1[_0x4321('0x50')],{})['then'](respondWithResult(_0x4399f3,0xc9))[_0x4321('0x4e')](handleError(_0x4399f3,null));};exports[_0x4321('0x18')]=function(_0x40edc3,_0x3a90c2){if(_0x40edc3[_0x4321('0x50')]['id']){delete _0x40edc3[_0x4321('0x50')]['id'];}return db[_0x4321('0x44')][_0x4321('0x4d')]({'where':{'id':_0x40edc3['params']['id']}})['then'](handleEntityNotFound(_0x3a90c2,null))[_0x4321('0x45')](saveUpdates(_0x40edc3[_0x4321('0x50')],null))[_0x4321('0x45')](respondWithResult(_0x3a90c2,null))['catch'](handleError(_0x3a90c2,null));};exports[_0x4321('0x51')]=function(_0x603c97,_0x9d1bb0){return db[_0x4321('0x44')][_0x4321('0x51')]()[_0x4321('0x45')](respondWithResult(_0x9d1bb0,null))[_0x4321('0x4e')](handleError(_0x9d1bb0,null));};exports[_0x4321('0x19')]=function(_0x4f2b86,_0xa3cddc){var _0x43c0a8;return db[_0x4321('0x44')][_0x4321('0x4d')]({'where':{'id':_0x4f2b86[_0x4321('0x4b')]['id']}})[_0x4321('0x45')](handleEntityNotFound(_0xa3cddc,null))[_0x4321('0x45')](function(_0x236e08){if(_0x236e08){return _0x236e08[_0x4321('0x19')]()['then'](function(_0x14ccbf){return _0x14ccbf;});}})[_0x4321('0x45')](function(_0x344458){_0x43c0a8=_0x344458;if(_0x344458){if(_0x344458[_0x4321('0x52')]||_0x344458[_0x4321('0x53')]){return db[_0x344458[_0x4321('0x52')]?_0x4321('0x54'):_0x4321('0x55')][_0x4321('0x4d')]({'where':{'id':_0x344458[_0x4321('0x52')]?_0x344458[_0x4321('0x52')]:_0x344458[_0x4321('0x53')]},'attributes':['id',_0x4321('0x1b')],'raw':!![]});}}})[_0x4321('0x45')](function(_0x48f8a0){var _0x248eb6={};if(_0x48f8a0){_[_0x4321('0x42')](_0x248eb6,_[_0x4321('0x56')](_0x43c0a8['dataValues'],[_0x4321('0x57'),_0x4321('0x58'),'id']));_0x248eb6[_0x4321('0x59')]=0x15;_0x248eb6[_0x4321('0x5a')]='deleted';_0x248eb6['campaign']=_0x48f8a0[_0x4321('0x1b')];_0x248eb6[_0x4321('0x5b')]=_0x4f2b86[_0x4321('0x5c')]['name'];_0x248eb6[_0x4321('0x5d')]=_0x4f2b86[_0x4321('0x5c')]['id'];_0x248eb6[_0x4321('0x5e')]=!![];_0x248eb6['deletedat']=moment()[_0x4321('0x5f')](_0x4321('0x60'));_0x248eb6[_0x4321('0x61')]=_0x43c0a8['phone'];_0x248eb6[_0x4321('0x62')]=_0x43c0a8['VoiceQueueId']?_0x4321('0x63'):_0x4321('0x64');return db[_0x4321('0x65')][_0x4321('0x4d')]({'where':{'id':_0x248eb6[_0x4321('0x66')]},'attributes':['firstName','lastName']})[_0x4321('0x45')](function(_0x5c4b6e){if(!_['isNil'](_0xa3cddc)&&!_[_0x4321('0x67')](_0x5c4b6e[_0x4321('0x68')])){_0x248eb6[_0x4321('0x69')]=_0x5c4b6e[_0x4321('0x68')];if(!_[_0x4321('0x67')](_0x5c4b6e['lastName'])){_0x248eb6[_0x4321('0x69')]+='\x20'+_0x5c4b6e[_0x4321('0x6a')];}}})[_0x4321('0x6b')](function(){return db[_0x4321('0x6c')]['create'](_0x248eb6);});}})[_0x4321('0x45')](function(){return _0xa3cddc['status'](0xcc)[_0x4321('0x13')]();})[_0x4321('0x4e')](handleError(_0xa3cddc,null));};exports[_0x4321('0x6d')]=function(_0x4cbfd2,_0x42a31d,_0x29b5b8){var _0x3a6cf8=[];return db[_0x4321('0x65')]['describe']()[_0x4321('0x45')](function(_0x462bab){_0x3a6cf8=_['keys'](_0x462bab);return _0x4cbfd2[_0x4321('0x5c')][_0x4321('0x6e')]({'where':{'type':_0x4321('0x6f'),'dialActive':!![],'dialMethod':_0x4321('0x70')},'attributes':['id',_0x4321('0x71')],'raw':!![]});})[_0x4321('0x45')](function(_0x140f35){if(_0x140f35&&_0x140f35[_0x4321('0x3a')]){return db[_0x4321('0x72')][_0x4321('0x73')](function(_0x5384f0){var _0x5958a6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4321('0x5f')](_0x4321('0x60'))},'VoiceQueueId':{'$in':_[_0x4321('0x21')](_0x140f35,'id')},'$or':[{'UserId':null},{'UserId':_0x4cbfd2['user']['id']}]};var _0x567665=[];if(_0x4cbfd2[_0x4321('0x50')]['direction']&&_0x4cbfd2['body'][_0x4321('0x74')]===_0x4321('0x75')){if(!_['isEmpty'](_0x4cbfd2[_0x4321('0x50')]['hopperIds'])){_0x5958a6['id']={'$in':_0x4cbfd2[_0x4321('0x50')][_0x4321('0x76')]};}_0x567665=[[_0x4321('0x77'),_0x4321('0x78')],['scheduledAt',_0x140f35[0x0][_0x4321('0x71')]===_0x4321('0x78')?_0x4321('0x79'):_0x4321('0x78')],db[_0x4321('0x72')][_0x4321('0x7a')](_0x4321('0x7b')),['id',_0x4321('0x79')]];}else{if(!_[_0x4321('0x7c')](_0x4cbfd2['body'][_0x4321('0x76')])){_0x5958a6['id']={'$notIn':_0x4cbfd2['body'][_0x4321('0x76')]};}_0x567665=[[_0x4321('0x77'),'DESC'],[_0x4321('0x7d'),_0x140f35[0x0][_0x4321('0x71')]],db['sequelize'][_0x4321('0x7a')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x4321('0x78')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x4321('0x7e')],'where':_0x5958a6,'order':_0x567665,'transaction':_0x5384f0,'lock':_0x5384f0[_0x4321('0x7f')][_0x4321('0x80')],'include':[{'model':db[_0x4321('0x65')],'as':_0x4321('0x81'),'attributes':_0x3a6cf8,'include':[{'model':db[_0x4321('0x82')],'as':_0x4321('0x83'),'attributes':['id',_0x4321('0x1b')]}]},{'model':db[_0x4321('0x84')],'as':'List','attributes':['id',_0x4321('0x1b')]},{'model':db[_0x4321('0x54')],'as':_0x4321('0x85'),'attributes':['id',_0x4321('0x1b'),'dialActive']}]})[_0x4321('0x45')](function(_0x4c1f6b){if(_0x4c1f6b){return _0x4c1f6b['update']({'UserId':_0x4cbfd2[_0x4321('0x5c')]['id']},{'transaction':_0x5384f0});}});});}})['then'](handleEntityNotFound(_0x42a31d,null))[_0x4321('0x45')](respondWithResult(_0x42a31d,null))[_0x4321('0x4e')](handleError(_0x42a31d,null));};exports[_0x4321('0x86')]=function(_0x53885c,_0x7f44d2,_0x1056cc){return _0x53885c['user'][_0x4321('0x6e')]({'where':{'type':_0x4321('0x6f'),'dialActive':!![],'dialMethod':_0x4321('0x70')},'attributes':['id'],'raw':!![]})[_0x4321('0x45')](function(_0x5ed3a1){if(_0x5ed3a1&&_0x5ed3a1[_0x4321('0x3a')]){return db[_0x4321('0x44')][_0x4321('0x15')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x4321('0x60'))},'VoiceQueueId':{'$in':_[_0x4321('0x21')](_0x5ed3a1,'id')},'$or':[{'UserId':null},{'UserId':_0x53885c[_0x4321('0x5c')]['id']}]}});}return 0x0;})[_0x4321('0x45')](function(_0x48bba7){if(!_[_0x4321('0x67')](_0x48bba7)&&_['isNumber'](_0x48bba7)){return _0x7f44d2['status'](0xc8)[_0x4321('0x14')]({'contacts':_0x48bba7});}else{logger['error'](_0x4321('0x87'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x7f44d2[_0x4321('0x11')](0x194);}})[_0x4321('0x4e')](handleError(_0x7f44d2,null));};exports[_0x4321('0x88')]=function(_0x10ac5a,_0x4c58da,_0xb2f23d){var _0x182bf9=shared[_0x4321('0x89')];var _0x286549=[];_[_0x4321('0x21')](_0x182bf9,function(_0x5ab9d0){_0x286549['push']({'id':_0x5ab9d0['name'],'name':_0x5ab9d0[_0x4321('0x1b')],'utcOffset':_0x5ab9d0[_0x4321('0x8a')]});});return _0x4c58da[_0x4321('0x12')](0xc8)['json']({'tz':_0x286549});};exports[_0x4321('0x8b')]=function(_0x4de785,_0x46a337,_0x3a03b7){var _0x5e8145=shared[_0x4321('0x89')];var _0xd9d720={};if(!_['isNil'](_0x5e8145[_0x4de785[_0x4321('0x50')]['id']]))_0xd9d720=_0x5e8145[_0x4de785[_0x4321('0x50')]['id']];return _0x46a337[_0x4321('0x12')](0xc8)['json'](_0xd9d720);}; \ No newline at end of file +var _0xd1e3=['preview','dialOrderByScheduledAt','sequelize','transaction','prev','isEmpty','hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','List','Queue','getOpenContacts','isNumber','getTimezones','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','filters','concat','$and','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','CmHopper','findAll','rows','catch','show','params','length','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','getPreview','getVoiceQueues','outbound'];(function(_0x30a6e8,_0x3b5610){var _0x5629a5=function(_0x5af72f){while(--_0x5af72f){_0x30a6e8['push'](_0x30a6e8['shift']());}};_0x5629a5(++_0x3b5610);}(_0xd1e3,0x142));var _0x3d1e=function(_0x226c11,_0x14c0a4){_0x226c11=_0x226c11-0x0;var _0x4dc73e=_0xd1e3[_0x226c11];return _0x4dc73e;};'use strict';var pdf=require(_0x3d1e('0x0'));var emlformat=require(_0x3d1e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d1e('0x2'));var jsonpatch=require(_0x3d1e('0x3'));var rp=require(_0x3d1e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d1e('0x5'));var path=require(_0x3d1e('0x6'));var sox=require(_0x3d1e('0x7'));var csv=require(_0x3d1e('0x8'));var ejs=require(_0x3d1e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d1e('0xa'));var jsforce=require(_0x3d1e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3d1e('0x8'));var querystring=require(_0x3d1e('0xc'));var Papa=require('papaparse');var Redis=require(_0x3d1e('0xd'));var shared=require(_0x3d1e('0xe'));var authService=require(_0x3d1e('0xf'));var qs=require(_0x3d1e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d1e('0x11'))(_0x3d1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3d1e('0xe'));var db=require(_0x3d1e('0x13'))['db'];function respondWithStatusCode(_0x4c2376,_0x144d0a){_0x144d0a=_0x144d0a||0xcc;return function(_0x550893){if(_0x550893){return _0x4c2376[_0x3d1e('0x14')](_0x144d0a);}return _0x4c2376['status'](_0x144d0a)[_0x3d1e('0x15')]();};}function respondWithResult(_0xbdf1,_0x4263d4){_0x4263d4=_0x4263d4||0xc8;return function(_0x338515){if(_0x338515){return _0xbdf1[_0x3d1e('0x16')](_0x4263d4)['json'](_0x338515);}};}function respondWithFilteredResult(_0x3cef4d,_0x1a3949){return function(_0x504ac3){if(_0x504ac3){var _0x78ccb3=_0x504ac3[_0x3d1e('0x17')],_0x27d2f7=_0x1a3949[_0x3d1e('0x18')],_0x1721a9=_0x1a3949[_0x3d1e('0x18')]+_0x1a3949[_0x3d1e('0x19')],_0x21e4b0;if(_0x1721a9>=_0x78ccb3){_0x1721a9=_0x78ccb3;_0x21e4b0=0xc8;}else{_0x21e4b0=0xce;}_0x3cef4d[_0x3d1e('0x16')](_0x21e4b0);return _0x3cef4d[_0x3d1e('0x1a')](_0x3d1e('0x1b'),_0x27d2f7+'-'+_0x1721a9+'/'+_0x78ccb3)[_0x3d1e('0x1c')](_0x504ac3);}return null;};}function patchUpdates(_0x3e5a52){return function(_0x2cb597){try{jsonpatch['apply'](_0x2cb597,_0x3e5a52,!![]);}catch(_0x1a3705){return BPromise[_0x3d1e('0x1d')](_0x1a3705);}return _0x2cb597['save']();};}function saveUpdates(_0x505412,_0x437158){return function(_0x5c6321){if(_0x5c6321){return _0x5c6321[_0x3d1e('0x1e')](_0x505412)[_0x3d1e('0x1f')](function(_0x52375){return _0x52375;});}return null;};}function removeEntity(_0x403c4c,_0x1e460b){return function(_0x3bbefc){if(_0x3bbefc){return _0x3bbefc[_0x3d1e('0x20')]()[_0x3d1e('0x1f')](function(){_0x403c4c[_0x3d1e('0x16')](0xcc)[_0x3d1e('0x15')]();});}};}function handleEntityNotFound(_0x306c46,_0x43cab8){return function(_0x3f667d){if(!_0x3f667d){_0x306c46[_0x3d1e('0x14')](0x194);}return _0x3f667d;};}function handleError(_0x5c8de1,_0x41161f){_0x41161f=_0x41161f||0x1f4;return function(_0x247dae){logger[_0x3d1e('0x21')](_0x247dae[_0x3d1e('0x22')]);if(_0x247dae[_0x3d1e('0x23')]){delete _0x247dae[_0x3d1e('0x23')];}_0x5c8de1[_0x3d1e('0x16')](_0x41161f)[_0x3d1e('0x24')](_0x247dae);};}exports[_0x3d1e('0x25')]=function(_0x430f16,_0x2283af){var _0x28ecd2={},_0x3404e3={},_0x3f400a={'count':0x0,'rows':[]};var _0x561bd5=_[_0x3d1e('0x26')](db['CmHopper'][_0x3d1e('0x27')],function(_0x5442b2){return{'name':_0x5442b2[_0x3d1e('0x28')],'type':_0x5442b2['type'][_0x3d1e('0x29')]};});_0x3404e3[_0x3d1e('0x2a')]=_[_0x3d1e('0x26')](_0x561bd5,_0x3d1e('0x23'));_0x3404e3[_0x3d1e('0x2b')]=_[_0x3d1e('0x2c')](_0x430f16['query']);_0x3404e3['filters']=_[_0x3d1e('0x2d')](_0x3404e3[_0x3d1e('0x2a')],_0x3404e3['query']);_0x3404e3[_0x3d1e('0x2e')]=_[_0x3d1e('0x2f')](_0x3404e3[_0x3d1e('0x2e')],[_0x3d1e('0x30'),'$or','$gt',_0x3d1e('0x31'),_0x3d1e('0x32'),_0x3d1e('0x33'),'$ne',_0x3d1e('0x34'),_0x3d1e('0x35'),_0x3d1e('0x36'),_0x3d1e('0x37'),_0x3d1e('0x38'),_0x3d1e('0x39'),'$like',_0x3d1e('0x3a'),_0x3d1e('0x3b'),_0x3d1e('0x3c'),_0x3d1e('0x3d'),_0x3d1e('0x3e'),_0x3d1e('0x3f'),'$contained',_0x3d1e('0x40')]);_0x28ecd2[_0x3d1e('0x41')]=_[_0x3d1e('0x2d')](_0x3404e3[_0x3d1e('0x2a')],qs[_0x3d1e('0x42')](_0x430f16[_0x3d1e('0x2b')][_0x3d1e('0x42')]));_0x28ecd2[_0x3d1e('0x41')]=_0x28ecd2['attributes']['length']?_0x28ecd2[_0x3d1e('0x41')]:_0x3404e3[_0x3d1e('0x2a')];if(!_0x430f16['query'][_0x3d1e('0x43')](_0x3d1e('0x44'))){_0x28ecd2[_0x3d1e('0x19')]=qs[_0x3d1e('0x19')](_0x430f16[_0x3d1e('0x2b')][_0x3d1e('0x19')]);_0x28ecd2['offset']=qs['offset'](_0x430f16[_0x3d1e('0x2b')][_0x3d1e('0x18')]);}_0x28ecd2[_0x3d1e('0x45')]=qs[_0x3d1e('0x46')](_0x430f16[_0x3d1e('0x2b')][_0x3d1e('0x46')]);_0x28ecd2[_0x3d1e('0x47')]=qs[_0x3d1e('0x2e')](_['pick'](_0x430f16['query'],_0x3404e3[_0x3d1e('0x2e')]),_0x561bd5);if(_0x430f16[_0x3d1e('0x2b')][_0x3d1e('0x48')]){_0x28ecd2['where']=_[_0x3d1e('0x49')](_0x28ecd2['where'],{'$or':_[_0x3d1e('0x26')](_0x561bd5,function(_0x499d05){if(_0x499d05[_0x3d1e('0x4a')]!==_0x3d1e('0x4b')){var _0x3ca870={};_0x3ca870[_0x499d05[_0x3d1e('0x23')]]={'$like':'%'+_0x430f16[_0x3d1e('0x2b')][_0x3d1e('0x48')]+'%'};return _0x3ca870;}})});}_0x28ecd2=_[_0x3d1e('0x49')]({},_0x28ecd2,_0x430f16[_0x3d1e('0x4c')]);var _0x4b2599={'where':_0x28ecd2['where']};return db['CmHopper'][_0x3d1e('0x17')](_0x4b2599)[_0x3d1e('0x1f')](function(_0x40e398){_0x3f400a[_0x3d1e('0x17')]=_0x40e398;if(_0x430f16['query'][_0x3d1e('0x4d')]){_0x28ecd2[_0x3d1e('0x4e')]=[{'all':!![]}];}return db[_0x3d1e('0x4f')][_0x3d1e('0x50')](_0x28ecd2);})[_0x3d1e('0x1f')](function(_0x13798e){_0x3f400a[_0x3d1e('0x51')]=_0x13798e;return _0x3f400a;})[_0x3d1e('0x1f')](respondWithFilteredResult(_0x2283af,_0x28ecd2))[_0x3d1e('0x52')](handleError(_0x2283af,null));};exports[_0x3d1e('0x53')]=function(_0x5ae145,_0xd4dde0){var _0x9b172d={'raw':!![],'where':{'id':_0x5ae145[_0x3d1e('0x54')]['id']}},_0x453062={};_0x453062['model']=_[_0x3d1e('0x2c')](db[_0x3d1e('0x4f')][_0x3d1e('0x27')]);_0x453062[_0x3d1e('0x2b')]=_[_0x3d1e('0x2c')](_0x5ae145[_0x3d1e('0x2b')]);_0x453062[_0x3d1e('0x2e')]=_[_0x3d1e('0x2d')](_0x453062['model'],_0x453062[_0x3d1e('0x2b')]);_0x9b172d[_0x3d1e('0x41')]=_[_0x3d1e('0x2d')](_0x453062[_0x3d1e('0x2a')],qs[_0x3d1e('0x42')](_0x5ae145[_0x3d1e('0x2b')][_0x3d1e('0x42')]));_0x9b172d[_0x3d1e('0x41')]=_0x9b172d[_0x3d1e('0x41')][_0x3d1e('0x55')]?_0x9b172d[_0x3d1e('0x41')]:_0x453062[_0x3d1e('0x2a')];if(_0x5ae145[_0x3d1e('0x2b')]['includeAll']){_0x9b172d['include']=[{'all':!![]}];}_0x9b172d=_[_0x3d1e('0x49')]({},_0x9b172d,_0x5ae145[_0x3d1e('0x4c')]);return db['CmHopper'][_0x3d1e('0x56')](_0x9b172d)['then'](handleEntityNotFound(_0xd4dde0,null))['then'](respondWithResult(_0xd4dde0,null))[_0x3d1e('0x52')](handleError(_0xd4dde0,null));};exports['create']=function(_0x4a74be,_0x4c45ff){return db[_0x3d1e('0x4f')][_0x3d1e('0x57')](_0x4a74be[_0x3d1e('0x58')],{})['then'](respondWithResult(_0x4c45ff,0xc9))[_0x3d1e('0x52')](handleError(_0x4c45ff,null));};exports[_0x3d1e('0x1e')]=function(_0x2c98d3,_0x403a9){if(_0x2c98d3[_0x3d1e('0x58')]['id']){delete _0x2c98d3['body']['id'];}return db['CmHopper'][_0x3d1e('0x56')]({'where':{'id':_0x2c98d3[_0x3d1e('0x54')]['id']}})[_0x3d1e('0x1f')](handleEntityNotFound(_0x403a9,null))[_0x3d1e('0x1f')](saveUpdates(_0x2c98d3[_0x3d1e('0x58')],null))[_0x3d1e('0x1f')](respondWithResult(_0x403a9,null))[_0x3d1e('0x52')](handleError(_0x403a9,null));};exports[_0x3d1e('0x59')]=function(_0x4b08e9,_0x4f52b9){return db[_0x3d1e('0x4f')][_0x3d1e('0x59')]()['then'](respondWithResult(_0x4f52b9,null))[_0x3d1e('0x52')](handleError(_0x4f52b9,null));};exports[_0x3d1e('0x20')]=function(_0x5465c2,_0x2a2ea8){var _0x57fd1d;return db[_0x3d1e('0x4f')][_0x3d1e('0x56')]({'where':{'id':_0x5465c2[_0x3d1e('0x54')]['id']}})[_0x3d1e('0x1f')](handleEntityNotFound(_0x2a2ea8,null))[_0x3d1e('0x1f')](function(_0x30403c){if(_0x30403c){return _0x30403c[_0x3d1e('0x20')]()[_0x3d1e('0x1f')](function(_0xa995b3){return _0xa995b3;});}})[_0x3d1e('0x1f')](function(_0x1d0f14){_0x57fd1d=_0x1d0f14;if(_0x1d0f14){if(_0x1d0f14[_0x3d1e('0x5a')]||_0x1d0f14[_0x3d1e('0x5b')]){return db[_0x1d0f14[_0x3d1e('0x5a')]?_0x3d1e('0x5c'):_0x3d1e('0x5d')][_0x3d1e('0x56')]({'where':{'id':_0x1d0f14[_0x3d1e('0x5a')]?_0x1d0f14['VoiceQueueId']:_0x1d0f14[_0x3d1e('0x5b')]},'attributes':['id',_0x3d1e('0x23')],'raw':!![]});}}})[_0x3d1e('0x1f')](function(_0x41044d){var _0x3de953={};if(_0x41044d){_[_0x3d1e('0x49')](_0x3de953,_[_0x3d1e('0x5e')](_0x57fd1d[_0x3d1e('0x5f')],[_0x3d1e('0x60'),_0x3d1e('0x61'),'id']));_0x3de953[_0x3d1e('0x62')]=0x15;_0x3de953[_0x3d1e('0x63')]=_0x3d1e('0x64');_0x3de953[_0x3d1e('0x65')]=_0x41044d[_0x3d1e('0x23')];_0x3de953[_0x3d1e('0x66')]=_0x5465c2['user'][_0x3d1e('0x23')];_0x3de953['UserId']=_0x5465c2[_0x3d1e('0x67')]['id'];_0x3de953['deleted']=!![];_0x3de953[_0x3d1e('0x68')]=moment()[_0x3d1e('0x69')](_0x3d1e('0x6a'));_0x3de953['calleridnum']=_0x57fd1d[_0x3d1e('0x6b')];_0x3de953[_0x3d1e('0x6c')]=_0x57fd1d[_0x3d1e('0x5a')]?'queue':_0x3d1e('0x6d');return db[_0x3d1e('0x6e')][_0x3d1e('0x56')]({'where':{'id':_0x3de953[_0x3d1e('0x6f')]},'attributes':['firstName',_0x3d1e('0x70')]})['then'](function(_0x20423e){if(!_[_0x3d1e('0x71')](_0x2a2ea8)&&!_[_0x3d1e('0x71')](_0x20423e[_0x3d1e('0x72')])){_0x3de953[_0x3d1e('0x73')]=_0x20423e[_0x3d1e('0x72')];if(!_[_0x3d1e('0x71')](_0x20423e[_0x3d1e('0x70')])){_0x3de953[_0x3d1e('0x73')]+='\x20'+_0x20423e['lastName'];}}})['finally'](function(){return db['CmHopperFinal']['create'](_0x3de953);});}})[_0x3d1e('0x1f')](function(){return _0x2a2ea8[_0x3d1e('0x16')](0xcc)[_0x3d1e('0x15')]();})[_0x3d1e('0x52')](handleError(_0x2a2ea8,null));};exports[_0x3d1e('0x74')]=function(_0x441613,_0x19f7bb,_0x498f62){var _0x5b1c10=[];return db[_0x3d1e('0x6e')][_0x3d1e('0x59')]()[_0x3d1e('0x1f')](function(_0x4ee5ba){_0x5b1c10=_[_0x3d1e('0x2c')](_0x4ee5ba);return _0x441613['user'][_0x3d1e('0x75')]({'where':{'type':_0x3d1e('0x76'),'dialActive':!![],'dialMethod':_0x3d1e('0x77')},'attributes':['id',_0x3d1e('0x78')],'raw':!![]});})['then'](function(_0x451a13){if(_0x451a13&&_0x451a13[_0x3d1e('0x55')]){return db[_0x3d1e('0x79')][_0x3d1e('0x7a')](function(_0x5e09e4){var _0x2bfeec={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3d1e('0x69')](_0x3d1e('0x6a'))},'VoiceQueueId':{'$in':_[_0x3d1e('0x26')](_0x451a13,'id')},'$or':[{'UserId':null},{'UserId':_0x441613[_0x3d1e('0x67')]['id']}]};var _0x3f2824=[];if(_0x441613['body']['direction']&&_0x441613['body']['direction']===_0x3d1e('0x7b')){if(!_[_0x3d1e('0x7c')](_0x441613['body'][_0x3d1e('0x7d')])){_0x2bfeec['id']={'$in':_0x441613[_0x3d1e('0x58')]['hopperIds']};}_0x3f2824=[[_0x3d1e('0x7e'),_0x3d1e('0x7f')],['scheduledAt',_0x451a13[0x0][_0x3d1e('0x78')]===_0x3d1e('0x7f')?'DESC':'ASC'],db[_0x3d1e('0x79')][_0x3d1e('0x80')](_0x3d1e('0x81')),['id',_0x3d1e('0x82')]];}else{if(!_[_0x3d1e('0x7c')](_0x441613[_0x3d1e('0x58')][_0x3d1e('0x7d')])){_0x2bfeec['id']={'$notIn':_0x441613[_0x3d1e('0x58')]['hopperIds']};}_0x3f2824=[[_0x3d1e('0x7e'),'DESC'],[_0x3d1e('0x83'),_0x451a13[0x0]['dialOrderByScheduledAt']],db[_0x3d1e('0x79')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x3d1e('0x7f')]];}return db[_0x3d1e('0x4f')][_0x3d1e('0x84')]({'attributes':['id',_0x3d1e('0x85')],'where':_0x2bfeec,'order':_0x3f2824,'transaction':_0x5e09e4,'lock':_0x5e09e4['LOCK'][_0x3d1e('0x86')],'include':[{'model':db[_0x3d1e('0x6e')],'as':_0x3d1e('0x87'),'attributes':_0x5b1c10,'include':[{'model':db[_0x3d1e('0x88')],'as':_0x3d1e('0x89'),'attributes':['id',_0x3d1e('0x23')]}]},{'model':db['CmList'],'as':_0x3d1e('0x8a'),'attributes':['id',_0x3d1e('0x23')]},{'model':db[_0x3d1e('0x5c')],'as':_0x3d1e('0x8b'),'attributes':['id',_0x3d1e('0x23'),'dialActive']}]})[_0x3d1e('0x1f')](function(_0x46acf3){if(_0x46acf3){return _0x46acf3[_0x3d1e('0x1e')]({'UserId':_0x441613[_0x3d1e('0x67')]['id']},{'transaction':_0x5e09e4});}});});}})[_0x3d1e('0x1f')](handleEntityNotFound(_0x19f7bb,null))['then'](respondWithResult(_0x19f7bb,null))[_0x3d1e('0x52')](handleError(_0x19f7bb,null));};exports[_0x3d1e('0x8c')]=function(_0x2afeef,_0x159953,_0x3597e9){return _0x2afeef[_0x3d1e('0x67')][_0x3d1e('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x3d1e('0x77')},'attributes':['id'],'raw':!![]})[_0x3d1e('0x1f')](function(_0x28c435){if(_0x28c435&&_0x28c435[_0x3d1e('0x55')]){return db[_0x3d1e('0x4f')][_0x3d1e('0x17')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3d1e('0x69')](_0x3d1e('0x6a'))},'VoiceQueueId':{'$in':_[_0x3d1e('0x26')](_0x28c435,'id')},'$or':[{'UserId':null},{'UserId':_0x2afeef[_0x3d1e('0x67')]['id']}]}});}return 0x0;})[_0x3d1e('0x1f')](function(_0x557a7f){if(!_['isNil'](_0x557a7f)&&_[_0x3d1e('0x8d')](_0x557a7f)){return _0x159953['status'](0xc8)[_0x3d1e('0x1c')]({'contacts':_0x557a7f});}else{logger[_0x3d1e('0x21')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3d1e('0x8c'),0x194,'entity\x20not\x20found');_0x159953[_0x3d1e('0x14')](0x194);}})[_0x3d1e('0x52')](handleError(_0x159953,null));};exports[_0x3d1e('0x8e')]=function(_0x314e4c,_0x50848f,_0x25bb73){var _0x5106a0=shared[_0x3d1e('0x8f')];var _0x4ba32f=[];_['map'](_0x5106a0,function(_0x5b2ce3){_0x4ba32f[_0x3d1e('0x90')]({'id':_0x5b2ce3[_0x3d1e('0x23')],'name':_0x5b2ce3[_0x3d1e('0x23')],'utcOffset':_0x5b2ce3[_0x3d1e('0x91')]});});return _0x50848f[_0x3d1e('0x16')](0xc8)['json']({'tz':_0x4ba32f});};exports[_0x3d1e('0x92')]=function(_0x52ae74,_0xf8a8d6,_0x414315){var _0x4763b2=shared[_0x3d1e('0x8f')];var _0x3e1ef2={};if(!_['isNil'](_0x4763b2[_0x52ae74[_0x3d1e('0x58')]['id']]))_0x3e1ef2=_0x4763b2[_0x52ae74[_0x3d1e('0x58')]['id']];return _0xf8a8d6[_0x3d1e('0x16')](0xc8)[_0x3d1e('0x1c')](_0x3e1ef2);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 990ff56..881fa3f 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 _0x23b4=['api','bluebird','request-promise','path','rimraf','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23b4,0xfa));var _0x423b=function(_0x29a7c5,_0x177ec8){_0x29a7c5=_0x29a7c5-0x0;var _0x23093f=_0x23b4[_0x29a7c5];return _0x23093f;};'use strict';var _=require('lodash');var util=require(_0x423b('0x0'));var logger=require(_0x423b('0x1'))(_0x423b('0x2'));var moment=require('moment');var BPromise=require(_0x423b('0x3'));var rp=require(_0x423b('0x4'));var fs=require('fs');var path=require(_0x423b('0x5'));var rimraf=require(_0x423b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x423b('0x7')]=function(_0x12fcaa,_0x495ec7){return _0x12fcaa[_0x423b('0x8')](_0x423b('0x9'),attributes,{'tableName':_0x423b('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x423b('0xb')]},{'name':_0x423b('0xc'),'fields':[_0x423b('0xc')]},{'name':_0x423b('0xd'),'fields':[_0x423b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4360=['exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopper.attributes'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4360,0xba));var _0x0436=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4360[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0436('0x0'));var util=require(_0x0436('0x1'));var logger=require(_0x0436('0x2'))(_0x0436('0x3'));var moment=require(_0x0436('0x4'));var BPromise=require(_0x0436('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0436('0x6'));var rimraf=require('rimraf');var config=require(_0x0436('0x7'));var attributes=require(_0x0436('0x8'));module[_0x0436('0x9')]=function(_0x32fa3f,_0x3a640e){return _0x32fa3f[_0x0436('0xa')](_0x0436('0xb'),attributes,{'tableName':_0x0436('0xc'),'paranoid':![],'indexes':[{'name':_0x0436('0xd'),'fields':[_0x0436('0xd')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0x0436('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 66ba75d..b6a8b4f 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 _0xf442=['options','raw','where','attributes','limit','include','map','GetCmHopper','ShowCmHopper','find','model','catch','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','length','includes','UserId','push','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','literal','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','order','all','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','phone','findOne','dialTimezone','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopper','findAll'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xf442,0xd0));var _0x2f44=function(_0xa0ab36,_0x57c12e){_0xa0ab36=_0xa0ab36-0x0;var _0x2657db=_0xf442[_0xa0ab36];return _0x2657db;};'use strict';var _=require(_0x2f44('0x0'));var util=require(_0x2f44('0x1'));var moment=require(_0x2f44('0x2'));var BPromise=require(_0x2f44('0x3'));var rs=require(_0x2f44('0x4'));var fs=require('fs');var Redis=require(_0x2f44('0x5'));var db=require(_0x2f44('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f44('0x7'))(_0x2f44('0x8'));var config=require(_0x2f44('0x9'));var jayson=require(_0x2f44('0xa'));var client=jayson[_0x2f44('0xb')][_0x2f44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27015d,_0xe4df0b,_0x49ead8){return new BPromise(function(_0x16d64b,_0x4c42c3){return client[_0x2f44('0xd')](_0x27015d,_0x49ead8)[_0x2f44('0xe')](function(_0x1c7a1c){logger[_0x2f44('0xf')](_0x2f44('0x10'),_0xe4df0b,_0x2f44('0x11'));logger[_0x2f44('0x12')](_0x2f44('0x13'),_0xe4df0b,_0x2f44('0x11'),JSON[_0x2f44('0x14')](_0x1c7a1c));if(_0x1c7a1c[_0x2f44('0x15')]){if(_0x1c7a1c['error'][_0x2f44('0x16')]===0x1f4){logger[_0x2f44('0x15')](_0x2f44('0x10'),_0xe4df0b,_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);return _0x4c42c3(_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);}logger[_0x2f44('0x15')](_0x2f44('0x10'),_0xe4df0b,_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);return _0x16d64b(_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);}else{logger['info'](_0x2f44('0x10'),_0xe4df0b,'request\x20sent');_0x16d64b(_0x1c7a1c['result'][_0x2f44('0x17')]);}})['catch'](function(_0x42b421){logger[_0x2f44('0x15')]('CmHopper,\x20%s,\x20%s',_0xe4df0b,_0x42b421);_0x4c42c3(_0x42b421);});});}exports['GetCmHopper']=function(_0xa9d2f){var _0x2ae927=this;return new Promise(function(_0x4a28da,_0x19d512){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'raw':_0xa9d2f['options']?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1b')]===undefined?!![]:![]:!![],'where':_0xa9d2f['options']?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0xa9d2f[_0x2f44('0x1a')]?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'limit':_0xa9d2f[_0x2f44('0x1a')]?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null,'include':_0xa9d2f[_0x2f44('0x1a')]?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0xa9d2f[_0x2f44('0x1a')]['include'],function(_0x166301){return{'model':db[_0x166301['model']],'as':_0x166301['as'],'attributes':_0x166301[_0x2f44('0x1d')],'include':_0x166301['include']?_['map'](_0x166301[_0x2f44('0x1f')],function(_0xeb1215){return{'model':db[_0xeb1215['model']],'as':_0xeb1215['as'],'attributes':_0xeb1215['attributes'],'include':_0xeb1215[_0x2f44('0x1f')]?_['map'](_0xeb1215[_0x2f44('0x1f')],function(_0x394e0a){return{'model':db[_0x394e0a['model']],'as':_0x394e0a['as'],'attributes':_0x394e0a[_0x2f44('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1460d9){logger[_0x2f44('0xf')]('GetCmHopper',_0xa9d2f);logger[_0x2f44('0x12')](_0x2f44('0x21'),_0xa9d2f,JSON[_0x2f44('0x14')](_0x1460d9));_0x4a28da(_0x1460d9);})['catch'](function(_0x9eb63c){logger[_0x2f44('0x15')](_0x2f44('0x21'),_0x9eb63c['message'],_0xa9d2f);_0x19d512(_0x2ae927[_0x2f44('0x15')](0x1f4,_0x9eb63c[_0x2f44('0x17')]));});});};exports[_0x2f44('0x22')]=function(_0x12c311){var _0x14ea09=this;return new Promise(function(_0x40f7b3,_0x1e8b66){return db[_0x2f44('0x18')][_0x2f44('0x23')]({'raw':_0x12c311[_0x2f44('0x1a')]?_0x12c311[_0x2f44('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x12c311['options']?_0x12c311[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x12c311[_0x2f44('0x1a')]?_0x12c311[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'include':_0x12c311[_0x2f44('0x1a')]?_0x12c311[_0x2f44('0x1a')][_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x12c311['options'][_0x2f44('0x1f')],function(_0x373e2a){return{'model':db[_0x373e2a['model']],'as':_0x373e2a['as'],'attributes':_0x373e2a['attributes'],'include':_0x373e2a[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x373e2a[_0x2f44('0x1f')],function(_0x5778c9){return{'model':db[_0x5778c9[_0x2f44('0x24')]],'as':_0x5778c9['as'],'attributes':_0x5778c9['attributes'],'include':_0x5778c9[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x5778c9[_0x2f44('0x1f')],function(_0x9ff77e){return{'model':db[_0x9ff77e['model']],'as':_0x9ff77e['as'],'attributes':_0x9ff77e[_0x2f44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f44('0xe')](function(_0x1bf518){logger[_0x2f44('0xf')](_0x2f44('0x22'),_0x12c311);logger['debug'](_0x2f44('0x22'),_0x12c311,JSON['stringify'](_0x1bf518));_0x40f7b3(_0x1bf518);})[_0x2f44('0x25')](function(_0x2249f5){logger[_0x2f44('0x15')]('ShowCmHopper',_0x2249f5[_0x2f44('0x17')],_0x12c311);_0x1e8b66(_0x14ea09[_0x2f44('0x15')](0x1f4,_0x2249f5[_0x2f44('0x17')]));});});};exports['CreateCmHopper']=function(_0x4f486e){var _0x56477b=this;return new Promise(function(_0x182a11,_0x56eb4c){return db[_0x2f44('0x18')][_0x2f44('0x26')](_0x4f486e[_0x2f44('0x27')],{'raw':_0x4f486e['options']?_0x4f486e[_0x2f44('0x1a')][_0x2f44('0x1b')]===undefined?!![]:![]:!![]})[_0x2f44('0xe')](function(_0x35d9bb){logger[_0x2f44('0xf')](_0x2f44('0x28'),_0x4f486e);logger[_0x2f44('0x12')]('CreateCmHopper',_0x4f486e,JSON[_0x2f44('0x14')](_0x35d9bb));_0x182a11(_0x35d9bb);})[_0x2f44('0x25')](function(_0x4345a9){logger['error'](_0x2f44('0x28'),_0x4345a9[_0x2f44('0x17')],_0x4f486e);_0x56eb4c(_0x56477b[_0x2f44('0x15')](0x1f4,_0x4345a9[_0x2f44('0x17')]));});});};exports['UpdateCmHopper']=function(_0x567c58){var _0x9c4290=this;return new Promise(function(_0x52c8fc,_0x1b9922){return db[_0x2f44('0x18')][_0x2f44('0x29')](_0x567c58[_0x2f44('0x27')],{'raw':_0x567c58[_0x2f44('0x1a')]?_0x567c58[_0x2f44('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567c58[_0x2f44('0x1a')]?_0x567c58[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x567c58[_0x2f44('0x1a')]?_0x567c58['options'][_0x2f44('0x1d')]||null:null,'limit':_0x567c58[_0x2f44('0x1a')]?_0x567c58[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null})[_0x2f44('0xe')](function(_0x48f3e8){logger[_0x2f44('0xf')](_0x2f44('0x2a'),_0x567c58);logger[_0x2f44('0x12')](_0x2f44('0x2a'),_0x567c58,JSON[_0x2f44('0x14')](_0x48f3e8));_0x52c8fc(_0x48f3e8);})[_0x2f44('0x25')](function(_0x13a97f){logger[_0x2f44('0x15')](_0x2f44('0x2a'),_0x13a97f['message'],_0x567c58);_0x1b9922(_0x9c4290[_0x2f44('0x15')](0x1f4,_0x13a97f[_0x2f44('0x17')]));});});};exports[_0x2f44('0x2b')]=function(_0x10eb34){var _0x27a57c=this;return new Promise(function(_0x56ba74,_0x3db628){return db[_0x2f44('0x18')][_0x2f44('0x2c')]({'where':_0x10eb34[_0x2f44('0x1a')]?_0x10eb34[_0x2f44('0x1a')]['where']||null:null})[_0x2f44('0xe')](function(_0x4efed5){logger[_0x2f44('0xf')](_0x2f44('0x2b'),_0x10eb34);logger[_0x2f44('0x12')](_0x2f44('0x2b'),_0x10eb34,JSON[_0x2f44('0x14')](_0x4efed5));_0x56ba74(_0x4efed5);})['catch'](function(_0x51584b){logger[_0x2f44('0x15')](_0x2f44('0x2b'),_0x51584b[_0x2f44('0x17')],_0x10eb34);_0x3db628(_0x27a57c['error'](0x1f4,_0x51584b[_0x2f44('0x17')]));});});};exports[_0x2f44('0x2d')]=function(_0x211c80){var _0x51270a=this;return new Promise(function(_0x3d3c49,_0x4fe479){return db[_0x2f44('0x2e')][_0x2f44('0x2f')]()[_0x2f44('0xe')](function(_0xcde749){return db[_0x2f44('0x30')]['transaction'](function(_0x4d9cef){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'where':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'limit':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null,'order':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')]['order']||null:null,'transaction':_0x4d9cef,'lock':_0x4d9cef[_0x2f44('0x31')][_0x2f44('0x32')],'include':[{'model':db[_0x2f44('0x2e')],'as':_0x2f44('0x33'),'attributes':_[_0x2f44('0x34')](_0xcde749)},{'model':db['User'],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x2f44('0xe')](function(_0x381df4){var _0x23729c=[];var _0x442698=[];for(var _0x439656=0x0;_0x439656<_0x381df4[_0x2f44('0x35')];_0x439656+=0x1){if(!_0x442698[_0x2f44('0x36')](_0x381df4[_0x439656][_0x2f44('0x37')])){_0x442698[_0x2f44('0x38')](_0x381df4[_0x439656][_0x2f44('0x37')]);_0x23729c[_0x2f44('0x38')](_0x381df4[_0x439656][_0x2f44('0x29')](_0x211c80[_0x2f44('0x27')],{'transaction':_0x4d9cef}));}}return BPromise['all'](_0x23729c);});})[_0x2f44('0xe')](function(_0x18fa55){logger[_0x2f44('0xf')](_0x2f44('0x2d'),_0x211c80);logger[_0x2f44('0x12')](_0x2f44('0x2d'),_0x211c80,JSON[_0x2f44('0x14')](_0x18fa55));_0x3d3c49(_0x18fa55);})[_0x2f44('0x25')](function(_0x2ef9f7){logger[_0x2f44('0x15')]('GetContactDialer',_0x2ef9f7[_0x2f44('0x17')],_0x211c80);_0x4fe479(_0x51270a['error'](0x1f4,_0x2ef9f7[_0x2f44('0x17')]));});});});};exports[_0x2f44('0x39')]=function(_0x474240){var _0x593c1b=this;return new Promise(function(_0x4e50d5,_0x51e52e){return db[_0x2f44('0x30')][_0x2f44('0x3a')](function(_0x466e38){return db[_0x2f44('0x3b')][_0x2f44('0x26')](_0x474240[_0x2f44('0x27')],{'raw':_0x474240[_0x2f44('0x1a')]?_0x474240[_0x2f44('0x1a')]['raw']===undefined?!![]:![]:!![],'transaction':_0x466e38})[_0x2f44('0xe')](function(){return db[_0x2f44('0x18')][_0x2f44('0x2c')]({'where':_0x474240[_0x2f44('0x1a')]?_0x474240['options'][_0x2f44('0x1c')]||null:null,'transaction':_0x466e38});});})['then'](function(_0x9065dd){logger['info']('MoveContactManagedDialer',_0x474240);logger['debug']('MoveContactManagedDialer',_0x474240,JSON['stringify'](_0x9065dd));_0x4e50d5(_0x9065dd);})[_0x2f44('0x25')](function(_0x3a621b){logger[_0x2f44('0x15')]('MoveContactManagedDialer',_0x3a621b[_0x2f44('0x17')],_0x474240);_0x51e52e(_0x593c1b[_0x2f44('0x15')](0x1f4,_0x3a621b[_0x2f44('0x17')]));});});};exports[_0x2f44('0x3c')]=function(_0x1e41a6){var _0x3ac50f=this;return new Promise(function(_0x391dcc,_0x38e120){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'raw':_0x1e41a6['options']?_0x1e41a6[_0x2f44('0x1a')][_0x2f44('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e41a6[_0x2f44('0x1a')]?_0x1e41a6[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':[[db[_0x2f44('0x30')]['fn']('COUNT',db[_0x2f44('0x30')]['fn']('IF',db[_0x2f44('0x30')][_0x2f44('0x3d')]('`scheduledat`\x20>=\x20'+util[_0x2f44('0x3e')](_0x2f44('0x3f'),moment()[_0x2f44('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x2f44('0x40')]]})['then'](function(_0x412168){logger[_0x2f44('0xf')](_0x2f44('0x3c'),_0x1e41a6);logger[_0x2f44('0x12')]('CountReScheduled',_0x1e41a6,JSON['stringify'](_0x412168));_0x391dcc(_0x412168);})['catch'](function(_0x489de3){logger[_0x2f44('0x15')](_0x2f44('0x3c'),_0x489de3[_0x2f44('0x17')],_0x1e41a6);_0x38e120(_0x3ac50f[_0x2f44('0x15')](0x1f4,_0x489de3[_0x2f44('0x17')]));});});};exports[_0x2f44('0x41')]=function(_0x252bfb){var _0x290839=this;return new Promise(function(_0x220fb6,_0x417fcc){return db[_0x2f44('0x2e')][_0x2f44('0x2f')]()[_0x2f44('0xe')](function(_0x44d2a4){return db['sequelize'][_0x2f44('0x3a')](function(_0x5e213c){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'where':_0x252bfb['options']?_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x252bfb['options']?_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'limit':0x1,'order':_0x252bfb[_0x2f44('0x1a')]?_0x252bfb['options'][_0x2f44('0x42')]||null:null,'group':db[_0x2f44('0x18')][_0x2f44('0x37')],'transaction':_0x5e213c,'lock':_0x5e213c[_0x2f44('0x31')][_0x2f44('0x32')],'include':_0x252bfb['options']?_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1f')]?_['map'](_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1f')],function(_0x54673c){return{'model':db[_0x54673c[_0x2f44('0x24')]],'as':_0x54673c['as'],'attributes':_0x54673c[_0x2f44('0x1d')],'include':_0x54673c[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x54673c[_0x2f44('0x1f')],function(_0x350fc7){return{'model':db[_0x350fc7[_0x2f44('0x24')]],'as':_0x350fc7['as'],'attributes':_0x350fc7[_0x2f44('0x1d')],'include':_0x350fc7[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x350fc7[_0x2f44('0x1f')],function(_0x320b43){return{'model':db[_0x320b43[_0x2f44('0x24')]],'as':_0x320b43['as'],'attributes':_0x320b43[_0x2f44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f44('0xe')](function(_0xf0c4ca){var _0x1e9496=[];for(var _0x53c059=0x0;_0x53c059<_0xf0c4ca[_0x2f44('0x35')];_0x53c059+=0x1){_0x1e9496[_0x2f44('0x38')](_0xf0c4ca[_0x53c059][_0x2f44('0x29')](_0x252bfb[_0x2f44('0x27')],{'transaction':_0x5e213c}));}return BPromise[_0x2f44('0x43')](_0x1e9496);});})[_0x2f44('0xe')](function(_0x450f2a){logger[_0x2f44('0xf')]('GetContactRecallMe',_0x252bfb);logger[_0x2f44('0x12')]('GetContactRecallMe',_0x252bfb,JSON[_0x2f44('0x14')](_0x450f2a));_0x220fb6(_0x450f2a);})['catch'](function(_0x409860){logger[_0x2f44('0x15')]('GetContactRecallMe',_0x409860[_0x2f44('0x17')],_0x252bfb);_0x417fcc(_0x290839['error'](0x1f4,_0x409860['message']));});});});};exports[_0x2f44('0x44')]=function(_0x1c6f24){var _0x2a7a1e=this;return new Promise(function(_0xd883f7,_0x55ba84){db['CmContact'][_0x2f44('0x2f')]()['then'](function(_0x2b2b25){return db[_0x2f44('0x18')]['findAll']({'raw':_0x1c6f24['options']?_0x1c6f24['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c6f24[_0x2f44('0x1a')]?_0x1c6f24[_0x2f44('0x1a')]['where']||null:null,'attributes':_0x1c6f24['options']?_0x1c6f24['options']['attributes']||null:null,'limit':_0x1c6f24[_0x2f44('0x1a')]?_0x1c6f24[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null,'include':_0x1c6f24[_0x2f44('0x1a')]?_0x1c6f24[_0x2f44('0x1a')][_0x2f44('0x1f')]?_['map'](_0x1c6f24[_0x2f44('0x1a')][_0x2f44('0x1f')],function(_0x19cb69){return{'model':db[_0x19cb69[_0x2f44('0x24')]],'as':_0x19cb69['as'],'attributes':_0x19cb69['as']===_0x2f44('0x33')?_[_0x2f44('0x34')](_0x2b2b25):_0x19cb69[_0x2f44('0x1d')],'include':_0x19cb69[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x19cb69[_0x2f44('0x1f')],function(_0x31b7b9){return{'model':db[_0x31b7b9[_0x2f44('0x24')]],'as':_0x31b7b9['as'],'attributes':_0x31b7b9[_0x2f44('0x1d')],'include':_0x31b7b9[_0x2f44('0x1f')]?_['map'](_0x31b7b9[_0x2f44('0x1f')],function(_0x26c267){return{'model':db[_0x26c267[_0x2f44('0x24')]],'as':_0x26c267['as'],'attributes':_0x26c267['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f44('0xe')](function(_0x1f9dd2){logger[_0x2f44('0xf')](_0x2f44('0x21'),_0x1c6f24);logger[_0x2f44('0x12')](_0x2f44('0x21'),_0x1c6f24,JSON['stringify'](_0x1f9dd2));_0xd883f7(_0x1f9dd2);})[_0x2f44('0x25')](function(_0x2687dc){logger['error'](_0x2f44('0x21'),_0x2687dc['message'],_0x1c6f24);_0x55ba84(_0x2a7a1e['error'](0x1f4,_0x2687dc['message']));});});});};exports[_0x2f44('0x45')]=function(_0x92dc7c){console[_0x2f44('0x46')](_0x2f44('0x47'),_0x92dc7c);console['log'](_0x2f44('0x48'),_0x92dc7c[_0x2f44('0x1a')][_0x2f44('0x1c')][_0x2f44('0x49')]);_this=this;return new Promise(function(_0x315874,_0x12529e){return db[_0x2f44('0x2e')][_0x2f44('0x4a')]({'raw':!![],'where':{'phone':_0x92dc7c[_0x2f44('0x1a')][_0x2f44('0x1c')][_0x2f44('0x49')]},'attributes':['id',_0x2f44('0x4b')],'order':[['id','DESC']]})['then'](function(_0x321561){console[_0x2f44('0x46')](_0x2f44('0x4c'),_0x321561);logger[_0x2f44('0xf')](_0x2f44('0x4d'),_0x92dc7c);logger[_0x2f44('0x12')](_0x2f44('0x4d'),_0x92dc7c,JSON[_0x2f44('0x14')](_0x321561));_0x315874(_0x321561);})[_0x2f44('0x25')](function(_0x39aced){logger[_0x2f44('0x15')](_0x2f44('0x4d'),_0x39aced[_0x2f44('0x17')],_0x92dc7c);_0x12529e(_this['error'](0x1f4,_0x39aced[_0x2f44('0x17')]));});});}; \ No newline at end of file +var _0xce59=['GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','Agent','includes','UserId','push','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','UPDATE','length','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','log','req\x20value','phone\x20value','phone','dialTimezone','DESC','getContactByPhone','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','CmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','where','DestroyCmHopper'];(function(_0x4a7abd,_0x3cbb8f){var _0x20cdd3=function(_0x53224e){while(--_0x53224e){_0x4a7abd['push'](_0x4a7abd['shift']());}};_0x20cdd3(++_0x3cbb8f);}(_0xce59,0x195));var _0x9ce5=function(_0x483670,_0x3b6fed){_0x483670=_0x483670-0x0;var _0x3a7dc2=_0xce59[_0x483670];return _0x3a7dc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9ce5('0x0'));var rs=require(_0x9ce5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ce5('0x2'))['db'];var utils=require(_0x9ce5('0x3'));var logger=require(_0x9ce5('0x4'))(_0x9ce5('0x5'));var config=require(_0x9ce5('0x6'));var jayson=require(_0x9ce5('0x7'));var client=jayson['client'][_0x9ce5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dd67c,_0x2b1e70,_0x493703){return new BPromise(function(_0xec384f,_0x34252d){return client[_0x9ce5('0x9')](_0x2dd67c,_0x493703)[_0x9ce5('0xa')](function(_0x2ab6fc){logger[_0x9ce5('0xb')](_0x9ce5('0xc'),_0x2b1e70,'request\x20sent');logger[_0x9ce5('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2b1e70,_0x9ce5('0xe'),JSON[_0x9ce5('0xf')](_0x2ab6fc));if(_0x2ab6fc['error']){if(_0x2ab6fc[_0x9ce5('0x10')][_0x9ce5('0x11')]===0x1f4){logger['error'](_0x9ce5('0xc'),_0x2b1e70,_0x2ab6fc[_0x9ce5('0x10')][_0x9ce5('0x12')]);return _0x34252d(_0x2ab6fc[_0x9ce5('0x10')]['message']);}logger[_0x9ce5('0x10')]('CmHopper,\x20%s,\x20%s',_0x2b1e70,_0x2ab6fc[_0x9ce5('0x10')]['message']);return _0xec384f(_0x2ab6fc[_0x9ce5('0x10')]['message']);}else{logger[_0x9ce5('0xb')](_0x9ce5('0xc'),_0x2b1e70,_0x9ce5('0xe'));_0xec384f(_0x2ab6fc[_0x9ce5('0x13')][_0x9ce5('0x12')]);}})[_0x9ce5('0x14')](function(_0x3d06af){logger[_0x9ce5('0x10')](_0x9ce5('0xc'),_0x2b1e70,_0x3d06af);_0x34252d(_0x3d06af);});});}exports['GetCmHopper']=function(_0x4c37c7){var _0x58554f=this;return new Promise(function(_0x1410ea,_0x1ac26d){return db['CmHopper'][_0x9ce5('0x15')]({'raw':_0x4c37c7[_0x9ce5('0x16')]?_0x4c37c7['options'][_0x9ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x4c37c7['options']?_0x4c37c7[_0x9ce5('0x16')]['where']||null:null,'attributes':_0x4c37c7[_0x9ce5('0x16')]?_0x4c37c7[_0x9ce5('0x16')][_0x9ce5('0x18')]||null:null,'limit':_0x4c37c7[_0x9ce5('0x16')]?_0x4c37c7[_0x9ce5('0x16')][_0x9ce5('0x19')]||null:null,'include':_0x4c37c7[_0x9ce5('0x16')]?_0x4c37c7[_0x9ce5('0x16')]['include']?_['map'](_0x4c37c7[_0x9ce5('0x16')][_0x9ce5('0x1a')],function(_0xc5b00c){return{'model':db[_0xc5b00c['model']],'as':_0xc5b00c['as'],'attributes':_0xc5b00c[_0x9ce5('0x18')],'include':_0xc5b00c[_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0xc5b00c[_0x9ce5('0x1a')],function(_0x211455){return{'model':db[_0x211455[_0x9ce5('0x1c')]],'as':_0x211455['as'],'attributes':_0x211455[_0x9ce5('0x18')],'include':_0x211455[_0x9ce5('0x1a')]?_['map'](_0x211455[_0x9ce5('0x1a')],function(_0x3ef520){return{'model':db[_0x3ef520[_0x9ce5('0x1c')]],'as':_0x3ef520['as'],'attributes':_0x3ef520['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27ba0b){logger[_0x9ce5('0xb')](_0x9ce5('0x1d'),_0x4c37c7);logger['debug']('GetCmHopper',_0x4c37c7,JSON['stringify'](_0x27ba0b));_0x1410ea(_0x27ba0b);})[_0x9ce5('0x14')](function(_0x128ac2){logger[_0x9ce5('0x10')](_0x9ce5('0x1d'),_0x128ac2[_0x9ce5('0x12')],_0x4c37c7);_0x1ac26d(_0x58554f[_0x9ce5('0x10')](0x1f4,_0x128ac2['message']));});});};exports[_0x9ce5('0x1e')]=function(_0x3b409d){var _0x1e5290=this;return new Promise(function(_0x134642,_0x36ebdd){return db[_0x9ce5('0x1f')]['find']({'raw':_0x3b409d[_0x9ce5('0x16')]?_0x3b409d[_0x9ce5('0x16')][_0x9ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x3b409d[_0x9ce5('0x16')]?_0x3b409d['options']['where']||null:null,'attributes':_0x3b409d[_0x9ce5('0x16')]?_0x3b409d[_0x9ce5('0x16')][_0x9ce5('0x18')]||null:null,'include':_0x3b409d['options']?_0x3b409d[_0x9ce5('0x16')]['include']?_[_0x9ce5('0x1b')](_0x3b409d[_0x9ce5('0x16')]['include'],function(_0x29fbfe){return{'model':db[_0x29fbfe[_0x9ce5('0x1c')]],'as':_0x29fbfe['as'],'attributes':_0x29fbfe[_0x9ce5('0x18')],'include':_0x29fbfe[_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0x29fbfe[_0x9ce5('0x1a')],function(_0x58d9d1){return{'model':db[_0x58d9d1[_0x9ce5('0x1c')]],'as':_0x58d9d1['as'],'attributes':_0x58d9d1[_0x9ce5('0x18')],'include':_0x58d9d1[_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0x58d9d1[_0x9ce5('0x1a')],function(_0x2e0795){return{'model':db[_0x2e0795[_0x9ce5('0x1c')]],'as':_0x2e0795['as'],'attributes':_0x2e0795[_0x9ce5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9ce5('0xa')](function(_0x4808eb){logger['info'](_0x9ce5('0x1e'),_0x3b409d);logger[_0x9ce5('0xd')]('ShowCmHopper',_0x3b409d,JSON[_0x9ce5('0xf')](_0x4808eb));_0x134642(_0x4808eb);})[_0x9ce5('0x14')](function(_0x47bf8f){logger['error'](_0x9ce5('0x1e'),_0x47bf8f[_0x9ce5('0x12')],_0x3b409d);_0x36ebdd(_0x1e5290[_0x9ce5('0x10')](0x1f4,_0x47bf8f[_0x9ce5('0x12')]));});});};exports[_0x9ce5('0x20')]=function(_0x26e3aa){var _0x838dd8=this;return new Promise(function(_0x5f078e,_0x3af812){return db[_0x9ce5('0x1f')][_0x9ce5('0x21')](_0x26e3aa['body'],{'raw':_0x26e3aa[_0x9ce5('0x16')]?_0x26e3aa[_0x9ce5('0x16')][_0x9ce5('0x17')]===undefined?!![]:![]:!![]})[_0x9ce5('0xa')](function(_0x2ba2e7){logger[_0x9ce5('0xb')](_0x9ce5('0x20'),_0x26e3aa);logger['debug'](_0x9ce5('0x20'),_0x26e3aa,JSON['stringify'](_0x2ba2e7));_0x5f078e(_0x2ba2e7);})['catch'](function(_0x1daa54){logger[_0x9ce5('0x10')](_0x9ce5('0x20'),_0x1daa54['message'],_0x26e3aa);_0x3af812(_0x838dd8[_0x9ce5('0x10')](0x1f4,_0x1daa54[_0x9ce5('0x12')]));});});};exports[_0x9ce5('0x22')]=function(_0x46980f){var _0x1ef4c1=this;return new Promise(function(_0x3408ef,_0x480d9a){return db[_0x9ce5('0x1f')][_0x9ce5('0x23')](_0x46980f[_0x9ce5('0x24')],{'raw':_0x46980f[_0x9ce5('0x16')]?_0x46980f[_0x9ce5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46980f[_0x9ce5('0x16')]?_0x46980f[_0x9ce5('0x16')][_0x9ce5('0x25')]||null:null,'attributes':_0x46980f[_0x9ce5('0x16')]?_0x46980f[_0x9ce5('0x16')][_0x9ce5('0x18')]||null:null,'limit':_0x46980f[_0x9ce5('0x16')]?_0x46980f[_0x9ce5('0x16')]['limit']||null:null})[_0x9ce5('0xa')](function(_0x444c3b){logger[_0x9ce5('0xb')](_0x9ce5('0x22'),_0x46980f);logger[_0x9ce5('0xd')]('UpdateCmHopper',_0x46980f,JSON[_0x9ce5('0xf')](_0x444c3b));_0x3408ef(_0x444c3b);})[_0x9ce5('0x14')](function(_0x45dc0a){logger[_0x9ce5('0x10')]('UpdateCmHopper',_0x45dc0a['message'],_0x46980f);_0x480d9a(_0x1ef4c1[_0x9ce5('0x10')](0x1f4,_0x45dc0a[_0x9ce5('0x12')]));});});};exports['DestroyCmHopper']=function(_0x4fb4e5){var _0x4170f9=this;return new Promise(function(_0x6d1120,_0x48244e){return db[_0x9ce5('0x1f')]['destroy']({'where':_0x4fb4e5['options']?_0x4fb4e5[_0x9ce5('0x16')][_0x9ce5('0x25')]||null:null})[_0x9ce5('0xa')](function(_0x2f6cde){logger[_0x9ce5('0xb')](_0x9ce5('0x26'),_0x4fb4e5);logger[_0x9ce5('0xd')](_0x9ce5('0x26'),_0x4fb4e5,JSON[_0x9ce5('0xf')](_0x2f6cde));_0x6d1120(_0x2f6cde);})['catch'](function(_0x3a6377){logger['error'](_0x9ce5('0x26'),_0x3a6377[_0x9ce5('0x12')],_0x4fb4e5);_0x48244e(_0x4170f9['error'](0x1f4,_0x3a6377['message']));});});};exports[_0x9ce5('0x27')]=function(_0xc3f154){var _0x5569a8=this;return new Promise(function(_0xf78f9b,_0x302dff){return db[_0x9ce5('0x28')][_0x9ce5('0x29')]()[_0x9ce5('0xa')](function(_0x3dfb76){return db[_0x9ce5('0x2a')][_0x9ce5('0x2b')](function(_0x2e83a1){return db[_0x9ce5('0x1f')][_0x9ce5('0x15')]({'where':_0xc3f154['options']?_0xc3f154['options'][_0x9ce5('0x25')]||null:null,'attributes':_0xc3f154['options']?_0xc3f154[_0x9ce5('0x16')][_0x9ce5('0x18')]||null:null,'limit':_0xc3f154[_0x9ce5('0x16')]?_0xc3f154[_0x9ce5('0x16')]['limit']||null:null,'order':_0xc3f154['options']?_0xc3f154[_0x9ce5('0x16')][_0x9ce5('0x2c')]||null:null,'transaction':_0x2e83a1,'lock':_0x2e83a1[_0x9ce5('0x2d')]['UPDATE'],'include':[{'model':db[_0x9ce5('0x28')],'as':'Contact','attributes':_[_0x9ce5('0x2e')](_0x3dfb76)},{'model':db['User'],'as':_0x9ce5('0x2f'),'attributes':['id','name','voicePause']}]})[_0x9ce5('0xa')](function(_0x37d52e){var _0x562e86=[];var _0x1bbdb2=[];for(var _0x34604b=0x0;_0x34604b<_0x37d52e['length'];_0x34604b+=0x1){if(!_0x1bbdb2[_0x9ce5('0x30')](_0x37d52e[_0x34604b][_0x9ce5('0x31')])){_0x1bbdb2[_0x9ce5('0x32')](_0x37d52e[_0x34604b][_0x9ce5('0x31')]);_0x562e86[_0x9ce5('0x32')](_0x37d52e[_0x34604b]['update'](_0xc3f154[_0x9ce5('0x24')],{'transaction':_0x2e83a1}));}}return BPromise[_0x9ce5('0x33')](_0x562e86);});})[_0x9ce5('0xa')](function(_0x231bda){logger[_0x9ce5('0xb')](_0x9ce5('0x27'),_0xc3f154);logger[_0x9ce5('0xd')](_0x9ce5('0x27'),_0xc3f154,JSON[_0x9ce5('0xf')](_0x231bda));_0xf78f9b(_0x231bda);})[_0x9ce5('0x14')](function(_0x13c512){logger[_0x9ce5('0x10')](_0x9ce5('0x27'),_0x13c512[_0x9ce5('0x12')],_0xc3f154);_0x302dff(_0x5569a8['error'](0x1f4,_0x13c512[_0x9ce5('0x12')]));});});});};exports[_0x9ce5('0x34')]=function(_0x1a1112){var _0xd92b11=this;return new Promise(function(_0x4face9,_0x55eefd){return db[_0x9ce5('0x2a')][_0x9ce5('0x2b')](function(_0x31aeec){return db['CmHopperFinal'][_0x9ce5('0x21')](_0x1a1112[_0x9ce5('0x24')],{'raw':_0x1a1112[_0x9ce5('0x16')]?_0x1a1112['options'][_0x9ce5('0x17')]===undefined?!![]:![]:!![],'transaction':_0x31aeec})[_0x9ce5('0xa')](function(){return db[_0x9ce5('0x1f')]['destroy']({'where':_0x1a1112[_0x9ce5('0x16')]?_0x1a1112[_0x9ce5('0x16')]['where']||null:null,'transaction':_0x31aeec});});})[_0x9ce5('0xa')](function(_0x3cc89e){logger[_0x9ce5('0xb')](_0x9ce5('0x34'),_0x1a1112);logger['debug']('MoveContactManagedDialer',_0x1a1112,JSON[_0x9ce5('0xf')](_0x3cc89e));_0x4face9(_0x3cc89e);})['catch'](function(_0x15ae20){logger[_0x9ce5('0x10')](_0x9ce5('0x34'),_0x15ae20[_0x9ce5('0x12')],_0x1a1112);_0x55eefd(_0xd92b11['error'](0x1f4,_0x15ae20[_0x9ce5('0x12')]));});});};exports[_0x9ce5('0x35')]=function(_0x27ccf0){var _0x4f2c0d=this;return new Promise(function(_0x485855,_0x5b11c7){return db['CmHopper'][_0x9ce5('0x15')]({'raw':_0x27ccf0['options']?_0x27ccf0[_0x9ce5('0x16')][_0x9ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x27ccf0[_0x9ce5('0x16')]?_0x27ccf0[_0x9ce5('0x16')][_0x9ce5('0x25')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9ce5('0x36'),db[_0x9ce5('0x2a')]['fn']('IF',db[_0x9ce5('0x2a')][_0x9ce5('0x37')](_0x9ce5('0x38')+util[_0x9ce5('0x39')](_0x9ce5('0x3a'),moment()[_0x9ce5('0x39')](_0x9ce5('0x3b')))+_0x9ce5('0x3c')))),'contactsRescheduled']]})[_0x9ce5('0xa')](function(_0x493aae){logger[_0x9ce5('0xb')](_0x9ce5('0x35'),_0x27ccf0);logger[_0x9ce5('0xd')](_0x9ce5('0x35'),_0x27ccf0,JSON['stringify'](_0x493aae));_0x485855(_0x493aae);})['catch'](function(_0x33baf8){logger[_0x9ce5('0x10')](_0x9ce5('0x35'),_0x33baf8[_0x9ce5('0x12')],_0x27ccf0);_0x5b11c7(_0x4f2c0d[_0x9ce5('0x10')](0x1f4,_0x33baf8['message']));});});};exports['GetContactRecallMe']=function(_0x525cb9){var _0xa238d7=this;return new Promise(function(_0x56297a,_0x2e04d3){return db['CmContact'][_0x9ce5('0x29')]()[_0x9ce5('0xa')](function(_0x1e04c5){return db[_0x9ce5('0x2a')][_0x9ce5('0x2b')](function(_0x210ecd){return db[_0x9ce5('0x1f')][_0x9ce5('0x15')]({'where':_0x525cb9['options']?_0x525cb9[_0x9ce5('0x16')][_0x9ce5('0x25')]||null:null,'attributes':_0x525cb9[_0x9ce5('0x16')]?_0x525cb9['options'][_0x9ce5('0x18')]||null:null,'limit':0x1,'order':_0x525cb9[_0x9ce5('0x16')]?_0x525cb9[_0x9ce5('0x16')][_0x9ce5('0x2c')]||null:null,'group':db[_0x9ce5('0x1f')]['UserId'],'transaction':_0x210ecd,'lock':_0x210ecd[_0x9ce5('0x2d')][_0x9ce5('0x3d')],'include':_0x525cb9[_0x9ce5('0x16')]?_0x525cb9[_0x9ce5('0x16')][_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0x525cb9[_0x9ce5('0x16')][_0x9ce5('0x1a')],function(_0x2ad971){return{'model':db[_0x2ad971[_0x9ce5('0x1c')]],'as':_0x2ad971['as'],'attributes':_0x2ad971[_0x9ce5('0x18')],'include':_0x2ad971['include']?_[_0x9ce5('0x1b')](_0x2ad971[_0x9ce5('0x1a')],function(_0x54e2d9){return{'model':db[_0x54e2d9[_0x9ce5('0x1c')]],'as':_0x54e2d9['as'],'attributes':_0x54e2d9[_0x9ce5('0x18')],'include':_0x54e2d9[_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0x54e2d9[_0x9ce5('0x1a')],function(_0x20eaf7){return{'model':db[_0x20eaf7[_0x9ce5('0x1c')]],'as':_0x20eaf7['as'],'attributes':_0x20eaf7['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ce5('0xa')](function(_0x367eb5){var _0x45e1fc=[];for(var _0x1f6d17=0x0;_0x1f6d17<_0x367eb5[_0x9ce5('0x3e')];_0x1f6d17+=0x1){_0x45e1fc['push'](_0x367eb5[_0x1f6d17][_0x9ce5('0x23')](_0x525cb9[_0x9ce5('0x24')],{'transaction':_0x210ecd}));}return BPromise['all'](_0x45e1fc);});})[_0x9ce5('0xa')](function(_0x5aec5b){logger[_0x9ce5('0xb')]('GetContactRecallMe',_0x525cb9);logger[_0x9ce5('0xd')](_0x9ce5('0x3f'),_0x525cb9,JSON[_0x9ce5('0xf')](_0x5aec5b));_0x56297a(_0x5aec5b);})[_0x9ce5('0x14')](function(_0x33062c){logger[_0x9ce5('0x10')](_0x9ce5('0x3f'),_0x33062c[_0x9ce5('0x12')],_0x525cb9);_0x2e04d3(_0xa238d7[_0x9ce5('0x10')](0x1f4,_0x33062c[_0x9ce5('0x12')]));});});});};exports[_0x9ce5('0x40')]=function(_0x2b42c6){var _0x59c7eb=this;return new Promise(function(_0x3a9c76,_0xd6e16e){db[_0x9ce5('0x28')][_0x9ce5('0x29')]()[_0x9ce5('0xa')](function(_0x54f3cf){return db[_0x9ce5('0x1f')][_0x9ce5('0x15')]({'raw':_0x2b42c6[_0x9ce5('0x16')]?_0x2b42c6[_0x9ce5('0x16')][_0x9ce5('0x17')]===undefined?!![]:![]:!![],'where':_0x2b42c6[_0x9ce5('0x16')]?_0x2b42c6['options']['where']||null:null,'attributes':_0x2b42c6['options']?_0x2b42c6[_0x9ce5('0x16')][_0x9ce5('0x18')]||null:null,'limit':_0x2b42c6[_0x9ce5('0x16')]?_0x2b42c6[_0x9ce5('0x16')][_0x9ce5('0x19')]||null:null,'include':_0x2b42c6['options']?_0x2b42c6[_0x9ce5('0x16')][_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0x2b42c6['options'][_0x9ce5('0x1a')],function(_0xaf0092){return{'model':db[_0xaf0092[_0x9ce5('0x1c')]],'as':_0xaf0092['as'],'attributes':_0xaf0092['as']===_0x9ce5('0x41')?_[_0x9ce5('0x2e')](_0x54f3cf):_0xaf0092['attributes'],'include':_0xaf0092[_0x9ce5('0x1a')]?_[_0x9ce5('0x1b')](_0xaf0092[_0x9ce5('0x1a')],function(_0x49f070){return{'model':db[_0x49f070['model']],'as':_0x49f070['as'],'attributes':_0x49f070[_0x9ce5('0x18')],'include':_0x49f070['include']?_[_0x9ce5('0x1b')](_0x49f070[_0x9ce5('0x1a')],function(_0x2051ff){return{'model':db[_0x2051ff[_0x9ce5('0x1c')]],'as':_0x2051ff['as'],'attributes':_0x2051ff[_0x9ce5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d1cca){logger['info']('GetCmHopper',_0x2b42c6);logger[_0x9ce5('0xd')](_0x9ce5('0x1d'),_0x2b42c6,JSON['stringify'](_0x1d1cca));_0x3a9c76(_0x1d1cca);})[_0x9ce5('0x14')](function(_0x12632a){logger['error']('GetCmHopper',_0x12632a[_0x9ce5('0x12')],_0x2b42c6);_0xd6e16e(_0x59c7eb[_0x9ce5('0x10')](0x1f4,_0x12632a['message']));});});});};exports[_0x9ce5('0x42')]=function(_0x470d60){console[_0x9ce5('0x43')](_0x9ce5('0x44'),_0x470d60);console[_0x9ce5('0x43')](_0x9ce5('0x45'),_0x470d60[_0x9ce5('0x16')][_0x9ce5('0x25')][_0x9ce5('0x46')]);_this=this;return new Promise(function(_0x57224b,_0x2615ee){return db[_0x9ce5('0x28')]['findOne']({'raw':!![],'where':{'phone':_0x470d60[_0x9ce5('0x16')][_0x9ce5('0x25')][_0x9ce5('0x46')]},'attributes':['id',_0x9ce5('0x47')],'order':[['id',_0x9ce5('0x48')]]})[_0x9ce5('0xa')](function(_0x18eb43){console['log']('getcontactbyohone',_0x18eb43);logger[_0x9ce5('0xb')]('getContactByPhone',_0x470d60);logger[_0x9ce5('0xd')](_0x9ce5('0x49'),_0x470d60,JSON[_0x9ce5('0xf')](_0x18eb43));_0x57224b(_0x18eb43);})['catch'](function(_0x329dab){logger[_0x9ce5('0x10')](_0x9ce5('0x49'),_0x329dab['message'],_0x470d60);_0x2615ee(_this['error'](0x1f4,_0x329dab['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0447818..6f747af 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 _0x81bd=['../../components/auth/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','getOpenContacts','/timezones','getTimezones','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x26c0a1,_0x300910){var _0x121382=function(_0x57cd56){while(--_0x57cd56){_0x26c0a1['push'](_0x26c0a1['shift']());}};_0x121382(++_0x300910);}(_0x81bd,0x7c));var _0xd81b=function(_0x2b5c60,_0xddad37){_0x2b5c60=_0x2b5c60-0x0;var _0x40ef50=_0x81bd[_0x2b5c60];return _0x40ef50;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd81b('0x9')]('/opencontacts',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0x9')](_0xd81b('0xe'),auth[_0xd81b('0xc')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x9')](_0xd81b('0x10'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')]('/',auth[_0xd81b('0xc')](),controller[_0xd81b('0x13')]);router['post'](_0xd81b('0x14'),auth['isAuthenticated'](),controller[_0xd81b('0x15')]);router[_0xd81b('0x12')]('/timezone',auth[_0xd81b('0xc')](),controller['getTimezone']);router[_0xd81b('0x16')](_0xd81b('0x10'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x17')]);router[_0xd81b('0x18')]('/:id',auth[_0xd81b('0xc')](),controller[_0xd81b('0x19')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['getTimezone','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','getTimezones','/:id','show','post','create','getPreview'];(function(_0x4c22f2,_0x5d6447){var _0x1915cd=function(_0x4d5cf2){while(--_0x4d5cf2){_0x4c22f2['push'](_0x4c22f2['shift']());}};_0x1915cd(++_0x5d6447);}(_0x55ca,0x126));var _0xa55c=function(_0x2c43f8,_0x261d10){_0x2c43f8=_0x2c43f8-0x0;var _0x3c0c0f=_0x55ca[_0x2c43f8];return _0x3c0c0f;};'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')]('/opencontacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/timezones',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0x6')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xf')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0xf')]('/preview',auth['isAuthenticated'](),controller[_0xa55c('0x11')]);router['post']('/timezone',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router[_0xa55c('0x13')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0x16')]);module[_0xa55c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ae820cc..a6cd487 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 _0x19ea=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x1bc1ad,_0x244f95){var _0x3fa4d3=function(_0x2a5cec){while(--_0x2a5cec){_0x1bc1ad['push'](_0x1bc1ad['shift']());}};_0x3fa4d3(++_0x244f95);}(_0x19ea,0x1db));var _0xa19e=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x19ea[_0x1e6e4e];return _0x3d746b;};'use strict';var moment=require(_0xa19e('0x0'));var Sequelize=require(_0xa19e('0x1'));module[_0xa19e('0x2')]={'CmHopperId':{'type':Sequelize[_0xa19e('0x3')]},'phone':{'type':Sequelize[_0xa19e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa19e('0x5')],'defaultValue':moment()['format'](_0xa19e('0x6'))},'countbusyretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x43e5=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x43e5,0x1b2));var _0x543e=function(_0x120dd2,_0xe21dfa){_0x120dd2=_0x120dd2-0x0;var _0x2fa4c4=_0x43e5[_0x120dd2];return _0x2fa4c4;};'use strict';var moment=require(_0x543e('0x0'));var Sequelize=require(_0x543e('0x1'));module[_0x543e('0x2')]={'CmHopperId':{'type':Sequelize[_0x543e('0x3')]},'phone':{'type':Sequelize[_0x543e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x543e('0x5')],'defaultValue':moment()[_0x543e('0x6')](_0x543e('0x7'))},'countbusyretry':{'type':Sequelize[_0x543e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x543e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x543e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x543e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x543e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x543e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 08ea076..d4c6466 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 _0x1126=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','json','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse'];(function(_0x5abc37,_0x45b4bf){var _0x151100=function(_0x2cb47a){while(--_0x2cb47a){_0x5abc37['push'](_0x5abc37['shift']());}};_0x151100(++_0x45b4bf);}(_0x1126,0xe0));var _0x6112=function(_0x44ca27,_0x81f0da){_0x44ca27=_0x44ca27-0x0;var _0x38bc17=_0x1126[_0x44ca27];return _0x38bc17;};'use strict';var pdf=require(_0x6112('0x0'));var emlformat=require(_0x6112('0x1'));var rimraf=require(_0x6112('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6112('0x3'));var rp=require(_0x6112('0x4'));var moment=require(_0x6112('0x5'));var BPromise=require(_0x6112('0x6'));var Mustache=require(_0x6112('0x7'));var util=require('util');var path=require('path');var sox=require(_0x6112('0x8'));var csv=require(_0x6112('0x9'));var ejs=require(_0x6112('0xa'));var fs=require('fs');var _=require(_0x6112('0xb'));var squel=require(_0x6112('0xc'));var crypto=require(_0x6112('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6112('0xe'));var toCsv=require(_0x6112('0x9'));var querystring=require('querystring');var Papa=require(_0x6112('0xf'));var Redis=require(_0x6112('0x10'));var authService=require(_0x6112('0x11'));var qs=require(_0x6112('0x12'));var as=require(_0x6112('0x13'));var hardwareService=require(_0x6112('0x14'));var logger=require(_0x6112('0x15'))('api');var utils=require(_0x6112('0x16'));var config=require(_0x6112('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38860d,_0x15b0e2){_0x15b0e2=_0x15b0e2||0xcc;return function(_0x52a0e9){if(_0x52a0e9){return _0x38860d[_0x6112('0x18')](_0x15b0e2);}return _0x38860d[_0x6112('0x19')](_0x15b0e2)[_0x6112('0x1a')]();};}function respondWithResult(_0x4bcf91,_0x1fb761){_0x1fb761=_0x1fb761||0xc8;return function(_0xcc4c59){if(_0xcc4c59){return _0x4bcf91['status'](_0x1fb761)['json'](_0xcc4c59);}};}function respondWithFilteredResult(_0x164cb6,_0x2683ce){return function(_0x2b82c3){if(_0x2b82c3){var _0x547304=_0x2b82c3[_0x6112('0x1b')],_0x52a297=_0x2683ce[_0x6112('0x1c')],_0x18ad54=_0x2683ce[_0x6112('0x1c')]+_0x2683ce['limit'],_0x3383c7;if(_0x18ad54>=_0x547304){_0x18ad54=_0x547304;_0x3383c7=0xc8;}else{_0x3383c7=0xce;}_0x164cb6[_0x6112('0x19')](_0x3383c7);return _0x164cb6[_0x6112('0x1d')]('Content-Range',_0x52a297+'-'+_0x18ad54+'/'+_0x547304)[_0x6112('0x1e')](_0x2b82c3);}return null;};}function patchUpdates(_0x3449d4){return function(_0x28ad90){try{jsonpatch['apply'](_0x28ad90,_0x3449d4,!![]);}catch(_0x146d72){return BPromise['reject'](_0x146d72);}return _0x28ad90[_0x6112('0x1f')]();};}function saveUpdates(_0x1db189,_0x172f34){return function(_0x47e6ba){if(_0x47e6ba){return _0x47e6ba[_0x6112('0x20')](_0x1db189)[_0x6112('0x21')](function(_0x2f0b50){return _0x2f0b50;});}return null;};}function removeEntity(_0x3479c6,_0x465762){return function(_0x199688){if(_0x199688){return _0x199688[_0x6112('0x22')]()[_0x6112('0x21')](function(){var _0x3346fc=_0x199688[_0x6112('0x23')]({'plain':!![]});var _0x31ed10=_0x6112('0x24');return db[_0x6112('0x25')][_0x6112('0x22')]({'where':{'type':_0x31ed10,'resourceId':_0x3346fc['id']}})[_0x6112('0x21')](function(){return _0x199688;});})[_0x6112('0x21')](function(){_0x3479c6[_0x6112('0x19')](0xcc)[_0x6112('0x1a')]();});}};}function handleEntityNotFound(_0x5b5741,_0x2e4f60){return function(_0x506b52){if(!_0x506b52){_0x5b5741[_0x6112('0x18')](0x194);}return _0x506b52;};}function handleError(_0x357115,_0x5098b6){_0x5098b6=_0x5098b6||0x1f4;return function(_0x1c4c14){logger[_0x6112('0x26')](_0x1c4c14[_0x6112('0x27')]);if(_0x1c4c14[_0x6112('0x28')]){delete _0x1c4c14['name'];}_0x357115[_0x6112('0x19')](_0x5098b6)['send'](_0x1c4c14);};}exports['index']=function(_0x4774f,_0x5e6b90){var _0x255002={},_0x21524d={},_0x3d7c0f={'count':0x0,'rows':[]};var _0xb51dd7=_['map'](db[_0x6112('0x29')][_0x6112('0x2a')],function(_0x3e5d32){return{'name':_0x3e5d32[_0x6112('0x2b')],'type':_0x3e5d32[_0x6112('0x2c')][_0x6112('0x2d')]};});_0x21524d[_0x6112('0x2e')]=_[_0x6112('0x2f')](_0xb51dd7,_0x6112('0x28'));_0x21524d[_0x6112('0x30')]=_[_0x6112('0x31')](_0x4774f['query']);_0x21524d['filters']=_[_0x6112('0x32')](_0x21524d[_0x6112('0x2e')],_0x21524d[_0x6112('0x30')]);_0x255002[_0x6112('0x33')]=_[_0x6112('0x32')](_0x21524d[_0x6112('0x2e')],qs[_0x6112('0x34')](_0x4774f['query']['fields']));_0x255002[_0x6112('0x33')]=_0x255002[_0x6112('0x33')][_0x6112('0x35')]?_0x255002['attributes']:_0x21524d[_0x6112('0x2e')];if(!_0x4774f[_0x6112('0x30')][_0x6112('0x36')]('nolimit')){_0x255002['limit']=qs[_0x6112('0x37')](_0x4774f[_0x6112('0x30')][_0x6112('0x37')]);_0x255002[_0x6112('0x1c')]=qs[_0x6112('0x1c')](_0x4774f[_0x6112('0x30')][_0x6112('0x1c')]);}_0x255002[_0x6112('0x38')]=qs['sort'](_0x4774f[_0x6112('0x30')][_0x6112('0x39')]);_0x255002[_0x6112('0x3a')]=qs[_0x6112('0x3b')](_[_0x6112('0x3c')](_0x4774f[_0x6112('0x30')],_0x21524d[_0x6112('0x3b')]),_0xb51dd7);if(_0x4774f[_0x6112('0x30')][_0x6112('0x3d')]){_0x255002[_0x6112('0x3a')]=_[_0x6112('0x3e')](_0x255002[_0x6112('0x3a')],{'$or':_[_0x6112('0x2f')](_0xb51dd7,function(_0xf0fa3c){if(_0xf0fa3c['type']!==_0x6112('0x3f')){var _0x4ba978={};_0x4ba978[_0xf0fa3c['name']]={'$like':'%'+_0x4774f[_0x6112('0x30')]['filter']+'%'};return _0x4ba978;}})});}_0x255002=_[_0x6112('0x3e')]({},_0x255002,_0x4774f[_0x6112('0x40')]);var _0x3781f2={'where':_0x255002[_0x6112('0x3a')]};return db[_0x6112('0x29')]['count'](_0x3781f2)[_0x6112('0x21')](function(_0x17a5d7){_0x3d7c0f[_0x6112('0x1b')]=_0x17a5d7;if(_0x4774f[_0x6112('0x30')][_0x6112('0x41')]){_0x255002[_0x6112('0x42')]=[{'all':!![]}];}return db[_0x6112('0x29')]['findAll'](_0x255002);})[_0x6112('0x21')](function(_0x3bbb52){_0x3d7c0f[_0x6112('0x43')]=_0x3bbb52;return _0x3d7c0f;})[_0x6112('0x21')](respondWithFilteredResult(_0x5e6b90,_0x255002))['catch'](handleError(_0x5e6b90,null));};exports[_0x6112('0x44')]=function(_0x1c0a7e,_0xcac6bb){var _0x1bbdb0={'raw':!![],'where':{'id':_0x1c0a7e['params']['id']}},_0x5e3abf={};_0x5e3abf['model']=_[_0x6112('0x31')](db[_0x6112('0x29')][_0x6112('0x2a')]);_0x5e3abf[_0x6112('0x30')]=_[_0x6112('0x31')](_0x1c0a7e[_0x6112('0x30')]);_0x5e3abf['filters']=_['intersection'](_0x5e3abf['model'],_0x5e3abf[_0x6112('0x30')]);_0x1bbdb0['attributes']=_['intersection'](_0x5e3abf[_0x6112('0x2e')],qs['fields'](_0x1c0a7e['query'][_0x6112('0x34')]));_0x1bbdb0[_0x6112('0x33')]=_0x1bbdb0[_0x6112('0x33')][_0x6112('0x35')]?_0x1bbdb0[_0x6112('0x33')]:_0x5e3abf[_0x6112('0x2e')];if(_0x1c0a7e[_0x6112('0x30')][_0x6112('0x41')]){_0x1bbdb0['include']=[{'all':!![]}];}_0x1bbdb0=_[_0x6112('0x3e')]({},_0x1bbdb0,_0x1c0a7e[_0x6112('0x40')]);return db[_0x6112('0x29')][_0x6112('0x45')](_0x1bbdb0)[_0x6112('0x21')](handleEntityNotFound(_0xcac6bb,null))[_0x6112('0x21')](respondWithResult(_0xcac6bb,null))[_0x6112('0x46')](handleError(_0xcac6bb,null));};exports[_0x6112('0x47')]=function(_0x5ef136,_0x1a8c1c){return db[_0x6112('0x29')][_0x6112('0x47')](_0x5ef136[_0x6112('0x48')],{})[_0x6112('0x21')](function(_0x57820d){var _0x22d9b9=_0x5ef136['user'][_0x6112('0x23')]({'plain':!![]});if(!_0x22d9b9)throw new Error(_0x6112('0x49'));if(_0x22d9b9['role']===_0x6112('0x4a')){var _0x41c61f=_0x57820d[_0x6112('0x23')]({'plain':!![]});var _0x3f42bc=_0x6112('0x24');return db[_0x6112('0x4b')][_0x6112('0x45')]({'where':{'name':_0x3f42bc,'userProfileId':_0x22d9b9[_0x6112('0x4c')]},'raw':!![]})[_0x6112('0x21')](function(_0x3ce4ab){if(_0x3ce4ab&&_0x3ce4ab[_0x6112('0x4d')]===0x0){return db[_0x6112('0x25')][_0x6112('0x47')]({'name':_0x41c61f[_0x6112('0x28')],'resourceId':_0x41c61f['id'],'type':_0x3ce4ab[_0x6112('0x28')],'sectionId':_0x3ce4ab['id']},{})[_0x6112('0x21')](function(){return _0x57820d;});}else{return _0x57820d;}})[_0x6112('0x46')](function(_0x2686f4){logger[_0x6112('0x26')](_0x6112('0x4e'),_0x2686f4);throw _0x2686f4;});}return _0x57820d;})['then'](respondWithResult(_0x1a8c1c,0xc9))['catch'](handleError(_0x1a8c1c,null));};exports['update']=function(_0x485038,_0x2a9ef7){if(_0x485038[_0x6112('0x48')]['id']){delete _0x485038[_0x6112('0x48')]['id'];}return db[_0x6112('0x29')][_0x6112('0x45')]({'where':{'id':_0x485038[_0x6112('0x4f')]['id']}})[_0x6112('0x21')](handleEntityNotFound(_0x2a9ef7,null))['then'](saveUpdates(_0x485038[_0x6112('0x48')],null))[_0x6112('0x21')](respondWithResult(_0x2a9ef7,null))[_0x6112('0x46')](handleError(_0x2a9ef7,null));};exports[_0x6112('0x22')]=function(_0x1a50ea,_0x5234b0){return db[_0x6112('0x29')][_0x6112('0x45')]({'where':{'id':_0x1a50ea['params']['id']}})[_0x6112('0x21')](handleEntityNotFound(_0x5234b0,null))['then'](removeEntity(_0x5234b0,null))[_0x6112('0x46')](handleError(_0x5234b0,null));}; \ No newline at end of file +var _0x9086=['mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','update','find','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x1585ad,_0x5ce3ab){var _0x10e1e4=function(_0x3470a5){while(--_0x3470a5){_0x1585ad['push'](_0x1585ad['shift']());}};_0x10e1e4(++_0x5ce3ab);}(_0x9086,0x147));var _0x6908=function(_0x26b034,_0x5a0893){_0x26b034=_0x26b034-0x0;var _0x3bdd88=_0x9086[_0x26b034];return _0x3bdd88;};'use strict';var pdf=require(_0x6908('0x0'));var emlformat=require(_0x6908('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6908('0x2'));var rp=require(_0x6908('0x3'));var moment=require(_0x6908('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6908('0x5'));var util=require(_0x6908('0x6'));var path=require('path');var sox=require(_0x6908('0x7'));var csv=require(_0x6908('0x8'));var ejs=require(_0x6908('0x9'));var fs=require('fs');var _=require(_0x6908('0xa'));var squel=require('squel');var crypto=require(_0x6908('0xb'));var jsforce=require(_0x6908('0xc'));var deskjs=require(_0x6908('0xd'));var toCsv=require(_0x6908('0x8'));var querystring=require('querystring');var Papa=require(_0x6908('0xe'));var Redis=require(_0x6908('0xf'));var authService=require(_0x6908('0x10'));var qs=require(_0x6908('0x11'));var as=require(_0x6908('0x12'));var hardwareService=require(_0x6908('0x13'));var logger=require(_0x6908('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6908('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd849ff,_0x3c36b1){_0x3c36b1=_0x3c36b1||0xcc;return function(_0x5c9d29){if(_0x5c9d29){return _0xd849ff[_0x6908('0x16')](_0x3c36b1);}return _0xd849ff[_0x6908('0x17')](_0x3c36b1)[_0x6908('0x18')]();};}function respondWithResult(_0x10be37,_0x46baa6){_0x46baa6=_0x46baa6||0xc8;return function(_0x35a06d){if(_0x35a06d){return _0x10be37[_0x6908('0x17')](_0x46baa6)[_0x6908('0x19')](_0x35a06d);}};}function respondWithFilteredResult(_0x169e9f,_0x363745){return function(_0x31258f){if(_0x31258f){var _0x162d37=_0x31258f[_0x6908('0x1a')],_0x3c828c=_0x363745[_0x6908('0x1b')],_0x14f1ba=_0x363745[_0x6908('0x1b')]+_0x363745['limit'],_0x365bec;if(_0x14f1ba>=_0x162d37){_0x14f1ba=_0x162d37;_0x365bec=0xc8;}else{_0x365bec=0xce;}_0x169e9f[_0x6908('0x17')](_0x365bec);return _0x169e9f[_0x6908('0x1c')](_0x6908('0x1d'),_0x3c828c+'-'+_0x14f1ba+'/'+_0x162d37)[_0x6908('0x19')](_0x31258f);}return null;};}function patchUpdates(_0x5143d9){return function(_0x6344f4){try{jsonpatch[_0x6908('0x1e')](_0x6344f4,_0x5143d9,!![]);}catch(_0x47eb7e){return BPromise[_0x6908('0x1f')](_0x47eb7e);}return _0x6344f4[_0x6908('0x20')]();};}function saveUpdates(_0x1b3446,_0x5c64c2){return function(_0x5f53f3){if(_0x5f53f3){return _0x5f53f3['update'](_0x1b3446)[_0x6908('0x21')](function(_0x357090){return _0x357090;});}return null;};}function removeEntity(_0x467076,_0x58d5fd){return function(_0x255d86){if(_0x255d86){return _0x255d86[_0x6908('0x22')]()[_0x6908('0x21')](function(){var _0xbd4f26=_0x255d86['get']({'plain':!![]});var _0x10a58f=_0x6908('0x23');return db[_0x6908('0x24')][_0x6908('0x22')]({'where':{'type':_0x10a58f,'resourceId':_0xbd4f26['id']}})['then'](function(){return _0x255d86;});})[_0x6908('0x21')](function(){_0x467076[_0x6908('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f957,_0x498324){return function(_0x52f9f4){if(!_0x52f9f4){_0x38f957['sendStatus'](0x194);}return _0x52f9f4;};}function handleError(_0x3bb847,_0x489c0b){_0x489c0b=_0x489c0b||0x1f4;return function(_0x6bcee3){logger[_0x6908('0x25')](_0x6bcee3[_0x6908('0x26')]);if(_0x6bcee3[_0x6908('0x27')]){delete _0x6bcee3['name'];}_0x3bb847['status'](_0x489c0b)[_0x6908('0x28')](_0x6bcee3);};}exports[_0x6908('0x29')]=function(_0x225206,_0x224251){var _0x1c3c95={},_0xc3c7d8={},_0x23de57={'count':0x0,'rows':[]};var _0x13df9e=_['map'](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x190874){return{'name':_0x190874[_0x6908('0x2a')],'type':_0x190874[_0x6908('0x2b')][_0x6908('0x2c')]};});_0xc3c7d8['model']=_[_0x6908('0x2d')](_0x13df9e,_0x6908('0x27'));_0xc3c7d8[_0x6908('0x2e')]=_[_0x6908('0x2f')](_0x225206['query']);_0xc3c7d8['filters']=_[_0x6908('0x30')](_0xc3c7d8[_0x6908('0x31')],_0xc3c7d8[_0x6908('0x2e')]);_0x1c3c95[_0x6908('0x32')]=_[_0x6908('0x30')](_0xc3c7d8[_0x6908('0x31')],qs[_0x6908('0x33')](_0x225206[_0x6908('0x2e')][_0x6908('0x33')]));_0x1c3c95[_0x6908('0x32')]=_0x1c3c95[_0x6908('0x32')][_0x6908('0x34')]?_0x1c3c95[_0x6908('0x32')]:_0xc3c7d8[_0x6908('0x31')];if(!_0x225206[_0x6908('0x2e')]['hasOwnProperty'](_0x6908('0x35'))){_0x1c3c95['limit']=qs[_0x6908('0x36')](_0x225206['query'][_0x6908('0x36')]);_0x1c3c95[_0x6908('0x1b')]=qs[_0x6908('0x1b')](_0x225206['query'][_0x6908('0x1b')]);}_0x1c3c95['order']=qs[_0x6908('0x37')](_0x225206[_0x6908('0x2e')]['sort']);_0x1c3c95[_0x6908('0x38')]=qs[_0x6908('0x39')](_[_0x6908('0x3a')](_0x225206[_0x6908('0x2e')],_0xc3c7d8['filters']),_0x13df9e);if(_0x225206[_0x6908('0x2e')][_0x6908('0x3b')]){_0x1c3c95[_0x6908('0x38')]=_['merge'](_0x1c3c95['where'],{'$or':_[_0x6908('0x2d')](_0x13df9e,function(_0x46a7b9){if(_0x46a7b9[_0x6908('0x2b')]!==_0x6908('0x3c')){var _0x32a26c={};_0x32a26c[_0x46a7b9[_0x6908('0x27')]]={'$like':'%'+_0x225206[_0x6908('0x2e')]['filter']+'%'};return _0x32a26c;}})});}_0x1c3c95=_[_0x6908('0x3d')]({},_0x1c3c95,_0x225206[_0x6908('0x3e')]);var _0x103b79={'where':_0x1c3c95[_0x6908('0x38')]};return db[_0x6908('0x3f')][_0x6908('0x1a')](_0x103b79)[_0x6908('0x21')](function(_0x9d82f0){_0x23de57['count']=_0x9d82f0;if(_0x225206['query'][_0x6908('0x40')]){_0x1c3c95[_0x6908('0x41')]=[{'all':!![]}];}return db[_0x6908('0x3f')][_0x6908('0x42')](_0x1c3c95);})[_0x6908('0x21')](function(_0x44d165){_0x23de57[_0x6908('0x43')]=_0x44d165;return _0x23de57;})[_0x6908('0x21')](respondWithFilteredResult(_0x224251,_0x1c3c95))[_0x6908('0x44')](handleError(_0x224251,null));};exports[_0x6908('0x45')]=function(_0x1fc9a3,_0x59aacb){var _0x1ae996={'raw':!![],'where':{'id':_0x1fc9a3[_0x6908('0x46')]['id']}},_0x51de9c={};_0x51de9c[_0x6908('0x31')]=_['keys'](db[_0x6908('0x3f')][_0x6908('0x47')]);_0x51de9c['query']=_[_0x6908('0x2f')](_0x1fc9a3[_0x6908('0x2e')]);_0x51de9c[_0x6908('0x39')]=_[_0x6908('0x30')](_0x51de9c[_0x6908('0x31')],_0x51de9c[_0x6908('0x2e')]);_0x1ae996[_0x6908('0x32')]=_[_0x6908('0x30')](_0x51de9c[_0x6908('0x31')],qs[_0x6908('0x33')](_0x1fc9a3[_0x6908('0x2e')][_0x6908('0x33')]));_0x1ae996[_0x6908('0x32')]=_0x1ae996[_0x6908('0x32')][_0x6908('0x34')]?_0x1ae996[_0x6908('0x32')]:_0x51de9c['model'];if(_0x1fc9a3[_0x6908('0x2e')][_0x6908('0x40')]){_0x1ae996[_0x6908('0x41')]=[{'all':!![]}];}_0x1ae996=_['merge']({},_0x1ae996,_0x1fc9a3[_0x6908('0x3e')]);return db[_0x6908('0x3f')]['find'](_0x1ae996)[_0x6908('0x21')](handleEntityNotFound(_0x59aacb,null))[_0x6908('0x21')](respondWithResult(_0x59aacb,null))[_0x6908('0x44')](handleError(_0x59aacb,null));};exports['create']=function(_0x281c25,_0x35efba){return db[_0x6908('0x3f')]['create'](_0x281c25[_0x6908('0x48')],{})[_0x6908('0x21')](function(_0x14f2e9){var _0x4e3e0b=_0x281c25[_0x6908('0x49')][_0x6908('0x4a')]({'plain':!![]});if(!_0x4e3e0b)throw new Error(_0x6908('0x4b'));if(_0x4e3e0b[_0x6908('0x4c')]==='user'){var _0x55784c=_0x14f2e9[_0x6908('0x4a')]({'plain':!![]});var _0x124e59=_0x6908('0x23');return db[_0x6908('0x4d')]['find']({'where':{'name':_0x124e59,'userProfileId':_0x4e3e0b[_0x6908('0x4e')]},'raw':!![]})[_0x6908('0x21')](function(_0x203882){if(_0x203882&&_0x203882[_0x6908('0x4f')]===0x0){return db['UserProfileResource'][_0x6908('0x50')]({'name':_0x55784c[_0x6908('0x27')],'resourceId':_0x55784c['id'],'type':_0x203882[_0x6908('0x27')],'sectionId':_0x203882['id']},{})['then'](function(){return _0x14f2e9;});}else{return _0x14f2e9;}})[_0x6908('0x44')](function(_0x3f9011){logger[_0x6908('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f9011);throw _0x3f9011;});}return _0x14f2e9;})[_0x6908('0x21')](respondWithResult(_0x35efba,0xc9))[_0x6908('0x44')](handleError(_0x35efba,null));};exports[_0x6908('0x51')]=function(_0x357d80,_0x205a8){if(_0x357d80['body']['id']){delete _0x357d80[_0x6908('0x48')]['id'];}return db[_0x6908('0x3f')][_0x6908('0x52')]({'where':{'id':_0x357d80[_0x6908('0x46')]['id']}})[_0x6908('0x21')](handleEntityNotFound(_0x205a8,null))[_0x6908('0x21')](saveUpdates(_0x357d80[_0x6908('0x48')],null))[_0x6908('0x21')](respondWithResult(_0x205a8,null))[_0x6908('0x44')](handleError(_0x205a8,null));};exports['destroy']=function(_0x412aaa,_0x3dc977){return db['CmHopperAdditionalPhone'][_0x6908('0x52')]({'where':{'id':_0x412aaa['params']['id']}})[_0x6908('0x21')](handleEntityNotFound(_0x3dc977,null))[_0x6908('0x21')](removeEntity(_0x3dc977,null))[_0x6908('0x44')](handleError(_0x3dc977,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 1a1023f..5015fc1 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 _0x60a7=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x60a7,0x127));var _0x760a=function(_0x16b5a0,_0xadeb6c){_0x16b5a0=_0x16b5a0-0x0;var _0x2dc72b=_0x60a7[_0x16b5a0];return _0x2dc72b;};'use strict';var _=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var logger=require(_0x760a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x760a('0x3'));var rp=require(_0x760a('0x4'));var fs=require('fs');var path=require(_0x760a('0x5'));var rimraf=require(_0x760a('0x6'));var config=require('../../config/environment');var attributes=require(_0x760a('0x7'));module[_0x760a('0x8')]=function(_0x1a63b2,_0x51af60){return _0x1a63b2[_0x760a('0x9')](_0x760a('0xa'),attributes,{'tableName':_0x760a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccaf=['lodash','util','../../config/logger','api','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xccaf,0x168));var _0xfcca=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xccaf[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xfcca('0x0'));var util=require(_0xfcca('0x1'));var logger=require(_0xfcca('0x2'))(_0xfcca('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('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcca('0x4'));module[_0xfcca('0x5')]=function(_0x5ce7c2,_0x43b36e){return _0x5ce7c2[_0xfcca('0x6')](_0xfcca('0x7'),attributes,{'tableName':_0xfcca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index f9b1da3..9237f70 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 _0x093b=['createdAt','updatedAt','phone','hopperToAdd','sequelize','transaction','update','field','IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','countmachineretry','entity','SwapAdditionalPhones','VoiceQueueId','CampaignId','duration','waitTime','scheduledat','add','minutes','isNil'];(function(_0x47cb6b,_0x32b8f5){var _0x3fcba4=function(_0x506f70){while(--_0x506f70){_0x47cb6b['push'](_0x47cb6b['shift']());}};_0x3fcba4(++_0x32b8f5);}(_0x093b,0x1b4));var _0xb093=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x093b[_0x2cc594];return _0x4abff7;};'use strict';var _=require(_0xb093('0x0'));var util=require(_0xb093('0x1'));var moment=require(_0xb093('0x2'));var BPromise=require(_0xb093('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb093('0x4'));var db=require(_0xb093('0x5'))['db'];var utils=require(_0xb093('0x6'));var logger=require(_0xb093('0x7'))(_0xb093('0x8'));var config=require('../../config/environment');var jayson=require(_0xb093('0x9'));var client=jayson[_0xb093('0xa')][_0xb093('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33d247,_0x12e716,_0xca23d5){return new BPromise(function(_0x1bb133,_0x7bbab7){return client[_0xb093('0xc')](_0x33d247,_0xca23d5)[_0xb093('0xd')](function(_0x54e3aa){logger['info'](_0xb093('0xe'),_0x12e716,_0xb093('0xf'));logger[_0xb093('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x12e716,_0xb093('0xf'),JSON[_0xb093('0x11')](_0x54e3aa));if(_0x54e3aa['error']){if(_0x54e3aa[_0xb093('0x12')][_0xb093('0x13')]===0x1f4){logger[_0xb093('0x12')](_0xb093('0xe'),_0x12e716,_0x54e3aa['error'][_0xb093('0x14')]);return _0x7bbab7(_0x54e3aa['error'][_0xb093('0x14')]);}logger[_0xb093('0x12')](_0xb093('0xe'),_0x12e716,_0x54e3aa[_0xb093('0x12')]['message']);return _0x1bb133(_0x54e3aa[_0xb093('0x12')]['message']);}else{logger[_0xb093('0x15')](_0xb093('0xe'),_0x12e716,_0xb093('0xf'));_0x1bb133(_0x54e3aa[_0xb093('0x16')][_0xb093('0x14')]);}})[_0xb093('0x17')](function(_0x509554){logger[_0xb093('0x12')](_0xb093('0xe'),_0x12e716,_0x509554);_0x7bbab7(_0x509554);});});}exports[_0xb093('0x18')]=function(_0x29b81c){var _0x279548=this;return new Promise(function(_0x4e2dd1,_0x47dc59){return db[_0xb093('0x19')][_0xb093('0x1a')]({'raw':!![],'where':{'ContactId':_0x29b81c[_0xb093('0x1b')][_0xb093('0x1c')],'ListId':_0x29b81c['body'][_0xb093('0x1d')],'VoiceQueueId':_0x29b81c[_0xb093('0x1b')]['VoiceQueueId']===undefined?null:_0x29b81c[_0xb093('0x1b')]['VoiceQueueId'],'CampaignId':_0x29b81c[_0xb093('0x1b')]['CampaignId']===undefined?null:_0x29b81c[_0xb093('0x1b')]['CampaignId']}})[_0xb093('0xd')](function(_0x5ed3eb){if(_0x5ed3eb!=null){return db[_0xb093('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5ed3eb['id'],'OrderBy':{'$gt':_0x5ed3eb[_0xb093('0x1f')]}},'order':[['OrderBy',_0xb093('0x20')]]})[_0xb093('0xd')](function(_0x317d7a){var _0x548c03=0x0;if(_0x317d7a){if(_0x317d7a['countbusyretry']+_0x317d7a[_0xb093('0x21')]+_0x317d7a[_0xb093('0x22')]+_0x317d7a[_0xb093('0x23')]+_0x317d7a[_0xb093('0x24')]+_0x317d7a[_0xb093('0x25')]+_0x317d7a['countmachineretry']+_0x317d7a[_0xb093('0x26')]<_0x29b81c['entity'][_0xb093('0x27')])_0x548c03=0x1;_0x4e2dd1({'additional':_0x548c03});}else{return db[_0xb093('0x1e')][_0xb093('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x5ed3eb['id']},'order':[[_0xb093('0x1f'),_0xb093('0x20')]]})['then'](function(_0x3f3c7e){var _0x3d7f0a=0x0;if(_0x3f3c7e){if(_0x3f3c7e[_0xb093('0x28')]+_0x3f3c7e[_0xb093('0x21')]+_0x3f3c7e[_0xb093('0x22')]+_0x3f3c7e[_0xb093('0x23')]+_0x3f3c7e[_0xb093('0x24')]+_0x3f3c7e[_0xb093('0x25')]+_0x3f3c7e[_0xb093('0x29')]+_0x3f3c7e['countagentrejectretry']<_0x29b81c[_0xb093('0x2a')][_0xb093('0x27')])_0x3d7f0a=0x1;_0x4e2dd1({'additional':_0x3d7f0a});}else{_0x4e2dd1({'additional':0x0});}})[_0xb093('0x17')](function(_0x56bca3){logger[_0xb093('0x12')]('VerifyAdditionalPhones',_0x56bca3['message'],_0x29b81c);_0x47dc59(_0x279548[_0xb093('0x12')](0x1f4,_0x56bca3['message']));});}})[_0xb093('0x17')](function(_0x211d57){logger[_0xb093('0x12')](_0xb093('0x18'),_0x211d57[_0xb093('0x14')],_0x29b81c);_0x47dc59(_0x279548[_0xb093('0x12')](0x1f4,_0x211d57[_0xb093('0x14')]));});}else _0x4e2dd1({'additional':0x0});});});};exports[_0xb093('0x2b')]=function(_0x6f1549){var _0x31e8ed=this;return new Promise(function(_0x106543,_0x163b02){return db[_0xb093('0x19')][_0xb093('0x1a')]({'raw':!![],'where':{'ContactId':_0x6f1549['body'][_0xb093('0x1c')],'ListId':_0x6f1549['body'][_0xb093('0x1d')],'VoiceQueueId':_0x6f1549[_0xb093('0x1b')][_0xb093('0x2c')]===undefined?null:_0x6f1549['body']['VoiceQueueId'],'CampaignId':_0x6f1549[_0xb093('0x1b')][_0xb093('0x2d')]===undefined?null:_0x6f1549['body'][_0xb093('0x2d')]}})[_0xb093('0xd')](function(_0x308321){if(_0x308321!=null){return db[_0xb093('0x1e')][_0xb093('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x308321['id'],'OrderBy':{'$gt':_0x308321[_0xb093('0x1f')]}},'order':[['OrderBy',_0xb093('0x20')]]})[_0xb093('0xd')](function(_0xd33dc4){if(_0xd33dc4)return activateAdditionalPhone(_0x308321,_0x6f1549[_0xb093('0x1b')],_0xd33dc4,_0x6f1549[_0xb093('0x2e')],_0x6f1549[_0xb093('0x2f')])[_0xb093('0xd')](function(_0x42058a){_0x106543(_0x42058a);});else{return db['CmHopperAdditionalPhone'][_0xb093('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x308321['id']},'order':[[_0xb093('0x1f'),_0xb093('0x20')]]})[_0xb093('0xd')](function(_0x15be91){if(_0x15be91)return activateAdditionalPhone(_0x308321,_0x6f1549[_0xb093('0x1b')],_0x15be91,_0x6f1549[_0xb093('0x2e')],_0x6f1549[_0xb093('0x2f')])[_0xb093('0xd')](function(_0x147e2b){_0x106543(_0x147e2b);});else{_0x106543({'id':_0x308321['id'],'phone':''});}})[_0xb093('0x17')](function(_0x33c2d0){logger[_0xb093('0x12')](_0xb093('0x18'),_0x33c2d0[_0xb093('0x14')],_0x6f1549);_0x163b02(_0x31e8ed[_0xb093('0x12')](0x1f4,_0x33c2d0[_0xb093('0x14')]));});}})[_0xb093('0x17')](function(_0x1c717c){logger[_0xb093('0x12')](_0xb093('0x18'),_0x1c717c['message'],_0x6f1549);_0x163b02(_0x31e8ed['error'](0x1f4,_0x1c717c[_0xb093('0x14')]));});}else _0x106543(0x1);});});};function activateAdditionalPhone(_0x440622,_0x2ac026,_0x56f78b,_0x36ced2,_0x468e6d){return new Promise(function(_0x9387bf,_0x2d9907){logger[_0xb093('0x15')]('VerifyAdditionalPhones',_0x56f78b);var _0x3be0b3;if(moment()>moment(_0x56f78b[_0xb093('0x30')])){_0x3be0b3=moment()[_0xb093('0x31')](_0x468e6d||0x3,_0xb093('0x32'));}else{if(_0x56f78b[_0xb093('0x1f')]==0x0){_0x3be0b3=moment(_0x56f78b[_0xb093('0x30')]);}else{_0x3be0b3=moment()[_0xb093('0x31')](_0x468e6d||0x3,_0xb093('0x32'));}}var _0x3a307c={'phone':_0x440622['phone'],'active':0x0,'OrderBy':_[_0xb093('0x33')](_0x440622[_0xb093('0x1f')])?0x0:_0x440622[_0xb093('0x1f')],'scheduledat':moment()['add'](_0x36ced2||0x1,_0xb093('0x32')),'countbusyretry':_0x2ac026[_0xb093('0x28')],'countcongestionretry':_0x2ac026[_0xb093('0x21')],'countnoanswerretry':_0x2ac026[_0xb093('0x22')],'countnosuchnumberretry':_0x2ac026[_0xb093('0x23')],'countdropretry':_0x2ac026[_0xb093('0x24')],'countabandonedretry':_0x2ac026[_0xb093('0x25')],'countmachineretry':_0x2ac026['countmachineretry'],'countagentrejectretry':_0x2ac026[_0xb093('0x26')],'createdAt':_0x2ac026[_0xb093('0x34')],'updatedAt':_0x2ac026[_0xb093('0x35')]};var _0x20c781={'CmHopperId':_0x440622['id'],'phone':_0x56f78b[_0xb093('0x36')],'active':0x0,'OrderBy':_[_0xb093('0x33')](_0x56f78b[_0xb093('0x1f')])?0x0:_0x56f78b[_0xb093('0x1f')],'scheduledat':_0x3be0b3,'countbusyretry':_0x56f78b[_0xb093('0x28')],'countcongestionretry':_0x56f78b[_0xb093('0x21')],'countnoanswerretry':_0x56f78b[_0xb093('0x22')],'countnosuchnumberretry':_0x2ac026[_0xb093('0x23')],'countdropretry':_0x2ac026['countdropretry'],'countabandonedretry':_0x2ac026['countabandonedretry'],'countmachineretry':_0x2ac026[_0xb093('0x29')],'countagentrejectretry':_0x2ac026['countagentrejectretry'],'createdAt':_0x56f78b[_0xb093('0x34')],'updatedAt':_0x56f78b[_0xb093('0x35')]};logger[_0xb093('0x15')](_0xb093('0x37'),_0x3a307c);logger[_0xb093('0x15')]('additionalToHop',_0x20c781);return db[_0xb093('0x38')][_0xb093('0x39')](function(_0x27806d){return db[_0xb093('0x1e')]['update'](_0x3a307c,{'where':{'id':_0x56f78b['id']}},{'transaction':_0x27806d})[_0xb093('0xd')](function(){return db[_0xb093('0x19')][_0xb093('0x3a')](_0x20c781,{'where':{'id':_0x440622['id']}},{'transaction':_0x27806d});});})[_0xb093('0xd')](function(_0x15de1d){_0x9387bf({'id':_0x440622['id'],'phone':_0x56f78b['phone']});})[_0xb093('0x17')](function(_0x3560e1){logger[_0xb093('0x12')]('VerifyAdditionalPhones',_0x3560e1[_0xb093('0x14')],req);_0x2d9907(_this[_0xb093('0x12')](0x1f4,_0x3560e1[_0xb093('0x14')]));});});}exports['IncrementPreviewCounters']=function(_0x4cf0cb){var _0x19e0ba=this;return new Promise(function(_0xd8188f,_0x2212f5){return db[_0xb093('0x19')][_0xb093('0x3a')](_0x4cf0cb['body'][_0xb093('0x3b')],{'where':{'id':_0x4cf0cb[_0xb093('0x1b')]['id']}})[_0xb093('0xd')](function(_0x5b4cde){_0xd8188f(_0x5b4cde);})[_0xb093('0x17')](function(_0x37eebd){logger['error'](_0xb093('0x3c'),_0x37eebd[_0xb093('0x14')],_0x4cf0cb);_0x2212f5(_0x19e0ba['error'](0x1f4,_0x37eebd[_0xb093('0x14')]));});});}; \ No newline at end of file +var _0x0c0b=['VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnosuchnumberretry','SwapAdditionalPhones','CmHopper','ContactId','duration','waitTime','info','add','minutes','scheduledat','isNil','createdAt','updatedAt','phone','countcongestionretry','hopperToAdd','update','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x5c3194,_0x2ebfec){var _0x402748=function(_0x52a8b4){while(--_0x52a8b4){_0x5c3194['push'](_0x5c3194['shift']());}};_0x402748(++_0x2ebfec);}(_0x0c0b,0x1e4));var _0xb0c0=function(_0x5273d3,_0x40269d){_0x5273d3=_0x5273d3-0x0;var _0x325189=_0x0c0b[_0x5273d3];return _0x325189;};'use strict';var _=require(_0xb0c0('0x0'));var util=require(_0xb0c0('0x1'));var moment=require('moment');var BPromise=require(_0xb0c0('0x2'));var rs=require(_0xb0c0('0x3'));var fs=require('fs');var Redis=require(_0xb0c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0c0('0x5'));var logger=require(_0xb0c0('0x6'))(_0xb0c0('0x7'));var config=require(_0xb0c0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb0c0('0x9')][_0xb0c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332854,_0x41cd4f,_0x346b28){return new BPromise(function(_0x37fd07,_0x5af5f6){return client['request'](_0x332854,_0x346b28)[_0xb0c0('0xb')](function(_0x2c09e8){logger['info'](_0xb0c0('0xc'),_0x41cd4f,_0xb0c0('0xd'));logger[_0xb0c0('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x41cd4f,'request\x20sent',JSON[_0xb0c0('0xf')](_0x2c09e8));if(_0x2c09e8[_0xb0c0('0x10')]){if(_0x2c09e8['error'][_0xb0c0('0x11')]===0x1f4){logger[_0xb0c0('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x41cd4f,_0x2c09e8[_0xb0c0('0x10')]['message']);return _0x5af5f6(_0x2c09e8[_0xb0c0('0x10')][_0xb0c0('0x12')]);}logger[_0xb0c0('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x41cd4f,_0x2c09e8['error']['message']);return _0x37fd07(_0x2c09e8[_0xb0c0('0x10')][_0xb0c0('0x12')]);}else{logger['info'](_0xb0c0('0xc'),_0x41cd4f,_0xb0c0('0xd'));_0x37fd07(_0x2c09e8['result'][_0xb0c0('0x12')]);}})[_0xb0c0('0x13')](function(_0x4fbd0b){logger[_0xb0c0('0x10')](_0xb0c0('0xc'),_0x41cd4f,_0x4fbd0b);_0x5af5f6(_0x4fbd0b);});});}exports[_0xb0c0('0x14')]=function(_0x281181){var _0x36a02d=this;return new Promise(function(_0x2bad2a,_0x1f0edd){return db['CmHopper'][_0xb0c0('0x15')]({'raw':!![],'where':{'ContactId':_0x281181[_0xb0c0('0x16')]['ContactId'],'ListId':_0x281181[_0xb0c0('0x16')][_0xb0c0('0x17')],'VoiceQueueId':_0x281181[_0xb0c0('0x16')][_0xb0c0('0x18')]===undefined?null:_0x281181[_0xb0c0('0x16')][_0xb0c0('0x18')],'CampaignId':_0x281181[_0xb0c0('0x16')][_0xb0c0('0x19')]===undefined?null:_0x281181['body'][_0xb0c0('0x19')]}})['then'](function(_0x352738){if(_0x352738!=null){return db['CmHopperAdditionalPhone'][_0xb0c0('0x15')]({'raw':!![],'where':{'CmHopperId':_0x352738['id'],'OrderBy':{'$gt':_0x352738[_0xb0c0('0x1a')]}},'order':[[_0xb0c0('0x1a'),_0xb0c0('0x1b')]]})['then'](function(_0x4d7324){var _0x58030b=0x0;if(_0x4d7324){if(_0x4d7324[_0xb0c0('0x1c')]+_0x4d7324['countcongestionretry']+_0x4d7324[_0xb0c0('0x1d')]+_0x4d7324['countnosuchnumberretry']+_0x4d7324[_0xb0c0('0x1e')]+_0x4d7324[_0xb0c0('0x1f')]+_0x4d7324[_0xb0c0('0x20')]+_0x4d7324[_0xb0c0('0x21')]<_0x281181[_0xb0c0('0x22')][_0xb0c0('0x23')])_0x58030b=0x1;_0x2bad2a({'additional':_0x58030b});}else{return db[_0xb0c0('0x24')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x352738['id']},'order':[[_0xb0c0('0x1a'),_0xb0c0('0x1b')]]})[_0xb0c0('0xb')](function(_0x14e185){var _0x563c53=0x0;if(_0x14e185){if(_0x14e185[_0xb0c0('0x1c')]+_0x14e185['countcongestionretry']+_0x14e185[_0xb0c0('0x1d')]+_0x14e185[_0xb0c0('0x25')]+_0x14e185['countdropretry']+_0x14e185['countabandonedretry']+_0x14e185[_0xb0c0('0x20')]+_0x14e185['countagentrejectretry']<_0x281181[_0xb0c0('0x22')][_0xb0c0('0x23')])_0x563c53=0x1;_0x2bad2a({'additional':_0x563c53});}else{_0x2bad2a({'additional':0x0});}})[_0xb0c0('0x13')](function(_0x416a4f){logger[_0xb0c0('0x10')]('VerifyAdditionalPhones',_0x416a4f[_0xb0c0('0x12')],_0x281181);_0x1f0edd(_0x36a02d['error'](0x1f4,_0x416a4f[_0xb0c0('0x12')]));});}})[_0xb0c0('0x13')](function(_0x338235){logger[_0xb0c0('0x10')](_0xb0c0('0x14'),_0x338235[_0xb0c0('0x12')],_0x281181);_0x1f0edd(_0x36a02d[_0xb0c0('0x10')](0x1f4,_0x338235[_0xb0c0('0x12')]));});}else _0x2bad2a({'additional':0x0});});});};exports[_0xb0c0('0x26')]=function(_0x49376c){var _0x14cd27=this;return new Promise(function(_0x5927c4,_0x2b30b1){return db[_0xb0c0('0x27')][_0xb0c0('0x15')]({'raw':!![],'where':{'ContactId':_0x49376c[_0xb0c0('0x16')][_0xb0c0('0x28')],'ListId':_0x49376c['body']['ListId'],'VoiceQueueId':_0x49376c['body'][_0xb0c0('0x18')]===undefined?null:_0x49376c[_0xb0c0('0x16')]['VoiceQueueId'],'CampaignId':_0x49376c[_0xb0c0('0x16')]['CampaignId']===undefined?null:_0x49376c['body'][_0xb0c0('0x19')]}})[_0xb0c0('0xb')](function(_0x229c52){if(_0x229c52!=null){return db[_0xb0c0('0x24')][_0xb0c0('0x15')]({'raw':!![],'where':{'CmHopperId':_0x229c52['id'],'OrderBy':{'$gt':_0x229c52['OrderBy']}},'order':[[_0xb0c0('0x1a'),_0xb0c0('0x1b')]]})[_0xb0c0('0xb')](function(_0x3c49b5){if(_0x3c49b5)return activateAdditionalPhone(_0x229c52,_0x49376c[_0xb0c0('0x16')],_0x3c49b5,_0x49376c[_0xb0c0('0x29')],_0x49376c[_0xb0c0('0x2a')])['then'](function(_0x2fe50a){_0x5927c4(_0x2fe50a);});else{return db[_0xb0c0('0x24')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x229c52['id']},'order':[[_0xb0c0('0x1a'),_0xb0c0('0x1b')]]})[_0xb0c0('0xb')](function(_0x5e7645){if(_0x5e7645)return activateAdditionalPhone(_0x229c52,_0x49376c[_0xb0c0('0x16')],_0x5e7645,_0x49376c['duration'],_0x49376c[_0xb0c0('0x2a')])[_0xb0c0('0xb')](function(_0x2444f8){_0x5927c4(_0x2444f8);});else{_0x5927c4({'id':_0x229c52['id'],'phone':''});}})[_0xb0c0('0x13')](function(_0x5438ee){logger['error']('VerifyAdditionalPhones',_0x5438ee[_0xb0c0('0x12')],_0x49376c);_0x2b30b1(_0x14cd27['error'](0x1f4,_0x5438ee[_0xb0c0('0x12')]));});}})[_0xb0c0('0x13')](function(_0x5a1e1c){logger[_0xb0c0('0x10')](_0xb0c0('0x14'),_0x5a1e1c[_0xb0c0('0x12')],_0x49376c);_0x2b30b1(_0x14cd27[_0xb0c0('0x10')](0x1f4,_0x5a1e1c['message']));});}else _0x5927c4(0x1);});});};function activateAdditionalPhone(_0x2226fa,_0x18f035,_0x399a55,_0x22c508,_0x37a651){return new Promise(function(_0x16006b,_0x116816){logger[_0xb0c0('0x2b')](_0xb0c0('0x14'),_0x399a55);var _0xd9faa9;if(moment()>moment(_0x399a55['scheduledat'])){_0xd9faa9=moment()[_0xb0c0('0x2c')](_0x37a651||0x3,_0xb0c0('0x2d'));}else{if(_0x399a55[_0xb0c0('0x1a')]==0x0){_0xd9faa9=moment(_0x399a55[_0xb0c0('0x2e')]);}else{_0xd9faa9=moment()[_0xb0c0('0x2c')](_0x37a651||0x3,_0xb0c0('0x2d'));}}var _0x1b68d1={'phone':_0x2226fa['phone'],'active':0x0,'OrderBy':_[_0xb0c0('0x2f')](_0x2226fa[_0xb0c0('0x1a')])?0x0:_0x2226fa[_0xb0c0('0x1a')],'scheduledat':moment()['add'](_0x22c508||0x1,_0xb0c0('0x2d')),'countbusyretry':_0x18f035['countbusyretry'],'countcongestionretry':_0x18f035['countcongestionretry'],'countnoanswerretry':_0x18f035[_0xb0c0('0x1d')],'countnosuchnumberretry':_0x18f035[_0xb0c0('0x25')],'countdropretry':_0x18f035[_0xb0c0('0x1e')],'countabandonedretry':_0x18f035[_0xb0c0('0x1f')],'countmachineretry':_0x18f035[_0xb0c0('0x20')],'countagentrejectretry':_0x18f035[_0xb0c0('0x21')],'createdAt':_0x18f035[_0xb0c0('0x30')],'updatedAt':_0x18f035[_0xb0c0('0x31')]};var _0x29b356={'CmHopperId':_0x2226fa['id'],'phone':_0x399a55[_0xb0c0('0x32')],'active':0x0,'OrderBy':_[_0xb0c0('0x2f')](_0x399a55[_0xb0c0('0x1a')])?0x0:_0x399a55[_0xb0c0('0x1a')],'scheduledat':_0xd9faa9,'countbusyretry':_0x399a55[_0xb0c0('0x1c')],'countcongestionretry':_0x399a55[_0xb0c0('0x33')],'countnoanswerretry':_0x399a55['countnoanswerretry'],'countnosuchnumberretry':_0x18f035[_0xb0c0('0x25')],'countdropretry':_0x18f035[_0xb0c0('0x1e')],'countabandonedretry':_0x18f035[_0xb0c0('0x1f')],'countmachineretry':_0x18f035[_0xb0c0('0x20')],'countagentrejectretry':_0x18f035[_0xb0c0('0x21')],'createdAt':_0x399a55[_0xb0c0('0x30')],'updatedAt':_0x399a55[_0xb0c0('0x31')]};logger[_0xb0c0('0x2b')](_0xb0c0('0x34'),_0x1b68d1);logger[_0xb0c0('0x2b')]('additionalToHop',_0x29b356);return db['sequelize']['transaction'](function(_0x26a0b0){return db['CmHopperAdditionalPhone'][_0xb0c0('0x35')](_0x1b68d1,{'where':{'id':_0x399a55['id']}},{'transaction':_0x26a0b0})['then'](function(){return db['CmHopper'][_0xb0c0('0x35')](_0x29b356,{'where':{'id':_0x2226fa['id']}},{'transaction':_0x26a0b0});});})[_0xb0c0('0xb')](function(_0x407682){_0x16006b({'id':_0x2226fa['id'],'phone':_0x399a55[_0xb0c0('0x32')]});})[_0xb0c0('0x13')](function(_0x2377b8){logger[_0xb0c0('0x10')](_0xb0c0('0x14'),_0x2377b8[_0xb0c0('0x12')],req);_0x116816(_this[_0xb0c0('0x10')](0x1f4,_0x2377b8['message']));});});}exports[_0xb0c0('0x36')]=function(_0xab7937){var _0x3189fd=this;return new Promise(function(_0x2944a1,_0x53a00c){return db[_0xb0c0('0x27')][_0xb0c0('0x35')](_0xab7937[_0xb0c0('0x16')][_0xb0c0('0x37')],{'where':{'id':_0xab7937[_0xb0c0('0x16')]['id']}})[_0xb0c0('0xb')](function(_0x2f17db){_0x2944a1(_0x2f17db);})[_0xb0c0('0x13')](function(_0xc0d5b2){logger[_0xb0c0('0x10')](_0xb0c0('0x36'),_0xc0d5b2[_0xb0c0('0x12')],_0xab7937);_0x53a00c(_0x3189fd[_0xb0c0('0x10')](0x1f4,_0xc0d5b2['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e62d488..d99d625 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 _0x7784=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x7784,0xd4));var _0x4778=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7784[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x4778('0x0'));var path=require('path');var timeout=require(_0x4778('0x1'));var express=require(_0x4778('0x2'));var router=express[_0x4778('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4778('0x4'));var config=require(_0x4778('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4778('0x6'),auth[_0x4778('0x7')](),controller[_0x4778('0x8')]);router[_0x4778('0x9')]('/',auth[_0x4778('0x7')](),controller[_0x4778('0xa')]);router['put'](_0x4778('0x6'),auth[_0x4778('0x7')](),controller[_0x4778('0xb')]);router[_0x4778('0xc')](_0x4778('0x6'),auth[_0x4778('0x7')](),controller[_0x4778('0xd')]);module[_0x4778('0xe')]=router; \ No newline at end of file +var _0xc765=['exports','multer','util','path','express','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','post','create','put','update','/:id'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0xc765,0x14b));var _0x5c76=function(_0x5e104c,_0x10e9a6){_0x5e104c=_0x5e104c-0x0;var _0x3e9b68=_0xc765[_0x5e104c];return _0x3e9b68;};'use strict';var multer=require(_0x5c76('0x0'));var util=require(_0x5c76('0x1'));var path=require(_0x5c76('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c76('0x3'));var router=express['Router']();var auth=require(_0x5c76('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c76('0x5'));var controller=require(_0x5c76('0x6'));router['get']('/',auth[_0x5c76('0x7')](),controller[_0x5c76('0x8')]);router['get']('/:id',auth[_0x5c76('0x7')](),controller['show']);router[_0x5c76('0x9')]('/',auth[_0x5c76('0x7')](),controller[_0x5c76('0xa')]);router[_0x5c76('0xb')]('/:id',auth[_0x5c76('0x7')](),controller[_0x5c76('0xc')]);router['delete'](_0x5c76('0xd'),auth[_0x5c76('0x7')](),controller['destroy']);module[_0x5c76('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 410a2b1..dcbdaa0 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 _0xb955=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb955,0x1db));var _0x5b95=function(_0x58c2df,_0x312f93){_0x58c2df=_0x58c2df-0x0;var _0x3599f7=_0xb955[_0x58c2df];return _0x3599f7;};'use strict';var moment=require(_0x5b95('0x0'));var Sequelize=require('sequelize');module[_0x5b95('0x1')]={'phone':{'type':Sequelize[_0x5b95('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5b95('0x3')],'unique':_0x5b95('0x4')},'ListId':{'type':Sequelize[_0x5b95('0x3')],'unique':_0x5b95('0x4')},'VoiceQueueId':{'type':Sequelize[_0x5b95('0x3')],'unique':_0x5b95('0x4')}}; \ No newline at end of file +var _0x298e=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x298e,0x159));var _0xe298=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x298e[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xe298('0x0'));var Sequelize=require(_0xe298('0x1'));module[_0xe298('0x2')]={'phone':{'type':Sequelize[_0xe298('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe298('0x4')],'unique':_0xe298('0x5')},'ListId':{'type':Sequelize[_0xe298('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe298('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7d49b6d..de09541 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(_0xc4c5fc,_0x2a7271){var _0x19a06c=function(_0x48d388){while(--_0x48d388){_0xc4c5fc['push'](_0xc4c5fc['shift']());}};_0x19a06c(++_0x2a7271);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x59421b,_0x1fe6fa){var _0x12e0e6=function(_0x2f6e5b){while(--_0x2f6e5b){_0x59421b['push'](_0x59421b['shift']());}};_0x12e0e6(++_0x1fe6fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 6ba7c16..08d3855 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api'];(function(_0x332cdd,_0x362367){var _0x421b2a=function(_0x58aa30){while(--_0x58aa30){_0x332cdd['push'](_0x332cdd['shift']());}};_0x421b2a(++_0x362367);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x28ac5a,_0x5619b4){var _0x3f2860=function(_0x5d00f1){while(--_0x5d00f1){_0x28ac5a['push'](_0x28ac5a['shift']());}};_0x3f2860(++_0x5619b4);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 63f858b..999d94a 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 _0xa14a=['http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopperBlack','findAll','options','raw','where','include','map','model','attributes','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0xa14a,0x156));var _0xaa14=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xa14a[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0xaa14('0x0'));var moment=require(_0xaa14('0x1'));var BPromise=require(_0xaa14('0x2'));var rs=require(_0xaa14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa14('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa14('0x5'))(_0xaa14('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa14('0x7')][_0xaa14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49403c,_0x10ae54,_0x31ac24){return new BPromise(function(_0x82ca95,_0x1de341){return client[_0xaa14('0x9')](_0x49403c,_0x31ac24)[_0xaa14('0xa')](function(_0x37ecae){logger[_0xaa14('0xb')](_0xaa14('0xc'),_0x10ae54,_0xaa14('0xd'));logger[_0xaa14('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x10ae54,_0xaa14('0xd'),JSON[_0xaa14('0xf')](_0x37ecae));if(_0x37ecae[_0xaa14('0x10')]){if(_0x37ecae[_0xaa14('0x10')][_0xaa14('0x11')]===0x1f4){logger[_0xaa14('0x10')](_0xaa14('0xc'),_0x10ae54,_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);return _0x1de341(_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);}logger[_0xaa14('0x10')](_0xaa14('0xc'),_0x10ae54,_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);return _0x82ca95(_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);}else{logger[_0xaa14('0xb')](_0xaa14('0xc'),_0x10ae54,_0xaa14('0xd'));_0x82ca95(_0x37ecae['result'][_0xaa14('0x12')]);}})[_0xaa14('0x13')](function(_0xe90b6){logger[_0xaa14('0x10')](_0xaa14('0xc'),_0x10ae54,_0xe90b6);_0x1de341(_0xe90b6);});});}exports[_0xaa14('0x14')]=function(_0x256a26){var _0x5174ed=this;return new Promise(function(_0x5ea696,_0x458376){return db['CmHopperBlack'][_0xaa14('0x15')]({'raw':_0x256a26['options']?_0x256a26[_0xaa14('0x16')][_0xaa14('0x17')]===undefined?!![]:![]:!![],'where':_0x256a26[_0xaa14('0x16')]?_0x256a26[_0xaa14('0x16')][_0xaa14('0x18')]||null:null,'attributes':_0x256a26[_0xaa14('0x16')]?_0x256a26['options']['attributes']||null:null,'limit':_0x256a26['options']?_0x256a26[_0xaa14('0x16')]['limit']||null:null,'include':_0x256a26[_0xaa14('0x16')]?_0x256a26[_0xaa14('0x16')][_0xaa14('0x19')]?_[_0xaa14('0x1a')](_0x256a26[_0xaa14('0x16')][_0xaa14('0x19')],function(_0x71cd83){return{'model':db[_0x71cd83[_0xaa14('0x1b')]],'as':_0x71cd83['as'],'attributes':_0x71cd83['attributes'],'include':_0x71cd83[_0xaa14('0x19')]?_['map'](_0x71cd83[_0xaa14('0x19')],function(_0x30e4c3){return{'model':db[_0x30e4c3['model']],'as':_0x30e4c3['as'],'attributes':_0x30e4c3[_0xaa14('0x1c')],'include':_0x30e4c3[_0xaa14('0x19')]?_[_0xaa14('0x1a')](_0x30e4c3['include'],function(_0x35f411){return{'model':db[_0x35f411['model']],'as':_0x35f411['as'],'attributes':_0x35f411[_0xaa14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa14('0xa')](function(_0x409941){logger[_0xaa14('0xb')](_0xaa14('0x14'),_0x256a26);logger[_0xaa14('0xe')](_0xaa14('0x14'),_0x256a26,JSON[_0xaa14('0xf')](_0x409941));_0x5ea696(_0x409941);})['catch'](function(_0x45d34b){logger['error'](_0xaa14('0x14'),_0x45d34b['message'],_0x256a26);_0x458376(_0x5174ed[_0xaa14('0x10')](0x1f4,_0x45d34b[_0xaa14('0x12')]));});});};exports[_0xaa14('0x1d')]=function(_0x63bade){var _0x229674=this;return new Promise(function(_0x374094,_0x1787cb){return db[_0xaa14('0x1e')][_0xaa14('0x1f')](_0x63bade[_0xaa14('0x20')],{'raw':_0x63bade[_0xaa14('0x16')]?_0x63bade[_0xaa14('0x16')][_0xaa14('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63bade[_0xaa14('0x16')]?_0x63bade[_0xaa14('0x16')][_0xaa14('0x18')]||null:null,'attributes':_0x63bade[_0xaa14('0x16')]?_0x63bade['options'][_0xaa14('0x1c')]||null:null,'limit':_0x63bade[_0xaa14('0x16')]?_0x63bade['options']['limit']||null:null})[_0xaa14('0xa')](function(_0xfbff3e){logger[_0xaa14('0xb')](_0xaa14('0x1d'),_0x63bade);logger[_0xaa14('0xe')](_0xaa14('0x1d'),_0x63bade,JSON['stringify'](_0xfbff3e));_0x374094(_0xfbff3e);})[_0xaa14('0x13')](function(_0x552b25){logger[_0xaa14('0x10')](_0xaa14('0x1d'),_0x552b25[_0xaa14('0x12')],_0x63bade);_0x1787cb(_0x229674['error'](0x1f4,_0x552b25['message']));});});};exports[_0xaa14('0x21')]=function(_0x3d687e){var _0x248041=this;return new Promise(function(_0x2bae3b,_0xe7845b){return db[_0xaa14('0x1e')][_0xaa14('0x22')]({'where':_0x3d687e[_0xaa14('0x16')]?_0x3d687e[_0xaa14('0x16')][_0xaa14('0x18')]||null:null})[_0xaa14('0xa')](function(_0x365bb6){logger[_0xaa14('0xb')](_0xaa14('0x21'),_0x3d687e);logger['debug'](_0xaa14('0x21'),_0x3d687e,JSON[_0xaa14('0xf')](_0x365bb6));_0x2bae3b(_0x365bb6);})[_0xaa14('0x13')](function(_0x148c2a){logger[_0xaa14('0x10')](_0xaa14('0x21'),_0x148c2a['message'],_0x3d687e);_0xe7845b(_0x248041[_0xaa14('0x10')](0x1f4,_0x148c2a[_0xaa14('0x12')]));});});}; \ No newline at end of file +var _0x485c=['stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x5f30a0,_0xc98d78){var _0x347887=function(_0x1b668a){while(--_0x1b668a){_0x5f30a0['push'](_0x5f30a0['shift']());}};_0x347887(++_0xc98d78);}(_0x485c,0x1a9));var _0xc485=function(_0x379ca6,_0x576458){_0x379ca6=_0x379ca6-0x0;var _0xee4c27=_0x485c[_0x379ca6];return _0xee4c27;};'use strict';var _=require('lodash');var util=require(_0xc485('0x0'));var moment=require(_0xc485('0x1'));var BPromise=require(_0xc485('0x2'));var rs=require(_0xc485('0x3'));var fs=require('fs');var Redis=require(_0xc485('0x4'));var db=require(_0xc485('0x5'))['db'];var utils=require(_0xc485('0x6'));var logger=require(_0xc485('0x7'))(_0xc485('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc485('0x9')][_0xc485('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58e9be,_0x4804b8,_0x1461fb){return new BPromise(function(_0xc1666a,_0x5661e9){return client[_0xc485('0xb')](_0x58e9be,_0x1461fb)[_0xc485('0xc')](function(_0x4804a9){logger[_0xc485('0xd')](_0xc485('0xe'),_0x4804b8,'request\x20sent');logger[_0xc485('0xf')](_0xc485('0x10'),_0x4804b8,'request\x20sent',JSON[_0xc485('0x11')](_0x4804a9));if(_0x4804a9[_0xc485('0x12')]){if(_0x4804a9['error'][_0xc485('0x13')]===0x1f4){logger[_0xc485('0x12')](_0xc485('0xe'),_0x4804b8,_0x4804a9[_0xc485('0x12')][_0xc485('0x14')]);return _0x5661e9(_0x4804a9['error'][_0xc485('0x14')]);}logger[_0xc485('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x4804b8,_0x4804a9[_0xc485('0x12')][_0xc485('0x14')]);return _0xc1666a(_0x4804a9[_0xc485('0x12')][_0xc485('0x14')]);}else{logger[_0xc485('0xd')](_0xc485('0xe'),_0x4804b8,'request\x20sent');_0xc1666a(_0x4804a9['result']['message']);}})[_0xc485('0x15')](function(_0x3db83f){logger[_0xc485('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x4804b8,_0x3db83f);_0x5661e9(_0x3db83f);});});}exports[_0xc485('0x16')]=function(_0x423df1){var _0x485ba1=this;return new Promise(function(_0x49dc01,_0x2df51b){return db[_0xc485('0x17')][_0xc485('0x18')]({'raw':_0x423df1[_0xc485('0x19')]?_0x423df1[_0xc485('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x423df1[_0xc485('0x19')]?_0x423df1[_0xc485('0x19')][_0xc485('0x1a')]||null:null,'attributes':_0x423df1[_0xc485('0x19')]?_0x423df1[_0xc485('0x19')][_0xc485('0x1b')]||null:null,'limit':_0x423df1[_0xc485('0x19')]?_0x423df1[_0xc485('0x19')][_0xc485('0x1c')]||null:null,'include':_0x423df1[_0xc485('0x19')]?_0x423df1[_0xc485('0x19')]['include']?_['map'](_0x423df1[_0xc485('0x19')][_0xc485('0x1d')],function(_0x1386af){return{'model':db[_0x1386af[_0xc485('0x1e')]],'as':_0x1386af['as'],'attributes':_0x1386af['attributes'],'include':_0x1386af[_0xc485('0x1d')]?_[_0xc485('0x1f')](_0x1386af[_0xc485('0x1d')],function(_0x3d4c8f){return{'model':db[_0x3d4c8f['model']],'as':_0x3d4c8f['as'],'attributes':_0x3d4c8f[_0xc485('0x1b')],'include':_0x3d4c8f['include']?_[_0xc485('0x1f')](_0x3d4c8f[_0xc485('0x1d')],function(_0xe87655){return{'model':db[_0xe87655['model']],'as':_0xe87655['as'],'attributes':_0xe87655['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x106b33){logger['info'](_0xc485('0x16'),_0x423df1);logger[_0xc485('0xf')](_0xc485('0x16'),_0x423df1,JSON[_0xc485('0x11')](_0x106b33));_0x49dc01(_0x106b33);})['catch'](function(_0x206f8c){logger[_0xc485('0x12')](_0xc485('0x16'),_0x206f8c[_0xc485('0x14')],_0x423df1);_0x2df51b(_0x485ba1['error'](0x1f4,_0x206f8c['message']));});});};exports[_0xc485('0x20')]=function(_0x398dde){var _0x155a37=this;return new Promise(function(_0x53ad0a,_0x221cef){return db[_0xc485('0x17')]['update'](_0x398dde['body'],{'raw':_0x398dde['options']?_0x398dde[_0xc485('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x398dde[_0xc485('0x19')]?_0x398dde[_0xc485('0x19')][_0xc485('0x1a')]||null:null,'attributes':_0x398dde['options']?_0x398dde[_0xc485('0x19')][_0xc485('0x1b')]||null:null,'limit':_0x398dde['options']?_0x398dde[_0xc485('0x19')]['limit']||null:null})[_0xc485('0xc')](function(_0x3a620c){logger['info'](_0xc485('0x20'),_0x398dde);logger['debug'](_0xc485('0x20'),_0x398dde,JSON[_0xc485('0x11')](_0x3a620c));_0x53ad0a(_0x3a620c);})['catch'](function(_0x539777){logger[_0xc485('0x12')]('UpdateCmHopperBlack',_0x539777['message'],_0x398dde);_0x221cef(_0x155a37[_0xc485('0x12')](0x1f4,_0x539777[_0xc485('0x14')]));});});};exports[_0xc485('0x21')]=function(_0x85d57b){var _0x4c49ae=this;return new Promise(function(_0x3b39fc,_0x10170c){return db['CmHopperBlack']['destroy']({'where':_0x85d57b[_0xc485('0x19')]?_0x85d57b['options'][_0xc485('0x1a')]||null:null})['then'](function(_0x3a41d7){logger[_0xc485('0xd')](_0xc485('0x21'),_0x85d57b);logger['debug']('DestroyCmHopperBlack',_0x85d57b,JSON[_0xc485('0x11')](_0x3a41d7));_0x3b39fc(_0x3a41d7);})['catch'](function(_0x3a3034){logger[_0xc485('0x12')]('DestroyCmHopperBlack',_0x3a3034['message'],_0x85d57b);_0x10170c(_0x4c49ae['error'](0x1f4,_0x3a3034[_0xc485('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a779a0a..8c5ad31 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 _0x5fd1=['/:id','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe'];(function(_0x11f6b4,_0x552754){var _0x5e0b4f=function(_0x31f8da){while(--_0x31f8da){_0x11f6b4['push'](_0x11f6b4['shift']());}};_0x5e0b4f(++_0x552754);}(_0x5fd1,0x155));var _0x15fd=function(_0x984b4a,_0x35a7b4){_0x984b4a=_0x984b4a-0x0;var _0x46b745=_0x5fd1[_0x984b4a];return _0x46b745;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router['get']('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0x8')]);router[_0x15fd('0x9')](_0x15fd('0xa'),auth[_0x15fd('0x7')](),controller['describe']);router[_0x15fd('0x9')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller['show']);router[_0x15fd('0xc')]('/:id',auth[_0x15fd('0x7')](),controller[_0x15fd('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xe')]);module[_0x15fd('0xf')]=router; \ No newline at end of file +var _0x34e8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2650de,_0x12c23e){var _0x2db8c0=function(_0x2d482d){while(--_0x2d482d){_0x2650de['push'](_0x2650de['shift']());}};_0x2db8c0(++_0x12c23e);}(_0x34e8,0x12c));var _0x834e=function(_0x1bd038,_0x520bbe){_0x1bd038=_0x1bd038-0x0;var _0x297a88=_0x34e8[_0x1bd038];return _0x297a88;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);module[_0x834e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 20d3655..24d10a5 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 _0x5fee=['DATE','getDataValue','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x576d5e,_0x20407a){var _0x45f248=function(_0x119d7e){while(--_0x119d7e){_0x576d5e['push'](_0x576d5e['shift']());}};_0x45f248(++_0x20407a);}(_0x5fee,0x150));var _0xe5fe=function(_0xd7e949,_0x71406b){_0xd7e949=_0xd7e949-0x0;var _0x165597=_0x5fee[_0xd7e949];return _0x165597;};'use strict';var Sequelize=require(_0xe5fe('0x0'));var moment=require(_0xe5fe('0x1'));module['exports']={'state':{'type':Sequelize[_0xe5fe('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe5fe('0x3')]},'scheduledat':{'type':Sequelize[_0xe5fe('0x4')]},'countbusyretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe5fe('0x3')]},'calleridname':{'type':Sequelize[_0xe5fe('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe5fe('0x4')]},'droptime':{'type':Sequelize[_0xe5fe('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe5fe('0x3')]},'membername':{'type':Sequelize[_0xe5fe('0x3')]},'reason':{'type':Sequelize[_0xe5fe('0x3')]},'disposition':{'type':Sequelize[_0xe5fe('0x3')]},'dispositionat':{'type':Sequelize[_0xe5fe('0x4')],'set':function(_0x368e0d){var _0x38e5ac=this[_0xe5fe('0x5')]('endtime');if(_0x38e5ac&&_0x368e0d){this[_0xe5fe('0x6')](_0xe5fe('0x7'),moment(_0x368e0d)[_0xe5fe('0x8')](moment(_0x38e5ac),'seconds'));}return this['setDataValue']('dispositionat',_0x368e0d);}},'amd':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe5fe('0x4')]},'callback':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe5fe('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe5fe('0x4')]},'deleted':{'type':Sequelize[_0xe5fe('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe5fe('0x4')]},'recallme':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe5fe('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x37c2=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','setDataValue','followuptime','diff','seconds','dispositionat'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x37c2,0x6d));var _0x237c=function(_0x5cebbc,_0x2de914){_0x5cebbc=_0x5cebbc-0x0;var _0x12b054=_0x37c2[_0x5cebbc];return _0x12b054;};'use strict';var Sequelize=require(_0x237c('0x0'));var moment=require(_0x237c('0x1'));module[_0x237c('0x2')]={'state':{'type':Sequelize[_0x237c('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x237c('0x4')]},'scheduledat':{'type':Sequelize[_0x237c('0x5')]},'countbusyretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x237c('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x237c('0x4')]},'originatecalleridname':{'type':Sequelize[_0x237c('0x4')]},'calleridnum':{'type':Sequelize[_0x237c('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x237c('0x5')]},'responsetime':{'type':Sequelize[_0x237c('0x5')]},'answertime':{'type':Sequelize[_0x237c('0x5')]},'droptime':{'type':Sequelize[_0x237c('0x5')]},'endtime':{'type':Sequelize[_0x237c('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x237c('0x4')]},'campaigntype':{'type':Sequelize[_0x237c('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x237c('0x4')]},'disposition':{'type':Sequelize[_0x237c('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x293042){var _0x1cca9e=this['getDataValue']('endtime');if(_0x1cca9e&&_0x293042){this[_0x237c('0x6')](_0x237c('0x7'),moment(_0x293042)[_0x237c('0x8')](moment(_0x1cca9e),_0x237c('0x9')));}return this[_0x237c('0x6')](_0x237c('0xa'),_0x293042);}},'amd':{'type':Sequelize[_0x237c('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x237c('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x237c('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x237c('0x5')]},'callback':{'type':Sequelize[_0x237c('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x237c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x237c('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x237c('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x237c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x237c('0x3')],'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 c14cab0..b4161e4 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 _0x0650=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','sendStatus','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','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','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x2b9896,_0x414ed2){var _0x545895=function(_0x507c60){while(--_0x507c60){_0x2b9896['push'](_0x2b9896['shift']());}};_0x545895(++_0x414ed2);}(_0x0650,0xed));var _0x0065=function(_0x111b29,_0x57139e){_0x111b29=_0x111b29-0x0;var _0x56fe78=_0x0650[_0x111b29];return _0x56fe78;};'use strict';var pdf=require(_0x0065('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0065('0x1'));var zipdir=require(_0x0065('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0065('0x3'));var moment=require('moment');var BPromise=require(_0x0065('0x4'));var Mustache=require(_0x0065('0x5'));var util=require(_0x0065('0x6'));var path=require('path');var sox=require(_0x0065('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0065('0x8'));var crypto=require(_0x0065('0x9'));var jsforce=require(_0x0065('0xa'));var deskjs=require(_0x0065('0xb'));var toCsv=require(_0x0065('0xc'));var querystring=require(_0x0065('0xd'));var Papa=require(_0x0065('0xe'));var Redis=require(_0x0065('0xf'));var authService=require(_0x0065('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0065('0x11'));var hardwareService=require(_0x0065('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0065('0x13'));var db=require(_0x0065('0x14'))['db'];function respondWithStatusCode(_0x5a2cb8,_0x45c7d1){_0x45c7d1=_0x45c7d1||0xcc;return function(_0x4255f6){if(_0x4255f6){return _0x5a2cb8['sendStatus'](_0x45c7d1);}return _0x5a2cb8[_0x0065('0x15')](_0x45c7d1)[_0x0065('0x16')]();};}function respondWithResult(_0x587bb2,_0x5ae653){_0x5ae653=_0x5ae653||0xc8;return function(_0x1b9b1e){if(_0x1b9b1e){return _0x587bb2['status'](_0x5ae653)['json'](_0x1b9b1e);}};}function respondWithFilteredResult(_0x2d29c5,_0x5773d6){return function(_0x38a870){if(_0x38a870){var _0x48d817=_0x38a870[_0x0065('0x17')],_0x391fc1=_0x5773d6[_0x0065('0x18')],_0x262d63=_0x5773d6[_0x0065('0x18')]+_0x5773d6[_0x0065('0x19')],_0x342d6b;if(_0x262d63>=_0x48d817){_0x262d63=_0x48d817;_0x342d6b=0xc8;}else{_0x342d6b=0xce;}_0x2d29c5[_0x0065('0x15')](_0x342d6b);return _0x2d29c5['set'](_0x0065('0x1a'),_0x391fc1+'-'+_0x262d63+'/'+_0x48d817)[_0x0065('0x1b')](_0x38a870);}return null;};}function patchUpdates(_0x49de99){return function(_0x967398){try{jsonpatch[_0x0065('0x1c')](_0x967398,_0x49de99,!![]);}catch(_0x278dff){return BPromise[_0x0065('0x1d')](_0x278dff);}return _0x967398[_0x0065('0x1e')]();};}function saveUpdates(_0x3eee18,_0x319e7a){return function(_0x529e30){if(_0x529e30){return _0x529e30['update'](_0x3eee18)['then'](function(_0x3f7af1){return _0x3f7af1;});}return null;};}function removeEntity(_0x657b,_0x5b60c3){return function(_0x2de3ae){if(_0x2de3ae){return _0x2de3ae['destroy']()[_0x0065('0x1f')](function(){_0x657b[_0x0065('0x15')](0xcc)[_0x0065('0x16')]();});}};}function handleEntityNotFound(_0x376452,_0x161b4c){return function(_0x1efa70){if(!_0x1efa70){_0x376452[_0x0065('0x20')](0x194);}return _0x1efa70;};}function handleError(_0x5d9911,_0x7057d1){_0x7057d1=_0x7057d1||0x1f4;return function(_0x5cb4b0){logger['error'](_0x5cb4b0[_0x0065('0x21')]);if(_0x5cb4b0['name']){delete _0x5cb4b0[_0x0065('0x22')];}_0x5d9911[_0x0065('0x15')](_0x7057d1)['send'](_0x5cb4b0);};}exports[_0x0065('0x23')]=function(_0x5e1829,_0x5542e0){var _0xb1378f={},_0x221be2={},_0x47eede={'count':0x0,'rows':[]};var _0x549fe1=_['map'](db[_0x0065('0x24')][_0x0065('0x25')],function(_0x1a977a){return{'name':_0x1a977a[_0x0065('0x26')],'type':_0x1a977a[_0x0065('0x27')]['key']};});_0x221be2['model']=_['map'](_0x549fe1,_0x0065('0x22'));_0x221be2[_0x0065('0x28')]=_[_0x0065('0x29')](_0x5e1829['query']);_0x221be2[_0x0065('0x2a')]=_[_0x0065('0x2b')](_0x221be2['model'],_0x221be2[_0x0065('0x28')]);_0xb1378f[_0x0065('0x2c')]=_[_0x0065('0x2b')](_0x221be2[_0x0065('0x2d')],qs[_0x0065('0x2e')](_0x5e1829[_0x0065('0x28')][_0x0065('0x2e')]));_0xb1378f[_0x0065('0x2c')]=_0xb1378f['attributes']['length']?_0xb1378f['attributes']:_0x221be2[_0x0065('0x2d')];if(!_0x5e1829[_0x0065('0x28')][_0x0065('0x2f')](_0x0065('0x30'))){_0xb1378f[_0x0065('0x19')]=qs[_0x0065('0x19')](_0x5e1829[_0x0065('0x28')]['limit']);_0xb1378f[_0x0065('0x18')]=qs[_0x0065('0x18')](_0x5e1829[_0x0065('0x28')][_0x0065('0x18')]);}_0xb1378f[_0x0065('0x31')]=qs['sort'](_0x5e1829[_0x0065('0x28')][_0x0065('0x32')]);_0xb1378f[_0x0065('0x33')]=qs[_0x0065('0x2a')](_[_0x0065('0x34')](_0x5e1829[_0x0065('0x28')],_0x221be2[_0x0065('0x2a')]),_0x549fe1);if(_0x5e1829[_0x0065('0x28')][_0x0065('0x35')]){_0xb1378f[_0x0065('0x33')]=_['merge'](_0xb1378f[_0x0065('0x33')],{'$or':_[_0x0065('0x36')](_0x549fe1,function(_0x3e174b){if(_0x3e174b['type']!==_0x0065('0x37')){var _0x9255df={};_0x9255df[_0x3e174b[_0x0065('0x22')]]={'$like':'%'+_0x5e1829[_0x0065('0x28')][_0x0065('0x35')]+'%'};return _0x9255df;}})});}_0xb1378f=_[_0x0065('0x38')]({},_0xb1378f,_0x5e1829['options']);var _0x32e6f={'where':_0xb1378f[_0x0065('0x33')]};return db[_0x0065('0x24')]['count'](_0x32e6f)[_0x0065('0x1f')](function(_0x59409c){_0x47eede[_0x0065('0x17')]=_0x59409c;if(_0x5e1829[_0x0065('0x28')]['includeAll']){_0xb1378f[_0x0065('0x39')]=[{'all':!![]}];}return db[_0x0065('0x24')][_0x0065('0x3a')](_0xb1378f);})[_0x0065('0x1f')](function(_0x44556f){_0x47eede[_0x0065('0x3b')]=_0x44556f;return _0x47eede;})['then'](respondWithFilteredResult(_0x5542e0,_0xb1378f))[_0x0065('0x3c')](handleError(_0x5542e0,null));};exports[_0x0065('0x3d')]=function(_0x145336,_0x1b8f52){var _0x1d251d={'raw':!![],'where':{'id':_0x145336[_0x0065('0x3e')]['id']}},_0x1b516c={};_0x1b516c[_0x0065('0x2d')]=_[_0x0065('0x29')](db[_0x0065('0x24')][_0x0065('0x25')]);_0x1b516c[_0x0065('0x28')]=_[_0x0065('0x29')](_0x145336[_0x0065('0x28')]);_0x1b516c[_0x0065('0x2a')]=_[_0x0065('0x2b')](_0x1b516c[_0x0065('0x2d')],_0x1b516c[_0x0065('0x28')]);_0x1d251d[_0x0065('0x2c')]=_[_0x0065('0x2b')](_0x1b516c[_0x0065('0x2d')],qs[_0x0065('0x2e')](_0x145336[_0x0065('0x28')]['fields']));_0x1d251d[_0x0065('0x2c')]=_0x1d251d['attributes'][_0x0065('0x3f')]?_0x1d251d['attributes']:_0x1b516c[_0x0065('0x2d')];if(_0x145336['query'][_0x0065('0x40')]){_0x1d251d[_0x0065('0x39')]=[{'all':!![]}];}_0x1d251d=_[_0x0065('0x38')]({},_0x1d251d,_0x145336['options']);return db['CmHopperFinal'][_0x0065('0x41')](_0x1d251d)[_0x0065('0x1f')](handleEntityNotFound(_0x1b8f52,null))[_0x0065('0x1f')](respondWithResult(_0x1b8f52,null))[_0x0065('0x3c')](handleError(_0x1b8f52,null));};exports['describe']=function(_0x1d9807,_0x132af6){return db[_0x0065('0x24')][_0x0065('0x42')]()[_0x0065('0x1f')](respondWithResult(_0x132af6,null))['catch'](handleError(_0x132af6,null));};exports[_0x0065('0x43')]=function(_0x5ef382,_0x339730){if(_0x5ef382[_0x0065('0x44')][_0x0065('0x45')]){delete _0x5ef382[_0x0065('0x44')]['uniqueid'];}return db[_0x0065('0x24')]['find']({'where':{'uniqueid':_0x5ef382[_0x0065('0x3e')]['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x339730,null))[_0x0065('0x1f')](saveUpdates(_0x5ef382[_0x0065('0x44')],null))[_0x0065('0x1f')](respondWithResult(_0x339730,null))[_0x0065('0x3c')](handleError(_0x339730,null));};exports[_0x0065('0x46')]=function(_0x1ca888,_0x3fd610,_0x42d53f){return db[_0x0065('0x24')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x1ca888[_0x0065('0x3e')]['id']},'attributes':[[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4a')))),'noSuchContacts'],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4b')))),_0x0065('0x4c')],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4d')))),_0x0065('0x4e')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db['sequelize'][_0x0065('0x49')](_0x0065('0x4f')))),_0x0065('0x50')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0065('0x51')],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0065('0x52')],[db['sequelize']['fn'](_0x0065('0x48'),db['sequelize']['fn']('IF',db[_0x0065('0x47')]['literal'](_0x0065('0x53')))),_0x0065('0x54')],[db['sequelize']['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),_0x0065('0x55')]]})[_0x0065('0x1f')](handleEntityNotFound(_0x3fd610,null))['then'](respondWithResult(_0x3fd610,null))['catch'](handleError(_0x3fd610,null));};exports[_0x0065('0x56')]=function(_0x2a6f28,_0x1ac140,_0x55ded6){return db[_0x0065('0x24')]['findAll']({'raw':![],'where':{'CampaignId':_0x2a6f28[_0x0065('0x3e')]['id']},'attributes':[[db[_0x0065('0x47')]['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4a')))),'noSuchContacts'],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db['sequelize']['literal'](_0x0065('0x4b')))),_0x0065('0x4c')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x0065('0x4e')],[db[_0x0065('0x47')]['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')]['literal'](_0x0065('0x4f')))),_0x0065('0x50')],[db[_0x0065('0x47')]['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x57')))),_0x0065('0x51')],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x0065('0x49')](_0x0065('0x58')))),_0x0065('0x52')],[db[_0x0065('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x0065('0x49')](_0x0065('0x53')))),_0x0065('0x54')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')]['literal'](_0x0065('0x59')))),_0x0065('0x55')]]})[_0x0065('0x1f')](handleEntityNotFound(_0x1ac140,null))['then'](respondWithResult(_0x1ac140,null))[_0x0065('0x3c')](handleError(_0x1ac140,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x10c177,_0x3af42f,_0xdf4d8e){return db[_0x0065('0x5a')][_0x0065('0x41')]({'where':{'id':_0x10c177[_0x0065('0x3e')]['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x3af42f,null))[_0x0065('0x1f')](function(_0x93842){var _0x23de06;if(_0x93842){_0x23de06=squel['insert']()[_0x0065('0x5b')](_0x0065('0x5c'))[_0x0065('0x5d')]([_0x0065('0x5e'),_0x0065('0x5f'),'ContactId',_0x0065('0x60'),_0x0065('0x61'),_0x0065('0x62'),_0x0065('0x63')],squel[_0x0065('0x64')]()['field'](_0x0065('0x65'),'phone')[_0x0065('0x66')](_0x0065('0x67'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x0065('0x68'))[_0x0065('0x66')](_0x0065('0x69'),'ListId')[_0x0065('0x66')](_0x0065('0x6a'),'VoiceQueueId')[_0x0065('0x66')](_0x0065('0x67'),_0x0065('0x62'))['field']('NOW()',_0x0065('0x63'))['from'](_0x0065('0x6b'))[_0x0065('0x33')](_0x0065('0x6c'),_0x10c177[_0x0065('0x3e')]['id'][_0x0065('0x6d')]())['where'](_0x0065('0x6e'),_0x10c177['body'][_0x0065('0x6f')][_0x0065('0x6d')]())[_0x0065('0x33')](_0x0065('0x70'))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()['field'](_0x0065('0x5e'))[_0x0065('0x72')](_0x0065('0x5c'))[_0x0065('0x33')](_0x0065('0x6c'),_0x10c177[_0x0065('0x3e')]['id'][_0x0065('0x6d')]()))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()['field'](_0x0065('0x73'))[_0x0065('0x72')](_0x0065('0x6b'))[_0x0065('0x33')](_0x0065('0x6c'),_0x10c177[_0x0065('0x3e')]['id']['toString']())['where'](_0x0065('0x74')))['group'](_0x0065('0x68')))[_0x0065('0x6d')]();return db[_0x0065('0x47')][_0x0065('0x28')](_0x23de06);}return[];})[_0x0065('0x1f')](respondWithResult(_0x3af42f,null))[_0x0065('0x3c')](handleError(_0x3af42f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1f4cf5,_0x28b02e,_0x15dc88){return db[_0x0065('0x75')][_0x0065('0x41')]({'where':{'id':_0x1f4cf5['params']['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x28b02e,null))[_0x0065('0x1f')](function(_0x5c43b9){var _0x1f8848;if(_0x5c43b9){_0x1f8848=squel['insert']()[_0x0065('0x5b')](_0x0065('0x5c'))[_0x0065('0x5d')](['phone',_0x0065('0x5f'),_0x0065('0x68'),'ListId',_0x0065('0x76'),_0x0065('0x62'),'updatedAt'],squel[_0x0065('0x64')]()['field'](_0x0065('0x65'),'phone')[_0x0065('0x66')](_0x0065('0x67'),_0x0065('0x5f'))['field'](_0x0065('0x77'),_0x0065('0x68'))[_0x0065('0x66')](_0x0065('0x69'),_0x0065('0x60'))[_0x0065('0x66')](_0x0065('0x78'),_0x0065('0x76'))[_0x0065('0x66')](_0x0065('0x67'),_0x0065('0x62'))[_0x0065('0x66')](_0x0065('0x67'),'updatedAt')[_0x0065('0x72')](_0x0065('0x6b'))[_0x0065('0x33')]('CampaignId\x20=\x20?',_0x1f4cf5[_0x0065('0x3e')]['id'][_0x0065('0x6d')]())[_0x0065('0x33')](_0x0065('0x6e'),_0x1f4cf5[_0x0065('0x44')][_0x0065('0x6f')][_0x0065('0x6d')]())[_0x0065('0x33')](_0x0065('0x70'))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()[_0x0065('0x66')](_0x0065('0x5e'))[_0x0065('0x72')](_0x0065('0x5c'))[_0x0065('0x33')](_0x0065('0x79'),_0x1f4cf5['params']['id'][_0x0065('0x6d')]()))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()[_0x0065('0x66')](_0x0065('0x73'))[_0x0065('0x72')](_0x0065('0x6b'))['where'](_0x0065('0x79'),_0x1f4cf5['params']['id'][_0x0065('0x6d')]())['where'](_0x0065('0x74')))[_0x0065('0x7a')](_0x0065('0x68')))['toString']();return db[_0x0065('0x47')][_0x0065('0x28')](_0x1f8848);}return[];})[_0x0065('0x1f')](respondWithResult(_0x28b02e,null))[_0x0065('0x3c')](handleError(_0x28b02e,null));};exports[_0x0065('0x7b')]=function(_0x11fa10,_0x34c727,_0x325a5){return db[_0x0065('0x7c')]['findOne']({'where':{'VoiceQueueId':_0x11fa10[_0x0065('0x44')][_0x0065('0x61')],'CampaignId':_0x11fa10[_0x0065('0x44')][_0x0065('0x76')],'ContactId':_0x11fa10['body']['ContactId']}})[_0x0065('0x1f')](handleEntityNotFound(_0x34c727,null))[_0x0065('0x1f')](function(_0x1e23fe){if(_0x1e23fe){return _0x1e23fe;}return null;})[_0x0065('0x1f')](respondWithResult(_0x34c727,null))['catch'](handleError(_0x34c727,null));}; \ No newline at end of file +var _0x5ed9=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','key','keys','attributes','intersection','model','fields','query','length','nolimit','offset','filters','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','catch','show','params','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','VoiceQueue','find','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x352797,_0x25947f){var _0x46bb5e=function(_0x2721e5){while(--_0x2721e5){_0x352797['push'](_0x352797['shift']());}};_0x46bb5e(++_0x25947f);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5ed9[_0x36eaaa];return _0x461349;};'use strict';var pdf=require(_0x95ed('0x0'));var emlformat=require(_0x95ed('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x95ed('0x2'));var jsonpatch=require(_0x95ed('0x3'));var rp=require(_0x95ed('0x4'));var moment=require(_0x95ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95ed('0x6'));var util=require(_0x95ed('0x7'));var path=require(_0x95ed('0x8'));var sox=require('sox');var csv=require(_0x95ed('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x95ed('0xa'));var squel=require(_0x95ed('0xb'));var crypto=require(_0x95ed('0xc'));var jsforce=require(_0x95ed('0xd'));var deskjs=require(_0x95ed('0xe'));var toCsv=require(_0x95ed('0x9'));var querystring=require('querystring');var Papa=require(_0x95ed('0xf'));var Redis=require(_0x95ed('0x10'));var authService=require(_0x95ed('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x95ed('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ed('0x13'))(_0x95ed('0x14'));var utils=require(_0x95ed('0x15'));var config=require(_0x95ed('0x16'));var db=require(_0x95ed('0x17'))['db'];function respondWithStatusCode(_0x5bccde,_0x5e4571){_0x5e4571=_0x5e4571||0xcc;return function(_0x3da05b){if(_0x3da05b){return _0x5bccde[_0x95ed('0x18')](_0x5e4571);}return _0x5bccde['status'](_0x5e4571)['end']();};}function respondWithResult(_0x2782a5,_0x11671d){_0x11671d=_0x11671d||0xc8;return function(_0x22211f){if(_0x22211f){return _0x2782a5[_0x95ed('0x19')](_0x11671d)['json'](_0x22211f);}};}function respondWithFilteredResult(_0x213355,_0xd3fe73){return function(_0x477b8f){if(_0x477b8f){var _0x597a04=_0x477b8f['count'],_0x5fc6b5=_0xd3fe73['offset'],_0x554c6a=_0xd3fe73['offset']+_0xd3fe73[_0x95ed('0x1a')],_0x23c63f;if(_0x554c6a>=_0x597a04){_0x554c6a=_0x597a04;_0x23c63f=0xc8;}else{_0x23c63f=0xce;}_0x213355['status'](_0x23c63f);return _0x213355[_0x95ed('0x1b')](_0x95ed('0x1c'),_0x5fc6b5+'-'+_0x554c6a+'/'+_0x597a04)['json'](_0x477b8f);}return null;};}function patchUpdates(_0xa5a91){return function(_0x3e9d1e){try{jsonpatch[_0x95ed('0x1d')](_0x3e9d1e,_0xa5a91,!![]);}catch(_0x2a8dc3){return BPromise[_0x95ed('0x1e')](_0x2a8dc3);}return _0x3e9d1e[_0x95ed('0x1f')]();};}function saveUpdates(_0x2d427e,_0x3e05cf){return function(_0x10823b){if(_0x10823b){return _0x10823b[_0x95ed('0x20')](_0x2d427e)['then'](function(_0xd798ec){return _0xd798ec;});}return null;};}function removeEntity(_0x390d09,_0x4e8a5d){return function(_0x5d5afe){if(_0x5d5afe){return _0x5d5afe['destroy']()[_0x95ed('0x21')](function(){_0x390d09[_0x95ed('0x19')](0xcc)[_0x95ed('0x22')]();});}};}function handleEntityNotFound(_0x61d85e,_0x2c0824){return function(_0x19b664){if(!_0x19b664){_0x61d85e[_0x95ed('0x18')](0x194);}return _0x19b664;};}function handleError(_0x416d23,_0x146f74){_0x146f74=_0x146f74||0x1f4;return function(_0x3bcb6d){logger[_0x95ed('0x23')](_0x3bcb6d[_0x95ed('0x24')]);if(_0x3bcb6d[_0x95ed('0x25')]){delete _0x3bcb6d[_0x95ed('0x25')];}_0x416d23['status'](_0x146f74)[_0x95ed('0x26')](_0x3bcb6d);};}exports['index']=function(_0x4c7a2d,_0x2f515d){var _0x2d6df0={},_0x45e403={},_0x3096ad={'count':0x0,'rows':[]};var _0x2d5042=_[_0x95ed('0x27')](db[_0x95ed('0x28')][_0x95ed('0x29')],function(_0x39330d){return{'name':_0x39330d[_0x95ed('0x2a')],'type':_0x39330d[_0x95ed('0x2b')][_0x95ed('0x2c')]};});_0x45e403['model']=_[_0x95ed('0x27')](_0x2d5042,_0x95ed('0x25'));_0x45e403['query']=_[_0x95ed('0x2d')](_0x4c7a2d['query']);_0x45e403['filters']=_['intersection'](_0x45e403['model'],_0x45e403['query']);_0x2d6df0[_0x95ed('0x2e')]=_[_0x95ed('0x2f')](_0x45e403[_0x95ed('0x30')],qs[_0x95ed('0x31')](_0x4c7a2d[_0x95ed('0x32')][_0x95ed('0x31')]));_0x2d6df0[_0x95ed('0x2e')]=_0x2d6df0['attributes'][_0x95ed('0x33')]?_0x2d6df0[_0x95ed('0x2e')]:_0x45e403[_0x95ed('0x30')];if(!_0x4c7a2d['query']['hasOwnProperty'](_0x95ed('0x34'))){_0x2d6df0['limit']=qs['limit'](_0x4c7a2d['query']['limit']);_0x2d6df0[_0x95ed('0x35')]=qs['offset'](_0x4c7a2d[_0x95ed('0x32')][_0x95ed('0x35')]);}_0x2d6df0['order']=qs['sort'](_0x4c7a2d['query']['sort']);_0x2d6df0['where']=qs[_0x95ed('0x36')](_[_0x95ed('0x37')](_0x4c7a2d[_0x95ed('0x32')],_0x45e403[_0x95ed('0x36')]),_0x2d5042);if(_0x4c7a2d[_0x95ed('0x32')][_0x95ed('0x38')]){_0x2d6df0['where']=_[_0x95ed('0x39')](_0x2d6df0[_0x95ed('0x3a')],{'$or':_[_0x95ed('0x27')](_0x2d5042,function(_0x5218a3){if(_0x5218a3[_0x95ed('0x2b')]!==_0x95ed('0x3b')){var _0x355623={};_0x355623[_0x5218a3[_0x95ed('0x25')]]={'$like':'%'+_0x4c7a2d[_0x95ed('0x32')][_0x95ed('0x38')]+'%'};return _0x355623;}})});}_0x2d6df0=_[_0x95ed('0x39')]({},_0x2d6df0,_0x4c7a2d[_0x95ed('0x3c')]);var _0x4f9306={'where':_0x2d6df0['where']};return db['CmHopperFinal'][_0x95ed('0x3d')](_0x4f9306)[_0x95ed('0x21')](function(_0x237e8b){_0x3096ad[_0x95ed('0x3d')]=_0x237e8b;if(_0x4c7a2d[_0x95ed('0x32')][_0x95ed('0x3e')]){_0x2d6df0['include']=[{'all':!![]}];}return db[_0x95ed('0x28')][_0x95ed('0x3f')](_0x2d6df0);})[_0x95ed('0x21')](function(_0x5aeb8b){_0x3096ad['rows']=_0x5aeb8b;return _0x3096ad;})[_0x95ed('0x21')](respondWithFilteredResult(_0x2f515d,_0x2d6df0))[_0x95ed('0x40')](handleError(_0x2f515d,null));};exports[_0x95ed('0x41')]=function(_0x3a81df,_0x3754a7){var _0x5c4c54={'raw':!![],'where':{'id':_0x3a81df[_0x95ed('0x42')]['id']}},_0x5c068f={};_0x5c068f[_0x95ed('0x30')]=_[_0x95ed('0x2d')](db[_0x95ed('0x28')]['rawAttributes']);_0x5c068f[_0x95ed('0x32')]=_['keys'](_0x3a81df[_0x95ed('0x32')]);_0x5c068f[_0x95ed('0x36')]=_[_0x95ed('0x2f')](_0x5c068f['model'],_0x5c068f[_0x95ed('0x32')]);_0x5c4c54[_0x95ed('0x2e')]=_[_0x95ed('0x2f')](_0x5c068f['model'],qs['fields'](_0x3a81df[_0x95ed('0x32')]['fields']));_0x5c4c54[_0x95ed('0x2e')]=_0x5c4c54['attributes'][_0x95ed('0x33')]?_0x5c4c54[_0x95ed('0x2e')]:_0x5c068f[_0x95ed('0x30')];if(_0x3a81df[_0x95ed('0x32')][_0x95ed('0x3e')]){_0x5c4c54['include']=[{'all':!![]}];}_0x5c4c54=_[_0x95ed('0x39')]({},_0x5c4c54,_0x3a81df[_0x95ed('0x3c')]);return db[_0x95ed('0x28')]['find'](_0x5c4c54)[_0x95ed('0x21')](handleEntityNotFound(_0x3754a7,null))['then'](respondWithResult(_0x3754a7,null))[_0x95ed('0x40')](handleError(_0x3754a7,null));};exports[_0x95ed('0x43')]=function(_0x5f2444,_0x34e5e4){return db[_0x95ed('0x28')]['describe']()['then'](respondWithResult(_0x34e5e4,null))[_0x95ed('0x40')](handleError(_0x34e5e4,null));};exports['update']=function(_0x257a23,_0x5288e6){if(_0x257a23[_0x95ed('0x44')][_0x95ed('0x45')]){delete _0x257a23[_0x95ed('0x44')][_0x95ed('0x45')];}return db[_0x95ed('0x28')]['find']({'where':{'uniqueid':_0x257a23[_0x95ed('0x42')]['id']}})[_0x95ed('0x21')](handleEntityNotFound(_0x5288e6,null))[_0x95ed('0x21')](saveUpdates(_0x257a23[_0x95ed('0x44')],null))[_0x95ed('0x21')](respondWithResult(_0x5288e6,null))[_0x95ed('0x40')](handleError(_0x5288e6,null));};exports[_0x95ed('0x46')]=function(_0x26cd04,_0x485ab9,_0x3a77b0){return db[_0x95ed('0x28')][_0x95ed('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x26cd04[_0x95ed('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db['sequelize'][_0x95ed('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x95ed('0x4a')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x95ed('0x48')]['fn']('COUNT',db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')]['literal'](_0x95ed('0x4b')))),_0x95ed('0x4c')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x95ed('0x4d')))),_0x95ed('0x4e')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')]['literal'](_0x95ed('0x4f')))),_0x95ed('0x50')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db['sequelize']['literal'](_0x95ed('0x51')))),_0x95ed('0x52')],[db['sequelize']['fn']('COUNT',db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x95ed('0x47'),db['sequelize']['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')](_0x95ed('0x53')))),'answeringMachine']]})[_0x95ed('0x21')](handleEntityNotFound(_0x485ab9,null))[_0x95ed('0x21')](respondWithResult(_0x485ab9,null))[_0x95ed('0x40')](handleError(_0x485ab9,null));};exports[_0x95ed('0x54')]=function(_0x3e5925,_0x12a7b0,_0x2203c0){return db['CmHopperFinal'][_0x95ed('0x3f')]({'raw':![],'where':{'CampaignId':_0x3e5925[_0x95ed('0x42')]['id']},'attributes':[[db[_0x95ed('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x95ed('0x48')]['literal'](_0x95ed('0x55')))),_0x95ed('0x4a')],[db[_0x95ed('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')](_0x95ed('0x56')))),_0x95ed('0x57')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')](_0x95ed('0x4b')))),_0x95ed('0x4c')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x95ed('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x95ed('0x4e')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')](_0x95ed('0x4f')))),_0x95ed('0x50')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db['sequelize'][_0x95ed('0x49')](_0x95ed('0x51')))),_0x95ed('0x52')],[db[_0x95ed('0x48')]['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x95ed('0x47'),db[_0x95ed('0x48')]['fn']('IF',db[_0x95ed('0x48')][_0x95ed('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x95ed('0x21')](handleEntityNotFound(_0x12a7b0,null))['then'](respondWithResult(_0x12a7b0,null))[_0x95ed('0x40')](handleError(_0x12a7b0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4c858f,_0x95e046,_0x2ebbc8){return db[_0x95ed('0x58')][_0x95ed('0x59')]({'where':{'id':_0x4c858f[_0x95ed('0x42')]['id']}})[_0x95ed('0x21')](handleEntityNotFound(_0x95e046,null))[_0x95ed('0x21')](function(_0x36e7e2){var _0x339a9a;if(_0x36e7e2){_0x339a9a=squel[_0x95ed('0x5a')]()[_0x95ed('0x5b')](_0x95ed('0x5c'))[_0x95ed('0x5d')](['phone',_0x95ed('0x5e'),_0x95ed('0x5f'),_0x95ed('0x60'),_0x95ed('0x61'),_0x95ed('0x62'),_0x95ed('0x63')],squel['select']()[_0x95ed('0x64')](_0x95ed('0x65'),_0x95ed('0x66'))['field'](_0x95ed('0x67'),_0x95ed('0x5e'))[_0x95ed('0x64')](_0x95ed('0x68'),_0x95ed('0x5f'))[_0x95ed('0x64')]('ANY_VALUE(ListId)',_0x95ed('0x60'))['field'](_0x95ed('0x69'),_0x95ed('0x61'))['field'](_0x95ed('0x67'),'createdAt')[_0x95ed('0x64')]('NOW()','updatedAt')[_0x95ed('0x6a')](_0x95ed('0x6b'))[_0x95ed('0x3a')](_0x95ed('0x6c'),_0x4c858f[_0x95ed('0x42')]['id'][_0x95ed('0x6d')]())[_0x95ed('0x3a')](_0x95ed('0x6e'),_0x4c858f[_0x95ed('0x44')][_0x95ed('0x6f')][_0x95ed('0x6d')]())[_0x95ed('0x3a')](_0x95ed('0x70'))[_0x95ed('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x95ed('0x71')]()['field']('phone')[_0x95ed('0x6a')](_0x95ed('0x5c'))['where']('VoiceQueueId\x20=\x20?',_0x4c858f[_0x95ed('0x42')]['id'][_0x95ed('0x6d')]()))[_0x95ed('0x3a')](_0x95ed('0x72'),squel[_0x95ed('0x71')]()[_0x95ed('0x64')]('calleridnum')['from']('cm_hopper_final')[_0x95ed('0x3a')]('VoiceQueueId\x20=\x20?',_0x4c858f['params']['id'][_0x95ed('0x6d')]())[_0x95ed('0x3a')](_0x95ed('0x73')))[_0x95ed('0x74')](_0x95ed('0x5f')))[_0x95ed('0x6d')]();return db[_0x95ed('0x48')][_0x95ed('0x32')](_0x339a9a);}return[];})[_0x95ed('0x21')](respondWithResult(_0x95e046,null))[_0x95ed('0x40')](handleError(_0x95e046,null));};exports[_0x95ed('0x75')]=function(_0x528258,_0x9319af,_0x2df4f7){return db[_0x95ed('0x76')][_0x95ed('0x59')]({'where':{'id':_0x528258[_0x95ed('0x42')]['id']}})[_0x95ed('0x21')](handleEntityNotFound(_0x9319af,null))[_0x95ed('0x21')](function(_0x45caec){var _0x598291;if(_0x45caec){_0x598291=squel[_0x95ed('0x5a')]()[_0x95ed('0x5b')](_0x95ed('0x5c'))[_0x95ed('0x5d')]([_0x95ed('0x66'),_0x95ed('0x5e'),_0x95ed('0x5f'),_0x95ed('0x60'),_0x95ed('0x77'),_0x95ed('0x62'),_0x95ed('0x63')],squel['select']()[_0x95ed('0x64')](_0x95ed('0x65'),_0x95ed('0x66'))[_0x95ed('0x64')](_0x95ed('0x67'),'scheduledAt')[_0x95ed('0x64')](_0x95ed('0x68'),_0x95ed('0x5f'))[_0x95ed('0x64')](_0x95ed('0x78'),_0x95ed('0x60'))[_0x95ed('0x64')](_0x95ed('0x79'),_0x95ed('0x77'))[_0x95ed('0x64')]('NOW()',_0x95ed('0x62'))[_0x95ed('0x64')](_0x95ed('0x67'),_0x95ed('0x63'))[_0x95ed('0x6a')](_0x95ed('0x6b'))[_0x95ed('0x3a')](_0x95ed('0x7a'),_0x528258[_0x95ed('0x42')]['id'][_0x95ed('0x6d')]())[_0x95ed('0x3a')](_0x95ed('0x6e'),_0x528258['body']['state']['toString']())['where'](_0x95ed('0x70'))[_0x95ed('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x95ed('0x64')](_0x95ed('0x66'))[_0x95ed('0x6a')]('cm_hopper')['where'](_0x95ed('0x7a'),_0x528258['params']['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x95ed('0x71')]()[_0x95ed('0x64')](_0x95ed('0x7b'))[_0x95ed('0x6a')](_0x95ed('0x6b'))['where']('CampaignId\x20=\x20?',_0x528258['params']['id'][_0x95ed('0x6d')]())['where'](_0x95ed('0x73')))[_0x95ed('0x74')]('ContactId'))[_0x95ed('0x6d')]();return db[_0x95ed('0x48')][_0x95ed('0x32')](_0x598291);}return[];})[_0x95ed('0x21')](respondWithResult(_0x9319af,null))[_0x95ed('0x40')](handleError(_0x9319af,null));};exports[_0x95ed('0x7c')]=function(_0xe508b5,_0x52d165,_0x1f496e){return db[_0x95ed('0x7d')][_0x95ed('0x7e')]({'where':{'VoiceQueueId':_0xe508b5[_0x95ed('0x44')][_0x95ed('0x61')],'CampaignId':_0xe508b5['body'][_0x95ed('0x77')],'ContactId':_0xe508b5['body']['ContactId']}})[_0x95ed('0x21')](handleEntityNotFound(_0x52d165,null))[_0x95ed('0x21')](function(_0x559250){if(_0x559250){return _0x559250;}return null;})[_0x95ed('0x21')](respondWithResult(_0x52d165,null))[_0x95ed('0x40')](handleError(_0x52d165,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index adca11d..32c051a 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 _0x3140=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x3140,0xaf));var _0x0314=function(_0x27472b,_0x1e5ca1){_0x27472b=_0x27472b-0x0;var _0x249243=_0x3140[_0x27472b];return _0x249243;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var logger=require(_0x0314('0x2'))(_0x0314('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0314('0x4'));var fs=require('fs');var path=require(_0x0314('0x5'));var rimraf=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var attributes=require(_0x0314('0x8'));module[_0x0314('0x9')]=function(_0x9e308d,_0xf87d26){return _0x9e308d[_0x0314('0xa')](_0x0314('0xb'),attributes,{'tableName':_0x0314('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x0314('0xd')]},{'name':_0x0314('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x07c3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x07c3,0x1bf));var _0x307c=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x07c3[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var logger=require(_0x307c('0x2'))(_0x307c('0x3'));var moment=require(_0x307c('0x4'));var BPromise=require(_0x307c('0x5'));var rp=require(_0x307c('0x6'));var fs=require('fs');var path=require(_0x307c('0x7'));var rimraf=require('rimraf');var config=require(_0x307c('0x8'));var attributes=require(_0x307c('0x9'));module[_0x307c('0xa')]=function(_0x317066,_0x250f22){return _0x317066[_0x307c('0xb')](_0x307c('0xc'),attributes,{'tableName':_0x307c('0xd'),'paranoid':![],'indexes':[{'name':_0x307c('0xe'),'fields':[_0x307c('0xe')]},{'name':_0x307c('0xf'),'fields':[_0x307c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e893b57..70ecd52 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 _0xabfc=['CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','body','options','then','debug','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0xabfc,0x194));var _0xcabf=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xabfc[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0xcabf('0x0'));var util=require(_0xcabf('0x1'));var moment=require(_0xcabf('0x2'));var BPromise=require(_0xcabf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcabf('0x4'));var logger=require('../../config/logger')(_0xcabf('0x5'));var config=require(_0xcabf('0x6'));var jayson=require(_0xcabf('0x7'));var client=jayson[_0xcabf('0x8')][_0xcabf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa50cf2,_0x1e07de,_0x3c8b61){return new BPromise(function(_0x2fcca9,_0x4b39d9){return client[_0xcabf('0xa')](_0xa50cf2,_0x3c8b61)['then'](function(_0x3551d4){logger[_0xcabf('0xb')](_0xcabf('0xc'),_0x1e07de,_0xcabf('0xd'));logger['debug'](_0xcabf('0xe'),_0x1e07de,'request\x20sent',JSON[_0xcabf('0xf')](_0x3551d4));if(_0x3551d4['error']){if(_0x3551d4[_0xcabf('0x10')]['code']===0x1f4){logger[_0xcabf('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x1e07de,_0x3551d4[_0xcabf('0x10')][_0xcabf('0x11')]);return _0x4b39d9(_0x3551d4[_0xcabf('0x10')][_0xcabf('0x11')]);}logger[_0xcabf('0x10')](_0xcabf('0xc'),_0x1e07de,_0x3551d4[_0xcabf('0x10')]['message']);return _0x2fcca9(_0x3551d4[_0xcabf('0x10')]['message']);}else{logger['info'](_0xcabf('0xc'),_0x1e07de,_0xcabf('0xd'));_0x2fcca9(_0x3551d4[_0xcabf('0x12')][_0xcabf('0x11')]);}})['catch'](function(_0x3d0dc9){logger[_0xcabf('0x10')](_0xcabf('0xc'),_0x1e07de,_0x3d0dc9);_0x4b39d9(_0x3d0dc9);});});}exports[_0xcabf('0x13')]=function(_0x52b50d){var _0x4b4b36=this;return new Promise(function(_0x21934a,_0x1f2b61){return db[_0xcabf('0x14')][_0xcabf('0x15')](_0x52b50d[_0xcabf('0x16')],{'raw':_0x52b50d[_0xcabf('0x17')]?_0x52b50d[_0xcabf('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xcabf('0x18')](function(_0x325c0e){logger['info'](_0xcabf('0x13'),_0x52b50d);logger[_0xcabf('0x19')](_0xcabf('0x13'),_0x52b50d,JSON[_0xcabf('0xf')](_0x325c0e));_0x21934a(_0x325c0e);})['catch'](function(_0x15eaff){logger[_0xcabf('0x10')](_0xcabf('0x13'),_0x15eaff[_0xcabf('0x11')],_0x52b50d);_0x1f2b61(_0x4b4b36[_0xcabf('0x10')](0x1f4,_0x15eaff['message']));});});}; \ No newline at end of file +var _0x83f3=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CmHopperFinal','create','options','raw','then','CreateCmHopperFinal','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x434807,_0x5509c3){var _0x26793a=function(_0x2ff9ee){while(--_0x2ff9ee){_0x434807['push'](_0x434807['shift']());}};_0x26793a(++_0x5509c3);}(_0x83f3,0xed));var _0x383f=function(_0x5d5f8d,_0x32f2a0){_0x5d5f8d=_0x5d5f8d-0x0;var _0x240e57=_0x83f3[_0x5d5f8d];return _0x240e57;};'use strict';var _=require(_0x383f('0x0'));var util=require(_0x383f('0x1'));var moment=require(_0x383f('0x2'));var BPromise=require(_0x383f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x383f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x383f('0x5'));var logger=require(_0x383f('0x6'))(_0x383f('0x7'));var config=require(_0x383f('0x8'));var jayson=require(_0x383f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea054,_0x1d211b,_0x3a53a1){return new BPromise(function(_0x3af8d7,_0x5b2006){return client[_0x383f('0xa')](_0x2ea054,_0x3a53a1)['then'](function(_0x400523){logger[_0x383f('0xb')](_0x383f('0xc'),_0x1d211b,_0x383f('0xd'));logger[_0x383f('0xe')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x1d211b,'request\x20sent',JSON[_0x383f('0xf')](_0x400523));if(_0x400523[_0x383f('0x10')]){if(_0x400523[_0x383f('0x10')][_0x383f('0x11')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x1d211b,_0x400523[_0x383f('0x10')][_0x383f('0x12')]);return _0x5b2006(_0x400523['error']['message']);}logger[_0x383f('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x1d211b,_0x400523[_0x383f('0x10')]['message']);return _0x3af8d7(_0x400523[_0x383f('0x10')][_0x383f('0x12')]);}else{logger[_0x383f('0xb')](_0x383f('0xc'),_0x1d211b,'request\x20sent');_0x3af8d7(_0x400523[_0x383f('0x13')][_0x383f('0x12')]);}})[_0x383f('0x14')](function(_0x2fa978){logger[_0x383f('0x10')](_0x383f('0xc'),_0x1d211b,_0x2fa978);_0x5b2006(_0x2fa978);});});}exports['CreateCmHopperFinal']=function(_0x252e29){var _0x1a54b5=this;return new Promise(function(_0x1cb81b,_0x4c1322){return db[_0x383f('0x15')][_0x383f('0x16')](_0x252e29['body'],{'raw':_0x252e29[_0x383f('0x17')]?_0x252e29['options'][_0x383f('0x18')]===undefined?!![]:![]:!![]})[_0x383f('0x19')](function(_0x4b8ff6){logger['info'](_0x383f('0x1a'),_0x252e29);logger['debug'](_0x383f('0x1a'),_0x252e29,JSON[_0x383f('0xf')](_0x4b8ff6));_0x1cb81b(_0x4b8ff6);})[_0x383f('0x14')](function(_0x259b4a){logger['error'](_0x383f('0x1a'),_0x259b4a[_0x383f('0x12')],_0x252e29);_0x4c1322(_0x1a54b5['error'](0x1f4,_0x259b4a[_0x383f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 4f02e01..3479278 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 _0xd0a8=['/checkContactHopper','put','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal'];(function(_0x405a1f,_0x446aa3){var _0x4fd010=function(_0xc2ed83){while(--_0xc2ed83){_0x405a1f['push'](_0x405a1f['shift']());}};_0x4fd010(++_0x446aa3);}(_0xd0a8,0xe9));var _0x8d0a=function(_0x3d7a72,_0x576fcd){_0x3d7a72=_0x3d7a72-0x0;var _0x47aa1d=_0xd0a8[_0x3d7a72];return _0x47aa1d;};'use strict';var multer=require(_0x8d0a('0x0'));var util=require('util');var path=require(_0x8d0a('0x1'));var timeout=require(_0x8d0a('0x2'));var express=require(_0x8d0a('0x3'));var router=express[_0x8d0a('0x4')]();var auth=require(_0x8d0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d0a('0x6'));var controller=require(_0x8d0a('0x7'));router['get']('/',auth[_0x8d0a('0x8')](),controller['index']);router[_0x8d0a('0x9')](_0x8d0a('0xa'),auth[_0x8d0a('0x8')](),controller['describe']);router[_0x8d0a('0x9')](_0x8d0a('0xb'),auth[_0x8d0a('0x8')](),controller[_0x8d0a('0xc')]);router['get'](_0x8d0a('0xd'),auth[_0x8d0a('0x8')](),controller[_0x8d0a('0xe')]);router[_0x8d0a('0x9')](_0x8d0a('0xf'),auth[_0x8d0a('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x8d0a('0x10')]('/voice/queue/moveContacts/:id',auth[_0x8d0a('0x8')](),controller[_0x8d0a('0x11')]);router[_0x8d0a('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x8d0a('0x8')](),controller[_0x8d0a('0x12')]);router[_0x8d0a('0x10')](_0x8d0a('0x13'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x8d0a('0x14')](_0x8d0a('0xb'),auth[_0x8d0a('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x09ba=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','countContactsQueueCampaignHopperFinal'];(function(_0xfbb69e,_0x1c65dd){var _0x31666f=function(_0x344c9f){while(--_0x344c9f){_0xfbb69e['push'](_0xfbb69e['shift']());}};_0x31666f(++_0x1c65dd);}(_0x09ba,0xa6));var _0xa09b=function(_0xbb6da2,_0x24614b){_0xbb6da2=_0xbb6da2-0x0;var _0x2a84f5=_0x09ba[_0xbb6da2];return _0x2a84f5;};'use strict';var multer=require(_0xa09b('0x0'));var util=require(_0xa09b('0x1'));var path=require(_0xa09b('0x2'));var timeout=require(_0xa09b('0x3'));var express=require(_0xa09b('0x4'));var router=express[_0xa09b('0x5')]();var auth=require(_0xa09b('0x6'));var interaction=require(_0xa09b('0x7'));var config=require('../../config/environment');var controller=require(_0xa09b('0x8'));router['get']('/',auth[_0xa09b('0x9')](),controller[_0xa09b('0xa')]);router[_0xa09b('0xb')](_0xa09b('0xc'),auth['isAuthenticated'](),controller[_0xa09b('0xd')]);router['get'](_0xa09b('0xe'),auth[_0xa09b('0x9')](),controller['show']);router[_0xa09b('0xb')]('/voice/queue/countAttributes/:id',auth[_0xa09b('0x9')](),controller[_0xa09b('0xf')]);router[_0xa09b('0xb')]('/campaign/countAttributes/:id',auth[_0xa09b('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xa09b('0x10'),auth[_0xa09b('0x9')](),controller[_0xa09b('0x11')]);router[_0xa09b('0x12')](_0xa09b('0x13'),auth[_0xa09b('0x9')](),controller[_0xa09b('0x14')]);router[_0xa09b('0x12')](_0xa09b('0x15'),auth[_0xa09b('0x9')](),controller[_0xa09b('0x16')]);router[_0xa09b('0x17')](_0xa09b('0xe'),auth[_0xa09b('0x9')](),controller[_0xa09b('0x18')]);module[_0xa09b('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6b31fc6..fe2d3dd 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 _0xa9ef=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xa9ef,0x150));var _0xfa9e=function(_0x34745f,_0x5f2952){_0x34745f=_0x34745f-0x0;var _0x851c1d=_0xa9ef[_0x34745f];return _0x851c1d;};'use strict';var Sequelize=require(_0xfa9e('0x0'));module[_0xfa9e('0x1')]={'state':{'type':Sequelize[_0xfa9e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfa9e('0x3')]},'countbusyretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfa9e('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfa9e('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfa9e('0x4')]},'calleridnum':{'type':Sequelize[_0xfa9e('0x4')]},'calleridname':{'type':Sequelize[_0xfa9e('0x4')]},'starttime':{'type':Sequelize[_0xfa9e('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfa9e('0x3')]},'droptime':{'type':Sequelize[_0xfa9e('0x3')]},'endtime':{'type':Sequelize[_0xfa9e('0x3')]},'ringtime':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xfa9e('0x4')]},'campaigntype':{'type':Sequelize[_0xfa9e('0x4')]},'membername':{'type':Sequelize[_0xfa9e('0x4')]},'reason':{'type':Sequelize[_0xfa9e('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfa9e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfa9e('0x3')]},'recallme':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfa9e('0x3')]},'edited':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfa9e('0x4')]}}; \ No newline at end of file +var _0x5d01=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5d01,0x190));var _0x15d0=function(_0x395dd4,_0x2b7020){_0x395dd4=_0x395dd4-0x0;var _0x5e09e4=_0x5d01[_0x395dd4];return _0x5e09e4;};'use strict';var Sequelize=require(_0x15d0('0x0'));module[_0x15d0('0x1')]={'state':{'type':Sequelize[_0x15d0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x15d0('0x3')]},'scheduledat':{'type':Sequelize[_0x15d0('0x4')]},'countbusyretry':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x15d0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x15d0('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x15d0('0x3')]},'starttime':{'type':Sequelize[_0x15d0('0x4')]},'responsetime':{'type':Sequelize[_0x15d0('0x4')]},'answertime':{'type':Sequelize[_0x15d0('0x4')]},'droptime':{'type':Sequelize[_0x15d0('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x15d0('0x3')]},'campaign':{'type':Sequelize[_0x15d0('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x15d0('0x3')]},'reason':{'type':Sequelize[_0x15d0('0x3')]},'amd':{'type':Sequelize[_0x15d0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x15d0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x15d0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x15d0('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x15d0('0x4')]},'edited':{'type':Sequelize[_0x15d0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x15d0('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x15d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 740c657..d2de151 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 _0x7dcf=['reject','save','update','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range'];(function(_0x2fd97d,_0xd43497){var _0x448a04=function(_0x22631d){while(--_0x22631d){_0x2fd97d['push'](_0x2fd97d['shift']());}};_0x448a04(++_0xd43497);}(_0x7dcf,0x1dd));var _0xf7dc=function(_0x2e1906,_0xa281e9){_0x2e1906=_0x2e1906-0x0;var _0x3ea10e=_0x7dcf[_0x2e1906];return _0x3ea10e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf7dc('0x0'));var rimraf=require(_0xf7dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7dc('0x2'));var moment=require(_0xf7dc('0x3'));var BPromise=require(_0xf7dc('0x4'));var Mustache=require(_0xf7dc('0x5'));var util=require(_0xf7dc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf7dc('0x7'));var ejs=require(_0xf7dc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf7dc('0x9'));var crypto=require('crypto');var jsforce=require(_0xf7dc('0xa'));var deskjs=require(_0xf7dc('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf7dc('0xc'));var authService=require(_0xf7dc('0xd'));var qs=require(_0xf7dc('0xe'));var as=require(_0xf7dc('0xf'));var hardwareService=require(_0xf7dc('0x10'));var logger=require(_0xf7dc('0x11'))(_0xf7dc('0x12'));var utils=require(_0xf7dc('0x13'));var config=require('../../config/environment');var db=require(_0xf7dc('0x14'))['db'];function respondWithStatusCode(_0x7c0285,_0x275455){_0x275455=_0x275455||0xcc;return function(_0x2fb589){if(_0x2fb589){return _0x7c0285['sendStatus'](_0x275455);}return _0x7c0285[_0xf7dc('0x15')](_0x275455)['end']();};}function respondWithResult(_0x2698d7,_0x235da8){_0x235da8=_0x235da8||0xc8;return function(_0xe3b124){if(_0xe3b124){return _0x2698d7[_0xf7dc('0x15')](_0x235da8)[_0xf7dc('0x16')](_0xe3b124);}};}function respondWithFilteredResult(_0xdd3a73,_0x451604){return function(_0x569006){if(_0x569006){var _0x2e95e1=_0x569006['count'],_0x4a5bc8=_0x451604[_0xf7dc('0x17')],_0x1033d8=_0x451604[_0xf7dc('0x17')]+_0x451604[_0xf7dc('0x18')],_0xc6e193;if(_0x1033d8>=_0x2e95e1){_0x1033d8=_0x2e95e1;_0xc6e193=0xc8;}else{_0xc6e193=0xce;}_0xdd3a73['status'](_0xc6e193);return _0xdd3a73[_0xf7dc('0x19')](_0xf7dc('0x1a'),_0x4a5bc8+'-'+_0x1033d8+'/'+_0x2e95e1)[_0xf7dc('0x16')](_0x569006);}return null;};}function patchUpdates(_0x3c7591){return function(_0x2a3856){try{jsonpatch['apply'](_0x2a3856,_0x3c7591,!![]);}catch(_0x5c58fc){return BPromise[_0xf7dc('0x1b')](_0x5c58fc);}return _0x2a3856[_0xf7dc('0x1c')]();};}function saveUpdates(_0x45a5bb,_0x37339f){return function(_0x3011f3){if(_0x3011f3){return _0x3011f3[_0xf7dc('0x1d')](_0x45a5bb)['then'](function(_0x2e0114){return _0x2e0114;});}return null;};}function removeEntity(_0x50b717,_0x2d22e2){return function(_0x40a324){if(_0x40a324){return _0x40a324[_0xf7dc('0x1e')]()['then'](function(){_0x50b717[_0xf7dc('0x15')](0xcc)[_0xf7dc('0x1f')]();});}};}function handleEntityNotFound(_0x58f536,_0x1733f2){return function(_0x16e7fe){if(!_0x16e7fe){_0x58f536['sendStatus'](0x194);}return _0x16e7fe;};}function handleError(_0x37c205,_0x23d2b1){_0x23d2b1=_0x23d2b1||0x1f4;return function(_0x3c5b83){logger[_0xf7dc('0x20')](_0x3c5b83[_0xf7dc('0x21')]);if(_0x3c5b83[_0xf7dc('0x22')]){delete _0x3c5b83['name'];}_0x37c205[_0xf7dc('0x15')](_0x23d2b1)[_0xf7dc('0x23')](_0x3c5b83);};}exports[_0xf7dc('0x24')]=function(_0x58c051,_0x5cd530){var _0x3efc8e={},_0xe68533={},_0x29a047={'count':0x0,'rows':[]};var _0x20dd61=_[_0xf7dc('0x25')](db[_0xf7dc('0x26')][_0xf7dc('0x27')],function(_0x2e9869){return{'name':_0x2e9869[_0xf7dc('0x28')],'type':_0x2e9869['type'][_0xf7dc('0x29')]};});_0xe68533['model']=_[_0xf7dc('0x25')](_0x20dd61,'name');_0xe68533[_0xf7dc('0x2a')]=_[_0xf7dc('0x2b')](_0x58c051[_0xf7dc('0x2a')]);_0xe68533['filters']=_['intersection'](_0xe68533[_0xf7dc('0x2c')],_0xe68533[_0xf7dc('0x2a')]);_0x3efc8e[_0xf7dc('0x2d')]=_[_0xf7dc('0x2e')](_0xe68533[_0xf7dc('0x2c')],qs[_0xf7dc('0x2f')](_0x58c051[_0xf7dc('0x2a')][_0xf7dc('0x2f')]));_0x3efc8e[_0xf7dc('0x2d')]=_0x3efc8e['attributes']['length']?_0x3efc8e[_0xf7dc('0x2d')]:_0xe68533[_0xf7dc('0x2c')];if(!_0x58c051['query']['hasOwnProperty'](_0xf7dc('0x30'))){_0x3efc8e['limit']=qs[_0xf7dc('0x18')](_0x58c051['query'][_0xf7dc('0x18')]);_0x3efc8e[_0xf7dc('0x17')]=qs['offset'](_0x58c051[_0xf7dc('0x2a')][_0xf7dc('0x17')]);}_0x3efc8e[_0xf7dc('0x31')]=qs[_0xf7dc('0x32')](_0x58c051[_0xf7dc('0x2a')]['sort']);_0x3efc8e[_0xf7dc('0x33')]=qs['filters'](_['pick'](_0x58c051['query'],_0xe68533[_0xf7dc('0x34')]),_0x20dd61);if(_0x58c051['query'][_0xf7dc('0x35')]){_0x3efc8e['where']=_[_0xf7dc('0x36')](_0x3efc8e[_0xf7dc('0x33')],{'$or':_[_0xf7dc('0x25')](_0x20dd61,function(_0x21f595){if(_0x21f595['type']!==_0xf7dc('0x37')){var _0xab14dc={};_0xab14dc[_0x21f595[_0xf7dc('0x22')]]={'$like':'%'+_0x58c051[_0xf7dc('0x2a')][_0xf7dc('0x35')]+'%'};return _0xab14dc;}})});}_0x3efc8e=_[_0xf7dc('0x36')]({},_0x3efc8e,_0x58c051[_0xf7dc('0x38')]);var _0x571d3c={'where':_0x3efc8e['where']};return db[_0xf7dc('0x26')][_0xf7dc('0x39')](_0x571d3c)[_0xf7dc('0x3a')](function(_0x368bdb){_0x29a047[_0xf7dc('0x39')]=_0x368bdb;if(_0x58c051['query'][_0xf7dc('0x3b')]){_0x3efc8e[_0xf7dc('0x3c')]=[{'all':!![]}];}return db[_0xf7dc('0x26')][_0xf7dc('0x3d')](_0x3efc8e);})[_0xf7dc('0x3a')](function(_0x207022){_0x29a047[_0xf7dc('0x3e')]=_0x207022;return _0x29a047;})[_0xf7dc('0x3a')](respondWithFilteredResult(_0x5cd530,_0x3efc8e))['catch'](handleError(_0x5cd530,null));};exports[_0xf7dc('0x3f')]=function(_0x2ed574,_0xa7360d){var _0x2d6b4b={'raw':!![],'where':{'id':_0x2ed574[_0xf7dc('0x40')]['id']}},_0x21bfc5={};_0x21bfc5[_0xf7dc('0x2c')]=_[_0xf7dc('0x2b')](db[_0xf7dc('0x26')]['rawAttributes']);_0x21bfc5[_0xf7dc('0x2a')]=_['keys'](_0x2ed574[_0xf7dc('0x2a')]);_0x21bfc5['filters']=_[_0xf7dc('0x2e')](_0x21bfc5[_0xf7dc('0x2c')],_0x21bfc5['query']);_0x2d6b4b[_0xf7dc('0x2d')]=_[_0xf7dc('0x2e')](_0x21bfc5[_0xf7dc('0x2c')],qs[_0xf7dc('0x2f')](_0x2ed574['query'][_0xf7dc('0x2f')]));_0x2d6b4b[_0xf7dc('0x2d')]=_0x2d6b4b[_0xf7dc('0x2d')][_0xf7dc('0x41')]?_0x2d6b4b['attributes']:_0x21bfc5[_0xf7dc('0x2c')];if(_0x2ed574['query']['includeAll']){_0x2d6b4b['include']=[{'all':!![]}];}_0x2d6b4b=_[_0xf7dc('0x36')]({},_0x2d6b4b,_0x2ed574[_0xf7dc('0x38')]);return db[_0xf7dc('0x26')][_0xf7dc('0x42')](_0x2d6b4b)['then'](handleEntityNotFound(_0xa7360d,null))['then'](respondWithResult(_0xa7360d,null))[_0xf7dc('0x43')](handleError(_0xa7360d,null));};exports['create']=function(_0x56ed1a,_0x1a0451){return db['CmHopperHistory'][_0xf7dc('0x44')](_0x56ed1a[_0xf7dc('0x45')],{})[_0xf7dc('0x3a')](respondWithResult(_0x1a0451,0xc9))[_0xf7dc('0x43')](handleError(_0x1a0451,null));};exports[_0xf7dc('0x46')]=function(_0x20b2e2,_0x222ec9){return db[_0xf7dc('0x26')][_0xf7dc('0x46')]()[_0xf7dc('0x3a')](respondWithResult(_0x222ec9,null))[_0xf7dc('0x43')](handleError(_0x222ec9,null));};exports['update']=function(_0x22b7e5,_0x496ce1){if(_0x22b7e5[_0xf7dc('0x45')][_0xf7dc('0x47')]){delete _0x22b7e5[_0xf7dc('0x45')][_0xf7dc('0x47')];}return db[_0xf7dc('0x26')]['find']({'where':{'uniqueid':_0x22b7e5[_0xf7dc('0x40')]['id']}})[_0xf7dc('0x3a')](handleEntityNotFound(_0x496ce1,null))[_0xf7dc('0x3a')](saveUpdates(_0x22b7e5['body'],null))[_0xf7dc('0x3a')](respondWithResult(_0x496ce1,null))[_0xf7dc('0x43')](handleError(_0x496ce1,null));}; \ No newline at end of file +var _0x6969=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','CmHopperHistory','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','update','uniqueid','html-pdf','eml-format'];(function(_0x11d0a2,_0x594caf){var _0x443c9c=function(_0x1b299e){while(--_0x1b299e){_0x11d0a2['push'](_0x11d0a2['shift']());}};_0x443c9c(++_0x594caf);}(_0x6969,0x17f));var _0x9696=function(_0x429f79,_0x2d8b89){_0x429f79=_0x429f79-0x0;var _0x44935c=_0x6969[_0x429f79];return _0x44935c;};'use strict';var pdf=require(_0x9696('0x0'));var emlformat=require(_0x9696('0x1'));var rimraf=require(_0x9696('0x2'));var zipdir=require(_0x9696('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9696('0x4'));var moment=require(_0x9696('0x5'));var BPromise=require(_0x9696('0x6'));var Mustache=require(_0x9696('0x7'));var util=require(_0x9696('0x8'));var path=require('path');var sox=require(_0x9696('0x9'));var csv=require(_0x9696('0xa'));var ejs=require(_0x9696('0xb'));var fs=require('fs');var _=require(_0x9696('0xc'));var squel=require('squel');var crypto=require(_0x9696('0xd'));var jsforce=require(_0x9696('0xe'));var deskjs=require(_0x9696('0xf'));var toCsv=require(_0x9696('0xa'));var querystring=require('querystring');var Papa=require(_0x9696('0x10'));var Redis=require(_0x9696('0x11'));var authService=require(_0x9696('0x12'));var qs=require(_0x9696('0x13'));var as=require(_0x9696('0x14'));var hardwareService=require(_0x9696('0x15'));var logger=require(_0x9696('0x16'))(_0x9696('0x17'));var utils=require('../../config/utils');var config=require(_0x9696('0x18'));var db=require(_0x9696('0x19'))['db'];function respondWithStatusCode(_0x311bee,_0xc105f0){_0xc105f0=_0xc105f0||0xcc;return function(_0x4ce613){if(_0x4ce613){return _0x311bee['sendStatus'](_0xc105f0);}return _0x311bee[_0x9696('0x1a')](_0xc105f0)[_0x9696('0x1b')]();};}function respondWithResult(_0x31472d,_0x4ca883){_0x4ca883=_0x4ca883||0xc8;return function(_0x2a8a60){if(_0x2a8a60){return _0x31472d[_0x9696('0x1a')](_0x4ca883)['json'](_0x2a8a60);}};}function respondWithFilteredResult(_0x56dc6f,_0x12cfb6){return function(_0x3a8878){if(_0x3a8878){var _0x2d18f1=_0x3a8878[_0x9696('0x1c')],_0x23b643=_0x12cfb6[_0x9696('0x1d')],_0x31d48e=_0x12cfb6[_0x9696('0x1d')]+_0x12cfb6[_0x9696('0x1e')],_0x171c5d;if(_0x31d48e>=_0x2d18f1){_0x31d48e=_0x2d18f1;_0x171c5d=0xc8;}else{_0x171c5d=0xce;}_0x56dc6f['status'](_0x171c5d);return _0x56dc6f[_0x9696('0x1f')]('Content-Range',_0x23b643+'-'+_0x31d48e+'/'+_0x2d18f1)[_0x9696('0x20')](_0x3a8878);}return null;};}function patchUpdates(_0x3ee9f2){return function(_0x36191b){try{jsonpatch[_0x9696('0x21')](_0x36191b,_0x3ee9f2,!![]);}catch(_0x6f2044){return BPromise[_0x9696('0x22')](_0x6f2044);}return _0x36191b[_0x9696('0x23')]();};}function saveUpdates(_0x2b23cc,_0x3b389b){return function(_0x4048ab){if(_0x4048ab){return _0x4048ab['update'](_0x2b23cc)['then'](function(_0xade7d5){return _0xade7d5;});}return null;};}function removeEntity(_0x2b20f3,_0x3994f4){return function(_0x615166){if(_0x615166){return _0x615166[_0x9696('0x24')]()[_0x9696('0x25')](function(){_0x2b20f3[_0x9696('0x1a')](0xcc)[_0x9696('0x1b')]();});}};}function handleEntityNotFound(_0x41bb89,_0x14ac45){return function(_0x1df867){if(!_0x1df867){_0x41bb89['sendStatus'](0x194);}return _0x1df867;};}function handleError(_0x350489,_0x327cd8){_0x327cd8=_0x327cd8||0x1f4;return function(_0x40274f){logger[_0x9696('0x26')](_0x40274f[_0x9696('0x27')]);if(_0x40274f[_0x9696('0x28')]){delete _0x40274f['name'];}_0x350489[_0x9696('0x1a')](_0x327cd8)['send'](_0x40274f);};}exports[_0x9696('0x29')]=function(_0x23a339,_0x4c0e8e){var _0x3504d7={},_0x1012bb={},_0x706eee={'count':0x0,'rows':[]};var _0x12863d=_[_0x9696('0x2a')](db['CmHopperHistory'][_0x9696('0x2b')],function(_0x46d8d6){return{'name':_0x46d8d6[_0x9696('0x2c')],'type':_0x46d8d6['type'][_0x9696('0x2d')]};});_0x1012bb[_0x9696('0x2e')]=_[_0x9696('0x2a')](_0x12863d,_0x9696('0x28'));_0x1012bb[_0x9696('0x2f')]=_[_0x9696('0x30')](_0x23a339['query']);_0x1012bb['filters']=_[_0x9696('0x31')](_0x1012bb[_0x9696('0x2e')],_0x1012bb['query']);_0x3504d7[_0x9696('0x32')]=_[_0x9696('0x31')](_0x1012bb[_0x9696('0x2e')],qs[_0x9696('0x33')](_0x23a339[_0x9696('0x2f')]['fields']));_0x3504d7[_0x9696('0x32')]=_0x3504d7[_0x9696('0x32')]['length']?_0x3504d7['attributes']:_0x1012bb[_0x9696('0x2e')];if(!_0x23a339[_0x9696('0x2f')]['hasOwnProperty'](_0x9696('0x34'))){_0x3504d7[_0x9696('0x1e')]=qs['limit'](_0x23a339[_0x9696('0x2f')][_0x9696('0x1e')]);_0x3504d7[_0x9696('0x1d')]=qs[_0x9696('0x1d')](_0x23a339[_0x9696('0x2f')][_0x9696('0x1d')]);}_0x3504d7[_0x9696('0x35')]=qs[_0x9696('0x36')](_0x23a339[_0x9696('0x2f')][_0x9696('0x36')]);_0x3504d7[_0x9696('0x37')]=qs['filters'](_[_0x9696('0x38')](_0x23a339[_0x9696('0x2f')],_0x1012bb[_0x9696('0x39')]),_0x12863d);if(_0x23a339[_0x9696('0x2f')][_0x9696('0x3a')]){_0x3504d7[_0x9696('0x37')]=_['merge'](_0x3504d7[_0x9696('0x37')],{'$or':_[_0x9696('0x2a')](_0x12863d,function(_0x1510d7){if(_0x1510d7[_0x9696('0x3b')]!==_0x9696('0x3c')){var _0x27d940={};_0x27d940[_0x1510d7[_0x9696('0x28')]]={'$like':'%'+_0x23a339[_0x9696('0x2f')][_0x9696('0x3a')]+'%'};return _0x27d940;}})});}_0x3504d7=_[_0x9696('0x3d')]({},_0x3504d7,_0x23a339[_0x9696('0x3e')]);var _0x34c235={'where':_0x3504d7['where']};return db[_0x9696('0x3f')]['count'](_0x34c235)[_0x9696('0x25')](function(_0x5dab23){_0x706eee[_0x9696('0x1c')]=_0x5dab23;if(_0x23a339[_0x9696('0x2f')][_0x9696('0x40')]){_0x3504d7['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x9696('0x41')](_0x3504d7);})[_0x9696('0x25')](function(_0x39edce){_0x706eee[_0x9696('0x42')]=_0x39edce;return _0x706eee;})['then'](respondWithFilteredResult(_0x4c0e8e,_0x3504d7))['catch'](handleError(_0x4c0e8e,null));};exports[_0x9696('0x43')]=function(_0x34bbda,_0x350b71){var _0x2acedc={'raw':!![],'where':{'id':_0x34bbda[_0x9696('0x44')]['id']}},_0x3dc1e1={};_0x3dc1e1[_0x9696('0x2e')]=_[_0x9696('0x30')](db[_0x9696('0x3f')][_0x9696('0x2b')]);_0x3dc1e1['query']=_[_0x9696('0x30')](_0x34bbda[_0x9696('0x2f')]);_0x3dc1e1[_0x9696('0x39')]=_[_0x9696('0x31')](_0x3dc1e1[_0x9696('0x2e')],_0x3dc1e1[_0x9696('0x2f')]);_0x2acedc[_0x9696('0x32')]=_['intersection'](_0x3dc1e1[_0x9696('0x2e')],qs['fields'](_0x34bbda[_0x9696('0x2f')][_0x9696('0x33')]));_0x2acedc[_0x9696('0x32')]=_0x2acedc[_0x9696('0x32')]['length']?_0x2acedc['attributes']:_0x3dc1e1[_0x9696('0x2e')];if(_0x34bbda[_0x9696('0x2f')][_0x9696('0x40')]){_0x2acedc[_0x9696('0x45')]=[{'all':!![]}];}_0x2acedc=_[_0x9696('0x3d')]({},_0x2acedc,_0x34bbda[_0x9696('0x3e')]);return db[_0x9696('0x3f')][_0x9696('0x46')](_0x2acedc)[_0x9696('0x25')](handleEntityNotFound(_0x350b71,null))[_0x9696('0x25')](respondWithResult(_0x350b71,null))[_0x9696('0x47')](handleError(_0x350b71,null));};exports[_0x9696('0x48')]=function(_0x31730b,_0x988c9){return db[_0x9696('0x3f')]['create'](_0x31730b[_0x9696('0x49')],{})['then'](respondWithResult(_0x988c9,0xc9))[_0x9696('0x47')](handleError(_0x988c9,null));};exports[_0x9696('0x4a')]=function(_0x22824c,_0x15f759){return db[_0x9696('0x3f')][_0x9696('0x4a')]()[_0x9696('0x25')](respondWithResult(_0x15f759,null))[_0x9696('0x47')](handleError(_0x15f759,null));};exports[_0x9696('0x4b')]=function(_0x370552,_0x29e24b){if(_0x370552['body'][_0x9696('0x4c')]){delete _0x370552[_0x9696('0x49')]['uniqueid'];}return db[_0x9696('0x3f')][_0x9696('0x46')]({'where':{'uniqueid':_0x370552['params']['id']}})[_0x9696('0x25')](handleEntityNotFound(_0x29e24b,null))['then'](saveUpdates(_0x370552[_0x9696('0x49')],null))[_0x9696('0x25')](respondWithResult(_0x29e24b,null))[_0x9696('0x47')](handleError(_0x29e24b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0a62bc0..552c210 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 _0x43b5=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x2a1fc0,_0x5d8d63){var _0x2b805c=function(_0x3d5d40){while(--_0x3d5d40){_0x2a1fc0['push'](_0x2a1fc0['shift']());}};_0x2b805c(++_0x5d8d63);}(_0x43b5,0x17a));var _0x543b=function(_0x205c95,_0x18a8d2){_0x205c95=_0x205c95-0x0;var _0x18db6b=_0x43b5[_0x205c95];return _0x18db6b;};'use strict';var _=require(_0x543b('0x0'));var util=require(_0x543b('0x1'));var logger=require(_0x543b('0x2'))(_0x543b('0x3'));var moment=require(_0x543b('0x4'));var BPromise=require(_0x543b('0x5'));var rp=require(_0x543b('0x6'));var fs=require('fs');var path=require(_0x543b('0x7'));var rimraf=require(_0x543b('0x8'));var config=require(_0x543b('0x9'));var attributes=require(_0x543b('0xa'));module[_0x543b('0xb')]=function(_0x2c0b7b,_0x4a63b1){return _0x2c0b7b['define']('CmHopperHistory',attributes,{'tableName':_0x543b('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x543b('0xd')]},{'name':_0x543b('0xe'),'fields':[_0x543b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa909=['../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xa909,0x19b));var _0x9a90=function(_0x491088,_0x1e26db){_0x491088=_0x491088-0x0;var _0x53e1a4=_0xa909[_0x491088];return _0x53e1a4;};'use strict';var _=require(_0x9a90('0x0'));var util=require(_0x9a90('0x1'));var logger=require(_0x9a90('0x2'))(_0x9a90('0x3'));var moment=require(_0x9a90('0x4'));var BPromise=require(_0x9a90('0x5'));var rp=require(_0x9a90('0x6'));var fs=require('fs');var path=require(_0x9a90('0x7'));var rimraf=require(_0x9a90('0x8'));var config=require(_0x9a90('0x9'));var attributes=require(_0x9a90('0xa'));module['exports']=function(_0x10764c,_0x3824e8){return _0x10764c[_0x9a90('0xb')]('CmHopperHistory',attributes,{'tableName':_0x9a90('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9a90('0xd')]},{'name':_0x9a90('0xe'),'fields':[_0x9a90('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 16d047f..d6df2f1 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 _0x8603=['create','options','raw','debug','stringify','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory'];(function(_0xd58173,_0x458c65){var _0x5dd3fd=function(_0x698f9f){while(--_0x698f9f){_0xd58173['push'](_0xd58173['shift']());}};_0x5dd3fd(++_0x458c65);}(_0x8603,0x190));var _0x3860=function(_0x3cc870,_0x60a6f9){_0x3cc870=_0x3cc870-0x0;var _0x3b729b=_0x8603[_0x3cc870];return _0x3b729b;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});};exports[_0x3860('0x19')]=function(_0x2b91f2){var _0x301e03=this;return new Promise(function(_0x20bb1e,_0x56a6d1){return db[_0x3860('0x13')]['findAll']({'raw':_0x2b91f2['options']?_0x2b91f2[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x2b91f2['options']?_0x2b91f2['options']['where']||null:null,'attributes':[[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')][_0x3860('0x1c')]('id')),_0x3860('0x1d')],[db[_0x3860('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3860('0x1f')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x20')))),_0x3860('0x21')],[db[_0x3860('0x1a')]['fn']('COUNT',db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3860('0x22')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x23'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x3860('0x24')],[db['sequelize']['fn'](_0x3860('0x23'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x25')))),_0x3860('0x26')]]})[_0x3860('0x9')](function(_0x4d30bc){logger[_0x3860('0xf')](_0x3860('0x19'),_0x2b91f2);logger['debug'](_0x3860('0x19'),_0x2b91f2,JSON[_0x3860('0x18')](_0x4d30bc));_0x20bb1e(_0x4d30bc);})[_0x3860('0x11')](function(_0x5af661){logger['error'](_0x3860('0x19'),_0x5af661[_0x3860('0xe')],_0x2b91f2);_0x56a6d1(_0x301e03[_0x3860('0xd')](0x1f4,_0x5af661[_0x3860('0xe')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4d6b1c){var _0x3ad0aa=this;return new Promise(function(_0x40dae8,_0xc715a0){return db[_0x3860('0x13')][_0x3860('0x27')]({'raw':_0x4d6b1c['options']?_0x4d6b1c[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x4d6b1c['options']?_0x4d6b1c['options'][_0x3860('0x28')]||null:null,'attributes':[[_0x3860('0x29'),_0x3860('0x2a')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x2b')))),_0x3860('0x2c')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')](_0x3860('0x2d')))),_0x3860('0x2e')],[db[_0x3860('0x1a')]['fn']('COUNT',db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3860('0x2f')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x30')))),_0x3860('0x31')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3860('0x32')))),_0x3860('0x33')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')](_0x3860('0x34')))),_0x3860('0x35')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x36')))),_0x3860('0x37')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0x3860('0x38')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x39')))),_0x3860('0x3a')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x3b')))),_0x3860('0x3c')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3860('0x3d')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3860('0x3f')))),_0x3860('0x3d')],[db['sequelize']['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x40')))),_0x3860('0x41')]],'group':[_0x3860('0x29')]})[_0x3860('0x9')](function(_0x3fad85){logger['info'](_0x3860('0x42'),_0x4d6b1c);logger[_0x3860('0x17')](_0x3860('0x42'),_0x4d6b1c,JSON[_0x3860('0x18')](_0x3fad85));_0x40dae8(_0x3fad85);})[_0x3860('0x11')](function(_0x447163){logger['error'](_0x3860('0x42'),_0x447163[_0x3860('0xe')],_0x4d6b1c);_0xc715a0(_0x3ad0aa[_0x3860('0xd')](0x1f4,_0x447163[_0x3860('0xe')]));});});};exports[_0x3860('0x43')]=function(_0x1e2b5d){var _0xe2b761=this;return new Promise(function(_0x1874f2,_0x48b603){return db[_0x3860('0x13')][_0x3860('0x27')]({'raw':_0x1e2b5d['options']?_0x1e2b5d[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x1e2b5d[_0x3860('0x15')]?_0x1e2b5d['options'][_0x3860('0x28')]||null:null,'attributes':[['campaign',_0x3860('0x2a')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')][_0x3860('0x1c')]('id')),_0x3860('0x44')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x45')))),'ivrAnswerCallsDay']],'group':['campaign']})['then'](function(_0x5fbea0){logger['info']('GetCampaignHopperHistory',_0x1e2b5d);logger[_0x3860('0x17')](_0x3860('0x43'),_0x1e2b5d,JSON[_0x3860('0x18')](_0x5fbea0));_0x1874f2(_0x5fbea0);})[_0x3860('0x11')](function(_0x3d6c17){logger[_0x3860('0xd')]('GetCampaignHopperHistory',_0x3d6c17['message'],_0x1e2b5d);_0x48b603(_0xe2b761['error'](0x1f4,_0x3d6c17[_0x3860('0xe')]));});});}; \ No newline at end of file +var _0x6e6c=['jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils','rpc'];(function(_0x1414c0,_0x4d7272){var _0x33019b=function(_0x2294cf){while(--_0x2294cf){_0x1414c0['push'](_0x1414c0['shift']());}};_0x33019b(++_0x4d7272);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301f55,_0x30a10b,_0x4da7bd){return new BPromise(function(_0x324706,_0x15d268){return client['request'](_0x301f55,_0x4da7bd)[_0xc6e6('0x8')](function(_0x481799){logger[_0xc6e6('0x9')](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));logger[_0xc6e6('0xc')](_0xc6e6('0xd'),_0x30a10b,_0xc6e6('0xb'),JSON[_0xc6e6('0xe')](_0x481799));if(_0x481799[_0xc6e6('0xf')]){if(_0x481799[_0xc6e6('0xf')]['code']===0x1f4){logger[_0xc6e6('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x15d268(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}logger['error'](_0xc6e6('0xa'),_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x324706(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}else{logger['info'](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));_0x324706(_0x481799['result'][_0xc6e6('0x10')]);}})[_0xc6e6('0x11')](function(_0xedf127){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x30a10b,_0xedf127);_0x15d268(_0xedf127);});});}exports['CreateCmHopperHistory']=function(_0x3a1ccc){var _0x554262=this;return new Promise(function(_0x46e58f,_0x2069e4){return db[_0xc6e6('0x12')][_0xc6e6('0x13')](_0x3a1ccc[_0xc6e6('0x14')],{'raw':_0x3a1ccc[_0xc6e6('0x15')]?_0x3a1ccc[_0xc6e6('0x15')][_0xc6e6('0x16')]===undefined?!![]:![]:!![]})[_0xc6e6('0x8')](function(_0x3d734d){logger['info'](_0xc6e6('0x17'),_0x3a1ccc);logger['debug'](_0xc6e6('0x17'),_0x3a1ccc,JSON[_0xc6e6('0xe')](_0x3d734d));_0x46e58f(_0x3d734d);})[_0xc6e6('0x11')](function(_0x2f69f1){logger['error'](_0xc6e6('0x17'),_0x2f69f1[_0xc6e6('0x10')],_0x3a1ccc);_0x2069e4(_0x554262[_0xc6e6('0xf')](0x1f4,_0x2f69f1[_0xc6e6('0x10')]));});});};exports[_0xc6e6('0x18')]=function(_0x4c35ae){var _0x41fe96=this;return new Promise(function(_0x51fe51,_0x266786){return db[_0xc6e6('0x12')][_0xc6e6('0x19')]({'raw':_0x4c35ae[_0xc6e6('0x15')]?_0x4c35ae['options'][_0xc6e6('0x16')]===undefined?!![]:![]:!![],'where':_0x4c35ae['options']?_0x4c35ae[_0xc6e6('0x15')]['where']||null:null,'attributes':[[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')][_0xc6e6('0x1c')]('id')),_0xc6e6('0x1d')],[db['sequelize']['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xc6e6('0x1f')],[db['sequelize']['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x20')))),_0xc6e6('0x21')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x22')))),_0xc6e6('0x23')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x24'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')]['literal'](_0xc6e6('0x25')))),_0xc6e6('0x26')],[db['sequelize']['fn']('AVG',db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x27')))),_0xc6e6('0x28')]]})[_0xc6e6('0x8')](function(_0x59a8f0){logger[_0xc6e6('0x9')](_0xc6e6('0x18'),_0x4c35ae);logger[_0xc6e6('0xc')]('AvgHandleTime',_0x4c35ae,JSON['stringify'](_0x59a8f0));_0x51fe51(_0x59a8f0);})[_0xc6e6('0x11')](function(_0xcf753){logger[_0xc6e6('0xf')](_0xc6e6('0x18'),_0xcf753['message'],_0x4c35ae);_0x266786(_0x41fe96['error'](0x1f4,_0xcf753[_0xc6e6('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x268c8f){var _0x577aa6=this;return new Promise(function(_0x357eae,_0x404fb3){return db[_0xc6e6('0x12')][_0xc6e6('0x19')]({'raw':_0x268c8f['options']?_0x268c8f['options'][_0xc6e6('0x16')]===undefined?!![]:![]:!![],'where':_0x268c8f[_0xc6e6('0x15')]?_0x268c8f[_0xc6e6('0x15')][_0xc6e6('0x29')]||null:null,'attributes':[['campaign','name'],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')]['literal'](_0xc6e6('0x2a')))),_0xc6e6('0x2b')],[db['sequelize']['fn']('COUNT',db[_0xc6e6('0x1a')]['fn']('IF',db['sequelize'][_0xc6e6('0x1e')](_0xc6e6('0x2c')))),'outboundNoAnswerCallsDay'],[db[_0xc6e6('0x1a')]['fn']('COUNT',db[_0xc6e6('0x1a')]['fn']('IF',db['sequelize'][_0xc6e6('0x1e')](_0xc6e6('0x2d')))),_0xc6e6('0x2e')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x2f')))),'outboundBusyCallsDay'],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')]['literal'](_0xc6e6('0x30')))),_0xc6e6('0x31')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db['sequelize']['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x32')))),_0xc6e6('0x33')],[db[_0xc6e6('0x1a')]['fn']('COUNT',db[_0xc6e6('0x1a')]['fn']('IF',db['sequelize'][_0xc6e6('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc6e6('0x34')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x35')))),_0xc6e6('0x36')],[db['sequelize']['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')]['literal'](_0xc6e6('0x37')))),_0xc6e6('0x38')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x39')))),_0xc6e6('0x3a')],[db[_0xc6e6('0x1a')]['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0xc6e6('0x3b')],[db['sequelize']['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')](_0xc6e6('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xc6e6('0x1b'),db[_0xc6e6('0x1a')]['fn']('IF',db[_0xc6e6('0x1a')][_0xc6e6('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xc6e6('0x3d')]],'group':[_0xc6e6('0x3e')]})[_0xc6e6('0x8')](function(_0x286dcf){logger[_0xc6e6('0x9')]('GetVoiceQueueHopperHistory',_0x268c8f);logger[_0xc6e6('0xc')](_0xc6e6('0x3f'),_0x268c8f,JSON[_0xc6e6('0xe')](_0x286dcf));_0x357eae(_0x286dcf);})['catch'](function(_0x3df0db){logger[_0xc6e6('0xf')](_0xc6e6('0x3f'),_0x3df0db[_0xc6e6('0x10')],_0x268c8f);_0x404fb3(_0x577aa6[_0xc6e6('0xf')](0x1f4,_0x3df0db['message']));});});};exports[_0xc6e6('0x40')]=function(_0x1de5ca){var _0x7c088c=this;return new Promise(function(_0x3e7ec5,_0x287fd4){return db['CmHopperHistory']['findAll']({'raw':_0x1de5ca['options']?_0x1de5ca[_0xc6e6('0x15')][_0xc6e6('0x16')]===undefined?!![]:![]:!![],'where':_0x1de5ca[_0xc6e6('0x15')]?_0x1de5ca[_0xc6e6('0x15')][_0xc6e6('0x29')]||null:null,'attributes':[[_0xc6e6('0x3e'),'name'],[db[_0xc6e6('0x1a')]['fn']('COUNT',db[_0xc6e6('0x1a')][_0xc6e6('0x1c')]('id')),_0xc6e6('0x41')],[db['sequelize']['fn'](_0xc6e6('0x1b'),db['sequelize']['fn']('IF',db[_0xc6e6('0x1a')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xc6e6('0x42')]],'group':['campaign']})['then'](function(_0x44cab4){logger[_0xc6e6('0x9')](_0xc6e6('0x40'),_0x1de5ca);logger[_0xc6e6('0xc')](_0xc6e6('0x40'),_0x1de5ca,JSON[_0xc6e6('0xe')](_0x44cab4));_0x3e7ec5(_0x44cab4);})[_0xc6e6('0x11')](function(_0x461d2b){logger['error'](_0xc6e6('0x40'),_0x461d2b[_0xc6e6('0x10')],_0x1de5ca);_0x287fd4(_0x7c088c[_0xc6e6('0xf')](0x1f4,_0x461d2b[_0xc6e6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0746355..a17590b 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 _0xf076=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','show','create','/:id','update','exports','multer','path'];(function(_0x198169,_0x1e0d40){var _0x7bea12=function(_0x2ebefa){while(--_0x2ebefa){_0x198169['push'](_0x198169['shift']());}};_0x7bea12(++_0x1e0d40);}(_0xf076,0x13e));var _0x6f07=function(_0x321b0a,_0x4c0518){_0x321b0a=_0x321b0a-0x0;var _0x34a8de=_0xf076[_0x321b0a];return _0x34a8de;};'use strict';var multer=require(_0x6f07('0x0'));var util=require('util');var path=require(_0x6f07('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f07('0x2'));var router=express[_0x6f07('0x3')]();var auth=require(_0x6f07('0x4'));var interaction=require(_0x6f07('0x5'));var config=require(_0x6f07('0x6'));var controller=require(_0x6f07('0x7'));router[_0x6f07('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6f07('0x8')]('/describe',auth[_0x6f07('0x9')](),controller[_0x6f07('0xa')]);router[_0x6f07('0x8')]('/:id',auth[_0x6f07('0x9')](),controller[_0x6f07('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6f07('0xc')]);router['put'](_0x6f07('0xd'),auth[_0x6f07('0x9')](),controller[_0x6f07('0xe')]);module[_0x6f07('0xf')]=router; \ No newline at end of file +var _0xdda4=['create','put','update','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x48e970,_0x259e69){var _0x2d524a=function(_0x30555c){while(--_0x30555c){_0x48e970['push'](_0x48e970['shift']());}};_0x2d524a(++_0x259e69);}(_0xdda4,0x1a6));var _0x4dda=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xdda4[_0x810e4d];return _0x13f01c;};'use strict';var multer=require('multer');var util=require(_0x4dda('0x0'));var path=require('path');var timeout=require(_0x4dda('0x1'));var express=require(_0x4dda('0x2'));var router=express[_0x4dda('0x3')]();var auth=require(_0x4dda('0x4'));var interaction=require(_0x4dda('0x5'));var config=require(_0x4dda('0x6'));var controller=require(_0x4dda('0x7'));router[_0x4dda('0x8')]('/',auth[_0x4dda('0x9')](),controller[_0x4dda('0xa')]);router[_0x4dda('0x8')](_0x4dda('0xb'),auth[_0x4dda('0x9')](),controller[_0x4dda('0xc')]);router[_0x4dda('0x8')](_0x4dda('0xd'),auth['isAuthenticated'](),controller[_0x4dda('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4dda('0xf')]);router[_0x4dda('0x10')](_0x4dda('0xd'),auth[_0x4dda('0x9')](),controller[_0x4dda('0x11')]);module[_0x4dda('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 90b8255..7c24d68 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 _0x0c4e=['STRING'];(function(_0x374a72,_0x5edd7d){var _0x48cdda=function(_0x46cb6a){while(--_0x46cb6a){_0x374a72['push'](_0x374a72['shift']());}};_0x48cdda(++_0x5edd7d);}(_0x0c4e,0x69));var _0xe0c4=function(_0x234fb3,_0xf5789c){_0x234fb3=_0x234fb3-0x0;var _0xca7d69=_0x0c4e[_0x234fb3];return _0xca7d69;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0c4('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe0c4('0x0')]},'dialPrefix':{'type':Sequelize[_0xe0c4('0x0')]}}; \ No newline at end of file +var _0x220e=['name','exports','STRING'];(function(_0x3adca1,_0x30c4ee){var _0x53e896=function(_0xd80163){while(--_0xd80163){_0x3adca1['push'](_0x3adca1['shift']());}};_0x53e896(++_0x30c4ee);}(_0x220e,0x115));var _0xe220=function(_0x3a833e,_0x5a1878){_0x3a833e=_0x3a833e-0x0;var _0xdff445=_0x220e[_0x3a833e];return _0xdff445;};'use strict';var Sequelize=require('sequelize');module[_0xe220('0x0')]={'name':{'type':Sequelize[_0xe220('0x1')],'unique':_0xe220('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xe220('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 4382bbd..8c437a3 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 _0x6ab8=['sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','CmList','fieldName','type','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','ListId','getDispositions','findOne','includeAll','rows','removeDispositions','addContacts','CmContact','describe','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x6ab8,0x19b));var _0x86ab=function(_0x387b6b,_0x4e170d){_0x387b6b=_0x387b6b-0x0;var _0x5909e3=_0x6ab8[_0x387b6b];return _0x5909e3;};'use strict';var pdf=require(_0x86ab('0x0'));var emlformat=require(_0x86ab('0x1'));var rimraf=require(_0x86ab('0x2'));var zipdir=require(_0x86ab('0x3'));var jsonpatch=require(_0x86ab('0x4'));var rp=require(_0x86ab('0x5'));var moment=require(_0x86ab('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x86ab('0x7'));var util=require(_0x86ab('0x8'));var path=require('path');var sox=require(_0x86ab('0x9'));var csv=require(_0x86ab('0xa'));var ejs=require(_0x86ab('0xb'));var fs=require('fs');var _=require(_0x86ab('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86ab('0xd'));var toCsv=require(_0x86ab('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86ab('0xe'));var authService=require(_0x86ab('0xf'));var qs=require(_0x86ab('0x10'));var as=require(_0x86ab('0x11'));var hardwareService=require(_0x86ab('0x12'));var logger=require(_0x86ab('0x13'))('api');var utils=require(_0x86ab('0x14'));var config=require('../../config/environment');var db=require(_0x86ab('0x15'))['db'];config['redis']=_[_0x86ab('0x16')](config[_0x86ab('0x17')],{'host':_0x86ab('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x86ab('0x19')](socket);function respondWithStatusCode(_0x41ec59,_0x53f853){_0x53f853=_0x53f853||0xcc;return function(_0x2e0cca){if(_0x2e0cca){return _0x41ec59[_0x86ab('0x1a')](_0x53f853);}return _0x41ec59[_0x86ab('0x1b')](_0x53f853)[_0x86ab('0x1c')]();};}function respondWithResult(_0x21a42e,_0x1dd0f0){_0x1dd0f0=_0x1dd0f0||0xc8;return function(_0x4c8775){if(_0x4c8775){return _0x21a42e[_0x86ab('0x1b')](_0x1dd0f0)[_0x86ab('0x1d')](_0x4c8775);}};}function respondWithFilteredResult(_0x256956,_0x2f9ed3){return function(_0x2cd8dd){if(_0x2cd8dd){var _0xc081d6=_0x2cd8dd['count'],_0x2df1c8=_0x2f9ed3[_0x86ab('0x1e')],_0x239481=_0x2f9ed3[_0x86ab('0x1e')]+_0x2f9ed3['limit'],_0x113ed4;if(_0x239481>=_0xc081d6){_0x239481=_0xc081d6;_0x113ed4=0xc8;}else{_0x113ed4=0xce;}_0x256956[_0x86ab('0x1b')](_0x113ed4);return _0x256956[_0x86ab('0x1f')](_0x86ab('0x20'),_0x2df1c8+'-'+_0x239481+'/'+_0xc081d6)[_0x86ab('0x1d')](_0x2cd8dd);}return null;};}function patchUpdates(_0x3e2951){return function(_0x3ae0c4){try{jsonpatch[_0x86ab('0x21')](_0x3ae0c4,_0x3e2951,!![]);}catch(_0x162858){return BPromise[_0x86ab('0x22')](_0x162858);}return _0x3ae0c4[_0x86ab('0x23')]();};}function saveUpdates(_0x497041,_0x2dae32){return function(_0xdf9ac3){if(_0xdf9ac3){return _0xdf9ac3['update'](_0x497041)[_0x86ab('0x24')](function(_0x4897c2){return _0x4897c2;});}return null;};}function removeEntity(_0x3d228a,_0x448dbb){return function(_0xc8f541){if(_0xc8f541){return _0xc8f541[_0x86ab('0x25')]()[_0x86ab('0x24')](function(){var _0x10726b=_0xc8f541['get']({'plain':!![]});var _0x588d15='Lists';return db[_0x86ab('0x26')][_0x86ab('0x25')]({'where':{'type':_0x588d15,'resourceId':_0x10726b['id']}})[_0x86ab('0x24')](function(){return _0xc8f541;});})[_0x86ab('0x24')](function(){_0x3d228a[_0x86ab('0x1b')](0xcc)[_0x86ab('0x1c')]();});}};}function handleEntityNotFound(_0x335980,_0x3821f2){return function(_0x7779d5){if(!_0x7779d5){_0x335980[_0x86ab('0x1a')](0x194);}return _0x7779d5;};}function handleError(_0x3a1cf5,_0x49704c){_0x49704c=_0x49704c||0x1f4;return function(_0x4c1111){logger[_0x86ab('0x27')](_0x4c1111[_0x86ab('0x28')]);if(_0x4c1111['name']){delete _0x4c1111[_0x86ab('0x29')];}_0x3a1cf5['status'](_0x49704c)[_0x86ab('0x2a')](_0x4c1111);};}exports[_0x86ab('0x2b')]=function(_0x3026f9,_0x1e2820){var _0x4eb5cf={},_0x1d8c20={},_0x4381ea={'count':0x0,'rows':[]};var _0xbbbe56=_[_0x86ab('0x2c')](db[_0x86ab('0x2d')]['rawAttributes'],function(_0x1e4ede){return{'name':_0x1e4ede[_0x86ab('0x2e')],'type':_0x1e4ede[_0x86ab('0x2f')]['key']};});_0x1d8c20[_0x86ab('0x30')]=_[_0x86ab('0x2c')](_0xbbbe56,_0x86ab('0x29'));_0x1d8c20['query']=_[_0x86ab('0x31')](_0x3026f9[_0x86ab('0x32')]);_0x1d8c20['filters']=_[_0x86ab('0x33')](_0x1d8c20['model'],_0x1d8c20[_0x86ab('0x32')]);_0x4eb5cf[_0x86ab('0x34')]=_[_0x86ab('0x33')](_0x1d8c20['model'],qs['fields'](_0x3026f9[_0x86ab('0x32')]['fields']));_0x4eb5cf['attributes']=_0x4eb5cf[_0x86ab('0x34')][_0x86ab('0x35')]?_0x4eb5cf['attributes']:_0x1d8c20[_0x86ab('0x30')];if(!_0x3026f9[_0x86ab('0x32')][_0x86ab('0x36')](_0x86ab('0x37'))){_0x4eb5cf[_0x86ab('0x38')]=qs[_0x86ab('0x38')](_0x3026f9[_0x86ab('0x32')][_0x86ab('0x38')]);_0x4eb5cf['offset']=qs[_0x86ab('0x1e')](_0x3026f9[_0x86ab('0x32')][_0x86ab('0x1e')]);}_0x4eb5cf[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x3026f9[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x4eb5cf['where']=qs['filters'](_[_0x86ab('0x3b')](_0x3026f9[_0x86ab('0x32')],_0x1d8c20[_0x86ab('0x3c')]),_0xbbbe56);if(_0x3026f9[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x4eb5cf[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x4eb5cf[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0xbbbe56,function(_0x999abe){if(_0x999abe[_0x86ab('0x2f')]!==_0x86ab('0x40')){var _0x2f55b2={};_0x2f55b2[_0x999abe[_0x86ab('0x29')]]={'$like':'%'+_0x3026f9['query'][_0x86ab('0x3d')]+'%'};return _0x2f55b2;}})});}_0x4eb5cf=_[_0x86ab('0x3f')]({},_0x4eb5cf,_0x3026f9[_0x86ab('0x41')]);var _0x183a14={'where':_0x4eb5cf[_0x86ab('0x3e')]};return db[_0x86ab('0x2d')][_0x86ab('0x42')](_0x183a14)[_0x86ab('0x24')](function(_0x57efcb){_0x4381ea[_0x86ab('0x42')]=_0x57efcb;if(_0x3026f9['query']['includeAll']){_0x4eb5cf[_0x86ab('0x43')]=[{'all':!![]}];}return db[_0x86ab('0x2d')][_0x86ab('0x44')](_0x4eb5cf);})[_0x86ab('0x24')](function(_0x27ce58){_0x4381ea['rows']=_0x27ce58;return _0x4381ea;})[_0x86ab('0x24')](respondWithFilteredResult(_0x1e2820,_0x4eb5cf))[_0x86ab('0x45')](handleError(_0x1e2820,null));};exports[_0x86ab('0x46')]=function(_0x3afd5c,_0x230cce){var _0x31123d={'raw':![],'where':{'id':_0x3afd5c[_0x86ab('0x47')]['id']}},_0x454135={};_0x454135[_0x86ab('0x30')]=_[_0x86ab('0x31')](db['CmList'][_0x86ab('0x48')]);_0x454135[_0x86ab('0x32')]=_['keys'](_0x3afd5c['query']);_0x454135[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x454135['model'],_0x454135[_0x86ab('0x32')]);_0x31123d['attributes']=_[_0x86ab('0x33')](_0x454135[_0x86ab('0x30')],qs[_0x86ab('0x49')](_0x3afd5c['query'][_0x86ab('0x49')]));_0x31123d[_0x86ab('0x34')]=_0x31123d[_0x86ab('0x34')][_0x86ab('0x35')]?_0x31123d[_0x86ab('0x34')]:_0x454135['model'];if(_0x3afd5c['query']['includeAll']){_0x31123d[_0x86ab('0x43')]=[{'all':!![]}];}_0x31123d=_[_0x86ab('0x3f')]({},_0x31123d,_0x3afd5c[_0x86ab('0x41')]);return db[_0x86ab('0x2d')][_0x86ab('0x4a')](_0x31123d)[_0x86ab('0x24')](handleEntityNotFound(_0x230cce,null))[_0x86ab('0x24')](respondWithResult(_0x230cce,null))['catch'](handleError(_0x230cce,null));};exports[_0x86ab('0x4b')]=function(_0x3379e3,_0x5c4a92){return db['CmList'][_0x86ab('0x4b')](_0x3379e3[_0x86ab('0x4c')],{})['then'](function(_0x5b2e82){var _0x295a41=_0x3379e3[_0x86ab('0x4d')][_0x86ab('0x4e')]({'plain':!![]});if(!_0x295a41)throw new Error(_0x86ab('0x4f'));if(_0x295a41[_0x86ab('0x50')]===_0x86ab('0x4d')){var _0x583133=_0x5b2e82[_0x86ab('0x4e')]({'plain':!![]});var _0x11b6d0=_0x86ab('0x51');return db[_0x86ab('0x52')][_0x86ab('0x4a')]({'where':{'name':_0x11b6d0,'userProfileId':_0x295a41['userProfileId']},'raw':!![]})['then'](function(_0x412887){if(_0x412887&&_0x412887['autoAssociation']===0x0){return db[_0x86ab('0x26')][_0x86ab('0x4b')]({'name':_0x583133[_0x86ab('0x29')],'resourceId':_0x583133['id'],'type':_0x412887[_0x86ab('0x29')],'sectionId':_0x412887['id']},{})['then'](function(){return _0x5b2e82;});}else{return _0x5b2e82;}})[_0x86ab('0x45')](function(_0x16a9ca){logger[_0x86ab('0x27')](_0x86ab('0x53'),_0x16a9ca);throw _0x16a9ca;});}return _0x5b2e82;})[_0x86ab('0x24')](respondWithResult(_0x5c4a92,0xc9))[_0x86ab('0x45')](handleError(_0x5c4a92,null));};exports[_0x86ab('0x54')]=function(_0xa933f5,_0x122d9b){if(_0xa933f5['body']['id']){delete _0xa933f5[_0x86ab('0x4c')]['id'];}return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0xa933f5['params']['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x122d9b,null))[_0x86ab('0x24')](saveUpdates(_0xa933f5[_0x86ab('0x4c')],null))['then'](respondWithResult(_0x122d9b,null))[_0x86ab('0x45')](handleError(_0x122d9b,null));};exports[_0x86ab('0x25')]=function(_0x4c40b5,_0x54cd9e){return db[_0x86ab('0x2d')]['find']({'where':{'id':_0x4c40b5[_0x86ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x54cd9e,null))[_0x86ab('0x24')](removeEntity(_0x54cd9e,null))[_0x86ab('0x45')](handleError(_0x54cd9e,null));};exports['describe']=function(_0x15e1ad,_0x157505){return db[_0x86ab('0x2d')]['describe']()[_0x86ab('0x24')](respondWithResult(_0x157505,null))[_0x86ab('0x45')](handleError(_0x157505,null));};exports['addDisposition']=function(_0x54f920,_0x1002dc,_0x343320){if(_0x54f920[_0x86ab('0x4c')]['id']){delete _0x54f920['body']['id'];}return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0x54f920[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x1002dc,null))[_0x86ab('0x24')](function(_0x65950f){if(_0x65950f){_0x54f920['body'][_0x86ab('0x55')]=_0x65950f['id'];return db['Disposition'][_0x86ab('0x4b')](_0x54f920['body']);}})['then'](respondWithResult(_0x1002dc,null))[_0x86ab('0x45')](handleError(_0x1002dc,null));};exports[_0x86ab('0x56')]=function(_0x20bb33,_0x186eae,_0x154cd0){var _0x21017e={'raw':![],'where':{}};var _0x2d8c15={};var _0x3479b9={'count':0x0,'rows':[]};return db[_0x86ab('0x2d')][_0x86ab('0x57')]({'where':{'id':_0x20bb33[_0x86ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x186eae,null))[_0x86ab('0x24')](function(_0x39f174){if(_0x39f174){_0x2d8c15['model']=_[_0x86ab('0x31')](db['Disposition'][_0x86ab('0x48')]);_0x2d8c15[_0x86ab('0x32')]=_[_0x86ab('0x31')](_0x20bb33[_0x86ab('0x32')]);_0x2d8c15[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x2d8c15['model'],_0x2d8c15[_0x86ab('0x32')]);_0x21017e[_0x86ab('0x34')]=_[_0x86ab('0x33')](_0x2d8c15[_0x86ab('0x30')],qs[_0x86ab('0x49')](_0x20bb33['query'][_0x86ab('0x49')]));_0x21017e[_0x86ab('0x34')]=_0x21017e[_0x86ab('0x34')][_0x86ab('0x35')]?_0x21017e[_0x86ab('0x34')]:_0x2d8c15['model'];if(!_0x20bb33[_0x86ab('0x32')][_0x86ab('0x36')](_0x86ab('0x37'))){_0x21017e[_0x86ab('0x38')]=qs['limit'](_0x20bb33[_0x86ab('0x32')][_0x86ab('0x38')]);_0x21017e['offset']=qs[_0x86ab('0x1e')](_0x20bb33[_0x86ab('0x32')][_0x86ab('0x1e')]);}_0x21017e[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x20bb33[_0x86ab('0x32')]['sort']);_0x21017e['where']=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x20bb33['query'],_0x2d8c15[_0x86ab('0x3c')]));_0x21017e['where'][_0x86ab('0x55')]=_0x39f174['id'];if(_0x20bb33[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x21017e[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x21017e['where'],{'$or':_['map'](_0x21017e['attributes'],function(_0x491032){var _0x5690c0={};_0x5690c0[_0x491032]={'$like':'%'+_0x20bb33['query'][_0x86ab('0x3d')]+'%'};return _0x5690c0;})});}_0x21017e=_[_0x86ab('0x3f')]({},_0x21017e,_0x20bb33[_0x86ab('0x41')]);return db['Disposition'][_0x86ab('0x42')]({'where':_0x21017e[_0x86ab('0x3e')]})[_0x86ab('0x24')](function(_0x33037f){_0x3479b9[_0x86ab('0x42')]=_0x33037f;if(_0x20bb33[_0x86ab('0x32')][_0x86ab('0x58')]){_0x21017e[_0x86ab('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x86ab('0x44')](_0x21017e);})['then'](function(_0x5760ba){_0x3479b9[_0x86ab('0x59')]=_0x5760ba;return _0x3479b9;});}})[_0x86ab('0x24')](respondWithFilteredResult(_0x186eae,_0x21017e))[_0x86ab('0x45')](handleError(_0x186eae,null));};exports[_0x86ab('0x5a')]=function(_0x515fcb,_0x147907,_0x5aa12c){return db[_0x86ab('0x2d')][_0x86ab('0x4a')]({'where':{'id':_0x515fcb[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x147907,null))['then'](function(_0x30b4f6){if(_0x30b4f6){return _0x30b4f6[_0x86ab('0x5a')](_0x515fcb[_0x86ab('0x32')]['ids']);}})[_0x86ab('0x24')](respondWithStatusCode(_0x147907,null))[_0x86ab('0x45')](handleError(_0x147907,null));};exports[_0x86ab('0x5b')]=function(_0x6277dd,_0x1dac30,_0x33269e){return db[_0x86ab('0x2d')][_0x86ab('0x4a')]({'where':{'id':_0x6277dd['params']['id']}})['then'](handleEntityNotFound(_0x1dac30,null))['then'](function(_0x2e31bf){if(_0x2e31bf){var _0x2704fa=[];var _0x58b04d={'success':[],'errors':[]};return db[_0x86ab('0x5c')][_0x86ab('0x5d')]()[_0x86ab('0x24')](function(_0x14614f){if(_0x6277dd[_0x86ab('0x4c')][_0x86ab('0x5e')]&&_[_0x86ab('0x5f')](_0x6277dd['body'][_0x86ab('0x5e')])){if(_0x6277dd[_0x86ab('0x4c')]['tags'][_0x86ab('0x35')]){_0x6277dd[_0x86ab('0x4c')][_0x86ab('0x5e')]=_0x6277dd[_0x86ab('0x4c')][_0x86ab('0x5e')][_0x86ab('0x60')](';')+';';}else{_0x6277dd[_0x86ab('0x4c')]['tags']=null;}}else{_0x6277dd[_0x86ab('0x4c')]['tags']=null;}if(_0x6277dd[_0x86ab('0x4c')]&&_['isArray'](_0x6277dd['body'])){for(var _0xeffebe=0x0;_0xeffebe<_0x6277dd['body'][_0x86ab('0x35')];_0xeffebe+=0x1){_0x6277dd[_0x86ab('0x4c')][_0xeffebe][_0x86ab('0x55')]=_0x6277dd['params']['id'];_0x2704fa[_0x86ab('0x61')](_0x6277dd[_0x86ab('0x4c')][_0xeffebe]);}return BPromise[_0x86ab('0x62')](_0x2704fa,function(_0x2c6b19){return db[_0x86ab('0x5c')][_0x86ab('0x4b')](_[_0x86ab('0x63')](_0x2c6b19,[_0x86ab('0x64'),'id'])||{},{'fields':_[_0x86ab('0x31')](_0x14614f),'raw':!![]})[_0x86ab('0x24')](function(_0xb4dda8){_0x58b04d[_0x86ab('0x65')][_0x86ab('0x61')](_0xb4dda8[_0x86ab('0x66')]);})[_0x86ab('0x45')](function(_0x2b78f8){_0x58b04d[_0x86ab('0x67')][_0x86ab('0x61')]({'data':_0x2c6b19,'error':_0x2b78f8['message']});});})[_0x86ab('0x24')](function(_0x2b2140){return _0x58b04d;})['catch'](function(_0xbab1f9){return _0xbab1f9;});}else{_0x1dac30[_0x86ab('0x1b')](0x190)['json']({'message':_0x86ab('0x68')});}});}})['then'](respondWithResult(_0x1dac30,null))[_0x86ab('0x45')](handleError(_0x1dac30,null));};exports[_0x86ab('0x69')]=function(_0x4f3eb3,_0x310134,_0x11fafb){var _0x11e251;return db[_0x86ab('0x2d')][_0x86ab('0x4a')]({'where':{'id':_0x4f3eb3['params']['id']},'include':[{'model':db[_0x86ab('0x6a')],'as':_0x86ab('0x6b')}]})[_0x86ab('0x24')](handleEntityNotFound(_0x310134,null))[_0x86ab('0x24')](function(_0x514273){if(_0x514273){_0x11e251=_0x514273;return db[_0x86ab('0x5c')][_0x86ab('0x48')];}})['then'](function(_0x56a6ba){if(_0x56a6ba){var _0x23ca9a={};var _0x11842e={};_0x11842e[_0x86ab('0x30')]=_[_0x86ab('0x6c')](_[_0x86ab('0x31')](_0x56a6ba),_[_0x86ab('0x2c')](_0x11e251['CustomFields'],function(_0x432de1){return util[_0x86ab('0x6d')](_0x86ab('0x6e'),_0x432de1['id']);}));_0x11842e[_0x86ab('0x32')]=_[_0x86ab('0x31')](_0x4f3eb3[_0x86ab('0x32')]);_0x11842e[_0x86ab('0x3c')]=_['intersection'](_0x11842e['model'],_0x11842e[_0x86ab('0x32')]);_0x23ca9a['attributes']=_[_0x86ab('0x33')](_0x11842e['model'],qs[_0x86ab('0x49')](_0x4f3eb3[_0x86ab('0x32')][_0x86ab('0x49')]));_0x23ca9a[_0x86ab('0x34')]=_0x23ca9a['attributes'][_0x86ab('0x35')]?_0x23ca9a[_0x86ab('0x34')]:_0x11842e['model'];if(!_0x4f3eb3[_0x86ab('0x32')]['hasOwnProperty']('nolimit')){_0x23ca9a[_0x86ab('0x38')]=qs[_0x86ab('0x38')](_0x4f3eb3['query'][_0x86ab('0x38')]);_0x23ca9a[_0x86ab('0x1e')]=qs[_0x86ab('0x1e')](_0x4f3eb3[_0x86ab('0x32')][_0x86ab('0x1e')]);}_0x23ca9a[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x4f3eb3[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x23ca9a['where']=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x4f3eb3[_0x86ab('0x32')],_0x11842e[_0x86ab('0x3c')]));_0x23ca9a[_0x86ab('0x6f')]=!![];if(_0x4f3eb3[_0x86ab('0x32')]['filter']){_0x23ca9a[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x23ca9a[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0x23ca9a[_0x86ab('0x34')],function(_0x41f53f){var _0x463a06={};_0x463a06[_0x41f53f]={'$like':'%'+_0x4f3eb3[_0x86ab('0x32')]['filter']+'%'};return _0x463a06;})});}_0x23ca9a=_[_0x86ab('0x3f')]({},_0x23ca9a,_0x4f3eb3[_0x86ab('0x41')]);return _0x11e251[_0x86ab('0x69')](_0x23ca9a);}})[_0x86ab('0x24')](respondWithResult(_0x310134,null))[_0x86ab('0x45')](handleError(_0x310134,null));};exports[_0x86ab('0x70')]=function(_0x495273,_0x11529c,_0x715afb){var _0x57f9f8;return db['CmList']['find']({'where':{'id':_0x495273[_0x86ab('0x47')]['id']},'include':[{'model':db[_0x86ab('0x6a')],'as':_0x86ab('0x6b')}]})[_0x86ab('0x24')](handleEntityNotFound(_0x11529c,null))[_0x86ab('0x24')](function(_0x585987){if(_0x585987){_0x57f9f8=_0x585987;return db[_0x86ab('0x5c')][_0x86ab('0x48')];}})[_0x86ab('0x24')](function(_0x3fc161){if(_0x3fc161){var _0x1521dc={};var _0x2a2729={};_0x2a2729[_0x86ab('0x30')]=_[_0x86ab('0x6c')](_[_0x86ab('0x31')](_0x3fc161),_[_0x86ab('0x2c')](_0x57f9f8[_0x86ab('0x6b')],function(_0x4fde3d){return util[_0x86ab('0x6d')](_0x86ab('0x6e'),_0x4fde3d['id']);}));_0x2a2729['query']=_['keys'](_0x495273[_0x86ab('0x32')]);_0x2a2729[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x2a2729[_0x86ab('0x30')],_0x2a2729['query']);_0x1521dc[_0x86ab('0x34')]=_[_0x86ab('0x33')](_0x2a2729[_0x86ab('0x30')],qs['fields'](_0x495273['query']['fields']));_0x1521dc[_0x86ab('0x34')]=_0x1521dc[_0x86ab('0x34')]['length']?_0x1521dc[_0x86ab('0x34')]:_0x2a2729[_0x86ab('0x30')];if(!_0x495273['query']['hasOwnProperty'](_0x86ab('0x37'))){_0x1521dc['limit']=qs[_0x86ab('0x38')](_0x495273[_0x86ab('0x32')][_0x86ab('0x38')]);_0x1521dc[_0x86ab('0x1e')]=qs[_0x86ab('0x1e')](_0x495273[_0x86ab('0x32')]['offset']);}_0x1521dc[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x495273[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x1521dc[_0x86ab('0x3e')]=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x495273[_0x86ab('0x32')],_0x2a2729[_0x86ab('0x3c')]));_0x1521dc['raw']=!![];if(_0x495273[_0x86ab('0x32')]['filter']){_0x1521dc['where']=_[_0x86ab('0x3f')](_0x1521dc[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0x1521dc[_0x86ab('0x34')],function(_0x19ef0d){var _0x5bcae6={};_0x5bcae6[_0x19ef0d]={'$like':'%'+_0x495273[_0x86ab('0x32')][_0x86ab('0x3d')]+'%'};return _0x5bcae6;})});}_0x1521dc=_[_0x86ab('0x3f')]({},_0x1521dc,_0x495273[_0x86ab('0x41')]);return _0x57f9f8[_0x86ab('0x69')](_0x1521dc);}})['then'](function(_0x42e96e){if(!_[_0x86ab('0x71')](_0x42e96e)){var _0x2e4583=toCsv(_0x42e96e);var _0x30b727=Date[_0x86ab('0x72')]();fs['writeFileSync'](util[_0x86ab('0x6d')](_0x86ab('0x73'),_0x57f9f8['id'],_0x30b727),_0x2e4583);_0x11529c[_0x86ab('0x74')]('Content-disposition','attachment;\x20filename='+util['format'](_0x86ab('0x75'),_0x57f9f8['id'],_0x30b727));_0x11529c[_0x86ab('0x74')](_0x86ab('0x76'),_0x86ab('0x77'));return _0x11529c[_0x86ab('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x57f9f8['id'],_0x30b727));}else{return _0x11529c[_0x86ab('0x1a')](0xcc);}})[_0x86ab('0x45')](handleError(_0x11529c,null));};exports[_0x86ab('0x79')]=function(_0xee07fb,_0x35d2c7,_0x266e99){var _0x142afd;delete _0xee07fb['body']['id'];return db[_0x86ab('0x2d')]['findOne']({'where':{'id':_0xee07fb[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x35d2c7,null))['then'](function(_0xa3df47){if(_0xa3df47){return db[_0x86ab('0x7a')]['transaction'](function(_0x199934){return db[_0x86ab('0x6a')][_0x86ab('0x4b')](_0xee07fb[_0x86ab('0x4c')],{'transaction':_0x199934})[_0x86ab('0x24')](function(_0x4cd970){_0x142afd=_0x4cd970;return _0xa3df47[_0x86ab('0x7b')](_0x4cd970,{'transaction':_0x199934});})[_0x86ab('0x24')](function(){var _0x5e1d93={'type':db[_0x86ab('0x7c')][_0x86ab('0x7d')],'transaction':_0x199934};switch(_0xee07fb[_0x86ab('0x4c')][_0x86ab('0x2f')]){case _0x86ab('0x7e'):_0x5e1d93[_0x86ab('0x2f')]=db[_0x86ab('0x7c')][_0x86ab('0x7d')];break;case _0x86ab('0x7f'):_0x5e1d93[_0x86ab('0x2f')]=db['Sequelize']['INTEGER'];break;case _0x86ab('0x80'):_0x5e1d93[_0x86ab('0x2f')]=db[_0x86ab('0x7c')][_0x86ab('0x81')];_0x5e1d93[_0x86ab('0x82')]=![];break;default:}return db[_0x86ab('0x7a')][_0x86ab('0x83')]['addColumn'](_0x86ab('0x84'),util['format']('cf_%s',_0x142afd['id']),_0x5e1d93);})[_0x86ab('0x24')](function(){return _0x142afd;});});}})['then'](respondWithResult(_0x35d2c7,null))[_0x86ab('0x45')](handleError(_0x35d2c7,null));};exports['getCustomFields']=function(_0x293b77,_0x59b664,_0x25eac7){var _0x4640e7={};var _0x2ee4e1={};var _0x4f0071;var _0x49f2f8;return db['CmList'][_0x86ab('0x57')]({'where':{'id':_0x293b77[_0x86ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x59b664,null))[_0x86ab('0x24')](function(_0x31dbf0){if(_0x31dbf0){_0x4f0071=_0x31dbf0;_0x2ee4e1[_0x86ab('0x30')]=_[_0x86ab('0x31')](db[_0x86ab('0x6a')]['rawAttributes']);_0x2ee4e1['query']=_['keys'](_0x293b77[_0x86ab('0x32')]);_0x2ee4e1[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x2ee4e1[_0x86ab('0x30')],_0x2ee4e1[_0x86ab('0x32')]);_0x4640e7['attributes']=_['intersection'](_0x2ee4e1[_0x86ab('0x30')],qs[_0x86ab('0x49')](_0x293b77[_0x86ab('0x32')][_0x86ab('0x49')]));_0x4640e7['attributes']=_0x4640e7['attributes'][_0x86ab('0x35')]?_0x4640e7[_0x86ab('0x34')]:_0x2ee4e1[_0x86ab('0x30')];_0x4640e7[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x293b77[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x4640e7['where']=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x293b77[_0x86ab('0x32')],_0x2ee4e1[_0x86ab('0x3c')]));_0x4640e7['where']=_[_0x86ab('0x3f')](_0x4640e7[_0x86ab('0x3e')],{'$or':[{'ListId':_0x31dbf0['id']},{'ListId':null}]});if(_0x293b77[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x4640e7[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x4640e7[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0x4640e7['attributes'],function(_0x58e6b9){var _0x4570ab={};_0x4570ab[_0x58e6b9]={'$like':'%'+_0x293b77[_0x86ab('0x32')][_0x86ab('0x3d')]+'%'};return _0x4570ab;})});}_0x4640e7=_[_0x86ab('0x3f')]({},_0x4640e7,_0x293b77[_0x86ab('0x41')]);return db[_0x86ab('0x6a')]['findAndCountAll'](_0x4640e7);}})[_0x86ab('0x24')](respondWithResult(_0x59b664,null))[_0x86ab('0x45')](handleError(_0x59b664,null));};exports[_0x86ab('0x85')]=function(_0x772232,_0x58174a,_0x4b53cb){return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0x772232[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x58174a,null))['then'](function(_0x1fbf87){if(_0x1fbf87){return _0x1fbf87['addAgents'](_0x772232[_0x86ab('0x4c')][_0x86ab('0x64')],_[_0x86ab('0x63')](_0x772232['body'],[_0x86ab('0x64'),'id'])||{})['spread'](function(_0x1c7930){for(var _0xa8c4ca=0x0;_0xa8c4ca<_0x772232['body'][_0x86ab('0x64')][_0x86ab('0x35')];_0xa8c4ca+=0x1){socket[_0x86ab('0x86')](_0x86ab('0x87'),{'UserId':_0x772232[_0x86ab('0x4c')][_0x86ab('0x64')][_0xa8c4ca],'CmListId':_0x772232[_0x86ab('0x47')]['id']});}return _0x1c7930;});}})[_0x86ab('0x24')](respondWithResult(_0x58174a,null))[_0x86ab('0x45')](handleError(_0x58174a,null));};exports[_0x86ab('0x88')]=function(_0x5a508c,_0xdf0bb5,_0x356e94){return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0x5a508c[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0xdf0bb5,null))[_0x86ab('0x24')](function(_0x2f14b4){if(_0x2f14b4){return _0x2f14b4['removeAgents'](_0x5a508c['query'][_0x86ab('0x64')])[_0x86ab('0x24')](function(){if(_[_0x86ab('0x5f')](_0x5a508c[_0x86ab('0x32')][_0x86ab('0x64')])){for(var _0x25ceef=0x0;_0x25ceef<_0x5a508c[_0x86ab('0x32')]['ids'][_0x86ab('0x35')];_0x25ceef+=0x1){socket[_0x86ab('0x86')](_0x86ab('0x89'),{'UserId':Number(_0x5a508c[_0x86ab('0x32')][_0x86ab('0x64')][_0x25ceef]),'CmListId':Number(_0x5a508c['params']['id'])});}}else{socket[_0x86ab('0x86')](_0x86ab('0x89'),{'UserId':Number(_0x5a508c['query']['ids']),'CmListId':Number(_0x5a508c['params']['id'])});}});}})[_0x86ab('0x24')](respondWithStatusCode(_0xdf0bb5,null))['catch'](handleError(_0xdf0bb5,null));};exports['getAgents']=function(_0x5e514c,_0x74b551,_0x1e4886){var _0x39e965={};var _0x51cf2e={};var _0x5f1b98;var _0x24d300;return db[_0x86ab('0x2d')][_0x86ab('0x57')]({'where':{'id':_0x5e514c[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x74b551,null))[_0x86ab('0x24')](function(_0x1339aa){if(_0x1339aa){_0x5f1b98=_0x1339aa;_0x51cf2e[_0x86ab('0x30')]=_[_0x86ab('0x31')](db[_0x86ab('0x8a')]['rawAttributes']);_0x51cf2e[_0x86ab('0x32')]=_[_0x86ab('0x31')](_0x5e514c[_0x86ab('0x32')]);_0x51cf2e[_0x86ab('0x3c')]=_['intersection'](_0x51cf2e['model'],_0x51cf2e[_0x86ab('0x32')]);_0x39e965[_0x86ab('0x34')]=_['intersection'](_0x51cf2e[_0x86ab('0x30')],qs['fields'](_0x5e514c[_0x86ab('0x32')][_0x86ab('0x49')]));_0x39e965['attributes']=_0x39e965[_0x86ab('0x34')][_0x86ab('0x35')]?_0x39e965[_0x86ab('0x34')]:_0x51cf2e[_0x86ab('0x30')];_0x39e965[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x5e514c[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x39e965['where']=qs[_0x86ab('0x3c')](_['pick'](_0x5e514c[_0x86ab('0x32')],_0x51cf2e['filters']));if(_0x5e514c[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x39e965[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x39e965[_0x86ab('0x3e')],{'$or':_['map'](_0x39e965[_0x86ab('0x34')],function(_0x10880f){var _0x120f89={};_0x120f89[_0x10880f]={'$like':'%'+_0x5e514c[_0x86ab('0x32')]['filter']+'%'};return _0x120f89;})});}_0x39e965=_['merge']({},_0x39e965,_0x5e514c['options']);return _0x5f1b98[_0x86ab('0x8b')](_0x39e965);}})[_0x86ab('0x24')](function(_0x10ac2b){if(_0x10ac2b){_0x24d300=_0x10ac2b[_0x86ab('0x35')];if(!_0x5e514c['query']['hasOwnProperty'](_0x86ab('0x37'))){_0x39e965[_0x86ab('0x38')]=qs[_0x86ab('0x38')](_0x5e514c['query'][_0x86ab('0x38')]);_0x39e965[_0x86ab('0x1e')]=qs[_0x86ab('0x1e')](_0x5e514c[_0x86ab('0x32')][_0x86ab('0x1e')]);}return _0x5f1b98[_0x86ab('0x8b')](_0x39e965);}})[_0x86ab('0x24')](function(_0x380c55){if(_0x380c55){return _0x380c55?{'count':_0x24d300,'rows':_0x380c55}:null;}})['then'](respondWithResult(_0x74b551,null))[_0x86ab('0x45')](handleError(_0x74b551,null));}; \ No newline at end of file +var _0xcca4=['update','describe','addDisposition','Disposition','ListId','count','findAll','rows','removeDispositions','isArray','tags','join','push','each','CmContact','ids','success','dataValues','message','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','order','getContacts','getContactsCsv','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','getCustomFields','findOne','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xaedebb,_0x4ff1b8){var _0x897990=function(_0x395d7b){while(--_0x395d7b){_0xaedebb['push'](_0xaedebb['shift']());}};_0x897990(++_0x4ff1b8);}(_0xcca4,0xcd));var _0x4cca=function(_0x33f66c,_0x21aa25){_0x33f66c=_0x33f66c-0x0;var _0xf868f2=_0xcca4[_0x33f66c];return _0xf868f2;};'use strict';var pdf=require(_0x4cca('0x0'));var emlformat=require(_0x4cca('0x1'));var rimraf=require(_0x4cca('0x2'));var zipdir=require(_0x4cca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4cca('0x4'));var moment=require(_0x4cca('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4cca('0x6'));var sox=require('sox');var csv=require(_0x4cca('0x7'));var ejs=require(_0x4cca('0x8'));var fs=require('fs');var _=require(_0x4cca('0x9'));var squel=require('squel');var crypto=require(_0x4cca('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4cca('0xb'));var toCsv=require(_0x4cca('0x7'));var querystring=require(_0x4cca('0xc'));var Papa=require(_0x4cca('0xd'));var Redis=require(_0x4cca('0xe'));var authService=require(_0x4cca('0xf'));var qs=require(_0x4cca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cca('0x11'));var logger=require(_0x4cca('0x12'))(_0x4cca('0x13'));var utils=require(_0x4cca('0x14'));var config=require(_0x4cca('0x15'));var db=require('../../mysqldb')['db'];config[_0x4cca('0x16')]=_[_0x4cca('0x17')](config[_0x4cca('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x4cca('0x18'))(new Redis(config[_0x4cca('0x16')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x2ea102,_0x145cf7){_0x145cf7=_0x145cf7||0xcc;return function(_0x1574aa){if(_0x1574aa){return _0x2ea102[_0x4cca('0x19')](_0x145cf7);}return _0x2ea102[_0x4cca('0x1a')](_0x145cf7)[_0x4cca('0x1b')]();};}function respondWithResult(_0x2634c5,_0x2cae2b){_0x2cae2b=_0x2cae2b||0xc8;return function(_0x2b30b1){if(_0x2b30b1){return _0x2634c5['status'](_0x2cae2b)[_0x4cca('0x1c')](_0x2b30b1);}};}function respondWithFilteredResult(_0x40c5fa,_0x272d0f){return function(_0x235e1a){if(_0x235e1a){var _0x1bff89=_0x235e1a['count'],_0xfba7e8=_0x272d0f[_0x4cca('0x1d')],_0x18ced7=_0x272d0f[_0x4cca('0x1d')]+_0x272d0f['limit'],_0x2e7c8e;if(_0x18ced7>=_0x1bff89){_0x18ced7=_0x1bff89;_0x2e7c8e=0xc8;}else{_0x2e7c8e=0xce;}_0x40c5fa[_0x4cca('0x1a')](_0x2e7c8e);return _0x40c5fa[_0x4cca('0x1e')](_0x4cca('0x1f'),_0xfba7e8+'-'+_0x18ced7+'/'+_0x1bff89)[_0x4cca('0x1c')](_0x235e1a);}return null;};}function patchUpdates(_0x1cfb54){return function(_0x13305d){try{jsonpatch['apply'](_0x13305d,_0x1cfb54,!![]);}catch(_0x366a12){return BPromise[_0x4cca('0x20')](_0x366a12);}return _0x13305d[_0x4cca('0x21')]();};}function saveUpdates(_0x265428,_0x506425){return function(_0x381da7){if(_0x381da7){return _0x381da7['update'](_0x265428)[_0x4cca('0x22')](function(_0x3c55f4){return _0x3c55f4;});}return null;};}function removeEntity(_0x65866,_0x1b3fc7){return function(_0x28a988){if(_0x28a988){return _0x28a988[_0x4cca('0x23')]()[_0x4cca('0x22')](function(){var _0x1dc801=_0x28a988[_0x4cca('0x24')]({'plain':!![]});var _0x2024b8='Lists';return db[_0x4cca('0x25')][_0x4cca('0x23')]({'where':{'type':_0x2024b8,'resourceId':_0x1dc801['id']}})[_0x4cca('0x22')](function(){return _0x28a988;});})[_0x4cca('0x22')](function(){_0x65866[_0x4cca('0x1a')](0xcc)[_0x4cca('0x1b')]();});}};}function handleEntityNotFound(_0x5149a7,_0x33135b){return function(_0x1949fc){if(!_0x1949fc){_0x5149a7[_0x4cca('0x19')](0x194);}return _0x1949fc;};}function handleError(_0x140cd4,_0x2c53bf){_0x2c53bf=_0x2c53bf||0x1f4;return function(_0x4e0dcb){logger[_0x4cca('0x26')](_0x4e0dcb[_0x4cca('0x27')]);if(_0x4e0dcb[_0x4cca('0x28')]){delete _0x4e0dcb['name'];}_0x140cd4[_0x4cca('0x1a')](_0x2c53bf)[_0x4cca('0x29')](_0x4e0dcb);};}exports[_0x4cca('0x2a')]=function(_0x3526a6,_0x35aae5){var _0x2efaca={},_0x35fd72={},_0xaa3e70={'count':0x0,'rows':[]};var _0x5d94d4=_[_0x4cca('0x2b')](db[_0x4cca('0x2c')][_0x4cca('0x2d')],function(_0x33c28a){return{'name':_0x33c28a[_0x4cca('0x2e')],'type':_0x33c28a[_0x4cca('0x2f')][_0x4cca('0x30')]};});_0x35fd72[_0x4cca('0x31')]=_[_0x4cca('0x2b')](_0x5d94d4,'name');_0x35fd72[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x3526a6['query']);_0x35fd72[_0x4cca('0x34')]=_[_0x4cca('0x35')](_0x35fd72['model'],_0x35fd72[_0x4cca('0x32')]);_0x2efaca[_0x4cca('0x36')]=_[_0x4cca('0x35')](_0x35fd72[_0x4cca('0x31')],qs[_0x4cca('0x37')](_0x3526a6[_0x4cca('0x32')]['fields']));_0x2efaca[_0x4cca('0x36')]=_0x2efaca[_0x4cca('0x36')][_0x4cca('0x38')]?_0x2efaca[_0x4cca('0x36')]:_0x35fd72[_0x4cca('0x31')];if(!_0x3526a6['query'][_0x4cca('0x39')](_0x4cca('0x3a'))){_0x2efaca['limit']=qs[_0x4cca('0x3b')](_0x3526a6['query'][_0x4cca('0x3b')]);_0x2efaca[_0x4cca('0x1d')]=qs[_0x4cca('0x1d')](_0x3526a6[_0x4cca('0x32')]['offset']);}_0x2efaca['order']=qs['sort'](_0x3526a6['query'][_0x4cca('0x3c')]);_0x2efaca[_0x4cca('0x3d')]=qs[_0x4cca('0x34')](_[_0x4cca('0x3e')](_0x3526a6[_0x4cca('0x32')],_0x35fd72['filters']),_0x5d94d4);if(_0x3526a6[_0x4cca('0x32')][_0x4cca('0x3f')]){_0x2efaca[_0x4cca('0x3d')]=_[_0x4cca('0x40')](_0x2efaca[_0x4cca('0x3d')],{'$or':_['map'](_0x5d94d4,function(_0x2cda25){if(_0x2cda25[_0x4cca('0x2f')]!==_0x4cca('0x41')){var _0x25f67e={};_0x25f67e[_0x2cda25['name']]={'$like':'%'+_0x3526a6[_0x4cca('0x32')]['filter']+'%'};return _0x25f67e;}})});}_0x2efaca=_[_0x4cca('0x40')]({},_0x2efaca,_0x3526a6[_0x4cca('0x42')]);var _0x3a6588={'where':_0x2efaca[_0x4cca('0x3d')]};return db[_0x4cca('0x2c')]['count'](_0x3a6588)[_0x4cca('0x22')](function(_0x3069a5){_0xaa3e70['count']=_0x3069a5;if(_0x3526a6[_0x4cca('0x32')][_0x4cca('0x43')]){_0x2efaca[_0x4cca('0x44')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x2efaca);})[_0x4cca('0x22')](function(_0x41ebbc){_0xaa3e70['rows']=_0x41ebbc;return _0xaa3e70;})[_0x4cca('0x22')](respondWithFilteredResult(_0x35aae5,_0x2efaca))[_0x4cca('0x45')](handleError(_0x35aae5,null));};exports['show']=function(_0x3b288e,_0x13c734){var _0x25a998={'raw':![],'where':{'id':_0x3b288e[_0x4cca('0x46')]['id']}},_0x584639={};_0x584639[_0x4cca('0x31')]=_[_0x4cca('0x33')](db[_0x4cca('0x2c')][_0x4cca('0x2d')]);_0x584639[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x3b288e[_0x4cca('0x32')]);_0x584639[_0x4cca('0x34')]=_['intersection'](_0x584639[_0x4cca('0x31')],_0x584639[_0x4cca('0x32')]);_0x25a998[_0x4cca('0x36')]=_[_0x4cca('0x35')](_0x584639['model'],qs[_0x4cca('0x37')](_0x3b288e['query']['fields']));_0x25a998[_0x4cca('0x36')]=_0x25a998[_0x4cca('0x36')][_0x4cca('0x38')]?_0x25a998['attributes']:_0x584639[_0x4cca('0x31')];if(_0x3b288e['query']['includeAll']){_0x25a998[_0x4cca('0x44')]=[{'all':!![]}];}_0x25a998=_[_0x4cca('0x40')]({},_0x25a998,_0x3b288e[_0x4cca('0x42')]);return db[_0x4cca('0x2c')][_0x4cca('0x47')](_0x25a998)[_0x4cca('0x22')](handleEntityNotFound(_0x13c734,null))['then'](respondWithResult(_0x13c734,null))[_0x4cca('0x45')](handleError(_0x13c734,null));};exports[_0x4cca('0x48')]=function(_0x778b31,_0x1aa588){return db[_0x4cca('0x2c')]['create'](_0x778b31[_0x4cca('0x49')],{})['then'](function(_0xa9696){var _0x4add97=_0x778b31[_0x4cca('0x4a')][_0x4cca('0x24')]({'plain':!![]});if(!_0x4add97)throw new Error(_0x4cca('0x4b'));if(_0x4add97[_0x4cca('0x4c')]===_0x4cca('0x4a')){var _0x34a952=_0xa9696[_0x4cca('0x24')]({'plain':!![]});var _0xc48343=_0x4cca('0x4d');return db[_0x4cca('0x4e')][_0x4cca('0x47')]({'where':{'name':_0xc48343,'userProfileId':_0x4add97[_0x4cca('0x4f')]},'raw':!![]})['then'](function(_0x5725bf){if(_0x5725bf&&_0x5725bf['autoAssociation']===0x0){return db[_0x4cca('0x25')][_0x4cca('0x48')]({'name':_0x34a952[_0x4cca('0x28')],'resourceId':_0x34a952['id'],'type':_0x5725bf['name'],'sectionId':_0x5725bf['id']},{})[_0x4cca('0x22')](function(){return _0xa9696;});}else{return _0xa9696;}})['catch'](function(_0xf39cf0){logger[_0x4cca('0x26')](_0x4cca('0x50'),_0xf39cf0);throw _0xf39cf0;});}return _0xa9696;})[_0x4cca('0x22')](respondWithResult(_0x1aa588,0xc9))[_0x4cca('0x45')](handleError(_0x1aa588,null));};exports[_0x4cca('0x51')]=function(_0xe3d9d5,_0x2036b3){if(_0xe3d9d5[_0x4cca('0x49')]['id']){delete _0xe3d9d5[_0x4cca('0x49')]['id'];}return db[_0x4cca('0x2c')][_0x4cca('0x47')]({'where':{'id':_0xe3d9d5[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x2036b3,null))[_0x4cca('0x22')](saveUpdates(_0xe3d9d5[_0x4cca('0x49')],null))['then'](respondWithResult(_0x2036b3,null))[_0x4cca('0x45')](handleError(_0x2036b3,null));};exports['destroy']=function(_0x4e1c08,_0x2f4f89){return db[_0x4cca('0x2c')]['find']({'where':{'id':_0x4e1c08[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x2f4f89,null))[_0x4cca('0x22')](removeEntity(_0x2f4f89,null))[_0x4cca('0x45')](handleError(_0x2f4f89,null));};exports[_0x4cca('0x52')]=function(_0xc04cb6,_0x30330c){return db[_0x4cca('0x2c')][_0x4cca('0x52')]()[_0x4cca('0x22')](respondWithResult(_0x30330c,null))['catch'](handleError(_0x30330c,null));};exports[_0x4cca('0x53')]=function(_0x13d267,_0x59b134,_0x4cf0b3){if(_0x13d267[_0x4cca('0x49')]['id']){delete _0x13d267[_0x4cca('0x49')]['id'];}return db[_0x4cca('0x2c')]['find']({'where':{'id':_0x13d267['params']['id']}})['then'](handleEntityNotFound(_0x59b134,null))[_0x4cca('0x22')](function(_0x81b84d){if(_0x81b84d){_0x13d267[_0x4cca('0x49')]['ListId']=_0x81b84d['id'];return db['Disposition'][_0x4cca('0x48')](_0x13d267[_0x4cca('0x49')]);}})[_0x4cca('0x22')](respondWithResult(_0x59b134,null))[_0x4cca('0x45')](handleError(_0x59b134,null));};exports['getDispositions']=function(_0x613fbd,_0x1d7666,_0x41f0d0){var _0x1a39b0={'raw':![],'where':{}};var _0x102af0={};var _0x44c023={'count':0x0,'rows':[]};return db[_0x4cca('0x2c')]['findOne']({'where':{'id':_0x613fbd[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x1d7666,null))[_0x4cca('0x22')](function(_0x1d9f08){if(_0x1d9f08){_0x102af0[_0x4cca('0x31')]=_[_0x4cca('0x33')](db[_0x4cca('0x54')][_0x4cca('0x2d')]);_0x102af0[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x613fbd[_0x4cca('0x32')]);_0x102af0[_0x4cca('0x34')]=_[_0x4cca('0x35')](_0x102af0[_0x4cca('0x31')],_0x102af0[_0x4cca('0x32')]);_0x1a39b0[_0x4cca('0x36')]=_[_0x4cca('0x35')](_0x102af0['model'],qs[_0x4cca('0x37')](_0x613fbd[_0x4cca('0x32')]['fields']));_0x1a39b0[_0x4cca('0x36')]=_0x1a39b0['attributes'][_0x4cca('0x38')]?_0x1a39b0[_0x4cca('0x36')]:_0x102af0[_0x4cca('0x31')];if(!_0x613fbd[_0x4cca('0x32')]['hasOwnProperty'](_0x4cca('0x3a'))){_0x1a39b0['limit']=qs[_0x4cca('0x3b')](_0x613fbd[_0x4cca('0x32')][_0x4cca('0x3b')]);_0x1a39b0['offset']=qs[_0x4cca('0x1d')](_0x613fbd[_0x4cca('0x32')][_0x4cca('0x1d')]);}_0x1a39b0['order']=qs[_0x4cca('0x3c')](_0x613fbd[_0x4cca('0x32')][_0x4cca('0x3c')]);_0x1a39b0[_0x4cca('0x3d')]=qs[_0x4cca('0x34')](_[_0x4cca('0x3e')](_0x613fbd[_0x4cca('0x32')],_0x102af0[_0x4cca('0x34')]));_0x1a39b0[_0x4cca('0x3d')][_0x4cca('0x55')]=_0x1d9f08['id'];if(_0x613fbd[_0x4cca('0x32')][_0x4cca('0x3f')]){_0x1a39b0['where']=_[_0x4cca('0x40')](_0x1a39b0[_0x4cca('0x3d')],{'$or':_[_0x4cca('0x2b')](_0x1a39b0[_0x4cca('0x36')],function(_0x1ddeee){var _0x50a777={};_0x50a777[_0x1ddeee]={'$like':'%'+_0x613fbd[_0x4cca('0x32')]['filter']+'%'};return _0x50a777;})});}_0x1a39b0=_[_0x4cca('0x40')]({},_0x1a39b0,_0x613fbd[_0x4cca('0x42')]);return db[_0x4cca('0x54')][_0x4cca('0x56')]({'where':_0x1a39b0[_0x4cca('0x3d')]})['then'](function(_0x23a259){_0x44c023[_0x4cca('0x56')]=_0x23a259;if(_0x613fbd[_0x4cca('0x32')][_0x4cca('0x43')]){_0x1a39b0['include']=[{'all':!![]}];}return db[_0x4cca('0x54')][_0x4cca('0x57')](_0x1a39b0);})[_0x4cca('0x22')](function(_0x5aaad1){_0x44c023[_0x4cca('0x58')]=_0x5aaad1;return _0x44c023;});}})[_0x4cca('0x22')](respondWithFilteredResult(_0x1d7666,_0x1a39b0))['catch'](handleError(_0x1d7666,null));};exports[_0x4cca('0x59')]=function(_0x478535,_0x3fee4a,_0x591ed6){return db[_0x4cca('0x2c')][_0x4cca('0x47')]({'where':{'id':_0x478535[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x3fee4a,null))[_0x4cca('0x22')](function(_0x4fd179){if(_0x4fd179){return _0x4fd179[_0x4cca('0x59')](_0x478535[_0x4cca('0x32')]['ids']);}})[_0x4cca('0x22')](respondWithStatusCode(_0x3fee4a,null))[_0x4cca('0x45')](handleError(_0x3fee4a,null));};exports['addContacts']=function(_0x12f792,_0x4afa0c,_0x441660){return db['CmList'][_0x4cca('0x47')]({'where':{'id':_0x12f792[_0x4cca('0x46')]['id']}})['then'](handleEntityNotFound(_0x4afa0c,null))[_0x4cca('0x22')](function(_0x19df99){if(_0x19df99){var _0x123536=[];var _0x34b755={'success':[],'errors':[]};return db['CmContact'][_0x4cca('0x52')]()[_0x4cca('0x22')](function(_0x46bf24){if(_0x12f792[_0x4cca('0x49')]['tags']&&_[_0x4cca('0x5a')](_0x12f792[_0x4cca('0x49')][_0x4cca('0x5b')])){if(_0x12f792['body'][_0x4cca('0x5b')][_0x4cca('0x38')]){_0x12f792[_0x4cca('0x49')][_0x4cca('0x5b')]=_0x12f792[_0x4cca('0x49')][_0x4cca('0x5b')][_0x4cca('0x5c')](';')+';';}else{_0x12f792[_0x4cca('0x49')][_0x4cca('0x5b')]=null;}}else{_0x12f792[_0x4cca('0x49')][_0x4cca('0x5b')]=null;}if(_0x12f792[_0x4cca('0x49')]&&_[_0x4cca('0x5a')](_0x12f792[_0x4cca('0x49')])){for(var _0x23cd54=0x0;_0x23cd54<_0x12f792[_0x4cca('0x49')][_0x4cca('0x38')];_0x23cd54+=0x1){_0x12f792[_0x4cca('0x49')][_0x23cd54][_0x4cca('0x55')]=_0x12f792[_0x4cca('0x46')]['id'];_0x123536[_0x4cca('0x5d')](_0x12f792[_0x4cca('0x49')][_0x23cd54]);}return BPromise[_0x4cca('0x5e')](_0x123536,function(_0x4ad308){return db[_0x4cca('0x5f')]['create'](_['omit'](_0x4ad308,[_0x4cca('0x60'),'id'])||{},{'fields':_[_0x4cca('0x33')](_0x46bf24),'raw':!![]})[_0x4cca('0x22')](function(_0x5c0175){_0x34b755[_0x4cca('0x61')][_0x4cca('0x5d')](_0x5c0175[_0x4cca('0x62')]);})[_0x4cca('0x45')](function(_0x123900){_0x34b755['errors']['push']({'data':_0x4ad308,'error':_0x123900[_0x4cca('0x63')]});});})[_0x4cca('0x22')](function(_0x54265f){return _0x34b755;})['catch'](function(_0x241633){return _0x241633;});}else{_0x4afa0c['status'](0x190)[_0x4cca('0x1c')]({'message':_0x4cca('0x64')});}});}})[_0x4cca('0x22')](respondWithResult(_0x4afa0c,null))[_0x4cca('0x45')](handleError(_0x4afa0c,null));};exports['getContacts']=function(_0x3b23ab,_0x236e4b,_0x173960){var _0x317517;return db['CmList']['find']({'where':{'id':_0x3b23ab[_0x4cca('0x46')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4cca('0x65')}]})[_0x4cca('0x22')](handleEntityNotFound(_0x236e4b,null))[_0x4cca('0x22')](function(_0x42ef4d){if(_0x42ef4d){_0x317517=_0x42ef4d;return db[_0x4cca('0x5f')][_0x4cca('0x2d')];}})[_0x4cca('0x22')](function(_0x352abf){if(_0x352abf){var _0x1ffdc9={};var _0x4bae1c={};_0x4bae1c[_0x4cca('0x31')]=_[_0x4cca('0x66')](_[_0x4cca('0x33')](_0x352abf),_['map'](_0x317517[_0x4cca('0x65')],function(_0x3368a0){return util[_0x4cca('0x67')](_0x4cca('0x68'),_0x3368a0['id']);}));_0x4bae1c[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x3b23ab[_0x4cca('0x32')]);_0x4bae1c[_0x4cca('0x34')]=_[_0x4cca('0x35')](_0x4bae1c[_0x4cca('0x31')],_0x4bae1c['query']);_0x1ffdc9['attributes']=_[_0x4cca('0x35')](_0x4bae1c[_0x4cca('0x31')],qs[_0x4cca('0x37')](_0x3b23ab[_0x4cca('0x32')][_0x4cca('0x37')]));_0x1ffdc9[_0x4cca('0x36')]=_0x1ffdc9[_0x4cca('0x36')][_0x4cca('0x38')]?_0x1ffdc9[_0x4cca('0x36')]:_0x4bae1c[_0x4cca('0x31')];if(!_0x3b23ab[_0x4cca('0x32')]['hasOwnProperty'](_0x4cca('0x3a'))){_0x1ffdc9[_0x4cca('0x3b')]=qs[_0x4cca('0x3b')](_0x3b23ab[_0x4cca('0x32')]['limit']);_0x1ffdc9['offset']=qs['offset'](_0x3b23ab['query']['offset']);}_0x1ffdc9[_0x4cca('0x69')]=qs[_0x4cca('0x3c')](_0x3b23ab[_0x4cca('0x32')][_0x4cca('0x3c')]);_0x1ffdc9[_0x4cca('0x3d')]=qs[_0x4cca('0x34')](_[_0x4cca('0x3e')](_0x3b23ab['query'],_0x4bae1c[_0x4cca('0x34')]));_0x1ffdc9['raw']=!![];if(_0x3b23ab[_0x4cca('0x32')][_0x4cca('0x3f')]){_0x1ffdc9[_0x4cca('0x3d')]=_['merge'](_0x1ffdc9[_0x4cca('0x3d')],{'$or':_[_0x4cca('0x2b')](_0x1ffdc9[_0x4cca('0x36')],function(_0x21e8a){var _0x123014={};_0x123014[_0x21e8a]={'$like':'%'+_0x3b23ab[_0x4cca('0x32')][_0x4cca('0x3f')]+'%'};return _0x123014;})});}_0x1ffdc9=_[_0x4cca('0x40')]({},_0x1ffdc9,_0x3b23ab[_0x4cca('0x42')]);return _0x317517[_0x4cca('0x6a')](_0x1ffdc9);}})['then'](respondWithResult(_0x236e4b,null))[_0x4cca('0x45')](handleError(_0x236e4b,null));};exports[_0x4cca('0x6b')]=function(_0x6d3bfe,_0x41281a,_0x3d92e9){var _0x491be1;return db[_0x4cca('0x2c')]['find']({'where':{'id':_0x6d3bfe[_0x4cca('0x46')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x4cca('0x22')](handleEntityNotFound(_0x41281a,null))[_0x4cca('0x22')](function(_0x2693b1){if(_0x2693b1){_0x491be1=_0x2693b1;return db[_0x4cca('0x5f')]['rawAttributes'];}})[_0x4cca('0x22')](function(_0xa6dd9b){if(_0xa6dd9b){var _0x7d9035={};var _0x590bbb={};_0x590bbb[_0x4cca('0x31')]=_[_0x4cca('0x66')](_[_0x4cca('0x33')](_0xa6dd9b),_['map'](_0x491be1['CustomFields'],function(_0x56e3bc){return util[_0x4cca('0x67')](_0x4cca('0x68'),_0x56e3bc['id']);}));_0x590bbb[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x6d3bfe['query']);_0x590bbb['filters']=_[_0x4cca('0x35')](_0x590bbb['model'],_0x590bbb[_0x4cca('0x32')]);_0x7d9035['attributes']=_[_0x4cca('0x35')](_0x590bbb['model'],qs[_0x4cca('0x37')](_0x6d3bfe[_0x4cca('0x32')][_0x4cca('0x37')]));_0x7d9035[_0x4cca('0x36')]=_0x7d9035['attributes'][_0x4cca('0x38')]?_0x7d9035[_0x4cca('0x36')]:_0x590bbb[_0x4cca('0x31')];if(!_0x6d3bfe[_0x4cca('0x32')]['hasOwnProperty']('nolimit')){_0x7d9035[_0x4cca('0x3b')]=qs[_0x4cca('0x3b')](_0x6d3bfe[_0x4cca('0x32')]['limit']);_0x7d9035[_0x4cca('0x1d')]=qs[_0x4cca('0x1d')](_0x6d3bfe[_0x4cca('0x32')][_0x4cca('0x1d')]);}_0x7d9035[_0x4cca('0x69')]=qs[_0x4cca('0x3c')](_0x6d3bfe[_0x4cca('0x32')][_0x4cca('0x3c')]);_0x7d9035[_0x4cca('0x3d')]=qs[_0x4cca('0x34')](_[_0x4cca('0x3e')](_0x6d3bfe[_0x4cca('0x32')],_0x590bbb[_0x4cca('0x34')]));_0x7d9035['raw']=!![];if(_0x6d3bfe[_0x4cca('0x32')][_0x4cca('0x3f')]){_0x7d9035['where']=_[_0x4cca('0x40')](_0x7d9035[_0x4cca('0x3d')],{'$or':_['map'](_0x7d9035[_0x4cca('0x36')],function(_0x2c9148){var _0x4f4ec5={};_0x4f4ec5[_0x2c9148]={'$like':'%'+_0x6d3bfe[_0x4cca('0x32')][_0x4cca('0x3f')]+'%'};return _0x4f4ec5;})});}_0x7d9035=_['merge']({},_0x7d9035,_0x6d3bfe[_0x4cca('0x42')]);return _0x491be1[_0x4cca('0x6a')](_0x7d9035);}})['then'](function(_0x4fac77){if(!_[_0x4cca('0x6c')](_0x4fac77)){var _0x2f4ca2=toCsv(_0x4fac77);var _0x5c698b=Date['now']();fs[_0x4cca('0x6d')](util[_0x4cca('0x67')]('/tmp/list_%d_%s.csv',_0x491be1['id'],_0x5c698b),_0x2f4ca2);_0x41281a[_0x4cca('0x6e')](_0x4cca('0x6f'),_0x4cca('0x70')+util['format'](_0x4cca('0x71'),_0x491be1['id'],_0x5c698b));_0x41281a[_0x4cca('0x6e')]('Content-type',_0x4cca('0x72'));return _0x41281a[_0x4cca('0x73')](util['format'](_0x4cca('0x74'),_0x491be1['id'],_0x5c698b));}else{return _0x41281a[_0x4cca('0x19')](0xcc);}})['catch'](handleError(_0x41281a,null));};exports[_0x4cca('0x75')]=function(_0x3e4d23,_0x426540,_0xdfd95f){var _0x404716;delete _0x3e4d23[_0x4cca('0x49')]['id'];return db[_0x4cca('0x2c')]['findOne']({'where':{'id':_0x3e4d23['params']['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x426540,null))['then'](function(_0x5f1661){if(_0x5f1661){return db['sequelize'][_0x4cca('0x76')](function(_0x1988e4){return db[_0x4cca('0x77')][_0x4cca('0x48')](_0x3e4d23['body'],{'transaction':_0x1988e4})[_0x4cca('0x22')](function(_0x4d3b6a){_0x404716=_0x4d3b6a;return _0x5f1661[_0x4cca('0x78')](_0x4d3b6a,{'transaction':_0x1988e4});})['then'](function(){var _0x53738b={'type':db[_0x4cca('0x79')][_0x4cca('0x7a')],'transaction':_0x1988e4};switch(_0x3e4d23['body']['type']){case _0x4cca('0x7b'):_0x53738b[_0x4cca('0x2f')]=db[_0x4cca('0x79')]['TEXT'];break;case _0x4cca('0x7c'):_0x53738b[_0x4cca('0x2f')]=db['Sequelize'][_0x4cca('0x7d')];break;case _0x4cca('0x7e'):_0x53738b[_0x4cca('0x2f')]=db['Sequelize']['BOOLEAN'];_0x53738b[_0x4cca('0x7f')]=![];break;default:}return db[_0x4cca('0x80')][_0x4cca('0x81')][_0x4cca('0x82')](_0x4cca('0x83'),util[_0x4cca('0x67')]('cf_%s',_0x404716['id']),_0x53738b);})['then'](function(){return _0x404716;});});}})[_0x4cca('0x22')](respondWithResult(_0x426540,null))[_0x4cca('0x45')](handleError(_0x426540,null));};exports[_0x4cca('0x84')]=function(_0x4490d0,_0x42b4bd,_0x188f1a){var _0x35fc1f={};var _0x4b11cd={};var _0x3697f7;var _0x2776f8;return db[_0x4cca('0x2c')][_0x4cca('0x85')]({'where':{'id':_0x4490d0[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x42b4bd,null))[_0x4cca('0x22')](function(_0x35a05f){if(_0x35a05f){_0x3697f7=_0x35a05f;_0x4b11cd[_0x4cca('0x31')]=_[_0x4cca('0x33')](db['CmCustomField'][_0x4cca('0x2d')]);_0x4b11cd[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x4490d0[_0x4cca('0x32')]);_0x4b11cd[_0x4cca('0x34')]=_['intersection'](_0x4b11cd[_0x4cca('0x31')],_0x4b11cd['query']);_0x35fc1f[_0x4cca('0x36')]=_[_0x4cca('0x35')](_0x4b11cd[_0x4cca('0x31')],qs['fields'](_0x4490d0['query'][_0x4cca('0x37')]));_0x35fc1f['attributes']=_0x35fc1f[_0x4cca('0x36')][_0x4cca('0x38')]?_0x35fc1f[_0x4cca('0x36')]:_0x4b11cd[_0x4cca('0x31')];_0x35fc1f[_0x4cca('0x69')]=qs[_0x4cca('0x3c')](_0x4490d0[_0x4cca('0x32')][_0x4cca('0x3c')]);_0x35fc1f['where']=qs[_0x4cca('0x34')](_[_0x4cca('0x3e')](_0x4490d0[_0x4cca('0x32')],_0x4b11cd[_0x4cca('0x34')]));_0x35fc1f[_0x4cca('0x3d')]=_['merge'](_0x35fc1f[_0x4cca('0x3d')],{'$or':[{'ListId':_0x35a05f['id']},{'ListId':null}]});if(_0x4490d0['query'][_0x4cca('0x3f')]){_0x35fc1f[_0x4cca('0x3d')]=_['merge'](_0x35fc1f[_0x4cca('0x3d')],{'$or':_[_0x4cca('0x2b')](_0x35fc1f[_0x4cca('0x36')],function(_0x5e221d){var _0x21a6c0={};_0x21a6c0[_0x5e221d]={'$like':'%'+_0x4490d0[_0x4cca('0x32')][_0x4cca('0x3f')]+'%'};return _0x21a6c0;})});}_0x35fc1f=_['merge']({},_0x35fc1f,_0x4490d0[_0x4cca('0x42')]);return db[_0x4cca('0x77')][_0x4cca('0x86')](_0x35fc1f);}})['then'](respondWithResult(_0x42b4bd,null))['catch'](handleError(_0x42b4bd,null));};exports[_0x4cca('0x87')]=function(_0x58d01a,_0x518c86,_0x1082f4){return db[_0x4cca('0x2c')][_0x4cca('0x47')]({'where':{'id':_0x58d01a[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x518c86,null))[_0x4cca('0x22')](function(_0x473f6e){if(_0x473f6e){return _0x473f6e['addAgents'](_0x58d01a['body'][_0x4cca('0x60')],_['omit'](_0x58d01a[_0x4cca('0x49')],[_0x4cca('0x60'),'id'])||{})[_0x4cca('0x88')](function(_0x3e3b96){for(var _0x57c81e=0x0;_0x57c81e<_0x58d01a[_0x4cca('0x49')][_0x4cca('0x60')][_0x4cca('0x38')];_0x57c81e+=0x1){socket[_0x4cca('0x89')](_0x4cca('0x8a'),{'UserId':_0x58d01a[_0x4cca('0x49')][_0x4cca('0x60')][_0x57c81e],'CmListId':_0x58d01a[_0x4cca('0x46')]['id']});}return _0x3e3b96;});}})['then'](respondWithResult(_0x518c86,null))[_0x4cca('0x45')](handleError(_0x518c86,null));};exports['removeAgents']=function(_0x1454d4,_0x40e946,_0x50354e){return db[_0x4cca('0x2c')]['find']({'where':{'id':_0x1454d4['params']['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x40e946,null))['then'](function(_0x587dac){if(_0x587dac){return _0x587dac[_0x4cca('0x8b')](_0x1454d4[_0x4cca('0x32')][_0x4cca('0x60')])['then'](function(){if(_[_0x4cca('0x5a')](_0x1454d4['query'][_0x4cca('0x60')])){for(var _0x4ff6f7=0x0;_0x4ff6f7<_0x1454d4[_0x4cca('0x32')]['ids'][_0x4cca('0x38')];_0x4ff6f7+=0x1){socket[_0x4cca('0x89')](_0x4cca('0x8c'),{'UserId':Number(_0x1454d4[_0x4cca('0x32')]['ids'][_0x4ff6f7]),'CmListId':Number(_0x1454d4['params']['id'])});}}else{socket[_0x4cca('0x89')](_0x4cca('0x8c'),{'UserId':Number(_0x1454d4[_0x4cca('0x32')][_0x4cca('0x60')]),'CmListId':Number(_0x1454d4[_0x4cca('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x40e946,null))[_0x4cca('0x45')](handleError(_0x40e946,null));};exports[_0x4cca('0x8d')]=function(_0x1679d6,_0x5b3714,_0x15177c){var _0x1fdf00={};var _0x39124c={};var _0x185297;var _0xd4793b;return db['CmList'][_0x4cca('0x85')]({'where':{'id':_0x1679d6[_0x4cca('0x46')]['id']}})[_0x4cca('0x22')](handleEntityNotFound(_0x5b3714,null))[_0x4cca('0x22')](function(_0x2a465e){if(_0x2a465e){_0x185297=_0x2a465e;_0x39124c[_0x4cca('0x31')]=_[_0x4cca('0x33')](db[_0x4cca('0x8e')]['rawAttributes']);_0x39124c[_0x4cca('0x32')]=_[_0x4cca('0x33')](_0x1679d6['query']);_0x39124c[_0x4cca('0x34')]=_['intersection'](_0x39124c[_0x4cca('0x31')],_0x39124c[_0x4cca('0x32')]);_0x1fdf00['attributes']=_[_0x4cca('0x35')](_0x39124c[_0x4cca('0x31')],qs[_0x4cca('0x37')](_0x1679d6['query'][_0x4cca('0x37')]));_0x1fdf00[_0x4cca('0x36')]=_0x1fdf00[_0x4cca('0x36')][_0x4cca('0x38')]?_0x1fdf00[_0x4cca('0x36')]:_0x39124c['model'];_0x1fdf00['order']=qs[_0x4cca('0x3c')](_0x1679d6['query'][_0x4cca('0x3c')]);_0x1fdf00[_0x4cca('0x3d')]=qs['filters'](_[_0x4cca('0x3e')](_0x1679d6[_0x4cca('0x32')],_0x39124c[_0x4cca('0x34')]));if(_0x1679d6[_0x4cca('0x32')]['filter']){_0x1fdf00[_0x4cca('0x3d')]=_[_0x4cca('0x40')](_0x1fdf00[_0x4cca('0x3d')],{'$or':_[_0x4cca('0x2b')](_0x1fdf00['attributes'],function(_0x2c1903){var _0x5c64a7={};_0x5c64a7[_0x2c1903]={'$like':'%'+_0x1679d6[_0x4cca('0x32')][_0x4cca('0x3f')]+'%'};return _0x5c64a7;})});}_0x1fdf00=_[_0x4cca('0x40')]({},_0x1fdf00,_0x1679d6[_0x4cca('0x42')]);return _0x185297[_0x4cca('0x8d')](_0x1fdf00);}})[_0x4cca('0x22')](function(_0x5e5d09){if(_0x5e5d09){_0xd4793b=_0x5e5d09[_0x4cca('0x38')];if(!_0x1679d6[_0x4cca('0x32')][_0x4cca('0x39')](_0x4cca('0x3a'))){_0x1fdf00[_0x4cca('0x3b')]=qs[_0x4cca('0x3b')](_0x1679d6['query']['limit']);_0x1fdf00[_0x4cca('0x1d')]=qs[_0x4cca('0x1d')](_0x1679d6[_0x4cca('0x32')][_0x4cca('0x1d')]);}return _0x185297[_0x4cca('0x8d')](_0x1fdf00);}})[_0x4cca('0x22')](function(_0x1b160e){if(_0x1b160e){return _0x1b160e?{'count':_0xd4793b,'rows':_0x1b160e}:null;}})['then'](respondWithResult(_0x5b3714,null))['catch'](handleError(_0x5b3714,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index bad3722..0c6f5a4 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 _0x5909=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x471412,_0x47a60e){var _0x7df308=function(_0x97f4e5){while(--_0x97f4e5){_0x471412['push'](_0x471412['shift']());}};_0x7df308(++_0x47a60e);}(_0x5909,0x120));var _0x9590=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x5909[_0x53abe5];return _0xc1c37e;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x9590('0x0')](0x0);var events={'afterCreate':_0x9590('0x1'),'afterUpdate':_0x9590('0x2'),'afterDestroy':_0x9590('0x3')};function emitEvent(_0x1c88d8){return function(_0x60895,_0x48f6c9,_0x279e85){CmListEvents[_0x9590('0x4')](_0x1c88d8+':'+_0x60895['id'],_0x60895);CmListEvents[_0x9590('0x4')](_0x1c88d8,_0x60895);_0x279e85(null);};}for(var e in events){if(events[_0x9590('0x5')](e)){var event=events[e];CmList[_0x9590('0x6')](e,emitEvent(event));}}module[_0x9590('0x7')]=CmListEvents; \ No newline at end of file +var _0x9d99=['emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove'];(function(_0x17556e,_0x1aa9d6){var _0x3639bc=function(_0x1626b4){while(--_0x1626b4){_0x17556e['push'](_0x17556e['shift']());}};_0x3639bc(++_0x1aa9d6);}(_0x9d99,0x71));var _0x99d9=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x9d99[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0x99d9('0x0'));var CmList=require(_0x99d9('0x1'))['db'][_0x99d9('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x99d9('0x3')](0x0);var events={'afterCreate':_0x99d9('0x4'),'afterUpdate':_0x99d9('0x5'),'afterDestroy':_0x99d9('0x6')};function emitEvent(_0x2f4e83){return function(_0x416b9d,_0x49ea94,_0x218ab6){CmListEvents[_0x99d9('0x7')](_0x2f4e83+':'+_0x416b9d['id'],_0x416b9d);CmListEvents[_0x99d9('0x7')](_0x2f4e83,_0x416b9d);_0x218ab6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x99d9('0x8')](e,emitEvent(event));}}module[_0x99d9('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7c44da3..bbdddba 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 _0xf30a=['path','rimraf','./cmList.attributes','exports','CmList','cm_lists','lodash','../../config/logger','moment','bluebird'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0xf30a,0x1e6));var _0xaf30=function(_0x54202e,_0x37575c){_0x54202e=_0x54202e-0x0;var _0x36a01=_0xf30a[_0x54202e];return _0x36a01;};'use strict';var _=require(_0xaf30('0x0'));var util=require('util');var logger=require(_0xaf30('0x1'))('api');var moment=require(_0xaf30('0x2'));var BPromise=require(_0xaf30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf30('0x4'));var rimraf=require(_0xaf30('0x5'));var config=require('../../config/environment');var attributes=require(_0xaf30('0x6'));module[_0xaf30('0x7')]=function(_0x1aed6a,_0x2e8c49){return _0x1aed6a['define'](_0xaf30('0x8'),attributes,{'tableName':_0xaf30('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb2c=['./cmList.attributes','CmList','cm_lists','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2de22c,_0x5105af){var _0x3251ae=function(_0x3b0eb8){while(--_0x3b0eb8){_0x2de22c['push'](_0x2de22c['shift']());}};_0x3251ae(++_0x5105af);}(_0xcb2c,0x16b));var _0xccb2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xcb2c[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xccb2('0x0'));var util=require('util');var logger=require(_0xccb2('0x1'))(_0xccb2('0x2'));var moment=require(_0xccb2('0x3'));var BPromise=require(_0xccb2('0x4'));var rp=require(_0xccb2('0x5'));var fs=require('fs');var path=require(_0xccb2('0x6'));var rimraf=require(_0xccb2('0x7'));var config=require(_0xccb2('0x8'));var attributes=require(_0xccb2('0x9'));module['exports']=function(_0x299af9,_0x10db29){return _0x299af9['define'](_0xccb2('0xa'),attributes,{'tableName':_0xccb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 118cff8..8048f17 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 _0x4649=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x2343b2,_0x375387){var _0x4d843d=function(_0x105638){while(--_0x105638){_0x2343b2['push'](_0x2343b2['shift']());}};_0x4d843d(++_0x375387);}(_0x4649,0x199));var _0x9464=function(_0x8ba045,_0x17cc0f){_0x8ba045=_0x8ba045-0x0;var _0xd9efc3=_0x4649[_0x8ba045];return _0xd9efc3;};'use strict';var _=require(_0x9464('0x0'));var util=require('util');var moment=require(_0x9464('0x1'));var BPromise=require(_0x9464('0x2'));var rs=require(_0x9464('0x3'));var fs=require('fs');var Redis=require(_0x9464('0x4'));var db=require(_0x9464('0x5'))['db'];var utils=require(_0x9464('0x6'));var logger=require(_0x9464('0x7'))('rpc');var config=require(_0x9464('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9464('0x9')][_0x9464('0xa')]({'port':0x232a});config[_0x9464('0xb')]=_[_0x9464('0xc')](config['redis'],{'host':_0x9464('0xd'),'port':0x18eb});var socket=require(_0x9464('0xe'))(new Redis(config[_0x9464('0xb')]));require(_0x9464('0xf'))[_0x9464('0x10')](socket);function respondWithRpcPromise(_0x5d850a,_0x2480cb,_0x5a4436){return new BPromise(function(_0x1dc525,_0x13bef3){return client[_0x9464('0x11')](_0x5d850a,_0x5a4436)[_0x9464('0x12')](function(_0x7c211d){logger[_0x9464('0x13')]('CmList,\x20%s,\x20%s',_0x2480cb,_0x9464('0x14'));logger[_0x9464('0x15')](_0x9464('0x16'),_0x2480cb,_0x9464('0x14'),JSON[_0x9464('0x17')](_0x7c211d));if(_0x7c211d['error']){if(_0x7c211d[_0x9464('0x18')][_0x9464('0x19')]===0x1f4){logger[_0x9464('0x18')](_0x9464('0x1a'),_0x2480cb,_0x7c211d[_0x9464('0x18')][_0x9464('0x1b')]);return _0x13bef3(_0x7c211d['error']['message']);}logger['error'](_0x9464('0x1a'),_0x2480cb,_0x7c211d['error']['message']);return _0x1dc525(_0x7c211d['error'][_0x9464('0x1b')]);}else{logger[_0x9464('0x13')](_0x9464('0x1a'),_0x2480cb,_0x9464('0x14'));_0x1dc525(_0x7c211d[_0x9464('0x1c')][_0x9464('0x1b')]);}})[_0x9464('0x1d')](function(_0x588430){logger[_0x9464('0x18')](_0x9464('0x1a'),_0x2480cb,_0x588430);_0x13bef3(_0x588430);});});} \ No newline at end of file +var _0x3e2e=['./cmList.socket','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x3e2e,0x10a));var _0xe3e2=function(_0x32bb87,_0x283aba){_0x32bb87=_0x32bb87-0x0;var _0x24e866=_0x3e2e[_0x32bb87];return _0x24e866;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe3e2('0x0'));var BPromise=require(_0xe3e2('0x1'));var rs=require(_0xe3e2('0x2'));var fs=require('fs');var Redis=require(_0xe3e2('0x3'));var db=require(_0xe3e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3e2('0x5'))(_0xe3e2('0x6'));var config=require(_0xe3e2('0x7'));var jayson=require(_0xe3e2('0x8'));var client=jayson['client'][_0xe3e2('0x9')]({'port':0x232a});config[_0xe3e2('0xa')]=_[_0xe3e2('0xb')](config[_0xe3e2('0xa')],{'host':_0xe3e2('0xc'),'port':0x18eb});var socket=require(_0xe3e2('0xd'))(new Redis(config[_0xe3e2('0xa')]));require(_0xe3e2('0xe'))[_0xe3e2('0xf')](socket);function respondWithRpcPromise(_0x224998,_0x2cce1b,_0x36b88c){return new BPromise(function(_0x2e3022,_0x35f279){return client[_0xe3e2('0x10')](_0x224998,_0x36b88c)[_0xe3e2('0x11')](function(_0x5065b6){logger[_0xe3e2('0x12')]('CmList,\x20%s,\x20%s',_0x2cce1b,'request\x20sent');logger[_0xe3e2('0x13')](_0xe3e2('0x14'),_0x2cce1b,_0xe3e2('0x15'),JSON[_0xe3e2('0x16')](_0x5065b6));if(_0x5065b6['error']){if(_0x5065b6[_0xe3e2('0x17')][_0xe3e2('0x18')]===0x1f4){logger[_0xe3e2('0x17')](_0xe3e2('0x19'),_0x2cce1b,_0x5065b6['error']['message']);return _0x35f279(_0x5065b6['error'][_0xe3e2('0x1a')]);}logger['error'](_0xe3e2('0x19'),_0x2cce1b,_0x5065b6[_0xe3e2('0x17')]['message']);return _0x2e3022(_0x5065b6['error'][_0xe3e2('0x1a')]);}else{logger['info'](_0xe3e2('0x19'),_0x2cce1b,'request\x20sent');_0x2e3022(_0x5065b6[_0xe3e2('0x1b')][_0xe3e2('0x1a')]);}})['catch'](function(_0x40e756){logger[_0xe3e2('0x17')](_0xe3e2('0x19'),_0x2cce1b,_0x40e756);_0x35f279(_0x40e756);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f630d06..7897cfa 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 _0x36c3=['length','cmList:','./cmList.events','save','update','emit','register'];(function(_0x3e2733,_0x26b858){var _0x49c845=function(_0xe1fc00){while(--_0xe1fc00){_0x3e2733['push'](_0x3e2733['shift']());}};_0x49c845(++_0x26b858);}(_0x36c3,0x1a6));var _0x336c=function(_0x17d76b,_0x54345b){_0x17d76b=_0x17d76b-0x0;var _0x16f3ac=_0x36c3[_0x17d76b];return _0x16f3ac;};'use strict';var CmListEvents=require(_0x336c('0x0'));var events=[_0x336c('0x1'),'remove',_0x336c('0x2')];function createListener(_0x34b4b2,_0x3368c2){return function(_0x194993){_0x3368c2[_0x336c('0x3')](_0x34b4b2,_0x194993);};}function removeListener(_0x2b1194,_0x39ed12){return function(){CmListEvents['removeListener'](_0x2b1194,_0x39ed12);};}exports[_0x336c('0x4')]=function(_0x2e0016){for(var _0x2097a8=0x0,_0x29a202=events[_0x336c('0x5')];_0x2097a8<_0x29a202;_0x2097a8++){var _0x4d1e4f=events[_0x2097a8];var _0x108bb0=createListener(_0x336c('0x6')+_0x4d1e4f,_0x2e0016);CmListEvents['on'](_0x4d1e4f,_0x108bb0);}}; \ No newline at end of file +var _0x8375=['./cmList.events','save','remove','emit','register','length','cmList:'];(function(_0x11ad21,_0x22ecc8){var _0x3220ad=function(_0x5cdd63){while(--_0x5cdd63){_0x11ad21['push'](_0x11ad21['shift']());}};_0x3220ad(++_0x22ecc8);}(_0x8375,0xa8));var _0x5837=function(_0xb6cfa4,_0x121e3b){_0xb6cfa4=_0xb6cfa4-0x0;var _0x51433b=_0x8375[_0xb6cfa4];return _0x51433b;};'use strict';var CmListEvents=require(_0x5837('0x0'));var events=[_0x5837('0x1'),_0x5837('0x2'),'update'];function createListener(_0x24c393,_0x181ec3){return function(_0x86f16a){_0x181ec3[_0x5837('0x3')](_0x24c393,_0x86f16a);};}function removeListener(_0x317452,_0x1edfc5){return function(){CmListEvents['removeListener'](_0x317452,_0x1edfc5);};}exports[_0x5837('0x4')]=function(_0x19491e){for(var _0x365da3=0x0,_0x2e383c=events[_0x5837('0x5')];_0x365da3<_0x2e383c;_0x365da3++){var _0x5bc421=events[_0x365da3];var _0x508caf=createListener(_0x5837('0x6')+_0x5bc421,_0x19491e);CmListEvents['on'](_0x5bc421,_0x508caf);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 498330b..b8b96c2 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 _0x787c=['getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','addDisposition','post','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions'];(function(_0x435eff,_0x1138e3){var _0x509d7b=function(_0x3c75ec){while(--_0x3c75ec){_0x435eff['push'](_0x435eff['shift']());}};_0x509d7b(++_0x1138e3);}(_0x787c,0xbe));var _0xc787=function(_0x4c35d1,_0x3e2464){_0x4c35d1=_0x4c35d1-0x0;var _0x2cdd4f=_0x787c[_0x4c35d1];return _0x2cdd4f;};'use strict';var multer=require(_0xc787('0x0'));var util=require(_0xc787('0x1'));var path=require('path');var timeout=require(_0xc787('0x2'));var express=require(_0xc787('0x3'));var router=express[_0xc787('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc787('0x5'));var config=require(_0xc787('0x6'));var controller=require(_0xc787('0x7'));router[_0xc787('0x8')]('/',auth[_0xc787('0x9')](),controller[_0xc787('0xa')]);router[_0xc787('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc787('0x8')](_0xc787('0xb'),auth['isAuthenticated'](),controller[_0xc787('0xc')]);router[_0xc787('0x8')](_0xc787('0xd'),auth[_0xc787('0x9')](),controller[_0xc787('0xe')]);router[_0xc787('0x8')](_0xc787('0xf'),auth[_0xc787('0x9')](),controller[_0xc787('0x10')]);router[_0xc787('0x8')](_0xc787('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0xc787('0x12'),auth[_0xc787('0x9')](),controller[_0xc787('0x13')]);router['get'](_0xc787('0x14'),auth[_0xc787('0x9')](),controller[_0xc787('0x15')]);router['post']('/',auth[_0xc787('0x9')](),controller[_0xc787('0x16')]);router['post'](_0xc787('0xd'),auth[_0xc787('0x9')](),controller[_0xc787('0x17')]);router[_0xc787('0x18')](_0xc787('0xf'),auth['isAuthenticated'](),controller[_0xc787('0x19')]);router[_0xc787('0x18')]('/:id/fields',auth[_0xc787('0x9')](),controller[_0xc787('0x1a')]);router[_0xc787('0x18')](_0xc787('0x14'),auth['isAuthenticated'](),controller[_0xc787('0x1b')]);router['put'](_0xc787('0xb'),auth[_0xc787('0x9')](),controller[_0xc787('0x1c')]);router[_0xc787('0x1d')](_0xc787('0xb'),auth[_0xc787('0x9')](),controller[_0xc787('0x1e')]);router[_0xc787('0x1d')](_0xc787('0xd'),auth['isAuthenticated'](),controller[_0xc787('0x1f')]);router[_0xc787('0x1d')](_0xc787('0x14'),auth[_0xc787('0x9')](),controller[_0xc787('0x20')]);module[_0xc787('0x21')]=router; \ No newline at end of file +var _0x9f0e=['/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x361fe1,_0x17d79a){var _0x4eec28=function(_0x2fa7b7){while(--_0x2fa7b7){_0x361fe1['push'](_0x361fe1['shift']());}};_0x4eec28(++_0x17d79a);}(_0x9f0e,0x8d));var _0xe9f0=function(_0x3abe01,_0x2b7784){_0x3abe01=_0x3abe01-0x0;var _0x329c96=_0x9f0e[_0x3abe01];return _0x329c96;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require('util');var path=require(_0xe9f0('0x1'));var timeout=require(_0xe9f0('0x2'));var express=require(_0xe9f0('0x3'));var router=express['Router']();var auth=require(_0xe9f0('0x4'));var interaction=require(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var controller=require('./cmList.controller');router['get']('/',auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x8')]);router['get'](_0xe9f0('0x9'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0xa')]);router[_0xe9f0('0xb')](_0xe9f0('0xc'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xb')](_0xe9f0('0xe'),auth[_0xe9f0('0x7')](),controller['getDispositions']);router[_0xe9f0('0xb')](_0xe9f0('0xf'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x10')]);router['get'](_0xe9f0('0x11'),auth[_0xe9f0('0x7')](),controller['getContactsCsv']);router[_0xe9f0('0xb')](_0xe9f0('0x12'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x13')]);router[_0xe9f0('0xb')](_0xe9f0('0x14'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x15')]);router[_0xe9f0('0x16')]('/',auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x17')]);router[_0xe9f0('0x16')](_0xe9f0('0xe'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x18')]);router[_0xe9f0('0x16')](_0xe9f0('0xf'),auth[_0xe9f0('0x7')](),controller['addContacts']);router[_0xe9f0('0x16')](_0xe9f0('0x12'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x19')]);router[_0xe9f0('0x16')](_0xe9f0('0x14'),auth[_0xe9f0('0x7')](),controller['addAgents']);router['put']('/:id',auth[_0xe9f0('0x7')](),controller['update']);router[_0xe9f0('0x1a')](_0xe9f0('0xc'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x1b')]);router[_0xe9f0('0x1a')](_0xe9f0('0xe'),auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x1c')]);router[_0xe9f0('0x1a')]('/:id/users',auth[_0xe9f0('0x7')](),controller[_0xe9f0('0x1d')]);module[_0xe9f0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f4ca619..708e774 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1a46f6,_0x114c10){var _0x1043a5=function(_0x515686){while(--_0x515686){_0x1a46f6['push'](_0x1a46f6['shift']());}};_0x1043a5(++_0x114c10);}(_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')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xc0f505,_0x515046){var _0x2e9d36=function(_0x44d879){while(--_0x44d879){_0xc0f505['push'](_0xc0f505['shift']());}};_0x2e9d36(++_0x515046);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 82c9214..70c7be4 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 _0xbb80=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbb80,0x8c));var _0x0bb8=function(_0x3a54c1,_0x1b19a7){_0x3a54c1=_0x3a54c1-0x0;var _0x532e71=_0xbb80[_0x3a54c1];return _0x532e71;};'use strict';var pdf=require(_0x0bb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0bb8('0x1'));var zipdir=require(_0x0bb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bb8('0x3'));var moment=require(_0x0bb8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0bb8('0x5'));var path=require('path');var sox=require(_0x0bb8('0x6'));var csv=require(_0x0bb8('0x7'));var ejs=require(_0x0bb8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0bb8('0x9'));var crypto=require('crypto');var jsforce=require(_0x0bb8('0xa'));var deskjs=require(_0x0bb8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0bb8('0xc'));var Redis=require(_0x0bb8('0xd'));var authService=require(_0x0bb8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bb8('0xf'));var logger=require(_0x0bb8('0x10'))('api');var utils=require(_0x0bb8('0x11'));var config=require('../../config/environment');var db=require(_0x0bb8('0x12'))['db'];function respondWithStatusCode(_0x1942a2,_0x514d5c){_0x514d5c=_0x514d5c||0xcc;return function(_0x32fae8){if(_0x32fae8){return _0x1942a2[_0x0bb8('0x13')](_0x514d5c);}return _0x1942a2['status'](_0x514d5c)[_0x0bb8('0x14')]();};}function respondWithResult(_0x26f728,_0x5d3e02){_0x5d3e02=_0x5d3e02||0xc8;return function(_0xbeedab){if(_0xbeedab){return _0x26f728[_0x0bb8('0x15')](_0x5d3e02)[_0x0bb8('0x16')](_0xbeedab);}};}function respondWithFilteredResult(_0x5e2ed8,_0x52480c){return function(_0x37887d){if(_0x37887d){var _0x5b6df9=_0x37887d['count'],_0x3e01b9=_0x52480c[_0x0bb8('0x17')],_0x43c322=_0x52480c[_0x0bb8('0x17')]+_0x52480c['limit'],_0x5c4cac;if(_0x43c322>=_0x5b6df9){_0x43c322=_0x5b6df9;_0x5c4cac=0xc8;}else{_0x5c4cac=0xce;}_0x5e2ed8[_0x0bb8('0x15')](_0x5c4cac);return _0x5e2ed8[_0x0bb8('0x18')](_0x0bb8('0x19'),_0x3e01b9+'-'+_0x43c322+'/'+_0x5b6df9)[_0x0bb8('0x16')](_0x37887d);}return null;};}function patchUpdates(_0x3b3115){return function(_0x66c7ac){try{jsonpatch[_0x0bb8('0x1a')](_0x66c7ac,_0x3b3115,!![]);}catch(_0x3f1027){return BPromise[_0x0bb8('0x1b')](_0x3f1027);}return _0x66c7ac[_0x0bb8('0x1c')]();};}function saveUpdates(_0xbb5a81,_0x3ab387){return function(_0x1fc673){if(_0x1fc673){return _0x1fc673[_0x0bb8('0x1d')](_0xbb5a81)[_0x0bb8('0x1e')](function(_0xbc6065){return _0xbc6065;});}return null;};}function removeEntity(_0x3b7554,_0x5753af){return function(_0x19ce1d){if(_0x19ce1d){return _0x19ce1d[_0x0bb8('0x1f')]()['then'](function(){_0x3b7554['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x578c43,_0x270c71){return function(_0x1676cc){if(!_0x1676cc){_0x578c43['sendStatus'](0x194);}return _0x1676cc;};}function handleError(_0x3cc9d3,_0x247ebb){_0x247ebb=_0x247ebb||0x1f4;return function(_0x41a60f){logger[_0x0bb8('0x20')](_0x41a60f[_0x0bb8('0x21')]);if(_0x41a60f[_0x0bb8('0x22')]){delete _0x41a60f[_0x0bb8('0x22')];}_0x3cc9d3[_0x0bb8('0x15')](_0x247ebb)[_0x0bb8('0x23')](_0x41a60f);};}exports['update']=function(_0x58082d,_0x13311a){if(_0x58082d[_0x0bb8('0x24')]['id']){delete _0x58082d[_0x0bb8('0x24')]['id'];}return db[_0x0bb8('0x25')][_0x0bb8('0x26')]({'where':{'id':_0x58082d[_0x0bb8('0x27')]['id']}})[_0x0bb8('0x1e')](handleEntityNotFound(_0x13311a,null))[_0x0bb8('0x1e')](saveUpdates(_0x58082d[_0x0bb8('0x24')],null))[_0x0bb8('0x1e')](respondWithResult(_0x13311a,null))[_0x0bb8('0x28')](handleError(_0x13311a,null));};exports[_0x0bb8('0x1f')]=function(_0x563a1b,_0x51ba17){return db['Condition'][_0x0bb8('0x26')]({'where':{'id':_0x563a1b[_0x0bb8('0x27')]['id']}})[_0x0bb8('0x1e')](handleEntityNotFound(_0x51ba17,null))[_0x0bb8('0x1e')](removeEntity(_0x51ba17,null))[_0x0bb8('0x28')](handleError(_0x51ba17,null));}; \ No newline at end of file +var _0x8b1c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','body','find','catch','Condition','params','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x8b1c,0x1e1));var _0xc8b1=function(_0x171bc9,_0x1e7a49){_0x171bc9=_0x171bc9-0x0;var _0x422da2=_0x8b1c[_0x171bc9];return _0x422da2;};'use strict';var pdf=require(_0xc8b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc8b1('0x1'));var zipdir=require(_0xc8b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8b1('0x3'));var moment=require('moment');var BPromise=require(_0xc8b1('0x4'));var Mustache=require(_0xc8b1('0x5'));var util=require(_0xc8b1('0x6'));var path=require('path');var sox=require(_0xc8b1('0x7'));var csv=require(_0xc8b1('0x8'));var ejs=require(_0xc8b1('0x9'));var fs=require('fs');var _=require(_0xc8b1('0xa'));var squel=require('squel');var crypto=require(_0xc8b1('0xb'));var jsforce=require(_0xc8b1('0xc'));var deskjs=require(_0xc8b1('0xd'));var toCsv=require(_0xc8b1('0x8'));var querystring=require('querystring');var Papa=require(_0xc8b1('0xe'));var Redis=require(_0xc8b1('0xf'));var authService=require(_0xc8b1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc8b1('0x11'));var hardwareService=require(_0xc8b1('0x12'));var logger=require(_0xc8b1('0x13'))(_0xc8b1('0x14'));var utils=require(_0xc8b1('0x15'));var config=require(_0xc8b1('0x16'));var db=require(_0xc8b1('0x17'))['db'];function respondWithStatusCode(_0xb889a8,_0x597359){_0x597359=_0x597359||0xcc;return function(_0x1524af){if(_0x1524af){return _0xb889a8[_0xc8b1('0x18')](_0x597359);}return _0xb889a8[_0xc8b1('0x19')](_0x597359)['end']();};}function respondWithResult(_0x4e444b,_0x13c2e6){_0x13c2e6=_0x13c2e6||0xc8;return function(_0x23ac14){if(_0x23ac14){return _0x4e444b['status'](_0x13c2e6)['json'](_0x23ac14);}};}function respondWithFilteredResult(_0x4db5d2,_0x36f62f){return function(_0x4e3ecb){if(_0x4e3ecb){var _0x167c10=_0x4e3ecb[_0xc8b1('0x1a')],_0x2ab528=_0x36f62f[_0xc8b1('0x1b')],_0x22a3f2=_0x36f62f[_0xc8b1('0x1b')]+_0x36f62f[_0xc8b1('0x1c')],_0x527b7f;if(_0x22a3f2>=_0x167c10){_0x22a3f2=_0x167c10;_0x527b7f=0xc8;}else{_0x527b7f=0xce;}_0x4db5d2[_0xc8b1('0x19')](_0x527b7f);return _0x4db5d2[_0xc8b1('0x1d')]('Content-Range',_0x2ab528+'-'+_0x22a3f2+'/'+_0x167c10)['json'](_0x4e3ecb);}return null;};}function patchUpdates(_0x4043f8){return function(_0x1d2944){try{jsonpatch[_0xc8b1('0x1e')](_0x1d2944,_0x4043f8,!![]);}catch(_0x9329b2){return BPromise[_0xc8b1('0x1f')](_0x9329b2);}return _0x1d2944['save']();};}function saveUpdates(_0x129648,_0x3df231){return function(_0x53e9e7){if(_0x53e9e7){return _0x53e9e7[_0xc8b1('0x20')](_0x129648)[_0xc8b1('0x21')](function(_0x172672){return _0x172672;});}return null;};}function removeEntity(_0x2bdf4a,_0xcf32d4){return function(_0x5f03a5){if(_0x5f03a5){return _0x5f03a5[_0xc8b1('0x22')]()[_0xc8b1('0x21')](function(){_0x2bdf4a[_0xc8b1('0x19')](0xcc)[_0xc8b1('0x23')]();});}};}function handleEntityNotFound(_0x35f328,_0x26e5fa){return function(_0x4be7d3){if(!_0x4be7d3){_0x35f328[_0xc8b1('0x18')](0x194);}return _0x4be7d3;};}function handleError(_0x5c76b9,_0x42c52f){_0x42c52f=_0x42c52f||0x1f4;return function(_0x1af92e){logger[_0xc8b1('0x24')](_0x1af92e[_0xc8b1('0x25')]);if(_0x1af92e[_0xc8b1('0x26')]){delete _0x1af92e[_0xc8b1('0x26')];}_0x5c76b9[_0xc8b1('0x19')](_0x42c52f)[_0xc8b1('0x27')](_0x1af92e);};}exports[_0xc8b1('0x20')]=function(_0x46693c,_0x3dad3d){if(_0x46693c[_0xc8b1('0x28')]['id']){delete _0x46693c[_0xc8b1('0x28')]['id'];}return db['Condition'][_0xc8b1('0x29')]({'where':{'id':_0x46693c['params']['id']}})['then'](handleEntityNotFound(_0x3dad3d,null))[_0xc8b1('0x21')](saveUpdates(_0x46693c['body'],null))['then'](respondWithResult(_0x3dad3d,null))[_0xc8b1('0x2a')](handleError(_0x3dad3d,null));};exports[_0xc8b1('0x22')]=function(_0x487684,_0x162c16){return db[_0xc8b1('0x2b')][_0xc8b1('0x29')]({'where':{'id':_0x487684[_0xc8b1('0x2c')]['id']}})[_0xc8b1('0x21')](handleEntityNotFound(_0x162c16,null))['then'](removeEntity(_0x162c16,null))['catch'](handleError(_0x162c16,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0bcf526..704fb5c 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 _0x44ea=['path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','bluebird'];(function(_0x2bd1aa,_0x2077aa){var _0x4bf239=function(_0x51f621){while(--_0x51f621){_0x2bd1aa['push'](_0x2bd1aa['shift']());}};_0x4bf239(++_0x2077aa);}(_0x44ea,0x1f3));var _0xa44e=function(_0x41832e,_0x58eeab){_0x41832e=_0x41832e-0x0;var _0x12889e=_0x44ea[_0x41832e];return _0x12889e;};'use strict';var _=require(_0xa44e('0x0'));var util=require(_0xa44e('0x1'));var logger=require(_0xa44e('0x2'))(_0xa44e('0x3'));var moment=require('moment');var BPromise=require(_0xa44e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa44e('0x5'));var rimraf=require(_0xa44e('0x6'));var config=require(_0xa44e('0x7'));var attributes=require(_0xa44e('0x8'));module[_0xa44e('0x9')]=function(_0x18f8f5,_0x4423c3){return _0x18f8f5[_0xa44e('0xa')]('Condition',attributes,{'tableName':_0xa44e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac3c=['request-promise','rimraf','../../config/environment','exports','define','Condition','tools_conditions','lodash','util','api','moment','bluebird'];(function(_0x228203,_0x2ab2d2){var _0x1e1b37=function(_0x54fff5){while(--_0x54fff5){_0x228203['push'](_0x228203['shift']());}};_0x1e1b37(++_0x2ab2d2);}(_0xac3c,0xaf));var _0xcac3=function(_0x22cb4e,_0x10af0a){_0x22cb4e=_0x22cb4e-0x0;var _0x53c592=_0xac3c[_0x22cb4e];return _0x53c592;};'use strict';var _=require(_0xcac3('0x0'));var util=require(_0xcac3('0x1'));var logger=require('../../config/logger')(_0xcac3('0x2'));var moment=require(_0xcac3('0x3'));var BPromise=require(_0xcac3('0x4'));var rp=require(_0xcac3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcac3('0x6'));var config=require(_0xcac3('0x7'));var attributes=require('./condition.attributes');module[_0xcac3('0x8')]=function(_0x40d70e,_0x5a0901){return _0x40d70e[_0xcac3('0x9')](_0xcac3('0xa'),attributes,{'tableName':_0xcac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index e9da5a1..a2929e5 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 _0x01e6=['request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x33bc15,_0x1b90d0){var _0x4d1e15=function(_0x1ad4d0){while(--_0x1ad4d0){_0x33bc15['push'](_0x33bc15['shift']());}};_0x4d1e15(++_0x1b90d0);}(_0x01e6,0x119));var _0x601e=function(_0x2b91ed,_0x4bc638){_0x2b91ed=_0x2b91ed-0x0;var _0x5d9f8c=_0x01e6[_0x2b91ed];return _0x5d9f8c;};'use strict';var _=require(_0x601e('0x0'));var util=require(_0x601e('0x1'));var moment=require(_0x601e('0x2'));var BPromise=require(_0x601e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x601e('0x4'));var db=require(_0x601e('0x5'))['db'];var utils=require(_0x601e('0x6'));var logger=require(_0x601e('0x7'))(_0x601e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x601e('0x9')][_0x601e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439c8f,_0x9df56c,_0x2da08c){return new BPromise(function(_0x465347,_0x20908f){return client['request'](_0x439c8f,_0x2da08c)[_0x601e('0xb')](function(_0x47e9e6){logger[_0x601e('0xc')]('Condition,\x20%s,\x20%s',_0x9df56c,_0x601e('0xd'));logger[_0x601e('0xe')](_0x601e('0xf'),_0x9df56c,'request\x20sent',JSON[_0x601e('0x10')](_0x47e9e6));if(_0x47e9e6[_0x601e('0x11')]){if(_0x47e9e6[_0x601e('0x11')][_0x601e('0x12')]===0x1f4){logger[_0x601e('0x11')](_0x601e('0x13'),_0x9df56c,_0x47e9e6['error']['message']);return _0x20908f(_0x47e9e6[_0x601e('0x11')][_0x601e('0x14')]);}logger[_0x601e('0x11')]('Condition,\x20%s,\x20%s',_0x9df56c,_0x47e9e6['error'][_0x601e('0x14')]);return _0x465347(_0x47e9e6[_0x601e('0x11')][_0x601e('0x14')]);}else{logger['info'](_0x601e('0x13'),_0x9df56c,'request\x20sent');_0x465347(_0x47e9e6['result'][_0x601e('0x14')]);}})['catch'](function(_0xa5567){logger['error'](_0x601e('0x13'),_0x9df56c,_0xa5567);_0x20908f(_0xa5567);});});} \ No newline at end of file +var _0xac3d=['message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac3d,0x1bc));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdac3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdac3('0x1'));var db=require(_0xdac3('0x2'))['db'];var utils=require(_0xdac3('0x3'));var logger=require(_0xdac3('0x4'))(_0xdac3('0x5'));var config=require(_0xdac3('0x6'));var jayson=require(_0xdac3('0x7'));var client=jayson[_0xdac3('0x8')][_0xdac3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d64d6,_0xbc0c1a,_0x4997f8){return new BPromise(function(_0x2a4f2f,_0x2a441a){return client[_0xdac3('0xa')](_0x4d64d6,_0x4997f8)[_0xdac3('0xb')](function(_0x3ba49a){logger[_0xdac3('0xc')](_0xdac3('0xd'),_0xbc0c1a,_0xdac3('0xe'));logger[_0xdac3('0xf')](_0xdac3('0x10'),_0xbc0c1a,_0xdac3('0xe'),JSON['stringify'](_0x3ba49a));if(_0x3ba49a['error']){if(_0x3ba49a[_0xdac3('0x11')]['code']===0x1f4){logger['error'](_0xdac3('0xd'),_0xbc0c1a,_0x3ba49a['error'][_0xdac3('0x12')]);return _0x2a441a(_0x3ba49a[_0xdac3('0x11')]['message']);}logger[_0xdac3('0x11')](_0xdac3('0xd'),_0xbc0c1a,_0x3ba49a['error'][_0xdac3('0x12')]);return _0x2a4f2f(_0x3ba49a[_0xdac3('0x11')]['message']);}else{logger[_0xdac3('0xc')]('Condition,\x20%s,\x20%s',_0xbc0c1a,_0xdac3('0xe'));_0x2a4f2f(_0x3ba49a[_0xdac3('0x13')][_0xdac3('0x12')]);}})[_0xdac3('0x14')](function(_0x96fa05){logger[_0xdac3('0x11')]('Condition,\x20%s,\x20%s',_0xbc0c1a,_0x96fa05);_0x2a441a(_0x96fa05);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4166d1f..1becb95 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 _0xc0e8=['update','/:id','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc0e8,0x1e3));var _0x8c0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc0e8[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x8c0e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c0e('0x1'));var router=express[_0x8c0e('0x2')]();var auth=require(_0x8c0e('0x3'));var interaction=require(_0x8c0e('0x4'));var config=require(_0x8c0e('0x5'));var controller=require(_0x8c0e('0x6'));router[_0x8c0e('0x7')]('/:id',auth[_0x8c0e('0x8')](),controller[_0x8c0e('0x9')]);router['delete'](_0x8c0e('0xa'),auth[_0x8c0e('0x8')](),controller[_0x8c0e('0xb')]);module['exports']=router; \ No newline at end of file +var _0x6220=['../../config/environment','put','/:id','update','delete','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6220,0xf8));var _0x0622=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6220[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0x0622('0x0'));var path=require(_0x0622('0x1'));var timeout=require(_0x0622('0x2'));var express=require(_0x0622('0x3'));var router=express[_0x0622('0x4')]();var auth=require(_0x0622('0x5'));var interaction=require(_0x0622('0x6'));var config=require(_0x0622('0x7'));var controller=require('./condition.controller');router[_0x0622('0x8')](_0x0622('0x9'),auth['isAuthenticated'](),controller[_0x0622('0xa')]);router[_0x0622('0xb')]('/:id',auth[_0x0622('0xc')](),controller[_0x0622('0xd')]);module[_0x0622('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 950ecc3..1e52e96 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 _0xe6c1=['exports','STRING','name'];(function(_0x2966fe,_0x5e9940){var _0x3a6705=function(_0x421240){while(--_0x421240){_0x2966fe['push'](_0x2966fe['shift']());}};_0x3a6705(++_0x5e9940);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x1e6c('0x0')]={'name':{'type':Sequelize[_0x1e6c('0x1')],'allowNull':![],'unique':_0x1e6c('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x0d4e=['STRING','name','INTEGER','sequelize','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0d4e[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xe0d4('0x0'));module[_0xe0d4('0x1')]={'name':{'type':Sequelize[_0xe0d4('0x2')],'allowNull':![],'unique':_0xe0d4('0x3')},'OrderBy':{'type':Sequelize[_0xe0d4('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe0d4('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 3719c74..797da01 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 _0x6aa7=['key','model','query','keys','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','fields','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','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName'];(function(_0x41c967,_0xe68f47){var _0x5cec5b=function(_0x19286f){while(--_0x19286f){_0x41c967['push'](_0x41c967['shift']());}};_0x5cec5b(++_0xe68f47);}(_0x6aa7,0x178));var _0x76aa=function(_0x2640d1,_0x48a758){_0x2640d1=_0x2640d1-0x0;var _0x588e65=_0x6aa7[_0x2640d1];return _0x588e65;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var authService=require(_0x76aa('0xf'));var qs=require(_0x76aa('0x10'));var as=require(_0x76aa('0x11'));var hardwareService=require(_0x76aa('0x12'));var logger=require(_0x76aa('0x13'))(_0x76aa('0x14'));var utils=require(_0x76aa('0x15'));var config=require(_0x76aa('0x16'));var db=require(_0x76aa('0x17'))['db'];function respondWithStatusCode(_0x5e5f47,_0x112c39){_0x112c39=_0x112c39||0xcc;return function(_0x5df49c){if(_0x5df49c){return _0x5e5f47[_0x76aa('0x18')](_0x112c39);}return _0x5e5f47[_0x76aa('0x19')](_0x112c39)[_0x76aa('0x1a')]();};}function respondWithResult(_0x8e44ed,_0x10432c){_0x10432c=_0x10432c||0xc8;return function(_0x4e309f){if(_0x4e309f){return _0x8e44ed['status'](_0x10432c)[_0x76aa('0x1b')](_0x4e309f);}};}function respondWithFilteredResult(_0x4cfc34,_0x180d92){return function(_0x319bf1){if(_0x319bf1){var _0x5cf594=_0x319bf1['count'],_0x2111c7=_0x180d92[_0x76aa('0x1c')],_0x550d9a=_0x180d92[_0x76aa('0x1c')]+_0x180d92[_0x76aa('0x1d')],_0x328381;if(_0x550d9a>=_0x5cf594){_0x550d9a=_0x5cf594;_0x328381=0xc8;}else{_0x328381=0xce;}_0x4cfc34[_0x76aa('0x19')](_0x328381);return _0x4cfc34[_0x76aa('0x1e')](_0x76aa('0x1f'),_0x2111c7+'-'+_0x550d9a+'/'+_0x5cf594)['json'](_0x319bf1);}return null;};}function patchUpdates(_0x5d6202){return function(_0x256636){try{jsonpatch[_0x76aa('0x20')](_0x256636,_0x5d6202,!![]);}catch(_0xf0711){return BPromise[_0x76aa('0x21')](_0xf0711);}return _0x256636[_0x76aa('0x22')]();};}function saveUpdates(_0x191560,_0x19af92){return function(_0x2eaf48){if(_0x2eaf48){return _0x2eaf48[_0x76aa('0x23')](_0x191560)['then'](function(_0x39ac5a){return _0x39ac5a;});}return null;};}function removeEntity(_0x21064c,_0x338a6b){return function(_0x5b3f55){if(_0x5b3f55){return _0x5b3f55[_0x76aa('0x24')]()[_0x76aa('0x25')](function(){var _0x31252f=_0x5b3f55[_0x76aa('0x26')]({'plain':!![]});var _0x29c50c=_0x76aa('0x27');return db[_0x76aa('0x28')][_0x76aa('0x24')]({'where':{'type':_0x29c50c,'resourceId':_0x31252f['id']}})[_0x76aa('0x25')](function(){return _0x5b3f55;});})[_0x76aa('0x25')](function(){_0x21064c[_0x76aa('0x19')](0xcc)[_0x76aa('0x1a')]();});}};}function handleEntityNotFound(_0x3599a9,_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x3599a9[_0x76aa('0x18')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x29')](_0xa1e6[_0x76aa('0x2a')]);if(_0xa1e6[_0x76aa('0x2b')]){delete _0xa1e6[_0x76aa('0x2b')];}_0x25c614[_0x76aa('0x19')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x2c')]=function(_0x5a8030,_0x994550){var _0x365ff8={},_0x2dec94={},_0x1e90b9={'count':0x0,'rows':[]};var _0x1eecd9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x19fd4f){return{'name':_0x19fd4f[_0x76aa('0x30')],'type':_0x19fd4f['type'][_0x76aa('0x31')]};});_0x2dec94[_0x76aa('0x32')]=_[_0x76aa('0x2d')](_0x1eecd9,_0x76aa('0x2b'));_0x2dec94[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x5a8030[_0x76aa('0x33')]);_0x2dec94['filters']=_[_0x76aa('0x35')](_0x2dec94[_0x76aa('0x32')],_0x2dec94['query']);_0x365ff8[_0x76aa('0x36')]=_['intersection'](_0x2dec94[_0x76aa('0x32')],qs['fields'](_0x5a8030[_0x76aa('0x33')]['fields']));_0x365ff8['attributes']=_0x365ff8[_0x76aa('0x36')][_0x76aa('0x37')]?_0x365ff8[_0x76aa('0x36')]:_0x2dec94[_0x76aa('0x32')];if(!_0x5a8030['query']['hasOwnProperty'](_0x76aa('0x38'))){_0x365ff8[_0x76aa('0x1d')]=qs[_0x76aa('0x1d')](_0x5a8030[_0x76aa('0x33')][_0x76aa('0x1d')]);_0x365ff8['offset']=qs[_0x76aa('0x1c')](_0x5a8030['query']['offset']);}_0x365ff8[_0x76aa('0x39')]=qs[_0x76aa('0x3a')](_0x5a8030[_0x76aa('0x33')][_0x76aa('0x3a')]);_0x365ff8['where']=qs[_0x76aa('0x3b')](_[_0x76aa('0x3c')](_0x5a8030[_0x76aa('0x33')],_0x2dec94['filters']),_0x1eecd9);if(_0x5a8030[_0x76aa('0x33')][_0x76aa('0x3d')]){_0x365ff8[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x365ff8[_0x76aa('0x3e')],{'$or':_[_0x76aa('0x2d')](_0x1eecd9,function(_0x878903){if(_0x878903[_0x76aa('0x40')]!==_0x76aa('0x41')){var _0x5f022a={};_0x5f022a[_0x878903[_0x76aa('0x2b')]]={'$like':'%'+_0x5a8030[_0x76aa('0x33')][_0x76aa('0x3d')]+'%'};return _0x5f022a;}})});}_0x365ff8=_[_0x76aa('0x3f')]({},_0x365ff8,_0x5a8030[_0x76aa('0x42')]);var _0x2957aa={'where':_0x365ff8['where']};return db['ContactItemType'][_0x76aa('0x43')](_0x2957aa)[_0x76aa('0x25')](function(_0x426454){_0x1e90b9[_0x76aa('0x43')]=_0x426454;if(_0x5a8030['query'][_0x76aa('0x44')]){_0x365ff8[_0x76aa('0x45')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x46')](_0x365ff8);})[_0x76aa('0x25')](function(_0x4aa2f3){_0x1e90b9[_0x76aa('0x47')]=_0x4aa2f3;return _0x1e90b9;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))[_0x76aa('0x48')](handleError(_0x994550,null));};exports['show']=function(_0x496304,_0x4f7f3a){var _0x144f0a={'raw':!![],'where':{'id':_0x496304['params']['id']}},_0x541594={};_0x541594['model']=_[_0x76aa('0x34')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x541594[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x496304['query']);_0x541594[_0x76aa('0x3b')]=_[_0x76aa('0x35')](_0x541594[_0x76aa('0x32')],_0x541594[_0x76aa('0x33')]);_0x144f0a[_0x76aa('0x36')]=_['intersection'](_0x541594[_0x76aa('0x32')],qs[_0x76aa('0x49')](_0x496304['query'][_0x76aa('0x49')]));_0x144f0a['attributes']=_0x144f0a[_0x76aa('0x36')][_0x76aa('0x37')]?_0x144f0a[_0x76aa('0x36')]:_0x541594[_0x76aa('0x32')];if(_0x496304[_0x76aa('0x33')][_0x76aa('0x44')]){_0x144f0a[_0x76aa('0x45')]=[{'all':!![]}];}_0x144f0a=_[_0x76aa('0x3f')]({},_0x144f0a,_0x496304[_0x76aa('0x42')]);return db[_0x76aa('0x2e')]['find'](_0x144f0a)[_0x76aa('0x25')](handleEntityNotFound(_0x4f7f3a,null))['then'](respondWithResult(_0x4f7f3a,null))[_0x76aa('0x48')](handleError(_0x4f7f3a,null));};exports[_0x76aa('0x4a')]=function(_0x5e95f5,_0x156d4e){return db['ContactItemType']['create'](_0x5e95f5[_0x76aa('0x4b')],{})['then'](function(_0x8660a4){var _0x302a0c=_0x5e95f5[_0x76aa('0x4c')][_0x76aa('0x26')]({'plain':!![]});if(!_0x302a0c)throw new Error(_0x76aa('0x4d'));if(_0x302a0c[_0x76aa('0x4e')]==='user'){var _0x564546=_0x8660a4[_0x76aa('0x26')]({'plain':!![]});var _0x1eafb2=_0x76aa('0x27');return db[_0x76aa('0x4f')][_0x76aa('0x50')]({'where':{'name':_0x1eafb2,'userProfileId':_0x302a0c[_0x76aa('0x51')]},'raw':!![]})['then'](function(_0x95b7c5){if(_0x95b7c5&&_0x95b7c5[_0x76aa('0x52')]===0x0){return db[_0x76aa('0x28')]['create']({'name':_0x564546[_0x76aa('0x2b')],'resourceId':_0x564546['id'],'type':_0x95b7c5['name'],'sectionId':_0x95b7c5['id']},{})[_0x76aa('0x25')](function(){return _0x8660a4;});}else{return _0x8660a4;}})['catch'](function(_0x339b0d){logger[_0x76aa('0x29')](_0x76aa('0x53'),_0x339b0d);throw _0x339b0d;});}return _0x8660a4;})[_0x76aa('0x25')](respondWithResult(_0x156d4e,0xc9))[_0x76aa('0x48')](handleError(_0x156d4e,null));};exports[_0x76aa('0x23')]=function(_0x953726,_0x4f2c2b){if(_0x953726[_0x76aa('0x4b')]['id']){delete _0x953726['body']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x50')]({'where':{'id':_0x953726[_0x76aa('0x54')]['id']}})[_0x76aa('0x25')](handleEntityNotFound(_0x4f2c2b,null))[_0x76aa('0x25')](saveUpdates(_0x953726[_0x76aa('0x4b')],null))[_0x76aa('0x25')](respondWithResult(_0x4f2c2b,null))['catch'](handleError(_0x4f2c2b,null));};exports[_0x76aa('0x24')]=function(_0x281f73,_0x27fc84){return db[_0x76aa('0x2e')]['find']({'where':{'id':_0x281f73[_0x76aa('0x54')]['id']}})[_0x76aa('0x25')](handleEntityNotFound(_0x27fc84,null))[_0x76aa('0x25')](removeEntity(_0x27fc84,null))[_0x76aa('0x48')](handleError(_0x27fc84,null));}; \ No newline at end of file +var _0x008c=['UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','send','index','map','ContactItemType','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ContactItemTypes'];(function(_0x23d89a,_0x115ed4){var _0x2b7686=function(_0x47d35c){while(--_0x47d35c){_0x23d89a['push'](_0x23d89a['shift']());}};_0x2b7686(++_0x115ed4);}(_0x008c,0x188));var _0xc008=function(_0x15b182,_0xb73a6e){_0x15b182=_0x15b182-0x0;var _0x400ac7=_0x008c[_0x15b182];return _0x400ac7;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){var _0x110128=_0x251db2['get']({'plain':!![]});var _0x459fd9='ContactItemTypes';return db['UserProfileResource'][_0xc008('0x1d')]({'where':{'type':_0x459fd9,'resourceId':_0x110128['id']}})[_0xc008('0x1e')](function(){return _0x251db2;});})[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48582b,_0x5de1e9){return function(_0x3f7b07){if(!_0x3f7b07){_0x48582b[_0xc008('0x17')](0x194);}return _0x3f7b07;};}function handleError(_0x92c582,_0x2e31c2){_0x2e31c2=_0x2e31c2||0x1f4;return function(_0x5bebd9){logger['error'](_0x5bebd9['stack']);if(_0x5bebd9['name']){delete _0x5bebd9['name'];}_0x92c582[_0xc008('0x18')](_0x2e31c2)[_0xc008('0x1f')](_0x5bebd9);};}exports[_0xc008('0x20')]=function(_0x529961,_0x24c14c){var _0x32390d={},_0x209591={},_0x2a7d4f={'count':0x0,'rows':[]};var _0x4c5dec=_[_0xc008('0x21')](db[_0xc008('0x22')]['rawAttributes'],function(_0x58db82){return{'name':_0x58db82['fieldName'],'type':_0x58db82[_0xc008('0x23')][_0xc008('0x24')]};});_0x209591[_0xc008('0x25')]=_[_0xc008('0x21')](_0x4c5dec,_0xc008('0x26'));_0x209591[_0xc008('0x27')]=_[_0xc008('0x28')](_0x529961[_0xc008('0x27')]);_0x209591[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x209591[_0xc008('0x25')],_0x209591[_0xc008('0x27')]);_0x32390d['attributes']=_[_0xc008('0x2a')](_0x209591[_0xc008('0x25')],qs['fields'](_0x529961[_0xc008('0x27')][_0xc008('0x2b')]));_0x32390d[_0xc008('0x2c')]=_0x32390d[_0xc008('0x2c')][_0xc008('0x2d')]?_0x32390d[_0xc008('0x2c')]:_0x209591[_0xc008('0x25')];if(!_0x529961[_0xc008('0x27')][_0xc008('0x2e')]('nolimit')){_0x32390d[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x529961[_0xc008('0x27')][_0xc008('0x2f')]);_0x32390d[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x529961[_0xc008('0x27')]['offset']);}_0x32390d[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x529961['query'][_0xc008('0x31')]);_0x32390d[_0xc008('0x32')]=qs['filters'](_[_0xc008('0x33')](_0x529961[_0xc008('0x27')],_0x209591[_0xc008('0x29')]),_0x4c5dec);if(_0x529961['query']['filter']){_0x32390d['where']=_[_0xc008('0x34')](_0x32390d['where'],{'$or':_[_0xc008('0x21')](_0x4c5dec,function(_0x3884dd){if(_0x3884dd[_0xc008('0x23')]!==_0xc008('0x35')){var _0x3148e1={};_0x3148e1[_0x3884dd[_0xc008('0x26')]]={'$like':'%'+_0x529961[_0xc008('0x27')][_0xc008('0x36')]+'%'};return _0x3148e1;}})});}_0x32390d=_[_0xc008('0x34')]({},_0x32390d,_0x529961[_0xc008('0x37')]);var _0x3ebb83={'where':_0x32390d[_0xc008('0x32')]};return db[_0xc008('0x22')][_0xc008('0x1a')](_0x3ebb83)['then'](function(_0x3238b4){_0x2a7d4f[_0xc008('0x1a')]=_0x3238b4;if(_0x529961[_0xc008('0x27')][_0xc008('0x38')]){_0x32390d['include']=[{'all':!![]}];}return db[_0xc008('0x22')][_0xc008('0x39')](_0x32390d);})[_0xc008('0x1e')](function(_0x36e7ae){_0x2a7d4f[_0xc008('0x3a')]=_0x36e7ae;return _0x2a7d4f;})['then'](respondWithFilteredResult(_0x24c14c,_0x32390d))[_0xc008('0x3b')](handleError(_0x24c14c,null));};exports[_0xc008('0x3c')]=function(_0x3794b0,_0x3e9a99){var _0x7279e8={'raw':!![],'where':{'id':_0x3794b0[_0xc008('0x3d')]['id']}},_0x4f93a4={};_0x4f93a4[_0xc008('0x25')]=_[_0xc008('0x28')](db[_0xc008('0x22')]['rawAttributes']);_0x4f93a4[_0xc008('0x27')]=_[_0xc008('0x28')](_0x3794b0[_0xc008('0x27')]);_0x4f93a4['filters']=_[_0xc008('0x2a')](_0x4f93a4['model'],_0x4f93a4[_0xc008('0x27')]);_0x7279e8['attributes']=_[_0xc008('0x2a')](_0x4f93a4[_0xc008('0x25')],qs['fields'](_0x3794b0[_0xc008('0x27')][_0xc008('0x2b')]));_0x7279e8[_0xc008('0x2c')]=_0x7279e8['attributes'][_0xc008('0x2d')]?_0x7279e8[_0xc008('0x2c')]:_0x4f93a4[_0xc008('0x25')];if(_0x3794b0[_0xc008('0x27')][_0xc008('0x38')]){_0x7279e8[_0xc008('0x3e')]=[{'all':!![]}];}_0x7279e8=_['merge']({},_0x7279e8,_0x3794b0['options']);return db['ContactItemType'][_0xc008('0x3f')](_0x7279e8)[_0xc008('0x1e')](handleEntityNotFound(_0x3e9a99,null))[_0xc008('0x1e')](respondWithResult(_0x3e9a99,null))[_0xc008('0x3b')](handleError(_0x3e9a99,null));};exports[_0xc008('0x40')]=function(_0x24f6a4,_0x2cf641){return db[_0xc008('0x22')]['create'](_0x24f6a4['body'],{})['then'](function(_0x2d5a49){var _0x2651cf=_0x24f6a4[_0xc008('0x41')]['get']({'plain':!![]});if(!_0x2651cf)throw new Error(_0xc008('0x42'));if(_0x2651cf[_0xc008('0x43')]===_0xc008('0x41')){var _0x1c2c50=_0x2d5a49[_0xc008('0x44')]({'plain':!![]});var _0x56e4ac=_0xc008('0x45');return db[_0xc008('0x46')][_0xc008('0x3f')]({'where':{'name':_0x56e4ac,'userProfileId':_0x2651cf[_0xc008('0x47')]},'raw':!![]})['then'](function(_0x4c63d4){if(_0x4c63d4&&_0x4c63d4[_0xc008('0x48')]===0x0){return db['UserProfileResource'][_0xc008('0x40')]({'name':_0x1c2c50[_0xc008('0x26')],'resourceId':_0x1c2c50['id'],'type':_0x4c63d4[_0xc008('0x26')],'sectionId':_0x4c63d4['id']},{})['then'](function(){return _0x2d5a49;});}else{return _0x2d5a49;}})[_0xc008('0x3b')](function(_0x32b435){logger[_0xc008('0x49')](_0xc008('0x4a'),_0x32b435);throw _0x32b435;});}return _0x2d5a49;})[_0xc008('0x1e')](respondWithResult(_0x2cf641,0xc9))['catch'](handleError(_0x2cf641,null));};exports[_0xc008('0x4b')]=function(_0x27b022,_0x4b4c6d){if(_0x27b022[_0xc008('0x4c')]['id']){delete _0x27b022[_0xc008('0x4c')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x27b022[_0xc008('0x3d')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x4b4c6d,null))[_0xc008('0x1e')](saveUpdates(_0x27b022[_0xc008('0x4c')],null))[_0xc008('0x1e')](respondWithResult(_0x4b4c6d,null))['catch'](handleError(_0x4b4c6d,null));};exports['destroy']=function(_0x34b72a,_0x5d815d){return db[_0xc008('0x22')][_0xc008('0x3f')]({'where':{'id':_0x34b72a[_0xc008('0x3d')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x5d815d,null))[_0xc008('0x1e')](removeEntity(_0x5d815d,null))[_0xc008('0x3b')](handleError(_0x5d815d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 14eb5a9..f0ea506 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 _0x7ebb=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x1fa038,_0x1c96e2){var _0x5720c6=function(_0x3ed6fd){while(--_0x3ed6fd){_0x1fa038['push'](_0x1fa038['shift']());}};_0x5720c6(++_0x1c96e2);}(_0x7ebb,0x161));var _0xb7eb=function(_0x30b58,_0x48df3b){_0x30b58=_0x30b58-0x0;var _0x9d210d=_0x7ebb[_0x30b58];return _0x9d210d;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var logger=require(_0xb7eb('0x2'))(_0xb7eb('0x3'));var moment=require(_0xb7eb('0x4'));var BPromise=require(_0xb7eb('0x5'));var rp=require(_0xb7eb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7eb('0x7'));var config=require(_0xb7eb('0x8'));var attributes=require(_0xb7eb('0x9'));module[_0xb7eb('0xa')]=function(_0x415157,_0x3982d7){return _0x415157[_0xb7eb('0xb')](_0xb7eb('0xc'),attributes,{'tableName':_0xb7eb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0024=['util','api','bluebird','rimraf','../../config/environment','define','ContactItemType'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x0024,0xa8));var _0x4002=function(_0x200766,_0x5114fa){_0x200766=_0x200766-0x0;var _0x8cc5d1=_0x0024[_0x200766];return _0x8cc5d1;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var logger=require('../../config/logger')(_0x4002('0x1'));var moment=require('moment');var BPromise=require(_0x4002('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4002('0x3'));var config=require(_0x4002('0x4'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x36c011,_0x144717){return _0x36c011[_0x4002('0x5')](_0x4002('0x6'),attributes,{'tableName':'tools_contact_item_types','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 1d8508f..7641e0e 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 _0xaf1d=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x53a07a,_0x41823c){_0x53a07a=_0x53a07a-0x0;var _0x59107e=_0xaf1d[_0x53a07a];return _0x59107e;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf1('0x4'));var db=require(_0xdaf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaf1('0x6'))(_0xdaf1('0x7'));var config=require(_0xdaf1('0x8'));var jayson=require(_0xdaf1('0x9'));var client=jayson[_0xdaf1('0xa')][_0xdaf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6c50,_0x54dc7a,_0x5ed9cd){return new BPromise(function(_0xfb18fc,_0x51a7e9){return client['request'](_0x4d6c50,_0x5ed9cd)[_0xdaf1('0xc')](function(_0x3219da){logger[_0xdaf1('0xd')](_0xdaf1('0xe'),_0x54dc7a,'request\x20sent');logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x54dc7a,_0xdaf1('0x11'),JSON[_0xdaf1('0x12')](_0x3219da));if(_0x3219da[_0xdaf1('0x13')]){if(_0x3219da['error'][_0xdaf1('0x14')]===0x1f4){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0x51a7e9(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0xfb18fc(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}else{logger['info'](_0xdaf1('0xe'),_0x54dc7a,_0xdaf1('0x11'));_0xfb18fc(_0x3219da['result'][_0xdaf1('0x15')]);}})['catch'](function(_0x39d34b){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x39d34b);_0x51a7e9(_0x39d34b);});});} \ No newline at end of file +var _0xa74d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa74d,0x1cf));var _0xda74=function(_0x1f800c,_0xbf544a){_0x1f800c=_0x1f800c-0x0;var _0x2129ec=_0xa74d[_0x1f800c];return _0x2129ec;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2113f2,_0x3fa4e7,_0x5da443){return new BPromise(function(_0x23d5f5,_0x517251){return client['request'](_0x2113f2,_0x5da443)[_0xda74('0xc')](function(_0x411790){logger['info'](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));logger[_0xda74('0xf')](_0xda74('0x10'),_0x3fa4e7,_0xda74('0xe'),JSON[_0xda74('0x11')](_0x411790));if(_0x411790[_0xda74('0x12')]){if(_0x411790[_0xda74('0x12')]['code']===0x1f4){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')]['message']);return _0x517251(_0x411790[_0xda74('0x12')][_0xda74('0x13')]);}logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')][_0xda74('0x13')]);return _0x23d5f5(_0x411790[_0xda74('0x12')]['message']);}else{logger[_0xda74('0x14')](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));_0x23d5f5(_0x411790[_0xda74('0x15')][_0xda74('0x13')]);}})['catch'](function(_0x1535d3){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x1535d3);_0x517251(_0x1535d3);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index db13d0b..d77e998 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 _0x5466=['show','post','create','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','index','get','isAuthenticated'];(function(_0x397e2f,_0x5a3f62){var _0x3f5b46=function(_0x21a5e9){while(--_0x21a5e9){_0x397e2f['push'](_0x397e2f['shift']());}};_0x3f5b46(++_0x5a3f62);}(_0x5466,0xf2));var _0x6546=function(_0x46b6e9,_0xf45e0d){_0x46b6e9=_0x46b6e9-0x0;var _0xc6f234=_0x5466[_0x46b6e9];return _0xc6f234;};'use strict';var multer=require(_0x6546('0x0'));var util=require('util');var path=require(_0x6546('0x1'));var timeout=require(_0x6546('0x2'));var express=require('express');var router=express[_0x6546('0x3')]();var auth=require(_0x6546('0x4'));var interaction=require(_0x6546('0x5'));var config=require('../../config/environment');var controller=require(_0x6546('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6546('0x7')]);router[_0x6546('0x8')]('/:id',auth[_0x6546('0x9')](),controller[_0x6546('0xa')]);router[_0x6546('0xb')]('/',auth[_0x6546('0x9')](),controller[_0x6546('0xc')]);router['put']('/:id',auth[_0x6546('0x9')](),controller[_0x6546('0xd')]);router[_0x6546('0xe')](_0x6546('0xf'),auth['isAuthenticated'](),controller[_0x6546('0x10')]);module[_0x6546('0x11')]=router; \ No newline at end of file +var _0x169f=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post'];(function(_0x2abdcb,_0x4a5307){var _0x2276c0=function(_0x168dce){while(--_0x168dce){_0x2abdcb['push'](_0x2abdcb['shift']());}};_0x2276c0(++_0x4a5307);}(_0x169f,0x15c));var _0xf169=function(_0x42fd3a,_0x4cbdab){_0x42fd3a=_0x42fd3a-0x0;var _0x1f7f53=_0x169f[_0x42fd3a];return _0x1f7f53;};'use strict';var multer=require(_0xf169('0x0'));var util=require(_0xf169('0x1'));var path=require(_0xf169('0x2'));var timeout=require(_0xf169('0x3'));var express=require('express');var router=express[_0xf169('0x4')]();var auth=require(_0xf169('0x5'));var interaction=require(_0xf169('0x6'));var config=require(_0xf169('0x7'));var controller=require('./contactItemType.controller');router[_0xf169('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf169('0x8')]('/:id',auth[_0xf169('0x9')](),controller[_0xf169('0xa')]);router[_0xf169('0xb')]('/',auth[_0xf169('0x9')](),controller['create']);router[_0xf169('0xc')](_0xf169('0xd'),auth[_0xf169('0x9')](),controller[_0xf169('0xe')]);router[_0xf169('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf169('0x10')]);module[_0xf169('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 294afd0..45c9598 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 _0x5301=['name','exports','STRING'];(function(_0x521f68,_0x2aa4e6){var _0x29722c=function(_0x338a48){while(--_0x338a48){_0x521f68['push'](_0x521f68['shift']());}};_0x29722c(++_0x2aa4e6);}(_0x5301,0x157));var _0x1530=function(_0x3418bb,_0x1b2618){_0x3418bb=_0x3418bb-0x0;var _0x1121df=_0x5301[_0x3418bb];return _0x1121df;};'use strict';var Sequelize=require('sequelize');module[_0x1530('0x0')]={'name':{'type':Sequelize[_0x1530('0x1')],'allowNull':![],'unique':_0x1530('0x2')},'description':{'type':Sequelize[_0x1530('0x1')]}}; \ No newline at end of file +var _0x6dd1=['sequelize','STRING','name'];(function(_0x42b362,_0x2fea19){var _0x49a47b=function(_0xe0a596){while(--_0xe0a596){_0x42b362['push'](_0x42b362['shift']());}};_0x49a47b(++_0x2fea19);}(_0x6dd1,0x111));var _0x16dd=function(_0x1d8c96,_0x341d73){_0x1d8c96=_0x1d8c96-0x0;var _0x5c8aa5=_0x6dd1[_0x1d8c96];return _0x5c8aa5;};'use strict';var Sequelize=require(_0x16dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x16dd('0x1')],'allowNull':![],'unique':_0x16dd('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 49b8c51..2d33b7e 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 _0x0f56=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','userProfileId','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','DashboardItem','eml-format','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x0f56,0xa0));var _0x60f5=function(_0x3a44bd,_0x4da623){_0x3a44bd=_0x3a44bd-0x0;var _0x2977b1=_0x0f56[_0x3a44bd];return _0x2977b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x60f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x60f5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x60f5('0x2'));var util=require(_0x60f5('0x3'));var path=require(_0x60f5('0x4'));var sox=require(_0x60f5('0x5'));var csv=require('to-csv');var ejs=require(_0x60f5('0x6'));var fs=require('fs');var _=require(_0x60f5('0x7'));var squel=require(_0x60f5('0x8'));var crypto=require(_0x60f5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x60f5('0xa'));var toCsv=require(_0x60f5('0xb'));var querystring=require(_0x60f5('0xc'));var Papa=require(_0x60f5('0xd'));var Redis=require(_0x60f5('0xe'));var authService=require(_0x60f5('0xf'));var qs=require(_0x60f5('0x10'));var as=require(_0x60f5('0x11'));var hardwareService=require(_0x60f5('0x12'));var logger=require('../../config/logger')(_0x60f5('0x13'));var utils=require(_0x60f5('0x14'));var config=require('../../config/environment');var db=require(_0x60f5('0x15'))['db'];config['redis']=_[_0x60f5('0x16')](config['redis'],{'host':_0x60f5('0x17'),'port':0x18eb});var socket=require(_0x60f5('0x18'))(new Redis(config[_0x60f5('0x19')]));require('./dashboard.socket')[_0x60f5('0x1a')](socket);function respondWithStatusCode(_0x270b1b,_0x2eabbf){_0x2eabbf=_0x2eabbf||0xcc;return function(_0x438b29){if(_0x438b29){return _0x270b1b[_0x60f5('0x1b')](_0x2eabbf);}return _0x270b1b['status'](_0x2eabbf)[_0x60f5('0x1c')]();};}function respondWithResult(_0x4fbcbb,_0x38f488){_0x38f488=_0x38f488||0xc8;return function(_0x411c20){if(_0x411c20){return _0x4fbcbb[_0x60f5('0x1d')](_0x38f488)['json'](_0x411c20);}};}function respondWithFilteredResult(_0x2e487c,_0x537173){return function(_0x30749a){if(_0x30749a){var _0x3056d8=_0x30749a[_0x60f5('0x1e')],_0x6e50b5=_0x537173[_0x60f5('0x1f')],_0x840fed=_0x537173['offset']+_0x537173[_0x60f5('0x20')],_0xbf11ad;if(_0x840fed>=_0x3056d8){_0x840fed=_0x3056d8;_0xbf11ad=0xc8;}else{_0xbf11ad=0xce;}_0x2e487c[_0x60f5('0x1d')](_0xbf11ad);return _0x2e487c[_0x60f5('0x21')](_0x60f5('0x22'),_0x6e50b5+'-'+_0x840fed+'/'+_0x3056d8)[_0x60f5('0x23')](_0x30749a);}return null;};}function patchUpdates(_0x2c4559){return function(_0x8329d){try{jsonpatch[_0x60f5('0x24')](_0x8329d,_0x2c4559,!![]);}catch(_0x3bb177){return BPromise[_0x60f5('0x25')](_0x3bb177);}return _0x8329d[_0x60f5('0x26')]();};}function saveUpdates(_0x8ed17,_0x1852b2){return function(_0x3f8524){if(_0x3f8524){return _0x3f8524[_0x60f5('0x27')](_0x8ed17)[_0x60f5('0x28')](function(_0x2246c4){return _0x2246c4;});}return null;};}function removeEntity(_0x22d0a3,_0x417520){return function(_0x430b81){if(_0x430b81){return _0x430b81['destroy']()[_0x60f5('0x28')](function(){var _0x18be99=_0x430b81[_0x60f5('0x29')]({'plain':!![]});var _0xcf15de='CustomDashboards';return db[_0x60f5('0x2a')][_0x60f5('0x2b')]({'where':{'type':_0xcf15de,'resourceId':_0x18be99['id']}})[_0x60f5('0x28')](function(){return _0x430b81;});})[_0x60f5('0x28')](function(){_0x22d0a3[_0x60f5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aefc9,_0x256f2a){return function(_0x1e3336){if(!_0x1e3336){_0x4aefc9['sendStatus'](0x194);}return _0x1e3336;};}function handleError(_0x535432,_0x3b0462){_0x3b0462=_0x3b0462||0x1f4;return function(_0x3e0b1e){logger[_0x60f5('0x2c')](_0x3e0b1e[_0x60f5('0x2d')]);if(_0x3e0b1e[_0x60f5('0x2e')]){delete _0x3e0b1e['name'];}_0x535432[_0x60f5('0x1d')](_0x3b0462)[_0x60f5('0x2f')](_0x3e0b1e);};}exports[_0x60f5('0x30')]=function(_0x41900e,_0x14e02d){var _0x165771={},_0x1b5c17={},_0x476fa8={'count':0x0,'rows':[]};var _0x3f9ebc=_[_0x60f5('0x31')](db[_0x60f5('0x32')][_0x60f5('0x33')],function(_0x3aa94c){return{'name':_0x3aa94c[_0x60f5('0x34')],'type':_0x3aa94c[_0x60f5('0x35')][_0x60f5('0x36')]};});_0x1b5c17[_0x60f5('0x37')]=_['map'](_0x3f9ebc,_0x60f5('0x2e'));_0x1b5c17['query']=_[_0x60f5('0x38')](_0x41900e['query']);_0x1b5c17[_0x60f5('0x39')]=_[_0x60f5('0x3a')](_0x1b5c17[_0x60f5('0x37')],_0x1b5c17['query']);_0x165771[_0x60f5('0x3b')]=_[_0x60f5('0x3a')](_0x1b5c17[_0x60f5('0x37')],qs[_0x60f5('0x3c')](_0x41900e[_0x60f5('0x3d')][_0x60f5('0x3c')]));_0x165771[_0x60f5('0x3b')]=_0x165771[_0x60f5('0x3b')][_0x60f5('0x3e')]?_0x165771[_0x60f5('0x3b')]:_0x1b5c17[_0x60f5('0x37')];if(!_0x41900e[_0x60f5('0x3d')][_0x60f5('0x3f')](_0x60f5('0x40'))){_0x165771[_0x60f5('0x20')]=qs[_0x60f5('0x20')](_0x41900e[_0x60f5('0x3d')][_0x60f5('0x20')]);_0x165771[_0x60f5('0x1f')]=qs[_0x60f5('0x1f')](_0x41900e[_0x60f5('0x3d')][_0x60f5('0x1f')]);}_0x165771[_0x60f5('0x41')]=qs[_0x60f5('0x42')](_0x41900e['query'][_0x60f5('0x42')]);_0x165771[_0x60f5('0x43')]=qs[_0x60f5('0x39')](_[_0x60f5('0x44')](_0x41900e[_0x60f5('0x3d')],_0x1b5c17[_0x60f5('0x39')]),_0x3f9ebc);if(_0x41900e[_0x60f5('0x3d')][_0x60f5('0x45')]){_0x165771[_0x60f5('0x43')]=_[_0x60f5('0x46')](_0x165771[_0x60f5('0x43')],{'$or':_[_0x60f5('0x31')](_0x3f9ebc,function(_0x5f02cf){if(_0x5f02cf[_0x60f5('0x35')]!=='VIRTUAL'){var _0x1ce6af={};_0x1ce6af[_0x5f02cf['name']]={'$like':'%'+_0x41900e[_0x60f5('0x3d')][_0x60f5('0x45')]+'%'};return _0x1ce6af;}})});}_0x165771=_[_0x60f5('0x46')]({},_0x165771,_0x41900e[_0x60f5('0x47')]);var _0x5e3971={'where':_0x165771[_0x60f5('0x43')]};return db['Dashboard'][_0x60f5('0x1e')](_0x5e3971)['then'](function(_0x31e829){_0x476fa8[_0x60f5('0x1e')]=_0x31e829;if(_0x41900e[_0x60f5('0x3d')]['includeAll']){_0x165771[_0x60f5('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x60f5('0x49')](_0x165771);})['then'](function(_0x4c0e83){_0x476fa8['rows']=_0x4c0e83;return _0x476fa8;})[_0x60f5('0x28')](respondWithFilteredResult(_0x14e02d,_0x165771))['catch'](handleError(_0x14e02d,null));};exports[_0x60f5('0x4a')]=function(_0x260478,_0x140a85){var _0x8a433b={'raw':![],'where':{'id':_0x260478[_0x60f5('0x4b')]['id']}},_0x55f6f6={};_0x55f6f6['model']=_[_0x60f5('0x38')](db[_0x60f5('0x32')][_0x60f5('0x33')]);_0x55f6f6['query']=_[_0x60f5('0x38')](_0x260478[_0x60f5('0x3d')]);_0x55f6f6[_0x60f5('0x39')]=_[_0x60f5('0x3a')](_0x55f6f6['model'],_0x55f6f6['query']);_0x8a433b['attributes']=_[_0x60f5('0x3a')](_0x55f6f6[_0x60f5('0x37')],qs['fields'](_0x260478[_0x60f5('0x3d')][_0x60f5('0x3c')]));_0x8a433b[_0x60f5('0x3b')]=_0x8a433b[_0x60f5('0x3b')][_0x60f5('0x3e')]?_0x8a433b[_0x60f5('0x3b')]:_0x55f6f6[_0x60f5('0x37')];if(_0x260478['query'][_0x60f5('0x4c')]){_0x8a433b[_0x60f5('0x48')]=[{'all':!![]}];}_0x8a433b=_[_0x60f5('0x46')]({},_0x8a433b,_0x260478['options']);return db['Dashboard']['find'](_0x8a433b)[_0x60f5('0x28')](handleEntityNotFound(_0x140a85,null))[_0x60f5('0x28')](respondWithResult(_0x140a85,null))[_0x60f5('0x4d')](handleError(_0x140a85,null));};exports[_0x60f5('0x4e')]=function(_0x5b5b9d,_0x3b3596){return db[_0x60f5('0x32')]['create'](_0x5b5b9d[_0x60f5('0x4f')],{})[_0x60f5('0x28')](function(_0x13afe6){var _0x36cb37=_0x5b5b9d[_0x60f5('0x50')][_0x60f5('0x29')]({'plain':!![]});if(!_0x36cb37)throw new Error(_0x60f5('0x51'));if(_0x36cb37[_0x60f5('0x52')]==='user'){var _0x3f4fa9=_0x13afe6[_0x60f5('0x29')]({'plain':!![]});var _0x4a83c8=_0x60f5('0x53');return db[_0x60f5('0x54')][_0x60f5('0x55')]({'where':{'name':_0x4a83c8,'userProfileId':_0x36cb37['userProfileId']},'raw':!![]})[_0x60f5('0x28')](function(_0x4f2645){if(_0x4f2645&&_0x4f2645[_0x60f5('0x56')]===0x0){return db['UserProfileResource'][_0x60f5('0x4e')]({'name':_0x3f4fa9[_0x60f5('0x2e')],'resourceId':_0x3f4fa9['id'],'type':_0x4f2645['name'],'sectionId':_0x4f2645['id']},{})[_0x60f5('0x28')](function(){return _0x13afe6;});}else{return _0x13afe6;}})[_0x60f5('0x4d')](function(_0xc152ac){logger['error'](_0x60f5('0x57'),_0xc152ac);throw _0xc152ac;});}return _0x13afe6;})[_0x60f5('0x28')](respondWithResult(_0x3b3596,0xc9))[_0x60f5('0x4d')](handleError(_0x3b3596,null));};exports['clone']=function(_0x2e53cb,_0x254d5a){var _0x43814b={'where':{'id':_0x2e53cb[_0x60f5('0x4b')]['id']}},_0x3196cd={};_0x3196cd[_0x60f5('0x37')]=_['keys'](db[_0x60f5('0x32')][_0x60f5('0x33')]);_0x43814b[_0x60f5('0x3b')]=_[_0x60f5('0x3a')](_0x3196cd[_0x60f5('0x37')],qs[_0x60f5('0x3c')](_0x2e53cb[_0x60f5('0x3d')][_0x60f5('0x3c')]));_0x43814b['attributes']=_0x43814b['attributes']['length']?_0x43814b[_0x60f5('0x3b')]:_0x3196cd[_0x60f5('0x37')];if(_0x2e53cb[_0x60f5('0x3d')][_0x60f5('0x4c')]){_0x43814b[_0x60f5('0x48')]=[{'all':!![]}];}_0x43814b=_[_0x60f5('0x46')]({},_0x43814b,_0x2e53cb['options']);return db[_0x60f5('0x32')][_0x60f5('0x55')](_0x43814b)[_0x60f5('0x28')](handleEntityNotFound(_0x254d5a,null))[_0x60f5('0x28')](function(_0x4d3720){if(_0x4d3720){var _0x477ba3=_0x4d3720[_0x60f5('0x29')]({'plain':!![]});_0x477ba3=qs[_0x60f5('0x58')](_0x477ba3,['id','createdAt',_0x60f5('0x59')]);_0x2e53cb[_0x60f5('0x4f')]=_[_0x60f5('0x58')](_0x2e53cb['body'],['id','createdAt',_0x60f5('0x59')]);return db[_0x60f5('0x32')][_0x60f5('0x4e')](_[_0x60f5('0x46')](_0x477ba3,_0x2e53cb[_0x60f5('0x4f')]),{'include':_0x2e53cb['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x52648d){var _0xbc01a4=_0x2e53cb[_0x60f5('0x50')][_0x60f5('0x29')]({'plain':!![]});if(!_0xbc01a4)throw new Error(_0x60f5('0x51'));if(_0xbc01a4[_0x60f5('0x52')]===_0x60f5('0x50')){var _0x525490=_0x52648d[_0x60f5('0x29')]({'plain':!![]});var _0x57a6d6=_0x60f5('0x53');return db['UserProfileSection'][_0x60f5('0x55')]({'where':{'name':_0x57a6d6,'userProfileId':_0xbc01a4[_0x60f5('0x5a')]},'raw':!![]})[_0x60f5('0x28')](function(_0x130ba4){if(_0x130ba4&&_0x130ba4['autoAssociation']===0x0){return db[_0x60f5('0x2a')][_0x60f5('0x4e')]({'name':_0x525490[_0x60f5('0x2e')],'resourceId':_0x525490['id'],'type':_0x130ba4[_0x60f5('0x2e')],'sectionId':_0x130ba4['id']},{})[_0x60f5('0x28')](function(){return _0x52648d;});}else{return _0x52648d;}})[_0x60f5('0x4d')](function(_0x1feb0d){logger[_0x60f5('0x2c')](_0x60f5('0x57'),_0x1feb0d);throw _0x1feb0d;});}return _0x52648d;});}})[_0x60f5('0x28')](respondWithResult(_0x254d5a,0xc9))['catch'](handleError(_0x254d5a,null));};exports[_0x60f5('0x27')]=function(_0x5d09e1,_0x4a24dd){if(_0x5d09e1[_0x60f5('0x4f')]['id']){delete _0x5d09e1[_0x60f5('0x4f')]['id'];}return db[_0x60f5('0x32')][_0x60f5('0x55')]({'where':{'id':_0x5d09e1['params']['id']}})[_0x60f5('0x28')](handleEntityNotFound(_0x4a24dd,null))[_0x60f5('0x28')](saveUpdates(_0x5d09e1['body'],null))['then'](respondWithResult(_0x4a24dd,null))[_0x60f5('0x4d')](handleError(_0x4a24dd,null));};exports['destroy']=function(_0x3a27b7,_0x4f9a25){return db['Dashboard'][_0x60f5('0x55')]({'where':{'id':_0x3a27b7[_0x60f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f9a25,null))[_0x60f5('0x28')](removeEntity(_0x4f9a25,null))['catch'](handleError(_0x4f9a25,null));};function widgetAttributes(_0x2b8cb0){try{switch(_0x2b8cb0[_0x60f5('0x35')]){case'iframe':return[{'name':_0x60f5('0x5b'),'value':_0x2b8cb0[_0x60f5('0x5b')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0['attrs'][0x0][_0x60f5('0x5d')]:undefined)||_0x60f5('0x5e')}];case _0x60f5('0x5f'):return[{'name':_0x60f5('0x60'),'value':_0x2b8cb0[_0x60f5('0x60')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||''}];case _0x60f5('0x61'):return[{'name':_0x60f5('0x62'),'value':_0x2b8cb0['attrHourFormat']||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x60f5('0x63'),'value':_0x2b8cb0[_0x60f5('0x63')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x1]?_0x2b8cb0[_0x60f5('0x5c')][0x1][_0x60f5('0x5d')]:undefined)||_0x60f5('0x64')},{'name':_0x60f5('0x65'),'value':_0x2b8cb0['attrFontSize']||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x2]?_0x2b8cb0[_0x60f5('0x5c')][0x2][_0x60f5('0x5d')]:undefined)||0xc}];case _0x60f5('0x66'):return[{'name':'attrMetric','value':_0x2b8cb0[_0x60f5('0x67')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||_0x60f5('0x68')},{'name':_0x60f5('0x69'),'value':_0x2b8cb0['attrVoiceQueues']||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x1]?_0x2b8cb0['attrs'][0x1][_0x60f5('0x5d')]:undefined)||[]},{'name':'attrFontSize','value':_0x2b8cb0[_0x60f5('0x65')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x2]?_0x2b8cb0[_0x60f5('0x5c')][0x2][_0x60f5('0x5d')]:undefined)||0x14}];case _0x60f5('0x6a'):case _0x60f5('0x6b'):return[{'name':_0x60f5('0x6c'),'value':_0x2b8cb0[_0x60f5('0x6c')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||_0x60f5('0x68')},{'name':_0x60f5('0x6d'),'value':_0x2b8cb0[_0x60f5('0x6d')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x1]?_0x2b8cb0[_0x60f5('0x5c')][0x1]['value']:undefined)||null},{'name':_0x60f5('0x6e'),'value':_0x2b8cb0[_0x60f5('0x6e')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x2]?_0x2b8cb0['attrs'][0x2][_0x60f5('0x5d')]:undefined)||null},{'name':_0x60f5('0x69'),'value':_0x2b8cb0[_0x60f5('0x69')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x3]?_0x2b8cb0[_0x60f5('0x5c')][0x3][_0x60f5('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0x60f5('0x6f'),'type':_0x2b8cb0['reportType']||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x35')]:undefined)||null,'value':_0x2b8cb0[_0x60f5('0x6f')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0['attrs'][0x0][_0x60f5('0x5d')]:undefined)||null},{'name':_0x60f5('0x70'),'value':_0x2b8cb0['attrRefresh']||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x1]?_0x2b8cb0['attrs'][0x1][_0x60f5('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x59a4b9){logger[_0x60f5('0x2c')](_0x60f5('0x71'),JSON[_0x60f5('0x72')](_0x59a4b9));return[];}}exports['addItem']=function(_0x2b3d31,_0x14b27d,_0x2c5744){if(_0x2b3d31[_0x60f5('0x4f')]['id']){delete _0x2b3d31[_0x60f5('0x4f')]['id'];}return db[_0x60f5('0x32')][_0x60f5('0x55')]({'where':{'id':_0x2b3d31['params']['id']}})[_0x60f5('0x28')](handleEntityNotFound(_0x14b27d,null))[_0x60f5('0x28')](function(_0x566c68){if(_0x566c68){_0x2b3d31[_0x60f5('0x4f')][_0x60f5('0x73')]=_0x566c68['id'];_0x2b3d31[_0x60f5('0x4f')][_0x60f5('0x5c')]=widgetAttributes(_0x2b3d31['body']);return db['DashboardItem'][_0x60f5('0x4e')](_0x2b3d31[_0x60f5('0x4f')]);}})[_0x60f5('0x28')](respondWithResult(_0x14b27d,null))[_0x60f5('0x4d')](handleError(_0x14b27d,null));};exports[_0x60f5('0x74')]=function(_0x3a6c2c,_0x54f067,_0x1eaa97){var _0x8e8356={};var _0x5b2765={};var _0x5ca030;var _0x243cfa;return db['Dashboard']['findOne']({'where':{'id':_0x3a6c2c[_0x60f5('0x4b')]['id']}})[_0x60f5('0x28')](handleEntityNotFound(_0x54f067,null))[_0x60f5('0x28')](function(_0x45595e){if(_0x45595e){_0x5ca030=_0x45595e;_0x5b2765[_0x60f5('0x37')]=_[_0x60f5('0x38')](db[_0x60f5('0x75')][_0x60f5('0x33')]);_0x5b2765[_0x60f5('0x3d')]=_[_0x60f5('0x38')](_0x3a6c2c[_0x60f5('0x3d')]);_0x5b2765[_0x60f5('0x39')]=_[_0x60f5('0x3a')](_0x5b2765[_0x60f5('0x37')],_0x5b2765[_0x60f5('0x3d')]);_0x8e8356[_0x60f5('0x3b')]=_[_0x60f5('0x3a')](_0x5b2765[_0x60f5('0x37')],qs['fields'](_0x3a6c2c[_0x60f5('0x3d')]['fields']));_0x8e8356[_0x60f5('0x3b')]=_0x8e8356['attributes'][_0x60f5('0x3e')]?_0x8e8356[_0x60f5('0x3b')]:_0x5b2765[_0x60f5('0x37')];_0x8e8356['order']=qs['sort'](_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x42')]);_0x8e8356[_0x60f5('0x43')]=qs[_0x60f5('0x39')](_[_0x60f5('0x44')](_0x3a6c2c[_0x60f5('0x3d')],_0x5b2765[_0x60f5('0x39')]));if(_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x45')]){_0x8e8356[_0x60f5('0x43')]=_['merge'](_0x8e8356['where'],{'$or':_[_0x60f5('0x31')](_0x8e8356['attributes'],function(_0x129282){var _0x1eb5da={};_0x1eb5da[_0x129282]={'$like':'%'+_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x45')]+'%'};return _0x1eb5da;})});}_0x8e8356=_[_0x60f5('0x46')]({},_0x8e8356,_0x3a6c2c[_0x60f5('0x47')]);return _0x5ca030[_0x60f5('0x74')](_0x8e8356);}})['then'](function(_0x39e163){if(_0x39e163){_0x243cfa=_0x39e163['length'];if(!_0x3a6c2c[_0x60f5('0x3d')]['hasOwnProperty']('nolimit')){_0x8e8356[_0x60f5('0x20')]=qs[_0x60f5('0x20')](_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x20')]);_0x8e8356[_0x60f5('0x1f')]=qs[_0x60f5('0x1f')](_0x3a6c2c[_0x60f5('0x3d')]['offset']);}return _0x5ca030[_0x60f5('0x74')](_0x8e8356);}})[_0x60f5('0x28')](function(_0x16cc26){if(_0x16cc26){return _0x16cc26?{'count':_0x243cfa,'rows':_0x16cc26}:null;}})[_0x60f5('0x28')](respondWithResult(_0x54f067,null))['catch'](handleError(_0x54f067,null));}; \ No newline at end of file +var _0x1f6a=['./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','then','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Dashboard','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','updatedAt','omit','createdAt','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x361026,_0x2375e2){var _0x37028e=function(_0x4f89e0){while(--_0x4f89e0){_0x361026['push'](_0x361026['shift']());}};_0x37028e(++_0x2375e2);}(_0x1f6a,0x15c));var _0xa1f6=function(_0x1280a1,_0x5967cd){_0x1280a1=_0x1280a1-0x0;var _0x240d6f=_0x1f6a[_0x1280a1];return _0x240d6f;};'use strict';var pdf=require(_0xa1f6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa1f6('0x1'));var zipdir=require(_0xa1f6('0x2'));var jsonpatch=require(_0xa1f6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1f6('0x4'));var Mustache=require(_0xa1f6('0x5'));var util=require(_0xa1f6('0x6'));var path=require(_0xa1f6('0x7'));var sox=require(_0xa1f6('0x8'));var csv=require('to-csv');var ejs=require(_0xa1f6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1f6('0xa'));var crypto=require('crypto');var jsforce=require(_0xa1f6('0xb'));var deskjs=require(_0xa1f6('0xc'));var toCsv=require(_0xa1f6('0xd'));var querystring=require('querystring');var Papa=require(_0xa1f6('0xe'));var Redis=require(_0xa1f6('0xf'));var authService=require(_0xa1f6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa1f6('0x11'));var hardwareService=require(_0xa1f6('0x12'));var logger=require(_0xa1f6('0x13'))('api');var utils=require(_0xa1f6('0x14'));var config=require(_0xa1f6('0x15'));var db=require(_0xa1f6('0x16'))['db'];config[_0xa1f6('0x17')]=_[_0xa1f6('0x18')](config[_0xa1f6('0x17')],{'host':_0xa1f6('0x19'),'port':0x18eb});var socket=require(_0xa1f6('0x1a'))(new Redis(config[_0xa1f6('0x17')]));require(_0xa1f6('0x1b'))[_0xa1f6('0x1c')](socket);function respondWithStatusCode(_0x284e69,_0x5e93dc){_0x5e93dc=_0x5e93dc||0xcc;return function(_0x5c8a55){if(_0x5c8a55){return _0x284e69[_0xa1f6('0x1d')](_0x5e93dc);}return _0x284e69[_0xa1f6('0x1e')](_0x5e93dc)[_0xa1f6('0x1f')]();};}function respondWithResult(_0x10b9b8,_0x523bf8){_0x523bf8=_0x523bf8||0xc8;return function(_0x28d531){if(_0x28d531){return _0x10b9b8[_0xa1f6('0x1e')](_0x523bf8)[_0xa1f6('0x20')](_0x28d531);}};}function respondWithFilteredResult(_0x5fd998,_0x2255e3){return function(_0x404134){if(_0x404134){var _0x2cf450=_0x404134[_0xa1f6('0x21')],_0x10e9e2=_0x2255e3[_0xa1f6('0x22')],_0x3273b3=_0x2255e3[_0xa1f6('0x22')]+_0x2255e3[_0xa1f6('0x23')],_0x36c527;if(_0x3273b3>=_0x2cf450){_0x3273b3=_0x2cf450;_0x36c527=0xc8;}else{_0x36c527=0xce;}_0x5fd998[_0xa1f6('0x1e')](_0x36c527);return _0x5fd998[_0xa1f6('0x24')](_0xa1f6('0x25'),_0x10e9e2+'-'+_0x3273b3+'/'+_0x2cf450)[_0xa1f6('0x20')](_0x404134);}return null;};}function patchUpdates(_0x2c8fea){return function(_0x1e41c9){try{jsonpatch['apply'](_0x1e41c9,_0x2c8fea,!![]);}catch(_0x276148){return BPromise[_0xa1f6('0x26')](_0x276148);}return _0x1e41c9[_0xa1f6('0x27')]();};}function saveUpdates(_0x5d4971,_0x1ed4ab){return function(_0x21147d){if(_0x21147d){return _0x21147d[_0xa1f6('0x28')](_0x5d4971)['then'](function(_0x36722f){return _0x36722f;});}return null;};}function removeEntity(_0x46706c,_0x4bdc17){return function(_0x17b1ae){if(_0x17b1ae){return _0x17b1ae[_0xa1f6('0x29')]()['then'](function(){var _0x10a77e=_0x17b1ae[_0xa1f6('0x2a')]({'plain':!![]});var _0x335678=_0xa1f6('0x2b');return db[_0xa1f6('0x2c')][_0xa1f6('0x29')]({'where':{'type':_0x335678,'resourceId':_0x10a77e['id']}})[_0xa1f6('0x2d')](function(){return _0x17b1ae;});})[_0xa1f6('0x2d')](function(){_0x46706c[_0xa1f6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275a1d,_0x4611dc){return function(_0x2d5c5f){if(!_0x2d5c5f){_0x275a1d[_0xa1f6('0x1d')](0x194);}return _0x2d5c5f;};}function handleError(_0x2d37a1,_0x2a2fe8){_0x2a2fe8=_0x2a2fe8||0x1f4;return function(_0x52cd3d){logger[_0xa1f6('0x2e')](_0x52cd3d[_0xa1f6('0x2f')]);if(_0x52cd3d[_0xa1f6('0x30')]){delete _0x52cd3d[_0xa1f6('0x30')];}_0x2d37a1[_0xa1f6('0x1e')](_0x2a2fe8)[_0xa1f6('0x31')](_0x52cd3d);};}exports[_0xa1f6('0x32')]=function(_0x5ec811,_0xa1258f){var _0x39f10e={},_0x1bd855={},_0x448da9={'count':0x0,'rows':[]};var _0x51d7d1=_['map'](db['Dashboard'][_0xa1f6('0x33')],function(_0x48d831){return{'name':_0x48d831[_0xa1f6('0x34')],'type':_0x48d831['type'][_0xa1f6('0x35')]};});_0x1bd855[_0xa1f6('0x36')]=_[_0xa1f6('0x37')](_0x51d7d1,_0xa1f6('0x30'));_0x1bd855[_0xa1f6('0x38')]=_[_0xa1f6('0x39')](_0x5ec811[_0xa1f6('0x38')]);_0x1bd855[_0xa1f6('0x3a')]=_[_0xa1f6('0x3b')](_0x1bd855['model'],_0x1bd855[_0xa1f6('0x38')]);_0x39f10e[_0xa1f6('0x3c')]=_['intersection'](_0x1bd855[_0xa1f6('0x36')],qs['fields'](_0x5ec811[_0xa1f6('0x38')][_0xa1f6('0x3d')]));_0x39f10e['attributes']=_0x39f10e[_0xa1f6('0x3c')][_0xa1f6('0x3e')]?_0x39f10e['attributes']:_0x1bd855[_0xa1f6('0x36')];if(!_0x5ec811[_0xa1f6('0x38')]['hasOwnProperty'](_0xa1f6('0x3f'))){_0x39f10e['limit']=qs[_0xa1f6('0x23')](_0x5ec811[_0xa1f6('0x38')]['limit']);_0x39f10e['offset']=qs[_0xa1f6('0x22')](_0x5ec811['query'][_0xa1f6('0x22')]);}_0x39f10e[_0xa1f6('0x40')]=qs[_0xa1f6('0x41')](_0x5ec811['query'][_0xa1f6('0x41')]);_0x39f10e[_0xa1f6('0x42')]=qs[_0xa1f6('0x3a')](_[_0xa1f6('0x43')](_0x5ec811['query'],_0x1bd855[_0xa1f6('0x3a')]),_0x51d7d1);if(_0x5ec811[_0xa1f6('0x38')][_0xa1f6('0x44')]){_0x39f10e[_0xa1f6('0x42')]=_[_0xa1f6('0x45')](_0x39f10e[_0xa1f6('0x42')],{'$or':_['map'](_0x51d7d1,function(_0x1f801b){if(_0x1f801b[_0xa1f6('0x46')]!==_0xa1f6('0x47')){var _0x4f6b85={};_0x4f6b85[_0x1f801b['name']]={'$like':'%'+_0x5ec811[_0xa1f6('0x38')]['filter']+'%'};return _0x4f6b85;}})});}_0x39f10e=_[_0xa1f6('0x45')]({},_0x39f10e,_0x5ec811['options']);var _0x159f94={'where':_0x39f10e[_0xa1f6('0x42')]};return db[_0xa1f6('0x48')][_0xa1f6('0x21')](_0x159f94)[_0xa1f6('0x2d')](function(_0x140606){_0x448da9[_0xa1f6('0x21')]=_0x140606;if(_0x5ec811[_0xa1f6('0x38')][_0xa1f6('0x49')]){_0x39f10e[_0xa1f6('0x4a')]=[{'all':!![]}];}return db[_0xa1f6('0x48')][_0xa1f6('0x4b')](_0x39f10e);})[_0xa1f6('0x2d')](function(_0x25745e){_0x448da9['rows']=_0x25745e;return _0x448da9;})['then'](respondWithFilteredResult(_0xa1258f,_0x39f10e))[_0xa1f6('0x4c')](handleError(_0xa1258f,null));};exports[_0xa1f6('0x4d')]=function(_0x2feb5b,_0xc4a5f2){var _0xb3916f={'raw':![],'where':{'id':_0x2feb5b[_0xa1f6('0x4e')]['id']}},_0x475b9a={};_0x475b9a[_0xa1f6('0x36')]=_['keys'](db[_0xa1f6('0x48')][_0xa1f6('0x33')]);_0x475b9a[_0xa1f6('0x38')]=_[_0xa1f6('0x39')](_0x2feb5b[_0xa1f6('0x38')]);_0x475b9a[_0xa1f6('0x3a')]=_[_0xa1f6('0x3b')](_0x475b9a[_0xa1f6('0x36')],_0x475b9a[_0xa1f6('0x38')]);_0xb3916f['attributes']=_[_0xa1f6('0x3b')](_0x475b9a[_0xa1f6('0x36')],qs['fields'](_0x2feb5b[_0xa1f6('0x38')]['fields']));_0xb3916f[_0xa1f6('0x3c')]=_0xb3916f['attributes']['length']?_0xb3916f['attributes']:_0x475b9a[_0xa1f6('0x36')];if(_0x2feb5b[_0xa1f6('0x38')][_0xa1f6('0x49')]){_0xb3916f[_0xa1f6('0x4a')]=[{'all':!![]}];}_0xb3916f=_['merge']({},_0xb3916f,_0x2feb5b[_0xa1f6('0x4f')]);return db[_0xa1f6('0x48')][_0xa1f6('0x50')](_0xb3916f)[_0xa1f6('0x2d')](handleEntityNotFound(_0xc4a5f2,null))['then'](respondWithResult(_0xc4a5f2,null))[_0xa1f6('0x4c')](handleError(_0xc4a5f2,null));};exports[_0xa1f6('0x51')]=function(_0x4f6c72,_0x20e5e2){return db[_0xa1f6('0x48')][_0xa1f6('0x51')](_0x4f6c72[_0xa1f6('0x52')],{})[_0xa1f6('0x2d')](function(_0x327db2){var _0x3d580e=_0x4f6c72[_0xa1f6('0x53')][_0xa1f6('0x2a')]({'plain':!![]});if(!_0x3d580e)throw new Error(_0xa1f6('0x54'));if(_0x3d580e['role']==='user'){var _0x22455b=_0x327db2['get']({'plain':!![]});var _0x307bd4=_0xa1f6('0x2b');return db['UserProfileSection'][_0xa1f6('0x50')]({'where':{'name':_0x307bd4,'userProfileId':_0x3d580e[_0xa1f6('0x55')]},'raw':!![]})[_0xa1f6('0x2d')](function(_0x5da7c4){if(_0x5da7c4&&_0x5da7c4['autoAssociation']===0x0){return db[_0xa1f6('0x2c')]['create']({'name':_0x22455b[_0xa1f6('0x30')],'resourceId':_0x22455b['id'],'type':_0x5da7c4[_0xa1f6('0x30')],'sectionId':_0x5da7c4['id']},{})[_0xa1f6('0x2d')](function(){return _0x327db2;});}else{return _0x327db2;}})[_0xa1f6('0x4c')](function(_0x3f7b20){logger[_0xa1f6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f7b20);throw _0x3f7b20;});}return _0x327db2;})['then'](respondWithResult(_0x20e5e2,0xc9))['catch'](handleError(_0x20e5e2,null));};exports['clone']=function(_0x421525,_0x1b1143){var _0x5843f1={'where':{'id':_0x421525['params']['id']}},_0x314844={};_0x314844[_0xa1f6('0x36')]=_[_0xa1f6('0x39')](db[_0xa1f6('0x48')][_0xa1f6('0x33')]);_0x5843f1[_0xa1f6('0x3c')]=_['intersection'](_0x314844[_0xa1f6('0x36')],qs['fields'](_0x421525[_0xa1f6('0x38')]['fields']));_0x5843f1[_0xa1f6('0x3c')]=_0x5843f1[_0xa1f6('0x3c')][_0xa1f6('0x3e')]?_0x5843f1['attributes']:_0x314844[_0xa1f6('0x36')];if(_0x421525[_0xa1f6('0x38')][_0xa1f6('0x49')]){_0x5843f1[_0xa1f6('0x4a')]=[{'all':!![]}];}_0x5843f1=_[_0xa1f6('0x45')]({},_0x5843f1,_0x421525[_0xa1f6('0x4f')]);return db['Dashboard'][_0xa1f6('0x50')](_0x5843f1)[_0xa1f6('0x2d')](handleEntityNotFound(_0x1b1143,null))['then'](function(_0x792899){if(_0x792899){var _0x5d2fc6=_0x792899['get']({'plain':!![]});_0x5d2fc6=qs['omit'](_0x5d2fc6,['id','createdAt',_0xa1f6('0x56')]);_0x421525[_0xa1f6('0x52')]=_[_0xa1f6('0x57')](_0x421525[_0xa1f6('0x52')],['id',_0xa1f6('0x58'),_0xa1f6('0x56')]);return db['Dashboard']['create'](_[_0xa1f6('0x45')](_0x5d2fc6,_0x421525[_0xa1f6('0x52')]),{'include':_0x421525[_0xa1f6('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0xa1f6('0x2d')](function(_0x221a7a){var _0x231434=_0x421525[_0xa1f6('0x53')][_0xa1f6('0x2a')]({'plain':!![]});if(!_0x231434)throw new Error(_0xa1f6('0x54'));if(_0x231434[_0xa1f6('0x59')]===_0xa1f6('0x53')){var _0x2dc2d1=_0x221a7a[_0xa1f6('0x2a')]({'plain':!![]});var _0x545284=_0xa1f6('0x2b');return db[_0xa1f6('0x5a')][_0xa1f6('0x50')]({'where':{'name':_0x545284,'userProfileId':_0x231434[_0xa1f6('0x55')]},'raw':!![]})['then'](function(_0x3f5caa){if(_0x3f5caa&&_0x3f5caa[_0xa1f6('0x5b')]===0x0){return db[_0xa1f6('0x2c')][_0xa1f6('0x51')]({'name':_0x2dc2d1[_0xa1f6('0x30')],'resourceId':_0x2dc2d1['id'],'type':_0x3f5caa[_0xa1f6('0x30')],'sectionId':_0x3f5caa['id']},{})[_0xa1f6('0x2d')](function(){return _0x221a7a;});}else{return _0x221a7a;}})[_0xa1f6('0x4c')](function(_0x54db00){logger[_0xa1f6('0x2e')](_0xa1f6('0x5c'),_0x54db00);throw _0x54db00;});}return _0x221a7a;});}})['then'](respondWithResult(_0x1b1143,0xc9))['catch'](handleError(_0x1b1143,null));};exports['update']=function(_0x33d4a1,_0x577fcb){if(_0x33d4a1[_0xa1f6('0x52')]['id']){delete _0x33d4a1['body']['id'];}return db[_0xa1f6('0x48')][_0xa1f6('0x50')]({'where':{'id':_0x33d4a1['params']['id']}})[_0xa1f6('0x2d')](handleEntityNotFound(_0x577fcb,null))[_0xa1f6('0x2d')](saveUpdates(_0x33d4a1[_0xa1f6('0x52')],null))[_0xa1f6('0x2d')](respondWithResult(_0x577fcb,null))[_0xa1f6('0x4c')](handleError(_0x577fcb,null));};exports[_0xa1f6('0x29')]=function(_0x160c31,_0x20065b){return db[_0xa1f6('0x48')][_0xa1f6('0x50')]({'where':{'id':_0x160c31[_0xa1f6('0x4e')]['id']}})[_0xa1f6('0x2d')](handleEntityNotFound(_0x20065b,null))[_0xa1f6('0x2d')](removeEntity(_0x20065b,null))[_0xa1f6('0x4c')](handleError(_0x20065b,null));};function widgetAttributes(_0x5b83c6){try{switch(_0x5b83c6['type']){case _0xa1f6('0x5d'):return[{'name':_0xa1f6('0x5e'),'value':_0x5b83c6[_0xa1f6('0x5e')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6[_0xa1f6('0x5f')][0x0]?_0x5b83c6['attrs'][0x0][_0xa1f6('0x60')]:undefined)||_0xa1f6('0x61')}];case'custom':return[{'name':_0xa1f6('0x62'),'value':_0x5b83c6['attrPath']||(_0x5b83c6['attrs']&&_0x5b83c6[_0xa1f6('0x5f')][0x0]?_0x5b83c6[_0xa1f6('0x5f')][0x0][_0xa1f6('0x60')]:undefined)||''}];case _0xa1f6('0x63'):return[{'name':'attrHourFormat','value':_0x5b83c6[_0xa1f6('0x64')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6[_0xa1f6('0x5f')][0x0]?_0x5b83c6['attrs'][0x0][_0xa1f6('0x60')]:undefined)||_0xa1f6('0x65')},{'name':'attrTimezone','value':_0x5b83c6[_0xa1f6('0x66')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6[_0xa1f6('0x5f')][0x1]?_0x5b83c6[_0xa1f6('0x5f')][0x1]['value']:undefined)||_0xa1f6('0x67')},{'name':_0xa1f6('0x68'),'value':_0x5b83c6[_0xa1f6('0x68')]||(_0x5b83c6['attrs']&&_0x5b83c6[_0xa1f6('0x5f')][0x2]?_0x5b83c6[_0xa1f6('0x5f')][0x2][_0xa1f6('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0xa1f6('0x69'),'value':_0x5b83c6[_0xa1f6('0x69')]||(_0x5b83c6['attrs']&&_0x5b83c6['attrs'][0x0]?_0x5b83c6[_0xa1f6('0x5f')][0x0][_0xa1f6('0x60')]:undefined)||_0xa1f6('0x6a')},{'name':_0xa1f6('0x6b'),'value':_0x5b83c6['attrVoiceQueues']||(_0x5b83c6['attrs']&&_0x5b83c6['attrs'][0x1]?_0x5b83c6['attrs'][0x1][_0xa1f6('0x60')]:undefined)||[]},{'name':_0xa1f6('0x68'),'value':_0x5b83c6[_0xa1f6('0x68')]||(_0x5b83c6['attrs']&&_0x5b83c6['attrs'][0x2]?_0x5b83c6[_0xa1f6('0x5f')][0x2][_0xa1f6('0x60')]:undefined)||0x14}];case _0xa1f6('0x6c'):case _0xa1f6('0x6d'):return[{'name':_0xa1f6('0x6e'),'value':_0x5b83c6[_0xa1f6('0x6e')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6[_0xa1f6('0x5f')][0x0]?_0x5b83c6[_0xa1f6('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0xa1f6('0x6f'),'value':_0x5b83c6[_0xa1f6('0x6f')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6[_0xa1f6('0x5f')][0x1]?_0x5b83c6['attrs'][0x1]['value']:undefined)||null},{'name':_0xa1f6('0x70'),'value':_0x5b83c6[_0xa1f6('0x70')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6['attrs'][0x2]?_0x5b83c6[_0xa1f6('0x5f')][0x2]['value']:undefined)||null},{'name':_0xa1f6('0x6b'),'value':_0x5b83c6[_0xa1f6('0x6b')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6['attrs'][0x3]?_0x5b83c6[_0xa1f6('0x5f')][0x3]['value']:undefined)||[]}];case _0xa1f6('0x71'):return[{'name':_0xa1f6('0x72'),'type':_0x5b83c6[_0xa1f6('0x73')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6[_0xa1f6('0x5f')][0x0]?_0x5b83c6[_0xa1f6('0x5f')][0x0]['type']:undefined)||null,'value':_0x5b83c6[_0xa1f6('0x72')]||(_0x5b83c6[_0xa1f6('0x5f')]&&_0x5b83c6['attrs'][0x0]?_0x5b83c6[_0xa1f6('0x5f')][0x0][_0xa1f6('0x60')]:undefined)||null},{'name':_0xa1f6('0x74'),'value':_0x5b83c6[_0xa1f6('0x74')]||(_0x5b83c6['attrs']&&_0x5b83c6[_0xa1f6('0x5f')][0x1]?_0x5b83c6[_0xa1f6('0x5f')][0x1][_0xa1f6('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x2dae1a){logger[_0xa1f6('0x2e')](_0xa1f6('0x75'),JSON[_0xa1f6('0x76')](_0x2dae1a));return[];}}exports[_0xa1f6('0x77')]=function(_0x3ddb61,_0x45c93f,_0x5a9e14){if(_0x3ddb61[_0xa1f6('0x52')]['id']){delete _0x3ddb61[_0xa1f6('0x52')]['id'];}return db[_0xa1f6('0x48')][_0xa1f6('0x50')]({'where':{'id':_0x3ddb61['params']['id']}})[_0xa1f6('0x2d')](handleEntityNotFound(_0x45c93f,null))[_0xa1f6('0x2d')](function(_0x7e8180){if(_0x7e8180){_0x3ddb61[_0xa1f6('0x52')][_0xa1f6('0x78')]=_0x7e8180['id'];_0x3ddb61[_0xa1f6('0x52')][_0xa1f6('0x5f')]=widgetAttributes(_0x3ddb61[_0xa1f6('0x52')]);return db[_0xa1f6('0x79')][_0xa1f6('0x51')](_0x3ddb61['body']);}})[_0xa1f6('0x2d')](respondWithResult(_0x45c93f,null))['catch'](handleError(_0x45c93f,null));};exports[_0xa1f6('0x7a')]=function(_0xbb094b,_0x2bd1f9,_0x53ec5f){var _0x5609a6={};var _0x186d19={};var _0x37a8b8;var _0x3f4f76;return db['Dashboard'][_0xa1f6('0x7b')]({'where':{'id':_0xbb094b[_0xa1f6('0x4e')]['id']}})[_0xa1f6('0x2d')](handleEntityNotFound(_0x2bd1f9,null))[_0xa1f6('0x2d')](function(_0x2ab28a){if(_0x2ab28a){_0x37a8b8=_0x2ab28a;_0x186d19['model']=_[_0xa1f6('0x39')](db[_0xa1f6('0x79')][_0xa1f6('0x33')]);_0x186d19[_0xa1f6('0x38')]=_['keys'](_0xbb094b['query']);_0x186d19[_0xa1f6('0x3a')]=_[_0xa1f6('0x3b')](_0x186d19[_0xa1f6('0x36')],_0x186d19['query']);_0x5609a6['attributes']=_[_0xa1f6('0x3b')](_0x186d19['model'],qs[_0xa1f6('0x3d')](_0xbb094b[_0xa1f6('0x38')][_0xa1f6('0x3d')]));_0x5609a6['attributes']=_0x5609a6[_0xa1f6('0x3c')]['length']?_0x5609a6[_0xa1f6('0x3c')]:_0x186d19['model'];_0x5609a6[_0xa1f6('0x40')]=qs[_0xa1f6('0x41')](_0xbb094b[_0xa1f6('0x38')]['sort']);_0x5609a6[_0xa1f6('0x42')]=qs[_0xa1f6('0x3a')](_[_0xa1f6('0x43')](_0xbb094b[_0xa1f6('0x38')],_0x186d19['filters']));if(_0xbb094b[_0xa1f6('0x38')]['filter']){_0x5609a6[_0xa1f6('0x42')]=_[_0xa1f6('0x45')](_0x5609a6[_0xa1f6('0x42')],{'$or':_[_0xa1f6('0x37')](_0x5609a6[_0xa1f6('0x3c')],function(_0x34bf58){var _0x2a5663={};_0x2a5663[_0x34bf58]={'$like':'%'+_0xbb094b[_0xa1f6('0x38')][_0xa1f6('0x44')]+'%'};return _0x2a5663;})});}_0x5609a6=_['merge']({},_0x5609a6,_0xbb094b['options']);return _0x37a8b8[_0xa1f6('0x7a')](_0x5609a6);}})[_0xa1f6('0x2d')](function(_0x4d2804){if(_0x4d2804){_0x3f4f76=_0x4d2804[_0xa1f6('0x3e')];if(!_0xbb094b[_0xa1f6('0x38')][_0xa1f6('0x7c')](_0xa1f6('0x3f'))){_0x5609a6[_0xa1f6('0x23')]=qs[_0xa1f6('0x23')](_0xbb094b[_0xa1f6('0x38')][_0xa1f6('0x23')]);_0x5609a6['offset']=qs['offset'](_0xbb094b[_0xa1f6('0x38')][_0xa1f6('0x22')]);}return _0x37a8b8[_0xa1f6('0x7a')](_0x5609a6);}})[_0xa1f6('0x2d')](function(_0x1636e6){if(_0x1636e6){return _0x1636e6?{'count':_0x3f4f76,'rows':_0x1636e6}:null;}})[_0xa1f6('0x2d')](respondWithResult(_0x2bd1f9,null))['catch'](handleError(_0x2bd1f9,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b569c0d..c50f713 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 _0xb550=['hook','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb550,0x19f));var _0x0b55=function(_0x2aa3bc,_0x2b10a3){_0x2aa3bc=_0x2aa3bc-0x0;var _0x1e3039=_0xb550[_0x2aa3bc];return _0x1e3039;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x0b55('0x0'))['db'][_0x0b55('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0b55('0x2')](0x0);var events={'afterCreate':_0x0b55('0x3'),'afterUpdate':_0x0b55('0x4'),'afterDestroy':_0x0b55('0x5')};function emitEvent(_0x471714){return function(_0x492c82,_0x271ef6,_0x2e341c){DashboardEvents[_0x0b55('0x6')](_0x471714+':'+_0x492c82['id'],_0x492c82);DashboardEvents['emit'](_0x471714,_0x492c82);_0x2e341c(null);};}for(var e in events){if(events[_0x0b55('0x7')](e)){var event=events[e];Dashboard[_0x0b55('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x7506=['hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x911f74,_0x8020b1){var _0x114eeb=function(_0x1c8969){while(--_0x1c8969){_0x911f74['push'](_0x911f74['shift']());}};_0x114eeb(++_0x8020b1);}(_0x7506,0x1e8));var _0x6750=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x7506[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x6750('0x0'))['db'][_0x6750('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6750('0x2')](0x0);var events={'afterCreate':_0x6750('0x3'),'afterUpdate':_0x6750('0x4'),'afterDestroy':_0x6750('0x5')};function emitEvent(_0x29b012){return function(_0x4b8bff,_0x30f9b8,_0x113679){DashboardEvents[_0x6750('0x6')](_0x29b012+':'+_0x4b8bff['id'],_0x4b8bff);DashboardEvents[_0x6750('0x6')](_0x29b012,_0x4b8bff);_0x113679(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x6750('0x7')](e,emitEvent(event));}}module[_0x6750('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 331309b..2c13829 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 _0x5521=['request-promise','path','../../config/environment','./dashboard.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x5521,0x119));var _0x1552=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5521[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1552('0x0'));var util=require(_0x1552('0x1'));var logger=require(_0x1552('0x2'))(_0x1552('0x3'));var moment=require(_0x1552('0x4'));var BPromise=require('bluebird');var rp=require(_0x1552('0x5'));var fs=require('fs');var path=require(_0x1552('0x6'));var rimraf=require('rimraf');var config=require(_0x1552('0x7'));var attributes=require(_0x1552('0x8'));module[_0x1552('0x9')]=function(_0x467a2c,_0x19ca18){return _0x467a2c[_0x1552('0xa')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1515=['Dashboard','dashboards','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x9920bc,_0x570538){var _0x347352=function(_0x673cd5){while(--_0x673cd5){_0x9920bc['push'](_0x9920bc['shift']());}};_0x347352(++_0x570538);}(_0x1515,0x1c2));var _0x5151=function(_0x2e8e81,_0x2278b6){_0x2e8e81=_0x2e8e81-0x0;var _0x34589a=_0x1515[_0x2e8e81];return _0x34589a;};'use strict';var _=require(_0x5151('0x0'));var util=require(_0x5151('0x1'));var logger=require('../../config/logger')(_0x5151('0x2'));var moment=require(_0x5151('0x3'));var BPromise=require(_0x5151('0x4'));var rp=require(_0x5151('0x5'));var fs=require('fs');var path=require(_0x5151('0x6'));var rimraf=require(_0x5151('0x7'));var config=require(_0x5151('0x8'));var attributes=require(_0x5151('0x9'));module[_0x5151('0xa')]=function(_0x170b6a,_0x441b3b){return _0x170b6a[_0x5151('0xb')](_0x5151('0xc'),attributes,{'tableName':_0x5151('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ee88d7f..c64cd32 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 _0xdd73=['stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x39b92f,_0x55efae){var _0x2779b0=function(_0x160b9b){while(--_0x160b9b){_0x39b92f['push'](_0x39b92f['shift']());}};_0x2779b0(++_0x55efae);}(_0xdd73,0x14a));var _0x3dd7=function(_0x5aef12,_0x1edd9d){_0x5aef12=_0x5aef12-0x0;var _0x245089=_0xdd73[_0x5aef12];return _0x245089;};'use strict';var _=require(_0x3dd7('0x0'));var util=require(_0x3dd7('0x1'));var moment=require(_0x3dd7('0x2'));var BPromise=require('bluebird');var rs=require(_0x3dd7('0x3'));var fs=require('fs');var Redis=require(_0x3dd7('0x4'));var db=require(_0x3dd7('0x5'))['db'];var utils=require(_0x3dd7('0x6'));var logger=require('../../config/logger')(_0x3dd7('0x7'));var config=require(_0x3dd7('0x8'));var jayson=require(_0x3dd7('0x9'));var client=jayson[_0x3dd7('0xa')][_0x3dd7('0xb')]({'port':0x232a});config[_0x3dd7('0xc')]=_[_0x3dd7('0xd')](config[_0x3dd7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3dd7('0xe'))(new Redis(config[_0x3dd7('0xc')]));require(_0x3dd7('0xf'))[_0x3dd7('0x10')](socket);function respondWithRpcPromise(_0x416f50,_0xe3c5f7,_0xeae21){return new BPromise(function(_0xa4c1e1,_0x288461){return client[_0x3dd7('0x11')](_0x416f50,_0xeae21)[_0x3dd7('0x12')](function(_0x4de9cb){logger['info'](_0x3dd7('0x13'),_0xe3c5f7,_0x3dd7('0x14'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0xe3c5f7,_0x3dd7('0x14'),JSON[_0x3dd7('0x15')](_0x4de9cb));if(_0x4de9cb[_0x3dd7('0x16')]){if(_0x4de9cb[_0x3dd7('0x16')]['code']===0x1f4){logger[_0x3dd7('0x16')](_0x3dd7('0x13'),_0xe3c5f7,_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);return _0x288461(_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);}logger[_0x3dd7('0x16')](_0x3dd7('0x13'),_0xe3c5f7,_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);return _0xa4c1e1(_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);}else{logger[_0x3dd7('0x18')](_0x3dd7('0x13'),_0xe3c5f7,'request\x20sent');_0xa4c1e1(_0x4de9cb[_0x3dd7('0x19')][_0x3dd7('0x17')]);}})[_0x3dd7('0x1a')](function(_0x17c3db){logger[_0x3dd7('0x16')]('Dashboard,\x20%s,\x20%s',_0xe3c5f7,_0x17c3db);_0x288461(_0x17c3db);});});} \ No newline at end of file +var _0xd84e=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0xd84e,0x137));var _0xed84=function(_0x25e633,_0x5b6f07){_0x25e633=_0x25e633-0x0;var _0x555dd9=_0xd84e[_0x25e633];return _0x555dd9;};'use strict';var _=require(_0xed84('0x0'));var util=require(_0xed84('0x1'));var moment=require('moment');var BPromise=require(_0xed84('0x2'));var rs=require(_0xed84('0x3'));var fs=require('fs');var Redis=require(_0xed84('0x4'));var db=require(_0xed84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed84('0x6'))(_0xed84('0x7'));var config=require('../../config/environment');var jayson=require(_0xed84('0x8'));var client=jayson['client'][_0xed84('0x9')]({'port':0x232a});config[_0xed84('0xa')]=_[_0xed84('0xb')](config[_0xed84('0xa')],{'host':_0xed84('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xed84('0xd'))[_0xed84('0xe')](socket);function respondWithRpcPromise(_0x1619e8,_0x29c3db,_0x4cec20){return new BPromise(function(_0x202bef,_0x126c22){return client[_0xed84('0xf')](_0x1619e8,_0x4cec20)[_0xed84('0x10')](function(_0x18908d){logger[_0xed84('0x11')](_0xed84('0x12'),_0x29c3db,'request\x20sent');logger[_0xed84('0x13')](_0xed84('0x14'),_0x29c3db,'request\x20sent',JSON[_0xed84('0x15')](_0x18908d));if(_0x18908d[_0xed84('0x16')]){if(_0x18908d['error'][_0xed84('0x17')]===0x1f4){logger[_0xed84('0x16')](_0xed84('0x12'),_0x29c3db,_0x18908d[_0xed84('0x16')][_0xed84('0x18')]);return _0x126c22(_0x18908d[_0xed84('0x16')][_0xed84('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x29c3db,_0x18908d[_0xed84('0x16')][_0xed84('0x18')]);return _0x202bef(_0x18908d['error'][_0xed84('0x18')]);}else{logger[_0xed84('0x11')](_0xed84('0x12'),_0x29c3db,'request\x20sent');_0x202bef(_0x18908d['result'][_0xed84('0x18')]);}})[_0xed84('0x19')](function(_0xdfb69c){logger['error']('Dashboard,\x20%s,\x20%s',_0x29c3db,_0xdfb69c);_0x126c22(_0xdfb69c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ed2c102..9780711 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 _0x8ab0=['length','./dashboard.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ab0,0x199));var _0x08ab=function(_0x234590,_0x36fd2a){_0x234590=_0x234590-0x0;var _0x49b3ef=_0x8ab0[_0x234590];return _0x49b3ef;};'use strict';var DashboardEvents=require(_0x08ab('0x0'));var events=[_0x08ab('0x1'),_0x08ab('0x2'),_0x08ab('0x3')];function createListener(_0x3e3721,_0x57cd4a){return function(_0x20908c){_0x57cd4a[_0x08ab('0x4')](_0x3e3721,_0x20908c);};}function removeListener(_0x21d3ca,_0x568be9){return function(){DashboardEvents['removeListener'](_0x21d3ca,_0x568be9);};}exports['register']=function(_0x1f1b88){for(var _0x4294a0=0x0,_0x143b63=events[_0x08ab('0x5')];_0x4294a0<_0x143b63;_0x4294a0++){var _0x37653d=events[_0x4294a0];var _0x34e784=createListener('dashboard:'+_0x37653d,_0x1f1b88);DashboardEvents['on'](_0x37653d,_0x34e784);}}; \ No newline at end of file +var _0xc77d=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xc77d,0x163));var _0xdc77=function(_0x507d71,_0x260c61){_0x507d71=_0x507d71-0x0;var _0xa8f225=_0xc77d[_0x507d71];return _0xa8f225;};'use strict';var DashboardEvents=require(_0xdc77('0x0'));var events=[_0xdc77('0x1'),_0xdc77('0x2'),_0xdc77('0x3')];function createListener(_0x54fca4,_0x5ee4e7){return function(_0x53332d){_0x5ee4e7[_0xdc77('0x4')](_0x54fca4,_0x53332d);};}function removeListener(_0x2092bb,_0x3e2cd4){return function(){DashboardEvents[_0xdc77('0x5')](_0x2092bb,_0x3e2cd4);};}exports[_0xdc77('0x6')]=function(_0x38436a){for(var _0xd1c430=0x0,_0x124a0b=events[_0xdc77('0x7')];_0xd1c430<_0x124a0b;_0xd1c430++){var _0x376adb=events[_0xd1c430];var _0xf7b841=createListener(_0xdc77('0x8')+_0x376adb,_0x38436a);DashboardEvents['on'](_0x376adb,_0xf7b841);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 86889a6..c355b0a 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 _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x254fae,_0x241be4){var _0x25db4b=function(_0x3bc3ba){while(--_0x3bc3ba){_0x254fae['push'](_0x254fae['shift']());}};_0x25db4b(++_0x241be4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 54367b2..625b15a 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 _0x7ad1=['STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7ad1,0x129));var _0x17ad=function(_0x3137f2,_0x3ab52d){_0x3137f2=_0x3137f2-0x0;var _0x4221a8=_0x7ad1[_0x3137f2];return _0x4221a8;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x17ad('0x0'));var _=require('lodash');module[_0x17ad('0x1')]={'title':{'type':Sequelize[_0x17ad('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x17ad('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x17ad('0x3')](_0x17ad('0x4')),'get':function(){try{return JSON[_0x17ad('0x5')](this[_0x17ad('0x6')](_0x17ad('0x7')));}catch(_0x3ab42f){return[];}},'set':function(_0x30f202){try{this[_0x17ad('0x8')](_0x17ad('0x7'),JSON[_0x17ad('0x9')](_0x30f202));}catch(_0x152092){this[_0x17ad('0x8')](_0x17ad('0x7'),JSON[_0x17ad('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x17ad('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x17ad('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x17ad('0xa')]},'col':{'type':Sequelize[_0x17ad('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x17ad('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x17ad('0x2')],'allowNull':![],'defaultValue':_0x17ad('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5132=['parse','getDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','STRING','TEXT','long'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x5132,0x126));var _0x2513=function(_0x32da9e,_0x195b39){_0x32da9e=_0x32da9e-0x0;var _0x5ca730=_0x5132[_0x32da9e];return _0x5ca730;};'use strict';var Sequelize=require(_0x2513('0x0'));var squel=require(_0x2513('0x1'));var _=require(_0x2513('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2513('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x2513('0x4')](_0x2513('0x5')),'get':function(){try{return JSON[_0x2513('0x6')](this[_0x2513('0x7')]('attrs'));}catch(_0x2e3a5a){return[];}},'set':function(_0x57445d){try{this['setDataValue']('attrs',JSON[_0x2513('0x8')](_0x57445d));}catch(_0x18960f){this['setDataValue']('attrs',JSON[_0x2513('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x2513('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2513('0x9')]},'col':{'type':Sequelize[_0x2513('0x9')]},'background':{'type':Sequelize[_0x2513('0x3')],'allowNull':![],'defaultValue':_0x2513('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2513('0x3')],'allowNull':![],'defaultValue':_0x2513('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2513('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 7e86321..470777b 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 _0xa1ee=['socket.io-emitter','./dashboardItem.socket','register','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x4fd82a,_0x29d9d5){var _0x21d2a8=function(_0x11f85f){while(--_0x11f85f){_0x4fd82a['push'](_0x4fd82a['shift']());}};_0x21d2a8(++_0x29d9d5);}(_0xa1ee,0xf2));var _0xea1e=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0xa1ee[_0x46d87a];return _0x115296;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xea1e('0x0'));var rimraf=require(_0xea1e('0x1'));var zipdir=require(_0xea1e('0x2'));var jsonpatch=require(_0xea1e('0x3'));var rp=require(_0xea1e('0x4'));var moment=require(_0xea1e('0x5'));var BPromise=require(_0xea1e('0x6'));var Mustache=require(_0xea1e('0x7'));var util=require(_0xea1e('0x8'));var path=require(_0xea1e('0x9'));var sox=require('sox');var csv=require(_0xea1e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xea1e('0xb'));var squel=require('squel');var crypto=require(_0xea1e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xea1e('0xd'));var toCsv=require(_0xea1e('0xa'));var querystring=require(_0xea1e('0xe'));var Papa=require(_0xea1e('0xf'));var Redis=require(_0xea1e('0x10'));var authService=require(_0xea1e('0x11'));var qs=require(_0xea1e('0x12'));var as=require(_0xea1e('0x13'));var hardwareService=require(_0xea1e('0x14'));var logger=require(_0xea1e('0x15'))(_0xea1e('0x16'));var utils=require(_0xea1e('0x17'));var config=require(_0xea1e('0x18'));var db=require(_0xea1e('0x19'))['db'];config[_0xea1e('0x1a')]=_['defaults'](config['redis'],{'host':_0xea1e('0x1b'),'port':0x18eb});var socket=require(_0xea1e('0x1c'))(new Redis(config['redis']));require(_0xea1e('0x1d'))[_0xea1e('0x1e')](socket);function respondWithStatusCode(_0x98bfe8,_0x4b8641){_0x4b8641=_0x4b8641||0xcc;return function(_0x5c705f){if(_0x5c705f){return _0x98bfe8['sendStatus'](_0x4b8641);}return _0x98bfe8[_0xea1e('0x1f')](_0x4b8641)[_0xea1e('0x20')]();};}function respondWithResult(_0xf12c69,_0xb9d9ea){_0xb9d9ea=_0xb9d9ea||0xc8;return function(_0x50aba3){if(_0x50aba3){return _0xf12c69[_0xea1e('0x1f')](_0xb9d9ea)['json'](_0x50aba3);}};}function respondWithFilteredResult(_0x493e44,_0x41fda9){return function(_0x54cda1){if(_0x54cda1){var _0x5d6891=_0x54cda1[_0xea1e('0x21')],_0x1cc5dc=_0x41fda9[_0xea1e('0x22')],_0x4d8d63=_0x41fda9[_0xea1e('0x22')]+_0x41fda9['limit'],_0x213646;if(_0x4d8d63>=_0x5d6891){_0x4d8d63=_0x5d6891;_0x213646=0xc8;}else{_0x213646=0xce;}_0x493e44[_0xea1e('0x1f')](_0x213646);return _0x493e44[_0xea1e('0x23')](_0xea1e('0x24'),_0x1cc5dc+'-'+_0x4d8d63+'/'+_0x5d6891)[_0xea1e('0x25')](_0x54cda1);}return null;};}function patchUpdates(_0x368c2a){return function(_0x1b0f8d){try{jsonpatch[_0xea1e('0x26')](_0x1b0f8d,_0x368c2a,!![]);}catch(_0x367ee){return BPromise['reject'](_0x367ee);}return _0x1b0f8d[_0xea1e('0x27')]();};}function saveUpdates(_0x4b42f0,_0x365ccb){return function(_0x36dbc9){if(_0x36dbc9){return _0x36dbc9[_0xea1e('0x28')](_0x4b42f0)[_0xea1e('0x29')](function(_0x3beb9c){return _0x3beb9c;});}return null;};}function removeEntity(_0x155f63,_0x594ad7){return function(_0x2b03f8){if(_0x2b03f8){return _0x2b03f8[_0xea1e('0x2a')]()['then'](function(){_0x155f63[_0xea1e('0x1f')](0xcc)[_0xea1e('0x20')]();});}};}function handleEntityNotFound(_0x4e9056,_0x159cb5){return function(_0x564a03){if(!_0x564a03){_0x4e9056['sendStatus'](0x194);}return _0x564a03;};}function handleError(_0x40f72e,_0x3f174c){_0x3f174c=_0x3f174c||0x1f4;return function(_0x39f915){logger[_0xea1e('0x2b')](_0x39f915[_0xea1e('0x2c')]);if(_0x39f915[_0xea1e('0x2d')]){delete _0x39f915['name'];}_0x40f72e[_0xea1e('0x1f')](_0x3f174c)[_0xea1e('0x2e')](_0x39f915);};}exports[_0xea1e('0x2f')]=function(_0x2b81e3,_0x4e0dba){var _0x14fe13={'raw':![],'where':{'id':_0x2b81e3['params']['id']}},_0x5c97c2={};_0x5c97c2[_0xea1e('0x30')]=_[_0xea1e('0x31')](db[_0xea1e('0x32')]['rawAttributes']);_0x5c97c2[_0xea1e('0x33')]=_[_0xea1e('0x31')](_0x2b81e3[_0xea1e('0x33')]);_0x5c97c2[_0xea1e('0x34')]=_[_0xea1e('0x35')](_0x5c97c2[_0xea1e('0x30')],_0x5c97c2[_0xea1e('0x33')]);_0x14fe13[_0xea1e('0x36')]=_[_0xea1e('0x35')](_0x5c97c2[_0xea1e('0x30')],qs[_0xea1e('0x37')](_0x2b81e3[_0xea1e('0x33')][_0xea1e('0x37')]));_0x14fe13[_0xea1e('0x36')]=_0x14fe13[_0xea1e('0x36')][_0xea1e('0x38')]?_0x14fe13[_0xea1e('0x36')]:_0x5c97c2[_0xea1e('0x30')];if(_0x2b81e3[_0xea1e('0x33')][_0xea1e('0x39')]){_0x14fe13['include']=[{'all':!![]}];}_0x14fe13=_['merge']({},_0x14fe13,_0x2b81e3[_0xea1e('0x3a')]);return db[_0xea1e('0x32')][_0xea1e('0x3b')](_0x14fe13)[_0xea1e('0x29')](handleEntityNotFound(_0x4e0dba,null))[_0xea1e('0x29')](respondWithResult(_0x4e0dba,null))[_0xea1e('0x3c')](handleError(_0x4e0dba,null));};exports[_0xea1e('0x2a')]=function(_0x5d2198,_0xbbe716){return db[_0xea1e('0x32')]['find']({'where':{'id':_0x5d2198[_0xea1e('0x3d')]['id']}})['then'](handleEntityNotFound(_0xbbe716,null))[_0xea1e('0x29')](removeEntity(_0xbbe716,null))[_0xea1e('0x3c')](handleError(_0xbbe716,null));};function widgetAttributes(_0x48fe4b){try{switch(_0x48fe4b[_0xea1e('0x3e')]){case _0xea1e('0x3f'):return[{'name':'attrUrl','value':_0x48fe4b[_0xea1e('0x40')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b['attrs'][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||_0xea1e('0x43')}];case _0xea1e('0x44'):return[{'name':_0xea1e('0x45'),'value':_0x48fe4b[_0xea1e('0x45')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0]['value']:undefined)||''}];case _0xea1e('0x46'):return[{'name':'attrHourFormat','value':_0x48fe4b[_0xea1e('0x47')]||(_0x48fe4b['attrs']&&_0x48fe4b['attrs'][0x0]?_0x48fe4b['attrs'][0x0][_0xea1e('0x42')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x48fe4b[_0xea1e('0x48')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b['attrs'][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1][_0xea1e('0x42')]:undefined)||_0xea1e('0x49')},{'name':_0xea1e('0x4a'),'value':_0x48fe4b[_0xea1e('0x4a')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b['attrs'][0x2]?_0x48fe4b[_0xea1e('0x41')][0x2][_0xea1e('0x42')]:undefined)||0xc}];case _0xea1e('0x4b'):return[{'name':_0xea1e('0x4c'),'value':_0x48fe4b[_0xea1e('0x4c')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||_0xea1e('0x4d')},{'name':_0xea1e('0x4e'),'value':_0x48fe4b[_0xea1e('0x4e')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1]['value']:undefined)||[]},{'name':_0xea1e('0x4a'),'value':_0x48fe4b[_0xea1e('0x4a')]||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x2]?_0x48fe4b[_0xea1e('0x41')][0x2][_0xea1e('0x42')]:undefined)||0x14}];case'multibar-chart':case _0xea1e('0x4f'):return[{'name':_0xea1e('0x50'),'value':_0x48fe4b[_0xea1e('0x50')]||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||'total'},{'name':'attrSerie2','value':_0x48fe4b[_0xea1e('0x51')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1][_0xea1e('0x42')]:undefined)||null},{'name':'attrSerie3','value':_0x48fe4b[_0xea1e('0x52')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x2]?_0x48fe4b[_0xea1e('0x41')][0x2]['value']:undefined)||null},{'name':_0xea1e('0x4e'),'value':_0x48fe4b[_0xea1e('0x4e')]||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x3]?_0x48fe4b[_0xea1e('0x41')][0x3][_0xea1e('0x42')]:undefined)||[]}];case _0xea1e('0x53'):return[{'name':_0xea1e('0x54'),'type':_0x48fe4b[_0xea1e('0x55')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x3e')]:undefined)||null,'value':_0x48fe4b[_0xea1e('0x54')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x48fe4b['attrRefresh']||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x24d88e){logger[_0xea1e('0x2b')](_0xea1e('0x56'),JSON[_0xea1e('0x57')](_0x24d88e));return[];}}exports[_0xea1e('0x58')]=function(_0x151465,_0x257943){if(_0x151465[_0xea1e('0x59')]){_0x151465[_0xea1e('0x59')]['attrs']=widgetAttributes(_0x151465[_0xea1e('0x59')]);}return db[_0xea1e('0x32')][_0xea1e('0x58')](_0x151465[_0xea1e('0x59')],{})[_0xea1e('0x29')](respondWithResult(_0x257943,0xc9))[_0xea1e('0x3c')](handleError(_0x257943,null));};exports[_0xea1e('0x28')]=function(_0x5d0470,_0x663349){if(_0x5d0470[_0xea1e('0x59')]['id']){delete _0x5d0470[_0xea1e('0x59')]['id'];}_0x5d0470[_0xea1e('0x59')][_0xea1e('0x41')]=widgetAttributes(_0x5d0470[_0xea1e('0x59')]);return db[_0xea1e('0x32')][_0xea1e('0x3b')]({'where':{'id':_0x5d0470['params']['id']}})[_0xea1e('0x29')](handleEntityNotFound(_0x663349,null))[_0xea1e('0x29')](saveUpdates(_0x5d0470[_0xea1e('0x59')],null))['then'](respondWithResult(_0x663349,null))[_0xea1e('0x3c')](handleError(_0x663349,null));}; \ No newline at end of file +var _0x074a=['bluebird','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','show','model','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','params','iframe','attrUrl','attrs','https://','attrPath','value','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','eml-format','rimraf','request-promise'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x074a,0x1af));var _0xa074=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x074a[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xa074('0x0'));var emlformat=require(_0xa074('0x1'));var rimraf=require(_0xa074('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa074('0x3'));var moment=require('moment');var BPromise=require(_0xa074('0x4'));var Mustache=require('mustache');var util=require(_0xa074('0x5'));var path=require('path');var sox=require(_0xa074('0x6'));var csv=require(_0xa074('0x7'));var ejs=require(_0xa074('0x8'));var fs=require('fs');var _=require(_0xa074('0x9'));var squel=require('squel');var crypto=require(_0xa074('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa074('0xb'));var Papa=require(_0xa074('0xc'));var Redis=require(_0xa074('0xd'));var authService=require(_0xa074('0xe'));var qs=require(_0xa074('0xf'));var as=require(_0xa074('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa074('0x11'))(_0xa074('0x12'));var utils=require(_0xa074('0x13'));var config=require(_0xa074('0x14'));var db=require(_0xa074('0x15'))['db'];config[_0xa074('0x16')]=_[_0xa074('0x17')](config[_0xa074('0x16')],{'host':_0xa074('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa074('0x16')]));require(_0xa074('0x19'))[_0xa074('0x1a')](socket);function respondWithStatusCode(_0x545f99,_0x57ad9d){_0x57ad9d=_0x57ad9d||0xcc;return function(_0x12a98a){if(_0x12a98a){return _0x545f99[_0xa074('0x1b')](_0x57ad9d);}return _0x545f99[_0xa074('0x1c')](_0x57ad9d)[_0xa074('0x1d')]();};}function respondWithResult(_0x4b0cf2,_0x8f87e0){_0x8f87e0=_0x8f87e0||0xc8;return function(_0x2efb1a){if(_0x2efb1a){return _0x4b0cf2['status'](_0x8f87e0)[_0xa074('0x1e')](_0x2efb1a);}};}function respondWithFilteredResult(_0x2b175a,_0x59d0d0){return function(_0x3fe495){if(_0x3fe495){var _0x357da0=_0x3fe495[_0xa074('0x1f')],_0x5e5868=_0x59d0d0[_0xa074('0x20')],_0x325aca=_0x59d0d0['offset']+_0x59d0d0[_0xa074('0x21')],_0x3ad7e6;if(_0x325aca>=_0x357da0){_0x325aca=_0x357da0;_0x3ad7e6=0xc8;}else{_0x3ad7e6=0xce;}_0x2b175a[_0xa074('0x1c')](_0x3ad7e6);return _0x2b175a[_0xa074('0x22')](_0xa074('0x23'),_0x5e5868+'-'+_0x325aca+'/'+_0x357da0)['json'](_0x3fe495);}return null;};}function patchUpdates(_0x183ffc){return function(_0x7a5ce1){try{jsonpatch[_0xa074('0x24')](_0x7a5ce1,_0x183ffc,!![]);}catch(_0x52207d){return BPromise[_0xa074('0x25')](_0x52207d);}return _0x7a5ce1[_0xa074('0x26')]();};}function saveUpdates(_0x306afd,_0x12f3d3){return function(_0x17cd38){if(_0x17cd38){return _0x17cd38['update'](_0x306afd)[_0xa074('0x27')](function(_0xa4b089){return _0xa4b089;});}return null;};}function removeEntity(_0x30ce9b,_0x3aac78){return function(_0x2558b6){if(_0x2558b6){return _0x2558b6['destroy']()['then'](function(){_0x30ce9b[_0xa074('0x1c')](0xcc)[_0xa074('0x1d')]();});}};}function handleEntityNotFound(_0x4a90fc,_0x5baef8){return function(_0x269ad5){if(!_0x269ad5){_0x4a90fc[_0xa074('0x1b')](0x194);}return _0x269ad5;};}function handleError(_0xad783b,_0x395b06){_0x395b06=_0x395b06||0x1f4;return function(_0x336a80){logger[_0xa074('0x28')](_0x336a80['stack']);if(_0x336a80[_0xa074('0x29')]){delete _0x336a80['name'];}_0xad783b['status'](_0x395b06)[_0xa074('0x2a')](_0x336a80);};}exports[_0xa074('0x2b')]=function(_0x289a7a,_0x5a9e8c){var _0x19e534={'raw':![],'where':{'id':_0x289a7a['params']['id']}},_0x1bc0cf={};_0x1bc0cf[_0xa074('0x2c')]=_['keys'](db[_0xa074('0x2d')][_0xa074('0x2e')]);_0x1bc0cf[_0xa074('0x2f')]=_['keys'](_0x289a7a[_0xa074('0x2f')]);_0x1bc0cf[_0xa074('0x30')]=_['intersection'](_0x1bc0cf['model'],_0x1bc0cf[_0xa074('0x2f')]);_0x19e534['attributes']=_[_0xa074('0x31')](_0x1bc0cf[_0xa074('0x2c')],qs[_0xa074('0x32')](_0x289a7a[_0xa074('0x2f')]['fields']));_0x19e534[_0xa074('0x33')]=_0x19e534[_0xa074('0x33')][_0xa074('0x34')]?_0x19e534[_0xa074('0x33')]:_0x1bc0cf['model'];if(_0x289a7a[_0xa074('0x2f')][_0xa074('0x35')]){_0x19e534['include']=[{'all':!![]}];}_0x19e534=_[_0xa074('0x36')]({},_0x19e534,_0x289a7a[_0xa074('0x37')]);return db['DashboardItem'][_0xa074('0x38')](_0x19e534)[_0xa074('0x27')](handleEntityNotFound(_0x5a9e8c,null))[_0xa074('0x27')](respondWithResult(_0x5a9e8c,null))[_0xa074('0x39')](handleError(_0x5a9e8c,null));};exports['destroy']=function(_0x2fca74,_0x50d178){return db[_0xa074('0x2d')][_0xa074('0x38')]({'where':{'id':_0x2fca74[_0xa074('0x3a')]['id']}})[_0xa074('0x27')](handleEntityNotFound(_0x50d178,null))[_0xa074('0x27')](removeEntity(_0x50d178,null))[_0xa074('0x39')](handleError(_0x50d178,null));};function widgetAttributes(_0x23abc1){try{switch(_0x23abc1['type']){case _0xa074('0x3b'):return[{'name':_0xa074('0x3c'),'value':_0x23abc1[_0xa074('0x3c')]||(_0x23abc1['attrs']&&_0x23abc1[_0xa074('0x3d')][0x0]?_0x23abc1[_0xa074('0x3d')][0x0]['value']:undefined)||_0xa074('0x3e')}];case'custom':return[{'name':_0xa074('0x3f'),'value':_0x23abc1[_0xa074('0x3f')]||(_0x23abc1['attrs']&&_0x23abc1[_0xa074('0x3d')][0x0]?_0x23abc1[_0xa074('0x3d')][0x0][_0xa074('0x40')]:undefined)||''}];case _0xa074('0x41'):return[{'name':'attrHourFormat','value':_0x23abc1['attrHourFormat']||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x0]?_0x23abc1[_0xa074('0x3d')][0x0][_0xa074('0x40')]:undefined)||_0xa074('0x42')},{'name':'attrTimezone','value':_0x23abc1[_0xa074('0x43')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1['attrs'][0x1]?_0x23abc1[_0xa074('0x3d')][0x1][_0xa074('0x40')]:undefined)||_0xa074('0x44')},{'name':'attrFontSize','value':_0x23abc1[_0xa074('0x45')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1['attrs'][0x2]?_0x23abc1[_0xa074('0x3d')][0x2][_0xa074('0x40')]:undefined)||0xc}];case _0xa074('0x46'):return[{'name':_0xa074('0x47'),'value':_0x23abc1[_0xa074('0x47')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x0]?_0x23abc1[_0xa074('0x3d')][0x0][_0xa074('0x40')]:undefined)||_0xa074('0x48')},{'name':'attrVoiceQueues','value':_0x23abc1[_0xa074('0x49')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x1]?_0x23abc1[_0xa074('0x3d')][0x1]['value']:undefined)||[]},{'name':_0xa074('0x45'),'value':_0x23abc1['attrFontSize']||(_0x23abc1['attrs']&&_0x23abc1[_0xa074('0x3d')][0x2]?_0x23abc1['attrs'][0x2][_0xa074('0x40')]:undefined)||0x14}];case _0xa074('0x4a'):case _0xa074('0x4b'):return[{'name':'attrSerie1','value':_0x23abc1['attrSerie1']||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1['attrs'][0x0]?_0x23abc1['attrs'][0x0]['value']:undefined)||_0xa074('0x48')},{'name':'attrSerie2','value':_0x23abc1[_0xa074('0x4c')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1['attrs'][0x1]?_0x23abc1[_0xa074('0x3d')][0x1][_0xa074('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x23abc1[_0xa074('0x4d')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1['attrs'][0x2]?_0x23abc1[_0xa074('0x3d')][0x2][_0xa074('0x40')]:undefined)||null},{'name':_0xa074('0x49'),'value':_0x23abc1[_0xa074('0x49')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x3]?_0x23abc1[_0xa074('0x3d')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xa074('0x4e'),'type':_0x23abc1[_0xa074('0x4f')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x0]?_0x23abc1['attrs'][0x0][_0xa074('0x50')]:undefined)||null,'value':_0x23abc1[_0xa074('0x4e')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x0]?_0x23abc1[_0xa074('0x3d')][0x0]['value']:undefined)||null},{'name':_0xa074('0x51'),'value':_0x23abc1[_0xa074('0x51')]||(_0x23abc1[_0xa074('0x3d')]&&_0x23abc1[_0xa074('0x3d')][0x1]?_0x23abc1[_0xa074('0x3d')][0x1][_0xa074('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x50d1cc){logger[_0xa074('0x28')](_0xa074('0x52'),JSON[_0xa074('0x53')](_0x50d1cc));return[];}}exports[_0xa074('0x54')]=function(_0x9759b1,_0x32cda4){if(_0x9759b1['body']){_0x9759b1['body'][_0xa074('0x3d')]=widgetAttributes(_0x9759b1[_0xa074('0x55')]);}return db[_0xa074('0x2d')]['create'](_0x9759b1[_0xa074('0x55')],{})[_0xa074('0x27')](respondWithResult(_0x32cda4,0xc9))['catch'](handleError(_0x32cda4,null));};exports[_0xa074('0x56')]=function(_0x13f444,_0x3720d9){if(_0x13f444[_0xa074('0x55')]['id']){delete _0x13f444[_0xa074('0x55')]['id'];}_0x13f444[_0xa074('0x55')]['attrs']=widgetAttributes(_0x13f444[_0xa074('0x55')]);return db[_0xa074('0x2d')][_0xa074('0x38')]({'where':{'id':_0x13f444['params']['id']}})[_0xa074('0x27')](handleEntityNotFound(_0x3720d9,null))[_0xa074('0x27')](saveUpdates(_0x13f444[_0xa074('0x55')],null))[_0xa074('0x27')](respondWithResult(_0x3720d9,null))['catch'](handleError(_0x3720d9,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 70ce921..19df329 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 _0xa3cf=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x118a66,_0x370d30){var _0x5edc9c=function(_0xb3b7f9){while(--_0xb3b7f9){_0x118a66['push'](_0x118a66['shift']());}};_0x5edc9c(++_0x370d30);}(_0xa3cf,0xfa));var _0xfa3c=function(_0x37a36e,_0x4fb349){_0x37a36e=_0x37a36e-0x0;var _0x1bc896=_0xa3cf[_0x37a36e];return _0x1bc896;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xfa3c('0x0'))['db'][_0xfa3c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfa3c('0x2')](0x0);var events={'afterCreate':_0xfa3c('0x3'),'afterUpdate':_0xfa3c('0x4'),'afterDestroy':_0xfa3c('0x5')};function emitEvent(_0x556e1d){return function(_0x19d014,_0x2d1aab,_0x1917f8){DashboardItemEvents[_0xfa3c('0x6')](_0x556e1d+':'+_0x19d014['id'],_0x19d014);DashboardItemEvents[_0xfa3c('0x6')](_0x556e1d,_0x19d014);_0x1917f8(null);};}for(var e in events){if(events[_0xfa3c('0x7')](e)){var event=events[e];DashboardItem[_0xfa3c('0x8')](e,emitEvent(event));}}module[_0xfa3c('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xc791=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x2eb7dd,_0x520d2f){var _0x52112f=function(_0x52939b){while(--_0x52939b){_0x2eb7dd['push'](_0x2eb7dd['shift']());}};_0x52112f(++_0x520d2f);}(_0xc791,0xa9));var _0x1c79=function(_0x3a290c,_0x5b4ef0){_0x3a290c=_0x3a290c-0x0;var _0x50227c=_0xc791[_0x3a290c];return _0x50227c;};'use strict';var EventEmitter=require(_0x1c79('0x0'));var DashboardItem=require(_0x1c79('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1c79('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1c79('0x3')};function emitEvent(_0x22c1a7){return function(_0x251052,_0x58903c,_0x5a1031){DashboardItemEvents[_0x1c79('0x4')](_0x22c1a7+':'+_0x251052['id'],_0x251052);DashboardItemEvents[_0x1c79('0x4')](_0x22c1a7,_0x251052);_0x5a1031(null);};}for(var e in events){if(events[_0x1c79('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x1c79('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a73df94..de52c1b 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 _0x8d4d=['rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x8d4d,0x187));var _0xd8d4=function(_0x29f8d2,_0x83c4c1){_0x29f8d2=_0x29f8d2-0x0;var _0x349d73=_0x8d4d[_0x29f8d2];return _0x349d73;};'use strict';var _=require(_0xd8d4('0x0'));var util=require(_0xd8d4('0x1'));var logger=require(_0xd8d4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd8d4('0x3'));var rp=require(_0xd8d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8d4('0x5'));var config=require(_0xd8d4('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xd8d4('0x7')]=function(_0x3878aa,_0xa7947c){return _0x3878aa[_0xd8d4('0x8')](_0xd8d4('0x9'),attributes,{'tableName':_0xd8d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash','util'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x6ca0,0x129));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x06ca('0x0'));var util=require(_0x06ca('0x1'));var logger=require(_0x06ca('0x2'))(_0x06ca('0x3'));var moment=require(_0x06ca('0x4'));var BPromise=require(_0x06ca('0x5'));var rp=require(_0x06ca('0x6'));var fs=require('fs');var path=require(_0x06ca('0x7'));var rimraf=require(_0x06ca('0x8'));var config=require(_0x06ca('0x9'));var attributes=require(_0x06ca('0xa'));module[_0x06ca('0xb')]=function(_0xda1428,_0x4d16b4){return _0xda1428['define'](_0x06ca('0xc'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 91ec4de..18d2aa2 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 _0x0905=['rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0905,0xf5));var _0x5090=function(_0x49ba8a,_0x4fa4c0){_0x49ba8a=_0x49ba8a-0x0;var _0x29fec4=_0x0905[_0x49ba8a];return _0x29fec4;};'use strict';var _=require('lodash');var util=require(_0x5090('0x0'));var moment=require('moment');var BPromise=require(_0x5090('0x1'));var rs=require(_0x5090('0x2'));var fs=require('fs');var Redis=require(_0x5090('0x3'));var db=require(_0x5090('0x4'))['db'];var utils=require(_0x5090('0x5'));var logger=require(_0x5090('0x6'))(_0x5090('0x7'));var config=require(_0x5090('0x8'));var jayson=require(_0x5090('0x9'));var client=jayson['client'][_0x5090('0xa')]({'port':0x232a});config['redis']=_[_0x5090('0xb')](config[_0x5090('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5090('0xd'))(new Redis(config[_0x5090('0xc')]));require(_0x5090('0xe'))[_0x5090('0xf')](socket);function respondWithRpcPromise(_0x4d6b49,_0x3b1b69,_0x35da14){return new BPromise(function(_0x3c68c8,_0x2b128e){return client['request'](_0x4d6b49,_0x35da14)[_0x5090('0x10')](function(_0x3fb873){logger[_0x5090('0x11')](_0x5090('0x12'),_0x3b1b69,_0x5090('0x13'));logger[_0x5090('0x14')](_0x5090('0x15'),_0x3b1b69,_0x5090('0x13'),JSON[_0x5090('0x16')](_0x3fb873));if(_0x3fb873[_0x5090('0x17')]){if(_0x3fb873[_0x5090('0x17')][_0x5090('0x18')]===0x1f4){logger[_0x5090('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3b1b69,_0x3fb873[_0x5090('0x17')][_0x5090('0x19')]);return _0x2b128e(_0x3fb873['error'][_0x5090('0x19')]);}logger[_0x5090('0x17')](_0x5090('0x12'),_0x3b1b69,_0x3fb873[_0x5090('0x17')][_0x5090('0x19')]);return _0x3c68c8(_0x3fb873[_0x5090('0x17')][_0x5090('0x19')]);}else{logger[_0x5090('0x11')](_0x5090('0x12'),_0x3b1b69,'request\x20sent');_0x3c68c8(_0x3fb873[_0x5090('0x1a')][_0x5090('0x19')]);}})[_0x5090('0x1b')](function(_0xf893ca){logger[_0x5090('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3b1b69,_0xf893ca);_0x2b128e(_0xf893ca);});});} \ No newline at end of file +var _0x82bb=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./dashboardItem.socket','register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x551160,_0x3ba006){var _0x28fdd7=function(_0x123b2d){while(--_0x123b2d){_0x551160['push'](_0x551160['shift']());}};_0x28fdd7(++_0x3ba006);}(_0x82bb,0x6b));var _0xb82b=function(_0xcd939f,_0x33117d){_0xcd939f=_0xcd939f-0x0;var _0xe23e6f=_0x82bb[_0xcd939f];return _0xe23e6f;};'use strict';var _=require(_0xb82b('0x0'));var util=require(_0xb82b('0x1'));var moment=require(_0xb82b('0x2'));var BPromise=require(_0xb82b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb82b('0x4'))['db'];var utils=require(_0xb82b('0x5'));var logger=require(_0xb82b('0x6'))(_0xb82b('0x7'));var config=require(_0xb82b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb82b('0x9')][_0xb82b('0xa')]({'port':0x232a});config['redis']=_[_0xb82b('0xb')](config[_0xb82b('0xc')],{'host':_0xb82b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb82b('0xe'))[_0xb82b('0xf')](socket);function respondWithRpcPromise(_0x2b3b7b,_0x1e58ec,_0x2b9013){return new BPromise(function(_0x50b0b0,_0x2a9b56){return client['request'](_0x2b3b7b,_0x2b9013)[_0xb82b('0x10')](function(_0x144cea){logger['info'](_0xb82b('0x11'),_0x1e58ec,_0xb82b('0x12'));logger[_0xb82b('0x13')](_0xb82b('0x14'),_0x1e58ec,_0xb82b('0x12'),JSON[_0xb82b('0x15')](_0x144cea));if(_0x144cea[_0xb82b('0x16')]){if(_0x144cea['error'][_0xb82b('0x17')]===0x1f4){logger[_0xb82b('0x16')](_0xb82b('0x11'),_0x1e58ec,_0x144cea['error'][_0xb82b('0x18')]);return _0x2a9b56(_0x144cea[_0xb82b('0x16')][_0xb82b('0x18')]);}logger[_0xb82b('0x16')](_0xb82b('0x11'),_0x1e58ec,_0x144cea[_0xb82b('0x16')][_0xb82b('0x18')]);return _0x50b0b0(_0x144cea[_0xb82b('0x16')][_0xb82b('0x18')]);}else{logger[_0xb82b('0x19')](_0xb82b('0x11'),_0x1e58ec,_0xb82b('0x12'));_0x50b0b0(_0x144cea[_0xb82b('0x1a')][_0xb82b('0x18')]);}})[_0xb82b('0x1b')](function(_0x56886c){logger[_0xb82b('0x16')](_0xb82b('0x11'),_0x1e58ec,_0x56886c);_0x2a9b56(_0x56886c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index df49386..11dca7d 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 _0xa99d=['length','./dashboardItem.events','save','removeListener','register'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xa99d,0x1dc));var _0xda99=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xa99d[_0x388b47];return _0x4859df;};'use strict';var DashboardItemEvents=require(_0xda99('0x0'));var events=[_0xda99('0x1'),'remove','update'];function createListener(_0x5a43ab,_0x8a7338){return function(_0x556ab0){_0x8a7338['emit'](_0x5a43ab,_0x556ab0);};}function removeListener(_0x2b1d23,_0x27c5d3){return function(){DashboardItemEvents[_0xda99('0x2')](_0x2b1d23,_0x27c5d3);};}exports[_0xda99('0x3')]=function(_0x3b7021){for(var _0x2bbe66=0x0,_0x39bc21=events[_0xda99('0x4')];_0x2bbe66<_0x39bc21;_0x2bbe66++){var _0x279ad9=events[_0x2bbe66];var _0x47846d=createListener('dashboardItem:'+_0x279ad9,_0x3b7021);DashboardItemEvents['on'](_0x279ad9,_0x47846d);}}; \ No newline at end of file +var _0x4dce=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x5e9c3a,_0x13acc2){var _0x12ccb4=function(_0x3ffd23){while(--_0x3ffd23){_0x5e9c3a['push'](_0x5e9c3a['shift']());}};_0x12ccb4(++_0x13acc2);}(_0x4dce,0xdd));var _0xe4dc=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0x4dce[_0x4b3d13];return _0xf64dd8;};'use strict';var DashboardItemEvents=require(_0xe4dc('0x0'));var events=[_0xe4dc('0x1'),_0xe4dc('0x2'),'update'];function createListener(_0x2e226d,_0x457c29){return function(_0x22df9b){_0x457c29[_0xe4dc('0x3')](_0x2e226d,_0x22df9b);};}function removeListener(_0x17c99a,_0x3075fb){return function(){DashboardItemEvents[_0xe4dc('0x4')](_0x17c99a,_0x3075fb);};}exports[_0xe4dc('0x5')]=function(_0xfa9db8){for(var _0x111148=0x0,_0x508c00=events[_0xe4dc('0x6')];_0x111148<_0x508c00;_0x111148++){var _0x878459=events[_0x111148];var _0x3938dc=createListener(_0xe4dc('0x7')+_0x878459,_0xfa9db8);DashboardItemEvents['on'](_0x878459,_0x3938dc);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1d1cdc3..cf74e02 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 _0x7da7=['put','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create'];(function(_0x1544c7,_0x52670b){var _0x1a350d=function(_0x97f4e9){while(--_0x97f4e9){_0x1544c7['push'](_0x1544c7['shift']());}};_0x1a350d(++_0x52670b);}(_0x7da7,0x10d));var _0x77da=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x7da7[_0x39780c];return _0x53c19b;};'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'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x9')]('/',auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xc')]);router['delete'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);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(_0x426a37,_0x1d32df){var _0x4e9e28=function(_0x420223){while(--_0x420223){_0x426a37['push'](_0x426a37['shift']());}};_0x4e9e28(++_0x1d32df);}(_0x31f0,0xb7));var _0x031f=function(_0x5dc02f,_0x53542a){_0x5dc02f=_0x5dc02f-0x0;var _0x20ff93=_0x31f0[_0x5dc02f];return _0x20ff93;};'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 6e69574..03135a9 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 _0x516d=['exports','STRING'];(function(_0x4068e6,_0x209435){var _0x1c8395=function(_0x2ec4ff){while(--_0x2ec4ff){_0x4068e6['push'](_0x4068e6['shift']());}};_0x1c8395(++_0x209435);}(_0x516d,0xc0));var _0xd516=function(_0x319ab9,_0xad6320){_0x319ab9=_0x319ab9-0x0;var _0x4308eb=_0x516d[_0x319ab9];return _0x4308eb;};'use strict';var Sequelize=require('sequelize');module[_0xd516('0x0')]={'name':{'type':Sequelize[_0xd516('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8101=['sequelize','exports','STRING'];(function(_0x16367d,_0x528383){var _0x508889=function(_0x1bab33){while(--_0x1bab33){_0x16367d['push'](_0x16367d['shift']());}};_0x508889(++_0x528383);}(_0x8101,0x8d));var _0x1810=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x8101[_0x2c0be1];return _0x3d4bd2;};'use strict';var Sequelize=require(_0x1810('0x0'));module[_0x1810('0x1')]={'name':{'type':Sequelize[_0x1810('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 36c3a25..bd69e81 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 _0xf8e4=['rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','UserProfileResource','then','error','name','send','map'];(function(_0x4c35a0,_0x99114b){var _0x2ef0e9=function(_0x7c207){while(--_0x7c207){_0x4c35a0['push'](_0x4c35a0['shift']());}};_0x2ef0e9(++_0x99114b);}(_0xf8e4,0x118));var _0x4f8e=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xf8e4[_0x30a31e];return _0x170879;};'use strict';var pdf=require(_0x4f8e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f8e('0x1'));var jsonpatch=require(_0x4f8e('0x2'));var rp=require(_0x4f8e('0x3'));var moment=require('moment');var BPromise=require(_0x4f8e('0x4'));var Mustache=require(_0x4f8e('0x5'));var util=require(_0x4f8e('0x6'));var path=require(_0x4f8e('0x7'));var sox=require(_0x4f8e('0x8'));var csv=require(_0x4f8e('0x9'));var ejs=require(_0x4f8e('0xa'));var fs=require('fs');var _=require(_0x4f8e('0xb'));var squel=require('squel');var crypto=require(_0x4f8e('0xc'));var jsforce=require(_0x4f8e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f8e('0x9'));var querystring=require(_0x4f8e('0xe'));var Papa=require(_0x4f8e('0xf'));var Redis=require(_0x4f8e('0x10'));var authService=require(_0x4f8e('0x11'));var qs=require(_0x4f8e('0x12'));var as=require(_0x4f8e('0x13'));var hardwareService=require(_0x4f8e('0x14'));var logger=require(_0x4f8e('0x15'))(_0x4f8e('0x16'));var utils=require(_0x4f8e('0x17'));var config=require(_0x4f8e('0x18'));var db=require(_0x4f8e('0x19'))['db'];function respondWithStatusCode(_0x2bf804,_0x4d3af2){_0x4d3af2=_0x4d3af2||0xcc;return function(_0xfb0d1f){if(_0xfb0d1f){return _0x2bf804[_0x4f8e('0x1a')](_0x4d3af2);}return _0x2bf804[_0x4f8e('0x1b')](_0x4d3af2)[_0x4f8e('0x1c')]();};}function respondWithResult(_0x540621,_0x2ad667){_0x2ad667=_0x2ad667||0xc8;return function(_0x43886f){if(_0x43886f){return _0x540621[_0x4f8e('0x1b')](_0x2ad667)[_0x4f8e('0x1d')](_0x43886f);}};}function respondWithFilteredResult(_0xc3c70a,_0x1723eb){return function(_0x570cd0){if(_0x570cd0){var _0x2de19d=_0x570cd0[_0x4f8e('0x1e')],_0x4d27af=_0x1723eb[_0x4f8e('0x1f')],_0x427870=_0x1723eb[_0x4f8e('0x1f')]+_0x1723eb[_0x4f8e('0x20')],_0x2bf358;if(_0x427870>=_0x2de19d){_0x427870=_0x2de19d;_0x2bf358=0xc8;}else{_0x2bf358=0xce;}_0xc3c70a['status'](_0x2bf358);return _0xc3c70a[_0x4f8e('0x21')]('Content-Range',_0x4d27af+'-'+_0x427870+'/'+_0x2de19d)['json'](_0x570cd0);}return null;};}function patchUpdates(_0x395f70){return function(_0x2a2314){try{jsonpatch[_0x4f8e('0x22')](_0x2a2314,_0x395f70,!![]);}catch(_0x466f2d){return BPromise['reject'](_0x466f2d);}return _0x2a2314[_0x4f8e('0x23')]();};}function saveUpdates(_0x376c60,_0xce04c8){return function(_0x535ceb){if(_0x535ceb){return _0x535ceb[_0x4f8e('0x24')](_0x376c60)['then'](function(_0x5205aa){return _0x5205aa;});}return null;};}function removeEntity(_0x5e652b,_0x36a59f){return function(_0x102c7f){if(_0x102c7f){return _0x102c7f[_0x4f8e('0x25')]()['then'](function(){var _0x3c00c2=_0x102c7f['get']({'plain':!![]});var _0x4e7798='Dispositions';return db[_0x4f8e('0x26')][_0x4f8e('0x25')]({'where':{'type':_0x4e7798,'resourceId':_0x3c00c2['id']}})[_0x4f8e('0x27')](function(){return _0x102c7f;});})[_0x4f8e('0x27')](function(){_0x5e652b[_0x4f8e('0x1b')](0xcc)[_0x4f8e('0x1c')]();});}};}function handleEntityNotFound(_0x1b6166,_0x8c30bf){return function(_0x4f72c8){if(!_0x4f72c8){_0x1b6166[_0x4f8e('0x1a')](0x194);}return _0x4f72c8;};}function handleError(_0x1dd7fd,_0x54a84a){_0x54a84a=_0x54a84a||0x1f4;return function(_0x4e39c6){logger[_0x4f8e('0x28')](_0x4e39c6['stack']);if(_0x4e39c6[_0x4f8e('0x29')]){delete _0x4e39c6[_0x4f8e('0x29')];}_0x1dd7fd[_0x4f8e('0x1b')](_0x54a84a)[_0x4f8e('0x2a')](_0x4e39c6);};}exports['index']=function(_0x888551,_0x207ab4){var _0x1677db={},_0x175f4a={},_0x2ab77e={'count':0x0,'rows':[]};var _0x4edffa=_[_0x4f8e('0x2b')](db['Disposition'][_0x4f8e('0x2c')],function(_0x2280ef){return{'name':_0x2280ef['fieldName'],'type':_0x2280ef[_0x4f8e('0x2d')][_0x4f8e('0x2e')]};});_0x175f4a[_0x4f8e('0x2f')]=_[_0x4f8e('0x2b')](_0x4edffa,_0x4f8e('0x29'));_0x175f4a[_0x4f8e('0x30')]=_[_0x4f8e('0x31')](_0x888551['query']);_0x175f4a[_0x4f8e('0x32')]=_['intersection'](_0x175f4a['model'],_0x175f4a[_0x4f8e('0x30')]);_0x1677db['attributes']=_[_0x4f8e('0x33')](_0x175f4a['model'],qs['fields'](_0x888551[_0x4f8e('0x30')][_0x4f8e('0x34')]));_0x1677db[_0x4f8e('0x35')]=_0x1677db[_0x4f8e('0x35')][_0x4f8e('0x36')]?_0x1677db['attributes']:_0x175f4a[_0x4f8e('0x2f')];if(!_0x888551[_0x4f8e('0x30')]['hasOwnProperty']('nolimit')){_0x1677db['limit']=qs[_0x4f8e('0x20')](_0x888551[_0x4f8e('0x30')]['limit']);_0x1677db['offset']=qs[_0x4f8e('0x1f')](_0x888551[_0x4f8e('0x30')][_0x4f8e('0x1f')]);}_0x1677db[_0x4f8e('0x37')]=qs[_0x4f8e('0x38')](_0x888551[_0x4f8e('0x30')][_0x4f8e('0x38')]);_0x1677db[_0x4f8e('0x39')]=qs[_0x4f8e('0x32')](_[_0x4f8e('0x3a')](_0x888551['query'],_0x175f4a[_0x4f8e('0x32')]),_0x4edffa);if(_0x888551[_0x4f8e('0x30')][_0x4f8e('0x3b')]){_0x1677db[_0x4f8e('0x39')]=_[_0x4f8e('0x3c')](_0x1677db[_0x4f8e('0x39')],{'$or':_[_0x4f8e('0x2b')](_0x4edffa,function(_0x231d2d){if(_0x231d2d['type']!==_0x4f8e('0x3d')){var _0x159802={};_0x159802[_0x231d2d['name']]={'$like':'%'+_0x888551[_0x4f8e('0x30')][_0x4f8e('0x3b')]+'%'};return _0x159802;}})});}_0x1677db=_[_0x4f8e('0x3c')]({},_0x1677db,_0x888551[_0x4f8e('0x3e')]);var _0x117b12={'where':_0x1677db[_0x4f8e('0x39')]};return db[_0x4f8e('0x3f')][_0x4f8e('0x1e')](_0x117b12)['then'](function(_0x3e76f6){_0x2ab77e['count']=_0x3e76f6;if(_0x888551[_0x4f8e('0x30')][_0x4f8e('0x40')]){_0x1677db[_0x4f8e('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x4f8e('0x42')](_0x1677db);})[_0x4f8e('0x27')](function(_0x43a1ec){_0x2ab77e[_0x4f8e('0x43')]=_0x43a1ec;return _0x2ab77e;})[_0x4f8e('0x27')](respondWithFilteredResult(_0x207ab4,_0x1677db))['catch'](handleError(_0x207ab4,null));};exports[_0x4f8e('0x44')]=function(_0x5b826e,_0x247c1d){var _0x3d6b0f={'raw':!![],'where':{'id':_0x5b826e[_0x4f8e('0x45')]['id']}},_0x2e4b65={};_0x2e4b65['model']=_['keys'](db['Disposition'][_0x4f8e('0x2c')]);_0x2e4b65['query']=_[_0x4f8e('0x31')](_0x5b826e[_0x4f8e('0x30')]);_0x2e4b65['filters']=_[_0x4f8e('0x33')](_0x2e4b65['model'],_0x2e4b65[_0x4f8e('0x30')]);_0x3d6b0f[_0x4f8e('0x35')]=_[_0x4f8e('0x33')](_0x2e4b65[_0x4f8e('0x2f')],qs['fields'](_0x5b826e['query']['fields']));_0x3d6b0f[_0x4f8e('0x35')]=_0x3d6b0f['attributes'][_0x4f8e('0x36')]?_0x3d6b0f['attributes']:_0x2e4b65[_0x4f8e('0x2f')];if(_0x5b826e[_0x4f8e('0x30')]['includeAll']){_0x3d6b0f[_0x4f8e('0x41')]=[{'all':!![]}];}_0x3d6b0f=_[_0x4f8e('0x3c')]({},_0x3d6b0f,_0x5b826e['options']);return db[_0x4f8e('0x3f')][_0x4f8e('0x46')](_0x3d6b0f)[_0x4f8e('0x27')](handleEntityNotFound(_0x247c1d,null))[_0x4f8e('0x27')](respondWithResult(_0x247c1d,null))[_0x4f8e('0x47')](handleError(_0x247c1d,null));};exports[_0x4f8e('0x48')]=function(_0x20a513,_0x1258e7){return db[_0x4f8e('0x3f')][_0x4f8e('0x48')](_0x20a513['body'],{})[_0x4f8e('0x27')](function(_0x566e0c){var _0x3b5b8c=_0x20a513[_0x4f8e('0x49')][_0x4f8e('0x4a')]({'plain':!![]});if(!_0x3b5b8c)throw new Error(_0x4f8e('0x4b'));if(_0x3b5b8c[_0x4f8e('0x4c')]===_0x4f8e('0x49')){var _0x16804f=_0x566e0c[_0x4f8e('0x4a')]({'plain':!![]});var _0x9e0625=_0x4f8e('0x4d');return db['UserProfileSection'][_0x4f8e('0x46')]({'where':{'name':_0x9e0625,'userProfileId':_0x3b5b8c['userProfileId']},'raw':!![]})[_0x4f8e('0x27')](function(_0x1d0cc0){if(_0x1d0cc0&&_0x1d0cc0[_0x4f8e('0x4e')]===0x0){return db[_0x4f8e('0x26')][_0x4f8e('0x48')]({'name':_0x16804f[_0x4f8e('0x29')],'resourceId':_0x16804f['id'],'type':_0x1d0cc0[_0x4f8e('0x29')],'sectionId':_0x1d0cc0['id']},{})[_0x4f8e('0x27')](function(){return _0x566e0c;});}else{return _0x566e0c;}})[_0x4f8e('0x47')](function(_0x28c9a1){logger[_0x4f8e('0x28')](_0x4f8e('0x4f'),_0x28c9a1);throw _0x28c9a1;});}return _0x566e0c;})[_0x4f8e('0x27')](respondWithResult(_0x1258e7,0xc9))[_0x4f8e('0x47')](handleError(_0x1258e7,null));};exports[_0x4f8e('0x24')]=function(_0x490412,_0x183bb0){if(_0x490412[_0x4f8e('0x50')]['id']){delete _0x490412[_0x4f8e('0x50')]['id'];}return db['Disposition'][_0x4f8e('0x46')]({'where':{'id':_0x490412[_0x4f8e('0x45')]['id']}})[_0x4f8e('0x27')](handleEntityNotFound(_0x183bb0,null))['then'](saveUpdates(_0x490412[_0x4f8e('0x50')],null))[_0x4f8e('0x27')](respondWithResult(_0x183bb0,null))['catch'](handleError(_0x183bb0,null));};exports['destroy']=function(_0x5bf085,_0x27bcca){return db['Disposition'][_0x4f8e('0x46')]({'where':{'id':_0x5bf085[_0x4f8e('0x45')]['id']}})['then'](handleEntityNotFound(_0x27bcca,null))[_0x4f8e('0x27')](removeEntity(_0x27bcca,null))[_0x4f8e('0x47')](handleError(_0x27bcca,null));}; \ No newline at end of file +var _0xe47e=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','get','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x4c9c46,_0x3c4f5b){var _0x3e7607=function(_0x8ef8a0){while(--_0x8ef8a0){_0x4c9c46['push'](_0x4c9c46['shift']());}};_0x3e7607(++_0x3c4f5b);}(_0xe47e,0x1b6));var _0xee47=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xe47e[_0x386b03];return _0xd3d524;};'use strict';var pdf=require(_0xee47('0x0'));var emlformat=require(_0xee47('0x1'));var rimraf=require(_0xee47('0x2'));var zipdir=require(_0xee47('0x3'));var jsonpatch=require(_0xee47('0x4'));var rp=require(_0xee47('0x5'));var moment=require('moment');var BPromise=require(_0xee47('0x6'));var Mustache=require('mustache');var util=require(_0xee47('0x7'));var path=require(_0xee47('0x8'));var sox=require(_0xee47('0x9'));var csv=require(_0xee47('0xa'));var ejs=require(_0xee47('0xb'));var fs=require('fs');var _=require(_0xee47('0xc'));var squel=require('squel');var crypto=require(_0xee47('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xee47('0xa'));var querystring=require('querystring');var Papa=require(_0xee47('0xe'));var Redis=require(_0xee47('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xee47('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee47('0x11'));var logger=require(_0xee47('0x12'))(_0xee47('0x13'));var utils=require('../../config/utils');var config=require(_0xee47('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30645e,_0x25937f){_0x25937f=_0x25937f||0xcc;return function(_0x27f233){if(_0x27f233){return _0x30645e['sendStatus'](_0x25937f);}return _0x30645e[_0xee47('0x15')](_0x25937f)[_0xee47('0x16')]();};}function respondWithResult(_0x3277b5,_0x4c598f){_0x4c598f=_0x4c598f||0xc8;return function(_0x199f87){if(_0x199f87){return _0x3277b5[_0xee47('0x15')](_0x4c598f)['json'](_0x199f87);}};}function respondWithFilteredResult(_0x5f3a2f,_0x2e6a78){return function(_0x587c65){if(_0x587c65){var _0x571c6e=_0x587c65['count'],_0x46dc2e=_0x2e6a78['offset'],_0x115634=_0x2e6a78[_0xee47('0x17')]+_0x2e6a78[_0xee47('0x18')],_0x4b3501;if(_0x115634>=_0x571c6e){_0x115634=_0x571c6e;_0x4b3501=0xc8;}else{_0x4b3501=0xce;}_0x5f3a2f[_0xee47('0x15')](_0x4b3501);return _0x5f3a2f[_0xee47('0x19')](_0xee47('0x1a'),_0x46dc2e+'-'+_0x115634+'/'+_0x571c6e)[_0xee47('0x1b')](_0x587c65);}return null;};}function patchUpdates(_0x201dd1){return function(_0x1c1448){try{jsonpatch[_0xee47('0x1c')](_0x1c1448,_0x201dd1,!![]);}catch(_0x75a33a){return BPromise[_0xee47('0x1d')](_0x75a33a);}return _0x1c1448[_0xee47('0x1e')]();};}function saveUpdates(_0x542aab,_0x280f2b){return function(_0x380b7c){if(_0x380b7c){return _0x380b7c['update'](_0x542aab)['then'](function(_0x6002c){return _0x6002c;});}return null;};}function removeEntity(_0x4771ab,_0x3766f8){return function(_0x412afd){if(_0x412afd){return _0x412afd['destroy']()[_0xee47('0x1f')](function(){var _0x3d8a5a=_0x412afd[_0xee47('0x20')]({'plain':!![]});var _0x45e5b3='Dispositions';return db[_0xee47('0x21')]['destroy']({'where':{'type':_0x45e5b3,'resourceId':_0x3d8a5a['id']}})['then'](function(){return _0x412afd;});})['then'](function(){_0x4771ab[_0xee47('0x15')](0xcc)[_0xee47('0x16')]();});}};}function handleEntityNotFound(_0x110199,_0x9604df){return function(_0x474cae){if(!_0x474cae){_0x110199['sendStatus'](0x194);}return _0x474cae;};}function handleError(_0x102f92,_0x49137e){_0x49137e=_0x49137e||0x1f4;return function(_0x4fe9f3){logger[_0xee47('0x22')](_0x4fe9f3[_0xee47('0x23')]);if(_0x4fe9f3[_0xee47('0x24')]){delete _0x4fe9f3[_0xee47('0x24')];}_0x102f92['status'](_0x49137e)[_0xee47('0x25')](_0x4fe9f3);};}exports[_0xee47('0x26')]=function(_0x58bd18,_0x10e886){var _0x46f225={},_0x2e4806={},_0x5cde67={'count':0x0,'rows':[]};var _0x1d67e2=_[_0xee47('0x27')](db[_0xee47('0x28')][_0xee47('0x29')],function(_0x32b01c){return{'name':_0x32b01c[_0xee47('0x2a')],'type':_0x32b01c[_0xee47('0x2b')][_0xee47('0x2c')]};});_0x2e4806[_0xee47('0x2d')]=_[_0xee47('0x27')](_0x1d67e2,'name');_0x2e4806['query']=_[_0xee47('0x2e')](_0x58bd18[_0xee47('0x2f')]);_0x2e4806[_0xee47('0x30')]=_[_0xee47('0x31')](_0x2e4806['model'],_0x2e4806[_0xee47('0x2f')]);_0x46f225['attributes']=_[_0xee47('0x31')](_0x2e4806[_0xee47('0x2d')],qs[_0xee47('0x32')](_0x58bd18[_0xee47('0x2f')]['fields']));_0x46f225['attributes']=_0x46f225[_0xee47('0x33')][_0xee47('0x34')]?_0x46f225[_0xee47('0x33')]:_0x2e4806[_0xee47('0x2d')];if(!_0x58bd18[_0xee47('0x2f')][_0xee47('0x35')](_0xee47('0x36'))){_0x46f225['limit']=qs[_0xee47('0x18')](_0x58bd18[_0xee47('0x2f')][_0xee47('0x18')]);_0x46f225[_0xee47('0x17')]=qs[_0xee47('0x17')](_0x58bd18[_0xee47('0x2f')][_0xee47('0x17')]);}_0x46f225[_0xee47('0x37')]=qs['sort'](_0x58bd18['query'][_0xee47('0x38')]);_0x46f225[_0xee47('0x39')]=qs[_0xee47('0x30')](_[_0xee47('0x3a')](_0x58bd18[_0xee47('0x2f')],_0x2e4806[_0xee47('0x30')]),_0x1d67e2);if(_0x58bd18['query'][_0xee47('0x3b')]){_0x46f225[_0xee47('0x39')]=_[_0xee47('0x3c')](_0x46f225[_0xee47('0x39')],{'$or':_[_0xee47('0x27')](_0x1d67e2,function(_0x1e7ad5){if(_0x1e7ad5['type']!==_0xee47('0x3d')){var _0x32af49={};_0x32af49[_0x1e7ad5['name']]={'$like':'%'+_0x58bd18[_0xee47('0x2f')][_0xee47('0x3b')]+'%'};return _0x32af49;}})});}_0x46f225=_['merge']({},_0x46f225,_0x58bd18[_0xee47('0x3e')]);var _0x5e9362={'where':_0x46f225[_0xee47('0x39')]};return db[_0xee47('0x28')]['count'](_0x5e9362)[_0xee47('0x1f')](function(_0x43313c){_0x5cde67[_0xee47('0x3f')]=_0x43313c;if(_0x58bd18[_0xee47('0x2f')][_0xee47('0x40')]){_0x46f225[_0xee47('0x41')]=[{'all':!![]}];}return db[_0xee47('0x28')][_0xee47('0x42')](_0x46f225);})[_0xee47('0x1f')](function(_0x196d79){_0x5cde67[_0xee47('0x43')]=_0x196d79;return _0x5cde67;})[_0xee47('0x1f')](respondWithFilteredResult(_0x10e886,_0x46f225))[_0xee47('0x44')](handleError(_0x10e886,null));};exports[_0xee47('0x45')]=function(_0x3808bb,_0x417bb4){var _0x5c3946={'raw':!![],'where':{'id':_0x3808bb[_0xee47('0x46')]['id']}},_0x5876fb={};_0x5876fb[_0xee47('0x2d')]=_[_0xee47('0x2e')](db[_0xee47('0x28')][_0xee47('0x29')]);_0x5876fb[_0xee47('0x2f')]=_[_0xee47('0x2e')](_0x3808bb['query']);_0x5876fb[_0xee47('0x30')]=_[_0xee47('0x31')](_0x5876fb[_0xee47('0x2d')],_0x5876fb[_0xee47('0x2f')]);_0x5c3946[_0xee47('0x33')]=_[_0xee47('0x31')](_0x5876fb[_0xee47('0x2d')],qs[_0xee47('0x32')](_0x3808bb[_0xee47('0x2f')][_0xee47('0x32')]));_0x5c3946[_0xee47('0x33')]=_0x5c3946['attributes'][_0xee47('0x34')]?_0x5c3946[_0xee47('0x33')]:_0x5876fb['model'];if(_0x3808bb[_0xee47('0x2f')][_0xee47('0x40')]){_0x5c3946['include']=[{'all':!![]}];}_0x5c3946=_[_0xee47('0x3c')]({},_0x5c3946,_0x3808bb[_0xee47('0x3e')]);return db[_0xee47('0x28')][_0xee47('0x47')](_0x5c3946)['then'](handleEntityNotFound(_0x417bb4,null))[_0xee47('0x1f')](respondWithResult(_0x417bb4,null))[_0xee47('0x44')](handleError(_0x417bb4,null));};exports[_0xee47('0x48')]=function(_0x2473b9,_0x28992b){return db[_0xee47('0x28')][_0xee47('0x48')](_0x2473b9[_0xee47('0x49')],{})[_0xee47('0x1f')](function(_0xa3c55f){var _0xc8008d=_0x2473b9[_0xee47('0x4a')]['get']({'plain':!![]});if(!_0xc8008d)throw new Error(_0xee47('0x4b'));if(_0xc8008d['role']===_0xee47('0x4a')){var _0x50a9f7=_0xa3c55f[_0xee47('0x20')]({'plain':!![]});var _0x390018=_0xee47('0x4c');return db[_0xee47('0x4d')]['find']({'where':{'name':_0x390018,'userProfileId':_0xc8008d[_0xee47('0x4e')]},'raw':!![]})[_0xee47('0x1f')](function(_0x455a15){if(_0x455a15&&_0x455a15[_0xee47('0x4f')]===0x0){return db[_0xee47('0x21')][_0xee47('0x48')]({'name':_0x50a9f7['name'],'resourceId':_0x50a9f7['id'],'type':_0x455a15['name'],'sectionId':_0x455a15['id']},{})[_0xee47('0x1f')](function(){return _0xa3c55f;});}else{return _0xa3c55f;}})[_0xee47('0x44')](function(_0x5d4575){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d4575);throw _0x5d4575;});}return _0xa3c55f;})[_0xee47('0x1f')](respondWithResult(_0x28992b,0xc9))['catch'](handleError(_0x28992b,null));};exports[_0xee47('0x50')]=function(_0x394e64,_0x4e29e0){if(_0x394e64[_0xee47('0x49')]['id']){delete _0x394e64[_0xee47('0x49')]['id'];}return db[_0xee47('0x28')]['find']({'where':{'id':_0x394e64[_0xee47('0x46')]['id']}})[_0xee47('0x1f')](handleEntityNotFound(_0x4e29e0,null))[_0xee47('0x1f')](saveUpdates(_0x394e64[_0xee47('0x49')],null))[_0xee47('0x1f')](respondWithResult(_0x4e29e0,null))[_0xee47('0x44')](handleError(_0x4e29e0,null));};exports['destroy']=function(_0x1bc11d,_0x518c89){return db[_0xee47('0x28')][_0xee47('0x47')]({'where':{'id':_0x1bc11d['params']['id']}})['then'](handleEntityNotFound(_0x518c89,null))[_0xee47('0x1f')](removeEntity(_0x518c89,null))[_0xee47('0x44')](handleError(_0x518c89,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 8f62725..ba274a7 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 _0xaabc=['name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaabc,0x19a));var _0xcaab=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0xaabc[_0x5c9f56];return _0x2a726b;};'use strict';var _=require(_0xcaab('0x0'));var util=require(_0xcaab('0x1'));var logger=require(_0xcaab('0x2'))(_0xcaab('0x3'));var moment=require(_0xcaab('0x4'));var BPromise=require(_0xcaab('0x5'));var rp=require(_0xcaab('0x6'));var fs=require('fs');var path=require(_0xcaab('0x7'));var rimraf=require(_0xcaab('0x8'));var config=require(_0xcaab('0x9'));var attributes=require(_0xcaab('0xa'));module[_0xcaab('0xb')]=function(_0x38a5aa,_0x201c50){return _0x38a5aa[_0xcaab('0xc')]('Disposition',attributes,{'tableName':_0xcaab('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcaab('0xe'),'fields':[_0xcaab('0xf'),'ListId']},{'unique':!![],'name':_0xcaab('0x10'),'fields':[_0xcaab('0xf'),_0xcaab('0x11')]},{'unique':!![],'name':_0xcaab('0x12'),'fields':[_0xcaab('0xf'),_0xcaab('0x13')]},{'unique':!![],'name':_0xcaab('0x14'),'fields':['name',_0xcaab('0x15')]},{'unique':!![],'name':_0xcaab('0x16'),'fields':[_0xcaab('0xf'),_0xcaab('0x17')]},{'unique':!![],'name':_0xcaab('0x18'),'fields':[_0xcaab('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xcaab('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ac0=['WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x134813,_0x397328){var _0x3abb44=function(_0x3dc7f7){while(--_0x3dc7f7){_0x134813['push'](_0x134813['shift']());}};_0x3abb44(++_0x397328);}(_0x6ac0,0x1cd));var _0x06ac=function(_0x3fee5a,_0x11649c){_0x3fee5a=_0x3fee5a-0x0;var _0x4a4d10=_0x6ac0[_0x3fee5a];return _0x4a4d10;};'use strict';var _=require(_0x06ac('0x0'));var util=require(_0x06ac('0x1'));var logger=require(_0x06ac('0x2'))(_0x06ac('0x3'));var moment=require(_0x06ac('0x4'));var BPromise=require(_0x06ac('0x5'));var rp=require(_0x06ac('0x6'));var fs=require('fs');var path=require(_0x06ac('0x7'));var rimraf=require('rimraf');var config=require(_0x06ac('0x8'));var attributes=require('./disposition.attributes');module['exports']=function(_0x423adc,_0x328204){return _0x423adc[_0x06ac('0x9')](_0x06ac('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x06ac('0xb'),'fields':[_0x06ac('0xc'),_0x06ac('0xd')]},{'unique':!![],'name':_0x06ac('0xe'),'fields':[_0x06ac('0xc'),_0x06ac('0xf')]},{'unique':!![],'name':_0x06ac('0x10'),'fields':[_0x06ac('0xc'),_0x06ac('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x06ac('0xc'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x06ac('0xc'),_0x06ac('0x12')]},{'unique':!![],'name':_0x06ac('0x13'),'fields':[_0x06ac('0xc'),_0x06ac('0x14')]},{'unique':!![],'name':_0x06ac('0x15'),'fields':[_0x06ac('0xc'),_0x06ac('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c59f9fc..1604be7 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 _0x704a=['error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46389a,_0x825f69){var _0x5d4cd0=function(_0x378bf3){while(--_0x378bf3){_0x46389a['push'](_0x46389a['shift']());}};_0x5d4cd0(++_0x825f69);}(_0x704a,0xe1));var _0xa704=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x704a[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require(_0xa704('0x0'));var moment=require('moment');var BPromise=require(_0xa704('0x1'));var rs=require(_0xa704('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa704('0x3'))['db'];var utils=require(_0xa704('0x4'));var logger=require('../../config/logger')(_0xa704('0x5'));var config=require('../../config/environment');var jayson=require(_0xa704('0x6'));var client=jayson[_0xa704('0x7')][_0xa704('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7c1c,_0xc2e4cd,_0x20908e){return new BPromise(function(_0x5cddb0,_0xfb82ff){return client['request'](_0x3e7c1c,_0x20908e)[_0xa704('0x9')](function(_0x54ef7e){logger['info'](_0xa704('0xa'),_0xc2e4cd,_0xa704('0xb'));logger[_0xa704('0xc')](_0xa704('0xd'),_0xc2e4cd,_0xa704('0xb'),JSON[_0xa704('0xe')](_0x54ef7e));if(_0x54ef7e[_0xa704('0xf')]){if(_0x54ef7e[_0xa704('0xf')][_0xa704('0x10')]===0x1f4){logger[_0xa704('0xf')](_0xa704('0xa'),_0xc2e4cd,_0x54ef7e[_0xa704('0xf')]['message']);return _0xfb82ff(_0x54ef7e['error'][_0xa704('0x11')]);}logger['error']('Disposition,\x20%s,\x20%s',_0xc2e4cd,_0x54ef7e[_0xa704('0xf')][_0xa704('0x11')]);return _0x5cddb0(_0x54ef7e['error'][_0xa704('0x11')]);}else{logger[_0xa704('0x12')](_0xa704('0xa'),_0xc2e4cd,_0xa704('0xb'));_0x5cddb0(_0x54ef7e['result']['message']);}})[_0xa704('0x13')](function(_0x12e974){logger[_0xa704('0xf')]('Disposition,\x20%s,\x20%s',_0xc2e4cd,_0x12e974);_0xfb82ff(_0x12e974);});});} \ No newline at end of file +var _0xf646=['info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xf646,0xf9));var _0x6f64=function(_0x57d184,_0xbb269b){_0x57d184=_0x57d184-0x0;var _0x5570a7=_0xf646[_0x57d184];return _0x5570a7;};'use strict';var _=require(_0x6f64('0x0'));var util=require(_0x6f64('0x1'));var moment=require('moment');var BPromise=require(_0x6f64('0x2'));var rs=require(_0x6f64('0x3'));var fs=require('fs');var Redis=require(_0x6f64('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f64('0x5'));var logger=require(_0x6f64('0x6'))(_0x6f64('0x7'));var config=require(_0x6f64('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43ad84,_0x1e5c97,_0x140707){return new BPromise(function(_0x5b494c,_0x3382a9){return client[_0x6f64('0xa')](_0x43ad84,_0x140707)['then'](function(_0x19579e){logger[_0x6f64('0xb')](_0x6f64('0xc'),_0x1e5c97,_0x6f64('0xd'));logger[_0x6f64('0xe')](_0x6f64('0xf'),_0x1e5c97,_0x6f64('0xd'),JSON['stringify'](_0x19579e));if(_0x19579e['error']){if(_0x19579e[_0x6f64('0x10')][_0x6f64('0x11')]===0x1f4){logger['error'](_0x6f64('0xc'),_0x1e5c97,_0x19579e[_0x6f64('0x10')][_0x6f64('0x12')]);return _0x3382a9(_0x19579e['error'][_0x6f64('0x12')]);}logger[_0x6f64('0x10')](_0x6f64('0xc'),_0x1e5c97,_0x19579e[_0x6f64('0x10')]['message']);return _0x5b494c(_0x19579e[_0x6f64('0x10')]['message']);}else{logger[_0x6f64('0xb')]('Disposition,\x20%s,\x20%s',_0x1e5c97,_0x6f64('0xd'));_0x5b494c(_0x19579e[_0x6f64('0x13')][_0x6f64('0x12')]);}})['catch'](function(_0x54577b){logger[_0x6f64('0x10')](_0x6f64('0xc'),_0x1e5c97,_0x54577b);_0x3382a9(_0x54577b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 85e6835..84b897d 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 _0x8212=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer'];(function(_0x54db8c,_0x6d1ff1){var _0x10ea0c=function(_0x5808c0){while(--_0x5808c0){_0x54db8c['push'](_0x54db8c['shift']());}};_0x10ea0c(++_0x6d1ff1);}(_0x8212,0xb3));var _0x2821=function(_0x22cea4,_0x54f16a){_0x22cea4=_0x22cea4-0x0;var _0x59d75b=_0x8212[_0x22cea4];return _0x59d75b;};'use strict';var multer=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var path=require('path');var timeout=require(_0x2821('0x2'));var express=require(_0x2821('0x3'));var router=express[_0x2821('0x4')]();var auth=require(_0x2821('0x5'));var interaction=require(_0x2821('0x6'));var config=require(_0x2821('0x7'));var controller=require(_0x2821('0x8'));router[_0x2821('0x9')]('/',auth['isAuthenticated'](),controller[_0x2821('0xa')]);router['get'](_0x2821('0xb'),auth[_0x2821('0xc')](),controller['show']);router[_0x2821('0xd')]('/',auth[_0x2821('0xc')](),controller[_0x2821('0xe')]);router[_0x2821('0xf')](_0x2821('0xb'),auth[_0x2821('0xc')](),controller[_0x2821('0x10')]);router[_0x2821('0x11')](_0x2821('0xb'),auth['isAuthenticated'](),controller[_0x2821('0x12')]);module[_0x2821('0x13')]=router; \ No newline at end of file +var _0x6d5e=['put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x28cbc0,_0x203516){var _0x4b3cf5=function(_0x2a15c6){while(--_0x2a15c6){_0x28cbc0['push'](_0x28cbc0['shift']());}};_0x4b3cf5(++_0x203516);}(_0x6d5e,0x103));var _0xe6d5=function(_0x580f58,_0x37cee4){_0x580f58=_0x580f58-0x0;var _0xd96fb3=_0x6d5e[_0x580f58];return _0xd96fb3;};'use strict';var multer=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var path=require(_0xe6d5('0x2'));var timeout=require(_0xe6d5('0x3'));var express=require('express');var router=express[_0xe6d5('0x4')]();var auth=require(_0xe6d5('0x5'));var interaction=require(_0xe6d5('0x6'));var config=require(_0xe6d5('0x7'));var controller=require(_0xe6d5('0x8'));router[_0xe6d5('0x9')]('/',auth[_0xe6d5('0xa')](),controller['index']);router[_0xe6d5('0x9')]('/:id',auth[_0xe6d5('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe6d5('0xb')](_0xe6d5('0xc'),auth[_0xe6d5('0xa')](),controller[_0xe6d5('0xd')]);router['delete'](_0xe6d5('0xc'),auth[_0xe6d5('0xa')](),controller[_0xe6d5('0xe')]);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 765f20f..bf5e8c2 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 _0x7944=['STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','9600','12000','4800','7200','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x4678fd,_0x431892){var _0xfef9c0=function(_0x43afe){while(--_0x43afe){_0x4678fd['push'](_0x4678fd['shift']());}};_0xfef9c0(++_0x431892);}(_0x7944,0x9a));var _0x4794=function(_0x50663b,_0x33bbf6){_0x50663b=_0x50663b-0x0;var _0x59b77b=_0x7944[_0x50663b];return _0x59b77b;};'use strict';var Sequelize=require(_0x4794('0x0'));module[_0x4794('0x1')]={'name':{'type':Sequelize[_0x4794('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4794('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x4794('0x3'),'no'),'defaultValue':_0x4794('0x3')},'headerinfo':{'type':Sequelize[_0x4794('0x2')],'defaultValue':_0x4794('0x4')},'localstationid':{'type':Sequelize[_0x4794('0x2')],'unique':_0x4794('0x5')},'minrate':{'type':Sequelize[_0x4794('0x6')](_0x4794('0x7'),'4800','7200',_0x4794('0x8'),_0x4794('0x9'),'14400'),'defaultValue':_0x4794('0xa')},'maxrate':{'type':Sequelize[_0x4794('0x6')](_0x4794('0x7'),'4800',_0x4794('0xb'),_0x4794('0x8'),_0x4794('0x9'),_0x4794('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4794('0x2')],'defaultValue':_0x4794('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4794('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4794('0x6')](_0x4794('0xe'),_0x4794('0xf'),_0x4794('0x10'),'KHOMP'),'defaultValue':_0x4794('0xe')},'key':{'type':Sequelize[_0x4794('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4794('0x11')],'defaultValue':function(){return _0x4794('0x12');}},'notificationSound':{'type':Sequelize[_0x4794('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4794('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4794('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4794('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4794('0x14')],'allowNull':!![],'defaultValue':null,'comment':_0x4794('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![],'comment':_0x4794('0x16'),'set':function(_0x57f31d){if(!_0x57f31d)this[_0x4794('0x17')](_0x4794('0x18'),null);this[_0x4794('0x17')](_0x4794('0x19'),_0x57f31d);}}}; \ No newline at end of file +var _0xb4b5=['v17,v27,v29','INTEGER','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','ENUM','2400','4800','7200','9600','12000','14400'];(function(_0x5a2013,_0x1fd232){var _0x543b9f=function(_0x57caf6){while(--_0x57caf6){_0x5a2013['push'](_0x5a2013['shift']());}};_0x543b9f(++_0x1fd232);}(_0xb4b5,0x1ed));var _0x5b4b=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xb4b5[_0x2e5f9c];return _0x538b44;};'use strict';var Sequelize=require(_0x5b4b('0x0'));module[_0x5b4b('0x1')]={'name':{'type':Sequelize[_0x5b4b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5b4b('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x5b4b('0x3'),'no'),'defaultValue':_0x5b4b('0x3')},'headerinfo':{'type':Sequelize[_0x5b4b('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x5b4b('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5b4b('0x4')](_0x5b4b('0x5'),_0x5b4b('0x6'),_0x5b4b('0x7'),_0x5b4b('0x8'),_0x5b4b('0x9'),'14400'),'defaultValue':_0x5b4b('0x6')},'maxrate':{'type':Sequelize[_0x5b4b('0x4')](_0x5b4b('0x5'),'4800','7200',_0x5b4b('0x8'),'12000','14400'),'defaultValue':_0x5b4b('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5b4b('0xb')},'gateway':{'type':Sequelize[_0x5b4b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5b4b('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5b4b('0x4')](_0x5b4b('0xd'),'IAX','DADHI','KHOMP'),'defaultValue':_0x5b4b('0xd')},'key':{'type':Sequelize[_0x5b4b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5b4b('0xe');}},'notificationSound':{'type':Sequelize[_0x5b4b('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5b4b('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5b4b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5b4b('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b4b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b4b('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b4b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b4b('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x5b4b('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x5b4b('0xf')],'defaultValue':![],'comment':_0x5b4b('0x11'),'set':function(_0x523b8b){if(!_0x523b8b)this[_0x5b4b('0x12')](_0x5b4b('0x13'),null);this[_0x5b4b('0x12')](_0x5b4b('0x14'),_0x523b8b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c06398e..252bbd1 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 _0x8903=['attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','nolimit','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','ecm','gateway','faxdetect','headerinfo','modem','FAXOPT(','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','basename','isNil','from','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','mandatoryDispositionPause','FaxAccount','rawAttributes','key','model','map','query','keys','filters','intersection','fields'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x8903,0x74));var _0x3890=function(_0x558222,_0x105cdb){_0x558222=_0x558222-0x0;var _0x4e1044=_0x8903[_0x558222];return _0x4e1044;};'use strict';var pdf=require(_0x3890('0x0'));var emlformat=require(_0x3890('0x1'));var rimraf=require(_0x3890('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3890('0x3'));var moment=require(_0x3890('0x4'));var BPromise=require(_0x3890('0x5'));var Mustache=require(_0x3890('0x6'));var util=require('util');var path=require(_0x3890('0x7'));var sox=require(_0x3890('0x8'));var csv=require('to-csv');var ejs=require(_0x3890('0x9'));var fs=require('fs');var _=require(_0x3890('0xa'));var squel=require('squel');var crypto=require(_0x3890('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3890('0xc'));var toCsv=require(_0x3890('0xd'));var querystring=require('querystring');var Papa=require(_0x3890('0xe'));var Redis=require(_0x3890('0xf'));var authService=require(_0x3890('0x10'));var qs=require(_0x3890('0x11'));var as=require(_0x3890('0x12'));var hardwareService=require(_0x3890('0x13'));var logger=require(_0x3890('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3890('0x15'));var db=require(_0x3890('0x16'))['db'];config['redis']=_[_0x3890('0x17')](config[_0x3890('0x18')],{'host':_0x3890('0x19'),'port':0x18eb});var socket=require(_0x3890('0x1a'))(new Redis(config[_0x3890('0x18')]));require(_0x3890('0x1b'))['register'](socket);var jayson=require(_0x3890('0x1c'));var client=jayson[_0x3890('0x1d')][_0x3890('0x1e')]({'port':0x232c});var client9002=jayson[_0x3890('0x1d')][_0x3890('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x17710c,_0x531368,_0x141bcd){if(_0x141bcd){var _0x2cd159=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cd159[_0x3890('0x1f')](_0x531368)){return _0x17710c;}else{throw new db[(_0x3890('0x20'))][(_0x3890('0x21'))](_0x3890('0x22'));}}else{return _0x17710c;}}function respondWithRpcPromise(_0x1563a5,_0x32100d,_0x3a0ae1,_0x1c00c6){return new BPromise(function(_0x2468f9,_0x3014ef){var _0x3450b0=_0x1c00c6||client;return _0x3450b0[_0x3890('0x23')](_0x1563a5,_0x3a0ae1)[_0x3890('0x24')](function(_0x3c2114){logger[_0x3890('0x25')](_0x3890('0x26'),_0x32100d,'request\x20sent');logger['debug'](_0x3890('0x27'),_0x32100d,'request\x20sent',JSON[_0x3890('0x28')](_0x3c2114));if(_0x3c2114['error']){if(_0x3c2114[_0x3890('0x29')][_0x3890('0x2a')]===0x1f4){logger[_0x3890('0x29')](_0x3890('0x26'),_0x32100d,_0x3c2114['error'][_0x3890('0x2b')]);return _0x3014ef(_0x3c2114[_0x3890('0x29')][_0x3890('0x2b')]);}logger[_0x3890('0x29')](_0x3890('0x26'),_0x32100d,_0x3c2114[_0x3890('0x29')][_0x3890('0x2b')]);return _0x2468f9(_0x3c2114[_0x3890('0x29')][_0x3890('0x2b')]);}else{logger[_0x3890('0x25')](_0x3890('0x26'),_0x32100d,_0x3890('0x2c'));_0x2468f9(_0x3c2114[_0x3890('0x2d')]['message']);}})[_0x3890('0x2e')](function(_0xe43f29){logger[_0x3890('0x29')](_0x3890('0x26'),_0x32100d,_0xe43f29);_0x3014ef(_0xe43f29);});});}function respondWithStatusCode(_0x14957a,_0x45d093){_0x45d093=_0x45d093||0xcc;return function(_0x4a7a1a){if(_0x4a7a1a){return _0x14957a['sendStatus'](_0x45d093);}return _0x14957a[_0x3890('0x2f')](_0x45d093)[_0x3890('0x30')]();};}function respondWithResult(_0x49ecd5,_0x4995a4){_0x4995a4=_0x4995a4||0xc8;return function(_0xfaeb0c){if(_0xfaeb0c){return _0x49ecd5['status'](_0x4995a4)[_0x3890('0x31')](_0xfaeb0c);}};}function respondWithFilteredResult(_0x31fe39,_0x3209a2){return function(_0x521bdf){if(_0x521bdf){var _0x4b5097=_0x521bdf[_0x3890('0x32')],_0x64eeac=_0x3209a2[_0x3890('0x33')],_0x500bc5=_0x3209a2['offset']+_0x3209a2[_0x3890('0x34')],_0x5834a8;if(_0x500bc5>=_0x4b5097){_0x500bc5=_0x4b5097;_0x5834a8=0xc8;}else{_0x5834a8=0xce;}_0x31fe39[_0x3890('0x2f')](_0x5834a8);return _0x31fe39[_0x3890('0x35')](_0x3890('0x36'),_0x64eeac+'-'+_0x500bc5+'/'+_0x4b5097)[_0x3890('0x31')](_0x521bdf);}return null;};}function patchUpdates(_0x2f4237){return function(_0x411c66){try{jsonpatch['apply'](_0x411c66,_0x2f4237,!![]);}catch(_0x2e0d7e){return BPromise[_0x3890('0x37')](_0x2e0d7e);}return _0x411c66[_0x3890('0x38')]();};}function saveUpdates(_0x3bdd35,_0x30d9ba){return function(_0xfb042c){if(_0xfb042c){return _0xfb042c['update'](_0x3bdd35)[_0x3890('0x24')](function(_0x7fb926){return _0x7fb926;});}return null;};}function removeEntity(_0x26a7a3,_0x4d4344){return function(_0x445681){if(_0x445681){return _0x445681[_0x3890('0x39')]()[_0x3890('0x24')](function(){var _0x2c95e3=_0x445681[_0x3890('0x3a')]({'plain':!![]});var _0x28b7de=_0x3890('0x3b');return db[_0x3890('0x3c')]['destroy']({'where':{'type':_0x28b7de,'resourceId':_0x2c95e3['id']}})[_0x3890('0x24')](function(){return _0x445681;});})['then'](function(){_0x26a7a3['status'](0xcc)[_0x3890('0x30')]();});}};}function handleEntityNotFound(_0x4dcd6d,_0x218b0b){return function(_0xd00bd1){if(!_0xd00bd1){_0x4dcd6d[_0x3890('0x3d')](0x194);}return _0xd00bd1;};}function handleError(_0x55759c,_0x2fed57){_0x2fed57=_0x2fed57||0x1f4;return function(_0x167794){logger[_0x3890('0x29')](_0x167794[_0x3890('0x3e')]);if(_0x167794['name']){delete _0x167794[_0x3890('0x3f')];}_0x55759c[_0x3890('0x2f')](_0x2fed57)[_0x3890('0x40')](_0x167794);};}exports['index']=function(_0x392d64,_0x534d74){var _0xac391c={'include':[{'model':db['Pause'],'as':_0x3890('0x41')}]},_0x945c5b={},_0x3f5077={'count':0x0,'rows':[]};var _0x280e39=_['map'](db[_0x3890('0x42')][_0x3890('0x43')],function(_0x3875c3){return{'name':_0x3875c3['fieldName'],'type':_0x3875c3['type'][_0x3890('0x44')]};});_0x945c5b[_0x3890('0x45')]=_[_0x3890('0x46')](_0x280e39,_0x3890('0x3f'));_0x945c5b[_0x3890('0x47')]=_[_0x3890('0x48')](_0x392d64[_0x3890('0x47')]);_0x945c5b[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x945c5b[_0x3890('0x45')],_0x945c5b[_0x3890('0x47')]);_0xac391c['attributes']=_['intersection'](_0x945c5b[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x392d64[_0x3890('0x47')][_0x3890('0x4b')]));_0xac391c[_0x3890('0x4c')]=_0xac391c[_0x3890('0x4c')][_0x3890('0x4d')]?_0xac391c['attributes']:_0x945c5b[_0x3890('0x45')];if(!_0x392d64[_0x3890('0x47')][_0x3890('0x4e')]('nolimit')){_0xac391c[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x392d64[_0x3890('0x47')][_0x3890('0x34')]);_0xac391c[_0x3890('0x33')]=qs[_0x3890('0x33')](_0x392d64['query']['offset']);}_0xac391c[_0x3890('0x4f')]=qs['sort'](_0x392d64[_0x3890('0x47')][_0x3890('0x50')]);_0xac391c[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x392d64['query'],_0x945c5b[_0x3890('0x49')]),_0x280e39);if(_0x392d64[_0x3890('0x47')][_0x3890('0x53')]){_0xac391c[_0x3890('0x51')]=_[_0x3890('0x54')](_0xac391c[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x280e39,function(_0x1c2249){if(_0x1c2249[_0x3890('0x55')]!==_0x3890('0x56')){var _0x4c25d3={};_0x4c25d3[_0x1c2249[_0x3890('0x3f')]]={'$like':'%'+_0x392d64[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x4c25d3;}})});}_0xac391c=_[_0x3890('0x54')]({},_0xac391c,_0x392d64[_0x3890('0x57')]);var _0x44112a={'where':_0xac391c[_0x3890('0x51')]};return db[_0x3890('0x42')][_0x3890('0x32')](_0x44112a)[_0x3890('0x24')](function(_0x559ab6){_0x3f5077[_0x3890('0x32')]=_0x559ab6;if(_0x392d64[_0x3890('0x47')][_0x3890('0x58')]){_0xac391c[_0x3890('0x59')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0xac391c);})[_0x3890('0x24')](function(_0x38daee){_0x3f5077[_0x3890('0x5a')]=_0x38daee;return _0x3f5077;})[_0x3890('0x24')](respondWithFilteredResult(_0x534d74,_0xac391c))[_0x3890('0x2e')](handleError(_0x534d74,null));};exports[_0x3890('0x5b')]=function(_0x1b5e13,_0x3730d2){var _0x285d8e={'raw':![],'where':{'id':_0x1b5e13[_0x3890('0x5c')]['id']},'include':[{'model':db[_0x3890('0x5d')],'as':'mandatoryDispositionPause'}]},_0x46583b={};_0x46583b[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x42')]['rawAttributes']);_0x46583b['query']=_['keys'](_0x1b5e13['query']);_0x46583b[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x46583b['model'],_0x46583b[_0x3890('0x47')]);_0x285d8e[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x46583b[_0x3890('0x45')],qs['fields'](_0x1b5e13[_0x3890('0x47')][_0x3890('0x4b')]));_0x285d8e[_0x3890('0x4c')]=_0x285d8e['attributes'][_0x3890('0x4d')]?_0x285d8e['attributes']:_0x46583b[_0x3890('0x45')];if(_0x1b5e13[_0x3890('0x47')][_0x3890('0x58')]){_0x285d8e[_0x3890('0x59')]=[{'all':!![]}];}_0x285d8e=_['merge']({},_0x285d8e,_0x1b5e13['options']);return db['FaxAccount'][_0x3890('0x5e')](_0x285d8e)[_0x3890('0x24')](handleEntityNotFound(_0x3730d2,null))[_0x3890('0x24')](respondWithResult(_0x3730d2,null))[_0x3890('0x2e')](handleError(_0x3730d2,null));};exports[_0x3890('0x5f')]=function(_0x30eec6,_0x466897){return db[_0x3890('0x42')][_0x3890('0x5f')](_0x30eec6[_0x3890('0x60')],{})['then'](function(_0x16df7a){var _0x2cf63a=_0x30eec6[_0x3890('0x61')][_0x3890('0x3a')]({'plain':!![]});if(!_0x2cf63a)throw new Error(_0x3890('0x62'));if(_0x2cf63a[_0x3890('0x63')]===_0x3890('0x61')){var _0x5afa6f=_0x16df7a[_0x3890('0x3a')]({'plain':!![]});var _0x4a0a18=_0x3890('0x3b');return db[_0x3890('0x64')][_0x3890('0x5e')]({'where':{'name':_0x4a0a18,'userProfileId':_0x2cf63a[_0x3890('0x65')]},'raw':!![]})[_0x3890('0x24')](function(_0x283a76){if(_0x283a76&&_0x283a76['autoAssociation']===0x0){return db[_0x3890('0x3c')][_0x3890('0x5f')]({'name':_0x5afa6f[_0x3890('0x3f')],'resourceId':_0x5afa6f['id'],'type':_0x283a76[_0x3890('0x3f')],'sectionId':_0x283a76['id']},{})['then'](function(){return _0x16df7a;});}else{return _0x16df7a;}})['catch'](function(_0x2cb621){logger[_0x3890('0x29')](_0x3890('0x66'),_0x2cb621);throw _0x2cb621;});}return _0x16df7a;})[_0x3890('0x24')](respondWithResult(_0x466897,0xc9))[_0x3890('0x2e')](handleError(_0x466897,null));};exports[_0x3890('0x67')]=function(_0x4e0dd0,_0x3990fd){if(_0x4e0dd0['body']['id']){delete _0x4e0dd0[_0x3890('0x60')]['id'];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x4e0dd0[_0x3890('0x5c')]['id']},'include':[{'model':db[_0x3890('0x5d')],'as':_0x3890('0x41')}]})[_0x3890('0x24')](handleEntityNotFound(_0x3990fd,null))[_0x3890('0x24')](saveUpdates(_0x4e0dd0[_0x3890('0x60')],null))[_0x3890('0x24')](respondWithResult(_0x3990fd,null))[_0x3890('0x2e')](handleError(_0x3990fd,null));};exports['destroy']=function(_0x33ddcd,_0x539b7c){return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x33ddcd['params']['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x539b7c,null))[_0x3890('0x24')](removeEntity(_0x539b7c,null))[_0x3890('0x2e')](handleError(_0x539b7c,null));};exports[_0x3890('0x68')]=function(_0x2bda50,_0x2a38ec){return db[_0x3890('0x42')][_0x3890('0x68')]()[_0x3890('0x24')](respondWithResult(_0x2a38ec,null))['catch'](handleError(_0x2a38ec,null));};exports[_0x3890('0x69')]=function(_0x4a2950,_0x4737e9,_0x3cd938){if(_0x4a2950['body']['id']){delete _0x4a2950[_0x3890('0x60')]['id'];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x4a2950[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x4737e9,null))[_0x3890('0x24')](function(_0x4b60ee){if(_0x4b60ee){_0x4a2950[_0x3890('0x60')][_0x3890('0x6a')]=_0x4b60ee['id'];return db['Disposition'][_0x3890('0x5f')](_0x4a2950[_0x3890('0x60')]);}})[_0x3890('0x24')](respondWithResult(_0x4737e9,null))[_0x3890('0x2e')](handleError(_0x4737e9,null));};exports[_0x3890('0x6b')]=function(_0x1dc034,_0x3be1ae,_0x29d465){var _0x55773b={'raw':![],'where':{}};var _0x5c486e={};var _0x22ce9d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3890('0x6c')]({'where':{'id':_0x1dc034[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x3be1ae,null))['then'](function(_0x22cfc9){if(_0x22cfc9){_0x5c486e[_0x3890('0x45')]=_['keys'](db['Disposition'][_0x3890('0x43')]);_0x5c486e[_0x3890('0x47')]=_[_0x3890('0x48')](_0x1dc034[_0x3890('0x47')]);_0x5c486e[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x5c486e['model'],_0x5c486e[_0x3890('0x47')]);_0x55773b[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x5c486e[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x1dc034[_0x3890('0x47')]['fields']));_0x55773b[_0x3890('0x4c')]=_0x55773b['attributes'][_0x3890('0x4d')]?_0x55773b['attributes']:_0x5c486e[_0x3890('0x45')];if(!_0x1dc034[_0x3890('0x47')][_0x3890('0x4e')]('nolimit')){_0x55773b[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x1dc034[_0x3890('0x47')][_0x3890('0x34')]);_0x55773b['offset']=qs[_0x3890('0x33')](_0x1dc034['query']['offset']);}_0x55773b['order']=qs[_0x3890('0x50')](_0x1dc034[_0x3890('0x47')][_0x3890('0x50')]);_0x55773b[_0x3890('0x51')]=qs['filters'](_['pick'](_0x1dc034[_0x3890('0x47')],_0x5c486e[_0x3890('0x49')]));_0x55773b[_0x3890('0x51')][_0x3890('0x6a')]=_0x22cfc9['id'];if(_0x1dc034[_0x3890('0x47')][_0x3890('0x53')]){_0x55773b[_0x3890('0x51')]=_['merge'](_0x55773b['where'],{'$or':_[_0x3890('0x46')](_0x55773b[_0x3890('0x4c')],function(_0xe541c){var _0x50cee0={};_0x50cee0[_0xe541c]={'$like':'%'+_0x1dc034[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x50cee0;})});}_0x55773b=_['merge']({},_0x55773b,_0x1dc034[_0x3890('0x57')]);return db['Disposition'][_0x3890('0x32')]({'where':_0x55773b[_0x3890('0x51')]})[_0x3890('0x24')](function(_0x28d342){_0x22ce9d[_0x3890('0x32')]=_0x28d342;if(_0x1dc034[_0x3890('0x47')][_0x3890('0x58')]){_0x55773b['include']=[{'all':!![]}];}return db['Disposition'][_0x3890('0x6d')](_0x55773b);})[_0x3890('0x24')](function(_0x3e1248){_0x22ce9d['rows']=_0x3e1248;return _0x22ce9d;});}})[_0x3890('0x24')](respondWithFilteredResult(_0x3be1ae,_0x55773b))[_0x3890('0x2e')](handleError(_0x3be1ae,null));};exports[_0x3890('0x6e')]=function(_0x53c817,_0xc0236f,_0x78f48d){return db[_0x3890('0x42')]['find']({'where':{'id':_0x53c817[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0xc0236f,null))[_0x3890('0x24')](function(_0x290bbf){if(_0x290bbf){return _0x290bbf['removeDispositions'](_0x53c817[_0x3890('0x47')][_0x3890('0x6f')]);}})[_0x3890('0x24')](respondWithStatusCode(_0xc0236f,null))['catch'](handleError(_0xc0236f,null));};exports[_0x3890('0x70')]=function(_0x39989d,_0x2a300c,_0x584ed7){if(_0x39989d[_0x3890('0x60')]['id']){delete _0x39989d['body']['id'];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x39989d[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x2a300c,null))[_0x3890('0x24')](function(_0x3dacf9){if(_0x3dacf9){_0x39989d['body'][_0x3890('0x6a')]=_0x3dacf9['id'];return db['CannedAnswer'][_0x3890('0x5f')](_0x39989d['body']);}})[_0x3890('0x24')](respondWithResult(_0x2a300c,null))['catch'](handleError(_0x2a300c,null));};exports['getAnswers']=function(_0x3def0a,_0x1af419,_0x355dda){var _0x55565e={'raw':![],'where':{}};var _0x57db45={};var _0x4c518c={'count':0x0,'rows':[]};return db[_0x3890('0x42')][_0x3890('0x6c')]({'where':{'id':_0x3def0a[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x1af419,null))[_0x3890('0x24')](function(_0x553920){if(_0x553920){_0x57db45[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x71')]['rawAttributes']);_0x57db45[_0x3890('0x47')]=_['keys'](_0x3def0a[_0x3890('0x47')]);_0x57db45[_0x3890('0x49')]=_['intersection'](_0x57db45[_0x3890('0x45')],_0x57db45[_0x3890('0x47')]);_0x55565e[_0x3890('0x4c')]=_['intersection'](_0x57db45['model'],qs[_0x3890('0x4b')](_0x3def0a[_0x3890('0x47')][_0x3890('0x4b')]));_0x55565e[_0x3890('0x4c')]=_0x55565e[_0x3890('0x4c')][_0x3890('0x4d')]?_0x55565e[_0x3890('0x4c')]:_0x57db45['model'];if(!_0x3def0a[_0x3890('0x47')][_0x3890('0x4e')]('nolimit')){_0x55565e[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x3def0a['query'][_0x3890('0x34')]);_0x55565e['offset']=qs[_0x3890('0x33')](_0x3def0a[_0x3890('0x47')][_0x3890('0x33')]);}_0x55565e['order']=qs[_0x3890('0x50')](_0x3def0a[_0x3890('0x47')][_0x3890('0x50')]);_0x55565e['where']=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x3def0a[_0x3890('0x47')],_0x57db45[_0x3890('0x49')]));_0x55565e['where'][_0x3890('0x6a')]=_0x553920['id'];if(_0x3def0a['query'][_0x3890('0x53')]){_0x55565e[_0x3890('0x51')]=_['merge'](_0x55565e[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x55565e[_0x3890('0x4c')],function(_0x41bbf4){var _0x524801={};_0x524801[_0x41bbf4]={'$like':'%'+_0x3def0a[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x524801;})});}_0x55565e=_[_0x3890('0x54')]({},_0x55565e,_0x3def0a[_0x3890('0x57')]);return db[_0x3890('0x71')][_0x3890('0x32')]({'where':_0x55565e['where']})[_0x3890('0x24')](function(_0x5739d2){_0x4c518c[_0x3890('0x32')]=_0x5739d2;if(_0x3def0a[_0x3890('0x47')][_0x3890('0x58')]){_0x55565e[_0x3890('0x59')]=[{'all':!![]}];}return db[_0x3890('0x71')]['findAll'](_0x55565e);})['then'](function(_0x2fcf56){_0x4c518c['rows']=_0x2fcf56;return _0x4c518c;});}})[_0x3890('0x24')](respondWithFilteredResult(_0x1af419,_0x55565e))[_0x3890('0x2e')](handleError(_0x1af419,null));};exports[_0x3890('0x72')]=function(_0x3616e8,_0x47a760,_0x228dc1){return db[_0x3890('0x42')]['find']({'where':{'id':_0x3616e8[_0x3890('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47a760,null))['then'](function(_0x4563c1){if(_0x4563c1){return _0x4563c1[_0x3890('0x72')](_0x3616e8[_0x3890('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x47a760,null))[_0x3890('0x2e')](handleError(_0x47a760,null));};exports['addInteraction']=function(_0x214ebd,_0x2dcbb8,_0x2348fd){return db[_0x3890('0x73')][_0x3890('0x5e')]({'where':{'id':_0x214ebd[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x2dcbb8,null))[_0x3890('0x24')](function(_0x40714d){if(_0x40714d){return _0x40714d[_0x3890('0x74')](_0x214ebd[_0x3890('0x60')][_0x3890('0x6f')],_[_0x3890('0x75')](_0x214ebd['body'],[_0x3890('0x6f'),'id'])||{});}})[_0x3890('0x24')](respondWithResult(_0x2dcbb8,null))['catch'](handleError(_0x2dcbb8,null));};exports['getInteractions']=function(_0x87431,_0xe3e833,_0x42228f){var _0x4ad98f={'raw':![],'where':{}};var _0x2086a1={};var _0x559315={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3890('0x6c')]({'where':{'id':_0x87431[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0xe3e833,null))[_0x3890('0x24')](function(_0x161c64){if(_0x161c64){_0x2086a1[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x73')]['rawAttributes']);_0x2086a1[_0x3890('0x47')]=_[_0x3890('0x48')](_0x87431[_0x3890('0x47')]);_0x2086a1[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x2086a1['model'],_0x2086a1['query']);_0x4ad98f[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x2086a1[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x87431[_0x3890('0x47')]['fields']));_0x4ad98f[_0x3890('0x4c')]=_0x4ad98f[_0x3890('0x4c')][_0x3890('0x4d')]?_0x4ad98f[_0x3890('0x4c')]:_0x2086a1['model'];if(!_0x87431[_0x3890('0x47')][_0x3890('0x4e')](_0x3890('0x76'))){_0x4ad98f['limit']=qs[_0x3890('0x34')](_0x87431['query']['limit']);_0x4ad98f[_0x3890('0x33')]=qs[_0x3890('0x33')](_0x87431[_0x3890('0x47')][_0x3890('0x33')]);}_0x4ad98f[_0x3890('0x4f')]=qs[_0x3890('0x50')](_0x87431[_0x3890('0x47')][_0x3890('0x50')]);_0x4ad98f[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x87431[_0x3890('0x47')],_0x2086a1[_0x3890('0x49')]));_0x4ad98f['where'][_0x3890('0x6a')]=_0x161c64['id'];if(_0x87431[_0x3890('0x47')][_0x3890('0x53')]){_0x4ad98f[_0x3890('0x51')]=_[_0x3890('0x54')](_0x4ad98f[_0x3890('0x51')],{'$or':_['map'](_0x4ad98f[_0x3890('0x4c')],function(_0x28ec39){var _0x5d73be={};_0x5d73be[_0x28ec39]={'$like':'%'+_0x87431[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x5d73be;})});}_0x4ad98f=_[_0x3890('0x54')]({},_0x4ad98f,_0x87431[_0x3890('0x57')]);return db[_0x3890('0x73')][_0x3890('0x32')]({'where':_0x4ad98f[_0x3890('0x51')]})[_0x3890('0x24')](function(_0x3c4a99){_0x559315[_0x3890('0x32')]=_0x3c4a99;if(_0x87431[_0x3890('0x47')][_0x3890('0x58')]){_0x4ad98f[_0x3890('0x59')]=[{'model':db[_0x3890('0x77')],'as':_0x3890('0x78'),'required':![]},{'model':db['User'],'as':_0x3890('0x79'),'attributes':[_0x3890('0x3f'),_0x3890('0x7a'),'internal'],'required':![]},{'model':db[_0x3890('0x7b')],'as':_0x3890('0x7c'),'attributes':['id','name',_0x3890('0x7d')],'where':_0x87431[_0x3890('0x47')][_0x3890('0x7e')]?{'id':_0x87431[_0x3890('0x47')][_0x3890('0x7e')]}:undefined,'required':_0x87431['query'][_0x3890('0x7e')]?!![]:![]}];}return db[_0x3890('0x73')][_0x3890('0x6d')](_0x4ad98f);})['then'](function(_0x49070a){_0x559315[_0x3890('0x5a')]=_0x49070a;return _0x559315;});}})[_0x3890('0x24')](respondWithFilteredResult(_0xe3e833,_0x4ad98f))[_0x3890('0x2e')](handleError(_0xe3e833,null));};exports[_0x3890('0x7f')]=function(_0x3e5fdb,_0x346fab,_0x14032d){return db['FaxAccount']['findOne']({'where':{'id':_0x3e5fdb[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x346fab,null))[_0x3890('0x24')](function(_0x339976){if(_0x339976){return db[_0x3890('0x80')][_0x3890('0x81')](function(_0x105cd3){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x3e5fdb[_0x3890('0x5c')]['id']},'transaction':_0x105cd3})[_0x3890('0x24')](function(_0x1e6660){var _0x5c812b=_['map'](_0x3e5fdb[_0x3890('0x60')],function(_0x39cabb){_0x39cabb[_0x3890('0x6a')]=_0x3e5fdb['params']['id'];return _0x39cabb;});return db[_0x3890('0x82')][_0x3890('0x83')](_0x5c812b,{'transaction':_0x105cd3});});})['then'](function(){return db[_0x3890('0x82')][_0x3890('0x84')]({'where':{'FaxAccountId':_0x3e5fdb[_0x3890('0x5c')]['id']},'order':_0x3890('0x85')});});}})[_0x3890('0x24')](respondWithResult(_0x346fab,null))[_0x3890('0x2e')](handleError(_0x346fab,null));};exports[_0x3890('0x86')]=function(_0x12c62c,_0x328032,_0x2067df){var _0x2596f9={};var _0x3e7c05={};var _0x345261;var _0x551aef;return db[_0x3890('0x42')][_0x3890('0x6c')]({'where':{'id':_0x12c62c[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x328032,null))['then'](function(_0x3749a6){if(_0x3749a6){_0x345261=_0x3749a6;_0x3e7c05[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x82')][_0x3890('0x43')]);_0x3e7c05[_0x3890('0x47')]=_[_0x3890('0x48')](_0x12c62c[_0x3890('0x47')]);_0x3e7c05[_0x3890('0x49')]=_['intersection'](_0x3e7c05[_0x3890('0x45')],_0x3e7c05['query']);_0x2596f9['attributes']=_[_0x3890('0x4a')](_0x3e7c05[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x12c62c[_0x3890('0x47')][_0x3890('0x4b')]));_0x2596f9['attributes']=_0x2596f9[_0x3890('0x4c')][_0x3890('0x4d')]?_0x2596f9[_0x3890('0x4c')]:_0x3e7c05['model'];_0x2596f9['order']=qs[_0x3890('0x50')](_0x12c62c[_0x3890('0x47')][_0x3890('0x50')]);_0x2596f9[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x12c62c[_0x3890('0x47')],_0x3e7c05[_0x3890('0x49')]));if(_0x12c62c[_0x3890('0x47')]['filter']){_0x2596f9[_0x3890('0x51')]=_['merge'](_0x2596f9[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x2596f9['attributes'],function(_0x329f38){var _0x2d9217={};_0x2d9217[_0x329f38]={'$like':'%'+_0x12c62c['query']['filter']+'%'};return _0x2d9217;})});}_0x2596f9=_[_0x3890('0x54')]({},_0x2596f9,_0x12c62c[_0x3890('0x57')]);return _0x345261[_0x3890('0x86')](_0x2596f9);}})[_0x3890('0x24')](function(_0x1a48b6){if(_0x1a48b6){_0x551aef=_0x1a48b6[_0x3890('0x4d')];if(!_0x12c62c[_0x3890('0x47')][_0x3890('0x4e')](_0x3890('0x76'))){_0x2596f9[_0x3890('0x34')]=qs['limit'](_0x12c62c['query'][_0x3890('0x34')]);_0x2596f9[_0x3890('0x33')]=qs['offset'](_0x12c62c[_0x3890('0x47')]['offset']);}return _0x345261['getApplications'](_0x2596f9);}})[_0x3890('0x24')](function(_0x1e7065){if(_0x1e7065){return _0x1e7065?{'count':_0x551aef,'rows':_0x1e7065}:null;}})[_0x3890('0x24')](respondWithResult(_0x328032,null))[_0x3890('0x2e')](handleError(_0x328032,null));};function Extension(_0x325cbd,_0x579078,_0x588cc4,_0x906e81){this[_0x3890('0x87')]=_0x3890('0x88');this[_0x3890('0x89')]=_0x325cbd['localstationid'];this[_0x3890('0x8a')]=_0x906e81;this[_0x3890('0x55')]=_0x3890('0x8b');this[_0x3890('0x8c')]=_0x3890('0x8d');this['FaxAccountId']=_0x325cbd['id'];this[_0x3890('0x85')]=_0x579078;this[_0x3890('0x8e')]=_0x588cc4;}function createExtensionsReciveFax(_0x2b6d56){var _0x1274da=0x1;var _0x1f2862=[];_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,'','Answer'));_0x1274da+=0x1;_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,'CDR(type)=inbound-fax','Set'));_0x1274da+=0x1;for(var _0x12a015 in _0x2b6d56){if(_0x2b6d56[_0x3890('0x4e')](_0x12a015)&&(_0x12a015===_0x3890('0x90')||_0x12a015==='localstationid'||_0x12a015===_0x3890('0x91')||_0x12a015===_0x3890('0x92')||_0x12a015===_0x3890('0x93')||_0x12a015==='maxrate'||_0x12a015==='minrate'||_0x12a015===_0x3890('0x94')||_0x12a015==='t38timeout')){_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,_0x3890('0x95')+_0x12a015+')='+_0x2b6d56[_0x12a015],_0x3890('0x96')));_0x1274da+=0x1;}}_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,'6','Wait'));_0x1274da+=0x1;_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,_0x3890('0x97'),_0x3890('0x98')));_0x1274da=0x0;return _0x1f2862;}exports[_0x3890('0x99')]=function(_0x15a1fa,_0xab9c4d,_0x2b703a){var _0x869785;return db[_0x3890('0x80')][_0x3890('0x81')](function(_0x11884a){return db[_0x3890('0x42')][_0x3890('0x5f')](_0x15a1fa[_0x3890('0x60')],{'transaction':_0x11884a})['then'](function(_0x5562c2){_0x869785=_0x5562c2[_0x3890('0x3a')]({'plain':!![]});return db[_0x3890('0x9a')][_0x3890('0x83')](createExtensionsReciveFax(_0x869785),{'transaction':_0x11884a});});})[_0x3890('0x24')](function(){return _0x869785;})[_0x3890('0x24')](respondWithResult(_0xab9c4d,null))[_0x3890('0x2e')](handleError(_0xab9c4d,null));};exports['updateAccountApplications']=function(_0x4b6d7c,_0x4b3a0f,_0x4098f9){var _0x4334b;return db[_0x3890('0x80')][_0x3890('0x81')](function(_0x417a73){return db[_0x3890('0x42')][_0x3890('0x67')](_0x4b6d7c['body'],{'where':{'id':_0x4b6d7c[_0x3890('0x60')]['id']},'transaction':_0x417a73})[_0x3890('0x24')](function(_0x23dee4){return db[_0x3890('0x9a')][_0x3890('0x39')]({'where':{'FaxAccountId':_0x4b6d7c[_0x3890('0x60')]['id']},'transaction':_0x417a73})[_0x3890('0x24')](function(_0xaac93e){return db[_0x3890('0x9a')][_0x3890('0x83')](createExtensionsReciveFax(_['omit'](_0x4b6d7c[_0x3890('0x60')],[_0x3890('0x9b'),_0x3890('0x44'),_0x3890('0x9c'),'updatedAt',_0x3890('0x9d'),_0x3890('0x9e')])),{'transaction':_0x417a73});});});})[_0x3890('0x24')](function(){return db[_0x3890('0x42')]['findById'](_0x4b6d7c[_0x3890('0x60')]['id']);})[_0x3890('0x24')](respondWithResult(_0x4b3a0f,null))[_0x3890('0x2e')](handleError(_0x4b3a0f,null));};exports[_0x3890('0x9f')]=function(_0x1f6440,_0x29c9c8,_0x428124){var _0x4b325a={'raw':!![],'where':{}};var _0x5070f0={};var _0x4decc7={'count':0x0,'rows':[]};return db[_0x3890('0x42')][_0x3890('0x6c')]({'where':{'id':_0x1f6440[_0x3890('0x5c')]['id']}})['then'](handleEntityNotFound(_0x29c9c8,null))[_0x3890('0x24')](function(_0x439f19){if(_0x439f19){_0x5070f0[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0xa0')][_0x3890('0x43')]);_0x5070f0[_0x3890('0x47')]=_[_0x3890('0x48')](_0x1f6440[_0x3890('0x47')]);_0x5070f0[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x5070f0[_0x3890('0x45')],_0x5070f0[_0x3890('0x47')]);_0x4b325a[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x5070f0[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x1f6440['query'][_0x3890('0x4b')]));_0x4b325a[_0x3890('0x4c')]=_0x4b325a[_0x3890('0x4c')][_0x3890('0x4d')]?_0x4b325a[_0x3890('0x4c')]:_0x5070f0[_0x3890('0x45')];if(!_0x1f6440[_0x3890('0x47')]['hasOwnProperty'](_0x3890('0x76'))){_0x4b325a[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x1f6440['query']['limit']);_0x4b325a[_0x3890('0x33')]=qs[_0x3890('0x33')](_0x1f6440[_0x3890('0x47')][_0x3890('0x33')]);}_0x4b325a[_0x3890('0x4f')]=qs[_0x3890('0x50')](_0x1f6440['query'][_0x3890('0x50')]);_0x4b325a['where']=qs[_0x3890('0x49')](_['pick'](_0x1f6440[_0x3890('0x47')],_0x5070f0[_0x3890('0x49')]));_0x4b325a[_0x3890('0x51')][_0x3890('0x6a')]=_0x439f19['id'];if(_0x1f6440[_0x3890('0x47')]['filter']){_0x4b325a['where']=_[_0x3890('0x54')](_0x4b325a[_0x3890('0x51')],{'$or':_['map'](_0x4b325a[_0x3890('0x4c')],function(_0x5e99fb){var _0x297959={};_0x297959[_0x5e99fb]={'$like':'%'+_0x1f6440[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x297959;})});}if(_0x1f6440[_0x3890('0x47')][_0x3890('0xa1')]){var _0x6726ef=_0x1f6440[_0x3890('0x47')][_0x3890('0xa1')][_0x3890('0xa2')](',');var _0x4f220b={};_0x4f220b[_0x6726ef[0x0]]={'$gte':moment(_0x6726ef[0x1])[_0x3890('0xa3')](_0x3890('0xa4'))};_0x4b325a['where']=_[_0x3890('0x54')](_0x4b325a[_0x3890('0x51')],_0x4f220b);}_0x4b325a=_[_0x3890('0x54')]({},_0x4b325a,_0x1f6440[_0x3890('0x57')]);return db[_0x3890('0xa0')]['count']({'where':_0x4b325a[_0x3890('0x51')]})[_0x3890('0x24')](function(_0x3fa4e3){_0x4decc7[_0x3890('0x32')]=_0x3fa4e3;if(_0x1f6440[_0x3890('0x47')]['includeAll']){_0x4b325a[_0x3890('0x59')]=[{'all':!![]}];}return db['FaxMessage'][_0x3890('0x6d')](_0x4b325a);})[_0x3890('0x24')](function(_0x4f484e){_0x4decc7[_0x3890('0x5a')]=_0x4f484e;return _0x4decc7;});}})[_0x3890('0x24')](respondWithFilteredResult(_0x29c9c8,_0x4b325a))['catch'](handleError(_0x29c9c8,null));};exports[_0x3890('0x40')]=function(_0x3f5961,_0x2e28dc,_0x397d00){var _0x403058,_0x2d73a7={},_0x3b0336;if(_0x3f5961[_0x3890('0x60')]['to']){_0x3b0336=_0x3f5961[_0x3890('0x60')]['to'][0x0];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x3f5961[_0x3890('0x5c')]['id']},'include':[{'model':db[_0x3890('0xa5')],'as':_0x3890('0xa6'),'include':[{'model':db[_0x3890('0x77')],'as':_0x3890('0xa7'),'where':{'fax':_0x3b0336},'limit':0x1,'order':[[_0x3890('0xa8'),_0x3890('0xa9')]]}]}]})[_0x3890('0x24')](handleEntityNotFound(_0x2e28dc,null))[_0x3890('0x24')](function(_0x5b718a){_0x403058=_0x5b718a;if(_0x3f5961[_0x3890('0x60')]['attachments']&&_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][_0x3890('0x4d')]){for(var _0x49dc90=0x0;_0x49dc90<_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')]['length'];_0x49dc90+=0x1){_0x3f5961['body'][_0x3890('0xaa')][_0x49dc90]={'filename':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][_0x49dc90]['name'],'id':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][_0x49dc90]['id'],'path':path['join'](config[_0x3890('0xab')],'server/files/attachments',_0x3f5961[_0x3890('0x60')]['attachments'][_0x49dc90][_0x3890('0xac')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x3890('0xad')](_0x3f5961['params']['id'])?undefined:_0x3f5961[_0x3890('0x5c')]['id'],'path':_['isNil'](_0x3f5961[_0x3890('0x60')]['attachments'][0x0][_0x3890('0x7')])?undefined:_0x3f5961[_0x3890('0x60')]['attachments'][0x0][_0x3890('0x7')],'fax':_[_0x3890('0xad')](_0x3f5961[_0x3890('0x60')]['to'][0x0])?undefined:_0x3f5961[_0x3890('0x60')]['to'][0x0]},client9002);})[_0x3890('0x24')](function(){if(_0x403058){if(_[_0x3890('0xad')](_0x3f5961['body'][_0x3890('0xae')])){_0x3f5961[_0x3890('0x60')][_0x3890('0xae')]=util[_0x3890('0xa3')]('\x22%s\x22\x20<%s>',_0x403058['name'],_0x403058['fax']);}if(_0x403058[_0x3890('0xa6')]){if(_0x403058[_0x3890('0xa6')][_0x3890('0xa7')][_0x3890('0x4d')]){return _0x403058['List'][_0x3890('0xa7')][0x0];}else{return db[_0x3890('0x77')][_0x3890('0x5f')](_[_0x3890('0x17')](_0x3f5961['body'],{'firstName':_0x3f5961[_0x3890('0x60')]['to'][0x0],'phone':_0x3f5961['body']['to'][0x0],'fax':_0x3f5961[_0x3890('0x60')]['to'][0x0],'ListId':_0x403058[_0x3890('0x9e')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x3890('0xaf'));}})[_0x3890('0x24')](function(_0x34a270){if(_0x34a270){return db[_0x3890('0x73')][_0x3890('0x5e')]({'where':{'ContactId':_0x34a270['id'],'closed':![],'FaxAccountId':_0x403058['id']}})[_0x3890('0x24')](function(_0x261a09){if(_0x261a09){return[_0x261a09,![]];}return db[_0x3890('0x73')][_0x3890('0x5f')]({'UserId':_0x3f5961['user']['id'],'ContactId':_0x34a270['id'],'FaxAccountId':_0x403058['id'],'fax':_0x3f5961[_0x3890('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x3890('0x54')](_0x3f5961[_0x3890('0x60')],{'read':![],'body':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0][_0x3890('0xb0')],'FaxAccountId':_0x403058['id'],'UserId':_0x3f5961['user']['id'],'ContactId':_0x34a270['id'],'AttachmentId':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x3890('0xb1')}]})[_0x3890('0x24')](function(_0x133ca6){return[_0x133ca6,!![]];});});}else{throw new Error(_0x3890('0xb2'));}})[_0x3890('0xb3')](function(_0x146a1f,_0x58dedb){if(_0x58dedb){return _0x146a1f;}return db[_0x3890('0xa0')]['create']({'direction':_0x3890('0xb4'),'read':![],'body':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0][_0x3890('0xb0')],'FaxAccountId':_0x403058['id'],'FaxInteractionId':_0x146a1f['id'],'UserId':_0x3f5961['user']['id'],'ContactId':_0x146a1f[_0x3890('0xb5')],'AttachmentId':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['id']})[_0x3890('0x24')](function(_0x2f98d7){_0x146a1f[_0x3890('0xb6')][_0x3890('0xb1')]=[];_0x146a1f[_0x3890('0xb6')][_0x3890('0xb1')][_0x3890('0x8f')](_0x2f98d7[_0x3890('0xb6')]);return _0x146a1f;});})[_0x3890('0x24')](function(_0x1c1963){respondWithRpcPromise(_0x3890('0xb7'),_0x3890('0xb7'),{'FaxAccountId':_[_0x3890('0xad')](_0x3f5961[_0x3890('0x5c')]['id'])?undefined:_0x3f5961[_0x3890('0x5c')]['id'],'path':_[_0x3890('0xad')](_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['path'])?undefined:_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0][_0x3890('0x7')],'fax':_[_0x3890('0xad')](_0x3f5961['body']['to'][0x0])?undefined:_0x3f5961[_0x3890('0x60')]['to'][0x0],'AttachmentId':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['id']},client9002)['then'](function(_0x5ab0d7){logger[_0x3890('0x25')]('SendFaxRpc,\x20%s',_0x5ab0d7);})[_0x3890('0x2e')](function(_0x302a44){logger[_0x3890('0x25')]('SendFaxRpc,\x20%s',_0x302a44);});return _0x1c1963;})[_0x3890('0x24')](respondWithResult(_0x2e28dc,null))[_0x3890('0x2e')](handleError(_0x2e28dc,null));};exports[_0x3890('0xb8')]=function(_0x31722c,_0x4dddd3,_0x5d3c3b){return db['FaxAccount'][_0x3890('0x5e')]({'where':{'id':_0x31722c[_0x3890('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4dddd3,null))['then'](function(_0x49c71f){if(_0x49c71f){return _0x49c71f['addAgents'](_0x31722c['body'][_0x3890('0x6f')],_[_0x3890('0x75')](_0x31722c[_0x3890('0x60')],[_0x3890('0x6f'),'id'])||{})[_0x3890('0xb3')](function(_0xed0280){for(var _0x387c5c=0x0;_0x387c5c<_0x31722c[_0x3890('0x60')]['ids'][_0x3890('0x4d')];_0x387c5c+=0x1){socket[_0x3890('0xb9')](_0x3890('0xba'),{'UserId':_0x31722c[_0x3890('0x60')][_0x3890('0x6f')][_0x387c5c],'FaxAccountId':_0x31722c['params']['id']});}return _0xed0280;});}})[_0x3890('0x24')](respondWithResult(_0x4dddd3,null))['catch'](handleError(_0x4dddd3,null));};exports[_0x3890('0xbb')]=function(_0x5c6190,_0x27bbbc,_0x18ac03){return db[_0x3890('0x42')]['find']({'where':{'id':_0x5c6190[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x27bbbc,null))[_0x3890('0x24')](function(_0x2c39a4){if(_0x2c39a4){return _0x2c39a4[_0x3890('0xbb')](_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')])[_0x3890('0x24')](function(){if(_[_0x3890('0xbc')](_0x5c6190[_0x3890('0x47')]['ids'])){for(var _0x269521=0x0;_0x269521<_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')]['length'];_0x269521+=0x1){socket['emit'](_0x3890('0xbd'),{'UserId':Number(_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')][_0x269521]),'FaxAccountId':Number(_0x5c6190[_0x3890('0x5c')]['id'])});}}else{socket[_0x3890('0xb9')](_0x3890('0xbd'),{'UserId':Number(_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')]),'FaxAccountId':Number(_0x5c6190[_0x3890('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x27bbbc,null))[_0x3890('0x2e')](handleError(_0x27bbbc,null));};exports[_0x3890('0xbe')]=function(_0x18158a,_0x39d057,_0x4e5c85){var _0x3a725e={};var _0x2d7e46={};var _0x3d687f;var _0x1af18a;return db['FaxAccount'][_0x3890('0x6c')]({'where':{'id':_0x18158a[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x39d057,null))[_0x3890('0x24')](function(_0x238acf){if(_0x238acf){_0x3d687f=_0x238acf;_0x2d7e46[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0xbf')]['rawAttributes']);_0x2d7e46[_0x3890('0x47')]=_[_0x3890('0x48')](_0x18158a[_0x3890('0x47')]);_0x2d7e46[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x2d7e46[_0x3890('0x45')],_0x2d7e46[_0x3890('0x47')]);_0x3a725e[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x2d7e46[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x18158a['query'][_0x3890('0x4b')]));_0x3a725e['attributes']=_0x3a725e[_0x3890('0x4c')][_0x3890('0x4d')]?_0x3a725e[_0x3890('0x4c')]:_0x2d7e46[_0x3890('0x45')];_0x3a725e[_0x3890('0x4f')]=qs[_0x3890('0x50')](_0x18158a[_0x3890('0x47')]['sort']);_0x3a725e[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x18158a['query'],_0x2d7e46[_0x3890('0x49')]));if(_0x18158a[_0x3890('0x47')][_0x3890('0x53')]){_0x3a725e[_0x3890('0x51')]=_[_0x3890('0x54')](_0x3a725e[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x3a725e[_0x3890('0x4c')],function(_0x1ef76a){var _0x363506={};_0x363506[_0x1ef76a]={'$like':'%'+_0x18158a[_0x3890('0x47')]['filter']+'%'};return _0x363506;})});}_0x3a725e=_[_0x3890('0x54')]({},_0x3a725e,_0x18158a[_0x3890('0x57')]);return _0x3d687f[_0x3890('0xbe')](_0x3a725e);}})['then'](function(_0x3f22b3){if(_0x3f22b3){_0x1af18a=_0x3f22b3[_0x3890('0x4d')];if(!_0x18158a['query'][_0x3890('0x4e')](_0x3890('0x76'))){_0x3a725e[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x18158a[_0x3890('0x47')][_0x3890('0x34')]);_0x3a725e[_0x3890('0x33')]=qs['offset'](_0x18158a[_0x3890('0x47')][_0x3890('0x33')]);}return _0x3d687f[_0x3890('0xbe')](_0x3a725e);}})[_0x3890('0x24')](function(_0x21d585){if(_0x21d585){return _0x21d585?{'count':_0x1af18a,'rows':_0x21d585}:null;}})[_0x3890('0x24')](respondWithResult(_0x39d057,null))[_0x3890('0x2e')](handleError(_0x39d057,null));}; \ No newline at end of file +var _0x1929=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','ValidationError','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','end','name','index','Pause','FaxAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','push','Answer','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','get','VoiceExtension','bulkCreate','omit','tech','createdAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','join','root','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','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x1929,0x187));var _0x9192=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x1929[_0x4709c8];return _0x478cdd;};'use strict';var pdf=require(_0x9192('0x0'));var emlformat=require(_0x9192('0x1'));var rimraf=require(_0x9192('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9192('0x3'));var moment=require(_0x9192('0x4'));var BPromise=require(_0x9192('0x5'));var Mustache=require(_0x9192('0x6'));var util=require(_0x9192('0x7'));var path=require(_0x9192('0x8'));var sox=require(_0x9192('0x9'));var csv=require(_0x9192('0xa'));var ejs=require(_0x9192('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9192('0xc'));var crypto=require(_0x9192('0xd'));var jsforce=require(_0x9192('0xe'));var deskjs=require(_0x9192('0xf'));var toCsv=require(_0x9192('0xa'));var querystring=require(_0x9192('0x10'));var Papa=require(_0x9192('0x11'));var Redis=require(_0x9192('0x12'));var authService=require(_0x9192('0x13'));var qs=require(_0x9192('0x14'));var as=require(_0x9192('0x15'));var hardwareService=require(_0x9192('0x16'));var logger=require('../../config/logger')(_0x9192('0x17'));var utils=require(_0x9192('0x18'));var config=require(_0x9192('0x19'));var db=require(_0x9192('0x1a'))['db'];config[_0x9192('0x1b')]=_[_0x9192('0x1c')](config['redis'],{'host':_0x9192('0x1d'),'port':0x18eb});var socket=require(_0x9192('0x1e'))(new Redis(config[_0x9192('0x1b')]));require('./faxAccount.socket')[_0x9192('0x1f')](socket);var jayson=require(_0x9192('0x20'));var client=jayson[_0x9192('0x21')][_0x9192('0x22')]({'port':0x232c});var client9002=jayson[_0x9192('0x21')][_0x9192('0x22')]({'port':0x232a});function checkPasswordPattern(_0x11075e,_0x327ae4,_0x5979d6){if(_0x5979d6){var _0x21ce2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21ce2b['test'](_0x327ae4)){return _0x11075e;}else{throw new db['Sequelize'][(_0x9192('0x23'))]('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 _0x11075e;}}function respondWithRpcPromise(_0x58730f,_0x59db53,_0x1eafe0,_0x321a44){return new BPromise(function(_0x3c9fb2,_0x3b6674){var _0x7b1b85=_0x321a44||client;return _0x7b1b85[_0x9192('0x24')](_0x58730f,_0x1eafe0)[_0x9192('0x25')](function(_0x1a2f59){logger['info'](_0x9192('0x26'),_0x59db53,_0x9192('0x27'));logger[_0x9192('0x28')](_0x9192('0x29'),_0x59db53,_0x9192('0x27'),JSON['stringify'](_0x1a2f59));if(_0x1a2f59['error']){if(_0x1a2f59[_0x9192('0x2a')][_0x9192('0x2b')]===0x1f4){logger[_0x9192('0x2a')](_0x9192('0x26'),_0x59db53,_0x1a2f59[_0x9192('0x2a')][_0x9192('0x2c')]);return _0x3b6674(_0x1a2f59[_0x9192('0x2a')][_0x9192('0x2c')]);}logger['error'](_0x9192('0x26'),_0x59db53,_0x1a2f59[_0x9192('0x2a')]['message']);return _0x3c9fb2(_0x1a2f59['error'][_0x9192('0x2c')]);}else{logger[_0x9192('0x2d')]('FaxAccount,\x20%s,\x20%s',_0x59db53,_0x9192('0x27'));_0x3c9fb2(_0x1a2f59[_0x9192('0x2e')][_0x9192('0x2c')]);}})['catch'](function(_0x1a5542){logger[_0x9192('0x2a')](_0x9192('0x26'),_0x59db53,_0x1a5542);_0x3b6674(_0x1a5542);});});}function respondWithStatusCode(_0x32a8df,_0x4739b0){_0x4739b0=_0x4739b0||0xcc;return function(_0xcd2eec){if(_0xcd2eec){return _0x32a8df[_0x9192('0x2f')](_0x4739b0);}return _0x32a8df[_0x9192('0x30')](_0x4739b0)['end']();};}function respondWithResult(_0x75b9c8,_0x2d1aae){_0x2d1aae=_0x2d1aae||0xc8;return function(_0x181560){if(_0x181560){return _0x75b9c8['status'](_0x2d1aae)[_0x9192('0x31')](_0x181560);}};}function respondWithFilteredResult(_0x362d87,_0x3e3f93){return function(_0x591e1e){if(_0x591e1e){var _0x3fa14b=_0x591e1e[_0x9192('0x32')],_0x342cdd=_0x3e3f93[_0x9192('0x33')],_0x204c7a=_0x3e3f93[_0x9192('0x33')]+_0x3e3f93[_0x9192('0x34')],_0xb0209c;if(_0x204c7a>=_0x3fa14b){_0x204c7a=_0x3fa14b;_0xb0209c=0xc8;}else{_0xb0209c=0xce;}_0x362d87['status'](_0xb0209c);return _0x362d87['set'](_0x9192('0x35'),_0x342cdd+'-'+_0x204c7a+'/'+_0x3fa14b)['json'](_0x591e1e);}return null;};}function patchUpdates(_0x4e9f6e){return function(_0x5f59d8){try{jsonpatch[_0x9192('0x36')](_0x5f59d8,_0x4e9f6e,!![]);}catch(_0x129e58){return BPromise[_0x9192('0x37')](_0x129e58);}return _0x5f59d8[_0x9192('0x38')]();};}function saveUpdates(_0x261502,_0xd154b){return function(_0x129cff){if(_0x129cff){return _0x129cff[_0x9192('0x39')](_0x261502)[_0x9192('0x25')](function(_0x4ef1c8){return _0x4ef1c8;});}return null;};}function removeEntity(_0x2351e4,_0x528be9){return function(_0x3887bc){if(_0x3887bc){return _0x3887bc[_0x9192('0x3a')]()['then'](function(){var _0xe38c0d=_0x3887bc['get']({'plain':!![]});var _0x1eb304=_0x9192('0x3b');return db[_0x9192('0x3c')][_0x9192('0x3a')]({'where':{'type':_0x1eb304,'resourceId':_0xe38c0d['id']}})[_0x9192('0x25')](function(){return _0x3887bc;});})[_0x9192('0x25')](function(){_0x2351e4[_0x9192('0x30')](0xcc)[_0x9192('0x3d')]();});}};}function handleEntityNotFound(_0x30d300,_0x24e090){return function(_0x49e161){if(!_0x49e161){_0x30d300[_0x9192('0x2f')](0x194);}return _0x49e161;};}function handleError(_0x2d4167,_0x208d60){_0x208d60=_0x208d60||0x1f4;return function(_0x177b4d){logger['error'](_0x177b4d['stack']);if(_0x177b4d[_0x9192('0x3e')]){delete _0x177b4d['name'];}_0x2d4167[_0x9192('0x30')](_0x208d60)['send'](_0x177b4d);};}exports[_0x9192('0x3f')]=function(_0x75a7ec,_0x4de40a){var _0x1ba08d={'include':[{'model':db[_0x9192('0x40')],'as':'mandatoryDispositionPause'}]},_0x47ce04={},_0x2d346a={'count':0x0,'rows':[]};var _0x528aef=_['map'](db[_0x9192('0x41')][_0x9192('0x42')],function(_0x46d31d){return{'name':_0x46d31d['fieldName'],'type':_0x46d31d[_0x9192('0x43')][_0x9192('0x44')]};});_0x47ce04[_0x9192('0x45')]=_[_0x9192('0x46')](_0x528aef,_0x9192('0x3e'));_0x47ce04[_0x9192('0x47')]=_[_0x9192('0x48')](_0x75a7ec[_0x9192('0x47')]);_0x47ce04[_0x9192('0x49')]=_[_0x9192('0x4a')](_0x47ce04[_0x9192('0x45')],_0x47ce04[_0x9192('0x47')]);_0x1ba08d[_0x9192('0x4b')]=_[_0x9192('0x4a')](_0x47ce04[_0x9192('0x45')],qs['fields'](_0x75a7ec[_0x9192('0x47')][_0x9192('0x4c')]));_0x1ba08d[_0x9192('0x4b')]=_0x1ba08d[_0x9192('0x4b')][_0x9192('0x4d')]?_0x1ba08d['attributes']:_0x47ce04['model'];if(!_0x75a7ec[_0x9192('0x47')][_0x9192('0x4e')](_0x9192('0x4f'))){_0x1ba08d[_0x9192('0x34')]=qs[_0x9192('0x34')](_0x75a7ec[_0x9192('0x47')][_0x9192('0x34')]);_0x1ba08d[_0x9192('0x33')]=qs[_0x9192('0x33')](_0x75a7ec['query']['offset']);}_0x1ba08d['order']=qs[_0x9192('0x50')](_0x75a7ec[_0x9192('0x47')][_0x9192('0x50')]);_0x1ba08d[_0x9192('0x51')]=qs[_0x9192('0x49')](_[_0x9192('0x52')](_0x75a7ec[_0x9192('0x47')],_0x47ce04[_0x9192('0x49')]),_0x528aef);if(_0x75a7ec['query'][_0x9192('0x53')]){_0x1ba08d[_0x9192('0x51')]=_[_0x9192('0x54')](_0x1ba08d['where'],{'$or':_[_0x9192('0x46')](_0x528aef,function(_0x38a4ed){if(_0x38a4ed[_0x9192('0x43')]!==_0x9192('0x55')){var _0x4584a2={};_0x4584a2[_0x38a4ed[_0x9192('0x3e')]]={'$like':'%'+_0x75a7ec[_0x9192('0x47')][_0x9192('0x53')]+'%'};return _0x4584a2;}})});}_0x1ba08d=_[_0x9192('0x54')]({},_0x1ba08d,_0x75a7ec[_0x9192('0x56')]);var _0x536a98={'where':_0x1ba08d[_0x9192('0x51')]};return db['FaxAccount']['count'](_0x536a98)[_0x9192('0x25')](function(_0x8ea4ef){_0x2d346a['count']=_0x8ea4ef;if(_0x75a7ec[_0x9192('0x47')][_0x9192('0x57')]){_0x1ba08d['include']=[{'all':!![]}];}return db[_0x9192('0x41')][_0x9192('0x58')](_0x1ba08d);})[_0x9192('0x25')](function(_0x27efd2){_0x2d346a[_0x9192('0x59')]=_0x27efd2;return _0x2d346a;})[_0x9192('0x25')](respondWithFilteredResult(_0x4de40a,_0x1ba08d))['catch'](handleError(_0x4de40a,null));};exports[_0x9192('0x5a')]=function(_0x2f7baf,_0x427628){var _0xf2cb71={'raw':![],'where':{'id':_0x2f7baf[_0x9192('0x5b')]['id']},'include':[{'model':db[_0x9192('0x40')],'as':_0x9192('0x5c')}]},_0x379c33={};_0x379c33[_0x9192('0x45')]=_[_0x9192('0x48')](db[_0x9192('0x41')][_0x9192('0x42')]);_0x379c33[_0x9192('0x47')]=_[_0x9192('0x48')](_0x2f7baf['query']);_0x379c33['filters']=_[_0x9192('0x4a')](_0x379c33[_0x9192('0x45')],_0x379c33[_0x9192('0x47')]);_0xf2cb71[_0x9192('0x4b')]=_[_0x9192('0x4a')](_0x379c33['model'],qs[_0x9192('0x4c')](_0x2f7baf['query'][_0x9192('0x4c')]));_0xf2cb71[_0x9192('0x4b')]=_0xf2cb71[_0x9192('0x4b')]['length']?_0xf2cb71[_0x9192('0x4b')]:_0x379c33[_0x9192('0x45')];if(_0x2f7baf['query']['includeAll']){_0xf2cb71[_0x9192('0x5d')]=[{'all':!![]}];}_0xf2cb71=_[_0x9192('0x54')]({},_0xf2cb71,_0x2f7baf[_0x9192('0x56')]);return db[_0x9192('0x41')][_0x9192('0x5e')](_0xf2cb71)[_0x9192('0x25')](handleEntityNotFound(_0x427628,null))[_0x9192('0x25')](respondWithResult(_0x427628,null))[_0x9192('0x5f')](handleError(_0x427628,null));};exports[_0x9192('0x60')]=function(_0x564010,_0x3b6a01){return db['FaxAccount']['create'](_0x564010[_0x9192('0x61')],{})[_0x9192('0x25')](function(_0x4419d1){var _0x100537=_0x564010[_0x9192('0x62')]['get']({'plain':!![]});if(!_0x100537)throw new Error(_0x9192('0x63'));if(_0x100537['role']===_0x9192('0x62')){var _0x6a3b01=_0x4419d1['get']({'plain':!![]});var _0x325e4e='FaxAccounts';return db[_0x9192('0x64')]['find']({'where':{'name':_0x325e4e,'userProfileId':_0x100537[_0x9192('0x65')]},'raw':!![]})['then'](function(_0x4e8018){if(_0x4e8018&&_0x4e8018[_0x9192('0x66')]===0x0){return db[_0x9192('0x3c')][_0x9192('0x60')]({'name':_0x6a3b01[_0x9192('0x3e')],'resourceId':_0x6a3b01['id'],'type':_0x4e8018['name'],'sectionId':_0x4e8018['id']},{})['then'](function(){return _0x4419d1;});}else{return _0x4419d1;}})[_0x9192('0x5f')](function(_0x1ada4f){logger[_0x9192('0x2a')](_0x9192('0x67'),_0x1ada4f);throw _0x1ada4f;});}return _0x4419d1;})[_0x9192('0x25')](respondWithResult(_0x3b6a01,0xc9))[_0x9192('0x5f')](handleError(_0x3b6a01,null));};exports[_0x9192('0x39')]=function(_0x22a3e7,_0x4d1dce){if(_0x22a3e7[_0x9192('0x61')]['id']){delete _0x22a3e7['body']['id'];}return db[_0x9192('0x41')]['find']({'where':{'id':_0x22a3e7[_0x9192('0x5b')]['id']},'include':[{'model':db[_0x9192('0x40')],'as':'mandatoryDispositionPause'}]})[_0x9192('0x25')](handleEntityNotFound(_0x4d1dce,null))[_0x9192('0x25')](saveUpdates(_0x22a3e7[_0x9192('0x61')],null))[_0x9192('0x25')](respondWithResult(_0x4d1dce,null))[_0x9192('0x5f')](handleError(_0x4d1dce,null));};exports[_0x9192('0x3a')]=function(_0x2f01e1,_0x204611){return db['FaxAccount'][_0x9192('0x5e')]({'where':{'id':_0x2f01e1[_0x9192('0x5b')]['id']}})['then'](handleEntityNotFound(_0x204611,null))[_0x9192('0x25')](removeEntity(_0x204611,null))[_0x9192('0x5f')](handleError(_0x204611,null));};exports[_0x9192('0x68')]=function(_0x69365c,_0x2a74bd){return db[_0x9192('0x41')]['describe']()[_0x9192('0x25')](respondWithResult(_0x2a74bd,null))[_0x9192('0x5f')](handleError(_0x2a74bd,null));};exports[_0x9192('0x69')]=function(_0x630417,_0x3b85cb,_0xcf32ba){if(_0x630417['body']['id']){delete _0x630417[_0x9192('0x61')]['id'];}return db[_0x9192('0x41')][_0x9192('0x5e')]({'where':{'id':_0x630417[_0x9192('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b85cb,null))['then'](function(_0x93d21){if(_0x93d21){_0x630417[_0x9192('0x61')][_0x9192('0x6a')]=_0x93d21['id'];return db[_0x9192('0x6b')][_0x9192('0x60')](_0x630417[_0x9192('0x61')]);}})[_0x9192('0x25')](respondWithResult(_0x3b85cb,null))[_0x9192('0x5f')](handleError(_0x3b85cb,null));};exports[_0x9192('0x6c')]=function(_0x53ea43,_0x5dc821,_0x4f90c2){var _0x131392={'raw':![],'where':{}};var _0x1d8523={};var _0x4d69a4={'count':0x0,'rows':[]};return db[_0x9192('0x41')]['findOne']({'where':{'id':_0x53ea43['params']['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x5dc821,null))[_0x9192('0x25')](function(_0x3abfd6){if(_0x3abfd6){_0x1d8523['model']=_[_0x9192('0x48')](db[_0x9192('0x6b')]['rawAttributes']);_0x1d8523[_0x9192('0x47')]=_[_0x9192('0x48')](_0x53ea43[_0x9192('0x47')]);_0x1d8523[_0x9192('0x49')]=_[_0x9192('0x4a')](_0x1d8523[_0x9192('0x45')],_0x1d8523[_0x9192('0x47')]);_0x131392[_0x9192('0x4b')]=_[_0x9192('0x4a')](_0x1d8523[_0x9192('0x45')],qs['fields'](_0x53ea43[_0x9192('0x47')]['fields']));_0x131392[_0x9192('0x4b')]=_0x131392['attributes']['length']?_0x131392[_0x9192('0x4b')]:_0x1d8523['model'];if(!_0x53ea43[_0x9192('0x47')][_0x9192('0x4e')](_0x9192('0x4f'))){_0x131392['limit']=qs['limit'](_0x53ea43[_0x9192('0x47')]['limit']);_0x131392[_0x9192('0x33')]=qs[_0x9192('0x33')](_0x53ea43[_0x9192('0x47')][_0x9192('0x33')]);}_0x131392[_0x9192('0x6d')]=qs[_0x9192('0x50')](_0x53ea43['query'][_0x9192('0x50')]);_0x131392[_0x9192('0x51')]=qs[_0x9192('0x49')](_['pick'](_0x53ea43[_0x9192('0x47')],_0x1d8523[_0x9192('0x49')]));_0x131392[_0x9192('0x51')]['FaxAccountId']=_0x3abfd6['id'];if(_0x53ea43[_0x9192('0x47')][_0x9192('0x53')]){_0x131392[_0x9192('0x51')]=_[_0x9192('0x54')](_0x131392['where'],{'$or':_[_0x9192('0x46')](_0x131392[_0x9192('0x4b')],function(_0x434134){var _0x1332f8={};_0x1332f8[_0x434134]={'$like':'%'+_0x53ea43[_0x9192('0x47')][_0x9192('0x53')]+'%'};return _0x1332f8;})});}_0x131392=_['merge']({},_0x131392,_0x53ea43['options']);return db[_0x9192('0x6b')][_0x9192('0x32')]({'where':_0x131392[_0x9192('0x51')]})[_0x9192('0x25')](function(_0x3d0582){_0x4d69a4['count']=_0x3d0582;if(_0x53ea43[_0x9192('0x47')][_0x9192('0x57')]){_0x131392[_0x9192('0x5d')]=[{'all':!![]}];}return db[_0x9192('0x6b')][_0x9192('0x58')](_0x131392);})[_0x9192('0x25')](function(_0x5efbe3){_0x4d69a4[_0x9192('0x59')]=_0x5efbe3;return _0x4d69a4;});}})[_0x9192('0x25')](respondWithFilteredResult(_0x5dc821,_0x131392))['catch'](handleError(_0x5dc821,null));};exports[_0x9192('0x6e')]=function(_0x17040d,_0xec34ba,_0x2973cf){return db[_0x9192('0x41')][_0x9192('0x5e')]({'where':{'id':_0x17040d[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0xec34ba,null))['then'](function(_0x435e56){if(_0x435e56){return _0x435e56[_0x9192('0x6e')](_0x17040d[_0x9192('0x47')]['ids']);}})[_0x9192('0x25')](respondWithStatusCode(_0xec34ba,null))[_0x9192('0x5f')](handleError(_0xec34ba,null));};exports[_0x9192('0x6f')]=function(_0x390e13,_0x51a363,_0x807641){if(_0x390e13[_0x9192('0x61')]['id']){delete _0x390e13['body']['id'];}return db[_0x9192('0x41')][_0x9192('0x5e')]({'where':{'id':_0x390e13[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x51a363,null))[_0x9192('0x25')](function(_0x395ac3){if(_0x395ac3){_0x390e13[_0x9192('0x61')]['FaxAccountId']=_0x395ac3['id'];return db[_0x9192('0x70')]['create'](_0x390e13[_0x9192('0x61')]);}})[_0x9192('0x25')](respondWithResult(_0x51a363,null))[_0x9192('0x5f')](handleError(_0x51a363,null));};exports[_0x9192('0x71')]=function(_0x3dc01e,_0x890bf4,_0xc43795){var _0x57585f={'raw':![],'where':{}};var _0x4e178b={};var _0x28e92f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9192('0x72')]({'where':{'id':_0x3dc01e[_0x9192('0x5b')]['id']}})['then'](handleEntityNotFound(_0x890bf4,null))[_0x9192('0x25')](function(_0x113d3a){if(_0x113d3a){_0x4e178b[_0x9192('0x45')]=_[_0x9192('0x48')](db[_0x9192('0x70')][_0x9192('0x42')]);_0x4e178b[_0x9192('0x47')]=_[_0x9192('0x48')](_0x3dc01e['query']);_0x4e178b[_0x9192('0x49')]=_[_0x9192('0x4a')](_0x4e178b[_0x9192('0x45')],_0x4e178b[_0x9192('0x47')]);_0x57585f[_0x9192('0x4b')]=_['intersection'](_0x4e178b[_0x9192('0x45')],qs[_0x9192('0x4c')](_0x3dc01e[_0x9192('0x47')][_0x9192('0x4c')]));_0x57585f[_0x9192('0x4b')]=_0x57585f[_0x9192('0x4b')][_0x9192('0x4d')]?_0x57585f['attributes']:_0x4e178b['model'];if(!_0x3dc01e[_0x9192('0x47')]['hasOwnProperty']('nolimit')){_0x57585f['limit']=qs['limit'](_0x3dc01e['query']['limit']);_0x57585f['offset']=qs[_0x9192('0x33')](_0x3dc01e[_0x9192('0x47')]['offset']);}_0x57585f[_0x9192('0x6d')]=qs['sort'](_0x3dc01e[_0x9192('0x47')][_0x9192('0x50')]);_0x57585f['where']=qs['filters'](_[_0x9192('0x52')](_0x3dc01e[_0x9192('0x47')],_0x4e178b[_0x9192('0x49')]));_0x57585f['where'][_0x9192('0x6a')]=_0x113d3a['id'];if(_0x3dc01e[_0x9192('0x47')]['filter']){_0x57585f['where']=_[_0x9192('0x54')](_0x57585f[_0x9192('0x51')],{'$or':_['map'](_0x57585f['attributes'],function(_0x852ac7){var _0x2d1943={};_0x2d1943[_0x852ac7]={'$like':'%'+_0x3dc01e['query'][_0x9192('0x53')]+'%'};return _0x2d1943;})});}_0x57585f=_[_0x9192('0x54')]({},_0x57585f,_0x3dc01e[_0x9192('0x56')]);return db[_0x9192('0x70')]['count']({'where':_0x57585f['where']})[_0x9192('0x25')](function(_0x4e7153){_0x28e92f[_0x9192('0x32')]=_0x4e7153;if(_0x3dc01e[_0x9192('0x47')][_0x9192('0x57')]){_0x57585f[_0x9192('0x5d')]=[{'all':!![]}];}return db[_0x9192('0x70')][_0x9192('0x58')](_0x57585f);})[_0x9192('0x25')](function(_0x30cd56){_0x28e92f[_0x9192('0x59')]=_0x30cd56;return _0x28e92f;});}})[_0x9192('0x25')](respondWithFilteredResult(_0x890bf4,_0x57585f))[_0x9192('0x5f')](handleError(_0x890bf4,null));};exports[_0x9192('0x73')]=function(_0x1b8cad,_0x594417,_0x5afb9c){return db[_0x9192('0x41')][_0x9192('0x5e')]({'where':{'id':_0x1b8cad[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x594417,null))[_0x9192('0x25')](function(_0x3dcf3a){if(_0x3dcf3a){return _0x3dcf3a[_0x9192('0x73')](_0x1b8cad['query'][_0x9192('0x74')]);}})[_0x9192('0x25')](respondWithStatusCode(_0x594417,null))['catch'](handleError(_0x594417,null));};exports[_0x9192('0x75')]=function(_0x3d8d29,_0x541c20,_0x5de12a){return db[_0x9192('0x76')]['find']({'where':{'id':_0x3d8d29['params']['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x541c20,null))[_0x9192('0x25')](function(_0x261b77){if(_0x261b77){return _0x261b77['addInteraction'](_0x3d8d29[_0x9192('0x61')][_0x9192('0x74')],_['omit'](_0x3d8d29[_0x9192('0x61')],['ids','id'])||{});}})[_0x9192('0x25')](respondWithResult(_0x541c20,null))[_0x9192('0x5f')](handleError(_0x541c20,null));};exports[_0x9192('0x77')]=function(_0x552b43,_0x37596e,_0x4947d3){var _0x38f040={'raw':![],'where':{}};var _0x126be0={};var _0x344f5c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9192('0x72')]({'where':{'id':_0x552b43['params']['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x37596e,null))[_0x9192('0x25')](function(_0x2f7183){if(_0x2f7183){_0x126be0[_0x9192('0x45')]=_[_0x9192('0x48')](db[_0x9192('0x76')][_0x9192('0x42')]);_0x126be0['query']=_[_0x9192('0x48')](_0x552b43['query']);_0x126be0['filters']=_[_0x9192('0x4a')](_0x126be0['model'],_0x126be0[_0x9192('0x47')]);_0x38f040[_0x9192('0x4b')]=_[_0x9192('0x4a')](_0x126be0[_0x9192('0x45')],qs['fields'](_0x552b43[_0x9192('0x47')][_0x9192('0x4c')]));_0x38f040[_0x9192('0x4b')]=_0x38f040[_0x9192('0x4b')]['length']?_0x38f040[_0x9192('0x4b')]:_0x126be0['model'];if(!_0x552b43[_0x9192('0x47')][_0x9192('0x4e')](_0x9192('0x4f'))){_0x38f040[_0x9192('0x34')]=qs[_0x9192('0x34')](_0x552b43[_0x9192('0x47')][_0x9192('0x34')]);_0x38f040[_0x9192('0x33')]=qs[_0x9192('0x33')](_0x552b43[_0x9192('0x47')][_0x9192('0x33')]);}_0x38f040['order']=qs[_0x9192('0x50')](_0x552b43['query'][_0x9192('0x50')]);_0x38f040[_0x9192('0x51')]=qs[_0x9192('0x49')](_['pick'](_0x552b43[_0x9192('0x47')],_0x126be0['filters']));_0x38f040[_0x9192('0x51')]['FaxAccountId']=_0x2f7183['id'];if(_0x552b43[_0x9192('0x47')][_0x9192('0x53')]){_0x38f040[_0x9192('0x51')]=_[_0x9192('0x54')](_0x38f040[_0x9192('0x51')],{'$or':_[_0x9192('0x46')](_0x38f040[_0x9192('0x4b')],function(_0x48b20e){var _0x76954b={};_0x76954b[_0x48b20e]={'$like':'%'+_0x552b43['query'][_0x9192('0x53')]+'%'};return _0x76954b;})});}_0x38f040=_[_0x9192('0x54')]({},_0x38f040,_0x552b43[_0x9192('0x56')]);return db[_0x9192('0x76')][_0x9192('0x32')]({'where':_0x38f040[_0x9192('0x51')]})[_0x9192('0x25')](function(_0x11837f){_0x344f5c[_0x9192('0x32')]=_0x11837f;if(_0x552b43[_0x9192('0x47')][_0x9192('0x57')]){_0x38f040[_0x9192('0x5d')]=[{'model':db[_0x9192('0x78')],'as':_0x9192('0x79'),'required':![]},{'model':db['User'],'as':_0x9192('0x7a'),'attributes':[_0x9192('0x3e'),'fullname',_0x9192('0x7b')],'required':![]},{'model':db[_0x9192('0x7c')],'as':'Tags','attributes':['id',_0x9192('0x3e'),_0x9192('0x7d')],'where':_0x552b43[_0x9192('0x47')][_0x9192('0x7e')]?{'id':_0x552b43['query'][_0x9192('0x7e')]}:undefined,'required':_0x552b43['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0x9192('0x58')](_0x38f040);})[_0x9192('0x25')](function(_0x4a6e33){_0x344f5c['rows']=_0x4a6e33;return _0x344f5c;});}})[_0x9192('0x25')](respondWithFilteredResult(_0x37596e,_0x38f040))[_0x9192('0x5f')](handleError(_0x37596e,null));};exports[_0x9192('0x7f')]=function(_0x196321,_0x3fcff2,_0x3ab0c6){return db[_0x9192('0x41')]['findOne']({'where':{'id':_0x196321['params']['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x3fcff2,null))['then'](function(_0x5985db){if(_0x5985db){return db[_0x9192('0x80')][_0x9192('0x81')](function(_0x1d6f71){return db[_0x9192('0x82')][_0x9192('0x3a')]({'where':{'FaxAccountId':_0x196321[_0x9192('0x5b')]['id']},'transaction':_0x1d6f71})[_0x9192('0x25')](function(_0x5424ec){var _0x5c6ba8=_[_0x9192('0x46')](_0x196321[_0x9192('0x61')],function(_0x2553e6){_0x2553e6[_0x9192('0x6a')]=_0x196321[_0x9192('0x5b')]['id'];return _0x2553e6;});return db[_0x9192('0x82')]['bulkCreate'](_0x5c6ba8,{'transaction':_0x1d6f71});});})[_0x9192('0x25')](function(){return db[_0x9192('0x82')][_0x9192('0x83')]({'where':{'FaxAccountId':_0x196321[_0x9192('0x5b')]['id']},'order':_0x9192('0x84')});});}})[_0x9192('0x25')](respondWithResult(_0x3fcff2,null))['catch'](handleError(_0x3fcff2,null));};exports['getApplications']=function(_0x47efad,_0x34905d,_0x4675f1){var _0xb3b633={};var _0x1b9ab6={};var _0xce2046;var _0x1973fa;return db[_0x9192('0x41')][_0x9192('0x72')]({'where':{'id':_0x47efad[_0x9192('0x5b')]['id']}})['then'](handleEntityNotFound(_0x34905d,null))['then'](function(_0x4241f7){if(_0x4241f7){_0xce2046=_0x4241f7;_0x1b9ab6[_0x9192('0x45')]=_['keys'](db['FaxApplication'][_0x9192('0x42')]);_0x1b9ab6['query']=_['keys'](_0x47efad['query']);_0x1b9ab6[_0x9192('0x49')]=_[_0x9192('0x4a')](_0x1b9ab6[_0x9192('0x45')],_0x1b9ab6['query']);_0xb3b633[_0x9192('0x4b')]=_['intersection'](_0x1b9ab6[_0x9192('0x45')],qs[_0x9192('0x4c')](_0x47efad[_0x9192('0x47')][_0x9192('0x4c')]));_0xb3b633[_0x9192('0x4b')]=_0xb3b633[_0x9192('0x4b')][_0x9192('0x4d')]?_0xb3b633[_0x9192('0x4b')]:_0x1b9ab6[_0x9192('0x45')];_0xb3b633[_0x9192('0x6d')]=qs[_0x9192('0x50')](_0x47efad['query'][_0x9192('0x50')]);_0xb3b633['where']=qs[_0x9192('0x49')](_[_0x9192('0x52')](_0x47efad['query'],_0x1b9ab6[_0x9192('0x49')]));if(_0x47efad['query']['filter']){_0xb3b633['where']=_[_0x9192('0x54')](_0xb3b633[_0x9192('0x51')],{'$or':_[_0x9192('0x46')](_0xb3b633[_0x9192('0x4b')],function(_0x3c0890){var _0x4ff19d={};_0x4ff19d[_0x3c0890]={'$like':'%'+_0x47efad['query']['filter']+'%'};return _0x4ff19d;})});}_0xb3b633=_[_0x9192('0x54')]({},_0xb3b633,_0x47efad[_0x9192('0x56')]);return _0xce2046[_0x9192('0x85')](_0xb3b633);}})[_0x9192('0x25')](function(_0x34d89f){if(_0x34d89f){_0x1973fa=_0x34d89f['length'];if(!_0x47efad[_0x9192('0x47')][_0x9192('0x4e')]('nolimit')){_0xb3b633[_0x9192('0x34')]=qs[_0x9192('0x34')](_0x47efad['query']['limit']);_0xb3b633[_0x9192('0x33')]=qs[_0x9192('0x33')](_0x47efad['query'][_0x9192('0x33')]);}return _0xce2046[_0x9192('0x85')](_0xb3b633);}})[_0x9192('0x25')](function(_0x162933){if(_0x162933){return _0x162933?{'count':_0x1973fa,'rows':_0x162933}:null;}})[_0x9192('0x25')](respondWithResult(_0x34905d,null))[_0x9192('0x5f')](handleError(_0x34905d,null));};function Extension(_0x10bfac,_0xbc5285,_0x3c3f51,_0xf08d4d){this[_0x9192('0x86')]=_0x9192('0x87');this['exten']=_0x10bfac[_0x9192('0x88')];this[_0x9192('0x89')]=_0xf08d4d;this[_0x9192('0x43')]=_0x9192('0x8a');this[_0x9192('0x8b')]=_0x9192('0x8c');this[_0x9192('0x6a')]=_0x10bfac['id'];this['priority']=_0xbc5285;this['appdata']=_0x3c3f51;}function createExtensionsReciveFax(_0x5f5511){var _0x15c0f1=0x1;var _0x2c6bff=[];_0x2c6bff[_0x9192('0x8d')](new Extension(_0x5f5511,_0x15c0f1,'',_0x9192('0x8e')));_0x15c0f1+=0x1;_0x2c6bff[_0x9192('0x8d')](new Extension(_0x5f5511,_0x15c0f1,'CDR(type)=inbound-fax','Set'));_0x15c0f1+=0x1;for(var _0x1fb74e in _0x5f5511){if(_0x5f5511['hasOwnProperty'](_0x1fb74e)&&(_0x1fb74e===_0x9192('0x8f')||_0x1fb74e===_0x9192('0x88')||_0x1fb74e===_0x9192('0x90')||_0x1fb74e==='faxdetect'||_0x1fb74e===_0x9192('0x91')||_0x1fb74e===_0x9192('0x92')||_0x1fb74e===_0x9192('0x93')||_0x1fb74e===_0x9192('0x94')||_0x1fb74e===_0x9192('0x95'))){_0x2c6bff[_0x9192('0x8d')](new Extension(_0x5f5511,_0x15c0f1,_0x9192('0x96')+_0x1fb74e+')='+_0x5f5511[_0x1fb74e],_0x9192('0x97')));_0x15c0f1+=0x1;}}_0x2c6bff[_0x9192('0x8d')](new Extension(_0x5f5511,_0x15c0f1,'6',_0x9192('0x98')));_0x15c0f1+=0x1;_0x2c6bff[_0x9192('0x8d')](new Extension(_0x5f5511,_0x15c0f1,_0x9192('0x99'),'ReceiveFax'));_0x15c0f1=0x0;return _0x2c6bff;}exports['addAccountApplications']=function(_0x126830,_0x593883,_0x18b91e){var _0x1d06dd;return db[_0x9192('0x80')][_0x9192('0x81')](function(_0x2ffa86){return db['FaxAccount'][_0x9192('0x60')](_0x126830[_0x9192('0x61')],{'transaction':_0x2ffa86})[_0x9192('0x25')](function(_0x43dcd3){_0x1d06dd=_0x43dcd3[_0x9192('0x9a')]({'plain':!![]});return db[_0x9192('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x1d06dd),{'transaction':_0x2ffa86});});})[_0x9192('0x25')](function(){return _0x1d06dd;})[_0x9192('0x25')](respondWithResult(_0x593883,null))['catch'](handleError(_0x593883,null));};exports['updateAccountApplications']=function(_0x56c0c4,_0x513c3a,_0x3161ba){var _0x2ed19f;return db[_0x9192('0x80')]['transaction'](function(_0xa02329){return db[_0x9192('0x41')]['update'](_0x56c0c4[_0x9192('0x61')],{'where':{'id':_0x56c0c4[_0x9192('0x61')]['id']},'transaction':_0xa02329})[_0x9192('0x25')](function(_0x591141){return db[_0x9192('0x9b')][_0x9192('0x3a')]({'where':{'FaxAccountId':_0x56c0c4[_0x9192('0x61')]['id']},'transaction':_0xa02329})[_0x9192('0x25')](function(_0xf25d34){return db[_0x9192('0x9b')][_0x9192('0x9c')](createExtensionsReciveFax(_[_0x9192('0x9d')](_0x56c0c4[_0x9192('0x61')],[_0x9192('0x9e'),'key',_0x9192('0x9f'),'updatedAt',_0x9192('0xa0'),_0x9192('0xa1')])),{'transaction':_0xa02329});});});})[_0x9192('0x25')](function(){return db[_0x9192('0x41')]['findById'](_0x56c0c4[_0x9192('0x61')]['id']);})[_0x9192('0x25')](respondWithResult(_0x513c3a,null))[_0x9192('0x5f')](handleError(_0x513c3a,null));};exports['getMessages']=function(_0x4fb654,_0x207f11,_0x103b8d){var _0x427941={'raw':!![],'where':{}};var _0x360445={};var _0x5e5961={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4fb654[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x207f11,null))[_0x9192('0x25')](function(_0x3760ff){if(_0x3760ff){_0x360445[_0x9192('0x45')]=_['keys'](db[_0x9192('0xa2')]['rawAttributes']);_0x360445[_0x9192('0x47')]=_[_0x9192('0x48')](_0x4fb654[_0x9192('0x47')]);_0x360445[_0x9192('0x49')]=_[_0x9192('0x4a')](_0x360445[_0x9192('0x45')],_0x360445['query']);_0x427941[_0x9192('0x4b')]=_[_0x9192('0x4a')](_0x360445[_0x9192('0x45')],qs[_0x9192('0x4c')](_0x4fb654[_0x9192('0x47')]['fields']));_0x427941[_0x9192('0x4b')]=_0x427941[_0x9192('0x4b')][_0x9192('0x4d')]?_0x427941[_0x9192('0x4b')]:_0x360445[_0x9192('0x45')];if(!_0x4fb654[_0x9192('0x47')]['hasOwnProperty'](_0x9192('0x4f'))){_0x427941[_0x9192('0x34')]=qs[_0x9192('0x34')](_0x4fb654['query']['limit']);_0x427941['offset']=qs[_0x9192('0x33')](_0x4fb654['query'][_0x9192('0x33')]);}_0x427941[_0x9192('0x6d')]=qs['sort'](_0x4fb654['query']['sort']);_0x427941[_0x9192('0x51')]=qs[_0x9192('0x49')](_[_0x9192('0x52')](_0x4fb654['query'],_0x360445[_0x9192('0x49')]));_0x427941[_0x9192('0x51')][_0x9192('0x6a')]=_0x3760ff['id'];if(_0x4fb654[_0x9192('0x47')][_0x9192('0x53')]){_0x427941[_0x9192('0x51')]=_[_0x9192('0x54')](_0x427941[_0x9192('0x51')],{'$or':_[_0x9192('0x46')](_0x427941[_0x9192('0x4b')],function(_0x5c4ca4){var _0x7d3ad2={};_0x7d3ad2[_0x5c4ca4]={'$like':'%'+_0x4fb654['query'][_0x9192('0x53')]+'%'};return _0x7d3ad2;})});}if(_0x4fb654['query'][_0x9192('0xa3')]){var _0x49f257=_0x4fb654[_0x9192('0x47')][_0x9192('0xa3')][_0x9192('0xa4')](',');var _0x297032={};_0x297032[_0x49f257[0x0]]={'$gte':moment(_0x49f257[0x1])[_0x9192('0xa5')](_0x9192('0xa6'))};_0x427941[_0x9192('0x51')]=_['merge'](_0x427941[_0x9192('0x51')],_0x297032);}_0x427941=_['merge']({},_0x427941,_0x4fb654[_0x9192('0x56')]);return db[_0x9192('0xa2')][_0x9192('0x32')]({'where':_0x427941[_0x9192('0x51')]})[_0x9192('0x25')](function(_0x1991fb){_0x5e5961[_0x9192('0x32')]=_0x1991fb;if(_0x4fb654['query'][_0x9192('0x57')]){_0x427941[_0x9192('0x5d')]=[{'all':!![]}];}return db[_0x9192('0xa2')][_0x9192('0x58')](_0x427941);})['then'](function(_0x461823){_0x5e5961[_0x9192('0x59')]=_0x461823;return _0x5e5961;});}})['then'](respondWithFilteredResult(_0x207f11,_0x427941))[_0x9192('0x5f')](handleError(_0x207f11,null));};exports[_0x9192('0xa7')]=function(_0x3bd3a9,_0x1048b0,_0x456603){var _0x2094b9,_0x4ff2fd={},_0x428f18;if(_0x3bd3a9[_0x9192('0x61')]['to']){_0x428f18=_0x3bd3a9[_0x9192('0x61')]['to'][0x0];}return db['FaxAccount'][_0x9192('0x5e')]({'where':{'id':_0x3bd3a9[_0x9192('0x5b')]['id']},'include':[{'model':db[_0x9192('0xa8')],'as':_0x9192('0xa9'),'include':[{'model':db['CmContact'],'as':_0x9192('0xaa'),'where':{'fax':_0x428f18},'limit':0x1,'order':[['updatedAt',_0x9192('0xab')]]}]}]})[_0x9192('0x25')](handleEntityNotFound(_0x1048b0,null))[_0x9192('0x25')](function(_0x53e3af){_0x2094b9=_0x53e3af;if(_0x3bd3a9['body']['attachments']&&_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')]['length']){for(var _0x57d510=0x0;_0x57d510<_0x3bd3a9[_0x9192('0x61')]['attachments']['length'];_0x57d510+=0x1){_0x3bd3a9['body'][_0x9192('0xac')][_0x57d510]={'filename':_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')][_0x57d510][_0x9192('0x3e')],'id':_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')][_0x57d510]['id'],'path':path[_0x9192('0xad')](config[_0x9192('0xae')],'server/files/attachments',_0x3bd3a9[_0x9192('0x61')]['attachments'][_0x57d510][_0x9192('0xaf')])};}}return respondWithRpcPromise(_0x9192('0xb0'),_0x9192('0xb0'),{'FaxAccountId':_[_0x9192('0xb1')](_0x3bd3a9[_0x9192('0x5b')]['id'])?undefined:_0x3bd3a9[_0x9192('0x5b')]['id'],'path':_[_0x9192('0xb1')](_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')][0x0][_0x9192('0x8')])?undefined:_0x3bd3a9[_0x9192('0x61')]['attachments'][0x0][_0x9192('0x8')],'fax':_['isNil'](_0x3bd3a9[_0x9192('0x61')]['to'][0x0])?undefined:_0x3bd3a9[_0x9192('0x61')]['to'][0x0]},client9002);})[_0x9192('0x25')](function(){if(_0x2094b9){if(_[_0x9192('0xb1')](_0x3bd3a9[_0x9192('0x61')][_0x9192('0xb2')])){_0x3bd3a9['body'][_0x9192('0xb2')]=util[_0x9192('0xa5')](_0x9192('0xb3'),_0x2094b9['name'],_0x2094b9['fax']);}if(_0x2094b9[_0x9192('0xa9')]){if(_0x2094b9[_0x9192('0xa9')][_0x9192('0xaa')][_0x9192('0x4d')]){return _0x2094b9[_0x9192('0xa9')][_0x9192('0xaa')][0x0];}else{return db['CmContact'][_0x9192('0x60')](_[_0x9192('0x1c')](_0x3bd3a9[_0x9192('0x61')],{'firstName':_0x3bd3a9[_0x9192('0x61')]['to'][0x0],'phone':_0x3bd3a9[_0x9192('0x61')]['to'][0x0],'fax':_0x3bd3a9[_0x9192('0x61')]['to'][0x0],'ListId':_0x2094b9['ListId']}));}}else{throw new Error(_0x9192('0xb4'));}}else{throw new Error(_0x9192('0xb5'));}})[_0x9192('0x25')](function(_0x4e3d4d){if(_0x4e3d4d){return db[_0x9192('0x76')][_0x9192('0x5e')]({'where':{'ContactId':_0x4e3d4d['id'],'closed':![],'FaxAccountId':_0x2094b9['id']}})[_0x9192('0x25')](function(_0x4cf23d){if(_0x4cf23d){return[_0x4cf23d,![]];}return db['FaxInteraction'][_0x9192('0x60')]({'UserId':_0x3bd3a9['user']['id'],'ContactId':_0x4e3d4d['id'],'FaxAccountId':_0x2094b9['id'],'fax':_0x3bd3a9[_0x9192('0x61')]['to'][0x0],'firstMsgDirection':_0x9192('0xb6'),'Messages':[_[_0x9192('0x54')](_0x3bd3a9[_0x9192('0x61')],{'read':![],'body':_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')][0x0][_0x9192('0xb7')],'FaxAccountId':_0x2094b9['id'],'UserId':_0x3bd3a9[_0x9192('0x62')]['id'],'ContactId':_0x4e3d4d['id'],'AttachmentId':_0x3bd3a9[_0x9192('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x9192('0xa2')],'as':_0x9192('0xb8')}]})[_0x9192('0x25')](function(_0x33411a){return[_0x33411a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9192('0xb9')](function(_0x5b9357,_0x410e13){if(_0x410e13){return _0x5b9357;}return db['FaxMessage'][_0x9192('0x60')]({'direction':_0x9192('0xb6'),'read':![],'body':_0x3bd3a9['body'][_0x9192('0xac')][0x0][_0x9192('0xb7')],'FaxAccountId':_0x2094b9['id'],'FaxInteractionId':_0x5b9357['id'],'UserId':_0x3bd3a9[_0x9192('0x62')]['id'],'ContactId':_0x5b9357[_0x9192('0xba')],'AttachmentId':_0x3bd3a9[_0x9192('0x61')]['attachments'][0x0]['id']})[_0x9192('0x25')](function(_0x502c69){_0x5b9357[_0x9192('0xbb')][_0x9192('0xb8')]=[];_0x5b9357[_0x9192('0xbb')][_0x9192('0xb8')][_0x9192('0x8d')](_0x502c69[_0x9192('0xbb')]);return _0x5b9357;});})['then'](function(_0xea0586){respondWithRpcPromise(_0x9192('0xbc'),_0x9192('0xbc'),{'FaxAccountId':_['isNil'](_0x3bd3a9[_0x9192('0x5b')]['id'])?undefined:_0x3bd3a9[_0x9192('0x5b')]['id'],'path':_[_0x9192('0xb1')](_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')][0x0][_0x9192('0x8')])?undefined:_0x3bd3a9['body']['attachments'][0x0][_0x9192('0x8')],'fax':_[_0x9192('0xb1')](_0x3bd3a9[_0x9192('0x61')]['to'][0x0])?undefined:_0x3bd3a9['body']['to'][0x0],'AttachmentId':_0x3bd3a9[_0x9192('0x61')][_0x9192('0xac')][0x0]['id']},client9002)[_0x9192('0x25')](function(_0x18e5fe){logger[_0x9192('0x2d')]('SendFaxRpc,\x20%s',_0x18e5fe);})[_0x9192('0x5f')](function(_0x3f2b91){logger['info'](_0x9192('0xbd'),_0x3f2b91);});return _0xea0586;})[_0x9192('0x25')](respondWithResult(_0x1048b0,null))['catch'](handleError(_0x1048b0,null));};exports[_0x9192('0xbe')]=function(_0x4c7bb5,_0x27ab7a,_0x426fc5){return db['FaxAccount'][_0x9192('0x5e')]({'where':{'id':_0x4c7bb5[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x27ab7a,null))['then'](function(_0x528c60){if(_0x528c60){return _0x528c60[_0x9192('0xbe')](_0x4c7bb5[_0x9192('0x61')][_0x9192('0x74')],_[_0x9192('0x9d')](_0x4c7bb5[_0x9192('0x61')],[_0x9192('0x74'),'id'])||{})['spread'](function(_0x6f82ab){for(var _0x3371f1=0x0;_0x3371f1<_0x4c7bb5[_0x9192('0x61')]['ids']['length'];_0x3371f1+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x4c7bb5[_0x9192('0x61')][_0x9192('0x74')][_0x3371f1],'FaxAccountId':_0x4c7bb5[_0x9192('0x5b')]['id']});}return _0x6f82ab;});}})[_0x9192('0x25')](respondWithResult(_0x27ab7a,null))[_0x9192('0x5f')](handleError(_0x27ab7a,null));};exports[_0x9192('0xbf')]=function(_0x18472d,_0x4f7996,_0x5880d9){return db[_0x9192('0x41')][_0x9192('0x5e')]({'where':{'id':_0x18472d[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x4f7996,null))[_0x9192('0x25')](function(_0x505204){if(_0x505204){return _0x505204[_0x9192('0xbf')](_0x18472d[_0x9192('0x47')][_0x9192('0x74')])['then'](function(){if(_[_0x9192('0xc0')](_0x18472d[_0x9192('0x47')]['ids'])){for(var _0x1f5495=0x0;_0x1f5495<_0x18472d['query'][_0x9192('0x74')][_0x9192('0x4d')];_0x1f5495+=0x1){socket[_0x9192('0xc1')](_0x9192('0xc2'),{'UserId':Number(_0x18472d[_0x9192('0x47')][_0x9192('0x74')][_0x1f5495]),'FaxAccountId':Number(_0x18472d['params']['id'])});}}else{socket[_0x9192('0xc1')](_0x9192('0xc2'),{'UserId':Number(_0x18472d[_0x9192('0x47')]['ids']),'FaxAccountId':Number(_0x18472d['params']['id'])});}});}})[_0x9192('0x25')](respondWithStatusCode(_0x4f7996,null))[_0x9192('0x5f')](handleError(_0x4f7996,null));};exports[_0x9192('0xc3')]=function(_0x815c49,_0x2ef2c6,_0x510e5a){var _0x4cd8eb={};var _0x37871b={};var _0x2b077f;var _0x339861;return db['FaxAccount'][_0x9192('0x72')]({'where':{'id':_0x815c49[_0x9192('0x5b')]['id']}})[_0x9192('0x25')](handleEntityNotFound(_0x2ef2c6,null))[_0x9192('0x25')](function(_0x5a661d){if(_0x5a661d){_0x2b077f=_0x5a661d;_0x37871b[_0x9192('0x45')]=_['keys'](db[_0x9192('0xc4')]['rawAttributes']);_0x37871b[_0x9192('0x47')]=_['keys'](_0x815c49[_0x9192('0x47')]);_0x37871b['filters']=_[_0x9192('0x4a')](_0x37871b[_0x9192('0x45')],_0x37871b['query']);_0x4cd8eb[_0x9192('0x4b')]=_[_0x9192('0x4a')](_0x37871b[_0x9192('0x45')],qs[_0x9192('0x4c')](_0x815c49['query'][_0x9192('0x4c')]));_0x4cd8eb['attributes']=_0x4cd8eb[_0x9192('0x4b')]['length']?_0x4cd8eb['attributes']:_0x37871b[_0x9192('0x45')];_0x4cd8eb[_0x9192('0x6d')]=qs['sort'](_0x815c49['query'][_0x9192('0x50')]);_0x4cd8eb[_0x9192('0x51')]=qs['filters'](_[_0x9192('0x52')](_0x815c49[_0x9192('0x47')],_0x37871b[_0x9192('0x49')]));if(_0x815c49[_0x9192('0x47')]['filter']){_0x4cd8eb[_0x9192('0x51')]=_[_0x9192('0x54')](_0x4cd8eb[_0x9192('0x51')],{'$or':_[_0x9192('0x46')](_0x4cd8eb[_0x9192('0x4b')],function(_0x4e9406){var _0x119202={};_0x119202[_0x4e9406]={'$like':'%'+_0x815c49['query']['filter']+'%'};return _0x119202;})});}_0x4cd8eb=_[_0x9192('0x54')]({},_0x4cd8eb,_0x815c49['options']);return _0x2b077f[_0x9192('0xc3')](_0x4cd8eb);}})['then'](function(_0x3ebc20){if(_0x3ebc20){_0x339861=_0x3ebc20['length'];if(!_0x815c49[_0x9192('0x47')][_0x9192('0x4e')](_0x9192('0x4f'))){_0x4cd8eb['limit']=qs[_0x9192('0x34')](_0x815c49[_0x9192('0x47')][_0x9192('0x34')]);_0x4cd8eb['offset']=qs['offset'](_0x815c49[_0x9192('0x47')][_0x9192('0x33')]);}return _0x2b077f['getAgents'](_0x4cd8eb);}})[_0x9192('0x25')](function(_0x535149){if(_0x535149){return _0x535149?{'count':_0x339861,'rows':_0x535149}:null;}})[_0x9192('0x25')](respondWithResult(_0x2ef2c6,null))[_0x9192('0x5f')](handleError(_0x2ef2c6,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 19fe094..370c1f5 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 _0x4052=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x4a5814,_0x19ad4f){var _0x35e486=function(_0x378c56){while(--_0x378c56){_0x4a5814['push'](_0x4a5814['shift']());}};_0x35e486(++_0x19ad4f);}(_0x4052,0x155));var _0x2405=function(_0x24af33,_0x478fc6){_0x24af33=_0x24af33-0x0;var _0x17df0d=_0x4052[_0x24af33];return _0x17df0d;};'use strict';var EventEmitter=require(_0x2405('0x0'));var FaxAccount=require(_0x2405('0x1'))['db'][_0x2405('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2405('0x3')](0x0);var events={'afterCreate':_0x2405('0x4'),'afterUpdate':'update','afterDestroy':_0x2405('0x5')};function emitEvent(_0x37b44c){return function(_0x59d542,_0x4c64b5,_0x20b11a){FaxAccountEvents['emit'](_0x37b44c+':'+_0x59d542['id'],_0x59d542);FaxAccountEvents[_0x2405('0x6')](_0x37b44c,_0x59d542);_0x20b11a(null);};}for(var e in events){if(events[_0x2405('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2405('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x1190=['update','remove','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0xba36ac,_0x170493){var _0xd5c7ae=function(_0x945e48){while(--_0x945e48){_0xba36ac['push'](_0xba36ac['shift']());}};_0xd5c7ae(++_0x170493);}(_0x1190,0x79));var _0x0119=function(_0x4ee18d,_0x87408d){_0x4ee18d=_0x4ee18d-0x0;var _0x342597=_0x1190[_0x4ee18d];return _0x342597;};'use strict';var EventEmitter=require(_0x0119('0x0'));var FaxAccount=require(_0x0119('0x1'))['db'][_0x0119('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0119('0x3')](0x0);var events={'afterCreate':_0x0119('0x4'),'afterUpdate':_0x0119('0x5'),'afterDestroy':_0x0119('0x6')};function emitEvent(_0x5857c1){return function(_0x585edc,_0x30f1ee,_0x4f28f4){FaxAccountEvents['emit'](_0x5857c1+':'+_0x585edc['id'],_0x585edc);FaxAccountEvents['emit'](_0x5857c1,_0x585edc);_0x4f28f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x0119('0x7')](e,emitEvent(event));}}module[_0x0119('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 6ffa71a..02ab533 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 _0x7f70=['path','rimraf','../../config/environment','FaxAccount','fax_accounts','util','api','moment','bluebird','request-promise'];(function(_0x1ec01b,_0x5b9ade){var _0x39c013=function(_0xd740a0){while(--_0xd740a0){_0x1ec01b['push'](_0x1ec01b['shift']());}};_0x39c013(++_0x5b9ade);}(_0x7f70,0xd7));var _0x07f7=function(_0x14ede1,_0x4e04c0){_0x14ede1=_0x14ede1-0x0;var _0x4a88af=_0x7f70[_0x14ede1];return _0x4a88af;};'use strict';var _=require('lodash');var util=require(_0x07f7('0x0'));var logger=require('../../config/logger')(_0x07f7('0x1'));var moment=require(_0x07f7('0x2'));var BPromise=require(_0x07f7('0x3'));var rp=require(_0x07f7('0x4'));var fs=require('fs');var path=require(_0x07f7('0x5'));var rimraf=require(_0x07f7('0x6'));var config=require(_0x07f7('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x3a9543,_0x2c6838){return _0x3a9543['define'](_0x07f7('0x8'),attributes,{'tableName':_0x07f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0011=['bluebird','request-promise','path','rimraf','../../config/environment','fax_accounts','lodash','../../config/logger','api','moment'];(function(_0x4f9339,_0x39a501){var _0x141282=function(_0x312af5){while(--_0x312af5){_0x4f9339['push'](_0x4f9339['shift']());}};_0x141282(++_0x39a501);}(_0x0011,0x196));var _0x1001=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0011[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1001('0x0'));var util=require('util');var logger=require(_0x1001('0x1'))(_0x1001('0x2'));var moment=require(_0x1001('0x3'));var BPromise=require(_0x1001('0x4'));var rp=require(_0x1001('0x5'));var fs=require('fs');var path=require(_0x1001('0x6'));var rimraf=require(_0x1001('0x7'));var config=require(_0x1001('0x8'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x31522f,_0x534b73){return _0x31522f['define']('FaxAccount',attributes,{'tableName':_0x1001('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a308c7f..cdc8a85 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 _0x6e73=['length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetFaxAccount','findAll','options','raw','where','limit','include','map','attributes','model','debug','stringify','body','fax','CmContact','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','account','Contacts'];(function(_0x1dffa3,_0x3c967a){var _0x49e93e=function(_0x1b2c0c){while(--_0x1b2c0c){_0x1dffa3['push'](_0x1dffa3['shift']());}};_0x49e93e(++_0x3c967a);}(_0x6e73,0xdb));var _0x36e7=function(_0x4b2531,_0x1b39e3){_0x4b2531=_0x4b2531-0x0;var _0x3ec524=_0x6e73[_0x4b2531];return _0x3ec524;};'use strict';var _=require(_0x36e7('0x0'));var util=require(_0x36e7('0x1'));var moment=require(_0x36e7('0x2'));var BPromise=require(_0x36e7('0x3'));var rs=require(_0x36e7('0x4'));var fs=require('fs');var Redis=require(_0x36e7('0x5'));var db=require(_0x36e7('0x6'))['db'];var utils=require(_0x36e7('0x7'));var logger=require(_0x36e7('0x8'))(_0x36e7('0x9'));var config=require(_0x36e7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x36e7('0xb')][_0x36e7('0xc')]({'port':0x232c});config[_0x36e7('0xd')]=_['defaults'](config[_0x36e7('0xd')],{'host':_0x36e7('0xe'),'port':0x18eb});var socket=require(_0x36e7('0xf'))(new Redis(config['redis']));require(_0x36e7('0x10'))[_0x36e7('0x11')](socket);function respondWithRpcPromise(_0xfb8752,_0x375e7a,_0x51abdb){return new BPromise(function(_0x4b2a62,_0x1f76b8){return client[_0x36e7('0x12')](_0xfb8752,_0x51abdb)[_0x36e7('0x13')](function(_0x167854){logger[_0x36e7('0x14')](_0x36e7('0x15'),_0x375e7a,_0x36e7('0x16'));logger['debug'](_0x36e7('0x17'),_0x375e7a,_0x36e7('0x16'),JSON['stringify'](_0x167854));if(_0x167854['error']){if(_0x167854['error'][_0x36e7('0x18')]===0x1f4){logger[_0x36e7('0x19')]('FaxAccount,\x20%s,\x20%s',_0x375e7a,_0x167854['error'][_0x36e7('0x1a')]);return _0x1f76b8(_0x167854[_0x36e7('0x19')][_0x36e7('0x1a')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x375e7a,_0x167854[_0x36e7('0x19')][_0x36e7('0x1a')]);return _0x4b2a62(_0x167854['error'][_0x36e7('0x1a')]);}else{logger[_0x36e7('0x14')](_0x36e7('0x15'),_0x375e7a,_0x36e7('0x16'));_0x4b2a62(_0x167854[_0x36e7('0x1b')][_0x36e7('0x1a')]);}})[_0x36e7('0x1c')](function(_0x52a3aa){logger[_0x36e7('0x19')](_0x36e7('0x15'),_0x375e7a,_0x52a3aa);_0x1f76b8(_0x52a3aa);});});}exports[_0x36e7('0x1d')]=function(_0x4a49c4){var _0x28d012=this;return new Promise(function(_0x449f8,_0x797790){return db['FaxAccount'][_0x36e7('0x1e')]({'raw':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x20')]===undefined?!![]:![]:!![],'where':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x21')]||null:null,'attributes':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')]['attributes']||null:null,'limit':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x22')]||null:null,'include':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x23')]?_[_0x36e7('0x24')](_0x4a49c4[_0x36e7('0x1f')]['include'],function(_0x34a3c1){return{'model':db[_0x34a3c1['model']],'as':_0x34a3c1['as'],'attributes':_0x34a3c1[_0x36e7('0x25')],'include':_0x34a3c1[_0x36e7('0x23')]?_[_0x36e7('0x24')](_0x34a3c1['include'],function(_0x16487e){return{'model':db[_0x16487e[_0x36e7('0x26')]],'as':_0x16487e['as'],'attributes':_0x16487e[_0x36e7('0x25')],'include':_0x16487e[_0x36e7('0x23')]?_[_0x36e7('0x24')](_0x16487e[_0x36e7('0x23')],function(_0x592b8d){return{'model':db[_0x592b8d['model']],'as':_0x592b8d['as'],'attributes':_0x592b8d[_0x36e7('0x25')]};}):[]};}):[]};}):[]:[]})[_0x36e7('0x13')](function(_0x39e5cd){logger[_0x36e7('0x14')]('GetFaxAccount',_0x4a49c4);logger[_0x36e7('0x27')](_0x36e7('0x1d'),_0x4a49c4,JSON[_0x36e7('0x28')](_0x39e5cd));_0x449f8(_0x39e5cd);})[_0x36e7('0x1c')](function(_0x210e6b){logger[_0x36e7('0x19')](_0x36e7('0x1d'),_0x210e6b['message'],_0x4a49c4);_0x797790(_0x28d012[_0x36e7('0x19')](0x1f4,_0x210e6b[_0x36e7('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x969ba4,_0x412e7f,_0x4a1296){var _0x47393d=this;return new Promise(function(_0x4acc18,_0x4de2f1){var _0x5b962e={'body':_0x969ba4[_0x36e7('0x29')],'channel':_0x36e7('0x2a')};var _0x18c25b=[];var _0x11a3a1=[];var _0x52e12e={};return db[_0x36e7('0x2b')][_0x36e7('0x2c')]()['then'](function(_0x4bcc1e){if(!_0x4bcc1e){throw new db['Sequelize']['ValidationError'](_0x36e7('0x2d'));}_0x18c25b=_[_0x36e7('0x2e')](_[_0x36e7('0x2f')](_0x4bcc1e),[_0x36e7('0x30'),_0x36e7('0x31')]);_0x11a3a1=_[_0x36e7('0x2e')](_['keys'](_0x4bcc1e),['createdAt','updatedAt',_0x36e7('0x32'),_0x36e7('0x33')]);if(_0x969ba4[_0x36e7('0x29')]['id']){delete _0x969ba4[_0x36e7('0x29')]['id'];}if(_['isNil'](_0x969ba4[_0x36e7('0x29')][_0x36e7('0x34')])){throw new db[(_0x36e7('0x35'))][(_0x36e7('0x36'))](_0x36e7('0x37'));}if(_[_0x36e7('0x38')](_0x969ba4[_0x36e7('0x29')]['body'])||_0x969ba4['body'][_0x36e7('0x29')]===''){throw new db[(_0x36e7('0x35'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x36e7('0x38')](_0x969ba4[_0x36e7('0x29')][_0x36e7('0x39')])){throw new db[(_0x36e7('0x35'))][(_0x36e7('0x36'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11a3a1);}if(!_[_0x36e7('0x3a')](_0x11a3a1,_0x969ba4[_0x36e7('0x29')][_0x36e7('0x39')])){throw new db[(_0x36e7('0x35'))][(_0x36e7('0x36'))](_0x36e7('0x3b')+_0x11a3a1);}_0x52e12e[_0x969ba4[_0x36e7('0x29')][_0x36e7('0x39')]]=_0x969ba4[_0x36e7('0x29')][_0x36e7('0x34')];})[_0x36e7('0x13')](function(){return db[_0x36e7('0x3c')][_0x36e7('0x3d')]({'where':{'id':_0x969ba4['account']['id']},'include':[{'model':db[_0x36e7('0x3e')],'as':_0x36e7('0x3f'),'include':[{'model':db[_0x36e7('0x2b')],'as':'Contacts','where':_0x52e12e,'limit':0x1,'order':[[_0x36e7('0x31'),_0x36e7('0x40')]]}]},{'model':db[_0x36e7('0x41')],'as':'Applications'}]});})[_0x36e7('0x13')](function(_0x4af24a){if(_0x4af24a&&_0x4af24a['List']){var _0x607fcf=_0x4af24a[_0x36e7('0x42')]({'plain':!![]});_0x5b962e['account']=_0x607fcf;_0x5b962e[_0x36e7('0x43')]=_0x607fcf[_0x36e7('0x44')];_0x5b962e[_0x36e7('0x45')]=_0x607fcf[_0x36e7('0x3f')];_0x5b962e[_0x36e7('0x43')]=_[_0x36e7('0x46')](_0x5b962e[_0x36e7('0x43')],[_0x36e7('0x47')],[_0x36e7('0x48')]);if(_0x5b962e['account'][_0x36e7('0x44')]){delete _0x5b962e[_0x36e7('0x49')][_0x36e7('0x44')];}if(_0x5b962e[_0x36e7('0x49')]['List']&&_0x5b962e[_0x36e7('0x49')][_0x36e7('0x3f')][_0x36e7('0x4a')][_0x36e7('0x4b')]){return _0x5b962e['account']['List'][_0x36e7('0x4a')][0x0];}var _0x2dbfdd=_[_0x36e7('0x4c')](_0x969ba4['body'],{'firstName':_0x969ba4[_0x36e7('0x29')][_0x36e7('0x34')],'ListId':_0x607fcf[_0x36e7('0x33')]});_0x2dbfdd[_0x969ba4[_0x36e7('0x29')]['mapKey']]=_0x969ba4[_0x36e7('0x29')]['from'];return db[_0x36e7('0x2b')][_0x36e7('0x4d')](_0x2dbfdd,{'fields':_0x18c25b,'raw':!![]});}})['then'](function(_0x2f5010){_0x5b962e[_0x36e7('0x4e')]=_0x2f5010;if(_0x2f5010){var _0x5f35d3={'ContactId':_0x2f5010['id'],'FaxAccountId':_0x969ba4[_0x36e7('0x49')]['id'],'fax':_0x2f5010[_0x36e7('0x2a')]};return db[_0x36e7('0x4f')]['find']({'where':{'ContactId':_0x2f5010['id'],'closed':![],'FaxAccountId':_0x969ba4['account']['id']}})[_0x36e7('0x13')](function(_0x3fe7a8){if(_0x3fe7a8){return[_0x3fe7a8,![]];}return db[_0x36e7('0x4f')][_0x36e7('0x4d')](_0x5f35d3)[_0x36e7('0x13')](function(_0x2bc871){return[_0x2bc871,!![]];});});}else{throw new Error(_0x36e7('0x50'));}})['spread'](function(_0x29c7dd,_0x24fa93){var _0x32d215=_0x29c7dd['get']({'plain':!![]});if(_0x24fa93){if(_0x5b962e[_0x36e7('0x49')][_0x36e7('0x51')]){_0x5b962e['applications'][_0x36e7('0x52')]({'id':0x0,'priority':_0x5b962e[_0x36e7('0x43')][_0x36e7('0x4b')]+0x1,'app':'close','appdata':_0x36e7('0x53'),'interval':'*,*,*,*'});}_0x32d215[_0x36e7('0x54')]=!![];}else{_0x32d215[_0x36e7('0x54')]=![];}_0x5b962e[_0x36e7('0x55')]=_0x32d215;return db[_0x36e7('0x56')][_0x36e7('0x4d')]({'body':_0x969ba4[_0x36e7('0x29')]['body'],'FaxAccountId':_0x969ba4['account']['id'],'FaxInteractionId':_0x29c7dd['id'],'direction':'in','ContactId':_0x29c7dd[_0x36e7('0x57')],'AttachmentId':_0x969ba4[_0x36e7('0x29')][_0x36e7('0x58')]});})[_0x36e7('0x13')](function(_0x52a95e){_0x5b962e[_0x36e7('0x1a')]=_0x52a95e;if(_0x5b962e[_0x36e7('0x55')][_0x36e7('0x59')]){return db[_0x36e7('0x5a')][_0x36e7('0x3d')]({'attributes':['id',_0x36e7('0x5b')],'where':{'id':_0x5b962e[_0x36e7('0x55')][_0x36e7('0x59')]}})[_0x36e7('0x13')](function(_0x3f5461){if(_0x3f5461){_0x5b962e[_0x36e7('0x43')][_0x36e7('0x5c')]({'id':0x0,'priority':0x0,'app':_0x36e7('0x5d'),'appdata':_0x3f5461[_0x36e7('0x5b')]+','+(_0x5b962e[_0x36e7('0x49')][_0x36e7('0x5e')]||0xa),'interval':_0x36e7('0x5f')});}return respondWithRpcPromise(_0x36e7('0x60'),_0x36e7('0x61'),_0x5b962e);});}return respondWithRpcPromise(_0x36e7('0x60'),_0x36e7('0x61'),_0x5b962e);})[_0x36e7('0x13')](function(_0x5b4433){_0x4acc18(_0x5b4433);})[_0x36e7('0x1c')](function(_0x1d382f){_0x4de2f1(_0x47393d[_0x36e7('0x19')](0x1f4,_0x1d382f['message']));});});}; \ No newline at end of file +var _0x9e1f=['request\x20sent','debug','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','Applications','get','applications','orderBy','asc','length','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s'];(function(_0x1bc06c,_0x138581){var _0x931224=function(_0x165db7){while(--_0x165db7){_0x1bc06c['push'](_0x1bc06c['shift']());}};_0x931224(++_0x138581);}(_0x9e1f,0x9c));var _0xf9e1=function(_0x3b1393,_0xa70d84){_0x3b1393=_0x3b1393-0x0;var _0x564aa7=_0x9e1f[_0x3b1393];return _0x564aa7;};'use strict';var _=require(_0xf9e1('0x0'));var util=require(_0xf9e1('0x1'));var moment=require(_0xf9e1('0x2'));var BPromise=require(_0xf9e1('0x3'));var rs=require(_0xf9e1('0x4'));var fs=require('fs');var Redis=require(_0xf9e1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf9e1('0x6'))(_0xf9e1('0x7'));var config=require(_0xf9e1('0x8'));var jayson=require(_0xf9e1('0x9'));var client=jayson[_0xf9e1('0xa')]['http']({'port':0x232c});config[_0xf9e1('0xb')]=_[_0xf9e1('0xc')](config[_0xf9e1('0xb')],{'host':_0xf9e1('0xd'),'port':0x18eb});var socket=require(_0xf9e1('0xe'))(new Redis(config[_0xf9e1('0xb')]));require(_0xf9e1('0xf'))['register'](socket);function respondWithRpcPromise(_0x3d7b40,_0x5a0627,_0x403cd4){return new BPromise(function(_0x4d90a0,_0x5a048e){return client[_0xf9e1('0x10')](_0x3d7b40,_0x403cd4)[_0xf9e1('0x11')](function(_0x1e8141){logger[_0xf9e1('0x12')](_0xf9e1('0x13'),_0x5a0627,_0xf9e1('0x14'));logger[_0xf9e1('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5a0627,'request\x20sent',JSON[_0xf9e1('0x16')](_0x1e8141));if(_0x1e8141['error']){if(_0x1e8141[_0xf9e1('0x17')]['code']===0x1f4){logger[_0xf9e1('0x17')](_0xf9e1('0x13'),_0x5a0627,_0x1e8141[_0xf9e1('0x17')]['message']);return _0x5a048e(_0x1e8141[_0xf9e1('0x17')]['message']);}logger[_0xf9e1('0x17')](_0xf9e1('0x13'),_0x5a0627,_0x1e8141[_0xf9e1('0x17')][_0xf9e1('0x18')]);return _0x4d90a0(_0x1e8141[_0xf9e1('0x17')][_0xf9e1('0x18')]);}else{logger['info'](_0xf9e1('0x13'),_0x5a0627,_0xf9e1('0x14'));_0x4d90a0(_0x1e8141[_0xf9e1('0x19')][_0xf9e1('0x18')]);}})[_0xf9e1('0x1a')](function(_0x41a283){logger[_0xf9e1('0x17')](_0xf9e1('0x13'),_0x5a0627,_0x41a283);_0x5a048e(_0x41a283);});});}exports[_0xf9e1('0x1b')]=function(_0x2b31f6){var _0x5ea63e=this;return new Promise(function(_0x2d30d6,_0x397164){return db[_0xf9e1('0x1c')]['findAll']({'raw':_0x2b31f6['options']?_0x2b31f6[_0xf9e1('0x1d')][_0xf9e1('0x1e')]===undefined?!![]:![]:!![],'where':_0x2b31f6['options']?_0x2b31f6[_0xf9e1('0x1d')][_0xf9e1('0x1f')]||null:null,'attributes':_0x2b31f6[_0xf9e1('0x1d')]?_0x2b31f6['options'][_0xf9e1('0x20')]||null:null,'limit':_0x2b31f6[_0xf9e1('0x1d')]?_0x2b31f6[_0xf9e1('0x1d')][_0xf9e1('0x21')]||null:null,'include':_0x2b31f6['options']?_0x2b31f6['options'][_0xf9e1('0x22')]?_[_0xf9e1('0x23')](_0x2b31f6[_0xf9e1('0x1d')][_0xf9e1('0x22')],function(_0x4c8699){return{'model':db[_0x4c8699[_0xf9e1('0x24')]],'as':_0x4c8699['as'],'attributes':_0x4c8699[_0xf9e1('0x20')],'include':_0x4c8699[_0xf9e1('0x22')]?_['map'](_0x4c8699[_0xf9e1('0x22')],function(_0x1bb325){return{'model':db[_0x1bb325['model']],'as':_0x1bb325['as'],'attributes':_0x1bb325['attributes'],'include':_0x1bb325[_0xf9e1('0x22')]?_[_0xf9e1('0x23')](_0x1bb325[_0xf9e1('0x22')],function(_0x581803){return{'model':db[_0x581803[_0xf9e1('0x24')]],'as':_0x581803['as'],'attributes':_0x581803[_0xf9e1('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46fa3e){logger[_0xf9e1('0x12')](_0xf9e1('0x1b'),_0x2b31f6);logger[_0xf9e1('0x15')](_0xf9e1('0x1b'),_0x2b31f6,JSON[_0xf9e1('0x16')](_0x46fa3e));_0x2d30d6(_0x46fa3e);})[_0xf9e1('0x1a')](function(_0x13ae1f){logger[_0xf9e1('0x17')]('GetFaxAccount',_0x13ae1f[_0xf9e1('0x18')],_0x2b31f6);_0x397164(_0x5ea63e['error'](0x1f4,_0x13ae1f[_0xf9e1('0x18')]));});});};exports[_0xf9e1('0x25')]=function(_0x37c989,_0x44b380,_0x44358b){var _0x591b61=this;return new Promise(function(_0x50e721,_0x20e4c6){var _0x308d36={'body':_0x37c989[_0xf9e1('0x26')],'channel':_0xf9e1('0x27')};var _0x5804f2=[];var _0x3038ba=[];var _0x2408b7={};return db[_0xf9e1('0x28')][_0xf9e1('0x29')]()['then'](function(_0x24bb27){if(!_0x24bb27){throw new db[(_0xf9e1('0x2a'))][(_0xf9e1('0x2b'))](_0xf9e1('0x2c'));}_0x5804f2=_[_0xf9e1('0x2d')](_['keys'](_0x24bb27),[_0xf9e1('0x2e'),_0xf9e1('0x2f')]);_0x3038ba=_['difference'](_[_0xf9e1('0x30')](_0x24bb27),['createdAt','updatedAt',_0xf9e1('0x31'),_0xf9e1('0x32')]);if(_0x37c989[_0xf9e1('0x26')]['id']){delete _0x37c989[_0xf9e1('0x26')]['id'];}if(_[_0xf9e1('0x33')](_0x37c989['body'][_0xf9e1('0x34')])){throw new db[(_0xf9e1('0x2a'))][(_0xf9e1('0x2b'))](_0xf9e1('0x35'));}if(_[_0xf9e1('0x33')](_0x37c989[_0xf9e1('0x26')]['body'])||_0x37c989['body'][_0xf9e1('0x26')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x37c989['body'][_0xf9e1('0x36')])){throw new db[(_0xf9e1('0x2a'))][(_0xf9e1('0x2b'))](_0xf9e1('0x37')+_0x3038ba);}if(!_[_0xf9e1('0x38')](_0x3038ba,_0x37c989[_0xf9e1('0x26')][_0xf9e1('0x36')])){throw new db[(_0xf9e1('0x2a'))][(_0xf9e1('0x2b'))](_0xf9e1('0x39')+_0x3038ba);}_0x2408b7[_0x37c989[_0xf9e1('0x26')]['mapKey']]=_0x37c989[_0xf9e1('0x26')][_0xf9e1('0x34')];})[_0xf9e1('0x11')](function(){return db['FaxAccount'][_0xf9e1('0x3a')]({'where':{'id':_0x37c989[_0xf9e1('0x3b')]['id']},'include':[{'model':db[_0xf9e1('0x3c')],'as':_0xf9e1('0x3d'),'include':[{'model':db[_0xf9e1('0x28')],'as':_0xf9e1('0x3e'),'where':_0x2408b7,'limit':0x1,'order':[[_0xf9e1('0x2f'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xf9e1('0x3f')}]});})[_0xf9e1('0x11')](function(_0x3d168f){if(_0x3d168f&&_0x3d168f['List']){var _0x31cf15=_0x3d168f[_0xf9e1('0x40')]({'plain':!![]});_0x308d36['account']=_0x31cf15;_0x308d36[_0xf9e1('0x41')]=_0x31cf15[_0xf9e1('0x3f')];_0x308d36['list']=_0x31cf15[_0xf9e1('0x3d')];_0x308d36[_0xf9e1('0x41')]=_[_0xf9e1('0x42')](_0x308d36[_0xf9e1('0x41')],['priority'],[_0xf9e1('0x43')]);if(_0x308d36[_0xf9e1('0x3b')][_0xf9e1('0x3f')]){delete _0x308d36[_0xf9e1('0x3b')][_0xf9e1('0x3f')];}if(_0x308d36[_0xf9e1('0x3b')][_0xf9e1('0x3d')]&&_0x308d36[_0xf9e1('0x3b')][_0xf9e1('0x3d')]['Contacts'][_0xf9e1('0x44')]){return _0x308d36['account']['List'][_0xf9e1('0x3e')][0x0];}var _0x30da41=_[_0xf9e1('0xc')](_0x37c989[_0xf9e1('0x26')],{'firstName':_0x37c989['body'][_0xf9e1('0x34')],'ListId':_0x31cf15[_0xf9e1('0x32')]});_0x30da41[_0x37c989['body']['mapKey']]=_0x37c989['body'][_0xf9e1('0x34')];return db['CmContact'][_0xf9e1('0x45')](_0x30da41,{'fields':_0x5804f2,'raw':!![]});}})[_0xf9e1('0x11')](function(_0x265ee1){_0x308d36['contact']=_0x265ee1;if(_0x265ee1){var _0x2571e6={'ContactId':_0x265ee1['id'],'FaxAccountId':_0x37c989['account']['id'],'fax':_0x265ee1['fax']};return db[_0xf9e1('0x46')][_0xf9e1('0x3a')]({'where':{'ContactId':_0x265ee1['id'],'closed':![],'FaxAccountId':_0x37c989[_0xf9e1('0x3b')]['id']}})['then'](function(_0x1b86ce){if(_0x1b86ce){return[_0x1b86ce,![]];}return db[_0xf9e1('0x46')][_0xf9e1('0x45')](_0x2571e6)[_0xf9e1('0x11')](function(_0x3e5166){return[_0x3e5166,!![]];});});}else{throw new Error(_0xf9e1('0x47'));}})[_0xf9e1('0x48')](function(_0x299fec,_0x313277){var _0x2ff6bf=_0x299fec['get']({'plain':!![]});if(_0x313277){if(_0x308d36[_0xf9e1('0x3b')][_0xf9e1('0x49')]){_0x308d36[_0xf9e1('0x41')][_0xf9e1('0x4a')]({'id':0x0,'priority':_0x308d36[_0xf9e1('0x41')][_0xf9e1('0x44')]+0x1,'app':_0xf9e1('0x4b'),'appdata':_0xf9e1('0x4c'),'interval':_0xf9e1('0x4d')});}_0x2ff6bf['created']=!![];}else{_0x2ff6bf[_0xf9e1('0x4e')]=![];}_0x308d36[_0xf9e1('0x4f')]=_0x2ff6bf;return db['FaxMessage'][_0xf9e1('0x45')]({'body':_0x37c989[_0xf9e1('0x26')][_0xf9e1('0x26')],'FaxAccountId':_0x37c989[_0xf9e1('0x3b')]['id'],'FaxInteractionId':_0x299fec['id'],'direction':'in','ContactId':_0x299fec[_0xf9e1('0x50')],'AttachmentId':_0x37c989[_0xf9e1('0x26')]['AttachmentId']});})[_0xf9e1('0x11')](function(_0x4ee596){_0x308d36[_0xf9e1('0x18')]=_0x4ee596;if(_0x308d36[_0xf9e1('0x4f')][_0xf9e1('0x51')]){return db[_0xf9e1('0x52')][_0xf9e1('0x3a')]({'attributes':['id','name'],'where':{'id':_0x308d36[_0xf9e1('0x4f')]['UserId']}})[_0xf9e1('0x11')](function(_0x4e1d57){if(_0x4e1d57){_0x308d36['applications'][_0xf9e1('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e1d57[_0xf9e1('0x54')]+','+(_0x308d36[_0xf9e1('0x3b')][_0xf9e1('0x55')]||0xa),'interval':_0xf9e1('0x4d')});}return respondWithRpcPromise(_0xf9e1('0x56'),_0xf9e1('0x57'),_0x308d36);});}return respondWithRpcPromise(_0xf9e1('0x56'),_0xf9e1('0x57'),_0x308d36);})[_0xf9e1('0x11')](function(_0x38a30a){_0x50e721(_0x38a30a);})[_0xf9e1('0x1a')](function(_0xc4dfcb){_0x20e4c6(_0x591b61[_0xf9e1('0x17')](0x1f4,_0xc4dfcb[_0xf9e1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index be396f5..900c46c 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 _0xffd6=['save','remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x1d2520,_0x105606){var _0x22fd54=function(_0x2c3123){while(--_0x2c3123){_0x1d2520['push'](_0x1d2520['shift']());}};_0x22fd54(++_0x105606);}(_0xffd6,0x97));var _0x6ffd=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0xffd6[_0x3877c1];return _0x59056a;};'use strict';var FaxAccountEvents=require(_0x6ffd('0x0'));var events=[_0x6ffd('0x1'),_0x6ffd('0x2'),'update'];function createListener(_0x589640,_0x305b6b){return function(_0x400c43){_0x305b6b[_0x6ffd('0x3')](_0x589640,_0x400c43);};}function removeListener(_0x560afa,_0x1d12e3){return function(){FaxAccountEvents[_0x6ffd('0x4')](_0x560afa,_0x1d12e3);};}exports[_0x6ffd('0x5')]=function(_0x2949a4){for(var _0x561055=0x0,_0x122b71=events[_0x6ffd('0x6')];_0x561055<_0x122b71;_0x561055++){var _0x2445a0=events[_0x561055];var _0x1fbbe6=createListener(_0x6ffd('0x7')+_0x2445a0,_0x2949a4);FaxAccountEvents['on'](_0x2445a0,_0x1fbbe6);}}; \ No newline at end of file +var _0xba34=['faxAccount:','./faxAccount.events','save','remove','update','removeListener','register'];(function(_0x9db750,_0xd34745){var _0x156866=function(_0xbd2151){while(--_0xbd2151){_0x9db750['push'](_0x9db750['shift']());}};_0x156866(++_0xd34745);}(_0xba34,0x119));var _0x4ba3=function(_0x104b59,_0x37d3c3){_0x104b59=_0x104b59-0x0;var _0x2cd5ff=_0xba34[_0x104b59];return _0x2cd5ff;};'use strict';var FaxAccountEvents=require(_0x4ba3('0x0'));var events=[_0x4ba3('0x1'),_0x4ba3('0x2'),_0x4ba3('0x3')];function createListener(_0xeb0ac4,_0x4d6e75){return function(_0x5aa88e){_0x4d6e75['emit'](_0xeb0ac4,_0x5aa88e);};}function removeListener(_0x4592fc,_0x2947f2){return function(){FaxAccountEvents[_0x4ba3('0x4')](_0x4592fc,_0x2947f2);};}exports[_0x4ba3('0x5')]=function(_0x3590a1){for(var _0xb88621=0x0,_0xe5f99a=events['length'];_0xb88621<_0xe5f99a;_0xb88621++){var _0x6254fb=events[_0xb88621];var _0x368eee=createListener(_0x4ba3('0x6')+_0x6254fb,_0x3590a1);FaxAccountEvents['on'](_0x6254fb,_0x368eee);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b621224..17ce410 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 _0x9d24=['addDisposition','/:id/interactions','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x9d24,0xb5));var _0x49d2=function(_0x3e91fb,_0x5945bc){_0x3e91fb=_0x3e91fb-0x0;var _0x4cbafc=_0x9d24[_0x3e91fb];return _0x4cbafc;};'use strict';var multer=require(_0x49d2('0x0'));var util=require(_0x49d2('0x1'));var path=require('path');var timeout=require(_0x49d2('0x2'));var express=require(_0x49d2('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x49d2('0x4'));var config=require(_0x49d2('0x5'));var controller=require(_0x49d2('0x6'));router['get']('/',auth[_0x49d2('0x7')](),controller['index']);router[_0x49d2('0x8')](_0x49d2('0x9'),auth[_0x49d2('0x7')](),controller[_0x49d2('0xa')]);router['get'](_0x49d2('0xb'),auth[_0x49d2('0x7')](),controller[_0x49d2('0xc')]);router[_0x49d2('0x8')](_0x49d2('0xd'),auth[_0x49d2('0x7')](),controller[_0x49d2('0xe')]);router['get'](_0x49d2('0xf'),auth['isAuthenticated'](),controller[_0x49d2('0x10')]);router[_0x49d2('0x8')]('/:id/interactions',auth[_0x49d2('0x7')](),controller[_0x49d2('0x11')]);router['get'](_0x49d2('0x12'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x13')]);router[_0x49d2('0x8')](_0x49d2('0x14'),auth[_0x49d2('0x7')](),controller['getMessages']);router[_0x49d2('0x8')](_0x49d2('0x15'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x16')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x49d2('0x17')](_0x49d2('0xd'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x18')]);router[_0x49d2('0x17')](_0x49d2('0xf'),auth[_0x49d2('0x7')](),controller['addAnswer']);router[_0x49d2('0x17')](_0x49d2('0x19'),auth['isAuthenticated'](),controller[_0x49d2('0x1a')]);router[_0x49d2('0x17')](_0x49d2('0x12'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x1b')]);router[_0x49d2('0x17')]('/addaccountapplications',auth[_0x49d2('0x7')](),controller[_0x49d2('0x1c')]);router[_0x49d2('0x17')](_0x49d2('0x1d'),auth['isAuthenticated'](),controller[_0x49d2('0x1e')]);router[_0x49d2('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0x49d2('0x1f')]);router[_0x49d2('0x17')](_0x49d2('0x15'),auth['isAuthenticated'](),controller[_0x49d2('0x20')]);router[_0x49d2('0x21')]('/:id',auth[_0x49d2('0x7')](),controller[_0x49d2('0x22')]);router[_0x49d2('0x23')](_0x49d2('0xb'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x24')]);router[_0x49d2('0x23')](_0x49d2('0xd'),auth['isAuthenticated'](),controller[_0x49d2('0x25')]);router[_0x49d2('0x23')](_0x49d2('0xf'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x26')]);router[_0x49d2('0x23')](_0x49d2('0x15'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x27')]);module[_0x49d2('0x28')]=router; \ No newline at end of file +var _0xb4b2=['create','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','put','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xb4b2,0x139));var _0x2b4b=function(_0x57eb38,_0x7772d6){_0x57eb38=_0x57eb38-0x0;var _0x999897=_0xb4b2[_0x57eb38];return _0x999897;};'use strict';var multer=require(_0x2b4b('0x0'));var util=require('util');var path=require(_0x2b4b('0x1'));var timeout=require(_0x2b4b('0x2'));var express=require(_0x2b4b('0x3'));var router=express['Router']();var auth=require(_0x2b4b('0x4'));var interaction=require(_0x2b4b('0x5'));var config=require(_0x2b4b('0x6'));var controller=require('./faxAccount.controller');router[_0x2b4b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b4b('0x7')]('/describe',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x9')]);router[_0x2b4b('0x7')](_0x2b4b('0xa'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0xb')]);router['get'](_0x2b4b('0xc'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0xd')]);router[_0x2b4b('0x7')]('/:id/canned_answers',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0xe')]);router['get'](_0x2b4b('0xf'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x10')]);router[_0x2b4b('0x7')](_0x2b4b('0x11'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x12')]);router[_0x2b4b('0x7')](_0x2b4b('0x13'),auth['isAuthenticated'](),controller[_0x2b4b('0x14')]);router['get']('/:id/users',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x15')]);router[_0x2b4b('0x16')]('/',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x17')]);router[_0x2b4b('0x16')](_0x2b4b('0xc'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x18')]);router[_0x2b4b('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2b4b('0x19')]);router[_0x2b4b('0x16')](_0x2b4b('0xf'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x1a')]);router[_0x2b4b('0x16')]('/:id/applications',auth[_0x2b4b('0x8')](),controller['addApplications']);router[_0x2b4b('0x16')](_0x2b4b('0x1b'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x1c')]);router['post'](_0x2b4b('0x1d'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x1e')]);router['post'](_0x2b4b('0x1f'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x20')]);router[_0x2b4b('0x16')](_0x2b4b('0x21'),auth['isAuthenticated'](),controller['addAgents']);router[_0x2b4b('0x22')]('/:id',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x23')]);router[_0x2b4b('0x24')]('/:id',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x25')]);router[_0x2b4b('0x24')](_0x2b4b('0xc'),auth[_0x2b4b('0x8')](),controller['removeDispositions']);router['delete'](_0x2b4b('0x26'),auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x27')]);router[_0x2b4b('0x24')]('/:id/users',auth[_0x2b4b('0x8')](),controller[_0x2b4b('0x28')]);module[_0x2b4b('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index abfd7e7..c82745b 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 _0x9e38=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1b6feb,_0x3f2115){var _0x25b42b=function(_0x37427a){while(--_0x37427a){_0x1b6feb['push'](_0x1b6feb['shift']());}};_0x25b42b(++_0x3f2115);}(_0x9e38,0x155));var _0x89e3=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x9e38[_0x5d23be];return _0x4d60a9;};'use strict';var Sequelize=require(_0x89e3('0x0'));module[_0x89e3('0x1')]={'priority':{'type':Sequelize[_0x89e3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x89e3('0x3')],'allowNull':![],'defaultValue':_0x89e3('0x4')},'appdata':{'type':Sequelize[_0x89e3('0x5')]()},'description':{'type':Sequelize[_0x89e3('0x3')]},'interval':{'type':Sequelize[_0x89e3('0x3')],'defaultValue':_0x89e3('0x6')}}; \ No newline at end of file +var _0x4ccb=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4d263e,_0x505e54){var _0x37d11a=function(_0x129341){while(--_0x129341){_0x4d263e['push'](_0x4d263e['shift']());}};_0x37d11a(++_0x505e54);}(_0x4ccb,0x196));var _0xb4cc=function(_0x351349,_0x48b658){_0x351349=_0x351349-0x0;var _0x4f6603=_0x4ccb[_0x351349];return _0x4f6603;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'priority':{'type':Sequelize[_0xb4cc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb4cc('0x3')},'appdata':{'type':Sequelize[_0xb4cc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb4cc('0x5')],'defaultValue':_0xb4cc('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e324b24..6d01587 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x54ec37,_0x4c2b1c){var _0x397ebf=function(_0x7b596f){while(--_0x7b596f){_0x54ec37['push'](_0x54ec37['shift']());}};_0x397ebf(++_0x4c2b1c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3e5d29,_0x43c598){_0x3e5d29=_0x3e5d29-0x0;var _0x482c43=_0x8ef6[_0x3e5d29];return _0x482c43;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file +var _0xabce=['offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','FaxApplication','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xabce,0x103));var _0xeabc=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xabce[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['FaxApplication'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['FaxApplication'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':!![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4b6a475..a9f59d2 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 _0x1fd2=['define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes'];(function(_0x575db2,_0x1ce944){var _0x24cf93=function(_0x145122){while(--_0x145122){_0x575db2['push'](_0x575db2['shift']());}};_0x24cf93(++_0x1ce944);}(_0x1fd2,0x184));var _0x21fd=function(_0x5c3364,_0x29c6cb){_0x5c3364=_0x5c3364-0x0;var _0xef9b58=_0x1fd2[_0x5c3364];return _0xef9b58;};'use strict';var _=require('lodash');var util=require(_0x21fd('0x0'));var logger=require(_0x21fd('0x1'))('api');var moment=require(_0x21fd('0x2'));var BPromise=require(_0x21fd('0x3'));var rp=require(_0x21fd('0x4'));var fs=require('fs');var path=require(_0x21fd('0x5'));var rimraf=require('rimraf');var config=require(_0x21fd('0x6'));var attributes=require(_0x21fd('0x7'));module['exports']=function(_0x48c369,_0x421e1f){return _0x48c369[_0x21fd('0x8')](_0x21fd('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21fd('0xa'),'collate':_0x21fd('0xb')});}; \ No newline at end of file +var _0x34ca=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x1b89ea,_0x481aa2){var _0x4e713a=function(_0x798754){while(--_0x798754){_0x1b89ea['push'](_0x1b89ea['shift']());}};_0x4e713a(++_0x481aa2);}(_0x34ca,0x101));var _0xa34c=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x34ca[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xa34c('0x0'));var util=require(_0xa34c('0x1'));var logger=require(_0xa34c('0x2'))(_0xa34c('0x3'));var moment=require(_0xa34c('0x4'));var BPromise=require(_0xa34c('0x5'));var rp=require(_0xa34c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa34c('0x7'));var attributes=require('./faxApplication.attributes');module[_0xa34c('0x8')]=function(_0x3c6f16,_0x457c88){return _0x3c6f16[_0xa34c('0x9')](_0xa34c('0xa'),attributes,{'tableName':_0xa34c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa34c('0xc'),'collate':_0xa34c('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c26cf62..bf89b6c 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 _0x1e34=['FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','FaxApplication','update','body','options','raw','attributes','UpdateFaxApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x1e34,0x64));var _0x41e3=function(_0x109bf0,_0x3d5b4b){_0x109bf0=_0x109bf0-0x0;var _0x208e2a=_0x1e34[_0x109bf0];return _0x208e2a;};'use strict';var _=require(_0x41e3('0x0'));var util=require(_0x41e3('0x1'));var moment=require(_0x41e3('0x2'));var BPromise=require(_0x41e3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41e3('0x4'));var db=require(_0x41e3('0x5'))['db'];var utils=require(_0x41e3('0x6'));var logger=require(_0x41e3('0x7'))('rpc');var config=require(_0x41e3('0x8'));var jayson=require(_0x41e3('0x9'));var client=jayson[_0x41e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c900d,_0x2a21d5,_0x2f8c89){return new BPromise(function(_0x453ade,_0x2d17fa){return client['request'](_0x4c900d,_0x2f8c89)[_0x41e3('0xb')](function(_0x293e4c){logger['info'](_0x41e3('0xc'),_0x2a21d5,'request\x20sent');logger[_0x41e3('0xd')](_0x41e3('0xe'),_0x2a21d5,_0x41e3('0xf'),JSON[_0x41e3('0x10')](_0x293e4c));if(_0x293e4c['error']){if(_0x293e4c['error'][_0x41e3('0x11')]===0x1f4){logger[_0x41e3('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2a21d5,_0x293e4c[_0x41e3('0x12')][_0x41e3('0x13')]);return _0x2d17fa(_0x293e4c[_0x41e3('0x12')][_0x41e3('0x13')]);}logger['error'](_0x41e3('0xc'),_0x2a21d5,_0x293e4c[_0x41e3('0x12')]['message']);return _0x453ade(_0x293e4c[_0x41e3('0x12')]['message']);}else{logger[_0x41e3('0x14')]('FaxApplication,\x20%s,\x20%s',_0x2a21d5,_0x41e3('0xf'));_0x453ade(_0x293e4c['result']['message']);}})['catch'](function(_0x4f3aaa){logger[_0x41e3('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2a21d5,_0x4f3aaa);_0x2d17fa(_0x4f3aaa);});});}exports['UpdateFaxApplication']=function(_0x29a550){var _0x205c37=this;return new Promise(function(_0xb75a0a,_0x412424){return db[_0x41e3('0x15')][_0x41e3('0x16')](_0x29a550[_0x41e3('0x17')],{'raw':_0x29a550[_0x41e3('0x18')]?_0x29a550[_0x41e3('0x18')][_0x41e3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a550['options']?_0x29a550[_0x41e3('0x18')]['where']||null:null,'attributes':_0x29a550[_0x41e3('0x18')]?_0x29a550[_0x41e3('0x18')][_0x41e3('0x1a')]||null:null,'limit':_0x29a550[_0x41e3('0x18')]?_0x29a550[_0x41e3('0x18')]['limit']||null:null})[_0x41e3('0xb')](function(_0x3efdc1){logger[_0x41e3('0x14')](_0x41e3('0x1b'),_0x29a550);logger[_0x41e3('0xd')](_0x41e3('0x1b'),_0x29a550,JSON['stringify'](_0x3efdc1));_0xb75a0a(_0x3efdc1);})['catch'](function(_0xe6814c){logger[_0x41e3('0x12')](_0x41e3('0x1b'),_0xe6814c[_0x41e3('0x13')],_0x29a550);_0x412424(_0x205c37[_0x41e3('0x12')](0x1f4,_0xe6814c[_0x41e3('0x13')]));});});}; \ No newline at end of file +var _0xed8d=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit'];(function(_0x4c8df3,_0x3624c7){var _0x205553=function(_0xd8ec43){while(--_0xd8ec43){_0x4c8df3['push'](_0x4c8df3['shift']());}};_0x205553(++_0x3624c7);}(_0xed8d,0x14b));var _0xded8=function(_0x45fb4f,_0x2ddb9d){_0x45fb4f=_0x45fb4f-0x0;var _0x55d8d4=_0xed8d[_0x45fb4f];return _0x55d8d4;};'use strict';var _=require(_0xded8('0x0'));var util=require(_0xded8('0x1'));var moment=require(_0xded8('0x2'));var BPromise=require(_0xded8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xded8('0x4'));var db=require(_0xded8('0x5'))['db'];var utils=require(_0xded8('0x6'));var logger=require(_0xded8('0x7'))(_0xded8('0x8'));var config=require(_0xded8('0x9'));var jayson=require(_0xded8('0xa'));var client=jayson['client'][_0xded8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x332262,_0x4bafb3,_0x58f63d){return new BPromise(function(_0x12df51,_0x3cd31c){return client[_0xded8('0xc')](_0x332262,_0x58f63d)[_0xded8('0xd')](function(_0x335237){logger[_0xded8('0xe')](_0xded8('0xf'),_0x4bafb3,_0xded8('0x10'));logger[_0xded8('0x11')](_0xded8('0x12'),_0x4bafb3,_0xded8('0x10'),JSON[_0xded8('0x13')](_0x335237));if(_0x335237[_0xded8('0x14')]){if(_0x335237[_0xded8('0x14')][_0xded8('0x15')]===0x1f4){logger[_0xded8('0x14')](_0xded8('0xf'),_0x4bafb3,_0x335237[_0xded8('0x14')][_0xded8('0x16')]);return _0x3cd31c(_0x335237[_0xded8('0x14')]['message']);}logger[_0xded8('0x14')](_0xded8('0xf'),_0x4bafb3,_0x335237[_0xded8('0x14')]['message']);return _0x12df51(_0x335237[_0xded8('0x14')][_0xded8('0x16')]);}else{logger[_0xded8('0xe')](_0xded8('0xf'),_0x4bafb3,_0xded8('0x10'));_0x12df51(_0x335237[_0xded8('0x17')][_0xded8('0x16')]);}})['catch'](function(_0x1b4dc4){logger[_0xded8('0x14')](_0xded8('0xf'),_0x4bafb3,_0x1b4dc4);_0x3cd31c(_0x1b4dc4);});});}exports[_0xded8('0x18')]=function(_0x44207c){var _0x52baf6=this;return new Promise(function(_0x479b73,_0x3afb79){return db[_0xded8('0x19')][_0xded8('0x1a')](_0x44207c[_0xded8('0x1b')],{'raw':_0x44207c['options']?_0x44207c[_0xded8('0x1c')][_0xded8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44207c[_0xded8('0x1c')]?_0x44207c['options'][_0xded8('0x1e')]||null:null,'attributes':_0x44207c[_0xded8('0x1c')]?_0x44207c[_0xded8('0x1c')]['attributes']||null:null,'limit':_0x44207c[_0xded8('0x1c')]?_0x44207c[_0xded8('0x1c')][_0xded8('0x1f')]||null:null})[_0xded8('0xd')](function(_0xbc928a){logger[_0xded8('0xe')](_0xded8('0x18'),_0x44207c);logger[_0xded8('0x11')](_0xded8('0x18'),_0x44207c,JSON[_0xded8('0x13')](_0xbc928a));_0x479b73(_0xbc928a);})[_0xded8('0x20')](function(_0xcea9b2){logger[_0xded8('0x14')]('UpdateFaxApplication',_0xcea9b2['message'],_0x44207c);_0x3afb79(_0x52baf6['error'](0x1f4,_0xcea9b2[_0xded8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 167fef5..8c9d3ef 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 _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4d7043,_0x2e47af){var _0x1453ca=function(_0x3bf16f){while(--_0x3bf16f){_0x4d7043['push'](_0x4d7043['shift']());}};_0x1453ca(++_0x2e47af);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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('./faxApplication.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('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router; \ No newline at end of file +var _0xb138=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','util','path'];(function(_0x31c112,_0x30612f){var _0xd2d71=function(_0x2d42c3){while(--_0x2d42c3){_0x31c112['push'](_0x31c112['shift']());}};_0xd2d71(++_0x30612f);}(_0xb138,0x1dd));var _0x8b13=function(_0x549d57,_0x6b8598){_0x549d57=_0x549d57-0x0;var _0x330291=_0xb138[_0x549d57];return _0x330291;};'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')]('/:id',auth[_0x8b13('0xb')](),controller[_0x8b13('0xc')]);router[_0x8b13('0xd')]('/',auth['isAuthenticated'](),controller[_0x8b13('0xe')]);router[_0x8b13('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')](_0x8b13('0x12'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 036c12f..b78b913 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 _0x5f10=['out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x5f10,0x1de));var _0x05f1=function(_0x8f270,_0x2f435f){_0x8f270=_0x8f270-0x0;var _0x5446cb=_0x5f10[_0x8f270];return _0x5446cb;};'use strict';var Sequelize=require(_0x05f1('0x0'));module[_0x05f1('0x1')]={'closed':{'type':Sequelize[_0x05f1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05f1('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x05f1('0x3')]},'fax':{'type':Sequelize[_0x05f1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x05f1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x05f1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x05f1('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3d4b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x1ec24e,_0x32c563){var _0x18b742=function(_0x2cfcf1){while(--_0x2cfcf1){_0x1ec24e['push'](_0x1ec24e['shift']());}};_0x18b742(++_0x32c563);}(_0x3d4b,0x1be));var _0xb3d4=function(_0x61ed7f,_0x31fa63){_0x61ed7f=_0x61ed7f-0x0;var _0x1d3e82=_0x3d4b[_0x61ed7f];return _0x1d3e82;};'use strict';var Sequelize=require(_0xb3d4('0x0'));module[_0xb3d4('0x1')]={'closed':{'type':Sequelize[_0xb3d4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb3d4('0x3')]},'disposition':{'type':Sequelize[_0xb3d4('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xb3d4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb3d4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb3d4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb3d4('0x5')]('in',_0xb3d4('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 5ab0d27..4deebee 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 _0xd3a8=['createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','sequelize','toString','merge','a.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','rawAttributes','includeAll','options','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','Users','map','Tags','TagIds','split','catch','index','FaxInteraction','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat'];(function(_0x49aea0,_0x32b7f7){var _0x5435d9=function(_0x5af3e4){while(--_0x5af3e4){_0x49aea0['push'](_0x49aea0['shift']());}};_0x5435d9(++_0x32b7f7);}(_0xd3a8,0x135));var _0x8d3a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3a8[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x8d3a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8d3a('0x1'));var zipdir=require(_0x8d3a('0x2'));var jsonpatch=require(_0x8d3a('0x3'));var rp=require(_0x8d3a('0x4'));var moment=require('moment');var BPromise=require(_0x8d3a('0x5'));var Mustache=require(_0x8d3a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8d3a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8d3a('0x8'));var crypto=require(_0x8d3a('0x9'));var jsforce=require(_0x8d3a('0xa'));var deskjs=require(_0x8d3a('0xb'));var toCsv=require(_0x8d3a('0x7'));var querystring=require(_0x8d3a('0xc'));var Papa=require(_0x8d3a('0xd'));var Redis=require(_0x8d3a('0xe'));var authService=require(_0x8d3a('0xf'));var qs=require(_0x8d3a('0x10'));var as=require(_0x8d3a('0x11'));var hardwareService=require(_0x8d3a('0x12'));var logger=require(_0x8d3a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8d3a('0x14'))['db'];config[_0x8d3a('0x15')]=_[_0x8d3a('0x16')](config[_0x8d3a('0x15')],{'host':_0x8d3a('0x17'),'port':0x18eb});var socket=require(_0x8d3a('0x18'))(new Redis(config['redis']));require(_0x8d3a('0x19'))[_0x8d3a('0x1a')](socket);function respondWithStatusCode(_0x5c6ed1,_0x4c11b3){_0x4c11b3=_0x4c11b3||0xcc;return function(_0x2fd704){if(_0x2fd704){return _0x5c6ed1['sendStatus'](_0x4c11b3);}return _0x5c6ed1[_0x8d3a('0x1b')](_0x4c11b3)[_0x8d3a('0x1c')]();};}function respondWithResult(_0x10f582,_0x4c915d){_0x4c915d=_0x4c915d||0xc8;return function(_0x33eefb){if(_0x33eefb){return _0x10f582['status'](_0x4c915d)[_0x8d3a('0x1d')](_0x33eefb);}};}function respondWithFilteredResult(_0x5218d9,_0x3217a2){return function(_0x36cc0b){if(_0x36cc0b){var _0xb24d92=_0x36cc0b[_0x8d3a('0x1e')],_0x5cf34a=_0x3217a2[_0x8d3a('0x1f')],_0x499f25=_0x3217a2[_0x8d3a('0x1f')]+_0x3217a2[_0x8d3a('0x20')],_0x1bbbe1;if(_0x499f25>=_0xb24d92){_0x499f25=_0xb24d92;_0x1bbbe1=0xc8;}else{_0x1bbbe1=0xce;}_0x5218d9['status'](_0x1bbbe1);return _0x5218d9[_0x8d3a('0x21')](_0x8d3a('0x22'),_0x5cf34a+'-'+_0x499f25+'/'+_0xb24d92)[_0x8d3a('0x1d')](_0x36cc0b);}return null;};}function patchUpdates(_0xd390c2){return function(_0x230971){try{jsonpatch[_0x8d3a('0x23')](_0x230971,_0xd390c2,!![]);}catch(_0x563d44){return BPromise[_0x8d3a('0x24')](_0x563d44);}return _0x230971[_0x8d3a('0x25')]();};}function saveUpdates(_0x46fcf1,_0x412126){return function(_0x5c32bf){if(_0x5c32bf){return _0x5c32bf[_0x8d3a('0x26')](_0x46fcf1)[_0x8d3a('0x27')](function(_0x246275){return _0x246275;});}return null;};}function removeEntity(_0x53916d,_0x10b997){return function(_0x477070){if(_0x477070){return _0x477070[_0x8d3a('0x28')]()[_0x8d3a('0x27')](function(){_0x53916d[_0x8d3a('0x1b')](0xcc)[_0x8d3a('0x1c')]();});}};}function handleEntityNotFound(_0x3bff9e,_0x4f6551){return function(_0x5f268b){if(!_0x5f268b){_0x3bff9e[_0x8d3a('0x29')](0x194);}return _0x5f268b;};}function handleError(_0x2204a7,_0x45451e){_0x45451e=_0x45451e||0x1f4;return function(_0x360fcc){logger[_0x8d3a('0x2a')](_0x360fcc['stack']);if(_0x360fcc['name']){delete _0x360fcc[_0x8d3a('0x2b')];}_0x2204a7[_0x8d3a('0x1b')](_0x45451e)[_0x8d3a('0x2c')](_0x360fcc);};}function getInteractionUsers(_0x2ab876,_0x1c6ff6){return new BPromise(function(_0x24e990,_0x497328){try{if(_0x1c6ff6[_0x2ab876['id']]){_0x2ab876[_0x8d3a('0x2d')]=_[_0x8d3a('0x2e')](_0x1c6ff6[_0x2ab876['id']],function(_0x18f710){return{'id':_0x18f710['id'],'fullname':_0x18f710['fullname']};});}}catch(_0x4349ad){_0x497328(_0x4349ad);}_0x24e990(_0x2ab876);});}function getInteractionTags(_0x1b4530,_0x2ffd78){return new BPromise(function(_0x556828,_0x12a79f){try{if(_0x1b4530['TagIds']){_0x1b4530[_0x8d3a('0x2f')]=[];_0x1b4530[_0x8d3a('0x30')][_0x8d3a('0x31')](',')['forEach'](function(_0x3596f6){_0x1b4530['Tags']['push'](_0x2ffd78[_0x3596f6]);});}delete _0x1b4530[_0x8d3a('0x30')];}catch(_0x341ce8){_0x12a79f(_0x341ce8);}_0x556828(_0x1b4530);});}function updateFaxInteraction(_0x486b7f,_0x1a4f3a,_0x58fd79){return new BPromise(function(_0x5e16a6,_0x3e8476){return getInteractionUsers(_0x486b7f,_0x58fd79)[_0x8d3a('0x27')](function(_0x53d3d2){return getInteractionTags(_0x53d3d2,_0x1a4f3a);})[_0x8d3a('0x27')](function(_0x32f102){_0x5e16a6(_0x32f102);})[_0x8d3a('0x32')](function(_0x3896ca){_0x3e8476(_0x3896ca);});});}exports[_0x8d3a('0x33')]=function(_0x1e6538,_0x12cb40){var _0x22a707={},_0x4569ca={},_0x17aa45={'count':0x0,'rows':[]};var _0x5933de=_[_0x8d3a('0x2e')](db[_0x8d3a('0x34')]['rawAttributes'],function(_0x56383e){return{'name':_0x56383e[_0x8d3a('0x35')],'type':_0x56383e[_0x8d3a('0x36')][_0x8d3a('0x37')]};});_0x4569ca['model']=_[_0x8d3a('0x2e')](_0x5933de,_0x8d3a('0x2b'));_0x4569ca['query']=_[_0x8d3a('0x38')](_0x1e6538[_0x8d3a('0x39')]);_0x4569ca[_0x8d3a('0x3a')]=_[_0x8d3a('0x3b')](_0x4569ca[_0x8d3a('0x3c')],_0x4569ca[_0x8d3a('0x39')]);_0x22a707['attributes']=_[_0x8d3a('0x3b')](_0x4569ca[_0x8d3a('0x3c')],qs[_0x8d3a('0x3d')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x3d')]));_0x22a707[_0x8d3a('0x3e')]=_0x22a707[_0x8d3a('0x3e')][_0x8d3a('0x3f')]?_0x22a707[_0x8d3a('0x3e')]:_0x4569ca[_0x8d3a('0x3c')];if(!_0x1e6538['query']['hasOwnProperty'](_0x8d3a('0x40'))){_0x22a707[_0x8d3a('0x20')]=qs[_0x8d3a('0x20')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x20')]);_0x22a707[_0x8d3a('0x1f')]=qs['offset'](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x1f')]);}_0x22a707[_0x8d3a('0x41')]=qs[_0x8d3a('0x42')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x42')]);_0x22a707[_0x8d3a('0x43')]=qs[_0x8d3a('0x3a')](_[_0x8d3a('0x44')](_0x1e6538[_0x8d3a('0x39')],_0x4569ca[_0x8d3a('0x3a')]),_0x5933de);var _0x337995=[];var _0x54b19a=squel[_0x8d3a('0x45')]()[_0x8d3a('0x46')]('id')[_0x8d3a('0x46')]('name')[_0x8d3a('0x46')](_0x8d3a('0x47'))[_0x8d3a('0x48')]('tools_tags');var _0x489d8f=squel[_0x8d3a('0x45')]()[_0x8d3a('0x46')](_0x8d3a('0x49'))[_0x8d3a('0x46')](_0x8d3a('0x4a'))['field'](_0x8d3a('0x4b'))[_0x8d3a('0x48')](_0x8d3a('0x4c'),'ui')[_0x8d3a('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x49f599=squel[_0x8d3a('0x45')]()[_0x8d3a('0x48')](_0x8d3a('0x4e'),'i')[_0x8d3a('0x4d')](_0x8d3a('0x4f'),'c',_0x8d3a('0x50'))['left_join'](_0x8d3a('0x51'),'o',_0x8d3a('0x52'))['left_join'](_0x8d3a('0x53'),'a',_0x8d3a('0x54'))[_0x8d3a('0x4d')](_0x8d3a('0x55'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x8d3a('0x4d')](_0x8d3a('0x56'),'it',_0x8d3a('0x57'))[_0x8d3a('0x4d')](_0x8d3a('0x58'),'t',_0x8d3a('0x59'));var _0x1ffb91=squel[_0x8d3a('0x5a')]();var _0x1b4aae=[];var _0x1be6ab=squel['expr']();var _0x2ce7af;if(_0x1e6538[_0x8d3a('0x39')]['search']){_0x2ce7af=as[_0x8d3a('0x5b')](_0x1e6538['query'][_0x8d3a('0x5c')]);var _0x1551a0=_0x2ce7af[_0x8d3a('0x5d')];for(var _0x9116e9=0x0;_0x9116e9<_0x2ce7af['conditions'][_0x8d3a('0x3f')];_0x9116e9++){var _0x3cf25d=_0x2ce7af[_0x8d3a('0x5e')][_0x9116e9];var _0x2663ce='i';var _0x1ed9b1=_[_0x8d3a('0x5f')](_0x5933de,[_0x8d3a('0x2b'),_0x3cf25d[_0x8d3a('0x46')]]);if(!_0x1ed9b1){switch(_0x3cf25d['field']){case'unreadMessages':if(_0x3cf25d[_0x8d3a('0x60')]==0x1){_0x49f599[_0x8d3a('0x61')]('`'+_0x3cf25d[_0x8d3a('0x46')]+'`\x20=\x200');}else{_0x49f599[_0x8d3a('0x61')]('`'+_0x3cf25d[_0x8d3a('0x46')]+'`\x20>\x200');}break;case _0x8d3a('0x62'):if(_0x3cf25d[_0x8d3a('0x63')]===_0x8d3a('0x64')){if(_0x3cf25d[_0x8d3a('0x60')][_0x8d3a('0x31')]('\x20')[_0x8d3a('0x3f')]>0x1){_0x1ffb91[_0x1551a0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d3a('0x65')](_0x3cf25d[_0x8d3a('0x60')]),null);}else{var _0x4345e9='%'+_0x3cf25d['value']+'%';_0x1ffb91[_0x1551a0](_0x8d3a('0x66'),_0x4345e9,_0x4345e9,_0x4345e9);}}else{_0x1ed9b1=_[_0x8d3a('0x5f')](_0x5933de,['name','ContactId']);_0x3cf25d[_0x8d3a('0x46')]=_0x8d3a('0x67');_0x8cd681=as[_0x8d3a('0x68')](_0x2663ce,_0x1ed9b1['type'],_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681['text'],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x69')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x1c')]);}break;case _0x8d3a('0x6a'):var _0x33760b=_0x3cf25d[_0x8d3a('0x60')][_0x8d3a('0x31')](',')['map'](function(_0xfa88b){return Number(_0xfa88b);});_0x33760b[_0x8d3a('0x6b')](function(_0x3c42f9){_0x1be6ab['or'](_0x8d3a('0x6c'),'%,'+_0x3c42f9+',%');});_0x1b4aae=_['union'](_0x1b4aae,_0x33760b);break;case'User':if(_0x3cf25d['operator']===_0x8d3a('0x64')){_0x1ffb91[_0x1551a0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3cf25d[_0x8d3a('0x60')]+'%',null);}else{_0x1ed9b1=_[_0x8d3a('0x5f')](_0x5933de,['name',_0x8d3a('0x6d')]);_0x3cf25d[_0x8d3a('0x46')]='UserId';_0x8cd681=as['buildExpression'](_0x2663ce,_0x1ed9b1[_0x8d3a('0x36')],_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681[_0x8d3a('0x6e')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x69')],_0x8cd681[_0x8d3a('0x60')]['end']);}break;case'body':_0x8cd681=as['buildExpression']('me',null,_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681[_0x8d3a('0x6e')],_0x8cd681['value'][_0x8d3a('0x69')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x1c')]);break;}}else{var _0x8cd681=as['buildExpression'](_0x2663ce,_0x1ed9b1[_0x8d3a('0x36')],_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681[_0x8d3a('0x6e')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x69')],_0x8cd681['value'][_0x8d3a('0x1c')]);}}}else{var _0x46b06f=_(_0x1e6538[_0x8d3a('0x39')])['keys']()[_0x8d3a('0x2e')](function(_0x4c6fa6){return _[_0x8d3a('0x6f')](_0x5933de,[_0x8d3a('0x2b'),_0x4c6fa6])?_0x4c6fa6:undefined;})[_0x8d3a('0x70')]()['value']();if(!_[_0x8d3a('0x71')](_0x46b06f)){_0x46b06f[_0x8d3a('0x6b')](function(_0x420ea8){if(_0x420ea8===_0x8d3a('0x72')){_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x73'),[][_0x8d3a('0x74')](_0x1e6538[_0x8d3a('0x39')][_0x420ea8]));}else if(_0x420ea8===_0x8d3a('0x75')){var _0x1a5c3c=JSON[_0x8d3a('0x76')](_0x1e6538[_0x8d3a('0x39')][_0x420ea8])[_0x8d3a('0x77')];var _0x3aa3a5=JSON['parse'](_0x1e6538[_0x8d3a('0x39')][_0x420ea8])[_0x8d3a('0x78')];_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x79'),_0x1a5c3c,_0x3aa3a5);}else{if(_0x1e6538[_0x8d3a('0x39')][_0x420ea8]==='null'){_0x49f599['where']('i.'+_0x420ea8+_0x8d3a('0x7a'));}else{_0x49f599['where']('i.'+_0x420ea8+_0x8d3a('0x7b'),_0x1e6538[_0x8d3a('0x39')][_0x420ea8]);}}});}if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7c')]){if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7c')]==0x1){_0x49f599[_0x8d3a('0x61')](_0x8d3a('0x7d'));}else{_0x49f599[_0x8d3a('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7e')]){_0x1b4aae=_[_0x8d3a('0x7f')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7e')])?_0x1e6538['query'][_0x8d3a('0x7e')]:new Array(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7e')]);_0x1b4aae[_0x8d3a('0x6b')](function(_0x4182cd){_0x1be6ab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4182cd+',%');});}if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x80')]){var _0x3e7392=_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x80')]['replace']('\x5c','\x5c\x5c')[_0x8d3a('0x81')]('\x27\x27',_0x8d3a('0x82'));if(qs[_0x8d3a('0x83')](_0x3e7392)){_0x1ffb91['or']('i.id\x20LIKE\x20?',_0x3e7392+'%')['or']('i.fax\x20LIKE\x20?',_0x3e7392+'%');}_0x1ffb91['or'](_0x8d3a('0x84'),_0x3e7392+'%');}}_0x49f599['where'](_0x1ffb91);_0x49f599[_0x8d3a('0x85')](_0x8d3a('0x86'));var _0x2e451e={'type':db[_0x8d3a('0x87')]['QueryTypes'][_0x8d3a('0x88')],'raw':!![]};var _0x5814a9=_0x49f599[_0x8d3a('0x89')]();_0x5814a9['field']('i.id');_0x5814a9[_0x8d3a('0x46')](_0x8d3a('0x8a'),_0x8d3a('0x8b'));if(_0x22a707[_0x8d3a('0x41')]){_0x22a707[_0x8d3a('0x41')][_0x8d3a('0x6b')](function(_0x3fb695){_0x49f599[_0x8d3a('0x41')]('i.'+_0x3fb695[0x0],_0x3fb695[0x1]===_0x8d3a('0x8c')?![]:!![]);});}if(!_[_0x8d3a('0x71')](_0x1b4aae)){_0x49f599[_0x8d3a('0x61')](_0x1be6ab);_0x5814a9[_0x8d3a('0x43')](_0x8d3a('0x8d'),_0x1b4aae);}BPromise[_0x8d3a('0x8e')]()[_0x8d3a('0x27')](function(){if(!_0x2ce7af){if(_0x1e6538['query']['FaxAccountId']||_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x8f')])return;_0x5814a9['where'](_0x8d3a('0x90'));_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x90'));return;}return _0x1e6538[_0x8d3a('0x91')][_0x8d3a('0x92')]({'attributes':['id'],'raw':!![]})[_0x8d3a('0x27')](function(_0x3a6e2f){if(_[_0x8d3a('0x71')](_0x3a6e2f)){_0x5814a9['where']('i.FaxAccountId\x20IS\x20NULL');_0x49f599[_0x8d3a('0x43')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x5814a9[_0x8d3a('0x43')](_0x8d3a('0x73'),_['map'](_0x3a6e2f,'id'));_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x73'),_['map'](_0x3a6e2f,'id'));}});})[_0x8d3a('0x27')](function(){db[_0x8d3a('0x93')]['query'](_0x5814a9[_0x8d3a('0x94')](),_0x2e451e)[_0x8d3a('0x27')](function(_0x50cb3f){_0x17aa45[_0x8d3a('0x1e')]=_0x50cb3f['length'];if(_0x17aa45['count']===0x0)return[];return db['sequelize'][_0x8d3a('0x39')](_0x54b19a[_0x8d3a('0x94')](),_0x2e451e)['then'](function(_0xa0260c){_0x337995=_['keyBy'](_0xa0260c,'id');_0x2e451e=_[_0x8d3a('0x95')](_0x2e451e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x3d')]){_0x22a707[_0x8d3a('0x3e')][_0x8d3a('0x6b')](function(_0x350bfd){_0x49f599[_0x8d3a('0x46')]('i.'+_0x350bfd);});}else{_0x49f599['field'](_0x8d3a('0x8a'),_0x8d3a('0x8b'));_0x49f599['field'](_0x8d3a('0x96'),'Account.key');_0x49f599[_0x8d3a('0x46')]('a.mandatoryDisposition',_0x8d3a('0x97'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x98'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x99'),'Contact.firstName');_0x49f599[_0x8d3a('0x46')]('c.lastName',_0x8d3a('0x9a'));_0x49f599[_0x8d3a('0x46')]('c.email',_0x8d3a('0x9b'));_0x49f599['field'](_0x8d3a('0x9c'),'Contact.phone');_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x9d'),'Contact.mobile');_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x9e'),_0x8d3a('0x9f'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0xa0'),_0x8d3a('0xa1'));_0x49f599['field'](_0x8d3a('0xa2'),_0x8d3a('0xa3'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0xa4'),_0x8d3a('0x30'));}if(_0x22a707['limit'])_0x49f599['limit'](_0x22a707[_0x8d3a('0x20')]);if(_0x22a707['offset'])_0x49f599['offset'](_0x22a707[_0x8d3a('0x1f')]);return db[_0x8d3a('0x93')]['query'](_0x49f599[_0x8d3a('0x94')](),_0x2e451e);})[_0x8d3a('0x27')](function(_0x18bede){_0x489d8f[_0x8d3a('0x43')]('ui.FaxInteractionId\x20IN\x20?',_[_0x8d3a('0x2e')](_0x18bede,'id'));return db[_0x8d3a('0x93')][_0x8d3a('0x39')](_0x489d8f[_0x8d3a('0x94')](),_0x2e451e)['then'](function(_0xd930e4){var _0x5608e6=_[_0x8d3a('0xa5')](_0xd930e4,'FaxInteractionId');var _0x1eb7e7=[];_0x18bede[_0x8d3a('0x6b')](function(_0x31aac5){_0x1eb7e7['push'](updateFaxInteraction(_0x31aac5,_0x337995,_0x5608e6));});return BPromise[_0x8d3a('0xa6')](_0x1eb7e7);});});})[_0x8d3a('0x27')](function(_0x18af3b){_0x17aa45[_0x8d3a('0xa7')]=_0x18af3b;return _0x17aa45;})[_0x8d3a('0x27')](respondWithFilteredResult(_0x12cb40,_0x22a707));})[_0x8d3a('0x32')](handleError(_0x12cb40,null));};exports[_0x8d3a('0xa8')]=function(_0x2e747b,_0x281cbb){var _0x39163f={'raw':![],'where':{'id':_0x2e747b['params']['id']}},_0x50744c={};_0x50744c[_0x8d3a('0x3c')]=_[_0x8d3a('0x38')](db['FaxInteraction'][_0x8d3a('0xa9')]);_0x50744c[_0x8d3a('0x39')]=_[_0x8d3a('0x38')](_0x2e747b['query']);_0x50744c[_0x8d3a('0x3a')]=_[_0x8d3a('0x3b')](_0x50744c[_0x8d3a('0x3c')],_0x50744c[_0x8d3a('0x39')]);_0x39163f[_0x8d3a('0x3e')]=_[_0x8d3a('0x3b')](_0x50744c[_0x8d3a('0x3c')],qs['fields'](_0x2e747b[_0x8d3a('0x39')]['fields']));_0x39163f[_0x8d3a('0x3e')]=_0x39163f[_0x8d3a('0x3e')]['length']?_0x39163f[_0x8d3a('0x3e')]:_0x50744c[_0x8d3a('0x3c')];if(_0x2e747b[_0x8d3a('0x39')][_0x8d3a('0xaa')]){_0x39163f['include']=[{'all':!![]}];}_0x39163f=_[_0x8d3a('0x95')]({},_0x39163f,_0x2e747b[_0x8d3a('0xab')]);return db[_0x8d3a('0x34')][_0x8d3a('0x5f')](_0x39163f)['then'](handleEntityNotFound(_0x281cbb,null))[_0x8d3a('0x27')](respondWithResult(_0x281cbb,null))['catch'](handleError(_0x281cbb,null));};exports[_0x8d3a('0xac')]=function(_0x5d3910,_0x583ebc){return db[_0x8d3a('0x34')][_0x8d3a('0xac')](_0x5d3910[_0x8d3a('0xad')],{})[_0x8d3a('0x27')](respondWithResult(_0x583ebc,0xc9))[_0x8d3a('0x32')](handleError(_0x583ebc,null));};exports[_0x8d3a('0x26')]=function(_0x4ee4f9,_0x504bdd){if(_0x4ee4f9[_0x8d3a('0xad')]['id']){delete _0x4ee4f9['body']['id'];}return db[_0x8d3a('0x34')]['find']({'where':{'id':_0x4ee4f9[_0x8d3a('0xae')]['id']}})['then'](handleEntityNotFound(_0x504bdd,null))[_0x8d3a('0x27')](saveUpdates(_0x4ee4f9[_0x8d3a('0xad')],null))['then'](respondWithResult(_0x504bdd,null))[_0x8d3a('0x32')](handleError(_0x504bdd,null));};exports[_0x8d3a('0x28')]=function(_0x8ddb67,_0x5dde97){return db[_0x8d3a('0x34')][_0x8d3a('0x5f')]({'where':{'id':_0x8ddb67[_0x8d3a('0xae')]['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0x5dde97,null))[_0x8d3a('0x27')](removeEntity(_0x5dde97,null))['catch'](handleError(_0x5dde97,null));};exports[_0x8d3a('0xaf')]=function(_0x3c8226,_0x111922){return db[_0x8d3a('0x34')][_0x8d3a('0xaf')]()[_0x8d3a('0x27')](respondWithResult(_0x111922,null))[_0x8d3a('0x32')](handleError(_0x111922,null));};exports[_0x8d3a('0xb0')]=function(_0x276a0b,_0x44d018,_0x24fc01){return db[_0x8d3a('0xb1')][_0x8d3a('0x5f')]({'where':{'id':_0x276a0b[_0x8d3a('0xae')]['id']}})['then'](handleEntityNotFound(_0x44d018,null))[_0x8d3a('0x27')](function(_0x5247a1){if(_0x5247a1){return _0x5247a1[_0x8d3a('0xb0')](_0x276a0b[_0x8d3a('0xad')][_0x8d3a('0xb2')],_[_0x8d3a('0xb3')](_0x276a0b[_0x8d3a('0xad')],[_0x8d3a('0xb2'),'id'])||{});}})[_0x8d3a('0x27')](respondWithResult(_0x44d018,null))[_0x8d3a('0x32')](handleError(_0x44d018,null));};exports[_0x8d3a('0xb4')]=function(_0x2918ca,_0x4e6290,_0x59a557){var _0x46e5bf={'raw':![],'where':{}};var _0x55becc={};var _0x345167={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x8d3a('0xb5')]({'where':{'id':_0x2918ca[_0x8d3a('0xae')]['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0x4e6290,null))['then'](function(_0x432c56){if(_0x432c56){_0x55becc['model']=_[_0x8d3a('0x38')](db[_0x8d3a('0xb1')][_0x8d3a('0xa9')]);_0x55becc[_0x8d3a('0x39')]=_['keys'](_0x2918ca[_0x8d3a('0x39')]);_0x55becc[_0x8d3a('0x3a')]=_[_0x8d3a('0x3b')](_0x55becc['model'],_0x55becc[_0x8d3a('0x39')]);_0x46e5bf[_0x8d3a('0x3e')]=_[_0x8d3a('0x3b')](_0x55becc[_0x8d3a('0x3c')],qs['fields'](_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0x3d')]));_0x46e5bf[_0x8d3a('0x3e')]=_0x46e5bf[_0x8d3a('0x3e')][_0x8d3a('0x3f')]?_0x46e5bf[_0x8d3a('0x3e')]:_0x55becc['model'];if(!_0x2918ca['query'][_0x8d3a('0xb6')]('nolimit')){_0x46e5bf['limit']=qs[_0x8d3a('0x20')](_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0x20')]);_0x46e5bf[_0x8d3a('0x1f')]=qs[_0x8d3a('0x1f')](_0x2918ca['query'][_0x8d3a('0x1f')]);}_0x46e5bf[_0x8d3a('0x41')]=qs['sort'](_0x2918ca['query'][_0x8d3a('0x42')]);_0x46e5bf[_0x8d3a('0x43')]=qs['filters'](_[_0x8d3a('0x44')](_0x2918ca[_0x8d3a('0x39')],_0x55becc['filters']));_0x46e5bf[_0x8d3a('0x43')][_0x8d3a('0xb7')]=_0x432c56['id'];if(_0x2918ca[_0x8d3a('0x39')]['filter']){_0x46e5bf[_0x8d3a('0x43')]=_['merge'](_0x46e5bf[_0x8d3a('0x43')],{'$or':_[_0x8d3a('0x2e')](_0x46e5bf[_0x8d3a('0x3e')],function(_0x529aa7){var _0x1e519d={};_0x1e519d[_0x529aa7]={'$like':'%'+_0x2918ca[_0x8d3a('0x39')]['filter']+'%'};return _0x1e519d;})});}if(_0x2918ca[_0x8d3a('0x39')]['$gte']){var _0x561071=_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0x77')][_0x8d3a('0x31')](',');var _0x130dfa={};_0x130dfa[_0x561071[0x0]]={'$gte':moment(_0x561071[0x1])[_0x8d3a('0xb8')](_0x8d3a('0xb9'))};_0x46e5bf[_0x8d3a('0x43')]=_[_0x8d3a('0x95')](_0x46e5bf[_0x8d3a('0x43')],_0x130dfa);}_0x46e5bf=_[_0x8d3a('0x95')]({},_0x46e5bf,_0x2918ca['options']);return db['FaxMessage'][_0x8d3a('0x1e')]({'where':_0x46e5bf[_0x8d3a('0x43')]})[_0x8d3a('0x27')](function(_0x542ba7){_0x345167[_0x8d3a('0x1e')]=_0x542ba7;if(_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0xaa')]){_0x46e5bf[_0x8d3a('0xba')]=[{'all':!![]}];}return db['FaxMessage'][_0x8d3a('0xbb')](_0x46e5bf);})['then'](function(_0x5430f0){_0x345167[_0x8d3a('0xa7')]=_0x5430f0;return _0x345167;});}})['then'](respondWithFilteredResult(_0x4e6290,_0x46e5bf))[_0x8d3a('0x32')](handleError(_0x4e6290,null));};exports[_0x8d3a('0xbc')]=function(_0x222dc7,_0x1e4d36,_0x370f6d){return db[_0x8d3a('0x34')][_0x8d3a('0x5f')]({'where':{'id':_0x222dc7['params']['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0x1e4d36,null))[_0x8d3a('0x27')](function(_0x468f39){if(_0x468f39){return _0x468f39[_0x8d3a('0xbd')](_0x222dc7[_0x8d3a('0xad')][_0x8d3a('0xb2')],_[_0x8d3a('0xb3')](_0x222dc7[_0x8d3a('0xad')],[_0x8d3a('0xb2'),'id'])||{})[_0x8d3a('0xbe')](function(){return db[_0x8d3a('0x6a')][_0x8d3a('0xbb')]({'attributes':['id',_0x8d3a('0x2b'),_0x8d3a('0x47')],'where':{'id':_0x222dc7[_0x8d3a('0xad')][_0x8d3a('0xb2')]}});})['then'](function(_0x2f6920){socket[_0x8d3a('0xbf')](_0x8d3a('0xc0'),{'id':Number(_0x222dc7[_0x8d3a('0xae')]['id']),'tags':_0x2f6920||[]});return{'id':Number(_0x222dc7[_0x8d3a('0xae')]['id']),'tags':_0x2f6920||[]};});}})[_0x8d3a('0x27')](respondWithResult(_0x1e4d36,null))[_0x8d3a('0x32')](handleError(_0x1e4d36,null));};exports['removeTags']=function(_0x2c2cc7,_0xe193f8,_0x1ba6ab){return db['FaxInteraction'][_0x8d3a('0x5f')]({'where':{'id':_0x2c2cc7[_0x8d3a('0xae')]['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0xe193f8,null))[_0x8d3a('0x27')](function(_0x24e92d){if(_0x24e92d){return _0x24e92d[_0x8d3a('0xc1')](_0x2c2cc7[_0x8d3a('0x39')][_0x8d3a('0xb2')]);}})[_0x8d3a('0x27')](respondWithStatusCode(_0xe193f8,null))[_0x8d3a('0x32')](handleError(_0xe193f8,null));};exports['download']=function(_0x290b8d,_0x3fccd7){var _0x1d67e4=moment()[_0x8d3a('0xc2')]()[_0x8d3a('0x94')]();var _0x1d9c13=path[_0x8d3a('0xc3')](config[_0x8d3a('0xc4')],_0x8d3a('0xc5'),_0x8d3a('0xc6'),_0x8d3a('0xc7'));var _0xb83ebe=path[_0x8d3a('0xc3')](config['root'],_0x8d3a('0xc5'),_0x8d3a('0xc6'),_0x8d3a('0xc8'));var _0x19dd8b=path[_0x8d3a('0xc3')](_0x1d9c13,_0x1d67e4);var _0x522f23=util['format'](_0x8d3a('0xc9'),_0x290b8d['params']['id'],_0x1d67e4);var _0x57a09f=path['join'](_0x1d9c13,_0x522f23);var _0x200bd1=[];_0x200bd1[_0x8d3a('0xca')]({'model':db[_0x8d3a('0xcb')],'as':_0x8d3a('0xcb'),'raw':!![]});var _0xad9c46=[{'model':db[_0x8d3a('0xb1')],'as':'Messages','attributes':['id',_0x8d3a('0xad'),'createdAt'],'include':_0x200bd1}];return db[_0x8d3a('0x34')][_0x8d3a('0x5f')]({'where':{'id':_0x290b8d[_0x8d3a('0xae')]['id']},'include':_0xad9c46})[_0x8d3a('0x27')](handleEntityNotFound(_0x3fccd7,null))[_0x8d3a('0x27')](function(_0x2cf890){if(_0x2cf890&&_0x2cf890[_0x8d3a('0xcc')]){var _0x46b36a=_0x2cf890[_0x8d3a('0xcd')]({'plain':!![]});fs[_0x8d3a('0xce')](_0x19dd8b);for(var _0x356e09=0x0;_0x356e09<_0x46b36a[_0x8d3a('0xcc')]['length'];_0x356e09++){var _0x5910c9=_0x46b36a[_0x8d3a('0xcc')][_0x356e09]['Attachment'];if(_0x5910c9){var _0x554c80=path[_0x8d3a('0xc3')](_0xb83ebe,_0x5910c9['basename']);if(fs[_0x8d3a('0xcf')](_0x554c80)){fs['createReadStream'](_0x554c80)[_0x8d3a('0xd0')](fs[_0x8d3a('0xd1')](path[_0x8d3a('0xc3')](_0x19dd8b,_0x5910c9['basename'])));}}}return BPromise['resolve']()[_0x8d3a('0x27')](function(){return new BPromise(function(_0x4c624f,_0xd0fddb){zipdir(_0x19dd8b,{'saveTo':_0x57a09f},function(_0x27c184,_0x1a806f){if(_0x27c184)return _0xd0fddb(_0x27c184);return _0x4c624f(_0x1a806f);});})['then'](function(){return new BPromise(function(_0x418553,_0x3cbe16){rimraf(_0x19dd8b,function(_0x1a32f7){if(_0x1a32f7)_0x3cbe16(_0x1a32f7);return _0x418553();});});})[_0x8d3a('0x27')](function(){return _0x3fccd7['download'](_0x57a09f,_0x522f23,function(_0x135d78){if(_0x135d78){console[_0x8d3a('0xd2')](_0x8d3a('0xd3'),_0x135d78);}else{fs[_0x8d3a('0xd4')](_0x57a09f);}});});});}else{return _0x3fccd7['sendStatus'](0xc8);}})['catch'](handleError(_0x3fccd7,null));}; \ No newline at end of file +var _0x5454=['length','hasOwnProperty','offset','order','sort','where','filters','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','`unreadMessages`\x20=\x200','tag','filter','replace','\x27\x27\x27\x27','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','unlinkSync','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','status','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','fieldName','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x1353d8,_0x33f93b){var _0x35cd80=function(_0x456f45){while(--_0x456f45){_0x1353d8['push'](_0x1353d8['shift']());}};_0x35cd80(++_0x33f93b);}(_0x5454,0x15b));var _0x4545=function(_0x260992,_0x1ae28f){_0x260992=_0x260992-0x0;var _0x4b848f=_0x5454[_0x260992];return _0x4b848f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4545('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4545('0x1'));var Mustache=require(_0x4545('0x2'));var util=require(_0x4545('0x3'));var path=require(_0x4545('0x4'));var sox=require('sox');var csv=require(_0x4545('0x5'));var ejs=require(_0x4545('0x6'));var fs=require('fs');var _=require(_0x4545('0x7'));var squel=require(_0x4545('0x8'));var crypto=require(_0x4545('0x9'));var jsforce=require(_0x4545('0xa'));var deskjs=require(_0x4545('0xb'));var toCsv=require(_0x4545('0x5'));var querystring=require(_0x4545('0xc'));var Papa=require(_0x4545('0xd'));var Redis=require(_0x4545('0xe'));var authService=require(_0x4545('0xf'));var qs=require(_0x4545('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4545('0x11'));var logger=require(_0x4545('0x12'))(_0x4545('0x13'));var utils=require(_0x4545('0x14'));var config=require(_0x4545('0x15'));var db=require(_0x4545('0x16'))['db'];config['redis']=_[_0x4545('0x17')](config[_0x4545('0x18')],{'host':_0x4545('0x19'),'port':0x18eb});var socket=require(_0x4545('0x1a'))(new Redis(config[_0x4545('0x18')]));require(_0x4545('0x1b'))[_0x4545('0x1c')](socket);function respondWithStatusCode(_0x347072,_0x36bb8e){_0x36bb8e=_0x36bb8e||0xcc;return function(_0xab7856){if(_0xab7856){return _0x347072[_0x4545('0x1d')](_0x36bb8e);}return _0x347072['status'](_0x36bb8e)[_0x4545('0x1e')]();};}function respondWithResult(_0x3577f5,_0x2416b0){_0x2416b0=_0x2416b0||0xc8;return function(_0x3bb165){if(_0x3bb165){return _0x3577f5['status'](_0x2416b0)['json'](_0x3bb165);}};}function respondWithFilteredResult(_0x3bf878,_0x29effa){return function(_0x44704b){if(_0x44704b){var _0x2e13e0=_0x44704b[_0x4545('0x1f')],_0x207e38=_0x29effa['offset'],_0x33393b=_0x29effa['offset']+_0x29effa[_0x4545('0x20')],_0x3161c8;if(_0x33393b>=_0x2e13e0){_0x33393b=_0x2e13e0;_0x3161c8=0xc8;}else{_0x3161c8=0xce;}_0x3bf878['status'](_0x3161c8);return _0x3bf878[_0x4545('0x21')](_0x4545('0x22'),_0x207e38+'-'+_0x33393b+'/'+_0x2e13e0)[_0x4545('0x23')](_0x44704b);}return null;};}function patchUpdates(_0x6b3bc){return function(_0x7e47e5){try{jsonpatch[_0x4545('0x24')](_0x7e47e5,_0x6b3bc,!![]);}catch(_0x1a4f5a){return BPromise[_0x4545('0x25')](_0x1a4f5a);}return _0x7e47e5['save']();};}function saveUpdates(_0x580b57,_0x431b5d){return function(_0x483827){if(_0x483827){return _0x483827[_0x4545('0x26')](_0x580b57)['then'](function(_0x293c18){return _0x293c18;});}return null;};}function removeEntity(_0x4c47c0,_0x519489){return function(_0x21dbc2){if(_0x21dbc2){return _0x21dbc2[_0x4545('0x27')]()[_0x4545('0x28')](function(){_0x4c47c0[_0x4545('0x29')](0xcc)[_0x4545('0x1e')]();});}};}function handleEntityNotFound(_0x39eaa1,_0x43033c){return function(_0x889814){if(!_0x889814){_0x39eaa1[_0x4545('0x1d')](0x194);}return _0x889814;};}function handleError(_0x2a6842,_0x3e5807){_0x3e5807=_0x3e5807||0x1f4;return function(_0x43749b){logger[_0x4545('0x2a')](_0x43749b[_0x4545('0x2b')]);if(_0x43749b[_0x4545('0x2c')]){delete _0x43749b[_0x4545('0x2c')];}_0x2a6842['status'](_0x3e5807)[_0x4545('0x2d')](_0x43749b);};}function getInteractionUsers(_0x2c256b,_0x853476){return new BPromise(function(_0x394a8e,_0xb9c5ee){try{if(_0x853476[_0x2c256b['id']]){_0x2c256b['Users']=_[_0x4545('0x2e')](_0x853476[_0x2c256b['id']],function(_0x39ddcc){return{'id':_0x39ddcc['id'],'fullname':_0x39ddcc[_0x4545('0x2f')]};});}}catch(_0x247762){_0xb9c5ee(_0x247762);}_0x394a8e(_0x2c256b);});}function getInteractionTags(_0x1da2a9,_0x27b7d7){return new BPromise(function(_0x52dd8e,_0x406920){try{if(_0x1da2a9[_0x4545('0x30')]){_0x1da2a9[_0x4545('0x31')]=[];_0x1da2a9[_0x4545('0x30')][_0x4545('0x32')](',')[_0x4545('0x33')](function(_0x879927){_0x1da2a9[_0x4545('0x31')][_0x4545('0x34')](_0x27b7d7[_0x879927]);});}delete _0x1da2a9[_0x4545('0x30')];}catch(_0x196884){_0x406920(_0x196884);}_0x52dd8e(_0x1da2a9);});}function updateFaxInteraction(_0x4a606d,_0x1e3a47,_0x5d3f61){return new BPromise(function(_0x2848ac,_0x9bffd8){return getInteractionUsers(_0x4a606d,_0x5d3f61)['then'](function(_0x329417){return getInteractionTags(_0x329417,_0x1e3a47);})[_0x4545('0x28')](function(_0x46e814){_0x2848ac(_0x46e814);})[_0x4545('0x35')](function(_0x1f4a3b){_0x9bffd8(_0x1f4a3b);});});}exports[_0x4545('0x36')]=function(_0x16acf4,_0x54ea62){var _0x1abc06={},_0x386b38={},_0x36f4b9={'count':0x0,'rows':[]};var _0x1b7a11=_[_0x4545('0x2e')](db[_0x4545('0x37')]['rawAttributes'],function(_0x2db2f7){return{'name':_0x2db2f7[_0x4545('0x38')],'type':_0x2db2f7[_0x4545('0x39')][_0x4545('0x3a')]};});_0x386b38[_0x4545('0x3b')]=_[_0x4545('0x2e')](_0x1b7a11,_0x4545('0x2c'));_0x386b38[_0x4545('0x3c')]=_[_0x4545('0x3d')](_0x16acf4['query']);_0x386b38['filters']=_['intersection'](_0x386b38[_0x4545('0x3b')],_0x386b38['query']);_0x1abc06[_0x4545('0x3e')]=_[_0x4545('0x3f')](_0x386b38[_0x4545('0x3b')],qs[_0x4545('0x40')](_0x16acf4['query']['fields']));_0x1abc06[_0x4545('0x3e')]=_0x1abc06['attributes'][_0x4545('0x41')]?_0x1abc06[_0x4545('0x3e')]:_0x386b38[_0x4545('0x3b')];if(!_0x16acf4[_0x4545('0x3c')][_0x4545('0x42')]('nolimit')){_0x1abc06['limit']=qs[_0x4545('0x20')](_0x16acf4[_0x4545('0x3c')][_0x4545('0x20')]);_0x1abc06['offset']=qs[_0x4545('0x43')](_0x16acf4[_0x4545('0x3c')]['offset']);}_0x1abc06[_0x4545('0x44')]=qs['sort'](_0x16acf4[_0x4545('0x3c')][_0x4545('0x45')]);_0x1abc06[_0x4545('0x46')]=qs[_0x4545('0x47')](_['pick'](_0x16acf4[_0x4545('0x3c')],_0x386b38[_0x4545('0x47')]),_0x1b7a11);var _0x3d308e=[];var _0x299869=squel['select']()['field']('id')[_0x4545('0x48')]('name')[_0x4545('0x48')](_0x4545('0x49'))[_0x4545('0x4a')](_0x4545('0x4b'));var _0x427554=squel[_0x4545('0x4c')]()[_0x4545('0x48')](_0x4545('0x4d'))['field'](_0x4545('0x4e'))[_0x4545('0x48')](_0x4545('0x4f'))['from'](_0x4545('0x50'),'ui')[_0x4545('0x51')](_0x4545('0x52'),'u',_0x4545('0x53'));var _0x46123d=squel[_0x4545('0x4c')]()[_0x4545('0x4a')](_0x4545('0x54'),'i')['left_join'](_0x4545('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4545('0x51')]('users','o',_0x4545('0x56'))[_0x4545('0x51')](_0x4545('0x57'),'a','a.id\x20=\x20i.FaxAccountId')[_0x4545('0x51')](_0x4545('0x58'),'me',_0x4545('0x59'))[_0x4545('0x51')](_0x4545('0x5a'),'it',_0x4545('0x5b'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x563835=squel[_0x4545('0x5c')]();var _0x14153e=[];var _0x32b6fd=squel[_0x4545('0x5c')]();var _0x6fd3b6;if(_0x16acf4[_0x4545('0x3c')][_0x4545('0x5d')]){_0x6fd3b6=as['parseSearch'](_0x16acf4['query'][_0x4545('0x5d')]);var _0x32fdc1=_0x6fd3b6[_0x4545('0x5e')];for(var _0x2946b5=0x0;_0x2946b5<_0x6fd3b6[_0x4545('0x5f')][_0x4545('0x41')];_0x2946b5++){var _0x4e9a19=_0x6fd3b6[_0x4545('0x5f')][_0x2946b5];var _0xbf9ef4='i';var _0x59d9e5=_[_0x4545('0x60')](_0x1b7a11,['name',_0x4e9a19[_0x4545('0x48')]]);if(!_0x59d9e5){switch(_0x4e9a19[_0x4545('0x48')]){case _0x4545('0x61'):if(_0x4e9a19[_0x4545('0x62')]==0x1){_0x46123d[_0x4545('0x63')]('`'+_0x4e9a19[_0x4545('0x48')]+_0x4545('0x64'));}else{_0x46123d['having']('`'+_0x4e9a19[_0x4545('0x48')]+'`\x20>\x200');}break;case _0x4545('0x65'):if(_0x4e9a19['operator']===_0x4545('0x66')){if(_0x4e9a19[_0x4545('0x62')][_0x4545('0x32')]('\x20')['length']>0x1){_0x563835[_0x32fdc1](_0x4545('0x67'),qs[_0x4545('0x68')](_0x4e9a19['value']),null);}else{var _0x37a775='%'+_0x4e9a19['value']+'%';_0x563835[_0x32fdc1](_0x4545('0x69'),_0x37a775,_0x37a775,_0x37a775);}}else{_0x59d9e5=_[_0x4545('0x60')](_0x1b7a11,[_0x4545('0x2c'),_0x4545('0x6a')]);_0x4e9a19[_0x4545('0x48')]=_0x4545('0x6a');_0x40393b=as[_0x4545('0x6b')](_0xbf9ef4,_0x59d9e5[_0x4545('0x39')],_0x4e9a19);_0x563835[_0x32fdc1](_0x40393b[_0x4545('0x6c')],_0x40393b['value'][_0x4545('0x6d')],_0x40393b[_0x4545('0x62')][_0x4545('0x1e')]);}break;case _0x4545('0x6e'):var _0xcd6b7d=_0x4e9a19['value'][_0x4545('0x32')](',')[_0x4545('0x2e')](function(_0x40e25a){return Number(_0x40e25a);});_0xcd6b7d[_0x4545('0x33')](function(_0x8be55e){_0x32b6fd['or'](_0x4545('0x6f'),'%,'+_0x8be55e+',%');});_0x14153e=_[_0x4545('0x70')](_0x14153e,_0xcd6b7d);break;case _0x4545('0x71'):if(_0x4e9a19['operator']===_0x4545('0x66')){_0x563835[_0x32fdc1](_0x4545('0x72'),'%'+_0x4e9a19[_0x4545('0x62')]+'%',null);}else{_0x59d9e5=_[_0x4545('0x60')](_0x1b7a11,[_0x4545('0x2c'),_0x4545('0x73')]);_0x4e9a19[_0x4545('0x48')]=_0x4545('0x73');_0x40393b=as['buildExpression'](_0xbf9ef4,_0x59d9e5[_0x4545('0x39')],_0x4e9a19);_0x563835[_0x32fdc1](_0x40393b[_0x4545('0x6c')],_0x40393b[_0x4545('0x62')][_0x4545('0x6d')],_0x40393b[_0x4545('0x62')]['end']);}break;case _0x4545('0x74'):_0x40393b=as[_0x4545('0x6b')]('me',null,_0x4e9a19);_0x563835[_0x32fdc1](_0x40393b[_0x4545('0x6c')],_0x40393b[_0x4545('0x62')][_0x4545('0x6d')],_0x40393b[_0x4545('0x62')][_0x4545('0x1e')]);break;}}else{var _0x40393b=as[_0x4545('0x6b')](_0xbf9ef4,_0x59d9e5[_0x4545('0x39')],_0x4e9a19);_0x563835[_0x32fdc1](_0x40393b[_0x4545('0x6c')],_0x40393b[_0x4545('0x62')][_0x4545('0x6d')],_0x40393b['value'][_0x4545('0x1e')]);}}}else{var _0x4240cc=_(_0x16acf4[_0x4545('0x3c')])[_0x4545('0x3d')]()[_0x4545('0x2e')](function(_0x26dd68){return _['some'](_0x1b7a11,['name',_0x26dd68])?_0x26dd68:undefined;})[_0x4545('0x75')]()[_0x4545('0x62')]();if(!_[_0x4545('0x76')](_0x4240cc)){_0x4240cc[_0x4545('0x33')](function(_0x26cf0f){if(_0x26cf0f===_0x4545('0x77')){_0x46123d[_0x4545('0x46')](_0x4545('0x78'),[][_0x4545('0x79')](_0x16acf4[_0x4545('0x3c')][_0x26cf0f]));}else if(_0x26cf0f===_0x4545('0x7a')){var _0x447746=JSON['parse'](_0x16acf4[_0x4545('0x3c')][_0x26cf0f])['$gte'];var _0xceccec=JSON['parse'](_0x16acf4[_0x4545('0x3c')][_0x26cf0f])['$lte'];_0x46123d[_0x4545('0x46')](_0x4545('0x7b'),_0x447746,_0xceccec);}else{if(_0x16acf4[_0x4545('0x3c')][_0x26cf0f]==='null'){_0x46123d['where']('i.'+_0x26cf0f+_0x4545('0x7c'));}else{_0x46123d[_0x4545('0x46')]('i.'+_0x26cf0f+'\x20=\x20?',_0x16acf4[_0x4545('0x3c')][_0x26cf0f]);}}});}if(_0x16acf4[_0x4545('0x3c')]['read']){if(_0x16acf4[_0x4545('0x3c')]['read']==0x1){_0x46123d[_0x4545('0x63')](_0x4545('0x7d'));}else{_0x46123d['having']('`unreadMessages`\x20>\x200');}}if(_0x16acf4[_0x4545('0x3c')]['tag']){_0x14153e=_['isArray'](_0x16acf4[_0x4545('0x3c')][_0x4545('0x7e')])?_0x16acf4[_0x4545('0x3c')][_0x4545('0x7e')]:new Array(_0x16acf4[_0x4545('0x3c')]['tag']);_0x14153e['forEach'](function(_0x5e8b41){_0x32b6fd['or'](_0x4545('0x6f'),'%,'+_0x5e8b41+',%');});}if(_0x16acf4[_0x4545('0x3c')][_0x4545('0x7f')]){var _0x49e1fe=_0x16acf4[_0x4545('0x3c')][_0x4545('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x4545('0x80')]('\x27\x27',_0x4545('0x81'));if(qs['isNumeric'](_0x49e1fe)){_0x563835['or']('i.id\x20LIKE\x20?',_0x49e1fe+'%')['or'](_0x4545('0x82'),_0x49e1fe+'%');}_0x563835['or'](_0x4545('0x83'),_0x49e1fe+'%');}}_0x46123d['where'](_0x563835);_0x46123d[_0x4545('0x84')]('i.id');var _0x127202={'type':db['Sequelize'][_0x4545('0x85')]['SELECT'],'raw':!![]};var _0x1178f3=_0x46123d[_0x4545('0x86')]();_0x1178f3[_0x4545('0x48')](_0x4545('0x87'));_0x1178f3[_0x4545('0x48')](_0x4545('0x88'),_0x4545('0x61'));if(_0x1abc06['order']){_0x1abc06[_0x4545('0x44')][_0x4545('0x33')](function(_0x3cb9de){_0x46123d[_0x4545('0x44')]('i.'+_0x3cb9de[0x0],_0x3cb9de[0x1]===_0x4545('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x14153e)){_0x46123d['having'](_0x32b6fd);_0x1178f3[_0x4545('0x46')](_0x4545('0x8a'),_0x14153e);}BPromise['resolve']()[_0x4545('0x28')](function(){if(!_0x6fd3b6){if(_0x16acf4[_0x4545('0x3c')][_0x4545('0x77')]||_0x16acf4['query']['journey'])return;_0x1178f3[_0x4545('0x46')](_0x4545('0x8b'));_0x46123d[_0x4545('0x46')](_0x4545('0x8b'));return;}return _0x16acf4[_0x4545('0x8c')][_0x4545('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45ee11){if(_[_0x4545('0x76')](_0x45ee11)){_0x1178f3[_0x4545('0x46')](_0x4545('0x8e'));_0x46123d[_0x4545('0x46')](_0x4545('0x8e'));}else{_0x1178f3[_0x4545('0x46')](_0x4545('0x78'),_[_0x4545('0x2e')](_0x45ee11,'id'));_0x46123d[_0x4545('0x46')](_0x4545('0x78'),_[_0x4545('0x2e')](_0x45ee11,'id'));}});})[_0x4545('0x28')](function(){db[_0x4545('0x8f')][_0x4545('0x3c')](_0x1178f3[_0x4545('0x90')](),_0x127202)[_0x4545('0x28')](function(_0x49baaa){_0x36f4b9[_0x4545('0x1f')]=_0x49baaa[_0x4545('0x41')];if(_0x36f4b9[_0x4545('0x1f')]===0x0)return[];return db[_0x4545('0x8f')][_0x4545('0x3c')](_0x299869['toString'](),_0x127202)[_0x4545('0x28')](function(_0x4399d7){_0x3d308e=_[_0x4545('0x91')](_0x4399d7,'id');_0x127202=_[_0x4545('0x92')](_0x127202,{'model':db[_0x4545('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16acf4['query'][_0x4545('0x40')]){_0x1abc06['attributes'][_0x4545('0x33')](function(_0x3f096a){_0x46123d[_0x4545('0x48')]('i.'+_0x3f096a);});}else{_0x46123d[_0x4545('0x48')](_0x4545('0x88'),_0x4545('0x61'));_0x46123d['field'](_0x4545('0x93'),_0x4545('0x94'));_0x46123d[_0x4545('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x46123d[_0x4545('0x48')](_0x4545('0x95'));_0x46123d[_0x4545('0x48')](_0x4545('0x96'),_0x4545('0x97'));_0x46123d[_0x4545('0x48')](_0x4545('0x98'),_0x4545('0x99'));_0x46123d[_0x4545('0x48')]('c.email','Contact.email');_0x46123d[_0x4545('0x48')](_0x4545('0x9a'),_0x4545('0x9b'));_0x46123d[_0x4545('0x48')](_0x4545('0x9c'),_0x4545('0x9d'));_0x46123d[_0x4545('0x48')](_0x4545('0x9e'),_0x4545('0x9f'));_0x46123d[_0x4545('0x48')]('o.fullname',_0x4545('0xa0'));_0x46123d['field'](_0x4545('0xa1'),'Owner.internal');_0x46123d[_0x4545('0x48')](_0x4545('0xa2'),_0x4545('0x30'));}if(_0x1abc06[_0x4545('0x20')])_0x46123d['limit'](_0x1abc06[_0x4545('0x20')]);if(_0x1abc06[_0x4545('0x43')])_0x46123d[_0x4545('0x43')](_0x1abc06[_0x4545('0x43')]);return db['sequelize']['query'](_0x46123d[_0x4545('0x90')](),_0x127202);})[_0x4545('0x28')](function(_0x4ec72d){_0x427554[_0x4545('0x46')](_0x4545('0xa3'),_[_0x4545('0x2e')](_0x4ec72d,'id'));return db[_0x4545('0x8f')][_0x4545('0x3c')](_0x427554[_0x4545('0x90')](),_0x127202)[_0x4545('0x28')](function(_0x2db58f){var _0x21f6f7=_[_0x4545('0xa4')](_0x2db58f,_0x4545('0xa5'));var _0x4a3bcc=[];_0x4ec72d[_0x4545('0x33')](function(_0x30bf62){_0x4a3bcc[_0x4545('0x34')](updateFaxInteraction(_0x30bf62,_0x3d308e,_0x21f6f7));});return BPromise[_0x4545('0xa6')](_0x4a3bcc);});});})[_0x4545('0x28')](function(_0x37e18b){_0x36f4b9[_0x4545('0xa7')]=_0x37e18b;return _0x36f4b9;})[_0x4545('0x28')](respondWithFilteredResult(_0x54ea62,_0x1abc06));})[_0x4545('0x35')](handleError(_0x54ea62,null));};exports[_0x4545('0xa8')]=function(_0x2573e7,_0x5675f5){var _0x21c6fd={'raw':![],'where':{'id':_0x2573e7[_0x4545('0xa9')]['id']}},_0x34165c={};_0x34165c[_0x4545('0x3b')]=_['keys'](db['FaxInteraction'][_0x4545('0xaa')]);_0x34165c['query']=_['keys'](_0x2573e7['query']);_0x34165c[_0x4545('0x47')]=_[_0x4545('0x3f')](_0x34165c[_0x4545('0x3b')],_0x34165c[_0x4545('0x3c')]);_0x21c6fd[_0x4545('0x3e')]=_[_0x4545('0x3f')](_0x34165c[_0x4545('0x3b')],qs[_0x4545('0x40')](_0x2573e7[_0x4545('0x3c')][_0x4545('0x40')]));_0x21c6fd[_0x4545('0x3e')]=_0x21c6fd[_0x4545('0x3e')][_0x4545('0x41')]?_0x21c6fd['attributes']:_0x34165c[_0x4545('0x3b')];if(_0x2573e7[_0x4545('0x3c')][_0x4545('0xab')]){_0x21c6fd[_0x4545('0xac')]=[{'all':!![]}];}_0x21c6fd=_[_0x4545('0x92')]({},_0x21c6fd,_0x2573e7[_0x4545('0xad')]);return db['FaxInteraction'][_0x4545('0x60')](_0x21c6fd)[_0x4545('0x28')](handleEntityNotFound(_0x5675f5,null))[_0x4545('0x28')](respondWithResult(_0x5675f5,null))[_0x4545('0x35')](handleError(_0x5675f5,null));};exports[_0x4545('0xae')]=function(_0x9583c7,_0xc2b350){return db[_0x4545('0x37')][_0x4545('0xae')](_0x9583c7[_0x4545('0x74')],{})[_0x4545('0x28')](respondWithResult(_0xc2b350,0xc9))[_0x4545('0x35')](handleError(_0xc2b350,null));};exports[_0x4545('0x26')]=function(_0x4dba03,_0x2e194e){if(_0x4dba03[_0x4545('0x74')]['id']){delete _0x4dba03[_0x4545('0x74')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x4dba03[_0x4545('0xa9')]['id']}})[_0x4545('0x28')](handleEntityNotFound(_0x2e194e,null))[_0x4545('0x28')](saveUpdates(_0x4dba03[_0x4545('0x74')],null))[_0x4545('0x28')](respondWithResult(_0x2e194e,null))[_0x4545('0x35')](handleError(_0x2e194e,null));};exports[_0x4545('0x27')]=function(_0x5ee905,_0x244533){return db[_0x4545('0x37')][_0x4545('0x60')]({'where':{'id':_0x5ee905[_0x4545('0xa9')]['id']}})[_0x4545('0x28')](handleEntityNotFound(_0x244533,null))[_0x4545('0x28')](removeEntity(_0x244533,null))[_0x4545('0x35')](handleError(_0x244533,null));};exports[_0x4545('0xaf')]=function(_0x2dec48,_0x49ebc0){return db[_0x4545('0x37')][_0x4545('0xaf')]()[_0x4545('0x28')](respondWithResult(_0x49ebc0,null))['catch'](handleError(_0x49ebc0,null));};exports[_0x4545('0xb0')]=function(_0x2a56bb,_0x5c05eb,_0x1e12e2){return db[_0x4545('0xb1')][_0x4545('0x60')]({'where':{'id':_0x2a56bb[_0x4545('0xa9')]['id']}})[_0x4545('0x28')](handleEntityNotFound(_0x5c05eb,null))[_0x4545('0x28')](function(_0x2ae1e2){if(_0x2ae1e2){return _0x2ae1e2[_0x4545('0xb0')](_0x2a56bb[_0x4545('0x74')][_0x4545('0xb2')],_[_0x4545('0xb3')](_0x2a56bb[_0x4545('0x74')],[_0x4545('0xb2'),'id'])||{});}})[_0x4545('0x28')](respondWithResult(_0x5c05eb,null))[_0x4545('0x35')](handleError(_0x5c05eb,null));};exports[_0x4545('0xb4')]=function(_0x24281c,_0x9bf7d5,_0x4c948c){var _0x5310bd={'raw':![],'where':{}};var _0x257d4a={};var _0x35c9f0={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x4545('0xb5')]({'where':{'id':_0x24281c[_0x4545('0xa9')]['id']}})[_0x4545('0x28')](handleEntityNotFound(_0x9bf7d5,null))[_0x4545('0x28')](function(_0x22aff2){if(_0x22aff2){_0x257d4a[_0x4545('0x3b')]=_[_0x4545('0x3d')](db[_0x4545('0xb1')]['rawAttributes']);_0x257d4a[_0x4545('0x3c')]=_[_0x4545('0x3d')](_0x24281c[_0x4545('0x3c')]);_0x257d4a['filters']=_[_0x4545('0x3f')](_0x257d4a[_0x4545('0x3b')],_0x257d4a[_0x4545('0x3c')]);_0x5310bd[_0x4545('0x3e')]=_[_0x4545('0x3f')](_0x257d4a[_0x4545('0x3b')],qs[_0x4545('0x40')](_0x24281c[_0x4545('0x3c')][_0x4545('0x40')]));_0x5310bd['attributes']=_0x5310bd[_0x4545('0x3e')][_0x4545('0x41')]?_0x5310bd[_0x4545('0x3e')]:_0x257d4a['model'];if(!_0x24281c[_0x4545('0x3c')]['hasOwnProperty'](_0x4545('0xb6'))){_0x5310bd['limit']=qs[_0x4545('0x20')](_0x24281c[_0x4545('0x3c')][_0x4545('0x20')]);_0x5310bd[_0x4545('0x43')]=qs[_0x4545('0x43')](_0x24281c[_0x4545('0x3c')][_0x4545('0x43')]);}_0x5310bd[_0x4545('0x44')]=qs[_0x4545('0x45')](_0x24281c[_0x4545('0x3c')]['sort']);_0x5310bd[_0x4545('0x46')]=qs['filters'](_['pick'](_0x24281c[_0x4545('0x3c')],_0x257d4a[_0x4545('0x47')]));_0x5310bd[_0x4545('0x46')][_0x4545('0xa5')]=_0x22aff2['id'];if(_0x24281c['query'][_0x4545('0x7f')]){_0x5310bd['where']=_[_0x4545('0x92')](_0x5310bd[_0x4545('0x46')],{'$or':_['map'](_0x5310bd['attributes'],function(_0x3c74a4){var _0x1cbdba={};_0x1cbdba[_0x3c74a4]={'$like':'%'+_0x24281c[_0x4545('0x3c')][_0x4545('0x7f')]+'%'};return _0x1cbdba;})});}if(_0x24281c[_0x4545('0x3c')]['$gte']){var _0x2b736b=_0x24281c[_0x4545('0x3c')]['$gte']['split'](',');var _0x4edd00={};_0x4edd00[_0x2b736b[0x0]]={'$gte':moment(_0x2b736b[0x1])[_0x4545('0xb7')](_0x4545('0xb8'))};_0x5310bd['where']=_['merge'](_0x5310bd[_0x4545('0x46')],_0x4edd00);}_0x5310bd=_[_0x4545('0x92')]({},_0x5310bd,_0x24281c[_0x4545('0xad')]);return db[_0x4545('0xb1')][_0x4545('0x1f')]({'where':_0x5310bd[_0x4545('0x46')]})[_0x4545('0x28')](function(_0x5b2dd6){_0x35c9f0['count']=_0x5b2dd6;if(_0x24281c[_0x4545('0x3c')][_0x4545('0xab')]){_0x5310bd[_0x4545('0xac')]=[{'all':!![]}];}return db[_0x4545('0xb1')][_0x4545('0xb9')](_0x5310bd);})[_0x4545('0x28')](function(_0xecf5da){_0x35c9f0[_0x4545('0xa7')]=_0xecf5da;return _0x35c9f0;});}})[_0x4545('0x28')](respondWithFilteredResult(_0x9bf7d5,_0x5310bd))[_0x4545('0x35')](handleError(_0x9bf7d5,null));};exports['addTags']=function(_0x280a65,_0xbbb9da,_0x569cb1){return db[_0x4545('0x37')][_0x4545('0x60')]({'where':{'id':_0x280a65[_0x4545('0xa9')]['id']}})['then'](handleEntityNotFound(_0xbbb9da,null))[_0x4545('0x28')](function(_0x39065d){if(_0x39065d){return _0x39065d[_0x4545('0xba')](_0x280a65[_0x4545('0x74')][_0x4545('0xb2')],_[_0x4545('0xb3')](_0x280a65['body'],[_0x4545('0xb2'),'id'])||{})['spread'](function(){return db[_0x4545('0x6e')][_0x4545('0xb9')]({'attributes':['id',_0x4545('0x2c'),_0x4545('0x49')],'where':{'id':_0x280a65[_0x4545('0x74')][_0x4545('0xb2')]}});})[_0x4545('0x28')](function(_0x2b4f20){socket['emit'](_0x4545('0xbb'),{'id':Number(_0x280a65['params']['id']),'tags':_0x2b4f20||[]});return{'id':Number(_0x280a65[_0x4545('0xa9')]['id']),'tags':_0x2b4f20||[]};});}})[_0x4545('0x28')](respondWithResult(_0xbbb9da,null))['catch'](handleError(_0xbbb9da,null));};exports[_0x4545('0xbc')]=function(_0x4aa081,_0x322e83,_0x2cb16f){return db['FaxInteraction']['find']({'where':{'id':_0x4aa081[_0x4545('0xa9')]['id']}})['then'](handleEntityNotFound(_0x322e83,null))[_0x4545('0x28')](function(_0x42e024){if(_0x42e024){return _0x42e024['removeTags'](_0x4aa081['query']['ids']);}})[_0x4545('0x28')](respondWithStatusCode(_0x322e83,null))[_0x4545('0x35')](handleError(_0x322e83,null));};exports[_0x4545('0xbd')]=function(_0x590657,_0x3d6df9){var _0x5cb382=moment()[_0x4545('0xbe')]()[_0x4545('0x90')]();var _0x44db91=path[_0x4545('0xbf')](config[_0x4545('0xc0')],_0x4545('0xc1'),_0x4545('0xc2'),'tmp');var _0x37f6e6=path[_0x4545('0xbf')](config['root'],_0x4545('0xc1'),'files',_0x4545('0xc3'));var _0x43a147=path['join'](_0x44db91,_0x5cb382);var _0x2e1d6b=util[_0x4545('0xb7')](_0x4545('0xc4'),_0x590657[_0x4545('0xa9')]['id'],_0x5cb382);var _0x3efc5d=path['join'](_0x44db91,_0x2e1d6b);var _0x280cd5=[];_0x280cd5[_0x4545('0x34')]({'model':db['Attachment'],'as':_0x4545('0xc5'),'raw':!![]});var _0x38fc3f=[{'model':db['FaxMessage'],'as':_0x4545('0xc6'),'attributes':['id',_0x4545('0x74'),_0x4545('0x7a')],'include':_0x280cd5}];return db['FaxInteraction'][_0x4545('0x60')]({'where':{'id':_0x590657['params']['id']},'include':_0x38fc3f})['then'](handleEntityNotFound(_0x3d6df9,null))[_0x4545('0x28')](function(_0x2e775c){if(_0x2e775c&&_0x2e775c[_0x4545('0xc6')]){var _0x39a68e=_0x2e775c['get']({'plain':!![]});fs[_0x4545('0xc7')](_0x43a147);for(var _0x2c6859=0x0;_0x2c6859<_0x39a68e[_0x4545('0xc6')][_0x4545('0x41')];_0x2c6859++){var _0x3731be=_0x39a68e[_0x4545('0xc6')][_0x2c6859][_0x4545('0xc5')];if(_0x3731be){var _0x5b23f4=path[_0x4545('0xbf')](_0x37f6e6,_0x3731be[_0x4545('0xc8')]);if(fs[_0x4545('0xc9')](_0x5b23f4)){fs[_0x4545('0xca')](_0x5b23f4)[_0x4545('0xcb')](fs['createWriteStream'](path[_0x4545('0xbf')](_0x43a147,_0x3731be['basename'])));}}}return BPromise[_0x4545('0xcc')]()[_0x4545('0x28')](function(){return new BPromise(function(_0x59edc8,_0x1e0a47){zipdir(_0x43a147,{'saveTo':_0x3efc5d},function(_0x3bcbd5,_0x1642f2){if(_0x3bcbd5)return _0x1e0a47(_0x3bcbd5);return _0x59edc8(_0x1642f2);});})[_0x4545('0x28')](function(){return new BPromise(function(_0x657fbf,_0x2e5a51){rimraf(_0x43a147,function(_0x305322){if(_0x305322)_0x2e5a51(_0x305322);return _0x657fbf();});});})[_0x4545('0x28')](function(){return _0x3d6df9[_0x4545('0xbd')](_0x3efc5d,_0x2e1d6b,function(_0x9d5b7f){if(_0x9d5b7f){console['log']('err',_0x9d5b7f);}else{fs[_0x4545('0xcd')](_0x3efc5d);}});});});}else{return _0x3d6df9['sendStatus'](0xc8);}})['catch'](handleError(_0x3d6df9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2a9e555..51ea2e7 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x218b21,_0x123331){var _0x5a1239=function(_0x1cafcb){while(--_0x1cafcb){_0x218b21['push'](_0x218b21['shift']());}};_0x5a1239(++_0x123331);}(_0x326f,0xd1));var _0xf326=function(_0x1a3b3d,_0x38dc32){_0x1a3b3d=_0x1a3b3d-0x0;var _0x2ea095=_0x326f[_0x1a3b3d];return _0x2ea095;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 60e2308..1658d16 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 _0x6f0d=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define'];(function(_0x862be0,_0x263d9a){var _0xf5ec21=function(_0x30d027){while(--_0x30d027){_0x862be0['push'](_0x862be0['shift']());}};_0xf5ec21(++_0x263d9a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x234971,_0x4327a1){_0x234971=_0x234971-0x0;var _0x2b72f6=_0x6f0d[_0x234971];return _0x2b72f6;};'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':!![],'hooks':{'beforeUpdate':function(_0x1a48a0,_0x4c4916,_0x507048){if(_0x1a48a0[_0xd6f0('0xc')](_0xd6f0('0xd'))){_0x1a48a0[_0xd6f0('0xe')]=moment()[_0xd6f0('0xf')](_0xd6f0('0x10'));}_0x507048(null,_0x1a48a0);}}});}; \ No newline at end of file +var _0xdace=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closed'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdace,0xc5));var _0xedac=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xdace[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x162eea,_0x53fa43,_0x27243f){if(_0x162eea[_0xedac('0xb')](_0xedac('0xc'))){_0x162eea['closedAt']=moment()['format'](_0xedac('0xd'));}_0x27243f(null,_0x162eea);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 788dce4..2304a67 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 _0x06a9=['options','raw','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body'];(function(_0x5314a3,_0x485f48){var _0x50a0de=function(_0x4de78a){while(--_0x4de78a){_0x5314a3['push'](_0x5314a3['shift']());}};_0x50a0de(++_0x485f48);}(_0x06a9,0x101));var _0x906a=function(_0x4045f3,_0x555e1d){_0x4045f3=_0x4045f3-0x0;var _0x588eb2=_0x06a9[_0x4045f3];return _0x588eb2;};'use strict';var _=require(_0x906a('0x0'));var util=require('util');var moment=require(_0x906a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x906a('0x2'));var db=require(_0x906a('0x3'))['db'];var utils=require(_0x906a('0x4'));var logger=require(_0x906a('0x5'))(_0x906a('0x6'));var config=require('../../config/environment');var jayson=require(_0x906a('0x7'));var client=jayson[_0x906a('0x8')][_0x906a('0x9')]({'port':0x232a});config[_0x906a('0xa')]=_[_0x906a('0xb')](config[_0x906a('0xa')],{'host':_0x906a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0x906a('0xd')](socket);function respondWithRpcPromise(_0x531d4b,_0x3185b3,_0x41cd87){return new BPromise(function(_0x36a410,_0xf12ec8){return client[_0x906a('0xe')](_0x531d4b,_0x41cd87)[_0x906a('0xf')](function(_0x2ddc1a){logger[_0x906a('0x10')](_0x906a('0x11'),_0x3185b3,_0x906a('0x12'));logger[_0x906a('0x13')](_0x906a('0x14'),_0x3185b3,_0x906a('0x12'),JSON[_0x906a('0x15')](_0x2ddc1a));if(_0x2ddc1a[_0x906a('0x16')]){if(_0x2ddc1a[_0x906a('0x16')][_0x906a('0x17')]===0x1f4){logger['error'](_0x906a('0x11'),_0x3185b3,_0x2ddc1a[_0x906a('0x16')][_0x906a('0x18')]);return _0xf12ec8(_0x2ddc1a[_0x906a('0x16')][_0x906a('0x18')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3185b3,_0x2ddc1a[_0x906a('0x16')][_0x906a('0x18')]);return _0x36a410(_0x2ddc1a['error']['message']);}else{logger[_0x906a('0x10')](_0x906a('0x11'),_0x3185b3,_0x906a('0x12'));_0x36a410(_0x2ddc1a['result'][_0x906a('0x18')]);}})[_0x906a('0x19')](function(_0x44f85d){logger[_0x906a('0x16')](_0x906a('0x11'),_0x3185b3,_0x44f85d);_0xf12ec8(_0x44f85d);});});}exports[_0x906a('0x1a')]=function(_0x2e1960){var _0x53ae34=this;return new Promise(function(_0x3f32bb,_0x2edf13){return db[_0x906a('0x1b')][_0x906a('0x1c')](_0x2e1960[_0x906a('0x1d')],{'raw':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')][_0x906a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')]['where']||null:null,'attributes':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')][_0x906a('0x20')]||null:null,'limit':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')][_0x906a('0x21')]||null:null})[_0x906a('0xf')](function(_0x1ca4e2){logger['info'](_0x906a('0x1a'),_0x2e1960);logger[_0x906a('0x13')](_0x906a('0x1a'),_0x2e1960,JSON[_0x906a('0x15')](_0x1ca4e2));_0x3f32bb(_0x1ca4e2);})['catch'](function(_0x4177ce){logger[_0x906a('0x16')]('UpdateFaxInteraction',_0x4177ce[_0x906a('0x18')],_0x2e1960);_0x2edf13(_0x53ae34[_0x906a('0x16')](0x1f4,_0x4177ce['message']));});});};exports[_0x906a('0x22')]=function(_0x1f4bff){return new Promise(function(_0x30ad99,_0x4a8d1e){return db[_0x906a('0x1b')][_0x906a('0x23')]({'where':_0x1f4bff['options']?_0x1f4bff[_0x906a('0x1e')][_0x906a('0x24')]||null:null})['then'](function(_0x4294be){if(_0x4294be){return _0x4294be[_0x906a('0x25')](_0x1f4bff[_0x906a('0x1d')][_0x906a('0x26')],_[_0x906a('0x27')](_0x1f4bff[_0x906a('0x1d')],['ids','id'])||{});}})['spread'](function(_0x361353){logger[_0x906a('0x10')](_0x906a('0x28'),_0x1f4bff);logger['debug'](_0x906a('0x28'),_0x1f4bff,JSON[_0x906a('0x15')](_0x361353));_0x30ad99(_0x361353);})[_0x906a('0x19')](function(_0x891f93){logger[_0x906a('0x16')]('AddTags',_0x891f93[_0x906a('0x18')],_0x1f4bff);_0x4a8d1e(_this['error'](0x1f4,_0x891f93[_0x906a('0x18')]));});});}; \ No newline at end of file +var _0xb6d5=['raw','where','limit','AddTagsToFaxInteraction','FaxInteraction','find','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','body','options'];(function(_0x393775,_0x204e3f){var _0x9b5d4a=function(_0x14a32b){while(--_0x14a32b){_0x393775['push'](_0x393775['shift']());}};_0x9b5d4a(++_0x204e3f);}(_0xb6d5,0x13e));var _0x5b6d=function(_0x28876d,_0x46f49d){_0x28876d=_0x28876d-0x0;var _0x1eb326=_0xb6d5[_0x28876d];return _0x1eb326;};'use strict';var _=require(_0x5b6d('0x0'));var util=require(_0x5b6d('0x1'));var moment=require('moment');var BPromise=require(_0x5b6d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b6d('0x3'));var db=require(_0x5b6d('0x4'))['db'];var utils=require(_0x5b6d('0x5'));var logger=require(_0x5b6d('0x6'))(_0x5b6d('0x7'));var config=require(_0x5b6d('0x8'));var jayson=require(_0x5b6d('0x9'));var client=jayson[_0x5b6d('0xa')][_0x5b6d('0xb')]({'port':0x232a});config[_0x5b6d('0xc')]=_[_0x5b6d('0xd')](config[_0x5b6d('0xc')],{'host':_0x5b6d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b6d('0xc')]));require(_0x5b6d('0xf'))[_0x5b6d('0x10')](socket);function respondWithRpcPromise(_0x57ba99,_0x5d7059,_0x454819){return new BPromise(function(_0xace9b2,_0x1e5306){return client[_0x5b6d('0x11')](_0x57ba99,_0x454819)[_0x5b6d('0x12')](function(_0x693a7f){logger[_0x5b6d('0x13')](_0x5b6d('0x14'),_0x5d7059,_0x5b6d('0x15'));logger[_0x5b6d('0x16')](_0x5b6d('0x17'),_0x5d7059,_0x5b6d('0x15'),JSON[_0x5b6d('0x18')](_0x693a7f));if(_0x693a7f[_0x5b6d('0x19')]){if(_0x693a7f[_0x5b6d('0x19')][_0x5b6d('0x1a')]===0x1f4){logger[_0x5b6d('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5d7059,_0x693a7f[_0x5b6d('0x19')][_0x5b6d('0x1b')]);return _0x1e5306(_0x693a7f[_0x5b6d('0x19')][_0x5b6d('0x1b')]);}logger[_0x5b6d('0x19')](_0x5b6d('0x14'),_0x5d7059,_0x693a7f[_0x5b6d('0x19')][_0x5b6d('0x1b')]);return _0xace9b2(_0x693a7f['error']['message']);}else{logger['info'](_0x5b6d('0x14'),_0x5d7059,_0x5b6d('0x15'));_0xace9b2(_0x693a7f[_0x5b6d('0x1c')][_0x5b6d('0x1b')]);}})[_0x5b6d('0x1d')](function(_0x50ac1b){logger[_0x5b6d('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5d7059,_0x50ac1b);_0x1e5306(_0x50ac1b);});});}exports[_0x5b6d('0x1e')]=function(_0x45e310){var _0x106caa=this;return new Promise(function(_0x23672c,_0x1b1eb6){return db['FaxInteraction'][_0x5b6d('0x1f')](_0x45e310[_0x5b6d('0x20')],{'raw':_0x45e310[_0x5b6d('0x21')]?_0x45e310[_0x5b6d('0x21')][_0x5b6d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e310[_0x5b6d('0x21')]?_0x45e310[_0x5b6d('0x21')][_0x5b6d('0x23')]||null:null,'attributes':_0x45e310[_0x5b6d('0x21')]?_0x45e310['options']['attributes']||null:null,'limit':_0x45e310[_0x5b6d('0x21')]?_0x45e310['options'][_0x5b6d('0x24')]||null:null})[_0x5b6d('0x12')](function(_0x39fdcf){logger[_0x5b6d('0x13')](_0x5b6d('0x1e'),_0x45e310);logger['debug']('UpdateFaxInteraction',_0x45e310,JSON[_0x5b6d('0x18')](_0x39fdcf));_0x23672c(_0x39fdcf);})['catch'](function(_0x5afbc5){logger[_0x5b6d('0x19')](_0x5b6d('0x1e'),_0x5afbc5[_0x5b6d('0x1b')],_0x45e310);_0x1b1eb6(_0x106caa[_0x5b6d('0x19')](0x1f4,_0x5afbc5[_0x5b6d('0x1b')]));});});};exports[_0x5b6d('0x25')]=function(_0x49efef){return new Promise(function(_0x1d88c2,_0x5b86d7){return db[_0x5b6d('0x26')][_0x5b6d('0x27')]({'where':_0x49efef[_0x5b6d('0x21')]?_0x49efef[_0x5b6d('0x21')]['where']||null:null})[_0x5b6d('0x12')](function(_0x4683eb){if(_0x4683eb){return _0x4683eb['addTags'](_0x49efef['body'][_0x5b6d('0x28')],_[_0x5b6d('0x29')](_0x49efef[_0x5b6d('0x20')],['ids','id'])||{});}})[_0x5b6d('0x2a')](function(_0x1832f5){logger[_0x5b6d('0x13')](_0x5b6d('0x2b'),_0x49efef);logger[_0x5b6d('0x16')]('AddTags',_0x49efef,JSON[_0x5b6d('0x18')](_0x1832f5));_0x1d88c2(_0x1832f5);})[_0x5b6d('0x1d')](function(_0x27e99c){logger[_0x5b6d('0x19')]('AddTags',_0x27e99c['message'],_0x49efef);_0x5b86d7(_this[_0x5b6d('0x19')](0x1f4,_0x27e99c[_0x5b6d('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bec91f1..e8295cd 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 _0x93ab=['update','emit','removeListener','register','faxInteraction:','./faxInteraction.events','remove'];(function(_0x5bd0cb,_0x175893){var _0x35a125=function(_0x3365c7){while(--_0x3365c7){_0x5bd0cb['push'](_0x5bd0cb['shift']());}};_0x35a125(++_0x175893);}(_0x93ab,0x17f));var _0xb93a=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x93ab[_0x2442b9];return _0x31b571;};'use strict';var FaxInteractionEvents=require(_0xb93a('0x0'));var events=['save',_0xb93a('0x1'),_0xb93a('0x2')];function createListener(_0xee2555,_0x185664){return function(_0x3db4b7){_0x185664[_0xb93a('0x3')](_0xee2555,_0x3db4b7);};}function removeListener(_0x4e1b2e,_0x310446){return function(){FaxInteractionEvents[_0xb93a('0x4')](_0x4e1b2e,_0x310446);};}exports[_0xb93a('0x5')]=function(_0x28bda1){for(var _0x4fa642=0x0,_0x1ce07=events['length'];_0x4fa642<_0x1ce07;_0x4fa642++){var _0x40cbbc=events[_0x4fa642];var _0x372253=createListener(_0xb93a('0x6')+_0x40cbbc,_0x28bda1);FaxInteractionEvents['on'](_0x40cbbc,_0x372253);}}; \ No newline at end of file +var _0xdb78=['emit','removeListener','length','faxInteraction:','save','remove','update'];(function(_0x8b94ff,_0x1f846d){var _0x367202=function(_0x243ce9){while(--_0x243ce9){_0x8b94ff['push'](_0x8b94ff['shift']());}};_0x367202(++_0x1f846d);}(_0xdb78,0x1bd));var _0x8db7=function(_0x3d60bb,_0x2b95ee){_0x3d60bb=_0x3d60bb-0x0;var _0x11cef9=_0xdb78[_0x3d60bb];return _0x11cef9;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x8db7('0x0'),_0x8db7('0x1'),_0x8db7('0x2')];function createListener(_0x26d69c,_0x3fa1d4){return function(_0x1ae6f5){_0x3fa1d4[_0x8db7('0x3')](_0x26d69c,_0x1ae6f5);};}function removeListener(_0x24736b,_0x3fa728){return function(){FaxInteractionEvents[_0x8db7('0x4')](_0x24736b,_0x3fa728);};}exports['register']=function(_0x4f4cac){for(var _0x43313f=0x0,_0x5e732a=events[_0x8db7('0x5')];_0x43313f<_0x5e732a;_0x43313f++){var _0xea9750=events[_0x43313f];var _0x2dcf43=createListener(_0x8db7('0x6')+_0xea9750,_0x4f4cac);FaxInteractionEvents['on'](_0xea9750,_0x2dcf43);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 231fd16..87ff359 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 _0xc995=['get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','faxinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated'];(function(_0x485cac,_0x3186fc){var _0x3790e8=function(_0x4df115){while(--_0x4df115){_0x485cac['push'](_0x485cac['shift']());}};_0x3790e8(++_0x3186fc);}(_0xc995,0x8c));var _0x5c99=function(_0x503f63,_0xe5c883){_0x503f63=_0x503f63-0x0;var _0x12a3f9=_0xc995[_0x503f63];return _0x12a3f9;};'use strict';var multer=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var path=require(_0x5c99('0x2'));var timeout=require(_0x5c99('0x3'));var express=require(_0x5c99('0x4'));var router=express[_0x5c99('0x5')]();var auth=require(_0x5c99('0x6'));var interaction=require(_0x5c99('0x7'));var config=require('../../config/environment');var controller=require(_0x5c99('0x8'));router['get']('/',auth[_0x5c99('0x9')](),controller['index']);router[_0x5c99('0xa')](_0x5c99('0xb'),auth[_0x5c99('0x9')](),controller[_0x5c99('0xc')]);router['get'](_0x5c99('0xd'),auth[_0x5c99('0x9')](),controller[_0x5c99('0xe')]);router[_0x5c99('0xa')](_0x5c99('0xf'),auth['isAuthenticated'](),controller[_0x5c99('0x10')]);router[_0x5c99('0xa')]('/:id/download',auth[_0x5c99('0x9')](),controller[_0x5c99('0x11')]);router[_0x5c99('0x12')]('/',auth[_0x5c99('0x9')](),controller[_0x5c99('0x13')]);router[_0x5c99('0x12')](_0x5c99('0xf'),auth[_0x5c99('0x9')](),controller['addMessage']);router[_0x5c99('0x12')](_0x5c99('0x14'),auth[_0x5c99('0x9')](),interaction[_0x5c99('0x15')](_0x5c99('0x16'),_0x5c99('0x17')),controller['addTags']);router[_0x5c99('0x18')]('/:id',auth[_0x5c99('0x9')](),interaction['tracked']('fax',_0x5c99('0x19')),controller[_0x5c99('0x1a')]);router[_0x5c99('0x1b')]('/:id',auth[_0x5c99('0x9')](),interaction[_0x5c99('0x15')](_0x5c99('0x16'),_0x5c99('0x1c')),controller['destroy']);router[_0x5c99('0x1b')](_0x5c99('0x14'),auth[_0x5c99('0x9')](),controller['removeTags']);module[_0x5c99('0x1d')]=router; \ No newline at end of file +var _0xfe11=['get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfe11,0x94));var _0x1fe1=function(_0x567fff,_0xd8acd8){_0x567fff=_0x567fff-0x0;var _0x465a37=_0xfe11[_0x567fff];return _0x465a37;};'use strict';var multer=require(_0x1fe1('0x0'));var util=require(_0x1fe1('0x1'));var path=require(_0x1fe1('0x2'));var timeout=require(_0x1fe1('0x3'));var express=require(_0x1fe1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1fe1('0x5'));var config=require(_0x1fe1('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1fe1('0x7')](_0x1fe1('0x8'),auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xa')]);router['get'](_0x1fe1('0xb'),auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xc')]);router[_0x1fe1('0x7')](_0x1fe1('0xd'),auth[_0x1fe1('0x9')](),controller[_0x1fe1('0xe')]);router[_0x1fe1('0x7')](_0x1fe1('0xf'),auth[_0x1fe1('0x9')](),controller['download']);router[_0x1fe1('0x10')]('/',auth[_0x1fe1('0x9')](),controller[_0x1fe1('0x11')]);router['post']('/:id/messages',auth[_0x1fe1('0x9')](),controller[_0x1fe1('0x12')]);router[_0x1fe1('0x10')](_0x1fe1('0x13'),auth[_0x1fe1('0x9')](),interaction[_0x1fe1('0x14')](_0x1fe1('0x15'),_0x1fe1('0x16')),controller[_0x1fe1('0x17')]);router[_0x1fe1('0x18')](_0x1fe1('0xb'),auth[_0x1fe1('0x9')](),interaction['tracked'](_0x1fe1('0x15'),_0x1fe1('0x19')),controller[_0x1fe1('0x1a')]);router[_0x1fe1('0x1b')](_0x1fe1('0xb'),auth[_0x1fe1('0x9')](),interaction['tracked'](_0x1fe1('0x15'),_0x1fe1('0x1c')),controller[_0x1fe1('0x1d')]);router[_0x1fe1('0x1b')](_0x1fe1('0x13'),auth[_0x1fe1('0x9')](),controller[_0x1fe1('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f13ff85..6ae4e60 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 _0xc38e=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc38e,0x9b));var _0xec38=function(_0x13c458,_0x138ec5){_0x13c458=_0x13c458-0x0;var _0x2cac34=_0xc38e[_0x13c458];return _0x2cac34;};'use strict';var Sequelize=require(_0xec38('0x0'));module[_0xec38('0x1')]={'body':{'type':Sequelize[_0xec38('0x2')](_0xec38('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xec38('0x4')]('in','out'),'defaultValue':_0xec38('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xec38('0x6')]}}; \ No newline at end of file +var _0xd087=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x1bc1de,_0x25c6ca){var _0x21d681=function(_0x499869){while(--_0x499869){_0x1bc1de['push'](_0x1bc1de['shift']());}};_0x21d681(++_0x25c6ca);}(_0xd087,0xcf));var _0x7d08=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0xd087[_0x563129];return _0x28d1a3;};'use strict';var Sequelize=require(_0x7d08('0x0'));module[_0x7d08('0x1')]={'body':{'type':Sequelize[_0x7d08('0x2')](_0x7d08('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7d08('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7d08('0x5')]('in',_0x7d08('0x6')),'defaultValue':_0x7d08('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x7d08('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2f4879d..c94ee4d 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 _0x5f09=['interface','SIP/%s','event','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','download','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.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','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','FaxMessage','includeAll','include','findAll','rows','show','params','rawAttributes','options','body','find','describe','fax-interactions','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','AcceptMessage','acceptMessage','manual','channel','accept','EventManager','acceptmessage','agent','info','null','rejectMessage'];(function(_0x4d639e,_0x3751bd){var _0xc52993=function(_0x2f6de2){while(--_0x2f6de2){_0x4d639e['push'](_0x4d639e['shift']());}};_0xc52993(++_0x3751bd);}(_0x5f09,0x124));var _0x95f0=function(_0x4ac1ed,_0x4e89a5){_0x4ac1ed=_0x4ac1ed-0x0;var _0x1a2eea=_0x5f09[_0x4ac1ed];return _0x1a2eea;};'use strict';var pdf=require(_0x95f0('0x0'));var emlformat=require(_0x95f0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x95f0('0x2'));var jsonpatch=require(_0x95f0('0x3'));var rp=require(_0x95f0('0x4'));var moment=require(_0x95f0('0x5'));var BPromise=require(_0x95f0('0x6'));var Mustache=require(_0x95f0('0x7'));var util=require('util');var path=require(_0x95f0('0x8'));var sox=require(_0x95f0('0x9'));var csv=require('to-csv');var ejs=require(_0x95f0('0xa'));var fs=require('fs');var _=require(_0x95f0('0xb'));var squel=require('squel');var crypto=require(_0x95f0('0xc'));var jsforce=require(_0x95f0('0xd'));var deskjs=require(_0x95f0('0xe'));var toCsv=require(_0x95f0('0xf'));var querystring=require(_0x95f0('0x10'));var Papa=require(_0x95f0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95f0('0x13'));var logger=require(_0x95f0('0x14'))(_0x95f0('0x15'));var utils=require('../../config/utils');var config=require(_0x95f0('0x16'));var db=require(_0x95f0('0x17'))['db'];config[_0x95f0('0x18')]=_[_0x95f0('0x19')](config[_0x95f0('0x18')],{'host':_0x95f0('0x1a'),'port':0x18eb});var socket=require(_0x95f0('0x1b'))(new Redis(config[_0x95f0('0x18')]));require(_0x95f0('0x1c'))[_0x95f0('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x95f0('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x95f0('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x4b9935,_0x407e2a,_0x2979ae){if(_0x2979ae){var _0x4397ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4397ad[_0x95f0('0x20')](_0x407e2a)){return _0x4b9935;}else{throw new db[(_0x95f0('0x21'))]['ValidationError'](_0x95f0('0x22'));}}else{return _0x4b9935;}}function respondWithRpcPromise(_0x1f0cc4,_0x3ff0e6,_0x276035,_0x3845c7){return new BPromise(function(_0x166999,_0x3b9c90){var _0x267700=_0x3845c7||client;return _0x267700[_0x95f0('0x23')](_0x1f0cc4,_0x276035)[_0x95f0('0x24')](function(_0x3a71bf){logger['info'](_0x95f0('0x25'),_0x3ff0e6,_0x95f0('0x26'));logger['debug'](_0x95f0('0x27'),_0x3ff0e6,'request\x20sent',JSON['stringify'](_0x3a71bf));if(_0x3a71bf[_0x95f0('0x28')]){if(_0x3a71bf['error']['code']===0x1f4){logger[_0x95f0('0x28')](_0x95f0('0x25'),_0x3ff0e6,_0x3a71bf['error']['message']);return _0x3b9c90(_0x3a71bf[_0x95f0('0x28')][_0x95f0('0x29')]);}logger[_0x95f0('0x28')](_0x95f0('0x25'),_0x3ff0e6,_0x3a71bf[_0x95f0('0x28')]['message']);return _0x166999(_0x3a71bf['error'][_0x95f0('0x29')]);}else{logger['info'](_0x95f0('0x25'),_0x3ff0e6,_0x95f0('0x26'));_0x166999(_0x3a71bf[_0x95f0('0x2a')][_0x95f0('0x29')]);}})[_0x95f0('0x2b')](function(_0x3dbae2){logger[_0x95f0('0x28')](_0x95f0('0x25'),_0x3ff0e6,_0x3dbae2);_0x3b9c90(_0x3dbae2);});});}function respondWithStatusCode(_0x3188bc,_0x1a4d89){_0x1a4d89=_0x1a4d89||0xcc;return function(_0x165275){if(_0x165275){return _0x3188bc['sendStatus'](_0x1a4d89);}return _0x3188bc[_0x95f0('0x2c')](_0x1a4d89)[_0x95f0('0x2d')]();};}function respondWithResult(_0x27e368,_0x1f712c){_0x1f712c=_0x1f712c||0xc8;return function(_0x2d913e){if(_0x2d913e){return _0x27e368[_0x95f0('0x2c')](_0x1f712c)[_0x95f0('0x2e')](_0x2d913e);}};}function respondWithFilteredResult(_0x22046a,_0x140dbb){return function(_0x2d94c0){if(_0x2d94c0){var _0x3114ae=_0x2d94c0[_0x95f0('0x2f')],_0x53ac90=_0x140dbb[_0x95f0('0x30')],_0x2b35ac=_0x140dbb[_0x95f0('0x30')]+_0x140dbb['limit'],_0x430f17;if(_0x2b35ac>=_0x3114ae){_0x2b35ac=_0x3114ae;_0x430f17=0xc8;}else{_0x430f17=0xce;}_0x22046a[_0x95f0('0x2c')](_0x430f17);return _0x22046a[_0x95f0('0x31')](_0x95f0('0x32'),_0x53ac90+'-'+_0x2b35ac+'/'+_0x3114ae)[_0x95f0('0x2e')](_0x2d94c0);}return null;};}function patchUpdates(_0x1a16a4){return function(_0x5cc10a){try{jsonpatch[_0x95f0('0x33')](_0x5cc10a,_0x1a16a4,!![]);}catch(_0x2a30cb){return BPromise[_0x95f0('0x34')](_0x2a30cb);}return _0x5cc10a[_0x95f0('0x35')]();};}function saveUpdates(_0x21a453,_0x12e398){return function(_0x3eafc6){if(_0x3eafc6){return _0x3eafc6[_0x95f0('0x36')](_0x21a453)[_0x95f0('0x24')](function(_0x1d04e5){return _0x1d04e5;});}return null;};}function removeEntity(_0x522747,_0x3c31ce){return function(_0x5dc0a3){if(_0x5dc0a3){return _0x5dc0a3[_0x95f0('0x37')]()['then'](function(){_0x522747[_0x95f0('0x2c')](0xcc)[_0x95f0('0x2d')]();});}};}function handleEntityNotFound(_0x448c09,_0x4d0216){return function(_0x1ec675){if(!_0x1ec675){_0x448c09[_0x95f0('0x38')](0x194);}return _0x1ec675;};}function handleError(_0x104f04,_0x2e2832){_0x2e2832=_0x2e2832||0x1f4;return function(_0x33dccd){logger['error'](_0x33dccd[_0x95f0('0x39')]);if(_0x33dccd[_0x95f0('0x3a')]){delete _0x33dccd[_0x95f0('0x3a')];}_0x104f04[_0x95f0('0x2c')](_0x2e2832)[_0x95f0('0x3b')](_0x33dccd);};}exports[_0x95f0('0x3c')]=function(_0x5a2b4e,_0x311f46){var _0x1aebf2={},_0x9c62a4={},_0x378f81={'count':0x0,'rows':[]};var _0x2548f8=_[_0x95f0('0x3d')](db['FaxMessage']['rawAttributes'],function(_0x1fb34e){return{'name':_0x1fb34e[_0x95f0('0x3e')],'type':_0x1fb34e[_0x95f0('0x3f')][_0x95f0('0x40')]};});_0x9c62a4['model']=_[_0x95f0('0x3d')](_0x2548f8,_0x95f0('0x3a'));_0x9c62a4[_0x95f0('0x41')]=_[_0x95f0('0x42')](_0x5a2b4e[_0x95f0('0x41')]);_0x9c62a4['filters']=_[_0x95f0('0x43')](_0x9c62a4['model'],_0x9c62a4['query']);_0x1aebf2[_0x95f0('0x44')]=_[_0x95f0('0x43')](_0x9c62a4[_0x95f0('0x45')],qs[_0x95f0('0x46')](_0x5a2b4e['query']['fields']));_0x1aebf2[_0x95f0('0x44')]=_0x1aebf2[_0x95f0('0x44')][_0x95f0('0x47')]?_0x1aebf2[_0x95f0('0x44')]:_0x9c62a4[_0x95f0('0x45')];if(!_0x5a2b4e[_0x95f0('0x41')]['hasOwnProperty'](_0x95f0('0x48'))){_0x1aebf2[_0x95f0('0x49')]=qs[_0x95f0('0x49')](_0x5a2b4e[_0x95f0('0x41')][_0x95f0('0x49')]);_0x1aebf2[_0x95f0('0x30')]=qs[_0x95f0('0x30')](_0x5a2b4e['query'][_0x95f0('0x30')]);}_0x1aebf2[_0x95f0('0x4a')]=qs[_0x95f0('0x4b')](_0x5a2b4e['query'][_0x95f0('0x4b')]);_0x1aebf2[_0x95f0('0x4c')]=qs[_0x95f0('0x4d')](_['pick'](_0x5a2b4e[_0x95f0('0x41')],_0x9c62a4[_0x95f0('0x4d')]),_0x2548f8);if(_0x5a2b4e['query'][_0x95f0('0x4e')]){_0x1aebf2['where']=_[_0x95f0('0x4f')](_0x1aebf2[_0x95f0('0x4c')],{'$or':_[_0x95f0('0x3d')](_0x2548f8,function(_0x5accca){if(_0x5accca[_0x95f0('0x3f')]!==_0x95f0('0x50')){var _0x388233={};_0x388233[_0x5accca[_0x95f0('0x3a')]]={'$like':'%'+_0x5a2b4e[_0x95f0('0x41')][_0x95f0('0x4e')]+'%'};return _0x388233;}})});}_0x1aebf2=_[_0x95f0('0x4f')]({},_0x1aebf2,_0x5a2b4e['options']);var _0x2a7fbb={'where':_0x1aebf2[_0x95f0('0x4c')]};return db[_0x95f0('0x51')][_0x95f0('0x2f')](_0x2a7fbb)[_0x95f0('0x24')](function(_0x1c7dd3){_0x378f81[_0x95f0('0x2f')]=_0x1c7dd3;if(_0x5a2b4e[_0x95f0('0x41')][_0x95f0('0x52')]){_0x1aebf2[_0x95f0('0x53')]=[{'all':!![]}];}return db[_0x95f0('0x51')][_0x95f0('0x54')](_0x1aebf2);})[_0x95f0('0x24')](function(_0x4b3de3){_0x378f81[_0x95f0('0x55')]=_0x4b3de3;return _0x378f81;})[_0x95f0('0x24')](respondWithFilteredResult(_0x311f46,_0x1aebf2))[_0x95f0('0x2b')](handleError(_0x311f46,null));};exports[_0x95f0('0x56')]=function(_0x21dc3f,_0xd1027){var _0x12daa5={'raw':!![],'where':{'id':_0x21dc3f[_0x95f0('0x57')]['id']}},_0xe97fd3={};_0xe97fd3[_0x95f0('0x45')]=_[_0x95f0('0x42')](db[_0x95f0('0x51')][_0x95f0('0x58')]);_0xe97fd3[_0x95f0('0x41')]=_[_0x95f0('0x42')](_0x21dc3f['query']);_0xe97fd3['filters']=_['intersection'](_0xe97fd3['model'],_0xe97fd3['query']);_0x12daa5[_0x95f0('0x44')]=_[_0x95f0('0x43')](_0xe97fd3[_0x95f0('0x45')],qs[_0x95f0('0x46')](_0x21dc3f[_0x95f0('0x41')][_0x95f0('0x46')]));_0x12daa5[_0x95f0('0x44')]=_0x12daa5[_0x95f0('0x44')][_0x95f0('0x47')]?_0x12daa5['attributes']:_0xe97fd3[_0x95f0('0x45')];if(_0x21dc3f[_0x95f0('0x41')]['includeAll']){_0x12daa5[_0x95f0('0x53')]=[{'all':!![]}];}_0x12daa5=_[_0x95f0('0x4f')]({},_0x12daa5,_0x21dc3f[_0x95f0('0x59')]);return db['FaxMessage']['find'](_0x12daa5)[_0x95f0('0x24')](handleEntityNotFound(_0xd1027,null))[_0x95f0('0x24')](respondWithResult(_0xd1027,null))[_0x95f0('0x2b')](handleError(_0xd1027,null));};exports[_0x95f0('0x36')]=function(_0x454b08,_0xaeaa52){if(_0x454b08[_0x95f0('0x5a')]['id']){delete _0x454b08['body']['id'];}return db['FaxMessage'][_0x95f0('0x5b')]({'where':{'id':_0x454b08[_0x95f0('0x57')]['id']}})[_0x95f0('0x24')](handleEntityNotFound(_0xaeaa52,null))[_0x95f0('0x24')](saveUpdates(_0x454b08[_0x95f0('0x5a')],null))[_0x95f0('0x24')](respondWithResult(_0xaeaa52,null))['catch'](handleError(_0xaeaa52,null));};exports['destroy']=function(_0x468c6d,_0x2ff901){return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x468c6d['params']['id']}})[_0x95f0('0x24')](handleEntityNotFound(_0x2ff901,null))['then'](removeEntity(_0x2ff901,null))[_0x95f0('0x2b')](handleError(_0x2ff901,null));};exports[_0x95f0('0x5c')]=function(_0x5e5602,_0x248ba6){return db['FaxMessage'][_0x95f0('0x5c')]()[_0x95f0('0x24')](respondWithResult(_0x248ba6,null))[_0x95f0('0x2b')](handleError(_0x248ba6,null));};var interaction_log=require(_0x95f0('0x14'))(_0x95f0('0x5d'));exports['accept']=function(_0x58fc2c,_0x4c2c10,_0x564402){var _0x60ed94={'channel':_0x95f0('0x5e')};if(_0x58fc2c[_0x95f0('0x5a')]['id']){delete _0x58fc2c[_0x95f0('0x5a')]['id'];}_0x58fc2c['body']['read']=!![];_0x58fc2c['body'][_0x95f0('0x5f')]=moment()['format'](_0x95f0('0x60'));_0x58fc2c[_0x95f0('0x5a')][_0x95f0('0x61')]=_0x58fc2c['body'][_0x95f0('0x61')]||_0x58fc2c['user']['id'];return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x58fc2c[_0x95f0('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x95f0('0x62')],'as':_0x95f0('0x63')}]})[_0x95f0('0x24')](handleEntityNotFound(_0x4c2c10,null))['then'](saveUpdates(_0x58fc2c[_0x95f0('0x5a')],null))[_0x95f0('0x24')](function(_0x177b22){if(_0x177b22){_0x60ed94[_0x95f0('0x29')]=_0x177b22[_0x95f0('0x64')]({'plain':!![]});return db[_0x95f0('0x65')][_0x95f0('0x5b')]({'where':{'id':_0x177b22[_0x95f0('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4c2c10,null))[_0x95f0('0x24')](function(_0x20651d){if(_0x20651d){return _0x20651d[_0x95f0('0x36')]({'UserId':_0x58fc2c[_0x95f0('0x5a')][_0x95f0('0x61')],'read1stAt':_[_0x95f0('0x67')](_0x20651d[_0x95f0('0x68')])?moment()[_0x95f0('0x69')](_0x95f0('0x60')):undefined});}return null;})['then'](function(_0x1fde43){if(_0x1fde43){_0x60ed94['interaction']=_0x1fde43[_0x95f0('0x64')]({'plain':!![]});interaction_log['info'](_0x95f0('0x6a'),_0x58fc2c[_0x95f0('0x6b')]['id'],_0x58fc2c[_0x95f0('0x6b')][_0x95f0('0x3a')],_0x58fc2c[_0x95f0('0x6b')][_0x95f0('0x6c')],_0x60ed94[_0x95f0('0x6d')]['id'],_0x58fc2c[_0x95f0('0x5a')]?JSON[_0x95f0('0x6e')](_0x58fc2c['body']):'null');return respondWithRpcPromise(_0x95f0('0x6f'),_0x95f0('0x70'),_0x60ed94);}return null;})[_0x95f0('0x24')](function(_0x22348e){if(_0x22348e){if(_0x58fc2c['body'][_0x95f0('0x71')]){_0x60ed94[_0x95f0('0x29')]['interface']=util[_0x95f0('0x69')]('SIP/%s',_0x58fc2c['user']['name']);_0x60ed94['message']['channel']=_0x60ed94[_0x95f0('0x72')];_0x60ed94[_0x95f0('0x29')]['event']=_0x95f0('0x73');return respondWithRpcPromise(_0x95f0('0x74'),'EventManager',{'event':_0x95f0('0x75'),'message':_0x60ed94[_0x95f0('0x29')]},client9002)['then'](function(){return _0x60ed94;});}return _0x60ed94;}return null;})[_0x95f0('0x24')](respondWithResult(_0x4c2c10,null))[_0x95f0('0x2b')](handleError(_0x4c2c10,null));};var interaction_log=require('../../config/logger')(_0x95f0('0x5d'));exports[_0x95f0('0x34')]=function(_0x59af14,_0x12bd8d,_0x3e8a7d){var _0x56d51b={'agent':{},'channel':_0x95f0('0x5e')};if(_0x59af14[_0x95f0('0x5a')]['id']){delete _0x59af14[_0x95f0('0x5a')]['id'];}_0x59af14[_0x95f0('0x5a')]['UserId']=_0x59af14[_0x95f0('0x5a')][_0x95f0('0x61')]||_0x59af14[_0x95f0('0x6b')]['id'];_0x56d51b[_0x95f0('0x76')]['id']=_0x59af14[_0x95f0('0x5a')][_0x95f0('0x61')];return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x59af14[_0x95f0('0x57')]['id'],'UserId':null}})[_0x95f0('0x24')](handleEntityNotFound(_0x12bd8d,null))['then'](function(_0x27a4a7){if(_0x27a4a7){_0x56d51b[_0x95f0('0x29')]=_0x27a4a7[_0x95f0('0x64')]({'plain':!![]});return db[_0x95f0('0x65')][_0x95f0('0x5b')]({'where':{'id':_0x27a4a7[_0x95f0('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x12bd8d,null))['then'](function(_0x592f78){if(_0x592f78){_0x56d51b['interaction']=_0x592f78['get']({'plain':!![]});interaction_log[_0x95f0('0x77')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59af14[_0x95f0('0x6b')]['id'],_0x59af14[_0x95f0('0x6b')][_0x95f0('0x3a')],_0x59af14[_0x95f0('0x6b')][_0x95f0('0x6c')],_0x56d51b['interaction']['id'],_0x59af14['body']?JSON[_0x95f0('0x6e')](_0x59af14[_0x95f0('0x5a')]):_0x95f0('0x78'));return respondWithRpcPromise('RejectMessage',_0x95f0('0x79'),_0x56d51b);}return null;})[_0x95f0('0x24')](function(_0x42d704){if(_0x42d704){_0x42d704[_0x95f0('0x29')][_0x95f0('0x7a')]=util[_0x95f0('0x69')](_0x95f0('0x7b'),_0x59af14[_0x95f0('0x6b')]['name']);_0x42d704['message'][_0x95f0('0x72')]=_0x56d51b[_0x95f0('0x72')];_0x42d704[_0x95f0('0x29')][_0x95f0('0x7c')]=_0x95f0('0x34');respondWithRpcPromise('EventManager',_0x95f0('0x74'),{'event':'rejectmessage','message':_0x42d704[_0x95f0('0x29')]},client9002);return _0x56d51b;}return null;})[_0x95f0('0x24')](respondWithResult(_0x12bd8d,null))['catch'](handleError(_0x12bd8d,null));};exports['create']=function(_0x4829fe,_0x37a12b){var _0x84feff;return db[_0x95f0('0x51')][_0x95f0('0x7d')](_0x4829fe[_0x95f0('0x5a')],{})['then'](function(_0x50cc54){_0x84feff=_0x50cc54;return db['CmContact'][_0x95f0('0x7e')]({'where':{'id':_0x84feff['ContactId']}});})[_0x95f0('0x24')](function(_0xe9ce94){if(_[_0x95f0('0x67')](_0xe9ce94)){return;}else{_0x84feff['fax']=_0xe9ce94['fax'];return db[_0x95f0('0x7f')]['findOne']({'where':{'id':_0x84feff[_0x95f0('0x80')]}});}})[_0x95f0('0x24')](function(_0x56f56c){return respondWithRpcPromise(_0x95f0('0x81'),'SendFax',{'FaxAccountId':_[_0x95f0('0x67')](_0x4829fe['body'])?undefined:_0x4829fe['body'][_0x95f0('0x82')],'path':_[_0x95f0('0x67')](_0x56f56c)?undefined:util[_0x95f0('0x69')](_0x95f0('0x83'),_0x56f56c[_0x95f0('0x84')]),'fax':_[_0x95f0('0x67')](_0x84feff[_0x95f0('0x5e')])?undefined:_0x84feff['fax'],'AttachmentId':_0x84feff[_0x95f0('0x80')]},client9002);})[_0x95f0('0x24')](respondWithResult(_0x37a12b,0xc9))[_0x95f0('0x2b')](handleError(_0x37a12b,null));};exports['download']=function(_0x3ede7f,_0x8f1b45){var _0x1f3253=path[_0x95f0('0x85')](config[_0x95f0('0x86')],_0x95f0('0x87'),'files',_0x95f0('0x88'));return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x3ede7f[_0x95f0('0x57')]['id']},'include':[{'model':db[_0x95f0('0x7f')],'as':'Attachment'}]})[_0x95f0('0x24')](handleEntityNotFound(_0x8f1b45,null))[_0x95f0('0x24')](function(_0x40de2b){if(_0x40de2b){return _0x8f1b45[_0x95f0('0x89')](path[_0x95f0('0x85')](_0x1f3253,_0x40de2b[_0x95f0('0x7f')]['basename']));}})[_0x95f0('0x2b')](handleError(_0x8f1b45,null));}; \ No newline at end of file +var _0x874e=['body','find','params','describe','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','fax','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event','rejectmessage','create','ContactId','Attachment','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.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','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','stack','name','send','index','FaxMessage','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','catch','length'];(function(_0x2474e3,_0x2203ba){var _0x5793ae=function(_0xb2cbff){while(--_0xb2cbff){_0x2474e3['push'](_0x2474e3['shift']());}};_0x5793ae(++_0x2203ba);}(_0x874e,0x139));var _0xe874=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x874e[_0x257642];return _0x3d813b;};'use strict';var pdf=require(_0xe874('0x0'));var emlformat=require(_0xe874('0x1'));var rimraf=require(_0xe874('0x2'));var zipdir=require(_0xe874('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe874('0x4'));var BPromise=require(_0xe874('0x5'));var Mustache=require(_0xe874('0x6'));var util=require(_0xe874('0x7'));var path=require('path');var sox=require(_0xe874('0x8'));var csv=require(_0xe874('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe874('0xa'));var squel=require(_0xe874('0xb'));var crypto=require(_0xe874('0xc'));var jsforce=require(_0xe874('0xd'));var deskjs=require(_0xe874('0xe'));var toCsv=require(_0xe874('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe874('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe874('0x10'));var hardwareService=require(_0xe874('0x11'));var logger=require(_0xe874('0x12'))(_0xe874('0x13'));var utils=require(_0xe874('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe874('0x15')]=_[_0xe874('0x16')](config[_0xe874('0x15')],{'host':_0xe874('0x17'),'port':0x18eb});var socket=require(_0xe874('0x18'))(new Redis(config[_0xe874('0x15')]));require(_0xe874('0x19'))[_0xe874('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe874('0x1b')][_0xe874('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x28b8fe,_0x2333c2,_0x2fe05b){if(_0x2fe05b){var _0x4c6ac0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c6ac0[_0xe874('0x1d')](_0x2333c2)){return _0x28b8fe;}else{throw new db[(_0xe874('0x1e'))][(_0xe874('0x1f'))](_0xe874('0x20'));}}else{return _0x28b8fe;}}function respondWithRpcPromise(_0x470602,_0x3c718a,_0x1f2f29,_0x2b3def){return new BPromise(function(_0x2420fd,_0x36d89d){var _0x55c01b=_0x2b3def||client;return _0x55c01b[_0xe874('0x21')](_0x470602,_0x1f2f29)['then'](function(_0x5d5b18){logger['info'](_0xe874('0x22'),_0x3c718a,_0xe874('0x23'));logger[_0xe874('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3c718a,_0xe874('0x23'),JSON[_0xe874('0x25')](_0x5d5b18));if(_0x5d5b18['error']){if(_0x5d5b18[_0xe874('0x26')]['code']===0x1f4){logger[_0xe874('0x26')]('FaxMessage,\x20%s,\x20%s',_0x3c718a,_0x5d5b18[_0xe874('0x26')][_0xe874('0x27')]);return _0x36d89d(_0x5d5b18[_0xe874('0x26')][_0xe874('0x27')]);}logger[_0xe874('0x26')](_0xe874('0x22'),_0x3c718a,_0x5d5b18['error'][_0xe874('0x27')]);return _0x2420fd(_0x5d5b18[_0xe874('0x26')][_0xe874('0x27')]);}else{logger[_0xe874('0x28')](_0xe874('0x22'),_0x3c718a,'request\x20sent');_0x2420fd(_0x5d5b18[_0xe874('0x29')][_0xe874('0x27')]);}})['catch'](function(_0xfc8c93){logger[_0xe874('0x26')](_0xe874('0x22'),_0x3c718a,_0xfc8c93);_0x36d89d(_0xfc8c93);});});}function respondWithStatusCode(_0x16cfab,_0x5a9537){_0x5a9537=_0x5a9537||0xcc;return function(_0x392bf6){if(_0x392bf6){return _0x16cfab[_0xe874('0x2a')](_0x5a9537);}return _0x16cfab[_0xe874('0x2b')](_0x5a9537)[_0xe874('0x2c')]();};}function respondWithResult(_0x22b97a,_0x3ed6a0){_0x3ed6a0=_0x3ed6a0||0xc8;return function(_0x2f9240){if(_0x2f9240){return _0x22b97a[_0xe874('0x2b')](_0x3ed6a0)[_0xe874('0x2d')](_0x2f9240);}};}function respondWithFilteredResult(_0x3e88fe,_0x2305bc){return function(_0x3a7aad){if(_0x3a7aad){var _0x599f77=_0x3a7aad[_0xe874('0x2e')],_0x2554ce=_0x2305bc[_0xe874('0x2f')],_0x29c68a=_0x2305bc['offset']+_0x2305bc[_0xe874('0x30')],_0x2f882f;if(_0x29c68a>=_0x599f77){_0x29c68a=_0x599f77;_0x2f882f=0xc8;}else{_0x2f882f=0xce;}_0x3e88fe[_0xe874('0x2b')](_0x2f882f);return _0x3e88fe['set'](_0xe874('0x31'),_0x2554ce+'-'+_0x29c68a+'/'+_0x599f77)[_0xe874('0x2d')](_0x3a7aad);}return null;};}function patchUpdates(_0x5a5bbd){return function(_0x3a93f8){try{jsonpatch[_0xe874('0x32')](_0x3a93f8,_0x5a5bbd,!![]);}catch(_0x48f98a){return BPromise['reject'](_0x48f98a);}return _0x3a93f8[_0xe874('0x33')]();};}function saveUpdates(_0x4229ed,_0x182f1d){return function(_0x3d24eb){if(_0x3d24eb){return _0x3d24eb[_0xe874('0x34')](_0x4229ed)['then'](function(_0x51247d){return _0x51247d;});}return null;};}function removeEntity(_0x268be3,_0x30119e){return function(_0xa171a3){if(_0xa171a3){return _0xa171a3[_0xe874('0x35')]()[_0xe874('0x36')](function(){_0x268be3['status'](0xcc)[_0xe874('0x2c')]();});}};}function handleEntityNotFound(_0x17c64f,_0x29d297){return function(_0x450d6a){if(!_0x450d6a){_0x17c64f[_0xe874('0x2a')](0x194);}return _0x450d6a;};}function handleError(_0x418a94,_0x384c3c){_0x384c3c=_0x384c3c||0x1f4;return function(_0x3a6cbe){logger['error'](_0x3a6cbe[_0xe874('0x37')]);if(_0x3a6cbe[_0xe874('0x38')]){delete _0x3a6cbe[_0xe874('0x38')];}_0x418a94[_0xe874('0x2b')](_0x384c3c)[_0xe874('0x39')](_0x3a6cbe);};}exports[_0xe874('0x3a')]=function(_0x39e46b,_0x3abdd0){var _0x22cbe5={},_0x379145={},_0x5b778b={'count':0x0,'rows':[]};var _0x428b64=_['map'](db[_0xe874('0x3b')]['rawAttributes'],function(_0x3f942){return{'name':_0x3f942[_0xe874('0x3c')],'type':_0x3f942[_0xe874('0x3d')][_0xe874('0x3e')]};});_0x379145[_0xe874('0x3f')]=_[_0xe874('0x40')](_0x428b64,_0xe874('0x38'));_0x379145[_0xe874('0x41')]=_[_0xe874('0x42')](_0x39e46b[_0xe874('0x41')]);_0x379145['filters']=_['intersection'](_0x379145['model'],_0x379145[_0xe874('0x41')]);_0x22cbe5[_0xe874('0x43')]=_[_0xe874('0x44')](_0x379145[_0xe874('0x3f')],qs[_0xe874('0x45')](_0x39e46b[_0xe874('0x41')]['fields']));_0x22cbe5[_0xe874('0x43')]=_0x22cbe5[_0xe874('0x43')]['length']?_0x22cbe5[_0xe874('0x43')]:_0x379145[_0xe874('0x3f')];if(!_0x39e46b['query'][_0xe874('0x46')](_0xe874('0x47'))){_0x22cbe5[_0xe874('0x30')]=qs[_0xe874('0x30')](_0x39e46b[_0xe874('0x41')]['limit']);_0x22cbe5[_0xe874('0x2f')]=qs[_0xe874('0x2f')](_0x39e46b[_0xe874('0x41')]['offset']);}_0x22cbe5[_0xe874('0x48')]=qs[_0xe874('0x49')](_0x39e46b[_0xe874('0x41')][_0xe874('0x49')]);_0x22cbe5['where']=qs[_0xe874('0x4a')](_[_0xe874('0x4b')](_0x39e46b[_0xe874('0x41')],_0x379145[_0xe874('0x4a')]),_0x428b64);if(_0x39e46b[_0xe874('0x41')]['filter']){_0x22cbe5['where']=_[_0xe874('0x4c')](_0x22cbe5['where'],{'$or':_[_0xe874('0x40')](_0x428b64,function(_0x4b5bc3){if(_0x4b5bc3[_0xe874('0x3d')]!==_0xe874('0x4d')){var _0x230533={};_0x230533[_0x4b5bc3[_0xe874('0x38')]]={'$like':'%'+_0x39e46b[_0xe874('0x41')][_0xe874('0x4e')]+'%'};return _0x230533;}})});}_0x22cbe5=_[_0xe874('0x4c')]({},_0x22cbe5,_0x39e46b[_0xe874('0x4f')]);var _0xa5268={'where':_0x22cbe5[_0xe874('0x50')]};return db[_0xe874('0x3b')]['count'](_0xa5268)[_0xe874('0x36')](function(_0x5aaebc){_0x5b778b[_0xe874('0x2e')]=_0x5aaebc;if(_0x39e46b[_0xe874('0x41')][_0xe874('0x51')]){_0x22cbe5[_0xe874('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0xe874('0x53')](_0x22cbe5);})[_0xe874('0x36')](function(_0x589784){_0x5b778b['rows']=_0x589784;return _0x5b778b;})[_0xe874('0x36')](respondWithFilteredResult(_0x3abdd0,_0x22cbe5))[_0xe874('0x54')](handleError(_0x3abdd0,null));};exports['show']=function(_0x4be4db,_0x396e78){var _0x23b61d={'raw':!![],'where':{'id':_0x4be4db['params']['id']}},_0x53e3e4={};_0x53e3e4[_0xe874('0x3f')]=_[_0xe874('0x42')](db['FaxMessage']['rawAttributes']);_0x53e3e4[_0xe874('0x41')]=_[_0xe874('0x42')](_0x4be4db[_0xe874('0x41')]);_0x53e3e4['filters']=_['intersection'](_0x53e3e4[_0xe874('0x3f')],_0x53e3e4[_0xe874('0x41')]);_0x23b61d['attributes']=_[_0xe874('0x44')](_0x53e3e4[_0xe874('0x3f')],qs[_0xe874('0x45')](_0x4be4db[_0xe874('0x41')][_0xe874('0x45')]));_0x23b61d[_0xe874('0x43')]=_0x23b61d['attributes'][_0xe874('0x55')]?_0x23b61d[_0xe874('0x43')]:_0x53e3e4[_0xe874('0x3f')];if(_0x4be4db['query'][_0xe874('0x51')]){_0x23b61d[_0xe874('0x52')]=[{'all':!![]}];}_0x23b61d=_[_0xe874('0x4c')]({},_0x23b61d,_0x4be4db[_0xe874('0x4f')]);return db[_0xe874('0x3b')]['find'](_0x23b61d)[_0xe874('0x36')](handleEntityNotFound(_0x396e78,null))['then'](respondWithResult(_0x396e78,null))[_0xe874('0x54')](handleError(_0x396e78,null));};exports[_0xe874('0x34')]=function(_0x2e83fb,_0x25ebd6){if(_0x2e83fb[_0xe874('0x56')]['id']){delete _0x2e83fb[_0xe874('0x56')]['id'];}return db['FaxMessage'][_0xe874('0x57')]({'where':{'id':_0x2e83fb[_0xe874('0x58')]['id']}})['then'](handleEntityNotFound(_0x25ebd6,null))[_0xe874('0x36')](saveUpdates(_0x2e83fb[_0xe874('0x56')],null))[_0xe874('0x36')](respondWithResult(_0x25ebd6,null))[_0xe874('0x54')](handleError(_0x25ebd6,null));};exports[_0xe874('0x35')]=function(_0x3150a4,_0x17684a){return db['FaxMessage'][_0xe874('0x57')]({'where':{'id':_0x3150a4[_0xe874('0x58')]['id']}})[_0xe874('0x36')](handleEntityNotFound(_0x17684a,null))[_0xe874('0x36')](removeEntity(_0x17684a,null))[_0xe874('0x54')](handleError(_0x17684a,null));};exports[_0xe874('0x59')]=function(_0x1cdc49,_0x17721c){return db['FaxMessage']['describe']()[_0xe874('0x36')](respondWithResult(_0x17721c,null))[_0xe874('0x54')](handleError(_0x17721c,null));};var interaction_log=require(_0xe874('0x12'))('fax-interactions');exports[_0xe874('0x5a')]=function(_0x25c5d7,_0x440cab,_0x444c17){var _0x1ccd29={'channel':'fax'};if(_0x25c5d7['body']['id']){delete _0x25c5d7[_0xe874('0x56')]['id'];}_0x25c5d7['body']['read']=!![];_0x25c5d7[_0xe874('0x56')]['readAt']=moment()['format'](_0xe874('0x5b'));_0x25c5d7[_0xe874('0x56')][_0xe874('0x5c')]=_0x25c5d7[_0xe874('0x56')]['UserId']||_0x25c5d7[_0xe874('0x5d')]['id'];return db[_0xe874('0x3b')]['find']({'where':{'id':_0x25c5d7[_0xe874('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xe874('0x5e')],'as':_0xe874('0x5f')}]})[_0xe874('0x36')](handleEntityNotFound(_0x440cab,null))[_0xe874('0x36')](saveUpdates(_0x25c5d7[_0xe874('0x56')],null))[_0xe874('0x36')](function(_0x4e732c){if(_0x4e732c){_0x1ccd29[_0xe874('0x27')]=_0x4e732c[_0xe874('0x60')]({'plain':!![]});return db[_0xe874('0x61')]['find']({'where':{'id':_0x4e732c[_0xe874('0x62')]}});}return null;})[_0xe874('0x36')](handleEntityNotFound(_0x440cab,null))[_0xe874('0x36')](function(_0x4ac043){if(_0x4ac043){return _0x4ac043[_0xe874('0x34')]({'UserId':_0x25c5d7[_0xe874('0x56')][_0xe874('0x5c')],'read1stAt':_[_0xe874('0x63')](_0x4ac043[_0xe874('0x64')])?moment()[_0xe874('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x13523e){if(_0x13523e){_0x1ccd29[_0xe874('0x66')]=_0x13523e['get']({'plain':!![]});interaction_log[_0xe874('0x28')](_0xe874('0x67'),_0x25c5d7[_0xe874('0x5d')]['id'],_0x25c5d7[_0xe874('0x5d')][_0xe874('0x38')],_0x25c5d7['user'][_0xe874('0x68')],_0x1ccd29['interaction']['id'],_0x25c5d7[_0xe874('0x56')]?JSON[_0xe874('0x25')](_0x25c5d7[_0xe874('0x56')]):'null');return respondWithRpcPromise(_0xe874('0x69'),_0xe874('0x6a'),_0x1ccd29);}return null;})['then'](function(_0xb5998a){if(_0xb5998a){if(_0x25c5d7[_0xe874('0x56')][_0xe874('0x6b')]){_0x1ccd29[_0xe874('0x27')][_0xe874('0x6c')]=util['format'](_0xe874('0x6d'),_0x25c5d7['user'][_0xe874('0x38')]);_0x1ccd29[_0xe874('0x27')][_0xe874('0x6e')]=_0x1ccd29['channel'];_0x1ccd29['message']['event']=_0xe874('0x5a');return respondWithRpcPromise(_0xe874('0x6f'),_0xe874('0x6f'),{'event':_0xe874('0x70'),'message':_0x1ccd29[_0xe874('0x27')]},client9002)[_0xe874('0x36')](function(){return _0x1ccd29;});}return _0x1ccd29;}return null;})['then'](respondWithResult(_0x440cab,null))[_0xe874('0x54')](handleError(_0x440cab,null));};var interaction_log=require(_0xe874('0x12'))('fax-interactions');exports[_0xe874('0x71')]=function(_0x389fbb,_0x4f5af1,_0x4a822c){var _0xd9a91f={'agent':{},'channel':_0xe874('0x72')};if(_0x389fbb[_0xe874('0x56')]['id']){delete _0x389fbb[_0xe874('0x56')]['id'];}_0x389fbb[_0xe874('0x56')][_0xe874('0x5c')]=_0x389fbb[_0xe874('0x56')][_0xe874('0x5c')]||_0x389fbb['user']['id'];_0xd9a91f[_0xe874('0x73')]['id']=_0x389fbb[_0xe874('0x56')][_0xe874('0x5c')];return db[_0xe874('0x3b')][_0xe874('0x57')]({'where':{'id':_0x389fbb[_0xe874('0x58')]['id'],'UserId':null}})[_0xe874('0x36')](handleEntityNotFound(_0x4f5af1,null))[_0xe874('0x36')](function(_0x1b8df9){if(_0x1b8df9){_0xd9a91f['message']=_0x1b8df9[_0xe874('0x60')]({'plain':!![]});return db[_0xe874('0x61')][_0xe874('0x57')]({'where':{'id':_0x1b8df9[_0xe874('0x62')]}});}return null;})[_0xe874('0x36')](handleEntityNotFound(_0x4f5af1,null))['then'](function(_0x17eeca){if(_0x17eeca){_0xd9a91f[_0xe874('0x66')]=_0x17eeca[_0xe874('0x60')]({'plain':!![]});interaction_log[_0xe874('0x28')](_0xe874('0x74'),_0x389fbb[_0xe874('0x5d')]['id'],_0x389fbb[_0xe874('0x5d')][_0xe874('0x38')],_0x389fbb[_0xe874('0x5d')]['role'],_0xd9a91f[_0xe874('0x66')]['id'],_0x389fbb[_0xe874('0x56')]?JSON[_0xe874('0x25')](_0x389fbb[_0xe874('0x56')]):'null');return respondWithRpcPromise(_0xe874('0x75'),'rejectMessage',_0xd9a91f);}return null;})['then'](function(_0x29d686){if(_0x29d686){_0x29d686[_0xe874('0x27')][_0xe874('0x6c')]=util['format'](_0xe874('0x6d'),_0x389fbb[_0xe874('0x5d')][_0xe874('0x38')]);_0x29d686[_0xe874('0x27')][_0xe874('0x6e')]=_0xd9a91f['channel'];_0x29d686['message'][_0xe874('0x76')]=_0xe874('0x71');respondWithRpcPromise(_0xe874('0x6f'),_0xe874('0x6f'),{'event':_0xe874('0x77'),'message':_0x29d686[_0xe874('0x27')]},client9002);return _0xd9a91f;}return null;})[_0xe874('0x36')](respondWithResult(_0x4f5af1,null))[_0xe874('0x54')](handleError(_0x4f5af1,null));};exports[_0xe874('0x78')]=function(_0x4e657e,_0x5f2bf6){var _0x218c52;return db['FaxMessage'][_0xe874('0x78')](_0x4e657e['body'],{})['then'](function(_0x4b27ce){_0x218c52=_0x4b27ce;return db[_0xe874('0x5e')]['findOne']({'where':{'id':_0x218c52[_0xe874('0x79')]}});})['then'](function(_0x5415ba){if(_['isNil'](_0x5415ba)){return;}else{_0x218c52[_0xe874('0x72')]=_0x5415ba['fax'];return db[_0xe874('0x7a')][_0xe874('0x7b')]({'where':{'id':_0x218c52[_0xe874('0x7c')]}});}})[_0xe874('0x36')](function(_0x46210e){return respondWithRpcPromise(_0xe874('0x7d'),_0xe874('0x7d'),{'FaxAccountId':_[_0xe874('0x63')](_0x4e657e['body'])?undefined:_0x4e657e[_0xe874('0x56')]['FaxAccountId'],'path':_[_0xe874('0x63')](_0x46210e)?undefined:util[_0xe874('0x65')](_0xe874('0x7e'),_0x46210e[_0xe874('0x7f')]),'fax':_[_0xe874('0x63')](_0x218c52[_0xe874('0x72')])?undefined:_0x218c52[_0xe874('0x72')],'AttachmentId':_0x218c52[_0xe874('0x7c')]},client9002);})[_0xe874('0x36')](respondWithResult(_0x5f2bf6,0xc9))['catch'](handleError(_0x5f2bf6,null));};exports[_0xe874('0x80')]=function(_0x517f08,_0x51f2f9){var _0x4298a0=path[_0xe874('0x81')](config['root'],_0xe874('0x82'),_0xe874('0x83'),_0xe874('0x84'));return db[_0xe874('0x3b')][_0xe874('0x57')]({'where':{'id':_0x517f08[_0xe874('0x58')]['id']},'include':[{'model':db[_0xe874('0x7a')],'as':'Attachment'}]})[_0xe874('0x36')](handleEntityNotFound(_0x51f2f9,null))[_0xe874('0x36')](function(_0x19731a){if(_0x19731a){return _0x51f2f9[_0xe874('0x80')](path[_0xe874('0x81')](_0x4298a0,_0x19731a['Attachment'][_0xe874('0x7f')]));}})[_0xe874('0x54')](handleError(_0x51f2f9,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5667d78..e227083 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x5fc3[_0x4c1ec2];return _0x3f6f1c;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x36241a,_0x484a39){var _0x3ce5ba=function(_0x19a35a){while(--_0x19a35a){_0x36241a['push'](_0x36241a['shift']());}};_0x3ce5ba(++_0x484a39);}(_0x008c,0x188));var _0xc008=function(_0x14e65e,_0x461afd){_0x14e65e=_0x14e65e-0x0;var _0x4774a1=_0x008c[_0x14e65e];return _0x4774a1;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 083361c..b5fe5d7 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 _0x64bb=['direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','../../config/environment','exports','FaxMessage','fti_fax_messages','body','models','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x64bb,0x1ec));var _0xb64b=function(_0x327b1d,_0x400faf){_0x327b1d=_0x327b1d-0x0;var _0x1c0325=_0x64bb[_0x327b1d];return _0x1c0325;};'use strict';var _=require(_0xb64b('0x0'));var util=require('util');var logger=require(_0xb64b('0x1'))('api');var moment=require(_0xb64b('0x2'));var BPromise=require('bluebird');var rp=require(_0xb64b('0x3'));var fs=require('fs');var path=require(_0xb64b('0x4'));var rimraf=require('rimraf');var config=require(_0xb64b('0x5'));var attributes=require('./faxMessage.attributes');module[_0xb64b('0x6')]=function(_0x5e3390,_0x364f5c){return _0x5e3390['define'](_0xb64b('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb64b('0x8'),'fields':[_0xb64b('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x553f0b,_0x36e057,_0x517370){var _0x281d7f=_0x5e3390[_0xb64b('0xa')];var _0x2ff17d=_0x553f0b[_0xb64b('0xb')]({'plain':!![]});if(_0x2ff17d[_0xb64b('0xc')][_0xb64b('0xd')]()==='in'||_0x2ff17d[_0xb64b('0xc')][_0xb64b('0xd')]()===_0xb64b('0xe')&&!_0x2ff17d[_0xb64b('0xf')]&&!_[_0xb64b('0x10')](_0x2ff17d[_0xb64b('0x11')])){_0x281d7f[_0xb64b('0x12')][_0xb64b('0x13')]({'where':{'id':_0x2ff17d[_0xb64b('0x14')]}})[_0xb64b('0x15')](function(_0x6e6040){if(_0x6e6040){_0x6e6040[_0xb64b('0x16')]({'lastMsgAt':_0x2ff17d[_0xb64b('0x17')],'lastMsgDirection':_0x2ff17d[_0xb64b('0xc')][_0xb64b('0xd')]()});}})[_0xb64b('0x18')](function(_0x30df13){console[_0xb64b('0x19')](_0x30df13);});}_0x517370();}},'charset':_0xb64b('0x1a'),'collate':_0xb64b('0x1b')});}; \ No newline at end of file +var _0x7aa9=['findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7aa9,0x19c));var _0x97aa=function(_0x244f5d,_0x3c98c6){_0x244f5d=_0x244f5d-0x0;var _0x1a3886=_0x7aa9[_0x244f5d];return _0x1a3886;};'use strict';var _=require(_0x97aa('0x0'));var util=require('util');var logger=require(_0x97aa('0x1'))(_0x97aa('0x2'));var moment=require(_0x97aa('0x3'));var BPromise=require(_0x97aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97aa('0x5'));var rimraf=require(_0x97aa('0x6'));var config=require(_0x97aa('0x7'));var attributes=require(_0x97aa('0x8'));module['exports']=function(_0x1a36d9,_0xf1b258){return _0x1a36d9[_0x97aa('0x9')](_0x97aa('0xa'),attributes,{'tableName':_0x97aa('0xb'),'paranoid':![],'indexes':[{'name':_0x97aa('0xc'),'fields':['body'],'type':_0x97aa('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e3f02,_0x3ef4ff,_0x228ba8){var _0x335e8f=_0x1a36d9[_0x97aa('0xe')];var _0x36a436=_0x2e3f02[_0x97aa('0xf')]({'plain':!![]});if(_0x36a436[_0x97aa('0x10')][_0x97aa('0x11')]()==='in'||_0x36a436[_0x97aa('0x10')]['toLowerCase']()==='out'&&!_0x36a436[_0x97aa('0x12')]&&!_[_0x97aa('0x13')](_0x36a436[_0x97aa('0x14')])){_0x335e8f[_0x97aa('0x15')][_0x97aa('0x16')]({'where':{'id':_0x36a436[_0x97aa('0x17')]}})[_0x97aa('0x18')](function(_0x21b03b){if(_0x21b03b){_0x21b03b[_0x97aa('0x19')]({'lastMsgAt':_0x36a436[_0x97aa('0x1a')],'lastMsgDirection':_0x36a436[_0x97aa('0x10')][_0x97aa('0x11')]()});}})[_0x97aa('0x1b')](function(_0x3d5187){console[_0x97aa('0x1c')](_0x3d5187);});}_0x228ba8();}},'charset':_0x97aa('0x1d'),'collate':_0x97aa('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index ff7eaf0..b644689 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 _0x8ea4=['http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateFaxMessage','create','options','raw','stringify','update','where','attributes','limit','UpdateFaxMessage','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x8ea4,0x1b2));var _0x48ea=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x8ea4[_0x47e549];return _0x251374;};'use strict';var _=require(_0x48ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x48ea('0x1'));var rs=require(_0x48ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48ea('0x3'))(_0x48ea('0x4'));var config=require(_0x48ea('0x5'));var jayson=require(_0x48ea('0x6'));var client=jayson[_0x48ea('0x7')][_0x48ea('0x8')]({'port':0x232a});config[_0x48ea('0x9')]=_[_0x48ea('0xa')](config[_0x48ea('0x9')],{'host':_0x48ea('0xb'),'port':0x18eb});var socket=require(_0x48ea('0xc'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x48ea('0xd')](socket);function respondWithRpcPromise(_0x3f6f1f,_0xa209db,_0x55d55f){return new BPromise(function(_0x5e424c,_0x403a2a){return client['request'](_0x3f6f1f,_0x55d55f)[_0x48ea('0xe')](function(_0x47d370){logger[_0x48ea('0xf')](_0x48ea('0x10'),_0xa209db,_0x48ea('0x11'));logger[_0x48ea('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xa209db,_0x48ea('0x11'),JSON['stringify'](_0x47d370));if(_0x47d370['error']){if(_0x47d370[_0x48ea('0x13')][_0x48ea('0x14')]===0x1f4){logger[_0x48ea('0x13')]('FaxMessage,\x20%s,\x20%s',_0xa209db,_0x47d370['error'][_0x48ea('0x15')]);return _0x403a2a(_0x47d370[_0x48ea('0x13')][_0x48ea('0x15')]);}logger[_0x48ea('0x13')]('FaxMessage,\x20%s,\x20%s',_0xa209db,_0x47d370['error']['message']);return _0x5e424c(_0x47d370[_0x48ea('0x13')][_0x48ea('0x15')]);}else{logger[_0x48ea('0xf')](_0x48ea('0x10'),_0xa209db,_0x48ea('0x11'));_0x5e424c(_0x47d370[_0x48ea('0x16')]['message']);}})[_0x48ea('0x17')](function(_0x1de16d){logger[_0x48ea('0x13')]('FaxMessage,\x20%s,\x20%s',_0xa209db,_0x1de16d);_0x403a2a(_0x1de16d);});});}exports[_0x48ea('0x18')]=function(_0x5eb8fb){var _0x362023=this;return new Promise(function(_0x192340,_0x4777e9){return db['FaxMessage'][_0x48ea('0x19')](_0x5eb8fb['body'],{'raw':_0x5eb8fb['options']?_0x5eb8fb[_0x48ea('0x1a')][_0x48ea('0x1b')]===undefined?!![]:![]:!![]})[_0x48ea('0xe')](function(_0x423ff0){logger['info'](_0x48ea('0x18'),_0x5eb8fb);logger[_0x48ea('0x12')](_0x48ea('0x18'),_0x5eb8fb,JSON[_0x48ea('0x1c')](_0x423ff0));_0x192340(_0x423ff0);})[_0x48ea('0x17')](function(_0x4d953e){logger[_0x48ea('0x13')](_0x48ea('0x18'),_0x4d953e[_0x48ea('0x15')],_0x5eb8fb);_0x4777e9(_0x362023[_0x48ea('0x13')](0x1f4,_0x4d953e[_0x48ea('0x15')]));});});};exports['UpdateFaxMessage']=function(_0xc0db9f){var _0x144fda=this;return new Promise(function(_0xcd26fc,_0x53a7a1){return db['FaxMessage'][_0x48ea('0x1d')](_0xc0db9f['body'],{'raw':_0xc0db9f[_0x48ea('0x1a')]?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0db9f[_0x48ea('0x1a')]?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x1e')]||null:null,'attributes':_0xc0db9f['options']?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x1f')]||null:null,'limit':_0xc0db9f['options']?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x20')]||null:null})[_0x48ea('0xe')](function(_0x5dfe68){logger[_0x48ea('0xf')]('UpdateFaxMessage',_0xc0db9f);logger[_0x48ea('0x12')]('UpdateFaxMessage',_0xc0db9f,JSON['stringify'](_0x5dfe68));_0xcd26fc(_0x5dfe68);})[_0x48ea('0x17')](function(_0x3da33b){logger[_0x48ea('0x13')](_0x48ea('0x21'),_0x3da33b['message'],_0xc0db9f);_0x53a7a1(_0x144fda['error'](0x1f4,_0x3da33b[_0x48ea('0x15')]));});});}; \ No newline at end of file +var _0x58a3=['CreateFaxMessage','FaxMessage','options','raw','UpdateFaxMessage','body','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1d9cbc,_0x59d49c){var _0x500316=function(_0x162a70){while(--_0x162a70){_0x1d9cbc['push'](_0x1d9cbc['shift']());}};_0x500316(++_0x59d49c);}(_0x58a3,0xac));var _0x358a=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x58a3[_0x1460f6];return _0x46ce94;};'use strict';var _=require('lodash');var util=require(_0x358a('0x0'));var moment=require('moment');var BPromise=require(_0x358a('0x1'));var rs=require(_0x358a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x358a('0x3'));var logger=require(_0x358a('0x4'))(_0x358a('0x5'));var config=require(_0x358a('0x6'));var jayson=require(_0x358a('0x7'));var client=jayson[_0x358a('0x8')][_0x358a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x358a('0xa')],{'host':_0x358a('0xb'),'port':0x18eb});var socket=require(_0x358a('0xc'))(new Redis(config['redis']));require(_0x358a('0xd'))[_0x358a('0xe')](socket);function respondWithRpcPromise(_0x1e838c,_0x20dadc,_0x311c7d){return new BPromise(function(_0x219063,_0x38b650){return client[_0x358a('0xf')](_0x1e838c,_0x311c7d)[_0x358a('0x10')](function(_0xb075ef){logger['info'](_0x358a('0x11'),_0x20dadc,_0x358a('0x12'));logger[_0x358a('0x13')](_0x358a('0x14'),_0x20dadc,'request\x20sent',JSON[_0x358a('0x15')](_0xb075ef));if(_0xb075ef[_0x358a('0x16')]){if(_0xb075ef['error']['code']===0x1f4){logger[_0x358a('0x16')](_0x358a('0x11'),_0x20dadc,_0xb075ef[_0x358a('0x16')][_0x358a('0x17')]);return _0x38b650(_0xb075ef[_0x358a('0x16')][_0x358a('0x17')]);}logger[_0x358a('0x16')](_0x358a('0x11'),_0x20dadc,_0xb075ef['error'][_0x358a('0x17')]);return _0x219063(_0xb075ef['error'][_0x358a('0x17')]);}else{logger[_0x358a('0x18')](_0x358a('0x11'),_0x20dadc,'request\x20sent');_0x219063(_0xb075ef[_0x358a('0x19')][_0x358a('0x17')]);}})['catch'](function(_0x1fe5e1){logger[_0x358a('0x16')](_0x358a('0x11'),_0x20dadc,_0x1fe5e1);_0x38b650(_0x1fe5e1);});});}exports[_0x358a('0x1a')]=function(_0x3f8536){var _0x13f858=this;return new Promise(function(_0x14ac52,_0x3ae2a9){return db[_0x358a('0x1b')]['create'](_0x3f8536['body'],{'raw':_0x3f8536[_0x358a('0x1c')]?_0x3f8536['options'][_0x358a('0x1d')]===undefined?!![]:![]:!![]})[_0x358a('0x10')](function(_0x5668e1){logger[_0x358a('0x18')](_0x358a('0x1a'),_0x3f8536);logger[_0x358a('0x13')](_0x358a('0x1a'),_0x3f8536,JSON['stringify'](_0x5668e1));_0x14ac52(_0x5668e1);})['catch'](function(_0x4e2b7d){logger[_0x358a('0x16')]('CreateFaxMessage',_0x4e2b7d[_0x358a('0x17')],_0x3f8536);_0x3ae2a9(_0x13f858['error'](0x1f4,_0x4e2b7d[_0x358a('0x17')]));});});};exports[_0x358a('0x1e')]=function(_0x42f976){var _0x42c995=this;return new Promise(function(_0x47a2c4,_0x5c8fa6){return db['FaxMessage']['update'](_0x42f976[_0x358a('0x1f')],{'raw':_0x42f976[_0x358a('0x1c')]?_0x42f976[_0x358a('0x1c')][_0x358a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42f976[_0x358a('0x1c')]?_0x42f976['options']['where']||null:null,'attributes':_0x42f976[_0x358a('0x1c')]?_0x42f976[_0x358a('0x1c')]['attributes']||null:null,'limit':_0x42f976[_0x358a('0x1c')]?_0x42f976[_0x358a('0x1c')]['limit']||null:null})[_0x358a('0x10')](function(_0x14a244){logger['info']('UpdateFaxMessage',_0x42f976);logger['debug'](_0x358a('0x1e'),_0x42f976,JSON[_0x358a('0x15')](_0x14a244));_0x47a2c4(_0x14a244);})[_0x358a('0x20')](function(_0x45a106){logger[_0x358a('0x16')]('UpdateFaxMessage',_0x45a106[_0x358a('0x17')],_0x42f976);_0x5c8fa6(_0x42c995[_0x358a('0x16')](0x1f4,_0x45a106[_0x358a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ab5d7b8..092b2fd 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f190ddc..96c253d 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 _0x0647=['isAuthenticated','index','/describe','/:id','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./faxMessage.controller','get'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x0647,0xd0));var _0x7064=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x0647[_0x489b87];return _0x1823b6;};'use strict';var multer=require(_0x7064('0x0'));var util=require('util');var path=require(_0x7064('0x1'));var timeout=require(_0x7064('0x2'));var express=require(_0x7064('0x3'));var router=express[_0x7064('0x4')]();var auth=require(_0x7064('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7064('0x6'));router[_0x7064('0x7')]('/',auth[_0x7064('0x8')](),controller[_0x7064('0x9')]);router[_0x7064('0x7')](_0x7064('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7064('0x7')](_0x7064('0xb'),auth[_0x7064('0x8')](),controller['show']);router[_0x7064('0x7')](_0x7064('0xc'),auth['isAuthenticated'](),controller[_0x7064('0xd')]);router[_0x7064('0xe')]('/',auth[_0x7064('0x8')](),interaction['tracked'](_0x7064('0xf'),_0x7064('0x10')),controller[_0x7064('0x11')]);router[_0x7064('0x12')]('/:id',auth[_0x7064('0x8')](),controller[_0x7064('0x13')]);router[_0x7064('0x12')](_0x7064('0x14'),auth[_0x7064('0x8')](),controller[_0x7064('0x15')]);router[_0x7064('0x12')](_0x7064('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x7064('0xb'),auth[_0x7064('0x8')](),controller[_0x7064('0x17')]);module['exports']=router; \ No newline at end of file +var _0xee4e=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','/:id/download','post','tracked','fax','faxmessage:create','put','update','accept','/:id/reject'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xee4e,0x122));var _0xeee4=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xee4e[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0xeee4('0x0'));var util=require(_0xeee4('0x1'));var path=require(_0xeee4('0x2'));var timeout=require('connect-timeout');var express=require(_0xeee4('0x3'));var router=express[_0xeee4('0x4')]();var auth=require(_0xeee4('0x5'));var interaction=require(_0xeee4('0x6'));var config=require(_0xeee4('0x7'));var controller=require(_0xeee4('0x8'));router[_0xeee4('0x9')]('/',auth[_0xeee4('0xa')](),controller['index']);router[_0xeee4('0x9')](_0xeee4('0xb'),auth[_0xeee4('0xa')](),controller['describe']);router[_0xeee4('0x9')](_0xeee4('0xc'),auth[_0xeee4('0xa')](),controller['show']);router[_0xeee4('0x9')](_0xeee4('0xd'),auth[_0xeee4('0xa')](),controller['download']);router[_0xeee4('0xe')]('/',auth['isAuthenticated'](),interaction[_0xeee4('0xf')](_0xeee4('0x10'),_0xeee4('0x11')),controller['create']);router[_0xeee4('0x12')](_0xeee4('0xc'),auth[_0xeee4('0xa')](),controller[_0xeee4('0x13')]);router['put']('/:id/accept',auth[_0xeee4('0xa')](),controller[_0xeee4('0x14')]);router[_0xeee4('0x12')](_0xeee4('0x15'),auth[_0xeee4('0xa')](),controller['reject']);router['delete'](_0xeee4('0xc'),auth[_0xeee4('0xa')](),controller[_0xeee4('0x16')]);module[_0xeee4('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 067debb..d5b1e47 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 _0xe999=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xe999,0x119));var _0x9e99=function(_0x5dd7f2,_0x5ab01d){_0x5dd7f2=_0x5dd7f2-0x0;var _0x454df3=_0xe999[_0x5dd7f2];return _0x454df3;};'use strict';var Sequelize=require(_0x9e99('0x0'));module[_0x9e99('0x1')]={'name':{'type':Sequelize[_0x9e99('0x2')],'unique':_0x9e99('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e99('0x2')]},'timeout':{'type':Sequelize[_0x9e99('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9e99('0x5'),_0x9e99('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9e99('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d88=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x20f68e,_0xc7c7ec){var _0x3c37a8=function(_0xc4d1d8){while(--_0xc4d1d8){_0x20f68e['push'](_0x20f68e['shift']());}};_0x3c37a8(++_0xc7c7ec);}(_0x4d88,0x195));var _0x84d8=function(_0x86794c,_0x5df4b0){_0x86794c=_0x86794c-0x0;var _0x2ea7a8=_0x4d88[_0x86794c];return _0x2ea7a8;};'use strict';var Sequelize=require(_0x84d8('0x0'));module[_0x84d8('0x1')]={'name':{'type':Sequelize[_0x84d8('0x2')],'unique':_0x84d8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x84d8('0x2')]},'timeout':{'type':Sequelize[_0x84d8('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x84d8('0x5')](_0x84d8('0x6'),_0x84d8('0x7'),_0x84d8('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x84d8('0x4')],'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 439fc58..41018dd 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 _0xdca4=['online','voicePause','interface','flatMap','transaction','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','value','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','getAgents','pick','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','status','end','json','count','offset','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','FaxQueueId','options','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','Team','Agents'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xdca4,0x138));var _0x4dca=function(_0x1b467c,_0x3cd118){_0x1b467c=_0x1b467c-0x0;var _0x27e5df=_0xdca4[_0x1b467c];return _0x27e5df;};'use strict';var pdf=require(_0x4dca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4dca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4dca('0x2'));var rp=require(_0x4dca('0x3'));var moment=require(_0x4dca('0x4'));var BPromise=require(_0x4dca('0x5'));var Mustache=require(_0x4dca('0x6'));var util=require(_0x4dca('0x7'));var path=require(_0x4dca('0x8'));var sox=require('sox');var csv=require(_0x4dca('0x9'));var ejs=require(_0x4dca('0xa'));var fs=require('fs');var _=require(_0x4dca('0xb'));var squel=require(_0x4dca('0xc'));var crypto=require('crypto');var jsforce=require(_0x4dca('0xd'));var deskjs=require(_0x4dca('0xe'));var toCsv=require(_0x4dca('0x9'));var querystring=require(_0x4dca('0xf'));var Papa=require(_0x4dca('0x10'));var Redis=require(_0x4dca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4dca('0x12'));var as=require(_0x4dca('0x13'));var hardwareService=require(_0x4dca('0x14'));var logger=require('../../config/logger')(_0x4dca('0x15'));var utils=require(_0x4dca('0x16'));var config=require(_0x4dca('0x17'));var db=require(_0x4dca('0x18'))['db'];config[_0x4dca('0x19')]=_[_0x4dca('0x1a')](config[_0x4dca('0x19')],{'host':_0x4dca('0x1b'),'port':0x18eb});var socket=require(_0x4dca('0x1c'))(new Redis(config[_0x4dca('0x19')]));require(_0x4dca('0x1d'))['register'](socket);function respondWithStatusCode(_0x33633f,_0x263c44){_0x263c44=_0x263c44||0xcc;return function(_0x43211e){if(_0x43211e){return _0x33633f['sendStatus'](_0x263c44);}return _0x33633f[_0x4dca('0x1e')](_0x263c44)[_0x4dca('0x1f')]();};}function respondWithResult(_0x4da393,_0x3216e9){_0x3216e9=_0x3216e9||0xc8;return function(_0x3635cd){if(_0x3635cd){return _0x4da393['status'](_0x3216e9)[_0x4dca('0x20')](_0x3635cd);}};}function respondWithFilteredResult(_0x2b2d22,_0x2fea94){return function(_0x2fa48d){if(_0x2fa48d){var _0x41e56f=_0x2fa48d[_0x4dca('0x21')],_0xef705=_0x2fea94[_0x4dca('0x22')],_0x536606=_0x2fea94[_0x4dca('0x22')]+_0x2fea94['limit'],_0x1aa6a5;if(_0x536606>=_0x41e56f){_0x536606=_0x41e56f;_0x1aa6a5=0xc8;}else{_0x1aa6a5=0xce;}_0x2b2d22[_0x4dca('0x1e')](_0x1aa6a5);return _0x2b2d22['set']('Content-Range',_0xef705+'-'+_0x536606+'/'+_0x41e56f)[_0x4dca('0x20')](_0x2fa48d);}return null;};}function patchUpdates(_0x3d956e){return function(_0x576ed4){try{jsonpatch[_0x4dca('0x23')](_0x576ed4,_0x3d956e,!![]);}catch(_0xcbf101){return BPromise['reject'](_0xcbf101);}return _0x576ed4[_0x4dca('0x24')]();};}function saveUpdates(_0x12203e,_0x404788){return function(_0x33d10a){if(_0x33d10a){return _0x33d10a[_0x4dca('0x25')](_0x12203e)[_0x4dca('0x26')](function(_0x5dcf31){return _0x5dcf31;});}return null;};}function removeEntity(_0x4ec5c6,_0x4eb255){return function(_0x1142a5){if(_0x1142a5){return _0x1142a5[_0x4dca('0x27')]()[_0x4dca('0x26')](function(){var _0x1ccc29=_0x1142a5['get']({'plain':!![]});var _0x141227='FaxQueues';return db[_0x4dca('0x28')][_0x4dca('0x27')]({'where':{'type':_0x141227,'resourceId':_0x1ccc29['id']}})[_0x4dca('0x26')](function(){return _0x1142a5;});})['then'](function(){_0x4ec5c6['status'](0xcc)[_0x4dca('0x1f')]();});}};}function handleEntityNotFound(_0x1e0cf,_0x34d70e){return function(_0xc833f4){if(!_0xc833f4){_0x1e0cf['sendStatus'](0x194);}return _0xc833f4;};}function handleError(_0x3483c8,_0x5c02aa){_0x5c02aa=_0x5c02aa||0x1f4;return function(_0x35be18){logger[_0x4dca('0x29')](_0x35be18[_0x4dca('0x2a')]);if(_0x35be18[_0x4dca('0x2b')]){delete _0x35be18[_0x4dca('0x2b')];}_0x3483c8[_0x4dca('0x1e')](_0x5c02aa)[_0x4dca('0x2c')](_0x35be18);};}exports[_0x4dca('0x2d')]=function(_0xad04c,_0x3f9171){var _0x50640b={},_0x500f2b={},_0x4d1f28={'count':0x0,'rows':[]};var _0x2fa8f6=_[_0x4dca('0x2e')](db[_0x4dca('0x2f')][_0x4dca('0x30')],function(_0x57ad65){return{'name':_0x57ad65[_0x4dca('0x31')],'type':_0x57ad65[_0x4dca('0x32')][_0x4dca('0x33')]};});_0x500f2b['model']=_[_0x4dca('0x2e')](_0x2fa8f6,'name');_0x500f2b[_0x4dca('0x34')]=_[_0x4dca('0x35')](_0xad04c['query']);_0x500f2b[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x500f2b[_0x4dca('0x38')],_0x500f2b[_0x4dca('0x34')]);_0x50640b['attributes']=_[_0x4dca('0x37')](_0x500f2b[_0x4dca('0x38')],qs['fields'](_0xad04c[_0x4dca('0x34')][_0x4dca('0x39')]));_0x50640b[_0x4dca('0x3a')]=_0x50640b[_0x4dca('0x3a')][_0x4dca('0x3b')]?_0x50640b[_0x4dca('0x3a')]:_0x500f2b[_0x4dca('0x38')];if(!_0xad04c[_0x4dca('0x34')]['hasOwnProperty'](_0x4dca('0x3c'))){_0x50640b[_0x4dca('0x3d')]=qs['limit'](_0xad04c['query']['limit']);_0x50640b[_0x4dca('0x22')]=qs[_0x4dca('0x22')](_0xad04c[_0x4dca('0x34')][_0x4dca('0x22')]);}_0x50640b['order']=qs['sort'](_0xad04c[_0x4dca('0x34')]['sort']);_0x50640b[_0x4dca('0x3e')]=qs[_0x4dca('0x36')](_['pick'](_0xad04c[_0x4dca('0x34')],_0x500f2b[_0x4dca('0x36')]),_0x2fa8f6);if(_0xad04c[_0x4dca('0x34')][_0x4dca('0x3f')]){_0x50640b[_0x4dca('0x3e')]=_['merge'](_0x50640b[_0x4dca('0x3e')],{'$or':_[_0x4dca('0x2e')](_0x2fa8f6,function(_0x4f4939){if(_0x4f4939[_0x4dca('0x32')]!==_0x4dca('0x40')){var _0x4b1e58={};_0x4b1e58[_0x4f4939[_0x4dca('0x2b')]]={'$like':'%'+_0xad04c['query'][_0x4dca('0x3f')]+'%'};return _0x4b1e58;}})});}_0x50640b=_[_0x4dca('0x41')]({},_0x50640b,_0xad04c['options']);var _0x15cf45={'where':_0x50640b[_0x4dca('0x3e')]};return db[_0x4dca('0x2f')][_0x4dca('0x21')](_0x15cf45)[_0x4dca('0x26')](function(_0x193c62){_0x4d1f28[_0x4dca('0x21')]=_0x193c62;if(_0xad04c['query'][_0x4dca('0x42')]){_0x50640b[_0x4dca('0x43')]=[{'all':!![]}];}return db[_0x4dca('0x2f')][_0x4dca('0x44')](_0x50640b);})['then'](function(_0x12de15){_0x4d1f28[_0x4dca('0x45')]=_0x12de15;return _0x4d1f28;})[_0x4dca('0x26')](respondWithFilteredResult(_0x3f9171,_0x50640b))['catch'](handleError(_0x3f9171,null));};exports[_0x4dca('0x46')]=function(_0x3759cc,_0x1a3599){var _0x35549e={'raw':!![],'where':{'id':_0x3759cc[_0x4dca('0x47')]['id']}},_0x44d54f={};_0x44d54f[_0x4dca('0x38')]=_[_0x4dca('0x35')](db['FaxQueue'][_0x4dca('0x30')]);_0x44d54f['query']=_[_0x4dca('0x35')](_0x3759cc[_0x4dca('0x34')]);_0x44d54f['filters']=_['intersection'](_0x44d54f[_0x4dca('0x38')],_0x44d54f[_0x4dca('0x34')]);_0x35549e[_0x4dca('0x3a')]=_['intersection'](_0x44d54f[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x3759cc[_0x4dca('0x34')][_0x4dca('0x39')]));_0x35549e[_0x4dca('0x3a')]=_0x35549e['attributes'][_0x4dca('0x3b')]?_0x35549e['attributes']:_0x44d54f[_0x4dca('0x38')];if(_0x3759cc[_0x4dca('0x34')][_0x4dca('0x42')]){_0x35549e[_0x4dca('0x43')]=[{'all':!![]}];}_0x35549e=_['merge']({},_0x35549e,_0x3759cc['options']);return db[_0x4dca('0x2f')]['find'](_0x35549e)[_0x4dca('0x26')](handleEntityNotFound(_0x1a3599,null))[_0x4dca('0x26')](respondWithResult(_0x1a3599,null))[_0x4dca('0x48')](handleError(_0x1a3599,null));};exports[_0x4dca('0x49')]=function(_0x229c42,_0x146d2a){return db[_0x4dca('0x2f')][_0x4dca('0x49')](_0x229c42['body'],{})[_0x4dca('0x26')](function(_0x296038){var _0x34f806=_0x229c42['user'][_0x4dca('0x4a')]({'plain':!![]});if(!_0x34f806)throw new Error(_0x4dca('0x4b'));if(_0x34f806[_0x4dca('0x4c')]===_0x4dca('0x4d')){var _0x3d6291=_0x296038[_0x4dca('0x4a')]({'plain':!![]});var _0x501209='FaxQueues';return db['UserProfileSection'][_0x4dca('0x4e')]({'where':{'name':_0x501209,'userProfileId':_0x34f806[_0x4dca('0x4f')]},'raw':!![]})['then'](function(_0x3e2e29){if(_0x3e2e29&&_0x3e2e29[_0x4dca('0x50')]===0x0){return db[_0x4dca('0x28')][_0x4dca('0x49')]({'name':_0x3d6291[_0x4dca('0x2b')],'resourceId':_0x3d6291['id'],'type':_0x3e2e29[_0x4dca('0x2b')],'sectionId':_0x3e2e29['id']},{})[_0x4dca('0x26')](function(){return _0x296038;});}else{return _0x296038;}})['catch'](function(_0x2fab3c){logger[_0x4dca('0x29')](_0x4dca('0x51'),_0x2fab3c);throw _0x2fab3c;});}return _0x296038;})[_0x4dca('0x26')](respondWithResult(_0x146d2a,0xc9))[_0x4dca('0x48')](handleError(_0x146d2a,null));};exports['update']=function(_0x35824c,_0x124977){if(_0x35824c[_0x4dca('0x52')]['id']){delete _0x35824c[_0x4dca('0x52')]['id'];}return db[_0x4dca('0x2f')]['find']({'where':{'id':_0x35824c[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x124977,null))['then'](saveUpdates(_0x35824c['body'],null))[_0x4dca('0x26')](respondWithResult(_0x124977,null))[_0x4dca('0x48')](handleError(_0x124977,null));};exports[_0x4dca('0x27')]=function(_0x16eb54,_0x2d3d77){return db[_0x4dca('0x2f')]['find']({'where':{'id':_0x16eb54[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x2d3d77,null))['then'](removeEntity(_0x2d3d77,null))['catch'](handleError(_0x2d3d77,null));};exports['describe']=function(_0x6417f6,_0x478c92){return db[_0x4dca('0x2f')][_0x4dca('0x53')]()[_0x4dca('0x26')](respondWithResult(_0x478c92,null))[_0x4dca('0x48')](handleError(_0x478c92,null));};exports[_0x4dca('0x54')]=function(_0x368954,_0x5737c4,_0x425474){var _0x1a7df1={'raw':!![],'where':{}},_0x567719={},_0x428758;return db[_0x4dca('0x2f')][_0x4dca('0x55')]({'where':{'id':_0x368954[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x5737c4,null))['then'](function(_0x3d86c1){if(_0x3d86c1){_0x428758=_0x3d86c1[_0x4dca('0x4a')]({'plain':!![]});_0x567719['model']=_[_0x4dca('0x35')](db[_0x4dca('0x56')]['rawAttributes']);_0x567719[_0x4dca('0x34')]=_['keys'](_0x368954[_0x4dca('0x34')]);_0x567719[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x567719[_0x4dca('0x38')],_0x567719[_0x4dca('0x34')]);_0x1a7df1[_0x4dca('0x3a')]=_[_0x4dca('0x37')](_0x567719[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x368954[_0x4dca('0x34')][_0x4dca('0x39')]));_0x1a7df1[_0x4dca('0x3a')]=_0x1a7df1[_0x4dca('0x3a')][_0x4dca('0x3b')]?_0x1a7df1[_0x4dca('0x3a')]:_0x567719[_0x4dca('0x38')];if(!_0x368954['query'][_0x4dca('0x57')](_0x4dca('0x3c'))){_0x1a7df1[_0x4dca('0x3d')]=qs[_0x4dca('0x3d')](_0x368954[_0x4dca('0x34')][_0x4dca('0x3d')]);_0x1a7df1[_0x4dca('0x22')]=qs['offset'](_0x368954[_0x4dca('0x34')][_0x4dca('0x22')]);}_0x1a7df1[_0x4dca('0x58')]=qs['sort'](_0x368954[_0x4dca('0x34')][_0x4dca('0x59')]);_0x1a7df1[_0x4dca('0x3e')]=qs['filters'](_['pick'](_0x368954['query'],_0x567719[_0x4dca('0x36')]));_0x1a7df1[_0x4dca('0x3e')][_0x4dca('0x5a')]=_0x3d86c1['id'];if(_0x368954[_0x4dca('0x34')][_0x4dca('0x3f')]){_0x1a7df1[_0x4dca('0x3e')]=_[_0x4dca('0x41')](_0x1a7df1[_0x4dca('0x3e')],{'$or':_[_0x4dca('0x2e')](_0x1a7df1['attributes'],function(_0x215695){var _0x4a1613={};_0x4a1613[_0x215695]={'$like':'%'+_0x368954[_0x4dca('0x34')][_0x4dca('0x3f')]+'%'};return _0x4a1613;})});}_0x1a7df1=_[_0x4dca('0x41')]({},_0x1a7df1,_0x368954[_0x4dca('0x5b')]);return db[_0x4dca('0x56')][_0x4dca('0x44')](_0x1a7df1);}})['then'](function(_0x2fcf53){if(_0x2fcf53){return db[_0x4dca('0x5c')][_0x4dca('0x5d')]({'where':{'id':_['map'](_0x2fcf53,_0x4dca('0x5e')),'role':_0x4dca('0x5f')},'attributes':['id',_0x4dca('0x2b'),_0x4dca('0x60'),_0x4dca('0x61'),_0x4dca('0x62')]});}})[_0x4dca('0x26')](function(_0x4a294c){if(_0x4a294c){return{'count':_0x4a294c['count'],'rows':_[_0x4dca('0x2e')](_0x4a294c[_0x4dca('0x45')],function(_0x3ad0a3){return{'membername':_0x3ad0a3['name'],'UserId':_0x3ad0a3['id'],'queue_name':_0x428758[_0x4dca('0x2b')],'FaxQueueId':_0x428758['id'],'interface':util[_0x4dca('0x63')](_0x4dca('0x64'),'SIP',_0x3ad0a3['name']),'penalty':0x0,'paused':_0x3ad0a3[_0x4dca('0x60')],'createdAt':_0x3ad0a3[_0x4dca('0x62')],'updatedAt':_0x3ad0a3[_0x4dca('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4dca('0x26')](respondWithFilteredResult(_0x5737c4,_0x1a7df1))[_0x4dca('0x48')](handleError(_0x5737c4,null));};exports[_0x4dca('0x65')]=function(_0x6d1028,_0x23a1ec,_0x3ec4ff){var _0x3e5c3e={};var _0x56e481={};var _0x36c7c0;var _0x143564;return db[_0x4dca('0x2f')][_0x4dca('0x55')]({'where':{'id':_0x6d1028['params']['id']}})['then'](handleEntityNotFound(_0x23a1ec,null))['then'](function(_0x2eb016){if(_0x2eb016){_0x36c7c0=_0x2eb016;_0x56e481[_0x4dca('0x38')]=_[_0x4dca('0x35')](db['Team']['rawAttributes']);_0x56e481['query']=_[_0x4dca('0x35')](_0x6d1028[_0x4dca('0x34')]);_0x56e481[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x56e481[_0x4dca('0x38')],_0x56e481[_0x4dca('0x34')]);_0x3e5c3e[_0x4dca('0x3a')]=_['intersection'](_0x56e481[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x6d1028['query'][_0x4dca('0x39')]));_0x3e5c3e[_0x4dca('0x3a')]=_0x3e5c3e[_0x4dca('0x3a')][_0x4dca('0x3b')]?_0x3e5c3e['attributes']:_0x56e481['model'];_0x3e5c3e['order']=qs['sort'](_0x6d1028[_0x4dca('0x34')]['sort']);_0x3e5c3e[_0x4dca('0x3e')]=qs['filters'](_['pick'](_0x6d1028['query'],_0x56e481[_0x4dca('0x36')]));if(_0x6d1028[_0x4dca('0x34')]['filter']){_0x3e5c3e[_0x4dca('0x3e')]=_[_0x4dca('0x41')](_0x3e5c3e['where'],{'$or':_[_0x4dca('0x2e')](_0x3e5c3e[_0x4dca('0x3a')],function(_0x28a0a3){var _0x110911={};_0x110911[_0x28a0a3]={'$like':'%'+_0x6d1028[_0x4dca('0x34')][_0x4dca('0x3f')]+'%'};return _0x110911;})});}_0x3e5c3e=_[_0x4dca('0x41')]({},_0x3e5c3e,_0x6d1028['options']);return _0x36c7c0['getTeams'](_0x3e5c3e);}})[_0x4dca('0x26')](function(_0x3f236b){if(_0x3f236b){_0x143564=_0x3f236b['length'];if(!_0x6d1028['query'][_0x4dca('0x57')](_0x4dca('0x3c'))){_0x3e5c3e[_0x4dca('0x3d')]=qs[_0x4dca('0x3d')](_0x6d1028[_0x4dca('0x34')][_0x4dca('0x3d')]);_0x3e5c3e[_0x4dca('0x22')]=qs[_0x4dca('0x22')](_0x6d1028[_0x4dca('0x34')][_0x4dca('0x22')]);}return _0x36c7c0[_0x4dca('0x65')](_0x3e5c3e);}})[_0x4dca('0x26')](function(_0x2de606){if(_0x2de606){return _0x2de606?{'count':_0x143564,'rows':_0x2de606}:null;}})[_0x4dca('0x26')](respondWithResult(_0x23a1ec,null))['catch'](handleError(_0x23a1ec,null));};exports[_0x4dca('0x66')]=function(_0x1d4045,_0x721035,_0xf7ef94){var _0x38d449=_0x1d4045[_0x4dca('0x52')]['ids'];return db[_0x4dca('0x67')]['findAll']({'where':{'id':_0x38d449},'attributes':['id'],'include':[{'model':db[_0x4dca('0x5c')],'as':_0x4dca('0x68'),'attributes':['id',_0x4dca('0x2b'),_0x4dca('0x69'),_0x4dca('0x6a'),_0x4dca('0x6b')],'raw':!![]}]})[_0x4dca('0x26')](function(_0x3e6f13){if(_0x3e6f13){var _0x57b921=_[_0x4dca('0x6c')](_0x3e6f13,function(_0x1aece1){var _0x35c58b=_0x1aece1[_0x4dca('0x4a')]({'plain':!![]});return _0x35c58b['Agents'];});return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x1d4045[_0x4dca('0x47')]['id']}})['then'](function(_0x3c12c7){return db['sequelize'][_0x4dca('0x6d')](function(_0x56c41b){return _0x3c12c7[_0x4dca('0x66')](_0x38d449,{'transaction':_0x56c41b})['then'](function(){return BPromise['each'](_0x57b921,function(_0x1ddde1){return db[_0x4dca('0x56')]['findOrCreate']({'where':{'UserId':_0x1ddde1['id'],'FaxQueueId':_0x1d4045[_0x4dca('0x47')]['id']},'transaction':_0x56c41b});});})[_0x4dca('0x26')](function(){_0x57b921[_0x4dca('0x6e')](function(_0x17e0fb){socket[_0x4dca('0x6f')](_0x4dca('0x70'),{'UserId':_0x17e0fb['id'],'FaxQueueId':_0x3c12c7['id']});});});});});}})['then'](respondWithStatusCode(_0x721035,null))[_0x4dca('0x48')](handleError(_0x721035,null));};exports[_0x4dca('0x71')]=function(_0x1c0fa1,_0x1362e6,_0x40065f){return db[_0x4dca('0x67')]['findAll']({'where':{'id':_0x1c0fa1[_0x4dca('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4dca('0x5c')],'as':_0x4dca('0x68'),'attributes':['id'],'raw':!![]}]})[_0x4dca('0x26')](handleEntityNotFound(_0x1362e6,null))[_0x4dca('0x26')](function(_0x10e72c){var _0x50e915=_[_0x4dca('0x2e')](_0x10e72c,'id');var _0x43691d=[];var _0x5606f9=[];var _0x593a95=squel[_0x4dca('0x72')]();_0x593a95[_0x4dca('0x73')](_0x4dca('0x74'))[_0x4dca('0x75')](_0x4dca('0x76'),'tq')[_0x4dca('0x77')]('user_has_teams','ut',_0x4dca('0x78'))[_0x4dca('0x3e')]('FaxQueueId\x20=\x20?',_0x1c0fa1['params']['id']);for(var _0x5b9f43=0x0;_0x5b9f43<_0x10e72c[_0x4dca('0x3b')];_0x5b9f43+=0x1){let _0x562c43=_0x10e72c[_0x5b9f43];for(var _0x4a03d8=0x0;_0x4a03d8<_0x562c43[_0x4dca('0x68')][_0x4dca('0x3b')];_0x4a03d8+=0x1){let _0x22064f=_0x562c43[_0x4dca('0x68')][_0x4a03d8];var _0x5614d2=_0x593a95[_0x4dca('0x79')]();_0x5614d2[_0x4dca('0x3e')]('ut.UserId\x20=\x20?',_0x22064f['id']);_0x5606f9[_0x4dca('0x7a')](db[_0x4dca('0x7b')][_0x4dca('0x34')](_0x5614d2[_0x4dca('0x7c')](),{'type':db['sequelize'][_0x4dca('0x7d')][_0x4dca('0x7e')]})['then'](function(_0x3ca4c3){if(_0x3ca4c3['length']===0x1){return _0x22064f['id'];}else{var _0xf61dbe=_['every'](_['map'](_0x3ca4c3,_0x4dca('0x7f')),function(_0x5bb843){return _['includes'](_0x50e915,_0x5bb843);});if(_0xf61dbe){return _0x22064f['id'];}}}));}}return BPromise[_0x4dca('0x80')](_0x5606f9)['then'](function(_0x183bb8){_0x43691d=_(_0x43691d)[_0x4dca('0x81')](_0x183bb8)['compact']()[_0x4dca('0x82')]();return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x1c0fa1[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](function(_0x35d2f4){return db['sequelize'][_0x4dca('0x6d')](function(_0x4fd704){return _0x35d2f4[_0x4dca('0x71')](_0x1c0fa1['query'][_0x4dca('0x83')],{'transaction':_0x4fd704})[_0x4dca('0x26')](function(){if(!_[_0x4dca('0x84')](_0x43691d)){return _0x35d2f4[_0x4dca('0x85')](_0x43691d,{'transaction':_0x4fd704});}})[_0x4dca('0x26')](function(){_0x43691d[_0x4dca('0x6e')](function(_0x4a1a23){socket[_0x4dca('0x6f')](_0x4dca('0x86'),{'UserId':_0x4a1a23,'FaxQueueId':_0x35d2f4['id']});});});});});});})['then'](respondWithStatusCode(_0x1362e6,null))[_0x4dca('0x48')](handleError(_0x1362e6,null));};exports[_0x4dca('0x87')]=function(_0x29c0c5,_0x33d347,_0x296772){return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x29c0c5[_0x4dca('0x47')]['id']}})['then'](handleEntityNotFound(_0x33d347,null))[_0x4dca('0x26')](function(_0x4965ac){if(_0x4965ac){return _0x4965ac[_0x4dca('0x87')](_0x29c0c5[_0x4dca('0x52')][_0x4dca('0x83')],_['omit'](_0x29c0c5[_0x4dca('0x52')],['ids','id'])||{})[_0x4dca('0x88')](function(_0x178e85){for(var _0x54f51d=0x0;_0x54f51d<_0x29c0c5[_0x4dca('0x52')][_0x4dca('0x83')][_0x4dca('0x3b')];_0x54f51d+=0x1){socket['emit'](_0x4dca('0x70'),{'UserId':_0x29c0c5[_0x4dca('0x52')][_0x4dca('0x83')][_0x54f51d],'FaxQueueId':_0x29c0c5[_0x4dca('0x47')]['id']});}return _0x178e85;});}})['then'](respondWithResult(_0x33d347,null))['catch'](handleError(_0x33d347,null));};exports[_0x4dca('0x85')]=function(_0x3c656e,_0x2f8f36,_0x5ac6c1){return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x3c656e[_0x4dca('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f8f36,null))[_0x4dca('0x26')](function(_0xe3e72a){if(_0xe3e72a){return _0xe3e72a['removeAgents'](_0x3c656e['query'][_0x4dca('0x83')])[_0x4dca('0x26')](function(){if(_['isArray'](_0x3c656e[_0x4dca('0x34')][_0x4dca('0x83')])){for(var _0x1eb1b2=0x0;_0x1eb1b2<_0x3c656e['query'][_0x4dca('0x83')][_0x4dca('0x3b')];_0x1eb1b2+=0x1){socket[_0x4dca('0x6f')](_0x4dca('0x86'),{'UserId':Number(_0x3c656e[_0x4dca('0x34')]['ids'][_0x1eb1b2]),'FaxQueueId':Number(_0x3c656e[_0x4dca('0x47')]['id'])});}}else{socket[_0x4dca('0x6f')](_0x4dca('0x86'),{'UserId':Number(_0x3c656e['query'][_0x4dca('0x83')]),'FaxQueueId':Number(_0x3c656e[_0x4dca('0x47')]['id'])});}});}})[_0x4dca('0x26')](respondWithStatusCode(_0x2f8f36,null))['catch'](handleError(_0x2f8f36,null));};exports[_0x4dca('0x89')]=function(_0x26bb78,_0x3b598f,_0x4793d5){var _0x40aab3={};var _0x474e98={};var _0x44647c;var _0x74485e;return db[_0x4dca('0x2f')][_0x4dca('0x55')]({'where':{'id':_0x26bb78[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x3b598f,null))[_0x4dca('0x26')](function(_0x3e4de4){if(_0x3e4de4){_0x44647c=_0x3e4de4;_0x474e98[_0x4dca('0x38')]=_['keys'](db[_0x4dca('0x5c')]['rawAttributes']);_0x474e98['query']=_[_0x4dca('0x35')](_0x26bb78[_0x4dca('0x34')]);_0x474e98[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x474e98[_0x4dca('0x38')],_0x474e98[_0x4dca('0x34')]);_0x40aab3['attributes']=_[_0x4dca('0x37')](_0x474e98[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x26bb78['query'][_0x4dca('0x39')]));_0x40aab3['attributes']=_0x40aab3['attributes'][_0x4dca('0x3b')]?_0x40aab3[_0x4dca('0x3a')]:_0x474e98[_0x4dca('0x38')];_0x40aab3[_0x4dca('0x58')]=qs['sort'](_0x26bb78[_0x4dca('0x34')][_0x4dca('0x59')]);_0x40aab3['where']=qs[_0x4dca('0x36')](_[_0x4dca('0x8a')](_0x26bb78['query'],_0x474e98[_0x4dca('0x36')]));if(_0x26bb78[_0x4dca('0x34')]['filter']){_0x40aab3[_0x4dca('0x3e')]=_[_0x4dca('0x41')](_0x40aab3['where'],{'$or':_[_0x4dca('0x2e')](_0x40aab3[_0x4dca('0x3a')],function(_0x4bc88b){var _0x5d1915={};_0x5d1915[_0x4bc88b]={'$like':'%'+_0x26bb78['query'][_0x4dca('0x3f')]+'%'};return _0x5d1915;})});}_0x40aab3=_['merge']({},_0x40aab3,_0x26bb78['options']);return _0x44647c['getAgents'](_0x40aab3);}})[_0x4dca('0x26')](function(_0x58ab2a){if(_0x58ab2a){_0x74485e=_0x58ab2a[_0x4dca('0x3b')];if(!_0x26bb78[_0x4dca('0x34')][_0x4dca('0x57')](_0x4dca('0x3c'))){_0x40aab3[_0x4dca('0x3d')]=qs['limit'](_0x26bb78[_0x4dca('0x34')][_0x4dca('0x3d')]);_0x40aab3['offset']=qs[_0x4dca('0x22')](_0x26bb78[_0x4dca('0x34')]['offset']);}return _0x44647c[_0x4dca('0x89')](_0x40aab3);}})['then'](function(_0x4a3867){if(_0x4a3867){return _0x4a3867?{'count':_0x74485e,'rows':_0x4a3867}:null;}})[_0x4dca('0x26')](respondWithResult(_0x3b598f,null))[_0x4dca('0x48')](handleError(_0x3b598f,null));}; \ No newline at end of file +var _0x0993=['../../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','./faxQueue.socket','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','FaxQueues','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','addTeams','ids','Agents','online','interface','transaction','each','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','removeAgents','addAgents','omit','spread','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x5de42f,_0x71db9a){var _0x5c7df7=function(_0x4c4af){while(--_0x4c4af){_0x5de42f['push'](_0x5de42f['shift']());}};_0x5c7df7(++_0x71db9a);}(_0x0993,0x81));var _0x3099=function(_0x43ca37,_0x5f3441){_0x43ca37=_0x43ca37-0x0;var _0x3de945=_0x0993[_0x43ca37];return _0x3de945;};'use strict';var pdf=require(_0x3099('0x0'));var emlformat=require(_0x3099('0x1'));var rimraf=require(_0x3099('0x2'));var zipdir=require(_0x3099('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3099('0x4'));var moment=require(_0x3099('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3099('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3099('0x7'));var csv=require(_0x3099('0x8'));var ejs=require(_0x3099('0x9'));var fs=require('fs');var _=require(_0x3099('0xa'));var squel=require(_0x3099('0xb'));var crypto=require(_0x3099('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3099('0xd'));var toCsv=require(_0x3099('0x8'));var querystring=require(_0x3099('0xe'));var Papa=require('papaparse');var Redis=require(_0x3099('0xf'));var authService=require(_0x3099('0x10'));var qs=require(_0x3099('0x11'));var as=require(_0x3099('0x12'));var hardwareService=require(_0x3099('0x13'));var logger=require(_0x3099('0x14'))(_0x3099('0x15'));var utils=require(_0x3099('0x16'));var config=require(_0x3099('0x17'));var db=require(_0x3099('0x18'))['db'];config[_0x3099('0x19')]=_[_0x3099('0x1a')](config['redis'],{'host':_0x3099('0x1b'),'port':0x18eb});var socket=require(_0x3099('0x1c'))(new Redis(config[_0x3099('0x19')]));require(_0x3099('0x1d'))['register'](socket);function respondWithStatusCode(_0x3c0020,_0x34ec5f){_0x34ec5f=_0x34ec5f||0xcc;return function(_0x1d236c){if(_0x1d236c){return _0x3c0020[_0x3099('0x1e')](_0x34ec5f);}return _0x3c0020[_0x3099('0x1f')](_0x34ec5f)[_0x3099('0x20')]();};}function respondWithResult(_0x5bd441,_0x137a51){_0x137a51=_0x137a51||0xc8;return function(_0x52c603){if(_0x52c603){return _0x5bd441[_0x3099('0x1f')](_0x137a51)['json'](_0x52c603);}};}function respondWithFilteredResult(_0x5ecbf8,_0x1bbe3c){return function(_0x49fec9){if(_0x49fec9){var _0x17e705=_0x49fec9[_0x3099('0x21')],_0x483875=_0x1bbe3c[_0x3099('0x22')],_0x392a42=_0x1bbe3c[_0x3099('0x22')]+_0x1bbe3c[_0x3099('0x23')],_0x22e129;if(_0x392a42>=_0x17e705){_0x392a42=_0x17e705;_0x22e129=0xc8;}else{_0x22e129=0xce;}_0x5ecbf8[_0x3099('0x1f')](_0x22e129);return _0x5ecbf8[_0x3099('0x24')]('Content-Range',_0x483875+'-'+_0x392a42+'/'+_0x17e705)[_0x3099('0x25')](_0x49fec9);}return null;};}function patchUpdates(_0x4d739d){return function(_0x156269){try{jsonpatch[_0x3099('0x26')](_0x156269,_0x4d739d,!![]);}catch(_0x22b881){return BPromise[_0x3099('0x27')](_0x22b881);}return _0x156269[_0x3099('0x28')]();};}function saveUpdates(_0x2137ee,_0x5cbf7f){return function(_0x2b0ad2){if(_0x2b0ad2){return _0x2b0ad2[_0x3099('0x29')](_0x2137ee)[_0x3099('0x2a')](function(_0x321b8e){return _0x321b8e;});}return null;};}function removeEntity(_0xf2e5fa,_0x357e54){return function(_0x34d657){if(_0x34d657){return _0x34d657[_0x3099('0x2b')]()[_0x3099('0x2a')](function(){var _0x5e510d=_0x34d657['get']({'plain':!![]});var _0x576c47=_0x3099('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x576c47,'resourceId':_0x5e510d['id']}})[_0x3099('0x2a')](function(){return _0x34d657;});})['then'](function(){_0xf2e5fa[_0x3099('0x1f')](0xcc)[_0x3099('0x20')]();});}};}function handleEntityNotFound(_0x4d3a9e,_0x3e9f4c){return function(_0x1d611f){if(!_0x1d611f){_0x4d3a9e['sendStatus'](0x194);}return _0x1d611f;};}function handleError(_0xf18a1e,_0x4f3678){_0x4f3678=_0x4f3678||0x1f4;return function(_0x5a451f){logger[_0x3099('0x2d')](_0x5a451f[_0x3099('0x2e')]);if(_0x5a451f[_0x3099('0x2f')]){delete _0x5a451f[_0x3099('0x2f')];}_0xf18a1e['status'](_0x4f3678)[_0x3099('0x30')](_0x5a451f);};}exports[_0x3099('0x31')]=function(_0x8639d8,_0xa70827){var _0x5a8912={},_0x431f8f={},_0x5e5604={'count':0x0,'rows':[]};var _0x368250=_[_0x3099('0x32')](db[_0x3099('0x33')][_0x3099('0x34')],function(_0x4c98c5){return{'name':_0x4c98c5[_0x3099('0x35')],'type':_0x4c98c5['type'][_0x3099('0x36')]};});_0x431f8f['model']=_[_0x3099('0x32')](_0x368250,_0x3099('0x2f'));_0x431f8f[_0x3099('0x37')]=_[_0x3099('0x38')](_0x8639d8['query']);_0x431f8f[_0x3099('0x39')]=_[_0x3099('0x3a')](_0x431f8f[_0x3099('0x3b')],_0x431f8f[_0x3099('0x37')]);_0x5a8912[_0x3099('0x3c')]=_[_0x3099('0x3a')](_0x431f8f[_0x3099('0x3b')],qs[_0x3099('0x3d')](_0x8639d8[_0x3099('0x37')][_0x3099('0x3d')]));_0x5a8912[_0x3099('0x3c')]=_0x5a8912['attributes'][_0x3099('0x3e')]?_0x5a8912['attributes']:_0x431f8f[_0x3099('0x3b')];if(!_0x8639d8[_0x3099('0x37')][_0x3099('0x3f')](_0x3099('0x40'))){_0x5a8912[_0x3099('0x23')]=qs[_0x3099('0x23')](_0x8639d8[_0x3099('0x37')][_0x3099('0x23')]);_0x5a8912['offset']=qs[_0x3099('0x22')](_0x8639d8[_0x3099('0x37')][_0x3099('0x22')]);}_0x5a8912['order']=qs[_0x3099('0x41')](_0x8639d8[_0x3099('0x37')][_0x3099('0x41')]);_0x5a8912[_0x3099('0x42')]=qs[_0x3099('0x39')](_['pick'](_0x8639d8['query'],_0x431f8f[_0x3099('0x39')]),_0x368250);if(_0x8639d8[_0x3099('0x37')]['filter']){_0x5a8912['where']=_[_0x3099('0x43')](_0x5a8912['where'],{'$or':_[_0x3099('0x32')](_0x368250,function(_0x3e38c7){if(_0x3e38c7[_0x3099('0x44')]!==_0x3099('0x45')){var _0x475cb6={};_0x475cb6[_0x3e38c7[_0x3099('0x2f')]]={'$like':'%'+_0x8639d8[_0x3099('0x37')][_0x3099('0x46')]+'%'};return _0x475cb6;}})});}_0x5a8912=_[_0x3099('0x43')]({},_0x5a8912,_0x8639d8[_0x3099('0x47')]);var _0x161fce={'where':_0x5a8912[_0x3099('0x42')]};return db['FaxQueue'][_0x3099('0x21')](_0x161fce)[_0x3099('0x2a')](function(_0x43e9dc){_0x5e5604[_0x3099('0x21')]=_0x43e9dc;if(_0x8639d8[_0x3099('0x37')][_0x3099('0x48')]){_0x5a8912[_0x3099('0x49')]=[{'all':!![]}];}return db[_0x3099('0x33')][_0x3099('0x4a')](_0x5a8912);})[_0x3099('0x2a')](function(_0x478c58){_0x5e5604[_0x3099('0x4b')]=_0x478c58;return _0x5e5604;})['then'](respondWithFilteredResult(_0xa70827,_0x5a8912))[_0x3099('0x4c')](handleError(_0xa70827,null));};exports[_0x3099('0x4d')]=function(_0x36cfe8,_0x453a5b){var _0x578622={'raw':!![],'where':{'id':_0x36cfe8[_0x3099('0x4e')]['id']}},_0x45fa4f={};_0x45fa4f['model']=_['keys'](db[_0x3099('0x33')]['rawAttributes']);_0x45fa4f[_0x3099('0x37')]=_['keys'](_0x36cfe8[_0x3099('0x37')]);_0x45fa4f[_0x3099('0x39')]=_['intersection'](_0x45fa4f['model'],_0x45fa4f[_0x3099('0x37')]);_0x578622[_0x3099('0x3c')]=_[_0x3099('0x3a')](_0x45fa4f[_0x3099('0x3b')],qs['fields'](_0x36cfe8[_0x3099('0x37')][_0x3099('0x3d')]));_0x578622[_0x3099('0x3c')]=_0x578622[_0x3099('0x3c')]['length']?_0x578622['attributes']:_0x45fa4f[_0x3099('0x3b')];if(_0x36cfe8[_0x3099('0x37')]['includeAll']){_0x578622[_0x3099('0x49')]=[{'all':!![]}];}_0x578622=_[_0x3099('0x43')]({},_0x578622,_0x36cfe8[_0x3099('0x47')]);return db[_0x3099('0x33')][_0x3099('0x4f')](_0x578622)[_0x3099('0x2a')](handleEntityNotFound(_0x453a5b,null))[_0x3099('0x2a')](respondWithResult(_0x453a5b,null))[_0x3099('0x4c')](handleError(_0x453a5b,null));};exports[_0x3099('0x50')]=function(_0x3a2d31,_0x1a9315){return db[_0x3099('0x33')][_0x3099('0x50')](_0x3a2d31[_0x3099('0x51')],{})['then'](function(_0x519739){var _0x549706=_0x3a2d31[_0x3099('0x52')]['get']({'plain':!![]});if(!_0x549706)throw new Error(_0x3099('0x53'));if(_0x549706[_0x3099('0x54')]==='user'){var _0x1a52b7=_0x519739[_0x3099('0x55')]({'plain':!![]});var _0xf8f66a=_0x3099('0x2c');return db[_0x3099('0x56')][_0x3099('0x4f')]({'where':{'name':_0xf8f66a,'userProfileId':_0x549706[_0x3099('0x57')]},'raw':!![]})['then'](function(_0x43e7d0){if(_0x43e7d0&&_0x43e7d0[_0x3099('0x58')]===0x0){return db[_0x3099('0x59')]['create']({'name':_0x1a52b7[_0x3099('0x2f')],'resourceId':_0x1a52b7['id'],'type':_0x43e7d0[_0x3099('0x2f')],'sectionId':_0x43e7d0['id']},{})[_0x3099('0x2a')](function(){return _0x519739;});}else{return _0x519739;}})['catch'](function(_0x56c94f){logger['error'](_0x3099('0x5a'),_0x56c94f);throw _0x56c94f;});}return _0x519739;})[_0x3099('0x2a')](respondWithResult(_0x1a9315,0xc9))[_0x3099('0x4c')](handleError(_0x1a9315,null));};exports[_0x3099('0x29')]=function(_0x3e9639,_0x3356bd){if(_0x3e9639['body']['id']){delete _0x3e9639[_0x3099('0x51')]['id'];}return db[_0x3099('0x33')][_0x3099('0x4f')]({'where':{'id':_0x3e9639[_0x3099('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3356bd,null))[_0x3099('0x2a')](saveUpdates(_0x3e9639[_0x3099('0x51')],null))[_0x3099('0x2a')](respondWithResult(_0x3356bd,null))[_0x3099('0x4c')](handleError(_0x3356bd,null));};exports['destroy']=function(_0x474994,_0x37d0a6){return db[_0x3099('0x33')]['find']({'where':{'id':_0x474994['params']['id']}})['then'](handleEntityNotFound(_0x37d0a6,null))['then'](removeEntity(_0x37d0a6,null))['catch'](handleError(_0x37d0a6,null));};exports['describe']=function(_0x4153fb,_0x2fa4ef){return db[_0x3099('0x33')][_0x3099('0x5b')]()[_0x3099('0x2a')](respondWithResult(_0x2fa4ef,null))[_0x3099('0x4c')](handleError(_0x2fa4ef,null));};exports[_0x3099('0x5c')]=function(_0x7078d2,_0x42f19d,_0x369b87){var _0x213373={'raw':!![],'where':{}},_0x4235fe={},_0x3e358f;return db[_0x3099('0x33')][_0x3099('0x5d')]({'where':{'id':_0x7078d2[_0x3099('0x4e')]['id']}})[_0x3099('0x2a')](handleEntityNotFound(_0x42f19d,null))[_0x3099('0x2a')](function(_0x5464d1){if(_0x5464d1){_0x3e358f=_0x5464d1[_0x3099('0x55')]({'plain':!![]});_0x4235fe[_0x3099('0x3b')]=_[_0x3099('0x38')](db['UserFaxQueue'][_0x3099('0x34')]);_0x4235fe[_0x3099('0x37')]=_['keys'](_0x7078d2[_0x3099('0x37')]);_0x4235fe[_0x3099('0x39')]=_['intersection'](_0x4235fe[_0x3099('0x3b')],_0x4235fe['query']);_0x213373['attributes']=_[_0x3099('0x3a')](_0x4235fe[_0x3099('0x3b')],qs['fields'](_0x7078d2[_0x3099('0x37')][_0x3099('0x3d')]));_0x213373[_0x3099('0x3c')]=_0x213373['attributes']['length']?_0x213373['attributes']:_0x4235fe[_0x3099('0x3b')];if(!_0x7078d2[_0x3099('0x37')][_0x3099('0x3f')](_0x3099('0x40'))){_0x213373[_0x3099('0x23')]=qs['limit'](_0x7078d2[_0x3099('0x37')]['limit']);_0x213373[_0x3099('0x22')]=qs['offset'](_0x7078d2[_0x3099('0x37')][_0x3099('0x22')]);}_0x213373['order']=qs[_0x3099('0x41')](_0x7078d2[_0x3099('0x37')][_0x3099('0x41')]);_0x213373['where']=qs[_0x3099('0x39')](_[_0x3099('0x5e')](_0x7078d2[_0x3099('0x37')],_0x4235fe[_0x3099('0x39')]));_0x213373[_0x3099('0x42')][_0x3099('0x5f')]=_0x5464d1['id'];if(_0x7078d2['query'][_0x3099('0x46')]){_0x213373[_0x3099('0x42')]=_[_0x3099('0x43')](_0x213373[_0x3099('0x42')],{'$or':_[_0x3099('0x32')](_0x213373['attributes'],function(_0x591738){var _0x87a7c0={};_0x87a7c0[_0x591738]={'$like':'%'+_0x7078d2[_0x3099('0x37')][_0x3099('0x46')]+'%'};return _0x87a7c0;})});}_0x213373=_[_0x3099('0x43')]({},_0x213373,_0x7078d2[_0x3099('0x47')]);return db[_0x3099('0x60')]['findAll'](_0x213373);}})['then'](function(_0x26c59b){if(_0x26c59b){return db[_0x3099('0x61')]['findAndCountAll']({'where':{'id':_[_0x3099('0x32')](_0x26c59b,_0x3099('0x62')),'role':_0x3099('0x63')},'attributes':['id',_0x3099('0x2f'),_0x3099('0x64'),_0x3099('0x65'),_0x3099('0x66')]});}})[_0x3099('0x2a')](function(_0x1aa863){if(_0x1aa863){return{'count':_0x1aa863[_0x3099('0x21')],'rows':_[_0x3099('0x32')](_0x1aa863['rows'],function(_0x2cf78f){return{'membername':_0x2cf78f[_0x3099('0x2f')],'UserId':_0x2cf78f['id'],'queue_name':_0x3e358f[_0x3099('0x2f')],'FaxQueueId':_0x3e358f['id'],'interface':util[_0x3099('0x67')](_0x3099('0x68'),_0x3099('0x69'),_0x2cf78f[_0x3099('0x2f')]),'penalty':0x0,'paused':_0x2cf78f[_0x3099('0x64')],'createdAt':_0x2cf78f['createdAt'],'updatedAt':_0x2cf78f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3099('0x2a')](respondWithFilteredResult(_0x42f19d,_0x213373))['catch'](handleError(_0x42f19d,null));};exports[_0x3099('0x6a')]=function(_0x3793cc,_0x10d893,_0x4e4b51){var _0x3fbcfb={};var _0x3dfd91={};var _0x3fda87;var _0xea9fdb;return db[_0x3099('0x33')][_0x3099('0x5d')]({'where':{'id':_0x3793cc[_0x3099('0x4e')]['id']}})[_0x3099('0x2a')](handleEntityNotFound(_0x10d893,null))['then'](function(_0x4bf61f){if(_0x4bf61f){_0x3fda87=_0x4bf61f;_0x3dfd91['model']=_['keys'](db[_0x3099('0x6b')][_0x3099('0x34')]);_0x3dfd91[_0x3099('0x37')]=_['keys'](_0x3793cc[_0x3099('0x37')]);_0x3dfd91[_0x3099('0x39')]=_[_0x3099('0x3a')](_0x3dfd91[_0x3099('0x3b')],_0x3dfd91['query']);_0x3fbcfb[_0x3099('0x3c')]=_[_0x3099('0x3a')](_0x3dfd91[_0x3099('0x3b')],qs[_0x3099('0x3d')](_0x3793cc['query'][_0x3099('0x3d')]));_0x3fbcfb[_0x3099('0x3c')]=_0x3fbcfb['attributes'][_0x3099('0x3e')]?_0x3fbcfb[_0x3099('0x3c')]:_0x3dfd91['model'];_0x3fbcfb[_0x3099('0x6c')]=qs[_0x3099('0x41')](_0x3793cc[_0x3099('0x37')][_0x3099('0x41')]);_0x3fbcfb[_0x3099('0x42')]=qs['filters'](_[_0x3099('0x5e')](_0x3793cc['query'],_0x3dfd91[_0x3099('0x39')]));if(_0x3793cc[_0x3099('0x37')][_0x3099('0x46')]){_0x3fbcfb[_0x3099('0x42')]=_[_0x3099('0x43')](_0x3fbcfb[_0x3099('0x42')],{'$or':_[_0x3099('0x32')](_0x3fbcfb[_0x3099('0x3c')],function(_0x31f1e5){var _0x51c130={};_0x51c130[_0x31f1e5]={'$like':'%'+_0x3793cc[_0x3099('0x37')][_0x3099('0x46')]+'%'};return _0x51c130;})});}_0x3fbcfb=_[_0x3099('0x43')]({},_0x3fbcfb,_0x3793cc[_0x3099('0x47')]);return _0x3fda87[_0x3099('0x6a')](_0x3fbcfb);}})[_0x3099('0x2a')](function(_0x261c78){if(_0x261c78){_0xea9fdb=_0x261c78[_0x3099('0x3e')];if(!_0x3793cc[_0x3099('0x37')]['hasOwnProperty'](_0x3099('0x40'))){_0x3fbcfb[_0x3099('0x23')]=qs['limit'](_0x3793cc[_0x3099('0x37')][_0x3099('0x23')]);_0x3fbcfb['offset']=qs['offset'](_0x3793cc[_0x3099('0x37')][_0x3099('0x22')]);}return _0x3fda87[_0x3099('0x6a')](_0x3fbcfb);}})[_0x3099('0x2a')](function(_0x2564d7){if(_0x2564d7){return _0x2564d7?{'count':_0xea9fdb,'rows':_0x2564d7}:null;}})[_0x3099('0x2a')](respondWithResult(_0x10d893,null))[_0x3099('0x4c')](handleError(_0x10d893,null));};exports[_0x3099('0x6d')]=function(_0x5ed924,_0x19e472,_0x2d12cc){var _0x4e1ee6=_0x5ed924[_0x3099('0x51')][_0x3099('0x6e')];return db[_0x3099('0x6b')][_0x3099('0x4a')]({'where':{'id':_0x4e1ee6},'attributes':['id'],'include':[{'model':db[_0x3099('0x61')],'as':_0x3099('0x6f'),'attributes':['id',_0x3099('0x2f'),_0x3099('0x70'),'voicePause',_0x3099('0x71')],'raw':!![]}]})[_0x3099('0x2a')](function(_0x14c294){if(_0x14c294){var _0x34531b=_['flatMap'](_0x14c294,function(_0x9cc36c){var _0x4d9e45=_0x9cc36c[_0x3099('0x55')]({'plain':!![]});return _0x4d9e45[_0x3099('0x6f')];});return db['FaxQueue'][_0x3099('0x4f')]({'where':{'id':_0x5ed924[_0x3099('0x4e')]['id']}})[_0x3099('0x2a')](function(_0x2f7253){return db['sequelize'][_0x3099('0x72')](function(_0x703bff){return _0x2f7253['addTeams'](_0x4e1ee6,{'transaction':_0x703bff})[_0x3099('0x2a')](function(){return BPromise[_0x3099('0x73')](_0x34531b,function(_0x4e71a8){return db[_0x3099('0x60')]['findOrCreate']({'where':{'UserId':_0x4e71a8['id'],'FaxQueueId':_0x5ed924['params']['id']},'transaction':_0x703bff});});})[_0x3099('0x2a')](function(){_0x34531b[_0x3099('0x74')](function(_0x2d6639){socket[_0x3099('0x75')](_0x3099('0x76'),{'UserId':_0x2d6639['id'],'FaxQueueId':_0x2f7253['id']});});});});});}})[_0x3099('0x2a')](respondWithStatusCode(_0x19e472,null))['catch'](handleError(_0x19e472,null));};exports['removeTeams']=function(_0x22e551,_0x3bdda2,_0x2bf0ab){return db[_0x3099('0x6b')][_0x3099('0x4a')]({'where':{'id':_0x22e551[_0x3099('0x37')][_0x3099('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x3099('0x61')],'as':_0x3099('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x3099('0x2a')](handleEntityNotFound(_0x3bdda2,null))['then'](function(_0x24b4e9){var _0x15b0d5=_['map'](_0x24b4e9,'id');var _0x4043ea=[];var _0x5bddc7=[];var _0xa04cc1=squel['select']();_0xa04cc1[_0x3099('0x77')](_0x3099('0x78'))[_0x3099('0x79')](_0x3099('0x7a'),'tq')['join'](_0x3099('0x7b'),'ut',_0x3099('0x7c'))['where'](_0x3099('0x7d'),_0x22e551[_0x3099('0x4e')]['id']);for(var _0x5c5a74=0x0;_0x5c5a74<_0x24b4e9[_0x3099('0x3e')];_0x5c5a74+=0x1){let _0x632d23=_0x24b4e9[_0x5c5a74];for(var _0x134b89=0x0;_0x134b89<_0x632d23[_0x3099('0x6f')]['length'];_0x134b89+=0x1){let _0x331942=_0x632d23[_0x3099('0x6f')][_0x134b89];var _0x24d08d=_0xa04cc1[_0x3099('0x7e')]();_0x24d08d[_0x3099('0x42')](_0x3099('0x7f'),_0x331942['id']);_0x5bddc7[_0x3099('0x80')](db[_0x3099('0x81')][_0x3099('0x37')](_0x24d08d[_0x3099('0x82')](),{'type':db[_0x3099('0x81')][_0x3099('0x83')][_0x3099('0x84')]})[_0x3099('0x2a')](function(_0x2ee441){if(_0x2ee441[_0x3099('0x3e')]===0x1){return _0x331942['id'];}else{var _0x316116=_[_0x3099('0x85')](_['map'](_0x2ee441,'TeamId'),function(_0x22ccf0){return _[_0x3099('0x86')](_0x15b0d5,_0x22ccf0);});if(_0x316116){return _0x331942['id'];}}}));}}return BPromise[_0x3099('0x87')](_0x5bddc7)[_0x3099('0x2a')](function(_0x773bc5){_0x4043ea=_(_0x4043ea)[_0x3099('0x88')](_0x773bc5)[_0x3099('0x89')]()['value']();return db['FaxQueue'][_0x3099('0x4f')]({'where':{'id':_0x22e551[_0x3099('0x4e')]['id']}})[_0x3099('0x2a')](function(_0xf54391){return db[_0x3099('0x81')]['transaction'](function(_0xf1c5a6){return _0xf54391[_0x3099('0x8a')](_0x22e551['query'][_0x3099('0x6e')],{'transaction':_0xf1c5a6})[_0x3099('0x2a')](function(){if(!_['isEmpty'](_0x4043ea)){return _0xf54391[_0x3099('0x8b')](_0x4043ea,{'transaction':_0xf1c5a6});}})[_0x3099('0x2a')](function(){_0x4043ea[_0x3099('0x74')](function(_0x457849){socket[_0x3099('0x75')]('userFaxQueue:remove',{'UserId':_0x457849,'FaxQueueId':_0xf54391['id']});});});});});});})[_0x3099('0x2a')](respondWithStatusCode(_0x3bdda2,null))['catch'](handleError(_0x3bdda2,null));};exports[_0x3099('0x8c')]=function(_0x1ac8a7,_0x225d74,_0x1cc573){return db[_0x3099('0x33')][_0x3099('0x4f')]({'where':{'id':_0x1ac8a7[_0x3099('0x4e')]['id']}})[_0x3099('0x2a')](handleEntityNotFound(_0x225d74,null))[_0x3099('0x2a')](function(_0x4440a0){if(_0x4440a0){return _0x4440a0[_0x3099('0x8c')](_0x1ac8a7[_0x3099('0x51')][_0x3099('0x6e')],_[_0x3099('0x8d')](_0x1ac8a7[_0x3099('0x51')],[_0x3099('0x6e'),'id'])||{})[_0x3099('0x8e')](function(_0x5d1ee6){for(var _0x402ab7=0x0;_0x402ab7<_0x1ac8a7[_0x3099('0x51')]['ids'][_0x3099('0x3e')];_0x402ab7+=0x1){socket[_0x3099('0x75')](_0x3099('0x76'),{'UserId':_0x1ac8a7[_0x3099('0x51')]['ids'][_0x402ab7],'FaxQueueId':_0x1ac8a7[_0x3099('0x4e')]['id']});}return _0x5d1ee6;});}})[_0x3099('0x2a')](respondWithResult(_0x225d74,null))[_0x3099('0x4c')](handleError(_0x225d74,null));};exports[_0x3099('0x8b')]=function(_0x419d71,_0x18f57e,_0x4fa952){return db[_0x3099('0x33')][_0x3099('0x4f')]({'where':{'id':_0x419d71['params']['id']}})[_0x3099('0x2a')](handleEntityNotFound(_0x18f57e,null))[_0x3099('0x2a')](function(_0x15b4c9){if(_0x15b4c9){return _0x15b4c9['removeAgents'](_0x419d71['query'][_0x3099('0x6e')])[_0x3099('0x2a')](function(){if(_['isArray'](_0x419d71['query'][_0x3099('0x6e')])){for(var _0x336798=0x0;_0x336798<_0x419d71['query'][_0x3099('0x6e')]['length'];_0x336798+=0x1){socket[_0x3099('0x75')](_0x3099('0x8f'),{'UserId':Number(_0x419d71['query']['ids'][_0x336798]),'FaxQueueId':Number(_0x419d71['params']['id'])});}}else{socket[_0x3099('0x75')](_0x3099('0x8f'),{'UserId':Number(_0x419d71['query'][_0x3099('0x6e')]),'FaxQueueId':Number(_0x419d71[_0x3099('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x18f57e,null))[_0x3099('0x4c')](handleError(_0x18f57e,null));};exports[_0x3099('0x90')]=function(_0xe8e241,_0x7ed367,_0x3da4cc){var _0x4017a9={};var _0xe2af09={};var _0x2bd9f9;var _0x5b6050;return db[_0x3099('0x33')]['findOne']({'where':{'id':_0xe8e241['params']['id']}})[_0x3099('0x2a')](handleEntityNotFound(_0x7ed367,null))['then'](function(_0x36600a){if(_0x36600a){_0x2bd9f9=_0x36600a;_0xe2af09['model']=_[_0x3099('0x38')](db[_0x3099('0x61')][_0x3099('0x34')]);_0xe2af09[_0x3099('0x37')]=_[_0x3099('0x38')](_0xe8e241[_0x3099('0x37')]);_0xe2af09[_0x3099('0x39')]=_[_0x3099('0x3a')](_0xe2af09[_0x3099('0x3b')],_0xe2af09['query']);_0x4017a9[_0x3099('0x3c')]=_['intersection'](_0xe2af09[_0x3099('0x3b')],qs['fields'](_0xe8e241[_0x3099('0x37')]['fields']));_0x4017a9[_0x3099('0x3c')]=_0x4017a9[_0x3099('0x3c')][_0x3099('0x3e')]?_0x4017a9['attributes']:_0xe2af09[_0x3099('0x3b')];_0x4017a9[_0x3099('0x6c')]=qs['sort'](_0xe8e241['query']['sort']);_0x4017a9[_0x3099('0x42')]=qs[_0x3099('0x39')](_[_0x3099('0x5e')](_0xe8e241[_0x3099('0x37')],_0xe2af09[_0x3099('0x39')]));if(_0xe8e241[_0x3099('0x37')]['filter']){_0x4017a9[_0x3099('0x42')]=_['merge'](_0x4017a9[_0x3099('0x42')],{'$or':_['map'](_0x4017a9[_0x3099('0x3c')],function(_0x2e6408){var _0x5a24ae={};_0x5a24ae[_0x2e6408]={'$like':'%'+_0xe8e241[_0x3099('0x37')]['filter']+'%'};return _0x5a24ae;})});}_0x4017a9=_[_0x3099('0x43')]({},_0x4017a9,_0xe8e241[_0x3099('0x47')]);return _0x2bd9f9['getAgents'](_0x4017a9);}})['then'](function(_0x572377){if(_0x572377){_0x5b6050=_0x572377[_0x3099('0x3e')];if(!_0xe8e241[_0x3099('0x37')]['hasOwnProperty']('nolimit')){_0x4017a9[_0x3099('0x23')]=qs[_0x3099('0x23')](_0xe8e241[_0x3099('0x37')][_0x3099('0x23')]);_0x4017a9[_0x3099('0x22')]=qs[_0x3099('0x22')](_0xe8e241['query'][_0x3099('0x22')]);}return _0x2bd9f9[_0x3099('0x90')](_0x4017a9);}})[_0x3099('0x2a')](function(_0x3a836c){if(_0x3a836c){return _0x3a836c?{'count':_0x5b6050,'rows':_0x3a836c}:null;}})[_0x3099('0x2a')](respondWithResult(_0x7ed367,null))[_0x3099('0x4c')](handleError(_0x7ed367,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 68e046f..b91ca00 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 _0x02e5=['events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x460c38,_0x257274){var _0x1486b8=function(_0x40d2c1){while(--_0x40d2c1){_0x460c38['push'](_0x460c38['shift']());}};_0x1486b8(++_0x257274);}(_0x02e5,0xc6));var _0x502e=function(_0x219ca0,_0x3708be){_0x219ca0=_0x219ca0-0x0;var _0x2056aa=_0x02e5[_0x219ca0];return _0x2056aa;};'use strict';var EventEmitter=require(_0x502e('0x0'));var FaxQueue=require(_0x502e('0x1'))['db'][_0x502e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x502e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x502e('0x4'),'afterDestroy':_0x502e('0x5')};function emitEvent(_0x4dd5a4){return function(_0x570d96,_0x7988bd,_0xd424e8){FaxQueueEvents[_0x502e('0x6')](_0x4dd5a4+':'+_0x570d96['id'],_0x570d96);FaxQueueEvents[_0x502e('0x6')](_0x4dd5a4,_0x570d96);_0xd424e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x502e('0x7')](e,emitEvent(event));}}module[_0x502e('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x93fd=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2cbaa5,_0x2349e2){var _0x5bb0cc=function(_0x2f9462){while(--_0x2f9462){_0x2cbaa5['push'](_0x2cbaa5['shift']());}};_0x5bb0cc(++_0x2349e2);}(_0x93fd,0x1dd));var _0xd93f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x93fd[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xd93f('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd93f('0x1')](0x0);var events={'afterCreate':_0xd93f('0x2'),'afterUpdate':_0xd93f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2dc9e9){return function(_0x54cc23,_0x49ce75,_0xbacfe9){FaxQueueEvents[_0xd93f('0x4')](_0x2dc9e9+':'+_0x54cc23['id'],_0x54cc23);FaxQueueEvents[_0xd93f('0x4')](_0x2dc9e9,_0x54cc23);_0xbacfe9(null);};}for(var e in events){if(events[_0xd93f('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xd93f('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 17c1251..b1f8117 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 _0x7d89=['exports','define','FaxQueue','fax_queues','lodash','util','bluebird','path','rimraf','../../config/environment'];(function(_0x187783,_0x523c06){var _0x20cfcd=function(_0x53a715){while(--_0x53a715){_0x187783['push'](_0x187783['shift']());}};_0x20cfcd(++_0x523c06);}(_0x7d89,0x68));var _0x97d8=function(_0x5373d4,_0x3e257e){_0x5373d4=_0x5373d4-0x0;var _0x21050d=_0x7d89[_0x5373d4];return _0x21050d;};'use strict';var _=require(_0x97d8('0x0'));var util=require(_0x97d8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x97d8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97d8('0x3'));var rimraf=require(_0x97d8('0x4'));var config=require(_0x97d8('0x5'));var attributes=require('./faxQueue.attributes');module[_0x97d8('0x6')]=function(_0x7bf0f6,_0x28be3c){return _0x7bf0f6[_0x97d8('0x7')](_0x97d8('0x8'),attributes,{'tableName':_0x97d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd805=['bluebird','path','./faxQueue.attributes','exports','define','FaxQueue','util','../../config/logger','api','moment'];(function(_0x2c42c5,_0x14255){var _0x524503=function(_0x3baeec){while(--_0x3baeec){_0x2c42c5['push'](_0x2c42c5['shift']());}};_0x524503(++_0x14255);}(_0xd805,0x13c));var _0x5d80=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0xd805[_0x2b84d5];return _0x51452a;};'use strict';var _=require('lodash');var util=require(_0x5d80('0x0'));var logger=require(_0x5d80('0x1'))(_0x5d80('0x2'));var moment=require(_0x5d80('0x3'));var BPromise=require(_0x5d80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d80('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d80('0x6'));module[_0x5d80('0x7')]=function(_0x145804,_0x588668){return _0x145804[_0x5d80('0x8')](_0x5d80('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index dfbad7a..7bf4cef 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 _0x58a7=['model','ShowFaxQueue','find','where','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map'];(function(_0x195e4a,_0x2e769a){var _0x650a3a=function(_0x24197e){while(--_0x24197e){_0x195e4a['push'](_0x195e4a['shift']());}};_0x650a3a(++_0x2e769a);}(_0x58a7,0x19f));var _0x758a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x58a7[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x758a('0x0'));var util=require('util');var moment=require(_0x758a('0x1'));var BPromise=require(_0x758a('0x2'));var rs=require(_0x758a('0x3'));var fs=require('fs');var Redis=require(_0x758a('0x4'));var db=require(_0x758a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x758a('0x6'))(_0x758a('0x7'));var config=require(_0x758a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x758a('0x9')][_0x758a('0xa')]({'port':0x232a});config['redis']=_[_0x758a('0xb')](config[_0x758a('0xc')],{'host':_0x758a('0xd'),'port':0x18eb});var socket=require(_0x758a('0xe'))(new Redis(config[_0x758a('0xc')]));require(_0x758a('0xf'))[_0x758a('0x10')](socket);function respondWithRpcPromise(_0x532896,_0x55872f,_0x5d1890){return new BPromise(function(_0x28ce27,_0x42208e){return client['request'](_0x532896,_0x5d1890)[_0x758a('0x11')](function(_0x2baa3c){logger[_0x758a('0x12')]('FaxQueue,\x20%s,\x20%s',_0x55872f,_0x758a('0x13'));logger['debug'](_0x758a('0x14'),_0x55872f,_0x758a('0x13'),JSON[_0x758a('0x15')](_0x2baa3c));if(_0x2baa3c[_0x758a('0x16')]){if(_0x2baa3c['error'][_0x758a('0x17')]===0x1f4){logger[_0x758a('0x16')](_0x758a('0x18'),_0x55872f,_0x2baa3c['error'][_0x758a('0x19')]);return _0x42208e(_0x2baa3c[_0x758a('0x16')]['message']);}logger[_0x758a('0x16')](_0x758a('0x18'),_0x55872f,_0x2baa3c[_0x758a('0x16')][_0x758a('0x19')]);return _0x28ce27(_0x2baa3c['error'][_0x758a('0x19')]);}else{logger[_0x758a('0x12')](_0x758a('0x18'),_0x55872f,_0x758a('0x13'));_0x28ce27(_0x2baa3c['result'][_0x758a('0x19')]);}})[_0x758a('0x1a')](function(_0x297298){logger[_0x758a('0x16')]('FaxQueue,\x20%s,\x20%s',_0x55872f,_0x297298);_0x42208e(_0x297298);});});}exports[_0x758a('0x1b')]=function(_0x4d0ab3){var _0x50ce12=this;return new Promise(function(_0x5b5248,_0x1d1497){return db[_0x758a('0x1c')][_0x758a('0x1d')]({'raw':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3[_0x758a('0x1e')][_0x758a('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3['options']['where']||null:null,'attributes':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3[_0x758a('0x1e')][_0x758a('0x20')]||null:null,'limit':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3['options'][_0x758a('0x21')]||null:null,'include':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3[_0x758a('0x1e')][_0x758a('0x22')]?_[_0x758a('0x23')](_0x4d0ab3['options'][_0x758a('0x22')],function(_0x324690){return{'model':db[_0x324690['model']],'as':_0x324690['as'],'attributes':_0x324690[_0x758a('0x20')],'include':_0x324690[_0x758a('0x22')]?_[_0x758a('0x23')](_0x324690['include'],function(_0x23f8bb){return{'model':db[_0x23f8bb[_0x758a('0x24')]],'as':_0x23f8bb['as'],'attributes':_0x23f8bb[_0x758a('0x20')],'include':_0x23f8bb['include']?_[_0x758a('0x23')](_0x23f8bb[_0x758a('0x22')],function(_0x4ba4c3){return{'model':db[_0x4ba4c3[_0x758a('0x24')]],'as':_0x4ba4c3['as'],'attributes':_0x4ba4c3[_0x758a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8a994a){logger['info'](_0x758a('0x1b'),_0x4d0ab3);logger['debug'](_0x758a('0x1b'),_0x4d0ab3,JSON[_0x758a('0x15')](_0x8a994a));_0x5b5248(_0x8a994a);})[_0x758a('0x1a')](function(_0x1e0311){logger[_0x758a('0x16')](_0x758a('0x1b'),_0x1e0311[_0x758a('0x19')],_0x4d0ab3);_0x1d1497(_0x50ce12['error'](0x1f4,_0x1e0311[_0x758a('0x19')]));});});};exports[_0x758a('0x25')]=function(_0x3ab435){var _0x4625cf=this;return new Promise(function(_0x5337b9,_0x25d5b1){return db[_0x758a('0x1c')][_0x758a('0x26')]({'raw':_0x3ab435['options']?_0x3ab435[_0x758a('0x1e')][_0x758a('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ab435['options']?_0x3ab435['options'][_0x758a('0x27')]||null:null,'attributes':_0x3ab435[_0x758a('0x1e')]?_0x3ab435[_0x758a('0x1e')][_0x758a('0x20')]||null:null,'include':_0x3ab435['options']?_0x3ab435[_0x758a('0x1e')]['include']?_[_0x758a('0x23')](_0x3ab435['options']['include'],function(_0x42cd30){return{'model':db[_0x42cd30['model']],'as':_0x42cd30['as'],'attributes':_0x42cd30[_0x758a('0x20')],'include':_0x42cd30[_0x758a('0x22')]?_[_0x758a('0x23')](_0x42cd30[_0x758a('0x22')],function(_0xcf09c){return{'model':db[_0xcf09c[_0x758a('0x24')]],'as':_0xcf09c['as'],'attributes':_0xcf09c[_0x758a('0x20')],'include':_0xcf09c['include']?_['map'](_0xcf09c[_0x758a('0x22')],function(_0x28fa06){return{'model':db[_0x28fa06[_0x758a('0x24')]],'as':_0x28fa06['as'],'attributes':_0x28fa06['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11e5ce){logger[_0x758a('0x12')]('ShowFaxQueue',_0x3ab435);logger[_0x758a('0x28')](_0x758a('0x25'),_0x3ab435,JSON[_0x758a('0x15')](_0x11e5ce));_0x5337b9(_0x11e5ce);})[_0x758a('0x1a')](function(_0x94d956){logger[_0x758a('0x16')](_0x758a('0x25'),_0x94d956[_0x758a('0x19')],_0x3ab435);_0x25d5b1(_0x4625cf[_0x758a('0x16')](0x1f4,_0x94d956[_0x758a('0x19')]));});});}; \ No newline at end of file +var _0x15f2=['request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','map','model','attributes','include','catch','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register'];(function(_0x6d34f7,_0x2194c4){var _0x98f803=function(_0x29808a){while(--_0x29808a){_0x6d34f7['push'](_0x6d34f7['shift']());}};_0x98f803(++_0x2194c4);}(_0x15f2,0xfb));var _0x215f=function(_0x4cba86,_0x51a278){_0x4cba86=_0x4cba86-0x0;var _0x268f75=_0x15f2[_0x4cba86];return _0x268f75;};'use strict';var _=require(_0x215f('0x0'));var util=require(_0x215f('0x1'));var moment=require(_0x215f('0x2'));var BPromise=require(_0x215f('0x3'));var rs=require(_0x215f('0x4'));var fs=require('fs');var Redis=require(_0x215f('0x5'));var db=require(_0x215f('0x6'))['db'];var utils=require(_0x215f('0x7'));var logger=require('../../config/logger')(_0x215f('0x8'));var config=require(_0x215f('0x9'));var jayson=require(_0x215f('0xa'));var client=jayson[_0x215f('0xb')][_0x215f('0xc')]({'port':0x232a});config[_0x215f('0xd')]=_[_0x215f('0xe')](config[_0x215f('0xd')],{'host':_0x215f('0xf'),'port':0x18eb});var socket=require(_0x215f('0x10'))(new Redis(config['redis']));require(_0x215f('0x11'))[_0x215f('0x12')](socket);function respondWithRpcPromise(_0x4d6202,_0x2835ad,_0x3db0ce){return new BPromise(function(_0x1a76b6,_0x20aa61){return client[_0x215f('0x13')](_0x4d6202,_0x3db0ce)[_0x215f('0x14')](function(_0x5ea655){logger[_0x215f('0x15')](_0x215f('0x16'),_0x2835ad,_0x215f('0x17'));logger[_0x215f('0x18')](_0x215f('0x19'),_0x2835ad,_0x215f('0x17'),JSON[_0x215f('0x1a')](_0x5ea655));if(_0x5ea655[_0x215f('0x1b')]){if(_0x5ea655[_0x215f('0x1b')][_0x215f('0x1c')]===0x1f4){logger[_0x215f('0x1b')](_0x215f('0x16'),_0x2835ad,_0x5ea655[_0x215f('0x1b')][_0x215f('0x1d')]);return _0x20aa61(_0x5ea655[_0x215f('0x1b')][_0x215f('0x1d')]);}logger[_0x215f('0x1b')](_0x215f('0x16'),_0x2835ad,_0x5ea655[_0x215f('0x1b')][_0x215f('0x1d')]);return _0x1a76b6(_0x5ea655['error'][_0x215f('0x1d')]);}else{logger[_0x215f('0x15')](_0x215f('0x16'),_0x2835ad,_0x215f('0x17'));_0x1a76b6(_0x5ea655[_0x215f('0x1e')][_0x215f('0x1d')]);}})['catch'](function(_0x4e1b38){logger['error']('FaxQueue,\x20%s,\x20%s',_0x2835ad,_0x4e1b38);_0x20aa61(_0x4e1b38);});});}exports[_0x215f('0x1f')]=function(_0x5c43ea){var _0x369c05=this;return new Promise(function(_0x548c75,_0x285b21){return db[_0x215f('0x20')][_0x215f('0x21')]({'raw':_0x5c43ea[_0x215f('0x22')]?_0x5c43ea[_0x215f('0x22')][_0x215f('0x23')]===undefined?!![]:![]:!![],'where':_0x5c43ea[_0x215f('0x22')]?_0x5c43ea[_0x215f('0x22')][_0x215f('0x24')]||null:null,'attributes':_0x5c43ea[_0x215f('0x22')]?_0x5c43ea[_0x215f('0x22')]['attributes']||null:null,'limit':_0x5c43ea[_0x215f('0x22')]?_0x5c43ea['options'][_0x215f('0x25')]||null:null,'include':_0x5c43ea[_0x215f('0x22')]?_0x5c43ea['options']['include']?_[_0x215f('0x26')](_0x5c43ea[_0x215f('0x22')]['include'],function(_0x1b8ccb){return{'model':db[_0x1b8ccb[_0x215f('0x27')]],'as':_0x1b8ccb['as'],'attributes':_0x1b8ccb[_0x215f('0x28')],'include':_0x1b8ccb[_0x215f('0x29')]?_[_0x215f('0x26')](_0x1b8ccb['include'],function(_0x33b4cc){return{'model':db[_0x33b4cc[_0x215f('0x27')]],'as':_0x33b4cc['as'],'attributes':_0x33b4cc[_0x215f('0x28')],'include':_0x33b4cc[_0x215f('0x29')]?_['map'](_0x33b4cc['include'],function(_0x6d5eb7){return{'model':db[_0x6d5eb7[_0x215f('0x27')]],'as':_0x6d5eb7['as'],'attributes':_0x6d5eb7[_0x215f('0x28')]};}):[]};}):[]};}):[]:[]})[_0x215f('0x14')](function(_0x247cae){logger[_0x215f('0x15')]('GetFaxQueue',_0x5c43ea);logger['debug']('GetFaxQueue',_0x5c43ea,JSON[_0x215f('0x1a')](_0x247cae));_0x548c75(_0x247cae);})[_0x215f('0x2a')](function(_0x4c32df){logger[_0x215f('0x1b')](_0x215f('0x1f'),_0x4c32df['message'],_0x5c43ea);_0x285b21(_0x369c05[_0x215f('0x1b')](0x1f4,_0x4c32df[_0x215f('0x1d')]));});});};exports[_0x215f('0x2b')]=function(_0x2743ad){var _0x324980=this;return new Promise(function(_0x50a7f1,_0x37865b){return db[_0x215f('0x20')][_0x215f('0x2c')]({'raw':_0x2743ad[_0x215f('0x22')]?_0x2743ad[_0x215f('0x22')][_0x215f('0x23')]===undefined?!![]:![]:!![],'where':_0x2743ad[_0x215f('0x22')]?_0x2743ad['options'][_0x215f('0x24')]||null:null,'attributes':_0x2743ad['options']?_0x2743ad[_0x215f('0x22')][_0x215f('0x28')]||null:null,'include':_0x2743ad['options']?_0x2743ad[_0x215f('0x22')][_0x215f('0x29')]?_[_0x215f('0x26')](_0x2743ad[_0x215f('0x22')][_0x215f('0x29')],function(_0x25b4a1){return{'model':db[_0x25b4a1[_0x215f('0x27')]],'as':_0x25b4a1['as'],'attributes':_0x25b4a1[_0x215f('0x28')],'include':_0x25b4a1[_0x215f('0x29')]?_[_0x215f('0x26')](_0x25b4a1[_0x215f('0x29')],function(_0x7d94e6){return{'model':db[_0x7d94e6[_0x215f('0x27')]],'as':_0x7d94e6['as'],'attributes':_0x7d94e6[_0x215f('0x28')],'include':_0x7d94e6[_0x215f('0x29')]?_[_0x215f('0x26')](_0x7d94e6['include'],function(_0x126466){return{'model':db[_0x126466[_0x215f('0x27')]],'as':_0x126466['as'],'attributes':_0x126466['attributes']};}):[]};}):[]};}):[]:[]})[_0x215f('0x14')](function(_0x2f9ed6){logger[_0x215f('0x15')](_0x215f('0x2b'),_0x2743ad);logger[_0x215f('0x18')]('ShowFaxQueue',_0x2743ad,JSON['stringify'](_0x2f9ed6));_0x50a7f1(_0x2f9ed6);})[_0x215f('0x2a')](function(_0x236284){logger[_0x215f('0x1b')](_0x215f('0x2b'),_0x236284[_0x215f('0x1d')],_0x2743ad);_0x37865b(_0x324980[_0x215f('0x1b')](0x1f4,_0x236284[_0x215f('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 9f572d1..b42ec44 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 _0x0b8b=['length','faxQueue:','remove','emit','register'];(function(_0x20976a,_0x48233f){var _0x314b35=function(_0x363c26){while(--_0x363c26){_0x20976a['push'](_0x20976a['shift']());}};_0x314b35(++_0x48233f);}(_0x0b8b,0x174));var _0xb0b8=function(_0x20befa,_0x1d57da){_0x20befa=_0x20befa-0x0;var _0x1da8c6=_0x0b8b[_0x20befa];return _0x1da8c6;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0xb0b8('0x0'),'update'];function createListener(_0x5b1769,_0x520bfb){return function(_0x1b619a){_0x520bfb[_0xb0b8('0x1')](_0x5b1769,_0x1b619a);};}function removeListener(_0x449513,_0x1113ef){return function(){FaxQueueEvents['removeListener'](_0x449513,_0x1113ef);};}exports[_0xb0b8('0x2')]=function(_0x2b680e){for(var _0x29ab3b=0x0,_0x58353d=events[_0xb0b8('0x3')];_0x29ab3b<_0x58353d;_0x29ab3b++){var _0x5bf738=events[_0x29ab3b];var _0x3680e4=createListener(_0xb0b8('0x4')+_0x5bf738,_0x2b680e);FaxQueueEvents['on'](_0x5bf738,_0x3680e4);}}; \ No newline at end of file +var _0x83a4=['update','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x83a4,0x10d));var _0x483a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x83a4[_0xfae23b];return _0x200640;};'use strict';var FaxQueueEvents=require(_0x483a('0x0'));var events=[_0x483a('0x1'),_0x483a('0x2'),_0x483a('0x3')];function createListener(_0x3cf5a4,_0x114b12){return function(_0x37b8ab){_0x114b12['emit'](_0x3cf5a4,_0x37b8ab);};}function removeListener(_0x20f08e,_0x2554c2){return function(){FaxQueueEvents[_0x483a('0x4')](_0x20f08e,_0x2554c2);};}exports[_0x483a('0x5')]=function(_0x482af0){for(var _0x57c5b0=0x0,_0x19cd69=events[_0x483a('0x6')];_0x57c5b0<_0x19cd69;_0x57c5b0++){var _0xd700f0=events[_0x57c5b0];var _0x4da883=createListener(_0x483a('0x7')+_0xd700f0,_0x482af0);FaxQueueEvents['on'](_0xd700f0,_0x4da883);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index acb762d..d4235c6 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0x0b0e[_0x52b91f];return _0x15f8f5;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _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(_0x20b3ce,_0x3a749a){var _0x3cace2=function(_0x2832ba){while(--_0x2832ba){_0x20b3ce['push'](_0x20b3ce['shift']());}};_0x3cace2(++_0x3a749a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30db46,_0x5dedc8){_0x30db46=_0x30db46-0x0;var _0x366c5c=_0x5f2f[_0x30db46];return _0x366c5c;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5012ddd..6491acd 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 _0x869b=['STRING','DATE','moment','exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x869b,0x186));var _0xb869=function(_0x336953,_0x41b7f0){_0x336953=_0x336953-0x0;var _0x1177db=_0x869b[_0x336953];return _0x1177db;};'use strict';var moment=require(_0xb869('0x0'));var Sequelize=require('sequelize');module[_0xb869('0x1')]={'uniqueid':{'type':Sequelize[_0xb869('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb869('0x2')]},'joinAt':{'type':Sequelize[_0xb869('0x3')]},'leaveAt':{'type':Sequelize[_0xb869('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb869('0x2')]}}; \ No newline at end of file +var _0x6008=['sequelize','STRING','DATE','moment'];(function(_0x315aa8,_0x262f9c){var _0x20f758=function(_0x1765e7){while(--_0x1765e7){_0x315aa8['push'](_0x315aa8['shift']());}};_0x20f758(++_0x262f9c);}(_0x6008,0x1bb));var _0x8600=function(_0x476654,_0x3f2547){_0x476654=_0x476654-0x0;var _0x55eebb=_0x6008[_0x476654];return _0x55eebb;};'use strict';var moment=require(_0x8600('0x0'));var Sequelize=require(_0x8600('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8600('0x2')]},'joinAt':{'type':Sequelize[_0x8600('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8600('0x3')]},'exitAt':{'type':Sequelize[_0x8600('0x3')]},'reason':{'type':Sequelize[_0x8600('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 28cfe79..42b71c6 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 _0x9d42=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','options','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','apply','reject','save','update','destroy','then','sendStatus','name','send','index','FaxQueueReport'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x9d42,0x1c5));var _0x29d4=function(_0x7e2e2e,_0x4ce3b3){_0x7e2e2e=_0x7e2e2e-0x0;var _0x4e69c9=_0x9d42[_0x7e2e2e];return _0x4e69c9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x29d4('0x0'));var zipdir=require(_0x29d4('0x1'));var jsonpatch=require(_0x29d4('0x2'));var rp=require(_0x29d4('0x3'));var moment=require(_0x29d4('0x4'));var BPromise=require(_0x29d4('0x5'));var Mustache=require('mustache');var util=require(_0x29d4('0x6'));var path=require(_0x29d4('0x7'));var sox=require(_0x29d4('0x8'));var csv=require(_0x29d4('0x9'));var ejs=require(_0x29d4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x29d4('0xb'));var crypto=require(_0x29d4('0xc'));var jsforce=require(_0x29d4('0xd'));var deskjs=require(_0x29d4('0xe'));var toCsv=require(_0x29d4('0x9'));var querystring=require(_0x29d4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29d4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29d4('0x11'))(_0x29d4('0x12'));var utils=require('../../config/utils');var config=require(_0x29d4('0x13'));var db=require(_0x29d4('0x14'))['db'];function respondWithStatusCode(_0x25b68d,_0x4b922b){_0x4b922b=_0x4b922b||0xcc;return function(_0x4eb90a){if(_0x4eb90a){return _0x25b68d['sendStatus'](_0x4b922b);}return _0x25b68d[_0x29d4('0x15')](_0x4b922b)[_0x29d4('0x16')]();};}function respondWithResult(_0x111257,_0x3d67ac){_0x3d67ac=_0x3d67ac||0xc8;return function(_0x54c1f7){if(_0x54c1f7){return _0x111257['status'](_0x3d67ac)[_0x29d4('0x17')](_0x54c1f7);}};}function respondWithFilteredResult(_0x476775,_0x2a1450){return function(_0x588489){if(_0x588489){var _0x44f90a=_0x588489[_0x29d4('0x18')],_0x518e4e=_0x2a1450[_0x29d4('0x19')],_0x2aaa4c=_0x2a1450['offset']+_0x2a1450['limit'],_0x4bcf93;if(_0x2aaa4c>=_0x44f90a){_0x2aaa4c=_0x44f90a;_0x4bcf93=0xc8;}else{_0x4bcf93=0xce;}_0x476775['status'](_0x4bcf93);return _0x476775['set']('Content-Range',_0x518e4e+'-'+_0x2aaa4c+'/'+_0x44f90a)['json'](_0x588489);}return null;};}function patchUpdates(_0x4bdb7e){return function(_0xdbc79b){try{jsonpatch[_0x29d4('0x1a')](_0xdbc79b,_0x4bdb7e,!![]);}catch(_0x3d59fb){return BPromise[_0x29d4('0x1b')](_0x3d59fb);}return _0xdbc79b[_0x29d4('0x1c')]();};}function saveUpdates(_0x277dbe,_0x44c293){return function(_0x4e0b12){if(_0x4e0b12){return _0x4e0b12[_0x29d4('0x1d')](_0x277dbe)['then'](function(_0x2be952){return _0x2be952;});}return null;};}function removeEntity(_0x5aa765,_0xd15df7){return function(_0x51339c){if(_0x51339c){return _0x51339c[_0x29d4('0x1e')]()[_0x29d4('0x1f')](function(){_0x5aa765[_0x29d4('0x15')](0xcc)[_0x29d4('0x16')]();});}};}function handleEntityNotFound(_0x2e6697,_0x368006){return function(_0x5a5a35){if(!_0x5a5a35){_0x2e6697[_0x29d4('0x20')](0x194);}return _0x5a5a35;};}function handleError(_0x35d859,_0x42afcd){_0x42afcd=_0x42afcd||0x1f4;return function(_0x31e9a9){logger['error'](_0x31e9a9['stack']);if(_0x31e9a9[_0x29d4('0x21')]){delete _0x31e9a9['name'];}_0x35d859[_0x29d4('0x15')](_0x42afcd)[_0x29d4('0x22')](_0x31e9a9);};}exports[_0x29d4('0x23')]=function(_0x591a4b,_0x562498){var _0x49131a={},_0x489045={},_0x4b8702={'count':0x0,'rows':[]};var _0x5b8f28=_['map'](db[_0x29d4('0x24')][_0x29d4('0x25')],function(_0x5d3efb){return{'name':_0x5d3efb[_0x29d4('0x26')],'type':_0x5d3efb[_0x29d4('0x27')][_0x29d4('0x28')]};});_0x489045[_0x29d4('0x29')]=_['map'](_0x5b8f28,_0x29d4('0x21'));_0x489045[_0x29d4('0x2a')]=_['keys'](_0x591a4b['query']);_0x489045[_0x29d4('0x2b')]=_[_0x29d4('0x2c')](_0x489045['model'],_0x489045['query']);_0x49131a[_0x29d4('0x2d')]=_[_0x29d4('0x2c')](_0x489045[_0x29d4('0x29')],qs['fields'](_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x2e')]));_0x49131a[_0x29d4('0x2d')]=_0x49131a['attributes']['length']?_0x49131a[_0x29d4('0x2d')]:_0x489045['model'];if(!_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x2f')](_0x29d4('0x30'))){_0x49131a[_0x29d4('0x31')]=qs[_0x29d4('0x31')](_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x31')]);_0x49131a['offset']=qs['offset'](_0x591a4b[_0x29d4('0x2a')]['offset']);}_0x49131a['order']=qs[_0x29d4('0x32')](_0x591a4b['query'][_0x29d4('0x32')]);_0x49131a[_0x29d4('0x33')]=qs[_0x29d4('0x2b')](_[_0x29d4('0x34')](_0x591a4b[_0x29d4('0x2a')],_0x489045['filters']),_0x5b8f28);if(_0x591a4b['query'][_0x29d4('0x35')]){_0x49131a[_0x29d4('0x33')]=_[_0x29d4('0x36')](_0x49131a[_0x29d4('0x33')],{'$or':_[_0x29d4('0x37')](_0x5b8f28,function(_0x5bc702){if(_0x5bc702[_0x29d4('0x27')]!==_0x29d4('0x38')){var _0xe1155f={};_0xe1155f[_0x5bc702[_0x29d4('0x21')]]={'$like':'%'+_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x35')]+'%'};return _0xe1155f;}})});}_0x49131a=_[_0x29d4('0x36')]({},_0x49131a,_0x591a4b['options']);var _0x1d4901={'where':_0x49131a[_0x29d4('0x33')]};return db[_0x29d4('0x24')]['count'](_0x1d4901)[_0x29d4('0x1f')](function(_0x1d61ac){_0x4b8702[_0x29d4('0x18')]=_0x1d61ac;if(_0x591a4b[_0x29d4('0x2a')]['includeAll']){_0x49131a[_0x29d4('0x39')]=[{'all':!![]}];}return db[_0x29d4('0x24')][_0x29d4('0x3a')](_0x49131a);})[_0x29d4('0x1f')](function(_0x3c86d4){_0x4b8702[_0x29d4('0x3b')]=_0x3c86d4;return _0x4b8702;})[_0x29d4('0x1f')](respondWithFilteredResult(_0x562498,_0x49131a))['catch'](handleError(_0x562498,null));};exports[_0x29d4('0x3c')]=function(_0x874b48,_0x33da4d){var _0x12d44a={'raw':!![],'where':{'id':_0x874b48[_0x29d4('0x3d')]['id']}},_0x44d3f3={};_0x44d3f3[_0x29d4('0x29')]=_[_0x29d4('0x3e')](db[_0x29d4('0x24')][_0x29d4('0x25')]);_0x44d3f3[_0x29d4('0x2a')]=_[_0x29d4('0x3e')](_0x874b48[_0x29d4('0x2a')]);_0x44d3f3[_0x29d4('0x2b')]=_[_0x29d4('0x2c')](_0x44d3f3[_0x29d4('0x29')],_0x44d3f3[_0x29d4('0x2a')]);_0x12d44a['attributes']=_[_0x29d4('0x2c')](_0x44d3f3[_0x29d4('0x29')],qs[_0x29d4('0x2e')](_0x874b48['query'][_0x29d4('0x2e')]));_0x12d44a[_0x29d4('0x2d')]=_0x12d44a[_0x29d4('0x2d')]['length']?_0x12d44a[_0x29d4('0x2d')]:_0x44d3f3[_0x29d4('0x29')];if(_0x874b48[_0x29d4('0x2a')][_0x29d4('0x3f')]){_0x12d44a[_0x29d4('0x39')]=[{'all':!![]}];}_0x12d44a=_['merge']({},_0x12d44a,_0x874b48[_0x29d4('0x40')]);return db[_0x29d4('0x24')][_0x29d4('0x41')](_0x12d44a)[_0x29d4('0x1f')](handleEntityNotFound(_0x33da4d,null))['then'](respondWithResult(_0x33da4d,null))['catch'](handleError(_0x33da4d,null));};exports['create']=function(_0x252120,_0x2c1ada){return db[_0x29d4('0x24')][_0x29d4('0x42')](_0x252120['body'],{})[_0x29d4('0x1f')](respondWithResult(_0x2c1ada,0xc9))['catch'](handleError(_0x2c1ada,null));};exports[_0x29d4('0x1d')]=function(_0xd38b50,_0x3d947f){if(_0xd38b50[_0x29d4('0x43')]['id']){delete _0xd38b50['body']['id'];}return db[_0x29d4('0x24')][_0x29d4('0x41')]({'where':{'id':_0xd38b50[_0x29d4('0x3d')]['id']}})[_0x29d4('0x1f')](handleEntityNotFound(_0x3d947f,null))[_0x29d4('0x1f')](saveUpdates(_0xd38b50[_0x29d4('0x43')],null))[_0x29d4('0x1f')](respondWithResult(_0x3d947f,null))[_0x29d4('0x44')](handleError(_0x3d947f,null));};exports['destroy']=function(_0x4c8462,_0x3fbd82){return db[_0x29d4('0x24')][_0x29d4('0x41')]({'where':{'id':_0x4c8462[_0x29d4('0x3d')]['id']}})[_0x29d4('0x1f')](handleEntityNotFound(_0x3fbd82,null))[_0x29d4('0x1f')](removeEntity(_0x3fbd82,null))[_0x29d4('0x44')](handleError(_0x3fbd82,null));};exports[_0x29d4('0x45')]=function(_0x50e3fb,_0x3f8d54){return db['FaxQueueReport'][_0x29d4('0x45')]()[_0x29d4('0x1f')](respondWithResult(_0x3f8d54,null))[_0x29d4('0x44')](handleError(_0x3f8d54,null));}; \ No newline at end of file +var _0xa53b=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','moment','path','sox','to-csv','ejs','lodash','squel'];(function(_0x423ccb,_0x210002){var _0xafea3f=function(_0x3ebdc7){while(--_0x3ebdc7){_0x423ccb['push'](_0x423ccb['shift']());}};_0xafea3f(++_0x210002);}(_0xa53b,0x81));var _0xba53=function(_0x1442aa,_0x5e99f){_0x1442aa=_0x1442aa-0x0;var _0x294f34=_0xa53b[_0x1442aa];return _0x294f34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba53('0x0'));var rimraf=require(_0xba53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba53('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xba53('0x3'));var sox=require(_0xba53('0x4'));var csv=require(_0xba53('0x5'));var ejs=require(_0xba53('0x6'));var fs=require('fs');var _=require(_0xba53('0x7'));var squel=require(_0xba53('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba53('0x9'));var toCsv=require(_0xba53('0x5'));var querystring=require(_0xba53('0xa'));var Papa=require('papaparse');var Redis=require(_0xba53('0xb'));var authService=require(_0xba53('0xc'));var qs=require(_0xba53('0xd'));var as=require(_0xba53('0xe'));var hardwareService=require(_0xba53('0xf'));var logger=require(_0xba53('0x10'))('api');var utils=require(_0xba53('0x11'));var config=require('../../config/environment');var db=require(_0xba53('0x12'))['db'];function respondWithStatusCode(_0x382f2,_0x2999d5){_0x2999d5=_0x2999d5||0xcc;return function(_0x4ee8d6){if(_0x4ee8d6){return _0x382f2['sendStatus'](_0x2999d5);}return _0x382f2[_0xba53('0x13')](_0x2999d5)['end']();};}function respondWithResult(_0x4b8ac6,_0x2f62f3){_0x2f62f3=_0x2f62f3||0xc8;return function(_0x29ae73){if(_0x29ae73){return _0x4b8ac6[_0xba53('0x13')](_0x2f62f3)['json'](_0x29ae73);}};}function respondWithFilteredResult(_0x372972,_0x2241f7){return function(_0x537ad4){if(_0x537ad4){var _0x1f3397=_0x537ad4[_0xba53('0x14')],_0x20c9fc=_0x2241f7[_0xba53('0x15')],_0x3b60b0=_0x2241f7[_0xba53('0x15')]+_0x2241f7['limit'],_0xd3e207;if(_0x3b60b0>=_0x1f3397){_0x3b60b0=_0x1f3397;_0xd3e207=0xc8;}else{_0xd3e207=0xce;}_0x372972[_0xba53('0x13')](_0xd3e207);return _0x372972[_0xba53('0x16')](_0xba53('0x17'),_0x20c9fc+'-'+_0x3b60b0+'/'+_0x1f3397)[_0xba53('0x18')](_0x537ad4);}return null;};}function patchUpdates(_0x51d4b6){return function(_0x50711a){try{jsonpatch[_0xba53('0x19')](_0x50711a,_0x51d4b6,!![]);}catch(_0x33a586){return BPromise['reject'](_0x33a586);}return _0x50711a[_0xba53('0x1a')]();};}function saveUpdates(_0x5d5b3b,_0x35261f){return function(_0x43fb0d){if(_0x43fb0d){return _0x43fb0d[_0xba53('0x1b')](_0x5d5b3b)[_0xba53('0x1c')](function(_0x314586){return _0x314586;});}return null;};}function removeEntity(_0x1cde64,_0x3d80ad){return function(_0x38e046){if(_0x38e046){return _0x38e046[_0xba53('0x1d')]()['then'](function(){_0x1cde64[_0xba53('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b0e6,_0x4050e9){return function(_0x46e98d){if(!_0x46e98d){_0x26b0e6[_0xba53('0x1e')](0x194);}return _0x46e98d;};}function handleError(_0x292c93,_0x5a3e1e){_0x5a3e1e=_0x5a3e1e||0x1f4;return function(_0x223928){logger[_0xba53('0x1f')](_0x223928[_0xba53('0x20')]);if(_0x223928['name']){delete _0x223928['name'];}_0x292c93[_0xba53('0x13')](_0x5a3e1e)['send'](_0x223928);};}exports[_0xba53('0x21')]=function(_0x164bc3,_0x297d5a){var _0x47d617={},_0x471739={},_0xaadf73={'count':0x0,'rows':[]};var _0x30b0cd=_['map'](db[_0xba53('0x22')][_0xba53('0x23')],function(_0x297d6d){return{'name':_0x297d6d[_0xba53('0x24')],'type':_0x297d6d[_0xba53('0x25')][_0xba53('0x26')]};});_0x471739[_0xba53('0x27')]=_[_0xba53('0x28')](_0x30b0cd,_0xba53('0x29'));_0x471739[_0xba53('0x2a')]=_[_0xba53('0x2b')](_0x164bc3['query']);_0x471739[_0xba53('0x2c')]=_['intersection'](_0x471739['model'],_0x471739[_0xba53('0x2a')]);_0x47d617[_0xba53('0x2d')]=_[_0xba53('0x2e')](_0x471739[_0xba53('0x27')],qs[_0xba53('0x2f')](_0x164bc3[_0xba53('0x2a')]['fields']));_0x47d617[_0xba53('0x2d')]=_0x47d617[_0xba53('0x2d')][_0xba53('0x30')]?_0x47d617[_0xba53('0x2d')]:_0x471739[_0xba53('0x27')];if(!_0x164bc3[_0xba53('0x2a')][_0xba53('0x31')](_0xba53('0x32'))){_0x47d617[_0xba53('0x33')]=qs['limit'](_0x164bc3['query']['limit']);_0x47d617[_0xba53('0x15')]=qs[_0xba53('0x15')](_0x164bc3[_0xba53('0x2a')][_0xba53('0x15')]);}_0x47d617['order']=qs[_0xba53('0x34')](_0x164bc3[_0xba53('0x2a')][_0xba53('0x34')]);_0x47d617['where']=qs[_0xba53('0x2c')](_[_0xba53('0x35')](_0x164bc3[_0xba53('0x2a')],_0x471739[_0xba53('0x2c')]),_0x30b0cd);if(_0x164bc3[_0xba53('0x2a')][_0xba53('0x36')]){_0x47d617[_0xba53('0x37')]=_['merge'](_0x47d617[_0xba53('0x37')],{'$or':_[_0xba53('0x28')](_0x30b0cd,function(_0x2254f2){if(_0x2254f2[_0xba53('0x25')]!==_0xba53('0x38')){var _0x340436={};_0x340436[_0x2254f2['name']]={'$like':'%'+_0x164bc3[_0xba53('0x2a')][_0xba53('0x36')]+'%'};return _0x340436;}})});}_0x47d617=_[_0xba53('0x39')]({},_0x47d617,_0x164bc3[_0xba53('0x3a')]);var _0x3a5d97={'where':_0x47d617[_0xba53('0x37')]};return db[_0xba53('0x22')][_0xba53('0x14')](_0x3a5d97)[_0xba53('0x1c')](function(_0x462f4d){_0xaadf73['count']=_0x462f4d;if(_0x164bc3['query']['includeAll']){_0x47d617[_0xba53('0x3b')]=[{'all':!![]}];}return db[_0xba53('0x22')][_0xba53('0x3c')](_0x47d617);})['then'](function(_0x39158f){_0xaadf73['rows']=_0x39158f;return _0xaadf73;})[_0xba53('0x1c')](respondWithFilteredResult(_0x297d5a,_0x47d617))[_0xba53('0x3d')](handleError(_0x297d5a,null));};exports[_0xba53('0x3e')]=function(_0x4993a8,_0x3c9b03){var _0x299ba3={'raw':!![],'where':{'id':_0x4993a8[_0xba53('0x3f')]['id']}},_0x4fb1ec={};_0x4fb1ec[_0xba53('0x27')]=_['keys'](db[_0xba53('0x22')][_0xba53('0x23')]);_0x4fb1ec[_0xba53('0x2a')]=_[_0xba53('0x2b')](_0x4993a8[_0xba53('0x2a')]);_0x4fb1ec[_0xba53('0x2c')]=_[_0xba53('0x2e')](_0x4fb1ec[_0xba53('0x27')],_0x4fb1ec[_0xba53('0x2a')]);_0x299ba3[_0xba53('0x2d')]=_[_0xba53('0x2e')](_0x4fb1ec['model'],qs[_0xba53('0x2f')](_0x4993a8[_0xba53('0x2a')]['fields']));_0x299ba3[_0xba53('0x2d')]=_0x299ba3[_0xba53('0x2d')][_0xba53('0x30')]?_0x299ba3[_0xba53('0x2d')]:_0x4fb1ec[_0xba53('0x27')];if(_0x4993a8['query'][_0xba53('0x40')]){_0x299ba3[_0xba53('0x3b')]=[{'all':!![]}];}_0x299ba3=_[_0xba53('0x39')]({},_0x299ba3,_0x4993a8['options']);return db['FaxQueueReport'][_0xba53('0x41')](_0x299ba3)[_0xba53('0x1c')](handleEntityNotFound(_0x3c9b03,null))[_0xba53('0x1c')](respondWithResult(_0x3c9b03,null))[_0xba53('0x3d')](handleError(_0x3c9b03,null));};exports[_0xba53('0x42')]=function(_0x44c2ec,_0x3bf5b2){return db[_0xba53('0x22')][_0xba53('0x42')](_0x44c2ec['body'],{})[_0xba53('0x1c')](respondWithResult(_0x3bf5b2,0xc9))[_0xba53('0x3d')](handleError(_0x3bf5b2,null));};exports['update']=function(_0xf60775,_0x5ccc4e){if(_0xf60775[_0xba53('0x43')]['id']){delete _0xf60775[_0xba53('0x43')]['id'];}return db[_0xba53('0x22')]['find']({'where':{'id':_0xf60775[_0xba53('0x3f')]['id']}})[_0xba53('0x1c')](handleEntityNotFound(_0x5ccc4e,null))[_0xba53('0x1c')](saveUpdates(_0xf60775['body'],null))[_0xba53('0x1c')](respondWithResult(_0x5ccc4e,null))[_0xba53('0x3d')](handleError(_0x5ccc4e,null));};exports['destroy']=function(_0x50c0ad,_0x19ab2c){return db[_0xba53('0x22')][_0xba53('0x41')]({'where':{'id':_0x50c0ad[_0xba53('0x3f')]['id']}})[_0xba53('0x1c')](handleEntityNotFound(_0x19ab2c,null))[_0xba53('0x1c')](removeEntity(_0x19ab2c,null))[_0xba53('0x3d')](handleError(_0x19ab2c,null));};exports[_0xba53('0x44')]=function(_0x18bbc7,_0x408a73){return db[_0xba53('0x22')][_0xba53('0x44')]()['then'](respondWithResult(_0x408a73,null))[_0xba53('0x3d')](handleError(_0x408a73,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e1a12fd..11e3dca 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 _0x6f44=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid'];(function(_0x472dde,_0x447587){var _0x44cb2a=function(_0x1b8200){while(--_0x1b8200){_0x472dde['push'](_0x472dde['shift']());}};_0x44cb2a(++_0x447587);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4e9e13,_0x5310af){_0x4e9e13=_0x4e9e13-0x0;var _0x3aad47=_0x6f44[_0x4e9e13];return _0x3aad47;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x46f4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['rimraf','../../config/environment','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4aee4d,_0x1790ce){var _0xa28f7a=function(_0x4b9410){while(--_0x4b9410){_0x4aee4d['push'](_0x4aee4d['shift']());}};_0xa28f7a(++_0x1790ce);}(_0x66fa,0x117));var _0xa66f=function(_0x407869,_0x27d94d){_0x407869=_0x407869-0x0;var _0x13746b=_0x66fa[_0x407869];return _0x13746b;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa66f('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 9537b8f..afcdc3e 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 _0x968d=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','where','limit','lodash'];(function(_0x18d06a,_0x8ef0fe){var _0x2d8675=function(_0x1680c8){while(--_0x1680c8){_0x18d06a['push'](_0x18d06a['shift']());}};_0x2d8675(++_0x8ef0fe);}(_0x968d,0x18b));var _0xd968=function(_0x111164,_0x48487f){_0x111164=_0x111164-0x0;var _0x532f6e=_0x968d[_0x111164];return _0x532f6e;};'use strict';var _=require(_0xd968('0x0'));var util=require(_0xd968('0x1'));var moment=require(_0xd968('0x2'));var BPromise=require(_0xd968('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd968('0x4'));var logger=require(_0xd968('0x5'))(_0xd968('0x6'));var config=require(_0xd968('0x7'));var jayson=require(_0xd968('0x8'));var client=jayson['client'][_0xd968('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a219e,_0x4c4460,_0x5b5431){return new BPromise(function(_0x4944c8,_0x230f11){return client[_0xd968('0xa')](_0x3a219e,_0x5b5431)[_0xd968('0xb')](function(_0x107a73){logger['info'](_0xd968('0xc'),_0x4c4460,_0xd968('0xd'));logger[_0xd968('0xe')](_0xd968('0xf'),_0x4c4460,'request\x20sent',JSON[_0xd968('0x10')](_0x107a73));if(_0x107a73[_0xd968('0x11')]){if(_0x107a73['error'][_0xd968('0x12')]===0x1f4){logger[_0xd968('0x11')](_0xd968('0xc'),_0x4c4460,_0x107a73[_0xd968('0x11')][_0xd968('0x13')]);return _0x230f11(_0x107a73['error'][_0xd968('0x13')]);}logger[_0xd968('0x11')](_0xd968('0xc'),_0x4c4460,_0x107a73[_0xd968('0x11')]['message']);return _0x4944c8(_0x107a73['error'][_0xd968('0x13')]);}else{logger[_0xd968('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x4c4460,_0xd968('0xd'));_0x4944c8(_0x107a73[_0xd968('0x15')][_0xd968('0x13')]);}})[_0xd968('0x16')](function(_0x58e2c8){logger[_0xd968('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4c4460,_0x58e2c8);_0x230f11(_0x58e2c8);});});}exports[_0xd968('0x17')]=function(_0x3fb9a8){var _0x407909=this;return new Promise(function(_0x326b14,_0xaa0388){return db[_0xd968('0x18')][_0xd968('0x19')](_0x3fb9a8['body'],{'raw':_0x3fb9a8[_0xd968('0x1a')]?_0x3fb9a8[_0xd968('0x1a')][_0xd968('0x1b')]===undefined?!![]:![]:!![]})[_0xd968('0xb')](function(_0x170646){logger[_0xd968('0x14')]('CreateFaxQueueReport',_0x3fb9a8);logger[_0xd968('0xe')](_0xd968('0x17'),_0x3fb9a8,JSON[_0xd968('0x10')](_0x170646));_0x326b14(_0x170646);})[_0xd968('0x16')](function(_0x540a90){logger[_0xd968('0x11')](_0xd968('0x17'),_0x540a90['message'],_0x3fb9a8);_0xaa0388(_0x407909[_0xd968('0x11')](0x1f4,_0x540a90[_0xd968('0x13')]));});});};exports[_0xd968('0x1c')]=function(_0x1b5411){var _0x51cab8=this;return new Promise(function(_0x514a5e,_0x3fc02a){return db[_0xd968('0x18')][_0xd968('0x1d')](_0x1b5411[_0xd968('0x1e')],{'raw':_0x1b5411[_0xd968('0x1a')]?_0x1b5411[_0xd968('0x1a')][_0xd968('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5411['options']?_0x1b5411[_0xd968('0x1a')][_0xd968('0x1f')]||null:null,'attributes':_0x1b5411[_0xd968('0x1a')]?_0x1b5411[_0xd968('0x1a')]['attributes']||null:null,'limit':_0x1b5411['options']?_0x1b5411['options'][_0xd968('0x20')]||null:null})['then'](function(_0x2e41e1){logger[_0xd968('0x14')](_0xd968('0x1c'),_0x1b5411);logger['debug'](_0xd968('0x1c'),_0x1b5411,JSON['stringify'](_0x2e41e1));_0x514a5e(_0x2e41e1);})[_0xd968('0x16')](function(_0x1a0f90){logger[_0xd968('0x11')](_0xd968('0x1c'),_0x1a0f90['message'],_0x1b5411);_0x3fc02a(_0x51cab8['error'](0x1f4,_0x1a0f90[_0xd968('0x13')]));});});}; \ No newline at end of file +var _0x7212=['update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','request\x20sent','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7212,0xf2));var _0x2721=function(_0x433a8c,_0x45d79a){_0x433a8c=_0x433a8c-0x0;var _0x38fe59=_0x7212[_0x433a8c];return _0x38fe59;};'use strict';var _=require(_0x2721('0x0'));var util=require(_0x2721('0x1'));var moment=require(_0x2721('0x2'));var BPromise=require(_0x2721('0x3'));var rs=require(_0x2721('0x4'));var fs=require('fs');var Redis=require(_0x2721('0x5'));var db=require(_0x2721('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2721('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2721('0x8'));var client=jayson['client'][_0x2721('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ada5f,_0x52f44a,_0xc9b0cf){return new BPromise(function(_0x5ba1c7,_0x3bf92d){return client['request'](_0x4ada5f,_0xc9b0cf)[_0x2721('0xa')](function(_0x503119){logger[_0x2721('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x52f44a,'request\x20sent');logger[_0x2721('0xc')](_0x2721('0xd'),_0x52f44a,'request\x20sent',JSON[_0x2721('0xe')](_0x503119));if(_0x503119[_0x2721('0xf')]){if(_0x503119[_0x2721('0xf')][_0x2721('0x10')]===0x1f4){logger[_0x2721('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x52f44a,_0x503119[_0x2721('0xf')][_0x2721('0x11')]);return _0x3bf92d(_0x503119[_0x2721('0xf')]['message']);}logger[_0x2721('0xf')](_0x2721('0x12'),_0x52f44a,_0x503119['error'][_0x2721('0x11')]);return _0x5ba1c7(_0x503119[_0x2721('0xf')]['message']);}else{logger[_0x2721('0xb')](_0x2721('0x12'),_0x52f44a,_0x2721('0x13'));_0x5ba1c7(_0x503119['result'][_0x2721('0x11')]);}})[_0x2721('0x14')](function(_0x416ae7){logger[_0x2721('0xf')](_0x2721('0x12'),_0x52f44a,_0x416ae7);_0x3bf92d(_0x416ae7);});});}exports[_0x2721('0x15')]=function(_0x3deb97){var _0x163d84=this;return new Promise(function(_0x4d74a1,_0x431b86){return db[_0x2721('0x16')][_0x2721('0x17')](_0x3deb97[_0x2721('0x18')],{'raw':_0x3deb97[_0x2721('0x19')]?_0x3deb97[_0x2721('0x19')][_0x2721('0x1a')]===undefined?!![]:![]:!![]})[_0x2721('0xa')](function(_0x5dd8b5){logger[_0x2721('0xb')](_0x2721('0x15'),_0x3deb97);logger['debug'](_0x2721('0x15'),_0x3deb97,JSON['stringify'](_0x5dd8b5));_0x4d74a1(_0x5dd8b5);})[_0x2721('0x14')](function(_0x341a86){logger['error'](_0x2721('0x15'),_0x341a86[_0x2721('0x11')],_0x3deb97);_0x431b86(_0x163d84['error'](0x1f4,_0x341a86[_0x2721('0x11')]));});});};exports[_0x2721('0x1b')]=function(_0x56827e){var _0x3d7b64=this;return new Promise(function(_0x5a1842,_0x13ce6a){return db[_0x2721('0x16')][_0x2721('0x1c')](_0x56827e[_0x2721('0x18')],{'raw':_0x56827e[_0x2721('0x19')]?_0x56827e['options'][_0x2721('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56827e['options']?_0x56827e[_0x2721('0x19')]['where']||null:null,'attributes':_0x56827e[_0x2721('0x19')]?_0x56827e[_0x2721('0x19')][_0x2721('0x1d')]||null:null,'limit':_0x56827e['options']?_0x56827e[_0x2721('0x19')]['limit']||null:null})[_0x2721('0xa')](function(_0x3e73c5){logger[_0x2721('0xb')](_0x2721('0x1b'),_0x56827e);logger['debug'](_0x2721('0x1b'),_0x56827e,JSON['stringify'](_0x3e73c5));_0x5a1842(_0x3e73c5);})[_0x2721('0x14')](function(_0x18188f){logger[_0x2721('0xf')](_0x2721('0x1b'),_0x18188f[_0x2721('0x11')],_0x56827e);_0x13ce6a(_0x3d7b64['error'](0x1f4,_0x18188f[_0x2721('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bec9f90..8ab07bc 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 _0xb311=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete'];(function(_0x3e704c,_0x4db64e){var _0x835691=function(_0x1a2182){while(--_0x1a2182){_0x3e704c['push'](_0x3e704c['shift']());}};_0x835691(++_0x4db64e);}(_0xb311,0x18e));var _0x1b31=function(_0x4e77e5,_0x702cd3){_0x4e77e5=_0x4e77e5-0x0;var _0x46e60d=_0xb311[_0x4e77e5];return _0x46e60d;};'use strict';var multer=require(_0x1b31('0x0'));var util=require('util');var path=require(_0x1b31('0x1'));var timeout=require(_0x1b31('0x2'));var express=require(_0x1b31('0x3'));var router=express[_0x1b31('0x4')]();var auth=require(_0x1b31('0x5'));var interaction=require(_0x1b31('0x6'));var config=require(_0x1b31('0x7'));var controller=require(_0x1b31('0x8'));router[_0x1b31('0x9')]('/',auth['isAuthenticated'](),controller[_0x1b31('0xa')]);router[_0x1b31('0x9')](_0x1b31('0xb'),auth[_0x1b31('0xc')](),controller[_0x1b31('0xd')]);router[_0x1b31('0x9')](_0x1b31('0xe'),auth['isAuthenticated'](),controller[_0x1b31('0xf')]);router[_0x1b31('0x10')]('/',auth[_0x1b31('0xc')](),controller[_0x1b31('0x11')]);router['put']('/:id',auth[_0x1b31('0xc')](),controller[_0x1b31('0x12')]);router[_0x1b31('0x13')](_0x1b31('0xe'),auth[_0x1b31('0xc')](),controller[_0x1b31('0x14')]);module[_0x1b31('0x15')]=router; \ No newline at end of file +var _0xbb58=['/:id','show','put','update','delete','destroy','exports','path','express','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x47deaa,_0x3593d7){var _0x521a0a=function(_0x24981a){while(--_0x24981a){_0x47deaa['push'](_0x47deaa['shift']());}};_0x521a0a(++_0x3593d7);}(_0xbb58,0xd7));var _0x8bb5=function(_0x1c4362,_0xa0c98b){_0x1c4362=_0x1c4362-0x0;var _0xd55e58=_0xbb58[_0x1c4362];return _0xd55e58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8bb5('0x0'));var timeout=require('connect-timeout');var express=require(_0x8bb5('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8bb5('0x2'));var controller=require(_0x8bb5('0x3'));router[_0x8bb5('0x4')]('/',auth[_0x8bb5('0x5')](),controller[_0x8bb5('0x6')]);router[_0x8bb5('0x4')](_0x8bb5('0x7'),auth[_0x8bb5('0x5')](),controller[_0x8bb5('0x8')]);router['get'](_0x8bb5('0x9'),auth[_0x8bb5('0x5')](),controller[_0x8bb5('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8bb5('0xb')]('/:id',auth[_0x8bb5('0x5')](),controller[_0x8bb5('0xc')]);router[_0x8bb5('0xd')](_0x8bb5('0x9'),auth[_0x8bb5('0x5')](),controller[_0x8bb5('0xe')]);module[_0x8bb5('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 8602f75..a326b33 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 _0x97a7=['NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x3d1cce,_0x4bc6df){var _0x4d2146=function(_0x5a5282){while(--_0x5a5282){_0x3d1cce['push'](_0x3d1cce['shift']());}};_0x4d2146(++_0x4bc6df);}(_0x97a7,0x151));var _0x797a=function(_0x1b83c0,_0x452121){_0x1b83c0=_0x1b83c0-0x0;var _0x4b7bf0=_0x97a7[_0x1b83c0];return _0x4b7bf0;};'use strict';var moment=require(_0x797a('0x0'));var Sequelize=require(_0x797a('0x1'));module[_0x797a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x797a('0x3')](_0x797a('0x4'),_0x797a('0x5'),'queue'),'allowNull':![],'defaultValue':_0x797a('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x797a('0x7')]}}; \ No newline at end of file +var _0x9988=['account','agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x9988,0x10a));var _0x8998=function(_0x212b5d,_0x318113){_0x212b5d=_0x212b5d-0x0;var _0xd29835=_0x9988[_0x212b5d];return _0xd29835;};'use strict';var moment=require('moment');var Sequelize=require(_0x8998('0x0'));module[_0x8998('0x1')]={'uniqueid':{'type':Sequelize[_0x8998('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8998('0x3')](_0x8998('0x4'),_0x8998('0x5'),_0x8998('0x6')),'allowNull':![],'defaultValue':_0x8998('0x6')},'transferredAt':{'type':Sequelize[_0x8998('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8998('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c9681c9..0fd94f5 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(_0x21b48b,_0x1290a4){var _0x2e35a8=function(_0x4f47b9){while(--_0x4f47b9){_0x21b48b['push'](_0x21b48b['shift']());}};_0x2e35a8(++_0x1290a4);}(_0xdb28,0x106));var _0x8db2=function(_0x547261,_0x233065){_0x547261=_0x547261-0x0;var _0x5d8ac4=_0xdb28[_0x547261];return _0x5d8ac4;};'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 _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(_0x16dfbf,_0x4fee91){var _0x64086c=function(_0x2c9160){while(--_0x2c9160){_0x16dfbf['push'](_0x16dfbf['shift']());}};_0x64086c(++_0x4fee91);}(_0xdb28,0x106));var _0x8db2=function(_0x5e1706,_0x254346){_0x5e1706=_0x5e1706-0x0;var _0x2b9d1e=_0xdb28[_0x5e1706];return _0x2b9d1e;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 08c86ec..0069fcc 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 _0xa244=['request-promise','path','rimraf','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2827eb,_0x54f4d0){var _0x495ae1=function(_0x310057){while(--_0x310057){_0x2827eb['push'](_0x2827eb['shift']());}};_0x495ae1(++_0x54f4d0);}(_0xa244,0xf1));var _0x4a24=function(_0x22fc70,_0x2a7484){_0x22fc70=_0x22fc70-0x0;var _0xb37f8=_0xa244[_0x22fc70];return _0xb37f8;};'use strict';var _=require(_0x4a24('0x0'));var util=require(_0x4a24('0x1'));var logger=require(_0x4a24('0x2'))(_0x4a24('0x3'));var moment=require(_0x4a24('0x4'));var BPromise=require(_0x4a24('0x5'));var rp=require(_0x4a24('0x6'));var fs=require('fs');var path=require(_0x4a24('0x7'));var rimraf=require(_0x4a24('0x8'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x4a24('0x9')]=function(_0x52ce20,_0x29f3f9){return _0x52ce20[_0x4a24('0xa')]('FaxTransferReport',attributes,{'tableName':_0x4a24('0xb'),'paranoid':![],'indexes':[{'name':_0x4a24('0xc'),'fields':[_0x4a24('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc288=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x13aee8,_0x4e55b6){var _0x8d06f3=function(_0x2b26e9){while(--_0x2b26e9){_0x13aee8['push'](_0x13aee8['shift']());}};_0x8d06f3(++_0x4e55b6);}(_0xc288,0x1d3));var _0x8c28=function(_0x341862,_0x5c2f81){_0x341862=_0x341862-0x0;var _0x22b740=_0xc288[_0x341862];return _0x22b740;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var moment=require(_0x8c28('0x4'));var BPromise=require(_0x8c28('0x5'));var rp=require(_0x8c28('0x6'));var fs=require('fs');var path=require(_0x8c28('0x7'));var rimraf=require(_0x8c28('0x8'));var config=require(_0x8c28('0x9'));var attributes=require(_0x8c28('0xa'));module[_0x8c28('0xb')]=function(_0x3d124c,_0x2240c7){return _0x3d124c[_0x8c28('0xc')](_0x8c28('0xd'),attributes,{'tableName':_0x8c28('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8c28('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e9efd3e..aba0ed2 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 _0xf03b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3d3d7b,_0x5c0937){var _0x33e7c8=function(_0xe0ee81){while(--_0xe0ee81){_0x3d3d7b['push'](_0x3d3d7b['shift']());}};_0x33e7c8(++_0x5c0937);}(_0xf03b,0x73));var _0xbf03=function(_0xde8e3e,_0x542c5c){_0xde8e3e=_0xde8e3e-0x0;var _0x228940=_0xf03b[_0xde8e3e];return _0x228940;};'use strict';var _=require(_0xbf03('0x0'));var util=require(_0xbf03('0x1'));var moment=require(_0xbf03('0x2'));var BPromise=require(_0xbf03('0x3'));var rs=require(_0xbf03('0x4'));var fs=require('fs');var Redis=require(_0xbf03('0x5'));var db=require(_0xbf03('0x6'))['db'];var utils=require(_0xbf03('0x7'));var logger=require(_0xbf03('0x8'))(_0xbf03('0x9'));var config=require(_0xbf03('0xa'));var jayson=require(_0xbf03('0xb'));var client=jayson[_0xbf03('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84e900,_0x43b502,_0x448dd2){return new BPromise(function(_0x18c322,_0x33d5e0){return client[_0xbf03('0xd')](_0x84e900,_0x448dd2)['then'](function(_0x407b72){logger[_0xbf03('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x43b502,_0xbf03('0xf'));logger[_0xbf03('0x10')](_0xbf03('0x11'),_0x43b502,_0xbf03('0xf'),JSON[_0xbf03('0x12')](_0x407b72));if(_0x407b72['error']){if(_0x407b72['error'][_0xbf03('0x13')]===0x1f4){logger[_0xbf03('0x14')](_0xbf03('0x15'),_0x43b502,_0x407b72['error'][_0xbf03('0x16')]);return _0x33d5e0(_0x407b72['error'][_0xbf03('0x16')]);}logger[_0xbf03('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x43b502,_0x407b72[_0xbf03('0x14')]['message']);return _0x18c322(_0x407b72[_0xbf03('0x14')][_0xbf03('0x16')]);}else{logger[_0xbf03('0xe')](_0xbf03('0x15'),_0x43b502,_0xbf03('0xf'));_0x18c322(_0x407b72[_0xbf03('0x17')][_0xbf03('0x16')]);}})['catch'](function(_0x2d765b){logger['error'](_0xbf03('0x15'),_0x43b502,_0x2d765b);_0x33d5e0(_0x2d765b);});});} \ No newline at end of file +var _0x3977=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3977,0x132));var _0x7397=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3977[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7397('0x0'));var util=require('util');var moment=require(_0x7397('0x1'));var BPromise=require(_0x7397('0x2'));var rs=require(_0x7397('0x3'));var fs=require('fs');var Redis=require(_0x7397('0x4'));var db=require(_0x7397('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7397('0x6'));var jayson=require(_0x7397('0x7'));var client=jayson['client'][_0x7397('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8e12ce,_0x6736f0,_0x547fde){return new BPromise(function(_0x327f47,_0x2f866f){return client[_0x7397('0x9')](_0x8e12ce,_0x547fde)[_0x7397('0xa')](function(_0x3d8e73){logger[_0x7397('0xb')](_0x7397('0xc'),_0x6736f0,_0x7397('0xd'));logger[_0x7397('0xe')](_0x7397('0xf'),_0x6736f0,_0x7397('0xd'),JSON[_0x7397('0x10')](_0x3d8e73));if(_0x3d8e73[_0x7397('0x11')]){if(_0x3d8e73['error'][_0x7397('0x12')]===0x1f4){logger[_0x7397('0x11')](_0x7397('0xc'),_0x6736f0,_0x3d8e73['error'][_0x7397('0x13')]);return _0x2f866f(_0x3d8e73[_0x7397('0x11')][_0x7397('0x13')]);}logger['error'](_0x7397('0xc'),_0x6736f0,_0x3d8e73['error'][_0x7397('0x13')]);return _0x327f47(_0x3d8e73[_0x7397('0x11')][_0x7397('0x13')]);}else{logger[_0x7397('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x6736f0,_0x7397('0xd'));_0x327f47(_0x3d8e73[_0x7397('0x14')][_0x7397('0x13')]);}})[_0x7397('0x15')](function(_0xb83e3f){logger[_0x7397('0x11')](_0x7397('0xc'),_0x6736f0,_0xb83e3f);_0x2f866f(_0xb83e3f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8b47ed1..d907485 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 _0x4a06=['create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x4a06,0xfb));var _0x64a0=function(_0x1933a8,_0x50f4e3){_0x1933a8=_0x1933a8-0x0;var _0xcd0d85=_0x4a06[_0x1933a8];return _0xcd0d85;};'use strict';var multer=require(_0x64a0('0x0'));var util=require('util');var path=require(_0x64a0('0x1'));var timeout=require(_0x64a0('0x2'));var express=require(_0x64a0('0x3'));var router=express[_0x64a0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x64a0('0x5'));var config=require(_0x64a0('0x6'));var controller=require(_0x64a0('0x7'));router[_0x64a0('0x8')]('/',auth[_0x64a0('0x9')](),controller[_0x64a0('0xa')]);router[_0x64a0('0x8')](_0x64a0('0xb'),auth[_0x64a0('0x9')](),controller['describe']);router[_0x64a0('0x8')](_0x64a0('0xc'),auth['isAuthenticated'](),controller[_0x64a0('0xd')]);router[_0x64a0('0xe')]('/',auth[_0x64a0('0x9')](),controller[_0x64a0('0xf')]);router[_0x64a0('0x10')](_0x64a0('0xc'),auth[_0x64a0('0x9')](),controller[_0x64a0('0x11')]);router[_0x64a0('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8fbb=['put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','/describe','describe','/:id','show','post','isAuthenticated','create'];(function(_0x12f11c,_0x4cdc42){var _0x46f7fb=function(_0x392745){while(--_0x392745){_0x12f11c['push'](_0x12f11c['shift']());}};_0x46f7fb(++_0x4cdc42);}(_0x8fbb,0x134));var _0xb8fb=function(_0x95a619,_0x1f9ad6){_0x95a619=_0x95a619-0x0;var _0x3f9473=_0x8fbb[_0x95a619];return _0x3f9473;};'use strict';var multer=require('multer');var util=require(_0xb8fb('0x0'));var path=require(_0xb8fb('0x1'));var timeout=require(_0xb8fb('0x2'));var express=require(_0xb8fb('0x3'));var router=express['Router']();var auth=require(_0xb8fb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb8fb('0x5'));var controller=require(_0xb8fb('0x6'));router[_0xb8fb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb8fb('0x7')](_0xb8fb('0x8'),auth['isAuthenticated'](),controller[_0xb8fb('0x9')]);router[_0xb8fb('0x7')](_0xb8fb('0xa'),auth['isAuthenticated'](),controller[_0xb8fb('0xb')]);router[_0xb8fb('0xc')]('/',auth[_0xb8fb('0xd')](),controller[_0xb8fb('0xe')]);router[_0xb8fb('0xf')](_0xb8fb('0xa'),auth[_0xb8fb('0xd')](),controller['update']);router[_0xb8fb('0x10')](_0xb8fb('0xa'),auth[_0xb8fb('0xd')](),controller[_0xb8fb('0x11')]);module[_0xb8fb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e2f2ee6..163178a 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 _0x0e85=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','../../config/environment','get','isAuthenticated','index','show'];(function(_0x5cb3a9,_0x19602b){var _0x343dce=function(_0x4e6aff){while(--_0x4e6aff){_0x5cb3a9['push'](_0x5cb3a9['shift']());}};_0x343dce(++_0x19602b);}(_0x0e85,0x7c));var _0x50e8=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x0e85[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./intDeskAccount.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/:id',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x5')](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xa')]);router['get'](_0x50e8('0xb'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0xd')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xe')]);router[_0x50e8('0xd')](_0x50e8('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x50e8('0xf')](_0x50e8('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x50e8('0x11')](_0x50e8('0x10'),auth[_0x50e8('0x6')](),controller[_0x50e8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2eb2=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0xf2efae,_0x307737){var _0x241311=function(_0x5ba928){while(--_0x5ba928){_0xf2efae['push'](_0xf2efae['shift']());}};_0x241311(++_0x307737);}(_0x2eb2,0x19f));var _0x22eb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x2eb2[_0x397cfb];return _0x15fed9;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x9')](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0x9')](_0x22eb('0xe'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);router['post'](_0x22eb('0xc'),auth[_0x22eb('0x7')](),controller['addConfiguration']);router['put'](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x11')]);router[_0x22eb('0x12')](_0x22eb('0xa'),auth['isAuthenticated'](),controller[_0x22eb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 00b0157..6a96ee5 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 _0xc62b=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc62b,0x136));var _0xbc62=function(_0xc4f80a,_0x14cfa1){_0xc4f80a=_0xc4f80a-0x0;var _0x4bcef1=_0xc62b[_0xc4f80a];return _0x4bcef1;};'use strict';var Sequelize=require(_0xbc62('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc62('0x1')]},'description':{'type':Sequelize[_0xbc62('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbc62('0x1')]},'authType':{'type':Sequelize[_0xbc62('0x2')](_0xbc62('0x3')),'defaultValue':_0xbc62('0x3')},'password':{'type':Sequelize[_0xbc62('0x1')]},'consumerKey':{'type':Sequelize[_0xbc62('0x1')]},'consumerSecret':{'type':Sequelize[_0xbc62('0x1')]},'token':{'type':Sequelize[_0xbc62('0x1')]},'tokenSecret':{'type':Sequelize[_0xbc62('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbc62('0x2')](_0xbc62('0x4'),_0xbc62('0x5')),'defaultValue':_0xbc62('0x4')}}; \ No newline at end of file +var _0x820d=['exports','STRING','basic','integrationTab','sequelize'];(function(_0x4491f0,_0x4d4d7f){var _0x2df09f=function(_0x4b9ceb){while(--_0x4b9ceb){_0x4491f0['push'](_0x4491f0['shift']());}};_0x2df09f(++_0x4d4d7f);}(_0x820d,0xb8));var _0xd820=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x820d[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xd820('0x0'));module[_0xd820('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd820('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xd820('0x3')),'defaultValue':_0xd820('0x3')},'password':{'type':Sequelize[_0xd820('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd820('0x2')]},'token':{'type':Sequelize[_0xd820('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd820('0x2')]},'type':{'type':Sequelize['ENUM'](_0xd820('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index d1621e5..df3d1bc 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 _0xc5d5=['addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','base64','concat','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','apply','save','update','destroy','end','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','count','include','show','includeAll','find','create','body','params','getConfigurations','DeskConfiguration','length'];(function(_0x33f994,_0x563f5a){var _0x5e1900=function(_0x448cd3){while(--_0x448cd3){_0x33f994['push'](_0x33f994['shift']());}};_0x5e1900(++_0x563f5a);}(_0xc5d5,0x178));var _0x5c5d=function(_0x195c6b,_0x558639){_0x195c6b=_0x195c6b-0x0;var _0x239123=_0xc5d5[_0x195c6b];return _0x239123;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c5d('0x0'));var rimraf=require(_0x5c5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c5d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c5d('0x3'));var Mustache=require('mustache');var util=require(_0x5c5d('0x4'));var path=require(_0x5c5d('0x5'));var sox=require(_0x5c5d('0x6'));var csv=require(_0x5c5d('0x7'));var ejs=require(_0x5c5d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5c5d('0x9'));var crypto=require('crypto');var jsforce=require(_0x5c5d('0xa'));var deskjs=require(_0x5c5d('0xb'));var toCsv=require(_0x5c5d('0x7'));var querystring=require(_0x5c5d('0xc'));var Papa=require(_0x5c5d('0xd'));var Redis=require(_0x5c5d('0xe'));var authService=require(_0x5c5d('0xf'));var qs=require(_0x5c5d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c5d('0x11'));var logger=require(_0x5c5d('0x12'))('api');var utils=require(_0x5c5d('0x13'));var config=require(_0x5c5d('0x14'));var db=require(_0x5c5d('0x15'))['db'];var integrations=require(_0x5c5d('0x16'));var jayson=require(_0x5c5d('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xc4ef7a,_0x266bd2,_0x51986d){if(_0x51986d){var _0x2b97e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b97e8['test'](_0x266bd2)){return _0xc4ef7a;}else{throw new db[(_0x5c5d('0x18'))]['ValidationError'](_0x5c5d('0x19'));}}else{return _0xc4ef7a;}}function respondWithRpcPromise(_0x463df6,_0x4c5d0c,_0x559dc9,_0x41239d){return new BPromise(function(_0x3f796c,_0x317ec){var _0xeaa118=_0x41239d||client;return _0xeaa118[_0x5c5d('0x1a')](_0x463df6,_0x559dc9)[_0x5c5d('0x1b')](function(_0x133d92){logger[_0x5c5d('0x1c')](_0x5c5d('0x1d'),_0x4c5d0c,'request\x20sent');logger[_0x5c5d('0x1e')](_0x5c5d('0x1f'),_0x4c5d0c,_0x5c5d('0x20'),JSON['stringify'](_0x133d92));if(_0x133d92[_0x5c5d('0x21')]){if(_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x22')]===0x1f4){logger[_0x5c5d('0x21')](_0x5c5d('0x1d'),_0x4c5d0c,_0x133d92['error'][_0x5c5d('0x23')]);return _0x317ec(_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x23')]);}logger['error'](_0x5c5d('0x1d'),_0x4c5d0c,_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x23')]);return _0x3f796c(_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x23')]);}else{logger[_0x5c5d('0x1c')](_0x5c5d('0x1d'),_0x4c5d0c,_0x5c5d('0x20'));_0x3f796c(_0x133d92[_0x5c5d('0x24')][_0x5c5d('0x23')]);}})[_0x5c5d('0x25')](function(_0x5f252a){logger[_0x5c5d('0x21')](_0x5c5d('0x1d'),_0x4c5d0c,_0x5f252a);_0x317ec(_0x5f252a);});});}function respondWithStatusCode(_0x4cfc84,_0x537607){_0x537607=_0x537607||0xcc;return function(_0xb271b1){if(_0xb271b1){return _0x4cfc84[_0x5c5d('0x26')](_0x537607);}return _0x4cfc84[_0x5c5d('0x27')](_0x537607)['end']();};}function respondWithResult(_0x28bd27,_0x5961d0){_0x5961d0=_0x5961d0||0xc8;return function(_0x296764){if(_0x296764){return _0x28bd27[_0x5c5d('0x27')](_0x5961d0)[_0x5c5d('0x28')](_0x296764);}};}function respondWithFilteredResult(_0x559886,_0x4887e3){return function(_0x23b8aa){if(_0x23b8aa){var _0x59fa18=_0x23b8aa['count'],_0x5990f9=_0x4887e3[_0x5c5d('0x29')],_0x45811a=_0x4887e3[_0x5c5d('0x29')]+_0x4887e3[_0x5c5d('0x2a')],_0x10220a;if(_0x45811a>=_0x59fa18){_0x45811a=_0x59fa18;_0x10220a=0xc8;}else{_0x10220a=0xce;}_0x559886[_0x5c5d('0x27')](_0x10220a);return _0x559886[_0x5c5d('0x2b')]('Content-Range',_0x5990f9+'-'+_0x45811a+'/'+_0x59fa18)['json'](_0x23b8aa);}return null;};}function patchUpdates(_0x51f0a5){return function(_0x457009){try{jsonpatch[_0x5c5d('0x2c')](_0x457009,_0x51f0a5,!![]);}catch(_0x15e7ab){return BPromise['reject'](_0x15e7ab);}return _0x457009[_0x5c5d('0x2d')]();};}function saveUpdates(_0x3e1ef9,_0x306784){return function(_0x3b5211){if(_0x3b5211){return _0x3b5211[_0x5c5d('0x2e')](_0x3e1ef9)[_0x5c5d('0x1b')](function(_0x26b3a2){return _0x26b3a2;});}return null;};}function removeEntity(_0x2fc5f8,_0x2fb8cc){return function(_0x20da60){if(_0x20da60){return _0x20da60[_0x5c5d('0x2f')]()[_0x5c5d('0x1b')](function(){_0x2fc5f8[_0x5c5d('0x27')](0xcc)[_0x5c5d('0x30')]();});}};}function handleEntityNotFound(_0x258dc6,_0xdd946f){return function(_0x2adf8c){if(!_0x2adf8c){_0x258dc6[_0x5c5d('0x26')](0x194);}return _0x2adf8c;};}function handleError(_0x5cdfcc,_0x11cfde){_0x11cfde=_0x11cfde||0x1f4;return function(_0x41a942){logger['error'](_0x41a942['stack']);if(_0x41a942[_0x5c5d('0x31')]){delete _0x41a942[_0x5c5d('0x31')];}_0x5cdfcc['status'](_0x11cfde)[_0x5c5d('0x32')](_0x41a942);};}exports[_0x5c5d('0x33')]=function(_0x10b4b8,_0x4d8f56){var _0x44e751={},_0x41680b={},_0x158d1b={'count':0x0,'rows':[]};var _0x194059=_[_0x5c5d('0x34')](db[_0x5c5d('0x35')][_0x5c5d('0x36')],function(_0x8dfb6c){return{'name':_0x8dfb6c[_0x5c5d('0x37')],'type':_0x8dfb6c['type'][_0x5c5d('0x38')]};});_0x41680b['model']=_[_0x5c5d('0x34')](_0x194059,_0x5c5d('0x31'));_0x41680b[_0x5c5d('0x39')]=_[_0x5c5d('0x3a')](_0x10b4b8['query']);_0x41680b[_0x5c5d('0x3b')]=_[_0x5c5d('0x3c')](_0x41680b[_0x5c5d('0x3d')],_0x41680b[_0x5c5d('0x39')]);_0x44e751[_0x5c5d('0x3e')]=_[_0x5c5d('0x3c')](_0x41680b[_0x5c5d('0x3d')],qs[_0x5c5d('0x3f')](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x3f')]));_0x44e751[_0x5c5d('0x3e')]=_0x44e751[_0x5c5d('0x3e')]['length']?_0x44e751['attributes']:_0x41680b[_0x5c5d('0x3d')];if(!_0x10b4b8['query'][_0x5c5d('0x40')](_0x5c5d('0x41'))){_0x44e751['limit']=qs['limit'](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x2a')]);_0x44e751['offset']=qs[_0x5c5d('0x29')](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x29')]);}_0x44e751[_0x5c5d('0x42')]=qs[_0x5c5d('0x43')](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x43')]);_0x44e751[_0x5c5d('0x44')]=qs[_0x5c5d('0x3b')](_['pick'](_0x10b4b8[_0x5c5d('0x39')],_0x41680b[_0x5c5d('0x3b')]),_0x194059);if(_0x10b4b8[_0x5c5d('0x39')]['filter']){_0x44e751['where']=_['merge'](_0x44e751['where'],{'$or':_[_0x5c5d('0x34')](_0x194059,function(_0x254b7b){if(_0x254b7b[_0x5c5d('0x45')]!==_0x5c5d('0x46')){var _0x1d49a2={};_0x1d49a2[_0x254b7b[_0x5c5d('0x31')]]={'$like':'%'+_0x10b4b8[_0x5c5d('0x39')]['filter']+'%'};return _0x1d49a2;}})});}_0x44e751=_[_0x5c5d('0x47')]({},_0x44e751,_0x10b4b8[_0x5c5d('0x48')]);var _0x5857f1={'where':_0x44e751[_0x5c5d('0x44')]};return db['DeskAccount'][_0x5c5d('0x49')](_0x5857f1)[_0x5c5d('0x1b')](function(_0x2143fd){_0x158d1b[_0x5c5d('0x49')]=_0x2143fd;if(_0x10b4b8[_0x5c5d('0x39')]['includeAll']){_0x44e751[_0x5c5d('0x4a')]=[{'all':!![]}];}return db[_0x5c5d('0x35')]['findAll'](_0x44e751);})[_0x5c5d('0x1b')](function(_0x3c5efc){_0x158d1b['rows']=_0x3c5efc;return _0x158d1b;})[_0x5c5d('0x1b')](respondWithFilteredResult(_0x4d8f56,_0x44e751))['catch'](handleError(_0x4d8f56,null));};exports[_0x5c5d('0x4b')]=function(_0x4e05e7,_0x13d983){var _0x41a85c={'raw':![],'where':{'id':_0x4e05e7['params']['id']}},_0x398401={};_0x398401[_0x5c5d('0x3d')]=_[_0x5c5d('0x3a')](db[_0x5c5d('0x35')]['rawAttributes']);_0x398401[_0x5c5d('0x39')]=_[_0x5c5d('0x3a')](_0x4e05e7[_0x5c5d('0x39')]);_0x398401[_0x5c5d('0x3b')]=_[_0x5c5d('0x3c')](_0x398401[_0x5c5d('0x3d')],_0x398401[_0x5c5d('0x39')]);_0x41a85c[_0x5c5d('0x3e')]=_['intersection'](_0x398401[_0x5c5d('0x3d')],qs['fields'](_0x4e05e7[_0x5c5d('0x39')][_0x5c5d('0x3f')]));_0x41a85c[_0x5c5d('0x3e')]=_0x41a85c[_0x5c5d('0x3e')]['length']?_0x41a85c[_0x5c5d('0x3e')]:_0x398401[_0x5c5d('0x3d')];if(_0x4e05e7[_0x5c5d('0x39')][_0x5c5d('0x4c')]){_0x41a85c[_0x5c5d('0x4a')]=[{'all':!![]}];}_0x41a85c=_[_0x5c5d('0x47')]({},_0x41a85c,_0x4e05e7['options']);return db[_0x5c5d('0x35')][_0x5c5d('0x4d')](_0x41a85c)[_0x5c5d('0x1b')](handleEntityNotFound(_0x13d983,null))[_0x5c5d('0x1b')](respondWithResult(_0x13d983,null))[_0x5c5d('0x25')](handleError(_0x13d983,null));};exports['create']=function(_0x16f921,_0x2cecdf){return db[_0x5c5d('0x35')][_0x5c5d('0x4e')](_0x16f921[_0x5c5d('0x4f')],{})[_0x5c5d('0x1b')](respondWithResult(_0x2cecdf,0xc9))[_0x5c5d('0x25')](handleError(_0x2cecdf,null));};exports[_0x5c5d('0x2e')]=function(_0x155c75,_0x2825fd){if(_0x155c75[_0x5c5d('0x4f')]['id']){delete _0x155c75[_0x5c5d('0x4f')]['id'];}return db[_0x5c5d('0x35')][_0x5c5d('0x4d')]({'where':{'id':_0x155c75[_0x5c5d('0x50')]['id']}})['then'](handleEntityNotFound(_0x2825fd,null))['then'](saveUpdates(_0x155c75[_0x5c5d('0x4f')],null))[_0x5c5d('0x1b')](respondWithResult(_0x2825fd,null))[_0x5c5d('0x25')](handleError(_0x2825fd,null));};exports[_0x5c5d('0x2f')]=function(_0x5410d3,_0x1382f4){return db['DeskAccount']['find']({'where':{'id':_0x5410d3[_0x5c5d('0x50')]['id']}})[_0x5c5d('0x1b')](handleEntityNotFound(_0x1382f4,null))['then'](removeEntity(_0x1382f4,null))['catch'](handleError(_0x1382f4,null));};exports[_0x5c5d('0x51')]=function(_0x19aece,_0x4502d9,_0x14c643){var _0x52c518={};var _0x823467={};var _0xdda075;var _0x24de14;return db[_0x5c5d('0x35')]['findOne']({'where':{'id':_0x19aece['params']['id']}})[_0x5c5d('0x1b')](handleEntityNotFound(_0x4502d9,null))[_0x5c5d('0x1b')](function(_0x1c7149){if(_0x1c7149){_0xdda075=_0x1c7149;_0x823467[_0x5c5d('0x3d')]=_[_0x5c5d('0x3a')](db[_0x5c5d('0x52')][_0x5c5d('0x36')]);_0x823467['query']=_['keys'](_0x19aece[_0x5c5d('0x39')]);_0x823467[_0x5c5d('0x3b')]=_[_0x5c5d('0x3c')](_0x823467['model'],_0x823467[_0x5c5d('0x39')]);_0x52c518[_0x5c5d('0x3e')]=_[_0x5c5d('0x3c')](_0x823467[_0x5c5d('0x3d')],qs['fields'](_0x19aece[_0x5c5d('0x39')][_0x5c5d('0x3f')]));_0x52c518[_0x5c5d('0x3e')]=_0x52c518[_0x5c5d('0x3e')][_0x5c5d('0x53')]?_0x52c518[_0x5c5d('0x3e')]:_0x823467[_0x5c5d('0x3d')];_0x52c518[_0x5c5d('0x42')]=qs['sort'](_0x19aece[_0x5c5d('0x39')]['sort']);_0x52c518[_0x5c5d('0x44')]=qs['filters'](_['pick'](_0x19aece[_0x5c5d('0x39')],_0x823467[_0x5c5d('0x3b')]));if(_0x19aece[_0x5c5d('0x39')]['filter']){_0x52c518['where']=_[_0x5c5d('0x47')](_0x52c518[_0x5c5d('0x44')],{'$or':_[_0x5c5d('0x34')](_0x52c518[_0x5c5d('0x3e')],function(_0x41fff2){var _0x489dda={};_0x489dda[_0x41fff2]={'$like':'%'+_0x19aece['query']['filter']+'%'};return _0x489dda;})});}_0x52c518=_['merge']({},_0x52c518,_0x19aece['options']);return _0xdda075[_0x5c5d('0x51')](_0x52c518);}})[_0x5c5d('0x1b')](function(_0x30015a){if(_0x30015a){_0x24de14=_0x30015a['length'];if(!_0x19aece['query']['hasOwnProperty']('nolimit')){_0x52c518[_0x5c5d('0x2a')]=qs['limit'](_0x19aece[_0x5c5d('0x39')]['limit']);_0x52c518[_0x5c5d('0x29')]=qs['offset'](_0x19aece[_0x5c5d('0x39')][_0x5c5d('0x29')]);}return _0xdda075[_0x5c5d('0x51')](_0x52c518);}})[_0x5c5d('0x1b')](function(_0x140a2e){if(_0x140a2e){return _0x140a2e?{'count':_0x24de14,'rows':_0x140a2e}:null;}})[_0x5c5d('0x1b')](respondWithResult(_0x4502d9,null))[_0x5c5d('0x25')](handleError(_0x4502d9,null));};exports[_0x5c5d('0x54')]=function(_0x4f6687,_0x6d24f6,_0x237198){if(_0x4f6687[_0x5c5d('0x4f')]['id']){delete _0x4f6687[_0x5c5d('0x4f')]['id'];}return db[_0x5c5d('0x35')][_0x5c5d('0x55')]({'where':{'id':_0x4f6687['params']['id']}})[_0x5c5d('0x1b')](handleEntityNotFound(_0x6d24f6,null))[_0x5c5d('0x1b')](function(_0x1e0468){if(_0x1e0468){_0x4f6687['body'][_0x5c5d('0x56')]=_0x1e0468['id'];_0x4f6687['body']['Subjects']=integrations[_0x5c5d('0x57')](_0x4f6687[_0x5c5d('0x4f')]['channel'],_0x4f6687[_0x5c5d('0x4f')][_0x5c5d('0x45')]);_0x4f6687[_0x5c5d('0x4f')][_0x5c5d('0x58')]=integrations[_0x5c5d('0x59')](_0x4f6687[_0x5c5d('0x4f')]['channel'],_0x4f6687['body'][_0x5c5d('0x45')]);return db['DeskConfiguration'][_0x5c5d('0x4e')](_0x4f6687[_0x5c5d('0x4f')],{'include':[{'model':db[_0x5c5d('0x5a')],'as':_0x5c5d('0x5b')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6d24f6,null))[_0x5c5d('0x25')](handleError(_0x6d24f6,null));};exports[_0x5c5d('0x5c')]=function(_0x5edb82,_0x21aef6,_0x2f3098){var _0x26676e=[{'name':'priority','label':_0x5c5d('0x5d'),'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 _0x52b7f8='';return db[_0x5c5d('0x35')][_0x5c5d('0x55')]({'where':{'id':_0x5edb82[_0x5c5d('0x50')]['id']},'attributes':['id',_0x5c5d('0x5e'),_0x5c5d('0x5f'),'username',_0x5c5d('0x60'),'consumerKey',_0x5c5d('0x61'),'token','tokenSecret']})[_0x5c5d('0x1b')](handleEntityNotFound(_0x21aef6,null))['then'](function(_0x404c18){if(_0x404c18){_0x52b7f8=_0x404c18[_0x5c5d('0x5e')];var _0x2cfff9=_0x52b7f8[_0x5c5d('0x62')](-0x1);if(_0x2cfff9==='/'){_0x52b7f8=_0x52b7f8[_0x5c5d('0x63')](0x0,_0x52b7f8[_0x5c5d('0x64')](_0x2cfff9));}var _0x3c78a8={'method':_0x5c5d('0x65'),'uri':util[_0x5c5d('0x66')](_0x5c5d('0x67'),_0x52b7f8),'headers':{'Content-Type':_0x5c5d('0x68'),'Accept':_0x5c5d('0x68')},'json':!![]};if(_0x404c18[_0x5c5d('0x5f')]===_0x5c5d('0x69')){_0x3c78a8[_0x5c5d('0x6a')]['Authorization']=util[_0x5c5d('0x66')](_0x5c5d('0x6b'),new Buffer(util[_0x5c5d('0x66')]('%s:%s',_0x404c18['username'],_0x404c18[_0x5c5d('0x60')]))['toString'](_0x5c5d('0x6c')));}return rp(_0x3c78a8)[_0x5c5d('0x1b')](function(_0x3fb292){return _0x26676e[_0x5c5d('0x6d')](_[_0x5c5d('0x34')](_0x3fb292[_0x5c5d('0x6e')][_0x5c5d('0x6f')],function(_0x37f8bb){return{'id':_0x37f8bb[_0x5c5d('0x31')],'name':_0x37f8bb['name'],'type':_0x37f8bb[_0x5c5d('0x45')],'active':_0x37f8bb['active'],'label':_0x37f8bb['label'],'custom':!![]};}));});}})[_0x5c5d('0x1b')](function(_0x3adc9d){return{'count':_0x3adc9d['length'],'rows':_0x3adc9d};})['then'](respondWithResult(_0x21aef6,null))[_0x5c5d('0x25')](function(_0x2425cd){var _0x3b8fa2=_0x5edb82['query'][_0x5c5d('0x70')]?0x1f4:_0x2425cd[_0x5c5d('0x71')]||0x1f4;logger[_0x5c5d('0x21')](_0x5c5d('0x72'),_0x5c5d('0x5c'),_0x3b8fa2,JSON['stringify'](_0x2425cd));delete _0x2425cd[_0x5c5d('0x31')];if(_0x3b8fa2===0x191){_0x3b8fa2=0x190;}_0x21aef6['status'](_0x3b8fa2)['send'](_0x5edb82[_0x5c5d('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2425cd[_0x5c5d('0x71')]}:_0x2425cd);});}; \ No newline at end of file +var _0x5fc8=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','Sequelize','ValidationError','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','offset','set','save','name','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','DeskAccount','count','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','base64','concat','_embedded','entries','label','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x5fc8,0x1ea));var _0x85fc=function(_0x24a9ef,_0x2e4758){_0x24a9ef=_0x24a9ef-0x0;var _0x6ca07e=_0x5fc8[_0x24a9ef];return _0x6ca07e;};'use strict';var pdf=require(_0x85fc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x85fc('0x1'));var zipdir=require(_0x85fc('0x2'));var jsonpatch=require(_0x85fc('0x3'));var rp=require(_0x85fc('0x4'));var moment=require(_0x85fc('0x5'));var BPromise=require(_0x85fc('0x6'));var Mustache=require(_0x85fc('0x7'));var util=require(_0x85fc('0x8'));var path=require(_0x85fc('0x9'));var sox=require(_0x85fc('0xa'));var csv=require(_0x85fc('0xb'));var ejs=require(_0x85fc('0xc'));var fs=require('fs');var _=require(_0x85fc('0xd'));var squel=require('squel');var crypto=require(_0x85fc('0xe'));var jsforce=require(_0x85fc('0xf'));var deskjs=require(_0x85fc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x85fc('0x11'));var Papa=require(_0x85fc('0x12'));var Redis=require(_0x85fc('0x13'));var authService=require(_0x85fc('0x14'));var qs=require(_0x85fc('0x15'));var as=require(_0x85fc('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85fc('0x17'))(_0x85fc('0x18'));var utils=require(_0x85fc('0x19'));var config=require(_0x85fc('0x1a'));var db=require(_0x85fc('0x1b'))['db'];var integrations=require(_0x85fc('0x1c'));var jayson=require('jayson/promise');var client=jayson['client'][_0x85fc('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x2ebb5e,_0x26b19d,_0x501145){if(_0x501145){var _0x5e65ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e65ad[_0x85fc('0x1e')](_0x26b19d)){return _0x2ebb5e;}else{throw new db[(_0x85fc('0x1f'))][(_0x85fc('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 _0x2ebb5e;}}function respondWithRpcPromise(_0x52c490,_0x2a22f1,_0x23417a,_0x1f5ece){return new BPromise(function(_0x5a1744,_0x4545c0){var _0x324ae8=_0x1f5ece||client;return _0x324ae8[_0x85fc('0x21')](_0x52c490,_0x23417a)[_0x85fc('0x22')](function(_0x4c41c7){logger['info'](_0x85fc('0x23'),_0x2a22f1,_0x85fc('0x24'));logger[_0x85fc('0x25')](_0x85fc('0x26'),_0x2a22f1,_0x85fc('0x24'),JSON[_0x85fc('0x27')](_0x4c41c7));if(_0x4c41c7[_0x85fc('0x28')]){if(_0x4c41c7[_0x85fc('0x28')]['code']===0x1f4){logger[_0x85fc('0x28')](_0x85fc('0x23'),_0x2a22f1,_0x4c41c7['error'][_0x85fc('0x29')]);return _0x4545c0(_0x4c41c7['error'][_0x85fc('0x29')]);}logger[_0x85fc('0x28')](_0x85fc('0x23'),_0x2a22f1,_0x4c41c7[_0x85fc('0x28')][_0x85fc('0x29')]);return _0x5a1744(_0x4c41c7[_0x85fc('0x28')][_0x85fc('0x29')]);}else{logger[_0x85fc('0x2a')]('DeskAccount,\x20%s,\x20%s',_0x2a22f1,_0x85fc('0x24'));_0x5a1744(_0x4c41c7[_0x85fc('0x2b')]['message']);}})['catch'](function(_0x49e8ce){logger[_0x85fc('0x28')](_0x85fc('0x23'),_0x2a22f1,_0x49e8ce);_0x4545c0(_0x49e8ce);});});}function respondWithStatusCode(_0x4c2d35,_0x3b7d22){_0x3b7d22=_0x3b7d22||0xcc;return function(_0x104bde){if(_0x104bde){return _0x4c2d35[_0x85fc('0x2c')](_0x3b7d22);}return _0x4c2d35[_0x85fc('0x2d')](_0x3b7d22)[_0x85fc('0x2e')]();};}function respondWithResult(_0x1547fd,_0x8a1864){_0x8a1864=_0x8a1864||0xc8;return function(_0x4f8c9b){if(_0x4f8c9b){return _0x1547fd[_0x85fc('0x2d')](_0x8a1864)[_0x85fc('0x2f')](_0x4f8c9b);}};}function respondWithFilteredResult(_0xc767c3,_0x264799){return function(_0x3d78f2){if(_0x3d78f2){var _0x510453=_0x3d78f2['count'],_0x3145da=_0x264799[_0x85fc('0x30')],_0x20de09=_0x264799[_0x85fc('0x30')]+_0x264799['limit'],_0x2895a2;if(_0x20de09>=_0x510453){_0x20de09=_0x510453;_0x2895a2=0xc8;}else{_0x2895a2=0xce;}_0xc767c3['status'](_0x2895a2);return _0xc767c3[_0x85fc('0x31')]('Content-Range',_0x3145da+'-'+_0x20de09+'/'+_0x510453)[_0x85fc('0x2f')](_0x3d78f2);}return null;};}function patchUpdates(_0x3acec2){return function(_0x2b8112){try{jsonpatch['apply'](_0x2b8112,_0x3acec2,!![]);}catch(_0x160589){return BPromise['reject'](_0x160589);}return _0x2b8112[_0x85fc('0x32')]();};}function saveUpdates(_0x3218a9,_0x3da711){return function(_0xe4ffdd){if(_0xe4ffdd){return _0xe4ffdd['update'](_0x3218a9)[_0x85fc('0x22')](function(_0x2067e4){return _0x2067e4;});}return null;};}function removeEntity(_0x567f91,_0x5ca6d4){return function(_0x29fbc0){if(_0x29fbc0){return _0x29fbc0['destroy']()['then'](function(){_0x567f91[_0x85fc('0x2d')](0xcc)[_0x85fc('0x2e')]();});}};}function handleEntityNotFound(_0x110cb3,_0x133ab9){return function(_0x53f92f){if(!_0x53f92f){_0x110cb3['sendStatus'](0x194);}return _0x53f92f;};}function handleError(_0x2421ec,_0x49a999){_0x49a999=_0x49a999||0x1f4;return function(_0x13595c){logger[_0x85fc('0x28')](_0x13595c['stack']);if(_0x13595c[_0x85fc('0x33')]){delete _0x13595c[_0x85fc('0x33')];}_0x2421ec['status'](_0x49a999)['send'](_0x13595c);};}exports['index']=function(_0x166a86,_0x4730f8){var _0x82a466={},_0x737e52={},_0x3db99c={'count':0x0,'rows':[]};var _0x17bf6f=_['map'](db['DeskAccount'][_0x85fc('0x34')],function(_0x297c8d){return{'name':_0x297c8d['fieldName'],'type':_0x297c8d['type'][_0x85fc('0x35')]};});_0x737e52[_0x85fc('0x36')]=_[_0x85fc('0x37')](_0x17bf6f,_0x85fc('0x33'));_0x737e52[_0x85fc('0x38')]=_[_0x85fc('0x39')](_0x166a86['query']);_0x737e52[_0x85fc('0x3a')]=_[_0x85fc('0x3b')](_0x737e52[_0x85fc('0x36')],_0x737e52[_0x85fc('0x38')]);_0x82a466[_0x85fc('0x3c')]=_['intersection'](_0x737e52[_0x85fc('0x36')],qs[_0x85fc('0x3d')](_0x166a86[_0x85fc('0x38')][_0x85fc('0x3d')]));_0x82a466[_0x85fc('0x3c')]=_0x82a466['attributes'][_0x85fc('0x3e')]?_0x82a466['attributes']:_0x737e52[_0x85fc('0x36')];if(!_0x166a86[_0x85fc('0x38')][_0x85fc('0x3f')](_0x85fc('0x40'))){_0x82a466[_0x85fc('0x41')]=qs[_0x85fc('0x41')](_0x166a86[_0x85fc('0x38')]['limit']);_0x82a466['offset']=qs[_0x85fc('0x30')](_0x166a86[_0x85fc('0x38')][_0x85fc('0x30')]);}_0x82a466[_0x85fc('0x42')]=qs['sort'](_0x166a86[_0x85fc('0x38')][_0x85fc('0x43')]);_0x82a466['where']=qs[_0x85fc('0x3a')](_[_0x85fc('0x44')](_0x166a86[_0x85fc('0x38')],_0x737e52[_0x85fc('0x3a')]),_0x17bf6f);if(_0x166a86[_0x85fc('0x38')]['filter']){_0x82a466[_0x85fc('0x45')]=_[_0x85fc('0x46')](_0x82a466[_0x85fc('0x45')],{'$or':_[_0x85fc('0x37')](_0x17bf6f,function(_0x14ad00){if(_0x14ad00[_0x85fc('0x47')]!==_0x85fc('0x48')){var _0x55b94f={};_0x55b94f[_0x14ad00['name']]={'$like':'%'+_0x166a86[_0x85fc('0x38')][_0x85fc('0x49')]+'%'};return _0x55b94f;}})});}_0x82a466=_[_0x85fc('0x46')]({},_0x82a466,_0x166a86[_0x85fc('0x4a')]);var _0x2723dd={'where':_0x82a466[_0x85fc('0x45')]};return db[_0x85fc('0x4b')]['count'](_0x2723dd)[_0x85fc('0x22')](function(_0x20cd99){_0x3db99c[_0x85fc('0x4c')]=_0x20cd99;if(_0x166a86[_0x85fc('0x38')][_0x85fc('0x4d')]){_0x82a466[_0x85fc('0x4e')]=[{'all':!![]}];}return db[_0x85fc('0x4b')][_0x85fc('0x4f')](_0x82a466);})[_0x85fc('0x22')](function(_0xd68870){_0x3db99c[_0x85fc('0x50')]=_0xd68870;return _0x3db99c;})[_0x85fc('0x22')](respondWithFilteredResult(_0x4730f8,_0x82a466))['catch'](handleError(_0x4730f8,null));};exports['show']=function(_0x56d2c6,_0x27423a){var _0x193307={'raw':![],'where':{'id':_0x56d2c6[_0x85fc('0x51')]['id']}},_0x379f85={};_0x379f85[_0x85fc('0x36')]=_[_0x85fc('0x39')](db[_0x85fc('0x4b')]['rawAttributes']);_0x379f85[_0x85fc('0x38')]=_[_0x85fc('0x39')](_0x56d2c6[_0x85fc('0x38')]);_0x379f85[_0x85fc('0x3a')]=_['intersection'](_0x379f85[_0x85fc('0x36')],_0x379f85[_0x85fc('0x38')]);_0x193307['attributes']=_[_0x85fc('0x3b')](_0x379f85[_0x85fc('0x36')],qs[_0x85fc('0x3d')](_0x56d2c6[_0x85fc('0x38')][_0x85fc('0x3d')]));_0x193307[_0x85fc('0x3c')]=_0x193307['attributes'][_0x85fc('0x3e')]?_0x193307[_0x85fc('0x3c')]:_0x379f85[_0x85fc('0x36')];if(_0x56d2c6['query']['includeAll']){_0x193307['include']=[{'all':!![]}];}_0x193307=_[_0x85fc('0x46')]({},_0x193307,_0x56d2c6[_0x85fc('0x4a')]);return db[_0x85fc('0x4b')][_0x85fc('0x52')](_0x193307)['then'](handleEntityNotFound(_0x27423a,null))[_0x85fc('0x22')](respondWithResult(_0x27423a,null))[_0x85fc('0x53')](handleError(_0x27423a,null));};exports[_0x85fc('0x54')]=function(_0x2b2f45,_0x402426){return db['DeskAccount'][_0x85fc('0x54')](_0x2b2f45['body'],{})[_0x85fc('0x22')](respondWithResult(_0x402426,0xc9))['catch'](handleError(_0x402426,null));};exports['update']=function(_0x4dab9e,_0x3c553f){if(_0x4dab9e[_0x85fc('0x55')]['id']){delete _0x4dab9e[_0x85fc('0x55')]['id'];}return db['DeskAccount'][_0x85fc('0x52')]({'where':{'id':_0x4dab9e['params']['id']}})[_0x85fc('0x22')](handleEntityNotFound(_0x3c553f,null))['then'](saveUpdates(_0x4dab9e[_0x85fc('0x55')],null))['then'](respondWithResult(_0x3c553f,null))['catch'](handleError(_0x3c553f,null));};exports[_0x85fc('0x56')]=function(_0x2f9ab5,_0x14e868){return db[_0x85fc('0x4b')][_0x85fc('0x52')]({'where':{'id':_0x2f9ab5[_0x85fc('0x51')]['id']}})[_0x85fc('0x22')](handleEntityNotFound(_0x14e868,null))['then'](removeEntity(_0x14e868,null))[_0x85fc('0x53')](handleError(_0x14e868,null));};exports[_0x85fc('0x57')]=function(_0x21a741,_0x2e9663,_0x45737f){var _0x4c2ad3={};var _0x1ec88f={};var _0x41cd60;var _0x39d520;return db[_0x85fc('0x4b')][_0x85fc('0x58')]({'where':{'id':_0x21a741[_0x85fc('0x51')]['id']}})[_0x85fc('0x22')](handleEntityNotFound(_0x2e9663,null))[_0x85fc('0x22')](function(_0x5f11b5){if(_0x5f11b5){_0x41cd60=_0x5f11b5;_0x1ec88f[_0x85fc('0x36')]=_[_0x85fc('0x39')](db[_0x85fc('0x59')][_0x85fc('0x34')]);_0x1ec88f[_0x85fc('0x38')]=_[_0x85fc('0x39')](_0x21a741[_0x85fc('0x38')]);_0x1ec88f[_0x85fc('0x3a')]=_[_0x85fc('0x3b')](_0x1ec88f[_0x85fc('0x36')],_0x1ec88f[_0x85fc('0x38')]);_0x4c2ad3[_0x85fc('0x3c')]=_[_0x85fc('0x3b')](_0x1ec88f[_0x85fc('0x36')],qs['fields'](_0x21a741[_0x85fc('0x38')]['fields']));_0x4c2ad3['attributes']=_0x4c2ad3[_0x85fc('0x3c')][_0x85fc('0x3e')]?_0x4c2ad3[_0x85fc('0x3c')]:_0x1ec88f['model'];_0x4c2ad3[_0x85fc('0x42')]=qs[_0x85fc('0x43')](_0x21a741[_0x85fc('0x38')][_0x85fc('0x43')]);_0x4c2ad3['where']=qs[_0x85fc('0x3a')](_[_0x85fc('0x44')](_0x21a741[_0x85fc('0x38')],_0x1ec88f[_0x85fc('0x3a')]));if(_0x21a741[_0x85fc('0x38')][_0x85fc('0x49')]){_0x4c2ad3[_0x85fc('0x45')]=_[_0x85fc('0x46')](_0x4c2ad3[_0x85fc('0x45')],{'$or':_['map'](_0x4c2ad3[_0x85fc('0x3c')],function(_0x4eb882){var _0x3d414b={};_0x3d414b[_0x4eb882]={'$like':'%'+_0x21a741['query']['filter']+'%'};return _0x3d414b;})});}_0x4c2ad3=_[_0x85fc('0x46')]({},_0x4c2ad3,_0x21a741[_0x85fc('0x4a')]);return _0x41cd60[_0x85fc('0x57')](_0x4c2ad3);}})['then'](function(_0x5007c4){if(_0x5007c4){_0x39d520=_0x5007c4['length'];if(!_0x21a741[_0x85fc('0x38')][_0x85fc('0x3f')](_0x85fc('0x40'))){_0x4c2ad3[_0x85fc('0x41')]=qs[_0x85fc('0x41')](_0x21a741['query'][_0x85fc('0x41')]);_0x4c2ad3[_0x85fc('0x30')]=qs['offset'](_0x21a741[_0x85fc('0x38')][_0x85fc('0x30')]);}return _0x41cd60[_0x85fc('0x57')](_0x4c2ad3);}})[_0x85fc('0x22')](function(_0x1e40ae){if(_0x1e40ae){return _0x1e40ae?{'count':_0x39d520,'rows':_0x1e40ae}:null;}})[_0x85fc('0x22')](respondWithResult(_0x2e9663,null))[_0x85fc('0x53')](handleError(_0x2e9663,null));};exports[_0x85fc('0x5a')]=function(_0x37030c,_0x145af5,_0x306c94){if(_0x37030c['body']['id']){delete _0x37030c[_0x85fc('0x55')]['id'];}return db[_0x85fc('0x4b')][_0x85fc('0x58')]({'where':{'id':_0x37030c[_0x85fc('0x51')]['id']}})[_0x85fc('0x22')](handleEntityNotFound(_0x145af5,null))[_0x85fc('0x22')](function(_0x222a4f){if(_0x222a4f){_0x37030c[_0x85fc('0x55')][_0x85fc('0x5b')]=_0x222a4f['id'];_0x37030c['body'][_0x85fc('0x5c')]=integrations[_0x85fc('0x5d')](_0x37030c['body'][_0x85fc('0x5e')],_0x37030c['body'][_0x85fc('0x47')]);_0x37030c['body'][_0x85fc('0x5f')]=integrations[_0x85fc('0x60')](_0x37030c[_0x85fc('0x55')][_0x85fc('0x5e')],_0x37030c[_0x85fc('0x55')][_0x85fc('0x47')]);return db[_0x85fc('0x59')][_0x85fc('0x54')](_0x37030c[_0x85fc('0x55')],{'include':[{'model':db[_0x85fc('0x61')],'as':_0x85fc('0x5c')},{'model':db['DeskField'],'as':_0x85fc('0x5f')}]});}return null;})[_0x85fc('0x22')](respondWithResult(_0x145af5,null))[_0x85fc('0x53')](handleError(_0x145af5,null));};exports[_0x85fc('0x62')]=function(_0x39d8c1,_0x26e022,_0x200408){var _0x187686=[{'name':_0x85fc('0x63'),'label':_0x85fc('0x63'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x154b2e='';return db[_0x85fc('0x4b')][_0x85fc('0x58')]({'where':{'id':_0x39d8c1[_0x85fc('0x51')]['id']},'attributes':['id',_0x85fc('0x64'),_0x85fc('0x65'),'username',_0x85fc('0x66'),_0x85fc('0x67'),_0x85fc('0x68'),_0x85fc('0x69'),'tokenSecret']})[_0x85fc('0x22')](handleEntityNotFound(_0x26e022,null))[_0x85fc('0x22')](function(_0x216f3c){if(_0x216f3c){_0x154b2e=_0x216f3c[_0x85fc('0x64')];var _0x3de740=_0x154b2e[_0x85fc('0x6a')](-0x1);if(_0x3de740==='/'){_0x154b2e=_0x154b2e[_0x85fc('0x6b')](0x0,_0x154b2e[_0x85fc('0x6c')](_0x3de740));}var _0x57f0f0={'method':_0x85fc('0x6d'),'uri':util[_0x85fc('0x6e')]('%s/custom_fields',_0x154b2e),'headers':{'Content-Type':_0x85fc('0x6f'),'Accept':_0x85fc('0x6f')},'json':!![]};if(_0x216f3c['authType']===_0x85fc('0x70')){_0x57f0f0[_0x85fc('0x71')][_0x85fc('0x72')]=util['format'](_0x85fc('0x73'),new Buffer(util[_0x85fc('0x6e')]('%s:%s',_0x216f3c[_0x85fc('0x74')],_0x216f3c['password']))[_0x85fc('0x75')](_0x85fc('0x76')));}return rp(_0x57f0f0)['then'](function(_0x28b90c){return _0x187686[_0x85fc('0x77')](_[_0x85fc('0x37')](_0x28b90c[_0x85fc('0x78')][_0x85fc('0x79')],function(_0x2411c9){return{'id':_0x2411c9[_0x85fc('0x33')],'name':_0x2411c9['name'],'type':_0x2411c9['type'],'active':_0x2411c9['active'],'label':_0x2411c9[_0x85fc('0x7a')],'custom':!![]};}));});}})['then'](function(_0x55684c){return{'count':_0x55684c['length'],'rows':_0x55684c};})[_0x85fc('0x22')](respondWithResult(_0x26e022,null))[_0x85fc('0x53')](function(_0x764fc6){var _0x306c07=_0x39d8c1[_0x85fc('0x38')][_0x85fc('0x1e')]?0x1f4:_0x764fc6[_0x85fc('0x7b')]||0x1f4;logger[_0x85fc('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x85fc('0x62'),_0x306c07,JSON['stringify'](_0x764fc6));delete _0x764fc6[_0x85fc('0x33')];if(_0x306c07===0x191){_0x306c07=0x190;}_0x26e022[_0x85fc('0x2d')](_0x306c07)['send'](_0x39d8c1[_0x85fc('0x38')]['test']?{'message':_0x85fc('0x7c'),'statusCode':_0x764fc6['statusCode']}:_0x764fc6);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5cb198a..51adc59 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 _0xcf6c=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4145a8,_0x55e817){var _0x155db0=function(_0x30ad81){while(--_0x30ad81){_0x4145a8['push'](_0x4145a8['shift']());}};_0x155db0(++_0x55e817);}(_0xcf6c,0x133));var _0xccf6=function(_0x115cdc,_0x2533b9){_0x115cdc=_0x115cdc-0x0;var _0x43259f=_0xcf6c[_0x115cdc];return _0x43259f;};'use strict';var _=require(_0xccf6('0x0'));var util=require(_0xccf6('0x1'));var logger=require(_0xccf6('0x2'))(_0xccf6('0x3'));var moment=require(_0xccf6('0x4'));var BPromise=require(_0xccf6('0x5'));var rp=require(_0xccf6('0x6'));var fs=require('fs');var path=require(_0xccf6('0x7'));var rimraf=require(_0xccf6('0x8'));var config=require(_0xccf6('0x9'));var attributes=require(_0xccf6('0xa'));var integrations=require(_0xccf6('0xb'));module[_0xccf6('0xc')]=function(_0x55757c,_0x5e5959){return _0x55757c[_0xccf6('0xd')](_0xccf6('0xe'),attributes,{'tableName':_0xccf6('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe18c=['exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4911f1,_0xd974c8){var _0x113e48=function(_0x3bda54){while(--_0x3bda54){_0x4911f1['push'](_0x4911f1['shift']());}};_0x113e48(++_0xd974c8);}(_0xe18c,0x178));var _0xce18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe18c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xce18('0x0'));var util=require(_0xce18('0x1'));var logger=require('../../config/logger')(_0xce18('0x2'));var moment=require(_0xce18('0x3'));var BPromise=require('bluebird');var rp=require(_0xce18('0x4'));var fs=require('fs');var path=require(_0xce18('0x5'));var rimraf=require(_0xce18('0x6'));var config=require(_0xce18('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xce18('0x8')]=function(_0x444180,_0xb09964){return _0x444180[_0xce18('0x9')](_0xce18('0xa'),attributes,{'tableName':_0xce18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 08fd3b7..5132411 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 _0x4a42=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','include','model','attributes','map','debug','where','ShowDeskAccount','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a42,0xee));var _0x24a4=function(_0x474c14,_0x19bd72){_0x474c14=_0x474c14-0x0;var _0x154332=_0x4a42[_0x474c14];return _0x154332;};'use strict';var _=require(_0x24a4('0x0'));var util=require('util');var moment=require(_0x24a4('0x1'));var BPromise=require(_0x24a4('0x2'));var rs=require(_0x24a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x24a4('0x4'));var logger=require('../../config/logger')(_0x24a4('0x5'));var config=require(_0x24a4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x24a4('0x7')][_0x24a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28373d,_0x4728f1,_0x956c8a){return new BPromise(function(_0x43c0da,_0x5208cf){return client['request'](_0x28373d,_0x956c8a)[_0x24a4('0x9')](function(_0x187fa5){logger[_0x24a4('0xa')](_0x24a4('0xb'),_0x4728f1,_0x24a4('0xc'));logger['debug'](_0x24a4('0xd'),_0x4728f1,'request\x20sent',JSON[_0x24a4('0xe')](_0x187fa5));if(_0x187fa5[_0x24a4('0xf')]){if(_0x187fa5['error'][_0x24a4('0x10')]===0x1f4){logger[_0x24a4('0xf')](_0x24a4('0xb'),_0x4728f1,_0x187fa5[_0x24a4('0xf')][_0x24a4('0x11')]);return _0x5208cf(_0x187fa5[_0x24a4('0xf')][_0x24a4('0x11')]);}logger[_0x24a4('0xf')](_0x24a4('0xb'),_0x4728f1,_0x187fa5['error']['message']);return _0x43c0da(_0x187fa5[_0x24a4('0xf')][_0x24a4('0x11')]);}else{logger[_0x24a4('0xa')]('DeskAccount,\x20%s,\x20%s',_0x4728f1,_0x24a4('0xc'));_0x43c0da(_0x187fa5[_0x24a4('0x12')][_0x24a4('0x11')]);}})[_0x24a4('0x13')](function(_0x233233){logger['error'](_0x24a4('0xb'),_0x4728f1,_0x233233);_0x5208cf(_0x233233);});});}exports[_0x24a4('0x14')]=function(_0x2b938a){var _0x1a7905=this;return new Promise(function(_0x43ab9e,_0x3b4d8d){return db[_0x24a4('0x15')][_0x24a4('0x16')]({'raw':_0x2b938a[_0x24a4('0x17')]?_0x2b938a[_0x24a4('0x17')][_0x24a4('0x18')]===undefined?!![]:![]:!![],'where':_0x2b938a[_0x24a4('0x17')]?_0x2b938a[_0x24a4('0x17')]['where']||null:null,'attributes':_0x2b938a[_0x24a4('0x17')]?_0x2b938a['options']['attributes']||null:null,'limit':_0x2b938a[_0x24a4('0x17')]?_0x2b938a[_0x24a4('0x17')]['limit']||null:null,'include':_0x2b938a['options']?_0x2b938a[_0x24a4('0x17')][_0x24a4('0x19')]?_['map'](_0x2b938a['options'][_0x24a4('0x19')],function(_0x17fda6){return{'model':db[_0x17fda6[_0x24a4('0x1a')]],'as':_0x17fda6['as'],'attributes':_0x17fda6[_0x24a4('0x1b')],'include':_0x17fda6['include']?_['map'](_0x17fda6['include'],function(_0x4bd7be){return{'model':db[_0x4bd7be[_0x24a4('0x1a')]],'as':_0x4bd7be['as'],'attributes':_0x4bd7be[_0x24a4('0x1b')],'include':_0x4bd7be[_0x24a4('0x19')]?_[_0x24a4('0x1c')](_0x4bd7be[_0x24a4('0x19')],function(_0x3ea287){return{'model':db[_0x3ea287[_0x24a4('0x1a')]],'as':_0x3ea287['as'],'attributes':_0x3ea287[_0x24a4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x24a4('0x9')](function(_0xac876c){logger[_0x24a4('0xa')](_0x24a4('0x14'),_0x2b938a);logger[_0x24a4('0x1d')](_0x24a4('0x14'),_0x2b938a,JSON[_0x24a4('0xe')](_0xac876c));_0x43ab9e(_0xac876c);})[_0x24a4('0x13')](function(_0x16b0fd){logger[_0x24a4('0xf')](_0x24a4('0x14'),_0x16b0fd['message'],_0x2b938a);_0x3b4d8d(_0x1a7905['error'](0x1f4,_0x16b0fd['message']));});});};exports['ShowDeskAccount']=function(_0x33e29b){var _0x5390be=this;return new Promise(function(_0x36f99c,_0xce0364){return db[_0x24a4('0x15')]['find']({'raw':_0x33e29b[_0x24a4('0x17')]?_0x33e29b['options'][_0x24a4('0x18')]===undefined?!![]:![]:!![],'where':_0x33e29b[_0x24a4('0x17')]?_0x33e29b['options'][_0x24a4('0x1e')]||null:null,'attributes':_0x33e29b[_0x24a4('0x17')]?_0x33e29b[_0x24a4('0x17')][_0x24a4('0x1b')]||null:null,'include':_0x33e29b['options']?_0x33e29b['options'][_0x24a4('0x19')]?_['map'](_0x33e29b[_0x24a4('0x17')][_0x24a4('0x19')],function(_0x102a3b){return{'model':db[_0x102a3b[_0x24a4('0x1a')]],'as':_0x102a3b['as'],'attributes':_0x102a3b[_0x24a4('0x1b')],'include':_0x102a3b[_0x24a4('0x19')]?_[_0x24a4('0x1c')](_0x102a3b[_0x24a4('0x19')],function(_0x34abe0){return{'model':db[_0x34abe0[_0x24a4('0x1a')]],'as':_0x34abe0['as'],'attributes':_0x34abe0[_0x24a4('0x1b')],'include':_0x34abe0['include']?_[_0x24a4('0x1c')](_0x34abe0[_0x24a4('0x19')],function(_0x3ef830){return{'model':db[_0x3ef830[_0x24a4('0x1a')]],'as':_0x3ef830['as'],'attributes':_0x3ef830['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a4('0x9')](function(_0x36223c){logger[_0x24a4('0xa')](_0x24a4('0x1f'),_0x33e29b);logger[_0x24a4('0x1d')](_0x24a4('0x1f'),_0x33e29b,JSON[_0x24a4('0xe')](_0x36223c));_0x36f99c(_0x36223c);})[_0x24a4('0x13')](function(_0x4d23d0){logger[_0x24a4('0xf')](_0x24a4('0x1f'),_0x4d23d0['message'],_0x33e29b);_0xce0364(_0x5390be[_0x24a4('0xf')](0x1f4,_0x4d23d0['message']));});});}; \ No newline at end of file +var _0xaaca=['catch','ShowDeskAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','include','map','model'];(function(_0x2ca7d9,_0x240b45){var _0x37e067=function(_0x14f36d){while(--_0x14f36d){_0x2ca7d9['push'](_0x2ca7d9['shift']());}};_0x37e067(++_0x240b45);}(_0xaaca,0x158));var _0xaaac=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xaaca[_0x513545];return _0x18b7c5;};'use strict';var _=require(_0xaaac('0x0'));var util=require(_0xaaac('0x1'));var moment=require('moment');var BPromise=require(_0xaaac('0x2'));var rs=require(_0xaaac('0x3'));var fs=require('fs');var Redis=require(_0xaaac('0x4'));var db=require(_0xaaac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaaac('0x6'))('rpc');var config=require(_0xaaac('0x7'));var jayson=require(_0xaaac('0x8'));var client=jayson[_0xaaac('0x9')][_0xaaac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40be1f,_0xc3ebe,_0x2f2cf5){return new BPromise(function(_0x36dfa7,_0x33881f){return client['request'](_0x40be1f,_0x2f2cf5)[_0xaaac('0xb')](function(_0x48e4f1){logger[_0xaaac('0xc')](_0xaaac('0xd'),_0xc3ebe,_0xaaac('0xe'));logger[_0xaaac('0xf')](_0xaaac('0x10'),_0xc3ebe,'request\x20sent',JSON[_0xaaac('0x11')](_0x48e4f1));if(_0x48e4f1[_0xaaac('0x12')]){if(_0x48e4f1[_0xaaac('0x12')][_0xaaac('0x13')]===0x1f4){logger[_0xaaac('0x12')]('DeskAccount,\x20%s,\x20%s',_0xc3ebe,_0x48e4f1['error'][_0xaaac('0x14')]);return _0x33881f(_0x48e4f1[_0xaaac('0x12')][_0xaaac('0x14')]);}logger[_0xaaac('0x12')](_0xaaac('0xd'),_0xc3ebe,_0x48e4f1[_0xaaac('0x12')][_0xaaac('0x14')]);return _0x36dfa7(_0x48e4f1[_0xaaac('0x12')][_0xaaac('0x14')]);}else{logger[_0xaaac('0xc')](_0xaaac('0xd'),_0xc3ebe,'request\x20sent');_0x36dfa7(_0x48e4f1['result'][_0xaaac('0x14')]);}})['catch'](function(_0x20e374){logger[_0xaaac('0x12')](_0xaaac('0xd'),_0xc3ebe,_0x20e374);_0x33881f(_0x20e374);});});}exports[_0xaaac('0x15')]=function(_0x4e4668){var _0x85ca52=this;return new Promise(function(_0x186aa2,_0x42746d){return db[_0xaaac('0x16')][_0xaaac('0x17')]({'raw':_0x4e4668[_0xaaac('0x18')]?_0x4e4668[_0xaaac('0x18')][_0xaaac('0x19')]===undefined?!![]:![]:!![],'where':_0x4e4668[_0xaaac('0x18')]?_0x4e4668[_0xaaac('0x18')]['where']||null:null,'attributes':_0x4e4668[_0xaaac('0x18')]?_0x4e4668[_0xaaac('0x18')][_0xaaac('0x1a')]||null:null,'limit':_0x4e4668[_0xaaac('0x18')]?_0x4e4668[_0xaaac('0x18')]['limit']||null:null,'include':_0x4e4668[_0xaaac('0x18')]?_0x4e4668[_0xaaac('0x18')][_0xaaac('0x1b')]?_[_0xaaac('0x1c')](_0x4e4668[_0xaaac('0x18')]['include'],function(_0x3c92d7){return{'model':db[_0x3c92d7['model']],'as':_0x3c92d7['as'],'attributes':_0x3c92d7['attributes'],'include':_0x3c92d7[_0xaaac('0x1b')]?_[_0xaaac('0x1c')](_0x3c92d7[_0xaaac('0x1b')],function(_0x2b75eb){return{'model':db[_0x2b75eb[_0xaaac('0x1d')]],'as':_0x2b75eb['as'],'attributes':_0x2b75eb[_0xaaac('0x1a')],'include':_0x2b75eb['include']?_[_0xaaac('0x1c')](_0x2b75eb[_0xaaac('0x1b')],function(_0xc3c99a){return{'model':db[_0xc3c99a[_0xaaac('0x1d')]],'as':_0xc3c99a['as'],'attributes':_0xc3c99a['attributes']};}):[]};}):[]};}):[]:[]})[_0xaaac('0xb')](function(_0x17a85d){logger[_0xaaac('0xc')]('GetDeskAccount',_0x4e4668);logger['debug'](_0xaaac('0x15'),_0x4e4668,JSON[_0xaaac('0x11')](_0x17a85d));_0x186aa2(_0x17a85d);})[_0xaaac('0x1e')](function(_0x497277){logger[_0xaaac('0x12')](_0xaaac('0x15'),_0x497277[_0xaaac('0x14')],_0x4e4668);_0x42746d(_0x85ca52['error'](0x1f4,_0x497277[_0xaaac('0x14')]));});});};exports[_0xaaac('0x1f')]=function(_0x394f84){var _0x97890d=this;return new Promise(function(_0x29e184,_0x194bee){return db[_0xaaac('0x16')][_0xaaac('0x20')]({'raw':_0x394f84[_0xaaac('0x18')]?_0x394f84[_0xaaac('0x18')][_0xaaac('0x19')]===undefined?!![]:![]:!![],'where':_0x394f84[_0xaaac('0x18')]?_0x394f84[_0xaaac('0x18')][_0xaaac('0x21')]||null:null,'attributes':_0x394f84[_0xaaac('0x18')]?_0x394f84[_0xaaac('0x18')][_0xaaac('0x1a')]||null:null,'include':_0x394f84['options']?_0x394f84[_0xaaac('0x18')]['include']?_[_0xaaac('0x1c')](_0x394f84[_0xaaac('0x18')][_0xaaac('0x1b')],function(_0x49b93d){return{'model':db[_0x49b93d[_0xaaac('0x1d')]],'as':_0x49b93d['as'],'attributes':_0x49b93d[_0xaaac('0x1a')],'include':_0x49b93d['include']?_[_0xaaac('0x1c')](_0x49b93d[_0xaaac('0x1b')],function(_0x5c951a){return{'model':db[_0x5c951a['model']],'as':_0x5c951a['as'],'attributes':_0x5c951a[_0xaaac('0x1a')],'include':_0x5c951a[_0xaaac('0x1b')]?_[_0xaaac('0x1c')](_0x5c951a[_0xaaac('0x1b')],function(_0x475bd6){return{'model':db[_0x475bd6[_0xaaac('0x1d')]],'as':_0x475bd6['as'],'attributes':_0x475bd6[_0xaaac('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47f529){logger[_0xaaac('0xc')]('ShowDeskAccount',_0x394f84);logger[_0xaaac('0xf')](_0xaaac('0x1f'),_0x394f84,JSON['stringify'](_0x47f529));_0x29e184(_0x47f529);})[_0xaaac('0x1e')](function(_0x39aa7e){logger[_0xaaac('0x12')](_0xaaac('0x1f'),_0x39aa7e[_0xaaac('0x14')],_0x394f84);_0x194bee(_0x97890d[_0xaaac('0x12')](0x1f4,_0x39aa7e[_0xaaac('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7c7394a..db4843e 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 _0x0650=['post','put','update','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags'];(function(_0x1b38bd,_0x12713c){var _0x4d95b2=function(_0x2650f7){while(--_0x2650f7){_0x1b38bd['push'](_0x1b38bd['shift']());}};_0x4d95b2(++_0x12713c);}(_0x0650,0xed));var _0x0065=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x0650[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x4'));var config=require(_0x0065('0x5'));var controller=require(_0x0065('0x6'));router['get']('/',auth[_0x0065('0x7')](),controller['index']);router['get']('/:id',auth[_0x0065('0x7')](),controller[_0x0065('0x8')]);router[_0x0065('0x9')](_0x0065('0xa'),auth[_0x0065('0x7')](),controller[_0x0065('0xb')]);router[_0x0065('0x9')](_0x0065('0xc'),auth[_0x0065('0x7')](),controller['getSubjects']);router[_0x0065('0x9')](_0x0065('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x0065('0xe'),auth[_0x0065('0x7')](),controller['getTags']);router[_0x0065('0xf')]('/',auth[_0x0065('0x7')](),controller['create']);router[_0x0065('0xf')](_0x0065('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x0065('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0065('0x11')]);router['delete'](_0x0065('0x12'),auth['isAuthenticated'](),controller[_0x0065('0x13')]);module[_0x0065('0x14')]=router; \ No newline at end of file +var _0x8ed7=['/:id/descriptions','getTags','post','create','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8ed7,0x8b));var _0x78ed=function(_0x23960f,_0x4df89c){_0x23960f=_0x23960f-0x0;var _0x24d40b=_0x8ed7[_0x23960f];return _0x24d40b;};'use strict';var multer=require('multer');var util=require(_0x78ed('0x0'));var path=require(_0x78ed('0x1'));var timeout=require(_0x78ed('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x78ed('0x3'));var interaction=require(_0x78ed('0x4'));var config=require(_0x78ed('0x5'));var controller=require(_0x78ed('0x6'));router[_0x78ed('0x7')]('/',auth[_0x78ed('0x8')](),controller[_0x78ed('0x9')]);router[_0x78ed('0x7')](_0x78ed('0xa'),auth['isAuthenticated'](),controller[_0x78ed('0xb')]);router['get'](_0x78ed('0xc'),auth['isAuthenticated'](),controller[_0x78ed('0xd')]);router['get']('/:id/subjects',auth[_0x78ed('0x8')](),controller[_0x78ed('0xe')]);router['get'](_0x78ed('0xf'),auth[_0x78ed('0x8')](),controller['getDescriptions']);router[_0x78ed('0x7')]('/:id/tags',auth[_0x78ed('0x8')](),controller[_0x78ed('0x10')]);router[_0x78ed('0x11')]('/',auth[_0x78ed('0x8')](),controller[_0x78ed('0x12')]);router[_0x78ed('0x11')]('/:id/tags',auth[_0x78ed('0x8')](),controller['setTags']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x78ed('0x13')](_0x78ed('0xa'),auth[_0x78ed('0x8')](),controller[_0x78ed('0x14')]);module[_0x78ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a84c7a6..eac25a9 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 _0x8f45=['exports','STRING'];(function(_0x451967,_0x12ed31){var _0x3f23de=function(_0x12e0e8){while(--_0x12e0e8){_0x451967['push'](_0x451967['shift']());}};_0x3f23de(++_0x12ed31);}(_0x8f45,0xf4));var _0x58f4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8f45[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x58f4('0x0')]={'name':{'type':Sequelize[_0x58f4('0x1')]},'description':{'type':Sequelize[_0x58f4('0x1')]}}; \ No newline at end of file +var _0xded6=['exports','STRING','sequelize'];(function(_0x29db8a,_0x27424f){var _0x27ae25=function(_0x568a46){while(--_0x568a46){_0x29db8a['push'](_0x29db8a['shift']());}};_0x27ae25(++_0x27424f);}(_0xded6,0x1bb));var _0x6ded=function(_0x5a750a,_0x30d794){_0x5a750a=_0x5a750a-0x0;var _0x21335d=_0xded6[_0x5a750a];return _0x21335d;};'use strict';var Sequelize=require(_0x6ded('0x0'));module[_0x6ded('0x1')]={'name':{'type':Sequelize[_0x6ded('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3bef9c9..9abc7ea 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 _0x5640=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','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~!@#$%^&-_=+[{]}.','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','reject','save','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','params','DeskConfiguration','options','create','body','find','getFields','findOne','DeskField','limit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir'];(function(_0x2725a1,_0x2bb5b2){var _0x51c315=function(_0x356bc0){while(--_0x356bc0){_0x2725a1['push'](_0x2725a1['shift']());}};_0x51c315(++_0x2bb5b2);}(_0x5640,0x111));var _0x0564=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5640[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x0564('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0564('0x1'));var zipdir=require(_0x0564('0x2'));var jsonpatch=require(_0x0564('0x3'));var rp=require(_0x0564('0x4'));var moment=require(_0x0564('0x5'));var BPromise=require(_0x0564('0x6'));var Mustache=require(_0x0564('0x7'));var util=require(_0x0564('0x8'));var path=require(_0x0564('0x9'));var sox=require(_0x0564('0xa'));var csv=require(_0x0564('0xb'));var ejs=require(_0x0564('0xc'));var fs=require('fs');var _=require(_0x0564('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0564('0xe'));var deskjs=require(_0x0564('0xf'));var toCsv=require(_0x0564('0xb'));var querystring=require(_0x0564('0x10'));var Papa=require('papaparse');var Redis=require(_0x0564('0x11'));var authService=require(_0x0564('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0564('0x13'));var hardwareService=require(_0x0564('0x14'));var logger=require('../../config/logger')(_0x0564('0x15'));var utils=require(_0x0564('0x16'));var config=require(_0x0564('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0564('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x24b0c3,_0x2ccfcc,_0x46b095){if(_0x46b095){var _0x28a6fb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28a6fb[_0x0564('0x19')](_0x2ccfcc)){return _0x24b0c3;}else{throw new db[(_0x0564('0x1a'))][(_0x0564('0x1b'))](_0x0564('0x1c'));}}else{return _0x24b0c3;}}function respondWithRpcPromise(_0x40466a,_0x4e6c49,_0x456034,_0x9bec7d){return new BPromise(function(_0x3cc407,_0x1c119d){var _0x2e6990=_0x9bec7d||client;return _0x2e6990['request'](_0x40466a,_0x456034)['then'](function(_0x10f7e7){logger[_0x0564('0x1d')](_0x0564('0x1e'),_0x4e6c49,_0x0564('0x1f'));logger[_0x0564('0x20')](_0x0564('0x21'),_0x4e6c49,_0x0564('0x1f'),JSON['stringify'](_0x10f7e7));if(_0x10f7e7[_0x0564('0x22')]){if(_0x10f7e7[_0x0564('0x22')][_0x0564('0x23')]===0x1f4){logger[_0x0564('0x22')](_0x0564('0x1e'),_0x4e6c49,_0x10f7e7[_0x0564('0x22')][_0x0564('0x24')]);return _0x1c119d(_0x10f7e7[_0x0564('0x22')][_0x0564('0x24')]);}logger['error'](_0x0564('0x1e'),_0x4e6c49,_0x10f7e7[_0x0564('0x22')]['message']);return _0x3cc407(_0x10f7e7[_0x0564('0x22')][_0x0564('0x24')]);}else{logger[_0x0564('0x1d')](_0x0564('0x1e'),_0x4e6c49,'request\x20sent');_0x3cc407(_0x10f7e7[_0x0564('0x25')][_0x0564('0x24')]);}})[_0x0564('0x26')](function(_0x4b4121){logger[_0x0564('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x4e6c49,_0x4b4121);_0x1c119d(_0x4b4121);});});}function respondWithStatusCode(_0x4ed225,_0x3c5200){_0x3c5200=_0x3c5200||0xcc;return function(_0x5ef47b){if(_0x5ef47b){return _0x4ed225['sendStatus'](_0x3c5200);}return _0x4ed225[_0x0564('0x27')](_0x3c5200)[_0x0564('0x28')]();};}function respondWithResult(_0x23d59d,_0x3d4cbb){_0x3d4cbb=_0x3d4cbb||0xc8;return function(_0xce69bb){if(_0xce69bb){return _0x23d59d[_0x0564('0x27')](_0x3d4cbb)[_0x0564('0x29')](_0xce69bb);}};}function respondWithFilteredResult(_0x101b39,_0x27f70f){return function(_0x136ec8){if(_0x136ec8){var _0x2d2bef=_0x136ec8['count'],_0x4f2338=_0x27f70f['offset'],_0x1f0de9=_0x27f70f[_0x0564('0x2a')]+_0x27f70f['limit'],_0x2bd9c7;if(_0x1f0de9>=_0x2d2bef){_0x1f0de9=_0x2d2bef;_0x2bd9c7=0xc8;}else{_0x2bd9c7=0xce;}_0x101b39[_0x0564('0x27')](_0x2bd9c7);return _0x101b39['set']('Content-Range',_0x4f2338+'-'+_0x1f0de9+'/'+_0x2d2bef)[_0x0564('0x29')](_0x136ec8);}return null;};}function patchUpdates(_0x59536b){return function(_0x42e1a1){try{jsonpatch['apply'](_0x42e1a1,_0x59536b,!![]);}catch(_0x180dc6){return BPromise[_0x0564('0x2b')](_0x180dc6);}return _0x42e1a1[_0x0564('0x2c')]();};}function saveUpdates(_0xff4308,_0x4c6014){return function(_0x56bc5a){if(_0x56bc5a){return _0x56bc5a[_0x0564('0x2d')](_0xff4308)[_0x0564('0x2e')](function(_0x391bc8){return _0x391bc8;});}return null;};}function removeEntity(_0x4e8d81,_0x422507){return function(_0x384e06){if(_0x384e06){return _0x384e06[_0x0564('0x2f')]()[_0x0564('0x2e')](function(){_0x4e8d81[_0x0564('0x27')](0xcc)[_0x0564('0x28')]();});}};}function handleEntityNotFound(_0x10100a,_0x1d59c0){return function(_0x1385f1){if(!_0x1385f1){_0x10100a[_0x0564('0x30')](0x194);}return _0x1385f1;};}function handleError(_0x14aa05,_0x28da2c){_0x28da2c=_0x28da2c||0x1f4;return function(_0x406003){logger[_0x0564('0x22')](_0x406003[_0x0564('0x31')]);if(_0x406003[_0x0564('0x32')]){delete _0x406003[_0x0564('0x32')];}_0x14aa05[_0x0564('0x27')](_0x28da2c)['send'](_0x406003);};}exports['index']=function(_0x29efd5,_0x4eb13e){var _0x32e3e5={},_0xedb71f={},_0x277dea={'count':0x0,'rows':[]};var _0x17973a=_[_0x0564('0x33')](db['DeskConfiguration'][_0x0564('0x34')],function(_0x394ed5){return{'name':_0x394ed5[_0x0564('0x35')],'type':_0x394ed5[_0x0564('0x36')]['key']};});_0xedb71f['model']=_['map'](_0x17973a,'name');_0xedb71f['query']=_[_0x0564('0x37')](_0x29efd5[_0x0564('0x38')]);_0xedb71f[_0x0564('0x39')]=_[_0x0564('0x3a')](_0xedb71f[_0x0564('0x3b')],_0xedb71f['query']);_0x32e3e5[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0xedb71f[_0x0564('0x3b')],qs[_0x0564('0x3d')](_0x29efd5['query'][_0x0564('0x3d')]));_0x32e3e5[_0x0564('0x3c')]=_0x32e3e5[_0x0564('0x3c')][_0x0564('0x3e')]?_0x32e3e5['attributes']:_0xedb71f[_0x0564('0x3b')];if(!_0x29efd5[_0x0564('0x38')][_0x0564('0x3f')](_0x0564('0x40'))){_0x32e3e5['limit']=qs['limit'](_0x29efd5[_0x0564('0x38')]['limit']);_0x32e3e5[_0x0564('0x2a')]=qs['offset'](_0x29efd5[_0x0564('0x38')][_0x0564('0x2a')]);}_0x32e3e5[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x29efd5['query'][_0x0564('0x42')]);_0x32e3e5[_0x0564('0x43')]=qs[_0x0564('0x39')](_['pick'](_0x29efd5[_0x0564('0x38')],_0xedb71f[_0x0564('0x39')]),_0x17973a);if(_0x29efd5[_0x0564('0x38')][_0x0564('0x44')]){_0x32e3e5['where']=_[_0x0564('0x45')](_0x32e3e5[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x17973a,function(_0x312112){if(_0x312112[_0x0564('0x36')]!==_0x0564('0x46')){var _0x50013d={};_0x50013d[_0x312112[_0x0564('0x32')]]={'$like':'%'+_0x29efd5[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0x50013d;}})});}_0x32e3e5=_[_0x0564('0x45')]({},_0x32e3e5,_0x29efd5['options']);var _0x1807b1={'where':_0x32e3e5[_0x0564('0x43')]};return db['DeskConfiguration']['count'](_0x1807b1)[_0x0564('0x2e')](function(_0x52c79b){_0x277dea[_0x0564('0x47')]=_0x52c79b;if(_0x29efd5['query']['includeAll']){_0x32e3e5[_0x0564('0x48')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x0564('0x49')](_0x32e3e5);})[_0x0564('0x2e')](function(_0x5c2aaf){_0x277dea[_0x0564('0x4a')]=_0x5c2aaf;return _0x277dea;})['then'](respondWithFilteredResult(_0x4eb13e,_0x32e3e5))['catch'](handleError(_0x4eb13e,null));};exports['show']=function(_0x114c79,_0x1ef863){var _0x4adcb6={'raw':![],'where':{'id':_0x114c79[_0x0564('0x4b')]['id']}},_0x3c5db0={};_0x3c5db0[_0x0564('0x3b')]=_[_0x0564('0x37')](db[_0x0564('0x4c')]['rawAttributes']);_0x3c5db0['query']=_[_0x0564('0x37')](_0x114c79[_0x0564('0x38')]);_0x3c5db0[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x3c5db0[_0x0564('0x3b')],_0x3c5db0[_0x0564('0x38')]);_0x4adcb6[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0x3c5db0[_0x0564('0x3b')],qs['fields'](_0x114c79[_0x0564('0x38')]['fields']));_0x4adcb6[_0x0564('0x3c')]=_0x4adcb6[_0x0564('0x3c')][_0x0564('0x3e')]?_0x4adcb6['attributes']:_0x3c5db0[_0x0564('0x3b')];if(_0x114c79[_0x0564('0x38')]['includeAll']){_0x4adcb6[_0x0564('0x48')]=[{'all':!![]}];}_0x4adcb6=_[_0x0564('0x45')]({},_0x4adcb6,_0x114c79[_0x0564('0x4d')]);return db[_0x0564('0x4c')]['find'](_0x4adcb6)[_0x0564('0x2e')](handleEntityNotFound(_0x1ef863,null))[_0x0564('0x2e')](respondWithResult(_0x1ef863,null))[_0x0564('0x26')](handleError(_0x1ef863,null));};exports[_0x0564('0x4e')]=function(_0x3d1f90,_0x55c381){return db['DeskConfiguration'][_0x0564('0x4e')](_0x3d1f90[_0x0564('0x4f')],{})['then'](respondWithResult(_0x55c381,0xc9))[_0x0564('0x26')](handleError(_0x55c381,null));};exports[_0x0564('0x2d')]=function(_0x4adb77,_0x2df9f8){if(_0x4adb77[_0x0564('0x4f')]['id']){delete _0x4adb77[_0x0564('0x4f')]['id'];}return db[_0x0564('0x4c')][_0x0564('0x50')]({'where':{'id':_0x4adb77[_0x0564('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2df9f8,null))[_0x0564('0x2e')](saveUpdates(_0x4adb77[_0x0564('0x4f')],null))[_0x0564('0x2e')](respondWithResult(_0x2df9f8,null))[_0x0564('0x26')](handleError(_0x2df9f8,null));};exports[_0x0564('0x2f')]=function(_0x1a14e5,_0x16241f){return db['DeskConfiguration'][_0x0564('0x50')]({'where':{'id':_0x1a14e5[_0x0564('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16241f,null))[_0x0564('0x2e')](removeEntity(_0x16241f,null))[_0x0564('0x26')](handleError(_0x16241f,null));};exports[_0x0564('0x51')]=function(_0x14f49e,_0x565924,_0x498cfc){var _0x51898c={};var _0x1b521={};var _0x463f31;var _0x51ed1a;return db['DeskConfiguration'][_0x0564('0x52')]({'where':{'id':_0x14f49e['params']['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0x565924,null))['then'](function(_0x43ee2a){if(_0x43ee2a){_0x463f31=_0x43ee2a;_0x1b521[_0x0564('0x3b')]=_[_0x0564('0x37')](db[_0x0564('0x53')][_0x0564('0x34')]);_0x1b521[_0x0564('0x38')]=_[_0x0564('0x37')](_0x14f49e[_0x0564('0x38')]);_0x1b521[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x1b521[_0x0564('0x3b')],_0x1b521[_0x0564('0x38')]);_0x51898c[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0x1b521[_0x0564('0x3b')],qs[_0x0564('0x3d')](_0x14f49e['query']['fields']));_0x51898c['attributes']=_0x51898c[_0x0564('0x3c')][_0x0564('0x3e')]?_0x51898c[_0x0564('0x3c')]:_0x1b521['model'];_0x51898c[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x14f49e[_0x0564('0x38')][_0x0564('0x42')]);_0x51898c[_0x0564('0x43')]=qs[_0x0564('0x39')](_['pick'](_0x14f49e[_0x0564('0x38')],_0x1b521['filters']));if(_0x14f49e[_0x0564('0x38')][_0x0564('0x44')]){_0x51898c[_0x0564('0x43')]=_[_0x0564('0x45')](_0x51898c[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x51898c['attributes'],function(_0x28a8fa){var _0x2e9cae={};_0x2e9cae[_0x28a8fa]={'$like':'%'+_0x14f49e[_0x0564('0x38')]['filter']+'%'};return _0x2e9cae;})});}_0x51898c=_['merge']({},_0x51898c,_0x14f49e[_0x0564('0x4d')]);return _0x463f31[_0x0564('0x51')](_0x51898c);}})[_0x0564('0x2e')](function(_0x38fb96){if(_0x38fb96){_0x51ed1a=_0x38fb96[_0x0564('0x3e')];if(!_0x14f49e[_0x0564('0x38')]['hasOwnProperty'](_0x0564('0x40'))){_0x51898c[_0x0564('0x54')]=qs['limit'](_0x14f49e['query'][_0x0564('0x54')]);_0x51898c['offset']=qs[_0x0564('0x2a')](_0x14f49e[_0x0564('0x38')][_0x0564('0x2a')]);}return _0x463f31['getFields'](_0x51898c);}})[_0x0564('0x2e')](function(_0x58d8a3){if(_0x58d8a3){return _0x58d8a3?{'count':_0x51ed1a,'rows':_0x58d8a3}:null;}})['then'](respondWithResult(_0x565924,null))[_0x0564('0x26')](handleError(_0x565924,null));};exports[_0x0564('0x55')]=function(_0x1d18f0,_0x5ee165,_0x5a81aa){var _0x326a81={};var _0x168b93={};var _0x1efe4b;var _0x21a88f;return db['DeskConfiguration'][_0x0564('0x52')]({'where':{'id':_0x1d18f0[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0x5ee165,null))['then'](function(_0x224eac){if(_0x224eac){_0x1efe4b=_0x224eac;_0x168b93['model']=_[_0x0564('0x37')](db[_0x0564('0x53')][_0x0564('0x34')]);_0x168b93[_0x0564('0x38')]=_['keys'](_0x1d18f0['query']);_0x168b93[_0x0564('0x39')]=_['intersection'](_0x168b93[_0x0564('0x3b')],_0x168b93[_0x0564('0x38')]);_0x326a81[_0x0564('0x3c')]=_['intersection'](_0x168b93[_0x0564('0x3b')],qs[_0x0564('0x3d')](_0x1d18f0['query'][_0x0564('0x3d')]));_0x326a81[_0x0564('0x3c')]=_0x326a81['attributes'][_0x0564('0x3e')]?_0x326a81[_0x0564('0x3c')]:_0x168b93[_0x0564('0x3b')];_0x326a81[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x1d18f0[_0x0564('0x38')]['sort']);_0x326a81[_0x0564('0x43')]=qs['filters'](_[_0x0564('0x56')](_0x1d18f0[_0x0564('0x38')],_0x168b93['filters']));if(_0x1d18f0[_0x0564('0x38')]['filter']){_0x326a81['where']=_['merge'](_0x326a81[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x326a81[_0x0564('0x3c')],function(_0xe4de89){var _0x3858cb={};_0x3858cb[_0xe4de89]={'$like':'%'+_0x1d18f0[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0x3858cb;})});}_0x326a81=_[_0x0564('0x45')]({},_0x326a81,_0x1d18f0[_0x0564('0x4d')]);return _0x1efe4b[_0x0564('0x55')](_0x326a81);}})[_0x0564('0x2e')](function(_0x46c6b9){if(_0x46c6b9){_0x21a88f=_0x46c6b9[_0x0564('0x3e')];if(!_0x1d18f0[_0x0564('0x38')][_0x0564('0x3f')](_0x0564('0x40'))){_0x326a81[_0x0564('0x54')]=qs[_0x0564('0x54')](_0x1d18f0[_0x0564('0x38')][_0x0564('0x54')]);_0x326a81['offset']=qs[_0x0564('0x2a')](_0x1d18f0[_0x0564('0x38')][_0x0564('0x2a')]);}return _0x1efe4b[_0x0564('0x55')](_0x326a81);}})['then'](function(_0x18a110){if(_0x18a110){return _0x18a110?{'count':_0x21a88f,'rows':_0x18a110}:null;}})[_0x0564('0x2e')](respondWithResult(_0x5ee165,null))[_0x0564('0x26')](handleError(_0x5ee165,null));};exports[_0x0564('0x57')]=function(_0x143cd7,_0xfade98,_0x54750b){var _0x1c6bc2={};var _0x10ec07={};var _0x386499;var _0x27c3b0;return db[_0x0564('0x4c')][_0x0564('0x52')]({'where':{'id':_0x143cd7[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0xfade98,null))[_0x0564('0x2e')](function(_0xed307b){if(_0xed307b){_0x386499=_0xed307b;_0x10ec07[_0x0564('0x3b')]=_[_0x0564('0x37')](db[_0x0564('0x53')][_0x0564('0x34')]);_0x10ec07[_0x0564('0x38')]=_[_0x0564('0x37')](_0x143cd7['query']);_0x10ec07[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x10ec07['model'],_0x10ec07[_0x0564('0x38')]);_0x1c6bc2[_0x0564('0x3c')]=_['intersection'](_0x10ec07['model'],qs[_0x0564('0x3d')](_0x143cd7['query'][_0x0564('0x3d')]));_0x1c6bc2[_0x0564('0x3c')]=_0x1c6bc2['attributes'][_0x0564('0x3e')]?_0x1c6bc2[_0x0564('0x3c')]:_0x10ec07[_0x0564('0x3b')];_0x1c6bc2[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x143cd7[_0x0564('0x38')][_0x0564('0x42')]);_0x1c6bc2[_0x0564('0x43')]=qs[_0x0564('0x39')](_[_0x0564('0x56')](_0x143cd7[_0x0564('0x38')],_0x10ec07[_0x0564('0x39')]));if(_0x143cd7[_0x0564('0x38')][_0x0564('0x44')]){_0x1c6bc2[_0x0564('0x43')]=_[_0x0564('0x45')](_0x1c6bc2[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x1c6bc2[_0x0564('0x3c')],function(_0x1ed899){var _0xae65e9={};_0xae65e9[_0x1ed899]={'$like':'%'+_0x143cd7[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0xae65e9;})});}_0x1c6bc2=_[_0x0564('0x45')]({},_0x1c6bc2,_0x143cd7[_0x0564('0x4d')]);return _0x386499[_0x0564('0x57')](_0x1c6bc2);}})[_0x0564('0x2e')](function(_0x3b6bbe){if(_0x3b6bbe){_0x27c3b0=_0x3b6bbe[_0x0564('0x3e')];if(!_0x143cd7[_0x0564('0x38')][_0x0564('0x3f')](_0x0564('0x40'))){_0x1c6bc2['limit']=qs[_0x0564('0x54')](_0x143cd7[_0x0564('0x38')][_0x0564('0x54')]);_0x1c6bc2[_0x0564('0x2a')]=qs[_0x0564('0x2a')](_0x143cd7[_0x0564('0x38')]['offset']);}return _0x386499[_0x0564('0x57')](_0x1c6bc2);}})[_0x0564('0x2e')](function(_0x1b1939){if(_0x1b1939){return _0x1b1939?{'count':_0x27c3b0,'rows':_0x1b1939}:null;}})[_0x0564('0x2e')](respondWithResult(_0xfade98,null))[_0x0564('0x26')](handleError(_0xfade98,null));};exports[_0x0564('0x58')]=function(_0x180432,_0xe4c039,_0x33e8fb){var _0x34b437={};var _0x200836={};var _0x1a588f;var _0x32c2a9;return db['DeskConfiguration']['findOne']({'where':{'id':_0x180432[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0xe4c039,null))[_0x0564('0x2e')](function(_0x46842b){if(_0x46842b){_0x1a588f=_0x46842b;_0x200836[_0x0564('0x3b')]=_['keys'](db[_0x0564('0x59')][_0x0564('0x34')]);_0x200836[_0x0564('0x38')]=_[_0x0564('0x37')](_0x180432[_0x0564('0x38')]);_0x200836[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x200836[_0x0564('0x3b')],_0x200836['query']);_0x34b437[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0x200836[_0x0564('0x3b')],qs['fields'](_0x180432[_0x0564('0x38')][_0x0564('0x3d')]));_0x34b437[_0x0564('0x3c')]=_0x34b437[_0x0564('0x3c')]['length']?_0x34b437[_0x0564('0x3c')]:_0x200836[_0x0564('0x3b')];_0x34b437[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x180432[_0x0564('0x38')][_0x0564('0x42')]);_0x34b437[_0x0564('0x43')]=qs[_0x0564('0x39')](_[_0x0564('0x56')](_0x180432[_0x0564('0x38')],_0x200836[_0x0564('0x39')]));if(_0x180432[_0x0564('0x38')][_0x0564('0x44')]){_0x34b437[_0x0564('0x43')]=_[_0x0564('0x45')](_0x34b437[_0x0564('0x43')],{'$or':_['map'](_0x34b437[_0x0564('0x3c')],function(_0x122799){var _0x5f2356={};_0x5f2356[_0x122799]={'$like':'%'+_0x180432[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0x5f2356;})});}_0x34b437=_[_0x0564('0x45')]({},_0x34b437,_0x180432['options']);return _0x1a588f[_0x0564('0x58')](_0x34b437);}})[_0x0564('0x2e')](function(_0x3d2b15){if(_0x3d2b15){_0x32c2a9=_0x3d2b15[_0x0564('0x3e')];if(!_0x180432[_0x0564('0x38')][_0x0564('0x3f')]('nolimit')){_0x34b437['limit']=qs[_0x0564('0x54')](_0x180432[_0x0564('0x38')][_0x0564('0x54')]);_0x34b437[_0x0564('0x2a')]=qs[_0x0564('0x2a')](_0x180432[_0x0564('0x38')][_0x0564('0x2a')]);}return _0x1a588f['getTags'](_0x34b437);}})['then'](function(_0x4b22e9){if(_0x4b22e9){return _0x4b22e9?{'count':_0x32c2a9,'rows':_0x4b22e9}:null;}})['then'](respondWithResult(_0xe4c039,null))[_0x0564('0x26')](handleError(_0xe4c039,null));};exports[_0x0564('0x5a')]=function(_0x5c0def,_0x5c436b,_0x2c316a){if(_0x5c0def[_0x0564('0x4f')]['id']){delete _0x5c0def[_0x0564('0x4f')]['id'];}return db[_0x0564('0x4c')]['findOne']({'where':{'id':_0x5c0def[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0x5c436b,null))[_0x0564('0x2e')](function(_0x15d436){if(_0x15d436){return _0x15d436[_0x0564('0x5a')](_0x5c0def[_0x0564('0x4f')][_0x0564('0x5b')]||[]);}return null;})[_0x0564('0x2e')](respondWithResult(_0x5c436b,null))[_0x0564('0x26')](handleError(_0x5c436b,null));}; \ No newline at end of file +var _0x2fed=['VIRTUAL','merge','options','DeskConfiguration','includeAll','include','rows','catch','show','params','length','find','create','body','getFields','findOne','DeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','count','offset','limit','set','json','apply','reject','save','update','destroy','end','sendStatus','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','sort','filters','pick','filter','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fed,0x7c));var _0xd2fe=function(_0x55357e,_0x10226d){_0x55357e=_0x55357e-0x0;var _0x232aae=_0x2fed[_0x55357e];return _0x232aae;};'use strict';var pdf=require(_0xd2fe('0x0'));var emlformat=require(_0xd2fe('0x1'));var rimraf=require(_0xd2fe('0x2'));var zipdir=require(_0xd2fe('0x3'));var jsonpatch=require(_0xd2fe('0x4'));var rp=require('request-promise');var moment=require(_0xd2fe('0x5'));var BPromise=require(_0xd2fe('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd2fe('0x7'));var sox=require(_0xd2fe('0x8'));var csv=require(_0xd2fe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd2fe('0xa'));var squel=require(_0xd2fe('0xb'));var crypto=require(_0xd2fe('0xc'));var jsforce=require(_0xd2fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2fe('0x9'));var querystring=require(_0xd2fe('0xe'));var Papa=require(_0xd2fe('0xf'));var Redis=require(_0xd2fe('0x10'));var authService=require(_0xd2fe('0x11'));var qs=require(_0xd2fe('0x12'));var as=require(_0xd2fe('0x13'));var hardwareService=require(_0xd2fe('0x14'));var logger=require(_0xd2fe('0x15'))(_0xd2fe('0x16'));var utils=require(_0xd2fe('0x17'));var config=require(_0xd2fe('0x18'));var db=require(_0xd2fe('0x19'))['db'];var jayson=require(_0xd2fe('0x1a'));var client=jayson[_0xd2fe('0x1b')][_0xd2fe('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x22e414,_0x1e2b2a,_0x5eb0cb){if(_0x5eb0cb){var _0x1c2401=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c2401[_0xd2fe('0x1d')](_0x1e2b2a)){return _0x22e414;}else{throw new db[(_0xd2fe('0x1e'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x22e414;}}function respondWithRpcPromise(_0x4ab9d2,_0x203bea,_0x54f4cc,_0x458f87){return new BPromise(function(_0x3085b4,_0x3d9bf9){var _0x3ea4e1=_0x458f87||client;return _0x3ea4e1[_0xd2fe('0x1f')](_0x4ab9d2,_0x54f4cc)[_0xd2fe('0x20')](function(_0x588d03){logger['info'](_0xd2fe('0x21'),_0x203bea,_0xd2fe('0x22'));logger['debug'](_0xd2fe('0x23'),_0x203bea,_0xd2fe('0x22'),JSON[_0xd2fe('0x24')](_0x588d03));if(_0x588d03[_0xd2fe('0x25')]){if(_0x588d03[_0xd2fe('0x25')][_0xd2fe('0x26')]===0x1f4){logger[_0xd2fe('0x25')](_0xd2fe('0x21'),_0x203bea,_0x588d03[_0xd2fe('0x25')][_0xd2fe('0x27')]);return _0x3d9bf9(_0x588d03['error'][_0xd2fe('0x27')]);}logger['error'](_0xd2fe('0x21'),_0x203bea,_0x588d03[_0xd2fe('0x25')][_0xd2fe('0x27')]);return _0x3085b4(_0x588d03[_0xd2fe('0x25')]['message']);}else{logger[_0xd2fe('0x28')]('DeskConfiguration,\x20%s,\x20%s',_0x203bea,_0xd2fe('0x22'));_0x3085b4(_0x588d03[_0xd2fe('0x29')][_0xd2fe('0x27')]);}})['catch'](function(_0x5a5f1b){logger[_0xd2fe('0x25')](_0xd2fe('0x21'),_0x203bea,_0x5a5f1b);_0x3d9bf9(_0x5a5f1b);});});}function respondWithStatusCode(_0x236294,_0x28bef3){_0x28bef3=_0x28bef3||0xcc;return function(_0x202531){if(_0x202531){return _0x236294['sendStatus'](_0x28bef3);}return _0x236294['status'](_0x28bef3)['end']();};}function respondWithResult(_0x39e20a,_0x1ba638){_0x1ba638=_0x1ba638||0xc8;return function(_0x28580a){if(_0x28580a){return _0x39e20a[_0xd2fe('0x2a')](_0x1ba638)['json'](_0x28580a);}};}function respondWithFilteredResult(_0x23682c,_0x39c71c){return function(_0x293364){if(_0x293364){var _0x6bba0d=_0x293364[_0xd2fe('0x2b')],_0x49ab21=_0x39c71c['offset'],_0x391e93=_0x39c71c[_0xd2fe('0x2c')]+_0x39c71c[_0xd2fe('0x2d')],_0x327730;if(_0x391e93>=_0x6bba0d){_0x391e93=_0x6bba0d;_0x327730=0xc8;}else{_0x327730=0xce;}_0x23682c[_0xd2fe('0x2a')](_0x327730);return _0x23682c[_0xd2fe('0x2e')]('Content-Range',_0x49ab21+'-'+_0x391e93+'/'+_0x6bba0d)[_0xd2fe('0x2f')](_0x293364);}return null;};}function patchUpdates(_0x328089){return function(_0x11bea2){try{jsonpatch[_0xd2fe('0x30')](_0x11bea2,_0x328089,!![]);}catch(_0x4d2f8b){return BPromise[_0xd2fe('0x31')](_0x4d2f8b);}return _0x11bea2[_0xd2fe('0x32')]();};}function saveUpdates(_0x1b4812,_0x425d1f){return function(_0x42c7b2){if(_0x42c7b2){return _0x42c7b2[_0xd2fe('0x33')](_0x1b4812)['then'](function(_0x4436e7){return _0x4436e7;});}return null;};}function removeEntity(_0x355679,_0x56d8d7){return function(_0x448416){if(_0x448416){return _0x448416[_0xd2fe('0x34')]()[_0xd2fe('0x20')](function(){_0x355679['status'](0xcc)[_0xd2fe('0x35')]();});}};}function handleEntityNotFound(_0x13f01a,_0x53409a){return function(_0x1cb22a){if(!_0x1cb22a){_0x13f01a[_0xd2fe('0x36')](0x194);}return _0x1cb22a;};}function handleError(_0xca7bf9,_0x426bd6){_0x426bd6=_0x426bd6||0x1f4;return function(_0x351ab3){logger[_0xd2fe('0x25')](_0x351ab3['stack']);if(_0x351ab3['name']){delete _0x351ab3[_0xd2fe('0x37')];}_0xca7bf9['status'](_0x426bd6)['send'](_0x351ab3);};}exports[_0xd2fe('0x38')]=function(_0x6cc70e,_0xfaf600){var _0x101ba2={},_0x32278d={},_0x4e0b4d={'count':0x0,'rows':[]};var _0x3daff0=_['map'](db['DeskConfiguration'][_0xd2fe('0x39')],function(_0x325ef7){return{'name':_0x325ef7[_0xd2fe('0x3a')],'type':_0x325ef7[_0xd2fe('0x3b')][_0xd2fe('0x3c')]};});_0x32278d[_0xd2fe('0x3d')]=_[_0xd2fe('0x3e')](_0x3daff0,'name');_0x32278d[_0xd2fe('0x3f')]=_[_0xd2fe('0x40')](_0x6cc70e[_0xd2fe('0x3f')]);_0x32278d['filters']=_['intersection'](_0x32278d[_0xd2fe('0x3d')],_0x32278d[_0xd2fe('0x3f')]);_0x101ba2[_0xd2fe('0x41')]=_[_0xd2fe('0x42')](_0x32278d[_0xd2fe('0x3d')],qs[_0xd2fe('0x43')](_0x6cc70e[_0xd2fe('0x3f')]['fields']));_0x101ba2[_0xd2fe('0x41')]=_0x101ba2[_0xd2fe('0x41')]['length']?_0x101ba2[_0xd2fe('0x41')]:_0x32278d[_0xd2fe('0x3d')];if(!_0x6cc70e[_0xd2fe('0x3f')][_0xd2fe('0x44')]('nolimit')){_0x101ba2[_0xd2fe('0x2d')]=qs[_0xd2fe('0x2d')](_0x6cc70e[_0xd2fe('0x3f')][_0xd2fe('0x2d')]);_0x101ba2['offset']=qs[_0xd2fe('0x2c')](_0x6cc70e[_0xd2fe('0x3f')][_0xd2fe('0x2c')]);}_0x101ba2['order']=qs[_0xd2fe('0x45')](_0x6cc70e[_0xd2fe('0x3f')][_0xd2fe('0x45')]);_0x101ba2['where']=qs[_0xd2fe('0x46')](_[_0xd2fe('0x47')](_0x6cc70e['query'],_0x32278d['filters']),_0x3daff0);if(_0x6cc70e['query'][_0xd2fe('0x48')]){_0x101ba2[_0xd2fe('0x49')]=_['merge'](_0x101ba2[_0xd2fe('0x49')],{'$or':_[_0xd2fe('0x3e')](_0x3daff0,function(_0x17589d){if(_0x17589d['type']!==_0xd2fe('0x4a')){var _0x3b0f93={};_0x3b0f93[_0x17589d[_0xd2fe('0x37')]]={'$like':'%'+_0x6cc70e[_0xd2fe('0x3f')][_0xd2fe('0x48')]+'%'};return _0x3b0f93;}})});}_0x101ba2=_[_0xd2fe('0x4b')]({},_0x101ba2,_0x6cc70e[_0xd2fe('0x4c')]);var _0x4fe5cb={'where':_0x101ba2[_0xd2fe('0x49')]};return db[_0xd2fe('0x4d')][_0xd2fe('0x2b')](_0x4fe5cb)[_0xd2fe('0x20')](function(_0x15e1fb){_0x4e0b4d['count']=_0x15e1fb;if(_0x6cc70e['query'][_0xd2fe('0x4e')]){_0x101ba2[_0xd2fe('0x4f')]=[{'all':!![]}];}return db[_0xd2fe('0x4d')]['findAll'](_0x101ba2);})['then'](function(_0xc09227){_0x4e0b4d[_0xd2fe('0x50')]=_0xc09227;return _0x4e0b4d;})[_0xd2fe('0x20')](respondWithFilteredResult(_0xfaf600,_0x101ba2))[_0xd2fe('0x51')](handleError(_0xfaf600,null));};exports[_0xd2fe('0x52')]=function(_0x44e45d,_0x377e88){var _0x13ec7d={'raw':![],'where':{'id':_0x44e45d[_0xd2fe('0x53')]['id']}},_0x465490={};_0x465490[_0xd2fe('0x3d')]=_['keys'](db[_0xd2fe('0x4d')][_0xd2fe('0x39')]);_0x465490[_0xd2fe('0x3f')]=_['keys'](_0x44e45d[_0xd2fe('0x3f')]);_0x465490['filters']=_['intersection'](_0x465490[_0xd2fe('0x3d')],_0x465490['query']);_0x13ec7d[_0xd2fe('0x41')]=_['intersection'](_0x465490[_0xd2fe('0x3d')],qs['fields'](_0x44e45d[_0xd2fe('0x3f')][_0xd2fe('0x43')]));_0x13ec7d['attributes']=_0x13ec7d['attributes'][_0xd2fe('0x54')]?_0x13ec7d[_0xd2fe('0x41')]:_0x465490['model'];if(_0x44e45d[_0xd2fe('0x3f')][_0xd2fe('0x4e')]){_0x13ec7d[_0xd2fe('0x4f')]=[{'all':!![]}];}_0x13ec7d=_['merge']({},_0x13ec7d,_0x44e45d['options']);return db['DeskConfiguration'][_0xd2fe('0x55')](_0x13ec7d)['then'](handleEntityNotFound(_0x377e88,null))[_0xd2fe('0x20')](respondWithResult(_0x377e88,null))[_0xd2fe('0x51')](handleError(_0x377e88,null));};exports[_0xd2fe('0x56')]=function(_0x1ffd92,_0xbb8303){return db['DeskConfiguration'][_0xd2fe('0x56')](_0x1ffd92[_0xd2fe('0x57')],{})['then'](respondWithResult(_0xbb8303,0xc9))[_0xd2fe('0x51')](handleError(_0xbb8303,null));};exports[_0xd2fe('0x33')]=function(_0x588dac,_0x2e108c){if(_0x588dac[_0xd2fe('0x57')]['id']){delete _0x588dac[_0xd2fe('0x57')]['id'];}return db[_0xd2fe('0x4d')]['find']({'where':{'id':_0x588dac['params']['id']}})[_0xd2fe('0x20')](handleEntityNotFound(_0x2e108c,null))[_0xd2fe('0x20')](saveUpdates(_0x588dac[_0xd2fe('0x57')],null))['then'](respondWithResult(_0x2e108c,null))[_0xd2fe('0x51')](handleError(_0x2e108c,null));};exports['destroy']=function(_0x3a3566,_0x4fae03){return db[_0xd2fe('0x4d')]['find']({'where':{'id':_0x3a3566[_0xd2fe('0x53')]['id']}})[_0xd2fe('0x20')](handleEntityNotFound(_0x4fae03,null))[_0xd2fe('0x20')](removeEntity(_0x4fae03,null))['catch'](handleError(_0x4fae03,null));};exports[_0xd2fe('0x58')]=function(_0x4c48b5,_0x2a8d97,_0x28737c){var _0x3089ca={};var _0x24eb5a={};var _0x58a8bf;var _0x217192;return db['DeskConfiguration'][_0xd2fe('0x59')]({'where':{'id':_0x4c48b5[_0xd2fe('0x53')]['id']}})[_0xd2fe('0x20')](handleEntityNotFound(_0x2a8d97,null))[_0xd2fe('0x20')](function(_0x2574bc){if(_0x2574bc){_0x58a8bf=_0x2574bc;_0x24eb5a[_0xd2fe('0x3d')]=_['keys'](db[_0xd2fe('0x5a')][_0xd2fe('0x39')]);_0x24eb5a['query']=_['keys'](_0x4c48b5[_0xd2fe('0x3f')]);_0x24eb5a['filters']=_[_0xd2fe('0x42')](_0x24eb5a[_0xd2fe('0x3d')],_0x24eb5a[_0xd2fe('0x3f')]);_0x3089ca[_0xd2fe('0x41')]=_[_0xd2fe('0x42')](_0x24eb5a['model'],qs[_0xd2fe('0x43')](_0x4c48b5['query']['fields']));_0x3089ca[_0xd2fe('0x41')]=_0x3089ca[_0xd2fe('0x41')]['length']?_0x3089ca['attributes']:_0x24eb5a[_0xd2fe('0x3d')];_0x3089ca[_0xd2fe('0x5b')]=qs[_0xd2fe('0x45')](_0x4c48b5[_0xd2fe('0x3f')][_0xd2fe('0x45')]);_0x3089ca[_0xd2fe('0x49')]=qs['filters'](_[_0xd2fe('0x47')](_0x4c48b5[_0xd2fe('0x3f')],_0x24eb5a[_0xd2fe('0x46')]));if(_0x4c48b5[_0xd2fe('0x3f')][_0xd2fe('0x48')]){_0x3089ca[_0xd2fe('0x49')]=_[_0xd2fe('0x4b')](_0x3089ca[_0xd2fe('0x49')],{'$or':_['map'](_0x3089ca['attributes'],function(_0x187951){var _0x3b0667={};_0x3b0667[_0x187951]={'$like':'%'+_0x4c48b5[_0xd2fe('0x3f')][_0xd2fe('0x48')]+'%'};return _0x3b0667;})});}_0x3089ca=_[_0xd2fe('0x4b')]({},_0x3089ca,_0x4c48b5['options']);return _0x58a8bf[_0xd2fe('0x58')](_0x3089ca);}})[_0xd2fe('0x20')](function(_0xa13fe){if(_0xa13fe){_0x217192=_0xa13fe['length'];if(!_0x4c48b5[_0xd2fe('0x3f')]['hasOwnProperty'](_0xd2fe('0x5c'))){_0x3089ca['limit']=qs[_0xd2fe('0x2d')](_0x4c48b5[_0xd2fe('0x3f')][_0xd2fe('0x2d')]);_0x3089ca[_0xd2fe('0x2c')]=qs[_0xd2fe('0x2c')](_0x4c48b5[_0xd2fe('0x3f')]['offset']);}return _0x58a8bf[_0xd2fe('0x58')](_0x3089ca);}})[_0xd2fe('0x20')](function(_0x33a71b){if(_0x33a71b){return _0x33a71b?{'count':_0x217192,'rows':_0x33a71b}:null;}})['then'](respondWithResult(_0x2a8d97,null))[_0xd2fe('0x51')](handleError(_0x2a8d97,null));};exports['getSubjects']=function(_0x43c3d6,_0x5eb1f5,_0x48a568){var _0x28fa56={};var _0x2de25f={};var _0x301f03;var _0x5d7ae1;return db[_0xd2fe('0x4d')][_0xd2fe('0x59')]({'where':{'id':_0x43c3d6['params']['id']}})[_0xd2fe('0x20')](handleEntityNotFound(_0x5eb1f5,null))[_0xd2fe('0x20')](function(_0x1b00da){if(_0x1b00da){_0x301f03=_0x1b00da;_0x2de25f[_0xd2fe('0x3d')]=_[_0xd2fe('0x40')](db[_0xd2fe('0x5a')][_0xd2fe('0x39')]);_0x2de25f[_0xd2fe('0x3f')]=_['keys'](_0x43c3d6[_0xd2fe('0x3f')]);_0x2de25f[_0xd2fe('0x46')]=_['intersection'](_0x2de25f['model'],_0x2de25f['query']);_0x28fa56[_0xd2fe('0x41')]=_[_0xd2fe('0x42')](_0x2de25f[_0xd2fe('0x3d')],qs[_0xd2fe('0x43')](_0x43c3d6['query'][_0xd2fe('0x43')]));_0x28fa56['attributes']=_0x28fa56['attributes'][_0xd2fe('0x54')]?_0x28fa56['attributes']:_0x2de25f[_0xd2fe('0x3d')];_0x28fa56[_0xd2fe('0x5b')]=qs[_0xd2fe('0x45')](_0x43c3d6[_0xd2fe('0x3f')]['sort']);_0x28fa56[_0xd2fe('0x49')]=qs[_0xd2fe('0x46')](_[_0xd2fe('0x47')](_0x43c3d6[_0xd2fe('0x3f')],_0x2de25f[_0xd2fe('0x46')]));if(_0x43c3d6[_0xd2fe('0x3f')]['filter']){_0x28fa56['where']=_[_0xd2fe('0x4b')](_0x28fa56[_0xd2fe('0x49')],{'$or':_[_0xd2fe('0x3e')](_0x28fa56[_0xd2fe('0x41')],function(_0x5b0472){var _0x3081ab={};_0x3081ab[_0x5b0472]={'$like':'%'+_0x43c3d6[_0xd2fe('0x3f')]['filter']+'%'};return _0x3081ab;})});}_0x28fa56=_['merge']({},_0x28fa56,_0x43c3d6[_0xd2fe('0x4c')]);return _0x301f03[_0xd2fe('0x5d')](_0x28fa56);}})[_0xd2fe('0x20')](function(_0xb4fc16){if(_0xb4fc16){_0x5d7ae1=_0xb4fc16[_0xd2fe('0x54')];if(!_0x43c3d6[_0xd2fe('0x3f')][_0xd2fe('0x44')](_0xd2fe('0x5c'))){_0x28fa56['limit']=qs[_0xd2fe('0x2d')](_0x43c3d6[_0xd2fe('0x3f')]['limit']);_0x28fa56[_0xd2fe('0x2c')]=qs['offset'](_0x43c3d6['query']['offset']);}return _0x301f03[_0xd2fe('0x5d')](_0x28fa56);}})['then'](function(_0x655d1){if(_0x655d1){return _0x655d1?{'count':_0x5d7ae1,'rows':_0x655d1}:null;}})[_0xd2fe('0x20')](respondWithResult(_0x5eb1f5,null))[_0xd2fe('0x51')](handleError(_0x5eb1f5,null));};exports[_0xd2fe('0x5e')]=function(_0x1d3914,_0x4c32f7,_0x3e2088){var _0x34549e={};var _0x41c0c3={};var _0x24ca22;var _0x351e99;return db[_0xd2fe('0x4d')][_0xd2fe('0x59')]({'where':{'id':_0x1d3914['params']['id']}})[_0xd2fe('0x20')](handleEntityNotFound(_0x4c32f7,null))['then'](function(_0x3a2d22){if(_0x3a2d22){_0x24ca22=_0x3a2d22;_0x41c0c3[_0xd2fe('0x3d')]=_[_0xd2fe('0x40')](db[_0xd2fe('0x5a')]['rawAttributes']);_0x41c0c3[_0xd2fe('0x3f')]=_[_0xd2fe('0x40')](_0x1d3914[_0xd2fe('0x3f')]);_0x41c0c3[_0xd2fe('0x46')]=_['intersection'](_0x41c0c3[_0xd2fe('0x3d')],_0x41c0c3[_0xd2fe('0x3f')]);_0x34549e[_0xd2fe('0x41')]=_[_0xd2fe('0x42')](_0x41c0c3[_0xd2fe('0x3d')],qs[_0xd2fe('0x43')](_0x1d3914[_0xd2fe('0x3f')]['fields']));_0x34549e['attributes']=_0x34549e[_0xd2fe('0x41')][_0xd2fe('0x54')]?_0x34549e[_0xd2fe('0x41')]:_0x41c0c3[_0xd2fe('0x3d')];_0x34549e[_0xd2fe('0x5b')]=qs[_0xd2fe('0x45')](_0x1d3914[_0xd2fe('0x3f')][_0xd2fe('0x45')]);_0x34549e[_0xd2fe('0x49')]=qs[_0xd2fe('0x46')](_[_0xd2fe('0x47')](_0x1d3914[_0xd2fe('0x3f')],_0x41c0c3[_0xd2fe('0x46')]));if(_0x1d3914[_0xd2fe('0x3f')][_0xd2fe('0x48')]){_0x34549e[_0xd2fe('0x49')]=_['merge'](_0x34549e[_0xd2fe('0x49')],{'$or':_[_0xd2fe('0x3e')](_0x34549e[_0xd2fe('0x41')],function(_0x48f49a){var _0x2a7eaf={};_0x2a7eaf[_0x48f49a]={'$like':'%'+_0x1d3914[_0xd2fe('0x3f')][_0xd2fe('0x48')]+'%'};return _0x2a7eaf;})});}_0x34549e=_['merge']({},_0x34549e,_0x1d3914[_0xd2fe('0x4c')]);return _0x24ca22[_0xd2fe('0x5e')](_0x34549e);}})[_0xd2fe('0x20')](function(_0x5d5a5a){if(_0x5d5a5a){_0x351e99=_0x5d5a5a[_0xd2fe('0x54')];if(!_0x1d3914[_0xd2fe('0x3f')][_0xd2fe('0x44')](_0xd2fe('0x5c'))){_0x34549e['limit']=qs[_0xd2fe('0x2d')](_0x1d3914[_0xd2fe('0x3f')][_0xd2fe('0x2d')]);_0x34549e[_0xd2fe('0x2c')]=qs['offset'](_0x1d3914[_0xd2fe('0x3f')][_0xd2fe('0x2c')]);}return _0x24ca22[_0xd2fe('0x5e')](_0x34549e);}})[_0xd2fe('0x20')](function(_0x4fdf73){if(_0x4fdf73){return _0x4fdf73?{'count':_0x351e99,'rows':_0x4fdf73}:null;}})['then'](respondWithResult(_0x4c32f7,null))[_0xd2fe('0x51')](handleError(_0x4c32f7,null));};exports[_0xd2fe('0x5f')]=function(_0x38c505,_0x5e6922,_0xb1b595){var _0x467f2a={};var _0x39a53d={};var _0x23cc4c;var _0x25d3aa;return db[_0xd2fe('0x4d')]['findOne']({'where':{'id':_0x38c505[_0xd2fe('0x53')]['id']}})['then'](handleEntityNotFound(_0x5e6922,null))[_0xd2fe('0x20')](function(_0x259a48){if(_0x259a48){_0x23cc4c=_0x259a48;_0x39a53d[_0xd2fe('0x3d')]=_[_0xd2fe('0x40')](db[_0xd2fe('0x60')][_0xd2fe('0x39')]);_0x39a53d['query']=_['keys'](_0x38c505['query']);_0x39a53d['filters']=_[_0xd2fe('0x42')](_0x39a53d[_0xd2fe('0x3d')],_0x39a53d[_0xd2fe('0x3f')]);_0x467f2a[_0xd2fe('0x41')]=_['intersection'](_0x39a53d[_0xd2fe('0x3d')],qs[_0xd2fe('0x43')](_0x38c505['query'][_0xd2fe('0x43')]));_0x467f2a['attributes']=_0x467f2a[_0xd2fe('0x41')][_0xd2fe('0x54')]?_0x467f2a[_0xd2fe('0x41')]:_0x39a53d[_0xd2fe('0x3d')];_0x467f2a['order']=qs[_0xd2fe('0x45')](_0x38c505[_0xd2fe('0x3f')][_0xd2fe('0x45')]);_0x467f2a[_0xd2fe('0x49')]=qs['filters'](_[_0xd2fe('0x47')](_0x38c505[_0xd2fe('0x3f')],_0x39a53d['filters']));if(_0x38c505[_0xd2fe('0x3f')][_0xd2fe('0x48')]){_0x467f2a[_0xd2fe('0x49')]=_[_0xd2fe('0x4b')](_0x467f2a[_0xd2fe('0x49')],{'$or':_[_0xd2fe('0x3e')](_0x467f2a[_0xd2fe('0x41')],function(_0x33dfc5){var _0x5dab41={};_0x5dab41[_0x33dfc5]={'$like':'%'+_0x38c505[_0xd2fe('0x3f')][_0xd2fe('0x48')]+'%'};return _0x5dab41;})});}_0x467f2a=_[_0xd2fe('0x4b')]({},_0x467f2a,_0x38c505[_0xd2fe('0x4c')]);return _0x23cc4c['getTags'](_0x467f2a);}})['then'](function(_0x4083de){if(_0x4083de){_0x25d3aa=_0x4083de[_0xd2fe('0x54')];if(!_0x38c505['query'][_0xd2fe('0x44')]('nolimit')){_0x467f2a[_0xd2fe('0x2d')]=qs['limit'](_0x38c505[_0xd2fe('0x3f')][_0xd2fe('0x2d')]);_0x467f2a[_0xd2fe('0x2c')]=qs[_0xd2fe('0x2c')](_0x38c505['query'][_0xd2fe('0x2c')]);}return _0x23cc4c[_0xd2fe('0x5f')](_0x467f2a);}})['then'](function(_0x5d00ae){if(_0x5d00ae){return _0x5d00ae?{'count':_0x25d3aa,'rows':_0x5d00ae}:null;}})[_0xd2fe('0x20')](respondWithResult(_0x5e6922,null))['catch'](handleError(_0x5e6922,null));};exports[_0xd2fe('0x61')]=function(_0xbb3ff9,_0x3ab333,_0x4c42f4){if(_0xbb3ff9[_0xd2fe('0x57')]['id']){delete _0xbb3ff9[_0xd2fe('0x57')]['id'];}return db[_0xd2fe('0x4d')]['findOne']({'where':{'id':_0xbb3ff9[_0xd2fe('0x53')]['id']}})[_0xd2fe('0x20')](handleEntityNotFound(_0x3ab333,null))['then'](function(_0x135641){if(_0x135641){return _0x135641[_0xd2fe('0x61')](_0xbb3ff9[_0xd2fe('0x57')][_0xd2fe('0x62')]||[]);}return null;})[_0xd2fe('0x20')](respondWithResult(_0x3ab333,null))[_0xd2fe('0x51')](handleError(_0x3ab333,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b0c596d..5f5b13f 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 _0x8a75=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15b2d3,_0x243ad9){var _0x425a1f=function(_0x6530b0){while(--_0x6530b0){_0x15b2d3['push'](_0x15b2d3['shift']());}};_0x425a1f(++_0x243ad9);}(_0x8a75,0xf6));var _0x58a7=function(_0x2bdf81,_0x4033ab){_0x2bdf81=_0x2bdf81-0x0;var _0x49d1c1=_0x8a75[_0x2bdf81];return _0x49d1c1;};'use strict';var _=require(_0x58a7('0x0'));var util=require(_0x58a7('0x1'));var logger=require(_0x58a7('0x2'))(_0x58a7('0x3'));var moment=require(_0x58a7('0x4'));var BPromise=require(_0x58a7('0x5'));var rp=require(_0x58a7('0x6'));var fs=require('fs');var path=require(_0x58a7('0x7'));var rimraf=require(_0x58a7('0x8'));var config=require(_0x58a7('0x9'));var attributes=require(_0x58a7('0xa'));module[_0x58a7('0xb')]=function(_0x1d8460,_0x296cae){return _0x1d8460[_0x58a7('0xc')](_0x58a7('0xd'),attributes,{'tableName':_0x58a7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3343=['../../config/logger','api','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x3343,0x1ea));var _0x3334=function(_0x2055a7,_0x415a4c){_0x2055a7=_0x2055a7-0x0;var _0x42a14d=_0x3343[_0x2055a7];return _0x42a14d;};'use strict';var _=require(_0x3334('0x0'));var util=require(_0x3334('0x1'));var logger=require(_0x3334('0x2'))(_0x3334('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3334('0x4'));var fs=require('fs');var path=require(_0x3334('0x5'));var rimraf=require('rimraf');var config=require(_0x3334('0x6'));var attributes=require(_0x3334('0x7'));module[_0x3334('0x8')]=function(_0xad03bf,_0x37fc45){return _0xad03bf[_0x3334('0x9')](_0x3334('0xa'),attributes,{'tableName':_0x3334('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 be615fc..1d9171b 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 _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x2bc6,0x163));var _0x62bc=function(_0x4ce0b0,_0x572278){_0x4ce0b0=_0x4ce0b0-0x0;var _0x58115a=_0x2bc6[_0x4ce0b0];return _0x58115a;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62bc('0x3'));var logger=require('../../config/logger')(_0x62bc('0x4'));var config=require(_0x62bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x6')][_0x62bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40af10,_0x3f3dc9,_0x3ed6ad){return new BPromise(function(_0x3f625c,_0x5bedeb){return client[_0x62bc('0x8')](_0x40af10,_0x3ed6ad)[_0x62bc('0x9')](function(_0x1917e1){logger[_0x62bc('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x3f3dc9,_0x62bc('0xb'));logger[_0x62bc('0xc')](_0x62bc('0xd'),_0x3f3dc9,'request\x20sent',JSON[_0x62bc('0xe')](_0x1917e1));if(_0x1917e1[_0x62bc('0xf')]){if(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x10')]===0x1f4){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')]['message']);return _0x5bedeb(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);}logger['error'](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);return _0x3f625c(_0x1917e1['error'][_0x62bc('0x12')]);}else{logger[_0x62bc('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x3f3dc9,'request\x20sent');_0x3f625c(_0x1917e1[_0x62bc('0x13')][_0x62bc('0x12')]);}})['catch'](function(_0x278893){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x278893);_0x5bedeb(_0x278893);});});} \ No newline at end of file +var _0x8bdf=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a4d07,_0x3664aa){var _0x3d0203=function(_0x2bde31){while(--_0x2bde31){_0x2a4d07['push'](_0x2a4d07['shift']());}};_0x3d0203(++_0x3664aa);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8bdf[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xf8bd('0x0'));var util=require(_0xf8bd('0x1'));var moment=require(_0xf8bd('0x2'));var BPromise=require(_0xf8bd('0x3'));var rs=require(_0xf8bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8bd('0x5'))['db'];var utils=require(_0xf8bd('0x6'));var logger=require(_0xf8bd('0x7'))(_0xf8bd('0x8'));var config=require(_0xf8bd('0x9'));var jayson=require(_0xf8bd('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x504c82,_0x3ee99e,_0x22a277){return new BPromise(function(_0x3e1db1,_0x424831){return client['request'](_0x504c82,_0x22a277)[_0xf8bd('0xb')](function(_0x3d10d3){logger['info'](_0xf8bd('0xc'),_0x3ee99e,_0xf8bd('0xd'));logger['debug'](_0xf8bd('0xe'),_0x3ee99e,_0xf8bd('0xd'),JSON[_0xf8bd('0xf')](_0x3d10d3));if(_0x3d10d3[_0xf8bd('0x10')]){if(_0x3d10d3['error'][_0xf8bd('0x11')]===0x1f4){logger[_0xf8bd('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x3ee99e,_0x3d10d3[_0xf8bd('0x10')]['message']);return _0x424831(_0x3d10d3[_0xf8bd('0x10')][_0xf8bd('0x12')]);}logger[_0xf8bd('0x10')](_0xf8bd('0xc'),_0x3ee99e,_0x3d10d3[_0xf8bd('0x10')][_0xf8bd('0x12')]);return _0x3e1db1(_0x3d10d3['error']['message']);}else{logger['info'](_0xf8bd('0xc'),_0x3ee99e,_0xf8bd('0xd'));_0x3e1db1(_0x3d10d3['result'][_0xf8bd('0x12')]);}})[_0xf8bd('0x13')](function(_0x1bd8c6){logger[_0xf8bd('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x3ee99e,_0x1bd8c6);_0x424831(_0x1bd8c6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6f6c0d7..505a519 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 _0x57d7=['./intDeskField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service'];(function(_0x105075,_0x250a49){var _0x3e88b1=function(_0x254e83){while(--_0x254e83){_0x105075['push'](_0x105075['shift']());}};_0x3e88b1(++_0x250a49);}(_0x57d7,0xac));var _0x757d=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x57d7[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0x757d('0x0'));var util=require('util');var path=require(_0x757d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x757d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x757d('0x3'));var config=require('../../config/environment');var controller=require(_0x757d('0x4'));router[_0x757d('0x5')]('/',auth[_0x757d('0x6')](),controller[_0x757d('0x7')]);router[_0x757d('0x5')]('/:id',auth[_0x757d('0x6')](),controller['show']);router[_0x757d('0x8')]('/',auth[_0x757d('0x6')](),controller[_0x757d('0x9')]);router[_0x757d('0xa')](_0x757d('0xb'),auth[_0x757d('0x6')](),controller[_0x757d('0xc')]);router[_0x757d('0xd')]('/:id',auth[_0x757d('0x6')](),controller[_0x757d('0xe')]);module[_0x757d('0xf')]=router; \ No newline at end of file +var _0x643d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x643d,0x1bd));var _0xd643=function(_0x496221,_0xe39993){_0x496221=_0x496221-0x0;var _0x5b0642=_0x643d[_0x496221];return _0x5b0642;};'use strict';var multer=require(_0xd643('0x0'));var util=require(_0xd643('0x1'));var path=require(_0xd643('0x2'));var timeout=require(_0xd643('0x3'));var express=require(_0xd643('0x4'));var router=express[_0xd643('0x5')]();var auth=require(_0xd643('0x6'));var interaction=require(_0xd643('0x7'));var config=require('../../config/environment');var controller=require(_0xd643('0x8'));router[_0xd643('0x9')]('/',auth['isAuthenticated'](),controller[_0xd643('0xa')]);router[_0xd643('0x9')](_0xd643('0xb'),auth[_0xd643('0xc')](),controller[_0xd643('0xd')]);router[_0xd643('0xe')]('/',auth[_0xd643('0xc')](),controller[_0xd643('0xf')]);router[_0xd643('0x10')](_0xd643('0xb'),auth[_0xd643('0xc')](),controller[_0xd643('0x11')]);router[_0xd643('0x12')](_0xd643('0xb'),auth[_0xd643('0xc')](),controller[_0xd643('0x13')]);module[_0xd643('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8dbcb4c..48df3b4 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 _0xce6c=['BOOLEAN','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x3c0016,_0xcff79){var _0x3ddf38=function(_0x41b3dc){while(--_0x41b3dc){_0x3c0016['push'](_0x3c0016['shift']());}};_0x3ddf38(++_0xcff79);}(_0xce6c,0x143));var _0xcce6=function(_0x330bc2,_0x563776){_0x330bc2=_0x330bc2-0x0;var _0x4a9049=_0xce6c[_0x330bc2];return _0x4a9049;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xcce6('0x0')](_0xcce6('0x1'),'variable',_0xcce6('0x2'),_0xcce6('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcce6('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xcce6('0x5'),_0xcce6('0x2'))},'keyContent':{'type':Sequelize[_0xcce6('0x4')]},'idField':{'type':Sequelize[_0xcce6('0x4')]},'nameField':{'type':Sequelize[_0xcce6('0x4')]},'customField':{'type':Sequelize[_0xcce6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2153=['keyValue','string','STRING','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x4390b5,_0x3d5732){var _0x40466f=function(_0x2a7d75){while(--_0x2a7d75){_0x4390b5['push'](_0x4390b5['shift']());}};_0x40466f(++_0x3d5732);}(_0x2153,0x14c));var _0x3215=function(_0xd40b55,_0x33116f){_0xd40b55=_0xd40b55-0x0;var _0x47169e=_0x2153[_0xd40b55];return _0x47169e;};'use strict';var Sequelize=require(_0x3215('0x0'));module[_0x3215('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x3215('0x2'),_0x3215('0x3'),_0x3215('0x4')),'defaultValue':_0x3215('0x5')},'content':{'type':Sequelize[_0x3215('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x3215('0x5'),'variable',_0x3215('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3215('0x6')]},'customField':{'type':Sequelize[_0x3215('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3215('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 32d1541..f1ec375 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 _0x48b0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','update','then','destroy','error','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x48b0,0x115));var _0x048b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x48b0[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x048b('0x0'));var emlformat=require(_0x048b('0x1'));var rimraf=require(_0x048b('0x2'));var zipdir=require(_0x048b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x048b('0x4'));var moment=require(_0x048b('0x5'));var BPromise=require(_0x048b('0x6'));var Mustache=require('mustache');var util=require(_0x048b('0x7'));var path=require(_0x048b('0x8'));var sox=require(_0x048b('0x9'));var csv=require(_0x048b('0xa'));var ejs=require(_0x048b('0xb'));var fs=require('fs');var _=require(_0x048b('0xc'));var squel=require('squel');var crypto=require(_0x048b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x048b('0xe'));var Papa=require(_0x048b('0xf'));var Redis=require(_0x048b('0x10'));var authService=require(_0x048b('0x11'));var qs=require(_0x048b('0x12'));var as=require(_0x048b('0x13'));var hardwareService=require(_0x048b('0x14'));var logger=require(_0x048b('0x15'))(_0x048b('0x16'));var utils=require(_0x048b('0x17'));var config=require('../../config/environment');var db=require(_0x048b('0x18'))['db'];function respondWithStatusCode(_0x1cb038,_0x4dde78){_0x4dde78=_0x4dde78||0xcc;return function(_0x3b22f9){if(_0x3b22f9){return _0x1cb038[_0x048b('0x19')](_0x4dde78);}return _0x1cb038[_0x048b('0x1a')](_0x4dde78)[_0x048b('0x1b')]();};}function respondWithResult(_0x5a55aa,_0x3ce94c){_0x3ce94c=_0x3ce94c||0xc8;return function(_0x4f8fa2){if(_0x4f8fa2){return _0x5a55aa['status'](_0x3ce94c)[_0x048b('0x1c')](_0x4f8fa2);}};}function respondWithFilteredResult(_0x4a88d6,_0x326432){return function(_0x3d7e66){if(_0x3d7e66){var _0x3f46a6=_0x3d7e66[_0x048b('0x1d')],_0x513b2d=_0x326432['offset'],_0x2f4088=_0x326432['offset']+_0x326432[_0x048b('0x1e')],_0x44ef1e;if(_0x2f4088>=_0x3f46a6){_0x2f4088=_0x3f46a6;_0x44ef1e=0xc8;}else{_0x44ef1e=0xce;}_0x4a88d6[_0x048b('0x1a')](_0x44ef1e);return _0x4a88d6[_0x048b('0x1f')](_0x048b('0x20'),_0x513b2d+'-'+_0x2f4088+'/'+_0x3f46a6)[_0x048b('0x1c')](_0x3d7e66);}return null;};}function patchUpdates(_0x210938){return function(_0x4d3bd7){try{jsonpatch[_0x048b('0x21')](_0x4d3bd7,_0x210938,!![]);}catch(_0x585068){return BPromise['reject'](_0x585068);}return _0x4d3bd7['save']();};}function saveUpdates(_0x1456de,_0x413031){return function(_0x5c3398){if(_0x5c3398){return _0x5c3398[_0x048b('0x22')](_0x1456de)[_0x048b('0x23')](function(_0x486f40){return _0x486f40;});}return null;};}function removeEntity(_0x12f7e5,_0xe1e3ed){return function(_0xe151f6){if(_0xe151f6){return _0xe151f6[_0x048b('0x24')]()['then'](function(){_0x12f7e5['status'](0xcc)[_0x048b('0x1b')]();});}};}function handleEntityNotFound(_0x8b5d6f,_0x3d9171){return function(_0x5c68d0){if(!_0x5c68d0){_0x8b5d6f[_0x048b('0x19')](0x194);}return _0x5c68d0;};}function handleError(_0x5c84d2,_0xb3a8fe){_0xb3a8fe=_0xb3a8fe||0x1f4;return function(_0x48ea1b){logger[_0x048b('0x25')](_0x48ea1b['stack']);if(_0x48ea1b[_0x048b('0x26')]){delete _0x48ea1b[_0x048b('0x26')];}_0x5c84d2['status'](_0xb3a8fe)[_0x048b('0x27')](_0x48ea1b);};}exports['index']=function(_0x576845,_0x448497){var _0x2139a3={},_0x2d3fed={},_0x4dfaae={'count':0x0,'rows':[]};var _0x216a15=_[_0x048b('0x28')](db[_0x048b('0x29')][_0x048b('0x2a')],function(_0x2de066){return{'name':_0x2de066[_0x048b('0x2b')],'type':_0x2de066[_0x048b('0x2c')][_0x048b('0x2d')]};});_0x2d3fed[_0x048b('0x2e')]=_[_0x048b('0x28')](_0x216a15,_0x048b('0x26'));_0x2d3fed['query']=_[_0x048b('0x2f')](_0x576845[_0x048b('0x30')]);_0x2d3fed[_0x048b('0x31')]=_['intersection'](_0x2d3fed[_0x048b('0x2e')],_0x2d3fed[_0x048b('0x30')]);_0x2139a3[_0x048b('0x32')]=_[_0x048b('0x33')](_0x2d3fed['model'],qs[_0x048b('0x34')](_0x576845[_0x048b('0x30')]['fields']));_0x2139a3['attributes']=_0x2139a3[_0x048b('0x32')][_0x048b('0x35')]?_0x2139a3[_0x048b('0x32')]:_0x2d3fed['model'];if(!_0x576845['query'][_0x048b('0x36')](_0x048b('0x37'))){_0x2139a3[_0x048b('0x1e')]=qs[_0x048b('0x1e')](_0x576845['query']['limit']);_0x2139a3['offset']=qs[_0x048b('0x38')](_0x576845[_0x048b('0x30')]['offset']);}_0x2139a3[_0x048b('0x39')]=qs[_0x048b('0x3a')](_0x576845[_0x048b('0x30')]['sort']);_0x2139a3[_0x048b('0x3b')]=qs['filters'](_[_0x048b('0x3c')](_0x576845[_0x048b('0x30')],_0x2d3fed[_0x048b('0x31')]),_0x216a15);if(_0x576845[_0x048b('0x30')][_0x048b('0x3d')]){_0x2139a3[_0x048b('0x3b')]=_[_0x048b('0x3e')](_0x2139a3[_0x048b('0x3b')],{'$or':_[_0x048b('0x28')](_0x216a15,function(_0x1c93c){if(_0x1c93c['type']!==_0x048b('0x3f')){var _0x26fcab={};_0x26fcab[_0x1c93c[_0x048b('0x26')]]={'$like':'%'+_0x576845[_0x048b('0x30')][_0x048b('0x3d')]+'%'};return _0x26fcab;}})});}_0x2139a3=_[_0x048b('0x3e')]({},_0x2139a3,_0x576845[_0x048b('0x40')]);var _0x5ed33d={'where':_0x2139a3[_0x048b('0x3b')]};return db[_0x048b('0x29')]['count'](_0x5ed33d)[_0x048b('0x23')](function(_0x3caa0b){_0x4dfaae[_0x048b('0x1d')]=_0x3caa0b;if(_0x576845[_0x048b('0x30')]['includeAll']){_0x2139a3['include']=[{'all':!![]}];}return db[_0x048b('0x29')][_0x048b('0x41')](_0x2139a3);})[_0x048b('0x23')](function(_0xba384e){_0x4dfaae[_0x048b('0x42')]=_0xba384e;return _0x4dfaae;})[_0x048b('0x23')](respondWithFilteredResult(_0x448497,_0x2139a3))[_0x048b('0x43')](handleError(_0x448497,null));};exports[_0x048b('0x44')]=function(_0x4eb217,_0x1d2d7b){var _0x39b756={'raw':!![],'where':{'id':_0x4eb217[_0x048b('0x45')]['id']}},_0x2b8dbe={};_0x2b8dbe['model']=_[_0x048b('0x2f')](db[_0x048b('0x29')][_0x048b('0x2a')]);_0x2b8dbe[_0x048b('0x30')]=_[_0x048b('0x2f')](_0x4eb217[_0x048b('0x30')]);_0x2b8dbe[_0x048b('0x31')]=_['intersection'](_0x2b8dbe['model'],_0x2b8dbe[_0x048b('0x30')]);_0x39b756[_0x048b('0x32')]=_[_0x048b('0x33')](_0x2b8dbe['model'],qs[_0x048b('0x34')](_0x4eb217['query'][_0x048b('0x34')]));_0x39b756['attributes']=_0x39b756['attributes'][_0x048b('0x35')]?_0x39b756[_0x048b('0x32')]:_0x2b8dbe[_0x048b('0x2e')];if(_0x4eb217[_0x048b('0x30')][_0x048b('0x46')]){_0x39b756['include']=[{'all':!![]}];}_0x39b756=_['merge']({},_0x39b756,_0x4eb217['options']);return db['DeskField'][_0x048b('0x47')](_0x39b756)['then'](handleEntityNotFound(_0x1d2d7b,null))[_0x048b('0x23')](respondWithResult(_0x1d2d7b,null))['catch'](handleError(_0x1d2d7b,null));};exports[_0x048b('0x48')]=function(_0x3c5e72,_0x28e94d){return db['DeskField'][_0x048b('0x48')](_0x3c5e72[_0x048b('0x49')],{})[_0x048b('0x23')](respondWithResult(_0x28e94d,0xc9))[_0x048b('0x43')](handleError(_0x28e94d,null));};exports['update']=function(_0x5b6f3d,_0x556850){if(_0x5b6f3d['body']['id']){delete _0x5b6f3d[_0x048b('0x49')]['id'];}return db['DeskField'][_0x048b('0x47')]({'where':{'id':_0x5b6f3d[_0x048b('0x45')]['id']}})[_0x048b('0x23')](handleEntityNotFound(_0x556850,null))[_0x048b('0x23')](saveUpdates(_0x5b6f3d[_0x048b('0x49')],null))[_0x048b('0x23')](respondWithResult(_0x556850,null))['catch'](handleError(_0x556850,null));};exports[_0x048b('0x24')]=function(_0x30549b,_0x2e9791){return db['DeskField'][_0x048b('0x47')]({'where':{'id':_0x30549b[_0x048b('0x45')]['id']}})[_0x048b('0x23')](handleEntityNotFound(_0x2e9791,null))[_0x048b('0x23')](removeEntity(_0x2e9791,null))[_0x048b('0x43')](handleError(_0x2e9791,null));}; \ No newline at end of file +var _0x4f16=['sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4a18f0,_0x903c50){var _0x158316=function(_0x3cf39c){while(--_0x3cf39c){_0x4a18f0['push'](_0x4a18f0['shift']());}};_0x158316(++_0x903c50);}(_0x4f16,0x9e));var _0x64f1=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x4f16[_0x21d532];return _0x37bda1;};'use strict';var pdf=require(_0x64f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x64f1('0x2'));var moment=require(_0x64f1('0x3'));var BPromise=require(_0x64f1('0x4'));var Mustache=require(_0x64f1('0x5'));var util=require(_0x64f1('0x6'));var path=require(_0x64f1('0x7'));var sox=require('sox');var csv=require(_0x64f1('0x8'));var ejs=require(_0x64f1('0x9'));var fs=require('fs');var _=require(_0x64f1('0xa'));var squel=require(_0x64f1('0xb'));var crypto=require(_0x64f1('0xc'));var jsforce=require(_0x64f1('0xd'));var deskjs=require(_0x64f1('0xe'));var toCsv=require(_0x64f1('0x8'));var querystring=require(_0x64f1('0xf'));var Papa=require(_0x64f1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64f1('0x12'))(_0x64f1('0x13'));var utils=require(_0x64f1('0x14'));var config=require(_0x64f1('0x15'));var db=require(_0x64f1('0x16'))['db'];function respondWithStatusCode(_0x2676b,_0x5c3be4){_0x5c3be4=_0x5c3be4||0xcc;return function(_0x3a8c3f){if(_0x3a8c3f){return _0x2676b['sendStatus'](_0x5c3be4);}return _0x2676b[_0x64f1('0x17')](_0x5c3be4)[_0x64f1('0x18')]();};}function respondWithResult(_0x58ecd5,_0x2aa7c1){_0x2aa7c1=_0x2aa7c1||0xc8;return function(_0x3e7ece){if(_0x3e7ece){return _0x58ecd5[_0x64f1('0x17')](_0x2aa7c1)[_0x64f1('0x19')](_0x3e7ece);}};}function respondWithFilteredResult(_0x3df521,_0x299a66){return function(_0x471152){if(_0x471152){var _0x206c7b=_0x471152[_0x64f1('0x1a')],_0x5d728c=_0x299a66['offset'],_0x27b4f9=_0x299a66[_0x64f1('0x1b')]+_0x299a66[_0x64f1('0x1c')],_0x4da272;if(_0x27b4f9>=_0x206c7b){_0x27b4f9=_0x206c7b;_0x4da272=0xc8;}else{_0x4da272=0xce;}_0x3df521['status'](_0x4da272);return _0x3df521[_0x64f1('0x1d')](_0x64f1('0x1e'),_0x5d728c+'-'+_0x27b4f9+'/'+_0x206c7b)[_0x64f1('0x19')](_0x471152);}return null;};}function patchUpdates(_0x3a5b37){return function(_0x50dd87){try{jsonpatch[_0x64f1('0x1f')](_0x50dd87,_0x3a5b37,!![]);}catch(_0x2792c9){return BPromise['reject'](_0x2792c9);}return _0x50dd87[_0x64f1('0x20')]();};}function saveUpdates(_0x4357fb,_0x1142d2){return function(_0x4b8ca9){if(_0x4b8ca9){return _0x4b8ca9[_0x64f1('0x21')](_0x4357fb)[_0x64f1('0x22')](function(_0x20f0bd){return _0x20f0bd;});}return null;};}function removeEntity(_0x2c09d6,_0x29d46c){return function(_0x3be7fc){if(_0x3be7fc){return _0x3be7fc[_0x64f1('0x23')]()[_0x64f1('0x22')](function(){_0x2c09d6[_0x64f1('0x17')](0xcc)[_0x64f1('0x18')]();});}};}function handleEntityNotFound(_0x14d2d3,_0x3f80da){return function(_0xb0f36e){if(!_0xb0f36e){_0x14d2d3['sendStatus'](0x194);}return _0xb0f36e;};}function handleError(_0x5d1340,_0xa58178){_0xa58178=_0xa58178||0x1f4;return function(_0x203999){logger[_0x64f1('0x24')](_0x203999['stack']);if(_0x203999[_0x64f1('0x25')]){delete _0x203999[_0x64f1('0x25')];}_0x5d1340[_0x64f1('0x17')](_0xa58178)[_0x64f1('0x26')](_0x203999);};}exports[_0x64f1('0x27')]=function(_0x535d37,_0x169761){var _0x27a409={},_0x28c247={},_0x1bb576={'count':0x0,'rows':[]};var _0x1c5753=_[_0x64f1('0x28')](db[_0x64f1('0x29')][_0x64f1('0x2a')],function(_0x249ad7){return{'name':_0x249ad7[_0x64f1('0x2b')],'type':_0x249ad7[_0x64f1('0x2c')][_0x64f1('0x2d')]};});_0x28c247['model']=_['map'](_0x1c5753,_0x64f1('0x25'));_0x28c247[_0x64f1('0x2e')]=_[_0x64f1('0x2f')](_0x535d37['query']);_0x28c247['filters']=_[_0x64f1('0x30')](_0x28c247[_0x64f1('0x31')],_0x28c247['query']);_0x27a409[_0x64f1('0x32')]=_['intersection'](_0x28c247[_0x64f1('0x31')],qs[_0x64f1('0x33')](_0x535d37[_0x64f1('0x2e')][_0x64f1('0x33')]));_0x27a409[_0x64f1('0x32')]=_0x27a409[_0x64f1('0x32')][_0x64f1('0x34')]?_0x27a409[_0x64f1('0x32')]:_0x28c247['model'];if(!_0x535d37[_0x64f1('0x2e')][_0x64f1('0x35')](_0x64f1('0x36'))){_0x27a409['limit']=qs['limit'](_0x535d37[_0x64f1('0x2e')][_0x64f1('0x1c')]);_0x27a409[_0x64f1('0x1b')]=qs[_0x64f1('0x1b')](_0x535d37[_0x64f1('0x2e')]['offset']);}_0x27a409['order']=qs[_0x64f1('0x37')](_0x535d37[_0x64f1('0x2e')][_0x64f1('0x37')]);_0x27a409[_0x64f1('0x38')]=qs[_0x64f1('0x39')](_[_0x64f1('0x3a')](_0x535d37[_0x64f1('0x2e')],_0x28c247[_0x64f1('0x39')]),_0x1c5753);if(_0x535d37['query'][_0x64f1('0x3b')]){_0x27a409['where']=_[_0x64f1('0x3c')](_0x27a409[_0x64f1('0x38')],{'$or':_[_0x64f1('0x28')](_0x1c5753,function(_0x5b9898){if(_0x5b9898[_0x64f1('0x2c')]!=='VIRTUAL'){var _0x49f50e={};_0x49f50e[_0x5b9898[_0x64f1('0x25')]]={'$like':'%'+_0x535d37['query'][_0x64f1('0x3b')]+'%'};return _0x49f50e;}})});}_0x27a409=_[_0x64f1('0x3c')]({},_0x27a409,_0x535d37[_0x64f1('0x3d')]);var _0x45207e={'where':_0x27a409['where']};return db[_0x64f1('0x29')][_0x64f1('0x1a')](_0x45207e)[_0x64f1('0x22')](function(_0x1ec84a){_0x1bb576[_0x64f1('0x1a')]=_0x1ec84a;if(_0x535d37[_0x64f1('0x2e')][_0x64f1('0x3e')]){_0x27a409[_0x64f1('0x3f')]=[{'all':!![]}];}return db[_0x64f1('0x29')][_0x64f1('0x40')](_0x27a409);})[_0x64f1('0x22')](function(_0x212906){_0x1bb576[_0x64f1('0x41')]=_0x212906;return _0x1bb576;})[_0x64f1('0x22')](respondWithFilteredResult(_0x169761,_0x27a409))[_0x64f1('0x42')](handleError(_0x169761,null));};exports['show']=function(_0x4c12c1,_0x27ae4f){var _0x1b9ac={'raw':!![],'where':{'id':_0x4c12c1['params']['id']}},_0x502bef={};_0x502bef[_0x64f1('0x31')]=_[_0x64f1('0x2f')](db['DeskField'][_0x64f1('0x2a')]);_0x502bef[_0x64f1('0x2e')]=_[_0x64f1('0x2f')](_0x4c12c1['query']);_0x502bef[_0x64f1('0x39')]=_[_0x64f1('0x30')](_0x502bef['model'],_0x502bef['query']);_0x1b9ac[_0x64f1('0x32')]=_[_0x64f1('0x30')](_0x502bef['model'],qs[_0x64f1('0x33')](_0x4c12c1[_0x64f1('0x2e')]['fields']));_0x1b9ac[_0x64f1('0x32')]=_0x1b9ac['attributes'][_0x64f1('0x34')]?_0x1b9ac[_0x64f1('0x32')]:_0x502bef[_0x64f1('0x31')];if(_0x4c12c1['query'][_0x64f1('0x3e')]){_0x1b9ac[_0x64f1('0x3f')]=[{'all':!![]}];}_0x1b9ac=_[_0x64f1('0x3c')]({},_0x1b9ac,_0x4c12c1[_0x64f1('0x3d')]);return db[_0x64f1('0x29')][_0x64f1('0x43')](_0x1b9ac)['then'](handleEntityNotFound(_0x27ae4f,null))[_0x64f1('0x22')](respondWithResult(_0x27ae4f,null))[_0x64f1('0x42')](handleError(_0x27ae4f,null));};exports[_0x64f1('0x44')]=function(_0x5f05fa,_0xdf6b6c){return db[_0x64f1('0x29')][_0x64f1('0x44')](_0x5f05fa['body'],{})[_0x64f1('0x22')](respondWithResult(_0xdf6b6c,0xc9))[_0x64f1('0x42')](handleError(_0xdf6b6c,null));};exports[_0x64f1('0x21')]=function(_0x1b16bb,_0x525b5f){if(_0x1b16bb[_0x64f1('0x45')]['id']){delete _0x1b16bb[_0x64f1('0x45')]['id'];}return db['DeskField']['find']({'where':{'id':_0x1b16bb[_0x64f1('0x46')]['id']}})[_0x64f1('0x22')](handleEntityNotFound(_0x525b5f,null))[_0x64f1('0x22')](saveUpdates(_0x1b16bb[_0x64f1('0x45')],null))[_0x64f1('0x22')](respondWithResult(_0x525b5f,null))[_0x64f1('0x42')](handleError(_0x525b5f,null));};exports[_0x64f1('0x23')]=function(_0x1ad196,_0x1b970e){return db[_0x64f1('0x29')][_0x64f1('0x43')]({'where':{'id':_0x1ad196[_0x64f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b970e,null))[_0x64f1('0x22')](removeEntity(_0x1b970e,null))[_0x64f1('0x42')](handleError(_0x1b970e,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 66e9603..8b755fc 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 _0xd080=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports'];(function(_0x564b0e,_0x5b328b){var _0x3c4576=function(_0x3dbf48){while(--_0x3dbf48){_0x564b0e['push'](_0x564b0e['shift']());}};_0x3c4576(++_0x5b328b);}(_0xd080,0xc9));var _0x0d08=function(_0x3d6d31,_0x59c570){_0x3d6d31=_0x3d6d31-0x0;var _0x585b4f=_0xd080[_0x3d6d31];return _0x585b4f;};'use strict';var _=require('lodash');var util=require(_0x0d08('0x0'));var logger=require('../../config/logger')(_0x0d08('0x1'));var moment=require(_0x0d08('0x2'));var BPromise=require(_0x0d08('0x3'));var rp=require(_0x0d08('0x4'));var fs=require('fs');var path=require(_0x0d08('0x5'));var rimraf=require(_0x0d08('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d08('0x7'));module[_0x0d08('0x8')]=function(_0x4c1a9d,_0x240e87){return _0x4c1a9d[_0x0d08('0x9')](_0x0d08('0xa'),attributes,{'tableName':_0x0d08('0xb'),'paranoid':![],'indexes':[{'name':_0x0d08('0xc'),'fields':[_0x0d08('0xd'),_0x0d08('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff0b=['exports','define','int_desk_fields','lodash','../../config/logger','bluebird','request-promise','path','./intDeskField.attributes'];(function(_0x1c3104,_0x19b2c6){var _0x6bcf08=function(_0x2e72b3){while(--_0x2e72b3){_0x1c3104['push'](_0x1c3104['shift']());}};_0x6bcf08(++_0x19b2c6);}(_0xff0b,0x18f));var _0xbff0=function(_0x4a6d3a,_0x1b2479){_0x4a6d3a=_0x4a6d3a-0x0;var _0x55d643=_0xff0b[_0x4a6d3a];return _0x55d643;};'use strict';var _=require(_0xbff0('0x0'));var util=require('util');var logger=require(_0xbff0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbff0('0x2'));var rp=require(_0xbff0('0x3'));var fs=require('fs');var path=require(_0xbff0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbff0('0x5'));module[_0xbff0('0x6')]=function(_0x172c6d,_0x9dcc98){return _0x172c6d[_0xbff0('0x7')]('DeskField',attributes,{'tableName':_0xbff0('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e133846..8ba73b4 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 _0xabdd=['rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc3300f,_0x1b957d){var _0x5007df=function(_0x5f583c){while(--_0x5f583c){_0xc3300f['push'](_0xc3300f['shift']());}};_0x5007df(++_0x1b957d);}(_0xabdd,0x1b1));var _0xdabd=function(_0x3890ea,_0x108efb){_0x3890ea=_0x3890ea-0x0;var _0x28f70f=_0xabdd[_0x3890ea];return _0x28f70f;};'use strict';var _=require(_0xdabd('0x0'));var util=require(_0xdabd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdabd('0x2'));var fs=require('fs');var Redis=require(_0xdabd('0x3'));var db=require(_0xdabd('0x4'))['db'];var utils=require(_0xdabd('0x5'));var logger=require(_0xdabd('0x6'))(_0xdabd('0x7'));var config=require(_0xdabd('0x8'));var jayson=require(_0xdabd('0x9'));var client=jayson['client'][_0xdabd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fcb50,_0x13edf5,_0x47a26){return new BPromise(function(_0x8c091,_0x6307b0){return client[_0xdabd('0xb')](_0x1fcb50,_0x47a26)[_0xdabd('0xc')](function(_0x2102a5){logger[_0xdabd('0xd')](_0xdabd('0xe'),_0x13edf5,_0xdabd('0xf'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x13edf5,_0xdabd('0xf'),JSON[_0xdabd('0x10')](_0x2102a5));if(_0x2102a5['error']){if(_0x2102a5[_0xdabd('0x11')][_0xdabd('0x12')]===0x1f4){logger[_0xdabd('0x11')](_0xdabd('0xe'),_0x13edf5,_0x2102a5[_0xdabd('0x11')][_0xdabd('0x13')]);return _0x6307b0(_0x2102a5[_0xdabd('0x11')][_0xdabd('0x13')]);}logger['error'](_0xdabd('0xe'),_0x13edf5,_0x2102a5['error']['message']);return _0x8c091(_0x2102a5[_0xdabd('0x11')][_0xdabd('0x13')]);}else{logger[_0xdabd('0xd')](_0xdabd('0xe'),_0x13edf5,_0xdabd('0xf'));_0x8c091(_0x2102a5[_0xdabd('0x14')][_0xdabd('0x13')]);}})[_0xdabd('0x15')](function(_0x24064f){logger['error'](_0xdabd('0xe'),_0x13edf5,_0x24064f);_0x6307b0(_0x24064f);});});} \ No newline at end of file +var _0xfee6=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfee6,0x14e));var _0x6fee=function(_0x348bb5,_0x32c723){_0x348bb5=_0x348bb5-0x0;var _0x4fbc6c=_0xfee6[_0x348bb5];return _0x4fbc6c;};'use strict';var _=require('lodash');var util=require(_0x6fee('0x0'));var moment=require('moment');var BPromise=require(_0x6fee('0x1'));var rs=require(_0x6fee('0x2'));var fs=require('fs');var Redis=require(_0x6fee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fee('0x4'));var logger=require(_0x6fee('0x5'))(_0x6fee('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6fee('0x7')][_0x6fee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5252da,_0xa830a7,_0x4c5199){return new BPromise(function(_0x2faecf,_0x1cd267){return client[_0x6fee('0x9')](_0x5252da,_0x4c5199)[_0x6fee('0xa')](function(_0xe5ca4){logger[_0x6fee('0xb')](_0x6fee('0xc'),_0xa830a7,_0x6fee('0xd'));logger[_0x6fee('0xe')](_0x6fee('0xf'),_0xa830a7,_0x6fee('0xd'),JSON[_0x6fee('0x10')](_0xe5ca4));if(_0xe5ca4[_0x6fee('0x11')]){if(_0xe5ca4[_0x6fee('0x11')][_0x6fee('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0xa830a7,_0xe5ca4[_0x6fee('0x11')][_0x6fee('0x13')]);return _0x1cd267(_0xe5ca4['error'][_0x6fee('0x13')]);}logger[_0x6fee('0x11')](_0x6fee('0xc'),_0xa830a7,_0xe5ca4[_0x6fee('0x11')]['message']);return _0x2faecf(_0xe5ca4['error'][_0x6fee('0x13')]);}else{logger[_0x6fee('0xb')](_0x6fee('0xc'),_0xa830a7,_0x6fee('0xd'));_0x2faecf(_0xe5ca4[_0x6fee('0x14')][_0x6fee('0x13')]);}})[_0x6fee('0x15')](function(_0x114690){logger[_0x6fee('0x11')](_0x6fee('0xc'),_0xa830a7,_0x114690);_0x1cd267(_0x114690);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9fd20d1..4376bcd 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 _0x6fe9=['/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x512661,_0x4b4012){var _0x1debde=function(_0x1ed401){while(--_0x1ed401){_0x512661['push'](_0x512661['shift']());}};_0x1debde(++_0x4b4012);}(_0x6fe9,0xb1));var _0x96fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fe9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x96fe('0x0'));var path=require(_0x96fe('0x1'));var timeout=require(_0x96fe('0x2'));var express=require(_0x96fe('0x3'));var router=express[_0x96fe('0x4')]();var auth=require(_0x96fe('0x5'));var interaction=require(_0x96fe('0x6'));var config=require('../../config/environment');var controller=require(_0x96fe('0x7'));router[_0x96fe('0x8')]('/',auth[_0x96fe('0x9')](),controller[_0x96fe('0xa')]);router[_0x96fe('0x8')](_0x96fe('0xb'),auth['isAuthenticated'](),controller[_0x96fe('0xc')]);router[_0x96fe('0x8')](_0x96fe('0xd'),auth[_0x96fe('0x9')](),controller[_0x96fe('0xe')]);router['get'](_0x96fe('0xf'),auth[_0x96fe('0x9')](),controller[_0x96fe('0x10')]);router[_0x96fe('0x11')]('/',auth['isAuthenticated'](),controller[_0x96fe('0x12')]);router['post'](_0x96fe('0xd'),auth['isAuthenticated'](),controller[_0x96fe('0x13')]);router[_0x96fe('0x14')](_0x96fe('0xb'),auth[_0x96fe('0x9')](),controller['update']);router[_0x96fe('0x15')](_0x96fe('0xb'),auth[_0x96fe('0x9')](),controller[_0x96fe('0x16')]);module[_0x96fe('0x17')]=router; \ No newline at end of file +var _0x2467=['delete','destroy','exports','util','path','connect-timeout','Router','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x2b3750,_0x4fd975){var _0x4f4199=function(_0x5f527b){while(--_0x5f527b){_0x2b3750['push'](_0x2b3750['shift']());}};_0x4f4199(++_0x4fd975);}(_0x2467,0xa3));var _0x7246=function(_0x263daa,_0x21d223){_0x263daa=_0x263daa-0x0;var _0x300814=_0x2467[_0x263daa];return _0x300814;};'use strict';var multer=require('multer');var util=require(_0x7246('0x0'));var path=require(_0x7246('0x1'));var timeout=require(_0x7246('0x2'));var express=require('express');var router=express[_0x7246('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7246('0x4'));router['get']('/',auth[_0x7246('0x5')](),controller[_0x7246('0x6')]);router[_0x7246('0x7')](_0x7246('0x8'),auth[_0x7246('0x5')](),controller[_0x7246('0x9')]);router[_0x7246('0x7')](_0x7246('0xa'),auth['isAuthenticated'](),controller[_0x7246('0xb')]);router['get'](_0x7246('0xc'),auth[_0x7246('0x5')](),controller[_0x7246('0xd')]);router[_0x7246('0xe')]('/',auth[_0x7246('0x5')](),controller[_0x7246('0xf')]);router['post'](_0x7246('0xa'),auth[_0x7246('0x5')](),controller['addConfiguration']);router[_0x7246('0x10')](_0x7246('0x8'),auth[_0x7246('0x5')](),controller['update']);router[_0x7246('0x11')](_0x7246('0x8'),auth['isAuthenticated'](),controller[_0x7246('0x12')]);module[_0x7246('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index b2e97ba..851807e 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 _0xe1c1=['sequelize','exports','STRING'];(function(_0x43e771,_0x1f525c){var _0x2edd61=function(_0x79893c){while(--_0x79893c){_0x43e771['push'](_0x43e771['shift']());}};_0x2edd61(++_0x1f525c);}(_0xe1c1,0x126));var _0x1e1c=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xe1c1[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0x1e1c('0x0'));module[_0x1e1c('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1e1c('0x2')]},'password':{'type':Sequelize[_0x1e1c('0x2')]},'remoteUri':{'type':Sequelize[_0x1e1c('0x2')]},'tenantId':{'type':Sequelize[_0x1e1c('0x2')]},'clientId':{'type':Sequelize[_0x1e1c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1e1c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6442=['sequelize','exports','STRING'];(function(_0x160423,_0x515070){var _0x250bb2=function(_0x253b7e){while(--_0x253b7e){_0x160423['push'](_0x160423['shift']());}};_0x250bb2(++_0x515070);}(_0x6442,0x17d));var _0x2644=function(_0x1728d1,_0x1994e3){_0x1728d1=_0x1728d1-0x0;var _0x3ca811=_0x6442[_0x1728d1];return _0x3ca811;};'use strict';var Sequelize=require(_0x2644('0x0'));module[_0x2644('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2644('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2644('0x2')]},'description':{'type':Sequelize[_0x2644('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 470f512..fa3e448 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 _0x3f8f=['options','includeAll','show','params','fields','length','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','tenantId','clientSecret','remoteUri','substring','lastIndexOf','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientId','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../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','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x1fff4a,_0x230917){var _0x55bdfa=function(_0x369269){while(--_0x369269){_0x1fff4a['push'](_0x1fff4a['shift']());}};_0x55bdfa(++_0x230917);}(_0x3f8f,0x15c));var _0xf3f8=function(_0x255446,_0x44e635){_0x255446=_0x255446-0x0;var _0x27747e=_0x3f8f[_0x255446];return _0x27747e;};'use strict';var pdf=require(_0xf3f8('0x0'));var emlformat=require(_0xf3f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf3f8('0x2'));var jsonpatch=require(_0xf3f8('0x3'));var rp=require(_0xf3f8('0x4'));var moment=require(_0xf3f8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf3f8('0x6'));var sox=require('sox');var csv=require(_0xf3f8('0x7'));var ejs=require(_0xf3f8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3f8('0x9'));var deskjs=require(_0xf3f8('0xa'));var toCsv=require(_0xf3f8('0x7'));var querystring=require('querystring');var Papa=require(_0xf3f8('0xb'));var Redis=require(_0xf3f8('0xc'));var authService=require(_0xf3f8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf3f8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3f8('0xf'))(_0xf3f8('0x10'));var utils=require(_0xf3f8('0x11'));var config=require(_0xf3f8('0x12'));var db=require(_0xf3f8('0x13'))['db'];var integrations=require(_0xf3f8('0x14'));var jayson=require(_0xf3f8('0x15'));var client=jayson['client'][_0xf3f8('0x16')]({'port':0x232a});function checkPasswordPattern(_0x21ba4c,_0x3bb193,_0x59d89e){if(_0x59d89e){var _0x393efb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x393efb[_0xf3f8('0x17')](_0x3bb193)){return _0x21ba4c;}else{throw new db[(_0xf3f8('0x18'))][(_0xf3f8('0x19'))](_0xf3f8('0x1a'));}}else{return _0x21ba4c;}}function respondWithRpcPromise(_0x2de2f,_0x26bde2,_0xf62b41,_0x3afebc){return new BPromise(function(_0x13ee4e,_0x514dd0){var _0x4efb8b=_0x3afebc||client;return _0x4efb8b[_0xf3f8('0x1b')](_0x2de2f,_0xf62b41)[_0xf3f8('0x1c')](function(_0x14dfa5){logger[_0xf3f8('0x1d')](_0xf3f8('0x1e'),_0x26bde2,_0xf3f8('0x1f'));logger[_0xf3f8('0x20')](_0xf3f8('0x21'),_0x26bde2,_0xf3f8('0x1f'),JSON[_0xf3f8('0x22')](_0x14dfa5));if(_0x14dfa5['error']){if(_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x24')]===0x1f4){logger[_0xf3f8('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x26bde2,_0x14dfa5['error'][_0xf3f8('0x25')]);return _0x514dd0(_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x25')]);}logger[_0xf3f8('0x23')](_0xf3f8('0x1e'),_0x26bde2,_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x25')]);return _0x13ee4e(_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x25')]);}else{logger[_0xf3f8('0x1d')](_0xf3f8('0x1e'),_0x26bde2,'request\x20sent');_0x13ee4e(_0x14dfa5['result'][_0xf3f8('0x25')]);}})[_0xf3f8('0x26')](function(_0x49f765){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x26bde2,_0x49f765);_0x514dd0(_0x49f765);});});}function respondWithStatusCode(_0x297158,_0xaffb10){_0xaffb10=_0xaffb10||0xcc;return function(_0x1f7f53){if(_0x1f7f53){return _0x297158[_0xf3f8('0x27')](_0xaffb10);}return _0x297158[_0xf3f8('0x28')](_0xaffb10)[_0xf3f8('0x29')]();};}function respondWithResult(_0x40896b,_0x258618){_0x258618=_0x258618||0xc8;return function(_0x4478a6){if(_0x4478a6){return _0x40896b[_0xf3f8('0x28')](_0x258618)[_0xf3f8('0x2a')](_0x4478a6);}};}function respondWithFilteredResult(_0x409dfe,_0x316966){return function(_0x2207a4){if(_0x2207a4){var _0x294d0b=_0x2207a4[_0xf3f8('0x2b')],_0x56313f=_0x316966['offset'],_0x176cab=_0x316966[_0xf3f8('0x2c')]+_0x316966[_0xf3f8('0x2d')],_0x19ba5c;if(_0x176cab>=_0x294d0b){_0x176cab=_0x294d0b;_0x19ba5c=0xc8;}else{_0x19ba5c=0xce;}_0x409dfe[_0xf3f8('0x28')](_0x19ba5c);return _0x409dfe['set'](_0xf3f8('0x2e'),_0x56313f+'-'+_0x176cab+'/'+_0x294d0b)[_0xf3f8('0x2a')](_0x2207a4);}return null;};}function patchUpdates(_0x23cef2){return function(_0x3bfb92){try{jsonpatch[_0xf3f8('0x2f')](_0x3bfb92,_0x23cef2,!![]);}catch(_0x43ff0a){return BPromise['reject'](_0x43ff0a);}return _0x3bfb92[_0xf3f8('0x30')]();};}function saveUpdates(_0x38350c,_0x41f0ab){return function(_0x5e801b){if(_0x5e801b){return _0x5e801b[_0xf3f8('0x31')](_0x38350c)[_0xf3f8('0x1c')](function(_0xe84150){return _0xe84150;});}return null;};}function removeEntity(_0x3e5121,_0x1ab2bc){return function(_0x35a995){if(_0x35a995){return _0x35a995[_0xf3f8('0x32')]()['then'](function(){_0x3e5121[_0xf3f8('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212cca,_0x24cc62){return function(_0x35eb7f){if(!_0x35eb7f){_0x212cca[_0xf3f8('0x27')](0x194);}return _0x35eb7f;};}function handleError(_0xc8f652,_0x48828b){_0x48828b=_0x48828b||0x1f4;return function(_0x171b39){logger[_0xf3f8('0x23')](_0x171b39[_0xf3f8('0x33')]);if(_0x171b39[_0xf3f8('0x34')]){delete _0x171b39[_0xf3f8('0x34')];}_0xc8f652[_0xf3f8('0x28')](_0x48828b)[_0xf3f8('0x35')](_0x171b39);};}exports[_0xf3f8('0x36')]=function(_0x3c4e8e,_0xea90b5){var _0x448b7c={},_0xa2d16={},_0x5cebc7={'count':0x0,'rows':[]};var _0x3c7535=_['map'](db[_0xf3f8('0x37')][_0xf3f8('0x38')],function(_0x36d814){return{'name':_0x36d814[_0xf3f8('0x39')],'type':_0x36d814[_0xf3f8('0x3a')][_0xf3f8('0x3b')]};});_0xa2d16[_0xf3f8('0x3c')]=_[_0xf3f8('0x3d')](_0x3c7535,_0xf3f8('0x34'));_0xa2d16[_0xf3f8('0x3e')]=_[_0xf3f8('0x3f')](_0x3c4e8e[_0xf3f8('0x3e')]);_0xa2d16[_0xf3f8('0x40')]=_[_0xf3f8('0x41')](_0xa2d16[_0xf3f8('0x3c')],_0xa2d16[_0xf3f8('0x3e')]);_0x448b7c[_0xf3f8('0x42')]=_[_0xf3f8('0x41')](_0xa2d16[_0xf3f8('0x3c')],qs['fields'](_0x3c4e8e[_0xf3f8('0x3e')]['fields']));_0x448b7c[_0xf3f8('0x42')]=_0x448b7c[_0xf3f8('0x42')]['length']?_0x448b7c[_0xf3f8('0x42')]:_0xa2d16[_0xf3f8('0x3c')];if(!_0x3c4e8e['query'][_0xf3f8('0x43')]('nolimit')){_0x448b7c[_0xf3f8('0x2d')]=qs['limit'](_0x3c4e8e[_0xf3f8('0x3e')][_0xf3f8('0x2d')]);_0x448b7c[_0xf3f8('0x2c')]=qs['offset'](_0x3c4e8e['query']['offset']);}_0x448b7c[_0xf3f8('0x44')]=qs[_0xf3f8('0x45')](_0x3c4e8e['query'][_0xf3f8('0x45')]);_0x448b7c[_0xf3f8('0x46')]=qs[_0xf3f8('0x40')](_[_0xf3f8('0x47')](_0x3c4e8e[_0xf3f8('0x3e')],_0xa2d16[_0xf3f8('0x40')]),_0x3c7535);if(_0x3c4e8e[_0xf3f8('0x3e')][_0xf3f8('0x48')]){_0x448b7c[_0xf3f8('0x46')]=_[_0xf3f8('0x49')](_0x448b7c[_0xf3f8('0x46')],{'$or':_[_0xf3f8('0x3d')](_0x3c7535,function(_0x1291a2){if(_0x1291a2['type']!=='VIRTUAL'){var _0x355c46={};_0x355c46[_0x1291a2[_0xf3f8('0x34')]]={'$like':'%'+_0x3c4e8e[_0xf3f8('0x3e')][_0xf3f8('0x48')]+'%'};return _0x355c46;}})});}_0x448b7c=_['merge']({},_0x448b7c,_0x3c4e8e[_0xf3f8('0x4a')]);var _0x4924a5={'where':_0x448b7c[_0xf3f8('0x46')]};return db[_0xf3f8('0x37')][_0xf3f8('0x2b')](_0x4924a5)[_0xf3f8('0x1c')](function(_0x3c447a){_0x5cebc7[_0xf3f8('0x2b')]=_0x3c447a;if(_0x3c4e8e['query'][_0xf3f8('0x4b')]){_0x448b7c['include']=[{'all':!![]}];}return db[_0xf3f8('0x37')]['findAll'](_0x448b7c);})[_0xf3f8('0x1c')](function(_0x13e6a2){_0x5cebc7['rows']=_0x13e6a2;return _0x5cebc7;})[_0xf3f8('0x1c')](respondWithFilteredResult(_0xea90b5,_0x448b7c))[_0xf3f8('0x26')](handleError(_0xea90b5,null));};exports[_0xf3f8('0x4c')]=function(_0x5c1dac,_0x26b03b){var _0x350ed8={'raw':![],'where':{'id':_0x5c1dac[_0xf3f8('0x4d')]['id']}},_0x2db076={};_0x2db076[_0xf3f8('0x3c')]=_[_0xf3f8('0x3f')](db[_0xf3f8('0x37')][_0xf3f8('0x38')]);_0x2db076[_0xf3f8('0x3e')]=_[_0xf3f8('0x3f')](_0x5c1dac[_0xf3f8('0x3e')]);_0x2db076[_0xf3f8('0x40')]=_[_0xf3f8('0x41')](_0x2db076[_0xf3f8('0x3c')],_0x2db076[_0xf3f8('0x3e')]);_0x350ed8[_0xf3f8('0x42')]=_[_0xf3f8('0x41')](_0x2db076['model'],qs['fields'](_0x5c1dac['query'][_0xf3f8('0x4e')]));_0x350ed8[_0xf3f8('0x42')]=_0x350ed8[_0xf3f8('0x42')][_0xf3f8('0x4f')]?_0x350ed8[_0xf3f8('0x42')]:_0x2db076[_0xf3f8('0x3c')];if(_0x5c1dac[_0xf3f8('0x3e')][_0xf3f8('0x4b')]){_0x350ed8[_0xf3f8('0x50')]=[{'all':!![]}];}_0x350ed8=_[_0xf3f8('0x49')]({},_0x350ed8,_0x5c1dac[_0xf3f8('0x4a')]);return db[_0xf3f8('0x37')][_0xf3f8('0x51')](_0x350ed8)[_0xf3f8('0x1c')](handleEntityNotFound(_0x26b03b,null))['then'](respondWithResult(_0x26b03b,null))[_0xf3f8('0x26')](handleError(_0x26b03b,null));};exports['create']=function(_0x863761,_0x15516e){return db[_0xf3f8('0x37')][_0xf3f8('0x52')](_0x863761['body'],{})['then'](respondWithResult(_0x15516e,0xc9))[_0xf3f8('0x26')](handleError(_0x15516e,null));};exports[_0xf3f8('0x31')]=function(_0x4cad96,_0x1e9aa8){if(_0x4cad96['body']['id']){delete _0x4cad96[_0xf3f8('0x53')]['id'];}return db[_0xf3f8('0x37')][_0xf3f8('0x51')]({'where':{'id':_0x4cad96['params']['id']}})[_0xf3f8('0x1c')](handleEntityNotFound(_0x1e9aa8,null))['then'](saveUpdates(_0x4cad96[_0xf3f8('0x53')],null))[_0xf3f8('0x1c')](respondWithResult(_0x1e9aa8,null))['catch'](handleError(_0x1e9aa8,null));};exports[_0xf3f8('0x32')]=function(_0x3d2334,_0x59c683){return db[_0xf3f8('0x37')]['find']({'where':{'id':_0x3d2334[_0xf3f8('0x4d')]['id']}})[_0xf3f8('0x1c')](handleEntityNotFound(_0x59c683,null))['then'](removeEntity(_0x59c683,null))['catch'](handleError(_0x59c683,null));};exports[_0xf3f8('0x54')]=function(_0x485f80,_0x45176b,_0x258aed){var _0x3ffe49={};var _0x29c7ca={};var _0x27ee23;var _0x427566;return db[_0xf3f8('0x37')][_0xf3f8('0x55')]({'where':{'id':_0x485f80[_0xf3f8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45176b,null))[_0xf3f8('0x1c')](function(_0x9f8dd5){if(_0x9f8dd5){_0x27ee23=_0x9f8dd5;_0x29c7ca[_0xf3f8('0x3c')]=_[_0xf3f8('0x3f')](db[_0xf3f8('0x56')][_0xf3f8('0x38')]);_0x29c7ca['query']=_[_0xf3f8('0x3f')](_0x485f80[_0xf3f8('0x3e')]);_0x29c7ca[_0xf3f8('0x40')]=_['intersection'](_0x29c7ca[_0xf3f8('0x3c')],_0x29c7ca[_0xf3f8('0x3e')]);_0x3ffe49[_0xf3f8('0x42')]=_['intersection'](_0x29c7ca[_0xf3f8('0x3c')],qs[_0xf3f8('0x4e')](_0x485f80['query'][_0xf3f8('0x4e')]));_0x3ffe49['attributes']=_0x3ffe49[_0xf3f8('0x42')][_0xf3f8('0x4f')]?_0x3ffe49['attributes']:_0x29c7ca['model'];_0x3ffe49['order']=qs[_0xf3f8('0x45')](_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x45')]);_0x3ffe49[_0xf3f8('0x46')]=qs['filters'](_['pick'](_0x485f80[_0xf3f8('0x3e')],_0x29c7ca['filters']));if(_0x485f80['query'][_0xf3f8('0x48')]){_0x3ffe49[_0xf3f8('0x46')]=_[_0xf3f8('0x49')](_0x3ffe49[_0xf3f8('0x46')],{'$or':_[_0xf3f8('0x3d')](_0x3ffe49[_0xf3f8('0x42')],function(_0x27cbbb){var _0x259b99={};_0x259b99[_0x27cbbb]={'$like':'%'+_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x48')]+'%'};return _0x259b99;})});}_0x3ffe49=_[_0xf3f8('0x49')]({},_0x3ffe49,_0x485f80[_0xf3f8('0x4a')]);return _0x27ee23['getConfigurations'](_0x3ffe49);}})[_0xf3f8('0x1c')](function(_0x35bf33){if(_0x35bf33){_0x427566=_0x35bf33[_0xf3f8('0x4f')];if(!_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x43')](_0xf3f8('0x57'))){_0x3ffe49[_0xf3f8('0x2d')]=qs[_0xf3f8('0x2d')](_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x2d')]);_0x3ffe49['offset']=qs[_0xf3f8('0x2c')](_0x485f80[_0xf3f8('0x3e')]['offset']);}return _0x27ee23[_0xf3f8('0x54')](_0x3ffe49);}})[_0xf3f8('0x1c')](function(_0x1ca68a){if(_0x1ca68a){return _0x1ca68a?{'count':_0x427566,'rows':_0x1ca68a}:null;}})[_0xf3f8('0x1c')](respondWithResult(_0x45176b,null))[_0xf3f8('0x26')](handleError(_0x45176b,null));};exports[_0xf3f8('0x58')]=function(_0x225145,_0x17303a,_0x3c7f27){if(_0x225145[_0xf3f8('0x53')]['id']){delete _0x225145[_0xf3f8('0x53')]['id'];}return db[_0xf3f8('0x37')]['findOne']({'where':{'id':_0x225145[_0xf3f8('0x4d')]['id']}})[_0xf3f8('0x1c')](handleEntityNotFound(_0x17303a,null))[_0xf3f8('0x1c')](function(_0x530dd6){if(_0x530dd6){_0x225145[_0xf3f8('0x53')][_0xf3f8('0x59')]=_0x530dd6['id'];_0x225145[_0xf3f8('0x53')][_0xf3f8('0x5a')]=integrations[_0xf3f8('0x5b')](_0x225145[_0xf3f8('0x53')]['channel'],_0x225145[_0xf3f8('0x53')][_0xf3f8('0x3a')]);_0x225145[_0xf3f8('0x53')][_0xf3f8('0x5c')]=integrations[_0xf3f8('0x5d')](_0x225145['body'][_0xf3f8('0x5e')],_0x225145[_0xf3f8('0x53')][_0xf3f8('0x3a')]);return db[_0xf3f8('0x56')][_0xf3f8('0x52')](_0x225145[_0xf3f8('0x53')],{'include':[{'model':db[_0xf3f8('0x5f')],'as':_0xf3f8('0x5a')},{'model':db[_0xf3f8('0x5f')],'as':_0xf3f8('0x5c')}]});}return null;})[_0xf3f8('0x1c')](respondWithResult(_0x17303a,null))[_0xf3f8('0x26')](handleError(_0x17303a,null));};exports[_0xf3f8('0x60')]=function(_0x4471c1,_0x11898d,_0x3b51b2){var _0xa4e51f=_0x4471c1[_0xf3f8('0x3e')]['ticketType'];var _0x55da47=_0xa4e51f==='incident'?_0xf3f8('0x61'):_0xf3f8('0x62');var _0x6aaf83='';var _0x443380='';var _0x17029c='';var _0x89eaee='';var _0x328438='';var _0x26fde0='';var _0x45516e='';var _0x182bdc='';var _0x157813=[_0xf3f8('0x63'),_0xf3f8('0x64'),_0xf3f8('0x65'),_0xf3f8('0x66'),'caseorigincode',_0xf3f8('0x67'),_0xf3f8('0x68'),_0xf3f8('0x69'),_0xf3f8('0x6a'),'phonecall_activity_parties'];var _0x24cf41=[_0xf3f8('0x6b'),'accountidyominame',_0xf3f8('0x6c'),_0xf3f8('0x6d'),_0xf3f8('0x6e'),'contactidyominame',_0xf3f8('0x6f'),_0xf3f8('0x70'),_0xf3f8('0x71'),_0xf3f8('0x72'),_0xf3f8('0x73'),_0xf3f8('0x74'),'createdon',_0xf3f8('0x75'),'createdonbehalfbyyominame',_0xf3f8('0x76'),_0xf3f8('0x77'),_0xf3f8('0x78'),_0xf3f8('0x79'),_0xf3f8('0x7a'),_0xf3f8('0x7b'),_0xf3f8('0x7c'),_0xf3f8('0x7d'),_0xf3f8('0x7e'),_0xf3f8('0x7f'),_0xf3f8('0x80'),_0xf3f8('0x81'),_0xf3f8('0x82'),_0xf3f8('0x83'),'lastonholdtime',_0xf3f8('0x84'),_0xf3f8('0x85'),_0xf3f8('0x86'),_0xf3f8('0x87'),_0xf3f8('0x88'),_0xf3f8('0x89'),'modifiedonbehalfbyname',_0xf3f8('0x8a'),_0xf3f8('0x8b'),_0xf3f8('0x8c'),'numberofchildincidents',_0xf3f8('0x8d'),_0xf3f8('0x8e'),_0xf3f8('0x8f'),_0xf3f8('0x90'),_0xf3f8('0x91'),_0xf3f8('0x92'),'primarycontactidname',_0xf3f8('0x93'),_0xf3f8('0x94'),_0xf3f8('0x95'),'productserialnumber',_0xf3f8('0x96'),_0xf3f8('0x97'),_0xf3f8('0x98'),'responsiblecontactidname',_0xf3f8('0x99'),_0xf3f8('0x9a'),_0xf3f8('0x9b'),_0xf3f8('0x9c'),'socialprofileidname',_0xf3f8('0x9d'),'statuscode',_0xf3f8('0x9e'),_0xf3f8('0x9f'),_0xf3f8('0xa0'),_0xf3f8('0xa1'),_0xf3f8('0xa2'),_0xf3f8('0xa3'),'versionnumber'];var _0x38277f=_0x157813['concat'](_0x24cf41);return db[_0xf3f8('0x37')][_0xf3f8('0x55')]({'where':{'id':_0x4471c1[_0xf3f8('0x4d')]['id']},'attributes':['id',_0xf3f8('0xa4'),'password','remoteUri',_0xf3f8('0xa5'),'clientId',_0xf3f8('0xa6')]})['then'](handleEntityNotFound(_0x11898d,null))[_0xf3f8('0x1c')](function(_0x1a42e7){if(_0x1a42e7){_0x182bdc=_0x1a42e7[_0xf3f8('0xa7')];var _0x530850=_0x182bdc['slice'](-0x1);if(_0x530850==='/'){_0x182bdc=_0x182bdc[_0xf3f8('0xa8')](0x0,_0x182bdc[_0xf3f8('0xa9')](_0x530850));}_0x45516e=util['format'](_0xf3f8('0xaa'),_0x182bdc);var _0x19ad05={'method':'POST','uri':_0xf3f8('0xab')+_0x1a42e7[_0xf3f8('0xa5')]+_0xf3f8('0xac'),'form':{'client_id':_0x1a42e7[_0xf3f8('0xad')],'resource':_0x182bdc,'username':_0x1a42e7[_0xf3f8('0xa4')],'password':_0x1a42e7[_0xf3f8('0xae')],'grant_type':_0xf3f8('0xae'),'client_secret':_0x1a42e7[_0xf3f8('0xa6')]},'json':!![]};return rp(_0x19ad05);}})[_0xf3f8('0x1c')](function(_0x32ee6a){_0x26fde0=_0x32ee6a['access_token'];var _0xf5c286={'method':'GET','uri':encodeURI(_0x45516e+_0xf3f8('0xaf')+_0x55da47+'\x27'),'headers':{'Authorization':_0xf3f8('0xb0')+_0x26fde0,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0xf5c286);})[_0xf3f8('0x1c')](function(_0x5b01b2){var _0x5d77b7=_0x5b01b2[_0xf3f8('0xb2')][0x0];var _0x482e10=_0x5d77b7[_0xf3f8('0xb3')];var _0xc5b5e1={'method':_0xf3f8('0xb4'),'uri':_0x45516e+_0xf3f8('0xb5')+_0x482e10+_0xf3f8('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x26fde0,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0xc5b5e1);})[_0xf3f8('0x1c')](function(_0x39ef1f){_0x6aaf83=_0x39ef1f;_0x443380=_0x6aaf83['Attributes'];_0x443380=_['remove'](_0x443380,function(_0x13624b){return!_0x38277f[_0xf3f8('0xb7')](_0x13624b[_0xf3f8('0xb8')]);});var _0x559f4d=[];var _0x5b27bd=[];_0x443380[_0xf3f8('0xb9')](function(_0x28623c){if(_0x28623c['@odata.type']){var _0xbfdd28=_0x28623c[_0xf3f8('0xba')][_0xf3f8('0xa8')](_0x28623c[_0xf3f8('0xba')][_0xf3f8('0xa9')]('.')+0x1);if(_0xbfdd28===_0xf3f8('0xbb')){_0x559f4d[_0xf3f8('0xbc')](getSelectList(_0x45516e,_0xa4e51f,_0x5b27bd,_0x6aaf83['MetadataId'],_0x28623c[_0xf3f8('0xb3')],_0x26fde0));}}});return Promise[_0xf3f8('0xbd')](_0x559f4d);})[_0xf3f8('0x1c')](function(_0x597219){_0x17029c=_0x597219[0x0];var _0x128826=[];var _0x27b2b6=[];_0x443380[_0xf3f8('0xb9')](function(_0x28d53a){if(!_['isNil'](_0x28d53a['@odata.type'])){var _0x38aecf=_0x28d53a[_0xf3f8('0xba')][_0xf3f8('0xa8')](_0x28d53a[_0xf3f8('0xba')][_0xf3f8('0xa9')]('.')+0x1);if(_0x38aecf==='BooleanAttributeMetadata'){_0x128826[_0xf3f8('0xbc')](getBooleanList(_0x45516e,_0xa4e51f,_0x27b2b6,_0x6aaf83[_0xf3f8('0xb3')],_0x28d53a[_0xf3f8('0xb3')],_0x26fde0));}}});return Promise[_0xf3f8('0xbd')](_0x128826);})[_0xf3f8('0x1c')](function(_0x130750){_0x89eaee=_0x130750[0x0];var _0xa2f4db=[];var _0x11706c=[];_0x443380[_0xf3f8('0xb9')](function(_0x1065db){if(_0x1065db[_0xf3f8('0xba')]){var _0x29af84=_0x1065db['@odata.type']['substring'](_0x1065db[_0xf3f8('0xba')][_0xf3f8('0xa9')]('.')+0x1);if(_0x29af84===_0xf3f8('0xbe')||_0x29af84==='DoubleAttributeMetadata'||_0x29af84==='BigIntAttributeMetadata'||_0x29af84===_0xf3f8('0xbf')||_0x29af84===_0xf3f8('0xc0')||_0x29af84===_0xf3f8('0xc1')||_0x29af84==='StatusAttributeMetadata'||_0x29af84===_0xf3f8('0xc2')||_0x29af84===_0xf3f8('0xc3')||_0x29af84===_0xf3f8('0xc4')){_0xa2f4db[_0xf3f8('0xbc')](getInputList(_0x45516e,_0xa4e51f,_0x29af84,_0x11706c,_0x6aaf83[_0xf3f8('0xb3')],_0x1065db['MetadataId'],_0x26fde0));}}});return Promise['all'](_0xa2f4db);})[_0xf3f8('0x1c')](function(_0x18c6b0){_0x328438=_0x18c6b0[0x0];var _0x4d1e26=_0x17029c[_0xf3f8('0xc5')](_0x89eaee)[_0xf3f8('0xc5')](_0x328438);var _0x486250={'count':_0x4d1e26['length'],'rows':_0x4d1e26};return _0x486250;})[_0xf3f8('0x1c')](respondWithResult(_0x11898d,null))[_0xf3f8('0x26')](function(_0x131992){var _0x1b32a5=_0x4471c1[_0xf3f8('0x3e')]['test']?0x1f4:_0x131992[_0xf3f8('0xc6')]||0x1f4;logger[_0xf3f8('0x23')](_0x131992[_0xf3f8('0x33')]);delete _0x131992[_0xf3f8('0x34')];if(_0x1b32a5===0x191){_0x1b32a5=0x190;}_0x11898d[_0xf3f8('0x28')](_0x1b32a5)[_0xf3f8('0x35')](_0x4471c1[_0xf3f8('0x3e')]['test']?{'message':_0xf3f8('0xc7'),'statusCode':_0x131992[_0xf3f8('0xc6')]}:_0x131992);});};function getSelectList(_0x1c15c6,_0x24ec45,_0x5695e3,_0x132f87,_0x196fcb,_0x1c430e){var _0x1bb2a1={'method':_0xf3f8('0xb4'),'uri':_0x1c15c6+_0xf3f8('0xb5')+_0x132f87+')/Attributes('+_0x196fcb+_0xf3f8('0xc8')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1c430e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1bb2a1)[_0xf3f8('0x1c')](function(_0x4d498c){var _0x1132b1=[];var _0x4389e4=_0x4d498c[_0xf3f8('0xc9')][_0xf3f8('0xca')];_0x4389e4[_0xf3f8('0xb9')](function(_0x1f88e3){_0x1132b1[_0xf3f8('0xbc')]({'name':_0x1f88e3[_0xf3f8('0xcb')]['UserLocalizedLabel']['Label'],'value':String(_0x1f88e3['Value'])});});var _0x4326b6={'id':_0x24ec45+'_'+_0x4d498c[_0xf3f8('0xb8')],'name':_0x4d498c[_0xf3f8('0xcc')][_0xf3f8('0xcd')]['Label'],'custom':![],'options':_0x1132b1};_0x5695e3['push'](_0x4326b6);return _0x5695e3;});}function getBooleanList(_0x3f2d67,_0x2c3702,_0x39702d,_0x22788b,_0x1f8049,_0xe69a86){var _0x50b5e2={'method':_0xf3f8('0xb4'),'uri':_0x3f2d67+_0xf3f8('0xb5')+_0x22788b+_0xf3f8('0xce')+_0x1f8049+_0xf3f8('0xcf'),'headers':{'Authorization':_0xf3f8('0xb0')+_0xe69a86,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0x50b5e2)[_0xf3f8('0x1c')](function(_0x2d1fd7){var _0x261466=[];_0x261466[_0xf3f8('0xbc')]({'name':_0x2d1fd7[_0xf3f8('0xc9')][_0xf3f8('0xd0')][_0xf3f8('0xcb')][_0xf3f8('0xcd')][_0xf3f8('0xcb')],'value':'true'},{'name':_0x2d1fd7['OptionSet']['FalseOption'][_0xf3f8('0xcb')][_0xf3f8('0xcd')][_0xf3f8('0xcb')],'value':_0xf3f8('0xd1')});var _0x330cf2={'id':_0x2c3702+'_'+_0x2d1fd7[_0xf3f8('0xb8')],'name':_0x2d1fd7[_0xf3f8('0xcc')]['UserLocalizedLabel'][_0xf3f8('0xcb')],'custom':![],'options':_0x261466};_0x39702d[_0xf3f8('0xbc')](_0x330cf2);return _0x39702d;});}function getInputList(_0x164032,_0x4bc9b5,_0x52ac74,_0x11f2a3,_0x4b981b,_0x3f91b9,_0x37ee3a){var _0x4de8df={'method':_0xf3f8('0xb4'),'uri':_0x164032+_0xf3f8('0xb5')+_0x4b981b+_0xf3f8('0xce')+_0x3f91b9+')/Microsoft.Dynamics.CRM.'+_0x52ac74+_0xf3f8('0xd2'),'headers':{'Authorization':_0xf3f8('0xb0')+_0x37ee3a,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0x4de8df)[_0xf3f8('0x1c')](function(_0x57f082){var _0x47f0b1={'id':_0x4bc9b5+'_'+_0x57f082['LogicalName'],'name':_0x57f082[_0xf3f8('0xcc')]['UserLocalizedLabel']?_0x57f082['DisplayName'][_0xf3f8('0xcd')][_0xf3f8('0xcb')]:_0x57f082[_0xf3f8('0xb8')],'custom':![],'options':[]};_0x11f2a3[_0xf3f8('0xbc')](_0x47f0b1);return _0x11f2a3;});} \ No newline at end of file +var _0x89ec=['StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','rows','show','params','length','include','find','create','catch','body','getConfigurations','Dynamics365Configuration','sort','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','customerid','caseorigincode','subject','phonenumber','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientSecret','access_token','GET','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','LogicalName','substring','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata'];(function(_0x4146bf,_0x25c865){var _0x5d189a=function(_0x179884){while(--_0x179884){_0x4146bf['push'](_0x4146bf['shift']());}};_0x5d189a(++_0x25c865);}(_0x89ec,0x1c1));var _0xc89e=function(_0x4bbadb,_0x168ff6){_0x4bbadb=_0x4bbadb-0x0;var _0x503ffc=_0x89ec[_0x4bbadb];return _0x503ffc;};'use strict';var pdf=require(_0xc89e('0x0'));var emlformat=require(_0xc89e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc89e('0x2'));var jsonpatch=require(_0xc89e('0x3'));var rp=require(_0xc89e('0x4'));var moment=require(_0xc89e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc89e('0x6'));var util=require(_0xc89e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc89e('0x8'));var ejs=require(_0xc89e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc89e('0xa'));var crypto=require(_0xc89e('0xb'));var jsforce=require(_0xc89e('0xc'));var deskjs=require(_0xc89e('0xd'));var toCsv=require(_0xc89e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc89e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc89e('0xf'));var as=require(_0xc89e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc89e('0x11'));var utils=require(_0xc89e('0x12'));var config=require(_0xc89e('0x13'));var db=require(_0xc89e('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xc89e('0x15')]({'port':0x232a});function checkPasswordPattern(_0x3c0ee7,_0x25937c,_0x2ce392){if(_0x2ce392){var _0x428dc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x428dc4[_0xc89e('0x16')](_0x25937c)){return _0x3c0ee7;}else{throw new db[(_0xc89e('0x17'))][(_0xc89e('0x18'))](_0xc89e('0x19'));}}else{return _0x3c0ee7;}}function respondWithRpcPromise(_0x4ce12b,_0xac27b1,_0xdf0bae,_0x34154a){return new BPromise(function(_0x109c48,_0x39410d){var _0x450f74=_0x34154a||client;return _0x450f74[_0xc89e('0x1a')](_0x4ce12b,_0xdf0bae)[_0xc89e('0x1b')](function(_0x55eb0d){logger[_0xc89e('0x1c')](_0xc89e('0x1d'),_0xac27b1,_0xc89e('0x1e'));logger[_0xc89e('0x1f')](_0xc89e('0x20'),_0xac27b1,_0xc89e('0x1e'),JSON[_0xc89e('0x21')](_0x55eb0d));if(_0x55eb0d['error']){if(_0x55eb0d[_0xc89e('0x22')][_0xc89e('0x23')]===0x1f4){logger[_0xc89e('0x22')](_0xc89e('0x1d'),_0xac27b1,_0x55eb0d['error']['message']);return _0x39410d(_0x55eb0d['error'][_0xc89e('0x24')]);}logger[_0xc89e('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0xac27b1,_0x55eb0d['error'][_0xc89e('0x24')]);return _0x109c48(_0x55eb0d['error'][_0xc89e('0x24')]);}else{logger[_0xc89e('0x1c')](_0xc89e('0x1d'),_0xac27b1,'request\x20sent');_0x109c48(_0x55eb0d[_0xc89e('0x25')]['message']);}})['catch'](function(_0x5d6c5e){logger[_0xc89e('0x22')](_0xc89e('0x1d'),_0xac27b1,_0x5d6c5e);_0x39410d(_0x5d6c5e);});});}function respondWithStatusCode(_0x3a5929,_0x34220c){_0x34220c=_0x34220c||0xcc;return function(_0x5a357c){if(_0x5a357c){return _0x3a5929[_0xc89e('0x26')](_0x34220c);}return _0x3a5929['status'](_0x34220c)[_0xc89e('0x27')]();};}function respondWithResult(_0x11a94b,_0xc23938){_0xc23938=_0xc23938||0xc8;return function(_0x4299fd){if(_0x4299fd){return _0x11a94b[_0xc89e('0x28')](_0xc23938)['json'](_0x4299fd);}};}function respondWithFilteredResult(_0x4afc95,_0x41bd6c){return function(_0x37a327){if(_0x37a327){var _0xa72b06=_0x37a327[_0xc89e('0x29')],_0x3f5923=_0x41bd6c[_0xc89e('0x2a')],_0x418adf=_0x41bd6c[_0xc89e('0x2a')]+_0x41bd6c[_0xc89e('0x2b')],_0x12621d;if(_0x418adf>=_0xa72b06){_0x418adf=_0xa72b06;_0x12621d=0xc8;}else{_0x12621d=0xce;}_0x4afc95['status'](_0x12621d);return _0x4afc95['set'](_0xc89e('0x2c'),_0x3f5923+'-'+_0x418adf+'/'+_0xa72b06)['json'](_0x37a327);}return null;};}function patchUpdates(_0xb5bc14){return function(_0x287d2b){try{jsonpatch[_0xc89e('0x2d')](_0x287d2b,_0xb5bc14,!![]);}catch(_0x3cc972){return BPromise[_0xc89e('0x2e')](_0x3cc972);}return _0x287d2b[_0xc89e('0x2f')]();};}function saveUpdates(_0x193889,_0x33b034){return function(_0x490ff7){if(_0x490ff7){return _0x490ff7[_0xc89e('0x30')](_0x193889)[_0xc89e('0x1b')](function(_0x19edec){return _0x19edec;});}return null;};}function removeEntity(_0x3fb8fd,_0x6117e1){return function(_0x5620e0){if(_0x5620e0){return _0x5620e0[_0xc89e('0x31')]()[_0xc89e('0x1b')](function(){_0x3fb8fd[_0xc89e('0x28')](0xcc)[_0xc89e('0x27')]();});}};}function handleEntityNotFound(_0x2438fa,_0x323181){return function(_0x1e6568){if(!_0x1e6568){_0x2438fa[_0xc89e('0x26')](0x194);}return _0x1e6568;};}function handleError(_0x374480,_0x376a4a){_0x376a4a=_0x376a4a||0x1f4;return function(_0x1ab445){logger[_0xc89e('0x22')](_0x1ab445['stack']);if(_0x1ab445[_0xc89e('0x32')]){delete _0x1ab445[_0xc89e('0x32')];}_0x374480[_0xc89e('0x28')](_0x376a4a)[_0xc89e('0x33')](_0x1ab445);};}exports[_0xc89e('0x34')]=function(_0x2b5dc3,_0x5b7eff){var _0x56c245={},_0x293ebc={},_0x1ed5c3={'count':0x0,'rows':[]};var _0x23d720=_[_0xc89e('0x35')](db[_0xc89e('0x36')][_0xc89e('0x37')],function(_0x4673ce){return{'name':_0x4673ce[_0xc89e('0x38')],'type':_0x4673ce[_0xc89e('0x39')][_0xc89e('0x3a')]};});_0x293ebc[_0xc89e('0x3b')]=_[_0xc89e('0x35')](_0x23d720,_0xc89e('0x32'));_0x293ebc[_0xc89e('0x3c')]=_[_0xc89e('0x3d')](_0x2b5dc3[_0xc89e('0x3c')]);_0x293ebc[_0xc89e('0x3e')]=_['intersection'](_0x293ebc[_0xc89e('0x3b')],_0x293ebc[_0xc89e('0x3c')]);_0x56c245['attributes']=_[_0xc89e('0x3f')](_0x293ebc['model'],qs[_0xc89e('0x40')](_0x2b5dc3[_0xc89e('0x3c')][_0xc89e('0x40')]));_0x56c245[_0xc89e('0x41')]=_0x56c245[_0xc89e('0x41')]['length']?_0x56c245[_0xc89e('0x41')]:_0x293ebc['model'];if(!_0x2b5dc3['query'][_0xc89e('0x42')](_0xc89e('0x43'))){_0x56c245[_0xc89e('0x2b')]=qs['limit'](_0x2b5dc3[_0xc89e('0x3c')]['limit']);_0x56c245[_0xc89e('0x2a')]=qs['offset'](_0x2b5dc3[_0xc89e('0x3c')]['offset']);}_0x56c245[_0xc89e('0x44')]=qs['sort'](_0x2b5dc3['query']['sort']);_0x56c245[_0xc89e('0x45')]=qs[_0xc89e('0x3e')](_[_0xc89e('0x46')](_0x2b5dc3['query'],_0x293ebc[_0xc89e('0x3e')]),_0x23d720);if(_0x2b5dc3['query'][_0xc89e('0x47')]){_0x56c245[_0xc89e('0x45')]=_[_0xc89e('0x48')](_0x56c245['where'],{'$or':_[_0xc89e('0x35')](_0x23d720,function(_0xeaeae9){if(_0xeaeae9[_0xc89e('0x39')]!==_0xc89e('0x49')){var _0x38e732={};_0x38e732[_0xeaeae9['name']]={'$like':'%'+_0x2b5dc3['query'][_0xc89e('0x47')]+'%'};return _0x38e732;}})});}_0x56c245=_[_0xc89e('0x48')]({},_0x56c245,_0x2b5dc3['options']);var _0x2ed9a5={'where':_0x56c245[_0xc89e('0x45')]};return db['Dynamics365Account'][_0xc89e('0x29')](_0x2ed9a5)[_0xc89e('0x1b')](function(_0x2d583e){_0x1ed5c3[_0xc89e('0x29')]=_0x2d583e;if(_0x2b5dc3[_0xc89e('0x3c')]['includeAll']){_0x56c245['include']=[{'all':!![]}];}return db[_0xc89e('0x36')]['findAll'](_0x56c245);})[_0xc89e('0x1b')](function(_0x4626ba){_0x1ed5c3[_0xc89e('0x4a')]=_0x4626ba;return _0x1ed5c3;})['then'](respondWithFilteredResult(_0x5b7eff,_0x56c245))['catch'](handleError(_0x5b7eff,null));};exports[_0xc89e('0x4b')]=function(_0x2d5197,_0x224d33){var _0x193bf6={'raw':![],'where':{'id':_0x2d5197[_0xc89e('0x4c')]['id']}},_0x2d1171={};_0x2d1171[_0xc89e('0x3b')]=_[_0xc89e('0x3d')](db['Dynamics365Account'][_0xc89e('0x37')]);_0x2d1171[_0xc89e('0x3c')]=_[_0xc89e('0x3d')](_0x2d5197[_0xc89e('0x3c')]);_0x2d1171[_0xc89e('0x3e')]=_[_0xc89e('0x3f')](_0x2d1171['model'],_0x2d1171['query']);_0x193bf6['attributes']=_[_0xc89e('0x3f')](_0x2d1171[_0xc89e('0x3b')],qs['fields'](_0x2d5197[_0xc89e('0x3c')]['fields']));_0x193bf6[_0xc89e('0x41')]=_0x193bf6[_0xc89e('0x41')][_0xc89e('0x4d')]?_0x193bf6[_0xc89e('0x41')]:_0x2d1171[_0xc89e('0x3b')];if(_0x2d5197[_0xc89e('0x3c')]['includeAll']){_0x193bf6[_0xc89e('0x4e')]=[{'all':!![]}];}_0x193bf6=_['merge']({},_0x193bf6,_0x2d5197['options']);return db[_0xc89e('0x36')][_0xc89e('0x4f')](_0x193bf6)[_0xc89e('0x1b')](handleEntityNotFound(_0x224d33,null))['then'](respondWithResult(_0x224d33,null))['catch'](handleError(_0x224d33,null));};exports[_0xc89e('0x50')]=function(_0x48461e,_0x5dde16){return db[_0xc89e('0x36')][_0xc89e('0x50')](_0x48461e['body'],{})[_0xc89e('0x1b')](respondWithResult(_0x5dde16,0xc9))[_0xc89e('0x51')](handleError(_0x5dde16,null));};exports['update']=function(_0x1a3b3f,_0x1304f5){if(_0x1a3b3f[_0xc89e('0x52')]['id']){delete _0x1a3b3f[_0xc89e('0x52')]['id'];}return db[_0xc89e('0x36')]['find']({'where':{'id':_0x1a3b3f['params']['id']}})[_0xc89e('0x1b')](handleEntityNotFound(_0x1304f5,null))[_0xc89e('0x1b')](saveUpdates(_0x1a3b3f[_0xc89e('0x52')],null))[_0xc89e('0x1b')](respondWithResult(_0x1304f5,null))[_0xc89e('0x51')](handleError(_0x1304f5,null));};exports[_0xc89e('0x31')]=function(_0x3fc397,_0x3e5506){return db['Dynamics365Account'][_0xc89e('0x4f')]({'where':{'id':_0x3fc397[_0xc89e('0x4c')]['id']}})[_0xc89e('0x1b')](handleEntityNotFound(_0x3e5506,null))[_0xc89e('0x1b')](removeEntity(_0x3e5506,null))[_0xc89e('0x51')](handleError(_0x3e5506,null));};exports[_0xc89e('0x53')]=function(_0x36639d,_0xffd9bc,_0x579e76){var _0x108751={};var _0xd38397={};var _0x209fe5;var _0x5bb1bf;return db[_0xc89e('0x36')]['findOne']({'where':{'id':_0x36639d[_0xc89e('0x4c')]['id']}})['then'](handleEntityNotFound(_0xffd9bc,null))['then'](function(_0x450a92){if(_0x450a92){_0x209fe5=_0x450a92;_0xd38397[_0xc89e('0x3b')]=_['keys'](db[_0xc89e('0x54')]['rawAttributes']);_0xd38397[_0xc89e('0x3c')]=_[_0xc89e('0x3d')](_0x36639d[_0xc89e('0x3c')]);_0xd38397[_0xc89e('0x3e')]=_[_0xc89e('0x3f')](_0xd38397[_0xc89e('0x3b')],_0xd38397[_0xc89e('0x3c')]);_0x108751['attributes']=_[_0xc89e('0x3f')](_0xd38397[_0xc89e('0x3b')],qs['fields'](_0x36639d[_0xc89e('0x3c')][_0xc89e('0x40')]));_0x108751['attributes']=_0x108751[_0xc89e('0x41')][_0xc89e('0x4d')]?_0x108751[_0xc89e('0x41')]:_0xd38397[_0xc89e('0x3b')];_0x108751[_0xc89e('0x44')]=qs['sort'](_0x36639d['query'][_0xc89e('0x55')]);_0x108751[_0xc89e('0x45')]=qs[_0xc89e('0x3e')](_[_0xc89e('0x46')](_0x36639d['query'],_0xd38397[_0xc89e('0x3e')]));if(_0x36639d[_0xc89e('0x3c')][_0xc89e('0x47')]){_0x108751[_0xc89e('0x45')]=_[_0xc89e('0x48')](_0x108751[_0xc89e('0x45')],{'$or':_[_0xc89e('0x35')](_0x108751['attributes'],function(_0x3cfbfc){var _0x82eb6c={};_0x82eb6c[_0x3cfbfc]={'$like':'%'+_0x36639d[_0xc89e('0x3c')][_0xc89e('0x47')]+'%'};return _0x82eb6c;})});}_0x108751=_['merge']({},_0x108751,_0x36639d['options']);return _0x209fe5[_0xc89e('0x53')](_0x108751);}})[_0xc89e('0x1b')](function(_0x4f3e26){if(_0x4f3e26){_0x5bb1bf=_0x4f3e26['length'];if(!_0x36639d[_0xc89e('0x3c')][_0xc89e('0x42')](_0xc89e('0x43'))){_0x108751[_0xc89e('0x2b')]=qs[_0xc89e('0x2b')](_0x36639d[_0xc89e('0x3c')][_0xc89e('0x2b')]);_0x108751[_0xc89e('0x2a')]=qs['offset'](_0x36639d['query'][_0xc89e('0x2a')]);}return _0x209fe5[_0xc89e('0x53')](_0x108751);}})[_0xc89e('0x1b')](function(_0x2d093e){if(_0x2d093e){return _0x2d093e?{'count':_0x5bb1bf,'rows':_0x2d093e}:null;}})[_0xc89e('0x1b')](respondWithResult(_0xffd9bc,null))[_0xc89e('0x51')](handleError(_0xffd9bc,null));};exports[_0xc89e('0x56')]=function(_0x470cd6,_0x4e6743,_0x1b7a85){if(_0x470cd6['body']['id']){delete _0x470cd6['body']['id'];}return db['Dynamics365Account'][_0xc89e('0x57')]({'where':{'id':_0x470cd6['params']['id']}})['then'](handleEntityNotFound(_0x4e6743,null))[_0xc89e('0x1b')](function(_0x4b5ba5){if(_0x4b5ba5){_0x470cd6[_0xc89e('0x52')][_0xc89e('0x58')]=_0x4b5ba5['id'];_0x470cd6[_0xc89e('0x52')][_0xc89e('0x59')]=integrations['getSubjects'](_0x470cd6[_0xc89e('0x52')][_0xc89e('0x5a')],_0x470cd6[_0xc89e('0x52')]['type']);_0x470cd6['body'][_0xc89e('0x5b')]=integrations[_0xc89e('0x5c')](_0x470cd6[_0xc89e('0x52')]['channel'],_0x470cd6[_0xc89e('0x52')][_0xc89e('0x39')]);return db['Dynamics365Configuration'][_0xc89e('0x50')](_0x470cd6[_0xc89e('0x52')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xc89e('0x5d')],'as':_0xc89e('0x5b')}]});}return null;})['then'](respondWithResult(_0x4e6743,null))[_0xc89e('0x51')](handleError(_0x4e6743,null));};exports[_0xc89e('0x5e')]=function(_0x169a0c,_0x1e2214,_0x392cb7){var _0x5df681=_0x169a0c['query']['ticketType'];var _0x461f25=_0x5df681===_0xc89e('0x5f')?_0xc89e('0x60'):_0xc89e('0x61');var _0x464e87='';var _0x5ceca6='';var _0x50eaa9='';var _0x32aa98='';var _0xe722f2='';var _0x763465='';var _0x5a9740='';var _0x51b6a5='';var _0x42accb=[_0xc89e('0x62'),'description',_0xc89e('0x63'),'ownerid',_0xc89e('0x64'),_0xc89e('0x65'),_0xc89e('0x66'),'regardingobjectid','directioncode',_0xc89e('0x67')];var _0x54275f=['accountidname',_0xc89e('0x68'),'actualserviceunits',_0xc89e('0x69'),'contactidname',_0xc89e('0x6a'),_0xc89e('0x6b'),_0xc89e('0x6c'),_0xc89e('0x6d'),_0xc89e('0x6e'),_0xc89e('0x6f'),_0xc89e('0x70'),'createdon',_0xc89e('0x71'),'createdonbehalfbyyominame',_0xc89e('0x72'),_0xc89e('0x73'),_0xc89e('0x74'),'emailaddress',_0xc89e('0x75'),'entityimage_timestamp','entityimage_url',_0xc89e('0x76'),'exchangerate',_0xc89e('0x77'),'followupby',_0xc89e('0x78'),_0xc89e('0x79'),_0xc89e('0x7a'),_0xc89e('0x7b'),_0xc89e('0x7c'),_0xc89e('0x7d'),_0xc89e('0x7e'),_0xc89e('0x7f'),_0xc89e('0x80'),_0xc89e('0x81'),_0xc89e('0x82'),_0xc89e('0x83'),'msdyn_incidenttypename',_0xc89e('0x84'),_0xc89e('0x85'),_0xc89e('0x86'),_0xc89e('0x87'),_0xc89e('0x88'),'owneridtype',_0xc89e('0x89'),_0xc89e('0x8a'),_0xc89e('0x8b'),_0xc89e('0x8c'),_0xc89e('0x8d'),_0xc89e('0x8e'),_0xc89e('0x8f'),_0xc89e('0x90'),_0xc89e('0x91'),'responseby',_0xc89e('0x92'),_0xc89e('0x93'),_0xc89e('0x94'),'slainvokedidname','slaname',_0xc89e('0x95'),'statecode','statuscode',_0xc89e('0x96'),_0xc89e('0x97'),_0xc89e('0x98'),_0xc89e('0x99'),_0xc89e('0x9a'),_0xc89e('0x9b'),'versionnumber'];var _0x439bb8=_0x42accb[_0xc89e('0x9c')](_0x54275f);return db[_0xc89e('0x36')][_0xc89e('0x57')]({'where':{'id':_0x169a0c['params']['id']},'attributes':['id',_0xc89e('0x9d'),_0xc89e('0x9e'),_0xc89e('0x9f'),_0xc89e('0xa0'),_0xc89e('0xa1'),'clientSecret']})[_0xc89e('0x1b')](handleEntityNotFound(_0x1e2214,null))[_0xc89e('0x1b')](function(_0x19f905){if(_0x19f905){_0x51b6a5=_0x19f905['remoteUri'];var _0x182d64=_0x51b6a5[_0xc89e('0xa2')](-0x1);if(_0x182d64==='/'){_0x51b6a5=_0x51b6a5['substring'](0x0,_0x51b6a5[_0xc89e('0xa3')](_0x182d64));}_0x5a9740=util[_0xc89e('0xa4')](_0xc89e('0xa5'),_0x51b6a5);var _0x5c6711={'method':_0xc89e('0xa6'),'uri':_0xc89e('0xa7')+_0x19f905[_0xc89e('0xa0')]+'/oauth2/token','form':{'client_id':_0x19f905['clientId'],'resource':_0x51b6a5,'username':_0x19f905['username'],'password':_0x19f905[_0xc89e('0x9e')],'grant_type':_0xc89e('0x9e'),'client_secret':_0x19f905[_0xc89e('0xa8')]},'json':!![]};return rp(_0x5c6711);}})[_0xc89e('0x1b')](function(_0x5276f8){_0x763465=_0x5276f8[_0xc89e('0xa9')];var _0x227972={'method':_0xc89e('0xaa'),'uri':encodeURI(_0x5a9740+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x461f25+'\x27'),'headers':{'Authorization':_0xc89e('0xab')+_0x763465,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x227972);})['then'](function(_0x51deb1){var _0x50b97a=_0x51deb1[_0xc89e('0xac')][0x0];var _0x3ccdc4=_0x50b97a[_0xc89e('0xad')];var _0x32696c={'method':_0xc89e('0xaa'),'uri':_0x5a9740+_0xc89e('0xae')+_0x3ccdc4+_0xc89e('0xaf'),'headers':{'Authorization':_0xc89e('0xab')+_0x763465,'If-None-Match':null,'OData-Version':_0xc89e('0xb0')},'json':!![]};return rp(_0x32696c);})[_0xc89e('0x1b')](function(_0x2c78a2){_0x464e87=_0x2c78a2;_0x5ceca6=_0x464e87[_0xc89e('0xb1')];_0x5ceca6=_['remove'](_0x5ceca6,function(_0x28a6fc){return!_0x439bb8['includes'](_0x28a6fc[_0xc89e('0xb2')]);});var _0x3c0704=[];var _0x27c0dc=[];_0x5ceca6['forEach'](function(_0x59f359){if(_0x59f359['@odata.type']){var _0x2caa96=_0x59f359['@odata.type'][_0xc89e('0xb3')](_0x59f359[_0xc89e('0xb4')]['lastIndexOf']('.')+0x1);if(_0x2caa96===_0xc89e('0xb5')){_0x3c0704[_0xc89e('0xb6')](getSelectList(_0x5a9740,_0x5df681,_0x27c0dc,_0x464e87['MetadataId'],_0x59f359['MetadataId'],_0x763465));}}});return Promise[_0xc89e('0xb7')](_0x3c0704);})['then'](function(_0x7883e5){_0x50eaa9=_0x7883e5[0x0];var _0x298060=[];var _0xa296f3=[];_0x5ceca6[_0xc89e('0xb8')](function(_0x3e95f7){if(!_[_0xc89e('0xb9')](_0x3e95f7['@odata.type'])){var _0x5539d1=_0x3e95f7[_0xc89e('0xb4')][_0xc89e('0xb3')](_0x3e95f7[_0xc89e('0xb4')]['lastIndexOf']('.')+0x1);if(_0x5539d1===_0xc89e('0xba')){_0x298060[_0xc89e('0xb6')](getBooleanList(_0x5a9740,_0x5df681,_0xa296f3,_0x464e87['MetadataId'],_0x3e95f7['MetadataId'],_0x763465));}}});return Promise['all'](_0x298060);})[_0xc89e('0x1b')](function(_0x4c79ba){_0x32aa98=_0x4c79ba[0x0];var _0x4a1a4d=[];var _0x19d312=[];_0x5ceca6['forEach'](function(_0x252850){if(_0x252850[_0xc89e('0xb4')]){var _0x32bcae=_0x252850['@odata.type']['substring'](_0x252850[_0xc89e('0xb4')][_0xc89e('0xa3')]('.')+0x1);if(_0x32bcae===_0xc89e('0xbb')||_0x32bcae===_0xc89e('0xbc')||_0x32bcae===_0xc89e('0xbd')||_0x32bcae===_0xc89e('0xbe')||_0x32bcae===_0xc89e('0xbf')||_0x32bcae==='DateTimeAttributeMetadata'||_0x32bcae===_0xc89e('0xc0')||_0x32bcae==='EntityNameAttributeMetadata'||_0x32bcae===_0xc89e('0xc1')||_0x32bcae==='DecimalAttributeMetadata'){_0x4a1a4d[_0xc89e('0xb6')](getInputList(_0x5a9740,_0x5df681,_0x32bcae,_0x19d312,_0x464e87[_0xc89e('0xad')],_0x252850[_0xc89e('0xad')],_0x763465));}}});return Promise[_0xc89e('0xb7')](_0x4a1a4d);})[_0xc89e('0x1b')](function(_0x3fbb5d){_0xe722f2=_0x3fbb5d[0x0];var _0x2fcfd5=_0x50eaa9[_0xc89e('0x9c')](_0x32aa98)[_0xc89e('0x9c')](_0xe722f2);var _0x1506d6={'count':_0x2fcfd5[_0xc89e('0x4d')],'rows':_0x2fcfd5};return _0x1506d6;})['then'](respondWithResult(_0x1e2214,null))[_0xc89e('0x51')](function(_0x29d288){var _0x58bc05=_0x169a0c[_0xc89e('0x3c')][_0xc89e('0x16')]?0x1f4:_0x29d288[_0xc89e('0xc2')]||0x1f4;logger[_0xc89e('0x22')](_0x29d288[_0xc89e('0xc3')]);delete _0x29d288[_0xc89e('0x32')];if(_0x58bc05===0x191){_0x58bc05=0x190;}_0x1e2214[_0xc89e('0x28')](_0x58bc05)['send'](_0x169a0c[_0xc89e('0x3c')][_0xc89e('0x16')]?{'message':'Wrong\x20credentials','statusCode':_0x29d288[_0xc89e('0xc2')]}:_0x29d288);});};function getSelectList(_0xacd6dc,_0x11a854,_0x2600b7,_0x5bc502,_0x3efed2,_0x5e672e){var _0x54469d={'method':'GET','uri':_0xacd6dc+_0xc89e('0xae')+_0x5bc502+_0xc89e('0xc4')+_0x3efed2+_0xc89e('0xc5')+_0xc89e('0xc6'),'headers':{'Authorization':_0xc89e('0xab')+_0x5e672e,'If-None-Match':null,'OData-Version':_0xc89e('0xb0')},'json':!![]};return rp(_0x54469d)[_0xc89e('0x1b')](function(_0x3979d3){var _0x392bd5=[];var _0x45b699=_0x3979d3[_0xc89e('0xc7')][_0xc89e('0xc8')];_0x45b699[_0xc89e('0xb8')](function(_0x5ee379){_0x392bd5['push']({'name':_0x5ee379[_0xc89e('0xc9')][_0xc89e('0xca')][_0xc89e('0xc9')],'value':String(_0x5ee379[_0xc89e('0xcb')])});});var _0x33f246={'id':_0x11a854+'_'+_0x3979d3[_0xc89e('0xb2')],'name':_0x3979d3[_0xc89e('0xcc')][_0xc89e('0xca')][_0xc89e('0xc9')],'custom':![],'options':_0x392bd5};_0x2600b7['push'](_0x33f246);return _0x2600b7;});}function getBooleanList(_0x551927,_0x3af271,_0x1ef5f2,_0xfa660c,_0x31be0f,_0x5ab58f){var _0x435489={'method':_0xc89e('0xaa'),'uri':_0x551927+'EntityDefinitions('+_0xfa660c+_0xc89e('0xc4')+_0x31be0f+_0xc89e('0xcd'),'headers':{'Authorization':_0xc89e('0xab')+_0x5ab58f,'If-None-Match':null,'OData-Version':_0xc89e('0xb0')},'json':!![]};return rp(_0x435489)[_0xc89e('0x1b')](function(_0x447ee6){var _0x109533=[];_0x109533['push']({'name':_0x447ee6[_0xc89e('0xc7')][_0xc89e('0xce')][_0xc89e('0xc9')]['UserLocalizedLabel'][_0xc89e('0xc9')],'value':_0xc89e('0xcf')},{'name':_0x447ee6[_0xc89e('0xc7')][_0xc89e('0xd0')][_0xc89e('0xc9')][_0xc89e('0xca')]['Label'],'value':_0xc89e('0xd1')});var _0xbc1892={'id':_0x3af271+'_'+_0x447ee6[_0xc89e('0xb2')],'name':_0x447ee6[_0xc89e('0xcc')][_0xc89e('0xca')][_0xc89e('0xc9')],'custom':![],'options':_0x109533};_0x1ef5f2[_0xc89e('0xb6')](_0xbc1892);return _0x1ef5f2;});}function getInputList(_0x643ca5,_0xc56d88,_0x25b267,_0x3eb340,_0x39f1ff,_0x311dbd,_0xd724b0){var _0x3358c2={'method':_0xc89e('0xaa'),'uri':_0x643ca5+_0xc89e('0xae')+_0x39f1ff+_0xc89e('0xc4')+_0x311dbd+_0xc89e('0xd2')+_0x25b267+_0xc89e('0xd3'),'headers':{'Authorization':_0xc89e('0xab')+_0xd724b0,'If-None-Match':null,'OData-Version':_0xc89e('0xb0')},'json':!![]};return rp(_0x3358c2)[_0xc89e('0x1b')](function(_0x311bf4){var _0x2d976c={'id':_0xc56d88+'_'+_0x311bf4[_0xc89e('0xb2')],'name':_0x311bf4[_0xc89e('0xcc')]['UserLocalizedLabel']?_0x311bf4[_0xc89e('0xcc')][_0xc89e('0xca')][_0xc89e('0xc9')]:_0x311bf4['LogicalName'],'custom':![],'options':[]};_0x3eb340[_0xc89e('0xb6')](_0x2d976c);return _0x3eb340;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f1ac13f..368660e 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 _0x29e9=['../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1883ad,_0x290bef){var _0x3b1e5c=function(_0x4c0bdf){while(--_0x4c0bdf){_0x1883ad['push'](_0x1883ad['shift']());}};_0x3b1e5c(++_0x290bef);}(_0x29e9,0xaf));var _0x929e=function(_0x9a05f3,_0x1341b7){_0x9a05f3=_0x9a05f3-0x0;var _0x3e205b=_0x29e9[_0x9a05f3];return _0x3e205b;};'use strict';var _=require(_0x929e('0x0'));var util=require(_0x929e('0x1'));var logger=require('../../config/logger')(_0x929e('0x2'));var moment=require(_0x929e('0x3'));var BPromise=require(_0x929e('0x4'));var rp=require(_0x929e('0x5'));var fs=require('fs');var path=require(_0x929e('0x6'));var rimraf=require('rimraf');var config=require(_0x929e('0x7'));var attributes=require(_0x929e('0x8'));var integrations=require(_0x929e('0x9'));module[_0x929e('0xa')]=function(_0x55fa97,_0x57ed90){return _0x55fa97[_0x929e('0xb')](_0x929e('0xc'),attributes,{'tableName':_0x929e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d41=['bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x8d41,0x167));var _0x18d4=function(_0x99302a,_0xc71da9){_0x99302a=_0x99302a-0x0;var _0x3273ff=_0x8d41[_0x99302a];return _0x3273ff;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var logger=require(_0x18d4('0x2'))(_0x18d4('0x3'));var moment=require(_0x18d4('0x4'));var BPromise=require(_0x18d4('0x5'));var rp=require(_0x18d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18d4('0x7'));var config=require(_0x18d4('0x8'));var attributes=require(_0x18d4('0x9'));var integrations=require(_0x18d4('0xa'));module[_0x18d4('0xb')]=function(_0x2d5381,_0x396f5c){return _0x2d5381[_0x18d4('0xc')]('Dynamics365Account',attributes,{'tableName':_0x18d4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8c02375..36e12a1 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 _0x933c=['where','attributes','limit','include','model','map','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw'];(function(_0x430163,_0x480ce7){var _0x5867e4=function(_0x3e00c1){while(--_0x3e00c1){_0x430163['push'](_0x430163['shift']());}};_0x5867e4(++_0x480ce7);}(_0x933c,0x99));var _0xc933=function(_0x29b608,_0x883498){_0x29b608=_0x29b608-0x0;var _0x7fbece=_0x933c[_0x29b608];return _0x7fbece;};'use strict';var _=require(_0xc933('0x0'));var util=require(_0xc933('0x1'));var moment=require(_0xc933('0x2'));var BPromise=require(_0xc933('0x3'));var rs=require(_0xc933('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc933('0x5'));var logger=require(_0xc933('0x6'))(_0xc933('0x7'));var config=require(_0xc933('0x8'));var jayson=require(_0xc933('0x9'));var client=jayson[_0xc933('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xed6789,_0x505c18,_0x1f78e2){return new BPromise(function(_0xf924f4,_0x520373){return client['request'](_0xed6789,_0x1f78e2)[_0xc933('0xb')](function(_0x1ac472){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x505c18,_0xc933('0xc'));logger[_0xc933('0xd')](_0xc933('0xe'),_0x505c18,_0xc933('0xc'),JSON[_0xc933('0xf')](_0x1ac472));if(_0x1ac472[_0xc933('0x10')]){if(_0x1ac472[_0xc933('0x10')][_0xc933('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x505c18,_0x1ac472[_0xc933('0x10')][_0xc933('0x12')]);return _0x520373(_0x1ac472[_0xc933('0x10')][_0xc933('0x12')]);}logger[_0xc933('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x505c18,_0x1ac472[_0xc933('0x10')]['message']);return _0xf924f4(_0x1ac472[_0xc933('0x10')][_0xc933('0x12')]);}else{logger[_0xc933('0x13')](_0xc933('0x14'),_0x505c18,'request\x20sent');_0xf924f4(_0x1ac472[_0xc933('0x15')]['message']);}})['catch'](function(_0x776634){logger[_0xc933('0x10')](_0xc933('0x14'),_0x505c18,_0x776634);_0x520373(_0x776634);});});}exports[_0xc933('0x16')]=function(_0x1611a7){var _0x2ba124=this;return new Promise(function(_0x186b19,_0x21eca2){return db[_0xc933('0x17')][_0xc933('0x18')]({'raw':_0x1611a7['options']?_0x1611a7[_0xc933('0x19')][_0xc933('0x1a')]===undefined?!![]:![]:!![],'where':_0x1611a7[_0xc933('0x19')]?_0x1611a7[_0xc933('0x19')][_0xc933('0x1b')]||null:null,'attributes':_0x1611a7[_0xc933('0x19')]?_0x1611a7[_0xc933('0x19')][_0xc933('0x1c')]||null:null,'limit':_0x1611a7['options']?_0x1611a7[_0xc933('0x19')][_0xc933('0x1d')]||null:null,'include':_0x1611a7[_0xc933('0x19')]?_0x1611a7[_0xc933('0x19')][_0xc933('0x1e')]?_['map'](_0x1611a7[_0xc933('0x19')][_0xc933('0x1e')],function(_0x3411ce){return{'model':db[_0x3411ce[_0xc933('0x1f')]],'as':_0x3411ce['as'],'attributes':_0x3411ce[_0xc933('0x1c')],'include':_0x3411ce['include']?_[_0xc933('0x20')](_0x3411ce[_0xc933('0x1e')],function(_0x5ede22){return{'model':db[_0x5ede22['model']],'as':_0x5ede22['as'],'attributes':_0x5ede22[_0xc933('0x1c')],'include':_0x5ede22[_0xc933('0x1e')]?_[_0xc933('0x20')](_0x5ede22[_0xc933('0x1e')],function(_0x5a213c){return{'model':db[_0x5a213c[_0xc933('0x1f')]],'as':_0x5a213c['as'],'attributes':_0x5a213c[_0xc933('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a9004){logger[_0xc933('0x13')]('GetDynamics365Account',_0x1611a7);logger['debug'](_0xc933('0x16'),_0x1611a7,JSON['stringify'](_0x1a9004));_0x186b19(_0x1a9004);})[_0xc933('0x21')](function(_0xaad361){logger['error'](_0xc933('0x16'),_0xaad361[_0xc933('0x12')],_0x1611a7);_0x21eca2(_0x2ba124[_0xc933('0x10')](0x1f4,_0xaad361['message']));});});};exports[_0xc933('0x22')]=function(_0x39e652){var _0x457683=this;return new Promise(function(_0x5ab52a,_0x129af4){return db[_0xc933('0x17')][_0xc933('0x23')]({'raw':_0x39e652[_0xc933('0x19')]?_0x39e652[_0xc933('0x19')][_0xc933('0x1a')]===undefined?!![]:![]:!![],'where':_0x39e652[_0xc933('0x19')]?_0x39e652[_0xc933('0x19')][_0xc933('0x1b')]||null:null,'attributes':_0x39e652[_0xc933('0x19')]?_0x39e652['options'][_0xc933('0x1c')]||null:null,'include':_0x39e652[_0xc933('0x19')]?_0x39e652[_0xc933('0x19')][_0xc933('0x1e')]?_['map'](_0x39e652['options'][_0xc933('0x1e')],function(_0x1ff6ae){return{'model':db[_0x1ff6ae[_0xc933('0x1f')]],'as':_0x1ff6ae['as'],'attributes':_0x1ff6ae['attributes'],'include':_0x1ff6ae[_0xc933('0x1e')]?_[_0xc933('0x20')](_0x1ff6ae[_0xc933('0x1e')],function(_0x2d9dc0){return{'model':db[_0x2d9dc0[_0xc933('0x1f')]],'as':_0x2d9dc0['as'],'attributes':_0x2d9dc0[_0xc933('0x1c')],'include':_0x2d9dc0[_0xc933('0x1e')]?_[_0xc933('0x20')](_0x2d9dc0[_0xc933('0x1e')],function(_0x54dd16){return{'model':db[_0x54dd16[_0xc933('0x1f')]],'as':_0x54dd16['as'],'attributes':_0x54dd16[_0xc933('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc933('0xb')](function(_0x304ee7){logger['info'](_0xc933('0x22'),_0x39e652);logger[_0xc933('0xd')](_0xc933('0x22'),_0x39e652,JSON[_0xc933('0xf')](_0x304ee7));_0x5ab52a(_0x304ee7);})[_0xc933('0x21')](function(_0x4652fb){logger[_0xc933('0x10')](_0xc933('0x22'),_0x4652fb[_0xc933('0x12')],_0x39e652);_0x129af4(_0x457683[_0xc933('0x10')](0x1f4,_0x4652fb['message']));});});}; \ No newline at end of file +var _0x02b6=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetDynamics365Account','Dynamics365Account','options','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','moment'];(function(_0xa2111d,_0x559308){var _0x541547=function(_0x2b4c36){while(--_0x2b4c36){_0xa2111d['push'](_0xa2111d['shift']());}};_0x541547(++_0x559308);}(_0x02b6,0xfe));var _0x602b=function(_0x3ab950,_0x143d8f){_0x3ab950=_0x3ab950-0x0;var _0x4ab72b=_0x02b6[_0x3ab950];return _0x4ab72b;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var moment=require(_0x602b('0x1'));var BPromise=require(_0x602b('0x2'));var rs=require(_0x602b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x602b('0x4'));var logger=require(_0x602b('0x5'))(_0x602b('0x6'));var config=require(_0x602b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x602b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x265e3b,_0xac6c85,_0x140c8a){return new BPromise(function(_0x1edb2d,_0x51f151){return client[_0x602b('0x9')](_0x265e3b,_0x140c8a)[_0x602b('0xa')](function(_0x3a9579){logger[_0x602b('0xb')](_0x602b('0xc'),_0xac6c85,'request\x20sent');logger[_0x602b('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xac6c85,'request\x20sent',JSON[_0x602b('0xe')](_0x3a9579));if(_0x3a9579['error']){if(_0x3a9579[_0x602b('0xf')][_0x602b('0x10')]===0x1f4){logger['error'](_0x602b('0xc'),_0xac6c85,_0x3a9579[_0x602b('0xf')][_0x602b('0x11')]);return _0x51f151(_0x3a9579['error'][_0x602b('0x11')]);}logger[_0x602b('0xf')](_0x602b('0xc'),_0xac6c85,_0x3a9579[_0x602b('0xf')][_0x602b('0x11')]);return _0x1edb2d(_0x3a9579[_0x602b('0xf')][_0x602b('0x11')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0xac6c85,_0x602b('0x12'));_0x1edb2d(_0x3a9579[_0x602b('0x13')][_0x602b('0x11')]);}})[_0x602b('0x14')](function(_0x2aed6b){logger[_0x602b('0xf')](_0x602b('0xc'),_0xac6c85,_0x2aed6b);_0x51f151(_0x2aed6b);});});}exports[_0x602b('0x15')]=function(_0x46758d){var _0x57057c=this;return new Promise(function(_0x48d992,_0x7dd35d){return db[_0x602b('0x16')]['findAll']({'raw':_0x46758d[_0x602b('0x17')]?_0x46758d['options']['raw']===undefined?!![]:![]:!![],'where':_0x46758d[_0x602b('0x17')]?_0x46758d['options'][_0x602b('0x18')]||null:null,'attributes':_0x46758d['options']?_0x46758d[_0x602b('0x17')][_0x602b('0x19')]||null:null,'limit':_0x46758d[_0x602b('0x17')]?_0x46758d['options'][_0x602b('0x1a')]||null:null,'include':_0x46758d[_0x602b('0x17')]?_0x46758d['options'][_0x602b('0x1b')]?_[_0x602b('0x1c')](_0x46758d[_0x602b('0x17')][_0x602b('0x1b')],function(_0x8510cf){return{'model':db[_0x8510cf[_0x602b('0x1d')]],'as':_0x8510cf['as'],'attributes':_0x8510cf[_0x602b('0x19')],'include':_0x8510cf[_0x602b('0x1b')]?_[_0x602b('0x1c')](_0x8510cf['include'],function(_0x43acc3){return{'model':db[_0x43acc3[_0x602b('0x1d')]],'as':_0x43acc3['as'],'attributes':_0x43acc3['attributes'],'include':_0x43acc3[_0x602b('0x1b')]?_[_0x602b('0x1c')](_0x43acc3['include'],function(_0x11dfd5){return{'model':db[_0x11dfd5[_0x602b('0x1d')]],'as':_0x11dfd5['as'],'attributes':_0x11dfd5[_0x602b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x602b('0xa')](function(_0xc4a556){logger[_0x602b('0xb')](_0x602b('0x15'),_0x46758d);logger[_0x602b('0xd')](_0x602b('0x15'),_0x46758d,JSON[_0x602b('0xe')](_0xc4a556));_0x48d992(_0xc4a556);})[_0x602b('0x14')](function(_0x529fa8){logger[_0x602b('0xf')]('GetDynamics365Account',_0x529fa8[_0x602b('0x11')],_0x46758d);_0x7dd35d(_0x57057c[_0x602b('0xf')](0x1f4,_0x529fa8[_0x602b('0x11')]));});});};exports[_0x602b('0x1e')]=function(_0x32b9b7){var _0x3647cf=this;return new Promise(function(_0x12b379,_0xdf4648){return db[_0x602b('0x16')][_0x602b('0x1f')]({'raw':_0x32b9b7[_0x602b('0x17')]?_0x32b9b7['options']['raw']===undefined?!![]:![]:!![],'where':_0x32b9b7[_0x602b('0x17')]?_0x32b9b7[_0x602b('0x17')][_0x602b('0x18')]||null:null,'attributes':_0x32b9b7[_0x602b('0x17')]?_0x32b9b7['options'][_0x602b('0x19')]||null:null,'include':_0x32b9b7[_0x602b('0x17')]?_0x32b9b7[_0x602b('0x17')]['include']?_[_0x602b('0x1c')](_0x32b9b7[_0x602b('0x17')][_0x602b('0x1b')],function(_0x5cca49){return{'model':db[_0x5cca49['model']],'as':_0x5cca49['as'],'attributes':_0x5cca49[_0x602b('0x19')],'include':_0x5cca49['include']?_[_0x602b('0x1c')](_0x5cca49[_0x602b('0x1b')],function(_0x19a4d4){return{'model':db[_0x19a4d4[_0x602b('0x1d')]],'as':_0x19a4d4['as'],'attributes':_0x19a4d4[_0x602b('0x19')],'include':_0x19a4d4[_0x602b('0x1b')]?_['map'](_0x19a4d4[_0x602b('0x1b')],function(_0x22a179){return{'model':db[_0x22a179[_0x602b('0x1d')]],'as':_0x22a179['as'],'attributes':_0x22a179['attributes']};}):[]};}):[]};}):[]:[]})[_0x602b('0xa')](function(_0x4b287b){logger[_0x602b('0xb')](_0x602b('0x1e'),_0x32b9b7);logger['debug']('ShowDynamics365Account',_0x32b9b7,JSON['stringify'](_0x4b287b));_0x12b379(_0x4b287b);})[_0x602b('0x14')](function(_0x199e7b){logger[_0x602b('0xf')](_0x602b('0x1e'),_0x199e7b[_0x602b('0x11')],_0x32b9b7);_0xdf4648(_0x3647cf[_0x602b('0xf')](0x1f4,_0x199e7b[_0x602b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 256350b..8f0b4a5 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 _0xf7dd=['/:id','getFields','/:id/subjects','/:id/descriptions','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf7dd,0x182));var _0xdf7d=function(_0x90ae4b,_0x40a3b6){_0x90ae4b=_0x90ae4b-0x0;var _0x23e212=_0xf7dd[_0x90ae4b];return _0x23e212;};'use strict';var multer=require(_0xdf7d('0x0'));var util=require(_0xdf7d('0x1'));var path=require('path');var timeout=require(_0xdf7d('0x2'));var express=require('express');var router=express[_0xdf7d('0x3')]();var auth=require(_0xdf7d('0x4'));var interaction=require(_0xdf7d('0x5'));var config=require(_0xdf7d('0x6'));var controller=require(_0xdf7d('0x7'));router[_0xdf7d('0x8')]('/',auth[_0xdf7d('0x9')](),controller['index']);router[_0xdf7d('0x8')](_0xdf7d('0xa'),auth[_0xdf7d('0x9')](),controller['show']);router[_0xdf7d('0x8')]('/:id/fields',auth[_0xdf7d('0x9')](),controller[_0xdf7d('0xb')]);router['get'](_0xdf7d('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdf7d('0x8')](_0xdf7d('0xd'),auth[_0xdf7d('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xdf7d('0x9')](),controller['create']);router[_0xdf7d('0xe')](_0xdf7d('0xa'),auth[_0xdf7d('0x9')](),controller[_0xdf7d('0xf')]);router['delete']('/:id',auth[_0xdf7d('0x9')](),controller[_0xdf7d('0x10')]);module[_0xdf7d('0x11')]=router; \ No newline at end of file +var _0x5d4c=['Router','../../components/auth/service','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x19e174,_0x357aca){var _0x2d6024=function(_0x282d23){while(--_0x282d23){_0x19e174['push'](_0x19e174['shift']());}};_0x2d6024(++_0x357aca);}(_0x5d4c,0x66));var _0xc5d4=function(_0x1c5a4f,_0x46d570){_0x1c5a4f=_0x1c5a4f-0x0;var _0x20f751=_0x5d4c[_0x1c5a4f];return _0x20f751;};'use strict';var multer=require('multer');var util=require(_0xc5d4('0x0'));var path=require(_0xc5d4('0x1'));var timeout=require(_0xc5d4('0x2'));var express=require('express');var router=express[_0xc5d4('0x3')]();var auth=require(_0xc5d4('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc5d4('0x5'));router[_0xc5d4('0x6')]('/',auth['isAuthenticated'](),controller[_0xc5d4('0x7')]);router[_0xc5d4('0x6')](_0xc5d4('0x8'),auth[_0xc5d4('0x9')](),controller[_0xc5d4('0xa')]);router[_0xc5d4('0x6')](_0xc5d4('0xb'),auth[_0xc5d4('0x9')](),controller['getFields']);router[_0xc5d4('0x6')](_0xc5d4('0xc'),auth[_0xc5d4('0x9')](),controller[_0xc5d4('0xd')]);router['get'](_0xc5d4('0xe'),auth['isAuthenticated'](),controller[_0xc5d4('0xf')]);router['post']('/',auth[_0xc5d4('0x9')](),controller[_0xc5d4('0x10')]);router[_0xc5d4('0x11')]('/:id',auth[_0xc5d4('0x9')](),controller[_0xc5d4('0x12')]);router[_0xc5d4('0x13')](_0xc5d4('0x8'),auth[_0xc5d4('0x9')](),controller[_0xc5d4('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 031ae63..261d333 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 _0xced4=['sequelize','STRING','ENUM','incident','phonecall'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0xced4,0xf0));var _0x4ced=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0xced4[_0x57fc2a];return _0xa839b;};'use strict';var Sequelize=require(_0x4ced('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4ced('0x1')]},'ticketType':{'type':Sequelize[_0x4ced('0x2')](_0x4ced('0x3'),_0x4ced('0x4')),'defaultValue':_0x4ced('0x3')}}; \ No newline at end of file +var _0xa9f0=['exports','STRING','ENUM','incident','sequelize'];(function(_0x46279a,_0x4e92c7){var _0x4cea87=function(_0x41e359){while(--_0x41e359){_0x46279a['push'](_0x46279a['shift']());}};_0x4cea87(++_0x4e92c7);}(_0xa9f0,0x1da));var _0x0a9f=function(_0x69e37c,_0x3d55c4){_0x69e37c=_0x69e37c-0x0;var _0x25df6b=_0xa9f0[_0x69e37c];return _0x25df6b;};'use strict';var Sequelize=require(_0x0a9f('0x0'));module[_0x0a9f('0x1')]={'name':{'type':Sequelize[_0x0a9f('0x2')]},'description':{'type':Sequelize[_0x0a9f('0x2')]},'ticketType':{'type':Sequelize[_0x0a9f('0x3')](_0x0a9f('0x4'),'phonecall'),'defaultValue':_0x0a9f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 50c5a58..b2340d0 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 _0x5870=['sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','length','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../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~!@#$%^&-_=+[{]}.','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x480689,_0x1c6e02){var _0x22905f=function(_0x7a2a61){while(--_0x7a2a61){_0x480689['push'](_0x480689['shift']());}};_0x22905f(++_0x1c6e02);}(_0x5870,0x14b));var _0x0587=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x5870[_0x45f951];return _0x24756c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0587('0x0'));var rimraf=require(_0x0587('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0587('0x2'));var rp=require(_0x0587('0x3'));var moment=require(_0x0587('0x4'));var BPromise=require(_0x0587('0x5'));var Mustache=require(_0x0587('0x6'));var util=require('util');var path=require(_0x0587('0x7'));var sox=require(_0x0587('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0587('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0587('0xa'));var toCsv=require(_0x0587('0xb'));var querystring=require(_0x0587('0xc'));var Papa=require(_0x0587('0xd'));var Redis=require(_0x0587('0xe'));var authService=require(_0x0587('0xf'));var qs=require(_0x0587('0x10'));var as=require(_0x0587('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0587('0x12'));var config=require(_0x0587('0x13'));var db=require(_0x0587('0x14'))['db'];var jayson=require(_0x0587('0x15'));var client=jayson[_0x0587('0x16')][_0x0587('0x17')]({'port':0x232a});function checkPasswordPattern(_0x482e6d,_0x28b80f,_0x25c6b3){if(_0x25c6b3){var _0xc21110=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc21110[_0x0587('0x18')](_0x28b80f)){return _0x482e6d;}else{throw new db['Sequelize'][(_0x0587('0x19'))](_0x0587('0x1a'));}}else{return _0x482e6d;}}function respondWithRpcPromise(_0x26f08b,_0x4c7f0b,_0x518ddc,_0x15d1cd){return new BPromise(function(_0x15582a,_0x95bf15){var _0x10b615=_0x15d1cd||client;return _0x10b615['request'](_0x26f08b,_0x518ddc)[_0x0587('0x1b')](function(_0x3eda91){logger[_0x0587('0x1c')](_0x0587('0x1d'),_0x4c7f0b,'request\x20sent');logger[_0x0587('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4c7f0b,_0x0587('0x1f'),JSON[_0x0587('0x20')](_0x3eda91));if(_0x3eda91[_0x0587('0x21')]){if(_0x3eda91[_0x0587('0x21')][_0x0587('0x22')]===0x1f4){logger[_0x0587('0x21')](_0x0587('0x1d'),_0x4c7f0b,_0x3eda91[_0x0587('0x21')][_0x0587('0x23')]);return _0x95bf15(_0x3eda91[_0x0587('0x21')][_0x0587('0x23')]);}logger[_0x0587('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4c7f0b,_0x3eda91[_0x0587('0x21')]['message']);return _0x15582a(_0x3eda91[_0x0587('0x21')]['message']);}else{logger[_0x0587('0x1c')](_0x0587('0x1d'),_0x4c7f0b,_0x0587('0x1f'));_0x15582a(_0x3eda91[_0x0587('0x24')]['message']);}})['catch'](function(_0x4f4c46){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4c7f0b,_0x4f4c46);_0x95bf15(_0x4f4c46);});});}function respondWithStatusCode(_0x464659,_0x608c57){_0x608c57=_0x608c57||0xcc;return function(_0x569b36){if(_0x569b36){return _0x464659[_0x0587('0x25')](_0x608c57);}return _0x464659[_0x0587('0x26')](_0x608c57)['end']();};}function respondWithResult(_0x33fb47,_0x42b48a){_0x42b48a=_0x42b48a||0xc8;return function(_0x4fa879){if(_0x4fa879){return _0x33fb47['status'](_0x42b48a)[_0x0587('0x27')](_0x4fa879);}};}function respondWithFilteredResult(_0x3e1c0d,_0x297539){return function(_0x40044f){if(_0x40044f){var _0x488046=_0x40044f[_0x0587('0x28')],_0x19b2f0=_0x297539[_0x0587('0x29')],_0x547b36=_0x297539[_0x0587('0x29')]+_0x297539[_0x0587('0x2a')],_0x43d02d;if(_0x547b36>=_0x488046){_0x547b36=_0x488046;_0x43d02d=0xc8;}else{_0x43d02d=0xce;}_0x3e1c0d[_0x0587('0x26')](_0x43d02d);return _0x3e1c0d[_0x0587('0x2b')]('Content-Range',_0x19b2f0+'-'+_0x547b36+'/'+_0x488046)[_0x0587('0x27')](_0x40044f);}return null;};}function patchUpdates(_0x28b747){return function(_0x4cc21a){try{jsonpatch[_0x0587('0x2c')](_0x4cc21a,_0x28b747,!![]);}catch(_0x2e19d7){return BPromise[_0x0587('0x2d')](_0x2e19d7);}return _0x4cc21a[_0x0587('0x2e')]();};}function saveUpdates(_0x51f6bd,_0x5d8974){return function(_0x2b0b05){if(_0x2b0b05){return _0x2b0b05[_0x0587('0x2f')](_0x51f6bd)[_0x0587('0x1b')](function(_0xf5c933){return _0xf5c933;});}return null;};}function removeEntity(_0x13d0df,_0x35a790){return function(_0x4dd4b0){if(_0x4dd4b0){return _0x4dd4b0[_0x0587('0x30')]()[_0x0587('0x1b')](function(){_0x13d0df[_0x0587('0x26')](0xcc)[_0x0587('0x31')]();});}};}function handleEntityNotFound(_0x3dd6b7,_0x41e45c){return function(_0x4b0c60){if(!_0x4b0c60){_0x3dd6b7[_0x0587('0x25')](0x194);}return _0x4b0c60;};}function handleError(_0xa15e10,_0x3a7b52){_0x3a7b52=_0x3a7b52||0x1f4;return function(_0x4c74e9){logger['error'](_0x4c74e9[_0x0587('0x32')]);if(_0x4c74e9['name']){delete _0x4c74e9[_0x0587('0x33')];}_0xa15e10[_0x0587('0x26')](_0x3a7b52)[_0x0587('0x34')](_0x4c74e9);};}exports[_0x0587('0x35')]=function(_0x326e30,_0x42598e){var _0x51a426={},_0x56dfbc={},_0x2dc4e6={'count':0x0,'rows':[]};var _0x352e86=_[_0x0587('0x36')](db[_0x0587('0x37')][_0x0587('0x38')],function(_0x1b0025){return{'name':_0x1b0025[_0x0587('0x39')],'type':_0x1b0025[_0x0587('0x3a')][_0x0587('0x3b')]};});_0x56dfbc[_0x0587('0x3c')]=_[_0x0587('0x36')](_0x352e86,_0x0587('0x33'));_0x56dfbc[_0x0587('0x3d')]=_['keys'](_0x326e30[_0x0587('0x3d')]);_0x56dfbc[_0x0587('0x3e')]=_[_0x0587('0x3f')](_0x56dfbc['model'],_0x56dfbc[_0x0587('0x3d')]);_0x51a426[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x56dfbc[_0x0587('0x3c')],qs['fields'](_0x326e30['query'][_0x0587('0x41')]));_0x51a426[_0x0587('0x40')]=_0x51a426[_0x0587('0x40')]['length']?_0x51a426[_0x0587('0x40')]:_0x56dfbc[_0x0587('0x3c')];if(!_0x326e30[_0x0587('0x3d')]['hasOwnProperty'](_0x0587('0x42'))){_0x51a426[_0x0587('0x2a')]=qs[_0x0587('0x2a')](_0x326e30[_0x0587('0x3d')][_0x0587('0x2a')]);_0x51a426[_0x0587('0x29')]=qs['offset'](_0x326e30[_0x0587('0x3d')][_0x0587('0x29')]);}_0x51a426['order']=qs[_0x0587('0x43')](_0x326e30[_0x0587('0x3d')][_0x0587('0x43')]);_0x51a426[_0x0587('0x44')]=qs[_0x0587('0x3e')](_[_0x0587('0x45')](_0x326e30[_0x0587('0x3d')],_0x56dfbc[_0x0587('0x3e')]),_0x352e86);if(_0x326e30[_0x0587('0x3d')][_0x0587('0x46')]){_0x51a426[_0x0587('0x44')]=_[_0x0587('0x47')](_0x51a426[_0x0587('0x44')],{'$or':_[_0x0587('0x36')](_0x352e86,function(_0x4b622d){if(_0x4b622d[_0x0587('0x3a')]!==_0x0587('0x48')){var _0x5d1368={};_0x5d1368[_0x4b622d[_0x0587('0x33')]]={'$like':'%'+_0x326e30[_0x0587('0x3d')][_0x0587('0x46')]+'%'};return _0x5d1368;}})});}_0x51a426=_[_0x0587('0x47')]({},_0x51a426,_0x326e30[_0x0587('0x49')]);var _0xe58bec={'where':_0x51a426[_0x0587('0x44')]};return db[_0x0587('0x37')][_0x0587('0x28')](_0xe58bec)['then'](function(_0x4bec7d){_0x2dc4e6[_0x0587('0x28')]=_0x4bec7d;if(_0x326e30[_0x0587('0x3d')][_0x0587('0x4a')]){_0x51a426[_0x0587('0x4b')]=[{'all':!![]}];}return db[_0x0587('0x37')]['findAll'](_0x51a426);})[_0x0587('0x1b')](function(_0x48167e){_0x2dc4e6[_0x0587('0x4c')]=_0x48167e;return _0x2dc4e6;})[_0x0587('0x1b')](respondWithFilteredResult(_0x42598e,_0x51a426))[_0x0587('0x4d')](handleError(_0x42598e,null));};exports[_0x0587('0x4e')]=function(_0x209bca,_0x15f999){var _0x2ae8cd={'raw':![],'where':{'id':_0x209bca[_0x0587('0x4f')]['id']}},_0x2c07f8={};_0x2c07f8[_0x0587('0x3c')]=_[_0x0587('0x50')](db[_0x0587('0x37')][_0x0587('0x38')]);_0x2c07f8[_0x0587('0x3d')]=_[_0x0587('0x50')](_0x209bca[_0x0587('0x3d')]);_0x2c07f8[_0x0587('0x3e')]=_['intersection'](_0x2c07f8[_0x0587('0x3c')],_0x2c07f8[_0x0587('0x3d')]);_0x2ae8cd[_0x0587('0x40')]=_['intersection'](_0x2c07f8[_0x0587('0x3c')],qs[_0x0587('0x41')](_0x209bca['query'][_0x0587('0x41')]));_0x2ae8cd[_0x0587('0x40')]=_0x2ae8cd['attributes']['length']?_0x2ae8cd[_0x0587('0x40')]:_0x2c07f8[_0x0587('0x3c')];if(_0x209bca[_0x0587('0x3d')]['includeAll']){_0x2ae8cd[_0x0587('0x4b')]=[{'all':!![]}];}_0x2ae8cd=_[_0x0587('0x47')]({},_0x2ae8cd,_0x209bca[_0x0587('0x49')]);return db[_0x0587('0x37')][_0x0587('0x51')](_0x2ae8cd)[_0x0587('0x1b')](handleEntityNotFound(_0x15f999,null))['then'](respondWithResult(_0x15f999,null))[_0x0587('0x4d')](handleError(_0x15f999,null));};exports[_0x0587('0x52')]=function(_0x49ccfb,_0x13bcd5){return db[_0x0587('0x37')][_0x0587('0x52')](_0x49ccfb['body'],{})['then'](respondWithResult(_0x13bcd5,0xc9))[_0x0587('0x4d')](handleError(_0x13bcd5,null));};exports['update']=function(_0x2dfc7c,_0x4ea5f6){if(_0x2dfc7c[_0x0587('0x53')]['id']){delete _0x2dfc7c[_0x0587('0x53')]['id'];}return db[_0x0587('0x37')][_0x0587('0x51')]({'where':{'id':_0x2dfc7c['params']['id']}})[_0x0587('0x1b')](handleEntityNotFound(_0x4ea5f6,null))[_0x0587('0x1b')](saveUpdates(_0x2dfc7c[_0x0587('0x53')],null))[_0x0587('0x1b')](respondWithResult(_0x4ea5f6,null))[_0x0587('0x4d')](handleError(_0x4ea5f6,null));};exports['destroy']=function(_0x402a05,_0x4873b8){return db['Dynamics365Configuration'][_0x0587('0x51')]({'where':{'id':_0x402a05['params']['id']}})['then'](handleEntityNotFound(_0x4873b8,null))['then'](removeEntity(_0x4873b8,null))[_0x0587('0x4d')](handleError(_0x4873b8,null));};exports[_0x0587('0x54')]=function(_0x1f5b6e,_0x1144d3,_0x52fdf7){var _0x35f3a6={};var _0x23627b={};var _0x45a08a;var _0x80a8a6;return db[_0x0587('0x37')][_0x0587('0x55')]({'where':{'id':_0x1f5b6e['params']['id']}})[_0x0587('0x1b')](handleEntityNotFound(_0x1144d3,null))[_0x0587('0x1b')](function(_0x5e3ecb){if(_0x5e3ecb){_0x45a08a=_0x5e3ecb;_0x23627b[_0x0587('0x3c')]=_[_0x0587('0x50')](db[_0x0587('0x56')]['rawAttributes']);_0x23627b[_0x0587('0x3d')]=_[_0x0587('0x50')](_0x1f5b6e['query']);_0x23627b['filters']=_['intersection'](_0x23627b[_0x0587('0x3c')],_0x23627b['query']);_0x35f3a6[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x23627b[_0x0587('0x3c')],qs[_0x0587('0x41')](_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x41')]));_0x35f3a6[_0x0587('0x40')]=_0x35f3a6[_0x0587('0x40')][_0x0587('0x57')]?_0x35f3a6[_0x0587('0x40')]:_0x23627b[_0x0587('0x3c')];_0x35f3a6[_0x0587('0x58')]=qs[_0x0587('0x43')](_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x43')]);_0x35f3a6[_0x0587('0x44')]=qs[_0x0587('0x3e')](_['pick'](_0x1f5b6e[_0x0587('0x3d')],_0x23627b[_0x0587('0x3e')]));if(_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x46')]){_0x35f3a6[_0x0587('0x44')]=_[_0x0587('0x47')](_0x35f3a6[_0x0587('0x44')],{'$or':_[_0x0587('0x36')](_0x35f3a6[_0x0587('0x40')],function(_0xe76db){var _0x388ab0={};_0x388ab0[_0xe76db]={'$like':'%'+_0x1f5b6e['query'][_0x0587('0x46')]+'%'};return _0x388ab0;})});}_0x35f3a6=_[_0x0587('0x47')]({},_0x35f3a6,_0x1f5b6e[_0x0587('0x49')]);return _0x45a08a['getFields'](_0x35f3a6);}})[_0x0587('0x1b')](function(_0x578dfd){if(_0x578dfd){_0x80a8a6=_0x578dfd[_0x0587('0x57')];if(!_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x59')]('nolimit')){_0x35f3a6[_0x0587('0x2a')]=qs[_0x0587('0x2a')](_0x1f5b6e['query'][_0x0587('0x2a')]);_0x35f3a6[_0x0587('0x29')]=qs[_0x0587('0x29')](_0x1f5b6e[_0x0587('0x3d')]['offset']);}return _0x45a08a['getFields'](_0x35f3a6);}})[_0x0587('0x1b')](function(_0x3b6d32){if(_0x3b6d32){return _0x3b6d32?{'count':_0x80a8a6,'rows':_0x3b6d32}:null;}})[_0x0587('0x1b')](respondWithResult(_0x1144d3,null))['catch'](handleError(_0x1144d3,null));};exports['getSubjects']=function(_0x5cb7e6,_0x485e46,_0x2603f0){var _0x45a539={};var _0x491f5f={};var _0x1d5e89;var _0x461161;return db[_0x0587('0x37')][_0x0587('0x55')]({'where':{'id':_0x5cb7e6['params']['id']}})['then'](handleEntityNotFound(_0x485e46,null))['then'](function(_0x23f3a7){if(_0x23f3a7){_0x1d5e89=_0x23f3a7;_0x491f5f['model']=_[_0x0587('0x50')](db[_0x0587('0x56')][_0x0587('0x38')]);_0x491f5f[_0x0587('0x3d')]=_['keys'](_0x5cb7e6[_0x0587('0x3d')]);_0x491f5f['filters']=_['intersection'](_0x491f5f['model'],_0x491f5f[_0x0587('0x3d')]);_0x45a539[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x491f5f[_0x0587('0x3c')],qs['fields'](_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x41')]));_0x45a539['attributes']=_0x45a539[_0x0587('0x40')]['length']?_0x45a539['attributes']:_0x491f5f[_0x0587('0x3c')];_0x45a539[_0x0587('0x58')]=qs[_0x0587('0x43')](_0x5cb7e6['query'][_0x0587('0x43')]);_0x45a539[_0x0587('0x44')]=qs[_0x0587('0x3e')](_[_0x0587('0x45')](_0x5cb7e6[_0x0587('0x3d')],_0x491f5f['filters']));if(_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x46')]){_0x45a539[_0x0587('0x44')]=_[_0x0587('0x47')](_0x45a539[_0x0587('0x44')],{'$or':_[_0x0587('0x36')](_0x45a539['attributes'],function(_0x22dcc6){var _0x449b82={};_0x449b82[_0x22dcc6]={'$like':'%'+_0x5cb7e6[_0x0587('0x3d')]['filter']+'%'};return _0x449b82;})});}_0x45a539=_[_0x0587('0x47')]({},_0x45a539,_0x5cb7e6[_0x0587('0x49')]);return _0x1d5e89[_0x0587('0x5a')](_0x45a539);}})[_0x0587('0x1b')](function(_0x283d82){if(_0x283d82){_0x461161=_0x283d82[_0x0587('0x57')];if(!_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x59')](_0x0587('0x42'))){_0x45a539[_0x0587('0x2a')]=qs['limit'](_0x5cb7e6[_0x0587('0x3d')]['limit']);_0x45a539[_0x0587('0x29')]=qs[_0x0587('0x29')](_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x29')]);}return _0x1d5e89[_0x0587('0x5a')](_0x45a539);}})[_0x0587('0x1b')](function(_0x2f77a3){if(_0x2f77a3){return _0x2f77a3?{'count':_0x461161,'rows':_0x2f77a3}:null;}})['then'](respondWithResult(_0x485e46,null))[_0x0587('0x4d')](handleError(_0x485e46,null));};exports[_0x0587('0x5b')]=function(_0x4b8272,_0x385a57,_0x38b3ed){var _0x137448={};var _0x18344b={};var _0x1af997;var _0x58b4f1;return db[_0x0587('0x37')][_0x0587('0x55')]({'where':{'id':_0x4b8272[_0x0587('0x4f')]['id']}})['then'](handleEntityNotFound(_0x385a57,null))['then'](function(_0x381633){if(_0x381633){_0x1af997=_0x381633;_0x18344b[_0x0587('0x3c')]=_[_0x0587('0x50')](db[_0x0587('0x56')][_0x0587('0x38')]);_0x18344b['query']=_[_0x0587('0x50')](_0x4b8272['query']);_0x18344b[_0x0587('0x3e')]=_['intersection'](_0x18344b['model'],_0x18344b[_0x0587('0x3d')]);_0x137448[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x18344b['model'],qs['fields'](_0x4b8272[_0x0587('0x3d')]['fields']));_0x137448[_0x0587('0x40')]=_0x137448['attributes'][_0x0587('0x57')]?_0x137448[_0x0587('0x40')]:_0x18344b[_0x0587('0x3c')];_0x137448[_0x0587('0x58')]=qs[_0x0587('0x43')](_0x4b8272[_0x0587('0x3d')][_0x0587('0x43')]);_0x137448[_0x0587('0x44')]=qs[_0x0587('0x3e')](_[_0x0587('0x45')](_0x4b8272['query'],_0x18344b['filters']));if(_0x4b8272[_0x0587('0x3d')][_0x0587('0x46')]){_0x137448[_0x0587('0x44')]=_['merge'](_0x137448['where'],{'$or':_['map'](_0x137448[_0x0587('0x40')],function(_0x5e32fc){var _0x336ed2={};_0x336ed2[_0x5e32fc]={'$like':'%'+_0x4b8272['query'][_0x0587('0x46')]+'%'};return _0x336ed2;})});}_0x137448=_['merge']({},_0x137448,_0x4b8272['options']);return _0x1af997[_0x0587('0x5b')](_0x137448);}})['then'](function(_0x2af7d9){if(_0x2af7d9){_0x58b4f1=_0x2af7d9[_0x0587('0x57')];if(!_0x4b8272[_0x0587('0x3d')][_0x0587('0x59')](_0x0587('0x42'))){_0x137448[_0x0587('0x2a')]=qs[_0x0587('0x2a')](_0x4b8272[_0x0587('0x3d')][_0x0587('0x2a')]);_0x137448[_0x0587('0x29')]=qs['offset'](_0x4b8272[_0x0587('0x3d')][_0x0587('0x29')]);}return _0x1af997[_0x0587('0x5b')](_0x137448);}})[_0x0587('0x1b')](function(_0x497003){if(_0x497003){return _0x497003?{'count':_0x58b4f1,'rows':_0x497003}:null;}})[_0x0587('0x1b')](respondWithResult(_0x385a57,null))[_0x0587('0x4d')](handleError(_0x385a57,null));}; \ No newline at end of file +var _0x4753=['getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','status','end','json','count','offset','limit','apply','reject','save','destroy','sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','Dynamics365Configuration','find','create','body','update','getFields','findOne','keys','Dynamics365Field','nolimit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4753,0x1bf));var _0x3475=function(_0x145abc,_0x27e946){_0x145abc=_0x145abc-0x0;var _0x4ac583=_0x4753[_0x145abc];return _0x4ac583;};'use strict';var pdf=require(_0x3475('0x0'));var emlformat=require(_0x3475('0x1'));var rimraf=require(_0x3475('0x2'));var zipdir=require(_0x3475('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3475('0x4'));var moment=require('moment');var BPromise=require(_0x3475('0x5'));var Mustache=require(_0x3475('0x6'));var util=require('util');var path=require(_0x3475('0x7'));var sox=require(_0x3475('0x8'));var csv=require(_0x3475('0x9'));var ejs=require(_0x3475('0xa'));var fs=require('fs');var _=require(_0x3475('0xb'));var squel=require(_0x3475('0xc'));var crypto=require(_0x3475('0xd'));var jsforce=require(_0x3475('0xe'));var deskjs=require(_0x3475('0xf'));var toCsv=require(_0x3475('0x9'));var querystring=require('querystring');var Papa=require(_0x3475('0x10'));var Redis=require('ioredis');var authService=require(_0x3475('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3475('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3475('0x13'));var utils=require(_0x3475('0x14'));var config=require(_0x3475('0x15'));var db=require(_0x3475('0x16'))['db'];var jayson=require(_0x3475('0x17'));var client=jayson[_0x3475('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x2d053d,_0x11c313,_0x470cf5){if(_0x470cf5){var _0x11edae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11edae[_0x3475('0x19')](_0x11c313)){return _0x2d053d;}else{throw new db[(_0x3475('0x1a'))]['ValidationError'](_0x3475('0x1b'));}}else{return _0x2d053d;}}function respondWithRpcPromise(_0x34c55d,_0x2d6ef3,_0x2ba71c,_0x1d603e){return new BPromise(function(_0x519057,_0x5ee0fc){var _0x1ac170=_0x1d603e||client;return _0x1ac170[_0x3475('0x1c')](_0x34c55d,_0x2ba71c)[_0x3475('0x1d')](function(_0x3c4365){logger['info'](_0x3475('0x1e'),_0x2d6ef3,_0x3475('0x1f'));logger[_0x3475('0x20')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2d6ef3,'request\x20sent',JSON[_0x3475('0x21')](_0x3c4365));if(_0x3c4365['error']){if(_0x3c4365[_0x3475('0x22')]['code']===0x1f4){logger['error'](_0x3475('0x1e'),_0x2d6ef3,_0x3c4365[_0x3475('0x22')][_0x3475('0x23')]);return _0x5ee0fc(_0x3c4365[_0x3475('0x22')][_0x3475('0x23')]);}logger[_0x3475('0x22')](_0x3475('0x1e'),_0x2d6ef3,_0x3c4365[_0x3475('0x22')][_0x3475('0x23')]);return _0x519057(_0x3c4365[_0x3475('0x22')][_0x3475('0x23')]);}else{logger[_0x3475('0x24')](_0x3475('0x1e'),_0x2d6ef3,'request\x20sent');_0x519057(_0x3c4365[_0x3475('0x25')]['message']);}})['catch'](function(_0x3c3289){logger['error'](_0x3475('0x1e'),_0x2d6ef3,_0x3c3289);_0x5ee0fc(_0x3c3289);});});}function respondWithStatusCode(_0xfd93ad,_0x1aca37){_0x1aca37=_0x1aca37||0xcc;return function(_0x49b07b){if(_0x49b07b){return _0xfd93ad['sendStatus'](_0x1aca37);}return _0xfd93ad[_0x3475('0x26')](_0x1aca37)[_0x3475('0x27')]();};}function respondWithResult(_0x2d5299,_0x35fd9d){_0x35fd9d=_0x35fd9d||0xc8;return function(_0x31bc67){if(_0x31bc67){return _0x2d5299[_0x3475('0x26')](_0x35fd9d)[_0x3475('0x28')](_0x31bc67);}};}function respondWithFilteredResult(_0x5d6e73,_0x1d6de0){return function(_0x47bb20){if(_0x47bb20){var _0x4cb5eb=_0x47bb20[_0x3475('0x29')],_0x1a4132=_0x1d6de0[_0x3475('0x2a')],_0x46671b=_0x1d6de0[_0x3475('0x2a')]+_0x1d6de0[_0x3475('0x2b')],_0x7dac2c;if(_0x46671b>=_0x4cb5eb){_0x46671b=_0x4cb5eb;_0x7dac2c=0xc8;}else{_0x7dac2c=0xce;}_0x5d6e73[_0x3475('0x26')](_0x7dac2c);return _0x5d6e73['set']('Content-Range',_0x1a4132+'-'+_0x46671b+'/'+_0x4cb5eb)[_0x3475('0x28')](_0x47bb20);}return null;};}function patchUpdates(_0x70501c){return function(_0x3e72af){try{jsonpatch[_0x3475('0x2c')](_0x3e72af,_0x70501c,!![]);}catch(_0x3810e7){return BPromise[_0x3475('0x2d')](_0x3810e7);}return _0x3e72af[_0x3475('0x2e')]();};}function saveUpdates(_0xc33e8c,_0x424514){return function(_0x1c11f9){if(_0x1c11f9){return _0x1c11f9['update'](_0xc33e8c)['then'](function(_0x5bae8d){return _0x5bae8d;});}return null;};}function removeEntity(_0x3942d0,_0x9d002d){return function(_0x216ec9){if(_0x216ec9){return _0x216ec9[_0x3475('0x2f')]()[_0x3475('0x1d')](function(){_0x3942d0[_0x3475('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x529dbc,_0x4bc42c){return function(_0x3058ce){if(!_0x3058ce){_0x529dbc[_0x3475('0x30')](0x194);}return _0x3058ce;};}function handleError(_0x15b731,_0x4ccb5d){_0x4ccb5d=_0x4ccb5d||0x1f4;return function(_0x25cfd9){logger[_0x3475('0x22')](_0x25cfd9[_0x3475('0x31')]);if(_0x25cfd9[_0x3475('0x32')]){delete _0x25cfd9[_0x3475('0x32')];}_0x15b731['status'](_0x4ccb5d)['send'](_0x25cfd9);};}exports[_0x3475('0x33')]=function(_0x45b55d,_0x3d0a24){var _0x5ae777={},_0x58df67={},_0x374a98={'count':0x0,'rows':[]};var _0x35a9fe=_[_0x3475('0x34')](db['Dynamics365Configuration'][_0x3475('0x35')],function(_0x4a0b13){return{'name':_0x4a0b13['fieldName'],'type':_0x4a0b13[_0x3475('0x36')][_0x3475('0x37')]};});_0x58df67[_0x3475('0x38')]=_['map'](_0x35a9fe,_0x3475('0x32'));_0x58df67[_0x3475('0x39')]=_['keys'](_0x45b55d[_0x3475('0x39')]);_0x58df67['filters']=_[_0x3475('0x3a')](_0x58df67['model'],_0x58df67[_0x3475('0x39')]);_0x5ae777[_0x3475('0x3b')]=_[_0x3475('0x3a')](_0x58df67['model'],qs[_0x3475('0x3c')](_0x45b55d[_0x3475('0x39')][_0x3475('0x3c')]));_0x5ae777[_0x3475('0x3b')]=_0x5ae777[_0x3475('0x3b')][_0x3475('0x3d')]?_0x5ae777[_0x3475('0x3b')]:_0x58df67[_0x3475('0x38')];if(!_0x45b55d[_0x3475('0x39')][_0x3475('0x3e')]('nolimit')){_0x5ae777[_0x3475('0x2b')]=qs['limit'](_0x45b55d[_0x3475('0x39')]['limit']);_0x5ae777[_0x3475('0x2a')]=qs[_0x3475('0x2a')](_0x45b55d['query'][_0x3475('0x2a')]);}_0x5ae777[_0x3475('0x3f')]=qs[_0x3475('0x40')](_0x45b55d[_0x3475('0x39')][_0x3475('0x40')]);_0x5ae777[_0x3475('0x41')]=qs[_0x3475('0x42')](_[_0x3475('0x43')](_0x45b55d[_0x3475('0x39')],_0x58df67[_0x3475('0x42')]),_0x35a9fe);if(_0x45b55d[_0x3475('0x39')][_0x3475('0x44')]){_0x5ae777['where']=_[_0x3475('0x45')](_0x5ae777[_0x3475('0x41')],{'$or':_[_0x3475('0x34')](_0x35a9fe,function(_0x23bb79){if(_0x23bb79['type']!=='VIRTUAL'){var _0x6155e9={};_0x6155e9[_0x23bb79[_0x3475('0x32')]]={'$like':'%'+_0x45b55d['query'][_0x3475('0x44')]+'%'};return _0x6155e9;}})});}_0x5ae777=_[_0x3475('0x45')]({},_0x5ae777,_0x45b55d[_0x3475('0x46')]);var _0x24b97d={'where':_0x5ae777[_0x3475('0x41')]};return db['Dynamics365Configuration'][_0x3475('0x29')](_0x24b97d)[_0x3475('0x1d')](function(_0x449aa7){_0x374a98[_0x3475('0x29')]=_0x449aa7;if(_0x45b55d[_0x3475('0x39')][_0x3475('0x47')]){_0x5ae777['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x3475('0x48')](_0x5ae777);})[_0x3475('0x1d')](function(_0x3e57b3){_0x374a98[_0x3475('0x49')]=_0x3e57b3;return _0x374a98;})[_0x3475('0x1d')](respondWithFilteredResult(_0x3d0a24,_0x5ae777))[_0x3475('0x4a')](handleError(_0x3d0a24,null));};exports[_0x3475('0x4b')]=function(_0x4b4184,_0x4fab7b){var _0x4a5369={'raw':![],'where':{'id':_0x4b4184[_0x3475('0x4c')]['id']}},_0x5193f4={};_0x5193f4[_0x3475('0x38')]=_['keys'](db[_0x3475('0x4d')]['rawAttributes']);_0x5193f4['query']=_['keys'](_0x4b4184['query']);_0x5193f4[_0x3475('0x42')]=_[_0x3475('0x3a')](_0x5193f4[_0x3475('0x38')],_0x5193f4[_0x3475('0x39')]);_0x4a5369['attributes']=_['intersection'](_0x5193f4[_0x3475('0x38')],qs['fields'](_0x4b4184[_0x3475('0x39')][_0x3475('0x3c')]));_0x4a5369[_0x3475('0x3b')]=_0x4a5369['attributes'][_0x3475('0x3d')]?_0x4a5369[_0x3475('0x3b')]:_0x5193f4[_0x3475('0x38')];if(_0x4b4184[_0x3475('0x39')][_0x3475('0x47')]){_0x4a5369['include']=[{'all':!![]}];}_0x4a5369=_[_0x3475('0x45')]({},_0x4a5369,_0x4b4184[_0x3475('0x46')]);return db[_0x3475('0x4d')][_0x3475('0x4e')](_0x4a5369)['then'](handleEntityNotFound(_0x4fab7b,null))[_0x3475('0x1d')](respondWithResult(_0x4fab7b,null))[_0x3475('0x4a')](handleError(_0x4fab7b,null));};exports[_0x3475('0x4f')]=function(_0x513afa,_0x51fb66){return db[_0x3475('0x4d')]['create'](_0x513afa[_0x3475('0x50')],{})[_0x3475('0x1d')](respondWithResult(_0x51fb66,0xc9))[_0x3475('0x4a')](handleError(_0x51fb66,null));};exports[_0x3475('0x51')]=function(_0x232291,_0x1124ff){if(_0x232291[_0x3475('0x50')]['id']){delete _0x232291[_0x3475('0x50')]['id'];}return db[_0x3475('0x4d')]['find']({'where':{'id':_0x232291[_0x3475('0x4c')]['id']}})[_0x3475('0x1d')](handleEntityNotFound(_0x1124ff,null))['then'](saveUpdates(_0x232291[_0x3475('0x50')],null))['then'](respondWithResult(_0x1124ff,null))[_0x3475('0x4a')](handleError(_0x1124ff,null));};exports[_0x3475('0x2f')]=function(_0x2d7019,_0x3906ce){return db[_0x3475('0x4d')][_0x3475('0x4e')]({'where':{'id':_0x2d7019[_0x3475('0x4c')]['id']}})[_0x3475('0x1d')](handleEntityNotFound(_0x3906ce,null))[_0x3475('0x1d')](removeEntity(_0x3906ce,null))[_0x3475('0x4a')](handleError(_0x3906ce,null));};exports[_0x3475('0x52')]=function(_0x65ad02,_0xe0636f,_0x5b61f5){var _0x415d50={};var _0x5c654a={};var _0x426945;var _0x417589;return db['Dynamics365Configuration'][_0x3475('0x53')]({'where':{'id':_0x65ad02['params']['id']}})[_0x3475('0x1d')](handleEntityNotFound(_0xe0636f,null))[_0x3475('0x1d')](function(_0x4f64ba){if(_0x4f64ba){_0x426945=_0x4f64ba;_0x5c654a[_0x3475('0x38')]=_[_0x3475('0x54')](db[_0x3475('0x55')][_0x3475('0x35')]);_0x5c654a['query']=_['keys'](_0x65ad02[_0x3475('0x39')]);_0x5c654a[_0x3475('0x42')]=_[_0x3475('0x3a')](_0x5c654a['model'],_0x5c654a[_0x3475('0x39')]);_0x415d50['attributes']=_['intersection'](_0x5c654a[_0x3475('0x38')],qs['fields'](_0x65ad02[_0x3475('0x39')][_0x3475('0x3c')]));_0x415d50[_0x3475('0x3b')]=_0x415d50[_0x3475('0x3b')][_0x3475('0x3d')]?_0x415d50[_0x3475('0x3b')]:_0x5c654a[_0x3475('0x38')];_0x415d50[_0x3475('0x3f')]=qs[_0x3475('0x40')](_0x65ad02[_0x3475('0x39')][_0x3475('0x40')]);_0x415d50[_0x3475('0x41')]=qs[_0x3475('0x42')](_[_0x3475('0x43')](_0x65ad02[_0x3475('0x39')],_0x5c654a['filters']));if(_0x65ad02[_0x3475('0x39')][_0x3475('0x44')]){_0x415d50['where']=_['merge'](_0x415d50[_0x3475('0x41')],{'$or':_[_0x3475('0x34')](_0x415d50['attributes'],function(_0x3a1008){var _0x6dbef1={};_0x6dbef1[_0x3a1008]={'$like':'%'+_0x65ad02[_0x3475('0x39')][_0x3475('0x44')]+'%'};return _0x6dbef1;})});}_0x415d50=_[_0x3475('0x45')]({},_0x415d50,_0x65ad02[_0x3475('0x46')]);return _0x426945['getFields'](_0x415d50);}})[_0x3475('0x1d')](function(_0x41cc36){if(_0x41cc36){_0x417589=_0x41cc36[_0x3475('0x3d')];if(!_0x65ad02[_0x3475('0x39')]['hasOwnProperty'](_0x3475('0x56'))){_0x415d50['limit']=qs[_0x3475('0x2b')](_0x65ad02[_0x3475('0x39')]['limit']);_0x415d50[_0x3475('0x2a')]=qs['offset'](_0x65ad02[_0x3475('0x39')][_0x3475('0x2a')]);}return _0x426945[_0x3475('0x52')](_0x415d50);}})[_0x3475('0x1d')](function(_0x3a3cc6){if(_0x3a3cc6){return _0x3a3cc6?{'count':_0x417589,'rows':_0x3a3cc6}:null;}})[_0x3475('0x1d')](respondWithResult(_0xe0636f,null))['catch'](handleError(_0xe0636f,null));};exports[_0x3475('0x57')]=function(_0x30db64,_0x142e8c,_0x16864b){var _0x373d89={};var _0x103ea7={};var _0x5d921f;var _0x3f3842;return db[_0x3475('0x4d')]['findOne']({'where':{'id':_0x30db64[_0x3475('0x4c')]['id']}})[_0x3475('0x1d')](handleEntityNotFound(_0x142e8c,null))[_0x3475('0x1d')](function(_0x118c3f){if(_0x118c3f){_0x5d921f=_0x118c3f;_0x103ea7[_0x3475('0x38')]=_[_0x3475('0x54')](db[_0x3475('0x55')][_0x3475('0x35')]);_0x103ea7['query']=_[_0x3475('0x54')](_0x30db64[_0x3475('0x39')]);_0x103ea7['filters']=_['intersection'](_0x103ea7[_0x3475('0x38')],_0x103ea7[_0x3475('0x39')]);_0x373d89[_0x3475('0x3b')]=_[_0x3475('0x3a')](_0x103ea7['model'],qs[_0x3475('0x3c')](_0x30db64['query'][_0x3475('0x3c')]));_0x373d89[_0x3475('0x3b')]=_0x373d89[_0x3475('0x3b')][_0x3475('0x3d')]?_0x373d89['attributes']:_0x103ea7['model'];_0x373d89['order']=qs['sort'](_0x30db64[_0x3475('0x39')][_0x3475('0x40')]);_0x373d89[_0x3475('0x41')]=qs[_0x3475('0x42')](_[_0x3475('0x43')](_0x30db64[_0x3475('0x39')],_0x103ea7[_0x3475('0x42')]));if(_0x30db64[_0x3475('0x39')]['filter']){_0x373d89[_0x3475('0x41')]=_['merge'](_0x373d89[_0x3475('0x41')],{'$or':_[_0x3475('0x34')](_0x373d89['attributes'],function(_0x2b36a2){var _0x54801d={};_0x54801d[_0x2b36a2]={'$like':'%'+_0x30db64[_0x3475('0x39')][_0x3475('0x44')]+'%'};return _0x54801d;})});}_0x373d89=_['merge']({},_0x373d89,_0x30db64[_0x3475('0x46')]);return _0x5d921f['getSubjects'](_0x373d89);}})['then'](function(_0x1fce5d){if(_0x1fce5d){_0x3f3842=_0x1fce5d[_0x3475('0x3d')];if(!_0x30db64[_0x3475('0x39')][_0x3475('0x3e')]('nolimit')){_0x373d89[_0x3475('0x2b')]=qs['limit'](_0x30db64[_0x3475('0x39')][_0x3475('0x2b')]);_0x373d89[_0x3475('0x2a')]=qs['offset'](_0x30db64[_0x3475('0x39')]['offset']);}return _0x5d921f[_0x3475('0x57')](_0x373d89);}})['then'](function(_0x1e6e45){if(_0x1e6e45){return _0x1e6e45?{'count':_0x3f3842,'rows':_0x1e6e45}:null;}})[_0x3475('0x1d')](respondWithResult(_0x142e8c,null))[_0x3475('0x4a')](handleError(_0x142e8c,null));};exports[_0x3475('0x58')]=function(_0x137712,_0x3f9e08,_0x20fcbf){var _0x475516={};var _0x1847e5={};var _0x24443f;var _0xd55947;return db[_0x3475('0x4d')][_0x3475('0x53')]({'where':{'id':_0x137712[_0x3475('0x4c')]['id']}})[_0x3475('0x1d')](handleEntityNotFound(_0x3f9e08,null))[_0x3475('0x1d')](function(_0x46c66a){if(_0x46c66a){_0x24443f=_0x46c66a;_0x1847e5['model']=_['keys'](db[_0x3475('0x55')]['rawAttributes']);_0x1847e5['query']=_[_0x3475('0x54')](_0x137712[_0x3475('0x39')]);_0x1847e5[_0x3475('0x42')]=_['intersection'](_0x1847e5[_0x3475('0x38')],_0x1847e5[_0x3475('0x39')]);_0x475516[_0x3475('0x3b')]=_['intersection'](_0x1847e5[_0x3475('0x38')],qs[_0x3475('0x3c')](_0x137712[_0x3475('0x39')][_0x3475('0x3c')]));_0x475516[_0x3475('0x3b')]=_0x475516['attributes']['length']?_0x475516[_0x3475('0x3b')]:_0x1847e5[_0x3475('0x38')];_0x475516[_0x3475('0x3f')]=qs[_0x3475('0x40')](_0x137712[_0x3475('0x39')][_0x3475('0x40')]);_0x475516[_0x3475('0x41')]=qs[_0x3475('0x42')](_[_0x3475('0x43')](_0x137712[_0x3475('0x39')],_0x1847e5[_0x3475('0x42')]));if(_0x137712[_0x3475('0x39')][_0x3475('0x44')]){_0x475516['where']=_[_0x3475('0x45')](_0x475516['where'],{'$or':_[_0x3475('0x34')](_0x475516['attributes'],function(_0x3e3926){var _0x47f183={};_0x47f183[_0x3e3926]={'$like':'%'+_0x137712[_0x3475('0x39')][_0x3475('0x44')]+'%'};return _0x47f183;})});}_0x475516=_[_0x3475('0x45')]({},_0x475516,_0x137712[_0x3475('0x46')]);return _0x24443f['getDescriptions'](_0x475516);}})['then'](function(_0xa35119){if(_0xa35119){_0xd55947=_0xa35119['length'];if(!_0x137712[_0x3475('0x39')][_0x3475('0x3e')](_0x3475('0x56'))){_0x475516[_0x3475('0x2b')]=qs[_0x3475('0x2b')](_0x137712[_0x3475('0x39')][_0x3475('0x2b')]);_0x475516[_0x3475('0x2a')]=qs[_0x3475('0x2a')](_0x137712[_0x3475('0x39')]['offset']);}return _0x24443f[_0x3475('0x58')](_0x475516);}})[_0x3475('0x1d')](function(_0x3d44d5){if(_0x3d44d5){return _0x3d44d5?{'count':_0xd55947,'rows':_0x3d44d5}:null;}})[_0x3475('0x1d')](respondWithResult(_0x3f9e08,null))[_0x3475('0x4a')](handleError(_0x3f9e08,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 12c3b95..0c09fa8 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 _0xe644=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe644,0xe3));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x3324aa,_0x31a4f3){return _0x3324aa[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':_0x4e64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9efb=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x2560d5,_0xefe8ec){var _0x3ebd21=function(_0x4d49d7){while(--_0x4d49d7){_0x2560d5['push'](_0x2560d5['shift']());}};_0x3ebd21(++_0xefe8ec);}(_0x9efb,0x74));var _0xb9ef=function(_0xc833a,_0x5a56cf){_0xc833a=_0xc833a-0x0;var _0x20170b=_0x9efb[_0xc833a];return _0x20170b;};'use strict';var _=require(_0xb9ef('0x0'));var util=require(_0xb9ef('0x1'));var logger=require(_0xb9ef('0x2'))(_0xb9ef('0x3'));var moment=require(_0xb9ef('0x4'));var BPromise=require(_0xb9ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb9ef('0x6'));var config=require(_0xb9ef('0x7'));var attributes=require(_0xb9ef('0x8'));module[_0xb9ef('0x9')]=function(_0x1e0ce6,_0xfd7d9d){return _0x1e0ce6[_0xb9ef('0xa')](_0xb9ef('0xb'),attributes,{'tableName':_0xb9ef('0xc'),'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 77637d0..4b6dea3 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 _0x1f20=['request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x580b84,_0x54652f){var _0x4517ab=function(_0x4c5a9a){while(--_0x4c5a9a){_0x580b84['push'](_0x580b84['shift']());}};_0x4517ab(++_0x54652f);}(_0x1f20,0x6b));var _0x01f2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1f20[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x01f2('0x0'));var util=require(_0x01f2('0x1'));var moment=require(_0x01f2('0x2'));var BPromise=require(_0x01f2('0x3'));var rs=require(_0x01f2('0x4'));var fs=require('fs');var Redis=require(_0x01f2('0x5'));var db=require(_0x01f2('0x6'))['db'];var utils=require(_0x01f2('0x7'));var logger=require(_0x01f2('0x8'))(_0x01f2('0x9'));var config=require(_0x01f2('0xa'));var jayson=require(_0x01f2('0xb'));var client=jayson['client'][_0x01f2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ddfd5,_0x487498,_0x55ce84){return new BPromise(function(_0x2830c4,_0x509b18){return client[_0x01f2('0xd')](_0x1ddfd5,_0x55ce84)['then'](function(_0x30bae0){logger[_0x01f2('0xe')](_0x01f2('0xf'),_0x487498,_0x01f2('0x10'));logger[_0x01f2('0x11')](_0x01f2('0x12'),_0x487498,_0x01f2('0x10'),JSON['stringify'](_0x30bae0));if(_0x30bae0[_0x01f2('0x13')]){if(_0x30bae0[_0x01f2('0x13')][_0x01f2('0x14')]===0x1f4){logger[_0x01f2('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x487498,_0x30bae0['error'][_0x01f2('0x15')]);return _0x509b18(_0x30bae0[_0x01f2('0x13')][_0x01f2('0x15')]);}logger[_0x01f2('0x13')](_0x01f2('0xf'),_0x487498,_0x30bae0[_0x01f2('0x13')][_0x01f2('0x15')]);return _0x2830c4(_0x30bae0[_0x01f2('0x13')][_0x01f2('0x15')]);}else{logger[_0x01f2('0xe')](_0x01f2('0xf'),_0x487498,_0x01f2('0x10'));_0x2830c4(_0x30bae0[_0x01f2('0x16')]['message']);}})[_0x01f2('0x17')](function(_0x481ef9){logger[_0x01f2('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x487498,_0x481ef9);_0x509b18(_0x481ef9);});});} \ No newline at end of file +var _0x96d7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','bluebird'];(function(_0x4f7125,_0x21c694){var _0x3d4326=function(_0x9d54ac){while(--_0x9d54ac){_0x4f7125['push'](_0x4f7125['shift']());}};_0x3d4326(++_0x21c694);}(_0x96d7,0x156));var _0x796d=function(_0x22acf3,_0x40935c){_0x22acf3=_0x22acf3-0x0;var _0x31bf79=_0x96d7[_0x22acf3];return _0x31bf79;};'use strict';var _=require(_0x796d('0x0'));var util=require(_0x796d('0x1'));var moment=require('moment');var BPromise=require(_0x796d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x796d('0x3'));var db=require(_0x796d('0x4'))['db'];var utils=require(_0x796d('0x5'));var logger=require(_0x796d('0x6'))(_0x796d('0x7'));var config=require('../../config/environment');var jayson=require(_0x796d('0x8'));var client=jayson[_0x796d('0x9')][_0x796d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dceef,_0x5b3bf8,_0x18d09){return new BPromise(function(_0x240f1a,_0x1adf6b){return client['request'](_0x5dceef,_0x18d09)[_0x796d('0xb')](function(_0x4aeaee){logger[_0x796d('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3bf8,_0x796d('0xd'));logger[_0x796d('0xe')](_0x796d('0xf'),_0x5b3bf8,_0x796d('0xd'),JSON[_0x796d('0x10')](_0x4aeaee));if(_0x4aeaee[_0x796d('0x11')]){if(_0x4aeaee[_0x796d('0x11')][_0x796d('0x12')]===0x1f4){logger[_0x796d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3bf8,_0x4aeaee[_0x796d('0x11')][_0x796d('0x13')]);return _0x1adf6b(_0x4aeaee[_0x796d('0x11')][_0x796d('0x13')]);}logger[_0x796d('0x11')](_0x796d('0x14'),_0x5b3bf8,_0x4aeaee['error'][_0x796d('0x13')]);return _0x240f1a(_0x4aeaee[_0x796d('0x11')][_0x796d('0x13')]);}else{logger[_0x796d('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3bf8,_0x796d('0xd'));_0x240f1a(_0x4aeaee[_0x796d('0x15')][_0x796d('0x13')]);}})[_0x796d('0x16')](function(_0x128693){logger[_0x796d('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5b3bf8,_0x128693);_0x1adf6b(_0x128693);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 821af36..b16e70c 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe205=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe205,0xa7));var _0x5e20=function(_0x5bb3f8,_0x5f3bcb){_0x5bb3f8=_0x5bb3f8-0x0;var _0x332911=_0xe205[_0x5bb3f8];return _0x332911;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var auth=require(_0x5e20('0x6'));var interaction=require(_0x5e20('0x7'));var config=require(_0x5e20('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x5e20('0x9')]('/',auth[_0x5e20('0xa')](),controller[_0x5e20('0xb')]);router[_0x5e20('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e20('0xd')]);router[_0x5e20('0xe')]('/:id',auth[_0x5e20('0xa')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')](_0x5e20('0x11'),auth['isAuthenticated'](),controller[_0x5e20('0x12')]);module[_0x5e20('0x13')]=router; \ No newline at end of file +var _0x0624=['isAuthenticated','show','put','update','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','index','get','/:id'];(function(_0xa15fba,_0x115fc2){var _0x1ffbf0=function(_0x2b336e){while(--_0x2b336e){_0xa15fba['push'](_0xa15fba['shift']());}};_0x1ffbf0(++_0x115fc2);}(_0x0624,0x132));var _0x4062=function(_0x1e8250,_0xa62bc5){_0x1e8250=_0x1e8250-0x0;var _0x385579=_0x0624[_0x1e8250];return _0x385579;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4062('0x0'));var router=express[_0x4062('0x1')]();var auth=require(_0x4062('0x2'));var interaction=require(_0x4062('0x3'));var config=require(_0x4062('0x4'));var controller=require(_0x4062('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4062('0x6')]);router[_0x4062('0x7')](_0x4062('0x8'),auth[_0x4062('0x9')](),controller[_0x4062('0xa')]);router['post']('/',auth[_0x4062('0x9')](),controller['create']);router[_0x4062('0xb')](_0x4062('0x8'),auth[_0x4062('0x9')](),controller[_0x4062('0xc')]);router[_0x4062('0xd')](_0x4062('0x8'),auth[_0x4062('0x9')](),controller['destroy']);module[_0x4062('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1b3900a..ca5327e 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 _0x3a38=['BOOLEAN','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0xefe181,_0xcb4712){var _0x445cdb=function(_0x15d16f){while(--_0x15d16f){_0xefe181['push'](_0xefe181['shift']());}};_0x445cdb(++_0xcb4712);}(_0x3a38,0xd9));var _0x83a3=function(_0x5c0eda,_0x5842f0){_0x5c0eda=_0x5c0eda-0x0;var _0x43c9ac=_0x3a38[_0x5c0eda];return _0x43c9ac;};'use strict';var Sequelize=require('sequelize');module[_0x83a3('0x0')]={'type':{'type':Sequelize[_0x83a3('0x1')]('string','variable',_0x83a3('0x2'),_0x83a3('0x3')),'defaultValue':_0x83a3('0x4')},'content':{'type':Sequelize[_0x83a3('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x83a3('0x1')](_0x83a3('0x4'),_0x83a3('0x6'),_0x83a3('0x2'))},'keyContent':{'type':Sequelize[_0x83a3('0x5')]},'idField':{'type':Sequelize[_0x83a3('0x5')]},'nameField':{'type':Sequelize[_0x83a3('0x5')]},'customField':{'type':Sequelize[_0x83a3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83a3('0x5')]}}; \ No newline at end of file +var _0x45a6=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x3c4bb5,_0x295111){var _0x2395d4=function(_0x4007c3){while(--_0x4007c3){_0x3c4bb5['push'](_0x3c4bb5['shift']());}};_0x2395d4(++_0x295111);}(_0x45a6,0x116));var _0x645a=function(_0x12c81e,_0x50a2f8){_0x12c81e=_0x12c81e-0x0;var _0x552be8=_0x45a6[_0x12c81e];return _0x552be8;};'use strict';var Sequelize=require(_0x645a('0x0'));module[_0x645a('0x1')]={'type':{'type':Sequelize[_0x645a('0x2')](_0x645a('0x3'),_0x645a('0x4'),_0x645a('0x5'),_0x645a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x645a('0x7')]},'key':{'type':Sequelize[_0x645a('0x7')]},'keyType':{'type':Sequelize[_0x645a('0x2')](_0x645a('0x3'),_0x645a('0x4'),_0x645a('0x5'))},'keyContent':{'type':Sequelize[_0x645a('0x7')]},'idField':{'type':Sequelize[_0x645a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x645a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x645a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d263a82..407d19a 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 _0xdf64=['VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','json','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdf64,0x1da));var _0x4df6=function(_0x3535c6,_0xe0076d){_0x3535c6=_0x3535c6-0x0;var _0x3049c9=_0xdf64[_0x3535c6];return _0x3049c9;};'use strict';var pdf=require(_0x4df6('0x0'));var emlformat=require(_0x4df6('0x1'));var rimraf=require(_0x4df6('0x2'));var zipdir=require(_0x4df6('0x3'));var jsonpatch=require(_0x4df6('0x4'));var rp=require(_0x4df6('0x5'));var moment=require(_0x4df6('0x6'));var BPromise=require(_0x4df6('0x7'));var Mustache=require(_0x4df6('0x8'));var util=require(_0x4df6('0x9'));var path=require('path');var sox=require(_0x4df6('0xa'));var csv=require(_0x4df6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4df6('0xc'));var squel=require(_0x4df6('0xd'));var crypto=require(_0x4df6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4df6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4df6('0x10'));var Papa=require(_0x4df6('0x11'));var Redis=require(_0x4df6('0x12'));var authService=require(_0x4df6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4df6('0x14'));var hardwareService=require(_0x4df6('0x15'));var logger=require(_0x4df6('0x16'))(_0x4df6('0x17'));var utils=require(_0x4df6('0x18'));var config=require(_0x4df6('0x19'));var db=require(_0x4df6('0x1a'))['db'];function respondWithStatusCode(_0x395d27,_0x334b41){_0x334b41=_0x334b41||0xcc;return function(_0x419b9a){if(_0x419b9a){return _0x395d27[_0x4df6('0x1b')](_0x334b41);}return _0x395d27[_0x4df6('0x1c')](_0x334b41)[_0x4df6('0x1d')]();};}function respondWithResult(_0x4e55b0,_0x59347c){_0x59347c=_0x59347c||0xc8;return function(_0x38e8f9){if(_0x38e8f9){return _0x4e55b0[_0x4df6('0x1c')](_0x59347c)[_0x4df6('0x1e')](_0x38e8f9);}};}function respondWithFilteredResult(_0x4e49c6,_0x1a98ff){return function(_0x1b9463){if(_0x1b9463){var _0x11eef9=_0x1b9463[_0x4df6('0x1f')],_0x9b02d3=_0x1a98ff[_0x4df6('0x20')],_0x20de3e=_0x1a98ff['offset']+_0x1a98ff['limit'],_0x3443f1;if(_0x20de3e>=_0x11eef9){_0x20de3e=_0x11eef9;_0x3443f1=0xc8;}else{_0x3443f1=0xce;}_0x4e49c6[_0x4df6('0x1c')](_0x3443f1);return _0x4e49c6['set'](_0x4df6('0x21'),_0x9b02d3+'-'+_0x20de3e+'/'+_0x11eef9)['json'](_0x1b9463);}return null;};}function patchUpdates(_0x5cf0f7){return function(_0x5c9f86){try{jsonpatch['apply'](_0x5c9f86,_0x5cf0f7,!![]);}catch(_0x5d8f6b){return BPromise[_0x4df6('0x22')](_0x5d8f6b);}return _0x5c9f86[_0x4df6('0x23')]();};}function saveUpdates(_0x3f0744,_0x112a86){return function(_0x57f6e4){if(_0x57f6e4){return _0x57f6e4['update'](_0x3f0744)[_0x4df6('0x24')](function(_0x1a9798){return _0x1a9798;});}return null;};}function removeEntity(_0xd5317a,_0x50b5f7){return function(_0xcc0b0){if(_0xcc0b0){return _0xcc0b0[_0x4df6('0x25')]()[_0x4df6('0x24')](function(){_0xd5317a[_0x4df6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd6a9,_0x2dd570){return function(_0x3998e3){if(!_0x3998e3){_0x4fd6a9[_0x4df6('0x1b')](0x194);}return _0x3998e3;};}function handleError(_0x1b673f,_0x536e80){_0x536e80=_0x536e80||0x1f4;return function(_0x153095){logger[_0x4df6('0x26')](_0x153095[_0x4df6('0x27')]);if(_0x153095['name']){delete _0x153095[_0x4df6('0x28')];}_0x1b673f[_0x4df6('0x1c')](_0x536e80)[_0x4df6('0x29')](_0x153095);};}exports[_0x4df6('0x2a')]=function(_0x20d674,_0x351ad6){var _0xf148b9={},_0x2d76d5={},_0x2f7c55={'count':0x0,'rows':[]};var _0x113b1b=_[_0x4df6('0x2b')](db[_0x4df6('0x2c')][_0x4df6('0x2d')],function(_0x529d2d){return{'name':_0x529d2d[_0x4df6('0x2e')],'type':_0x529d2d['type'][_0x4df6('0x2f')]};});_0x2d76d5[_0x4df6('0x30')]=_['map'](_0x113b1b,_0x4df6('0x28'));_0x2d76d5['query']=_[_0x4df6('0x31')](_0x20d674[_0x4df6('0x32')]);_0x2d76d5[_0x4df6('0x33')]=_[_0x4df6('0x34')](_0x2d76d5[_0x4df6('0x30')],_0x2d76d5[_0x4df6('0x32')]);_0xf148b9[_0x4df6('0x35')]=_['intersection'](_0x2d76d5['model'],qs[_0x4df6('0x36')](_0x20d674[_0x4df6('0x32')][_0x4df6('0x36')]));_0xf148b9['attributes']=_0xf148b9['attributes'][_0x4df6('0x37')]?_0xf148b9['attributes']:_0x2d76d5['model'];if(!_0x20d674['query'][_0x4df6('0x38')]('nolimit')){_0xf148b9[_0x4df6('0x39')]=qs[_0x4df6('0x39')](_0x20d674[_0x4df6('0x32')][_0x4df6('0x39')]);_0xf148b9[_0x4df6('0x20')]=qs[_0x4df6('0x20')](_0x20d674[_0x4df6('0x32')][_0x4df6('0x20')]);}_0xf148b9[_0x4df6('0x3a')]=qs[_0x4df6('0x3b')](_0x20d674[_0x4df6('0x32')]['sort']);_0xf148b9['where']=qs[_0x4df6('0x33')](_[_0x4df6('0x3c')](_0x20d674[_0x4df6('0x32')],_0x2d76d5[_0x4df6('0x33')]),_0x113b1b);if(_0x20d674[_0x4df6('0x32')][_0x4df6('0x3d')]){_0xf148b9['where']=_[_0x4df6('0x3e')](_0xf148b9[_0x4df6('0x3f')],{'$or':_[_0x4df6('0x2b')](_0x113b1b,function(_0x34fbe2){if(_0x34fbe2[_0x4df6('0x40')]!==_0x4df6('0x41')){var _0x35ac36={};_0x35ac36[_0x34fbe2[_0x4df6('0x28')]]={'$like':'%'+_0x20d674[_0x4df6('0x32')]['filter']+'%'};return _0x35ac36;}})});}_0xf148b9=_['merge']({},_0xf148b9,_0x20d674[_0x4df6('0x42')]);var _0xb8a099={'where':_0xf148b9[_0x4df6('0x3f')]};return db[_0x4df6('0x2c')][_0x4df6('0x1f')](_0xb8a099)['then'](function(_0x56742e){_0x2f7c55[_0x4df6('0x1f')]=_0x56742e;if(_0x20d674[_0x4df6('0x32')]['includeAll']){_0xf148b9['include']=[{'all':!![]}];}return db[_0x4df6('0x2c')][_0x4df6('0x43')](_0xf148b9);})[_0x4df6('0x24')](function(_0x37c4b){_0x2f7c55[_0x4df6('0x44')]=_0x37c4b;return _0x2f7c55;})['then'](respondWithFilteredResult(_0x351ad6,_0xf148b9))[_0x4df6('0x45')](handleError(_0x351ad6,null));};exports[_0x4df6('0x46')]=function(_0x108ac1,_0x36a14e){var _0x48ff4f={'raw':!![],'where':{'id':_0x108ac1[_0x4df6('0x47')]['id']}},_0xc10360={};_0xc10360[_0x4df6('0x30')]=_[_0x4df6('0x31')](db[_0x4df6('0x2c')][_0x4df6('0x2d')]);_0xc10360[_0x4df6('0x32')]=_[_0x4df6('0x31')](_0x108ac1['query']);_0xc10360[_0x4df6('0x33')]=_[_0x4df6('0x34')](_0xc10360[_0x4df6('0x30')],_0xc10360['query']);_0x48ff4f[_0x4df6('0x35')]=_[_0x4df6('0x34')](_0xc10360[_0x4df6('0x30')],qs[_0x4df6('0x36')](_0x108ac1[_0x4df6('0x32')]['fields']));_0x48ff4f[_0x4df6('0x35')]=_0x48ff4f[_0x4df6('0x35')]['length']?_0x48ff4f[_0x4df6('0x35')]:_0xc10360[_0x4df6('0x30')];if(_0x108ac1['query'][_0x4df6('0x48')]){_0x48ff4f[_0x4df6('0x49')]=[{'all':!![]}];}_0x48ff4f=_[_0x4df6('0x3e')]({},_0x48ff4f,_0x108ac1[_0x4df6('0x42')]);return db['Dynamics365Field'][_0x4df6('0x4a')](_0x48ff4f)['then'](handleEntityNotFound(_0x36a14e,null))[_0x4df6('0x24')](respondWithResult(_0x36a14e,null))['catch'](handleError(_0x36a14e,null));};exports[_0x4df6('0x4b')]=function(_0x3847fb,_0x9fd6d0){return db['Dynamics365Field']['create'](_0x3847fb[_0x4df6('0x4c')],{})[_0x4df6('0x24')](respondWithResult(_0x9fd6d0,0xc9))[_0x4df6('0x45')](handleError(_0x9fd6d0,null));};exports['update']=function(_0x294e0d,_0x33180b){if(_0x294e0d[_0x4df6('0x4c')]['id']){delete _0x294e0d[_0x4df6('0x4c')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x294e0d['params']['id']}})['then'](handleEntityNotFound(_0x33180b,null))[_0x4df6('0x24')](saveUpdates(_0x294e0d[_0x4df6('0x4c')],null))[_0x4df6('0x24')](respondWithResult(_0x33180b,null))[_0x4df6('0x45')](handleError(_0x33180b,null));};exports[_0x4df6('0x25')]=function(_0x136510,_0x59c881){return db['Dynamics365Field'][_0x4df6('0x4a')]({'where':{'id':_0x136510['params']['id']}})[_0x4df6('0x24')](handleEntityNotFound(_0x59c881,null))[_0x4df6('0x24')](removeEntity(_0x59c881,null))[_0x4df6('0x45')](handleError(_0x59c881,null));}; \ No newline at end of file +var _0x7846=['json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','count','includeAll','include','rows','catch','show','params','options','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x2d8dcc,_0x5d5a76){var _0x3e2aa8=function(_0x129215){while(--_0x129215){_0x2d8dcc['push'](_0x2d8dcc['shift']());}};_0x3e2aa8(++_0x5d5a76);}(_0x7846,0xbf));var _0x6784=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x7846[_0x37e845];return _0x59e55b;};'use strict';var pdf=require(_0x6784('0x0'));var emlformat=require(_0x6784('0x1'));var rimraf=require(_0x6784('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6784('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6784('0x4'));var Mustache=require(_0x6784('0x5'));var util=require('util');var path=require(_0x6784('0x6'));var sox=require(_0x6784('0x7'));var csv=require(_0x6784('0x8'));var ejs=require(_0x6784('0x9'));var fs=require('fs');var _=require(_0x6784('0xa'));var squel=require(_0x6784('0xb'));var crypto=require('crypto');var jsforce=require(_0x6784('0xc'));var deskjs=require(_0x6784('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6784('0xe'));var Papa=require(_0x6784('0xf'));var Redis=require('ioredis');var authService=require(_0x6784('0x10'));var qs=require(_0x6784('0x11'));var as=require(_0x6784('0x12'));var hardwareService=require(_0x6784('0x13'));var logger=require(_0x6784('0x14'))(_0x6784('0x15'));var utils=require(_0x6784('0x16'));var config=require(_0x6784('0x17'));var db=require(_0x6784('0x18'))['db'];function respondWithStatusCode(_0xfb6f6d,_0x30bcfd){_0x30bcfd=_0x30bcfd||0xcc;return function(_0x34c698){if(_0x34c698){return _0xfb6f6d[_0x6784('0x19')](_0x30bcfd);}return _0xfb6f6d[_0x6784('0x1a')](_0x30bcfd)[_0x6784('0x1b')]();};}function respondWithResult(_0x196578,_0x30c0cd){_0x30c0cd=_0x30c0cd||0xc8;return function(_0x3110c3){if(_0x3110c3){return _0x196578[_0x6784('0x1a')](_0x30c0cd)[_0x6784('0x1c')](_0x3110c3);}};}function respondWithFilteredResult(_0x234980,_0x30c158){return function(_0x1e24e2){if(_0x1e24e2){var _0x530227=_0x1e24e2['count'],_0x5cebbb=_0x30c158[_0x6784('0x1d')],_0x36b237=_0x30c158[_0x6784('0x1d')]+_0x30c158[_0x6784('0x1e')],_0x44faa5;if(_0x36b237>=_0x530227){_0x36b237=_0x530227;_0x44faa5=0xc8;}else{_0x44faa5=0xce;}_0x234980[_0x6784('0x1a')](_0x44faa5);return _0x234980[_0x6784('0x1f')](_0x6784('0x20'),_0x5cebbb+'-'+_0x36b237+'/'+_0x530227)[_0x6784('0x1c')](_0x1e24e2);}return null;};}function patchUpdates(_0x549bbc){return function(_0x4ccae9){try{jsonpatch[_0x6784('0x21')](_0x4ccae9,_0x549bbc,!![]);}catch(_0x5c54d3){return BPromise[_0x6784('0x22')](_0x5c54d3);}return _0x4ccae9[_0x6784('0x23')]();};}function saveUpdates(_0x26f55a,_0x10be67){return function(_0x50cce2){if(_0x50cce2){return _0x50cce2['update'](_0x26f55a)[_0x6784('0x24')](function(_0x113412){return _0x113412;});}return null;};}function removeEntity(_0x34d6ff,_0x42b2e4){return function(_0x32921c){if(_0x32921c){return _0x32921c[_0x6784('0x25')]()['then'](function(){_0x34d6ff['status'](0xcc)[_0x6784('0x1b')]();});}};}function handleEntityNotFound(_0x26c418,_0x34e51e){return function(_0x1a4347){if(!_0x1a4347){_0x26c418[_0x6784('0x19')](0x194);}return _0x1a4347;};}function handleError(_0x3c9bd0,_0x4ccc2a){_0x4ccc2a=_0x4ccc2a||0x1f4;return function(_0x20f962){logger[_0x6784('0x26')](_0x20f962[_0x6784('0x27')]);if(_0x20f962['name']){delete _0x20f962[_0x6784('0x28')];}_0x3c9bd0[_0x6784('0x1a')](_0x4ccc2a)['send'](_0x20f962);};}exports[_0x6784('0x29')]=function(_0x182ef4,_0x5a4ce7){var _0x5d396d={},_0x33dbd7={},_0x552463={'count':0x0,'rows':[]};var _0x2a9eaf=_[_0x6784('0x2a')](db[_0x6784('0x2b')][_0x6784('0x2c')],function(_0x3971d2){return{'name':_0x3971d2[_0x6784('0x2d')],'type':_0x3971d2[_0x6784('0x2e')][_0x6784('0x2f')]};});_0x33dbd7[_0x6784('0x30')]=_[_0x6784('0x2a')](_0x2a9eaf,'name');_0x33dbd7[_0x6784('0x31')]=_[_0x6784('0x32')](_0x182ef4[_0x6784('0x31')]);_0x33dbd7['filters']=_[_0x6784('0x33')](_0x33dbd7['model'],_0x33dbd7[_0x6784('0x31')]);_0x5d396d[_0x6784('0x34')]=_[_0x6784('0x33')](_0x33dbd7[_0x6784('0x30')],qs['fields'](_0x182ef4[_0x6784('0x31')][_0x6784('0x35')]));_0x5d396d[_0x6784('0x34')]=_0x5d396d['attributes']['length']?_0x5d396d[_0x6784('0x34')]:_0x33dbd7['model'];if(!_0x182ef4[_0x6784('0x31')]['hasOwnProperty']('nolimit')){_0x5d396d[_0x6784('0x1e')]=qs[_0x6784('0x1e')](_0x182ef4[_0x6784('0x31')][_0x6784('0x1e')]);_0x5d396d['offset']=qs[_0x6784('0x1d')](_0x182ef4[_0x6784('0x31')][_0x6784('0x1d')]);}_0x5d396d[_0x6784('0x36')]=qs['sort'](_0x182ef4[_0x6784('0x31')][_0x6784('0x37')]);_0x5d396d[_0x6784('0x38')]=qs[_0x6784('0x39')](_[_0x6784('0x3a')](_0x182ef4[_0x6784('0x31')],_0x33dbd7[_0x6784('0x39')]),_0x2a9eaf);if(_0x182ef4['query'][_0x6784('0x3b')]){_0x5d396d[_0x6784('0x38')]=_[_0x6784('0x3c')](_0x5d396d['where'],{'$or':_[_0x6784('0x2a')](_0x2a9eaf,function(_0x6b748e){if(_0x6b748e[_0x6784('0x2e')]!=='VIRTUAL'){var _0x19f1e4={};_0x19f1e4[_0x6b748e[_0x6784('0x28')]]={'$like':'%'+_0x182ef4['query'][_0x6784('0x3b')]+'%'};return _0x19f1e4;}})});}_0x5d396d=_[_0x6784('0x3c')]({},_0x5d396d,_0x182ef4['options']);var _0x3926a4={'where':_0x5d396d['where']};return db[_0x6784('0x2b')][_0x6784('0x3d')](_0x3926a4)[_0x6784('0x24')](function(_0xb753a6){_0x552463[_0x6784('0x3d')]=_0xb753a6;if(_0x182ef4[_0x6784('0x31')][_0x6784('0x3e')]){_0x5d396d[_0x6784('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x5d396d);})[_0x6784('0x24')](function(_0x2c2fb0){_0x552463[_0x6784('0x40')]=_0x2c2fb0;return _0x552463;})[_0x6784('0x24')](respondWithFilteredResult(_0x5a4ce7,_0x5d396d))[_0x6784('0x41')](handleError(_0x5a4ce7,null));};exports[_0x6784('0x42')]=function(_0x563b5b,_0x3231e3){var _0x3e208b={'raw':!![],'where':{'id':_0x563b5b[_0x6784('0x43')]['id']}},_0x49cbb9={};_0x49cbb9['model']=_[_0x6784('0x32')](db[_0x6784('0x2b')][_0x6784('0x2c')]);_0x49cbb9[_0x6784('0x31')]=_['keys'](_0x563b5b[_0x6784('0x31')]);_0x49cbb9[_0x6784('0x39')]=_[_0x6784('0x33')](_0x49cbb9[_0x6784('0x30')],_0x49cbb9[_0x6784('0x31')]);_0x3e208b[_0x6784('0x34')]=_[_0x6784('0x33')](_0x49cbb9['model'],qs[_0x6784('0x35')](_0x563b5b[_0x6784('0x31')][_0x6784('0x35')]));_0x3e208b[_0x6784('0x34')]=_0x3e208b[_0x6784('0x34')]['length']?_0x3e208b[_0x6784('0x34')]:_0x49cbb9[_0x6784('0x30')];if(_0x563b5b[_0x6784('0x31')][_0x6784('0x3e')]){_0x3e208b['include']=[{'all':!![]}];}_0x3e208b=_['merge']({},_0x3e208b,_0x563b5b[_0x6784('0x44')]);return db[_0x6784('0x2b')][_0x6784('0x45')](_0x3e208b)[_0x6784('0x24')](handleEntityNotFound(_0x3231e3,null))[_0x6784('0x24')](respondWithResult(_0x3231e3,null))['catch'](handleError(_0x3231e3,null));};exports[_0x6784('0x46')]=function(_0x2d7ea3,_0x3e6e57){return db[_0x6784('0x2b')][_0x6784('0x46')](_0x2d7ea3[_0x6784('0x47')],{})[_0x6784('0x24')](respondWithResult(_0x3e6e57,0xc9))[_0x6784('0x41')](handleError(_0x3e6e57,null));};exports[_0x6784('0x48')]=function(_0x24635c,_0x3d0410){if(_0x24635c['body']['id']){delete _0x24635c[_0x6784('0x47')]['id'];}return db['Dynamics365Field'][_0x6784('0x45')]({'where':{'id':_0x24635c[_0x6784('0x43')]['id']}})[_0x6784('0x24')](handleEntityNotFound(_0x3d0410,null))[_0x6784('0x24')](saveUpdates(_0x24635c['body'],null))[_0x6784('0x24')](respondWithResult(_0x3d0410,null))[_0x6784('0x41')](handleError(_0x3d0410,null));};exports[_0x6784('0x25')]=function(_0x22fa72,_0x9fb1c6){return db['Dynamics365Field'][_0x6784('0x45')]({'where':{'id':_0x22fa72['params']['id']}})[_0x6784('0x24')](handleEntityNotFound(_0x9fb1c6,null))['then'](removeEntity(_0x9fb1c6,null))[_0x6784('0x41')](handleError(_0x9fb1c6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b21c732..60373b6 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 _0x349a=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define'];(function(_0x2ce9c1,_0x582960){var _0x7e27ce=function(_0x5a9c4d){while(--_0x5a9c4d){_0x2ce9c1['push'](_0x2ce9c1['shift']());}};_0x7e27ce(++_0x582960);}(_0x349a,0x16c));var _0xa349=function(_0x1f1283,_0x1bea3b){_0x1f1283=_0x1f1283-0x0;var _0x205041=_0x349a[_0x1f1283];return _0x205041;};'use strict';var _=require(_0xa349('0x0'));var util=require(_0xa349('0x1'));var logger=require('../../config/logger')(_0xa349('0x2'));var moment=require(_0xa349('0x3'));var BPromise=require(_0xa349('0x4'));var rp=require(_0xa349('0x5'));var fs=require('fs');var path=require(_0xa349('0x6'));var rimraf=require(_0xa349('0x7'));var config=require(_0xa349('0x8'));var attributes=require(_0xa349('0x9'));module['exports']=function(_0x4a2195,_0x4cfe30){return _0x4a2195[_0xa349('0xa')](_0xa349('0xb'),attributes,{'tableName':_0xa349('0xc'),'paranoid':![],'indexes':[{'name':_0xa349('0xd'),'fields':[_0xa349('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c24=['idField','FieldId','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0x4c24,0xb8));var _0x44c2=function(_0x597598,_0x3881dc){_0x597598=_0x597598-0x0;var _0x3df496=_0x4c24[_0x597598];return _0x3df496;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44c2('0x0'))('api');var moment=require(_0x44c2('0x1'));var BPromise=require(_0x44c2('0x2'));var rp=require(_0x44c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44c2('0x4'));var config=require(_0x44c2('0x5'));var attributes=require(_0x44c2('0x6'));module[_0x44c2('0x7')]=function(_0x138eb3,_0x4ddbc8){return _0x138eb3[_0x44c2('0x8')](_0x44c2('0x9'),attributes,{'tableName':_0x44c2('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x44c2('0xb'),_0x44c2('0xc')],'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 73322b3..8dc2414 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eec=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch'];(function(_0x2f08c1,_0x45a9bd){var _0x3bd057=function(_0xca272e){while(--_0xca272e){_0x2f08c1['push'](_0x2f08c1['shift']());}};_0x3bd057(++_0x45a9bd);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var moment=require(_0xc6ee('0x2'));var BPromise=require(_0xc6ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6ee('0x4'));var db=require(_0xc6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6ee('0x6'))(_0xc6ee('0x7'));var config=require(_0xc6ee('0x8'));var jayson=require(_0xc6ee('0x9'));var client=jayson[_0xc6ee('0xa')][_0xc6ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa820be,_0x3325b5,_0x476339){return new BPromise(function(_0x59bd32,_0x5d1421){return client[_0xc6ee('0xc')](_0xa820be,_0x476339)[_0xc6ee('0xd')](function(_0x4d6c8b){logger[_0xc6ee('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3325b5,_0xc6ee('0xf'));logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x3325b5,_0xc6ee('0xf'),JSON['stringify'](_0x4d6c8b));if(_0x4d6c8b[_0xc6ee('0x12')]){if(_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x13')]===0x1f4){logger['error'](_0xc6ee('0x14'),_0x3325b5,_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x15')]);return _0x5d1421(_0x4d6c8b['error'][_0xc6ee('0x15')]);}logger[_0xc6ee('0x12')](_0xc6ee('0x14'),_0x3325b5,_0x4d6c8b['error'][_0xc6ee('0x15')]);return _0x59bd32(_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x15')]);}else{logger['info'](_0xc6ee('0x14'),_0x3325b5,_0xc6ee('0xf'));_0x59bd32(_0x4d6c8b[_0xc6ee('0x16')][_0xc6ee('0x15')]);}})[_0xc6ee('0x17')](function(_0x18fea5){logger[_0xc6ee('0x12')](_0xc6ee('0x14'),_0x3325b5,_0x18fea5);_0x5d1421(_0x18fea5);});});} \ No newline at end of file +var _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x3d8977,_0x244dee){var _0xe6d544=function(_0x112b00){while(--_0x112b00){_0x3d8977['push'](_0x3d8977['shift']());}};_0xe6d544(++_0x244dee);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x52a99c,_0x386807){_0x52a99c=_0x52a99c-0x0;var _0x3cf27f=_0xc1c6[_0x52a99c];return _0x3cf27f;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 56a2a80..e6f9566 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 _0xadf8=['path','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','util'];(function(_0x381117,_0x36e787){var _0x47cac3=function(_0x139bad){while(--_0x139bad){_0x381117['push'](_0x381117['shift']());}};_0x47cac3(++_0x36e787);}(_0xadf8,0x18f));var _0x8adf=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xadf8[_0x3b19ea];return _0x40ece9;};'use strict';var multer=require('multer');var util=require(_0x8adf('0x0'));var path=require(_0x8adf('0x1'));var timeout=require('connect-timeout');var express=require(_0x8adf('0x2'));var router=express['Router']();var auth=require(_0x8adf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8adf('0x4'));var controller=require(_0x8adf('0x5'));router[_0x8adf('0x6')]('/',auth[_0x8adf('0x7')](),controller[_0x8adf('0x8')]);router[_0x8adf('0x6')]('/:id',auth[_0x8adf('0x7')](),controller[_0x8adf('0x9')]);router[_0x8adf('0x6')](_0x8adf('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x8adf('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8adf('0xb')]);router['post']('/',auth[_0x8adf('0x7')](),controller['create']);router[_0x8adf('0xc')](_0x8adf('0xa'),auth[_0x8adf('0x7')](),controller[_0x8adf('0xd')]);router[_0x8adf('0xe')](_0x8adf('0xf'),auth[_0x8adf('0x7')](),controller[_0x8adf('0x10')]);router[_0x8adf('0x11')](_0x8adf('0xf'),auth[_0x8adf('0x7')](),controller[_0x8adf('0x12')]);module[_0x8adf('0x13')]=router; \ No newline at end of file +var _0x2d2e=['getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x51498d,_0x57db51){var _0x48acb6=function(_0x2e94b3){while(--_0x2e94b3){_0x51498d['push'](_0x51498d['shift']());}};_0x48acb6(++_0x57db51);}(_0x2d2e,0x106));var _0xe2d2=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x2d2e[_0x1d6a82];return _0x5834ac;};'use strict';var multer=require('multer');var util=require(_0xe2d2('0x0'));var path=require(_0xe2d2('0x1'));var timeout=require(_0xe2d2('0x2'));var express=require(_0xe2d2('0x3'));var router=express[_0xe2d2('0x4')]();var auth=require(_0xe2d2('0x5'));var interaction=require(_0xe2d2('0x6'));var config=require(_0xe2d2('0x7'));var controller=require(_0xe2d2('0x8'));router[_0xe2d2('0x9')]('/',auth[_0xe2d2('0xa')](),controller['index']);router[_0xe2d2('0x9')](_0xe2d2('0xb'),auth[_0xe2d2('0xa')](),controller[_0xe2d2('0xc')]);router['get'](_0xe2d2('0xd'),auth[_0xe2d2('0xa')](),controller[_0xe2d2('0xe')]);router['get']('/:id/fields',auth[_0xe2d2('0xa')](),controller[_0xe2d2('0xf')]);router[_0xe2d2('0x10')]('/',auth[_0xe2d2('0xa')](),controller[_0xe2d2('0x11')]);router[_0xe2d2('0x10')](_0xe2d2('0xd'),auth[_0xe2d2('0xa')](),controller[_0xe2d2('0x12')]);router[_0xe2d2('0x13')](_0xe2d2('0xb'),auth[_0xe2d2('0xa')](),controller['update']);router[_0xe2d2('0x14')](_0xe2d2('0xb'),auth[_0xe2d2('0xa')](),controller[_0xe2d2('0x15')]);module[_0xe2d2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ebf00ed..c5cbe67 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 _0x160f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')]},'description':{'type':Sequelize[_0xf160('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf160('0x3')},'apiKey':{'type':Sequelize[_0xf160('0x2')]},'remoteUri':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x4')},'serverUrl':{'type':Sequelize[_0xf160('0x2')]}}; \ No newline at end of file +var _0xe34f=['username','remoteUri','STRING'];(function(_0x434a7b,_0x1f126c){var _0x5eaff0=function(_0x45b7ac){while(--_0x45b7ac){_0x434a7b['push'](_0x434a7b['shift']());}};_0x5eaff0(++_0x1f126c);}(_0xe34f,0xbc));var _0xfe34=function(_0x5c286c,_0xb10ce5){_0x5c286c=_0x5c286c-0x0;var _0x4b0e7c=_0xe34f[_0x5c286c];return _0x4b0e7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe34('0x0')],'unique':_0xfe34('0x1')},'apiKey':{'type':Sequelize[_0xfe34('0x0')]},'remoteUri':{'type':Sequelize[_0xfe34('0x0')],'unique':_0xfe34('0x2')},'serverUrl':{'type':Sequelize[_0xfe34('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 289ccce..eaff202 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 _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(_0x479bb8,_0x7dd48e){var _0x2be2fd=function(_0x2544ac){while(--_0x2544ac){_0x479bb8['push'](_0x479bb8['shift']());}};_0x2be2fd(++_0x7dd48e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x511d3c,_0x2483e5){_0x511d3c=_0x511d3c-0x0;var _0x413d9e=_0x1cb9[_0x511d3c];return _0x413d9e;};'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 +var _0x326f=['offset','limit','set','Content-Range','json','apply','reject','then','destroy','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','merge','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','options','addConfiguration','AccountId','getSubjects','Descriptions','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','GET','api/v2/ticket_fields','format','base64','requester','subject','description','source','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','Sequelize','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count'];(function(_0x270928,_0x461c5f){var _0x56cae1=function(_0x46218e){while(--_0x46218e){_0x270928['push'](_0x270928['shift']());}};_0x56cae1(++_0x461c5f);}(_0x326f,0xd1));var _0xf326=function(_0x437356,_0x22a39b){_0x437356=_0x437356-0x0;var _0x46c1fb=_0x326f[_0x437356];return _0x46c1fb;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xf326('0x17'));var client=jayson[_0xf326('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x342fe5,_0x472632,_0x3504eb){if(_0x3504eb){var _0x17a098=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17a098['test'](_0x472632)){return _0x342fe5;}else{throw new db[(_0xf326('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 _0x342fe5;}}function respondWithRpcPromise(_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return new BPromise(function(_0x292f4b,_0x287a2a){var _0x34128e=_0xa63d1a||client;return _0x34128e[_0xf326('0x1a')](_0xdf21d9,_0x1f2e5a)['then'](function(_0x3ad7da){logger[_0xf326('0x1b')](_0xf326('0x1c'),_0x11f6d2,_0xf326('0x1d'));logger[_0xf326('0x1e')](_0xf326('0x1f'),_0x11f6d2,'request\x20sent',JSON['stringify'](_0x3ad7da));if(_0x3ad7da['error']){if(_0x3ad7da[_0xf326('0x20')][_0xf326('0x21')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x11f6d2,_0x3ad7da[_0xf326('0x20')]['message']);return _0x287a2a(_0x3ad7da['error'][_0xf326('0x22')]);}logger[_0xf326('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x11f6d2,_0x3ad7da['error'][_0xf326('0x22')]);return _0x292f4b(_0x3ad7da[_0xf326('0x20')]['message']);}else{logger[_0xf326('0x1b')](_0xf326('0x1c'),_0x11f6d2,_0xf326('0x1d'));_0x292f4b(_0x3ad7da[_0xf326('0x23')][_0xf326('0x22')]);}})[_0xf326('0x24')](function(_0x5ce532){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x11f6d2,_0x5ce532);_0x287a2a(_0x5ce532);});});}function respondWithStatusCode(_0x520d85,_0x1a2c4e){_0x1a2c4e=_0x1a2c4e||0xcc;return function(_0x2cd45a){if(_0x2cd45a){return _0x520d85[_0xf326('0x25')](_0x1a2c4e);}return _0x520d85[_0xf326('0x26')](_0x1a2c4e)[_0xf326('0x27')]();};}function respondWithResult(_0x5217d4,_0x201d28){_0x201d28=_0x201d28||0xc8;return function(_0xa3c0b){if(_0xa3c0b){return _0x5217d4[_0xf326('0x26')](_0x201d28)['json'](_0xa3c0b);}};}function respondWithFilteredResult(_0x1617d2,_0x55ad0f){return function(_0x4a9abf){if(_0x4a9abf){var _0x6a8e89=_0x4a9abf[_0xf326('0x28')],_0x1ae23a=_0x55ad0f[_0xf326('0x29')],_0x2fa28e=_0x55ad0f['offset']+_0x55ad0f[_0xf326('0x2a')],_0x5dbe63;if(_0x2fa28e>=_0x6a8e89){_0x2fa28e=_0x6a8e89;_0x5dbe63=0xc8;}else{_0x5dbe63=0xce;}_0x1617d2[_0xf326('0x26')](_0x5dbe63);return _0x1617d2[_0xf326('0x2b')](_0xf326('0x2c'),_0x1ae23a+'-'+_0x2fa28e+'/'+_0x6a8e89)[_0xf326('0x2d')](_0x4a9abf);}return null;};}function patchUpdates(_0x269be9){return function(_0x161143){try{jsonpatch[_0xf326('0x2e')](_0x161143,_0x269be9,!![]);}catch(_0x43b951){return BPromise[_0xf326('0x2f')](_0x43b951);}return _0x161143['save']();};}function saveUpdates(_0x1035ed,_0x424104){return function(_0x21b23d){if(_0x21b23d){return _0x21b23d['update'](_0x1035ed)[_0xf326('0x30')](function(_0x1721fd){return _0x1721fd;});}return null;};}function removeEntity(_0x303dc6,_0x4df451){return function(_0x5b101d){if(_0x5b101d){return _0x5b101d[_0xf326('0x31')]()[_0xf326('0x30')](function(){_0x303dc6[_0xf326('0x26')](0xcc)[_0xf326('0x27')]();});}};}function handleEntityNotFound(_0x30694f,_0x2e8a64){return function(_0x62585a){if(!_0x62585a){_0x30694f[_0xf326('0x25')](0x194);}return _0x62585a;};}function handleError(_0x580374,_0x461e93){_0x461e93=_0x461e93||0x1f4;return function(_0x1981bc){logger['error'](_0x1981bc[_0xf326('0x32')]);if(_0x1981bc['name']){delete _0x1981bc[_0xf326('0x33')];}_0x580374['status'](_0x461e93)['send'](_0x1981bc);};}exports[_0xf326('0x34')]=function(_0x4d8eac,_0x40dcb4){var _0x57aa27={},_0x310dbb={},_0x409260={'count':0x0,'rows':[]};var _0x2750ae=_['map'](db[_0xf326('0x35')][_0xf326('0x36')],function(_0x48525a){return{'name':_0x48525a[_0xf326('0x37')],'type':_0x48525a[_0xf326('0x38')][_0xf326('0x39')]};});_0x310dbb[_0xf326('0x3a')]=_['map'](_0x2750ae,_0xf326('0x33'));_0x310dbb[_0xf326('0x3b')]=_[_0xf326('0x3c')](_0x4d8eac[_0xf326('0x3b')]);_0x310dbb[_0xf326('0x3d')]=_['intersection'](_0x310dbb[_0xf326('0x3a')],_0x310dbb[_0xf326('0x3b')]);_0x57aa27['attributes']=_['intersection'](_0x310dbb[_0xf326('0x3a')],qs['fields'](_0x4d8eac['query'][_0xf326('0x3e')]));_0x57aa27['attributes']=_0x57aa27[_0xf326('0x3f')][_0xf326('0x40')]?_0x57aa27[_0xf326('0x3f')]:_0x310dbb[_0xf326('0x3a')];if(!_0x4d8eac['query'][_0xf326('0x41')](_0xf326('0x42'))){_0x57aa27[_0xf326('0x2a')]=qs[_0xf326('0x2a')](_0x4d8eac[_0xf326('0x3b')][_0xf326('0x2a')]);_0x57aa27[_0xf326('0x29')]=qs[_0xf326('0x29')](_0x4d8eac[_0xf326('0x3b')][_0xf326('0x29')]);}_0x57aa27[_0xf326('0x43')]=qs[_0xf326('0x44')](_0x4d8eac['query'][_0xf326('0x44')]);_0x57aa27[_0xf326('0x45')]=qs[_0xf326('0x3d')](_[_0xf326('0x46')](_0x4d8eac[_0xf326('0x3b')],_0x310dbb[_0xf326('0x3d')]),_0x2750ae);if(_0x4d8eac['query'][_0xf326('0x47')]){_0x57aa27[_0xf326('0x45')]=_['merge'](_0x57aa27[_0xf326('0x45')],{'$or':_[_0xf326('0x48')](_0x2750ae,function(_0x130c56){if(_0x130c56[_0xf326('0x38')]!==_0xf326('0x49')){var _0x55361f={};_0x55361f[_0x130c56['name']]={'$like':'%'+_0x4d8eac[_0xf326('0x3b')][_0xf326('0x47')]+'%'};return _0x55361f;}})});}_0x57aa27=_['merge']({},_0x57aa27,_0x4d8eac['options']);var _0x8e318d={'where':_0x57aa27[_0xf326('0x45')]};return db[_0xf326('0x35')]['count'](_0x8e318d)[_0xf326('0x30')](function(_0xe96e1e){_0x409260[_0xf326('0x28')]=_0xe96e1e;if(_0x4d8eac[_0xf326('0x3b')][_0xf326('0x4a')]){_0x57aa27[_0xf326('0x4b')]=[{'all':!![]}];}return db[_0xf326('0x35')][_0xf326('0x4c')](_0x57aa27);})[_0xf326('0x30')](function(_0x27ced1){_0x409260[_0xf326('0x4d')]=_0x27ced1;return _0x409260;})[_0xf326('0x30')](respondWithFilteredResult(_0x40dcb4,_0x57aa27))[_0xf326('0x24')](handleError(_0x40dcb4,null));};exports[_0xf326('0x4e')]=function(_0xeac1a1,_0x59f9a7){var _0x199f8b={'raw':![],'where':{'id':_0xeac1a1[_0xf326('0x4f')]['id']}},_0x1b0e03={};_0x1b0e03[_0xf326('0x3a')]=_['keys'](db[_0xf326('0x35')][_0xf326('0x36')]);_0x1b0e03[_0xf326('0x3b')]=_[_0xf326('0x3c')](_0xeac1a1['query']);_0x1b0e03[_0xf326('0x3d')]=_[_0xf326('0x50')](_0x1b0e03[_0xf326('0x3a')],_0x1b0e03[_0xf326('0x3b')]);_0x199f8b[_0xf326('0x3f')]=_['intersection'](_0x1b0e03['model'],qs[_0xf326('0x3e')](_0xeac1a1[_0xf326('0x3b')][_0xf326('0x3e')]));_0x199f8b['attributes']=_0x199f8b[_0xf326('0x3f')][_0xf326('0x40')]?_0x199f8b[_0xf326('0x3f')]:_0x1b0e03['model'];if(_0xeac1a1['query'][_0xf326('0x4a')]){_0x199f8b['include']=[{'all':!![]}];}_0x199f8b=_[_0xf326('0x51')]({},_0x199f8b,_0xeac1a1['options']);return db[_0xf326('0x35')][_0xf326('0x52')](_0x199f8b)[_0xf326('0x30')](handleEntityNotFound(_0x59f9a7,null))[_0xf326('0x30')](respondWithResult(_0x59f9a7,null))[_0xf326('0x24')](handleError(_0x59f9a7,null));};exports[_0xf326('0x53')]=function(_0x7f7ece,_0x495a16){return db[_0xf326('0x35')][_0xf326('0x53')](_0x7f7ece[_0xf326('0x54')],{})['then'](respondWithResult(_0x495a16,0xc9))[_0xf326('0x24')](handleError(_0x495a16,null));};exports[_0xf326('0x55')]=function(_0x3b8635,_0x16c578){if(_0x3b8635[_0xf326('0x54')]['id']){delete _0x3b8635['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x52')]({'where':{'id':_0x3b8635[_0xf326('0x4f')]['id']}})[_0xf326('0x30')](handleEntityNotFound(_0x16c578,null))['then'](saveUpdates(_0x3b8635[_0xf326('0x54')],null))[_0xf326('0x30')](respondWithResult(_0x16c578,null))[_0xf326('0x24')](handleError(_0x16c578,null));};exports[_0xf326('0x31')]=function(_0x4d3b9e,_0x5be2b1){return db[_0xf326('0x35')][_0xf326('0x52')]({'where':{'id':_0x4d3b9e['params']['id']}})[_0xf326('0x30')](handleEntityNotFound(_0x5be2b1,null))[_0xf326('0x30')](removeEntity(_0x5be2b1,null))[_0xf326('0x24')](handleError(_0x5be2b1,null));};exports[_0xf326('0x56')]=function(_0x5765b0,_0xb1c18c,_0x5657b7){var _0x5dbeb9={};var _0x9d84c3={};var _0x51d466;var _0x173760;return db[_0xf326('0x35')][_0xf326('0x57')]({'where':{'id':_0x5765b0['params']['id']}})['then'](handleEntityNotFound(_0xb1c18c,null))[_0xf326('0x30')](function(_0xa85a42){if(_0xa85a42){_0x51d466=_0xa85a42;_0x9d84c3[_0xf326('0x3a')]=_['keys'](db[_0xf326('0x58')]['rawAttributes']);_0x9d84c3[_0xf326('0x3b')]=_[_0xf326('0x3c')](_0x5765b0[_0xf326('0x3b')]);_0x9d84c3[_0xf326('0x3d')]=_[_0xf326('0x50')](_0x9d84c3[_0xf326('0x3a')],_0x9d84c3[_0xf326('0x3b')]);_0x5dbeb9[_0xf326('0x3f')]=_[_0xf326('0x50')](_0x9d84c3[_0xf326('0x3a')],qs[_0xf326('0x3e')](_0x5765b0[_0xf326('0x3b')][_0xf326('0x3e')]));_0x5dbeb9['attributes']=_0x5dbeb9[_0xf326('0x3f')]['length']?_0x5dbeb9[_0xf326('0x3f')]:_0x9d84c3[_0xf326('0x3a')];_0x5dbeb9['order']=qs[_0xf326('0x44')](_0x5765b0['query'][_0xf326('0x44')]);_0x5dbeb9[_0xf326('0x45')]=qs[_0xf326('0x3d')](_[_0xf326('0x46')](_0x5765b0[_0xf326('0x3b')],_0x9d84c3['filters']));if(_0x5765b0['query'][_0xf326('0x47')]){_0x5dbeb9[_0xf326('0x45')]=_[_0xf326('0x51')](_0x5dbeb9[_0xf326('0x45')],{'$or':_[_0xf326('0x48')](_0x5dbeb9['attributes'],function(_0x28c4f2){var _0x471da8={};_0x471da8[_0x28c4f2]={'$like':'%'+_0x5765b0['query']['filter']+'%'};return _0x471da8;})});}_0x5dbeb9=_['merge']({},_0x5dbeb9,_0x5765b0[_0xf326('0x59')]);return _0x51d466[_0xf326('0x56')](_0x5dbeb9);}})[_0xf326('0x30')](function(_0x235525){if(_0x235525){_0x173760=_0x235525[_0xf326('0x40')];if(!_0x5765b0[_0xf326('0x3b')][_0xf326('0x41')]('nolimit')){_0x5dbeb9[_0xf326('0x2a')]=qs[_0xf326('0x2a')](_0x5765b0[_0xf326('0x3b')][_0xf326('0x2a')]);_0x5dbeb9['offset']=qs[_0xf326('0x29')](_0x5765b0['query']['offset']);}return _0x51d466[_0xf326('0x56')](_0x5dbeb9);}})['then'](function(_0x78ba34){if(_0x78ba34){return _0x78ba34?{'count':_0x173760,'rows':_0x78ba34}:null;}})[_0xf326('0x30')](respondWithResult(_0xb1c18c,null))[_0xf326('0x24')](handleError(_0xb1c18c,null));};exports[_0xf326('0x5a')]=function(_0x17cd36,_0x541491,_0x4a053c){if(_0x17cd36['body']['id']){delete _0x17cd36[_0xf326('0x54')]['id'];}return db[_0xf326('0x35')][_0xf326('0x57')]({'where':{'id':_0x17cd36[_0xf326('0x4f')]['id']}})[_0xf326('0x30')](handleEntityNotFound(_0x541491,null))['then'](function(_0x1ed961){if(_0x1ed961){_0x17cd36[_0xf326('0x54')][_0xf326('0x5b')]=_0x1ed961['id'];_0x17cd36['body']['Subjects']=integrations[_0xf326('0x5c')](_0x17cd36[_0xf326('0x54')]['channel'],_0x17cd36['body'][_0xf326('0x38')]);_0x17cd36['body'][_0xf326('0x5d')]=integrations['getDescriptions'](_0x17cd36['body']['channel'],_0x17cd36[_0xf326('0x54')][_0xf326('0x38')]);return db[_0xf326('0x58')]['create'](_0x17cd36[_0xf326('0x54')],{'include':[{'model':db[_0xf326('0x5e')],'as':_0xf326('0x5f')},{'model':db[_0xf326('0x5e')],'as':_0xf326('0x5d')}]});}return null;})[_0xf326('0x30')](respondWithResult(_0x541491,null))[_0xf326('0x24')](handleError(_0x541491,null));};exports[_0xf326('0x60')]=function(_0x3855a4,_0x5290da,_0x34c3cf){var _0x5b1494='';return db[_0xf326('0x35')][_0xf326('0x57')]({'where':{'id':_0x3855a4[_0xf326('0x4f')]['id']},'attributes':['id','remoteUri',_0xf326('0x61')]})[_0xf326('0x30')](handleEntityNotFound(_0x5290da,null))[_0xf326('0x30')](function(_0x4dc8d7){if(_0x4dc8d7){_0x5b1494=_0x4dc8d7[_0xf326('0x62')];var _0x4057e1=_0x5b1494[_0xf326('0x63')](-0x1);if(_0x4057e1==='/'){_0x5b1494=_0x5b1494[_0xf326('0x64')](0x0,_0x5b1494['lastIndexOf'](_0x4057e1));}return rp({'method':_0xf326('0x65'),'uri':util['format']('%s/%s',_0x5b1494,_0xf326('0x66')),'headers':{'Authorization':util[_0xf326('0x67')]('Basic\x20%s',new Buffer(util['format']('%s:X',_0x4dc8d7[_0xf326('0x61')]))['toString'](_0xf326('0x68')))},'json':!![]});}})[_0xf326('0x30')](function(_0x3434b2){if(_0x3434b2){var _0x2ec314=[_0xf326('0x69'),_0xf326('0x6a'),'agent',_0xf326('0x6b'),_0xf326('0x26'),'priority','group',_0xf326('0x6c'),'ticket_type',_0xf326('0x6d'),_0xf326('0x6e')];_[_0xf326('0x6f')](_0x3434b2,function(_0x363e64){return _0x2ec314[_0xf326('0x70')](_0x363e64[_0xf326('0x33')])||!_0x363e64[_0xf326('0x71')]&&_0x363e64[_0xf326('0x38')]!==_0xf326('0x72')&&_0x363e64['type']!==_0xf326('0x73');});return{'count':_0x3434b2[_0xf326('0x40')],'rows':_['map'](_0x3434b2,function(_0x3c82cf){return{'id':_0x3c82cf['name'],'name':_0x3c82cf[_0xf326('0x74')],'custom':!_0x3c82cf[_0xf326('0x71')],'options':_0x3c82cf[_0xf326('0x75')]?_['map'](_0x3c82cf[_0xf326('0x75')],function(_0x1c86c8){return{'name':_[_0xf326('0x76')](_0x1c86c8),'value':_0x1c86c8};}):[]};})};}})[_0xf326('0x30')](respondWithResult(_0x5290da,null))[_0xf326('0x24')](function(_0x1e50aa){var _0x148779=_0x3855a4[_0xf326('0x3b')][_0xf326('0x77')]?0x1f4:_0x1e50aa[_0xf326('0x78')]||0x1f4;logger[_0xf326('0x20')](_0xf326('0x79'),_0xf326('0x60'),_0x148779,JSON[_0xf326('0x7a')](_0x1e50aa));delete _0x1e50aa[_0xf326('0x33')];if(_0x148779===0x191){_0x148779=0x190;}_0x5290da['status'](_0x148779)[_0xf326('0x7b')](_0x3855a4[_0xf326('0x3b')]['test']?{'message':_0xf326('0x7c'),'statusCode':_0x1e50aa[_0xf326('0x78')]}:_0x1e50aa);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ab77e55..82fd530 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 _0xe66f=['bluebird','request-promise','path','./intFreshdeskAccount.attributes','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1345ca,_0x1613af){var _0x512713=function(_0x5d9974){while(--_0x5d9974){_0x1345ca['push'](_0x1345ca['shift']());}};_0x512713(++_0x1613af);}(_0xe66f,0xdf));var _0xfe66=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe66f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfe66('0x0'));var util=require(_0xfe66('0x1'));var logger=require(_0xfe66('0x2'))(_0xfe66('0x3'));var moment=require(_0xfe66('0x4'));var BPromise=require(_0xfe66('0x5'));var rp=require(_0xfe66('0x6'));var fs=require('fs');var path=require(_0xfe66('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe66('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xfe66('0x9')]=function(_0x2b61c9,_0x1498fa){return _0x2b61c9[_0xfe66('0xa')]('FreshdeskAccount',attributes,{'tableName':_0xfe66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefdc=['FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xefdc,0x1a6));var _0xcefd=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0xefdc[_0x3d8d0a];return _0x5b9df5;};'use strict';var _=require('lodash');var util=require(_0xcefd('0x0'));var logger=require(_0xcefd('0x1'))(_0xcefd('0x2'));var moment=require('moment');var BPromise=require(_0xcefd('0x3'));var rp=require(_0xcefd('0x4'));var fs=require('fs');var path=require(_0xcefd('0x5'));var rimraf=require('rimraf');var config=require(_0xcefd('0x6'));var attributes=require(_0xcefd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xcefd('0x8')]=function(_0x332703,_0x475e25){return _0x332703[_0xcefd('0x9')](_0xcefd('0xa'),attributes,{'tableName':_0xcefd('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 bfdd1f3..0ab9dd8 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 _0x37fc=['message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x37fc,0x19d));var _0xc37f=function(_0x219892,_0x41b943){_0x219892=_0x219892-0x0;var _0x3b09f3=_0x37fc[_0x219892];return _0x3b09f3;};'use strict';var _=require(_0xc37f('0x0'));var util=require(_0xc37f('0x1'));var moment=require(_0xc37f('0x2'));var BPromise=require(_0xc37f('0x3'));var rs=require(_0xc37f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc37f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc37f('0x6'))(_0xc37f('0x7'));var config=require(_0xc37f('0x8'));var jayson=require(_0xc37f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51a7ef,_0x6e179c,_0x54a938){return new BPromise(function(_0x41b5ff,_0x448daa){return client[_0xc37f('0xa')](_0x51a7ef,_0x54a938)[_0xc37f('0xb')](function(_0x263744){logger[_0xc37f('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x6e179c,_0xc37f('0xd'));logger[_0xc37f('0xe')](_0xc37f('0xf'),_0x6e179c,'request\x20sent',JSON['stringify'](_0x263744));if(_0x263744[_0xc37f('0x10')]){if(_0x263744[_0xc37f('0x10')][_0xc37f('0x11')]===0x1f4){logger[_0xc37f('0x10')](_0xc37f('0x12'),_0x6e179c,_0x263744[_0xc37f('0x10')][_0xc37f('0x13')]);return _0x448daa(_0x263744['error'][_0xc37f('0x13')]);}logger[_0xc37f('0x10')](_0xc37f('0x12'),_0x6e179c,_0x263744[_0xc37f('0x10')][_0xc37f('0x13')]);return _0x41b5ff(_0x263744['error'][_0xc37f('0x13')]);}else{logger['info'](_0xc37f('0x12'),_0x6e179c,'request\x20sent');_0x41b5ff(_0x263744[_0xc37f('0x14')][_0xc37f('0x13')]);}})['catch'](function(_0x1ff606){logger[_0xc37f('0x10')](_0xc37f('0x12'),_0x6e179c,_0x1ff606);_0x448daa(_0x1ff606);});});}exports[_0xc37f('0x15')]=function(_0x161dd4){var _0x1fadf9=this;return new Promise(function(_0x546e04,_0x5b782d){return db[_0xc37f('0x16')][_0xc37f('0x17')]({'raw':_0x161dd4[_0xc37f('0x18')]?_0x161dd4[_0xc37f('0x18')][_0xc37f('0x19')]===undefined?!![]:![]:!![],'where':_0x161dd4[_0xc37f('0x18')]?_0x161dd4['options'][_0xc37f('0x1a')]||null:null,'attributes':_0x161dd4[_0xc37f('0x18')]?_0x161dd4['options'][_0xc37f('0x1b')]||null:null,'limit':_0x161dd4[_0xc37f('0x18')]?_0x161dd4[_0xc37f('0x18')][_0xc37f('0x1c')]||null:null,'include':_0x161dd4[_0xc37f('0x18')]?_0x161dd4['options']['include']?_[_0xc37f('0x1d')](_0x161dd4['options'][_0xc37f('0x1e')],function(_0x578361){return{'model':db[_0x578361[_0xc37f('0x1f')]],'as':_0x578361['as'],'attributes':_0x578361['attributes'],'include':_0x578361[_0xc37f('0x1e')]?_[_0xc37f('0x1d')](_0x578361[_0xc37f('0x1e')],function(_0x30ea8d){return{'model':db[_0x30ea8d[_0xc37f('0x1f')]],'as':_0x30ea8d['as'],'attributes':_0x30ea8d[_0xc37f('0x1b')],'include':_0x30ea8d[_0xc37f('0x1e')]?_['map'](_0x30ea8d['include'],function(_0x7d3bd3){return{'model':db[_0x7d3bd3[_0xc37f('0x1f')]],'as':_0x7d3bd3['as'],'attributes':_0x7d3bd3[_0xc37f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc37f('0xb')](function(_0x2160ea){logger[_0xc37f('0xc')](_0xc37f('0x15'),_0x161dd4);logger[_0xc37f('0xe')](_0xc37f('0x15'),_0x161dd4,JSON[_0xc37f('0x20')](_0x2160ea));_0x546e04(_0x2160ea);})[_0xc37f('0x21')](function(_0x5699c6){logger['error'](_0xc37f('0x15'),_0x5699c6[_0xc37f('0x13')],_0x161dd4);_0x5b782d(_0x1fadf9[_0xc37f('0x10')](0x1f4,_0x5699c6[_0xc37f('0x13')]));});});};exports[_0xc37f('0x22')]=function(_0x8c3f58){var _0x24ccd3=this;return new Promise(function(_0x38f468,_0x3c2b47){return db[_0xc37f('0x16')][_0xc37f('0x23')]({'raw':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58[_0xc37f('0x18')][_0xc37f('0x19')]===undefined?!![]:![]:!![],'where':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58[_0xc37f('0x18')][_0xc37f('0x1a')]||null:null,'attributes':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58['options'][_0xc37f('0x1b')]||null:null,'include':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58['options'][_0xc37f('0x1e')]?_[_0xc37f('0x1d')](_0x8c3f58['options'][_0xc37f('0x1e')],function(_0x3f6a75){return{'model':db[_0x3f6a75[_0xc37f('0x1f')]],'as':_0x3f6a75['as'],'attributes':_0x3f6a75[_0xc37f('0x1b')],'include':_0x3f6a75[_0xc37f('0x1e')]?_['map'](_0x3f6a75[_0xc37f('0x1e')],function(_0xe89261){return{'model':db[_0xe89261[_0xc37f('0x1f')]],'as':_0xe89261['as'],'attributes':_0xe89261[_0xc37f('0x1b')],'include':_0xe89261[_0xc37f('0x1e')]?_[_0xc37f('0x1d')](_0xe89261[_0xc37f('0x1e')],function(_0x224f0a){return{'model':db[_0x224f0a['model']],'as':_0x224f0a['as'],'attributes':_0x224f0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc37f('0xb')](function(_0x104d76){logger['info'](_0xc37f('0x22'),_0x8c3f58);logger[_0xc37f('0xe')](_0xc37f('0x22'),_0x8c3f58,JSON[_0xc37f('0x20')](_0x104d76));_0x38f468(_0x104d76);})[_0xc37f('0x21')](function(_0xa31f65){logger[_0xc37f('0x10')]('ShowFreshdeskAccount',_0xa31f65[_0xc37f('0x13')],_0x8c3f58);_0x3c2b47(_0x24ccd3[_0xc37f('0x10')](0x1f4,_0xa31f65['message']));});});}; \ No newline at end of file +var _0x5fef=['client','http','request','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','FreshdeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','FreshdeskAccount','options','raw','where','include','map','model','attributes','stringify','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x8e68e5,_0x430c07){var _0x48f0d4=function(_0x5e60d6){while(--_0x5e60d6){_0x8e68e5['push'](_0x8e68e5['shift']());}};_0x48f0d4(++_0x430c07);}(_0x5fef,0x118));var _0xf5fe=function(_0x33828f,_0x546b9e){_0x33828f=_0x33828f-0x0;var _0x3458ab=_0x5fef[_0x33828f];return _0x3458ab;};'use strict';var _=require(_0xf5fe('0x0'));var util=require(_0xf5fe('0x1'));var moment=require('moment');var BPromise=require(_0xf5fe('0x2'));var rs=require(_0xf5fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf5fe('0x5'));var config=require(_0xf5fe('0x6'));var jayson=require(_0xf5fe('0x7'));var client=jayson[_0xf5fe('0x8')][_0xf5fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c038d,_0x13c54f,_0x376199){return new BPromise(function(_0x5d0136,_0x1b79d9){return client[_0xf5fe('0xa')](_0x3c038d,_0x376199)['then'](function(_0x102b70){logger[_0xf5fe('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x13c54f,'request\x20sent');logger[_0xf5fe('0xc')](_0xf5fe('0xd'),_0x13c54f,'request\x20sent',JSON['stringify'](_0x102b70));if(_0x102b70[_0xf5fe('0xe')]){if(_0x102b70[_0xf5fe('0xe')]['code']===0x1f4){logger[_0xf5fe('0xe')](_0xf5fe('0xf'),_0x13c54f,_0x102b70['error'][_0xf5fe('0x10')]);return _0x1b79d9(_0x102b70[_0xf5fe('0xe')][_0xf5fe('0x10')]);}logger[_0xf5fe('0xe')](_0xf5fe('0xf'),_0x13c54f,_0x102b70[_0xf5fe('0xe')][_0xf5fe('0x10')]);return _0x5d0136(_0x102b70[_0xf5fe('0xe')][_0xf5fe('0x10')]);}else{logger[_0xf5fe('0xb')](_0xf5fe('0xf'),_0x13c54f,_0xf5fe('0x11'));_0x5d0136(_0x102b70[_0xf5fe('0x12')]['message']);}})[_0xf5fe('0x13')](function(_0x3cf1a4){logger[_0xf5fe('0xe')](_0xf5fe('0xf'),_0x13c54f,_0x3cf1a4);_0x1b79d9(_0x3cf1a4);});});}exports['GetFreshdeskAccount']=function(_0x11b3cb){var _0x4e764d=this;return new Promise(function(_0x2337ea,_0x521c4d){return db[_0xf5fe('0x14')]['findAll']({'raw':_0x11b3cb['options']?_0x11b3cb[_0xf5fe('0x15')][_0xf5fe('0x16')]===undefined?!![]:![]:!![],'where':_0x11b3cb['options']?_0x11b3cb['options'][_0xf5fe('0x17')]||null:null,'attributes':_0x11b3cb[_0xf5fe('0x15')]?_0x11b3cb[_0xf5fe('0x15')]['attributes']||null:null,'limit':_0x11b3cb['options']?_0x11b3cb[_0xf5fe('0x15')]['limit']||null:null,'include':_0x11b3cb[_0xf5fe('0x15')]?_0x11b3cb['options'][_0xf5fe('0x18')]?_[_0xf5fe('0x19')](_0x11b3cb[_0xf5fe('0x15')][_0xf5fe('0x18')],function(_0x154e88){return{'model':db[_0x154e88['model']],'as':_0x154e88['as'],'attributes':_0x154e88['attributes'],'include':_0x154e88['include']?_['map'](_0x154e88[_0xf5fe('0x18')],function(_0x57130b){return{'model':db[_0x57130b[_0xf5fe('0x1a')]],'as':_0x57130b['as'],'attributes':_0x57130b['attributes'],'include':_0x57130b[_0xf5fe('0x18')]?_[_0xf5fe('0x19')](_0x57130b[_0xf5fe('0x18')],function(_0x4881bb){return{'model':db[_0x4881bb[_0xf5fe('0x1a')]],'as':_0x4881bb['as'],'attributes':_0x4881bb[_0xf5fe('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cac5c){logger[_0xf5fe('0xb')]('GetFreshdeskAccount',_0x11b3cb);logger[_0xf5fe('0xc')]('GetFreshdeskAccount',_0x11b3cb,JSON[_0xf5fe('0x1c')](_0x4cac5c));_0x2337ea(_0x4cac5c);})[_0xf5fe('0x13')](function(_0x5a756a){logger[_0xf5fe('0xe')](_0xf5fe('0x1d'),_0x5a756a['message'],_0x11b3cb);_0x521c4d(_0x4e764d[_0xf5fe('0xe')](0x1f4,_0x5a756a[_0xf5fe('0x10')]));});});};exports[_0xf5fe('0x1e')]=function(_0x162a9c){var _0x3f94db=this;return new Promise(function(_0x3a7204,_0x465eb9){return db[_0xf5fe('0x14')][_0xf5fe('0x1f')]({'raw':_0x162a9c['options']?_0x162a9c[_0xf5fe('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x162a9c[_0xf5fe('0x15')]?_0x162a9c[_0xf5fe('0x15')][_0xf5fe('0x17')]||null:null,'attributes':_0x162a9c[_0xf5fe('0x15')]?_0x162a9c[_0xf5fe('0x15')][_0xf5fe('0x1b')]||null:null,'include':_0x162a9c['options']?_0x162a9c[_0xf5fe('0x15')][_0xf5fe('0x18')]?_[_0xf5fe('0x19')](_0x162a9c[_0xf5fe('0x15')][_0xf5fe('0x18')],function(_0x42887e){return{'model':db[_0x42887e[_0xf5fe('0x1a')]],'as':_0x42887e['as'],'attributes':_0x42887e[_0xf5fe('0x1b')],'include':_0x42887e[_0xf5fe('0x18')]?_['map'](_0x42887e[_0xf5fe('0x18')],function(_0x493fdf){return{'model':db[_0x493fdf[_0xf5fe('0x1a')]],'as':_0x493fdf['as'],'attributes':_0x493fdf['attributes'],'include':_0x493fdf[_0xf5fe('0x18')]?_[_0xf5fe('0x19')](_0x493fdf[_0xf5fe('0x18')],function(_0x1197f2){return{'model':db[_0x1197f2[_0xf5fe('0x1a')]],'as':_0x1197f2['as'],'attributes':_0x1197f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a00fc){logger[_0xf5fe('0xb')](_0xf5fe('0x1e'),_0x162a9c);logger['debug'](_0xf5fe('0x1e'),_0x162a9c,JSON[_0xf5fe('0x1c')](_0x2a00fc));_0x3a7204(_0x2a00fc);})[_0xf5fe('0x13')](function(_0x11e2c6){logger['error'](_0xf5fe('0x1e'),_0x11e2c6[_0xf5fe('0x10')],_0x162a9c);_0x465eb9(_0x3f94db[_0xf5fe('0xe')](0x1f4,_0x11e2c6[_0xf5fe('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7906405..e62fb91 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 _0x6e19=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e19,0x13a));var _0x96e1=function(_0x2b4c2b,_0x257224){_0x2b4c2b=_0x2b4c2b-0x0;var _0x48c347=_0x6e19[_0x2b4c2b];return _0x48c347;};'use strict';var multer=require(_0x96e1('0x0'));var util=require('util');var path=require(_0x96e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x96e1('0x2'));var router=express[_0x96e1('0x3')]();var auth=require(_0x96e1('0x4'));var interaction=require(_0x96e1('0x5'));var config=require(_0x96e1('0x6'));var controller=require(_0x96e1('0x7'));router[_0x96e1('0x8')]('/',auth[_0x96e1('0x9')](),controller[_0x96e1('0xa')]);router[_0x96e1('0x8')]('/:id',auth[_0x96e1('0x9')](),controller[_0x96e1('0xb')]);router['get'](_0x96e1('0xc'),auth[_0x96e1('0x9')](),controller[_0x96e1('0xd')]);router[_0x96e1('0x8')](_0x96e1('0xe'),auth[_0x96e1('0x9')](),controller[_0x96e1('0xf')]);router['get'](_0x96e1('0x10'),auth[_0x96e1('0x9')](),controller[_0x96e1('0x11')]);router[_0x96e1('0x8')](_0x96e1('0x12'),auth[_0x96e1('0x9')](),controller[_0x96e1('0x13')]);router['post']('/',auth[_0x96e1('0x9')](),controller[_0x96e1('0x14')]);router[_0x96e1('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x96e1('0x16')]);router[_0x96e1('0x17')](_0x96e1('0x18'),auth['isAuthenticated'](),controller[_0x96e1('0x19')]);router[_0x96e1('0x1a')](_0x96e1('0x18'),auth[_0x96e1('0x9')](),controller[_0x96e1('0x1b')]);module[_0x96e1('0x1c')]=router; \ No newline at end of file +var _0xdff0=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdff0,0x1ec));var _0x0dff=function(_0x5f0a26,_0x251107){_0x5f0a26=_0x5f0a26-0x0;var _0x4f6b3b=_0xdff0[_0x5f0a26];return _0x4f6b3b;};'use strict';var multer=require('multer');var util=require(_0x0dff('0x0'));var path=require('path');var timeout=require(_0x0dff('0x1'));var express=require(_0x0dff('0x2'));var router=express[_0x0dff('0x3')]();var auth=require(_0x0dff('0x4'));var interaction=require(_0x0dff('0x5'));var config=require(_0x0dff('0x6'));var controller=require(_0x0dff('0x7'));router[_0x0dff('0x8')]('/',auth['isAuthenticated'](),controller[_0x0dff('0x9')]);router[_0x0dff('0x8')](_0x0dff('0xa'),auth[_0x0dff('0xb')](),controller[_0x0dff('0xc')]);router[_0x0dff('0x8')](_0x0dff('0xd'),auth['isAuthenticated'](),controller[_0x0dff('0xe')]);router['get']('/:id/subjects',auth[_0x0dff('0xb')](),controller[_0x0dff('0xf')]);router[_0x0dff('0x8')](_0x0dff('0x10'),auth['isAuthenticated'](),controller[_0x0dff('0x11')]);router[_0x0dff('0x8')]('/:id/tags',auth[_0x0dff('0xb')](),controller[_0x0dff('0x12')]);router['post']('/',auth[_0x0dff('0xb')](),controller[_0x0dff('0x13')]);router[_0x0dff('0x14')](_0x0dff('0x15'),auth[_0x0dff('0xb')](),controller[_0x0dff('0x16')]);router[_0x0dff('0x17')](_0x0dff('0xa'),auth['isAuthenticated'](),controller[_0x0dff('0x18')]);router[_0x0dff('0x19')](_0x0dff('0xa'),auth['isAuthenticated'](),controller[_0x0dff('0x1a')]);module[_0x0dff('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2a5126f..536197f 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 _0xed1a=['exports','STRING','sequelize'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0xed1a,0x8f));var _0xaed1=function(_0x471592,_0x24cbda){_0x471592=_0x471592-0x0;var _0x59fc24=_0xed1a[_0x471592];return _0x59fc24;};'use strict';var Sequelize=require(_0xaed1('0x0'));module[_0xaed1('0x1')]={'name':{'type':Sequelize[_0xaed1('0x2')]},'description':{'type':Sequelize[_0xaed1('0x2')]}}; \ No newline at end of file +var _0x6af7=['exports','STRING','sequelize'];(function(_0x54dc56,_0x1089ff){var _0x3c2b85=function(_0x51e7f8){while(--_0x51e7f8){_0x54dc56['push'](_0x54dc56['shift']());}};_0x3c2b85(++_0x1089ff);}(_0x6af7,0xfe));var _0x76af=function(_0x597be7,_0x5dfabe){_0x597be7=_0x597be7-0x0;var _0x1dcc97=_0x6af7[_0x597be7];return _0x1dcc97;};'use strict';var Sequelize=require(_0x76af('0x0'));module[_0x76af('0x1')]={'name':{'type':Sequelize[_0x76af('0x2')]},'description':{'type':Sequelize[_0x76af('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7df9a9e..f417f23 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 _0xc688=['getSubjects','pick','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','intersection','create','body','find','getFields','findOne','FreshdeskField','sort','options'];(function(_0x1c65e4,_0x205372){var _0x469ce6=function(_0x2959b6){while(--_0x2959b6){_0x1c65e4['push'](_0x1c65e4['shift']());}};_0x469ce6(++_0x205372);}(_0xc688,0xc0));var _0x8c68=function(_0x3c7c53,_0x1ce289){_0x3c7c53=_0x3c7c53-0x0;var _0x57085f=_0xc688[_0x3c7c53];return _0x57085f;};'use strict';var pdf=require(_0x8c68('0x0'));var emlformat=require(_0x8c68('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c68('0x2'));var jsonpatch=require(_0x8c68('0x3'));var rp=require('request-promise');var moment=require(_0x8c68('0x4'));var BPromise=require(_0x8c68('0x5'));var Mustache=require('mustache');var util=require(_0x8c68('0x6'));var path=require('path');var sox=require(_0x8c68('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8c68('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c68('0x9'));var toCsv=require(_0x8c68('0xa'));var querystring=require('querystring');var Papa=require(_0x8c68('0xb'));var Redis=require('ioredis');var authService=require(_0x8c68('0xc'));var qs=require(_0x8c68('0xd'));var as=require(_0x8c68('0xe'));var hardwareService=require(_0x8c68('0xf'));var logger=require('../../config/logger')(_0x8c68('0x10'));var utils=require(_0x8c68('0x11'));var config=require(_0x8c68('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8c68('0x13'));var client=jayson[_0x8c68('0x14')][_0x8c68('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2530e5,_0xda1135,_0xc3b3c1){if(_0xc3b3c1){var _0xe5154=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe5154[_0x8c68('0x16')](_0xda1135)){return _0x2530e5;}else{throw new db[(_0x8c68('0x17'))]['ValidationError'](_0x8c68('0x18'));}}else{return _0x2530e5;}}function respondWithRpcPromise(_0x5da80f,_0x2fac16,_0x5cf64d,_0x513d82){return new BPromise(function(_0x1ae4b3,_0x5a51fd){var _0xbe1456=_0x513d82||client;return _0xbe1456[_0x8c68('0x19')](_0x5da80f,_0x5cf64d)[_0x8c68('0x1a')](function(_0x54b402){logger['info'](_0x8c68('0x1b'),_0x2fac16,'request\x20sent');logger[_0x8c68('0x1c')](_0x8c68('0x1d'),_0x2fac16,_0x8c68('0x1e'),JSON['stringify'](_0x54b402));if(_0x54b402[_0x8c68('0x1f')]){if(_0x54b402[_0x8c68('0x1f')][_0x8c68('0x20')]===0x1f4){logger[_0x8c68('0x1f')](_0x8c68('0x1b'),_0x2fac16,_0x54b402[_0x8c68('0x1f')]['message']);return _0x5a51fd(_0x54b402[_0x8c68('0x1f')][_0x8c68('0x21')]);}logger[_0x8c68('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2fac16,_0x54b402[_0x8c68('0x1f')][_0x8c68('0x21')]);return _0x1ae4b3(_0x54b402[_0x8c68('0x1f')][_0x8c68('0x21')]);}else{logger[_0x8c68('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2fac16,_0x8c68('0x1e'));_0x1ae4b3(_0x54b402[_0x8c68('0x23')]['message']);}})[_0x8c68('0x24')](function(_0x415676){logger['error'](_0x8c68('0x1b'),_0x2fac16,_0x415676);_0x5a51fd(_0x415676);});});}function respondWithStatusCode(_0x3639a6,_0x4e9b1c){_0x4e9b1c=_0x4e9b1c||0xcc;return function(_0x188918){if(_0x188918){return _0x3639a6['sendStatus'](_0x4e9b1c);}return _0x3639a6['status'](_0x4e9b1c)[_0x8c68('0x25')]();};}function respondWithResult(_0x775c40,_0x46a26c){_0x46a26c=_0x46a26c||0xc8;return function(_0x396ea1){if(_0x396ea1){return _0x775c40['status'](_0x46a26c)[_0x8c68('0x26')](_0x396ea1);}};}function respondWithFilteredResult(_0x23c0e6,_0x3b4b92){return function(_0x5e6d5d){if(_0x5e6d5d){var _0x2bbd59=_0x5e6d5d[_0x8c68('0x27')],_0x35613a=_0x3b4b92[_0x8c68('0x28')],_0x45899d=_0x3b4b92[_0x8c68('0x28')]+_0x3b4b92[_0x8c68('0x29')],_0x479429;if(_0x45899d>=_0x2bbd59){_0x45899d=_0x2bbd59;_0x479429=0xc8;}else{_0x479429=0xce;}_0x23c0e6[_0x8c68('0x2a')](_0x479429);return _0x23c0e6[_0x8c68('0x2b')](_0x8c68('0x2c'),_0x35613a+'-'+_0x45899d+'/'+_0x2bbd59)[_0x8c68('0x26')](_0x5e6d5d);}return null;};}function patchUpdates(_0x4983ea){return function(_0x541b17){try{jsonpatch[_0x8c68('0x2d')](_0x541b17,_0x4983ea,!![]);}catch(_0x2fc257){return BPromise[_0x8c68('0x2e')](_0x2fc257);}return _0x541b17[_0x8c68('0x2f')]();};}function saveUpdates(_0xcb1279,_0x5a4531){return function(_0x2cd56f){if(_0x2cd56f){return _0x2cd56f[_0x8c68('0x30')](_0xcb1279)[_0x8c68('0x1a')](function(_0x38eb65){return _0x38eb65;});}return null;};}function removeEntity(_0x41661e,_0x15b45a){return function(_0x2a2273){if(_0x2a2273){return _0x2a2273['destroy']()[_0x8c68('0x1a')](function(){_0x41661e[_0x8c68('0x2a')](0xcc)[_0x8c68('0x25')]();});}};}function handleEntityNotFound(_0x12fd68,_0x2b781f){return function(_0x549aaf){if(!_0x549aaf){_0x12fd68[_0x8c68('0x31')](0x194);}return _0x549aaf;};}function handleError(_0x41d181,_0x277536){_0x277536=_0x277536||0x1f4;return function(_0x21fa7c){logger[_0x8c68('0x1f')](_0x21fa7c['stack']);if(_0x21fa7c[_0x8c68('0x32')]){delete _0x21fa7c[_0x8c68('0x32')];}_0x41d181[_0x8c68('0x2a')](_0x277536)[_0x8c68('0x33')](_0x21fa7c);};}exports[_0x8c68('0x34')]=function(_0x3b4f0d,_0x385a91){var _0x194ff3={},_0x1edcf8={},_0x6c57c1={'count':0x0,'rows':[]};var _0x167274=_[_0x8c68('0x35')](db['FreshdeskConfiguration'][_0x8c68('0x36')],function(_0x29bfd3){return{'name':_0x29bfd3[_0x8c68('0x37')],'type':_0x29bfd3['type'][_0x8c68('0x38')]};});_0x1edcf8[_0x8c68('0x39')]=_[_0x8c68('0x35')](_0x167274,_0x8c68('0x32'));_0x1edcf8[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x3b4f0d['query']);_0x1edcf8[_0x8c68('0x3c')]=_['intersection'](_0x1edcf8[_0x8c68('0x39')],_0x1edcf8[_0x8c68('0x3a')]);_0x194ff3[_0x8c68('0x3d')]=_['intersection'](_0x1edcf8['model'],qs['fields'](_0x3b4f0d['query'][_0x8c68('0x3e')]));_0x194ff3[_0x8c68('0x3d')]=_0x194ff3['attributes'][_0x8c68('0x3f')]?_0x194ff3[_0x8c68('0x3d')]:_0x1edcf8[_0x8c68('0x39')];if(!_0x3b4f0d[_0x8c68('0x3a')][_0x8c68('0x40')](_0x8c68('0x41'))){_0x194ff3[_0x8c68('0x29')]=qs[_0x8c68('0x29')](_0x3b4f0d[_0x8c68('0x3a')]['limit']);_0x194ff3[_0x8c68('0x28')]=qs[_0x8c68('0x28')](_0x3b4f0d[_0x8c68('0x3a')][_0x8c68('0x28')]);}_0x194ff3[_0x8c68('0x42')]=qs['sort'](_0x3b4f0d['query']['sort']);_0x194ff3[_0x8c68('0x43')]=qs[_0x8c68('0x3c')](_['pick'](_0x3b4f0d[_0x8c68('0x3a')],_0x1edcf8[_0x8c68('0x3c')]),_0x167274);if(_0x3b4f0d[_0x8c68('0x3a')]['filter']){_0x194ff3[_0x8c68('0x43')]=_[_0x8c68('0x44')](_0x194ff3[_0x8c68('0x43')],{'$or':_[_0x8c68('0x35')](_0x167274,function(_0x4e871d){if(_0x4e871d['type']!==_0x8c68('0x45')){var _0x5c2dcb={};_0x5c2dcb[_0x4e871d[_0x8c68('0x32')]]={'$like':'%'+_0x3b4f0d['query'][_0x8c68('0x46')]+'%'};return _0x5c2dcb;}})});}_0x194ff3=_[_0x8c68('0x44')]({},_0x194ff3,_0x3b4f0d['options']);var _0x2ae584={'where':_0x194ff3['where']};return db['FreshdeskConfiguration'][_0x8c68('0x27')](_0x2ae584)[_0x8c68('0x1a')](function(_0x4a3a91){_0x6c57c1['count']=_0x4a3a91;if(_0x3b4f0d[_0x8c68('0x3a')][_0x8c68('0x47')]){_0x194ff3[_0x8c68('0x48')]=[{'all':!![]}];}return db[_0x8c68('0x49')][_0x8c68('0x4a')](_0x194ff3);})[_0x8c68('0x1a')](function(_0x4119e4){_0x6c57c1[_0x8c68('0x4b')]=_0x4119e4;return _0x6c57c1;})[_0x8c68('0x1a')](respondWithFilteredResult(_0x385a91,_0x194ff3))[_0x8c68('0x24')](handleError(_0x385a91,null));};exports[_0x8c68('0x4c')]=function(_0x3dd2a9,_0xce7c18){var _0x31483c={'raw':![],'where':{'id':_0x3dd2a9[_0x8c68('0x4d')]['id']}},_0xd1b914={};_0xd1b914[_0x8c68('0x39')]=_[_0x8c68('0x3b')](db[_0x8c68('0x49')][_0x8c68('0x36')]);_0xd1b914[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x3dd2a9[_0x8c68('0x3a')]);_0xd1b914[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0xd1b914[_0x8c68('0x39')],_0xd1b914['query']);_0x31483c[_0x8c68('0x3d')]=_[_0x8c68('0x4e')](_0xd1b914[_0x8c68('0x39')],qs[_0x8c68('0x3e')](_0x3dd2a9['query'][_0x8c68('0x3e')]));_0x31483c[_0x8c68('0x3d')]=_0x31483c['attributes'][_0x8c68('0x3f')]?_0x31483c[_0x8c68('0x3d')]:_0xd1b914[_0x8c68('0x39')];if(_0x3dd2a9['query']['includeAll']){_0x31483c[_0x8c68('0x48')]=[{'all':!![]}];}_0x31483c=_['merge']({},_0x31483c,_0x3dd2a9['options']);return db[_0x8c68('0x49')]['find'](_0x31483c)[_0x8c68('0x1a')](handleEntityNotFound(_0xce7c18,null))[_0x8c68('0x1a')](respondWithResult(_0xce7c18,null))[_0x8c68('0x24')](handleError(_0xce7c18,null));};exports[_0x8c68('0x4f')]=function(_0x544136,_0x330d42){return db[_0x8c68('0x49')][_0x8c68('0x4f')](_0x544136[_0x8c68('0x50')],{})['then'](respondWithResult(_0x330d42,0xc9))[_0x8c68('0x24')](handleError(_0x330d42,null));};exports[_0x8c68('0x30')]=function(_0x1d6d2d,_0x1aec09){if(_0x1d6d2d[_0x8c68('0x50')]['id']){delete _0x1d6d2d[_0x8c68('0x50')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1d6d2d[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1aec09,null))[_0x8c68('0x1a')](saveUpdates(_0x1d6d2d[_0x8c68('0x50')],null))['then'](respondWithResult(_0x1aec09,null))['catch'](handleError(_0x1aec09,null));};exports['destroy']=function(_0x5b9428,_0x50c3ee){return db['FreshdeskConfiguration'][_0x8c68('0x51')]({'where':{'id':_0x5b9428[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50c3ee,null))[_0x8c68('0x1a')](removeEntity(_0x50c3ee,null))['catch'](handleError(_0x50c3ee,null));};exports[_0x8c68('0x52')]=function(_0x2b4316,_0x1d8720,_0x5138a5){var _0x4b3544={};var _0x5065e1={};var _0x104b50;var _0x181773;return db[_0x8c68('0x49')][_0x8c68('0x53')]({'where':{'id':_0x2b4316[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d8720,null))[_0x8c68('0x1a')](function(_0x3a7e40){if(_0x3a7e40){_0x104b50=_0x3a7e40;_0x5065e1['model']=_[_0x8c68('0x3b')](db[_0x8c68('0x54')][_0x8c68('0x36')]);_0x5065e1['query']=_[_0x8c68('0x3b')](_0x2b4316[_0x8c68('0x3a')]);_0x5065e1['filters']=_['intersection'](_0x5065e1[_0x8c68('0x39')],_0x5065e1[_0x8c68('0x3a')]);_0x4b3544[_0x8c68('0x3d')]=_['intersection'](_0x5065e1[_0x8c68('0x39')],qs[_0x8c68('0x3e')](_0x2b4316[_0x8c68('0x3a')]['fields']));_0x4b3544['attributes']=_0x4b3544[_0x8c68('0x3d')][_0x8c68('0x3f')]?_0x4b3544['attributes']:_0x5065e1[_0x8c68('0x39')];_0x4b3544['order']=qs[_0x8c68('0x55')](_0x2b4316[_0x8c68('0x3a')][_0x8c68('0x55')]);_0x4b3544[_0x8c68('0x43')]=qs['filters'](_['pick'](_0x2b4316[_0x8c68('0x3a')],_0x5065e1[_0x8c68('0x3c')]));if(_0x2b4316[_0x8c68('0x3a')][_0x8c68('0x46')]){_0x4b3544[_0x8c68('0x43')]=_['merge'](_0x4b3544[_0x8c68('0x43')],{'$or':_['map'](_0x4b3544['attributes'],function(_0x58e233){var _0x545dc6={};_0x545dc6[_0x58e233]={'$like':'%'+_0x2b4316[_0x8c68('0x3a')][_0x8c68('0x46')]+'%'};return _0x545dc6;})});}_0x4b3544=_['merge']({},_0x4b3544,_0x2b4316[_0x8c68('0x56')]);return _0x104b50[_0x8c68('0x52')](_0x4b3544);}})[_0x8c68('0x1a')](function(_0x2149c5){if(_0x2149c5){_0x181773=_0x2149c5[_0x8c68('0x3f')];if(!_0x2b4316['query'][_0x8c68('0x40')](_0x8c68('0x41'))){_0x4b3544['limit']=qs[_0x8c68('0x29')](_0x2b4316[_0x8c68('0x3a')]['limit']);_0x4b3544[_0x8c68('0x28')]=qs[_0x8c68('0x28')](_0x2b4316['query'][_0x8c68('0x28')]);}return _0x104b50[_0x8c68('0x52')](_0x4b3544);}})[_0x8c68('0x1a')](function(_0x6c7a77){if(_0x6c7a77){return _0x6c7a77?{'count':_0x181773,'rows':_0x6c7a77}:null;}})[_0x8c68('0x1a')](respondWithResult(_0x1d8720,null))['catch'](handleError(_0x1d8720,null));};exports[_0x8c68('0x57')]=function(_0xa7819,_0x55255c,_0x4fc50a){var _0x2b2a1c={};var _0x302fa9={};var _0x1dbe7b;var _0x37d257;return db[_0x8c68('0x49')]['findOne']({'where':{'id':_0xa7819[_0x8c68('0x4d')]['id']}})[_0x8c68('0x1a')](handleEntityNotFound(_0x55255c,null))['then'](function(_0xbb7f9f){if(_0xbb7f9f){_0x1dbe7b=_0xbb7f9f;_0x302fa9['model']=_[_0x8c68('0x3b')](db[_0x8c68('0x54')][_0x8c68('0x36')]);_0x302fa9[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0xa7819[_0x8c68('0x3a')]);_0x302fa9[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0x302fa9[_0x8c68('0x39')],_0x302fa9[_0x8c68('0x3a')]);_0x2b2a1c[_0x8c68('0x3d')]=_[_0x8c68('0x4e')](_0x302fa9['model'],qs[_0x8c68('0x3e')](_0xa7819['query'][_0x8c68('0x3e')]));_0x2b2a1c[_0x8c68('0x3d')]=_0x2b2a1c['attributes'][_0x8c68('0x3f')]?_0x2b2a1c[_0x8c68('0x3d')]:_0x302fa9[_0x8c68('0x39')];_0x2b2a1c['order']=qs['sort'](_0xa7819['query']['sort']);_0x2b2a1c['where']=qs['filters'](_[_0x8c68('0x58')](_0xa7819[_0x8c68('0x3a')],_0x302fa9[_0x8c68('0x3c')]));if(_0xa7819[_0x8c68('0x3a')][_0x8c68('0x46')]){_0x2b2a1c['where']=_[_0x8c68('0x44')](_0x2b2a1c[_0x8c68('0x43')],{'$or':_['map'](_0x2b2a1c[_0x8c68('0x3d')],function(_0x21e9ad){var _0x40854a={};_0x40854a[_0x21e9ad]={'$like':'%'+_0xa7819[_0x8c68('0x3a')]['filter']+'%'};return _0x40854a;})});}_0x2b2a1c=_[_0x8c68('0x44')]({},_0x2b2a1c,_0xa7819[_0x8c68('0x56')]);return _0x1dbe7b[_0x8c68('0x57')](_0x2b2a1c);}})[_0x8c68('0x1a')](function(_0x28cd1d){if(_0x28cd1d){_0x37d257=_0x28cd1d[_0x8c68('0x3f')];if(!_0xa7819[_0x8c68('0x3a')][_0x8c68('0x40')](_0x8c68('0x41'))){_0x2b2a1c[_0x8c68('0x29')]=qs[_0x8c68('0x29')](_0xa7819[_0x8c68('0x3a')][_0x8c68('0x29')]);_0x2b2a1c[_0x8c68('0x28')]=qs[_0x8c68('0x28')](_0xa7819['query']['offset']);}return _0x1dbe7b[_0x8c68('0x57')](_0x2b2a1c);}})[_0x8c68('0x1a')](function(_0x4bb4fb){if(_0x4bb4fb){return _0x4bb4fb?{'count':_0x37d257,'rows':_0x4bb4fb}:null;}})[_0x8c68('0x1a')](respondWithResult(_0x55255c,null))[_0x8c68('0x24')](handleError(_0x55255c,null));};exports['getDescriptions']=function(_0x11f3f7,_0x994cb8,_0x2495c7){var _0xedff79={};var _0x3def49={};var _0xf4e477;var _0x5bf800;return db[_0x8c68('0x49')][_0x8c68('0x53')]({'where':{'id':_0x11f3f7['params']['id']}})[_0x8c68('0x1a')](handleEntityNotFound(_0x994cb8,null))[_0x8c68('0x1a')](function(_0x475496){if(_0x475496){_0xf4e477=_0x475496;_0x3def49['model']=_[_0x8c68('0x3b')](db[_0x8c68('0x54')][_0x8c68('0x36')]);_0x3def49[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x11f3f7[_0x8c68('0x3a')]);_0x3def49[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0x3def49['model'],_0x3def49[_0x8c68('0x3a')]);_0xedff79[_0x8c68('0x3d')]=_[_0x8c68('0x4e')](_0x3def49[_0x8c68('0x39')],qs[_0x8c68('0x3e')](_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x3e')]));_0xedff79[_0x8c68('0x3d')]=_0xedff79[_0x8c68('0x3d')][_0x8c68('0x3f')]?_0xedff79['attributes']:_0x3def49[_0x8c68('0x39')];_0xedff79[_0x8c68('0x42')]=qs[_0x8c68('0x55')](_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x55')]);_0xedff79[_0x8c68('0x43')]=qs['filters'](_[_0x8c68('0x58')](_0x11f3f7[_0x8c68('0x3a')],_0x3def49[_0x8c68('0x3c')]));if(_0x11f3f7['query']['filter']){_0xedff79[_0x8c68('0x43')]=_[_0x8c68('0x44')](_0xedff79[_0x8c68('0x43')],{'$or':_[_0x8c68('0x35')](_0xedff79[_0x8c68('0x3d')],function(_0x5cd047){var _0x3af892={};_0x3af892[_0x5cd047]={'$like':'%'+_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x46')]+'%'};return _0x3af892;})});}_0xedff79=_[_0x8c68('0x44')]({},_0xedff79,_0x11f3f7[_0x8c68('0x56')]);return _0xf4e477[_0x8c68('0x59')](_0xedff79);}})[_0x8c68('0x1a')](function(_0x28d85f){if(_0x28d85f){_0x5bf800=_0x28d85f[_0x8c68('0x3f')];if(!_0x11f3f7[_0x8c68('0x3a')]['hasOwnProperty'](_0x8c68('0x41'))){_0xedff79[_0x8c68('0x29')]=qs[_0x8c68('0x29')](_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x29')]);_0xedff79['offset']=qs['offset'](_0x11f3f7['query'][_0x8c68('0x28')]);}return _0xf4e477[_0x8c68('0x59')](_0xedff79);}})[_0x8c68('0x1a')](function(_0x120702){if(_0x120702){return _0x120702?{'count':_0x5bf800,'rows':_0x120702}:null;}})[_0x8c68('0x1a')](respondWithResult(_0x994cb8,null))['catch'](handleError(_0x994cb8,null));};exports[_0x8c68('0x5a')]=function(_0x55e6b2,_0xd3b986,_0x50e2ac){var _0x578775={};var _0x4ee963={};var _0x466992;var _0x87adc1;return db['FreshdeskConfiguration'][_0x8c68('0x53')]({'where':{'id':_0x55e6b2[_0x8c68('0x4d')]['id']}})[_0x8c68('0x1a')](handleEntityNotFound(_0xd3b986,null))['then'](function(_0x3182bb){if(_0x3182bb){_0x466992=_0x3182bb;_0x4ee963[_0x8c68('0x39')]=_[_0x8c68('0x3b')](db[_0x8c68('0x5b')][_0x8c68('0x36')]);_0x4ee963[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x55e6b2[_0x8c68('0x3a')]);_0x4ee963[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0x4ee963[_0x8c68('0x39')],_0x4ee963[_0x8c68('0x3a')]);_0x578775[_0x8c68('0x3d')]=_['intersection'](_0x4ee963['model'],qs[_0x8c68('0x3e')](_0x55e6b2[_0x8c68('0x3a')]['fields']));_0x578775[_0x8c68('0x3d')]=_0x578775[_0x8c68('0x3d')]['length']?_0x578775['attributes']:_0x4ee963[_0x8c68('0x39')];_0x578775[_0x8c68('0x42')]=qs[_0x8c68('0x55')](_0x55e6b2['query'][_0x8c68('0x55')]);_0x578775['where']=qs['filters'](_[_0x8c68('0x58')](_0x55e6b2[_0x8c68('0x3a')],_0x4ee963[_0x8c68('0x3c')]));if(_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x46')]){_0x578775[_0x8c68('0x43')]=_[_0x8c68('0x44')](_0x578775[_0x8c68('0x43')],{'$or':_[_0x8c68('0x35')](_0x578775[_0x8c68('0x3d')],function(_0x47ba6c){var _0x2b7a11={};_0x2b7a11[_0x47ba6c]={'$like':'%'+_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x46')]+'%'};return _0x2b7a11;})});}_0x578775=_[_0x8c68('0x44')]({},_0x578775,_0x55e6b2['options']);return _0x466992[_0x8c68('0x5a')](_0x578775);}})['then'](function(_0x481fa1){if(_0x481fa1){_0x87adc1=_0x481fa1[_0x8c68('0x3f')];if(!_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x40')](_0x8c68('0x41'))){_0x578775['limit']=qs['limit'](_0x55e6b2['query'][_0x8c68('0x29')]);_0x578775['offset']=qs[_0x8c68('0x28')](_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x28')]);}return _0x466992[_0x8c68('0x5a')](_0x578775);}})[_0x8c68('0x1a')](function(_0xc9c7f0){if(_0xc9c7f0){return _0xc9c7f0?{'count':_0x87adc1,'rows':_0xc9c7f0}:null;}})['then'](respondWithResult(_0xd3b986,null))[_0x8c68('0x24')](handleError(_0xd3b986,null));};exports[_0x8c68('0x5c')]=function(_0x44dea2,_0x52a5c3,_0x401355){if(_0x44dea2[_0x8c68('0x50')]['id']){delete _0x44dea2[_0x8c68('0x50')]['id'];}return db[_0x8c68('0x49')]['findOne']({'where':{'id':_0x44dea2[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x52a5c3,null))[_0x8c68('0x1a')](function(_0x52a55d){if(_0x52a55d){return _0x52a55d[_0x8c68('0x5c')](_0x44dea2[_0x8c68('0x50')]['ids']||[]);}return null;})[_0x8c68('0x1a')](respondWithResult(_0x52a5c3,null))[_0x8c68('0x24')](handleError(_0x52a5c3,null));}; \ No newline at end of file +var _0x383d=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','order','pick','getFields','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x4a10fe,_0x250d29){var _0x49eb71=function(_0x107615){while(--_0x107615){_0x4a10fe['push'](_0x4a10fe['shift']());}};_0x49eb71(++_0x250d29);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd383('0x0'));var zipdir=require(_0xd383('0x1'));var jsonpatch=require(_0xd383('0x2'));var rp=require('request-promise');var moment=require(_0xd383('0x3'));var BPromise=require(_0xd383('0x4'));var Mustache=require(_0xd383('0x5'));var util=require(_0xd383('0x6'));var path=require(_0xd383('0x7'));var sox=require(_0xd383('0x8'));var csv=require('to-csv');var ejs=require(_0xd383('0x9'));var fs=require('fs');var _=require(_0xd383('0xa'));var squel=require(_0xd383('0xb'));var crypto=require(_0xd383('0xc'));var jsforce=require(_0xd383('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd383('0xe'));var Papa=require(_0xd383('0xf'));var Redis=require('ioredis');var authService=require(_0xd383('0x10'));var qs=require(_0xd383('0x11'));var as=require(_0xd383('0x12'));var hardwareService=require(_0xd383('0x13'));var logger=require(_0xd383('0x14'))(_0xd383('0x15'));var utils=require('../../config/utils');var config=require(_0xd383('0x16'));var db=require(_0xd383('0x17'))['db'];var jayson=require(_0xd383('0x18'));var client=jayson[_0xd383('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x42143c,_0x23fecb,_0x208d82){if(_0x208d82){var _0x3fe48f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fe48f['test'](_0x23fecb)){return _0x42143c;}else{throw new db[(_0xd383('0x1a'))]['ValidationError'](_0xd383('0x1b'));}}else{return _0x42143c;}}function respondWithRpcPromise(_0x1e35fe,_0xf2dcb6,_0x373876,_0x387f5f){return new BPromise(function(_0x18690a,_0x5359c6){var _0x508ef9=_0x387f5f||client;return _0x508ef9[_0xd383('0x1c')](_0x1e35fe,_0x373876)[_0xd383('0x1d')](function(_0x8639e8){logger[_0xd383('0x1e')](_0xd383('0x1f'),_0xf2dcb6,_0xd383('0x20'));logger[_0xd383('0x21')](_0xd383('0x22'),_0xf2dcb6,'request\x20sent',JSON[_0xd383('0x23')](_0x8639e8));if(_0x8639e8[_0xd383('0x24')]){if(_0x8639e8[_0xd383('0x24')][_0xd383('0x25')]===0x1f4){logger[_0xd383('0x24')](_0xd383('0x1f'),_0xf2dcb6,_0x8639e8['error'][_0xd383('0x26')]);return _0x5359c6(_0x8639e8['error'][_0xd383('0x26')]);}logger['error'](_0xd383('0x1f'),_0xf2dcb6,_0x8639e8[_0xd383('0x24')]['message']);return _0x18690a(_0x8639e8[_0xd383('0x24')][_0xd383('0x26')]);}else{logger[_0xd383('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xf2dcb6,'request\x20sent');_0x18690a(_0x8639e8[_0xd383('0x27')]['message']);}})['catch'](function(_0x2a95a8){logger['error'](_0xd383('0x1f'),_0xf2dcb6,_0x2a95a8);_0x5359c6(_0x2a95a8);});});}function respondWithStatusCode(_0x5b407e,_0x4c52c7){_0x4c52c7=_0x4c52c7||0xcc;return function(_0x54afc4){if(_0x54afc4){return _0x5b407e[_0xd383('0x28')](_0x4c52c7);}return _0x5b407e[_0xd383('0x29')](_0x4c52c7)[_0xd383('0x2a')]();};}function respondWithResult(_0x554758,_0x343d4d){_0x343d4d=_0x343d4d||0xc8;return function(_0x2b3ab6){if(_0x2b3ab6){return _0x554758[_0xd383('0x29')](_0x343d4d)[_0xd383('0x2b')](_0x2b3ab6);}};}function respondWithFilteredResult(_0x27750a,_0x2c7de2){return function(_0x13d395){if(_0x13d395){var _0x208247=_0x13d395[_0xd383('0x2c')],_0x1981db=_0x2c7de2[_0xd383('0x2d')],_0x4f2ec6=_0x2c7de2[_0xd383('0x2d')]+_0x2c7de2[_0xd383('0x2e')],_0x2f1fea;if(_0x4f2ec6>=_0x208247){_0x4f2ec6=_0x208247;_0x2f1fea=0xc8;}else{_0x2f1fea=0xce;}_0x27750a[_0xd383('0x29')](_0x2f1fea);return _0x27750a[_0xd383('0x2f')](_0xd383('0x30'),_0x1981db+'-'+_0x4f2ec6+'/'+_0x208247)[_0xd383('0x2b')](_0x13d395);}return null;};}function patchUpdates(_0xcea4cf){return function(_0x1f87da){try{jsonpatch[_0xd383('0x31')](_0x1f87da,_0xcea4cf,!![]);}catch(_0x107411){return BPromise[_0xd383('0x32')](_0x107411);}return _0x1f87da[_0xd383('0x33')]();};}function saveUpdates(_0x5a2cc5,_0x2bfce1){return function(_0x476dfc){if(_0x476dfc){return _0x476dfc[_0xd383('0x34')](_0x5a2cc5)[_0xd383('0x1d')](function(_0x263ed3){return _0x263ed3;});}return null;};}function removeEntity(_0x18f305,_0x2f2d1c){return function(_0x3bb4b5){if(_0x3bb4b5){return _0x3bb4b5[_0xd383('0x35')]()['then'](function(){_0x18f305[_0xd383('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8b2f,_0x585c1c){return function(_0x2c2e1d){if(!_0x2c2e1d){_0x2c8b2f['sendStatus'](0x194);}return _0x2c2e1d;};}function handleError(_0x15d06b,_0x1bc5a5){_0x1bc5a5=_0x1bc5a5||0x1f4;return function(_0x4be0ea){logger[_0xd383('0x24')](_0x4be0ea[_0xd383('0x36')]);if(_0x4be0ea[_0xd383('0x37')]){delete _0x4be0ea[_0xd383('0x37')];}_0x15d06b[_0xd383('0x29')](_0x1bc5a5)[_0xd383('0x38')](_0x4be0ea);};}exports[_0xd383('0x39')]=function(_0x2d3f88,_0x9af1be){var _0x2a328d={},_0x55043d={},_0x3914ea={'count':0x0,'rows':[]};var _0x39c006=_[_0xd383('0x3a')](db[_0xd383('0x3b')][_0xd383('0x3c')],function(_0x3262c6){return{'name':_0x3262c6[_0xd383('0x3d')],'type':_0x3262c6[_0xd383('0x3e')][_0xd383('0x3f')]};});_0x55043d[_0xd383('0x40')]=_[_0xd383('0x3a')](_0x39c006,'name');_0x55043d[_0xd383('0x41')]=_[_0xd383('0x42')](_0x2d3f88[_0xd383('0x41')]);_0x55043d[_0xd383('0x43')]=_[_0xd383('0x44')](_0x55043d['model'],_0x55043d[_0xd383('0x41')]);_0x2a328d[_0xd383('0x45')]=_['intersection'](_0x55043d['model'],qs[_0xd383('0x46')](_0x2d3f88[_0xd383('0x41')][_0xd383('0x46')]));_0x2a328d[_0xd383('0x45')]=_0x2a328d[_0xd383('0x45')][_0xd383('0x47')]?_0x2a328d['attributes']:_0x55043d[_0xd383('0x40')];if(!_0x2d3f88[_0xd383('0x41')][_0xd383('0x48')](_0xd383('0x49'))){_0x2a328d[_0xd383('0x2e')]=qs[_0xd383('0x2e')](_0x2d3f88[_0xd383('0x41')][_0xd383('0x2e')]);_0x2a328d[_0xd383('0x2d')]=qs[_0xd383('0x2d')](_0x2d3f88[_0xd383('0x41')][_0xd383('0x2d')]);}_0x2a328d['order']=qs['sort'](_0x2d3f88['query'][_0xd383('0x4a')]);_0x2a328d[_0xd383('0x4b')]=qs[_0xd383('0x43')](_['pick'](_0x2d3f88[_0xd383('0x41')],_0x55043d[_0xd383('0x43')]),_0x39c006);if(_0x2d3f88[_0xd383('0x41')][_0xd383('0x4c')]){_0x2a328d['where']=_[_0xd383('0x4d')](_0x2a328d[_0xd383('0x4b')],{'$or':_[_0xd383('0x3a')](_0x39c006,function(_0x43feb6){if(_0x43feb6[_0xd383('0x3e')]!=='VIRTUAL'){var _0x6ac7a6={};_0x6ac7a6[_0x43feb6[_0xd383('0x37')]]={'$like':'%'+_0x2d3f88['query'][_0xd383('0x4c')]+'%'};return _0x6ac7a6;}})});}_0x2a328d=_[_0xd383('0x4d')]({},_0x2a328d,_0x2d3f88[_0xd383('0x4e')]);var _0x5f44a2={'where':_0x2a328d[_0xd383('0x4b')]};return db['FreshdeskConfiguration'][_0xd383('0x2c')](_0x5f44a2)[_0xd383('0x1d')](function(_0xb3f550){_0x3914ea['count']=_0xb3f550;if(_0x2d3f88['query'][_0xd383('0x4f')]){_0x2a328d[_0xd383('0x50')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xd383('0x51')](_0x2a328d);})[_0xd383('0x1d')](function(_0x160c0a){_0x3914ea[_0xd383('0x52')]=_0x160c0a;return _0x3914ea;})[_0xd383('0x1d')](respondWithFilteredResult(_0x9af1be,_0x2a328d))['catch'](handleError(_0x9af1be,null));};exports[_0xd383('0x53')]=function(_0x136de8,_0x36f2c2){var _0x41bbc6={'raw':![],'where':{'id':_0x136de8[_0xd383('0x54')]['id']}},_0x2df7ef={};_0x2df7ef[_0xd383('0x40')]=_[_0xd383('0x42')](db[_0xd383('0x3b')][_0xd383('0x3c')]);_0x2df7ef[_0xd383('0x41')]=_[_0xd383('0x42')](_0x136de8[_0xd383('0x41')]);_0x2df7ef['filters']=_[_0xd383('0x44')](_0x2df7ef[_0xd383('0x40')],_0x2df7ef['query']);_0x41bbc6[_0xd383('0x45')]=_[_0xd383('0x44')](_0x2df7ef[_0xd383('0x40')],qs[_0xd383('0x46')](_0x136de8[_0xd383('0x41')][_0xd383('0x46')]));_0x41bbc6[_0xd383('0x45')]=_0x41bbc6['attributes']['length']?_0x41bbc6[_0xd383('0x45')]:_0x2df7ef[_0xd383('0x40')];if(_0x136de8[_0xd383('0x41')][_0xd383('0x4f')]){_0x41bbc6[_0xd383('0x50')]=[{'all':!![]}];}_0x41bbc6=_[_0xd383('0x4d')]({},_0x41bbc6,_0x136de8['options']);return db[_0xd383('0x3b')][_0xd383('0x55')](_0x41bbc6)[_0xd383('0x1d')](handleEntityNotFound(_0x36f2c2,null))[_0xd383('0x1d')](respondWithResult(_0x36f2c2,null))[_0xd383('0x56')](handleError(_0x36f2c2,null));};exports[_0xd383('0x57')]=function(_0x121ba0,_0x5a2b26){return db[_0xd383('0x3b')][_0xd383('0x57')](_0x121ba0[_0xd383('0x58')],{})[_0xd383('0x1d')](respondWithResult(_0x5a2b26,0xc9))[_0xd383('0x56')](handleError(_0x5a2b26,null));};exports[_0xd383('0x34')]=function(_0x3f089d,_0x375a48){if(_0x3f089d[_0xd383('0x58')]['id']){delete _0x3f089d[_0xd383('0x58')]['id'];}return db['FreshdeskConfiguration'][_0xd383('0x55')]({'where':{'id':_0x3f089d[_0xd383('0x54')]['id']}})['then'](handleEntityNotFound(_0x375a48,null))['then'](saveUpdates(_0x3f089d['body'],null))['then'](respondWithResult(_0x375a48,null))['catch'](handleError(_0x375a48,null));};exports[_0xd383('0x35')]=function(_0x4655d9,_0x433a81){return db['FreshdeskConfiguration'][_0xd383('0x55')]({'where':{'id':_0x4655d9[_0xd383('0x54')]['id']}})[_0xd383('0x1d')](handleEntityNotFound(_0x433a81,null))[_0xd383('0x1d')](removeEntity(_0x433a81,null))[_0xd383('0x56')](handleError(_0x433a81,null));};exports['getFields']=function(_0x2c2d65,_0x23ae84,_0x1a4764){var _0x15d297={};var _0x374a69={};var _0x533fab;var _0x2812d0;return db[_0xd383('0x3b')][_0xd383('0x59')]({'where':{'id':_0x2c2d65['params']['id']}})[_0xd383('0x1d')](handleEntityNotFound(_0x23ae84,null))[_0xd383('0x1d')](function(_0xe75e94){if(_0xe75e94){_0x533fab=_0xe75e94;_0x374a69['model']=_[_0xd383('0x42')](db['FreshdeskField'][_0xd383('0x3c')]);_0x374a69['query']=_[_0xd383('0x42')](_0x2c2d65['query']);_0x374a69[_0xd383('0x43')]=_['intersection'](_0x374a69[_0xd383('0x40')],_0x374a69[_0xd383('0x41')]);_0x15d297[_0xd383('0x45')]=_['intersection'](_0x374a69[_0xd383('0x40')],qs[_0xd383('0x46')](_0x2c2d65[_0xd383('0x41')][_0xd383('0x46')]));_0x15d297[_0xd383('0x45')]=_0x15d297['attributes'][_0xd383('0x47')]?_0x15d297[_0xd383('0x45')]:_0x374a69[_0xd383('0x40')];_0x15d297[_0xd383('0x5a')]=qs['sort'](_0x2c2d65[_0xd383('0x41')][_0xd383('0x4a')]);_0x15d297[_0xd383('0x4b')]=qs[_0xd383('0x43')](_[_0xd383('0x5b')](_0x2c2d65[_0xd383('0x41')],_0x374a69[_0xd383('0x43')]));if(_0x2c2d65[_0xd383('0x41')][_0xd383('0x4c')]){_0x15d297[_0xd383('0x4b')]=_[_0xd383('0x4d')](_0x15d297[_0xd383('0x4b')],{'$or':_[_0xd383('0x3a')](_0x15d297['attributes'],function(_0x3003ac){var _0x2c8ce4={};_0x2c8ce4[_0x3003ac]={'$like':'%'+_0x2c2d65[_0xd383('0x41')][_0xd383('0x4c')]+'%'};return _0x2c8ce4;})});}_0x15d297=_[_0xd383('0x4d')]({},_0x15d297,_0x2c2d65[_0xd383('0x4e')]);return _0x533fab[_0xd383('0x5c')](_0x15d297);}})[_0xd383('0x1d')](function(_0x1b9b07){if(_0x1b9b07){_0x2812d0=_0x1b9b07[_0xd383('0x47')];if(!_0x2c2d65[_0xd383('0x41')][_0xd383('0x48')]('nolimit')){_0x15d297[_0xd383('0x2e')]=qs[_0xd383('0x2e')](_0x2c2d65['query']['limit']);_0x15d297[_0xd383('0x2d')]=qs['offset'](_0x2c2d65['query'][_0xd383('0x2d')]);}return _0x533fab[_0xd383('0x5c')](_0x15d297);}})[_0xd383('0x1d')](function(_0x16a8ea){if(_0x16a8ea){return _0x16a8ea?{'count':_0x2812d0,'rows':_0x16a8ea}:null;}})[_0xd383('0x1d')](respondWithResult(_0x23ae84,null))[_0xd383('0x56')](handleError(_0x23ae84,null));};exports[_0xd383('0x5d')]=function(_0x1b3a4f,_0x423a53,_0x5036c8){var _0x234471={};var _0x1c5326={};var _0x49d6ee;var _0x2adcf4;return db[_0xd383('0x3b')][_0xd383('0x59')]({'where':{'id':_0x1b3a4f[_0xd383('0x54')]['id']}})[_0xd383('0x1d')](handleEntityNotFound(_0x423a53,null))[_0xd383('0x1d')](function(_0x26a274){if(_0x26a274){_0x49d6ee=_0x26a274;_0x1c5326[_0xd383('0x40')]=_[_0xd383('0x42')](db[_0xd383('0x5e')]['rawAttributes']);_0x1c5326['query']=_[_0xd383('0x42')](_0x1b3a4f['query']);_0x1c5326[_0xd383('0x43')]=_[_0xd383('0x44')](_0x1c5326[_0xd383('0x40')],_0x1c5326[_0xd383('0x41')]);_0x234471[_0xd383('0x45')]=_['intersection'](_0x1c5326[_0xd383('0x40')],qs[_0xd383('0x46')](_0x1b3a4f[_0xd383('0x41')][_0xd383('0x46')]));_0x234471[_0xd383('0x45')]=_0x234471[_0xd383('0x45')]['length']?_0x234471[_0xd383('0x45')]:_0x1c5326[_0xd383('0x40')];_0x234471['order']=qs[_0xd383('0x4a')](_0x1b3a4f[_0xd383('0x41')][_0xd383('0x4a')]);_0x234471['where']=qs[_0xd383('0x43')](_['pick'](_0x1b3a4f[_0xd383('0x41')],_0x1c5326[_0xd383('0x43')]));if(_0x1b3a4f[_0xd383('0x41')][_0xd383('0x4c')]){_0x234471['where']=_[_0xd383('0x4d')](_0x234471[_0xd383('0x4b')],{'$or':_[_0xd383('0x3a')](_0x234471['attributes'],function(_0x173236){var _0xa6c6b8={};_0xa6c6b8[_0x173236]={'$like':'%'+_0x1b3a4f['query'][_0xd383('0x4c')]+'%'};return _0xa6c6b8;})});}_0x234471=_[_0xd383('0x4d')]({},_0x234471,_0x1b3a4f[_0xd383('0x4e')]);return _0x49d6ee[_0xd383('0x5d')](_0x234471);}})['then'](function(_0x4fe1ff){if(_0x4fe1ff){_0x2adcf4=_0x4fe1ff[_0xd383('0x47')];if(!_0x1b3a4f[_0xd383('0x41')][_0xd383('0x48')](_0xd383('0x49'))){_0x234471[_0xd383('0x2e')]=qs[_0xd383('0x2e')](_0x1b3a4f[_0xd383('0x41')]['limit']);_0x234471[_0xd383('0x2d')]=qs['offset'](_0x1b3a4f['query'][_0xd383('0x2d')]);}return _0x49d6ee['getSubjects'](_0x234471);}})[_0xd383('0x1d')](function(_0x1e56c0){if(_0x1e56c0){return _0x1e56c0?{'count':_0x2adcf4,'rows':_0x1e56c0}:null;}})[_0xd383('0x1d')](respondWithResult(_0x423a53,null))[_0xd383('0x56')](handleError(_0x423a53,null));};exports['getDescriptions']=function(_0x32106a,_0x11a7f5,_0x3fa13c){var _0x29f933={};var _0x1c48eb={};var _0x58effe;var _0x2a19d3;return db[_0xd383('0x3b')][_0xd383('0x59')]({'where':{'id':_0x32106a['params']['id']}})['then'](handleEntityNotFound(_0x11a7f5,null))[_0xd383('0x1d')](function(_0x492039){if(_0x492039){_0x58effe=_0x492039;_0x1c48eb[_0xd383('0x40')]=_[_0xd383('0x42')](db[_0xd383('0x5e')][_0xd383('0x3c')]);_0x1c48eb[_0xd383('0x41')]=_[_0xd383('0x42')](_0x32106a['query']);_0x1c48eb[_0xd383('0x43')]=_[_0xd383('0x44')](_0x1c48eb[_0xd383('0x40')],_0x1c48eb[_0xd383('0x41')]);_0x29f933[_0xd383('0x45')]=_[_0xd383('0x44')](_0x1c48eb[_0xd383('0x40')],qs[_0xd383('0x46')](_0x32106a['query'][_0xd383('0x46')]));_0x29f933['attributes']=_0x29f933[_0xd383('0x45')][_0xd383('0x47')]?_0x29f933[_0xd383('0x45')]:_0x1c48eb['model'];_0x29f933['order']=qs[_0xd383('0x4a')](_0x32106a[_0xd383('0x41')]['sort']);_0x29f933['where']=qs['filters'](_['pick'](_0x32106a[_0xd383('0x41')],_0x1c48eb[_0xd383('0x43')]));if(_0x32106a[_0xd383('0x41')][_0xd383('0x4c')]){_0x29f933[_0xd383('0x4b')]=_['merge'](_0x29f933[_0xd383('0x4b')],{'$or':_['map'](_0x29f933[_0xd383('0x45')],function(_0x2cb700){var _0x4a4b9e={};_0x4a4b9e[_0x2cb700]={'$like':'%'+_0x32106a[_0xd383('0x41')]['filter']+'%'};return _0x4a4b9e;})});}_0x29f933=_[_0xd383('0x4d')]({},_0x29f933,_0x32106a[_0xd383('0x4e')]);return _0x58effe[_0xd383('0x5f')](_0x29f933);}})[_0xd383('0x1d')](function(_0x438508){if(_0x438508){_0x2a19d3=_0x438508['length'];if(!_0x32106a[_0xd383('0x41')][_0xd383('0x48')](_0xd383('0x49'))){_0x29f933[_0xd383('0x2e')]=qs[_0xd383('0x2e')](_0x32106a[_0xd383('0x41')][_0xd383('0x2e')]);_0x29f933[_0xd383('0x2d')]=qs['offset'](_0x32106a[_0xd383('0x41')][_0xd383('0x2d')]);}return _0x58effe[_0xd383('0x5f')](_0x29f933);}})[_0xd383('0x1d')](function(_0x425fb5){if(_0x425fb5){return _0x425fb5?{'count':_0x2a19d3,'rows':_0x425fb5}:null;}})[_0xd383('0x1d')](respondWithResult(_0x11a7f5,null))[_0xd383('0x56')](handleError(_0x11a7f5,null));};exports['getTags']=function(_0x5a4722,_0x3843f2,_0x31d568){var _0x1fad7f={};var _0x3b259a={};var _0x27ce0e;var _0x2c0ae2;return db[_0xd383('0x3b')]['findOne']({'where':{'id':_0x5a4722[_0xd383('0x54')]['id']}})[_0xd383('0x1d')](handleEntityNotFound(_0x3843f2,null))[_0xd383('0x1d')](function(_0x377e47){if(_0x377e47){_0x27ce0e=_0x377e47;_0x3b259a[_0xd383('0x40')]=_[_0xd383('0x42')](db['Tag'][_0xd383('0x3c')]);_0x3b259a['query']=_['keys'](_0x5a4722[_0xd383('0x41')]);_0x3b259a[_0xd383('0x43')]=_[_0xd383('0x44')](_0x3b259a[_0xd383('0x40')],_0x3b259a[_0xd383('0x41')]);_0x1fad7f['attributes']=_[_0xd383('0x44')](_0x3b259a['model'],qs[_0xd383('0x46')](_0x5a4722[_0xd383('0x41')][_0xd383('0x46')]));_0x1fad7f[_0xd383('0x45')]=_0x1fad7f[_0xd383('0x45')][_0xd383('0x47')]?_0x1fad7f[_0xd383('0x45')]:_0x3b259a[_0xd383('0x40')];_0x1fad7f[_0xd383('0x5a')]=qs[_0xd383('0x4a')](_0x5a4722[_0xd383('0x41')][_0xd383('0x4a')]);_0x1fad7f[_0xd383('0x4b')]=qs['filters'](_[_0xd383('0x5b')](_0x5a4722['query'],_0x3b259a[_0xd383('0x43')]));if(_0x5a4722['query'][_0xd383('0x4c')]){_0x1fad7f[_0xd383('0x4b')]=_[_0xd383('0x4d')](_0x1fad7f[_0xd383('0x4b')],{'$or':_[_0xd383('0x3a')](_0x1fad7f['attributes'],function(_0x424dc4){var _0x343b7f={};_0x343b7f[_0x424dc4]={'$like':'%'+_0x5a4722[_0xd383('0x41')][_0xd383('0x4c')]+'%'};return _0x343b7f;})});}_0x1fad7f=_[_0xd383('0x4d')]({},_0x1fad7f,_0x5a4722[_0xd383('0x4e')]);return _0x27ce0e[_0xd383('0x60')](_0x1fad7f);}})[_0xd383('0x1d')](function(_0x3f4186){if(_0x3f4186){_0x2c0ae2=_0x3f4186['length'];if(!_0x5a4722[_0xd383('0x41')][_0xd383('0x48')]('nolimit')){_0x1fad7f[_0xd383('0x2e')]=qs[_0xd383('0x2e')](_0x5a4722[_0xd383('0x41')][_0xd383('0x2e')]);_0x1fad7f[_0xd383('0x2d')]=qs['offset'](_0x5a4722[_0xd383('0x41')]['offset']);}return _0x27ce0e[_0xd383('0x60')](_0x1fad7f);}})['then'](function(_0x55d98a){if(_0x55d98a){return _0x55d98a?{'count':_0x2c0ae2,'rows':_0x55d98a}:null;}})[_0xd383('0x1d')](respondWithResult(_0x3843f2,null))['catch'](handleError(_0x3843f2,null));};exports[_0xd383('0x61')]=function(_0x564925,_0x344124,_0x4de7ea){if(_0x564925[_0xd383('0x58')]['id']){delete _0x564925[_0xd383('0x58')]['id'];}return db[_0xd383('0x3b')][_0xd383('0x59')]({'where':{'id':_0x564925[_0xd383('0x54')]['id']}})[_0xd383('0x1d')](handleEntityNotFound(_0x344124,null))[_0xd383('0x1d')](function(_0x5e045b){if(_0x5e045b){return _0x5e045b[_0xd383('0x61')](_0x564925['body'][_0xd383('0x62')]||[]);}return null;})[_0xd383('0x1d')](respondWithResult(_0x344124,null))[_0xd383('0x56')](handleError(_0x344124,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5ede967..cdf497c 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 _0x814b=['define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x58f985,_0x46aa71){var _0x30750d=function(_0x5a6427){while(--_0x5a6427){_0x58f985['push'](_0x58f985['shift']());}};_0x30750d(++_0x46aa71);}(_0x814b,0x1a2));var _0xb814=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x814b[_0x26cab7];return _0x31ba06;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x577ac4,_0x55ffd7){var _0x5cecc3=function(_0x37d1b9){while(--_0x37d1b9){_0x577ac4['push'](_0x577ac4['shift']());}};_0x5cecc3(++_0x55ffd7);}(_0x53ec,0x192));var _0xc53e=function(_0x31b7ff,_0x4d3503){_0x31b7ff=_0x31b7ff-0x0;var _0x33ba84=_0x53ec[_0x31b7ff];return _0x33ba84;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 8d20f1e..58f7ba9 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 _0x071f=['../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x47c10c,_0x24bd33){var _0x320de8=function(_0x16e0df){while(--_0x16e0df){_0x47c10c['push'](_0x47c10c['shift']());}};_0x320de8(++_0x24bd33);}(_0x071f,0x9a));var _0xf071=function(_0x4bbfe8,_0x4a2aed){_0x4bbfe8=_0x4bbfe8-0x0;var _0x359165=_0x071f[_0x4bbfe8];return _0x359165;};'use strict';var _=require(_0xf071('0x0'));var util=require(_0xf071('0x1'));var moment=require('moment');var BPromise=require(_0xf071('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf071('0x3'))['db'];var utils=require(_0xf071('0x4'));var logger=require('../../config/logger')(_0xf071('0x5'));var config=require(_0xf071('0x6'));var jayson=require(_0xf071('0x7'));var client=jayson['client'][_0xf071('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7876f4,_0xed4408,_0x475b73){return new BPromise(function(_0x1aef8a,_0x2e3385){return client[_0xf071('0x9')](_0x7876f4,_0x475b73)[_0xf071('0xa')](function(_0x48a0da){logger[_0xf071('0xb')](_0xf071('0xc'),_0xed4408,_0xf071('0xd'));logger[_0xf071('0xe')](_0xf071('0xf'),_0xed4408,_0xf071('0xd'),JSON[_0xf071('0x10')](_0x48a0da));if(_0x48a0da[_0xf071('0x11')]){if(_0x48a0da[_0xf071('0x11')]['code']===0x1f4){logger['error'](_0xf071('0xc'),_0xed4408,_0x48a0da[_0xf071('0x11')][_0xf071('0x12')]);return _0x2e3385(_0x48a0da['error'][_0xf071('0x12')]);}logger['error'](_0xf071('0xc'),_0xed4408,_0x48a0da['error'][_0xf071('0x12')]);return _0x1aef8a(_0x48a0da['error']['message']);}else{logger[_0xf071('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xed4408,'request\x20sent');_0x1aef8a(_0x48a0da[_0xf071('0x13')][_0xf071('0x12')]);}})['catch'](function(_0x35086c){logger[_0xf071('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xed4408,_0x35086c);_0x2e3385(_0x35086c);});});} \ No newline at end of file +var _0x2c14=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x32f36f,_0x22af41){var _0x3fd49f=function(_0x1be757){while(--_0x1be757){_0x32f36f['push'](_0x32f36f['shift']());}};_0x3fd49f(++_0x22af41);}(_0x2c14,0x130));var _0x42c1=function(_0x2e45bb,_0x390873){_0x2e45bb=_0x2e45bb-0x0;var _0x48af4=_0x2c14[_0x2e45bb];return _0x48af4;};'use strict';var _=require(_0x42c1('0x0'));var util=require(_0x42c1('0x1'));var moment=require(_0x42c1('0x2'));var BPromise=require(_0x42c1('0x3'));var rs=require(_0x42c1('0x4'));var fs=require('fs');var Redis=require(_0x42c1('0x5'));var db=require(_0x42c1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x42c1('0x7'))('rpc');var config=require(_0x42c1('0x8'));var jayson=require(_0x42c1('0x9'));var client=jayson[_0x42c1('0xa')][_0x42c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b52d4,_0xc8d26d,_0x462ff7){return new BPromise(function(_0x14c28b,_0x1109e2){return client[_0x42c1('0xc')](_0x5b52d4,_0x462ff7)[_0x42c1('0xd')](function(_0x3b3880){logger['info'](_0x42c1('0xe'),_0xc8d26d,_0x42c1('0xf'));logger[_0x42c1('0x10')](_0x42c1('0x11'),_0xc8d26d,_0x42c1('0xf'),JSON[_0x42c1('0x12')](_0x3b3880));if(_0x3b3880[_0x42c1('0x13')]){if(_0x3b3880[_0x42c1('0x13')]['code']===0x1f4){logger['error'](_0x42c1('0xe'),_0xc8d26d,_0x3b3880[_0x42c1('0x13')][_0x42c1('0x14')]);return _0x1109e2(_0x3b3880[_0x42c1('0x13')]['message']);}logger[_0x42c1('0x13')](_0x42c1('0xe'),_0xc8d26d,_0x3b3880[_0x42c1('0x13')][_0x42c1('0x14')]);return _0x14c28b(_0x3b3880[_0x42c1('0x13')][_0x42c1('0x14')]);}else{logger['info'](_0x42c1('0xe'),_0xc8d26d,_0x42c1('0xf'));_0x14c28b(_0x3b3880[_0x42c1('0x15')][_0x42c1('0x14')]);}})['catch'](function(_0x3198d9){logger[_0x42c1('0x13')](_0x42c1('0xe'),_0xc8d26d,_0x3198d9);_0x1109e2(_0x3198d9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1d724b9..d7ea4ee 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(_0x3a1cbb,_0x388d70){var _0x4d780c=function(_0x24ca43){while(--_0x24ca43){_0x3a1cbb['push'](_0x3a1cbb['shift']());}};_0x4d780c(++_0x388d70);}(_0x008c,0x188));var _0xc008=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x008c[_0x52085a];return _0x5afc1a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0xc65fbd,_0x14d192){var _0x32c699=function(_0xcdfc88){while(--_0xcdfc88){_0xc65fbd['push'](_0xc65fbd['shift']());}};_0x32c699(++_0x14d192);}(_0x008c,0x188));var _0xc008=function(_0x2ae489,_0x9f8183){_0x2ae489=_0x2ae489-0x0;var _0x144cd2=_0x008c[_0x2ae489];return _0x144cd2;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d573d48..5b46ed1 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 _0x4944=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x2a0b5,_0x4f3624){var _0x4f0821=function(_0x209089){while(--_0x209089){_0x2a0b5['push'](_0x2a0b5['shift']());}};_0x4f0821(++_0x4f3624);}(_0x4944,0x6d));var _0x4494=function(_0x55e27b,_0x3b0a08){_0x55e27b=_0x55e27b-0x0;var _0x3a2271=_0x4944[_0x55e27b];return _0x3a2271;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'type':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4494('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'))},'keyContent':{'type':Sequelize[_0x4494('0x6')]},'idField':{'type':Sequelize[_0x4494('0x6')]},'nameField':{'type':Sequelize[_0x4494('0x6')]},'customField':{'type':Sequelize[_0x4494('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4494('0x6')]}}; \ No newline at end of file +var _0xe599=['string','variable','customVariable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x237f14,_0x1dfc3a){var _0x540817=function(_0x2277f1){while(--_0x2277f1){_0x237f14['push'](_0x237f14['shift']());}};_0x540817(++_0x1dfc3a);}(_0xe599,0x1e5));var _0x9e59=function(_0x66866e,_0x513f75){_0x66866e=_0x66866e-0x0;var _0x5b6ca3=_0xe599[_0x66866e];return _0x5b6ca3;};'use strict';var Sequelize=require(_0x9e59('0x0'));module[_0x9e59('0x1')]={'type':{'type':Sequelize[_0x9e59('0x2')](_0x9e59('0x3'),_0x9e59('0x4'),_0x9e59('0x5'),_0x9e59('0x6')),'defaultValue':_0x9e59('0x3')},'content':{'type':Sequelize[_0x9e59('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9e59('0x2')](_0x9e59('0x3'),'variable',_0x9e59('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9e59('0x7')]},'nameField':{'type':Sequelize[_0x9e59('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e59('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a003f01..e1e101b 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 _0x74b0=['json','count','offset','limit','status','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','FreshdeskField','includeAll','include','findAll','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x52f733,_0xa08011){var _0x38af5f=function(_0x675770){while(--_0x675770){_0x52f733['push'](_0x52f733['shift']());}};_0x38af5f(++_0xa08011);}(_0x74b0,0x6f));var _0x074b=function(_0x27e357,_0x596b3c){_0x27e357=_0x27e357-0x0;var _0x1451bf=_0x74b0[_0x27e357];return _0x1451bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x074b('0x0'));var rimraf=require(_0x074b('0x1'));var zipdir=require(_0x074b('0x2'));var jsonpatch=require(_0x074b('0x3'));var rp=require(_0x074b('0x4'));var moment=require(_0x074b('0x5'));var BPromise=require(_0x074b('0x6'));var Mustache=require('mustache');var util=require(_0x074b('0x7'));var path=require(_0x074b('0x8'));var sox=require('sox');var csv=require(_0x074b('0x9'));var ejs=require(_0x074b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x074b('0xb'));var crypto=require(_0x074b('0xc'));var jsforce=require(_0x074b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x074b('0x9'));var querystring=require(_0x074b('0xe'));var Papa=require(_0x074b('0xf'));var Redis=require(_0x074b('0x10'));var authService=require(_0x074b('0x11'));var qs=require(_0x074b('0x12'));var as=require(_0x074b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x074b('0x14'));var utils=require(_0x074b('0x15'));var config=require(_0x074b('0x16'));var db=require(_0x074b('0x17'))['db'];function respondWithStatusCode(_0x5b5348,_0x306f58){_0x306f58=_0x306f58||0xcc;return function(_0x490069){if(_0x490069){return _0x5b5348[_0x074b('0x18')](_0x306f58);}return _0x5b5348['status'](_0x306f58)['end']();};}function respondWithResult(_0x58b7ec,_0x1ff693){_0x1ff693=_0x1ff693||0xc8;return function(_0x595824){if(_0x595824){return _0x58b7ec['status'](_0x1ff693)[_0x074b('0x19')](_0x595824);}};}function respondWithFilteredResult(_0x4984bc,_0x1e6f87){return function(_0x317cd3){if(_0x317cd3){var _0x34ca94=_0x317cd3[_0x074b('0x1a')],_0x42e407=_0x1e6f87['offset'],_0x5462aa=_0x1e6f87[_0x074b('0x1b')]+_0x1e6f87[_0x074b('0x1c')],_0x5e13ab;if(_0x5462aa>=_0x34ca94){_0x5462aa=_0x34ca94;_0x5e13ab=0xc8;}else{_0x5e13ab=0xce;}_0x4984bc[_0x074b('0x1d')](_0x5e13ab);return _0x4984bc['set'](_0x074b('0x1e'),_0x42e407+'-'+_0x5462aa+'/'+_0x34ca94)[_0x074b('0x19')](_0x317cd3);}return null;};}function patchUpdates(_0x3ef87d){return function(_0x481e87){try{jsonpatch['apply'](_0x481e87,_0x3ef87d,!![]);}catch(_0x4633f2){return BPromise[_0x074b('0x1f')](_0x4633f2);}return _0x481e87['save']();};}function saveUpdates(_0x209da1,_0x2b58ea){return function(_0x280c70){if(_0x280c70){return _0x280c70[_0x074b('0x20')](_0x209da1)[_0x074b('0x21')](function(_0x4b3b27){return _0x4b3b27;});}return null;};}function removeEntity(_0x265bc6,_0xd00d8d){return function(_0x1c959){if(_0x1c959){return _0x1c959[_0x074b('0x22')]()[_0x074b('0x21')](function(){_0x265bc6[_0x074b('0x1d')](0xcc)[_0x074b('0x23')]();});}};}function handleEntityNotFound(_0x14ae1a,_0x426874){return function(_0x19e643){if(!_0x19e643){_0x14ae1a[_0x074b('0x18')](0x194);}return _0x19e643;};}function handleError(_0x3f2170,_0x1a0399){_0x1a0399=_0x1a0399||0x1f4;return function(_0xf05cfe){logger['error'](_0xf05cfe[_0x074b('0x24')]);if(_0xf05cfe['name']){delete _0xf05cfe[_0x074b('0x25')];}_0x3f2170[_0x074b('0x1d')](_0x1a0399)[_0x074b('0x26')](_0xf05cfe);};}exports[_0x074b('0x27')]=function(_0x3218fd,_0x2e35c5){var _0x38ffce={},_0x5fbee0={},_0x2b6a16={'count':0x0,'rows':[]};var _0x54096b=_[_0x074b('0x28')](db['FreshdeskField'][_0x074b('0x29')],function(_0x366ee8){return{'name':_0x366ee8['fieldName'],'type':_0x366ee8['type'][_0x074b('0x2a')]};});_0x5fbee0[_0x074b('0x2b')]=_[_0x074b('0x28')](_0x54096b,_0x074b('0x25'));_0x5fbee0[_0x074b('0x2c')]=_['keys'](_0x3218fd[_0x074b('0x2c')]);_0x5fbee0['filters']=_[_0x074b('0x2d')](_0x5fbee0['model'],_0x5fbee0[_0x074b('0x2c')]);_0x38ffce[_0x074b('0x2e')]=_[_0x074b('0x2d')](_0x5fbee0[_0x074b('0x2b')],qs[_0x074b('0x2f')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x2f')]));_0x38ffce[_0x074b('0x2e')]=_0x38ffce[_0x074b('0x2e')][_0x074b('0x30')]?_0x38ffce[_0x074b('0x2e')]:_0x5fbee0[_0x074b('0x2b')];if(!_0x3218fd[_0x074b('0x2c')]['hasOwnProperty'](_0x074b('0x31'))){_0x38ffce[_0x074b('0x1c')]=qs[_0x074b('0x1c')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x1c')]);_0x38ffce[_0x074b('0x1b')]=qs[_0x074b('0x1b')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x1b')]);}_0x38ffce[_0x074b('0x32')]=qs[_0x074b('0x33')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x33')]);_0x38ffce[_0x074b('0x34')]=qs[_0x074b('0x35')](_['pick'](_0x3218fd[_0x074b('0x2c')],_0x5fbee0[_0x074b('0x35')]),_0x54096b);if(_0x3218fd[_0x074b('0x2c')][_0x074b('0x36')]){_0x38ffce[_0x074b('0x34')]=_[_0x074b('0x37')](_0x38ffce[_0x074b('0x34')],{'$or':_[_0x074b('0x28')](_0x54096b,function(_0x6a4600){if(_0x6a4600[_0x074b('0x38')]!==_0x074b('0x39')){var _0x28266a={};_0x28266a[_0x6a4600[_0x074b('0x25')]]={'$like':'%'+_0x3218fd['query']['filter']+'%'};return _0x28266a;}})});}_0x38ffce=_[_0x074b('0x37')]({},_0x38ffce,_0x3218fd['options']);var _0x9a9713={'where':_0x38ffce[_0x074b('0x34')]};return db[_0x074b('0x3a')][_0x074b('0x1a')](_0x9a9713)[_0x074b('0x21')](function(_0xc7cca9){_0x2b6a16[_0x074b('0x1a')]=_0xc7cca9;if(_0x3218fd[_0x074b('0x2c')][_0x074b('0x3b')]){_0x38ffce[_0x074b('0x3c')]=[{'all':!![]}];}return db[_0x074b('0x3a')][_0x074b('0x3d')](_0x38ffce);})[_0x074b('0x21')](function(_0x43343a){_0x2b6a16['rows']=_0x43343a;return _0x2b6a16;})[_0x074b('0x21')](respondWithFilteredResult(_0x2e35c5,_0x38ffce))['catch'](handleError(_0x2e35c5,null));};exports['show']=function(_0x2ddd85,_0x1c9365){var _0x504713={'raw':!![],'where':{'id':_0x2ddd85[_0x074b('0x3e')]['id']}},_0x526472={};_0x526472[_0x074b('0x2b')]=_['keys'](db[_0x074b('0x3a')][_0x074b('0x29')]);_0x526472[_0x074b('0x2c')]=_['keys'](_0x2ddd85[_0x074b('0x2c')]);_0x526472[_0x074b('0x35')]=_['intersection'](_0x526472[_0x074b('0x2b')],_0x526472[_0x074b('0x2c')]);_0x504713[_0x074b('0x2e')]=_[_0x074b('0x2d')](_0x526472[_0x074b('0x2b')],qs['fields'](_0x2ddd85[_0x074b('0x2c')][_0x074b('0x2f')]));_0x504713[_0x074b('0x2e')]=_0x504713['attributes']['length']?_0x504713['attributes']:_0x526472[_0x074b('0x2b')];if(_0x2ddd85[_0x074b('0x2c')][_0x074b('0x3b')]){_0x504713[_0x074b('0x3c')]=[{'all':!![]}];}_0x504713=_[_0x074b('0x37')]({},_0x504713,_0x2ddd85[_0x074b('0x3f')]);return db[_0x074b('0x3a')][_0x074b('0x40')](_0x504713)[_0x074b('0x21')](handleEntityNotFound(_0x1c9365,null))[_0x074b('0x21')](respondWithResult(_0x1c9365,null))[_0x074b('0x41')](handleError(_0x1c9365,null));};exports[_0x074b('0x42')]=function(_0x3d3538,_0x288f6d){return db['FreshdeskField'][_0x074b('0x42')](_0x3d3538[_0x074b('0x43')],{})[_0x074b('0x21')](respondWithResult(_0x288f6d,0xc9))[_0x074b('0x41')](handleError(_0x288f6d,null));};exports['update']=function(_0x26243c,_0x371e1a){if(_0x26243c[_0x074b('0x43')]['id']){delete _0x26243c['body']['id'];}return db[_0x074b('0x3a')][_0x074b('0x40')]({'where':{'id':_0x26243c[_0x074b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x371e1a,null))[_0x074b('0x21')](saveUpdates(_0x26243c['body'],null))[_0x074b('0x21')](respondWithResult(_0x371e1a,null))[_0x074b('0x41')](handleError(_0x371e1a,null));};exports[_0x074b('0x22')]=function(_0x4965a6,_0x4e2d8c){return db[_0x074b('0x3a')]['find']({'where':{'id':_0x4965a6[_0x074b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e2d8c,null))[_0x074b('0x21')](removeEntity(_0x4e2d8c,null))[_0x074b('0x41')](handleError(_0x4e2d8c,null));}; \ No newline at end of file +var _0xcb42=['map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','FreshdeskField','rawAttributes','type','key','model'];(function(_0x7902d0,_0x378152){var _0x2ab4ac=function(_0x1837ee){while(--_0x1837ee){_0x7902d0['push'](_0x7902d0['shift']());}};_0x2ab4ac(++_0x378152);}(_0xcb42,0xa9));var _0x2cb4=function(_0x205e56,_0x366e77){_0x205e56=_0x205e56-0x0;var _0x489d5d=_0xcb42[_0x205e56];return _0x489d5d;};'use strict';var pdf=require(_0x2cb4('0x0'));var emlformat=require(_0x2cb4('0x1'));var rimraf=require(_0x2cb4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cb4('0x3'));var rp=require('request-promise');var moment=require(_0x2cb4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2cb4('0x5'));var path=require(_0x2cb4('0x6'));var sox=require(_0x2cb4('0x7'));var csv=require(_0x2cb4('0x8'));var ejs=require(_0x2cb4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2cb4('0xa'));var crypto=require(_0x2cb4('0xb'));var jsforce=require(_0x2cb4('0xc'));var deskjs=require(_0x2cb4('0xd'));var toCsv=require(_0x2cb4('0x8'));var querystring=require(_0x2cb4('0xe'));var Papa=require(_0x2cb4('0xf'));var Redis=require(_0x2cb4('0x10'));var authService=require(_0x2cb4('0x11'));var qs=require(_0x2cb4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cb4('0x13'));var logger=require(_0x2cb4('0x14'))(_0x2cb4('0x15'));var utils=require(_0x2cb4('0x16'));var config=require(_0x2cb4('0x17'));var db=require(_0x2cb4('0x18'))['db'];function respondWithStatusCode(_0x25ec69,_0x2cd574){_0x2cd574=_0x2cd574||0xcc;return function(_0x4394ed){if(_0x4394ed){return _0x25ec69[_0x2cb4('0x19')](_0x2cd574);}return _0x25ec69[_0x2cb4('0x1a')](_0x2cd574)['end']();};}function respondWithResult(_0x3578ef,_0x4b70de){_0x4b70de=_0x4b70de||0xc8;return function(_0x981ef3){if(_0x981ef3){return _0x3578ef[_0x2cb4('0x1a')](_0x4b70de)[_0x2cb4('0x1b')](_0x981ef3);}};}function respondWithFilteredResult(_0x38c87d,_0xe70bc2){return function(_0x4a8192){if(_0x4a8192){var _0x56f348=_0x4a8192[_0x2cb4('0x1c')],_0x548e99=_0xe70bc2[_0x2cb4('0x1d')],_0x3edfaf=_0xe70bc2[_0x2cb4('0x1d')]+_0xe70bc2[_0x2cb4('0x1e')],_0x60fde6;if(_0x3edfaf>=_0x56f348){_0x3edfaf=_0x56f348;_0x60fde6=0xc8;}else{_0x60fde6=0xce;}_0x38c87d[_0x2cb4('0x1a')](_0x60fde6);return _0x38c87d[_0x2cb4('0x1f')](_0x2cb4('0x20'),_0x548e99+'-'+_0x3edfaf+'/'+_0x56f348)[_0x2cb4('0x1b')](_0x4a8192);}return null;};}function patchUpdates(_0x1a64e5){return function(_0x4e0a6b){try{jsonpatch[_0x2cb4('0x21')](_0x4e0a6b,_0x1a64e5,!![]);}catch(_0x3a219b){return BPromise[_0x2cb4('0x22')](_0x3a219b);}return _0x4e0a6b[_0x2cb4('0x23')]();};}function saveUpdates(_0x55aa5b,_0x567085){return function(_0x1f6668){if(_0x1f6668){return _0x1f6668[_0x2cb4('0x24')](_0x55aa5b)[_0x2cb4('0x25')](function(_0x409354){return _0x409354;});}return null;};}function removeEntity(_0x3b46ee,_0x21e74b){return function(_0xfbde37){if(_0xfbde37){return _0xfbde37[_0x2cb4('0x26')]()['then'](function(){_0x3b46ee[_0x2cb4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c9da3,_0x18c76e){return function(_0x4f5ecd){if(!_0x4f5ecd){_0x5c9da3[_0x2cb4('0x19')](0x194);}return _0x4f5ecd;};}function handleError(_0x2213ee,_0x54970d){_0x54970d=_0x54970d||0x1f4;return function(_0x3c0bdf){logger[_0x2cb4('0x27')](_0x3c0bdf[_0x2cb4('0x28')]);if(_0x3c0bdf[_0x2cb4('0x29')]){delete _0x3c0bdf[_0x2cb4('0x29')];}_0x2213ee[_0x2cb4('0x1a')](_0x54970d)['send'](_0x3c0bdf);};}exports['index']=function(_0x594c9d,_0x31ebe6){var _0x3c78={},_0x1a0ba7={},_0x4f9017={'count':0x0,'rows':[]};var _0x40120a=_['map'](db[_0x2cb4('0x2a')][_0x2cb4('0x2b')],function(_0x2dde43){return{'name':_0x2dde43['fieldName'],'type':_0x2dde43[_0x2cb4('0x2c')][_0x2cb4('0x2d')]};});_0x1a0ba7[_0x2cb4('0x2e')]=_[_0x2cb4('0x2f')](_0x40120a,'name');_0x1a0ba7[_0x2cb4('0x30')]=_[_0x2cb4('0x31')](_0x594c9d[_0x2cb4('0x30')]);_0x1a0ba7['filters']=_[_0x2cb4('0x32')](_0x1a0ba7[_0x2cb4('0x2e')],_0x1a0ba7[_0x2cb4('0x30')]);_0x3c78[_0x2cb4('0x33')]=_[_0x2cb4('0x32')](_0x1a0ba7[_0x2cb4('0x2e')],qs[_0x2cb4('0x34')](_0x594c9d['query'][_0x2cb4('0x34')]));_0x3c78[_0x2cb4('0x33')]=_0x3c78[_0x2cb4('0x33')]['length']?_0x3c78['attributes']:_0x1a0ba7[_0x2cb4('0x2e')];if(!_0x594c9d['query'][_0x2cb4('0x35')]('nolimit')){_0x3c78[_0x2cb4('0x1e')]=qs[_0x2cb4('0x1e')](_0x594c9d[_0x2cb4('0x30')][_0x2cb4('0x1e')]);_0x3c78['offset']=qs[_0x2cb4('0x1d')](_0x594c9d[_0x2cb4('0x30')][_0x2cb4('0x1d')]);}_0x3c78[_0x2cb4('0x36')]=qs[_0x2cb4('0x37')](_0x594c9d['query'][_0x2cb4('0x37')]);_0x3c78[_0x2cb4('0x38')]=qs[_0x2cb4('0x39')](_['pick'](_0x594c9d['query'],_0x1a0ba7['filters']),_0x40120a);if(_0x594c9d[_0x2cb4('0x30')][_0x2cb4('0x3a')]){_0x3c78[_0x2cb4('0x38')]=_[_0x2cb4('0x3b')](_0x3c78['where'],{'$or':_['map'](_0x40120a,function(_0x446d7a){if(_0x446d7a[_0x2cb4('0x2c')]!==_0x2cb4('0x3c')){var _0x4d32f0={};_0x4d32f0[_0x446d7a[_0x2cb4('0x29')]]={'$like':'%'+_0x594c9d[_0x2cb4('0x30')][_0x2cb4('0x3a')]+'%'};return _0x4d32f0;}})});}_0x3c78=_[_0x2cb4('0x3b')]({},_0x3c78,_0x594c9d[_0x2cb4('0x3d')]);var _0x3374c3={'where':_0x3c78[_0x2cb4('0x38')]};return db[_0x2cb4('0x2a')]['count'](_0x3374c3)[_0x2cb4('0x25')](function(_0x5da8b4){_0x4f9017['count']=_0x5da8b4;if(_0x594c9d[_0x2cb4('0x30')][_0x2cb4('0x3e')]){_0x3c78['include']=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x3c78);})[_0x2cb4('0x25')](function(_0x54cdf4){_0x4f9017[_0x2cb4('0x3f')]=_0x54cdf4;return _0x4f9017;})[_0x2cb4('0x25')](respondWithFilteredResult(_0x31ebe6,_0x3c78))[_0x2cb4('0x40')](handleError(_0x31ebe6,null));};exports[_0x2cb4('0x41')]=function(_0x1e1e74,_0x20c959){var _0xde154e={'raw':!![],'where':{'id':_0x1e1e74[_0x2cb4('0x42')]['id']}},_0x13a3fe={};_0x13a3fe['model']=_[_0x2cb4('0x31')](db[_0x2cb4('0x2a')]['rawAttributes']);_0x13a3fe[_0x2cb4('0x30')]=_[_0x2cb4('0x31')](_0x1e1e74[_0x2cb4('0x30')]);_0x13a3fe[_0x2cb4('0x39')]=_[_0x2cb4('0x32')](_0x13a3fe[_0x2cb4('0x2e')],_0x13a3fe['query']);_0xde154e[_0x2cb4('0x33')]=_[_0x2cb4('0x32')](_0x13a3fe['model'],qs[_0x2cb4('0x34')](_0x1e1e74['query'][_0x2cb4('0x34')]));_0xde154e['attributes']=_0xde154e['attributes'][_0x2cb4('0x43')]?_0xde154e['attributes']:_0x13a3fe[_0x2cb4('0x2e')];if(_0x1e1e74['query']['includeAll']){_0xde154e[_0x2cb4('0x44')]=[{'all':!![]}];}_0xde154e=_['merge']({},_0xde154e,_0x1e1e74[_0x2cb4('0x3d')]);return db['FreshdeskField'][_0x2cb4('0x45')](_0xde154e)[_0x2cb4('0x25')](handleEntityNotFound(_0x20c959,null))[_0x2cb4('0x25')](respondWithResult(_0x20c959,null))[_0x2cb4('0x40')](handleError(_0x20c959,null));};exports[_0x2cb4('0x46')]=function(_0x4d94b4,_0x570613){return db[_0x2cb4('0x2a')][_0x2cb4('0x46')](_0x4d94b4[_0x2cb4('0x47')],{})[_0x2cb4('0x25')](respondWithResult(_0x570613,0xc9))[_0x2cb4('0x40')](handleError(_0x570613,null));};exports[_0x2cb4('0x24')]=function(_0x583b10,_0x4f9bd9){if(_0x583b10[_0x2cb4('0x47')]['id']){delete _0x583b10['body']['id'];}return db[_0x2cb4('0x2a')][_0x2cb4('0x45')]({'where':{'id':_0x583b10['params']['id']}})[_0x2cb4('0x25')](handleEntityNotFound(_0x4f9bd9,null))[_0x2cb4('0x25')](saveUpdates(_0x583b10[_0x2cb4('0x47')],null))['then'](respondWithResult(_0x4f9bd9,null))['catch'](handleError(_0x4f9bd9,null));};exports[_0x2cb4('0x26')]=function(_0x23a07d,_0x278fe6){return db[_0x2cb4('0x2a')][_0x2cb4('0x45')]({'where':{'id':_0x23a07d['params']['id']}})[_0x2cb4('0x25')](handleEntityNotFound(_0x278fe6,null))[_0x2cb4('0x25')](removeEntity(_0x278fe6,null))['catch'](handleError(_0x278fe6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 63e5004..5c15ce2 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 _0x62d6=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x523fff,_0x24649c){var _0x3c7a34=function(_0x3c5621){while(--_0x3c5621){_0x523fff['push'](_0x523fff['shift']());}};_0x3c7a34(++_0x24649c);}(_0x62d6,0x164));var _0x662d=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x62d6[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0x662d('0x0'));var util=require(_0x662d('0x1'));var logger=require(_0x662d('0x2'))(_0x662d('0x3'));var moment=require(_0x662d('0x4'));var BPromise=require('bluebird');var rp=require(_0x662d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x662d('0x6'));var config=require(_0x662d('0x7'));var attributes=require(_0x662d('0x8'));module[_0x662d('0x9')]=function(_0x237e92,_0x8344ac){return _0x237e92[_0x662d('0xa')](_0x662d('0xb'),attributes,{'tableName':_0x662d('0xc'),'paranoid':![],'indexes':[{'name':_0x662d('0xd'),'fields':[_0x662d('0xe'),_0x662d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec55=['exports','define','int_freshdesk_fields','freshdesk_unique_index','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes'];(function(_0x74746c,_0x4b0a70){var _0xfdb2f6=function(_0x1daf23){while(--_0x1daf23){_0x74746c['push'](_0x74746c['shift']());}};_0xfdb2f6(++_0x4b0a70);}(_0xec55,0x71));var _0x5ec5=function(_0x53174f,_0x986a3b){_0x53174f=_0x53174f-0x0;var _0x1cbd1c=_0xec55[_0x53174f];return _0x1cbd1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5ec5('0x0'))(_0x5ec5('0x1'));var moment=require('moment');var BPromise=require(_0x5ec5('0x2'));var rp=require(_0x5ec5('0x3'));var fs=require('fs');var path=require(_0x5ec5('0x4'));var rimraf=require(_0x5ec5('0x5'));var config=require('../../config/environment');var attributes=require(_0x5ec5('0x6'));module[_0x5ec5('0x7')]=function(_0x57c487,_0x27a2d8){return _0x57c487[_0x5ec5('0x8')]('FreshdeskField',attributes,{'tableName':_0x5ec5('0x9'),'paranoid':![],'indexes':[{'name':_0x5ec5('0xa'),'fields':['idField',_0x5ec5('0xb')],'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 98060ca..7422247 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x397a42,_0x3c3688){_0x397a42=_0x397a42-0x0;var _0x388d45=_0x7a54[_0x397a42];return _0x388d45;};'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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x23ca39,_0x4408ab){_0x23ca39=_0x23ca39-0x0;var _0x25951b=_0x7a54[_0x23ca39];return _0x25951b;};'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 5b70012..016a73f 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 _0x9a81=['./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1780e2,_0x362a36){var _0x3345d9=function(_0xccdcd5){while(--_0xccdcd5){_0x1780e2['push'](_0x1780e2['shift']());}};_0x3345d9(++_0x362a36);}(_0x9a81,0xf6));var _0x19a8=function(_0x63b8a3,_0x205576){_0x63b8a3=_0x63b8a3-0x0;var _0x4982f8=_0x9a81[_0x63b8a3];return _0x4982f8;};'use strict';var multer=require(_0x19a8('0x0'));var util=require(_0x19a8('0x1'));var path=require(_0x19a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x19a8('0x3'));var router=express['Router']();var auth=require(_0x19a8('0x4'));var interaction=require(_0x19a8('0x5'));var config=require(_0x19a8('0x6'));var controller=require(_0x19a8('0x7'));router[_0x19a8('0x8')]('/',auth[_0x19a8('0x9')](),controller[_0x19a8('0xa')]);router['get']('/:id',auth[_0x19a8('0x9')](),controller[_0x19a8('0xb')]);router[_0x19a8('0x8')](_0x19a8('0xc'),auth[_0x19a8('0x9')](),controller[_0x19a8('0xd')]);router[_0x19a8('0x8')](_0x19a8('0xe'),auth[_0x19a8('0x9')](),controller[_0x19a8('0xf')]);router[_0x19a8('0x10')]('/',auth[_0x19a8('0x9')](),controller[_0x19a8('0x11')]);router[_0x19a8('0x10')](_0x19a8('0xc'),auth[_0x19a8('0x9')](),controller[_0x19a8('0x12')]);router[_0x19a8('0x13')](_0x19a8('0x14'),auth[_0x19a8('0x9')](),controller['update']);router['delete'](_0x19a8('0x14'),auth[_0x19a8('0x9')](),controller[_0x19a8('0x15')]);module[_0x19a8('0x16')]=router; \ No newline at end of file +var _0x711d=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update'];(function(_0x1f0436,_0x32f41f){var _0x568cff=function(_0x3a0356){while(--_0x3a0356){_0x1f0436['push'](_0x1f0436['shift']());}};_0x568cff(++_0x32f41f);}(_0x711d,0x87));var _0xd711=function(_0x9318e4,_0x21e468){_0x9318e4=_0x9318e4-0x0;var _0x1531a0=_0x711d[_0x9318e4];return _0x1531a0;};'use strict';var multer=require(_0xd711('0x0'));var util=require(_0xd711('0x1'));var path=require(_0xd711('0x2'));var timeout=require(_0xd711('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd711('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd711('0x5'));router[_0xd711('0x6')]('/',auth['isAuthenticated'](),controller[_0xd711('0x7')]);router['get'](_0xd711('0x8'),auth[_0xd711('0x9')](),controller[_0xd711('0xa')]);router['get'](_0xd711('0xb'),auth[_0xd711('0x9')](),controller[_0xd711('0xc')]);router[_0xd711('0x6')](_0xd711('0xd'),auth[_0xd711('0x9')](),controller[_0xd711('0xe')]);router[_0xd711('0xf')]('/',auth['isAuthenticated'](),controller[_0xd711('0x10')]);router[_0xd711('0xf')](_0xd711('0xb'),auth[_0xd711('0x9')](),controller[_0xd711('0x11')]);router['put'](_0xd711('0x8'),auth[_0xd711('0x9')](),controller[_0xd711('0x12')]);router[_0xd711('0x13')](_0xd711('0x8'),auth[_0xd711('0x9')](),controller[_0xd711('0x14')]);module[_0xd711('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 344c18f..e543a46 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 _0x11c8=['username','remoteUri','exports','STRING'];(function(_0x3a435d,_0xbcc898){var _0x4fcd12=function(_0x50ea20){while(--_0x50ea20){_0x3a435d['push'](_0x3a435d['shift']());}};_0x4fcd12(++_0xbcc898);}(_0x11c8,0x19a));var _0x811c=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x11c8[_0x44c844];return _0x1d51b7;};'use strict';var Sequelize=require('sequelize');module[_0x811c('0x0')]={'name':{'type':Sequelize[_0x811c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x811c('0x1')],'unique':_0x811c('0x2')},'apiKey':{'type':Sequelize[_0x811c('0x1')]},'remoteUri':{'type':Sequelize[_0x811c('0x1')],'unique':_0x811c('0x3')},'serverUrl':{'type':Sequelize[_0x811c('0x1')]}}; \ No newline at end of file +var _0xac35=['remoteUri','sequelize','exports','STRING','username'];(function(_0x577d5e,_0x481ae){var _0xa4d5d=function(_0x2da983){while(--_0x2da983){_0x577d5e['push'](_0x577d5e['shift']());}};_0xa4d5d(++_0x481ae);}(_0xac35,0x141));var _0x5ac3=function(_0x596b6c,_0x12b670){_0x596b6c=_0x596b6c-0x0;var _0x309a77=_0xac35[_0x596b6c];return _0x309a77;};'use strict';var Sequelize=require(_0x5ac3('0x0'));module[_0x5ac3('0x1')]={'name':{'type':Sequelize[_0x5ac3('0x2')]},'description':{'type':Sequelize[_0x5ac3('0x2')]},'username':{'type':Sequelize[_0x5ac3('0x2')],'unique':_0x5ac3('0x3')},'apiKey':{'type':Sequelize[_0x5ac3('0x2')]},'remoteUri':{'type':Sequelize[_0x5ac3('0x2')],'unique':_0x5ac3('0x4')},'serverUrl':{'type':Sequelize[_0x5ac3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index fd1b1ab..416b505 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 _0xdd49=['apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','test','Sequelize','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','create','body','findOne','order','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','Subjects','username','remoteUri'];(function(_0x16cf52,_0x44157c){var _0x31db1c=function(_0x239301){while(--_0x239301){_0x16cf52['push'](_0x16cf52['shift']());}};_0x31db1c(++_0x44157c);}(_0xdd49,0x1d8));var _0x9dd4=function(_0x4fbaf9,_0x3b8190){_0x4fbaf9=_0x4fbaf9-0x0;var _0x1d89a0=_0xdd49[_0x4fbaf9];return _0x1d89a0;};'use strict';var pdf=require(_0x9dd4('0x0'));var emlformat=require(_0x9dd4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9dd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dd4('0x3'));var BPromise=require(_0x9dd4('0x4'));var Mustache=require(_0x9dd4('0x5'));var util=require(_0x9dd4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9dd4('0x7'));var ejs=require(_0x9dd4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9dd4('0x9'));var crypto=require(_0x9dd4('0xa'));var jsforce=require(_0x9dd4('0xb'));var deskjs=require(_0x9dd4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9dd4('0xd'));var Papa=require(_0x9dd4('0xe'));var Redis=require('ioredis');var authService=require(_0x9dd4('0xf'));var qs=require(_0x9dd4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dd4('0x11'));var logger=require(_0x9dd4('0x12'))(_0x9dd4('0x13'));var utils=require(_0x9dd4('0x14'));var config=require('../../config/environment');var db=require(_0x9dd4('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x9dd4('0x16')][_0x9dd4('0x17')]({'port':0x232a});function checkPasswordPattern(_0x568789,_0x18159e,_0x45fb64){if(_0x45fb64){var _0x44712b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44712b[_0x9dd4('0x18')](_0x18159e)){return _0x568789;}else{throw new db[(_0x9dd4('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 _0x568789;}}function respondWithRpcPromise(_0x40c4af,_0x2febc6,_0x422b03,_0xa7217c){return new BPromise(function(_0x1dc0f6,_0x40983a){var _0x5185f1=_0xa7217c||client;return _0x5185f1[_0x9dd4('0x1a')](_0x40c4af,_0x422b03)[_0x9dd4('0x1b')](function(_0x25d129){logger['info'](_0x9dd4('0x1c'),_0x2febc6,_0x9dd4('0x1d'));logger[_0x9dd4('0x1e')](_0x9dd4('0x1f'),_0x2febc6,_0x9dd4('0x1d'),JSON[_0x9dd4('0x20')](_0x25d129));if(_0x25d129[_0x9dd4('0x21')]){if(_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x22')]===0x1f4){logger[_0x9dd4('0x21')](_0x9dd4('0x1c'),_0x2febc6,_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);return _0x40983a(_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);}logger[_0x9dd4('0x21')](_0x9dd4('0x1c'),_0x2febc6,_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);return _0x1dc0f6(_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);}else{logger[_0x9dd4('0x24')](_0x9dd4('0x1c'),_0x2febc6,'request\x20sent');_0x1dc0f6(_0x25d129[_0x9dd4('0x25')][_0x9dd4('0x23')]);}})[_0x9dd4('0x26')](function(_0x1f8eee){logger[_0x9dd4('0x21')](_0x9dd4('0x1c'),_0x2febc6,_0x1f8eee);_0x40983a(_0x1f8eee);});});}function respondWithStatusCode(_0x3bd396,_0x49c473){_0x49c473=_0x49c473||0xcc;return function(_0x3aa2c2){if(_0x3aa2c2){return _0x3bd396[_0x9dd4('0x27')](_0x49c473);}return _0x3bd396[_0x9dd4('0x28')](_0x49c473)[_0x9dd4('0x29')]();};}function respondWithResult(_0x54c466,_0x7dc636){_0x7dc636=_0x7dc636||0xc8;return function(_0x2a3ac5){if(_0x2a3ac5){return _0x54c466['status'](_0x7dc636)['json'](_0x2a3ac5);}};}function respondWithFilteredResult(_0xbc700f,_0x54063b){return function(_0xc23f1e){if(_0xc23f1e){var _0x2b1c3d=_0xc23f1e[_0x9dd4('0x2a')],_0x4c0096=_0x54063b[_0x9dd4('0x2b')],_0xd2f4e9=_0x54063b[_0x9dd4('0x2b')]+_0x54063b['limit'],_0x2b7015;if(_0xd2f4e9>=_0x2b1c3d){_0xd2f4e9=_0x2b1c3d;_0x2b7015=0xc8;}else{_0x2b7015=0xce;}_0xbc700f['status'](_0x2b7015);return _0xbc700f[_0x9dd4('0x2c')]('Content-Range',_0x4c0096+'-'+_0xd2f4e9+'/'+_0x2b1c3d)[_0x9dd4('0x2d')](_0xc23f1e);}return null;};}function patchUpdates(_0x2cb042){return function(_0x4ff19d){try{jsonpatch[_0x9dd4('0x2e')](_0x4ff19d,_0x2cb042,!![]);}catch(_0x551199){return BPromise[_0x9dd4('0x2f')](_0x551199);}return _0x4ff19d[_0x9dd4('0x30')]();};}function saveUpdates(_0x40283f,_0x4c5073){return function(_0x3c970d){if(_0x3c970d){return _0x3c970d[_0x9dd4('0x31')](_0x40283f)['then'](function(_0x3dc34f){return _0x3dc34f;});}return null;};}function removeEntity(_0x4debfa,_0xe54ee7){return function(_0x128a47){if(_0x128a47){return _0x128a47[_0x9dd4('0x32')]()[_0x9dd4('0x1b')](function(){_0x4debfa[_0x9dd4('0x28')](0xcc)[_0x9dd4('0x29')]();});}};}function handleEntityNotFound(_0x42a0ee,_0x53bb08){return function(_0x5db3bb){if(!_0x5db3bb){_0x42a0ee[_0x9dd4('0x27')](0x194);}return _0x5db3bb;};}function handleError(_0x9c811d,_0x15f801){_0x15f801=_0x15f801||0x1f4;return function(_0x464737){logger[_0x9dd4('0x21')](_0x464737[_0x9dd4('0x33')]);if(_0x464737[_0x9dd4('0x34')]){delete _0x464737['name'];}_0x9c811d[_0x9dd4('0x28')](_0x15f801)[_0x9dd4('0x35')](_0x464737);};}exports[_0x9dd4('0x36')]=function(_0x3089a6,_0x1cb081){var _0x2c1ceb={},_0x3ac51f={},_0x156409={'count':0x0,'rows':[]};var _0x2f1123=_[_0x9dd4('0x37')](db[_0x9dd4('0x38')]['rawAttributes'],function(_0x8d3f22){return{'name':_0x8d3f22[_0x9dd4('0x39')],'type':_0x8d3f22[_0x9dd4('0x3a')]['key']};});_0x3ac51f[_0x9dd4('0x3b')]=_[_0x9dd4('0x37')](_0x2f1123,'name');_0x3ac51f[_0x9dd4('0x3c')]=_[_0x9dd4('0x3d')](_0x3089a6[_0x9dd4('0x3c')]);_0x3ac51f[_0x9dd4('0x3e')]=_[_0x9dd4('0x3f')](_0x3ac51f[_0x9dd4('0x3b')],_0x3ac51f[_0x9dd4('0x3c')]);_0x2c1ceb['attributes']=_[_0x9dd4('0x3f')](_0x3ac51f[_0x9dd4('0x3b')],qs[_0x9dd4('0x40')](_0x3089a6['query'][_0x9dd4('0x40')]));_0x2c1ceb[_0x9dd4('0x41')]=_0x2c1ceb[_0x9dd4('0x41')][_0x9dd4('0x42')]?_0x2c1ceb[_0x9dd4('0x41')]:_0x3ac51f[_0x9dd4('0x3b')];if(!_0x3089a6['query'][_0x9dd4('0x43')](_0x9dd4('0x44'))){_0x2c1ceb[_0x9dd4('0x45')]=qs[_0x9dd4('0x45')](_0x3089a6['query']['limit']);_0x2c1ceb[_0x9dd4('0x2b')]=qs[_0x9dd4('0x2b')](_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x2b')]);}_0x2c1ceb['order']=qs[_0x9dd4('0x46')](_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x46')]);_0x2c1ceb[_0x9dd4('0x47')]=qs['filters'](_[_0x9dd4('0x48')](_0x3089a6[_0x9dd4('0x3c')],_0x3ac51f[_0x9dd4('0x3e')]),_0x2f1123);if(_0x3089a6[_0x9dd4('0x3c')]['filter']){_0x2c1ceb['where']=_[_0x9dd4('0x49')](_0x2c1ceb[_0x9dd4('0x47')],{'$or':_[_0x9dd4('0x37')](_0x2f1123,function(_0x44d79a){if(_0x44d79a[_0x9dd4('0x3a')]!==_0x9dd4('0x4a')){var _0x2aa6ed={};_0x2aa6ed[_0x44d79a[_0x9dd4('0x34')]]={'$like':'%'+_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x4b')]+'%'};return _0x2aa6ed;}})});}_0x2c1ceb=_[_0x9dd4('0x49')]({},_0x2c1ceb,_0x3089a6['options']);var _0x437405={'where':_0x2c1ceb[_0x9dd4('0x47')]};return db[_0x9dd4('0x38')][_0x9dd4('0x2a')](_0x437405)[_0x9dd4('0x1b')](function(_0x4ff2c7){_0x156409[_0x9dd4('0x2a')]=_0x4ff2c7;if(_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x4c')]){_0x2c1ceb[_0x9dd4('0x4d')]=[{'all':!![]}];}return db[_0x9dd4('0x38')]['findAll'](_0x2c1ceb);})[_0x9dd4('0x1b')](function(_0x1bb2b0){_0x156409[_0x9dd4('0x4e')]=_0x1bb2b0;return _0x156409;})[_0x9dd4('0x1b')](respondWithFilteredResult(_0x1cb081,_0x2c1ceb))[_0x9dd4('0x26')](handleError(_0x1cb081,null));};exports[_0x9dd4('0x4f')]=function(_0xf90da0,_0x3a75d9){var _0x284090={'raw':![],'where':{'id':_0xf90da0[_0x9dd4('0x50')]['id']}},_0x4f90bc={};_0x4f90bc[_0x9dd4('0x3b')]=_[_0x9dd4('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x4f90bc['query']=_[_0x9dd4('0x3d')](_0xf90da0[_0x9dd4('0x3c')]);_0x4f90bc[_0x9dd4('0x3e')]=_[_0x9dd4('0x3f')](_0x4f90bc[_0x9dd4('0x3b')],_0x4f90bc['query']);_0x284090[_0x9dd4('0x41')]=_[_0x9dd4('0x3f')](_0x4f90bc[_0x9dd4('0x3b')],qs['fields'](_0xf90da0['query'][_0x9dd4('0x40')]));_0x284090[_0x9dd4('0x41')]=_0x284090[_0x9dd4('0x41')][_0x9dd4('0x42')]?_0x284090[_0x9dd4('0x41')]:_0x4f90bc[_0x9dd4('0x3b')];if(_0xf90da0[_0x9dd4('0x3c')][_0x9dd4('0x4c')]){_0x284090[_0x9dd4('0x4d')]=[{'all':!![]}];}_0x284090=_[_0x9dd4('0x49')]({},_0x284090,_0xf90da0[_0x9dd4('0x51')]);return db[_0x9dd4('0x38')][_0x9dd4('0x52')](_0x284090)[_0x9dd4('0x1b')](handleEntityNotFound(_0x3a75d9,null))[_0x9dd4('0x1b')](respondWithResult(_0x3a75d9,null))[_0x9dd4('0x26')](handleError(_0x3a75d9,null));};exports[_0x9dd4('0x53')]=function(_0x14e819,_0x4b9d15){return db[_0x9dd4('0x38')][_0x9dd4('0x53')](_0x14e819['body'],{})['then'](respondWithResult(_0x4b9d15,0xc9))[_0x9dd4('0x26')](handleError(_0x4b9d15,null));};exports[_0x9dd4('0x31')]=function(_0x1e471c,_0x33038f){if(_0x1e471c[_0x9dd4('0x54')]['id']){delete _0x1e471c[_0x9dd4('0x54')]['id'];}return db[_0x9dd4('0x38')][_0x9dd4('0x52')]({'where':{'id':_0x1e471c[_0x9dd4('0x50')]['id']}})[_0x9dd4('0x1b')](handleEntityNotFound(_0x33038f,null))[_0x9dd4('0x1b')](saveUpdates(_0x1e471c['body'],null))[_0x9dd4('0x1b')](respondWithResult(_0x33038f,null))[_0x9dd4('0x26')](handleError(_0x33038f,null));};exports[_0x9dd4('0x32')]=function(_0x348e27,_0x13d06e){return db[_0x9dd4('0x38')][_0x9dd4('0x52')]({'where':{'id':_0x348e27[_0x9dd4('0x50')]['id']}})[_0x9dd4('0x1b')](handleEntityNotFound(_0x13d06e,null))[_0x9dd4('0x1b')](removeEntity(_0x13d06e,null))['catch'](handleError(_0x13d06e,null));};exports['getConfigurations']=function(_0x3d83bb,_0x4330ed,_0xcb86d3){var _0x121912={};var _0xea82ad={};var _0x276586;var _0x1703a3;return db[_0x9dd4('0x38')][_0x9dd4('0x55')]({'where':{'id':_0x3d83bb[_0x9dd4('0x50')]['id']}})[_0x9dd4('0x1b')](handleEntityNotFound(_0x4330ed,null))[_0x9dd4('0x1b')](function(_0x4d301b){if(_0x4d301b){_0x276586=_0x4d301b;_0xea82ad['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0xea82ad[_0x9dd4('0x3c')]=_[_0x9dd4('0x3d')](_0x3d83bb['query']);_0xea82ad['filters']=_['intersection'](_0xea82ad['model'],_0xea82ad['query']);_0x121912['attributes']=_[_0x9dd4('0x3f')](_0xea82ad[_0x9dd4('0x3b')],qs['fields'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x40')]));_0x121912['attributes']=_0x121912[_0x9dd4('0x41')][_0x9dd4('0x42')]?_0x121912[_0x9dd4('0x41')]:_0xea82ad['model'];_0x121912[_0x9dd4('0x56')]=qs['sort'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x46')]);_0x121912[_0x9dd4('0x47')]=qs['filters'](_[_0x9dd4('0x48')](_0x3d83bb[_0x9dd4('0x3c')],_0xea82ad[_0x9dd4('0x3e')]));if(_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x4b')]){_0x121912[_0x9dd4('0x47')]=_[_0x9dd4('0x49')](_0x121912['where'],{'$or':_[_0x9dd4('0x37')](_0x121912[_0x9dd4('0x41')],function(_0xc91c4d){var _0x4ba099={};_0x4ba099[_0xc91c4d]={'$like':'%'+_0x3d83bb['query'][_0x9dd4('0x4b')]+'%'};return _0x4ba099;})});}_0x121912=_['merge']({},_0x121912,_0x3d83bb['options']);return _0x276586[_0x9dd4('0x57')](_0x121912);}})[_0x9dd4('0x1b')](function(_0x25d8c3){if(_0x25d8c3){_0x1703a3=_0x25d8c3['length'];if(!_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x43')](_0x9dd4('0x44'))){_0x121912[_0x9dd4('0x45')]=qs['limit'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x45')]);_0x121912[_0x9dd4('0x2b')]=qs['offset'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x2b')]);}return _0x276586[_0x9dd4('0x57')](_0x121912);}})[_0x9dd4('0x1b')](function(_0x31c817){if(_0x31c817){return _0x31c817?{'count':_0x1703a3,'rows':_0x31c817}:null;}})[_0x9dd4('0x1b')](respondWithResult(_0x4330ed,null))['catch'](handleError(_0x4330ed,null));};exports[_0x9dd4('0x58')]=function(_0x3f2c4c,_0x15baf9,_0x5bbe88){if(_0x3f2c4c[_0x9dd4('0x54')]['id']){delete _0x3f2c4c[_0x9dd4('0x54')]['id'];}return db['FreshsalesAccount'][_0x9dd4('0x55')]({'where':{'id':_0x3f2c4c['params']['id']}})['then'](handleEntityNotFound(_0x15baf9,null))[_0x9dd4('0x1b')](function(_0x30f10f){if(_0x30f10f){_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x59')]=_0x30f10f['id'];_0x3f2c4c[_0x9dd4('0x54')]['Subjects']=integrations['getSubjects'](_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x5a')],_0x3f2c4c['body']['type']);_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x5b')]=integrations[_0x9dd4('0x5c')](_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x5a')],_0x3f2c4c[_0x9dd4('0x54')]['type']);return db[_0x9dd4('0x5d')][_0x9dd4('0x53')](_0x3f2c4c[_0x9dd4('0x54')],{'include':[{'model':db[_0x9dd4('0x5e')],'as':_0x9dd4('0x5f')},{'model':db[_0x9dd4('0x5e')],'as':_0x9dd4('0x5b')}]});}return null;})[_0x9dd4('0x1b')](respondWithResult(_0x15baf9,null))[_0x9dd4('0x26')](handleError(_0x15baf9,null));};exports['getFields']=function(_0x1fd69f,_0x324f55,_0x30daee){var _0x26e548='';var _0x5a2545='';return db[_0x9dd4('0x38')][_0x9dd4('0x55')]({'where':{'id':_0x1fd69f[_0x9dd4('0x50')]['id']},'attributes':['id',_0x9dd4('0x60'),_0x9dd4('0x61'),_0x9dd4('0x62')]})[_0x9dd4('0x1b')](handleEntityNotFound(_0x324f55,null))[_0x9dd4('0x1b')](function(_0x73e49e){if(_0x73e49e){_0x5a2545=_0x73e49e[_0x9dd4('0x60')];_0x26e548=_0x73e49e[_0x9dd4('0x61')];var _0x491636=_0x73e49e[_0x9dd4('0x61')][_0x9dd4('0x63')](-0x1);if(_0x491636==='/'){_0x26e548=_0x26e548[_0x9dd4('0x64')](0x0,_0x26e548[_0x9dd4('0x65')](_0x491636));}return rp({'method':_0x9dd4('0x66'),'uri':util[_0x9dd4('0x67')](_0x9dd4('0x68'),_0x26e548,_0x9dd4('0x69')),'headers':{'Authorization':_0x9dd4('0x6a')+_0x73e49e[_0x9dd4('0x62')]},'json':!![]});}})[_0x9dd4('0x1b')](function(_0xd06e){if(_0xd06e){var _0x54f3df=_0xd06e[_0x9dd4('0x6b')];var _0x4d0d99=![];var _0x2f98e8=null;for(_0x2f98e8=0x0;_0x2f98e8<_0x54f3df[_0x9dd4('0x42')];_0x2f98e8++){if(_0x54f3df[_0x2f98e8][_0x9dd4('0x6c')]===_0x5a2545){_0x4d0d99=!![];}}if(_0x4d0d99){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9dd4('0x6d')});}}})[_0x9dd4('0x1b')](respondWithResult(_0x324f55,null))[_0x9dd4('0x26')](function(_0xc7a132){var _0x5b88b4=_0x1fd69f['query'][_0x9dd4('0x18')]?0x1f4:_0xc7a132[_0x9dd4('0x6e')]||0x1f4;logger['error'](_0x9dd4('0x6f'),_0x9dd4('0x70'),_0x5b88b4,JSON[_0x9dd4('0x20')](_0xc7a132));delete _0xc7a132['name'];if(_0x5b88b4===0x191){_0x5b88b4=0x190;}_0x324f55['status'](_0x5b88b4)[_0x9dd4('0x35')](_0x1fd69f[_0x9dd4('0x3c')][_0x9dd4('0x18')]?{'message':_0x9dd4('0x71'),'statusCode':_0xc7a132[_0x9dd4('0x6e')]}:_0xc7a132);});}; \ No newline at end of file +var _0xf756=['FreshsalesConfiguration','order','options','getConfigurations','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../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','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','end','status','count','offset','limit','set','json','apply','save','update','destroy','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','rows','show','find','create','body','params'];(function(_0x45aeb0,_0x4d37ad){var _0x7677b5=function(_0x45dd24){while(--_0x45dd24){_0x45aeb0['push'](_0x45aeb0['shift']());}};_0x7677b5(++_0x4d37ad);}(_0xf756,0xfb));var _0x6f75=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf756[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require(_0x6f75('0x0'));var emlformat=require(_0x6f75('0x1'));var rimraf=require(_0x6f75('0x2'));var zipdir=require(_0x6f75('0x3'));var jsonpatch=require(_0x6f75('0x4'));var rp=require(_0x6f75('0x5'));var moment=require(_0x6f75('0x6'));var BPromise=require(_0x6f75('0x7'));var Mustache=require(_0x6f75('0x8'));var util=require(_0x6f75('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x6f75('0xa'));var ejs=require(_0x6f75('0xb'));var fs=require('fs');var _=require(_0x6f75('0xc'));var squel=require(_0x6f75('0xd'));var crypto=require(_0x6f75('0xe'));var jsforce=require(_0x6f75('0xf'));var deskjs=require(_0x6f75('0x10'));var toCsv=require(_0x6f75('0xa'));var querystring=require(_0x6f75('0x11'));var Papa=require(_0x6f75('0x12'));var Redis=require(_0x6f75('0x13'));var authService=require(_0x6f75('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f75('0x15'));var logger=require('../../config/logger')(_0x6f75('0x16'));var utils=require('../../config/utils');var config=require(_0x6f75('0x17'));var db=require(_0x6f75('0x18'))['db'];var integrations=require(_0x6f75('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f75('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x363ef8,_0x2940cc,_0x1526eb){if(_0x1526eb){var _0x2e94df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e94df[_0x6f75('0x1b')](_0x2940cc)){return _0x363ef8;}else{throw new db[(_0x6f75('0x1c'))][(_0x6f75('0x1d'))](_0x6f75('0x1e'));}}else{return _0x363ef8;}}function respondWithRpcPromise(_0x2e763c,_0x32c9e0,_0x6530b8,_0x40cc1e){return new BPromise(function(_0x4074fa,_0x288415){var _0x46c4a6=_0x40cc1e||client;return _0x46c4a6[_0x6f75('0x1f')](_0x2e763c,_0x6530b8)[_0x6f75('0x20')](function(_0x42a058){logger[_0x6f75('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x32c9e0,'request\x20sent');logger[_0x6f75('0x22')](_0x6f75('0x23'),_0x32c9e0,_0x6f75('0x24'),JSON[_0x6f75('0x25')](_0x42a058));if(_0x42a058['error']){if(_0x42a058[_0x6f75('0x26')][_0x6f75('0x27')]===0x1f4){logger[_0x6f75('0x26')](_0x6f75('0x28'),_0x32c9e0,_0x42a058[_0x6f75('0x26')][_0x6f75('0x29')]);return _0x288415(_0x42a058[_0x6f75('0x26')]['message']);}logger[_0x6f75('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x32c9e0,_0x42a058[_0x6f75('0x26')][_0x6f75('0x29')]);return _0x4074fa(_0x42a058[_0x6f75('0x26')][_0x6f75('0x29')]);}else{logger[_0x6f75('0x21')](_0x6f75('0x28'),_0x32c9e0,_0x6f75('0x24'));_0x4074fa(_0x42a058[_0x6f75('0x2a')][_0x6f75('0x29')]);}})[_0x6f75('0x2b')](function(_0x44c0ad){logger[_0x6f75('0x26')](_0x6f75('0x28'),_0x32c9e0,_0x44c0ad);_0x288415(_0x44c0ad);});});}function respondWithStatusCode(_0x3f3237,_0x11e9c8){_0x11e9c8=_0x11e9c8||0xcc;return function(_0x5e6b41){if(_0x5e6b41){return _0x3f3237['sendStatus'](_0x11e9c8);}return _0x3f3237['status'](_0x11e9c8)[_0x6f75('0x2c')]();};}function respondWithResult(_0x2013e0,_0x38f96f){_0x38f96f=_0x38f96f||0xc8;return function(_0x24c481){if(_0x24c481){return _0x2013e0[_0x6f75('0x2d')](_0x38f96f)['json'](_0x24c481);}};}function respondWithFilteredResult(_0x56955f,_0x347400){return function(_0x46a4f7){if(_0x46a4f7){var _0x5d4896=_0x46a4f7[_0x6f75('0x2e')],_0x336856=_0x347400[_0x6f75('0x2f')],_0x607ffb=_0x347400[_0x6f75('0x2f')]+_0x347400[_0x6f75('0x30')],_0x425ba8;if(_0x607ffb>=_0x5d4896){_0x607ffb=_0x5d4896;_0x425ba8=0xc8;}else{_0x425ba8=0xce;}_0x56955f['status'](_0x425ba8);return _0x56955f[_0x6f75('0x31')]('Content-Range',_0x336856+'-'+_0x607ffb+'/'+_0x5d4896)[_0x6f75('0x32')](_0x46a4f7);}return null;};}function patchUpdates(_0x101c09){return function(_0x27db91){try{jsonpatch[_0x6f75('0x33')](_0x27db91,_0x101c09,!![]);}catch(_0x4d421a){return BPromise['reject'](_0x4d421a);}return _0x27db91[_0x6f75('0x34')]();};}function saveUpdates(_0x251ffa,_0x4c24f8){return function(_0x1752a8){if(_0x1752a8){return _0x1752a8[_0x6f75('0x35')](_0x251ffa)[_0x6f75('0x20')](function(_0x3f5658){return _0x3f5658;});}return null;};}function removeEntity(_0x4ed265,_0x1639da){return function(_0x7ce2c9){if(_0x7ce2c9){return _0x7ce2c9[_0x6f75('0x36')]()[_0x6f75('0x20')](function(){_0x4ed265[_0x6f75('0x2d')](0xcc)[_0x6f75('0x2c')]();});}};}function handleEntityNotFound(_0x275ddc,_0x2416c6){return function(_0x1f59ea){if(!_0x1f59ea){_0x275ddc[_0x6f75('0x37')](0x194);}return _0x1f59ea;};}function handleError(_0x336393,_0x1442c3){_0x1442c3=_0x1442c3||0x1f4;return function(_0x4d88a2){logger[_0x6f75('0x26')](_0x4d88a2[_0x6f75('0x38')]);if(_0x4d88a2[_0x6f75('0x39')]){delete _0x4d88a2[_0x6f75('0x39')];}_0x336393[_0x6f75('0x2d')](_0x1442c3)[_0x6f75('0x3a')](_0x4d88a2);};}exports[_0x6f75('0x3b')]=function(_0x3e4177,_0x4e36c3){var _0x5a9092={},_0xee04ea={},_0x259c9d={'count':0x0,'rows':[]};var _0x6ba515=_[_0x6f75('0x3c')](db[_0x6f75('0x3d')][_0x6f75('0x3e')],function(_0x5bb255){return{'name':_0x5bb255['fieldName'],'type':_0x5bb255[_0x6f75('0x3f')][_0x6f75('0x40')]};});_0xee04ea[_0x6f75('0x41')]=_['map'](_0x6ba515,_0x6f75('0x39'));_0xee04ea[_0x6f75('0x42')]=_[_0x6f75('0x43')](_0x3e4177['query']);_0xee04ea['filters']=_[_0x6f75('0x44')](_0xee04ea[_0x6f75('0x41')],_0xee04ea[_0x6f75('0x42')]);_0x5a9092[_0x6f75('0x45')]=_[_0x6f75('0x44')](_0xee04ea[_0x6f75('0x41')],qs[_0x6f75('0x46')](_0x3e4177['query'][_0x6f75('0x46')]));_0x5a9092[_0x6f75('0x45')]=_0x5a9092['attributes'][_0x6f75('0x47')]?_0x5a9092[_0x6f75('0x45')]:_0xee04ea['model'];if(!_0x3e4177['query'][_0x6f75('0x48')](_0x6f75('0x49'))){_0x5a9092['limit']=qs[_0x6f75('0x30')](_0x3e4177['query']['limit']);_0x5a9092['offset']=qs[_0x6f75('0x2f')](_0x3e4177[_0x6f75('0x42')]['offset']);}_0x5a9092['order']=qs[_0x6f75('0x4a')](_0x3e4177[_0x6f75('0x42')][_0x6f75('0x4a')]);_0x5a9092[_0x6f75('0x4b')]=qs[_0x6f75('0x4c')](_[_0x6f75('0x4d')](_0x3e4177[_0x6f75('0x42')],_0xee04ea[_0x6f75('0x4c')]),_0x6ba515);if(_0x3e4177[_0x6f75('0x42')][_0x6f75('0x4e')]){_0x5a9092[_0x6f75('0x4b')]=_[_0x6f75('0x4f')](_0x5a9092[_0x6f75('0x4b')],{'$or':_['map'](_0x6ba515,function(_0xd388f9){if(_0xd388f9[_0x6f75('0x3f')]!=='VIRTUAL'){var _0x4da434={};_0x4da434[_0xd388f9['name']]={'$like':'%'+_0x3e4177['query']['filter']+'%'};return _0x4da434;}})});}_0x5a9092=_['merge']({},_0x5a9092,_0x3e4177['options']);var _0x488978={'where':_0x5a9092[_0x6f75('0x4b')]};return db[_0x6f75('0x3d')]['count'](_0x488978)['then'](function(_0x31bd06){_0x259c9d['count']=_0x31bd06;if(_0x3e4177[_0x6f75('0x42')][_0x6f75('0x50')]){_0x5a9092[_0x6f75('0x51')]=[{'all':!![]}];}return db[_0x6f75('0x3d')]['findAll'](_0x5a9092);})[_0x6f75('0x20')](function(_0x32ae07){_0x259c9d[_0x6f75('0x52')]=_0x32ae07;return _0x259c9d;})[_0x6f75('0x20')](respondWithFilteredResult(_0x4e36c3,_0x5a9092))[_0x6f75('0x2b')](handleError(_0x4e36c3,null));};exports[_0x6f75('0x53')]=function(_0x4557b2,_0xb19529){var _0x3e2531={'raw':![],'where':{'id':_0x4557b2['params']['id']}},_0x368a7a={};_0x368a7a[_0x6f75('0x41')]=_[_0x6f75('0x43')](db['FreshsalesAccount']['rawAttributes']);_0x368a7a[_0x6f75('0x42')]=_['keys'](_0x4557b2[_0x6f75('0x42')]);_0x368a7a[_0x6f75('0x4c')]=_[_0x6f75('0x44')](_0x368a7a[_0x6f75('0x41')],_0x368a7a[_0x6f75('0x42')]);_0x3e2531[_0x6f75('0x45')]=_['intersection'](_0x368a7a[_0x6f75('0x41')],qs[_0x6f75('0x46')](_0x4557b2[_0x6f75('0x42')][_0x6f75('0x46')]));_0x3e2531['attributes']=_0x3e2531['attributes'][_0x6f75('0x47')]?_0x3e2531[_0x6f75('0x45')]:_0x368a7a[_0x6f75('0x41')];if(_0x4557b2[_0x6f75('0x42')][_0x6f75('0x50')]){_0x3e2531[_0x6f75('0x51')]=[{'all':!![]}];}_0x3e2531=_[_0x6f75('0x4f')]({},_0x3e2531,_0x4557b2['options']);return db[_0x6f75('0x3d')][_0x6f75('0x54')](_0x3e2531)['then'](handleEntityNotFound(_0xb19529,null))[_0x6f75('0x20')](respondWithResult(_0xb19529,null))[_0x6f75('0x2b')](handleError(_0xb19529,null));};exports[_0x6f75('0x55')]=function(_0x42d646,_0x3e050c){return db[_0x6f75('0x3d')]['create'](_0x42d646[_0x6f75('0x56')],{})[_0x6f75('0x20')](respondWithResult(_0x3e050c,0xc9))[_0x6f75('0x2b')](handleError(_0x3e050c,null));};exports[_0x6f75('0x35')]=function(_0x27a51f,_0x23ac20){if(_0x27a51f[_0x6f75('0x56')]['id']){delete _0x27a51f[_0x6f75('0x56')]['id'];}return db[_0x6f75('0x3d')][_0x6f75('0x54')]({'where':{'id':_0x27a51f[_0x6f75('0x57')]['id']}})[_0x6f75('0x20')](handleEntityNotFound(_0x23ac20,null))[_0x6f75('0x20')](saveUpdates(_0x27a51f[_0x6f75('0x56')],null))[_0x6f75('0x20')](respondWithResult(_0x23ac20,null))['catch'](handleError(_0x23ac20,null));};exports[_0x6f75('0x36')]=function(_0x46e241,_0x16d9c8){return db[_0x6f75('0x3d')][_0x6f75('0x54')]({'where':{'id':_0x46e241['params']['id']}})['then'](handleEntityNotFound(_0x16d9c8,null))[_0x6f75('0x20')](removeEntity(_0x16d9c8,null))['catch'](handleError(_0x16d9c8,null));};exports['getConfigurations']=function(_0x1ca14e,_0x16cdd9,_0x3461e4){var _0x2416db={};var _0x500127={};var _0x132c12;var _0x12b971;return db[_0x6f75('0x3d')]['findOne']({'where':{'id':_0x1ca14e[_0x6f75('0x57')]['id']}})['then'](handleEntityNotFound(_0x16cdd9,null))['then'](function(_0x38f9a4){if(_0x38f9a4){_0x132c12=_0x38f9a4;_0x500127['model']=_[_0x6f75('0x43')](db[_0x6f75('0x58')][_0x6f75('0x3e')]);_0x500127[_0x6f75('0x42')]=_[_0x6f75('0x43')](_0x1ca14e[_0x6f75('0x42')]);_0x500127['filters']=_[_0x6f75('0x44')](_0x500127[_0x6f75('0x41')],_0x500127['query']);_0x2416db[_0x6f75('0x45')]=_[_0x6f75('0x44')](_0x500127[_0x6f75('0x41')],qs[_0x6f75('0x46')](_0x1ca14e[_0x6f75('0x42')][_0x6f75('0x46')]));_0x2416db[_0x6f75('0x45')]=_0x2416db[_0x6f75('0x45')][_0x6f75('0x47')]?_0x2416db[_0x6f75('0x45')]:_0x500127[_0x6f75('0x41')];_0x2416db[_0x6f75('0x59')]=qs[_0x6f75('0x4a')](_0x1ca14e[_0x6f75('0x42')]['sort']);_0x2416db[_0x6f75('0x4b')]=qs['filters'](_[_0x6f75('0x4d')](_0x1ca14e[_0x6f75('0x42')],_0x500127['filters']));if(_0x1ca14e[_0x6f75('0x42')]['filter']){_0x2416db[_0x6f75('0x4b')]=_[_0x6f75('0x4f')](_0x2416db[_0x6f75('0x4b')],{'$or':_[_0x6f75('0x3c')](_0x2416db[_0x6f75('0x45')],function(_0x8a04c4){var _0xe6b3c2={};_0xe6b3c2[_0x8a04c4]={'$like':'%'+_0x1ca14e[_0x6f75('0x42')][_0x6f75('0x4e')]+'%'};return _0xe6b3c2;})});}_0x2416db=_[_0x6f75('0x4f')]({},_0x2416db,_0x1ca14e[_0x6f75('0x5a')]);return _0x132c12['getConfigurations'](_0x2416db);}})['then'](function(_0x25bd2b){if(_0x25bd2b){_0x12b971=_0x25bd2b[_0x6f75('0x47')];if(!_0x1ca14e[_0x6f75('0x42')][_0x6f75('0x48')](_0x6f75('0x49'))){_0x2416db[_0x6f75('0x30')]=qs['limit'](_0x1ca14e[_0x6f75('0x42')][_0x6f75('0x30')]);_0x2416db[_0x6f75('0x2f')]=qs['offset'](_0x1ca14e[_0x6f75('0x42')][_0x6f75('0x2f')]);}return _0x132c12[_0x6f75('0x5b')](_0x2416db);}})[_0x6f75('0x20')](function(_0x1223e0){if(_0x1223e0){return _0x1223e0?{'count':_0x12b971,'rows':_0x1223e0}:null;}})[_0x6f75('0x20')](respondWithResult(_0x16cdd9,null))[_0x6f75('0x2b')](handleError(_0x16cdd9,null));};exports['addConfiguration']=function(_0x4482b8,_0x21269a,_0x531264){if(_0x4482b8[_0x6f75('0x56')]['id']){delete _0x4482b8[_0x6f75('0x56')]['id'];}return db[_0x6f75('0x3d')][_0x6f75('0x5c')]({'where':{'id':_0x4482b8[_0x6f75('0x57')]['id']}})['then'](handleEntityNotFound(_0x21269a,null))[_0x6f75('0x20')](function(_0x4429ce){if(_0x4429ce){_0x4482b8[_0x6f75('0x56')][_0x6f75('0x5d')]=_0x4429ce['id'];_0x4482b8[_0x6f75('0x56')][_0x6f75('0x5e')]=integrations['getSubjects'](_0x4482b8[_0x6f75('0x56')][_0x6f75('0x5f')],_0x4482b8[_0x6f75('0x56')][_0x6f75('0x3f')]);_0x4482b8[_0x6f75('0x56')][_0x6f75('0x60')]=integrations[_0x6f75('0x61')](_0x4482b8[_0x6f75('0x56')][_0x6f75('0x5f')],_0x4482b8['body']['type']);return db[_0x6f75('0x58')][_0x6f75('0x55')](_0x4482b8[_0x6f75('0x56')],{'include':[{'model':db['FreshsalesField'],'as':_0x6f75('0x5e')},{'model':db[_0x6f75('0x62')],'as':_0x6f75('0x60')}]});}return null;})[_0x6f75('0x20')](respondWithResult(_0x21269a,null))[_0x6f75('0x2b')](handleError(_0x21269a,null));};exports[_0x6f75('0x63')]=function(_0x4dcdf9,_0xb786dd,_0x4d095f){var _0x118197='';var _0xde7b47='';return db[_0x6f75('0x3d')][_0x6f75('0x5c')]({'where':{'id':_0x4dcdf9[_0x6f75('0x57')]['id']},'attributes':['id',_0x6f75('0x64'),'remoteUri',_0x6f75('0x65')]})[_0x6f75('0x20')](handleEntityNotFound(_0xb786dd,null))['then'](function(_0x27690e){if(_0x27690e){_0xde7b47=_0x27690e[_0x6f75('0x64')];_0x118197=_0x27690e[_0x6f75('0x66')];var _0x3b33f0=_0x27690e[_0x6f75('0x66')][_0x6f75('0x67')](-0x1);if(_0x3b33f0==='/'){_0x118197=_0x118197[_0x6f75('0x68')](0x0,_0x118197['lastIndexOf'](_0x3b33f0));}return rp({'method':_0x6f75('0x69'),'uri':util['format']('%s%s',_0x118197,_0x6f75('0x6a')),'headers':{'Authorization':_0x6f75('0x6b')+_0x27690e[_0x6f75('0x65')]},'json':!![]});}})[_0x6f75('0x20')](function(_0xa9b88d){if(_0xa9b88d){var _0x40912c=_0xa9b88d[_0x6f75('0x6c')];var _0xb711fe=![];var _0x4a33ba=null;for(_0x4a33ba=0x0;_0x4a33ba<_0x40912c[_0x6f75('0x47')];_0x4a33ba++){if(_0x40912c[_0x4a33ba][_0x6f75('0x6d')]===_0xde7b47){_0xb711fe=!![];}}if(_0xb711fe){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6f75('0x6e')});}}})[_0x6f75('0x20')](respondWithResult(_0xb786dd,null))[_0x6f75('0x2b')](function(_0x3b0b31){var _0x49b35c=_0x4dcdf9[_0x6f75('0x42')][_0x6f75('0x1b')]?0x1f4:_0x3b0b31[_0x6f75('0x6f')]||0x1f4;logger[_0x6f75('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x6f75('0x63'),_0x49b35c,JSON[_0x6f75('0x25')](_0x3b0b31));delete _0x3b0b31[_0x6f75('0x39')];if(_0x49b35c===0x191){_0x49b35c=0x190;}_0xb786dd[_0x6f75('0x2d')](_0x49b35c)['send'](_0x4dcdf9['query'][_0x6f75('0x1b')]?{'message':_0x6f75('0x70'),'statusCode':_0x3b0b31[_0x6f75('0x6f')]}:_0x3b0b31);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0bc11b8..f2c8d07 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd67b=['api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util'];(function(_0x416865,_0x47124f){var _0x6373e5=function(_0x14f99c){while(--_0x14f99c){_0x416865['push'](_0x416865['shift']());}};_0x6373e5(++_0x47124f);}(_0xd67b,0x133));var _0xbd67=function(_0x9bb64f,_0x41f52c){_0x9bb64f=_0x9bb64f-0x0;var _0x1bd88c=_0xd67b[_0x9bb64f];return _0x1bd88c;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xbd67('0x6'));module[_0xbd67('0x7')]=function(_0x2ad142,_0x27b016){return _0x2ad142[_0xbd67('0x8')](_0xbd67('0x9'),attributes,{'tableName':_0xbd67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d4=['int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4a16c8,_0x443415){var _0x34e512=function(_0x2f06f8){while(--_0x2f06f8){_0x4a16c8['push'](_0x4a16c8['shift']());}};_0x34e512(++_0x443415);}(_0x29d4,0x1a1));var _0x429d=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x29d4[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var moment=require(_0x429d('0x3'));var BPromise=require(_0x429d('0x4'));var rp=require(_0x429d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var attributes=require(_0x429d('0x8'));var integrations=require(_0x429d('0x9'));module[_0x429d('0xa')]=function(_0xa71445,_0x56aa2f){return _0xa71445[_0x429d('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x429d('0xc'),'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 f33b85d..cb813bf 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 _0x6da9=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','include','model','map','then','GetFreshsalesAccount','debug','ShowFreshsalesAccount','FreshsalesAccount'];(function(_0x14b16f,_0x4b2b3a){var _0x2d8ddc=function(_0x2e54c2){while(--_0x2e54c2){_0x14b16f['push'](_0x14b16f['shift']());}};_0x2d8ddc(++_0x4b2b3a);}(_0x6da9,0x161));var _0x96da=function(_0x37b9a2,_0x56294c){_0x37b9a2=_0x37b9a2-0x0;var _0x21a8aa=_0x6da9[_0x37b9a2];return _0x21a8aa;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var moment=require(_0x96da('0x2'));var BPromise=require(_0x96da('0x3'));var rs=require(_0x96da('0x4'));var fs=require('fs');var Redis=require(_0x96da('0x5'));var db=require(_0x96da('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x96da('0x7'));var jayson=require(_0x96da('0x8'));var client=jayson[_0x96da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc4b0,_0x5d7737,_0x161249){return new BPromise(function(_0x45ee2f,_0x3b0883){return client['request'](_0x1bc4b0,_0x161249)['then'](function(_0x4ed0c1){logger[_0x96da('0xa')](_0x96da('0xb'),_0x5d7737,_0x96da('0xc'));logger['debug'](_0x96da('0xd'),_0x5d7737,_0x96da('0xc'),JSON['stringify'](_0x4ed0c1));if(_0x4ed0c1[_0x96da('0xe')]){if(_0x4ed0c1[_0x96da('0xe')][_0x96da('0xf')]===0x1f4){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);return _0x3b0883(_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);}logger['error'](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')]['message']);return _0x45ee2f(_0x4ed0c1['error'][_0x96da('0x10')]);}else{logger[_0x96da('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x5d7737,_0x96da('0xc'));_0x45ee2f(_0x4ed0c1['result'][_0x96da('0x10')]);}})[_0x96da('0x11')](function(_0x2d6d15){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x2d6d15);_0x3b0883(_0x2d6d15);});});}exports['GetFreshsalesAccount']=function(_0x2bfd0c){var _0xd1fef8=this;return new Promise(function(_0x7ac4a5,_0x30834c){return db['FreshsalesAccount'][_0x96da('0x12')]({'raw':_0x2bfd0c['options']?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x14')]===undefined?!![]:![]:!![],'where':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c['options'][_0x96da('0x15')]||null:null,'attributes':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x16')]||null:null,'limit':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')]['limit']||null:null,'include':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x17')]?_['map'](_0x2bfd0c[_0x96da('0x13')][_0x96da('0x17')],function(_0x4a9232){return{'model':db[_0x4a9232[_0x96da('0x18')]],'as':_0x4a9232['as'],'attributes':_0x4a9232['attributes'],'include':_0x4a9232[_0x96da('0x17')]?_[_0x96da('0x19')](_0x4a9232[_0x96da('0x17')],function(_0x1b29ae){return{'model':db[_0x1b29ae[_0x96da('0x18')]],'as':_0x1b29ae['as'],'attributes':_0x1b29ae[_0x96da('0x16')],'include':_0x1b29ae[_0x96da('0x17')]?_[_0x96da('0x19')](_0x1b29ae[_0x96da('0x17')],function(_0x2d197f){return{'model':db[_0x2d197f['model']],'as':_0x2d197f['as'],'attributes':_0x2d197f[_0x96da('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96da('0x1a')](function(_0x2e7a34){logger[_0x96da('0xa')](_0x96da('0x1b'),_0x2bfd0c);logger[_0x96da('0x1c')](_0x96da('0x1b'),_0x2bfd0c,JSON['stringify'](_0x2e7a34));_0x7ac4a5(_0x2e7a34);})[_0x96da('0x11')](function(_0x4241ba){logger[_0x96da('0xe')]('GetFreshsalesAccount',_0x4241ba['message'],_0x2bfd0c);_0x30834c(_0xd1fef8['error'](0x1f4,_0x4241ba['message']));});});};exports[_0x96da('0x1d')]=function(_0x480169){var _0x31110d=this;return new Promise(function(_0x156469,_0x2ddc62){return db[_0x96da('0x1e')][_0x96da('0x1f')]({'raw':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')][_0x96da('0x14')]===undefined?!![]:![]:!![],'where':_0x480169[_0x96da('0x13')]?_0x480169['options']['where']||null:null,'attributes':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')]['attributes']||null:null,'include':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')][_0x96da('0x17')]?_[_0x96da('0x19')](_0x480169[_0x96da('0x13')][_0x96da('0x17')],function(_0x3a6f6a){return{'model':db[_0x3a6f6a[_0x96da('0x18')]],'as':_0x3a6f6a['as'],'attributes':_0x3a6f6a[_0x96da('0x16')],'include':_0x3a6f6a['include']?_[_0x96da('0x19')](_0x3a6f6a['include'],function(_0x4daf81){return{'model':db[_0x4daf81[_0x96da('0x18')]],'as':_0x4daf81['as'],'attributes':_0x4daf81[_0x96da('0x16')],'include':_0x4daf81[_0x96da('0x17')]?_[_0x96da('0x19')](_0x4daf81[_0x96da('0x17')],function(_0x1147e4){return{'model':db[_0x1147e4[_0x96da('0x18')]],'as':_0x1147e4['as'],'attributes':_0x1147e4[_0x96da('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96da('0x1a')](function(_0x35db80){logger[_0x96da('0xa')]('ShowFreshsalesAccount',_0x480169);logger[_0x96da('0x1c')](_0x96da('0x1d'),_0x480169,JSON['stringify'](_0x35db80));_0x156469(_0x35db80);})['catch'](function(_0x41e123){logger[_0x96da('0xe')](_0x96da('0x1d'),_0x41e123[_0x96da('0x10')],_0x480169);_0x2ddc62(_0x31110d[_0x96da('0xe')](0x1f4,_0x41e123['message']));});});}; \ No newline at end of file +var _0x3c32=['message','catch','GetFreshsalesAccount','findAll','options','limit','include','model','map','attributes','ShowFreshsalesAccount','raw','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dd708,_0x24624e){var _0x13a7fb=function(_0x354526){while(--_0x354526){_0x2dd708['push'](_0x2dd708['shift']());}};_0x13a7fb(++_0x24624e);}(_0x3c32,0x161));var _0x23c3=function(_0x4bbd8a,_0x294530){_0x4bbd8a=_0x4bbd8a-0x0;var _0x1b02f1=_0x3c32[_0x4bbd8a];return _0x1b02f1;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var moment=require(_0x23c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x23c3('0x3'));var fs=require('fs');var Redis=require(_0x23c3('0x4'));var db=require(_0x23c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23c3('0x6'))('rpc');var config=require(_0x23c3('0x7'));var jayson=require(_0x23c3('0x8'));var client=jayson[_0x23c3('0x9')][_0x23c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6364,_0x56568e,_0x493ca6){return new BPromise(function(_0x4df5ee,_0x422558){return client[_0x23c3('0xb')](_0x4a6364,_0x493ca6)[_0x23c3('0xc')](function(_0x420987){logger[_0x23c3('0xd')](_0x23c3('0xe'),_0x56568e,_0x23c3('0xf'));logger[_0x23c3('0x10')](_0x23c3('0x11'),_0x56568e,_0x23c3('0xf'),JSON[_0x23c3('0x12')](_0x420987));if(_0x420987[_0x23c3('0x13')]){if(_0x420987[_0x23c3('0x13')][_0x23c3('0x14')]===0x1f4){logger[_0x23c3('0x13')](_0x23c3('0xe'),_0x56568e,_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x422558(_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x56568e,_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x4df5ee(_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);}else{logger[_0x23c3('0xd')](_0x23c3('0xe'),_0x56568e,_0x23c3('0xf'));_0x4df5ee(_0x420987['result']['message']);}})[_0x23c3('0x16')](function(_0x43534b){logger['error'](_0x23c3('0xe'),_0x56568e,_0x43534b);_0x422558(_0x43534b);});});}exports[_0x23c3('0x17')]=function(_0x20a8b7){var _0x1456a3=this;return new Promise(function(_0x25880d,_0x18990f){return db['FreshsalesAccount'][_0x23c3('0x18')]({'raw':_0x20a8b7[_0x23c3('0x19')]?_0x20a8b7[_0x23c3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x20a8b7[_0x23c3('0x19')]?_0x20a8b7['options']['where']||null:null,'attributes':_0x20a8b7[_0x23c3('0x19')]?_0x20a8b7['options']['attributes']||null:null,'limit':_0x20a8b7[_0x23c3('0x19')]?_0x20a8b7[_0x23c3('0x19')][_0x23c3('0x1a')]||null:null,'include':_0x20a8b7[_0x23c3('0x19')]?_0x20a8b7['options'][_0x23c3('0x1b')]?_['map'](_0x20a8b7[_0x23c3('0x19')][_0x23c3('0x1b')],function(_0x30fe87){return{'model':db[_0x30fe87[_0x23c3('0x1c')]],'as':_0x30fe87['as'],'attributes':_0x30fe87['attributes'],'include':_0x30fe87[_0x23c3('0x1b')]?_[_0x23c3('0x1d')](_0x30fe87['include'],function(_0x24fabd){return{'model':db[_0x24fabd[_0x23c3('0x1c')]],'as':_0x24fabd['as'],'attributes':_0x24fabd[_0x23c3('0x1e')],'include':_0x24fabd[_0x23c3('0x1b')]?_[_0x23c3('0x1d')](_0x24fabd['include'],function(_0x30ad00){return{'model':db[_0x30ad00[_0x23c3('0x1c')]],'as':_0x30ad00['as'],'attributes':_0x30ad00[_0x23c3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x23c3('0xc')](function(_0xa520fc){logger[_0x23c3('0xd')](_0x23c3('0x17'),_0x20a8b7);logger[_0x23c3('0x10')](_0x23c3('0x17'),_0x20a8b7,JSON[_0x23c3('0x12')](_0xa520fc));_0x25880d(_0xa520fc);})[_0x23c3('0x16')](function(_0xbb7faa){logger[_0x23c3('0x13')](_0x23c3('0x17'),_0xbb7faa[_0x23c3('0x15')],_0x20a8b7);_0x18990f(_0x1456a3[_0x23c3('0x13')](0x1f4,_0xbb7faa[_0x23c3('0x15')]));});});};exports[_0x23c3('0x1f')]=function(_0x12b8be){var _0xd732d7=this;return new Promise(function(_0x1bc3ce,_0x47abc5){return db['FreshsalesAccount']['find']({'raw':_0x12b8be[_0x23c3('0x19')]?_0x12b8be['options'][_0x23c3('0x20')]===undefined?!![]:![]:!![],'where':_0x12b8be['options']?_0x12b8be[_0x23c3('0x19')][_0x23c3('0x21')]||null:null,'attributes':_0x12b8be[_0x23c3('0x19')]?_0x12b8be[_0x23c3('0x19')][_0x23c3('0x1e')]||null:null,'include':_0x12b8be[_0x23c3('0x19')]?_0x12b8be[_0x23c3('0x19')]['include']?_[_0x23c3('0x1d')](_0x12b8be['options'][_0x23c3('0x1b')],function(_0x157734){return{'model':db[_0x157734['model']],'as':_0x157734['as'],'attributes':_0x157734['attributes'],'include':_0x157734['include']?_[_0x23c3('0x1d')](_0x157734[_0x23c3('0x1b')],function(_0x152249){return{'model':db[_0x152249['model']],'as':_0x152249['as'],'attributes':_0x152249[_0x23c3('0x1e')],'include':_0x152249[_0x23c3('0x1b')]?_[_0x23c3('0x1d')](_0x152249[_0x23c3('0x1b')],function(_0x323fc7){return{'model':db[_0x323fc7['model']],'as':_0x323fc7['as'],'attributes':_0x323fc7[_0x23c3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x23c3('0xc')](function(_0x7a925e){logger['info']('ShowFreshsalesAccount',_0x12b8be);logger[_0x23c3('0x10')](_0x23c3('0x1f'),_0x12b8be,JSON[_0x23c3('0x12')](_0x7a925e));_0x1bc3ce(_0x7a925e);})[_0x23c3('0x16')](function(_0x508374){logger[_0x23c3('0x13')](_0x23c3('0x1f'),_0x508374[_0x23c3('0x15')],_0x12b8be);_0x47abc5(_0xd732d7[_0x23c3('0x13')](0x1f4,_0x508374[_0x23c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index cca1a19..6605667 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 _0xfebc=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0xfebc,0x1a0));var _0xcfeb=function(_0x52fa1e,_0x39a40f){_0x52fa1e=_0x52fa1e-0x0;var _0x26849d=_0xfebc[_0x52fa1e];return _0x26849d;};'use strict';var multer=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var path=require(_0xcfeb('0x2'));var timeout=require(_0xcfeb('0x3'));var express=require(_0xcfeb('0x4'));var router=express[_0xcfeb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcfeb('0x6'));var config=require('../../config/environment');var controller=require(_0xcfeb('0x7'));router[_0xcfeb('0x8')]('/',auth[_0xcfeb('0x9')](),controller[_0xcfeb('0xa')]);router['get'](_0xcfeb('0xb'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0xc')]);router['get'](_0xcfeb('0xd'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0xe')]);router[_0xcfeb('0x8')](_0xcfeb('0xf'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x10')]);router[_0xcfeb('0x8')](_0xcfeb('0x11'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x12')]);router[_0xcfeb('0x13')]('/',auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x14')]);router[_0xcfeb('0x15')]('/:id',auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x16')]);router[_0xcfeb('0x17')](_0xcfeb('0xb'),auth['isAuthenticated'](),controller[_0xcfeb('0x18')]);module[_0xcfeb('0x19')]=router; \ No newline at end of file +var _0x111b=['getFields','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions'];(function(_0x294b6,_0x2907ae){var _0x38bb97=function(_0x5aaa76){while(--_0x5aaa76){_0x294b6['push'](_0x294b6['shift']());}};_0x38bb97(++_0x2907ae);}(_0x111b,0x15f));var _0xb111=function(_0x4e6ba8,_0x4ca053){_0x4e6ba8=_0x4e6ba8-0x0;var _0x2d7f19=_0x111b[_0x4e6ba8];return _0x2d7f19;};'use strict';var multer=require('multer');var util=require(_0xb111('0x0'));var path=require(_0xb111('0x1'));var timeout=require(_0xb111('0x2'));var express=require(_0xb111('0x3'));var router=express[_0xb111('0x4')]();var auth=require(_0xb111('0x5'));var interaction=require(_0xb111('0x6'));var config=require(_0xb111('0x7'));var controller=require(_0xb111('0x8'));router[_0xb111('0x9')]('/',auth[_0xb111('0xa')](),controller[_0xb111('0xb')]);router[_0xb111('0x9')](_0xb111('0xc'),auth[_0xb111('0xa')](),controller[_0xb111('0xd')]);router[_0xb111('0x9')](_0xb111('0xe'),auth['isAuthenticated'](),controller[_0xb111('0xf')]);router[_0xb111('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb111('0x10')]);router[_0xb111('0x9')]('/:id/fields',auth[_0xb111('0xa')](),controller[_0xb111('0x11')]);router['post']('/',auth[_0xb111('0xa')](),controller[_0xb111('0x12')]);router['put'](_0xb111('0xc'),auth['isAuthenticated'](),controller[_0xb111('0x13')]);router[_0xb111('0x14')]('/:id',auth[_0xb111('0xa')](),controller[_0xb111('0x15')]);module[_0xb111('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 07c6e9a..1462ea2 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 _0x6188=['STRING','sequelize','exports'];(function(_0x27d910,_0x464aa7){var _0x3dded3=function(_0x250080){while(--_0x250080){_0x27d910['push'](_0x27d910['shift']());}};_0x3dded3(++_0x464aa7);}(_0x6188,0x136));var _0x8618=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0x6188[_0x233716];return _0x302298;};'use strict';var Sequelize=require(_0x8618('0x0'));module[_0x8618('0x1')]={'name':{'type':Sequelize[_0x8618('0x2')]},'description':{'type':Sequelize[_0x8618('0x2')]}}; \ No newline at end of file +var _0xa108=['sequelize','exports','STRING'];(function(_0xcde320,_0x397361){var _0x18717f=function(_0x5c93ae){while(--_0x5c93ae){_0xcde320['push'](_0xcde320['shift']());}};_0x18717f(++_0x397361);}(_0xa108,0x1da));var _0x8a10=function(_0x14da4b,_0x54790c){_0x14da4b=_0x14da4b-0x0;var _0x4661e6=_0xa108[_0x14da4b];return _0x4661e6;};'use strict';var Sequelize=require(_0x8a10('0x0'));module[_0x8a10('0x1')]={'name':{'type':Sequelize[_0x8a10('0x2')]},'description':{'type':Sequelize[_0x8a10('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b63c019..9119863 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 _0xadc1=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','FreshsalesConfiguration','includeAll','include','rows','show','params','find','body','destroy','getSubjects','FreshsalesField','pick','options','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse'];(function(_0x5c23bc,_0x16e4dd){var _0x3b4262=function(_0x37c4fb){while(--_0x37c4fb){_0x5c23bc['push'](_0x5c23bc['shift']());}};_0x3b4262(++_0x16e4dd);}(_0xadc1,0x1d3));var _0x1adc=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xadc1[_0x118653];return _0xc11fa6;};'use strict';var pdf=require(_0x1adc('0x0'));var emlformat=require(_0x1adc('0x1'));var rimraf=require(_0x1adc('0x2'));var zipdir=require(_0x1adc('0x3'));var jsonpatch=require(_0x1adc('0x4'));var rp=require(_0x1adc('0x5'));var moment=require(_0x1adc('0x6'));var BPromise=require(_0x1adc('0x7'));var Mustache=require(_0x1adc('0x8'));var util=require(_0x1adc('0x9'));var path=require('path');var sox=require(_0x1adc('0xa'));var csv=require(_0x1adc('0xb'));var ejs=require(_0x1adc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1adc('0xd'));var crypto=require(_0x1adc('0xe'));var jsforce=require(_0x1adc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1adc('0xb'));var querystring=require(_0x1adc('0x10'));var Papa=require(_0x1adc('0x11'));var Redis=require(_0x1adc('0x12'));var authService=require(_0x1adc('0x13'));var qs=require(_0x1adc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1adc('0x15'));var logger=require('../../config/logger')(_0x1adc('0x16'));var utils=require('../../config/utils');var config=require(_0x1adc('0x17'));var db=require(_0x1adc('0x18'))['db'];var jayson=require(_0x1adc('0x19'));var client=jayson['client'][_0x1adc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1b9f37,_0x3dcc89,_0x3e75f7){if(_0x3e75f7){var _0x2e9e8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e9e8d[_0x1adc('0x1b')](_0x3dcc89)){return _0x1b9f37;}else{throw new db[(_0x1adc('0x1c'))][(_0x1adc('0x1d'))](_0x1adc('0x1e'));}}else{return _0x1b9f37;}}function respondWithRpcPromise(_0x570be8,_0x104654,_0x1ad783,_0x4de970){return new BPromise(function(_0x3838f8,_0x447138){var _0x5ba9f4=_0x4de970||client;return _0x5ba9f4[_0x1adc('0x1f')](_0x570be8,_0x1ad783)[_0x1adc('0x20')](function(_0x4b8143){logger[_0x1adc('0x21')](_0x1adc('0x22'),_0x104654,_0x1adc('0x23'));logger[_0x1adc('0x24')](_0x1adc('0x25'),_0x104654,'request\x20sent',JSON['stringify'](_0x4b8143));if(_0x4b8143[_0x1adc('0x26')]){if(_0x4b8143['error'][_0x1adc('0x27')]===0x1f4){logger['error'](_0x1adc('0x22'),_0x104654,_0x4b8143[_0x1adc('0x26')][_0x1adc('0x28')]);return _0x447138(_0x4b8143[_0x1adc('0x26')]['message']);}logger[_0x1adc('0x26')](_0x1adc('0x22'),_0x104654,_0x4b8143[_0x1adc('0x26')][_0x1adc('0x28')]);return _0x3838f8(_0x4b8143[_0x1adc('0x26')]['message']);}else{logger[_0x1adc('0x21')](_0x1adc('0x22'),_0x104654,'request\x20sent');_0x3838f8(_0x4b8143[_0x1adc('0x29')][_0x1adc('0x28')]);}})[_0x1adc('0x2a')](function(_0x59749c){logger[_0x1adc('0x26')](_0x1adc('0x22'),_0x104654,_0x59749c);_0x447138(_0x59749c);});});}function respondWithStatusCode(_0x5b7bd8,_0x58b644){_0x58b644=_0x58b644||0xcc;return function(_0x10a124){if(_0x10a124){return _0x5b7bd8[_0x1adc('0x2b')](_0x58b644);}return _0x5b7bd8[_0x1adc('0x2c')](_0x58b644)[_0x1adc('0x2d')]();};}function respondWithResult(_0x284044,_0x456743){_0x456743=_0x456743||0xc8;return function(_0x9398e5){if(_0x9398e5){return _0x284044['status'](_0x456743)[_0x1adc('0x2e')](_0x9398e5);}};}function respondWithFilteredResult(_0x1eb507,_0x3592af){return function(_0x2760b9){if(_0x2760b9){var _0x25d578=_0x2760b9[_0x1adc('0x2f')],_0x4440d0=_0x3592af[_0x1adc('0x30')],_0x109faf=_0x3592af['offset']+_0x3592af[_0x1adc('0x31')],_0x262467;if(_0x109faf>=_0x25d578){_0x109faf=_0x25d578;_0x262467=0xc8;}else{_0x262467=0xce;}_0x1eb507[_0x1adc('0x2c')](_0x262467);return _0x1eb507[_0x1adc('0x32')](_0x1adc('0x33'),_0x4440d0+'-'+_0x109faf+'/'+_0x25d578)[_0x1adc('0x2e')](_0x2760b9);}return null;};}function patchUpdates(_0x86730e){return function(_0x43a8d1){try{jsonpatch[_0x1adc('0x34')](_0x43a8d1,_0x86730e,!![]);}catch(_0x16d351){return BPromise[_0x1adc('0x35')](_0x16d351);}return _0x43a8d1[_0x1adc('0x36')]();};}function saveUpdates(_0x25d800,_0x41e4be){return function(_0x1545c7){if(_0x1545c7){return _0x1545c7[_0x1adc('0x37')](_0x25d800)[_0x1adc('0x20')](function(_0x29eed6){return _0x29eed6;});}return null;};}function removeEntity(_0x55a7d5,_0x457e27){return function(_0x5cdcf9){if(_0x5cdcf9){return _0x5cdcf9['destroy']()['then'](function(){_0x55a7d5[_0x1adc('0x2c')](0xcc)[_0x1adc('0x2d')]();});}};}function handleEntityNotFound(_0x1dcfe5,_0x563046){return function(_0x37eea9){if(!_0x37eea9){_0x1dcfe5['sendStatus'](0x194);}return _0x37eea9;};}function handleError(_0x3cc092,_0x2573c5){_0x2573c5=_0x2573c5||0x1f4;return function(_0xe465ef){logger[_0x1adc('0x26')](_0xe465ef[_0x1adc('0x38')]);if(_0xe465ef['name']){delete _0xe465ef['name'];}_0x3cc092[_0x1adc('0x2c')](_0x2573c5)[_0x1adc('0x39')](_0xe465ef);};}exports[_0x1adc('0x3a')]=function(_0x511207,_0x4adce2){var _0x37e13d={},_0x292977={},_0x545769={'count':0x0,'rows':[]};var _0x506736=_[_0x1adc('0x3b')](db['FreshsalesConfiguration'][_0x1adc('0x3c')],function(_0x4a06d7){return{'name':_0x4a06d7[_0x1adc('0x3d')],'type':_0x4a06d7['type'][_0x1adc('0x3e')]};});_0x292977[_0x1adc('0x3f')]=_[_0x1adc('0x3b')](_0x506736,_0x1adc('0x40'));_0x292977['query']=_[_0x1adc('0x41')](_0x511207[_0x1adc('0x42')]);_0x292977[_0x1adc('0x43')]=_['intersection'](_0x292977[_0x1adc('0x3f')],_0x292977[_0x1adc('0x42')]);_0x37e13d[_0x1adc('0x44')]=_[_0x1adc('0x45')](_0x292977[_0x1adc('0x3f')],qs[_0x1adc('0x46')](_0x511207[_0x1adc('0x42')][_0x1adc('0x46')]));_0x37e13d[_0x1adc('0x44')]=_0x37e13d[_0x1adc('0x44')][_0x1adc('0x47')]?_0x37e13d['attributes']:_0x292977['model'];if(!_0x511207[_0x1adc('0x42')][_0x1adc('0x48')](_0x1adc('0x49'))){_0x37e13d[_0x1adc('0x31')]=qs[_0x1adc('0x31')](_0x511207[_0x1adc('0x42')][_0x1adc('0x31')]);_0x37e13d[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x511207[_0x1adc('0x42')][_0x1adc('0x30')]);}_0x37e13d[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x511207[_0x1adc('0x42')][_0x1adc('0x4b')]);_0x37e13d['where']=qs[_0x1adc('0x43')](_['pick'](_0x511207[_0x1adc('0x42')],_0x292977['filters']),_0x506736);if(_0x511207['query'][_0x1adc('0x4c')]){_0x37e13d[_0x1adc('0x4d')]=_[_0x1adc('0x4e')](_0x37e13d[_0x1adc('0x4d')],{'$or':_[_0x1adc('0x3b')](_0x506736,function(_0x2b761f){if(_0x2b761f[_0x1adc('0x4f')]!==_0x1adc('0x50')){var _0x3a85d6={};_0x3a85d6[_0x2b761f['name']]={'$like':'%'+_0x511207[_0x1adc('0x42')]['filter']+'%'};return _0x3a85d6;}})});}_0x37e13d=_['merge']({},_0x37e13d,_0x511207['options']);var _0x17d449={'where':_0x37e13d[_0x1adc('0x4d')]};return db[_0x1adc('0x51')][_0x1adc('0x2f')](_0x17d449)[_0x1adc('0x20')](function(_0x2ef50c){_0x545769[_0x1adc('0x2f')]=_0x2ef50c;if(_0x511207[_0x1adc('0x42')][_0x1adc('0x52')]){_0x37e13d[_0x1adc('0x53')]=[{'all':!![]}];}return db[_0x1adc('0x51')]['findAll'](_0x37e13d);})['then'](function(_0x1d1fd2){_0x545769[_0x1adc('0x54')]=_0x1d1fd2;return _0x545769;})[_0x1adc('0x20')](respondWithFilteredResult(_0x4adce2,_0x37e13d))['catch'](handleError(_0x4adce2,null));};exports[_0x1adc('0x55')]=function(_0x2ce67b,_0x24f6b6){var _0x240d77={'raw':![],'where':{'id':_0x2ce67b[_0x1adc('0x56')]['id']}},_0x55c2a1={};_0x55c2a1['model']=_[_0x1adc('0x41')](db[_0x1adc('0x51')][_0x1adc('0x3c')]);_0x55c2a1['query']=_[_0x1adc('0x41')](_0x2ce67b[_0x1adc('0x42')]);_0x55c2a1[_0x1adc('0x43')]=_[_0x1adc('0x45')](_0x55c2a1[_0x1adc('0x3f')],_0x55c2a1[_0x1adc('0x42')]);_0x240d77['attributes']=_[_0x1adc('0x45')](_0x55c2a1[_0x1adc('0x3f')],qs['fields'](_0x2ce67b[_0x1adc('0x42')][_0x1adc('0x46')]));_0x240d77[_0x1adc('0x44')]=_0x240d77[_0x1adc('0x44')][_0x1adc('0x47')]?_0x240d77[_0x1adc('0x44')]:_0x55c2a1[_0x1adc('0x3f')];if(_0x2ce67b[_0x1adc('0x42')][_0x1adc('0x52')]){_0x240d77[_0x1adc('0x53')]=[{'all':!![]}];}_0x240d77=_[_0x1adc('0x4e')]({},_0x240d77,_0x2ce67b['options']);return db['FreshsalesConfiguration'][_0x1adc('0x57')](_0x240d77)[_0x1adc('0x20')](handleEntityNotFound(_0x24f6b6,null))[_0x1adc('0x20')](respondWithResult(_0x24f6b6,null))[_0x1adc('0x2a')](handleError(_0x24f6b6,null));};exports['create']=function(_0x4eabc5,_0x439cfd){return db[_0x1adc('0x51')]['create'](_0x4eabc5[_0x1adc('0x58')],{})[_0x1adc('0x20')](respondWithResult(_0x439cfd,0xc9))[_0x1adc('0x2a')](handleError(_0x439cfd,null));};exports[_0x1adc('0x37')]=function(_0x46470f,_0x45e465){if(_0x46470f[_0x1adc('0x58')]['id']){delete _0x46470f[_0x1adc('0x58')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x46470f['params']['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x45e465,null))[_0x1adc('0x20')](saveUpdates(_0x46470f[_0x1adc('0x58')],null))[_0x1adc('0x20')](respondWithResult(_0x45e465,null))[_0x1adc('0x2a')](handleError(_0x45e465,null));};exports[_0x1adc('0x59')]=function(_0x7afe13,_0x2be434){return db[_0x1adc('0x51')]['find']({'where':{'id':_0x7afe13[_0x1adc('0x56')]['id']}})['then'](handleEntityNotFound(_0x2be434,null))['then'](removeEntity(_0x2be434,null))[_0x1adc('0x2a')](handleError(_0x2be434,null));};exports[_0x1adc('0x5a')]=function(_0x5cb187,_0x1f198f,_0x29bbee){var _0x598ff5={};var _0x4336a2={};var _0x4d205b;var _0x5f361a;return db[_0x1adc('0x51')]['findOne']({'where':{'id':_0x5cb187[_0x1adc('0x56')]['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x1f198f,null))[_0x1adc('0x20')](function(_0x334b6b){if(_0x334b6b){_0x4d205b=_0x334b6b;_0x4336a2[_0x1adc('0x3f')]=_[_0x1adc('0x41')](db[_0x1adc('0x5b')][_0x1adc('0x3c')]);_0x4336a2[_0x1adc('0x42')]=_[_0x1adc('0x41')](_0x5cb187[_0x1adc('0x42')]);_0x4336a2['filters']=_['intersection'](_0x4336a2[_0x1adc('0x3f')],_0x4336a2[_0x1adc('0x42')]);_0x598ff5[_0x1adc('0x44')]=_[_0x1adc('0x45')](_0x4336a2['model'],qs['fields'](_0x5cb187['query'][_0x1adc('0x46')]));_0x598ff5[_0x1adc('0x44')]=_0x598ff5[_0x1adc('0x44')]['length']?_0x598ff5[_0x1adc('0x44')]:_0x4336a2[_0x1adc('0x3f')];_0x598ff5[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x5cb187[_0x1adc('0x42')][_0x1adc('0x4b')]);_0x598ff5[_0x1adc('0x4d')]=qs[_0x1adc('0x43')](_[_0x1adc('0x5c')](_0x5cb187[_0x1adc('0x42')],_0x4336a2[_0x1adc('0x43')]));if(_0x5cb187[_0x1adc('0x42')]['filter']){_0x598ff5[_0x1adc('0x4d')]=_[_0x1adc('0x4e')](_0x598ff5[_0x1adc('0x4d')],{'$or':_[_0x1adc('0x3b')](_0x598ff5[_0x1adc('0x44')],function(_0x75c9be){var _0x1939cf={};_0x1939cf[_0x75c9be]={'$like':'%'+_0x5cb187[_0x1adc('0x42')][_0x1adc('0x4c')]+'%'};return _0x1939cf;})});}_0x598ff5=_[_0x1adc('0x4e')]({},_0x598ff5,_0x5cb187[_0x1adc('0x5d')]);return _0x4d205b[_0x1adc('0x5a')](_0x598ff5);}})[_0x1adc('0x20')](function(_0x3d5dd7){if(_0x3d5dd7){_0x5f361a=_0x3d5dd7['length'];if(!_0x5cb187[_0x1adc('0x42')][_0x1adc('0x48')]('nolimit')){_0x598ff5['limit']=qs['limit'](_0x5cb187[_0x1adc('0x42')][_0x1adc('0x31')]);_0x598ff5[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x5cb187[_0x1adc('0x42')][_0x1adc('0x30')]);}return _0x4d205b[_0x1adc('0x5a')](_0x598ff5);}})['then'](function(_0x4562b8){if(_0x4562b8){return _0x4562b8?{'count':_0x5f361a,'rows':_0x4562b8}:null;}})[_0x1adc('0x20')](respondWithResult(_0x1f198f,null))[_0x1adc('0x2a')](handleError(_0x1f198f,null));};exports[_0x1adc('0x5e')]=function(_0x39f03c,_0x2735fa,_0x5a88be){var _0x1aec00={};var _0x128a3a={};var _0x3fce61;var _0x564729;return db[_0x1adc('0x51')][_0x1adc('0x5f')]({'where':{'id':_0x39f03c[_0x1adc('0x56')]['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x2735fa,null))[_0x1adc('0x20')](function(_0x299c9d){if(_0x299c9d){_0x3fce61=_0x299c9d;_0x128a3a[_0x1adc('0x3f')]=_[_0x1adc('0x41')](db[_0x1adc('0x5b')][_0x1adc('0x3c')]);_0x128a3a[_0x1adc('0x42')]=_['keys'](_0x39f03c[_0x1adc('0x42')]);_0x128a3a[_0x1adc('0x43')]=_[_0x1adc('0x45')](_0x128a3a['model'],_0x128a3a[_0x1adc('0x42')]);_0x1aec00['attributes']=_[_0x1adc('0x45')](_0x128a3a[_0x1adc('0x3f')],qs[_0x1adc('0x46')](_0x39f03c['query'][_0x1adc('0x46')]));_0x1aec00[_0x1adc('0x44')]=_0x1aec00[_0x1adc('0x44')][_0x1adc('0x47')]?_0x1aec00[_0x1adc('0x44')]:_0x128a3a[_0x1adc('0x3f')];_0x1aec00[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x39f03c[_0x1adc('0x42')]['sort']);_0x1aec00[_0x1adc('0x4d')]=qs[_0x1adc('0x43')](_[_0x1adc('0x5c')](_0x39f03c[_0x1adc('0x42')],_0x128a3a[_0x1adc('0x43')]));if(_0x39f03c['query'][_0x1adc('0x4c')]){_0x1aec00[_0x1adc('0x4d')]=_[_0x1adc('0x4e')](_0x1aec00[_0x1adc('0x4d')],{'$or':_[_0x1adc('0x3b')](_0x1aec00[_0x1adc('0x44')],function(_0x20339f){var _0x17afaa={};_0x17afaa[_0x20339f]={'$like':'%'+_0x39f03c[_0x1adc('0x42')]['filter']+'%'};return _0x17afaa;})});}_0x1aec00=_[_0x1adc('0x4e')]({},_0x1aec00,_0x39f03c['options']);return _0x3fce61[_0x1adc('0x5e')](_0x1aec00);}})['then'](function(_0x356c3c){if(_0x356c3c){_0x564729=_0x356c3c['length'];if(!_0x39f03c['query'][_0x1adc('0x48')](_0x1adc('0x49'))){_0x1aec00[_0x1adc('0x31')]=qs[_0x1adc('0x31')](_0x39f03c[_0x1adc('0x42')]['limit']);_0x1aec00[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x39f03c[_0x1adc('0x42')][_0x1adc('0x30')]);}return _0x3fce61[_0x1adc('0x5e')](_0x1aec00);}})[_0x1adc('0x20')](function(_0x5be301){if(_0x5be301){return _0x5be301?{'count':_0x564729,'rows':_0x5be301}:null;}})[_0x1adc('0x20')](respondWithResult(_0x2735fa,null))['catch'](handleError(_0x2735fa,null));};exports[_0x1adc('0x60')]=function(_0x370c02,_0x573e97,_0x30ae45){var _0x4b41c7={};var _0x5d7a01={};var _0x629801;var _0x17ebc0;return db['FreshsalesConfiguration'][_0x1adc('0x5f')]({'where':{'id':_0x370c02[_0x1adc('0x56')]['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x573e97,null))[_0x1adc('0x20')](function(_0x5917c1){if(_0x5917c1){_0x629801=_0x5917c1;_0x5d7a01[_0x1adc('0x3f')]=_['keys'](db[_0x1adc('0x5b')][_0x1adc('0x3c')]);_0x5d7a01[_0x1adc('0x42')]=_[_0x1adc('0x41')](_0x370c02['query']);_0x5d7a01[_0x1adc('0x43')]=_[_0x1adc('0x45')](_0x5d7a01[_0x1adc('0x3f')],_0x5d7a01[_0x1adc('0x42')]);_0x4b41c7[_0x1adc('0x44')]=_['intersection'](_0x5d7a01[_0x1adc('0x3f')],qs['fields'](_0x370c02['query'][_0x1adc('0x46')]));_0x4b41c7[_0x1adc('0x44')]=_0x4b41c7[_0x1adc('0x44')][_0x1adc('0x47')]?_0x4b41c7['attributes']:_0x5d7a01[_0x1adc('0x3f')];_0x4b41c7[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x370c02[_0x1adc('0x42')]['sort']);_0x4b41c7['where']=qs['filters'](_['pick'](_0x370c02['query'],_0x5d7a01[_0x1adc('0x43')]));if(_0x370c02[_0x1adc('0x42')][_0x1adc('0x4c')]){_0x4b41c7['where']=_[_0x1adc('0x4e')](_0x4b41c7['where'],{'$or':_['map'](_0x4b41c7[_0x1adc('0x44')],function(_0x2af9f0){var _0x14324d={};_0x14324d[_0x2af9f0]={'$like':'%'+_0x370c02[_0x1adc('0x42')][_0x1adc('0x4c')]+'%'};return _0x14324d;})});}_0x4b41c7=_[_0x1adc('0x4e')]({},_0x4b41c7,_0x370c02['options']);return _0x629801['getFields'](_0x4b41c7);}})[_0x1adc('0x20')](function(_0xf0e11b){if(_0xf0e11b){_0x17ebc0=_0xf0e11b[_0x1adc('0x47')];if(!_0x370c02[_0x1adc('0x42')][_0x1adc('0x48')](_0x1adc('0x49'))){_0x4b41c7[_0x1adc('0x31')]=qs[_0x1adc('0x31')](_0x370c02[_0x1adc('0x42')][_0x1adc('0x31')]);_0x4b41c7[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x370c02[_0x1adc('0x42')]['offset']);}return _0x629801[_0x1adc('0x60')](_0x4b41c7);}})['then'](function(_0x184752){if(_0x184752){return _0x184752?{'count':_0x17ebc0,'rows':_0x184752}:null;}})[_0x1adc('0x20')](respondWithResult(_0x573e97,null))[_0x1adc('0x2a')](handleError(_0x573e97,null));}; \ No newline at end of file +var _0x0ae9=['FreshsalesField','sort','pick','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','filter','options','includeAll','include','FreshsalesConfiguration','findAll','rows','catch','show','params','find','create','body','getSubjects','findOne'];(function(_0x31c78e,_0x36dac3){var _0x116a8e=function(_0x370efe){while(--_0x370efe){_0x31c78e['push'](_0x31c78e['shift']());}};_0x116a8e(++_0x36dac3);}(_0x0ae9,0x128));var _0x90ae=function(_0x334799,_0x5ec338){_0x334799=_0x334799-0x0;var _0xf8b184=_0x0ae9[_0x334799];return _0xf8b184;};'use strict';var pdf=require(_0x90ae('0x0'));var emlformat=require(_0x90ae('0x1'));var rimraf=require(_0x90ae('0x2'));var zipdir=require(_0x90ae('0x3'));var jsonpatch=require(_0x90ae('0x4'));var rp=require(_0x90ae('0x5'));var moment=require('moment');var BPromise=require(_0x90ae('0x6'));var Mustache=require(_0x90ae('0x7'));var util=require(_0x90ae('0x8'));var path=require(_0x90ae('0x9'));var sox=require(_0x90ae('0xa'));var csv=require(_0x90ae('0xb'));var ejs=require(_0x90ae('0xc'));var fs=require('fs');var _=require(_0x90ae('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x90ae('0xe'));var deskjs=require(_0x90ae('0xf'));var toCsv=require(_0x90ae('0xb'));var querystring=require(_0x90ae('0x10'));var Papa=require(_0x90ae('0x11'));var Redis=require(_0x90ae('0x12'));var authService=require(_0x90ae('0x13'));var qs=require(_0x90ae('0x14'));var as=require(_0x90ae('0x15'));var hardwareService=require(_0x90ae('0x16'));var logger=require(_0x90ae('0x17'))(_0x90ae('0x18'));var utils=require('../../config/utils');var config=require(_0x90ae('0x19'));var db=require(_0x90ae('0x1a'))['db'];var jayson=require(_0x90ae('0x1b'));var client=jayson[_0x90ae('0x1c')][_0x90ae('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1428a5,_0x189882,_0x1673d8){if(_0x1673d8){var _0x3abc6b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3abc6b[_0x90ae('0x1e')](_0x189882)){return _0x1428a5;}else{throw new db[(_0x90ae('0x1f'))][(_0x90ae('0x20'))](_0x90ae('0x21'));}}else{return _0x1428a5;}}function respondWithRpcPromise(_0x2a8e2f,_0x30d746,_0x4785c3,_0x719815){return new BPromise(function(_0x5660ff,_0x3f89eb){var _0x5bcc8a=_0x719815||client;return _0x5bcc8a['request'](_0x2a8e2f,_0x4785c3)[_0x90ae('0x22')](function(_0x5014e6){logger['info'](_0x90ae('0x23'),_0x30d746,'request\x20sent');logger[_0x90ae('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x30d746,_0x90ae('0x25'),JSON[_0x90ae('0x26')](_0x5014e6));if(_0x5014e6[_0x90ae('0x27')]){if(_0x5014e6[_0x90ae('0x27')][_0x90ae('0x28')]===0x1f4){logger[_0x90ae('0x27')](_0x90ae('0x23'),_0x30d746,_0x5014e6[_0x90ae('0x27')][_0x90ae('0x29')]);return _0x3f89eb(_0x5014e6[_0x90ae('0x27')][_0x90ae('0x29')]);}logger[_0x90ae('0x27')](_0x90ae('0x23'),_0x30d746,_0x5014e6[_0x90ae('0x27')][_0x90ae('0x29')]);return _0x5660ff(_0x5014e6[_0x90ae('0x27')]['message']);}else{logger[_0x90ae('0x2a')](_0x90ae('0x23'),_0x30d746,_0x90ae('0x25'));_0x5660ff(_0x5014e6[_0x90ae('0x2b')]['message']);}})['catch'](function(_0x5d5bde){logger[_0x90ae('0x27')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x30d746,_0x5d5bde);_0x3f89eb(_0x5d5bde);});});}function respondWithStatusCode(_0x3a34d8,_0x97d338){_0x97d338=_0x97d338||0xcc;return function(_0x1af484){if(_0x1af484){return _0x3a34d8['sendStatus'](_0x97d338);}return _0x3a34d8[_0x90ae('0x2c')](_0x97d338)['end']();};}function respondWithResult(_0x470ca8,_0x5f3f57){_0x5f3f57=_0x5f3f57||0xc8;return function(_0x465d76){if(_0x465d76){return _0x470ca8['status'](_0x5f3f57)[_0x90ae('0x2d')](_0x465d76);}};}function respondWithFilteredResult(_0x503a33,_0x3b43b3){return function(_0x1762ce){if(_0x1762ce){var _0x285819=_0x1762ce[_0x90ae('0x2e')],_0x251196=_0x3b43b3['offset'],_0x2b4865=_0x3b43b3[_0x90ae('0x2f')]+_0x3b43b3[_0x90ae('0x30')],_0x5477f8;if(_0x2b4865>=_0x285819){_0x2b4865=_0x285819;_0x5477f8=0xc8;}else{_0x5477f8=0xce;}_0x503a33[_0x90ae('0x2c')](_0x5477f8);return _0x503a33[_0x90ae('0x31')](_0x90ae('0x32'),_0x251196+'-'+_0x2b4865+'/'+_0x285819)[_0x90ae('0x2d')](_0x1762ce);}return null;};}function patchUpdates(_0x5f55a8){return function(_0x4f78b9){try{jsonpatch['apply'](_0x4f78b9,_0x5f55a8,!![]);}catch(_0x393711){return BPromise[_0x90ae('0x33')](_0x393711);}return _0x4f78b9[_0x90ae('0x34')]();};}function saveUpdates(_0x197ea0,_0x11da5f){return function(_0x43dd40){if(_0x43dd40){return _0x43dd40[_0x90ae('0x35')](_0x197ea0)[_0x90ae('0x22')](function(_0x5de04a){return _0x5de04a;});}return null;};}function removeEntity(_0x1b172c,_0x562e41){return function(_0x44250d){if(_0x44250d){return _0x44250d[_0x90ae('0x36')]()[_0x90ae('0x22')](function(){_0x1b172c[_0x90ae('0x2c')](0xcc)[_0x90ae('0x37')]();});}};}function handleEntityNotFound(_0x477e6f,_0xe467fd){return function(_0x464ddb){if(!_0x464ddb){_0x477e6f[_0x90ae('0x38')](0x194);}return _0x464ddb;};}function handleError(_0x157e8c,_0x35944f){_0x35944f=_0x35944f||0x1f4;return function(_0x8a7aca){logger['error'](_0x8a7aca[_0x90ae('0x39')]);if(_0x8a7aca['name']){delete _0x8a7aca[_0x90ae('0x3a')];}_0x157e8c['status'](_0x35944f)[_0x90ae('0x3b')](_0x8a7aca);};}exports['index']=function(_0x39bb4f,_0x4b16d5){var _0x4a4c22={},_0x199bc7={},_0x43106d={'count':0x0,'rows':[]};var _0x8504d4=_[_0x90ae('0x3c')](db['FreshsalesConfiguration'][_0x90ae('0x3d')],function(_0x4dd873){return{'name':_0x4dd873[_0x90ae('0x3e')],'type':_0x4dd873[_0x90ae('0x3f')]['key']};});_0x199bc7[_0x90ae('0x40')]=_[_0x90ae('0x3c')](_0x8504d4,_0x90ae('0x3a'));_0x199bc7[_0x90ae('0x41')]=_[_0x90ae('0x42')](_0x39bb4f[_0x90ae('0x41')]);_0x199bc7[_0x90ae('0x43')]=_[_0x90ae('0x44')](_0x199bc7['model'],_0x199bc7[_0x90ae('0x41')]);_0x4a4c22[_0x90ae('0x45')]=_[_0x90ae('0x44')](_0x199bc7[_0x90ae('0x40')],qs['fields'](_0x39bb4f[_0x90ae('0x41')][_0x90ae('0x46')]));_0x4a4c22[_0x90ae('0x45')]=_0x4a4c22[_0x90ae('0x45')][_0x90ae('0x47')]?_0x4a4c22[_0x90ae('0x45')]:_0x199bc7[_0x90ae('0x40')];if(!_0x39bb4f['query'][_0x90ae('0x48')](_0x90ae('0x49'))){_0x4a4c22[_0x90ae('0x30')]=qs['limit'](_0x39bb4f[_0x90ae('0x41')][_0x90ae('0x30')]);_0x4a4c22[_0x90ae('0x2f')]=qs[_0x90ae('0x2f')](_0x39bb4f[_0x90ae('0x41')]['offset']);}_0x4a4c22[_0x90ae('0x4a')]=qs['sort'](_0x39bb4f['query']['sort']);_0x4a4c22['where']=qs[_0x90ae('0x43')](_['pick'](_0x39bb4f[_0x90ae('0x41')],_0x199bc7[_0x90ae('0x43')]),_0x8504d4);if(_0x39bb4f[_0x90ae('0x41')]['filter']){_0x4a4c22[_0x90ae('0x4b')]=_[_0x90ae('0x4c')](_0x4a4c22[_0x90ae('0x4b')],{'$or':_[_0x90ae('0x3c')](_0x8504d4,function(_0x1491a1){if(_0x1491a1['type']!=='VIRTUAL'){var _0x209851={};_0x209851[_0x1491a1[_0x90ae('0x3a')]]={'$like':'%'+_0x39bb4f['query'][_0x90ae('0x4d')]+'%'};return _0x209851;}})});}_0x4a4c22=_[_0x90ae('0x4c')]({},_0x4a4c22,_0x39bb4f[_0x90ae('0x4e')]);var _0x19a581={'where':_0x4a4c22['where']};return db['FreshsalesConfiguration'][_0x90ae('0x2e')](_0x19a581)[_0x90ae('0x22')](function(_0x7005c1){_0x43106d[_0x90ae('0x2e')]=_0x7005c1;if(_0x39bb4f['query'][_0x90ae('0x4f')]){_0x4a4c22[_0x90ae('0x50')]=[{'all':!![]}];}return db[_0x90ae('0x51')][_0x90ae('0x52')](_0x4a4c22);})[_0x90ae('0x22')](function(_0x5b059c){_0x43106d[_0x90ae('0x53')]=_0x5b059c;return _0x43106d;})[_0x90ae('0x22')](respondWithFilteredResult(_0x4b16d5,_0x4a4c22))[_0x90ae('0x54')](handleError(_0x4b16d5,null));};exports[_0x90ae('0x55')]=function(_0x48f3cf,_0x1c0195){var _0x41f311={'raw':![],'where':{'id':_0x48f3cf[_0x90ae('0x56')]['id']}},_0x272455={};_0x272455[_0x90ae('0x40')]=_['keys'](db[_0x90ae('0x51')][_0x90ae('0x3d')]);_0x272455[_0x90ae('0x41')]=_[_0x90ae('0x42')](_0x48f3cf[_0x90ae('0x41')]);_0x272455[_0x90ae('0x43')]=_[_0x90ae('0x44')](_0x272455[_0x90ae('0x40')],_0x272455[_0x90ae('0x41')]);_0x41f311['attributes']=_['intersection'](_0x272455[_0x90ae('0x40')],qs[_0x90ae('0x46')](_0x48f3cf['query']['fields']));_0x41f311['attributes']=_0x41f311['attributes'][_0x90ae('0x47')]?_0x41f311[_0x90ae('0x45')]:_0x272455['model'];if(_0x48f3cf[_0x90ae('0x41')][_0x90ae('0x4f')]){_0x41f311['include']=[{'all':!![]}];}_0x41f311=_[_0x90ae('0x4c')]({},_0x41f311,_0x48f3cf['options']);return db['FreshsalesConfiguration'][_0x90ae('0x57')](_0x41f311)[_0x90ae('0x22')](handleEntityNotFound(_0x1c0195,null))['then'](respondWithResult(_0x1c0195,null))[_0x90ae('0x54')](handleError(_0x1c0195,null));};exports[_0x90ae('0x58')]=function(_0x5a037c,_0x2646f4){return db['FreshsalesConfiguration']['create'](_0x5a037c[_0x90ae('0x59')],{})[_0x90ae('0x22')](respondWithResult(_0x2646f4,0xc9))[_0x90ae('0x54')](handleError(_0x2646f4,null));};exports[_0x90ae('0x35')]=function(_0x23e98d,_0x4c53d9){if(_0x23e98d[_0x90ae('0x59')]['id']){delete _0x23e98d[_0x90ae('0x59')]['id'];}return db[_0x90ae('0x51')]['find']({'where':{'id':_0x23e98d[_0x90ae('0x56')]['id']}})[_0x90ae('0x22')](handleEntityNotFound(_0x4c53d9,null))[_0x90ae('0x22')](saveUpdates(_0x23e98d[_0x90ae('0x59')],null))['then'](respondWithResult(_0x4c53d9,null))['catch'](handleError(_0x4c53d9,null));};exports[_0x90ae('0x36')]=function(_0x16234c,_0x2dccfe){return db[_0x90ae('0x51')][_0x90ae('0x57')]({'where':{'id':_0x16234c[_0x90ae('0x56')]['id']}})[_0x90ae('0x22')](handleEntityNotFound(_0x2dccfe,null))[_0x90ae('0x22')](removeEntity(_0x2dccfe,null))[_0x90ae('0x54')](handleError(_0x2dccfe,null));};exports[_0x90ae('0x5a')]=function(_0x1cec4c,_0x37b739,_0x22bcd9){var _0x1cfb95={};var _0x2415c2={};var _0x2575c3;var _0x1ba9de;return db['FreshsalesConfiguration'][_0x90ae('0x5b')]({'where':{'id':_0x1cec4c[_0x90ae('0x56')]['id']}})[_0x90ae('0x22')](handleEntityNotFound(_0x37b739,null))[_0x90ae('0x22')](function(_0xd0aa5a){if(_0xd0aa5a){_0x2575c3=_0xd0aa5a;_0x2415c2[_0x90ae('0x40')]=_[_0x90ae('0x42')](db[_0x90ae('0x5c')][_0x90ae('0x3d')]);_0x2415c2[_0x90ae('0x41')]=_['keys'](_0x1cec4c['query']);_0x2415c2[_0x90ae('0x43')]=_[_0x90ae('0x44')](_0x2415c2[_0x90ae('0x40')],_0x2415c2[_0x90ae('0x41')]);_0x1cfb95[_0x90ae('0x45')]=_[_0x90ae('0x44')](_0x2415c2[_0x90ae('0x40')],qs[_0x90ae('0x46')](_0x1cec4c[_0x90ae('0x41')][_0x90ae('0x46')]));_0x1cfb95['attributes']=_0x1cfb95['attributes']['length']?_0x1cfb95['attributes']:_0x2415c2['model'];_0x1cfb95[_0x90ae('0x4a')]=qs[_0x90ae('0x5d')](_0x1cec4c['query'][_0x90ae('0x5d')]);_0x1cfb95['where']=qs['filters'](_[_0x90ae('0x5e')](_0x1cec4c[_0x90ae('0x41')],_0x2415c2[_0x90ae('0x43')]));if(_0x1cec4c[_0x90ae('0x41')][_0x90ae('0x4d')]){_0x1cfb95[_0x90ae('0x4b')]=_[_0x90ae('0x4c')](_0x1cfb95[_0x90ae('0x4b')],{'$or':_['map'](_0x1cfb95[_0x90ae('0x45')],function(_0x3e43c0){var _0x5c6558={};_0x5c6558[_0x3e43c0]={'$like':'%'+_0x1cec4c[_0x90ae('0x41')]['filter']+'%'};return _0x5c6558;})});}_0x1cfb95=_[_0x90ae('0x4c')]({},_0x1cfb95,_0x1cec4c[_0x90ae('0x4e')]);return _0x2575c3['getSubjects'](_0x1cfb95);}})[_0x90ae('0x22')](function(_0x521fcd){if(_0x521fcd){_0x1ba9de=_0x521fcd[_0x90ae('0x47')];if(!_0x1cec4c[_0x90ae('0x41')]['hasOwnProperty']('nolimit')){_0x1cfb95[_0x90ae('0x30')]=qs[_0x90ae('0x30')](_0x1cec4c['query']['limit']);_0x1cfb95[_0x90ae('0x2f')]=qs[_0x90ae('0x2f')](_0x1cec4c[_0x90ae('0x41')]['offset']);}return _0x2575c3[_0x90ae('0x5a')](_0x1cfb95);}})['then'](function(_0x283001){if(_0x283001){return _0x283001?{'count':_0x1ba9de,'rows':_0x283001}:null;}})[_0x90ae('0x22')](respondWithResult(_0x37b739,null))[_0x90ae('0x54')](handleError(_0x37b739,null));};exports[_0x90ae('0x5f')]=function(_0x4e23c3,_0x21469f,_0x4aa482){var _0x43858e={};var _0x625e40={};var _0x5ca005;var _0x51e3ce;return db[_0x90ae('0x51')]['findOne']({'where':{'id':_0x4e23c3[_0x90ae('0x56')]['id']}})[_0x90ae('0x22')](handleEntityNotFound(_0x21469f,null))['then'](function(_0x2dad94){if(_0x2dad94){_0x5ca005=_0x2dad94;_0x625e40[_0x90ae('0x40')]=_['keys'](db['FreshsalesField'][_0x90ae('0x3d')]);_0x625e40[_0x90ae('0x41')]=_[_0x90ae('0x42')](_0x4e23c3['query']);_0x625e40['filters']=_[_0x90ae('0x44')](_0x625e40['model'],_0x625e40[_0x90ae('0x41')]);_0x43858e[_0x90ae('0x45')]=_[_0x90ae('0x44')](_0x625e40[_0x90ae('0x40')],qs['fields'](_0x4e23c3[_0x90ae('0x41')][_0x90ae('0x46')]));_0x43858e[_0x90ae('0x45')]=_0x43858e[_0x90ae('0x45')][_0x90ae('0x47')]?_0x43858e[_0x90ae('0x45')]:_0x625e40[_0x90ae('0x40')];_0x43858e[_0x90ae('0x4a')]=qs[_0x90ae('0x5d')](_0x4e23c3['query'][_0x90ae('0x5d')]);_0x43858e['where']=qs['filters'](_['pick'](_0x4e23c3[_0x90ae('0x41')],_0x625e40[_0x90ae('0x43')]));if(_0x4e23c3[_0x90ae('0x41')][_0x90ae('0x4d')]){_0x43858e[_0x90ae('0x4b')]=_[_0x90ae('0x4c')](_0x43858e[_0x90ae('0x4b')],{'$or':_['map'](_0x43858e[_0x90ae('0x45')],function(_0x5176a0){var _0x7f4d6b={};_0x7f4d6b[_0x5176a0]={'$like':'%'+_0x4e23c3[_0x90ae('0x41')][_0x90ae('0x4d')]+'%'};return _0x7f4d6b;})});}_0x43858e=_[_0x90ae('0x4c')]({},_0x43858e,_0x4e23c3[_0x90ae('0x4e')]);return _0x5ca005['getDescriptions'](_0x43858e);}})[_0x90ae('0x22')](function(_0x401185){if(_0x401185){_0x51e3ce=_0x401185[_0x90ae('0x47')];if(!_0x4e23c3[_0x90ae('0x41')][_0x90ae('0x48')](_0x90ae('0x49'))){_0x43858e[_0x90ae('0x30')]=qs[_0x90ae('0x30')](_0x4e23c3[_0x90ae('0x41')][_0x90ae('0x30')]);_0x43858e[_0x90ae('0x2f')]=qs[_0x90ae('0x2f')](_0x4e23c3[_0x90ae('0x41')][_0x90ae('0x2f')]);}return _0x5ca005[_0x90ae('0x5f')](_0x43858e);}})[_0x90ae('0x22')](function(_0x33a9eb){if(_0x33a9eb){return _0x33a9eb?{'count':_0x51e3ce,'rows':_0x33a9eb}:null;}})['then'](respondWithResult(_0x21469f,null))[_0x90ae('0x54')](handleError(_0x21469f,null));};exports[_0x90ae('0x60')]=function(_0x2c5bbe,_0x197d00,_0x359253){var _0xad981a={};var _0x37034b={};var _0x6f485a;var _0x25e911;return db[_0x90ae('0x51')][_0x90ae('0x5b')]({'where':{'id':_0x2c5bbe[_0x90ae('0x56')]['id']}})['then'](handleEntityNotFound(_0x197d00,null))['then'](function(_0x132a09){if(_0x132a09){_0x6f485a=_0x132a09;_0x37034b[_0x90ae('0x40')]=_[_0x90ae('0x42')](db['FreshsalesField'][_0x90ae('0x3d')]);_0x37034b['query']=_['keys'](_0x2c5bbe[_0x90ae('0x41')]);_0x37034b[_0x90ae('0x43')]=_[_0x90ae('0x44')](_0x37034b[_0x90ae('0x40')],_0x37034b[_0x90ae('0x41')]);_0xad981a[_0x90ae('0x45')]=_[_0x90ae('0x44')](_0x37034b[_0x90ae('0x40')],qs[_0x90ae('0x46')](_0x2c5bbe[_0x90ae('0x41')][_0x90ae('0x46')]));_0xad981a['attributes']=_0xad981a[_0x90ae('0x45')][_0x90ae('0x47')]?_0xad981a[_0x90ae('0x45')]:_0x37034b['model'];_0xad981a[_0x90ae('0x4a')]=qs['sort'](_0x2c5bbe[_0x90ae('0x41')]['sort']);_0xad981a[_0x90ae('0x4b')]=qs[_0x90ae('0x43')](_[_0x90ae('0x5e')](_0x2c5bbe[_0x90ae('0x41')],_0x37034b[_0x90ae('0x43')]));if(_0x2c5bbe[_0x90ae('0x41')][_0x90ae('0x4d')]){_0xad981a[_0x90ae('0x4b')]=_[_0x90ae('0x4c')](_0xad981a[_0x90ae('0x4b')],{'$or':_[_0x90ae('0x3c')](_0xad981a['attributes'],function(_0x5b4362){var _0x57aa46={};_0x57aa46[_0x5b4362]={'$like':'%'+_0x2c5bbe['query'][_0x90ae('0x4d')]+'%'};return _0x57aa46;})});}_0xad981a=_[_0x90ae('0x4c')]({},_0xad981a,_0x2c5bbe[_0x90ae('0x4e')]);return _0x6f485a[_0x90ae('0x60')](_0xad981a);}})[_0x90ae('0x22')](function(_0x2c3ea7){if(_0x2c3ea7){_0x25e911=_0x2c3ea7[_0x90ae('0x47')];if(!_0x2c5bbe[_0x90ae('0x41')][_0x90ae('0x48')]('nolimit')){_0xad981a[_0x90ae('0x30')]=qs[_0x90ae('0x30')](_0x2c5bbe[_0x90ae('0x41')][_0x90ae('0x30')]);_0xad981a['offset']=qs[_0x90ae('0x2f')](_0x2c5bbe['query'][_0x90ae('0x2f')]);}return _0x6f485a[_0x90ae('0x60')](_0xad981a);}})[_0x90ae('0x22')](function(_0x5c4667){if(_0x5c4667){return _0x5c4667?{'count':_0x25e911,'rows':_0x5c4667}:null;}})['then'](respondWithResult(_0x197d00,null))[_0x90ae('0x54')](handleError(_0x197d00,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index dabe7f4..e8ebaed 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 _0x28b1=['rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0x28b1,0x1aa));var _0x128b=function(_0xcfeef8,_0x23ab04){_0xcfeef8=_0xcfeef8-0x0;var _0x336590=_0x28b1[_0xcfeef8];return _0x336590;};'use strict';var _=require('lodash');var util=require(_0x128b('0x0'));var logger=require(_0x128b('0x1'))(_0x128b('0x2'));var moment=require(_0x128b('0x3'));var BPromise=require(_0x128b('0x4'));var rp=require(_0x128b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x128b('0x6'));var config=require('../../config/environment');var attributes=require(_0x128b('0x7'));module[_0x128b('0x8')]=function(_0x445591,_0x5c0310){return _0x445591[_0x128b('0x9')](_0x128b('0xa'),attributes,{'tableName':_0x128b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7017=['int_freshsales_configurations','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x3acb89,_0x2ca05e){var _0x4d38f2=function(_0x4cb6a9){while(--_0x4cb6a9){_0x3acb89['push'](_0x3acb89['shift']());}};_0x4d38f2(++_0x2ca05e);}(_0x7017,0x76));var _0x7701=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7017[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x7701('0x0'));var logger=require(_0x7701('0x1'))(_0x7701('0x2'));var moment=require('moment');var BPromise=require(_0x7701('0x3'));var rp=require(_0x7701('0x4'));var fs=require('fs');var path=require(_0x7701('0x5'));var rimraf=require(_0x7701('0x6'));var config=require(_0x7701('0x7'));var attributes=require(_0x7701('0x8'));module[_0x7701('0x9')]=function(_0x354e5d,_0x46ebf2){return _0x354e5d[_0x7701('0xa')](_0x7701('0xb'),attributes,{'tableName':_0x7701('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index f961e5c..cf261e2 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 _0xf958=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x25358e,_0x5dbb99){var _0x4f1f32=function(_0xd209a3){while(--_0xd209a3){_0x25358e['push'](_0x25358e['shift']());}};_0x4f1f32(++_0x5dbb99);}(_0xf958,0xe6));var _0x8f95=function(_0xbb62f,_0x319198){_0xbb62f=_0xbb62f-0x0;var _0x230d12=_0xf958[_0xbb62f];return _0x230d12;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c2af8,_0x5cfc04,_0x1ae9c4){return new BPromise(function(_0x109bed,_0x435b5b){return client[_0x8f95('0x9')](_0x5c2af8,_0x1ae9c4)[_0x8f95('0xa')](function(_0x585025){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5cfc04,'request\x20sent');logger[_0x8f95('0xd')](_0x8f95('0xe'),_0x5cfc04,_0x8f95('0xf'),JSON['stringify'](_0x585025));if(_0x585025[_0x8f95('0x10')]){if(_0x585025[_0x8f95('0x10')][_0x8f95('0x11')]===0x1f4){logger['error'](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x435b5b(_0x585025['error'][_0x8f95('0x12')]);}logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x109bed(_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5cfc04,'request\x20sent');_0x109bed(_0x585025['result']['message']);}})[_0x8f95('0x13')](function(_0x2f01cd){logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x2f01cd);_0x435b5b(_0x2f01cd);});});} \ No newline at end of file +var _0x8c38=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x8c38,0x83));var _0x88c3=function(_0x198f04,_0x3b90ed){_0x198f04=_0x198f04-0x0;var _0x192415=_0x8c38[_0x198f04];return _0x192415;};'use strict';var _=require(_0x88c3('0x0'));var util=require(_0x88c3('0x1'));var moment=require('moment');var BPromise=require(_0x88c3('0x2'));var rs=require(_0x88c3('0x3'));var fs=require('fs');var Redis=require(_0x88c3('0x4'));var db=require(_0x88c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c3('0x6'))(_0x88c3('0x7'));var config=require(_0x88c3('0x8'));var jayson=require(_0x88c3('0x9'));var client=jayson[_0x88c3('0xa')][_0x88c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcdbc28,_0x25e385,_0x5020c9){return new BPromise(function(_0x350a11,_0x4efd63){return client[_0x88c3('0xc')](_0xcdbc28,_0x5020c9)['then'](function(_0x760391){logger['info'](_0x88c3('0xd'),_0x25e385,_0x88c3('0xe'));logger[_0x88c3('0xf')](_0x88c3('0x10'),_0x25e385,'request\x20sent',JSON[_0x88c3('0x11')](_0x760391));if(_0x760391[_0x88c3('0x12')]){if(_0x760391[_0x88c3('0x12')]['code']===0x1f4){logger[_0x88c3('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x25e385,_0x760391['error'][_0x88c3('0x13')]);return _0x4efd63(_0x760391[_0x88c3('0x12')][_0x88c3('0x13')]);}logger[_0x88c3('0x12')](_0x88c3('0xd'),_0x25e385,_0x760391['error'][_0x88c3('0x13')]);return _0x350a11(_0x760391[_0x88c3('0x12')][_0x88c3('0x13')]);}else{logger[_0x88c3('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x25e385,_0x88c3('0xe'));_0x350a11(_0x760391['result'][_0x88c3('0x13')]);}})[_0x88c3('0x15')](function(_0x26019e){logger[_0x88c3('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x25e385,_0x26019e);_0x4efd63(_0x26019e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 07390bb..22f2779 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 _0x935f=['update','destroy','util','path','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3fe520,_0x4e4f2c){var _0x4ab8c0=function(_0x1962cc){while(--_0x1962cc){_0x3fe520['push'](_0x3fe520['shift']());}};_0x4ab8c0(++_0x4e4f2c);}(_0x935f,0x84));var _0xf935=function(_0x247029,_0xb92a74){_0x247029=_0x247029-0x0;var _0x21297d=_0x935f[_0x247029];return _0x21297d;};'use strict';var multer=require('multer');var util=require(_0xf935('0x0'));var path=require(_0xf935('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf935('0x2')]();var auth=require(_0xf935('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf935('0x4'));var controller=require(_0xf935('0x5'));router[_0xf935('0x6')]('/',auth[_0xf935('0x7')](),controller[_0xf935('0x8')]);router[_0xf935('0x6')](_0xf935('0x9'),auth[_0xf935('0x7')](),controller[_0xf935('0xa')]);router['post']('/',auth[_0xf935('0x7')](),controller['create']);router['put'](_0xf935('0x9'),auth[_0xf935('0x7')](),controller[_0xf935('0xb')]);router['delete'](_0xf935('0x9'),auth[_0xf935('0x7')](),controller[_0xf935('0xc')]);module['exports']=router; \ No newline at end of file +var _0xa663=['create','put','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x5cf8a7,_0x2da367){var _0x57f03f=function(_0x33dcc8){while(--_0x33dcc8){_0x5cf8a7['push'](_0x5cf8a7['shift']());}};_0x57f03f(++_0x2da367);}(_0xa663,0x188));var _0x3a66=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0xa663[_0x195c21];return _0x3576a8;};'use strict';var multer=require(_0x3a66('0x0'));var util=require('util');var path=require(_0x3a66('0x1'));var timeout=require(_0x3a66('0x2'));var express=require(_0x3a66('0x3'));var router=express[_0x3a66('0x4')]();var auth=require(_0x3a66('0x5'));var interaction=require(_0x3a66('0x6'));var config=require(_0x3a66('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x3a66('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3a66('0x8')](_0x3a66('0x9'),auth[_0x3a66('0xa')](),controller[_0x3a66('0xb')]);router[_0x3a66('0xc')]('/',auth[_0x3a66('0xa')](),controller[_0x3a66('0xd')]);router[_0x3a66('0xe')](_0x3a66('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3a66('0x9'),auth[_0x3a66('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 764a620..1aca45c 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 _0x56ff=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3b3a81,_0x45f077){var _0xf6d3fd=function(_0x46428c){while(--_0x46428c){_0x3b3a81['push'](_0x3b3a81['shift']());}};_0xf6d3fd(++_0x45f077);}(_0x56ff,0xb9));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf56f('0x0'));module[_0xf56f('0x1')]={'type':{'type':Sequelize[_0xf56f('0x2')](_0xf56f('0x3'),_0xf56f('0x4'),_0xf56f('0x5'),_0xf56f('0x6')),'defaultValue':_0xf56f('0x3')},'content':{'type':Sequelize[_0xf56f('0x7')]},'key':{'type':Sequelize[_0xf56f('0x7')]},'keyType':{'type':Sequelize[_0xf56f('0x2')](_0xf56f('0x3'),'variable',_0xf56f('0x5'))},'keyContent':{'type':Sequelize[_0xf56f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf56f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf56f('0x7')]}}; \ No newline at end of file +var _0xc8e9=['keyValue','STRING','string','variable','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x4141b1,_0x10dcd1){var _0x5d5a51=function(_0x525940){while(--_0x525940){_0x4141b1['push'](_0x4141b1['shift']());}};_0x5d5a51(++_0x10dcd1);}(_0xc8e9,0x1d6));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9c8e('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c8e('0x1')]('string','variable','customVariable',_0x9c8e('0x2')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9c8e('0x3')]},'keyType':{'type':Sequelize[_0x9c8e('0x1')](_0x9c8e('0x4'),_0x9c8e('0x5'),_0x9c8e('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9c8e('0x3')]},'nameField':{'type':Sequelize[_0x9c8e('0x3')]},'customField':{'type':Sequelize[_0x9c8e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f4717be..b2b8dc9 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 _0xc8e8=['fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','map','FreshsalesField','rawAttributes'];(function(_0xd1368e,_0x3f9d19){var _0x1ce149=function(_0x46d1cb){while(--_0x46d1cb){_0xd1368e['push'](_0xd1368e['shift']());}};_0x1ce149(++_0x3f9d19);}(_0xc8e8,0xac));var _0x8c8e=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xc8e8[_0x50a004];return _0x5e9992;};'use strict';var pdf=require(_0x8c8e('0x0'));var emlformat=require(_0x8c8e('0x1'));var rimraf=require(_0x8c8e('0x2'));var zipdir=require(_0x8c8e('0x3'));var jsonpatch=require(_0x8c8e('0x4'));var rp=require('request-promise');var moment=require(_0x8c8e('0x5'));var BPromise=require(_0x8c8e('0x6'));var Mustache=require(_0x8c8e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8c8e('0x8'));var csv=require(_0x8c8e('0x9'));var ejs=require(_0x8c8e('0xa'));var fs=require('fs');var _=require(_0x8c8e('0xb'));var squel=require('squel');var crypto=require(_0x8c8e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c8e('0xd'));var toCsv=require(_0x8c8e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c8e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8c8e('0xf'));var as=require(_0x8c8e('0x10'));var hardwareService=require(_0x8c8e('0x11'));var logger=require(_0x8c8e('0x12'))(_0x8c8e('0x13'));var utils=require('../../config/utils');var config=require(_0x8c8e('0x14'));var db=require(_0x8c8e('0x15'))['db'];function respondWithStatusCode(_0x35c1b6,_0x491ee6){_0x491ee6=_0x491ee6||0xcc;return function(_0x46b8df){if(_0x46b8df){return _0x35c1b6['sendStatus'](_0x491ee6);}return _0x35c1b6[_0x8c8e('0x16')](_0x491ee6)[_0x8c8e('0x17')]();};}function respondWithResult(_0x1bbc5f,_0x22b957){_0x22b957=_0x22b957||0xc8;return function(_0x485098){if(_0x485098){return _0x1bbc5f[_0x8c8e('0x16')](_0x22b957)['json'](_0x485098);}};}function respondWithFilteredResult(_0x2f6e8d,_0x4cc28f){return function(_0x15059c){if(_0x15059c){var _0x26aeba=_0x15059c[_0x8c8e('0x18')],_0x404da5=_0x4cc28f[_0x8c8e('0x19')],_0x4d35ad=_0x4cc28f[_0x8c8e('0x19')]+_0x4cc28f[_0x8c8e('0x1a')],_0x2eec09;if(_0x4d35ad>=_0x26aeba){_0x4d35ad=_0x26aeba;_0x2eec09=0xc8;}else{_0x2eec09=0xce;}_0x2f6e8d['status'](_0x2eec09);return _0x2f6e8d['set'](_0x8c8e('0x1b'),_0x404da5+'-'+_0x4d35ad+'/'+_0x26aeba)[_0x8c8e('0x1c')](_0x15059c);}return null;};}function patchUpdates(_0x18696f){return function(_0x26b4ca){try{jsonpatch[_0x8c8e('0x1d')](_0x26b4ca,_0x18696f,!![]);}catch(_0x260c4f){return BPromise[_0x8c8e('0x1e')](_0x260c4f);}return _0x26b4ca[_0x8c8e('0x1f')]();};}function saveUpdates(_0x13d842,_0x5b9b38){return function(_0x3a9c13){if(_0x3a9c13){return _0x3a9c13[_0x8c8e('0x20')](_0x13d842)[_0x8c8e('0x21')](function(_0x327dbb){return _0x327dbb;});}return null;};}function removeEntity(_0x4ef5c0,_0xf28894){return function(_0x42b615){if(_0x42b615){return _0x42b615['destroy']()[_0x8c8e('0x21')](function(){_0x4ef5c0[_0x8c8e('0x16')](0xcc)[_0x8c8e('0x17')]();});}};}function handleEntityNotFound(_0x11b122,_0x23e4cb){return function(_0x5e7b5e){if(!_0x5e7b5e){_0x11b122[_0x8c8e('0x22')](0x194);}return _0x5e7b5e;};}function handleError(_0x2147e2,_0x24ee2d){_0x24ee2d=_0x24ee2d||0x1f4;return function(_0x1cc759){logger[_0x8c8e('0x23')](_0x1cc759[_0x8c8e('0x24')]);if(_0x1cc759[_0x8c8e('0x25')]){delete _0x1cc759[_0x8c8e('0x25')];}_0x2147e2[_0x8c8e('0x16')](_0x24ee2d)['send'](_0x1cc759);};}exports['index']=function(_0x18135f,_0xb63f03){var _0x216749={},_0x1f97a7={},_0x410d26={'count':0x0,'rows':[]};var _0x1bfb39=_[_0x8c8e('0x26')](db[_0x8c8e('0x27')][_0x8c8e('0x28')],function(_0x294dc4){return{'name':_0x294dc4[_0x8c8e('0x29')],'type':_0x294dc4[_0x8c8e('0x2a')][_0x8c8e('0x2b')]};});_0x1f97a7[_0x8c8e('0x2c')]=_[_0x8c8e('0x26')](_0x1bfb39,'name');_0x1f97a7[_0x8c8e('0x2d')]=_[_0x8c8e('0x2e')](_0x18135f['query']);_0x1f97a7['filters']=_['intersection'](_0x1f97a7['model'],_0x1f97a7['query']);_0x216749['attributes']=_['intersection'](_0x1f97a7[_0x8c8e('0x2c')],qs[_0x8c8e('0x2f')](_0x18135f[_0x8c8e('0x2d')]['fields']));_0x216749[_0x8c8e('0x30')]=_0x216749[_0x8c8e('0x30')][_0x8c8e('0x31')]?_0x216749[_0x8c8e('0x30')]:_0x1f97a7['model'];if(!_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x32')]('nolimit')){_0x216749[_0x8c8e('0x1a')]=qs[_0x8c8e('0x1a')](_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x1a')]);_0x216749[_0x8c8e('0x19')]=qs[_0x8c8e('0x19')](_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x19')]);}_0x216749[_0x8c8e('0x33')]=qs[_0x8c8e('0x34')](_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x34')]);_0x216749[_0x8c8e('0x35')]=qs[_0x8c8e('0x36')](_[_0x8c8e('0x37')](_0x18135f[_0x8c8e('0x2d')],_0x1f97a7[_0x8c8e('0x36')]),_0x1bfb39);if(_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x38')]){_0x216749['where']=_[_0x8c8e('0x39')](_0x216749[_0x8c8e('0x35')],{'$or':_[_0x8c8e('0x26')](_0x1bfb39,function(_0x5c94bb){if(_0x5c94bb['type']!=='VIRTUAL'){var _0x3d6d3f={};_0x3d6d3f[_0x5c94bb[_0x8c8e('0x25')]]={'$like':'%'+_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x38')]+'%'};return _0x3d6d3f;}})});}_0x216749=_[_0x8c8e('0x39')]({},_0x216749,_0x18135f[_0x8c8e('0x3a')]);var _0x83deaf={'where':_0x216749[_0x8c8e('0x35')]};return db['FreshsalesField'][_0x8c8e('0x18')](_0x83deaf)[_0x8c8e('0x21')](function(_0x30bb67){_0x410d26[_0x8c8e('0x18')]=_0x30bb67;if(_0x18135f['query'][_0x8c8e('0x3b')]){_0x216749[_0x8c8e('0x3c')]=[{'all':!![]}];}return db[_0x8c8e('0x27')][_0x8c8e('0x3d')](_0x216749);})['then'](function(_0x147651){_0x410d26[_0x8c8e('0x3e')]=_0x147651;return _0x410d26;})['then'](respondWithFilteredResult(_0xb63f03,_0x216749))['catch'](handleError(_0xb63f03,null));};exports[_0x8c8e('0x3f')]=function(_0xea4444,_0x4a232e){var _0x3c4599={'raw':!![],'where':{'id':_0xea4444['params']['id']}},_0x40f788={};_0x40f788[_0x8c8e('0x2c')]=_[_0x8c8e('0x2e')](db[_0x8c8e('0x27')][_0x8c8e('0x28')]);_0x40f788[_0x8c8e('0x2d')]=_[_0x8c8e('0x2e')](_0xea4444['query']);_0x40f788['filters']=_[_0x8c8e('0x40')](_0x40f788[_0x8c8e('0x2c')],_0x40f788['query']);_0x3c4599[_0x8c8e('0x30')]=_[_0x8c8e('0x40')](_0x40f788['model'],qs[_0x8c8e('0x2f')](_0xea4444[_0x8c8e('0x2d')][_0x8c8e('0x2f')]));_0x3c4599[_0x8c8e('0x30')]=_0x3c4599[_0x8c8e('0x30')][_0x8c8e('0x31')]?_0x3c4599['attributes']:_0x40f788['model'];if(_0xea4444[_0x8c8e('0x2d')]['includeAll']){_0x3c4599[_0x8c8e('0x3c')]=[{'all':!![]}];}_0x3c4599=_['merge']({},_0x3c4599,_0xea4444['options']);return db[_0x8c8e('0x27')][_0x8c8e('0x41')](_0x3c4599)[_0x8c8e('0x21')](handleEntityNotFound(_0x4a232e,null))[_0x8c8e('0x21')](respondWithResult(_0x4a232e,null))[_0x8c8e('0x42')](handleError(_0x4a232e,null));};exports['create']=function(_0x31542a,_0xd5246){return db[_0x8c8e('0x27')][_0x8c8e('0x43')](_0x31542a[_0x8c8e('0x44')],{})[_0x8c8e('0x21')](respondWithResult(_0xd5246,0xc9))[_0x8c8e('0x42')](handleError(_0xd5246,null));};exports[_0x8c8e('0x20')]=function(_0x11a6cf,_0x5cfa57){if(_0x11a6cf[_0x8c8e('0x44')]['id']){delete _0x11a6cf[_0x8c8e('0x44')]['id'];}return db['FreshsalesField'][_0x8c8e('0x41')]({'where':{'id':_0x11a6cf['params']['id']}})[_0x8c8e('0x21')](handleEntityNotFound(_0x5cfa57,null))['then'](saveUpdates(_0x11a6cf[_0x8c8e('0x44')],null))[_0x8c8e('0x21')](respondWithResult(_0x5cfa57,null))[_0x8c8e('0x42')](handleError(_0x5cfa57,null));};exports[_0x8c8e('0x45')]=function(_0x4cf2d3,_0xce6ac3){return db[_0x8c8e('0x27')]['find']({'where':{'id':_0x4cf2d3[_0x8c8e('0x46')]['id']}})['then'](handleEntityNotFound(_0xce6ac3,null))[_0x8c8e('0x21')](removeEntity(_0xce6ac3,null))[_0x8c8e('0x42')](handleError(_0xce6ac3,null));}; \ No newline at end of file +var _0x4f99=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName'];(function(_0x37f184,_0x13ed3c){var _0x26e39f=function(_0x41a821){while(--_0x41a821){_0x37f184['push'](_0x37f184['shift']());}};_0x26e39f(++_0x13ed3c);}(_0x4f99,0x67));var _0x94f9=function(_0x3f8b73,_0x4c772e){_0x3f8b73=_0x3f8b73-0x0;var _0x38cbf6=_0x4f99[_0x3f8b73];return _0x38cbf6;};'use strict';var pdf=require(_0x94f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94f9('0x1'));var zipdir=require(_0x94f9('0x2'));var jsonpatch=require(_0x94f9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x94f9('0x4'));var Mustache=require(_0x94f9('0x5'));var util=require(_0x94f9('0x6'));var path=require(_0x94f9('0x7'));var sox=require(_0x94f9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x94f9('0x9'));var squel=require(_0x94f9('0xa'));var crypto=require(_0x94f9('0xb'));var jsforce=require(_0x94f9('0xc'));var deskjs=require(_0x94f9('0xd'));var toCsv=require(_0x94f9('0xe'));var querystring=require(_0x94f9('0xf'));var Papa=require(_0x94f9('0x10'));var Redis=require('ioredis');var authService=require(_0x94f9('0x11'));var qs=require(_0x94f9('0x12'));var as=require(_0x94f9('0x13'));var hardwareService=require(_0x94f9('0x14'));var logger=require(_0x94f9('0x15'))(_0x94f9('0x16'));var utils=require(_0x94f9('0x17'));var config=require(_0x94f9('0x18'));var db=require(_0x94f9('0x19'))['db'];function respondWithStatusCode(_0x16025d,_0x1932d9){_0x1932d9=_0x1932d9||0xcc;return function(_0x5a8165){if(_0x5a8165){return _0x16025d['sendStatus'](_0x1932d9);}return _0x16025d[_0x94f9('0x1a')](_0x1932d9)[_0x94f9('0x1b')]();};}function respondWithResult(_0x578818,_0x419eca){_0x419eca=_0x419eca||0xc8;return function(_0x4403de){if(_0x4403de){return _0x578818[_0x94f9('0x1a')](_0x419eca)[_0x94f9('0x1c')](_0x4403de);}};}function respondWithFilteredResult(_0xe3d51,_0x582321){return function(_0x16e04d){if(_0x16e04d){var _0x272942=_0x16e04d['count'],_0x508c5f=_0x582321['offset'],_0x11fd0b=_0x582321[_0x94f9('0x1d')]+_0x582321[_0x94f9('0x1e')],_0x593931;if(_0x11fd0b>=_0x272942){_0x11fd0b=_0x272942;_0x593931=0xc8;}else{_0x593931=0xce;}_0xe3d51[_0x94f9('0x1a')](_0x593931);return _0xe3d51[_0x94f9('0x1f')](_0x94f9('0x20'),_0x508c5f+'-'+_0x11fd0b+'/'+_0x272942)['json'](_0x16e04d);}return null;};}function patchUpdates(_0x2dfdef){return function(_0x5128d2){try{jsonpatch[_0x94f9('0x21')](_0x5128d2,_0x2dfdef,!![]);}catch(_0x1ac6dc){return BPromise['reject'](_0x1ac6dc);}return _0x5128d2['save']();};}function saveUpdates(_0x2c6b9f,_0x21e301){return function(_0xb257c7){if(_0xb257c7){return _0xb257c7[_0x94f9('0x22')](_0x2c6b9f)[_0x94f9('0x23')](function(_0x34b5cb){return _0x34b5cb;});}return null;};}function removeEntity(_0x20c7af,_0x45ddde){return function(_0x3372c4){if(_0x3372c4){return _0x3372c4[_0x94f9('0x24')]()[_0x94f9('0x23')](function(){_0x20c7af[_0x94f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f4f72,_0x557d90){return function(_0x248a51){if(!_0x248a51){_0x9f4f72['sendStatus'](0x194);}return _0x248a51;};}function handleError(_0x5d74fb,_0x48d6bb){_0x48d6bb=_0x48d6bb||0x1f4;return function(_0xb24254){logger[_0x94f9('0x25')](_0xb24254[_0x94f9('0x26')]);if(_0xb24254[_0x94f9('0x27')]){delete _0xb24254['name'];}_0x5d74fb[_0x94f9('0x1a')](_0x48d6bb)['send'](_0xb24254);};}exports[_0x94f9('0x28')]=function(_0x2227ee,_0x46157f){var _0x5d6e1d={},_0x59e143={},_0x24d28b={'count':0x0,'rows':[]};var _0x3f85f1=_[_0x94f9('0x29')](db[_0x94f9('0x2a')][_0x94f9('0x2b')],function(_0x29b5ba){return{'name':_0x29b5ba[_0x94f9('0x2c')],'type':_0x29b5ba[_0x94f9('0x2d')][_0x94f9('0x2e')]};});_0x59e143[_0x94f9('0x2f')]=_[_0x94f9('0x29')](_0x3f85f1,_0x94f9('0x27'));_0x59e143[_0x94f9('0x30')]=_['keys'](_0x2227ee[_0x94f9('0x30')]);_0x59e143[_0x94f9('0x31')]=_['intersection'](_0x59e143[_0x94f9('0x2f')],_0x59e143['query']);_0x5d6e1d[_0x94f9('0x32')]=_[_0x94f9('0x33')](_0x59e143[_0x94f9('0x2f')],qs[_0x94f9('0x34')](_0x2227ee[_0x94f9('0x30')]['fields']));_0x5d6e1d[_0x94f9('0x32')]=_0x5d6e1d[_0x94f9('0x32')]['length']?_0x5d6e1d[_0x94f9('0x32')]:_0x59e143['model'];if(!_0x2227ee[_0x94f9('0x30')][_0x94f9('0x35')](_0x94f9('0x36'))){_0x5d6e1d['limit']=qs[_0x94f9('0x1e')](_0x2227ee[_0x94f9('0x30')][_0x94f9('0x1e')]);_0x5d6e1d[_0x94f9('0x1d')]=qs['offset'](_0x2227ee[_0x94f9('0x30')][_0x94f9('0x1d')]);}_0x5d6e1d[_0x94f9('0x37')]=qs[_0x94f9('0x38')](_0x2227ee['query'][_0x94f9('0x38')]);_0x5d6e1d[_0x94f9('0x39')]=qs[_0x94f9('0x31')](_[_0x94f9('0x3a')](_0x2227ee[_0x94f9('0x30')],_0x59e143[_0x94f9('0x31')]),_0x3f85f1);if(_0x2227ee[_0x94f9('0x30')][_0x94f9('0x3b')]){_0x5d6e1d[_0x94f9('0x39')]=_[_0x94f9('0x3c')](_0x5d6e1d[_0x94f9('0x39')],{'$or':_[_0x94f9('0x29')](_0x3f85f1,function(_0x40bb62){if(_0x40bb62[_0x94f9('0x2d')]!==_0x94f9('0x3d')){var _0x3d5f91={};_0x3d5f91[_0x40bb62[_0x94f9('0x27')]]={'$like':'%'+_0x2227ee[_0x94f9('0x30')][_0x94f9('0x3b')]+'%'};return _0x3d5f91;}})});}_0x5d6e1d=_['merge']({},_0x5d6e1d,_0x2227ee[_0x94f9('0x3e')]);var _0x12e3e0={'where':_0x5d6e1d[_0x94f9('0x39')]};return db[_0x94f9('0x2a')][_0x94f9('0x3f')](_0x12e3e0)['then'](function(_0x466154){_0x24d28b[_0x94f9('0x3f')]=_0x466154;if(_0x2227ee['query']['includeAll']){_0x5d6e1d[_0x94f9('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x94f9('0x41')](_0x5d6e1d);})[_0x94f9('0x23')](function(_0x5b4dab){_0x24d28b[_0x94f9('0x42')]=_0x5b4dab;return _0x24d28b;})['then'](respondWithFilteredResult(_0x46157f,_0x5d6e1d))[_0x94f9('0x43')](handleError(_0x46157f,null));};exports[_0x94f9('0x44')]=function(_0x40d338,_0xcdfe01){var _0x1e03d2={'raw':!![],'where':{'id':_0x40d338[_0x94f9('0x45')]['id']}},_0x483c5f={};_0x483c5f[_0x94f9('0x2f')]=_[_0x94f9('0x46')](db[_0x94f9('0x2a')]['rawAttributes']);_0x483c5f['query']=_[_0x94f9('0x46')](_0x40d338[_0x94f9('0x30')]);_0x483c5f[_0x94f9('0x31')]=_[_0x94f9('0x33')](_0x483c5f['model'],_0x483c5f[_0x94f9('0x30')]);_0x1e03d2['attributes']=_[_0x94f9('0x33')](_0x483c5f['model'],qs[_0x94f9('0x34')](_0x40d338[_0x94f9('0x30')][_0x94f9('0x34')]));_0x1e03d2[_0x94f9('0x32')]=_0x1e03d2[_0x94f9('0x32')]['length']?_0x1e03d2['attributes']:_0x483c5f[_0x94f9('0x2f')];if(_0x40d338['query']['includeAll']){_0x1e03d2['include']=[{'all':!![]}];}_0x1e03d2=_[_0x94f9('0x3c')]({},_0x1e03d2,_0x40d338['options']);return db['FreshsalesField'][_0x94f9('0x47')](_0x1e03d2)[_0x94f9('0x23')](handleEntityNotFound(_0xcdfe01,null))[_0x94f9('0x23')](respondWithResult(_0xcdfe01,null))[_0x94f9('0x43')](handleError(_0xcdfe01,null));};exports['create']=function(_0x2746b3,_0x54c1f4){return db[_0x94f9('0x2a')][_0x94f9('0x48')](_0x2746b3[_0x94f9('0x49')],{})['then'](respondWithResult(_0x54c1f4,0xc9))[_0x94f9('0x43')](handleError(_0x54c1f4,null));};exports[_0x94f9('0x22')]=function(_0x3614e6,_0x105cfe){if(_0x3614e6[_0x94f9('0x49')]['id']){delete _0x3614e6['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x3614e6[_0x94f9('0x45')]['id']}})[_0x94f9('0x23')](handleEntityNotFound(_0x105cfe,null))['then'](saveUpdates(_0x3614e6['body'],null))[_0x94f9('0x23')](respondWithResult(_0x105cfe,null))[_0x94f9('0x43')](handleError(_0x105cfe,null));};exports['destroy']=function(_0x5032f9,_0x38bdb1){return db[_0x94f9('0x2a')][_0x94f9('0x47')]({'where':{'id':_0x5032f9[_0x94f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bdb1,null))[_0x94f9('0x23')](removeEntity(_0x38bdb1,null))[_0x94f9('0x43')](handleError(_0x38bdb1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 29c5fea..e48828e 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 _0xdac5=['freshsales_unique_index','../../config/logger','api','moment','rimraf','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x36734a,_0xdd12e1){var _0x565da1=function(_0x4e27d3){while(--_0x4e27d3){_0x36734a['push'](_0x36734a['shift']());}};_0x565da1(++_0xdd12e1);}(_0xdac5,0x7f));var _0x5dac=function(_0x2dcd33,_0x3769d8){_0x2dcd33=_0x2dcd33-0x0;var _0x2f0b3a=_0xdac5[_0x2dcd33];return _0x2f0b3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5dac('0x0'))(_0x5dac('0x1'));var moment=require(_0x5dac('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dac('0x3'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x5dac('0x4')]=function(_0x1961bf,_0x188f1a){return _0x1961bf[_0x5dac('0x5')](_0x5dac('0x6'),attributes,{'tableName':_0x5dac('0x7'),'paranoid':![],'indexes':[{'name':_0x5dac('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x186f=['../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x530418,_0x5f4046){var _0x5535d2=function(_0x4ce14d){while(--_0x4ce14d){_0x530418['push'](_0x530418['shift']());}};_0x5535d2(++_0x5f4046);}(_0x186f,0x9d));var _0xf186=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x186f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf186('0x0'));var util=require(_0xf186('0x1'));var logger=require(_0xf186('0x2'))('api');var moment=require(_0xf186('0x3'));var BPromise=require(_0xf186('0x4'));var rp=require(_0xf186('0x5'));var fs=require('fs');var path=require(_0xf186('0x6'));var rimraf=require(_0xf186('0x7'));var config=require(_0xf186('0x8'));var attributes=require(_0xf186('0x9'));module['exports']=function(_0x532514,_0x811370){return _0x532514[_0xf186('0xa')](_0xf186('0xb'),attributes,{'tableName':_0xf186('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf186('0xd'),_0xf186('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 f9ed5d3..d7d0533 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 _0x8f1a=['message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2f9b03,_0x8d12b0){var _0x437f9a=function(_0x3447c5){while(--_0x3447c5){_0x2f9b03['push'](_0x2f9b03['shift']());}};_0x437f9a(++_0x8d12b0);}(_0x8f1a,0xba));var _0xa8f1=function(_0x35e1e3,_0x2ee3a9){_0x35e1e3=_0x35e1e3-0x0;var _0x12cb1d=_0x8f1a[_0x35e1e3];return _0x12cb1d;};'use strict';var _=require('lodash');var util=require(_0xa8f1('0x0'));var moment=require(_0xa8f1('0x1'));var BPromise=require(_0xa8f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8f1('0x3'))['db'];var utils=require(_0xa8f1('0x4'));var logger=require(_0xa8f1('0x5'))(_0xa8f1('0x6'));var config=require(_0xa8f1('0x7'));var jayson=require(_0xa8f1('0x8'));var client=jayson[_0xa8f1('0x9')][_0xa8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xccce44,_0x5de898,_0x1a04f){return new BPromise(function(_0x530267,_0xbedf91){return client[_0xa8f1('0xb')](_0xccce44,_0x1a04f)[_0xa8f1('0xc')](function(_0x5575e5){logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x5de898,'request\x20sent');logger[_0xa8f1('0xf')](_0xa8f1('0x10'),_0x5de898,_0xa8f1('0x11'),JSON[_0xa8f1('0x12')](_0x5575e5));if(_0x5575e5[_0xa8f1('0x13')]){if(_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x14')]===0x1f4){logger['error'](_0xa8f1('0xe'),_0x5de898,_0x5575e5['error'][_0xa8f1('0x15')]);return _0xbedf91(_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x15')]);}logger['error'](_0xa8f1('0xe'),_0x5de898,_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x15')]);return _0x530267(_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x15')]);}else{logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x5de898,_0xa8f1('0x11'));_0x530267(_0x5575e5[_0xa8f1('0x16')][_0xa8f1('0x15')]);}})['catch'](function(_0x52d1d3){logger[_0xa8f1('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x5de898,_0x52d1d3);_0xbedf91(_0x52d1d3);});});} \ No newline at end of file +var _0x6c57=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x6c57,0x76));var _0x76c5=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x6c57[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x76c5('0x0'));var util=require(_0x76c5('0x1'));var moment=require(_0x76c5('0x2'));var BPromise=require(_0x76c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76c5('0x4'));var db=require(_0x76c5('0x5'))['db'];var utils=require(_0x76c5('0x6'));var logger=require(_0x76c5('0x7'))(_0x76c5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76c5('0x9')][_0x76c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3602a8,_0x4cf6ea,_0x374cd5){return new BPromise(function(_0x27885a,_0x3f58b5){return client[_0x76c5('0xb')](_0x3602a8,_0x374cd5)[_0x76c5('0xc')](function(_0x2dd12d){logger[_0x76c5('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4cf6ea,_0x76c5('0xe'));logger[_0x76c5('0xf')](_0x76c5('0x10'),_0x4cf6ea,_0x76c5('0xe'),JSON[_0x76c5('0x11')](_0x2dd12d));if(_0x2dd12d[_0x76c5('0x12')]){if(_0x2dd12d['error']['code']===0x1f4){logger['error'](_0x76c5('0x13'),_0x4cf6ea,_0x2dd12d['error'][_0x76c5('0x14')]);return _0x3f58b5(_0x2dd12d[_0x76c5('0x12')][_0x76c5('0x14')]);}logger['error'](_0x76c5('0x13'),_0x4cf6ea,_0x2dd12d['error']['message']);return _0x27885a(_0x2dd12d[_0x76c5('0x12')][_0x76c5('0x14')]);}else{logger[_0x76c5('0xd')](_0x76c5('0x13'),_0x4cf6ea,_0x76c5('0xe'));_0x27885a(_0x2dd12d[_0x76c5('0x15')][_0x76c5('0x14')]);}})[_0x76c5('0x16')](function(_0x4e8d0d){logger[_0x76c5('0x12')](_0x76c5('0x13'),_0x4cf6ea,_0x4e8d0d);_0x3f58b5(_0x4e8d0d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1cdcdb8..b652085 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 _0x9c2b=['destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','put','update','delete','/:id'];(function(_0x20a48e,_0x19c088){var _0x4b0c22=function(_0x55910b){while(--_0x55910b){_0x20a48e['push'](_0x20a48e['shift']());}};_0x4b0c22(++_0x19c088);}(_0x9c2b,0x1a5));var _0xb9c2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x9c2b[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0xb9c2('0x0'));var path=require('path');var timeout=require(_0xb9c2('0x1'));var express=require(_0xb9c2('0x2'));var router=express[_0xb9c2('0x3')]();var auth=require(_0xb9c2('0x4'));var interaction=require(_0xb9c2('0x5'));var config=require(_0xb9c2('0x6'));var controller=require('./intSalesforceAccount.controller');router[_0xb9c2('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9c2('0x8')]);router[_0xb9c2('0x7')]('/:id',auth[_0xb9c2('0x9')](),controller[_0xb9c2('0xa')]);router[_0xb9c2('0x7')](_0xb9c2('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb9c2('0x7')](_0xb9c2('0xc'),auth[_0xb9c2('0x9')](),controller['getFields']);router[_0xb9c2('0xd')]('/',auth['isAuthenticated'](),controller[_0xb9c2('0xe')]);router[_0xb9c2('0xd')]('/:id/configurations',auth[_0xb9c2('0x9')](),controller['addConfiguration']);router[_0xb9c2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb9c2('0x10')]);router[_0xb9c2('0x11')](_0xb9c2('0x12'),auth[_0xb9c2('0x9')](),controller[_0xb9c2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x29cd=['addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','create','post'];(function(_0x3a1712,_0x251664){var _0x1dc6dd=function(_0x54f295){while(--_0x54f295){_0x3a1712['push'](_0x3a1712['shift']());}};_0x1dc6dd(++_0x251664);}(_0x29cd,0x17b));var _0xd29c=function(_0x244d9d,_0x20f5c5){_0x244d9d=_0x244d9d-0x0;var _0x4d2b74=_0x29cd[_0x244d9d];return _0x4d2b74;};'use strict';var multer=require(_0xd29c('0x0'));var util=require('util');var path=require(_0xd29c('0x1'));var timeout=require(_0xd29c('0x2'));var express=require(_0xd29c('0x3'));var router=express[_0xd29c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd29c('0x5'));var config=require(_0xd29c('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xd29c('0x7')](),controller[_0xd29c('0x8')]);router[_0xd29c('0x9')](_0xd29c('0xa'),auth['isAuthenticated'](),controller[_0xd29c('0xb')]);router[_0xd29c('0x9')](_0xd29c('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd29c('0x9')](_0xd29c('0xd'),auth[_0xd29c('0x7')](),controller[_0xd29c('0xe')]);router['post']('/',auth[_0xd29c('0x7')](),controller[_0xd29c('0xf')]);router[_0xd29c('0x10')](_0xd29c('0xc'),auth[_0xd29c('0x7')](),controller[_0xd29c('0x11')]);router[_0xd29c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd29c('0x13')]);router[_0xd29c('0x14')]('/:id',auth[_0xd29c('0x7')](),controller['destroy']);module[_0xd29c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index be5536b..ce3ffc2 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 _0x326f=['STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x326f,0xd1));var _0xf326=function(_0x323888,_0x465293){_0x323888=_0x323888-0x0;var _0x5e8958=_0x326f[_0x323888];return _0x5e8958;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf326('0x1')]},'username':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x2')},'remoteUri':{'type':Sequelize[_0xf326('0x1')]},'password':{'type':Sequelize[_0xf326('0x1')]},'clientId':{'type':Sequelize[_0xf326('0x1')]},'clientSecret':{'type':Sequelize[_0xf326('0x1')]},'securityToken':{'type':Sequelize[_0xf326('0x1')]},'serverUrl':{'type':Sequelize[_0xf326('0x1')]},'type':{'type':Sequelize[_0xf326('0x3')]('integrationTab',_0xf326('0x4')),'defaultValue':_0xf326('0x5')}}; \ No newline at end of file +var _0x1cb9=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x27e5ff,_0x4c1442){var _0x20ccdf=function(_0x5a9c2f){while(--_0x5a9c2f){_0x27e5ff['push'](_0x27e5ff['shift']());}};_0x20ccdf(++_0x4c1442);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20c4af,_0x4509fc){_0x20c4af=_0x20c4af-0x0;var _0x4e5bee=_0x1cb9[_0x20c4af];return _0x4e5bee;};'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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5e0a36e..5398384 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 _0xb04f=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','findOne','SalesforceConfiguration','options','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedName','custom','includes','picklistValues','label','value','boolean','true','false','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x26c153,_0x137fa6){var _0x502158=function(_0x1791d8){while(--_0x1791d8){_0x26c153['push'](_0x26c153['shift']());}};_0x502158(++_0x137fa6);}(_0xb04f,0x17a));var _0xfb04=function(_0x490807,_0x499506){_0x490807=_0x490807-0x0;var _0xc4f0c1=_0xb04f[_0x490807];return _0xc4f0c1;};'use strict';var pdf=require(_0xfb04('0x0'));var emlformat=require(_0xfb04('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfb04('0x2'));var jsonpatch=require(_0xfb04('0x3'));var rp=require('request-promise');var moment=require(_0xfb04('0x4'));var BPromise=require(_0xfb04('0x5'));var Mustache=require(_0xfb04('0x6'));var util=require(_0xfb04('0x7'));var path=require(_0xfb04('0x8'));var sox=require(_0xfb04('0x9'));var csv=require(_0xfb04('0xa'));var ejs=require(_0xfb04('0xb'));var fs=require('fs');var _=require(_0xfb04('0xc'));var squel=require(_0xfb04('0xd'));var crypto=require('crypto');var jsforce=require(_0xfb04('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb04('0xf'));var Papa=require(_0xfb04('0x10'));var Redis=require('ioredis');var authService=require(_0xfb04('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb04('0x12'));var logger=require(_0xfb04('0x13'))('api');var utils=require(_0xfb04('0x14'));var config=require(_0xfb04('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb04('0x16'));var jayson=require(_0xfb04('0x17'));var client=jayson[_0xfb04('0x18')][_0xfb04('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5dbfdb,_0x4f98fd,_0x420b3){if(_0x420b3){var _0x215080=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x215080[_0xfb04('0x1a')](_0x4f98fd)){return _0x5dbfdb;}else{throw new db['Sequelize'][(_0xfb04('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 _0x5dbfdb;}}function respondWithRpcPromise(_0x306a8f,_0x3c3919,_0x1fbe8f,_0x2180bb){return new BPromise(function(_0xe941d9,_0x235a46){var _0xbe6b98=_0x2180bb||client;return _0xbe6b98[_0xfb04('0x1c')](_0x306a8f,_0x1fbe8f)[_0xfb04('0x1d')](function(_0x4c0768){logger[_0xfb04('0x1e')](_0xfb04('0x1f'),_0x3c3919,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3c3919,_0xfb04('0x20'),JSON[_0xfb04('0x21')](_0x4c0768));if(_0x4c0768['error']){if(_0x4c0768[_0xfb04('0x22')]['code']===0x1f4){logger['error'](_0xfb04('0x1f'),_0x3c3919,_0x4c0768[_0xfb04('0x22')][_0xfb04('0x23')]);return _0x235a46(_0x4c0768['error']['message']);}logger['error'](_0xfb04('0x1f'),_0x3c3919,_0x4c0768['error'][_0xfb04('0x23')]);return _0xe941d9(_0x4c0768[_0xfb04('0x22')][_0xfb04('0x23')]);}else{logger[_0xfb04('0x1e')](_0xfb04('0x1f'),_0x3c3919,'request\x20sent');_0xe941d9(_0x4c0768[_0xfb04('0x24')]['message']);}})['catch'](function(_0x4cf0d5){logger[_0xfb04('0x22')](_0xfb04('0x1f'),_0x3c3919,_0x4cf0d5);_0x235a46(_0x4cf0d5);});});}function respondWithStatusCode(_0x48caec,_0x1259d1){_0x1259d1=_0x1259d1||0xcc;return function(_0x6dee86){if(_0x6dee86){return _0x48caec[_0xfb04('0x25')](_0x1259d1);}return _0x48caec['status'](_0x1259d1)['end']();};}function respondWithResult(_0x1b117b,_0x3b837b){_0x3b837b=_0x3b837b||0xc8;return function(_0xad9c00){if(_0xad9c00){return _0x1b117b['status'](_0x3b837b)[_0xfb04('0x26')](_0xad9c00);}};}function respondWithFilteredResult(_0x2d4a4d,_0x265720){return function(_0x599898){if(_0x599898){var _0x14c9d0=_0x599898[_0xfb04('0x27')],_0x398ad8=_0x265720['offset'],_0x415cd6=_0x265720[_0xfb04('0x28')]+_0x265720['limit'],_0x4f1507;if(_0x415cd6>=_0x14c9d0){_0x415cd6=_0x14c9d0;_0x4f1507=0xc8;}else{_0x4f1507=0xce;}_0x2d4a4d[_0xfb04('0x29')](_0x4f1507);return _0x2d4a4d[_0xfb04('0x2a')](_0xfb04('0x2b'),_0x398ad8+'-'+_0x415cd6+'/'+_0x14c9d0)[_0xfb04('0x26')](_0x599898);}return null;};}function patchUpdates(_0x30a29c){return function(_0x1c5dcf){try{jsonpatch[_0xfb04('0x2c')](_0x1c5dcf,_0x30a29c,!![]);}catch(_0x2393ae){return BPromise[_0xfb04('0x2d')](_0x2393ae);}return _0x1c5dcf[_0xfb04('0x2e')]();};}function saveUpdates(_0x2648d7,_0x51cec0){return function(_0x31a5ba){if(_0x31a5ba){return _0x31a5ba[_0xfb04('0x2f')](_0x2648d7)[_0xfb04('0x1d')](function(_0x1211dd){return _0x1211dd;});}return null;};}function removeEntity(_0x6c5dc7,_0x4ea350){return function(_0x4b58f8){if(_0x4b58f8){return _0x4b58f8[_0xfb04('0x30')]()[_0xfb04('0x1d')](function(){_0x6c5dc7[_0xfb04('0x29')](0xcc)[_0xfb04('0x31')]();});}};}function handleEntityNotFound(_0x5a889,_0x173f18){return function(_0x527f15){if(!_0x527f15){_0x5a889[_0xfb04('0x25')](0x194);}return _0x527f15;};}function handleError(_0x1a6c36,_0x423ae1){_0x423ae1=_0x423ae1||0x1f4;return function(_0x46ac86){logger[_0xfb04('0x22')](_0x46ac86[_0xfb04('0x32')]);if(_0x46ac86[_0xfb04('0x33')]){delete _0x46ac86[_0xfb04('0x33')];}_0x1a6c36[_0xfb04('0x29')](_0x423ae1)[_0xfb04('0x34')](_0x46ac86);};}exports[_0xfb04('0x35')]=function(_0x4ed888,_0x2f078d){var _0x3f4950={},_0x493ed2={},_0x2173e3={'count':0x0,'rows':[]};var _0x5f53b8=_[_0xfb04('0x36')](db[_0xfb04('0x37')]['rawAttributes'],function(_0xe6cf66){return{'name':_0xe6cf66[_0xfb04('0x38')],'type':_0xe6cf66[_0xfb04('0x39')][_0xfb04('0x3a')]};});_0x493ed2[_0xfb04('0x3b')]=_['map'](_0x5f53b8,_0xfb04('0x33'));_0x493ed2[_0xfb04('0x3c')]=_[_0xfb04('0x3d')](_0x4ed888[_0xfb04('0x3c')]);_0x493ed2[_0xfb04('0x3e')]=_['intersection'](_0x493ed2[_0xfb04('0x3b')],_0x493ed2[_0xfb04('0x3c')]);_0x3f4950[_0xfb04('0x3f')]=_[_0xfb04('0x40')](_0x493ed2[_0xfb04('0x3b')],qs[_0xfb04('0x41')](_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x41')]));_0x3f4950[_0xfb04('0x3f')]=_0x3f4950[_0xfb04('0x3f')][_0xfb04('0x42')]?_0x3f4950[_0xfb04('0x3f')]:_0x493ed2[_0xfb04('0x3b')];if(!_0x4ed888[_0xfb04('0x3c')]['hasOwnProperty']('nolimit')){_0x3f4950['limit']=qs[_0xfb04('0x43')](_0x4ed888[_0xfb04('0x3c')]['limit']);_0x3f4950[_0xfb04('0x28')]=qs[_0xfb04('0x28')](_0x4ed888[_0xfb04('0x3c')]['offset']);}_0x3f4950[_0xfb04('0x44')]=qs[_0xfb04('0x45')](_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x45')]);_0x3f4950[_0xfb04('0x46')]=qs[_0xfb04('0x3e')](_[_0xfb04('0x47')](_0x4ed888[_0xfb04('0x3c')],_0x493ed2[_0xfb04('0x3e')]),_0x5f53b8);if(_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x48')]){_0x3f4950[_0xfb04('0x46')]=_[_0xfb04('0x49')](_0x3f4950[_0xfb04('0x46')],{'$or':_[_0xfb04('0x36')](_0x5f53b8,function(_0xd9e0d3){if(_0xd9e0d3[_0xfb04('0x39')]!=='VIRTUAL'){var _0xf8ba50={};_0xf8ba50[_0xd9e0d3[_0xfb04('0x33')]]={'$like':'%'+_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x48')]+'%'};return _0xf8ba50;}})});}_0x3f4950=_['merge']({},_0x3f4950,_0x4ed888['options']);var _0x5d64b6={'where':_0x3f4950[_0xfb04('0x46')]};return db[_0xfb04('0x37')]['count'](_0x5d64b6)['then'](function(_0x535e9e){_0x2173e3[_0xfb04('0x27')]=_0x535e9e;if(_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x4a')]){_0x3f4950[_0xfb04('0x4b')]=[{'all':!![]}];}return db[_0xfb04('0x37')][_0xfb04('0x4c')](_0x3f4950);})[_0xfb04('0x1d')](function(_0x541cce){_0x2173e3['rows']=_0x541cce;return _0x2173e3;})[_0xfb04('0x1d')](respondWithFilteredResult(_0x2f078d,_0x3f4950))[_0xfb04('0x4d')](handleError(_0x2f078d,null));};exports[_0xfb04('0x4e')]=function(_0x1e7ca8,_0x70947c){var _0x424ee0={'raw':![],'where':{'id':_0x1e7ca8[_0xfb04('0x4f')]['id']}},_0x1cd336={};_0x1cd336['model']=_[_0xfb04('0x3d')](db[_0xfb04('0x37')][_0xfb04('0x50')]);_0x1cd336['query']=_[_0xfb04('0x3d')](_0x1e7ca8[_0xfb04('0x3c')]);_0x1cd336['filters']=_[_0xfb04('0x40')](_0x1cd336['model'],_0x1cd336[_0xfb04('0x3c')]);_0x424ee0[_0xfb04('0x3f')]=_[_0xfb04('0x40')](_0x1cd336[_0xfb04('0x3b')],qs[_0xfb04('0x41')](_0x1e7ca8['query'][_0xfb04('0x41')]));_0x424ee0[_0xfb04('0x3f')]=_0x424ee0[_0xfb04('0x3f')]['length']?_0x424ee0[_0xfb04('0x3f')]:_0x1cd336[_0xfb04('0x3b')];if(_0x1e7ca8[_0xfb04('0x3c')]['includeAll']){_0x424ee0[_0xfb04('0x4b')]=[{'all':!![]}];}_0x424ee0=_[_0xfb04('0x49')]({},_0x424ee0,_0x1e7ca8['options']);return db['SalesforceAccount'][_0xfb04('0x51')](_0x424ee0)['then'](handleEntityNotFound(_0x70947c,null))[_0xfb04('0x1d')](respondWithResult(_0x70947c,null))['catch'](handleError(_0x70947c,null));};exports[_0xfb04('0x52')]=function(_0x3eb837,_0x124d13){return db['SalesforceAccount'][_0xfb04('0x52')](_0x3eb837[_0xfb04('0x53')],{})[_0xfb04('0x1d')](respondWithResult(_0x124d13,0xc9))[_0xfb04('0x4d')](handleError(_0x124d13,null));};exports['update']=function(_0x432ef6,_0x232eba){if(_0x432ef6[_0xfb04('0x53')]['id']){delete _0x432ef6['body']['id'];}return db['SalesforceAccount'][_0xfb04('0x51')]({'where':{'id':_0x432ef6[_0xfb04('0x4f')]['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x232eba,null))[_0xfb04('0x1d')](saveUpdates(_0x432ef6['body'],null))[_0xfb04('0x1d')](respondWithResult(_0x232eba,null))['catch'](handleError(_0x232eba,null));};exports[_0xfb04('0x30')]=function(_0x22f896,_0x1eeed3){return db[_0xfb04('0x37')][_0xfb04('0x51')]({'where':{'id':_0x22f896[_0xfb04('0x4f')]['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x1eeed3,null))['then'](removeEntity(_0x1eeed3,null))[_0xfb04('0x4d')](handleError(_0x1eeed3,null));};exports['getConfigurations']=function(_0x36df98,_0x215d85,_0x449e4b){var _0x4a9869={};var _0x1bf84a={};var _0x47a075;var _0x2bf3f4;return db[_0xfb04('0x37')][_0xfb04('0x54')]({'where':{'id':_0x36df98['params']['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x215d85,null))[_0xfb04('0x1d')](function(_0x3b5cb4){if(_0x3b5cb4){_0x47a075=_0x3b5cb4;_0x1bf84a[_0xfb04('0x3b')]=_['keys'](db[_0xfb04('0x55')][_0xfb04('0x50')]);_0x1bf84a[_0xfb04('0x3c')]=_[_0xfb04('0x3d')](_0x36df98[_0xfb04('0x3c')]);_0x1bf84a['filters']=_[_0xfb04('0x40')](_0x1bf84a['model'],_0x1bf84a[_0xfb04('0x3c')]);_0x4a9869[_0xfb04('0x3f')]=_[_0xfb04('0x40')](_0x1bf84a['model'],qs[_0xfb04('0x41')](_0x36df98[_0xfb04('0x3c')][_0xfb04('0x41')]));_0x4a9869[_0xfb04('0x3f')]=_0x4a9869[_0xfb04('0x3f')][_0xfb04('0x42')]?_0x4a9869[_0xfb04('0x3f')]:_0x1bf84a['model'];_0x4a9869[_0xfb04('0x44')]=qs[_0xfb04('0x45')](_0x36df98[_0xfb04('0x3c')][_0xfb04('0x45')]);_0x4a9869['where']=qs[_0xfb04('0x3e')](_[_0xfb04('0x47')](_0x36df98['query'],_0x1bf84a[_0xfb04('0x3e')]));if(_0x36df98[_0xfb04('0x3c')][_0xfb04('0x48')]){_0x4a9869[_0xfb04('0x46')]=_['merge'](_0x4a9869[_0xfb04('0x46')],{'$or':_['map'](_0x4a9869[_0xfb04('0x3f')],function(_0x134133){var _0x483634={};_0x483634[_0x134133]={'$like':'%'+_0x36df98[_0xfb04('0x3c')][_0xfb04('0x48')]+'%'};return _0x483634;})});}_0x4a9869=_['merge']({},_0x4a9869,_0x36df98[_0xfb04('0x56')]);return _0x47a075[_0xfb04('0x57')](_0x4a9869);}})['then'](function(_0x1e2fb2){if(_0x1e2fb2){_0x2bf3f4=_0x1e2fb2[_0xfb04('0x42')];if(!_0x36df98[_0xfb04('0x3c')]['hasOwnProperty'](_0xfb04('0x58'))){_0x4a9869['limit']=qs[_0xfb04('0x43')](_0x36df98[_0xfb04('0x3c')][_0xfb04('0x43')]);_0x4a9869[_0xfb04('0x28')]=qs[_0xfb04('0x28')](_0x36df98[_0xfb04('0x3c')]['offset']);}return _0x47a075[_0xfb04('0x57')](_0x4a9869);}})['then'](function(_0x45f1bf){if(_0x45f1bf){return _0x45f1bf?{'count':_0x2bf3f4,'rows':_0x45f1bf}:null;}})['then'](respondWithResult(_0x215d85,null))[_0xfb04('0x4d')](handleError(_0x215d85,null));};exports[_0xfb04('0x59')]=function(_0x54e92f,_0x276192,_0x3d28b6){if(_0x54e92f[_0xfb04('0x53')]['id']){delete _0x54e92f[_0xfb04('0x53')]['id'];}return db[_0xfb04('0x37')][_0xfb04('0x54')]({'where':{'id':_0x54e92f['params']['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x276192,null))['then'](function(_0xd860a){if(_0xd860a){_0x54e92f[_0xfb04('0x53')][_0xfb04('0x5a')]=_0xd860a['id'];_0x54e92f[_0xfb04('0x53')][_0xfb04('0x5b')]=integrations[_0xfb04('0x5c')](_0x54e92f[_0xfb04('0x53')]['channel'],_0x54e92f[_0xfb04('0x53')]['type']);_0x54e92f[_0xfb04('0x53')]['Descriptions']=integrations['getDescriptions'](_0x54e92f[_0xfb04('0x53')][_0xfb04('0x5d')],_0x54e92f['body'][_0xfb04('0x39')]);return db['SalesforceConfiguration'][_0xfb04('0x52')](_0x54e92f['body'],{'include':[{'model':db[_0xfb04('0x5e')],'as':_0xfb04('0x5b')},{'model':db[_0xfb04('0x5e')],'as':'Descriptions'}]});}return null;})[_0xfb04('0x1d')](respondWithResult(_0x276192,null))['catch'](handleError(_0x276192,null));};exports[_0xfb04('0x5f')]=function(_0x2f00a4,_0x28bc4b,_0x427dc2){var _0x459d53;var _0x252cb1='';var _0x6d93da=_0xfb04('0x60');return db[_0xfb04('0x37')][_0xfb04('0x54')]({'where':{'id':_0x2f00a4[_0xfb04('0x4f')]['id']},'attributes':['id',_0xfb04('0x61'),_0xfb04('0x62'),_0xfb04('0x63'),_0xfb04('0x64'),_0xfb04('0x65'),'securityToken']})[_0xfb04('0x1d')](handleEntityNotFound(_0x28bc4b,null))[_0xfb04('0x1d')](function(_0x449fe2){if(_0x449fe2){_0x252cb1=_0x449fe2[_0xfb04('0x61')];var _0x41f4b6=_0x252cb1[_0xfb04('0x66')](-0x1);if(_0x41f4b6==='/'){_0x252cb1=_0x252cb1['substring'](0x0,_0x252cb1[_0xfb04('0x67')](_0x41f4b6));}_0x459d53=new jsforce[(_0xfb04('0x68'))]({'oauth2':{'loginUrl':_0x252cb1,'clientId':_0x449fe2[_0xfb04('0x62')],'clientSecret':_0x449fe2[_0xfb04('0x63')]}});return _0x459d53[_0xfb04('0x69')](_0x449fe2[_0xfb04('0x64')],_0x449fe2[_0xfb04('0x65')][_0xfb04('0x6a')](_0x449fe2[_0xfb04('0x6b')]));}})['then'](function(_0x25f3d6){if(_0x25f3d6){if(!_['isNil'](_0x2f00a4[_0xfb04('0x3c')]['ticketType'])){_0x6d93da=_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x6c')];}return _0x459d53[_0xfb04('0x6d')](_0x6d93da)[_0xfb04('0x6e')]();}})[_0xfb04('0x1d')](function(_0x3d5687){var _0x4138a8=[_0xfb04('0x6f'),'CallDurationInSeconds',_0xfb04('0x70'),_0xfb04('0x71'),_0xfb04('0x72'),_0xfb04('0x73'),_0xfb04('0x74'),_0xfb04('0x75')];if(!_['isNil'](_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x6c')])&&_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x6c')]===_0xfb04('0x76')){_0x4138a8=[_0xfb04('0x75'),'Origin',_0xfb04('0x77'),_0xfb04('0x74'),_0xfb04('0x73'),_0xfb04('0x78'),_0xfb04('0x79'),'SuppliedCompany'];}if(_0x3d5687){_['remove'](_0x3d5687[_0xfb04('0x41')],function(_0xc8da1b){return _0xc8da1b[_0xfb04('0x7a')]===![]&&!_0x4138a8[_0xfb04('0x7b')](_0xc8da1b[_0xfb04('0x33')]);});return{'count':_0x3d5687['fields'][_0xfb04('0x42')],'rows':_[_0xfb04('0x36')](_0x3d5687[_0xfb04('0x41')],function(_0x180599){return{'id':_0x180599[_0xfb04('0x33')],'name':_0x180599['label'],'custom':_0x180599['custom'],'options':_0x180599[_0xfb04('0x7c')][_0xfb04('0x42')]>0x0?_['map'](_0x180599[_0xfb04('0x7c')],function(_0x368bd6){return{'name':_0x368bd6[_0xfb04('0x7d')],'value':_0x368bd6[_0xfb04('0x7e')]};}):_0x180599['type']==_0xfb04('0x7f')?[{'name':'True','value':_0xfb04('0x80')},{'name':'False','value':_0xfb04('0x81')}]:[]};})};}})[_0xfb04('0x1d')](respondWithResult(_0x28bc4b,null))[_0xfb04('0x4d')](function(_0x145fde){var _0x22299b=_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x1a')]?0x1f4:_0x145fde[_0xfb04('0x82')]||0x1f4;logger[_0xfb04('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xfb04('0x5f'),_0x22299b,JSON[_0xfb04('0x21')](_0x145fde));delete _0x145fde[_0xfb04('0x33')];if(_0x22299b===0x191){_0x22299b=0x190;}_0x28bc4b[_0xfb04('0x29')](_0x22299b)[_0xfb04('0x34')](_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x145fde[_0xfb04('0x82')]}:_0x145fde);});}; \ No newline at end of file +var _0x8883=['SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientSecret','username','password','securityToken','lastIndexOf','clientId','ticketType','sobject','CallDisposition','CallObject','Type','Case','Reason','Status','Priority','IsEscalated','SuppliedName','remove','custom','includes','picklistValues','label','value','boolean','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','findOne'];(function(_0x733c97,_0x40f9e7){var _0x57c50f=function(_0x116817){while(--_0x116817){_0x733c97['push'](_0x733c97['shift']());}};_0x57c50f(++_0x40f9e7);}(_0x8883,0xb0));var _0x3888=function(_0x3ee7e4,_0x40ae01){_0x3ee7e4=_0x3ee7e4-0x0;var _0x41ac03=_0x8883[_0x3ee7e4];return _0x41ac03;};'use strict';var pdf=require(_0x3888('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3888('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3888('0x2'));var BPromise=require(_0x3888('0x3'));var Mustache=require(_0x3888('0x4'));var util=require(_0x3888('0x5'));var path=require(_0x3888('0x6'));var sox=require(_0x3888('0x7'));var csv=require(_0x3888('0x8'));var ejs=require(_0x3888('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3888('0xa'));var crypto=require('crypto');var jsforce=require(_0x3888('0xb'));var deskjs=require(_0x3888('0xc'));var toCsv=require(_0x3888('0x8'));var querystring=require(_0x3888('0xd'));var Papa=require(_0x3888('0xe'));var Redis=require(_0x3888('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3888('0x10'));var as=require(_0x3888('0x11'));var hardwareService=require(_0x3888('0x12'));var logger=require(_0x3888('0x13'))(_0x3888('0x14'));var utils=require(_0x3888('0x15'));var config=require(_0x3888('0x16'));var db=require(_0x3888('0x17'))['db'];var integrations=require(_0x3888('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x3888('0x19')][_0x3888('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3da633,_0x5efe03,_0x29c472){if(_0x29c472){var _0x120da9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x120da9[_0x3888('0x1b')](_0x5efe03)){return _0x3da633;}else{throw new db[(_0x3888('0x1c'))]['ValidationError'](_0x3888('0x1d'));}}else{return _0x3da633;}}function respondWithRpcPromise(_0x6830f,_0x82b6dd,_0x272932,_0x33518d){return new BPromise(function(_0x537acc,_0x3614ca){var _0x51ff09=_0x33518d||client;return _0x51ff09[_0x3888('0x1e')](_0x6830f,_0x272932)[_0x3888('0x1f')](function(_0x401010){logger[_0x3888('0x20')](_0x3888('0x21'),_0x82b6dd,_0x3888('0x22'));logger['debug'](_0x3888('0x23'),_0x82b6dd,_0x3888('0x22'),JSON[_0x3888('0x24')](_0x401010));if(_0x401010['error']){if(_0x401010[_0x3888('0x25')][_0x3888('0x26')]===0x1f4){logger[_0x3888('0x25')](_0x3888('0x21'),_0x82b6dd,_0x401010[_0x3888('0x25')][_0x3888('0x27')]);return _0x3614ca(_0x401010['error'][_0x3888('0x27')]);}logger[_0x3888('0x25')]('SalesforceAccount,\x20%s,\x20%s',_0x82b6dd,_0x401010['error'][_0x3888('0x27')]);return _0x537acc(_0x401010[_0x3888('0x25')][_0x3888('0x27')]);}else{logger[_0x3888('0x20')](_0x3888('0x21'),_0x82b6dd,_0x3888('0x22'));_0x537acc(_0x401010[_0x3888('0x28')][_0x3888('0x27')]);}})['catch'](function(_0x24c278){logger[_0x3888('0x25')](_0x3888('0x21'),_0x82b6dd,_0x24c278);_0x3614ca(_0x24c278);});});}function respondWithStatusCode(_0x51782a,_0x12d655){_0x12d655=_0x12d655||0xcc;return function(_0xbee2c0){if(_0xbee2c0){return _0x51782a['sendStatus'](_0x12d655);}return _0x51782a['status'](_0x12d655)[_0x3888('0x29')]();};}function respondWithResult(_0x5199b8,_0x355848){_0x355848=_0x355848||0xc8;return function(_0x19c578){if(_0x19c578){return _0x5199b8[_0x3888('0x2a')](_0x355848)[_0x3888('0x2b')](_0x19c578);}};}function respondWithFilteredResult(_0x20bcc2,_0x558062){return function(_0x150160){if(_0x150160){var _0xa98f25=_0x150160[_0x3888('0x2c')],_0x11261a=_0x558062[_0x3888('0x2d')],_0x145595=_0x558062['offset']+_0x558062[_0x3888('0x2e')],_0x427607;if(_0x145595>=_0xa98f25){_0x145595=_0xa98f25;_0x427607=0xc8;}else{_0x427607=0xce;}_0x20bcc2[_0x3888('0x2a')](_0x427607);return _0x20bcc2[_0x3888('0x2f')](_0x3888('0x30'),_0x11261a+'-'+_0x145595+'/'+_0xa98f25)[_0x3888('0x2b')](_0x150160);}return null;};}function patchUpdates(_0x51bbf0){return function(_0x39ad29){try{jsonpatch['apply'](_0x39ad29,_0x51bbf0,!![]);}catch(_0x1b18f2){return BPromise[_0x3888('0x31')](_0x1b18f2);}return _0x39ad29[_0x3888('0x32')]();};}function saveUpdates(_0x22f685,_0x53de15){return function(_0x5d276e){if(_0x5d276e){return _0x5d276e[_0x3888('0x33')](_0x22f685)['then'](function(_0x44b55a){return _0x44b55a;});}return null;};}function removeEntity(_0x2d02da,_0xf583b6){return function(_0x50a200){if(_0x50a200){return _0x50a200[_0x3888('0x34')]()[_0x3888('0x1f')](function(){_0x2d02da[_0x3888('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x150513,_0xdb7796){return function(_0x7c141d){if(!_0x7c141d){_0x150513[_0x3888('0x35')](0x194);}return _0x7c141d;};}function handleError(_0x44a6f2,_0x3ae264){_0x3ae264=_0x3ae264||0x1f4;return function(_0x67389d){logger[_0x3888('0x25')](_0x67389d[_0x3888('0x36')]);if(_0x67389d[_0x3888('0x37')]){delete _0x67389d[_0x3888('0x37')];}_0x44a6f2[_0x3888('0x2a')](_0x3ae264)[_0x3888('0x38')](_0x67389d);};}exports[_0x3888('0x39')]=function(_0xe09130,_0x687fdc){var _0x16cb26={},_0x4e3f6a={},_0x188b6={'count':0x0,'rows':[]};var _0x5dd8c6=_[_0x3888('0x3a')](db[_0x3888('0x3b')][_0x3888('0x3c')],function(_0x2d7184){return{'name':_0x2d7184[_0x3888('0x3d')],'type':_0x2d7184[_0x3888('0x3e')][_0x3888('0x3f')]};});_0x4e3f6a[_0x3888('0x40')]=_[_0x3888('0x3a')](_0x5dd8c6,_0x3888('0x37'));_0x4e3f6a[_0x3888('0x41')]=_['keys'](_0xe09130[_0x3888('0x41')]);_0x4e3f6a[_0x3888('0x42')]=_[_0x3888('0x43')](_0x4e3f6a[_0x3888('0x40')],_0x4e3f6a[_0x3888('0x41')]);_0x16cb26[_0x3888('0x44')]=_[_0x3888('0x43')](_0x4e3f6a[_0x3888('0x40')],qs[_0x3888('0x45')](_0xe09130[_0x3888('0x41')][_0x3888('0x45')]));_0x16cb26['attributes']=_0x16cb26[_0x3888('0x44')][_0x3888('0x46')]?_0x16cb26[_0x3888('0x44')]:_0x4e3f6a[_0x3888('0x40')];if(!_0xe09130[_0x3888('0x41')][_0x3888('0x47')](_0x3888('0x48'))){_0x16cb26[_0x3888('0x2e')]=qs[_0x3888('0x2e')](_0xe09130[_0x3888('0x41')][_0x3888('0x2e')]);_0x16cb26[_0x3888('0x2d')]=qs['offset'](_0xe09130[_0x3888('0x41')][_0x3888('0x2d')]);}_0x16cb26[_0x3888('0x49')]=qs['sort'](_0xe09130[_0x3888('0x41')][_0x3888('0x4a')]);_0x16cb26[_0x3888('0x4b')]=qs[_0x3888('0x42')](_[_0x3888('0x4c')](_0xe09130['query'],_0x4e3f6a[_0x3888('0x42')]),_0x5dd8c6);if(_0xe09130[_0x3888('0x41')][_0x3888('0x4d')]){_0x16cb26[_0x3888('0x4b')]=_[_0x3888('0x4e')](_0x16cb26[_0x3888('0x4b')],{'$or':_[_0x3888('0x3a')](_0x5dd8c6,function(_0x391468){if(_0x391468[_0x3888('0x3e')]!=='VIRTUAL'){var _0x5e6bef={};_0x5e6bef[_0x391468[_0x3888('0x37')]]={'$like':'%'+_0xe09130[_0x3888('0x41')]['filter']+'%'};return _0x5e6bef;}})});}_0x16cb26=_[_0x3888('0x4e')]({},_0x16cb26,_0xe09130[_0x3888('0x4f')]);var _0x4f32f9={'where':_0x16cb26[_0x3888('0x4b')]};return db[_0x3888('0x3b')][_0x3888('0x2c')](_0x4f32f9)['then'](function(_0x1fb39f){_0x188b6[_0x3888('0x2c')]=_0x1fb39f;if(_0xe09130[_0x3888('0x41')][_0x3888('0x50')]){_0x16cb26[_0x3888('0x51')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x3888('0x52')](_0x16cb26);})[_0x3888('0x1f')](function(_0x59541d){_0x188b6[_0x3888('0x53')]=_0x59541d;return _0x188b6;})[_0x3888('0x1f')](respondWithFilteredResult(_0x687fdc,_0x16cb26))[_0x3888('0x54')](handleError(_0x687fdc,null));};exports[_0x3888('0x55')]=function(_0x54d74e,_0x221eda){var _0x2b6e71={'raw':![],'where':{'id':_0x54d74e[_0x3888('0x56')]['id']}},_0x233fde={};_0x233fde['model']=_[_0x3888('0x57')](db[_0x3888('0x3b')]['rawAttributes']);_0x233fde[_0x3888('0x41')]=_[_0x3888('0x57')](_0x54d74e[_0x3888('0x41')]);_0x233fde['filters']=_['intersection'](_0x233fde['model'],_0x233fde[_0x3888('0x41')]);_0x2b6e71[_0x3888('0x44')]=_[_0x3888('0x43')](_0x233fde[_0x3888('0x40')],qs[_0x3888('0x45')](_0x54d74e[_0x3888('0x41')]['fields']));_0x2b6e71[_0x3888('0x44')]=_0x2b6e71[_0x3888('0x44')][_0x3888('0x46')]?_0x2b6e71['attributes']:_0x233fde[_0x3888('0x40')];if(_0x54d74e[_0x3888('0x41')][_0x3888('0x50')]){_0x2b6e71['include']=[{'all':!![]}];}_0x2b6e71=_[_0x3888('0x4e')]({},_0x2b6e71,_0x54d74e[_0x3888('0x4f')]);return db[_0x3888('0x3b')][_0x3888('0x58')](_0x2b6e71)['then'](handleEntityNotFound(_0x221eda,null))[_0x3888('0x1f')](respondWithResult(_0x221eda,null))[_0x3888('0x54')](handleError(_0x221eda,null));};exports[_0x3888('0x59')]=function(_0x5a0454,_0x320288){return db['SalesforceAccount'][_0x3888('0x59')](_0x5a0454[_0x3888('0x5a')],{})['then'](respondWithResult(_0x320288,0xc9))['catch'](handleError(_0x320288,null));};exports[_0x3888('0x33')]=function(_0x1f548d,_0x1e4049){if(_0x1f548d[_0x3888('0x5a')]['id']){delete _0x1f548d['body']['id'];}return db[_0x3888('0x3b')][_0x3888('0x58')]({'where':{'id':_0x1f548d['params']['id']}})[_0x3888('0x1f')](handleEntityNotFound(_0x1e4049,null))[_0x3888('0x1f')](saveUpdates(_0x1f548d[_0x3888('0x5a')],null))[_0x3888('0x1f')](respondWithResult(_0x1e4049,null))[_0x3888('0x54')](handleError(_0x1e4049,null));};exports[_0x3888('0x34')]=function(_0x2fdb60,_0x641bc1){return db[_0x3888('0x3b')][_0x3888('0x58')]({'where':{'id':_0x2fdb60['params']['id']}})[_0x3888('0x1f')](handleEntityNotFound(_0x641bc1,null))['then'](removeEntity(_0x641bc1,null))[_0x3888('0x54')](handleError(_0x641bc1,null));};exports['getConfigurations']=function(_0x1938ab,_0x30ce46,_0x2804ef){var _0x5e909={};var _0x2a583a={};var _0x1b7c09;var _0x208817;return db[_0x3888('0x3b')][_0x3888('0x5b')]({'where':{'id':_0x1938ab[_0x3888('0x56')]['id']}})[_0x3888('0x1f')](handleEntityNotFound(_0x30ce46,null))[_0x3888('0x1f')](function(_0x4fe775){if(_0x4fe775){_0x1b7c09=_0x4fe775;_0x2a583a[_0x3888('0x40')]=_[_0x3888('0x57')](db[_0x3888('0x5c')][_0x3888('0x3c')]);_0x2a583a['query']=_['keys'](_0x1938ab['query']);_0x2a583a['filters']=_[_0x3888('0x43')](_0x2a583a[_0x3888('0x40')],_0x2a583a[_0x3888('0x41')]);_0x5e909[_0x3888('0x44')]=_[_0x3888('0x43')](_0x2a583a[_0x3888('0x40')],qs[_0x3888('0x45')](_0x1938ab[_0x3888('0x41')][_0x3888('0x45')]));_0x5e909[_0x3888('0x44')]=_0x5e909[_0x3888('0x44')][_0x3888('0x46')]?_0x5e909[_0x3888('0x44')]:_0x2a583a[_0x3888('0x40')];_0x5e909[_0x3888('0x49')]=qs['sort'](_0x1938ab[_0x3888('0x41')][_0x3888('0x4a')]);_0x5e909['where']=qs['filters'](_[_0x3888('0x4c')](_0x1938ab['query'],_0x2a583a[_0x3888('0x42')]));if(_0x1938ab['query'][_0x3888('0x4d')]){_0x5e909['where']=_[_0x3888('0x4e')](_0x5e909[_0x3888('0x4b')],{'$or':_[_0x3888('0x3a')](_0x5e909['attributes'],function(_0x8650d9){var _0x415146={};_0x415146[_0x8650d9]={'$like':'%'+_0x1938ab[_0x3888('0x41')][_0x3888('0x4d')]+'%'};return _0x415146;})});}_0x5e909=_[_0x3888('0x4e')]({},_0x5e909,_0x1938ab[_0x3888('0x4f')]);return _0x1b7c09[_0x3888('0x5d')](_0x5e909);}})[_0x3888('0x1f')](function(_0x35f895){if(_0x35f895){_0x208817=_0x35f895[_0x3888('0x46')];if(!_0x1938ab[_0x3888('0x41')][_0x3888('0x47')]('nolimit')){_0x5e909['limit']=qs['limit'](_0x1938ab['query']['limit']);_0x5e909[_0x3888('0x2d')]=qs['offset'](_0x1938ab[_0x3888('0x41')][_0x3888('0x2d')]);}return _0x1b7c09[_0x3888('0x5d')](_0x5e909);}})['then'](function(_0x124b67){if(_0x124b67){return _0x124b67?{'count':_0x208817,'rows':_0x124b67}:null;}})[_0x3888('0x1f')](respondWithResult(_0x30ce46,null))['catch'](handleError(_0x30ce46,null));};exports[_0x3888('0x5e')]=function(_0x1d6b50,_0x1ccc45,_0x548393){if(_0x1d6b50[_0x3888('0x5a')]['id']){delete _0x1d6b50[_0x3888('0x5a')]['id'];}return db[_0x3888('0x3b')][_0x3888('0x5b')]({'where':{'id':_0x1d6b50['params']['id']}})[_0x3888('0x1f')](handleEntityNotFound(_0x1ccc45,null))['then'](function(_0x56f08e){if(_0x56f08e){_0x1d6b50[_0x3888('0x5a')][_0x3888('0x5f')]=_0x56f08e['id'];_0x1d6b50[_0x3888('0x5a')][_0x3888('0x60')]=integrations[_0x3888('0x61')](_0x1d6b50[_0x3888('0x5a')][_0x3888('0x62')],_0x1d6b50[_0x3888('0x5a')][_0x3888('0x3e')]);_0x1d6b50[_0x3888('0x5a')]['Descriptions']=integrations[_0x3888('0x63')](_0x1d6b50[_0x3888('0x5a')][_0x3888('0x62')],_0x1d6b50[_0x3888('0x5a')]['type']);return db[_0x3888('0x5c')]['create'](_0x1d6b50[_0x3888('0x5a')],{'include':[{'model':db[_0x3888('0x64')],'as':_0x3888('0x60')},{'model':db[_0x3888('0x64')],'as':_0x3888('0x65')}]});}return null;})[_0x3888('0x1f')](respondWithResult(_0x1ccc45,null))[_0x3888('0x54')](handleError(_0x1ccc45,null));};exports[_0x3888('0x66')]=function(_0x2c6547,_0x2b72a0,_0x1066bb){var _0x2db398;var _0x169764='';var _0x56eb61=_0x3888('0x67');return db['SalesforceAccount'][_0x3888('0x5b')]({'where':{'id':_0x2c6547['params']['id']},'attributes':['id',_0x3888('0x68'),'clientId',_0x3888('0x69'),_0x3888('0x6a'),_0x3888('0x6b'),_0x3888('0x6c')]})[_0x3888('0x1f')](handleEntityNotFound(_0x2b72a0,null))[_0x3888('0x1f')](function(_0x2b34b1){if(_0x2b34b1){_0x169764=_0x2b34b1['remoteUri'];var _0x48c88a=_0x169764['slice'](-0x1);if(_0x48c88a==='/'){_0x169764=_0x169764['substring'](0x0,_0x169764[_0x3888('0x6d')](_0x48c88a));}_0x2db398=new jsforce['Connection']({'oauth2':{'loginUrl':_0x169764,'clientId':_0x2b34b1[_0x3888('0x6e')],'clientSecret':_0x2b34b1['clientSecret']}});return _0x2db398['login'](_0x2b34b1[_0x3888('0x6a')],_0x2b34b1[_0x3888('0x6b')]['concat'](_0x2b34b1[_0x3888('0x6c')]));}})[_0x3888('0x1f')](function(_0x4570bf){if(_0x4570bf){if(!_['isNil'](_0x2c6547[_0x3888('0x41')][_0x3888('0x6f')])){_0x56eb61=_0x2c6547[_0x3888('0x41')]['ticketType'];}return _0x2db398[_0x3888('0x70')](_0x56eb61)['describe']();}})[_0x3888('0x1f')](function(_0x4ca694){var _0x3beba8=[_0x3888('0x71'),'CallDurationInSeconds',_0x3888('0x72'),'CallType','IsArchived','Priority','Status',_0x3888('0x73')];if(!_['isNil'](_0x2c6547[_0x3888('0x41')]['ticketType'])&&_0x2c6547[_0x3888('0x41')][_0x3888('0x6f')]===_0x3888('0x74')){_0x3beba8=[_0x3888('0x73'),'Origin',_0x3888('0x75'),_0x3888('0x76'),_0x3888('0x77'),_0x3888('0x78'),_0x3888('0x79'),'SuppliedCompany'];}if(_0x4ca694){_[_0x3888('0x7a')](_0x4ca694[_0x3888('0x45')],function(_0x58cdf8){return _0x58cdf8[_0x3888('0x7b')]===![]&&!_0x3beba8[_0x3888('0x7c')](_0x58cdf8[_0x3888('0x37')]);});return{'count':_0x4ca694[_0x3888('0x45')]['length'],'rows':_['map'](_0x4ca694[_0x3888('0x45')],function(_0x256505){return{'id':_0x256505['name'],'name':_0x256505['label'],'custom':_0x256505[_0x3888('0x7b')],'options':_0x256505['picklistValues'][_0x3888('0x46')]>0x0?_[_0x3888('0x3a')](_0x256505[_0x3888('0x7d')],function(_0x2a75cf){return{'name':_0x2a75cf[_0x3888('0x7e')],'value':_0x2a75cf[_0x3888('0x7f')]};}):_0x256505[_0x3888('0x3e')]==_0x3888('0x80')?[{'name':'True','value':'true'},{'name':_0x3888('0x81'),'value':_0x3888('0x82')}]:[]};})};}})[_0x3888('0x1f')](respondWithResult(_0x2b72a0,null))[_0x3888('0x54')](function(_0x550a68){var _0x4f1233=_0x2c6547[_0x3888('0x41')]['test']?0x1f4:_0x550a68[_0x3888('0x83')]||0x1f4;logger[_0x3888('0x25')](_0x3888('0x84'),_0x3888('0x66'),_0x4f1233,JSON[_0x3888('0x24')](_0x550a68));delete _0x550a68[_0x3888('0x37')];if(_0x4f1233===0x191){_0x4f1233=0x190;}_0x2b72a0['status'](_0x4f1233)[_0x3888('0x38')](_0x2c6547['query'][_0x3888('0x1b')]?{'message':_0x3888('0x85'),'statusCode':_0x550a68[_0x3888('0x83')]}:_0x550a68);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b346d32..8c850b1 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 _0xd1b8=['../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x53d35c,_0xeb12a9){var _0xcafe36=function(_0x4968e4){while(--_0x4968e4){_0x53d35c['push'](_0x53d35c['shift']());}};_0xcafe36(++_0xeb12a9);}(_0xd1b8,0x108));var _0x8d1b=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0xd1b8[_0x9b3efc];return _0x200f05;};'use strict';var _=require(_0x8d1b('0x0'));var util=require(_0x8d1b('0x1'));var logger=require(_0x8d1b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8d1b('0x3'));var rp=require(_0x8d1b('0x4'));var fs=require('fs');var path=require(_0x8d1b('0x5'));var rimraf=require(_0x8d1b('0x6'));var config=require(_0x8d1b('0x7'));var attributes=require(_0x8d1b('0x8'));var integrations=require(_0x8d1b('0x9'));module[_0x8d1b('0xa')]=function(_0x56e517,_0x1b3fa3){return _0x56e517['define'](_0x8d1b('0xb'),attributes,{'tableName':_0x8d1b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a90=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','api'];(function(_0x9f8671,_0x434bbc){var _0x4208fa=function(_0x3c31ef){while(--_0x3c31ef){_0x9f8671['push'](_0x9f8671['shift']());}};_0x4208fa(++_0x434bbc);}(_0x1a90,0xe7));var _0x01a9=function(_0x2c2cb8,_0x41f1c5){_0x2c2cb8=_0x2c2cb8-0x0;var _0x3147c4=_0x1a90[_0x2c2cb8];return _0x3147c4;};'use strict';var _=require(_0x01a9('0x0'));var util=require(_0x01a9('0x1'));var logger=require('../../config/logger')(_0x01a9('0x2'));var moment=require(_0x01a9('0x3'));var BPromise=require(_0x01a9('0x4'));var rp=require(_0x01a9('0x5'));var fs=require('fs');var path=require(_0x01a9('0x6'));var rimraf=require(_0x01a9('0x7'));var config=require(_0x01a9('0x8'));var attributes=require(_0x01a9('0x9'));var integrations=require(_0x01a9('0xa'));module['exports']=function(_0x55f069,_0x5d0e84){return _0x55f069['define'](_0x01a9('0xb'),attributes,{'tableName':_0x01a9('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 fd13158..3c9cb1c 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 _0x1cc7=['map','model','debug','find','ShowSalesforceAccount','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','then','info','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','include'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x1cc7,0x15a));var _0x71cc=function(_0x15b07c,_0x1be214){_0x15b07c=_0x15b07c-0x0;var _0x43ac28=_0x1cc7[_0x15b07c];return _0x43ac28;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var moment=require(_0x71cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71cc('0x3'))['db'];var utils=require(_0x71cc('0x4'));var logger=require(_0x71cc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71cc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc0444e,_0x41a004,_0x4039ce){return new BPromise(function(_0x2e70f0,_0x2b788c){return client['request'](_0xc0444e,_0x4039ce)[_0x71cc('0x7')](function(_0x322df2){logger[_0x71cc('0x8')]('SalesforceAccount,\x20%s,\x20%s',_0x41a004,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x41a004,_0x71cc('0x9'),JSON[_0x71cc('0xa')](_0x322df2));if(_0x322df2[_0x71cc('0xb')]){if(_0x322df2['error'][_0x71cc('0xc')]===0x1f4){logger['error'](_0x71cc('0xd'),_0x41a004,_0x322df2['error'][_0x71cc('0xe')]);return _0x2b788c(_0x322df2['error'][_0x71cc('0xe')]);}logger[_0x71cc('0xb')](_0x71cc('0xd'),_0x41a004,_0x322df2[_0x71cc('0xb')][_0x71cc('0xe')]);return _0x2e70f0(_0x322df2['error'][_0x71cc('0xe')]);}else{logger[_0x71cc('0x8')](_0x71cc('0xd'),_0x41a004,_0x71cc('0x9'));_0x2e70f0(_0x322df2[_0x71cc('0xf')][_0x71cc('0xe')]);}})[_0x71cc('0x10')](function(_0x5eae5b){logger[_0x71cc('0xb')](_0x71cc('0xd'),_0x41a004,_0x5eae5b);_0x2b788c(_0x5eae5b);});});}exports[_0x71cc('0x11')]=function(_0x1d1da8){var _0x1067be=this;return new Promise(function(_0x10da0a,_0x4c5c6d){return db[_0x71cc('0x12')][_0x71cc('0x13')]({'raw':_0x1d1da8['options']?_0x1d1da8['options'][_0x71cc('0x14')]===undefined?!![]:![]:!![],'where':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8[_0x71cc('0x15')][_0x71cc('0x16')]||null:null,'attributes':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8[_0x71cc('0x15')][_0x71cc('0x17')]||null:null,'limit':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8['options'][_0x71cc('0x18')]||null:null,'include':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8['options'][_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x1d1da8[_0x71cc('0x15')][_0x71cc('0x19')],function(_0x1bc67c){return{'model':db[_0x1bc67c[_0x71cc('0x1b')]],'as':_0x1bc67c['as'],'attributes':_0x1bc67c['attributes'],'include':_0x1bc67c[_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x1bc67c[_0x71cc('0x19')],function(_0x180cd2){return{'model':db[_0x180cd2[_0x71cc('0x1b')]],'as':_0x180cd2['as'],'attributes':_0x180cd2[_0x71cc('0x17')],'include':_0x180cd2[_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x180cd2[_0x71cc('0x19')],function(_0x4d4529){return{'model':db[_0x4d4529[_0x71cc('0x1b')]],'as':_0x4d4529['as'],'attributes':_0x4d4529[_0x71cc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x71cc('0x7')](function(_0x26becf){logger[_0x71cc('0x8')](_0x71cc('0x11'),_0x1d1da8);logger[_0x71cc('0x1c')](_0x71cc('0x11'),_0x1d1da8,JSON[_0x71cc('0xa')](_0x26becf));_0x10da0a(_0x26becf);})[_0x71cc('0x10')](function(_0x30f94d){logger[_0x71cc('0xb')](_0x71cc('0x11'),_0x30f94d[_0x71cc('0xe')],_0x1d1da8);_0x4c5c6d(_0x1067be[_0x71cc('0xb')](0x1f4,_0x30f94d[_0x71cc('0xe')]));});});};exports['ShowSalesforceAccount']=function(_0x3054ff){var _0x3b7451=this;return new Promise(function(_0x34c6bc,_0x184a51){return db[_0x71cc('0x12')][_0x71cc('0x1d')]({'raw':_0x3054ff['options']?_0x3054ff[_0x71cc('0x15')][_0x71cc('0x14')]===undefined?!![]:![]:!![],'where':_0x3054ff[_0x71cc('0x15')]?_0x3054ff[_0x71cc('0x15')][_0x71cc('0x16')]||null:null,'attributes':_0x3054ff[_0x71cc('0x15')]?_0x3054ff[_0x71cc('0x15')]['attributes']||null:null,'include':_0x3054ff[_0x71cc('0x15')]?_0x3054ff['options']['include']?_[_0x71cc('0x1a')](_0x3054ff['options']['include'],function(_0x1ca012){return{'model':db[_0x1ca012['model']],'as':_0x1ca012['as'],'attributes':_0x1ca012[_0x71cc('0x17')],'include':_0x1ca012['include']?_[_0x71cc('0x1a')](_0x1ca012[_0x71cc('0x19')],function(_0x569380){return{'model':db[_0x569380[_0x71cc('0x1b')]],'as':_0x569380['as'],'attributes':_0x569380[_0x71cc('0x17')],'include':_0x569380[_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x569380[_0x71cc('0x19')],function(_0x2c2211){return{'model':db[_0x2c2211[_0x71cc('0x1b')]],'as':_0x2c2211['as'],'attributes':_0x2c2211[_0x71cc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x71cc('0x7')](function(_0x2f8a72){logger['info'](_0x71cc('0x1e'),_0x3054ff);logger['debug'](_0x71cc('0x1e'),_0x3054ff,JSON[_0x71cc('0xa')](_0x2f8a72));_0x34c6bc(_0x2f8a72);})[_0x71cc('0x10')](function(_0x9328e2){logger[_0x71cc('0xb')](_0x71cc('0x1e'),_0x9328e2['message'],_0x3054ff);_0x184a51(_0x3b7451[_0x71cc('0xb')](0x1f4,_0x9328e2['message']));});});}; \ No newline at end of file +var _0x4522=['limit','include','map','model','attributes','info','ShowSalesforceAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where'];(function(_0x570938,_0x14d25e){var _0x466dd2=function(_0x487210){while(--_0x487210){_0x570938['push'](_0x570938['shift']());}};_0x466dd2(++_0x14d25e);}(_0x4522,0x1a0));var _0x2452=function(_0x1cf707,_0x3ac2b6){_0x1cf707=_0x1cf707-0x0;var _0x5b5a59=_0x4522[_0x1cf707];return _0x5b5a59;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});}exports[_0x2452('0x15')]=function(_0x59d89a){var _0x4802ad=this;return new Promise(function(_0x1bfb44,_0x37c6a6){return db[_0x2452('0x16')]['findAll']({'raw':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')]['attributes']||null:null,'limit':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1a')]||null:null,'include':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')],function(_0x397f21){return{'model':db[_0x397f21[_0x2452('0x1d')]],'as':_0x397f21['as'],'attributes':_0x397f21['attributes'],'include':_0x397f21[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x397f21[_0x2452('0x1b')],function(_0x231410){return{'model':db[_0x231410[_0x2452('0x1d')]],'as':_0x231410['as'],'attributes':_0x231410['attributes'],'include':_0x231410['include']?_[_0x2452('0x1c')](_0x231410[_0x2452('0x1b')],function(_0x46fcbb){return{'model':db[_0x46fcbb[_0x2452('0x1d')]],'as':_0x46fcbb['as'],'attributes':_0x46fcbb[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fba00){logger[_0x2452('0x1f')]('GetSalesforceAccount',_0x59d89a);logger['debug'](_0x2452('0x15'),_0x59d89a,JSON[_0x2452('0xe')](_0x3fba00));_0x1bfb44(_0x3fba00);})[_0x2452('0x14')](function(_0x28e6ea){logger[_0x2452('0xf')](_0x2452('0x15'),_0x28e6ea['message'],_0x59d89a);_0x37c6a6(_0x4802ad['error'](0x1f4,_0x28e6ea[_0x2452('0x12')]));});});};exports[_0x2452('0x20')]=function(_0x130565){var _0x5c36aa=this;return new Promise(function(_0x2fb2ae,_0x586a20){return db['SalesforceAccount'][_0x2452('0x21')]({'raw':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x1e')]||null:null,'include':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x1b')]?_['map'](_0x130565[_0x2452('0x17')][_0x2452('0x1b')],function(_0x4cd7e2){return{'model':db[_0x4cd7e2[_0x2452('0x1d')]],'as':_0x4cd7e2['as'],'attributes':_0x4cd7e2['attributes'],'include':_0x4cd7e2[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x4cd7e2['include'],function(_0x645722){return{'model':db[_0x645722[_0x2452('0x1d')]],'as':_0x645722['as'],'attributes':_0x645722[_0x2452('0x1e')],'include':_0x645722['include']?_[_0x2452('0x1c')](_0x645722[_0x2452('0x1b')],function(_0x4ba2ae){return{'model':db[_0x4ba2ae[_0x2452('0x1d')]],'as':_0x4ba2ae['as'],'attributes':_0x4ba2ae[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2452('0xc')](function(_0x26264f){logger[_0x2452('0x1f')]('ShowSalesforceAccount',_0x130565);logger['debug']('ShowSalesforceAccount',_0x130565,JSON[_0x2452('0xe')](_0x26264f));_0x2fb2ae(_0x26264f);})[_0x2452('0x14')](function(_0x64965c){logger[_0x2452('0xf')](_0x2452('0x20'),_0x64965c['message'],_0x130565);_0x586a20(_0x5c36aa[_0x2452('0xf')](0x1f4,_0x64965c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c389dfe..1d1040a 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 _0xe22c=['/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','index','show','get','/:id/fields','isAuthenticated','getFields'];(function(_0x1a97f0,_0x295731){var _0x2f5cc1=function(_0x525acb){while(--_0x525acb){_0x1a97f0['push'](_0x1a97f0['shift']());}};_0x2f5cc1(++_0x295731);}(_0xe22c,0xee));var _0xce22=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe22c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xce22('0x0'));var util=require(_0xce22('0x1'));var path=require(_0xce22('0x2'));var timeout=require(_0xce22('0x3'));var express=require(_0xce22('0x4'));var router=express[_0xce22('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xce22('0x6'));var config=require(_0xce22('0x7'));var controller=require(_0xce22('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xce22('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xce22('0xa')]);router[_0xce22('0xb')](_0xce22('0xc'),auth[_0xce22('0xd')](),controller[_0xce22('0xe')]);router[_0xce22('0xb')](_0xce22('0xf'),auth[_0xce22('0xd')](),controller[_0xce22('0x10')]);router[_0xce22('0xb')]('/:id/descriptions',auth[_0xce22('0xd')](),controller[_0xce22('0x11')]);router[_0xce22('0x12')]('/',auth[_0xce22('0xd')](),controller[_0xce22('0x13')]);router[_0xce22('0x14')]('/:id',auth[_0xce22('0xd')](),controller['update']);router[_0xce22('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xce22('0x16')]);module['exports']=router; \ No newline at end of file +var _0x043e=['get','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./intSalesforceConfiguration.controller','isAuthenticated','index'];(function(_0x328dd1,_0x311399){var _0x21b3e3=function(_0x41fd6a){while(--_0x41fd6a){_0x328dd1['push'](_0x328dd1['shift']());}};_0x21b3e3(++_0x311399);}(_0x043e,0x138));var _0xe043=function(_0x59b0e4,_0x26956e){_0x59b0e4=_0x59b0e4-0x0;var _0x418be1=_0x043e[_0x59b0e4];return _0x418be1;};'use strict';var multer=require(_0xe043('0x0'));var util=require('util');var path=require(_0xe043('0x1'));var timeout=require(_0xe043('0x2'));var express=require('express');var router=express[_0xe043('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe043('0x4'));var config=require('../../config/environment');var controller=require(_0xe043('0x5'));router['get']('/',auth[_0xe043('0x6')](),controller[_0xe043('0x7')]);router[_0xe043('0x8')]('/:id',auth[_0xe043('0x6')](),controller[_0xe043('0x9')]);router['get'](_0xe043('0xa'),auth[_0xe043('0x6')](),controller[_0xe043('0xb')]);router['get'](_0xe043('0xc'),auth[_0xe043('0x6')](),controller['getSubjects']);router[_0xe043('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe043('0xd')]);router[_0xe043('0xe')]('/',auth[_0xe043('0x6')](),controller[_0xe043('0xf')]);router[_0xe043('0x10')](_0xe043('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xe043('0x12')](_0xe043('0x11'),auth[_0xe043('0x6')](),controller['destroy']);module[_0xe043('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 10f1d38..948d7eb 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 _0xfd42=['Task','ENUM','contact_lead','contact','lead','nothing','exports','STRING'];(function(_0x33c44a,_0x3045a8){var _0x27f590=function(_0x3e706f){while(--_0x3e706f){_0x33c44a['push'](_0x33c44a['shift']());}};_0x27f590(++_0x3045a8);}(_0xfd42,0x186));var _0x2fd4=function(_0x3d187b,_0xe946ef){_0x3d187b=_0x3d187b-0x0;var _0x40ae0e=_0xfd42[_0x3d187b];return _0x40ae0e;};'use strict';var Sequelize=require('sequelize');module[_0x2fd4('0x0')]={'name':{'type':Sequelize[_0x2fd4('0x1')]},'description':{'type':Sequelize[_0x2fd4('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2fd4('0x2'),'Case'),'defaultValue':_0x2fd4('0x2')},'moduleSearch':{'type':Sequelize[_0x2fd4('0x3')](_0x2fd4('0x4'),_0x2fd4('0x5'),_0x2fd4('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2fd4('0x3')](_0x2fd4('0x7'),_0x2fd4('0x5'),'lead'),'defaultValue':_0x2fd4('0x6')}}; \ No newline at end of file +var _0xef82=['nothing','exports','STRING','Task','Case','ENUM','contact_lead','contact','lead'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xef82,0x17b));var _0x2ef8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xef82[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module[_0x2ef8('0x0')]={'name':{'type':Sequelize[_0x2ef8('0x1')]},'description':{'type':Sequelize[_0x2ef8('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2ef8('0x2'),_0x2ef8('0x3')),'defaultValue':_0x2ef8('0x2')},'moduleSearch':{'type':Sequelize[_0x2ef8('0x4')](_0x2ef8('0x5'),_0x2ef8('0x6'),_0x2ef8('0x7')),'defaultValue':_0x2ef8('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x2ef8('0x8'),'contact',_0x2ef8('0x7')),'defaultValue':_0x2ef8('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4b42157..6ad6706 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 _0x397b=['include','rows','show','params','keys','rawAttributes','length','find','create','body','getFields','findOne','getSubjects','SalesforceField','nolimit','getDescriptions','html-pdf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','save','update','end','name','send','index','SalesforceConfiguration','type','key','map','filters','query','intersection','fields','attributes','model','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0x397b,0x168));var _0xb397=function(_0x18464a,_0x233a5c){_0x18464a=_0x18464a-0x0;var _0x338952=_0x397b[_0x18464a];return _0x338952;};'use strict';var pdf=require(_0xb397('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb397('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb397('0x2'));var BPromise=require(_0xb397('0x3'));var Mustache=require(_0xb397('0x4'));var util=require(_0xb397('0x5'));var path=require('path');var sox=require(_0xb397('0x6'));var csv=require(_0xb397('0x7'));var ejs=require(_0xb397('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb397('0x9'));var crypto=require(_0xb397('0xa'));var jsforce=require(_0xb397('0xb'));var deskjs=require(_0xb397('0xc'));var toCsv=require(_0xb397('0x7'));var querystring=require(_0xb397('0xd'));var Papa=require(_0xb397('0xe'));var Redis=require(_0xb397('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb397('0x10'));var as=require(_0xb397('0x11'));var hardwareService=require(_0xb397('0x12'));var logger=require('../../config/logger')(_0xb397('0x13'));var utils=require('../../config/utils');var config=require(_0xb397('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb397('0x15'));var client=jayson['client'][_0xb397('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2453a8,_0x1a4eae,_0x2a6f09){if(_0x2a6f09){var _0x3a68db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a68db[_0xb397('0x17')](_0x1a4eae)){return _0x2453a8;}else{throw new db[(_0xb397('0x18'))][(_0xb397('0x19'))](_0xb397('0x1a'));}}else{return _0x2453a8;}}function respondWithRpcPromise(_0x374b24,_0x5083a0,_0x5dbfe0,_0x2f8b7f){return new BPromise(function(_0x5bf4e2,_0x45c432){var _0x59e823=_0x2f8b7f||client;return _0x59e823['request'](_0x374b24,_0x5dbfe0)[_0xb397('0x1b')](function(_0x24e61b){logger[_0xb397('0x1c')](_0xb397('0x1d'),_0x5083a0,_0xb397('0x1e'));logger[_0xb397('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5083a0,_0xb397('0x1e'),JSON[_0xb397('0x20')](_0x24e61b));if(_0x24e61b[_0xb397('0x21')]){if(_0x24e61b[_0xb397('0x21')]['code']===0x1f4){logger[_0xb397('0x21')](_0xb397('0x1d'),_0x5083a0,_0x24e61b['error'][_0xb397('0x22')]);return _0x45c432(_0x24e61b[_0xb397('0x21')][_0xb397('0x22')]);}logger[_0xb397('0x21')](_0xb397('0x1d'),_0x5083a0,_0x24e61b[_0xb397('0x21')]['message']);return _0x5bf4e2(_0x24e61b[_0xb397('0x21')][_0xb397('0x22')]);}else{logger['info'](_0xb397('0x1d'),_0x5083a0,_0xb397('0x1e'));_0x5bf4e2(_0x24e61b[_0xb397('0x23')][_0xb397('0x22')]);}})[_0xb397('0x24')](function(_0x46d368){logger[_0xb397('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5083a0,_0x46d368);_0x45c432(_0x46d368);});});}function respondWithStatusCode(_0x2ebc95,_0x5ce82d){_0x5ce82d=_0x5ce82d||0xcc;return function(_0x5ca3dd){if(_0x5ca3dd){return _0x2ebc95[_0xb397('0x25')](_0x5ce82d);}return _0x2ebc95[_0xb397('0x26')](_0x5ce82d)['end']();};}function respondWithResult(_0x163c3b,_0x11735d){_0x11735d=_0x11735d||0xc8;return function(_0x5f4e36){if(_0x5f4e36){return _0x163c3b[_0xb397('0x26')](_0x11735d)['json'](_0x5f4e36);}};}function respondWithFilteredResult(_0x4670b9,_0x5c9029){return function(_0x57ef6d){if(_0x57ef6d){var _0x2c4f35=_0x57ef6d[_0xb397('0x27')],_0x4ad1bc=_0x5c9029[_0xb397('0x28')],_0x176f7d=_0x5c9029['offset']+_0x5c9029['limit'],_0x2a1be0;if(_0x176f7d>=_0x2c4f35){_0x176f7d=_0x2c4f35;_0x2a1be0=0xc8;}else{_0x2a1be0=0xce;}_0x4670b9[_0xb397('0x26')](_0x2a1be0);return _0x4670b9[_0xb397('0x29')](_0xb397('0x2a'),_0x4ad1bc+'-'+_0x176f7d+'/'+_0x2c4f35)[_0xb397('0x2b')](_0x57ef6d);}return null;};}function patchUpdates(_0x234bf0){return function(_0x4210cd){try{jsonpatch['apply'](_0x4210cd,_0x234bf0,!![]);}catch(_0x1b2d2f){return BPromise['reject'](_0x1b2d2f);}return _0x4210cd[_0xb397('0x2c')]();};}function saveUpdates(_0x2d4313,_0x5adda6){return function(_0x214a09){if(_0x214a09){return _0x214a09[_0xb397('0x2d')](_0x2d4313)[_0xb397('0x1b')](function(_0x4ddacf){return _0x4ddacf;});}return null;};}function removeEntity(_0x3bea4f,_0x43d494){return function(_0x356089){if(_0x356089){return _0x356089['destroy']()[_0xb397('0x1b')](function(){_0x3bea4f['status'](0xcc)[_0xb397('0x2e')]();});}};}function handleEntityNotFound(_0x5d24ed,_0x4e8940){return function(_0x4aeed6){if(!_0x4aeed6){_0x5d24ed['sendStatus'](0x194);}return _0x4aeed6;};}function handleError(_0x45f1a8,_0x10081f){_0x10081f=_0x10081f||0x1f4;return function(_0x12fd09){logger[_0xb397('0x21')](_0x12fd09['stack']);if(_0x12fd09[_0xb397('0x2f')]){delete _0x12fd09[_0xb397('0x2f')];}_0x45f1a8[_0xb397('0x26')](_0x10081f)[_0xb397('0x30')](_0x12fd09);};}exports[_0xb397('0x31')]=function(_0x11285c,_0x4d66ba){var _0x3a9199={},_0x594cad={},_0x1b8a8a={'count':0x0,'rows':[]};var _0x1b9447=_['map'](db[_0xb397('0x32')]['rawAttributes'],function(_0x50f762){return{'name':_0x50f762['fieldName'],'type':_0x50f762[_0xb397('0x33')][_0xb397('0x34')]};});_0x594cad['model']=_[_0xb397('0x35')](_0x1b9447,_0xb397('0x2f'));_0x594cad['query']=_['keys'](_0x11285c['query']);_0x594cad[_0xb397('0x36')]=_['intersection'](_0x594cad['model'],_0x594cad[_0xb397('0x37')]);_0x3a9199['attributes']=_[_0xb397('0x38')](_0x594cad['model'],qs[_0xb397('0x39')](_0x11285c[_0xb397('0x37')][_0xb397('0x39')]));_0x3a9199[_0xb397('0x3a')]=_0x3a9199[_0xb397('0x3a')]['length']?_0x3a9199[_0xb397('0x3a')]:_0x594cad[_0xb397('0x3b')];if(!_0x11285c[_0xb397('0x37')][_0xb397('0x3c')]('nolimit')){_0x3a9199['limit']=qs['limit'](_0x11285c[_0xb397('0x37')][_0xb397('0x3d')]);_0x3a9199[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x11285c[_0xb397('0x37')][_0xb397('0x28')]);}_0x3a9199[_0xb397('0x3e')]=qs['sort'](_0x11285c[_0xb397('0x37')][_0xb397('0x3f')]);_0x3a9199[_0xb397('0x40')]=qs[_0xb397('0x36')](_[_0xb397('0x41')](_0x11285c[_0xb397('0x37')],_0x594cad[_0xb397('0x36')]),_0x1b9447);if(_0x11285c[_0xb397('0x37')][_0xb397('0x42')]){_0x3a9199[_0xb397('0x40')]=_[_0xb397('0x43')](_0x3a9199[_0xb397('0x40')],{'$or':_[_0xb397('0x35')](_0x1b9447,function(_0xd3b481){if(_0xd3b481[_0xb397('0x33')]!=='VIRTUAL'){var _0x587d7e={};_0x587d7e[_0xd3b481[_0xb397('0x2f')]]={'$like':'%'+_0x11285c[_0xb397('0x37')]['filter']+'%'};return _0x587d7e;}})});}_0x3a9199=_[_0xb397('0x43')]({},_0x3a9199,_0x11285c[_0xb397('0x44')]);var _0x3becc5={'where':_0x3a9199['where']};return db[_0xb397('0x32')]['count'](_0x3becc5)[_0xb397('0x1b')](function(_0x1f1653){_0x1b8a8a[_0xb397('0x27')]=_0x1f1653;if(_0x11285c[_0xb397('0x37')][_0xb397('0x45')]){_0x3a9199[_0xb397('0x46')]=[{'all':!![]}];}return db[_0xb397('0x32')]['findAll'](_0x3a9199);})['then'](function(_0x55ed67){_0x1b8a8a[_0xb397('0x47')]=_0x55ed67;return _0x1b8a8a;})[_0xb397('0x1b')](respondWithFilteredResult(_0x4d66ba,_0x3a9199))[_0xb397('0x24')](handleError(_0x4d66ba,null));};exports[_0xb397('0x48')]=function(_0x4316ea,_0x1985c8){var _0xbc262={'raw':![],'where':{'id':_0x4316ea[_0xb397('0x49')]['id']}},_0x3542e3={};_0x3542e3['model']=_[_0xb397('0x4a')](db[_0xb397('0x32')][_0xb397('0x4b')]);_0x3542e3[_0xb397('0x37')]=_[_0xb397('0x4a')](_0x4316ea[_0xb397('0x37')]);_0x3542e3[_0xb397('0x36')]=_[_0xb397('0x38')](_0x3542e3[_0xb397('0x3b')],_0x3542e3[_0xb397('0x37')]);_0xbc262[_0xb397('0x3a')]=_['intersection'](_0x3542e3[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x4316ea[_0xb397('0x37')][_0xb397('0x39')]));_0xbc262[_0xb397('0x3a')]=_0xbc262[_0xb397('0x3a')][_0xb397('0x4c')]?_0xbc262[_0xb397('0x3a')]:_0x3542e3[_0xb397('0x3b')];if(_0x4316ea[_0xb397('0x37')][_0xb397('0x45')]){_0xbc262[_0xb397('0x46')]=[{'all':!![]}];}_0xbc262=_[_0xb397('0x43')]({},_0xbc262,_0x4316ea[_0xb397('0x44')]);return db['SalesforceConfiguration'][_0xb397('0x4d')](_0xbc262)['then'](handleEntityNotFound(_0x1985c8,null))[_0xb397('0x1b')](respondWithResult(_0x1985c8,null))[_0xb397('0x24')](handleError(_0x1985c8,null));};exports[_0xb397('0x4e')]=function(_0x2b89ee,_0x28ebb1){return db['SalesforceConfiguration'][_0xb397('0x4e')](_0x2b89ee[_0xb397('0x4f')],{})[_0xb397('0x1b')](respondWithResult(_0x28ebb1,0xc9))[_0xb397('0x24')](handleError(_0x28ebb1,null));};exports['update']=function(_0x481862,_0xdf69fb){if(_0x481862[_0xb397('0x4f')]['id']){delete _0x481862[_0xb397('0x4f')]['id'];}return db[_0xb397('0x32')][_0xb397('0x4d')]({'where':{'id':_0x481862[_0xb397('0x49')]['id']}})[_0xb397('0x1b')](handleEntityNotFound(_0xdf69fb,null))[_0xb397('0x1b')](saveUpdates(_0x481862[_0xb397('0x4f')],null))[_0xb397('0x1b')](respondWithResult(_0xdf69fb,null))['catch'](handleError(_0xdf69fb,null));};exports['destroy']=function(_0x5c93c9,_0x12c589){return db[_0xb397('0x32')][_0xb397('0x4d')]({'where':{'id':_0x5c93c9[_0xb397('0x49')]['id']}})[_0xb397('0x1b')](handleEntityNotFound(_0x12c589,null))[_0xb397('0x1b')](removeEntity(_0x12c589,null))[_0xb397('0x24')](handleError(_0x12c589,null));};exports[_0xb397('0x50')]=function(_0x502dcb,_0x1b3af8,_0x4cc78c){var _0xcdd38={};var _0x7bcd1e={};var _0x1deb78;var _0x14ea40;return db[_0xb397('0x32')][_0xb397('0x51')]({'where':{'id':_0x502dcb[_0xb397('0x49')]['id']}})[_0xb397('0x1b')](handleEntityNotFound(_0x1b3af8,null))['then'](function(_0x241caa){if(_0x241caa){_0x1deb78=_0x241caa;_0x7bcd1e[_0xb397('0x3b')]=_[_0xb397('0x4a')](db['SalesforceField'][_0xb397('0x4b')]);_0x7bcd1e[_0xb397('0x37')]=_['keys'](_0x502dcb[_0xb397('0x37')]);_0x7bcd1e[_0xb397('0x36')]=_[_0xb397('0x38')](_0x7bcd1e[_0xb397('0x3b')],_0x7bcd1e[_0xb397('0x37')]);_0xcdd38['attributes']=_['intersection'](_0x7bcd1e[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x502dcb[_0xb397('0x37')][_0xb397('0x39')]));_0xcdd38['attributes']=_0xcdd38[_0xb397('0x3a')]['length']?_0xcdd38[_0xb397('0x3a')]:_0x7bcd1e[_0xb397('0x3b')];_0xcdd38[_0xb397('0x3e')]=qs[_0xb397('0x3f')](_0x502dcb['query'][_0xb397('0x3f')]);_0xcdd38[_0xb397('0x40')]=qs['filters'](_[_0xb397('0x41')](_0x502dcb[_0xb397('0x37')],_0x7bcd1e[_0xb397('0x36')]));if(_0x502dcb[_0xb397('0x37')][_0xb397('0x42')]){_0xcdd38[_0xb397('0x40')]=_['merge'](_0xcdd38[_0xb397('0x40')],{'$or':_[_0xb397('0x35')](_0xcdd38['attributes'],function(_0x5507d4){var _0xdb7381={};_0xdb7381[_0x5507d4]={'$like':'%'+_0x502dcb[_0xb397('0x37')]['filter']+'%'};return _0xdb7381;})});}_0xcdd38=_[_0xb397('0x43')]({},_0xcdd38,_0x502dcb[_0xb397('0x44')]);return _0x1deb78[_0xb397('0x50')](_0xcdd38);}})[_0xb397('0x1b')](function(_0x3ff864){if(_0x3ff864){_0x14ea40=_0x3ff864['length'];if(!_0x502dcb[_0xb397('0x37')][_0xb397('0x3c')]('nolimit')){_0xcdd38[_0xb397('0x3d')]=qs[_0xb397('0x3d')](_0x502dcb[_0xb397('0x37')][_0xb397('0x3d')]);_0xcdd38[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x502dcb[_0xb397('0x37')][_0xb397('0x28')]);}return _0x1deb78[_0xb397('0x50')](_0xcdd38);}})[_0xb397('0x1b')](function(_0x3e2823){if(_0x3e2823){return _0x3e2823?{'count':_0x14ea40,'rows':_0x3e2823}:null;}})[_0xb397('0x1b')](respondWithResult(_0x1b3af8,null))['catch'](handleError(_0x1b3af8,null));};exports[_0xb397('0x52')]=function(_0x67e021,_0x126bb1,_0x9b3fe){var _0x3692aa={};var _0x36ec0d={};var _0x301a57;var _0xe47c03;return db[_0xb397('0x32')][_0xb397('0x51')]({'where':{'id':_0x67e021[_0xb397('0x49')]['id']}})['then'](handleEntityNotFound(_0x126bb1,null))[_0xb397('0x1b')](function(_0x835c0){if(_0x835c0){_0x301a57=_0x835c0;_0x36ec0d['model']=_['keys'](db[_0xb397('0x53')][_0xb397('0x4b')]);_0x36ec0d[_0xb397('0x37')]=_['keys'](_0x67e021[_0xb397('0x37')]);_0x36ec0d[_0xb397('0x36')]=_[_0xb397('0x38')](_0x36ec0d[_0xb397('0x3b')],_0x36ec0d[_0xb397('0x37')]);_0x3692aa[_0xb397('0x3a')]=_['intersection'](_0x36ec0d[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x67e021['query'][_0xb397('0x39')]));_0x3692aa[_0xb397('0x3a')]=_0x3692aa[_0xb397('0x3a')][_0xb397('0x4c')]?_0x3692aa['attributes']:_0x36ec0d['model'];_0x3692aa[_0xb397('0x3e')]=qs[_0xb397('0x3f')](_0x67e021[_0xb397('0x37')]['sort']);_0x3692aa['where']=qs[_0xb397('0x36')](_['pick'](_0x67e021[_0xb397('0x37')],_0x36ec0d[_0xb397('0x36')]));if(_0x67e021[_0xb397('0x37')][_0xb397('0x42')]){_0x3692aa[_0xb397('0x40')]=_['merge'](_0x3692aa[_0xb397('0x40')],{'$or':_[_0xb397('0x35')](_0x3692aa[_0xb397('0x3a')],function(_0x19976c){var _0x38ab3b={};_0x38ab3b[_0x19976c]={'$like':'%'+_0x67e021[_0xb397('0x37')]['filter']+'%'};return _0x38ab3b;})});}_0x3692aa=_[_0xb397('0x43')]({},_0x3692aa,_0x67e021[_0xb397('0x44')]);return _0x301a57[_0xb397('0x52')](_0x3692aa);}})[_0xb397('0x1b')](function(_0x254a79){if(_0x254a79){_0xe47c03=_0x254a79['length'];if(!_0x67e021[_0xb397('0x37')][_0xb397('0x3c')](_0xb397('0x54'))){_0x3692aa[_0xb397('0x3d')]=qs[_0xb397('0x3d')](_0x67e021['query'][_0xb397('0x3d')]);_0x3692aa[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x67e021['query'][_0xb397('0x28')]);}return _0x301a57[_0xb397('0x52')](_0x3692aa);}})[_0xb397('0x1b')](function(_0x356478){if(_0x356478){return _0x356478?{'count':_0xe47c03,'rows':_0x356478}:null;}})[_0xb397('0x1b')](respondWithResult(_0x126bb1,null))[_0xb397('0x24')](handleError(_0x126bb1,null));};exports[_0xb397('0x55')]=function(_0x267666,_0xd61a0c,_0x4c5a8b){var _0x21078f={};var _0x461319={};var _0x544791;var _0x34761a;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x267666[_0xb397('0x49')]['id']}})['then'](handleEntityNotFound(_0xd61a0c,null))[_0xb397('0x1b')](function(_0x769395){if(_0x769395){_0x544791=_0x769395;_0x461319[_0xb397('0x3b')]=_[_0xb397('0x4a')](db[_0xb397('0x53')][_0xb397('0x4b')]);_0x461319['query']=_[_0xb397('0x4a')](_0x267666[_0xb397('0x37')]);_0x461319[_0xb397('0x36')]=_[_0xb397('0x38')](_0x461319[_0xb397('0x3b')],_0x461319[_0xb397('0x37')]);_0x21078f[_0xb397('0x3a')]=_['intersection'](_0x461319[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x267666['query'][_0xb397('0x39')]));_0x21078f[_0xb397('0x3a')]=_0x21078f[_0xb397('0x3a')][_0xb397('0x4c')]?_0x21078f[_0xb397('0x3a')]:_0x461319['model'];_0x21078f['order']=qs['sort'](_0x267666[_0xb397('0x37')][_0xb397('0x3f')]);_0x21078f[_0xb397('0x40')]=qs['filters'](_[_0xb397('0x41')](_0x267666['query'],_0x461319[_0xb397('0x36')]));if(_0x267666['query'][_0xb397('0x42')]){_0x21078f[_0xb397('0x40')]=_[_0xb397('0x43')](_0x21078f[_0xb397('0x40')],{'$or':_['map'](_0x21078f[_0xb397('0x3a')],function(_0xc3c499){var _0xb0aad5={};_0xb0aad5[_0xc3c499]={'$like':'%'+_0x267666[_0xb397('0x37')][_0xb397('0x42')]+'%'};return _0xb0aad5;})});}_0x21078f=_['merge']({},_0x21078f,_0x267666['options']);return _0x544791[_0xb397('0x55')](_0x21078f);}})[_0xb397('0x1b')](function(_0x3e9099){if(_0x3e9099){_0x34761a=_0x3e9099[_0xb397('0x4c')];if(!_0x267666[_0xb397('0x37')][_0xb397('0x3c')](_0xb397('0x54'))){_0x21078f['limit']=qs['limit'](_0x267666[_0xb397('0x37')]['limit']);_0x21078f[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x267666[_0xb397('0x37')]['offset']);}return _0x544791[_0xb397('0x55')](_0x21078f);}})[_0xb397('0x1b')](function(_0x5860a7){if(_0x5860a7){return _0x5860a7?{'count':_0x34761a,'rows':_0x5860a7}:null;}})[_0xb397('0x1b')](respondWithResult(_0xd61a0c,null))[_0xb397('0x24')](handleError(_0xd61a0c,null));}; \ No newline at end of file +var _0x057f=['end','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','show','params','length','options','create','body','find','getFields','SalesforceField','getSubjects','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','status','json','offset','limit','set','apply','reject','save','update','then','destroy'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x057f,0x85));var _0xf057=function(_0x48f9d4,_0x39d744){_0x48f9d4=_0x48f9d4-0x0;var _0x14e71d=_0x057f[_0x48f9d4];return _0x14e71d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf057('0x0'));var rimraf=require(_0xf057('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf057('0x2'));var rp=require('request-promise');var moment=require(_0xf057('0x3'));var BPromise=require(_0xf057('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf057('0x5'));var sox=require('sox');var csv=require(_0xf057('0x6'));var ejs=require(_0xf057('0x7'));var fs=require('fs');var _=require(_0xf057('0x8'));var squel=require(_0xf057('0x9'));var crypto=require(_0xf057('0xa'));var jsforce=require(_0xf057('0xb'));var deskjs=require(_0xf057('0xc'));var toCsv=require(_0xf057('0x6'));var querystring=require(_0xf057('0xd'));var Papa=require(_0xf057('0xe'));var Redis=require(_0xf057('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf057('0x10'));var as=require(_0xf057('0x11'));var hardwareService=require(_0xf057('0x12'));var logger=require(_0xf057('0x13'))(_0xf057('0x14'));var utils=require(_0xf057('0x15'));var config=require(_0xf057('0x16'));var db=require(_0xf057('0x17'))['db'];var jayson=require(_0xf057('0x18'));var client=jayson[_0xf057('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3b8011,_0xad15b4,_0xbf4101){if(_0xbf4101){var _0x409bb8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x409bb8[_0xf057('0x1a')](_0xad15b4)){return _0x3b8011;}else{throw new db['Sequelize'][(_0xf057('0x1b'))](_0xf057('0x1c'));}}else{return _0x3b8011;}}function respondWithRpcPromise(_0x5af6c4,_0x3847ed,_0xa183de,_0x20fcfa){return new BPromise(function(_0x359e2b,_0x5d3b38){var _0xedcd43=_0x20fcfa||client;return _0xedcd43[_0xf057('0x1d')](_0x5af6c4,_0xa183de)['then'](function(_0x3cf590){logger[_0xf057('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3847ed,_0xf057('0x1f'));logger['debug'](_0xf057('0x20'),_0x3847ed,_0xf057('0x1f'),JSON['stringify'](_0x3cf590));if(_0x3cf590[_0xf057('0x21')]){if(_0x3cf590[_0xf057('0x21')][_0xf057('0x22')]===0x1f4){logger[_0xf057('0x21')](_0xf057('0x23'),_0x3847ed,_0x3cf590['error']['message']);return _0x5d3b38(_0x3cf590['error'][_0xf057('0x24')]);}logger[_0xf057('0x21')](_0xf057('0x23'),_0x3847ed,_0x3cf590[_0xf057('0x21')][_0xf057('0x24')]);return _0x359e2b(_0x3cf590[_0xf057('0x21')][_0xf057('0x24')]);}else{logger[_0xf057('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3847ed,_0xf057('0x1f'));_0x359e2b(_0x3cf590['result'][_0xf057('0x24')]);}})[_0xf057('0x25')](function(_0x210fd2){logger[_0xf057('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3847ed,_0x210fd2);_0x5d3b38(_0x210fd2);});});}function respondWithStatusCode(_0x173ca8,_0x2eff89){_0x2eff89=_0x2eff89||0xcc;return function(_0x5786c2){if(_0x5786c2){return _0x173ca8['sendStatus'](_0x2eff89);}return _0x173ca8['status'](_0x2eff89)['end']();};}function respondWithResult(_0x438e7e,_0x5666eb){_0x5666eb=_0x5666eb||0xc8;return function(_0x457d22){if(_0x457d22){return _0x438e7e[_0xf057('0x26')](_0x5666eb)[_0xf057('0x27')](_0x457d22);}};}function respondWithFilteredResult(_0x3f700e,_0x40ab42){return function(_0x40062d){if(_0x40062d){var _0x3b5bc6=_0x40062d['count'],_0x37a49c=_0x40ab42[_0xf057('0x28')],_0x35ac14=_0x40ab42['offset']+_0x40ab42[_0xf057('0x29')],_0x42b977;if(_0x35ac14>=_0x3b5bc6){_0x35ac14=_0x3b5bc6;_0x42b977=0xc8;}else{_0x42b977=0xce;}_0x3f700e[_0xf057('0x26')](_0x42b977);return _0x3f700e[_0xf057('0x2a')]('Content-Range',_0x37a49c+'-'+_0x35ac14+'/'+_0x3b5bc6)['json'](_0x40062d);}return null;};}function patchUpdates(_0x383aa3){return function(_0x54d309){try{jsonpatch[_0xf057('0x2b')](_0x54d309,_0x383aa3,!![]);}catch(_0x116480){return BPromise[_0xf057('0x2c')](_0x116480);}return _0x54d309[_0xf057('0x2d')]();};}function saveUpdates(_0x1883b2,_0x53bcf6){return function(_0xc9af1c){if(_0xc9af1c){return _0xc9af1c[_0xf057('0x2e')](_0x1883b2)[_0xf057('0x2f')](function(_0x464f3e){return _0x464f3e;});}return null;};}function removeEntity(_0x46eaa6,_0x3d78d5){return function(_0x56d6e0){if(_0x56d6e0){return _0x56d6e0[_0xf057('0x30')]()['then'](function(){_0x46eaa6[_0xf057('0x26')](0xcc)[_0xf057('0x31')]();});}};}function handleEntityNotFound(_0x1d38c7,_0x50079d){return function(_0x2ee824){if(!_0x2ee824){_0x1d38c7['sendStatus'](0x194);}return _0x2ee824;};}function handleError(_0x66cd42,_0x379d56){_0x379d56=_0x379d56||0x1f4;return function(_0x521e7b){logger[_0xf057('0x21')](_0x521e7b[_0xf057('0x32')]);if(_0x521e7b[_0xf057('0x33')]){delete _0x521e7b[_0xf057('0x33')];}_0x66cd42[_0xf057('0x26')](_0x379d56)['send'](_0x521e7b);};}exports[_0xf057('0x34')]=function(_0x530e52,_0x41554c){var _0x14c884={},_0x58255f={},_0x235dac={'count':0x0,'rows':[]};var _0x2bc625=_[_0xf057('0x35')](db[_0xf057('0x36')][_0xf057('0x37')],function(_0x1b0b48){return{'name':_0x1b0b48[_0xf057('0x38')],'type':_0x1b0b48[_0xf057('0x39')][_0xf057('0x3a')]};});_0x58255f[_0xf057('0x3b')]=_[_0xf057('0x35')](_0x2bc625,_0xf057('0x33'));_0x58255f[_0xf057('0x3c')]=_[_0xf057('0x3d')](_0x530e52[_0xf057('0x3c')]);_0x58255f[_0xf057('0x3e')]=_[_0xf057('0x3f')](_0x58255f[_0xf057('0x3b')],_0x58255f['query']);_0x14c884[_0xf057('0x40')]=_['intersection'](_0x58255f[_0xf057('0x3b')],qs[_0xf057('0x41')](_0x530e52[_0xf057('0x3c')][_0xf057('0x41')]));_0x14c884['attributes']=_0x14c884[_0xf057('0x40')]['length']?_0x14c884[_0xf057('0x40')]:_0x58255f[_0xf057('0x3b')];if(!_0x530e52[_0xf057('0x3c')][_0xf057('0x42')](_0xf057('0x43'))){_0x14c884[_0xf057('0x29')]=qs[_0xf057('0x29')](_0x530e52['query'][_0xf057('0x29')]);_0x14c884[_0xf057('0x28')]=qs[_0xf057('0x28')](_0x530e52[_0xf057('0x3c')][_0xf057('0x28')]);}_0x14c884[_0xf057('0x44')]=qs[_0xf057('0x45')](_0x530e52[_0xf057('0x3c')][_0xf057('0x45')]);_0x14c884['where']=qs[_0xf057('0x3e')](_[_0xf057('0x46')](_0x530e52[_0xf057('0x3c')],_0x58255f['filters']),_0x2bc625);if(_0x530e52['query'][_0xf057('0x47')]){_0x14c884[_0xf057('0x48')]=_[_0xf057('0x49')](_0x14c884[_0xf057('0x48')],{'$or':_[_0xf057('0x35')](_0x2bc625,function(_0x443c52){if(_0x443c52[_0xf057('0x39')]!=='VIRTUAL'){var _0x42769a={};_0x42769a[_0x443c52[_0xf057('0x33')]]={'$like':'%'+_0x530e52[_0xf057('0x3c')][_0xf057('0x47')]+'%'};return _0x42769a;}})});}_0x14c884=_[_0xf057('0x49')]({},_0x14c884,_0x530e52['options']);var _0x49c66f={'where':_0x14c884[_0xf057('0x48')]};return db[_0xf057('0x36')][_0xf057('0x4a')](_0x49c66f)[_0xf057('0x2f')](function(_0x4ed7c4){_0x235dac[_0xf057('0x4a')]=_0x4ed7c4;if(_0x530e52[_0xf057('0x3c')][_0xf057('0x4b')]){_0x14c884[_0xf057('0x4c')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xf057('0x4d')](_0x14c884);})[_0xf057('0x2f')](function(_0x4c2a99){_0x235dac[_0xf057('0x4e')]=_0x4c2a99;return _0x235dac;})[_0xf057('0x2f')](respondWithFilteredResult(_0x41554c,_0x14c884))[_0xf057('0x25')](handleError(_0x41554c,null));};exports[_0xf057('0x4f')]=function(_0x12e25c,_0x1c8ee9){var _0xa58e8e={'raw':![],'where':{'id':_0x12e25c[_0xf057('0x50')]['id']}},_0x3d7a8c={};_0x3d7a8c[_0xf057('0x3b')]=_[_0xf057('0x3d')](db[_0xf057('0x36')][_0xf057('0x37')]);_0x3d7a8c[_0xf057('0x3c')]=_['keys'](_0x12e25c['query']);_0x3d7a8c[_0xf057('0x3e')]=_[_0xf057('0x3f')](_0x3d7a8c[_0xf057('0x3b')],_0x3d7a8c[_0xf057('0x3c')]);_0xa58e8e[_0xf057('0x40')]=_[_0xf057('0x3f')](_0x3d7a8c[_0xf057('0x3b')],qs[_0xf057('0x41')](_0x12e25c[_0xf057('0x3c')][_0xf057('0x41')]));_0xa58e8e[_0xf057('0x40')]=_0xa58e8e[_0xf057('0x40')][_0xf057('0x51')]?_0xa58e8e[_0xf057('0x40')]:_0x3d7a8c['model'];if(_0x12e25c[_0xf057('0x3c')]['includeAll']){_0xa58e8e[_0xf057('0x4c')]=[{'all':!![]}];}_0xa58e8e=_[_0xf057('0x49')]({},_0xa58e8e,_0x12e25c[_0xf057('0x52')]);return db['SalesforceConfiguration']['find'](_0xa58e8e)[_0xf057('0x2f')](handleEntityNotFound(_0x1c8ee9,null))[_0xf057('0x2f')](respondWithResult(_0x1c8ee9,null))[_0xf057('0x25')](handleError(_0x1c8ee9,null));};exports[_0xf057('0x53')]=function(_0x2c9941,_0x3ee842){return db['SalesforceConfiguration'][_0xf057('0x53')](_0x2c9941[_0xf057('0x54')],{})['then'](respondWithResult(_0x3ee842,0xc9))[_0xf057('0x25')](handleError(_0x3ee842,null));};exports[_0xf057('0x2e')]=function(_0x3acfc8,_0x405feb){if(_0x3acfc8[_0xf057('0x54')]['id']){delete _0x3acfc8['body']['id'];}return db[_0xf057('0x36')][_0xf057('0x55')]({'where':{'id':_0x3acfc8[_0xf057('0x50')]['id']}})[_0xf057('0x2f')](handleEntityNotFound(_0x405feb,null))[_0xf057('0x2f')](saveUpdates(_0x3acfc8[_0xf057('0x54')],null))[_0xf057('0x2f')](respondWithResult(_0x405feb,null))['catch'](handleError(_0x405feb,null));};exports[_0xf057('0x30')]=function(_0x40ef13,_0x5bd8dd){return db['SalesforceConfiguration']['find']({'where':{'id':_0x40ef13['params']['id']}})['then'](handleEntityNotFound(_0x5bd8dd,null))[_0xf057('0x2f')](removeEntity(_0x5bd8dd,null))[_0xf057('0x25')](handleError(_0x5bd8dd,null));};exports[_0xf057('0x56')]=function(_0x293dce,_0x49444a,_0x3f24d0){var _0x16c3aa={};var _0x81f880={};var _0x1cb179;var _0x21c818;return db[_0xf057('0x36')]['findOne']({'where':{'id':_0x293dce[_0xf057('0x50')]['id']}})[_0xf057('0x2f')](handleEntityNotFound(_0x49444a,null))[_0xf057('0x2f')](function(_0x2dfa60){if(_0x2dfa60){_0x1cb179=_0x2dfa60;_0x81f880[_0xf057('0x3b')]=_[_0xf057('0x3d')](db[_0xf057('0x57')][_0xf057('0x37')]);_0x81f880[_0xf057('0x3c')]=_[_0xf057('0x3d')](_0x293dce[_0xf057('0x3c')]);_0x81f880[_0xf057('0x3e')]=_[_0xf057('0x3f')](_0x81f880[_0xf057('0x3b')],_0x81f880[_0xf057('0x3c')]);_0x16c3aa[_0xf057('0x40')]=_[_0xf057('0x3f')](_0x81f880[_0xf057('0x3b')],qs[_0xf057('0x41')](_0x293dce[_0xf057('0x3c')]['fields']));_0x16c3aa[_0xf057('0x40')]=_0x16c3aa[_0xf057('0x40')][_0xf057('0x51')]?_0x16c3aa['attributes']:_0x81f880[_0xf057('0x3b')];_0x16c3aa[_0xf057('0x44')]=qs[_0xf057('0x45')](_0x293dce['query'][_0xf057('0x45')]);_0x16c3aa[_0xf057('0x48')]=qs[_0xf057('0x3e')](_['pick'](_0x293dce[_0xf057('0x3c')],_0x81f880[_0xf057('0x3e')]));if(_0x293dce[_0xf057('0x3c')][_0xf057('0x47')]){_0x16c3aa['where']=_[_0xf057('0x49')](_0x16c3aa[_0xf057('0x48')],{'$or':_[_0xf057('0x35')](_0x16c3aa[_0xf057('0x40')],function(_0x72744b){var _0x485692={};_0x485692[_0x72744b]={'$like':'%'+_0x293dce[_0xf057('0x3c')]['filter']+'%'};return _0x485692;})});}_0x16c3aa=_[_0xf057('0x49')]({},_0x16c3aa,_0x293dce[_0xf057('0x52')]);return _0x1cb179[_0xf057('0x56')](_0x16c3aa);}})['then'](function(_0x29872b){if(_0x29872b){_0x21c818=_0x29872b['length'];if(!_0x293dce[_0xf057('0x3c')][_0xf057('0x42')]('nolimit')){_0x16c3aa[_0xf057('0x29')]=qs[_0xf057('0x29')](_0x293dce['query'][_0xf057('0x29')]);_0x16c3aa['offset']=qs[_0xf057('0x28')](_0x293dce['query']['offset']);}return _0x1cb179['getFields'](_0x16c3aa);}})[_0xf057('0x2f')](function(_0x1b7b71){if(_0x1b7b71){return _0x1b7b71?{'count':_0x21c818,'rows':_0x1b7b71}:null;}})[_0xf057('0x2f')](respondWithResult(_0x49444a,null))[_0xf057('0x25')](handleError(_0x49444a,null));};exports[_0xf057('0x58')]=function(_0x3ded5d,_0x5a17fd,_0x138f57){var _0x308178={};var _0x4c87aa={};var _0x580cce;var _0x522140;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3ded5d[_0xf057('0x50')]['id']}})[_0xf057('0x2f')](handleEntityNotFound(_0x5a17fd,null))[_0xf057('0x2f')](function(_0x8cc522){if(_0x8cc522){_0x580cce=_0x8cc522;_0x4c87aa['model']=_[_0xf057('0x3d')](db[_0xf057('0x57')]['rawAttributes']);_0x4c87aa[_0xf057('0x3c')]=_[_0xf057('0x3d')](_0x3ded5d['query']);_0x4c87aa['filters']=_[_0xf057('0x3f')](_0x4c87aa[_0xf057('0x3b')],_0x4c87aa[_0xf057('0x3c')]);_0x308178[_0xf057('0x40')]=_[_0xf057('0x3f')](_0x4c87aa[_0xf057('0x3b')],qs['fields'](_0x3ded5d[_0xf057('0x3c')]['fields']));_0x308178[_0xf057('0x40')]=_0x308178[_0xf057('0x40')][_0xf057('0x51')]?_0x308178[_0xf057('0x40')]:_0x4c87aa['model'];_0x308178[_0xf057('0x44')]=qs[_0xf057('0x45')](_0x3ded5d[_0xf057('0x3c')][_0xf057('0x45')]);_0x308178[_0xf057('0x48')]=qs[_0xf057('0x3e')](_[_0xf057('0x46')](_0x3ded5d[_0xf057('0x3c')],_0x4c87aa[_0xf057('0x3e')]));if(_0x3ded5d[_0xf057('0x3c')][_0xf057('0x47')]){_0x308178[_0xf057('0x48')]=_['merge'](_0x308178['where'],{'$or':_[_0xf057('0x35')](_0x308178[_0xf057('0x40')],function(_0x29c912){var _0x3c3e53={};_0x3c3e53[_0x29c912]={'$like':'%'+_0x3ded5d[_0xf057('0x3c')][_0xf057('0x47')]+'%'};return _0x3c3e53;})});}_0x308178=_[_0xf057('0x49')]({},_0x308178,_0x3ded5d[_0xf057('0x52')]);return _0x580cce[_0xf057('0x58')](_0x308178);}})[_0xf057('0x2f')](function(_0x490fe8){if(_0x490fe8){_0x522140=_0x490fe8['length'];if(!_0x3ded5d[_0xf057('0x3c')][_0xf057('0x42')](_0xf057('0x43'))){_0x308178[_0xf057('0x29')]=qs['limit'](_0x3ded5d[_0xf057('0x3c')]['limit']);_0x308178['offset']=qs[_0xf057('0x28')](_0x3ded5d[_0xf057('0x3c')][_0xf057('0x28')]);}return _0x580cce['getSubjects'](_0x308178);}})[_0xf057('0x2f')](function(_0x1d48dc){if(_0x1d48dc){return _0x1d48dc?{'count':_0x522140,'rows':_0x1d48dc}:null;}})[_0xf057('0x2f')](respondWithResult(_0x5a17fd,null))[_0xf057('0x25')](handleError(_0x5a17fd,null));};exports[_0xf057('0x59')]=function(_0x57f694,_0x7826de,_0x217fc9){var _0x3702fe={};var _0x2236e3={};var _0xdf7693;var _0x5cf74f;return db['SalesforceConfiguration'][_0xf057('0x5a')]({'where':{'id':_0x57f694['params']['id']}})[_0xf057('0x2f')](handleEntityNotFound(_0x7826de,null))['then'](function(_0x5a81ae){if(_0x5a81ae){_0xdf7693=_0x5a81ae;_0x2236e3[_0xf057('0x3b')]=_[_0xf057('0x3d')](db[_0xf057('0x57')][_0xf057('0x37')]);_0x2236e3[_0xf057('0x3c')]=_[_0xf057('0x3d')](_0x57f694[_0xf057('0x3c')]);_0x2236e3[_0xf057('0x3e')]=_['intersection'](_0x2236e3[_0xf057('0x3b')],_0x2236e3[_0xf057('0x3c')]);_0x3702fe[_0xf057('0x40')]=_[_0xf057('0x3f')](_0x2236e3['model'],qs[_0xf057('0x41')](_0x57f694[_0xf057('0x3c')][_0xf057('0x41')]));_0x3702fe['attributes']=_0x3702fe[_0xf057('0x40')][_0xf057('0x51')]?_0x3702fe[_0xf057('0x40')]:_0x2236e3[_0xf057('0x3b')];_0x3702fe[_0xf057('0x44')]=qs['sort'](_0x57f694['query'][_0xf057('0x45')]);_0x3702fe['where']=qs[_0xf057('0x3e')](_[_0xf057('0x46')](_0x57f694[_0xf057('0x3c')],_0x2236e3['filters']));if(_0x57f694[_0xf057('0x3c')][_0xf057('0x47')]){_0x3702fe['where']=_['merge'](_0x3702fe[_0xf057('0x48')],{'$or':_[_0xf057('0x35')](_0x3702fe[_0xf057('0x40')],function(_0x5bdb94){var _0x2a09f0={};_0x2a09f0[_0x5bdb94]={'$like':'%'+_0x57f694[_0xf057('0x3c')][_0xf057('0x47')]+'%'};return _0x2a09f0;})});}_0x3702fe=_[_0xf057('0x49')]({},_0x3702fe,_0x57f694[_0xf057('0x52')]);return _0xdf7693[_0xf057('0x59')](_0x3702fe);}})[_0xf057('0x2f')](function(_0x5cd14d){if(_0x5cd14d){_0x5cf74f=_0x5cd14d['length'];if(!_0x57f694[_0xf057('0x3c')][_0xf057('0x42')](_0xf057('0x43'))){_0x3702fe['limit']=qs['limit'](_0x57f694['query']['limit']);_0x3702fe['offset']=qs[_0xf057('0x28')](_0x57f694[_0xf057('0x3c')][_0xf057('0x28')]);}return _0xdf7693[_0xf057('0x59')](_0x3702fe);}})[_0xf057('0x2f')](function(_0xb53821){if(_0xb53821){return _0xb53821?{'count':_0x5cf74f,'rows':_0xb53821}:null;}})[_0xf057('0x2f')](respondWithResult(_0x7826de,null))[_0xf057('0x25')](handleError(_0x7826de,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 93ede55..be8f6c5 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 _0x3011=['path','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','lodash','util','moment','request-promise'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x3011,0x1ec));var _0x1301=function(_0x5c1255,_0xe7aeff){_0x5c1255=_0x5c1255-0x0;var _0x1824d8=_0x3011[_0x5c1255];return _0x1824d8;};'use strict';var _=require(_0x1301('0x0'));var util=require(_0x1301('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1301('0x2'));var BPromise=require('bluebird');var rp=require(_0x1301('0x3'));var fs=require('fs');var path=require(_0x1301('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1301('0x5'));module[_0x1301('0x6')]=function(_0x5b5fac,_0x2f7b22){return _0x5b5fac['define'](_0x1301('0x7'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeed7=['SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x1f3e88,_0x583f45){var _0x419b01=function(_0x21deae){while(--_0x21deae){_0x1f3e88['push'](_0x1f3e88['shift']());}};_0x419b01(++_0x583f45);}(_0xeed7,0x105));var _0x7eed=function(_0x585ca1,_0x40c937){_0x585ca1=_0x585ca1-0x0;var _0x5309c2=_0xeed7[_0x585ca1];return _0x5309c2;};'use strict';var _=require(_0x7eed('0x0'));var util=require(_0x7eed('0x1'));var logger=require(_0x7eed('0x2'))(_0x7eed('0x3'));var moment=require(_0x7eed('0x4'));var BPromise=require(_0x7eed('0x5'));var rp=require(_0x7eed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7eed('0x7'));var config=require(_0x7eed('0x8'));var attributes=require(_0x7eed('0x9'));module[_0x7eed('0xa')]=function(_0x575ecb,_0x30834c){return _0x575ecb[_0x7eed('0xb')](_0x7eed('0xc'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9ba9d68..396b338 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 _0xe41c=['rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cd134,_0x55c52b){var _0xe27752=function(_0xb9222c){while(--_0xb9222c){_0x4cd134['push'](_0x4cd134['shift']());}};_0xe27752(++_0x55c52b);}(_0xe41c,0x168));var _0xce41=function(_0x200e69,_0x25ee56){_0x200e69=_0x200e69-0x0;var _0x105241=_0xe41c[_0x200e69];return _0x105241;};'use strict';var _=require(_0xce41('0x0'));var util=require('util');var moment=require(_0xce41('0x1'));var BPromise=require(_0xce41('0x2'));var rs=require(_0xce41('0x3'));var fs=require('fs');var Redis=require(_0xce41('0x4'));var db=require(_0xce41('0x5'))['db'];var utils=require(_0xce41('0x6'));var logger=require(_0xce41('0x7'))(_0xce41('0x8'));var config=require(_0xce41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xce41('0xa')][_0xce41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f3b05,_0x17cd57,_0x154341){return new BPromise(function(_0x4e9074,_0x339ff5){return client[_0xce41('0xc')](_0x5f3b05,_0x154341)[_0xce41('0xd')](function(_0x4bd9b7){logger['info'](_0xce41('0xe'),_0x17cd57,_0xce41('0xf'));logger['debug'](_0xce41('0x10'),_0x17cd57,_0xce41('0xf'),JSON['stringify'](_0x4bd9b7));if(_0x4bd9b7[_0xce41('0x11')]){if(_0x4bd9b7[_0xce41('0x11')][_0xce41('0x12')]===0x1f4){logger[_0xce41('0x11')](_0xce41('0xe'),_0x17cd57,_0x4bd9b7['error'][_0xce41('0x13')]);return _0x339ff5(_0x4bd9b7[_0xce41('0x11')][_0xce41('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x17cd57,_0x4bd9b7['error'][_0xce41('0x13')]);return _0x4e9074(_0x4bd9b7[_0xce41('0x11')][_0xce41('0x13')]);}else{logger[_0xce41('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17cd57,_0xce41('0xf'));_0x4e9074(_0x4bd9b7[_0xce41('0x15')][_0xce41('0x13')]);}})[_0xce41('0x16')](function(_0x225154){logger[_0xce41('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17cd57,_0x225154);_0x339ff5(_0x225154);});});} \ No newline at end of file +var _0x7fa9=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0xb28846,_0x54736a){var _0x3c2518=function(_0x559ede){while(--_0x559ede){_0xb28846['push'](_0xb28846['shift']());}};_0x3c2518(++_0x54736a);}(_0x7fa9,0x1ab));var _0x97fa=function(_0x22856d,_0x1abe86){_0x22856d=_0x22856d-0x0;var _0x517ae3=_0x7fa9[_0x22856d];return _0x517ae3;};'use strict';var _=require('lodash');var util=require(_0x97fa('0x0'));var moment=require(_0x97fa('0x1'));var BPromise=require(_0x97fa('0x2'));var rs=require(_0x97fa('0x3'));var fs=require('fs');var Redis=require(_0x97fa('0x4'));var db=require(_0x97fa('0x5'))['db'];var utils=require(_0x97fa('0x6'));var logger=require(_0x97fa('0x7'))(_0x97fa('0x8'));var config=require(_0x97fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x97fa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565c38,_0x461089,_0x16103e){return new BPromise(function(_0x583223,_0x4ebee1){return client['request'](_0x565c38,_0x16103e)[_0x97fa('0xb')](function(_0x4d5ca2){logger[_0x97fa('0xc')](_0x97fa('0xd'),_0x461089,'request\x20sent');logger['debug'](_0x97fa('0xe'),_0x461089,_0x97fa('0xf'),JSON[_0x97fa('0x10')](_0x4d5ca2));if(_0x4d5ca2[_0x97fa('0x11')]){if(_0x4d5ca2['error'][_0x97fa('0x12')]===0x1f4){logger[_0x97fa('0x11')](_0x97fa('0xd'),_0x461089,_0x4d5ca2[_0x97fa('0x11')][_0x97fa('0x13')]);return _0x4ebee1(_0x4d5ca2[_0x97fa('0x11')][_0x97fa('0x13')]);}logger[_0x97fa('0x11')](_0x97fa('0xd'),_0x461089,_0x4d5ca2[_0x97fa('0x11')][_0x97fa('0x13')]);return _0x583223(_0x4d5ca2[_0x97fa('0x11')][_0x97fa('0x13')]);}else{logger[_0x97fa('0xc')](_0x97fa('0xd'),_0x461089,_0x97fa('0xf'));_0x583223(_0x4d5ca2['result'][_0x97fa('0x13')]);}})[_0x97fa('0x14')](function(_0x456337){logger[_0x97fa('0x11')](_0x97fa('0xd'),_0x461089,_0x456337);_0x4ebee1(_0x456337);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 1757c2e..e115bab 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 _0x0adf=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x54cfaf,_0x59f305){var _0x4e80e3=function(_0x4ee6b7){while(--_0x4ee6b7){_0x54cfaf['push'](_0x54cfaf['shift']());}};_0x4e80e3(++_0x59f305);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x246971,_0x1670a2){_0x246971=_0x246971-0x0;var _0x580306=_0x0adf[_0x246971];return _0x580306;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var auth=require(_0xf0ad('0x5'));var interaction=require(_0xf0ad('0x6'));var config=require(_0xf0ad('0x7'));var controller=require(_0xf0ad('0x8'));router[_0xf0ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0xa')]);router['get'](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xf')]);router[_0xf0ad('0x10')]('/:id',auth[_0xf0ad('0xc')](),controller['update']);router[_0xf0ad('0x11')](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0x12')]);module[_0xf0ad('0x13')]=router; \ No newline at end of file +var _0xe0ae=['../../config/environment','get','/:id','isAuthenticated','show','update','exports','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x5e6bc8,_0x269dc9){var _0x219c61=function(_0x5cb39e){while(--_0x5cb39e){_0x5e6bc8['push'](_0x5e6bc8['shift']());}};_0x219c61(++_0x269dc9);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xe0ae[_0x4a93bb];return _0x208468;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xee0a('0x3'));var config=require(_0xee0a('0x4'));var controller=require('./intSalesforceField.controller');router[_0xee0a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee0a('0x5')](_0xee0a('0x6'),auth[_0xee0a('0x7')](),controller[_0xee0a('0x8')]);router['post']('/',auth[_0xee0a('0x7')](),controller['create']);router['put'](_0xee0a('0x6'),auth[_0xee0a('0x7')](),controller[_0xee0a('0x9')]);router['delete'](_0xee0a('0x6'),auth[_0xee0a('0x7')](),controller['destroy']);module[_0xee0a('0xa')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index be902a3..7c00db4 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 _0xf404=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xf404,0xfc));var _0x4f40=function(_0x3a022c,_0x415080){_0x3a022c=_0x3a022c-0x0;var _0x31518e=_0xf404[_0x3a022c];return _0x31518e;};'use strict';var Sequelize=require(_0x4f40('0x0'));module[_0x4f40('0x1')]={'type':{'type':Sequelize[_0x4f40('0x2')](_0x4f40('0x3'),_0x4f40('0x4'),_0x4f40('0x5'),_0x4f40('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4f40('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4f40('0x2')](_0x4f40('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4f40('0x7')]},'variableName':{'type':Sequelize[_0x4f40('0x7')]}}; \ No newline at end of file +var _0x86d7=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x86d7,0x184));var _0x786d=function(_0x121e71,_0x3d3c13){_0x121e71=_0x121e71-0x0;var _0x2acc8c=_0x86d7[_0x121e71];return _0x2acc8c;};'use strict';var Sequelize=require(_0x786d('0x0'));module['exports']={'type':{'type':Sequelize[_0x786d('0x1')](_0x786d('0x2'),_0x786d('0x3'),_0x786d('0x4'),_0x786d('0x5')),'defaultValue':_0x786d('0x2')},'content':{'type':Sequelize[_0x786d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x786d('0x1')](_0x786d('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x786d('0x6')]},'variableName':{'type':Sequelize[_0x786d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e1a0ed6..499c822 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 _0x6748=['fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SalesforceField','rawAttributes'];(function(_0x4b5a92,_0x2cf3d6){var _0x439fab=function(_0x122ae4){while(--_0x122ae4){_0x4b5a92['push'](_0x4b5a92['shift']());}};_0x439fab(++_0x2cf3d6);}(_0x6748,0xae));var _0x8674=function(_0x2d7371,_0x4f0afe){_0x2d7371=_0x2d7371-0x0;var _0x22e511=_0x6748[_0x2d7371];return _0x22e511;};'use strict';var pdf=require(_0x8674('0x0'));var emlformat=require(_0x8674('0x1'));var rimraf=require(_0x8674('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8674('0x3'));var rp=require(_0x8674('0x4'));var moment=require(_0x8674('0x5'));var BPromise=require(_0x8674('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8674('0x7'));var sox=require(_0x8674('0x8'));var csv=require('to-csv');var ejs=require(_0x8674('0x9'));var fs=require('fs');var _=require(_0x8674('0xa'));var squel=require('squel');var crypto=require(_0x8674('0xb'));var jsforce=require(_0x8674('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8674('0xd'));var querystring=require(_0x8674('0xe'));var Papa=require('papaparse');var Redis=require(_0x8674('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8674('0x10'));var hardwareService=require(_0x8674('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8674('0x12'));var config=require(_0x8674('0x13'));var db=require(_0x8674('0x14'))['db'];function respondWithStatusCode(_0x760a18,_0x40ffd3){_0x40ffd3=_0x40ffd3||0xcc;return function(_0x46eadc){if(_0x46eadc){return _0x760a18['sendStatus'](_0x40ffd3);}return _0x760a18[_0x8674('0x15')](_0x40ffd3)[_0x8674('0x16')]();};}function respondWithResult(_0x4f3532,_0xa63bad){_0xa63bad=_0xa63bad||0xc8;return function(_0x21225c){if(_0x21225c){return _0x4f3532[_0x8674('0x15')](_0xa63bad)['json'](_0x21225c);}};}function respondWithFilteredResult(_0x2fe59a,_0x2de02d){return function(_0x28c950){if(_0x28c950){var _0x25f1de=_0x28c950['count'],_0x43effb=_0x2de02d[_0x8674('0x17')],_0x2e1654=_0x2de02d['offset']+_0x2de02d[_0x8674('0x18')],_0x432c3e;if(_0x2e1654>=_0x25f1de){_0x2e1654=_0x25f1de;_0x432c3e=0xc8;}else{_0x432c3e=0xce;}_0x2fe59a[_0x8674('0x15')](_0x432c3e);return _0x2fe59a[_0x8674('0x19')](_0x8674('0x1a'),_0x43effb+'-'+_0x2e1654+'/'+_0x25f1de)['json'](_0x28c950);}return null;};}function patchUpdates(_0x12a496){return function(_0x31234b){try{jsonpatch[_0x8674('0x1b')](_0x31234b,_0x12a496,!![]);}catch(_0xa97f91){return BPromise[_0x8674('0x1c')](_0xa97f91);}return _0x31234b[_0x8674('0x1d')]();};}function saveUpdates(_0x34c2af,_0x37d76a){return function(_0x57fae3){if(_0x57fae3){return _0x57fae3['update'](_0x34c2af)['then'](function(_0x42e878){return _0x42e878;});}return null;};}function removeEntity(_0x3c70db,_0xe1fdd2){return function(_0x18fbb7){if(_0x18fbb7){return _0x18fbb7[_0x8674('0x1e')]()[_0x8674('0x1f')](function(){_0x3c70db[_0x8674('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341b8f,_0x18131b){return function(_0x9f6a6){if(!_0x9f6a6){_0x341b8f['sendStatus'](0x194);}return _0x9f6a6;};}function handleError(_0x4560c7,_0x334039){_0x334039=_0x334039||0x1f4;return function(_0x2415e7){logger[_0x8674('0x20')](_0x2415e7[_0x8674('0x21')]);if(_0x2415e7['name']){delete _0x2415e7[_0x8674('0x22')];}_0x4560c7[_0x8674('0x15')](_0x334039)['send'](_0x2415e7);};}exports[_0x8674('0x23')]=function(_0x1f51a9,_0x4282a9){var _0x46634a={},_0x4779a0={},_0x2f9840={'count':0x0,'rows':[]};var _0x21b8e1=_[_0x8674('0x24')](db[_0x8674('0x25')][_0x8674('0x26')],function(_0x2908c6){return{'name':_0x2908c6[_0x8674('0x27')],'type':_0x2908c6[_0x8674('0x28')][_0x8674('0x29')]};});_0x4779a0['model']=_[_0x8674('0x24')](_0x21b8e1,_0x8674('0x22'));_0x4779a0[_0x8674('0x2a')]=_['keys'](_0x1f51a9[_0x8674('0x2a')]);_0x4779a0['filters']=_[_0x8674('0x2b')](_0x4779a0[_0x8674('0x2c')],_0x4779a0['query']);_0x46634a[_0x8674('0x2d')]=_[_0x8674('0x2b')](_0x4779a0['model'],qs[_0x8674('0x2e')](_0x1f51a9[_0x8674('0x2a')]['fields']));_0x46634a['attributes']=_0x46634a[_0x8674('0x2d')]['length']?_0x46634a['attributes']:_0x4779a0['model'];if(!_0x1f51a9[_0x8674('0x2a')][_0x8674('0x2f')](_0x8674('0x30'))){_0x46634a[_0x8674('0x18')]=qs[_0x8674('0x18')](_0x1f51a9[_0x8674('0x2a')][_0x8674('0x18')]);_0x46634a[_0x8674('0x17')]=qs[_0x8674('0x17')](_0x1f51a9[_0x8674('0x2a')][_0x8674('0x17')]);}_0x46634a[_0x8674('0x31')]=qs[_0x8674('0x32')](_0x1f51a9[_0x8674('0x2a')][_0x8674('0x32')]);_0x46634a['where']=qs[_0x8674('0x33')](_[_0x8674('0x34')](_0x1f51a9[_0x8674('0x2a')],_0x4779a0[_0x8674('0x33')]),_0x21b8e1);if(_0x1f51a9[_0x8674('0x2a')][_0x8674('0x35')]){_0x46634a[_0x8674('0x36')]=_[_0x8674('0x37')](_0x46634a[_0x8674('0x36')],{'$or':_[_0x8674('0x24')](_0x21b8e1,function(_0x1a6920){if(_0x1a6920[_0x8674('0x28')]!=='VIRTUAL'){var _0x3d2e9e={};_0x3d2e9e[_0x1a6920[_0x8674('0x22')]]={'$like':'%'+_0x1f51a9[_0x8674('0x2a')][_0x8674('0x35')]+'%'};return _0x3d2e9e;}})});}_0x46634a=_[_0x8674('0x37')]({},_0x46634a,_0x1f51a9['options']);var _0x2db4e1={'where':_0x46634a[_0x8674('0x36')]};return db[_0x8674('0x25')][_0x8674('0x38')](_0x2db4e1)['then'](function(_0x4da151){_0x2f9840[_0x8674('0x38')]=_0x4da151;if(_0x1f51a9['query'][_0x8674('0x39')]){_0x46634a[_0x8674('0x3a')]=[{'all':!![]}];}return db[_0x8674('0x25')][_0x8674('0x3b')](_0x46634a);})[_0x8674('0x1f')](function(_0x18cbd2){_0x2f9840[_0x8674('0x3c')]=_0x18cbd2;return _0x2f9840;})[_0x8674('0x1f')](respondWithFilteredResult(_0x4282a9,_0x46634a))[_0x8674('0x3d')](handleError(_0x4282a9,null));};exports[_0x8674('0x3e')]=function(_0xf59e4,_0x5514de){var _0x2edd10={'raw':!![],'where':{'id':_0xf59e4[_0x8674('0x3f')]['id']}},_0x591231={};_0x591231['model']=_[_0x8674('0x40')](db[_0x8674('0x25')][_0x8674('0x26')]);_0x591231[_0x8674('0x2a')]=_[_0x8674('0x40')](_0xf59e4[_0x8674('0x2a')]);_0x591231[_0x8674('0x33')]=_['intersection'](_0x591231[_0x8674('0x2c')],_0x591231['query']);_0x2edd10['attributes']=_[_0x8674('0x2b')](_0x591231[_0x8674('0x2c')],qs['fields'](_0xf59e4['query'][_0x8674('0x2e')]));_0x2edd10['attributes']=_0x2edd10['attributes'][_0x8674('0x41')]?_0x2edd10[_0x8674('0x2d')]:_0x591231[_0x8674('0x2c')];if(_0xf59e4['query'][_0x8674('0x39')]){_0x2edd10['include']=[{'all':!![]}];}_0x2edd10=_['merge']({},_0x2edd10,_0xf59e4[_0x8674('0x42')]);return db['SalesforceField'][_0x8674('0x43')](_0x2edd10)[_0x8674('0x1f')](handleEntityNotFound(_0x5514de,null))[_0x8674('0x1f')](respondWithResult(_0x5514de,null))[_0x8674('0x3d')](handleError(_0x5514de,null));};exports['create']=function(_0x4bb9e2,_0x5b0c60){return db[_0x8674('0x25')][_0x8674('0x44')](_0x4bb9e2[_0x8674('0x45')],{})[_0x8674('0x1f')](respondWithResult(_0x5b0c60,0xc9))[_0x8674('0x3d')](handleError(_0x5b0c60,null));};exports[_0x8674('0x46')]=function(_0x51f237,_0xebb5ee){if(_0x51f237[_0x8674('0x45')]['id']){delete _0x51f237[_0x8674('0x45')]['id'];}return db[_0x8674('0x25')]['find']({'where':{'id':_0x51f237['params']['id']}})[_0x8674('0x1f')](handleEntityNotFound(_0xebb5ee,null))['then'](saveUpdates(_0x51f237[_0x8674('0x45')],null))[_0x8674('0x1f')](respondWithResult(_0xebb5ee,null))[_0x8674('0x3d')](handleError(_0xebb5ee,null));};exports[_0x8674('0x1e')]=function(_0x168347,_0x1ca30c){return db[_0x8674('0x25')][_0x8674('0x43')]({'where':{'id':_0x168347[_0x8674('0x3f')]['id']}})[_0x8674('0x1f')](handleEntityNotFound(_0x1ca30c,null))[_0x8674('0x1f')](removeEntity(_0x1ca30c,null))['catch'](handleError(_0x1ca30c,null));}; \ No newline at end of file +var _0x1b5e=['to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','show','include','merge','find','create','body','params','eml-format','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x1b5e,0x18b));var _0xe1b5=function(_0x3e007d,_0x4cfa51){_0x3e007d=_0x3e007d-0x0;var _0x58697b=_0x1b5e[_0x3e007d];return _0x58697b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe1b5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe1b5('0x2'));var Mustache=require(_0xe1b5('0x3'));var util=require(_0xe1b5('0x4'));var path=require(_0xe1b5('0x5'));var sox=require(_0xe1b5('0x6'));var csv=require(_0xe1b5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe1b5('0x8'));var squel=require(_0xe1b5('0x9'));var crypto=require(_0xe1b5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe1b5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe1b5('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe1b5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe1b5('0xe'));var hardwareService=require(_0xe1b5('0xf'));var logger=require(_0xe1b5('0x10'))('api');var utils=require(_0xe1b5('0x11'));var config=require(_0xe1b5('0x12'));var db=require(_0xe1b5('0x13'))['db'];function respondWithStatusCode(_0x4cf6c2,_0x4a31ae){_0x4a31ae=_0x4a31ae||0xcc;return function(_0x1fbc8b){if(_0x1fbc8b){return _0x4cf6c2[_0xe1b5('0x14')](_0x4a31ae);}return _0x4cf6c2[_0xe1b5('0x15')](_0x4a31ae)[_0xe1b5('0x16')]();};}function respondWithResult(_0x58fa50,_0x5ea08a){_0x5ea08a=_0x5ea08a||0xc8;return function(_0x3bdd47){if(_0x3bdd47){return _0x58fa50[_0xe1b5('0x15')](_0x5ea08a)[_0xe1b5('0x17')](_0x3bdd47);}};}function respondWithFilteredResult(_0x211cff,_0x43a64b){return function(_0x1a4b31){if(_0x1a4b31){var _0xcb1022=_0x1a4b31[_0xe1b5('0x18')],_0x141547=_0x43a64b[_0xe1b5('0x19')],_0x1643c7=_0x43a64b[_0xe1b5('0x19')]+_0x43a64b[_0xe1b5('0x1a')],_0x592898;if(_0x1643c7>=_0xcb1022){_0x1643c7=_0xcb1022;_0x592898=0xc8;}else{_0x592898=0xce;}_0x211cff[_0xe1b5('0x15')](_0x592898);return _0x211cff[_0xe1b5('0x1b')]('Content-Range',_0x141547+'-'+_0x1643c7+'/'+_0xcb1022)[_0xe1b5('0x17')](_0x1a4b31);}return null;};}function patchUpdates(_0x5ba4e9){return function(_0x416de5){try{jsonpatch['apply'](_0x416de5,_0x5ba4e9,!![]);}catch(_0x9ba7a2){return BPromise['reject'](_0x9ba7a2);}return _0x416de5[_0xe1b5('0x1c')]();};}function saveUpdates(_0x40a7dd,_0x763723){return function(_0x108ce3){if(_0x108ce3){return _0x108ce3['update'](_0x40a7dd)[_0xe1b5('0x1d')](function(_0x40e829){return _0x40e829;});}return null;};}function removeEntity(_0x26e84f,_0x4034d2){return function(_0x38b4ff){if(_0x38b4ff){return _0x38b4ff[_0xe1b5('0x1e')]()[_0xe1b5('0x1d')](function(){_0x26e84f[_0xe1b5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5d1a,_0xf711c2){return function(_0x490c89){if(!_0x490c89){_0x2a5d1a[_0xe1b5('0x14')](0x194);}return _0x490c89;};}function handleError(_0x55b630,_0x2e9f66){_0x2e9f66=_0x2e9f66||0x1f4;return function(_0x50e2a2){logger[_0xe1b5('0x1f')](_0x50e2a2[_0xe1b5('0x20')]);if(_0x50e2a2['name']){delete _0x50e2a2[_0xe1b5('0x21')];}_0x55b630[_0xe1b5('0x15')](_0x2e9f66)[_0xe1b5('0x22')](_0x50e2a2);};}exports[_0xe1b5('0x23')]=function(_0x15d700,_0x544fbf){var _0x3820e8={},_0x3facdc={},_0x38dbc5={'count':0x0,'rows':[]};var _0x5d16c9=_[_0xe1b5('0x24')](db[_0xe1b5('0x25')][_0xe1b5('0x26')],function(_0x53923d){return{'name':_0x53923d[_0xe1b5('0x27')],'type':_0x53923d[_0xe1b5('0x28')]['key']};});_0x3facdc['model']=_[_0xe1b5('0x24')](_0x5d16c9,_0xe1b5('0x21'));_0x3facdc[_0xe1b5('0x29')]=_[_0xe1b5('0x2a')](_0x15d700[_0xe1b5('0x29')]);_0x3facdc[_0xe1b5('0x2b')]=_[_0xe1b5('0x2c')](_0x3facdc['model'],_0x3facdc[_0xe1b5('0x29')]);_0x3820e8[_0xe1b5('0x2d')]=_[_0xe1b5('0x2c')](_0x3facdc[_0xe1b5('0x2e')],qs[_0xe1b5('0x2f')](_0x15d700[_0xe1b5('0x29')][_0xe1b5('0x2f')]));_0x3820e8[_0xe1b5('0x2d')]=_0x3820e8[_0xe1b5('0x2d')][_0xe1b5('0x30')]?_0x3820e8[_0xe1b5('0x2d')]:_0x3facdc[_0xe1b5('0x2e')];if(!_0x15d700[_0xe1b5('0x29')][_0xe1b5('0x31')]('nolimit')){_0x3820e8[_0xe1b5('0x1a')]=qs[_0xe1b5('0x1a')](_0x15d700[_0xe1b5('0x29')][_0xe1b5('0x1a')]);_0x3820e8[_0xe1b5('0x19')]=qs['offset'](_0x15d700[_0xe1b5('0x29')]['offset']);}_0x3820e8[_0xe1b5('0x32')]=qs[_0xe1b5('0x33')](_0x15d700[_0xe1b5('0x29')]['sort']);_0x3820e8['where']=qs['filters'](_[_0xe1b5('0x34')](_0x15d700[_0xe1b5('0x29')],_0x3facdc[_0xe1b5('0x2b')]),_0x5d16c9);if(_0x15d700['query'][_0xe1b5('0x35')]){_0x3820e8[_0xe1b5('0x36')]=_['merge'](_0x3820e8[_0xe1b5('0x36')],{'$or':_[_0xe1b5('0x24')](_0x5d16c9,function(_0x14f58f){if(_0x14f58f['type']!==_0xe1b5('0x37')){var _0x34625f={};_0x34625f[_0x14f58f['name']]={'$like':'%'+_0x15d700[_0xe1b5('0x29')][_0xe1b5('0x35')]+'%'};return _0x34625f;}})});}_0x3820e8=_['merge']({},_0x3820e8,_0x15d700[_0xe1b5('0x38')]);var _0x20efa5={'where':_0x3820e8[_0xe1b5('0x36')]};return db[_0xe1b5('0x25')]['count'](_0x20efa5)[_0xe1b5('0x1d')](function(_0x4634b2){_0x38dbc5[_0xe1b5('0x18')]=_0x4634b2;if(_0x15d700['query']['includeAll']){_0x3820e8['include']=[{'all':!![]}];}return db[_0xe1b5('0x25')][_0xe1b5('0x39')](_0x3820e8);})['then'](function(_0x1cc2c5){_0x38dbc5[_0xe1b5('0x3a')]=_0x1cc2c5;return _0x38dbc5;})[_0xe1b5('0x1d')](respondWithFilteredResult(_0x544fbf,_0x3820e8))[_0xe1b5('0x3b')](handleError(_0x544fbf,null));};exports[_0xe1b5('0x3c')]=function(_0x5dfa08,_0x188cf5){var _0x29b489={'raw':!![],'where':{'id':_0x5dfa08['params']['id']}},_0x2fd52={};_0x2fd52[_0xe1b5('0x2e')]=_[_0xe1b5('0x2a')](db[_0xe1b5('0x25')]['rawAttributes']);_0x2fd52['query']=_[_0xe1b5('0x2a')](_0x5dfa08[_0xe1b5('0x29')]);_0x2fd52['filters']=_[_0xe1b5('0x2c')](_0x2fd52[_0xe1b5('0x2e')],_0x2fd52[_0xe1b5('0x29')]);_0x29b489['attributes']=_[_0xe1b5('0x2c')](_0x2fd52[_0xe1b5('0x2e')],qs[_0xe1b5('0x2f')](_0x5dfa08[_0xe1b5('0x29')]['fields']));_0x29b489[_0xe1b5('0x2d')]=_0x29b489['attributes'][_0xe1b5('0x30')]?_0x29b489['attributes']:_0x2fd52[_0xe1b5('0x2e')];if(_0x5dfa08[_0xe1b5('0x29')]['includeAll']){_0x29b489[_0xe1b5('0x3d')]=[{'all':!![]}];}_0x29b489=_[_0xe1b5('0x3e')]({},_0x29b489,_0x5dfa08[_0xe1b5('0x38')]);return db['SalesforceField'][_0xe1b5('0x3f')](_0x29b489)[_0xe1b5('0x1d')](handleEntityNotFound(_0x188cf5,null))[_0xe1b5('0x1d')](respondWithResult(_0x188cf5,null))[_0xe1b5('0x3b')](handleError(_0x188cf5,null));};exports[_0xe1b5('0x40')]=function(_0x518eb3,_0xdc702d){return db[_0xe1b5('0x25')][_0xe1b5('0x40')](_0x518eb3[_0xe1b5('0x41')],{})[_0xe1b5('0x1d')](respondWithResult(_0xdc702d,0xc9))[_0xe1b5('0x3b')](handleError(_0xdc702d,null));};exports['update']=function(_0x4e110e,_0x281cea){if(_0x4e110e[_0xe1b5('0x41')]['id']){delete _0x4e110e[_0xe1b5('0x41')]['id'];}return db[_0xe1b5('0x25')][_0xe1b5('0x3f')]({'where':{'id':_0x4e110e[_0xe1b5('0x42')]['id']}})['then'](handleEntityNotFound(_0x281cea,null))[_0xe1b5('0x1d')](saveUpdates(_0x4e110e[_0xe1b5('0x41')],null))[_0xe1b5('0x1d')](respondWithResult(_0x281cea,null))['catch'](handleError(_0x281cea,null));};exports[_0xe1b5('0x1e')]=function(_0x3e1e0c,_0x426e81){return db['SalesforceField']['find']({'where':{'id':_0x3e1e0c[_0xe1b5('0x42')]['id']}})[_0xe1b5('0x1d')](handleEntityNotFound(_0x426e81,null))['then'](removeEntity(_0x426e81,null))[_0xe1b5('0x3b')](handleError(_0x426e81,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 56dd22e..52cec4d 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 _0xa14d=['./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xa14d,0x95));var _0xda14=function(_0x1d5531,_0x4e9bbb){_0x1d5531=_0x1d5531-0x0;var _0x105e17=_0xa14d[_0x1d5531];return _0x105e17;};'use strict';var _=require(_0xda14('0x0'));var util=require(_0xda14('0x1'));var logger=require('../../config/logger')(_0xda14('0x2'));var moment=require('moment');var BPromise=require(_0xda14('0x3'));var rp=require(_0xda14('0x4'));var fs=require('fs');var path=require(_0xda14('0x5'));var rimraf=require(_0xda14('0x6'));var config=require('../../config/environment');var attributes=require(_0xda14('0x7'));module[_0xda14('0x8')]=function(_0x27a4a8,_0x4db5ed){return _0x27a4a8['define'](_0xda14('0x9'),attributes,{'tableName':_0xda14('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xda14('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5388=['rimraf','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d63bb,_0x45c2e0){var _0x1f95b3=function(_0x5836db){while(--_0x5836db){_0x2d63bb['push'](_0x2d63bb['shift']());}};_0x1f95b3(++_0x45c2e0);}(_0x5388,0x102));var _0x8538=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x5388[_0x53bcc3];return _0x47c959;};'use strict';var _=require(_0x8538('0x0'));var util=require(_0x8538('0x1'));var logger=require(_0x8538('0x2'))(_0x8538('0x3'));var moment=require(_0x8538('0x4'));var BPromise=require(_0x8538('0x5'));var rp=require(_0x8538('0x6'));var fs=require('fs');var path=require(_0x8538('0x7'));var rimraf=require(_0x8538('0x8'));var config=require('../../config/environment');var attributes=require(_0x8538('0x9'));module['exports']=function(_0x3c8190,_0x39251e){return _0x3c8190[_0x8538('0xa')]('SalesforceField',attributes,{'tableName':_0x8538('0xb'),'paranoid':![],'indexes':[{'name':_0x8538('0xc'),'fields':[_0x8538('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 6c3b1db..2e7d4bd 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x233d67,_0x24f881){var _0x5616e5=function(_0x1ae3bb){while(--_0x1ae3bb){_0x233d67['push'](_0x233d67['shift']());}};_0x5616e5(++_0x24f881);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xcb91[_0x54eab6];return _0x1e7435;};'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')]('SalesforceField,\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);});});} \ No newline at end of file +var _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x5c00,0x17e));var _0x05c0=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x5c00[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f4742bd..845013d 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 _0x2a56=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x3b3e87,_0x8c001b){var _0x42513f=function(_0x1989cf){while(--_0x1989cf){_0x3b3e87['push'](_0x3b3e87['shift']());}};_0x42513f(++_0x8c001b);}(_0x2a56,0xaf));var _0x62a5=function(_0x578b25,_0x5be828){_0x578b25=_0x578b25-0x0;var _0x5c533d=_0x2a56[_0x578b25];return _0x5c533d;};'use strict';var multer=require('multer');var util=require(_0x62a5('0x0'));var path=require('path');var timeout=require(_0x62a5('0x1'));var express=require(_0x62a5('0x2'));var router=express[_0x62a5('0x3')]();var auth=require(_0x62a5('0x4'));var interaction=require(_0x62a5('0x5'));var config=require('../../config/environment');var controller=require(_0x62a5('0x6'));router[_0x62a5('0x7')]('/',auth[_0x62a5('0x8')](),controller[_0x62a5('0x9')]);router[_0x62a5('0x7')](_0x62a5('0xa'),auth[_0x62a5('0x8')](),controller[_0x62a5('0xb')]);router['get'](_0x62a5('0xc'),auth[_0x62a5('0x8')](),controller[_0x62a5('0xd')]);router[_0x62a5('0x7')](_0x62a5('0xe'),auth['isAuthenticated'](),controller[_0x62a5('0xf')]);router[_0x62a5('0x10')]('/',auth[_0x62a5('0x8')](),controller[_0x62a5('0x11')]);router[_0x62a5('0x10')](_0x62a5('0xc'),auth[_0x62a5('0x8')](),controller[_0x62a5('0x12')]);router[_0x62a5('0x13')]('/:id',auth[_0x62a5('0x8')](),controller[_0x62a5('0x14')]);router[_0x62a5('0x15')](_0x62a5('0xa'),auth['isAuthenticated'](),controller[_0x62a5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8585=['put','update','delete','destroy','exports','multer','util','path','express','Router','./intServicenowAccount.controller','get','/:id','isAuthenticated','/:id/configurations','/:id/fields','post','create','addConfiguration'];(function(_0x28d7fb,_0x50aa9d){var _0x234477=function(_0x384a51){while(--_0x384a51){_0x28d7fb['push'](_0x28d7fb['shift']());}};_0x234477(++_0x50aa9d);}(_0x8585,0x64));var _0x5858=function(_0x138f02,_0x37bdc0){_0x138f02=_0x138f02-0x0;var _0x41fe82=_0x8585[_0x138f02];return _0x41fe82;};'use strict';var multer=require(_0x5858('0x0'));var util=require(_0x5858('0x1'));var path=require(_0x5858('0x2'));var timeout=require('connect-timeout');var express=require(_0x5858('0x3'));var router=express[_0x5858('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5858('0x5'));router[_0x5858('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5858('0x6')](_0x5858('0x7'),auth[_0x5858('0x8')](),controller['show']);router['get'](_0x5858('0x9'),auth[_0x5858('0x8')](),controller['getConfigurations']);router['get'](_0x5858('0xa'),auth[_0x5858('0x8')](),controller['getFields']);router[_0x5858('0xb')]('/',auth[_0x5858('0x8')](),controller[_0x5858('0xc')]);router[_0x5858('0xb')](_0x5858('0x9'),auth[_0x5858('0x8')](),controller[_0x5858('0xd')]);router[_0x5858('0xe')](_0x5858('0x7'),auth['isAuthenticated'](),controller[_0x5858('0xf')]);router[_0x5858('0x10')](_0x5858('0x7'),auth['isAuthenticated'](),controller[_0x5858('0x11')]);module[_0x5858('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 77e52da..74452f2 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 _0x9314=['remoteUri','exports','STRING','username'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9314,0x181));var _0x4931=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9314[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require('sequelize');module[_0x4931('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4931('0x1')]},'username':{'type':Sequelize[_0x4931('0x1')],'unique':_0x4931('0x2')},'password':{'type':Sequelize[_0x4931('0x1')]},'email':{'type':Sequelize[_0x4931('0x1')]},'remoteUri':{'type':Sequelize[_0x4931('0x1')],'unique':_0x4931('0x3')},'serverUrl':{'type':Sequelize[_0x4931('0x1')]}}; \ No newline at end of file +var _0x7e80=['exports','STRING','username','remoteUri','sequelize'];(function(_0x517286,_0x1da6cd){var _0x156bbc=function(_0x3a8400){while(--_0x3a8400){_0x517286['push'](_0x517286['shift']());}};_0x156bbc(++_0x1da6cd);}(_0x7e80,0x103));var _0x07e8=function(_0x2815,_0x5f3c49){_0x2815=_0x2815-0x0;var _0x42d012=_0x7e80[_0x2815];return _0x42d012;};'use strict';var Sequelize=require(_0x07e8('0x0'));module[_0x07e8('0x1')]={'name':{'type':Sequelize[_0x07e8('0x2')]},'description':{'type':Sequelize[_0x07e8('0x2')]},'username':{'type':Sequelize[_0x07e8('0x2')],'unique':_0x07e8('0x3')},'password':{'type':Sequelize[_0x07e8('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x07e8('0x4')},'serverUrl':{'type':Sequelize[_0x07e8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d213180..f3622c5 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 _0xf7ed=['email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','ServicenowAccount','count','findAll','rows','params','keys','includeAll','include','options','create','body','find','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','time_worked','business_duration','reopened_time','resolved_at','caller_id','work_notes','short_description','work_start','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x4de0aa,_0x22628e){_0x4de0aa=_0x4de0aa-0x0;var _0x2214bb=_0xf7ed[_0x4de0aa];return _0x2214bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdf7e('0x0'));var rimraf=require(_0xdf7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf7e('0x2'));var rp=require(_0xdf7e('0x3'));var moment=require('moment');var BPromise=require(_0xdf7e('0x4'));var Mustache=require(_0xdf7e('0x5'));var util=require('util');var path=require(_0xdf7e('0x6'));var sox=require(_0xdf7e('0x7'));var csv=require(_0xdf7e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf7e('0x9'));var squel=require(_0xdf7e('0xa'));var crypto=require(_0xdf7e('0xb'));var jsforce=require(_0xdf7e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf7e('0x8'));var querystring=require(_0xdf7e('0xd'));var Papa=require(_0xdf7e('0xe'));var Redis=require(_0xdf7e('0xf'));var authService=require(_0xdf7e('0x10'));var qs=require(_0xdf7e('0x11'));var as=require(_0xdf7e('0x12'));var hardwareService=require(_0xdf7e('0x13'));var logger=require(_0xdf7e('0x14'))(_0xdf7e('0x15'));var utils=require(_0xdf7e('0x16'));var config=require(_0xdf7e('0x17'));var db=require(_0xdf7e('0x18'))['db'];var integrations=require(_0xdf7e('0x19'));var jayson=require(_0xdf7e('0x1a'));var client=jayson['client'][_0xdf7e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x536927,_0x22e411,_0xe0068a){if(_0xe0068a){var _0x500475=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x500475[_0xdf7e('0x1c')](_0x22e411)){return _0x536927;}else{throw new db[(_0xdf7e('0x1d'))][(_0xdf7e('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 _0x536927;}}function respondWithRpcPromise(_0x280380,_0x3b483d,_0x1ea911,_0x39212f){return new BPromise(function(_0x19134c,_0xb1c752){var _0x5dd057=_0x39212f||client;return _0x5dd057['request'](_0x280380,_0x1ea911)[_0xdf7e('0x1f')](function(_0x3dfef7){logger[_0xdf7e('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0xdf7e('0x21'));logger[_0xdf7e('0x22')](_0xdf7e('0x23'),_0x3b483d,_0xdf7e('0x21'),JSON[_0xdf7e('0x24')](_0x3dfef7));if(_0x3dfef7[_0xdf7e('0x25')]){if(_0x3dfef7['error']['code']===0x1f4){logger[_0xdf7e('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);return _0xb1c752(_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);}logger[_0xdf7e('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);return _0x19134c(_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);}else{logger[_0xdf7e('0x20')](_0xdf7e('0x27'),_0x3b483d,'request\x20sent');_0x19134c(_0x3dfef7['result'][_0xdf7e('0x26')]);}})[_0xdf7e('0x28')](function(_0x2ffc55){logger[_0xdf7e('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0x2ffc55);_0xb1c752(_0x2ffc55);});});}function respondWithStatusCode(_0x485fef,_0x129dfd){_0x129dfd=_0x129dfd||0xcc;return function(_0xd5431b){if(_0xd5431b){return _0x485fef[_0xdf7e('0x29')](_0x129dfd);}return _0x485fef[_0xdf7e('0x2a')](_0x129dfd)[_0xdf7e('0x2b')]();};}function respondWithResult(_0x580560,_0x36c081){_0x36c081=_0x36c081||0xc8;return function(_0x10c597){if(_0x10c597){return _0x580560['status'](_0x36c081)[_0xdf7e('0x2c')](_0x10c597);}};}function respondWithFilteredResult(_0x4273aa,_0x29155b){return function(_0x16a61e){if(_0x16a61e){var _0x516d69=_0x16a61e['count'],_0x4d127b=_0x29155b[_0xdf7e('0x2d')],_0x4b9664=_0x29155b[_0xdf7e('0x2d')]+_0x29155b[_0xdf7e('0x2e')],_0x5ed006;if(_0x4b9664>=_0x516d69){_0x4b9664=_0x516d69;_0x5ed006=0xc8;}else{_0x5ed006=0xce;}_0x4273aa[_0xdf7e('0x2a')](_0x5ed006);return _0x4273aa[_0xdf7e('0x2f')](_0xdf7e('0x30'),_0x4d127b+'-'+_0x4b9664+'/'+_0x516d69)[_0xdf7e('0x2c')](_0x16a61e);}return null;};}function patchUpdates(_0x2d5b8f){return function(_0x3b9aae){try{jsonpatch['apply'](_0x3b9aae,_0x2d5b8f,!![]);}catch(_0x138e92){return BPromise[_0xdf7e('0x31')](_0x138e92);}return _0x3b9aae['save']();};}function saveUpdates(_0x2ae01d,_0x4ea96c){return function(_0x3347c1){if(_0x3347c1){return _0x3347c1[_0xdf7e('0x32')](_0x2ae01d)['then'](function(_0x1a7a13){return _0x1a7a13;});}return null;};}function removeEntity(_0x7784fe,_0x7525aa){return function(_0x66cc99){if(_0x66cc99){return _0x66cc99['destroy']()[_0xdf7e('0x1f')](function(){_0x7784fe[_0xdf7e('0x2a')](0xcc)[_0xdf7e('0x2b')]();});}};}function handleEntityNotFound(_0x376daf,_0x1e87d8){return function(_0x4c9f61){if(!_0x4c9f61){_0x376daf[_0xdf7e('0x29')](0x194);}return _0x4c9f61;};}function handleError(_0xf920e3,_0x3c4e6a){_0x3c4e6a=_0x3c4e6a||0x1f4;return function(_0x5ac0bc){logger[_0xdf7e('0x25')](_0x5ac0bc[_0xdf7e('0x33')]);if(_0x5ac0bc[_0xdf7e('0x34')]){delete _0x5ac0bc['name'];}_0xf920e3['status'](_0x3c4e6a)[_0xdf7e('0x35')](_0x5ac0bc);};}exports[_0xdf7e('0x36')]=function(_0x4eaa04,_0x2d49dd){var _0x5d68d0={},_0x37ed27={},_0x1a1929={'count':0x0,'rows':[]};var _0x478d42=_[_0xdf7e('0x37')](db['ServicenowAccount'][_0xdf7e('0x38')],function(_0x574b73){return{'name':_0x574b73[_0xdf7e('0x39')],'type':_0x574b73[_0xdf7e('0x3a')]['key']};});_0x37ed27[_0xdf7e('0x3b')]=_[_0xdf7e('0x37')](_0x478d42,'name');_0x37ed27[_0xdf7e('0x3c')]=_['keys'](_0x4eaa04['query']);_0x37ed27['filters']=_[_0xdf7e('0x3d')](_0x37ed27[_0xdf7e('0x3b')],_0x37ed27[_0xdf7e('0x3c')]);_0x5d68d0[_0xdf7e('0x3e')]=_[_0xdf7e('0x3d')](_0x37ed27[_0xdf7e('0x3b')],qs[_0xdf7e('0x3f')](_0x4eaa04['query']['fields']));_0x5d68d0[_0xdf7e('0x3e')]=_0x5d68d0[_0xdf7e('0x3e')][_0xdf7e('0x40')]?_0x5d68d0[_0xdf7e('0x3e')]:_0x37ed27['model'];if(!_0x4eaa04['query']['hasOwnProperty'](_0xdf7e('0x41'))){_0x5d68d0['limit']=qs[_0xdf7e('0x2e')](_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x2e')]);_0x5d68d0['offset']=qs['offset'](_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x2d')]);}_0x5d68d0[_0xdf7e('0x42')]=qs[_0xdf7e('0x43')](_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x43')]);_0x5d68d0[_0xdf7e('0x44')]=qs[_0xdf7e('0x45')](_['pick'](_0x4eaa04[_0xdf7e('0x3c')],_0x37ed27[_0xdf7e('0x45')]),_0x478d42);if(_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x46')]){_0x5d68d0[_0xdf7e('0x44')]=_[_0xdf7e('0x47')](_0x5d68d0[_0xdf7e('0x44')],{'$or':_[_0xdf7e('0x37')](_0x478d42,function(_0x1874bb){if(_0x1874bb['type']!==_0xdf7e('0x48')){var _0x29111b={};_0x29111b[_0x1874bb[_0xdf7e('0x34')]]={'$like':'%'+_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x46')]+'%'};return _0x29111b;}})});}_0x5d68d0=_['merge']({},_0x5d68d0,_0x4eaa04['options']);var _0xeefd7a={'where':_0x5d68d0[_0xdf7e('0x44')]};return db[_0xdf7e('0x49')][_0xdf7e('0x4a')](_0xeefd7a)['then'](function(_0x3db221){_0x1a1929[_0xdf7e('0x4a')]=_0x3db221;if(_0x4eaa04[_0xdf7e('0x3c')]['includeAll']){_0x5d68d0['include']=[{'all':!![]}];}return db[_0xdf7e('0x49')][_0xdf7e('0x4b')](_0x5d68d0);})[_0xdf7e('0x1f')](function(_0x2a3b73){_0x1a1929[_0xdf7e('0x4c')]=_0x2a3b73;return _0x1a1929;})[_0xdf7e('0x1f')](respondWithFilteredResult(_0x2d49dd,_0x5d68d0))['catch'](handleError(_0x2d49dd,null));};exports['show']=function(_0xda8310,_0x3e1289){var _0x3be5c6={'raw':![],'where':{'id':_0xda8310[_0xdf7e('0x4d')]['id']}},_0xdbfe63={};_0xdbfe63['model']=_['keys'](db[_0xdf7e('0x49')][_0xdf7e('0x38')]);_0xdbfe63['query']=_[_0xdf7e('0x4e')](_0xda8310['query']);_0xdbfe63[_0xdf7e('0x45')]=_[_0xdf7e('0x3d')](_0xdbfe63[_0xdf7e('0x3b')],_0xdbfe63[_0xdf7e('0x3c')]);_0x3be5c6[_0xdf7e('0x3e')]=_[_0xdf7e('0x3d')](_0xdbfe63[_0xdf7e('0x3b')],qs[_0xdf7e('0x3f')](_0xda8310[_0xdf7e('0x3c')]['fields']));_0x3be5c6[_0xdf7e('0x3e')]=_0x3be5c6['attributes']['length']?_0x3be5c6[_0xdf7e('0x3e')]:_0xdbfe63[_0xdf7e('0x3b')];if(_0xda8310[_0xdf7e('0x3c')][_0xdf7e('0x4f')]){_0x3be5c6[_0xdf7e('0x50')]=[{'all':!![]}];}_0x3be5c6=_[_0xdf7e('0x47')]({},_0x3be5c6,_0xda8310[_0xdf7e('0x51')]);return db['ServicenowAccount']['find'](_0x3be5c6)[_0xdf7e('0x1f')](handleEntityNotFound(_0x3e1289,null))['then'](respondWithResult(_0x3e1289,null))[_0xdf7e('0x28')](handleError(_0x3e1289,null));};exports['create']=function(_0x304292,_0x1f98f4){return db[_0xdf7e('0x49')][_0xdf7e('0x52')](_0x304292[_0xdf7e('0x53')],{})[_0xdf7e('0x1f')](respondWithResult(_0x1f98f4,0xc9))[_0xdf7e('0x28')](handleError(_0x1f98f4,null));};exports['update']=function(_0x2a6e8b,_0x22573a){if(_0x2a6e8b[_0xdf7e('0x53')]['id']){delete _0x2a6e8b[_0xdf7e('0x53')]['id'];}return db[_0xdf7e('0x49')][_0xdf7e('0x54')]({'where':{'id':_0x2a6e8b['params']['id']}})[_0xdf7e('0x1f')](handleEntityNotFound(_0x22573a,null))[_0xdf7e('0x1f')](saveUpdates(_0x2a6e8b[_0xdf7e('0x53')],null))['then'](respondWithResult(_0x22573a,null))[_0xdf7e('0x28')](handleError(_0x22573a,null));};exports[_0xdf7e('0x55')]=function(_0x1170b8,_0x17fdd4){return db['ServicenowAccount'][_0xdf7e('0x54')]({'where':{'id':_0x1170b8['params']['id']}})['then'](handleEntityNotFound(_0x17fdd4,null))[_0xdf7e('0x1f')](removeEntity(_0x17fdd4,null))['catch'](handleError(_0x17fdd4,null));};exports[_0xdf7e('0x56')]=function(_0x5642b5,_0x2ddcfc,_0x295d32){var _0xd3ebcd={};var _0x48fcf1={};var _0x41f153;var _0x3d4b5e;return db[_0xdf7e('0x49')][_0xdf7e('0x57')]({'where':{'id':_0x5642b5[_0xdf7e('0x4d')]['id']}})[_0xdf7e('0x1f')](handleEntityNotFound(_0x2ddcfc,null))[_0xdf7e('0x1f')](function(_0x3689e1){if(_0x3689e1){_0x41f153=_0x3689e1;_0x48fcf1['model']=_[_0xdf7e('0x4e')](db[_0xdf7e('0x58')]['rawAttributes']);_0x48fcf1[_0xdf7e('0x3c')]=_[_0xdf7e('0x4e')](_0x5642b5[_0xdf7e('0x3c')]);_0x48fcf1[_0xdf7e('0x45')]=_['intersection'](_0x48fcf1[_0xdf7e('0x3b')],_0x48fcf1['query']);_0xd3ebcd[_0xdf7e('0x3e')]=_['intersection'](_0x48fcf1['model'],qs[_0xdf7e('0x3f')](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x3f')]));_0xd3ebcd[_0xdf7e('0x3e')]=_0xd3ebcd[_0xdf7e('0x3e')]['length']?_0xd3ebcd[_0xdf7e('0x3e')]:_0x48fcf1[_0xdf7e('0x3b')];_0xd3ebcd[_0xdf7e('0x42')]=qs[_0xdf7e('0x43')](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x43')]);_0xd3ebcd[_0xdf7e('0x44')]=qs[_0xdf7e('0x45')](_[_0xdf7e('0x59')](_0x5642b5['query'],_0x48fcf1[_0xdf7e('0x45')]));if(_0x5642b5[_0xdf7e('0x3c')]['filter']){_0xd3ebcd[_0xdf7e('0x44')]=_[_0xdf7e('0x47')](_0xd3ebcd[_0xdf7e('0x44')],{'$or':_[_0xdf7e('0x37')](_0xd3ebcd[_0xdf7e('0x3e')],function(_0x2d4db9){var _0x102758={};_0x102758[_0x2d4db9]={'$like':'%'+_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x46')]+'%'};return _0x102758;})});}_0xd3ebcd=_['merge']({},_0xd3ebcd,_0x5642b5[_0xdf7e('0x51')]);return _0x41f153[_0xdf7e('0x56')](_0xd3ebcd);}})[_0xdf7e('0x1f')](function(_0x1166fd){if(_0x1166fd){_0x3d4b5e=_0x1166fd[_0xdf7e('0x40')];if(!_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x5a')]('nolimit')){_0xd3ebcd[_0xdf7e('0x2e')]=qs[_0xdf7e('0x2e')](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x2e')]);_0xd3ebcd[_0xdf7e('0x2d')]=qs['offset'](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x2d')]);}return _0x41f153[_0xdf7e('0x56')](_0xd3ebcd);}})[_0xdf7e('0x1f')](function(_0x26a261){if(_0x26a261){return _0x26a261?{'count':_0x3d4b5e,'rows':_0x26a261}:null;}})[_0xdf7e('0x1f')](respondWithResult(_0x2ddcfc,null))['catch'](handleError(_0x2ddcfc,null));};exports[_0xdf7e('0x5b')]=function(_0x9bfd41,_0x5f516c,_0x19ce95){if(_0x9bfd41['body']['id']){delete _0x9bfd41['body']['id'];}return db[_0xdf7e('0x49')][_0xdf7e('0x57')]({'where':{'id':_0x9bfd41[_0xdf7e('0x4d')]['id']}})[_0xdf7e('0x1f')](handleEntityNotFound(_0x5f516c,null))[_0xdf7e('0x1f')](function(_0x326e5e){if(_0x326e5e){_0x9bfd41['body'][_0xdf7e('0x5c')]=_0x326e5e['id'];_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x5d')]=integrations['getSubjects'](_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x5e')],_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x3a')]);_0x9bfd41[_0xdf7e('0x53')]['Descriptions']=integrations[_0xdf7e('0x5f')](_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x5e')],_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x3a')]);return db[_0xdf7e('0x58')]['create'](_0x9bfd41[_0xdf7e('0x53')],{'include':[{'model':db[_0xdf7e('0x60')],'as':'Subjects'},{'model':db[_0xdf7e('0x60')],'as':_0xdf7e('0x61')}]});}return null;})[_0xdf7e('0x1f')](respondWithResult(_0x5f516c,null))[_0xdf7e('0x28')](handleError(_0x5f516c,null));};exports[_0xdf7e('0x62')]=function(_0x229bc6,_0x3a4c9d,_0x2bd53d){var _0x30584f=['made_sla',_0xdf7e('0x63'),_0xdf7e('0x64'),_0xdf7e('0x65'),_0xdf7e('0x66'),_0xdf7e('0x67'),_0xdf7e('0x68'),_0xdf7e('0x69'),_0xdf7e('0x6a')];var _0x12b466=[_0xdf7e('0x6b'),'made_sla','caused_by','watch_list',_0xdf7e('0x6c'),'sys_updated_on',_0xdf7e('0x6d'),_0xdf7e('0x63'),_0xdf7e('0x6e'),_0xdf7e('0x6f'),_0xdf7e('0x70'),_0xdf7e('0x71'),_0xdf7e('0x72'),_0xdf7e('0x73'),_0xdf7e('0x74'),'sys_domain',_0xdf7e('0x75'),_0xdf7e('0x76'),_0xdf7e('0x64'),_0xdf7e('0x42'),_0xdf7e('0x77'),_0xdf7e('0x78'),_0xdf7e('0x79'),_0xdf7e('0x7a'),_0xdf7e('0x7b'),'active',_0xdf7e('0x7c'),_0xdf7e('0x7d'),_0xdf7e('0x7e'),'sys_domain_path',_0xdf7e('0x7f'),_0xdf7e('0x80'),'expected_start','opened_at',_0xdf7e('0x81'),'group_list','work_end',_0xdf7e('0x82'),_0xdf7e('0x83'),_0xdf7e('0x84'),'approval_set',_0xdf7e('0x65'),_0xdf7e('0x85'),_0xdf7e('0x86'),_0xdf7e('0x66'),'correlation_display','delivery_task',_0xdf7e('0x87'),'assignment_group',_0xdf7e('0x88'),_0xdf7e('0x89'),_0xdf7e('0x8a'),'calendar_duration',_0xdf7e('0x67'),_0xdf7e('0x8b'),_0xdf7e('0x8c'),_0xdf7e('0x8d'),_0xdf7e('0x8e'),_0xdf7e('0x8f'),'sys_id','contact_type',_0xdf7e('0x90'),_0xdf7e('0x68'),_0xdf7e('0x91'),_0xdf7e('0x92'),_0xdf7e('0x93'),_0xdf7e('0x94'),_0xdf7e('0x95'),_0xdf7e('0x96'),_0xdf7e('0x69'),'comments',_0xdf7e('0x97'),_0xdf7e('0x98'),_0xdf7e('0x99'),_0xdf7e('0x9a'),_0xdf7e('0x9b'),'reopen_count',_0xdf7e('0x9c'),'escalation',_0xdf7e('0x9d'),_0xdf7e('0x9e'),_0xdf7e('0x9f'),_0xdf7e('0x6a')];var _0x114aca='';var _0x56a5d5='';var _0x50c120=[];var _0x555ea3='';var _0x46862a='';var _0x2c3cfe=[];var _0x5c4cb0='';var _0x5bf5c0='';var _0xd7dab5={};var _0x41d3c4='';return db[_0xdf7e('0x49')][_0xdf7e('0x57')]({'where':{'id':_0x229bc6[_0xdf7e('0x4d')]['id']},'attributes':['id',_0xdf7e('0xa0'),_0xdf7e('0xa1'),_0xdf7e('0xa2'),_0xdf7e('0xa3'),_0xdf7e('0xa4')]})[_0xdf7e('0x1f')](handleEntityNotFound(_0x3a4c9d,null))[_0xdf7e('0x1f')](function(_0x49b0af){if(_0x49b0af){_0x41d3c4=_0x49b0af[_0xdf7e('0xa3')];var _0x2b38e8=_0x41d3c4[_0xdf7e('0xa5')](-0x1);if(_0x2b38e8==='/'){_0x41d3c4=_0x41d3c4[_0xdf7e('0xa6')](0x0,_0x41d3c4[_0xdf7e('0xa7')](_0x2b38e8));}_0x5bf5c0=util[_0xdf7e('0xa8')](_0xdf7e('0xa9'),_0x41d3c4);_0x5c4cb0=util[_0xdf7e('0xa8')]('%s/api/now/table/',_0x41d3c4);_0xd7dab5={'user':_0x49b0af[_0xdf7e('0xa0')],'pass':_0x49b0af[_0xdf7e('0xa1')]};var _0x5de686={'method':_0xdf7e('0xaa'),'uri':_0x5bf5c0+_0xdf7e('0xab'),'auth':_0xd7dab5,'json':!![]};return rp(_0x5de686);}})[_0xdf7e('0x1f')](function(_0x41fa35){if(_0x41fa35[_0xdf7e('0xac')]['length']>0x0){_0x114aca=_0x41fa35[_0xdf7e('0xac')];}console[_0xdf7e('0xad')](_0xdf7e('0xae'),_0x114aca);_0x2c3cfe=[];_0x56a5d5=Object['assign']([],_0x114aca);_[_0xdf7e('0xaf')](_0x56a5d5,function(_0x2161d1){return!_0x30584f[_0xdf7e('0xb0')](_0x2161d1[_0xdf7e('0x34')]);});_0x56a5d5[_0xdf7e('0xb1')](function(_0x31a83b){var _0xbd2774=createFieldObject(_0x5c4cb0,_0xd7dab5,_0x31a83b[_0xdf7e('0xb2')],_0x31a83b[_0xdf7e('0x34')],_0x31a83b[_0xdf7e('0xb3')],![]);_0x2c3cfe[_0xdf7e('0xb4')](_0xbd2774);});return Promise[_0xdf7e('0xb5')](_0x2c3cfe);})[_0xdf7e('0x1f')](function(_0x4bf4f9){_0x50c120=_0x4bf4f9;_0x555ea3=Object['assign']([],_0x114aca);console[_0xdf7e('0xad')]('TCL:\x20_object',_0x114aca);_['remove'](_0x555ea3,function(_0x232390){return _0x12b466[_0xdf7e('0xb0')](_0x232390[_0xdf7e('0x34')]);});console[_0xdf7e('0xad')](_0xdf7e('0xb6'),_0x555ea3);_0x2c3cfe=[];_0x555ea3[_0xdf7e('0xb1')](function(_0x379c4e){var _0xf3802a=createFieldObject(_0x5c4cb0,_0xd7dab5,_0x379c4e['internalType'],_0x379c4e['name'],_0x379c4e['label'],!![]);_0x2c3cfe[_0xdf7e('0xb4')](_0xf3802a);});return Promise[_0xdf7e('0xb5')](_0x2c3cfe);})[_0xdf7e('0x1f')](function(_0x13f45e){_0x46862a=_0x13f45e;var _0x214a70=_0x50c120[_0xdf7e('0xb7')](_0x46862a);return{'count':_0x214a70[_0xdf7e('0x40')],'rows':_0x214a70};})[_0xdf7e('0x1f')](respondWithResult(_0x3a4c9d,null))[_0xdf7e('0x28')](function(_0x15b64e){console[_0xdf7e('0xad')](_0xdf7e('0xb8')+_0x15b64e);var _0x112ec9=_0x229bc6['query']['test']?0x1f4:_0x15b64e[_0xdf7e('0xb9')]||0x1f4;logger[_0xdf7e('0x25')](_0x15b64e[_0xdf7e('0x33')]);delete _0x15b64e[_0xdf7e('0x34')];if(_0x112ec9===0x191){_0x112ec9=0x190;}_0x3a4c9d[_0xdf7e('0x2a')](_0x112ec9)[_0xdf7e('0x35')](_0x229bc6[_0xdf7e('0x3c')]['test']?{'message':_0xdf7e('0xba'),'statusCode':_0x15b64e['statusCode']}:_0x15b64e);});};function createFieldObject(_0x293527,_0x42a637,_0x332d85,_0xf678c0,_0x446cd7,_0x127697){return new Promise(function(_0x37f388,_0x46277a){var _0x4df035={'id':_0xf678c0,'name':_0x446cd7,'custom':_0x127697};if(_0x332d85===_0xdf7e('0xbb')){_0x4df035[_0xdf7e('0x51')]=[{'name':_0xdf7e('0xbc'),'value':_0xdf7e('0xbd')},{'name':_0xdf7e('0xbe'),'value':_0xdf7e('0xbf')}];_0x37f388(_0x4df035);}else{var _0x1c7060={'method':'GET','uri':_0x293527+'sys_choice?sysparm_query=name=incident^element='+_0xf678c0,'auth':_0x42a637,'json':!![]};return rp(_0x1c7060)[_0xdf7e('0x1f')](function(_0xde1948){var _0x1b1e28=[];if(_0xde1948['result'][_0xdf7e('0x40')]>0x0){_0xde1948[_0xdf7e('0xac')][_0xdf7e('0xb1')](function(_0x41acc4){if(_0x41acc4['inactive']===_0xdf7e('0xbf')){var _0x556b2e={'name':_0x41acc4['label'],'value':_0x41acc4[_0xdf7e('0xc0')]};_0x1b1e28[_0xdf7e('0xb4')](_0x556b2e);}});}_0x4df035['options']=_0x1b1e28;if(_0x4df035[_0xdf7e('0x51')][_0xdf7e('0x40')]>0x0){_0x37f388(_0x4df035);}else{if(_0x127697==![]){_0x37f388();}else{_0x37f388(_0x4df035);}}});}});} \ No newline at end of file +var _0xc5dc=['params','keys','length','find','create','body','getConfigurations','findOne','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','notify','incident_state','severity','parent','made_sla','caused_by','upon_reject','child_incidents','hold_reason','approval_history','resolved_by','opened_by','user_input','sys_created_on','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','follow_up','parent_incident','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','correlation_id','location','username','password','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','internalType','label','push','all','remove','forEach','ServiceNow\x20error:\x20','statusCode','send','Wrong\x20credentials','boolean','False','false','inactive','value','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowAccount','includeAll','include','findAll','rows','show'];(function(_0xa3f0e7,_0x4dfd0d){var _0x46a1e4=function(_0x8ee6ad){while(--_0x8ee6ad){_0xa3f0e7['push'](_0xa3f0e7['shift']());}};_0x46a1e4(++_0x4dfd0d);}(_0xc5dc,0x128));var _0xcc5d=function(_0x15ae23,_0x3038a2){_0x15ae23=_0x15ae23-0x0;var _0x4ca313=_0xc5dc[_0x15ae23];return _0x4ca313;};'use strict';var pdf=require(_0xcc5d('0x0'));var emlformat=require(_0xcc5d('0x1'));var rimraf=require(_0xcc5d('0x2'));var zipdir=require(_0xcc5d('0x3'));var jsonpatch=require(_0xcc5d('0x4'));var rp=require(_0xcc5d('0x5'));var moment=require(_0xcc5d('0x6'));var BPromise=require(_0xcc5d('0x7'));var Mustache=require(_0xcc5d('0x8'));var util=require(_0xcc5d('0x9'));var path=require(_0xcc5d('0xa'));var sox=require('sox');var csv=require(_0xcc5d('0xb'));var ejs=require(_0xcc5d('0xc'));var fs=require('fs');var _=require(_0xcc5d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc5d('0xe'));var toCsv=require(_0xcc5d('0xb'));var querystring=require(_0xcc5d('0xf'));var Papa=require(_0xcc5d('0x10'));var Redis=require(_0xcc5d('0x11'));var authService=require(_0xcc5d('0x12'));var qs=require(_0xcc5d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcc5d('0x14'));var utils=require(_0xcc5d('0x15'));var config=require(_0xcc5d('0x16'));var db=require(_0xcc5d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1fdbcb,_0xfee5c4,_0x54bd87){if(_0x54bd87){var _0x139730=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x139730[_0xcc5d('0x18')](_0xfee5c4)){return _0x1fdbcb;}else{throw new db[(_0xcc5d('0x19'))]['ValidationError'](_0xcc5d('0x1a'));}}else{return _0x1fdbcb;}}function respondWithRpcPromise(_0x3e8d59,_0x54738f,_0x321e45,_0x18af90){return new BPromise(function(_0x17454c,_0x571d50){var _0x4cfc3f=_0x18af90||client;return _0x4cfc3f[_0xcc5d('0x1b')](_0x3e8d59,_0x321e45)['then'](function(_0x3cccf7){logger[_0xcc5d('0x1c')](_0xcc5d('0x1d'),_0x54738f,_0xcc5d('0x1e'));logger[_0xcc5d('0x1f')](_0xcc5d('0x20'),_0x54738f,_0xcc5d('0x1e'),JSON[_0xcc5d('0x21')](_0x3cccf7));if(_0x3cccf7[_0xcc5d('0x22')]){if(_0x3cccf7[_0xcc5d('0x22')][_0xcc5d('0x23')]===0x1f4){logger['error'](_0xcc5d('0x1d'),_0x54738f,_0x3cccf7[_0xcc5d('0x22')]['message']);return _0x571d50(_0x3cccf7['error']['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x54738f,_0x3cccf7[_0xcc5d('0x22')][_0xcc5d('0x24')]);return _0x17454c(_0x3cccf7['error'][_0xcc5d('0x24')]);}else{logger['info'](_0xcc5d('0x1d'),_0x54738f,_0xcc5d('0x1e'));_0x17454c(_0x3cccf7[_0xcc5d('0x25')][_0xcc5d('0x24')]);}})[_0xcc5d('0x26')](function(_0x2dfe5f){logger[_0xcc5d('0x22')](_0xcc5d('0x1d'),_0x54738f,_0x2dfe5f);_0x571d50(_0x2dfe5f);});});}function respondWithStatusCode(_0x2034c7,_0x13a0ce){_0x13a0ce=_0x13a0ce||0xcc;return function(_0x594007){if(_0x594007){return _0x2034c7['sendStatus'](_0x13a0ce);}return _0x2034c7[_0xcc5d('0x27')](_0x13a0ce)[_0xcc5d('0x28')]();};}function respondWithResult(_0x136c0e,_0x38344c){_0x38344c=_0x38344c||0xc8;return function(_0x3cf0f0){if(_0x3cf0f0){return _0x136c0e[_0xcc5d('0x27')](_0x38344c)[_0xcc5d('0x29')](_0x3cf0f0);}};}function respondWithFilteredResult(_0x11ec80,_0x3db0e1){return function(_0xe8f6f9){if(_0xe8f6f9){var _0x134363=_0xe8f6f9[_0xcc5d('0x2a')],_0xc0f633=_0x3db0e1[_0xcc5d('0x2b')],_0x239eb0=_0x3db0e1[_0xcc5d('0x2b')]+_0x3db0e1[_0xcc5d('0x2c')],_0x3205b5;if(_0x239eb0>=_0x134363){_0x239eb0=_0x134363;_0x3205b5=0xc8;}else{_0x3205b5=0xce;}_0x11ec80[_0xcc5d('0x27')](_0x3205b5);return _0x11ec80[_0xcc5d('0x2d')](_0xcc5d('0x2e'),_0xc0f633+'-'+_0x239eb0+'/'+_0x134363)[_0xcc5d('0x29')](_0xe8f6f9);}return null;};}function patchUpdates(_0x4532bf){return function(_0x552dca){try{jsonpatch[_0xcc5d('0x2f')](_0x552dca,_0x4532bf,!![]);}catch(_0x4bbf04){return BPromise[_0xcc5d('0x30')](_0x4bbf04);}return _0x552dca[_0xcc5d('0x31')]();};}function saveUpdates(_0xfd2cca,_0x4411cc){return function(_0x2dfb29){if(_0x2dfb29){return _0x2dfb29[_0xcc5d('0x32')](_0xfd2cca)['then'](function(_0x3cd8e9){return _0x3cd8e9;});}return null;};}function removeEntity(_0x583a04,_0x355214){return function(_0x2e2366){if(_0x2e2366){return _0x2e2366[_0xcc5d('0x33')]()[_0xcc5d('0x34')](function(){_0x583a04['status'](0xcc)[_0xcc5d('0x28')]();});}};}function handleEntityNotFound(_0x90cd40,_0x38902c){return function(_0x3ab106){if(!_0x3ab106){_0x90cd40[_0xcc5d('0x35')](0x194);}return _0x3ab106;};}function handleError(_0x390ac0,_0x4af3d4){_0x4af3d4=_0x4af3d4||0x1f4;return function(_0x2c7c46){logger[_0xcc5d('0x22')](_0x2c7c46[_0xcc5d('0x36')]);if(_0x2c7c46['name']){delete _0x2c7c46[_0xcc5d('0x37')];}_0x390ac0[_0xcc5d('0x27')](_0x4af3d4)['send'](_0x2c7c46);};}exports['index']=function(_0x4657f1,_0xe0c62a){var _0x326c48={},_0x55f389={},_0x3e40e4={'count':0x0,'rows':[]};var _0x209a7f=_[_0xcc5d('0x38')](db['ServicenowAccount'][_0xcc5d('0x39')],function(_0x268dfb){return{'name':_0x268dfb[_0xcc5d('0x3a')],'type':_0x268dfb[_0xcc5d('0x3b')][_0xcc5d('0x3c')]};});_0x55f389[_0xcc5d('0x3d')]=_[_0xcc5d('0x38')](_0x209a7f,'name');_0x55f389['query']=_['keys'](_0x4657f1[_0xcc5d('0x3e')]);_0x55f389[_0xcc5d('0x3f')]=_[_0xcc5d('0x40')](_0x55f389[_0xcc5d('0x3d')],_0x55f389[_0xcc5d('0x3e')]);_0x326c48[_0xcc5d('0x41')]=_[_0xcc5d('0x40')](_0x55f389['model'],qs['fields'](_0x4657f1[_0xcc5d('0x3e')][_0xcc5d('0x42')]));_0x326c48[_0xcc5d('0x41')]=_0x326c48['attributes']['length']?_0x326c48[_0xcc5d('0x41')]:_0x55f389['model'];if(!_0x4657f1[_0xcc5d('0x3e')][_0xcc5d('0x43')](_0xcc5d('0x44'))){_0x326c48[_0xcc5d('0x2c')]=qs[_0xcc5d('0x2c')](_0x4657f1['query'][_0xcc5d('0x2c')]);_0x326c48[_0xcc5d('0x2b')]=qs[_0xcc5d('0x2b')](_0x4657f1[_0xcc5d('0x3e')][_0xcc5d('0x2b')]);}_0x326c48[_0xcc5d('0x45')]=qs[_0xcc5d('0x46')](_0x4657f1['query'][_0xcc5d('0x46')]);_0x326c48[_0xcc5d('0x47')]=qs['filters'](_[_0xcc5d('0x48')](_0x4657f1['query'],_0x55f389['filters']),_0x209a7f);if(_0x4657f1['query'][_0xcc5d('0x49')]){_0x326c48[_0xcc5d('0x47')]=_[_0xcc5d('0x4a')](_0x326c48[_0xcc5d('0x47')],{'$or':_[_0xcc5d('0x38')](_0x209a7f,function(_0x39ed11){if(_0x39ed11[_0xcc5d('0x3b')]!==_0xcc5d('0x4b')){var _0x34958e={};_0x34958e[_0x39ed11[_0xcc5d('0x37')]]={'$like':'%'+_0x4657f1[_0xcc5d('0x3e')]['filter']+'%'};return _0x34958e;}})});}_0x326c48=_['merge']({},_0x326c48,_0x4657f1['options']);var _0x125500={'where':_0x326c48[_0xcc5d('0x47')]};return db[_0xcc5d('0x4c')][_0xcc5d('0x2a')](_0x125500)['then'](function(_0x283362){_0x3e40e4[_0xcc5d('0x2a')]=_0x283362;if(_0x4657f1['query'][_0xcc5d('0x4d')]){_0x326c48[_0xcc5d('0x4e')]=[{'all':!![]}];}return db[_0xcc5d('0x4c')][_0xcc5d('0x4f')](_0x326c48);})[_0xcc5d('0x34')](function(_0x25c453){_0x3e40e4[_0xcc5d('0x50')]=_0x25c453;return _0x3e40e4;})[_0xcc5d('0x34')](respondWithFilteredResult(_0xe0c62a,_0x326c48))[_0xcc5d('0x26')](handleError(_0xe0c62a,null));};exports[_0xcc5d('0x51')]=function(_0x3c6dec,_0x144935){var _0x286059={'raw':![],'where':{'id':_0x3c6dec[_0xcc5d('0x52')]['id']}},_0x20b39f={};_0x20b39f[_0xcc5d('0x3d')]=_[_0xcc5d('0x53')](db[_0xcc5d('0x4c')][_0xcc5d('0x39')]);_0x20b39f[_0xcc5d('0x3e')]=_[_0xcc5d('0x53')](_0x3c6dec['query']);_0x20b39f[_0xcc5d('0x3f')]=_[_0xcc5d('0x40')](_0x20b39f[_0xcc5d('0x3d')],_0x20b39f['query']);_0x286059[_0xcc5d('0x41')]=_['intersection'](_0x20b39f[_0xcc5d('0x3d')],qs[_0xcc5d('0x42')](_0x3c6dec['query'][_0xcc5d('0x42')]));_0x286059[_0xcc5d('0x41')]=_0x286059['attributes'][_0xcc5d('0x54')]?_0x286059[_0xcc5d('0x41')]:_0x20b39f[_0xcc5d('0x3d')];if(_0x3c6dec[_0xcc5d('0x3e')]['includeAll']){_0x286059['include']=[{'all':!![]}];}_0x286059=_[_0xcc5d('0x4a')]({},_0x286059,_0x3c6dec['options']);return db[_0xcc5d('0x4c')][_0xcc5d('0x55')](_0x286059)[_0xcc5d('0x34')](handleEntityNotFound(_0x144935,null))[_0xcc5d('0x34')](respondWithResult(_0x144935,null))[_0xcc5d('0x26')](handleError(_0x144935,null));};exports[_0xcc5d('0x56')]=function(_0x3d4c7a,_0x85fdb9){return db[_0xcc5d('0x4c')][_0xcc5d('0x56')](_0x3d4c7a[_0xcc5d('0x57')],{})[_0xcc5d('0x34')](respondWithResult(_0x85fdb9,0xc9))[_0xcc5d('0x26')](handleError(_0x85fdb9,null));};exports[_0xcc5d('0x32')]=function(_0x112c56,_0x4feeec){if(_0x112c56[_0xcc5d('0x57')]['id']){delete _0x112c56['body']['id'];}return db[_0xcc5d('0x4c')]['find']({'where':{'id':_0x112c56[_0xcc5d('0x52')]['id']}})[_0xcc5d('0x34')](handleEntityNotFound(_0x4feeec,null))[_0xcc5d('0x34')](saveUpdates(_0x112c56[_0xcc5d('0x57')],null))[_0xcc5d('0x34')](respondWithResult(_0x4feeec,null))[_0xcc5d('0x26')](handleError(_0x4feeec,null));};exports['destroy']=function(_0x2faafa,_0x2953e9){return db[_0xcc5d('0x4c')][_0xcc5d('0x55')]({'where':{'id':_0x2faafa['params']['id']}})[_0xcc5d('0x34')](handleEntityNotFound(_0x2953e9,null))[_0xcc5d('0x34')](removeEntity(_0x2953e9,null))[_0xcc5d('0x26')](handleError(_0x2953e9,null));};exports[_0xcc5d('0x58')]=function(_0x491996,_0x4968ef,_0x33ac66){var _0xe7923a={};var _0x2d206d={};var _0x1bdf1c;var _0x4f4704;return db[_0xcc5d('0x4c')][_0xcc5d('0x59')]({'where':{'id':_0x491996['params']['id']}})[_0xcc5d('0x34')](handleEntityNotFound(_0x4968ef,null))[_0xcc5d('0x34')](function(_0x17d71c){if(_0x17d71c){_0x1bdf1c=_0x17d71c;_0x2d206d[_0xcc5d('0x3d')]=_['keys'](db['ServicenowConfiguration'][_0xcc5d('0x39')]);_0x2d206d[_0xcc5d('0x3e')]=_[_0xcc5d('0x53')](_0x491996['query']);_0x2d206d[_0xcc5d('0x3f')]=_['intersection'](_0x2d206d[_0xcc5d('0x3d')],_0x2d206d[_0xcc5d('0x3e')]);_0xe7923a[_0xcc5d('0x41')]=_[_0xcc5d('0x40')](_0x2d206d[_0xcc5d('0x3d')],qs[_0xcc5d('0x42')](_0x491996[_0xcc5d('0x3e')][_0xcc5d('0x42')]));_0xe7923a['attributes']=_0xe7923a[_0xcc5d('0x41')][_0xcc5d('0x54')]?_0xe7923a[_0xcc5d('0x41')]:_0x2d206d['model'];_0xe7923a[_0xcc5d('0x45')]=qs[_0xcc5d('0x46')](_0x491996[_0xcc5d('0x3e')][_0xcc5d('0x46')]);_0xe7923a['where']=qs[_0xcc5d('0x3f')](_[_0xcc5d('0x48')](_0x491996[_0xcc5d('0x3e')],_0x2d206d[_0xcc5d('0x3f')]));if(_0x491996['query']['filter']){_0xe7923a['where']=_['merge'](_0xe7923a[_0xcc5d('0x47')],{'$or':_['map'](_0xe7923a[_0xcc5d('0x41')],function(_0x104a0f){var _0x58e4c1={};_0x58e4c1[_0x104a0f]={'$like':'%'+_0x491996['query'][_0xcc5d('0x49')]+'%'};return _0x58e4c1;})});}_0xe7923a=_[_0xcc5d('0x4a')]({},_0xe7923a,_0x491996[_0xcc5d('0x5a')]);return _0x1bdf1c['getConfigurations'](_0xe7923a);}})[_0xcc5d('0x34')](function(_0x11b3a0){if(_0x11b3a0){_0x4f4704=_0x11b3a0[_0xcc5d('0x54')];if(!_0x491996['query'][_0xcc5d('0x43')](_0xcc5d('0x44'))){_0xe7923a['limit']=qs['limit'](_0x491996[_0xcc5d('0x3e')][_0xcc5d('0x2c')]);_0xe7923a['offset']=qs[_0xcc5d('0x2b')](_0x491996[_0xcc5d('0x3e')]['offset']);}return _0x1bdf1c[_0xcc5d('0x58')](_0xe7923a);}})[_0xcc5d('0x34')](function(_0x307494){if(_0x307494){return _0x307494?{'count':_0x4f4704,'rows':_0x307494}:null;}})[_0xcc5d('0x34')](respondWithResult(_0x4968ef,null))[_0xcc5d('0x26')](handleError(_0x4968ef,null));};exports[_0xcc5d('0x5b')]=function(_0x26a1f8,_0x3646c8,_0x26b75c){if(_0x26a1f8['body']['id']){delete _0x26a1f8[_0xcc5d('0x57')]['id'];}return db[_0xcc5d('0x4c')][_0xcc5d('0x59')]({'where':{'id':_0x26a1f8[_0xcc5d('0x52')]['id']}})[_0xcc5d('0x34')](handleEntityNotFound(_0x3646c8,null))[_0xcc5d('0x34')](function(_0x87a5d5){if(_0x87a5d5){_0x26a1f8[_0xcc5d('0x57')][_0xcc5d('0x5c')]=_0x87a5d5['id'];_0x26a1f8['body'][_0xcc5d('0x5d')]=integrations[_0xcc5d('0x5e')](_0x26a1f8[_0xcc5d('0x57')][_0xcc5d('0x5f')],_0x26a1f8[_0xcc5d('0x57')][_0xcc5d('0x3b')]);_0x26a1f8[_0xcc5d('0x57')][_0xcc5d('0x60')]=integrations[_0xcc5d('0x61')](_0x26a1f8[_0xcc5d('0x57')]['channel'],_0x26a1f8[_0xcc5d('0x57')][_0xcc5d('0x3b')]);return db[_0xcc5d('0x62')][_0xcc5d('0x56')](_0x26a1f8[_0xcc5d('0x57')],{'include':[{'model':db[_0xcc5d('0x63')],'as':'Subjects'},{'model':db[_0xcc5d('0x63')],'as':_0xcc5d('0x60')}]});}return null;})[_0xcc5d('0x34')](respondWithResult(_0x3646c8,null))[_0xcc5d('0x26')](handleError(_0x3646c8,null));};exports[_0xcc5d('0x64')]=function(_0x198ad8,_0x1ab3ad,_0x4733c6){var _0x4c0948=['made_sla','hold_reason','knowledge','subcategory','close_code',_0xcc5d('0x65'),_0xcc5d('0x66'),_0xcc5d('0x67'),'category'];var _0x58fdf3=[_0xcc5d('0x68'),_0xcc5d('0x69'),_0xcc5d('0x6a'),'watch_list',_0xcc5d('0x6b'),'sys_updated_on',_0xcc5d('0x6c'),_0xcc5d('0x6d'),_0xcc5d('0x6e'),'number',_0xcc5d('0x6f'),'sys_updated_by',_0xcc5d('0x70'),_0xcc5d('0x71'),_0xcc5d('0x72'),'sys_domain','state','sys_created_by',_0xcc5d('0x73'),_0xcc5d('0x45'),_0xcc5d('0x74'),_0xcc5d('0x75'),'cmdb_ci',_0xcc5d('0x76'),_0xcc5d('0x77'),_0xcc5d('0x78'),'work_notes_list','business_service',_0xcc5d('0x79'),_0xcc5d('0x7a'),_0xcc5d('0x7b'),_0xcc5d('0x7c'),_0xcc5d('0x7d'),_0xcc5d('0x7e'),'business_duration',_0xcc5d('0x7f'),_0xcc5d('0x80'),_0xcc5d('0x81'),_0xcc5d('0x82'),_0xcc5d('0x83'),_0xcc5d('0x84'),'subcategory',_0xcc5d('0x85'),_0xcc5d('0x86'),_0xcc5d('0x87'),_0xcc5d('0x88'),'delivery_task',_0xcc5d('0x89'),_0xcc5d('0x8a'),_0xcc5d('0x8b'),_0xcc5d('0x8c'),_0xcc5d('0x8d'),_0xcc5d('0x8e'),'notify','sys_class_name',_0xcc5d('0x8f'),'closed_by',_0xcc5d('0x90'),_0xcc5d('0x91'),'sys_id',_0xcc5d('0x92'),_0xcc5d('0x93'),_0xcc5d('0x66'),'urgency',_0xcc5d('0x94'),_0xcc5d('0x95'),_0xcc5d('0x96'),_0xcc5d('0x97'),'assigned_to','severity','comments','sla_due',_0xcc5d('0x98'),_0xcc5d('0x99'),_0xcc5d('0x9a'),_0xcc5d('0x9b'),'reopen_count',_0xcc5d('0x9c'),_0xcc5d('0x9d'),'upon_approval',_0xcc5d('0x9e'),_0xcc5d('0x9f'),'category'];var _0x18cfa9='';var _0x27a029='';var _0x4f73af=[];var _0x344821='';var _0x52cde1='';var _0x33b554=[];var _0x3ba24b='';var _0x749580='';var _0xf80107={};var _0x39ef38='';return db[_0xcc5d('0x4c')][_0xcc5d('0x59')]({'where':{'id':_0x198ad8[_0xcc5d('0x52')]['id']},'attributes':['id',_0xcc5d('0xa0'),_0xcc5d('0xa1'),'email',_0xcc5d('0xa2'),_0xcc5d('0xa3')]})['then'](handleEntityNotFound(_0x1ab3ad,null))[_0xcc5d('0x34')](function(_0x590b71){if(_0x590b71){_0x39ef38=_0x590b71[_0xcc5d('0xa2')];var _0x27fc7c=_0x39ef38['slice'](-0x1);if(_0x27fc7c==='/'){_0x39ef38=_0x39ef38['substring'](0x0,_0x39ef38[_0xcc5d('0xa4')](_0x27fc7c));}_0x749580=util[_0xcc5d('0xa5')](_0xcc5d('0xa6'),_0x39ef38);_0x3ba24b=util[_0xcc5d('0xa5')](_0xcc5d('0xa7'),_0x39ef38);_0xf80107={'user':_0x590b71['username'],'pass':_0x590b71[_0xcc5d('0xa1')]};var _0x5978b0={'method':_0xcc5d('0xa8'),'uri':_0x749580+_0xcc5d('0xa9'),'auth':_0xf80107,'json':!![]};return rp(_0x5978b0);}})[_0xcc5d('0x34')](function(_0x393e81){if(_0x393e81[_0xcc5d('0x25')][_0xcc5d('0x54')]>0x0){_0x18cfa9=_0x393e81[_0xcc5d('0x25')];}console[_0xcc5d('0xaa')](_0xcc5d('0xab'),_0x18cfa9);_0x33b554=[];_0x27a029=Object[_0xcc5d('0xac')]([],_0x18cfa9);_['remove'](_0x27a029,function(_0x47040b){return!_0x4c0948[_0xcc5d('0xad')](_0x47040b['name']);});_0x27a029['forEach'](function(_0x4a36dc){var _0x5bf13e=createFieldObject(_0x3ba24b,_0xf80107,_0x4a36dc[_0xcc5d('0xae')],_0x4a36dc[_0xcc5d('0x37')],_0x4a36dc[_0xcc5d('0xaf')],![]);_0x33b554[_0xcc5d('0xb0')](_0x5bf13e);});return Promise[_0xcc5d('0xb1')](_0x33b554);})[_0xcc5d('0x34')](function(_0x2ed4a1){_0x4f73af=_0x2ed4a1;_0x344821=Object[_0xcc5d('0xac')]([],_0x18cfa9);console[_0xcc5d('0xaa')]('TCL:\x20_object',_0x18cfa9);_[_0xcc5d('0xb2')](_0x344821,function(_0x40f77a){return _0x58fdf3[_0xcc5d('0xad')](_0x40f77a['name']);});console[_0xcc5d('0xaa')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x344821);_0x33b554=[];_0x344821[_0xcc5d('0xb3')](function(_0x445893){var _0x5399b1=createFieldObject(_0x3ba24b,_0xf80107,_0x445893[_0xcc5d('0xae')],_0x445893[_0xcc5d('0x37')],_0x445893[_0xcc5d('0xaf')],!![]);_0x33b554['push'](_0x5399b1);});return Promise[_0xcc5d('0xb1')](_0x33b554);})['then'](function(_0x178e22){_0x52cde1=_0x178e22;var _0x82576d=_0x4f73af['concat'](_0x52cde1);return{'count':_0x82576d[_0xcc5d('0x54')],'rows':_0x82576d};})['then'](respondWithResult(_0x1ab3ad,null))[_0xcc5d('0x26')](function(_0x5b07ad){console[_0xcc5d('0xaa')](_0xcc5d('0xb4')+_0x5b07ad);var _0x2a1d91=_0x198ad8['query'][_0xcc5d('0x18')]?0x1f4:_0x5b07ad[_0xcc5d('0xb5')]||0x1f4;logger[_0xcc5d('0x22')](_0x5b07ad[_0xcc5d('0x36')]);delete _0x5b07ad['name'];if(_0x2a1d91===0x191){_0x2a1d91=0x190;}_0x1ab3ad['status'](_0x2a1d91)[_0xcc5d('0xb6')](_0x198ad8[_0xcc5d('0x3e')][_0xcc5d('0x18')]?{'message':_0xcc5d('0xb7'),'statusCode':_0x5b07ad[_0xcc5d('0xb5')]}:_0x5b07ad);});};function createFieldObject(_0x329ed3,_0x2adff4,_0x2896ba,_0x118042,_0x2a46d3,_0x1be55f){return new Promise(function(_0x20d7cf,_0xd53e38){var _0x2831d9={'id':_0x118042,'name':_0x2a46d3,'custom':_0x1be55f};if(_0x2896ba===_0xcc5d('0xb8')){_0x2831d9[_0xcc5d('0x5a')]=[{'name':'True','value':'true'},{'name':_0xcc5d('0xb9'),'value':_0xcc5d('0xba')}];_0x20d7cf(_0x2831d9);}else{var _0x300a67={'method':_0xcc5d('0xa8'),'uri':_0x329ed3+'sys_choice?sysparm_query=name=incident^element='+_0x118042,'auth':_0x2adff4,'json':!![]};return rp(_0x300a67)[_0xcc5d('0x34')](function(_0x1d8efd){var _0x1a740a=[];if(_0x1d8efd[_0xcc5d('0x25')]['length']>0x0){_0x1d8efd[_0xcc5d('0x25')][_0xcc5d('0xb3')](function(_0x348cc0){if(_0x348cc0[_0xcc5d('0xbb')]===_0xcc5d('0xba')){var _0x4a55d7={'name':_0x348cc0[_0xcc5d('0xaf')],'value':_0x348cc0[_0xcc5d('0xbc')]};_0x1a740a[_0xcc5d('0xb0')](_0x4a55d7);}});}_0x2831d9[_0xcc5d('0x5a')]=_0x1a740a;if(_0x2831d9[_0xcc5d('0x5a')][_0xcc5d('0x54')]>0x0){_0x20d7cf(_0x2831d9);}else{if(_0x1be55f==![]){_0x20d7cf();}else{_0x20d7cf(_0x2831d9);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6ca93bc..9eed530 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 _0xeca9=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3ced95,_0x3d653a){var _0x1301ab=function(_0x550e24){while(--_0x550e24){_0x3ced95['push'](_0x3ced95['shift']());}};_0x1301ab(++_0x3d653a);}(_0xeca9,0x13c));var _0x9eca=function(_0x473803,_0xb2748f){_0x473803=_0x473803-0x0;var _0x3a431b=_0xeca9[_0x473803];return _0x3a431b;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var logger=require(_0x9eca('0x2'))('api');var moment=require(_0x9eca('0x3'));var BPromise=require(_0x9eca('0x4'));var rp=require(_0x9eca('0x5'));var fs=require('fs');var path=require(_0x9eca('0x6'));var rimraf=require(_0x9eca('0x7'));var config=require(_0x9eca('0x8'));var attributes=require(_0x9eca('0x9'));var integrations=require(_0x9eca('0xa'));module['exports']=function(_0x3823c6,_0x4716df){return _0x3823c6[_0x9eca('0xb')](_0x9eca('0xc'),attributes,{'tableName':_0x9eca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc470=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x27c52f,_0x4052c5){var _0x121678=function(_0x16ee66){while(--_0x16ee66){_0x27c52f['push'](_0x27c52f['shift']());}};_0x121678(++_0x4052c5);}(_0xc470,0x12c));var _0x0c47=function(_0x330d8c,_0x477d0a){_0x330d8c=_0x330d8c-0x0;var _0x38ec91=_0xc470[_0x330d8c];return _0x38ec91;};'use strict';var _=require(_0x0c47('0x0'));var util=require(_0x0c47('0x1'));var logger=require(_0x0c47('0x2'))(_0x0c47('0x3'));var moment=require(_0x0c47('0x4'));var BPromise=require(_0x0c47('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c47('0x6'));var rimraf=require('rimraf');var config=require(_0x0c47('0x7'));var attributes=require(_0x0c47('0x8'));var integrations=require(_0x0c47('0x9'));module[_0x0c47('0xa')]=function(_0x41de22,_0x52ba2e){return _0x41de22[_0x0c47('0xb')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 6a375e1..6e9f7c4 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 _0x88ea=['ServicenowAccount','findAll','options','raw','where','attributes','map','include','model','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','GetServicenowAccount'];(function(_0x37cd8c,_0x425de5){var _0x213168=function(_0x4aed59){while(--_0x4aed59){_0x37cd8c['push'](_0x37cd8c['shift']());}};_0x213168(++_0x425de5);}(_0x88ea,0x1a3));var _0xa88e=function(_0xacc499,_0x163ba7){_0xacc499=_0xacc499-0x0;var _0x51a45e=_0x88ea[_0xacc499];return _0x51a45e;};'use strict';var _=require(_0xa88e('0x0'));var util=require(_0xa88e('0x1'));var moment=require('moment');var BPromise=require(_0xa88e('0x2'));var rs=require(_0xa88e('0x3'));var fs=require('fs');var Redis=require(_0xa88e('0x4'));var db=require(_0xa88e('0x5'))['db'];var utils=require(_0xa88e('0x6'));var logger=require('../../config/logger')(_0xa88e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa88e('0x8')][_0xa88e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc823,_0x4f77db,_0x5129fa){return new BPromise(function(_0x48a0e4,_0x4d5504){return client[_0xa88e('0xa')](_0x5cc823,_0x5129fa)[_0xa88e('0xb')](function(_0x26e5e2){logger[_0xa88e('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4f77db,'request\x20sent');logger[_0xa88e('0xd')](_0xa88e('0xe'),_0x4f77db,'request\x20sent',JSON[_0xa88e('0xf')](_0x26e5e2));if(_0x26e5e2[_0xa88e('0x10')]){if(_0x26e5e2[_0xa88e('0x10')][_0xa88e('0x11')]===0x1f4){logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x4f77db,_0x26e5e2[_0xa88e('0x10')]['message']);return _0x4d5504(_0x26e5e2['error'][_0xa88e('0x13')]);}logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x4f77db,_0x26e5e2[_0xa88e('0x10')][_0xa88e('0x13')]);return _0x48a0e4(_0x26e5e2[_0xa88e('0x10')]['message']);}else{logger['info'](_0xa88e('0x12'),_0x4f77db,_0xa88e('0x14'));_0x48a0e4(_0x26e5e2[_0xa88e('0x15')][_0xa88e('0x13')]);}})['catch'](function(_0x51656c){logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x4f77db,_0x51656c);_0x4d5504(_0x51656c);});});}exports[_0xa88e('0x16')]=function(_0xd7e9a0){var _0x2fa195=this;return new Promise(function(_0xbcbb5,_0x24df1f){return db[_0xa88e('0x17')][_0xa88e('0x18')]({'raw':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1a')]===undefined?!![]:![]:!![],'where':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1b')]||null:null,'attributes':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1c')]||null:null,'limit':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')]['limit']||null:null,'include':_0xd7e9a0['options']?_0xd7e9a0[_0xa88e('0x19')]['include']?_[_0xa88e('0x1d')](_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1e')],function(_0x10aa2d){return{'model':db[_0x10aa2d[_0xa88e('0x1f')]],'as':_0x10aa2d['as'],'attributes':_0x10aa2d[_0xa88e('0x1c')],'include':_0x10aa2d[_0xa88e('0x1e')]?_[_0xa88e('0x1d')](_0x10aa2d['include'],function(_0x7df1df){return{'model':db[_0x7df1df[_0xa88e('0x1f')]],'as':_0x7df1df['as'],'attributes':_0x7df1df[_0xa88e('0x1c')],'include':_0x7df1df[_0xa88e('0x1e')]?_[_0xa88e('0x1d')](_0x7df1df[_0xa88e('0x1e')],function(_0x14b01a){return{'model':db[_0x14b01a[_0xa88e('0x1f')]],'as':_0x14b01a['as'],'attributes':_0x14b01a[_0xa88e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21a2cf){logger['info'](_0xa88e('0x16'),_0xd7e9a0);logger[_0xa88e('0xd')]('GetServicenowAccount',_0xd7e9a0,JSON[_0xa88e('0xf')](_0x21a2cf));_0xbcbb5(_0x21a2cf);})['catch'](function(_0x501b45){logger['error'](_0xa88e('0x16'),_0x501b45[_0xa88e('0x13')],_0xd7e9a0);_0x24df1f(_0x2fa195[_0xa88e('0x10')](0x1f4,_0x501b45[_0xa88e('0x13')]));});});};exports[_0xa88e('0x20')]=function(_0x571b4f){var _0x4c75cb=this;return new Promise(function(_0x3bbdb7,_0x5b4c4f){return db['ServicenowAccount'][_0xa88e('0x21')]({'raw':_0x571b4f[_0xa88e('0x19')]?_0x571b4f['options'][_0xa88e('0x1a')]===undefined?!![]:![]:!![],'where':_0x571b4f[_0xa88e('0x19')]?_0x571b4f[_0xa88e('0x19')][_0xa88e('0x1b')]||null:null,'attributes':_0x571b4f[_0xa88e('0x19')]?_0x571b4f['options'][_0xa88e('0x1c')]||null:null,'include':_0x571b4f[_0xa88e('0x19')]?_0x571b4f[_0xa88e('0x19')]['include']?_[_0xa88e('0x1d')](_0x571b4f[_0xa88e('0x19')][_0xa88e('0x1e')],function(_0x35c874){return{'model':db[_0x35c874[_0xa88e('0x1f')]],'as':_0x35c874['as'],'attributes':_0x35c874['attributes'],'include':_0x35c874[_0xa88e('0x1e')]?_[_0xa88e('0x1d')](_0x35c874[_0xa88e('0x1e')],function(_0x4da96c){return{'model':db[_0x4da96c[_0xa88e('0x1f')]],'as':_0x4da96c['as'],'attributes':_0x4da96c[_0xa88e('0x1c')],'include':_0x4da96c['include']?_['map'](_0x4da96c[_0xa88e('0x1e')],function(_0x1407dd){return{'model':db[_0x1407dd[_0xa88e('0x1f')]],'as':_0x1407dd['as'],'attributes':_0x1407dd[_0xa88e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa88e('0xb')](function(_0xeb6f17){logger[_0xa88e('0xc')](_0xa88e('0x20'),_0x571b4f);logger[_0xa88e('0xd')](_0xa88e('0x20'),_0x571b4f,JSON[_0xa88e('0xf')](_0xeb6f17));_0x3bbdb7(_0xeb6f17);})['catch'](function(_0x41a155){logger[_0xa88e('0x10')](_0xa88e('0x20'),_0x41a155[_0xa88e('0x13')],_0x571b4f);_0x5b4c4f(_0x4c75cb[_0xa88e('0x10')](0x1f4,_0x41a155[_0xa88e('0x13')]));});});}; \ No newline at end of file +var _0xbd28=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowServicenowAccount','find','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xbd28,0x99));var _0x8bd2=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xbd28[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x8bd2('0x0'));var util=require(_0x8bd2('0x1'));var moment=require('moment');var BPromise=require(_0x8bd2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8bd2('0x3'));var logger=require(_0x8bd2('0x4'))(_0x8bd2('0x5'));var config=require(_0x8bd2('0x6'));var jayson=require(_0x8bd2('0x7'));var client=jayson[_0x8bd2('0x8')][_0x8bd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x317311,_0xe58493,_0x484c9e){return new BPromise(function(_0x5a641e,_0x434f21){return client['request'](_0x317311,_0x484c9e)[_0x8bd2('0xa')](function(_0x239deb){logger[_0x8bd2('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0xe58493,_0x8bd2('0xc'));logger[_0x8bd2('0xd')](_0x8bd2('0xe'),_0xe58493,'request\x20sent',JSON[_0x8bd2('0xf')](_0x239deb));if(_0x239deb[_0x8bd2('0x10')]){if(_0x239deb['error'][_0x8bd2('0x11')]===0x1f4){logger[_0x8bd2('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xe58493,_0x239deb[_0x8bd2('0x10')]['message']);return _0x434f21(_0x239deb[_0x8bd2('0x10')][_0x8bd2('0x12')]);}logger[_0x8bd2('0x10')](_0x8bd2('0x13'),_0xe58493,_0x239deb['error'][_0x8bd2('0x12')]);return _0x5a641e(_0x239deb[_0x8bd2('0x10')][_0x8bd2('0x12')]);}else{logger[_0x8bd2('0xb')](_0x8bd2('0x13'),_0xe58493,_0x8bd2('0xc'));_0x5a641e(_0x239deb[_0x8bd2('0x14')][_0x8bd2('0x12')]);}})[_0x8bd2('0x15')](function(_0x48b0b0){logger[_0x8bd2('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xe58493,_0x48b0b0);_0x434f21(_0x48b0b0);});});}exports[_0x8bd2('0x16')]=function(_0x5e5203){var _0x54787c=this;return new Promise(function(_0x5a8fcd,_0x449ef4){return db[_0x8bd2('0x17')][_0x8bd2('0x18')]({'raw':_0x5e5203[_0x8bd2('0x19')]?_0x5e5203[_0x8bd2('0x19')][_0x8bd2('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e5203['options']?_0x5e5203['options'][_0x8bd2('0x1b')]||null:null,'attributes':_0x5e5203[_0x8bd2('0x19')]?_0x5e5203['options'][_0x8bd2('0x1c')]||null:null,'limit':_0x5e5203['options']?_0x5e5203[_0x8bd2('0x19')][_0x8bd2('0x1d')]||null:null,'include':_0x5e5203['options']?_0x5e5203[_0x8bd2('0x19')]['include']?_[_0x8bd2('0x1e')](_0x5e5203[_0x8bd2('0x19')]['include'],function(_0x443993){return{'model':db[_0x443993[_0x8bd2('0x1f')]],'as':_0x443993['as'],'attributes':_0x443993[_0x8bd2('0x1c')],'include':_0x443993[_0x8bd2('0x20')]?_['map'](_0x443993[_0x8bd2('0x20')],function(_0x2cd71){return{'model':db[_0x2cd71[_0x8bd2('0x1f')]],'as':_0x2cd71['as'],'attributes':_0x2cd71[_0x8bd2('0x1c')],'include':_0x2cd71['include']?_['map'](_0x2cd71[_0x8bd2('0x20')],function(_0xac7861){return{'model':db[_0xac7861[_0x8bd2('0x1f')]],'as':_0xac7861['as'],'attributes':_0xac7861[_0x8bd2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bd2('0xa')](function(_0x497e9c){logger['info'](_0x8bd2('0x16'),_0x5e5203);logger[_0x8bd2('0xd')](_0x8bd2('0x16'),_0x5e5203,JSON[_0x8bd2('0xf')](_0x497e9c));_0x5a8fcd(_0x497e9c);})[_0x8bd2('0x15')](function(_0x5ea241){logger[_0x8bd2('0x10')](_0x8bd2('0x16'),_0x5ea241[_0x8bd2('0x12')],_0x5e5203);_0x449ef4(_0x54787c['error'](0x1f4,_0x5ea241[_0x8bd2('0x12')]));});});};exports[_0x8bd2('0x21')]=function(_0x1dd432){var _0x1aaf0b=this;return new Promise(function(_0x1df8c6,_0x387e1e){return db[_0x8bd2('0x17')][_0x8bd2('0x22')]({'raw':_0x1dd432['options']?_0x1dd432[_0x8bd2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1dd432[_0x8bd2('0x19')]?_0x1dd432['options'][_0x8bd2('0x1b')]||null:null,'attributes':_0x1dd432['options']?_0x1dd432[_0x8bd2('0x19')]['attributes']||null:null,'include':_0x1dd432[_0x8bd2('0x19')]?_0x1dd432[_0x8bd2('0x19')][_0x8bd2('0x20')]?_[_0x8bd2('0x1e')](_0x1dd432[_0x8bd2('0x19')][_0x8bd2('0x20')],function(_0x6fc665){return{'model':db[_0x6fc665[_0x8bd2('0x1f')]],'as':_0x6fc665['as'],'attributes':_0x6fc665['attributes'],'include':_0x6fc665['include']?_[_0x8bd2('0x1e')](_0x6fc665[_0x8bd2('0x20')],function(_0x36d2e5){return{'model':db[_0x36d2e5[_0x8bd2('0x1f')]],'as':_0x36d2e5['as'],'attributes':_0x36d2e5['attributes'],'include':_0x36d2e5[_0x8bd2('0x20')]?_[_0x8bd2('0x1e')](_0x36d2e5[_0x8bd2('0x20')],function(_0x2dac4a){return{'model':db[_0x2dac4a['model']],'as':_0x2dac4a['as'],'attributes':_0x2dac4a[_0x8bd2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bd2('0xa')](function(_0x2389ab){logger[_0x8bd2('0xb')]('ShowServicenowAccount',_0x1dd432);logger['debug'](_0x8bd2('0x21'),_0x1dd432,JSON[_0x8bd2('0xf')](_0x2389ab));_0x1df8c6(_0x2389ab);})[_0x8bd2('0x15')](function(_0x372503){logger['error']('ShowServicenowAccount',_0x372503[_0x8bd2('0x12')],_0x1dd432);_0x387e1e(_0x1aaf0b[_0x8bd2('0x10')](0x1f4,_0x372503['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cb75575..1501670 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 _0x3868=['create','update','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x25a9af,_0x3c6d24){var _0x310d7c=function(_0xf2ead8){while(--_0xf2ead8){_0x25a9af['push'](_0x25a9af['shift']());}};_0x310d7c(++_0x3c6d24);}(_0x3868,0x82));var _0x8386=function(_0x54ed2d,_0x2c36f3){_0x54ed2d=_0x54ed2d-0x0;var _0x1b082b=_0x3868[_0x54ed2d];return _0x1b082b;};'use strict';var multer=require(_0x8386('0x0'));var util=require(_0x8386('0x1'));var path=require(_0x8386('0x2'));var timeout=require(_0x8386('0x3'));var express=require(_0x8386('0x4'));var router=express['Router']();var auth=require(_0x8386('0x5'));var interaction=require(_0x8386('0x6'));var config=require(_0x8386('0x7'));var controller=require(_0x8386('0x8'));router[_0x8386('0x9')]('/',auth[_0x8386('0xa')](),controller[_0x8386('0xb')]);router['get']('/:id',auth[_0x8386('0xa')](),controller[_0x8386('0xc')]);router[_0x8386('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8386('0xd')]);router[_0x8386('0x9')]('/:id/subjects',auth[_0x8386('0xa')](),controller['getSubjects']);router[_0x8386('0x9')](_0x8386('0xe'),auth[_0x8386('0xa')](),controller[_0x8386('0xf')]);router[_0x8386('0x10')]('/',auth[_0x8386('0xa')](),controller[_0x8386('0x11')]);router['put']('/:id',auth[_0x8386('0xa')](),controller[_0x8386('0x12')]);router['delete'](_0x8386('0x13'),auth[_0x8386('0xa')](),controller[_0x8386('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8636=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated'];(function(_0x48ae85,_0x4f6363){var _0x2257bc=function(_0x406d8f){while(--_0x406d8f){_0x48ae85['push'](_0x48ae85['shift']());}};_0x2257bc(++_0x4f6363);}(_0x8636,0x99));var _0x6863=function(_0x1dfa55,_0x1d2007){_0x1dfa55=_0x1dfa55-0x0;var _0x893d0e=_0x8636[_0x1dfa55];return _0x893d0e;};'use strict';var multer=require('multer');var util=require(_0x6863('0x0'));var path=require(_0x6863('0x1'));var timeout=require('connect-timeout');var express=require(_0x6863('0x2'));var router=express[_0x6863('0x3')]();var auth=require(_0x6863('0x4'));var interaction=require(_0x6863('0x5'));var config=require('../../config/environment');var controller=require(_0x6863('0x6'));router['get']('/',auth[_0x6863('0x7')](),controller[_0x6863('0x8')]);router[_0x6863('0x9')](_0x6863('0xa'),auth[_0x6863('0x7')](),controller[_0x6863('0xb')]);router[_0x6863('0x9')](_0x6863('0xc'),auth[_0x6863('0x7')](),controller[_0x6863('0xd')]);router['get'](_0x6863('0xe'),auth[_0x6863('0x7')](),controller[_0x6863('0xf')]);router[_0x6863('0x9')](_0x6863('0x10'),auth[_0x6863('0x7')](),controller[_0x6863('0x11')]);router[_0x6863('0x12')]('/',auth['isAuthenticated'](),controller[_0x6863('0x13')]);router['put'](_0x6863('0xa'),auth[_0x6863('0x7')](),controller[_0x6863('0x14')]);router[_0x6863('0x15')]('/:id',auth[_0x6863('0x7')](),controller['destroy']);module[_0x6863('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 43bf64f..c121c6a 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 _0x18b3=['STRING','sequelize','exports'];(function(_0x563eaa,_0x5b1ee6){var _0x1825cc=function(_0x1e5a94){while(--_0x1e5a94){_0x563eaa['push'](_0x563eaa['shift']());}};_0x1825cc(++_0x5b1ee6);}(_0x18b3,0x142));var _0x318b=function(_0x5e0112,_0x1a0f16){_0x5e0112=_0x5e0112-0x0;var _0x186ff5=_0x18b3[_0x5e0112];return _0x186ff5;};'use strict';var Sequelize=require(_0x318b('0x0'));module[_0x318b('0x1')]={'name':{'type':Sequelize[_0x318b('0x2')]},'description':{'type':Sequelize[_0x318b('0x2')]}}; \ No newline at end of file +var _0x421d=['exports','STRING','sequelize'];(function(_0x5c066d,_0x383034){var _0x7080a7=function(_0x10e2ac){while(--_0x10e2ac){_0x5c066d['push'](_0x5c066d['shift']());}};_0x7080a7(++_0x383034);}(_0x421d,0x98));var _0xd421=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x421d[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0xd421('0x0'));module[_0xd421('0x1')]={'name':{'type':Sequelize[_0xd421('0x2')]},'description':{'type':Sequelize[_0xd421('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index c9f320c..26bb996 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 _0xea28=['model','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','fields','body','destroy','ServicenowField','order','options','getFields','findOne','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','count','offset','limit','set','Content-Range','apply','update','end','sendStatus','stack','name','send','index','map','ServicenowConfiguration','key','query','keys','intersection','attributes'];(function(_0x346d3e,_0x30abd9){var _0x56824f=function(_0x3324b4){while(--_0x3324b4){_0x346d3e['push'](_0x346d3e['shift']());}};_0x56824f(++_0x30abd9);}(_0xea28,0x13a));var _0x8ea2=function(_0x1632fb,_0x82c3e4){_0x1632fb=_0x1632fb-0x0;var _0x3af79c=_0xea28[_0x1632fb];return _0x3af79c;};'use strict';var pdf=require(_0x8ea2('0x0'));var emlformat=require(_0x8ea2('0x1'));var rimraf=require(_0x8ea2('0x2'));var zipdir=require(_0x8ea2('0x3'));var jsonpatch=require(_0x8ea2('0x4'));var rp=require(_0x8ea2('0x5'));var moment=require(_0x8ea2('0x6'));var BPromise=require(_0x8ea2('0x7'));var Mustache=require('mustache');var util=require(_0x8ea2('0x8'));var path=require(_0x8ea2('0x9'));var sox=require(_0x8ea2('0xa'));var csv=require('to-csv');var ejs=require(_0x8ea2('0xb'));var fs=require('fs');var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0x11'));var querystring=require(_0x8ea2('0x12'));var Papa=require(_0x8ea2('0x13'));var Redis=require(_0x8ea2('0x14'));var authService=require(_0x8ea2('0x15'));var qs=require(_0x8ea2('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require(_0x8ea2('0x19'));var config=require('../../config/environment');var db=require(_0x8ea2('0x1a'))['db'];var jayson=require(_0x8ea2('0x1b'));var client=jayson[_0x8ea2('0x1c')][_0x8ea2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xe47c0e,_0x5e662e,_0x2879d6){if(_0x2879d6){var _0x553154=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x553154['test'](_0x5e662e)){return _0xe47c0e;}else{throw new db[(_0x8ea2('0x1e'))][(_0x8ea2('0x1f'))](_0x8ea2('0x20'));}}else{return _0xe47c0e;}}function respondWithRpcPromise(_0x78669a,_0x393faf,_0xbb9bd1,_0x3cff96){return new BPromise(function(_0x11f5e8,_0x474873){var _0x396aab=_0x3cff96||client;return _0x396aab[_0x8ea2('0x21')](_0x78669a,_0xbb9bd1)[_0x8ea2('0x22')](function(_0x3bc774){logger[_0x8ea2('0x23')](_0x8ea2('0x24'),_0x393faf,_0x8ea2('0x25'));logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x393faf,_0x8ea2('0x25'),JSON[_0x8ea2('0x28')](_0x3bc774));if(_0x3bc774[_0x8ea2('0x29')]){if(_0x3bc774[_0x8ea2('0x29')]['code']===0x1f4){logger['error'](_0x8ea2('0x24'),_0x393faf,_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);return _0x474873(_0x3bc774['error'][_0x8ea2('0x2a')]);}logger[_0x8ea2('0x29')]('ServicenowConfiguration,\x20%s,\x20%s',_0x393faf,_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);return _0x11f5e8(_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);}else{logger[_0x8ea2('0x23')](_0x8ea2('0x24'),_0x393faf,_0x8ea2('0x25'));_0x11f5e8(_0x3bc774[_0x8ea2('0x2b')][_0x8ea2('0x2a')]);}})['catch'](function(_0x433bc5){logger['error'](_0x8ea2('0x24'),_0x393faf,_0x433bc5);_0x474873(_0x433bc5);});});}function respondWithStatusCode(_0x42bec8,_0x29b38f){_0x29b38f=_0x29b38f||0xcc;return function(_0x4e2106){if(_0x4e2106){return _0x42bec8['sendStatus'](_0x29b38f);}return _0x42bec8[_0x8ea2('0x2c')](_0x29b38f)['end']();};}function respondWithResult(_0x200a49,_0x4e786d){_0x4e786d=_0x4e786d||0xc8;return function(_0x3be291){if(_0x3be291){return _0x200a49[_0x8ea2('0x2c')](_0x4e786d)[_0x8ea2('0x2d')](_0x3be291);}};}function respondWithFilteredResult(_0x266db8,_0x4e1b90){return function(_0x5ce1d4){if(_0x5ce1d4){var _0xacaa6c=_0x5ce1d4[_0x8ea2('0x2e')],_0x4da5b3=_0x4e1b90[_0x8ea2('0x2f')],_0x4a9875=_0x4e1b90[_0x8ea2('0x2f')]+_0x4e1b90[_0x8ea2('0x30')],_0x287078;if(_0x4a9875>=_0xacaa6c){_0x4a9875=_0xacaa6c;_0x287078=0xc8;}else{_0x287078=0xce;}_0x266db8[_0x8ea2('0x2c')](_0x287078);return _0x266db8[_0x8ea2('0x31')](_0x8ea2('0x32'),_0x4da5b3+'-'+_0x4a9875+'/'+_0xacaa6c)[_0x8ea2('0x2d')](_0x5ce1d4);}return null;};}function patchUpdates(_0x56d914){return function(_0x5b7ff9){try{jsonpatch[_0x8ea2('0x33')](_0x5b7ff9,_0x56d914,!![]);}catch(_0x188553){return BPromise['reject'](_0x188553);}return _0x5b7ff9['save']();};}function saveUpdates(_0x1ee7b2,_0x4e273e){return function(_0x64475b){if(_0x64475b){return _0x64475b[_0x8ea2('0x34')](_0x1ee7b2)['then'](function(_0x17b21c){return _0x17b21c;});}return null;};}function removeEntity(_0x38f3d5,_0x33abc8){return function(_0x4cfdc6){if(_0x4cfdc6){return _0x4cfdc6['destroy']()['then'](function(){_0x38f3d5[_0x8ea2('0x2c')](0xcc)[_0x8ea2('0x35')]();});}};}function handleEntityNotFound(_0x3fc785,_0x5ef924){return function(_0x456487){if(!_0x456487){_0x3fc785[_0x8ea2('0x36')](0x194);}return _0x456487;};}function handleError(_0x3d5bf0,_0x278e5d){_0x278e5d=_0x278e5d||0x1f4;return function(_0x253031){logger[_0x8ea2('0x29')](_0x253031[_0x8ea2('0x37')]);if(_0x253031[_0x8ea2('0x38')]){delete _0x253031['name'];}_0x3d5bf0[_0x8ea2('0x2c')](_0x278e5d)[_0x8ea2('0x39')](_0x253031);};}exports[_0x8ea2('0x3a')]=function(_0x467d97,_0x4eebc1){var _0x2a1f14={},_0x5355aa={},_0x1e03f2={'count':0x0,'rows':[]};var _0x103d5a=_[_0x8ea2('0x3b')](db[_0x8ea2('0x3c')]['rawAttributes'],function(_0x2bed24){return{'name':_0x2bed24['fieldName'],'type':_0x2bed24['type'][_0x8ea2('0x3d')]};});_0x5355aa['model']=_[_0x8ea2('0x3b')](_0x103d5a,_0x8ea2('0x38'));_0x5355aa[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x467d97[_0x8ea2('0x3e')]);_0x5355aa['filters']=_[_0x8ea2('0x40')](_0x5355aa['model'],_0x5355aa[_0x8ea2('0x3e')]);_0x2a1f14[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x5355aa[_0x8ea2('0x42')],qs['fields'](_0x467d97[_0x8ea2('0x3e')]['fields']));_0x2a1f14[_0x8ea2('0x41')]=_0x2a1f14['attributes'][_0x8ea2('0x43')]?_0x2a1f14[_0x8ea2('0x41')]:_0x5355aa[_0x8ea2('0x42')];if(!_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x44')](_0x8ea2('0x45'))){_0x2a1f14[_0x8ea2('0x30')]=qs['limit'](_0x467d97['query'][_0x8ea2('0x30')]);_0x2a1f14['offset']=qs['offset'](_0x467d97['query'][_0x8ea2('0x2f')]);}_0x2a1f14['order']=qs[_0x8ea2('0x46')](_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x2a1f14[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x467d97[_0x8ea2('0x3e')],_0x5355aa[_0x8ea2('0x48')]),_0x103d5a);if(_0x467d97['query'][_0x8ea2('0x4a')]){_0x2a1f14[_0x8ea2('0x47')]=_[_0x8ea2('0x4b')](_0x2a1f14['where'],{'$or':_[_0x8ea2('0x3b')](_0x103d5a,function(_0x17df7b){if(_0x17df7b[_0x8ea2('0x4c')]!==_0x8ea2('0x4d')){var _0x20992d={};_0x20992d[_0x17df7b['name']]={'$like':'%'+_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x20992d;}})});}_0x2a1f14=_[_0x8ea2('0x4b')]({},_0x2a1f14,_0x467d97['options']);var _0x99fe91={'where':_0x2a1f14[_0x8ea2('0x47')]};return db[_0x8ea2('0x3c')][_0x8ea2('0x2e')](_0x99fe91)[_0x8ea2('0x22')](function(_0x3ca1c8){_0x1e03f2[_0x8ea2('0x2e')]=_0x3ca1c8;if(_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x4e')]){_0x2a1f14[_0x8ea2('0x4f')]=[{'all':!![]}];}return db[_0x8ea2('0x3c')][_0x8ea2('0x50')](_0x2a1f14);})[_0x8ea2('0x22')](function(_0x12e81f){_0x1e03f2['rows']=_0x12e81f;return _0x1e03f2;})[_0x8ea2('0x22')](respondWithFilteredResult(_0x4eebc1,_0x2a1f14))[_0x8ea2('0x51')](handleError(_0x4eebc1,null));};exports[_0x8ea2('0x52')]=function(_0x6ed85a,_0x182a46){var _0x1daa25={'raw':![],'where':{'id':_0x6ed85a[_0x8ea2('0x53')]['id']}},_0x11b3ef={};_0x11b3ef['model']=_[_0x8ea2('0x3f')](db[_0x8ea2('0x3c')][_0x8ea2('0x54')]);_0x11b3ef['query']=_['keys'](_0x6ed85a[_0x8ea2('0x3e')]);_0x11b3ef[_0x8ea2('0x48')]=_[_0x8ea2('0x40')](_0x11b3ef['model'],_0x11b3ef[_0x8ea2('0x3e')]);_0x1daa25[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x11b3ef[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x6ed85a['query']['fields']));_0x1daa25[_0x8ea2('0x41')]=_0x1daa25[_0x8ea2('0x41')][_0x8ea2('0x43')]?_0x1daa25['attributes']:_0x11b3ef[_0x8ea2('0x42')];if(_0x6ed85a[_0x8ea2('0x3e')][_0x8ea2('0x4e')]){_0x1daa25['include']=[{'all':!![]}];}_0x1daa25=_['merge']({},_0x1daa25,_0x6ed85a['options']);return db['ServicenowConfiguration']['find'](_0x1daa25)[_0x8ea2('0x22')](handleEntityNotFound(_0x182a46,null))[_0x8ea2('0x22')](respondWithResult(_0x182a46,null))['catch'](handleError(_0x182a46,null));};exports['create']=function(_0x1a7a75,_0x12c0db){return db[_0x8ea2('0x3c')]['create'](_0x1a7a75[_0x8ea2('0x56')],{})[_0x8ea2('0x22')](respondWithResult(_0x12c0db,0xc9))['catch'](handleError(_0x12c0db,null));};exports[_0x8ea2('0x34')]=function(_0x28e56a,_0x293dd8){if(_0x28e56a[_0x8ea2('0x56')]['id']){delete _0x28e56a[_0x8ea2('0x56')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x28e56a['params']['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x293dd8,null))[_0x8ea2('0x22')](saveUpdates(_0x28e56a[_0x8ea2('0x56')],null))[_0x8ea2('0x22')](respondWithResult(_0x293dd8,null))[_0x8ea2('0x51')](handleError(_0x293dd8,null));};exports[_0x8ea2('0x57')]=function(_0x36fda3,_0x5265e7){return db['ServicenowConfiguration']['find']({'where':{'id':_0x36fda3[_0x8ea2('0x53')]['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x5265e7,null))[_0x8ea2('0x22')](removeEntity(_0x5265e7,null))[_0x8ea2('0x51')](handleError(_0x5265e7,null));};exports['getFields']=function(_0x11824e,_0x2b8662,_0x4ec833){var _0x21485a={};var _0x193c32={};var _0x142ede;var _0xf78d1d;return db[_0x8ea2('0x3c')]['findOne']({'where':{'id':_0x11824e['params']['id']}})['then'](handleEntityNotFound(_0x2b8662,null))[_0x8ea2('0x22')](function(_0x1e2066){if(_0x1e2066){_0x142ede=_0x1e2066;_0x193c32[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x193c32[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x11824e[_0x8ea2('0x3e')]);_0x193c32[_0x8ea2('0x48')]=_['intersection'](_0x193c32[_0x8ea2('0x42')],_0x193c32['query']);_0x21485a[_0x8ea2('0x41')]=_['intersection'](_0x193c32[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x11824e['query']['fields']));_0x21485a[_0x8ea2('0x41')]=_0x21485a['attributes'][_0x8ea2('0x43')]?_0x21485a[_0x8ea2('0x41')]:_0x193c32[_0x8ea2('0x42')];_0x21485a[_0x8ea2('0x59')]=qs['sort'](_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x21485a[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x11824e[_0x8ea2('0x3e')],_0x193c32[_0x8ea2('0x48')]));if(_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x21485a[_0x8ea2('0x47')]=_[_0x8ea2('0x4b')](_0x21485a[_0x8ea2('0x47')],{'$or':_['map'](_0x21485a[_0x8ea2('0x41')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x4de6ba;})});}_0x21485a=_[_0x8ea2('0x4b')]({},_0x21485a,_0x11824e[_0x8ea2('0x5a')]);return _0x142ede[_0x8ea2('0x5b')](_0x21485a);}})[_0x8ea2('0x22')](function(_0xefb7b){if(_0xefb7b){_0xf78d1d=_0xefb7b[_0x8ea2('0x43')];if(!_0x11824e[_0x8ea2('0x3e')]['hasOwnProperty'](_0x8ea2('0x45'))){_0x21485a[_0x8ea2('0x30')]=qs[_0x8ea2('0x30')](_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x30')]);_0x21485a['offset']=qs['offset'](_0x11824e['query'][_0x8ea2('0x2f')]);}return _0x142ede[_0x8ea2('0x5b')](_0x21485a);}})[_0x8ea2('0x22')](function(_0x31bda0){if(_0x31bda0){return _0x31bda0?{'count':_0xf78d1d,'rows':_0x31bda0}:null;}})[_0x8ea2('0x22')](respondWithResult(_0x2b8662,null))[_0x8ea2('0x51')](handleError(_0x2b8662,null));};exports['getSubjects']=function(_0x428106,_0x14dd7d,_0x5712a3){var _0x55f929={};var _0x2a7ccc={};var _0x145a88;var _0x1bf4cb;return db[_0x8ea2('0x3c')][_0x8ea2('0x5c')]({'where':{'id':_0x428106[_0x8ea2('0x53')]['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x14dd7d,null))['then'](function(_0x435233){if(_0x435233){_0x145a88=_0x435233;_0x2a7ccc[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x2a7ccc[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x428106[_0x8ea2('0x3e')]);_0x2a7ccc['filters']=_[_0x8ea2('0x40')](_0x2a7ccc['model'],_0x2a7ccc['query']);_0x55f929[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x2a7ccc['model'],qs['fields'](_0x428106['query'][_0x8ea2('0x55')]));_0x55f929['attributes']=_0x55f929['attributes'][_0x8ea2('0x43')]?_0x55f929[_0x8ea2('0x41')]:_0x2a7ccc[_0x8ea2('0x42')];_0x55f929[_0x8ea2('0x59')]=qs[_0x8ea2('0x46')](_0x428106[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x55f929[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x428106[_0x8ea2('0x3e')],_0x2a7ccc[_0x8ea2('0x48')]));if(_0x428106[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x55f929['where']=_[_0x8ea2('0x4b')](_0x55f929[_0x8ea2('0x47')],{'$or':_[_0x8ea2('0x3b')](_0x55f929['attributes'],function(_0x1807bb){var _0x486ae8={};_0x486ae8[_0x1807bb]={'$like':'%'+_0x428106[_0x8ea2('0x3e')]['filter']+'%'};return _0x486ae8;})});}_0x55f929=_[_0x8ea2('0x4b')]({},_0x55f929,_0x428106['options']);return _0x145a88[_0x8ea2('0x5d')](_0x55f929);}})[_0x8ea2('0x22')](function(_0x4cdc8d){if(_0x4cdc8d){_0x1bf4cb=_0x4cdc8d[_0x8ea2('0x43')];if(!_0x428106['query'][_0x8ea2('0x44')](_0x8ea2('0x45'))){_0x55f929[_0x8ea2('0x30')]=qs[_0x8ea2('0x30')](_0x428106[_0x8ea2('0x3e')]['limit']);_0x55f929['offset']=qs[_0x8ea2('0x2f')](_0x428106['query'][_0x8ea2('0x2f')]);}return _0x145a88[_0x8ea2('0x5d')](_0x55f929);}})[_0x8ea2('0x22')](function(_0x1c365e){if(_0x1c365e){return _0x1c365e?{'count':_0x1bf4cb,'rows':_0x1c365e}:null;}})[_0x8ea2('0x22')](respondWithResult(_0x14dd7d,null))[_0x8ea2('0x51')](handleError(_0x14dd7d,null));};exports['getDescriptions']=function(_0x4aa32e,_0x53d9f3,_0x1f50dc){var _0x576075={};var _0x27b7c6={};var _0x36a913;var _0x3d9242;return db[_0x8ea2('0x3c')][_0x8ea2('0x5c')]({'where':{'id':_0x4aa32e[_0x8ea2('0x53')]['id']}})['then'](handleEntityNotFound(_0x53d9f3,null))[_0x8ea2('0x22')](function(_0x1a6426){if(_0x1a6426){_0x36a913=_0x1a6426;_0x27b7c6[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x27b7c6['query']=_[_0x8ea2('0x3f')](_0x4aa32e[_0x8ea2('0x3e')]);_0x27b7c6[_0x8ea2('0x48')]=_[_0x8ea2('0x40')](_0x27b7c6[_0x8ea2('0x42')],_0x27b7c6[_0x8ea2('0x3e')]);_0x576075[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x27b7c6[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x55')]));_0x576075[_0x8ea2('0x41')]=_0x576075[_0x8ea2('0x41')][_0x8ea2('0x43')]?_0x576075[_0x8ea2('0x41')]:_0x27b7c6[_0x8ea2('0x42')];_0x576075['order']=qs['sort'](_0x4aa32e[_0x8ea2('0x3e')]['sort']);_0x576075[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_['pick'](_0x4aa32e[_0x8ea2('0x3e')],_0x27b7c6['filters']));if(_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x576075['where']=_[_0x8ea2('0x4b')](_0x576075[_0x8ea2('0x47')],{'$or':_[_0x8ea2('0x3b')](_0x576075[_0x8ea2('0x41')],function(_0x14dac9){var _0x28e80a={};_0x28e80a[_0x14dac9]={'$like':'%'+_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x28e80a;})});}_0x576075=_[_0x8ea2('0x4b')]({},_0x576075,_0x4aa32e[_0x8ea2('0x5a')]);return _0x36a913['getDescriptions'](_0x576075);}})[_0x8ea2('0x22')](function(_0x1051ac){if(_0x1051ac){_0x3d9242=_0x1051ac['length'];if(!_0x4aa32e[_0x8ea2('0x3e')]['hasOwnProperty']('nolimit')){_0x576075['limit']=qs[_0x8ea2('0x30')](_0x4aa32e['query'][_0x8ea2('0x30')]);_0x576075[_0x8ea2('0x2f')]=qs[_0x8ea2('0x2f')](_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x2f')]);}return _0x36a913[_0x8ea2('0x5e')](_0x576075);}})['then'](function(_0x2f4f45){if(_0x2f4f45){return _0x2f4f45?{'count':_0x3d9242,'rows':_0x2f4f45}:null;}})['then'](respondWithResult(_0x53d9f3,null))[_0x8ea2('0x51')](handleError(_0x53d9f3,null));}; \ No newline at end of file +var _0x36ee=['catch','sendStatus','status','end','json','limit','apply','reject','update','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','ServicenowConfiguration','count','include','findAll','rows','show','params','length','includeAll','create','body','find','getFields','findOne','ServicenowField','order','pick','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x1b55de,_0xe4362a){var _0x461a2c=function(_0x3f23d7){while(--_0x3f23d7){_0x1b55de['push'](_0x1b55de['shift']());}};_0x461a2c(++_0xe4362a);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe36e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36e('0x1'));var rp=require(_0xe36e('0x2'));var moment=require(_0xe36e('0x3'));var BPromise=require(_0xe36e('0x4'));var Mustache=require(_0xe36e('0x5'));var util=require(_0xe36e('0x6'));var path=require(_0xe36e('0x7'));var sox=require(_0xe36e('0x8'));var csv=require(_0xe36e('0x9'));var ejs=require(_0xe36e('0xa'));var fs=require('fs');var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x9'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var db=require(_0xe36e('0x17'))['db'];var jayson=require(_0xe36e('0x18'));var client=jayson['client'][_0xe36e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x27841e,_0x23abfb,_0x1fdea2){if(_0x1fdea2){var _0x5c3f3c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c3f3c[_0xe36e('0x1a')](_0x23abfb)){return _0x27841e;}else{throw new db['Sequelize']['ValidationError'](_0xe36e('0x1b'));}}else{return _0x27841e;}}function respondWithRpcPromise(_0x300f21,_0x26fb37,_0x278135,_0xd6828e){return new BPromise(function(_0x924cd5,_0x2096f6){var _0x39bae8=_0xd6828e||client;return _0x39bae8[_0xe36e('0x1c')](_0x300f21,_0x278135)[_0xe36e('0x1d')](function(_0x5792e8){logger[_0xe36e('0x1e')](_0xe36e('0x1f'),_0x26fb37,'request\x20sent');logger[_0xe36e('0x20')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x26fb37,_0xe36e('0x21'),JSON[_0xe36e('0x22')](_0x5792e8));if(_0x5792e8['error']){if(_0x5792e8[_0xe36e('0x23')][_0xe36e('0x24')]===0x1f4){logger[_0xe36e('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x26fb37,_0x5792e8[_0xe36e('0x23')][_0xe36e('0x25')]);return _0x2096f6(_0x5792e8[_0xe36e('0x23')][_0xe36e('0x25')]);}logger[_0xe36e('0x23')](_0xe36e('0x1f'),_0x26fb37,_0x5792e8['error'][_0xe36e('0x25')]);return _0x924cd5(_0x5792e8[_0xe36e('0x23')][_0xe36e('0x25')]);}else{logger[_0xe36e('0x1e')](_0xe36e('0x1f'),_0x26fb37,'request\x20sent');_0x924cd5(_0x5792e8['result'][_0xe36e('0x25')]);}})[_0xe36e('0x26')](function(_0xb0cd85){logger[_0xe36e('0x23')](_0xe36e('0x1f'),_0x26fb37,_0xb0cd85);_0x2096f6(_0xb0cd85);});});}function respondWithStatusCode(_0x1507f9,_0x1a045c){_0x1a045c=_0x1a045c||0xcc;return function(_0x5ac484){if(_0x5ac484){return _0x1507f9[_0xe36e('0x27')](_0x1a045c);}return _0x1507f9[_0xe36e('0x28')](_0x1a045c)[_0xe36e('0x29')]();};}function respondWithResult(_0x262caa,_0x5e58d8){_0x5e58d8=_0x5e58d8||0xc8;return function(_0x2d757c){if(_0x2d757c){return _0x262caa['status'](_0x5e58d8)[_0xe36e('0x2a')](_0x2d757c);}};}function respondWithFilteredResult(_0x5993de,_0x19f001){return function(_0x5884cb){if(_0x5884cb){var _0x410504=_0x5884cb['count'],_0x4c5d98=_0x19f001['offset'],_0x3b1045=_0x19f001['offset']+_0x19f001[_0xe36e('0x2b')],_0x59548b;if(_0x3b1045>=_0x410504){_0x3b1045=_0x410504;_0x59548b=0xc8;}else{_0x59548b=0xce;}_0x5993de[_0xe36e('0x28')](_0x59548b);return _0x5993de['set']('Content-Range',_0x4c5d98+'-'+_0x3b1045+'/'+_0x410504)[_0xe36e('0x2a')](_0x5884cb);}return null;};}function patchUpdates(_0xb8d44e){return function(_0x259e19){try{jsonpatch[_0xe36e('0x2c')](_0x259e19,_0xb8d44e,!![]);}catch(_0x3d826e){return BPromise[_0xe36e('0x2d')](_0x3d826e);}return _0x259e19['save']();};}function saveUpdates(_0xb98e78,_0x11c95d){return function(_0x57272f){if(_0x57272f){return _0x57272f[_0xe36e('0x2e')](_0xb98e78)[_0xe36e('0x1d')](function(_0xba4869){return _0xba4869;});}return null;};}function removeEntity(_0x5d6f41,_0x21623e){return function(_0x253cdc){if(_0x253cdc){return _0x253cdc[_0xe36e('0x2f')]()[_0xe36e('0x1d')](function(){_0x5d6f41[_0xe36e('0x28')](0xcc)[_0xe36e('0x29')]();});}};}function handleEntityNotFound(_0xf808f5,_0x4c0c46){return function(_0x4507b9){if(!_0x4507b9){_0xf808f5['sendStatus'](0x194);}return _0x4507b9;};}function handleError(_0x4a717e,_0x81cf9a){_0x81cf9a=_0x81cf9a||0x1f4;return function(_0x4f620d){logger[_0xe36e('0x23')](_0x4f620d[_0xe36e('0x30')]);if(_0x4f620d[_0xe36e('0x31')]){delete _0x4f620d[_0xe36e('0x31')];}_0x4a717e['status'](_0x81cf9a)['send'](_0x4f620d);};}exports[_0xe36e('0x32')]=function(_0x222c65,_0x19a53f){var _0x243338={},_0x51894c={},_0xb2046c={'count':0x0,'rows':[]};var _0x2f828e=_[_0xe36e('0x33')](db['ServicenowConfiguration'][_0xe36e('0x34')],function(_0x2ff8f4){return{'name':_0x2ff8f4['fieldName'],'type':_0x2ff8f4[_0xe36e('0x35')][_0xe36e('0x36')]};});_0x51894c[_0xe36e('0x37')]=_[_0xe36e('0x33')](_0x2f828e,_0xe36e('0x31'));_0x51894c[_0xe36e('0x38')]=_[_0xe36e('0x39')](_0x222c65[_0xe36e('0x38')]);_0x51894c[_0xe36e('0x3a')]=_[_0xe36e('0x3b')](_0x51894c[_0xe36e('0x37')],_0x51894c[_0xe36e('0x38')]);_0x243338[_0xe36e('0x3c')]=_['intersection'](_0x51894c[_0xe36e('0x37')],qs[_0xe36e('0x3d')](_0x222c65[_0xe36e('0x38')][_0xe36e('0x3d')]));_0x243338[_0xe36e('0x3c')]=_0x243338['attributes']['length']?_0x243338[_0xe36e('0x3c')]:_0x51894c[_0xe36e('0x37')];if(!_0x222c65[_0xe36e('0x38')][_0xe36e('0x3e')](_0xe36e('0x3f'))){_0x243338[_0xe36e('0x2b')]=qs[_0xe36e('0x2b')](_0x222c65[_0xe36e('0x38')]['limit']);_0x243338[_0xe36e('0x40')]=qs[_0xe36e('0x40')](_0x222c65['query'][_0xe36e('0x40')]);}_0x243338['order']=qs[_0xe36e('0x41')](_0x222c65[_0xe36e('0x38')][_0xe36e('0x41')]);_0x243338[_0xe36e('0x42')]=qs[_0xe36e('0x3a')](_['pick'](_0x222c65[_0xe36e('0x38')],_0x51894c[_0xe36e('0x3a')]),_0x2f828e);if(_0x222c65[_0xe36e('0x38')][_0xe36e('0x43')]){_0x243338[_0xe36e('0x42')]=_[_0xe36e('0x44')](_0x243338['where'],{'$or':_[_0xe36e('0x33')](_0x2f828e,function(_0x134d71){if(_0x134d71[_0xe36e('0x35')]!==_0xe36e('0x45')){var _0x1cbb7d={};_0x1cbb7d[_0x134d71['name']]={'$like':'%'+_0x222c65[_0xe36e('0x38')][_0xe36e('0x43')]+'%'};return _0x1cbb7d;}})});}_0x243338=_[_0xe36e('0x44')]({},_0x243338,_0x222c65[_0xe36e('0x46')]);var _0x11d6b2={'where':_0x243338[_0xe36e('0x42')]};return db[_0xe36e('0x47')][_0xe36e('0x48')](_0x11d6b2)[_0xe36e('0x1d')](function(_0x52e744){_0xb2046c['count']=_0x52e744;if(_0x222c65[_0xe36e('0x38')]['includeAll']){_0x243338[_0xe36e('0x49')]=[{'all':!![]}];}return db[_0xe36e('0x47')][_0xe36e('0x4a')](_0x243338);})[_0xe36e('0x1d')](function(_0x51641c){_0xb2046c[_0xe36e('0x4b')]=_0x51641c;return _0xb2046c;})[_0xe36e('0x1d')](respondWithFilteredResult(_0x19a53f,_0x243338))['catch'](handleError(_0x19a53f,null));};exports[_0xe36e('0x4c')]=function(_0x40634a,_0x2c26e6){var _0x42eae5={'raw':![],'where':{'id':_0x40634a[_0xe36e('0x4d')]['id']}},_0x15895d={};_0x15895d[_0xe36e('0x37')]=_[_0xe36e('0x39')](db[_0xe36e('0x47')][_0xe36e('0x34')]);_0x15895d[_0xe36e('0x38')]=_[_0xe36e('0x39')](_0x40634a[_0xe36e('0x38')]);_0x15895d[_0xe36e('0x3a')]=_[_0xe36e('0x3b')](_0x15895d['model'],_0x15895d[_0xe36e('0x38')]);_0x42eae5['attributes']=_['intersection'](_0x15895d[_0xe36e('0x37')],qs[_0xe36e('0x3d')](_0x40634a['query'][_0xe36e('0x3d')]));_0x42eae5[_0xe36e('0x3c')]=_0x42eae5[_0xe36e('0x3c')][_0xe36e('0x4e')]?_0x42eae5[_0xe36e('0x3c')]:_0x15895d[_0xe36e('0x37')];if(_0x40634a[_0xe36e('0x38')][_0xe36e('0x4f')]){_0x42eae5[_0xe36e('0x49')]=[{'all':!![]}];}_0x42eae5=_['merge']({},_0x42eae5,_0x40634a[_0xe36e('0x46')]);return db[_0xe36e('0x47')]['find'](_0x42eae5)[_0xe36e('0x1d')](handleEntityNotFound(_0x2c26e6,null))[_0xe36e('0x1d')](respondWithResult(_0x2c26e6,null))[_0xe36e('0x26')](handleError(_0x2c26e6,null));};exports[_0xe36e('0x50')]=function(_0x3770bd,_0x53758e){return db['ServicenowConfiguration']['create'](_0x3770bd['body'],{})[_0xe36e('0x1d')](respondWithResult(_0x53758e,0xc9))[_0xe36e('0x26')](handleError(_0x53758e,null));};exports[_0xe36e('0x2e')]=function(_0x3e3d4d,_0x9025cd){if(_0x3e3d4d[_0xe36e('0x51')]['id']){delete _0x3e3d4d[_0xe36e('0x51')]['id'];}return db[_0xe36e('0x47')][_0xe36e('0x52')]({'where':{'id':_0x3e3d4d['params']['id']}})[_0xe36e('0x1d')](handleEntityNotFound(_0x9025cd,null))[_0xe36e('0x1d')](saveUpdates(_0x3e3d4d['body'],null))[_0xe36e('0x1d')](respondWithResult(_0x9025cd,null))[_0xe36e('0x26')](handleError(_0x9025cd,null));};exports[_0xe36e('0x2f')]=function(_0x443154,_0x700b63){return db[_0xe36e('0x47')][_0xe36e('0x52')]({'where':{'id':_0x443154[_0xe36e('0x4d')]['id']}})[_0xe36e('0x1d')](handleEntityNotFound(_0x700b63,null))[_0xe36e('0x1d')](removeEntity(_0x700b63,null))[_0xe36e('0x26')](handleError(_0x700b63,null));};exports[_0xe36e('0x53')]=function(_0x389e91,_0x6f979f,_0x3512ec){var _0x3e4860={};var _0x3c78ea={};var _0x275142;var _0x14738a;return db[_0xe36e('0x47')][_0xe36e('0x54')]({'where':{'id':_0x389e91[_0xe36e('0x4d')]['id']}})[_0xe36e('0x1d')](handleEntityNotFound(_0x6f979f,null))[_0xe36e('0x1d')](function(_0x40604f){if(_0x40604f){_0x275142=_0x40604f;_0x3c78ea['model']=_[_0xe36e('0x39')](db[_0xe36e('0x55')]['rawAttributes']);_0x3c78ea[_0xe36e('0x38')]=_[_0xe36e('0x39')](_0x389e91[_0xe36e('0x38')]);_0x3c78ea[_0xe36e('0x3a')]=_[_0xe36e('0x3b')](_0x3c78ea[_0xe36e('0x37')],_0x3c78ea['query']);_0x3e4860[_0xe36e('0x3c')]=_['intersection'](_0x3c78ea[_0xe36e('0x37')],qs[_0xe36e('0x3d')](_0x389e91[_0xe36e('0x38')][_0xe36e('0x3d')]));_0x3e4860[_0xe36e('0x3c')]=_0x3e4860[_0xe36e('0x3c')][_0xe36e('0x4e')]?_0x3e4860[_0xe36e('0x3c')]:_0x3c78ea['model'];_0x3e4860[_0xe36e('0x56')]=qs[_0xe36e('0x41')](_0x389e91['query'][_0xe36e('0x41')]);_0x3e4860[_0xe36e('0x42')]=qs[_0xe36e('0x3a')](_[_0xe36e('0x57')](_0x389e91[_0xe36e('0x38')],_0x3c78ea[_0xe36e('0x3a')]));if(_0x389e91[_0xe36e('0x38')]['filter']){_0x3e4860[_0xe36e('0x42')]=_[_0xe36e('0x44')](_0x3e4860[_0xe36e('0x42')],{'$or':_[_0xe36e('0x33')](_0x3e4860[_0xe36e('0x3c')],function(_0x43d8c2){var _0xc1daf8={};_0xc1daf8[_0x43d8c2]={'$like':'%'+_0x389e91[_0xe36e('0x38')][_0xe36e('0x43')]+'%'};return _0xc1daf8;})});}_0x3e4860=_[_0xe36e('0x44')]({},_0x3e4860,_0x389e91[_0xe36e('0x46')]);return _0x275142['getFields'](_0x3e4860);}})[_0xe36e('0x1d')](function(_0x9a77de){if(_0x9a77de){_0x14738a=_0x9a77de[_0xe36e('0x4e')];if(!_0x389e91[_0xe36e('0x38')]['hasOwnProperty']('nolimit')){_0x3e4860[_0xe36e('0x2b')]=qs['limit'](_0x389e91['query']['limit']);_0x3e4860[_0xe36e('0x40')]=qs['offset'](_0x389e91[_0xe36e('0x38')][_0xe36e('0x40')]);}return _0x275142[_0xe36e('0x53')](_0x3e4860);}})[_0xe36e('0x1d')](function(_0x1bd60d){if(_0x1bd60d){return _0x1bd60d?{'count':_0x14738a,'rows':_0x1bd60d}:null;}})[_0xe36e('0x1d')](respondWithResult(_0x6f979f,null))[_0xe36e('0x26')](handleError(_0x6f979f,null));};exports[_0xe36e('0x58')]=function(_0x2a26f4,_0x5e7c92,_0x7b9501){var _0x54f14c={};var _0x13ad07={};var _0x517c2a;var _0x3080ad;return db[_0xe36e('0x47')][_0xe36e('0x54')]({'where':{'id':_0x2a26f4[_0xe36e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e7c92,null))['then'](function(_0x5cccb7){if(_0x5cccb7){_0x517c2a=_0x5cccb7;_0x13ad07[_0xe36e('0x37')]=_[_0xe36e('0x39')](db[_0xe36e('0x55')][_0xe36e('0x34')]);_0x13ad07[_0xe36e('0x38')]=_['keys'](_0x2a26f4[_0xe36e('0x38')]);_0x13ad07[_0xe36e('0x3a')]=_['intersection'](_0x13ad07[_0xe36e('0x37')],_0x13ad07['query']);_0x54f14c[_0xe36e('0x3c')]=_[_0xe36e('0x3b')](_0x13ad07[_0xe36e('0x37')],qs[_0xe36e('0x3d')](_0x2a26f4['query'][_0xe36e('0x3d')]));_0x54f14c['attributes']=_0x54f14c['attributes'][_0xe36e('0x4e')]?_0x54f14c[_0xe36e('0x3c')]:_0x13ad07['model'];_0x54f14c['order']=qs[_0xe36e('0x41')](_0x2a26f4['query'][_0xe36e('0x41')]);_0x54f14c[_0xe36e('0x42')]=qs[_0xe36e('0x3a')](_[_0xe36e('0x57')](_0x2a26f4[_0xe36e('0x38')],_0x13ad07[_0xe36e('0x3a')]));if(_0x2a26f4['query'][_0xe36e('0x43')]){_0x54f14c[_0xe36e('0x42')]=_[_0xe36e('0x44')](_0x54f14c[_0xe36e('0x42')],{'$or':_['map'](_0x54f14c[_0xe36e('0x3c')],function(_0x37409f){var _0x2eef73={};_0x2eef73[_0x37409f]={'$like':'%'+_0x2a26f4[_0xe36e('0x38')]['filter']+'%'};return _0x2eef73;})});}_0x54f14c=_[_0xe36e('0x44')]({},_0x54f14c,_0x2a26f4['options']);return _0x517c2a[_0xe36e('0x58')](_0x54f14c);}})['then'](function(_0x160621){if(_0x160621){_0x3080ad=_0x160621['length'];if(!_0x2a26f4['query'][_0xe36e('0x3e')](_0xe36e('0x3f'))){_0x54f14c[_0xe36e('0x2b')]=qs['limit'](_0x2a26f4[_0xe36e('0x38')][_0xe36e('0x2b')]);_0x54f14c['offset']=qs[_0xe36e('0x40')](_0x2a26f4[_0xe36e('0x38')][_0xe36e('0x40')]);}return _0x517c2a['getSubjects'](_0x54f14c);}})['then'](function(_0x72fcc){if(_0x72fcc){return _0x72fcc?{'count':_0x3080ad,'rows':_0x72fcc}:null;}})[_0xe36e('0x1d')](respondWithResult(_0x5e7c92,null))[_0xe36e('0x26')](handleError(_0x5e7c92,null));};exports[_0xe36e('0x59')]=function(_0x411305,_0x51bc99,_0x3797f0){var _0x2847a2={};var _0x15334c={};var _0x79882;var _0xdc59c5;return db['ServicenowConfiguration'][_0xe36e('0x54')]({'where':{'id':_0x411305[_0xe36e('0x4d')]['id']}})[_0xe36e('0x1d')](handleEntityNotFound(_0x51bc99,null))['then'](function(_0x25e4eb){if(_0x25e4eb){_0x79882=_0x25e4eb;_0x15334c['model']=_[_0xe36e('0x39')](db['ServicenowField'][_0xe36e('0x34')]);_0x15334c[_0xe36e('0x38')]=_['keys'](_0x411305[_0xe36e('0x38')]);_0x15334c['filters']=_[_0xe36e('0x3b')](_0x15334c[_0xe36e('0x37')],_0x15334c[_0xe36e('0x38')]);_0x2847a2[_0xe36e('0x3c')]=_[_0xe36e('0x3b')](_0x15334c['model'],qs[_0xe36e('0x3d')](_0x411305['query'][_0xe36e('0x3d')]));_0x2847a2[_0xe36e('0x3c')]=_0x2847a2[_0xe36e('0x3c')][_0xe36e('0x4e')]?_0x2847a2[_0xe36e('0x3c')]:_0x15334c[_0xe36e('0x37')];_0x2847a2['order']=qs[_0xe36e('0x41')](_0x411305[_0xe36e('0x38')][_0xe36e('0x41')]);_0x2847a2['where']=qs[_0xe36e('0x3a')](_[_0xe36e('0x57')](_0x411305[_0xe36e('0x38')],_0x15334c[_0xe36e('0x3a')]));if(_0x411305['query'][_0xe36e('0x43')]){_0x2847a2['where']=_[_0xe36e('0x44')](_0x2847a2['where'],{'$or':_[_0xe36e('0x33')](_0x2847a2[_0xe36e('0x3c')],function(_0xecf9d8){var _0x49a89c={};_0x49a89c[_0xecf9d8]={'$like':'%'+_0x411305[_0xe36e('0x38')][_0xe36e('0x43')]+'%'};return _0x49a89c;})});}_0x2847a2=_['merge']({},_0x2847a2,_0x411305[_0xe36e('0x46')]);return _0x79882[_0xe36e('0x59')](_0x2847a2);}})[_0xe36e('0x1d')](function(_0x531eac){if(_0x531eac){_0xdc59c5=_0x531eac['length'];if(!_0x411305[_0xe36e('0x38')][_0xe36e('0x3e')](_0xe36e('0x3f'))){_0x2847a2[_0xe36e('0x2b')]=qs[_0xe36e('0x2b')](_0x411305['query'][_0xe36e('0x2b')]);_0x2847a2[_0xe36e('0x40')]=qs[_0xe36e('0x40')](_0x411305[_0xe36e('0x38')]['offset']);}return _0x79882[_0xe36e('0x59')](_0x2847a2);}})[_0xe36e('0x1d')](function(_0x4b1024){if(_0x4b1024){return _0x4b1024?{'count':_0xdc59c5,'rows':_0x4b1024}:null;}})['then'](respondWithResult(_0x51bc99,null))['catch'](handleError(_0x51bc99,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 8d57549..b76dd0e 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 _0xca03=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x5ed354,_0x3e2edc){var _0x5d3688=function(_0x4abc56){while(--_0x4abc56){_0x5ed354['push'](_0x5ed354['shift']());}};_0x5d3688(++_0x3e2edc);}(_0xca03,0x1f2));var _0x3ca0=function(_0x32dff2,_0x9320b3){_0x32dff2=_0x32dff2-0x0;var _0x12108e=_0xca03[_0x32dff2];return _0x12108e;};'use strict';var _=require(_0x3ca0('0x0'));var util=require(_0x3ca0('0x1'));var logger=require(_0x3ca0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3ca0('0x3'));var rp=require(_0x3ca0('0x4'));var fs=require('fs');var path=require(_0x3ca0('0x5'));var rimraf=require(_0x3ca0('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ca0('0x7'));module[_0x3ca0('0x8')]=function(_0xe959b9,_0x3a1f79){return _0xe959b9[_0x3ca0('0x9')](_0x3ca0('0xa'),attributes,{'tableName':_0x3ca0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x637e=['bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment'];(function(_0x8ae49d,_0x4a02c7){var _0x423bb4=function(_0x4df2dc){while(--_0x4df2dc){_0x8ae49d['push'](_0x8ae49d['shift']());}};_0x423bb4(++_0x4a02c7);}(_0x637e,0x158));var _0xe637=function(_0x4a4193,_0x4e3497){_0x4a4193=_0x4a4193-0x0;var _0x1e46a2=_0x637e[_0x4a4193];return _0x1e46a2;};'use strict';var _=require('lodash');var util=require(_0xe637('0x0'));var logger=require(_0xe637('0x1'))(_0xe637('0x2'));var moment=require(_0xe637('0x3'));var BPromise=require(_0xe637('0x4'));var rp=require(_0xe637('0x5'));var fs=require('fs');var path=require(_0xe637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe637('0x7'));module[_0xe637('0x8')]=function(_0x92309e,_0x331ff1){return _0x92309e[_0xe637('0x9')](_0xe637('0xa'),attributes,{'tableName':_0xe637('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 b73f0db..1621766 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 _0xcc0c=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2b13f6,_0x25e44c){var _0x14ea98=function(_0x55ac59){while(--_0x55ac59){_0x2b13f6['push'](_0x2b13f6['shift']());}};_0x14ea98(++_0x25e44c);}(_0xcc0c,0x88));var _0xccc0=function(_0x100827,_0x49215d){_0x100827=_0x100827-0x0;var _0x1e6245=_0xcc0c[_0x100827];return _0x1e6245;};'use strict';var _=require(_0xccc0('0x0'));var util=require(_0xccc0('0x1'));var moment=require(_0xccc0('0x2'));var BPromise=require('bluebird');var rs=require(_0xccc0('0x3'));var fs=require('fs');var Redis=require(_0xccc0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xccc0('0x5'));var logger=require(_0xccc0('0x6'))(_0xccc0('0x7'));var config=require(_0xccc0('0x8'));var jayson=require(_0xccc0('0x9'));var client=jayson[_0xccc0('0xa')][_0xccc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af557,_0x2128e2,_0x4d540c){return new BPromise(function(_0x468513,_0x64ecf7){return client['request'](_0x3af557,_0x4d540c)['then'](function(_0x138153){logger[_0xccc0('0xc')](_0xccc0('0xd'),_0x2128e2,_0xccc0('0xe'));logger[_0xccc0('0xf')](_0xccc0('0x10'),_0x2128e2,_0xccc0('0xe'),JSON[_0xccc0('0x11')](_0x138153));if(_0x138153[_0xccc0('0x12')]){if(_0x138153[_0xccc0('0x12')][_0xccc0('0x13')]===0x1f4){logger[_0xccc0('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2128e2,_0x138153['error'][_0xccc0('0x14')]);return _0x64ecf7(_0x138153[_0xccc0('0x12')][_0xccc0('0x14')]);}logger[_0xccc0('0x12')](_0xccc0('0xd'),_0x2128e2,_0x138153[_0xccc0('0x12')][_0xccc0('0x14')]);return _0x468513(_0x138153[_0xccc0('0x12')]['message']);}else{logger[_0xccc0('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2128e2,'request\x20sent');_0x468513(_0x138153[_0xccc0('0x15')][_0xccc0('0x14')]);}})[_0xccc0('0x16')](function(_0x1c2b4e){logger[_0xccc0('0x12')](_0xccc0('0xd'),_0x2128e2,_0x1c2b4e);_0x64ecf7(_0x1c2b4e);});});} \ No newline at end of file +var _0xdcae=['rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56d443,_0x391396){var _0x317405=function(_0x5970e6){while(--_0x5970e6){_0x56d443['push'](_0x56d443['shift']());}};_0x317405(++_0x391396);}(_0xdcae,0x10c));var _0xedca=function(_0x5f52e4,_0x5a69b3){_0x5f52e4=_0x5f52e4-0x0;var _0x25148b=_0xdcae[_0x5f52e4];return _0x25148b;};'use strict';var _=require('lodash');var util=require(_0xedca('0x0'));var moment=require(_0xedca('0x1'));var BPromise=require(_0xedca('0x2'));var rs=require(_0xedca('0x3'));var fs=require('fs');var Redis=require(_0xedca('0x4'));var db=require(_0xedca('0x5'))['db'];var utils=require(_0xedca('0x6'));var logger=require(_0xedca('0x7'))(_0xedca('0x8'));var config=require(_0xedca('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xedca('0xa')][_0xedca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb26c9d,_0x4e0853,_0x506726){return new BPromise(function(_0x3682fc,_0x131018){return client[_0xedca('0xc')](_0xb26c9d,_0x506726)[_0xedca('0xd')](function(_0x1141e2){logger[_0xedca('0xe')](_0xedca('0xf'),_0x4e0853,_0xedca('0x10'));logger[_0xedca('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4e0853,'request\x20sent',JSON[_0xedca('0x12')](_0x1141e2));if(_0x1141e2[_0xedca('0x13')]){if(_0x1141e2[_0xedca('0x13')][_0xedca('0x14')]===0x1f4){logger['error'](_0xedca('0xf'),_0x4e0853,_0x1141e2[_0xedca('0x13')][_0xedca('0x15')]);return _0x131018(_0x1141e2[_0xedca('0x13')]['message']);}logger['error'](_0xedca('0xf'),_0x4e0853,_0x1141e2[_0xedca('0x13')]['message']);return _0x3682fc(_0x1141e2[_0xedca('0x13')]['message']);}else{logger[_0xedca('0xe')](_0xedca('0xf'),_0x4e0853,_0xedca('0x10'));_0x3682fc(_0x1141e2[_0xedca('0x16')][_0xedca('0x15')]);}})['catch'](function(_0x5c2b0d){logger[_0xedca('0x13')](_0xedca('0xf'),_0x4e0853,_0x5c2b0d);_0x131018(_0x5c2b0d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index da2000b..ad4f5bf 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 _0xa770=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x293a23,_0xab710f){var _0x4b1ba8=function(_0x53bf50){while(--_0x53bf50){_0x293a23['push'](_0x293a23['shift']());}};_0x4b1ba8(++_0xab710f);}(_0xa770,0x10d));var _0x0a77=function(_0x2c6504,_0x3ade63){_0x2c6504=_0x2c6504-0x0;var _0x18d226=_0xa770[_0x2c6504];return _0x18d226;};'use strict';var multer=require(_0x0a77('0x0'));var util=require(_0x0a77('0x1'));var path=require(_0x0a77('0x2'));var timeout=require(_0x0a77('0x3'));var express=require('express');var router=express[_0x0a77('0x4')]();var auth=require(_0x0a77('0x5'));var interaction=require(_0x0a77('0x6'));var config=require(_0x0a77('0x7'));var controller=require(_0x0a77('0x8'));router[_0x0a77('0x9')]('/',auth[_0x0a77('0xa')](),controller[_0x0a77('0xb')]);router['get'](_0x0a77('0xc'),auth[_0x0a77('0xa')](),controller[_0x0a77('0xd')]);router[_0x0a77('0xe')]('/',auth[_0x0a77('0xa')](),controller[_0x0a77('0xf')]);router[_0x0a77('0x10')](_0x0a77('0xc'),auth[_0x0a77('0xa')](),controller[_0x0a77('0x11')]);router[_0x0a77('0x12')](_0x0a77('0xc'),auth[_0x0a77('0xa')](),controller['destroy']);module[_0x0a77('0x13')]=router; \ No newline at end of file +var _0x1ba9=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2cfce4,_0x19e9b3){var _0x32c9ce=function(_0x485f15){while(--_0x485f15){_0x2cfce4['push'](_0x2cfce4['shift']());}};_0x32c9ce(++_0x19e9b3);}(_0x1ba9,0xf5));var _0x91ba=function(_0x24dcd4,_0xf849b7){_0x24dcd4=_0x24dcd4-0x0;var _0x54ec84=_0x1ba9[_0x24dcd4];return _0x54ec84;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x91ba('0x0'));var timeout=require(_0x91ba('0x1'));var express=require(_0x91ba('0x2'));var router=express[_0x91ba('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x91ba('0x4'));var config=require(_0x91ba('0x5'));var controller=require('./intServicenowField.controller');router[_0x91ba('0x6')]('/',auth[_0x91ba('0x7')](),controller[_0x91ba('0x8')]);router['get'](_0x91ba('0x9'),auth[_0x91ba('0x7')](),controller['show']);router[_0x91ba('0xa')]('/',auth[_0x91ba('0x7')](),controller[_0x91ba('0xb')]);router[_0x91ba('0xc')]('/:id',auth[_0x91ba('0x7')](),controller[_0x91ba('0xd')]);router[_0x91ba('0xe')](_0x91ba('0x9'),auth[_0x91ba('0x7')](),controller[_0x91ba('0xf')]);module[_0x91ba('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index aae66b9..c7963d3 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 _0x1105=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x46a214,_0x1da7ec){var _0x9f6d43=function(_0x58ab16){while(--_0x58ab16){_0x46a214['push'](_0x46a214['shift']());}};_0x9f6d43(++_0x1da7ec);}(_0x1105,0x124));var _0x5110=function(_0x536a51,_0x2bf510){_0x536a51=_0x536a51-0x0;var _0x4a4d9e=_0x1105[_0x536a51];return _0x4a4d9e;};'use strict';var Sequelize=require(_0x5110('0x0'));module['exports']={'type':{'type':Sequelize[_0x5110('0x1')](_0x5110('0x2'),_0x5110('0x3'),_0x5110('0x4'),_0x5110('0x5')),'defaultValue':_0x5110('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5110('0x6')]},'keyType':{'type':Sequelize[_0x5110('0x1')](_0x5110('0x2'),_0x5110('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x5110('0x6')]},'idField':{'type':Sequelize[_0x5110('0x6')]},'nameField':{'type':Sequelize[_0x5110('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87c6=['ENUM','BOOLEAN','sequelize','variable','customVariable','string','STRING'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x87c6,0x87));var _0x687c=function(_0x5d0429,_0x4b4b7b){_0x5d0429=_0x5d0429-0x0;var _0x26065e=_0x87c6[_0x5d0429];return _0x26065e;};'use strict';var Sequelize=require(_0x687c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x687c('0x1'),_0x687c('0x2'),'keyValue'),'defaultValue':_0x687c('0x3')},'content':{'type':Sequelize[_0x687c('0x4')]},'key':{'type':Sequelize[_0x687c('0x4')]},'keyType':{'type':Sequelize[_0x687c('0x5')](_0x687c('0x3'),'variable',_0x687c('0x2'))},'keyContent':{'type':Sequelize[_0x687c('0x4')]},'idField':{'type':Sequelize[_0x687c('0x4')]},'nameField':{'type':Sequelize[_0x687c('0x4')]},'customField':{'type':Sequelize[_0x687c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x687c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 8caf362..28deb4e 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(_0x549aea,_0x1875f4){var _0x325453=function(_0x132fd4){while(--_0x132fd4){_0x549aea['push'](_0x549aea['shift']());}};_0x325453(++_0x1875f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +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(_0x430255,_0x49dbad){var _0x1aafe9=function(_0x4a20b1){while(--_0x4a20b1){_0x430255['push'](_0x430255['shift']());}};_0x1aafe9(++_0x49dbad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 22e2b64..af6a1e5 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 _0x62a1=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x62a1,0x1b4));var _0x162a=function(_0x4868d8,_0x261b95){_0x4868d8=_0x4868d8-0x0;var _0x22efc3=_0x62a1[_0x4868d8];return _0x22efc3;};'use strict';var _=require(_0x162a('0x0'));var util=require(_0x162a('0x1'));var logger=require('../../config/logger')(_0x162a('0x2'));var moment=require(_0x162a('0x3'));var BPromise=require(_0x162a('0x4'));var rp=require(_0x162a('0x5'));var fs=require('fs');var path=require(_0x162a('0x6'));var rimraf=require(_0x162a('0x7'));var config=require(_0x162a('0x8'));var attributes=require(_0x162a('0x9'));module[_0x162a('0xa')]=function(_0x20f5d1,_0xc1e62){return _0x20f5d1[_0x162a('0xb')]('ServicenowField',attributes,{'tableName':_0x162a('0xc'),'paranoid':![],'indexes':[{'name':_0x162a('0xd'),'fields':[_0x162a('0xe'),_0x162a('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d7c=['FieldId','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','define','servicenow_unique_index','idField'];(function(_0x2efe4f,_0x35b3d9){var _0x251e7e=function(_0x56be52){while(--_0x56be52){_0x2efe4f['push'](_0x2efe4f['shift']());}};_0x251e7e(++_0x35b3d9);}(_0x5d7c,0xb5));var _0xc5d7=function(_0x6dc163,_0x4c8603){_0x6dc163=_0x6dc163-0x0;var _0x7c1385=_0x5d7c[_0x6dc163];return _0x7c1385;};'use strict';var _=require(_0xc5d7('0x0'));var util=require(_0xc5d7('0x1'));var logger=require(_0xc5d7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc5d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5d7('0x4'));var rimraf=require(_0xc5d7('0x5'));var config=require(_0xc5d7('0x6'));var attributes=require(_0xc5d7('0x7'));module['exports']=function(_0x49ee20,_0x5db116){return _0x49ee20[_0xc5d7('0x8')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc5d7('0x9'),'fields':[_0xc5d7('0xa'),_0xc5d7('0xb')],'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 2e7d889..be779ff 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 _0x63ed=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3e5021,_0x540817){var _0x3db478=function(_0x15b94a){while(--_0x15b94a){_0x3e5021['push'](_0x3e5021['shift']());}};_0x3db478(++_0x540817);}(_0x63ed,0xff));var _0xd63e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x63ed[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xd63e('0x0'));var util=require(_0xd63e('0x1'));var moment=require(_0xd63e('0x2'));var BPromise=require(_0xd63e('0x3'));var rs=require(_0xd63e('0x4'));var fs=require('fs');var Redis=require(_0xd63e('0x5'));var db=require(_0xd63e('0x6'))['db'];var utils=require(_0xd63e('0x7'));var logger=require(_0xd63e('0x8'))(_0xd63e('0x9'));var config=require('../../config/environment');var jayson=require(_0xd63e('0xa'));var client=jayson[_0xd63e('0xb')][_0xd63e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54330c,_0x31cf56,_0x198322){return new BPromise(function(_0x24c099,_0x44e8b0){return client[_0xd63e('0xd')](_0x54330c,_0x198322)[_0xd63e('0xe')](function(_0x18da68){logger[_0xd63e('0xf')](_0xd63e('0x10'),_0x31cf56,'request\x20sent');logger[_0xd63e('0x11')](_0xd63e('0x12'),_0x31cf56,_0xd63e('0x13'),JSON[_0xd63e('0x14')](_0x18da68));if(_0x18da68[_0xd63e('0x15')]){if(_0x18da68[_0xd63e('0x15')]['code']===0x1f4){logger[_0xd63e('0x15')]('ServicenowField,\x20%s,\x20%s',_0x31cf56,_0x18da68[_0xd63e('0x15')][_0xd63e('0x16')]);return _0x44e8b0(_0x18da68[_0xd63e('0x15')]['message']);}logger[_0xd63e('0x15')](_0xd63e('0x10'),_0x31cf56,_0x18da68['error'][_0xd63e('0x16')]);return _0x24c099(_0x18da68[_0xd63e('0x15')]['message']);}else{logger[_0xd63e('0xf')](_0xd63e('0x10'),_0x31cf56,_0xd63e('0x13'));_0x24c099(_0x18da68[_0xd63e('0x17')][_0xd63e('0x16')]);}})[_0xd63e('0x18')](function(_0x4e31ae){logger[_0xd63e('0x15')](_0xd63e('0x10'),_0x31cf56,_0x4e31ae);_0x44e8b0(_0x4e31ae);});});} \ No newline at end of file +var _0x4291=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x12b298,_0x36e4c3){var _0x3ad431=function(_0x2c063e){while(--_0x2c063e){_0x12b298['push'](_0x12b298['shift']());}};_0x3ad431(++_0x36e4c3);}(_0x4291,0x164));var _0x1429=function(_0x25530e,_0x2e7c06){_0x25530e=_0x25530e-0x0;var _0x5a4c04=_0x4291[_0x25530e];return _0x5a4c04;};'use strict';var _=require(_0x1429('0x0'));var util=require(_0x1429('0x1'));var moment=require(_0x1429('0x2'));var BPromise=require(_0x1429('0x3'));var rs=require(_0x1429('0x4'));var fs=require('fs');var Redis=require(_0x1429('0x5'));var db=require(_0x1429('0x6'))['db'];var utils=require(_0x1429('0x7'));var logger=require(_0x1429('0x8'))('rpc');var config=require(_0x1429('0x9'));var jayson=require(_0x1429('0xa'));var client=jayson[_0x1429('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fb581,_0x3a6203,_0xc46961){return new BPromise(function(_0x59e3d9,_0x250b47){return client[_0x1429('0xc')](_0x3fb581,_0xc46961)[_0x1429('0xd')](function(_0x8cf4b8){logger[_0x1429('0xe')](_0x1429('0xf'),_0x3a6203,_0x1429('0x10'));logger['debug'](_0x1429('0x11'),_0x3a6203,_0x1429('0x10'),JSON[_0x1429('0x12')](_0x8cf4b8));if(_0x8cf4b8[_0x1429('0x13')]){if(_0x8cf4b8[_0x1429('0x13')][_0x1429('0x14')]===0x1f4){logger['error'](_0x1429('0xf'),_0x3a6203,_0x8cf4b8['error']['message']);return _0x250b47(_0x8cf4b8[_0x1429('0x13')][_0x1429('0x15')]);}logger[_0x1429('0x13')](_0x1429('0xf'),_0x3a6203,_0x8cf4b8[_0x1429('0x13')][_0x1429('0x15')]);return _0x59e3d9(_0x8cf4b8[_0x1429('0x13')][_0x1429('0x15')]);}else{logger['info'](_0x1429('0xf'),_0x3a6203,'request\x20sent');_0x59e3d9(_0x8cf4b8[_0x1429('0x16')]['message']);}})[_0x1429('0x17')](function(_0x50c3d9){logger[_0x1429('0x13')](_0x1429('0xf'),_0x3a6203,_0x50c3d9);_0x250b47(_0x50c3d9);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9df841f..526b260 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 _0x8a76=['/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8a76,0x1ec));var _0x68a7=function(_0x50b382,_0x19ed75){_0x50b382=_0x50b382-0x0;var _0xf55325=_0x8a76[_0x50b382];return _0xf55325;};'use strict';var multer=require(_0x68a7('0x0'));var util=require(_0x68a7('0x1'));var path=require(_0x68a7('0x2'));var timeout=require(_0x68a7('0x3'));var express=require('express');var router=express[_0x68a7('0x4')]();var auth=require(_0x68a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x68a7('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x68a7('0x7')]('/',auth['isAuthenticated'](),controller[_0x68a7('0x8')]);router[_0x68a7('0x7')](_0x68a7('0x9'),auth[_0x68a7('0xa')](),controller[_0x68a7('0xb')]);router[_0x68a7('0x7')](_0x68a7('0xc'),auth['isAuthenticated'](),controller[_0x68a7('0xd')]);router[_0x68a7('0x7')](_0x68a7('0xe'),auth[_0x68a7('0xa')](),controller[_0x68a7('0xf')]);router['post']('/',auth[_0x68a7('0xa')](),controller[_0x68a7('0x10')]);router[_0x68a7('0x11')](_0x68a7('0xc'),auth['isAuthenticated'](),controller[_0x68a7('0x12')]);router[_0x68a7('0x13')](_0x68a7('0x9'),auth[_0x68a7('0xa')](),controller[_0x68a7('0x14')]);router[_0x68a7('0x15')](_0x68a7('0x9'),auth['isAuthenticated'](),controller[_0x68a7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3a57=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','getConfigurations'];(function(_0x47baa4,_0x522480){var _0x484801=function(_0x4a1c32){while(--_0x4a1c32){_0x47baa4['push'](_0x47baa4['shift']());}};_0x484801(++_0x522480);}(_0x3a57,0x14d));var _0x73a5=function(_0x45eba6,_0x2409d7){_0x45eba6=_0x45eba6-0x0;var _0x15cb73=_0x3a57[_0x45eba6];return _0x15cb73;};'use strict';var multer=require(_0x73a5('0x0'));var util=require(_0x73a5('0x1'));var path=require(_0x73a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x73a5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x73a5('0x4'));var config=require(_0x73a5('0x5'));var controller=require(_0x73a5('0x6'));router[_0x73a5('0x7')]('/',auth[_0x73a5('0x8')](),controller[_0x73a5('0x9')]);router[_0x73a5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x73a5('0xa')]);router['get']('/:id/configurations',auth[_0x73a5('0x8')](),controller[_0x73a5('0xb')]);router['get'](_0x73a5('0xc'),auth['isAuthenticated'](),controller[_0x73a5('0xd')]);router[_0x73a5('0xe')]('/',auth[_0x73a5('0x8')](),controller[_0x73a5('0xf')]);router[_0x73a5('0xe')](_0x73a5('0x10'),auth['isAuthenticated'](),controller[_0x73a5('0x11')]);router['put'](_0x73a5('0x12'),auth[_0x73a5('0x8')](),controller[_0x73a5('0x13')]);router[_0x73a5('0x14')](_0x73a5('0x12'),auth[_0x73a5('0x8')](),controller[_0x73a5('0x15')]);module[_0x73a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 19fcbcc..7a231be 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 _0x714a=['exports','STRING','username'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x714a,0xd8));var _0xa714=function(_0x33ca42,_0x581d78){_0x33ca42=_0x33ca42-0x0;var _0x134268=_0x714a[_0x33ca42];return _0x134268;};'use strict';var Sequelize=require('sequelize');module[_0xa714('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa714('0x1')]},'username':{'type':Sequelize[_0xa714('0x1')],'unique':_0xa714('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa714('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa714('0x1')]}}; \ No newline at end of file +var _0x75ba=['username','remoteUri','sequelize','STRING'];(function(_0x4ab585,_0x299f86){var _0x2fa953=function(_0x30bace){while(--_0x30bace){_0x4ab585['push'](_0x4ab585['shift']());}};_0x2fa953(++_0x299f86);}(_0x75ba,0x1c2));var _0xa75b=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x75ba[_0x149083];return _0x4dc74e;};'use strict';var Sequelize=require(_0xa75b('0x0'));module['exports']={'name':{'type':Sequelize[_0xa75b('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa75b('0x1')],'unique':_0xa75b('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa75b('0x1')],'unique':_0xa75b('0x3')},'serverUrl':{'type':Sequelize[_0xa75b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index e58149a..f1f59ba 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 _0xacb1=['Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','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','message','result','catch','sendStatus','status','end','json','offset','limit','set','reject','save','update','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','SugarcrmAccount','count','includeAll','include','show','params','keys','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration'];(function(_0x225466,_0x879a37){var _0x496110=function(_0x5cf1e1){while(--_0x5cf1e1){_0x225466['push'](_0x225466['shift']());}};_0x496110(++_0x879a37);}(_0xacb1,0x8c));var _0x1acb=function(_0x57a7dc,_0x1802ac){_0x57a7dc=_0x57a7dc-0x0;var _0x55772d=_0xacb1[_0x57a7dc];return _0x55772d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1acb('0x0'));var rimraf=require(_0x1acb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1acb('0x2'));var moment=require(_0x1acb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1acb('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1acb('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1acb('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x1acb('0x7'));var toCsv=require(_0x1acb('0x8'));var querystring=require(_0x1acb('0x9'));var Papa=require(_0x1acb('0xa'));var Redis=require(_0x1acb('0xb'));var authService=require(_0x1acb('0xc'));var qs=require(_0x1acb('0xd'));var as=require(_0x1acb('0xe'));var hardwareService=require(_0x1acb('0xf'));var logger=require(_0x1acb('0x10'))(_0x1acb('0x11'));var utils=require(_0x1acb('0x12'));var config=require('../../config/environment');var db=require(_0x1acb('0x13'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x1acb('0x14')][_0x1acb('0x15')]({'port':0x232a});function checkPasswordPattern(_0x18994f,_0xd58115,_0x364740){if(_0x364740){var _0x85be15=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x85be15[_0x1acb('0x16')](_0xd58115)){return _0x18994f;}else{throw new db[(_0x1acb('0x17'))][(_0x1acb('0x18'))](_0x1acb('0x19'));}}else{return _0x18994f;}}function respondWithRpcPromise(_0xc8b793,_0x114e5e,_0x131c0f,_0x1402a1){return new BPromise(function(_0x1addae,_0x1c59d0){var _0x448176=_0x1402a1||client;return _0x448176[_0x1acb('0x1a')](_0xc8b793,_0x131c0f)[_0x1acb('0x1b')](function(_0x2653fa){logger[_0x1acb('0x1c')](_0x1acb('0x1d'),_0x114e5e,_0x1acb('0x1e'));logger[_0x1acb('0x1f')](_0x1acb('0x20'),_0x114e5e,_0x1acb('0x1e'),JSON[_0x1acb('0x21')](_0x2653fa));if(_0x2653fa[_0x1acb('0x22')]){if(_0x2653fa[_0x1acb('0x22')]['code']===0x1f4){logger[_0x1acb('0x22')](_0x1acb('0x1d'),_0x114e5e,_0x2653fa['error'][_0x1acb('0x23')]);return _0x1c59d0(_0x2653fa[_0x1acb('0x22')][_0x1acb('0x23')]);}logger[_0x1acb('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x114e5e,_0x2653fa[_0x1acb('0x22')]['message']);return _0x1addae(_0x2653fa[_0x1acb('0x22')]['message']);}else{logger['info'](_0x1acb('0x1d'),_0x114e5e,_0x1acb('0x1e'));_0x1addae(_0x2653fa[_0x1acb('0x24')]['message']);}})[_0x1acb('0x25')](function(_0x32cb07){logger[_0x1acb('0x22')](_0x1acb('0x1d'),_0x114e5e,_0x32cb07);_0x1c59d0(_0x32cb07);});});}function respondWithStatusCode(_0x26a728,_0xd09a0b){_0xd09a0b=_0xd09a0b||0xcc;return function(_0x4caa94){if(_0x4caa94){return _0x26a728[_0x1acb('0x26')](_0xd09a0b);}return _0x26a728[_0x1acb('0x27')](_0xd09a0b)[_0x1acb('0x28')]();};}function respondWithResult(_0xb47887,_0x5c85a1){_0x5c85a1=_0x5c85a1||0xc8;return function(_0x1b84bd){if(_0x1b84bd){return _0xb47887['status'](_0x5c85a1)[_0x1acb('0x29')](_0x1b84bd);}};}function respondWithFilteredResult(_0x2006e3,_0x313077){return function(_0x406b09){if(_0x406b09){var _0x524687=_0x406b09['count'],_0x2aea76=_0x313077[_0x1acb('0x2a')],_0x298335=_0x313077[_0x1acb('0x2a')]+_0x313077[_0x1acb('0x2b')],_0x2ded33;if(_0x298335>=_0x524687){_0x298335=_0x524687;_0x2ded33=0xc8;}else{_0x2ded33=0xce;}_0x2006e3[_0x1acb('0x27')](_0x2ded33);return _0x2006e3[_0x1acb('0x2c')]('Content-Range',_0x2aea76+'-'+_0x298335+'/'+_0x524687)[_0x1acb('0x29')](_0x406b09);}return null;};}function patchUpdates(_0x5d72ea){return function(_0x59e609){try{jsonpatch['apply'](_0x59e609,_0x5d72ea,!![]);}catch(_0x27ed56){return BPromise[_0x1acb('0x2d')](_0x27ed56);}return _0x59e609[_0x1acb('0x2e')]();};}function saveUpdates(_0x51210e,_0x1cbf04){return function(_0x452108){if(_0x452108){return _0x452108[_0x1acb('0x2f')](_0x51210e)['then'](function(_0x4c41e8){return _0x4c41e8;});}return null;};}function removeEntity(_0x492209,_0x4b55e2){return function(_0x33c5e5){if(_0x33c5e5){return _0x33c5e5['destroy']()[_0x1acb('0x1b')](function(){_0x492209['status'](0xcc)[_0x1acb('0x28')]();});}};}function handleEntityNotFound(_0x362189,_0x299379){return function(_0x45d24e){if(!_0x45d24e){_0x362189[_0x1acb('0x26')](0x194);}return _0x45d24e;};}function handleError(_0x3d67cb,_0xd459d8){_0xd459d8=_0xd459d8||0x1f4;return function(_0x388f54){logger[_0x1acb('0x22')](_0x388f54['stack']);if(_0x388f54[_0x1acb('0x30')]){delete _0x388f54[_0x1acb('0x30')];}_0x3d67cb['status'](_0xd459d8)[_0x1acb('0x31')](_0x388f54);};}exports[_0x1acb('0x32')]=function(_0x74d6f5,_0x278b6e){var _0x16f62b={},_0x5f43d5={},_0x55d86d={'count':0x0,'rows':[]};var _0x18901e=_['map'](db['SugarcrmAccount'][_0x1acb('0x33')],function(_0x39512f){return{'name':_0x39512f[_0x1acb('0x34')],'type':_0x39512f['type'][_0x1acb('0x35')]};});_0x5f43d5['model']=_[_0x1acb('0x36')](_0x18901e,_0x1acb('0x30'));_0x5f43d5[_0x1acb('0x37')]=_['keys'](_0x74d6f5[_0x1acb('0x37')]);_0x5f43d5[_0x1acb('0x38')]=_[_0x1acb('0x39')](_0x5f43d5['model'],_0x5f43d5[_0x1acb('0x37')]);_0x16f62b[_0x1acb('0x3a')]=_[_0x1acb('0x39')](_0x5f43d5['model'],qs[_0x1acb('0x3b')](_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x3b')]));_0x16f62b[_0x1acb('0x3a')]=_0x16f62b[_0x1acb('0x3a')][_0x1acb('0x3c')]?_0x16f62b[_0x1acb('0x3a')]:_0x5f43d5[_0x1acb('0x3d')];if(!_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x3e')](_0x1acb('0x3f'))){_0x16f62b[_0x1acb('0x2b')]=qs[_0x1acb('0x2b')](_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x2b')]);_0x16f62b[_0x1acb('0x2a')]=qs[_0x1acb('0x2a')](_0x74d6f5['query']['offset']);}_0x16f62b[_0x1acb('0x40')]=qs[_0x1acb('0x41')](_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x41')]);_0x16f62b[_0x1acb('0x42')]=qs[_0x1acb('0x38')](_[_0x1acb('0x43')](_0x74d6f5['query'],_0x5f43d5[_0x1acb('0x38')]),_0x18901e);if(_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x44')]){_0x16f62b[_0x1acb('0x42')]=_[_0x1acb('0x45')](_0x16f62b['where'],{'$or':_[_0x1acb('0x36')](_0x18901e,function(_0x151ceb){if(_0x151ceb[_0x1acb('0x46')]!=='VIRTUAL'){var _0x2049de={};_0x2049de[_0x151ceb[_0x1acb('0x30')]]={'$like':'%'+_0x74d6f5['query'][_0x1acb('0x44')]+'%'};return _0x2049de;}})});}_0x16f62b=_[_0x1acb('0x45')]({},_0x16f62b,_0x74d6f5[_0x1acb('0x47')]);var _0x285d3d={'where':_0x16f62b[_0x1acb('0x42')]};return db[_0x1acb('0x48')][_0x1acb('0x49')](_0x285d3d)['then'](function(_0x29a719){_0x55d86d[_0x1acb('0x49')]=_0x29a719;if(_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x4a')]){_0x16f62b[_0x1acb('0x4b')]=[{'all':!![]}];}return db[_0x1acb('0x48')]['findAll'](_0x16f62b);})['then'](function(_0x450fbd){_0x55d86d['rows']=_0x450fbd;return _0x55d86d;})['then'](respondWithFilteredResult(_0x278b6e,_0x16f62b))[_0x1acb('0x25')](handleError(_0x278b6e,null));};exports[_0x1acb('0x4c')]=function(_0x3927d4,_0x39424a){var _0x4ef92e={'raw':![],'where':{'id':_0x3927d4[_0x1acb('0x4d')]['id']}},_0x998ad5={};_0x998ad5[_0x1acb('0x3d')]=_['keys'](db[_0x1acb('0x48')][_0x1acb('0x33')]);_0x998ad5['query']=_[_0x1acb('0x4e')](_0x3927d4[_0x1acb('0x37')]);_0x998ad5[_0x1acb('0x38')]=_[_0x1acb('0x39')](_0x998ad5[_0x1acb('0x3d')],_0x998ad5[_0x1acb('0x37')]);_0x4ef92e[_0x1acb('0x3a')]=_[_0x1acb('0x39')](_0x998ad5['model'],qs[_0x1acb('0x3b')](_0x3927d4[_0x1acb('0x37')][_0x1acb('0x3b')]));_0x4ef92e[_0x1acb('0x3a')]=_0x4ef92e[_0x1acb('0x3a')][_0x1acb('0x3c')]?_0x4ef92e[_0x1acb('0x3a')]:_0x998ad5[_0x1acb('0x3d')];if(_0x3927d4['query']['includeAll']){_0x4ef92e[_0x1acb('0x4b')]=[{'all':!![]}];}_0x4ef92e=_['merge']({},_0x4ef92e,_0x3927d4[_0x1acb('0x47')]);return db[_0x1acb('0x48')][_0x1acb('0x4f')](_0x4ef92e)[_0x1acb('0x1b')](handleEntityNotFound(_0x39424a,null))['then'](respondWithResult(_0x39424a,null))['catch'](handleError(_0x39424a,null));};exports[_0x1acb('0x50')]=function(_0x5351a4,_0x4dd75e){return db['SugarcrmAccount'][_0x1acb('0x50')](_0x5351a4[_0x1acb('0x51')],{})[_0x1acb('0x1b')](respondWithResult(_0x4dd75e,0xc9))[_0x1acb('0x25')](handleError(_0x4dd75e,null));};exports[_0x1acb('0x2f')]=function(_0x3007ae,_0x112d8d){if(_0x3007ae[_0x1acb('0x51')]['id']){delete _0x3007ae[_0x1acb('0x51')]['id'];}return db['SugarcrmAccount'][_0x1acb('0x4f')]({'where':{'id':_0x3007ae[_0x1acb('0x4d')]['id']}})[_0x1acb('0x1b')](handleEntityNotFound(_0x112d8d,null))[_0x1acb('0x1b')](saveUpdates(_0x3007ae[_0x1acb('0x51')],null))[_0x1acb('0x1b')](respondWithResult(_0x112d8d,null))[_0x1acb('0x25')](handleError(_0x112d8d,null));};exports[_0x1acb('0x52')]=function(_0x54b89b,_0x14357c){return db[_0x1acb('0x48')]['find']({'where':{'id':_0x54b89b[_0x1acb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14357c,null))['then'](removeEntity(_0x14357c,null))[_0x1acb('0x25')](handleError(_0x14357c,null));};exports[_0x1acb('0x53')]=function(_0x521152,_0x745c58,_0x598b0c){var _0x1ea310={};var _0x525db4={};var _0x5e04d6;var _0x262f0c;return db['SugarcrmAccount'][_0x1acb('0x54')]({'where':{'id':_0x521152[_0x1acb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x745c58,null))[_0x1acb('0x1b')](function(_0x3641b4){if(_0x3641b4){_0x5e04d6=_0x3641b4;_0x525db4[_0x1acb('0x3d')]=_[_0x1acb('0x4e')](db[_0x1acb('0x55')][_0x1acb('0x33')]);_0x525db4[_0x1acb('0x37')]=_[_0x1acb('0x4e')](_0x521152['query']);_0x525db4[_0x1acb('0x38')]=_[_0x1acb('0x39')](_0x525db4['model'],_0x525db4[_0x1acb('0x37')]);_0x1ea310[_0x1acb('0x3a')]=_[_0x1acb('0x39')](_0x525db4[_0x1acb('0x3d')],qs[_0x1acb('0x3b')](_0x521152['query'][_0x1acb('0x3b')]));_0x1ea310[_0x1acb('0x3a')]=_0x1ea310['attributes'][_0x1acb('0x3c')]?_0x1ea310[_0x1acb('0x3a')]:_0x525db4[_0x1acb('0x3d')];_0x1ea310[_0x1acb('0x40')]=qs[_0x1acb('0x41')](_0x521152[_0x1acb('0x37')]['sort']);_0x1ea310[_0x1acb('0x42')]=qs['filters'](_[_0x1acb('0x43')](_0x521152[_0x1acb('0x37')],_0x525db4[_0x1acb('0x38')]));if(_0x521152[_0x1acb('0x37')][_0x1acb('0x44')]){_0x1ea310[_0x1acb('0x42')]=_[_0x1acb('0x45')](_0x1ea310['where'],{'$or':_[_0x1acb('0x36')](_0x1ea310[_0x1acb('0x3a')],function(_0x183649){var _0xf353d3={};_0xf353d3[_0x183649]={'$like':'%'+_0x521152[_0x1acb('0x37')][_0x1acb('0x44')]+'%'};return _0xf353d3;})});}_0x1ea310=_[_0x1acb('0x45')]({},_0x1ea310,_0x521152[_0x1acb('0x47')]);return _0x5e04d6[_0x1acb('0x53')](_0x1ea310);}})[_0x1acb('0x1b')](function(_0x59c1b2){if(_0x59c1b2){_0x262f0c=_0x59c1b2['length'];if(!_0x521152[_0x1acb('0x37')][_0x1acb('0x3e')](_0x1acb('0x3f'))){_0x1ea310[_0x1acb('0x2b')]=qs['limit'](_0x521152[_0x1acb('0x37')][_0x1acb('0x2b')]);_0x1ea310[_0x1acb('0x2a')]=qs[_0x1acb('0x2a')](_0x521152[_0x1acb('0x37')][_0x1acb('0x2a')]);}return _0x5e04d6[_0x1acb('0x53')](_0x1ea310);}})[_0x1acb('0x1b')](function(_0x58c377){if(_0x58c377){return _0x58c377?{'count':_0x262f0c,'rows':_0x58c377}:null;}})[_0x1acb('0x1b')](respondWithResult(_0x745c58,null))['catch'](handleError(_0x745c58,null));};exports[_0x1acb('0x56')]=function(_0xdecfd7,_0x4021be,_0x2c478b){if(_0xdecfd7['body']['id']){delete _0xdecfd7[_0x1acb('0x51')]['id'];}return db['SugarcrmAccount'][_0x1acb('0x54')]({'where':{'id':_0xdecfd7[_0x1acb('0x4d')]['id']}})[_0x1acb('0x1b')](handleEntityNotFound(_0x4021be,null))[_0x1acb('0x1b')](function(_0x49cfca){if(_0x49cfca){_0xdecfd7[_0x1acb('0x51')]['AccountId']=_0x49cfca['id'];_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x57')]=integrations[_0x1acb('0x58')](_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x59')],_0xdecfd7[_0x1acb('0x51')]['type']);_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x5a')]=integrations['getDescriptions'](_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x59')],_0xdecfd7[_0x1acb('0x51')]['type']);return db[_0x1acb('0x55')]['create'](_0xdecfd7[_0x1acb('0x51')],{'include':[{'model':db[_0x1acb('0x5b')],'as':_0x1acb('0x57')},{'model':db[_0x1acb('0x5b')],'as':_0x1acb('0x5a')}]});}return null;})[_0x1acb('0x1b')](respondWithResult(_0x4021be,null))[_0x1acb('0x25')](handleError(_0x4021be,null));};exports[_0x1acb('0x5c')]=function(_0x362ac2,_0x38dbad,_0x430ed5){var _0x409263='';var _0x2e1ef9=['id','name',_0x1acb('0x5d'),_0x1acb('0x5e'),_0x1acb('0x5f'),_0x1acb('0x60'),_0x1acb('0x61'),_0x1acb('0x62'),_0x1acb('0x63'),_0x1acb('0x64'),'parent_name','direction'];return db[_0x1acb('0x48')][_0x1acb('0x54')]({'where':{'id':_0x362ac2[_0x1acb('0x4d')]['id']},'attributes':['id',_0x1acb('0x65'),_0x1acb('0x66'),_0x1acb('0x67')]})[_0x1acb('0x1b')](handleEntityNotFound(_0x38dbad,null))[_0x1acb('0x1b')](function(_0x4915f7){if(_0x4915f7){_0x409263=_0x4915f7[_0x1acb('0x67')];var _0x4704c1=_0x409263[_0x1acb('0x68')](-0x1);if(_0x4704c1==='/'){_0x409263=_0x409263[_0x1acb('0x69')](0x0,_0x409263[_0x1acb('0x6a')](_0x4704c1));}return rp({'method':_0x1acb('0x6b'),'uri':util[_0x1acb('0x6c')](_0x1acb('0x6d'),_0x409263,_0x1acb('0x6e')),'json':!![],'form':{'method':_0x1acb('0x6f'),'input_type':'JSON','response_type':_0x1acb('0x70'),'rest_data':JSON[_0x1acb('0x21')]({'user_auth':{'user_name':_0x4915f7[_0x1acb('0x65')],'password':_0x4915f7['password'],'encryption':'PLAIN'},'application':_0x1acb('0x71')})}});}})[_0x1acb('0x1b')](function(_0x4a3012){if(_0x4a3012&&_0x4a3012[_0x1acb('0x30')]!==_0x1acb('0x72')&&_0x4a3012[_0x1acb('0x30')]!==_0x1acb('0x73')){return rp({'method':_0x1acb('0x6b'),'uri':util[_0x1acb('0x6c')](_0x1acb('0x6d'),_0x409263,_0x1acb('0x6e')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x1acb('0x70'),'rest_data':JSON[_0x1acb('0x21')]({'session':_0x4a3012['id'],'module_name':_0x1acb('0x74')})}})['then'](function(_0xa787){if(_0xa787){var _0x325679=_[_0x1acb('0x75')](_0xa787[_0x1acb('0x76')]);_[_0x1acb('0x77')](_0x325679,function(_0x1e191d){return _0x2e1ef9[_0x1acb('0x78')](_0x1e191d[_0x1acb('0x30')]);});return{'count':_0x325679[_0x1acb('0x3c')],'rows':_[_0x1acb('0x36')](_0x325679,function(_0x20daf0){return{'id':_0x20daf0[_0x1acb('0x30')],'name':_0x20daf0[_0x1acb('0x79')],'custom':_[_0x1acb('0x7a')](_0x20daf0[_0x1acb('0x30')],'_c')?!![]:![],'options':_0x20daf0[_0x1acb('0x47')]?_[_0x1acb('0x36')](_[_0x1acb('0x75')](_0x20daf0['options']),function(_0x1051cb){return{'name':_0x1051cb[_0x1acb('0x7b')],'value':_0x1051cb[_0x1acb('0x30')]};}):[]};})};}})[_0x1acb('0x1b')](respondWithResult(_0x38dbad,null))[_0x1acb('0x25')](function(_0x2dc19e){var _0x1e3e92=_0x362ac2[_0x1acb('0x37')][_0x1acb('0x16')]?0x1f4:_0x2dc19e[_0x1acb('0x7c')]||0x1f4;logger[_0x1acb('0x22')](_0x1acb('0x7d'),_0x1acb('0x5c'),_0x1e3e92,JSON[_0x1acb('0x21')](_0x2dc19e));delete _0x2dc19e[_0x1acb('0x30')];if(_0x1e3e92===0x191){_0x1e3e92=0x190;}_0x38dbad[_0x1acb('0x27')](_0x1e3e92)[_0x1acb('0x31')](_0x362ac2[_0x1acb('0x37')][_0x1acb('0x16')]?{'message':_0x1acb('0x7e'),'statusCode':_0x2dc19e[_0x1acb('0x7c')]}:_0x2dc19e);});}else{var _0x5b45bf=0x1f4;_0x38dbad['status'](_0x5b45bf)[_0x1acb('0x31')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xf99e=['duration_hours','parent_id','parent_type','parent_name','password','remoteUri','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','SugarcrmAccount','findAll','rows','catch','params','length','includeAll','options','create','body','find','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start'];(function(_0x3ae425,_0x5538c0){var _0x12eac1=function(_0x3c92e2){while(--_0x3c92e2){_0x3ae425['push'](_0x3ae425['shift']());}};_0x12eac1(++_0x5538c0);}(_0xf99e,0xa4));var _0xef99=function(_0x5a3f92,_0x23e7df){_0x5a3f92=_0x5a3f92-0x0;var _0x467063=_0xf99e[_0x5a3f92];return _0x467063;};'use strict';var pdf=require(_0xef99('0x0'));var emlformat=require(_0xef99('0x1'));var rimraf=require(_0xef99('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef99('0x3'));var rp=require(_0xef99('0x4'));var moment=require(_0xef99('0x5'));var BPromise=require(_0xef99('0x6'));var Mustache=require(_0xef99('0x7'));var util=require(_0xef99('0x8'));var path=require(_0xef99('0x9'));var sox=require(_0xef99('0xa'));var csv=require(_0xef99('0xb'));var ejs=require(_0xef99('0xc'));var fs=require('fs');var _=require(_0xef99('0xd'));var squel=require('squel');var crypto=require(_0xef99('0xe'));var jsforce=require(_0xef99('0xf'));var deskjs=require(_0xef99('0x10'));var toCsv=require(_0xef99('0xb'));var querystring=require(_0xef99('0x11'));var Papa=require('papaparse');var Redis=require(_0xef99('0x12'));var authService=require(_0xef99('0x13'));var qs=require(_0xef99('0x14'));var as=require(_0xef99('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xef99('0x16'));var config=require(_0xef99('0x17'));var db=require(_0xef99('0x18'))['db'];var integrations=require(_0xef99('0x19'));var jayson=require(_0xef99('0x1a'));var client=jayson[_0xef99('0x1b')][_0xef99('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x41cd2,_0x439cf8,_0x254cb9){if(_0x254cb9){var _0xe717d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe717d3[_0xef99('0x1d')](_0x439cf8)){return _0x41cd2;}else{throw new db[(_0xef99('0x1e'))][(_0xef99('0x1f'))](_0xef99('0x20'));}}else{return _0x41cd2;}}function respondWithRpcPromise(_0x32facd,_0x86db0a,_0x20aa18,_0x27528){return new BPromise(function(_0x3f2d55,_0x278cf4){var _0x156d74=_0x27528||client;return _0x156d74[_0xef99('0x21')](_0x32facd,_0x20aa18)[_0xef99('0x22')](function(_0x5fade0){logger[_0xef99('0x23')](_0xef99('0x24'),_0x86db0a,_0xef99('0x25'));logger[_0xef99('0x26')](_0xef99('0x27'),_0x86db0a,_0xef99('0x25'),JSON[_0xef99('0x28')](_0x5fade0));if(_0x5fade0['error']){if(_0x5fade0[_0xef99('0x29')][_0xef99('0x2a')]===0x1f4){logger[_0xef99('0x29')](_0xef99('0x24'),_0x86db0a,_0x5fade0['error'][_0xef99('0x2b')]);return _0x278cf4(_0x5fade0[_0xef99('0x29')][_0xef99('0x2b')]);}logger['error'](_0xef99('0x24'),_0x86db0a,_0x5fade0['error'][_0xef99('0x2b')]);return _0x3f2d55(_0x5fade0['error']['message']);}else{logger[_0xef99('0x23')](_0xef99('0x24'),_0x86db0a,_0xef99('0x25'));_0x3f2d55(_0x5fade0[_0xef99('0x2c')][_0xef99('0x2b')]);}})['catch'](function(_0x36f16a){logger[_0xef99('0x29')](_0xef99('0x24'),_0x86db0a,_0x36f16a);_0x278cf4(_0x36f16a);});});}function respondWithStatusCode(_0x33964d,_0x3b7d68){_0x3b7d68=_0x3b7d68||0xcc;return function(_0x2d8fc1){if(_0x2d8fc1){return _0x33964d[_0xef99('0x2d')](_0x3b7d68);}return _0x33964d[_0xef99('0x2e')](_0x3b7d68)['end']();};}function respondWithResult(_0x507dd8,_0x2a513d){_0x2a513d=_0x2a513d||0xc8;return function(_0x269479){if(_0x269479){return _0x507dd8[_0xef99('0x2e')](_0x2a513d)[_0xef99('0x2f')](_0x269479);}};}function respondWithFilteredResult(_0x344bbd,_0x3496f0){return function(_0xde966a){if(_0xde966a){var _0x352119=_0xde966a[_0xef99('0x30')],_0x1389aa=_0x3496f0['offset'],_0x2e7e80=_0x3496f0[_0xef99('0x31')]+_0x3496f0[_0xef99('0x32')],_0x109ca4;if(_0x2e7e80>=_0x352119){_0x2e7e80=_0x352119;_0x109ca4=0xc8;}else{_0x109ca4=0xce;}_0x344bbd[_0xef99('0x2e')](_0x109ca4);return _0x344bbd[_0xef99('0x33')](_0xef99('0x34'),_0x1389aa+'-'+_0x2e7e80+'/'+_0x352119)[_0xef99('0x2f')](_0xde966a);}return null;};}function patchUpdates(_0xa216e9){return function(_0x4dad07){try{jsonpatch[_0xef99('0x35')](_0x4dad07,_0xa216e9,!![]);}catch(_0x24079d){return BPromise['reject'](_0x24079d);}return _0x4dad07['save']();};}function saveUpdates(_0x12e9ae,_0x59f2f0){return function(_0x58303c){if(_0x58303c){return _0x58303c[_0xef99('0x36')](_0x12e9ae)[_0xef99('0x22')](function(_0x35e8a1){return _0x35e8a1;});}return null;};}function removeEntity(_0x5d2357,_0x5730d2){return function(_0x285245){if(_0x285245){return _0x285245[_0xef99('0x37')]()[_0xef99('0x22')](function(){_0x5d2357['status'](0xcc)[_0xef99('0x38')]();});}};}function handleEntityNotFound(_0x58da3e,_0x2d4695){return function(_0x4b806f){if(!_0x4b806f){_0x58da3e['sendStatus'](0x194);}return _0x4b806f;};}function handleError(_0x3ba0fd,_0x189c2b){_0x189c2b=_0x189c2b||0x1f4;return function(_0x24c5ef){logger[_0xef99('0x29')](_0x24c5ef[_0xef99('0x39')]);if(_0x24c5ef[_0xef99('0x3a')]){delete _0x24c5ef[_0xef99('0x3a')];}_0x3ba0fd[_0xef99('0x2e')](_0x189c2b)[_0xef99('0x3b')](_0x24c5ef);};}exports[_0xef99('0x3c')]=function(_0x41bb69,_0x357ca3){var _0x2e2119={},_0x344ab4={},_0x291553={'count':0x0,'rows':[]};var _0x43b507=_[_0xef99('0x3d')](db['SugarcrmAccount'][_0xef99('0x3e')],function(_0x5b0b8e){return{'name':_0x5b0b8e['fieldName'],'type':_0x5b0b8e[_0xef99('0x3f')][_0xef99('0x40')]};});_0x344ab4[_0xef99('0x41')]=_['map'](_0x43b507,_0xef99('0x3a'));_0x344ab4[_0xef99('0x42')]=_[_0xef99('0x43')](_0x41bb69['query']);_0x344ab4[_0xef99('0x44')]=_[_0xef99('0x45')](_0x344ab4[_0xef99('0x41')],_0x344ab4[_0xef99('0x42')]);_0x2e2119['attributes']=_['intersection'](_0x344ab4['model'],qs[_0xef99('0x46')](_0x41bb69[_0xef99('0x42')][_0xef99('0x46')]));_0x2e2119[_0xef99('0x47')]=_0x2e2119[_0xef99('0x47')]['length']?_0x2e2119[_0xef99('0x47')]:_0x344ab4[_0xef99('0x41')];if(!_0x41bb69[_0xef99('0x42')][_0xef99('0x48')](_0xef99('0x49'))){_0x2e2119[_0xef99('0x32')]=qs[_0xef99('0x32')](_0x41bb69[_0xef99('0x42')][_0xef99('0x32')]);_0x2e2119[_0xef99('0x31')]=qs[_0xef99('0x31')](_0x41bb69['query'][_0xef99('0x31')]);}_0x2e2119[_0xef99('0x4a')]=qs[_0xef99('0x4b')](_0x41bb69[_0xef99('0x42')][_0xef99('0x4b')]);_0x2e2119[_0xef99('0x4c')]=qs[_0xef99('0x44')](_['pick'](_0x41bb69[_0xef99('0x42')],_0x344ab4[_0xef99('0x44')]),_0x43b507);if(_0x41bb69[_0xef99('0x42')][_0xef99('0x4d')]){_0x2e2119['where']=_['merge'](_0x2e2119[_0xef99('0x4c')],{'$or':_[_0xef99('0x3d')](_0x43b507,function(_0x5b1ef5){if(_0x5b1ef5[_0xef99('0x3f')]!==_0xef99('0x4e')){var _0x510543={};_0x510543[_0x5b1ef5['name']]={'$like':'%'+_0x41bb69[_0xef99('0x42')]['filter']+'%'};return _0x510543;}})});}_0x2e2119=_[_0xef99('0x4f')]({},_0x2e2119,_0x41bb69['options']);var _0x391429={'where':_0x2e2119[_0xef99('0x4c')]};return db[_0xef99('0x50')][_0xef99('0x30')](_0x391429)[_0xef99('0x22')](function(_0x3efaa5){_0x291553[_0xef99('0x30')]=_0x3efaa5;if(_0x41bb69[_0xef99('0x42')]['includeAll']){_0x2e2119['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xef99('0x51')](_0x2e2119);})[_0xef99('0x22')](function(_0x2fa478){_0x291553[_0xef99('0x52')]=_0x2fa478;return _0x291553;})[_0xef99('0x22')](respondWithFilteredResult(_0x357ca3,_0x2e2119))[_0xef99('0x53')](handleError(_0x357ca3,null));};exports['show']=function(_0x37c1de,_0x4b3917){var _0xcf0680={'raw':![],'where':{'id':_0x37c1de[_0xef99('0x54')]['id']}},_0x59cf1a={};_0x59cf1a[_0xef99('0x41')]=_[_0xef99('0x43')](db['SugarcrmAccount'][_0xef99('0x3e')]);_0x59cf1a[_0xef99('0x42')]=_[_0xef99('0x43')](_0x37c1de[_0xef99('0x42')]);_0x59cf1a[_0xef99('0x44')]=_[_0xef99('0x45')](_0x59cf1a[_0xef99('0x41')],_0x59cf1a[_0xef99('0x42')]);_0xcf0680[_0xef99('0x47')]=_[_0xef99('0x45')](_0x59cf1a[_0xef99('0x41')],qs[_0xef99('0x46')](_0x37c1de[_0xef99('0x42')][_0xef99('0x46')]));_0xcf0680[_0xef99('0x47')]=_0xcf0680[_0xef99('0x47')][_0xef99('0x55')]?_0xcf0680[_0xef99('0x47')]:_0x59cf1a[_0xef99('0x41')];if(_0x37c1de['query'][_0xef99('0x56')]){_0xcf0680['include']=[{'all':!![]}];}_0xcf0680=_[_0xef99('0x4f')]({},_0xcf0680,_0x37c1de[_0xef99('0x57')]);return db['SugarcrmAccount']['find'](_0xcf0680)[_0xef99('0x22')](handleEntityNotFound(_0x4b3917,null))[_0xef99('0x22')](respondWithResult(_0x4b3917,null))[_0xef99('0x53')](handleError(_0x4b3917,null));};exports[_0xef99('0x58')]=function(_0x2a5d5d,_0x459c6a){return db[_0xef99('0x50')][_0xef99('0x58')](_0x2a5d5d[_0xef99('0x59')],{})[_0xef99('0x22')](respondWithResult(_0x459c6a,0xc9))[_0xef99('0x53')](handleError(_0x459c6a,null));};exports[_0xef99('0x36')]=function(_0x12d85a,_0x3a9b7a){if(_0x12d85a[_0xef99('0x59')]['id']){delete _0x12d85a[_0xef99('0x59')]['id'];}return db['SugarcrmAccount'][_0xef99('0x5a')]({'where':{'id':_0x12d85a[_0xef99('0x54')]['id']}})[_0xef99('0x22')](handleEntityNotFound(_0x3a9b7a,null))[_0xef99('0x22')](saveUpdates(_0x12d85a[_0xef99('0x59')],null))[_0xef99('0x22')](respondWithResult(_0x3a9b7a,null))['catch'](handleError(_0x3a9b7a,null));};exports[_0xef99('0x37')]=function(_0x4bca3a,_0x54265a){return db[_0xef99('0x50')][_0xef99('0x5a')]({'where':{'id':_0x4bca3a[_0xef99('0x54')]['id']}})[_0xef99('0x22')](handleEntityNotFound(_0x54265a,null))['then'](removeEntity(_0x54265a,null))[_0xef99('0x53')](handleError(_0x54265a,null));};exports['getConfigurations']=function(_0x3bedc1,_0x34118c,_0x4afac0){var _0x4000ea={};var _0x5d1250={};var _0x2bb7bc;var _0x55988b;return db[_0xef99('0x50')][_0xef99('0x5b')]({'where':{'id':_0x3bedc1['params']['id']}})[_0xef99('0x22')](handleEntityNotFound(_0x34118c,null))['then'](function(_0x3d69c8){if(_0x3d69c8){_0x2bb7bc=_0x3d69c8;_0x5d1250[_0xef99('0x41')]=_['keys'](db[_0xef99('0x5c')][_0xef99('0x3e')]);_0x5d1250[_0xef99('0x42')]=_[_0xef99('0x43')](_0x3bedc1[_0xef99('0x42')]);_0x5d1250['filters']=_[_0xef99('0x45')](_0x5d1250['model'],_0x5d1250[_0xef99('0x42')]);_0x4000ea[_0xef99('0x47')]=_[_0xef99('0x45')](_0x5d1250[_0xef99('0x41')],qs[_0xef99('0x46')](_0x3bedc1[_0xef99('0x42')]['fields']));_0x4000ea[_0xef99('0x47')]=_0x4000ea['attributes'][_0xef99('0x55')]?_0x4000ea[_0xef99('0x47')]:_0x5d1250[_0xef99('0x41')];_0x4000ea[_0xef99('0x4a')]=qs[_0xef99('0x4b')](_0x3bedc1[_0xef99('0x42')]['sort']);_0x4000ea[_0xef99('0x4c')]=qs[_0xef99('0x44')](_['pick'](_0x3bedc1['query'],_0x5d1250['filters']));if(_0x3bedc1[_0xef99('0x42')][_0xef99('0x4d')]){_0x4000ea[_0xef99('0x4c')]=_[_0xef99('0x4f')](_0x4000ea['where'],{'$or':_[_0xef99('0x3d')](_0x4000ea[_0xef99('0x47')],function(_0x577f25){var _0x2f95f8={};_0x2f95f8[_0x577f25]={'$like':'%'+_0x3bedc1['query'][_0xef99('0x4d')]+'%'};return _0x2f95f8;})});}_0x4000ea=_[_0xef99('0x4f')]({},_0x4000ea,_0x3bedc1[_0xef99('0x57')]);return _0x2bb7bc[_0xef99('0x5d')](_0x4000ea);}})[_0xef99('0x22')](function(_0x4c2d0d){if(_0x4c2d0d){_0x55988b=_0x4c2d0d[_0xef99('0x55')];if(!_0x3bedc1[_0xef99('0x42')][_0xef99('0x48')](_0xef99('0x49'))){_0x4000ea[_0xef99('0x32')]=qs['limit'](_0x3bedc1[_0xef99('0x42')][_0xef99('0x32')]);_0x4000ea['offset']=qs[_0xef99('0x31')](_0x3bedc1[_0xef99('0x42')][_0xef99('0x31')]);}return _0x2bb7bc['getConfigurations'](_0x4000ea);}})[_0xef99('0x22')](function(_0x1305c0){if(_0x1305c0){return _0x1305c0?{'count':_0x55988b,'rows':_0x1305c0}:null;}})[_0xef99('0x22')](respondWithResult(_0x34118c,null))[_0xef99('0x53')](handleError(_0x34118c,null));};exports[_0xef99('0x5e')]=function(_0x15ec22,_0x14767a,_0x55cb34){if(_0x15ec22[_0xef99('0x59')]['id']){delete _0x15ec22[_0xef99('0x59')]['id'];}return db[_0xef99('0x50')]['findOne']({'where':{'id':_0x15ec22[_0xef99('0x54')]['id']}})[_0xef99('0x22')](handleEntityNotFound(_0x14767a,null))[_0xef99('0x22')](function(_0x2c3c06){if(_0x2c3c06){_0x15ec22['body'][_0xef99('0x5f')]=_0x2c3c06['id'];_0x15ec22['body'][_0xef99('0x60')]=integrations[_0xef99('0x61')](_0x15ec22[_0xef99('0x59')][_0xef99('0x62')],_0x15ec22[_0xef99('0x59')][_0xef99('0x3f')]);_0x15ec22['body']['Descriptions']=integrations[_0xef99('0x63')](_0x15ec22[_0xef99('0x59')][_0xef99('0x62')],_0x15ec22[_0xef99('0x59')][_0xef99('0x3f')]);return db[_0xef99('0x5c')][_0xef99('0x58')](_0x15ec22[_0xef99('0x59')],{'include':[{'model':db[_0xef99('0x64')],'as':_0xef99('0x60')},{'model':db[_0xef99('0x64')],'as':_0xef99('0x65')}]});}return null;})['then'](respondWithResult(_0x14767a,null))[_0xef99('0x53')](handleError(_0x14767a,null));};exports['getFields']=function(_0x451d0b,_0x46442c,_0xacb1c7){var _0x5d6225='';var _0x585c4d=['id','name',_0xef99('0x66'),_0xef99('0x67'),_0xef99('0x68'),_0xef99('0x69'),_0xef99('0x6a'),'duration_minutes',_0xef99('0x6b'),_0xef99('0x6c'),_0xef99('0x6d'),'direction'];return db[_0xef99('0x50')]['findOne']({'where':{'id':_0x451d0b[_0xef99('0x54')]['id']},'attributes':['id','username',_0xef99('0x6e'),_0xef99('0x6f')]})[_0xef99('0x22')](handleEntityNotFound(_0x46442c,null))[_0xef99('0x22')](function(_0x3e4346){if(_0x3e4346){_0x5d6225=_0x3e4346[_0xef99('0x6f')];var _0x3a1dc6=_0x5d6225['slice'](-0x1);if(_0x3a1dc6==='/'){_0x5d6225=_0x5d6225[_0xef99('0x70')](0x0,_0x5d6225[_0xef99('0x71')](_0x3a1dc6));}return rp({'method':_0xef99('0x72'),'uri':util[_0xef99('0x73')]('%s%s',_0x5d6225,_0xef99('0x74')),'json':!![],'form':{'method':_0xef99('0x75'),'input_type':_0xef99('0x76'),'response_type':_0xef99('0x76'),'rest_data':JSON[_0xef99('0x28')]({'user_auth':{'user_name':_0x3e4346[_0xef99('0x77')],'password':_0x3e4346[_0xef99('0x6e')],'encryption':'PLAIN'},'application':_0xef99('0x78')})}});}})[_0xef99('0x22')](function(_0x98de10){if(_0x98de10&&_0x98de10[_0xef99('0x3a')]!==_0xef99('0x79')&&_0x98de10[_0xef99('0x3a')]!==_0xef99('0x7a')){return rp({'method':_0xef99('0x72'),'uri':util[_0xef99('0x73')](_0xef99('0x7b'),_0x5d6225,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xef99('0x7c'),'input_type':_0xef99('0x76'),'response_type':_0xef99('0x76'),'rest_data':JSON[_0xef99('0x28')]({'session':_0x98de10['id'],'module_name':_0xef99('0x7d')})}})[_0xef99('0x22')](function(_0xf0aeba){if(_0xf0aeba){var _0x275ed6=_[_0xef99('0x7e')](_0xf0aeba['module_fields']);_['remove'](_0x275ed6,function(_0x17d07e){return _0x585c4d[_0xef99('0x7f')](_0x17d07e['name']);});return{'count':_0x275ed6['length'],'rows':_[_0xef99('0x3d')](_0x275ed6,function(_0x621fd7){return{'id':_0x621fd7[_0xef99('0x3a')],'name':_0x621fd7[_0xef99('0x80')],'custom':_[_0xef99('0x81')](_0x621fd7[_0xef99('0x3a')],'_c')?!![]:![],'options':_0x621fd7[_0xef99('0x57')]?_[_0xef99('0x3d')](_[_0xef99('0x7e')](_0x621fd7['options']),function(_0x2108df){return{'name':_0x2108df[_0xef99('0x82')],'value':_0x2108df[_0xef99('0x3a')]};}):[]};})};}})[_0xef99('0x22')](respondWithResult(_0x46442c,null))[_0xef99('0x53')](function(_0x294c8e){var _0x3169ac=_0x451d0b[_0xef99('0x42')][_0xef99('0x1d')]?0x1f4:_0x294c8e[_0xef99('0x83')]||0x1f4;logger[_0xef99('0x29')](_0xef99('0x84'),_0xef99('0x85'),_0x3169ac,JSON[_0xef99('0x28')](_0x294c8e));delete _0x294c8e[_0xef99('0x3a')];if(_0x3169ac===0x191){_0x3169ac=0x190;}_0x46442c[_0xef99('0x2e')](_0x3169ac)[_0xef99('0x3b')](_0x451d0b[_0xef99('0x42')][_0xef99('0x1d')]?{'message':'Wrong\x20credentials','statusCode':_0x294c8e['statusCode']}:_0x294c8e);});}else{var _0x7ab079=0x1f4;_0x46442c['status'](_0x7ab079)[_0xef99('0x3b')]({'message':_0xef99('0x86'),'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 2558d19..089c7ae 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 _0x009b=['../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x009b,0xd0));var _0xb009=function(_0x25cd75,_0x54fcaa){_0x25cd75=_0x25cd75-0x0;var _0x428cc6=_0x009b[_0x25cd75];return _0x428cc6;};'use strict';var _=require(_0xb009('0x0'));var util=require(_0xb009('0x1'));var logger=require('../../config/logger')(_0xb009('0x2'));var moment=require(_0xb009('0x3'));var BPromise=require(_0xb009('0x4'));var rp=require(_0xb009('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb009('0x6'));var attributes=require(_0xb009('0x7'));var integrations=require(_0xb009('0x8'));module[_0xb009('0x9')]=function(_0x779dc1,_0xe297d9){return _0x779dc1[_0xb009('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xb009('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bd9=['exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x158f9b,_0x30d3d2){var _0x11268f=function(_0x2b6c61){while(--_0x2b6c61){_0x158f9b['push'](_0x158f9b['shift']());}};_0x11268f(++_0x30d3d2);}(_0x6bd9,0xb3));var _0x96bd=function(_0x46d743,_0x1675ee){_0x46d743=_0x46d743-0x0;var _0x1c4972=_0x6bd9[_0x46d743];return _0x1c4972;};'use strict';var _=require(_0x96bd('0x0'));var util=require(_0x96bd('0x1'));var logger=require('../../config/logger')(_0x96bd('0x2'));var moment=require(_0x96bd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x96bd('0x4'));var rimraf=require(_0x96bd('0x5'));var config=require(_0x96bd('0x6'));var attributes=require(_0x96bd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x96bd('0x8')]=function(_0x21287b,_0x44ebcb){return _0x21287b['define'](_0x96bd('0x9'),attributes,{'tableName':_0x96bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 400b987..4b23076 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 _0xb191=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5c8ae6,_0x1ff2ff){var _0x474544=function(_0x26d20b){while(--_0x26d20b){_0x5c8ae6['push'](_0x5c8ae6['shift']());}};_0x474544(++_0x1ff2ff);}(_0xb191,0x1c4));var _0x1b19=function(_0x7804f4,_0x367352){_0x7804f4=_0x7804f4-0x0;var _0x293c7d=_0xb191[_0x7804f4];return _0x293c7d;};'use strict';var _=require(_0x1b19('0x0'));var util=require('util');var moment=require(_0x1b19('0x1'));var BPromise=require(_0x1b19('0x2'));var rs=require(_0x1b19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b19('0x4'))['db'];var utils=require(_0x1b19('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b19('0x6'));var jayson=require(_0x1b19('0x7'));var client=jayson[_0x1b19('0x8')][_0x1b19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x873436,_0x5e937c,_0x5a6bf4){return new BPromise(function(_0x53d2fb,_0x3eca80){return client['request'](_0x873436,_0x5a6bf4)[_0x1b19('0xa')](function(_0xa3a101){logger[_0x1b19('0xb')](_0x1b19('0xc'),_0x5e937c,_0x1b19('0xd'));logger[_0x1b19('0xe')](_0x1b19('0xf'),_0x5e937c,_0x1b19('0xd'),JSON[_0x1b19('0x10')](_0xa3a101));if(_0xa3a101[_0x1b19('0x11')]){if(_0xa3a101[_0x1b19('0x11')]['code']===0x1f4){logger['error'](_0x1b19('0xc'),_0x5e937c,_0xa3a101[_0x1b19('0x11')][_0x1b19('0x12')]);return _0x3eca80(_0xa3a101[_0x1b19('0x11')]['message']);}logger['error'](_0x1b19('0xc'),_0x5e937c,_0xa3a101[_0x1b19('0x11')][_0x1b19('0x12')]);return _0x53d2fb(_0xa3a101['error']['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5e937c,_0x1b19('0xd'));_0x53d2fb(_0xa3a101[_0x1b19('0x13')][_0x1b19('0x12')]);}})['catch'](function(_0x118fb0){logger['error'](_0x1b19('0xc'),_0x5e937c,_0x118fb0);_0x3eca80(_0x118fb0);});});}exports['GetSugarcrmAccount']=function(_0x242f01){var _0x2f9c80=this;return new Promise(function(_0x14c68b,_0x40eb17){return db[_0x1b19('0x14')][_0x1b19('0x15')]({'raw':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x17')]===undefined?!![]:![]:!![],'where':_0x242f01['options']?_0x242f01['options'][_0x1b19('0x18')]||null:null,'attributes':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x19')]||null:null,'limit':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x1a')]||null:null,'include':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x242f01['options'][_0x1b19('0x1b')],function(_0x527f25){return{'model':db[_0x527f25['model']],'as':_0x527f25['as'],'attributes':_0x527f25[_0x1b19('0x19')],'include':_0x527f25['include']?_['map'](_0x527f25[_0x1b19('0x1b')],function(_0x508559){return{'model':db[_0x508559[_0x1b19('0x1d')]],'as':_0x508559['as'],'attributes':_0x508559[_0x1b19('0x19')],'include':_0x508559[_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x508559[_0x1b19('0x1b')],function(_0x31c156){return{'model':db[_0x31c156[_0x1b19('0x1d')]],'as':_0x31c156['as'],'attributes':_0x31c156[_0x1b19('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b19('0xa')](function(_0x5e8442){logger[_0x1b19('0xb')]('GetSugarcrmAccount',_0x242f01);logger[_0x1b19('0xe')](_0x1b19('0x1e'),_0x242f01,JSON[_0x1b19('0x10')](_0x5e8442));_0x14c68b(_0x5e8442);})['catch'](function(_0x29a7c2){logger['error'](_0x1b19('0x1e'),_0x29a7c2[_0x1b19('0x12')],_0x242f01);_0x40eb17(_0x2f9c80[_0x1b19('0x11')](0x1f4,_0x29a7c2['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1c3f31){var _0x3ed869=this;return new Promise(function(_0xdc0073,_0x5e709c){return db[_0x1b19('0x14')][_0x1b19('0x1f')]({'raw':_0x1c3f31[_0x1b19('0x16')]?_0x1c3f31[_0x1b19('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1c3f31[_0x1b19('0x16')]?_0x1c3f31['options']['where']||null:null,'attributes':_0x1c3f31['options']?_0x1c3f31[_0x1b19('0x16')][_0x1b19('0x19')]||null:null,'include':_0x1c3f31[_0x1b19('0x16')]?_0x1c3f31[_0x1b19('0x16')][_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x1c3f31['options'][_0x1b19('0x1b')],function(_0x5296d9){return{'model':db[_0x5296d9[_0x1b19('0x1d')]],'as':_0x5296d9['as'],'attributes':_0x5296d9['attributes'],'include':_0x5296d9[_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x5296d9[_0x1b19('0x1b')],function(_0x3a1153){return{'model':db[_0x3a1153[_0x1b19('0x1d')]],'as':_0x3a1153['as'],'attributes':_0x3a1153[_0x1b19('0x19')],'include':_0x3a1153[_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x3a1153[_0x1b19('0x1b')],function(_0x5bef95){return{'model':db[_0x5bef95[_0x1b19('0x1d')]],'as':_0x5bef95['as'],'attributes':_0x5bef95[_0x1b19('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b19('0xa')](function(_0x41d637){logger[_0x1b19('0xb')](_0x1b19('0x20'),_0x1c3f31);logger['debug'](_0x1b19('0x20'),_0x1c3f31,JSON[_0x1b19('0x10')](_0x41d637));_0xdc0073(_0x41d637);})['catch'](function(_0x4357dc){logger[_0x1b19('0x11')](_0x1b19('0x20'),_0x4357dc[_0x1b19('0x12')],_0x1c3f31);_0x5e709c(_0x3ed869[_0x1b19('0x11')](0x1f4,_0x4357dc[_0x1b19('0x12')]));});});}; \ No newline at end of file +var _0x2464=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','include','model','map','then','message','ShowSugarcrmAccount','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x800883,_0x397c5d){var _0x3e44e9=function(_0xa82521){while(--_0xa82521){_0x800883['push'](_0x800883['shift']());}};_0x3e44e9(++_0x397c5d);}(_0x2464,0x15a));var _0x4246=function(_0x29647c,_0x92be9e){_0x29647c=_0x29647c-0x0;var _0x276458=_0x2464[_0x29647c];return _0x276458;};'use strict';var _=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var moment=require('moment');var BPromise=require(_0x4246('0x2'));var rs=require(_0x4246('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4246('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4246('0x5'))(_0x4246('0x6'));var config=require(_0x4246('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4246('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f904,_0x545bfd,_0x3b61c8){return new BPromise(function(_0x24ca34,_0x25389a){return client[_0x4246('0x9')](_0x43f904,_0x3b61c8)['then'](function(_0xc1ed68){logger[_0x4246('0xa')](_0x4246('0xb'),_0x545bfd,_0x4246('0xc'));logger[_0x4246('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x545bfd,'request\x20sent',JSON[_0x4246('0xe')](_0xc1ed68));if(_0xc1ed68[_0x4246('0xf')]){if(_0xc1ed68[_0x4246('0xf')][_0x4246('0x10')]===0x1f4){logger['error'](_0x4246('0xb'),_0x545bfd,_0xc1ed68[_0x4246('0xf')]['message']);return _0x25389a(_0xc1ed68[_0x4246('0xf')]['message']);}logger[_0x4246('0xf')](_0x4246('0xb'),_0x545bfd,_0xc1ed68['error']['message']);return _0x24ca34(_0xc1ed68[_0x4246('0xf')]['message']);}else{logger['info'](_0x4246('0xb'),_0x545bfd,_0x4246('0xc'));_0x24ca34(_0xc1ed68[_0x4246('0x11')]['message']);}})[_0x4246('0x12')](function(_0x94b307){logger[_0x4246('0xf')](_0x4246('0xb'),_0x545bfd,_0x94b307);_0x25389a(_0x94b307);});});}exports[_0x4246('0x13')]=function(_0x122020){var _0x10bc7e=this;return new Promise(function(_0x333522,_0x1dd7bb){return db[_0x4246('0x14')][_0x4246('0x15')]({'raw':_0x122020[_0x4246('0x16')]?_0x122020['options'][_0x4246('0x17')]===undefined?!![]:![]:!![],'where':_0x122020[_0x4246('0x16')]?_0x122020['options']['where']||null:null,'attributes':_0x122020['options']?_0x122020[_0x4246('0x16')][_0x4246('0x18')]||null:null,'limit':_0x122020[_0x4246('0x16')]?_0x122020[_0x4246('0x16')]['limit']||null:null,'include':_0x122020['options']?_0x122020[_0x4246('0x16')][_0x4246('0x19')]?_['map'](_0x122020[_0x4246('0x16')][_0x4246('0x19')],function(_0x44ea86){return{'model':db[_0x44ea86[_0x4246('0x1a')]],'as':_0x44ea86['as'],'attributes':_0x44ea86['attributes'],'include':_0x44ea86[_0x4246('0x19')]?_[_0x4246('0x1b')](_0x44ea86[_0x4246('0x19')],function(_0x2049fc){return{'model':db[_0x2049fc['model']],'as':_0x2049fc['as'],'attributes':_0x2049fc[_0x4246('0x18')],'include':_0x2049fc[_0x4246('0x19')]?_[_0x4246('0x1b')](_0x2049fc[_0x4246('0x19')],function(_0x52a50b){return{'model':db[_0x52a50b[_0x4246('0x1a')]],'as':_0x52a50b['as'],'attributes':_0x52a50b[_0x4246('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4246('0x1c')](function(_0x216989){logger[_0x4246('0xa')](_0x4246('0x13'),_0x122020);logger[_0x4246('0xd')](_0x4246('0x13'),_0x122020,JSON[_0x4246('0xe')](_0x216989));_0x333522(_0x216989);})[_0x4246('0x12')](function(_0x4d9f05){logger[_0x4246('0xf')](_0x4246('0x13'),_0x4d9f05[_0x4246('0x1d')],_0x122020);_0x1dd7bb(_0x10bc7e[_0x4246('0xf')](0x1f4,_0x4d9f05[_0x4246('0x1d')]));});});};exports[_0x4246('0x1e')]=function(_0x90eacd){var _0x4a9802=this;return new Promise(function(_0x4417af,_0x42ed94){return db[_0x4246('0x14')][_0x4246('0x1f')]({'raw':_0x90eacd[_0x4246('0x16')]?_0x90eacd[_0x4246('0x16')][_0x4246('0x17')]===undefined?!![]:![]:!![],'where':_0x90eacd['options']?_0x90eacd[_0x4246('0x16')][_0x4246('0x20')]||null:null,'attributes':_0x90eacd[_0x4246('0x16')]?_0x90eacd['options'][_0x4246('0x18')]||null:null,'include':_0x90eacd[_0x4246('0x16')]?_0x90eacd[_0x4246('0x16')]['include']?_[_0x4246('0x1b')](_0x90eacd['options']['include'],function(_0x5bd66c){return{'model':db[_0x5bd66c[_0x4246('0x1a')]],'as':_0x5bd66c['as'],'attributes':_0x5bd66c[_0x4246('0x18')],'include':_0x5bd66c['include']?_[_0x4246('0x1b')](_0x5bd66c[_0x4246('0x19')],function(_0x41752f){return{'model':db[_0x41752f[_0x4246('0x1a')]],'as':_0x41752f['as'],'attributes':_0x41752f['attributes'],'include':_0x41752f[_0x4246('0x19')]?_[_0x4246('0x1b')](_0x41752f[_0x4246('0x19')],function(_0x28c271){return{'model':db[_0x28c271[_0x4246('0x1a')]],'as':_0x28c271['as'],'attributes':_0x28c271[_0x4246('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4246('0x1c')](function(_0x285f4d){logger['info'](_0x4246('0x1e'),_0x90eacd);logger[_0x4246('0xd')]('ShowSugarcrmAccount',_0x90eacd,JSON[_0x4246('0xe')](_0x285f4d));_0x4417af(_0x285f4d);})['catch'](function(_0x310caf){logger['error'](_0x4246('0x1e'),_0x310caf[_0x4246('0x1d')],_0x90eacd);_0x42ed94(_0x4a9802['error'](0x1f4,_0x310caf[_0x4246('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d49e0ed..a1ebea4 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 _0xb398=['index','get','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated'];(function(_0x2a3031,_0x4842c3){var _0x4e7a20=function(_0x264102){while(--_0x264102){_0x2a3031['push'](_0x2a3031['shift']());}};_0x4e7a20(++_0x4842c3);}(_0xb398,0x18a));var _0x8b39=function(_0x3ffc22,_0x384c16){_0x3ffc22=_0x3ffc22-0x0;var _0x8f243c=_0xb398[_0x3ffc22];return _0x8f243c;};'use strict';var multer=require(_0x8b39('0x0'));var util=require('util');var path=require(_0x8b39('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8b39('0x2'));var interaction=require(_0x8b39('0x3'));var config=require('../../config/environment');var controller=require(_0x8b39('0x4'));router['get']('/',auth[_0x8b39('0x5')](),controller[_0x8b39('0x6')]);router[_0x8b39('0x7')](_0x8b39('0x8'),auth[_0x8b39('0x5')](),controller['show']);router[_0x8b39('0x7')]('/:id/fields',auth[_0x8b39('0x5')](),controller[_0x8b39('0x9')]);router[_0x8b39('0x7')](_0x8b39('0xa'),auth[_0x8b39('0x5')](),controller[_0x8b39('0xb')]);router[_0x8b39('0x7')](_0x8b39('0xc'),auth[_0x8b39('0x5')](),controller[_0x8b39('0xd')]);router[_0x8b39('0xe')]('/',auth[_0x8b39('0x5')](),controller[_0x8b39('0xf')]);router['put'](_0x8b39('0x8'),auth[_0x8b39('0x5')](),controller[_0x8b39('0x10')]);router[_0x8b39('0x11')](_0x8b39('0x8'),auth['isAuthenticated'](),controller[_0x8b39('0x12')]);module[_0x8b39('0x13')]=router; \ No newline at end of file +var _0xefdd=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x49ee44,_0x3cfc78){var _0x10b2bb=function(_0x2e7b27){while(--_0x2e7b27){_0x49ee44['push'](_0x49ee44['shift']());}};_0x10b2bb(++_0x3cfc78);}(_0xefdd,0x141));var _0xdefd=function(_0x48c510,_0x3989e1){_0x48c510=_0x48c510-0x0;var _0x54697c=_0xefdd[_0x48c510];return _0x54697c;};'use strict';var multer=require(_0xdefd('0x0'));var util=require(_0xdefd('0x1'));var path=require(_0xdefd('0x2'));var timeout=require(_0xdefd('0x3'));var express=require('express');var router=express[_0xdefd('0x4')]();var auth=require(_0xdefd('0x5'));var interaction=require(_0xdefd('0x6'));var config=require(_0xdefd('0x7'));var controller=require(_0xdefd('0x8'));router[_0xdefd('0x9')]('/',auth[_0xdefd('0xa')](),controller[_0xdefd('0xb')]);router['get'](_0xdefd('0xc'),auth[_0xdefd('0xa')](),controller['show']);router[_0xdefd('0x9')](_0xdefd('0xd'),auth[_0xdefd('0xa')](),controller[_0xdefd('0xe')]);router[_0xdefd('0x9')](_0xdefd('0xf'),auth[_0xdefd('0xa')](),controller['getSubjects']);router[_0xdefd('0x9')](_0xdefd('0x10'),auth[_0xdefd('0xa')](),controller[_0xdefd('0x11')]);router['post']('/',auth[_0xdefd('0xa')](),controller[_0xdefd('0x12')]);router[_0xdefd('0x13')](_0xdefd('0xc'),auth[_0xdefd('0xa')](),controller['update']);router[_0xdefd('0x14')](_0xdefd('0xc'),auth[_0xdefd('0xa')](),controller['destroy']);module[_0xdefd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4abbc4f..0a61ce6 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 _0x6beb=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6beb,0x164));var _0xb6be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6beb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb6be('0x0'));module[_0xb6be('0x1')]={'name':{'type':Sequelize[_0xb6be('0x2')]},'description':{'type':Sequelize[_0xb6be('0x2')]}}; \ No newline at end of file +var _0x2365=['exports','STRING','sequelize'];(function(_0x282516,_0x433430){var _0x311feb=function(_0x23202f){while(--_0x23202f){_0x282516['push'](_0x282516['shift']());}};_0x311feb(++_0x433430);}(_0x2365,0x19a));var _0x5236=function(_0xfa631c,_0x3d9ca6){_0xfa631c=_0xfa631c-0x0;var _0x136ba4=_0x2365[_0xfa631c];return _0x136ba4;};'use strict';var Sequelize=require(_0x5236('0x0'));module[_0x5236('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5236('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 72cfa8c..9d6f28c 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 _0x6c61=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','destroy','end','stack','name','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','include','rows','show','params','rawAttributes','includeAll','options','find','create','update','body','getFields','findOne','order','SugarcrmField','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5af2a0,_0x1c92d9){var _0x72f843=function(_0x2fe83b){while(--_0x2fe83b){_0x5af2a0['push'](_0x5af2a0['shift']());}};_0x72f843(++_0x1c92d9);}(_0x6c61,0x178));var _0x16c6=function(_0x26b2f7,_0x113598){_0x26b2f7=_0x26b2f7-0x0;var _0x1c3507=_0x6c61[_0x26b2f7];return _0x1c3507;};'use strict';var pdf=require(_0x16c6('0x0'));var emlformat=require(_0x16c6('0x1'));var rimraf=require(_0x16c6('0x2'));var zipdir=require(_0x16c6('0x3'));var jsonpatch=require(_0x16c6('0x4'));var rp=require(_0x16c6('0x5'));var moment=require(_0x16c6('0x6'));var BPromise=require(_0x16c6('0x7'));var Mustache=require(_0x16c6('0x8'));var util=require(_0x16c6('0x9'));var path=require(_0x16c6('0xa'));var sox=require(_0x16c6('0xb'));var csv=require(_0x16c6('0xc'));var ejs=require(_0x16c6('0xd'));var fs=require('fs');var _=require(_0x16c6('0xe'));var squel=require(_0x16c6('0xf'));var crypto=require(_0x16c6('0x10'));var jsforce=require(_0x16c6('0x11'));var deskjs=require(_0x16c6('0x12'));var toCsv=require('to-csv');var querystring=require(_0x16c6('0x13'));var Papa=require(_0x16c6('0x14'));var Redis=require(_0x16c6('0x15'));var authService=require(_0x16c6('0x16'));var qs=require(_0x16c6('0x17'));var as=require(_0x16c6('0x18'));var hardwareService=require(_0x16c6('0x19'));var logger=require('../../config/logger')(_0x16c6('0x1a'));var utils=require(_0x16c6('0x1b'));var config=require(_0x16c6('0x1c'));var db=require(_0x16c6('0x1d'))['db'];var jayson=require(_0x16c6('0x1e'));var client=jayson[_0x16c6('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x271560,_0x4b445d,_0xae2b49){if(_0xae2b49){var _0x58ba61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58ba61[_0x16c6('0x20')](_0x4b445d)){return _0x271560;}else{throw new db['Sequelize'][(_0x16c6('0x21'))](_0x16c6('0x22'));}}else{return _0x271560;}}function respondWithRpcPromise(_0x436faa,_0x1d2df3,_0x208e3e,_0x3fba28){return new BPromise(function(_0x4eec86,_0x1fa584){var _0x29c3a4=_0x3fba28||client;return _0x29c3a4[_0x16c6('0x23')](_0x436faa,_0x208e3e)[_0x16c6('0x24')](function(_0x3def6c){logger[_0x16c6('0x25')](_0x16c6('0x26'),_0x1d2df3,_0x16c6('0x27'));logger[_0x16c6('0x28')](_0x16c6('0x29'),_0x1d2df3,_0x16c6('0x27'),JSON[_0x16c6('0x2a')](_0x3def6c));if(_0x3def6c[_0x16c6('0x2b')]){if(_0x3def6c[_0x16c6('0x2b')]['code']===0x1f4){logger[_0x16c6('0x2b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d2df3,_0x3def6c[_0x16c6('0x2b')][_0x16c6('0x2c')]);return _0x1fa584(_0x3def6c[_0x16c6('0x2b')][_0x16c6('0x2c')]);}logger[_0x16c6('0x2b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d2df3,_0x3def6c[_0x16c6('0x2b')][_0x16c6('0x2c')]);return _0x4eec86(_0x3def6c['error']['message']);}else{logger[_0x16c6('0x25')](_0x16c6('0x26'),_0x1d2df3,_0x16c6('0x27'));_0x4eec86(_0x3def6c['result'][_0x16c6('0x2c')]);}})[_0x16c6('0x2d')](function(_0x453e68){logger[_0x16c6('0x2b')](_0x16c6('0x26'),_0x1d2df3,_0x453e68);_0x1fa584(_0x453e68);});});}function respondWithStatusCode(_0x55fd7a,_0x3770c3){_0x3770c3=_0x3770c3||0xcc;return function(_0xff2ac4){if(_0xff2ac4){return _0x55fd7a[_0x16c6('0x2e')](_0x3770c3);}return _0x55fd7a[_0x16c6('0x2f')](_0x3770c3)['end']();};}function respondWithResult(_0x3f5cfb,_0x1b5911){_0x1b5911=_0x1b5911||0xc8;return function(_0x18f563){if(_0x18f563){return _0x3f5cfb[_0x16c6('0x2f')](_0x1b5911)[_0x16c6('0x30')](_0x18f563);}};}function respondWithFilteredResult(_0x35105f,_0x545981){return function(_0x25675e){if(_0x25675e){var _0x8eecdc=_0x25675e[_0x16c6('0x31')],_0x2b7af0=_0x545981[_0x16c6('0x32')],_0x2a8f69=_0x545981[_0x16c6('0x32')]+_0x545981[_0x16c6('0x33')],_0x462b3c;if(_0x2a8f69>=_0x8eecdc){_0x2a8f69=_0x8eecdc;_0x462b3c=0xc8;}else{_0x462b3c=0xce;}_0x35105f[_0x16c6('0x2f')](_0x462b3c);return _0x35105f[_0x16c6('0x34')](_0x16c6('0x35'),_0x2b7af0+'-'+_0x2a8f69+'/'+_0x8eecdc)[_0x16c6('0x30')](_0x25675e);}return null;};}function patchUpdates(_0x491648){return function(_0x19506c){try{jsonpatch['apply'](_0x19506c,_0x491648,!![]);}catch(_0x6f45e9){return BPromise[_0x16c6('0x36')](_0x6f45e9);}return _0x19506c['save']();};}function saveUpdates(_0x10ea18,_0x468dc3){return function(_0x4ca32f){if(_0x4ca32f){return _0x4ca32f['update'](_0x10ea18)[_0x16c6('0x24')](function(_0x3418b1){return _0x3418b1;});}return null;};}function removeEntity(_0x8d916a,_0x4680a3){return function(_0x538452){if(_0x538452){return _0x538452[_0x16c6('0x37')]()[_0x16c6('0x24')](function(){_0x8d916a[_0x16c6('0x2f')](0xcc)[_0x16c6('0x38')]();});}};}function handleEntityNotFound(_0x360a78,_0x3965eb){return function(_0x1e24ed){if(!_0x1e24ed){_0x360a78[_0x16c6('0x2e')](0x194);}return _0x1e24ed;};}function handleError(_0x1a09e8,_0x170608){_0x170608=_0x170608||0x1f4;return function(_0x4c2662){logger[_0x16c6('0x2b')](_0x4c2662[_0x16c6('0x39')]);if(_0x4c2662[_0x16c6('0x3a')]){delete _0x4c2662[_0x16c6('0x3a')];}_0x1a09e8[_0x16c6('0x2f')](_0x170608)['send'](_0x4c2662);};}exports['index']=function(_0x2224fa,_0x3ca1ee){var _0x4b2b28={},_0x53299f={},_0x5d2b14={'count':0x0,'rows':[]};var _0x34eb39=_[_0x16c6('0x3b')](db[_0x16c6('0x3c')]['rawAttributes'],function(_0x16c328){return{'name':_0x16c328[_0x16c6('0x3d')],'type':_0x16c328[_0x16c6('0x3e')][_0x16c6('0x3f')]};});_0x53299f['model']=_[_0x16c6('0x3b')](_0x34eb39,_0x16c6('0x3a'));_0x53299f[_0x16c6('0x40')]=_[_0x16c6('0x41')](_0x2224fa[_0x16c6('0x40')]);_0x53299f[_0x16c6('0x42')]=_[_0x16c6('0x43')](_0x53299f[_0x16c6('0x44')],_0x53299f['query']);_0x4b2b28[_0x16c6('0x45')]=_['intersection'](_0x53299f[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x2224fa[_0x16c6('0x40')]['fields']));_0x4b2b28[_0x16c6('0x45')]=_0x4b2b28[_0x16c6('0x45')][_0x16c6('0x47')]?_0x4b2b28[_0x16c6('0x45')]:_0x53299f['model'];if(!_0x2224fa[_0x16c6('0x40')][_0x16c6('0x48')]('nolimit')){_0x4b2b28[_0x16c6('0x33')]=qs[_0x16c6('0x33')](_0x2224fa[_0x16c6('0x40')][_0x16c6('0x33')]);_0x4b2b28[_0x16c6('0x32')]=qs[_0x16c6('0x32')](_0x2224fa['query'][_0x16c6('0x32')]);}_0x4b2b28['order']=qs[_0x16c6('0x49')](_0x2224fa[_0x16c6('0x40')][_0x16c6('0x49')]);_0x4b2b28['where']=qs[_0x16c6('0x42')](_[_0x16c6('0x4a')](_0x2224fa['query'],_0x53299f[_0x16c6('0x42')]),_0x34eb39);if(_0x2224fa[_0x16c6('0x40')]['filter']){_0x4b2b28[_0x16c6('0x4b')]=_[_0x16c6('0x4c')](_0x4b2b28[_0x16c6('0x4b')],{'$or':_['map'](_0x34eb39,function(_0x558add){if(_0x558add[_0x16c6('0x3e')]!==_0x16c6('0x4d')){var _0x183901={};_0x183901[_0x558add[_0x16c6('0x3a')]]={'$like':'%'+_0x2224fa[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x183901;}})});}_0x4b2b28=_['merge']({},_0x4b2b28,_0x2224fa['options']);var _0x48dad6={'where':_0x4b2b28[_0x16c6('0x4b')]};return db[_0x16c6('0x3c')][_0x16c6('0x31')](_0x48dad6)[_0x16c6('0x24')](function(_0x3e841f){_0x5d2b14[_0x16c6('0x31')]=_0x3e841f;if(_0x2224fa[_0x16c6('0x40')]['includeAll']){_0x4b2b28[_0x16c6('0x4f')]=[{'all':!![]}];}return db[_0x16c6('0x3c')]['findAll'](_0x4b2b28);})[_0x16c6('0x24')](function(_0x50e4f5){_0x5d2b14[_0x16c6('0x50')]=_0x50e4f5;return _0x5d2b14;})[_0x16c6('0x24')](respondWithFilteredResult(_0x3ca1ee,_0x4b2b28))[_0x16c6('0x2d')](handleError(_0x3ca1ee,null));};exports[_0x16c6('0x51')]=function(_0x1688aa,_0x47547e){var _0x1dfb25={'raw':![],'where':{'id':_0x1688aa[_0x16c6('0x52')]['id']}},_0x13a2c6={};_0x13a2c6['model']=_['keys'](db['SugarcrmConfiguration'][_0x16c6('0x53')]);_0x13a2c6['query']=_[_0x16c6('0x41')](_0x1688aa['query']);_0x13a2c6[_0x16c6('0x42')]=_[_0x16c6('0x43')](_0x13a2c6[_0x16c6('0x44')],_0x13a2c6[_0x16c6('0x40')]);_0x1dfb25['attributes']=_['intersection'](_0x13a2c6['model'],qs[_0x16c6('0x46')](_0x1688aa[_0x16c6('0x40')]['fields']));_0x1dfb25[_0x16c6('0x45')]=_0x1dfb25[_0x16c6('0x45')][_0x16c6('0x47')]?_0x1dfb25[_0x16c6('0x45')]:_0x13a2c6['model'];if(_0x1688aa[_0x16c6('0x40')][_0x16c6('0x54')]){_0x1dfb25[_0x16c6('0x4f')]=[{'all':!![]}];}_0x1dfb25=_[_0x16c6('0x4c')]({},_0x1dfb25,_0x1688aa[_0x16c6('0x55')]);return db[_0x16c6('0x3c')][_0x16c6('0x56')](_0x1dfb25)[_0x16c6('0x24')](handleEntityNotFound(_0x47547e,null))[_0x16c6('0x24')](respondWithResult(_0x47547e,null))[_0x16c6('0x2d')](handleError(_0x47547e,null));};exports[_0x16c6('0x57')]=function(_0x732ce7,_0x2dbca3){return db[_0x16c6('0x3c')][_0x16c6('0x57')](_0x732ce7['body'],{})[_0x16c6('0x24')](respondWithResult(_0x2dbca3,0xc9))[_0x16c6('0x2d')](handleError(_0x2dbca3,null));};exports[_0x16c6('0x58')]=function(_0x359c1f,_0x5c42fc){if(_0x359c1f[_0x16c6('0x59')]['id']){delete _0x359c1f[_0x16c6('0x59')]['id'];}return db[_0x16c6('0x3c')]['find']({'where':{'id':_0x359c1f['params']['id']}})['then'](handleEntityNotFound(_0x5c42fc,null))[_0x16c6('0x24')](saveUpdates(_0x359c1f[_0x16c6('0x59')],null))[_0x16c6('0x24')](respondWithResult(_0x5c42fc,null))['catch'](handleError(_0x5c42fc,null));};exports['destroy']=function(_0x338d27,_0x120f33){return db['SugarcrmConfiguration'][_0x16c6('0x56')]({'where':{'id':_0x338d27[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x120f33,null))[_0x16c6('0x24')](removeEntity(_0x120f33,null))['catch'](handleError(_0x120f33,null));};exports[_0x16c6('0x5a')]=function(_0x2dde89,_0x7c1950,_0x51e4cc){var _0x1a10cb={};var _0x35b226={};var _0x5b5404;var _0x523e03;return db[_0x16c6('0x3c')][_0x16c6('0x5b')]({'where':{'id':_0x2dde89[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x7c1950,null))[_0x16c6('0x24')](function(_0x396e8e){if(_0x396e8e){_0x5b5404=_0x396e8e;_0x35b226[_0x16c6('0x44')]=_['keys'](db['SugarcrmField'][_0x16c6('0x53')]);_0x35b226[_0x16c6('0x40')]=_['keys'](_0x2dde89['query']);_0x35b226['filters']=_[_0x16c6('0x43')](_0x35b226['model'],_0x35b226['query']);_0x1a10cb[_0x16c6('0x45')]=_['intersection'](_0x35b226[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x2dde89[_0x16c6('0x40')][_0x16c6('0x46')]));_0x1a10cb[_0x16c6('0x45')]=_0x1a10cb['attributes'][_0x16c6('0x47')]?_0x1a10cb[_0x16c6('0x45')]:_0x35b226[_0x16c6('0x44')];_0x1a10cb[_0x16c6('0x5c')]=qs['sort'](_0x2dde89[_0x16c6('0x40')][_0x16c6('0x49')]);_0x1a10cb['where']=qs[_0x16c6('0x42')](_[_0x16c6('0x4a')](_0x2dde89[_0x16c6('0x40')],_0x35b226[_0x16c6('0x42')]));if(_0x2dde89[_0x16c6('0x40')][_0x16c6('0x4e')]){_0x1a10cb[_0x16c6('0x4b')]=_[_0x16c6('0x4c')](_0x1a10cb[_0x16c6('0x4b')],{'$or':_[_0x16c6('0x3b')](_0x1a10cb[_0x16c6('0x45')],function(_0x4bd487){var _0x5c9a8d={};_0x5c9a8d[_0x4bd487]={'$like':'%'+_0x2dde89[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x5c9a8d;})});}_0x1a10cb=_[_0x16c6('0x4c')]({},_0x1a10cb,_0x2dde89[_0x16c6('0x55')]);return _0x5b5404['getFields'](_0x1a10cb);}})[_0x16c6('0x24')](function(_0x2c0fd7){if(_0x2c0fd7){_0x523e03=_0x2c0fd7[_0x16c6('0x47')];if(!_0x2dde89['query'][_0x16c6('0x48')]('nolimit')){_0x1a10cb['limit']=qs['limit'](_0x2dde89[_0x16c6('0x40')][_0x16c6('0x33')]);_0x1a10cb['offset']=qs['offset'](_0x2dde89[_0x16c6('0x40')]['offset']);}return _0x5b5404[_0x16c6('0x5a')](_0x1a10cb);}})[_0x16c6('0x24')](function(_0x3f928b){if(_0x3f928b){return _0x3f928b?{'count':_0x523e03,'rows':_0x3f928b}:null;}})[_0x16c6('0x24')](respondWithResult(_0x7c1950,null))[_0x16c6('0x2d')](handleError(_0x7c1950,null));};exports['getSubjects']=function(_0x59c1e2,_0x52f521,_0x1670d0){var _0x119dd8={};var _0x28c436={};var _0x351055;var _0x4a4157;return db[_0x16c6('0x3c')][_0x16c6('0x5b')]({'where':{'id':_0x59c1e2[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x52f521,null))[_0x16c6('0x24')](function(_0xc37f8d){if(_0xc37f8d){_0x351055=_0xc37f8d;_0x28c436[_0x16c6('0x44')]=_[_0x16c6('0x41')](db[_0x16c6('0x5d')][_0x16c6('0x53')]);_0x28c436[_0x16c6('0x40')]=_['keys'](_0x59c1e2[_0x16c6('0x40')]);_0x28c436['filters']=_[_0x16c6('0x43')](_0x28c436[_0x16c6('0x44')],_0x28c436['query']);_0x119dd8[_0x16c6('0x45')]=_[_0x16c6('0x43')](_0x28c436[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x46')]));_0x119dd8[_0x16c6('0x45')]=_0x119dd8[_0x16c6('0x45')]['length']?_0x119dd8[_0x16c6('0x45')]:_0x28c436[_0x16c6('0x44')];_0x119dd8['order']=qs['sort'](_0x59c1e2['query'][_0x16c6('0x49')]);_0x119dd8[_0x16c6('0x4b')]=qs['filters'](_[_0x16c6('0x4a')](_0x59c1e2[_0x16c6('0x40')],_0x28c436[_0x16c6('0x42')]));if(_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x4e')]){_0x119dd8['where']=_[_0x16c6('0x4c')](_0x119dd8['where'],{'$or':_[_0x16c6('0x3b')](_0x119dd8[_0x16c6('0x45')],function(_0x54ac78){var _0x587a81={};_0x587a81[_0x54ac78]={'$like':'%'+_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x587a81;})});}_0x119dd8=_[_0x16c6('0x4c')]({},_0x119dd8,_0x59c1e2['options']);return _0x351055[_0x16c6('0x5e')](_0x119dd8);}})[_0x16c6('0x24')](function(_0x36e817){if(_0x36e817){_0x4a4157=_0x36e817[_0x16c6('0x47')];if(!_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x48')](_0x16c6('0x5f'))){_0x119dd8[_0x16c6('0x33')]=qs[_0x16c6('0x33')](_0x59c1e2['query']['limit']);_0x119dd8['offset']=qs[_0x16c6('0x32')](_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x32')]);}return _0x351055[_0x16c6('0x5e')](_0x119dd8);}})['then'](function(_0x3f7644){if(_0x3f7644){return _0x3f7644?{'count':_0x4a4157,'rows':_0x3f7644}:null;}})[_0x16c6('0x24')](respondWithResult(_0x52f521,null))[_0x16c6('0x2d')](handleError(_0x52f521,null));};exports[_0x16c6('0x60')]=function(_0x541b6d,_0x519fdc,_0x5f48a8){var _0x359237={};var _0x528043={};var _0x501ccb;var _0x4966d1;return db[_0x16c6('0x3c')][_0x16c6('0x5b')]({'where':{'id':_0x541b6d[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x519fdc,null))[_0x16c6('0x24')](function(_0x25e018){if(_0x25e018){_0x501ccb=_0x25e018;_0x528043['model']=_[_0x16c6('0x41')](db[_0x16c6('0x5d')][_0x16c6('0x53')]);_0x528043[_0x16c6('0x40')]=_[_0x16c6('0x41')](_0x541b6d['query']);_0x528043[_0x16c6('0x42')]=_[_0x16c6('0x43')](_0x528043[_0x16c6('0x44')],_0x528043[_0x16c6('0x40')]);_0x359237['attributes']=_[_0x16c6('0x43')](_0x528043[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x541b6d[_0x16c6('0x40')]['fields']));_0x359237[_0x16c6('0x45')]=_0x359237[_0x16c6('0x45')][_0x16c6('0x47')]?_0x359237['attributes']:_0x528043[_0x16c6('0x44')];_0x359237[_0x16c6('0x5c')]=qs[_0x16c6('0x49')](_0x541b6d[_0x16c6('0x40')][_0x16c6('0x49')]);_0x359237[_0x16c6('0x4b')]=qs['filters'](_[_0x16c6('0x4a')](_0x541b6d[_0x16c6('0x40')],_0x528043[_0x16c6('0x42')]));if(_0x541b6d['query'][_0x16c6('0x4e')]){_0x359237[_0x16c6('0x4b')]=_[_0x16c6('0x4c')](_0x359237['where'],{'$or':_[_0x16c6('0x3b')](_0x359237[_0x16c6('0x45')],function(_0x5df55d){var _0x244630={};_0x244630[_0x5df55d]={'$like':'%'+_0x541b6d[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x244630;})});}_0x359237=_[_0x16c6('0x4c')]({},_0x359237,_0x541b6d['options']);return _0x501ccb[_0x16c6('0x60')](_0x359237);}})[_0x16c6('0x24')](function(_0x1e2a88){if(_0x1e2a88){_0x4966d1=_0x1e2a88[_0x16c6('0x47')];if(!_0x541b6d[_0x16c6('0x40')][_0x16c6('0x48')]('nolimit')){_0x359237[_0x16c6('0x33')]=qs[_0x16c6('0x33')](_0x541b6d[_0x16c6('0x40')]['limit']);_0x359237['offset']=qs[_0x16c6('0x32')](_0x541b6d[_0x16c6('0x40')][_0x16c6('0x32')]);}return _0x501ccb[_0x16c6('0x60')](_0x359237);}})[_0x16c6('0x24')](function(_0x4655b7){if(_0x4655b7){return _0x4655b7?{'count':_0x4966d1,'rows':_0x4655b7}:null;}})['then'](respondWithResult(_0x519fdc,null))[_0x16c6('0x2d')](handleError(_0x519fdc,null));}; \ No newline at end of file +var _0x248a=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getFields','hasOwnProperty','getSubjects','SugarcrmField','findOne','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','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','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x413663,_0x2bd760){var _0x7f3df8=function(_0x370fb0){while(--_0x370fb0){_0x413663['push'](_0x413663['shift']());}};_0x7f3df8(++_0x2bd760);}(_0x248a,0xd0));var _0xa248=function(_0x28f402,_0x5aec8a){_0x28f402=_0x28f402-0x0;var _0x498203=_0x248a[_0x28f402];return _0x498203;};'use strict';var pdf=require(_0xa248('0x0'));var emlformat=require(_0xa248('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa248('0x2'));var jsonpatch=require(_0xa248('0x3'));var rp=require(_0xa248('0x4'));var moment=require('moment');var BPromise=require(_0xa248('0x5'));var Mustache=require('mustache');var util=require(_0xa248('0x6'));var path=require('path');var sox=require(_0xa248('0x7'));var csv=require('to-csv');var ejs=require(_0xa248('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa248('0x9'));var jsforce=require(_0xa248('0xa'));var deskjs=require(_0xa248('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa248('0xc'));var Redis=require(_0xa248('0xd'));var authService=require(_0xa248('0xe'));var qs=require(_0xa248('0xf'));var as=require(_0xa248('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa248('0x11'))(_0xa248('0x12'));var utils=require(_0xa248('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xa248('0x14'));var client=jayson[_0xa248('0x15')][_0xa248('0x16')]({'port':0x232a});function checkPasswordPattern(_0x5ea628,_0xbce74e,_0x2a5ffa){if(_0x2a5ffa){var _0x1c4dda=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c4dda[_0xa248('0x17')](_0xbce74e)){return _0x5ea628;}else{throw new db[(_0xa248('0x18'))]['ValidationError'](_0xa248('0x19'));}}else{return _0x5ea628;}}function respondWithRpcPromise(_0x4c91eb,_0x250900,_0x75f815,_0x7c79b1){return new BPromise(function(_0xb185a,_0x431a98){var _0x105e3f=_0x7c79b1||client;return _0x105e3f[_0xa248('0x1a')](_0x4c91eb,_0x75f815)[_0xa248('0x1b')](function(_0x2aa938){logger[_0xa248('0x1c')](_0xa248('0x1d'),_0x250900,'request\x20sent');logger[_0xa248('0x1e')](_0xa248('0x1f'),_0x250900,_0xa248('0x20'),JSON[_0xa248('0x21')](_0x2aa938));if(_0x2aa938[_0xa248('0x22')]){if(_0x2aa938[_0xa248('0x22')][_0xa248('0x23')]===0x1f4){logger[_0xa248('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x250900,_0x2aa938[_0xa248('0x22')][_0xa248('0x24')]);return _0x431a98(_0x2aa938[_0xa248('0x22')]['message']);}logger[_0xa248('0x22')](_0xa248('0x1d'),_0x250900,_0x2aa938[_0xa248('0x22')][_0xa248('0x24')]);return _0xb185a(_0x2aa938[_0xa248('0x22')][_0xa248('0x24')]);}else{logger[_0xa248('0x1c')](_0xa248('0x1d'),_0x250900,'request\x20sent');_0xb185a(_0x2aa938[_0xa248('0x25')][_0xa248('0x24')]);}})[_0xa248('0x26')](function(_0x820729){logger[_0xa248('0x22')](_0xa248('0x1d'),_0x250900,_0x820729);_0x431a98(_0x820729);});});}function respondWithStatusCode(_0x27e15d,_0x5bea77){_0x5bea77=_0x5bea77||0xcc;return function(_0x3c3e94){if(_0x3c3e94){return _0x27e15d[_0xa248('0x27')](_0x5bea77);}return _0x27e15d[_0xa248('0x28')](_0x5bea77)[_0xa248('0x29')]();};}function respondWithResult(_0x179ff6,_0x1b9df8){_0x1b9df8=_0x1b9df8||0xc8;return function(_0x24719a){if(_0x24719a){return _0x179ff6[_0xa248('0x28')](_0x1b9df8)['json'](_0x24719a);}};}function respondWithFilteredResult(_0x5ef01d,_0xcdbbb4){return function(_0x2ebc2c){if(_0x2ebc2c){var _0x10d8b1=_0x2ebc2c[_0xa248('0x2a')],_0x1cb27c=_0xcdbbb4[_0xa248('0x2b')],_0x2d66df=_0xcdbbb4[_0xa248('0x2b')]+_0xcdbbb4[_0xa248('0x2c')],_0x44024f;if(_0x2d66df>=_0x10d8b1){_0x2d66df=_0x10d8b1;_0x44024f=0xc8;}else{_0x44024f=0xce;}_0x5ef01d[_0xa248('0x28')](_0x44024f);return _0x5ef01d[_0xa248('0x2d')](_0xa248('0x2e'),_0x1cb27c+'-'+_0x2d66df+'/'+_0x10d8b1)['json'](_0x2ebc2c);}return null;};}function patchUpdates(_0x5952e9){return function(_0x10629f){try{jsonpatch[_0xa248('0x2f')](_0x10629f,_0x5952e9,!![]);}catch(_0x1f073f){return BPromise[_0xa248('0x30')](_0x1f073f);}return _0x10629f[_0xa248('0x31')]();};}function saveUpdates(_0x5a7450,_0x253178){return function(_0x4a150e){if(_0x4a150e){return _0x4a150e[_0xa248('0x32')](_0x5a7450)[_0xa248('0x1b')](function(_0x4f4655){return _0x4f4655;});}return null;};}function removeEntity(_0x55a641,_0x16055d){return function(_0x5e871f){if(_0x5e871f){return _0x5e871f['destroy']()[_0xa248('0x1b')](function(){_0x55a641[_0xa248('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196d71,_0x3e551d){return function(_0x483d51){if(!_0x483d51){_0x196d71[_0xa248('0x27')](0x194);}return _0x483d51;};}function handleError(_0x3d00ca,_0x4588bd){_0x4588bd=_0x4588bd||0x1f4;return function(_0x48113a){logger['error'](_0x48113a[_0xa248('0x33')]);if(_0x48113a[_0xa248('0x34')]){delete _0x48113a[_0xa248('0x34')];}_0x3d00ca[_0xa248('0x28')](_0x4588bd)[_0xa248('0x35')](_0x48113a);};}exports[_0xa248('0x36')]=function(_0x5459ef,_0x51679e){var _0x34e48a={},_0x38fa4b={},_0x335689={'count':0x0,'rows':[]};var _0xef2b68=_[_0xa248('0x37')](db[_0xa248('0x38')]['rawAttributes'],function(_0x4f0b8f){return{'name':_0x4f0b8f[_0xa248('0x39')],'type':_0x4f0b8f[_0xa248('0x3a')][_0xa248('0x3b')]};});_0x38fa4b[_0xa248('0x3c')]=_[_0xa248('0x37')](_0xef2b68,_0xa248('0x34'));_0x38fa4b[_0xa248('0x3d')]=_[_0xa248('0x3e')](_0x5459ef[_0xa248('0x3d')]);_0x38fa4b['filters']=_[_0xa248('0x3f')](_0x38fa4b['model'],_0x38fa4b[_0xa248('0x3d')]);_0x34e48a[_0xa248('0x40')]=_[_0xa248('0x3f')](_0x38fa4b[_0xa248('0x3c')],qs[_0xa248('0x41')](_0x5459ef[_0xa248('0x3d')]['fields']));_0x34e48a['attributes']=_0x34e48a[_0xa248('0x40')][_0xa248('0x42')]?_0x34e48a[_0xa248('0x40')]:_0x38fa4b[_0xa248('0x3c')];if(!_0x5459ef[_0xa248('0x3d')]['hasOwnProperty'](_0xa248('0x43'))){_0x34e48a[_0xa248('0x2c')]=qs[_0xa248('0x2c')](_0x5459ef['query'][_0xa248('0x2c')]);_0x34e48a[_0xa248('0x2b')]=qs[_0xa248('0x2b')](_0x5459ef[_0xa248('0x3d')][_0xa248('0x2b')]);}_0x34e48a[_0xa248('0x44')]=qs[_0xa248('0x45')](_0x5459ef[_0xa248('0x3d')][_0xa248('0x45')]);_0x34e48a[_0xa248('0x46')]=qs[_0xa248('0x47')](_[_0xa248('0x48')](_0x5459ef[_0xa248('0x3d')],_0x38fa4b[_0xa248('0x47')]),_0xef2b68);if(_0x5459ef['query'][_0xa248('0x49')]){_0x34e48a['where']=_[_0xa248('0x4a')](_0x34e48a['where'],{'$or':_[_0xa248('0x37')](_0xef2b68,function(_0xd47270){if(_0xd47270[_0xa248('0x3a')]!==_0xa248('0x4b')){var _0x19131c={};_0x19131c[_0xd47270[_0xa248('0x34')]]={'$like':'%'+_0x5459ef[_0xa248('0x3d')][_0xa248('0x49')]+'%'};return _0x19131c;}})});}_0x34e48a=_['merge']({},_0x34e48a,_0x5459ef[_0xa248('0x4c')]);var _0x3e8ffc={'where':_0x34e48a[_0xa248('0x46')]};return db[_0xa248('0x38')]['count'](_0x3e8ffc)[_0xa248('0x1b')](function(_0x19204d){_0x335689['count']=_0x19204d;if(_0x5459ef[_0xa248('0x3d')][_0xa248('0x4d')]){_0x34e48a[_0xa248('0x4e')]=[{'all':!![]}];}return db[_0xa248('0x38')][_0xa248('0x4f')](_0x34e48a);})['then'](function(_0x5cfff6){_0x335689[_0xa248('0x50')]=_0x5cfff6;return _0x335689;})[_0xa248('0x1b')](respondWithFilteredResult(_0x51679e,_0x34e48a))[_0xa248('0x26')](handleError(_0x51679e,null));};exports[_0xa248('0x51')]=function(_0x358522,_0x41ec38){var _0x4069b6={'raw':![],'where':{'id':_0x358522[_0xa248('0x52')]['id']}},_0x450b37={};_0x450b37[_0xa248('0x3c')]=_[_0xa248('0x3e')](db[_0xa248('0x38')][_0xa248('0x53')]);_0x450b37[_0xa248('0x3d')]=_[_0xa248('0x3e')](_0x358522[_0xa248('0x3d')]);_0x450b37[_0xa248('0x47')]=_[_0xa248('0x3f')](_0x450b37[_0xa248('0x3c')],_0x450b37[_0xa248('0x3d')]);_0x4069b6[_0xa248('0x40')]=_[_0xa248('0x3f')](_0x450b37[_0xa248('0x3c')],qs[_0xa248('0x41')](_0x358522['query'][_0xa248('0x41')]));_0x4069b6[_0xa248('0x40')]=_0x4069b6[_0xa248('0x40')][_0xa248('0x42')]?_0x4069b6[_0xa248('0x40')]:_0x450b37[_0xa248('0x3c')];if(_0x358522[_0xa248('0x3d')]['includeAll']){_0x4069b6[_0xa248('0x4e')]=[{'all':!![]}];}_0x4069b6=_[_0xa248('0x4a')]({},_0x4069b6,_0x358522[_0xa248('0x4c')]);return db['SugarcrmConfiguration'][_0xa248('0x54')](_0x4069b6)[_0xa248('0x1b')](handleEntityNotFound(_0x41ec38,null))[_0xa248('0x1b')](respondWithResult(_0x41ec38,null))[_0xa248('0x26')](handleError(_0x41ec38,null));};exports['create']=function(_0x53629b,_0x21f435){return db['SugarcrmConfiguration'][_0xa248('0x55')](_0x53629b[_0xa248('0x56')],{})[_0xa248('0x1b')](respondWithResult(_0x21f435,0xc9))[_0xa248('0x26')](handleError(_0x21f435,null));};exports[_0xa248('0x32')]=function(_0x9b8594,_0x5a757f){if(_0x9b8594[_0xa248('0x56')]['id']){delete _0x9b8594[_0xa248('0x56')]['id'];}return db[_0xa248('0x38')]['find']({'where':{'id':_0x9b8594[_0xa248('0x52')]['id']}})[_0xa248('0x1b')](handleEntityNotFound(_0x5a757f,null))['then'](saveUpdates(_0x9b8594[_0xa248('0x56')],null))[_0xa248('0x1b')](respondWithResult(_0x5a757f,null))[_0xa248('0x26')](handleError(_0x5a757f,null));};exports[_0xa248('0x57')]=function(_0x30c441,_0x3b16b2){return db[_0xa248('0x38')][_0xa248('0x54')]({'where':{'id':_0x30c441['params']['id']}})[_0xa248('0x1b')](handleEntityNotFound(_0x3b16b2,null))['then'](removeEntity(_0x3b16b2,null))['catch'](handleError(_0x3b16b2,null));};exports[_0xa248('0x58')]=function(_0x341e5e,_0x569a4c,_0x5a5f61){var _0xb4d388={};var _0x5f3e9c={};var _0x261c35;var _0x1a53fb;return db[_0xa248('0x38')]['findOne']({'where':{'id':_0x341e5e['params']['id']}})[_0xa248('0x1b')](handleEntityNotFound(_0x569a4c,null))['then'](function(_0x3533a9){if(_0x3533a9){_0x261c35=_0x3533a9;_0x5f3e9c['model']=_[_0xa248('0x3e')](db['SugarcrmField'][_0xa248('0x53')]);_0x5f3e9c[_0xa248('0x3d')]=_[_0xa248('0x3e')](_0x341e5e[_0xa248('0x3d')]);_0x5f3e9c[_0xa248('0x47')]=_[_0xa248('0x3f')](_0x5f3e9c[_0xa248('0x3c')],_0x5f3e9c[_0xa248('0x3d')]);_0xb4d388[_0xa248('0x40')]=_[_0xa248('0x3f')](_0x5f3e9c[_0xa248('0x3c')],qs[_0xa248('0x41')](_0x341e5e[_0xa248('0x3d')]['fields']));_0xb4d388[_0xa248('0x40')]=_0xb4d388[_0xa248('0x40')][_0xa248('0x42')]?_0xb4d388[_0xa248('0x40')]:_0x5f3e9c[_0xa248('0x3c')];_0xb4d388[_0xa248('0x44')]=qs['sort'](_0x341e5e['query'][_0xa248('0x45')]);_0xb4d388[_0xa248('0x46')]=qs[_0xa248('0x47')](_[_0xa248('0x48')](_0x341e5e[_0xa248('0x3d')],_0x5f3e9c[_0xa248('0x47')]));if(_0x341e5e['query']['filter']){_0xb4d388['where']=_[_0xa248('0x4a')](_0xb4d388[_0xa248('0x46')],{'$or':_[_0xa248('0x37')](_0xb4d388[_0xa248('0x40')],function(_0x1cfe98){var _0x201cf9={};_0x201cf9[_0x1cfe98]={'$like':'%'+_0x341e5e[_0xa248('0x3d')][_0xa248('0x49')]+'%'};return _0x201cf9;})});}_0xb4d388=_[_0xa248('0x4a')]({},_0xb4d388,_0x341e5e[_0xa248('0x4c')]);return _0x261c35['getFields'](_0xb4d388);}})[_0xa248('0x1b')](function(_0x214c2e){if(_0x214c2e){_0x1a53fb=_0x214c2e[_0xa248('0x42')];if(!_0x341e5e[_0xa248('0x3d')][_0xa248('0x59')](_0xa248('0x43'))){_0xb4d388[_0xa248('0x2c')]=qs[_0xa248('0x2c')](_0x341e5e['query']['limit']);_0xb4d388[_0xa248('0x2b')]=qs[_0xa248('0x2b')](_0x341e5e[_0xa248('0x3d')][_0xa248('0x2b')]);}return _0x261c35['getFields'](_0xb4d388);}})[_0xa248('0x1b')](function(_0x39a038){if(_0x39a038){return _0x39a038?{'count':_0x1a53fb,'rows':_0x39a038}:null;}})[_0xa248('0x1b')](respondWithResult(_0x569a4c,null))[_0xa248('0x26')](handleError(_0x569a4c,null));};exports[_0xa248('0x5a')]=function(_0x2f7777,_0x2f5d1f,_0x2f5612){var _0x33c98c={};var _0x472a0f={};var _0x2cf244;var _0x54fab1;return db[_0xa248('0x38')]['findOne']({'where':{'id':_0x2f7777[_0xa248('0x52')]['id']}})[_0xa248('0x1b')](handleEntityNotFound(_0x2f5d1f,null))[_0xa248('0x1b')](function(_0x17fcab){if(_0x17fcab){_0x2cf244=_0x17fcab;_0x472a0f[_0xa248('0x3c')]=_[_0xa248('0x3e')](db[_0xa248('0x5b')][_0xa248('0x53')]);_0x472a0f[_0xa248('0x3d')]=_[_0xa248('0x3e')](_0x2f7777[_0xa248('0x3d')]);_0x472a0f['filters']=_[_0xa248('0x3f')](_0x472a0f[_0xa248('0x3c')],_0x472a0f[_0xa248('0x3d')]);_0x33c98c[_0xa248('0x40')]=_[_0xa248('0x3f')](_0x472a0f['model'],qs[_0xa248('0x41')](_0x2f7777[_0xa248('0x3d')][_0xa248('0x41')]));_0x33c98c[_0xa248('0x40')]=_0x33c98c[_0xa248('0x40')][_0xa248('0x42')]?_0x33c98c[_0xa248('0x40')]:_0x472a0f['model'];_0x33c98c[_0xa248('0x44')]=qs[_0xa248('0x45')](_0x2f7777[_0xa248('0x3d')]['sort']);_0x33c98c['where']=qs[_0xa248('0x47')](_[_0xa248('0x48')](_0x2f7777[_0xa248('0x3d')],_0x472a0f[_0xa248('0x47')]));if(_0x2f7777[_0xa248('0x3d')][_0xa248('0x49')]){_0x33c98c['where']=_[_0xa248('0x4a')](_0x33c98c[_0xa248('0x46')],{'$or':_[_0xa248('0x37')](_0x33c98c[_0xa248('0x40')],function(_0x20773e){var _0x418d86={};_0x418d86[_0x20773e]={'$like':'%'+_0x2f7777[_0xa248('0x3d')]['filter']+'%'};return _0x418d86;})});}_0x33c98c=_[_0xa248('0x4a')]({},_0x33c98c,_0x2f7777['options']);return _0x2cf244[_0xa248('0x5a')](_0x33c98c);}})[_0xa248('0x1b')](function(_0x3c2937){if(_0x3c2937){_0x54fab1=_0x3c2937[_0xa248('0x42')];if(!_0x2f7777[_0xa248('0x3d')][_0xa248('0x59')](_0xa248('0x43'))){_0x33c98c[_0xa248('0x2c')]=qs[_0xa248('0x2c')](_0x2f7777[_0xa248('0x3d')][_0xa248('0x2c')]);_0x33c98c[_0xa248('0x2b')]=qs[_0xa248('0x2b')](_0x2f7777[_0xa248('0x3d')][_0xa248('0x2b')]);}return _0x2cf244[_0xa248('0x5a')](_0x33c98c);}})['then'](function(_0x42b8d8){if(_0x42b8d8){return _0x42b8d8?{'count':_0x54fab1,'rows':_0x42b8d8}:null;}})['then'](respondWithResult(_0x2f5d1f,null))[_0xa248('0x26')](handleError(_0x2f5d1f,null));};exports['getDescriptions']=function(_0x2172e7,_0x27773c,_0x22229a){var _0x26a863={};var _0x594187={};var _0x3e81d9;var _0x3fabe0;return db['SugarcrmConfiguration'][_0xa248('0x5c')]({'where':{'id':_0x2172e7['params']['id']}})[_0xa248('0x1b')](handleEntityNotFound(_0x27773c,null))['then'](function(_0x415615){if(_0x415615){_0x3e81d9=_0x415615;_0x594187[_0xa248('0x3c')]=_[_0xa248('0x3e')](db['SugarcrmField'][_0xa248('0x53')]);_0x594187[_0xa248('0x3d')]=_[_0xa248('0x3e')](_0x2172e7[_0xa248('0x3d')]);_0x594187[_0xa248('0x47')]=_[_0xa248('0x3f')](_0x594187['model'],_0x594187[_0xa248('0x3d')]);_0x26a863[_0xa248('0x40')]=_[_0xa248('0x3f')](_0x594187['model'],qs[_0xa248('0x41')](_0x2172e7[_0xa248('0x3d')][_0xa248('0x41')]));_0x26a863['attributes']=_0x26a863[_0xa248('0x40')][_0xa248('0x42')]?_0x26a863[_0xa248('0x40')]:_0x594187[_0xa248('0x3c')];_0x26a863['order']=qs['sort'](_0x2172e7['query'][_0xa248('0x45')]);_0x26a863[_0xa248('0x46')]=qs[_0xa248('0x47')](_[_0xa248('0x48')](_0x2172e7[_0xa248('0x3d')],_0x594187[_0xa248('0x47')]));if(_0x2172e7[_0xa248('0x3d')][_0xa248('0x49')]){_0x26a863[_0xa248('0x46')]=_[_0xa248('0x4a')](_0x26a863[_0xa248('0x46')],{'$or':_['map'](_0x26a863[_0xa248('0x40')],function(_0x2f50b9){var _0x59742e={};_0x59742e[_0x2f50b9]={'$like':'%'+_0x2172e7[_0xa248('0x3d')][_0xa248('0x49')]+'%'};return _0x59742e;})});}_0x26a863=_['merge']({},_0x26a863,_0x2172e7[_0xa248('0x4c')]);return _0x3e81d9[_0xa248('0x5d')](_0x26a863);}})[_0xa248('0x1b')](function(_0x454508){if(_0x454508){_0x3fabe0=_0x454508[_0xa248('0x42')];if(!_0x2172e7['query'][_0xa248('0x59')](_0xa248('0x43'))){_0x26a863[_0xa248('0x2c')]=qs[_0xa248('0x2c')](_0x2172e7[_0xa248('0x3d')]['limit']);_0x26a863[_0xa248('0x2b')]=qs['offset'](_0x2172e7['query']['offset']);}return _0x3e81d9[_0xa248('0x5d')](_0x26a863);}})[_0xa248('0x1b')](function(_0x4f5740){if(_0x4f5740){return _0x4f5740?{'count':_0x3fabe0,'rows':_0x4f5740}:null;}})[_0xa248('0x1b')](respondWithResult(_0x27773c,null))['catch'](handleError(_0x27773c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 35c0e35..6adcb35 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 _0x2667=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash','util','moment','request-promise','path','rimraf'];(function(_0x2f98dd,_0xce76a7){var _0x2c7df0=function(_0x2194e4){while(--_0x2194e4){_0x2f98dd['push'](_0x2f98dd['shift']());}};_0x2c7df0(++_0xce76a7);}(_0x2667,0x1c6));var _0x7266=function(_0x281744,_0x51ac61){_0x281744=_0x281744-0x0;var _0x566393=_0x2667[_0x281744];return _0x566393;};'use strict';var _=require(_0x7266('0x0'));var util=require(_0x7266('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7266('0x2'));var BPromise=require('bluebird');var rp=require(_0x7266('0x3'));var fs=require('fs');var path=require(_0x7266('0x4'));var rimraf=require(_0x7266('0x5'));var config=require(_0x7266('0x6'));var attributes=require(_0x7266('0x7'));module[_0x7266('0x8')]=function(_0xd5bc54,_0x18820f){return _0xd5bc54[_0x7266('0x9')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c86=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','api','moment','bluebird','request-promise','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6c86,0x1e5));var _0x66c8=function(_0x485b1d,_0x569b78){_0x485b1d=_0x485b1d-0x0;var _0x5dfae7=_0x6c86[_0x485b1d];return _0x5dfae7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x66c8('0x0'));var moment=require(_0x66c8('0x1'));var BPromise=require(_0x66c8('0x2'));var rp=require(_0x66c8('0x3'));var fs=require('fs');var path=require(_0x66c8('0x4'));var rimraf=require(_0x66c8('0x5'));var config=require(_0x66c8('0x6'));var attributes=require(_0x66c8('0x7'));module[_0x66c8('0x8')]=function(_0x58dbb4,_0x5c03ea){return _0x58dbb4['define'](_0x66c8('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 7231aba..f649b24 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 _0xbdaf=['then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xbdaf,0xe6));var _0xfbda=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbdaf[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xfbda('0x0'));var util=require('util');var moment=require(_0xfbda('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbda('0x2'));var fs=require('fs');var Redis=require(_0xfbda('0x3'));var db=require(_0xfbda('0x4'))['db'];var utils=require(_0xfbda('0x5'));var logger=require('../../config/logger')(_0xfbda('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbda('0x7')][_0xfbda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53ac85,_0x474273,_0x5224f5){return new BPromise(function(_0x175563,_0x528656){return client[_0xfbda('0x9')](_0x53ac85,_0x5224f5)[_0xfbda('0xa')](function(_0x452d79){logger['info'](_0xfbda('0xb'),_0x474273,_0xfbda('0xc'));logger[_0xfbda('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x474273,'request\x20sent',JSON['stringify'](_0x452d79));if(_0x452d79[_0xfbda('0xe')]){if(_0x452d79[_0xfbda('0xe')][_0xfbda('0xf')]===0x1f4){logger['error'](_0xfbda('0xb'),_0x474273,_0x452d79[_0xfbda('0xe')][_0xfbda('0x10')]);return _0x528656(_0x452d79['error'][_0xfbda('0x10')]);}logger[_0xfbda('0xe')](_0xfbda('0xb'),_0x474273,_0x452d79[_0xfbda('0xe')]['message']);return _0x175563(_0x452d79[_0xfbda('0xe')][_0xfbda('0x10')]);}else{logger[_0xfbda('0x11')](_0xfbda('0xb'),_0x474273,'request\x20sent');_0x175563(_0x452d79[_0xfbda('0x12')][_0xfbda('0x10')]);}})[_0xfbda('0x13')](function(_0x58f22b){logger[_0xfbda('0xe')](_0xfbda('0xb'),_0x474273,_0x58f22b);_0x528656(_0x58f22b);});});} \ No newline at end of file +var _0x7c2d=['error','code','message','catch','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xec0590,_0xd27f54){var _0x58158f=function(_0x4e6cef){while(--_0x4e6cef){_0xec0590['push'](_0xec0590['shift']());}};_0x58158f(++_0xd27f54);}(_0x7c2d,0x1a8));var _0xd7c2=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7c2d[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd7c2('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7c2('0x1'));var db=require(_0xd7c2('0x2'))['db'];var utils=require(_0xd7c2('0x3'));var logger=require('../../config/logger')(_0xd7c2('0x4'));var config=require(_0xd7c2('0x5'));var jayson=require(_0xd7c2('0x6'));var client=jayson[_0xd7c2('0x7')][_0xd7c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10a694,_0x5ba685,_0x3a96a3){return new BPromise(function(_0x23b847,_0x4ca46b){return client[_0xd7c2('0x9')](_0x10a694,_0x3a96a3)[_0xd7c2('0xa')](function(_0x3b70df){logger[_0xd7c2('0xb')](_0xd7c2('0xc'),_0x5ba685,_0xd7c2('0xd'));logger['debug'](_0xd7c2('0xe'),_0x5ba685,_0xd7c2('0xd'),JSON[_0xd7c2('0xf')](_0x3b70df));if(_0x3b70df[_0xd7c2('0x10')]){if(_0x3b70df['error'][_0xd7c2('0x11')]===0x1f4){logger['error'](_0xd7c2('0xc'),_0x5ba685,_0x3b70df['error']['message']);return _0x4ca46b(_0x3b70df[_0xd7c2('0x10')][_0xd7c2('0x12')]);}logger[_0xd7c2('0x10')](_0xd7c2('0xc'),_0x5ba685,_0x3b70df[_0xd7c2('0x10')][_0xd7c2('0x12')]);return _0x23b847(_0x3b70df[_0xd7c2('0x10')][_0xd7c2('0x12')]);}else{logger[_0xd7c2('0xb')](_0xd7c2('0xc'),_0x5ba685,'request\x20sent');_0x23b847(_0x3b70df['result'][_0xd7c2('0x12')]);}})[_0xd7c2('0x13')](function(_0x4da743){logger[_0xd7c2('0x10')](_0xd7c2('0xc'),_0x5ba685,_0x4da743);_0x4ca46b(_0x4da743);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b819f3a..37524e6 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 _0x2bba=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x453369,_0x5079f6){var _0x518648=function(_0xc76b8d){while(--_0xc76b8d){_0x453369['push'](_0x453369['shift']());}};_0x518648(++_0x5079f6);}(_0x2bba,0x99));var _0xa2bb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2bba[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa2bb('0x0'));var util=require(_0xa2bb('0x1'));var path=require(_0xa2bb('0x2'));var timeout=require(_0xa2bb('0x3'));var express=require(_0xa2bb('0x4'));var router=express[_0xa2bb('0x5')]();var auth=require(_0xa2bb('0x6'));var interaction=require(_0xa2bb('0x7'));var config=require(_0xa2bb('0x8'));var controller=require('./intSugarcrmField.controller');router[_0xa2bb('0x9')]('/',auth[_0xa2bb('0xa')](),controller[_0xa2bb('0xb')]);router[_0xa2bb('0x9')](_0xa2bb('0xc'),auth[_0xa2bb('0xa')](),controller[_0xa2bb('0xd')]);router[_0xa2bb('0xe')]('/',auth[_0xa2bb('0xa')](),controller[_0xa2bb('0xf')]);router['put'](_0xa2bb('0xc'),auth[_0xa2bb('0xa')](),controller[_0xa2bb('0x10')]);router[_0xa2bb('0x11')](_0xa2bb('0xc'),auth[_0xa2bb('0xa')](),controller[_0xa2bb('0x12')]);module[_0xa2bb('0x13')]=router; \ No newline at end of file +var _0x7ca9=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7ca9,0x1e8));var _0x97ca=function(_0x28effe,_0x5599e7){_0x28effe=_0x28effe-0x0;var _0x477a1a=_0x7ca9[_0x28effe];return _0x477a1a;};'use strict';var multer=require(_0x97ca('0x0'));var util=require(_0x97ca('0x1'));var path=require(_0x97ca('0x2'));var timeout=require(_0x97ca('0x3'));var express=require(_0x97ca('0x4'));var router=express[_0x97ca('0x5')]();var auth=require(_0x97ca('0x6'));var interaction=require(_0x97ca('0x7'));var config=require(_0x97ca('0x8'));var controller=require(_0x97ca('0x9'));router[_0x97ca('0xa')]('/',auth[_0x97ca('0xb')](),controller[_0x97ca('0xc')]);router[_0x97ca('0xa')](_0x97ca('0xd'),auth[_0x97ca('0xb')](),controller[_0x97ca('0xe')]);router[_0x97ca('0xf')]('/',auth['isAuthenticated'](),controller[_0x97ca('0x10')]);router[_0x97ca('0x11')](_0x97ca('0xd'),auth['isAuthenticated'](),controller[_0x97ca('0x12')]);router[_0x97ca('0x13')]('/:id',auth[_0x97ca('0xb')](),controller['destroy']);module[_0x97ca('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6ddeec9..8e27c74 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 _0x9224=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x20ae3b,_0x23a21c){var _0x391475=function(_0x590776){while(--_0x590776){_0x20ae3b['push'](_0x20ae3b['shift']());}};_0x391475(++_0x23a21c);}(_0x9224,0xa3));var _0x4922=function(_0xb4387d,_0x567061){_0xb4387d=_0xb4387d-0x0;var _0x40c549=_0x9224[_0xb4387d];return _0x40c549;};'use strict';var Sequelize=require('sequelize');module[_0x4922('0x0')]={'type':{'type':Sequelize[_0x4922('0x1')](_0x4922('0x2'),_0x4922('0x3'),_0x4922('0x4'),_0x4922('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4922('0x1')]('string',_0x4922('0x3'),_0x4922('0x4'))},'keyContent':{'type':Sequelize[_0x4922('0x6')]},'idField':{'type':Sequelize[_0x4922('0x6')]},'nameField':{'type':Sequelize[_0x4922('0x6')]},'customField':{'type':Sequelize[_0x4922('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5359=['variable','customVariable','string','STRING','exports','ENUM'];(function(_0x48999c,_0x4bda7c){var _0x5bfc51=function(_0x2346f9){while(--_0x2346f9){_0x48999c['push'](_0x48999c['shift']());}};_0x5bfc51(++_0x4bda7c);}(_0x5359,0x130));var _0x9535=function(_0x28c699,_0x43c787){_0x28c699=_0x28c699-0x0;var _0x6d16f0=_0x5359[_0x28c699];return _0x6d16f0;};'use strict';var Sequelize=require('sequelize');module[_0x9535('0x0')]={'type':{'type':Sequelize[_0x9535('0x1')]('string',_0x9535('0x2'),_0x9535('0x3'),'keyValue'),'defaultValue':_0x9535('0x4')},'content':{'type':Sequelize[_0x9535('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9535('0x1')]('string',_0x9535('0x2'),_0x9535('0x3'))},'keyContent':{'type':Sequelize[_0x9535('0x5')]},'idField':{'type':Sequelize[_0x9535('0x5')]},'nameField':{'type':Sequelize[_0x9535('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9535('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b6a1429..551e1fa 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 _0x544d=['mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','SugarcrmField','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','rawAttributes','options','find','create','body','update','params','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544d,0x88));var _0xd544=function(_0x4755ae,_0x3fb2cb){_0x4755ae=_0x4755ae-0x0;var _0x48810d=_0x544d[_0x4755ae];return _0x48810d;};'use strict';var pdf=require(_0xd544('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd544('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd544('0x2'));var rp=require(_0xd544('0x3'));var moment=require(_0xd544('0x4'));var BPromise=require(_0xd544('0x5'));var Mustache=require(_0xd544('0x6'));var util=require('util');var path=require(_0xd544('0x7'));var sox=require('sox');var csv=require(_0xd544('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd544('0x9'));var squel=require(_0xd544('0xa'));var crypto=require(_0xd544('0xb'));var jsforce=require(_0xd544('0xc'));var deskjs=require(_0xd544('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd544('0xe'));var Papa=require(_0xd544('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd544('0x10'));var as=require(_0xd544('0x11'));var hardwareService=require(_0xd544('0x12'));var logger=require(_0xd544('0x13'))(_0xd544('0x14'));var utils=require(_0xd544('0x15'));var config=require('../../config/environment');var db=require(_0xd544('0x16'))['db'];function respondWithStatusCode(_0x41bba0,_0x46e150){_0x46e150=_0x46e150||0xcc;return function(_0x4ed914){if(_0x4ed914){return _0x41bba0[_0xd544('0x17')](_0x46e150);}return _0x41bba0['status'](_0x46e150)[_0xd544('0x18')]();};}function respondWithResult(_0x3c8745,_0x8d3b81){_0x8d3b81=_0x8d3b81||0xc8;return function(_0xd8f80e){if(_0xd8f80e){return _0x3c8745[_0xd544('0x19')](_0x8d3b81)[_0xd544('0x1a')](_0xd8f80e);}};}function respondWithFilteredResult(_0x3f2b84,_0x26343a){return function(_0x310b67){if(_0x310b67){var _0x21a499=_0x310b67[_0xd544('0x1b')],_0x1a8eb6=_0x26343a[_0xd544('0x1c')],_0x45bfed=_0x26343a['offset']+_0x26343a[_0xd544('0x1d')],_0x21a083;if(_0x45bfed>=_0x21a499){_0x45bfed=_0x21a499;_0x21a083=0xc8;}else{_0x21a083=0xce;}_0x3f2b84[_0xd544('0x19')](_0x21a083);return _0x3f2b84[_0xd544('0x1e')](_0xd544('0x1f'),_0x1a8eb6+'-'+_0x45bfed+'/'+_0x21a499)[_0xd544('0x1a')](_0x310b67);}return null;};}function patchUpdates(_0x3c7755){return function(_0x2017a6){try{jsonpatch[_0xd544('0x20')](_0x2017a6,_0x3c7755,!![]);}catch(_0x3d2340){return BPromise[_0xd544('0x21')](_0x3d2340);}return _0x2017a6[_0xd544('0x22')]();};}function saveUpdates(_0x1daead,_0x5edf10){return function(_0x242d15){if(_0x242d15){return _0x242d15['update'](_0x1daead)[_0xd544('0x23')](function(_0x262a9f){return _0x262a9f;});}return null;};}function removeEntity(_0x1dff8d,_0xad960e){return function(_0x138a84){if(_0x138a84){return _0x138a84['destroy']()[_0xd544('0x23')](function(){_0x1dff8d['status'](0xcc)[_0xd544('0x18')]();});}};}function handleEntityNotFound(_0x39b33a,_0x3d7625){return function(_0x1f93d7){if(!_0x1f93d7){_0x39b33a[_0xd544('0x17')](0x194);}return _0x1f93d7;};}function handleError(_0x302ecd,_0x4e8c39){_0x4e8c39=_0x4e8c39||0x1f4;return function(_0x2fa146){logger['error'](_0x2fa146[_0xd544('0x24')]);if(_0x2fa146[_0xd544('0x25')]){delete _0x2fa146[_0xd544('0x25')];}_0x302ecd[_0xd544('0x19')](_0x4e8c39)['send'](_0x2fa146);};}exports['index']=function(_0x3654c6,_0x4d17c1){var _0x19f328={},_0x517309={},_0x1fdca9={'count':0x0,'rows':[]};var _0x108ded=_['map'](db[_0xd544('0x26')]['rawAttributes'],function(_0x2275ee){return{'name':_0x2275ee['fieldName'],'type':_0x2275ee[_0xd544('0x27')][_0xd544('0x28')]};});_0x517309[_0xd544('0x29')]=_[_0xd544('0x2a')](_0x108ded,_0xd544('0x25'));_0x517309[_0xd544('0x2b')]=_['keys'](_0x3654c6[_0xd544('0x2b')]);_0x517309['filters']=_[_0xd544('0x2c')](_0x517309[_0xd544('0x29')],_0x517309[_0xd544('0x2b')]);_0x19f328[_0xd544('0x2d')]=_['intersection'](_0x517309[_0xd544('0x29')],qs[_0xd544('0x2e')](_0x3654c6[_0xd544('0x2b')]['fields']));_0x19f328[_0xd544('0x2d')]=_0x19f328[_0xd544('0x2d')][_0xd544('0x2f')]?_0x19f328[_0xd544('0x2d')]:_0x517309['model'];if(!_0x3654c6[_0xd544('0x2b')]['hasOwnProperty'](_0xd544('0x30'))){_0x19f328[_0xd544('0x1d')]=qs[_0xd544('0x1d')](_0x3654c6[_0xd544('0x2b')][_0xd544('0x1d')]);_0x19f328[_0xd544('0x1c')]=qs[_0xd544('0x1c')](_0x3654c6[_0xd544('0x2b')]['offset']);}_0x19f328[_0xd544('0x31')]=qs[_0xd544('0x32')](_0x3654c6[_0xd544('0x2b')]['sort']);_0x19f328[_0xd544('0x33')]=qs[_0xd544('0x34')](_[_0xd544('0x35')](_0x3654c6[_0xd544('0x2b')],_0x517309[_0xd544('0x34')]),_0x108ded);if(_0x3654c6[_0xd544('0x2b')][_0xd544('0x36')]){_0x19f328[_0xd544('0x33')]=_[_0xd544('0x37')](_0x19f328[_0xd544('0x33')],{'$or':_[_0xd544('0x2a')](_0x108ded,function(_0x361543){if(_0x361543[_0xd544('0x27')]!==_0xd544('0x38')){var _0x1ff60c={};_0x1ff60c[_0x361543['name']]={'$like':'%'+_0x3654c6[_0xd544('0x2b')][_0xd544('0x36')]+'%'};return _0x1ff60c;}})});}_0x19f328=_[_0xd544('0x37')]({},_0x19f328,_0x3654c6['options']);var _0x355ce8={'where':_0x19f328[_0xd544('0x33')]};return db['SugarcrmField'][_0xd544('0x1b')](_0x355ce8)[_0xd544('0x23')](function(_0x28401d){_0x1fdca9['count']=_0x28401d;if(_0x3654c6[_0xd544('0x2b')][_0xd544('0x39')]){_0x19f328[_0xd544('0x3a')]=[{'all':!![]}];}return db[_0xd544('0x26')][_0xd544('0x3b')](_0x19f328);})[_0xd544('0x23')](function(_0x1a949b){_0x1fdca9['rows']=_0x1a949b;return _0x1fdca9;})[_0xd544('0x23')](respondWithFilteredResult(_0x4d17c1,_0x19f328))[_0xd544('0x3c')](handleError(_0x4d17c1,null));};exports[_0xd544('0x3d')]=function(_0x4ba436,_0x199a0b){var _0x497b0d={'raw':!![],'where':{'id':_0x4ba436['params']['id']}},_0x4fcd0a={};_0x4fcd0a[_0xd544('0x29')]=_[_0xd544('0x3e')](db[_0xd544('0x26')][_0xd544('0x3f')]);_0x4fcd0a[_0xd544('0x2b')]=_[_0xd544('0x3e')](_0x4ba436[_0xd544('0x2b')]);_0x4fcd0a['filters']=_['intersection'](_0x4fcd0a[_0xd544('0x29')],_0x4fcd0a[_0xd544('0x2b')]);_0x497b0d['attributes']=_[_0xd544('0x2c')](_0x4fcd0a[_0xd544('0x29')],qs[_0xd544('0x2e')](_0x4ba436[_0xd544('0x2b')][_0xd544('0x2e')]));_0x497b0d['attributes']=_0x497b0d[_0xd544('0x2d')][_0xd544('0x2f')]?_0x497b0d[_0xd544('0x2d')]:_0x4fcd0a['model'];if(_0x4ba436[_0xd544('0x2b')][_0xd544('0x39')]){_0x497b0d[_0xd544('0x3a')]=[{'all':!![]}];}_0x497b0d=_[_0xd544('0x37')]({},_0x497b0d,_0x4ba436[_0xd544('0x40')]);return db[_0xd544('0x26')][_0xd544('0x41')](_0x497b0d)[_0xd544('0x23')](handleEntityNotFound(_0x199a0b,null))['then'](respondWithResult(_0x199a0b,null))[_0xd544('0x3c')](handleError(_0x199a0b,null));};exports[_0xd544('0x42')]=function(_0x3a72ce,_0x5bbb79){return db['SugarcrmField']['create'](_0x3a72ce[_0xd544('0x43')],{})['then'](respondWithResult(_0x5bbb79,0xc9))[_0xd544('0x3c')](handleError(_0x5bbb79,null));};exports[_0xd544('0x44')]=function(_0x420962,_0x45b5b1){if(_0x420962[_0xd544('0x43')]['id']){delete _0x420962[_0xd544('0x43')]['id'];}return db[_0xd544('0x26')][_0xd544('0x41')]({'where':{'id':_0x420962[_0xd544('0x45')]['id']}})['then'](handleEntityNotFound(_0x45b5b1,null))[_0xd544('0x23')](saveUpdates(_0x420962[_0xd544('0x43')],null))[_0xd544('0x23')](respondWithResult(_0x45b5b1,null))[_0xd544('0x3c')](handleError(_0x45b5b1,null));};exports[_0xd544('0x46')]=function(_0x233ceb,_0x284ab3){return db['SugarcrmField'][_0xd544('0x41')]({'where':{'id':_0x233ceb[_0xd544('0x45')]['id']}})[_0xd544('0x23')](handleEntityNotFound(_0x284ab3,null))['then'](removeEntity(_0x284ab3,null))[_0xd544('0x3c')](handleError(_0x284ab3,null));}; \ No newline at end of file +var _0x96bd=['merge','VIRTUAL','includeAll','include','SugarcrmField','findAll','rows','catch','show','params','length','find','create','body','update','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','where','filter'];(function(_0x3cbd3c,_0x1fe1cc){var _0x1bff6f=function(_0x31ebad){while(--_0x31ebad){_0x3cbd3c['push'](_0x3cbd3c['shift']());}};_0x1bff6f(++_0x1fe1cc);}(_0x96bd,0xee));var _0xd96b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x96bd[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0xd96b('0x0'));var emlformat=require(_0xd96b('0x1'));var rimraf=require(_0xd96b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd96b('0x3'));var rp=require(_0xd96b('0x4'));var moment=require(_0xd96b('0x5'));var BPromise=require(_0xd96b('0x6'));var Mustache=require(_0xd96b('0x7'));var util=require(_0xd96b('0x8'));var path=require(_0xd96b('0x9'));var sox=require('sox');var csv=require(_0xd96b('0xa'));var ejs=require(_0xd96b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd96b('0xc'));var jsforce=require(_0xd96b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd96b('0xa'));var querystring=require(_0xd96b('0xe'));var Papa=require(_0xd96b('0xf'));var Redis=require(_0xd96b('0x10'));var authService=require(_0xd96b('0x11'));var qs=require(_0xd96b('0x12'));var as=require(_0xd96b('0x13'));var hardwareService=require(_0xd96b('0x14'));var logger=require(_0xd96b('0x15'))('api');var utils=require(_0xd96b('0x16'));var config=require(_0xd96b('0x17'));var db=require(_0xd96b('0x18'))['db'];function respondWithStatusCode(_0x4cc876,_0xa9fc15){_0xa9fc15=_0xa9fc15||0xcc;return function(_0x1dcb39){if(_0x1dcb39){return _0x4cc876[_0xd96b('0x19')](_0xa9fc15);}return _0x4cc876[_0xd96b('0x1a')](_0xa9fc15)[_0xd96b('0x1b')]();};}function respondWithResult(_0x3cfe69,_0x19755c){_0x19755c=_0x19755c||0xc8;return function(_0x10e982){if(_0x10e982){return _0x3cfe69[_0xd96b('0x1a')](_0x19755c)[_0xd96b('0x1c')](_0x10e982);}};}function respondWithFilteredResult(_0x1520be,_0x309345){return function(_0xaf15d9){if(_0xaf15d9){var _0x5f1d84=_0xaf15d9[_0xd96b('0x1d')],_0x5de3ea=_0x309345[_0xd96b('0x1e')],_0x3a42c1=_0x309345[_0xd96b('0x1e')]+_0x309345[_0xd96b('0x1f')],_0x54342e;if(_0x3a42c1>=_0x5f1d84){_0x3a42c1=_0x5f1d84;_0x54342e=0xc8;}else{_0x54342e=0xce;}_0x1520be[_0xd96b('0x1a')](_0x54342e);return _0x1520be[_0xd96b('0x20')](_0xd96b('0x21'),_0x5de3ea+'-'+_0x3a42c1+'/'+_0x5f1d84)[_0xd96b('0x1c')](_0xaf15d9);}return null;};}function patchUpdates(_0xa75c96){return function(_0x2b5ae9){try{jsonpatch[_0xd96b('0x22')](_0x2b5ae9,_0xa75c96,!![]);}catch(_0x36d529){return BPromise[_0xd96b('0x23')](_0x36d529);}return _0x2b5ae9[_0xd96b('0x24')]();};}function saveUpdates(_0x1bb7ec,_0x5dd829){return function(_0xff4d87){if(_0xff4d87){return _0xff4d87['update'](_0x1bb7ec)[_0xd96b('0x25')](function(_0x3fb63e){return _0x3fb63e;});}return null;};}function removeEntity(_0x3c6ce2,_0x1eb134){return function(_0x26cc89){if(_0x26cc89){return _0x26cc89['destroy']()[_0xd96b('0x25')](function(){_0x3c6ce2['status'](0xcc)[_0xd96b('0x1b')]();});}};}function handleEntityNotFound(_0xc9f850,_0x54ea46){return function(_0x18a093){if(!_0x18a093){_0xc9f850[_0xd96b('0x19')](0x194);}return _0x18a093;};}function handleError(_0x1a1f21,_0x15ef7d){_0x15ef7d=_0x15ef7d||0x1f4;return function(_0x254cf6){logger[_0xd96b('0x26')](_0x254cf6[_0xd96b('0x27')]);if(_0x254cf6['name']){delete _0x254cf6[_0xd96b('0x28')];}_0x1a1f21[_0xd96b('0x1a')](_0x15ef7d)[_0xd96b('0x29')](_0x254cf6);};}exports['index']=function(_0x2a329b,_0x131ef4){var _0x22d048={},_0x223061={},_0x266c1f={'count':0x0,'rows':[]};var _0x52788a=_[_0xd96b('0x2a')](db['SugarcrmField'][_0xd96b('0x2b')],function(_0x2161eb){return{'name':_0x2161eb[_0xd96b('0x2c')],'type':_0x2161eb[_0xd96b('0x2d')][_0xd96b('0x2e')]};});_0x223061['model']=_[_0xd96b('0x2a')](_0x52788a,_0xd96b('0x28'));_0x223061[_0xd96b('0x2f')]=_[_0xd96b('0x30')](_0x2a329b[_0xd96b('0x2f')]);_0x223061[_0xd96b('0x31')]=_[_0xd96b('0x32')](_0x223061['model'],_0x223061['query']);_0x22d048[_0xd96b('0x33')]=_[_0xd96b('0x32')](_0x223061[_0xd96b('0x34')],qs['fields'](_0x2a329b[_0xd96b('0x2f')][_0xd96b('0x35')]));_0x22d048['attributes']=_0x22d048[_0xd96b('0x33')]['length']?_0x22d048['attributes']:_0x223061[_0xd96b('0x34')];if(!_0x2a329b[_0xd96b('0x2f')][_0xd96b('0x36')]('nolimit')){_0x22d048['limit']=qs[_0xd96b('0x1f')](_0x2a329b['query'][_0xd96b('0x1f')]);_0x22d048[_0xd96b('0x1e')]=qs[_0xd96b('0x1e')](_0x2a329b[_0xd96b('0x2f')][_0xd96b('0x1e')]);}_0x22d048['order']=qs[_0xd96b('0x37')](_0x2a329b[_0xd96b('0x2f')][_0xd96b('0x37')]);_0x22d048[_0xd96b('0x38')]=qs[_0xd96b('0x31')](_['pick'](_0x2a329b[_0xd96b('0x2f')],_0x223061['filters']),_0x52788a);if(_0x2a329b['query'][_0xd96b('0x39')]){_0x22d048[_0xd96b('0x38')]=_[_0xd96b('0x3a')](_0x22d048['where'],{'$or':_['map'](_0x52788a,function(_0xd74275){if(_0xd74275[_0xd96b('0x2d')]!==_0xd96b('0x3b')){var _0x231049={};_0x231049[_0xd74275['name']]={'$like':'%'+_0x2a329b[_0xd96b('0x2f')][_0xd96b('0x39')]+'%'};return _0x231049;}})});}_0x22d048=_[_0xd96b('0x3a')]({},_0x22d048,_0x2a329b['options']);var _0x1d2aaf={'where':_0x22d048['where']};return db['SugarcrmField'][_0xd96b('0x1d')](_0x1d2aaf)[_0xd96b('0x25')](function(_0x107d8a){_0x266c1f[_0xd96b('0x1d')]=_0x107d8a;if(_0x2a329b['query'][_0xd96b('0x3c')]){_0x22d048[_0xd96b('0x3d')]=[{'all':!![]}];}return db[_0xd96b('0x3e')][_0xd96b('0x3f')](_0x22d048);})[_0xd96b('0x25')](function(_0x4ecbd5){_0x266c1f[_0xd96b('0x40')]=_0x4ecbd5;return _0x266c1f;})[_0xd96b('0x25')](respondWithFilteredResult(_0x131ef4,_0x22d048))[_0xd96b('0x41')](handleError(_0x131ef4,null));};exports[_0xd96b('0x42')]=function(_0x739aa,_0x1f01dd){var _0x3a202b={'raw':!![],'where':{'id':_0x739aa[_0xd96b('0x43')]['id']}},_0x10d374={};_0x10d374['model']=_[_0xd96b('0x30')](db[_0xd96b('0x3e')][_0xd96b('0x2b')]);_0x10d374[_0xd96b('0x2f')]=_['keys'](_0x739aa[_0xd96b('0x2f')]);_0x10d374['filters']=_[_0xd96b('0x32')](_0x10d374[_0xd96b('0x34')],_0x10d374[_0xd96b('0x2f')]);_0x3a202b[_0xd96b('0x33')]=_[_0xd96b('0x32')](_0x10d374['model'],qs['fields'](_0x739aa[_0xd96b('0x2f')][_0xd96b('0x35')]));_0x3a202b[_0xd96b('0x33')]=_0x3a202b[_0xd96b('0x33')][_0xd96b('0x44')]?_0x3a202b['attributes']:_0x10d374[_0xd96b('0x34')];if(_0x739aa[_0xd96b('0x2f')][_0xd96b('0x3c')]){_0x3a202b[_0xd96b('0x3d')]=[{'all':!![]}];}_0x3a202b=_[_0xd96b('0x3a')]({},_0x3a202b,_0x739aa['options']);return db[_0xd96b('0x3e')][_0xd96b('0x45')](_0x3a202b)[_0xd96b('0x25')](handleEntityNotFound(_0x1f01dd,null))[_0xd96b('0x25')](respondWithResult(_0x1f01dd,null))['catch'](handleError(_0x1f01dd,null));};exports[_0xd96b('0x46')]=function(_0x4ea088,_0x3b5c02){return db[_0xd96b('0x3e')][_0xd96b('0x46')](_0x4ea088[_0xd96b('0x47')],{})['then'](respondWithResult(_0x3b5c02,0xc9))[_0xd96b('0x41')](handleError(_0x3b5c02,null));};exports[_0xd96b('0x48')]=function(_0x43cdbb,_0x5b7025){if(_0x43cdbb[_0xd96b('0x47')]['id']){delete _0x43cdbb[_0xd96b('0x47')]['id'];}return db[_0xd96b('0x3e')][_0xd96b('0x45')]({'where':{'id':_0x43cdbb[_0xd96b('0x43')]['id']}})[_0xd96b('0x25')](handleEntityNotFound(_0x5b7025,null))[_0xd96b('0x25')](saveUpdates(_0x43cdbb[_0xd96b('0x47')],null))['then'](respondWithResult(_0x5b7025,null))[_0xd96b('0x41')](handleError(_0x5b7025,null));};exports[_0xd96b('0x49')]=function(_0x3e1323,_0x56428d){return db[_0xd96b('0x3e')]['find']({'where':{'id':_0x3e1323[_0xd96b('0x43')]['id']}})[_0xd96b('0x25')](handleEntityNotFound(_0x56428d,null))[_0xd96b('0x25')](removeEntity(_0x56428d,null))['catch'](handleError(_0x56428d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c56f962..333f294 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 _0x7cc4=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x7cc4,0xd6));var _0x47cc=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x7cc4[_0x17406e];return _0x2bfc5a;};'use strict';var _=require(_0x47cc('0x0'));var util=require(_0x47cc('0x1'));var logger=require(_0x47cc('0x2'))(_0x47cc('0x3'));var moment=require('moment');var BPromise=require(_0x47cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47cc('0x5'));var rimraf=require('rimraf');var config=require(_0x47cc('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x47cc('0x7')]=function(_0x494e06,_0x2b2497){return _0x494e06[_0x47cc('0x8')](_0x47cc('0x9'),attributes,{'tableName':_0x47cc('0xa'),'paranoid':![],'indexes':[{'name':_0x47cc('0xb'),'fields':['idField',_0x47cc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d5a=['bluebird','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','lodash','util','../../config/logger','api','moment'];(function(_0x9d4ce4,_0x510f23){var _0x555e00=function(_0x2572f9){while(--_0x2572f9){_0x9d4ce4['push'](_0x9d4ce4['shift']());}};_0x555e00(++_0x510f23);}(_0x0d5a,0x18e));var _0xa0d5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0d5a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xa0d5('0x0'));var util=require(_0xa0d5('0x1'));var logger=require(_0xa0d5('0x2'))(_0xa0d5('0x3'));var moment=require(_0xa0d5('0x4'));var BPromise=require(_0xa0d5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0d5('0x6'));var rimraf=require(_0xa0d5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0d5('0x8'));module[_0xa0d5('0x9')]=function(_0x50a240,_0x129642){return _0x50a240[_0xa0d5('0xa')](_0xa0d5('0xb'),attributes,{'tableName':_0xa0d5('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index aca1ab4..67b95b1 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0xc377c1,_0x1063d1){var _0x45d950=function(_0x19b126){while(--_0x19b126){_0xc377c1['push'](_0xc377c1['shift']());}};_0x45d950(++_0x1063d1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29a6be,_0x28ad94){_0x29a6be=_0x29a6be-0x0;var _0x1d542d=_0x5f2f[_0x29a6be];return _0x1d542d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x169790,_0x48aa33){var _0x4d0f36=function(_0x2a848d){while(--_0x2a848d){_0x169790['push'](_0x169790['shift']());}};_0x4d0f36(++_0x48aa33);}(_0x14a0,0x8e));var _0x014a=function(_0x986bb1,_0x5024b6){_0x986bb1=_0x986bb1-0x0;var _0x468f28=_0x14a0[_0x986bb1];return _0x468f28;};'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']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a819245..79c27e4 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 _0x5090=['multer','util','path','express','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0x5090,0x1ce));var _0x0509=function(_0x195f5e,_0x3dfac4){_0x195f5e=_0x195f5e-0x0;var _0x36267c=_0x5090[_0x195f5e];return _0x36267c;};'use strict';var multer=require(_0x0509('0x0'));var util=require(_0x0509('0x1'));var path=require(_0x0509('0x2'));var timeout=require('connect-timeout');var express=require(_0x0509('0x3'));var router=express['Router']();var auth=require(_0x0509('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0509('0x5'));var controller=require(_0x0509('0x6'));router[_0x0509('0x7')]('/',auth[_0x0509('0x8')](),controller[_0x0509('0x9')]);router[_0x0509('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0509('0xa')]);router[_0x0509('0x7')](_0x0509('0xb'),auth[_0x0509('0x8')](),controller[_0x0509('0xc')]);router[_0x0509('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0509('0xd')]);router['post']('/',auth[_0x0509('0x8')](),controller[_0x0509('0xe')]);router[_0x0509('0xf')](_0x0509('0xb'),auth[_0x0509('0x8')](),controller[_0x0509('0x10')]);router[_0x0509('0x11')]('/:id',auth[_0x0509('0x8')](),controller[_0x0509('0x12')]);router[_0x0509('0x13')](_0x0509('0x14'),auth['isAuthenticated'](),controller[_0x0509('0x15')]);module['exports']=router; \ No newline at end of file +var _0x52cc=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x33e4a2,_0x39316d){var _0x15e82a=function(_0xb9586e){while(--_0xb9586e){_0x33e4a2['push'](_0x33e4a2['shift']());}};_0x15e82a(++_0x39316d);}(_0x52cc,0x1c1));var _0xc52c=function(_0x34c03a,_0x5a1942){_0x34c03a=_0x34c03a-0x0;var _0x41eb10=_0x52cc[_0x34c03a];return _0x41eb10;};'use strict';var multer=require(_0xc52c('0x0'));var util=require(_0xc52c('0x1'));var path=require(_0xc52c('0x2'));var timeout=require(_0xc52c('0x3'));var express=require(_0xc52c('0x4'));var router=express[_0xc52c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc52c('0x6'));var config=require(_0xc52c('0x7'));var controller=require(_0xc52c('0x8'));router[_0xc52c('0x9')]('/',auth[_0xc52c('0xa')](),controller[_0xc52c('0xb')]);router['get'](_0xc52c('0xc'),auth[_0xc52c('0xa')](),controller[_0xc52c('0xd')]);router[_0xc52c('0x9')](_0xc52c('0xe'),auth[_0xc52c('0xa')](),controller[_0xc52c('0xf')]);router[_0xc52c('0x9')](_0xc52c('0x10'),auth[_0xc52c('0xa')](),controller[_0xc52c('0x11')]);router['post']('/',auth[_0xc52c('0xa')](),controller[_0xc52c('0x12')]);router[_0xc52c('0x13')](_0xc52c('0xe'),auth[_0xc52c('0xa')](),controller[_0xc52c('0x14')]);router['put'](_0xc52c('0xc'),auth[_0xc52c('0xa')](),controller[_0xc52c('0x15')]);router[_0xc52c('0x16')](_0xc52c('0xc'),auth[_0xc52c('0xa')](),controller[_0xc52c('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1f2efc8..d16d37f 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 _0xdaa9=['sequelize','exports','STRING','HelpDesk'];(function(_0x3ab293,_0x2d162a){var _0x2744ec=function(_0x57d471){while(--_0x57d471){_0x3ab293['push'](_0x3ab293['shift']());}};_0x2744ec(++_0x2d162a);}(_0xdaa9,0x1c8));var _0x9daa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdaa9[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x9daa('0x0'));module[_0x9daa('0x1')]={'name':{'type':Sequelize[_0x9daa('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9daa('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9daa('0x2')],'allowNull':![],'defaultValue':_0x9daa('0x3')},'remoteUri':{'type':Sequelize[_0x9daa('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9daa('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x90fa=['STRING','HelpDesk','sequelize','exports'];(function(_0x77485d,_0x1c1392){var _0x2e3304=function(_0x14f017){while(--_0x14f017){_0x77485d['push'](_0x77485d['shift']());}};_0x2e3304(++_0x1c1392);}(_0x90fa,0x172));var _0xa90f=function(_0x1adcc4,_0x45e751){_0x1adcc4=_0x1adcc4-0x0;var _0x34a040=_0x90fa[_0x1adcc4];return _0x34a040;};'use strict';var Sequelize=require(_0xa90f('0x0'));module[_0xa90f('0x1')]={'name':{'type':Sequelize[_0xa90f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa90f('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa90f('0x3')},'remoteUri':{'type':Sequelize[_0xa90f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa90f('0x2')]},'accessKey':{'type':Sequelize[_0xa90f('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 7322d02..ab92ee2 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 _0x50ae=['login','success','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','length','create','body','find','VtigerConfiguration','nolimit','getConfigurations','addConfiguration','getSubjects','channel','VtigerField','Subjects','Descriptions','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','lastIndexOf','format','GET','POST'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x50ae,0x11a));var _0xe50a=function(_0x67d65a,_0x29ccbe){_0x67d65a=_0x67d65a-0x0;var _0x3f1525=_0x50ae[_0x67d65a];return _0x3f1525;};'use strict';var pdf=require(_0xe50a('0x0'));var emlformat=require(_0xe50a('0x1'));var rimraf=require(_0xe50a('0x2'));var zipdir=require(_0xe50a('0x3'));var jsonpatch=require(_0xe50a('0x4'));var rp=require(_0xe50a('0x5'));var moment=require(_0xe50a('0x6'));var BPromise=require(_0xe50a('0x7'));var Mustache=require(_0xe50a('0x8'));var util=require(_0xe50a('0x9'));var path=require(_0xe50a('0xa'));var sox=require('sox');var csv=require(_0xe50a('0xb'));var ejs=require(_0xe50a('0xc'));var fs=require('fs');var _=require(_0xe50a('0xd'));var squel=require(_0xe50a('0xe'));var crypto=require(_0xe50a('0xf'));var jsforce=require(_0xe50a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe50a('0xb'));var querystring=require('querystring');var Papa=require(_0xe50a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe50a('0x12'));var as=require(_0xe50a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe50a('0x14'));var utils=require(_0xe50a('0x15'));var config=require(_0xe50a('0x16'));var db=require(_0xe50a('0x17'))['db'];var integrations=require(_0xe50a('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xe50a('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x191619,_0x3a2256,_0x4c1eb4){if(_0x4c1eb4){var _0x24a666=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24a666[_0xe50a('0x1a')](_0x3a2256)){return _0x191619;}else{throw new db[(_0xe50a('0x1b'))][(_0xe50a('0x1c'))](_0xe50a('0x1d'));}}else{return _0x191619;}}function respondWithRpcPromise(_0x54c382,_0x2eff04,_0x33fe3e,_0x39f05f){return new BPromise(function(_0x4abd34,_0x304369){var _0x17bc85=_0x39f05f||client;return _0x17bc85[_0xe50a('0x1e')](_0x54c382,_0x33fe3e)['then'](function(_0x33e01d){logger[_0xe50a('0x1f')](_0xe50a('0x20'),_0x2eff04,_0xe50a('0x21'));logger[_0xe50a('0x22')](_0xe50a('0x23'),_0x2eff04,_0xe50a('0x21'),JSON[_0xe50a('0x24')](_0x33e01d));if(_0x33e01d[_0xe50a('0x25')]){if(_0x33e01d[_0xe50a('0x25')][_0xe50a('0x26')]===0x1f4){logger['error'](_0xe50a('0x20'),_0x2eff04,_0x33e01d[_0xe50a('0x25')][_0xe50a('0x27')]);return _0x304369(_0x33e01d[_0xe50a('0x25')][_0xe50a('0x27')]);}logger[_0xe50a('0x25')](_0xe50a('0x20'),_0x2eff04,_0x33e01d[_0xe50a('0x25')]['message']);return _0x4abd34(_0x33e01d[_0xe50a('0x25')]['message']);}else{logger[_0xe50a('0x1f')](_0xe50a('0x20'),_0x2eff04,_0xe50a('0x21'));_0x4abd34(_0x33e01d[_0xe50a('0x28')][_0xe50a('0x27')]);}})[_0xe50a('0x29')](function(_0x51313a){logger[_0xe50a('0x25')](_0xe50a('0x20'),_0x2eff04,_0x51313a);_0x304369(_0x51313a);});});}function respondWithStatusCode(_0x4e24e6,_0x809763){_0x809763=_0x809763||0xcc;return function(_0xc6098c){if(_0xc6098c){return _0x4e24e6['sendStatus'](_0x809763);}return _0x4e24e6[_0xe50a('0x2a')](_0x809763)[_0xe50a('0x2b')]();};}function respondWithResult(_0x26a30e,_0x262284){_0x262284=_0x262284||0xc8;return function(_0x288d26){if(_0x288d26){return _0x26a30e[_0xe50a('0x2a')](_0x262284)[_0xe50a('0x2c')](_0x288d26);}};}function respondWithFilteredResult(_0x2933e5,_0x1256ea){return function(_0x46909b){if(_0x46909b){var _0x267ee3=_0x46909b['count'],_0x93b2ae=_0x1256ea['offset'],_0x24e8f4=_0x1256ea[_0xe50a('0x2d')]+_0x1256ea[_0xe50a('0x2e')],_0x5a74b8;if(_0x24e8f4>=_0x267ee3){_0x24e8f4=_0x267ee3;_0x5a74b8=0xc8;}else{_0x5a74b8=0xce;}_0x2933e5['status'](_0x5a74b8);return _0x2933e5[_0xe50a('0x2f')](_0xe50a('0x30'),_0x93b2ae+'-'+_0x24e8f4+'/'+_0x267ee3)[_0xe50a('0x2c')](_0x46909b);}return null;};}function patchUpdates(_0x37f46f){return function(_0x3da649){try{jsonpatch[_0xe50a('0x31')](_0x3da649,_0x37f46f,!![]);}catch(_0x4c637a){return BPromise[_0xe50a('0x32')](_0x4c637a);}return _0x3da649[_0xe50a('0x33')]();};}function saveUpdates(_0x5e766a,_0x243e16){return function(_0x333fd3){if(_0x333fd3){return _0x333fd3[_0xe50a('0x34')](_0x5e766a)['then'](function(_0x5bc902){return _0x5bc902;});}return null;};}function removeEntity(_0x4f586d,_0x1c8fde){return function(_0x1f16b3){if(_0x1f16b3){return _0x1f16b3[_0xe50a('0x35')]()[_0xe50a('0x36')](function(){_0x4f586d['status'](0xcc)[_0xe50a('0x2b')]();});}};}function handleEntityNotFound(_0x179f95,_0x89b511){return function(_0x3c3bcd){if(!_0x3c3bcd){_0x179f95[_0xe50a('0x37')](0x194);}return _0x3c3bcd;};}function handleError(_0x4b3b7d,_0x3f14d9){_0x3f14d9=_0x3f14d9||0x1f4;return function(_0x3cc7c2){logger['error'](_0x3cc7c2[_0xe50a('0x38')]);if(_0x3cc7c2['name']){delete _0x3cc7c2[_0xe50a('0x39')];}_0x4b3b7d['status'](_0x3f14d9)[_0xe50a('0x3a')](_0x3cc7c2);};}exports['index']=function(_0x3dcd9a,_0x3d9d62){var _0x180b40={},_0x57fc00={},_0x5d2c5a={'count':0x0,'rows':[]};var _0x14adb0=_[_0xe50a('0x3b')](db[_0xe50a('0x3c')][_0xe50a('0x3d')],function(_0x125197){return{'name':_0x125197[_0xe50a('0x3e')],'type':_0x125197[_0xe50a('0x3f')]['key']};});_0x57fc00[_0xe50a('0x40')]=_[_0xe50a('0x3b')](_0x14adb0,_0xe50a('0x39'));_0x57fc00['query']=_[_0xe50a('0x41')](_0x3dcd9a[_0xe50a('0x42')]);_0x57fc00[_0xe50a('0x43')]=_['intersection'](_0x57fc00[_0xe50a('0x40')],_0x57fc00[_0xe50a('0x42')]);_0x180b40[_0xe50a('0x44')]=_[_0xe50a('0x45')](_0x57fc00[_0xe50a('0x40')],qs['fields'](_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x46')]));_0x180b40[_0xe50a('0x44')]=_0x180b40[_0xe50a('0x44')]['length']?_0x180b40[_0xe50a('0x44')]:_0x57fc00['model'];if(!_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x47')]('nolimit')){_0x180b40[_0xe50a('0x2e')]=qs[_0xe50a('0x2e')](_0x3dcd9a['query'][_0xe50a('0x2e')]);_0x180b40['offset']=qs[_0xe50a('0x2d')](_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x2d')]);}_0x180b40[_0xe50a('0x48')]=qs[_0xe50a('0x49')](_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x49')]);_0x180b40[_0xe50a('0x4a')]=qs[_0xe50a('0x43')](_[_0xe50a('0x4b')](_0x3dcd9a['query'],_0x57fc00['filters']),_0x14adb0);if(_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x4c')]){_0x180b40['where']=_[_0xe50a('0x4d')](_0x180b40[_0xe50a('0x4a')],{'$or':_[_0xe50a('0x3b')](_0x14adb0,function(_0x160a62){if(_0x160a62['type']!==_0xe50a('0x4e')){var _0x2f0317={};_0x2f0317[_0x160a62[_0xe50a('0x39')]]={'$like':'%'+_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x4c')]+'%'};return _0x2f0317;}})});}_0x180b40=_[_0xe50a('0x4d')]({},_0x180b40,_0x3dcd9a[_0xe50a('0x4f')]);var _0x3f1d47={'where':_0x180b40[_0xe50a('0x4a')]};return db[_0xe50a('0x3c')][_0xe50a('0x50')](_0x3f1d47)[_0xe50a('0x36')](function(_0x26e498){_0x5d2c5a[_0xe50a('0x50')]=_0x26e498;if(_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x51')]){_0x180b40['include']=[{'all':!![]}];}return db[_0xe50a('0x3c')][_0xe50a('0x52')](_0x180b40);})[_0xe50a('0x36')](function(_0x410747){_0x5d2c5a[_0xe50a('0x53')]=_0x410747;return _0x5d2c5a;})[_0xe50a('0x36')](respondWithFilteredResult(_0x3d9d62,_0x180b40))[_0xe50a('0x29')](handleError(_0x3d9d62,null));};exports[_0xe50a('0x54')]=function(_0x1fd64c,_0x399177){var _0x2eadc0={'raw':![],'where':{'id':_0x1fd64c[_0xe50a('0x55')]['id']}},_0x2158c1={};_0x2158c1['model']=_[_0xe50a('0x41')](db[_0xe50a('0x3c')]['rawAttributes']);_0x2158c1[_0xe50a('0x42')]=_[_0xe50a('0x41')](_0x1fd64c[_0xe50a('0x42')]);_0x2158c1[_0xe50a('0x43')]=_[_0xe50a('0x45')](_0x2158c1['model'],_0x2158c1[_0xe50a('0x42')]);_0x2eadc0[_0xe50a('0x44')]=_[_0xe50a('0x45')](_0x2158c1['model'],qs[_0xe50a('0x46')](_0x1fd64c[_0xe50a('0x42')]['fields']));_0x2eadc0[_0xe50a('0x44')]=_0x2eadc0[_0xe50a('0x44')][_0xe50a('0x56')]?_0x2eadc0[_0xe50a('0x44')]:_0x2158c1[_0xe50a('0x40')];if(_0x1fd64c[_0xe50a('0x42')][_0xe50a('0x51')]){_0x2eadc0['include']=[{'all':!![]}];}_0x2eadc0=_['merge']({},_0x2eadc0,_0x1fd64c[_0xe50a('0x4f')]);return db[_0xe50a('0x3c')]['find'](_0x2eadc0)[_0xe50a('0x36')](handleEntityNotFound(_0x399177,null))['then'](respondWithResult(_0x399177,null))['catch'](handleError(_0x399177,null));};exports['create']=function(_0x96cb48,_0x2ae5ec){return db[_0xe50a('0x3c')][_0xe50a('0x57')](_0x96cb48['body'],{})['then'](respondWithResult(_0x2ae5ec,0xc9))[_0xe50a('0x29')](handleError(_0x2ae5ec,null));};exports[_0xe50a('0x34')]=function(_0x55ccf6,_0x258134){if(_0x55ccf6[_0xe50a('0x58')]['id']){delete _0x55ccf6[_0xe50a('0x58')]['id'];}return db[_0xe50a('0x3c')]['find']({'where':{'id':_0x55ccf6[_0xe50a('0x55')]['id']}})[_0xe50a('0x36')](handleEntityNotFound(_0x258134,null))['then'](saveUpdates(_0x55ccf6[_0xe50a('0x58')],null))['then'](respondWithResult(_0x258134,null))[_0xe50a('0x29')](handleError(_0x258134,null));};exports[_0xe50a('0x35')]=function(_0x464f1b,_0x9dfb1d){return db[_0xe50a('0x3c')][_0xe50a('0x59')]({'where':{'id':_0x464f1b[_0xe50a('0x55')]['id']}})['then'](handleEntityNotFound(_0x9dfb1d,null))[_0xe50a('0x36')](removeEntity(_0x9dfb1d,null))[_0xe50a('0x29')](handleError(_0x9dfb1d,null));};exports['getConfigurations']=function(_0x1a2975,_0x173303,_0xcdbee5){var _0x396d73={};var _0x5c7618={};var _0x1312b8;var _0x22deb1;return db[_0xe50a('0x3c')]['findOne']({'where':{'id':_0x1a2975[_0xe50a('0x55')]['id']}})[_0xe50a('0x36')](handleEntityNotFound(_0x173303,null))[_0xe50a('0x36')](function(_0x172470){if(_0x172470){_0x1312b8=_0x172470;_0x5c7618[_0xe50a('0x40')]=_[_0xe50a('0x41')](db[_0xe50a('0x5a')][_0xe50a('0x3d')]);_0x5c7618['query']=_[_0xe50a('0x41')](_0x1a2975[_0xe50a('0x42')]);_0x5c7618['filters']=_[_0xe50a('0x45')](_0x5c7618[_0xe50a('0x40')],_0x5c7618['query']);_0x396d73[_0xe50a('0x44')]=_['intersection'](_0x5c7618[_0xe50a('0x40')],qs[_0xe50a('0x46')](_0x1a2975[_0xe50a('0x42')][_0xe50a('0x46')]));_0x396d73[_0xe50a('0x44')]=_0x396d73[_0xe50a('0x44')][_0xe50a('0x56')]?_0x396d73['attributes']:_0x5c7618[_0xe50a('0x40')];_0x396d73['order']=qs[_0xe50a('0x49')](_0x1a2975[_0xe50a('0x42')][_0xe50a('0x49')]);_0x396d73[_0xe50a('0x4a')]=qs['filters'](_[_0xe50a('0x4b')](_0x1a2975[_0xe50a('0x42')],_0x5c7618[_0xe50a('0x43')]));if(_0x1a2975[_0xe50a('0x42')][_0xe50a('0x4c')]){_0x396d73[_0xe50a('0x4a')]=_[_0xe50a('0x4d')](_0x396d73[_0xe50a('0x4a')],{'$or':_['map'](_0x396d73['attributes'],function(_0x595575){var _0xdb467a={};_0xdb467a[_0x595575]={'$like':'%'+_0x1a2975[_0xe50a('0x42')][_0xe50a('0x4c')]+'%'};return _0xdb467a;})});}_0x396d73=_['merge']({},_0x396d73,_0x1a2975[_0xe50a('0x4f')]);return _0x1312b8['getConfigurations'](_0x396d73);}})[_0xe50a('0x36')](function(_0x306766){if(_0x306766){_0x22deb1=_0x306766['length'];if(!_0x1a2975['query'][_0xe50a('0x47')](_0xe50a('0x5b'))){_0x396d73['limit']=qs[_0xe50a('0x2e')](_0x1a2975[_0xe50a('0x42')][_0xe50a('0x2e')]);_0x396d73[_0xe50a('0x2d')]=qs['offset'](_0x1a2975['query'][_0xe50a('0x2d')]);}return _0x1312b8[_0xe50a('0x5c')](_0x396d73);}})[_0xe50a('0x36')](function(_0x550bcc){if(_0x550bcc){return _0x550bcc?{'count':_0x22deb1,'rows':_0x550bcc}:null;}})[_0xe50a('0x36')](respondWithResult(_0x173303,null))[_0xe50a('0x29')](handleError(_0x173303,null));};exports[_0xe50a('0x5d')]=function(_0x210142,_0x20f75e,_0xd0886f){if(_0x210142['body']['id']){delete _0x210142[_0xe50a('0x58')]['id'];}return db[_0xe50a('0x3c')]['findOne']({'where':{'id':_0x210142[_0xe50a('0x55')]['id']}})[_0xe50a('0x36')](handleEntityNotFound(_0x20f75e,null))[_0xe50a('0x36')](function(_0x5d8533){if(_0x5d8533){_0x210142[_0xe50a('0x58')]['AccountId']=_0x5d8533['id'];_0x210142['body']['Subjects']=integrations[_0xe50a('0x5e')](_0x210142[_0xe50a('0x58')]['channel'],_0x210142[_0xe50a('0x58')]['type']);_0x210142['body']['Descriptions']=integrations['getDescriptions'](_0x210142[_0xe50a('0x58')][_0xe50a('0x5f')],_0x210142[_0xe50a('0x58')]['type']);return db[_0xe50a('0x5a')][_0xe50a('0x57')](_0x210142['body'],{'include':[{'model':db[_0xe50a('0x60')],'as':_0xe50a('0x61')},{'model':db[_0xe50a('0x60')],'as':_0xe50a('0x62')}]});}return null;})[_0xe50a('0x36')](respondWithResult(_0x20f75e,null))[_0xe50a('0x29')](handleError(_0x20f75e,null));};var md5=require('md5');exports[_0xe50a('0x63')]=function(_0x453974,_0x51c3c5,_0x55dd5c){var _0x1fb3f6=null;var _0x70b9f1=null;var _0x1af09e=null;var _0x3f1723=null;var _0xb2b98c='';return db[_0xe50a('0x3c')]['findOne']({'where':{'id':_0x453974[_0xe50a('0x55')]['id']},'attributes':['id',_0xe50a('0x39'),'username',_0xe50a('0x64'),_0xe50a('0x65'),_0xe50a('0x66'),_0xe50a('0x67'),_0xe50a('0x68')]})['then'](handleEntityNotFound(_0x51c3c5,null))[_0xe50a('0x36')](function(_0x300b9f){if(_0x300b9f){_0x1fb3f6=_0x300b9f[_0xe50a('0x69')];_0x70b9f1=_0x300b9f['accessKey'];_0x1af09e=_0x300b9f[_0xe50a('0x65')];_0xb2b98c=_0x300b9f['remoteUri'];var _0x3b8ea3=_0xb2b98c[_0xe50a('0x6a')](-0x1);if(_0x3b8ea3==='/'){_0xb2b98c=_0xb2b98c['substring'](0x0,_0xb2b98c[_0xe50a('0x6b')](_0x3b8ea3));}_0x3f1723=util[_0xe50a('0x6c')]('%s/webservice.php',_0xb2b98c);var _0x56b998={'method':_0xe50a('0x6d'),'uri':_0x3f1723,'qs':{'operation':'getchallenge','username':_0x300b9f['username']},'json':!![]};return rp(_0x56b998);}})['then'](function(_0x5d904b){if(_0x5d904b['success']){var _0x56befb={'method':_0xe50a('0x6e'),'uri':_0x3f1723,'form':{'operation':_0xe50a('0x6f'),'username':_0x1fb3f6,'accessKey':md5(_0x5d904b[_0xe50a('0x28')]['token']+_0x70b9f1)},'json':!![]};return rp(_0x56befb);}})['then'](function(_0x55f58f){if(_0x55f58f[_0xe50a('0x70')]){var _0x3a22f2={'method':_0xe50a('0x6d'),'uri':_0x3f1723,'qs':{'operation':_0xe50a('0x71'),'username':_0x1fb3f6,'sessionName':_0x55f58f[_0xe50a('0x28')][_0xe50a('0x72')],'elementType':_0x1af09e},'json':!![]};return rp(_0x3a22f2);}})[_0xe50a('0x36')](function(_0x59a36a){if(_0x59a36a[_0xe50a('0x70')]){var _0x5aa210=[_0xe50a('0x73'),_0xe50a('0x74'),_0xe50a('0x75')];_[_0xe50a('0x76')](_0x59a36a[_0xe50a('0x28')][_0xe50a('0x46')],function(_0x1098a5){return _0x5aa210[_0xe50a('0x77')](_0x1098a5[_0xe50a('0x3f')][_0xe50a('0x39')]);});_[_0xe50a('0x76')](_0x59a36a['result'][_0xe50a('0x46')],function(_0x4667a7){return _0x4667a7[_0xe50a('0x78')]===_0xe50a('0x79');});return{'count':_0x59a36a['result'][_0xe50a('0x46')][_0xe50a('0x56')],'rows':_[_0xe50a('0x3b')](_0x59a36a[_0xe50a('0x28')]['fields'],function(_0x548dce){return{'id':_0x548dce['name'],'name':_0x548dce[_0xe50a('0x7a')],'custom':_[_0xe50a('0x7b')](_0x548dce['name'],_0xe50a('0x7c'))?!![]:![],'options':_0x548dce[_0xe50a('0x3f')][_0xe50a('0x39')]===_0xe50a('0x7d')&&_0x548dce['type'][_0xe50a('0x7e')]['length']>0x0?_[_0xe50a('0x3b')](_0x548dce[_0xe50a('0x3f')]['picklistValues'],function(_0x36d198){return{'name':_0x36d198['label'],'value':_0x36d198['value']};}):[]};})};}})['then'](respondWithResult(_0x51c3c5,null))[_0xe50a('0x29')](function(_0x436261){console[_0xe50a('0x7f')](_0xe50a('0x80')+_0x436261);var _0x120e9a=_0x453974[_0xe50a('0x42')][_0xe50a('0x1a')]?0x1f4:_0x436261['statusCode']||0x1f4;logger[_0xe50a('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xe50a('0x63'),_0x120e9a,JSON[_0xe50a('0x24')](_0x436261));delete _0x436261['name'];if(_0x120e9a===0x191){_0x120e9a=0x190;}_0x51c3c5[_0xe50a('0x2a')](_0x120e9a)[_0xe50a('0x3a')](_0x453974['query']['test']?{'message':_0xe50a('0x81'),'statusCode':_0x436261[_0xe50a('0x82')]}:_0x436261);});}; \ No newline at end of file +var _0x0a27=['bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','catch','params','fields','find','create','body','getConfigurations','findOne','VtigerConfiguration','filter','addConfiguration','AccountId','getSubjects','channel','type','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0xae4dec,_0x4bc635){var _0x36a0a9=function(_0x181e11){while(--_0x181e11){_0xae4dec['push'](_0xae4dec['shift']());}};_0x36a0a9(++_0x4bc635);}(_0x0a27,0xf9));var _0x70a2=function(_0x5bf234,_0x19ba4a){_0x5bf234=_0x5bf234-0x0;var _0x5d6144=_0x0a27[_0x5bf234];return _0x5d6144;};'use strict';var pdf=require(_0x70a2('0x0'));var emlformat=require(_0x70a2('0x1'));var rimraf=require(_0x70a2('0x2'));var zipdir=require(_0x70a2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70a2('0x4'));var moment=require('moment');var BPromise=require(_0x70a2('0x5'));var Mustache=require('mustache');var util=require(_0x70a2('0x6'));var path=require(_0x70a2('0x7'));var sox=require(_0x70a2('0x8'));var csv=require(_0x70a2('0x9'));var ejs=require(_0x70a2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70a2('0xb'));var crypto=require(_0x70a2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70a2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70a2('0xe'));var Papa=require('papaparse');var Redis=require(_0x70a2('0xf'));var authService=require(_0x70a2('0x10'));var qs=require(_0x70a2('0x11'));var as=require(_0x70a2('0x12'));var hardwareService=require(_0x70a2('0x13'));var logger=require(_0x70a2('0x14'))(_0x70a2('0x15'));var utils=require(_0x70a2('0x16'));var config=require('../../config/environment');var db=require(_0x70a2('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x70a2('0x18'));var client=jayson['client'][_0x70a2('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5ebbbd,_0x172813,_0x5a669f){if(_0x5a669f){var _0x5445bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5445bd['test'](_0x172813)){return _0x5ebbbd;}else{throw new db['Sequelize'][(_0x70a2('0x1a'))](_0x70a2('0x1b'));}}else{return _0x5ebbbd;}}function respondWithRpcPromise(_0x49f56e,_0x1a554f,_0xe22caf,_0xe08bc3){return new BPromise(function(_0x17ac5a,_0x808c24){var _0x882844=_0xe08bc3||client;return _0x882844[_0x70a2('0x1c')](_0x49f56e,_0xe22caf)[_0x70a2('0x1d')](function(_0x416acd){logger['info'](_0x70a2('0x1e'),_0x1a554f,_0x70a2('0x1f'));logger[_0x70a2('0x20')](_0x70a2('0x21'),_0x1a554f,_0x70a2('0x1f'),JSON[_0x70a2('0x22')](_0x416acd));if(_0x416acd[_0x70a2('0x23')]){if(_0x416acd['error'][_0x70a2('0x24')]===0x1f4){logger['error'](_0x70a2('0x1e'),_0x1a554f,_0x416acd['error'][_0x70a2('0x25')]);return _0x808c24(_0x416acd[_0x70a2('0x23')][_0x70a2('0x25')]);}logger[_0x70a2('0x23')](_0x70a2('0x1e'),_0x1a554f,_0x416acd['error'][_0x70a2('0x25')]);return _0x17ac5a(_0x416acd['error'][_0x70a2('0x25')]);}else{logger['info'](_0x70a2('0x1e'),_0x1a554f,_0x70a2('0x1f'));_0x17ac5a(_0x416acd[_0x70a2('0x26')][_0x70a2('0x25')]);}})['catch'](function(_0xed4c1a){logger[_0x70a2('0x23')](_0x70a2('0x1e'),_0x1a554f,_0xed4c1a);_0x808c24(_0xed4c1a);});});}function respondWithStatusCode(_0x345846,_0x3fa5fe){_0x3fa5fe=_0x3fa5fe||0xcc;return function(_0x28e477){if(_0x28e477){return _0x345846[_0x70a2('0x27')](_0x3fa5fe);}return _0x345846[_0x70a2('0x28')](_0x3fa5fe)[_0x70a2('0x29')]();};}function respondWithResult(_0x2d8f68,_0x4faa44){_0x4faa44=_0x4faa44||0xc8;return function(_0x38519a){if(_0x38519a){return _0x2d8f68['status'](_0x4faa44)[_0x70a2('0x2a')](_0x38519a);}};}function respondWithFilteredResult(_0x5e0386,_0x4642fb){return function(_0x32e4f3){if(_0x32e4f3){var _0x55cd5c=_0x32e4f3[_0x70a2('0x2b')],_0x3eec3e=_0x4642fb[_0x70a2('0x2c')],_0x4e4c56=_0x4642fb[_0x70a2('0x2c')]+_0x4642fb['limit'],_0x188407;if(_0x4e4c56>=_0x55cd5c){_0x4e4c56=_0x55cd5c;_0x188407=0xc8;}else{_0x188407=0xce;}_0x5e0386['status'](_0x188407);return _0x5e0386[_0x70a2('0x2d')](_0x70a2('0x2e'),_0x3eec3e+'-'+_0x4e4c56+'/'+_0x55cd5c)[_0x70a2('0x2a')](_0x32e4f3);}return null;};}function patchUpdates(_0x498dec){return function(_0xab66a4){try{jsonpatch['apply'](_0xab66a4,_0x498dec,!![]);}catch(_0x5cb737){return BPromise[_0x70a2('0x2f')](_0x5cb737);}return _0xab66a4[_0x70a2('0x30')]();};}function saveUpdates(_0x389fb7,_0x12f107){return function(_0x519c24){if(_0x519c24){return _0x519c24[_0x70a2('0x31')](_0x389fb7)[_0x70a2('0x1d')](function(_0x1337bb){return _0x1337bb;});}return null;};}function removeEntity(_0x40f40c,_0x5f0845){return function(_0x40ed3e){if(_0x40ed3e){return _0x40ed3e[_0x70a2('0x32')]()['then'](function(){_0x40f40c['status'](0xcc)[_0x70a2('0x29')]();});}};}function handleEntityNotFound(_0x4f1d42,_0x26458b){return function(_0x15aace){if(!_0x15aace){_0x4f1d42[_0x70a2('0x27')](0x194);}return _0x15aace;};}function handleError(_0x93f238,_0x4d9419){_0x4d9419=_0x4d9419||0x1f4;return function(_0x2c5f52){logger[_0x70a2('0x23')](_0x2c5f52['stack']);if(_0x2c5f52[_0x70a2('0x33')]){delete _0x2c5f52['name'];}_0x93f238[_0x70a2('0x28')](_0x4d9419)[_0x70a2('0x34')](_0x2c5f52);};}exports[_0x70a2('0x35')]=function(_0x5781a4,_0x289a39){var _0x56eaae={},_0x2ef374={},_0x7ea383={'count':0x0,'rows':[]};var _0x33f1db=_[_0x70a2('0x36')](db[_0x70a2('0x37')][_0x70a2('0x38')],function(_0x377e0b){return{'name':_0x377e0b[_0x70a2('0x39')],'type':_0x377e0b['type'][_0x70a2('0x3a')]};});_0x2ef374[_0x70a2('0x3b')]=_['map'](_0x33f1db,_0x70a2('0x33'));_0x2ef374[_0x70a2('0x3c')]=_[_0x70a2('0x3d')](_0x5781a4[_0x70a2('0x3c')]);_0x2ef374['filters']=_[_0x70a2('0x3e')](_0x2ef374[_0x70a2('0x3b')],_0x2ef374[_0x70a2('0x3c')]);_0x56eaae[_0x70a2('0x3f')]=_[_0x70a2('0x3e')](_0x2ef374[_0x70a2('0x3b')],qs['fields'](_0x5781a4[_0x70a2('0x3c')]['fields']));_0x56eaae[_0x70a2('0x3f')]=_0x56eaae['attributes'][_0x70a2('0x40')]?_0x56eaae['attributes']:_0x2ef374['model'];if(!_0x5781a4[_0x70a2('0x3c')][_0x70a2('0x41')]('nolimit')){_0x56eaae[_0x70a2('0x42')]=qs[_0x70a2('0x42')](_0x5781a4[_0x70a2('0x3c')]['limit']);_0x56eaae[_0x70a2('0x2c')]=qs[_0x70a2('0x2c')](_0x5781a4[_0x70a2('0x3c')][_0x70a2('0x2c')]);}_0x56eaae[_0x70a2('0x43')]=qs[_0x70a2('0x44')](_0x5781a4[_0x70a2('0x3c')][_0x70a2('0x44')]);_0x56eaae[_0x70a2('0x45')]=qs[_0x70a2('0x46')](_[_0x70a2('0x47')](_0x5781a4['query'],_0x2ef374['filters']),_0x33f1db);if(_0x5781a4[_0x70a2('0x3c')]['filter']){_0x56eaae['where']=_[_0x70a2('0x48')](_0x56eaae[_0x70a2('0x45')],{'$or':_['map'](_0x33f1db,function(_0x3cff42){if(_0x3cff42['type']!==_0x70a2('0x49')){var _0xd9a737={};_0xd9a737[_0x3cff42[_0x70a2('0x33')]]={'$like':'%'+_0x5781a4[_0x70a2('0x3c')]['filter']+'%'};return _0xd9a737;}})});}_0x56eaae=_[_0x70a2('0x48')]({},_0x56eaae,_0x5781a4[_0x70a2('0x4a')]);var _0x44779b={'where':_0x56eaae[_0x70a2('0x45')]};return db[_0x70a2('0x37')][_0x70a2('0x2b')](_0x44779b)[_0x70a2('0x1d')](function(_0x1dace6){_0x7ea383['count']=_0x1dace6;if(_0x5781a4['query'][_0x70a2('0x4b')]){_0x56eaae[_0x70a2('0x4c')]=[{'all':!![]}];}return db[_0x70a2('0x37')]['findAll'](_0x56eaae);})['then'](function(_0x145803){_0x7ea383['rows']=_0x145803;return _0x7ea383;})[_0x70a2('0x1d')](respondWithFilteredResult(_0x289a39,_0x56eaae))[_0x70a2('0x4d')](handleError(_0x289a39,null));};exports['show']=function(_0x49c1f5,_0xa48f5c){var _0x1d7a7e={'raw':![],'where':{'id':_0x49c1f5[_0x70a2('0x4e')]['id']}},_0x1c16ac={};_0x1c16ac[_0x70a2('0x3b')]=_[_0x70a2('0x3d')](db[_0x70a2('0x37')][_0x70a2('0x38')]);_0x1c16ac['query']=_[_0x70a2('0x3d')](_0x49c1f5['query']);_0x1c16ac['filters']=_[_0x70a2('0x3e')](_0x1c16ac[_0x70a2('0x3b')],_0x1c16ac[_0x70a2('0x3c')]);_0x1d7a7e['attributes']=_['intersection'](_0x1c16ac[_0x70a2('0x3b')],qs[_0x70a2('0x4f')](_0x49c1f5[_0x70a2('0x3c')][_0x70a2('0x4f')]));_0x1d7a7e[_0x70a2('0x3f')]=_0x1d7a7e[_0x70a2('0x3f')][_0x70a2('0x40')]?_0x1d7a7e[_0x70a2('0x3f')]:_0x1c16ac[_0x70a2('0x3b')];if(_0x49c1f5['query'][_0x70a2('0x4b')]){_0x1d7a7e[_0x70a2('0x4c')]=[{'all':!![]}];}_0x1d7a7e=_[_0x70a2('0x48')]({},_0x1d7a7e,_0x49c1f5[_0x70a2('0x4a')]);return db[_0x70a2('0x37')][_0x70a2('0x50')](_0x1d7a7e)['then'](handleEntityNotFound(_0xa48f5c,null))[_0x70a2('0x1d')](respondWithResult(_0xa48f5c,null))['catch'](handleError(_0xa48f5c,null));};exports[_0x70a2('0x51')]=function(_0x4d7120,_0x522900){return db['VtigerAccount'][_0x70a2('0x51')](_0x4d7120['body'],{})[_0x70a2('0x1d')](respondWithResult(_0x522900,0xc9))['catch'](handleError(_0x522900,null));};exports[_0x70a2('0x31')]=function(_0x58963a,_0x468f48){if(_0x58963a[_0x70a2('0x52')]['id']){delete _0x58963a[_0x70a2('0x52')]['id'];}return db[_0x70a2('0x37')][_0x70a2('0x50')]({'where':{'id':_0x58963a[_0x70a2('0x4e')]['id']}})[_0x70a2('0x1d')](handleEntityNotFound(_0x468f48,null))[_0x70a2('0x1d')](saveUpdates(_0x58963a[_0x70a2('0x52')],null))[_0x70a2('0x1d')](respondWithResult(_0x468f48,null))[_0x70a2('0x4d')](handleError(_0x468f48,null));};exports[_0x70a2('0x32')]=function(_0x3e093e,_0x3bf735){return db[_0x70a2('0x37')]['find']({'where':{'id':_0x3e093e[_0x70a2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3bf735,null))['then'](removeEntity(_0x3bf735,null))[_0x70a2('0x4d')](handleError(_0x3bf735,null));};exports[_0x70a2('0x53')]=function(_0x4d4474,_0x4c45e5,_0x2f2d35){var _0x499b15={};var _0x116703={};var _0x1f9181;var _0x1f9b96;return db[_0x70a2('0x37')][_0x70a2('0x54')]({'where':{'id':_0x4d4474['params']['id']}})[_0x70a2('0x1d')](handleEntityNotFound(_0x4c45e5,null))[_0x70a2('0x1d')](function(_0x1aa6a8){if(_0x1aa6a8){_0x1f9181=_0x1aa6a8;_0x116703[_0x70a2('0x3b')]=_[_0x70a2('0x3d')](db[_0x70a2('0x55')][_0x70a2('0x38')]);_0x116703[_0x70a2('0x3c')]=_['keys'](_0x4d4474['query']);_0x116703['filters']=_[_0x70a2('0x3e')](_0x116703[_0x70a2('0x3b')],_0x116703[_0x70a2('0x3c')]);_0x499b15['attributes']=_[_0x70a2('0x3e')](_0x116703[_0x70a2('0x3b')],qs[_0x70a2('0x4f')](_0x4d4474[_0x70a2('0x3c')][_0x70a2('0x4f')]));_0x499b15[_0x70a2('0x3f')]=_0x499b15[_0x70a2('0x3f')][_0x70a2('0x40')]?_0x499b15[_0x70a2('0x3f')]:_0x116703[_0x70a2('0x3b')];_0x499b15[_0x70a2('0x43')]=qs[_0x70a2('0x44')](_0x4d4474[_0x70a2('0x3c')][_0x70a2('0x44')]);_0x499b15[_0x70a2('0x45')]=qs[_0x70a2('0x46')](_[_0x70a2('0x47')](_0x4d4474['query'],_0x116703['filters']));if(_0x4d4474[_0x70a2('0x3c')][_0x70a2('0x56')]){_0x499b15[_0x70a2('0x45')]=_[_0x70a2('0x48')](_0x499b15[_0x70a2('0x45')],{'$or':_['map'](_0x499b15['attributes'],function(_0x580e3c){var _0x459e6c={};_0x459e6c[_0x580e3c]={'$like':'%'+_0x4d4474[_0x70a2('0x3c')][_0x70a2('0x56')]+'%'};return _0x459e6c;})});}_0x499b15=_[_0x70a2('0x48')]({},_0x499b15,_0x4d4474['options']);return _0x1f9181[_0x70a2('0x53')](_0x499b15);}})[_0x70a2('0x1d')](function(_0x477525){if(_0x477525){_0x1f9b96=_0x477525[_0x70a2('0x40')];if(!_0x4d4474[_0x70a2('0x3c')][_0x70a2('0x41')]('nolimit')){_0x499b15['limit']=qs[_0x70a2('0x42')](_0x4d4474['query'][_0x70a2('0x42')]);_0x499b15['offset']=qs['offset'](_0x4d4474[_0x70a2('0x3c')][_0x70a2('0x2c')]);}return _0x1f9181[_0x70a2('0x53')](_0x499b15);}})['then'](function(_0x3ecf19){if(_0x3ecf19){return _0x3ecf19?{'count':_0x1f9b96,'rows':_0x3ecf19}:null;}})[_0x70a2('0x1d')](respondWithResult(_0x4c45e5,null))[_0x70a2('0x4d')](handleError(_0x4c45e5,null));};exports[_0x70a2('0x57')]=function(_0x3056fe,_0x51bc9e,_0x8cb961){if(_0x3056fe[_0x70a2('0x52')]['id']){delete _0x3056fe['body']['id'];}return db['VtigerAccount'][_0x70a2('0x54')]({'where':{'id':_0x3056fe['params']['id']}})[_0x70a2('0x1d')](handleEntityNotFound(_0x51bc9e,null))[_0x70a2('0x1d')](function(_0x66e3f1){if(_0x66e3f1){_0x3056fe['body'][_0x70a2('0x58')]=_0x66e3f1['id'];_0x3056fe[_0x70a2('0x52')]['Subjects']=integrations[_0x70a2('0x59')](_0x3056fe[_0x70a2('0x52')][_0x70a2('0x5a')],_0x3056fe[_0x70a2('0x52')][_0x70a2('0x5b')]);_0x3056fe[_0x70a2('0x52')]['Descriptions']=integrations[_0x70a2('0x5c')](_0x3056fe['body']['channel'],_0x3056fe['body'][_0x70a2('0x5b')]);return db[_0x70a2('0x55')][_0x70a2('0x51')](_0x3056fe[_0x70a2('0x52')],{'include':[{'model':db[_0x70a2('0x5d')],'as':_0x70a2('0x5e')},{'model':db[_0x70a2('0x5d')],'as':'Descriptions'}]});}return null;})[_0x70a2('0x1d')](respondWithResult(_0x51bc9e,null))['catch'](handleError(_0x51bc9e,null));};var md5=require(_0x70a2('0x5f'));exports[_0x70a2('0x60')]=function(_0x4367a3,_0x2c7202,_0x2468e9){var _0x41c962=null;var _0x22e297=null;var _0xa0c09a=null;var _0x322a9a=null;var _0x3ac4c5='';return db[_0x70a2('0x37')][_0x70a2('0x54')]({'where':{'id':_0x4367a3[_0x70a2('0x4e')]['id']},'attributes':['id',_0x70a2('0x33'),_0x70a2('0x61'),_0x70a2('0x62'),_0x70a2('0x63'),_0x70a2('0x64'),_0x70a2('0x65'),'accessKey']})['then'](handleEntityNotFound(_0x2c7202,null))[_0x70a2('0x1d')](function(_0x2f3e1d){if(_0x2f3e1d){_0x41c962=_0x2f3e1d['username'];_0x22e297=_0x2f3e1d['accessKey'];_0xa0c09a=_0x2f3e1d['moduleName'];_0x3ac4c5=_0x2f3e1d[_0x70a2('0x64')];var _0x313d00=_0x3ac4c5[_0x70a2('0x66')](-0x1);if(_0x313d00==='/'){_0x3ac4c5=_0x3ac4c5[_0x70a2('0x67')](0x0,_0x3ac4c5['lastIndexOf'](_0x313d00));}_0x322a9a=util[_0x70a2('0x68')](_0x70a2('0x69'),_0x3ac4c5);var _0x1cac20={'method':_0x70a2('0x6a'),'uri':_0x322a9a,'qs':{'operation':_0x70a2('0x6b'),'username':_0x2f3e1d[_0x70a2('0x61')]},'json':!![]};return rp(_0x1cac20);}})[_0x70a2('0x1d')](function(_0x3ec175){if(_0x3ec175[_0x70a2('0x6c')]){var _0x3063c0={'method':_0x70a2('0x6d'),'uri':_0x322a9a,'form':{'operation':_0x70a2('0x6e'),'username':_0x41c962,'accessKey':md5(_0x3ec175[_0x70a2('0x26')][_0x70a2('0x6f')]+_0x22e297)},'json':!![]};return rp(_0x3063c0);}})[_0x70a2('0x1d')](function(_0x2a769e){if(_0x2a769e[_0x70a2('0x6c')]){var _0x4d7222={'method':_0x70a2('0x6a'),'uri':_0x322a9a,'qs':{'operation':'describe','username':_0x41c962,'sessionName':_0x2a769e[_0x70a2('0x26')]['sessionName'],'elementType':_0xa0c09a},'json':!![]};return rp(_0x4d7222);}})[_0x70a2('0x1d')](function(_0x2b128b){if(_0x2b128b[_0x70a2('0x6c')]){var _0xad2bca=[_0x70a2('0x70'),_0x70a2('0x71'),_0x70a2('0x72')];_[_0x70a2('0x73')](_0x2b128b['result']['fields'],function(_0x35f825){return _0xad2bca[_0x70a2('0x74')](_0x35f825[_0x70a2('0x5b')][_0x70a2('0x33')]);});_['remove'](_0x2b128b[_0x70a2('0x26')]['fields'],function(_0x4018ca){return _0x4018ca[_0x70a2('0x75')]===_0x70a2('0x76');});return{'count':_0x2b128b[_0x70a2('0x26')][_0x70a2('0x4f')]['length'],'rows':_['map'](_0x2b128b[_0x70a2('0x26')][_0x70a2('0x4f')],function(_0x47b11a){return{'id':_0x47b11a[_0x70a2('0x33')],'name':_0x47b11a[_0x70a2('0x77')],'custom':_[_0x70a2('0x78')](_0x47b11a[_0x70a2('0x33')],'cf_')?!![]:![],'options':_0x47b11a['type']['name']==='picklist'&&_0x47b11a['type'][_0x70a2('0x79')][_0x70a2('0x40')]>0x0?_[_0x70a2('0x36')](_0x47b11a[_0x70a2('0x5b')][_0x70a2('0x79')],function(_0x2a06e6){return{'name':_0x2a06e6[_0x70a2('0x77')],'value':_0x2a06e6['value']};}):[]};})};}})['then'](respondWithResult(_0x2c7202,null))['catch'](function(_0x36e7d7){console[_0x70a2('0x7a')](_0x70a2('0x7b')+_0x36e7d7);var _0x1d450c=_0x4367a3[_0x70a2('0x3c')][_0x70a2('0x7c')]?0x1f4:_0x36e7d7[_0x70a2('0x7d')]||0x1f4;logger[_0x70a2('0x23')](_0x70a2('0x7e'),_0x70a2('0x60'),_0x1d450c,JSON[_0x70a2('0x22')](_0x36e7d7));delete _0x36e7d7[_0x70a2('0x33')];if(_0x1d450c===0x191){_0x1d450c=0x190;}_0x2c7202[_0x70a2('0x28')](_0x1d450c)['send'](_0x4367a3[_0x70a2('0x3c')][_0x70a2('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x36e7d7[_0x70a2('0x7d')]}:_0x36e7d7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 74a4e45..6683b67 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 _0x7a79=['int_vtiger_accounts','lodash','util','api','moment','request-promise','path','../../config/environment','./intVtigerAccount.attributes','VtigerAccount'];(function(_0x27a3c5,_0x3823de){var _0x52d7fc=function(_0x56f33e){while(--_0x56f33e){_0x27a3c5['push'](_0x27a3c5['shift']());}};_0x52d7fc(++_0x3823de);}(_0x7a79,0x187));var _0x97a7=function(_0xe24841,_0x2c0f66){_0xe24841=_0xe24841-0x0;var _0x2e41b3=_0x7a79[_0xe24841];return _0x2e41b3;};'use strict';var _=require(_0x97a7('0x0'));var util=require(_0x97a7('0x1'));var logger=require('../../config/logger')(_0x97a7('0x2'));var moment=require(_0x97a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x97a7('0x4'));var fs=require('fs');var path=require(_0x97a7('0x5'));var rimraf=require('rimraf');var config=require(_0x97a7('0x6'));var attributes=require(_0x97a7('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x8ff1e6,_0xc319f3){return _0x8ff1e6['define'](_0x97a7('0x8'),attributes,{'tableName':_0x97a7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x209c=['./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1fca6c,_0x2bbb55){var _0x4583de=function(_0x3cba69){while(--_0x3cba69){_0x1fca6c['push'](_0x1fca6c['shift']());}};_0x4583de(++_0x2bbb55);}(_0x209c,0xf4));var _0xc209=function(_0x1a4798,_0x36e48f){_0x1a4798=_0x1a4798-0x0;var _0x12bc9d=_0x209c[_0x1a4798];return _0x12bc9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc209('0x0'))(_0xc209('0x1'));var moment=require(_0xc209('0x2'));var BPromise=require(_0xc209('0x3'));var rp=require(_0xc209('0x4'));var fs=require('fs');var path=require(_0xc209('0x5'));var rimraf=require(_0xc209('0x6'));var config=require(_0xc209('0x7'));var attributes=require(_0xc209('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc209('0x9')]=function(_0x111ae7,_0x3b7960){return _0x111ae7['define'](_0xc209('0xa'),attributes,{'tableName':_0xc209('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 8f6948f..22a634b 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 _0x3c65=['request','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','include','map','model','attributes','then','debug','ShowVtigerAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3c65,0x1a4));var _0x53c6=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x3c65[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x53c6('0x0'));var util=require('util');var moment=require(_0x53c6('0x1'));var BPromise=require(_0x53c6('0x2'));var rs=require(_0x53c6('0x3'));var fs=require('fs');var Redis=require(_0x53c6('0x4'));var db=require(_0x53c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53c6('0x6'))(_0x53c6('0x7'));var config=require(_0x53c6('0x8'));var jayson=require(_0x53c6('0x9'));var client=jayson[_0x53c6('0xa')][_0x53c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x577574,_0x5bf127,_0x57924b){return new BPromise(function(_0x45e719,_0x116b2a){return client[_0x53c6('0xc')](_0x577574,_0x57924b)['then'](function(_0x2a0c59){logger['info'](_0x53c6('0xd'),_0x5bf127,_0x53c6('0xe'));logger['debug'](_0x53c6('0xf'),_0x5bf127,_0x53c6('0xe'),JSON[_0x53c6('0x10')](_0x2a0c59));if(_0x2a0c59[_0x53c6('0x11')]){if(_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x12')]===0x1f4){logger[_0x53c6('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5bf127,_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);return _0x116b2a(_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);}logger['error'](_0x53c6('0xd'),_0x5bf127,_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);return _0x45e719(_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);}else{logger[_0x53c6('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x5bf127,'request\x20sent');_0x45e719(_0x2a0c59[_0x53c6('0x15')]['message']);}})[_0x53c6('0x16')](function(_0x33859e){logger[_0x53c6('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5bf127,_0x33859e);_0x116b2a(_0x33859e);});});}exports[_0x53c6('0x17')]=function(_0x59ffc3){var _0x1b6d66=this;return new Promise(function(_0xc0e3b4,_0x40e45a){return db[_0x53c6('0x18')][_0x53c6('0x19')]({'raw':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')][_0x53c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3['options']['where']||null:null,'attributes':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')]['attributes']||null:null,'limit':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')]['limit']||null:null,'include':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')][_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x59ffc3['options']['include'],function(_0x2882eb){return{'model':db[_0x2882eb[_0x53c6('0x1e')]],'as':_0x2882eb['as'],'attributes':_0x2882eb[_0x53c6('0x1f')],'include':_0x2882eb[_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x2882eb[_0x53c6('0x1c')],function(_0x49f9ad){return{'model':db[_0x49f9ad[_0x53c6('0x1e')]],'as':_0x49f9ad['as'],'attributes':_0x49f9ad[_0x53c6('0x1f')],'include':_0x49f9ad[_0x53c6('0x1c')]?_['map'](_0x49f9ad[_0x53c6('0x1c')],function(_0xd45dfd){return{'model':db[_0xd45dfd[_0x53c6('0x1e')]],'as':_0xd45dfd['as'],'attributes':_0xd45dfd[_0x53c6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x53c6('0x20')](function(_0x5f36aa){logger[_0x53c6('0x14')](_0x53c6('0x17'),_0x59ffc3);logger[_0x53c6('0x21')]('GetVtigerAccount',_0x59ffc3,JSON[_0x53c6('0x10')](_0x5f36aa));_0xc0e3b4(_0x5f36aa);})[_0x53c6('0x16')](function(_0x49a652){logger['error']('GetVtigerAccount',_0x49a652[_0x53c6('0x13')],_0x59ffc3);_0x40e45a(_0x1b6d66[_0x53c6('0x11')](0x1f4,_0x49a652[_0x53c6('0x13')]));});});};exports[_0x53c6('0x22')]=function(_0x49896e){var _0x353e64=this;return new Promise(function(_0xd9e278,_0x4d4076){return db['VtigerAccount'][_0x53c6('0x23')]({'raw':_0x49896e[_0x53c6('0x1a')]?_0x49896e[_0x53c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x49896e[_0x53c6('0x1a')]?_0x49896e[_0x53c6('0x1a')]['where']||null:null,'attributes':_0x49896e[_0x53c6('0x1a')]?_0x49896e['options'][_0x53c6('0x1f')]||null:null,'include':_0x49896e[_0x53c6('0x1a')]?_0x49896e[_0x53c6('0x1a')][_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x49896e[_0x53c6('0x1a')][_0x53c6('0x1c')],function(_0x46e2fb){return{'model':db[_0x46e2fb[_0x53c6('0x1e')]],'as':_0x46e2fb['as'],'attributes':_0x46e2fb[_0x53c6('0x1f')],'include':_0x46e2fb[_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x46e2fb[_0x53c6('0x1c')],function(_0x45b415){return{'model':db[_0x45b415['model']],'as':_0x45b415['as'],'attributes':_0x45b415['attributes'],'include':_0x45b415[_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x45b415['include'],function(_0x481a26){return{'model':db[_0x481a26[_0x53c6('0x1e')]],'as':_0x481a26['as'],'attributes':_0x481a26[_0x53c6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3880b1){logger[_0x53c6('0x14')](_0x53c6('0x22'),_0x49896e);logger[_0x53c6('0x21')](_0x53c6('0x22'),_0x49896e,JSON[_0x53c6('0x10')](_0x3880b1));_0xd9e278(_0x3880b1);})[_0x53c6('0x16')](function(_0x470431){logger[_0x53c6('0x11')](_0x53c6('0x22'),_0x470431[_0x53c6('0x13')],_0x49896e);_0x4d4076(_0x353e64[_0x53c6('0x11')](0x1f4,_0x470431[_0x53c6('0x13')]));});});}; \ No newline at end of file +var _0x26fe=['request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','options','limit','include','map','model','attributes','GetVtigerAccount','ShowVtigerAccount','find','raw','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x556995,_0x17ac79){var _0x30e3b5=function(_0x2e6f78){while(--_0x2e6f78){_0x556995['push'](_0x556995['shift']());}};_0x30e3b5(++_0x17ac79);}(_0x26fe,0x1b0));var _0xe26f=function(_0xb5e33a,_0x575801){_0xb5e33a=_0xb5e33a-0x0;var _0x3ee313=_0x26fe[_0xb5e33a];return _0x3ee313;};'use strict';var _=require('lodash');var util=require(_0xe26f('0x0'));var moment=require(_0xe26f('0x1'));var BPromise=require(_0xe26f('0x2'));var rs=require(_0xe26f('0x3'));var fs=require('fs');var Redis=require(_0xe26f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe26f('0x5'));var logger=require(_0xe26f('0x6'))(_0xe26f('0x7'));var config=require(_0xe26f('0x8'));var jayson=require(_0xe26f('0x9'));var client=jayson[_0xe26f('0xa')][_0xe26f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d1eb4,_0x56d274,_0x10ee81){return new BPromise(function(_0x1bdf75,_0x24d69e){return client[_0xe26f('0xc')](_0x3d1eb4,_0x10ee81)[_0xe26f('0xd')](function(_0x3a0bdb){logger[_0xe26f('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x56d274,_0xe26f('0xf'));logger[_0xe26f('0x10')](_0xe26f('0x11'),_0x56d274,_0xe26f('0xf'),JSON[_0xe26f('0x12')](_0x3a0bdb));if(_0x3a0bdb[_0xe26f('0x13')]){if(_0x3a0bdb[_0xe26f('0x13')][_0xe26f('0x14')]===0x1f4){logger[_0xe26f('0x13')](_0xe26f('0x15'),_0x56d274,_0x3a0bdb['error'][_0xe26f('0x16')]);return _0x24d69e(_0x3a0bdb[_0xe26f('0x13')]['message']);}logger[_0xe26f('0x13')](_0xe26f('0x15'),_0x56d274,_0x3a0bdb[_0xe26f('0x13')]['message']);return _0x1bdf75(_0x3a0bdb['error'][_0xe26f('0x16')]);}else{logger[_0xe26f('0xe')](_0xe26f('0x15'),_0x56d274,'request\x20sent');_0x1bdf75(_0x3a0bdb[_0xe26f('0x17')][_0xe26f('0x16')]);}})[_0xe26f('0x18')](function(_0x4a3779){logger[_0xe26f('0x13')](_0xe26f('0x15'),_0x56d274,_0x4a3779);_0x24d69e(_0x4a3779);});});}exports['GetVtigerAccount']=function(_0x29a835){var _0x2d5f3b=this;return new Promise(function(_0xa6ce57,_0x4c92b9){return db[_0xe26f('0x19')]['findAll']({'raw':_0x29a835[_0xe26f('0x1a')]?_0x29a835['options']['raw']===undefined?!![]:![]:!![],'where':_0x29a835[_0xe26f('0x1a')]?_0x29a835[_0xe26f('0x1a')]['where']||null:null,'attributes':_0x29a835['options']?_0x29a835[_0xe26f('0x1a')]['attributes']||null:null,'limit':_0x29a835[_0xe26f('0x1a')]?_0x29a835[_0xe26f('0x1a')][_0xe26f('0x1b')]||null:null,'include':_0x29a835[_0xe26f('0x1a')]?_0x29a835[_0xe26f('0x1a')][_0xe26f('0x1c')]?_[_0xe26f('0x1d')](_0x29a835[_0xe26f('0x1a')][_0xe26f('0x1c')],function(_0x10b3be){return{'model':db[_0x10b3be[_0xe26f('0x1e')]],'as':_0x10b3be['as'],'attributes':_0x10b3be[_0xe26f('0x1f')],'include':_0x10b3be[_0xe26f('0x1c')]?_[_0xe26f('0x1d')](_0x10b3be[_0xe26f('0x1c')],function(_0x5bb09d){return{'model':db[_0x5bb09d['model']],'as':_0x5bb09d['as'],'attributes':_0x5bb09d[_0xe26f('0x1f')],'include':_0x5bb09d['include']?_[_0xe26f('0x1d')](_0x5bb09d['include'],function(_0x59fa79){return{'model':db[_0x59fa79[_0xe26f('0x1e')]],'as':_0x59fa79['as'],'attributes':_0x59fa79[_0xe26f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5538a8){logger[_0xe26f('0xe')](_0xe26f('0x20'),_0x29a835);logger[_0xe26f('0x10')]('GetVtigerAccount',_0x29a835,JSON[_0xe26f('0x12')](_0x5538a8));_0xa6ce57(_0x5538a8);})[_0xe26f('0x18')](function(_0x359be5){logger['error'](_0xe26f('0x20'),_0x359be5[_0xe26f('0x16')],_0x29a835);_0x4c92b9(_0x2d5f3b['error'](0x1f4,_0x359be5[_0xe26f('0x16')]));});});};exports[_0xe26f('0x21')]=function(_0x30830d){var _0xd59fc=this;return new Promise(function(_0x4051b8,_0x105ad0){return db[_0xe26f('0x19')][_0xe26f('0x22')]({'raw':_0x30830d['options']?_0x30830d[_0xe26f('0x1a')][_0xe26f('0x23')]===undefined?!![]:![]:!![],'where':_0x30830d[_0xe26f('0x1a')]?_0x30830d[_0xe26f('0x1a')][_0xe26f('0x24')]||null:null,'attributes':_0x30830d[_0xe26f('0x1a')]?_0x30830d[_0xe26f('0x1a')][_0xe26f('0x1f')]||null:null,'include':_0x30830d['options']?_0x30830d[_0xe26f('0x1a')][_0xe26f('0x1c')]?_[_0xe26f('0x1d')](_0x30830d[_0xe26f('0x1a')][_0xe26f('0x1c')],function(_0x4ea5a8){return{'model':db[_0x4ea5a8[_0xe26f('0x1e')]],'as':_0x4ea5a8['as'],'attributes':_0x4ea5a8[_0xe26f('0x1f')],'include':_0x4ea5a8[_0xe26f('0x1c')]?_[_0xe26f('0x1d')](_0x4ea5a8[_0xe26f('0x1c')],function(_0x53d0c5){return{'model':db[_0x53d0c5['model']],'as':_0x53d0c5['as'],'attributes':_0x53d0c5['attributes'],'include':_0x53d0c5['include']?_[_0xe26f('0x1d')](_0x53d0c5[_0xe26f('0x1c')],function(_0x529403){return{'model':db[_0x529403[_0xe26f('0x1e')]],'as':_0x529403['as'],'attributes':_0x529403[_0xe26f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe26f('0xd')](function(_0x5d50a9){logger[_0xe26f('0xe')](_0xe26f('0x21'),_0x30830d);logger[_0xe26f('0x10')](_0xe26f('0x21'),_0x30830d,JSON['stringify'](_0x5d50a9));_0x4051b8(_0x5d50a9);})[_0xe26f('0x18')](function(_0x2c61f7){logger['error'](_0xe26f('0x21'),_0x2c61f7[_0xe26f('0x16')],_0x30830d);_0x105ad0(_0xd59fc[_0xe26f('0x13')](0x1f4,_0x2c61f7['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 14dacb5..1554059 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x59cea1,_0x187b71){var _0x3ec0a1=function(_0x2f9713){while(--_0x2f9713){_0x59cea1['push'](_0x59cea1['shift']());}};_0x3ec0a1(++_0x187b71);}(_0xb10b,0x12a));var _0xbb10=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb10b[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x267867,_0x1b632b){var _0x23a37a=function(_0x2a1283){while(--_0x2a1283){_0x267867['push'](_0x267867['shift']());}};_0x23a37a(++_0x1b632b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a10e3,_0x3cdb35){_0x3a10e3=_0x3a10e3-0x0;var _0xf067c8=_0x5f2f[_0x3a10e3];return _0xf067c8;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index fb4141b..6d60d26 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 _0x79db=['exports','STRING','sequelize'];(function(_0x416a85,_0x434ee3){var _0x38406b=function(_0x253ab1){while(--_0x253ab1){_0x416a85['push'](_0x416a85['shift']());}};_0x38406b(++_0x434ee3);}(_0x79db,0xfe));var _0xb79d=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x79db[_0x1c6ef2];return _0x404b8c;};'use strict';var Sequelize=require(_0xb79d('0x0'));module[_0xb79d('0x1')]={'name':{'type':Sequelize[_0xb79d('0x2')]},'description':{'type':Sequelize[_0xb79d('0x2')]}}; \ No newline at end of file +var _0x8f6d=['sequelize','STRING'];(function(_0x335cba,_0x156ad5){var _0x2d9f05=function(_0x561868){while(--_0x561868){_0x335cba['push'](_0x335cba['shift']());}};_0x2d9f05(++_0x156ad5);}(_0x8f6d,0xae));var _0xd8f6=function(_0x57ce02,_0x125622){_0x57ce02=_0x57ce02-0x0;var _0x36bc51=_0x8f6d[_0x57ce02];return _0x36bc51;};'use strict';var Sequelize=require(_0xd8f6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c933097..0cd5726 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 _0x9007=['getDescriptions','html-pdf','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../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','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','VtigerConfiguration','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','getFields','keys','VtigerField','order','pick','getSubjects','findOne'];(function(_0x1b20a5,_0x4de662){var _0x16076c=function(_0x4ecfac){while(--_0x4ecfac){_0x1b20a5['push'](_0x1b20a5['shift']());}};_0x16076c(++_0x4de662);}(_0x9007,0xb3));var _0x7900=function(_0x36f284,_0x24cbd1){_0x36f284=_0x36f284-0x0;var _0x4ea099=_0x9007[_0x36f284];return _0x4ea099;};'use strict';var pdf=require(_0x7900('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7900('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7900('0x2'));var moment=require(_0x7900('0x3'));var BPromise=require(_0x7900('0x4'));var Mustache=require(_0x7900('0x5'));var util=require('util');var path=require(_0x7900('0x6'));var sox=require(_0x7900('0x7'));var csv=require('to-csv');var ejs=require(_0x7900('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7900('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7900('0xa'));var toCsv=require(_0x7900('0xb'));var querystring=require(_0x7900('0xc'));var Papa=require(_0x7900('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7900('0xe'));var as=require(_0x7900('0xf'));var hardwareService=require(_0x7900('0x10'));var logger=require(_0x7900('0x11'))('api');var utils=require(_0x7900('0x12'));var config=require(_0x7900('0x13'));var db=require(_0x7900('0x14'))['db'];var jayson=require(_0x7900('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2ebff6,_0x4711b8,_0x51fc04){if(_0x51fc04){var _0xd3b7ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd3b7ac[_0x7900('0x16')](_0x4711b8)){return _0x2ebff6;}else{throw new db[(_0x7900('0x17'))][(_0x7900('0x18'))](_0x7900('0x19'));}}else{return _0x2ebff6;}}function respondWithRpcPromise(_0x368f51,_0x18a6f4,_0x53ec10,_0x18dcd8){return new BPromise(function(_0x52aa4e,_0x3ac4dd){var _0x153429=_0x18dcd8||client;return _0x153429[_0x7900('0x1a')](_0x368f51,_0x53ec10)['then'](function(_0xeb5448){logger[_0x7900('0x1b')](_0x7900('0x1c'),_0x18a6f4,_0x7900('0x1d'));logger[_0x7900('0x1e')](_0x7900('0x1f'),_0x18a6f4,_0x7900('0x1d'),JSON[_0x7900('0x20')](_0xeb5448));if(_0xeb5448['error']){if(_0xeb5448[_0x7900('0x21')]['code']===0x1f4){logger[_0x7900('0x21')](_0x7900('0x1c'),_0x18a6f4,_0xeb5448[_0x7900('0x21')]['message']);return _0x3ac4dd(_0xeb5448['error'][_0x7900('0x22')]);}logger['error'](_0x7900('0x1c'),_0x18a6f4,_0xeb5448[_0x7900('0x21')][_0x7900('0x22')]);return _0x52aa4e(_0xeb5448['error'][_0x7900('0x22')]);}else{logger[_0x7900('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x18a6f4,_0x7900('0x1d'));_0x52aa4e(_0xeb5448[_0x7900('0x23')]['message']);}})[_0x7900('0x24')](function(_0x1d3544){logger[_0x7900('0x21')](_0x7900('0x1c'),_0x18a6f4,_0x1d3544);_0x3ac4dd(_0x1d3544);});});}function respondWithStatusCode(_0x566153,_0x55e77a){_0x55e77a=_0x55e77a||0xcc;return function(_0x1c4a84){if(_0x1c4a84){return _0x566153[_0x7900('0x25')](_0x55e77a);}return _0x566153[_0x7900('0x26')](_0x55e77a)['end']();};}function respondWithResult(_0x9366cd,_0x1bfc0d){_0x1bfc0d=_0x1bfc0d||0xc8;return function(_0x4a385b){if(_0x4a385b){return _0x9366cd[_0x7900('0x26')](_0x1bfc0d)[_0x7900('0x27')](_0x4a385b);}};}function respondWithFilteredResult(_0x1d5cb1,_0x258c9f){return function(_0x5828ba){if(_0x5828ba){var _0x11c99e=_0x5828ba[_0x7900('0x28')],_0x498a5d=_0x258c9f[_0x7900('0x29')],_0x219071=_0x258c9f[_0x7900('0x29')]+_0x258c9f[_0x7900('0x2a')],_0xc332f7;if(_0x219071>=_0x11c99e){_0x219071=_0x11c99e;_0xc332f7=0xc8;}else{_0xc332f7=0xce;}_0x1d5cb1[_0x7900('0x26')](_0xc332f7);return _0x1d5cb1['set'](_0x7900('0x2b'),_0x498a5d+'-'+_0x219071+'/'+_0x11c99e)[_0x7900('0x27')](_0x5828ba);}return null;};}function patchUpdates(_0x484096){return function(_0x1214e4){try{jsonpatch[_0x7900('0x2c')](_0x1214e4,_0x484096,!![]);}catch(_0x32177f){return BPromise[_0x7900('0x2d')](_0x32177f);}return _0x1214e4[_0x7900('0x2e')]();};}function saveUpdates(_0x2b9cc7,_0x505378){return function(_0xe0dc1){if(_0xe0dc1){return _0xe0dc1['update'](_0x2b9cc7)[_0x7900('0x2f')](function(_0x490715){return _0x490715;});}return null;};}function removeEntity(_0x1c0063,_0x3c3ded){return function(_0x2a1238){if(_0x2a1238){return _0x2a1238[_0x7900('0x30')]()['then'](function(){_0x1c0063['status'](0xcc)[_0x7900('0x31')]();});}};}function handleEntityNotFound(_0x4f8c4a,_0x146361){return function(_0x227f8f){if(!_0x227f8f){_0x4f8c4a[_0x7900('0x25')](0x194);}return _0x227f8f;};}function handleError(_0xb429a9,_0x1e35d4){_0x1e35d4=_0x1e35d4||0x1f4;return function(_0x3a1c90){logger[_0x7900('0x21')](_0x3a1c90['stack']);if(_0x3a1c90[_0x7900('0x32')]){delete _0x3a1c90[_0x7900('0x32')];}_0xb429a9[_0x7900('0x26')](_0x1e35d4)[_0x7900('0x33')](_0x3a1c90);};}exports[_0x7900('0x34')]=function(_0x3098be,_0x45df9b){var _0x5618c1={},_0x5bf380={},_0x2fe2e9={'count':0x0,'rows':[]};var _0xae378c=_[_0x7900('0x35')](db[_0x7900('0x36')]['rawAttributes'],function(_0x421ee3){return{'name':_0x421ee3['fieldName'],'type':_0x421ee3[_0x7900('0x37')]['key']};});_0x5bf380[_0x7900('0x38')]=_['map'](_0xae378c,_0x7900('0x32'));_0x5bf380[_0x7900('0x39')]=_['keys'](_0x3098be['query']);_0x5bf380[_0x7900('0x3a')]=_[_0x7900('0x3b')](_0x5bf380[_0x7900('0x38')],_0x5bf380[_0x7900('0x39')]);_0x5618c1[_0x7900('0x3c')]=_[_0x7900('0x3b')](_0x5bf380['model'],qs[_0x7900('0x3d')](_0x3098be[_0x7900('0x39')]['fields']));_0x5618c1['attributes']=_0x5618c1[_0x7900('0x3c')][_0x7900('0x3e')]?_0x5618c1[_0x7900('0x3c')]:_0x5bf380[_0x7900('0x38')];if(!_0x3098be[_0x7900('0x39')][_0x7900('0x3f')](_0x7900('0x40'))){_0x5618c1[_0x7900('0x2a')]=qs[_0x7900('0x2a')](_0x3098be['query'][_0x7900('0x2a')]);_0x5618c1[_0x7900('0x29')]=qs[_0x7900('0x29')](_0x3098be[_0x7900('0x39')][_0x7900('0x29')]);}_0x5618c1['order']=qs[_0x7900('0x41')](_0x3098be['query'][_0x7900('0x41')]);_0x5618c1[_0x7900('0x42')]=qs['filters'](_['pick'](_0x3098be[_0x7900('0x39')],_0x5bf380[_0x7900('0x3a')]),_0xae378c);if(_0x3098be[_0x7900('0x39')][_0x7900('0x43')]){_0x5618c1[_0x7900('0x42')]=_['merge'](_0x5618c1[_0x7900('0x42')],{'$or':_[_0x7900('0x35')](_0xae378c,function(_0x596cad){if(_0x596cad[_0x7900('0x37')]!==_0x7900('0x44')){var _0x33d4c7={};_0x33d4c7[_0x596cad[_0x7900('0x32')]]={'$like':'%'+_0x3098be[_0x7900('0x39')][_0x7900('0x43')]+'%'};return _0x33d4c7;}})});}_0x5618c1=_[_0x7900('0x45')]({},_0x5618c1,_0x3098be[_0x7900('0x46')]);var _0x3db80d={'where':_0x5618c1['where']};return db[_0x7900('0x36')][_0x7900('0x28')](_0x3db80d)[_0x7900('0x2f')](function(_0x17d7c4){_0x2fe2e9[_0x7900('0x28')]=_0x17d7c4;if(_0x3098be['query']['includeAll']){_0x5618c1['include']=[{'all':!![]}];}return db[_0x7900('0x36')][_0x7900('0x47')](_0x5618c1);})[_0x7900('0x2f')](function(_0x4f7fe6){_0x2fe2e9[_0x7900('0x48')]=_0x4f7fe6;return _0x2fe2e9;})[_0x7900('0x2f')](respondWithFilteredResult(_0x45df9b,_0x5618c1))[_0x7900('0x24')](handleError(_0x45df9b,null));};exports[_0x7900('0x49')]=function(_0x4103ab,_0x217352){var _0x16ac68={'raw':![],'where':{'id':_0x4103ab[_0x7900('0x4a')]['id']}},_0xabc0f2={};_0xabc0f2['model']=_['keys'](db['VtigerConfiguration'][_0x7900('0x4b')]);_0xabc0f2['query']=_['keys'](_0x4103ab[_0x7900('0x39')]);_0xabc0f2[_0x7900('0x3a')]=_['intersection'](_0xabc0f2[_0x7900('0x38')],_0xabc0f2[_0x7900('0x39')]);_0x16ac68[_0x7900('0x3c')]=_[_0x7900('0x3b')](_0xabc0f2[_0x7900('0x38')],qs[_0x7900('0x3d')](_0x4103ab[_0x7900('0x39')][_0x7900('0x3d')]));_0x16ac68[_0x7900('0x3c')]=_0x16ac68['attributes'][_0x7900('0x3e')]?_0x16ac68['attributes']:_0xabc0f2[_0x7900('0x38')];if(_0x4103ab[_0x7900('0x39')][_0x7900('0x4c')]){_0x16ac68[_0x7900('0x4d')]=[{'all':!![]}];}_0x16ac68=_[_0x7900('0x45')]({},_0x16ac68,_0x4103ab['options']);return db[_0x7900('0x36')][_0x7900('0x4e')](_0x16ac68)[_0x7900('0x2f')](handleEntityNotFound(_0x217352,null))['then'](respondWithResult(_0x217352,null))['catch'](handleError(_0x217352,null));};exports[_0x7900('0x4f')]=function(_0x31635d,_0x150951){return db['VtigerConfiguration'][_0x7900('0x4f')](_0x31635d[_0x7900('0x50')],{})[_0x7900('0x2f')](respondWithResult(_0x150951,0xc9))[_0x7900('0x24')](handleError(_0x150951,null));};exports['update']=function(_0x214be4,_0x280cd9){if(_0x214be4[_0x7900('0x50')]['id']){delete _0x214be4[_0x7900('0x50')]['id'];}return db['VtigerConfiguration'][_0x7900('0x4e')]({'where':{'id':_0x214be4[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x280cd9,null))[_0x7900('0x2f')](saveUpdates(_0x214be4[_0x7900('0x50')],null))['then'](respondWithResult(_0x280cd9,null))['catch'](handleError(_0x280cd9,null));};exports['destroy']=function(_0x390587,_0xe87b37){return db['VtigerConfiguration'][_0x7900('0x4e')]({'where':{'id':_0x390587['params']['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0xe87b37,null))['then'](removeEntity(_0xe87b37,null))[_0x7900('0x24')](handleError(_0xe87b37,null));};exports[_0x7900('0x51')]=function(_0x26b404,_0x479a43,_0x43c708){var _0x3f3297={};var _0x155707={};var _0x381f8d;var _0x499091;return db[_0x7900('0x36')]['findOne']({'where':{'id':_0x26b404[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x479a43,null))['then'](function(_0x4ea933){if(_0x4ea933){_0x381f8d=_0x4ea933;_0x155707[_0x7900('0x38')]=_[_0x7900('0x52')](db[_0x7900('0x53')][_0x7900('0x4b')]);_0x155707['query']=_[_0x7900('0x52')](_0x26b404[_0x7900('0x39')]);_0x155707[_0x7900('0x3a')]=_[_0x7900('0x3b')](_0x155707[_0x7900('0x38')],_0x155707[_0x7900('0x39')]);_0x3f3297[_0x7900('0x3c')]=_[_0x7900('0x3b')](_0x155707['model'],qs[_0x7900('0x3d')](_0x26b404[_0x7900('0x39')][_0x7900('0x3d')]));_0x3f3297['attributes']=_0x3f3297['attributes']['length']?_0x3f3297[_0x7900('0x3c')]:_0x155707[_0x7900('0x38')];_0x3f3297[_0x7900('0x54')]=qs[_0x7900('0x41')](_0x26b404['query']['sort']);_0x3f3297[_0x7900('0x42')]=qs[_0x7900('0x3a')](_[_0x7900('0x55')](_0x26b404['query'],_0x155707[_0x7900('0x3a')]));if(_0x26b404['query']['filter']){_0x3f3297[_0x7900('0x42')]=_[_0x7900('0x45')](_0x3f3297[_0x7900('0x42')],{'$or':_['map'](_0x3f3297[_0x7900('0x3c')],function(_0x11eebb){var _0x552d62={};_0x552d62[_0x11eebb]={'$like':'%'+_0x26b404[_0x7900('0x39')][_0x7900('0x43')]+'%'};return _0x552d62;})});}_0x3f3297=_[_0x7900('0x45')]({},_0x3f3297,_0x26b404[_0x7900('0x46')]);return _0x381f8d[_0x7900('0x51')](_0x3f3297);}})['then'](function(_0x5e365a){if(_0x5e365a){_0x499091=_0x5e365a[_0x7900('0x3e')];if(!_0x26b404['query'][_0x7900('0x3f')]('nolimit')){_0x3f3297[_0x7900('0x2a')]=qs[_0x7900('0x2a')](_0x26b404[_0x7900('0x39')][_0x7900('0x2a')]);_0x3f3297['offset']=qs[_0x7900('0x29')](_0x26b404[_0x7900('0x39')]['offset']);}return _0x381f8d[_0x7900('0x51')](_0x3f3297);}})[_0x7900('0x2f')](function(_0xccdae6){if(_0xccdae6){return _0xccdae6?{'count':_0x499091,'rows':_0xccdae6}:null;}})[_0x7900('0x2f')](respondWithResult(_0x479a43,null))[_0x7900('0x24')](handleError(_0x479a43,null));};exports[_0x7900('0x56')]=function(_0x4fd940,_0x4ac6d9,_0x2a1340){var _0x59fece={};var _0x5c0b7e={};var _0x51ddba;var _0x395c46;return db[_0x7900('0x36')][_0x7900('0x57')]({'where':{'id':_0x4fd940[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x4ac6d9,null))[_0x7900('0x2f')](function(_0x23c32b){if(_0x23c32b){_0x51ddba=_0x23c32b;_0x5c0b7e[_0x7900('0x38')]=_[_0x7900('0x52')](db[_0x7900('0x53')]['rawAttributes']);_0x5c0b7e[_0x7900('0x39')]=_[_0x7900('0x52')](_0x4fd940[_0x7900('0x39')]);_0x5c0b7e['filters']=_[_0x7900('0x3b')](_0x5c0b7e['model'],_0x5c0b7e[_0x7900('0x39')]);_0x59fece['attributes']=_[_0x7900('0x3b')](_0x5c0b7e[_0x7900('0x38')],qs[_0x7900('0x3d')](_0x4fd940['query'][_0x7900('0x3d')]));_0x59fece['attributes']=_0x59fece[_0x7900('0x3c')][_0x7900('0x3e')]?_0x59fece[_0x7900('0x3c')]:_0x5c0b7e[_0x7900('0x38')];_0x59fece[_0x7900('0x54')]=qs[_0x7900('0x41')](_0x4fd940[_0x7900('0x39')]['sort']);_0x59fece[_0x7900('0x42')]=qs['filters'](_[_0x7900('0x55')](_0x4fd940[_0x7900('0x39')],_0x5c0b7e[_0x7900('0x3a')]));if(_0x4fd940[_0x7900('0x39')][_0x7900('0x43')]){_0x59fece[_0x7900('0x42')]=_['merge'](_0x59fece[_0x7900('0x42')],{'$or':_['map'](_0x59fece[_0x7900('0x3c')],function(_0x25c856){var _0x3c2dff={};_0x3c2dff[_0x25c856]={'$like':'%'+_0x4fd940['query'][_0x7900('0x43')]+'%'};return _0x3c2dff;})});}_0x59fece=_[_0x7900('0x45')]({},_0x59fece,_0x4fd940[_0x7900('0x46')]);return _0x51ddba[_0x7900('0x56')](_0x59fece);}})[_0x7900('0x2f')](function(_0x4f6fe1){if(_0x4f6fe1){_0x395c46=_0x4f6fe1[_0x7900('0x3e')];if(!_0x4fd940['query']['hasOwnProperty'](_0x7900('0x40'))){_0x59fece[_0x7900('0x2a')]=qs['limit'](_0x4fd940[_0x7900('0x39')][_0x7900('0x2a')]);_0x59fece[_0x7900('0x29')]=qs[_0x7900('0x29')](_0x4fd940['query'][_0x7900('0x29')]);}return _0x51ddba[_0x7900('0x56')](_0x59fece);}})[_0x7900('0x2f')](function(_0x27a15e){if(_0x27a15e){return _0x27a15e?{'count':_0x395c46,'rows':_0x27a15e}:null;}})['then'](respondWithResult(_0x4ac6d9,null))['catch'](handleError(_0x4ac6d9,null));};exports[_0x7900('0x58')]=function(_0xa67f1e,_0x3ffead,_0x43333b){var _0x4c05e0={};var _0x4583f0={};var _0x1a236f;var _0x445c07;return db[_0x7900('0x36')][_0x7900('0x57')]({'where':{'id':_0xa67f1e[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x3ffead,null))['then'](function(_0x732bdf){if(_0x732bdf){_0x1a236f=_0x732bdf;_0x4583f0[_0x7900('0x38')]=_['keys'](db[_0x7900('0x53')][_0x7900('0x4b')]);_0x4583f0[_0x7900('0x39')]=_['keys'](_0xa67f1e[_0x7900('0x39')]);_0x4583f0[_0x7900('0x3a')]=_['intersection'](_0x4583f0[_0x7900('0x38')],_0x4583f0[_0x7900('0x39')]);_0x4c05e0['attributes']=_[_0x7900('0x3b')](_0x4583f0[_0x7900('0x38')],qs[_0x7900('0x3d')](_0xa67f1e[_0x7900('0x39')][_0x7900('0x3d')]));_0x4c05e0[_0x7900('0x3c')]=_0x4c05e0[_0x7900('0x3c')][_0x7900('0x3e')]?_0x4c05e0[_0x7900('0x3c')]:_0x4583f0[_0x7900('0x38')];_0x4c05e0[_0x7900('0x54')]=qs[_0x7900('0x41')](_0xa67f1e[_0x7900('0x39')]['sort']);_0x4c05e0[_0x7900('0x42')]=qs[_0x7900('0x3a')](_[_0x7900('0x55')](_0xa67f1e[_0x7900('0x39')],_0x4583f0[_0x7900('0x3a')]));if(_0xa67f1e[_0x7900('0x39')][_0x7900('0x43')]){_0x4c05e0[_0x7900('0x42')]=_[_0x7900('0x45')](_0x4c05e0[_0x7900('0x42')],{'$or':_['map'](_0x4c05e0[_0x7900('0x3c')],function(_0x4af23e){var _0x40289d={};_0x40289d[_0x4af23e]={'$like':'%'+_0xa67f1e[_0x7900('0x39')][_0x7900('0x43')]+'%'};return _0x40289d;})});}_0x4c05e0=_['merge']({},_0x4c05e0,_0xa67f1e[_0x7900('0x46')]);return _0x1a236f[_0x7900('0x58')](_0x4c05e0);}})[_0x7900('0x2f')](function(_0x7e6f6d){if(_0x7e6f6d){_0x445c07=_0x7e6f6d[_0x7900('0x3e')];if(!_0xa67f1e[_0x7900('0x39')]['hasOwnProperty'](_0x7900('0x40'))){_0x4c05e0[_0x7900('0x2a')]=qs[_0x7900('0x2a')](_0xa67f1e[_0x7900('0x39')][_0x7900('0x2a')]);_0x4c05e0['offset']=qs[_0x7900('0x29')](_0xa67f1e[_0x7900('0x39')][_0x7900('0x29')]);}return _0x1a236f[_0x7900('0x58')](_0x4c05e0);}})[_0x7900('0x2f')](function(_0x471e03){if(_0x471e03){return _0x471e03?{'count':_0x445c07,'rows':_0x471e03}:null;}})[_0x7900('0x2f')](respondWithResult(_0x3ffead,null))[_0x7900('0x24')](handleError(_0x3ffead,null));}; \ No newline at end of file +var _0x64a4=['pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','keys','include','find','create','body','params','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','stack','name','send','map','VtigerConfiguration','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where'];(function(_0x16fe01,_0x5039e1){var _0x56c48a=function(_0x419884){while(--_0x419884){_0x16fe01['push'](_0x16fe01['shift']());}};_0x56c48a(++_0x5039e1);}(_0x64a4,0x1d2));var _0x464a=function(_0x4a9d03,_0x3db157){_0x4a9d03=_0x4a9d03-0x0;var _0x3ec097=_0x64a4[_0x4a9d03];return _0x3ec097;};'use strict';var pdf=require(_0x464a('0x0'));var emlformat=require(_0x464a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x464a('0x2'));var jsonpatch=require(_0x464a('0x3'));var rp=require('request-promise');var moment=require(_0x464a('0x4'));var BPromise=require(_0x464a('0x5'));var Mustache=require(_0x464a('0x6'));var util=require(_0x464a('0x7'));var path=require(_0x464a('0x8'));var sox=require(_0x464a('0x9'));var csv=require('to-csv');var ejs=require(_0x464a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x464a('0xb'));var crypto=require(_0x464a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x464a('0xd'));var toCsv=require(_0x464a('0xe'));var querystring=require(_0x464a('0xf'));var Papa=require(_0x464a('0x10'));var Redis=require(_0x464a('0x11'));var authService=require(_0x464a('0x12'));var qs=require(_0x464a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x464a('0x14'));var logger=require(_0x464a('0x15'))(_0x464a('0x16'));var utils=require(_0x464a('0x17'));var config=require('../../config/environment');var db=require(_0x464a('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x464a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x13bff9,_0x57960e,_0x49f47d){if(_0x49f47d){var _0x4aafa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4aafa6[_0x464a('0x1a')](_0x57960e)){return _0x13bff9;}else{throw new db['Sequelize'][(_0x464a('0x1b'))](_0x464a('0x1c'));}}else{return _0x13bff9;}}function respondWithRpcPromise(_0x20d908,_0x19141f,_0x5e8424,_0x48a10b){return new BPromise(function(_0x5c1155,_0x5c7556){var _0x173c75=_0x48a10b||client;return _0x173c75[_0x464a('0x1d')](_0x20d908,_0x5e8424)[_0x464a('0x1e')](function(_0x4e3b74){logger[_0x464a('0x1f')](_0x464a('0x20'),_0x19141f,'request\x20sent');logger['debug'](_0x464a('0x21'),_0x19141f,_0x464a('0x22'),JSON['stringify'](_0x4e3b74));if(_0x4e3b74['error']){if(_0x4e3b74['error'][_0x464a('0x23')]===0x1f4){logger[_0x464a('0x24')]('VtigerConfiguration,\x20%s,\x20%s',_0x19141f,_0x4e3b74[_0x464a('0x24')]['message']);return _0x5c7556(_0x4e3b74[_0x464a('0x24')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x19141f,_0x4e3b74[_0x464a('0x24')][_0x464a('0x25')]);return _0x5c1155(_0x4e3b74[_0x464a('0x24')]['message']);}else{logger[_0x464a('0x1f')](_0x464a('0x20'),_0x19141f,_0x464a('0x22'));_0x5c1155(_0x4e3b74[_0x464a('0x26')]['message']);}})['catch'](function(_0x4f0989){logger['error'](_0x464a('0x20'),_0x19141f,_0x4f0989);_0x5c7556(_0x4f0989);});});}function respondWithStatusCode(_0x2bef5e,_0x5573c8){_0x5573c8=_0x5573c8||0xcc;return function(_0x27d4e0){if(_0x27d4e0){return _0x2bef5e[_0x464a('0x27')](_0x5573c8);}return _0x2bef5e[_0x464a('0x28')](_0x5573c8)[_0x464a('0x29')]();};}function respondWithResult(_0x4b8d71,_0x7810b1){_0x7810b1=_0x7810b1||0xc8;return function(_0x56b17e){if(_0x56b17e){return _0x4b8d71[_0x464a('0x28')](_0x7810b1)[_0x464a('0x2a')](_0x56b17e);}};}function respondWithFilteredResult(_0x4a45b2,_0x13b54c){return function(_0x3d762c){if(_0x3d762c){var _0x30d2dd=_0x3d762c[_0x464a('0x2b')],_0x17cd08=_0x13b54c[_0x464a('0x2c')],_0x42478d=_0x13b54c[_0x464a('0x2c')]+_0x13b54c['limit'],_0x1a8fb4;if(_0x42478d>=_0x30d2dd){_0x42478d=_0x30d2dd;_0x1a8fb4=0xc8;}else{_0x1a8fb4=0xce;}_0x4a45b2['status'](_0x1a8fb4);return _0x4a45b2['set'](_0x464a('0x2d'),_0x17cd08+'-'+_0x42478d+'/'+_0x30d2dd)[_0x464a('0x2a')](_0x3d762c);}return null;};}function patchUpdates(_0x2845fb){return function(_0x2e9a0a){try{jsonpatch[_0x464a('0x2e')](_0x2e9a0a,_0x2845fb,!![]);}catch(_0x5e0046){return BPromise[_0x464a('0x2f')](_0x5e0046);}return _0x2e9a0a[_0x464a('0x30')]();};}function saveUpdates(_0x3345d1,_0x144cb8){return function(_0x4ea26d){if(_0x4ea26d){return _0x4ea26d['update'](_0x3345d1)[_0x464a('0x1e')](function(_0x47798f){return _0x47798f;});}return null;};}function removeEntity(_0x3c604a,_0x3be369){return function(_0xc89b55){if(_0xc89b55){return _0xc89b55[_0x464a('0x31')]()['then'](function(){_0x3c604a['status'](0xcc)[_0x464a('0x29')]();});}};}function handleEntityNotFound(_0x258565,_0x5309f2){return function(_0x8d8c75){if(!_0x8d8c75){_0x258565[_0x464a('0x27')](0x194);}return _0x8d8c75;};}function handleError(_0x4cd528,_0x3874e7){_0x3874e7=_0x3874e7||0x1f4;return function(_0x390fa9){logger[_0x464a('0x24')](_0x390fa9[_0x464a('0x32')]);if(_0x390fa9[_0x464a('0x33')]){delete _0x390fa9[_0x464a('0x33')];}_0x4cd528[_0x464a('0x28')](_0x3874e7)[_0x464a('0x34')](_0x390fa9);};}exports['index']=function(_0x25b8fb,_0x340a05){var _0x30801a={},_0x3407bd={},_0x420f53={'count':0x0,'rows':[]};var _0x4e9943=_[_0x464a('0x35')](db[_0x464a('0x36')][_0x464a('0x37')],function(_0x11e9a5){return{'name':_0x11e9a5['fieldName'],'type':_0x11e9a5[_0x464a('0x38')]['key']};});_0x3407bd[_0x464a('0x39')]=_[_0x464a('0x35')](_0x4e9943,_0x464a('0x33'));_0x3407bd[_0x464a('0x3a')]=_['keys'](_0x25b8fb['query']);_0x3407bd[_0x464a('0x3b')]=_[_0x464a('0x3c')](_0x3407bd['model'],_0x3407bd[_0x464a('0x3a')]);_0x30801a['attributes']=_[_0x464a('0x3c')](_0x3407bd['model'],qs[_0x464a('0x3d')](_0x25b8fb[_0x464a('0x3a')][_0x464a('0x3d')]));_0x30801a[_0x464a('0x3e')]=_0x30801a['attributes'][_0x464a('0x3f')]?_0x30801a[_0x464a('0x3e')]:_0x3407bd[_0x464a('0x39')];if(!_0x25b8fb[_0x464a('0x3a')]['hasOwnProperty'](_0x464a('0x40'))){_0x30801a['limit']=qs[_0x464a('0x41')](_0x25b8fb[_0x464a('0x3a')][_0x464a('0x41')]);_0x30801a[_0x464a('0x2c')]=qs[_0x464a('0x2c')](_0x25b8fb[_0x464a('0x3a')][_0x464a('0x2c')]);}_0x30801a['order']=qs[_0x464a('0x42')](_0x25b8fb['query'][_0x464a('0x42')]);_0x30801a[_0x464a('0x43')]=qs[_0x464a('0x3b')](_[_0x464a('0x44')](_0x25b8fb[_0x464a('0x3a')],_0x3407bd[_0x464a('0x3b')]),_0x4e9943);if(_0x25b8fb[_0x464a('0x3a')][_0x464a('0x45')]){_0x30801a[_0x464a('0x43')]=_[_0x464a('0x46')](_0x30801a[_0x464a('0x43')],{'$or':_[_0x464a('0x35')](_0x4e9943,function(_0x3f6512){if(_0x3f6512['type']!==_0x464a('0x47')){var _0x119189={};_0x119189[_0x3f6512[_0x464a('0x33')]]={'$like':'%'+_0x25b8fb[_0x464a('0x3a')][_0x464a('0x45')]+'%'};return _0x119189;}})});}_0x30801a=_[_0x464a('0x46')]({},_0x30801a,_0x25b8fb[_0x464a('0x48')]);var _0x35c40d={'where':_0x30801a[_0x464a('0x43')]};return db[_0x464a('0x36')][_0x464a('0x2b')](_0x35c40d)[_0x464a('0x1e')](function(_0x5b19e7){_0x420f53[_0x464a('0x2b')]=_0x5b19e7;if(_0x25b8fb[_0x464a('0x3a')][_0x464a('0x49')]){_0x30801a['include']=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x30801a);})['then'](function(_0x314778){_0x420f53[_0x464a('0x4a')]=_0x314778;return _0x420f53;})[_0x464a('0x1e')](respondWithFilteredResult(_0x340a05,_0x30801a))[_0x464a('0x4b')](handleError(_0x340a05,null));};exports['show']=function(_0x35dc2d,_0x2c9b44){var _0x5ba763={'raw':![],'where':{'id':_0x35dc2d['params']['id']}},_0x898061={};_0x898061['model']=_[_0x464a('0x4c')](db[_0x464a('0x36')][_0x464a('0x37')]);_0x898061[_0x464a('0x3a')]=_[_0x464a('0x4c')](_0x35dc2d[_0x464a('0x3a')]);_0x898061[_0x464a('0x3b')]=_[_0x464a('0x3c')](_0x898061[_0x464a('0x39')],_0x898061['query']);_0x5ba763[_0x464a('0x3e')]=_['intersection'](_0x898061[_0x464a('0x39')],qs[_0x464a('0x3d')](_0x35dc2d['query'][_0x464a('0x3d')]));_0x5ba763['attributes']=_0x5ba763[_0x464a('0x3e')]['length']?_0x5ba763[_0x464a('0x3e')]:_0x898061['model'];if(_0x35dc2d[_0x464a('0x3a')]['includeAll']){_0x5ba763[_0x464a('0x4d')]=[{'all':!![]}];}_0x5ba763=_[_0x464a('0x46')]({},_0x5ba763,_0x35dc2d['options']);return db['VtigerConfiguration'][_0x464a('0x4e')](_0x5ba763)[_0x464a('0x1e')](handleEntityNotFound(_0x2c9b44,null))[_0x464a('0x1e')](respondWithResult(_0x2c9b44,null))['catch'](handleError(_0x2c9b44,null));};exports[_0x464a('0x4f')]=function(_0x4ae88f,_0xe3fefe){return db[_0x464a('0x36')]['create'](_0x4ae88f[_0x464a('0x50')],{})[_0x464a('0x1e')](respondWithResult(_0xe3fefe,0xc9))[_0x464a('0x4b')](handleError(_0xe3fefe,null));};exports['update']=function(_0x4524f7,_0x251ea9){if(_0x4524f7[_0x464a('0x50')]['id']){delete _0x4524f7['body']['id'];}return db[_0x464a('0x36')][_0x464a('0x4e')]({'where':{'id':_0x4524f7[_0x464a('0x51')]['id']}})[_0x464a('0x1e')](handleEntityNotFound(_0x251ea9,null))[_0x464a('0x1e')](saveUpdates(_0x4524f7[_0x464a('0x50')],null))['then'](respondWithResult(_0x251ea9,null))[_0x464a('0x4b')](handleError(_0x251ea9,null));};exports[_0x464a('0x31')]=function(_0x111ec2,_0x1340bc){return db[_0x464a('0x36')][_0x464a('0x4e')]({'where':{'id':_0x111ec2[_0x464a('0x51')]['id']}})[_0x464a('0x1e')](handleEntityNotFound(_0x1340bc,null))[_0x464a('0x1e')](removeEntity(_0x1340bc,null))[_0x464a('0x4b')](handleError(_0x1340bc,null));};exports[_0x464a('0x52')]=function(_0x48944c,_0x4cd7b5,_0x5e94a8){var _0x3fa735={};var _0x75f585={};var _0x2eb1dc;var _0xa0848d;return db[_0x464a('0x36')][_0x464a('0x53')]({'where':{'id':_0x48944c[_0x464a('0x51')]['id']}})[_0x464a('0x1e')](handleEntityNotFound(_0x4cd7b5,null))[_0x464a('0x1e')](function(_0x4f4371){if(_0x4f4371){_0x2eb1dc=_0x4f4371;_0x75f585['model']=_[_0x464a('0x4c')](db[_0x464a('0x54')][_0x464a('0x37')]);_0x75f585[_0x464a('0x3a')]=_[_0x464a('0x4c')](_0x48944c[_0x464a('0x3a')]);_0x75f585['filters']=_['intersection'](_0x75f585['model'],_0x75f585['query']);_0x3fa735[_0x464a('0x3e')]=_['intersection'](_0x75f585[_0x464a('0x39')],qs[_0x464a('0x3d')](_0x48944c[_0x464a('0x3a')]['fields']));_0x3fa735[_0x464a('0x3e')]=_0x3fa735[_0x464a('0x3e')][_0x464a('0x3f')]?_0x3fa735[_0x464a('0x3e')]:_0x75f585[_0x464a('0x39')];_0x3fa735[_0x464a('0x55')]=qs['sort'](_0x48944c['query'][_0x464a('0x42')]);_0x3fa735[_0x464a('0x43')]=qs[_0x464a('0x3b')](_[_0x464a('0x44')](_0x48944c[_0x464a('0x3a')],_0x75f585[_0x464a('0x3b')]));if(_0x48944c['query']['filter']){_0x3fa735[_0x464a('0x43')]=_[_0x464a('0x46')](_0x3fa735[_0x464a('0x43')],{'$or':_[_0x464a('0x35')](_0x3fa735['attributes'],function(_0x2201a4){var _0x35c32e={};_0x35c32e[_0x2201a4]={'$like':'%'+_0x48944c[_0x464a('0x3a')][_0x464a('0x45')]+'%'};return _0x35c32e;})});}_0x3fa735=_[_0x464a('0x46')]({},_0x3fa735,_0x48944c[_0x464a('0x48')]);return _0x2eb1dc[_0x464a('0x52')](_0x3fa735);}})['then'](function(_0x32fe44){if(_0x32fe44){_0xa0848d=_0x32fe44[_0x464a('0x3f')];if(!_0x48944c[_0x464a('0x3a')][_0x464a('0x56')](_0x464a('0x40'))){_0x3fa735['limit']=qs['limit'](_0x48944c[_0x464a('0x3a')][_0x464a('0x41')]);_0x3fa735['offset']=qs[_0x464a('0x2c')](_0x48944c['query']['offset']);}return _0x2eb1dc['getFields'](_0x3fa735);}})[_0x464a('0x1e')](function(_0x56de27){if(_0x56de27){return _0x56de27?{'count':_0xa0848d,'rows':_0x56de27}:null;}})[_0x464a('0x1e')](respondWithResult(_0x4cd7b5,null))[_0x464a('0x4b')](handleError(_0x4cd7b5,null));};exports[_0x464a('0x57')]=function(_0x50d39a,_0x550b83,_0x18d3f5){var _0x176eee={};var _0x461b81={};var _0x46a194;var _0x24c13a;return db[_0x464a('0x36')]['findOne']({'where':{'id':_0x50d39a[_0x464a('0x51')]['id']}})[_0x464a('0x1e')](handleEntityNotFound(_0x550b83,null))['then'](function(_0x56525d){if(_0x56525d){_0x46a194=_0x56525d;_0x461b81[_0x464a('0x39')]=_['keys'](db['VtigerField'][_0x464a('0x37')]);_0x461b81[_0x464a('0x3a')]=_[_0x464a('0x4c')](_0x50d39a[_0x464a('0x3a')]);_0x461b81[_0x464a('0x3b')]=_[_0x464a('0x3c')](_0x461b81['model'],_0x461b81['query']);_0x176eee['attributes']=_[_0x464a('0x3c')](_0x461b81[_0x464a('0x39')],qs[_0x464a('0x3d')](_0x50d39a[_0x464a('0x3a')]['fields']));_0x176eee[_0x464a('0x3e')]=_0x176eee[_0x464a('0x3e')][_0x464a('0x3f')]?_0x176eee[_0x464a('0x3e')]:_0x461b81[_0x464a('0x39')];_0x176eee['order']=qs[_0x464a('0x42')](_0x50d39a[_0x464a('0x3a')][_0x464a('0x42')]);_0x176eee['where']=qs[_0x464a('0x3b')](_[_0x464a('0x44')](_0x50d39a[_0x464a('0x3a')],_0x461b81[_0x464a('0x3b')]));if(_0x50d39a['query']['filter']){_0x176eee[_0x464a('0x43')]=_[_0x464a('0x46')](_0x176eee[_0x464a('0x43')],{'$or':_[_0x464a('0x35')](_0x176eee['attributes'],function(_0x5742ec){var _0x43eb18={};_0x43eb18[_0x5742ec]={'$like':'%'+_0x50d39a[_0x464a('0x3a')][_0x464a('0x45')]+'%'};return _0x43eb18;})});}_0x176eee=_[_0x464a('0x46')]({},_0x176eee,_0x50d39a[_0x464a('0x48')]);return _0x46a194[_0x464a('0x57')](_0x176eee);}})[_0x464a('0x1e')](function(_0x48b9d6){if(_0x48b9d6){_0x24c13a=_0x48b9d6[_0x464a('0x3f')];if(!_0x50d39a[_0x464a('0x3a')]['hasOwnProperty']('nolimit')){_0x176eee[_0x464a('0x41')]=qs[_0x464a('0x41')](_0x50d39a[_0x464a('0x3a')][_0x464a('0x41')]);_0x176eee['offset']=qs[_0x464a('0x2c')](_0x50d39a['query'][_0x464a('0x2c')]);}return _0x46a194['getSubjects'](_0x176eee);}})['then'](function(_0xac7f2f){if(_0xac7f2f){return _0xac7f2f?{'count':_0x24c13a,'rows':_0xac7f2f}:null;}})[_0x464a('0x1e')](respondWithResult(_0x550b83,null))[_0x464a('0x4b')](handleError(_0x550b83,null));};exports[_0x464a('0x58')]=function(_0x496bd5,_0x29454c,_0x5e1be2){var _0x9647={};var _0x3b2604={};var _0xc6d807;var _0x40fed3;return db[_0x464a('0x36')][_0x464a('0x53')]({'where':{'id':_0x496bd5['params']['id']}})[_0x464a('0x1e')](handleEntityNotFound(_0x29454c,null))['then'](function(_0x9cd97d){if(_0x9cd97d){_0xc6d807=_0x9cd97d;_0x3b2604[_0x464a('0x39')]=_[_0x464a('0x4c')](db[_0x464a('0x54')]['rawAttributes']);_0x3b2604[_0x464a('0x3a')]=_[_0x464a('0x4c')](_0x496bd5[_0x464a('0x3a')]);_0x3b2604[_0x464a('0x3b')]=_[_0x464a('0x3c')](_0x3b2604[_0x464a('0x39')],_0x3b2604[_0x464a('0x3a')]);_0x9647[_0x464a('0x3e')]=_[_0x464a('0x3c')](_0x3b2604['model'],qs[_0x464a('0x3d')](_0x496bd5[_0x464a('0x3a')][_0x464a('0x3d')]));_0x9647[_0x464a('0x3e')]=_0x9647[_0x464a('0x3e')]['length']?_0x9647[_0x464a('0x3e')]:_0x3b2604['model'];_0x9647[_0x464a('0x55')]=qs[_0x464a('0x42')](_0x496bd5[_0x464a('0x3a')][_0x464a('0x42')]);_0x9647[_0x464a('0x43')]=qs[_0x464a('0x3b')](_[_0x464a('0x44')](_0x496bd5[_0x464a('0x3a')],_0x3b2604['filters']));if(_0x496bd5[_0x464a('0x3a')][_0x464a('0x45')]){_0x9647['where']=_[_0x464a('0x46')](_0x9647[_0x464a('0x43')],{'$or':_[_0x464a('0x35')](_0x9647[_0x464a('0x3e')],function(_0x33dd60){var _0x5318ef={};_0x5318ef[_0x33dd60]={'$like':'%'+_0x496bd5[_0x464a('0x3a')][_0x464a('0x45')]+'%'};return _0x5318ef;})});}_0x9647=_['merge']({},_0x9647,_0x496bd5[_0x464a('0x48')]);return _0xc6d807[_0x464a('0x58')](_0x9647);}})[_0x464a('0x1e')](function(_0x34e347){if(_0x34e347){_0x40fed3=_0x34e347['length'];if(!_0x496bd5[_0x464a('0x3a')]['hasOwnProperty']('nolimit')){_0x9647[_0x464a('0x41')]=qs['limit'](_0x496bd5[_0x464a('0x3a')][_0x464a('0x41')]);_0x9647[_0x464a('0x2c')]=qs[_0x464a('0x2c')](_0x496bd5[_0x464a('0x3a')]['offset']);}return _0xc6d807[_0x464a('0x58')](_0x9647);}})[_0x464a('0x1e')](function(_0x4c8aca){if(_0x4c8aca){return _0x4c8aca?{'count':_0x40fed3,'rows':_0x4c8aca}:null;}})[_0x464a('0x1e')](respondWithResult(_0x29454c,null))['catch'](handleError(_0x29454c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 807ea5b..232970b 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 _0xbe9a=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x74e8b5,_0x190ea8){var _0xa0f960=function(_0x37581d){while(--_0x37581d){_0x74e8b5['push'](_0x74e8b5['shift']());}};_0xa0f960(++_0x190ea8);}(_0xbe9a,0x1e6));var _0xabe9=function(_0xaf047d,_0x32dd83){_0xaf047d=_0xaf047d-0x0;var _0x45504f=_0xbe9a[_0xaf047d];return _0x45504f;};'use strict';var _=require(_0xabe9('0x0'));var util=require(_0xabe9('0x1'));var logger=require(_0xabe9('0x2'))(_0xabe9('0x3'));var moment=require(_0xabe9('0x4'));var BPromise=require('bluebird');var rp=require(_0xabe9('0x5'));var fs=require('fs');var path=require(_0xabe9('0x6'));var rimraf=require(_0xabe9('0x7'));var config=require(_0xabe9('0x8'));var attributes=require(_0xabe9('0x9'));module['exports']=function(_0x58fa85,_0x5832f5){return _0x58fa85[_0xabe9('0xa')](_0xabe9('0xb'),attributes,{'tableName':_0xabe9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1678=['api','bluebird','path','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x278192,_0x337902){var _0x39df77=function(_0xa8ea7d){while(--_0xa8ea7d){_0x278192['push'](_0x278192['shift']());}};_0x39df77(++_0x337902);}(_0x1678,0x66));var _0x8167=function(_0x21405a,_0x192c00){_0x21405a=_0x21405a-0x0;var _0x28d49e=_0x1678[_0x21405a];return _0x28d49e;};'use strict';var _=require('lodash');var util=require(_0x8167('0x0'));var logger=require(_0x8167('0x1'))(_0x8167('0x2'));var moment=require('moment');var BPromise=require(_0x8167('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8167('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8167('0x5'));module['exports']=function(_0xebface,_0x5414f9){return _0xebface['define'](_0x8167('0x6'),attributes,{'tableName':_0x8167('0x7'),'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 2e09e60..e3d9871 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 _0x0961=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird'];(function(_0x3b4922,_0x25b030){var _0xab3838=function(_0x2097f8){while(--_0x2097f8){_0x3b4922['push'](_0x3b4922['shift']());}};_0xab3838(++_0x25b030);}(_0x0961,0x1cc));var _0x1096=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x0961[_0x589f71];return _0x5763bd;};'use strict';var _=require('lodash');var util=require(_0x1096('0x0'));var moment=require('moment');var BPromise=require(_0x1096('0x1'));var rs=require(_0x1096('0x2'));var fs=require('fs');var Redis=require(_0x1096('0x3'));var db=require(_0x1096('0x4'))['db'];var utils=require(_0x1096('0x5'));var logger=require(_0x1096('0x6'))('rpc');var config=require(_0x1096('0x7'));var jayson=require(_0x1096('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47f570,_0x4f120e,_0x15ac5d){return new BPromise(function(_0x3c0460,_0x2fea8f){return client[_0x1096('0x9')](_0x47f570,_0x15ac5d)[_0x1096('0xa')](function(_0x569146){logger[_0x1096('0xb')](_0x1096('0xc'),_0x4f120e,'request\x20sent');logger['debug'](_0x1096('0xd'),_0x4f120e,'request\x20sent',JSON[_0x1096('0xe')](_0x569146));if(_0x569146[_0x1096('0xf')]){if(_0x569146[_0x1096('0xf')][_0x1096('0x10')]===0x1f4){logger[_0x1096('0xf')](_0x1096('0xc'),_0x4f120e,_0x569146['error'][_0x1096('0x11')]);return _0x2fea8f(_0x569146[_0x1096('0xf')][_0x1096('0x11')]);}logger[_0x1096('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x4f120e,_0x569146[_0x1096('0xf')][_0x1096('0x11')]);return _0x3c0460(_0x569146['error'][_0x1096('0x11')]);}else{logger['info'](_0x1096('0xc'),_0x4f120e,_0x1096('0x12'));_0x3c0460(_0x569146[_0x1096('0x13')][_0x1096('0x11')]);}})[_0x1096('0x14')](function(_0x4a2902){logger[_0x1096('0xf')](_0x1096('0xc'),_0x4f120e,_0x4a2902);_0x2fea8f(_0x4a2902);});});} \ No newline at end of file +var _0xfc27=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x1ee215,_0x21f401){var _0xe71a24=function(_0x31300a){while(--_0x31300a){_0x1ee215['push'](_0x1ee215['shift']());}};_0xe71a24(++_0x21f401);}(_0xfc27,0xb4));var _0x7fc2=function(_0x6f40e6,_0x4fc4c3){_0x6f40e6=_0x6f40e6-0x0;var _0x25fc5a=_0xfc27[_0x6f40e6];return _0x25fc5a;};'use strict';var _=require('lodash');var util=require(_0x7fc2('0x0'));var moment=require(_0x7fc2('0x1'));var BPromise=require(_0x7fc2('0x2'));var rs=require(_0x7fc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fc2('0x4'))['db'];var utils=require(_0x7fc2('0x5'));var logger=require(_0x7fc2('0x6'))(_0x7fc2('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fc2('0x8'));var client=jayson[_0x7fc2('0x9')][_0x7fc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f5e57,_0x4be7d4,_0x23d3d0){return new BPromise(function(_0xc79d81,_0x100710){return client['request'](_0x2f5e57,_0x23d3d0)[_0x7fc2('0xb')](function(_0x1c4e77){logger[_0x7fc2('0xc')](_0x7fc2('0xd'),_0x4be7d4,_0x7fc2('0xe'));logger[_0x7fc2('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4be7d4,_0x7fc2('0xe'),JSON['stringify'](_0x1c4e77));if(_0x1c4e77[_0x7fc2('0x10')]){if(_0x1c4e77[_0x7fc2('0x10')][_0x7fc2('0x11')]===0x1f4){logger[_0x7fc2('0x10')](_0x7fc2('0xd'),_0x4be7d4,_0x1c4e77['error']['message']);return _0x100710(_0x1c4e77['error'][_0x7fc2('0x12')]);}logger[_0x7fc2('0x10')](_0x7fc2('0xd'),_0x4be7d4,_0x1c4e77[_0x7fc2('0x10')]['message']);return _0xc79d81(_0x1c4e77['error'][_0x7fc2('0x12')]);}else{logger[_0x7fc2('0xc')](_0x7fc2('0xd'),_0x4be7d4,_0x7fc2('0xe'));_0xc79d81(_0x1c4e77[_0x7fc2('0x13')][_0x7fc2('0x12')]);}})['catch'](function(_0x3ff99a){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4be7d4,_0x3ff99a);_0x100710(_0x3ff99a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 92b35e4..3194c94 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 _0x7ce6=['index','get','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2b9111,_0xc60067){var _0x4bf35b=function(_0x2bbd4d){while(--_0x2bbd4d){_0x2b9111['push'](_0x2b9111['shift']());}};_0x4bf35b(++_0xc60067);}(_0x7ce6,0x184));var _0x67ce=function(_0x34b4df,_0xed778){_0x34b4df=_0x34b4df-0x0;var _0x3c0019=_0x7ce6[_0x34b4df];return _0x3c0019;};'use strict';var multer=require(_0x67ce('0x0'));var util=require('util');var path=require(_0x67ce('0x1'));var timeout=require('connect-timeout');var express=require(_0x67ce('0x2'));var router=express[_0x67ce('0x3')]();var auth=require(_0x67ce('0x4'));var interaction=require(_0x67ce('0x5'));var config=require(_0x67ce('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x67ce('0x7')](),controller[_0x67ce('0x8')]);router[_0x67ce('0x9')](_0x67ce('0xa'),auth[_0x67ce('0x7')](),controller[_0x67ce('0xb')]);router['post']('/',auth[_0x67ce('0x7')](),controller[_0x67ce('0xc')]);router[_0x67ce('0xd')](_0x67ce('0xa'),auth[_0x67ce('0x7')](),controller[_0x67ce('0xe')]);router[_0x67ce('0xf')](_0x67ce('0xa'),auth[_0x67ce('0x7')](),controller[_0x67ce('0x10')]);module[_0x67ce('0x11')]=router; \ No newline at end of file +var _0xcfe5=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcfe5,0x115));var _0x5cfe=function(_0x30ac04,_0x365f1b){_0x30ac04=_0x30ac04-0x0;var _0x56b497=_0xcfe5[_0x30ac04];return _0x56b497;};'use strict';var multer=require(_0x5cfe('0x0'));var util=require(_0x5cfe('0x1'));var path=require(_0x5cfe('0x2'));var timeout=require(_0x5cfe('0x3'));var express=require(_0x5cfe('0x4'));var router=express[_0x5cfe('0x5')]();var auth=require(_0x5cfe('0x6'));var interaction=require(_0x5cfe('0x7'));var config=require(_0x5cfe('0x8'));var controller=require(_0x5cfe('0x9'));router[_0x5cfe('0xa')]('/',auth['isAuthenticated'](),controller[_0x5cfe('0xb')]);router[_0x5cfe('0xa')](_0x5cfe('0xc'),auth[_0x5cfe('0xd')](),controller[_0x5cfe('0xe')]);router[_0x5cfe('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5cfe('0x10')](_0x5cfe('0xc'),auth[_0x5cfe('0xd')](),controller[_0x5cfe('0x11')]);router[_0x5cfe('0x12')](_0x5cfe('0xc'),auth[_0x5cfe('0xd')](),controller[_0x5cfe('0x13')]);module[_0x5cfe('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 7478586..3744d56 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 _0x938a=['customVariable','sequelize','exports','ENUM','string','keyValue','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x938a,0x1f2));var _0xa938=function(_0x279d58,_0x45446a){_0x279d58=_0x279d58-0x0;var _0x27d6e1=_0x938a[_0x279d58];return _0x27d6e1;};'use strict';var Sequelize=require(_0xa938('0x0'));module[_0xa938('0x1')]={'type':{'type':Sequelize[_0xa938('0x2')](_0xa938('0x3'),'variable','customVariable',_0xa938('0x4')),'defaultValue':_0xa938('0x3')},'content':{'type':Sequelize[_0xa938('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa938('0x2')](_0xa938('0x3'),'variable',_0xa938('0x6'))},'keyContent':{'type':Sequelize[_0xa938('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa938('0x5')]}}; \ No newline at end of file +var _0x97f6=['variable','customVariable','keyValue','STRING','string'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x97f6,0x199));var _0x697f=function(_0xacbb95,_0x466526){_0xacbb95=_0xacbb95-0x0;var _0x560048=_0x97f6[_0xacbb95];return _0x560048;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x697f('0x0'),_0x697f('0x1'),_0x697f('0x2'),_0x697f('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x697f('0x4')]},'key':{'type':Sequelize[_0x697f('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x697f('0x0'),_0x697f('0x1'),_0x697f('0x2'))},'keyContent':{'type':Sequelize[_0x697f('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x697f('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x697f('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 6567f6b..283df47 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 _0xc622=['offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','VtigerField','includeAll','findAll','rows','params','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','json','count'];(function(_0x290801,_0x3bf9b5){var _0x2271c3=function(_0x771660){while(--_0x771660){_0x290801['push'](_0x290801['shift']());}};_0x2271c3(++_0x3bf9b5);}(_0xc622,0xb5));var _0x2c62=function(_0x12b71a,_0x5a0f68){_0x12b71a=_0x12b71a-0x0;var _0xfa09c6=_0xc622[_0x12b71a];return _0xfa09c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c62('0x0'));var rimraf=require(_0x2c62('0x1'));var zipdir=require(_0x2c62('0x2'));var jsonpatch=require(_0x2c62('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2c62('0x4'));var Mustache=require('mustache');var util=require(_0x2c62('0x5'));var path=require('path');var sox=require(_0x2c62('0x6'));var csv=require(_0x2c62('0x7'));var ejs=require(_0x2c62('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c62('0x9'));var crypto=require(_0x2c62('0xa'));var jsforce=require(_0x2c62('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2c62('0x7'));var querystring=require(_0x2c62('0xc'));var Papa=require(_0x2c62('0xd'));var Redis=require('ioredis');var authService=require(_0x2c62('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2c62('0xf'));var hardwareService=require(_0x2c62('0x10'));var logger=require(_0x2c62('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x2c62('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fb9f0,_0x559990){_0x559990=_0x559990||0xcc;return function(_0x23277b){if(_0x23277b){return _0x3fb9f0[_0x2c62('0x13')](_0x559990);}return _0x3fb9f0['status'](_0x559990)[_0x2c62('0x14')]();};}function respondWithResult(_0x1f5e70,_0x57865a){_0x57865a=_0x57865a||0xc8;return function(_0x4ec553){if(_0x4ec553){return _0x1f5e70['status'](_0x57865a)[_0x2c62('0x15')](_0x4ec553);}};}function respondWithFilteredResult(_0x61ac34,_0xe304a8){return function(_0x1e7cd0){if(_0x1e7cd0){var _0x3b244c=_0x1e7cd0[_0x2c62('0x16')],_0x3d7715=_0xe304a8[_0x2c62('0x17')],_0x5ea34a=_0xe304a8[_0x2c62('0x17')]+_0xe304a8[_0x2c62('0x18')],_0x55e816;if(_0x5ea34a>=_0x3b244c){_0x5ea34a=_0x3b244c;_0x55e816=0xc8;}else{_0x55e816=0xce;}_0x61ac34[_0x2c62('0x19')](_0x55e816);return _0x61ac34[_0x2c62('0x1a')](_0x2c62('0x1b'),_0x3d7715+'-'+_0x5ea34a+'/'+_0x3b244c)[_0x2c62('0x15')](_0x1e7cd0);}return null;};}function patchUpdates(_0x4e9486){return function(_0x4f6b19){try{jsonpatch[_0x2c62('0x1c')](_0x4f6b19,_0x4e9486,!![]);}catch(_0xc2eb68){return BPromise[_0x2c62('0x1d')](_0xc2eb68);}return _0x4f6b19[_0x2c62('0x1e')]();};}function saveUpdates(_0x4765a1,_0x16d56f){return function(_0x1ce946){if(_0x1ce946){return _0x1ce946['update'](_0x4765a1)[_0x2c62('0x1f')](function(_0xfcd90a){return _0xfcd90a;});}return null;};}function removeEntity(_0x47a871,_0x3ea126){return function(_0x58f194){if(_0x58f194){return _0x58f194[_0x2c62('0x20')]()[_0x2c62('0x1f')](function(){_0x47a871[_0x2c62('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x223377,_0x32aadb){return function(_0x24f709){if(!_0x24f709){_0x223377['sendStatus'](0x194);}return _0x24f709;};}function handleError(_0x4df2ab,_0x357b8b){_0x357b8b=_0x357b8b||0x1f4;return function(_0x13ad92){logger['error'](_0x13ad92[_0x2c62('0x21')]);if(_0x13ad92[_0x2c62('0x22')]){delete _0x13ad92[_0x2c62('0x22')];}_0x4df2ab['status'](_0x357b8b)['send'](_0x13ad92);};}exports[_0x2c62('0x23')]=function(_0x13de98,_0x3c7cb1){var _0x4b4d07={},_0x380d3c={},_0x4b65ac={'count':0x0,'rows':[]};var _0x33afc5=_[_0x2c62('0x24')](db['VtigerField'][_0x2c62('0x25')],function(_0x12e856){return{'name':_0x12e856[_0x2c62('0x26')],'type':_0x12e856['type'][_0x2c62('0x27')]};});_0x380d3c[_0x2c62('0x28')]=_[_0x2c62('0x24')](_0x33afc5,_0x2c62('0x22'));_0x380d3c[_0x2c62('0x29')]=_[_0x2c62('0x2a')](_0x13de98[_0x2c62('0x29')]);_0x380d3c[_0x2c62('0x2b')]=_[_0x2c62('0x2c')](_0x380d3c[_0x2c62('0x28')],_0x380d3c[_0x2c62('0x29')]);_0x4b4d07[_0x2c62('0x2d')]=_['intersection'](_0x380d3c[_0x2c62('0x28')],qs[_0x2c62('0x2e')](_0x13de98['query'][_0x2c62('0x2e')]));_0x4b4d07[_0x2c62('0x2d')]=_0x4b4d07['attributes'][_0x2c62('0x2f')]?_0x4b4d07['attributes']:_0x380d3c[_0x2c62('0x28')];if(!_0x13de98['query']['hasOwnProperty'](_0x2c62('0x30'))){_0x4b4d07['limit']=qs[_0x2c62('0x18')](_0x13de98[_0x2c62('0x29')][_0x2c62('0x18')]);_0x4b4d07[_0x2c62('0x17')]=qs[_0x2c62('0x17')](_0x13de98['query']['offset']);}_0x4b4d07[_0x2c62('0x31')]=qs[_0x2c62('0x32')](_0x13de98[_0x2c62('0x29')]['sort']);_0x4b4d07['where']=qs[_0x2c62('0x2b')](_[_0x2c62('0x33')](_0x13de98[_0x2c62('0x29')],_0x380d3c['filters']),_0x33afc5);if(_0x13de98[_0x2c62('0x29')][_0x2c62('0x34')]){_0x4b4d07[_0x2c62('0x35')]=_[_0x2c62('0x36')](_0x4b4d07[_0x2c62('0x35')],{'$or':_[_0x2c62('0x24')](_0x33afc5,function(_0x4aa8e5){if(_0x4aa8e5[_0x2c62('0x37')]!=='VIRTUAL'){var _0x332869={};_0x332869[_0x4aa8e5['name']]={'$like':'%'+_0x13de98['query']['filter']+'%'};return _0x332869;}})});}_0x4b4d07=_[_0x2c62('0x36')]({},_0x4b4d07,_0x13de98[_0x2c62('0x38')]);var _0x599cdb={'where':_0x4b4d07[_0x2c62('0x35')]};return db[_0x2c62('0x39')][_0x2c62('0x16')](_0x599cdb)[_0x2c62('0x1f')](function(_0x59b315){_0x4b65ac['count']=_0x59b315;if(_0x13de98[_0x2c62('0x29')][_0x2c62('0x3a')]){_0x4b4d07['include']=[{'all':!![]}];}return db['VtigerField'][_0x2c62('0x3b')](_0x4b4d07);})['then'](function(_0xfac5be){_0x4b65ac[_0x2c62('0x3c')]=_0xfac5be;return _0x4b65ac;})[_0x2c62('0x1f')](respondWithFilteredResult(_0x3c7cb1,_0x4b4d07))['catch'](handleError(_0x3c7cb1,null));};exports['show']=function(_0x66cf81,_0x4fd771){var _0x1bb1f9={'raw':!![],'where':{'id':_0x66cf81[_0x2c62('0x3d')]['id']}},_0x313364={};_0x313364[_0x2c62('0x28')]=_[_0x2c62('0x2a')](db['VtigerField']['rawAttributes']);_0x313364[_0x2c62('0x29')]=_[_0x2c62('0x2a')](_0x66cf81[_0x2c62('0x29')]);_0x313364['filters']=_[_0x2c62('0x2c')](_0x313364[_0x2c62('0x28')],_0x313364[_0x2c62('0x29')]);_0x1bb1f9[_0x2c62('0x2d')]=_[_0x2c62('0x2c')](_0x313364['model'],qs[_0x2c62('0x2e')](_0x66cf81['query']['fields']));_0x1bb1f9[_0x2c62('0x2d')]=_0x1bb1f9['attributes'][_0x2c62('0x2f')]?_0x1bb1f9[_0x2c62('0x2d')]:_0x313364[_0x2c62('0x28')];if(_0x66cf81[_0x2c62('0x29')][_0x2c62('0x3a')]){_0x1bb1f9[_0x2c62('0x3e')]=[{'all':!![]}];}_0x1bb1f9=_[_0x2c62('0x36')]({},_0x1bb1f9,_0x66cf81[_0x2c62('0x38')]);return db[_0x2c62('0x39')][_0x2c62('0x3f')](_0x1bb1f9)[_0x2c62('0x1f')](handleEntityNotFound(_0x4fd771,null))[_0x2c62('0x1f')](respondWithResult(_0x4fd771,null))[_0x2c62('0x40')](handleError(_0x4fd771,null));};exports[_0x2c62('0x41')]=function(_0x67789a,_0xeeb052){return db[_0x2c62('0x39')]['create'](_0x67789a[_0x2c62('0x42')],{})[_0x2c62('0x1f')](respondWithResult(_0xeeb052,0xc9))[_0x2c62('0x40')](handleError(_0xeeb052,null));};exports[_0x2c62('0x43')]=function(_0x288855,_0x4eb497){if(_0x288855[_0x2c62('0x42')]['id']){delete _0x288855[_0x2c62('0x42')]['id'];}return db[_0x2c62('0x39')][_0x2c62('0x3f')]({'where':{'id':_0x288855[_0x2c62('0x3d')]['id']}})[_0x2c62('0x1f')](handleEntityNotFound(_0x4eb497,null))['then'](saveUpdates(_0x288855[_0x2c62('0x42')],null))[_0x2c62('0x1f')](respondWithResult(_0x4eb497,null))[_0x2c62('0x40')](handleError(_0x4eb497,null));};exports[_0x2c62('0x20')]=function(_0x258301,_0x3443bb){return db[_0x2c62('0x39')][_0x2c62('0x3f')]({'where':{'id':_0x258301[_0x2c62('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3443bb,null))[_0x2c62('0x1f')](removeEntity(_0x3443bb,null))['catch'](handleError(_0x3443bb,null));}; \ No newline at end of file +var _0x409d=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerField','fieldName'];(function(_0x2bf8c6,_0x314fff){var _0x28bf19=function(_0xddccf6){while(--_0xddccf6){_0x2bf8c6['push'](_0x2bf8c6['shift']());}};_0x28bf19(++_0x314fff);}(_0x409d,0x195));var _0xd409=function(_0x362f63,_0x505e9b){_0x362f63=_0x362f63-0x0;var _0xf62a8d=_0x409d[_0x362f63];return _0xf62a8d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd409('0x0'));var rimraf=require(_0xd409('0x1'));var zipdir=require(_0xd409('0x2'));var jsonpatch=require(_0xd409('0x3'));var rp=require(_0xd409('0x4'));var moment=require(_0xd409('0x5'));var BPromise=require(_0xd409('0x6'));var Mustache=require(_0xd409('0x7'));var util=require(_0xd409('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd409('0x9'));var ejs=require(_0xd409('0xa'));var fs=require('fs');var _=require(_0xd409('0xb'));var squel=require(_0xd409('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd409('0x9'));var querystring=require(_0xd409('0xd'));var Papa=require(_0xd409('0xe'));var Redis=require(_0xd409('0xf'));var authService=require(_0xd409('0x10'));var qs=require(_0xd409('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd409('0x12'));var logger=require(_0xd409('0x13'))(_0xd409('0x14'));var utils=require(_0xd409('0x15'));var config=require(_0xd409('0x16'));var db=require(_0xd409('0x17'))['db'];function respondWithStatusCode(_0x1cc65c,_0x1a8098){_0x1a8098=_0x1a8098||0xcc;return function(_0x44dc57){if(_0x44dc57){return _0x1cc65c[_0xd409('0x18')](_0x1a8098);}return _0x1cc65c[_0xd409('0x19')](_0x1a8098)[_0xd409('0x1a')]();};}function respondWithResult(_0x58e9ed,_0x34a23f){_0x34a23f=_0x34a23f||0xc8;return function(_0x397ce0){if(_0x397ce0){return _0x58e9ed[_0xd409('0x19')](_0x34a23f)[_0xd409('0x1b')](_0x397ce0);}};}function respondWithFilteredResult(_0x35c2bc,_0x4558e2){return function(_0x1e4d14){if(_0x1e4d14){var _0x567a28=_0x1e4d14[_0xd409('0x1c')],_0x13ae22=_0x4558e2[_0xd409('0x1d')],_0x2ae87a=_0x4558e2['offset']+_0x4558e2[_0xd409('0x1e')],_0x11d627;if(_0x2ae87a>=_0x567a28){_0x2ae87a=_0x567a28;_0x11d627=0xc8;}else{_0x11d627=0xce;}_0x35c2bc[_0xd409('0x19')](_0x11d627);return _0x35c2bc['set'](_0xd409('0x1f'),_0x13ae22+'-'+_0x2ae87a+'/'+_0x567a28)['json'](_0x1e4d14);}return null;};}function patchUpdates(_0xf88e49){return function(_0x178483){try{jsonpatch[_0xd409('0x20')](_0x178483,_0xf88e49,!![]);}catch(_0x18a150){return BPromise[_0xd409('0x21')](_0x18a150);}return _0x178483[_0xd409('0x22')]();};}function saveUpdates(_0x56a568,_0x2afae8){return function(_0x18139e){if(_0x18139e){return _0x18139e[_0xd409('0x23')](_0x56a568)[_0xd409('0x24')](function(_0x1c51b9){return _0x1c51b9;});}return null;};}function removeEntity(_0x33ff43,_0x2d457c){return function(_0x3fc2f5){if(_0x3fc2f5){return _0x3fc2f5[_0xd409('0x25')]()[_0xd409('0x24')](function(){_0x33ff43[_0xd409('0x19')](0xcc)[_0xd409('0x1a')]();});}};}function handleEntityNotFound(_0x2f6bce,_0x74b1f5){return function(_0x290298){if(!_0x290298){_0x2f6bce[_0xd409('0x18')](0x194);}return _0x290298;};}function handleError(_0x390cbf,_0x18f705){_0x18f705=_0x18f705||0x1f4;return function(_0x3f8f14){logger[_0xd409('0x26')](_0x3f8f14[_0xd409('0x27')]);if(_0x3f8f14['name']){delete _0x3f8f14[_0xd409('0x28')];}_0x390cbf[_0xd409('0x19')](_0x18f705)[_0xd409('0x29')](_0x3f8f14);};}exports['index']=function(_0x41a967,_0x1bfab1){var _0x55a319={},_0x358de7={},_0x1b180c={'count':0x0,'rows':[]};var _0x15406b=_[_0xd409('0x2a')](db[_0xd409('0x2b')]['rawAttributes'],function(_0x2c5fab){return{'name':_0x2c5fab[_0xd409('0x2c')],'type':_0x2c5fab['type'][_0xd409('0x2d')]};});_0x358de7[_0xd409('0x2e')]=_[_0xd409('0x2a')](_0x15406b,_0xd409('0x28'));_0x358de7[_0xd409('0x2f')]=_[_0xd409('0x30')](_0x41a967['query']);_0x358de7['filters']=_[_0xd409('0x31')](_0x358de7['model'],_0x358de7[_0xd409('0x2f')]);_0x55a319[_0xd409('0x32')]=_[_0xd409('0x31')](_0x358de7[_0xd409('0x2e')],qs[_0xd409('0x33')](_0x41a967['query'][_0xd409('0x33')]));_0x55a319[_0xd409('0x32')]=_0x55a319[_0xd409('0x32')][_0xd409('0x34')]?_0x55a319['attributes']:_0x358de7[_0xd409('0x2e')];if(!_0x41a967[_0xd409('0x2f')][_0xd409('0x35')]('nolimit')){_0x55a319[_0xd409('0x1e')]=qs['limit'](_0x41a967['query']['limit']);_0x55a319['offset']=qs[_0xd409('0x1d')](_0x41a967[_0xd409('0x2f')][_0xd409('0x1d')]);}_0x55a319[_0xd409('0x36')]=qs[_0xd409('0x37')](_0x41a967[_0xd409('0x2f')]['sort']);_0x55a319[_0xd409('0x38')]=qs[_0xd409('0x39')](_[_0xd409('0x3a')](_0x41a967[_0xd409('0x2f')],_0x358de7[_0xd409('0x39')]),_0x15406b);if(_0x41a967[_0xd409('0x2f')][_0xd409('0x3b')]){_0x55a319['where']=_[_0xd409('0x3c')](_0x55a319[_0xd409('0x38')],{'$or':_[_0xd409('0x2a')](_0x15406b,function(_0x2115af){if(_0x2115af[_0xd409('0x3d')]!==_0xd409('0x3e')){var _0x2e25c9={};_0x2e25c9[_0x2115af[_0xd409('0x28')]]={'$like':'%'+_0x41a967[_0xd409('0x2f')]['filter']+'%'};return _0x2e25c9;}})});}_0x55a319=_[_0xd409('0x3c')]({},_0x55a319,_0x41a967[_0xd409('0x3f')]);var _0xa6bab7={'where':_0x55a319['where']};return db[_0xd409('0x2b')][_0xd409('0x1c')](_0xa6bab7)['then'](function(_0x2f2747){_0x1b180c[_0xd409('0x1c')]=_0x2f2747;if(_0x41a967[_0xd409('0x2f')][_0xd409('0x40')]){_0x55a319[_0xd409('0x41')]=[{'all':!![]}];}return db['VtigerField'][_0xd409('0x42')](_0x55a319);})[_0xd409('0x24')](function(_0x21751f){_0x1b180c[_0xd409('0x43')]=_0x21751f;return _0x1b180c;})[_0xd409('0x24')](respondWithFilteredResult(_0x1bfab1,_0x55a319))['catch'](handleError(_0x1bfab1,null));};exports[_0xd409('0x44')]=function(_0x3fc04b,_0x194576){var _0x20290c={'raw':!![],'where':{'id':_0x3fc04b[_0xd409('0x45')]['id']}},_0x453eef={};_0x453eef[_0xd409('0x2e')]=_[_0xd409('0x30')](db[_0xd409('0x2b')][_0xd409('0x46')]);_0x453eef['query']=_['keys'](_0x3fc04b['query']);_0x453eef[_0xd409('0x39')]=_[_0xd409('0x31')](_0x453eef[_0xd409('0x2e')],_0x453eef[_0xd409('0x2f')]);_0x20290c['attributes']=_[_0xd409('0x31')](_0x453eef[_0xd409('0x2e')],qs[_0xd409('0x33')](_0x3fc04b[_0xd409('0x2f')][_0xd409('0x33')]));_0x20290c['attributes']=_0x20290c[_0xd409('0x32')]['length']?_0x20290c[_0xd409('0x32')]:_0x453eef['model'];if(_0x3fc04b[_0xd409('0x2f')][_0xd409('0x40')]){_0x20290c[_0xd409('0x41')]=[{'all':!![]}];}_0x20290c=_[_0xd409('0x3c')]({},_0x20290c,_0x3fc04b[_0xd409('0x3f')]);return db[_0xd409('0x2b')][_0xd409('0x47')](_0x20290c)[_0xd409('0x24')](handleEntityNotFound(_0x194576,null))['then'](respondWithResult(_0x194576,null))[_0xd409('0x48')](handleError(_0x194576,null));};exports[_0xd409('0x49')]=function(_0xcade9f,_0x2650c0){return db[_0xd409('0x2b')]['create'](_0xcade9f[_0xd409('0x4a')],{})[_0xd409('0x24')](respondWithResult(_0x2650c0,0xc9))[_0xd409('0x48')](handleError(_0x2650c0,null));};exports[_0xd409('0x23')]=function(_0x2cdac1,_0xf84b64){if(_0x2cdac1[_0xd409('0x4a')]['id']){delete _0x2cdac1[_0xd409('0x4a')]['id'];}return db[_0xd409('0x2b')]['find']({'where':{'id':_0x2cdac1[_0xd409('0x45')]['id']}})[_0xd409('0x24')](handleEntityNotFound(_0xf84b64,null))['then'](saveUpdates(_0x2cdac1[_0xd409('0x4a')],null))[_0xd409('0x24')](respondWithResult(_0xf84b64,null))[_0xd409('0x48')](handleError(_0xf84b64,null));};exports[_0xd409('0x25')]=function(_0x344d76,_0x5ec8d9){return db[_0xd409('0x2b')][_0xd409('0x47')]({'where':{'id':_0x344d76[_0xd409('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ec8d9,null))[_0xd409('0x24')](removeEntity(_0x5ec8d9,null))['catch'](handleError(_0x5ec8d9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 91d9f37..3cddf34 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['define','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5024c7,_0xd560bd){_0x5024c7=_0x5024c7-0x0;var _0xf2f316=_0xbdb7[_0x5024c7];return _0xf2f316;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7bdb('0xb'),'fields':[_0x7bdb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['VtigerField','int_vtiger_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','define'];(function(_0x48c5e6,_0x1bd5d3){var _0xce37c0=function(_0x1aaa08){while(--_0x1aaa08){_0x48c5e6['push'](_0x48c5e6['shift']());}};_0xce37c0(++_0x1bd5d3);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x49c4('0xa'),_0x49c4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index b47d572..e58a29b 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 _0xbc9d=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x12d05f,_0x521393){_0x12d05f=_0x12d05f-0x0;var _0x5bf7a6=_0xbc9d[_0x12d05f];return _0x5bf7a6;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381a0e,_0x4a9246,_0x2dbd23){return new BPromise(function(_0x181f8a,_0x3d4918){return client['request'](_0x381a0e,_0x2dbd23)[_0xdbc9('0xb')](function(_0x53cff1){logger['info'](_0xdbc9('0xc'),_0x4a9246,_0xdbc9('0xd'));logger[_0xdbc9('0xe')](_0xdbc9('0xf'),_0x4a9246,'request\x20sent',JSON[_0xdbc9('0x10')](_0x53cff1));if(_0x53cff1[_0xdbc9('0x11')]){if(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x12')]===0x1f4){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1['error']['message']);return _0x3d4918(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1[_0xdbc9('0x11')]['message']);return _0x181f8a(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}else{logger[_0xdbc9('0x14')]('VtigerField,\x20%s,\x20%s',_0x4a9246,_0xdbc9('0xd'));_0x181f8a(_0x53cff1[_0xdbc9('0x15')]['message']);}})[_0xdbc9('0x16')](function(_0x37856d){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x37856d);_0x3d4918(_0x37856d);});});} \ No newline at end of file +var _0x2d93=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b9d23,_0x437c38){var _0x56985a=function(_0x59237e){while(--_0x59237e){_0x5b9d23['push'](_0x5b9d23['shift']());}};_0x56985a(++_0x437c38);}(_0x2d93,0xf3));var _0x32d9=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x2d93[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var moment=require(_0x32d9('0x2'));var BPromise=require(_0x32d9('0x3'));var rs=require(_0x32d9('0x4'));var fs=require('fs');var Redis=require(_0x32d9('0x5'));var db=require(_0x32d9('0x6'))['db'];var utils=require(_0x32d9('0x7'));var logger=require(_0x32d9('0x8'))(_0x32d9('0x9'));var config=require(_0x32d9('0xa'));var jayson=require(_0x32d9('0xb'));var client=jayson[_0x32d9('0xc')][_0x32d9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4d2424,_0x161a9f,_0x12c49f){return new BPromise(function(_0x42cec8,_0x43dd2c){return client[_0x32d9('0xe')](_0x4d2424,_0x12c49f)['then'](function(_0x21df58){logger[_0x32d9('0xf')](_0x32d9('0x10'),_0x161a9f,_0x32d9('0x11'));logger[_0x32d9('0x12')](_0x32d9('0x13'),_0x161a9f,_0x32d9('0x11'),JSON[_0x32d9('0x14')](_0x21df58));if(_0x21df58[_0x32d9('0x15')]){if(_0x21df58[_0x32d9('0x15')][_0x32d9('0x16')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x161a9f,_0x21df58[_0x32d9('0x15')][_0x32d9('0x17')]);return _0x43dd2c(_0x21df58[_0x32d9('0x15')][_0x32d9('0x17')]);}logger[_0x32d9('0x15')](_0x32d9('0x10'),_0x161a9f,_0x21df58[_0x32d9('0x15')][_0x32d9('0x17')]);return _0x42cec8(_0x21df58[_0x32d9('0x15')][_0x32d9('0x17')]);}else{logger[_0x32d9('0xf')](_0x32d9('0x10'),_0x161a9f,'request\x20sent');_0x42cec8(_0x21df58[_0x32d9('0x18')][_0x32d9('0x17')]);}})['catch'](function(_0x24ab70){logger[_0x32d9('0x15')](_0x32d9('0x10'),_0x161a9f,_0x24ab70);_0x43dd2c(_0x24ab70);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2ccb10b..d74aac2 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 _0xd98c=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util'];(function(_0x21fded,_0x203183){var _0x5927de=function(_0x1e5762){while(--_0x1e5762){_0x21fded['push'](_0x21fded['shift']());}};_0x5927de(++_0x203183);}(_0xd98c,0x129));var _0xcd98=function(_0x3619b2,_0xfb1234){_0x3619b2=_0x3619b2-0x0;var _0x1dc91e=_0xd98c[_0x3619b2];return _0x1dc91e;};'use strict';var multer=require(_0xcd98('0x0'));var util=require(_0xcd98('0x1'));var path=require('path');var timeout=require(_0xcd98('0x2'));var express=require(_0xcd98('0x3'));var router=express[_0xcd98('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd98('0x5'));var config=require(_0xcd98('0x6'));var controller=require(_0xcd98('0x7'));router[_0xcd98('0x8')]('/',auth[_0xcd98('0x9')](),controller[_0xcd98('0xa')]);router[_0xcd98('0x8')](_0xcd98('0xb'),auth['isAuthenticated'](),controller[_0xcd98('0xc')]);router[_0xcd98('0x8')](_0xcd98('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xcd98('0xe'),auth[_0xcd98('0x9')](),controller[_0xcd98('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd98('0x10')]);router[_0xcd98('0x11')]('/:id/configurations',auth[_0xcd98('0x9')](),controller['addConfiguration']);router[_0xcd98('0x12')](_0xcd98('0xb'),auth[_0xcd98('0x9')](),controller[_0xcd98('0x13')]);router[_0xcd98('0x14')](_0xcd98('0xb'),auth['isAuthenticated'](),controller[_0xcd98('0x15')]);module[_0xcd98('0x16')]=router; \ No newline at end of file +var _0xeb88=['update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','put','/:id'];(function(_0x1113ce,_0x314645){var _0x3aefb8=function(_0x19ded2){while(--_0x19ded2){_0x1113ce['push'](_0x1113ce['shift']());}};_0x3aefb8(++_0x314645);}(_0xeb88,0xc0));var _0x8eb8=function(_0x3edd80,_0x4fff6f){_0x3edd80=_0x3edd80-0x0;var _0x580be5=_0xeb88[_0x3edd80];return _0x580be5;};'use strict';var multer=require('multer');var util=require(_0x8eb8('0x0'));var path=require('path');var timeout=require(_0x8eb8('0x1'));var express=require(_0x8eb8('0x2'));var router=express[_0x8eb8('0x3')]();var auth=require(_0x8eb8('0x4'));var interaction=require(_0x8eb8('0x5'));var config=require('../../config/environment');var controller=require(_0x8eb8('0x6'));router[_0x8eb8('0x7')]('/',auth[_0x8eb8('0x8')](),controller[_0x8eb8('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8eb8('0xa')]);router[_0x8eb8('0x7')]('/:id/configurations',auth[_0x8eb8('0x8')](),controller[_0x8eb8('0xb')]);router[_0x8eb8('0x7')](_0x8eb8('0xc'),auth['isAuthenticated'](),controller[_0x8eb8('0xd')]);router[_0x8eb8('0xe')]('/',auth[_0x8eb8('0x8')](),controller[_0x8eb8('0xf')]);router['post']('/:id/configurations',auth[_0x8eb8('0x8')](),controller['addConfiguration']);router[_0x8eb8('0x10')](_0x8eb8('0x11'),auth['isAuthenticated'](),controller[_0x8eb8('0x12')]);router[_0x8eb8('0x13')](_0x8eb8('0x11'),auth[_0x8eb8('0x8')](),controller[_0x8eb8('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 17f4399..cc8f79c 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 _0xb833=['password','token','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb833,0x1e9));var _0x3b83=function(_0x1197aa,_0x13d14d){_0x1197aa=_0x1197aa-0x0;var _0x11eda7=_0xb833[_0x1197aa];return _0x11eda7;};'use strict';var Sequelize=require(_0x3b83('0x0'));module[_0x3b83('0x1')]={'name':{'type':Sequelize[_0x3b83('0x2')]},'description':{'type':Sequelize[_0x3b83('0x2')]},'username':{'type':Sequelize[_0x3b83('0x2')],'unique':_0x3b83('0x3')},'password':{'type':Sequelize[_0x3b83('0x2')]},'token':{'type':Sequelize[_0x3b83('0x2')]},'remoteUri':{'type':Sequelize[_0x3b83('0x2')],'unique':_0x3b83('0x4')},'authType':{'type':Sequelize[_0x3b83('0x5')](_0x3b83('0x6'),_0x3b83('0x7')),'defaultValue':_0x3b83('0x6')},'serverUrl':{'type':Sequelize[_0x3b83('0x2')]},'type':{'type':Sequelize[_0x3b83('0x5')](_0x3b83('0x8'),'newTab'),'defaultValue':_0x3b83('0x8')}}; \ No newline at end of file +var _0xea5a=['token','ENUM','integrationTab','exports','STRING','username','remoteUri','password'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xea5a,0x1e3));var _0xaea5=function(_0x24a992,_0x5c49eb){_0x24a992=_0x24a992-0x0;var _0x26e1d4=_0xea5a[_0x24a992];return _0x26e1d4;};'use strict';var Sequelize=require('sequelize');module[_0xaea5('0x0')]={'name':{'type':Sequelize[_0xaea5('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaea5('0x1')],'unique':_0xaea5('0x2')},'password':{'type':Sequelize[_0xaea5('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaea5('0x1')],'unique':_0xaea5('0x3')},'authType':{'type':Sequelize['ENUM'](_0xaea5('0x4'),_0xaea5('0x5')),'defaultValue':_0xaea5('0x4')},'serverUrl':{'type':Sequelize[_0xaea5('0x1')]},'type':{'type':Sequelize[_0xaea5('0x6')](_0xaea5('0x7'),'newTab'),'defaultValue':_0xaea5('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 8691973..3c741b6 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 _0x1e8c=['../../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','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','count','include','ZendeskAccount','findAll','rows','show','includeAll','options','find','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Unknown\x20authentication\x20type','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1e8c,0x17d));var _0xc1e8=function(_0x4b332a,_0x5ec2db){_0x4b332a=_0x4b332a-0x0;var _0x115a04=_0x1e8c[_0x4b332a];return _0x115a04;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc1e8('0x0'));var zipdir=require(_0xc1e8('0x1'));var jsonpatch=require(_0xc1e8('0x2'));var rp=require(_0xc1e8('0x3'));var moment=require(_0xc1e8('0x4'));var BPromise=require(_0xc1e8('0x5'));var Mustache=require(_0xc1e8('0x6'));var util=require('util');var path=require(_0xc1e8('0x7'));var sox=require('sox');var csv=require(_0xc1e8('0x8'));var ejs=require(_0xc1e8('0x9'));var fs=require('fs');var _=require(_0xc1e8('0xa'));var squel=require(_0xc1e8('0xb'));var crypto=require(_0xc1e8('0xc'));var jsforce=require(_0xc1e8('0xd'));var deskjs=require(_0xc1e8('0xe'));var toCsv=require(_0xc1e8('0x8'));var querystring=require('querystring');var Papa=require(_0xc1e8('0xf'));var Redis=require(_0xc1e8('0x10'));var authService=require(_0xc1e8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1e8('0x12'));var logger=require('../../config/logger')(_0xc1e8('0x13'));var utils=require(_0xc1e8('0x14'));var config=require(_0xc1e8('0x15'));var db=require(_0xc1e8('0x16'))['db'];var integrations=require(_0xc1e8('0x17'));var jayson=require(_0xc1e8('0x18'));var client=jayson[_0xc1e8('0x19')][_0xc1e8('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4066d0,_0x4d502e,_0x3ac5c0){if(_0x3ac5c0){var _0x8b48dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8b48dd['test'](_0x4d502e)){return _0x4066d0;}else{throw new db[(_0xc1e8('0x1b'))][(_0xc1e8('0x1c'))](_0xc1e8('0x1d'));}}else{return _0x4066d0;}}function respondWithRpcPromise(_0x419c62,_0x3ca6dc,_0x536175,_0x227ca2){return new BPromise(function(_0x5a1ab1,_0x3aaf03){var _0x2ed92e=_0x227ca2||client;return _0x2ed92e[_0xc1e8('0x1e')](_0x419c62,_0x536175)[_0xc1e8('0x1f')](function(_0x37ab28){logger[_0xc1e8('0x20')](_0xc1e8('0x21'),_0x3ca6dc,_0xc1e8('0x22'));logger[_0xc1e8('0x23')](_0xc1e8('0x24'),_0x3ca6dc,_0xc1e8('0x22'),JSON[_0xc1e8('0x25')](_0x37ab28));if(_0x37ab28[_0xc1e8('0x26')]){if(_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x27')]===0x1f4){logger[_0xc1e8('0x26')](_0xc1e8('0x21'),_0x3ca6dc,_0x37ab28[_0xc1e8('0x26')]['message']);return _0x3aaf03(_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x28')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3ca6dc,_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x28')]);return _0x5a1ab1(_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x28')]);}else{logger['info'](_0xc1e8('0x21'),_0x3ca6dc,_0xc1e8('0x22'));_0x5a1ab1(_0x37ab28[_0xc1e8('0x29')]['message']);}})[_0xc1e8('0x2a')](function(_0x572142){logger[_0xc1e8('0x26')](_0xc1e8('0x21'),_0x3ca6dc,_0x572142);_0x3aaf03(_0x572142);});});}function respondWithStatusCode(_0x21c229,_0x248c55){_0x248c55=_0x248c55||0xcc;return function(_0x36745f){if(_0x36745f){return _0x21c229[_0xc1e8('0x2b')](_0x248c55);}return _0x21c229[_0xc1e8('0x2c')](_0x248c55)[_0xc1e8('0x2d')]();};}function respondWithResult(_0x17f146,_0x329408){_0x329408=_0x329408||0xc8;return function(_0x340b7a){if(_0x340b7a){return _0x17f146['status'](_0x329408)[_0xc1e8('0x2e')](_0x340b7a);}};}function respondWithFilteredResult(_0x230ca1,_0x27a9c3){return function(_0x44615e){if(_0x44615e){var _0xe2f12b=_0x44615e['count'],_0x48b0de=_0x27a9c3[_0xc1e8('0x2f')],_0x2a4a6c=_0x27a9c3[_0xc1e8('0x2f')]+_0x27a9c3[_0xc1e8('0x30')],_0x5b9074;if(_0x2a4a6c>=_0xe2f12b){_0x2a4a6c=_0xe2f12b;_0x5b9074=0xc8;}else{_0x5b9074=0xce;}_0x230ca1[_0xc1e8('0x2c')](_0x5b9074);return _0x230ca1[_0xc1e8('0x31')]('Content-Range',_0x48b0de+'-'+_0x2a4a6c+'/'+_0xe2f12b)[_0xc1e8('0x2e')](_0x44615e);}return null;};}function patchUpdates(_0xae1018){return function(_0x2bec0e){try{jsonpatch[_0xc1e8('0x32')](_0x2bec0e,_0xae1018,!![]);}catch(_0x2e47af){return BPromise[_0xc1e8('0x33')](_0x2e47af);}return _0x2bec0e[_0xc1e8('0x34')]();};}function saveUpdates(_0x47b529,_0x3e7df9){return function(_0x422e95){if(_0x422e95){return _0x422e95[_0xc1e8('0x35')](_0x47b529)[_0xc1e8('0x1f')](function(_0x151e68){return _0x151e68;});}return null;};}function removeEntity(_0x73aa30,_0x23fbe7){return function(_0x3af1a4){if(_0x3af1a4){return _0x3af1a4[_0xc1e8('0x36')]()['then'](function(){_0x73aa30[_0xc1e8('0x2c')](0xcc)[_0xc1e8('0x2d')]();});}};}function handleEntityNotFound(_0x5497e2,_0x481095){return function(_0x459126){if(!_0x459126){_0x5497e2[_0xc1e8('0x2b')](0x194);}return _0x459126;};}function handleError(_0x24643b,_0xb8df02){_0xb8df02=_0xb8df02||0x1f4;return function(_0x3e9062){logger['error'](_0x3e9062[_0xc1e8('0x37')]);if(_0x3e9062[_0xc1e8('0x38')]){delete _0x3e9062['name'];}_0x24643b[_0xc1e8('0x2c')](_0xb8df02)[_0xc1e8('0x39')](_0x3e9062);};}exports[_0xc1e8('0x3a')]=function(_0x359261,_0x5a9518){var _0x5b78f1={},_0x1cd143={},_0x1d24cc={'count':0x0,'rows':[]};var _0x576bc3=_[_0xc1e8('0x3b')](db['ZendeskAccount'][_0xc1e8('0x3c')],function(_0x43d88c){return{'name':_0x43d88c[_0xc1e8('0x3d')],'type':_0x43d88c['type'][_0xc1e8('0x3e')]};});_0x1cd143[_0xc1e8('0x3f')]=_[_0xc1e8('0x3b')](_0x576bc3,_0xc1e8('0x38'));_0x1cd143[_0xc1e8('0x40')]=_[_0xc1e8('0x41')](_0x359261[_0xc1e8('0x40')]);_0x1cd143['filters']=_[_0xc1e8('0x42')](_0x1cd143[_0xc1e8('0x3f')],_0x1cd143[_0xc1e8('0x40')]);_0x5b78f1[_0xc1e8('0x43')]=_['intersection'](_0x1cd143['model'],qs[_0xc1e8('0x44')](_0x359261[_0xc1e8('0x40')][_0xc1e8('0x44')]));_0x5b78f1['attributes']=_0x5b78f1[_0xc1e8('0x43')][_0xc1e8('0x45')]?_0x5b78f1[_0xc1e8('0x43')]:_0x1cd143[_0xc1e8('0x3f')];if(!_0x359261['query'][_0xc1e8('0x46')](_0xc1e8('0x47'))){_0x5b78f1[_0xc1e8('0x30')]=qs[_0xc1e8('0x30')](_0x359261['query'][_0xc1e8('0x30')]);_0x5b78f1['offset']=qs[_0xc1e8('0x2f')](_0x359261[_0xc1e8('0x40')][_0xc1e8('0x2f')]);}_0x5b78f1[_0xc1e8('0x48')]=qs[_0xc1e8('0x49')](_0x359261[_0xc1e8('0x40')][_0xc1e8('0x49')]);_0x5b78f1[_0xc1e8('0x4a')]=qs[_0xc1e8('0x4b')](_['pick'](_0x359261[_0xc1e8('0x40')],_0x1cd143['filters']),_0x576bc3);if(_0x359261[_0xc1e8('0x40')][_0xc1e8('0x4c')]){_0x5b78f1['where']=_[_0xc1e8('0x4d')](_0x5b78f1[_0xc1e8('0x4a')],{'$or':_[_0xc1e8('0x3b')](_0x576bc3,function(_0x1a5a5e){if(_0x1a5a5e[_0xc1e8('0x4e')]!==_0xc1e8('0x4f')){var _0x4a9209={};_0x4a9209[_0x1a5a5e[_0xc1e8('0x38')]]={'$like':'%'+_0x359261[_0xc1e8('0x40')]['filter']+'%'};return _0x4a9209;}})});}_0x5b78f1=_['merge']({},_0x5b78f1,_0x359261['options']);var _0x265cb7={'where':_0x5b78f1[_0xc1e8('0x4a')]};return db['ZendeskAccount'][_0xc1e8('0x50')](_0x265cb7)[_0xc1e8('0x1f')](function(_0x2a1129){_0x1d24cc[_0xc1e8('0x50')]=_0x2a1129;if(_0x359261[_0xc1e8('0x40')]['includeAll']){_0x5b78f1[_0xc1e8('0x51')]=[{'all':!![]}];}return db[_0xc1e8('0x52')][_0xc1e8('0x53')](_0x5b78f1);})[_0xc1e8('0x1f')](function(_0x409ced){_0x1d24cc[_0xc1e8('0x54')]=_0x409ced;return _0x1d24cc;})['then'](respondWithFilteredResult(_0x5a9518,_0x5b78f1))['catch'](handleError(_0x5a9518,null));};exports[_0xc1e8('0x55')]=function(_0x5d0662,_0x59fcee){var _0x19c0fb={'raw':![],'where':{'id':_0x5d0662['params']['id']}},_0x1a8bde={};_0x1a8bde[_0xc1e8('0x3f')]=_[_0xc1e8('0x41')](db['ZendeskAccount'][_0xc1e8('0x3c')]);_0x1a8bde[_0xc1e8('0x40')]=_[_0xc1e8('0x41')](_0x5d0662[_0xc1e8('0x40')]);_0x1a8bde[_0xc1e8('0x4b')]=_[_0xc1e8('0x42')](_0x1a8bde[_0xc1e8('0x3f')],_0x1a8bde[_0xc1e8('0x40')]);_0x19c0fb['attributes']=_[_0xc1e8('0x42')](_0x1a8bde[_0xc1e8('0x3f')],qs[_0xc1e8('0x44')](_0x5d0662[_0xc1e8('0x40')][_0xc1e8('0x44')]));_0x19c0fb[_0xc1e8('0x43')]=_0x19c0fb[_0xc1e8('0x43')]['length']?_0x19c0fb[_0xc1e8('0x43')]:_0x1a8bde['model'];if(_0x5d0662['query'][_0xc1e8('0x56')]){_0x19c0fb['include']=[{'all':!![]}];}_0x19c0fb=_[_0xc1e8('0x4d')]({},_0x19c0fb,_0x5d0662[_0xc1e8('0x57')]);return db[_0xc1e8('0x52')][_0xc1e8('0x58')](_0x19c0fb)['then'](handleEntityNotFound(_0x59fcee,null))[_0xc1e8('0x1f')](respondWithResult(_0x59fcee,null))[_0xc1e8('0x2a')](handleError(_0x59fcee,null));};exports['create']=function(_0x585f64,_0x2d6197){return db[_0xc1e8('0x52')]['create'](_0x585f64[_0xc1e8('0x59')],{})[_0xc1e8('0x1f')](respondWithResult(_0x2d6197,0xc9))[_0xc1e8('0x2a')](handleError(_0x2d6197,null));};exports[_0xc1e8('0x35')]=function(_0x519df1,_0x2caed1){if(_0x519df1['body']['id']){delete _0x519df1['body']['id'];}return db[_0xc1e8('0x52')][_0xc1e8('0x58')]({'where':{'id':_0x519df1[_0xc1e8('0x5a')]['id']}})[_0xc1e8('0x1f')](handleEntityNotFound(_0x2caed1,null))['then'](saveUpdates(_0x519df1['body'],null))[_0xc1e8('0x1f')](respondWithResult(_0x2caed1,null))[_0xc1e8('0x2a')](handleError(_0x2caed1,null));};exports[_0xc1e8('0x36')]=function(_0x47ef16,_0x42026c){return db[_0xc1e8('0x52')]['find']({'where':{'id':_0x47ef16[_0xc1e8('0x5a')]['id']}})[_0xc1e8('0x1f')](handleEntityNotFound(_0x42026c,null))['then'](removeEntity(_0x42026c,null))[_0xc1e8('0x2a')](handleError(_0x42026c,null));};exports[_0xc1e8('0x5b')]=function(_0x2720fe,_0x2ebe9f,_0x2ed443){var _0x28ade2={};var _0x43c951={};var _0x507aa1;var _0x4fb6b0;return db[_0xc1e8('0x52')][_0xc1e8('0x5c')]({'where':{'id':_0x2720fe[_0xc1e8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ebe9f,null))['then'](function(_0x483f4f){if(_0x483f4f){_0x507aa1=_0x483f4f;_0x43c951[_0xc1e8('0x3f')]=_[_0xc1e8('0x41')](db[_0xc1e8('0x5d')][_0xc1e8('0x3c')]);_0x43c951[_0xc1e8('0x40')]=_['keys'](_0x2720fe[_0xc1e8('0x40')]);_0x43c951['filters']=_[_0xc1e8('0x42')](_0x43c951[_0xc1e8('0x3f')],_0x43c951[_0xc1e8('0x40')]);_0x28ade2[_0xc1e8('0x43')]=_[_0xc1e8('0x42')](_0x43c951[_0xc1e8('0x3f')],qs[_0xc1e8('0x44')](_0x2720fe['query'][_0xc1e8('0x44')]));_0x28ade2[_0xc1e8('0x43')]=_0x28ade2[_0xc1e8('0x43')]['length']?_0x28ade2[_0xc1e8('0x43')]:_0x43c951[_0xc1e8('0x3f')];_0x28ade2[_0xc1e8('0x48')]=qs[_0xc1e8('0x49')](_0x2720fe[_0xc1e8('0x40')]['sort']);_0x28ade2[_0xc1e8('0x4a')]=qs[_0xc1e8('0x4b')](_[_0xc1e8('0x5e')](_0x2720fe[_0xc1e8('0x40')],_0x43c951['filters']));if(_0x2720fe['query'][_0xc1e8('0x4c')]){_0x28ade2[_0xc1e8('0x4a')]=_[_0xc1e8('0x4d')](_0x28ade2[_0xc1e8('0x4a')],{'$or':_[_0xc1e8('0x3b')](_0x28ade2[_0xc1e8('0x43')],function(_0x486984){var _0x19d403={};_0x19d403[_0x486984]={'$like':'%'+_0x2720fe['query']['filter']+'%'};return _0x19d403;})});}_0x28ade2=_['merge']({},_0x28ade2,_0x2720fe[_0xc1e8('0x57')]);return _0x507aa1['getConfigurations'](_0x28ade2);}})['then'](function(_0x5929fe){if(_0x5929fe){_0x4fb6b0=_0x5929fe[_0xc1e8('0x45')];if(!_0x2720fe[_0xc1e8('0x40')]['hasOwnProperty'](_0xc1e8('0x47'))){_0x28ade2[_0xc1e8('0x30')]=qs['limit'](_0x2720fe[_0xc1e8('0x40')][_0xc1e8('0x30')]);_0x28ade2[_0xc1e8('0x2f')]=qs[_0xc1e8('0x2f')](_0x2720fe['query']['offset']);}return _0x507aa1['getConfigurations'](_0x28ade2);}})['then'](function(_0x2e8f44){if(_0x2e8f44){return _0x2e8f44?{'count':_0x4fb6b0,'rows':_0x2e8f44}:null;}})[_0xc1e8('0x1f')](respondWithResult(_0x2ebe9f,null))[_0xc1e8('0x2a')](handleError(_0x2ebe9f,null));};exports[_0xc1e8('0x5f')]=function(_0x2adb91,_0x1b9615,_0x2add69){if(_0x2adb91[_0xc1e8('0x59')]['id']){delete _0x2adb91[_0xc1e8('0x59')]['id'];}return db[_0xc1e8('0x52')]['findOne']({'where':{'id':_0x2adb91['params']['id']}})[_0xc1e8('0x1f')](handleEntityNotFound(_0x1b9615,null))[_0xc1e8('0x1f')](function(_0x233e87){if(_0x233e87){_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x60')]=_0x233e87['id'];_0x2adb91['body'][_0xc1e8('0x61')]=integrations[_0xc1e8('0x62')](_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x63')],_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x4e')]);_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x64')]=integrations[_0xc1e8('0x65')](_0x2adb91[_0xc1e8('0x59')]['channel'],_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x4e')]);return db[_0xc1e8('0x5d')][_0xc1e8('0x66')](_0x2adb91[_0xc1e8('0x59')],{'include':[{'model':db['ZendeskField'],'as':_0xc1e8('0x61')},{'model':db['ZendeskField'],'as':_0xc1e8('0x64')}]});}return null;})[_0xc1e8('0x1f')](respondWithResult(_0x1b9615,null))[_0xc1e8('0x2a')](handleError(_0x1b9615,null));};exports['getFields']=function(_0x52cbc5,_0x53fcbe,_0x4e7c70){var _0x441697='';return db['ZendeskAccount'][_0xc1e8('0x5c')]({'where':{'id':_0x52cbc5[_0xc1e8('0x5a')]['id']},'attributes':['id','username',_0xc1e8('0x67'),_0xc1e8('0x68'),'authType',_0xc1e8('0x69')]})[_0xc1e8('0x1f')](handleEntityNotFound(_0x53fcbe,null))['then'](function(_0x3b60b1){if(_0x3b60b1){_0x441697=_0x3b60b1[_0xc1e8('0x69')];var _0x1f77e0=_0x441697[_0xc1e8('0x6a')](-0x1);if(_0x1f77e0==='/'){_0x441697=_0x441697[_0xc1e8('0x6b')](0x0,_0x441697[_0xc1e8('0x6c')](_0x1f77e0));}var _0x54afba={'method':_0xc1e8('0x6d'),'uri':util[_0xc1e8('0x6e')](_0xc1e8('0x6f'),_0x441697,_0xc1e8('0x70')),'json':!![]};switch(_0x3b60b1[_0xc1e8('0x71')]){case _0xc1e8('0x67'):_0x54afba[_0xc1e8('0x72')]={'Authorization':util['format'](_0xc1e8('0x73'),new Buffer(util['format'](_0xc1e8('0x74'),_0x3b60b1[_0xc1e8('0x75')],_0x3b60b1['password']))[_0xc1e8('0x76')](_0xc1e8('0x77')))};break;case _0xc1e8('0x68'):_0x54afba[_0xc1e8('0x72')]={'Authorization':util[_0xc1e8('0x6e')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x3b60b1[_0xc1e8('0x75')],_0x3b60b1[_0xc1e8('0x68')]))['toString'](_0xc1e8('0x77')))};break;default:throw new db[(_0xc1e8('0x1b'))]['ValidationError'](_0xc1e8('0x78'));}return rp(_0x54afba);}})[_0xc1e8('0x1f')](function(_0x193429){if(_0x193429){var _0x326652=['subject',_0xc1e8('0x79'),_0xc1e8('0x7a'),'assignee'];_[_0xc1e8('0x7b')](_0x193429[_0xc1e8('0x70')],function(_0x4fe528){return _0x326652[_0xc1e8('0x7c')](_0x4fe528[_0xc1e8('0x4e')]);});return{'count':_0x193429[_0xc1e8('0x70')][_0xc1e8('0x45')],'rows':_[_0xc1e8('0x3b')](_0x193429[_0xc1e8('0x70')],function(_0x276de0){return{'id':_0x276de0['id'],'name':_0x276de0[_0xc1e8('0x7d')]>0x7?_0x276de0[_0xc1e8('0x7e')]:_0x276de0[_0xc1e8('0x4e')],'custom':_0x276de0[_0xc1e8('0x7d')]>0x7?!![]:![],'options':_0x276de0[_0xc1e8('0x7f')]?_0x276de0[_0xc1e8('0x7f')]:_0x276de0[_0xc1e8('0x80')]?_0x276de0[_0xc1e8('0x80')]:[]};})};}})[_0xc1e8('0x1f')](respondWithResult(_0x53fcbe,null))[_0xc1e8('0x2a')](function(_0xed774e){var _0x4dbd18=_0x52cbc5[_0xc1e8('0x40')][_0xc1e8('0x81')]?0x1f4:_0xed774e[_0xc1e8('0x82')]||0x1f4;logger['error'](_0xc1e8('0x83'),_0xc1e8('0x84'),_0x4dbd18,JSON['stringify'](_0xed774e));delete _0xed774e[_0xc1e8('0x38')];if(_0x4dbd18===0x191){_0x4dbd18=0x190;}_0x53fcbe['status'](_0x4dbd18)[_0xc1e8('0x39')](_0x52cbc5[_0xc1e8('0x40')][_0xc1e8('0x81')]?{'message':_0xc1e8('0x85'),'statusCode':_0xed774e[_0xc1e8('0x82')]}:_0xed774e);});}; \ No newline at end of file +var _0x1bc0=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','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','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','ZendeskAccount','options','find','create','body','getConfigurations','ZendeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','ZendeskField','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','subject','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','html-pdf'];(function(_0x577caa,_0x3194d4){var _0x2b4fae=function(_0x1ffa0a){while(--_0x1ffa0a){_0x577caa['push'](_0x577caa['shift']());}};_0x2b4fae(++_0x3194d4);}(_0x1bc0,0x188));var _0x01bc=function(_0x225400,_0x3f62cf){_0x225400=_0x225400-0x0;var _0xabf49a=_0x1bc0[_0x225400];return _0xabf49a;};'use strict';var pdf=require(_0x01bc('0x0'));var emlformat=require(_0x01bc('0x1'));var rimraf=require(_0x01bc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01bc('0x3'));var rp=require(_0x01bc('0x4'));var moment=require(_0x01bc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x01bc('0x6'));var util=require('util');var path=require('path');var sox=require(_0x01bc('0x7'));var csv=require(_0x01bc('0x8'));var ejs=require(_0x01bc('0x9'));var fs=require('fs');var _=require(_0x01bc('0xa'));var squel=require('squel');var crypto=require(_0x01bc('0xb'));var jsforce=require(_0x01bc('0xc'));var deskjs=require(_0x01bc('0xd'));var toCsv=require(_0x01bc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x01bc('0xe'));var qs=require(_0x01bc('0xf'));var as=require(_0x01bc('0x10'));var hardwareService=require(_0x01bc('0x11'));var logger=require(_0x01bc('0x12'))(_0x01bc('0x13'));var utils=require(_0x01bc('0x14'));var config=require('../../config/environment');var db=require(_0x01bc('0x15'))['db'];var integrations=require(_0x01bc('0x16'));var jayson=require(_0x01bc('0x17'));var client=jayson[_0x01bc('0x18')][_0x01bc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x6614e7,_0x3ae122,_0x54a81f){if(_0x54a81f){var _0x5f1af3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f1af3[_0x01bc('0x1a')](_0x3ae122)){return _0x6614e7;}else{throw new db[(_0x01bc('0x1b'))][(_0x01bc('0x1c'))](_0x01bc('0x1d'));}}else{return _0x6614e7;}}function respondWithRpcPromise(_0x3695f3,_0x5c71ca,_0x131789,_0xc7e75f){return new BPromise(function(_0x500a04,_0x5707e0){var _0x21ded4=_0xc7e75f||client;return _0x21ded4[_0x01bc('0x1e')](_0x3695f3,_0x131789)[_0x01bc('0x1f')](function(_0x2f1623){logger[_0x01bc('0x20')](_0x01bc('0x21'),_0x5c71ca,_0x01bc('0x22'));logger[_0x01bc('0x23')](_0x01bc('0x24'),_0x5c71ca,_0x01bc('0x22'),JSON['stringify'](_0x2f1623));if(_0x2f1623[_0x01bc('0x25')]){if(_0x2f1623[_0x01bc('0x25')][_0x01bc('0x26')]===0x1f4){logger['error'](_0x01bc('0x21'),_0x5c71ca,_0x2f1623[_0x01bc('0x25')][_0x01bc('0x27')]);return _0x5707e0(_0x2f1623[_0x01bc('0x25')]['message']);}logger[_0x01bc('0x25')](_0x01bc('0x21'),_0x5c71ca,_0x2f1623[_0x01bc('0x25')][_0x01bc('0x27')]);return _0x500a04(_0x2f1623[_0x01bc('0x25')]['message']);}else{logger['info'](_0x01bc('0x21'),_0x5c71ca,_0x01bc('0x22'));_0x500a04(_0x2f1623[_0x01bc('0x28')][_0x01bc('0x27')]);}})['catch'](function(_0x51b75b){logger[_0x01bc('0x25')](_0x01bc('0x21'),_0x5c71ca,_0x51b75b);_0x5707e0(_0x51b75b);});});}function respondWithStatusCode(_0x19b69d,_0x1e5afe){_0x1e5afe=_0x1e5afe||0xcc;return function(_0x3eb605){if(_0x3eb605){return _0x19b69d['sendStatus'](_0x1e5afe);}return _0x19b69d[_0x01bc('0x29')](_0x1e5afe)[_0x01bc('0x2a')]();};}function respondWithResult(_0x5d1ec4,_0x3d649b){_0x3d649b=_0x3d649b||0xc8;return function(_0x277711){if(_0x277711){return _0x5d1ec4[_0x01bc('0x29')](_0x3d649b)[_0x01bc('0x2b')](_0x277711);}};}function respondWithFilteredResult(_0x4df68f,_0xba98e3){return function(_0x37bbdb){if(_0x37bbdb){var _0x1a4895=_0x37bbdb[_0x01bc('0x2c')],_0xef1bb7=_0xba98e3[_0x01bc('0x2d')],_0x423cfb=_0xba98e3['offset']+_0xba98e3[_0x01bc('0x2e')],_0x59bc07;if(_0x423cfb>=_0x1a4895){_0x423cfb=_0x1a4895;_0x59bc07=0xc8;}else{_0x59bc07=0xce;}_0x4df68f[_0x01bc('0x29')](_0x59bc07);return _0x4df68f[_0x01bc('0x2f')](_0x01bc('0x30'),_0xef1bb7+'-'+_0x423cfb+'/'+_0x1a4895)[_0x01bc('0x2b')](_0x37bbdb);}return null;};}function patchUpdates(_0x434eda){return function(_0x53831d){try{jsonpatch[_0x01bc('0x31')](_0x53831d,_0x434eda,!![]);}catch(_0x4d170e){return BPromise['reject'](_0x4d170e);}return _0x53831d[_0x01bc('0x32')]();};}function saveUpdates(_0x15f06f,_0x2c7767){return function(_0x33c1e7){if(_0x33c1e7){return _0x33c1e7[_0x01bc('0x33')](_0x15f06f)[_0x01bc('0x1f')](function(_0x27504){return _0x27504;});}return null;};}function removeEntity(_0x286ac9,_0x50a4da){return function(_0x1b9968){if(_0x1b9968){return _0x1b9968['destroy']()[_0x01bc('0x1f')](function(){_0x286ac9[_0x01bc('0x29')](0xcc)[_0x01bc('0x2a')]();});}};}function handleEntityNotFound(_0x340142,_0x557a59){return function(_0x44f978){if(!_0x44f978){_0x340142[_0x01bc('0x34')](0x194);}return _0x44f978;};}function handleError(_0x52c9ee,_0x3fd443){_0x3fd443=_0x3fd443||0x1f4;return function(_0x27cac6){logger['error'](_0x27cac6[_0x01bc('0x35')]);if(_0x27cac6[_0x01bc('0x36')]){delete _0x27cac6[_0x01bc('0x36')];}_0x52c9ee[_0x01bc('0x29')](_0x3fd443)[_0x01bc('0x37')](_0x27cac6);};}exports[_0x01bc('0x38')]=function(_0x2b45cc,_0x338b25){var _0x49a153={},_0x2a5a06={},_0x156aae={'count':0x0,'rows':[]};var _0x55ee9c=_[_0x01bc('0x39')](db['ZendeskAccount'][_0x01bc('0x3a')],function(_0x13b70c){return{'name':_0x13b70c[_0x01bc('0x3b')],'type':_0x13b70c[_0x01bc('0x3c')][_0x01bc('0x3d')]};});_0x2a5a06[_0x01bc('0x3e')]=_[_0x01bc('0x39')](_0x55ee9c,_0x01bc('0x36'));_0x2a5a06[_0x01bc('0x3f')]=_[_0x01bc('0x40')](_0x2b45cc[_0x01bc('0x3f')]);_0x2a5a06[_0x01bc('0x41')]=_[_0x01bc('0x42')](_0x2a5a06[_0x01bc('0x3e')],_0x2a5a06[_0x01bc('0x3f')]);_0x49a153[_0x01bc('0x43')]=_[_0x01bc('0x42')](_0x2a5a06['model'],qs[_0x01bc('0x44')](_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x44')]));_0x49a153[_0x01bc('0x43')]=_0x49a153[_0x01bc('0x43')][_0x01bc('0x45')]?_0x49a153[_0x01bc('0x43')]:_0x2a5a06[_0x01bc('0x3e')];if(!_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x46')](_0x01bc('0x47'))){_0x49a153[_0x01bc('0x2e')]=qs[_0x01bc('0x2e')](_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x2e')]);_0x49a153[_0x01bc('0x2d')]=qs[_0x01bc('0x2d')](_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x2d')]);}_0x49a153['order']=qs['sort'](_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x48')]);_0x49a153[_0x01bc('0x49')]=qs[_0x01bc('0x41')](_[_0x01bc('0x4a')](_0x2b45cc['query'],_0x2a5a06[_0x01bc('0x41')]),_0x55ee9c);if(_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x4b')]){_0x49a153['where']=_['merge'](_0x49a153[_0x01bc('0x49')],{'$or':_[_0x01bc('0x39')](_0x55ee9c,function(_0x5c4a84){if(_0x5c4a84[_0x01bc('0x3c')]!==_0x01bc('0x4c')){var _0x583177={};_0x583177[_0x5c4a84[_0x01bc('0x36')]]={'$like':'%'+_0x2b45cc[_0x01bc('0x3f')]['filter']+'%'};return _0x583177;}})});}_0x49a153=_[_0x01bc('0x4d')]({},_0x49a153,_0x2b45cc['options']);var _0x8b7e5a={'where':_0x49a153['where']};return db['ZendeskAccount'][_0x01bc('0x2c')](_0x8b7e5a)[_0x01bc('0x1f')](function(_0x35b31d){_0x156aae[_0x01bc('0x2c')]=_0x35b31d;if(_0x2b45cc[_0x01bc('0x3f')][_0x01bc('0x4e')]){_0x49a153[_0x01bc('0x4f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x01bc('0x50')](_0x49a153);})[_0x01bc('0x1f')](function(_0xd81d5c){_0x156aae[_0x01bc('0x51')]=_0xd81d5c;return _0x156aae;})[_0x01bc('0x1f')](respondWithFilteredResult(_0x338b25,_0x49a153))[_0x01bc('0x52')](handleError(_0x338b25,null));};exports['show']=function(_0xd8a0fc,_0x590c6b){var _0x3e303f={'raw':![],'where':{'id':_0xd8a0fc[_0x01bc('0x53')]['id']}},_0x120a1e={};_0x120a1e[_0x01bc('0x3e')]=_[_0x01bc('0x40')](db[_0x01bc('0x54')][_0x01bc('0x3a')]);_0x120a1e[_0x01bc('0x3f')]=_['keys'](_0xd8a0fc[_0x01bc('0x3f')]);_0x120a1e[_0x01bc('0x41')]=_[_0x01bc('0x42')](_0x120a1e[_0x01bc('0x3e')],_0x120a1e[_0x01bc('0x3f')]);_0x3e303f[_0x01bc('0x43')]=_['intersection'](_0x120a1e['model'],qs[_0x01bc('0x44')](_0xd8a0fc[_0x01bc('0x3f')][_0x01bc('0x44')]));_0x3e303f[_0x01bc('0x43')]=_0x3e303f['attributes']['length']?_0x3e303f[_0x01bc('0x43')]:_0x120a1e[_0x01bc('0x3e')];if(_0xd8a0fc['query'][_0x01bc('0x4e')]){_0x3e303f['include']=[{'all':!![]}];}_0x3e303f=_[_0x01bc('0x4d')]({},_0x3e303f,_0xd8a0fc[_0x01bc('0x55')]);return db[_0x01bc('0x54')][_0x01bc('0x56')](_0x3e303f)[_0x01bc('0x1f')](handleEntityNotFound(_0x590c6b,null))[_0x01bc('0x1f')](respondWithResult(_0x590c6b,null))[_0x01bc('0x52')](handleError(_0x590c6b,null));};exports[_0x01bc('0x57')]=function(_0xa709f5,_0x9a0a70){return db[_0x01bc('0x54')][_0x01bc('0x57')](_0xa709f5['body'],{})[_0x01bc('0x1f')](respondWithResult(_0x9a0a70,0xc9))['catch'](handleError(_0x9a0a70,null));};exports[_0x01bc('0x33')]=function(_0x5c7e97,_0x2e2156){if(_0x5c7e97[_0x01bc('0x58')]['id']){delete _0x5c7e97[_0x01bc('0x58')]['id'];}return db[_0x01bc('0x54')]['find']({'where':{'id':_0x5c7e97[_0x01bc('0x53')]['id']}})[_0x01bc('0x1f')](handleEntityNotFound(_0x2e2156,null))[_0x01bc('0x1f')](saveUpdates(_0x5c7e97['body'],null))[_0x01bc('0x1f')](respondWithResult(_0x2e2156,null))[_0x01bc('0x52')](handleError(_0x2e2156,null));};exports['destroy']=function(_0x1c4277,_0x56b6eb){return db[_0x01bc('0x54')][_0x01bc('0x56')]({'where':{'id':_0x1c4277[_0x01bc('0x53')]['id']}})[_0x01bc('0x1f')](handleEntityNotFound(_0x56b6eb,null))['then'](removeEntity(_0x56b6eb,null))['catch'](handleError(_0x56b6eb,null));};exports[_0x01bc('0x59')]=function(_0x179c32,_0x11e0cc,_0x24ce37){var _0x117e7f={};var _0x1ff6f4={};var _0x58b073;var _0x4531b4;return db[_0x01bc('0x54')]['findOne']({'where':{'id':_0x179c32['params']['id']}})['then'](handleEntityNotFound(_0x11e0cc,null))[_0x01bc('0x1f')](function(_0x58f064){if(_0x58f064){_0x58b073=_0x58f064;_0x1ff6f4[_0x01bc('0x3e')]=_[_0x01bc('0x40')](db[_0x01bc('0x5a')][_0x01bc('0x3a')]);_0x1ff6f4[_0x01bc('0x3f')]=_['keys'](_0x179c32[_0x01bc('0x3f')]);_0x1ff6f4[_0x01bc('0x41')]=_[_0x01bc('0x42')](_0x1ff6f4[_0x01bc('0x3e')],_0x1ff6f4[_0x01bc('0x3f')]);_0x117e7f[_0x01bc('0x43')]=_[_0x01bc('0x42')](_0x1ff6f4[_0x01bc('0x3e')],qs[_0x01bc('0x44')](_0x179c32[_0x01bc('0x3f')][_0x01bc('0x44')]));_0x117e7f[_0x01bc('0x43')]=_0x117e7f['attributes']['length']?_0x117e7f[_0x01bc('0x43')]:_0x1ff6f4['model'];_0x117e7f[_0x01bc('0x5b')]=qs[_0x01bc('0x48')](_0x179c32[_0x01bc('0x3f')][_0x01bc('0x48')]);_0x117e7f[_0x01bc('0x49')]=qs['filters'](_[_0x01bc('0x4a')](_0x179c32[_0x01bc('0x3f')],_0x1ff6f4[_0x01bc('0x41')]));if(_0x179c32[_0x01bc('0x3f')][_0x01bc('0x4b')]){_0x117e7f[_0x01bc('0x49')]=_[_0x01bc('0x4d')](_0x117e7f[_0x01bc('0x49')],{'$or':_[_0x01bc('0x39')](_0x117e7f[_0x01bc('0x43')],function(_0xf808cd){var _0x2b6a0c={};_0x2b6a0c[_0xf808cd]={'$like':'%'+_0x179c32[_0x01bc('0x3f')][_0x01bc('0x4b')]+'%'};return _0x2b6a0c;})});}_0x117e7f=_[_0x01bc('0x4d')]({},_0x117e7f,_0x179c32[_0x01bc('0x55')]);return _0x58b073[_0x01bc('0x59')](_0x117e7f);}})[_0x01bc('0x1f')](function(_0x305f2a){if(_0x305f2a){_0x4531b4=_0x305f2a[_0x01bc('0x45')];if(!_0x179c32[_0x01bc('0x3f')][_0x01bc('0x46')](_0x01bc('0x47'))){_0x117e7f[_0x01bc('0x2e')]=qs[_0x01bc('0x2e')](_0x179c32[_0x01bc('0x3f')][_0x01bc('0x2e')]);_0x117e7f[_0x01bc('0x2d')]=qs[_0x01bc('0x2d')](_0x179c32['query'][_0x01bc('0x2d')]);}return _0x58b073[_0x01bc('0x59')](_0x117e7f);}})[_0x01bc('0x1f')](function(_0x109e57){if(_0x109e57){return _0x109e57?{'count':_0x4531b4,'rows':_0x109e57}:null;}})[_0x01bc('0x1f')](respondWithResult(_0x11e0cc,null))[_0x01bc('0x52')](handleError(_0x11e0cc,null));};exports[_0x01bc('0x5c')]=function(_0x14e973,_0x2c8b64,_0x4ca1d6){if(_0x14e973[_0x01bc('0x58')]['id']){delete _0x14e973['body']['id'];}return db[_0x01bc('0x54')][_0x01bc('0x5d')]({'where':{'id':_0x14e973[_0x01bc('0x53')]['id']}})[_0x01bc('0x1f')](handleEntityNotFound(_0x2c8b64,null))[_0x01bc('0x1f')](function(_0x4da9c2){if(_0x4da9c2){_0x14e973[_0x01bc('0x58')][_0x01bc('0x5e')]=_0x4da9c2['id'];_0x14e973[_0x01bc('0x58')][_0x01bc('0x5f')]=integrations['getSubjects'](_0x14e973['body'][_0x01bc('0x60')],_0x14e973[_0x01bc('0x58')][_0x01bc('0x3c')]);_0x14e973[_0x01bc('0x58')][_0x01bc('0x61')]=integrations['getDescriptions'](_0x14e973['body'][_0x01bc('0x60')],_0x14e973['body'][_0x01bc('0x3c')]);return db[_0x01bc('0x5a')][_0x01bc('0x57')](_0x14e973[_0x01bc('0x58')],{'include':[{'model':db[_0x01bc('0x62')],'as':'Subjects'},{'model':db[_0x01bc('0x62')],'as':_0x01bc('0x61')}]});}return null;})['then'](respondWithResult(_0x2c8b64,null))[_0x01bc('0x52')](handleError(_0x2c8b64,null));};exports[_0x01bc('0x63')]=function(_0xd36753,_0x4d2b96,_0x52d6d8){var _0x94bf03='';return db[_0x01bc('0x54')]['findOne']({'where':{'id':_0xd36753[_0x01bc('0x53')]['id']},'attributes':['id',_0x01bc('0x64'),_0x01bc('0x65'),'token',_0x01bc('0x66'),_0x01bc('0x67')]})[_0x01bc('0x1f')](handleEntityNotFound(_0x4d2b96,null))[_0x01bc('0x1f')](function(_0x5e43a1){if(_0x5e43a1){_0x94bf03=_0x5e43a1[_0x01bc('0x67')];var _0x19a9df=_0x94bf03[_0x01bc('0x68')](-0x1);if(_0x19a9df==='/'){_0x94bf03=_0x94bf03[_0x01bc('0x69')](0x0,_0x94bf03[_0x01bc('0x6a')](_0x19a9df));}var _0x46c6f5={'method':_0x01bc('0x6b'),'uri':util[_0x01bc('0x6c')](_0x01bc('0x6d'),_0x94bf03,_0x01bc('0x6e')),'json':!![]};switch(_0x5e43a1[_0x01bc('0x66')]){case _0x01bc('0x65'):_0x46c6f5[_0x01bc('0x6f')]={'Authorization':util['format'](_0x01bc('0x70'),new Buffer(util[_0x01bc('0x6c')](_0x01bc('0x71'),_0x5e43a1[_0x01bc('0x64')],_0x5e43a1[_0x01bc('0x65')]))[_0x01bc('0x72')](_0x01bc('0x73')))};break;case _0x01bc('0x74'):_0x46c6f5['headers']={'Authorization':util[_0x01bc('0x6c')]('Basic\x20%s',new Buffer(util[_0x01bc('0x6c')](_0x01bc('0x75'),_0x5e43a1[_0x01bc('0x64')],_0x5e43a1[_0x01bc('0x74')]))['toString'](_0x01bc('0x73')))};break;default:throw new db[(_0x01bc('0x1b'))][(_0x01bc('0x1c'))]('Unknown\x20authentication\x20type');}return rp(_0x46c6f5);}})[_0x01bc('0x1f')](function(_0x240b6f){if(_0x240b6f){var _0x3595cc=[_0x01bc('0x76'),_0x01bc('0x77'),_0x01bc('0x78'),_0x01bc('0x79')];_[_0x01bc('0x7a')](_0x240b6f[_0x01bc('0x6e')],function(_0x54a6bd){return _0x3595cc[_0x01bc('0x7b')](_0x54a6bd['type']);});return{'count':_0x240b6f['ticket_fields'][_0x01bc('0x45')],'rows':_[_0x01bc('0x39')](_0x240b6f[_0x01bc('0x6e')],function(_0x326339){return{'id':_0x326339['id'],'name':_0x326339['position']>0x7?_0x326339[_0x01bc('0x7c')]:_0x326339[_0x01bc('0x3c')],'custom':_0x326339[_0x01bc('0x7d')]>0x7?!![]:![],'options':_0x326339['system_field_options']?_0x326339[_0x01bc('0x7e')]:_0x326339[_0x01bc('0x7f')]?_0x326339[_0x01bc('0x7f')]:[]};})};}})['then'](respondWithResult(_0x4d2b96,null))[_0x01bc('0x52')](function(_0x3acc39){var _0x3f549b=_0xd36753[_0x01bc('0x3f')][_0x01bc('0x1a')]?0x1f4:_0x3acc39['statusCode']||0x1f4;logger[_0x01bc('0x25')](_0x01bc('0x80'),_0x01bc('0x63'),_0x3f549b,JSON[_0x01bc('0x81')](_0x3acc39));delete _0x3acc39['name'];if(_0x3f549b===0x191){_0x3f549b=0x190;}_0x4d2b96['status'](_0x3f549b)['send'](_0xd36753[_0x01bc('0x3f')][_0x01bc('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x3acc39[_0x01bc('0x82')]}:_0x3acc39);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5074afb..29fa807 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 _0x4d6f=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x4d6f,0x14a));var _0xf4d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4d6f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf4d6('0x0'));var util=require('util');var logger=require(_0xf4d6('0x1'))('api');var moment=require(_0xf4d6('0x2'));var BPromise=require(_0xf4d6('0x3'));var rp=require(_0xf4d6('0x4'));var fs=require('fs');var path=require(_0xf4d6('0x5'));var rimraf=require('rimraf');var config=require(_0xf4d6('0x6'));var attributes=require(_0xf4d6('0x7'));var integrations=require(_0xf4d6('0x8'));module['exports']=function(_0x56e506,_0x148b40){return _0x56e506[_0xf4d6('0x9')](_0xf4d6('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a69=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash'];(function(_0x2576c1,_0x49c89b){var _0x4e69e5=function(_0x3c253c){while(--_0x3c253c){_0x2576c1['push'](_0x2576c1['shift']());}};_0x4e69e5(++_0x49c89b);}(_0x3a69,0x110));var _0x93a6=function(_0x20cdd2,_0x24da9b){_0x20cdd2=_0x20cdd2-0x0;var _0x8bd09e=_0x3a69[_0x20cdd2];return _0x8bd09e;};'use strict';var _=require(_0x93a6('0x0'));var util=require(_0x93a6('0x1'));var logger=require(_0x93a6('0x2'))(_0x93a6('0x3'));var moment=require(_0x93a6('0x4'));var BPromise=require(_0x93a6('0x5'));var rp=require(_0x93a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93a6('0x7'));var config=require('../../config/environment');var attributes=require(_0x93a6('0x8'));var integrations=require(_0x93a6('0x9'));module[_0x93a6('0xa')]=function(_0x4d4dda,_0x4dcbd9){return _0x4d4dda[_0x93a6('0xb')]('ZendeskAccount',attributes,{'tableName':_0x93a6('0xc'),'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 3b3c122..4ee9613 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 _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0xfbe418,_0x2677f4){var _0x46e9b7=function(_0x5f2f62){while(--_0x5f2f62){_0xfbe418['push'](_0xfbe418['shift']());}};_0x46e9b7(++_0x2677f4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file +var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\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')]('GetZendeskAccount',_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')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7116290..b6982ea 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 _0x0226=['Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42aeef,_0x528223){var _0x4365e6=function(_0x53ca84){while(--_0x53ca84){_0x42aeef['push'](_0x42aeef['shift']());}};_0x4365e6(++_0x528223);}(_0x0226,0x1ac));var _0x6022=function(_0x79c6de,_0x10de94){_0x79c6de=_0x79c6de-0x0;var _0x321a56=_0x0226[_0x79c6de];return _0x321a56;};'use strict';var multer=require(_0x6022('0x0'));var util=require(_0x6022('0x1'));var path=require(_0x6022('0x2'));var timeout=require(_0x6022('0x3'));var express=require('express');var router=express[_0x6022('0x4')]();var auth=require(_0x6022('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6022('0x6'));var controller=require(_0x6022('0x7'));router[_0x6022('0x8')]('/',auth['isAuthenticated'](),controller[_0x6022('0x9')]);router['get']('/:id',auth[_0x6022('0xa')](),controller[_0x6022('0xb')]);router[_0x6022('0x8')](_0x6022('0xc'),auth['isAuthenticated'](),controller[_0x6022('0xd')]);router[_0x6022('0x8')](_0x6022('0xe'),auth[_0x6022('0xa')](),controller[_0x6022('0xf')]);router['get'](_0x6022('0x10'),auth[_0x6022('0xa')](),controller['getDescriptions']);router['get'](_0x6022('0x11'),auth[_0x6022('0xa')](),controller[_0x6022('0x12')]);router[_0x6022('0x13')]('/',auth[_0x6022('0xa')](),controller['create']);router['post']('/:id/tags',auth[_0x6022('0xa')](),controller[_0x6022('0x14')]);router[_0x6022('0x15')](_0x6022('0x16'),auth[_0x6022('0xa')](),controller[_0x6022('0x17')]);router[_0x6022('0x18')](_0x6022('0x16'),auth[_0x6022('0xa')](),controller[_0x6022('0x19')]);module[_0x6022('0x1a')]=router; \ No newline at end of file +var _0xe018=['/:id/tags','getTags','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getSubjects','/:id/descriptions'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xe018,0x1e4));var _0x8e01=function(_0x4d2e69,_0x445a1a){_0x4d2e69=_0x4d2e69-0x0;var _0x5562ae=_0xe018[_0x4d2e69];return _0x5562ae;};'use strict';var multer=require('multer');var util=require(_0x8e01('0x0'));var path=require(_0x8e01('0x1'));var timeout=require(_0x8e01('0x2'));var express=require(_0x8e01('0x3'));var router=express[_0x8e01('0x4')]();var auth=require(_0x8e01('0x5'));var interaction=require(_0x8e01('0x6'));var config=require(_0x8e01('0x7'));var controller=require(_0x8e01('0x8'));router[_0x8e01('0x9')]('/',auth[_0x8e01('0xa')](),controller['index']);router[_0x8e01('0x9')](_0x8e01('0xb'),auth[_0x8e01('0xa')](),controller[_0x8e01('0xc')]);router[_0x8e01('0x9')](_0x8e01('0xd'),auth[_0x8e01('0xa')](),controller['getFields']);router[_0x8e01('0x9')]('/:id/subjects',auth[_0x8e01('0xa')](),controller[_0x8e01('0xe')]);router[_0x8e01('0x9')](_0x8e01('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8e01('0x9')](_0x8e01('0x10'),auth[_0x8e01('0xa')](),controller[_0x8e01('0x11')]);router[_0x8e01('0x12')]('/',auth[_0x8e01('0xa')](),controller[_0x8e01('0x13')]);router[_0x8e01('0x12')]('/:id/tags',auth[_0x8e01('0xa')](),controller['setTags']);router[_0x8e01('0x14')](_0x8e01('0xb'),auth[_0x8e01('0xa')](),controller[_0x8e01('0x15')]);router[_0x8e01('0x16')]('/:id',auth[_0x8e01('0xa')](),controller[_0x8e01('0x17')]);module[_0x8e01('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 234bd09..6fd1ac8 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 _0x4925=['STRING','exports'];(function(_0x482b09,_0x38e844){var _0x1922de=function(_0x159878){while(--_0x159878){_0x482b09['push'](_0x482b09['shift']());}};_0x1922de(++_0x38e844);}(_0x4925,0x8d));var _0x5492=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x4925[_0x5ce3c8];return _0xa76867;};'use strict';var Sequelize=require('sequelize');module[_0x5492('0x0')]={'name':{'type':Sequelize[_0x5492('0x1')]},'description':{'type':Sequelize[_0x5492('0x1')]}}; \ No newline at end of file +var _0xb548=['exports','STRING'];(function(_0x526f1f,_0x4e49d8){var _0x399828=function(_0x42b329){while(--_0x42b329){_0x526f1f['push'](_0x526f1f['shift']());}};_0x399828(++_0x4e49d8);}(_0xb548,0x1e8));var _0x8b54=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb548[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require('sequelize');module[_0x8b54('0x0')]={'name':{'type':Sequelize[_0x8b54('0x1')]},'description':{'type':Sequelize[_0x8b54('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 905d7ac..90d06cb 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 _0x1beb=['ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/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','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','destroy','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','update','getFields','findOne'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1beb,0x17f));var _0xb1be=function(_0x5edddd,_0x98a0a5){_0x5edddd=_0x5edddd-0x0;var _0x1cc8cb=_0x1beb[_0x5edddd];return _0x1cc8cb;};'use strict';var pdf=require(_0xb1be('0x0'));var emlformat=require(_0xb1be('0x1'));var rimraf=require(_0xb1be('0x2'));var zipdir=require(_0xb1be('0x3'));var jsonpatch=require(_0xb1be('0x4'));var rp=require(_0xb1be('0x5'));var moment=require('moment');var BPromise=require(_0xb1be('0x6'));var Mustache=require('mustache');var util=require(_0xb1be('0x7'));var path=require('path');var sox=require(_0xb1be('0x8'));var csv=require(_0xb1be('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb1be('0xa'));var squel=require(_0xb1be('0xb'));var crypto=require(_0xb1be('0xc'));var jsforce=require(_0xb1be('0xd'));var deskjs=require(_0xb1be('0xe'));var toCsv=require(_0xb1be('0x9'));var querystring=require(_0xb1be('0xf'));var Papa=require(_0xb1be('0x10'));var Redis=require('ioredis');var authService=require(_0xb1be('0x11'));var qs=require(_0xb1be('0x12'));var as=require(_0xb1be('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb1be('0x14'));var config=require('../../config/environment');var db=require(_0xb1be('0x15'))['db'];var jayson=require(_0xb1be('0x16'));var client=jayson[_0xb1be('0x17')][_0xb1be('0x18')]({'port':0x232a});function checkPasswordPattern(_0x46c23d,_0x824f32,_0x336219){if(_0x336219){var _0x44203d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44203d['test'](_0x824f32)){return _0x46c23d;}else{throw new db[(_0xb1be('0x19'))][(_0xb1be('0x1a'))](_0xb1be('0x1b'));}}else{return _0x46c23d;}}function respondWithRpcPromise(_0x57da13,_0x5af865,_0x1c28ee,_0x293d9e){return new BPromise(function(_0x20b128,_0x332f8f){var _0x4ab865=_0x293d9e||client;return _0x4ab865[_0xb1be('0x1c')](_0x57da13,_0x1c28ee)[_0xb1be('0x1d')](function(_0x460829){logger[_0xb1be('0x1e')](_0xb1be('0x1f'),_0x5af865,_0xb1be('0x20'));logger[_0xb1be('0x21')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5af865,_0xb1be('0x20'),JSON[_0xb1be('0x22')](_0x460829));if(_0x460829[_0xb1be('0x23')]){if(_0x460829['error'][_0xb1be('0x24')]===0x1f4){logger['error'](_0xb1be('0x1f'),_0x5af865,_0x460829[_0xb1be('0x23')][_0xb1be('0x25')]);return _0x332f8f(_0x460829['error'][_0xb1be('0x25')]);}logger[_0xb1be('0x23')](_0xb1be('0x1f'),_0x5af865,_0x460829['error'][_0xb1be('0x25')]);return _0x20b128(_0x460829['error']['message']);}else{logger[_0xb1be('0x1e')](_0xb1be('0x1f'),_0x5af865,'request\x20sent');_0x20b128(_0x460829['result'][_0xb1be('0x25')]);}})[_0xb1be('0x26')](function(_0x4b79bc){logger[_0xb1be('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5af865,_0x4b79bc);_0x332f8f(_0x4b79bc);});});}function respondWithStatusCode(_0x2c3000,_0x376161){_0x376161=_0x376161||0xcc;return function(_0x3e5124){if(_0x3e5124){return _0x2c3000[_0xb1be('0x27')](_0x376161);}return _0x2c3000[_0xb1be('0x28')](_0x376161)[_0xb1be('0x29')]();};}function respondWithResult(_0xe28a54,_0x230b05){_0x230b05=_0x230b05||0xc8;return function(_0x5c2c85){if(_0x5c2c85){return _0xe28a54['status'](_0x230b05)['json'](_0x5c2c85);}};}function respondWithFilteredResult(_0x79538e,_0x2ac417){return function(_0xc0f20){if(_0xc0f20){var _0x35ed19=_0xc0f20[_0xb1be('0x2a')],_0x318989=_0x2ac417[_0xb1be('0x2b')],_0x45f473=_0x2ac417[_0xb1be('0x2b')]+_0x2ac417['limit'],_0x3e8673;if(_0x45f473>=_0x35ed19){_0x45f473=_0x35ed19;_0x3e8673=0xc8;}else{_0x3e8673=0xce;}_0x79538e[_0xb1be('0x28')](_0x3e8673);return _0x79538e['set'](_0xb1be('0x2c'),_0x318989+'-'+_0x45f473+'/'+_0x35ed19)[_0xb1be('0x2d')](_0xc0f20);}return null;};}function patchUpdates(_0x43a7a8){return function(_0x10d00f){try{jsonpatch[_0xb1be('0x2e')](_0x10d00f,_0x43a7a8,!![]);}catch(_0x274f06){return BPromise[_0xb1be('0x2f')](_0x274f06);}return _0x10d00f[_0xb1be('0x30')]();};}function saveUpdates(_0x5dc920,_0x3681a8){return function(_0x1acc58){if(_0x1acc58){return _0x1acc58['update'](_0x5dc920)[_0xb1be('0x1d')](function(_0x44cbc0){return _0x44cbc0;});}return null;};}function removeEntity(_0x1f746b,_0x33b249){return function(_0x485bbb){if(_0x485bbb){return _0x485bbb[_0xb1be('0x31')]()[_0xb1be('0x1d')](function(){_0x1f746b[_0xb1be('0x28')](0xcc)[_0xb1be('0x29')]();});}};}function handleEntityNotFound(_0x360e82,_0x4f7915){return function(_0x39106f){if(!_0x39106f){_0x360e82[_0xb1be('0x27')](0x194);}return _0x39106f;};}function handleError(_0x943638,_0x17e912){_0x17e912=_0x17e912||0x1f4;return function(_0x31b602){logger[_0xb1be('0x23')](_0x31b602['stack']);if(_0x31b602['name']){delete _0x31b602[_0xb1be('0x32')];}_0x943638['status'](_0x17e912)['send'](_0x31b602);};}exports[_0xb1be('0x33')]=function(_0x897343,_0x156e4d){var _0x4b9945={},_0x2a7412={},_0x37173a={'count':0x0,'rows':[]};var _0x53acdc=_[_0xb1be('0x34')](db[_0xb1be('0x35')][_0xb1be('0x36')],function(_0x27e44b){return{'name':_0x27e44b[_0xb1be('0x37')],'type':_0x27e44b[_0xb1be('0x38')][_0xb1be('0x39')]};});_0x2a7412[_0xb1be('0x3a')]=_[_0xb1be('0x34')](_0x53acdc,'name');_0x2a7412[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x897343['query']);_0x2a7412['filters']=_[_0xb1be('0x3d')](_0x2a7412[_0xb1be('0x3a')],_0x2a7412[_0xb1be('0x3b')]);_0x4b9945[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x2a7412['model'],qs[_0xb1be('0x3f')](_0x897343['query'][_0xb1be('0x3f')]));_0x4b9945[_0xb1be('0x3e')]=_0x4b9945[_0xb1be('0x3e')][_0xb1be('0x40')]?_0x4b9945[_0xb1be('0x3e')]:_0x2a7412['model'];if(!_0x897343[_0xb1be('0x3b')][_0xb1be('0x41')](_0xb1be('0x42'))){_0x4b9945[_0xb1be('0x43')]=qs['limit'](_0x897343[_0xb1be('0x3b')][_0xb1be('0x43')]);_0x4b9945[_0xb1be('0x2b')]=qs['offset'](_0x897343[_0xb1be('0x3b')][_0xb1be('0x2b')]);}_0x4b9945[_0xb1be('0x44')]=qs[_0xb1be('0x45')](_0x897343[_0xb1be('0x3b')][_0xb1be('0x45')]);_0x4b9945[_0xb1be('0x46')]=qs[_0xb1be('0x47')](_[_0xb1be('0x48')](_0x897343[_0xb1be('0x3b')],_0x2a7412[_0xb1be('0x47')]),_0x53acdc);if(_0x897343[_0xb1be('0x3b')][_0xb1be('0x49')]){_0x4b9945[_0xb1be('0x46')]=_[_0xb1be('0x4a')](_0x4b9945[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x53acdc,function(_0x44020c){if(_0x44020c[_0xb1be('0x38')]!=='VIRTUAL'){var _0x542747={};_0x542747[_0x44020c['name']]={'$like':'%'+_0x897343['query'][_0xb1be('0x49')]+'%'};return _0x542747;}})});}_0x4b9945=_['merge']({},_0x4b9945,_0x897343[_0xb1be('0x4b')]);var _0x4a558d={'where':_0x4b9945['where']};return db[_0xb1be('0x35')]['count'](_0x4a558d)[_0xb1be('0x1d')](function(_0x56fff9){_0x37173a[_0xb1be('0x2a')]=_0x56fff9;if(_0x897343[_0xb1be('0x3b')][_0xb1be('0x4c')]){_0x4b9945[_0xb1be('0x4d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb1be('0x4e')](_0x4b9945);})[_0xb1be('0x1d')](function(_0x58716f){_0x37173a['rows']=_0x58716f;return _0x37173a;})[_0xb1be('0x1d')](respondWithFilteredResult(_0x156e4d,_0x4b9945))[_0xb1be('0x26')](handleError(_0x156e4d,null));};exports[_0xb1be('0x4f')]=function(_0x20b648,_0x112238){var _0x2c1289={'raw':![],'where':{'id':_0x20b648[_0xb1be('0x50')]['id']}},_0x1fb24f={};_0x1fb24f[_0xb1be('0x3a')]=_['keys'](db['ZendeskConfiguration'][_0xb1be('0x36')]);_0x1fb24f[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x20b648['query']);_0x1fb24f['filters']=_[_0xb1be('0x3d')](_0x1fb24f[_0xb1be('0x3a')],_0x1fb24f[_0xb1be('0x3b')]);_0x2c1289['attributes']=_['intersection'](_0x1fb24f[_0xb1be('0x3a')],qs['fields'](_0x20b648[_0xb1be('0x3b')]['fields']));_0x2c1289[_0xb1be('0x3e')]=_0x2c1289['attributes']['length']?_0x2c1289[_0xb1be('0x3e')]:_0x1fb24f[_0xb1be('0x3a')];if(_0x20b648[_0xb1be('0x3b')]['includeAll']){_0x2c1289[_0xb1be('0x4d')]=[{'all':!![]}];}_0x2c1289=_[_0xb1be('0x4a')]({},_0x2c1289,_0x20b648[_0xb1be('0x4b')]);return db[_0xb1be('0x35')][_0xb1be('0x51')](_0x2c1289)[_0xb1be('0x1d')](handleEntityNotFound(_0x112238,null))[_0xb1be('0x1d')](respondWithResult(_0x112238,null))['catch'](handleError(_0x112238,null));};exports['create']=function(_0x56a1b0,_0x67933){return db['ZendeskConfiguration'][_0xb1be('0x52')](_0x56a1b0[_0xb1be('0x53')],{})['then'](respondWithResult(_0x67933,0xc9))['catch'](handleError(_0x67933,null));};exports[_0xb1be('0x54')]=function(_0x227539,_0xc5ecdd){if(_0x227539[_0xb1be('0x53')]['id']){delete _0x227539[_0xb1be('0x53')]['id'];}return db['ZendeskConfiguration'][_0xb1be('0x51')]({'where':{'id':_0x227539[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0xc5ecdd,null))[_0xb1be('0x1d')](saveUpdates(_0x227539[_0xb1be('0x53')],null))[_0xb1be('0x1d')](respondWithResult(_0xc5ecdd,null))[_0xb1be('0x26')](handleError(_0xc5ecdd,null));};exports['destroy']=function(_0x23f4a5,_0xc71040){return db['ZendeskConfiguration'][_0xb1be('0x51')]({'where':{'id':_0x23f4a5['params']['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0xc71040,null))[_0xb1be('0x1d')](removeEntity(_0xc71040,null))['catch'](handleError(_0xc71040,null));};exports[_0xb1be('0x55')]=function(_0x49b739,_0x45de65,_0x27509d){var _0x28f2c8={};var _0x305384={};var _0x16940e;var _0x3883f8;return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x49b739['params']['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x45de65,null))['then'](function(_0x38778d){if(_0x38778d){_0x16940e=_0x38778d;_0x305384[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x57')]['rawAttributes']);_0x305384['query']=_[_0xb1be('0x3c')](_0x49b739[_0xb1be('0x3b')]);_0x305384['filters']=_[_0xb1be('0x3d')](_0x305384[_0xb1be('0x3a')],_0x305384[_0xb1be('0x3b')]);_0x28f2c8[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x305384[_0xb1be('0x3a')],qs[_0xb1be('0x3f')](_0x49b739[_0xb1be('0x3b')][_0xb1be('0x3f')]));_0x28f2c8[_0xb1be('0x3e')]=_0x28f2c8[_0xb1be('0x3e')]['length']?_0x28f2c8[_0xb1be('0x3e')]:_0x305384[_0xb1be('0x3a')];_0x28f2c8[_0xb1be('0x44')]=qs[_0xb1be('0x45')](_0x49b739['query'][_0xb1be('0x45')]);_0x28f2c8['where']=qs[_0xb1be('0x47')](_['pick'](_0x49b739['query'],_0x305384['filters']));if(_0x49b739['query'][_0xb1be('0x49')]){_0x28f2c8['where']=_['merge'](_0x28f2c8[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x28f2c8[_0xb1be('0x3e')],function(_0x5d623d){var _0x1ff243={};_0x1ff243[_0x5d623d]={'$like':'%'+_0x49b739['query'][_0xb1be('0x49')]+'%'};return _0x1ff243;})});}_0x28f2c8=_[_0xb1be('0x4a')]({},_0x28f2c8,_0x49b739[_0xb1be('0x4b')]);return _0x16940e['getFields'](_0x28f2c8);}})[_0xb1be('0x1d')](function(_0x3bcf25){if(_0x3bcf25){_0x3883f8=_0x3bcf25[_0xb1be('0x40')];if(!_0x49b739[_0xb1be('0x3b')][_0xb1be('0x41')]('nolimit')){_0x28f2c8[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x49b739['query'][_0xb1be('0x43')]);_0x28f2c8[_0xb1be('0x2b')]=qs[_0xb1be('0x2b')](_0x49b739[_0xb1be('0x3b')][_0xb1be('0x2b')]);}return _0x16940e['getFields'](_0x28f2c8);}})[_0xb1be('0x1d')](function(_0x252635){if(_0x252635){return _0x252635?{'count':_0x3883f8,'rows':_0x252635}:null;}})['then'](respondWithResult(_0x45de65,null))['catch'](handleError(_0x45de65,null));};exports[_0xb1be('0x58')]=function(_0x57a3e6,_0x49e342,_0x18a7df){var _0x15e27b={};var _0x3f6428={};var _0x3f16b0;var _0x4fa168;return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x57a3e6[_0xb1be('0x50')]['id']}})['then'](handleEntityNotFound(_0x49e342,null))[_0xb1be('0x1d')](function(_0x3b0e2e){if(_0x3b0e2e){_0x3f16b0=_0x3b0e2e;_0x3f6428[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x57')][_0xb1be('0x36')]);_0x3f6428[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x57a3e6['query']);_0x3f6428['filters']=_[_0xb1be('0x3d')](_0x3f6428['model'],_0x3f6428[_0xb1be('0x3b')]);_0x15e27b[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x3f6428[_0xb1be('0x3a')],qs['fields'](_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x3f')]));_0x15e27b[_0xb1be('0x3e')]=_0x15e27b[_0xb1be('0x3e')]['length']?_0x15e27b['attributes']:_0x3f6428[_0xb1be('0x3a')];_0x15e27b['order']=qs[_0xb1be('0x45')](_0x57a3e6[_0xb1be('0x3b')]['sort']);_0x15e27b['where']=qs[_0xb1be('0x47')](_[_0xb1be('0x48')](_0x57a3e6[_0xb1be('0x3b')],_0x3f6428[_0xb1be('0x47')]));if(_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x49')]){_0x15e27b[_0xb1be('0x46')]=_['merge'](_0x15e27b[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x15e27b[_0xb1be('0x3e')],function(_0x310d53){var _0x3c481b={};_0x3c481b[_0x310d53]={'$like':'%'+_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x49')]+'%'};return _0x3c481b;})});}_0x15e27b=_[_0xb1be('0x4a')]({},_0x15e27b,_0x57a3e6[_0xb1be('0x4b')]);return _0x3f16b0['getSubjects'](_0x15e27b);}})[_0xb1be('0x1d')](function(_0x5bf254){if(_0x5bf254){_0x4fa168=_0x5bf254[_0xb1be('0x40')];if(!_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x41')](_0xb1be('0x42'))){_0x15e27b[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x43')]);_0x15e27b[_0xb1be('0x2b')]=qs[_0xb1be('0x2b')](_0x57a3e6['query'][_0xb1be('0x2b')]);}return _0x3f16b0[_0xb1be('0x58')](_0x15e27b);}})[_0xb1be('0x1d')](function(_0x13e7da){if(_0x13e7da){return _0x13e7da?{'count':_0x4fa168,'rows':_0x13e7da}:null;}})['then'](respondWithResult(_0x49e342,null))['catch'](handleError(_0x49e342,null));};exports[_0xb1be('0x59')]=function(_0x2562d3,_0x29854f,_0x55dc69){var _0x349822={};var _0x35e438={};var _0x134b0b;var _0x6a8bd4;return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x2562d3[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x29854f,null))[_0xb1be('0x1d')](function(_0x253445){if(_0x253445){_0x134b0b=_0x253445;_0x35e438[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x57')]['rawAttributes']);_0x35e438[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x2562d3[_0xb1be('0x3b')]);_0x35e438[_0xb1be('0x47')]=_[_0xb1be('0x3d')](_0x35e438[_0xb1be('0x3a')],_0x35e438[_0xb1be('0x3b')]);_0x349822[_0xb1be('0x3e')]=_['intersection'](_0x35e438[_0xb1be('0x3a')],qs['fields'](_0x2562d3['query']['fields']));_0x349822[_0xb1be('0x3e')]=_0x349822[_0xb1be('0x3e')][_0xb1be('0x40')]?_0x349822[_0xb1be('0x3e')]:_0x35e438[_0xb1be('0x3a')];_0x349822[_0xb1be('0x44')]=qs[_0xb1be('0x45')](_0x2562d3[_0xb1be('0x3b')][_0xb1be('0x45')]);_0x349822[_0xb1be('0x46')]=qs[_0xb1be('0x47')](_['pick'](_0x2562d3[_0xb1be('0x3b')],_0x35e438[_0xb1be('0x47')]));if(_0x2562d3[_0xb1be('0x3b')]['filter']){_0x349822[_0xb1be('0x46')]=_[_0xb1be('0x4a')](_0x349822['where'],{'$or':_['map'](_0x349822[_0xb1be('0x3e')],function(_0x4ba7f6){var _0x12620f={};_0x12620f[_0x4ba7f6]={'$like':'%'+_0x2562d3[_0xb1be('0x3b')][_0xb1be('0x49')]+'%'};return _0x12620f;})});}_0x349822=_[_0xb1be('0x4a')]({},_0x349822,_0x2562d3[_0xb1be('0x4b')]);return _0x134b0b[_0xb1be('0x59')](_0x349822);}})[_0xb1be('0x1d')](function(_0x1a2249){if(_0x1a2249){_0x6a8bd4=_0x1a2249[_0xb1be('0x40')];if(!_0x2562d3['query']['hasOwnProperty']('nolimit')){_0x349822[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x2562d3[_0xb1be('0x3b')][_0xb1be('0x43')]);_0x349822[_0xb1be('0x2b')]=qs[_0xb1be('0x2b')](_0x2562d3[_0xb1be('0x3b')]['offset']);}return _0x134b0b[_0xb1be('0x59')](_0x349822);}})[_0xb1be('0x1d')](function(_0x75f14b){if(_0x75f14b){return _0x75f14b?{'count':_0x6a8bd4,'rows':_0x75f14b}:null;}})[_0xb1be('0x1d')](respondWithResult(_0x29854f,null))['catch'](handleError(_0x29854f,null));};exports['getTags']=function(_0x1d0138,_0x142aa4,_0x2a68a9){var _0x34c74f={};var _0x5dd973={};var _0x5212f8;var _0x243338;return db['ZendeskConfiguration'][_0xb1be('0x56')]({'where':{'id':_0x1d0138[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x142aa4,null))[_0xb1be('0x1d')](function(_0x19d14b){if(_0x19d14b){_0x5212f8=_0x19d14b;_0x5dd973[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x5a')][_0xb1be('0x36')]);_0x5dd973[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x1d0138[_0xb1be('0x3b')]);_0x5dd973[_0xb1be('0x47')]=_[_0xb1be('0x3d')](_0x5dd973[_0xb1be('0x3a')],_0x5dd973[_0xb1be('0x3b')]);_0x34c74f[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x5dd973[_0xb1be('0x3a')],qs[_0xb1be('0x3f')](_0x1d0138[_0xb1be('0x3b')][_0xb1be('0x3f')]));_0x34c74f[_0xb1be('0x3e')]=_0x34c74f[_0xb1be('0x3e')][_0xb1be('0x40')]?_0x34c74f['attributes']:_0x5dd973[_0xb1be('0x3a')];_0x34c74f[_0xb1be('0x44')]=qs['sort'](_0x1d0138[_0xb1be('0x3b')]['sort']);_0x34c74f[_0xb1be('0x46')]=qs['filters'](_[_0xb1be('0x48')](_0x1d0138[_0xb1be('0x3b')],_0x5dd973[_0xb1be('0x47')]));if(_0x1d0138['query']['filter']){_0x34c74f[_0xb1be('0x46')]=_[_0xb1be('0x4a')](_0x34c74f[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x34c74f[_0xb1be('0x3e')],function(_0x51eb20){var _0x4db2de={};_0x4db2de[_0x51eb20]={'$like':'%'+_0x1d0138[_0xb1be('0x3b')][_0xb1be('0x49')]+'%'};return _0x4db2de;})});}_0x34c74f=_[_0xb1be('0x4a')]({},_0x34c74f,_0x1d0138[_0xb1be('0x4b')]);return _0x5212f8[_0xb1be('0x5b')](_0x34c74f);}})[_0xb1be('0x1d')](function(_0x16a83e){if(_0x16a83e){_0x243338=_0x16a83e[_0xb1be('0x40')];if(!_0x1d0138['query'][_0xb1be('0x41')](_0xb1be('0x42'))){_0x34c74f[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x1d0138['query'][_0xb1be('0x43')]);_0x34c74f[_0xb1be('0x2b')]=qs['offset'](_0x1d0138[_0xb1be('0x3b')][_0xb1be('0x2b')]);}return _0x5212f8[_0xb1be('0x5b')](_0x34c74f);}})['then'](function(_0x38a70b){if(_0x38a70b){return _0x38a70b?{'count':_0x243338,'rows':_0x38a70b}:null;}})['then'](respondWithResult(_0x142aa4,null))[_0xb1be('0x26')](handleError(_0x142aa4,null));};exports['setTags']=function(_0x3e201c,_0x492834,_0x4574b3){if(_0x3e201c[_0xb1be('0x53')]['id']){delete _0x3e201c['body']['id'];}return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x3e201c[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x492834,null))[_0xb1be('0x1d')](function(_0x5c30fc){if(_0x5c30fc){return _0x5c30fc[_0xb1be('0x5c')](_0x3e201c['body'][_0xb1be('0x5d')]||[]);}return null;})[_0xb1be('0x1d')](respondWithResult(_0x492834,null))[_0xb1be('0x26')](handleError(_0x492834,null));}; \ No newline at end of file +var _0xf96c=['length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','ZendeskConfiguration','create','body','find','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','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','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xf96c,0x140));var _0xcf96=function(_0x84445b,_0x4ab3ad){_0x84445b=_0x84445b-0x0;var _0x46d165=_0xf96c[_0x84445b];return _0x46d165;};'use strict';var pdf=require(_0xcf96('0x0'));var emlformat=require(_0xcf96('0x1'));var rimraf=require(_0xcf96('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf96('0x3'));var rp=require(_0xcf96('0x4'));var moment=require(_0xcf96('0x5'));var BPromise=require(_0xcf96('0x6'));var Mustache=require(_0xcf96('0x7'));var util=require(_0xcf96('0x8'));var path=require(_0xcf96('0x9'));var sox=require(_0xcf96('0xa'));var csv=require(_0xcf96('0xb'));var ejs=require(_0xcf96('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcf96('0xd'));var jsforce=require(_0xcf96('0xe'));var deskjs=require(_0xcf96('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf96('0x10'));var Papa=require(_0xcf96('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf96('0x12'));var as=require(_0xcf96('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf96('0x14'))(_0xcf96('0x15'));var utils=require(_0xcf96('0x16'));var config=require('../../config/environment');var db=require(_0xcf96('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xcf96('0x18')]({'port':0x232a});function checkPasswordPattern(_0x227695,_0x50f044,_0x490614){if(_0x490614){var _0x12cc3c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12cc3c['test'](_0x50f044)){return _0x227695;}else{throw new db[(_0xcf96('0x19'))][(_0xcf96('0x1a'))](_0xcf96('0x1b'));}}else{return _0x227695;}}function respondWithRpcPromise(_0x29b2cf,_0x5582d0,_0x294525,_0x1ade07){return new BPromise(function(_0x277510,_0x57fd07){var _0x251d75=_0x1ade07||client;return _0x251d75['request'](_0x29b2cf,_0x294525)[_0xcf96('0x1c')](function(_0x5689ed){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5582d0,_0xcf96('0x1d'));logger[_0xcf96('0x1e')](_0xcf96('0x1f'),_0x5582d0,_0xcf96('0x1d'),JSON['stringify'](_0x5689ed));if(_0x5689ed[_0xcf96('0x20')]){if(_0x5689ed[_0xcf96('0x20')][_0xcf96('0x21')]===0x1f4){logger[_0xcf96('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5582d0,_0x5689ed[_0xcf96('0x20')][_0xcf96('0x22')]);return _0x57fd07(_0x5689ed[_0xcf96('0x20')][_0xcf96('0x22')]);}logger[_0xcf96('0x20')](_0xcf96('0x23'),_0x5582d0,_0x5689ed['error'][_0xcf96('0x22')]);return _0x277510(_0x5689ed[_0xcf96('0x20')][_0xcf96('0x22')]);}else{logger[_0xcf96('0x24')](_0xcf96('0x23'),_0x5582d0,_0xcf96('0x1d'));_0x277510(_0x5689ed['result'][_0xcf96('0x22')]);}})[_0xcf96('0x25')](function(_0x305fa8){logger[_0xcf96('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5582d0,_0x305fa8);_0x57fd07(_0x305fa8);});});}function respondWithStatusCode(_0x4cf823,_0x1daf0a){_0x1daf0a=_0x1daf0a||0xcc;return function(_0x59c6ba){if(_0x59c6ba){return _0x4cf823[_0xcf96('0x26')](_0x1daf0a);}return _0x4cf823[_0xcf96('0x27')](_0x1daf0a)[_0xcf96('0x28')]();};}function respondWithResult(_0x1cc38a,_0xe44d25){_0xe44d25=_0xe44d25||0xc8;return function(_0x31c14b){if(_0x31c14b){return _0x1cc38a[_0xcf96('0x27')](_0xe44d25)[_0xcf96('0x29')](_0x31c14b);}};}function respondWithFilteredResult(_0x2a614a,_0x3eee65){return function(_0x225351){if(_0x225351){var _0x162d56=_0x225351[_0xcf96('0x2a')],_0x39ccf3=_0x3eee65['offset'],_0x585ddf=_0x3eee65['offset']+_0x3eee65['limit'],_0xac76b7;if(_0x585ddf>=_0x162d56){_0x585ddf=_0x162d56;_0xac76b7=0xc8;}else{_0xac76b7=0xce;}_0x2a614a[_0xcf96('0x27')](_0xac76b7);return _0x2a614a['set'](_0xcf96('0x2b'),_0x39ccf3+'-'+_0x585ddf+'/'+_0x162d56)[_0xcf96('0x29')](_0x225351);}return null;};}function patchUpdates(_0x4c563a){return function(_0x577841){try{jsonpatch[_0xcf96('0x2c')](_0x577841,_0x4c563a,!![]);}catch(_0x55c1e9){return BPromise[_0xcf96('0x2d')](_0x55c1e9);}return _0x577841[_0xcf96('0x2e')]();};}function saveUpdates(_0x3cc0d1,_0x2d335a){return function(_0x3c5ce9){if(_0x3c5ce9){return _0x3c5ce9[_0xcf96('0x2f')](_0x3cc0d1)['then'](function(_0x25f076){return _0x25f076;});}return null;};}function removeEntity(_0xa8c8d,_0x5006da){return function(_0x5ce67f){if(_0x5ce67f){return _0x5ce67f[_0xcf96('0x30')]()[_0xcf96('0x1c')](function(){_0xa8c8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14712d,_0x264f82){return function(_0x3e724c){if(!_0x3e724c){_0x14712d[_0xcf96('0x26')](0x194);}return _0x3e724c;};}function handleError(_0xf103ce,_0x5a3f77){_0x5a3f77=_0x5a3f77||0x1f4;return function(_0x87ec75){logger['error'](_0x87ec75[_0xcf96('0x31')]);if(_0x87ec75['name']){delete _0x87ec75[_0xcf96('0x32')];}_0xf103ce['status'](_0x5a3f77)[_0xcf96('0x33')](_0x87ec75);};}exports[_0xcf96('0x34')]=function(_0x25b8b9,_0x288e2f){var _0x4580b9={},_0x43edb0={},_0x559b3d={'count':0x0,'rows':[]};var _0xdf0f67=_[_0xcf96('0x35')](db['ZendeskConfiguration'][_0xcf96('0x36')],function(_0x24ac51){return{'name':_0x24ac51[_0xcf96('0x37')],'type':_0x24ac51[_0xcf96('0x38')][_0xcf96('0x39')]};});_0x43edb0[_0xcf96('0x3a')]=_[_0xcf96('0x35')](_0xdf0f67,_0xcf96('0x32'));_0x43edb0[_0xcf96('0x3b')]=_['keys'](_0x25b8b9['query']);_0x43edb0[_0xcf96('0x3c')]=_['intersection'](_0x43edb0[_0xcf96('0x3a')],_0x43edb0[_0xcf96('0x3b')]);_0x4580b9['attributes']=_[_0xcf96('0x3d')](_0x43edb0['model'],qs[_0xcf96('0x3e')](_0x25b8b9[_0xcf96('0x3b')]['fields']));_0x4580b9[_0xcf96('0x3f')]=_0x4580b9[_0xcf96('0x3f')][_0xcf96('0x40')]?_0x4580b9['attributes']:_0x43edb0[_0xcf96('0x3a')];if(!_0x25b8b9[_0xcf96('0x3b')][_0xcf96('0x41')](_0xcf96('0x42'))){_0x4580b9['limit']=qs[_0xcf96('0x43')](_0x25b8b9[_0xcf96('0x3b')][_0xcf96('0x43')]);_0x4580b9[_0xcf96('0x44')]=qs['offset'](_0x25b8b9[_0xcf96('0x3b')]['offset']);}_0x4580b9[_0xcf96('0x45')]=qs[_0xcf96('0x46')](_0x25b8b9['query'][_0xcf96('0x46')]);_0x4580b9[_0xcf96('0x47')]=qs['filters'](_['pick'](_0x25b8b9[_0xcf96('0x3b')],_0x43edb0['filters']),_0xdf0f67);if(_0x25b8b9[_0xcf96('0x3b')][_0xcf96('0x48')]){_0x4580b9['where']=_['merge'](_0x4580b9[_0xcf96('0x47')],{'$or':_[_0xcf96('0x35')](_0xdf0f67,function(_0x44363a){if(_0x44363a['type']!==_0xcf96('0x49')){var _0x46ef51={};_0x46ef51[_0x44363a[_0xcf96('0x32')]]={'$like':'%'+_0x25b8b9[_0xcf96('0x3b')][_0xcf96('0x48')]+'%'};return _0x46ef51;}})});}_0x4580b9=_[_0xcf96('0x4a')]({},_0x4580b9,_0x25b8b9[_0xcf96('0x4b')]);var _0x1b5882={'where':_0x4580b9['where']};return db['ZendeskConfiguration'][_0xcf96('0x2a')](_0x1b5882)[_0xcf96('0x1c')](function(_0x276ae3){_0x559b3d[_0xcf96('0x2a')]=_0x276ae3;if(_0x25b8b9['query'][_0xcf96('0x4c')]){_0x4580b9[_0xcf96('0x4d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xcf96('0x4e')](_0x4580b9);})[_0xcf96('0x1c')](function(_0xb45af7){_0x559b3d['rows']=_0xb45af7;return _0x559b3d;})[_0xcf96('0x1c')](respondWithFilteredResult(_0x288e2f,_0x4580b9))[_0xcf96('0x25')](handleError(_0x288e2f,null));};exports[_0xcf96('0x4f')]=function(_0x436ed0,_0x19a89b){var _0x11dfec={'raw':![],'where':{'id':_0x436ed0[_0xcf96('0x50')]['id']}},_0x146cd3={};_0x146cd3[_0xcf96('0x3a')]=_[_0xcf96('0x51')](db[_0xcf96('0x52')][_0xcf96('0x36')]);_0x146cd3[_0xcf96('0x3b')]=_[_0xcf96('0x51')](_0x436ed0[_0xcf96('0x3b')]);_0x146cd3['filters']=_[_0xcf96('0x3d')](_0x146cd3[_0xcf96('0x3a')],_0x146cd3[_0xcf96('0x3b')]);_0x11dfec[_0xcf96('0x3f')]=_['intersection'](_0x146cd3[_0xcf96('0x3a')],qs[_0xcf96('0x3e')](_0x436ed0['query'][_0xcf96('0x3e')]));_0x11dfec[_0xcf96('0x3f')]=_0x11dfec[_0xcf96('0x3f')]['length']?_0x11dfec[_0xcf96('0x3f')]:_0x146cd3[_0xcf96('0x3a')];if(_0x436ed0[_0xcf96('0x3b')][_0xcf96('0x4c')]){_0x11dfec[_0xcf96('0x4d')]=[{'all':!![]}];}_0x11dfec=_[_0xcf96('0x4a')]({},_0x11dfec,_0x436ed0[_0xcf96('0x4b')]);return db[_0xcf96('0x52')]['find'](_0x11dfec)[_0xcf96('0x1c')](handleEntityNotFound(_0x19a89b,null))['then'](respondWithResult(_0x19a89b,null))[_0xcf96('0x25')](handleError(_0x19a89b,null));};exports[_0xcf96('0x53')]=function(_0x3af6e2,_0x2e5c72){return db[_0xcf96('0x52')]['create'](_0x3af6e2[_0xcf96('0x54')],{})[_0xcf96('0x1c')](respondWithResult(_0x2e5c72,0xc9))[_0xcf96('0x25')](handleError(_0x2e5c72,null));};exports[_0xcf96('0x2f')]=function(_0x1f3188,_0xdc46c){if(_0x1f3188[_0xcf96('0x54')]['id']){delete _0x1f3188[_0xcf96('0x54')]['id'];}return db['ZendeskConfiguration'][_0xcf96('0x55')]({'where':{'id':_0x1f3188['params']['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0xdc46c,null))[_0xcf96('0x1c')](saveUpdates(_0x1f3188[_0xcf96('0x54')],null))[_0xcf96('0x1c')](respondWithResult(_0xdc46c,null))[_0xcf96('0x25')](handleError(_0xdc46c,null));};exports[_0xcf96('0x30')]=function(_0x38aeb9,_0x327680){return db[_0xcf96('0x52')][_0xcf96('0x55')]({'where':{'id':_0x38aeb9[_0xcf96('0x50')]['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0x327680,null))[_0xcf96('0x1c')](removeEntity(_0x327680,null))[_0xcf96('0x25')](handleError(_0x327680,null));};exports[_0xcf96('0x56')]=function(_0x4c4305,_0x4b1930,_0x55bc39){var _0x4b1edc={};var _0x233d21={};var _0x508fb3;var _0x5eccf7;return db[_0xcf96('0x52')][_0xcf96('0x57')]({'where':{'id':_0x4c4305[_0xcf96('0x50')]['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0x4b1930,null))[_0xcf96('0x1c')](function(_0x38f885){if(_0x38f885){_0x508fb3=_0x38f885;_0x233d21['model']=_[_0xcf96('0x51')](db[_0xcf96('0x58')][_0xcf96('0x36')]);_0x233d21[_0xcf96('0x3b')]=_[_0xcf96('0x51')](_0x4c4305[_0xcf96('0x3b')]);_0x233d21[_0xcf96('0x3c')]=_['intersection'](_0x233d21['model'],_0x233d21['query']);_0x4b1edc[_0xcf96('0x3f')]=_[_0xcf96('0x3d')](_0x233d21[_0xcf96('0x3a')],qs[_0xcf96('0x3e')](_0x4c4305[_0xcf96('0x3b')][_0xcf96('0x3e')]));_0x4b1edc[_0xcf96('0x3f')]=_0x4b1edc[_0xcf96('0x3f')][_0xcf96('0x40')]?_0x4b1edc[_0xcf96('0x3f')]:_0x233d21['model'];_0x4b1edc[_0xcf96('0x45')]=qs[_0xcf96('0x46')](_0x4c4305[_0xcf96('0x3b')]['sort']);_0x4b1edc[_0xcf96('0x47')]=qs[_0xcf96('0x3c')](_[_0xcf96('0x59')](_0x4c4305[_0xcf96('0x3b')],_0x233d21[_0xcf96('0x3c')]));if(_0x4c4305[_0xcf96('0x3b')]['filter']){_0x4b1edc[_0xcf96('0x47')]=_[_0xcf96('0x4a')](_0x4b1edc[_0xcf96('0x47')],{'$or':_['map'](_0x4b1edc['attributes'],function(_0x24a518){var _0x1ae0f0={};_0x1ae0f0[_0x24a518]={'$like':'%'+_0x4c4305[_0xcf96('0x3b')][_0xcf96('0x48')]+'%'};return _0x1ae0f0;})});}_0x4b1edc=_[_0xcf96('0x4a')]({},_0x4b1edc,_0x4c4305[_0xcf96('0x4b')]);return _0x508fb3['getFields'](_0x4b1edc);}})[_0xcf96('0x1c')](function(_0x475ac6){if(_0x475ac6){_0x5eccf7=_0x475ac6[_0xcf96('0x40')];if(!_0x4c4305['query']['hasOwnProperty'](_0xcf96('0x42'))){_0x4b1edc['limit']=qs['limit'](_0x4c4305['query'][_0xcf96('0x43')]);_0x4b1edc['offset']=qs['offset'](_0x4c4305[_0xcf96('0x3b')]['offset']);}return _0x508fb3[_0xcf96('0x56')](_0x4b1edc);}})[_0xcf96('0x1c')](function(_0x51ff26){if(_0x51ff26){return _0x51ff26?{'count':_0x5eccf7,'rows':_0x51ff26}:null;}})[_0xcf96('0x1c')](respondWithResult(_0x4b1930,null))[_0xcf96('0x25')](handleError(_0x4b1930,null));};exports['getSubjects']=function(_0x48c29d,_0x47525d,_0x1b68d0){var _0x1646f4={};var _0x8124ca={};var _0x34ce3b;var _0x2965a7;return db[_0xcf96('0x52')][_0xcf96('0x57')]({'where':{'id':_0x48c29d[_0xcf96('0x50')]['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0x47525d,null))[_0xcf96('0x1c')](function(_0x2e551f){if(_0x2e551f){_0x34ce3b=_0x2e551f;_0x8124ca[_0xcf96('0x3a')]=_[_0xcf96('0x51')](db[_0xcf96('0x58')][_0xcf96('0x36')]);_0x8124ca[_0xcf96('0x3b')]=_['keys'](_0x48c29d[_0xcf96('0x3b')]);_0x8124ca[_0xcf96('0x3c')]=_[_0xcf96('0x3d')](_0x8124ca[_0xcf96('0x3a')],_0x8124ca[_0xcf96('0x3b')]);_0x1646f4[_0xcf96('0x3f')]=_[_0xcf96('0x3d')](_0x8124ca[_0xcf96('0x3a')],qs[_0xcf96('0x3e')](_0x48c29d['query'][_0xcf96('0x3e')]));_0x1646f4[_0xcf96('0x3f')]=_0x1646f4['attributes'][_0xcf96('0x40')]?_0x1646f4['attributes']:_0x8124ca['model'];_0x1646f4[_0xcf96('0x45')]=qs[_0xcf96('0x46')](_0x48c29d['query'][_0xcf96('0x46')]);_0x1646f4['where']=qs['filters'](_[_0xcf96('0x59')](_0x48c29d[_0xcf96('0x3b')],_0x8124ca['filters']));if(_0x48c29d[_0xcf96('0x3b')][_0xcf96('0x48')]){_0x1646f4[_0xcf96('0x47')]=_['merge'](_0x1646f4['where'],{'$or':_[_0xcf96('0x35')](_0x1646f4[_0xcf96('0x3f')],function(_0x431f7d){var _0x7d9151={};_0x7d9151[_0x431f7d]={'$like':'%'+_0x48c29d[_0xcf96('0x3b')]['filter']+'%'};return _0x7d9151;})});}_0x1646f4=_[_0xcf96('0x4a')]({},_0x1646f4,_0x48c29d[_0xcf96('0x4b')]);return _0x34ce3b['getSubjects'](_0x1646f4);}})[_0xcf96('0x1c')](function(_0x5bde7f){if(_0x5bde7f){_0x2965a7=_0x5bde7f['length'];if(!_0x48c29d['query'][_0xcf96('0x41')](_0xcf96('0x42'))){_0x1646f4[_0xcf96('0x43')]=qs['limit'](_0x48c29d[_0xcf96('0x3b')][_0xcf96('0x43')]);_0x1646f4[_0xcf96('0x44')]=qs['offset'](_0x48c29d[_0xcf96('0x3b')][_0xcf96('0x44')]);}return _0x34ce3b[_0xcf96('0x5a')](_0x1646f4);}})[_0xcf96('0x1c')](function(_0x381eea){if(_0x381eea){return _0x381eea?{'count':_0x2965a7,'rows':_0x381eea}:null;}})[_0xcf96('0x1c')](respondWithResult(_0x47525d,null))[_0xcf96('0x25')](handleError(_0x47525d,null));};exports['getDescriptions']=function(_0x39b6c2,_0x56e5f6,_0x26a4bd){var _0x42df6c={};var _0x3a1b61={};var _0x182dcd;var _0x5af11f;return db[_0xcf96('0x52')][_0xcf96('0x57')]({'where':{'id':_0x39b6c2['params']['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0x56e5f6,null))[_0xcf96('0x1c')](function(_0x8b276f){if(_0x8b276f){_0x182dcd=_0x8b276f;_0x3a1b61['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x3a1b61[_0xcf96('0x3b')]=_[_0xcf96('0x51')](_0x39b6c2['query']);_0x3a1b61[_0xcf96('0x3c')]=_[_0xcf96('0x3d')](_0x3a1b61[_0xcf96('0x3a')],_0x3a1b61[_0xcf96('0x3b')]);_0x42df6c[_0xcf96('0x3f')]=_[_0xcf96('0x3d')](_0x3a1b61[_0xcf96('0x3a')],qs['fields'](_0x39b6c2[_0xcf96('0x3b')][_0xcf96('0x3e')]));_0x42df6c[_0xcf96('0x3f')]=_0x42df6c['attributes'][_0xcf96('0x40')]?_0x42df6c['attributes']:_0x3a1b61[_0xcf96('0x3a')];_0x42df6c[_0xcf96('0x45')]=qs[_0xcf96('0x46')](_0x39b6c2[_0xcf96('0x3b')]['sort']);_0x42df6c[_0xcf96('0x47')]=qs[_0xcf96('0x3c')](_[_0xcf96('0x59')](_0x39b6c2[_0xcf96('0x3b')],_0x3a1b61[_0xcf96('0x3c')]));if(_0x39b6c2[_0xcf96('0x3b')][_0xcf96('0x48')]){_0x42df6c['where']=_[_0xcf96('0x4a')](_0x42df6c['where'],{'$or':_[_0xcf96('0x35')](_0x42df6c[_0xcf96('0x3f')],function(_0x21a890){var _0x5ae9f6={};_0x5ae9f6[_0x21a890]={'$like':'%'+_0x39b6c2[_0xcf96('0x3b')][_0xcf96('0x48')]+'%'};return _0x5ae9f6;})});}_0x42df6c=_[_0xcf96('0x4a')]({},_0x42df6c,_0x39b6c2[_0xcf96('0x4b')]);return _0x182dcd[_0xcf96('0x5b')](_0x42df6c);}})[_0xcf96('0x1c')](function(_0x54126c){if(_0x54126c){_0x5af11f=_0x54126c[_0xcf96('0x40')];if(!_0x39b6c2[_0xcf96('0x3b')]['hasOwnProperty'](_0xcf96('0x42'))){_0x42df6c[_0xcf96('0x43')]=qs[_0xcf96('0x43')](_0x39b6c2[_0xcf96('0x3b')][_0xcf96('0x43')]);_0x42df6c[_0xcf96('0x44')]=qs[_0xcf96('0x44')](_0x39b6c2[_0xcf96('0x3b')][_0xcf96('0x44')]);}return _0x182dcd[_0xcf96('0x5b')](_0x42df6c);}})[_0xcf96('0x1c')](function(_0x5954b8){if(_0x5954b8){return _0x5954b8?{'count':_0x5af11f,'rows':_0x5954b8}:null;}})[_0xcf96('0x1c')](respondWithResult(_0x56e5f6,null))['catch'](handleError(_0x56e5f6,null));};exports[_0xcf96('0x5c')]=function(_0x1ec02e,_0x2004b3,_0x27f975){var _0x33742d={};var _0x14b347={};var _0x28efde;var _0x4acd81;return db['ZendeskConfiguration'][_0xcf96('0x57')]({'where':{'id':_0x1ec02e[_0xcf96('0x50')]['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0x2004b3,null))[_0xcf96('0x1c')](function(_0x1e054f){if(_0x1e054f){_0x28efde=_0x1e054f;_0x14b347[_0xcf96('0x3a')]=_[_0xcf96('0x51')](db[_0xcf96('0x5d')][_0xcf96('0x36')]);_0x14b347[_0xcf96('0x3b')]=_[_0xcf96('0x51')](_0x1ec02e['query']);_0x14b347[_0xcf96('0x3c')]=_['intersection'](_0x14b347[_0xcf96('0x3a')],_0x14b347['query']);_0x33742d[_0xcf96('0x3f')]=_[_0xcf96('0x3d')](_0x14b347[_0xcf96('0x3a')],qs[_0xcf96('0x3e')](_0x1ec02e[_0xcf96('0x3b')][_0xcf96('0x3e')]));_0x33742d[_0xcf96('0x3f')]=_0x33742d['attributes'][_0xcf96('0x40')]?_0x33742d[_0xcf96('0x3f')]:_0x14b347[_0xcf96('0x3a')];_0x33742d[_0xcf96('0x45')]=qs['sort'](_0x1ec02e[_0xcf96('0x3b')][_0xcf96('0x46')]);_0x33742d[_0xcf96('0x47')]=qs[_0xcf96('0x3c')](_[_0xcf96('0x59')](_0x1ec02e[_0xcf96('0x3b')],_0x14b347[_0xcf96('0x3c')]));if(_0x1ec02e['query']['filter']){_0x33742d[_0xcf96('0x47')]=_[_0xcf96('0x4a')](_0x33742d[_0xcf96('0x47')],{'$or':_[_0xcf96('0x35')](_0x33742d['attributes'],function(_0x35e538){var _0xddbe7={};_0xddbe7[_0x35e538]={'$like':'%'+_0x1ec02e['query']['filter']+'%'};return _0xddbe7;})});}_0x33742d=_[_0xcf96('0x4a')]({},_0x33742d,_0x1ec02e[_0xcf96('0x4b')]);return _0x28efde[_0xcf96('0x5c')](_0x33742d);}})[_0xcf96('0x1c')](function(_0x26d45b){if(_0x26d45b){_0x4acd81=_0x26d45b[_0xcf96('0x40')];if(!_0x1ec02e[_0xcf96('0x3b')]['hasOwnProperty']('nolimit')){_0x33742d['limit']=qs[_0xcf96('0x43')](_0x1ec02e[_0xcf96('0x3b')][_0xcf96('0x43')]);_0x33742d[_0xcf96('0x44')]=qs[_0xcf96('0x44')](_0x1ec02e[_0xcf96('0x3b')][_0xcf96('0x44')]);}return _0x28efde[_0xcf96('0x5c')](_0x33742d);}})['then'](function(_0x3b1446){if(_0x3b1446){return _0x3b1446?{'count':_0x4acd81,'rows':_0x3b1446}:null;}})[_0xcf96('0x1c')](respondWithResult(_0x2004b3,null))[_0xcf96('0x25')](handleError(_0x2004b3,null));};exports[_0xcf96('0x5e')]=function(_0xa49029,_0x8876c8,_0x1d1c95){if(_0xa49029[_0xcf96('0x54')]['id']){delete _0xa49029[_0xcf96('0x54')]['id'];}return db[_0xcf96('0x52')][_0xcf96('0x57')]({'where':{'id':_0xa49029['params']['id']}})[_0xcf96('0x1c')](handleEntityNotFound(_0x8876c8,null))[_0xcf96('0x1c')](function(_0xf44e22){if(_0xf44e22){return _0xf44e22[_0xcf96('0x5e')](_0xa49029[_0xcf96('0x54')][_0xcf96('0x5f')]||[]);}return null;})[_0xcf96('0x1c')](respondWithResult(_0x8876c8,null))['catch'](handleError(_0x8876c8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0ca34cd..b1f9913 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 _0x0bc2=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4c0620,_0x59846d){var _0x11d3c2=function(_0x3c6cd3){while(--_0x3c6cd3){_0x4c0620['push'](_0x4c0620['shift']());}};_0x11d3c2(++_0x59846d);}(_0x0bc2,0x8a));var _0x20bc=function(_0x3e9db1,_0x34b2f6){_0x3e9db1=_0x3e9db1-0x0;var _0x990b8=_0x0bc2[_0x3e9db1];return _0x990b8;};'use strict';var _=require(_0x20bc('0x0'));var util=require(_0x20bc('0x1'));var logger=require(_0x20bc('0x2'))(_0x20bc('0x3'));var moment=require('moment');var BPromise=require(_0x20bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20bc('0x5'));var rimraf=require(_0x20bc('0x6'));var config=require(_0x20bc('0x7'));var attributes=require(_0x20bc('0x8'));module[_0x20bc('0x9')]=function(_0x140c08,_0x2cf268){return _0x140c08[_0x20bc('0xa')](_0x20bc('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3fa=['request-promise','rimraf','../../config/environment','exports','ZendeskConfiguration','util','../../config/logger','moment','bluebird'];(function(_0x1b2e6b,_0x2f97fb){var _0x1dd2aa=function(_0x413974){while(--_0x413974){_0x1b2e6b['push'](_0x1b2e6b['shift']());}};_0x1dd2aa(++_0x2f97fb);}(_0xe3fa,0x19a));var _0xae3f=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xe3fa[_0x4f0e62];return _0x117ab8;};'use strict';var _=require('lodash');var util=require(_0xae3f('0x0'));var logger=require(_0xae3f('0x1'))('api');var moment=require(_0xae3f('0x2'));var BPromise=require(_0xae3f('0x3'));var rp=require(_0xae3f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae3f('0x5'));var config=require(_0xae3f('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xae3f('0x7')]=function(_0x5884e9,_0x5a1fc9){return _0x5884e9['define'](_0xae3f('0x8'),attributes,{'tableName':'int_zendesk_configurations','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 0648b47..5167fcf 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 _0xebbf=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x2a9ec5,_0x443383){var _0x2a6113=function(_0x1ee453){while(--_0x1ee453){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x2a6113(++_0x443383);}(_0xebbf,0x108));var _0xfebb=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xebbf[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xfebb('0x0'));var moment=require(_0xfebb('0x1'));var BPromise=require(_0xfebb('0x2'));var rs=require(_0xfebb('0x3'));var fs=require('fs');var Redis=require(_0xfebb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfebb('0x5'));var logger=require(_0xfebb('0x6'))(_0xfebb('0x7'));var config=require(_0xfebb('0x8'));var jayson=require(_0xfebb('0x9'));var client=jayson[_0xfebb('0xa')][_0xfebb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c16d,_0xc0f277,_0x440f71){return new BPromise(function(_0x355212,_0x502ecf){return client[_0xfebb('0xc')](_0x46c16d,_0x440f71)['then'](function(_0x2972f5){logger[_0xfebb('0xd')](_0xfebb('0xe'),_0xc0f277,'request\x20sent');logger['debug'](_0xfebb('0xf'),_0xc0f277,_0xfebb('0x10'),JSON['stringify'](_0x2972f5));if(_0x2972f5[_0xfebb('0x11')]){if(_0x2972f5['error'][_0xfebb('0x12')]===0x1f4){logger[_0xfebb('0x11')](_0xfebb('0xe'),_0xc0f277,_0x2972f5[_0xfebb('0x11')][_0xfebb('0x13')]);return _0x502ecf(_0x2972f5[_0xfebb('0x11')][_0xfebb('0x13')]);}logger['error'](_0xfebb('0xe'),_0xc0f277,_0x2972f5[_0xfebb('0x11')][_0xfebb('0x13')]);return _0x355212(_0x2972f5['error'][_0xfebb('0x13')]);}else{logger[_0xfebb('0xd')](_0xfebb('0xe'),_0xc0f277,_0xfebb('0x10'));_0x355212(_0x2972f5[_0xfebb('0x14')][_0xfebb('0x13')]);}})[_0xfebb('0x15')](function(_0x4900e9){logger[_0xfebb('0x11')](_0xfebb('0xe'),_0xc0f277,_0x4900e9);_0x502ecf(_0x4900e9);});});} \ No newline at end of file +var _0x62fb=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x62fb,0x6c));var _0xb62f=function(_0x1ce2fc,_0x3ab648){_0x1ce2fc=_0x1ce2fc-0x0;var _0x269f03=_0x62fb[_0x1ce2fc];return _0x269f03;};'use strict';var _=require(_0xb62f('0x0'));var util=require('util');var moment=require(_0xb62f('0x1'));var BPromise=require(_0xb62f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb62f('0x3'));var db=require(_0xb62f('0x4'))['db'];var utils=require(_0xb62f('0x5'));var logger=require(_0xb62f('0x6'))(_0xb62f('0x7'));var config=require('../../config/environment');var jayson=require(_0xb62f('0x8'));var client=jayson[_0xb62f('0x9')][_0xb62f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7426da,_0x203b04,_0x5157f4){return new BPromise(function(_0x51d361,_0x6d8c27){return client[_0xb62f('0xb')](_0x7426da,_0x5157f4)[_0xb62f('0xc')](function(_0x58f732){logger[_0xb62f('0xd')](_0xb62f('0xe'),_0x203b04,_0xb62f('0xf'));logger['debug'](_0xb62f('0x10'),_0x203b04,_0xb62f('0xf'),JSON['stringify'](_0x58f732));if(_0x58f732[_0xb62f('0x11')]){if(_0x58f732['error'][_0xb62f('0x12')]===0x1f4){logger[_0xb62f('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x203b04,_0x58f732[_0xb62f('0x11')][_0xb62f('0x13')]);return _0x6d8c27(_0x58f732[_0xb62f('0x11')]['message']);}logger[_0xb62f('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x203b04,_0x58f732[_0xb62f('0x11')][_0xb62f('0x13')]);return _0x51d361(_0x58f732[_0xb62f('0x11')][_0xb62f('0x13')]);}else{logger[_0xb62f('0xd')](_0xb62f('0xe'),_0x203b04,_0xb62f('0xf'));_0x51d361(_0x58f732[_0xb62f('0x14')][_0xb62f('0x13')]);}})[_0xb62f('0x15')](function(_0xbb8069){logger[_0xb62f('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x203b04,_0xbb8069);_0x6d8c27(_0xbb8069);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7c78e54..f7c707e 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 _0x975f=['show','post','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x30436f,_0x27c7c6){var _0xfbbde0=function(_0x1a6db8){while(--_0x1a6db8){_0x30436f['push'](_0x30436f['shift']());}};_0xfbbde0(++_0x27c7c6);}(_0x975f,0x1e1));var _0xf975=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x975f[_0x58965a];return _0x254efc;};'use strict';var multer=require('multer');var util=require(_0xf975('0x0'));var path=require(_0xf975('0x1'));var timeout=require(_0xf975('0x2'));var express=require(_0xf975('0x3'));var router=express[_0xf975('0x4')]();var auth=require(_0xf975('0x5'));var interaction=require(_0xf975('0x6'));var config=require('../../config/environment');var controller=require(_0xf975('0x7'));router[_0xf975('0x8')]('/',auth[_0xf975('0x9')](),controller[_0xf975('0xa')]);router[_0xf975('0x8')](_0xf975('0xb'),auth[_0xf975('0x9')](),controller[_0xf975('0xc')]);router[_0xf975('0xd')]('/',auth[_0xf975('0x9')](),controller['create']);router[_0xf975('0xe')](_0xf975('0xb'),auth[_0xf975('0x9')](),controller[_0xf975('0xf')]);router['delete'](_0xf975('0xb'),auth[_0xf975('0x9')](),controller[_0xf975('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe20e=['express','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe20e,0x195));var _0xee20=function(_0x143896,_0x31f415){_0x143896=_0x143896-0x0;var _0x27d303=_0xe20e[_0x143896];return _0x27d303;};'use strict';var multer=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var path=require('path');var timeout=require(_0xee20('0x2'));var express=require(_0xee20('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xee20('0x4'));var config=require('../../config/environment');var controller=require(_0xee20('0x5'));router[_0xee20('0x6')]('/',auth[_0xee20('0x7')](),controller[_0xee20('0x8')]);router[_0xee20('0x6')](_0xee20('0x9'),auth[_0xee20('0x7')](),controller[_0xee20('0xa')]);router[_0xee20('0xb')]('/',auth[_0xee20('0x7')](),controller[_0xee20('0xc')]);router[_0xee20('0xd')]('/:id',auth[_0xee20('0x7')](),controller[_0xee20('0xe')]);router['delete']('/:id',auth[_0xee20('0x7')](),controller[_0xee20('0xf')]);module[_0xee20('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ed61feb..6bc3b3f 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 _0x7dc0=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3330ae,_0x292fd5){var _0x304fcd=function(_0x11255b){while(--_0x11255b){_0x3330ae['push'](_0x3330ae['shift']());}};_0x304fcd(++_0x292fd5);}(_0x7dc0,0x18f));var _0x07dc=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x7dc0[_0x257495];return _0x3849aa;};'use strict';var Sequelize=require(_0x07dc('0x0'));module[_0x07dc('0x1')]={'type':{'type':Sequelize[_0x07dc('0x2')](_0x07dc('0x3'),_0x07dc('0x4'),_0x07dc('0x5'),_0x07dc('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x07dc('0x7')]},'key':{'type':Sequelize[_0x07dc('0x7')]},'keyType':{'type':Sequelize[_0x07dc('0x2')](_0x07dc('0x3'),_0x07dc('0x4'),_0x07dc('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x07dc('0x7')]},'nameField':{'type':Sequelize[_0x07dc('0x7')]},'customField':{'type':Sequelize[_0x07dc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07dc('0x7')]}}; \ No newline at end of file +var _0x8f23=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2dc513,_0x2699e9){var _0x4f6e06=function(_0x3b4421){while(--_0x3b4421){_0x2dc513['push'](_0x2dc513['shift']());}};_0x4f6e06(++_0x2699e9);}(_0x8f23,0x1e5));var _0x38f2=function(_0x4ca81c,_0x25d85a){_0x4ca81c=_0x4ca81c-0x0;var _0x5caa07=_0x8f23[_0x4ca81c];return _0x5caa07;};'use strict';var Sequelize=require(_0x38f2('0x0'));module[_0x38f2('0x1')]={'type':{'type':Sequelize[_0x38f2('0x2')](_0x38f2('0x3'),_0x38f2('0x4'),_0x38f2('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x38f2('0x6')]},'key':{'type':Sequelize[_0x38f2('0x6')]},'keyType':{'type':Sequelize[_0x38f2('0x2')](_0x38f2('0x3'),_0x38f2('0x4'),_0x38f2('0x5'))},'keyContent':{'type':Sequelize[_0x38f2('0x6')]},'idField':{'type':Sequelize[_0x38f2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x38f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x38f2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8f18440..fbbca63 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 _0xb253=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','fields','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xb253,0x14f));var _0x3b25=function(_0x3a65f6,_0x58863a){_0x3a65f6=_0x3a65f6-0x0;var _0x111bf6=_0xb253[_0x3a65f6];return _0x111bf6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b25('0x0'));var rimraf=require(_0x3b25('0x1'));var zipdir=require(_0x3b25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b25('0x3'));var moment=require(_0x3b25('0x4'));var BPromise=require(_0x3b25('0x5'));var Mustache=require(_0x3b25('0x6'));var util=require(_0x3b25('0x7'));var path=require(_0x3b25('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b25('0x9'));var fs=require('fs');var _=require(_0x3b25('0xa'));var squel=require(_0x3b25('0xb'));var crypto=require(_0x3b25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3b25('0xd'));var toCsv=require(_0x3b25('0xe'));var querystring=require(_0x3b25('0xf'));var Papa=require(_0x3b25('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b25('0x11'));var as=require(_0x3b25('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b25('0x13'))(_0x3b25('0x14'));var utils=require('../../config/utils');var config=require(_0x3b25('0x15'));var db=require(_0x3b25('0x16'))['db'];function respondWithStatusCode(_0x104b5c,_0x1947cf){_0x1947cf=_0x1947cf||0xcc;return function(_0x3630ed){if(_0x3630ed){return _0x104b5c[_0x3b25('0x17')](_0x1947cf);}return _0x104b5c['status'](_0x1947cf)[_0x3b25('0x18')]();};}function respondWithResult(_0x189175,_0x1f8449){_0x1f8449=_0x1f8449||0xc8;return function(_0x4fb029){if(_0x4fb029){return _0x189175['status'](_0x1f8449)[_0x3b25('0x19')](_0x4fb029);}};}function respondWithFilteredResult(_0x166a58,_0x4b90e0){return function(_0x5ed754){if(_0x5ed754){var _0xe3a91=_0x5ed754['count'],_0x476ec1=_0x4b90e0[_0x3b25('0x1a')],_0x1cffe1=_0x4b90e0[_0x3b25('0x1a')]+_0x4b90e0['limit'],_0xf4f771;if(_0x1cffe1>=_0xe3a91){_0x1cffe1=_0xe3a91;_0xf4f771=0xc8;}else{_0xf4f771=0xce;}_0x166a58[_0x3b25('0x1b')](_0xf4f771);return _0x166a58[_0x3b25('0x1c')](_0x3b25('0x1d'),_0x476ec1+'-'+_0x1cffe1+'/'+_0xe3a91)[_0x3b25('0x19')](_0x5ed754);}return null;};}function patchUpdates(_0x51b77d){return function(_0x2b870b){try{jsonpatch[_0x3b25('0x1e')](_0x2b870b,_0x51b77d,!![]);}catch(_0x54fa38){return BPromise[_0x3b25('0x1f')](_0x54fa38);}return _0x2b870b[_0x3b25('0x20')]();};}function saveUpdates(_0x13b895,_0x3b8c77){return function(_0x10465c){if(_0x10465c){return _0x10465c[_0x3b25('0x21')](_0x13b895)['then'](function(_0x2dabb5){return _0x2dabb5;});}return null;};}function removeEntity(_0x12db86,_0x38a18c){return function(_0x4d42bc){if(_0x4d42bc){return _0x4d42bc['destroy']()[_0x3b25('0x22')](function(){_0x12db86[_0x3b25('0x1b')](0xcc)[_0x3b25('0x18')]();});}};}function handleEntityNotFound(_0x1cc31f,_0x14cbac){return function(_0x4dc152){if(!_0x4dc152){_0x1cc31f[_0x3b25('0x17')](0x194);}return _0x4dc152;};}function handleError(_0xa19b97,_0x4728d7){_0x4728d7=_0x4728d7||0x1f4;return function(_0x447bec){logger['error'](_0x447bec[_0x3b25('0x23')]);if(_0x447bec[_0x3b25('0x24')]){delete _0x447bec[_0x3b25('0x24')];}_0xa19b97['status'](_0x4728d7)[_0x3b25('0x25')](_0x447bec);};}exports[_0x3b25('0x26')]=function(_0x377a23,_0x1bb128){var _0x576e95={},_0x4eabc1={},_0x15142f={'count':0x0,'rows':[]};var _0x2ede85=_[_0x3b25('0x27')](db[_0x3b25('0x28')][_0x3b25('0x29')],function(_0x28b2a2){return{'name':_0x28b2a2[_0x3b25('0x2a')],'type':_0x28b2a2[_0x3b25('0x2b')][_0x3b25('0x2c')]};});_0x4eabc1[_0x3b25('0x2d')]=_[_0x3b25('0x27')](_0x2ede85,_0x3b25('0x24'));_0x4eabc1['query']=_['keys'](_0x377a23['query']);_0x4eabc1[_0x3b25('0x2e')]=_[_0x3b25('0x2f')](_0x4eabc1[_0x3b25('0x2d')],_0x4eabc1[_0x3b25('0x30')]);_0x576e95[_0x3b25('0x31')]=_[_0x3b25('0x2f')](_0x4eabc1[_0x3b25('0x2d')],qs['fields'](_0x377a23[_0x3b25('0x30')]['fields']));_0x576e95[_0x3b25('0x31')]=_0x576e95[_0x3b25('0x31')]['length']?_0x576e95[_0x3b25('0x31')]:_0x4eabc1[_0x3b25('0x2d')];if(!_0x377a23[_0x3b25('0x30')]['hasOwnProperty'](_0x3b25('0x32'))){_0x576e95[_0x3b25('0x33')]=qs[_0x3b25('0x33')](_0x377a23[_0x3b25('0x30')][_0x3b25('0x33')]);_0x576e95['offset']=qs[_0x3b25('0x1a')](_0x377a23['query'][_0x3b25('0x1a')]);}_0x576e95['order']=qs[_0x3b25('0x34')](_0x377a23['query'][_0x3b25('0x34')]);_0x576e95[_0x3b25('0x35')]=qs[_0x3b25('0x2e')](_['pick'](_0x377a23[_0x3b25('0x30')],_0x4eabc1[_0x3b25('0x2e')]),_0x2ede85);if(_0x377a23[_0x3b25('0x30')][_0x3b25('0x36')]){_0x576e95[_0x3b25('0x35')]=_[_0x3b25('0x37')](_0x576e95[_0x3b25('0x35')],{'$or':_[_0x3b25('0x27')](_0x2ede85,function(_0x199fe6){if(_0x199fe6[_0x3b25('0x2b')]!==_0x3b25('0x38')){var _0x21063a={};_0x21063a[_0x199fe6[_0x3b25('0x24')]]={'$like':'%'+_0x377a23['query'][_0x3b25('0x36')]+'%'};return _0x21063a;}})});}_0x576e95=_[_0x3b25('0x37')]({},_0x576e95,_0x377a23[_0x3b25('0x39')]);var _0x4e41f7={'where':_0x576e95['where']};return db[_0x3b25('0x28')]['count'](_0x4e41f7)[_0x3b25('0x22')](function(_0x56c8f9){_0x15142f[_0x3b25('0x3a')]=_0x56c8f9;if(_0x377a23[_0x3b25('0x30')]['includeAll']){_0x576e95['include']=[{'all':!![]}];}return db[_0x3b25('0x28')][_0x3b25('0x3b')](_0x576e95);})[_0x3b25('0x22')](function(_0x27b478){_0x15142f[_0x3b25('0x3c')]=_0x27b478;return _0x15142f;})['then'](respondWithFilteredResult(_0x1bb128,_0x576e95))[_0x3b25('0x3d')](handleError(_0x1bb128,null));};exports[_0x3b25('0x3e')]=function(_0x2f83a6,_0x46efdc){var _0x4b4d9a={'raw':!![],'where':{'id':_0x2f83a6[_0x3b25('0x3f')]['id']}},_0x43f3de={};_0x43f3de[_0x3b25('0x2d')]=_[_0x3b25('0x40')](db['ZendeskField'][_0x3b25('0x29')]);_0x43f3de[_0x3b25('0x30')]=_[_0x3b25('0x40')](_0x2f83a6['query']);_0x43f3de[_0x3b25('0x2e')]=_[_0x3b25('0x2f')](_0x43f3de['model'],_0x43f3de[_0x3b25('0x30')]);_0x4b4d9a['attributes']=_[_0x3b25('0x2f')](_0x43f3de[_0x3b25('0x2d')],qs[_0x3b25('0x41')](_0x2f83a6[_0x3b25('0x30')][_0x3b25('0x41')]));_0x4b4d9a[_0x3b25('0x31')]=_0x4b4d9a['attributes'][_0x3b25('0x42')]?_0x4b4d9a[_0x3b25('0x31')]:_0x43f3de[_0x3b25('0x2d')];if(_0x2f83a6[_0x3b25('0x30')]['includeAll']){_0x4b4d9a['include']=[{'all':!![]}];}_0x4b4d9a=_[_0x3b25('0x37')]({},_0x4b4d9a,_0x2f83a6[_0x3b25('0x39')]);return db['ZendeskField'][_0x3b25('0x43')](_0x4b4d9a)[_0x3b25('0x22')](handleEntityNotFound(_0x46efdc,null))[_0x3b25('0x22')](respondWithResult(_0x46efdc,null))[_0x3b25('0x3d')](handleError(_0x46efdc,null));};exports[_0x3b25('0x44')]=function(_0x5b0c2e,_0x2a650e){return db[_0x3b25('0x28')][_0x3b25('0x44')](_0x5b0c2e[_0x3b25('0x45')],{})[_0x3b25('0x22')](respondWithResult(_0x2a650e,0xc9))[_0x3b25('0x3d')](handleError(_0x2a650e,null));};exports[_0x3b25('0x21')]=function(_0x3f7004,_0x595643){if(_0x3f7004[_0x3b25('0x45')]['id']){delete _0x3f7004['body']['id'];}return db[_0x3b25('0x28')][_0x3b25('0x43')]({'where':{'id':_0x3f7004[_0x3b25('0x3f')]['id']}})[_0x3b25('0x22')](handleEntityNotFound(_0x595643,null))[_0x3b25('0x22')](saveUpdates(_0x3f7004[_0x3b25('0x45')],null))['then'](respondWithResult(_0x595643,null))['catch'](handleError(_0x595643,null));};exports['destroy']=function(_0x2d4de7,_0x2beb63){return db[_0x3b25('0x28')]['find']({'where':{'id':_0x2d4de7[_0x3b25('0x3f')]['id']}})[_0x3b25('0x22')](handleEntityNotFound(_0x2beb63,null))['then'](removeEntity(_0x2beb63,null))[_0x3b25('0x3d')](handleError(_0x2beb63,null));}; \ No newline at end of file +var _0xe407=['rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','offset','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskField'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0xe407,0xf0));var _0x7e40=function(_0x53fdad,_0x57a51d){_0x53fdad=_0x53fdad-0x0;var _0x2ea811=_0xe407[_0x53fdad];return _0x2ea811;};'use strict';var pdf=require(_0x7e40('0x0'));var emlformat=require(_0x7e40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7e40('0x2'));var jsonpatch=require(_0x7e40('0x3'));var rp=require('request-promise');var moment=require(_0x7e40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e40('0x5'));var util=require('util');var path=require(_0x7e40('0x6'));var sox=require(_0x7e40('0x7'));var csv=require(_0x7e40('0x8'));var ejs=require(_0x7e40('0x9'));var fs=require('fs');var _=require(_0x7e40('0xa'));var squel=require(_0x7e40('0xb'));var crypto=require('crypto');var jsforce=require(_0x7e40('0xc'));var deskjs=require(_0x7e40('0xd'));var toCsv=require(_0x7e40('0x8'));var querystring=require(_0x7e40('0xe'));var Papa=require(_0x7e40('0xf'));var Redis=require(_0x7e40('0x10'));var authService=require(_0x7e40('0x11'));var qs=require(_0x7e40('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e40('0x13'));var logger=require(_0x7e40('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7e40('0x15'));var db=require(_0x7e40('0x16'))['db'];function respondWithStatusCode(_0x50cd80,_0x1cec1c){_0x1cec1c=_0x1cec1c||0xcc;return function(_0x52bb08){if(_0x52bb08){return _0x50cd80[_0x7e40('0x17')](_0x1cec1c);}return _0x50cd80[_0x7e40('0x18')](_0x1cec1c)['end']();};}function respondWithResult(_0x21ab0f,_0x5b2834){_0x5b2834=_0x5b2834||0xc8;return function(_0x1f1f97){if(_0x1f1f97){return _0x21ab0f[_0x7e40('0x18')](_0x5b2834)[_0x7e40('0x19')](_0x1f1f97);}};}function respondWithFilteredResult(_0x255f63,_0x2fab65){return function(_0x166a19){if(_0x166a19){var _0x532ca9=_0x166a19['count'],_0x33b12d=_0x2fab65['offset'],_0x415330=_0x2fab65['offset']+_0x2fab65[_0x7e40('0x1a')],_0x739e86;if(_0x415330>=_0x532ca9){_0x415330=_0x532ca9;_0x739e86=0xc8;}else{_0x739e86=0xce;}_0x255f63[_0x7e40('0x18')](_0x739e86);return _0x255f63[_0x7e40('0x1b')]('Content-Range',_0x33b12d+'-'+_0x415330+'/'+_0x532ca9)[_0x7e40('0x19')](_0x166a19);}return null;};}function patchUpdates(_0x26e83e){return function(_0x26d9ab){try{jsonpatch[_0x7e40('0x1c')](_0x26d9ab,_0x26e83e,!![]);}catch(_0x3948b9){return BPromise[_0x7e40('0x1d')](_0x3948b9);}return _0x26d9ab['save']();};}function saveUpdates(_0x4aedcd,_0x1c33bb){return function(_0x33df9a){if(_0x33df9a){return _0x33df9a[_0x7e40('0x1e')](_0x4aedcd)[_0x7e40('0x1f')](function(_0x3d98d5){return _0x3d98d5;});}return null;};}function removeEntity(_0x291bd3,_0x2736f2){return function(_0x57d64b){if(_0x57d64b){return _0x57d64b[_0x7e40('0x20')]()[_0x7e40('0x1f')](function(){_0x291bd3[_0x7e40('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f341d,_0x561f6e){return function(_0x174d65){if(!_0x174d65){_0x4f341d[_0x7e40('0x17')](0x194);}return _0x174d65;};}function handleError(_0x5b93e3,_0x25a049){_0x25a049=_0x25a049||0x1f4;return function(_0x514628){logger[_0x7e40('0x21')](_0x514628[_0x7e40('0x22')]);if(_0x514628[_0x7e40('0x23')]){delete _0x514628[_0x7e40('0x23')];}_0x5b93e3[_0x7e40('0x18')](_0x25a049)[_0x7e40('0x24')](_0x514628);};}exports[_0x7e40('0x25')]=function(_0x59c030,_0x39a8da){var _0x1ea68a={},_0x1c21c5={},_0x1cb393={'count':0x0,'rows':[]};var _0x5878ff=_[_0x7e40('0x26')](db[_0x7e40('0x27')][_0x7e40('0x28')],function(_0x807e81){return{'name':_0x807e81[_0x7e40('0x29')],'type':_0x807e81['type'][_0x7e40('0x2a')]};});_0x1c21c5[_0x7e40('0x2b')]=_[_0x7e40('0x26')](_0x5878ff,'name');_0x1c21c5[_0x7e40('0x2c')]=_[_0x7e40('0x2d')](_0x59c030['query']);_0x1c21c5['filters']=_[_0x7e40('0x2e')](_0x1c21c5[_0x7e40('0x2b')],_0x1c21c5[_0x7e40('0x2c')]);_0x1ea68a[_0x7e40('0x2f')]=_[_0x7e40('0x2e')](_0x1c21c5[_0x7e40('0x2b')],qs['fields'](_0x59c030[_0x7e40('0x2c')][_0x7e40('0x30')]));_0x1ea68a[_0x7e40('0x2f')]=_0x1ea68a[_0x7e40('0x2f')][_0x7e40('0x31')]?_0x1ea68a[_0x7e40('0x2f')]:_0x1c21c5[_0x7e40('0x2b')];if(!_0x59c030[_0x7e40('0x2c')]['hasOwnProperty']('nolimit')){_0x1ea68a['limit']=qs[_0x7e40('0x1a')](_0x59c030['query'][_0x7e40('0x1a')]);_0x1ea68a[_0x7e40('0x32')]=qs['offset'](_0x59c030[_0x7e40('0x2c')][_0x7e40('0x32')]);}_0x1ea68a[_0x7e40('0x33')]=qs['sort'](_0x59c030['query']['sort']);_0x1ea68a[_0x7e40('0x34')]=qs[_0x7e40('0x35')](_[_0x7e40('0x36')](_0x59c030[_0x7e40('0x2c')],_0x1c21c5[_0x7e40('0x35')]),_0x5878ff);if(_0x59c030['query'][_0x7e40('0x37')]){_0x1ea68a[_0x7e40('0x34')]=_[_0x7e40('0x38')](_0x1ea68a[_0x7e40('0x34')],{'$or':_['map'](_0x5878ff,function(_0x14791f){if(_0x14791f['type']!==_0x7e40('0x39')){var _0x425109={};_0x425109[_0x14791f[_0x7e40('0x23')]]={'$like':'%'+_0x59c030[_0x7e40('0x2c')][_0x7e40('0x37')]+'%'};return _0x425109;}})});}_0x1ea68a=_['merge']({},_0x1ea68a,_0x59c030[_0x7e40('0x3a')]);var _0x1fd621={'where':_0x1ea68a['where']};return db[_0x7e40('0x27')][_0x7e40('0x3b')](_0x1fd621)[_0x7e40('0x1f')](function(_0x2d817a){_0x1cb393[_0x7e40('0x3b')]=_0x2d817a;if(_0x59c030['query'][_0x7e40('0x3c')]){_0x1ea68a[_0x7e40('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0x7e40('0x3e')](_0x1ea68a);})['then'](function(_0x10c171){_0x1cb393[_0x7e40('0x3f')]=_0x10c171;return _0x1cb393;})[_0x7e40('0x1f')](respondWithFilteredResult(_0x39a8da,_0x1ea68a))[_0x7e40('0x40')](handleError(_0x39a8da,null));};exports[_0x7e40('0x41')]=function(_0x2a379c,_0x2c967d){var _0x191b33={'raw':!![],'where':{'id':_0x2a379c['params']['id']}},_0x4ac17c={};_0x4ac17c[_0x7e40('0x2b')]=_[_0x7e40('0x2d')](db[_0x7e40('0x27')][_0x7e40('0x28')]);_0x4ac17c[_0x7e40('0x2c')]=_['keys'](_0x2a379c['query']);_0x4ac17c[_0x7e40('0x35')]=_[_0x7e40('0x2e')](_0x4ac17c[_0x7e40('0x2b')],_0x4ac17c['query']);_0x191b33[_0x7e40('0x2f')]=_[_0x7e40('0x2e')](_0x4ac17c[_0x7e40('0x2b')],qs['fields'](_0x2a379c['query'][_0x7e40('0x30')]));_0x191b33[_0x7e40('0x2f')]=_0x191b33[_0x7e40('0x2f')]['length']?_0x191b33[_0x7e40('0x2f')]:_0x4ac17c['model'];if(_0x2a379c[_0x7e40('0x2c')][_0x7e40('0x3c')]){_0x191b33['include']=[{'all':!![]}];}_0x191b33=_[_0x7e40('0x38')]({},_0x191b33,_0x2a379c['options']);return db[_0x7e40('0x27')][_0x7e40('0x42')](_0x191b33)['then'](handleEntityNotFound(_0x2c967d,null))[_0x7e40('0x1f')](respondWithResult(_0x2c967d,null))[_0x7e40('0x40')](handleError(_0x2c967d,null));};exports[_0x7e40('0x43')]=function(_0x21c479,_0x2ecd57){return db[_0x7e40('0x27')][_0x7e40('0x43')](_0x21c479['body'],{})[_0x7e40('0x1f')](respondWithResult(_0x2ecd57,0xc9))['catch'](handleError(_0x2ecd57,null));};exports[_0x7e40('0x1e')]=function(_0x53ab2d,_0x3e775d){if(_0x53ab2d['body']['id']){delete _0x53ab2d[_0x7e40('0x44')]['id'];}return db[_0x7e40('0x27')]['find']({'where':{'id':_0x53ab2d[_0x7e40('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e775d,null))[_0x7e40('0x1f')](saveUpdates(_0x53ab2d[_0x7e40('0x44')],null))[_0x7e40('0x1f')](respondWithResult(_0x3e775d,null))[_0x7e40('0x40')](handleError(_0x3e775d,null));};exports[_0x7e40('0x20')]=function(_0x2a537f,_0x32d26e){return db['ZendeskField'][_0x7e40('0x42')]({'where':{'id':_0x2a537f[_0x7e40('0x45')]['id']}})['then'](handleEntityNotFound(_0x32d26e,null))[_0x7e40('0x1f')](removeEntity(_0x32d26e,null))[_0x7e40('0x40')](handleError(_0x32d26e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 49e7af4..19c467f 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 _0xefda=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x4eeecd,_0x1beb87){var _0x1c2f89=function(_0x2ff071){while(--_0x2ff071){_0x4eeecd['push'](_0x4eeecd['shift']());}};_0x1c2f89(++_0x1beb87);}(_0xefda,0x96));var _0xaefd=function(_0x1bd4ca,_0x342721){_0x1bd4ca=_0x1bd4ca-0x0;var _0x5c422b=_0xefda[_0x1bd4ca];return _0x5c422b;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xaefd('0xc'),_0xaefd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa571=['int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ZendeskField'];(function(_0x2811b2,_0x36fd3f){var _0x22eace=function(_0x28f15c){while(--_0x28f15c){_0x2811b2['push'](_0x2811b2['shift']());}};_0x22eace(++_0x36fd3f);}(_0xa571,0x107));var _0x1a57=function(_0x2f8f44,_0x4989a4){_0x2f8f44=_0x2f8f44-0x0;var _0x547293=_0xa571[_0x2f8f44];return _0x547293;};'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('./intZendeskField.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1a57('0xb'),_0x1a57('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index c2d9e69..4e34a0a 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 _0xc274=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x51fc49,_0x310e0a){var _0x92cfa8=function(_0x30d703){while(--_0x30d703){_0x51fc49['push'](_0x51fc49['shift']());}};_0x92cfa8(++_0x310e0a);}(_0xc274,0x19b));var _0x4c27=function(_0x5bccb4,_0x1df217){_0x5bccb4=_0x5bccb4-0x0;var _0x30a2b5=_0xc274[_0x5bccb4];return _0x30a2b5;};'use strict';var _=require(_0x4c27('0x0'));var util=require(_0x4c27('0x1'));var moment=require(_0x4c27('0x2'));var BPromise=require(_0x4c27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c27('0x4'));var db=require(_0x4c27('0x5'))['db'];var utils=require(_0x4c27('0x6'));var logger=require(_0x4c27('0x7'))(_0x4c27('0x8'));var config=require(_0x4c27('0x9'));var jayson=require(_0x4c27('0xa'));var client=jayson[_0x4c27('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfcaffe,_0x5d47c6,_0x1e35a3){return new BPromise(function(_0x12b8f6,_0x472394){return client['request'](_0xfcaffe,_0x1e35a3)[_0x4c27('0xc')](function(_0x349319){logger[_0x4c27('0xd')](_0x4c27('0xe'),_0x5d47c6,'request\x20sent');logger[_0x4c27('0xf')](_0x4c27('0x10'),_0x5d47c6,_0x4c27('0x11'),JSON[_0x4c27('0x12')](_0x349319));if(_0x349319['error']){if(_0x349319['error'][_0x4c27('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5d47c6,_0x349319[_0x4c27('0x14')][_0x4c27('0x15')]);return _0x472394(_0x349319[_0x4c27('0x14')][_0x4c27('0x15')]);}logger['error'](_0x4c27('0xe'),_0x5d47c6,_0x349319[_0x4c27('0x14')][_0x4c27('0x15')]);return _0x12b8f6(_0x349319[_0x4c27('0x14')]['message']);}else{logger[_0x4c27('0xd')](_0x4c27('0xe'),_0x5d47c6,'request\x20sent');_0x12b8f6(_0x349319['result'][_0x4c27('0x15')]);}})['catch'](function(_0x4728a6){logger['error'](_0x4c27('0xe'),_0x5d47c6,_0x4728a6);_0x472394(_0x4728a6);});});} \ No newline at end of file +var _0x9aee=['randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x1e6e99,_0xd3bb5f){var _0x6b6ca8=function(_0xa29245){while(--_0xa29245){_0x1e6e99['push'](_0x1e6e99['shift']());}};_0x6b6ca8(++_0xd3bb5f);}(_0x9aee,0x1df));var _0xe9ae=function(_0x3927a9,_0x253765){_0x3927a9=_0x3927a9-0x0;var _0xa3231a=_0x9aee[_0x3927a9];return _0xa3231a;};'use strict';var _=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var moment=require(_0xe9ae('0x2'));var BPromise=require(_0xe9ae('0x3'));var rs=require(_0xe9ae('0x4'));var fs=require('fs');var Redis=require(_0xe9ae('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9ae('0x6'));var config=require('../../config/environment');var jayson=require(_0xe9ae('0x7'));var client=jayson[_0xe9ae('0x8')][_0xe9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe61e51,_0x2cd275,_0x3c3f82){return new BPromise(function(_0x5448c8,_0x2c797e){return client[_0xe9ae('0xa')](_0xe61e51,_0x3c3f82)[_0xe9ae('0xb')](function(_0xfe0f7){logger[_0xe9ae('0xc')]('ZendeskField,\x20%s,\x20%s',_0x2cd275,_0xe9ae('0xd'));logger[_0xe9ae('0xe')](_0xe9ae('0xf'),_0x2cd275,'request\x20sent',JSON['stringify'](_0xfe0f7));if(_0xfe0f7[_0xe9ae('0x10')]){if(_0xfe0f7['error'][_0xe9ae('0x11')]===0x1f4){logger[_0xe9ae('0x10')](_0xe9ae('0x12'),_0x2cd275,_0xfe0f7[_0xe9ae('0x10')][_0xe9ae('0x13')]);return _0x2c797e(_0xfe0f7['error'][_0xe9ae('0x13')]);}logger[_0xe9ae('0x10')](_0xe9ae('0x12'),_0x2cd275,_0xfe0f7[_0xe9ae('0x10')][_0xe9ae('0x13')]);return _0x5448c8(_0xfe0f7['error'][_0xe9ae('0x13')]);}else{logger[_0xe9ae('0xc')](_0xe9ae('0x12'),_0x2cd275,'request\x20sent');_0x5448c8(_0xfe0f7[_0xe9ae('0x14')][_0xe9ae('0x13')]);}})['catch'](function(_0x407e35){logger[_0xe9ae('0x10')](_0xe9ae('0x12'),_0x2cd275,_0x407e35);_0x2c797e(_0x407e35);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f83f208..9aee68f 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 _0x0aca=['../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x2ef4bb,_0x492567){var _0x5c9dd1=function(_0x5b8de2){while(--_0x5b8de2){_0x2ef4bb['push'](_0x2ef4bb['shift']());}};_0x5c9dd1(++_0x492567);}(_0x0aca,0x1de));var _0xa0ac=function(_0x9b1166,_0x384402){_0x9b1166=_0x9b1166-0x0;var _0x2ad057=_0x0aca[_0x9b1166];return _0x2ad057;};'use strict';var multer=require(_0xa0ac('0x0'));var util=require('util');var path=require(_0xa0ac('0x1'));var timeout=require(_0xa0ac('0x2'));var express=require(_0xa0ac('0x3'));var router=express[_0xa0ac('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0ac('0x5'));var controller=require(_0xa0ac('0x6'));router[_0xa0ac('0x7')]('/',auth[_0xa0ac('0x8')](),controller[_0xa0ac('0x9')]);router[_0xa0ac('0x7')](_0xa0ac('0xa'),auth[_0xa0ac('0x8')](),controller['show']);router[_0xa0ac('0x7')]('/:id/configurations',auth[_0xa0ac('0x8')](),controller['getConfigurations']);router['get'](_0xa0ac('0xb'),auth['isAuthenticated'](),controller[_0xa0ac('0xc')]);router[_0xa0ac('0xd')]('/',auth[_0xa0ac('0x8')](),controller[_0xa0ac('0xe')]);router[_0xa0ac('0xd')](_0xa0ac('0xf'),auth[_0xa0ac('0x8')](),controller[_0xa0ac('0x10')]);router[_0xa0ac('0x11')](_0xa0ac('0xa'),auth[_0xa0ac('0x8')](),controller[_0xa0ac('0x12')]);router[_0xa0ac('0x13')](_0xa0ac('0xa'),auth[_0xa0ac('0x8')](),controller['destroy']);module[_0xa0ac('0x14')]=router; \ No newline at end of file +var _0xf595=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3be2f5,_0x53447f){var _0x5dc05f=function(_0x4c4b48){while(--_0x4c4b48){_0x3be2f5['push'](_0x3be2f5['shift']());}};_0x5dc05f(++_0x53447f);}(_0xf595,0x15d));var _0x5f59=function(_0x43d1fd,_0x5ce01d){_0x43d1fd=_0x43d1fd-0x0;var _0x341d0a=_0xf595[_0x43d1fd];return _0x341d0a;};'use strict';var multer=require(_0x5f59('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f59('0x1'));var express=require('express');var router=express[_0x5f59('0x2')]();var auth=require(_0x5f59('0x3'));var interaction=require(_0x5f59('0x4'));var config=require(_0x5f59('0x5'));var controller=require('./intZohoAccount.controller');router[_0x5f59('0x6')]('/',auth[_0x5f59('0x7')](),controller['index']);router[_0x5f59('0x6')](_0x5f59('0x8'),auth['isAuthenticated'](),controller[_0x5f59('0x9')]);router[_0x5f59('0x6')](_0x5f59('0xa'),auth[_0x5f59('0x7')](),controller[_0x5f59('0xb')]);router[_0x5f59('0x6')](_0x5f59('0xc'),auth[_0x5f59('0x7')](),controller[_0x5f59('0xd')]);router[_0x5f59('0xe')]('/',auth['isAuthenticated'](),controller[_0x5f59('0xf')]);router[_0x5f59('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f59('0x10')]);router[_0x5f59('0x11')](_0x5f59('0x8'),auth[_0x5f59('0x7')](),controller[_0x5f59('0x12')]);router[_0x5f59('0x13')](_0x5f59('0x8'),auth[_0x5f59('0x7')](),controller['destroy']);module[_0x5f59('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 142d4bc..5dedc90 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 _0xa4e4=['STRING','exports'];(function(_0x277b1c,_0x51dff6){var _0x1b9fe1=function(_0xa38208){while(--_0xa38208){_0x277b1c['push'](_0x277b1c['shift']());}};_0x1b9fe1(++_0x51dff6);}(_0xa4e4,0x1af));var _0x4a4e=function(_0x3d0366,_0x50211a){_0x3d0366=_0x3d0366-0x0;var _0x5ce75e=_0xa4e4[_0x3d0366];return _0x5ce75e;};'use strict';var Sequelize=require('sequelize');module[_0x4a4e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a4e('0x1')]},'host':{'type':Sequelize[_0x4a4e('0x1')]},'zone':{'type':Sequelize[_0x4a4e('0x1')]},'clientId':{'type':Sequelize[_0x4a4e('0x1')]},'clientSecret':{'type':Sequelize[_0x4a4e('0x1')]},'serverUrl':{'type':Sequelize[_0x4a4e('0x1')]},'code':{'type':Sequelize[_0x4a4e('0x1')]},'refreshToken':{'type':Sequelize[_0x4a4e('0x1')]}}; \ No newline at end of file +var _0x0e2a=['STRING','exports'];(function(_0x39dac8,_0x981ece){var _0x310a98=function(_0x23ef4b){while(--_0x23ef4b){_0x39dac8['push'](_0x39dac8['shift']());}};_0x310a98(++_0x981ece);}(_0x0e2a,0xfb));var _0xa0e2=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x0e2a[_0x3b7a0c];return _0x3bb70f;};'use strict';var Sequelize=require('sequelize');module[_0xa0e2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa0e2('0x1')]},'zone':{'type':Sequelize[_0xa0e2('0x1')]},'clientId':{'type':Sequelize[_0xa0e2('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0xa0e2('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 341a7a1..900e37b 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 _0xccb8=['util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','save','stack','name','send','index','map','ZohoAccount','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','rows','show','params','include','catch','create','body','find','destroy','getConfigurations','findOne','ZohoConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','com','slice','substring','lastIndexOf','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x315eea,_0x1b0d52){var _0x20a0a5=function(_0x207f3e){while(--_0x207f3e){_0x315eea['push'](_0x315eea['shift']());}};_0x20a0a5(++_0x1b0d52);}(_0xccb8,0x85));var _0x8ccb=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xccb8[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x8ccb('0x0'));var emlformat=require(_0x8ccb('0x1'));var rimraf=require(_0x8ccb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ccb('0x3'));var rp=require('request-promise');var moment=require(_0x8ccb('0x4'));var BPromise=require(_0x8ccb('0x5'));var Mustache=require('mustache');var util=require(_0x8ccb('0x6'));var path=require(_0x8ccb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ccb('0x8'));var fs=require('fs');var _=require(_0x8ccb('0x9'));var squel=require('squel');var crypto=require(_0x8ccb('0xa'));var jsforce=require(_0x8ccb('0xb'));var deskjs=require(_0x8ccb('0xc'));var toCsv=require(_0x8ccb('0xd'));var querystring=require(_0x8ccb('0xe'));var Papa=require(_0x8ccb('0xf'));var Redis=require(_0x8ccb('0x10'));var authService=require(_0x8ccb('0x11'));var qs=require(_0x8ccb('0x12'));var as=require(_0x8ccb('0x13'));var hardwareService=require(_0x8ccb('0x14'));var logger=require('../../config/logger')(_0x8ccb('0x15'));var utils=require(_0x8ccb('0x16'));var config=require(_0x8ccb('0x17'));var db=require(_0x8ccb('0x18'))['db'];var integrations=require(_0x8ccb('0x19'));var jayson=require(_0x8ccb('0x1a'));var client=jayson[_0x8ccb('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x590207,_0x21120d,_0x1db226){if(_0x1db226){var _0x182e46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x182e46[_0x8ccb('0x1c')](_0x21120d)){return _0x590207;}else{throw new db[(_0x8ccb('0x1d'))][(_0x8ccb('0x1e'))](_0x8ccb('0x1f'));}}else{return _0x590207;}}function respondWithRpcPromise(_0x591191,_0x3465de,_0x24b54f,_0x10a823){return new BPromise(function(_0x1660c9,_0x39b61c){var _0x32877e=_0x10a823||client;return _0x32877e[_0x8ccb('0x20')](_0x591191,_0x24b54f)[_0x8ccb('0x21')](function(_0x30d85c){logger[_0x8ccb('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x3465de,_0x8ccb('0x23'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3465de,_0x8ccb('0x23'),JSON[_0x8ccb('0x24')](_0x30d85c));if(_0x30d85c[_0x8ccb('0x25')]){if(_0x30d85c[_0x8ccb('0x25')][_0x8ccb('0x26')]===0x1f4){logger['error'](_0x8ccb('0x27'),_0x3465de,_0x30d85c['error'][_0x8ccb('0x28')]);return _0x39b61c(_0x30d85c[_0x8ccb('0x25')][_0x8ccb('0x28')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3465de,_0x30d85c[_0x8ccb('0x25')][_0x8ccb('0x28')]);return _0x1660c9(_0x30d85c[_0x8ccb('0x25')]['message']);}else{logger[_0x8ccb('0x22')](_0x8ccb('0x27'),_0x3465de,'request\x20sent');_0x1660c9(_0x30d85c[_0x8ccb('0x29')][_0x8ccb('0x28')]);}})['catch'](function(_0xb3df79){logger[_0x8ccb('0x25')](_0x8ccb('0x27'),_0x3465de,_0xb3df79);_0x39b61c(_0xb3df79);});});}function respondWithStatusCode(_0x34b199,_0x3ed770){_0x3ed770=_0x3ed770||0xcc;return function(_0x442fe1){if(_0x442fe1){return _0x34b199['sendStatus'](_0x3ed770);}return _0x34b199[_0x8ccb('0x2a')](_0x3ed770)[_0x8ccb('0x2b')]();};}function respondWithResult(_0x517cd2,_0x3e6aad){_0x3e6aad=_0x3e6aad||0xc8;return function(_0xa466f5){if(_0xa466f5){return _0x517cd2[_0x8ccb('0x2a')](_0x3e6aad)[_0x8ccb('0x2c')](_0xa466f5);}};}function respondWithFilteredResult(_0x40dcb7,_0x4ebdae){return function(_0x2cab99){if(_0x2cab99){var _0x128c2f=_0x2cab99[_0x8ccb('0x2d')],_0x531dbc=_0x4ebdae['offset'],_0x2ad40a=_0x4ebdae[_0x8ccb('0x2e')]+_0x4ebdae[_0x8ccb('0x2f')],_0x41f863;if(_0x2ad40a>=_0x128c2f){_0x2ad40a=_0x128c2f;_0x41f863=0xc8;}else{_0x41f863=0xce;}_0x40dcb7[_0x8ccb('0x2a')](_0x41f863);return _0x40dcb7[_0x8ccb('0x30')](_0x8ccb('0x31'),_0x531dbc+'-'+_0x2ad40a+'/'+_0x128c2f)[_0x8ccb('0x2c')](_0x2cab99);}return null;};}function patchUpdates(_0x2d0cba){return function(_0x1e536a){try{jsonpatch[_0x8ccb('0x32')](_0x1e536a,_0x2d0cba,!![]);}catch(_0x5cdddd){return BPromise['reject'](_0x5cdddd);}return _0x1e536a[_0x8ccb('0x33')]();};}function saveUpdates(_0x599915,_0x4c8af){return function(_0x43274a){if(_0x43274a){return _0x43274a['update'](_0x599915)['then'](function(_0xcbe706){return _0xcbe706;});}return null;};}function removeEntity(_0xdbad8f,_0x21bbe5){return function(_0x4bec57){if(_0x4bec57){return _0x4bec57['destroy']()['then'](function(){_0xdbad8f[_0x8ccb('0x2a')](0xcc)[_0x8ccb('0x2b')]();});}};}function handleEntityNotFound(_0x351b6a,_0xba34d8){return function(_0x33800f){if(!_0x33800f){_0x351b6a['sendStatus'](0x194);}return _0x33800f;};}function handleError(_0x360b07,_0x328867){_0x328867=_0x328867||0x1f4;return function(_0x3cb993){logger['error'](_0x3cb993[_0x8ccb('0x34')]);if(_0x3cb993[_0x8ccb('0x35')]){delete _0x3cb993[_0x8ccb('0x35')];}_0x360b07['status'](_0x328867)[_0x8ccb('0x36')](_0x3cb993);};}exports[_0x8ccb('0x37')]=function(_0x1896ba,_0x194722){var _0x3982df={},_0x5548a9={},_0x5dd611={'count':0x0,'rows':[]};var _0x1d17e1=_[_0x8ccb('0x38')](db[_0x8ccb('0x39')][_0x8ccb('0x3a')],function(_0x48855a){return{'name':_0x48855a['fieldName'],'type':_0x48855a[_0x8ccb('0x3b')]['key']};});_0x5548a9['model']=_[_0x8ccb('0x38')](_0x1d17e1,'name');_0x5548a9[_0x8ccb('0x3c')]=_[_0x8ccb('0x3d')](_0x1896ba[_0x8ccb('0x3c')]);_0x5548a9['filters']=_[_0x8ccb('0x3e')](_0x5548a9[_0x8ccb('0x3f')],_0x5548a9[_0x8ccb('0x3c')]);_0x3982df[_0x8ccb('0x40')]=_[_0x8ccb('0x3e')](_0x5548a9['model'],qs[_0x8ccb('0x41')](_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x41')]));_0x3982df[_0x8ccb('0x40')]=_0x3982df['attributes'][_0x8ccb('0x42')]?_0x3982df[_0x8ccb('0x40')]:_0x5548a9[_0x8ccb('0x3f')];if(!_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x43')](_0x8ccb('0x44'))){_0x3982df[_0x8ccb('0x2f')]=qs[_0x8ccb('0x2f')](_0x1896ba['query']['limit']);_0x3982df[_0x8ccb('0x2e')]=qs[_0x8ccb('0x2e')](_0x1896ba['query'][_0x8ccb('0x2e')]);}_0x3982df[_0x8ccb('0x45')]=qs[_0x8ccb('0x46')](_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x46')]);_0x3982df[_0x8ccb('0x47')]=qs['filters'](_['pick'](_0x1896ba['query'],_0x5548a9[_0x8ccb('0x48')]),_0x1d17e1);if(_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x49')]){_0x3982df[_0x8ccb('0x47')]=_['merge'](_0x3982df['where'],{'$or':_[_0x8ccb('0x38')](_0x1d17e1,function(_0x505e4b){if(_0x505e4b[_0x8ccb('0x3b')]!==_0x8ccb('0x4a')){var _0x2865ae={};_0x2865ae[_0x505e4b[_0x8ccb('0x35')]]={'$like':'%'+_0x1896ba[_0x8ccb('0x3c')]['filter']+'%'};return _0x2865ae;}})});}_0x3982df=_[_0x8ccb('0x4b')]({},_0x3982df,_0x1896ba[_0x8ccb('0x4c')]);var _0x39fd39={'where':_0x3982df[_0x8ccb('0x47')]};return db[_0x8ccb('0x39')][_0x8ccb('0x2d')](_0x39fd39)[_0x8ccb('0x21')](function(_0x3be3e2){_0x5dd611[_0x8ccb('0x2d')]=_0x3be3e2;if(_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x4d')]){_0x3982df['include']=[{'all':!![]}];}return db[_0x8ccb('0x39')]['findAll'](_0x3982df);})[_0x8ccb('0x21')](function(_0x394f34){_0x5dd611[_0x8ccb('0x4e')]=_0x394f34;return _0x5dd611;})['then'](respondWithFilteredResult(_0x194722,_0x3982df))['catch'](handleError(_0x194722,null));};exports[_0x8ccb('0x4f')]=function(_0x57f60e,_0x288272){var _0xbdaee8={'raw':![],'where':{'id':_0x57f60e[_0x8ccb('0x50')]['id']}},_0x5667ab={};_0x5667ab['model']=_[_0x8ccb('0x3d')](db[_0x8ccb('0x39')][_0x8ccb('0x3a')]);_0x5667ab[_0x8ccb('0x3c')]=_[_0x8ccb('0x3d')](_0x57f60e[_0x8ccb('0x3c')]);_0x5667ab[_0x8ccb('0x48')]=_['intersection'](_0x5667ab[_0x8ccb('0x3f')],_0x5667ab[_0x8ccb('0x3c')]);_0xbdaee8[_0x8ccb('0x40')]=_[_0x8ccb('0x3e')](_0x5667ab[_0x8ccb('0x3f')],qs[_0x8ccb('0x41')](_0x57f60e[_0x8ccb('0x3c')][_0x8ccb('0x41')]));_0xbdaee8['attributes']=_0xbdaee8[_0x8ccb('0x40')][_0x8ccb('0x42')]?_0xbdaee8[_0x8ccb('0x40')]:_0x5667ab[_0x8ccb('0x3f')];if(_0x57f60e[_0x8ccb('0x3c')][_0x8ccb('0x4d')]){_0xbdaee8[_0x8ccb('0x51')]=[{'all':!![]}];}_0xbdaee8=_['merge']({},_0xbdaee8,_0x57f60e[_0x8ccb('0x4c')]);return db[_0x8ccb('0x39')]['find'](_0xbdaee8)[_0x8ccb('0x21')](handleEntityNotFound(_0x288272,null))[_0x8ccb('0x21')](respondWithResult(_0x288272,null))[_0x8ccb('0x52')](handleError(_0x288272,null));};exports[_0x8ccb('0x53')]=function(_0x38b6d7,_0x2e1919){return db[_0x8ccb('0x39')][_0x8ccb('0x53')](_0x38b6d7[_0x8ccb('0x54')],{})[_0x8ccb('0x21')](respondWithResult(_0x2e1919,0xc9))['catch'](handleError(_0x2e1919,null));};exports['update']=function(_0x21494,_0xd35ecc){if(_0x21494[_0x8ccb('0x54')]['id']){delete _0x21494['body']['id'];}return db[_0x8ccb('0x39')][_0x8ccb('0x55')]({'where':{'id':_0x21494['params']['id']}})[_0x8ccb('0x21')](handleEntityNotFound(_0xd35ecc,null))[_0x8ccb('0x21')](saveUpdates(_0x21494[_0x8ccb('0x54')],null))['then'](respondWithResult(_0xd35ecc,null))[_0x8ccb('0x52')](handleError(_0xd35ecc,null));};exports[_0x8ccb('0x56')]=function(_0x550ca4,_0x297bed){return db[_0x8ccb('0x39')][_0x8ccb('0x55')]({'where':{'id':_0x550ca4[_0x8ccb('0x50')]['id']}})[_0x8ccb('0x21')](handleEntityNotFound(_0x297bed,null))[_0x8ccb('0x21')](removeEntity(_0x297bed,null))[_0x8ccb('0x52')](handleError(_0x297bed,null));};exports[_0x8ccb('0x57')]=function(_0x5aa45d,_0x4d4a7d,_0x230402){var _0xc04595={};var _0x5c20d4={};var _0x48b01e;var _0x259848;return db[_0x8ccb('0x39')][_0x8ccb('0x58')]({'where':{'id':_0x5aa45d[_0x8ccb('0x50')]['id']}})['then'](handleEntityNotFound(_0x4d4a7d,null))[_0x8ccb('0x21')](function(_0x161396){if(_0x161396){_0x48b01e=_0x161396;_0x5c20d4[_0x8ccb('0x3f')]=_[_0x8ccb('0x3d')](db[_0x8ccb('0x59')][_0x8ccb('0x3a')]);_0x5c20d4[_0x8ccb('0x3c')]=_[_0x8ccb('0x3d')](_0x5aa45d['query']);_0x5c20d4['filters']=_[_0x8ccb('0x3e')](_0x5c20d4[_0x8ccb('0x3f')],_0x5c20d4[_0x8ccb('0x3c')]);_0xc04595[_0x8ccb('0x40')]=_[_0x8ccb('0x3e')](_0x5c20d4[_0x8ccb('0x3f')],qs[_0x8ccb('0x41')](_0x5aa45d[_0x8ccb('0x3c')]['fields']));_0xc04595[_0x8ccb('0x40')]=_0xc04595[_0x8ccb('0x40')][_0x8ccb('0x42')]?_0xc04595[_0x8ccb('0x40')]:_0x5c20d4['model'];_0xc04595[_0x8ccb('0x45')]=qs[_0x8ccb('0x46')](_0x5aa45d[_0x8ccb('0x3c')]['sort']);_0xc04595[_0x8ccb('0x47')]=qs[_0x8ccb('0x48')](_[_0x8ccb('0x5a')](_0x5aa45d['query'],_0x5c20d4[_0x8ccb('0x48')]));if(_0x5aa45d['query'][_0x8ccb('0x49')]){_0xc04595['where']=_[_0x8ccb('0x4b')](_0xc04595['where'],{'$or':_[_0x8ccb('0x38')](_0xc04595[_0x8ccb('0x40')],function(_0x2a0ab4){var _0x422a41={};_0x422a41[_0x2a0ab4]={'$like':'%'+_0x5aa45d[_0x8ccb('0x3c')][_0x8ccb('0x49')]+'%'};return _0x422a41;})});}_0xc04595=_[_0x8ccb('0x4b')]({},_0xc04595,_0x5aa45d[_0x8ccb('0x4c')]);return _0x48b01e['getConfigurations'](_0xc04595);}})['then'](function(_0x223dfc){if(_0x223dfc){_0x259848=_0x223dfc[_0x8ccb('0x42')];if(!_0x5aa45d[_0x8ccb('0x3c')]['hasOwnProperty']('nolimit')){_0xc04595[_0x8ccb('0x2f')]=qs[_0x8ccb('0x2f')](_0x5aa45d[_0x8ccb('0x3c')][_0x8ccb('0x2f')]);_0xc04595[_0x8ccb('0x2e')]=qs[_0x8ccb('0x2e')](_0x5aa45d[_0x8ccb('0x3c')]['offset']);}return _0x48b01e[_0x8ccb('0x57')](_0xc04595);}})[_0x8ccb('0x21')](function(_0x470536){if(_0x470536){return _0x470536?{'count':_0x259848,'rows':_0x470536}:null;}})[_0x8ccb('0x21')](respondWithResult(_0x4d4a7d,null))[_0x8ccb('0x52')](handleError(_0x4d4a7d,null));};exports['addConfiguration']=function(_0x194a9f,_0x24b4af,_0x6762e3){if(_0x194a9f[_0x8ccb('0x54')]['id']){delete _0x194a9f[_0x8ccb('0x54')]['id'];}return db['ZohoAccount'][_0x8ccb('0x58')]({'where':{'id':_0x194a9f[_0x8ccb('0x50')]['id']}})[_0x8ccb('0x21')](handleEntityNotFound(_0x24b4af,null))['then'](function(_0x3ed645){if(_0x3ed645){_0x194a9f['body'][_0x8ccb('0x5b')]=_0x3ed645['id'];_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5c')]=integrations[_0x8ccb('0x5d')](_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5e')],_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x3b')]);_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5f')]=integrations['getDescriptions'](_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5e')],_0x194a9f['body']['type']);return db[_0x8ccb('0x59')]['create'](_0x194a9f[_0x8ccb('0x54')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x8ccb('0x60')],'as':_0x8ccb('0x5f')}]});}return null;})[_0x8ccb('0x21')](respondWithResult(_0x24b4af,null))[_0x8ccb('0x52')](handleError(_0x24b4af,null));};function getAccessToken(_0x4b9ea4){return new Promise(function(_0x20d430,_0x573472){var _0x9b4c72;switch(_0x4b9ea4[_0x8ccb('0x61')]){case'US':_0x9b4c72='https://accounts.zoho.com';break;case'AU':_0x9b4c72=_0x8ccb('0x62');break;case'EU':_0x9b4c72=_0x8ccb('0x63');break;case'IN':_0x9b4c72=_0x8ccb('0x64');break;case'CN':_0x9b4c72=_0x8ccb('0x65');break;default:_0x9b4c72=_0x8ccb('0x63');break;}var _0x48f505={'method':_0x8ccb('0x66'),'uri':_0x9b4c72+_0x8ccb('0x67'),'qs':{'refresh_token':_0x4b9ea4[_0x8ccb('0x68')],'client_id':_0x4b9ea4[_0x8ccb('0x69')],'client_secret':_0x4b9ea4['clientSecret'],'grant_type':_0x8ccb('0x6a')},'json':!![]};return rp(_0x48f505)['then'](function(_0x42d93c){if(_0x42d93c[_0x8ccb('0x6b')]){_0x20d430(_0x42d93c['access_token']);}else{_0x573472(_0x8ccb('0x6c'));}})[_0x8ccb('0x52')](function(_0x445801){_0x573472(_0x445801);});});}exports[_0x8ccb('0x6d')]=function(_0x23b379,_0xcad684,_0x215e2f){var _0x704e3e,_0x553414,_0x804c5c,_0x1ac4dd,_0x5b2981;return db['ZohoAccount']['findOne']({'where':{'id':_0x23b379[_0x8ccb('0x50')]['id']},'attributes':['id',_0x8ccb('0x6e'),'zone',_0x8ccb('0x69'),_0x8ccb('0x6f'),_0x8ccb('0x70'),_0x8ccb('0x26'),_0x8ccb('0x68')]})[_0x8ccb('0x21')](handleEntityNotFound(_0xcad684,null))[_0x8ccb('0x21')](function(_0x3fa854){_0x5b2981=_0x3fa854;_0x704e3e=_0x5b2981[_0x8ccb('0x6e')];_0x553414=_0x704e3e==='zoho.eu'?'eu':_0x8ccb('0x71');_0x804c5c=_0x5b2981[_0x8ccb('0x70')];var _0x2fb8f5=_0x804c5c[_0x8ccb('0x72')](-0x1);if(_0x2fb8f5==='/'||_0x2fb8f5==='\x5c'||_0x2fb8f5===':'){_0x804c5c=_0x804c5c[_0x8ccb('0x73')](0x0,_0x804c5c[_0x8ccb('0x74')](_0x2fb8f5));}if(!_0x5b2981[_0x8ccb('0x68')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5b2981);})[_0x8ccb('0x21')](function(_0x4c25e1){if(_0x4c25e1){return rp({'method':_0x8ccb('0x75'),'uri':util[_0x8ccb('0x76')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x553414),'qs':{'module':_0x8ccb('0x77')},'headers':{'Authorization':_0x8ccb('0x78')+_0x4c25e1},'json':!![]});}})[_0x8ccb('0x21')](function(_0x49fb47){if(_0x49fb47){if(_0x49fb47[_0x8ccb('0x79')]&&_0x49fb47[_0x8ccb('0x79')][_0x8ccb('0x25')]){throw new Error(_0x49fb47[_0x8ccb('0x79')][_0x8ccb('0x25')][_0x8ccb('0x28')]);}var _0x2eec86=[];var _0x400f98=[];var _0xf6624d=[_0x8ccb('0x7a'),_0x8ccb('0x7b'),_0x8ccb('0x7c'),_0x8ccb('0x7d'),_0x8ccb('0x7e'),_0x8ccb('0x7f'),_0x8ccb('0x80'),'Call_Type'];_0x400f98=_[_0x8ccb('0x81')](_0x49fb47[_0x8ccb('0x41')],function(_0xf9f5bc){return _0xf6624d[_0x8ccb('0x82')](_0xf9f5bc['api_name']);});for(var _0x5bd9ba=0x0;_0x5bd9ba<_0x400f98['length'];_0x5bd9ba++){if(_0x400f98[_0x5bd9ba][_0x8ccb('0x83')]===![]){_0x2eec86[_0x8ccb('0x84')]({'id':_0x400f98[_0x5bd9ba]['id'],'name':_0x400f98[_0x5bd9ba][_0x8ccb('0x85')],'custom':_0x400f98[_0x5bd9ba][_0x8ccb('0x86')],'options':_0x400f98[_0x5bd9ba]['data_type']===_0x8ccb('0x87')&&_0x400f98[_0x5bd9ba][_0x8ccb('0x88')]['length']>-0x1?_[_0x8ccb('0x38')](_0x400f98[_0x5bd9ba]['pick_list_values'],function(_0x53d48b){return{'name':_0x53d48b,'value':_0x53d48b};}):[]});}}return{'count':_0x2eec86[_0x8ccb('0x42')],'rows':_0x2eec86};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xcad684,null))[_0x8ccb('0x52')](function(_0x120181){var _0x4ea0ef=_0x23b379[_0x8ccb('0x3c')][_0x8ccb('0x1c')]?0x1f4:_0x120181['statusCode']||0x1f4;logger[_0x8ccb('0x25')](_0x8ccb('0x89'),_0x8ccb('0x6d'),_0x4ea0ef,JSON['stringify'](_0x120181));delete _0x120181[_0x8ccb('0x35')];if(_0x4ea0ef===0x191){_0x4ea0ef=0x190;}_0xcad684['status'](_0x4ea0ef)[_0x8ccb('0x36')](_0x23b379[_0x8ccb('0x3c')][_0x8ccb('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x120181[_0x8ccb('0x8a')]}:_0x120181);});}; \ No newline at end of file +var _0x1609=['response','Owner','Subject','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1609,0x99));var _0x9160=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x1609[_0xbb091];return _0x467a04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9160('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9160('0x1'));var jsonpatch=require(_0x9160('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9160('0x3'));var Mustache=require('mustache');var util=require(_0x9160('0x4'));var path=require(_0x9160('0x5'));var sox=require(_0x9160('0x6'));var csv=require(_0x9160('0x7'));var ejs=require(_0x9160('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9160('0x9'));var crypto=require(_0x9160('0xa'));var jsforce=require(_0x9160('0xb'));var deskjs=require(_0x9160('0xc'));var toCsv=require(_0x9160('0x7'));var querystring=require(_0x9160('0xd'));var Papa=require(_0x9160('0xe'));var Redis=require('ioredis');var authService=require(_0x9160('0xf'));var qs=require(_0x9160('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9160('0x11'));var logger=require(_0x9160('0x12'))(_0x9160('0x13'));var utils=require('../../config/utils');var config=require(_0x9160('0x14'));var db=require(_0x9160('0x15'))['db'];var integrations=require(_0x9160('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x9160('0x17')][_0x9160('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4ebb56,_0x7e2382,_0x53f647){if(_0x53f647){var _0x20928e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20928e[_0x9160('0x19')](_0x7e2382)){return _0x4ebb56;}else{throw new db['Sequelize'][(_0x9160('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4ebb56;}}function respondWithRpcPromise(_0x5d5652,_0x26a13f,_0x400de3,_0x1f6d14){return new BPromise(function(_0x3819da,_0x2edb99){var _0x4953ed=_0x1f6d14||client;return _0x4953ed['request'](_0x5d5652,_0x400de3)['then'](function(_0x111bf2){logger[_0x9160('0x1b')](_0x9160('0x1c'),_0x26a13f,_0x9160('0x1d'));logger[_0x9160('0x1e')](_0x9160('0x1f'),_0x26a13f,_0x9160('0x1d'),JSON[_0x9160('0x20')](_0x111bf2));if(_0x111bf2[_0x9160('0x21')]){if(_0x111bf2[_0x9160('0x21')][_0x9160('0x22')]===0x1f4){logger[_0x9160('0x21')](_0x9160('0x1c'),_0x26a13f,_0x111bf2[_0x9160('0x21')][_0x9160('0x23')]);return _0x2edb99(_0x111bf2[_0x9160('0x21')]['message']);}logger[_0x9160('0x21')](_0x9160('0x1c'),_0x26a13f,_0x111bf2[_0x9160('0x21')]['message']);return _0x3819da(_0x111bf2[_0x9160('0x21')]['message']);}else{logger[_0x9160('0x1b')](_0x9160('0x1c'),_0x26a13f,_0x9160('0x1d'));_0x3819da(_0x111bf2[_0x9160('0x24')][_0x9160('0x23')]);}})[_0x9160('0x25')](function(_0x8f3171){logger[_0x9160('0x21')]('ZohoAccount,\x20%s,\x20%s',_0x26a13f,_0x8f3171);_0x2edb99(_0x8f3171);});});}function respondWithStatusCode(_0x124a78,_0x5d61fe){_0x5d61fe=_0x5d61fe||0xcc;return function(_0x2ba33e){if(_0x2ba33e){return _0x124a78[_0x9160('0x26')](_0x5d61fe);}return _0x124a78[_0x9160('0x27')](_0x5d61fe)[_0x9160('0x28')]();};}function respondWithResult(_0x134d28,_0x2f3389){_0x2f3389=_0x2f3389||0xc8;return function(_0x45a3dd){if(_0x45a3dd){return _0x134d28[_0x9160('0x27')](_0x2f3389)[_0x9160('0x29')](_0x45a3dd);}};}function respondWithFilteredResult(_0x242c3b,_0x4a93e4){return function(_0x924d29){if(_0x924d29){var _0x560172=_0x924d29[_0x9160('0x2a')],_0x1111f4=_0x4a93e4[_0x9160('0x2b')],_0x3e9682=_0x4a93e4[_0x9160('0x2b')]+_0x4a93e4[_0x9160('0x2c')],_0x5b4dd3;if(_0x3e9682>=_0x560172){_0x3e9682=_0x560172;_0x5b4dd3=0xc8;}else{_0x5b4dd3=0xce;}_0x242c3b[_0x9160('0x27')](_0x5b4dd3);return _0x242c3b[_0x9160('0x2d')](_0x9160('0x2e'),_0x1111f4+'-'+_0x3e9682+'/'+_0x560172)['json'](_0x924d29);}return null;};}function patchUpdates(_0x47e84a){return function(_0x4657c5){try{jsonpatch[_0x9160('0x2f')](_0x4657c5,_0x47e84a,!![]);}catch(_0x56ccd7){return BPromise[_0x9160('0x30')](_0x56ccd7);}return _0x4657c5['save']();};}function saveUpdates(_0x1ef795,_0x2124e3){return function(_0x3f5ab1){if(_0x3f5ab1){return _0x3f5ab1[_0x9160('0x31')](_0x1ef795)[_0x9160('0x32')](function(_0x47fda5){return _0x47fda5;});}return null;};}function removeEntity(_0x22937b,_0x18362e){return function(_0x12c7c3){if(_0x12c7c3){return _0x12c7c3[_0x9160('0x33')]()[_0x9160('0x32')](function(){_0x22937b[_0x9160('0x27')](0xcc)[_0x9160('0x28')]();});}};}function handleEntityNotFound(_0xa43a4d,_0x44db75){return function(_0x24bb08){if(!_0x24bb08){_0xa43a4d[_0x9160('0x26')](0x194);}return _0x24bb08;};}function handleError(_0x3e8b68,_0x31a48e){_0x31a48e=_0x31a48e||0x1f4;return function(_0xfa4748){logger[_0x9160('0x21')](_0xfa4748[_0x9160('0x34')]);if(_0xfa4748['name']){delete _0xfa4748['name'];}_0x3e8b68[_0x9160('0x27')](_0x31a48e)[_0x9160('0x35')](_0xfa4748);};}exports[_0x9160('0x36')]=function(_0x396f9f,_0x553fbd){var _0xd130f3={},_0x4b7fde={},_0x45bd24={'count':0x0,'rows':[]};var _0x30f1b4=_[_0x9160('0x37')](db[_0x9160('0x38')][_0x9160('0x39')],function(_0x5f3797){return{'name':_0x5f3797[_0x9160('0x3a')],'type':_0x5f3797[_0x9160('0x3b')][_0x9160('0x3c')]};});_0x4b7fde[_0x9160('0x3d')]=_[_0x9160('0x37')](_0x30f1b4,_0x9160('0x3e'));_0x4b7fde['query']=_[_0x9160('0x3f')](_0x396f9f['query']);_0x4b7fde[_0x9160('0x40')]=_[_0x9160('0x41')](_0x4b7fde['model'],_0x4b7fde[_0x9160('0x42')]);_0xd130f3[_0x9160('0x43')]=_['intersection'](_0x4b7fde[_0x9160('0x3d')],qs[_0x9160('0x44')](_0x396f9f[_0x9160('0x42')][_0x9160('0x44')]));_0xd130f3['attributes']=_0xd130f3[_0x9160('0x43')][_0x9160('0x45')]?_0xd130f3[_0x9160('0x43')]:_0x4b7fde[_0x9160('0x3d')];if(!_0x396f9f[_0x9160('0x42')][_0x9160('0x46')](_0x9160('0x47'))){_0xd130f3[_0x9160('0x2c')]=qs[_0x9160('0x2c')](_0x396f9f[_0x9160('0x42')][_0x9160('0x2c')]);_0xd130f3[_0x9160('0x2b')]=qs[_0x9160('0x2b')](_0x396f9f[_0x9160('0x42')][_0x9160('0x2b')]);}_0xd130f3[_0x9160('0x48')]=qs[_0x9160('0x49')](_0x396f9f[_0x9160('0x42')][_0x9160('0x49')]);_0xd130f3['where']=qs[_0x9160('0x40')](_[_0x9160('0x4a')](_0x396f9f[_0x9160('0x42')],_0x4b7fde['filters']),_0x30f1b4);if(_0x396f9f['query'][_0x9160('0x4b')]){_0xd130f3['where']=_[_0x9160('0x4c')](_0xd130f3['where'],{'$or':_[_0x9160('0x37')](_0x30f1b4,function(_0xf0ceba){if(_0xf0ceba[_0x9160('0x3b')]!==_0x9160('0x4d')){var _0x4852ea={};_0x4852ea[_0xf0ceba[_0x9160('0x3e')]]={'$like':'%'+_0x396f9f['query'][_0x9160('0x4b')]+'%'};return _0x4852ea;}})});}_0xd130f3=_[_0x9160('0x4c')]({},_0xd130f3,_0x396f9f[_0x9160('0x4e')]);var _0x209a26={'where':_0xd130f3[_0x9160('0x4f')]};return db[_0x9160('0x38')][_0x9160('0x2a')](_0x209a26)[_0x9160('0x32')](function(_0x592f74){_0x45bd24[_0x9160('0x2a')]=_0x592f74;if(_0x396f9f['query'][_0x9160('0x50')]){_0xd130f3[_0x9160('0x51')]=[{'all':!![]}];}return db[_0x9160('0x38')]['findAll'](_0xd130f3);})['then'](function(_0x356057){_0x45bd24[_0x9160('0x52')]=_0x356057;return _0x45bd24;})['then'](respondWithFilteredResult(_0x553fbd,_0xd130f3))['catch'](handleError(_0x553fbd,null));};exports[_0x9160('0x53')]=function(_0x34125e,_0xfc89b){var _0x540963={'raw':![],'where':{'id':_0x34125e[_0x9160('0x54')]['id']}},_0x1de247={};_0x1de247[_0x9160('0x3d')]=_[_0x9160('0x3f')](db['ZohoAccount'][_0x9160('0x39')]);_0x1de247['query']=_[_0x9160('0x3f')](_0x34125e[_0x9160('0x42')]);_0x1de247[_0x9160('0x40')]=_[_0x9160('0x41')](_0x1de247[_0x9160('0x3d')],_0x1de247[_0x9160('0x42')]);_0x540963[_0x9160('0x43')]=_['intersection'](_0x1de247['model'],qs[_0x9160('0x44')](_0x34125e['query'][_0x9160('0x44')]));_0x540963[_0x9160('0x43')]=_0x540963[_0x9160('0x43')]['length']?_0x540963[_0x9160('0x43')]:_0x1de247[_0x9160('0x3d')];if(_0x34125e[_0x9160('0x42')][_0x9160('0x50')]){_0x540963[_0x9160('0x51')]=[{'all':!![]}];}_0x540963=_[_0x9160('0x4c')]({},_0x540963,_0x34125e[_0x9160('0x4e')]);return db[_0x9160('0x38')][_0x9160('0x55')](_0x540963)[_0x9160('0x32')](handleEntityNotFound(_0xfc89b,null))[_0x9160('0x32')](respondWithResult(_0xfc89b,null))[_0x9160('0x25')](handleError(_0xfc89b,null));};exports[_0x9160('0x56')]=function(_0x53febf,_0x412031){return db[_0x9160('0x38')][_0x9160('0x56')](_0x53febf[_0x9160('0x57')],{})[_0x9160('0x32')](respondWithResult(_0x412031,0xc9))[_0x9160('0x25')](handleError(_0x412031,null));};exports[_0x9160('0x31')]=function(_0x544c9b,_0x356fd1){if(_0x544c9b['body']['id']){delete _0x544c9b['body']['id'];}return db[_0x9160('0x38')][_0x9160('0x55')]({'where':{'id':_0x544c9b[_0x9160('0x54')]['id']}})['then'](handleEntityNotFound(_0x356fd1,null))[_0x9160('0x32')](saveUpdates(_0x544c9b[_0x9160('0x57')],null))['then'](respondWithResult(_0x356fd1,null))[_0x9160('0x25')](handleError(_0x356fd1,null));};exports[_0x9160('0x33')]=function(_0x1d3844,_0x28187c){return db[_0x9160('0x38')][_0x9160('0x55')]({'where':{'id':_0x1d3844['params']['id']}})['then'](handleEntityNotFound(_0x28187c,null))[_0x9160('0x32')](removeEntity(_0x28187c,null))[_0x9160('0x25')](handleError(_0x28187c,null));};exports[_0x9160('0x58')]=function(_0x5b5508,_0x45987c,_0xc49af4){var _0x130fdb={};var _0x2d2912={};var _0x268a94;var _0x5145ea;return db[_0x9160('0x38')][_0x9160('0x59')]({'where':{'id':_0x5b5508['params']['id']}})[_0x9160('0x32')](handleEntityNotFound(_0x45987c,null))[_0x9160('0x32')](function(_0x35a61a){if(_0x35a61a){_0x268a94=_0x35a61a;_0x2d2912[_0x9160('0x3d')]=_['keys'](db[_0x9160('0x5a')][_0x9160('0x39')]);_0x2d2912[_0x9160('0x42')]=_[_0x9160('0x3f')](_0x5b5508[_0x9160('0x42')]);_0x2d2912[_0x9160('0x40')]=_[_0x9160('0x41')](_0x2d2912[_0x9160('0x3d')],_0x2d2912[_0x9160('0x42')]);_0x130fdb['attributes']=_[_0x9160('0x41')](_0x2d2912[_0x9160('0x3d')],qs[_0x9160('0x44')](_0x5b5508[_0x9160('0x42')][_0x9160('0x44')]));_0x130fdb[_0x9160('0x43')]=_0x130fdb['attributes'][_0x9160('0x45')]?_0x130fdb[_0x9160('0x43')]:_0x2d2912[_0x9160('0x3d')];_0x130fdb[_0x9160('0x48')]=qs[_0x9160('0x49')](_0x5b5508[_0x9160('0x42')][_0x9160('0x49')]);_0x130fdb['where']=qs['filters'](_[_0x9160('0x4a')](_0x5b5508['query'],_0x2d2912[_0x9160('0x40')]));if(_0x5b5508['query']['filter']){_0x130fdb[_0x9160('0x4f')]=_[_0x9160('0x4c')](_0x130fdb[_0x9160('0x4f')],{'$or':_['map'](_0x130fdb[_0x9160('0x43')],function(_0x1af7ee){var _0x8c9a8b={};_0x8c9a8b[_0x1af7ee]={'$like':'%'+_0x5b5508[_0x9160('0x42')][_0x9160('0x4b')]+'%'};return _0x8c9a8b;})});}_0x130fdb=_[_0x9160('0x4c')]({},_0x130fdb,_0x5b5508[_0x9160('0x4e')]);return _0x268a94[_0x9160('0x58')](_0x130fdb);}})[_0x9160('0x32')](function(_0x31e309){if(_0x31e309){_0x5145ea=_0x31e309[_0x9160('0x45')];if(!_0x5b5508[_0x9160('0x42')][_0x9160('0x46')](_0x9160('0x47'))){_0x130fdb['limit']=qs[_0x9160('0x2c')](_0x5b5508[_0x9160('0x42')][_0x9160('0x2c')]);_0x130fdb[_0x9160('0x2b')]=qs['offset'](_0x5b5508[_0x9160('0x42')]['offset']);}return _0x268a94[_0x9160('0x58')](_0x130fdb);}})[_0x9160('0x32')](function(_0x2aa4b8){if(_0x2aa4b8){return _0x2aa4b8?{'count':_0x5145ea,'rows':_0x2aa4b8}:null;}})['then'](respondWithResult(_0x45987c,null))[_0x9160('0x25')](handleError(_0x45987c,null));};exports[_0x9160('0x5b')]=function(_0x2bfc1b,_0x4feacb,_0x270671){if(_0x2bfc1b[_0x9160('0x57')]['id']){delete _0x2bfc1b[_0x9160('0x57')]['id'];}return db['ZohoAccount'][_0x9160('0x59')]({'where':{'id':_0x2bfc1b[_0x9160('0x54')]['id']}})[_0x9160('0x32')](handleEntityNotFound(_0x4feacb,null))[_0x9160('0x32')](function(_0x35fc6e){if(_0x35fc6e){_0x2bfc1b[_0x9160('0x57')][_0x9160('0x5c')]=_0x35fc6e['id'];_0x2bfc1b[_0x9160('0x57')][_0x9160('0x5d')]=integrations[_0x9160('0x5e')](_0x2bfc1b[_0x9160('0x57')]['channel'],_0x2bfc1b[_0x9160('0x57')][_0x9160('0x3b')]);_0x2bfc1b[_0x9160('0x57')]['Descriptions']=integrations[_0x9160('0x5f')](_0x2bfc1b[_0x9160('0x57')][_0x9160('0x60')],_0x2bfc1b[_0x9160('0x57')][_0x9160('0x3b')]);return db[_0x9160('0x5a')][_0x9160('0x56')](_0x2bfc1b[_0x9160('0x57')],{'include':[{'model':db[_0x9160('0x61')],'as':'Subjects'},{'model':db[_0x9160('0x61')],'as':_0x9160('0x62')}]});}return null;})[_0x9160('0x32')](respondWithResult(_0x4feacb,null))['catch'](handleError(_0x4feacb,null));};function getAccessToken(_0x4ec63a){return new Promise(function(_0x4c8b21,_0x3c1995){var _0x288e7c;switch(_0x4ec63a[_0x9160('0x63')]){case'US':_0x288e7c='https://accounts.zoho.com';break;case'AU':_0x288e7c='https://accounts.zoho.com.au';break;case'EU':_0x288e7c=_0x9160('0x64');break;case'IN':_0x288e7c='https://accounts.zoho.in';break;case'CN':_0x288e7c=_0x9160('0x65');break;default:_0x288e7c='https://accounts.zoho.eu';break;}var _0x20990f={'method':_0x9160('0x66'),'uri':_0x288e7c+_0x9160('0x67'),'qs':{'refresh_token':_0x4ec63a[_0x9160('0x68')],'client_id':_0x4ec63a[_0x9160('0x69')],'client_secret':_0x4ec63a['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x20990f)['then'](function(_0x2e064e){if(_0x2e064e[_0x9160('0x6a')]){_0x4c8b21(_0x2e064e[_0x9160('0x6a')]);}else{_0x3c1995(_0x9160('0x6b'));}})[_0x9160('0x25')](function(_0x3b38c7){_0x3c1995(_0x3b38c7);});});}exports[_0x9160('0x6c')]=function(_0x2403f1,_0x522138,_0x2d0e77){var _0x50bbe5,_0x436640,_0x1931cd,_0xf36bfa,_0x5ac0fc;return db[_0x9160('0x38')][_0x9160('0x59')]({'where':{'id':_0x2403f1['params']['id']},'attributes':['id',_0x9160('0x6d'),'zone',_0x9160('0x69'),_0x9160('0x6e'),'serverUrl',_0x9160('0x22'),'refreshToken']})[_0x9160('0x32')](handleEntityNotFound(_0x522138,null))[_0x9160('0x32')](function(_0x1497b6){_0x5ac0fc=_0x1497b6;_0x50bbe5=_0x5ac0fc[_0x9160('0x6d')];_0x436640=_0x50bbe5==='zoho.eu'?'eu':_0x9160('0x6f');_0x1931cd=_0x5ac0fc[_0x9160('0x70')];var _0x103370=_0x1931cd[_0x9160('0x71')](-0x1);if(_0x103370==='/'||_0x103370==='\x5c'||_0x103370===':'){_0x1931cd=_0x1931cd['substring'](0x0,_0x1931cd[_0x9160('0x72')](_0x103370));}if(!_0x5ac0fc[_0x9160('0x68')]){throw new Error(_0x9160('0x73'));}return getAccessToken(_0x5ac0fc);})[_0x9160('0x32')](function(_0x27cc8c){if(_0x27cc8c){return rp({'method':_0x9160('0x74'),'uri':util[_0x9160('0x75')](_0x9160('0x76'),_0x436640),'qs':{'module':_0x9160('0x77')},'headers':{'Authorization':_0x9160('0x78')+_0x27cc8c},'json':!![]});}})[_0x9160('0x32')](function(_0x9ebdb9){if(_0x9ebdb9){if(_0x9ebdb9[_0x9160('0x79')]&&_0x9ebdb9[_0x9160('0x79')][_0x9160('0x21')]){throw new Error(_0x9ebdb9[_0x9160('0x79')][_0x9160('0x21')][_0x9160('0x23')]);}var _0x5e3017=[];var _0x185b11=[];var _0x1f5d64=[_0x9160('0x7a'),_0x9160('0x7b'),'Description','WhoId','Call_Duration',_0x9160('0x7c'),_0x9160('0x7d'),_0x9160('0x7e')];_0x185b11=_[_0x9160('0x7f')](_0x9ebdb9['fields'],function(_0x5e6292){return _0x1f5d64[_0x9160('0x80')](_0x5e6292['api_name']);});for(var _0x427035=0x0;_0x427035<_0x185b11[_0x9160('0x45')];_0x427035++){if(_0x185b11[_0x427035][_0x9160('0x81')]===![]){_0x5e3017['push']({'id':_0x185b11[_0x427035]['id'],'name':_0x185b11[_0x427035][_0x9160('0x82')],'custom':_0x185b11[_0x427035][_0x9160('0x83')],'options':_0x185b11[_0x427035]['data_type']===_0x9160('0x84')&&_0x185b11[_0x427035]['pick_list_values'][_0x9160('0x45')]>-0x1?_['map'](_0x185b11[_0x427035][_0x9160('0x85')],function(_0x2126ed){return{'name':_0x2126ed,'value':_0x2126ed};}):[]});}}return{'count':_0x5e3017[_0x9160('0x45')],'rows':_0x5e3017};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x522138,null))['catch'](function(_0x5521c6){var _0x525dcc=_0x2403f1[_0x9160('0x42')]['test']?0x1f4:_0x5521c6[_0x9160('0x86')]||0x1f4;logger[_0x9160('0x21')](_0x9160('0x87'),_0x9160('0x6c'),_0x525dcc,JSON['stringify'](_0x5521c6));delete _0x5521c6[_0x9160('0x3e')];if(_0x525dcc===0x191){_0x525dcc=0x190;}_0x522138[_0x9160('0x27')](_0x525dcc)[_0x9160('0x35')](_0x2403f1[_0x9160('0x42')][_0x9160('0x19')]?{'message':_0x9160('0x88'),'statusCode':_0x5521c6[_0x9160('0x86')]}:_0x5521c6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8970040..71b4c8f 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 _0xf84a=['ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','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','https://accounts.zoho.com','then','parse','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4c1513,_0x5b0418){var _0x4f253f=function(_0x25cd66){while(--_0x25cd66){_0x4c1513['push'](_0x4c1513['shift']());}};_0x4f253f(++_0x5b0418);}(_0xf84a,0x1e2));var _0xaf84=function(_0x4bb235,_0x46a03d){_0x4bb235=_0x4bb235-0x0;var _0x64493f=_0xf84a[_0x4bb235];return _0x64493f;};'use strict';var _=require(_0xaf84('0x0'));var util=require(_0xaf84('0x1'));var logger=require(_0xaf84('0x2'))(_0xaf84('0x3'));var moment=require(_0xaf84('0x4'));var BPromise=require(_0xaf84('0x5'));var rp=require(_0xaf84('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf84('0x7'));var config=require(_0xaf84('0x8'));var attributes=require(_0xaf84('0x9'));var integrations=require(_0xaf84('0xa'));module[_0xaf84('0xb')]=function(_0xd1c5f8,_0x4688d8){return _0xd1c5f8[_0xaf84('0xc')](_0xaf84('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe46150,_0x4b0439,_0x54438a){if(_0xe46150[_0xaf84('0xe')](_0xaf84('0xf'))||_0xe46150['changed'](_0xaf84('0x10'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x11'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x12'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x13'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x14'))){var _0x25963d,_0x5598cb;_0x25963d=_0xe46150[_0xaf84('0x10')];var _0x5a5c95=_0x25963d[_0xaf84('0x15')](-0x1);if(_0x5a5c95==='/'||_0x5a5c95==='\x5c'||_0x5a5c95===':'){_0x25963d=_0x25963d[_0xaf84('0x16')](0x0,_0x25963d[_0xaf84('0x17')](_0x5a5c95));}switch(_0xe46150[_0xaf84('0xf')]){case'US':_0x5598cb='https://accounts.zoho.com';break;case'AU':_0x5598cb=_0xaf84('0x18');break;case'IN':_0x5598cb=_0xaf84('0x19');break;case'CN':_0x5598cb=_0xaf84('0x1a');break;default:_0x5598cb=_0xaf84('0x1b');break;}var _0x445e40={'method':_0xaf84('0x1c'),'uri':_0x5598cb+_0xaf84('0x1d'),'form':{'grant_type':_0xaf84('0x1e'),'client_id':_0xe46150['clientId'],'client_secret':_0xe46150[_0xaf84('0x12')],'redirect_uri':_0xe46150['serverUrl'],'code':_0xe46150[_0xaf84('0x13')]},'headers':{'Content-Type':_0xaf84('0x1f')}};return rp(_0x445e40)['then'](function(_0x5c9b4d){var _0x3d3b02=JSON['parse'](_0x5c9b4d);if(_0x3d3b02[_0xaf84('0x20')]){_0xe46150[_0xaf84('0x21')]=_0x3d3b02[_0xaf84('0x20')];logger[_0xaf84('0x22')](util[_0xaf84('0x23')](_0xaf84('0x24'),_0xe46150[_0xaf84('0x25')],_0xe46150['id']));}else{logger[_0xaf84('0x26')](util['format'](_0xaf84('0x27'),_0xe46150['name'],_0xe46150['id']),util[_0xaf84('0x28')](_0x3d3b02,{'showHidden':![],'depth':null}));}return _0x54438a(null,_0x4b0439);})['catch'](function(_0x1fa8e2){logger[_0xaf84('0x26')](util[_0xaf84('0x23')](_0xaf84('0x27'),_0xe46150[_0xaf84('0x25')],_0xe46150['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x54438a(_0x1fa8e2);});}else{return _0x54438a(null,_0x4b0439);}},'beforeUpdate':function(_0x28bf37,_0x55e7a5,_0x597c12){if(_0x28bf37[_0xaf84('0xe')](_0xaf84('0xf'))||_0x28bf37[_0xaf84('0xe')]('serverUrl')||_0x28bf37['changed'](_0xaf84('0x11'))||_0x28bf37['changed'](_0xaf84('0x12'))||_0x28bf37[_0xaf84('0xe')](_0xaf84('0x13'))||_0x28bf37['changed'](_0xaf84('0x14'))){var _0x1f9669,_0x3c3182;_0x1f9669=_0x28bf37[_0xaf84('0x10')];var _0x5a37ce=_0x1f9669['slice'](-0x1);if(_0x5a37ce==='/'||_0x5a37ce==='\x5c'||_0x5a37ce===':'){_0x1f9669=_0x1f9669['substring'](0x0,_0x1f9669['lastIndexOf'](_0x5a37ce));}switch(_0x28bf37[_0xaf84('0xf')]){case'US':_0x3c3182=_0xaf84('0x29');break;case'AU':_0x3c3182=_0xaf84('0x18');break;case'IN':_0x3c3182=_0xaf84('0x19');break;case'CN':_0x3c3182='https://accounts.zoho.com.cn';break;default:_0x3c3182='https://accounts.zoho.eu';break;}var _0x4ad1ec={'method':_0xaf84('0x1c'),'uri':_0x3c3182+_0xaf84('0x1d'),'form':{'grant_type':_0xaf84('0x1e'),'client_id':_0x28bf37[_0xaf84('0x11')],'client_secret':_0x28bf37[_0xaf84('0x12')],'redirect_uri':_0x28bf37[_0xaf84('0x10')],'code':_0x28bf37[_0xaf84('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4ad1ec)[_0xaf84('0x2a')](function(_0x177154){var _0x5f2ad9=JSON[_0xaf84('0x2b')](_0x177154);if(_0x5f2ad9[_0xaf84('0x20')]){_0x28bf37['refreshToken']=_0x5f2ad9[_0xaf84('0x20')];logger[_0xaf84('0x22')](util[_0xaf84('0x23')](_0xaf84('0x24'),_0x28bf37['name'],_0x28bf37['id']));}else{logger[_0xaf84('0x26')](util[_0xaf84('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28bf37[_0xaf84('0x25')],_0x28bf37['id']),util[_0xaf84('0x28')](_0x5f2ad9,{'showHidden':![],'depth':null}));}return _0x597c12(null,_0x55e7a5);})[_0xaf84('0x2c')](function(_0x3780f4){logger[_0xaf84('0x26')](util[_0xaf84('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28bf37[_0xaf84('0x25')],_0x28bf37['id']),util[_0xaf84('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x597c12(_0x3780f4);});}else{return _0x597c12(null,_0x55e7a5);}}}});}; \ No newline at end of file +var _0x72e2=['changed','zone','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts'];(function(_0x3f2cfe,_0x16fd1c){var _0x36c4ae=function(_0x5893cb){while(--_0x5893cb){_0x3f2cfe['push'](_0x3f2cfe['shift']());}};_0x36c4ae(++_0x16fd1c);}(_0x72e2,0x16f));var _0x272e=function(_0x209fdf,_0x31b8b7){_0x209fdf=_0x209fdf-0x0;var _0x2e2d99=_0x72e2[_0x209fdf];return _0x2e2d99;};'use strict';var _=require(_0x272e('0x0'));var util=require(_0x272e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x272e('0x2'));var BPromise=require(_0x272e('0x3'));var rp=require(_0x272e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x272e('0x5'));var attributes=require(_0x272e('0x6'));var integrations=require(_0x272e('0x7'));module[_0x272e('0x8')]=function(_0x49e933,_0x1d1355){return _0x49e933[_0x272e('0x9')]('ZohoAccount',attributes,{'tableName':_0x272e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x449158,_0x5f279c,_0x479ba0){if(_0x449158[_0x272e('0xb')](_0x272e('0xc'))||_0x449158['changed']('serverUrl')||_0x449158['changed']('clientId')||_0x449158[_0x272e('0xb')](_0x272e('0xd'))||_0x449158[_0x272e('0xb')](_0x272e('0xe'))||_0x449158[_0x272e('0xb')](_0x272e('0xf'))){var _0x125c1e,_0x46aa40;_0x125c1e=_0x449158[_0x272e('0x10')];var _0x1650b8=_0x125c1e[_0x272e('0x11')](-0x1);if(_0x1650b8==='/'||_0x1650b8==='\x5c'||_0x1650b8===':'){_0x125c1e=_0x125c1e[_0x272e('0x12')](0x0,_0x125c1e[_0x272e('0x13')](_0x1650b8));}switch(_0x449158[_0x272e('0xc')]){case'US':_0x46aa40=_0x272e('0x14');break;case'AU':_0x46aa40=_0x272e('0x15');break;case'IN':_0x46aa40=_0x272e('0x16');break;case'CN':_0x46aa40=_0x272e('0x17');break;default:_0x46aa40=_0x272e('0x18');break;}var _0x7d8c95={'method':_0x272e('0x19'),'uri':_0x46aa40+_0x272e('0x1a'),'form':{'grant_type':_0x272e('0x1b'),'client_id':_0x449158[_0x272e('0x1c')],'client_secret':_0x449158[_0x272e('0xd')],'redirect_uri':_0x449158['serverUrl'],'code':_0x449158[_0x272e('0xe')]},'headers':{'Content-Type':_0x272e('0x1d')}};return rp(_0x7d8c95)[_0x272e('0x1e')](function(_0x42c678){var _0x862c42=JSON[_0x272e('0x1f')](_0x42c678);if(_0x862c42[_0x272e('0x20')]){_0x449158[_0x272e('0x21')]=_0x862c42[_0x272e('0x20')];logger[_0x272e('0x22')](util[_0x272e('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x449158[_0x272e('0x24')],_0x449158['id']));}else{logger[_0x272e('0x25')](util['format'](_0x272e('0x26'),_0x449158[_0x272e('0x24')],_0x449158['id']),util[_0x272e('0x27')](_0x862c42,{'showHidden':![],'depth':null}));}return _0x479ba0(null,_0x5f279c);})[_0x272e('0x28')](function(_0x451fd8){logger['error'](util[_0x272e('0x23')](_0x272e('0x26'),_0x449158[_0x272e('0x24')],_0x449158['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x479ba0(_0x451fd8);});}else{return _0x479ba0(null,_0x5f279c);}},'beforeUpdate':function(_0x515566,_0x4cc13a,_0x35daed){if(_0x515566[_0x272e('0xb')]('zone')||_0x515566[_0x272e('0xb')]('serverUrl')||_0x515566[_0x272e('0xb')](_0x272e('0x1c'))||_0x515566[_0x272e('0xb')](_0x272e('0xd'))||_0x515566['changed']('code')||_0x515566[_0x272e('0xb')](_0x272e('0xf'))){var _0x6ffcad,_0x15c9e6;_0x6ffcad=_0x515566[_0x272e('0x10')];var _0x1b1a58=_0x6ffcad['slice'](-0x1);if(_0x1b1a58==='/'||_0x1b1a58==='\x5c'||_0x1b1a58===':'){_0x6ffcad=_0x6ffcad[_0x272e('0x12')](0x0,_0x6ffcad[_0x272e('0x13')](_0x1b1a58));}switch(_0x515566[_0x272e('0xc')]){case'US':_0x15c9e6=_0x272e('0x14');break;case'AU':_0x15c9e6='https://accounts.zoho.com.au';break;case'IN':_0x15c9e6='https://accounts.zoho.in';break;case'CN':_0x15c9e6=_0x272e('0x17');break;default:_0x15c9e6=_0x272e('0x18');break;}var _0x13befa={'method':_0x272e('0x19'),'uri':_0x15c9e6+_0x272e('0x1a'),'form':{'grant_type':_0x272e('0x1b'),'client_id':_0x515566['clientId'],'client_secret':_0x515566['clientSecret'],'redirect_uri':_0x515566['serverUrl'],'code':_0x515566['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x13befa)[_0x272e('0x1e')](function(_0x443840){var _0x3e2f44=JSON[_0x272e('0x1f')](_0x443840);if(_0x3e2f44[_0x272e('0x20')]){_0x515566[_0x272e('0x21')]=_0x3e2f44[_0x272e('0x20')];logger[_0x272e('0x22')](util[_0x272e('0x23')](_0x272e('0x29'),_0x515566[_0x272e('0x24')],_0x515566['id']));}else{logger[_0x272e('0x25')](util[_0x272e('0x23')](_0x272e('0x26'),_0x515566[_0x272e('0x24')],_0x515566['id']),util[_0x272e('0x27')](_0x3e2f44,{'showHidden':![],'depth':null}));}return _0x35daed(null,_0x4cc13a);})[_0x272e('0x28')](function(_0x3682c3){logger[_0x272e('0x25')](util[_0x272e('0x23')](_0x272e('0x26'),_0x515566[_0x272e('0x24')],_0x515566['id']),util[_0x272e('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x35daed(_0x3682c3);});}else{return _0x35daed(null,_0x4cc13a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 908ab41..4305588 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 _0x745c=['message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','include','map','model','ShowZohoAccount','find','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x475482,_0x5bf595){var _0x1445b8=function(_0x570dbc){while(--_0x570dbc){_0x475482['push'](_0x475482['shift']());}};_0x1445b8(++_0x5bf595);}(_0x745c,0x1e4));var _0xc745=function(_0x63c808,_0x581c80){_0x63c808=_0x63c808-0x0;var _0x190a3c=_0x745c[_0x63c808];return _0x190a3c;};'use strict';var _=require(_0xc745('0x0'));var util=require(_0xc745('0x1'));var moment=require('moment');var BPromise=require(_0xc745('0x2'));var rs=require(_0xc745('0x3'));var fs=require('fs');var Redis=require(_0xc745('0x4'));var db=require(_0xc745('0x5'))['db'];var utils=require(_0xc745('0x6'));var logger=require(_0xc745('0x7'))(_0xc745('0x8'));var config=require(_0xc745('0x9'));var jayson=require(_0xc745('0xa'));var client=jayson[_0xc745('0xb')][_0xc745('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x881cc7,_0x2a5fbe,_0x264074){return new BPromise(function(_0x4df180,_0x4a6889){return client['request'](_0x881cc7,_0x264074)['then'](function(_0x4e081c){logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,'request\x20sent');logger[_0xc745('0xf')](_0xc745('0x10'),_0x2a5fbe,'request\x20sent',JSON[_0xc745('0x11')](_0x4e081c));if(_0x4e081c['error']){if(_0x4e081c[_0xc745('0x12')][_0xc745('0x13')]===0x1f4){logger[_0xc745('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2a5fbe,_0x4e081c[_0xc745('0x12')]['message']);return _0x4a6889(_0x4e081c[_0xc745('0x12')]['message']);}logger['error'](_0xc745('0xe'),_0x2a5fbe,_0x4e081c[_0xc745('0x12')][_0xc745('0x14')]);return _0x4df180(_0x4e081c['error'][_0xc745('0x14')]);}else{logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,_0xc745('0x15'));_0x4df180(_0x4e081c[_0xc745('0x16')]['message']);}})[_0xc745('0x17')](function(_0x4f3f2b){logger[_0xc745('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2a5fbe,_0x4f3f2b);_0x4a6889(_0x4f3f2b);});});}exports[_0xc745('0x18')]=function(_0x33ac56){var _0x228063=this;return new Promise(function(_0x55d787,_0x8e1f86){return db[_0xc745('0x19')]['findAll']({'raw':_0x33ac56[_0xc745('0x1a')]?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1b')]===undefined?!![]:![]:!![],'where':_0x33ac56[_0xc745('0x1a')]?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1c')]||null:null,'attributes':_0x33ac56['options']?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1d')]||null:null,'limit':_0x33ac56['options']?_0x33ac56[_0xc745('0x1a')]['limit']||null:null,'include':_0x33ac56['options']?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x33ac56['options'][_0xc745('0x1e')],function(_0x5b5bba){return{'model':db[_0x5b5bba['model']],'as':_0x5b5bba['as'],'attributes':_0x5b5bba[_0xc745('0x1d')],'include':_0x5b5bba[_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x5b5bba[_0xc745('0x1e')],function(_0x572f71){return{'model':db[_0x572f71[_0xc745('0x20')]],'as':_0x572f71['as'],'attributes':_0x572f71['attributes'],'include':_0x572f71['include']?_['map'](_0x572f71[_0xc745('0x1e')],function(_0x4a4a31){return{'model':db[_0x4a4a31[_0xc745('0x20')]],'as':_0x4a4a31['as'],'attributes':_0x4a4a31[_0xc745('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3925f6){logger[_0xc745('0xd')](_0xc745('0x18'),_0x33ac56);logger[_0xc745('0xf')](_0xc745('0x18'),_0x33ac56,JSON[_0xc745('0x11')](_0x3925f6));_0x55d787(_0x3925f6);})[_0xc745('0x17')](function(_0x1ec03c){logger[_0xc745('0x12')](_0xc745('0x18'),_0x1ec03c['message'],_0x33ac56);_0x8e1f86(_0x228063['error'](0x1f4,_0x1ec03c['message']));});});};exports[_0xc745('0x21')]=function(_0x4c6120){var _0x315e9b=this;return new Promise(function(_0x43987d,_0x30b024){return db['ZohoAccount'][_0xc745('0x22')]({'raw':_0x4c6120[_0xc745('0x1a')]?_0x4c6120[_0xc745('0x1a')][_0xc745('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c6120['options']?_0x4c6120[_0xc745('0x1a')][_0xc745('0x1c')]||null:null,'attributes':_0x4c6120['options']?_0x4c6120[_0xc745('0x1a')][_0xc745('0x1d')]||null:null,'include':_0x4c6120[_0xc745('0x1a')]?_0x4c6120['options']['include']?_[_0xc745('0x1f')](_0x4c6120[_0xc745('0x1a')][_0xc745('0x1e')],function(_0x11b583){return{'model':db[_0x11b583['model']],'as':_0x11b583['as'],'attributes':_0x11b583['attributes'],'include':_0x11b583[_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x11b583[_0xc745('0x1e')],function(_0x2e2367){return{'model':db[_0x2e2367[_0xc745('0x20')]],'as':_0x2e2367['as'],'attributes':_0x2e2367[_0xc745('0x1d')],'include':_0x2e2367[_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x2e2367['include'],function(_0x13efe9){return{'model':db[_0x13efe9[_0xc745('0x20')]],'as':_0x13efe9['as'],'attributes':_0x13efe9[_0xc745('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc745('0x23')](function(_0xf9f34b){logger[_0xc745('0xd')](_0xc745('0x21'),_0x4c6120);logger[_0xc745('0xf')](_0xc745('0x21'),_0x4c6120,JSON[_0xc745('0x11')](_0xf9f34b));_0x43987d(_0xf9f34b);})[_0xc745('0x17')](function(_0x504418){logger[_0xc745('0x12')](_0xc745('0x21'),_0x504418['message'],_0x4c6120);_0x30b024(_0x315e9b[_0xc745('0x12')](0x1f4,_0x504418[_0xc745('0x14')]));});});}; \ No newline at end of file +var _0x226b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0xb3cc64,_0x4160db){var _0x492c7e=function(_0x3830b8){while(--_0x3830b8){_0xb3cc64['push'](_0xb3cc64['shift']());}};_0x492c7e(++_0x4160db);}(_0x226b,0x161));var _0xb226=function(_0x26236c,_0x234b4e){_0x26236c=_0x26236c-0x0;var _0x33d1dd=_0x226b[_0x26236c];return _0x33d1dd;};'use strict';var _=require(_0xb226('0x0'));var util=require(_0xb226('0x1'));var moment=require(_0xb226('0x2'));var BPromise=require(_0xb226('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb226('0x4'));var db=require(_0xb226('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb226('0x6'))(_0xb226('0x7'));var config=require(_0xb226('0x8'));var jayson=require(_0xb226('0x9'));var client=jayson[_0xb226('0xa')][_0xb226('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fd6bc,_0x3a0cb2,_0x450420){return new BPromise(function(_0x5ee216,_0x454cba){return client[_0xb226('0xc')](_0x3fd6bc,_0x450420)[_0xb226('0xd')](function(_0x5b85c8){logger[_0xb226('0xe')](_0xb226('0xf'),_0x3a0cb2,_0xb226('0x10'));logger[_0xb226('0x11')](_0xb226('0x12'),_0x3a0cb2,_0xb226('0x10'),JSON[_0xb226('0x13')](_0x5b85c8));if(_0x5b85c8['error']){if(_0x5b85c8[_0xb226('0x14')]['code']===0x1f4){logger[_0xb226('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3a0cb2,_0x5b85c8['error']['message']);return _0x454cba(_0x5b85c8['error'][_0xb226('0x15')]);}logger[_0xb226('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3a0cb2,_0x5b85c8[_0xb226('0x14')]['message']);return _0x5ee216(_0x5b85c8[_0xb226('0x14')][_0xb226('0x15')]);}else{logger['info'](_0xb226('0xf'),_0x3a0cb2,'request\x20sent');_0x5ee216(_0x5b85c8[_0xb226('0x16')][_0xb226('0x15')]);}})[_0xb226('0x17')](function(_0x119447){logger[_0xb226('0x14')](_0xb226('0xf'),_0x3a0cb2,_0x119447);_0x454cba(_0x119447);});});}exports[_0xb226('0x18')]=function(_0x5d0dfe){var _0x3405e6=this;return new Promise(function(_0x130ff0,_0x32d8b3){return db[_0xb226('0x19')][_0xb226('0x1a')]({'raw':_0x5d0dfe['options']?_0x5d0dfe[_0xb226('0x1b')][_0xb226('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d0dfe[_0xb226('0x1b')]?_0x5d0dfe[_0xb226('0x1b')][_0xb226('0x1d')]||null:null,'attributes':_0x5d0dfe[_0xb226('0x1b')]?_0x5d0dfe[_0xb226('0x1b')][_0xb226('0x1e')]||null:null,'limit':_0x5d0dfe[_0xb226('0x1b')]?_0x5d0dfe[_0xb226('0x1b')][_0xb226('0x1f')]||null:null,'include':_0x5d0dfe['options']?_0x5d0dfe['options'][_0xb226('0x20')]?_[_0xb226('0x21')](_0x5d0dfe[_0xb226('0x1b')][_0xb226('0x20')],function(_0x946099){return{'model':db[_0x946099[_0xb226('0x22')]],'as':_0x946099['as'],'attributes':_0x946099[_0xb226('0x1e')],'include':_0x946099['include']?_[_0xb226('0x21')](_0x946099[_0xb226('0x20')],function(_0x1f73aa){return{'model':db[_0x1f73aa['model']],'as':_0x1f73aa['as'],'attributes':_0x1f73aa['attributes'],'include':_0x1f73aa['include']?_['map'](_0x1f73aa[_0xb226('0x20')],function(_0xd2d479){return{'model':db[_0xd2d479[_0xb226('0x22')]],'as':_0xd2d479['as'],'attributes':_0xd2d479['attributes']};}):[]};}):[]};}):[]:[]})[_0xb226('0xd')](function(_0x3dd466){logger['info'](_0xb226('0x18'),_0x5d0dfe);logger[_0xb226('0x11')](_0xb226('0x18'),_0x5d0dfe,JSON[_0xb226('0x13')](_0x3dd466));_0x130ff0(_0x3dd466);})[_0xb226('0x17')](function(_0x21ce5c){logger[_0xb226('0x14')](_0xb226('0x18'),_0x21ce5c[_0xb226('0x15')],_0x5d0dfe);_0x32d8b3(_0x3405e6[_0xb226('0x14')](0x1f4,_0x21ce5c[_0xb226('0x15')]));});});};exports[_0xb226('0x23')]=function(_0x44578e){var _0x284588=this;return new Promise(function(_0x357166,_0x471ece){return db[_0xb226('0x19')]['find']({'raw':_0x44578e[_0xb226('0x1b')]?_0x44578e[_0xb226('0x1b')][_0xb226('0x1c')]===undefined?!![]:![]:!![],'where':_0x44578e[_0xb226('0x1b')]?_0x44578e[_0xb226('0x1b')]['where']||null:null,'attributes':_0x44578e[_0xb226('0x1b')]?_0x44578e[_0xb226('0x1b')][_0xb226('0x1e')]||null:null,'include':_0x44578e[_0xb226('0x1b')]?_0x44578e[_0xb226('0x1b')][_0xb226('0x20')]?_['map'](_0x44578e[_0xb226('0x1b')][_0xb226('0x20')],function(_0x57359a){return{'model':db[_0x57359a[_0xb226('0x22')]],'as':_0x57359a['as'],'attributes':_0x57359a['attributes'],'include':_0x57359a['include']?_[_0xb226('0x21')](_0x57359a[_0xb226('0x20')],function(_0x51b962){return{'model':db[_0x51b962[_0xb226('0x22')]],'as':_0x51b962['as'],'attributes':_0x51b962[_0xb226('0x1e')],'include':_0x51b962[_0xb226('0x20')]?_[_0xb226('0x21')](_0x51b962[_0xb226('0x20')],function(_0x4a3ab3){return{'model':db[_0x4a3ab3[_0xb226('0x22')]],'as':_0x4a3ab3['as'],'attributes':_0x4a3ab3[_0xb226('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x417628){logger['info'](_0xb226('0x23'),_0x44578e);logger[_0xb226('0x11')]('ShowZohoAccount',_0x44578e,JSON['stringify'](_0x417628));_0x357166(_0x417628);})[_0xb226('0x17')](function(_0x228e24){logger[_0xb226('0x14')](_0xb226('0x23'),_0x228e24[_0xb226('0x15')],_0x44578e);_0x471ece(_0x284588['error'](0x1f4,_0x228e24['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 53276f4..2219f44 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 _0x112a=['getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x24f7bb,_0x267dc2){var _0x2c5c5a=function(_0x9c1836){while(--_0x9c1836){_0x24f7bb['push'](_0x24f7bb['shift']());}};_0x2c5c5a(++_0x267dc2);}(_0x112a,0x115));var _0xa112=function(_0x3ea510,_0x3a1ba5){_0x3ea510=_0x3ea510-0x0;var _0x492199=_0x112a[_0x3ea510];return _0x492199;};'use strict';var multer=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var path=require(_0xa112('0x2'));var timeout=require(_0xa112('0x3'));var express=require(_0xa112('0x4'));var router=express[_0xa112('0x5')]();var auth=require(_0xa112('0x6'));var interaction=require(_0xa112('0x7'));var config=require(_0xa112('0x8'));var controller=require(_0xa112('0x9'));router[_0xa112('0xa')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0xc')]);router[_0xa112('0xa')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0xe')]);router[_0xa112('0xa')](_0xa112('0xf'),auth[_0xa112('0xb')](),controller[_0xa112('0x10')]);router[_0xa112('0xa')](_0xa112('0x11'),auth['isAuthenticated'](),controller[_0xa112('0x12')]);router['get'](_0xa112('0x13'),auth[_0xa112('0xb')](),controller[_0xa112('0x14')]);router[_0xa112('0x15')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0x16')]);router[_0xa112('0x17')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x18')]);router[_0xa112('0x19')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x7be1=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated'];(function(_0x3e4c02,_0x466584){var _0x12fc79=function(_0x8d5a20){while(--_0x8d5a20){_0x3e4c02['push'](_0x3e4c02['shift']());}};_0x12fc79(++_0x466584);}(_0x7be1,0x165));var _0x17be=function(_0x3ba2f6,_0x13cdb9){_0x3ba2f6=_0x3ba2f6-0x0;var _0x5bf772=_0x7be1[_0x3ba2f6];return _0x5bf772;};'use strict';var multer=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var path=require(_0x17be('0x2'));var timeout=require('connect-timeout');var express=require(_0x17be('0x3'));var router=express[_0x17be('0x4')]();var auth=require(_0x17be('0x5'));var interaction=require(_0x17be('0x6'));var config=require(_0x17be('0x7'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x17be('0x8')]);router[_0x17be('0x9')]('/:id',auth[_0x17be('0xa')](),controller[_0x17be('0xb')]);router[_0x17be('0x9')](_0x17be('0xc'),auth[_0x17be('0xa')](),controller[_0x17be('0xd')]);router['get'](_0x17be('0xe'),auth['isAuthenticated'](),controller[_0x17be('0xf')]);router[_0x17be('0x9')]('/:id/descriptions',auth[_0x17be('0xa')](),controller[_0x17be('0x10')]);router[_0x17be('0x11')]('/',auth[_0x17be('0xa')](),controller['create']);router[_0x17be('0x12')]('/:id',auth[_0x17be('0xa')](),controller['update']);router[_0x17be('0x13')](_0x17be('0x14'),auth[_0x17be('0xa')](),controller[_0x17be('0x15')]);module[_0x17be('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f0df877..dd15311 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 _0xb792=['contact_lead','exports','STRING','ENUM','lead','nothing'];(function(_0x2a31fa,_0x5d4755){var _0x581150=function(_0x2483a8){while(--_0x2483a8){_0x2a31fa['push'](_0x2a31fa['shift']());}};_0x581150(++_0x5d4755);}(_0xb792,0xf7));var _0x2b79=function(_0xd505e4,_0x4027a0){_0xd505e4=_0xd505e4-0x0;var _0x2c2a85=_0xb792[_0xd505e4];return _0x2c2a85;};'use strict';var Sequelize=require('sequelize');module[_0x2b79('0x0')]={'name':{'type':Sequelize[_0x2b79('0x1')]},'moduleCreate':{'type':Sequelize[_0x2b79('0x2')](_0x2b79('0x3'),'contact',_0x2b79('0x4')),'defaultValue':_0x2b79('0x3')},'moduleSearch':{'type':Sequelize[_0x2b79('0x2')](_0x2b79('0x5'),'contact',_0x2b79('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc8af=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x124aad,_0x37353a){var _0x582e38=function(_0x1640fd){while(--_0x1640fd){_0x124aad['push'](_0x124aad['shift']());}};_0x582e38(++_0x37353a);}(_0xc8af,0x118));var _0xfc8a=function(_0x3b1085,_0x5dd154){_0x3b1085=_0x3b1085-0x0;var _0x4fa273=_0xc8af[_0x3b1085];return _0x4fa273;};'use strict';var Sequelize=require(_0xfc8a('0x0'));module[_0xfc8a('0x1')]={'name':{'type':Sequelize[_0xfc8a('0x2')]},'moduleCreate':{'type':Sequelize[_0xfc8a('0x3')](_0xfc8a('0x4'),_0xfc8a('0x5'),_0xfc8a('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xfc8a('0x3')](_0xfc8a('0x7'),_0xfc8a('0x5'),_0xfc8a('0x4')),'defaultValue':_0xfc8a('0x7')},'description':{'type':Sequelize[_0xfc8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 68441c8..35ff3c9 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 _0x4a71=['debug','stringify','error','code','message','catch','status','end','json','count','offset','apply','reject','save','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','pick','filter','where','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','show','keys','find','create','body','update','params','getFields','findOne','ZohoField','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x4a71,0x95));var _0x14a7=function(_0xea897b,_0x269096){_0xea897b=_0xea897b-0x0;var _0x8a736e=_0x4a71[_0xea897b];return _0x8a736e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x14a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14a7('0x1'));var jsonpatch=require(_0x14a7('0x2'));var rp=require('request-promise');var moment=require(_0x14a7('0x3'));var BPromise=require(_0x14a7('0x4'));var Mustache=require(_0x14a7('0x5'));var util=require(_0x14a7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x14a7('0x7'));var ejs=require(_0x14a7('0x8'));var fs=require('fs');var _=require(_0x14a7('0x9'));var squel=require(_0x14a7('0xa'));var crypto=require(_0x14a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14a7('0xc'));var Papa=require(_0x14a7('0xd'));var Redis=require(_0x14a7('0xe'));var authService=require(_0x14a7('0xf'));var qs=require(_0x14a7('0x10'));var as=require(_0x14a7('0x11'));var hardwareService=require(_0x14a7('0x12'));var logger=require('../../config/logger')(_0x14a7('0x13'));var utils=require(_0x14a7('0x14'));var config=require(_0x14a7('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x14a7('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x227b8f,_0x2943e4,_0x4e1fed){if(_0x4e1fed){var _0x75ae1d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x75ae1d[_0x14a7('0x17')](_0x2943e4)){return _0x227b8f;}else{throw new db[(_0x14a7('0x18'))]['ValidationError'](_0x14a7('0x19'));}}else{return _0x227b8f;}}function respondWithRpcPromise(_0x462b90,_0x333e17,_0x2bd585,_0x196312){return new BPromise(function(_0x46259f,_0x5ef093){var _0x4643d1=_0x196312||client;return _0x4643d1[_0x14a7('0x1a')](_0x462b90,_0x2bd585)[_0x14a7('0x1b')](function(_0x332b14){logger[_0x14a7('0x1c')](_0x14a7('0x1d'),_0x333e17,_0x14a7('0x1e'));logger[_0x14a7('0x1f')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x333e17,'request\x20sent',JSON[_0x14a7('0x20')](_0x332b14));if(_0x332b14[_0x14a7('0x21')]){if(_0x332b14['error'][_0x14a7('0x22')]===0x1f4){logger[_0x14a7('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x333e17,_0x332b14[_0x14a7('0x21')]['message']);return _0x5ef093(_0x332b14['error'][_0x14a7('0x23')]);}logger[_0x14a7('0x21')](_0x14a7('0x1d'),_0x333e17,_0x332b14[_0x14a7('0x21')][_0x14a7('0x23')]);return _0x46259f(_0x332b14[_0x14a7('0x21')][_0x14a7('0x23')]);}else{logger['info'](_0x14a7('0x1d'),_0x333e17,_0x14a7('0x1e'));_0x46259f(_0x332b14['result'][_0x14a7('0x23')]);}})[_0x14a7('0x24')](function(_0x2b7a14){logger['error'](_0x14a7('0x1d'),_0x333e17,_0x2b7a14);_0x5ef093(_0x2b7a14);});});}function respondWithStatusCode(_0x1da118,_0x475217){_0x475217=_0x475217||0xcc;return function(_0x4640ce){if(_0x4640ce){return _0x1da118['sendStatus'](_0x475217);}return _0x1da118[_0x14a7('0x25')](_0x475217)[_0x14a7('0x26')]();};}function respondWithResult(_0x5dfaa0,_0x5e91cf){_0x5e91cf=_0x5e91cf||0xc8;return function(_0x4c7b62){if(_0x4c7b62){return _0x5dfaa0[_0x14a7('0x25')](_0x5e91cf)[_0x14a7('0x27')](_0x4c7b62);}};}function respondWithFilteredResult(_0x528880,_0x10b3ac){return function(_0x47dbd9){if(_0x47dbd9){var _0x1bf482=_0x47dbd9[_0x14a7('0x28')],_0x8a3d6d=_0x10b3ac['offset'],_0x53b39f=_0x10b3ac[_0x14a7('0x29')]+_0x10b3ac['limit'],_0x512938;if(_0x53b39f>=_0x1bf482){_0x53b39f=_0x1bf482;_0x512938=0xc8;}else{_0x512938=0xce;}_0x528880['status'](_0x512938);return _0x528880['set']('Content-Range',_0x8a3d6d+'-'+_0x53b39f+'/'+_0x1bf482)['json'](_0x47dbd9);}return null;};}function patchUpdates(_0x1653ec){return function(_0x3eeeaa){try{jsonpatch[_0x14a7('0x2a')](_0x3eeeaa,_0x1653ec,!![]);}catch(_0x6dd532){return BPromise[_0x14a7('0x2b')](_0x6dd532);}return _0x3eeeaa[_0x14a7('0x2c')]();};}function saveUpdates(_0x104061,_0x1e4414){return function(_0x168f2b){if(_0x168f2b){return _0x168f2b['update'](_0x104061)[_0x14a7('0x1b')](function(_0x1ff344){return _0x1ff344;});}return null;};}function removeEntity(_0x528ab3,_0x70f00d){return function(_0x26f8d4){if(_0x26f8d4){return _0x26f8d4[_0x14a7('0x2d')]()[_0x14a7('0x1b')](function(){_0x528ab3[_0x14a7('0x25')](0xcc)[_0x14a7('0x26')]();});}};}function handleEntityNotFound(_0x52d404,_0x10b4ed){return function(_0x4f9bd5){if(!_0x4f9bd5){_0x52d404[_0x14a7('0x2e')](0x194);}return _0x4f9bd5;};}function handleError(_0x19a664,_0x315d5d){_0x315d5d=_0x315d5d||0x1f4;return function(_0x3b413b){logger[_0x14a7('0x21')](_0x3b413b[_0x14a7('0x2f')]);if(_0x3b413b[_0x14a7('0x30')]){delete _0x3b413b[_0x14a7('0x30')];}_0x19a664['status'](_0x315d5d)[_0x14a7('0x31')](_0x3b413b);};}exports[_0x14a7('0x32')]=function(_0x52b339,_0x8a94e4){var _0x186123={},_0x3f72f0={},_0x8b636d={'count':0x0,'rows':[]};var _0x536ff4=_['map'](db['ZohoConfiguration'][_0x14a7('0x33')],function(_0x2b0521){return{'name':_0x2b0521[_0x14a7('0x34')],'type':_0x2b0521[_0x14a7('0x35')][_0x14a7('0x36')]};});_0x3f72f0[_0x14a7('0x37')]=_[_0x14a7('0x38')](_0x536ff4,_0x14a7('0x30'));_0x3f72f0['query']=_['keys'](_0x52b339[_0x14a7('0x39')]);_0x3f72f0[_0x14a7('0x3a')]=_[_0x14a7('0x3b')](_0x3f72f0[_0x14a7('0x37')],_0x3f72f0[_0x14a7('0x39')]);_0x186123[_0x14a7('0x3c')]=_[_0x14a7('0x3b')](_0x3f72f0['model'],qs[_0x14a7('0x3d')](_0x52b339['query'][_0x14a7('0x3d')]));_0x186123['attributes']=_0x186123['attributes'][_0x14a7('0x3e')]?_0x186123['attributes']:_0x3f72f0[_0x14a7('0x37')];if(!_0x52b339[_0x14a7('0x39')]['hasOwnProperty'](_0x14a7('0x3f'))){_0x186123['limit']=qs[_0x14a7('0x40')](_0x52b339['query']['limit']);_0x186123[_0x14a7('0x29')]=qs[_0x14a7('0x29')](_0x52b339[_0x14a7('0x39')][_0x14a7('0x29')]);}_0x186123[_0x14a7('0x41')]=qs['sort'](_0x52b339[_0x14a7('0x39')]['sort']);_0x186123['where']=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0x52b339[_0x14a7('0x39')],_0x3f72f0['filters']),_0x536ff4);if(_0x52b339[_0x14a7('0x39')][_0x14a7('0x43')]){_0x186123[_0x14a7('0x44')]=_[_0x14a7('0x45')](_0x186123['where'],{'$or':_[_0x14a7('0x38')](_0x536ff4,function(_0xcbf3fe){if(_0xcbf3fe[_0x14a7('0x35')]!=='VIRTUAL'){var _0x5f2acb={};_0x5f2acb[_0xcbf3fe['name']]={'$like':'%'+_0x52b339[_0x14a7('0x39')]['filter']+'%'};return _0x5f2acb;}})});}_0x186123=_[_0x14a7('0x45')]({},_0x186123,_0x52b339[_0x14a7('0x46')]);var _0x1f84f5={'where':_0x186123['where']};return db[_0x14a7('0x47')][_0x14a7('0x28')](_0x1f84f5)[_0x14a7('0x1b')](function(_0x5be449){_0x8b636d['count']=_0x5be449;if(_0x52b339['query'][_0x14a7('0x48')]){_0x186123[_0x14a7('0x49')]=[{'all':!![]}];}return db[_0x14a7('0x47')][_0x14a7('0x4a')](_0x186123);})[_0x14a7('0x1b')](function(_0xdda916){_0x8b636d[_0x14a7('0x4b')]=_0xdda916;return _0x8b636d;})[_0x14a7('0x1b')](respondWithFilteredResult(_0x8a94e4,_0x186123))[_0x14a7('0x24')](handleError(_0x8a94e4,null));};exports[_0x14a7('0x4c')]=function(_0x3b9585,_0x213d14){var _0x110f33={'raw':![],'where':{'id':_0x3b9585['params']['id']}},_0x75ee2f={};_0x75ee2f[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db[_0x14a7('0x47')][_0x14a7('0x33')]);_0x75ee2f[_0x14a7('0x39')]=_[_0x14a7('0x4d')](_0x3b9585['query']);_0x75ee2f[_0x14a7('0x3a')]=_[_0x14a7('0x3b')](_0x75ee2f['model'],_0x75ee2f[_0x14a7('0x39')]);_0x110f33['attributes']=_[_0x14a7('0x3b')](_0x75ee2f[_0x14a7('0x37')],qs['fields'](_0x3b9585[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x110f33[_0x14a7('0x3c')]=_0x110f33[_0x14a7('0x3c')]['length']?_0x110f33[_0x14a7('0x3c')]:_0x75ee2f['model'];if(_0x3b9585['query'][_0x14a7('0x48')]){_0x110f33['include']=[{'all':!![]}];}_0x110f33=_[_0x14a7('0x45')]({},_0x110f33,_0x3b9585[_0x14a7('0x46')]);return db[_0x14a7('0x47')][_0x14a7('0x4e')](_0x110f33)[_0x14a7('0x1b')](handleEntityNotFound(_0x213d14,null))[_0x14a7('0x1b')](respondWithResult(_0x213d14,null))[_0x14a7('0x24')](handleError(_0x213d14,null));};exports[_0x14a7('0x4f')]=function(_0x3750b2,_0x257702){return db[_0x14a7('0x47')]['create'](_0x3750b2[_0x14a7('0x50')],{})[_0x14a7('0x1b')](respondWithResult(_0x257702,0xc9))[_0x14a7('0x24')](handleError(_0x257702,null));};exports[_0x14a7('0x51')]=function(_0x553b8f,_0x329577){if(_0x553b8f[_0x14a7('0x50')]['id']){delete _0x553b8f[_0x14a7('0x50')]['id'];}return db[_0x14a7('0x47')][_0x14a7('0x4e')]({'where':{'id':_0x553b8f['params']['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x329577,null))[_0x14a7('0x1b')](saveUpdates(_0x553b8f['body'],null))[_0x14a7('0x1b')](respondWithResult(_0x329577,null))[_0x14a7('0x24')](handleError(_0x329577,null));};exports[_0x14a7('0x2d')]=function(_0x441a03,_0x119ca9){return db[_0x14a7('0x47')][_0x14a7('0x4e')]({'where':{'id':_0x441a03[_0x14a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x119ca9,null))[_0x14a7('0x1b')](removeEntity(_0x119ca9,null))[_0x14a7('0x24')](handleError(_0x119ca9,null));};exports[_0x14a7('0x53')]=function(_0xcb7029,_0x331e9c,_0x1763e1){var _0x35030d={};var _0xa45386={};var _0x2ca6af;var _0x55fa43;return db[_0x14a7('0x47')][_0x14a7('0x54')]({'where':{'id':_0xcb7029[_0x14a7('0x52')]['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x331e9c,null))[_0x14a7('0x1b')](function(_0x2be912){if(_0x2be912){_0x2ca6af=_0x2be912;_0xa45386[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db[_0x14a7('0x55')][_0x14a7('0x33')]);_0xa45386[_0x14a7('0x39')]=_['keys'](_0xcb7029[_0x14a7('0x39')]);_0xa45386[_0x14a7('0x3a')]=_['intersection'](_0xa45386[_0x14a7('0x37')],_0xa45386[_0x14a7('0x39')]);_0x35030d['attributes']=_[_0x14a7('0x3b')](_0xa45386[_0x14a7('0x37')],qs[_0x14a7('0x3d')](_0xcb7029[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x35030d[_0x14a7('0x3c')]=_0x35030d['attributes'][_0x14a7('0x3e')]?_0x35030d[_0x14a7('0x3c')]:_0xa45386[_0x14a7('0x37')];_0x35030d['order']=qs['sort'](_0xcb7029[_0x14a7('0x39')][_0x14a7('0x56')]);_0x35030d['where']=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0xcb7029[_0x14a7('0x39')],_0xa45386[_0x14a7('0x3a')]));if(_0xcb7029['query'][_0x14a7('0x43')]){_0x35030d[_0x14a7('0x44')]=_['merge'](_0x35030d[_0x14a7('0x44')],{'$or':_[_0x14a7('0x38')](_0x35030d[_0x14a7('0x3c')],function(_0x3bc25e){var _0x5c30af={};_0x5c30af[_0x3bc25e]={'$like':'%'+_0xcb7029[_0x14a7('0x39')][_0x14a7('0x43')]+'%'};return _0x5c30af;})});}_0x35030d=_[_0x14a7('0x45')]({},_0x35030d,_0xcb7029['options']);return _0x2ca6af[_0x14a7('0x53')](_0x35030d);}})[_0x14a7('0x1b')](function(_0x46d31b){if(_0x46d31b){_0x55fa43=_0x46d31b[_0x14a7('0x3e')];if(!_0xcb7029[_0x14a7('0x39')][_0x14a7('0x57')](_0x14a7('0x3f'))){_0x35030d['limit']=qs['limit'](_0xcb7029[_0x14a7('0x39')]['limit']);_0x35030d['offset']=qs[_0x14a7('0x29')](_0xcb7029['query'][_0x14a7('0x29')]);}return _0x2ca6af['getFields'](_0x35030d);}})[_0x14a7('0x1b')](function(_0x1d54f7){if(_0x1d54f7){return _0x1d54f7?{'count':_0x55fa43,'rows':_0x1d54f7}:null;}})[_0x14a7('0x1b')](respondWithResult(_0x331e9c,null))[_0x14a7('0x24')](handleError(_0x331e9c,null));};exports[_0x14a7('0x58')]=function(_0x388c9c,_0x45db18,_0x16601b){var _0x488813={};var _0x5ecccf={};var _0x570f1d;var _0x28e53f;return db[_0x14a7('0x47')]['findOne']({'where':{'id':_0x388c9c['params']['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x45db18,null))[_0x14a7('0x1b')](function(_0x794177){if(_0x794177){_0x570f1d=_0x794177;_0x5ecccf[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db[_0x14a7('0x55')]['rawAttributes']);_0x5ecccf[_0x14a7('0x39')]=_[_0x14a7('0x4d')](_0x388c9c['query']);_0x5ecccf[_0x14a7('0x3a')]=_[_0x14a7('0x3b')](_0x5ecccf[_0x14a7('0x37')],_0x5ecccf[_0x14a7('0x39')]);_0x488813[_0x14a7('0x3c')]=_[_0x14a7('0x3b')](_0x5ecccf[_0x14a7('0x37')],qs[_0x14a7('0x3d')](_0x388c9c[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x488813[_0x14a7('0x3c')]=_0x488813[_0x14a7('0x3c')][_0x14a7('0x3e')]?_0x488813[_0x14a7('0x3c')]:_0x5ecccf[_0x14a7('0x37')];_0x488813[_0x14a7('0x41')]=qs['sort'](_0x388c9c[_0x14a7('0x39')]['sort']);_0x488813[_0x14a7('0x44')]=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0x388c9c[_0x14a7('0x39')],_0x5ecccf[_0x14a7('0x3a')]));if(_0x388c9c['query'][_0x14a7('0x43')]){_0x488813[_0x14a7('0x44')]=_[_0x14a7('0x45')](_0x488813[_0x14a7('0x44')],{'$or':_[_0x14a7('0x38')](_0x488813[_0x14a7('0x3c')],function(_0x1182b1){var _0x61bcaf={};_0x61bcaf[_0x1182b1]={'$like':'%'+_0x388c9c[_0x14a7('0x39')][_0x14a7('0x43')]+'%'};return _0x61bcaf;})});}_0x488813=_[_0x14a7('0x45')]({},_0x488813,_0x388c9c[_0x14a7('0x46')]);return _0x570f1d[_0x14a7('0x58')](_0x488813);}})['then'](function(_0x1d3df2){if(_0x1d3df2){_0x28e53f=_0x1d3df2['length'];if(!_0x388c9c['query'][_0x14a7('0x57')](_0x14a7('0x3f'))){_0x488813[_0x14a7('0x40')]=qs['limit'](_0x388c9c['query'][_0x14a7('0x40')]);_0x488813[_0x14a7('0x29')]=qs[_0x14a7('0x29')](_0x388c9c['query']['offset']);}return _0x570f1d[_0x14a7('0x58')](_0x488813);}})[_0x14a7('0x1b')](function(_0x112b98){if(_0x112b98){return _0x112b98?{'count':_0x28e53f,'rows':_0x112b98}:null;}})[_0x14a7('0x1b')](respondWithResult(_0x45db18,null))[_0x14a7('0x24')](handleError(_0x45db18,null));};exports[_0x14a7('0x59')]=function(_0x2b5322,_0x4d8181,_0x1af343){var _0x2a7bfc={};var _0x5550f7={};var _0x124eb0;var _0x13f83b;return db['ZohoConfiguration'][_0x14a7('0x54')]({'where':{'id':_0x2b5322['params']['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x4d8181,null))['then'](function(_0x3ce319){if(_0x3ce319){_0x124eb0=_0x3ce319;_0x5550f7[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db['ZohoField'][_0x14a7('0x33')]);_0x5550f7[_0x14a7('0x39')]=_[_0x14a7('0x4d')](_0x2b5322[_0x14a7('0x39')]);_0x5550f7[_0x14a7('0x3a')]=_['intersection'](_0x5550f7[_0x14a7('0x37')],_0x5550f7[_0x14a7('0x39')]);_0x2a7bfc[_0x14a7('0x3c')]=_[_0x14a7('0x3b')](_0x5550f7['model'],qs[_0x14a7('0x3d')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x2a7bfc[_0x14a7('0x3c')]=_0x2a7bfc[_0x14a7('0x3c')][_0x14a7('0x3e')]?_0x2a7bfc[_0x14a7('0x3c')]:_0x5550f7[_0x14a7('0x37')];_0x2a7bfc['order']=qs[_0x14a7('0x56')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x56')]);_0x2a7bfc[_0x14a7('0x44')]=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0x2b5322[_0x14a7('0x39')],_0x5550f7[_0x14a7('0x3a')]));if(_0x2b5322[_0x14a7('0x39')][_0x14a7('0x43')]){_0x2a7bfc[_0x14a7('0x44')]=_[_0x14a7('0x45')](_0x2a7bfc[_0x14a7('0x44')],{'$or':_[_0x14a7('0x38')](_0x2a7bfc[_0x14a7('0x3c')],function(_0x494d8f){var _0x5d69a7={};_0x5d69a7[_0x494d8f]={'$like':'%'+_0x2b5322['query'][_0x14a7('0x43')]+'%'};return _0x5d69a7;})});}_0x2a7bfc=_[_0x14a7('0x45')]({},_0x2a7bfc,_0x2b5322[_0x14a7('0x46')]);return _0x124eb0[_0x14a7('0x59')](_0x2a7bfc);}})[_0x14a7('0x1b')](function(_0xbda780){if(_0xbda780){_0x13f83b=_0xbda780[_0x14a7('0x3e')];if(!_0x2b5322['query'][_0x14a7('0x57')](_0x14a7('0x3f'))){_0x2a7bfc[_0x14a7('0x40')]=qs[_0x14a7('0x40')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x40')]);_0x2a7bfc[_0x14a7('0x29')]=qs[_0x14a7('0x29')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x29')]);}return _0x124eb0['getDescriptions'](_0x2a7bfc);}})['then'](function(_0x4c7322){if(_0x4c7322){return _0x4c7322?{'count':_0x13f83b,'rows':_0x4c7322}:null;}})[_0x14a7('0x1b')](respondWithResult(_0x4d8181,null))[_0x14a7('0x24')](handleError(_0x4d8181,null));}; \ No newline at end of file +var _0x2222=['length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','create','body','params','getFields','findOne','hasOwnProperty','getSubjects','ZohoField','nolimit','getDescriptions','eml-format','zip-dir','request-promise','moment','util','path','sox','lodash','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../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','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','status','json','count','offset','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','map','ZohoConfiguration','fieldName','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3beb85,_0x4a0fbf){var _0x4b50e9=function(_0x491b5e){while(--_0x491b5e){_0x3beb85['push'](_0x3beb85['shift']());}};_0x4b50e9(++_0x4a0fbf);}(_0x2222,0x1c4));var _0x2222=function(_0x349a6d,_0x4b5ae0){_0x349a6d=_0x349a6d-0x0;var _0x391c7d=_0x2222[_0x349a6d];return _0x391c7d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2222('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2222('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2222('0x2'));var moment=require(_0x2222('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2222('0x4'));var path=require(_0x2222('0x5'));var sox=require(_0x2222('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2222('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2222('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x2222('0x9'));var querystring=require(_0x2222('0xa'));var Papa=require('papaparse');var Redis=require(_0x2222('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x2222('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2222('0xd'));var logger=require(_0x2222('0xe'))('api');var utils=require(_0x2222('0xf'));var config=require('../../config/environment');var db=require(_0x2222('0x10'))['db'];var jayson=require(_0x2222('0x11'));var client=jayson[_0x2222('0x12')][_0x2222('0x13')]({'port':0x232a});function checkPasswordPattern(_0x283585,_0x349bc1,_0x40f368){if(_0x40f368){var _0x530f21=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x530f21[_0x2222('0x14')](_0x349bc1)){return _0x283585;}else{throw new db[(_0x2222('0x15'))][(_0x2222('0x16'))](_0x2222('0x17'));}}else{return _0x283585;}}function respondWithRpcPromise(_0x40247c,_0x5ad656,_0x46cfc3,_0x446a7b){return new BPromise(function(_0x4abd2e,_0x840577){var _0x1a1e04=_0x446a7b||client;return _0x1a1e04['request'](_0x40247c,_0x46cfc3)[_0x2222('0x18')](function(_0x40b677){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x5ad656,_0x2222('0x19'));logger[_0x2222('0x1a')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5ad656,_0x2222('0x19'),JSON[_0x2222('0x1b')](_0x40b677));if(_0x40b677[_0x2222('0x1c')]){if(_0x40b677[_0x2222('0x1c')][_0x2222('0x1d')]===0x1f4){logger[_0x2222('0x1c')](_0x2222('0x1e'),_0x5ad656,_0x40b677['error']['message']);return _0x840577(_0x40b677[_0x2222('0x1c')][_0x2222('0x1f')]);}logger[_0x2222('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0x5ad656,_0x40b677['error']['message']);return _0x4abd2e(_0x40b677[_0x2222('0x1c')][_0x2222('0x1f')]);}else{logger[_0x2222('0x20')](_0x2222('0x1e'),_0x5ad656,'request\x20sent');_0x4abd2e(_0x40b677[_0x2222('0x21')]['message']);}})[_0x2222('0x22')](function(_0x1f55a5){logger['error'](_0x2222('0x1e'),_0x5ad656,_0x1f55a5);_0x840577(_0x1f55a5);});});}function respondWithStatusCode(_0x3b33fa,_0x3bf94b){_0x3bf94b=_0x3bf94b||0xcc;return function(_0x1c632f){if(_0x1c632f){return _0x3b33fa['sendStatus'](_0x3bf94b);}return _0x3b33fa[_0x2222('0x23')](_0x3bf94b)['end']();};}function respondWithResult(_0x3315d0,_0x324194){_0x324194=_0x324194||0xc8;return function(_0x14443f){if(_0x14443f){return _0x3315d0['status'](_0x324194)[_0x2222('0x24')](_0x14443f);}};}function respondWithFilteredResult(_0x1c277c,_0x1bb479){return function(_0x3b20ec){if(_0x3b20ec){var _0x13872d=_0x3b20ec[_0x2222('0x25')],_0x2e736b=_0x1bb479[_0x2222('0x26')],_0x1b29a8=_0x1bb479['offset']+_0x1bb479['limit'],_0xb442e7;if(_0x1b29a8>=_0x13872d){_0x1b29a8=_0x13872d;_0xb442e7=0xc8;}else{_0xb442e7=0xce;}_0x1c277c[_0x2222('0x23')](_0xb442e7);return _0x1c277c['set'](_0x2222('0x27'),_0x2e736b+'-'+_0x1b29a8+'/'+_0x13872d)['json'](_0x3b20ec);}return null;};}function patchUpdates(_0x2a1010){return function(_0x17f340){try{jsonpatch[_0x2222('0x28')](_0x17f340,_0x2a1010,!![]);}catch(_0x5a47aa){return BPromise[_0x2222('0x29')](_0x5a47aa);}return _0x17f340[_0x2222('0x2a')]();};}function saveUpdates(_0x1dfec3,_0x4800e8){return function(_0x6b8024){if(_0x6b8024){return _0x6b8024['update'](_0x1dfec3)[_0x2222('0x18')](function(_0x455ec4){return _0x455ec4;});}return null;};}function removeEntity(_0x30b8f1,_0x4da124){return function(_0x3ddca9){if(_0x3ddca9){return _0x3ddca9[_0x2222('0x2b')]()[_0x2222('0x18')](function(){_0x30b8f1[_0x2222('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0b7d,_0x8c3a41){return function(_0x37f1d1){if(!_0x37f1d1){_0x1b0b7d[_0x2222('0x2c')](0x194);}return _0x37f1d1;};}function handleError(_0x58852b,_0x1babcc){_0x1babcc=_0x1babcc||0x1f4;return function(_0x477229){logger[_0x2222('0x1c')](_0x477229[_0x2222('0x2d')]);if(_0x477229['name']){delete _0x477229[_0x2222('0x2e')];}_0x58852b[_0x2222('0x23')](_0x1babcc)['send'](_0x477229);};}exports[_0x2222('0x2f')]=function(_0x3a8a52,_0x50c70f){var _0x4f7a93={},_0x2f31d8={},_0x4c1be3={'count':0x0,'rows':[]};var _0xd934ba=_[_0x2222('0x30')](db[_0x2222('0x31')]['rawAttributes'],function(_0x590ed7){return{'name':_0x590ed7[_0x2222('0x32')],'type':_0x590ed7['type']['key']};});_0x2f31d8[_0x2222('0x33')]=_[_0x2222('0x30')](_0xd934ba,_0x2222('0x2e'));_0x2f31d8[_0x2222('0x34')]=_[_0x2222('0x35')](_0x3a8a52[_0x2222('0x34')]);_0x2f31d8[_0x2222('0x36')]=_[_0x2222('0x37')](_0x2f31d8[_0x2222('0x33')],_0x2f31d8[_0x2222('0x34')]);_0x4f7a93[_0x2222('0x38')]=_['intersection'](_0x2f31d8[_0x2222('0x33')],qs[_0x2222('0x39')](_0x3a8a52[_0x2222('0x34')][_0x2222('0x39')]));_0x4f7a93[_0x2222('0x38')]=_0x4f7a93[_0x2222('0x38')][_0x2222('0x3a')]?_0x4f7a93[_0x2222('0x38')]:_0x2f31d8[_0x2222('0x33')];if(!_0x3a8a52[_0x2222('0x34')]['hasOwnProperty']('nolimit')){_0x4f7a93[_0x2222('0x3b')]=qs[_0x2222('0x3b')](_0x3a8a52[_0x2222('0x34')][_0x2222('0x3b')]);_0x4f7a93[_0x2222('0x26')]=qs[_0x2222('0x26')](_0x3a8a52['query'][_0x2222('0x26')]);}_0x4f7a93[_0x2222('0x3c')]=qs[_0x2222('0x3d')](_0x3a8a52[_0x2222('0x34')][_0x2222('0x3d')]);_0x4f7a93[_0x2222('0x3e')]=qs[_0x2222('0x36')](_[_0x2222('0x3f')](_0x3a8a52[_0x2222('0x34')],_0x2f31d8[_0x2222('0x36')]),_0xd934ba);if(_0x3a8a52[_0x2222('0x34')][_0x2222('0x40')]){_0x4f7a93[_0x2222('0x3e')]=_[_0x2222('0x41')](_0x4f7a93[_0x2222('0x3e')],{'$or':_[_0x2222('0x30')](_0xd934ba,function(_0xd1ea1c){if(_0xd1ea1c[_0x2222('0x42')]!==_0x2222('0x43')){var _0x17f81d={};_0x17f81d[_0xd1ea1c[_0x2222('0x2e')]]={'$like':'%'+_0x3a8a52['query'][_0x2222('0x40')]+'%'};return _0x17f81d;}})});}_0x4f7a93=_[_0x2222('0x41')]({},_0x4f7a93,_0x3a8a52[_0x2222('0x44')]);var _0x28cefc={'where':_0x4f7a93[_0x2222('0x3e')]};return db[_0x2222('0x31')][_0x2222('0x25')](_0x28cefc)[_0x2222('0x18')](function(_0x3e968b){_0x4c1be3[_0x2222('0x25')]=_0x3e968b;if(_0x3a8a52[_0x2222('0x34')][_0x2222('0x45')]){_0x4f7a93[_0x2222('0x46')]=[{'all':!![]}];}return db[_0x2222('0x31')]['findAll'](_0x4f7a93);})[_0x2222('0x18')](function(_0x4ccfc7){_0x4c1be3[_0x2222('0x47')]=_0x4ccfc7;return _0x4c1be3;})[_0x2222('0x18')](respondWithFilteredResult(_0x50c70f,_0x4f7a93))[_0x2222('0x22')](handleError(_0x50c70f,null));};exports[_0x2222('0x48')]=function(_0x5c23be,_0x4f12ba){var _0x40817c={'raw':![],'where':{'id':_0x5c23be['params']['id']}},_0x2415fe={};_0x2415fe[_0x2222('0x33')]=_[_0x2222('0x35')](db['ZohoConfiguration'][_0x2222('0x49')]);_0x2415fe[_0x2222('0x34')]=_['keys'](_0x5c23be[_0x2222('0x34')]);_0x2415fe[_0x2222('0x36')]=_[_0x2222('0x37')](_0x2415fe[_0x2222('0x33')],_0x2415fe[_0x2222('0x34')]);_0x40817c[_0x2222('0x38')]=_['intersection'](_0x2415fe[_0x2222('0x33')],qs[_0x2222('0x39')](_0x5c23be['query'][_0x2222('0x39')]));_0x40817c[_0x2222('0x38')]=_0x40817c[_0x2222('0x38')][_0x2222('0x3a')]?_0x40817c['attributes']:_0x2415fe[_0x2222('0x33')];if(_0x5c23be['query']['includeAll']){_0x40817c[_0x2222('0x46')]=[{'all':!![]}];}_0x40817c=_[_0x2222('0x41')]({},_0x40817c,_0x5c23be[_0x2222('0x44')]);return db[_0x2222('0x31')][_0x2222('0x4a')](_0x40817c)[_0x2222('0x18')](handleEntityNotFound(_0x4f12ba,null))[_0x2222('0x18')](respondWithResult(_0x4f12ba,null))[_0x2222('0x22')](handleError(_0x4f12ba,null));};exports[_0x2222('0x4b')]=function(_0x1288d7,_0x18571c){return db['ZohoConfiguration'][_0x2222('0x4b')](_0x1288d7[_0x2222('0x4c')],{})[_0x2222('0x18')](respondWithResult(_0x18571c,0xc9))[_0x2222('0x22')](handleError(_0x18571c,null));};exports['update']=function(_0x3951b3,_0xa23a0a){if(_0x3951b3[_0x2222('0x4c')]['id']){delete _0x3951b3[_0x2222('0x4c')]['id'];}return db[_0x2222('0x31')][_0x2222('0x4a')]({'where':{'id':_0x3951b3[_0x2222('0x4d')]['id']}})[_0x2222('0x18')](handleEntityNotFound(_0xa23a0a,null))[_0x2222('0x18')](saveUpdates(_0x3951b3['body'],null))['then'](respondWithResult(_0xa23a0a,null))[_0x2222('0x22')](handleError(_0xa23a0a,null));};exports[_0x2222('0x2b')]=function(_0x5da06e,_0x217c9d){return db[_0x2222('0x31')][_0x2222('0x4a')]({'where':{'id':_0x5da06e[_0x2222('0x4d')]['id']}})[_0x2222('0x18')](handleEntityNotFound(_0x217c9d,null))[_0x2222('0x18')](removeEntity(_0x217c9d,null))[_0x2222('0x22')](handleError(_0x217c9d,null));};exports[_0x2222('0x4e')]=function(_0x29a38d,_0x19dc10,_0x54af34){var _0x37fea1={};var _0x5f1a6a={};var _0x521533;var _0x4b786f;return db[_0x2222('0x31')][_0x2222('0x4f')]({'where':{'id':_0x29a38d[_0x2222('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19dc10,null))[_0x2222('0x18')](function(_0x422653){if(_0x422653){_0x521533=_0x422653;_0x5f1a6a[_0x2222('0x33')]=_['keys'](db['ZohoField'][_0x2222('0x49')]);_0x5f1a6a['query']=_[_0x2222('0x35')](_0x29a38d[_0x2222('0x34')]);_0x5f1a6a['filters']=_[_0x2222('0x37')](_0x5f1a6a[_0x2222('0x33')],_0x5f1a6a[_0x2222('0x34')]);_0x37fea1[_0x2222('0x38')]=_[_0x2222('0x37')](_0x5f1a6a[_0x2222('0x33')],qs[_0x2222('0x39')](_0x29a38d[_0x2222('0x34')][_0x2222('0x39')]));_0x37fea1[_0x2222('0x38')]=_0x37fea1[_0x2222('0x38')][_0x2222('0x3a')]?_0x37fea1[_0x2222('0x38')]:_0x5f1a6a['model'];_0x37fea1[_0x2222('0x3c')]=qs[_0x2222('0x3d')](_0x29a38d[_0x2222('0x34')][_0x2222('0x3d')]);_0x37fea1[_0x2222('0x3e')]=qs[_0x2222('0x36')](_[_0x2222('0x3f')](_0x29a38d['query'],_0x5f1a6a[_0x2222('0x36')]));if(_0x29a38d[_0x2222('0x34')][_0x2222('0x40')]){_0x37fea1['where']=_[_0x2222('0x41')](_0x37fea1[_0x2222('0x3e')],{'$or':_[_0x2222('0x30')](_0x37fea1[_0x2222('0x38')],function(_0x5dde52){var _0x3abf2f={};_0x3abf2f[_0x5dde52]={'$like':'%'+_0x29a38d[_0x2222('0x34')][_0x2222('0x40')]+'%'};return _0x3abf2f;})});}_0x37fea1=_[_0x2222('0x41')]({},_0x37fea1,_0x29a38d[_0x2222('0x44')]);return _0x521533['getFields'](_0x37fea1);}})[_0x2222('0x18')](function(_0xbd8afb){if(_0xbd8afb){_0x4b786f=_0xbd8afb[_0x2222('0x3a')];if(!_0x29a38d['query'][_0x2222('0x50')]('nolimit')){_0x37fea1[_0x2222('0x3b')]=qs['limit'](_0x29a38d[_0x2222('0x34')][_0x2222('0x3b')]);_0x37fea1[_0x2222('0x26')]=qs['offset'](_0x29a38d[_0x2222('0x34')][_0x2222('0x26')]);}return _0x521533['getFields'](_0x37fea1);}})[_0x2222('0x18')](function(_0x1aa9b0){if(_0x1aa9b0){return _0x1aa9b0?{'count':_0x4b786f,'rows':_0x1aa9b0}:null;}})[_0x2222('0x18')](respondWithResult(_0x19dc10,null))[_0x2222('0x22')](handleError(_0x19dc10,null));};exports[_0x2222('0x51')]=function(_0x3de95e,_0x56a56b,_0x24aa86){var _0x20835c={};var _0x53ac5a={};var _0x36c2bf;var _0x1531c4;return db[_0x2222('0x31')][_0x2222('0x4f')]({'where':{'id':_0x3de95e[_0x2222('0x4d')]['id']}})[_0x2222('0x18')](handleEntityNotFound(_0x56a56b,null))[_0x2222('0x18')](function(_0x54cc5f){if(_0x54cc5f){_0x36c2bf=_0x54cc5f;_0x53ac5a[_0x2222('0x33')]=_[_0x2222('0x35')](db[_0x2222('0x52')][_0x2222('0x49')]);_0x53ac5a[_0x2222('0x34')]=_[_0x2222('0x35')](_0x3de95e[_0x2222('0x34')]);_0x53ac5a[_0x2222('0x36')]=_[_0x2222('0x37')](_0x53ac5a['model'],_0x53ac5a[_0x2222('0x34')]);_0x20835c[_0x2222('0x38')]=_[_0x2222('0x37')](_0x53ac5a[_0x2222('0x33')],qs[_0x2222('0x39')](_0x3de95e['query']['fields']));_0x20835c['attributes']=_0x20835c[_0x2222('0x38')]['length']?_0x20835c[_0x2222('0x38')]:_0x53ac5a['model'];_0x20835c['order']=qs[_0x2222('0x3d')](_0x3de95e[_0x2222('0x34')]['sort']);_0x20835c[_0x2222('0x3e')]=qs[_0x2222('0x36')](_[_0x2222('0x3f')](_0x3de95e['query'],_0x53ac5a['filters']));if(_0x3de95e[_0x2222('0x34')][_0x2222('0x40')]){_0x20835c[_0x2222('0x3e')]=_[_0x2222('0x41')](_0x20835c[_0x2222('0x3e')],{'$or':_['map'](_0x20835c[_0x2222('0x38')],function(_0x5d287b){var _0x555139={};_0x555139[_0x5d287b]={'$like':'%'+_0x3de95e[_0x2222('0x34')]['filter']+'%'};return _0x555139;})});}_0x20835c=_[_0x2222('0x41')]({},_0x20835c,_0x3de95e[_0x2222('0x44')]);return _0x36c2bf[_0x2222('0x51')](_0x20835c);}})['then'](function(_0x537889){if(_0x537889){_0x1531c4=_0x537889[_0x2222('0x3a')];if(!_0x3de95e[_0x2222('0x34')]['hasOwnProperty'](_0x2222('0x53'))){_0x20835c[_0x2222('0x3b')]=qs[_0x2222('0x3b')](_0x3de95e['query'][_0x2222('0x3b')]);_0x20835c['offset']=qs['offset'](_0x3de95e['query']['offset']);}return _0x36c2bf[_0x2222('0x51')](_0x20835c);}})[_0x2222('0x18')](function(_0x131785){if(_0x131785){return _0x131785?{'count':_0x1531c4,'rows':_0x131785}:null;}})[_0x2222('0x18')](respondWithResult(_0x56a56b,null))[_0x2222('0x22')](handleError(_0x56a56b,null));};exports[_0x2222('0x54')]=function(_0x12e895,_0x49607a,_0x156391){var _0xf98989={};var _0x29d91f={};var _0x473ca8;var _0x2f21a9;return db[_0x2222('0x31')]['findOne']({'where':{'id':_0x12e895[_0x2222('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49607a,null))[_0x2222('0x18')](function(_0x5f066d){if(_0x5f066d){_0x473ca8=_0x5f066d;_0x29d91f[_0x2222('0x33')]=_[_0x2222('0x35')](db[_0x2222('0x52')]['rawAttributes']);_0x29d91f[_0x2222('0x34')]=_[_0x2222('0x35')](_0x12e895[_0x2222('0x34')]);_0x29d91f[_0x2222('0x36')]=_[_0x2222('0x37')](_0x29d91f[_0x2222('0x33')],_0x29d91f[_0x2222('0x34')]);_0xf98989[_0x2222('0x38')]=_[_0x2222('0x37')](_0x29d91f[_0x2222('0x33')],qs[_0x2222('0x39')](_0x12e895[_0x2222('0x34')][_0x2222('0x39')]));_0xf98989[_0x2222('0x38')]=_0xf98989[_0x2222('0x38')][_0x2222('0x3a')]?_0xf98989[_0x2222('0x38')]:_0x29d91f[_0x2222('0x33')];_0xf98989['order']=qs[_0x2222('0x3d')](_0x12e895[_0x2222('0x34')][_0x2222('0x3d')]);_0xf98989[_0x2222('0x3e')]=qs[_0x2222('0x36')](_[_0x2222('0x3f')](_0x12e895[_0x2222('0x34')],_0x29d91f[_0x2222('0x36')]));if(_0x12e895[_0x2222('0x34')][_0x2222('0x40')]){_0xf98989[_0x2222('0x3e')]=_[_0x2222('0x41')](_0xf98989['where'],{'$or':_[_0x2222('0x30')](_0xf98989[_0x2222('0x38')],function(_0x51d6c8){var _0x4dee30={};_0x4dee30[_0x51d6c8]={'$like':'%'+_0x12e895['query'][_0x2222('0x40')]+'%'};return _0x4dee30;})});}_0xf98989=_[_0x2222('0x41')]({},_0xf98989,_0x12e895[_0x2222('0x44')]);return _0x473ca8['getDescriptions'](_0xf98989);}})['then'](function(_0x332be2){if(_0x332be2){_0x2f21a9=_0x332be2[_0x2222('0x3a')];if(!_0x12e895[_0x2222('0x34')][_0x2222('0x50')](_0x2222('0x53'))){_0xf98989['limit']=qs[_0x2222('0x3b')](_0x12e895[_0x2222('0x34')]['limit']);_0xf98989['offset']=qs[_0x2222('0x26')](_0x12e895['query'][_0x2222('0x26')]);}return _0x473ca8[_0x2222('0x54')](_0xf98989);}})[_0x2222('0x18')](function(_0x11fb42){if(_0x11fb42){return _0x11fb42?{'count':_0x2f21a9,'rows':_0x11fb42}:null;}})[_0x2222('0x18')](respondWithResult(_0x49607a,null))[_0x2222('0x22')](handleError(_0x49607a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index cbbc327..b9d03bf 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 _0x5e86=['define','ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x42e14a,_0x48f51c){var _0x40a489=function(_0x5997c4){while(--_0x5997c4){_0x42e14a['push'](_0x42e14a['shift']());}};_0x40a489(++_0x48f51c);}(_0x5e86,0x147));var _0x65e8=function(_0x41c4bc,_0x427bf8){_0x41c4bc=_0x41c4bc-0x0;var _0x5c5c3c=_0x5e86[_0x41c4bc];return _0x5c5c3c;};'use strict';var _=require(_0x65e8('0x0'));var util=require(_0x65e8('0x1'));var logger=require(_0x65e8('0x2'))(_0x65e8('0x3'));var moment=require(_0x65e8('0x4'));var BPromise=require(_0x65e8('0x5'));var rp=require(_0x65e8('0x6'));var fs=require('fs');var path=require(_0x65e8('0x7'));var rimraf=require(_0x65e8('0x8'));var config=require('../../config/environment');var attributes=require(_0x65e8('0x9'));module[_0x65e8('0xa')]=function(_0xb7a1bd,_0xc90036){return _0xb7a1bd[_0x65e8('0xb')](_0x65e8('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4735=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x5392c3,_0x148af1){var _0x31f1d4=function(_0x3df335){while(--_0x3df335){_0x5392c3['push'](_0x5392c3['shift']());}};_0x31f1d4(++_0x148af1);}(_0x4735,0xec));var _0x5473=function(_0xa2c51c,_0x98ad95){_0xa2c51c=_0xa2c51c-0x0;var _0x2f5401=_0x4735[_0xa2c51c];return _0x2f5401;};'use strict';var _=require(_0x5473('0x0'));var util=require(_0x5473('0x1'));var logger=require(_0x5473('0x2'))(_0x5473('0x3'));var moment=require(_0x5473('0x4'));var BPromise=require(_0x5473('0x5'));var rp=require(_0x5473('0x6'));var fs=require('fs');var path=require(_0x5473('0x7'));var rimraf=require(_0x5473('0x8'));var config=require(_0x5473('0x9'));var attributes=require(_0x5473('0xa'));module[_0x5473('0xb')]=function(_0x18c9b0,_0xa8286d){return _0x18c9b0[_0x5473('0xc')](_0x5473('0xd'),attributes,{'tableName':_0x5473('0xe'),'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 65b155f..82c6355 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 _0x8217=['stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x208475,_0x397b0f){var _0x5432c8=function(_0xb561d){while(--_0xb561d){_0x208475['push'](_0x208475['shift']());}};_0x5432c8(++_0x397b0f);}(_0x8217,0x1e9));var _0x7821=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x8217[_0x46b22a];return _0x44c2e8;};'use strict';var _=require(_0x7821('0x0'));var util=require(_0x7821('0x1'));var moment=require(_0x7821('0x2'));var BPromise=require(_0x7821('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7821('0x4'))['db'];var utils=require(_0x7821('0x5'));var logger=require(_0x7821('0x6'))('rpc');var config=require(_0x7821('0x7'));var jayson=require(_0x7821('0x8'));var client=jayson[_0x7821('0x9')][_0x7821('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51aa46,_0x4db8da,_0x379139){return new BPromise(function(_0x195217,_0x4696c7){return client[_0x7821('0xb')](_0x51aa46,_0x379139)['then'](function(_0x59aae6){logger[_0x7821('0xc')](_0x7821('0xd'),_0x4db8da,_0x7821('0xe'));logger[_0x7821('0xf')](_0x7821('0x10'),_0x4db8da,_0x7821('0xe'),JSON[_0x7821('0x11')](_0x59aae6));if(_0x59aae6['error']){if(_0x59aae6['error']['code']===0x1f4){logger[_0x7821('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4db8da,_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);return _0x4696c7(_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);}logger[_0x7821('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4db8da,_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);return _0x195217(_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);}else{logger[_0x7821('0xc')](_0x7821('0xd'),_0x4db8da,_0x7821('0xe'));_0x195217(_0x59aae6[_0x7821('0x14')]['message']);}})[_0x7821('0x15')](function(_0x51d3a6){logger[_0x7821('0x12')](_0x7821('0xd'),_0x4db8da,_0x51d3a6);_0x4696c7(_0x51d3a6);});});} \ No newline at end of file +var _0x27bb=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30a231,_0x59ec45){var _0x2e947c=function(_0x58200e){while(--_0x58200e){_0x30a231['push'](_0x30a231['shift']());}};_0x2e947c(++_0x59ec45);}(_0x27bb,0x1d6));var _0xb27b=function(_0x2d86a2,_0x303ebd){_0x2d86a2=_0x2d86a2-0x0;var _0x4bb98f=_0x27bb[_0x2d86a2];return _0x4bb98f;};'use strict';var _=require('lodash');var util=require(_0xb27b('0x0'));var moment=require(_0xb27b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb27b('0x2'));var fs=require('fs');var Redis=require(_0xb27b('0x3'));var db=require(_0xb27b('0x4'))['db'];var utils=require(_0xb27b('0x5'));var logger=require('../../config/logger')(_0xb27b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34d817,_0x2c7d80,_0x540116){return new BPromise(function(_0x246364,_0x1ac125){return client['request'](_0x34d817,_0x540116)['then'](function(_0x1c536b){logger['info'](_0xb27b('0x7'),_0x2c7d80,_0xb27b('0x8'));logger[_0xb27b('0x9')](_0xb27b('0xa'),_0x2c7d80,_0xb27b('0x8'),JSON['stringify'](_0x1c536b));if(_0x1c536b[_0xb27b('0xb')]){if(_0x1c536b[_0xb27b('0xb')]['code']===0x1f4){logger[_0xb27b('0xb')](_0xb27b('0x7'),_0x2c7d80,_0x1c536b['error'][_0xb27b('0xc')]);return _0x1ac125(_0x1c536b[_0xb27b('0xb')][_0xb27b('0xc')]);}logger[_0xb27b('0xb')](_0xb27b('0x7'),_0x2c7d80,_0x1c536b[_0xb27b('0xb')][_0xb27b('0xc')]);return _0x246364(_0x1c536b[_0xb27b('0xb')]['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x2c7d80,'request\x20sent');_0x246364(_0x1c536b[_0xb27b('0xd')][_0xb27b('0xc')]);}})[_0xb27b('0xe')](function(_0x5ef024){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2c7d80,_0x5ef024);_0x1ac125(_0x5ef024);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 00752f3..f689d21 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 _0x1a37=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','update','delete','destroy','exports'];(function(_0x595dac,_0x57e06b){var _0x38bb67=function(_0x14bb7b){while(--_0x14bb7b){_0x595dac['push'](_0x595dac['shift']());}};_0x38bb67(++_0x57e06b);}(_0x1a37,0xb4));var _0x71a3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x1a37[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var auth=require(_0x71a3('0x6'));var interaction=require(_0x71a3('0x7'));var config=require(_0x71a3('0x8'));var controller=require(_0x71a3('0x9'));router['get']('/',auth[_0x71a3('0xa')](),controller['index']);router[_0x71a3('0xb')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xe')]);router[_0x71a3('0xf')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0x10')]);module[_0x71a3('0x11')]=router; \ No newline at end of file +var _0xcf2f=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x4b0a80,_0x50a8a3){_0x4b0a80=_0x4b0a80-0x0;var _0x20f3bf=_0xcf2f[_0x4b0a80];return _0x20f3bf;};'use strict';var multer=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var path=require(_0xfcf2('0x2'));var timeout=require(_0xfcf2('0x3'));var express=require(_0xfcf2('0x4'));var router=express['Router']();var auth=require(_0xfcf2('0x5'));var interaction=require(_0xfcf2('0x6'));var config=require(_0xfcf2('0x7'));var controller=require(_0xfcf2('0x8'));router[_0xfcf2('0x9')]('/',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xb')]);router[_0xfcf2('0x9')](_0xfcf2('0xc'),auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xd')]);router[_0xfcf2('0xe')]('/',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfcf2('0x10')]);router[_0xfcf2('0x11')]('/:id',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0x12')]);module[_0xfcf2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 85c5e4f..7a0587a 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 _0x3e74=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','STRING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x3e74,0x175));var _0x43e7=function(_0x58402b,_0x31824b){_0x58402b=_0x58402b-0x0;var _0x4d1664=_0x3e74[_0x58402b];return _0x4d1664;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'type':{'type':Sequelize[_0x43e7('0x1')](_0x43e7('0x2'),_0x43e7('0x3'),'customVariable','keyValue'),'defaultValue':_0x43e7('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x43e7('0x4')]},'keyType':{'type':Sequelize[_0x43e7('0x1')](_0x43e7('0x2'),_0x43e7('0x3'),_0x43e7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x43e7('0x4')]},'nameField':{'type':Sequelize[_0x43e7('0x4')]},'customField':{'type':Sequelize[_0x43e7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43e7('0x4')]}}; \ No newline at end of file +var _0x4784=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x508ea7,_0x104766){var _0x4b14c2=function(_0x33c4ea){while(--_0x33c4ea){_0x508ea7['push'](_0x508ea7['shift']());}};_0x4b14c2(++_0x104766);}(_0x4784,0xe4));var _0x4478=function(_0x4b2741,_0x45ed3b){_0x4b2741=_0x4b2741-0x0;var _0x4d6ecc=_0x4784[_0x4b2741];return _0x4d6ecc;};'use strict';var Sequelize=require(_0x4478('0x0'));module[_0x4478('0x1')]={'type':{'type':Sequelize[_0x4478('0x2')](_0x4478('0x3'),_0x4478('0x4'),_0x4478('0x5'),'keyValue'),'defaultValue':_0x4478('0x3')},'content':{'type':Sequelize[_0x4478('0x6')]},'key':{'type':Sequelize[_0x4478('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4478('0x3'),'variable',_0x4478('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4478('0x6')]},'nameField':{'type':Sequelize[_0x4478('0x6')]},'customField':{'type':Sequelize[_0x4478('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4478('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 50862b9..6b6177a 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(_0x25bc7b,_0x1584e1){var _0x3c8d72=function(_0x3b9c63){while(--_0x3b9c63){_0x25bc7b['push'](_0x25bc7b['shift']());}};_0x3c8d72(++_0x1584e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x2d818b,_0x3f2c79){var _0x3798a9=function(_0x265854){while(--_0x265854){_0x2d818b['push'](_0x2d818b['shift']());}};_0x3798a9(++_0x3f2c79);}(_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));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 8e16182..68d9606 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 _0xc39c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x2393c0,_0x5d5d61){var _0x188aa9=function(_0x330de9){while(--_0x330de9){_0x2393c0['push'](_0x2393c0['shift']());}};_0x188aa9(++_0x5d5d61);}(_0xc39c,0xfb));var _0xcc39=function(_0x18bbce,_0x176b3b){_0x18bbce=_0x18bbce-0x0;var _0x41e909=_0xc39c[_0x18bbce];return _0x41e909;};'use strict';var _=require(_0xcc39('0x0'));var util=require(_0xcc39('0x1'));var logger=require(_0xcc39('0x2'))(_0xcc39('0x3'));var moment=require(_0xcc39('0x4'));var BPromise=require(_0xcc39('0x5'));var rp=require(_0xcc39('0x6'));var fs=require('fs');var path=require(_0xcc39('0x7'));var rimraf=require(_0xcc39('0x8'));var config=require(_0xcc39('0x9'));var attributes=require(_0xcc39('0xa'));module[_0xcc39('0xb')]=function(_0x100dd3,_0x4ae3c4){return _0x100dd3[_0xcc39('0xc')](_0xcc39('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xcc39('0xe'),'fields':[_0xcc39('0xf'),_0xcc39('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe061=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports'];(function(_0x3e85e3,_0x15470e){var _0x184ba1=function(_0x3838bf){while(--_0x3838bf){_0x3e85e3['push'](_0x3e85e3['shift']());}};_0x184ba1(++_0x15470e);}(_0xe061,0x157));var _0x1e06=function(_0x41a247,_0x2b9560){_0x41a247=_0x41a247-0x0;var _0x4a313b=_0xe061[_0x41a247];return _0x4a313b;};'use strict';var _=require(_0x1e06('0x0'));var util=require(_0x1e06('0x1'));var logger=require(_0x1e06('0x2'))(_0x1e06('0x3'));var moment=require('moment');var BPromise=require(_0x1e06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e06('0x5'));var rimraf=require(_0x1e06('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x1e06('0x7')]=function(_0x7f829,_0x5a28b4){return _0x7f829['define'](_0x1e06('0x8'),attributes,{'tableName':_0x1e06('0x9'),'paranoid':![],'indexes':[{'name':_0x1e06('0xa'),'fields':[_0x1e06('0xb'),_0x1e06('0xc')],'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 3853c34..398b5e7 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ff1cd,_0x163edf){var _0x10001d=function(_0x2a9dc9){while(--_0x2a9dc9){_0x3ff1cd['push'](_0x3ff1cd['shift']());}};_0x10001d(++_0x163edf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('ZohoField,\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);});});} \ No newline at end of file +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xc15b70,_0x461d10){var _0x178f88=function(_0x3230fa){while(--_0x3230fa){_0xc15b70['push'](_0xc15b70['shift']());}};_0x178f88(++_0x461d10);}(_0x84ab,0x12f));var _0xb84a=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x84ab[_0x1098db];return _0x14f090;};'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']('ZohoField,\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')]('ZohoField,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 381e6af..2f8d863 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 _0xf75b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0xf75b,0x1f4));var _0xbf75=function(_0xc9ffba,_0x14f0ff){_0xc9ffba=_0xc9ffba-0x0;var _0x18e98e=_0xf75b[_0xc9ffba];return _0x18e98e;};'use strict';var multer=require(_0xbf75('0x0'));var util=require(_0xbf75('0x1'));var path=require(_0xbf75('0x2'));var timeout=require(_0xbf75('0x3'));var express=require('express');var router=express[_0xbf75('0x4')]();var auth=require(_0xbf75('0x5'));var interaction=require(_0xbf75('0x6'));var config=require(_0xbf75('0x7'));module[_0xbf75('0x8')]=router; \ No newline at end of file +var _0x5688=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5688,0x199));var _0x8568=function(_0x323bf6,_0x19aed6){_0x323bf6=_0x323bf6-0x0;var _0x18da88=_0x5688[_0x323bf6];return _0x18da88;};'use strict';var multer=require(_0x8568('0x0'));var util=require(_0x8568('0x1'));var path=require(_0x8568('0x2'));var timeout=require(_0x8568('0x3'));var express=require(_0x8568('0x4'));var router=express[_0x8568('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8568('0x6'));var config=require(_0x8568('0x7'));module[_0x8568('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ff538c5..ddcdcf1 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 _0x86e9=['state','sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x86e9,0x158));var _0x986e=function(_0x3d09e2,_0x58e784){_0x3d09e2=_0x3d09e2-0x0;var _0x5d03cd=_0x86e9[_0x3d09e2];return _0x5d03cd;};'use strict';var Sequelize=require(_0x986e('0x0'));module[_0x986e('0x1')]={'name':{'type':Sequelize[_0x986e('0x2')],'allowNull':![],'unique':_0x986e('0x3')},'version':{'type':Sequelize[_0x986e('0x2')],'allowNull':![],'unique':_0x986e('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x986e('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x986e('0x4')]},'active':{'type':Sequelize[_0x986e('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x986e('0x2')]},'logo':{'type':Sequelize[_0x986e('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x986e('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x986e('0x2')]},'link':{'type':Sequelize[_0x986e('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x464c=['BOOLEAN','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x5a346f,_0x3baf33){var _0x149c19=function(_0x3f2743){while(--_0x3f2743){_0x5a346f['push'](_0x5a346f['shift']());}};_0x149c19(++_0x3baf33);}(_0x464c,0x1db));var _0xc464=function(_0x11314c,_0x2ca8d7){_0x11314c=_0x11314c-0x0;var _0x12cb4a=_0x464c[_0x11314c];return _0x12cb4a;};'use strict';var Sequelize=require(_0xc464('0x0'));module[_0xc464('0x1')]={'name':{'type':Sequelize[_0xc464('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xc464('0x2')],'allowNull':![],'unique':_0xc464('0x3')},'main':{'type':Sequelize[_0xc464('0x2')],'defaultValue':_0xc464('0x4')},'filename':{'type':Sequelize[_0xc464('0x2')]},'path':{'type':Sequelize[_0xc464('0x2')]},'type':{'type':Sequelize[_0xc464('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xc464('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc464('0x2')]},'logo':{'type':Sequelize[_0xc464('0x2')]},'state':{'type':Sequelize[_0xc464('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xc464('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc464('0x2')]},'link':{'type':Sequelize[_0xc464('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 3ebb1c2..e880362 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 _0x0537=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','Integration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0537,0x8c));var _0x7053=function(_0x31080a,_0x55b5cd){_0x31080a=_0x31080a-0x0;var _0x58d2fc=_0x0537[_0x31080a];return _0x58d2fc;};'use strict';var pdf=require(_0x7053('0x0'));var emlformat=require(_0x7053('0x1'));var rimraf=require(_0x7053('0x2'));var zipdir=require(_0x7053('0x3'));var jsonpatch=require(_0x7053('0x4'));var rp=require(_0x7053('0x5'));var moment=require(_0x7053('0x6'));var BPromise=require(_0x7053('0x7'));var Mustache=require(_0x7053('0x8'));var util=require(_0x7053('0x9'));var path=require(_0x7053('0xa'));var sox=require(_0x7053('0xb'));var csv=require(_0x7053('0xc'));var ejs=require(_0x7053('0xd'));var fs=require('fs');var _=require(_0x7053('0xe'));var squel=require(_0x7053('0xf'));var crypto=require(_0x7053('0x10'));var jsforce=require(_0x7053('0x11'));var deskjs=require(_0x7053('0x12'));var toCsv=require(_0x7053('0xc'));var querystring=require(_0x7053('0x13'));var Papa=require(_0x7053('0x14'));var Redis=require(_0x7053('0x15'));var authService=require(_0x7053('0x16'));var qs=require(_0x7053('0x17'));var as=require(_0x7053('0x18'));var hardwareService=require(_0x7053('0x19'));var logger=require(_0x7053('0x1a'))('api');var utils=require(_0x7053('0x1b'));var config=require(_0x7053('0x1c'));var db=require(_0x7053('0x1d'))['db'];function respondWithStatusCode(_0x44dc5c,_0x4ec669){_0x4ec669=_0x4ec669||0xcc;return function(_0x410a4b){if(_0x410a4b){return _0x44dc5c['sendStatus'](_0x4ec669);}return _0x44dc5c[_0x7053('0x1e')](_0x4ec669)['end']();};}function respondWithResult(_0x1946fa,_0x150939){_0x150939=_0x150939||0xc8;return function(_0x39fa9d){if(_0x39fa9d){return _0x1946fa[_0x7053('0x1e')](_0x150939)[_0x7053('0x1f')](_0x39fa9d);}};}function respondWithFilteredResult(_0x170c0b,_0x99faa1){return function(_0x464051){if(_0x464051){var _0xa71fbb=_0x464051[_0x7053('0x20')],_0x305912=_0x99faa1[_0x7053('0x21')],_0x1c205a=_0x99faa1[_0x7053('0x21')]+_0x99faa1[_0x7053('0x22')],_0x4a529a;if(_0x1c205a>=_0xa71fbb){_0x1c205a=_0xa71fbb;_0x4a529a=0xc8;}else{_0x4a529a=0xce;}_0x170c0b[_0x7053('0x1e')](_0x4a529a);return _0x170c0b[_0x7053('0x23')](_0x7053('0x24'),_0x305912+'-'+_0x1c205a+'/'+_0xa71fbb)[_0x7053('0x1f')](_0x464051);}return null;};}function patchUpdates(_0x3397e9){return function(_0x129990){try{jsonpatch[_0x7053('0x25')](_0x129990,_0x3397e9,!![]);}catch(_0x50fa62){return BPromise[_0x7053('0x26')](_0x50fa62);}return _0x129990[_0x7053('0x27')]();};}function saveUpdates(_0x399aa9,_0x3a93a4){return function(_0x5a2df6){if(_0x5a2df6){return _0x5a2df6[_0x7053('0x28')](_0x399aa9)[_0x7053('0x29')](function(_0x2a5bc8){return _0x2a5bc8;});}return null;};}function removeEntity(_0x15217a,_0x49d285){return function(_0x13a8e1){if(_0x13a8e1){return _0x13a8e1[_0x7053('0x2a')]()[_0x7053('0x29')](function(){_0x15217a[_0x7053('0x1e')](0xcc)[_0x7053('0x2b')]();});}};}function handleEntityNotFound(_0x5d8d24,_0x5bcb9e){return function(_0xf64b48){if(!_0xf64b48){_0x5d8d24['sendStatus'](0x194);}return _0xf64b48;};}function handleError(_0x46deab,_0x2a42d4){_0x2a42d4=_0x2a42d4||0x1f4;return function(_0x1645b3){logger[_0x7053('0x2c')](_0x1645b3['stack']);if(_0x1645b3['name']){delete _0x1645b3[_0x7053('0x2d')];}_0x46deab[_0x7053('0x1e')](_0x2a42d4)['send'](_0x1645b3);};}exports[_0x7053('0x2e')]=function(_0x4ec9be,_0x9e3297){var _0x387a92={},_0xd78957={},_0x3172ab={'count':0x0,'rows':[]};var _0x228215=_[_0x7053('0x2f')](db[_0x7053('0x30')][_0x7053('0x31')],function(_0xdfcd2f){return{'name':_0xdfcd2f[_0x7053('0x32')],'type':_0xdfcd2f[_0x7053('0x33')][_0x7053('0x34')]};});_0xd78957[_0x7053('0x35')]=_[_0x7053('0x2f')](_0x228215,_0x7053('0x2d'));_0xd78957['query']=_[_0x7053('0x36')](_0x4ec9be[_0x7053('0x37')]);_0xd78957['filters']=_[_0x7053('0x38')](_0xd78957['model'],_0xd78957[_0x7053('0x37')]);_0x387a92[_0x7053('0x39')]=_['intersection'](_0xd78957[_0x7053('0x35')],qs[_0x7053('0x3a')](_0x4ec9be[_0x7053('0x37')][_0x7053('0x3a')]));_0x387a92[_0x7053('0x39')]=_0x387a92[_0x7053('0x39')]['length']?_0x387a92[_0x7053('0x39')]:_0xd78957['model'];if(!_0x4ec9be['query']['hasOwnProperty'](_0x7053('0x3b'))){_0x387a92[_0x7053('0x22')]=qs['limit'](_0x4ec9be[_0x7053('0x37')][_0x7053('0x22')]);_0x387a92['offset']=qs[_0x7053('0x21')](_0x4ec9be[_0x7053('0x37')][_0x7053('0x21')]);}_0x387a92[_0x7053('0x3c')]=qs[_0x7053('0x3d')](_0x4ec9be['query'][_0x7053('0x3d')]);_0x387a92[_0x7053('0x3e')]=qs['filters'](_[_0x7053('0x3f')](_0x4ec9be[_0x7053('0x37')],_0xd78957[_0x7053('0x40')]),_0x228215);if(_0x4ec9be['query'][_0x7053('0x41')]){_0x387a92[_0x7053('0x3e')]=_[_0x7053('0x42')](_0x387a92[_0x7053('0x3e')],{'$or':_[_0x7053('0x2f')](_0x228215,function(_0x4a3b0d){if(_0x4a3b0d[_0x7053('0x33')]!==_0x7053('0x43')){var _0x47bfa2={};_0x47bfa2[_0x4a3b0d[_0x7053('0x2d')]]={'$like':'%'+_0x4ec9be[_0x7053('0x37')][_0x7053('0x41')]+'%'};return _0x47bfa2;}})});}_0x387a92=_[_0x7053('0x42')]({},_0x387a92,_0x4ec9be[_0x7053('0x44')]);var _0x38d339={'where':_0x387a92[_0x7053('0x3e')]};return db['Integration'][_0x7053('0x20')](_0x38d339)['then'](function(_0xc8a05f){_0x3172ab['count']=_0xc8a05f;if(_0x4ec9be['query'][_0x7053('0x45')]){_0x387a92[_0x7053('0x46')]=[{'all':!![]}];}return db[_0x7053('0x30')][_0x7053('0x47')](_0x387a92);})[_0x7053('0x29')](function(_0x2be3e2){_0x3172ab[_0x7053('0x48')]=_0x2be3e2;return _0x3172ab;})[_0x7053('0x29')](respondWithFilteredResult(_0x9e3297,_0x387a92))['catch'](handleError(_0x9e3297,null));};exports[_0x7053('0x49')]=function(_0x575110,_0x163388){var _0x46ccfb={'raw':![],'where':{'id':_0x575110[_0x7053('0x4a')]['id']}},_0x2223bf={};_0x2223bf[_0x7053('0x35')]=_['keys'](db['Integration']['rawAttributes']);_0x2223bf[_0x7053('0x37')]=_[_0x7053('0x36')](_0x575110['query']);_0x2223bf['filters']=_[_0x7053('0x38')](_0x2223bf[_0x7053('0x35')],_0x2223bf['query']);_0x46ccfb[_0x7053('0x39')]=_[_0x7053('0x38')](_0x2223bf[_0x7053('0x35')],qs[_0x7053('0x3a')](_0x575110[_0x7053('0x37')]['fields']));_0x46ccfb[_0x7053('0x39')]=_0x46ccfb[_0x7053('0x39')][_0x7053('0x4b')]?_0x46ccfb[_0x7053('0x39')]:_0x2223bf[_0x7053('0x35')];if(_0x575110[_0x7053('0x37')][_0x7053('0x45')]){_0x46ccfb[_0x7053('0x46')]=[{'all':!![]}];}_0x46ccfb=_[_0x7053('0x42')]({},_0x46ccfb,_0x575110[_0x7053('0x44')]);return db[_0x7053('0x30')][_0x7053('0x4c')](_0x46ccfb)['then'](handleEntityNotFound(_0x163388,null))[_0x7053('0x29')](respondWithResult(_0x163388,null))[_0x7053('0x4d')](handleError(_0x163388,null));};exports[_0x7053('0x4e')]=function(_0x20af07,_0x5c59e7){return db[_0x7053('0x30')][_0x7053('0x4e')](_0x20af07['body'],{})[_0x7053('0x29')](respondWithResult(_0x5c59e7,0xc9))[_0x7053('0x4d')](handleError(_0x5c59e7,null));};exports[_0x7053('0x28')]=function(_0xfe5499,_0x52557c){if(_0xfe5499[_0x7053('0x4f')]['id']){delete _0xfe5499['body']['id'];}return db[_0x7053('0x30')][_0x7053('0x4c')]({'where':{'id':_0xfe5499[_0x7053('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52557c,null))[_0x7053('0x29')](saveUpdates(_0xfe5499['body'],null))[_0x7053('0x29')](respondWithResult(_0x52557c,null))['catch'](handleError(_0x52557c,null));};exports[_0x7053('0x2a')]=function(_0x30d4b2,_0x2190c0){return db[_0x7053('0x30')][_0x7053('0x4c')]({'where':{'id':_0x30d4b2[_0x7053('0x4a')]['id']}})[_0x7053('0x29')](handleEntityNotFound(_0x2190c0,null))[_0x7053('0x29')](removeEntity(_0x2190c0,null))[_0x7053('0x4d')](handleError(_0x2190c0,null));}; \ No newline at end of file +var _0x8469=['name','index','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','map','VIRTUAL','merge','then','includeAll','include','findAll','catch','show','params','fields','length','create','body','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack'];(function(_0x2b6b92,_0x57303d){var _0x2233dc=function(_0x310e88){while(--_0x310e88){_0x2b6b92['push'](_0x2b6b92['shift']());}};_0x2233dc(++_0x57303d);}(_0x8469,0x142));var _0x9846=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x8469[_0xfd5f37];return _0x11bd01;};'use strict';var pdf=require(_0x9846('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9846('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9846('0x2'));var rp=require(_0x9846('0x3'));var moment=require(_0x9846('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9846('0x5'));var util=require(_0x9846('0x6'));var path=require(_0x9846('0x7'));var sox=require('sox');var csv=require(_0x9846('0x8'));var ejs=require(_0x9846('0x9'));var fs=require('fs');var _=require(_0x9846('0xa'));var squel=require(_0x9846('0xb'));var crypto=require(_0x9846('0xc'));var jsforce=require(_0x9846('0xd'));var deskjs=require(_0x9846('0xe'));var toCsv=require(_0x9846('0x8'));var querystring=require(_0x9846('0xf'));var Papa=require(_0x9846('0x10'));var Redis=require(_0x9846('0x11'));var authService=require(_0x9846('0x12'));var qs=require(_0x9846('0x13'));var as=require(_0x9846('0x14'));var hardwareService=require(_0x9846('0x15'));var logger=require('../../config/logger')(_0x9846('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9846('0x17'))['db'];function respondWithStatusCode(_0xa27500,_0x3bf234){_0x3bf234=_0x3bf234||0xcc;return function(_0x311f13){if(_0x311f13){return _0xa27500['sendStatus'](_0x3bf234);}return _0xa27500['status'](_0x3bf234)['end']();};}function respondWithResult(_0x3661f2,_0xeeef5c){_0xeeef5c=_0xeeef5c||0xc8;return function(_0x375c98){if(_0x375c98){return _0x3661f2[_0x9846('0x18')](_0xeeef5c)[_0x9846('0x19')](_0x375c98);}};}function respondWithFilteredResult(_0x3ad563,_0x261b43){return function(_0x3b4218){if(_0x3b4218){var _0x2047ea=_0x3b4218[_0x9846('0x1a')],_0x46b56b=_0x261b43[_0x9846('0x1b')],_0x42d678=_0x261b43[_0x9846('0x1b')]+_0x261b43['limit'],_0x5f4a5c;if(_0x42d678>=_0x2047ea){_0x42d678=_0x2047ea;_0x5f4a5c=0xc8;}else{_0x5f4a5c=0xce;}_0x3ad563[_0x9846('0x18')](_0x5f4a5c);return _0x3ad563[_0x9846('0x1c')](_0x9846('0x1d'),_0x46b56b+'-'+_0x42d678+'/'+_0x2047ea)[_0x9846('0x19')](_0x3b4218);}return null;};}function patchUpdates(_0x1ae27e){return function(_0x13064b){try{jsonpatch[_0x9846('0x1e')](_0x13064b,_0x1ae27e,!![]);}catch(_0x29d374){return BPromise[_0x9846('0x1f')](_0x29d374);}return _0x13064b[_0x9846('0x20')]();};}function saveUpdates(_0x522de5,_0x30579a){return function(_0x388d79){if(_0x388d79){return _0x388d79[_0x9846('0x21')](_0x522de5)['then'](function(_0x512805){return _0x512805;});}return null;};}function removeEntity(_0x152cc2,_0x573b08){return function(_0x4b558f){if(_0x4b558f){return _0x4b558f[_0x9846('0x22')]()['then'](function(){_0x152cc2[_0x9846('0x18')](0xcc)[_0x9846('0x23')]();});}};}function handleEntityNotFound(_0x46ad48,_0x33c2dd){return function(_0x1d8a63){if(!_0x1d8a63){_0x46ad48[_0x9846('0x24')](0x194);}return _0x1d8a63;};}function handleError(_0x39a397,_0x5bd682){_0x5bd682=_0x5bd682||0x1f4;return function(_0x3d9168){logger['error'](_0x3d9168[_0x9846('0x25')]);if(_0x3d9168[_0x9846('0x26')]){delete _0x3d9168['name'];}_0x39a397['status'](_0x5bd682)['send'](_0x3d9168);};}exports[_0x9846('0x27')]=function(_0x5d5c3f,_0x49b7ea){var _0x3325a3={},_0xf1e93f={},_0x186a44={'count':0x0,'rows':[]};var _0x3ffa2e=_['map'](db[_0x9846('0x28')][_0x9846('0x29')],function(_0x151b5b){return{'name':_0x151b5b['fieldName'],'type':_0x151b5b[_0x9846('0x2a')][_0x9846('0x2b')]};});_0xf1e93f[_0x9846('0x2c')]=_['map'](_0x3ffa2e,'name');_0xf1e93f[_0x9846('0x2d')]=_[_0x9846('0x2e')](_0x5d5c3f['query']);_0xf1e93f[_0x9846('0x2f')]=_[_0x9846('0x30')](_0xf1e93f[_0x9846('0x2c')],_0xf1e93f['query']);_0x3325a3[_0x9846('0x31')]=_[_0x9846('0x30')](_0xf1e93f['model'],qs['fields'](_0x5d5c3f[_0x9846('0x2d')]['fields']));_0x3325a3[_0x9846('0x31')]=_0x3325a3[_0x9846('0x31')]['length']?_0x3325a3['attributes']:_0xf1e93f[_0x9846('0x2c')];if(!_0x5d5c3f['query'][_0x9846('0x32')]('nolimit')){_0x3325a3['limit']=qs[_0x9846('0x33')](_0x5d5c3f[_0x9846('0x2d')][_0x9846('0x33')]);_0x3325a3[_0x9846('0x1b')]=qs[_0x9846('0x1b')](_0x5d5c3f[_0x9846('0x2d')][_0x9846('0x1b')]);}_0x3325a3[_0x9846('0x34')]=qs[_0x9846('0x35')](_0x5d5c3f['query'][_0x9846('0x35')]);_0x3325a3[_0x9846('0x36')]=qs['filters'](_[_0x9846('0x37')](_0x5d5c3f[_0x9846('0x2d')],_0xf1e93f[_0x9846('0x2f')]),_0x3ffa2e);if(_0x5d5c3f[_0x9846('0x2d')][_0x9846('0x38')]){_0x3325a3['where']=_['merge'](_0x3325a3['where'],{'$or':_[_0x9846('0x39')](_0x3ffa2e,function(_0x4f80a7){if(_0x4f80a7['type']!==_0x9846('0x3a')){var _0x33c9cf={};_0x33c9cf[_0x4f80a7[_0x9846('0x26')]]={'$like':'%'+_0x5d5c3f[_0x9846('0x2d')][_0x9846('0x38')]+'%'};return _0x33c9cf;}})});}_0x3325a3=_[_0x9846('0x3b')]({},_0x3325a3,_0x5d5c3f['options']);var _0x3a21ed={'where':_0x3325a3['where']};return db[_0x9846('0x28')]['count'](_0x3a21ed)[_0x9846('0x3c')](function(_0x1e85f2){_0x186a44[_0x9846('0x1a')]=_0x1e85f2;if(_0x5d5c3f['query'][_0x9846('0x3d')]){_0x3325a3[_0x9846('0x3e')]=[{'all':!![]}];}return db[_0x9846('0x28')][_0x9846('0x3f')](_0x3325a3);})[_0x9846('0x3c')](function(_0x481dfd){_0x186a44['rows']=_0x481dfd;return _0x186a44;})[_0x9846('0x3c')](respondWithFilteredResult(_0x49b7ea,_0x3325a3))[_0x9846('0x40')](handleError(_0x49b7ea,null));};exports[_0x9846('0x41')]=function(_0x27e0fc,_0x2f1f28){var _0x300e39={'raw':![],'where':{'id':_0x27e0fc[_0x9846('0x42')]['id']}},_0x3b7298={};_0x3b7298['model']=_[_0x9846('0x2e')](db[_0x9846('0x28')][_0x9846('0x29')]);_0x3b7298['query']=_[_0x9846('0x2e')](_0x27e0fc[_0x9846('0x2d')]);_0x3b7298['filters']=_[_0x9846('0x30')](_0x3b7298[_0x9846('0x2c')],_0x3b7298['query']);_0x300e39['attributes']=_[_0x9846('0x30')](_0x3b7298[_0x9846('0x2c')],qs[_0x9846('0x43')](_0x27e0fc[_0x9846('0x2d')][_0x9846('0x43')]));_0x300e39['attributes']=_0x300e39['attributes'][_0x9846('0x44')]?_0x300e39[_0x9846('0x31')]:_0x3b7298[_0x9846('0x2c')];if(_0x27e0fc[_0x9846('0x2d')][_0x9846('0x3d')]){_0x300e39[_0x9846('0x3e')]=[{'all':!![]}];}_0x300e39=_[_0x9846('0x3b')]({},_0x300e39,_0x27e0fc['options']);return db[_0x9846('0x28')]['find'](_0x300e39)['then'](handleEntityNotFound(_0x2f1f28,null))[_0x9846('0x3c')](respondWithResult(_0x2f1f28,null))['catch'](handleError(_0x2f1f28,null));};exports[_0x9846('0x45')]=function(_0x414e26,_0x448bde){return db[_0x9846('0x28')][_0x9846('0x45')](_0x414e26[_0x9846('0x46')],{})[_0x9846('0x3c')](respondWithResult(_0x448bde,0xc9))[_0x9846('0x40')](handleError(_0x448bde,null));};exports[_0x9846('0x21')]=function(_0xf69a15,_0x29f117){if(_0xf69a15[_0x9846('0x46')]['id']){delete _0xf69a15[_0x9846('0x46')]['id'];}return db[_0x9846('0x28')][_0x9846('0x47')]({'where':{'id':_0xf69a15[_0x9846('0x42')]['id']}})['then'](handleEntityNotFound(_0x29f117,null))[_0x9846('0x3c')](saveUpdates(_0xf69a15[_0x9846('0x46')],null))[_0x9846('0x3c')](respondWithResult(_0x29f117,null))['catch'](handleError(_0x29f117,null));};exports[_0x9846('0x22')]=function(_0x867765,_0x206888){return db['Integration'][_0x9846('0x47')]({'where':{'id':_0x867765['params']['id']}})[_0x9846('0x3c')](handleEntityNotFound(_0x206888,null))['then'](removeEntity(_0x206888,null))['catch'](handleError(_0x206888,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 62fab04..7a08cd8 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 _0x4f26=['integrations','util','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x493a89,_0x2f5fac){var _0x5be45c=function(_0x1147ed){while(--_0x1147ed){_0x493a89['push'](_0x493a89['shift']());}};_0x5be45c(++_0x2f5fac);}(_0x4f26,0xb1));var _0x64f2=function(_0x5b7525,_0x45f2cf){_0x5b7525=_0x5b7525-0x0;var _0xc8d580=_0x4f26[_0x5b7525];return _0xc8d580;};'use strict';var _=require('lodash');var util=require(_0x64f2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x64f2('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64f2('0x2'));var rimraf=require(_0x64f2('0x3'));var config=require(_0x64f2('0x4'));var attributes=require('./integration.attributes');module[_0x64f2('0x5')]=function(_0x1536ee,_0x3162b1){return _0x1536ee[_0x64f2('0x6')]('Integration',attributes,{'tableName':_0x64f2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f0a=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','api','moment','bluebird','path'];(function(_0x125ced,_0x2be672){var _0x1b0090=function(_0x419ee2){while(--_0x419ee2){_0x125ced['push'](_0x125ced['shift']());}};_0x1b0090(++_0x2be672);}(_0x9f0a,0x6f));var _0xa9f0=function(_0x38931e,_0x4553fd){_0x38931e=_0x38931e-0x0;var _0x47646e=_0x9f0a[_0x38931e];return _0x47646e;};'use strict';var _=require(_0xa9f0('0x0'));var util=require(_0xa9f0('0x1'));var logger=require('../../config/logger')(_0xa9f0('0x2'));var moment=require(_0xa9f0('0x3'));var BPromise=require(_0xa9f0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9f0('0x5'));var rimraf=require(_0xa9f0('0x6'));var config=require(_0xa9f0('0x7'));var attributes=require(_0xa9f0('0x8'));module[_0xa9f0('0x9')]=function(_0x4e1377,_0x5807bf){return _0x4e1377[_0xa9f0('0xa')](_0xa9f0('0xb'),attributes,{'tableName':_0xa9f0('0xc'),'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 51c6021..be8b1e1 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 _0xc92f=['request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0xc92f,0xf3));var _0xfc92=function(_0x13a986,_0x3dd901){_0x13a986=_0x13a986-0x0;var _0xb03d0a=_0xc92f[_0x13a986];return _0xb03d0a;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var moment=require('moment');var BPromise=require(_0xfc92('0x2'));var rs=require(_0xfc92('0x3'));var fs=require('fs');var Redis=require(_0xfc92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc92('0x5'));var logger=require(_0xfc92('0x6'))(_0xfc92('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc92('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x394026,_0x4e578a,_0xd80968){return new BPromise(function(_0x49db29,_0x432982){return client[_0xfc92('0x9')](_0x394026,_0xd80968)[_0xfc92('0xa')](function(_0x4f37f2){logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));logger['debug'](_0xfc92('0xe'),_0x4e578a,_0xfc92('0xd'),JSON[_0xfc92('0xf')](_0x4f37f2));if(_0x4f37f2[_0xfc92('0x10')]){if(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x11')]===0x1f4){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);return _0x432982(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);}logger['error']('Integration,\x20%s,\x20%s',_0x4e578a,_0x4f37f2['error'][_0xfc92('0x12')]);return _0x49db29(_0x4f37f2[_0xfc92('0x10')]['message']);}else{logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));_0x49db29(_0x4f37f2[_0xfc92('0x13')][_0xfc92('0x12')]);}})[_0xfc92('0x14')](function(_0x492d40){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x492d40);_0x432982(_0x492d40);});});} \ No newline at end of file +var _0xf50a=['info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf50a,0x1b8));var _0xaf50=function(_0x5f5df5,_0x2f41c8){_0x5f5df5=_0x5f5df5-0x0;var _0x511d12=_0xf50a[_0x5f5df5];return _0x511d12;};'use strict';var _=require('lodash');var util=require(_0xaf50('0x0'));var moment=require('moment');var BPromise=require(_0xaf50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf50('0x2'));var db=require(_0xaf50('0x3'))['db'];var utils=require(_0xaf50('0x4'));var logger=require('../../config/logger')(_0xaf50('0x5'));var config=require(_0xaf50('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaf50('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8805,_0x334b83,_0x1d9247){return new BPromise(function(_0x28375f,_0x5415dd){return client[_0xaf50('0x8')](_0x2b8805,_0x1d9247)[_0xaf50('0x9')](function(_0x3f433a){logger[_0xaf50('0xa')]('Integration,\x20%s,\x20%s',_0x334b83,'request\x20sent');logger['debug'](_0xaf50('0xb'),_0x334b83,_0xaf50('0xc'),JSON['stringify'](_0x3f433a));if(_0x3f433a[_0xaf50('0xd')]){if(_0x3f433a[_0xaf50('0xd')][_0xaf50('0xe')]===0x1f4){logger[_0xaf50('0xd')](_0xaf50('0xf'),_0x334b83,_0x3f433a[_0xaf50('0xd')][_0xaf50('0x10')]);return _0x5415dd(_0x3f433a['error'][_0xaf50('0x10')]);}logger[_0xaf50('0xd')](_0xaf50('0xf'),_0x334b83,_0x3f433a[_0xaf50('0xd')][_0xaf50('0x10')]);return _0x28375f(_0x3f433a['error'][_0xaf50('0x10')]);}else{logger['info'](_0xaf50('0xf'),_0x334b83,_0xaf50('0xc'));_0x28375f(_0x3f433a[_0xaf50('0x11')]['message']);}})['catch'](function(_0x1fcdb8){logger[_0xaf50('0xd')]('Integration,\x20%s,\x20%s',_0x334b83,_0x1fcdb8);_0x5415dd(_0x1fcdb8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 74a3219..fc31922 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 _0xab2d=['index','get','/:id','show','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated'];(function(_0x4be6a6,_0x184f2a){var _0x12100f=function(_0xc19615){while(--_0xc19615){_0x4be6a6['push'](_0x4be6a6['shift']());}};_0x12100f(++_0x184f2a);}(_0xab2d,0x85));var _0xdab2=function(_0x4420f6,_0x6db66c){_0x4420f6=_0x4420f6-0x0;var _0x24665d=_0xab2d[_0x4420f6];return _0x24665d;};'use strict';var multer=require(_0xdab2('0x0'));var util=require(_0xdab2('0x1'));var path=require(_0xdab2('0x2'));var timeout=require(_0xdab2('0x3'));var express=require(_0xdab2('0x4'));var router=express[_0xdab2('0x5')]();var auth=require(_0xdab2('0x6'));var interaction=require(_0xdab2('0x7'));var config=require(_0xdab2('0x8'));var controller=require(_0xdab2('0x9'));router['get']('/',auth[_0xdab2('0xa')](),controller[_0xdab2('0xb')]);router[_0xdab2('0xc')]('/describe',auth[_0xdab2('0xa')](),controller['describe']);router[_0xdab2('0xc')](_0xdab2('0xd'),auth['isAuthenticated'](),controller[_0xdab2('0xe')]);router['post']('/',auth[_0xdab2('0xa')](),controller['create']);router[_0xdab2('0xf')]('/:id',auth[_0xdab2('0xa')](),controller['update']);router['delete'](_0xdab2('0xd'),auth[_0xdab2('0xa')](),controller[_0xdab2('0x10')]);module[_0xdab2('0x11')]=router; \ No newline at end of file +var _0x24e4=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2455fc,_0x3636da){var _0x1012d6=function(_0x145047){while(--_0x145047){_0x2455fc['push'](_0x2455fc['shift']());}};_0x1012d6(++_0x3636da);}(_0x24e4,0x10e));var _0x424e=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x24e4[_0x310504];return _0x5b36d0;};'use strict';var multer=require(_0x424e('0x0'));var util=require(_0x424e('0x1'));var path=require(_0x424e('0x2'));var timeout=require(_0x424e('0x3'));var express=require(_0x424e('0x4'));var router=express[_0x424e('0x5')]();var auth=require(_0x424e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x424e('0x7'));var controller=require(_0x424e('0x8'));router[_0x424e('0x9')]('/',auth[_0x424e('0xa')](),controller[_0x424e('0xb')]);router[_0x424e('0x9')](_0x424e('0xc'),auth[_0x424e('0xa')](),controller[_0x424e('0xd')]);router['get'](_0x424e('0xe'),auth['isAuthenticated'](),controller[_0x424e('0xf')]);router[_0x424e('0x10')]('/',auth['isAuthenticated'](),controller[_0x424e('0x11')]);router['put'](_0x424e('0xe'),auth[_0x424e('0xa')](),controller[_0x424e('0x12')]);router[_0x424e('0x13')]('/:id',auth[_0x424e('0xa')](),controller[_0x424e('0x14')]);module[_0x424e('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 41cb446..c04c1f7 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 _0x817c=['RECEIVED','FAILED','STRING','BOOLEAN','INTEGER','DATE','TEXT','ENUM','SENT'];(function(_0x5db242,_0x5bbcf6){var _0x59b7ce=function(_0x10f84a){while(--_0x10f84a){_0x5db242['push'](_0x5db242['shift']());}};_0x59b7ce(++_0x5bbcf6);}(_0x817c,0xad));var _0xc817=function(_0x59d438,_0x49e538){_0x59d438=_0x59d438-0x0;var _0x4cde6b=_0x817c[_0x59d438];return _0x4cde6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xc817('0x0')]},'exitStatus':{'type':Sequelize[_0xc817('0x0')]},'ticketId':{'type':Sequelize[_0xc817('0x0')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xc817('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc817('0x0')]},'calleridname':{'type':Sequelize[_0xc817('0x0')]},'queue':{'type':Sequelize[_0xc817('0x0')]},'interface':{'type':Sequelize[_0xc817('0x0')]},'membername':{'type':Sequelize[_0xc817('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xc817('0x1')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc817('0x2')]},'reason':{'type':Sequelize[_0xc817('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xc817('0x1')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc817('0x3')]},'agentdump':{'type':Sequelize[_0xc817('0x1')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc817('0x0')]},'channel':{'type':Sequelize[_0xc817('0x0')]},'channelstate':{'type':Sequelize[_0xc817('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc817('0x0')]},'connectedlinenum':{'type':Sequelize[_0xc817('0x0')]},'connectedlinename':{'type':Sequelize[_0xc817('0x0')]},'language':{'type':Sequelize[_0xc817('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc817('0x0')]},'exten':{'type':Sequelize[_0xc817('0x0')]},'priority':{'type':Sequelize[_0xc817('0x0')]},'destchannel':{'type':Sequelize[_0xc817('0x0')]},'destchannelstate':{'type':Sequelize[_0xc817('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc817('0x0')]},'destcalleridnum':{'type':Sequelize[_0xc817('0x0')]},'destcalleridname':{'type':Sequelize[_0xc817('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xc817('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xc817('0x0')]},'destlanguage':{'type':Sequelize[_0xc817('0x0')]},'destaccountcode':{'type':Sequelize[_0xc817('0x0')]},'destcontext':{'type':Sequelize[_0xc817('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc817('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc817('0x0')]},'subject':{'type':Sequelize[_0xc817('0x0')]},'from':{'type':Sequelize[_0xc817('0x0')]},'to':{'type':Sequelize[_0xc817('0x0')]},'cc':{'type':Sequelize[_0xc817('0x0')]},'attachment':{'type':Sequelize[_0xc817('0x4')]},'html':{'type':Sequelize[_0xc817('0x4')]},'text':{'type':Sequelize[_0xc817('0x4')]},'status':{'type':Sequelize[_0xc817('0x5')](_0xc817('0x6'),'SENDING',_0xc817('0x7'),_0xc817('0x8'))},'url':{'type':Sequelize[_0xc817('0x0')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xc817('0x0')]},'projectId':{'type':Sequelize[_0xc817('0x2')]}}; \ No newline at end of file +var _0xd836=['STRING','INTEGER','DATE','BOOLEAN','TEXT','SENDING','FAILED','sequelize','exports'];(function(_0x5c9fc0,_0x513be1){var _0x458efa=function(_0x42345f){while(--_0x42345f){_0x5c9fc0['push'](_0x5c9fc0['shift']());}};_0x458efa(++_0x513be1);}(_0xd836,0x1ed));var _0x6d83=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd836[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6d83('0x0'));module[_0x6d83('0x1')]={'integration':{'type':Sequelize[_0x6d83('0x2')]},'eventChannel':{'type':Sequelize[_0x6d83('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x6d83('0x3')]},'contacts':{'type':Sequelize[_0x6d83('0x2')]},'uniqueid':{'type':Sequelize[_0x6d83('0x2')]},'calleridnum':{'type':Sequelize[_0x6d83('0x2')]},'calleridname':{'type':Sequelize[_0x6d83('0x2')]},'queue':{'type':Sequelize[_0x6d83('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6d83('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6d83('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6d83('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6d83('0x4')]},'talktime':{'type':Sequelize[_0x6d83('0x3')]},'agentacw':{'type':Sequelize[_0x6d83('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6d83('0x3')]},'reason':{'type':Sequelize[_0x6d83('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6d83('0x4')]},'agentdump':{'type':Sequelize[_0x6d83('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6d83('0x4')]},'lastevent':{'type':Sequelize[_0x6d83('0x2')]},'channel':{'type':Sequelize[_0x6d83('0x2')]},'channelstate':{'type':Sequelize[_0x6d83('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6d83('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d83('0x2')]},'language':{'type':Sequelize[_0x6d83('0x2')]},'accountcode':{'type':Sequelize[_0x6d83('0x2')]},'context':{'type':Sequelize[_0x6d83('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6d83('0x2')]},'destchannel':{'type':Sequelize[_0x6d83('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d83('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d83('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6d83('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6d83('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d83('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6d83('0x2')]},'destcontext':{'type':Sequelize[_0x6d83('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d83('0x2')]},'destuniqueid':{'type':Sequelize[_0x6d83('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6d83('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x6d83('0x2')]},'to':{'type':Sequelize[_0x6d83('0x2')]},'cc':{'type':Sequelize[_0x6d83('0x2')]},'attachment':{'type':Sequelize[_0x6d83('0x6')]},'html':{'type':Sequelize[_0x6d83('0x6')]},'text':{'type':Sequelize[_0x6d83('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x6d83('0x7'),'RECEIVED',_0x6d83('0x8'))},'url':{'type':Sequelize[_0x6d83('0x2')]},'app':{'type':Sequelize[_0x6d83('0x2')]},'appdata':{'type':Sequelize[_0x6d83('0x2')]},'projectId':{'type':Sequelize[_0x6d83('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7ae0307..058af33 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 _0xe787=['keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','findAll','rows','params','rawAttributes','fields','include','catch','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','index','map','IntegrationReport','fieldName','type','key','model','name'];(function(_0x1c7185,_0x5be047){var _0x437c83=function(_0x3e0121){while(--_0x3e0121){_0x1c7185['push'](_0x1c7185['shift']());}};_0x437c83(++_0x5be047);}(_0xe787,0x1ca));var _0x7e78=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xe787[_0x16b1a5];return _0x475e25;};'use strict';var pdf=require(_0x7e78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e78('0x1'));var zipdir=require(_0x7e78('0x2'));var jsonpatch=require(_0x7e78('0x3'));var rp=require(_0x7e78('0x4'));var moment=require('moment');var BPromise=require(_0x7e78('0x5'));var Mustache=require(_0x7e78('0x6'));var util=require(_0x7e78('0x7'));var path=require(_0x7e78('0x8'));var sox=require(_0x7e78('0x9'));var csv=require(_0x7e78('0xa'));var ejs=require(_0x7e78('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7e78('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e78('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e78('0xe'));var Papa=require(_0x7e78('0xf'));var Redis=require(_0x7e78('0x10'));var authService=require(_0x7e78('0x11'));var qs=require(_0x7e78('0x12'));var as=require(_0x7e78('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e78('0x14'))(_0x7e78('0x15'));var utils=require(_0x7e78('0x16'));var config=require('../../config/environment');var db=require(_0x7e78('0x17'))['db'];function respondWithStatusCode(_0x3d58a0,_0x316f7a){_0x316f7a=_0x316f7a||0xcc;return function(_0x5c4d00){if(_0x5c4d00){return _0x3d58a0['sendStatus'](_0x316f7a);}return _0x3d58a0['status'](_0x316f7a)['end']();};}function respondWithResult(_0x1e753a,_0x30b1e2){_0x30b1e2=_0x30b1e2||0xc8;return function(_0x552ba6){if(_0x552ba6){return _0x1e753a[_0x7e78('0x18')](_0x30b1e2)[_0x7e78('0x19')](_0x552ba6);}};}function respondWithFilteredResult(_0x460c85,_0x441aaa){return function(_0x193dd5){if(_0x193dd5){var _0x543abd=_0x193dd5[_0x7e78('0x1a')],_0x4d20f3=_0x441aaa[_0x7e78('0x1b')],_0x4f25fd=_0x441aaa['offset']+_0x441aaa['limit'],_0x791e60;if(_0x4f25fd>=_0x543abd){_0x4f25fd=_0x543abd;_0x791e60=0xc8;}else{_0x791e60=0xce;}_0x460c85[_0x7e78('0x18')](_0x791e60);return _0x460c85[_0x7e78('0x1c')](_0x7e78('0x1d'),_0x4d20f3+'-'+_0x4f25fd+'/'+_0x543abd)['json'](_0x193dd5);}return null;};}function patchUpdates(_0x4cf77d){return function(_0x1700eb){try{jsonpatch['apply'](_0x1700eb,_0x4cf77d,!![]);}catch(_0x5f2e70){return BPromise[_0x7e78('0x1e')](_0x5f2e70);}return _0x1700eb['save']();};}function saveUpdates(_0x5d5f46,_0x360537){return function(_0x4c25e9){if(_0x4c25e9){return _0x4c25e9[_0x7e78('0x1f')](_0x5d5f46)[_0x7e78('0x20')](function(_0x512635){return _0x512635;});}return null;};}function removeEntity(_0x25d851,_0x38067a){return function(_0x479d00){if(_0x479d00){return _0x479d00[_0x7e78('0x21')]()[_0x7e78('0x20')](function(){_0x25d851['status'](0xcc)[_0x7e78('0x22')]();});}};}function handleEntityNotFound(_0x506b41,_0x1c2e95){return function(_0x29ed9d){if(!_0x29ed9d){_0x506b41[_0x7e78('0x23')](0x194);}return _0x29ed9d;};}function handleError(_0x1f3f7a,_0x4a721b){_0x4a721b=_0x4a721b||0x1f4;return function(_0xc09936){logger[_0x7e78('0x24')](_0xc09936[_0x7e78('0x25')]);if(_0xc09936['name']){delete _0xc09936['name'];}_0x1f3f7a[_0x7e78('0x18')](_0x4a721b)['send'](_0xc09936);};}exports[_0x7e78('0x26')]=function(_0x2096fe,_0x582ae0){var _0x345897={},_0x16b4a0={},_0x118f2e={'count':0x0,'rows':[]};var _0x435aad=_[_0x7e78('0x27')](db[_0x7e78('0x28')]['rawAttributes'],function(_0x1e8a47){return{'name':_0x1e8a47[_0x7e78('0x29')],'type':_0x1e8a47[_0x7e78('0x2a')][_0x7e78('0x2b')]};});_0x16b4a0[_0x7e78('0x2c')]=_['map'](_0x435aad,_0x7e78('0x2d'));_0x16b4a0['query']=_[_0x7e78('0x2e')](_0x2096fe[_0x7e78('0x2f')]);_0x16b4a0[_0x7e78('0x30')]=_[_0x7e78('0x31')](_0x16b4a0[_0x7e78('0x2c')],_0x16b4a0[_0x7e78('0x2f')]);_0x345897[_0x7e78('0x32')]=_[_0x7e78('0x31')](_0x16b4a0[_0x7e78('0x2c')],qs['fields'](_0x2096fe[_0x7e78('0x2f')]['fields']));_0x345897[_0x7e78('0x32')]=_0x345897[_0x7e78('0x32')][_0x7e78('0x33')]?_0x345897['attributes']:_0x16b4a0[_0x7e78('0x2c')];if(!_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x34')](_0x7e78('0x35'))){_0x345897[_0x7e78('0x36')]=qs['limit'](_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x36')]);_0x345897[_0x7e78('0x1b')]=qs['offset'](_0x2096fe['query']['offset']);}_0x345897[_0x7e78('0x37')]=qs[_0x7e78('0x38')](_0x2096fe[_0x7e78('0x2f')]['sort']);_0x345897[_0x7e78('0x39')]=qs[_0x7e78('0x30')](_['pick'](_0x2096fe[_0x7e78('0x2f')],_0x16b4a0[_0x7e78('0x30')]),_0x435aad);if(_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x3a')]){_0x345897[_0x7e78('0x39')]=_[_0x7e78('0x3b')](_0x345897[_0x7e78('0x39')],{'$or':_['map'](_0x435aad,function(_0xbb0d1){if(_0xbb0d1[_0x7e78('0x2a')]!=='VIRTUAL'){var _0x31ff0a={};_0x31ff0a[_0xbb0d1[_0x7e78('0x2d')]]={'$like':'%'+_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x3a')]+'%'};return _0x31ff0a;}})});}_0x345897=_[_0x7e78('0x3b')]({},_0x345897,_0x2096fe[_0x7e78('0x3c')]);var _0x2922ff={'where':_0x345897['where']};return db[_0x7e78('0x28')][_0x7e78('0x1a')](_0x2922ff)['then'](function(_0x1dfcc7){_0x118f2e[_0x7e78('0x1a')]=_0x1dfcc7;if(_0x2096fe[_0x7e78('0x2f')]['includeAll']){_0x345897['include']=[{'all':!![]}];}return db[_0x7e78('0x28')][_0x7e78('0x3d')](_0x345897);})[_0x7e78('0x20')](function(_0x9403d0){_0x118f2e[_0x7e78('0x3e')]=_0x9403d0;return _0x118f2e;})[_0x7e78('0x20')](respondWithFilteredResult(_0x582ae0,_0x345897))['catch'](handleError(_0x582ae0,null));};exports['show']=function(_0x2f912a,_0x38231e){var _0x20acdb={'raw':![],'where':{'id':_0x2f912a[_0x7e78('0x3f')]['id']}},_0x2176f0={};_0x2176f0[_0x7e78('0x2c')]=_[_0x7e78('0x2e')](db[_0x7e78('0x28')][_0x7e78('0x40')]);_0x2176f0[_0x7e78('0x2f')]=_[_0x7e78('0x2e')](_0x2f912a['query']);_0x2176f0[_0x7e78('0x30')]=_[_0x7e78('0x31')](_0x2176f0[_0x7e78('0x2c')],_0x2176f0[_0x7e78('0x2f')]);_0x20acdb[_0x7e78('0x32')]=_[_0x7e78('0x31')](_0x2176f0[_0x7e78('0x2c')],qs[_0x7e78('0x41')](_0x2f912a[_0x7e78('0x2f')]['fields']));_0x20acdb[_0x7e78('0x32')]=_0x20acdb[_0x7e78('0x32')]['length']?_0x20acdb['attributes']:_0x2176f0[_0x7e78('0x2c')];if(_0x2f912a[_0x7e78('0x2f')]['includeAll']){_0x20acdb[_0x7e78('0x42')]=[{'all':!![]}];}_0x20acdb=_[_0x7e78('0x3b')]({},_0x20acdb,_0x2f912a['options']);return db[_0x7e78('0x28')]['find'](_0x20acdb)['then'](handleEntityNotFound(_0x38231e,null))[_0x7e78('0x20')](respondWithResult(_0x38231e,null))[_0x7e78('0x43')](handleError(_0x38231e,null));};exports[_0x7e78('0x44')]=function(_0x1654d6,_0x49f3f1){return db[_0x7e78('0x28')]['create'](_0x1654d6[_0x7e78('0x45')],{})['then'](respondWithResult(_0x49f3f1,0xc9))[_0x7e78('0x43')](handleError(_0x49f3f1,null));};exports[_0x7e78('0x1f')]=function(_0x441085,_0x4e05a9){if(_0x441085['body']['id']){delete _0x441085[_0x7e78('0x45')]['id'];}return db[_0x7e78('0x28')]['find']({'where':{'id':_0x441085[_0x7e78('0x3f')]['id']}})[_0x7e78('0x20')](handleEntityNotFound(_0x4e05a9,null))['then'](saveUpdates(_0x441085[_0x7e78('0x45')],null))[_0x7e78('0x20')](respondWithResult(_0x4e05a9,null))[_0x7e78('0x43')](handleError(_0x4e05a9,null));};exports[_0x7e78('0x21')]=function(_0xa5d63c,_0x871c29){return db[_0x7e78('0x28')][_0x7e78('0x46')]({'where':{'id':_0xa5d63c[_0x7e78('0x3f')]['id']}})[_0x7e78('0x20')](handleEntityNotFound(_0x871c29,null))['then'](removeEntity(_0x871c29,null))[_0x7e78('0x43')](handleError(_0x871c29,null));};exports[_0x7e78('0x47')]=function(_0x5e84b5,_0x417bd9){return db[_0x7e78('0x28')][_0x7e78('0x47')]()[_0x7e78('0x20')](respondWithResult(_0x417bd9,null))[_0x7e78('0x43')](handleError(_0x417bd9,null));}; \ No newline at end of file +var _0x22f0=['jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x2bed54,_0x16bcc3){var _0x195cf8=function(_0xf523bd){while(--_0xf523bd){_0x2bed54['push'](_0x2bed54['shift']());}};_0x195cf8(++_0x16bcc3);}(_0x22f0,0x15a));var _0x022f=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x22f0[_0x29c261];return _0x1a9335;};'use strict';var pdf=require(_0x022f('0x0'));var emlformat=require(_0x022f('0x1'));var rimraf=require(_0x022f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x022f('0x3'));var rp=require(_0x022f('0x4'));var moment=require(_0x022f('0x5'));var BPromise=require(_0x022f('0x6'));var Mustache=require('mustache');var util=require(_0x022f('0x7'));var path=require(_0x022f('0x8'));var sox=require('sox');var csv=require(_0x022f('0x9'));var ejs=require(_0x022f('0xa'));var fs=require('fs');var _=require(_0x022f('0xb'));var squel=require(_0x022f('0xc'));var crypto=require(_0x022f('0xd'));var jsforce=require(_0x022f('0xe'));var deskjs=require(_0x022f('0xf'));var toCsv=require(_0x022f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x022f('0x10'));var authService=require(_0x022f('0x11'));var qs=require(_0x022f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x022f('0x13'));var utils=require('../../config/utils');var config=require(_0x022f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c08eb,_0x234d1c){_0x234d1c=_0x234d1c||0xcc;return function(_0x552867){if(_0x552867){return _0x3c08eb[_0x022f('0x15')](_0x234d1c);}return _0x3c08eb[_0x022f('0x16')](_0x234d1c)[_0x022f('0x17')]();};}function respondWithResult(_0x479bc1,_0x453e4d){_0x453e4d=_0x453e4d||0xc8;return function(_0xc022c4){if(_0xc022c4){return _0x479bc1[_0x022f('0x16')](_0x453e4d)[_0x022f('0x18')](_0xc022c4);}};}function respondWithFilteredResult(_0x2b0f11,_0x19b12a){return function(_0x3554b5){if(_0x3554b5){var _0x220d65=_0x3554b5[_0x022f('0x19')],_0x312b3e=_0x19b12a[_0x022f('0x1a')],_0x30b755=_0x19b12a['offset']+_0x19b12a['limit'],_0x3f1d1c;if(_0x30b755>=_0x220d65){_0x30b755=_0x220d65;_0x3f1d1c=0xc8;}else{_0x3f1d1c=0xce;}_0x2b0f11[_0x022f('0x16')](_0x3f1d1c);return _0x2b0f11[_0x022f('0x1b')]('Content-Range',_0x312b3e+'-'+_0x30b755+'/'+_0x220d65)[_0x022f('0x18')](_0x3554b5);}return null;};}function patchUpdates(_0x4b0535){return function(_0x3893c0){try{jsonpatch[_0x022f('0x1c')](_0x3893c0,_0x4b0535,!![]);}catch(_0x1a6082){return BPromise[_0x022f('0x1d')](_0x1a6082);}return _0x3893c0[_0x022f('0x1e')]();};}function saveUpdates(_0x3eec86,_0x556c23){return function(_0x10e8d0){if(_0x10e8d0){return _0x10e8d0[_0x022f('0x1f')](_0x3eec86)[_0x022f('0x20')](function(_0x52acdd){return _0x52acdd;});}return null;};}function removeEntity(_0x273d0c,_0x1daec4){return function(_0x5ee365){if(_0x5ee365){return _0x5ee365[_0x022f('0x21')]()[_0x022f('0x20')](function(){_0x273d0c['status'](0xcc)[_0x022f('0x17')]();});}};}function handleEntityNotFound(_0x10a08a,_0x4682bd){return function(_0x55554d){if(!_0x55554d){_0x10a08a[_0x022f('0x15')](0x194);}return _0x55554d;};}function handleError(_0x5198cb,_0x4fa3f4){_0x4fa3f4=_0x4fa3f4||0x1f4;return function(_0x36f8ca){logger[_0x022f('0x22')](_0x36f8ca[_0x022f('0x23')]);if(_0x36f8ca[_0x022f('0x24')]){delete _0x36f8ca[_0x022f('0x24')];}_0x5198cb['status'](_0x4fa3f4)[_0x022f('0x25')](_0x36f8ca);};}exports['index']=function(_0x10b1d2,_0x2996f5){var _0x1c53be={},_0x245526={},_0x32ba1f={'count':0x0,'rows':[]};var _0x2f1b38=_[_0x022f('0x26')](db[_0x022f('0x27')][_0x022f('0x28')],function(_0x2c9b15){return{'name':_0x2c9b15['fieldName'],'type':_0x2c9b15['type'][_0x022f('0x29')]};});_0x245526[_0x022f('0x2a')]=_['map'](_0x2f1b38,_0x022f('0x24'));_0x245526[_0x022f('0x2b')]=_['keys'](_0x10b1d2[_0x022f('0x2b')]);_0x245526[_0x022f('0x2c')]=_['intersection'](_0x245526[_0x022f('0x2a')],_0x245526['query']);_0x1c53be[_0x022f('0x2d')]=_[_0x022f('0x2e')](_0x245526[_0x022f('0x2a')],qs[_0x022f('0x2f')](_0x10b1d2[_0x022f('0x2b')][_0x022f('0x2f')]));_0x1c53be[_0x022f('0x2d')]=_0x1c53be['attributes'][_0x022f('0x30')]?_0x1c53be[_0x022f('0x2d')]:_0x245526[_0x022f('0x2a')];if(!_0x10b1d2[_0x022f('0x2b')][_0x022f('0x31')](_0x022f('0x32'))){_0x1c53be[_0x022f('0x33')]=qs[_0x022f('0x33')](_0x10b1d2[_0x022f('0x2b')]['limit']);_0x1c53be[_0x022f('0x1a')]=qs['offset'](_0x10b1d2[_0x022f('0x2b')][_0x022f('0x1a')]);}_0x1c53be[_0x022f('0x34')]=qs['sort'](_0x10b1d2[_0x022f('0x2b')]['sort']);_0x1c53be[_0x022f('0x35')]=qs[_0x022f('0x2c')](_[_0x022f('0x36')](_0x10b1d2[_0x022f('0x2b')],_0x245526[_0x022f('0x2c')]),_0x2f1b38);if(_0x10b1d2[_0x022f('0x2b')][_0x022f('0x37')]){_0x1c53be[_0x022f('0x35')]=_[_0x022f('0x38')](_0x1c53be[_0x022f('0x35')],{'$or':_[_0x022f('0x26')](_0x2f1b38,function(_0x5b3d79){if(_0x5b3d79[_0x022f('0x39')]!==_0x022f('0x3a')){var _0x59ddd5={};_0x59ddd5[_0x5b3d79['name']]={'$like':'%'+_0x10b1d2[_0x022f('0x2b')]['filter']+'%'};return _0x59ddd5;}})});}_0x1c53be=_[_0x022f('0x38')]({},_0x1c53be,_0x10b1d2[_0x022f('0x3b')]);var _0x1f474f={'where':_0x1c53be['where']};return db['IntegrationReport'][_0x022f('0x19')](_0x1f474f)[_0x022f('0x20')](function(_0x42c6be){_0x32ba1f[_0x022f('0x19')]=_0x42c6be;if(_0x10b1d2['query']['includeAll']){_0x1c53be[_0x022f('0x3c')]=[{'all':!![]}];}return db[_0x022f('0x27')][_0x022f('0x3d')](_0x1c53be);})[_0x022f('0x20')](function(_0x1fa882){_0x32ba1f[_0x022f('0x3e')]=_0x1fa882;return _0x32ba1f;})[_0x022f('0x20')](respondWithFilteredResult(_0x2996f5,_0x1c53be))[_0x022f('0x3f')](handleError(_0x2996f5,null));};exports[_0x022f('0x40')]=function(_0x156a0b,_0x290932){var _0x302ef2={'raw':![],'where':{'id':_0x156a0b[_0x022f('0x41')]['id']}},_0x3fd885={};_0x3fd885[_0x022f('0x2a')]=_[_0x022f('0x42')](db[_0x022f('0x27')][_0x022f('0x28')]);_0x3fd885[_0x022f('0x2b')]=_[_0x022f('0x42')](_0x156a0b[_0x022f('0x2b')]);_0x3fd885[_0x022f('0x2c')]=_['intersection'](_0x3fd885['model'],_0x3fd885[_0x022f('0x2b')]);_0x302ef2[_0x022f('0x2d')]=_[_0x022f('0x2e')](_0x3fd885[_0x022f('0x2a')],qs['fields'](_0x156a0b[_0x022f('0x2b')]['fields']));_0x302ef2[_0x022f('0x2d')]=_0x302ef2[_0x022f('0x2d')][_0x022f('0x30')]?_0x302ef2['attributes']:_0x3fd885[_0x022f('0x2a')];if(_0x156a0b[_0x022f('0x2b')][_0x022f('0x43')]){_0x302ef2[_0x022f('0x3c')]=[{'all':!![]}];}_0x302ef2=_[_0x022f('0x38')]({},_0x302ef2,_0x156a0b['options']);return db[_0x022f('0x27')][_0x022f('0x44')](_0x302ef2)['then'](handleEntityNotFound(_0x290932,null))[_0x022f('0x20')](respondWithResult(_0x290932,null))[_0x022f('0x3f')](handleError(_0x290932,null));};exports['create']=function(_0x10bc67,_0x414dc8){return db[_0x022f('0x27')][_0x022f('0x45')](_0x10bc67[_0x022f('0x46')],{})[_0x022f('0x20')](respondWithResult(_0x414dc8,0xc9))[_0x022f('0x3f')](handleError(_0x414dc8,null));};exports[_0x022f('0x1f')]=function(_0x7e5fad,_0xbfa308){if(_0x7e5fad[_0x022f('0x46')]['id']){delete _0x7e5fad[_0x022f('0x46')]['id'];}return db[_0x022f('0x27')]['find']({'where':{'id':_0x7e5fad['params']['id']}})[_0x022f('0x20')](handleEntityNotFound(_0xbfa308,null))['then'](saveUpdates(_0x7e5fad[_0x022f('0x46')],null))[_0x022f('0x20')](respondWithResult(_0xbfa308,null))['catch'](handleError(_0xbfa308,null));};exports[_0x022f('0x21')]=function(_0x17ffb1,_0x14a079){return db[_0x022f('0x27')]['find']({'where':{'id':_0x17ffb1[_0x022f('0x41')]['id']}})[_0x022f('0x20')](handleEntityNotFound(_0x14a079,null))[_0x022f('0x20')](removeEntity(_0x14a079,null))[_0x022f('0x3f')](handleError(_0x14a079,null));};exports[_0x022f('0x47')]=function(_0x2cc35c,_0x5ecc4f){return db[_0x022f('0x27')][_0x022f('0x47')]()[_0x022f('0x20')](respondWithResult(_0x5ecc4f,null))[_0x022f('0x3f')](handleError(_0x5ecc4f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index b56fa4e..6a21756 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 _0x5e81=['exports','define','IntegrationReport','report_integration','util','api','moment','request-promise','path','rimraf','./integrationReport.attributes'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5e81,0x117));var _0x15e8=function(_0x51bd76,_0x25183c){_0x51bd76=_0x51bd76-0x0;var _0x5c1410=_0x5e81[_0x51bd76];return _0x5c1410;};'use strict';var _=require('lodash');var util=require(_0x15e8('0x0'));var logger=require('../../config/logger')(_0x15e8('0x1'));var moment=require(_0x15e8('0x2'));var BPromise=require('bluebird');var rp=require(_0x15e8('0x3'));var fs=require('fs');var path=require(_0x15e8('0x4'));var rimraf=require(_0x15e8('0x5'));var config=require('../../config/environment');var attributes=require(_0x15e8('0x6'));module[_0x15e8('0x7')]=function(_0x494771,_0x206f06){return _0x494771[_0x15e8('0x8')](_0x15e8('0x9'),attributes,{'tableName':_0x15e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a6=['define','IntegrationReport','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0xf9a6,0x199));var _0x6f9a=function(_0x370a3f,_0x52ea7b){_0x370a3f=_0x370a3f-0x0;var _0x31f2f1=_0xf9a6[_0x370a3f];return _0x31f2f1;};'use strict';var _=require(_0x6f9a('0x0'));var util=require(_0x6f9a('0x1'));var logger=require('../../config/logger')(_0x6f9a('0x2'));var moment=require(_0x6f9a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f9a('0x4'));var fs=require('fs');var path=require(_0x6f9a('0x5'));var rimraf=require(_0x6f9a('0x6'));var config=require(_0x6f9a('0x7'));var attributes=require(_0x6f9a('0x8'));module['exports']=function(_0x14e38f,_0x3ef688){return _0x14e38f[_0x6f9a('0x9')](_0x6f9a('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index b9eb7b3..6ed27ba 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 _0x5eb8=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x57aae3,_0x36d9c4){var _0x7ff01d=function(_0x14ed09){while(--_0x14ed09){_0x57aae3['push'](_0x57aae3['shift']());}};_0x7ff01d(++_0x36d9c4);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0x5eb8[_0x3011b7];return _0x304ca2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file +var _0x0b0e=['IntegrationReport,\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','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0b0e[_0x5f1391];return _0x50ebe3;};'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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 50a9c48..200e356 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(_0xa2485c,_0x12158b){var _0x313b49=function(_0x195618){while(--_0x195618){_0xa2485c['push'](_0xa2485c['shift']());}};_0x313b49(++_0x12158b);}(_0x3e74,0x175));var _0x43e7=function(_0x5cfee1,_0x2ac23c){_0x5cfee1=_0x5cfee1-0x0;var _0x34d945=_0x3e74[_0x5cfee1];return _0x34d945;};'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 _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54d20d,_0x2c085d){var _0x2f84b7=function(_0x4488ca){while(--_0x4488ca){_0x54d20d['push'](_0x54d20d['shift']());}};_0x2f84b7(++_0x2c085d);}(_0x34e8,0x12c));var _0x834e=function(_0x540d0c,_0x56bc0d){_0x540d0c=_0x540d0c-0x0;var _0x2361b8=_0x34e8[_0x540d0c];return _0x2361b8;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 57e3156..c12c58b 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 _0x2c13=['exports','STRING','sequelize'];(function(_0x18b477,_0x555d04){var _0x240b92=function(_0x343b06){while(--_0x343b06){_0x18b477['push'](_0x18b477['shift']());}};_0x240b92(++_0x555d04);}(_0x2c13,0x125));var _0x32c1=function(_0x325448,_0x41fd75){_0x325448=_0x325448-0x0;var _0x3dd9df=_0x2c13[_0x325448];return _0x3dd9df;};'use strict';var Sequelize=require(_0x32c1('0x0'));module[_0x32c1('0x1')]={'name':{'type':Sequelize[_0x32c1('0x2')]},'description':{'type':Sequelize[_0x32c1('0x2')]},'interval':{'type':Sequelize[_0x32c1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xfb6a=['exports','STRING','sequelize'];(function(_0x577b55,_0x38a861){var _0x224c94=function(_0x51842a){while(--_0x51842a){_0x577b55['push'](_0x577b55['shift']());}};_0x224c94(++_0x38a861);}(_0xfb6a,0xe9));var _0xafb6=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0xfb6a[_0x3ef45e];return _0x69e7c;};'use strict';var Sequelize=require(_0xafb6('0x0'));module[_0xafb6('0x1')]={'name':{'type':Sequelize[_0xafb6('0x2')]},'description':{'type':Sequelize[_0xafb6('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 298db59..efbb3af 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 _0x3d6c=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','Intervals','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','getIntervals','findOne','addIntervals','sequelize','IntervalId','bulkCreate','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3d6c,0x1eb));var _0xc3d6=function(_0x467aea,_0x12b5fb){_0x467aea=_0x467aea-0x0;var _0x3d526c=_0x3d6c[_0x467aea];return _0x3d526c;};'use strict';var pdf=require(_0xc3d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc3d6('0x2'));var moment=require(_0xc3d6('0x3'));var BPromise=require(_0xc3d6('0x4'));var Mustache=require(_0xc3d6('0x5'));var util=require(_0xc3d6('0x6'));var path=require('path');var sox=require(_0xc3d6('0x7'));var csv=require(_0xc3d6('0x8'));var ejs=require(_0xc3d6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc3d6('0xa'));var crypto=require(_0xc3d6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc3d6('0xc'));var toCsv=require(_0xc3d6('0x8'));var querystring=require(_0xc3d6('0xd'));var Papa=require(_0xc3d6('0xe'));var Redis=require(_0xc3d6('0xf'));var authService=require(_0xc3d6('0x10'));var qs=require(_0xc3d6('0x11'));var as=require(_0xc3d6('0x12'));var hardwareService=require(_0xc3d6('0x13'));var logger=require(_0xc3d6('0x14'))(_0xc3d6('0x15'));var utils=require(_0xc3d6('0x16'));var config=require(_0xc3d6('0x17'));var db=require(_0xc3d6('0x18'))['db'];var extensions=require(_0xc3d6('0x19'));function respondWithStatusCode(_0x46ff56,_0x27a706){_0x27a706=_0x27a706||0xcc;return function(_0xfa3a06){if(_0xfa3a06){return _0x46ff56[_0xc3d6('0x1a')](_0x27a706);}return _0x46ff56['status'](_0x27a706)[_0xc3d6('0x1b')]();};}function respondWithResult(_0x206779,_0x37d81c){_0x37d81c=_0x37d81c||0xc8;return function(_0x21bef9){if(_0x21bef9){return _0x206779['status'](_0x37d81c)['json'](_0x21bef9);}};}function respondWithFilteredResult(_0x34d5b1,_0x1024ea){return function(_0x5d5e74){if(_0x5d5e74){var _0x11ed21=_0x5d5e74[_0xc3d6('0x1c')],_0x339c17=_0x1024ea[_0xc3d6('0x1d')],_0x570779=_0x1024ea['offset']+_0x1024ea[_0xc3d6('0x1e')],_0x210b14;if(_0x570779>=_0x11ed21){_0x570779=_0x11ed21;_0x210b14=0xc8;}else{_0x210b14=0xce;}_0x34d5b1[_0xc3d6('0x1f')](_0x210b14);return _0x34d5b1['set'](_0xc3d6('0x20'),_0x339c17+'-'+_0x570779+'/'+_0x11ed21)[_0xc3d6('0x21')](_0x5d5e74);}return null;};}function patchUpdates(_0x5714cc){return function(_0x3af473){try{jsonpatch[_0xc3d6('0x22')](_0x3af473,_0x5714cc,!![]);}catch(_0x4c84c2){return BPromise[_0xc3d6('0x23')](_0x4c84c2);}return _0x3af473[_0xc3d6('0x24')]();};}function saveUpdates(_0x478c74,_0x50c836){return function(_0x5c2a8c){if(_0x5c2a8c){return _0x5c2a8c[_0xc3d6('0x25')](_0x478c74)[_0xc3d6('0x26')](function(_0x56e1fe){return _0x56e1fe;});}return null;};}function removeEntity(_0x211968,_0x24c061){return function(_0x402751){if(_0x402751){return _0x402751['destroy']()[_0xc3d6('0x26')](function(){var _0x2b211e=_0x402751[_0xc3d6('0x27')]({'plain':!![]});var _0x367ecb='Intervals';return db[_0xc3d6('0x28')]['destroy']({'where':{'type':_0x367ecb,'resourceId':_0x2b211e['id']}})[_0xc3d6('0x26')](function(){return _0x402751;});})['then'](function(){_0x211968[_0xc3d6('0x1f')](0xcc)[_0xc3d6('0x1b')]();});}};}function handleEntityNotFound(_0x3c2c69,_0x243dd0){return function(_0x5d60d8){if(!_0x5d60d8){_0x3c2c69[_0xc3d6('0x1a')](0x194);}return _0x5d60d8;};}function handleError(_0xcbdd0c,_0x2cdf3e){_0x2cdf3e=_0x2cdf3e||0x1f4;return function(_0x4d79a3){logger['error'](_0x4d79a3[_0xc3d6('0x29')]);if(_0x4d79a3[_0xc3d6('0x2a')]){delete _0x4d79a3['name'];}_0xcbdd0c[_0xc3d6('0x1f')](_0x2cdf3e)[_0xc3d6('0x2b')](_0x4d79a3);};}exports[_0xc3d6('0x2c')]=function(_0x1375ef,_0x2f817c){var _0x451a5a={},_0x1d8c06={},_0x2fd4d4={'count':0x0,'rows':[]};var _0x4bb64d=_[_0xc3d6('0x2d')](db[_0xc3d6('0x2e')][_0xc3d6('0x2f')],function(_0x419adf){return{'name':_0x419adf['fieldName'],'type':_0x419adf[_0xc3d6('0x30')]['key']};});_0x1d8c06[_0xc3d6('0x31')]=_[_0xc3d6('0x2d')](_0x4bb64d,_0xc3d6('0x2a'));_0x1d8c06[_0xc3d6('0x32')]=_[_0xc3d6('0x33')](_0x1375ef[_0xc3d6('0x32')]);_0x1d8c06[_0xc3d6('0x34')]=_[_0xc3d6('0x35')](_0x1d8c06[_0xc3d6('0x31')],_0x1d8c06[_0xc3d6('0x32')]);_0x451a5a[_0xc3d6('0x36')]=_[_0xc3d6('0x35')](_0x1d8c06['model'],qs[_0xc3d6('0x37')](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x37')]));_0x451a5a['attributes']=_0x451a5a['attributes'][_0xc3d6('0x38')]?_0x451a5a[_0xc3d6('0x36')]:_0x1d8c06[_0xc3d6('0x31')];if(!_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x39')](_0xc3d6('0x3a'))){_0x451a5a['limit']=qs['limit'](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x1e')]);_0x451a5a[_0xc3d6('0x1d')]=qs[_0xc3d6('0x1d')](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x1d')]);}_0x451a5a[_0xc3d6('0x3b')]=qs[_0xc3d6('0x3c')](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x3c')]);_0x451a5a[_0xc3d6('0x3d')]=qs['filters'](_[_0xc3d6('0x3e')](_0x1375ef[_0xc3d6('0x32')],_0x1d8c06[_0xc3d6('0x34')]),_0x4bb64d);if(_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x3f')]){_0x451a5a[_0xc3d6('0x3d')]=_[_0xc3d6('0x40')](_0x451a5a[_0xc3d6('0x3d')],{'$or':_[_0xc3d6('0x2d')](_0x4bb64d,function(_0x89d28b){if(_0x89d28b[_0xc3d6('0x30')]!==_0xc3d6('0x41')){var _0x16f6f0={};_0x16f6f0[_0x89d28b[_0xc3d6('0x2a')]]={'$like':'%'+_0x1375ef['query']['filter']+'%'};return _0x16f6f0;}})});}_0x451a5a=_[_0xc3d6('0x40')]({},_0x451a5a,_0x1375ef[_0xc3d6('0x42')]);var _0xc8620a={'where':_0x451a5a['where']};return db['Interval'][_0xc3d6('0x1c')](_0xc8620a)['then'](function(_0x4dda8a){_0x2fd4d4[_0xc3d6('0x1c')]=_0x4dda8a;if(_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x43')]){_0x451a5a[_0xc3d6('0x44')]=[{'all':!![]}];}return db[_0xc3d6('0x2e')][_0xc3d6('0x45')](_0x451a5a);})[_0xc3d6('0x26')](function(_0x239827){_0x2fd4d4['rows']=_0x239827;return _0x2fd4d4;})[_0xc3d6('0x26')](respondWithFilteredResult(_0x2f817c,_0x451a5a))[_0xc3d6('0x46')](handleError(_0x2f817c,null));};exports[_0xc3d6('0x47')]=function(_0x58bcdb,_0x1d0264){var _0x1ef259={'raw':!![],'where':{'id':_0x58bcdb[_0xc3d6('0x48')]['id']}},_0x215355={};_0x215355[_0xc3d6('0x31')]=_[_0xc3d6('0x33')](db[_0xc3d6('0x2e')][_0xc3d6('0x2f')]);_0x215355[_0xc3d6('0x32')]=_[_0xc3d6('0x33')](_0x58bcdb[_0xc3d6('0x32')]);_0x215355['filters']=_[_0xc3d6('0x35')](_0x215355[_0xc3d6('0x31')],_0x215355[_0xc3d6('0x32')]);_0x1ef259[_0xc3d6('0x36')]=_[_0xc3d6('0x35')](_0x215355[_0xc3d6('0x31')],qs['fields'](_0x58bcdb[_0xc3d6('0x32')][_0xc3d6('0x37')]));_0x1ef259[_0xc3d6('0x36')]=_0x1ef259[_0xc3d6('0x36')][_0xc3d6('0x38')]?_0x1ef259[_0xc3d6('0x36')]:_0x215355['model'];if(_0x58bcdb['query'][_0xc3d6('0x43')]){_0x1ef259[_0xc3d6('0x44')]=[{'all':!![]}];}_0x1ef259=_[_0xc3d6('0x40')]({},_0x1ef259,_0x58bcdb[_0xc3d6('0x42')]);return db[_0xc3d6('0x2e')][_0xc3d6('0x49')](_0x1ef259)[_0xc3d6('0x26')](handleEntityNotFound(_0x1d0264,null))['then'](respondWithResult(_0x1d0264,null))[_0xc3d6('0x46')](handleError(_0x1d0264,null));};exports[_0xc3d6('0x4a')]=function(_0x2d7465,_0x215079){return db['Interval'][_0xc3d6('0x4a')](_0x2d7465[_0xc3d6('0x4b')],{})[_0xc3d6('0x26')](function(_0x56a4db){var _0x111ed0=_0x2d7465[_0xc3d6('0x4c')][_0xc3d6('0x27')]({'plain':!![]});if(!_0x111ed0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x111ed0[_0xc3d6('0x4d')]===_0xc3d6('0x4c')){var _0x33d716=_0x56a4db['get']({'plain':!![]});var _0x440c0e=_0xc3d6('0x4e');return db['UserProfileSection'][_0xc3d6('0x49')]({'where':{'name':_0x440c0e,'userProfileId':_0x111ed0[_0xc3d6('0x4f')]},'raw':!![]})[_0xc3d6('0x26')](function(_0x24360b){if(_0x24360b&&_0x24360b[_0xc3d6('0x50')]===0x0){return db[_0xc3d6('0x28')][_0xc3d6('0x4a')]({'name':_0x33d716[_0xc3d6('0x2a')],'resourceId':_0x33d716['id'],'type':_0x24360b[_0xc3d6('0x2a')],'sectionId':_0x24360b['id']},{})[_0xc3d6('0x26')](function(){return _0x56a4db;});}else{return _0x56a4db;}})[_0xc3d6('0x46')](function(_0x2599cf){logger[_0xc3d6('0x51')](_0xc3d6('0x52'),_0x2599cf);throw _0x2599cf;});}return _0x56a4db;})[_0xc3d6('0x26')](respondWithResult(_0x215079,0xc9))[_0xc3d6('0x46')](handleError(_0x215079,null));};exports[_0xc3d6('0x25')]=function(_0x2f36a1,_0x238bf8){if(_0x2f36a1[_0xc3d6('0x4b')]['id']){delete _0x2f36a1[_0xc3d6('0x4b')]['id'];}return db[_0xc3d6('0x2e')]['find']({'where':{'id':_0x2f36a1['params']['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x238bf8,null))[_0xc3d6('0x26')](saveUpdates(_0x2f36a1[_0xc3d6('0x4b')],null))[_0xc3d6('0x26')](respondWithResult(_0x238bf8,null))[_0xc3d6('0x46')](handleError(_0x238bf8,null));};exports[_0xc3d6('0x53')]=function(_0x750808,_0x2419ac){return db[_0xc3d6('0x2e')]['find']({'where':{'id':_0x750808[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x2419ac,null))[_0xc3d6('0x26')](removeEntity(_0x2419ac,null))[_0xc3d6('0x46')](handleError(_0x2419ac,null));};exports[_0xc3d6('0x54')]=function(_0x3150af,_0x3fae61,_0x297100){if(_0x3150af[_0xc3d6('0x4b')]['id']){delete _0x3150af['body']['id'];}return db[_0xc3d6('0x2e')][_0xc3d6('0x49')]({'where':{'id':_0x3150af[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x3fae61,null))[_0xc3d6('0x26')](function(_0x24a674){if(_0x24a674){_0x3150af['body']['IntervalId']=_0x24a674['id'];return db[_0xc3d6('0x2e')]['create'](_0x3150af[_0xc3d6('0x4b')]);}})['then'](respondWithResult(_0x3fae61,null))[_0xc3d6('0x46')](handleError(_0x3fae61,null));};exports[_0xc3d6('0x55')]=function(_0x341b29,_0x12ee48,_0x45c43d){var _0x485421={};var _0x390f4f={};var _0x518835;var _0x2299e0;return db['Interval'][_0xc3d6('0x56')]({'where':{'id':_0x341b29[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x12ee48,null))['then'](function(_0x242d04){if(_0x242d04){_0x518835=_0x242d04;_0x390f4f[_0xc3d6('0x31')]=_[_0xc3d6('0x33')](db[_0xc3d6('0x2e')]['rawAttributes']);_0x390f4f['query']=_['keys'](_0x341b29[_0xc3d6('0x32')]);_0x390f4f['filters']=_[_0xc3d6('0x35')](_0x390f4f[_0xc3d6('0x31')],_0x390f4f['query']);_0x485421[_0xc3d6('0x36')]=_['intersection'](_0x390f4f['model'],qs[_0xc3d6('0x37')](_0x341b29[_0xc3d6('0x32')][_0xc3d6('0x37')]));_0x485421[_0xc3d6('0x36')]=_0x485421['attributes'][_0xc3d6('0x38')]?_0x485421[_0xc3d6('0x36')]:_0x390f4f[_0xc3d6('0x31')];_0x485421['order']=qs['sort'](_0x341b29['query'][_0xc3d6('0x3c')]);_0x485421[_0xc3d6('0x3d')]=qs[_0xc3d6('0x34')](_[_0xc3d6('0x3e')](_0x341b29[_0xc3d6('0x32')],_0x390f4f[_0xc3d6('0x34')]));if(_0x341b29['query'][_0xc3d6('0x3f')]){_0x485421[_0xc3d6('0x3d')]=_[_0xc3d6('0x40')](_0x485421[_0xc3d6('0x3d')],{'$or':_[_0xc3d6('0x2d')](_0x485421['attributes'],function(_0x26ea5e){var _0x3f2a84={};_0x3f2a84[_0x26ea5e]={'$like':'%'+_0x341b29[_0xc3d6('0x32')]['filter']+'%'};return _0x3f2a84;})});}_0x485421=_['merge']({},_0x485421,_0x341b29['options']);return _0x518835[_0xc3d6('0x55')](_0x485421);}})['then'](function(_0x3bdb51){if(_0x3bdb51){_0x2299e0=_0x3bdb51[_0xc3d6('0x38')];if(!_0x341b29[_0xc3d6('0x32')]['hasOwnProperty']('nolimit')){_0x485421[_0xc3d6('0x1e')]=qs[_0xc3d6('0x1e')](_0x341b29[_0xc3d6('0x32')][_0xc3d6('0x1e')]);_0x485421[_0xc3d6('0x1d')]=qs[_0xc3d6('0x1d')](_0x341b29['query'][_0xc3d6('0x1d')]);}return _0x518835[_0xc3d6('0x55')](_0x485421);}})['then'](function(_0x3b03ec){if(_0x3b03ec){return _0x3b03ec?{'count':_0x2299e0,'rows':_0x3b03ec}:null;}})[_0xc3d6('0x26')](respondWithResult(_0x12ee48,null))[_0xc3d6('0x46')](handleError(_0x12ee48,null));};exports[_0xc3d6('0x57')]=function(_0x28abd3,_0x6a6067,_0x4769f3){return db[_0xc3d6('0x2e')][_0xc3d6('0x56')]({'where':{'id':_0x28abd3[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x6a6067,null))[_0xc3d6('0x26')](function(_0x2d9f6e){if(_0x2d9f6e){return db[_0xc3d6('0x58')]['transaction'](function(_0x2bc564){return db[_0xc3d6('0x2e')][_0xc3d6('0x53')]({'where':{'IntervalId':_0x28abd3[_0xc3d6('0x48')]['id']},'transaction':_0x2bc564})[_0xc3d6('0x26')](function(_0x1229d0){var _0x1a2f5d=_[_0xc3d6('0x2d')](_0x28abd3[_0xc3d6('0x4b')],function(_0x183e43){delete _0x183e43['id'];_0x183e43[_0xc3d6('0x59')]=_0x28abd3[_0xc3d6('0x48')]['id'];return _0x183e43;});return db[_0xc3d6('0x2e')][_0xc3d6('0x5a')](_0x1a2f5d,{'transaction':_0x2bc564});});})['then'](function(){return db[_0xc3d6('0x2e')]['findAll']({'where':{'IntervalId':_0x28abd3['params']['id']}});});}})[_0xc3d6('0x26')](respondWithResult(_0x6a6067,null))['catch'](handleError(_0x6a6067,null));}; \ No newline at end of file +var _0x16f6=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','IntervalId','order','getIntervals','findOne','params','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','apply','save','update','destroy','then','get','Intervals','UserProfileResource','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x534ca2,_0x47f568){var _0x532552=function(_0x10e22c){while(--_0x10e22c){_0x534ca2['push'](_0x534ca2['shift']());}};_0x532552(++_0x47f568);}(_0x16f6,0x1be));var _0x616f=function(_0x181719,_0x1ff98b){_0x181719=_0x181719-0x0;var _0x4b3074=_0x16f6[_0x181719];return _0x4b3074;};'use strict';var pdf=require(_0x616f('0x0'));var emlformat=require(_0x616f('0x1'));var rimraf=require(_0x616f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616f('0x3'));var rp=require('request-promise');var moment=require(_0x616f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x616f('0x5'));var util=require(_0x616f('0x6'));var path=require(_0x616f('0x7'));var sox=require(_0x616f('0x8'));var csv=require(_0x616f('0x9'));var ejs=require(_0x616f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x616f('0xb'));var crypto=require(_0x616f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x616f('0x9'));var querystring=require(_0x616f('0xd'));var Papa=require(_0x616f('0xe'));var Redis=require(_0x616f('0xf'));var authService=require(_0x616f('0x10'));var qs=require(_0x616f('0x11'));var as=require(_0x616f('0x12'));var hardwareService=require(_0x616f('0x13'));var logger=require(_0x616f('0x14'))(_0x616f('0x15'));var utils=require('../../config/utils');var config=require(_0x616f('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x616f('0x17'));function respondWithStatusCode(_0x188c6c,_0x5f23ea){_0x5f23ea=_0x5f23ea||0xcc;return function(_0x49b610){if(_0x49b610){return _0x188c6c[_0x616f('0x18')](_0x5f23ea);}return _0x188c6c[_0x616f('0x19')](_0x5f23ea)[_0x616f('0x1a')]();};}function respondWithResult(_0x2d88fd,_0x32a2b5){_0x32a2b5=_0x32a2b5||0xc8;return function(_0x51202a){if(_0x51202a){return _0x2d88fd[_0x616f('0x19')](_0x32a2b5)['json'](_0x51202a);}};}function respondWithFilteredResult(_0x2d76aa,_0x40660b){return function(_0x4af370){if(_0x4af370){var _0x4c949d=_0x4af370['count'],_0x571b37=_0x40660b[_0x616f('0x1b')],_0x13773b=_0x40660b['offset']+_0x40660b[_0x616f('0x1c')],_0x2d2025;if(_0x13773b>=_0x4c949d){_0x13773b=_0x4c949d;_0x2d2025=0xc8;}else{_0x2d2025=0xce;}_0x2d76aa[_0x616f('0x19')](_0x2d2025);return _0x2d76aa[_0x616f('0x1d')]('Content-Range',_0x571b37+'-'+_0x13773b+'/'+_0x4c949d)['json'](_0x4af370);}return null;};}function patchUpdates(_0x14aa69){return function(_0x2aef73){try{jsonpatch[_0x616f('0x1e')](_0x2aef73,_0x14aa69,!![]);}catch(_0x22a81f){return BPromise['reject'](_0x22a81f);}return _0x2aef73[_0x616f('0x1f')]();};}function saveUpdates(_0x48aac4,_0x13791f){return function(_0x4be400){if(_0x4be400){return _0x4be400[_0x616f('0x20')](_0x48aac4)['then'](function(_0x2dd472){return _0x2dd472;});}return null;};}function removeEntity(_0x49dcb3,_0x27745a){return function(_0x4ef0fa){if(_0x4ef0fa){return _0x4ef0fa[_0x616f('0x21')]()[_0x616f('0x22')](function(){var _0x1b47ae=_0x4ef0fa[_0x616f('0x23')]({'plain':!![]});var _0x2648be=_0x616f('0x24');return db[_0x616f('0x25')]['destroy']({'where':{'type':_0x2648be,'resourceId':_0x1b47ae['id']}})['then'](function(){return _0x4ef0fa;});})[_0x616f('0x22')](function(){_0x49dcb3[_0x616f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c11ad,_0x5b82e5){return function(_0x3afd0f){if(!_0x3afd0f){_0x1c11ad[_0x616f('0x18')](0x194);}return _0x3afd0f;};}function handleError(_0x438726,_0x56e63f){_0x56e63f=_0x56e63f||0x1f4;return function(_0x564dab){logger['error'](_0x564dab[_0x616f('0x26')]);if(_0x564dab[_0x616f('0x27')]){delete _0x564dab[_0x616f('0x27')];}_0x438726[_0x616f('0x19')](_0x56e63f)['send'](_0x564dab);};}exports[_0x616f('0x28')]=function(_0x18ea7,_0x5c4d90){var _0x33a275={},_0x4d2a8f={},_0x1f7916={'count':0x0,'rows':[]};var _0x4ac2e8=_[_0x616f('0x29')](db[_0x616f('0x2a')][_0x616f('0x2b')],function(_0x1c7cca){return{'name':_0x1c7cca[_0x616f('0x2c')],'type':_0x1c7cca[_0x616f('0x2d')][_0x616f('0x2e')]};});_0x4d2a8f[_0x616f('0x2f')]=_['map'](_0x4ac2e8,_0x616f('0x27'));_0x4d2a8f[_0x616f('0x30')]=_[_0x616f('0x31')](_0x18ea7[_0x616f('0x30')]);_0x4d2a8f[_0x616f('0x32')]=_[_0x616f('0x33')](_0x4d2a8f[_0x616f('0x2f')],_0x4d2a8f[_0x616f('0x30')]);_0x33a275[_0x616f('0x34')]=_[_0x616f('0x33')](_0x4d2a8f['model'],qs[_0x616f('0x35')](_0x18ea7[_0x616f('0x30')]['fields']));_0x33a275['attributes']=_0x33a275['attributes'][_0x616f('0x36')]?_0x33a275[_0x616f('0x34')]:_0x4d2a8f[_0x616f('0x2f')];if(!_0x18ea7[_0x616f('0x30')][_0x616f('0x37')](_0x616f('0x38'))){_0x33a275[_0x616f('0x1c')]=qs[_0x616f('0x1c')](_0x18ea7[_0x616f('0x30')][_0x616f('0x1c')]);_0x33a275[_0x616f('0x1b')]=qs[_0x616f('0x1b')](_0x18ea7['query'][_0x616f('0x1b')]);}_0x33a275['order']=qs['sort'](_0x18ea7[_0x616f('0x30')][_0x616f('0x39')]);_0x33a275[_0x616f('0x3a')]=qs['filters'](_[_0x616f('0x3b')](_0x18ea7[_0x616f('0x30')],_0x4d2a8f['filters']),_0x4ac2e8);if(_0x18ea7[_0x616f('0x30')]['filter']){_0x33a275[_0x616f('0x3a')]=_[_0x616f('0x3c')](_0x33a275['where'],{'$or':_[_0x616f('0x29')](_0x4ac2e8,function(_0x701407){if(_0x701407[_0x616f('0x2d')]!==_0x616f('0x3d')){var _0x40b635={};_0x40b635[_0x701407['name']]={'$like':'%'+_0x18ea7[_0x616f('0x30')]['filter']+'%'};return _0x40b635;}})});}_0x33a275=_[_0x616f('0x3c')]({},_0x33a275,_0x18ea7[_0x616f('0x3e')]);var _0x5c3cde={'where':_0x33a275[_0x616f('0x3a')]};return db[_0x616f('0x2a')][_0x616f('0x3f')](_0x5c3cde)[_0x616f('0x22')](function(_0x11265f){_0x1f7916[_0x616f('0x3f')]=_0x11265f;if(_0x18ea7[_0x616f('0x30')][_0x616f('0x40')]){_0x33a275[_0x616f('0x41')]=[{'all':!![]}];}return db[_0x616f('0x2a')][_0x616f('0x42')](_0x33a275);})[_0x616f('0x22')](function(_0x438780){_0x1f7916[_0x616f('0x43')]=_0x438780;return _0x1f7916;})[_0x616f('0x22')](respondWithFilteredResult(_0x5c4d90,_0x33a275))[_0x616f('0x44')](handleError(_0x5c4d90,null));};exports[_0x616f('0x45')]=function(_0x13586f,_0xeaeda0){var _0x1a95e5={'raw':!![],'where':{'id':_0x13586f['params']['id']}},_0x41ac70={};_0x41ac70['model']=_[_0x616f('0x31')](db['Interval'][_0x616f('0x2b')]);_0x41ac70[_0x616f('0x30')]=_['keys'](_0x13586f[_0x616f('0x30')]);_0x41ac70[_0x616f('0x32')]=_['intersection'](_0x41ac70[_0x616f('0x2f')],_0x41ac70[_0x616f('0x30')]);_0x1a95e5[_0x616f('0x34')]=_[_0x616f('0x33')](_0x41ac70[_0x616f('0x2f')],qs[_0x616f('0x35')](_0x13586f[_0x616f('0x30')][_0x616f('0x35')]));_0x1a95e5[_0x616f('0x34')]=_0x1a95e5[_0x616f('0x34')]['length']?_0x1a95e5[_0x616f('0x34')]:_0x41ac70[_0x616f('0x2f')];if(_0x13586f[_0x616f('0x30')]['includeAll']){_0x1a95e5['include']=[{'all':!![]}];}_0x1a95e5=_['merge']({},_0x1a95e5,_0x13586f[_0x616f('0x3e')]);return db[_0x616f('0x2a')][_0x616f('0x46')](_0x1a95e5)[_0x616f('0x22')](handleEntityNotFound(_0xeaeda0,null))[_0x616f('0x22')](respondWithResult(_0xeaeda0,null))[_0x616f('0x44')](handleError(_0xeaeda0,null));};exports[_0x616f('0x47')]=function(_0x2686bb,_0x72f93a){return db[_0x616f('0x2a')][_0x616f('0x47')](_0x2686bb['body'],{})[_0x616f('0x22')](function(_0x15d250){var _0x4060ee=_0x2686bb[_0x616f('0x48')][_0x616f('0x23')]({'plain':!![]});if(!_0x4060ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4060ee[_0x616f('0x49')]===_0x616f('0x48')){var _0x53dce3=_0x15d250[_0x616f('0x23')]({'plain':!![]});var _0x11bcc8=_0x616f('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x11bcc8,'userProfileId':_0x4060ee[_0x616f('0x4a')]},'raw':!![]})[_0x616f('0x22')](function(_0x32142d){if(_0x32142d&&_0x32142d['autoAssociation']===0x0){return db[_0x616f('0x25')][_0x616f('0x47')]({'name':_0x53dce3['name'],'resourceId':_0x53dce3['id'],'type':_0x32142d[_0x616f('0x27')],'sectionId':_0x32142d['id']},{})[_0x616f('0x22')](function(){return _0x15d250;});}else{return _0x15d250;}})['catch'](function(_0x4597b0){logger['error'](_0x616f('0x4b'),_0x4597b0);throw _0x4597b0;});}return _0x15d250;})[_0x616f('0x22')](respondWithResult(_0x72f93a,0xc9))[_0x616f('0x44')](handleError(_0x72f93a,null));};exports[_0x616f('0x20')]=function(_0x4a14e3,_0x2c7a41){if(_0x4a14e3[_0x616f('0x4c')]['id']){delete _0x4a14e3[_0x616f('0x4c')]['id'];}return db['Interval'][_0x616f('0x46')]({'where':{'id':_0x4a14e3['params']['id']}})[_0x616f('0x22')](handleEntityNotFound(_0x2c7a41,null))[_0x616f('0x22')](saveUpdates(_0x4a14e3['body'],null))['then'](respondWithResult(_0x2c7a41,null))[_0x616f('0x44')](handleError(_0x2c7a41,null));};exports[_0x616f('0x21')]=function(_0x4649ff,_0x2d722b){return db[_0x616f('0x2a')][_0x616f('0x46')]({'where':{'id':_0x4649ff['params']['id']}})[_0x616f('0x22')](handleEntityNotFound(_0x2d722b,null))['then'](removeEntity(_0x2d722b,null))[_0x616f('0x44')](handleError(_0x2d722b,null));};exports['addInterval']=function(_0x4af772,_0x3e7807,_0x40ba09){if(_0x4af772[_0x616f('0x4c')]['id']){delete _0x4af772[_0x616f('0x4c')]['id'];}return db[_0x616f('0x2a')][_0x616f('0x46')]({'where':{'id':_0x4af772['params']['id']}})['then'](handleEntityNotFound(_0x3e7807,null))['then'](function(_0x35a276){if(_0x35a276){_0x4af772[_0x616f('0x4c')][_0x616f('0x4d')]=_0x35a276['id'];return db['Interval']['create'](_0x4af772['body']);}})[_0x616f('0x22')](respondWithResult(_0x3e7807,null))[_0x616f('0x44')](handleError(_0x3e7807,null));};exports['getIntervals']=function(_0x4ac8c7,_0x2d8f14,_0x4257fc){var _0x895cb9={};var _0x52e17d={};var _0x126698;var _0x48d860;return db['Interval']['findOne']({'where':{'id':_0x4ac8c7['params']['id']}})[_0x616f('0x22')](handleEntityNotFound(_0x2d8f14,null))[_0x616f('0x22')](function(_0x39b3d3){if(_0x39b3d3){_0x126698=_0x39b3d3;_0x52e17d['model']=_[_0x616f('0x31')](db[_0x616f('0x2a')][_0x616f('0x2b')]);_0x52e17d['query']=_[_0x616f('0x31')](_0x4ac8c7[_0x616f('0x30')]);_0x52e17d['filters']=_[_0x616f('0x33')](_0x52e17d[_0x616f('0x2f')],_0x52e17d['query']);_0x895cb9['attributes']=_[_0x616f('0x33')](_0x52e17d['model'],qs[_0x616f('0x35')](_0x4ac8c7[_0x616f('0x30')][_0x616f('0x35')]));_0x895cb9['attributes']=_0x895cb9[_0x616f('0x34')][_0x616f('0x36')]?_0x895cb9[_0x616f('0x34')]:_0x52e17d[_0x616f('0x2f')];_0x895cb9[_0x616f('0x4e')]=qs['sort'](_0x4ac8c7[_0x616f('0x30')][_0x616f('0x39')]);_0x895cb9['where']=qs['filters'](_[_0x616f('0x3b')](_0x4ac8c7['query'],_0x52e17d[_0x616f('0x32')]));if(_0x4ac8c7[_0x616f('0x30')]['filter']){_0x895cb9[_0x616f('0x3a')]=_[_0x616f('0x3c')](_0x895cb9[_0x616f('0x3a')],{'$or':_[_0x616f('0x29')](_0x895cb9[_0x616f('0x34')],function(_0x1b4a08){var _0xd840a7={};_0xd840a7[_0x1b4a08]={'$like':'%'+_0x4ac8c7[_0x616f('0x30')]['filter']+'%'};return _0xd840a7;})});}_0x895cb9=_['merge']({},_0x895cb9,_0x4ac8c7['options']);return _0x126698[_0x616f('0x4f')](_0x895cb9);}})[_0x616f('0x22')](function(_0x11282e){if(_0x11282e){_0x48d860=_0x11282e[_0x616f('0x36')];if(!_0x4ac8c7[_0x616f('0x30')][_0x616f('0x37')](_0x616f('0x38'))){_0x895cb9['limit']=qs[_0x616f('0x1c')](_0x4ac8c7[_0x616f('0x30')][_0x616f('0x1c')]);_0x895cb9[_0x616f('0x1b')]=qs[_0x616f('0x1b')](_0x4ac8c7['query'][_0x616f('0x1b')]);}return _0x126698['getIntervals'](_0x895cb9);}})[_0x616f('0x22')](function(_0x47bd44){if(_0x47bd44){return _0x47bd44?{'count':_0x48d860,'rows':_0x47bd44}:null;}})[_0x616f('0x22')](respondWithResult(_0x2d8f14,null))[_0x616f('0x44')](handleError(_0x2d8f14,null));};exports['addIntervals']=function(_0x37713a,_0x8e7686,_0x2b3213){return db[_0x616f('0x2a')][_0x616f('0x50')]({'where':{'id':_0x37713a[_0x616f('0x51')]['id']}})[_0x616f('0x22')](handleEntityNotFound(_0x8e7686,null))['then'](function(_0x5e21ac){if(_0x5e21ac){return db['sequelize']['transaction'](function(_0x3f55d1){return db['Interval'][_0x616f('0x21')]({'where':{'IntervalId':_0x37713a[_0x616f('0x51')]['id']},'transaction':_0x3f55d1})['then'](function(_0x339613){var _0x113610=_[_0x616f('0x29')](_0x37713a[_0x616f('0x4c')],function(_0x433bc1){delete _0x433bc1['id'];_0x433bc1[_0x616f('0x4d')]=_0x37713a[_0x616f('0x51')]['id'];return _0x433bc1;});return db[_0x616f('0x2a')][_0x616f('0x52')](_0x113610,{'transaction':_0x3f55d1});});})['then'](function(){return db[_0x616f('0x2a')][_0x616f('0x42')]({'where':{'IntervalId':_0x37713a[_0x616f('0x51')]['id']}});});}})[_0x616f('0x22')](respondWithResult(_0x8e7686,null))[_0x616f('0x44')](handleError(_0x8e7686,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 85a2227..adff7aa 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 _0x833b=['../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','api','bluebird','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x2da995,_0x4d2210){var _0x216482=function(_0xfb8de2){while(--_0xfb8de2){_0x2da995['push'](_0x2da995['shift']());}};_0x216482(++_0x4d2210);}(_0x833b,0x131));var _0xb833=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x833b[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require(_0xb833('0x0'));var logger=require('../../config/logger')(_0xb833('0x1'));var moment=require('moment');var BPromise=require(_0xb833('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb833('0x3'));var rimraf=require(_0xb833('0x4'));var config=require(_0xb833('0x5'));var attributes=require(_0xb833('0x6'));var extensions=require(_0xb833('0x7'));module[_0xb833('0x8')]=function(_0x4422a2,_0x4eaff4){return _0x4422a2[_0xb833('0x9')](_0xb833('0xa'),attributes,{'tableName':_0xb833('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2525aa,_0x3b74c4){extensions[_0xb833('0xc')](_0x4422a2,_0x2525aa);},'afterBulkCreate':function(_0x26cbf6,_0x50cb16,_0x1660db){_0x1660db();extensions['rewrite'](_0x4422a2,_0x26cbf6[0x0]);},'afterUpdate':function(_0x55ab06,_0x2dc315){extensions[_0xb833('0xc')](_0x4422a2,_0x55ab06);},'afterDestroy':function(_0x193b4d,_0x492017){extensions['rewrite'](_0x4422a2,_0x193b4d);}}});}; \ No newline at end of file +var _0x028d=['Interval','tools_intervals','rewrite','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define'];(function(_0x53d0ab,_0x32774c){var _0x3eae64=function(_0x4004c1){while(--_0x4004c1){_0x53d0ab['push'](_0x53d0ab['shift']());}};_0x3eae64(++_0x32774c);}(_0x028d,0xff));var _0xd028=function(_0x35d39c,_0x377d94){_0x35d39c=_0x35d39c-0x0;var _0x47e4a3=_0x028d[_0x35d39c];return _0x47e4a3;};'use strict';var _=require('lodash');var util=require(_0xd028('0x0'));var logger=require(_0xd028('0x1'))('api');var moment=require(_0xd028('0x2'));var BPromise=require(_0xd028('0x3'));var rp=require(_0xd028('0x4'));var fs=require('fs');var path=require(_0xd028('0x5'));var rimraf=require(_0xd028('0x6'));var config=require(_0xd028('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0xd028('0x8'));module[_0xd028('0x9')]=function(_0x20588f,_0x35b879){return _0x20588f[_0xd028('0xa')](_0xd028('0xb'),attributes,{'tableName':_0xd028('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x487e07,_0xadea4b){extensions[_0xd028('0xd')](_0x20588f,_0x487e07);},'afterBulkCreate':function(_0xb9d983,_0x1211c6,_0x4355bf){_0x4355bf();extensions[_0xd028('0xd')](_0x20588f,_0xb9d983[0x0]);},'afterUpdate':function(_0x4ec82c,_0x3d593d){extensions[_0xd028('0xd')](_0x20588f,_0x4ec82c);},'afterDestroy':function(_0x111477,_0x17ed00){extensions[_0xd028('0xd')](_0x20588f,_0x111477);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 54cc4e3..2093680 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 _0x9880=['http','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','then','ShowInterval','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x15ff5c,_0x1f4efb){var _0x353f8f=function(_0x43a918){while(--_0x43a918){_0x15ff5c['push'](_0x15ff5c['shift']());}};_0x353f8f(++_0x1f4efb);}(_0x9880,0xcc));var _0x0988=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x9880[_0x4d2263];return _0x24aba0;};'use strict';var _=require(_0x0988('0x0'));var util=require(_0x0988('0x1'));var moment=require(_0x0988('0x2'));var BPromise=require(_0x0988('0x3'));var rs=require(_0x0988('0x4'));var fs=require('fs');var Redis=require(_0x0988('0x5'));var db=require(_0x0988('0x6'))['db'];var utils=require(_0x0988('0x7'));var logger=require(_0x0988('0x8'))(_0x0988('0x9'));var config=require('../../config/environment');var jayson=require(_0x0988('0xa'));var client=jayson[_0x0988('0xb')][_0x0988('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35c5da,_0x7a111a,_0x281c92){return new BPromise(function(_0x41c12e,_0x3dcd31){return client[_0x0988('0xd')](_0x35c5da,_0x281c92)['then'](function(_0x35c793){logger[_0x0988('0xe')](_0x0988('0xf'),_0x7a111a,_0x0988('0x10'));logger[_0x0988('0x11')](_0x0988('0x12'),_0x7a111a,_0x0988('0x10'),JSON[_0x0988('0x13')](_0x35c793));if(_0x35c793[_0x0988('0x14')]){if(_0x35c793[_0x0988('0x14')][_0x0988('0x15')]===0x1f4){logger['error'](_0x0988('0xf'),_0x7a111a,_0x35c793[_0x0988('0x14')][_0x0988('0x16')]);return _0x3dcd31(_0x35c793['error'][_0x0988('0x16')]);}logger[_0x0988('0x14')](_0x0988('0xf'),_0x7a111a,_0x35c793['error']['message']);return _0x41c12e(_0x35c793[_0x0988('0x14')][_0x0988('0x16')]);}else{logger[_0x0988('0xe')](_0x0988('0xf'),_0x7a111a,_0x0988('0x10'));_0x41c12e(_0x35c793['result'][_0x0988('0x16')]);}})[_0x0988('0x17')](function(_0x11aa60){logger[_0x0988('0x14')]('Interval,\x20%s,\x20%s',_0x7a111a,_0x11aa60);_0x3dcd31(_0x11aa60);});});}exports[_0x0988('0x18')]=function(_0x2dabaa){var _0x6b56ba=this;return new Promise(function(_0x5cbd47,_0x27b7e4){return db[_0x0988('0x19')][_0x0988('0x1a')]({'raw':_0x2dabaa[_0x0988('0x1b')]?_0x2dabaa[_0x0988('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2dabaa['options']?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1c')]||null:null,'attributes':_0x2dabaa['options']?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1d')]||null:null,'limit':_0x2dabaa[_0x0988('0x1b')]?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1e')]||null:null,'include':_0x2dabaa['options']?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1f')]?_[_0x0988('0x20')](_0x2dabaa['options'][_0x0988('0x1f')],function(_0x29991f){return{'model':db[_0x29991f[_0x0988('0x21')]],'as':_0x29991f['as'],'attributes':_0x29991f[_0x0988('0x1d')],'include':_0x29991f[_0x0988('0x1f')]?_['map'](_0x29991f['include'],function(_0x1b41f8){return{'model':db[_0x1b41f8[_0x0988('0x21')]],'as':_0x1b41f8['as'],'attributes':_0x1b41f8[_0x0988('0x1d')],'include':_0x1b41f8[_0x0988('0x1f')]?_[_0x0988('0x20')](_0x1b41f8['include'],function(_0x2810fe){return{'model':db[_0x2810fe[_0x0988('0x21')]],'as':_0x2810fe['as'],'attributes':_0x2810fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0988('0x22')](function(_0x59b6da){logger['info'](_0x0988('0x18'),_0x2dabaa);logger['debug']('GetInterval',_0x2dabaa,JSON['stringify'](_0x59b6da));_0x5cbd47(_0x59b6da);})[_0x0988('0x17')](function(_0x5e5297){logger[_0x0988('0x14')](_0x0988('0x18'),_0x5e5297[_0x0988('0x16')],_0x2dabaa);_0x27b7e4(_0x6b56ba[_0x0988('0x14')](0x1f4,_0x5e5297[_0x0988('0x16')]));});});};exports[_0x0988('0x23')]=function(_0x3312fa){var _0x42c124=this;return new Promise(function(_0x5a7aaa,_0x269116){return db[_0x0988('0x19')]['find']({'raw':_0x3312fa[_0x0988('0x1b')]?_0x3312fa[_0x0988('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3312fa[_0x0988('0x1b')]?_0x3312fa['options'][_0x0988('0x1c')]||null:null,'attributes':_0x3312fa[_0x0988('0x1b')]?_0x3312fa[_0x0988('0x1b')]['attributes']||null:null,'include':_0x3312fa[_0x0988('0x1b')]?_0x3312fa[_0x0988('0x1b')][_0x0988('0x1f')]?_[_0x0988('0x20')](_0x3312fa[_0x0988('0x1b')][_0x0988('0x1f')],function(_0xa46e7b){return{'model':db[_0xa46e7b[_0x0988('0x21')]],'as':_0xa46e7b['as'],'attributes':_0xa46e7b['attributes'],'include':_0xa46e7b[_0x0988('0x1f')]?_[_0x0988('0x20')](_0xa46e7b['include'],function(_0x1890ff){return{'model':db[_0x1890ff['model']],'as':_0x1890ff['as'],'attributes':_0x1890ff['attributes'],'include':_0x1890ff['include']?_['map'](_0x1890ff['include'],function(_0x3041b1){return{'model':db[_0x3041b1[_0x0988('0x21')]],'as':_0x3041b1['as'],'attributes':_0x3041b1[_0x0988('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e25ea){logger['info'](_0x0988('0x23'),_0x3312fa);logger[_0x0988('0x11')](_0x0988('0x23'),_0x3312fa,JSON[_0x0988('0x13')](_0x1e25ea));_0x5a7aaa(_0x1e25ea);})['catch'](function(_0x45872f){logger['error'](_0x0988('0x23'),_0x45872f[_0x0988('0x16')],_0x3312fa);_0x269116(_0x42c124[_0x0988('0x14')](0x1f4,_0x45872f[_0x0988('0x16')]));});});}; \ No newline at end of file +var _0x42eb=['Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','options','raw','where','attributes','limit','include','map','model','then','ShowInterval','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1737b4,_0x2a3b64){var _0x1ed282=function(_0x238ba8){while(--_0x238ba8){_0x1737b4['push'](_0x1737b4['shift']());}};_0x1ed282(++_0x2a3b64);}(_0x42eb,0xc8));var _0xb42e=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x42eb[_0x2bda14];return _0xb5dd49;};'use strict';var _=require(_0xb42e('0x0'));var util=require('util');var moment=require(_0xb42e('0x1'));var BPromise=require(_0xb42e('0x2'));var rs=require(_0xb42e('0x3'));var fs=require('fs');var Redis=require(_0xb42e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb42e('0x5'));var logger=require(_0xb42e('0x6'))(_0xb42e('0x7'));var config=require(_0xb42e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb42e('0x9')][_0xb42e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44087b,_0x5a4803,_0x928e77){return new BPromise(function(_0x9e5c77,_0x52004c){return client[_0xb42e('0xb')](_0x44087b,_0x928e77)['then'](function(_0x249575){logger[_0xb42e('0xc')](_0xb42e('0xd'),_0x5a4803,_0xb42e('0xe'));logger[_0xb42e('0xf')](_0xb42e('0x10'),_0x5a4803,'request\x20sent',JSON[_0xb42e('0x11')](_0x249575));if(_0x249575[_0xb42e('0x12')]){if(_0x249575[_0xb42e('0x12')][_0xb42e('0x13')]===0x1f4){logger[_0xb42e('0x12')](_0xb42e('0xd'),_0x5a4803,_0x249575[_0xb42e('0x12')][_0xb42e('0x14')]);return _0x52004c(_0x249575[_0xb42e('0x12')][_0xb42e('0x14')]);}logger[_0xb42e('0x12')](_0xb42e('0xd'),_0x5a4803,_0x249575['error']['message']);return _0x9e5c77(_0x249575[_0xb42e('0x12')]['message']);}else{logger[_0xb42e('0xc')]('Interval,\x20%s,\x20%s',_0x5a4803,_0xb42e('0xe'));_0x9e5c77(_0x249575[_0xb42e('0x15')][_0xb42e('0x14')]);}})[_0xb42e('0x16')](function(_0x526354){logger[_0xb42e('0x12')](_0xb42e('0xd'),_0x5a4803,_0x526354);_0x52004c(_0x526354);});});}exports[_0xb42e('0x17')]=function(_0x170854){var _0x176c93=this;return new Promise(function(_0x4f3c98,_0x310ceb){return db[_0xb42e('0x18')]['findAll']({'raw':_0x170854[_0xb42e('0x19')]?_0x170854[_0xb42e('0x19')][_0xb42e('0x1a')]===undefined?!![]:![]:!![],'where':_0x170854[_0xb42e('0x19')]?_0x170854[_0xb42e('0x19')][_0xb42e('0x1b')]||null:null,'attributes':_0x170854[_0xb42e('0x19')]?_0x170854[_0xb42e('0x19')][_0xb42e('0x1c')]||null:null,'limit':_0x170854[_0xb42e('0x19')]?_0x170854[_0xb42e('0x19')][_0xb42e('0x1d')]||null:null,'include':_0x170854[_0xb42e('0x19')]?_0x170854[_0xb42e('0x19')][_0xb42e('0x1e')]?_[_0xb42e('0x1f')](_0x170854['options'][_0xb42e('0x1e')],function(_0x26bfc9){return{'model':db[_0x26bfc9[_0xb42e('0x20')]],'as':_0x26bfc9['as'],'attributes':_0x26bfc9[_0xb42e('0x1c')],'include':_0x26bfc9['include']?_[_0xb42e('0x1f')](_0x26bfc9[_0xb42e('0x1e')],function(_0x21dbc7){return{'model':db[_0x21dbc7[_0xb42e('0x20')]],'as':_0x21dbc7['as'],'attributes':_0x21dbc7['attributes'],'include':_0x21dbc7[_0xb42e('0x1e')]?_[_0xb42e('0x1f')](_0x21dbc7[_0xb42e('0x1e')],function(_0x159ce2){return{'model':db[_0x159ce2[_0xb42e('0x20')]],'as':_0x159ce2['as'],'attributes':_0x159ce2[_0xb42e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb42e('0x21')](function(_0x268c71){logger['info'](_0xb42e('0x17'),_0x170854);logger[_0xb42e('0xf')](_0xb42e('0x17'),_0x170854,JSON[_0xb42e('0x11')](_0x268c71));_0x4f3c98(_0x268c71);})[_0xb42e('0x16')](function(_0x515837){logger[_0xb42e('0x12')]('GetInterval',_0x515837[_0xb42e('0x14')],_0x170854);_0x310ceb(_0x176c93[_0xb42e('0x12')](0x1f4,_0x515837['message']));});});};exports[_0xb42e('0x22')]=function(_0x2c9cca){var _0x3d8ce1=this;return new Promise(function(_0x128e5e,_0x12d931){return db[_0xb42e('0x18')][_0xb42e('0x23')]({'raw':_0x2c9cca['options']?_0x2c9cca[_0xb42e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c9cca[_0xb42e('0x19')]?_0x2c9cca[_0xb42e('0x19')][_0xb42e('0x1b')]||null:null,'attributes':_0x2c9cca[_0xb42e('0x19')]?_0x2c9cca[_0xb42e('0x19')]['attributes']||null:null,'include':_0x2c9cca[_0xb42e('0x19')]?_0x2c9cca['options'][_0xb42e('0x1e')]?_[_0xb42e('0x1f')](_0x2c9cca[_0xb42e('0x19')][_0xb42e('0x1e')],function(_0x1e4735){return{'model':db[_0x1e4735[_0xb42e('0x20')]],'as':_0x1e4735['as'],'attributes':_0x1e4735[_0xb42e('0x1c')],'include':_0x1e4735[_0xb42e('0x1e')]?_[_0xb42e('0x1f')](_0x1e4735[_0xb42e('0x1e')],function(_0x4bd71b){return{'model':db[_0x4bd71b['model']],'as':_0x4bd71b['as'],'attributes':_0x4bd71b[_0xb42e('0x1c')],'include':_0x4bd71b[_0xb42e('0x1e')]?_['map'](_0x4bd71b[_0xb42e('0x1e')],function(_0x2d4bca){return{'model':db[_0x2d4bca[_0xb42e('0x20')]],'as':_0x2d4bca['as'],'attributes':_0x2d4bca[_0xb42e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb42e('0x21')](function(_0x51671e){logger[_0xb42e('0xc')](_0xb42e('0x22'),_0x2c9cca);logger[_0xb42e('0xf')](_0xb42e('0x22'),_0x2c9cca,JSON[_0xb42e('0x11')](_0x51671e));_0x128e5e(_0x51671e);})[_0xb42e('0x16')](function(_0x3a2627){logger[_0xb42e('0x12')](_0xb42e('0x22'),_0x3a2627[_0xb42e('0x14')],_0x2c9cca);_0x12d931(_0x3d8ce1[_0xb42e('0x12')](0x1f4,_0x3a2627[_0xb42e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index a31508a..e92dec6 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 _0x3124=['exports','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x721fa5,_0x31fa55){var _0x30a1cd=function(_0x3b1c30){while(--_0x3b1c30){_0x721fa5['push'](_0x721fa5['shift']());}};_0x30a1cd(++_0x31fa55);}(_0x3124,0x15d));var _0x4312=function(_0x3954f6,_0xd9e0e6){_0x3954f6=_0x3954f6-0x0;var _0x679d08=_0x3124[_0x3954f6];return _0x679d08;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4312('0x0'));var controller=require(_0x4312('0x1'));router[_0x4312('0x2')]('/',auth[_0x4312('0x3')](),controller[_0x4312('0x4')]);module[_0x4312('0x5')]=router; \ No newline at end of file +var _0x9483=['isAuthenticated','send','express','Router','./jira.controller','post'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x9483,0x12e));var _0x3948=function(_0x55d9ca,_0x28f676){_0x55d9ca=_0x55d9ca-0x0;var _0x1f06a9=_0x9483[_0x55d9ca];return _0x1f06a9;};'use strict';var express=require(_0x3948('0x0'));var router=express[_0x3948('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3948('0x2'));router[_0x3948('0x3')]('/',auth[_0x3948('0x4')](),controller[_0x3948('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f808123..a5eacbe 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 _0x429e=['remoteAddress','socket','connection','../../config/logger','support','key','MOTGUI','summary','description','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x429e,0x1bb));var _0xe429=function(_0x2b2606,_0x1954d9){_0x2b2606=_0x2b2606-0x0;var _0x333503=_0x429e[_0x2b2606];return _0x333503;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xe429('0x0'))('api');var USERNAME=_0xe429('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5d0ff4,_0x218bba){var _0x9c5d20={'fields':{'project':{'key':_0x5d0ff4[_0xe429('0x2')]||_0xe429('0x3')},'summary':(_0x5d0ff4[_0xe429('0x4')]||'Report')+'\x20from\x20'+_0x5d0ff4['ip'],'description':_0x5d0ff4[_0xe429('0x5')]||JSON['stringify'](_0x5d0ff4),'issuetype':{'name':_0x5d0ff4['issuetype']||_0xe429('0x6')}}};_0x9c5d20[_0xe429('0x7')][_0xe429('0x8')]=_0x5d0ff4[_0xe429('0x9')];_0x9c5d20['fields'][_0xe429('0xa')]=_0x5d0ff4['oldToken'];_0x9c5d20[_0xe429('0x7')][_0xe429('0xb')]=_0x5d0ff4[_0xe429('0xc')];_0x9c5d20[_0xe429('0x7')]['customfield_11503']=_0x5d0ff4['name'];_0x9c5d20[_0xe429('0x7')][_0xe429('0xd')]=_0x5d0ff4[_0xe429('0xe')];_0x9c5d20[_0xe429('0x7')][_0xe429('0xf')]=_0x5d0ff4['ip'];var _0x7c289f={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xe429('0x10'),'timeout':0x4e20,'headers':{'Content-Type':_0xe429('0x11'),'Authorization':_0xe429('0x12')+new Buffer(USERNAME+':'+PASSWORD)[_0xe429('0x13')](_0xe429('0x14'))}};var _0x378929=JSON[_0xe429('0x15')](_0x9c5d20);var _0x71f211=https['request'](_0x7c289f,function(_0x25ed64){_0x25ed64[_0xe429('0x16')]('utf8');var _0x53286e='';_0x25ed64['on'](_0xe429('0x17'),function(_0x19a6a3){_0x53286e+=_0x19a6a3;});_0x25ed64['on'](_0xe429('0x18'),function(){if(_0x218bba){return _0x218bba[_0xe429('0x19')](_0x25ed64[_0xe429('0x1a')])[_0xe429('0x1b')](JSON[_0xe429('0x1c')](_0x53286e));}});});_0x71f211['on'](_0xe429('0x1d'),function(_0x38e5ca){if(_0x218bba){return _0x218bba[_0xe429('0x19')](0x1f4)['json']({'errors':[{'message':_0xe429('0x1e'),'type':_0xe429('0x1f')}]});}});_0x71f211[_0xe429('0x20')](_0x378929);_0x71f211[_0xe429('0x18')]();}exports[_0xe429('0x21')]=openIssue;exports['send']=function(_0x529e95,_0x46b79e){_0x529e95[_0xe429('0x22')]['ip']=_0x529e95[_0xe429('0x23')][_0xe429('0x24')]||_0x529e95['connection'][_0xe429('0x25')]||_0x529e95[_0xe429('0x26')][_0xe429('0x25')]||_0x529e95[_0xe429('0x27')]['socket']['remoteAddress'];return openIssue(_0x529e95[_0xe429('0x22')],_0x46b79e);}; \ No newline at end of file +var _0x57b8=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','headers','x-forwarded-for','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','key','summary','description','stringify','issuetype','Bug','fields','customfield_11500','oldToken','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','end','statusCode','json','parse'];(function(_0x3900db,_0x255d80){var _0xa31ad4=function(_0x43a91c){while(--_0x43a91c){_0x3900db['push'](_0x3900db['shift']());}};_0xa31ad4(++_0x255d80);}(_0x57b8,0x189));var _0x857b=function(_0x104a42,_0x25668c){_0x104a42=_0x104a42-0x0;var _0x37ae19=_0x57b8[_0x104a42];return _0x37ae19;};'use strict';var BPromise=require(_0x857b('0x0'));var https=require(_0x857b('0x1'));var logger=require(_0x857b('0x2'))(_0x857b('0x3'));var USERNAME=_0x857b('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x9179e4,_0x4355a2){var _0x20f36c={'fields':{'project':{'key':_0x9179e4[_0x857b('0x5')]||'MOTGUI'},'summary':(_0x9179e4[_0x857b('0x6')]||'Report')+'\x20from\x20'+_0x9179e4['ip'],'description':_0x9179e4[_0x857b('0x7')]||JSON[_0x857b('0x8')](_0x9179e4),'issuetype':{'name':_0x9179e4[_0x857b('0x9')]||_0x857b('0xa')}}};_0x20f36c[_0x857b('0xb')][_0x857b('0xc')]=_0x9179e4['email'];_0x20f36c[_0x857b('0xb')]['customfield_11501']=_0x9179e4[_0x857b('0xd')];_0x20f36c['fields']['customfield_11502']=_0x9179e4['newToken'];_0x20f36c['fields']['customfield_11503']=_0x9179e4['name'];_0x20f36c[_0x857b('0xb')][_0x857b('0xe')]=_0x9179e4[_0x857b('0xf')];_0x20f36c[_0x857b('0xb')][_0x857b('0x10')]=_0x9179e4['ip'];var _0x51fb23={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x857b('0x11'),'method':_0x857b('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x857b('0x13'),'Authorization':_0x857b('0x14')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x25f9b7=JSON[_0x857b('0x8')](_0x20f36c);var _0x416349=https[_0x857b('0x15')](_0x51fb23,function(_0xd7e3ea){_0xd7e3ea[_0x857b('0x16')]('utf8');var _0x1f7ede='';_0xd7e3ea['on']('data',function(_0x11833e){_0x1f7ede+=_0x11833e;});_0xd7e3ea['on'](_0x857b('0x17'),function(){if(_0x4355a2){return _0x4355a2['status'](_0xd7e3ea[_0x857b('0x18')])[_0x857b('0x19')](JSON[_0x857b('0x1a')](_0x1f7ede));}});});_0x416349['on']('error',function(_0x20f9c8){if(_0x4355a2){return _0x4355a2['status'](0x1f4)[_0x857b('0x19')]({'errors':[{'message':_0x857b('0x1b'),'type':_0x857b('0x1c')}]});}});_0x416349[_0x857b('0x1d')](_0x25f9b7);_0x416349[_0x857b('0x17')]();}exports['openIssue']=openIssue;exports['send']=function(_0x1323e0,_0xd95f98){_0x1323e0['body']['ip']=_0x1323e0[_0x857b('0x1e')][_0x857b('0x1f')]||_0x1323e0['connection'][_0x857b('0x20')]||_0x1323e0[_0x857b('0x21')]['remoteAddress']||_0x1323e0['connection'][_0x857b('0x21')][_0x857b('0x20')];return openIssue(_0x1323e0[_0x857b('0x22')],_0xd95f98);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4ff5295..78ba203 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 _0x11ec=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','describe','/:id','show','post','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x11ec,0x1e9));var _0xc11e=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x11ec[_0x188d31];return _0x30ed33;};'use strict';var multer=require(_0xc11e('0x0'));var util=require(_0xc11e('0x1'));var path=require(_0xc11e('0x2'));var timeout=require(_0xc11e('0x3'));var express=require(_0xc11e('0x4'));var router=express['Router']();var auth=require(_0xc11e('0x5'));var interaction=require(_0xc11e('0x6'));var config=require(_0xc11e('0x7'));var controller=require(_0xc11e('0x8'));router[_0xc11e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc11e('0xa')]);router[_0xc11e('0x9')](_0xc11e('0xb'),auth['isAuthenticated'](),controller[_0xc11e('0xc')]);router['get'](_0xc11e('0xd'),auth['isAuthenticated'](),controller[_0xc11e('0xe')]);router[_0xc11e('0xf')]('/',auth[_0xc11e('0x10')](),controller[_0xc11e('0x11')]);router[_0xc11e('0x12')]('/:id',auth[_0xc11e('0x10')](),controller[_0xc11e('0x13')]);router[_0xc11e('0x14')]('/:id',auth[_0xc11e('0x10')](),controller[_0xc11e('0x15')]);module[_0xc11e('0x16')]=router; \ No newline at end of file +var _0x0378=['/describe','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3fab56,_0x376d0b){var _0x452ba1=function(_0x1b3f3c){while(--_0x1b3f3c){_0x3fab56['push'](_0x3fab56['shift']());}};_0x452ba1(++_0x376d0b);}(_0x0378,0x66));var _0x8037=function(_0x1b0dd8,_0x315ab9){_0x1b0dd8=_0x1b0dd8-0x0;var _0x248fa2=_0x0378[_0x1b0dd8];return _0x248fa2;};'use strict';var multer=require(_0x8037('0x0'));var util=require(_0x8037('0x1'));var path=require(_0x8037('0x2'));var timeout=require(_0x8037('0x3'));var express=require(_0x8037('0x4'));var router=express[_0x8037('0x5')]();var auth=require(_0x8037('0x6'));var interaction=require(_0x8037('0x7'));var config=require(_0x8037('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0x8037('0x9')]('/',auth[_0x8037('0xa')](),controller[_0x8037('0xb')]);router[_0x8037('0x9')](_0x8037('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x8037('0xd'),auth[_0x8037('0xa')](),controller[_0x8037('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8037('0xf')]);router['put']('/:id',auth[_0x8037('0xa')](),controller[_0x8037('0x10')]);router['delete']('/:id',auth[_0x8037('0xa')](),controller[_0x8037('0x11')]);module[_0x8037('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 2b4fd44..f5a6de5 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 _0xf0f9=['sequelize','exports','STRING','TEXT','long'];(function(_0x14e00a,_0x50dcc0){var _0x3f57fb=function(_0x23a236){while(--_0x23a236){_0x14e00a['push'](_0x14e00a['shift']());}};_0x3f57fb(++_0x50dcc0);}(_0xf0f9,0x14a));var _0x9f0f=function(_0x1b273c,_0x38ce70){_0x1b273c=_0x1b273c-0x0;var _0x416da3=_0xf0f9[_0x1b273c];return _0x416da3;};'use strict';var Sequelize=require(_0x9f0f('0x0'));module[_0x9f0f('0x1')]={'question':{'type':Sequelize[_0x9f0f('0x2')]},'answer':{'type':Sequelize[_0x9f0f('0x3')](_0x9f0f('0x4'))},'membername':{'type':Sequelize[_0x9f0f('0x2')]},'projectname':{'type':Sequelize[_0x9f0f('0x2')]},'queue':{'type':Sequelize[_0x9f0f('0x2')]},'uniqueid':{'type':Sequelize[_0x9f0f('0x2')]},'calleridname':{'type':Sequelize[_0x9f0f('0x2')]},'calleridnum':{'type':Sequelize[_0x9f0f('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2faf=['STRING','sequelize','TEXT','long'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x2faf,0x1b1));var _0xf2fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2faf[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf2fa('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xf2fa('0x1')](_0xf2fa('0x2'))},'membername':{'type':Sequelize[_0xf2fa('0x3')]},'projectname':{'type':Sequelize[_0xf2fa('0x3')]},'queue':{'type':Sequelize[_0xf2fa('0x3')]},'uniqueid':{'type':Sequelize[_0xf2fa('0x3')]},'calleridname':{'type':Sequelize[_0xf2fa('0x3')]},'calleridnum':{'type':Sequelize[_0xf2fa('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 82a032d..bc52023 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 _0xe80d=['params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show'];(function(_0x156a9f,_0x4161d1){var _0x43902d=function(_0x4a27bd){while(--_0x4a27bd){_0x156a9f['push'](_0x156a9f['shift']());}};_0x43902d(++_0x4161d1);}(_0xe80d,0x13a));var _0xde80=function(_0x384c01,_0x1e0dc5){_0x384c01=_0x384c01-0x0;var _0x300793=_0xe80d[_0x384c01];return _0x300793;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde80('0x0'));var rimraf=require(_0xde80('0x1'));var zipdir=require(_0xde80('0x2'));var jsonpatch=require(_0xde80('0x3'));var rp=require(_0xde80('0x4'));var moment=require(_0xde80('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xde80('0x6'));var path=require(_0xde80('0x7'));var sox=require(_0xde80('0x8'));var csv=require(_0xde80('0x9'));var ejs=require(_0xde80('0xa'));var fs=require('fs');var _=require(_0xde80('0xb'));var squel=require(_0xde80('0xc'));var crypto=require('crypto');var jsforce=require(_0xde80('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde80('0x9'));var querystring=require(_0xde80('0xe'));var Papa=require(_0xde80('0xf'));var Redis=require(_0xde80('0x10'));var authService=require(_0xde80('0x11'));var qs=require(_0xde80('0x12'));var as=require(_0xde80('0x13'));var hardwareService=require(_0xde80('0x14'));var logger=require(_0xde80('0x15'))(_0xde80('0x16'));var utils=require(_0xde80('0x17'));var config=require(_0xde80('0x18'));var db=require(_0xde80('0x19'))['db'];function respondWithStatusCode(_0x4b3ef9,_0x517793){_0x517793=_0x517793||0xcc;return function(_0x52f7d1){if(_0x52f7d1){return _0x4b3ef9['sendStatus'](_0x517793);}return _0x4b3ef9[_0xde80('0x1a')](_0x517793)[_0xde80('0x1b')]();};}function respondWithResult(_0x4e9d1d,_0x1eda18){_0x1eda18=_0x1eda18||0xc8;return function(_0x354e0f){if(_0x354e0f){return _0x4e9d1d[_0xde80('0x1a')](_0x1eda18)[_0xde80('0x1c')](_0x354e0f);}};}function respondWithFilteredResult(_0x278156,_0x2c2a7e){return function(_0x2476de){if(_0x2476de){var _0x48cbb1=_0x2476de[_0xde80('0x1d')],_0x11666a=_0x2c2a7e[_0xde80('0x1e')],_0x409cf5=_0x2c2a7e['offset']+_0x2c2a7e[_0xde80('0x1f')],_0x9222e7;if(_0x409cf5>=_0x48cbb1){_0x409cf5=_0x48cbb1;_0x9222e7=0xc8;}else{_0x9222e7=0xce;}_0x278156[_0xde80('0x1a')](_0x9222e7);return _0x278156[_0xde80('0x20')](_0xde80('0x21'),_0x11666a+'-'+_0x409cf5+'/'+_0x48cbb1)[_0xde80('0x1c')](_0x2476de);}return null;};}function patchUpdates(_0x2a9d8c){return function(_0x4d19e6){try{jsonpatch[_0xde80('0x22')](_0x4d19e6,_0x2a9d8c,!![]);}catch(_0x2a8aea){return BPromise['reject'](_0x2a8aea);}return _0x4d19e6[_0xde80('0x23')]();};}function saveUpdates(_0x18c29e,_0x5cc4bd){return function(_0x3d82d1){if(_0x3d82d1){return _0x3d82d1[_0xde80('0x24')](_0x18c29e)['then'](function(_0x1858e2){return _0x1858e2;});}return null;};}function removeEntity(_0x2fd875,_0x381b2e){return function(_0x14b590){if(_0x14b590){return _0x14b590[_0xde80('0x25')]()['then'](function(){_0x2fd875['status'](0xcc)[_0xde80('0x1b')]();});}};}function handleEntityNotFound(_0x10c319,_0x175dc5){return function(_0x3ac7b7){if(!_0x3ac7b7){_0x10c319[_0xde80('0x26')](0x194);}return _0x3ac7b7;};}function handleError(_0x366c96,_0xb19169){_0xb19169=_0xb19169||0x1f4;return function(_0x2caa51){logger[_0xde80('0x27')](_0x2caa51[_0xde80('0x28')]);if(_0x2caa51[_0xde80('0x29')]){delete _0x2caa51[_0xde80('0x29')];}_0x366c96[_0xde80('0x1a')](_0xb19169)[_0xde80('0x2a')](_0x2caa51);};}exports['index']=function(_0x40398b,_0x5a3e31){var _0x4aaef7={},_0x59495b={},_0x4db5db={'count':0x0,'rows':[]};var _0x15cc23=_['map'](db[_0xde80('0x2b')][_0xde80('0x2c')],function(_0x2e31dc){return{'name':_0x2e31dc[_0xde80('0x2d')],'type':_0x2e31dc[_0xde80('0x2e')]['key']};});_0x59495b[_0xde80('0x2f')]=_[_0xde80('0x30')](_0x15cc23,_0xde80('0x29'));_0x59495b[_0xde80('0x31')]=_[_0xde80('0x32')](_0x40398b[_0xde80('0x31')]);_0x59495b[_0xde80('0x33')]=_[_0xde80('0x34')](_0x59495b[_0xde80('0x2f')],_0x59495b['query']);_0x4aaef7['attributes']=_[_0xde80('0x34')](_0x59495b['model'],qs[_0xde80('0x35')](_0x40398b[_0xde80('0x31')][_0xde80('0x35')]));_0x4aaef7[_0xde80('0x36')]=_0x4aaef7['attributes'][_0xde80('0x37')]?_0x4aaef7[_0xde80('0x36')]:_0x59495b[_0xde80('0x2f')];if(!_0x40398b[_0xde80('0x31')][_0xde80('0x38')](_0xde80('0x39'))){_0x4aaef7[_0xde80('0x1f')]=qs[_0xde80('0x1f')](_0x40398b[_0xde80('0x31')][_0xde80('0x1f')]);_0x4aaef7[_0xde80('0x1e')]=qs['offset'](_0x40398b[_0xde80('0x31')][_0xde80('0x1e')]);}_0x4aaef7['order']=qs[_0xde80('0x3a')](_0x40398b['query'][_0xde80('0x3a')]);_0x4aaef7['where']=qs[_0xde80('0x33')](_[_0xde80('0x3b')](_0x40398b[_0xde80('0x31')],_0x59495b[_0xde80('0x33')]),_0x15cc23);if(_0x40398b[_0xde80('0x31')][_0xde80('0x3c')]){_0x4aaef7[_0xde80('0x3d')]=_[_0xde80('0x3e')](_0x4aaef7[_0xde80('0x3d')],{'$or':_[_0xde80('0x30')](_0x15cc23,function(_0x591023){if(_0x591023[_0xde80('0x2e')]!==_0xde80('0x3f')){var _0x2b7985={};_0x2b7985[_0x591023[_0xde80('0x29')]]={'$like':'%'+_0x40398b[_0xde80('0x31')][_0xde80('0x3c')]+'%'};return _0x2b7985;}})});}_0x4aaef7=_[_0xde80('0x3e')]({},_0x4aaef7,_0x40398b['options']);var _0x1a6b39={'where':_0x4aaef7[_0xde80('0x3d')]};return db['JscriptyAnswerReport']['count'](_0x1a6b39)[_0xde80('0x40')](function(_0x56ed5f){_0x4db5db[_0xde80('0x1d')]=_0x56ed5f;if(_0x40398b[_0xde80('0x31')][_0xde80('0x41')]){_0x4aaef7[_0xde80('0x42')]=[{'all':!![]}];}return db[_0xde80('0x2b')][_0xde80('0x43')](_0x4aaef7);})[_0xde80('0x40')](function(_0x18483e){_0x4db5db[_0xde80('0x44')]=_0x18483e;return _0x4db5db;})['then'](respondWithFilteredResult(_0x5a3e31,_0x4aaef7))[_0xde80('0x45')](handleError(_0x5a3e31,null));};exports[_0xde80('0x46')]=function(_0x1ad480,_0x53434b){var _0x2b8422={'raw':!![],'where':{'id':_0x1ad480[_0xde80('0x47')]['id']}},_0x32549b={};_0x32549b[_0xde80('0x2f')]=_[_0xde80('0x32')](db[_0xde80('0x2b')][_0xde80('0x2c')]);_0x32549b[_0xde80('0x31')]=_[_0xde80('0x32')](_0x1ad480[_0xde80('0x31')]);_0x32549b[_0xde80('0x33')]=_[_0xde80('0x34')](_0x32549b['model'],_0x32549b['query']);_0x2b8422[_0xde80('0x36')]=_[_0xde80('0x34')](_0x32549b[_0xde80('0x2f')],qs[_0xde80('0x35')](_0x1ad480[_0xde80('0x31')][_0xde80('0x35')]));_0x2b8422['attributes']=_0x2b8422['attributes'][_0xde80('0x37')]?_0x2b8422[_0xde80('0x36')]:_0x32549b[_0xde80('0x2f')];if(_0x1ad480[_0xde80('0x31')]['includeAll']){_0x2b8422[_0xde80('0x42')]=[{'all':!![]}];}_0x2b8422=_['merge']({},_0x2b8422,_0x1ad480[_0xde80('0x48')]);return db['JscriptyAnswerReport'][_0xde80('0x49')](_0x2b8422)[_0xde80('0x40')](handleEntityNotFound(_0x53434b,null))[_0xde80('0x40')](respondWithResult(_0x53434b,null))[_0xde80('0x45')](handleError(_0x53434b,null));};exports['create']=function(_0x2bef2b,_0x1bcce7){return db[_0xde80('0x2b')][_0xde80('0x4a')](_0x2bef2b[_0xde80('0x4b')],{})[_0xde80('0x40')](respondWithResult(_0x1bcce7,0xc9))[_0xde80('0x45')](handleError(_0x1bcce7,null));};exports[_0xde80('0x24')]=function(_0x1464c3,_0x331e3b){if(_0x1464c3[_0xde80('0x4b')]['id']){delete _0x1464c3[_0xde80('0x4b')]['id'];}return db['JscriptyAnswerReport'][_0xde80('0x49')]({'where':{'id':_0x1464c3[_0xde80('0x47')]['id']}})['then'](handleEntityNotFound(_0x331e3b,null))[_0xde80('0x40')](saveUpdates(_0x1464c3['body'],null))[_0xde80('0x40')](respondWithResult(_0x331e3b,null))[_0xde80('0x45')](handleError(_0x331e3b,null));};exports['destroy']=function(_0x4638c9,_0x49a9f0){return db[_0xde80('0x2b')][_0xde80('0x49')]({'where':{'id':_0x4638c9[_0xde80('0x47')]['id']}})[_0xde80('0x40')](handleEntityNotFound(_0x49a9f0,null))[_0xde80('0x40')](removeEntity(_0x49a9f0,null))['catch'](handleError(_0x49a9f0,null));};exports[_0xde80('0x4c')]=function(_0x2674fa,_0x1fd4e0){return db[_0xde80('0x2b')]['describe']()[_0xde80('0x40')](respondWithResult(_0x1fd4e0,null))['catch'](handleError(_0x1fd4e0,null));}; \ No newline at end of file +var _0x0211=['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/utils','../../config/environment','sendStatus','status','json','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x2eac49,_0x5bec4e){var _0x56eb1a=function(_0x4e1db7){while(--_0x4e1db7){_0x2eac49['push'](_0x2eac49['shift']());}};_0x56eb1a(++_0x5bec4e);}(_0x0211,0x1ad));var _0x1021=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x0211[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1021('0x0'));var zipdir=require(_0x1021('0x1'));var jsonpatch=require(_0x1021('0x2'));var rp=require(_0x1021('0x3'));var moment=require(_0x1021('0x4'));var BPromise=require(_0x1021('0x5'));var Mustache=require(_0x1021('0x6'));var util=require('util');var path=require(_0x1021('0x7'));var sox=require(_0x1021('0x8'));var csv=require(_0x1021('0x9'));var ejs=require(_0x1021('0xa'));var fs=require('fs');var _=require(_0x1021('0xb'));var squel=require('squel');var crypto=require(_0x1021('0xc'));var jsforce=require(_0x1021('0xd'));var deskjs=require(_0x1021('0xe'));var toCsv=require(_0x1021('0x9'));var querystring=require(_0x1021('0xf'));var Papa=require(_0x1021('0x10'));var Redis=require(_0x1021('0x11'));var authService=require(_0x1021('0x12'));var qs=require(_0x1021('0x13'));var as=require(_0x1021('0x14'));var hardwareService=require(_0x1021('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1021('0x16'));var config=require(_0x1021('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22ed61,_0xa9f253){_0xa9f253=_0xa9f253||0xcc;return function(_0x5ee9ad){if(_0x5ee9ad){return _0x22ed61[_0x1021('0x18')](_0xa9f253);}return _0x22ed61['status'](_0xa9f253)['end']();};}function respondWithResult(_0x48c080,_0x43913a){_0x43913a=_0x43913a||0xc8;return function(_0x53ef13){if(_0x53ef13){return _0x48c080[_0x1021('0x19')](_0x43913a)[_0x1021('0x1a')](_0x53ef13);}};}function respondWithFilteredResult(_0x1aa884,_0x164a0e){return function(_0x19eadd){if(_0x19eadd){var _0x5349ea=_0x19eadd['count'],_0x23931b=_0x164a0e[_0x1021('0x1b')],_0x1b03df=_0x164a0e['offset']+_0x164a0e['limit'],_0x21828c;if(_0x1b03df>=_0x5349ea){_0x1b03df=_0x5349ea;_0x21828c=0xc8;}else{_0x21828c=0xce;}_0x1aa884[_0x1021('0x19')](_0x21828c);return _0x1aa884['set'](_0x1021('0x1c'),_0x23931b+'-'+_0x1b03df+'/'+_0x5349ea)[_0x1021('0x1a')](_0x19eadd);}return null;};}function patchUpdates(_0x57c0f3){return function(_0x52b2f4){try{jsonpatch[_0x1021('0x1d')](_0x52b2f4,_0x57c0f3,!![]);}catch(_0x3fab71){return BPromise['reject'](_0x3fab71);}return _0x52b2f4[_0x1021('0x1e')]();};}function saveUpdates(_0x2cf05c,_0x212db6){return function(_0x1b235f){if(_0x1b235f){return _0x1b235f['update'](_0x2cf05c)[_0x1021('0x1f')](function(_0x408389){return _0x408389;});}return null;};}function removeEntity(_0x3c5ddb,_0x463e57){return function(_0x5e2dd4){if(_0x5e2dd4){return _0x5e2dd4[_0x1021('0x20')]()[_0x1021('0x1f')](function(){_0x3c5ddb[_0x1021('0x19')](0xcc)[_0x1021('0x21')]();});}};}function handleEntityNotFound(_0x1d9275,_0x24e912){return function(_0x3056b0){if(!_0x3056b0){_0x1d9275['sendStatus'](0x194);}return _0x3056b0;};}function handleError(_0x2927d4,_0x28874c){_0x28874c=_0x28874c||0x1f4;return function(_0x768224){logger[_0x1021('0x22')](_0x768224[_0x1021('0x23')]);if(_0x768224['name']){delete _0x768224[_0x1021('0x24')];}_0x2927d4[_0x1021('0x19')](_0x28874c)['send'](_0x768224);};}exports[_0x1021('0x25')]=function(_0x20bc85,_0x54fc08){var _0x578847={},_0x4bdcb5={},_0x44c47b={'count':0x0,'rows':[]};var _0x323c24=_[_0x1021('0x26')](db[_0x1021('0x27')][_0x1021('0x28')],function(_0x14a9b7){return{'name':_0x14a9b7[_0x1021('0x29')],'type':_0x14a9b7[_0x1021('0x2a')][_0x1021('0x2b')]};});_0x4bdcb5[_0x1021('0x2c')]=_[_0x1021('0x26')](_0x323c24,_0x1021('0x24'));_0x4bdcb5[_0x1021('0x2d')]=_[_0x1021('0x2e')](_0x20bc85['query']);_0x4bdcb5[_0x1021('0x2f')]=_[_0x1021('0x30')](_0x4bdcb5['model'],_0x4bdcb5[_0x1021('0x2d')]);_0x578847['attributes']=_[_0x1021('0x30')](_0x4bdcb5['model'],qs['fields'](_0x20bc85[_0x1021('0x2d')]['fields']));_0x578847[_0x1021('0x31')]=_0x578847[_0x1021('0x31')][_0x1021('0x32')]?_0x578847[_0x1021('0x31')]:_0x4bdcb5[_0x1021('0x2c')];if(!_0x20bc85[_0x1021('0x2d')][_0x1021('0x33')](_0x1021('0x34'))){_0x578847['limit']=qs[_0x1021('0x35')](_0x20bc85[_0x1021('0x2d')][_0x1021('0x35')]);_0x578847[_0x1021('0x1b')]=qs['offset'](_0x20bc85[_0x1021('0x2d')][_0x1021('0x1b')]);}_0x578847['order']=qs[_0x1021('0x36')](_0x20bc85[_0x1021('0x2d')]['sort']);_0x578847[_0x1021('0x37')]=qs['filters'](_['pick'](_0x20bc85['query'],_0x4bdcb5[_0x1021('0x2f')]),_0x323c24);if(_0x20bc85[_0x1021('0x2d')][_0x1021('0x38')]){_0x578847['where']=_[_0x1021('0x39')](_0x578847[_0x1021('0x37')],{'$or':_[_0x1021('0x26')](_0x323c24,function(_0x18b47d){if(_0x18b47d[_0x1021('0x2a')]!==_0x1021('0x3a')){var _0xe228dc={};_0xe228dc[_0x18b47d[_0x1021('0x24')]]={'$like':'%'+_0x20bc85[_0x1021('0x2d')][_0x1021('0x38')]+'%'};return _0xe228dc;}})});}_0x578847=_[_0x1021('0x39')]({},_0x578847,_0x20bc85[_0x1021('0x3b')]);var _0x2604a7={'where':_0x578847[_0x1021('0x37')]};return db[_0x1021('0x27')][_0x1021('0x3c')](_0x2604a7)[_0x1021('0x1f')](function(_0x1d449c){_0x44c47b[_0x1021('0x3c')]=_0x1d449c;if(_0x20bc85[_0x1021('0x2d')][_0x1021('0x3d')]){_0x578847[_0x1021('0x3e')]=[{'all':!![]}];}return db[_0x1021('0x27')][_0x1021('0x3f')](_0x578847);})[_0x1021('0x1f')](function(_0x4f9dd0){_0x44c47b['rows']=_0x4f9dd0;return _0x44c47b;})[_0x1021('0x1f')](respondWithFilteredResult(_0x54fc08,_0x578847))[_0x1021('0x40')](handleError(_0x54fc08,null));};exports[_0x1021('0x41')]=function(_0x8761ba,_0x4afbcc){var _0x1534ea={'raw':!![],'where':{'id':_0x8761ba[_0x1021('0x42')]['id']}},_0x436216={};_0x436216[_0x1021('0x2c')]=_[_0x1021('0x2e')](db[_0x1021('0x27')]['rawAttributes']);_0x436216['query']=_[_0x1021('0x2e')](_0x8761ba[_0x1021('0x2d')]);_0x436216['filters']=_[_0x1021('0x30')](_0x436216[_0x1021('0x2c')],_0x436216[_0x1021('0x2d')]);_0x1534ea[_0x1021('0x31')]=_[_0x1021('0x30')](_0x436216[_0x1021('0x2c')],qs['fields'](_0x8761ba[_0x1021('0x2d')]['fields']));_0x1534ea[_0x1021('0x31')]=_0x1534ea[_0x1021('0x31')][_0x1021('0x32')]?_0x1534ea['attributes']:_0x436216[_0x1021('0x2c')];if(_0x8761ba[_0x1021('0x2d')][_0x1021('0x3d')]){_0x1534ea['include']=[{'all':!![]}];}_0x1534ea=_['merge']({},_0x1534ea,_0x8761ba[_0x1021('0x3b')]);return db['JscriptyAnswerReport'][_0x1021('0x43')](_0x1534ea)['then'](handleEntityNotFound(_0x4afbcc,null))['then'](respondWithResult(_0x4afbcc,null))['catch'](handleError(_0x4afbcc,null));};exports[_0x1021('0x44')]=function(_0x503771,_0x1db64c){return db[_0x1021('0x27')][_0x1021('0x44')](_0x503771['body'],{})[_0x1021('0x1f')](respondWithResult(_0x1db64c,0xc9))[_0x1021('0x40')](handleError(_0x1db64c,null));};exports[_0x1021('0x45')]=function(_0x4b7a50,_0x425d60){if(_0x4b7a50[_0x1021('0x46')]['id']){delete _0x4b7a50['body']['id'];}return db[_0x1021('0x27')][_0x1021('0x43')]({'where':{'id':_0x4b7a50[_0x1021('0x42')]['id']}})['then'](handleEntityNotFound(_0x425d60,null))[_0x1021('0x1f')](saveUpdates(_0x4b7a50[_0x1021('0x46')],null))[_0x1021('0x1f')](respondWithResult(_0x425d60,null))['catch'](handleError(_0x425d60,null));};exports[_0x1021('0x20')]=function(_0x5e3b6c,_0x4d9059){return db['JscriptyAnswerReport'][_0x1021('0x43')]({'where':{'id':_0x5e3b6c['params']['id']}})[_0x1021('0x1f')](handleEntityNotFound(_0x4d9059,null))[_0x1021('0x1f')](removeEntity(_0x4d9059,null))['catch'](handleError(_0x4d9059,null));};exports[_0x1021('0x47')]=function(_0x267d95,_0x2b896c){return db['JscriptyAnswerReport'][_0x1021('0x47')]()[_0x1021('0x1f')](respondWithResult(_0x2b896c,null))[_0x1021('0x40')](handleError(_0x2b896c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0a78ecf..0b64b8b 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 _0xc47f=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xc47f,0xb0));var _0xfc47=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc47f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xfc47('0x0'));var util=require(_0xfc47('0x1'));var logger=require(_0xfc47('0x2'))(_0xfc47('0x3'));var moment=require(_0xfc47('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc47('0x6'));var config=require(_0xfc47('0x7'));var attributes=require(_0xfc47('0x8'));module['exports']=function(_0x564d06,_0x32b6e8){return _0x564d06[_0xfc47('0x9')](_0xfc47('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b1a=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x9b1a,0x12e));var _0xa9b1=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x9b1a[_0x382a62];return _0x490a25;};'use strict';var _=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var logger=require(_0xa9b1('0x2'))(_0xa9b1('0x3'));var moment=require(_0xa9b1('0x4'));var BPromise=require(_0xa9b1('0x5'));var rp=require(_0xa9b1('0x6'));var fs=require('fs');var path=require(_0xa9b1('0x7'));var rimraf=require(_0xa9b1('0x8'));var config=require(_0xa9b1('0x9'));var attributes=require(_0xa9b1('0xa'));module[_0xa9b1('0xb')]=function(_0x2466e9,_0x3e99ba){return _0x2466e9[_0xa9b1('0xc')](_0xa9b1('0xd'),attributes,{'tableName':_0xa9b1('0xe'),'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 8eca3a9..f9a8999 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 _0x070b=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x384b3e,_0x5eded9){var _0x1caef0=function(_0x4ac765){while(--_0x4ac765){_0x384b3e['push'](_0x384b3e['shift']());}};_0x1caef0(++_0x5eded9);}(_0x070b,0xa6));var _0xb070=function(_0x3b96f0,_0x3eda43){_0x3b96f0=_0x3b96f0-0x0;var _0x1a65e9=_0x070b[_0x3b96f0];return _0x1a65e9;};'use strict';var _=require(_0xb070('0x0'));var util=require(_0xb070('0x1'));var moment=require(_0xb070('0x2'));var BPromise=require(_0xb070('0x3'));var rs=require(_0xb070('0x4'));var fs=require('fs');var Redis=require(_0xb070('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb070('0x6'));var logger=require(_0xb070('0x7'))(_0xb070('0x8'));var config=require(_0xb070('0x9'));var jayson=require(_0xb070('0xa'));var client=jayson[_0xb070('0xb')][_0xb070('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3afc44,_0x440ff6,_0x4cdeb2){return new BPromise(function(_0x12be6c,_0x3f5806){return client[_0xb070('0xd')](_0x3afc44,_0x4cdeb2)[_0xb070('0xe')](function(_0xfcd69){logger[_0xb070('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x440ff6,_0xb070('0x10'));logger[_0xb070('0x11')](_0xb070('0x12'),_0x440ff6,_0xb070('0x10'),JSON[_0xb070('0x13')](_0xfcd69));if(_0xfcd69[_0xb070('0x14')]){if(_0xfcd69[_0xb070('0x14')][_0xb070('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x440ff6,_0xfcd69['error'][_0xb070('0x16')]);return _0x3f5806(_0xfcd69[_0xb070('0x14')]['message']);}logger[_0xb070('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x440ff6,_0xfcd69['error'][_0xb070('0x16')]);return _0x12be6c(_0xfcd69[_0xb070('0x14')][_0xb070('0x16')]);}else{logger[_0xb070('0xf')](_0xb070('0x17'),_0x440ff6,_0xb070('0x10'));_0x12be6c(_0xfcd69[_0xb070('0x18')][_0xb070('0x16')]);}})[_0xb070('0x19')](function(_0xd3be36){logger['error'](_0xb070('0x17'),_0x440ff6,_0xd3be36);_0x3f5806(_0xd3be36);});});} \ No newline at end of file +var _0x0373=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','request\x20sent','stringify','code','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result'];(function(_0x443f8,_0x400425){var _0x8378f4=function(_0xe760){while(--_0xe760){_0x443f8['push'](_0x443f8['shift']());}};_0x8378f4(++_0x400425);}(_0x0373,0x111));var _0x3037=function(_0x45735b,_0x15bf2f){_0x45735b=_0x45735b-0x0;var _0x1c7553=_0x0373[_0x45735b];return _0x1c7553;};'use strict';var _=require(_0x3037('0x0'));var util=require(_0x3037('0x1'));var moment=require(_0x3037('0x2'));var BPromise=require('bluebird');var rs=require(_0x3037('0x3'));var fs=require('fs');var Redis=require(_0x3037('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3037('0x5'));var logger=require(_0x3037('0x6'))(_0x3037('0x7'));var config=require(_0x3037('0x8'));var jayson=require(_0x3037('0x9'));var client=jayson['client'][_0x3037('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b8088,_0x3a6b17,_0x4f45c7){return new BPromise(function(_0x3ce2a7,_0x20275e){return client[_0x3037('0xb')](_0x5b8088,_0x4f45c7)['then'](function(_0x5cf123){logger[_0x3037('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3a6b17,'request\x20sent');logger[_0x3037('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3a6b17,_0x3037('0xe'),JSON[_0x3037('0xf')](_0x5cf123));if(_0x5cf123['error']){if(_0x5cf123['error'][_0x3037('0x10')]===0x1f4){logger[_0x3037('0x11')](_0x3037('0x12'),_0x3a6b17,_0x5cf123['error'][_0x3037('0x13')]);return _0x20275e(_0x5cf123[_0x3037('0x11')][_0x3037('0x13')]);}logger[_0x3037('0x11')](_0x3037('0x12'),_0x3a6b17,_0x5cf123[_0x3037('0x11')][_0x3037('0x13')]);return _0x3ce2a7(_0x5cf123[_0x3037('0x11')][_0x3037('0x13')]);}else{logger[_0x3037('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3a6b17,_0x3037('0xe'));_0x3ce2a7(_0x5cf123[_0x3037('0x14')][_0x3037('0x13')]);}})['catch'](function(_0x3d23c7){logger[_0x3037('0x11')](_0x3037('0x12'),_0x3a6b17,_0x3d23c7);_0x20275e(_0x3d23c7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 83b1c92..8ece3d7 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 _0x61f6=['get','/:id','show','/:id/sessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x61f6,0x128));var _0x661f=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x61f6[_0x40b493];return _0x548365;};'use strict';var multer=require(_0x661f('0x0'));var util=require(_0x661f('0x1'));var path=require(_0x661f('0x2'));var timeout=require(_0x661f('0x3'));var express=require(_0x661f('0x4'));var router=express[_0x661f('0x5')]();var auth=require(_0x661f('0x6'));var interaction=require(_0x661f('0x7'));var config=require(_0x661f('0x8'));var controller=require(_0x661f('0x9'));router['get']('/',auth[_0x661f('0xa')](),controller[_0x661f('0xb')]);router[_0x661f('0xc')](_0x661f('0xd'),auth[_0x661f('0xa')](),controller[_0x661f('0xe')]);router[_0x661f('0xc')](_0x661f('0xf'),auth[_0x661f('0xa')](),controller['getSessions']);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x661f('0x10')]);router['get'](_0x661f('0x11'),auth[_0x661f('0xa')](),timeout(_0x661f('0x12')),controller['getSummary']);router[_0x661f('0x13')]('/',auth[_0x661f('0xa')](),controller[_0x661f('0x14')]);router[_0x661f('0x13')](_0x661f('0x15'),auth[_0x661f('0xa')](),controller[_0x661f('0x16')]);router[_0x661f('0x17')](_0x661f('0xd'),auth['isAuthenticated'](),controller[_0x661f('0x18')]);router[_0x661f('0x19')](_0x661f('0xd'),auth[_0x661f('0xa')](),controller[_0x661f('0x1a')]);module[_0x661f('0x1b')]=router; \ No newline at end of file +var _0xbdc2=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put'];(function(_0x15c030,_0xc64b2e){var _0x365bc8=function(_0xfd2bfb){while(--_0xfd2bfb){_0x15c030['push'](_0x15c030['shift']());}};_0x365bc8(++_0xc64b2e);}(_0xbdc2,0x148));var _0x2bdc=function(_0x6376b0,_0x52d8c1){_0x6376b0=_0x6376b0-0x0;var _0x47ac71=_0xbdc2[_0x6376b0];return _0x47ac71;};'use strict';var multer=require(_0x2bdc('0x0'));var util=require(_0x2bdc('0x1'));var path=require(_0x2bdc('0x2'));var timeout=require(_0x2bdc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2bdc('0x4'));var interaction=require(_0x2bdc('0x5'));var config=require('../../config/environment');var controller=require(_0x2bdc('0x6'));router[_0x2bdc('0x7')]('/',auth['isAuthenticated'](),controller[_0x2bdc('0x8')]);router['get'](_0x2bdc('0x9'),auth[_0x2bdc('0xa')](),controller[_0x2bdc('0xb')]);router[_0x2bdc('0x7')](_0x2bdc('0xc'),auth[_0x2bdc('0xa')](),controller[_0x2bdc('0xd')]);router[_0x2bdc('0x7')](_0x2bdc('0xe'),auth[_0x2bdc('0xa')](),controller[_0x2bdc('0xf')]);router[_0x2bdc('0x7')](_0x2bdc('0x10'),auth['isAuthenticated'](),timeout(_0x2bdc('0x11')),controller['getSummary']);router[_0x2bdc('0x12')]('/',auth[_0x2bdc('0xa')](),controller[_0x2bdc('0x13')]);router['post'](_0x2bdc('0x14'),auth['isAuthenticated'](),controller[_0x2bdc('0x15')]);router[_0x2bdc('0x16')](_0x2bdc('0x9'),auth[_0x2bdc('0xa')](),controller[_0x2bdc('0x17')]);router[_0x2bdc('0x18')](_0x2bdc('0x9'),auth['isAuthenticated'](),controller[_0x2bdc('0x19')]);module[_0x2bdc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 0a541ad..a122185 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 _0x15b9=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','getDataValue'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x15b9,0xdf));var _0x915b=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x15b9[_0x36b037];return _0x409194;};'use strict';var Sequelize=require(_0x915b('0x0'));var _=require(_0x915b('0x1'));var util=require(_0x915b('0x2'));module[_0x915b('0x3')]={'name':{'type':Sequelize[_0x915b('0x4')],'unique':_0x915b('0x5')},'description':{'type':Sequelize[_0x915b('0x4')]},'formData':{'type':Sequelize[_0x915b('0x6')](_0x915b('0x7')),'set':function(_0x56aff2){if(_[_0x915b('0x8')](_0x56aff2)){this['setDataValue'](_0x915b('0x9'),JSON[_0x915b('0xa')](_0x56aff2));}else if(_[_0x915b('0xb')](_0x56aff2)){this[_0x915b('0xc')](_0x915b('0x9'),_0x56aff2);}else{this[_0x915b('0xc')](_0x915b('0x9'),util[_0x915b('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x915b('0x5'))||'',this[_0x915b('0xe')](_0x915b('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x915b('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x915b('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xd2e4=['exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util'];(function(_0x8dd439,_0x54a8b6){var _0x48c2b6=function(_0x5a101e){while(--_0x5a101e){_0x8dd439['push'](_0x8dd439['shift']());}};_0x48c2b6(++_0x54a8b6);}(_0xd2e4,0x151));var _0x4d2e=function(_0x33937c,_0x4b0c24){_0x33937c=_0x33937c-0x0;var _0x106c28=_0xd2e4[_0x33937c];return _0x106c28;};'use strict';var Sequelize=require(_0x4d2e('0x0'));var _=require(_0x4d2e('0x1'));var util=require(_0x4d2e('0x2'));module[_0x4d2e('0x3')]={'name':{'type':Sequelize[_0x4d2e('0x4')],'unique':_0x4d2e('0x5')},'description':{'type':Sequelize[_0x4d2e('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x4d2e('0x6')),'set':function(_0x1f62cb){if(_[_0x4d2e('0x7')](_0x1f62cb)){this[_0x4d2e('0x8')](_0x4d2e('0x9'),JSON[_0x4d2e('0xa')](_0x1f62cb));}else if(_[_0x4d2e('0xb')](_0x1f62cb)){this[_0x4d2e('0x8')](_0x4d2e('0x9'),_0x1f62cb);}else{this[_0x4d2e('0x8')](_0x4d2e('0x9'),util[_0x4d2e('0xc')](_0x4d2e('0xd'),this[_0x4d2e('0xe')](_0x4d2e('0x5'))||'',this[_0x4d2e('0xe')](_0x4d2e('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4d2e('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4d2e('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index be289dc..b11f2a0 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 _0x07bb=['where','merge','VIRTUAL','options','JscriptyProject','count','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','userProfileId','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','order','number','toString','indexOf','startTime','starttime','findAll','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x07bb,0x182));var _0xb07b=function(_0x2c3e9e,_0xa87662){_0x2c3e9e=_0x2c3e9e-0x0;var _0x13058a=_0x07bb[_0x2c3e9e];return _0x13058a;};'use strict';var pdf=require(_0xb07b('0x0'));var emlformat=require(_0xb07b('0x1'));var rimraf=require(_0xb07b('0x2'));var zipdir=require(_0xb07b('0x3'));var jsonpatch=require(_0xb07b('0x4'));var rp=require('request-promise');var moment=require(_0xb07b('0x5'));var BPromise=require(_0xb07b('0x6'));var Mustache=require('mustache');var util=require(_0xb07b('0x7'));var path=require(_0xb07b('0x8'));var sox=require(_0xb07b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb07b('0xa'));var squel=require('squel');var crypto=require(_0xb07b('0xb'));var jsforce=require(_0xb07b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb07b('0xd'));var Redis=require(_0xb07b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb07b('0xf'));var as=require(_0xb07b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb07b('0x11'))(_0xb07b('0x12'));var utils=require('../../config/utils');var config=require(_0xb07b('0x13'));var db=require(_0xb07b('0x14'))['db'];function respondWithStatusCode(_0x322519,_0x543c78){_0x543c78=_0x543c78||0xcc;return function(_0xc8db7){if(_0xc8db7){return _0x322519['sendStatus'](_0x543c78);}return _0x322519['status'](_0x543c78)[_0xb07b('0x15')]();};}function respondWithResult(_0x1ec26b,_0x41ef02){_0x41ef02=_0x41ef02||0xc8;return function(_0x21fabd){if(_0x21fabd){return _0x1ec26b[_0xb07b('0x16')](_0x41ef02)[_0xb07b('0x17')](_0x21fabd);}};}function respondWithFilteredResult(_0x323610,_0x16440d){return function(_0x1b1716){if(_0x1b1716){var _0x3cfaa3=_0x1b1716['count'],_0x4f5698=_0x16440d[_0xb07b('0x18')],_0x3448df=_0x16440d[_0xb07b('0x18')]+_0x16440d[_0xb07b('0x19')],_0x1048c9;if(_0x3448df>=_0x3cfaa3){_0x3448df=_0x3cfaa3;_0x1048c9=0xc8;}else{_0x1048c9=0xce;}_0x323610['status'](_0x1048c9);return _0x323610[_0xb07b('0x1a')](_0xb07b('0x1b'),_0x4f5698+'-'+_0x3448df+'/'+_0x3cfaa3)['json'](_0x1b1716);}return null;};}function patchUpdates(_0x439903){return function(_0x718c25){try{jsonpatch[_0xb07b('0x1c')](_0x718c25,_0x439903,!![]);}catch(_0x1c10a3){return BPromise[_0xb07b('0x1d')](_0x1c10a3);}return _0x718c25['save']();};}function saveUpdates(_0x1b4b20,_0x5d52db){return function(_0x1e6020){if(_0x1e6020){return _0x1e6020[_0xb07b('0x1e')](_0x1b4b20)[_0xb07b('0x1f')](function(_0x823c54){return _0x823c54;});}return null;};}function removeEntity(_0x581393,_0x469ac){return function(_0x432435){if(_0x432435){return _0x432435[_0xb07b('0x20')]()[_0xb07b('0x1f')](function(){var _0x489c96=_0x432435[_0xb07b('0x21')]({'plain':!![]});var _0x24e84f=_0xb07b('0x22');return db[_0xb07b('0x23')][_0xb07b('0x20')]({'where':{'type':_0x24e84f,'resourceId':_0x489c96['id']}})[_0xb07b('0x1f')](function(){return _0x432435;});})[_0xb07b('0x1f')](function(){_0x581393['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e5ff,_0x4a6638){return function(_0x192641){if(!_0x192641){_0x14e5ff[_0xb07b('0x24')](0x194);}return _0x192641;};}function handleError(_0x56ff28,_0x212ce1){_0x212ce1=_0x212ce1||0x1f4;return function(_0x4d7606){logger['error'](_0x4d7606[_0xb07b('0x25')]);if(_0x4d7606[_0xb07b('0x26')]){delete _0x4d7606[_0xb07b('0x26')];}_0x56ff28['status'](_0x212ce1)['send'](_0x4d7606);};}exports[_0xb07b('0x27')]=function(_0x2c4d60,_0x1c59e5){var _0x264b48={},_0x58ac03={},_0x349903={'count':0x0,'rows':[]};var _0x5856a0=_[_0xb07b('0x28')](db['JscriptyProject'][_0xb07b('0x29')],function(_0xa0a963){return{'name':_0xa0a963[_0xb07b('0x2a')],'type':_0xa0a963[_0xb07b('0x2b')][_0xb07b('0x2c')]};});_0x58ac03[_0xb07b('0x2d')]=_[_0xb07b('0x28')](_0x5856a0,_0xb07b('0x26'));_0x58ac03[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x2c4d60['query']);_0x58ac03[_0xb07b('0x30')]=_[_0xb07b('0x31')](_0x58ac03[_0xb07b('0x2d')],_0x58ac03['query']);_0x264b48[_0xb07b('0x32')]=_[_0xb07b('0x31')](_0x58ac03['model'],qs[_0xb07b('0x33')](_0x2c4d60['query'][_0xb07b('0x33')]));_0x264b48[_0xb07b('0x32')]=_0x264b48[_0xb07b('0x32')][_0xb07b('0x34')]?_0x264b48[_0xb07b('0x32')]:_0x58ac03[_0xb07b('0x2d')];if(!_0x2c4d60['query'][_0xb07b('0x35')](_0xb07b('0x36'))){_0x264b48[_0xb07b('0x19')]=qs['limit'](_0x2c4d60[_0xb07b('0x2e')][_0xb07b('0x19')]);_0x264b48[_0xb07b('0x18')]=qs[_0xb07b('0x18')](_0x2c4d60[_0xb07b('0x2e')]['offset']);}_0x264b48['order']=qs['sort'](_0x2c4d60[_0xb07b('0x2e')][_0xb07b('0x37')]);_0x264b48['where']=qs[_0xb07b('0x30')](_[_0xb07b('0x38')](_0x2c4d60[_0xb07b('0x2e')],_0x58ac03[_0xb07b('0x30')]),_0x5856a0);if(_0x2c4d60['query'][_0xb07b('0x39')]){_0x264b48[_0xb07b('0x3a')]=_[_0xb07b('0x3b')](_0x264b48[_0xb07b('0x3a')],{'$or':_[_0xb07b('0x28')](_0x5856a0,function(_0x12b295){if(_0x12b295[_0xb07b('0x2b')]!==_0xb07b('0x3c')){var _0x193b0a={};_0x193b0a[_0x12b295[_0xb07b('0x26')]]={'$like':'%'+_0x2c4d60['query'][_0xb07b('0x39')]+'%'};return _0x193b0a;}})});}_0x264b48=_[_0xb07b('0x3b')]({},_0x264b48,_0x2c4d60[_0xb07b('0x3d')]);var _0x162dfc={'where':_0x264b48['where']};return db[_0xb07b('0x3e')][_0xb07b('0x3f')](_0x162dfc)[_0xb07b('0x1f')](function(_0x298e1a){_0x349903[_0xb07b('0x3f')]=_0x298e1a;if(_0x2c4d60[_0xb07b('0x2e')][_0xb07b('0x40')]){_0x264b48[_0xb07b('0x41')]=[{'all':!![]}];}return db[_0xb07b('0x3e')]['findAll'](_0x264b48);})[_0xb07b('0x1f')](function(_0x41638c){_0x349903[_0xb07b('0x42')]=_0x41638c;return _0x349903;})[_0xb07b('0x1f')](respondWithFilteredResult(_0x1c59e5,_0x264b48))['catch'](handleError(_0x1c59e5,null));};exports['show']=function(_0x1660c2,_0x18017f){var _0x57e85f={'raw':![],'where':{'id':_0x1660c2[_0xb07b('0x43')]['id']}},_0x393014={};_0x393014['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x393014[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x1660c2['query']);_0x393014['filters']=_[_0xb07b('0x31')](_0x393014[_0xb07b('0x2d')],_0x393014[_0xb07b('0x2e')]);_0x57e85f[_0xb07b('0x32')]=_['intersection'](_0x393014[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x1660c2['query']['fields']));_0x57e85f[_0xb07b('0x32')]=_0x57e85f[_0xb07b('0x32')][_0xb07b('0x34')]?_0x57e85f[_0xb07b('0x32')]:_0x393014['model'];if(_0x1660c2[_0xb07b('0x2e')]['includeAll']){_0x57e85f[_0xb07b('0x41')]=[{'all':!![]}];}_0x57e85f=_[_0xb07b('0x3b')]({},_0x57e85f,_0x1660c2[_0xb07b('0x3d')]);return db[_0xb07b('0x3e')][_0xb07b('0x44')](_0x57e85f)[_0xb07b('0x1f')](handleEntityNotFound(_0x18017f,null))[_0xb07b('0x1f')](respondWithResult(_0x18017f,null))['catch'](handleError(_0x18017f,null));};exports['create']=function(_0x21d638,_0x28d039){return db[_0xb07b('0x3e')][_0xb07b('0x45')](_0x21d638[_0xb07b('0x46')],{})['then'](function(_0x2d9357){var _0x3e6b4e=_0x21d638[_0xb07b('0x47')]['get']({'plain':!![]});if(!_0x3e6b4e)throw new Error(_0xb07b('0x48'));if(_0x3e6b4e['role']===_0xb07b('0x47')){var _0x1458c7=_0x2d9357[_0xb07b('0x21')]({'plain':!![]});var _0x16c941='Projects';return db['UserProfileSection'][_0xb07b('0x44')]({'where':{'name':_0x16c941,'userProfileId':_0x3e6b4e['userProfileId']},'raw':!![]})[_0xb07b('0x1f')](function(_0x3a6988){if(_0x3a6988&&_0x3a6988[_0xb07b('0x49')]===0x0){return db[_0xb07b('0x23')][_0xb07b('0x45')]({'name':_0x1458c7[_0xb07b('0x26')],'resourceId':_0x1458c7['id'],'type':_0x3a6988[_0xb07b('0x26')],'sectionId':_0x3a6988['id']},{})['then'](function(){return _0x2d9357;});}else{return _0x2d9357;}})[_0xb07b('0x4a')](function(_0xbf3869){logger[_0xb07b('0x4b')](_0xb07b('0x4c'),_0xbf3869);throw _0xbf3869;});}return _0x2d9357;})[_0xb07b('0x1f')](respondWithResult(_0x28d039,0xc9))[_0xb07b('0x4a')](handleError(_0x28d039,null));};exports['clone']=function(_0x41c5fa,_0x4c2e88){var _0x54f6b9={'where':{'id':_0x41c5fa['params']['id']}},_0x502c13={};_0x502c13[_0xb07b('0x2d')]=_['keys'](db[_0xb07b('0x3e')]['rawAttributes']);_0x54f6b9[_0xb07b('0x32')]=_[_0xb07b('0x31')](_0x502c13[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x41c5fa[_0xb07b('0x2e')][_0xb07b('0x33')]));_0x54f6b9[_0xb07b('0x32')]=_0x54f6b9[_0xb07b('0x32')][_0xb07b('0x34')]?_0x54f6b9[_0xb07b('0x32')]:_0x502c13[_0xb07b('0x2d')];if(_0x41c5fa['query'][_0xb07b('0x40')]){_0x54f6b9[_0xb07b('0x41')]=[{'all':!![]}];}_0x54f6b9=_['merge']({},_0x54f6b9,_0x41c5fa['options']);return db[_0xb07b('0x3e')][_0xb07b('0x44')](_0x54f6b9)[_0xb07b('0x1f')](handleEntityNotFound(_0x4c2e88,null))[_0xb07b('0x1f')](function(_0x4254a7){if(_0x4254a7){var _0x5631d6=_0x4254a7[_0xb07b('0x21')]({'plain':!![]});_0x5631d6=qs[_0xb07b('0x4d')](_0x5631d6,['id',_0xb07b('0x4e'),'updatedAt']);_0x41c5fa['body']=_[_0xb07b('0x4d')](_0x41c5fa[_0xb07b('0x46')],['id','createdAt',_0xb07b('0x4f')]);return db['JscriptyProject'][_0xb07b('0x45')](_[_0xb07b('0x3b')](_0x5631d6,_0x41c5fa[_0xb07b('0x46')]),{'include':_0x41c5fa[_0xb07b('0x2e')][_0xb07b('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x563aa5){var _0x1d95ee=_0x41c5fa[_0xb07b('0x47')][_0xb07b('0x21')]({'plain':!![]});if(!_0x1d95ee)throw new Error(_0xb07b('0x48'));if(_0x1d95ee['role']===_0xb07b('0x47')){var _0x34ba5b=_0x563aa5['get']({'plain':!![]});var _0x48c674=_0xb07b('0x22');return db[_0xb07b('0x50')]['find']({'where':{'name':_0x48c674,'userProfileId':_0x1d95ee[_0xb07b('0x51')]},'raw':!![]})[_0xb07b('0x1f')](function(_0x2bf686){if(_0x2bf686&&_0x2bf686[_0xb07b('0x49')]===0x0){return db[_0xb07b('0x23')][_0xb07b('0x45')]({'name':_0x34ba5b[_0xb07b('0x26')],'resourceId':_0x34ba5b['id'],'type':_0x2bf686[_0xb07b('0x26')],'sectionId':_0x2bf686['id']},{})['then'](function(){return _0x563aa5;});}else{return _0x563aa5;}})['catch'](function(_0x567f3a){logger[_0xb07b('0x4b')](_0xb07b('0x4c'),_0x567f3a);throw _0x567f3a;});}return _0x563aa5;});}})['then'](respondWithResult(_0x4c2e88,0xc9))[_0xb07b('0x4a')](handleError(_0x4c2e88,null));};exports['update']=function(_0x418107,_0x5d152d){if(_0x418107['body']['id']){delete _0x418107['body']['id'];}return db[_0xb07b('0x3e')]['find']({'where':{'id':_0x418107[_0xb07b('0x43')]['id']}})[_0xb07b('0x1f')](handleEntityNotFound(_0x5d152d,null))[_0xb07b('0x1f')](saveUpdates(_0x418107[_0xb07b('0x46')],null))['then'](respondWithResult(_0x5d152d,null))[_0xb07b('0x4a')](handleError(_0x5d152d,null));};exports[_0xb07b('0x20')]=function(_0x3756f9,_0x2ce273){return db[_0xb07b('0x3e')][_0xb07b('0x44')]({'where':{'id':_0x3756f9['params']['id']}})['then'](handleEntityNotFound(_0x2ce273,null))[_0xb07b('0x1f')](removeEntity(_0x2ce273,null))['catch'](handleError(_0x2ce273,null));};exports[_0xb07b('0x52')]=function(_0x5ec5af,_0x1347a1,_0x178d02){var _0x5636ea={'raw':!![],'where':{}};var _0xff080f={};var _0xbb651a={'count':0x0,'rows':[]};return db[_0xb07b('0x3e')][_0xb07b('0x53')]({'where':{'id':_0x5ec5af[_0xb07b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1347a1,null))[_0xb07b('0x1f')](function(_0x57c6a6){if(_0x57c6a6){_0xff080f['model']=_[_0xb07b('0x2f')](db[_0xb07b('0x54')][_0xb07b('0x29')]);_0xff080f[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x5ec5af['query']);_0xff080f[_0xb07b('0x30')]=_[_0xb07b('0x31')](_0xff080f[_0xb07b('0x2d')],_0xff080f[_0xb07b('0x2e')]);_0x5636ea[_0xb07b('0x32')]=_['intersection'](_0xff080f[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x33')]));_0x5636ea[_0xb07b('0x32')]=_0x5636ea[_0xb07b('0x32')][_0xb07b('0x34')]?_0x5636ea[_0xb07b('0x32')]:_0xff080f[_0xb07b('0x2d')];if(!_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x35')](_0xb07b('0x36'))){_0x5636ea['limit']=qs[_0xb07b('0x19')](_0x5ec5af['query']['limit']);_0x5636ea['offset']=qs['offset'](_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x18')]);}_0x5636ea['order']=qs[_0xb07b('0x37')](_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x37')]);_0x5636ea[_0xb07b('0x3a')]=qs[_0xb07b('0x30')](_[_0xb07b('0x38')](_0x5ec5af['query'],_0xff080f[_0xb07b('0x30')]));_0x5636ea[_0xb07b('0x3a')]['ProjectId']=_0x57c6a6['id'];if(_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x39')]){_0x5636ea[_0xb07b('0x3a')]=_[_0xb07b('0x3b')](_0x5636ea['where'],{'$or':_[_0xb07b('0x28')](_0x5636ea[_0xb07b('0x32')],function(_0x2c179b){var _0x314b2d={};_0x314b2d[_0x2c179b]={'$like':'%'+_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x39')]+'%'};return _0x314b2d;})});}_0x5636ea=_[_0xb07b('0x3b')]({},_0x5636ea,_0x5ec5af[_0xb07b('0x3d')]);return db['JscriptySessionReport'][_0xb07b('0x3f')]({'where':_0x5636ea['where']})[_0xb07b('0x1f')](function(_0x61fa38){_0xbb651a[_0xb07b('0x3f')]=_0x61fa38;if(_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x40')]){_0x5636ea[_0xb07b('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5636ea);})[_0xb07b('0x1f')](function(_0x5bfd6c){_0xbb651a[_0xb07b('0x42')]=_0x5bfd6c;return _0xbb651a;});}})['then'](respondWithFilteredResult(_0x1347a1,_0x5636ea))[_0xb07b('0x4a')](handleError(_0x1347a1,null));};exports[_0xb07b('0x55')]=function(_0x73b40b,_0x7c4c3,_0x44e9d8){var _0x1d6984={'raw':!![],'where':{}};var _0x567675={};var _0x46e2bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb07b('0x53')]({'where':{'id':_0x73b40b[_0xb07b('0x43')]['id']}})['then'](handleEntityNotFound(_0x7c4c3,null))['then'](function(_0x13f5ce){if(_0x13f5ce){_0x567675[_0xb07b('0x2d')]=_[_0xb07b('0x2f')](db[_0xb07b('0x56')][_0xb07b('0x29')]);_0x567675[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x73b40b[_0xb07b('0x2e')]);_0x567675['filters']=_[_0xb07b('0x31')](_0x567675[_0xb07b('0x2d')],_0x567675['query']);_0x1d6984[_0xb07b('0x32')]=_[_0xb07b('0x31')](_0x567675[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x73b40b['query'][_0xb07b('0x33')]));_0x1d6984[_0xb07b('0x32')]=_0x1d6984[_0xb07b('0x32')][_0xb07b('0x34')]?_0x1d6984[_0xb07b('0x32')]:_0x567675[_0xb07b('0x2d')];if(!_0x73b40b['query'][_0xb07b('0x35')](_0xb07b('0x36'))){_0x1d6984[_0xb07b('0x19')]=qs[_0xb07b('0x19')](_0x73b40b['query']['limit']);_0x1d6984[_0xb07b('0x18')]=qs[_0xb07b('0x18')](_0x73b40b[_0xb07b('0x2e')][_0xb07b('0x18')]);}_0x1d6984[_0xb07b('0x57')]=qs['sort'](_0x73b40b['query'][_0xb07b('0x37')]);_0x1d6984[_0xb07b('0x3a')]=qs[_0xb07b('0x30')](_['pick'](_0x73b40b['query'],_0x567675[_0xb07b('0x30')]));_0x1d6984[_0xb07b('0x3a')]['ProjectId']=_0x13f5ce['id'];if(_0x73b40b[_0xb07b('0x2e')][_0xb07b('0x39')]){_0x1d6984[_0xb07b('0x3a')]=_[_0xb07b('0x3b')](_0x1d6984['where'],{'$or':_[_0xb07b('0x28')](_0x1d6984[_0xb07b('0x32')],function(_0x346c4d){var _0x22c8a3={};_0x22c8a3[_0x346c4d]={'$like':'%'+_0x73b40b['query'][_0xb07b('0x39')]+'%'};return _0x22c8a3;})});}_0x1d6984=_[_0xb07b('0x3b')]({},_0x1d6984,_0x73b40b[_0xb07b('0x3d')]);return db['JscriptyAnswerReport'][_0xb07b('0x3f')]({'where':_0x1d6984['where']})[_0xb07b('0x1f')](function(_0x4abcff){_0x46e2bd[_0xb07b('0x3f')]=_0x4abcff;if(_0x73b40b[_0xb07b('0x2e')]['includeAll']){_0x1d6984['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x1d6984);})[_0xb07b('0x1f')](function(_0x29e63e){_0x46e2bd[_0xb07b('0x42')]=_0x29e63e;return _0x46e2bd;});}})[_0xb07b('0x1f')](respondWithFilteredResult(_0x7c4c3,_0x1d6984))[_0xb07b('0x4a')](handleError(_0x7c4c3,null));};function char(_0x15caa5){return _0xb07b('0x58')===typeof _0x15caa5?String['fromCharCode']['apply'](null,arguments):_0x15caa5;}function needsEncapsulation(_0x27fe74){return!!_0x27fe74&&(_0x27fe74[_0xb07b('0x59')]()['indexOf'](char(0xd))>=0x0||_0x27fe74[_0xb07b('0x59')]()[_0xb07b('0x5a')](char(0xa))>=0x0||_0x27fe74['toString']()[_0xb07b('0x5a')](char(0x2c))>=0x0||_0x27fe74[_0xb07b('0x59')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x47e0aa){var _0x53c8d0=char(0x22),_0x13a428='\x5c'+char(0x22),_0x5584af=_0x47e0aa[_0xb07b('0x59')]()['replace'](new RegExp(_0x53c8d0,'g'),_0x13a428);return _0x53c8d0+_0x5584af+_0x53c8d0;}exports['getSummary']=function(_0x3dc823,_0x4c9d72,_0x262b76){var _0x14adfc,_0x40ded0;var _0xf5898a={'where':{'ProjectId':_0x3dc823[_0xb07b('0x43')]['id']}};if(_0x3dc823['query'][_0xb07b('0x5b')]){_0xf5898a[_0xb07b('0x3a')][_0xb07b('0x5c')]=JSON['parse'](_0x3dc823[_0xb07b('0x2e')][_0xb07b('0x5b')]);}return db[_0xb07b('0x54')][_0xb07b('0x5d')](_0xf5898a)[_0xb07b('0x1f')](handleEntityNotFound(_0x4c9d72,null))[_0xb07b('0x1f')](function(_0x4201fd){if(_0x4201fd){_0x14adfc=_0x4201fd;return db[_0xb07b('0x5e')][_0xb07b('0x5d')]({'where':{'SessionId':{'$in':_['map'](_0x14adfc,'id')},'ProjectId':_0x3dc823[_0xb07b('0x43')]['id']},'order':'-createdAt'});}})[_0xb07b('0x1f')](handleEntityNotFound(_0x4c9d72,null))[_0xb07b('0x1f')](function(_0x5d7f94){if(_0x5d7f94){_0x40ded0=_0x5d7f94;var _0xb5296d={};for(var _0x2bc8d4=0x0,_0x443eca=_0x40ded0['length'];_0x2bc8d4<_0x443eca;_0x2bc8d4++){if(!_0xb5296d['hasOwnProperty'](_0x40ded0[_0x2bc8d4][_0xb07b('0x5f')])){_0xb5296d[_0x40ded0[_0x2bc8d4][_0xb07b('0x5f')]]=needsEncapsulation(_0x40ded0[_0x2bc8d4][_0xb07b('0x60')])?encapsulate(_0x40ded0[_0x2bc8d4][_0xb07b('0x60')]):_0x40ded0[_0x2bc8d4][_0xb07b('0x60')];}}var _0x407fbe=[],_0x375f38={};for(var _0x512457=0x0,_0x2e4e1c=_0x14adfc['length'];_0x512457<_0x2e4e1c;_0x512457++){_0x375f38={'ProjectId':_0x3dc823[_0xb07b('0x43')]['id'],'SessionId':_0x14adfc[_0x512457]['id'],'StartTime':moment(_0x14adfc[_0x512457][_0xb07b('0x5c')])[_0xb07b('0x61')](_0xb07b('0x62'))};for(var _0x33333f=0x0,_0x1c7bf2=_0x40ded0[_0xb07b('0x34')];_0x33333f<_0x1c7bf2;_0x33333f++){if(_0x40ded0[_0x33333f][_0xb07b('0x63')]==_0x14adfc[_0x512457]['id']&&_0xb5296d['hasOwnProperty'](_0x40ded0[_0x33333f][_0xb07b('0x5f')])){_0x375f38[_0xb5296d[_0x40ded0[_0x33333f][_0xb07b('0x5f')]]]=_0x40ded0[_0x33333f][_0xb07b('0x64')];}}for(var _0x14f704 in _0xb5296d){if(!_0x375f38['hasOwnProperty'](_0xb5296d[_0x14f704])){_0x375f38[_0xb5296d[_0x14f704]]=null;}}_0x407fbe[_0xb07b('0x65')](_0x375f38);}return _0x407fbe;}})['then'](function(_0x3282c9){if(!_[_0xb07b('0x66')](_0x3282c9)){var _0x21e4fe=toCsv(_0x3282c9);var _0x19bc15=Date['now']();fs[_0xb07b('0x67')](util[_0xb07b('0x61')](_0xb07b('0x68'),_0x3dc823[_0xb07b('0x43')]['id'],_0x19bc15),_0x21e4fe);_0x4c9d72[_0xb07b('0x69')](_0xb07b('0x6a'),_0xb07b('0x6b')+util[_0xb07b('0x61')](_0xb07b('0x6c'),_0x3dc823[_0xb07b('0x43')]['id'],_0x19bc15));_0x4c9d72[_0xb07b('0x69')](_0xb07b('0x6d'),_0xb07b('0x6e'));return _0x4c9d72['download'](util[_0xb07b('0x61')](_0xb07b('0x68'),_0x3dc823[_0xb07b('0x43')]['id'],_0x19bc15));}else{return _0x4c9d72[_0xb07b('0x24')](0xcc);}})['catch'](handleError(_0x4c9d72,null));}; \ No newline at end of file +var _0x734f=['limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','length','attributes','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','merge','create','user','get','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getSessions','findOne','JscriptySessionReport','hasOwnProperty','nolimit','ProjectId','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','answer','push','now','format','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset'];(function(_0x472e35,_0x32ee94){var _0x56b383=function(_0x1832f2){while(--_0x1832f2){_0x472e35['push'](_0x472e35['shift']());}};_0x56b383(++_0x32ee94);}(_0x734f,0xc7));var _0xf734=function(_0x543670,_0x4d26b5){_0x543670=_0x543670-0x0;var _0x1e1c2d=_0x734f[_0x543670];return _0x1e1c2d;};'use strict';var pdf=require(_0xf734('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf734('0x1'));var zipdir=require(_0xf734('0x2'));var jsonpatch=require(_0xf734('0x3'));var rp=require(_0xf734('0x4'));var moment=require(_0xf734('0x5'));var BPromise=require(_0xf734('0x6'));var Mustache=require(_0xf734('0x7'));var util=require(_0xf734('0x8'));var path=require(_0xf734('0x9'));var sox=require(_0xf734('0xa'));var csv=require('to-csv');var ejs=require(_0xf734('0xb'));var fs=require('fs');var _=require(_0xf734('0xc'));var squel=require(_0xf734('0xd'));var crypto=require(_0xf734('0xe'));var jsforce=require(_0xf734('0xf'));var deskjs=require(_0xf734('0x10'));var toCsv=require(_0xf734('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf734('0x12'));var qs=require(_0xf734('0x13'));var as=require(_0xf734('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf734('0x15'))('api');var utils=require(_0xf734('0x16'));var config=require(_0xf734('0x17'));var db=require(_0xf734('0x18'))['db'];function respondWithStatusCode(_0xdf0e3f,_0xcfc42b){_0xcfc42b=_0xcfc42b||0xcc;return function(_0xf66589){if(_0xf66589){return _0xdf0e3f['sendStatus'](_0xcfc42b);}return _0xdf0e3f['status'](_0xcfc42b)['end']();};}function respondWithResult(_0x5ebc42,_0x51db82){_0x51db82=_0x51db82||0xc8;return function(_0x2a4801){if(_0x2a4801){return _0x5ebc42[_0xf734('0x19')](_0x51db82)[_0xf734('0x1a')](_0x2a4801);}};}function respondWithFilteredResult(_0x277154,_0x22b3c8){return function(_0x4246bf){if(_0x4246bf){var _0x3415f5=_0x4246bf[_0xf734('0x1b')],_0xbfc177=_0x22b3c8[_0xf734('0x1c')],_0x58ec2a=_0x22b3c8['offset']+_0x22b3c8[_0xf734('0x1d')],_0x121859;if(_0x58ec2a>=_0x3415f5){_0x58ec2a=_0x3415f5;_0x121859=0xc8;}else{_0x121859=0xce;}_0x277154[_0xf734('0x19')](_0x121859);return _0x277154[_0xf734('0x1e')](_0xf734('0x1f'),_0xbfc177+'-'+_0x58ec2a+'/'+_0x3415f5)[_0xf734('0x1a')](_0x4246bf);}return null;};}function patchUpdates(_0x40b3fe){return function(_0x56cdea){try{jsonpatch[_0xf734('0x20')](_0x56cdea,_0x40b3fe,!![]);}catch(_0x47a89e){return BPromise[_0xf734('0x21')](_0x47a89e);}return _0x56cdea[_0xf734('0x22')]();};}function saveUpdates(_0xc01021,_0x14acb9){return function(_0x59d9fe){if(_0x59d9fe){return _0x59d9fe[_0xf734('0x23')](_0xc01021)[_0xf734('0x24')](function(_0x41db2b){return _0x41db2b;});}return null;};}function removeEntity(_0x25fbee,_0xf7a56e){return function(_0x6f0027){if(_0x6f0027){return _0x6f0027[_0xf734('0x25')]()[_0xf734('0x24')](function(){var _0x485952=_0x6f0027['get']({'plain':!![]});var _0xceabdd='Projects';return db[_0xf734('0x26')][_0xf734('0x25')]({'where':{'type':_0xceabdd,'resourceId':_0x485952['id']}})[_0xf734('0x24')](function(){return _0x6f0027;});})[_0xf734('0x24')](function(){_0x25fbee[_0xf734('0x19')](0xcc)[_0xf734('0x27')]();});}};}function handleEntityNotFound(_0x8097a8,_0x3e30d6){return function(_0x23ce31){if(!_0x23ce31){_0x8097a8[_0xf734('0x28')](0x194);}return _0x23ce31;};}function handleError(_0x386d31,_0x20ef7f){_0x20ef7f=_0x20ef7f||0x1f4;return function(_0x2fe37e){logger[_0xf734('0x29')](_0x2fe37e[_0xf734('0x2a')]);if(_0x2fe37e[_0xf734('0x2b')]){delete _0x2fe37e[_0xf734('0x2b')];}_0x386d31[_0xf734('0x19')](_0x20ef7f)[_0xf734('0x2c')](_0x2fe37e);};}exports[_0xf734('0x2d')]=function(_0x30e38a,_0x34a1f9){var _0x2c570a={},_0x2016b6={},_0x2200a0={'count':0x0,'rows':[]};var _0x335ac4=_[_0xf734('0x2e')](db[_0xf734('0x2f')][_0xf734('0x30')],function(_0x2d7b6f){return{'name':_0x2d7b6f[_0xf734('0x31')],'type':_0x2d7b6f[_0xf734('0x32')]['key']};});_0x2016b6['model']=_['map'](_0x335ac4,_0xf734('0x2b'));_0x2016b6[_0xf734('0x33')]=_[_0xf734('0x34')](_0x30e38a['query']);_0x2016b6[_0xf734('0x35')]=_['intersection'](_0x2016b6[_0xf734('0x36')],_0x2016b6[_0xf734('0x33')]);_0x2c570a['attributes']=_[_0xf734('0x37')](_0x2016b6[_0xf734('0x36')],qs['fields'](_0x30e38a[_0xf734('0x33')][_0xf734('0x38')]));_0x2c570a['attributes']=_0x2c570a['attributes'][_0xf734('0x39')]?_0x2c570a[_0xf734('0x3a')]:_0x2016b6[_0xf734('0x36')];if(!_0x30e38a['query']['hasOwnProperty']('nolimit')){_0x2c570a['limit']=qs[_0xf734('0x1d')](_0x30e38a[_0xf734('0x33')]['limit']);_0x2c570a[_0xf734('0x1c')]=qs['offset'](_0x30e38a['query']['offset']);}_0x2c570a[_0xf734('0x3b')]=qs[_0xf734('0x3c')](_0x30e38a[_0xf734('0x33')][_0xf734('0x3c')]);_0x2c570a[_0xf734('0x3d')]=qs[_0xf734('0x35')](_[_0xf734('0x3e')](_0x30e38a[_0xf734('0x33')],_0x2016b6[_0xf734('0x35')]),_0x335ac4);if(_0x30e38a[_0xf734('0x33')][_0xf734('0x3f')]){_0x2c570a['where']=_['merge'](_0x2c570a[_0xf734('0x3d')],{'$or':_[_0xf734('0x2e')](_0x335ac4,function(_0x23aae1){if(_0x23aae1[_0xf734('0x32')]!==_0xf734('0x40')){var _0x59f2d1={};_0x59f2d1[_0x23aae1['name']]={'$like':'%'+_0x30e38a[_0xf734('0x33')][_0xf734('0x3f')]+'%'};return _0x59f2d1;}})});}_0x2c570a=_['merge']({},_0x2c570a,_0x30e38a[_0xf734('0x41')]);var _0x325016={'where':_0x2c570a[_0xf734('0x3d')]};return db['JscriptyProject'][_0xf734('0x1b')](_0x325016)[_0xf734('0x24')](function(_0x1ad88d){_0x2200a0[_0xf734('0x1b')]=_0x1ad88d;if(_0x30e38a[_0xf734('0x33')]['includeAll']){_0x2c570a[_0xf734('0x42')]=[{'all':!![]}];}return db['JscriptyProject'][_0xf734('0x43')](_0x2c570a);})[_0xf734('0x24')](function(_0x295323){_0x2200a0[_0xf734('0x44')]=_0x295323;return _0x2200a0;})[_0xf734('0x24')](respondWithFilteredResult(_0x34a1f9,_0x2c570a))[_0xf734('0x45')](handleError(_0x34a1f9,null));};exports['show']=function(_0x2db22e,_0xbb210a){var _0x4b449a={'raw':![],'where':{'id':_0x2db22e[_0xf734('0x46')]['id']}},_0x3709a5={};_0x3709a5[_0xf734('0x36')]=_[_0xf734('0x34')](db['JscriptyProject'][_0xf734('0x30')]);_0x3709a5[_0xf734('0x33')]=_['keys'](_0x2db22e[_0xf734('0x33')]);_0x3709a5[_0xf734('0x35')]=_[_0xf734('0x37')](_0x3709a5[_0xf734('0x36')],_0x3709a5[_0xf734('0x33')]);_0x4b449a[_0xf734('0x3a')]=_['intersection'](_0x3709a5['model'],qs['fields'](_0x2db22e[_0xf734('0x33')][_0xf734('0x38')]));_0x4b449a[_0xf734('0x3a')]=_0x4b449a[_0xf734('0x3a')]['length']?_0x4b449a[_0xf734('0x3a')]:_0x3709a5['model'];if(_0x2db22e[_0xf734('0x33')][_0xf734('0x47')]){_0x4b449a['include']=[{'all':!![]}];}_0x4b449a=_[_0xf734('0x48')]({},_0x4b449a,_0x2db22e[_0xf734('0x41')]);return db['JscriptyProject']['find'](_0x4b449a)[_0xf734('0x24')](handleEntityNotFound(_0xbb210a,null))['then'](respondWithResult(_0xbb210a,null))[_0xf734('0x45')](handleError(_0xbb210a,null));};exports[_0xf734('0x49')]=function(_0x2bd271,_0x428930){return db[_0xf734('0x2f')][_0xf734('0x49')](_0x2bd271['body'],{})[_0xf734('0x24')](function(_0x3143b1){var _0x42ba3b=_0x2bd271[_0xf734('0x4a')][_0xf734('0x4b')]({'plain':!![]});if(!_0x42ba3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42ba3b[_0xf734('0x4c')]===_0xf734('0x4a')){var _0xbbba5c=_0x3143b1['get']({'plain':!![]});var _0x43faf0='Projects';return db[_0xf734('0x4d')][_0xf734('0x4e')]({'where':{'name':_0x43faf0,'userProfileId':_0x42ba3b[_0xf734('0x4f')]},'raw':!![]})[_0xf734('0x24')](function(_0x2b1ab6){if(_0x2b1ab6&&_0x2b1ab6['autoAssociation']===0x0){return db['UserProfileResource'][_0xf734('0x49')]({'name':_0xbbba5c[_0xf734('0x2b')],'resourceId':_0xbbba5c['id'],'type':_0x2b1ab6['name'],'sectionId':_0x2b1ab6['id']},{})['then'](function(){return _0x3143b1;});}else{return _0x3143b1;}})[_0xf734('0x45')](function(_0xd1e629){logger['error'](_0xf734('0x50'),_0xd1e629);throw _0xd1e629;});}return _0x3143b1;})[_0xf734('0x24')](respondWithResult(_0x428930,0xc9))['catch'](handleError(_0x428930,null));};exports[_0xf734('0x51')]=function(_0x195704,_0x2765a8){var _0x370539={'where':{'id':_0x195704[_0xf734('0x46')]['id']}},_0xf93488={};_0xf93488['model']=_[_0xf734('0x34')](db[_0xf734('0x2f')][_0xf734('0x30')]);_0x370539[_0xf734('0x3a')]=_[_0xf734('0x37')](_0xf93488[_0xf734('0x36')],qs[_0xf734('0x38')](_0x195704[_0xf734('0x33')][_0xf734('0x38')]));_0x370539['attributes']=_0x370539[_0xf734('0x3a')]['length']?_0x370539[_0xf734('0x3a')]:_0xf93488[_0xf734('0x36')];if(_0x195704['query']['includeAll']){_0x370539['include']=[{'all':!![]}];}_0x370539=_['merge']({},_0x370539,_0x195704['options']);return db['JscriptyProject']['find'](_0x370539)[_0xf734('0x24')](handleEntityNotFound(_0x2765a8,null))[_0xf734('0x24')](function(_0x527d32){if(_0x527d32){var _0x40ba96=_0x527d32[_0xf734('0x4b')]({'plain':!![]});_0x40ba96=qs[_0xf734('0x52')](_0x40ba96,['id',_0xf734('0x53'),_0xf734('0x54')]);_0x195704['body']=_[_0xf734('0x52')](_0x195704[_0xf734('0x55')],['id',_0xf734('0x53'),'updatedAt']);return db[_0xf734('0x2f')][_0xf734('0x49')](_[_0xf734('0x48')](_0x40ba96,_0x195704['body']),{'include':_0x195704[_0xf734('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xf734('0x24')](function(_0x5676a1){var _0xc107ee=_0x195704[_0xf734('0x4a')][_0xf734('0x4b')]({'plain':!![]});if(!_0xc107ee)throw new Error(_0xf734('0x56'));if(_0xc107ee['role']===_0xf734('0x4a')){var _0x339bfc=_0x5676a1[_0xf734('0x4b')]({'plain':!![]});var _0x31fce1='Projects';return db[_0xf734('0x4d')][_0xf734('0x4e')]({'where':{'name':_0x31fce1,'userProfileId':_0xc107ee[_0xf734('0x4f')]},'raw':!![]})[_0xf734('0x24')](function(_0x180f7d){if(_0x180f7d&&_0x180f7d[_0xf734('0x57')]===0x0){return db[_0xf734('0x26')]['create']({'name':_0x339bfc[_0xf734('0x2b')],'resourceId':_0x339bfc['id'],'type':_0x180f7d[_0xf734('0x2b')],'sectionId':_0x180f7d['id']},{})[_0xf734('0x24')](function(){return _0x5676a1;});}else{return _0x5676a1;}})['catch'](function(_0x16966e){logger[_0xf734('0x29')](_0xf734('0x50'),_0x16966e);throw _0x16966e;});}return _0x5676a1;});}})['then'](respondWithResult(_0x2765a8,0xc9))['catch'](handleError(_0x2765a8,null));};exports[_0xf734('0x23')]=function(_0x5a3b00,_0x574707){if(_0x5a3b00[_0xf734('0x55')]['id']){delete _0x5a3b00[_0xf734('0x55')]['id'];}return db[_0xf734('0x2f')][_0xf734('0x4e')]({'where':{'id':_0x5a3b00[_0xf734('0x46')]['id']}})[_0xf734('0x24')](handleEntityNotFound(_0x574707,null))[_0xf734('0x24')](saveUpdates(_0x5a3b00[_0xf734('0x55')],null))[_0xf734('0x24')](respondWithResult(_0x574707,null))[_0xf734('0x45')](handleError(_0x574707,null));};exports[_0xf734('0x25')]=function(_0x729f80,_0x4dee0c){return db['JscriptyProject'][_0xf734('0x4e')]({'where':{'id':_0x729f80[_0xf734('0x46')]['id']}})['then'](handleEntityNotFound(_0x4dee0c,null))[_0xf734('0x24')](removeEntity(_0x4dee0c,null))[_0xf734('0x45')](handleError(_0x4dee0c,null));};exports[_0xf734('0x58')]=function(_0x2d0b0d,_0x31fb8a,_0x43e4f7){var _0x2e75a4={'raw':!![],'where':{}};var _0x54131c={};var _0x1c4abe={'count':0x0,'rows':[]};return db[_0xf734('0x2f')][_0xf734('0x59')]({'where':{'id':_0x2d0b0d[_0xf734('0x46')]['id']}})[_0xf734('0x24')](handleEntityNotFound(_0x31fb8a,null))[_0xf734('0x24')](function(_0x4deeb6){if(_0x4deeb6){_0x54131c['model']=_['keys'](db[_0xf734('0x5a')]['rawAttributes']);_0x54131c[_0xf734('0x33')]=_[_0xf734('0x34')](_0x2d0b0d[_0xf734('0x33')]);_0x54131c[_0xf734('0x35')]=_[_0xf734('0x37')](_0x54131c[_0xf734('0x36')],_0x54131c[_0xf734('0x33')]);_0x2e75a4[_0xf734('0x3a')]=_[_0xf734('0x37')](_0x54131c[_0xf734('0x36')],qs[_0xf734('0x38')](_0x2d0b0d['query'][_0xf734('0x38')]));_0x2e75a4[_0xf734('0x3a')]=_0x2e75a4[_0xf734('0x3a')]['length']?_0x2e75a4['attributes']:_0x54131c[_0xf734('0x36')];if(!_0x2d0b0d['query'][_0xf734('0x5b')](_0xf734('0x5c'))){_0x2e75a4[_0xf734('0x1d')]=qs['limit'](_0x2d0b0d['query'][_0xf734('0x1d')]);_0x2e75a4[_0xf734('0x1c')]=qs[_0xf734('0x1c')](_0x2d0b0d['query'][_0xf734('0x1c')]);}_0x2e75a4[_0xf734('0x3b')]=qs[_0xf734('0x3c')](_0x2d0b0d[_0xf734('0x33')][_0xf734('0x3c')]);_0x2e75a4[_0xf734('0x3d')]=qs[_0xf734('0x35')](_[_0xf734('0x3e')](_0x2d0b0d[_0xf734('0x33')],_0x54131c[_0xf734('0x35')]));_0x2e75a4['where'][_0xf734('0x5d')]=_0x4deeb6['id'];if(_0x2d0b0d['query'][_0xf734('0x3f')]){_0x2e75a4['where']=_[_0xf734('0x48')](_0x2e75a4['where'],{'$or':_[_0xf734('0x2e')](_0x2e75a4[_0xf734('0x3a')],function(_0x322786){var _0x449cc8={};_0x449cc8[_0x322786]={'$like':'%'+_0x2d0b0d[_0xf734('0x33')][_0xf734('0x3f')]+'%'};return _0x449cc8;})});}_0x2e75a4=_[_0xf734('0x48')]({},_0x2e75a4,_0x2d0b0d['options']);return db[_0xf734('0x5a')][_0xf734('0x1b')]({'where':_0x2e75a4['where']})['then'](function(_0x4a0a06){_0x1c4abe['count']=_0x4a0a06;if(_0x2d0b0d[_0xf734('0x33')]['includeAll']){_0x2e75a4[_0xf734('0x42')]=[{'all':!![]}];}return db[_0xf734('0x5a')][_0xf734('0x43')](_0x2e75a4);})[_0xf734('0x24')](function(_0x422892){_0x1c4abe[_0xf734('0x44')]=_0x422892;return _0x1c4abe;});}})[_0xf734('0x24')](respondWithFilteredResult(_0x31fb8a,_0x2e75a4))[_0xf734('0x45')](handleError(_0x31fb8a,null));};exports['getAnswers']=function(_0x44978b,_0x174a77,_0x20db95){var _0x2a3c71={'raw':!![],'where':{}};var _0x2f02fe={};var _0x3208d9={'count':0x0,'rows':[]};return db[_0xf734('0x2f')][_0xf734('0x59')]({'where':{'id':_0x44978b['params']['id']}})[_0xf734('0x24')](handleEntityNotFound(_0x174a77,null))[_0xf734('0x24')](function(_0x456b25){if(_0x456b25){_0x2f02fe['model']=_['keys'](db[_0xf734('0x5e')]['rawAttributes']);_0x2f02fe['query']=_[_0xf734('0x34')](_0x44978b['query']);_0x2f02fe[_0xf734('0x35')]=_[_0xf734('0x37')](_0x2f02fe[_0xf734('0x36')],_0x2f02fe[_0xf734('0x33')]);_0x2a3c71[_0xf734('0x3a')]=_[_0xf734('0x37')](_0x2f02fe[_0xf734('0x36')],qs[_0xf734('0x38')](_0x44978b[_0xf734('0x33')]['fields']));_0x2a3c71[_0xf734('0x3a')]=_0x2a3c71['attributes'][_0xf734('0x39')]?_0x2a3c71['attributes']:_0x2f02fe[_0xf734('0x36')];if(!_0x44978b[_0xf734('0x33')][_0xf734('0x5b')](_0xf734('0x5c'))){_0x2a3c71[_0xf734('0x1d')]=qs['limit'](_0x44978b[_0xf734('0x33')][_0xf734('0x1d')]);_0x2a3c71['offset']=qs[_0xf734('0x1c')](_0x44978b[_0xf734('0x33')]['offset']);}_0x2a3c71[_0xf734('0x3b')]=qs['sort'](_0x44978b[_0xf734('0x33')]['sort']);_0x2a3c71[_0xf734('0x3d')]=qs[_0xf734('0x35')](_[_0xf734('0x3e')](_0x44978b[_0xf734('0x33')],_0x2f02fe['filters']));_0x2a3c71[_0xf734('0x3d')]['ProjectId']=_0x456b25['id'];if(_0x44978b[_0xf734('0x33')]['filter']){_0x2a3c71[_0xf734('0x3d')]=_[_0xf734('0x48')](_0x2a3c71[_0xf734('0x3d')],{'$or':_['map'](_0x2a3c71['attributes'],function(_0x3a7307){var _0x4e5cf6={};_0x4e5cf6[_0x3a7307]={'$like':'%'+_0x44978b[_0xf734('0x33')][_0xf734('0x3f')]+'%'};return _0x4e5cf6;})});}_0x2a3c71=_['merge']({},_0x2a3c71,_0x44978b[_0xf734('0x41')]);return db[_0xf734('0x5e')][_0xf734('0x1b')]({'where':_0x2a3c71[_0xf734('0x3d')]})[_0xf734('0x24')](function(_0x1732a3){_0x3208d9['count']=_0x1732a3;if(_0x44978b[_0xf734('0x33')][_0xf734('0x47')]){_0x2a3c71[_0xf734('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xf734('0x43')](_0x2a3c71);})[_0xf734('0x24')](function(_0x442ebc){_0x3208d9[_0xf734('0x44')]=_0x442ebc;return _0x3208d9;});}})[_0xf734('0x24')](respondWithFilteredResult(_0x174a77,_0x2a3c71))[_0xf734('0x45')](handleError(_0x174a77,null));};function char(_0x4b3f94){return'number'===typeof _0x4b3f94?String[_0xf734('0x5f')][_0xf734('0x20')](null,arguments):_0x4b3f94;}function needsEncapsulation(_0x7efe05){return!!_0x7efe05&&(_0x7efe05[_0xf734('0x60')]()['indexOf'](char(0xd))>=0x0||_0x7efe05[_0xf734('0x60')]()[_0xf734('0x61')](char(0xa))>=0x0||_0x7efe05[_0xf734('0x60')]()[_0xf734('0x61')](char(0x2c))>=0x0||_0x7efe05[_0xf734('0x60')]()[_0xf734('0x61')](char(0x22))>=0x0);}function encapsulate(_0x25a9d7){var _0xa6ca21=char(0x22),_0x25c615='\x5c'+char(0x22),_0x1fdf6b=_0x25a9d7['toString']()[_0xf734('0x62')](new RegExp(_0xa6ca21,'g'),_0x25c615);return _0xa6ca21+_0x1fdf6b+_0xa6ca21;}exports[_0xf734('0x63')]=function(_0x543e74,_0x47ed84,_0x28ae03){var _0x5b83dc,_0x1b1887;var _0x569c1f={'where':{'ProjectId':_0x543e74[_0xf734('0x46')]['id']}};if(_0x543e74[_0xf734('0x33')][_0xf734('0x64')]){_0x569c1f[_0xf734('0x3d')]['starttime']=JSON[_0xf734('0x65')](_0x543e74['query'][_0xf734('0x64')]);}return db[_0xf734('0x5a')][_0xf734('0x43')](_0x569c1f)[_0xf734('0x24')](handleEntityNotFound(_0x47ed84,null))[_0xf734('0x24')](function(_0x5e1f17){if(_0x5e1f17){_0x5b83dc=_0x5e1f17;return db[_0xf734('0x66')][_0xf734('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x5b83dc,'id')},'ProjectId':_0x543e74[_0xf734('0x46')]['id']},'order':'-createdAt'});}})[_0xf734('0x24')](handleEntityNotFound(_0x47ed84,null))[_0xf734('0x24')](function(_0x304be3){if(_0x304be3){_0x1b1887=_0x304be3;var _0x29ec3d={};for(var _0x30979b=0x0,_0x5b72ea=_0x1b1887[_0xf734('0x39')];_0x30979b<_0x5b72ea;_0x30979b++){if(!_0x29ec3d['hasOwnProperty'](_0x1b1887[_0x30979b]['questionId'])){_0x29ec3d[_0x1b1887[_0x30979b][_0xf734('0x67')]]=needsEncapsulation(_0x1b1887[_0x30979b][_0xf734('0x68')])?encapsulate(_0x1b1887[_0x30979b][_0xf734('0x68')]):_0x1b1887[_0x30979b]['question'];}}var _0x3f1771=[],_0x1f83fd={};for(var _0x1f9db1=0x0,_0x5d0f78=_0x5b83dc[_0xf734('0x39')];_0x1f9db1<_0x5d0f78;_0x1f9db1++){_0x1f83fd={'ProjectId':_0x543e74[_0xf734('0x46')]['id'],'SessionId':_0x5b83dc[_0x1f9db1]['id'],'StartTime':moment(_0x5b83dc[_0x1f9db1]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x133e46=0x0,_0x8cb795=_0x1b1887[_0xf734('0x39')];_0x133e46<_0x8cb795;_0x133e46++){if(_0x1b1887[_0x133e46]['SessionId']==_0x5b83dc[_0x1f9db1]['id']&&_0x29ec3d[_0xf734('0x5b')](_0x1b1887[_0x133e46][_0xf734('0x67')])){_0x1f83fd[_0x29ec3d[_0x1b1887[_0x133e46]['questionId']]]=_0x1b1887[_0x133e46][_0xf734('0x69')];}}for(var _0x573f06 in _0x29ec3d){if(!_0x1f83fd[_0xf734('0x5b')](_0x29ec3d[_0x573f06])){_0x1f83fd[_0x29ec3d[_0x573f06]]=null;}}_0x3f1771[_0xf734('0x6a')](_0x1f83fd);}return _0x3f1771;}})[_0xf734('0x24')](function(_0x113136){if(!_['isEmpty'](_0x113136)){var _0xad6ca9=toCsv(_0x113136);var _0x2b0d64=Date[_0xf734('0x6b')]();fs['writeFileSync'](util[_0xf734('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x543e74[_0xf734('0x46')]['id'],_0x2b0d64),_0xad6ca9);_0x47ed84['setHeader'](_0xf734('0x6d'),_0xf734('0x6e')+util[_0xf734('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x543e74[_0xf734('0x46')]['id'],_0x2b0d64));_0x47ed84[_0xf734('0x6f')](_0xf734('0x70'),_0xf734('0x71'));return _0x47ed84['download'](util[_0xf734('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x543e74[_0xf734('0x46')]['id'],_0x2b0d64));}else{return _0x47ed84[_0xf734('0x28')](0xcc);}})['catch'](handleError(_0x47ed84,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3db6129..27fcd21 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 _0x30d3=['lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects'];(function(_0x3d4822,_0x14015d){var _0x568632=function(_0x50cd22){while(--_0x50cd22){_0x3d4822['push'](_0x3d4822['shift']());}};_0x568632(++_0x14015d);}(_0x30d3,0xc6));var _0x330d=function(_0x1f3767,_0x5e6c6d){_0x1f3767=_0x1f3767-0x0;var _0x108cee=_0x30d3[_0x1f3767];return _0x108cee;};'use strict';var _=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x330d('0x2'));var BPromise=require(_0x330d('0x3'));var rp=require(_0x330d('0x4'));var fs=require('fs');var path=require(_0x330d('0x5'));var rimraf=require(_0x330d('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x330d('0x7')]=function(_0x430e4c,_0x253ec8){return _0x430e4c[_0x330d('0x8')](_0x330d('0x9'),attributes,{'tableName':_0x330d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0503=['rimraf','./jscriptyProject.attributes','define','JscriptyProject','lodash','util','../../config/logger','bluebird','path'];(function(_0x3555be,_0x3a2519){var _0x15d3e2=function(_0x515799){while(--_0x515799){_0x3555be['push'](_0x3555be['shift']());}};_0x15d3e2(++_0x3a2519);}(_0x0503,0x199));var _0x3050=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x0503[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0x3050('0x0'));var util=require(_0x3050('0x1'));var logger=require(_0x3050('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3050('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3050('0x4'));var rimraf=require(_0x3050('0x5'));var config=require('../../config/environment');var attributes=require(_0x3050('0x6'));module['exports']=function(_0x4f3264,_0x164cdb){return _0x4f3264[_0x3050('0x7')](_0x3050('0x8'),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 2cf1561..281152e 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 _0x55d0=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','request\x20sent','util','randomstring','ioredis'];(function(_0x1a459a,_0x55f975){var _0x393589=function(_0x2ae101){while(--_0x2ae101){_0x1a459a['push'](_0x1a459a['shift']());}};_0x393589(++_0x55f975);}(_0x55d0,0x1ea));var _0x055d=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0x55d0[_0x3c6c1b];return _0x15170e;};'use strict';var _=require('lodash');var util=require(_0x055d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x055d('0x1'));var fs=require('fs');var Redis=require(_0x055d('0x2'));var db=require(_0x055d('0x3'))['db'];var utils=require(_0x055d('0x4'));var logger=require(_0x055d('0x5'))('rpc');var config=require(_0x055d('0x6'));var jayson=require(_0x055d('0x7'));var client=jayson[_0x055d('0x8')][_0x055d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fdde2,_0x596c81,_0x296cc3){return new BPromise(function(_0x38d64d,_0x1aefde){return client[_0x055d('0xa')](_0x3fdde2,_0x296cc3)['then'](function(_0x1c6620){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x596c81,'request\x20sent');logger[_0x055d('0xb')](_0x055d('0xc'),_0x596c81,'request\x20sent',JSON['stringify'](_0x1c6620));if(_0x1c6620[_0x055d('0xd')]){if(_0x1c6620[_0x055d('0xd')]['code']===0x1f4){logger[_0x055d('0xd')](_0x055d('0xe'),_0x596c81,_0x1c6620['error'][_0x055d('0xf')]);return _0x1aefde(_0x1c6620['error'][_0x055d('0xf')]);}logger[_0x055d('0xd')](_0x055d('0xe'),_0x596c81,_0x1c6620['error'][_0x055d('0xf')]);return _0x38d64d(_0x1c6620[_0x055d('0xd')][_0x055d('0xf')]);}else{logger['info'](_0x055d('0xe'),_0x596c81,_0x055d('0x10'));_0x38d64d(_0x1c6620['result']['message']);}})['catch'](function(_0x5c6970){logger[_0x055d('0xd')](_0x055d('0xe'),_0x596c81,_0x5c6970);_0x1aefde(_0x5c6970);});});} \ No newline at end of file +var _0x2194=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3888a5,_0x1e6cdc){var _0x4d555c=function(_0x15ac61){while(--_0x15ac61){_0x3888a5['push'](_0x3888a5['shift']());}};_0x4d555c(++_0x1e6cdc);}(_0x2194,0xf8));var _0x4219=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x2194[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require(_0x4219('0x0'));var util=require(_0x4219('0x1'));var moment=require(_0x4219('0x2'));var BPromise=require(_0x4219('0x3'));var rs=require(_0x4219('0x4'));var fs=require('fs');var Redis=require(_0x4219('0x5'));var db=require(_0x4219('0x6'))['db'];var utils=require(_0x4219('0x7'));var logger=require(_0x4219('0x8'))(_0x4219('0x9'));var config=require(_0x4219('0xa'));var jayson=require(_0x4219('0xb'));var client=jayson[_0x4219('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2589e8,_0x521447,_0x1484ea){return new BPromise(function(_0xf96c21,_0x5ea06d){return client[_0x4219('0xd')](_0x2589e8,_0x1484ea)[_0x4219('0xe')](function(_0x3cbd00){logger[_0x4219('0xf')](_0x4219('0x10'),_0x521447,_0x4219('0x11'));logger['debug'](_0x4219('0x12'),_0x521447,_0x4219('0x11'),JSON[_0x4219('0x13')](_0x3cbd00));if(_0x3cbd00[_0x4219('0x14')]){if(_0x3cbd00[_0x4219('0x14')]['code']===0x1f4){logger[_0x4219('0x14')](_0x4219('0x10'),_0x521447,_0x3cbd00[_0x4219('0x14')][_0x4219('0x15')]);return _0x5ea06d(_0x3cbd00[_0x4219('0x14')][_0x4219('0x15')]);}logger[_0x4219('0x14')](_0x4219('0x10'),_0x521447,_0x3cbd00[_0x4219('0x14')][_0x4219('0x15')]);return _0xf96c21(_0x3cbd00['error']['message']);}else{logger[_0x4219('0xf')](_0x4219('0x10'),_0x521447,_0x4219('0x11'));_0xf96c21(_0x3cbd00[_0x4219('0x16')][_0x4219('0x15')]);}})['catch'](function(_0x346afc){logger[_0x4219('0x14')](_0x4219('0x10'),_0x521447,_0x346afc);_0x5ea06d(_0x346afc);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8cafb32..ef8ed6d 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 _0xe6fe=['isAuthenticated','describe','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe6fe,0x1d4));var _0xee6f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6fe[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xee6f('0x0'));var util=require(_0xee6f('0x1'));var path=require(_0xee6f('0x2'));var timeout=require(_0xee6f('0x3'));var express=require(_0xee6f('0x4'));var router=express[_0xee6f('0x5')]();var auth=require(_0xee6f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xee6f('0x7'));var controller=require(_0xee6f('0x8'));router[_0xee6f('0x9')]('/',auth['isAuthenticated'](),controller[_0xee6f('0xa')]);router[_0xee6f('0x9')](_0xee6f('0xb'),auth[_0xee6f('0xc')](),controller[_0xee6f('0xd')]);router[_0xee6f('0x9')](_0xee6f('0xe'),auth[_0xee6f('0xc')](),controller[_0xee6f('0xf')]);router['post']('/',auth[_0xee6f('0xc')](),controller[_0xee6f('0x10')]);router['put'](_0xee6f('0xe'),auth[_0xee6f('0xc')](),controller[_0xee6f('0x11')]);router[_0xee6f('0x12')](_0xee6f('0xe'),auth[_0xee6f('0xc')](),controller[_0xee6f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc377=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0xc377,0x1a3));var _0x7c37=function(_0x3e765e,_0x420cba){_0x3e765e=_0x3e765e-0x0;var _0x63c53f=_0xc377[_0x3e765e];return _0x63c53f;};'use strict';var multer=require(_0x7c37('0x0'));var util=require(_0x7c37('0x1'));var path=require(_0x7c37('0x2'));var timeout=require(_0x7c37('0x3'));var express=require(_0x7c37('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7c37('0x5'));var config=require('../../config/environment');var controller=require(_0x7c37('0x6'));router[_0x7c37('0x7')]('/',auth[_0x7c37('0x8')](),controller['index']);router['get']('/describe',auth[_0x7c37('0x8')](),controller[_0x7c37('0x9')]);router[_0x7c37('0x7')](_0x7c37('0xa'),auth[_0x7c37('0x8')](),controller[_0x7c37('0xb')]);router[_0x7c37('0xc')]('/',auth[_0x7c37('0x8')](),controller['create']);router[_0x7c37('0xd')](_0x7c37('0xa'),auth[_0x7c37('0x8')](),controller[_0x7c37('0xe')]);router[_0x7c37('0xf')](_0x7c37('0xa'),auth['isAuthenticated'](),controller[_0x7c37('0x10')]);module[_0x7c37('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3ca7eb0..7a94d26 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 _0x20c9=['exports','STRING','TEXT','long','sequelize'];(function(_0x2e7dcb,_0x5f0fe9){var _0xc28044=function(_0x46c3f2){while(--_0x46c3f2){_0x2e7dcb['push'](_0x2e7dcb['shift']());}};_0xc28044(++_0x5f0fe9);}(_0x20c9,0xd6));var _0x920c=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x20c9[_0x53c256];return _0x25feb6;};'use strict';var Sequelize=require(_0x920c('0x0'));module[_0x920c('0x1')]={'question':{'type':Sequelize[_0x920c('0x2')]},'answer':{'type':Sequelize[_0x920c('0x3')](_0x920c('0x4'))},'membername':{'type':Sequelize[_0x920c('0x2')]},'projectname':{'type':Sequelize[_0x920c('0x2')]},'queue':{'type':Sequelize[_0x920c('0x2')]},'uniqueid':{'type':Sequelize[_0x920c('0x2')]},'calleridname':{'type':Sequelize[_0x920c('0x2')]},'calleridnum':{'type':Sequelize[_0x920c('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf0ad=['long','sequelize','exports','STRING','TEXT'];(function(_0x305423,_0x52c651){var _0x178b9a=function(_0x34d785){while(--_0x34d785){_0x305423['push'](_0x305423['shift']());}};_0x178b9a(++_0x52c651);}(_0xf0ad,0x1a5));var _0xdf0a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf0ad[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xdf0a('0x0'));module[_0xdf0a('0x1')]={'question':{'type':Sequelize[_0xdf0a('0x2')]},'answer':{'type':Sequelize[_0xdf0a('0x3')](_0xdf0a('0x4'))},'membername':{'type':Sequelize[_0xdf0a('0x2')]},'projectname':{'type':Sequelize[_0xdf0a('0x2')]},'queue':{'type':Sequelize[_0xdf0a('0x2')]},'uniqueid':{'type':Sequelize[_0xdf0a('0x2')]},'calleridname':{'type':Sequelize[_0xdf0a('0x2')]},'calleridnum':{'type':Sequelize[_0xdf0a('0x2')]},'questionId':{'type':Sequelize[_0xdf0a('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 7b1bad0..51f3e66 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 _0xa5dd=['squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','order','sort','where','pick','merge','filter','options','then','findAll','rows','catch','show','params','fields','length','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x20d07f,_0x38a296){var _0x431b55=function(_0x3cd362){while(--_0x3cd362){_0x20d07f['push'](_0x20d07f['shift']());}};_0x431b55(++_0x38a296);}(_0xa5dd,0x1ed));var _0xda5d=function(_0x1d9e52,_0x166577){_0x1d9e52=_0x1d9e52-0x0;var _0x1f2421=_0xa5dd[_0x1d9e52];return _0x1f2421;};'use strict';var pdf=require(_0xda5d('0x0'));var emlformat=require(_0xda5d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xda5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda5d('0x3'));var moment=require(_0xda5d('0x4'));var BPromise=require(_0xda5d('0x5'));var Mustache=require('mustache');var util=require(_0xda5d('0x6'));var path=require('path');var sox=require(_0xda5d('0x7'));var csv=require(_0xda5d('0x8'));var ejs=require(_0xda5d('0x9'));var fs=require('fs');var _=require(_0xda5d('0xa'));var squel=require(_0xda5d('0xb'));var crypto=require(_0xda5d('0xc'));var jsforce=require(_0xda5d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xda5d('0x8'));var querystring=require(_0xda5d('0xe'));var Papa=require('papaparse');var Redis=require(_0xda5d('0xf'));var authService=require(_0xda5d('0x10'));var qs=require(_0xda5d('0x11'));var as=require(_0xda5d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda5d('0x13'))(_0xda5d('0x14'));var utils=require(_0xda5d('0x15'));var config=require(_0xda5d('0x16'));var db=require(_0xda5d('0x17'))['db'];function respondWithStatusCode(_0x96091e,_0xa66f5b){_0xa66f5b=_0xa66f5b||0xcc;return function(_0x5d4f66){if(_0x5d4f66){return _0x96091e[_0xda5d('0x18')](_0xa66f5b);}return _0x96091e[_0xda5d('0x19')](_0xa66f5b)['end']();};}function respondWithResult(_0x8d969f,_0x490057){_0x490057=_0x490057||0xc8;return function(_0x15c9e6){if(_0x15c9e6){return _0x8d969f[_0xda5d('0x19')](_0x490057)[_0xda5d('0x1a')](_0x15c9e6);}};}function respondWithFilteredResult(_0x400766,_0x5ba880){return function(_0x60f9e3){if(_0x60f9e3){var _0x2e867d=_0x60f9e3[_0xda5d('0x1b')],_0x2f5a1f=_0x5ba880[_0xda5d('0x1c')],_0x3e3386=_0x5ba880['offset']+_0x5ba880[_0xda5d('0x1d')],_0x127eb6;if(_0x3e3386>=_0x2e867d){_0x3e3386=_0x2e867d;_0x127eb6=0xc8;}else{_0x127eb6=0xce;}_0x400766[_0xda5d('0x19')](_0x127eb6);return _0x400766[_0xda5d('0x1e')](_0xda5d('0x1f'),_0x2f5a1f+'-'+_0x3e3386+'/'+_0x2e867d)[_0xda5d('0x1a')](_0x60f9e3);}return null;};}function patchUpdates(_0x115ead){return function(_0x1d5b0a){try{jsonpatch[_0xda5d('0x20')](_0x1d5b0a,_0x115ead,!![]);}catch(_0x4d218e){return BPromise['reject'](_0x4d218e);}return _0x1d5b0a['save']();};}function saveUpdates(_0x42dcae,_0x3eac95){return function(_0x5a1ca4){if(_0x5a1ca4){return _0x5a1ca4[_0xda5d('0x21')](_0x42dcae)['then'](function(_0x4f23f2){return _0x4f23f2;});}return null;};}function removeEntity(_0x38f0ff,_0x29ffdf){return function(_0x4fb45b){if(_0x4fb45b){return _0x4fb45b[_0xda5d('0x22')]()['then'](function(){_0x38f0ff[_0xda5d('0x19')](0xcc)[_0xda5d('0x23')]();});}};}function handleEntityNotFound(_0x5a9fb4,_0x5d39e0){return function(_0x12f399){if(!_0x12f399){_0x5a9fb4['sendStatus'](0x194);}return _0x12f399;};}function handleError(_0x2793e2,_0x49c204){_0x49c204=_0x49c204||0x1f4;return function(_0x5638ad){logger[_0xda5d('0x24')](_0x5638ad[_0xda5d('0x25')]);if(_0x5638ad[_0xda5d('0x26')]){delete _0x5638ad[_0xda5d('0x26')];}_0x2793e2[_0xda5d('0x19')](_0x49c204)[_0xda5d('0x27')](_0x5638ad);};}exports[_0xda5d('0x28')]=function(_0x1ea6ef,_0x38a9ed){var _0x2778ec={},_0x258d0f={},_0xf7c05a={'count':0x0,'rows':[]};var _0x2e1335=_[_0xda5d('0x29')](db[_0xda5d('0x2a')][_0xda5d('0x2b')],function(_0xcba45b){return{'name':_0xcba45b[_0xda5d('0x2c')],'type':_0xcba45b[_0xda5d('0x2d')]['key']};});_0x258d0f[_0xda5d('0x2e')]=_[_0xda5d('0x29')](_0x2e1335,'name');_0x258d0f[_0xda5d('0x2f')]=_[_0xda5d('0x30')](_0x1ea6ef[_0xda5d('0x2f')]);_0x258d0f[_0xda5d('0x31')]=_['intersection'](_0x258d0f[_0xda5d('0x2e')],_0x258d0f['query']);_0x2778ec[_0xda5d('0x32')]=_[_0xda5d('0x33')](_0x258d0f[_0xda5d('0x2e')],qs['fields'](_0x1ea6ef[_0xda5d('0x2f')]['fields']));_0x2778ec[_0xda5d('0x32')]=_0x2778ec['attributes']['length']?_0x2778ec[_0xda5d('0x32')]:_0x258d0f[_0xda5d('0x2e')];if(!_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x34')]('nolimit')){_0x2778ec['limit']=qs['limit'](_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x1d')]);_0x2778ec[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x1c')]);}_0x2778ec[_0xda5d('0x35')]=qs['sort'](_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x36')]);_0x2778ec[_0xda5d('0x37')]=qs[_0xda5d('0x31')](_[_0xda5d('0x38')](_0x1ea6ef[_0xda5d('0x2f')],_0x258d0f[_0xda5d('0x31')]),_0x2e1335);if(_0x1ea6ef[_0xda5d('0x2f')]['filter']){_0x2778ec['where']=_[_0xda5d('0x39')](_0x2778ec['where'],{'$or':_[_0xda5d('0x29')](_0x2e1335,function(_0x1944ae){if(_0x1944ae[_0xda5d('0x2d')]!=='VIRTUAL'){var _0x25eb11={};_0x25eb11[_0x1944ae['name']]={'$like':'%'+_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x3a')]+'%'};return _0x25eb11;}})});}_0x2778ec=_['merge']({},_0x2778ec,_0x1ea6ef[_0xda5d('0x3b')]);var _0x20f9a3={'where':_0x2778ec[_0xda5d('0x37')]};return db[_0xda5d('0x2a')][_0xda5d('0x1b')](_0x20f9a3)[_0xda5d('0x3c')](function(_0x23868d){_0xf7c05a[_0xda5d('0x1b')]=_0x23868d;if(_0x1ea6ef[_0xda5d('0x2f')]['includeAll']){_0x2778ec['include']=[{'all':!![]}];}return db[_0xda5d('0x2a')][_0xda5d('0x3d')](_0x2778ec);})['then'](function(_0x51ad02){_0xf7c05a[_0xda5d('0x3e')]=_0x51ad02;return _0xf7c05a;})[_0xda5d('0x3c')](respondWithFilteredResult(_0x38a9ed,_0x2778ec))[_0xda5d('0x3f')](handleError(_0x38a9ed,null));};exports[_0xda5d('0x40')]=function(_0x19eeca,_0x306358){var _0x5b9a3a={'raw':!![],'where':{'id':_0x19eeca[_0xda5d('0x41')]['id']}},_0x24c5b4={};_0x24c5b4[_0xda5d('0x2e')]=_[_0xda5d('0x30')](db[_0xda5d('0x2a')][_0xda5d('0x2b')]);_0x24c5b4[_0xda5d('0x2f')]=_[_0xda5d('0x30')](_0x19eeca[_0xda5d('0x2f')]);_0x24c5b4[_0xda5d('0x31')]=_[_0xda5d('0x33')](_0x24c5b4[_0xda5d('0x2e')],_0x24c5b4['query']);_0x5b9a3a['attributes']=_['intersection'](_0x24c5b4[_0xda5d('0x2e')],qs[_0xda5d('0x42')](_0x19eeca['query'][_0xda5d('0x42')]));_0x5b9a3a['attributes']=_0x5b9a3a[_0xda5d('0x32')][_0xda5d('0x43')]?_0x5b9a3a[_0xda5d('0x32')]:_0x24c5b4[_0xda5d('0x2e')];if(_0x19eeca[_0xda5d('0x2f')]['includeAll']){_0x5b9a3a['include']=[{'all':!![]}];}_0x5b9a3a=_[_0xda5d('0x39')]({},_0x5b9a3a,_0x19eeca[_0xda5d('0x3b')]);return db[_0xda5d('0x2a')][_0xda5d('0x44')](_0x5b9a3a)[_0xda5d('0x3c')](handleEntityNotFound(_0x306358,null))[_0xda5d('0x3c')](respondWithResult(_0x306358,null))[_0xda5d('0x3f')](handleError(_0x306358,null));};exports[_0xda5d('0x45')]=function(_0x2c0419,_0x582396){return db[_0xda5d('0x2a')]['create'](_0x2c0419[_0xda5d('0x46')],{})[_0xda5d('0x3c')](respondWithResult(_0x582396,0xc9))[_0xda5d('0x3f')](handleError(_0x582396,null));};exports[_0xda5d('0x21')]=function(_0x299984,_0x2bdbdd){if(_0x299984[_0xda5d('0x46')]['id']){delete _0x299984['body']['id'];}return db[_0xda5d('0x2a')]['find']({'where':{'id':_0x299984['params']['id']}})[_0xda5d('0x3c')](handleEntityNotFound(_0x2bdbdd,null))[_0xda5d('0x3c')](saveUpdates(_0x299984[_0xda5d('0x46')],null))[_0xda5d('0x3c')](respondWithResult(_0x2bdbdd,null))[_0xda5d('0x3f')](handleError(_0x2bdbdd,null));};exports['destroy']=function(_0x29cccc,_0x500c85){return db[_0xda5d('0x2a')][_0xda5d('0x44')]({'where':{'id':_0x29cccc[_0xda5d('0x41')]['id']}})['then'](handleEntityNotFound(_0x500c85,null))[_0xda5d('0x3c')](removeEntity(_0x500c85,null))[_0xda5d('0x3f')](handleError(_0x500c85,null));};exports[_0xda5d('0x47')]=function(_0xf9f7b5,_0x537864){return db[_0xda5d('0x2a')][_0xda5d('0x47')]()[_0xda5d('0x3c')](respondWithResult(_0x537864,null))[_0xda5d('0x3f')](handleError(_0x537864,null));}; \ No newline at end of file +var _0xe54b=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xe54b,0x1a4));var _0xbe54=function(_0x55c15c,_0x3633e6){_0x55c15c=_0x55c15c-0x0;var _0x5323ad=_0xe54b[_0x55c15c];return _0x5323ad;};'use strict';var pdf=require(_0xbe54('0x0'));var emlformat=require(_0xbe54('0x1'));var rimraf=require(_0xbe54('0x2'));var zipdir=require(_0xbe54('0x3'));var jsonpatch=require(_0xbe54('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe54('0x5'));var util=require(_0xbe54('0x6'));var path=require(_0xbe54('0x7'));var sox=require(_0xbe54('0x8'));var csv=require(_0xbe54('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbe54('0xa'));var crypto=require(_0xbe54('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbe54('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbe54('0xd'));var Papa=require('papaparse');var Redis=require(_0xbe54('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe54('0xf'));var hardwareService=require(_0xbe54('0x10'));var logger=require(_0xbe54('0x11'))(_0xbe54('0x12'));var utils=require(_0xbe54('0x13'));var config=require(_0xbe54('0x14'));var db=require(_0xbe54('0x15'))['db'];function respondWithStatusCode(_0x81b01c,_0x59be5e){_0x59be5e=_0x59be5e||0xcc;return function(_0x295c90){if(_0x295c90){return _0x81b01c[_0xbe54('0x16')](_0x59be5e);}return _0x81b01c[_0xbe54('0x17')](_0x59be5e)[_0xbe54('0x18')]();};}function respondWithResult(_0x276aee,_0x47b43c){_0x47b43c=_0x47b43c||0xc8;return function(_0x2eeeb2){if(_0x2eeeb2){return _0x276aee[_0xbe54('0x17')](_0x47b43c)[_0xbe54('0x19')](_0x2eeeb2);}};}function respondWithFilteredResult(_0x409c8a,_0x5b7bc6){return function(_0x291047){if(_0x291047){var _0x31c2f3=_0x291047['count'],_0x59f6ed=_0x5b7bc6[_0xbe54('0x1a')],_0x4fa54d=_0x5b7bc6[_0xbe54('0x1a')]+_0x5b7bc6[_0xbe54('0x1b')],_0x4483f1;if(_0x4fa54d>=_0x31c2f3){_0x4fa54d=_0x31c2f3;_0x4483f1=0xc8;}else{_0x4483f1=0xce;}_0x409c8a['status'](_0x4483f1);return _0x409c8a[_0xbe54('0x1c')](_0xbe54('0x1d'),_0x59f6ed+'-'+_0x4fa54d+'/'+_0x31c2f3)[_0xbe54('0x19')](_0x291047);}return null;};}function patchUpdates(_0x5dc32f){return function(_0xbfe467){try{jsonpatch['apply'](_0xbfe467,_0x5dc32f,!![]);}catch(_0x4025a7){return BPromise[_0xbe54('0x1e')](_0x4025a7);}return _0xbfe467[_0xbe54('0x1f')]();};}function saveUpdates(_0x1cf2c1,_0x5aa951){return function(_0x2c3ed4){if(_0x2c3ed4){return _0x2c3ed4['update'](_0x1cf2c1)[_0xbe54('0x20')](function(_0x41fd19){return _0x41fd19;});}return null;};}function removeEntity(_0x99341b,_0x397879){return function(_0x18c3de){if(_0x18c3de){return _0x18c3de[_0xbe54('0x21')]()['then'](function(){_0x99341b[_0xbe54('0x17')](0xcc)[_0xbe54('0x18')]();});}};}function handleEntityNotFound(_0x30e5b0,_0xda0c1b){return function(_0x397cba){if(!_0x397cba){_0x30e5b0[_0xbe54('0x16')](0x194);}return _0x397cba;};}function handleError(_0x4a17c5,_0x5d1402){_0x5d1402=_0x5d1402||0x1f4;return function(_0x17f629){logger[_0xbe54('0x22')](_0x17f629[_0xbe54('0x23')]);if(_0x17f629[_0xbe54('0x24')]){delete _0x17f629[_0xbe54('0x24')];}_0x4a17c5[_0xbe54('0x17')](_0x5d1402)[_0xbe54('0x25')](_0x17f629);};}exports['index']=function(_0x3bd611,_0x5c9adc){var _0x5281f4={},_0x5bcada={},_0x3971ce={'count':0x0,'rows':[]};var _0x228a27=_[_0xbe54('0x26')](db[_0xbe54('0x27')][_0xbe54('0x28')],function(_0x1fe3ae){return{'name':_0x1fe3ae['fieldName'],'type':_0x1fe3ae[_0xbe54('0x29')][_0xbe54('0x2a')]};});_0x5bcada['model']=_[_0xbe54('0x26')](_0x228a27,_0xbe54('0x24'));_0x5bcada[_0xbe54('0x2b')]=_[_0xbe54('0x2c')](_0x3bd611[_0xbe54('0x2b')]);_0x5bcada[_0xbe54('0x2d')]=_[_0xbe54('0x2e')](_0x5bcada['model'],_0x5bcada[_0xbe54('0x2b')]);_0x5281f4[_0xbe54('0x2f')]=_[_0xbe54('0x2e')](_0x5bcada['model'],qs[_0xbe54('0x30')](_0x3bd611[_0xbe54('0x2b')][_0xbe54('0x30')]));_0x5281f4[_0xbe54('0x2f')]=_0x5281f4['attributes'][_0xbe54('0x31')]?_0x5281f4[_0xbe54('0x2f')]:_0x5bcada[_0xbe54('0x32')];if(!_0x3bd611[_0xbe54('0x2b')][_0xbe54('0x33')](_0xbe54('0x34'))){_0x5281f4[_0xbe54('0x1b')]=qs['limit'](_0x3bd611['query']['limit']);_0x5281f4['offset']=qs[_0xbe54('0x1a')](_0x3bd611['query'][_0xbe54('0x1a')]);}_0x5281f4[_0xbe54('0x35')]=qs[_0xbe54('0x36')](_0x3bd611[_0xbe54('0x2b')]['sort']);_0x5281f4['where']=qs[_0xbe54('0x2d')](_[_0xbe54('0x37')](_0x3bd611[_0xbe54('0x2b')],_0x5bcada[_0xbe54('0x2d')]),_0x228a27);if(_0x3bd611[_0xbe54('0x2b')]['filter']){_0x5281f4[_0xbe54('0x38')]=_[_0xbe54('0x39')](_0x5281f4[_0xbe54('0x38')],{'$or':_['map'](_0x228a27,function(_0x4e97ca){if(_0x4e97ca[_0xbe54('0x29')]!==_0xbe54('0x3a')){var _0x250b7c={};_0x250b7c[_0x4e97ca['name']]={'$like':'%'+_0x3bd611[_0xbe54('0x2b')][_0xbe54('0x3b')]+'%'};return _0x250b7c;}})});}_0x5281f4=_[_0xbe54('0x39')]({},_0x5281f4,_0x3bd611[_0xbe54('0x3c')]);var _0x2f231e={'where':_0x5281f4['where']};return db[_0xbe54('0x27')][_0xbe54('0x3d')](_0x2f231e)[_0xbe54('0x20')](function(_0x421911){_0x3971ce['count']=_0x421911;if(_0x3bd611[_0xbe54('0x2b')][_0xbe54('0x3e')]){_0x5281f4[_0xbe54('0x3f')]=[{'all':!![]}];}return db[_0xbe54('0x27')][_0xbe54('0x40')](_0x5281f4);})[_0xbe54('0x20')](function(_0x33f277){_0x3971ce[_0xbe54('0x41')]=_0x33f277;return _0x3971ce;})['then'](respondWithFilteredResult(_0x5c9adc,_0x5281f4))['catch'](handleError(_0x5c9adc,null));};exports[_0xbe54('0x42')]=function(_0x37e3d2,_0x1c82aa){var _0x1bf92d={'raw':!![],'where':{'id':_0x37e3d2[_0xbe54('0x43')]['id']}},_0x4f4460={};_0x4f4460[_0xbe54('0x32')]=_[_0xbe54('0x2c')](db[_0xbe54('0x27')][_0xbe54('0x28')]);_0x4f4460[_0xbe54('0x2b')]=_['keys'](_0x37e3d2[_0xbe54('0x2b')]);_0x4f4460[_0xbe54('0x2d')]=_[_0xbe54('0x2e')](_0x4f4460[_0xbe54('0x32')],_0x4f4460[_0xbe54('0x2b')]);_0x1bf92d[_0xbe54('0x2f')]=_['intersection'](_0x4f4460[_0xbe54('0x32')],qs[_0xbe54('0x30')](_0x37e3d2[_0xbe54('0x2b')][_0xbe54('0x30')]));_0x1bf92d['attributes']=_0x1bf92d[_0xbe54('0x2f')]['length']?_0x1bf92d[_0xbe54('0x2f')]:_0x4f4460[_0xbe54('0x32')];if(_0x37e3d2[_0xbe54('0x2b')][_0xbe54('0x3e')]){_0x1bf92d[_0xbe54('0x3f')]=[{'all':!![]}];}_0x1bf92d=_[_0xbe54('0x39')]({},_0x1bf92d,_0x37e3d2[_0xbe54('0x3c')]);return db[_0xbe54('0x27')][_0xbe54('0x44')](_0x1bf92d)['then'](handleEntityNotFound(_0x1c82aa,null))[_0xbe54('0x20')](respondWithResult(_0x1c82aa,null))['catch'](handleError(_0x1c82aa,null));};exports[_0xbe54('0x45')]=function(_0x4744f6,_0x59b1c2){return db[_0xbe54('0x27')]['create'](_0x4744f6[_0xbe54('0x46')],{})[_0xbe54('0x20')](respondWithResult(_0x59b1c2,0xc9))['catch'](handleError(_0x59b1c2,null));};exports[_0xbe54('0x47')]=function(_0x2061c2,_0x5069c3){if(_0x2061c2[_0xbe54('0x46')]['id']){delete _0x2061c2['body']['id'];}return db[_0xbe54('0x27')][_0xbe54('0x44')]({'where':{'id':_0x2061c2[_0xbe54('0x43')]['id']}})['then'](handleEntityNotFound(_0x5069c3,null))[_0xbe54('0x20')](saveUpdates(_0x2061c2['body'],null))[_0xbe54('0x20')](respondWithResult(_0x5069c3,null))[_0xbe54('0x48')](handleError(_0x5069c3,null));};exports[_0xbe54('0x21')]=function(_0x264342,_0x2bc0a5){return db[_0xbe54('0x27')][_0xbe54('0x44')]({'where':{'id':_0x264342['params']['id']}})['then'](handleEntityNotFound(_0x2bc0a5,null))[_0xbe54('0x20')](removeEntity(_0x2bc0a5,null))[_0xbe54('0x48')](handleError(_0x2bc0a5,null));};exports['describe']=function(_0x9b6f2b,_0x561c40){return db[_0xbe54('0x27')]['describe']()[_0xbe54('0x20')](respondWithResult(_0x561c40,null))['catch'](handleError(_0x561c40,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a215617..327b7e1 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 _0x9dda=['../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util'];(function(_0x31a09c,_0x22ee96){var _0x4b4ed0=function(_0x55d301){while(--_0x55d301){_0x31a09c['push'](_0x31a09c['shift']());}};_0x4b4ed0(++_0x22ee96);}(_0x9dda,0x1a3));var _0xa9dd=function(_0x8e9d70,_0x3059f6){_0x8e9d70=_0x8e9d70-0x0;var _0x58ecc1=_0x9dda[_0x8e9d70];return _0x58ecc1;};'use strict';var _=require('lodash');var util=require(_0xa9dd('0x0'));var logger=require(_0xa9dd('0x1'))(_0xa9dd('0x2'));var moment=require(_0xa9dd('0x3'));var BPromise=require(_0xa9dd('0x4'));var rp=require(_0xa9dd('0x5'));var fs=require('fs');var path=require(_0xa9dd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9dd('0x7'));module[_0xa9dd('0x8')]=function(_0x239485,_0x1025bf){return _0x239485[_0xa9dd('0x9')](_0xa9dd('0xa'),attributes,{'tableName':_0xa9dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bb1=['path','rimraf','exports','define','report_jscripty_questions','util','../../config/logger','api','bluebird','request-promise'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1bb1,0xff));var _0x11bb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1bb1[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x11bb('0x0'));var logger=require(_0x11bb('0x1'))(_0x11bb('0x2'));var moment=require('moment');var BPromise=require(_0x11bb('0x3'));var rp=require(_0x11bb('0x4'));var fs=require('fs');var path=require(_0x11bb('0x5'));var rimraf=require(_0x11bb('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x11bb('0x7')]=function(_0x3717df,_0x73c164){return _0x3717df[_0x11bb('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x11bb('0x9'),'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 f758699..00daf38 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 _0x7871=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment'];(function(_0x403c23,_0x210794){var _0x23c48f=function(_0x55b54f){while(--_0x55b54f){_0x403c23['push'](_0x403c23['shift']());}};_0x23c48f(++_0x210794);}(_0x7871,0x1b7));var _0x1787=function(_0x440cc5,_0x43225a){_0x440cc5=_0x440cc5-0x0;var _0x1f207b=_0x7871[_0x440cc5];return _0x1f207b;};'use strict';var _=require(_0x1787('0x0'));var util=require('util');var moment=require(_0x1787('0x1'));var BPromise=require(_0x1787('0x2'));var rs=require(_0x1787('0x3'));var fs=require('fs');var Redis=require(_0x1787('0x4'));var db=require(_0x1787('0x5'))['db'];var utils=require(_0x1787('0x6'));var logger=require(_0x1787('0x7'))(_0x1787('0x8'));var config=require(_0x1787('0x9'));var jayson=require(_0x1787('0xa'));var client=jayson[_0x1787('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558719,_0x3cbb70,_0x1230ed){return new BPromise(function(_0x2813e3,_0x630671){return client[_0x1787('0xc')](_0x558719,_0x1230ed)[_0x1787('0xd')](function(_0xd337fb){logger[_0x1787('0xe')](_0x1787('0xf'),_0x3cbb70,_0x1787('0x10'));logger[_0x1787('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3cbb70,_0x1787('0x10'),JSON['stringify'](_0xd337fb));if(_0xd337fb['error']){if(_0xd337fb[_0x1787('0x12')]['code']===0x1f4){logger[_0x1787('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3cbb70,_0xd337fb[_0x1787('0x12')]['message']);return _0x630671(_0xd337fb[_0x1787('0x12')][_0x1787('0x13')]);}logger[_0x1787('0x12')](_0x1787('0xf'),_0x3cbb70,_0xd337fb[_0x1787('0x12')][_0x1787('0x13')]);return _0x2813e3(_0xd337fb[_0x1787('0x12')][_0x1787('0x13')]);}else{logger[_0x1787('0xe')](_0x1787('0xf'),_0x3cbb70,_0x1787('0x10'));_0x2813e3(_0xd337fb['result'][_0x1787('0x13')]);}})[_0x1787('0x14')](function(_0x546df0){logger[_0x1787('0x12')](_0x1787('0xf'),_0x3cbb70,_0x546df0);_0x630671(_0x546df0);});});} \ No newline at end of file +var _0x68a4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x3c84e5,_0x412c4a){var _0x4dd2e9=function(_0x1f6ed6){while(--_0x1f6ed6){_0x3c84e5['push'](_0x3c84e5['shift']());}};_0x4dd2e9(++_0x412c4a);}(_0x68a4,0x129));var _0x468a=function(_0xee50c8,_0x1d426e){_0xee50c8=_0xee50c8-0x0;var _0x279f00=_0x68a4[_0xee50c8];return _0x279f00;};'use strict';var _=require(_0x468a('0x0'));var util=require(_0x468a('0x1'));var moment=require(_0x468a('0x2'));var BPromise=require(_0x468a('0x3'));var rs=require(_0x468a('0x4'));var fs=require('fs');var Redis=require(_0x468a('0x5'));var db=require(_0x468a('0x6'))['db'];var utils=require(_0x468a('0x7'));var logger=require(_0x468a('0x8'))('rpc');var config=require(_0x468a('0x9'));var jayson=require(_0x468a('0xa'));var client=jayson[_0x468a('0xb')][_0x468a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x536445,_0x1e3146,_0x532564){return new BPromise(function(_0x51951e,_0x22b88e){return client[_0x468a('0xd')](_0x536445,_0x532564)['then'](function(_0x5659ef){logger[_0x468a('0xe')](_0x468a('0xf'),_0x1e3146,_0x468a('0x10'));logger[_0x468a('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x1e3146,'request\x20sent',JSON[_0x468a('0x12')](_0x5659ef));if(_0x5659ef[_0x468a('0x13')]){if(_0x5659ef[_0x468a('0x13')]['code']===0x1f4){logger[_0x468a('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e3146,_0x5659ef['error'][_0x468a('0x14')]);return _0x22b88e(_0x5659ef['error'][_0x468a('0x14')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e3146,_0x5659ef['error'][_0x468a('0x14')]);return _0x51951e(_0x5659ef[_0x468a('0x13')]['message']);}else{logger[_0x468a('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e3146,_0x468a('0x10'));_0x51951e(_0x5659ef[_0x468a('0x15')][_0x468a('0x14')]);}})[_0x468a('0x16')](function(_0x41be30){logger[_0x468a('0x13')](_0x468a('0xf'),_0x1e3146,_0x41be30);_0x22b88e(_0x41be30);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2a5fb66..9bbad31 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 _0xfd0f=['update','/:id','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','post','create'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x2754ab,_0x38ce21){_0x2754ab=_0x2754ab-0x0;var _0x19fd0d=_0xfd0f[_0x2754ab];return _0x19fd0d;};'use strict';var multer=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var path=require('path');var timeout=require(_0xffd0('0x2'));var express=require(_0xffd0('0x3'));var router=express[_0xffd0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xffd0('0x5'));var config=require('../../config/environment');var controller=require(_0xffd0('0x6'));router[_0xffd0('0x7')]('/',auth[_0xffd0('0x8')](),controller[_0xffd0('0x9')]);router[_0xffd0('0x7')](_0xffd0('0xa'),auth[_0xffd0('0x8')](),controller[_0xffd0('0xb')]);router[_0xffd0('0x7')]('/:id',auth[_0xffd0('0x8')](),controller[_0xffd0('0xc')]);router[_0xffd0('0x7')](_0xffd0('0xd'),auth['isAuthenticated'](),controller['getQuestions']);router[_0xffd0('0xe')]('/',auth[_0xffd0('0x8')](),controller[_0xffd0('0xf')]);router['put']('/:id',auth[_0xffd0('0x8')](),controller[_0xffd0('0x10')]);router['delete'](_0xffd0('0x11'),auth[_0xffd0('0x8')](),controller[_0xffd0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6f7f=['express','Router','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x1252d9,_0xb59816){var _0x76c018=function(_0x52e72c){while(--_0x52e72c){_0x1252d9['push'](_0x1252d9['shift']());}};_0x76c018(++_0xb59816);}(_0x6f7f,0x177));var _0xf6f7=function(_0x19191c,_0x180441){_0x19191c=_0x19191c-0x0;var _0x1138f6=_0x6f7f[_0x19191c];return _0x1138f6;};'use strict';var multer=require('multer');var util=require(_0xf6f7('0x0'));var path=require(_0xf6f7('0x1'));var timeout=require(_0xf6f7('0x2'));var express=require(_0xf6f7('0x3'));var router=express[_0xf6f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf6f7('0x5'));var config=require('../../config/environment');var controller=require(_0xf6f7('0x6'));router[_0xf6f7('0x7')]('/',auth[_0xf6f7('0x8')](),controller['index']);router[_0xf6f7('0x7')]('/describe',auth[_0xf6f7('0x8')](),controller[_0xf6f7('0x9')]);router[_0xf6f7('0x7')](_0xf6f7('0xa'),auth[_0xf6f7('0x8')](),controller[_0xf6f7('0xb')]);router['get'](_0xf6f7('0xc'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth[_0xf6f7('0x8')](),controller[_0xf6f7('0xd')]);router[_0xf6f7('0xe')](_0xf6f7('0xa'),auth[_0xf6f7('0x8')](),controller[_0xf6f7('0xf')]);router['delete']('/:id',auth[_0xf6f7('0x8')](),controller[_0xf6f7('0x10')]);module[_0xf6f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d7db202..967e00c 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 _0x2b3f=['DATE','setDataValue','starttime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x281d51,_0x200860){var _0x1e272d=function(_0x275f59){while(--_0x275f59){_0x281d51['push'](_0x281d51['shift']());}};_0x1e272d(++_0x200860);}(_0x2b3f,0x1c6));var _0xf2b3=function(_0x165e8a,_0x170b15){_0x165e8a=_0x165e8a-0x0;var _0x20d955=_0x2b3f[_0x165e8a];return _0x20d955;};'use strict';var moment=require(_0xf2b3('0x0'));var Sequelize=require('sequelize');module[_0xf2b3('0x1')]={'starttime':{'type':Sequelize[_0xf2b3('0x2')],'set':function(_0x357497){this[_0xf2b3('0x3')](_0xf2b3('0x4'),_0x357497);this['setDataValue']('endtime',moment()['format'](_0xf2b3('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf2b3('0x6')]},'projectname':{'type':Sequelize[_0xf2b3('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf2b3('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf2b3('0x6')]},'completed':{'type':Sequelize[_0xf2b3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9cae=['DATE','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9cae,0xed));var _0xe9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9cae[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xe9ca('0x0'));var Sequelize=require(_0xe9ca('0x1'));module[_0xe9ca('0x2')]={'starttime':{'type':Sequelize[_0xe9ca('0x3')],'set':function(_0x119c97){this['setDataValue'](_0xe9ca('0x4'),_0x119c97);this[_0xe9ca('0x5')]('endtime',moment()[_0xe9ca('0x6')](_0xe9ca('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe9ca('0x8')]},'queue':{'type':Sequelize[_0xe9ca('0x8')]},'uniqueid':{'type':Sequelize[_0xe9ca('0x8')]},'calleridname':{'type':Sequelize[_0xe9ca('0x8')]},'calleridnum':{'type':Sequelize[_0xe9ca('0x8')]},'completed':{'type':Sequelize[_0xe9ca('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index f3e108b..a2aa5f7 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 _0xf2c9=['intersection','options','find','catch','create','body','update','params','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','SessionId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','end','error','stack','name','send','map','JscriptySessionReport','fieldName','type','key','model','query','keys','attributes','fields','length','order','sort','filters','pick','filter','merge','where','includeAll','include','rows','then','show','rawAttributes'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf2c9,0xf7));var _0x9f2c=function(_0x5b82e9,_0x382fe1){_0x5b82e9=_0x5b82e9-0x0;var _0x204239=_0xf2c9[_0x5b82e9];return _0x204239;};'use strict';var pdf=require(_0x9f2c('0x0'));var emlformat=require(_0x9f2c('0x1'));var rimraf=require(_0x9f2c('0x2'));var zipdir=require(_0x9f2c('0x3'));var jsonpatch=require(_0x9f2c('0x4'));var rp=require('request-promise');var moment=require(_0x9f2c('0x5'));var BPromise=require(_0x9f2c('0x6'));var Mustache=require(_0x9f2c('0x7'));var util=require(_0x9f2c('0x8'));var path=require(_0x9f2c('0x9'));var sox=require(_0x9f2c('0xa'));var csv=require(_0x9f2c('0xb'));var ejs=require(_0x9f2c('0xc'));var fs=require('fs');var _=require(_0x9f2c('0xd'));var squel=require(_0x9f2c('0xe'));var crypto=require(_0x9f2c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f2c('0xb'));var querystring=require('querystring');var Papa=require(_0x9f2c('0x10'));var Redis=require(_0x9f2c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f2c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f2c('0x13'));var logger=require(_0x9f2c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd933,_0x1e31e3){_0x1e31e3=_0x1e31e3||0xcc;return function(_0x46d723){if(_0x46d723){return _0x5dd933[_0x9f2c('0x15')](_0x1e31e3);}return _0x5dd933[_0x9f2c('0x16')](_0x1e31e3)['end']();};}function respondWithResult(_0x29a1d6,_0x1f0ed5){_0x1f0ed5=_0x1f0ed5||0xc8;return function(_0x27122e){if(_0x27122e){return _0x29a1d6[_0x9f2c('0x16')](_0x1f0ed5)[_0x9f2c('0x17')](_0x27122e);}};}function respondWithFilteredResult(_0x23c229,_0x5ec2cb){return function(_0x2de5d5){if(_0x2de5d5){var _0x2ccc73=_0x2de5d5[_0x9f2c('0x18')],_0x386b00=_0x5ec2cb['offset'],_0x265c7d=_0x5ec2cb[_0x9f2c('0x19')]+_0x5ec2cb[_0x9f2c('0x1a')],_0x326239;if(_0x265c7d>=_0x2ccc73){_0x265c7d=_0x2ccc73;_0x326239=0xc8;}else{_0x326239=0xce;}_0x23c229[_0x9f2c('0x16')](_0x326239);return _0x23c229[_0x9f2c('0x1b')](_0x9f2c('0x1c'),_0x386b00+'-'+_0x265c7d+'/'+_0x2ccc73)[_0x9f2c('0x17')](_0x2de5d5);}return null;};}function patchUpdates(_0x353bb2){return function(_0x1ff6dd){try{jsonpatch[_0x9f2c('0x1d')](_0x1ff6dd,_0x353bb2,!![]);}catch(_0x51e427){return BPromise[_0x9f2c('0x1e')](_0x51e427);}return _0x1ff6dd[_0x9f2c('0x1f')]();};}function saveUpdates(_0x2de552,_0x424adb){return function(_0x4ca8e4){if(_0x4ca8e4){return _0x4ca8e4['update'](_0x2de552)['then'](function(_0x5041e5){return _0x5041e5;});}return null;};}function removeEntity(_0x19a915,_0x598daa){return function(_0x4d741d){if(_0x4d741d){return _0x4d741d['destroy']()['then'](function(){_0x19a915[_0x9f2c('0x16')](0xcc)[_0x9f2c('0x20')]();});}};}function handleEntityNotFound(_0x5ca76b,_0x139604){return function(_0x2d956b){if(!_0x2d956b){_0x5ca76b[_0x9f2c('0x15')](0x194);}return _0x2d956b;};}function handleError(_0x1abec7,_0x5516be){_0x5516be=_0x5516be||0x1f4;return function(_0x28c12b){logger[_0x9f2c('0x21')](_0x28c12b[_0x9f2c('0x22')]);if(_0x28c12b['name']){delete _0x28c12b[_0x9f2c('0x23')];}_0x1abec7[_0x9f2c('0x16')](_0x5516be)[_0x9f2c('0x24')](_0x28c12b);};}exports['index']=function(_0x5b5763,_0x48b877){var _0x4275d7={},_0x2950ee={},_0x29740b={'count':0x0,'rows':[]};var _0x1facf1=_[_0x9f2c('0x25')](db[_0x9f2c('0x26')]['rawAttributes'],function(_0x444a65){return{'name':_0x444a65[_0x9f2c('0x27')],'type':_0x444a65[_0x9f2c('0x28')][_0x9f2c('0x29')]};});_0x2950ee[_0x9f2c('0x2a')]=_['map'](_0x1facf1,_0x9f2c('0x23'));_0x2950ee[_0x9f2c('0x2b')]=_[_0x9f2c('0x2c')](_0x5b5763[_0x9f2c('0x2b')]);_0x2950ee['filters']=_['intersection'](_0x2950ee[_0x9f2c('0x2a')],_0x2950ee[_0x9f2c('0x2b')]);_0x4275d7[_0x9f2c('0x2d')]=_['intersection'](_0x2950ee['model'],qs[_0x9f2c('0x2e')](_0x5b5763[_0x9f2c('0x2b')]['fields']));_0x4275d7[_0x9f2c('0x2d')]=_0x4275d7[_0x9f2c('0x2d')][_0x9f2c('0x2f')]?_0x4275d7['attributes']:_0x2950ee[_0x9f2c('0x2a')];if(!_0x5b5763[_0x9f2c('0x2b')]['hasOwnProperty']('nolimit')){_0x4275d7[_0x9f2c('0x1a')]=qs[_0x9f2c('0x1a')](_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x1a')]);_0x4275d7[_0x9f2c('0x19')]=qs[_0x9f2c('0x19')](_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x19')]);}_0x4275d7[_0x9f2c('0x30')]=qs[_0x9f2c('0x31')](_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x31')]);_0x4275d7['where']=qs[_0x9f2c('0x32')](_[_0x9f2c('0x33')](_0x5b5763[_0x9f2c('0x2b')],_0x2950ee[_0x9f2c('0x32')]),_0x1facf1);if(_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x34')]){_0x4275d7['where']=_['merge'](_0x4275d7['where'],{'$or':_[_0x9f2c('0x25')](_0x1facf1,function(_0x43b28a){if(_0x43b28a[_0x9f2c('0x28')]!=='VIRTUAL'){var _0x1882f9={};_0x1882f9[_0x43b28a['name']]={'$like':'%'+_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x34')]+'%'};return _0x1882f9;}})});}_0x4275d7=_[_0x9f2c('0x35')]({},_0x4275d7,_0x5b5763['options']);var _0x321ac3={'where':_0x4275d7[_0x9f2c('0x36')]};return db[_0x9f2c('0x26')][_0x9f2c('0x18')](_0x321ac3)['then'](function(_0x5055e5){_0x29740b[_0x9f2c('0x18')]=_0x5055e5;if(_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x37')]){_0x4275d7[_0x9f2c('0x38')]=[{'all':!![]}];}return db[_0x9f2c('0x26')]['findAll'](_0x4275d7);})['then'](function(_0xd95ced){_0x29740b[_0x9f2c('0x39')]=_0xd95ced;return _0x29740b;})[_0x9f2c('0x3a')](respondWithFilteredResult(_0x48b877,_0x4275d7))['catch'](handleError(_0x48b877,null));};exports[_0x9f2c('0x3b')]=function(_0x2eaa4c,_0x3ade1d){var _0x14e698={'raw':!![],'where':{'id':_0x2eaa4c['params']['id']}},_0x530104={};_0x530104[_0x9f2c('0x2a')]=_['keys'](db[_0x9f2c('0x26')][_0x9f2c('0x3c')]);_0x530104['query']=_[_0x9f2c('0x2c')](_0x2eaa4c[_0x9f2c('0x2b')]);_0x530104[_0x9f2c('0x32')]=_[_0x9f2c('0x3d')](_0x530104[_0x9f2c('0x2a')],_0x530104[_0x9f2c('0x2b')]);_0x14e698[_0x9f2c('0x2d')]=_[_0x9f2c('0x3d')](_0x530104[_0x9f2c('0x2a')],qs[_0x9f2c('0x2e')](_0x2eaa4c['query'][_0x9f2c('0x2e')]));_0x14e698['attributes']=_0x14e698[_0x9f2c('0x2d')]['length']?_0x14e698[_0x9f2c('0x2d')]:_0x530104[_0x9f2c('0x2a')];if(_0x2eaa4c['query'][_0x9f2c('0x37')]){_0x14e698[_0x9f2c('0x38')]=[{'all':!![]}];}_0x14e698=_[_0x9f2c('0x35')]({},_0x14e698,_0x2eaa4c[_0x9f2c('0x3e')]);return db[_0x9f2c('0x26')][_0x9f2c('0x3f')](_0x14e698)['then'](handleEntityNotFound(_0x3ade1d,null))['then'](respondWithResult(_0x3ade1d,null))[_0x9f2c('0x40')](handleError(_0x3ade1d,null));};exports[_0x9f2c('0x41')]=function(_0x3e4bdc,_0x2d9fc2){return db[_0x9f2c('0x26')][_0x9f2c('0x41')](_0x3e4bdc[_0x9f2c('0x42')],{})[_0x9f2c('0x3a')](respondWithResult(_0x2d9fc2,0xc9))[_0x9f2c('0x40')](handleError(_0x2d9fc2,null));};exports[_0x9f2c('0x43')]=function(_0x133e6f,_0x5a7a37){if(_0x133e6f[_0x9f2c('0x42')]['id']){delete _0x133e6f[_0x9f2c('0x42')]['id'];}return db[_0x9f2c('0x26')]['find']({'where':{'id':_0x133e6f[_0x9f2c('0x44')]['id']}})[_0x9f2c('0x3a')](handleEntityNotFound(_0x5a7a37,null))[_0x9f2c('0x3a')](saveUpdates(_0x133e6f[_0x9f2c('0x42')],null))[_0x9f2c('0x3a')](respondWithResult(_0x5a7a37,null))[_0x9f2c('0x40')](handleError(_0x5a7a37,null));};exports['destroy']=function(_0x5e38cc,_0x355605){return db[_0x9f2c('0x26')][_0x9f2c('0x3f')]({'where':{'id':_0x5e38cc[_0x9f2c('0x44')]['id']}})['then'](handleEntityNotFound(_0x355605,null))[_0x9f2c('0x3a')](removeEntity(_0x355605,null))[_0x9f2c('0x40')](handleError(_0x355605,null));};exports[_0x9f2c('0x45')]=function(_0x5edba1,_0x16d001){return db['JscriptySessionReport'][_0x9f2c('0x45')]()[_0x9f2c('0x3a')](respondWithResult(_0x16d001,null))[_0x9f2c('0x40')](handleError(_0x16d001,null));};exports[_0x9f2c('0x46')]=function(_0x43f4b2,_0x1af779,_0x3da0f2){var _0x2d313f={'raw':!![],'where':{}};var _0x378612={};var _0x4bbd86={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x9f2c('0x47')]({'where':{'id':_0x43f4b2[_0x9f2c('0x44')]['id']}})[_0x9f2c('0x3a')](handleEntityNotFound(_0x1af779,null))[_0x9f2c('0x3a')](function(_0x2fe5b4){if(_0x2fe5b4){_0x378612[_0x9f2c('0x2a')]=_[_0x9f2c('0x2c')](db[_0x9f2c('0x48')][_0x9f2c('0x3c')]);_0x378612[_0x9f2c('0x2b')]=_[_0x9f2c('0x2c')](_0x43f4b2[_0x9f2c('0x2b')]);_0x378612[_0x9f2c('0x32')]=_[_0x9f2c('0x3d')](_0x378612[_0x9f2c('0x2a')],_0x378612['query']);_0x2d313f[_0x9f2c('0x2d')]=_[_0x9f2c('0x3d')](_0x378612[_0x9f2c('0x2a')],qs['fields'](_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x2e')]));_0x2d313f[_0x9f2c('0x2d')]=_0x2d313f[_0x9f2c('0x2d')][_0x9f2c('0x2f')]?_0x2d313f[_0x9f2c('0x2d')]:_0x378612[_0x9f2c('0x2a')];if(!_0x43f4b2['query'][_0x9f2c('0x49')](_0x9f2c('0x4a'))){_0x2d313f['limit']=qs['limit'](_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x1a')]);_0x2d313f[_0x9f2c('0x19')]=qs['offset'](_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x19')]);}_0x2d313f[_0x9f2c('0x30')]=qs[_0x9f2c('0x31')](_0x43f4b2[_0x9f2c('0x2b')]['sort']);_0x2d313f['where']=qs[_0x9f2c('0x32')](_[_0x9f2c('0x33')](_0x43f4b2['query'],_0x378612[_0x9f2c('0x32')]));_0x2d313f[_0x9f2c('0x36')][_0x9f2c('0x4b')]=_0x2fe5b4['id'];if(_0x43f4b2['query'][_0x9f2c('0x34')]){_0x2d313f[_0x9f2c('0x36')]=_['merge'](_0x2d313f[_0x9f2c('0x36')],{'$or':_[_0x9f2c('0x25')](_0x2d313f[_0x9f2c('0x2d')],function(_0x2acf50){var _0x524710={};_0x524710[_0x2acf50]={'$like':'%'+_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x34')]+'%'};return _0x524710;})});}_0x2d313f=_['merge']({},_0x2d313f,_0x43f4b2['options']);return db[_0x9f2c('0x48')]['count']({'where':_0x2d313f[_0x9f2c('0x36')]})[_0x9f2c('0x3a')](function(_0x3357c2){_0x4bbd86[_0x9f2c('0x18')]=_0x3357c2;if(_0x43f4b2['query'][_0x9f2c('0x37')]){_0x2d313f[_0x9f2c('0x38')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9f2c('0x4c')](_0x2d313f);})['then'](function(_0xed90a4){_0x4bbd86[_0x9f2c('0x39')]=_0xed90a4;return _0x4bbd86;});}})['then'](respondWithFilteredResult(_0x1af779,_0x2d313f))[_0x9f2c('0x40')](handleError(_0x1af779,null));}; \ No newline at end of file +var _0xd514=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','destroy','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xd514,0x148));var _0x4d51=function(_0x626673,_0x30e375){_0x626673=_0x626673-0x0;var _0x4a6d1d=_0xd514[_0x626673];return _0x4a6d1d;};'use strict';var pdf=require(_0x4d51('0x0'));var emlformat=require(_0x4d51('0x1'));var rimraf=require(_0x4d51('0x2'));var zipdir=require(_0x4d51('0x3'));var jsonpatch=require(_0x4d51('0x4'));var rp=require('request-promise');var moment=require(_0x4d51('0x5'));var BPromise=require(_0x4d51('0x6'));var Mustache=require(_0x4d51('0x7'));var util=require(_0x4d51('0x8'));var path=require('path');var sox=require(_0x4d51('0x9'));var csv=require(_0x4d51('0xa'));var ejs=require(_0x4d51('0xb'));var fs=require('fs');var _=require(_0x4d51('0xc'));var squel=require(_0x4d51('0xd'));var crypto=require(_0x4d51('0xe'));var jsforce=require(_0x4d51('0xf'));var deskjs=require(_0x4d51('0x10'));var toCsv=require(_0x4d51('0xa'));var querystring=require('querystring');var Papa=require(_0x4d51('0x11'));var Redis=require(_0x4d51('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4d51('0x13'));var as=require(_0x4d51('0x14'));var hardwareService=require(_0x4d51('0x15'));var logger=require(_0x4d51('0x16'))(_0x4d51('0x17'));var utils=require(_0x4d51('0x18'));var config=require(_0x4d51('0x19'));var db=require(_0x4d51('0x1a'))['db'];function respondWithStatusCode(_0x48a1de,_0xb11df6){_0xb11df6=_0xb11df6||0xcc;return function(_0x3a9b2e){if(_0x3a9b2e){return _0x48a1de[_0x4d51('0x1b')](_0xb11df6);}return _0x48a1de[_0x4d51('0x1c')](_0xb11df6)['end']();};}function respondWithResult(_0x299935,_0x14ff6f){_0x14ff6f=_0x14ff6f||0xc8;return function(_0x1fed9e){if(_0x1fed9e){return _0x299935[_0x4d51('0x1c')](_0x14ff6f)[_0x4d51('0x1d')](_0x1fed9e);}};}function respondWithFilteredResult(_0x3a4cd6,_0x322702){return function(_0x4ef477){if(_0x4ef477){var _0x499b02=_0x4ef477[_0x4d51('0x1e')],_0x135875=_0x322702['offset'],_0x3d6cfa=_0x322702[_0x4d51('0x1f')]+_0x322702[_0x4d51('0x20')],_0x5486b3;if(_0x3d6cfa>=_0x499b02){_0x3d6cfa=_0x499b02;_0x5486b3=0xc8;}else{_0x5486b3=0xce;}_0x3a4cd6[_0x4d51('0x1c')](_0x5486b3);return _0x3a4cd6[_0x4d51('0x21')](_0x4d51('0x22'),_0x135875+'-'+_0x3d6cfa+'/'+_0x499b02)[_0x4d51('0x1d')](_0x4ef477);}return null;};}function patchUpdates(_0x86b050){return function(_0x2f4352){try{jsonpatch[_0x4d51('0x23')](_0x2f4352,_0x86b050,!![]);}catch(_0x95aa17){return BPromise['reject'](_0x95aa17);}return _0x2f4352[_0x4d51('0x24')]();};}function saveUpdates(_0x1acd32,_0x354b13){return function(_0x5d63cb){if(_0x5d63cb){return _0x5d63cb[_0x4d51('0x25')](_0x1acd32)['then'](function(_0x49332c){return _0x49332c;});}return null;};}function removeEntity(_0x5ccfad,_0x1a3075){return function(_0x31fdd3){if(_0x31fdd3){return _0x31fdd3['destroy']()[_0x4d51('0x26')](function(){_0x5ccfad[_0x4d51('0x1c')](0xcc)[_0x4d51('0x27')]();});}};}function handleEntityNotFound(_0x1ae77f,_0x10a859){return function(_0x46a1ce){if(!_0x46a1ce){_0x1ae77f[_0x4d51('0x1b')](0x194);}return _0x46a1ce;};}function handleError(_0x6dbb20,_0x49735f){_0x49735f=_0x49735f||0x1f4;return function(_0x52fd65){logger[_0x4d51('0x28')](_0x52fd65[_0x4d51('0x29')]);if(_0x52fd65['name']){delete _0x52fd65[_0x4d51('0x2a')];}_0x6dbb20['status'](_0x49735f)[_0x4d51('0x2b')](_0x52fd65);};}exports['index']=function(_0x47387d,_0xfbeff){var _0xb18c3c={},_0x193dfd={},_0x49ec62={'count':0x0,'rows':[]};var _0x46417a=_[_0x4d51('0x2c')](db[_0x4d51('0x2d')][_0x4d51('0x2e')],function(_0x189158){return{'name':_0x189158[_0x4d51('0x2f')],'type':_0x189158[_0x4d51('0x30')][_0x4d51('0x31')]};});_0x193dfd[_0x4d51('0x32')]=_[_0x4d51('0x2c')](_0x46417a,_0x4d51('0x2a'));_0x193dfd[_0x4d51('0x33')]=_[_0x4d51('0x34')](_0x47387d[_0x4d51('0x33')]);_0x193dfd['filters']=_[_0x4d51('0x35')](_0x193dfd[_0x4d51('0x32')],_0x193dfd['query']);_0xb18c3c[_0x4d51('0x36')]=_[_0x4d51('0x35')](_0x193dfd[_0x4d51('0x32')],qs[_0x4d51('0x37')](_0x47387d[_0x4d51('0x33')]['fields']));_0xb18c3c[_0x4d51('0x36')]=_0xb18c3c['attributes'][_0x4d51('0x38')]?_0xb18c3c[_0x4d51('0x36')]:_0x193dfd[_0x4d51('0x32')];if(!_0x47387d[_0x4d51('0x33')][_0x4d51('0x39')](_0x4d51('0x3a'))){_0xb18c3c[_0x4d51('0x20')]=qs[_0x4d51('0x20')](_0x47387d[_0x4d51('0x33')][_0x4d51('0x20')]);_0xb18c3c[_0x4d51('0x1f')]=qs[_0x4d51('0x1f')](_0x47387d[_0x4d51('0x33')]['offset']);}_0xb18c3c[_0x4d51('0x3b')]=qs[_0x4d51('0x3c')](_0x47387d[_0x4d51('0x33')][_0x4d51('0x3c')]);_0xb18c3c[_0x4d51('0x3d')]=qs[_0x4d51('0x3e')](_[_0x4d51('0x3f')](_0x47387d[_0x4d51('0x33')],_0x193dfd[_0x4d51('0x3e')]),_0x46417a);if(_0x47387d[_0x4d51('0x33')][_0x4d51('0x40')]){_0xb18c3c[_0x4d51('0x3d')]=_[_0x4d51('0x41')](_0xb18c3c[_0x4d51('0x3d')],{'$or':_[_0x4d51('0x2c')](_0x46417a,function(_0x20cf47){if(_0x20cf47[_0x4d51('0x30')]!==_0x4d51('0x42')){var _0x242fe8={};_0x242fe8[_0x20cf47[_0x4d51('0x2a')]]={'$like':'%'+_0x47387d['query'][_0x4d51('0x40')]+'%'};return _0x242fe8;}})});}_0xb18c3c=_['merge']({},_0xb18c3c,_0x47387d[_0x4d51('0x43')]);var _0x29de5d={'where':_0xb18c3c[_0x4d51('0x3d')]};return db[_0x4d51('0x2d')][_0x4d51('0x1e')](_0x29de5d)[_0x4d51('0x26')](function(_0x2c3870){_0x49ec62['count']=_0x2c3870;if(_0x47387d[_0x4d51('0x33')][_0x4d51('0x44')]){_0xb18c3c[_0x4d51('0x45')]=[{'all':!![]}];}return db[_0x4d51('0x2d')]['findAll'](_0xb18c3c);})[_0x4d51('0x26')](function(_0x5552f2){_0x49ec62[_0x4d51('0x46')]=_0x5552f2;return _0x49ec62;})[_0x4d51('0x26')](respondWithFilteredResult(_0xfbeff,_0xb18c3c))['catch'](handleError(_0xfbeff,null));};exports[_0x4d51('0x47')]=function(_0x15cf43,_0x2b2b0f){var _0x50a315={'raw':!![],'where':{'id':_0x15cf43[_0x4d51('0x48')]['id']}},_0x4e0c42={};_0x4e0c42[_0x4d51('0x32')]=_[_0x4d51('0x34')](db[_0x4d51('0x2d')][_0x4d51('0x2e')]);_0x4e0c42[_0x4d51('0x33')]=_[_0x4d51('0x34')](_0x15cf43['query']);_0x4e0c42[_0x4d51('0x3e')]=_[_0x4d51('0x35')](_0x4e0c42[_0x4d51('0x32')],_0x4e0c42[_0x4d51('0x33')]);_0x50a315[_0x4d51('0x36')]=_['intersection'](_0x4e0c42[_0x4d51('0x32')],qs[_0x4d51('0x37')](_0x15cf43[_0x4d51('0x33')]['fields']));_0x50a315['attributes']=_0x50a315['attributes'][_0x4d51('0x38')]?_0x50a315[_0x4d51('0x36')]:_0x4e0c42['model'];if(_0x15cf43[_0x4d51('0x33')]['includeAll']){_0x50a315['include']=[{'all':!![]}];}_0x50a315=_[_0x4d51('0x41')]({},_0x50a315,_0x15cf43[_0x4d51('0x43')]);return db['JscriptySessionReport'][_0x4d51('0x49')](_0x50a315)[_0x4d51('0x26')](handleEntityNotFound(_0x2b2b0f,null))[_0x4d51('0x26')](respondWithResult(_0x2b2b0f,null))[_0x4d51('0x4a')](handleError(_0x2b2b0f,null));};exports[_0x4d51('0x4b')]=function(_0x1c7abf,_0x26415f){return db[_0x4d51('0x2d')][_0x4d51('0x4b')](_0x1c7abf[_0x4d51('0x4c')],{})[_0x4d51('0x26')](respondWithResult(_0x26415f,0xc9))[_0x4d51('0x4a')](handleError(_0x26415f,null));};exports[_0x4d51('0x25')]=function(_0x82d60,_0x15c5b2){if(_0x82d60[_0x4d51('0x4c')]['id']){delete _0x82d60[_0x4d51('0x4c')]['id'];}return db[_0x4d51('0x2d')]['find']({'where':{'id':_0x82d60[_0x4d51('0x48')]['id']}})[_0x4d51('0x26')](handleEntityNotFound(_0x15c5b2,null))[_0x4d51('0x26')](saveUpdates(_0x82d60['body'],null))[_0x4d51('0x26')](respondWithResult(_0x15c5b2,null))['catch'](handleError(_0x15c5b2,null));};exports[_0x4d51('0x4d')]=function(_0x518063,_0xc46adb){return db['JscriptySessionReport']['find']({'where':{'id':_0x518063[_0x4d51('0x48')]['id']}})['then'](handleEntityNotFound(_0xc46adb,null))[_0x4d51('0x26')](removeEntity(_0xc46adb,null))[_0x4d51('0x4a')](handleError(_0xc46adb,null));};exports[_0x4d51('0x4e')]=function(_0x123d06,_0xab7bc5){return db[_0x4d51('0x2d')][_0x4d51('0x4e')]()[_0x4d51('0x26')](respondWithResult(_0xab7bc5,null))[_0x4d51('0x4a')](handleError(_0xab7bc5,null));};exports[_0x4d51('0x4f')]=function(_0x245d9b,_0x6556d4,_0xea2109){var _0x3379e6={'raw':!![],'where':{}};var _0x59173b={};var _0x58958c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x4d51('0x50')]({'where':{'id':_0x245d9b[_0x4d51('0x48')]['id']}})[_0x4d51('0x26')](handleEntityNotFound(_0x6556d4,null))[_0x4d51('0x26')](function(_0x387a01){if(_0x387a01){_0x59173b[_0x4d51('0x32')]=_['keys'](db['JscriptyQuestionReport'][_0x4d51('0x2e')]);_0x59173b['query']=_[_0x4d51('0x34')](_0x245d9b[_0x4d51('0x33')]);_0x59173b[_0x4d51('0x3e')]=_[_0x4d51('0x35')](_0x59173b['model'],_0x59173b[_0x4d51('0x33')]);_0x3379e6[_0x4d51('0x36')]=_[_0x4d51('0x35')](_0x59173b['model'],qs[_0x4d51('0x37')](_0x245d9b[_0x4d51('0x33')][_0x4d51('0x37')]));_0x3379e6[_0x4d51('0x36')]=_0x3379e6[_0x4d51('0x36')][_0x4d51('0x38')]?_0x3379e6[_0x4d51('0x36')]:_0x59173b[_0x4d51('0x32')];if(!_0x245d9b[_0x4d51('0x33')][_0x4d51('0x39')](_0x4d51('0x3a'))){_0x3379e6[_0x4d51('0x20')]=qs[_0x4d51('0x20')](_0x245d9b[_0x4d51('0x33')][_0x4d51('0x20')]);_0x3379e6[_0x4d51('0x1f')]=qs[_0x4d51('0x1f')](_0x245d9b[_0x4d51('0x33')][_0x4d51('0x1f')]);}_0x3379e6[_0x4d51('0x3b')]=qs['sort'](_0x245d9b[_0x4d51('0x33')]['sort']);_0x3379e6[_0x4d51('0x3d')]=qs[_0x4d51('0x3e')](_[_0x4d51('0x3f')](_0x245d9b[_0x4d51('0x33')],_0x59173b[_0x4d51('0x3e')]));_0x3379e6['where'][_0x4d51('0x51')]=_0x387a01['id'];if(_0x245d9b[_0x4d51('0x33')][_0x4d51('0x40')]){_0x3379e6[_0x4d51('0x3d')]=_[_0x4d51('0x41')](_0x3379e6[_0x4d51('0x3d')],{'$or':_[_0x4d51('0x2c')](_0x3379e6[_0x4d51('0x36')],function(_0xf1f81f){var _0x5de4eb={};_0x5de4eb[_0xf1f81f]={'$like':'%'+_0x245d9b[_0x4d51('0x33')][_0x4d51('0x40')]+'%'};return _0x5de4eb;})});}_0x3379e6=_[_0x4d51('0x41')]({},_0x3379e6,_0x245d9b[_0x4d51('0x43')]);return db[_0x4d51('0x52')]['count']({'where':_0x3379e6[_0x4d51('0x3d')]})[_0x4d51('0x26')](function(_0x176513){_0x58958c[_0x4d51('0x1e')]=_0x176513;if(_0x245d9b[_0x4d51('0x33')][_0x4d51('0x44')]){_0x3379e6[_0x4d51('0x45')]=[{'all':!![]}];}return db[_0x4d51('0x52')][_0x4d51('0x53')](_0x3379e6);})['then'](function(_0x10e79f){_0x58958c['rows']=_0x10e79f;return _0x58958c;});}})[_0x4d51('0x26')](respondWithFilteredResult(_0x6556d4,_0x3379e6))[_0x4d51('0x4a')](handleError(_0x6556d4,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1f2cae7..3ecbd96 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 _0x36c3=['define','JscriptySessionReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x162583,_0x4eb59c){var _0x1a44d3=function(_0xc37d11){while(--_0xc37d11){_0x162583['push'](_0x162583['shift']());}};_0x1a44d3(++_0x4eb59c);}(_0x36c3,0x1a6));var _0x336c=function(_0x2f0bf1,_0x183ef1){_0x2f0bf1=_0x2f0bf1-0x0;var _0xf1df38=_0x36c3[_0x2f0bf1];return _0xf1df38;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require('../../config/logger')(_0x336c('0x2'));var moment=require(_0x336c('0x3'));var BPromise=require(_0x336c('0x4'));var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0x336c('0x9')]=function(_0x2e0016,_0x2097a8){return _0x2e0016[_0x336c('0xa')](_0x336c('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38b8=['../../config/logger','api','bluebird','rimraf','../../config/environment','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x38b8,0x7f));var _0x838b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var logger=require(_0x838b('0x1'))(_0x838b('0x2'));var moment=require('moment');var BPromise=require(_0x838b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x43fd53,_0x4299dc){return _0x43fd53['define'](_0x838b('0x6'),attributes,{'tableName':_0x838b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4e6e72f..e23a3e1 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 _0xc4ca=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x3f70e2,_0x57a580){var _0x371537=function(_0x453083){while(--_0x453083){_0x3f70e2['push'](_0x3f70e2['shift']());}};_0x371537(++_0x57a580);}(_0xc4ca,0x141));var _0xac4c=function(_0x4c0620,_0x59846d){_0x4c0620=_0x4c0620-0x0;var _0x11d3c2=_0xc4ca[_0x4c0620];return _0x11d3c2;};'use strict';var _=require(_0xac4c('0x0'));var util=require(_0xac4c('0x1'));var moment=require(_0xac4c('0x2'));var BPromise=require(_0xac4c('0x3'));var rs=require(_0xac4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac4c('0x5'));var logger=require(_0xac4c('0x6'))(_0xac4c('0x7'));var config=require(_0xac4c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xac4c('0x9')][_0xac4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2122,_0x54674a,_0x4180fd){return new BPromise(function(_0xe6171d,_0x5c1501){return client[_0xac4c('0xb')](_0x1e2122,_0x4180fd)[_0xac4c('0xc')](function(_0x65166e){logger[_0xac4c('0xd')](_0xac4c('0xe'),_0x54674a,_0xac4c('0xf'));logger[_0xac4c('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x54674a,'request\x20sent',JSON[_0xac4c('0x11')](_0x65166e));if(_0x65166e['error']){if(_0x65166e[_0xac4c('0x12')][_0xac4c('0x13')]===0x1f4){logger[_0xac4c('0x12')](_0xac4c('0xe'),_0x54674a,_0x65166e[_0xac4c('0x12')]['message']);return _0x5c1501(_0x65166e[_0xac4c('0x12')][_0xac4c('0x14')]);}logger[_0xac4c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x54674a,_0x65166e[_0xac4c('0x12')][_0xac4c('0x14')]);return _0xe6171d(_0x65166e['error']['message']);}else{logger[_0xac4c('0xd')](_0xac4c('0xe'),_0x54674a,_0xac4c('0xf'));_0xe6171d(_0x65166e[_0xac4c('0x15')]['message']);}})[_0xac4c('0x16')](function(_0x593909){logger[_0xac4c('0x12')](_0xac4c('0xe'),_0x54674a,_0x593909);_0x5c1501(_0x593909);});});} \ No newline at end of file +var _0x8333=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x28e398,_0x38093f){var _0x42c9d1=function(_0x21fffe){while(--_0x21fffe){_0x28e398['push'](_0x28e398['shift']());}};_0x42c9d1(++_0x38093f);}(_0x8333,0x160));var _0x3833=function(_0x5cd46f,_0x2d5bc2){_0x5cd46f=_0x5cd46f-0x0;var _0x116a61=_0x8333[_0x5cd46f];return _0x116a61;};'use strict';var _=require(_0x3833('0x0'));var util=require(_0x3833('0x1'));var moment=require(_0x3833('0x2'));var BPromise=require(_0x3833('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3833('0x4'));var db=require(_0x3833('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3833('0x6'));var config=require(_0x3833('0x7'));var jayson=require(_0x3833('0x8'));var client=jayson[_0x3833('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9694ff,_0x51b0dd,_0x215be7){return new BPromise(function(_0x233b4a,_0x420e1c){return client['request'](_0x9694ff,_0x215be7)[_0x3833('0xa')](function(_0x53da5b){logger[_0x3833('0xb')](_0x3833('0xc'),_0x51b0dd,_0x3833('0xd'));logger[_0x3833('0xe')](_0x3833('0xf'),_0x51b0dd,_0x3833('0xd'),JSON[_0x3833('0x10')](_0x53da5b));if(_0x53da5b[_0x3833('0x11')]){if(_0x53da5b['error'][_0x3833('0x12')]===0x1f4){logger[_0x3833('0x11')](_0x3833('0xc'),_0x51b0dd,_0x53da5b[_0x3833('0x11')][_0x3833('0x13')]);return _0x420e1c(_0x53da5b['error'][_0x3833('0x13')]);}logger[_0x3833('0x11')](_0x3833('0xc'),_0x51b0dd,_0x53da5b['error']['message']);return _0x233b4a(_0x53da5b['error'][_0x3833('0x13')]);}else{logger[_0x3833('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x51b0dd,'request\x20sent');_0x233b4a(_0x53da5b[_0x3833('0x14')]['message']);}})[_0x3833('0x15')](function(_0x561a6a){logger[_0x3833('0x11')](_0x3833('0xc'),_0x51b0dd,_0x561a6a);_0x420e1c(_0x561a6a);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 82db7fb..67589a3 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 _0x0b1b=['get','put','/:id','isAuthenticated','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x0b1b,0x160));var _0xb0b1=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x0b1b[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0xb0b1('0x0'));var util=require(_0xb0b1('0x1'));var path=require(_0xb0b1('0x2'));var timeout=require(_0xb0b1('0x3'));var express=require(_0xb0b1('0x4'));var router=express['Router']();var auth=require(_0xb0b1('0x5'));var interaction=require(_0xb0b1('0x6'));var config=require(_0xb0b1('0x7'));var controller=require('./license.controller');router[_0xb0b1('0x8')]('/',controller['index']);router[_0xb0b1('0x9')](_0xb0b1('0xa'),auth[_0xb0b1('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x1294=['isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./license.controller','get','index','put','/:id'];(function(_0x13b1d8,_0x25c4f3){var _0x2e0c45=function(_0x1b9bb1){while(--_0x1b9bb1){_0x13b1d8['push'](_0x13b1d8['shift']());}};_0x2e0c45(++_0x25c4f3);}(_0x1294,0xb9));var _0x4129=function(_0x4fd6d5,_0x5161e3){_0x4fd6d5=_0x4fd6d5-0x0;var _0x34ada6=_0x1294[_0x4fd6d5];return _0x34ada6;};'use strict';var multer=require(_0x4129('0x0'));var util=require('util');var path=require(_0x4129('0x1'));var timeout=require(_0x4129('0x2'));var express=require(_0x4129('0x3'));var router=express[_0x4129('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4129('0x5'));var config=require('../../config/environment');var controller=require(_0x4129('0x6'));router[_0x4129('0x7')]('/',controller[_0x4129('0x8')]);router[_0x4129('0x9')](_0x4129('0xa'),auth[_0x4129('0xb')](),controller[_0x4129('0xc')]);module[_0x4129('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index bf81c5e..2aba85b 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 _0xabce=['exports','TEXT','STRING','sequelize'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xabce,0x103));var _0xeabc=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xabce[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'license':{'type':Sequelize[_0xeabc('0x2')]},'data1':{'type':Sequelize[_0xeabc('0x3')]},'data2':{'type':Sequelize[_0xeabc('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x524e=['STRING','INTEGER','TEXT'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x524e,0x15e));var _0xe524=function(_0x782b32,_0x55dcb5){_0x782b32=_0x782b32-0x0;var _0x1ca0eb=_0x524e[_0x782b32];return _0x1ca0eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xe524('0x0')]},'data1':{'type':Sequelize[_0xe524('0x1')]},'data2':{'type':Sequelize[_0xe524('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xe524('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 c15f11f..ceabe94 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 _0xe74c=['sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','name','send','../../config/license/util','index','model','keys','query','filters','intersection','fields','attributes','options','getLicense','catch','body','License','find','params','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe74c,0x69));var _0xce74=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe74c[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0xce74('0x0'));var emlformat=require(_0xce74('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xce74('0x2'));var jsonpatch=require(_0xce74('0x3'));var rp=require(_0xce74('0x4'));var moment=require(_0xce74('0x5'));var BPromise=require(_0xce74('0x6'));var Mustache=require('mustache');var util=require(_0xce74('0x7'));var path=require(_0xce74('0x8'));var sox=require(_0xce74('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xce74('0xa'));var squel=require(_0xce74('0xb'));var crypto=require(_0xce74('0xc'));var jsforce=require(_0xce74('0xd'));var deskjs=require(_0xce74('0xe'));var toCsv=require(_0xce74('0xf'));var querystring=require(_0xce74('0x10'));var Papa=require(_0xce74('0x11'));var Redis=require('ioredis');var authService=require(_0xce74('0x12'));var qs=require(_0xce74('0x13'));var as=require(_0xce74('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce74('0x15'))(_0xce74('0x16'));var utils=require(_0xce74('0x17'));var config=require('../../config/environment');var db=require(_0xce74('0x18'))['db'];function respondWithStatusCode(_0x3559a5,_0x1339c1){_0x1339c1=_0x1339c1||0xcc;return function(_0x507f8f){if(_0x507f8f){return _0x3559a5['sendStatus'](_0x1339c1);}return _0x3559a5[_0xce74('0x19')](_0x1339c1)[_0xce74('0x1a')]();};}function respondWithResult(_0x4ba8ec,_0x48a8e8){_0x48a8e8=_0x48a8e8||0xc8;return function(_0x2ec655){if(_0x2ec655){return _0x4ba8ec[_0xce74('0x19')](_0x48a8e8)['json'](_0x2ec655);}};}function respondWithFilteredResult(_0x4ddda8,_0x183534){return function(_0x4261b3){if(_0x4261b3){var _0x492ac6=_0x4261b3[_0xce74('0x1b')],_0x21c093=_0x183534[_0xce74('0x1c')],_0x5211b1=_0x183534[_0xce74('0x1c')]+_0x183534[_0xce74('0x1d')],_0x16e572;if(_0x5211b1>=_0x492ac6){_0x5211b1=_0x492ac6;_0x16e572=0xc8;}else{_0x16e572=0xce;}_0x4ddda8[_0xce74('0x19')](_0x16e572);return _0x4ddda8['set'](_0xce74('0x1e'),_0x21c093+'-'+_0x5211b1+'/'+_0x492ac6)[_0xce74('0x1f')](_0x4261b3);}return null;};}function patchUpdates(_0x2b65ab){return function(_0x2eb36c){try{jsonpatch[_0xce74('0x20')](_0x2eb36c,_0x2b65ab,!![]);}catch(_0x279310){return BPromise[_0xce74('0x21')](_0x279310);}return _0x2eb36c['save']();};}function saveUpdates(_0x877683,_0x22f983){return function(_0x18d162){if(_0x18d162){return _0x18d162[_0xce74('0x22')](_0x877683)[_0xce74('0x23')](function(_0x19ab0a){return _0x19ab0a;});}return null;};}function removeEntity(_0x42d2a2,_0x208949){return function(_0x2c07b5){if(_0x2c07b5){return _0x2c07b5['destroy']()['then'](function(){_0x42d2a2[_0xce74('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560b34,_0x1b1a18){return function(_0x47f26b){if(!_0x47f26b){_0x560b34['sendStatus'](0x194);}return _0x47f26b;};}function handleError(_0x47d8ee,_0x5eb660){_0x5eb660=_0x5eb660||0x1f4;return function(_0x1a3cdd){logger['error'](_0x1a3cdd['stack']);if(_0x1a3cdd[_0xce74('0x24')]){delete _0x1a3cdd['name'];}_0x47d8ee[_0xce74('0x19')](_0x5eb660)[_0xce74('0x25')](_0x1a3cdd);};}var utilLicense=require(_0xce74('0x26'));exports[_0xce74('0x27')]=function(_0x1b0677,_0x45ef47){var _0x5243cf={'raw':!![],'where':{'id':0x1}},_0x43a4df={};_0x43a4df[_0xce74('0x28')]=_[_0xce74('0x29')](db['License']['rawAttributes']);_0x43a4df[_0xce74('0x2a')]=_[_0xce74('0x29')](_0x1b0677[_0xce74('0x2a')]);_0x43a4df[_0xce74('0x2b')]=_[_0xce74('0x2c')](_0x43a4df[_0xce74('0x28')],_0x43a4df[_0xce74('0x2a')]);_0x5243cf['attributes']=_[_0xce74('0x2c')](_0x43a4df['model'],qs[_0xce74('0x2d')](_0x1b0677[_0xce74('0x2a')]['fields']));_0x5243cf[_0xce74('0x2e')]=_0x5243cf[_0xce74('0x2e')]['length']?_0x5243cf[_0xce74('0x2e')]:_0x43a4df[_0xce74('0x28')];_0x5243cf=_['merge']({},_0x5243cf,_0x1b0677[_0xce74('0x2f')]);return utilLicense[_0xce74('0x30')](_0x5243cf)['then'](respondWithResult(_0x45ef47,null))[_0xce74('0x31')](handleError(_0x45ef47,null));};exports['update']=function(_0x138e5b,_0xa23c8a){if(_0x138e5b['body']['id']){delete _0x138e5b[_0xce74('0x32')]['id'];}return db[_0xce74('0x33')][_0xce74('0x34')]({'where':{'id':_0x138e5b[_0xce74('0x35')]['id']}})[_0xce74('0x23')](handleEntityNotFound(_0xa23c8a,null))[_0xce74('0x23')](function(_0x38483a){var _0x4720a6=_0x38483a['get']({'plain':!![]});return utilLicense[_0xce74('0x36')](_0x4720a6,_0x138e5b[_0xce74('0x32')][_0xce74('0x37')]);})[_0xce74('0x23')](function(_0x219f30){if(!_0x219f30[_0xce74('0x38')]){return saveUpdates(_0x138e5b[_0xce74('0x32')],null);}return _0x219f30;})['then'](respondWithResult(_0xa23c8a,null))['catch'](handleError(_0xa23c8a,null));}; \ No newline at end of file +var _0x2890=['api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','send','../../config/license/util','index','keys','License','query','filters','attributes','intersection','model','fields','length','merge','options','getLicense','catch','update','body','params','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x56b11b,_0x10afb8){var _0x1cbaf1=function(_0x134da3){while(--_0x134da3){_0x56b11b['push'](_0x56b11b['shift']());}};_0x1cbaf1(++_0x10afb8);}(_0x2890,0x189));var _0x0289=function(_0x4dc94b,_0x32a19d){_0x4dc94b=_0x4dc94b-0x0;var _0x29542e=_0x2890[_0x4dc94b];return _0x29542e;};'use strict';var pdf=require(_0x0289('0x0'));var emlformat=require(_0x0289('0x1'));var rimraf=require(_0x0289('0x2'));var zipdir=require(_0x0289('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0289('0x4'));var moment=require(_0x0289('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0289('0x6'));var util=require(_0x0289('0x7'));var path=require('path');var sox=require(_0x0289('0x8'));var csv=require(_0x0289('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0289('0xa'));var squel=require(_0x0289('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0289('0xc'));var toCsv=require(_0x0289('0x9'));var querystring=require(_0x0289('0xd'));var Papa=require(_0x0289('0xe'));var Redis=require(_0x0289('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0289('0x10'));var as=require(_0x0289('0x11'));var hardwareService=require(_0x0289('0x12'));var logger=require(_0x0289('0x13'))(_0x0289('0x14'));var utils=require(_0x0289('0x15'));var config=require('../../config/environment');var db=require(_0x0289('0x16'))['db'];function respondWithStatusCode(_0x49ef1f,_0x2dbca6){_0x2dbca6=_0x2dbca6||0xcc;return function(_0x13c8e7){if(_0x13c8e7){return _0x49ef1f[_0x0289('0x17')](_0x2dbca6);}return _0x49ef1f['status'](_0x2dbca6)[_0x0289('0x18')]();};}function respondWithResult(_0x1357f8,_0xce5319){_0xce5319=_0xce5319||0xc8;return function(_0x242c79){if(_0x242c79){return _0x1357f8[_0x0289('0x19')](_0xce5319)[_0x0289('0x1a')](_0x242c79);}};}function respondWithFilteredResult(_0x598974,_0x524b88){return function(_0x2a0c6c){if(_0x2a0c6c){var _0x50899f=_0x2a0c6c[_0x0289('0x1b')],_0x15f801=_0x524b88['offset'],_0x5042a3=_0x524b88[_0x0289('0x1c')]+_0x524b88[_0x0289('0x1d')],_0x1113f0;if(_0x5042a3>=_0x50899f){_0x5042a3=_0x50899f;_0x1113f0=0xc8;}else{_0x1113f0=0xce;}_0x598974['status'](_0x1113f0);return _0x598974['set'](_0x0289('0x1e'),_0x15f801+'-'+_0x5042a3+'/'+_0x50899f)['json'](_0x2a0c6c);}return null;};}function patchUpdates(_0x3239a4){return function(_0x335c4a){try{jsonpatch[_0x0289('0x1f')](_0x335c4a,_0x3239a4,!![]);}catch(_0x48d45b){return BPromise[_0x0289('0x20')](_0x48d45b);}return _0x335c4a[_0x0289('0x21')]();};}function saveUpdates(_0x138f5c,_0x5299b1){return function(_0x507e20){if(_0x507e20){return _0x507e20['update'](_0x138f5c)[_0x0289('0x22')](function(_0x3dc99f){return _0x3dc99f;});}return null;};}function removeEntity(_0x4de882,_0x413bcc){return function(_0x46ce1e){if(_0x46ce1e){return _0x46ce1e[_0x0289('0x23')]()[_0x0289('0x22')](function(){_0x4de882[_0x0289('0x19')](0xcc)[_0x0289('0x18')]();});}};}function handleEntityNotFound(_0x29dde1,_0x4022cc){return function(_0x1856c4){if(!_0x1856c4){_0x29dde1[_0x0289('0x17')](0x194);}return _0x1856c4;};}function handleError(_0x17dece,_0x2f8968){_0x2f8968=_0x2f8968||0x1f4;return function(_0x15935b){logger['error'](_0x15935b['stack']);if(_0x15935b['name']){delete _0x15935b['name'];}_0x17dece[_0x0289('0x19')](_0x2f8968)[_0x0289('0x24')](_0x15935b);};}var utilLicense=require(_0x0289('0x25'));exports[_0x0289('0x26')]=function(_0x37d4ef,_0x1399fe){var _0x41b950={'raw':!![],'where':{'id':0x1}},_0x487c7e={};_0x487c7e['model']=_[_0x0289('0x27')](db[_0x0289('0x28')]['rawAttributes']);_0x487c7e[_0x0289('0x29')]=_['keys'](_0x37d4ef[_0x0289('0x29')]);_0x487c7e[_0x0289('0x2a')]=_['intersection'](_0x487c7e['model'],_0x487c7e[_0x0289('0x29')]);_0x41b950[_0x0289('0x2b')]=_[_0x0289('0x2c')](_0x487c7e[_0x0289('0x2d')],qs[_0x0289('0x2e')](_0x37d4ef[_0x0289('0x29')]['fields']));_0x41b950['attributes']=_0x41b950[_0x0289('0x2b')][_0x0289('0x2f')]?_0x41b950[_0x0289('0x2b')]:_0x487c7e[_0x0289('0x2d')];_0x41b950=_[_0x0289('0x30')]({},_0x41b950,_0x37d4ef[_0x0289('0x31')]);return utilLicense[_0x0289('0x32')](_0x41b950)['then'](respondWithResult(_0x1399fe,null))[_0x0289('0x33')](handleError(_0x1399fe,null));};exports[_0x0289('0x34')]=function(_0x10145f,_0x34daca){if(_0x10145f[_0x0289('0x35')]['id']){delete _0x10145f[_0x0289('0x35')]['id'];}return db[_0x0289('0x28')]['find']({'where':{'id':_0x10145f[_0x0289('0x36')]['id']}})[_0x0289('0x22')](handleEntityNotFound(_0x34daca,null))[_0x0289('0x22')](function(_0x414ed7){var _0x442199=_0x414ed7[_0x0289('0x37')]({'plain':!![]});return utilLicense[_0x0289('0x38')](_0x442199,_0x10145f[_0x0289('0x35')][_0x0289('0x39')]);})[_0x0289('0x22')](function(_0x29de79){if(!_0x29de79[_0x0289('0x3a')]){return saveUpdates(_0x10145f['body'],null);}return _0x29de79;})[_0x0289('0x22')](respondWithResult(_0x34daca,null))[_0x0289('0x33')](handleError(_0x34daca,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4cde440..cb866a5 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x278289,_0x3ad345){var _0x5351cc=function(_0x27ba4d){while(--_0x27ba4d){_0x278289['push'](_0x278289['shift']());}};_0x5351cc(++_0x3ad345);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b22e6,_0x3f2337){_0x2b22e6=_0x2b22e6-0x0;var _0x225b25=_0x5f2f[_0x2b22e6];return _0x225b25;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x44c229,_0xf2af91){var _0x706a13=function(_0x1e9a56){while(--_0x1e9a56){_0x44c229['push'](_0x44c229['shift']());}};_0x706a13(++_0xf2af91);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4570a3,_0x4f8d6e){_0x4570a3=_0x4570a3-0x0;var _0x1ddbd3=_0x5f2f[_0x4570a3];return _0x1ddbd3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 09612b1..a4697a2 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 _0xb12d=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5886e0,_0x211c32){var _0x2307a0=function(_0x247fec){while(--_0x247fec){_0x5886e0['push'](_0x5886e0['shift']());}};_0x2307a0(++_0x211c32);}(_0xb12d,0x124));var _0xdb12=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0xb12d[_0x22f85a];return _0xaa717;};'use strict';var _=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var moment=require(_0xdb12('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb12('0x4'))['db'];var utils=require(_0xdb12('0x5'));var logger=require(_0xdb12('0x6'))(_0xdb12('0x7'));var config=require(_0xdb12('0x8'));var jayson=require(_0xdb12('0x9'));var client=jayson['client'][_0xdb12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e73f,_0x27eb31,_0x3872c3){return new BPromise(function(_0x11385d,_0x11d97c){return client[_0xdb12('0xb')](_0x19e73f,_0x3872c3)[_0xdb12('0xc')](function(_0x54eb5b){logger[_0xdb12('0xd')]('License,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));logger[_0xdb12('0xf')](_0xdb12('0x10'),_0x27eb31,'request\x20sent',JSON[_0xdb12('0x11')](_0x54eb5b));if(_0x54eb5b[_0xdb12('0x12')]){if(_0x54eb5b[_0xdb12('0x12')]['code']===0x1f4){logger[_0xdb12('0x12')]('License,\x20%s,\x20%s',_0x27eb31,_0x54eb5b[_0xdb12('0x12')][_0xdb12('0x13')]);return _0x11d97c(_0x54eb5b[_0xdb12('0x12')]['message']);}logger[_0xdb12('0x12')](_0xdb12('0x14'),_0x27eb31,_0x54eb5b['error'][_0xdb12('0x13')]);return _0x11385d(_0x54eb5b['error'][_0xdb12('0x13')]);}else{logger[_0xdb12('0xd')]('License,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));_0x11385d(_0x54eb5b[_0xdb12('0x15')][_0xdb12('0x13')]);}})[_0xdb12('0x16')](function(_0x504cf5){logger['error'](_0xdb12('0x14'),_0x27eb31,_0x504cf5);_0x11d97c(_0x504cf5);});});} \ No newline at end of file +var _0x263f=['client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x263f,0x182));var _0xf263=function(_0x1d5861,_0x133594){_0x1d5861=_0x1d5861-0x0;var _0x298332=_0x263f[_0x1d5861];return _0x298332;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6a933b7..5a735fd 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 _0x8d67=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x8d67,0x1ea));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x78d6('0x0'));var util=require(_0x78d6('0x1'));var path=require(_0x78d6('0x2'));var timeout=require(_0x78d6('0x3'));var express=require(_0x78d6('0x4'));var router=express[_0x78d6('0x5')]();var auth=require(_0x78d6('0x6'));var interaction=require(_0x78d6('0x7'));var config=require(_0x78d6('0x8'));var controller=require(_0x78d6('0x9'));router[_0x78d6('0xa')]('/',auth[_0x78d6('0xb')](),controller[_0x78d6('0xc')]);router['get']('/describe',auth[_0x78d6('0xb')](),controller['describe']);router[_0x78d6('0xa')](_0x78d6('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x78d6('0xe'),auth['isAuthenticated'](),controller[_0x78d6('0xf')]);router[_0x78d6('0xa')](_0x78d6('0x10'),auth[_0x78d6('0xb')](),controller['getAnswers']);router[_0x78d6('0xa')](_0x78d6('0x11'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x12')]);router['get'](_0x78d6('0x13'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x14')]);router[_0x78d6('0xa')](_0x78d6('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x78d6('0xa')]('/:id/applications',auth[_0x78d6('0xb')](),controller['getApplications']);router['get']('/:id/messages',auth[_0x78d6('0xb')](),controller[_0x78d6('0x16')]);router[_0x78d6('0xa')](_0x78d6('0x17'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x18')]);router['get'](_0x78d6('0x19'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1a')]);router[_0x78d6('0x1b')](_0x78d6('0xe'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1c')]);router[_0x78d6('0x1b')]('/:id/canned_answers',auth[_0x78d6('0xb')](),controller[_0x78d6('0x1d')]);router[_0x78d6('0x1b')]('/',auth[_0x78d6('0xb')](),controller['create']);router[_0x78d6('0x1b')](_0x78d6('0x11'),auth['isAuthenticated'](),controller['addImap']);router['post'](_0x78d6('0x13'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1e')]);router['post'](_0x78d6('0x15'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1f')]);router[_0x78d6('0x1b')](_0x78d6('0x20'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x21')]);router[_0x78d6('0x1b')](_0x78d6('0x22'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x23')]);router['post']('/:id/users',auth[_0x78d6('0xb')](),controller['addAgents']);router['put'](_0x78d6('0xd'),auth['isAuthenticated'](),controller[_0x78d6('0x24')]);router[_0x78d6('0x25')](_0x78d6('0xe'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x26')]);router[_0x78d6('0x25')](_0x78d6('0x10'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x27')]);router['delete']('/:id/in_servers',auth[_0x78d6('0xb')](),controller[_0x78d6('0x28')]);router[_0x78d6('0x25')](_0x78d6('0x13'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x29')]);router[_0x78d6('0x25')]('/:id',auth[_0x78d6('0xb')](),controller[_0x78d6('0x2a')]);router[_0x78d6('0x25')]('/:id/users',auth[_0x78d6('0xb')](),controller[_0x78d6('0x2b')]);module[_0x78d6('0x2c')]=router; \ No newline at end of file +var _0x0ca8=['getAnswers','getImap','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','/:id/in_servers','removeImap','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x161ec8,_0x1402e1){var _0x25459e=function(_0x1c789e){while(--_0x1c789e){_0x161ec8['push'](_0x161ec8['shift']());}};_0x25459e(++_0x1402e1);}(_0x0ca8,0x175));var _0x80ca=function(_0xdc87a,_0x146acd){_0xdc87a=_0xdc87a-0x0;var _0x4c5ab=_0x0ca8[_0xdc87a];return _0x4c5ab;};'use strict';var multer=require(_0x80ca('0x0'));var util=require(_0x80ca('0x1'));var path=require(_0x80ca('0x2'));var timeout=require(_0x80ca('0x3'));var express=require(_0x80ca('0x4'));var router=express[_0x80ca('0x5')]();var auth=require(_0x80ca('0x6'));var interaction=require(_0x80ca('0x7'));var config=require('../../config/environment');var controller=require(_0x80ca('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x80ca('0x9')]);router[_0x80ca('0xa')](_0x80ca('0xb'),auth[_0x80ca('0xc')](),controller[_0x80ca('0xd')]);router['get'](_0x80ca('0xe'),auth[_0x80ca('0xc')](),controller[_0x80ca('0xf')]);router['get'](_0x80ca('0x10'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x11')]);router[_0x80ca('0xa')](_0x80ca('0x12'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x13')]);router[_0x80ca('0xa')]('/:id/in_servers',auth[_0x80ca('0xc')](),controller[_0x80ca('0x14')]);router[_0x80ca('0xa')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0x80ca('0xa')]('/:id/interactions',auth[_0x80ca('0xc')](),controller['getInteractions']);router[_0x80ca('0xa')]('/:id/applications',auth[_0x80ca('0xc')](),controller[_0x80ca('0x15')]);router[_0x80ca('0xa')](_0x80ca('0x16'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x17')]);router[_0x80ca('0xa')](_0x80ca('0x18'),auth['isAuthenticated'](),controller[_0x80ca('0x19')]);router[_0x80ca('0xa')](_0x80ca('0x1a'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x1b')]);router[_0x80ca('0x1c')](_0x80ca('0x10'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x1d')]);router['post'](_0x80ca('0x12'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x1e')]);router[_0x80ca('0x1c')]('/',auth[_0x80ca('0xc')](),controller[_0x80ca('0x1f')]);router['post']('/:id/in_servers',auth[_0x80ca('0xc')](),controller[_0x80ca('0x20')]);router[_0x80ca('0x1c')](_0x80ca('0x21'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x22')]);router[_0x80ca('0x1c')](_0x80ca('0x23'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x24')]);router[_0x80ca('0x1c')]('/:id/applications',auth['isAuthenticated'](),controller[_0x80ca('0x25')]);router['post'](_0x80ca('0x26'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x27')]);router[_0x80ca('0x1c')](_0x80ca('0x1a'),auth['isAuthenticated'](),controller[_0x80ca('0x28')]);router[_0x80ca('0x29')](_0x80ca('0xe'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x2a')]);router[_0x80ca('0x2b')](_0x80ca('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x80ca('0x2b')](_0x80ca('0x12'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x2c')]);router[_0x80ca('0x2b')](_0x80ca('0x2d'),auth[_0x80ca('0xc')](),controller[_0x80ca('0x2e')]);router[_0x80ca('0x2b')](_0x80ca('0x21'),auth[_0x80ca('0xc')](),controller['removeSmtp']);router['delete'](_0x80ca('0xe'),auth[_0x80ca('0xc')](),controller['destroy']);router['delete']('/:id/users',auth[_0x80ca('0xc')](),controller[_0x80ca('0x2f')]);module[_0x80ca('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 15cdecd..e98a8ba 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 _0x2197=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x59d798,_0x31ef7b){var _0x4dd1ab=function(_0xbb63f3){while(--_0xbb63f3){_0x59d798['push'](_0x59d798['shift']());}};_0x4dd1ab(++_0x31ef7b);}(_0x2197,0x11b));var _0x7219=function(_0x19e494,_0x3496a2){_0x19e494=_0x19e494-0x0;var _0xca04a3=_0x2197[_0x19e494];return _0xca04a3;};'use strict';var Sequelize=require(_0x7219('0x0'));module[_0x7219('0x1')]={'description':{'type':Sequelize[_0x7219('0x2')]},'name':{'type':Sequelize[_0x7219('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7219('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7219('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7219('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7219('0x4')]},'markAsUnread':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7219('0x2')],'allowNull':![],'defaultValue':_0x7219('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x7219('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7219('0x4')],'defaultValue':function(){return _0x7219('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7219('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7219('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7219('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7219('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x7219('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![],'comment':_0x7219('0xa'),'set':function(_0x2b62ad){if(!_0x2b62ad)this[_0x7219('0xb')](_0x7219('0xc'),null);this['setDataValue'](_0x7219('0xd'),_0x2b62ad);}}}; \ No newline at end of file +var _0x94e9=['TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','BOOLEAN'];(function(_0x4b3636,_0x598e0d){var _0x5cfefc=function(_0x4bd820){while(--_0x4bd820){_0x4b3636['push'](_0x4b3636['shift']());}};_0x5cfefc(++_0x598e0d);}(_0x94e9,0x1da));var _0x994e=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x94e9[_0x413b4d];return _0x8b810a;};'use strict';var Sequelize=require('sequelize');module[_0x994e('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x994e('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x994e('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x994e('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x994e('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x994e('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x994e('0x3')],'defaultValue':function(){return _0x994e('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x994e('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x994e('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x994e('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x994e('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x994e('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x994e('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x994e('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e5aa1){if(!_0x3e5aa1)this['setDataValue'](_0x994e('0x6'),null);this[_0x994e('0x7')](_0x994e('0x8'),_0x3e5aa1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 11033d2..a082130 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 _0xbab5=['nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','Smtp','Pause','mandatoryDispositionPause','fields','length','includeAll','find','body','describe','addDisposition','params','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','options','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','role','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','hasOwnProperty','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','basename','secure','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','auth','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','isArray','emit','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','Sequelize','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','set','apply','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x5e6226,_0x2a34b7){var _0x57f7dc=function(_0x72bb49){while(--_0x72bb49){_0x5e6226['push'](_0x5e6226['shift']());}};_0x57f7dc(++_0x2a34b7);}(_0xbab5,0x128));var _0x5bab=function(_0x161c44,_0x4a4750){_0x161c44=_0x161c44-0x0;var _0x573fcb=_0xbab5[_0x161c44];return _0x573fcb;};'use strict';var pdf=require(_0x5bab('0x0'));var emlformat=require(_0x5bab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bab('0x3'));var moment=require(_0x5bab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5bab('0x5'));var util=require(_0x5bab('0x6'));var path=require(_0x5bab('0x7'));var sox=require(_0x5bab('0x8'));var csv=require(_0x5bab('0x9'));var ejs=require(_0x5bab('0xa'));var fs=require('fs');var _=require(_0x5bab('0xb'));var squel=require(_0x5bab('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bab('0x9'));var querystring=require(_0x5bab('0xd'));var Papa=require(_0x5bab('0xe'));var Redis=require(_0x5bab('0xf'));var authService=require(_0x5bab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bab('0x11'));var logger=require(_0x5bab('0x12'))(_0x5bab('0x13'));var utils=require(_0x5bab('0x14'));var config=require(_0x5bab('0x15'));var db=require('../../mysqldb')['db'];config[_0x5bab('0x16')]=_[_0x5bab('0x17')](config[_0x5bab('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x5bab('0x18'))(new Redis(config[_0x5bab('0x16')]));require(_0x5bab('0x19'))[_0x5bab('0x1a')](socket);var jayson=require(_0x5bab('0x1b'));var client=jayson['client'][_0x5bab('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x5e1f05,_0x1cbf68,_0x2c1372){if(_0x2c1372){var _0xc52996=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc52996['test'](_0x1cbf68)){return _0x5e1f05;}else{throw new db[(_0x5bab('0x1d'))]['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 _0x5e1f05;}}function respondWithRpcPromise(_0x4b781e,_0x1d8897,_0x5bc426,_0x99de54){return new BPromise(function(_0x4df881,_0xa762cb){var _0x75e129=_0x99de54||client;return _0x75e129[_0x5bab('0x1e')](_0x4b781e,_0x5bc426)[_0x5bab('0x1f')](function(_0x3dda28){logger[_0x5bab('0x20')]('MailAccount,\x20%s,\x20%s',_0x1d8897,'request\x20sent');logger[_0x5bab('0x21')](_0x5bab('0x22'),_0x1d8897,_0x5bab('0x23'),JSON['stringify'](_0x3dda28));if(_0x3dda28[_0x5bab('0x24')]){if(_0x3dda28[_0x5bab('0x24')]['code']===0x1f4){logger[_0x5bab('0x24')](_0x5bab('0x25'),_0x1d8897,_0x3dda28['error']['message']);return _0xa762cb(_0x3dda28[_0x5bab('0x24')][_0x5bab('0x26')]);}logger['error'](_0x5bab('0x25'),_0x1d8897,_0x3dda28['error']['message']);return _0x4df881(_0x3dda28['error'][_0x5bab('0x26')]);}else{logger['info'](_0x5bab('0x25'),_0x1d8897,'request\x20sent');_0x4df881(_0x3dda28[_0x5bab('0x27')]['message']);}})[_0x5bab('0x28')](function(_0x19bc7f){logger[_0x5bab('0x24')](_0x5bab('0x25'),_0x1d8897,_0x19bc7f);_0xa762cb(_0x19bc7f);});});}function respondWithStatusCode(_0x1e1534,_0x4de84d){_0x4de84d=_0x4de84d||0xcc;return function(_0x2e30ac){if(_0x2e30ac){return _0x1e1534[_0x5bab('0x29')](_0x4de84d);}return _0x1e1534[_0x5bab('0x2a')](_0x4de84d)[_0x5bab('0x2b')]();};}function respondWithResult(_0x54264a,_0x20f5cf){_0x20f5cf=_0x20f5cf||0xc8;return function(_0x52a9a7){if(_0x52a9a7){return _0x54264a[_0x5bab('0x2a')](_0x20f5cf)[_0x5bab('0x2c')](_0x52a9a7);}};}function respondWithFilteredResult(_0x2b78d8,_0x3a9033){return function(_0x5d1bdf){if(_0x5d1bdf){var _0x345ed3=_0x5d1bdf['count'],_0x5ae815=_0x3a9033[_0x5bab('0x2d')],_0x36b577=_0x3a9033[_0x5bab('0x2d')]+_0x3a9033['limit'],_0x189005;if(_0x36b577>=_0x345ed3){_0x36b577=_0x345ed3;_0x189005=0xc8;}else{_0x189005=0xce;}_0x2b78d8[_0x5bab('0x2a')](_0x189005);return _0x2b78d8[_0x5bab('0x2e')]('Content-Range',_0x5ae815+'-'+_0x36b577+'/'+_0x345ed3)[_0x5bab('0x2c')](_0x5d1bdf);}return null;};}function patchUpdates(_0x76e7b4){return function(_0x4be712){try{jsonpatch[_0x5bab('0x2f')](_0x4be712,_0x76e7b4,!![]);}catch(_0x2c4303){return BPromise['reject'](_0x2c4303);}return _0x4be712[_0x5bab('0x30')]();};}function saveUpdates(_0x4685e8,_0xc6c6d6){return function(_0x55bf54){if(_0x55bf54){return _0x55bf54[_0x5bab('0x31')](_0x4685e8)['then'](function(_0x293cb5){return _0x293cb5;});}return null;};}function removeEntity(_0x460971,_0x1595e2){return function(_0x2ca422){if(_0x2ca422){return _0x2ca422[_0x5bab('0x32')]()[_0x5bab('0x1f')](function(){var _0x3ceda2=_0x2ca422[_0x5bab('0x33')]({'plain':!![]});var _0x11c217=_0x5bab('0x34');return db[_0x5bab('0x35')][_0x5bab('0x32')]({'where':{'type':_0x11c217,'resourceId':_0x3ceda2['id']}})[_0x5bab('0x1f')](function(){return _0x2ca422;});})[_0x5bab('0x1f')](function(){_0x460971[_0x5bab('0x2a')](0xcc)[_0x5bab('0x2b')]();});}};}function handleEntityNotFound(_0x17f57d,_0x43b72a){return function(_0x405011){if(!_0x405011){_0x17f57d[_0x5bab('0x29')](0x194);}return _0x405011;};}function handleError(_0x45cd2b,_0x43ef36){_0x43ef36=_0x43ef36||0x1f4;return function(_0x6a5e56){logger[_0x5bab('0x24')](_0x6a5e56[_0x5bab('0x36')]);if(_0x6a5e56[_0x5bab('0x37')]){delete _0x6a5e56['name'];}_0x45cd2b[_0x5bab('0x2a')](_0x43ef36)[_0x5bab('0x38')](_0x6a5e56);};}exports[_0x5bab('0x39')]=function(_0x3dbfee,_0x23a169){var _0x4a9583={'include':[{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')},{'model':db[_0x5bab('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x506230={},_0x3dc691={'count':0x0,'rows':[]};var _0x3c16c0=_[_0x5bab('0x3d')](db[_0x5bab('0x3e')]['rawAttributes'],function(_0x7042df){return{'name':_0x7042df[_0x5bab('0x3f')],'type':_0x7042df[_0x5bab('0x40')][_0x5bab('0x41')]};});_0x506230[_0x5bab('0x42')]=_['map'](_0x3c16c0,_0x5bab('0x37'));_0x506230[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x3dbfee[_0x5bab('0x43')]);_0x506230[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x506230[_0x5bab('0x42')],_0x506230[_0x5bab('0x43')]);_0x4a9583[_0x5bab('0x47')]=_['intersection'](_0x506230[_0x5bab('0x42')],qs['fields'](_0x3dbfee['query']['fields']));_0x4a9583[_0x5bab('0x47')]=_0x4a9583[_0x5bab('0x47')]['length']?_0x4a9583[_0x5bab('0x47')]:_0x506230[_0x5bab('0x42')];if(!_0x3dbfee[_0x5bab('0x43')]['hasOwnProperty'](_0x5bab('0x48'))){_0x4a9583['limit']=qs[_0x5bab('0x49')](_0x3dbfee[_0x5bab('0x43')][_0x5bab('0x49')]);_0x4a9583[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x3dbfee['query']['offset']);}_0x4a9583[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x3dbfee[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x4a9583[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x3dbfee['query'],_0x506230[_0x5bab('0x45')]),_0x3c16c0);if(_0x3dbfee['query'][_0x5bab('0x4e')]){_0x4a9583['where']=_[_0x5bab('0x4f')](_0x4a9583[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x3c16c0,function(_0x4d88f9){if(_0x4d88f9['type']!==_0x5bab('0x50')){var _0x19042b={};_0x19042b[_0x4d88f9[_0x5bab('0x37')]]={'$like':'%'+_0x3dbfee['query'][_0x5bab('0x4e')]+'%'};return _0x19042b;}})});}_0x4a9583=_['merge']({},_0x4a9583,_0x3dbfee['options']);var _0x3a007d={'where':_0x4a9583['where']};return db[_0x5bab('0x3e')][_0x5bab('0x51')](_0x3a007d)[_0x5bab('0x1f')](function(_0x5b9030){_0x3dc691['count']=_0x5b9030;if(_0x3dbfee['query']['includeAll']){_0x4a9583[_0x5bab('0x52')]=[{'all':!![]}];}return db[_0x5bab('0x3e')][_0x5bab('0x53')](_0x4a9583);})[_0x5bab('0x1f')](function(_0x993a1){_0x3dc691[_0x5bab('0x54')]=_0x993a1;return _0x3dc691;})[_0x5bab('0x1f')](respondWithFilteredResult(_0x23a169,_0x4a9583))[_0x5bab('0x28')](handleError(_0x23a169,null));};exports[_0x5bab('0x55')]=function(_0x47210d,_0x49dcae){var _0x1af4a8={'raw':![],'where':{'id':_0x47210d['params']['id']},'include':[{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')},{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56')},{'model':db[_0x5bab('0x57')],'as':_0x5bab('0x58')}]},_0x4f81ee={};_0x4f81ee[_0x5bab('0x42')]=_['keys'](db[_0x5bab('0x3e')]['rawAttributes']);_0x4f81ee['query']=_['keys'](_0x47210d[_0x5bab('0x43')]);_0x4f81ee[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x4f81ee[_0x5bab('0x42')],_0x4f81ee[_0x5bab('0x43')]);_0x1af4a8[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x4f81ee[_0x5bab('0x42')],qs['fields'](_0x47210d[_0x5bab('0x43')][_0x5bab('0x59')]));_0x1af4a8[_0x5bab('0x47')]=_0x1af4a8[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x1af4a8[_0x5bab('0x47')]:_0x4f81ee[_0x5bab('0x42')];if(_0x47210d[_0x5bab('0x43')][_0x5bab('0x5b')]){_0x1af4a8[_0x5bab('0x52')]=[{'all':!![]}];}_0x1af4a8=_[_0x5bab('0x4f')]({},_0x1af4a8,_0x47210d['options']);return db[_0x5bab('0x3e')][_0x5bab('0x5c')](_0x1af4a8)['then'](handleEntityNotFound(_0x49dcae,null))['then'](respondWithResult(_0x49dcae,null))[_0x5bab('0x28')](handleError(_0x49dcae,null));};exports[_0x5bab('0x31')]=function(_0x5a6cdd,_0x54dd3f){if(_0x5a6cdd[_0x5bab('0x5d')]['id']){delete _0x5a6cdd[_0x5bab('0x5d')]['id'];}return db[_0x5bab('0x3e')]['find']({'where':{'id':_0x5a6cdd['params']['id']},'include':[{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')},{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56')},{'model':db['Pause'],'as':_0x5bab('0x58')}]})['then'](handleEntityNotFound(_0x54dd3f,null))[_0x5bab('0x1f')](saveUpdates(_0x5a6cdd[_0x5bab('0x5d')],null))[_0x5bab('0x1f')](function(_0x2c6e8e){if(_0x2c6e8e&&_0x5a6cdd['body'][_0x5bab('0x3b')]){return db['MailServerIn']['update'](_0x5a6cdd[_0x5bab('0x5d')]['Imap'],{'where':{'MailAccountId':_0x2c6e8e['id']}})[_0x5bab('0x1f')](function(){return _0x2c6e8e;});}return _0x2c6e8e;})['then'](function(_0x25173c){if(_0x25173c&&_0x5a6cdd[_0x5bab('0x5d')][_0x5bab('0x56')]){return db[_0x5bab('0x3c')][_0x5bab('0x31')](_0x5a6cdd[_0x5bab('0x5d')][_0x5bab('0x56')],{'where':{'MailAccountId':_0x25173c['id']}})[_0x5bab('0x1f')](function(){return _0x25173c;});}return _0x25173c;})['then'](respondWithResult(_0x54dd3f,null))[_0x5bab('0x28')](handleError(_0x54dd3f,null));};exports[_0x5bab('0x5e')]=function(_0x50bae9,_0x5b695c){return db[_0x5bab('0x3e')][_0x5bab('0x5e')]()['then'](respondWithResult(_0x5b695c,null))['catch'](handleError(_0x5b695c,null));};exports[_0x5bab('0x5f')]=function(_0x3e52e3,_0xf31b0b,_0x118927){if(_0x3e52e3['body']['id']){delete _0x3e52e3[_0x5bab('0x5d')]['id'];}return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x3e52e3[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0xf31b0b,null))['then'](function(_0x201774){if(_0x201774){_0x3e52e3[_0x5bab('0x5d')][_0x5bab('0x61')]=_0x201774['id'];return db[_0x5bab('0x62')][_0x5bab('0x63')](_0x3e52e3[_0x5bab('0x5d')]);}})[_0x5bab('0x1f')](respondWithResult(_0xf31b0b,null))[_0x5bab('0x28')](handleError(_0xf31b0b,null));};exports[_0x5bab('0x64')]=function(_0x4301fb,_0x3cb942,_0x4fd197){var _0x477370={'raw':![],'where':{}};var _0x2f2e4c={};var _0x5e7beb={'count':0x0,'rows':[]};return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x4301fb['params']['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x3cb942,null))[_0x5bab('0x1f')](function(_0x51fd98){if(_0x51fd98){_0x2f2e4c['model']=_['keys'](db[_0x5bab('0x62')][_0x5bab('0x66')]);_0x2f2e4c['query']=_[_0x5bab('0x44')](_0x4301fb[_0x5bab('0x43')]);_0x2f2e4c[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x2f2e4c['model'],_0x2f2e4c[_0x5bab('0x43')]);_0x477370['attributes']=_[_0x5bab('0x46')](_0x2f2e4c[_0x5bab('0x42')],qs[_0x5bab('0x59')](_0x4301fb[_0x5bab('0x43')]['fields']));_0x477370[_0x5bab('0x47')]=_0x477370[_0x5bab('0x47')]['length']?_0x477370['attributes']:_0x2f2e4c['model'];if(!_0x4301fb[_0x5bab('0x43')]['hasOwnProperty'](_0x5bab('0x48'))){_0x477370[_0x5bab('0x49')]=qs['limit'](_0x4301fb[_0x5bab('0x43')][_0x5bab('0x49')]);_0x477370['offset']=qs[_0x5bab('0x2d')](_0x4301fb[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x477370[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x4301fb['query'][_0x5bab('0x4b')]);_0x477370[_0x5bab('0x4c')]=qs['filters'](_[_0x5bab('0x4d')](_0x4301fb[_0x5bab('0x43')],_0x2f2e4c['filters']));_0x477370[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x51fd98['id'];if(_0x4301fb['query'][_0x5bab('0x4e')]){_0x477370[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0x477370[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x477370['attributes'],function(_0x49d65e){var _0x1ce59d={};_0x1ce59d[_0x49d65e]={'$like':'%'+_0x4301fb[_0x5bab('0x43')][_0x5bab('0x4e')]+'%'};return _0x1ce59d;})});}_0x477370=_[_0x5bab('0x4f')]({},_0x477370,_0x4301fb[_0x5bab('0x67')]);return db[_0x5bab('0x62')]['count']({'where':_0x477370['where']})['then'](function(_0x1b21cd){_0x5e7beb[_0x5bab('0x51')]=_0x1b21cd;if(_0x4301fb['query']['includeAll']){_0x477370[_0x5bab('0x52')]=[{'all':!![]}];}return db[_0x5bab('0x62')][_0x5bab('0x53')](_0x477370);})['then'](function(_0x229cee){_0x5e7beb[_0x5bab('0x54')]=_0x229cee;return _0x5e7beb;});}})[_0x5bab('0x1f')](respondWithFilteredResult(_0x3cb942,_0x477370))['catch'](handleError(_0x3cb942,null));};exports[_0x5bab('0x68')]=function(_0x4e466f,_0xefdbdb,_0x3a0893){return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x4e466f[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0xefdbdb,null))[_0x5bab('0x1f')](function(_0x4b69fe){if(_0x4b69fe){return _0x4b69fe[_0x5bab('0x68')](_0x4e466f[_0x5bab('0x43')][_0x5bab('0x69')]);}})[_0x5bab('0x1f')](respondWithStatusCode(_0xefdbdb,null))['catch'](handleError(_0xefdbdb,null));};exports['addAnswer']=function(_0x56e14b,_0x37568f,_0x4f2f28){if(_0x56e14b[_0x5bab('0x5d')]['id']){delete _0x56e14b['body']['id'];}return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x56e14b[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x37568f,null))[_0x5bab('0x1f')](function(_0x47186c){if(_0x47186c){_0x56e14b[_0x5bab('0x5d')][_0x5bab('0x61')]=_0x47186c['id'];return db[_0x5bab('0x6a')][_0x5bab('0x63')](_0x56e14b['body']);}})[_0x5bab('0x1f')](respondWithResult(_0x37568f,null))[_0x5bab('0x28')](handleError(_0x37568f,null));};exports[_0x5bab('0x6b')]=function(_0x24d0bc,_0x4be19c,_0x4ad0c5){var _0x4e1f10={'raw':![],'where':{}};var _0x5d984c={};var _0x434b5b={'count':0x0,'rows':[]};return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x24d0bc[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x4be19c,null))[_0x5bab('0x1f')](function(_0x39bbce){if(_0x39bbce){_0x5d984c[_0x5bab('0x42')]=_[_0x5bab('0x44')](db['CannedAnswer'][_0x5bab('0x66')]);_0x5d984c[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x24d0bc['query']);_0x5d984c[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x5d984c['model'],_0x5d984c['query']);_0x4e1f10[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x5d984c[_0x5bab('0x42')],qs['fields'](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x59')]));_0x4e1f10['attributes']=_0x4e1f10[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x4e1f10[_0x5bab('0x47')]:_0x5d984c[_0x5bab('0x42')];if(!_0x24d0bc[_0x5bab('0x43')]['hasOwnProperty'](_0x5bab('0x48'))){_0x4e1f10[_0x5bab('0x49')]=qs[_0x5bab('0x49')](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x49')]);_0x4e1f10[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x4e1f10[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x4e1f10[_0x5bab('0x4c')]=qs['filters'](_[_0x5bab('0x4d')](_0x24d0bc['query'],_0x5d984c[_0x5bab('0x45')]));_0x4e1f10[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x39bbce['id'];if(_0x24d0bc['query'][_0x5bab('0x4e')]){_0x4e1f10[_0x5bab('0x4c')]=_['merge'](_0x4e1f10[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x4e1f10[_0x5bab('0x47')],function(_0xc06cea){var _0x1f5dcb={};_0x1f5dcb[_0xc06cea]={'$like':'%'+_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x4e')]+'%'};return _0x1f5dcb;})});}_0x4e1f10=_[_0x5bab('0x4f')]({},_0x4e1f10,_0x24d0bc['options']);return db[_0x5bab('0x6a')][_0x5bab('0x51')]({'where':_0x4e1f10[_0x5bab('0x4c')]})[_0x5bab('0x1f')](function(_0x42ba52){_0x434b5b[_0x5bab('0x51')]=_0x42ba52;if(_0x24d0bc['query']['includeAll']){_0x4e1f10['include']=[{'all':!![]}];}return db[_0x5bab('0x6a')][_0x5bab('0x53')](_0x4e1f10);})[_0x5bab('0x1f')](function(_0x39ff7f){_0x434b5b['rows']=_0x39ff7f;return _0x434b5b;});}})[_0x5bab('0x1f')](respondWithFilteredResult(_0x4be19c,_0x4e1f10))['catch'](handleError(_0x4be19c,null));};exports[_0x5bab('0x6c')]=function(_0x33a13c,_0x538135,_0x3adc5e){return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x33a13c[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x538135,null))['then'](function(_0xdd9e5b){if(_0xdd9e5b){return _0xdd9e5b[_0x5bab('0x6c')](_0x33a13c['query']['ids']);}})['then'](respondWithStatusCode(_0x538135,null))['catch'](handleError(_0x538135,null));};exports[_0x5bab('0x63')]=function(_0x33fff6,_0x2823da){var _0x264b87={'name':_0x33fff6['body'][_0x5bab('0x37')],'key':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x41')],'email':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x6d')],'ListId':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x6e')],'active':!_[_0x5bab('0x6f')](_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x70')])?_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x70')]:!![],'description':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x5bab('0x6f')](_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x72')])){if(_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x73')]){_0x264b87['Imap'][_0x5bab('0x74')]=_0x264b87[_0x5bab('0x56')]['user']=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x75')];_0x264b87[_0x5bab('0x3b')][_0x5bab('0x76')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x77')]=_0x33fff6['body'][_0x5bab('0x78')];}else{_0x264b87['Imap'][_0x5bab('0x79')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x79')]=![];}_0x264b87[_0x5bab('0x3b')][_0x5bab('0x7a')]=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x3b')][_0x5bab('0x7a')];_0x264b87['Imap'][_0x5bab('0x7b')]=_0x33fff6['body']['Imap'][_0x5bab('0x7b')];_0x264b87[_0x5bab('0x56')][_0x5bab('0x7a')]=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x56')][_0x5bab('0x7a')];_0x264b87[_0x5bab('0x56')][_0x5bab('0x7b')]=_0x33fff6['body'][_0x5bab('0x56')][_0x5bab('0x7b')];}else{_0x264b87[_0x5bab('0x3b')][_0x5bab('0x7c')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x7c')]=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x72')];_0x264b87[_0x5bab('0x3b')][_0x5bab('0x74')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x74')]=_0x33fff6[_0x5bab('0x5d')]['cuser'];_0x264b87['Imap'][_0x5bab('0x76')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x77')]=_0x33fff6[_0x5bab('0x5d')]['cpassword'];}return db['MailAccount'][_0x5bab('0x63')](_0x264b87,{'include':[{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56')},{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')}]})[_0x5bab('0x1f')](function(_0x17e2c1){var _0x2f4b92=_0x33fff6[_0x5bab('0x74')][_0x5bab('0x33')]({'plain':!![]});if(!_0x2f4b92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f4b92[_0x5bab('0x7d')]==='user'){var _0x109cf0=_0x17e2c1[_0x5bab('0x33')]({'plain':!![]});return db[_0x5bab('0x7e')][_0x5bab('0x5c')]({'where':{'name':_0x5bab('0x34'),'userProfileId':_0x2f4b92['userProfileId']},'raw':!![]})[_0x5bab('0x1f')](function(_0x3503b4){if(_0x3503b4&&_0x3503b4[_0x5bab('0x7f')]===0x0){return db['UserProfileResource'][_0x5bab('0x63')]({'name':_0x109cf0[_0x5bab('0x37')],'resourceId':_0x109cf0['id'],'type':_0x3503b4[_0x5bab('0x37')],'sectionId':_0x3503b4['id']},{})[_0x5bab('0x1f')](function(){return _0x17e2c1;});}else{return _0x17e2c1;}})[_0x5bab('0x28')](function(_0x2ef878){logger[_0x5bab('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef878);throw _0x2ef878;});}return _0x17e2c1;})['then'](respondWithResult(_0x2823da,0xc9))[_0x5bab('0x28')](handleError(_0x2823da,null));};exports[_0x5bab('0x80')]=function(_0x2145b7,_0x345fb5,_0x1b208d){return db['MailAccount'][_0x5bab('0x65')]({'where':{'id':_0x2145b7['params']['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x345fb5,null))['then'](function(_0x2c60ad){if(_0x2c60ad){return _0x2c60ad[_0x5bab('0x80')]();}return null;})['then'](respondWithResult(_0x345fb5,null))[_0x5bab('0x28')](handleError(_0x345fb5,null));};exports[_0x5bab('0x81')]=function(_0x19e9b4,_0x545894,_0x12a40d){if(_0x19e9b4['body']['id']){delete _0x19e9b4[_0x5bab('0x5d')]['id'];}return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x19e9b4[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x545894,null))[_0x5bab('0x1f')](function(_0x2c540f){if(_0x2c540f){_0x19e9b4['body'][_0x5bab('0x61')]=_0x2c540f['id'];return db[_0x5bab('0x3a')][_0x5bab('0x63')](_0x19e9b4[_0x5bab('0x5d')]);}})['then'](respondWithResult(_0x545894,null))[_0x5bab('0x28')](handleError(_0x545894,null));};exports[_0x5bab('0x82')]=function(_0x58a661,_0x231eff,_0x579d86){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x58a661[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x231eff,null))[_0x5bab('0x1f')](function(_0x1d9682){if(_0x1d9682){return _0x1d9682[_0x5bab('0x83')](null);}return null;})[_0x5bab('0x1f')](respondWithStatusCode(_0x231eff,null))[_0x5bab('0x28')](handleError(_0x231eff,null));};exports[_0x5bab('0x84')]=function(_0x1bc5d2,_0x1f730e,_0xc8d9){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x1bc5d2[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x1f730e,null))['then'](function(_0x248f35){if(_0x248f35){return _0x248f35['getSmtp']();}return null;})['then'](respondWithResult(_0x1f730e,null))[_0x5bab('0x28')](handleError(_0x1f730e,null));};exports['addSmtp']=function(_0x1fcbc4,_0x27f9be,_0x100493){if(_0x1fcbc4[_0x5bab('0x5d')]['id']){delete _0x1fcbc4[_0x5bab('0x5d')]['id'];}return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x1fcbc4[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x27f9be,null))[_0x5bab('0x1f')](function(_0x49a868){if(_0x49a868){_0x1fcbc4[_0x5bab('0x5d')]['MailAccountId']=_0x49a868['id'];return db[_0x5bab('0x3c')][_0x5bab('0x63')](_0x1fcbc4[_0x5bab('0x5d')]);}})[_0x5bab('0x1f')](respondWithResult(_0x27f9be,null))[_0x5bab('0x28')](handleError(_0x27f9be,null));};exports['removeSmtp']=function(_0x349a4e,_0x240a17,_0x1242ca){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x349a4e[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x240a17,null))['then'](function(_0x2ec7a3){if(_0x2ec7a3){return _0x2ec7a3[_0x5bab('0x85')](null);}return null;})[_0x5bab('0x1f')](respondWithStatusCode(_0x240a17,null))['catch'](handleError(_0x240a17,null));};exports['addInteraction']=function(_0x59c213,_0x3299ba,_0x5b97a9){return db[_0x5bab('0x86')][_0x5bab('0x5c')]({'where':{'id':_0x59c213[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x3299ba,null))[_0x5bab('0x1f')](function(_0x48e443){if(_0x48e443){return _0x48e443[_0x5bab('0x87')](_0x59c213[_0x5bab('0x5d')]['ids'],_[_0x5bab('0x88')](_0x59c213[_0x5bab('0x5d')],['ids','id'])||{});}})[_0x5bab('0x1f')](respondWithResult(_0x3299ba,null))['catch'](handleError(_0x3299ba,null));};exports[_0x5bab('0x89')]=function(_0x5066e9,_0x392076,_0x57e9c0){var _0x24d8a4={'raw':![],'where':{}};var _0x5e39a2={};var _0x94625f={'count':0x0,'rows':[]};return db[_0x5bab('0x3e')]['findOne']({'where':{'id':_0x5066e9[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x392076,null))[_0x5bab('0x1f')](function(_0x31d827){if(_0x31d827){_0x5e39a2[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x86')][_0x5bab('0x66')]);_0x5e39a2[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x5066e9['query']);_0x5e39a2[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x5e39a2[_0x5bab('0x42')],_0x5e39a2['query']);_0x24d8a4[_0x5bab('0x47')]=_['intersection'](_0x5e39a2[_0x5bab('0x42')],qs[_0x5bab('0x59')](_0x5066e9['query'][_0x5bab('0x59')]));_0x24d8a4['attributes']=_0x24d8a4[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x24d8a4[_0x5bab('0x47')]:_0x5e39a2[_0x5bab('0x42')];if(!_0x5066e9['query']['hasOwnProperty']('nolimit')){_0x24d8a4['limit']=qs[_0x5bab('0x49')](_0x5066e9[_0x5bab('0x43')][_0x5bab('0x49')]);_0x24d8a4[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x5066e9[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x24d8a4[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x5066e9['query'][_0x5bab('0x4b')]);_0x24d8a4[_0x5bab('0x4c')]=qs['filters'](_['pick'](_0x5066e9[_0x5bab('0x43')],_0x5e39a2[_0x5bab('0x45')]));_0x24d8a4[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x31d827['id'];if(_0x5066e9[_0x5bab('0x43')][_0x5bab('0x4e')]){_0x24d8a4[_0x5bab('0x4c')]=_['merge'](_0x24d8a4[_0x5bab('0x4c')],{'$or':_['map'](_0x24d8a4[_0x5bab('0x47')],function(_0x21a1fe){var _0x19f4cb={};_0x19f4cb[_0x21a1fe]={'$like':'%'+_0x5066e9['query'][_0x5bab('0x4e')]+'%'};return _0x19f4cb;})});}_0x24d8a4=_['merge']({},_0x24d8a4,_0x5066e9[_0x5bab('0x67')]);return db[_0x5bab('0x86')][_0x5bab('0x51')]({'where':_0x24d8a4['where']})['then'](function(_0x538ed4){_0x94625f['count']=_0x538ed4;if(_0x5066e9[_0x5bab('0x43')][_0x5bab('0x5b')]){_0x24d8a4[_0x5bab('0x52')]=[{'model':db[_0x5bab('0x8a')],'as':_0x5bab('0x8b'),'required':![]},{'model':db[_0x5bab('0x8c')],'as':_0x5bab('0x8d'),'attributes':[_0x5bab('0x37'),'fullname',_0x5bab('0x8e')],'required':![]},{'model':db[_0x5bab('0x8f')],'as':_0x5bab('0x90'),'attributes':['id',_0x5bab('0x37'),_0x5bab('0x91')],'where':_0x5066e9[_0x5bab('0x43')]['tag']?{'id':_0x5066e9[_0x5bab('0x43')]['tag']}:undefined,'required':_0x5066e9[_0x5bab('0x43')]['tag']?!![]:![]}];}return db[_0x5bab('0x86')][_0x5bab('0x53')](_0x24d8a4);})[_0x5bab('0x1f')](function(_0x45aada){_0x94625f[_0x5bab('0x54')]=_0x45aada;return _0x94625f;});}})[_0x5bab('0x1f')](respondWithFilteredResult(_0x392076,_0x24d8a4))[_0x5bab('0x28')](handleError(_0x392076,null));};exports['addApplications']=function(_0x4ad8e0,_0x2252ae,_0x22b254){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x4ad8e0[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x2252ae,null))['then'](function(_0x21b056){if(_0x21b056){return db[_0x5bab('0x92')][_0x5bab('0x93')](function(_0xa751e9){return db[_0x5bab('0x94')][_0x5bab('0x32')]({'where':{'MailAccountId':_0x4ad8e0[_0x5bab('0x60')]['id']},'transaction':_0xa751e9})[_0x5bab('0x1f')](function(_0x7d63d){var _0x81ce91=_['map'](_0x4ad8e0[_0x5bab('0x5d')],function(_0x492481){_0x492481[_0x5bab('0x61')]=_0x4ad8e0[_0x5bab('0x60')]['id'];return _0x492481;});return db[_0x5bab('0x94')][_0x5bab('0x95')](_0x81ce91,{'transaction':_0xa751e9});});})[_0x5bab('0x1f')](function(){return db[_0x5bab('0x94')][_0x5bab('0x96')]({'where':{'MailAccountId':_0x4ad8e0[_0x5bab('0x60')]['id']},'order':_0x5bab('0x97')});});}})[_0x5bab('0x1f')](respondWithResult(_0x2252ae,null))[_0x5bab('0x28')](handleError(_0x2252ae,null));};exports[_0x5bab('0x98')]=function(_0x3d5242,_0x123f88,_0x3418cb){var _0xa1fdd={};var _0x19180d={};var _0x338b4e;var _0x4fe877;return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x3d5242[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x123f88,null))[_0x5bab('0x1f')](function(_0x3cf205){if(_0x3cf205){_0x338b4e=_0x3cf205;_0x19180d[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x94')][_0x5bab('0x66')]);_0x19180d['query']=_[_0x5bab('0x44')](_0x3d5242['query']);_0x19180d[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x19180d[_0x5bab('0x42')],_0x19180d[_0x5bab('0x43')]);_0xa1fdd[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x19180d[_0x5bab('0x42')],qs[_0x5bab('0x59')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x59')]));_0xa1fdd[_0x5bab('0x47')]=_0xa1fdd[_0x5bab('0x47')][_0x5bab('0x5a')]?_0xa1fdd[_0x5bab('0x47')]:_0x19180d[_0x5bab('0x42')];_0xa1fdd['order']=qs[_0x5bab('0x4b')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x4b')]);_0xa1fdd[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x3d5242[_0x5bab('0x43')],_0x19180d[_0x5bab('0x45')]));if(_0x3d5242['query'][_0x5bab('0x4e')]){_0xa1fdd[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0xa1fdd[_0x5bab('0x4c')],{'$or':_['map'](_0xa1fdd['attributes'],function(_0x51c95d){var _0x16caea={};_0x16caea[_0x51c95d]={'$like':'%'+_0x3d5242[_0x5bab('0x43')]['filter']+'%'};return _0x16caea;})});}_0xa1fdd=_[_0x5bab('0x4f')]({},_0xa1fdd,_0x3d5242[_0x5bab('0x67')]);return _0x338b4e['getApplications'](_0xa1fdd);}})[_0x5bab('0x1f')](function(_0x244fb2){if(_0x244fb2){_0x4fe877=_0x244fb2[_0x5bab('0x5a')];if(!_0x3d5242[_0x5bab('0x43')]['hasOwnProperty']('nolimit')){_0xa1fdd[_0x5bab('0x49')]=qs[_0x5bab('0x49')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x49')]);_0xa1fdd[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x2d')]);}return _0x338b4e[_0x5bab('0x98')](_0xa1fdd);}})[_0x5bab('0x1f')](function(_0x4e7027){if(_0x4e7027){return _0x4e7027?{'count':_0x4fe877,'rows':_0x4e7027}:null;}})[_0x5bab('0x1f')](respondWithResult(_0x123f88,null))[_0x5bab('0x28')](handleError(_0x123f88,null));};exports[_0x5bab('0x99')]=function(_0x1e5d07,_0x12af0e,_0x29de1b){var _0x495bd1={'raw':!![],'where':{}};var _0x4a8ff2={};var _0x17d0d3={'count':0x0,'rows':[]};return db['MailAccount'][_0x5bab('0x65')]({'where':{'id':_0x1e5d07[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x12af0e,null))['then'](function(_0x1408e0){if(_0x1408e0){_0x4a8ff2[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x9a')][_0x5bab('0x66')]);_0x4a8ff2[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x1e5d07[_0x5bab('0x43')]);_0x4a8ff2['filters']=_[_0x5bab('0x46')](_0x4a8ff2[_0x5bab('0x42')],_0x4a8ff2[_0x5bab('0x43')]);_0x495bd1[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x4a8ff2['model'],qs[_0x5bab('0x59')](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x59')]));_0x495bd1[_0x5bab('0x47')]=_0x495bd1[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x495bd1[_0x5bab('0x47')]:_0x4a8ff2[_0x5bab('0x42')];if(!_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x9b')](_0x5bab('0x48'))){_0x495bd1['limit']=qs['limit'](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x49')]);_0x495bd1[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x495bd1[_0x5bab('0x4a')]=qs['sort'](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x495bd1[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x1e5d07[_0x5bab('0x43')],_0x4a8ff2['filters']));_0x495bd1[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x1408e0['id'];if(_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x4e')]){_0x495bd1[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0x495bd1[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x495bd1[_0x5bab('0x47')],function(_0xb1ee17){var _0x2968e1={};_0x2968e1[_0xb1ee17]={'$like':'%'+_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x4e')]+'%'};return _0x2968e1;})});}if(_0x1e5d07[_0x5bab('0x43')]['$gte']){var _0x1c7943=_0x1e5d07['query']['$gte'][_0x5bab('0x9c')](',');var _0x31c828={};_0x31c828[_0x1c7943[0x0]]={'$gte':moment(_0x1c7943[0x1])[_0x5bab('0x9d')](_0x5bab('0x9e'))};_0x495bd1['where']=_['merge'](_0x495bd1[_0x5bab('0x4c')],_0x31c828);}_0x495bd1=_['merge']({},_0x495bd1,_0x1e5d07['options']);return db[_0x5bab('0x9a')][_0x5bab('0x51')]({'where':_0x495bd1[_0x5bab('0x4c')]})['then'](function(_0x44cfb8){_0x17d0d3[_0x5bab('0x51')]=_0x44cfb8;if(_0x1e5d07['query'][_0x5bab('0x5b')]){_0x495bd1[_0x5bab('0x52')]=[{'all':!![]}];}return db['MailMessage'][_0x5bab('0x53')](_0x495bd1);})['then'](function(_0x360b02){_0x17d0d3['rows']=_0x360b02;return _0x17d0d3;});}})['then'](respondWithFilteredResult(_0x12af0e,_0x495bd1))[_0x5bab('0x28')](handleError(_0x12af0e,null));};exports[_0x5bab('0x38')]=function(_0x727057,_0x3ef4ef,_0x2f13d8){var _0x133d43,_0x4d8d4f={},_0x550e78;if(_0x727057[_0x5bab('0x5d')]['to']){_0x550e78=_0x727057[_0x5bab('0x5d')]['to'][_0x5bab('0x9c')](',')[0x0];}return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x727057[_0x5bab('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x5bab('0x9f'),'include':[{'model':db[_0x5bab('0x8a')],'as':_0x5bab('0xa0'),'where':{'email':_0x550e78},'limit':0x1,'order':[[_0x5bab('0xa1'),'DESC']]}]},{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56'),'raw':!![]}]})[_0x5bab('0x1f')](handleEntityNotFound(_0x3ef4ef,null))['then'](function(_0x5a9907){if(_0x5a9907){_0x133d43=_0x5a9907;if(_0x5a9907[_0x5bab('0x56')]){if(_[_0x5bab('0x6f')](_0x727057[_0x5bab('0x5d')][_0x5bab('0xa2')])){_0x727057['body']['from']=util[_0x5bab('0x9d')](_0x5bab('0xa3'),_0x5a9907[_0x5bab('0x37')],_0x5a9907['email']||_0x5a9907[_0x5bab('0x56')][_0x5bab('0x74')]);}if(_0x727057[_0x5bab('0x5d')][_0x5bab('0xa4')]&&_0x727057['body'][_0x5bab('0xa4')][_0x5bab('0x5a')]){for(var _0x3f1ad1=0x0;_0x3f1ad1<_0x727057['body']['attachments'][_0x5bab('0x5a')];_0x3f1ad1+=0x1){_0x727057[_0x5bab('0x5d')][_0x5bab('0xa4')][_0x3f1ad1]={'filename':_0x727057['body']['attachments'][_0x3f1ad1][_0x5bab('0x37')],'path':path[_0x5bab('0xa5')](config[_0x5bab('0xa6')],'server/files/attachments',_0x727057[_0x5bab('0x5d')][_0x5bab('0xa4')][_0x3f1ad1][_0x5bab('0xa7')])};}}var _0x474293={'tls':{'rejectUnauthorized':![]}};if(_[_0x5bab('0x6f')](_0x5a9907[_0x5bab('0x56')][_0x5bab('0x7c')])){if(_0x5a9907[_0x5bab('0x56')]['authentication']){_0x474293['auth']={'user':_0x5a9907[_0x5bab('0x56')][_0x5bab('0x74')],'pass':_0x5a9907[_0x5bab('0x56')]['pass']};}_0x474293['host']=_0x5a9907[_0x5bab('0x56')]['host'];_0x474293[_0x5bab('0x7b')]=_0x5a9907[_0x5bab('0x56')][_0x5bab('0x7b')];_0x474293['secure']=_0x5a9907['Smtp'][_0x5bab('0xa8')];}else{_0x474293[_0x5bab('0x7c')]=_0x5a9907[_0x5bab('0x56')]['service'];_0x474293['auth']={'user':_0x5a9907[_0x5bab('0x56')][_0x5bab('0x74')],'pass':_0x5a9907['Smtp'][_0x5bab('0x77')]};}return respondWithRpcPromise('SendMail',_0x5bab('0xa9'),{'account':_0x474293,'message':_0x727057[_0x5bab('0x5d')]});}else{throw new Error('List\x20not\x20found');}}})[_0x5bab('0x1f')](function(_0x4febc8){if(_0x4febc8){_0x4d8d4f=_0x4febc8;if(_0x133d43[_0x5bab('0x9f')]){if(_0x133d43[_0x5bab('0x9f')][_0x5bab('0xa0')][_0x5bab('0x5a')]){return _0x133d43['List']['Contacts'][0x0];}else{return db[_0x5bab('0x8a')][_0x5bab('0x63')](_['defaults'](_0x727057[_0x5bab('0x5d')],{'firstName':_0x727057[_0x5bab('0x5d')]['to'],'email':_0x727057[_0x5bab('0x5d')]['to'],'phone':_0x727057[_0x5bab('0x5d')]['to'],'ListId':_0x133d43['ListId']}));}}else{throw new Error(_0x5bab('0xaa'));}}})[_0x5bab('0x1f')](function(_0x3887b2){if(_0x3887b2){var _0x23e65d={'UserId':_0x727057[_0x5bab('0x74')]['id'],'ContactId':_0x3887b2['id'],'MailAccountId':_0x133d43['id'],'inReplyTo':_0x4d8d4f[_0x5bab('0xab')],'to':_0x727057[_0x5bab('0x5d')][_0x5bab('0xa2')],'cc':_0x727057[_0x5bab('0x5d')]['cc'],'subject':_0x727057[_0x5bab('0x5d')][_0x5bab('0xac')],'attach':_0x727057[_0x5bab('0x5d')]['attach'],'firstMsgDirection':_0x5bab('0xad'),'lastMsgAt':moment()[_0x5bab('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x5bab('0xad'),'lastMsgBody':_0x727057[_0x5bab('0x5d')][_0x5bab('0x5d')],'Messages':[_[_0x5bab('0x4f')](_0x727057[_0x5bab('0x5d')],{'messageId':_0x4d8d4f[_0x5bab('0xab')],'sentAt':moment()[_0x5bab('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x133d43['id'],'UserId':_0x727057[_0x5bab('0x74')]['id'],'ContactId':_0x3887b2['id']})]};if(_0x727057[_0x5bab('0x5d')][_0x5bab('0xae')]){_0x23e65d=_[_0x5bab('0x4f')](_0x23e65d,_0x727057[_0x5bab('0x5d')][_0x5bab('0xae')]);}return db['MailInteraction'][_0x5bab('0x63')](_0x23e65d,{'include':[{'model':db[_0x5bab('0x9a')],'as':'Messages'}]});}})['then'](respondWithResult(_0x3ef4ef,null))[_0x5bab('0x28')](handleError(_0x3ef4ef,null));};exports['verifySmtp']=function(_0x369be5,_0x104211,_0x5ca5fa){return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x369be5['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x5bab('0x56'),'raw':!![]}]})[_0x5bab('0x1f')](handleEntityNotFound(_0x104211,null))[_0x5bab('0x1f')](function(_0x4b0cf2){if(_0x4b0cf2&&_0x4b0cf2[_0x5bab('0x56')]){var _0x520ec5={'id':_0x4b0cf2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4b0cf2['Smtp'][_0x5bab('0x7c')]){_0x520ec5[_0x5bab('0x7c')]=_0x4b0cf2['Smtp'][_0x5bab('0x7c')];}else{_0x520ec5[_0x5bab('0x7a')]=_0x4b0cf2[_0x5bab('0x56')][_0x5bab('0x7a')];_0x520ec5['port']=_0x4b0cf2['Smtp'][_0x5bab('0x7b')];_0x520ec5[_0x5bab('0xa8')]=_0x4b0cf2[_0x5bab('0x56')]['secure'];}if(_0x4b0cf2['Smtp'][_0x5bab('0x79')]){_0x520ec5[_0x5bab('0xaf')]={'user':_0x4b0cf2[_0x5bab('0x56')]['user'],'pass':_0x4b0cf2[_0x5bab('0x56')]['pass']};}return respondWithRpcPromise(_0x5bab('0xb0'),_0x5bab('0xb1'),{'account':_0x520ec5});}})[_0x5bab('0x1f')](respondWithResult(_0x104211,null))[_0x5bab('0x28')](handleError(_0x104211,null));};exports['destroy']=function(_0x148853,_0x1e045a){return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x148853[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x1e045a,null))[_0x5bab('0x1f')](function(_0x58e467){if(_0x58e467&&_0x58e467['service']){throw new db[(_0x5bab('0x1d'))]['ValidationError'](_0x5bab('0xb2'));}return _0x58e467;})[_0x5bab('0x1f')](removeEntity(_0x1e045a,null))['catch'](handleError(_0x1e045a,null));};exports[_0x5bab('0xb3')]=function(_0x34e4ec,_0x1ae4d9,_0x2ebd6a){return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x34e4ec['params']['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x1ae4d9,null))[_0x5bab('0x1f')](function(_0x685347){if(_0x685347){return _0x685347['addAgents'](_0x34e4ec[_0x5bab('0x5d')]['ids'],_['omit'](_0x34e4ec[_0x5bab('0x5d')],[_0x5bab('0x69'),'id'])||{})['spread'](function(_0x1d519a){for(var _0x58fc8a=0x0;_0x58fc8a<_0x34e4ec[_0x5bab('0x5d')][_0x5bab('0x69')][_0x5bab('0x5a')];_0x58fc8a+=0x1){socket['emit'](_0x5bab('0xb4'),{'UserId':_0x34e4ec[_0x5bab('0x5d')][_0x5bab('0x69')][_0x58fc8a],'MailAccountId':_0x34e4ec[_0x5bab('0x60')]['id']});}return _0x1d519a;});}})[_0x5bab('0x1f')](respondWithResult(_0x1ae4d9,null))[_0x5bab('0x28')](handleError(_0x1ae4d9,null));};exports['removeAgents']=function(_0x442500,_0xd97468,_0x463464){return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x442500['params']['id']}})['then'](handleEntityNotFound(_0xd97468,null))[_0x5bab('0x1f')](function(_0x4cb315){if(_0x4cb315){return _0x4cb315['removeAgents'](_0x442500['query'][_0x5bab('0x69')])[_0x5bab('0x1f')](function(){if(_[_0x5bab('0xb5')](_0x442500[_0x5bab('0x43')]['ids'])){for(var _0x511193=0x0;_0x511193<_0x442500[_0x5bab('0x43')][_0x5bab('0x69')][_0x5bab('0x5a')];_0x511193+=0x1){socket[_0x5bab('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x442500[_0x5bab('0x43')]['ids'][_0x511193]),'MailAccountId':Number(_0x442500[_0x5bab('0x60')]['id'])});}}else{socket[_0x5bab('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x442500[_0x5bab('0x43')][_0x5bab('0x69')]),'MailAccountId':Number(_0x442500[_0x5bab('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0xd97468,null))[_0x5bab('0x28')](handleError(_0xd97468,null));};exports[_0x5bab('0xb7')]=function(_0x4f193c,_0x3dd0eb,_0x38c697){var _0x6d2e83={};var _0x48c2e2={};var _0x22daf8;var _0x169dc7;return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x4f193c[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x3dd0eb,null))['then'](function(_0x41c0bc){if(_0x41c0bc){_0x22daf8=_0x41c0bc;_0x48c2e2[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x8c')][_0x5bab('0x66')]);_0x48c2e2[_0x5bab('0x43')]=_['keys'](_0x4f193c['query']);_0x48c2e2[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x48c2e2[_0x5bab('0x42')],_0x48c2e2[_0x5bab('0x43')]);_0x6d2e83[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x48c2e2[_0x5bab('0x42')],qs['fields'](_0x4f193c[_0x5bab('0x43')]['fields']));_0x6d2e83['attributes']=_0x6d2e83['attributes'][_0x5bab('0x5a')]?_0x6d2e83[_0x5bab('0x47')]:_0x48c2e2[_0x5bab('0x42')];_0x6d2e83['order']=qs['sort'](_0x4f193c[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x6d2e83[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x4f193c['query'],_0x48c2e2[_0x5bab('0x45')]));if(_0x4f193c[_0x5bab('0x43')]['filter']){_0x6d2e83[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0x6d2e83['where'],{'$or':_[_0x5bab('0x3d')](_0x6d2e83['attributes'],function(_0x5e85b2){var _0x4df4f1={};_0x4df4f1[_0x5e85b2]={'$like':'%'+_0x4f193c[_0x5bab('0x43')]['filter']+'%'};return _0x4df4f1;})});}_0x6d2e83=_[_0x5bab('0x4f')]({},_0x6d2e83,_0x4f193c[_0x5bab('0x67')]);return _0x22daf8[_0x5bab('0xb7')](_0x6d2e83);}})['then'](function(_0x40b348){if(_0x40b348){_0x169dc7=_0x40b348['length'];if(!_0x4f193c['query'][_0x5bab('0x9b')](_0x5bab('0x48'))){_0x6d2e83[_0x5bab('0x49')]=qs[_0x5bab('0x49')](_0x4f193c[_0x5bab('0x43')]['limit']);_0x6d2e83[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x4f193c[_0x5bab('0x43')][_0x5bab('0x2d')]);}return _0x22daf8[_0x5bab('0xb7')](_0x6d2e83);}})[_0x5bab('0x1f')](function(_0x2b34f0){if(_0x2b34f0){return _0x2b34f0?{'count':_0x169dc7,'rows':_0x2b34f0}:null;}})['then'](respondWithResult(_0x3dd0eb,null))[_0x5bab('0x28')](handleError(_0x3dd0eb,null));}; \ No newline at end of file +var _0x5b19=['options','removeAnswers','create','ListId','isNil','active','description','cservice','cauthentication','user','pass','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','transaction','MailApplication','priority','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','CmList','List','DESC','from','%s\x20<%s>','email','attachments','join','root','basename','auth','secure','sendMail','List\x20not\x20found','messageId','subject','attach','out','format','Messages','verifySmtp','VerifySmtp','addAgents','omit','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','offset','limit','Content-Range','json','apply','save','get','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','params','Pause','find','update','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','CannedAnswer'];(function(_0x3e85eb,_0x4e4823){var _0x28817a=function(_0x344e53){while(--_0x344e53){_0x3e85eb['push'](_0x3e85eb['shift']());}};_0x28817a(++_0x4e4823);}(_0x5b19,0x1ce));var _0x95b1=function(_0x5b9fe0,_0x1419f6){_0x5b9fe0=_0x5b9fe0-0x0;var _0x555985=_0x5b19[_0x5b9fe0];return _0x555985;};'use strict';var pdf=require(_0x95b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x95b1('0x1'));var zipdir=require(_0x95b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95b1('0x3'));var moment=require(_0x95b1('0x4'));var BPromise=require(_0x95b1('0x5'));var Mustache=require(_0x95b1('0x6'));var util=require(_0x95b1('0x7'));var path=require(_0x95b1('0x8'));var sox=require(_0x95b1('0x9'));var csv=require('to-csv');var ejs=require(_0x95b1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x95b1('0xb'));var crypto=require(_0x95b1('0xc'));var jsforce=require(_0x95b1('0xd'));var deskjs=require(_0x95b1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95b1('0xf'));var Papa=require(_0x95b1('0x10'));var Redis=require(_0x95b1('0x11'));var authService=require(_0x95b1('0x12'));var qs=require(_0x95b1('0x13'));var as=require(_0x95b1('0x14'));var hardwareService=require(_0x95b1('0x15'));var logger=require(_0x95b1('0x16'))(_0x95b1('0x17'));var utils=require(_0x95b1('0x18'));var config=require(_0x95b1('0x19'));var db=require(_0x95b1('0x1a'))['db'];config[_0x95b1('0x1b')]=_[_0x95b1('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x95b1('0x1d'))(new Redis(config['redis']));require(_0x95b1('0x1e'))['register'](socket);var jayson=require(_0x95b1('0x1f'));var client=jayson[_0x95b1('0x20')][_0x95b1('0x21')]({'port':0x232b});function checkPasswordPattern(_0x754a27,_0x51a1a8,_0x37e05b){if(_0x37e05b){var _0x3ddf56=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ddf56[_0x95b1('0x22')](_0x51a1a8)){return _0x754a27;}else{throw new db[(_0x95b1('0x23'))][(_0x95b1('0x24'))]('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 _0x754a27;}}function respondWithRpcPromise(_0x558d49,_0x4b59f5,_0x4647c2,_0x282da1){return new BPromise(function(_0x5921ab,_0x180835){var _0x2bcaa2=_0x282da1||client;return _0x2bcaa2[_0x95b1('0x25')](_0x558d49,_0x4647c2)[_0x95b1('0x26')](function(_0x4aa2a7){logger[_0x95b1('0x27')](_0x95b1('0x28'),_0x4b59f5,_0x95b1('0x29'));logger[_0x95b1('0x2a')](_0x95b1('0x2b'),_0x4b59f5,_0x95b1('0x29'),JSON[_0x95b1('0x2c')](_0x4aa2a7));if(_0x4aa2a7[_0x95b1('0x2d')]){if(_0x4aa2a7[_0x95b1('0x2d')][_0x95b1('0x2e')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x4b59f5,_0x4aa2a7[_0x95b1('0x2d')]['message']);return _0x180835(_0x4aa2a7[_0x95b1('0x2d')][_0x95b1('0x2f')]);}logger['error'](_0x95b1('0x28'),_0x4b59f5,_0x4aa2a7[_0x95b1('0x2d')][_0x95b1('0x2f')]);return _0x5921ab(_0x4aa2a7[_0x95b1('0x2d')][_0x95b1('0x2f')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4b59f5,_0x95b1('0x29'));_0x5921ab(_0x4aa2a7['result'][_0x95b1('0x2f')]);}})[_0x95b1('0x30')](function(_0x58aa1c){logger['error'](_0x95b1('0x28'),_0x4b59f5,_0x58aa1c);_0x180835(_0x58aa1c);});});}function respondWithStatusCode(_0x915727,_0x52340b){_0x52340b=_0x52340b||0xcc;return function(_0x3236e1){if(_0x3236e1){return _0x915727['sendStatus'](_0x52340b);}return _0x915727[_0x95b1('0x31')](_0x52340b)['end']();};}function respondWithResult(_0x28eb5a,_0x52d1bc){_0x52d1bc=_0x52d1bc||0xc8;return function(_0x7fd4ab){if(_0x7fd4ab){return _0x28eb5a['status'](_0x52d1bc)['json'](_0x7fd4ab);}};}function respondWithFilteredResult(_0x33c8a9,_0x13c07){return function(_0x36c47d){if(_0x36c47d){var _0x1c64ea=_0x36c47d['count'],_0x5c1611=_0x13c07[_0x95b1('0x32')],_0x45d997=_0x13c07[_0x95b1('0x32')]+_0x13c07[_0x95b1('0x33')],_0x408f0d;if(_0x45d997>=_0x1c64ea){_0x45d997=_0x1c64ea;_0x408f0d=0xc8;}else{_0x408f0d=0xce;}_0x33c8a9['status'](_0x408f0d);return _0x33c8a9['set'](_0x95b1('0x34'),_0x5c1611+'-'+_0x45d997+'/'+_0x1c64ea)[_0x95b1('0x35')](_0x36c47d);}return null;};}function patchUpdates(_0x3d3df9){return function(_0x3e6482){try{jsonpatch[_0x95b1('0x36')](_0x3e6482,_0x3d3df9,!![]);}catch(_0x29006b){return BPromise['reject'](_0x29006b);}return _0x3e6482[_0x95b1('0x37')]();};}function saveUpdates(_0x776028,_0x241eda){return function(_0x997f67){if(_0x997f67){return _0x997f67['update'](_0x776028)['then'](function(_0x2e99dd){return _0x2e99dd;});}return null;};}function removeEntity(_0x298518,_0x231758){return function(_0x51cf1b){if(_0x51cf1b){return _0x51cf1b['destroy']()[_0x95b1('0x26')](function(){var _0x55102f=_0x51cf1b[_0x95b1('0x38')]({'plain':!![]});var _0x11c9fc='MailAccounts';return db[_0x95b1('0x39')][_0x95b1('0x3a')]({'where':{'type':_0x11c9fc,'resourceId':_0x55102f['id']}})[_0x95b1('0x26')](function(){return _0x51cf1b;});})[_0x95b1('0x26')](function(){_0x298518[_0x95b1('0x31')](0xcc)[_0x95b1('0x3b')]();});}};}function handleEntityNotFound(_0xef6237,_0x45f958){return function(_0x44c03f){if(!_0x44c03f){_0xef6237[_0x95b1('0x3c')](0x194);}return _0x44c03f;};}function handleError(_0x213d0a,_0x5b67ce){_0x5b67ce=_0x5b67ce||0x1f4;return function(_0x21b55a){logger[_0x95b1('0x2d')](_0x21b55a[_0x95b1('0x3d')]);if(_0x21b55a[_0x95b1('0x3e')]){delete _0x21b55a[_0x95b1('0x3e')];}_0x213d0a[_0x95b1('0x31')](_0x5b67ce)[_0x95b1('0x3f')](_0x21b55a);};}exports[_0x95b1('0x40')]=function(_0x282915,_0x4be40f){var _0x1f9806={'include':[{'model':db[_0x95b1('0x41')],'as':_0x95b1('0x42')},{'model':db[_0x95b1('0x43')],'as':_0x95b1('0x44')},{'model':db['Pause'],'as':_0x95b1('0x45')}]},_0x396171={},_0x208e7e={'count':0x0,'rows':[]};var _0x107ef1=_[_0x95b1('0x46')](db[_0x95b1('0x47')]['rawAttributes'],function(_0x16ba2a){return{'name':_0x16ba2a[_0x95b1('0x48')],'type':_0x16ba2a[_0x95b1('0x49')][_0x95b1('0x4a')]};});_0x396171[_0x95b1('0x4b')]=_[_0x95b1('0x46')](_0x107ef1,_0x95b1('0x3e'));_0x396171[_0x95b1('0x4c')]=_[_0x95b1('0x4d')](_0x282915[_0x95b1('0x4c')]);_0x396171[_0x95b1('0x4e')]=_[_0x95b1('0x4f')](_0x396171[_0x95b1('0x4b')],_0x396171[_0x95b1('0x4c')]);_0x1f9806[_0x95b1('0x50')]=_[_0x95b1('0x4f')](_0x396171[_0x95b1('0x4b')],qs[_0x95b1('0x51')](_0x282915[_0x95b1('0x4c')][_0x95b1('0x51')]));_0x1f9806[_0x95b1('0x50')]=_0x1f9806[_0x95b1('0x50')][_0x95b1('0x52')]?_0x1f9806['attributes']:_0x396171['model'];if(!_0x282915['query'][_0x95b1('0x53')](_0x95b1('0x54'))){_0x1f9806[_0x95b1('0x33')]=qs['limit'](_0x282915[_0x95b1('0x4c')][_0x95b1('0x33')]);_0x1f9806['offset']=qs['offset'](_0x282915['query'][_0x95b1('0x32')]);}_0x1f9806[_0x95b1('0x55')]=qs[_0x95b1('0x56')](_0x282915['query'][_0x95b1('0x56')]);_0x1f9806[_0x95b1('0x57')]=qs[_0x95b1('0x4e')](_[_0x95b1('0x58')](_0x282915[_0x95b1('0x4c')],_0x396171[_0x95b1('0x4e')]),_0x107ef1);if(_0x282915[_0x95b1('0x4c')][_0x95b1('0x59')]){_0x1f9806['where']=_[_0x95b1('0x5a')](_0x1f9806[_0x95b1('0x57')],{'$or':_[_0x95b1('0x46')](_0x107ef1,function(_0x4d5827){if(_0x4d5827['type']!=='VIRTUAL'){var _0x4bed70={};_0x4bed70[_0x4d5827['name']]={'$like':'%'+_0x282915[_0x95b1('0x4c')][_0x95b1('0x59')]+'%'};return _0x4bed70;}})});}_0x1f9806=_['merge']({},_0x1f9806,_0x282915['options']);var _0x52f752={'where':_0x1f9806[_0x95b1('0x57')]};return db[_0x95b1('0x47')]['count'](_0x52f752)[_0x95b1('0x26')](function(_0x5aa4ae){_0x208e7e[_0x95b1('0x5b')]=_0x5aa4ae;if(_0x282915[_0x95b1('0x4c')][_0x95b1('0x5c')]){_0x1f9806[_0x95b1('0x5d')]=[{'all':!![]}];}return db[_0x95b1('0x47')][_0x95b1('0x5e')](_0x1f9806);})['then'](function(_0xeae8aa){_0x208e7e[_0x95b1('0x5f')]=_0xeae8aa;return _0x208e7e;})[_0x95b1('0x26')](respondWithFilteredResult(_0x4be40f,_0x1f9806))['catch'](handleError(_0x4be40f,null));};exports['show']=function(_0x2421c9,_0x4502cb){var _0x1587b8={'raw':![],'where':{'id':_0x2421c9[_0x95b1('0x60')]['id']},'include':[{'model':db[_0x95b1('0x41')],'as':_0x95b1('0x42')},{'model':db[_0x95b1('0x43')],'as':'Smtp'},{'model':db[_0x95b1('0x61')],'as':_0x95b1('0x45')}]},_0x19ada8={};_0x19ada8[_0x95b1('0x4b')]=_[_0x95b1('0x4d')](db[_0x95b1('0x47')]['rawAttributes']);_0x19ada8[_0x95b1('0x4c')]=_[_0x95b1('0x4d')](_0x2421c9[_0x95b1('0x4c')]);_0x19ada8[_0x95b1('0x4e')]=_[_0x95b1('0x4f')](_0x19ada8[_0x95b1('0x4b')],_0x19ada8[_0x95b1('0x4c')]);_0x1587b8[_0x95b1('0x50')]=_[_0x95b1('0x4f')](_0x19ada8[_0x95b1('0x4b')],qs[_0x95b1('0x51')](_0x2421c9['query'][_0x95b1('0x51')]));_0x1587b8[_0x95b1('0x50')]=_0x1587b8[_0x95b1('0x50')][_0x95b1('0x52')]?_0x1587b8[_0x95b1('0x50')]:_0x19ada8['model'];if(_0x2421c9[_0x95b1('0x4c')]['includeAll']){_0x1587b8[_0x95b1('0x5d')]=[{'all':!![]}];}_0x1587b8=_[_0x95b1('0x5a')]({},_0x1587b8,_0x2421c9['options']);return db[_0x95b1('0x47')][_0x95b1('0x62')](_0x1587b8)[_0x95b1('0x26')](handleEntityNotFound(_0x4502cb,null))[_0x95b1('0x26')](respondWithResult(_0x4502cb,null))[_0x95b1('0x30')](handleError(_0x4502cb,null));};exports[_0x95b1('0x63')]=function(_0x20d8fb,_0x2b0bdb){if(_0x20d8fb[_0x95b1('0x64')]['id']){delete _0x20d8fb['body']['id'];}return db['MailAccount'][_0x95b1('0x62')]({'where':{'id':_0x20d8fb['params']['id']},'include':[{'model':db[_0x95b1('0x41')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x95b1('0x44')},{'model':db['Pause'],'as':_0x95b1('0x45')}]})['then'](handleEntityNotFound(_0x2b0bdb,null))['then'](saveUpdates(_0x20d8fb[_0x95b1('0x64')],null))['then'](function(_0x57d943){if(_0x57d943&&_0x20d8fb['body'][_0x95b1('0x42')]){return db[_0x95b1('0x41')][_0x95b1('0x63')](_0x20d8fb[_0x95b1('0x64')][_0x95b1('0x42')],{'where':{'MailAccountId':_0x57d943['id']}})[_0x95b1('0x26')](function(){return _0x57d943;});}return _0x57d943;})[_0x95b1('0x26')](function(_0x169e2c){if(_0x169e2c&&_0x20d8fb[_0x95b1('0x64')]['Smtp']){return db['MailServerOut'][_0x95b1('0x63')](_0x20d8fb[_0x95b1('0x64')]['Smtp'],{'where':{'MailAccountId':_0x169e2c['id']}})[_0x95b1('0x26')](function(){return _0x169e2c;});}return _0x169e2c;})[_0x95b1('0x26')](respondWithResult(_0x2b0bdb,null))[_0x95b1('0x30')](handleError(_0x2b0bdb,null));};exports[_0x95b1('0x65')]=function(_0x5749f8,_0x3afbf0){return db[_0x95b1('0x47')][_0x95b1('0x65')]()[_0x95b1('0x26')](respondWithResult(_0x3afbf0,null))[_0x95b1('0x30')](handleError(_0x3afbf0,null));};exports[_0x95b1('0x66')]=function(_0x56d5d7,_0xf8304c,_0x4e63f6){if(_0x56d5d7[_0x95b1('0x64')]['id']){delete _0x56d5d7['body']['id'];}return db[_0x95b1('0x47')][_0x95b1('0x62')]({'where':{'id':_0x56d5d7[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0xf8304c,null))[_0x95b1('0x26')](function(_0x3708b2){if(_0x3708b2){_0x56d5d7['body'][_0x95b1('0x67')]=_0x3708b2['id'];return db[_0x95b1('0x68')]['create'](_0x56d5d7[_0x95b1('0x64')]);}})[_0x95b1('0x26')](respondWithResult(_0xf8304c,null))['catch'](handleError(_0xf8304c,null));};exports[_0x95b1('0x69')]=function(_0x18811c,_0x4bfeba,_0x36bb04){var _0x3faced={'raw':![],'where':{}};var _0x4c2953={};var _0x502143={'count':0x0,'rows':[]};return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0x18811c[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x4bfeba,null))[_0x95b1('0x26')](function(_0x12afaf){if(_0x12afaf){_0x4c2953[_0x95b1('0x4b')]=_[_0x95b1('0x4d')](db[_0x95b1('0x68')][_0x95b1('0x6b')]);_0x4c2953[_0x95b1('0x4c')]=_['keys'](_0x18811c[_0x95b1('0x4c')]);_0x4c2953[_0x95b1('0x4e')]=_[_0x95b1('0x4f')](_0x4c2953[_0x95b1('0x4b')],_0x4c2953[_0x95b1('0x4c')]);_0x3faced['attributes']=_['intersection'](_0x4c2953[_0x95b1('0x4b')],qs[_0x95b1('0x51')](_0x18811c[_0x95b1('0x4c')][_0x95b1('0x51')]));_0x3faced[_0x95b1('0x50')]=_0x3faced['attributes']['length']?_0x3faced['attributes']:_0x4c2953[_0x95b1('0x4b')];if(!_0x18811c['query']['hasOwnProperty'](_0x95b1('0x54'))){_0x3faced[_0x95b1('0x33')]=qs[_0x95b1('0x33')](_0x18811c[_0x95b1('0x4c')][_0x95b1('0x33')]);_0x3faced[_0x95b1('0x32')]=qs['offset'](_0x18811c[_0x95b1('0x4c')][_0x95b1('0x32')]);}_0x3faced[_0x95b1('0x55')]=qs[_0x95b1('0x56')](_0x18811c[_0x95b1('0x4c')]['sort']);_0x3faced[_0x95b1('0x57')]=qs[_0x95b1('0x4e')](_[_0x95b1('0x58')](_0x18811c[_0x95b1('0x4c')],_0x4c2953[_0x95b1('0x4e')]));_0x3faced['where'][_0x95b1('0x67')]=_0x12afaf['id'];if(_0x18811c['query'][_0x95b1('0x59')]){_0x3faced[_0x95b1('0x57')]=_[_0x95b1('0x5a')](_0x3faced[_0x95b1('0x57')],{'$or':_['map'](_0x3faced['attributes'],function(_0x179575){var _0x508e8d={};_0x508e8d[_0x179575]={'$like':'%'+_0x18811c[_0x95b1('0x4c')][_0x95b1('0x59')]+'%'};return _0x508e8d;})});}_0x3faced=_[_0x95b1('0x5a')]({},_0x3faced,_0x18811c['options']);return db[_0x95b1('0x68')][_0x95b1('0x5b')]({'where':_0x3faced[_0x95b1('0x57')]})[_0x95b1('0x26')](function(_0x503e42){_0x502143[_0x95b1('0x5b')]=_0x503e42;if(_0x18811c[_0x95b1('0x4c')][_0x95b1('0x5c')]){_0x3faced['include']=[{'all':!![]}];}return db[_0x95b1('0x68')][_0x95b1('0x5e')](_0x3faced);})[_0x95b1('0x26')](function(_0x4ff0d5){_0x502143[_0x95b1('0x5f')]=_0x4ff0d5;return _0x502143;});}})[_0x95b1('0x26')](respondWithFilteredResult(_0x4bfeba,_0x3faced))[_0x95b1('0x30')](handleError(_0x4bfeba,null));};exports[_0x95b1('0x6c')]=function(_0x37efd5,_0x3b32e9,_0x1ef239){return db[_0x95b1('0x47')]['find']({'where':{'id':_0x37efd5[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x3b32e9,null))[_0x95b1('0x26')](function(_0x40ca4b){if(_0x40ca4b){return _0x40ca4b[_0x95b1('0x6c')](_0x37efd5['query'][_0x95b1('0x6d')]);}})[_0x95b1('0x26')](respondWithStatusCode(_0x3b32e9,null))['catch'](handleError(_0x3b32e9,null));};exports['addAnswer']=function(_0x127394,_0x1e4221,_0x386007){if(_0x127394[_0x95b1('0x64')]['id']){delete _0x127394[_0x95b1('0x64')]['id'];}return db[_0x95b1('0x47')][_0x95b1('0x62')]({'where':{'id':_0x127394[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x1e4221,null))[_0x95b1('0x26')](function(_0x427c8b){if(_0x427c8b){_0x127394[_0x95b1('0x64')][_0x95b1('0x67')]=_0x427c8b['id'];return db[_0x95b1('0x6e')]['create'](_0x127394[_0x95b1('0x64')]);}})[_0x95b1('0x26')](respondWithResult(_0x1e4221,null))[_0x95b1('0x30')](handleError(_0x1e4221,null));};exports['getAnswers']=function(_0x47b455,_0x510831,_0x4fef89){var _0x2f8fdf={'raw':![],'where':{}};var _0x21da89={};var _0x222134={'count':0x0,'rows':[]};return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0x47b455[_0x95b1('0x60')]['id']}})['then'](handleEntityNotFound(_0x510831,null))['then'](function(_0x23c7c9){if(_0x23c7c9){_0x21da89[_0x95b1('0x4b')]=_['keys'](db[_0x95b1('0x6e')][_0x95b1('0x6b')]);_0x21da89[_0x95b1('0x4c')]=_[_0x95b1('0x4d')](_0x47b455[_0x95b1('0x4c')]);_0x21da89['filters']=_[_0x95b1('0x4f')](_0x21da89[_0x95b1('0x4b')],_0x21da89['query']);_0x2f8fdf[_0x95b1('0x50')]=_[_0x95b1('0x4f')](_0x21da89['model'],qs[_0x95b1('0x51')](_0x47b455['query'][_0x95b1('0x51')]));_0x2f8fdf[_0x95b1('0x50')]=_0x2f8fdf[_0x95b1('0x50')][_0x95b1('0x52')]?_0x2f8fdf['attributes']:_0x21da89[_0x95b1('0x4b')];if(!_0x47b455[_0x95b1('0x4c')][_0x95b1('0x53')]('nolimit')){_0x2f8fdf[_0x95b1('0x33')]=qs[_0x95b1('0x33')](_0x47b455['query']['limit']);_0x2f8fdf['offset']=qs['offset'](_0x47b455[_0x95b1('0x4c')][_0x95b1('0x32')]);}_0x2f8fdf[_0x95b1('0x55')]=qs['sort'](_0x47b455['query'][_0x95b1('0x56')]);_0x2f8fdf[_0x95b1('0x57')]=qs[_0x95b1('0x4e')](_[_0x95b1('0x58')](_0x47b455[_0x95b1('0x4c')],_0x21da89['filters']));_0x2f8fdf[_0x95b1('0x57')][_0x95b1('0x67')]=_0x23c7c9['id'];if(_0x47b455[_0x95b1('0x4c')]['filter']){_0x2f8fdf[_0x95b1('0x57')]=_['merge'](_0x2f8fdf[_0x95b1('0x57')],{'$or':_[_0x95b1('0x46')](_0x2f8fdf[_0x95b1('0x50')],function(_0x245c44){var _0x522867={};_0x522867[_0x245c44]={'$like':'%'+_0x47b455[_0x95b1('0x4c')][_0x95b1('0x59')]+'%'};return _0x522867;})});}_0x2f8fdf=_[_0x95b1('0x5a')]({},_0x2f8fdf,_0x47b455[_0x95b1('0x6f')]);return db[_0x95b1('0x6e')]['count']({'where':_0x2f8fdf['where']})[_0x95b1('0x26')](function(_0x4db022){_0x222134[_0x95b1('0x5b')]=_0x4db022;if(_0x47b455['query']['includeAll']){_0x2f8fdf[_0x95b1('0x5d')]=[{'all':!![]}];}return db[_0x95b1('0x6e')]['findAll'](_0x2f8fdf);})[_0x95b1('0x26')](function(_0x427aeb){_0x222134[_0x95b1('0x5f')]=_0x427aeb;return _0x222134;});}})[_0x95b1('0x26')](respondWithFilteredResult(_0x510831,_0x2f8fdf))[_0x95b1('0x30')](handleError(_0x510831,null));};exports[_0x95b1('0x70')]=function(_0x5225b6,_0x362737,_0x14283f){return db[_0x95b1('0x47')][_0x95b1('0x62')]({'where':{'id':_0x5225b6[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x362737,null))[_0x95b1('0x26')](function(_0x5b1fb0){if(_0x5b1fb0){return _0x5b1fb0[_0x95b1('0x70')](_0x5225b6[_0x95b1('0x4c')]['ids']);}})[_0x95b1('0x26')](respondWithStatusCode(_0x362737,null))[_0x95b1('0x30')](handleError(_0x362737,null));};exports[_0x95b1('0x71')]=function(_0x5c3c6c,_0x33492b){var _0x547f54={'name':_0x5c3c6c['body'][_0x95b1('0x3e')],'key':_0x5c3c6c['body']['key'],'email':_0x5c3c6c[_0x95b1('0x64')]['email'],'ListId':_0x5c3c6c['body'][_0x95b1('0x72')],'active':!_[_0x95b1('0x73')](_0x5c3c6c['body'][_0x95b1('0x74')])?_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x74')]:!![],'description':_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0x95b1('0x73')](_0x5c3c6c['body'][_0x95b1('0x76')])){if(_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x77')]){_0x547f54[_0x95b1('0x42')][_0x95b1('0x78')]=_0x547f54[_0x95b1('0x44')][_0x95b1('0x78')]=_0x5c3c6c[_0x95b1('0x64')]['cuser'];_0x547f54[_0x95b1('0x42')]['password']=_0x547f54['Smtp'][_0x95b1('0x79')]=_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x7a')];}else{_0x547f54[_0x95b1('0x42')][_0x95b1('0x7b')]=_0x547f54[_0x95b1('0x44')][_0x95b1('0x7b')]=![];}_0x547f54[_0x95b1('0x42')][_0x95b1('0x7c')]=_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x42')][_0x95b1('0x7c')];_0x547f54[_0x95b1('0x42')][_0x95b1('0x7d')]=_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x42')][_0x95b1('0x7d')];_0x547f54[_0x95b1('0x44')][_0x95b1('0x7c')]=_0x5c3c6c['body'][_0x95b1('0x44')][_0x95b1('0x7c')];_0x547f54[_0x95b1('0x44')]['port']=_0x5c3c6c['body'][_0x95b1('0x44')]['port'];}else{_0x547f54[_0x95b1('0x42')][_0x95b1('0x7e')]=_0x547f54[_0x95b1('0x44')][_0x95b1('0x7e')]=_0x5c3c6c['body']['cservice'];_0x547f54['Imap']['user']=_0x547f54[_0x95b1('0x44')][_0x95b1('0x78')]=_0x5c3c6c[_0x95b1('0x64')]['cuser'];_0x547f54['Imap'][_0x95b1('0x7f')]=_0x547f54[_0x95b1('0x44')][_0x95b1('0x79')]=_0x5c3c6c[_0x95b1('0x64')][_0x95b1('0x7a')];}return db[_0x95b1('0x47')][_0x95b1('0x71')](_0x547f54,{'include':[{'model':db[_0x95b1('0x43')],'as':_0x95b1('0x44')},{'model':db[_0x95b1('0x41')],'as':_0x95b1('0x42')}]})['then'](function(_0x5c6944){var _0x567b63=_0x5c3c6c[_0x95b1('0x78')]['get']({'plain':!![]});if(!_0x567b63)throw new Error(_0x95b1('0x80'));if(_0x567b63['role']===_0x95b1('0x78')){var _0x47fc40=_0x5c6944['get']({'plain':!![]});return db[_0x95b1('0x81')][_0x95b1('0x62')]({'where':{'name':_0x95b1('0x82'),'userProfileId':_0x567b63[_0x95b1('0x83')]},'raw':!![]})[_0x95b1('0x26')](function(_0x4c9d40){if(_0x4c9d40&&_0x4c9d40[_0x95b1('0x84')]===0x0){return db['UserProfileResource'][_0x95b1('0x71')]({'name':_0x47fc40[_0x95b1('0x3e')],'resourceId':_0x47fc40['id'],'type':_0x4c9d40[_0x95b1('0x3e')],'sectionId':_0x4c9d40['id']},{})['then'](function(){return _0x5c6944;});}else{return _0x5c6944;}})[_0x95b1('0x30')](function(_0x1b7e8c){logger[_0x95b1('0x2d')](_0x95b1('0x85'),_0x1b7e8c);throw _0x1b7e8c;});}return _0x5c6944;})[_0x95b1('0x26')](respondWithResult(_0x33492b,0xc9))[_0x95b1('0x30')](handleError(_0x33492b,null));};exports[_0x95b1('0x86')]=function(_0x5d80b4,_0x6bad54,_0x5bd56b){return db[_0x95b1('0x47')]['findOne']({'where':{'id':_0x5d80b4[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x6bad54,null))[_0x95b1('0x26')](function(_0xd54ff9){if(_0xd54ff9){return _0xd54ff9[_0x95b1('0x86')]();}return null;})[_0x95b1('0x26')](respondWithResult(_0x6bad54,null))[_0x95b1('0x30')](handleError(_0x6bad54,null));};exports[_0x95b1('0x87')]=function(_0x197533,_0x170508,_0x184540){if(_0x197533[_0x95b1('0x64')]['id']){delete _0x197533['body']['id'];}return db[_0x95b1('0x47')]['find']({'where':{'id':_0x197533['params']['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x170508,null))['then'](function(_0x3c2053){if(_0x3c2053){_0x197533[_0x95b1('0x64')][_0x95b1('0x67')]=_0x3c2053['id'];return db[_0x95b1('0x41')][_0x95b1('0x71')](_0x197533[_0x95b1('0x64')]);}})[_0x95b1('0x26')](respondWithResult(_0x170508,null))['catch'](handleError(_0x170508,null));};exports[_0x95b1('0x88')]=function(_0xe1a020,_0x11213b,_0x332f3f){return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0xe1a020[_0x95b1('0x60')]['id']}})['then'](handleEntityNotFound(_0x11213b,null))[_0x95b1('0x26')](function(_0x5496b0){if(_0x5496b0){return _0x5496b0[_0x95b1('0x89')](null);}return null;})[_0x95b1('0x26')](respondWithStatusCode(_0x11213b,null))[_0x95b1('0x30')](handleError(_0x11213b,null));};exports[_0x95b1('0x8a')]=function(_0x238ee0,_0x1d5602,_0x2875d0){return db[_0x95b1('0x47')]['findOne']({'where':{'id':_0x238ee0[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x1d5602,null))[_0x95b1('0x26')](function(_0x52e18d){if(_0x52e18d){return _0x52e18d[_0x95b1('0x8a')]();}return null;})[_0x95b1('0x26')](respondWithResult(_0x1d5602,null))[_0x95b1('0x30')](handleError(_0x1d5602,null));};exports[_0x95b1('0x8b')]=function(_0x3688a3,_0x3f6559,_0x251cdb){if(_0x3688a3[_0x95b1('0x64')]['id']){delete _0x3688a3[_0x95b1('0x64')]['id'];}return db[_0x95b1('0x47')][_0x95b1('0x62')]({'where':{'id':_0x3688a3[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x3f6559,null))[_0x95b1('0x26')](function(_0x5f41a1){if(_0x5f41a1){_0x3688a3[_0x95b1('0x64')][_0x95b1('0x67')]=_0x5f41a1['id'];return db['MailServerOut'][_0x95b1('0x71')](_0x3688a3[_0x95b1('0x64')]);}})[_0x95b1('0x26')](respondWithResult(_0x3f6559,null))[_0x95b1('0x30')](handleError(_0x3f6559,null));};exports['removeSmtp']=function(_0x3e4e83,_0xc00491,_0x1a274c){return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0x3e4e83[_0x95b1('0x60')]['id']}})['then'](handleEntityNotFound(_0xc00491,null))[_0x95b1('0x26')](function(_0x49b34e){if(_0x49b34e){return _0x49b34e['setSmtp'](null);}return null;})[_0x95b1('0x26')](respondWithStatusCode(_0xc00491,null))[_0x95b1('0x30')](handleError(_0xc00491,null));};exports['addInteraction']=function(_0xbc55,_0x4ff2ad,_0x375d62){return db[_0x95b1('0x8c')]['find']({'where':{'id':_0xbc55[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x4ff2ad,null))[_0x95b1('0x26')](function(_0x346326){if(_0x346326){return _0x346326[_0x95b1('0x8d')](_0xbc55[_0x95b1('0x64')][_0x95b1('0x6d')],_['omit'](_0xbc55[_0x95b1('0x64')],['ids','id'])||{});}})[_0x95b1('0x26')](respondWithResult(_0x4ff2ad,null))[_0x95b1('0x30')](handleError(_0x4ff2ad,null));};exports[_0x95b1('0x8e')]=function(_0x362a71,_0xa42713,_0x162135){var _0x38984f={'raw':![],'where':{}};var _0x43bb6f={};var _0x10e2b9={'count':0x0,'rows':[]};return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0x362a71[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0xa42713,null))['then'](function(_0x498257){if(_0x498257){_0x43bb6f[_0x95b1('0x4b')]=_[_0x95b1('0x4d')](db[_0x95b1('0x8c')][_0x95b1('0x6b')]);_0x43bb6f[_0x95b1('0x4c')]=_[_0x95b1('0x4d')](_0x362a71[_0x95b1('0x4c')]);_0x43bb6f[_0x95b1('0x4e')]=_[_0x95b1('0x4f')](_0x43bb6f[_0x95b1('0x4b')],_0x43bb6f[_0x95b1('0x4c')]);_0x38984f[_0x95b1('0x50')]=_[_0x95b1('0x4f')](_0x43bb6f['model'],qs[_0x95b1('0x51')](_0x362a71[_0x95b1('0x4c')][_0x95b1('0x51')]));_0x38984f[_0x95b1('0x50')]=_0x38984f[_0x95b1('0x50')]['length']?_0x38984f['attributes']:_0x43bb6f['model'];if(!_0x362a71['query'][_0x95b1('0x53')](_0x95b1('0x54'))){_0x38984f[_0x95b1('0x33')]=qs['limit'](_0x362a71[_0x95b1('0x4c')][_0x95b1('0x33')]);_0x38984f[_0x95b1('0x32')]=qs['offset'](_0x362a71[_0x95b1('0x4c')][_0x95b1('0x32')]);}_0x38984f[_0x95b1('0x55')]=qs[_0x95b1('0x56')](_0x362a71[_0x95b1('0x4c')][_0x95b1('0x56')]);_0x38984f[_0x95b1('0x57')]=qs[_0x95b1('0x4e')](_[_0x95b1('0x58')](_0x362a71[_0x95b1('0x4c')],_0x43bb6f[_0x95b1('0x4e')]));_0x38984f['where']['MailAccountId']=_0x498257['id'];if(_0x362a71[_0x95b1('0x4c')]['filter']){_0x38984f[_0x95b1('0x57')]=_['merge'](_0x38984f[_0x95b1('0x57')],{'$or':_[_0x95b1('0x46')](_0x38984f['attributes'],function(_0x286b73){var _0x30ae8b={};_0x30ae8b[_0x286b73]={'$like':'%'+_0x362a71['query']['filter']+'%'};return _0x30ae8b;})});}_0x38984f=_[_0x95b1('0x5a')]({},_0x38984f,_0x362a71[_0x95b1('0x6f')]);return db['MailInteraction'][_0x95b1('0x5b')]({'where':_0x38984f[_0x95b1('0x57')]})[_0x95b1('0x26')](function(_0x55d92e){_0x10e2b9[_0x95b1('0x5b')]=_0x55d92e;if(_0x362a71[_0x95b1('0x4c')][_0x95b1('0x5c')]){_0x38984f['include']=[{'model':db[_0x95b1('0x8f')],'as':_0x95b1('0x90'),'required':![]},{'model':db[_0x95b1('0x91')],'as':_0x95b1('0x92'),'attributes':[_0x95b1('0x3e'),_0x95b1('0x93'),_0x95b1('0x94')],'required':![]},{'model':db['Tag'],'as':_0x95b1('0x95'),'attributes':['id',_0x95b1('0x3e'),_0x95b1('0x96')],'where':_0x362a71[_0x95b1('0x4c')][_0x95b1('0x97')]?{'id':_0x362a71[_0x95b1('0x4c')][_0x95b1('0x97')]}:undefined,'required':_0x362a71[_0x95b1('0x4c')][_0x95b1('0x97')]?!![]:![]}];}return db['MailInteraction'][_0x95b1('0x5e')](_0x38984f);})[_0x95b1('0x26')](function(_0x92adb8){_0x10e2b9[_0x95b1('0x5f')]=_0x92adb8;return _0x10e2b9;});}})[_0x95b1('0x26')](respondWithFilteredResult(_0xa42713,_0x38984f))[_0x95b1('0x30')](handleError(_0xa42713,null));};exports[_0x95b1('0x98')]=function(_0x42ebbf,_0x26084c,_0x5e8c95){return db['MailAccount'][_0x95b1('0x6a')]({'where':{'id':_0x42ebbf[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x26084c,null))['then'](function(_0x41a7dd){if(_0x41a7dd){return db['sequelize'][_0x95b1('0x99')](function(_0xb4f14c){return db[_0x95b1('0x9a')][_0x95b1('0x3a')]({'where':{'MailAccountId':_0x42ebbf[_0x95b1('0x60')]['id']},'transaction':_0xb4f14c})[_0x95b1('0x26')](function(_0x1f76e7){var _0x277eb5=_[_0x95b1('0x46')](_0x42ebbf[_0x95b1('0x64')],function(_0x4ecdcd){_0x4ecdcd['MailAccountId']=_0x42ebbf[_0x95b1('0x60')]['id'];return _0x4ecdcd;});return db[_0x95b1('0x9a')]['bulkCreate'](_0x277eb5,{'transaction':_0xb4f14c});});})[_0x95b1('0x26')](function(){return db[_0x95b1('0x9a')]['findAndCountAll']({'where':{'MailAccountId':_0x42ebbf[_0x95b1('0x60')]['id']},'order':_0x95b1('0x9b')});});}})[_0x95b1('0x26')](respondWithResult(_0x26084c,null))[_0x95b1('0x30')](handleError(_0x26084c,null));};exports[_0x95b1('0x9c')]=function(_0x129a89,_0x38ed33,_0x1e3f25){var _0x43601c={};var _0x21c5b7={};var _0x52b564;var _0x2e4fac;return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0x129a89[_0x95b1('0x60')]['id']}})['then'](handleEntityNotFound(_0x38ed33,null))[_0x95b1('0x26')](function(_0x5a3b2c){if(_0x5a3b2c){_0x52b564=_0x5a3b2c;_0x21c5b7[_0x95b1('0x4b')]=_['keys'](db[_0x95b1('0x9a')]['rawAttributes']);_0x21c5b7['query']=_[_0x95b1('0x4d')](_0x129a89[_0x95b1('0x4c')]);_0x21c5b7[_0x95b1('0x4e')]=_[_0x95b1('0x4f')](_0x21c5b7[_0x95b1('0x4b')],_0x21c5b7[_0x95b1('0x4c')]);_0x43601c[_0x95b1('0x50')]=_['intersection'](_0x21c5b7[_0x95b1('0x4b')],qs[_0x95b1('0x51')](_0x129a89[_0x95b1('0x4c')]['fields']));_0x43601c['attributes']=_0x43601c[_0x95b1('0x50')][_0x95b1('0x52')]?_0x43601c['attributes']:_0x21c5b7['model'];_0x43601c[_0x95b1('0x55')]=qs[_0x95b1('0x56')](_0x129a89[_0x95b1('0x4c')][_0x95b1('0x56')]);_0x43601c[_0x95b1('0x57')]=qs['filters'](_['pick'](_0x129a89['query'],_0x21c5b7['filters']));if(_0x129a89[_0x95b1('0x4c')][_0x95b1('0x59')]){_0x43601c[_0x95b1('0x57')]=_[_0x95b1('0x5a')](_0x43601c[_0x95b1('0x57')],{'$or':_[_0x95b1('0x46')](_0x43601c['attributes'],function(_0x29680c){var _0x36f4df={};_0x36f4df[_0x29680c]={'$like':'%'+_0x129a89[_0x95b1('0x4c')]['filter']+'%'};return _0x36f4df;})});}_0x43601c=_[_0x95b1('0x5a')]({},_0x43601c,_0x129a89[_0x95b1('0x6f')]);return _0x52b564[_0x95b1('0x9c')](_0x43601c);}})[_0x95b1('0x26')](function(_0x40bfe3){if(_0x40bfe3){_0x2e4fac=_0x40bfe3[_0x95b1('0x52')];if(!_0x129a89[_0x95b1('0x4c')][_0x95b1('0x53')](_0x95b1('0x54'))){_0x43601c['limit']=qs[_0x95b1('0x33')](_0x129a89[_0x95b1('0x4c')]['limit']);_0x43601c[_0x95b1('0x32')]=qs[_0x95b1('0x32')](_0x129a89['query'][_0x95b1('0x32')]);}return _0x52b564[_0x95b1('0x9c')](_0x43601c);}})['then'](function(_0x210824){if(_0x210824){return _0x210824?{'count':_0x2e4fac,'rows':_0x210824}:null;}})[_0x95b1('0x26')](respondWithResult(_0x38ed33,null))[_0x95b1('0x30')](handleError(_0x38ed33,null));};exports[_0x95b1('0x9d')]=function(_0x5790d7,_0x2e42f7,_0x2dc939){var _0x586a8f={'raw':!![],'where':{}};var _0x2740aa={};var _0x18d05f={'count':0x0,'rows':[]};return db[_0x95b1('0x47')]['findOne']({'where':{'id':_0x5790d7[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x2e42f7,null))['then'](function(_0x21f365){if(_0x21f365){_0x2740aa[_0x95b1('0x4b')]=_[_0x95b1('0x4d')](db['MailMessage'][_0x95b1('0x6b')]);_0x2740aa['query']=_[_0x95b1('0x4d')](_0x5790d7['query']);_0x2740aa[_0x95b1('0x4e')]=_[_0x95b1('0x4f')](_0x2740aa[_0x95b1('0x4b')],_0x2740aa[_0x95b1('0x4c')]);_0x586a8f[_0x95b1('0x50')]=_[_0x95b1('0x4f')](_0x2740aa[_0x95b1('0x4b')],qs[_0x95b1('0x51')](_0x5790d7[_0x95b1('0x4c')]['fields']));_0x586a8f[_0x95b1('0x50')]=_0x586a8f['attributes']['length']?_0x586a8f['attributes']:_0x2740aa[_0x95b1('0x4b')];if(!_0x5790d7['query'][_0x95b1('0x53')](_0x95b1('0x54'))){_0x586a8f[_0x95b1('0x33')]=qs['limit'](_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x33')]);_0x586a8f['offset']=qs[_0x95b1('0x32')](_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x32')]);}_0x586a8f[_0x95b1('0x55')]=qs[_0x95b1('0x56')](_0x5790d7[_0x95b1('0x4c')]['sort']);_0x586a8f[_0x95b1('0x57')]=qs[_0x95b1('0x4e')](_[_0x95b1('0x58')](_0x5790d7['query'],_0x2740aa[_0x95b1('0x4e')]));_0x586a8f[_0x95b1('0x57')][_0x95b1('0x67')]=_0x21f365['id'];if(_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x59')]){_0x586a8f['where']=_['merge'](_0x586a8f[_0x95b1('0x57')],{'$or':_[_0x95b1('0x46')](_0x586a8f[_0x95b1('0x50')],function(_0x224ace){var _0x491dda={};_0x491dda[_0x224ace]={'$like':'%'+_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x59')]+'%'};return _0x491dda;})});}if(_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x9e')]){var _0x516388=_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x9e')][_0x95b1('0x9f')](',');var _0x5e3709={};_0x5e3709[_0x516388[0x0]]={'$gte':moment(_0x516388[0x1])['format'](_0x95b1('0xa0'))};_0x586a8f[_0x95b1('0x57')]=_[_0x95b1('0x5a')](_0x586a8f[_0x95b1('0x57')],_0x5e3709);}_0x586a8f=_[_0x95b1('0x5a')]({},_0x586a8f,_0x5790d7[_0x95b1('0x6f')]);return db['MailMessage']['count']({'where':_0x586a8f['where']})[_0x95b1('0x26')](function(_0x546411){_0x18d05f['count']=_0x546411;if(_0x5790d7[_0x95b1('0x4c')][_0x95b1('0x5c')]){_0x586a8f[_0x95b1('0x5d')]=[{'all':!![]}];}return db[_0x95b1('0xa1')]['findAll'](_0x586a8f);})[_0x95b1('0x26')](function(_0x51f1aa){_0x18d05f[_0x95b1('0x5f')]=_0x51f1aa;return _0x18d05f;});}})[_0x95b1('0x26')](respondWithFilteredResult(_0x2e42f7,_0x586a8f))[_0x95b1('0x30')](handleError(_0x2e42f7,null));};exports[_0x95b1('0x3f')]=function(_0x4b5e6e,_0x4bbddb,_0x1bb8bc){var _0x33b77e,_0x19cf88={},_0x42716a;if(_0x4b5e6e[_0x95b1('0x64')]['to']){_0x42716a=_0x4b5e6e[_0x95b1('0x64')]['to'][_0x95b1('0x9f')](',')[0x0];}return db[_0x95b1('0x47')]['find']({'where':{'id':_0x4b5e6e[_0x95b1('0x60')]['id']},'include':[{'model':db[_0x95b1('0xa2')],'as':_0x95b1('0xa3'),'include':[{'model':db[_0x95b1('0x8f')],'as':'Contacts','where':{'email':_0x42716a},'limit':0x1,'order':[['updatedAt',_0x95b1('0xa4')]]}]},{'model':db[_0x95b1('0x43')],'as':_0x95b1('0x44'),'raw':!![]}]})[_0x95b1('0x26')](handleEntityNotFound(_0x4bbddb,null))[_0x95b1('0x26')](function(_0x181cfa){if(_0x181cfa){_0x33b77e=_0x181cfa;if(_0x181cfa[_0x95b1('0x44')]){if(_['isNil'](_0x4b5e6e['body'][_0x95b1('0xa5')])){_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0xa5')]=util['format'](_0x95b1('0xa6'),_0x181cfa[_0x95b1('0x3e')],_0x181cfa[_0x95b1('0xa7')]||_0x181cfa[_0x95b1('0x44')][_0x95b1('0x78')]);}if(_0x4b5e6e['body'][_0x95b1('0xa8')]&&_0x4b5e6e[_0x95b1('0x64')]['attachments'][_0x95b1('0x52')]){for(var _0x16157b=0x0;_0x16157b<_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0xa8')][_0x95b1('0x52')];_0x16157b+=0x1){_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0xa8')][_0x16157b]={'filename':_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0xa8')][_0x16157b][_0x95b1('0x3e')],'path':path[_0x95b1('0xa9')](config[_0x95b1('0xaa')],'server/files/attachments',_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0xa8')][_0x16157b][_0x95b1('0xab')])};}}var _0x349fc1={'tls':{'rejectUnauthorized':![]}};if(_[_0x95b1('0x73')](_0x181cfa['Smtp']['service'])){if(_0x181cfa[_0x95b1('0x44')]['authentication']){_0x349fc1[_0x95b1('0xac')]={'user':_0x181cfa[_0x95b1('0x44')][_0x95b1('0x78')],'pass':_0x181cfa[_0x95b1('0x44')][_0x95b1('0x79')]};}_0x349fc1[_0x95b1('0x7c')]=_0x181cfa['Smtp'][_0x95b1('0x7c')];_0x349fc1[_0x95b1('0x7d')]=_0x181cfa[_0x95b1('0x44')]['port'];_0x349fc1[_0x95b1('0xad')]=_0x181cfa['Smtp']['secure'];}else{_0x349fc1[_0x95b1('0x7e')]=_0x181cfa['Smtp'][_0x95b1('0x7e')];_0x349fc1[_0x95b1('0xac')]={'user':_0x181cfa[_0x95b1('0x44')][_0x95b1('0x78')],'pass':_0x181cfa['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0x95b1('0xae'),{'account':_0x349fc1,'message':_0x4b5e6e['body']});}else{throw new Error(_0x95b1('0xaf'));}}})[_0x95b1('0x26')](function(_0x46977c){if(_0x46977c){_0x19cf88=_0x46977c;if(_0x33b77e[_0x95b1('0xa3')]){if(_0x33b77e[_0x95b1('0xa3')]['Contacts']['length']){return _0x33b77e[_0x95b1('0xa3')]['Contacts'][0x0];}else{return db[_0x95b1('0x8f')][_0x95b1('0x71')](_[_0x95b1('0x1c')](_0x4b5e6e[_0x95b1('0x64')],{'firstName':_0x4b5e6e[_0x95b1('0x64')]['to'],'email':_0x4b5e6e[_0x95b1('0x64')]['to'],'phone':_0x4b5e6e['body']['to'],'ListId':_0x33b77e[_0x95b1('0x72')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x95b1('0x26')](function(_0x28f9f6){if(_0x28f9f6){var _0x5e3552={'UserId':_0x4b5e6e[_0x95b1('0x78')]['id'],'ContactId':_0x28f9f6['id'],'MailAccountId':_0x33b77e['id'],'inReplyTo':_0x19cf88[_0x95b1('0xb0')],'to':_0x4b5e6e['body']['from'],'cc':_0x4b5e6e['body']['cc'],'subject':_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0xb1')],'attach':_0x4b5e6e['body'][_0x95b1('0xb2')],'firstMsgDirection':_0x95b1('0xb3'),'lastMsgAt':moment()[_0x95b1('0xb4')](_0x95b1('0xa0')),'lastMsgDirection':'out','lastMsgBody':_0x4b5e6e[_0x95b1('0x64')][_0x95b1('0x64')],'Messages':[_[_0x95b1('0x5a')](_0x4b5e6e['body'],{'messageId':_0x19cf88[_0x95b1('0xb0')],'sentAt':moment()[_0x95b1('0xb4')](_0x95b1('0xa0')),'read':!![],'MailAccountId':_0x33b77e['id'],'UserId':_0x4b5e6e[_0x95b1('0x78')]['id'],'ContactId':_0x28f9f6['id']})]};if(_0x4b5e6e[_0x95b1('0x64')]['Interaction']){_0x5e3552=_[_0x95b1('0x5a')](_0x5e3552,_0x4b5e6e['body']['Interaction']);}return db[_0x95b1('0x8c')]['create'](_0x5e3552,{'include':[{'model':db['MailMessage'],'as':_0x95b1('0xb5')}]});}})['then'](respondWithResult(_0x4bbddb,null))[_0x95b1('0x30')](handleError(_0x4bbddb,null));};exports[_0x95b1('0xb6')]=function(_0x50e26a,_0x45a808,_0x45641e){return db[_0x95b1('0x47')][_0x95b1('0x62')]({'where':{'id':_0x50e26a[_0x95b1('0x60')]['id']},'include':[{'model':db[_0x95b1('0x43')],'as':_0x95b1('0x44'),'raw':!![]}]})[_0x95b1('0x26')](handleEntityNotFound(_0x45a808,null))[_0x95b1('0x26')](function(_0x23d3e5){if(_0x23d3e5&&_0x23d3e5['Smtp']){var _0x407c24={'id':_0x23d3e5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x23d3e5['Smtp'][_0x95b1('0x7e')]){_0x407c24['service']=_0x23d3e5[_0x95b1('0x44')][_0x95b1('0x7e')];}else{_0x407c24[_0x95b1('0x7c')]=_0x23d3e5['Smtp']['host'];_0x407c24[_0x95b1('0x7d')]=_0x23d3e5[_0x95b1('0x44')]['port'];_0x407c24[_0x95b1('0xad')]=_0x23d3e5[_0x95b1('0x44')][_0x95b1('0xad')];}if(_0x23d3e5[_0x95b1('0x44')][_0x95b1('0x7b')]){_0x407c24[_0x95b1('0xac')]={'user':_0x23d3e5[_0x95b1('0x44')][_0x95b1('0x78')],'pass':_0x23d3e5[_0x95b1('0x44')][_0x95b1('0x79')]};}return respondWithRpcPromise(_0x95b1('0xb7'),_0x95b1('0xb6'),{'account':_0x407c24});}})[_0x95b1('0x26')](respondWithResult(_0x45a808,null))[_0x95b1('0x30')](handleError(_0x45a808,null));};exports[_0x95b1('0x3a')]=function(_0x1788a5,_0x39dc95){return db[_0x95b1('0x47')][_0x95b1('0x62')]({'where':{'id':_0x1788a5[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x39dc95,null))[_0x95b1('0x26')](function(_0x13f7a9){if(_0x13f7a9&&_0x13f7a9[_0x95b1('0x7e')]){throw new db[(_0x95b1('0x23'))][(_0x95b1('0x24'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x13f7a9;})[_0x95b1('0x26')](removeEntity(_0x39dc95,null))[_0x95b1('0x30')](handleError(_0x39dc95,null));};exports[_0x95b1('0xb8')]=function(_0x2260f4,_0x104bbd,_0x1bc4b8){return db[_0x95b1('0x47')]['find']({'where':{'id':_0x2260f4[_0x95b1('0x60')]['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x104bbd,null))[_0x95b1('0x26')](function(_0xb7e62b){if(_0xb7e62b){return _0xb7e62b[_0x95b1('0xb8')](_0x2260f4['body'][_0x95b1('0x6d')],_[_0x95b1('0xb9')](_0x2260f4[_0x95b1('0x64')],[_0x95b1('0x6d'),'id'])||{})['spread'](function(_0x287f17){for(var _0x88d6cd=0x0;_0x88d6cd<_0x2260f4['body']['ids']['length'];_0x88d6cd+=0x1){socket[_0x95b1('0xba')](_0x95b1('0xbb'),{'UserId':_0x2260f4[_0x95b1('0x64')]['ids'][_0x88d6cd],'MailAccountId':_0x2260f4[_0x95b1('0x60')]['id']});}return _0x287f17;});}})[_0x95b1('0x26')](respondWithResult(_0x104bbd,null))[_0x95b1('0x30')](handleError(_0x104bbd,null));};exports[_0x95b1('0xbc')]=function(_0x524b74,_0x173053,_0x127804){return db['MailAccount'][_0x95b1('0x62')]({'where':{'id':_0x524b74['params']['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x173053,null))[_0x95b1('0x26')](function(_0x106e76){if(_0x106e76){return _0x106e76[_0x95b1('0xbc')](_0x524b74[_0x95b1('0x4c')][_0x95b1('0x6d')])['then'](function(){if(_['isArray'](_0x524b74[_0x95b1('0x4c')][_0x95b1('0x6d')])){for(var _0x4ec07a=0x0;_0x4ec07a<_0x524b74[_0x95b1('0x4c')][_0x95b1('0x6d')]['length'];_0x4ec07a+=0x1){socket[_0x95b1('0xba')](_0x95b1('0xbd'),{'UserId':Number(_0x524b74['query'][_0x95b1('0x6d')][_0x4ec07a]),'MailAccountId':Number(_0x524b74[_0x95b1('0x60')]['id'])});}}else{socket[_0x95b1('0xba')](_0x95b1('0xbd'),{'UserId':Number(_0x524b74[_0x95b1('0x4c')][_0x95b1('0x6d')]),'MailAccountId':Number(_0x524b74[_0x95b1('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x173053,null))[_0x95b1('0x30')](handleError(_0x173053,null));};exports[_0x95b1('0xbe')]=function(_0x25589c,_0x2ba40f,_0x36493c){var _0x2f593a={};var _0x1eaf89={};var _0xa6cb5e;var _0x5f1bda;return db[_0x95b1('0x47')][_0x95b1('0x6a')]({'where':{'id':_0x25589c['params']['id']}})[_0x95b1('0x26')](handleEntityNotFound(_0x2ba40f,null))[_0x95b1('0x26')](function(_0x32ebc4){if(_0x32ebc4){_0xa6cb5e=_0x32ebc4;_0x1eaf89[_0x95b1('0x4b')]=_['keys'](db[_0x95b1('0x91')][_0x95b1('0x6b')]);_0x1eaf89[_0x95b1('0x4c')]=_['keys'](_0x25589c[_0x95b1('0x4c')]);_0x1eaf89['filters']=_[_0x95b1('0x4f')](_0x1eaf89['model'],_0x1eaf89['query']);_0x2f593a[_0x95b1('0x50')]=_['intersection'](_0x1eaf89['model'],qs[_0x95b1('0x51')](_0x25589c[_0x95b1('0x4c')]['fields']));_0x2f593a[_0x95b1('0x50')]=_0x2f593a[_0x95b1('0x50')][_0x95b1('0x52')]?_0x2f593a[_0x95b1('0x50')]:_0x1eaf89[_0x95b1('0x4b')];_0x2f593a['order']=qs[_0x95b1('0x56')](_0x25589c[_0x95b1('0x4c')][_0x95b1('0x56')]);_0x2f593a[_0x95b1('0x57')]=qs[_0x95b1('0x4e')](_[_0x95b1('0x58')](_0x25589c[_0x95b1('0x4c')],_0x1eaf89[_0x95b1('0x4e')]));if(_0x25589c[_0x95b1('0x4c')]['filter']){_0x2f593a[_0x95b1('0x57')]=_[_0x95b1('0x5a')](_0x2f593a[_0x95b1('0x57')],{'$or':_[_0x95b1('0x46')](_0x2f593a[_0x95b1('0x50')],function(_0x179fbd){var _0x3a3d2d={};_0x3a3d2d[_0x179fbd]={'$like':'%'+_0x25589c[_0x95b1('0x4c')][_0x95b1('0x59')]+'%'};return _0x3a3d2d;})});}_0x2f593a=_['merge']({},_0x2f593a,_0x25589c[_0x95b1('0x6f')]);return _0xa6cb5e[_0x95b1('0xbe')](_0x2f593a);}})[_0x95b1('0x26')](function(_0x4d7694){if(_0x4d7694){_0x5f1bda=_0x4d7694[_0x95b1('0x52')];if(!_0x25589c[_0x95b1('0x4c')][_0x95b1('0x53')](_0x95b1('0x54'))){_0x2f593a[_0x95b1('0x33')]=qs[_0x95b1('0x33')](_0x25589c[_0x95b1('0x4c')]['limit']);_0x2f593a['offset']=qs[_0x95b1('0x32')](_0x25589c[_0x95b1('0x4c')][_0x95b1('0x32')]);}return _0xa6cb5e[_0x95b1('0xbe')](_0x2f593a);}})[_0x95b1('0x26')](function(_0x6707e9){if(_0x6707e9){return _0x6707e9?{'count':_0x5f1bda,'rows':_0x6707e9}:null;}})['then'](respondWithResult(_0x2ba40f,null))['catch'](handleError(_0x2ba40f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6519bed..11a5b1b 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 _0x5468=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x304c5a,_0x132822){var _0x368208=function(_0x459839){while(--_0x459839){_0x304c5a['push'](_0x304c5a['shift']());}};_0x368208(++_0x132822);}(_0x5468,0x187));var _0x8546=function(_0x543651,_0x344197){_0x543651=_0x543651-0x0;var _0x54103d=_0x5468[_0x543651];return _0x54103d;};'use strict';var EventEmitter=require(_0x8546('0x0'));var MailAccount=require(_0x8546('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8546('0x2'),'afterUpdate':_0x8546('0x3'),'afterDestroy':_0x8546('0x4')};function emitEvent(_0x53e8b7){return function(_0x51658d,_0x20411b,_0x4cd7a5){MailAccountEvents['emit'](_0x53e8b7+':'+_0x51658d['id'],_0x51658d);MailAccountEvents[_0x8546('0x5')](_0x53e8b7,_0x51658d);_0x4cd7a5(null);};}for(var e in events){if(events[_0x8546('0x6')](e)){var event=events[e];MailAccount[_0x8546('0x7')](e,emitEvent(event));}}module[_0x8546('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xa382=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32238b,_0x378a44){var _0x18dd50=function(_0x4acab0){while(--_0x4acab0){_0x32238b['push'](_0x32238b['shift']());}};_0x18dd50(++_0x378a44);}(_0xa382,0x64));var _0x2a38=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa382[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x2a38('0x0'));var MailAccount=require(_0x2a38('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2a38('0x2')](0x0);var events={'afterCreate':_0x2a38('0x3'),'afterUpdate':_0x2a38('0x4'),'afterDestroy':_0x2a38('0x5')};function emitEvent(_0x3f71d5){return function(_0xf66999,_0x456450,_0x3e683a){MailAccountEvents[_0x2a38('0x6')](_0x3f71d5+':'+_0xf66999['id'],_0xf66999);MailAccountEvents['emit'](_0x3f71d5,_0xf66999);_0x3e683a(null);};}for(var e in events){if(events[_0x2a38('0x7')](e)){var event=events[e];MailAccount[_0x2a38('0x8')](e,emitEvent(event));}}module[_0x2a38('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1a73a1e..4e33f6a 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 _0xaff3=['bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','util','../../config/logger','api','moment'];(function(_0x49bcc7,_0x5ae274){var _0x221c36=function(_0x2358a0){while(--_0x2358a0){_0x49bcc7['push'](_0x49bcc7['shift']());}};_0x221c36(++_0x5ae274);}(_0xaff3,0x18f));var _0x3aff=function(_0x481aa3,_0x1a0a81){_0x481aa3=_0x481aa3-0x0;var _0x7f8374=_0xaff3[_0x481aa3];return _0x7f8374;};'use strict';var _=require('lodash');var util=require(_0x3aff('0x0'));var logger=require(_0x3aff('0x1'))(_0x3aff('0x2'));var moment=require(_0x3aff('0x3'));var BPromise=require(_0x3aff('0x4'));var rp=require(_0x3aff('0x5'));var fs=require('fs');var path=require(_0x3aff('0x6'));var rimraf=require(_0x3aff('0x7'));var config=require(_0x3aff('0x8'));var attributes=require(_0x3aff('0x9'));module['exports']=function(_0xc4cd47,_0x50efd5){return _0xc4cd47[_0x3aff('0xa')](_0x3aff('0xb'),attributes,{'tableName':_0x3aff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11bd=['rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x11bd,0x125));var _0xd11b=function(_0x1a7408,_0x3ad72a){_0x1a7408=_0x1a7408-0x0;var _0x3121ad=_0x11bd[_0x1a7408];return _0x3121ad;};'use strict';var _=require(_0xd11b('0x0'));var util=require(_0xd11b('0x1'));var logger=require('../../config/logger')(_0xd11b('0x2'));var moment=require(_0xd11b('0x3'));var BPromise=require(_0xd11b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd11b('0x5'));var rimraf=require(_0xd11b('0x6'));var config=require(_0xd11b('0x7'));var attributes=require(_0xd11b('0x8'));module[_0xd11b('0x9')]=function(_0xcd7c94,_0x2140e1){return _0xcd7c94[_0xd11b('0xa')](_0xd11b('0xb'),attributes,{'tableName':_0xd11b('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 b5d4b43..fb5bcf0 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 _0x22fb=['attachments','Attachment','Attachments','name','interaction','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','map','model','include','debug','ShowMailAccount','find','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','priority','asc','autoclose','push','*,*,*,*','length','ListId','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','create','update','YYYY-MM-DD\x20HH:mm:ss','get','created'];(function(_0x393c55,_0x43b06c){var _0x4085fc=function(_0x541e20){while(--_0x541e20){_0x393c55['push'](_0x393c55['shift']());}};_0x4085fc(++_0x43b06c);}(_0x22fb,0x192));var _0xb22f=function(_0x9ad8c5,_0x33b44b){_0x9ad8c5=_0x9ad8c5-0x0;var _0x4a9cc8=_0x22fb[_0x9ad8c5];return _0x4a9cc8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232c});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('MailAccount,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('MailAccount,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('MailAccount,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')]({'raw':_0x4b4510['options']?_0x4b4510['options'][_0xb22f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510[_0xb22f('0x1e')][_0xb22f('0x1f')]||null:null,'attributes':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510[_0xb22f('0x1e')][_0xb22f('0x20')]||null:null,'limit':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510['options']['limit']||null:null,'include':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510[_0xb22f('0x1e')]['include']?_[_0xb22f('0x21')](_0x4b4510[_0xb22f('0x1e')]['include'],function(_0x4687f2){return{'model':db[_0x4687f2[_0xb22f('0x22')]],'as':_0x4687f2['as'],'attributes':_0x4687f2['attributes'],'include':_0x4687f2[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0x4687f2[_0xb22f('0x23')],function(_0xec047c){return{'model':db[_0xec047c[_0xb22f('0x22')]],'as':_0xec047c['as'],'attributes':_0xec047c[_0xb22f('0x20')],'include':_0xec047c[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0xec047c['include'],function(_0x483cc3){return{'model':db[_0x483cc3['model']],'as':_0x483cc3['as'],'attributes':_0x483cc3[_0xb22f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x327200){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x24')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x327200));_0x3878d8(_0x327200);})['catch'](function(_0x435690){logger[_0xb22f('0x14')](_0xb22f('0x1a'),_0x435690[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce['error'](0x1f4,_0x435690[_0xb22f('0x16')]));});});};exports[_0xb22f('0x25')]=function(_0x58f560){var _0x344c30=this;return new Promise(function(_0x218d55,_0x308ecd){return db[_0xb22f('0x1b')][_0xb22f('0x26')]({'raw':_0x58f560['options']?_0x58f560['options'][_0xb22f('0x1d')]===undefined?!![]:![]:!![],'where':_0x58f560[_0xb22f('0x1e')]?_0x58f560[_0xb22f('0x1e')][_0xb22f('0x1f')]||null:null,'attributes':_0x58f560[_0xb22f('0x1e')]?_0x58f560[_0xb22f('0x1e')][_0xb22f('0x20')]||null:null,'include':_0x58f560[_0xb22f('0x1e')]?_0x58f560[_0xb22f('0x1e')]['include']?_[_0xb22f('0x21')](_0x58f560['options']['include'],function(_0x3a74a7){return{'model':db[_0x3a74a7[_0xb22f('0x22')]],'as':_0x3a74a7['as'],'attributes':_0x3a74a7[_0xb22f('0x20')],'include':_0x3a74a7[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0x3a74a7[_0xb22f('0x23')],function(_0x1ca6b8){return{'model':db[_0x1ca6b8[_0xb22f('0x22')]],'as':_0x1ca6b8['as'],'attributes':_0x1ca6b8[_0xb22f('0x20')],'include':_0x1ca6b8[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0x1ca6b8[_0xb22f('0x23')],function(_0x2ab591){return{'model':db[_0x2ab591['model']],'as':_0x2ab591['as'],'attributes':_0x2ab591['attributes']};}):[]};}):[]};}):[]:[]})[_0xb22f('0x27')](function(_0x38a443){logger[_0xb22f('0x17')]('ShowMailAccount',_0x58f560);logger[_0xb22f('0x24')](_0xb22f('0x25'),_0x58f560,JSON['stringify'](_0x38a443));_0x218d55(_0x38a443);})['catch'](function(_0x2ddd64){logger['error'](_0xb22f('0x25'),_0x2ddd64['message'],_0x58f560);_0x308ecd(_0x344c30[_0xb22f('0x14')](0x1f4,_0x2ddd64[_0xb22f('0x16')]));});});};exports[_0xb22f('0x28')]=function(_0x52a3c7){var _0x2cf9f4=this;return new Promise(function(_0x2d265c,_0x2c2a72){var _0x5e2faa={'body':_0x52a3c7[_0xb22f('0x29')],'channel':_0xb22f('0x2a')};var _0x186a66=_[_0xb22f('0x2b')](_[_0xb22f('0x2c')](db[_0xb22f('0x2d')][_0xb22f('0x2e')]),[_0xb22f('0x2f'),_0xb22f('0x30'),_0xb22f('0x31'),'ListId']);var _0x37817a=![];if(_0x52a3c7[_0xb22f('0x29')]['id']){delete _0x52a3c7['body']['id'];}if(_[_0xb22f('0x32')](_0x52a3c7['body']['from'])){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,_0xb22f('0x33')));}if(_[_0xb22f('0x32')](_0x52a3c7[_0xb22f('0x29')]['body'])||_0x52a3c7[_0xb22f('0x29')]['body']===''){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,_0xb22f('0x34')));}if(_[_0xb22f('0x32')](_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x35')])){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x186a66));}if(!_[_0xb22f('0x36')](_0x186a66,_0x52a3c7['body'][_0xb22f('0x35')])){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x186a66));}var _0x2d78c1={};_0x2d78c1[_0x52a3c7[_0xb22f('0x29')]['mapKey']]=_0x52a3c7['body'][_0xb22f('0x37')];return db['MailAccount'][_0xb22f('0x26')]({'where':{'id':_0x52a3c7[_0xb22f('0x38')]['id']},'include':[{'model':db[_0xb22f('0x39')],'as':_0xb22f('0x3a'),'include':[{'model':db['CmContact'],'as':_0xb22f('0x3b'),'where':_0x2d78c1,'limit':0x1,'order':[[_0xb22f('0x30'),'DESC']]}]},{'model':db[_0xb22f('0x3c')],'as':_0xb22f('0x3d')},{'model':db[_0xb22f('0x3e')],'as':_0xb22f('0x3f')}]})[_0xb22f('0x27')](function(_0x589e82){if(_0x589e82&&_0x589e82[_0xb22f('0x3a')]){var _0x53ab34=_0x589e82['get']({'plain':!![]});_0x5e2faa[_0xb22f('0x38')]=_[_0xb22f('0x40')](_0x53ab34,[_0xb22f('0x3d'),_0xb22f('0x3a')]);_0x5e2faa[_0xb22f('0x41')]=_0x53ab34['Applications'];_0x5e2faa[_0xb22f('0x42')]=_0x53ab34['List'];_0x5e2faa[_0xb22f('0x41')]=_['orderBy'](_0x5e2faa[_0xb22f('0x41')],[_0xb22f('0x43')],[_0xb22f('0x44')]);if(_0x5e2faa['account']&&_0x5e2faa[_0xb22f('0x38')][_0xb22f('0x45')]){_0x5e2faa['applications'][_0xb22f('0x46')]({'id':0x0,'priority':_0x5e2faa[_0xb22f('0x41')]['length']+0x1,'app':'close','appdata':_0xb22f('0x45'),'interval':_0xb22f('0x47')});}if(_0x5e2faa['account'][_0xb22f('0x3d')]){delete _0x5e2faa[_0xb22f('0x38')]['Applications'];}if(_0x5e2faa['account'][_0xb22f('0x3a')]){delete _0x5e2faa[_0xb22f('0x38')]['List'];}if(_0x53ab34[_0xb22f('0x3a')][_0xb22f('0x3b')][_0xb22f('0x48')]){return _0x53ab34[_0xb22f('0x3a')]['Contacts'][0x0];}var _0x30039a=_[_0xb22f('0xb')](_0x52a3c7['body'],{'firstName':_0x52a3c7['body'][_0xb22f('0x37')],'ListId':_0x53ab34[_0xb22f('0x49')]});_0x30039a[_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x35')]]=_0x52a3c7['body'][_0xb22f('0x37')];return db[_0xb22f('0x2d')]['create'](_0x30039a);}else{throw new Error(_0xb22f('0x4a'));}})[_0xb22f('0x27')](function(_0xb5c779){_0x5e2faa[_0xb22f('0x4b')]=_0xb5c779;if(_0xb5c779){if(!_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4c')]){_0x52a3c7['body'][_0xb22f('0x16')][_0xb22f('0x4c')]=rs[_0xb22f('0x4d')]()+'\x20'+_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['from'];}var _0x49a6a2={'ContactId':_0xb5c779['id'],'MailAccountId':_0x52a3c7[_0xb22f('0x38')]['id'],'inReplyTo':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['messageId'],'to':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x37')],'cc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['cc'],'subject':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4e')],'attach':_0x52a3c7['body']['message'][_0xb22f('0x4f')],'lastMsgAt':moment()[_0xb22f('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x52a3c7['body'][_0xb22f('0x29')]};return db[_0xb22f('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x52a3c7['account']['id']},'include':[{'model':db[_0xb22f('0x52')],'as':'Messages','attributes':[_0xb22f('0x4c')],'where':{'messageId':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['inReplyTo']}}]})['then'](function(_0x14db56){if(_0x14db56){return[_0x14db56,![]];}return db['MailInteraction'][_0xb22f('0x53')](_0x49a6a2)[_0xb22f('0x27')](function(_0x31485a){return[_0x31485a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2988a2,_0x58e5e6){if(_0x2988a2){_0x37817a=_0x58e5e6;if(!_0x58e5e6){return _0x2988a2[_0xb22f('0x54')]({'inReplyTo':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['messageId'],'to':_0x52a3c7[_0xb22f('0x29')]['message'][_0xb22f('0x37')],'cc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['cc'],'subject':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4e')],'attach':_0x2988a2[_0xb22f('0x4f')]?_0x2988a2[_0xb22f('0x4f')]:_0x52a3c7[_0xb22f('0x29')]['message'][_0xb22f('0x4f')],'substatus':null,'substatusAt':moment()[_0xb22f('0x50')](_0xb22f('0x55')),'lastMsgAt':moment()['format'](_0xb22f('0x55')),'lastMsgDirection':'in','lastMsgBody':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x29')]});}else{return _0x2988a2;}}})[_0xb22f('0x27')](function(_0x492280){_0x5e2faa['interaction']=_0x492280[_0xb22f('0x56')]({'plain':!![]});_0x5e2faa['interaction'][_0xb22f('0x57')]=_0x37817a;return db[_0xb22f('0x52')][_0xb22f('0x53')]({'body':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x29')],'MailAccountId':_0x52a3c7[_0xb22f('0x38')]['id'],'MailInteractionId':_0x492280['id'],'direction':'in','ContactId':_0x5e2faa[_0xb22f('0x4b')]['id'],'messageId':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4c')],'from':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x37')],'to':_0x52a3c7['body'][_0xb22f('0x16')]['to'],'cc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['cc'],'subject':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4e')],'attach':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4f')],'Attachments':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x58')],'originTo':_0x52a3c7['body']['message']['originTo'],'originCc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['originCc'],'bcc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['bcc']},{'include':[{'model':db[_0xb22f('0x59')],'as':_0xb22f('0x5a')}]});})[_0xb22f('0x27')](function(_0x1e7f7a){_0x5e2faa[_0xb22f('0x16')]=_0x1e7f7a;if(_0x5e2faa['interaction']['UserId']){return db['User'][_0xb22f('0x26')]({'attributes':['id',_0xb22f('0x5b')],'where':{'id':_0x5e2faa[_0xb22f('0x5c')]['UserId']}})[_0xb22f('0x27')](function(_0x17a2d3){if(_0x17a2d3){_0x5e2faa['applications'][_0xb22f('0x5d')]({'id':0x0,'priority':0x0,'app':_0xb22f('0x5e'),'appdata':_0x17a2d3[_0xb22f('0x5b')]+','+(_0x5e2faa[_0xb22f('0x38')][_0xb22f('0x5f')]||0xa),'interval':_0xb22f('0x47')});}return respondWithRpcPromise(_0xb22f('0x60'),_0xb22f('0x61'),_0x5e2faa);});}return respondWithRpcPromise(_0xb22f('0x60'),_0xb22f('0x61'),_0x5e2faa);})['then'](function(_0x47055d){_0x2d265c(_0x47055d);})[_0xb22f('0x19')](function(_0x20df33){_0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,_0x20df33[_0xb22f('0x16')]));});});}; \ No newline at end of file +var _0x4d46=['agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','include','map','model','debug','ShowMailAccount','NotifyMailAccount','body','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','List','get','omit','Applications','applications','priority','asc','push','length','close','autoclose','*,*,*,*','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','attachments','originTo','Attachment','Attachments','UserId','User','name','unshift'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x4d46,0x197));var _0x64d4=function(_0x96bf55,_0x184b21){_0x96bf55=_0x96bf55-0x0;var _0x44c688=_0x4d46[_0x96bf55];return _0x44c688;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var moment=require(_0x64d4('0x2'));var BPromise=require(_0x64d4('0x3'));var rs=require(_0x64d4('0x4'));var fs=require('fs');var Redis=require(_0x64d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x64d4('0x6'));var logger=require(_0x64d4('0x7'))(_0x64d4('0x8'));var config=require(_0x64d4('0x9'));var jayson=require(_0x64d4('0xa'));var client=jayson[_0x64d4('0xb')]['http']({'port':0x232c});config[_0x64d4('0xc')]=_[_0x64d4('0xd')](config['redis'],{'host':_0x64d4('0xe'),'port':0x18eb});var socket=require(_0x64d4('0xf'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4ce2cf,_0x56bfd2,_0x2811fc){return new BPromise(function(_0xf3d890,_0xda30b3){return client[_0x64d4('0x10')](_0x4ce2cf,_0x2811fc)[_0x64d4('0x11')](function(_0x2b3a6e){logger[_0x64d4('0x12')](_0x64d4('0x13'),_0x56bfd2,_0x64d4('0x14'));logger['debug'](_0x64d4('0x15'),_0x56bfd2,'request\x20sent',JSON[_0x64d4('0x16')](_0x2b3a6e));if(_0x2b3a6e[_0x64d4('0x17')]){if(_0x2b3a6e[_0x64d4('0x17')][_0x64d4('0x18')]===0x1f4){logger[_0x64d4('0x17')](_0x64d4('0x13'),_0x56bfd2,_0x2b3a6e['error'][_0x64d4('0x19')]);return _0xda30b3(_0x2b3a6e[_0x64d4('0x17')][_0x64d4('0x19')]);}logger[_0x64d4('0x17')](_0x64d4('0x13'),_0x56bfd2,_0x2b3a6e[_0x64d4('0x17')][_0x64d4('0x19')]);return _0xf3d890(_0x2b3a6e['error'][_0x64d4('0x19')]);}else{logger[_0x64d4('0x12')]('MailAccount,\x20%s,\x20%s',_0x56bfd2,_0x64d4('0x14'));_0xf3d890(_0x2b3a6e[_0x64d4('0x1a')][_0x64d4('0x19')]);}})[_0x64d4('0x1b')](function(_0x21455d){logger[_0x64d4('0x17')](_0x64d4('0x13'),_0x56bfd2,_0x21455d);_0xda30b3(_0x21455d);});});}exports[_0x64d4('0x1c')]=function(_0x4bbbf6){var _0x1e4870=this;return new Promise(function(_0x46e926,_0x35ee04){return db[_0x64d4('0x1d')]['findAll']({'raw':_0x4bbbf6['options']?_0x4bbbf6[_0x64d4('0x1e')][_0x64d4('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bbbf6[_0x64d4('0x1e')]?_0x4bbbf6['options'][_0x64d4('0x20')]||null:null,'attributes':_0x4bbbf6[_0x64d4('0x1e')]?_0x4bbbf6[_0x64d4('0x1e')][_0x64d4('0x21')]||null:null,'limit':_0x4bbbf6[_0x64d4('0x1e')]?_0x4bbbf6[_0x64d4('0x1e')]['limit']||null:null,'include':_0x4bbbf6[_0x64d4('0x1e')]?_0x4bbbf6[_0x64d4('0x1e')][_0x64d4('0x22')]?_[_0x64d4('0x23')](_0x4bbbf6['options']['include'],function(_0x598457){return{'model':db[_0x598457[_0x64d4('0x24')]],'as':_0x598457['as'],'attributes':_0x598457['attributes'],'include':_0x598457[_0x64d4('0x22')]?_['map'](_0x598457[_0x64d4('0x22')],function(_0x44eb42){return{'model':db[_0x44eb42[_0x64d4('0x24')]],'as':_0x44eb42['as'],'attributes':_0x44eb42[_0x64d4('0x21')],'include':_0x44eb42[_0x64d4('0x22')]?_['map'](_0x44eb42['include'],function(_0x3865ef){return{'model':db[_0x3865ef[_0x64d4('0x24')]],'as':_0x3865ef['as'],'attributes':_0x3865ef[_0x64d4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x64d4('0x11')](function(_0x77912e){logger[_0x64d4('0x12')](_0x64d4('0x1c'),_0x4bbbf6);logger['debug']('GetMailAccount',_0x4bbbf6,JSON[_0x64d4('0x16')](_0x77912e));_0x46e926(_0x77912e);})[_0x64d4('0x1b')](function(_0x572ce0){logger[_0x64d4('0x17')](_0x64d4('0x1c'),_0x572ce0[_0x64d4('0x19')],_0x4bbbf6);_0x35ee04(_0x1e4870[_0x64d4('0x17')](0x1f4,_0x572ce0[_0x64d4('0x19')]));});});};exports['ShowMailAccount']=function(_0x2f9523){var _0x5d1de7=this;return new Promise(function(_0x5d560e,_0x425593){return db[_0x64d4('0x1d')]['find']({'raw':_0x2f9523[_0x64d4('0x1e')]?_0x2f9523['options'][_0x64d4('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f9523[_0x64d4('0x1e')]?_0x2f9523['options']['where']||null:null,'attributes':_0x2f9523[_0x64d4('0x1e')]?_0x2f9523[_0x64d4('0x1e')][_0x64d4('0x21')]||null:null,'include':_0x2f9523[_0x64d4('0x1e')]?_0x2f9523[_0x64d4('0x1e')]['include']?_[_0x64d4('0x23')](_0x2f9523[_0x64d4('0x1e')][_0x64d4('0x22')],function(_0x52a6f2){return{'model':db[_0x52a6f2['model']],'as':_0x52a6f2['as'],'attributes':_0x52a6f2[_0x64d4('0x21')],'include':_0x52a6f2[_0x64d4('0x22')]?_[_0x64d4('0x23')](_0x52a6f2[_0x64d4('0x22')],function(_0x372dc5){return{'model':db[_0x372dc5[_0x64d4('0x24')]],'as':_0x372dc5['as'],'attributes':_0x372dc5['attributes'],'include':_0x372dc5['include']?_[_0x64d4('0x23')](_0x372dc5[_0x64d4('0x22')],function(_0x4c3bea){return{'model':db[_0x4c3bea['model']],'as':_0x4c3bea['as'],'attributes':_0x4c3bea[_0x64d4('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x553f1a){logger['info']('ShowMailAccount',_0x2f9523);logger[_0x64d4('0x25')](_0x64d4('0x26'),_0x2f9523,JSON[_0x64d4('0x16')](_0x553f1a));_0x5d560e(_0x553f1a);})[_0x64d4('0x1b')](function(_0x2ca578){logger[_0x64d4('0x17')]('ShowMailAccount',_0x2ca578[_0x64d4('0x19')],_0x2f9523);_0x425593(_0x5d1de7[_0x64d4('0x17')](0x1f4,_0x2ca578[_0x64d4('0x19')]));});});};exports[_0x64d4('0x27')]=function(_0x2fd846){var _0x3fdf17=this;return new Promise(function(_0x2aeea6,_0x3c938c){var _0x57089f={'body':_0x2fd846[_0x64d4('0x28')],'channel':'mail'};var _0x14caef=_['difference'](_[_0x64d4('0x29')](db['CmContact']['rawAttributes']),[_0x64d4('0x2a'),_0x64d4('0x2b'),_0x64d4('0x2c'),_0x64d4('0x2d')]);var _0x435412=![];if(_0x2fd846[_0x64d4('0x28')]['id']){delete _0x2fd846[_0x64d4('0x28')]['id'];}if(_[_0x64d4('0x2e')](_0x2fd846[_0x64d4('0x28')]['from'])){return _0x3c938c(_0x3fdf17[_0x64d4('0x17')](0x1f4,_0x64d4('0x2f')));}if(_[_0x64d4('0x2e')](_0x2fd846[_0x64d4('0x28')]['body'])||_0x2fd846[_0x64d4('0x28')][_0x64d4('0x28')]===''){return _0x3c938c(_0x3fdf17['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x64d4('0x2e')](_0x2fd846['body'][_0x64d4('0x30')])){return _0x3c938c(_0x3fdf17['error'](0x1f4,_0x64d4('0x31')+_0x14caef));}if(!_[_0x64d4('0x32')](_0x14caef,_0x2fd846[_0x64d4('0x28')]['mapKey'])){return _0x3c938c(_0x3fdf17[_0x64d4('0x17')](0x1f4,_0x64d4('0x33')+_0x14caef));}var _0x2ec8f1={};_0x2ec8f1[_0x2fd846[_0x64d4('0x28')][_0x64d4('0x30')]]=_0x2fd846[_0x64d4('0x28')]['from'];return db[_0x64d4('0x1d')][_0x64d4('0x34')]({'where':{'id':_0x2fd846[_0x64d4('0x35')]['id']},'include':[{'model':db[_0x64d4('0x36')],'as':'List','include':[{'model':db[_0x64d4('0x37')],'as':_0x64d4('0x38'),'where':_0x2ec8f1,'limit':0x1,'order':[[_0x64d4('0x2b'),_0x64d4('0x39')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x64d4('0x3a')],'as':_0x64d4('0x3b')}]})['then'](function(_0x234e4e){if(_0x234e4e&&_0x234e4e[_0x64d4('0x3c')]){var _0x22ec28=_0x234e4e[_0x64d4('0x3d')]({'plain':!![]});_0x57089f['account']=_[_0x64d4('0x3e')](_0x22ec28,[_0x64d4('0x3f'),_0x64d4('0x3c')]);_0x57089f[_0x64d4('0x40')]=_0x22ec28[_0x64d4('0x3f')];_0x57089f['list']=_0x22ec28[_0x64d4('0x3c')];_0x57089f[_0x64d4('0x40')]=_['orderBy'](_0x57089f[_0x64d4('0x40')],[_0x64d4('0x41')],[_0x64d4('0x42')]);if(_0x57089f['account']&&_0x57089f[_0x64d4('0x35')]['autoclose']){_0x57089f[_0x64d4('0x40')][_0x64d4('0x43')]({'id':0x0,'priority':_0x57089f[_0x64d4('0x40')][_0x64d4('0x44')]+0x1,'app':_0x64d4('0x45'),'appdata':_0x64d4('0x46'),'interval':_0x64d4('0x47')});}if(_0x57089f['account']['Applications']){delete _0x57089f['account'][_0x64d4('0x3f')];}if(_0x57089f[_0x64d4('0x35')][_0x64d4('0x3c')]){delete _0x57089f[_0x64d4('0x35')][_0x64d4('0x3c')];}if(_0x22ec28[_0x64d4('0x3c')]['Contacts'][_0x64d4('0x44')]){return _0x22ec28[_0x64d4('0x3c')][_0x64d4('0x38')][0x0];}var _0x639e2c=_[_0x64d4('0xd')](_0x2fd846[_0x64d4('0x28')],{'firstName':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x48')],'ListId':_0x22ec28['ListId']});_0x639e2c[_0x2fd846[_0x64d4('0x28')][_0x64d4('0x30')]]=_0x2fd846[_0x64d4('0x28')][_0x64d4('0x48')];return db[_0x64d4('0x37')][_0x64d4('0x49')](_0x639e2c);}else{throw new Error(_0x64d4('0x4a'));}})[_0x64d4('0x11')](function(_0x260597){_0x57089f[_0x64d4('0x4b')]=_0x260597;if(_0x260597){if(!_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x4c')]){_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x4c')]=rs[_0x64d4('0x4d')]()+'\x20'+_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x48')];}var _0xf2ef5f={'ContactId':_0x260597['id'],'MailAccountId':_0x2fd846[_0x64d4('0x35')]['id'],'inReplyTo':_0x2fd846['body']['message'][_0x64d4('0x4c')],'to':_0x2fd846[_0x64d4('0x28')]['message']['from'],'cc':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')]['cc'],'subject':_0x2fd846['body'][_0x64d4('0x19')][_0x64d4('0x4e')],'attach':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x4f')],'lastMsgAt':moment()['format'](_0x64d4('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2fd846['body'][_0x64d4('0x28')]};return db[_0x64d4('0x51')][_0x64d4('0x34')]({'where':{'closed':![],'MailAccountId':_0x2fd846[_0x64d4('0x35')]['id']},'include':[{'model':db[_0x64d4('0x52')],'as':_0x64d4('0x53'),'attributes':['messageId'],'where':{'messageId':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x54')]}}]})[_0x64d4('0x11')](function(_0x586a4d){if(_0x586a4d){return[_0x586a4d,![]];}return db[_0x64d4('0x51')]['create'](_0xf2ef5f)[_0x64d4('0x11')](function(_0x47fc19){return[_0x47fc19,!![]];});});}else{throw new Error(_0x64d4('0x55'));}})[_0x64d4('0x56')](function(_0x3988a5,_0xca92f2){if(_0x3988a5){_0x435412=_0xca92f2;if(!_0xca92f2){return _0x3988a5[_0x64d4('0x57')]({'inReplyTo':_0x2fd846[_0x64d4('0x28')]['message'][_0x64d4('0x4c')],'to':_0x2fd846['body']['message'][_0x64d4('0x48')],'cc':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')]['cc'],'subject':_0x2fd846['body'][_0x64d4('0x19')][_0x64d4('0x4e')],'attach':_0x3988a5[_0x64d4('0x4f')]?_0x3988a5['attach']:_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0x64d4('0x58')](_0x64d4('0x50')),'lastMsgAt':moment()['format'](_0x64d4('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x28')]});}else{return _0x3988a5;}}})[_0x64d4('0x11')](function(_0x534e39){_0x57089f[_0x64d4('0x59')]=_0x534e39[_0x64d4('0x3d')]({'plain':!![]});_0x57089f[_0x64d4('0x59')]['created']=_0x435412;return db[_0x64d4('0x52')][_0x64d4('0x49')]({'body':_0x2fd846['body'][_0x64d4('0x28')],'MailAccountId':_0x2fd846[_0x64d4('0x35')]['id'],'MailInteractionId':_0x534e39['id'],'direction':'in','ContactId':_0x57089f[_0x64d4('0x4b')]['id'],'messageId':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x4c')],'from':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x48')],'to':_0x2fd846['body'][_0x64d4('0x19')]['to'],'cc':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')]['cc'],'subject':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x4e')],'attach':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')][_0x64d4('0x4f')],'Attachments':_0x2fd846['body'][_0x64d4('0x19')][_0x64d4('0x5a')],'originTo':_0x2fd846[_0x64d4('0x28')]['message'][_0x64d4('0x5b')],'originCc':_0x2fd846[_0x64d4('0x28')][_0x64d4('0x19')]['originCc'],'bcc':_0x2fd846['body'][_0x64d4('0x19')]['bcc']},{'include':[{'model':db[_0x64d4('0x5c')],'as':_0x64d4('0x5d')}]});})[_0x64d4('0x11')](function(_0x2bae1e){_0x57089f['message']=_0x2bae1e;if(_0x57089f[_0x64d4('0x59')][_0x64d4('0x5e')]){return db[_0x64d4('0x5f')][_0x64d4('0x34')]({'attributes':['id',_0x64d4('0x60')],'where':{'id':_0x57089f[_0x64d4('0x59')][_0x64d4('0x5e')]}})[_0x64d4('0x11')](function(_0x4e9e90){if(_0x4e9e90){_0x57089f[_0x64d4('0x40')][_0x64d4('0x61')]({'id':0x0,'priority':0x0,'app':_0x64d4('0x62'),'appdata':_0x4e9e90[_0x64d4('0x60')]+','+(_0x57089f[_0x64d4('0x35')][_0x64d4('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x64d4('0x64'),'startRouting',_0x57089f);});}return respondWithRpcPromise(_0x64d4('0x64'),'startRouting',_0x57089f);})[_0x64d4('0x11')](function(_0x50178d){_0x2aeea6(_0x50178d);})[_0x64d4('0x1b')](function(_0x3d4b9f){_0x3c938c(_0x3fdf17[_0x64d4('0x17')](0x1f4,_0x3d4b9f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ef0bbde..a07970f 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 _0x4677=['update','emit','removeListener','register','mailAccount:','./mailAccount.events','remove'];(function(_0x21cf80,_0x1fb0a1){var _0x5c6bed=function(_0x3492c3){while(--_0x3492c3){_0x21cf80['push'](_0x21cf80['shift']());}};_0x5c6bed(++_0x1fb0a1);}(_0x4677,0x155));var _0x7467=function(_0x109a29,_0x531d56){_0x109a29=_0x109a29-0x0;var _0x33364c=_0x4677[_0x109a29];return _0x33364c;};'use strict';var MailAccountEvents=require(_0x7467('0x0'));var events=['save',_0x7467('0x1'),_0x7467('0x2')];function createListener(_0x37705b,_0x5075bc){return function(_0x39e4c7){_0x5075bc[_0x7467('0x3')](_0x37705b,_0x39e4c7);};}function removeListener(_0x22a57e,_0xe227ce){return function(){MailAccountEvents[_0x7467('0x4')](_0x22a57e,_0xe227ce);};}exports[_0x7467('0x5')]=function(_0x36fc81){for(var _0x40a9c6=0x0,_0x198e6a=events['length'];_0x40a9c6<_0x198e6a;_0x40a9c6++){var _0x588489=events[_0x40a9c6];var _0x418ff9=createListener(_0x7467('0x6')+_0x588489,_0x36fc81);MailAccountEvents['on'](_0x588489,_0x418ff9);}}; \ No newline at end of file +var _0x9a5a=['emit','removeListener','register','length','./mailAccount.events','save','remove','update'];(function(_0x192929,_0x23f3d6){var _0x50ec8c=function(_0x499d13){while(--_0x499d13){_0x192929['push'](_0x192929['shift']());}};_0x50ec8c(++_0x23f3d6);}(_0x9a5a,0x194));var _0xa9a5=function(_0x337940,_0x8962f5){_0x337940=_0x337940-0x0;var _0x17f4da=_0x9a5a[_0x337940];return _0x17f4da;};'use strict';var MailAccountEvents=require(_0xa9a5('0x0'));var events=[_0xa9a5('0x1'),_0xa9a5('0x2'),_0xa9a5('0x3')];function createListener(_0x198d2a,_0x500287){return function(_0x28e2b3){_0x500287[_0xa9a5('0x4')](_0x198d2a,_0x28e2b3);};}function removeListener(_0x230710,_0x1080a9){return function(){MailAccountEvents[_0xa9a5('0x5')](_0x230710,_0x1080a9);};}exports[_0xa9a5('0x6')]=function(_0x4a73f4){for(var _0xb0ccd9=0x0,_0x37e93b=events[_0xa9a5('0x7')];_0xb0ccd9<_0x37e93b;_0xb0ccd9++){var _0x1eafa6=events[_0xb0ccd9];var _0x24e1bd=createListener('mailAccount:'+_0x1eafa6,_0x4a73f4);MailAccountEvents['on'](_0x1eafa6,_0x24e1bd);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 3357b5b..a940e57 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['delete','isAuthenticated','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','update'];(function(_0x290201,_0x279632){var _0x3d5c08=function(_0x3d0f41){while(--_0x3d0f41){_0x290201['push'](_0x290201['shift']());}};_0x3d5c08(++_0x279632);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);module[_0x7b7e('0xe')]=router; \ No newline at end of file +var _0xe706=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0x44c484,_0x34607f){var _0x9adcd4=function(_0x451a09){while(--_0x451a09){_0x44c484['push'](_0x44c484['shift']());}};_0x9adcd4(++_0x34607f);}(_0xe706,0xa3));var _0x6e70=function(_0x235e66,_0x4bef96){_0x235e66=_0x235e66-0x0;var _0x36019b=_0xe706[_0x235e66];return _0x36019b;};'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')](_0x6e70('0xa'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xd')](_0x6e70('0xa'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xf')](_0x6e70('0xa'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);module[_0x6e70('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0355e4f..cc7c3e4 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 _0x8847=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x938b6a,_0x318dc1){var _0x376cfa=function(_0xaa4293){while(--_0xaa4293){_0x938b6a['push'](_0x938b6a['shift']());}};_0x376cfa(++_0x318dc1);}(_0x8847,0x1a9));var _0x7884=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8847[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x7884('0x0'));module[_0x7884('0x1')]={'priority':{'type':Sequelize[_0x7884('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7884('0x3')],'allowNull':![],'defaultValue':_0x7884('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7884('0x3')]},'interval':{'type':Sequelize[_0x7884('0x3')],'defaultValue':_0x7884('0x5')}}; \ No newline at end of file +var _0x9355=['STRING','sequelize','INTEGER','TEXT'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9355,0x85));var _0x5935=function(_0x3d8e33,_0x4cc963){_0x3d8e33=_0x3d8e33-0x0;var _0x30ef3d=_0x9355[_0x3d8e33];return _0x30ef3d;};'use strict';var Sequelize=require(_0x5935('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5935('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5935('0x2')]()},'description':{'type':Sequelize[_0x5935('0x3')]},'interval':{'type':Sequelize[_0x5935('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index fcd1c3b..4ef0f48 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 _0xbf0e=['send','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','include','options','find','catch','update','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x4ed2c1,_0x8c9475){var _0x397295=function(_0x120012){while(--_0x120012){_0x4ed2c1['push'](_0x4ed2c1['shift']());}};_0x397295(++_0x8c9475);}(_0xbf0e,0x16e));var _0xebf0=function(_0x9331c2,_0x18050b){_0x9331c2=_0x9331c2-0x0;var _0x24ca58=_0xbf0e[_0x9331c2];return _0x24ca58;};'use strict';var pdf=require(_0xebf0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebf0('0x1'));var zipdir=require(_0xebf0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebf0('0x3'));var moment=require(_0xebf0('0x4'));var BPromise=require(_0xebf0('0x5'));var Mustache=require(_0xebf0('0x6'));var util=require(_0xebf0('0x7'));var path=require(_0xebf0('0x8'));var sox=require('sox');var csv=require(_0xebf0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xebf0('0xa'));var crypto=require(_0xebf0('0xb'));var jsforce=require(_0xebf0('0xc'));var deskjs=require(_0xebf0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xebf0('0xe'));var Papa=require(_0xebf0('0xf'));var Redis=require(_0xebf0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xebf0('0x11'));var as=require(_0xebf0('0x12'));var hardwareService=require(_0xebf0('0x13'));var logger=require(_0xebf0('0x14'))(_0xebf0('0x15'));var utils=require(_0xebf0('0x16'));var config=require('../../config/environment');var db=require(_0xebf0('0x17'))['db'];function respondWithStatusCode(_0x584535,_0x183073){_0x183073=_0x183073||0xcc;return function(_0x5d4d92){if(_0x5d4d92){return _0x584535[_0xebf0('0x18')](_0x183073);}return _0x584535[_0xebf0('0x19')](_0x183073)[_0xebf0('0x1a')]();};}function respondWithResult(_0x791427,_0x26c10b){_0x26c10b=_0x26c10b||0xc8;return function(_0x1323d5){if(_0x1323d5){return _0x791427['status'](_0x26c10b)[_0xebf0('0x1b')](_0x1323d5);}};}function respondWithFilteredResult(_0x180ce2,_0xb2be3a){return function(_0x45b785){if(_0x45b785){var _0x19d772=_0x45b785['count'],_0x36387e=_0xb2be3a[_0xebf0('0x1c')],_0x2a4ee7=_0xb2be3a['offset']+_0xb2be3a[_0xebf0('0x1d')],_0x22a605;if(_0x2a4ee7>=_0x19d772){_0x2a4ee7=_0x19d772;_0x22a605=0xc8;}else{_0x22a605=0xce;}_0x180ce2[_0xebf0('0x19')](_0x22a605);return _0x180ce2[_0xebf0('0x1e')](_0xebf0('0x1f'),_0x36387e+'-'+_0x2a4ee7+'/'+_0x19d772)[_0xebf0('0x1b')](_0x45b785);}return null;};}function patchUpdates(_0x5dec11){return function(_0x49246b){try{jsonpatch[_0xebf0('0x20')](_0x49246b,_0x5dec11,!![]);}catch(_0x759ac5){return BPromise[_0xebf0('0x21')](_0x759ac5);}return _0x49246b[_0xebf0('0x22')]();};}function saveUpdates(_0x2e80e6,_0x3d3eba){return function(_0x239373){if(_0x239373){return _0x239373['update'](_0x2e80e6)[_0xebf0('0x23')](function(_0x5bd171){return _0x5bd171;});}return null;};}function removeEntity(_0x301898,_0x5da27f){return function(_0x317e9c){if(_0x317e9c){return _0x317e9c[_0xebf0('0x24')]()[_0xebf0('0x23')](function(){_0x301898['status'](0xcc)[_0xebf0('0x1a')]();});}};}function handleEntityNotFound(_0x4bafca,_0x35aeeb){return function(_0xf59924){if(!_0xf59924){_0x4bafca[_0xebf0('0x18')](0x194);}return _0xf59924;};}function handleError(_0x2e8e8d,_0x49425f){_0x49425f=_0x49425f||0x1f4;return function(_0x309149){logger[_0xebf0('0x25')](_0x309149[_0xebf0('0x26')]);if(_0x309149[_0xebf0('0x27')]){delete _0x309149[_0xebf0('0x27')];}_0x2e8e8d['status'](_0x49425f)[_0xebf0('0x28')](_0x309149);};}exports['show']=function(_0x40b575,_0x3feb18){var _0x411f41={'raw':!![],'where':{'id':_0x40b575[_0xebf0('0x29')]['id']}},_0x408462={};_0x408462['model']=_[_0xebf0('0x2a')](db[_0xebf0('0x2b')][_0xebf0('0x2c')]);_0x408462[_0xebf0('0x2d')]=_['keys'](_0x40b575[_0xebf0('0x2d')]);_0x408462[_0xebf0('0x2e')]=_[_0xebf0('0x2f')](_0x408462['model'],_0x408462[_0xebf0('0x2d')]);_0x411f41[_0xebf0('0x30')]=_[_0xebf0('0x2f')](_0x408462[_0xebf0('0x31')],qs[_0xebf0('0x32')](_0x40b575[_0xebf0('0x2d')]['fields']));_0x411f41[_0xebf0('0x30')]=_0x411f41[_0xebf0('0x30')][_0xebf0('0x33')]?_0x411f41['attributes']:_0x408462[_0xebf0('0x31')];if(_0x40b575['query']['includeAll']){_0x411f41[_0xebf0('0x34')]=[{'all':!![]}];}_0x411f41=_['merge']({},_0x411f41,_0x40b575[_0xebf0('0x35')]);return db['MailApplication'][_0xebf0('0x36')](_0x411f41)[_0xebf0('0x23')](handleEntityNotFound(_0x3feb18,null))[_0xebf0('0x23')](respondWithResult(_0x3feb18,null))[_0xebf0('0x37')](handleError(_0x3feb18,null));};exports[_0xebf0('0x38')]=function(_0x356436,_0x129192){if(_0x356436[_0xebf0('0x39')]['id']){delete _0x356436[_0xebf0('0x39')]['id'];}return db[_0xebf0('0x2b')]['find']({'where':{'id':_0x356436[_0xebf0('0x29')]['id']}})[_0xebf0('0x23')](handleEntityNotFound(_0x129192,null))['then'](saveUpdates(_0x356436[_0xebf0('0x39')],null))[_0xebf0('0x23')](respondWithResult(_0x129192,null))['catch'](handleError(_0x129192,null));};exports[_0xebf0('0x24')]=function(_0x5dc08f,_0x2b1e5b){return db[_0xebf0('0x2b')][_0xebf0('0x36')]({'where':{'id':_0x5dc08f[_0xebf0('0x29')]['id']}})[_0xebf0('0x23')](handleEntityNotFound(_0x2b1e5b,null))[_0xebf0('0x23')](removeEntity(_0x2b1e5b,null))[_0xebf0('0x37')](handleError(_0x2b1e5b,null));}; \ No newline at end of file +var _0x4e83=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','show','params','model','MailApplication','rawAttributes','query','keys','attributes','intersection','fields','length','includeAll','include','merge','options','body','catch','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x1786da,_0x57b7da){var _0xba9f3c=function(_0x5a14d9){while(--_0x5a14d9){_0x1786da['push'](_0x1786da['shift']());}};_0xba9f3c(++_0x57b7da);}(_0x4e83,0xd5));var _0x34e8=function(_0x5ab232,_0x570056){_0x5ab232=_0x5ab232-0x0;var _0x457b86=_0x4e83[_0x5ab232];return _0x457b86;};'use strict';var pdf=require(_0x34e8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34e8('0x1'));var zipdir=require(_0x34e8('0x2'));var jsonpatch=require(_0x34e8('0x3'));var rp=require(_0x34e8('0x4'));var moment=require(_0x34e8('0x5'));var BPromise=require(_0x34e8('0x6'));var Mustache=require(_0x34e8('0x7'));var util=require(_0x34e8('0x8'));var path=require(_0x34e8('0x9'));var sox=require(_0x34e8('0xa'));var csv=require(_0x34e8('0xb'));var ejs=require(_0x34e8('0xc'));var fs=require('fs');var _=require(_0x34e8('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34e8('0xe'));var deskjs=require(_0x34e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x34e8('0x10'));var Redis=require(_0x34e8('0x11'));var authService=require(_0x34e8('0x12'));var qs=require(_0x34e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34e8('0x14'));var logger=require(_0x34e8('0x15'))(_0x34e8('0x16'));var utils=require('../../config/utils');var config=require(_0x34e8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f34a,_0x5f52f9){_0x5f52f9=_0x5f52f9||0xcc;return function(_0x136426){if(_0x136426){return _0x59f34a[_0x34e8('0x18')](_0x5f52f9);}return _0x59f34a['status'](_0x5f52f9)[_0x34e8('0x19')]();};}function respondWithResult(_0x2321d5,_0x2647de){_0x2647de=_0x2647de||0xc8;return function(_0x34a074){if(_0x34a074){return _0x2321d5[_0x34e8('0x1a')](_0x2647de)[_0x34e8('0x1b')](_0x34a074);}};}function respondWithFilteredResult(_0x5eccfe,_0x5b54c4){return function(_0x44a85a){if(_0x44a85a){var _0x221747=_0x44a85a['count'],_0xc752f3=_0x5b54c4[_0x34e8('0x1c')],_0x2c1068=_0x5b54c4[_0x34e8('0x1c')]+_0x5b54c4[_0x34e8('0x1d')],_0x51bf79;if(_0x2c1068>=_0x221747){_0x2c1068=_0x221747;_0x51bf79=0xc8;}else{_0x51bf79=0xce;}_0x5eccfe['status'](_0x51bf79);return _0x5eccfe[_0x34e8('0x1e')](_0x34e8('0x1f'),_0xc752f3+'-'+_0x2c1068+'/'+_0x221747)[_0x34e8('0x1b')](_0x44a85a);}return null;};}function patchUpdates(_0x5ad1d8){return function(_0x2b9325){try{jsonpatch[_0x34e8('0x20')](_0x2b9325,_0x5ad1d8,!![]);}catch(_0x20c39e){return BPromise[_0x34e8('0x21')](_0x20c39e);}return _0x2b9325[_0x34e8('0x22')]();};}function saveUpdates(_0xc48907,_0x5b9e8b){return function(_0x5c0176){if(_0x5c0176){return _0x5c0176[_0x34e8('0x23')](_0xc48907)[_0x34e8('0x24')](function(_0x393e49){return _0x393e49;});}return null;};}function removeEntity(_0x19886f,_0x497d29){return function(_0x5c9e8e){if(_0x5c9e8e){return _0x5c9e8e['destroy']()['then'](function(){_0x19886f[_0x34e8('0x1a')](0xcc)[_0x34e8('0x19')]();});}};}function handleEntityNotFound(_0x2ce025,_0x3a1084){return function(_0x65ece6){if(!_0x65ece6){_0x2ce025[_0x34e8('0x18')](0x194);}return _0x65ece6;};}function handleError(_0x1d5aa1,_0xb2e418){_0xb2e418=_0xb2e418||0x1f4;return function(_0x32bc4e){logger[_0x34e8('0x25')](_0x32bc4e[_0x34e8('0x26')]);if(_0x32bc4e['name']){delete _0x32bc4e[_0x34e8('0x27')];}_0x1d5aa1[_0x34e8('0x1a')](_0xb2e418)['send'](_0x32bc4e);};}exports[_0x34e8('0x28')]=function(_0x3ffc33,_0x3a4c13){var _0x288544={'raw':!![],'where':{'id':_0x3ffc33[_0x34e8('0x29')]['id']}},_0x30c76d={};_0x30c76d[_0x34e8('0x2a')]=_['keys'](db[_0x34e8('0x2b')][_0x34e8('0x2c')]);_0x30c76d[_0x34e8('0x2d')]=_[_0x34e8('0x2e')](_0x3ffc33['query']);_0x30c76d['filters']=_['intersection'](_0x30c76d[_0x34e8('0x2a')],_0x30c76d[_0x34e8('0x2d')]);_0x288544[_0x34e8('0x2f')]=_[_0x34e8('0x30')](_0x30c76d['model'],qs['fields'](_0x3ffc33[_0x34e8('0x2d')][_0x34e8('0x31')]));_0x288544[_0x34e8('0x2f')]=_0x288544['attributes'][_0x34e8('0x32')]?_0x288544[_0x34e8('0x2f')]:_0x30c76d[_0x34e8('0x2a')];if(_0x3ffc33[_0x34e8('0x2d')][_0x34e8('0x33')]){_0x288544[_0x34e8('0x34')]=[{'all':!![]}];}_0x288544=_[_0x34e8('0x35')]({},_0x288544,_0x3ffc33[_0x34e8('0x36')]);return db[_0x34e8('0x2b')]['find'](_0x288544)['then'](handleEntityNotFound(_0x3a4c13,null))[_0x34e8('0x24')](respondWithResult(_0x3a4c13,null))['catch'](handleError(_0x3a4c13,null));};exports['update']=function(_0x2509fc,_0x5eabfa){if(_0x2509fc[_0x34e8('0x37')]['id']){delete _0x2509fc[_0x34e8('0x37')]['id'];}return db[_0x34e8('0x2b')]['find']({'where':{'id':_0x2509fc[_0x34e8('0x29')]['id']}})[_0x34e8('0x24')](handleEntityNotFound(_0x5eabfa,null))['then'](saveUpdates(_0x2509fc[_0x34e8('0x37')],null))[_0x34e8('0x24')](respondWithResult(_0x5eabfa,null))[_0x34e8('0x38')](handleError(_0x5eabfa,null));};exports['destroy']=function(_0x54ae17,_0x1baba4){return db[_0x34e8('0x2b')][_0x34e8('0x39')]({'where':{'id':_0x54ae17['params']['id']}})[_0x34e8('0x24')](handleEntityNotFound(_0x1baba4,null))[_0x34e8('0x24')](removeEntity(_0x1baba4,null))['catch'](handleError(_0x1baba4,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8d6af18..6256b91 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 _0x1000=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x41476a,_0x559206){var _0x5983d3=function(_0xc24cf0){while(--_0xc24cf0){_0x41476a['push'](_0x41476a['shift']());}};_0x5983d3(++_0x559206);}(_0x1000,0x75));var _0x0100=function(_0x5bd0f9,_0x44b013){_0x5bd0f9=_0x5bd0f9-0x0;var _0x458916=_0x1000[_0x5bd0f9];return _0x458916;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0100('0x0'))(_0x0100('0x1'));var moment=require(_0x0100('0x2'));var BPromise=require(_0x0100('0x3'));var rp=require(_0x0100('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0100('0x5'));var config=require(_0x0100('0x6'));var attributes=require(_0x0100('0x7'));module[_0x0100('0x8')]=function(_0x4f55dd,_0x306714){return _0x4f55dd['define'](_0x0100('0x9'),attributes,{'tableName':_0x0100('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0100('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6d25=['MailApplication','mail_applications','utf8mb4_unicode_ci','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x206427,_0x5b02e7){var _0x43cca3=function(_0x421fdc){while(--_0x421fdc){_0x206427['push'](_0x206427['shift']());}};_0x43cca3(++_0x5b02e7);}(_0x6d25,0x81));var _0x56d2=function(_0x53d952,_0x252398){_0x53d952=_0x53d952-0x0;var _0x5b59e2=_0x6d25[_0x53d952];return _0x5b59e2;};'use strict';var _=require('lodash');var util=require(_0x56d2('0x0'));var logger=require('../../config/logger')(_0x56d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56d2('0x2'));var fs=require('fs');var path=require(_0x56d2('0x3'));var rimraf=require(_0x56d2('0x4'));var config=require(_0x56d2('0x5'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x5ac0ad,_0x5106d2){return _0x5ac0ad['define'](_0x56d2('0x6'),attributes,{'tableName':_0x56d2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x56d2('0x8')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a598811..ce54671 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 _0xf1a7=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x412e27,_0x3150ac){var _0xcb2aa2=function(_0x99e199){while(--_0x99e199){_0x412e27['push'](_0x412e27['shift']());}};_0xcb2aa2(++_0x3150ac);}(_0xf1a7,0x9e));var _0x7f1a=function(_0x3e985d,_0x51fc46){_0x3e985d=_0x3e985d-0x0;var _0x5c4b8b=_0xf1a7[_0x3e985d];return _0x5c4b8b;};'use strict';var _=require(_0x7f1a('0x0'));var util=require('util');var moment=require(_0x7f1a('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f1a('0x2'));var fs=require('fs');var Redis=require(_0x7f1a('0x3'));var db=require(_0x7f1a('0x4'))['db'];var utils=require(_0x7f1a('0x5'));var logger=require(_0x7f1a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7f1a('0x7'));var client=jayson[_0x7f1a('0x8')][_0x7f1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d79d5,_0x3907f2,_0x503c1a){return new BPromise(function(_0x410f6d,_0x3741cf){return client[_0x7f1a('0xa')](_0x5d79d5,_0x503c1a)[_0x7f1a('0xb')](function(_0x2a4d9f){logger[_0x7f1a('0xc')](_0x7f1a('0xd'),_0x3907f2,_0x7f1a('0xe'));logger[_0x7f1a('0xf')](_0x7f1a('0x10'),_0x3907f2,_0x7f1a('0xe'),JSON[_0x7f1a('0x11')](_0x2a4d9f));if(_0x2a4d9f[_0x7f1a('0x12')]){if(_0x2a4d9f[_0x7f1a('0x12')]['code']===0x1f4){logger['error'](_0x7f1a('0xd'),_0x3907f2,_0x2a4d9f[_0x7f1a('0x12')][_0x7f1a('0x13')]);return _0x3741cf(_0x2a4d9f[_0x7f1a('0x12')][_0x7f1a('0x13')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x3907f2,_0x2a4d9f['error'][_0x7f1a('0x13')]);return _0x410f6d(_0x2a4d9f[_0x7f1a('0x12')][_0x7f1a('0x13')]);}else{logger[_0x7f1a('0xc')](_0x7f1a('0xd'),_0x3907f2,_0x7f1a('0xe'));_0x410f6d(_0x2a4d9f[_0x7f1a('0x14')][_0x7f1a('0x13')]);}})[_0x7f1a('0x15')](function(_0x36f719){logger[_0x7f1a('0x12')](_0x7f1a('0xd'),_0x3907f2,_0x36f719);_0x3741cf(_0x36f719);});});}exports[_0x7f1a('0x16')]=function(_0x3e0a73){var _0x89907d=this;return new Promise(function(_0x6a98e7,_0x44688b){return db[_0x7f1a('0x17')]['update'](_0x3e0a73[_0x7f1a('0x18')],{'raw':_0x3e0a73[_0x7f1a('0x19')]?_0x3e0a73['options'][_0x7f1a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0a73['options']?_0x3e0a73['options']['where']||null:null,'attributes':_0x3e0a73['options']?_0x3e0a73[_0x7f1a('0x19')][_0x7f1a('0x1b')]||null:null,'limit':_0x3e0a73[_0x7f1a('0x19')]?_0x3e0a73['options']['limit']||null:null})[_0x7f1a('0xb')](function(_0x460c53){logger[_0x7f1a('0xc')](_0x7f1a('0x16'),_0x3e0a73);logger['debug'](_0x7f1a('0x16'),_0x3e0a73,JSON[_0x7f1a('0x11')](_0x460c53));_0x6a98e7(_0x460c53);})[_0x7f1a('0x15')](function(_0x238a0c){logger[_0x7f1a('0x12')](_0x7f1a('0x16'),_0x238a0c[_0x7f1a('0x13')],_0x3e0a73);_0x44688b(_0x89907d[_0x7f1a('0x12')](0x1f4,_0x238a0c['message']));});});}; \ No newline at end of file +var _0xeadf=['randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailApplication','update','body','options','raw','where','attributes','lodash','util','moment'];(function(_0x21de13,_0x55d014){var _0x44edcc=function(_0x235249){while(--_0x235249){_0x21de13['push'](_0x21de13['shift']());}};_0x44edcc(++_0x55d014);}(_0xeadf,0x1eb));var _0xfead=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xeadf[_0x162780];return _0x1ea2dc;};'use strict';var _=require(_0xfead('0x0'));var util=require(_0xfead('0x1'));var moment=require(_0xfead('0x2'));var BPromise=require('bluebird');var rs=require(_0xfead('0x3'));var fs=require('fs');var Redis=require(_0xfead('0x4'));var db=require(_0xfead('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfead('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfead('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c3e0,_0x139b6b,_0x590f57){return new BPromise(function(_0x5d31d5,_0x577e81){return client[_0xfead('0x8')](_0x25c3e0,_0x590f57)[_0xfead('0x9')](function(_0x3190f5){logger[_0xfead('0xa')](_0xfead('0xb'),_0x139b6b,_0xfead('0xc'));logger[_0xfead('0xd')](_0xfead('0xe'),_0x139b6b,_0xfead('0xc'),JSON[_0xfead('0xf')](_0x3190f5));if(_0x3190f5[_0xfead('0x10')]){if(_0x3190f5[_0xfead('0x10')]['code']===0x1f4){logger[_0xfead('0x10')]('MailApplication,\x20%s,\x20%s',_0x139b6b,_0x3190f5['error']['message']);return _0x577e81(_0x3190f5[_0xfead('0x10')][_0xfead('0x11')]);}logger[_0xfead('0x10')](_0xfead('0xb'),_0x139b6b,_0x3190f5['error'][_0xfead('0x11')]);return _0x5d31d5(_0x3190f5[_0xfead('0x10')][_0xfead('0x11')]);}else{logger[_0xfead('0xa')](_0xfead('0xb'),_0x139b6b,'request\x20sent');_0x5d31d5(_0x3190f5['result'][_0xfead('0x11')]);}})[_0xfead('0x12')](function(_0x2014ab){logger[_0xfead('0x10')](_0xfead('0xb'),_0x139b6b,_0x2014ab);_0x577e81(_0x2014ab);});});}exports[_0xfead('0x13')]=function(_0x50c6e0){var _0xdbaaf9=this;return new Promise(function(_0x16b694,_0x27a8ef){return db['MailApplication'][_0xfead('0x14')](_0x50c6e0[_0xfead('0x15')],{'raw':_0x50c6e0['options']?_0x50c6e0[_0xfead('0x16')][_0xfead('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c6e0[_0xfead('0x16')]?_0x50c6e0[_0xfead('0x16')][_0xfead('0x18')]||null:null,'attributes':_0x50c6e0[_0xfead('0x16')]?_0x50c6e0[_0xfead('0x16')][_0xfead('0x19')]||null:null,'limit':_0x50c6e0[_0xfead('0x16')]?_0x50c6e0[_0xfead('0x16')]['limit']||null:null})['then'](function(_0x15607c){logger[_0xfead('0xa')](_0xfead('0x13'),_0x50c6e0);logger[_0xfead('0xd')](_0xfead('0x13'),_0x50c6e0,JSON[_0xfead('0xf')](_0x15607c));_0x16b694(_0x15607c);})[_0xfead('0x12')](function(_0x12d6d2){logger[_0xfead('0x10')](_0xfead('0x13'),_0x12d6d2[_0xfead('0x11')],_0x50c6e0);_0x27a8ef(_0xdbaaf9[_0xfead('0x10')](0x1f4,_0x12d6d2[_0xfead('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 04e070d..afaadce 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 _0x0eea=['destroy','removeTags','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0eea,0xdc));var _0xa0ee=function(_0x2102c3,_0x53d4b8){_0x2102c3=_0x2102c3-0x0;var _0x3758c9=_0x0eea[_0x2102c3];return _0x3758c9;};'use strict';var multer=require('multer');var util=require(_0xa0ee('0x0'));var path=require(_0xa0ee('0x1'));var timeout=require(_0xa0ee('0x2'));var express=require(_0xa0ee('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa0ee('0x4'));var config=require(_0xa0ee('0x5'));var controller=require(_0xa0ee('0x6'));router[_0xa0ee('0x7')]('/',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x9')]);router[_0xa0ee('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa0ee('0xa')]);router['get'](_0xa0ee('0xb'),auth[_0xa0ee('0x8')](),controller['show']);router[_0xa0ee('0x7')](_0xa0ee('0xc'),auth[_0xa0ee('0x8')](),controller[_0xa0ee('0xd')]);router[_0xa0ee('0x7')](_0xa0ee('0xe'),auth[_0xa0ee('0x8')](),controller[_0xa0ee('0xf')]);router['post']('/',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x10')]);router[_0xa0ee('0x11')]('/:id/messages',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x12')]);router[_0xa0ee('0x11')](_0xa0ee('0x13'),auth[_0xa0ee('0x8')](),interaction[_0xa0ee('0x14')](_0xa0ee('0x15'),_0xa0ee('0x16')),controller[_0xa0ee('0x17')]);router[_0xa0ee('0x18')](_0xa0ee('0xb'),auth[_0xa0ee('0x8')](),interaction[_0xa0ee('0x14')]('mail','mailinteraction:update'),controller[_0xa0ee('0x19')]);router[_0xa0ee('0x1a')](_0xa0ee('0xb'),auth[_0xa0ee('0x8')](),interaction[_0xa0ee('0x14')]('mail',_0xa0ee('0x1b')),controller[_0xa0ee('0x1c')]);router['delete']('/:id/tags',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x1d')]);module[_0xa0ee('0x1e')]=router; \ No newline at end of file +var _0x5fdc=['mail','mailinteraction:addtags','put','update','delete','mailinteraction:destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x552c6a,_0x5bcb34){var _0x1d154d=function(_0x3a97bf){while(--_0x3a97bf){_0x552c6a['push'](_0x552c6a['shift']());}};_0x1d154d(++_0x5bcb34);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x5f0993,_0x4c19a5){_0x5f0993=_0x5f0993-0x0;var _0x5ae9a8=_0x5fdc[_0x5f0993];return _0x5ae9a8;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc5fd('0x1'));var express=require(_0xc5fd('0x2'));var router=express[_0xc5fd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc5fd('0x4'));var config=require(_0xc5fd('0x5'));var controller=require(_0xc5fd('0x6'));router[_0xc5fd('0x7')]('/',auth[_0xc5fd('0x8')](),controller[_0xc5fd('0x9')]);router[_0xc5fd('0x7')](_0xc5fd('0xa'),auth[_0xc5fd('0x8')](),controller[_0xc5fd('0xb')]);router['get'](_0xc5fd('0xc'),auth['isAuthenticated'](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc5fd('0xe')]);router[_0xc5fd('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xc5fd('0xf')]);router['post']('/',auth[_0xc5fd('0x8')](),controller['create']);router[_0xc5fd('0x10')](_0xc5fd('0x11'),auth[_0xc5fd('0x8')](),controller[_0xc5fd('0x12')]);router[_0xc5fd('0x10')](_0xc5fd('0x13'),auth[_0xc5fd('0x8')](),interaction[_0xc5fd('0x14')](_0xc5fd('0x15'),_0xc5fd('0x16')),controller['addTags']);router[_0xc5fd('0x17')](_0xc5fd('0xc'),auth['isAuthenticated'](),interaction['tracked']('mail','mailinteraction:update'),controller[_0xc5fd('0x18')]);router[_0xc5fd('0x19')]('/:id',auth[_0xc5fd('0x8')](),interaction[_0xc5fd('0x14')](_0xc5fd('0x15'),_0xc5fd('0x1a')),controller['destroy']);router[_0xc5fd('0x19')]('/:id/tags',auth[_0xc5fd('0x8')](),controller['removeTags']);module[_0xc5fd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0e85249..8569410 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 _0x0a98=['out','ENUM','long','sequelize','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0xf354ba,_0x4b50e0){var _0x41486a=function(_0x1b03f0){while(--_0x1b03f0){_0xf354ba['push'](_0xf354ba['shift']());}};_0x41486a(++_0x4b50e0);}(_0x0a98,0xf6));var _0x80a9=function(_0x552580,_0x1116a8){_0x552580=_0x552580-0x0;var _0x26d419=_0x0a98[_0x552580];return _0x26d419;};'use strict';var Sequelize=require(_0x80a9('0x0'));var iconv=require('iconv');module[_0x80a9('0x1')]={'closed':{'type':Sequelize[_0x80a9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x80a9('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x80a9('0x4')]},'inReplyTo':{'type':Sequelize[_0x80a9('0x4')](0x1fe)},'to':{'type':Sequelize[_0x80a9('0x4')]},'cc':{'type':Sequelize[_0x80a9('0x5')]('long')},'subject':{'type':Sequelize[_0x80a9('0x5')]()},'attach':{'type':Sequelize[_0x80a9('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x80a9('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x80a9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x80a9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x80a9('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x80a9('0x8'))},'lastMsgText':{'type':Sequelize[_0x80a9('0x5')](_0x80a9('0x8'))}}; \ No newline at end of file +var _0x0e1e=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x3cdd83,_0x103dd3){var _0x331c7a=function(_0x166e71){while(--_0x166e71){_0x3cdd83['push'](_0x3cdd83['shift']());}};_0x331c7a(++_0x103dd3);}(_0x0e1e,0xb5));var _0xe0e1=function(_0x30ffe6,_0x16ce7f){_0x30ffe6=_0x30ffe6-0x0;var _0x488f2=_0x0e1e[_0x30ffe6];return _0x488f2;};'use strict';var Sequelize=require(_0xe0e1('0x0'));var iconv=require(_0xe0e1('0x1'));module[_0xe0e1('0x2')]={'closed':{'type':Sequelize[_0xe0e1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe0e1('0x4')]},'disposition':{'type':Sequelize[_0xe0e1('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe0e1('0x5')](0x1fe)},'to':{'type':Sequelize[_0xe0e1('0x5')]},'cc':{'type':Sequelize[_0xe0e1('0x6')](_0xe0e1('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xe0e1('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xe0e1('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xe0e1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe0e1('0x8')]('in',_0xe0e1('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe0e1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe0e1('0x8')]('in',_0xe0e1('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xe0e1('0x6')](_0xe0e1('0x7'))},'lastMsgText':{'type':Sequelize[_0xe0e1('0x6')](_0xe0e1('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 79ab1fa..6a63e55 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(_0x30bf9f,_0x3b93b7){var _0x4cca70=function(_0x6fdccd){while(--_0x6fdccd){_0x30bf9f['push'](_0x30bf9f['shift']());}};_0x4cca70(++_0x3b93b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x2c2229,_0x180a4f){var _0x4c7591=function(_0x2e4aa4){while(--_0x2e4aa4){_0x2c2229['push'](_0x2c2229['shift']());}};_0x4c7591(++_0x180a4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 cf13797..5bfb3b0 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 _0x1515=['exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x1515,0x121));var _0x5151=function(_0x57e70d,_0x3469c6){_0x57e70d=_0x57e70d-0x0;var _0x4dd4d3=_0x1515[_0x57e70d];return _0x4dd4d3;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x5151('0x0')];var MailMessage=require(_0x5151('0x1'))['db'][_0x5151('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5151('0x3')](0x0);var events={'afterCreate':_0x5151('0x4'),'afterUpdate':_0x5151('0x5'),'afterDestroy':_0x5151('0x6')};function emitEvent(_0x51bf80){return function(_0x32f331,_0x3d47be,_0x363fcd){_0x32f331[_0x5151('0x7')]({'attributes':['id'],'raw':!![]})[_0x5151('0x8')](function(_0x359ab3){_0x32f331['setDataValue']('Users',_0x359ab3['map'](function(_0x41cab3){return{'id':_0x41cab3['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x32f331['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5c6f01){_0x32f331[_0x5151('0x9')](_0x5151('0xa'),_0x5c6f01[_0x5151('0xb')]);MailInteractionEvents[_0x5151('0xc')](_0x51bf80+':'+_0x32f331['id'],_0x32f331);MailInteractionEvents[_0x5151('0xc')](_0x51bf80,_0x32f331);_0x363fcd(null);})['catch'](_0x363fcd(null));};}for(var e in events){if(events[_0x5151('0xd')](e)){var event=events[e];MailInteraction[_0x5151('0xe')](e,emitEvent(event));}}module[_0x5151('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xbf4d=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x4d7a8b,_0x6a1dac){var _0xd3b9f1=function(_0x1c1d73){while(--_0x1c1d73){_0x4d7a8b['push'](_0x4d7a8b['shift']());}};_0xd3b9f1(++_0x6a1dac);}(_0xbf4d,0x1ca));var _0xdbf4=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0xbf4d[_0x1fb9d2];return _0x4a8916;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xdbf4('0x0'))['db'][_0xdbf4('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xdbf4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdbf4('0x3')](0x0);var events={'afterCreate':_0xdbf4('0x4'),'afterUpdate':_0xdbf4('0x5'),'afterDestroy':_0xdbf4('0x6')};function emitEvent(_0x283228){return function(_0x49a5d7,_0x2141ba,_0x13c94f){_0x49a5d7[_0xdbf4('0x7')]({'attributes':['id'],'raw':!![]})[_0xdbf4('0x8')](function(_0x369391){_0x49a5d7[_0xdbf4('0x9')](_0xdbf4('0xa'),_0x369391[_0xdbf4('0xb')](function(_0x3cf84c){return{'id':_0x3cf84c['id']};}));return MailMessage[_0xdbf4('0xc')]({'where':{'MailInteractionId':_0x49a5d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x520dad){_0x49a5d7[_0xdbf4('0x9')](_0xdbf4('0xd'),_0x520dad[_0xdbf4('0xe')]);MailInteractionEvents[_0xdbf4('0xf')](_0x283228+':'+_0x49a5d7['id'],_0x49a5d7);MailInteractionEvents[_0xdbf4('0xf')](_0x283228,_0x49a5d7);_0x13c94f(null);})[_0xdbf4('0x10')](_0x13c94f(null));};}for(var e in events){if(events[_0xdbf4('0x11')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9b7db93..9a51150 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 _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x5c2390,_0x866e07){var _0xa4f374=function(_0x3b314f){while(--_0x3b314f){_0x5c2390['push'](_0x5c2390['shift']());}};_0xa4f374(++_0x866e07);}(_0x34e8,0x12c));var _0x834e=function(_0x12d0d5,_0x36f842){_0x12d0d5=_0x12d0d5-0x0;var _0x244365=_0x34e8[_0x12d0d5];return _0x244365;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file +var _0x9957=['api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','lodash','util','../../config/logger'];(function(_0x48fd50,_0x378887){var _0x4ff1a7=function(_0x8d2c09){while(--_0x8d2c09){_0x48fd50['push'](_0x48fd50['shift']());}};_0x4ff1a7(++_0x378887);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){if(_0xa2e5f0[_0x7995('0xe')]){_0xa2e5f0[_0x7995('0xf')]=moment()[_0x7995('0x10')](_0x7995('0x11'));}if(_0xa2e5f0['closed']){_0xa2e5f0[_0x7995('0x12')]=moment()[_0x7995('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c8a3(null,_0x3116fb);},'beforeUpdate':function(_0xb0c872,_0x2cb37a,_0x19a27e){if(_0xb0c872[_0x7995('0x13')](_0x7995('0xe'))){_0xb0c872[_0x7995('0xf')]=_0xb0c872[_0x7995('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xb0c872[_0x7995('0x13')](_0x7995('0x14'))){_0xb0c872[_0x7995('0x12')]=moment()[_0x7995('0x10')](_0x7995('0x11'));_0xb0c872[_0x7995('0xe')]=null;_0xb0c872[_0x7995('0xf')]=null;}_0x19a27e(null,_0xb0c872);},'afterUpdate':function(_0x41cbf0,_0x5377e5,_0x2eeacc){var _0x565d97=_0x137b6b[_0x7995('0x15')];var _0x37f297=_0x41cbf0[_0x7995('0x16')]({'plain':!![]});if(_0x37f297[_0x7995('0x14')]){return _0x565d97[_0x7995('0x17')][_0x7995('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37f297['id']}})['then'](function(){_0x2eeacc();})['catch'](function(_0x2536c8){_0x2eeacc(_0x2536c8);});}else{_0x2eeacc();}}},'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 ada02a3..8fe1a65 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 _0xdf0c=['message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','stringify','catch','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xb6d5cd,_0x100b73){var _0x11d4fa=function(_0x31979a){while(--_0x31979a){_0xb6d5cd['push'](_0xb6d5cd['shift']());}};_0x11d4fa(++_0x100b73);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x5ef296,_0x27c9d7){_0x5ef296=_0x5ef296-0x0;var _0x1bf8c0=_0xdf0c[_0x5ef296];return _0x1bf8c0;};'use strict';var _=require(_0xcdf0('0x0'));var util=require('util');var moment=require(_0xcdf0('0x1'));var BPromise=require(_0xcdf0('0x2'));var rs=require(_0xcdf0('0x3'));var fs=require('fs');var Redis=require(_0xcdf0('0x4'));var db=require(_0xcdf0('0x5'))['db'];var utils=require(_0xcdf0('0x6'));var logger=require(_0xcdf0('0x7'))('rpc');var config=require(_0xcdf0('0x8'));var jayson=require(_0xcdf0('0x9'));var client=jayson['client'][_0xcdf0('0xa')]({'port':0x232a});config[_0xcdf0('0xb')]=_[_0xcdf0('0xc')](config['redis'],{'host':_0xcdf0('0xd'),'port':0x18eb});var socket=require(_0xcdf0('0xe'))(new Redis(config[_0xcdf0('0xb')]));require(_0xcdf0('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a25b3,_0x1a6e6d,_0x2104c7){return new BPromise(function(_0x197d96,_0x5ef0af){return client[_0xcdf0('0x10')](_0x3a25b3,_0x2104c7)[_0xcdf0('0x11')](function(_0x289a5b){logger[_0xcdf0('0x12')](_0xcdf0('0x13'),_0x1a6e6d,'request\x20sent');logger[_0xcdf0('0x14')](_0xcdf0('0x15'),_0x1a6e6d,_0xcdf0('0x16'),JSON['stringify'](_0x289a5b));if(_0x289a5b[_0xcdf0('0x17')]){if(_0x289a5b['error']['code']===0x1f4){logger[_0xcdf0('0x17')](_0xcdf0('0x13'),_0x1a6e6d,_0x289a5b['error'][_0xcdf0('0x18')]);return _0x5ef0af(_0x289a5b[_0xcdf0('0x17')][_0xcdf0('0x18')]);}logger[_0xcdf0('0x17')](_0xcdf0('0x13'),_0x1a6e6d,_0x289a5b[_0xcdf0('0x17')][_0xcdf0('0x18')]);return _0x197d96(_0x289a5b[_0xcdf0('0x17')][_0xcdf0('0x18')]);}else{logger[_0xcdf0('0x12')](_0xcdf0('0x13'),_0x1a6e6d,_0xcdf0('0x16'));_0x197d96(_0x289a5b[_0xcdf0('0x19')][_0xcdf0('0x18')]);}})['catch'](function(_0x38cd9d){logger[_0xcdf0('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1a6e6d,_0x38cd9d);_0x5ef0af(_0x38cd9d);});});}exports[_0xcdf0('0x1a')]=function(_0x62de68){var _0x1251f4=this;return new Promise(function(_0x240216,_0xcf6826){return db[_0xcdf0('0x1b')][_0xcdf0('0x1c')](_0x62de68[_0xcdf0('0x1d')],{'raw':_0x62de68['options']?_0x62de68[_0xcdf0('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62de68['options']?_0x62de68[_0xcdf0('0x1e')][_0xcdf0('0x1f')]||null:null,'attributes':_0x62de68[_0xcdf0('0x1e')]?_0x62de68['options'][_0xcdf0('0x20')]||null:null,'limit':_0x62de68[_0xcdf0('0x1e')]?_0x62de68[_0xcdf0('0x1e')][_0xcdf0('0x21')]||null:null})[_0xcdf0('0x11')](function(_0x2eb11a){logger[_0xcdf0('0x12')](_0xcdf0('0x1a'),_0x62de68);logger['debug'](_0xcdf0('0x1a'),_0x62de68,JSON[_0xcdf0('0x22')](_0x2eb11a));_0x240216(_0x2eb11a);})[_0xcdf0('0x23')](function(_0x479db5){logger[_0xcdf0('0x17')]('UpdateMailInteraction',_0x479db5[_0xcdf0('0x18')],_0x62de68);_0xcf6826(_0x1251f4[_0xcdf0('0x17')](0x1f4,_0x479db5['message']));});});};exports[_0xcdf0('0x24')]=function(_0x549ee3){return new Promise(function(_0x2f10f7,_0x466432){return db[_0xcdf0('0x1b')][_0xcdf0('0x25')]({'where':_0x549ee3[_0xcdf0('0x1e')]?_0x549ee3[_0xcdf0('0x1e')][_0xcdf0('0x1f')]||null:null})[_0xcdf0('0x11')](function(_0x79c63c){if(_0x79c63c){return _0x79c63c['addTags'](_0x549ee3['body'][_0xcdf0('0x26')],_['omit'](_0x549ee3[_0xcdf0('0x1d')],['ids','id'])||{});}})[_0xcdf0('0x27')](function(_0x527354){logger[_0xcdf0('0x12')](_0xcdf0('0x28'),_0x549ee3);logger[_0xcdf0('0x14')](_0xcdf0('0x28'),_0x549ee3,JSON[_0xcdf0('0x22')](_0x527354));_0x2f10f7(_0x527354);})[_0xcdf0('0x23')](function(_0x34d427){logger['error'](_0xcdf0('0x28'),_0x34d427[_0xcdf0('0x18')],_0x549ee3);_0x466432(_this[_0xcdf0('0x17')](0x1f4,_0x34d427[_0xcdf0('0x18')]));});});}; \ No newline at end of file +var _0x81a5=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','body','options','where','debug','catch','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x467eee,_0x416c33){var _0x553ebe=function(_0x387103){while(--_0x387103){_0x467eee['push'](_0x467eee['shift']());}};_0x553ebe(++_0x416c33);}(_0x81a5,0x1c8));var _0x581a=function(_0x57179d,_0x131e79){_0x57179d=_0x57179d-0x0;var _0x3a0b21=_0x81a5[_0x57179d];return _0x3a0b21;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var moment=require(_0x581a('0x2'));var BPromise=require(_0x581a('0x3'));var rs=require(_0x581a('0x4'));var fs=require('fs');var Redis=require(_0x581a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x581a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x581a('0x7')]['http']({'port':0x232a});config[_0x581a('0x8')]=_[_0x581a('0x9')](config[_0x581a('0x8')],{'host':_0x581a('0xa'),'port':0x18eb});var socket=require(_0x581a('0xb'))(new Redis(config[_0x581a('0x8')]));require(_0x581a('0xc'))[_0x581a('0xd')](socket);function respondWithRpcPromise(_0x524948,_0x1c9869,_0x493493){return new BPromise(function(_0x1541f1,_0x8e2264){return client[_0x581a('0xe')](_0x524948,_0x493493)[_0x581a('0xf')](function(_0x538d9b){logger[_0x581a('0x10')]('MailInteraction,\x20%s,\x20%s',_0x1c9869,'request\x20sent');logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1c9869,_0x581a('0x11'),JSON[_0x581a('0x12')](_0x538d9b));if(_0x538d9b['error']){if(_0x538d9b[_0x581a('0x13')][_0x581a('0x14')]===0x1f4){logger[_0x581a('0x13')](_0x581a('0x15'),_0x1c9869,_0x538d9b[_0x581a('0x13')][_0x581a('0x16')]);return _0x8e2264(_0x538d9b[_0x581a('0x13')][_0x581a('0x16')]);}logger['error'](_0x581a('0x15'),_0x1c9869,_0x538d9b[_0x581a('0x13')]['message']);return _0x1541f1(_0x538d9b[_0x581a('0x13')][_0x581a('0x16')]);}else{logger[_0x581a('0x10')](_0x581a('0x15'),_0x1c9869,'request\x20sent');_0x1541f1(_0x538d9b[_0x581a('0x17')][_0x581a('0x16')]);}})['catch'](function(_0x4bdc1a){logger[_0x581a('0x13')](_0x581a('0x15'),_0x1c9869,_0x4bdc1a);_0x8e2264(_0x4bdc1a);});});}exports[_0x581a('0x18')]=function(_0x28036f){var _0xeef3d7=this;return new Promise(function(_0x2ad551,_0x19e468){return db[_0x581a('0x19')]['update'](_0x28036f[_0x581a('0x1a')],{'raw':_0x28036f[_0x581a('0x1b')]?_0x28036f[_0x581a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28036f['options']?_0x28036f[_0x581a('0x1b')][_0x581a('0x1c')]||null:null,'attributes':_0x28036f[_0x581a('0x1b')]?_0x28036f[_0x581a('0x1b')]['attributes']||null:null,'limit':_0x28036f[_0x581a('0x1b')]?_0x28036f[_0x581a('0x1b')]['limit']||null:null})[_0x581a('0xf')](function(_0x3ce207){logger[_0x581a('0x10')](_0x581a('0x18'),_0x28036f);logger[_0x581a('0x1d')]('UpdateMailInteraction',_0x28036f,JSON['stringify'](_0x3ce207));_0x2ad551(_0x3ce207);})[_0x581a('0x1e')](function(_0x56262f){logger['error'](_0x581a('0x18'),_0x56262f[_0x581a('0x16')],_0x28036f);_0x19e468(_0xeef3d7[_0x581a('0x13')](0x1f4,_0x56262f['message']));});});};exports[_0x581a('0x1f')]=function(_0x4839c3){return new Promise(function(_0x111ec2,_0x2136fb){return db['MailInteraction'][_0x581a('0x20')]({'where':_0x4839c3[_0x581a('0x1b')]?_0x4839c3[_0x581a('0x1b')][_0x581a('0x1c')]||null:null})[_0x581a('0xf')](function(_0x25ee76){if(_0x25ee76){return _0x25ee76[_0x581a('0x21')](_0x4839c3[_0x581a('0x1a')][_0x581a('0x22')],_[_0x581a('0x23')](_0x4839c3['body'],[_0x581a('0x22'),'id'])||{});}})[_0x581a('0x24')](function(_0x51763c){logger[_0x581a('0x10')](_0x581a('0x25'),_0x4839c3);logger['debug'](_0x581a('0x25'),_0x4839c3,JSON[_0x581a('0x12')](_0x51763c));_0x111ec2(_0x51763c);})[_0x581a('0x1e')](function(_0x21dabb){logger[_0x581a('0x13')](_0x581a('0x25'),_0x21dabb[_0x581a('0x16')],_0x4839c3);_0x2136fb(_this[_0x581a('0x13')](0x1f4,_0x21dabb[_0x581a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 08ce37a..36b15f3 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 _0x3ebc=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x4a9ae5,_0x2490d2){var _0x1ae6fa=function(_0x5c6a4c){while(--_0x5c6a4c){_0x4a9ae5['push'](_0x4a9ae5['shift']());}};_0x1ae6fa(++_0x2490d2);}(_0x3ebc,0x10d));var _0xc3eb=function(_0x3d5140,_0x356e6a){_0x3d5140=_0x3d5140-0x0;var _0x2e2d9e=_0x3ebc[_0x3d5140];return _0x2e2d9e;};'use strict';var MailInteractionEvents=require(_0xc3eb('0x0'));var events=[_0xc3eb('0x1'),_0xc3eb('0x2'),_0xc3eb('0x3')];function createListener(_0x44cfb6,_0x42d420){return function(_0x2f6e1e){_0x42d420[_0xc3eb('0x4')](_0x44cfb6,_0x2f6e1e);};}function removeListener(_0x5d5cb7,_0x51f448){return function(){MailInteractionEvents[_0xc3eb('0x5')](_0x5d5cb7,_0x51f448);};}exports[_0xc3eb('0x6')]=function(_0x4a0907){for(var _0x2c6a2e=0x0,_0x4377cc=events[_0xc3eb('0x7')];_0x2c6a2e<_0x4377cc;_0x2c6a2e++){var _0x2925c1=events[_0x2c6a2e];var _0x3657af=createListener(_0xc3eb('0x8')+_0x2925c1,_0x4a0907);MailInteractionEvents['on'](_0x2925c1,_0x3657af);}}; \ No newline at end of file +var _0x5023=['remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0xd88549,_0x23b388){var _0x35c1e1=function(_0x5c8389){while(--_0x5c8389){_0xd88549['push'](_0xd88549['shift']());}};_0x35c1e1(++_0x23b388);}(_0x5023,0x6a));var _0x3502=function(_0x410da0,_0x2138e5){_0x410da0=_0x410da0-0x0;var _0x3b9106=_0x5023[_0x410da0];return _0x3b9106;};'use strict';var MailInteractionEvents=require(_0x3502('0x0'));var events=[_0x3502('0x1'),_0x3502('0x2'),_0x3502('0x3')];function createListener(_0x1773b6,_0x390464){return function(_0x45ddaa){_0x390464[_0x3502('0x4')](_0x1773b6,_0x45ddaa);};}function removeListener(_0x50a739,_0x325aa0){return function(){MailInteractionEvents[_0x3502('0x5')](_0x50a739,_0x325aa0);};}exports[_0x3502('0x6')]=function(_0x46ece2){for(var _0x5f2481=0x0,_0x5c0c82=events[_0x3502('0x7')];_0x5f2481<_0x5c0c82;_0x5f2481++){var _0x5a5897=events[_0x5f2481];var _0x1d0c53=createListener(_0x3502('0x8')+_0x5a5897,_0x46ece2);MailInteractionEvents['on'](_0x5a5897,_0x1d0c53);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 0a58901..6f1e423 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3b06f1,_0x48e9c0){var _0x329e2e=function(_0x17b243){while(--_0x17b243){_0x3b06f1['push'](_0x3b06f1['shift']());}};_0x329e2e(++_0x48e9c0);}(_0x84ab,0x12f));var _0xb84a=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x84ab[_0x23ec06];return _0x2831d4;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/describe',auth[_0xb84a('0x9')](),controller['describe']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb84a('0xe'),_0xb84a('0xf')),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0x12')]);router[_0xb84a('0x11')](_0xb84a('0x13'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x11')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller['destroy']);module[_0xb84a('0x18')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x33c65a,_0x2fa474){var _0x55b76e=function(_0x5e23f7){while(--_0x5e23f7){_0x33c65a['push'](_0x33c65a['shift']());}};_0x55b76e(++_0x2fa474);}(_0x3e74,0x175));var _0x43e7=function(_0x1183c9,_0x3d9fd9){_0x1183c9=_0x1183c9-0x0;var _0x527956=_0x3e74[_0x1183c9];return _0x527956;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3fb6c4e..db86733 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 _0x39d2=['STRING','DATE','INTEGER','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39d2,0xf5));var _0x239d=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x39d2[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0x239d('0x0'));var _=require('lodash');module[_0x239d('0x1')]={'body':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x4'))},'read':{'type':Sequelize[_0x239d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x239d('0x6')]('in',_0x239d('0x7')),'defaultValue':_0x239d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x239d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x239d('0x8')]},'to':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x239d('0x3'))},'bcc':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))},'subject':{'type':Sequelize[_0x239d('0x2')]},'sentAt':{'type':Sequelize[_0x239d('0x9')]},'attach':{'type':Sequelize[_0x239d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x239d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x239d('0x9')]},'originTo':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))},'originCc':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))}}; \ No newline at end of file +var _0x7753=['INTEGER','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7753,0xfd));var _0x3775=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x7753[_0x5216e0];return _0x5b3f40;};'use strict';var Sequelize=require(_0x3775('0x0'));var _=require(_0x3775('0x1'));module[_0x3775('0x2')]={'body':{'type':Sequelize[_0x3775('0x3')](_0x3775('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x3775('0x5'))},'read':{'type':Sequelize[_0x3775('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3775('0x7')]('in','out'),'defaultValue':_0x3775('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3775('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3775('0x3')](_0x3775('0x4'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x3775('0x3')](_0x3775('0x4'))},'subject':{'type':Sequelize[_0x3775('0x3')]},'sentAt':{'type':Sequelize[_0x3775('0xa')]},'attach':{'type':Sequelize[_0x3775('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3775('0xa')]},'originTo':{'type':Sequelize[_0x3775('0x3')](_0x3775('0x4'))},'originCc':{'type':Sequelize[_0x3775('0x3')](_0x3775('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 099553f..eb669d4 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 _0x8da5=['type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','filters','MailMessage','find','body','describe','create','direction','secret','split','MailAccount','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','isNil','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail','read','readAt','UserId','Contact','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','manual','format','channel','accept','acceptmessage','reject','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','SIP/%s','event','EventManager','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','log','err','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','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','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','json','save','update','destroy','end','stack','name','send','index','map','fieldName'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8da5,0x71));var _0x58da=function(_0x1cd9a1,_0x5f3f7c){_0x1cd9a1=_0x1cd9a1-0x0;var _0x1709fd=_0x8da5[_0x1cd9a1];return _0x1709fd;};'use strict';var pdf=require(_0x58da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x58da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58da('0x2'));var rp=require(_0x58da('0x3'));var moment=require(_0x58da('0x4'));var BPromise=require(_0x58da('0x5'));var Mustache=require(_0x58da('0x6'));var util=require(_0x58da('0x7'));var path=require('path');var sox=require(_0x58da('0x8'));var csv=require(_0x58da('0x9'));var ejs=require(_0x58da('0xa'));var fs=require('fs');var _=require(_0x58da('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58da('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x58da('0xd'));var authService=require(_0x58da('0xe'));var qs=require(_0x58da('0xf'));var as=require(_0x58da('0x10'));var hardwareService=require(_0x58da('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x58da('0x12'));var config=require(_0x58da('0x13'));var db=require(_0x58da('0x14'))['db'];config[_0x58da('0x15')]=_[_0x58da('0x16')](config[_0x58da('0x15')],{'host':_0x58da('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58da('0x15')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x58da('0x18'));var client=jayson[_0x58da('0x19')][_0x58da('0x1a')]({'port':0x232c});var client9003=jayson['client'][_0x58da('0x1a')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x320c08,_0x255e14,_0x193b15){if(_0x193b15){var _0x1bbb5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bbb5d[_0x58da('0x1b')](_0x255e14)){return _0x320c08;}else{throw new db['Sequelize']['ValidationError'](_0x58da('0x1c'));}}else{return _0x320c08;}}function respondWithRpcPromise(_0x467e4b,_0x37e59d,_0x52325c,_0x2113da){return new BPromise(function(_0x279942,_0x15fe05){var _0x1eccab=_0x2113da||client;return _0x1eccab[_0x58da('0x1d')](_0x467e4b,_0x52325c)[_0x58da('0x1e')](function(_0x2ff98c){logger[_0x58da('0x1f')](_0x58da('0x20'),_0x37e59d,_0x58da('0x21'));logger[_0x58da('0x22')](_0x58da('0x23'),_0x37e59d,'request\x20sent',JSON[_0x58da('0x24')](_0x2ff98c));if(_0x2ff98c['error']){if(_0x2ff98c[_0x58da('0x25')][_0x58da('0x26')]===0x1f4){logger[_0x58da('0x25')]('MailMessage,\x20%s,\x20%s',_0x37e59d,_0x2ff98c[_0x58da('0x25')][_0x58da('0x27')]);return _0x15fe05(_0x2ff98c[_0x58da('0x25')][_0x58da('0x27')]);}logger[_0x58da('0x25')](_0x58da('0x20'),_0x37e59d,_0x2ff98c[_0x58da('0x25')][_0x58da('0x27')]);return _0x279942(_0x2ff98c['error'][_0x58da('0x27')]);}else{logger[_0x58da('0x1f')](_0x58da('0x20'),_0x37e59d,_0x58da('0x21'));_0x279942(_0x2ff98c[_0x58da('0x28')][_0x58da('0x27')]);}})[_0x58da('0x29')](function(_0x1ce529){logger[_0x58da('0x25')](_0x58da('0x20'),_0x37e59d,_0x1ce529);_0x15fe05(_0x1ce529);});});}function respondWithStatusCode(_0x22d260,_0x1e5f9e){_0x1e5f9e=_0x1e5f9e||0xcc;return function(_0x579da5){if(_0x579da5){return _0x22d260[_0x58da('0x2a')](_0x1e5f9e);}return _0x22d260[_0x58da('0x2b')](_0x1e5f9e)['end']();};}function respondWithResult(_0x34860c,_0x4da555){_0x4da555=_0x4da555||0xc8;return function(_0x48108c){if(_0x48108c){return _0x34860c['status'](_0x4da555)['json'](_0x48108c);}};}function respondWithFilteredResult(_0xa07fc1,_0x39b2d4){return function(_0x314b09){if(_0x314b09){var _0x280c89=_0x314b09[_0x58da('0x2c')],_0x407300=_0x39b2d4[_0x58da('0x2d')],_0x1099ec=_0x39b2d4['offset']+_0x39b2d4['limit'],_0x4dbd0b;if(_0x1099ec>=_0x280c89){_0x1099ec=_0x280c89;_0x4dbd0b=0xc8;}else{_0x4dbd0b=0xce;}_0xa07fc1['status'](_0x4dbd0b);return _0xa07fc1[_0x58da('0x2e')]('Content-Range',_0x407300+'-'+_0x1099ec+'/'+_0x280c89)[_0x58da('0x2f')](_0x314b09);}return null;};}function patchUpdates(_0x71fabb){return function(_0x93cb53){try{jsonpatch['apply'](_0x93cb53,_0x71fabb,!![]);}catch(_0x2498b4){return BPromise['reject'](_0x2498b4);}return _0x93cb53[_0x58da('0x30')]();};}function saveUpdates(_0x384f64,_0x18a433){return function(_0x3c90a1){if(_0x3c90a1){return _0x3c90a1[_0x58da('0x31')](_0x384f64)[_0x58da('0x1e')](function(_0x2052df){return _0x2052df;});}return null;};}function removeEntity(_0xf9e4eb,_0x3b3486){return function(_0x727d62){if(_0x727d62){return _0x727d62[_0x58da('0x32')]()[_0x58da('0x1e')](function(){_0xf9e4eb['status'](0xcc)[_0x58da('0x33')]();});}};}function handleEntityNotFound(_0x19745e,_0x21b8d7){return function(_0xb0e37f){if(!_0xb0e37f){_0x19745e[_0x58da('0x2a')](0x194);}return _0xb0e37f;};}function handleError(_0x534096,_0x4e545a){_0x4e545a=_0x4e545a||0x1f4;return function(_0x42acd3){logger[_0x58da('0x25')](_0x42acd3[_0x58da('0x34')]);if(_0x42acd3[_0x58da('0x35')]){delete _0x42acd3['name'];}_0x534096[_0x58da('0x2b')](_0x4e545a)[_0x58da('0x36')](_0x42acd3);};}exports[_0x58da('0x37')]=function(_0x29d699,_0x1759fd){var _0x1a5289={},_0x1b4502={},_0x293ce9={'count':0x0,'rows':[]};var _0x443c12=_[_0x58da('0x38')](db['MailMessage']['rawAttributes'],function(_0x424efa){return{'name':_0x424efa[_0x58da('0x39')],'type':_0x424efa[_0x58da('0x3a')][_0x58da('0x3b')]};});_0x1b4502[_0x58da('0x3c')]=_[_0x58da('0x38')](_0x443c12,_0x58da('0x35'));_0x1b4502[_0x58da('0x3d')]=_[_0x58da('0x3e')](_0x29d699['query']);_0x1b4502['filters']=_[_0x58da('0x3f')](_0x1b4502[_0x58da('0x3c')],_0x1b4502[_0x58da('0x3d')]);_0x1a5289['attributes']=_['intersection'](_0x1b4502[_0x58da('0x3c')],qs['fields'](_0x29d699[_0x58da('0x3d')][_0x58da('0x40')]));_0x1a5289[_0x58da('0x41')]=_0x1a5289[_0x58da('0x41')][_0x58da('0x42')]?_0x1a5289[_0x58da('0x41')]:_0x1b4502[_0x58da('0x3c')];if(!_0x29d699[_0x58da('0x3d')]['hasOwnProperty'](_0x58da('0x43'))){_0x1a5289['limit']=qs[_0x58da('0x44')](_0x29d699[_0x58da('0x3d')]['limit']);_0x1a5289[_0x58da('0x2d')]=qs['offset'](_0x29d699[_0x58da('0x3d')]['offset']);}_0x1a5289['order']=qs[_0x58da('0x45')](_0x29d699['query'][_0x58da('0x45')]);_0x1a5289[_0x58da('0x46')]=qs['filters'](_[_0x58da('0x47')](_0x29d699['query'],_0x1b4502['filters']),_0x443c12);if(_0x29d699['query'][_0x58da('0x48')]){_0x1a5289[_0x58da('0x46')]=_['merge'](_0x1a5289[_0x58da('0x46')],{'$or':_[_0x58da('0x38')](_0x443c12,function(_0x153ebb){if(_0x153ebb[_0x58da('0x3a')]!==_0x58da('0x49')){var _0x36504b={};_0x36504b[_0x153ebb[_0x58da('0x35')]]={'$like':'%'+_0x29d699[_0x58da('0x3d')][_0x58da('0x48')]+'%'};return _0x36504b;}})});}_0x1a5289=_[_0x58da('0x4a')]({},_0x1a5289,_0x29d699[_0x58da('0x4b')]);var _0x3cfed5={'where':_0x1a5289[_0x58da('0x46')]};return db['MailMessage'][_0x58da('0x2c')](_0x3cfed5)['then'](function(_0x3fdfd7){_0x293ce9[_0x58da('0x2c')]=_0x3fdfd7;if(_0x29d699[_0x58da('0x3d')][_0x58da('0x4c')]){_0x1a5289[_0x58da('0x4d')]=[{'all':!![]}];}return db['MailMessage'][_0x58da('0x4e')](_0x1a5289);})['then'](function(_0x5cfd89){_0x293ce9[_0x58da('0x4f')]=_0x5cfd89;return _0x293ce9;})['then'](respondWithFilteredResult(_0x1759fd,_0x1a5289))[_0x58da('0x29')](handleError(_0x1759fd,null));};exports[_0x58da('0x50')]=function(_0x284330,_0x558498){var _0x332f1c={'raw':!![],'where':{'id':_0x284330[_0x58da('0x51')]['id']}},_0x139fbe={};_0x139fbe[_0x58da('0x3c')]=_[_0x58da('0x3e')](db['MailMessage'][_0x58da('0x52')]);_0x139fbe['query']=_[_0x58da('0x3e')](_0x284330[_0x58da('0x3d')]);_0x139fbe[_0x58da('0x53')]=_[_0x58da('0x3f')](_0x139fbe['model'],_0x139fbe[_0x58da('0x3d')]);_0x332f1c[_0x58da('0x41')]=_[_0x58da('0x3f')](_0x139fbe[_0x58da('0x3c')],qs[_0x58da('0x40')](_0x284330[_0x58da('0x3d')][_0x58da('0x40')]));_0x332f1c[_0x58da('0x41')]=_0x332f1c[_0x58da('0x41')][_0x58da('0x42')]?_0x332f1c[_0x58da('0x41')]:_0x139fbe[_0x58da('0x3c')];if(_0x284330[_0x58da('0x3d')][_0x58da('0x4c')]){_0x332f1c[_0x58da('0x4d')]=[{'all':!![]}];}_0x332f1c=_[_0x58da('0x4a')]({},_0x332f1c,_0x284330['options']);return db[_0x58da('0x54')][_0x58da('0x55')](_0x332f1c)['then'](handleEntityNotFound(_0x558498,null))[_0x58da('0x1e')](respondWithResult(_0x558498,null))[_0x58da('0x29')](handleError(_0x558498,null));};exports[_0x58da('0x31')]=function(_0x4c7ce4,_0x278150){if(_0x4c7ce4[_0x58da('0x56')]['id']){delete _0x4c7ce4[_0x58da('0x56')]['id'];}return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x4c7ce4[_0x58da('0x51')]['id']}})[_0x58da('0x1e')](handleEntityNotFound(_0x278150,null))[_0x58da('0x1e')](saveUpdates(_0x4c7ce4['body'],null))['then'](respondWithResult(_0x278150,null))[_0x58da('0x29')](handleError(_0x278150,null));};exports[_0x58da('0x32')]=function(_0x4993d7,_0x206e23){return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x4993d7['params']['id']}})[_0x58da('0x1e')](handleEntityNotFound(_0x206e23,null))[_0x58da('0x1e')](removeEntity(_0x206e23,null))[_0x58da('0x29')](handleError(_0x206e23,null));};exports[_0x58da('0x57')]=function(_0x2a3923,_0x17f983){return db[_0x58da('0x54')][_0x58da('0x57')]()[_0x58da('0x1e')](respondWithResult(_0x17f983,null))[_0x58da('0x29')](handleError(_0x17f983,null));};exports[_0x58da('0x58')]=function(_0x4e52b9,_0xa4b09d){return db[_0x58da('0x54')]['create'](_0x4e52b9['body'])[_0x58da('0x1e')](function(_0x53932d){if(_0x53932d){if(_0x53932d[_0x58da('0x59')]==='out'&&!_0x53932d[_0x58da('0x5a')]){var _0x497a30,_0x4da984,_0x21f1f1;if(_0x4e52b9['body']['to']){_0x4da984=_0x4e52b9[_0x58da('0x56')]['to'][_0x58da('0x5b')](',')[0x0];}return db[_0x58da('0x5c')]['findOne']({'where':{'id':_0x53932d['MailAccountId']},'include':[{'model':db[_0x58da('0x5d')],'as':_0x58da('0x5e'),'include':[{'model':db[_0x58da('0x5f')],'as':_0x58da('0x60'),'where':{'email':_0x4da984},'limit':0x1,'order':[[_0x58da('0x61'),'DESC']]}]},{'model':db[_0x58da('0x62')],'as':'Smtp','raw':!![]}]})[_0x58da('0x1e')](function(_0x2cc21f){_0x497a30=_0x2cc21f;if(_0x497a30&&_0x497a30['Smtp']){var _0x276f29={'tls':{'rejectUnauthorized':![]}};if(_[_0x58da('0x63')](_0x497a30[_0x58da('0x64')][_0x58da('0x65')])){_0x276f29['host']=_0x497a30['Smtp'][_0x58da('0x66')];_0x276f29[_0x58da('0x67')]=_0x497a30[_0x58da('0x64')][_0x58da('0x67')];_0x276f29[_0x58da('0x68')]=_0x497a30['Smtp']['secure'];if(_0x497a30[_0x58da('0x64')][_0x58da('0x69')]){_0x276f29[_0x58da('0x6a')]={'user':_0x497a30['Smtp'][_0x58da('0x6b')],'pass':_0x497a30[_0x58da('0x64')]['pass']};}}else{_0x276f29[_0x58da('0x65')]=_0x497a30['Smtp'][_0x58da('0x65')];_0x276f29[_0x58da('0x6a')]={'user':_0x497a30[_0x58da('0x64')]['user'],'pass':_0x497a30[_0x58da('0x64')][_0x58da('0x6c')]};_0x276f29[_0x58da('0x68')]=_0x497a30['Smtp'][_0x58da('0x68')];}if(_0x4e52b9[_0x58da('0x56')][_0x58da('0x6d')]&&_0x4e52b9[_0x58da('0x56')]['attachments'][_0x58da('0x42')]){for(var _0x591cb2=0x0;_0x591cb2<_0x4e52b9['body'][_0x58da('0x6d')][_0x58da('0x42')];_0x591cb2+=0x1){_0x4e52b9[_0x58da('0x56')][_0x58da('0x6d')][_0x591cb2]={'filename':_0x4e52b9['body'][_0x58da('0x6d')][_0x591cb2][_0x58da('0x35')],'path':path[_0x58da('0x6e')](config[_0x58da('0x6f')],_0x58da('0x70'),_0x4e52b9['body'][_0x58da('0x6d')][_0x591cb2][_0x58da('0x71')])};}}_0x21f1f1={'account':_0x276f29,'message':_0x4e52b9['body']};return;}})[_0x58da('0x1e')](function(){if(_0x497a30[_0x58da('0x5e')]){if(_0x497a30['List'][_0x58da('0x60')][_0x58da('0x42')]){return _0x497a30['List']['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x58da('0x16')](_0x4e52b9['body'],{'firstName':_0x4e52b9[_0x58da('0x56')]['to'],'email':_0x4e52b9[_0x58da('0x56')]['to'],'phone':_0x4e52b9[_0x58da('0x56')]['to'],'ListId':_0x497a30[_0x58da('0x72')]}));}}else{throw new Error(_0x58da('0x73'));}})[_0x58da('0x1e')](function(){if(_0x21f1f1){return respondWithRpcPromise(_0x58da('0x74'),_0x58da('0x75'),_0x21f1f1,client9003)[_0x58da('0x1e')](function(_0xcf53f7){return _0x53932d[_0x58da('0x31')]({'read':!![],'messageId':_0xcf53f7[_0x58da('0x76')],'sentAt':moment()['format'](_0x58da('0x77'))});})[_0x58da('0x29')](function(_0x6c6f8){logger[_0x58da('0x25')]('%s',JSON['stringify'](_0x6c6f8));return _0x53932d;});}return _0x53932d;});}return _0x53932d;}})['then'](respondWithResult(_0xa4b09d,0xc9))['catch'](handleError(_0xa4b09d,null));};var interaction_log=require(_0x58da('0x78'))('mail-interactions');exports['accept']=function(_0x11a9bd,_0x4e9f68,_0x1d1942){var _0x42be11={'channel':_0x58da('0x79')};if(_0x11a9bd[_0x58da('0x56')]['id']){delete _0x11a9bd[_0x58da('0x56')]['id'];}_0x11a9bd[_0x58da('0x56')][_0x58da('0x7a')]=!![];_0x11a9bd[_0x58da('0x56')][_0x58da('0x7b')]=moment()['format'](_0x58da('0x77'));_0x11a9bd[_0x58da('0x56')]['UserId']=_0x11a9bd[_0x58da('0x56')][_0x58da('0x7c')]||_0x11a9bd[_0x58da('0x6b')]['id'];return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x11a9bd['params']['id'],'UserId':null},'include':[{'model':db[_0x58da('0x5f')],'as':_0x58da('0x7d')}]})[_0x58da('0x1e')](handleEntityNotFound(_0x4e9f68,null))[_0x58da('0x1e')](saveUpdates(_0x11a9bd['body'],null))[_0x58da('0x1e')](function(_0x2d84f7){if(_0x2d84f7){_0x42be11[_0x58da('0x27')]=_0x2d84f7[_0x58da('0x7e')]({'plain':!![]});return db['MailInteraction'][_0x58da('0x55')]({'where':{'id':_0x2d84f7[_0x58da('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x4e9f68,null))[_0x58da('0x1e')](function(_0x5c8ca9){if(_0x5c8ca9){return _0x5c8ca9[_0x58da('0x31')]({'UserId':_0x11a9bd[_0x58da('0x56')]['UserId'],'read1stAt':_[_0x58da('0x63')](_0x5c8ca9[_0x58da('0x80')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x58da('0x1e')](function(_0x4a4ee4){if(_0x4a4ee4){_0x42be11[_0x58da('0x81')]=_0x4a4ee4['get']({'plain':!![]});interaction_log['info'](_0x58da('0x82'),_0x11a9bd[_0x58da('0x6b')]['id'],_0x11a9bd[_0x58da('0x6b')]['name'],_0x11a9bd[_0x58da('0x6b')][_0x58da('0x83')],_0x42be11[_0x58da('0x81')]['id'],_0x11a9bd['body']?JSON['stringify'](_0x11a9bd['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x58da('0x84'),_0x42be11);}return null;})[_0x58da('0x1e')](function(_0x5edcff){if(_0x5edcff){if(_0x11a9bd[_0x58da('0x56')][_0x58da('0x85')]){_0x42be11['message']['interface']=util[_0x58da('0x86')]('SIP/%s',_0x11a9bd['user']['name']);_0x42be11[_0x58da('0x27')][_0x58da('0x87')]=_0x42be11[_0x58da('0x87')];_0x42be11[_0x58da('0x27')]['event']=_0x58da('0x88');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x58da('0x89'),'message':_0x42be11[_0x58da('0x27')]},client9002)[_0x58da('0x1e')](function(){return _0x42be11;});}return _0x42be11;}return null;})[_0x58da('0x1e')](respondWithResult(_0x4e9f68,null))[_0x58da('0x29')](handleError(_0x4e9f68,null));};var interaction_log=require(_0x58da('0x78'))('mail-interactions');exports[_0x58da('0x8a')]=function(_0x321d9e,_0x6df6a1,_0x2a780c){var _0x3308e8={'agent':{},'channel':_0x58da('0x79')};if(_0x321d9e['body']['id']){delete _0x321d9e['body']['id'];}_0x321d9e[_0x58da('0x56')][_0x58da('0x7c')]=_0x321d9e[_0x58da('0x56')][_0x58da('0x7c')]||_0x321d9e[_0x58da('0x6b')]['id'];_0x3308e8[_0x58da('0x8b')]['id']=_0x321d9e[_0x58da('0x56')][_0x58da('0x7c')];return db['MailMessage'][_0x58da('0x55')]({'where':{'id':_0x321d9e['params']['id'],'UserId':null}})[_0x58da('0x1e')](handleEntityNotFound(_0x6df6a1,null))[_0x58da('0x1e')](function(_0x4be281){if(_0x4be281){_0x3308e8['message']=_0x4be281[_0x58da('0x7e')]({'plain':!![]});return db[_0x58da('0x8c')][_0x58da('0x55')]({'where':{'id':_0x4be281[_0x58da('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x6df6a1,null))[_0x58da('0x1e')](function(_0x1dc0f1){if(_0x1dc0f1){_0x3308e8['interaction']=_0x1dc0f1[_0x58da('0x7e')]({'plain':!![]});interaction_log[_0x58da('0x1f')](_0x58da('0x8d'),_0x321d9e[_0x58da('0x6b')]['id'],_0x321d9e[_0x58da('0x6b')][_0x58da('0x35')],_0x321d9e['user'][_0x58da('0x83')],_0x3308e8[_0x58da('0x81')]['id'],_0x321d9e[_0x58da('0x56')]?JSON[_0x58da('0x24')](_0x321d9e[_0x58da('0x56')]):_0x58da('0x8e'));return respondWithRpcPromise(_0x58da('0x8f'),_0x58da('0x90'),_0x3308e8);}return null;})['then'](function(_0x196f5a){if(_0x196f5a){_0x196f5a[_0x58da('0x27')][_0x58da('0x91')]=util['format'](_0x58da('0x92'),_0x321d9e['user'][_0x58da('0x35')]);_0x196f5a[_0x58da('0x27')][_0x58da('0x87')]=_0x3308e8[_0x58da('0x87')];_0x196f5a[_0x58da('0x27')][_0x58da('0x93')]=_0x58da('0x8a');respondWithRpcPromise(_0x58da('0x94'),_0x58da('0x94'),{'event':_0x58da('0x95'),'message':_0x196f5a[_0x58da('0x27')]},client9002);return _0x3308e8;}return null;})[_0x58da('0x1e')](respondWithResult(_0x6df6a1,null))[_0x58da('0x29')](handleError(_0x6df6a1,null));};exports[_0x58da('0x96')]=function(_0x587a66,_0x10e0c8){var _0x3c60f0=moment()[_0x58da('0x97')]()[_0x58da('0x98')]();var _0x1a1334=path['join'](config[_0x58da('0x6f')],'server','files','tmp');var _0xfcb480=path['join'](config[_0x58da('0x6f')],_0x58da('0x99'),_0x58da('0x9a'),_0x58da('0x6d'));var _0xab0e76=util['format'](_0x58da('0x9b'),_0x3c60f0);return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x587a66['params']['id']},'attributes':['id','body',_0x58da('0x9c'),'to','cc',_0x58da('0x9d'),_0x58da('0x9e'),_0x58da('0x9f')],'include':_0x587a66[_0x58da('0x3d')]['attachments']?[{'model':db[_0x58da('0xa0')],'as':_0x58da('0xa1')}]:undefined})[_0x58da('0x1e')](handleEntityNotFound(_0x10e0c8,null))['then'](function(_0x5c66a0){if(_0x5c66a0){var _0x584b11=_0x5c66a0;var _0x262bbf={'from':_0x584b11['from'],'to':_0x584b11['to'],'subject':_0x584b11[_0x58da('0x9e')],'html':_0x584b11[_0x58da('0x56')],'headers':{'Date':moment(_0x584b11[_0x58da('0x9f')])['format'](_0x58da('0xa2'))},'attachments':[]};if(_0x5c66a0['cc']){_0x262bbf[_0x58da('0xa3')]['Cc']=_0x5c66a0['cc'];}if(_0x5c66a0[_0x58da('0x9d')]){_0x262bbf['headers'][_0x58da('0xa4')]=_0x5c66a0[_0x58da('0x9d')];}return new BPromise(function(_0x55fa56,_0x52dec7){if(_0x5c66a0[_0x58da('0xa1')]){for(var _0x28d2a5=0x0;_0x28d2a5<_0x5c66a0[_0x58da('0xa1')][_0x58da('0x42')];_0x28d2a5++){var _0x5820ea=_0x5c66a0[_0x58da('0xa1')][_0x28d2a5];var _0x2f4eab=path[_0x58da('0x6e')](_0xfcb480,_0x5820ea[_0x58da('0x71')]);if(fs[_0x58da('0xa5')](_0x2f4eab)){_0x262bbf['attachments'][_0x58da('0xa6')]({'name':_0x5820ea['name'],'contentType':_0x5820ea[_0x58da('0x3a')],'data':fs[_0x58da('0xa7')](_0x2f4eab)});}}}emlformat[_0x58da('0xa8')](_0x262bbf,function(_0x30a1b6,_0x1a2ac4){if(_0x30a1b6)return _0x52dec7(_0x30a1b6);fs['writeFileSync'](path[_0x58da('0x6e')](_0x1a1334,_0xab0e76),_0x1a2ac4);return _0x55fa56(_0x1a2ac4);});});}})[_0x58da('0x1e')](function(_0x1aa84d){if(_0x1aa84d){return _0x10e0c8[_0x58da('0x96')](path[_0x58da('0x6e')](_0x1a1334,_0xab0e76),_0xab0e76,function(_0x2ba802){if(_0x2ba802){console[_0x58da('0xa9')](_0x58da('0xaa'),_0x2ba802);}else{fs['unlinkSync'](path[_0x58da('0x6e')](_0x1a1334,_0xab0e76));}});}})[_0x58da('0x29')](handleError(_0x10e0c8,null));}; \ No newline at end of file +var _0x0dec=['save','update','destroy','sendStatus','stack','name','send','map','MailMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','MailServerOut','Smtp','isNil','service','host','secure','user','pass','auth','attachments','root','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','read','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','interaction','RejectMessage','rejectmessage','download','toString','server','files','tmp','join','message-%s.eml','bcc','Attachment','from','subject','headers','Bcc','Attachments','push','type','readFileSync','build','writeFileSync','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x1ec9d1,_0x35ecaf){var _0x4b6bc2=function(_0x2695c6){while(--_0x2695c6){_0x1ec9d1['push'](_0x1ec9d1['shift']());}};_0x4b6bc2(++_0x35ecaf);}(_0x0dec,0x11c));var _0xc0de=function(_0x414d11,_0x515c01){_0x414d11=_0x414d11-0x0;var _0x959baf=_0x0dec[_0x414d11];return _0x959baf;};'use strict';var pdf=require(_0xc0de('0x0'));var emlformat=require(_0xc0de('0x1'));var rimraf=require(_0xc0de('0x2'));var zipdir=require(_0xc0de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0de('0x5'));var util=require(_0xc0de('0x6'));var path=require(_0xc0de('0x7'));var sox=require(_0xc0de('0x8'));var csv=require(_0xc0de('0x9'));var ejs=require(_0xc0de('0xa'));var fs=require('fs');var _=require(_0xc0de('0xb'));var squel=require(_0xc0de('0xc'));var crypto=require(_0xc0de('0xd'));var jsforce=require(_0xc0de('0xe'));var deskjs=require(_0xc0de('0xf'));var toCsv=require(_0xc0de('0x9'));var querystring=require(_0xc0de('0x10'));var Papa=require(_0xc0de('0x11'));var Redis=require(_0xc0de('0x12'));var authService=require(_0xc0de('0x13'));var qs=require(_0xc0de('0x14'));var as=require(_0xc0de('0x15'));var hardwareService=require(_0xc0de('0x16'));var logger=require(_0xc0de('0x17'))(_0xc0de('0x18'));var utils=require(_0xc0de('0x19'));var config=require(_0xc0de('0x1a'));var db=require(_0xc0de('0x1b'))['db'];config[_0xc0de('0x1c')]=_['defaults'](config[_0xc0de('0x1c')],{'host':_0xc0de('0x1d'),'port':0x18eb});var socket=require(_0xc0de('0x1e'))(new Redis(config[_0xc0de('0x1c')]));require(_0xc0de('0x1f'))[_0xc0de('0x20')](socket);var jayson=require(_0xc0de('0x21'));var client=jayson[_0xc0de('0x22')][_0xc0de('0x23')]({'port':0x232c});var client9003=jayson[_0xc0de('0x22')][_0xc0de('0x23')]({'port':0x232b});var client9002=jayson[_0xc0de('0x22')]['http']({'port':0x232a});function checkPasswordPattern(_0x12d66c,_0x1128e9,_0x526f67){if(_0x526f67){var _0x100458=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x100458[_0xc0de('0x24')](_0x1128e9)){return _0x12d66c;}else{throw new db[(_0xc0de('0x25'))]['ValidationError'](_0xc0de('0x26'));}}else{return _0x12d66c;}}function respondWithRpcPromise(_0x4a368e,_0x446d75,_0x5ac5b1,_0x412ceb){return new BPromise(function(_0x1109d2,_0x5b6104){var _0x2849de=_0x412ceb||client;return _0x2849de[_0xc0de('0x27')](_0x4a368e,_0x5ac5b1)[_0xc0de('0x28')](function(_0x2d855e){logger[_0xc0de('0x29')](_0xc0de('0x2a'),_0x446d75,_0xc0de('0x2b'));logger[_0xc0de('0x2c')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x446d75,_0xc0de('0x2b'),JSON[_0xc0de('0x2d')](_0x2d855e));if(_0x2d855e[_0xc0de('0x2e')]){if(_0x2d855e[_0xc0de('0x2e')][_0xc0de('0x2f')]===0x1f4){logger['error'](_0xc0de('0x2a'),_0x446d75,_0x2d855e[_0xc0de('0x2e')][_0xc0de('0x30')]);return _0x5b6104(_0x2d855e[_0xc0de('0x2e')]['message']);}logger[_0xc0de('0x2e')](_0xc0de('0x2a'),_0x446d75,_0x2d855e[_0xc0de('0x2e')][_0xc0de('0x30')]);return _0x1109d2(_0x2d855e[_0xc0de('0x2e')][_0xc0de('0x30')]);}else{logger[_0xc0de('0x29')](_0xc0de('0x2a'),_0x446d75,_0xc0de('0x2b'));_0x1109d2(_0x2d855e[_0xc0de('0x31')][_0xc0de('0x30')]);}})[_0xc0de('0x32')](function(_0xece6ca){logger['error']('MailMessage,\x20%s,\x20%s',_0x446d75,_0xece6ca);_0x5b6104(_0xece6ca);});});}function respondWithStatusCode(_0x285669,_0x2d6faa){_0x2d6faa=_0x2d6faa||0xcc;return function(_0x59fed0){if(_0x59fed0){return _0x285669['sendStatus'](_0x2d6faa);}return _0x285669[_0xc0de('0x33')](_0x2d6faa)[_0xc0de('0x34')]();};}function respondWithResult(_0x4ea40c,_0x484af0){_0x484af0=_0x484af0||0xc8;return function(_0x428089){if(_0x428089){return _0x4ea40c[_0xc0de('0x33')](_0x484af0)[_0xc0de('0x35')](_0x428089);}};}function respondWithFilteredResult(_0x5f317f,_0x23ff66){return function(_0x4eb14d){if(_0x4eb14d){var _0x1d6a49=_0x4eb14d[_0xc0de('0x36')],_0x1ccf8a=_0x23ff66['offset'],_0x61c92e=_0x23ff66[_0xc0de('0x37')]+_0x23ff66[_0xc0de('0x38')],_0x526862;if(_0x61c92e>=_0x1d6a49){_0x61c92e=_0x1d6a49;_0x526862=0xc8;}else{_0x526862=0xce;}_0x5f317f[_0xc0de('0x33')](_0x526862);return _0x5f317f['set'](_0xc0de('0x39'),_0x1ccf8a+'-'+_0x61c92e+'/'+_0x1d6a49)[_0xc0de('0x35')](_0x4eb14d);}return null;};}function patchUpdates(_0x104730){return function(_0x2e317a){try{jsonpatch[_0xc0de('0x3a')](_0x2e317a,_0x104730,!![]);}catch(_0x4456cc){return BPromise[_0xc0de('0x3b')](_0x4456cc);}return _0x2e317a[_0xc0de('0x3c')]();};}function saveUpdates(_0x197807,_0xe2a4f){return function(_0x47a8b9){if(_0x47a8b9){return _0x47a8b9[_0xc0de('0x3d')](_0x197807)['then'](function(_0xaca7e7){return _0xaca7e7;});}return null;};}function removeEntity(_0x11dc25,_0x2e2899){return function(_0xab9049){if(_0xab9049){return _0xab9049[_0xc0de('0x3e')]()[_0xc0de('0x28')](function(){_0x11dc25[_0xc0de('0x33')](0xcc)[_0xc0de('0x34')]();});}};}function handleEntityNotFound(_0x4128d7,_0x270708){return function(_0x4499e6){if(!_0x4499e6){_0x4128d7[_0xc0de('0x3f')](0x194);}return _0x4499e6;};}function handleError(_0x52303d,_0x534069){_0x534069=_0x534069||0x1f4;return function(_0x199aff){logger[_0xc0de('0x2e')](_0x199aff[_0xc0de('0x40')]);if(_0x199aff[_0xc0de('0x41')]){delete _0x199aff[_0xc0de('0x41')];}_0x52303d[_0xc0de('0x33')](_0x534069)[_0xc0de('0x42')](_0x199aff);};}exports['index']=function(_0x4ce461,_0x58fb03){var _0x37a4cd={},_0x135544={},_0x172183={'count':0x0,'rows':[]};var _0x15c12f=_[_0xc0de('0x43')](db[_0xc0de('0x44')]['rawAttributes'],function(_0x44407f){return{'name':_0x44407f[_0xc0de('0x45')],'type':_0x44407f['type'][_0xc0de('0x46')]};});_0x135544['model']=_[_0xc0de('0x43')](_0x15c12f,_0xc0de('0x41'));_0x135544[_0xc0de('0x47')]=_[_0xc0de('0x48')](_0x4ce461[_0xc0de('0x47')]);_0x135544[_0xc0de('0x49')]=_[_0xc0de('0x4a')](_0x135544[_0xc0de('0x4b')],_0x135544[_0xc0de('0x47')]);_0x37a4cd[_0xc0de('0x4c')]=_[_0xc0de('0x4a')](_0x135544['model'],qs[_0xc0de('0x4d')](_0x4ce461[_0xc0de('0x47')][_0xc0de('0x4d')]));_0x37a4cd[_0xc0de('0x4c')]=_0x37a4cd[_0xc0de('0x4c')]['length']?_0x37a4cd['attributes']:_0x135544[_0xc0de('0x4b')];if(!_0x4ce461[_0xc0de('0x47')][_0xc0de('0x4e')](_0xc0de('0x4f'))){_0x37a4cd['limit']=qs['limit'](_0x4ce461['query'][_0xc0de('0x38')]);_0x37a4cd['offset']=qs[_0xc0de('0x37')](_0x4ce461[_0xc0de('0x47')][_0xc0de('0x37')]);}_0x37a4cd[_0xc0de('0x50')]=qs[_0xc0de('0x51')](_0x4ce461[_0xc0de('0x47')]['sort']);_0x37a4cd[_0xc0de('0x52')]=qs[_0xc0de('0x49')](_[_0xc0de('0x53')](_0x4ce461[_0xc0de('0x47')],_0x135544['filters']),_0x15c12f);if(_0x4ce461[_0xc0de('0x47')][_0xc0de('0x54')]){_0x37a4cd[_0xc0de('0x52')]=_['merge'](_0x37a4cd[_0xc0de('0x52')],{'$or':_[_0xc0de('0x43')](_0x15c12f,function(_0xfc9cc0){if(_0xfc9cc0['type']!==_0xc0de('0x55')){var _0x5b4247={};_0x5b4247[_0xfc9cc0[_0xc0de('0x41')]]={'$like':'%'+_0x4ce461['query'][_0xc0de('0x54')]+'%'};return _0x5b4247;}})});}_0x37a4cd=_[_0xc0de('0x56')]({},_0x37a4cd,_0x4ce461[_0xc0de('0x57')]);var _0x3814f8={'where':_0x37a4cd['where']};return db[_0xc0de('0x44')][_0xc0de('0x36')](_0x3814f8)[_0xc0de('0x28')](function(_0x3b2447){_0x172183[_0xc0de('0x36')]=_0x3b2447;if(_0x4ce461[_0xc0de('0x47')][_0xc0de('0x58')]){_0x37a4cd[_0xc0de('0x59')]=[{'all':!![]}];}return db[_0xc0de('0x44')]['findAll'](_0x37a4cd);})[_0xc0de('0x28')](function(_0x1cf513){_0x172183[_0xc0de('0x5a')]=_0x1cf513;return _0x172183;})['then'](respondWithFilteredResult(_0x58fb03,_0x37a4cd))[_0xc0de('0x32')](handleError(_0x58fb03,null));};exports[_0xc0de('0x5b')]=function(_0x21a59b,_0x54ddd4){var _0x4c6837={'raw':!![],'where':{'id':_0x21a59b[_0xc0de('0x5c')]['id']}},_0x437159={};_0x437159['model']=_['keys'](db[_0xc0de('0x44')]['rawAttributes']);_0x437159[_0xc0de('0x47')]=_[_0xc0de('0x48')](_0x21a59b['query']);_0x437159['filters']=_['intersection'](_0x437159[_0xc0de('0x4b')],_0x437159[_0xc0de('0x47')]);_0x4c6837[_0xc0de('0x4c')]=_[_0xc0de('0x4a')](_0x437159['model'],qs[_0xc0de('0x4d')](_0x21a59b[_0xc0de('0x47')][_0xc0de('0x4d')]));_0x4c6837[_0xc0de('0x4c')]=_0x4c6837[_0xc0de('0x4c')][_0xc0de('0x5d')]?_0x4c6837[_0xc0de('0x4c')]:_0x437159['model'];if(_0x21a59b[_0xc0de('0x47')][_0xc0de('0x58')]){_0x4c6837[_0xc0de('0x59')]=[{'all':!![]}];}_0x4c6837=_[_0xc0de('0x56')]({},_0x4c6837,_0x21a59b['options']);return db['MailMessage'][_0xc0de('0x5e')](_0x4c6837)[_0xc0de('0x28')](handleEntityNotFound(_0x54ddd4,null))[_0xc0de('0x28')](respondWithResult(_0x54ddd4,null))[_0xc0de('0x32')](handleError(_0x54ddd4,null));};exports[_0xc0de('0x3d')]=function(_0x13b76f,_0x18faa0){if(_0x13b76f[_0xc0de('0x5f')]['id']){delete _0x13b76f[_0xc0de('0x5f')]['id'];}return db[_0xc0de('0x44')]['find']({'where':{'id':_0x13b76f[_0xc0de('0x5c')]['id']}})[_0xc0de('0x28')](handleEntityNotFound(_0x18faa0,null))['then'](saveUpdates(_0x13b76f['body'],null))['then'](respondWithResult(_0x18faa0,null))['catch'](handleError(_0x18faa0,null));};exports[_0xc0de('0x3e')]=function(_0x15bfcb,_0x4a46a2){return db['MailMessage'][_0xc0de('0x5e')]({'where':{'id':_0x15bfcb[_0xc0de('0x5c')]['id']}})[_0xc0de('0x28')](handleEntityNotFound(_0x4a46a2,null))[_0xc0de('0x28')](removeEntity(_0x4a46a2,null))[_0xc0de('0x32')](handleError(_0x4a46a2,null));};exports[_0xc0de('0x60')]=function(_0x4e1535,_0x3e8afe){return db[_0xc0de('0x44')][_0xc0de('0x60')]()[_0xc0de('0x28')](respondWithResult(_0x3e8afe,null))[_0xc0de('0x32')](handleError(_0x3e8afe,null));};exports[_0xc0de('0x61')]=function(_0x1ca913,_0x1fe9af){return db[_0xc0de('0x44')]['create'](_0x1ca913['body'])[_0xc0de('0x28')](function(_0x3ea480){if(_0x3ea480){if(_0x3ea480[_0xc0de('0x62')]===_0xc0de('0x63')&&!_0x3ea480[_0xc0de('0x64')]){var _0x534674,_0x170621,_0x2060b2;if(_0x1ca913[_0xc0de('0x5f')]['to']){_0x170621=_0x1ca913[_0xc0de('0x5f')]['to'][_0xc0de('0x65')](',')[0x0];}return db[_0xc0de('0x66')][_0xc0de('0x67')]({'where':{'id':_0x3ea480[_0xc0de('0x68')]},'include':[{'model':db[_0xc0de('0x69')],'as':_0xc0de('0x6a'),'include':[{'model':db['CmContact'],'as':_0xc0de('0x6b'),'where':{'email':_0x170621},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc0de('0x6c')],'as':_0xc0de('0x6d'),'raw':!![]}]})[_0xc0de('0x28')](function(_0x4f682){_0x534674=_0x4f682;if(_0x534674&&_0x534674[_0xc0de('0x6d')]){var _0x35ce50={'tls':{'rejectUnauthorized':![]}};if(_[_0xc0de('0x6e')](_0x534674[_0xc0de('0x6d')][_0xc0de('0x6f')])){_0x35ce50['host']=_0x534674[_0xc0de('0x6d')][_0xc0de('0x70')];_0x35ce50['port']=_0x534674['Smtp']['port'];_0x35ce50[_0xc0de('0x71')]=_0x534674['Smtp'][_0xc0de('0x71')];if(_0x534674['Smtp']['authentication']){_0x35ce50['auth']={'user':_0x534674[_0xc0de('0x6d')][_0xc0de('0x72')],'pass':_0x534674[_0xc0de('0x6d')][_0xc0de('0x73')]};}}else{_0x35ce50[_0xc0de('0x6f')]=_0x534674[_0xc0de('0x6d')][_0xc0de('0x6f')];_0x35ce50[_0xc0de('0x74')]={'user':_0x534674[_0xc0de('0x6d')][_0xc0de('0x72')],'pass':_0x534674[_0xc0de('0x6d')][_0xc0de('0x73')]};_0x35ce50[_0xc0de('0x71')]=_0x534674['Smtp']['secure'];}if(_0x1ca913['body'][_0xc0de('0x75')]&&_0x1ca913[_0xc0de('0x5f')][_0xc0de('0x75')][_0xc0de('0x5d')]){for(var _0x32e818=0x0;_0x32e818<_0x1ca913['body'][_0xc0de('0x75')][_0xc0de('0x5d')];_0x32e818+=0x1){_0x1ca913[_0xc0de('0x5f')][_0xc0de('0x75')][_0x32e818]={'filename':_0x1ca913['body']['attachments'][_0x32e818][_0xc0de('0x41')],'path':path['join'](config[_0xc0de('0x76')],'server/files/attachments',_0x1ca913[_0xc0de('0x5f')]['attachments'][_0x32e818][_0xc0de('0x77')])};}}_0x2060b2={'account':_0x35ce50,'message':_0x1ca913[_0xc0de('0x5f')]};return;}})[_0xc0de('0x28')](function(){if(_0x534674['List']){if(_0x534674['List'][_0xc0de('0x6b')][_0xc0de('0x5d')]){return _0x534674[_0xc0de('0x6a')][_0xc0de('0x6b')][0x0];}else{return db[_0xc0de('0x78')][_0xc0de('0x61')](_[_0xc0de('0x79')](_0x1ca913['body'],{'firstName':_0x1ca913[_0xc0de('0x5f')]['to'],'email':_0x1ca913[_0xc0de('0x5f')]['to'],'phone':_0x1ca913['body']['to'],'ListId':_0x534674[_0xc0de('0x7a')]}));}}else{throw new Error(_0xc0de('0x7b'));}})['then'](function(){if(_0x2060b2){return respondWithRpcPromise(_0xc0de('0x7c'),'sendMail',_0x2060b2,client9003)[_0xc0de('0x28')](function(_0x50168d){return _0x3ea480[_0xc0de('0x3d')]({'read':!![],'messageId':_0x50168d[_0xc0de('0x7d')],'sentAt':moment()[_0xc0de('0x7e')](_0xc0de('0x7f'))});})['catch'](function(_0x5be0ab){logger['error']('%s',JSON[_0xc0de('0x2d')](_0x5be0ab));return _0x3ea480;});}return _0x3ea480;});}return _0x3ea480;}})[_0xc0de('0x28')](respondWithResult(_0x1fe9af,0xc9))[_0xc0de('0x32')](handleError(_0x1fe9af,null));};var interaction_log=require(_0xc0de('0x17'))(_0xc0de('0x80'));exports['accept']=function(_0xdcd7e0,_0x1b6207,_0x2a719b){var _0x245df8={'channel':'mail'};if(_0xdcd7e0[_0xc0de('0x5f')]['id']){delete _0xdcd7e0[_0xc0de('0x5f')]['id'];}_0xdcd7e0['body'][_0xc0de('0x81')]=!![];_0xdcd7e0[_0xc0de('0x5f')][_0xc0de('0x82')]=moment()[_0xc0de('0x7e')](_0xc0de('0x7f'));_0xdcd7e0[_0xc0de('0x5f')]['UserId']=_0xdcd7e0[_0xc0de('0x5f')][_0xc0de('0x83')]||_0xdcd7e0[_0xc0de('0x72')]['id'];return db[_0xc0de('0x44')][_0xc0de('0x5e')]({'where':{'id':_0xdcd7e0[_0xc0de('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0xc0de('0x78')],'as':'Contact'}]})[_0xc0de('0x28')](handleEntityNotFound(_0x1b6207,null))['then'](saveUpdates(_0xdcd7e0[_0xc0de('0x5f')],null))[_0xc0de('0x28')](function(_0x245824){if(_0x245824){_0x245df8[_0xc0de('0x30')]=_0x245824[_0xc0de('0x84')]({'plain':!![]});return db[_0xc0de('0x85')][_0xc0de('0x5e')]({'where':{'id':_0x245824[_0xc0de('0x86')]}});}return null;})[_0xc0de('0x28')](handleEntityNotFound(_0x1b6207,null))[_0xc0de('0x28')](function(_0x2704d2){if(_0x2704d2){return _0x2704d2[_0xc0de('0x3d')]({'UserId':_0xdcd7e0[_0xc0de('0x5f')][_0xc0de('0x83')],'read1stAt':_[_0xc0de('0x6e')](_0x2704d2[_0xc0de('0x87')])?moment()['format'](_0xc0de('0x7f')):undefined});}return null;})[_0xc0de('0x28')](function(_0x4aa9fc){if(_0x4aa9fc){_0x245df8['interaction']=_0x4aa9fc[_0xc0de('0x84')]({'plain':!![]});interaction_log[_0xc0de('0x29')](_0xc0de('0x88'),_0xdcd7e0[_0xc0de('0x72')]['id'],_0xdcd7e0[_0xc0de('0x72')][_0xc0de('0x41')],_0xdcd7e0[_0xc0de('0x72')][_0xc0de('0x89')],_0x245df8['interaction']['id'],_0xdcd7e0['body']?JSON[_0xc0de('0x2d')](_0xdcd7e0[_0xc0de('0x5f')]):'null');return respondWithRpcPromise(_0xc0de('0x8a'),_0xc0de('0x8b'),_0x245df8);}return null;})['then'](function(_0x10afda){if(_0x10afda){if(_0xdcd7e0[_0xc0de('0x5f')][_0xc0de('0x8c')]){_0x245df8[_0xc0de('0x30')][_0xc0de('0x8d')]=util['format'](_0xc0de('0x8e'),_0xdcd7e0[_0xc0de('0x72')][_0xc0de('0x41')]);_0x245df8[_0xc0de('0x30')][_0xc0de('0x8f')]=_0x245df8[_0xc0de('0x8f')];_0x245df8[_0xc0de('0x30')][_0xc0de('0x90')]='accept';return respondWithRpcPromise(_0xc0de('0x91'),'EventManager',{'event':_0xc0de('0x92'),'message':_0x245df8[_0xc0de('0x30')]},client9002)[_0xc0de('0x28')](function(){return _0x245df8;});}return _0x245df8;}return null;})[_0xc0de('0x28')](respondWithResult(_0x1b6207,null))['catch'](handleError(_0x1b6207,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xc0de('0x3b')]=function(_0x4a6f36,_0x20e908,_0x5629fa){var _0x12e03f={'agent':{},'channel':_0xc0de('0x93')};if(_0x4a6f36[_0xc0de('0x5f')]['id']){delete _0x4a6f36[_0xc0de('0x5f')]['id'];}_0x4a6f36[_0xc0de('0x5f')][_0xc0de('0x83')]=_0x4a6f36[_0xc0de('0x5f')][_0xc0de('0x83')]||_0x4a6f36['user']['id'];_0x12e03f[_0xc0de('0x94')]['id']=_0x4a6f36[_0xc0de('0x5f')][_0xc0de('0x83')];return db['MailMessage'][_0xc0de('0x5e')]({'where':{'id':_0x4a6f36['params']['id'],'UserId':null}})[_0xc0de('0x28')](handleEntityNotFound(_0x20e908,null))[_0xc0de('0x28')](function(_0x2daff4){if(_0x2daff4){_0x12e03f[_0xc0de('0x30')]=_0x2daff4[_0xc0de('0x84')]({'plain':!![]});return db['MailInteraction'][_0xc0de('0x5e')]({'where':{'id':_0x2daff4[_0xc0de('0x86')]}});}return null;})[_0xc0de('0x28')](handleEntityNotFound(_0x20e908,null))[_0xc0de('0x28')](function(_0x1e6f94){if(_0x1e6f94){_0x12e03f[_0xc0de('0x95')]=_0x1e6f94['get']({'plain':!![]});interaction_log[_0xc0de('0x29')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a6f36['user']['id'],_0x4a6f36[_0xc0de('0x72')]['name'],_0x4a6f36['user']['role'],_0x12e03f[_0xc0de('0x95')]['id'],_0x4a6f36[_0xc0de('0x5f')]?JSON[_0xc0de('0x2d')](_0x4a6f36[_0xc0de('0x5f')]):'null');return respondWithRpcPromise(_0xc0de('0x96'),'rejectMessage',_0x12e03f);}return null;})['then'](function(_0x15cd26){if(_0x15cd26){_0x15cd26['message'][_0xc0de('0x8d')]=util['format'](_0xc0de('0x8e'),_0x4a6f36['user'][_0xc0de('0x41')]);_0x15cd26['message'][_0xc0de('0x8f')]=_0x12e03f['channel'];_0x15cd26[_0xc0de('0x30')][_0xc0de('0x90')]=_0xc0de('0x3b');respondWithRpcPromise(_0xc0de('0x91'),_0xc0de('0x91'),{'event':_0xc0de('0x97'),'message':_0x15cd26[_0xc0de('0x30')]},client9002);return _0x12e03f;}return null;})[_0xc0de('0x28')](respondWithResult(_0x20e908,null))[_0xc0de('0x32')](handleError(_0x20e908,null));};exports[_0xc0de('0x98')]=function(_0x5c698b,_0x4dc079){var _0x54c3ab=moment()['unix']()[_0xc0de('0x99')]();var _0x4d2fbb=path['join'](config['root'],_0xc0de('0x9a'),_0xc0de('0x9b'),_0xc0de('0x9c'));var _0x1ecbe0=path[_0xc0de('0x9d')](config[_0xc0de('0x76')],_0xc0de('0x9a'),'files',_0xc0de('0x75'));var _0x5dbc1a=util[_0xc0de('0x7e')](_0xc0de('0x9e'),_0x54c3ab);return db[_0xc0de('0x44')][_0xc0de('0x5e')]({'where':{'id':_0x5c698b[_0xc0de('0x5c')]['id']},'attributes':['id','body','from','to','cc',_0xc0de('0x9f'),'subject','createdAt'],'include':_0x5c698b['query']['attachments']?[{'model':db[_0xc0de('0xa0')],'as':'Attachments'}]:undefined})[_0xc0de('0x28')](handleEntityNotFound(_0x4dc079,null))[_0xc0de('0x28')](function(_0x2c4d84){if(_0x2c4d84){var _0x413ad0=_0x2c4d84;var _0x29219={'from':_0x413ad0[_0xc0de('0xa1')],'to':_0x413ad0['to'],'subject':_0x413ad0[_0xc0de('0xa2')],'html':_0x413ad0['body'],'headers':{'Date':moment(_0x413ad0['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2c4d84['cc']){_0x29219[_0xc0de('0xa3')]['Cc']=_0x2c4d84['cc'];}if(_0x2c4d84['bcc']){_0x29219[_0xc0de('0xa3')][_0xc0de('0xa4')]=_0x2c4d84[_0xc0de('0x9f')];}return new BPromise(function(_0x4eced4,_0x43ea84){if(_0x2c4d84['Attachments']){for(var _0xd2947f=0x0;_0xd2947f<_0x2c4d84[_0xc0de('0xa5')][_0xc0de('0x5d')];_0xd2947f++){var _0x4702ec=_0x2c4d84[_0xc0de('0xa5')][_0xd2947f];var _0x72192b=path[_0xc0de('0x9d')](_0x1ecbe0,_0x4702ec['basename']);if(fs['existsSync'](_0x72192b)){_0x29219[_0xc0de('0x75')][_0xc0de('0xa6')]({'name':_0x4702ec[_0xc0de('0x41')],'contentType':_0x4702ec[_0xc0de('0xa7')],'data':fs[_0xc0de('0xa8')](_0x72192b)});}}}emlformat[_0xc0de('0xa9')](_0x29219,function(_0x19a6de,_0x770d82){if(_0x19a6de)return _0x43ea84(_0x19a6de);fs[_0xc0de('0xaa')](path['join'](_0x4d2fbb,_0x5dbc1a),_0x770d82);return _0x4eced4(_0x770d82);});});}})[_0xc0de('0x28')](function(_0x117f44){if(_0x117f44){return _0x4dc079[_0xc0de('0x98')](path[_0xc0de('0x9d')](_0x4d2fbb,_0x5dbc1a),_0x5dbc1a,function(_0x37f8d0){if(_0x37f8d0){console['log'](_0xc0de('0xab'),_0x37f8d0);}else{fs['unlinkSync'](path[_0xc0de('0x9d')](_0x4d2fbb,_0x5dbc1a));}});}})[_0xc0de('0x32')](handleError(_0x4dc079,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f5d776b..b2c148b 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 _0x3131=['exports','events','MailMessage','save','update','remove','emit','hook'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x3131,0x1c1));var _0x1313=function(_0xe783d4,_0x38378f){_0xe783d4=_0xe783d4-0x0;var _0x911c4a=_0x3131[_0xe783d4];return _0x911c4a;};'use strict';var EventEmitter=require(_0x1313('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1313('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1313('0x2'),'afterUpdate':_0x1313('0x3'),'afterDestroy':_0x1313('0x4')};function emitEvent(_0x2ba12b){return function(_0x367b66,_0xedd883,_0x460309){MailMessageEvents['emit'](_0x2ba12b+':'+_0x367b66['id'],_0x367b66);MailMessageEvents[_0x1313('0x5')](_0x2ba12b,_0x367b66);_0x460309(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1313('0x6')](e,emitEvent(event));}}module[_0x1313('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x8e13=['update','remove','emit','hook','exports','MailMessage','setMaxListeners'];(function(_0x5085ee,_0x530877){var _0x539e60=function(_0x240320){while(--_0x240320){_0x5085ee['push'](_0x5085ee['shift']());}};_0x539e60(++_0x530877);}(_0x8e13,0x124));var _0x38e1=function(_0xc1b1c1,_0x284e93){_0xc1b1c1=_0xc1b1c1-0x0;var _0x8d262d=_0x8e13[_0xc1b1c1];return _0x8d262d;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x38e1('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x38e1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38e1('0x2'),'afterDestroy':_0x38e1('0x3')};function emitEvent(_0x53d323){return function(_0x320943,_0x40485b,_0x3152e3){MailMessageEvents['emit'](_0x53d323+':'+_0x320943['id'],_0x320943);MailMessageEvents[_0x38e1('0x4')](_0x53d323,_0x320943);_0x3152e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x38e1('0x5')](e,emitEvent(event));}}module[_0x38e1('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index fe17241..2dd199c 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 _0x6fc1=['./mailMessage.attributes','exports','MailMessage','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f494f,_0x47997a){var _0x371d55=function(_0x5f2de5){while(--_0x5f2de5){_0x2f494f['push'](_0x2f494f['shift']());}};_0x371d55(++_0x47997a);}(_0x6fc1,0x9b));var _0x16fc=function(_0x4beaa0,_0x2e20b4){_0x4beaa0=_0x4beaa0-0x0;var _0x32d9e4=_0x6fc1[_0x4beaa0];return _0x32d9e4;};'use strict';var _=require(_0x16fc('0x0'));var util=require(_0x16fc('0x1'));var logger=require(_0x16fc('0x2'))(_0x16fc('0x3'));var moment=require(_0x16fc('0x4'));var BPromise=require(_0x16fc('0x5'));var rp=require(_0x16fc('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x16fc('0x7'));var rimraf=require(_0x16fc('0x8'));var config=require(_0x16fc('0x9'));var attributes=require(_0x16fc('0xa'));module[_0x16fc('0xb')]=function(_0x392fe1,_0x27b8f7){return _0x392fe1['define'](_0x16fc('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x16fc('0xd'),'fields':[_0x16fc('0xd')]},{'name':'fti_mail_messages','fields':[_0x16fc('0xe'),_0x16fc('0xf')],'type':_0x16fc('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32172b,_0xabfe89,_0x40b0e7){if(_0x32172b[_0x16fc('0x11')]){_0x32172b['plainBody']=htmlToText[_0x16fc('0x12')](_0x32172b[_0x16fc('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x40b0e7(null,_0xabfe89);},'afterCreate':function(_0x462a9d,_0x2d95f0,_0x59522c){var _0x1430da=_0x392fe1[_0x16fc('0x13')];var _0x1fce72=_0x462a9d[_0x16fc('0x14')]({'plain':!![]});if(_0x1fce72[_0x16fc('0x15')][_0x16fc('0x16')]()==='in'||_0x1fce72[_0x16fc('0x15')][_0x16fc('0x16')]()==='out'&&!_0x1fce72[_0x16fc('0x17')]&&!_['isNil'](_0x1fce72[_0x16fc('0x18')])){_0x1430da[_0x16fc('0x19')]['findOne']({'where':{'id':_0x1fce72[_0x16fc('0x1a')]}})[_0x16fc('0x1b')](function(_0x4bc99d){if(_0x4bc99d){_0x4bc99d[_0x16fc('0x1c')]({'lastMsgAt':_0x1fce72['createdAt'],'lastMsgDirection':_0x1fce72[_0x16fc('0x15')][_0x16fc('0x16')](),'lastMsgBody':_0x1fce72['body']});}})[_0x16fc('0x1d')](function(_0xa5cde8){console[_0x16fc('0x1e')](_0xa5cde8);});}_0x59522c();}},'charset':_0x16fc('0x1f'),'collate':_0x16fc('0x20')});}; \ No newline at end of file +var _0x9608=['../../config/environment','./mailMessage.attributes','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','update','createdAt','catch','error','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x9608,0x159));var _0x8960=function(_0x249b51,_0x460803){_0x249b51=_0x249b51-0x0;var _0x1ed743=_0x9608[_0x249b51];return _0x1ed743;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8960('0x0'))(_0x8960('0x1'));var moment=require(_0x8960('0x2'));var BPromise=require(_0x8960('0x3'));var rp=require(_0x8960('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8960('0x5'));var rimraf=require(_0x8960('0x6'));var config=require(_0x8960('0x7'));var attributes=require(_0x8960('0x8'));module['exports']=function(_0x12ded2,_0x18e700){return _0x12ded2[_0x8960('0x9')]('MailMessage',attributes,{'tableName':_0x8960('0xa'),'paranoid':![],'indexes':[{'name':_0x8960('0xb'),'fields':[_0x8960('0xb')]},{'name':_0x8960('0xc'),'fields':[_0x8960('0xd'),_0x8960('0xe')],'type':_0x8960('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x8b59a2,_0xbb4ca3,_0xa9cc57){if(_0x8b59a2['body']){_0x8b59a2[_0x8960('0xd')]=htmlToText[_0x8960('0x10')](_0x8b59a2[_0x8960('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xa9cc57(null,_0xbb4ca3);},'afterCreate':function(_0x3676a4,_0xeef3f,_0x353f5c){var _0x1ba394=_0x12ded2[_0x8960('0x12')];var _0xdb5408=_0x3676a4[_0x8960('0x13')]({'plain':!![]});if(_0xdb5408['direction']['toLowerCase']()==='in'||_0xdb5408[_0x8960('0x14')][_0x8960('0x15')]()===_0x8960('0x16')&&!_0xdb5408[_0x8960('0x17')]&&!_[_0x8960('0x18')](_0xdb5408[_0x8960('0x19')])){_0x1ba394[_0x8960('0x1a')][_0x8960('0x1b')]({'where':{'id':_0xdb5408['MailInteractionId']}})['then'](function(_0xbeca8d){if(_0xbeca8d){_0xbeca8d[_0x8960('0x1c')]({'lastMsgAt':_0xdb5408[_0x8960('0x1d')],'lastMsgDirection':_0xdb5408['direction'][_0x8960('0x15')](),'lastMsgBody':_0xdb5408[_0x8960('0x11')]});}})[_0x8960('0x1e')](function(_0x322f98){console[_0x8960('0x1f')](_0x322f98);});}_0x353f5c();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 782f962..bed90dc 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 _0x18b2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','MailMessage','create','body','options','then','CreateMailMessage','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x18b2,0x85));var _0x218b=function(_0x31eb64,_0x2598f7){_0x31eb64=_0x31eb64-0x0;var _0x37c10b=_0x18b2[_0x31eb64];return _0x37c10b;};'use strict';var _=require('lodash');var util=require(_0x218b('0x0'));var moment=require(_0x218b('0x1'));var BPromise=require(_0x218b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x218b('0x3'));var db=require(_0x218b('0x4'))['db'];var utils=require(_0x218b('0x5'));var logger=require(_0x218b('0x6'))(_0x218b('0x7'));var config=require(_0x218b('0x8'));var jayson=require(_0x218b('0x9'));var client=jayson[_0x218b('0xa')][_0x218b('0xb')]({'port':0x232a});config[_0x218b('0xc')]=_[_0x218b('0xd')](config[_0x218b('0xc')],{'host':_0x218b('0xe'),'port':0x18eb});var socket=require(_0x218b('0xf'))(new Redis(config[_0x218b('0xc')]));require('./mailMessage.socket')[_0x218b('0x10')](socket);function respondWithRpcPromise(_0xc5f1d7,_0x413da9,_0x161acf){return new BPromise(function(_0x421a0f,_0x4ee68f){return client[_0x218b('0x11')](_0xc5f1d7,_0x161acf)['then'](function(_0xfc01c1){logger[_0x218b('0x12')](_0x218b('0x13'),_0x413da9,'request\x20sent');logger[_0x218b('0x14')](_0x218b('0x15'),_0x413da9,'request\x20sent',JSON[_0x218b('0x16')](_0xfc01c1));if(_0xfc01c1[_0x218b('0x17')]){if(_0xfc01c1['error'][_0x218b('0x18')]===0x1f4){logger[_0x218b('0x17')](_0x218b('0x13'),_0x413da9,_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);return _0x4ee68f(_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);}logger[_0x218b('0x17')](_0x218b('0x13'),_0x413da9,_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);return _0x421a0f(_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);}else{logger[_0x218b('0x12')](_0x218b('0x13'),_0x413da9,_0x218b('0x1a'));_0x421a0f(_0xfc01c1['result'][_0x218b('0x19')]);}})[_0x218b('0x1b')](function(_0x139ade){logger['error']('MailMessage,\x20%s,\x20%s',_0x413da9,_0x139ade);_0x4ee68f(_0x139ade);});});}exports['CreateMailMessage']=function(_0x35bc29){var _0x3ac24d=this;return new Promise(function(_0x309af8,_0x157a8e){return db[_0x218b('0x1c')][_0x218b('0x1d')](_0x35bc29[_0x218b('0x1e')],{'raw':_0x35bc29[_0x218b('0x1f')]?_0x35bc29['options']['raw']===undefined?!![]:![]:!![]})[_0x218b('0x20')](function(_0x35716b){logger['info'](_0x218b('0x21'),_0x35bc29);logger[_0x218b('0x14')](_0x218b('0x21'),_0x35bc29,JSON['stringify'](_0x35716b));_0x309af8(_0x35716b);})['catch'](function(_0x63ad32){logger[_0x218b('0x17')]('CreateMailMessage',_0x63ad32[_0x218b('0x19')],_0x35bc29);_0x157a8e(_0x3ac24d[_0x218b('0x17')](0x1f4,_0x63ad32[_0x218b('0x19')]));});});}; \ No newline at end of file +var _0x4af9=['http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x254bac,_0x76f51b){var _0xeb2b94=function(_0x3d98b0){while(--_0x3d98b0){_0x254bac['push'](_0x254bac['shift']());}};_0xeb2b94(++_0x76f51b);}(_0x4af9,0x12c));var _0x94af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4af9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94af('0x2'));var fs=require('fs');var Redis=require(_0x94af('0x3'));var db=require(_0x94af('0x4'))['db'];var utils=require(_0x94af('0x5'));var logger=require(_0x94af('0x6'))(_0x94af('0x7'));var config=require(_0x94af('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x94af('0x9')][_0x94af('0xa')]({'port':0x232a});config[_0x94af('0xb')]=_[_0x94af('0xc')](config['redis'],{'host':_0x94af('0xd'),'port':0x18eb});var socket=require(_0x94af('0xe'))(new Redis(config[_0x94af('0xb')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0xb778b2,_0xa3e353,_0x13cb35){return new BPromise(function(_0x3bfc17,_0x68ff71){return client[_0x94af('0xf')](_0xb778b2,_0x13cb35)['then'](function(_0x43b1da){logger[_0x94af('0x10')]('MailMessage,\x20%s,\x20%s',_0xa3e353,_0x94af('0x11'));logger[_0x94af('0x12')](_0x94af('0x13'),_0xa3e353,_0x94af('0x11'),JSON[_0x94af('0x14')](_0x43b1da));if(_0x43b1da['error']){if(_0x43b1da[_0x94af('0x15')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xa3e353,_0x43b1da[_0x94af('0x15')][_0x94af('0x16')]);return _0x68ff71(_0x43b1da[_0x94af('0x15')][_0x94af('0x16')]);}logger['error'](_0x94af('0x17'),_0xa3e353,_0x43b1da[_0x94af('0x15')]['message']);return _0x3bfc17(_0x43b1da[_0x94af('0x15')][_0x94af('0x16')]);}else{logger[_0x94af('0x10')](_0x94af('0x17'),_0xa3e353,_0x94af('0x11'));_0x3bfc17(_0x43b1da[_0x94af('0x18')][_0x94af('0x16')]);}})[_0x94af('0x19')](function(_0x38a2a9){logger[_0x94af('0x15')]('MailMessage,\x20%s,\x20%s',_0xa3e353,_0x38a2a9);_0x68ff71(_0x38a2a9);});});}exports['CreateMailMessage']=function(_0x4349db){var _0x186355=this;return new Promise(function(_0xee81a,_0x17bfcc){return db[_0x94af('0x1a')][_0x94af('0x1b')](_0x4349db['body'],{'raw':_0x4349db[_0x94af('0x1c')]?_0x4349db['options'][_0x94af('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xa0cf1a){logger[_0x94af('0x10')](_0x94af('0x1e'),_0x4349db);logger['debug'](_0x94af('0x1e'),_0x4349db,JSON[_0x94af('0x14')](_0xa0cf1a));_0xee81a(_0xa0cf1a);})[_0x94af('0x19')](function(_0x270f9a){logger['error'](_0x94af('0x1e'),_0x270f9a[_0x94af('0x16')],_0x4349db);_0x17bfcc(_0x186355[_0x94af('0x15')](0x1f4,_0x270f9a[_0x94af('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f993437..1c2a60b 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 _0xb7ce=['update','emit','removeListener','register','length','mailMessage:','save'];(function(_0x15291,_0x95ec05){var _0x2c0938=function(_0x17fc38){while(--_0x17fc38){_0x15291['push'](_0x15291['shift']());}};_0x2c0938(++_0x95ec05);}(_0xb7ce,0x1a3));var _0xeb7c=function(_0x3b8d61,_0x240a43){_0x3b8d61=_0x3b8d61-0x0;var _0x36a32b=_0xb7ce[_0x3b8d61];return _0x36a32b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xeb7c('0x0'),'remove',_0xeb7c('0x1')];function createListener(_0x37f26d,_0xf1822a){return function(_0x45f9fb){_0xf1822a[_0xeb7c('0x2')](_0x37f26d,_0x45f9fb);};}function removeListener(_0x500312,_0x380be6){return function(){MailMessageEvents[_0xeb7c('0x3')](_0x500312,_0x380be6);};}exports[_0xeb7c('0x4')]=function(_0x3e874b){for(var _0x70f54a=0x0,_0x251589=events[_0xeb7c('0x5')];_0x70f54a<_0x251589;_0x70f54a++){var _0x4d0183=events[_0x70f54a];var _0x3dae0b=createListener(_0xeb7c('0x6')+_0x4d0183,_0x3e874b);MailMessageEvents['on'](_0x4d0183,_0x3dae0b);}}; \ No newline at end of file +var _0xfb05=['mailMessage:','remove','update','register','length'];(function(_0x293b9d,_0x5c7dbf){var _0x12b891=function(_0x3c8987){while(--_0x3c8987){_0x293b9d['push'](_0x293b9d['shift']());}};_0x12b891(++_0x5c7dbf);}(_0xfb05,0x1b4));var _0x5fb0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfb05[_0x12fc8d];return _0x3f9d04;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x5fb0('0x0'),_0x5fb0('0x1')];function createListener(_0x11b769,_0x3a21fc){return function(_0x234f72){_0x3a21fc['emit'](_0x11b769,_0x234f72);};}function removeListener(_0x486924,_0x3629e5){return function(){MailMessageEvents['removeListener'](_0x486924,_0x3629e5);};}exports[_0x5fb0('0x2')]=function(_0xda0469){for(var _0x2d8c25=0x0,_0x157aec=events[_0x5fb0('0x3')];_0x2d8c25<_0x157aec;_0x2d8c25++){var _0x5cad6c=events[_0x2d8c25];var _0x542463=createListener(_0x5fb0('0x4')+_0x5cad6c,_0xda0469);MailMessageEvents['on'](_0x5cad6c,_0x542463);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index bc9ff7c..484c888 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 _0xb471=['./mailQueue.controller','index','get','/describe','describe','/:id','show','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1fd1be,_0x4490c2){var _0x3a7b03=function(_0x1e6a6a){while(--_0x1e6a6a){_0x1fd1be['push'](_0x1fd1be['shift']());}};_0x3a7b03(++_0x4490c2);}(_0xb471,0xbe));var _0x1b47=function(_0x2e416e,_0x4d955a){_0x2e416e=_0x2e416e-0x0;var _0x95bd0e=_0xb471[_0x2e416e];return _0x95bd0e;};'use strict';var multer=require(_0x1b47('0x0'));var util=require(_0x1b47('0x1'));var path=require(_0x1b47('0x2'));var timeout=require(_0x1b47('0x3'));var express=require(_0x1b47('0x4'));var router=express['Router']();var auth=require(_0x1b47('0x5'));var interaction=require(_0x1b47('0x6'));var config=require(_0x1b47('0x7'));var controller=require(_0x1b47('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b47('0x9')]);router[_0x1b47('0xa')](_0x1b47('0xb'),auth['isAuthenticated'](),controller[_0x1b47('0xc')]);router['get'](_0x1b47('0xd'),auth['isAuthenticated'](),controller[_0x1b47('0xe')]);router[_0x1b47('0xa')](_0x1b47('0xf'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x11')]);router[_0x1b47('0xa')](_0x1b47('0x12'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x13')]);router['get'](_0x1b47('0x14'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x15')]);router[_0x1b47('0x16')]('/',auth[_0x1b47('0x10')](),controller[_0x1b47('0x17')]);router['post'](_0x1b47('0x12'),auth['isAuthenticated'](),controller[_0x1b47('0x18')]);router[_0x1b47('0x16')](_0x1b47('0x14'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x19')]);router[_0x1b47('0x1a')]('/:id',auth[_0x1b47('0x10')](),controller[_0x1b47('0x1b')]);router[_0x1b47('0x1c')](_0x1b47('0xd'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x1d')]);router['delete'](_0x1b47('0x12'),auth['isAuthenticated'](),controller[_0x1b47('0x1e')]);router[_0x1b47('0x1c')](_0x1b47('0x14'),auth['isAuthenticated'](),controller[_0x1b47('0x1f')]);module[_0x1b47('0x20')]=router; \ No newline at end of file +var _0x5676=['destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','put'];(function(_0x26a515,_0x286339){var _0x314682=function(_0x501b51){while(--_0x501b51){_0x26a515['push'](_0x26a515['shift']());}};_0x314682(++_0x286339);}(_0x5676,0x1e0));var _0x6567=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5676[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x6567('0x0'));var util=require('util');var path=require(_0x6567('0x1'));var timeout=require(_0x6567('0x2'));var express=require('express');var router=express[_0x6567('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6567('0x4'));var controller=require(_0x6567('0x5'));router[_0x6567('0x6')]('/',auth[_0x6567('0x7')](),controller['index']);router['get'](_0x6567('0x8'),auth[_0x6567('0x7')](),controller[_0x6567('0x9')]);router[_0x6567('0x6')](_0x6567('0xa'),auth[_0x6567('0x7')](),controller[_0x6567('0xb')]);router[_0x6567('0x6')](_0x6567('0xc'),auth[_0x6567('0x7')](),controller[_0x6567('0xd')]);router[_0x6567('0x6')](_0x6567('0xe'),auth[_0x6567('0x7')](),controller[_0x6567('0xf')]);router['get']('/:id/users',auth[_0x6567('0x7')](),controller['getAgents']);router['post']('/',auth[_0x6567('0x7')](),controller['create']);router[_0x6567('0x10')](_0x6567('0xe'),auth[_0x6567('0x7')](),controller[_0x6567('0x11')]);router[_0x6567('0x10')](_0x6567('0x12'),auth[_0x6567('0x7')](),controller['addAgents']);router[_0x6567('0x13')](_0x6567('0xa'),auth[_0x6567('0x7')](),controller['update']);router['delete'](_0x6567('0xa'),auth['isAuthenticated'](),controller[_0x6567('0x14')]);router[_0x6567('0x15')](_0x6567('0xe'),auth[_0x6567('0x7')](),controller[_0x6567('0x16')]);router[_0x6567('0x15')]('/:id/users',auth[_0x6567('0x7')](),controller[_0x6567('0x17')]);module[_0x6567('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 14cf731..fc9e0a9 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 _0xade9=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xade9,0x194));var _0x9ade=function(_0x156515,_0x760da4){_0x156515=_0x156515-0x0;var _0x3e1e8b=_0xade9[_0x156515];return _0x3e1e8b;};'use strict';var Sequelize=require(_0x9ade('0x0'));module[_0x9ade('0x1')]={'name':{'type':Sequelize[_0x9ade('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9ade('0x2')]},'timeout':{'type':Sequelize[_0x9ade('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9ade('0x4')](_0x9ade('0x5'),_0x9ade('0x6'),_0x9ade('0x7'))}}; \ No newline at end of file +var _0xc6ef=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x54a279,_0x5cebfd){var _0x28d5a6=function(_0x262159){while(--_0x262159){_0x54a279['push'](_0x54a279['shift']());}};_0x28d5a6(++_0x5cebfd);}(_0xc6ef,0x81));var _0xfc6e=function(_0x9f51cd,_0xb084cc){_0x9f51cd=_0x9f51cd-0x0;var _0x1948f8=_0xc6ef[_0x9f51cd];return _0x1948f8;};'use strict';var Sequelize=require(_0xfc6e('0x0'));module[_0xfc6e('0x1')]={'name':{'type':Sequelize[_0xfc6e('0x2')],'unique':_0xfc6e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfc6e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfc6e('0x5')](_0xfc6e('0x6'),_0xfc6e('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 348a196..0ac1b7e 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 _0x0be9=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAndCountAll','UserId','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','MailQueues','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','MailQueue','findAll','rows','params','length','find','catch'];(function(_0x43cba5,_0x4a2f83){var _0x359d1a=function(_0x888a02){while(--_0x888a02){_0x43cba5['push'](_0x43cba5['shift']());}};_0x359d1a(++_0x4a2f83);}(_0x0be9,0x1e3));var _0x90be=function(_0x4c6612,_0x8fe2c4){_0x4c6612=_0x4c6612-0x0;var _0x3db3f7=_0x0be9[_0x4c6612];return _0x3db3f7;};'use strict';var pdf=require(_0x90be('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x90be('0x1'));var zipdir=require(_0x90be('0x2'));var jsonpatch=require(_0x90be('0x3'));var rp=require(_0x90be('0x4'));var moment=require(_0x90be('0x5'));var BPromise=require(_0x90be('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90be('0x7'));var sox=require(_0x90be('0x8'));var csv=require(_0x90be('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x90be('0xa'));var crypto=require(_0x90be('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x90be('0x9'));var querystring=require(_0x90be('0xc'));var Papa=require(_0x90be('0xd'));var Redis=require(_0x90be('0xe'));var authService=require(_0x90be('0xf'));var qs=require(_0x90be('0x10'));var as=require(_0x90be('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90be('0x12'))('api');var utils=require(_0x90be('0x13'));var config=require(_0x90be('0x14'));var db=require(_0x90be('0x15'))['db'];config['redis']=_['defaults'](config[_0x90be('0x16')],{'host':_0x90be('0x17'),'port':0x18eb});var socket=require(_0x90be('0x18'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x90be('0x19')](socket);function respondWithStatusCode(_0x11215a,_0x15efde){_0x15efde=_0x15efde||0xcc;return function(_0x14f62e){if(_0x14f62e){return _0x11215a[_0x90be('0x1a')](_0x15efde);}return _0x11215a[_0x90be('0x1b')](_0x15efde)[_0x90be('0x1c')]();};}function respondWithResult(_0x355569,_0xe4af29){_0xe4af29=_0xe4af29||0xc8;return function(_0x19f077){if(_0x19f077){return _0x355569[_0x90be('0x1b')](_0xe4af29)['json'](_0x19f077);}};}function respondWithFilteredResult(_0x16d61a,_0x2e6118){return function(_0x9c600f){if(_0x9c600f){var _0x167e52=_0x9c600f[_0x90be('0x1d')],_0x484055=_0x2e6118['offset'],_0x1f77e2=_0x2e6118[_0x90be('0x1e')]+_0x2e6118[_0x90be('0x1f')],_0x2bcc51;if(_0x1f77e2>=_0x167e52){_0x1f77e2=_0x167e52;_0x2bcc51=0xc8;}else{_0x2bcc51=0xce;}_0x16d61a[_0x90be('0x1b')](_0x2bcc51);return _0x16d61a['set'](_0x90be('0x20'),_0x484055+'-'+_0x1f77e2+'/'+_0x167e52)[_0x90be('0x21')](_0x9c600f);}return null;};}function patchUpdates(_0x418c6c){return function(_0x4523c1){try{jsonpatch[_0x90be('0x22')](_0x4523c1,_0x418c6c,!![]);}catch(_0x2afcda){return BPromise['reject'](_0x2afcda);}return _0x4523c1[_0x90be('0x23')]();};}function saveUpdates(_0x9b8d61,_0x307213){return function(_0x3c79e0){if(_0x3c79e0){return _0x3c79e0[_0x90be('0x24')](_0x9b8d61)[_0x90be('0x25')](function(_0x4b6271){return _0x4b6271;});}return null;};}function removeEntity(_0x4fbe1a,_0x588dd1){return function(_0x513915){if(_0x513915){return _0x513915['destroy']()['then'](function(){var _0x5b6a35=_0x513915['get']({'plain':!![]});var _0x22535a=_0x90be('0x26');return db[_0x90be('0x27')][_0x90be('0x28')]({'where':{'type':_0x22535a,'resourceId':_0x5b6a35['id']}})[_0x90be('0x25')](function(){return _0x513915;});})[_0x90be('0x25')](function(){_0x4fbe1a[_0x90be('0x1b')](0xcc)[_0x90be('0x1c')]();});}};}function handleEntityNotFound(_0x5342ad,_0x5c93f3){return function(_0x2c5d06){if(!_0x2c5d06){_0x5342ad['sendStatus'](0x194);}return _0x2c5d06;};}function handleError(_0x520cbf,_0x226e4f){_0x226e4f=_0x226e4f||0x1f4;return function(_0x3b6301){logger['error'](_0x3b6301['stack']);if(_0x3b6301[_0x90be('0x29')]){delete _0x3b6301['name'];}_0x520cbf['status'](_0x226e4f)[_0x90be('0x2a')](_0x3b6301);};}exports[_0x90be('0x2b')]=function(_0x1cea5c,_0x7383ce){var _0x4ffb21={},_0x1bf3ac={},_0x1395da={'count':0x0,'rows':[]};var _0x518bed=_[_0x90be('0x2c')](db['MailQueue'][_0x90be('0x2d')],function(_0x2cfb1a){return{'name':_0x2cfb1a[_0x90be('0x2e')],'type':_0x2cfb1a[_0x90be('0x2f')][_0x90be('0x30')]};});_0x1bf3ac['model']=_[_0x90be('0x2c')](_0x518bed,_0x90be('0x29'));_0x1bf3ac[_0x90be('0x31')]=_[_0x90be('0x32')](_0x1cea5c[_0x90be('0x31')]);_0x1bf3ac[_0x90be('0x33')]=_[_0x90be('0x34')](_0x1bf3ac[_0x90be('0x35')],_0x1bf3ac[_0x90be('0x31')]);_0x4ffb21[_0x90be('0x36')]=_['intersection'](_0x1bf3ac[_0x90be('0x35')],qs[_0x90be('0x37')](_0x1cea5c['query']['fields']));_0x4ffb21[_0x90be('0x36')]=_0x4ffb21[_0x90be('0x36')]['length']?_0x4ffb21['attributes']:_0x1bf3ac[_0x90be('0x35')];if(!_0x1cea5c[_0x90be('0x31')][_0x90be('0x38')](_0x90be('0x39'))){_0x4ffb21['limit']=qs[_0x90be('0x1f')](_0x1cea5c[_0x90be('0x31')][_0x90be('0x1f')]);_0x4ffb21[_0x90be('0x1e')]=qs[_0x90be('0x1e')](_0x1cea5c[_0x90be('0x31')]['offset']);}_0x4ffb21['order']=qs['sort'](_0x1cea5c[_0x90be('0x31')][_0x90be('0x3a')]);_0x4ffb21[_0x90be('0x3b')]=qs[_0x90be('0x33')](_['pick'](_0x1cea5c[_0x90be('0x31')],_0x1bf3ac['filters']),_0x518bed);if(_0x1cea5c[_0x90be('0x31')][_0x90be('0x3c')]){_0x4ffb21['where']=_['merge'](_0x4ffb21[_0x90be('0x3b')],{'$or':_[_0x90be('0x2c')](_0x518bed,function(_0x5e05e8){if(_0x5e05e8[_0x90be('0x2f')]!==_0x90be('0x3d')){var _0x1da07d={};_0x1da07d[_0x5e05e8[_0x90be('0x29')]]={'$like':'%'+_0x1cea5c[_0x90be('0x31')][_0x90be('0x3c')]+'%'};return _0x1da07d;}})});}_0x4ffb21=_[_0x90be('0x3e')]({},_0x4ffb21,_0x1cea5c[_0x90be('0x3f')]);var _0x5dc0a7={'where':_0x4ffb21['where']};return db['MailQueue']['count'](_0x5dc0a7)[_0x90be('0x25')](function(_0x27748e){_0x1395da[_0x90be('0x1d')]=_0x27748e;if(_0x1cea5c[_0x90be('0x31')][_0x90be('0x40')]){_0x4ffb21[_0x90be('0x41')]=[{'all':!![]}];}return db[_0x90be('0x42')][_0x90be('0x43')](_0x4ffb21);})[_0x90be('0x25')](function(_0x500e5e){_0x1395da[_0x90be('0x44')]=_0x500e5e;return _0x1395da;})['then'](respondWithFilteredResult(_0x7383ce,_0x4ffb21))['catch'](handleError(_0x7383ce,null));};exports['show']=function(_0x52f7d2,_0x39f0ca){var _0x4c6f60={'raw':!![],'where':{'id':_0x52f7d2[_0x90be('0x45')]['id']}},_0x132981={};_0x132981[_0x90be('0x35')]=_[_0x90be('0x32')](db[_0x90be('0x42')][_0x90be('0x2d')]);_0x132981[_0x90be('0x31')]=_[_0x90be('0x32')](_0x52f7d2['query']);_0x132981['filters']=_[_0x90be('0x34')](_0x132981[_0x90be('0x35')],_0x132981[_0x90be('0x31')]);_0x4c6f60['attributes']=_[_0x90be('0x34')](_0x132981['model'],qs[_0x90be('0x37')](_0x52f7d2['query'][_0x90be('0x37')]));_0x4c6f60[_0x90be('0x36')]=_0x4c6f60[_0x90be('0x36')][_0x90be('0x46')]?_0x4c6f60[_0x90be('0x36')]:_0x132981['model'];if(_0x52f7d2[_0x90be('0x31')][_0x90be('0x40')]){_0x4c6f60[_0x90be('0x41')]=[{'all':!![]}];}_0x4c6f60=_[_0x90be('0x3e')]({},_0x4c6f60,_0x52f7d2['options']);return db[_0x90be('0x42')][_0x90be('0x47')](_0x4c6f60)[_0x90be('0x25')](handleEntityNotFound(_0x39f0ca,null))[_0x90be('0x25')](respondWithResult(_0x39f0ca,null))[_0x90be('0x48')](handleError(_0x39f0ca,null));};exports[_0x90be('0x49')]=function(_0x36e41b,_0x513b72){return db[_0x90be('0x42')][_0x90be('0x49')](_0x36e41b[_0x90be('0x4a')],{})[_0x90be('0x25')](function(_0x51254d){var _0x20197d=_0x36e41b['user'][_0x90be('0x4b')]({'plain':!![]});if(!_0x20197d)throw new Error(_0x90be('0x4c'));if(_0x20197d[_0x90be('0x4d')]===_0x90be('0x4e')){var _0x20ab94=_0x51254d['get']({'plain':!![]});var _0x3e1465=_0x90be('0x26');return db['UserProfileSection'][_0x90be('0x47')]({'where':{'name':_0x3e1465,'userProfileId':_0x20197d[_0x90be('0x4f')]},'raw':!![]})[_0x90be('0x25')](function(_0xde9b27){if(_0xde9b27&&_0xde9b27[_0x90be('0x50')]===0x0){return db[_0x90be('0x27')][_0x90be('0x49')]({'name':_0x20ab94['name'],'resourceId':_0x20ab94['id'],'type':_0xde9b27[_0x90be('0x29')],'sectionId':_0xde9b27['id']},{})[_0x90be('0x25')](function(){return _0x51254d;});}else{return _0x51254d;}})['catch'](function(_0xf291dd){logger[_0x90be('0x51')](_0x90be('0x52'),_0xf291dd);throw _0xf291dd;});}return _0x51254d;})[_0x90be('0x25')](respondWithResult(_0x513b72,0xc9))[_0x90be('0x48')](handleError(_0x513b72,null));};exports['update']=function(_0x69f185,_0x17b05b){if(_0x69f185[_0x90be('0x4a')]['id']){delete _0x69f185['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x69f185['params']['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x17b05b,null))[_0x90be('0x25')](saveUpdates(_0x69f185['body'],null))['then'](respondWithResult(_0x17b05b,null))[_0x90be('0x48')](handleError(_0x17b05b,null));};exports[_0x90be('0x28')]=function(_0x4813f6,_0x440227){return db[_0x90be('0x42')][_0x90be('0x47')]({'where':{'id':_0x4813f6[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x440227,null))[_0x90be('0x25')](removeEntity(_0x440227,null))[_0x90be('0x48')](handleError(_0x440227,null));};exports['describe']=function(_0xdee6a1,_0x584a4a){return db[_0x90be('0x42')][_0x90be('0x53')]()[_0x90be('0x25')](respondWithResult(_0x584a4a,null))['catch'](handleError(_0x584a4a,null));};exports[_0x90be('0x54')]=function(_0x24dd4e,_0x110d01,_0x2e3d65){var _0xcac5e9={'raw':!![],'where':{}},_0x14f22b={},_0x32bbec;return db[_0x90be('0x42')][_0x90be('0x55')]({'where':{'id':_0x24dd4e[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x110d01,null))['then'](function(_0x489a9a){if(_0x489a9a){_0x32bbec=_0x489a9a[_0x90be('0x4b')]({'plain':!![]});_0x14f22b['model']=_[_0x90be('0x32')](db[_0x90be('0x56')]['rawAttributes']);_0x14f22b[_0x90be('0x31')]=_[_0x90be('0x32')](_0x24dd4e[_0x90be('0x31')]);_0x14f22b[_0x90be('0x33')]=_[_0x90be('0x34')](_0x14f22b[_0x90be('0x35')],_0x14f22b[_0x90be('0x31')]);_0xcac5e9[_0x90be('0x36')]=_[_0x90be('0x34')](_0x14f22b['model'],qs['fields'](_0x24dd4e[_0x90be('0x31')][_0x90be('0x37')]));_0xcac5e9[_0x90be('0x36')]=_0xcac5e9[_0x90be('0x36')][_0x90be('0x46')]?_0xcac5e9['attributes']:_0x14f22b[_0x90be('0x35')];if(!_0x24dd4e[_0x90be('0x31')][_0x90be('0x38')](_0x90be('0x39'))){_0xcac5e9[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x24dd4e[_0x90be('0x31')][_0x90be('0x1f')]);_0xcac5e9[_0x90be('0x1e')]=qs['offset'](_0x24dd4e['query'][_0x90be('0x1e')]);}_0xcac5e9['order']=qs[_0x90be('0x3a')](_0x24dd4e['query'][_0x90be('0x3a')]);_0xcac5e9['where']=qs[_0x90be('0x33')](_['pick'](_0x24dd4e[_0x90be('0x31')],_0x14f22b[_0x90be('0x33')]));_0xcac5e9[_0x90be('0x3b')][_0x90be('0x57')]=_0x489a9a['id'];if(_0x24dd4e[_0x90be('0x31')][_0x90be('0x3c')]){_0xcac5e9[_0x90be('0x3b')]=_[_0x90be('0x3e')](_0xcac5e9[_0x90be('0x3b')],{'$or':_[_0x90be('0x2c')](_0xcac5e9[_0x90be('0x36')],function(_0x57581f){var _0x333a2a={};_0x333a2a[_0x57581f]={'$like':'%'+_0x24dd4e[_0x90be('0x31')][_0x90be('0x3c')]+'%'};return _0x333a2a;})});}_0xcac5e9=_['merge']({},_0xcac5e9,_0x24dd4e[_0x90be('0x3f')]);return db[_0x90be('0x56')]['findAll'](_0xcac5e9);}})['then'](function(_0x852095){if(_0x852095){return db['User'][_0x90be('0x58')]({'where':{'id':_[_0x90be('0x2c')](_0x852095,_0x90be('0x59')),'role':'agent'},'attributes':['id',_0x90be('0x29'),_0x90be('0x5a'),_0x90be('0x5b'),'createdAt']});}})[_0x90be('0x25')](function(_0x443a59){if(_0x443a59){return{'count':_0x443a59[_0x90be('0x1d')],'rows':_[_0x90be('0x2c')](_0x443a59[_0x90be('0x44')],function(_0x2c26c5){return{'membername':_0x2c26c5[_0x90be('0x29')],'UserId':_0x2c26c5['id'],'queue_name':_0x32bbec['name'],'MailQueueId':_0x32bbec['id'],'interface':util[_0x90be('0x5c')](_0x90be('0x5d'),_0x90be('0x5e'),_0x2c26c5[_0x90be('0x29')]),'penalty':0x0,'paused':_0x2c26c5[_0x90be('0x5a')],'createdAt':_0x2c26c5[_0x90be('0x5f')],'updatedAt':_0x2c26c5[_0x90be('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x90be('0x25')](respondWithFilteredResult(_0x110d01,_0xcac5e9))['catch'](handleError(_0x110d01,null));};exports[_0x90be('0x60')]=function(_0xbbc425,_0x166708,_0x4c6a00){var _0x1095a7={};var _0x3ca8b7={};var _0x5000ed;var _0x58fe5e;return db[_0x90be('0x42')][_0x90be('0x55')]({'where':{'id':_0xbbc425[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x166708,null))[_0x90be('0x25')](function(_0x20cf19){if(_0x20cf19){_0x5000ed=_0x20cf19;_0x3ca8b7[_0x90be('0x35')]=_[_0x90be('0x32')](db[_0x90be('0x61')][_0x90be('0x2d')]);_0x3ca8b7[_0x90be('0x31')]=_[_0x90be('0x32')](_0xbbc425['query']);_0x3ca8b7[_0x90be('0x33')]=_[_0x90be('0x34')](_0x3ca8b7[_0x90be('0x35')],_0x3ca8b7[_0x90be('0x31')]);_0x1095a7[_0x90be('0x36')]=_['intersection'](_0x3ca8b7[_0x90be('0x35')],qs['fields'](_0xbbc425['query'][_0x90be('0x37')]));_0x1095a7['attributes']=_0x1095a7[_0x90be('0x36')][_0x90be('0x46')]?_0x1095a7['attributes']:_0x3ca8b7[_0x90be('0x35')];_0x1095a7['order']=qs[_0x90be('0x3a')](_0xbbc425[_0x90be('0x31')][_0x90be('0x3a')]);_0x1095a7['where']=qs[_0x90be('0x33')](_[_0x90be('0x62')](_0xbbc425[_0x90be('0x31')],_0x3ca8b7[_0x90be('0x33')]));if(_0xbbc425[_0x90be('0x31')][_0x90be('0x3c')]){_0x1095a7[_0x90be('0x3b')]=_[_0x90be('0x3e')](_0x1095a7['where'],{'$or':_[_0x90be('0x2c')](_0x1095a7[_0x90be('0x36')],function(_0x39f1df){var _0x237029={};_0x237029[_0x39f1df]={'$like':'%'+_0xbbc425[_0x90be('0x31')][_0x90be('0x3c')]+'%'};return _0x237029;})});}_0x1095a7=_[_0x90be('0x3e')]({},_0x1095a7,_0xbbc425[_0x90be('0x3f')]);return _0x5000ed['getTeams'](_0x1095a7);}})[_0x90be('0x25')](function(_0x592597){if(_0x592597){_0x58fe5e=_0x592597[_0x90be('0x46')];if(!_0xbbc425[_0x90be('0x31')][_0x90be('0x38')](_0x90be('0x39'))){_0x1095a7[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0xbbc425[_0x90be('0x31')]['limit']);_0x1095a7[_0x90be('0x1e')]=qs[_0x90be('0x1e')](_0xbbc425[_0x90be('0x31')]['offset']);}return _0x5000ed[_0x90be('0x60')](_0x1095a7);}})[_0x90be('0x25')](function(_0x50db67){if(_0x50db67){return _0x50db67?{'count':_0x58fe5e,'rows':_0x50db67}:null;}})['then'](respondWithResult(_0x166708,null))[_0x90be('0x48')](handleError(_0x166708,null));};exports[_0x90be('0x63')]=function(_0x4db05c,_0x566ef5,_0x3df0da){var _0x50e8b0=_0x4db05c[_0x90be('0x4a')][_0x90be('0x64')];return db[_0x90be('0x61')]['findAll']({'where':{'id':_0x50e8b0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x90be('0x65'),'attributes':['id',_0x90be('0x29'),_0x90be('0x66'),_0x90be('0x67'),_0x90be('0x68')],'raw':!![]}]})[_0x90be('0x25')](function(_0x4d808e){if(_0x4d808e){var _0x540aec=_[_0x90be('0x69')](_0x4d808e,function(_0x15bb4b){var _0x503ec5=_0x15bb4b[_0x90be('0x4b')]({'plain':!![]});return _0x503ec5['Agents'];});return db[_0x90be('0x42')]['find']({'where':{'id':_0x4db05c[_0x90be('0x45')]['id']}})[_0x90be('0x25')](function(_0x236335){return db[_0x90be('0x6a')][_0x90be('0x6b')](function(_0x3827f7){return _0x236335['addTeams'](_0x50e8b0,{'transaction':_0x3827f7})[_0x90be('0x25')](function(){return BPromise[_0x90be('0x6c')](_0x540aec,function(_0xe6963a){return db[_0x90be('0x56')][_0x90be('0x6d')]({'where':{'UserId':_0xe6963a['id'],'MailQueueId':_0x4db05c[_0x90be('0x45')]['id']},'transaction':_0x3827f7});});})[_0x90be('0x25')](function(){_0x540aec[_0x90be('0x6e')](function(_0x175982){socket[_0x90be('0x6f')](_0x90be('0x70'),{'UserId':_0x175982['id'],'MailQueueId':_0x236335['id']});});});});});}})[_0x90be('0x25')](respondWithStatusCode(_0x566ef5,null))[_0x90be('0x48')](handleError(_0x566ef5,null));};exports[_0x90be('0x71')]=function(_0x557c96,_0x346fbc,_0x3f81a1){return db[_0x90be('0x61')][_0x90be('0x43')]({'where':{'id':_0x557c96['query'][_0x90be('0x64')]},'attributes':['id'],'include':[{'model':db[_0x90be('0x72')],'as':_0x90be('0x65'),'attributes':['id'],'raw':!![]}]})[_0x90be('0x25')](handleEntityNotFound(_0x346fbc,null))[_0x90be('0x25')](function(_0x197331){var _0x22e4fd=_[_0x90be('0x2c')](_0x197331,'id');var _0x5d6e6d=[];var _0x5319c6=[];var _0x1d399e=squel[_0x90be('0x73')]();_0x1d399e[_0x90be('0x74')]('tq.TeamId')[_0x90be('0x75')](_0x90be('0x76'),'tq')[_0x90be('0x77')](_0x90be('0x78'),'ut',_0x90be('0x79'))[_0x90be('0x3b')]('MailQueueId\x20=\x20?',_0x557c96['params']['id']);for(var _0xeab91e=0x0;_0xeab91e<_0x197331['length'];_0xeab91e+=0x1){let _0x13dc78=_0x197331[_0xeab91e];for(var _0x3998a0=0x0;_0x3998a0<_0x13dc78[_0x90be('0x65')][_0x90be('0x46')];_0x3998a0+=0x1){let _0x3dddf8=_0x13dc78[_0x90be('0x65')][_0x3998a0];var _0x5f5941=_0x1d399e['clone']();_0x5f5941[_0x90be('0x3b')]('ut.UserId\x20=\x20?',_0x3dddf8['id']);_0x5319c6[_0x90be('0x7a')](db[_0x90be('0x6a')]['query'](_0x5f5941[_0x90be('0x7b')](),{'type':db[_0x90be('0x6a')][_0x90be('0x7c')][_0x90be('0x7d')]})[_0x90be('0x25')](function(_0x11d1c8){if(_0x11d1c8[_0x90be('0x46')]===0x1){return _0x3dddf8['id'];}else{var _0x4fbf1b=_['every'](_['map'](_0x11d1c8,_0x90be('0x7e')),function(_0x280253){return _[_0x90be('0x7f')](_0x22e4fd,_0x280253);});if(_0x4fbf1b){return _0x3dddf8['id'];}}}));}}return BPromise[_0x90be('0x80')](_0x5319c6)['then'](function(_0x2ecbf3){_0x5d6e6d=_(_0x5d6e6d)[_0x90be('0x81')](_0x2ecbf3)[_0x90be('0x82')]()[_0x90be('0x83')]();return db[_0x90be('0x42')][_0x90be('0x47')]({'where':{'id':_0x557c96[_0x90be('0x45')]['id']}})['then'](function(_0x55818d){return db[_0x90be('0x6a')][_0x90be('0x6b')](function(_0x140419){return _0x55818d[_0x90be('0x71')](_0x557c96[_0x90be('0x31')][_0x90be('0x64')],{'transaction':_0x140419})[_0x90be('0x25')](function(){if(!_[_0x90be('0x84')](_0x5d6e6d)){return _0x55818d[_0x90be('0x85')](_0x5d6e6d,{'transaction':_0x140419});}})[_0x90be('0x25')](function(){_0x5d6e6d[_0x90be('0x6e')](function(_0x448da5){socket[_0x90be('0x6f')](_0x90be('0x86'),{'UserId':_0x448da5,'MailQueueId':_0x55818d['id']});});});});});});})[_0x90be('0x25')](respondWithStatusCode(_0x346fbc,null))['catch'](handleError(_0x346fbc,null));};exports[_0x90be('0x87')]=function(_0xd01921,_0x3be7b0,_0x3dbaf0){return db[_0x90be('0x42')][_0x90be('0x47')]({'where':{'id':_0xd01921['params']['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x3be7b0,null))[_0x90be('0x25')](function(_0x4646bc){if(_0x4646bc){return _0x4646bc[_0x90be('0x87')](_0xd01921[_0x90be('0x4a')][_0x90be('0x64')],_['omit'](_0xd01921[_0x90be('0x4a')],[_0x90be('0x64'),'id'])||{})['spread'](function(_0x1045ad){for(var _0x593e7a=0x0;_0x593e7a<_0xd01921[_0x90be('0x4a')][_0x90be('0x64')]['length'];_0x593e7a+=0x1){socket[_0x90be('0x6f')](_0x90be('0x70'),{'UserId':_0xd01921[_0x90be('0x4a')][_0x90be('0x64')][_0x593e7a],'MailQueueId':_0xd01921[_0x90be('0x45')]['id']});}return _0x1045ad;});}})['then'](respondWithResult(_0x3be7b0,null))[_0x90be('0x48')](handleError(_0x3be7b0,null));};exports[_0x90be('0x85')]=function(_0x1554b7,_0x42b8c3,_0x4bc2d3){return db['MailQueue']['find']({'where':{'id':_0x1554b7['params']['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x42b8c3,null))['then'](function(_0x1d8c81){if(_0x1d8c81){return _0x1d8c81['removeAgents'](_0x1554b7[_0x90be('0x31')]['ids'])[_0x90be('0x25')](function(){if(_[_0x90be('0x88')](_0x1554b7[_0x90be('0x31')][_0x90be('0x64')])){for(var _0x3e4787=0x0;_0x3e4787<_0x1554b7['query']['ids']['length'];_0x3e4787+=0x1){socket[_0x90be('0x6f')](_0x90be('0x86'),{'UserId':Number(_0x1554b7[_0x90be('0x31')][_0x90be('0x64')][_0x3e4787]),'MailQueueId':Number(_0x1554b7[_0x90be('0x45')]['id'])});}}else{socket['emit'](_0x90be('0x86'),{'UserId':Number(_0x1554b7[_0x90be('0x31')][_0x90be('0x64')]),'MailQueueId':Number(_0x1554b7[_0x90be('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x42b8c3,null))[_0x90be('0x48')](handleError(_0x42b8c3,null));};exports[_0x90be('0x89')]=function(_0x3e4172,_0x3b15aa,_0x1a3bc7){var _0x1a45dc={};var _0x17b020={};var _0x57fae6;var _0x46f044;return db[_0x90be('0x42')]['findOne']({'where':{'id':_0x3e4172[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x3b15aa,null))['then'](function(_0x4b5310){if(_0x4b5310){_0x57fae6=_0x4b5310;_0x17b020[_0x90be('0x35')]=_[_0x90be('0x32')](db[_0x90be('0x72')][_0x90be('0x2d')]);_0x17b020[_0x90be('0x31')]=_[_0x90be('0x32')](_0x3e4172[_0x90be('0x31')]);_0x17b020[_0x90be('0x33')]=_[_0x90be('0x34')](_0x17b020[_0x90be('0x35')],_0x17b020[_0x90be('0x31')]);_0x1a45dc['attributes']=_[_0x90be('0x34')](_0x17b020[_0x90be('0x35')],qs[_0x90be('0x37')](_0x3e4172[_0x90be('0x31')][_0x90be('0x37')]));_0x1a45dc[_0x90be('0x36')]=_0x1a45dc[_0x90be('0x36')][_0x90be('0x46')]?_0x1a45dc[_0x90be('0x36')]:_0x17b020[_0x90be('0x35')];_0x1a45dc[_0x90be('0x8a')]=qs[_0x90be('0x3a')](_0x3e4172['query']['sort']);_0x1a45dc[_0x90be('0x3b')]=qs[_0x90be('0x33')](_['pick'](_0x3e4172[_0x90be('0x31')],_0x17b020[_0x90be('0x33')]));if(_0x3e4172[_0x90be('0x31')][_0x90be('0x3c')]){_0x1a45dc[_0x90be('0x3b')]=_[_0x90be('0x3e')](_0x1a45dc['where'],{'$or':_[_0x90be('0x2c')](_0x1a45dc[_0x90be('0x36')],function(_0x4cf068){var _0x11e32f={};_0x11e32f[_0x4cf068]={'$like':'%'+_0x3e4172['query']['filter']+'%'};return _0x11e32f;})});}_0x1a45dc=_[_0x90be('0x3e')]({},_0x1a45dc,_0x3e4172[_0x90be('0x3f')]);return _0x57fae6['getAgents'](_0x1a45dc);}})[_0x90be('0x25')](function(_0x1af768){if(_0x1af768){_0x46f044=_0x1af768['length'];if(!_0x3e4172[_0x90be('0x31')]['hasOwnProperty'](_0x90be('0x39'))){_0x1a45dc[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x3e4172[_0x90be('0x31')][_0x90be('0x1f')]);_0x1a45dc[_0x90be('0x1e')]=qs[_0x90be('0x1e')](_0x3e4172[_0x90be('0x31')]['offset']);}return _0x57fae6[_0x90be('0x89')](_0x1a45dc);}})[_0x90be('0x25')](function(_0x393ab8){if(_0x393ab8){return _0x393ab8?{'count':_0x46f044,'rows':_0x393ab8}:null;}})[_0x90be('0x25')](respondWithResult(_0x3b15aa,null))[_0x90be('0x48')](handleError(_0x3b15aa,null));}; \ No newline at end of file +var _0x86e5=['filter','merge','include','rows','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','MailQueueId','UserMailQueue','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','User','Agents','voicePause','flatMap','sequelize','transaction','each','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','clone','push','toString','SELECT','TeamId','union','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x228ccf,_0x5c4a09){var _0x233da0=function(_0x35aca9){while(--_0x35aca9){_0x228ccf['push'](_0x228ccf['shift']());}};_0x233da0(++_0x5c4a09);}(_0x86e5,0x14f));var _0x586e=function(_0x5a9cf0,_0x263d18){_0x5a9cf0=_0x5a9cf0-0x0;var _0x4d6b80=_0x86e5[_0x5a9cf0];return _0x4d6b80;};'use strict';var pdf=require(_0x586e('0x0'));var emlformat=require(_0x586e('0x1'));var rimraf=require(_0x586e('0x2'));var zipdir=require(_0x586e('0x3'));var jsonpatch=require(_0x586e('0x4'));var rp=require(_0x586e('0x5'));var moment=require(_0x586e('0x6'));var BPromise=require(_0x586e('0x7'));var Mustache=require(_0x586e('0x8'));var util=require(_0x586e('0x9'));var path=require(_0x586e('0xa'));var sox=require(_0x586e('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x586e('0xc'));var squel=require(_0x586e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x586e('0xe'));var querystring=require(_0x586e('0xf'));var Papa=require(_0x586e('0x10'));var Redis=require(_0x586e('0x11'));var authService=require(_0x586e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x586e('0x13'));var hardwareService=require(_0x586e('0x14'));var logger=require('../../config/logger')(_0x586e('0x15'));var utils=require('../../config/utils');var config=require(_0x586e('0x16'));var db=require(_0x586e('0x17'))['db'];config[_0x586e('0x18')]=_[_0x586e('0x19')](config[_0x586e('0x18')],{'host':_0x586e('0x1a'),'port':0x18eb});var socket=require(_0x586e('0x1b'))(new Redis(config[_0x586e('0x18')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x140e9f,_0x20c5e1){_0x20c5e1=_0x20c5e1||0xcc;return function(_0x3eed68){if(_0x3eed68){return _0x140e9f[_0x586e('0x1c')](_0x20c5e1);}return _0x140e9f[_0x586e('0x1d')](_0x20c5e1)[_0x586e('0x1e')]();};}function respondWithResult(_0x49875c,_0xf4a346){_0xf4a346=_0xf4a346||0xc8;return function(_0x52ac5a){if(_0x52ac5a){return _0x49875c['status'](_0xf4a346)[_0x586e('0x1f')](_0x52ac5a);}};}function respondWithFilteredResult(_0x25eba6,_0x87e4fc){return function(_0x5c0a47){if(_0x5c0a47){var _0x508b23=_0x5c0a47[_0x586e('0x20')],_0x5d6b0e=_0x87e4fc[_0x586e('0x21')],_0x174e1=_0x87e4fc[_0x586e('0x21')]+_0x87e4fc[_0x586e('0x22')],_0x25ecb7;if(_0x174e1>=_0x508b23){_0x174e1=_0x508b23;_0x25ecb7=0xc8;}else{_0x25ecb7=0xce;}_0x25eba6[_0x586e('0x1d')](_0x25ecb7);return _0x25eba6[_0x586e('0x23')](_0x586e('0x24'),_0x5d6b0e+'-'+_0x174e1+'/'+_0x508b23)[_0x586e('0x1f')](_0x5c0a47);}return null;};}function patchUpdates(_0xa8ae72){return function(_0x438d75){try{jsonpatch['apply'](_0x438d75,_0xa8ae72,!![]);}catch(_0x438d2d){return BPromise['reject'](_0x438d2d);}return _0x438d75['save']();};}function saveUpdates(_0x17f6ee,_0x2c593b){return function(_0x3234e7){if(_0x3234e7){return _0x3234e7[_0x586e('0x25')](_0x17f6ee)[_0x586e('0x26')](function(_0x528c4f){return _0x528c4f;});}return null;};}function removeEntity(_0x564a5a,_0x41fabe){return function(_0x55891a){if(_0x55891a){return _0x55891a[_0x586e('0x27')]()[_0x586e('0x26')](function(){var _0x4dbe0e=_0x55891a[_0x586e('0x28')]({'plain':!![]});var _0x49debf=_0x586e('0x29');return db[_0x586e('0x2a')][_0x586e('0x27')]({'where':{'type':_0x49debf,'resourceId':_0x4dbe0e['id']}})[_0x586e('0x26')](function(){return _0x55891a;});})[_0x586e('0x26')](function(){_0x564a5a[_0x586e('0x1d')](0xcc)[_0x586e('0x1e')]();});}};}function handleEntityNotFound(_0x575fe2,_0x28d364){return function(_0x7d9eaa){if(!_0x7d9eaa){_0x575fe2[_0x586e('0x1c')](0x194);}return _0x7d9eaa;};}function handleError(_0x3fa513,_0x2425f8){_0x2425f8=_0x2425f8||0x1f4;return function(_0x462955){logger[_0x586e('0x2b')](_0x462955[_0x586e('0x2c')]);if(_0x462955[_0x586e('0x2d')]){delete _0x462955['name'];}_0x3fa513['status'](_0x2425f8)['send'](_0x462955);};}exports[_0x586e('0x2e')]=function(_0x38e70c,_0x46fdfc){var _0xe5abb8={},_0xf78e4e={},_0x4843a5={'count':0x0,'rows':[]};var _0x5c45ba=_[_0x586e('0x2f')](db[_0x586e('0x30')][_0x586e('0x31')],function(_0x5e9c5e){return{'name':_0x5e9c5e[_0x586e('0x32')],'type':_0x5e9c5e[_0x586e('0x33')][_0x586e('0x34')]};});_0xf78e4e['model']=_[_0x586e('0x2f')](_0x5c45ba,_0x586e('0x2d'));_0xf78e4e[_0x586e('0x35')]=_[_0x586e('0x36')](_0x38e70c[_0x586e('0x35')]);_0xf78e4e[_0x586e('0x37')]=_[_0x586e('0x38')](_0xf78e4e[_0x586e('0x39')],_0xf78e4e[_0x586e('0x35')]);_0xe5abb8['attributes']=_[_0x586e('0x38')](_0xf78e4e[_0x586e('0x39')],qs[_0x586e('0x3a')](_0x38e70c[_0x586e('0x35')][_0x586e('0x3a')]));_0xe5abb8['attributes']=_0xe5abb8['attributes'][_0x586e('0x3b')]?_0xe5abb8[_0x586e('0x3c')]:_0xf78e4e[_0x586e('0x39')];if(!_0x38e70c[_0x586e('0x35')][_0x586e('0x3d')](_0x586e('0x3e'))){_0xe5abb8[_0x586e('0x22')]=qs['limit'](_0x38e70c['query'][_0x586e('0x22')]);_0xe5abb8[_0x586e('0x21')]=qs['offset'](_0x38e70c[_0x586e('0x35')][_0x586e('0x21')]);}_0xe5abb8[_0x586e('0x3f')]=qs['sort'](_0x38e70c[_0x586e('0x35')][_0x586e('0x40')]);_0xe5abb8[_0x586e('0x41')]=qs[_0x586e('0x37')](_[_0x586e('0x42')](_0x38e70c[_0x586e('0x35')],_0xf78e4e[_0x586e('0x37')]),_0x5c45ba);if(_0x38e70c[_0x586e('0x35')][_0x586e('0x43')]){_0xe5abb8[_0x586e('0x41')]=_[_0x586e('0x44')](_0xe5abb8[_0x586e('0x41')],{'$or':_[_0x586e('0x2f')](_0x5c45ba,function(_0x3a7137){if(_0x3a7137['type']!=='VIRTUAL'){var _0x4af655={};_0x4af655[_0x3a7137[_0x586e('0x2d')]]={'$like':'%'+_0x38e70c[_0x586e('0x35')][_0x586e('0x43')]+'%'};return _0x4af655;}})});}_0xe5abb8=_['merge']({},_0xe5abb8,_0x38e70c['options']);var _0x142966={'where':_0xe5abb8['where']};return db[_0x586e('0x30')]['count'](_0x142966)[_0x586e('0x26')](function(_0xf94bf3){_0x4843a5[_0x586e('0x20')]=_0xf94bf3;if(_0x38e70c[_0x586e('0x35')]['includeAll']){_0xe5abb8[_0x586e('0x45')]=[{'all':!![]}];}return db[_0x586e('0x30')]['findAll'](_0xe5abb8);})[_0x586e('0x26')](function(_0x5bdee8){_0x4843a5[_0x586e('0x46')]=_0x5bdee8;return _0x4843a5;})[_0x586e('0x26')](respondWithFilteredResult(_0x46fdfc,_0xe5abb8))[_0x586e('0x47')](handleError(_0x46fdfc,null));};exports[_0x586e('0x48')]=function(_0x4d0d6d,_0x46d5d9){var _0x5519a7={'raw':!![],'where':{'id':_0x4d0d6d[_0x586e('0x49')]['id']}},_0x4a81ea={};_0x4a81ea['model']=_[_0x586e('0x36')](db[_0x586e('0x30')][_0x586e('0x31')]);_0x4a81ea['query']=_[_0x586e('0x36')](_0x4d0d6d['query']);_0x4a81ea[_0x586e('0x37')]=_[_0x586e('0x38')](_0x4a81ea['model'],_0x4a81ea[_0x586e('0x35')]);_0x5519a7[_0x586e('0x3c')]=_[_0x586e('0x38')](_0x4a81ea[_0x586e('0x39')],qs['fields'](_0x4d0d6d['query'][_0x586e('0x3a')]));_0x5519a7[_0x586e('0x3c')]=_0x5519a7[_0x586e('0x3c')][_0x586e('0x3b')]?_0x5519a7['attributes']:_0x4a81ea[_0x586e('0x39')];if(_0x4d0d6d[_0x586e('0x35')][_0x586e('0x4a')]){_0x5519a7[_0x586e('0x45')]=[{'all':!![]}];}_0x5519a7=_[_0x586e('0x44')]({},_0x5519a7,_0x4d0d6d[_0x586e('0x4b')]);return db[_0x586e('0x30')][_0x586e('0x4c')](_0x5519a7)[_0x586e('0x26')](handleEntityNotFound(_0x46d5d9,null))['then'](respondWithResult(_0x46d5d9,null))[_0x586e('0x47')](handleError(_0x46d5d9,null));};exports[_0x586e('0x4d')]=function(_0x454763,_0x5012ea){return db['MailQueue'][_0x586e('0x4d')](_0x454763[_0x586e('0x4e')],{})[_0x586e('0x26')](function(_0x42b573){var _0x14f2f7=_0x454763['user'][_0x586e('0x28')]({'plain':!![]});if(!_0x14f2f7)throw new Error(_0x586e('0x4f'));if(_0x14f2f7[_0x586e('0x50')]===_0x586e('0x51')){var _0xd9098c=_0x42b573[_0x586e('0x28')]({'plain':!![]});var _0x2f3d4f=_0x586e('0x29');return db['UserProfileSection'][_0x586e('0x4c')]({'where':{'name':_0x2f3d4f,'userProfileId':_0x14f2f7[_0x586e('0x52')]},'raw':!![]})[_0x586e('0x26')](function(_0x5e8399){if(_0x5e8399&&_0x5e8399[_0x586e('0x53')]===0x0){return db[_0x586e('0x2a')][_0x586e('0x4d')]({'name':_0xd9098c[_0x586e('0x2d')],'resourceId':_0xd9098c['id'],'type':_0x5e8399[_0x586e('0x2d')],'sectionId':_0x5e8399['id']},{})[_0x586e('0x26')](function(){return _0x42b573;});}else{return _0x42b573;}})['catch'](function(_0x5f4097){logger['error'](_0x586e('0x54'),_0x5f4097);throw _0x5f4097;});}return _0x42b573;})[_0x586e('0x26')](respondWithResult(_0x5012ea,0xc9))['catch'](handleError(_0x5012ea,null));};exports[_0x586e('0x25')]=function(_0x4ce65b,_0x2009d2){if(_0x4ce65b[_0x586e('0x4e')]['id']){delete _0x4ce65b['body']['id'];}return db[_0x586e('0x30')][_0x586e('0x4c')]({'where':{'id':_0x4ce65b['params']['id']}})[_0x586e('0x26')](handleEntityNotFound(_0x2009d2,null))[_0x586e('0x26')](saveUpdates(_0x4ce65b[_0x586e('0x4e')],null))[_0x586e('0x26')](respondWithResult(_0x2009d2,null))[_0x586e('0x47')](handleError(_0x2009d2,null));};exports[_0x586e('0x27')]=function(_0x1befdf,_0x5e2f08){return db['MailQueue'][_0x586e('0x4c')]({'where':{'id':_0x1befdf[_0x586e('0x49')]['id']}})[_0x586e('0x26')](handleEntityNotFound(_0x5e2f08,null))[_0x586e('0x26')](removeEntity(_0x5e2f08,null))['catch'](handleError(_0x5e2f08,null));};exports['describe']=function(_0x47cf3f,_0x2a5c21){return db['MailQueue'][_0x586e('0x55')]()[_0x586e('0x26')](respondWithResult(_0x2a5c21,null))[_0x586e('0x47')](handleError(_0x2a5c21,null));};exports[_0x586e('0x56')]=function(_0x593eed,_0xc5c118,_0xc7634f){var _0x126714={'raw':!![],'where':{}},_0x39b4c9={},_0x2db71c;return db[_0x586e('0x30')][_0x586e('0x57')]({'where':{'id':_0x593eed[_0x586e('0x49')]['id']}})['then'](handleEntityNotFound(_0xc5c118,null))[_0x586e('0x26')](function(_0x2a93dc){if(_0x2a93dc){_0x2db71c=_0x2a93dc[_0x586e('0x28')]({'plain':!![]});_0x39b4c9['model']=_[_0x586e('0x36')](db['UserMailQueue'][_0x586e('0x31')]);_0x39b4c9[_0x586e('0x35')]=_[_0x586e('0x36')](_0x593eed[_0x586e('0x35')]);_0x39b4c9[_0x586e('0x37')]=_[_0x586e('0x38')](_0x39b4c9[_0x586e('0x39')],_0x39b4c9[_0x586e('0x35')]);_0x126714['attributes']=_[_0x586e('0x38')](_0x39b4c9[_0x586e('0x39')],qs[_0x586e('0x3a')](_0x593eed[_0x586e('0x35')][_0x586e('0x3a')]));_0x126714[_0x586e('0x3c')]=_0x126714['attributes'][_0x586e('0x3b')]?_0x126714[_0x586e('0x3c')]:_0x39b4c9[_0x586e('0x39')];if(!_0x593eed[_0x586e('0x35')][_0x586e('0x3d')](_0x586e('0x3e'))){_0x126714[_0x586e('0x22')]=qs[_0x586e('0x22')](_0x593eed['query'][_0x586e('0x22')]);_0x126714['offset']=qs[_0x586e('0x21')](_0x593eed['query'][_0x586e('0x21')]);}_0x126714[_0x586e('0x3f')]=qs['sort'](_0x593eed[_0x586e('0x35')][_0x586e('0x40')]);_0x126714['where']=qs['filters'](_[_0x586e('0x42')](_0x593eed[_0x586e('0x35')],_0x39b4c9['filters']));_0x126714[_0x586e('0x41')][_0x586e('0x58')]=_0x2a93dc['id'];if(_0x593eed[_0x586e('0x35')][_0x586e('0x43')]){_0x126714[_0x586e('0x41')]=_[_0x586e('0x44')](_0x126714[_0x586e('0x41')],{'$or':_[_0x586e('0x2f')](_0x126714[_0x586e('0x3c')],function(_0x523b38){var _0x4969ec={};_0x4969ec[_0x523b38]={'$like':'%'+_0x593eed[_0x586e('0x35')]['filter']+'%'};return _0x4969ec;})});}_0x126714=_['merge']({},_0x126714,_0x593eed['options']);return db[_0x586e('0x59')][_0x586e('0x5a')](_0x126714);}})[_0x586e('0x26')](function(_0x231214){if(_0x231214){return db['User'][_0x586e('0x5b')]({'where':{'id':_[_0x586e('0x2f')](_0x231214,_0x586e('0x5c')),'role':_0x586e('0x5d')},'attributes':['id',_0x586e('0x2d'),_0x586e('0x5e'),_0x586e('0x5f'),_0x586e('0x60')]});}})[_0x586e('0x26')](function(_0x418864){if(_0x418864){return{'count':_0x418864[_0x586e('0x20')],'rows':_[_0x586e('0x2f')](_0x418864[_0x586e('0x46')],function(_0x564547){return{'membername':_0x564547[_0x586e('0x2d')],'UserId':_0x564547['id'],'queue_name':_0x2db71c['name'],'MailQueueId':_0x2db71c['id'],'interface':util[_0x586e('0x61')]('%s/%s',_0x586e('0x62'),_0x564547[_0x586e('0x2d')]),'penalty':0x0,'paused':_0x564547['mailPause'],'createdAt':_0x564547['createdAt'],'updatedAt':_0x564547[_0x586e('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x586e('0x26')](respondWithFilteredResult(_0xc5c118,_0x126714))[_0x586e('0x47')](handleError(_0xc5c118,null));};exports['getTeams']=function(_0x4f0697,_0x2e754a,_0x3e533b){var _0x42b5c2={};var _0x4aebc4={};var _0x511473;var _0x16a060;return db['MailQueue'][_0x586e('0x57')]({'where':{'id':_0x4f0697[_0x586e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e754a,null))['then'](function(_0x24e2a6){if(_0x24e2a6){_0x511473=_0x24e2a6;_0x4aebc4[_0x586e('0x39')]=_[_0x586e('0x36')](db[_0x586e('0x63')][_0x586e('0x31')]);_0x4aebc4[_0x586e('0x35')]=_[_0x586e('0x36')](_0x4f0697[_0x586e('0x35')]);_0x4aebc4[_0x586e('0x37')]=_[_0x586e('0x38')](_0x4aebc4[_0x586e('0x39')],_0x4aebc4['query']);_0x42b5c2[_0x586e('0x3c')]=_['intersection'](_0x4aebc4[_0x586e('0x39')],qs['fields'](_0x4f0697[_0x586e('0x35')][_0x586e('0x3a')]));_0x42b5c2[_0x586e('0x3c')]=_0x42b5c2[_0x586e('0x3c')][_0x586e('0x3b')]?_0x42b5c2['attributes']:_0x4aebc4[_0x586e('0x39')];_0x42b5c2[_0x586e('0x3f')]=qs[_0x586e('0x40')](_0x4f0697[_0x586e('0x35')][_0x586e('0x40')]);_0x42b5c2[_0x586e('0x41')]=qs['filters'](_['pick'](_0x4f0697['query'],_0x4aebc4[_0x586e('0x37')]));if(_0x4f0697[_0x586e('0x35')]['filter']){_0x42b5c2[_0x586e('0x41')]=_[_0x586e('0x44')](_0x42b5c2[_0x586e('0x41')],{'$or':_[_0x586e('0x2f')](_0x42b5c2[_0x586e('0x3c')],function(_0x2d1b10){var _0x30fafc={};_0x30fafc[_0x2d1b10]={'$like':'%'+_0x4f0697[_0x586e('0x35')][_0x586e('0x43')]+'%'};return _0x30fafc;})});}_0x42b5c2=_[_0x586e('0x44')]({},_0x42b5c2,_0x4f0697[_0x586e('0x4b')]);return _0x511473[_0x586e('0x64')](_0x42b5c2);}})['then'](function(_0xf99269){if(_0xf99269){_0x16a060=_0xf99269[_0x586e('0x3b')];if(!_0x4f0697[_0x586e('0x35')]['hasOwnProperty'](_0x586e('0x3e'))){_0x42b5c2[_0x586e('0x22')]=qs['limit'](_0x4f0697[_0x586e('0x35')][_0x586e('0x22')]);_0x42b5c2[_0x586e('0x21')]=qs['offset'](_0x4f0697[_0x586e('0x35')]['offset']);}return _0x511473[_0x586e('0x64')](_0x42b5c2);}})[_0x586e('0x26')](function(_0x4dde7a){if(_0x4dde7a){return _0x4dde7a?{'count':_0x16a060,'rows':_0x4dde7a}:null;}})[_0x586e('0x26')](respondWithResult(_0x2e754a,null))[_0x586e('0x47')](handleError(_0x2e754a,null));};exports[_0x586e('0x65')]=function(_0x3f9c1e,_0x530eb9,_0x27a24b){var _0x4a4ad7=_0x3f9c1e['body'][_0x586e('0x66')];return db[_0x586e('0x63')][_0x586e('0x5a')]({'where':{'id':_0x4a4ad7},'attributes':['id'],'include':[{'model':db[_0x586e('0x67')],'as':_0x586e('0x68'),'attributes':['id',_0x586e('0x2d'),'online',_0x586e('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x319eea){if(_0x319eea){var _0x22f0a9=_[_0x586e('0x6a')](_0x319eea,function(_0xb12383){var _0x53feee=_0xb12383['get']({'plain':!![]});return _0x53feee[_0x586e('0x68')];});return db[_0x586e('0x30')][_0x586e('0x4c')]({'where':{'id':_0x3f9c1e[_0x586e('0x49')]['id']}})[_0x586e('0x26')](function(_0x4064fa){return db[_0x586e('0x6b')][_0x586e('0x6c')](function(_0x3ee22f){return _0x4064fa[_0x586e('0x65')](_0x4a4ad7,{'transaction':_0x3ee22f})[_0x586e('0x26')](function(){return BPromise[_0x586e('0x6d')](_0x22f0a9,function(_0x445120){return db[_0x586e('0x59')]['findOrCreate']({'where':{'UserId':_0x445120['id'],'MailQueueId':_0x3f9c1e['params']['id']},'transaction':_0x3ee22f});});})[_0x586e('0x26')](function(){_0x22f0a9[_0x586e('0x6e')](function(_0x4a91be){socket['emit'](_0x586e('0x6f'),{'UserId':_0x4a91be['id'],'MailQueueId':_0x4064fa['id']});});});});});}})[_0x586e('0x26')](respondWithStatusCode(_0x530eb9,null))['catch'](handleError(_0x530eb9,null));};exports[_0x586e('0x70')]=function(_0x46b02d,_0x4ae8e1,_0x21659c){return db['Team'][_0x586e('0x5a')]({'where':{'id':_0x46b02d['query'][_0x586e('0x66')]},'attributes':['id'],'include':[{'model':db[_0x586e('0x67')],'as':_0x586e('0x68'),'attributes':['id'],'raw':!![]}]})[_0x586e('0x26')](handleEntityNotFound(_0x4ae8e1,null))['then'](function(_0x48ac6c){var _0x5c912e=_[_0x586e('0x2f')](_0x48ac6c,'id');var _0x215e0b=[];var _0x49b915=[];var _0x46c94e=squel[_0x586e('0x71')]();_0x46c94e[_0x586e('0x72')](_0x586e('0x73'))[_0x586e('0x74')]('team_has_mail_queues','tq')[_0x586e('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x46b02d['params']['id']);for(var _0x425893=0x0;_0x425893<_0x48ac6c[_0x586e('0x3b')];_0x425893+=0x1){let _0xb13a66=_0x48ac6c[_0x425893];for(var _0x336f35=0x0;_0x336f35<_0xb13a66[_0x586e('0x68')][_0x586e('0x3b')];_0x336f35+=0x1){let _0x595bdb=_0xb13a66[_0x586e('0x68')][_0x336f35];var _0x492675=_0x46c94e[_0x586e('0x76')]();_0x492675[_0x586e('0x41')]('ut.UserId\x20=\x20?',_0x595bdb['id']);_0x49b915[_0x586e('0x77')](db[_0x586e('0x6b')][_0x586e('0x35')](_0x492675[_0x586e('0x78')](),{'type':db['sequelize']['QueryTypes'][_0x586e('0x79')]})[_0x586e('0x26')](function(_0x33ea81){if(_0x33ea81[_0x586e('0x3b')]===0x1){return _0x595bdb['id'];}else{var _0x22a7d2=_['every'](_['map'](_0x33ea81,_0x586e('0x7a')),function(_0x559a13){return _['includes'](_0x5c912e,_0x559a13);});if(_0x22a7d2){return _0x595bdb['id'];}}}));}}return BPromise['all'](_0x49b915)['then'](function(_0x11346b){_0x215e0b=_(_0x215e0b)[_0x586e('0x7b')](_0x11346b)[_0x586e('0x7c')]()[_0x586e('0x7d')]();return db[_0x586e('0x30')][_0x586e('0x4c')]({'where':{'id':_0x46b02d[_0x586e('0x49')]['id']}})[_0x586e('0x26')](function(_0x19bb29){return db[_0x586e('0x6b')][_0x586e('0x6c')](function(_0x6ff693){return _0x19bb29['removeTeams'](_0x46b02d[_0x586e('0x35')][_0x586e('0x66')],{'transaction':_0x6ff693})['then'](function(){if(!_['isEmpty'](_0x215e0b)){return _0x19bb29[_0x586e('0x7e')](_0x215e0b,{'transaction':_0x6ff693});}})[_0x586e('0x26')](function(){_0x215e0b[_0x586e('0x6e')](function(_0x2054aa){socket[_0x586e('0x7f')](_0x586e('0x80'),{'UserId':_0x2054aa,'MailQueueId':_0x19bb29['id']});});});});});});})[_0x586e('0x26')](respondWithStatusCode(_0x4ae8e1,null))[_0x586e('0x47')](handleError(_0x4ae8e1,null));};exports[_0x586e('0x81')]=function(_0x1856dc,_0x13df4b,_0x565140){return db[_0x586e('0x30')][_0x586e('0x4c')]({'where':{'id':_0x1856dc[_0x586e('0x49')]['id']}})[_0x586e('0x26')](handleEntityNotFound(_0x13df4b,null))[_0x586e('0x26')](function(_0x21ac57){if(_0x21ac57){return _0x21ac57['addAgents'](_0x1856dc['body'][_0x586e('0x66')],_[_0x586e('0x82')](_0x1856dc[_0x586e('0x4e')],['ids','id'])||{})[_0x586e('0x83')](function(_0x45969b){for(var _0x14db49=0x0;_0x14db49<_0x1856dc[_0x586e('0x4e')]['ids'][_0x586e('0x3b')];_0x14db49+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x1856dc[_0x586e('0x4e')]['ids'][_0x14db49],'MailQueueId':_0x1856dc[_0x586e('0x49')]['id']});}return _0x45969b;});}})[_0x586e('0x26')](respondWithResult(_0x13df4b,null))['catch'](handleError(_0x13df4b,null));};exports[_0x586e('0x7e')]=function(_0x480a5c,_0x5277ce,_0x49e2c3){return db[_0x586e('0x30')][_0x586e('0x4c')]({'where':{'id':_0x480a5c[_0x586e('0x49')]['id']}})[_0x586e('0x26')](handleEntityNotFound(_0x5277ce,null))[_0x586e('0x26')](function(_0x1ee762){if(_0x1ee762){return _0x1ee762[_0x586e('0x7e')](_0x480a5c['query'][_0x586e('0x66')])[_0x586e('0x26')](function(){if(_[_0x586e('0x84')](_0x480a5c[_0x586e('0x35')][_0x586e('0x66')])){for(var _0x3eaec0=0x0;_0x3eaec0<_0x480a5c['query'][_0x586e('0x66')][_0x586e('0x3b')];_0x3eaec0+=0x1){socket[_0x586e('0x7f')]('userMailQueue:remove',{'UserId':Number(_0x480a5c['query']['ids'][_0x3eaec0]),'MailQueueId':Number(_0x480a5c[_0x586e('0x49')]['id'])});}}else{socket[_0x586e('0x7f')]('userMailQueue:remove',{'UserId':Number(_0x480a5c[_0x586e('0x35')][_0x586e('0x66')]),'MailQueueId':Number(_0x480a5c['params']['id'])});}});}})[_0x586e('0x26')](respondWithStatusCode(_0x5277ce,null))['catch'](handleError(_0x5277ce,null));};exports[_0x586e('0x85')]=function(_0x1851be,_0x244152,_0x55de57){var _0x275dfb={};var _0x3a2e26={};var _0x44f4b9;var _0x50624e;return db[_0x586e('0x30')][_0x586e('0x57')]({'where':{'id':_0x1851be['params']['id']}})['then'](handleEntityNotFound(_0x244152,null))[_0x586e('0x26')](function(_0x4fe99a){if(_0x4fe99a){_0x44f4b9=_0x4fe99a;_0x3a2e26[_0x586e('0x39')]=_[_0x586e('0x36')](db[_0x586e('0x67')][_0x586e('0x31')]);_0x3a2e26[_0x586e('0x35')]=_[_0x586e('0x36')](_0x1851be[_0x586e('0x35')]);_0x3a2e26[_0x586e('0x37')]=_[_0x586e('0x38')](_0x3a2e26[_0x586e('0x39')],_0x3a2e26[_0x586e('0x35')]);_0x275dfb['attributes']=_['intersection'](_0x3a2e26[_0x586e('0x39')],qs['fields'](_0x1851be[_0x586e('0x35')][_0x586e('0x3a')]));_0x275dfb[_0x586e('0x3c')]=_0x275dfb[_0x586e('0x3c')][_0x586e('0x3b')]?_0x275dfb[_0x586e('0x3c')]:_0x3a2e26[_0x586e('0x39')];_0x275dfb[_0x586e('0x3f')]=qs[_0x586e('0x40')](_0x1851be[_0x586e('0x35')]['sort']);_0x275dfb[_0x586e('0x41')]=qs[_0x586e('0x37')](_[_0x586e('0x42')](_0x1851be[_0x586e('0x35')],_0x3a2e26[_0x586e('0x37')]));if(_0x1851be[_0x586e('0x35')][_0x586e('0x43')]){_0x275dfb[_0x586e('0x41')]=_[_0x586e('0x44')](_0x275dfb[_0x586e('0x41')],{'$or':_[_0x586e('0x2f')](_0x275dfb[_0x586e('0x3c')],function(_0x15480a){var _0x25c17a={};_0x25c17a[_0x15480a]={'$like':'%'+_0x1851be[_0x586e('0x35')][_0x586e('0x43')]+'%'};return _0x25c17a;})});}_0x275dfb=_[_0x586e('0x44')]({},_0x275dfb,_0x1851be['options']);return _0x44f4b9[_0x586e('0x85')](_0x275dfb);}})[_0x586e('0x26')](function(_0x39d2db){if(_0x39d2db){_0x50624e=_0x39d2db[_0x586e('0x3b')];if(!_0x1851be[_0x586e('0x35')][_0x586e('0x3d')](_0x586e('0x3e'))){_0x275dfb['limit']=qs[_0x586e('0x22')](_0x1851be[_0x586e('0x35')][_0x586e('0x22')]);_0x275dfb[_0x586e('0x21')]=qs['offset'](_0x1851be[_0x586e('0x35')][_0x586e('0x21')]);}return _0x44f4b9[_0x586e('0x85')](_0x275dfb);}})['then'](function(_0x2b19e1){if(_0x2b19e1){return _0x2b19e1?{'count':_0x50624e,'rows':_0x2b19e1}:null;}})[_0x586e('0x26')](respondWithResult(_0x244152,null))[_0x586e('0x47')](handleError(_0x244152,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 9a617ef..79f002e 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 _0x6d6b=['hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit'];(function(_0x46e700,_0x56afb1){var _0x46ec64=function(_0xe97cc1){while(--_0xe97cc1){_0x46e700['push'](_0x46e700['shift']());}};_0x46ec64(++_0x56afb1);}(_0x6d6b,0xc8));var _0xb6d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d6b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb6d6('0x0'));var MailQueue=require(_0xb6d6('0x1'))['db'][_0xb6d6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb6d6('0x3')](0x0);var events={'afterCreate':_0xb6d6('0x4'),'afterUpdate':_0xb6d6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x322433){return function(_0x554159,_0x4327ff,_0x39fb64){MailQueueEvents[_0xb6d6('0x6')](_0x322433+':'+_0x554159['id'],_0x554159);MailQueueEvents[_0xb6d6('0x6')](_0x322433,_0x554159);_0x39fb64(null);};}for(var e in events){if(events[_0xb6d6('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xb6d6('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xa6fc=['events','setMaxListeners','save','emit','hook','exports'];(function(_0x4e8d87,_0x556219){var _0x2652c0=function(_0x59edf9){while(--_0x59edf9){_0x4e8d87['push'](_0x4e8d87['shift']());}};_0x2652c0(++_0x556219);}(_0xa6fc,0xd2));var _0xca6f=function(_0x29f223,_0x1c2f6f){_0x29f223=_0x29f223-0x0;var _0x54b7d0=_0xa6fc[_0x29f223];return _0x54b7d0;};'use strict';var EventEmitter=require(_0xca6f('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xca6f('0x1')](0x0);var events={'afterCreate':_0xca6f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5020b5){return function(_0x51072c,_0xf57773,_0x2064b3){MailQueueEvents[_0xca6f('0x3')](_0x5020b5+':'+_0x51072c['id'],_0x51072c);MailQueueEvents[_0xca6f('0x3')](_0x5020b5,_0x51072c);_0x2064b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xca6f('0x4')](e,emitEvent(event));}}module[_0xca6f('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 96983d4..63faef6 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 _0xfe4c=['./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3f1aa9,_0x54983f){var _0x5d11b7=function(_0x5997b0){while(--_0x5997b0){_0x3f1aa9['push'](_0x3f1aa9['shift']());}};_0x5d11b7(++_0x54983f);}(_0xfe4c,0x1be));var _0xcfe4=function(_0x318d10,_0x5bf278){_0x318d10=_0x318d10-0x0;var _0x203b8b=_0xfe4c[_0x318d10];return _0x203b8b;};'use strict';var _=require(_0xcfe4('0x0'));var util=require(_0xcfe4('0x1'));var logger=require(_0xcfe4('0x2'))(_0xcfe4('0x3'));var moment=require(_0xcfe4('0x4'));var BPromise=require(_0xcfe4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfe4('0x6'));var rimraf=require(_0xcfe4('0x7'));var config=require(_0xcfe4('0x8'));var attributes=require(_0xcfe4('0x9'));module[_0xcfe4('0xa')]=function(_0x3c37b9,_0xd87909){return _0x3c37b9[_0xcfe4('0xb')]('MailQueue',attributes,{'tableName':_0xcfe4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a98=['./mailQueue.attributes','exports','MailQueue','mail_queues','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1830ec,_0x3130e0){var _0xa48591=function(_0x3976dd){while(--_0x3976dd){_0x1830ec['push'](_0x1830ec['shift']());}};_0xa48591(++_0x3130e0);}(_0x9a98,0x162));var _0x89a9=function(_0x1097ad,_0x1e357b){_0x1097ad=_0x1097ad-0x0;var _0x11ffcc=_0x9a98[_0x1097ad];return _0x11ffcc;};'use strict';var _=require('lodash');var util=require(_0x89a9('0x0'));var logger=require('../../config/logger')(_0x89a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x89a9('0x2'));var fs=require('fs');var path=require(_0x89a9('0x3'));var rimraf=require(_0x89a9('0x4'));var config=require(_0x89a9('0x5'));var attributes=require(_0x89a9('0x6'));module[_0x89a9('0x7')]=function(_0x1bdad4,_0x25c697){return _0x1bdad4['define'](_0x89a9('0x8'),attributes,{'tableName':_0x89a9('0x9'),'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 7968d62..200c177 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 _0x535f=['../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailQueue.socket','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','model','map','info','debug','find','raw','ShowMailQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x535f,0xb9));var _0xf535=function(_0x57c432,_0xea04b5){_0x57c432=_0x57c432-0x0;var _0x34f0bd=_0x535f[_0x57c432];return _0x34f0bd;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var moment=require('moment');var BPromise=require(_0xf535('0x1'));var rs=require(_0xf535('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf535('0x3'))['db'];var utils=require(_0xf535('0x4'));var logger=require(_0xf535('0x5'))(_0xf535('0x6'));var config=require(_0xf535('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf535('0x8')]({'port':0x232a});config[_0xf535('0x9')]=_[_0xf535('0xa')](config[_0xf535('0x9')],{'host':_0xf535('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf535('0x9')]));require(_0xf535('0xc'))['register'](socket);function respondWithRpcPromise(_0xb9f445,_0x4603d5,_0x1b0ceb){return new BPromise(function(_0x56c64b,_0x70d47b){return client['request'](_0xb9f445,_0x1b0ceb)[_0xf535('0xd')](function(_0x3c4c2c){logger['info'](_0xf535('0xe'),_0x4603d5,'request\x20sent');logger['debug'](_0xf535('0xf'),_0x4603d5,'request\x20sent',JSON[_0xf535('0x10')](_0x3c4c2c));if(_0x3c4c2c[_0xf535('0x11')]){if(_0x3c4c2c[_0xf535('0x11')][_0xf535('0x12')]===0x1f4){logger[_0xf535('0x11')](_0xf535('0xe'),_0x4603d5,_0x3c4c2c['error'][_0xf535('0x13')]);return _0x70d47b(_0x3c4c2c[_0xf535('0x11')][_0xf535('0x13')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4603d5,_0x3c4c2c[_0xf535('0x11')][_0xf535('0x13')]);return _0x56c64b(_0x3c4c2c[_0xf535('0x11')]['message']);}else{logger['info'](_0xf535('0xe'),_0x4603d5,_0xf535('0x14'));_0x56c64b(_0x3c4c2c[_0xf535('0x15')][_0xf535('0x13')]);}})[_0xf535('0x16')](function(_0x5e24e1){logger['error'](_0xf535('0xe'),_0x4603d5,_0x5e24e1);_0x70d47b(_0x5e24e1);});});}exports[_0xf535('0x17')]=function(_0x1ec605){var _0x4e3a66=this;return new Promise(function(_0x3ca920,_0x3ea52f){return db[_0xf535('0x18')][_0xf535('0x19')]({'raw':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ec605['options']?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1b')]||null:null,'attributes':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1c')]||null:null,'limit':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1d')]||null:null,'include':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1e')]?_['map'](_0x1ec605[_0xf535('0x1a')]['include'],function(_0x36e975){return{'model':db[_0x36e975[_0xf535('0x1f')]],'as':_0x36e975['as'],'attributes':_0x36e975[_0xf535('0x1c')],'include':_0x36e975[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x36e975['include'],function(_0x1c0439){return{'model':db[_0x1c0439[_0xf535('0x1f')]],'as':_0x1c0439['as'],'attributes':_0x1c0439[_0xf535('0x1c')],'include':_0x1c0439[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x1c0439[_0xf535('0x1e')],function(_0x2b4dda){return{'model':db[_0x2b4dda[_0xf535('0x1f')]],'as':_0x2b4dda['as'],'attributes':_0x2b4dda[_0xf535('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf535('0xd')](function(_0x4b78f7){logger[_0xf535('0x21')]('GetMailQueue',_0x1ec605);logger[_0xf535('0x22')](_0xf535('0x17'),_0x1ec605,JSON['stringify'](_0x4b78f7));_0x3ca920(_0x4b78f7);})[_0xf535('0x16')](function(_0x2a702f){logger[_0xf535('0x11')](_0xf535('0x17'),_0x2a702f['message'],_0x1ec605);_0x3ea52f(_0x4e3a66['error'](0x1f4,_0x2a702f[_0xf535('0x13')]));});});};exports['ShowMailQueue']=function(_0x5b6d2b){var _0x12e6f5=this;return new Promise(function(_0x3ee939,_0x5c4c07){return db['MailQueue'][_0xf535('0x23')]({'raw':_0x5b6d2b[_0xf535('0x1a')]?_0x5b6d2b[_0xf535('0x1a')][_0xf535('0x24')]===undefined?!![]:![]:!![],'where':_0x5b6d2b['options']?_0x5b6d2b[_0xf535('0x1a')][_0xf535('0x1b')]||null:null,'attributes':_0x5b6d2b[_0xf535('0x1a')]?_0x5b6d2b[_0xf535('0x1a')]['attributes']||null:null,'include':_0x5b6d2b[_0xf535('0x1a')]?_0x5b6d2b['options'][_0xf535('0x1e')]?_[_0xf535('0x20')](_0x5b6d2b[_0xf535('0x1a')][_0xf535('0x1e')],function(_0x4914cc){return{'model':db[_0x4914cc[_0xf535('0x1f')]],'as':_0x4914cc['as'],'attributes':_0x4914cc[_0xf535('0x1c')],'include':_0x4914cc[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x4914cc[_0xf535('0x1e')],function(_0x30b7c1){return{'model':db[_0x30b7c1[_0xf535('0x1f')]],'as':_0x30b7c1['as'],'attributes':_0x30b7c1[_0xf535('0x1c')],'include':_0x30b7c1[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x30b7c1[_0xf535('0x1e')],function(_0x229e9f){return{'model':db[_0x229e9f[_0xf535('0x1f')]],'as':_0x229e9f['as'],'attributes':_0x229e9f[_0xf535('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf535('0xd')](function(_0x4af4a0){logger[_0xf535('0x21')]('ShowMailQueue',_0x5b6d2b);logger['debug'](_0xf535('0x25'),_0x5b6d2b,JSON[_0xf535('0x10')](_0x4af4a0));_0x3ee939(_0x4af4a0);})[_0xf535('0x16')](function(_0x3cfea1){logger[_0xf535('0x11')](_0xf535('0x25'),_0x3cfea1[_0xf535('0x13')],_0x5b6d2b);_0x5c4c07(_0x12e6f5['error'](0x1f4,_0x3cfea1['message']));});});}; \ No newline at end of file +var _0x68eb=['client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','findAll','options','where','limit','include','map','model','attributes','MailQueue','find','raw','ShowMailQueue','lodash','util','randomstring','ioredis','../../config/logger','jayson/promise'];(function(_0x27dbfe,_0x52be07){var _0x473510=function(_0x52fae1){while(--_0x52fae1){_0x27dbfe['push'](_0x27dbfe['shift']());}};_0x473510(++_0x52be07);}(_0x68eb,0xd8));var _0xb68e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x68eb[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xb68e('0x0'));var util=require(_0xb68e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb68e('0x2'));var fs=require('fs');var Redis=require(_0xb68e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb68e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb68e('0x5'));var client=jayson[_0xb68e('0x6')]['http']({'port':0x232a});config[_0xb68e('0x7')]=_[_0xb68e('0x8')](config[_0xb68e('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xb68e('0x9'))(new Redis(config[_0xb68e('0x7')]));require(_0xb68e('0xa'))[_0xb68e('0xb')](socket);function respondWithRpcPromise(_0x6af6de,_0x3cef5a,_0x14dc9c){return new BPromise(function(_0x25a5fb,_0x445b3c){return client['request'](_0x6af6de,_0x14dc9c)[_0xb68e('0xc')](function(_0x548ba5){logger[_0xb68e('0xd')]('MailQueue,\x20%s,\x20%s',_0x3cef5a,_0xb68e('0xe'));logger[_0xb68e('0xf')](_0xb68e('0x10'),_0x3cef5a,_0xb68e('0xe'),JSON[_0xb68e('0x11')](_0x548ba5));if(_0x548ba5['error']){if(_0x548ba5[_0xb68e('0x12')][_0xb68e('0x13')]===0x1f4){logger[_0xb68e('0x12')]('MailQueue,\x20%s,\x20%s',_0x3cef5a,_0x548ba5['error'][_0xb68e('0x14')]);return _0x445b3c(_0x548ba5['error'][_0xb68e('0x14')]);}logger[_0xb68e('0x12')]('MailQueue,\x20%s,\x20%s',_0x3cef5a,_0x548ba5['error']['message']);return _0x25a5fb(_0x548ba5[_0xb68e('0x12')][_0xb68e('0x14')]);}else{logger[_0xb68e('0xd')](_0xb68e('0x15'),_0x3cef5a,_0xb68e('0xe'));_0x25a5fb(_0x548ba5[_0xb68e('0x16')][_0xb68e('0x14')]);}})[_0xb68e('0x17')](function(_0xc4476c){logger['error'](_0xb68e('0x15'),_0x3cef5a,_0xc4476c);_0x445b3c(_0xc4476c);});});}exports[_0xb68e('0x18')]=function(_0x2e474c){var _0x1ea62b=this;return new Promise(function(_0x451611,_0x5da275){return db['MailQueue'][_0xb68e('0x19')]({'raw':_0x2e474c[_0xb68e('0x1a')]?_0x2e474c[_0xb68e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2e474c[_0xb68e('0x1a')]?_0x2e474c[_0xb68e('0x1a')][_0xb68e('0x1b')]||null:null,'attributes':_0x2e474c[_0xb68e('0x1a')]?_0x2e474c['options']['attributes']||null:null,'limit':_0x2e474c[_0xb68e('0x1a')]?_0x2e474c[_0xb68e('0x1a')][_0xb68e('0x1c')]||null:null,'include':_0x2e474c[_0xb68e('0x1a')]?_0x2e474c[_0xb68e('0x1a')][_0xb68e('0x1d')]?_[_0xb68e('0x1e')](_0x2e474c[_0xb68e('0x1a')]['include'],function(_0x466dd3){return{'model':db[_0x466dd3[_0xb68e('0x1f')]],'as':_0x466dd3['as'],'attributes':_0x466dd3[_0xb68e('0x20')],'include':_0x466dd3[_0xb68e('0x1d')]?_[_0xb68e('0x1e')](_0x466dd3[_0xb68e('0x1d')],function(_0x25a9c9){return{'model':db[_0x25a9c9['model']],'as':_0x25a9c9['as'],'attributes':_0x25a9c9[_0xb68e('0x20')],'include':_0x25a9c9[_0xb68e('0x1d')]?_['map'](_0x25a9c9[_0xb68e('0x1d')],function(_0x28f372){return{'model':db[_0x28f372[_0xb68e('0x1f')]],'as':_0x28f372['as'],'attributes':_0x28f372[_0xb68e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb68e('0xc')](function(_0x3e2055){logger[_0xb68e('0xd')]('GetMailQueue',_0x2e474c);logger[_0xb68e('0xf')](_0xb68e('0x18'),_0x2e474c,JSON[_0xb68e('0x11')](_0x3e2055));_0x451611(_0x3e2055);})['catch'](function(_0xee7939){logger[_0xb68e('0x12')](_0xb68e('0x18'),_0xee7939[_0xb68e('0x14')],_0x2e474c);_0x5da275(_0x1ea62b[_0xb68e('0x12')](0x1f4,_0xee7939[_0xb68e('0x14')]));});});};exports['ShowMailQueue']=function(_0x2d6ff1){var _0x444b6d=this;return new Promise(function(_0x7a01a5,_0x15ecc7){return db[_0xb68e('0x21')][_0xb68e('0x22')]({'raw':_0x2d6ff1['options']?_0x2d6ff1[_0xb68e('0x1a')][_0xb68e('0x23')]===undefined?!![]:![]:!![],'where':_0x2d6ff1['options']?_0x2d6ff1[_0xb68e('0x1a')][_0xb68e('0x1b')]||null:null,'attributes':_0x2d6ff1[_0xb68e('0x1a')]?_0x2d6ff1['options'][_0xb68e('0x20')]||null:null,'include':_0x2d6ff1[_0xb68e('0x1a')]?_0x2d6ff1[_0xb68e('0x1a')][_0xb68e('0x1d')]?_[_0xb68e('0x1e')](_0x2d6ff1[_0xb68e('0x1a')][_0xb68e('0x1d')],function(_0x5cf6b5){return{'model':db[_0x5cf6b5[_0xb68e('0x1f')]],'as':_0x5cf6b5['as'],'attributes':_0x5cf6b5['attributes'],'include':_0x5cf6b5[_0xb68e('0x1d')]?_[_0xb68e('0x1e')](_0x5cf6b5['include'],function(_0x483bfa){return{'model':db[_0x483bfa[_0xb68e('0x1f')]],'as':_0x483bfa['as'],'attributes':_0x483bfa[_0xb68e('0x20')],'include':_0x483bfa[_0xb68e('0x1d')]?_['map'](_0x483bfa[_0xb68e('0x1d')],function(_0x55832b){return{'model':db[_0x55832b['model']],'as':_0x55832b['as'],'attributes':_0x55832b[_0xb68e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf6d7fe){logger[_0xb68e('0xd')]('ShowMailQueue',_0x2d6ff1);logger[_0xb68e('0xf')](_0xb68e('0x24'),_0x2d6ff1,JSON[_0xb68e('0x11')](_0xf6d7fe));_0x7a01a5(_0xf6d7fe);})[_0xb68e('0x17')](function(_0x22adc6){logger[_0xb68e('0x12')]('ShowMailQueue',_0x22adc6['message'],_0x2d6ff1);_0x15ecc7(_0x444b6d['error'](0x1f4,_0x22adc6[_0xb68e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index bed3fd7..3b2d26f 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 _0x4961=['./mailQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x245d40,_0x455ece){var _0x245534=function(_0x257f5d){while(--_0x257f5d){_0x245d40['push'](_0x245d40['shift']());}};_0x245534(++_0x455ece);}(_0x4961,0xe0));var _0x1496=function(_0x1de539,_0x334090){_0x1de539=_0x1de539-0x0;var _0x14582f=_0x4961[_0x1de539];return _0x14582f;};'use strict';var MailQueueEvents=require(_0x1496('0x0'));var events=[_0x1496('0x1'),_0x1496('0x2'),_0x1496('0x3')];function createListener(_0x482f58,_0x5ef43e){return function(_0x199a52){_0x5ef43e[_0x1496('0x4')](_0x482f58,_0x199a52);};}function removeListener(_0x2b49c2,_0x32acc5){return function(){MailQueueEvents[_0x1496('0x5')](_0x2b49c2,_0x32acc5);};}exports[_0x1496('0x6')]=function(_0xb7eb17){for(var _0x42000f=0x0,_0x242543=events[_0x1496('0x7')];_0x42000f<_0x242543;_0x42000f++){var _0x2f8d00=events[_0x42000f];var _0x3447aa=createListener('mailQueue:'+_0x2f8d00,_0xb7eb17);MailQueueEvents['on'](_0x2f8d00,_0x3447aa);}}; \ No newline at end of file +var _0x9893=['update','register','mailQueue:','./mailQueue.events','save'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9893,0xc6));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var MailQueueEvents=require(_0x3989('0x0'));var events=[_0x3989('0x1'),'remove',_0x3989('0x2')];function createListener(_0x5d93d6,_0x5aa84a){return function(_0x51d89f){_0x5aa84a['emit'](_0x5d93d6,_0x51d89f);};}function removeListener(_0x266056,_0x55dae0){return function(){MailQueueEvents['removeListener'](_0x266056,_0x55dae0);};}exports[_0x3989('0x3')]=function(_0x2b968f){for(var _0x2a6123=0x0,_0x1e7885=events['length'];_0x2a6123<_0x1e7885;_0x2a6123++){var _0x5b1fa3=events[_0x2a6123];var _0x4c9c94=createListener(_0x3989('0x4')+_0x5b1fa3,_0x2b968f);MailQueueEvents['on'](_0x5b1fa3,_0x4c9c94);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 91a20db..ba7aaa7 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 _0x7c99=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0x7c99,0x1b0));var _0x97c9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7c99[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x97c9('0x0'));var util=require(_0x97c9('0x1'));var path=require(_0x97c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x97c9('0x3'));var router=express[_0x97c9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x97c9('0x5'));var config=require('../../config/environment');var controller=require(_0x97c9('0x6'));router[_0x97c9('0x7')]('/',auth[_0x97c9('0x8')](),controller['index']);router[_0x97c9('0x7')](_0x97c9('0x9'),auth[_0x97c9('0x8')](),controller[_0x97c9('0xa')]);router[_0x97c9('0x7')](_0x97c9('0xb'),auth[_0x97c9('0x8')](),controller[_0x97c9('0xc')]);router[_0x97c9('0xd')]('/',auth['isAuthenticated'](),controller[_0x97c9('0xe')]);router[_0x97c9('0xf')]('/:id',auth[_0x97c9('0x8')](),controller[_0x97c9('0x10')]);router[_0x97c9('0x11')]('/:id',auth[_0x97c9('0x8')](),controller[_0x97c9('0x12')]);module[_0x97c9('0x13')]=router; \ No newline at end of file +var _0x4a0f=['isAuthenticated','index','/describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailQueueReport.controller'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x4a0f,0x187));var _0xf4a0=function(_0x9f8606,_0x4451d0){_0x9f8606=_0x9f8606-0x0;var _0x44f240=_0x4a0f[_0x9f8606];return _0x44f240;};'use strict';var multer=require(_0xf4a0('0x0'));var util=require(_0xf4a0('0x1'));var path=require(_0xf4a0('0x2'));var timeout=require(_0xf4a0('0x3'));var express=require(_0xf4a0('0x4'));var router=express['Router']();var auth=require(_0xf4a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4a0('0x6'));var controller=require(_0xf4a0('0x7'));router['get']('/',auth[_0xf4a0('0x8')](),controller[_0xf4a0('0x9')]);router['get'](_0xf4a0('0xa'),auth[_0xf4a0('0x8')](),controller['describe']);router[_0xf4a0('0xb')](_0xf4a0('0xc'),auth[_0xf4a0('0x8')](),controller[_0xf4a0('0xd')]);router[_0xf4a0('0xe')]('/',auth[_0xf4a0('0x8')](),controller[_0xf4a0('0xf')]);router[_0xf4a0('0x10')](_0xf4a0('0xc'),auth[_0xf4a0('0x8')](),controller[_0xf4a0('0x11')]);router[_0xf4a0('0x12')]('/:id',auth[_0xf4a0('0x8')](),controller[_0xf4a0('0x13')]);module[_0xf4a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 95d670b..12c8cb7 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 _0x1e9b=['moment','exports','STRING','DATE'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x1e9b,0xe4));var _0xb1e9=function(_0xfb9d2d,_0x4067c9){_0xfb9d2d=_0xfb9d2d-0x0;var _0xd2eac7=_0x1e9b[_0xfb9d2d];return _0xd2eac7;};'use strict';var moment=require(_0xb1e9('0x0'));var Sequelize=require('sequelize');module[_0xb1e9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb1e9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb1e9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb1e9('0x3')]},'reason':{'type':Sequelize[_0xb1e9('0x2')]}}; \ No newline at end of file +var _0x11a1=['exports','STRING','DATE','sequelize'];(function(_0x4145f6,_0xe5d514){var _0x38cbcf=function(_0x17866b){while(--_0x17866b){_0x4145f6['push'](_0x4145f6['shift']());}};_0x38cbcf(++_0xe5d514);}(_0x11a1,0x10b));var _0x111a=function(_0x26f1a0,_0x235ed1){_0x26f1a0=_0x26f1a0-0x0;var _0x3e22c0=_0x11a1[_0x26f1a0];return _0x3e22c0;};'use strict';var moment=require('moment');var Sequelize=require(_0x111a('0x0'));module[_0x111a('0x1')]={'uniqueid':{'type':Sequelize[_0x111a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x111a('0x3')]},'leaveAt':{'type':Sequelize[_0x111a('0x3')]},'acceptAt':{'type':Sequelize[_0x111a('0x3')]},'exitAt':{'type':Sequelize[_0x111a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 614b717..e993b2a 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 _0xf006=['api','../../config/environment','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','params','find','body','update','rimraf','zip-dir','request-promise','bluebird','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'];(function(_0x19e859,_0x333efb){var _0x481f06=function(_0x5736ee){while(--_0x5736ee){_0x19e859['push'](_0x19e859['shift']());}};_0x481f06(++_0x333efb);}(_0xf006,0x146));var _0x6f00=function(_0xa50ed7,_0x4a3a3d){_0xa50ed7=_0xa50ed7-0x0;var _0x3c6344=_0xf006[_0xa50ed7];return _0x3c6344;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f00('0x0'));var zipdir=require(_0x6f00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f00('0x2'));var moment=require('moment');var BPromise=require(_0x6f00('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f00('0x4'));var sox=require(_0x6f00('0x5'));var csv=require(_0x6f00('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x6'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var db=require(_0x6f00('0x15'))['db'];function respondWithStatusCode(_0x158817,_0x36a2ec){_0x36a2ec=_0x36a2ec||0xcc;return function(_0x289fe9){if(_0x289fe9){return _0x158817['sendStatus'](_0x36a2ec);}return _0x158817[_0x6f00('0x16')](_0x36a2ec)['end']();};}function respondWithResult(_0x30b10e,_0x5047f5){_0x5047f5=_0x5047f5||0xc8;return function(_0x324e67){if(_0x324e67){return _0x30b10e[_0x6f00('0x16')](_0x5047f5)[_0x6f00('0x17')](_0x324e67);}};}function respondWithFilteredResult(_0x33f3a2,_0xa6e7a1){return function(_0x411203){if(_0x411203){var _0x46bc2c=_0x411203[_0x6f00('0x18')],_0x4d8aee=_0xa6e7a1['offset'],_0x342c7f=_0xa6e7a1['offset']+_0xa6e7a1[_0x6f00('0x19')],_0x4bfac3;if(_0x342c7f>=_0x46bc2c){_0x342c7f=_0x46bc2c;_0x4bfac3=0xc8;}else{_0x4bfac3=0xce;}_0x33f3a2[_0x6f00('0x16')](_0x4bfac3);return _0x33f3a2[_0x6f00('0x1a')](_0x6f00('0x1b'),_0x4d8aee+'-'+_0x342c7f+'/'+_0x46bc2c)[_0x6f00('0x17')](_0x411203);}return null;};}function patchUpdates(_0x27e466){return function(_0x23fe10){try{jsonpatch[_0x6f00('0x1c')](_0x23fe10,_0x27e466,!![]);}catch(_0x9844bf){return BPromise[_0x6f00('0x1d')](_0x9844bf);}return _0x23fe10[_0x6f00('0x1e')]();};}function saveUpdates(_0x23f27a,_0x4e11de){return function(_0x4f3031){if(_0x4f3031){return _0x4f3031['update'](_0x23f27a)[_0x6f00('0x1f')](function(_0x1fd3d4){return _0x1fd3d4;});}return null;};}function removeEntity(_0x43bfb8,_0x57340f){return function(_0xe301e5){if(_0xe301e5){return _0xe301e5[_0x6f00('0x20')]()[_0x6f00('0x1f')](function(){_0x43bfb8[_0x6f00('0x16')](0xcc)[_0x6f00('0x21')]();});}};}function handleEntityNotFound(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(!_0x1ea061){_0x1cbf1c['sendStatus'](0x194);}return _0x1ea061;};}function handleError(_0x3c05ef,_0x45945e){_0x45945e=_0x45945e||0x1f4;return function(_0x1fd40b){logger['error'](_0x1fd40b[_0x6f00('0x22')]);if(_0x1fd40b['name']){delete _0x1fd40b[_0x6f00('0x23')];}_0x3c05ef['status'](_0x45945e)[_0x6f00('0x24')](_0x1fd40b);};}exports[_0x6f00('0x25')]=function(_0x7c6bcb,_0x1f84a6){var _0x375d76={},_0x49eb87={},_0x23a346={'count':0x0,'rows':[]};var _0x25cc71=_[_0x6f00('0x26')](db[_0x6f00('0x27')][_0x6f00('0x28')],function(_0x235a86){return{'name':_0x235a86[_0x6f00('0x29')],'type':_0x235a86[_0x6f00('0x2a')][_0x6f00('0x2b')]};});_0x49eb87[_0x6f00('0x2c')]=_[_0x6f00('0x26')](_0x25cc71,_0x6f00('0x23'));_0x49eb87[_0x6f00('0x2d')]=_[_0x6f00('0x2e')](_0x7c6bcb['query']);_0x49eb87['filters']=_['intersection'](_0x49eb87['model'],_0x49eb87['query']);_0x375d76['attributes']=_[_0x6f00('0x2f')](_0x49eb87['model'],qs[_0x6f00('0x30')](_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x30')]));_0x375d76[_0x6f00('0x31')]=_0x375d76[_0x6f00('0x31')][_0x6f00('0x32')]?_0x375d76['attributes']:_0x49eb87[_0x6f00('0x2c')];if(!_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x33')](_0x6f00('0x34'))){_0x375d76[_0x6f00('0x19')]=qs['limit'](_0x7c6bcb['query']['limit']);_0x375d76[_0x6f00('0x35')]=qs[_0x6f00('0x35')](_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x35')]);}_0x375d76[_0x6f00('0x36')]=qs['sort'](_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x37')]);_0x375d76[_0x6f00('0x38')]=qs[_0x6f00('0x39')](_[_0x6f00('0x3a')](_0x7c6bcb[_0x6f00('0x2d')],_0x49eb87[_0x6f00('0x39')]),_0x25cc71);if(_0x7c6bcb['query'][_0x6f00('0x3b')]){_0x375d76[_0x6f00('0x38')]=_[_0x6f00('0x3c')](_0x375d76['where'],{'$or':_[_0x6f00('0x26')](_0x25cc71,function(_0x389ff9){if(_0x389ff9[_0x6f00('0x2a')]!=='VIRTUAL'){var _0x4163fd={};_0x4163fd[_0x389ff9['name']]={'$like':'%'+_0x7c6bcb[_0x6f00('0x2d')]['filter']+'%'};return _0x4163fd;}})});}_0x375d76=_[_0x6f00('0x3c')]({},_0x375d76,_0x7c6bcb[_0x6f00('0x3d')]);var _0x37c791={'where':_0x375d76[_0x6f00('0x38')]};return db['MailQueueReport'][_0x6f00('0x18')](_0x37c791)['then'](function(_0x231bd6){_0x23a346['count']=_0x231bd6;if(_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x3e')]){_0x375d76[_0x6f00('0x3f')]=[{'all':!![]}];}return db[_0x6f00('0x27')]['findAll'](_0x375d76);})['then'](function(_0x2e745c){_0x23a346['rows']=_0x2e745c;return _0x23a346;})[_0x6f00('0x1f')](respondWithFilteredResult(_0x1f84a6,_0x375d76))[_0x6f00('0x40')](handleError(_0x1f84a6,null));};exports['show']=function(_0x2699af,_0x5dce37){var _0x4cac2c={'raw':!![],'where':{'id':_0x2699af[_0x6f00('0x41')]['id']}},_0x38da7f={};_0x38da7f[_0x6f00('0x2c')]=_[_0x6f00('0x2e')](db['MailQueueReport'][_0x6f00('0x28')]);_0x38da7f[_0x6f00('0x2d')]=_[_0x6f00('0x2e')](_0x2699af[_0x6f00('0x2d')]);_0x38da7f[_0x6f00('0x39')]=_[_0x6f00('0x2f')](_0x38da7f['model'],_0x38da7f[_0x6f00('0x2d')]);_0x4cac2c[_0x6f00('0x31')]=_[_0x6f00('0x2f')](_0x38da7f[_0x6f00('0x2c')],qs[_0x6f00('0x30')](_0x2699af[_0x6f00('0x2d')]['fields']));_0x4cac2c[_0x6f00('0x31')]=_0x4cac2c[_0x6f00('0x31')][_0x6f00('0x32')]?_0x4cac2c['attributes']:_0x38da7f[_0x6f00('0x2c')];if(_0x2699af['query'][_0x6f00('0x3e')]){_0x4cac2c[_0x6f00('0x3f')]=[{'all':!![]}];}_0x4cac2c=_['merge']({},_0x4cac2c,_0x2699af[_0x6f00('0x3d')]);return db['MailQueueReport'][_0x6f00('0x42')](_0x4cac2c)[_0x6f00('0x1f')](handleEntityNotFound(_0x5dce37,null))[_0x6f00('0x1f')](respondWithResult(_0x5dce37,null))[_0x6f00('0x40')](handleError(_0x5dce37,null));};exports['create']=function(_0x30272e,_0x59085a){return db[_0x6f00('0x27')]['create'](_0x30272e[_0x6f00('0x43')],{})[_0x6f00('0x1f')](respondWithResult(_0x59085a,0xc9))[_0x6f00('0x40')](handleError(_0x59085a,null));};exports[_0x6f00('0x44')]=function(_0x470ff3,_0x3472f0){if(_0x470ff3[_0x6f00('0x43')]['id']){delete _0x470ff3[_0x6f00('0x43')]['id'];}return db['MailQueueReport'][_0x6f00('0x42')]({'where':{'id':_0x470ff3['params']['id']}})[_0x6f00('0x1f')](handleEntityNotFound(_0x3472f0,null))[_0x6f00('0x1f')](saveUpdates(_0x470ff3[_0x6f00('0x43')],null))['then'](respondWithResult(_0x3472f0,null))['catch'](handleError(_0x3472f0,null));};exports[_0x6f00('0x20')]=function(_0x324c31,_0x494ba5){return db[_0x6f00('0x27')]['find']({'where':{'id':_0x324c31[_0x6f00('0x41')]['id']}})['then'](handleEntityNotFound(_0x494ba5,null))[_0x6f00('0x1f')](removeEntity(_0x494ba5,null))[_0x6f00('0x40')](handleError(_0x494ba5,null));};exports['describe']=function(_0x52ee5a,_0x418543){return db[_0x6f00('0x27')]['describe']()[_0x6f00('0x1f')](respondWithResult(_0x418543,null))['catch'](handleError(_0x418543,null));}; \ No newline at end of file +var _0x6631=['includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','options'];(function(_0x342299,_0x307e1c){var _0xf1dfd2=function(_0x1be4f0){while(--_0x1be4f0){_0x342299['push'](_0x342299['shift']());}};_0xf1dfd2(++_0x307e1c);}(_0x6631,0x134));var _0x1663=function(_0x43d5d3,_0x40c53c){_0x43d5d3=_0x43d5d3-0x0;var _0x5c91fd=_0x6631[_0x43d5d3];return _0x5c91fd;};'use strict';var pdf=require(_0x1663('0x0'));var emlformat=require(_0x1663('0x1'));var rimraf=require(_0x1663('0x2'));var zipdir=require(_0x1663('0x3'));var jsonpatch=require(_0x1663('0x4'));var rp=require(_0x1663('0x5'));var moment=require('moment');var BPromise=require(_0x1663('0x6'));var Mustache=require(_0x1663('0x7'));var util=require(_0x1663('0x8'));var path=require(_0x1663('0x9'));var sox=require(_0x1663('0xa'));var csv=require(_0x1663('0xb'));var ejs=require(_0x1663('0xc'));var fs=require('fs');var _=require(_0x1663('0xd'));var squel=require(_0x1663('0xe'));var crypto=require(_0x1663('0xf'));var jsforce=require(_0x1663('0x10'));var deskjs=require(_0x1663('0x11'));var toCsv=require(_0x1663('0xb'));var querystring=require('querystring');var Papa=require(_0x1663('0x12'));var Redis=require('ioredis');var authService=require(_0x1663('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1663('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1663('0x15'))(_0x1663('0x16'));var utils=require(_0x1663('0x17'));var config=require(_0x1663('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f828a,_0x204ace){_0x204ace=_0x204ace||0xcc;return function(_0x196fa7){if(_0x196fa7){return _0x3f828a['sendStatus'](_0x204ace);}return _0x3f828a['status'](_0x204ace)[_0x1663('0x19')]();};}function respondWithResult(_0x23417f,_0x57a482){_0x57a482=_0x57a482||0xc8;return function(_0xc839b9){if(_0xc839b9){return _0x23417f[_0x1663('0x1a')](_0x57a482)[_0x1663('0x1b')](_0xc839b9);}};}function respondWithFilteredResult(_0x354e28,_0x180f82){return function(_0x202a40){if(_0x202a40){var _0x26e925=_0x202a40['count'],_0x30598b=_0x180f82[_0x1663('0x1c')],_0x4b3d58=_0x180f82['offset']+_0x180f82[_0x1663('0x1d')],_0x5103a8;if(_0x4b3d58>=_0x26e925){_0x4b3d58=_0x26e925;_0x5103a8=0xc8;}else{_0x5103a8=0xce;}_0x354e28[_0x1663('0x1a')](_0x5103a8);return _0x354e28[_0x1663('0x1e')](_0x1663('0x1f'),_0x30598b+'-'+_0x4b3d58+'/'+_0x26e925)[_0x1663('0x1b')](_0x202a40);}return null;};}function patchUpdates(_0x1f4943){return function(_0x4853b2){try{jsonpatch[_0x1663('0x20')](_0x4853b2,_0x1f4943,!![]);}catch(_0xc88e88){return BPromise[_0x1663('0x21')](_0xc88e88);}return _0x4853b2[_0x1663('0x22')]();};}function saveUpdates(_0x5b27b4,_0x13a3b6){return function(_0x2b8e2d){if(_0x2b8e2d){return _0x2b8e2d[_0x1663('0x23')](_0x5b27b4)['then'](function(_0x59bbc5){return _0x59bbc5;});}return null;};}function removeEntity(_0x238882,_0x47be55){return function(_0x397898){if(_0x397898){return _0x397898[_0x1663('0x24')]()[_0x1663('0x25')](function(){_0x238882['status'](0xcc)[_0x1663('0x19')]();});}};}function handleEntityNotFound(_0xfdf8f0,_0x47257a){return function(_0x4357cf){if(!_0x4357cf){_0xfdf8f0[_0x1663('0x26')](0x194);}return _0x4357cf;};}function handleError(_0x47121c,_0x9cab46){_0x9cab46=_0x9cab46||0x1f4;return function(_0x3980d9){logger['error'](_0x3980d9[_0x1663('0x27')]);if(_0x3980d9[_0x1663('0x28')]){delete _0x3980d9[_0x1663('0x28')];}_0x47121c[_0x1663('0x1a')](_0x9cab46)[_0x1663('0x29')](_0x3980d9);};}exports['index']=function(_0x4e3aa0,_0x470e0d){var _0x8bc641={},_0x42a5bf={},_0xe7127e={'count':0x0,'rows':[]};var _0xb81776=_[_0x1663('0x2a')](db[_0x1663('0x2b')][_0x1663('0x2c')],function(_0x5efc5d){return{'name':_0x5efc5d[_0x1663('0x2d')],'type':_0x5efc5d[_0x1663('0x2e')][_0x1663('0x2f')]};});_0x42a5bf[_0x1663('0x30')]=_[_0x1663('0x2a')](_0xb81776,_0x1663('0x28'));_0x42a5bf['query']=_[_0x1663('0x31')](_0x4e3aa0[_0x1663('0x32')]);_0x42a5bf[_0x1663('0x33')]=_['intersection'](_0x42a5bf[_0x1663('0x30')],_0x42a5bf[_0x1663('0x32')]);_0x8bc641[_0x1663('0x34')]=_[_0x1663('0x35')](_0x42a5bf[_0x1663('0x30')],qs[_0x1663('0x36')](_0x4e3aa0[_0x1663('0x32')][_0x1663('0x36')]));_0x8bc641[_0x1663('0x34')]=_0x8bc641[_0x1663('0x34')]['length']?_0x8bc641['attributes']:_0x42a5bf[_0x1663('0x30')];if(!_0x4e3aa0[_0x1663('0x32')][_0x1663('0x37')]('nolimit')){_0x8bc641['limit']=qs['limit'](_0x4e3aa0['query']['limit']);_0x8bc641[_0x1663('0x1c')]=qs[_0x1663('0x1c')](_0x4e3aa0[_0x1663('0x32')][_0x1663('0x1c')]);}_0x8bc641['order']=qs[_0x1663('0x38')](_0x4e3aa0[_0x1663('0x32')][_0x1663('0x38')]);_0x8bc641[_0x1663('0x39')]=qs[_0x1663('0x33')](_[_0x1663('0x3a')](_0x4e3aa0[_0x1663('0x32')],_0x42a5bf['filters']),_0xb81776);if(_0x4e3aa0['query'][_0x1663('0x3b')]){_0x8bc641[_0x1663('0x39')]=_[_0x1663('0x3c')](_0x8bc641[_0x1663('0x39')],{'$or':_[_0x1663('0x2a')](_0xb81776,function(_0x648ca1){if(_0x648ca1[_0x1663('0x2e')]!=='VIRTUAL'){var _0x59c935={};_0x59c935[_0x648ca1['name']]={'$like':'%'+_0x4e3aa0[_0x1663('0x32')][_0x1663('0x3b')]+'%'};return _0x59c935;}})});}_0x8bc641=_['merge']({},_0x8bc641,_0x4e3aa0[_0x1663('0x3d')]);var _0x34b52e={'where':_0x8bc641[_0x1663('0x39')]};return db[_0x1663('0x2b')]['count'](_0x34b52e)['then'](function(_0x24710b){_0xe7127e['count']=_0x24710b;if(_0x4e3aa0['query'][_0x1663('0x3e')]){_0x8bc641[_0x1663('0x3f')]=[{'all':!![]}];}return db[_0x1663('0x2b')][_0x1663('0x40')](_0x8bc641);})['then'](function(_0x4ae98b){_0xe7127e[_0x1663('0x41')]=_0x4ae98b;return _0xe7127e;})[_0x1663('0x25')](respondWithFilteredResult(_0x470e0d,_0x8bc641))[_0x1663('0x42')](handleError(_0x470e0d,null));};exports[_0x1663('0x43')]=function(_0x4674c0,_0x426717){var _0x50ed91={'raw':!![],'where':{'id':_0x4674c0[_0x1663('0x44')]['id']}},_0x304765={};_0x304765['model']=_[_0x1663('0x31')](db[_0x1663('0x2b')][_0x1663('0x2c')]);_0x304765[_0x1663('0x32')]=_[_0x1663('0x31')](_0x4674c0[_0x1663('0x32')]);_0x304765[_0x1663('0x33')]=_[_0x1663('0x35')](_0x304765[_0x1663('0x30')],_0x304765[_0x1663('0x32')]);_0x50ed91[_0x1663('0x34')]=_[_0x1663('0x35')](_0x304765[_0x1663('0x30')],qs['fields'](_0x4674c0['query'][_0x1663('0x36')]));_0x50ed91[_0x1663('0x34')]=_0x50ed91[_0x1663('0x34')][_0x1663('0x45')]?_0x50ed91[_0x1663('0x34')]:_0x304765[_0x1663('0x30')];if(_0x4674c0[_0x1663('0x32')][_0x1663('0x3e')]){_0x50ed91['include']=[{'all':!![]}];}_0x50ed91=_[_0x1663('0x3c')]({},_0x50ed91,_0x4674c0[_0x1663('0x3d')]);return db[_0x1663('0x2b')]['find'](_0x50ed91)[_0x1663('0x25')](handleEntityNotFound(_0x426717,null))[_0x1663('0x25')](respondWithResult(_0x426717,null))[_0x1663('0x42')](handleError(_0x426717,null));};exports[_0x1663('0x46')]=function(_0x3dc45c,_0x11020){return db[_0x1663('0x2b')][_0x1663('0x46')](_0x3dc45c['body'],{})['then'](respondWithResult(_0x11020,0xc9))['catch'](handleError(_0x11020,null));};exports[_0x1663('0x23')]=function(_0x16ac82,_0x1e7500){if(_0x16ac82[_0x1663('0x47')]['id']){delete _0x16ac82['body']['id'];}return db[_0x1663('0x2b')]['find']({'where':{'id':_0x16ac82['params']['id']}})[_0x1663('0x25')](handleEntityNotFound(_0x1e7500,null))['then'](saveUpdates(_0x16ac82[_0x1663('0x47')],null))['then'](respondWithResult(_0x1e7500,null))[_0x1663('0x42')](handleError(_0x1e7500,null));};exports['destroy']=function(_0x2d1381,_0x3766c5){return db['MailQueueReport'][_0x1663('0x48')]({'where':{'id':_0x2d1381[_0x1663('0x44')]['id']}})[_0x1663('0x25')](handleEntityNotFound(_0x3766c5,null))[_0x1663('0x25')](removeEntity(_0x3766c5,null))[_0x1663('0x42')](handleError(_0x3766c5,null));};exports[_0x1663('0x49')]=function(_0x165660,_0x5332cf){return db[_0x1663('0x2b')][_0x1663('0x49')]()['then'](respondWithResult(_0x5332cf,null))[_0x1663('0x42')](handleError(_0x5332cf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 22d0c77..32a1700 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 _0x1189=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2c8129,_0x27ded6){var _0x30e4a4=function(_0xd42d0f){while(--_0xd42d0f){_0x2c8129['push'](_0x2c8129['shift']());}};_0x30e4a4(++_0x27ded6);}(_0x1189,0x17f));var _0x9118=function(_0xc11942,_0x55416b){_0xc11942=_0xc11942-0x0;var _0x4c5b44=_0x1189[_0xc11942];return _0x4c5b44;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))(_0x9118('0x3'));var moment=require('moment');var BPromise=require(_0x9118('0x4'));var rp=require(_0x9118('0x5'));var fs=require('fs');var path=require(_0x9118('0x6'));var rimraf=require(_0x9118('0x7'));var config=require(_0x9118('0x8'));var attributes=require(_0x9118('0x9'));module[_0x9118('0xa')]=function(_0x499ee5,_0x124b4a){return _0x499ee5[_0x9118('0xb')](_0x9118('0xc'),attributes,{'tableName':_0x9118('0xd'),'paranoid':![],'indexes':[{'name':_0x9118('0xe'),'fields':[_0x9118('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb35=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','util'];(function(_0x3f100c,_0x4c6397){var _0x274271=function(_0x1d8604){while(--_0x1d8604){_0x3f100c['push'](_0x3f100c['shift']());}};_0x274271(++_0x4c6397);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x263c44,_0x3c075d){_0x263c44=_0x263c44-0x0;var _0x32c684=_0xbb35[_0x263c44];return _0x32c684;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x5bb3('0xc'),'fields':[_0x5bb3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d18a345..41e29b1 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 _0xe3da=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailQueueReport','create','body','options','then','CreateMailQueueReport','catch','UpdateMailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['CreateMailQueueReport']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')](_0x3f8cf9[_0xae3d('0x1a')],{'raw':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xae3d('0x1c')](function(_0x48f00e){logger[_0xae3d('0xe')](_0xae3d('0x1d'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x1d'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x48f00e));_0x558e42(_0x48f00e);})[_0xae3d('0x1e')](function(_0x26c419){logger[_0xae3d('0x14')](_0xae3d('0x1d'),_0x26c419[_0xae3d('0x16')],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x26c419[_0xae3d('0x16')]));});});};exports[_0xae3d('0x1f')]=function(_0x1b2acb){var _0x44a4e0=this;return new Promise(function(_0x1fe90f,_0xfb54f6){return db[_0xae3d('0x18')][_0xae3d('0x20')](_0x1b2acb[_0xae3d('0x1a')],{'raw':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x22')]||null:null,'attributes':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')]['attributes']||null:null,'limit':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x23')]||null:null})[_0xae3d('0x1c')](function(_0x3114f9){logger[_0xae3d('0xe')]('UpdateMailQueueReport',_0x1b2acb);logger[_0xae3d('0x11')](_0xae3d('0x1f'),_0x1b2acb,JSON['stringify'](_0x3114f9));_0x1fe90f(_0x3114f9);})[_0xae3d('0x1e')](function(_0x323715){logger[_0xae3d('0x14')](_0xae3d('0x1f'),_0x323715[_0xae3d('0x16')],_0x1b2acb);_0xfb54f6(_0x44a4e0[_0xae3d('0x14')](0x1f4,_0x323715['message']));});});}; \ No newline at end of file +var _0x57ca=['jayson/promise','client','http','request','info','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','debug','stringify','UpdateMailQueueReport','update','raw','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x81ac2a,_0x5ccf48){var _0x3d4e4d=function(_0x5e02f7){while(--_0x5e02f7){_0x81ac2a['push'](_0x81ac2a['shift']());}};_0x3d4e4d(++_0x5ccf48);}(_0x57ca,0x108));var _0xa57c=function(_0x5c812,_0x56d270){_0x5c812=_0x5c812-0x0;var _0x251050=_0x57ca[_0x5c812];return _0x251050;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});}exports[_0xa57c('0x15')]=function(_0x3d781d){var _0x93462c=this;return new Promise(function(_0xe3d505,_0x1fd0d8){return db[_0xa57c('0x16')][_0xa57c('0x17')](_0x3d781d[_0xa57c('0x18')],{'raw':_0x3d781d['options']?_0x3d781d[_0xa57c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x418415){logger[_0xa57c('0xc')](_0xa57c('0x15'),_0x3d781d);logger[_0xa57c('0x1a')]('CreateMailQueueReport',_0x3d781d,JSON[_0xa57c('0x1b')](_0x418415));_0xe3d505(_0x418415);})[_0xa57c('0x14')](function(_0x34d1bc){logger[_0xa57c('0xf')](_0xa57c('0x15'),_0x34d1bc[_0xa57c('0x12')],_0x3d781d);_0x1fd0d8(_0x93462c[_0xa57c('0xf')](0x1f4,_0x34d1bc[_0xa57c('0x12')]));});});};exports[_0xa57c('0x1c')]=function(_0xdf65dd){var _0x382a26=this;return new Promise(function(_0x1e7f7a,_0x241dcc){return db[_0xa57c('0x16')][_0xa57c('0x1d')](_0xdf65dd['body'],{'raw':_0xdf65dd[_0xa57c('0x19')]?_0xdf65dd[_0xa57c('0x19')][_0xa57c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf65dd[_0xa57c('0x19')]?_0xdf65dd[_0xa57c('0x19')][_0xa57c('0x1f')]||null:null,'attributes':_0xdf65dd[_0xa57c('0x19')]?_0xdf65dd[_0xa57c('0x19')][_0xa57c('0x20')]||null:null,'limit':_0xdf65dd[_0xa57c('0x19')]?_0xdf65dd['options'][_0xa57c('0x21')]||null:null})['then'](function(_0x54a18b){logger[_0xa57c('0xc')](_0xa57c('0x1c'),_0xdf65dd);logger['debug'](_0xa57c('0x1c'),_0xdf65dd,JSON[_0xa57c('0x1b')](_0x54a18b));_0x1e7f7a(_0x54a18b);})[_0xa57c('0x14')](function(_0x57565b){logger[_0xa57c('0xf')]('UpdateMailQueueReport',_0x57565b[_0xa57c('0x12')],_0xdf65dd);_0x241dcc(_0x382a26['error'](0x1f4,_0x57565b[_0xa57c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 8d98832..609b3e8 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 _0xac26=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','multer'];(function(_0x692690,_0x872b1f){var _0x3e5594=function(_0xe46ba4){while(--_0xe46ba4){_0x692690['push'](_0x692690['shift']());}};_0x3e5594(++_0x872b1f);}(_0xac26,0xbf));var _0x6ac2=function(_0x5081d4,_0x174b3f){_0x5081d4=_0x5081d4-0x0;var _0x547f56=_0xac26[_0x5081d4];return _0x547f56;};'use strict';var multer=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var path=require('path');var timeout=require(_0x6ac2('0x2'));var express=require('express');var router=express[_0x6ac2('0x3')]();var auth=require(_0x6ac2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ac2('0x5'));module['exports']=router; \ No newline at end of file +var _0x83ff=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','express'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x83ff,0x1ea));var _0xf83f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x83ff[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0xf83f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf83f('0x1'));var router=express[_0xf83f('0x2')]();var auth=require(_0xf83f('0x3'));var interaction=require(_0xf83f('0x4'));var config=require('../../config/environment');module[_0xf83f('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1f7b26b..10ae753 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 _0x5d0d=['BOOLEAN','INBOX','exports','STRING','INTEGER'];(function(_0x40e389,_0x250e9d){var _0x213741=function(_0x32b3a6){while(--_0x32b3a6){_0x40e389['push'](_0x40e389['shift']());}};_0x213741(++_0x250e9d);}(_0x5d0d,0x1ec));var _0xd5d0=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5d0d[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require('sequelize');module[_0xd5d0('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd5d0('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xd5d0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd5d0('0x1')]},'port':{'type':Sequelize[_0xd5d0('0x2')]},'tls':{'type':Sequelize[_0xd5d0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd5d0('0x1')],'defaultValue':_0xd5d0('0x4')},'connTimeout':{'type':Sequelize[_0xd5d0('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd5d0('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a84=['BOOLEAN','username','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x1f0a08,_0x5c55a5){var _0x516e32=function(_0x375179){while(--_0x375179){_0x1f0a08['push'](_0x1f0a08['shift']());}};_0x516e32(++_0x5c55a5);}(_0x0a84,0x66));var _0x40a8=function(_0x474b2c,_0x1c9edd){_0x474b2c=_0x474b2c-0x0;var _0x1d347b=_0x0a84[_0x474b2c];return _0x1d347b;};'use strict';var Sequelize=require(_0x40a8('0x0'));module[_0x40a8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x40a8('0x2')]},'authentication':{'type':Sequelize[_0x40a8('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x40a8('0x2')],'unique':_0x40a8('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x40a8('0x5')]},'tls':{'type':Sequelize[_0x40a8('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x40a8('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x40a8('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x40a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f31d6b5..0b93293 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 _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','util'];(function(_0x59f369,_0x3efb01){var _0x555462=function(_0x1c20ed){while(--_0x1c20ed){_0x59f369['push'](_0x59f369['shift']());}};_0x555462(++_0x3efb01);}(_0x6f47,0xc7));var _0x76f4=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6f47[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2086=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1bf8f5,_0x28f62c){var _0x36a54e=function(_0x43ba61){while(--_0x43ba61){_0x1bf8f5['push'](_0x1bf8f5['shift']());}};_0x36a54e(++_0x28f62c);}(_0x2086,0x124));var _0x6208=function(_0x269e01,_0x4628f0){_0x269e01=_0x269e01-0x0;var _0x268d07=_0x2086[_0x269e01];return _0x268d07;};'use strict';var _=require(_0x6208('0x0'));var util=require(_0x6208('0x1'));var logger=require(_0x6208('0x2'))(_0x6208('0x3'));var moment=require(_0x6208('0x4'));var BPromise=require(_0x6208('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6208('0x6'));var rimraf=require(_0x6208('0x7'));var config=require('../../config/environment');var attributes=require(_0x6208('0x8'));module[_0x6208('0x9')]=function(_0x38bc4d,_0xb3cf2a){return _0x38bc4d[_0x6208('0xa')]('MailServerIn',attributes,{'tableName':_0x6208('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9c96a6d..7040105 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 _0x706d=['map','include','model','info','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailServerIn','findAll','options','where','attributes','limit'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x706d,0x1b7));var _0xd706=function(_0x5e9a73,_0x403f5d){_0x5e9a73=_0x5e9a73-0x0;var _0x419bb4=_0x706d[_0x5e9a73];return _0x419bb4;};'use strict';var _=require(_0xd706('0x0'));var util=require(_0xd706('0x1'));var moment=require(_0xd706('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd706('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd706('0x4'));var logger=require('../../config/logger')(_0xd706('0x5'));var config=require(_0xd706('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd706('0x7')][_0xd706('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4380ec,_0x33a114,_0x3175df){return new BPromise(function(_0x21f0af,_0x4a58c1){return client[_0xd706('0x9')](_0x4380ec,_0x3175df)[_0xd706('0xa')](function(_0x12db98){logger['info'](_0xd706('0xb'),_0x33a114,'request\x20sent');logger[_0xd706('0xc')](_0xd706('0xd'),_0x33a114,_0xd706('0xe'),JSON['stringify'](_0x12db98));if(_0x12db98[_0xd706('0xf')]){if(_0x12db98[_0xd706('0xf')][_0xd706('0x10')]===0x1f4){logger[_0xd706('0xf')]('MailServerIn,\x20%s,\x20%s',_0x33a114,_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);return _0x4a58c1(_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);}logger[_0xd706('0xf')](_0xd706('0xb'),_0x33a114,_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);return _0x21f0af(_0x12db98[_0xd706('0xf')]['message']);}else{logger['info'](_0xd706('0xb'),_0x33a114,_0xd706('0xe'));_0x21f0af(_0x12db98[_0xd706('0x12')][_0xd706('0x11')]);}})[_0xd706('0x13')](function(_0x271489){logger[_0xd706('0xf')](_0xd706('0xb'),_0x33a114,_0x271489);_0x4a58c1(_0x271489);});});}exports['GetMailServerIn']=function(_0x5bba6e){var _0x1e37a9=this;return new Promise(function(_0x2d634c,_0x2b38e2){return db[_0xd706('0x14')][_0xd706('0x15')]({'raw':_0x5bba6e['options']?_0x5bba6e[_0xd706('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5bba6e[_0xd706('0x16')]?_0x5bba6e[_0xd706('0x16')][_0xd706('0x17')]||null:null,'attributes':_0x5bba6e['options']?_0x5bba6e['options'][_0xd706('0x18')]||null:null,'limit':_0x5bba6e[_0xd706('0x16')]?_0x5bba6e[_0xd706('0x16')][_0xd706('0x19')]||null:null,'include':_0x5bba6e[_0xd706('0x16')]?_0x5bba6e[_0xd706('0x16')]['include']?_[_0xd706('0x1a')](_0x5bba6e[_0xd706('0x16')][_0xd706('0x1b')],function(_0x5b1c5f){return{'model':db[_0x5b1c5f[_0xd706('0x1c')]],'as':_0x5b1c5f['as'],'attributes':_0x5b1c5f[_0xd706('0x18')],'include':_0x5b1c5f[_0xd706('0x1b')]?_[_0xd706('0x1a')](_0x5b1c5f['include'],function(_0x37f291){return{'model':db[_0x37f291['model']],'as':_0x37f291['as'],'attributes':_0x37f291[_0xd706('0x18')],'include':_0x37f291[_0xd706('0x1b')]?_[_0xd706('0x1a')](_0x37f291[_0xd706('0x1b')],function(_0x3e0f7e){return{'model':db[_0x3e0f7e[_0xd706('0x1c')]],'as':_0x3e0f7e['as'],'attributes':_0x3e0f7e[_0xd706('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ea3c){logger[_0xd706('0x1d')]('GetMailServerIn',_0x5bba6e);logger[_0xd706('0xc')]('GetMailServerIn',_0x5bba6e,JSON[_0xd706('0x1e')](_0x44ea3c));_0x2d634c(_0x44ea3c);})['catch'](function(_0x3dbe49){logger['error']('GetMailServerIn',_0x3dbe49['message'],_0x5bba6e);_0x2b38e2(_0x1e37a9[_0xd706('0xf')](0x1f4,_0x3dbe49[_0xd706('0x11')]));});});}; \ No newline at end of file +var _0xb082=['code','message','GetMailServerIn','findAll','options','raw','where','attributes','limit','model','include','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x3fdff1,_0x1ac483){var _0x57cdab=function(_0x4dc903){while(--_0x4dc903){_0x3fdff1['push'](_0x3fdff1['shift']());}};_0x57cdab(++_0x1ac483);}(_0xb082,0x105));var _0x2b08=function(_0x4fbd6c,_0x2d6811){_0x4fbd6c=_0x4fbd6c-0x0;var _0x52b81e=_0xb082[_0x4fbd6c];return _0x52b81e;};'use strict';var _=require(_0x2b08('0x0'));var util=require(_0x2b08('0x1'));var moment=require(_0x2b08('0x2'));var BPromise=require(_0x2b08('0x3'));var rs=require(_0x2b08('0x4'));var fs=require('fs');var Redis=require(_0x2b08('0x5'));var db=require(_0x2b08('0x6'))['db'];var utils=require(_0x2b08('0x7'));var logger=require('../../config/logger')(_0x2b08('0x8'));var config=require(_0x2b08('0x9'));var jayson=require(_0x2b08('0xa'));var client=jayson['client'][_0x2b08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x411a26,_0x43f408,_0x3bb62c){return new BPromise(function(_0x53623a,_0x1d0e5a){return client['request'](_0x411a26,_0x3bb62c)[_0x2b08('0xc')](function(_0x112358){logger[_0x2b08('0xd')](_0x2b08('0xe'),_0x43f408,'request\x20sent');logger[_0x2b08('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x43f408,_0x2b08('0x10'),JSON['stringify'](_0x112358));if(_0x112358[_0x2b08('0x11')]){if(_0x112358['error'][_0x2b08('0x12')]===0x1f4){logger[_0x2b08('0x11')]('MailServerIn,\x20%s,\x20%s',_0x43f408,_0x112358[_0x2b08('0x11')][_0x2b08('0x13')]);return _0x1d0e5a(_0x112358[_0x2b08('0x11')][_0x2b08('0x13')]);}logger[_0x2b08('0x11')](_0x2b08('0xe'),_0x43f408,_0x112358[_0x2b08('0x11')][_0x2b08('0x13')]);return _0x53623a(_0x112358[_0x2b08('0x11')][_0x2b08('0x13')]);}else{logger[_0x2b08('0xd')](_0x2b08('0xe'),_0x43f408,_0x2b08('0x10'));_0x53623a(_0x112358['result'][_0x2b08('0x13')]);}})['catch'](function(_0x232580){logger[_0x2b08('0x11')](_0x2b08('0xe'),_0x43f408,_0x232580);_0x1d0e5a(_0x232580);});});}exports[_0x2b08('0x14')]=function(_0x22c66c){var _0x325283=this;return new Promise(function(_0x334ca9,_0x15211d){return db['MailServerIn'][_0x2b08('0x15')]({'raw':_0x22c66c['options']?_0x22c66c[_0x2b08('0x16')][_0x2b08('0x17')]===undefined?!![]:![]:!![],'where':_0x22c66c[_0x2b08('0x16')]?_0x22c66c[_0x2b08('0x16')][_0x2b08('0x18')]||null:null,'attributes':_0x22c66c[_0x2b08('0x16')]?_0x22c66c['options'][_0x2b08('0x19')]||null:null,'limit':_0x22c66c['options']?_0x22c66c[_0x2b08('0x16')][_0x2b08('0x1a')]||null:null,'include':_0x22c66c['options']?_0x22c66c[_0x2b08('0x16')]['include']?_['map'](_0x22c66c[_0x2b08('0x16')]['include'],function(_0x4417f4){return{'model':db[_0x4417f4[_0x2b08('0x1b')]],'as':_0x4417f4['as'],'attributes':_0x4417f4['attributes'],'include':_0x4417f4[_0x2b08('0x1c')]?_[_0x2b08('0x1d')](_0x4417f4[_0x2b08('0x1c')],function(_0x284dbe){return{'model':db[_0x284dbe['model']],'as':_0x284dbe['as'],'attributes':_0x284dbe[_0x2b08('0x19')],'include':_0x284dbe[_0x2b08('0x1c')]?_[_0x2b08('0x1d')](_0x284dbe[_0x2b08('0x1c')],function(_0x2f315c){return{'model':db[_0x2f315c[_0x2b08('0x1b')]],'as':_0x2f315c['as'],'attributes':_0x2f315c[_0x2b08('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2b08('0xc')](function(_0xf17f2){logger[_0x2b08('0xd')]('GetMailServerIn',_0x22c66c);logger[_0x2b08('0xf')](_0x2b08('0x14'),_0x22c66c,JSON['stringify'](_0xf17f2));_0x334ca9(_0xf17f2);})[_0x2b08('0x1e')](function(_0x117210){logger[_0x2b08('0x11')](_0x2b08('0x14'),_0x117210[_0x2b08('0x13')],_0x22c66c);_0x15211d(_0x325283[_0x2b08('0x11')](0x1f4,_0x117210[_0x2b08('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 56248b7..8484305 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 _0xb338=['/:id','show','post','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x120c43,_0x2e62f6){var _0x441d41=function(_0x3fe080){while(--_0x3fe080){_0x120c43['push'](_0x120c43['shift']());}};_0x441d41(++_0x2e62f6);}(_0xb338,0x76));var _0x8b33=function(_0x5f44c3,_0x460f76){_0x5f44c3=_0x5f44c3-0x0;var _0x577bf7=_0xb338[_0x5f44c3];return _0x577bf7;};'use strict';var multer=require(_0x8b33('0x0'));var util=require('util');var path=require(_0x8b33('0x1'));var timeout=require(_0x8b33('0x2'));var express=require(_0x8b33('0x3'));var router=express['Router']();var auth=require(_0x8b33('0x4'));var interaction=require(_0x8b33('0x5'));var config=require(_0x8b33('0x6'));var controller=require('./mailServerOut.controller');router['get']('/',auth[_0x8b33('0x7')](),controller[_0x8b33('0x8')]);router[_0x8b33('0x9')](_0x8b33('0xa'),auth[_0x8b33('0x7')](),controller[_0x8b33('0xb')]);router[_0x8b33('0xc')]('/',auth[_0x8b33('0x7')](),controller['create']);router['put'](_0x8b33('0xa'),auth[_0x8b33('0x7')](),controller['update']);router[_0x8b33('0xd')]('/:id',auth[_0x8b33('0x7')](),controller[_0x8b33('0xe')]);module[_0x8b33('0xf')]=router; \ No newline at end of file +var _0x2183=['../../components/interaction/service','./mailServerOut.controller','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2183,0x1e7));var _0x3218=function(_0x46f709,_0x278808){_0x46f709=_0x46f709-0x0;var _0x2e955b=_0x2183[_0x46f709];return _0x2e955b;};'use strict';var multer=require(_0x3218('0x0'));var util=require(_0x3218('0x1'));var path=require(_0x3218('0x2'));var timeout=require(_0x3218('0x3'));var express=require(_0x3218('0x4'));var router=express[_0x3218('0x5')]();var auth=require(_0x3218('0x6'));var interaction=require(_0x3218('0x7'));var config=require('../../config/environment');var controller=require(_0x3218('0x8'));router['get']('/',auth[_0x3218('0x9')](),controller[_0x3218('0xa')]);router['get'](_0x3218('0xb'),auth['isAuthenticated'](),controller[_0x3218('0xc')]);router[_0x3218('0xd')]('/',auth[_0x3218('0x9')](),controller[_0x3218('0xe')]);router['put'](_0x3218('0xb'),auth[_0x3218('0x9')](),controller[_0x3218('0xf')]);router[_0x3218('0x10')](_0x3218('0xb'),auth['isAuthenticated'](),controller[_0x3218('0x11')]);module[_0x3218('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8685d5f..b5a69ac 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 _0xf3fe=['STRING','BOOLEAN','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x378e4f,_0x304ac5){_0x378e4f=_0x378e4f-0x0;var _0xa279bd=_0xf3fe[_0x378e4f];return _0xa279bd;};'use strict';var Sequelize=require('sequelize');module[_0xef3f('0x0')]={'description':{'type':Sequelize[_0xef3f('0x1')]},'host':{'type':Sequelize[_0xef3f('0x1')]},'user':{'type':Sequelize[_0xef3f('0x1')]},'pass':{'type':Sequelize[_0xef3f('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xef3f('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xef3f('0x1')]},'authentication':{'type':Sequelize[_0xef3f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7dee=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7dee,0xb0));var _0xe7de=function(_0x10e68e,_0x30e4a9){_0x10e68e=_0x10e68e-0x0;var _0x3c1fcc=_0x7dee[_0x10e68e];return _0x3c1fcc;};'use strict';var Sequelize=require(_0xe7de('0x0'));module['exports']={'description':{'type':Sequelize[_0xe7de('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe7de('0x1')]},'pass':{'type':Sequelize[_0xe7de('0x1')]},'port':{'type':Sequelize[_0xe7de('0x2')]},'secure':{'type':Sequelize[_0xe7de('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe7de('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index a313f0e..9ccf341 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 _0xa3f8=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','rows','show','params','includeAll','options','catch','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x3f3e96,_0x2a283d){var _0x5d8c7a=function(_0x626334){while(--_0x626334){_0x3f3e96['push'](_0x3f3e96['shift']());}};_0x5d8c7a(++_0x2a283d);}(_0xa3f8,0x1f4));var _0x8a3f=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0xa3f8[_0x16e5d1];return _0x3f72e6;};'use strict';var pdf=require(_0x8a3f('0x0'));var emlformat=require(_0x8a3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8a3f('0x2'));var jsonpatch=require(_0x8a3f('0x3'));var rp=require(_0x8a3f('0x4'));var moment=require(_0x8a3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8a3f('0x6'));var util=require(_0x8a3f('0x7'));var path=require(_0x8a3f('0x8'));var sox=require(_0x8a3f('0x9'));var csv=require(_0x8a3f('0xa'));var ejs=require(_0x8a3f('0xb'));var fs=require('fs');var _=require(_0x8a3f('0xc'));var squel=require(_0x8a3f('0xd'));var crypto=require(_0x8a3f('0xe'));var jsforce=require(_0x8a3f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a3f('0xa'));var querystring=require(_0x8a3f('0x10'));var Papa=require(_0x8a3f('0x11'));var Redis=require(_0x8a3f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a3f('0x13'));var as=require(_0x8a3f('0x14'));var hardwareService=require(_0x8a3f('0x15'));var logger=require(_0x8a3f('0x16'))(_0x8a3f('0x17'));var utils=require('../../config/utils');var config=require(_0x8a3f('0x18'));var db=require(_0x8a3f('0x19'))['db'];function respondWithStatusCode(_0x199bf4,_0x202eb3){_0x202eb3=_0x202eb3||0xcc;return function(_0x9b343){if(_0x9b343){return _0x199bf4[_0x8a3f('0x1a')](_0x202eb3);}return _0x199bf4[_0x8a3f('0x1b')](_0x202eb3)[_0x8a3f('0x1c')]();};}function respondWithResult(_0x26cedc,_0x54224a){_0x54224a=_0x54224a||0xc8;return function(_0x594475){if(_0x594475){return _0x26cedc[_0x8a3f('0x1b')](_0x54224a)[_0x8a3f('0x1d')](_0x594475);}};}function respondWithFilteredResult(_0x15b634,_0x48b17a){return function(_0x3110bc){if(_0x3110bc){var _0x422af8=_0x3110bc[_0x8a3f('0x1e')],_0x4e7c73=_0x48b17a[_0x8a3f('0x1f')],_0x568821=_0x48b17a[_0x8a3f('0x1f')]+_0x48b17a[_0x8a3f('0x20')],_0x24515d;if(_0x568821>=_0x422af8){_0x568821=_0x422af8;_0x24515d=0xc8;}else{_0x24515d=0xce;}_0x15b634[_0x8a3f('0x1b')](_0x24515d);return _0x15b634[_0x8a3f('0x21')](_0x8a3f('0x22'),_0x4e7c73+'-'+_0x568821+'/'+_0x422af8)[_0x8a3f('0x1d')](_0x3110bc);}return null;};}function patchUpdates(_0x14906b){return function(_0x9249f5){try{jsonpatch['apply'](_0x9249f5,_0x14906b,!![]);}catch(_0x506136){return BPromise[_0x8a3f('0x23')](_0x506136);}return _0x9249f5[_0x8a3f('0x24')]();};}function saveUpdates(_0x433bfd,_0x3101c0){return function(_0x39da3d){if(_0x39da3d){return _0x39da3d['update'](_0x433bfd)[_0x8a3f('0x25')](function(_0x4a8461){return _0x4a8461;});}return null;};}function removeEntity(_0x117287,_0x529b38){return function(_0x5b04f2){if(_0x5b04f2){return _0x5b04f2[_0x8a3f('0x26')]()[_0x8a3f('0x25')](function(){_0x117287[_0x8a3f('0x1b')](0xcc)[_0x8a3f('0x1c')]();});}};}function handleEntityNotFound(_0x46fdc6,_0x4d96e3){return function(_0xa9a557){if(!_0xa9a557){_0x46fdc6[_0x8a3f('0x1a')](0x194);}return _0xa9a557;};}function handleError(_0x927214,_0x268885){_0x268885=_0x268885||0x1f4;return function(_0x363f89){logger[_0x8a3f('0x27')](_0x363f89[_0x8a3f('0x28')]);if(_0x363f89[_0x8a3f('0x29')]){delete _0x363f89[_0x8a3f('0x29')];}_0x927214[_0x8a3f('0x1b')](_0x268885)[_0x8a3f('0x2a')](_0x363f89);};}exports[_0x8a3f('0x2b')]=function(_0x1f381d,_0x50b8bd){var _0x3e8b8a={},_0x2c8a72={},_0x96b172={'count':0x0,'rows':[]};var _0x1b5034=_[_0x8a3f('0x2c')](db[_0x8a3f('0x2d')][_0x8a3f('0x2e')],function(_0x43dc77){return{'name':_0x43dc77[_0x8a3f('0x2f')],'type':_0x43dc77[_0x8a3f('0x30')][_0x8a3f('0x31')]};});_0x2c8a72[_0x8a3f('0x32')]=_[_0x8a3f('0x2c')](_0x1b5034,_0x8a3f('0x29'));_0x2c8a72['query']=_[_0x8a3f('0x33')](_0x1f381d[_0x8a3f('0x34')]);_0x2c8a72[_0x8a3f('0x35')]=_['intersection'](_0x2c8a72[_0x8a3f('0x32')],_0x2c8a72[_0x8a3f('0x34')]);_0x3e8b8a[_0x8a3f('0x36')]=_[_0x8a3f('0x37')](_0x2c8a72[_0x8a3f('0x32')],qs[_0x8a3f('0x38')](_0x1f381d[_0x8a3f('0x34')]['fields']));_0x3e8b8a[_0x8a3f('0x36')]=_0x3e8b8a[_0x8a3f('0x36')]['length']?_0x3e8b8a['attributes']:_0x2c8a72['model'];if(!_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x39')](_0x8a3f('0x3a'))){_0x3e8b8a[_0x8a3f('0x20')]=qs[_0x8a3f('0x20')](_0x1f381d['query'][_0x8a3f('0x20')]);_0x3e8b8a['offset']=qs[_0x8a3f('0x1f')](_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x1f')]);}_0x3e8b8a['order']=qs[_0x8a3f('0x3b')](_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x3b')]);_0x3e8b8a[_0x8a3f('0x3c')]=qs[_0x8a3f('0x35')](_[_0x8a3f('0x3d')](_0x1f381d['query'],_0x2c8a72[_0x8a3f('0x35')]),_0x1b5034);if(_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x3e')]){_0x3e8b8a[_0x8a3f('0x3c')]=_['merge'](_0x3e8b8a[_0x8a3f('0x3c')],{'$or':_[_0x8a3f('0x2c')](_0x1b5034,function(_0x355e52){if(_0x355e52['type']!==_0x8a3f('0x3f')){var _0x6f90a3={};_0x6f90a3[_0x355e52[_0x8a3f('0x29')]]={'$like':'%'+_0x1f381d['query']['filter']+'%'};return _0x6f90a3;}})});}_0x3e8b8a=_[_0x8a3f('0x40')]({},_0x3e8b8a,_0x1f381d['options']);var _0x1bdbd2={'where':_0x3e8b8a[_0x8a3f('0x3c')]};return db['MailServerOut'][_0x8a3f('0x1e')](_0x1bdbd2)[_0x8a3f('0x25')](function(_0x53cce9){_0x96b172[_0x8a3f('0x1e')]=_0x53cce9;if(_0x1f381d[_0x8a3f('0x34')]['includeAll']){_0x3e8b8a[_0x8a3f('0x41')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x3e8b8a);})[_0x8a3f('0x25')](function(_0x4eedbe){_0x96b172[_0x8a3f('0x42')]=_0x4eedbe;return _0x96b172;})['then'](respondWithFilteredResult(_0x50b8bd,_0x3e8b8a))['catch'](handleError(_0x50b8bd,null));};exports[_0x8a3f('0x43')]=function(_0x2bb7b3,_0x415a52){var _0x3e2111={'raw':!![],'where':{'id':_0x2bb7b3[_0x8a3f('0x44')]['id']}},_0x2a66fc={};_0x2a66fc['model']=_[_0x8a3f('0x33')](db['MailServerOut'][_0x8a3f('0x2e')]);_0x2a66fc[_0x8a3f('0x34')]=_[_0x8a3f('0x33')](_0x2bb7b3['query']);_0x2a66fc[_0x8a3f('0x35')]=_[_0x8a3f('0x37')](_0x2a66fc[_0x8a3f('0x32')],_0x2a66fc['query']);_0x3e2111[_0x8a3f('0x36')]=_['intersection'](_0x2a66fc[_0x8a3f('0x32')],qs[_0x8a3f('0x38')](_0x2bb7b3[_0x8a3f('0x34')][_0x8a3f('0x38')]));_0x3e2111['attributes']=_0x3e2111[_0x8a3f('0x36')]['length']?_0x3e2111['attributes']:_0x2a66fc[_0x8a3f('0x32')];if(_0x2bb7b3['query'][_0x8a3f('0x45')]){_0x3e2111[_0x8a3f('0x41')]=[{'all':!![]}];}_0x3e2111=_[_0x8a3f('0x40')]({},_0x3e2111,_0x2bb7b3[_0x8a3f('0x46')]);return db[_0x8a3f('0x2d')]['find'](_0x3e2111)[_0x8a3f('0x25')](handleEntityNotFound(_0x415a52,null))[_0x8a3f('0x25')](respondWithResult(_0x415a52,null))[_0x8a3f('0x47')](handleError(_0x415a52,null));};exports[_0x8a3f('0x48')]=function(_0x1a9cc2,_0x5c6b16){return db[_0x8a3f('0x2d')][_0x8a3f('0x48')](_0x1a9cc2[_0x8a3f('0x49')],{})[_0x8a3f('0x25')](respondWithResult(_0x5c6b16,0xc9))[_0x8a3f('0x47')](handleError(_0x5c6b16,null));};exports[_0x8a3f('0x4a')]=function(_0x3b4e59,_0x3d2c1e){if(_0x3b4e59['body']['id']){delete _0x3b4e59[_0x8a3f('0x49')]['id'];}return db[_0x8a3f('0x2d')]['find']({'where':{'id':_0x3b4e59['params']['id']}})['then'](handleEntityNotFound(_0x3d2c1e,null))[_0x8a3f('0x25')](saveUpdates(_0x3b4e59[_0x8a3f('0x49')],null))[_0x8a3f('0x25')](respondWithResult(_0x3d2c1e,null))[_0x8a3f('0x47')](handleError(_0x3d2c1e,null));};exports[_0x8a3f('0x26')]=function(_0x9a22e6,_0x4a7d70){return db['MailServerOut']['find']({'where':{'id':_0x9a22e6['params']['id']}})[_0x8a3f('0x25')](handleEntityNotFound(_0x4a7d70,null))['then'](removeEntity(_0x4a7d70,null))[_0x8a3f('0x47')](handleError(_0x4a7d70,null));}; \ No newline at end of file +var _0xf87d=['rows','catch','show','find','create','body','params','html-pdf','eml-format','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','reject','update','then','destroy','error','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x50fc55,_0x18fac2){var _0xd95ce7=function(_0x27d730){while(--_0x27d730){_0x50fc55['push'](_0x50fc55['shift']());}};_0xd95ce7(++_0x18fac2);}(_0xf87d,0x8f));var _0xdf87=function(_0x2e9232,_0x51fcca){_0x2e9232=_0x2e9232-0x0;var _0x331172=_0xf87d[_0x2e9232];return _0x331172;};'use strict';var pdf=require(_0xdf87('0x0'));var emlformat=require(_0xdf87('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdf87('0x2'));var rp=require('request-promise');var moment=require(_0xdf87('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf87('0x4'));var path=require(_0xdf87('0x5'));var sox=require(_0xdf87('0x6'));var csv=require(_0xdf87('0x7'));var ejs=require(_0xdf87('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf87('0x9'));var crypto=require(_0xdf87('0xa'));var jsforce=require(_0xdf87('0xb'));var deskjs=require(_0xdf87('0xc'));var toCsv=require(_0xdf87('0x7'));var querystring=require(_0xdf87('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf87('0xe'));var authService=require(_0xdf87('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf87('0x10'));var logger=require(_0xdf87('0x11'))(_0xdf87('0x12'));var utils=require(_0xdf87('0x13'));var config=require(_0xdf87('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dcb15,_0x295a60){_0x295a60=_0x295a60||0xcc;return function(_0x2eb7bb){if(_0x2eb7bb){return _0x3dcb15[_0xdf87('0x15')](_0x295a60);}return _0x3dcb15['status'](_0x295a60)[_0xdf87('0x16')]();};}function respondWithResult(_0x277a62,_0x2e5bba){_0x2e5bba=_0x2e5bba||0xc8;return function(_0x2a89a7){if(_0x2a89a7){return _0x277a62[_0xdf87('0x17')](_0x2e5bba)[_0xdf87('0x18')](_0x2a89a7);}};}function respondWithFilteredResult(_0x737b32,_0x1a449e){return function(_0x339393){if(_0x339393){var _0xfcb484=_0x339393[_0xdf87('0x19')],_0x466acf=_0x1a449e[_0xdf87('0x1a')],_0x318301=_0x1a449e[_0xdf87('0x1a')]+_0x1a449e[_0xdf87('0x1b')],_0xfc3674;if(_0x318301>=_0xfcb484){_0x318301=_0xfcb484;_0xfc3674=0xc8;}else{_0xfc3674=0xce;}_0x737b32['status'](_0xfc3674);return _0x737b32[_0xdf87('0x1c')]('Content-Range',_0x466acf+'-'+_0x318301+'/'+_0xfcb484)[_0xdf87('0x18')](_0x339393);}return null;};}function patchUpdates(_0x96bdbc){return function(_0xb26b75){try{jsonpatch['apply'](_0xb26b75,_0x96bdbc,!![]);}catch(_0x5133ff){return BPromise[_0xdf87('0x1d')](_0x5133ff);}return _0xb26b75['save']();};}function saveUpdates(_0x4e9cfc,_0x416d2b){return function(_0x36bc36){if(_0x36bc36){return _0x36bc36[_0xdf87('0x1e')](_0x4e9cfc)[_0xdf87('0x1f')](function(_0x5befc6){return _0x5befc6;});}return null;};}function removeEntity(_0x3a7461,_0x596fd1){return function(_0x6f737b){if(_0x6f737b){return _0x6f737b[_0xdf87('0x20')]()[_0xdf87('0x1f')](function(){_0x3a7461[_0xdf87('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5921,_0x1368de){return function(_0x4ba7b1){if(!_0x4ba7b1){_0x1d5921['sendStatus'](0x194);}return _0x4ba7b1;};}function handleError(_0x5a2e53,_0x2e4007){_0x2e4007=_0x2e4007||0x1f4;return function(_0x3857c7){logger[_0xdf87('0x21')](_0x3857c7['stack']);if(_0x3857c7[_0xdf87('0x22')]){delete _0x3857c7['name'];}_0x5a2e53['status'](_0x2e4007)[_0xdf87('0x23')](_0x3857c7);};}exports['index']=function(_0x48faa7,_0x3fb1e3){var _0x34e9cd={},_0x5be81e={},_0x598263={'count':0x0,'rows':[]};var _0x3b615b=_[_0xdf87('0x24')](db[_0xdf87('0x25')][_0xdf87('0x26')],function(_0x233482){return{'name':_0x233482[_0xdf87('0x27')],'type':_0x233482[_0xdf87('0x28')][_0xdf87('0x29')]};});_0x5be81e[_0xdf87('0x2a')]=_['map'](_0x3b615b,_0xdf87('0x22'));_0x5be81e[_0xdf87('0x2b')]=_[_0xdf87('0x2c')](_0x48faa7[_0xdf87('0x2b')]);_0x5be81e[_0xdf87('0x2d')]=_[_0xdf87('0x2e')](_0x5be81e[_0xdf87('0x2a')],_0x5be81e['query']);_0x34e9cd[_0xdf87('0x2f')]=_['intersection'](_0x5be81e[_0xdf87('0x2a')],qs['fields'](_0x48faa7[_0xdf87('0x2b')][_0xdf87('0x30')]));_0x34e9cd[_0xdf87('0x2f')]=_0x34e9cd[_0xdf87('0x2f')][_0xdf87('0x31')]?_0x34e9cd[_0xdf87('0x2f')]:_0x5be81e['model'];if(!_0x48faa7[_0xdf87('0x2b')][_0xdf87('0x32')](_0xdf87('0x33'))){_0x34e9cd[_0xdf87('0x1b')]=qs[_0xdf87('0x1b')](_0x48faa7[_0xdf87('0x2b')][_0xdf87('0x1b')]);_0x34e9cd[_0xdf87('0x1a')]=qs[_0xdf87('0x1a')](_0x48faa7[_0xdf87('0x2b')][_0xdf87('0x1a')]);}_0x34e9cd[_0xdf87('0x34')]=qs[_0xdf87('0x35')](_0x48faa7[_0xdf87('0x2b')]['sort']);_0x34e9cd[_0xdf87('0x36')]=qs[_0xdf87('0x2d')](_[_0xdf87('0x37')](_0x48faa7[_0xdf87('0x2b')],_0x5be81e[_0xdf87('0x2d')]),_0x3b615b);if(_0x48faa7[_0xdf87('0x2b')]['filter']){_0x34e9cd[_0xdf87('0x36')]=_[_0xdf87('0x38')](_0x34e9cd[_0xdf87('0x36')],{'$or':_[_0xdf87('0x24')](_0x3b615b,function(_0x46f2ca){if(_0x46f2ca['type']!==_0xdf87('0x39')){var _0x3a5e90={};_0x3a5e90[_0x46f2ca[_0xdf87('0x22')]]={'$like':'%'+_0x48faa7[_0xdf87('0x2b')]['filter']+'%'};return _0x3a5e90;}})});}_0x34e9cd=_['merge']({},_0x34e9cd,_0x48faa7[_0xdf87('0x3a')]);var _0x5d03e6={'where':_0x34e9cd[_0xdf87('0x36')]};return db['MailServerOut'][_0xdf87('0x19')](_0x5d03e6)[_0xdf87('0x1f')](function(_0x2db717){_0x598263[_0xdf87('0x19')]=_0x2db717;if(_0x48faa7['query'][_0xdf87('0x3b')]){_0x34e9cd[_0xdf87('0x3c')]=[{'all':!![]}];}return db[_0xdf87('0x25')]['findAll'](_0x34e9cd);})[_0xdf87('0x1f')](function(_0x366cec){_0x598263[_0xdf87('0x3d')]=_0x366cec;return _0x598263;})[_0xdf87('0x1f')](respondWithFilteredResult(_0x3fb1e3,_0x34e9cd))[_0xdf87('0x3e')](handleError(_0x3fb1e3,null));};exports[_0xdf87('0x3f')]=function(_0x56df32,_0x579c14){var _0xe684da={'raw':!![],'where':{'id':_0x56df32['params']['id']}},_0x107ef4={};_0x107ef4[_0xdf87('0x2a')]=_[_0xdf87('0x2c')](db['MailServerOut'][_0xdf87('0x26')]);_0x107ef4[_0xdf87('0x2b')]=_[_0xdf87('0x2c')](_0x56df32[_0xdf87('0x2b')]);_0x107ef4[_0xdf87('0x2d')]=_['intersection'](_0x107ef4['model'],_0x107ef4[_0xdf87('0x2b')]);_0xe684da[_0xdf87('0x2f')]=_['intersection'](_0x107ef4[_0xdf87('0x2a')],qs[_0xdf87('0x30')](_0x56df32[_0xdf87('0x2b')][_0xdf87('0x30')]));_0xe684da[_0xdf87('0x2f')]=_0xe684da['attributes']['length']?_0xe684da[_0xdf87('0x2f')]:_0x107ef4[_0xdf87('0x2a')];if(_0x56df32[_0xdf87('0x2b')]['includeAll']){_0xe684da[_0xdf87('0x3c')]=[{'all':!![]}];}_0xe684da=_['merge']({},_0xe684da,_0x56df32[_0xdf87('0x3a')]);return db[_0xdf87('0x25')][_0xdf87('0x40')](_0xe684da)[_0xdf87('0x1f')](handleEntityNotFound(_0x579c14,null))[_0xdf87('0x1f')](respondWithResult(_0x579c14,null))['catch'](handleError(_0x579c14,null));};exports[_0xdf87('0x41')]=function(_0x1ad7ed,_0x380e3e){return db['MailServerOut']['create'](_0x1ad7ed[_0xdf87('0x42')],{})[_0xdf87('0x1f')](respondWithResult(_0x380e3e,0xc9))[_0xdf87('0x3e')](handleError(_0x380e3e,null));};exports[_0xdf87('0x1e')]=function(_0xfbf3a9,_0x3eca6c){if(_0xfbf3a9['body']['id']){delete _0xfbf3a9[_0xdf87('0x42')]['id'];}return db[_0xdf87('0x25')][_0xdf87('0x40')]({'where':{'id':_0xfbf3a9[_0xdf87('0x43')]['id']}})[_0xdf87('0x1f')](handleEntityNotFound(_0x3eca6c,null))[_0xdf87('0x1f')](saveUpdates(_0xfbf3a9[_0xdf87('0x42')],null))['then'](respondWithResult(_0x3eca6c,null))[_0xdf87('0x3e')](handleError(_0x3eca6c,null));};exports['destroy']=function(_0x2ea24a,_0x5bee90){return db[_0xdf87('0x25')][_0xdf87('0x40')]({'where':{'id':_0x2ea24a['params']['id']}})[_0xdf87('0x1f')](handleEntityNotFound(_0x5bee90,null))[_0xdf87('0x1f')](removeEntity(_0x5bee90,null))[_0xdf87('0x3e')](handleError(_0x5bee90,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9af607d..721aec9 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 _0xd897=['path','../../config/environment','exports','define','MailServerOut','lodash','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd897,0xb9));var _0x7d89=function(_0x508252,_0x4cdd28){_0x508252=_0x508252-0x0;var _0x23147d=_0xd897[_0x508252];return _0x23147d;};'use strict';var _=require(_0x7d89('0x0'));var util=require(_0x7d89('0x1'));var logger=require(_0x7d89('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d89('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d89('0x4'));var rimraf=require('rimraf');var config=require(_0x7d89('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x7d89('0x6')]=function(_0x25cf6c,_0x44473e){return _0x25cf6c[_0x7d89('0x7')](_0x7d89('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cc2=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8cc2,0x1df));var _0x28cc=function(_0x19b52a,_0x1abd93){_0x19b52a=_0x19b52a-0x0;var _0x14cc48=_0x8cc2[_0x19b52a];return _0x14cc48;};'use strict';var _=require(_0x28cc('0x0'));var util=require('util');var logger=require(_0x28cc('0x1'))(_0x28cc('0x2'));var moment=require(_0x28cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x28cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28cc('0x5'));var config=require(_0x28cc('0x6'));var attributes=require(_0x28cc('0x7'));module[_0x28cc('0x8')]=function(_0x66e9d7,_0x407db0){return _0x66e9d7[_0x28cc('0x9')](_0x28cc('0xa'),attributes,{'tableName':_0x28cc('0xb'),'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 eb0d625..54690fc 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 _0x9057=['client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x375f59,_0x3277c8){var _0x1d946a=function(_0x2b060d){while(--_0x2b060d){_0x375f59['push'](_0x375f59['shift']());}};_0x1d946a(++_0x3277c8);}(_0x9057,0x115));var _0x7905=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x9057[_0x506d83];return _0x335e8b;};'use strict';var _=require('lodash');var util=require(_0x7905('0x0'));var moment=require(_0x7905('0x1'));var BPromise=require('bluebird');var rs=require(_0x7905('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7905('0x3'))['db'];var utils=require(_0x7905('0x4'));var logger=require(_0x7905('0x5'))(_0x7905('0x6'));var config=require(_0x7905('0x7'));var jayson=require(_0x7905('0x8'));var client=jayson[_0x7905('0x9')][_0x7905('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dc468,_0x22d56f,_0x39acec){return new BPromise(function(_0x8ef517,_0x268992){return client[_0x7905('0xb')](_0x3dc468,_0x39acec)[_0x7905('0xc')](function(_0x69ce00){logger[_0x7905('0xd')](_0x7905('0xe'),_0x22d56f,_0x7905('0xf'));logger['debug'](_0x7905('0x10'),_0x22d56f,'request\x20sent',JSON[_0x7905('0x11')](_0x69ce00));if(_0x69ce00[_0x7905('0x12')]){if(_0x69ce00[_0x7905('0x12')]['code']===0x1f4){logger[_0x7905('0x12')](_0x7905('0xe'),_0x22d56f,_0x69ce00[_0x7905('0x12')][_0x7905('0x13')]);return _0x268992(_0x69ce00[_0x7905('0x12')][_0x7905('0x13')]);}logger['error'](_0x7905('0xe'),_0x22d56f,_0x69ce00[_0x7905('0x12')][_0x7905('0x13')]);return _0x8ef517(_0x69ce00[_0x7905('0x12')]['message']);}else{logger[_0x7905('0xd')]('MailServerOut,\x20%s,\x20%s',_0x22d56f,_0x7905('0xf'));_0x8ef517(_0x69ce00[_0x7905('0x14')][_0x7905('0x13')]);}})[_0x7905('0x15')](function(_0x3adddd){logger['error'](_0x7905('0xe'),_0x22d56f,_0x3adddd);_0x268992(_0x3adddd);});});} \ No newline at end of file +var _0x708b=['rpc','../../config/environment','jayson/promise','http','request','then','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c223c,_0x3cef2f){var _0x141766=function(_0x5c09ed){while(--_0x5c09ed){_0x1c223c['push'](_0x1c223c['shift']());}};_0x141766(++_0x3cef2f);}(_0x708b,0x178));var _0xb708=function(_0x1e3bef,_0x1bf91c){_0x1e3bef=_0x1e3bef-0x0;var _0x12a59c=_0x708b[_0x1e3bef];return _0x12a59c;};'use strict';var _=require(_0xb708('0x0'));var util=require(_0xb708('0x1'));var moment=require(_0xb708('0x2'));var BPromise=require(_0xb708('0x3'));var rs=require(_0xb708('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb708('0x5'))['db'];var utils=require(_0xb708('0x6'));var logger=require(_0xb708('0x7'))(_0xb708('0x8'));var config=require(_0xb708('0x9'));var jayson=require(_0xb708('0xa'));var client=jayson['client'][_0xb708('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f9452,_0x21f169,_0x2b52b4){return new BPromise(function(_0xe4e344,_0x37fb27){return client[_0xb708('0xc')](_0x4f9452,_0x2b52b4)[_0xb708('0xd')](function(_0x3ae598){logger['info'](_0xb708('0xe'),_0x21f169,'request\x20sent');logger[_0xb708('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x21f169,'request\x20sent',JSON[_0xb708('0x10')](_0x3ae598));if(_0x3ae598[_0xb708('0x11')]){if(_0x3ae598['error'][_0xb708('0x12')]===0x1f4){logger[_0xb708('0x11')]('MailServerOut,\x20%s,\x20%s',_0x21f169,_0x3ae598[_0xb708('0x11')][_0xb708('0x13')]);return _0x37fb27(_0x3ae598[_0xb708('0x11')][_0xb708('0x13')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x21f169,_0x3ae598[_0xb708('0x11')][_0xb708('0x13')]);return _0xe4e344(_0x3ae598['error'][_0xb708('0x13')]);}else{logger[_0xb708('0x14')]('MailServerOut,\x20%s,\x20%s',_0x21f169,_0xb708('0x15'));_0xe4e344(_0x3ae598[_0xb708('0x16')]['message']);}})[_0xb708('0x17')](function(_0x2cd95f){logger['error'](_0xb708('0xe'),_0x21f169,_0x2cd95f);_0x37fb27(_0x2cd95f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ecc2444..409d7f1 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 _0xd663=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','post','create'];(function(_0x10355a,_0x5ab3b9){var _0x3481ba=function(_0x271719){while(--_0x271719){_0x10355a['push'](_0x10355a['shift']());}};_0x3481ba(++_0x5ab3b9);}(_0xd663,0x68));var _0x3d66=function(_0x8af965,_0x7f0d57){_0x8af965=_0x8af965-0x0;var _0x4da3f1=_0xd663[_0x8af965];return _0x4da3f1;};'use strict';var multer=require('multer');var util=require(_0x3d66('0x0'));var path=require(_0x3d66('0x1'));var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var auth=require(_0x3d66('0x5'));var interaction=require(_0x3d66('0x6'));var config=require(_0x3d66('0x7'));var controller=require(_0x3d66('0x8'));router[_0x3d66('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d66('0xa')]);router[_0x3d66('0x9')]('/describe',auth[_0x3d66('0xb')](),controller[_0x3d66('0xc')]);router[_0x3d66('0x9')](_0x3d66('0xd'),auth[_0x3d66('0xb')](),controller['show']);router[_0x3d66('0xe')]('/',auth[_0x3d66('0xb')](),controller[_0x3d66('0xf')]);router[_0x3d66('0x10')]('/:id',auth[_0x3d66('0xb')](),controller['update']);router[_0x3d66('0x11')](_0x3d66('0xd'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x12')]);module[_0x3d66('0x13')]=router; \ No newline at end of file +var _0x8ee9=['/describe','describe','/:id','show','post','put','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8ee9,0xab));var _0x98ee=function(_0x12a7b0,_0x4c6fd9){_0x12a7b0=_0x12a7b0-0x0;var _0x4a0577=_0x8ee9[_0x12a7b0];return _0x4a0577;};'use strict';var multer=require(_0x98ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x98ee('0x1'));var express=require(_0x98ee('0x2'));var router=express['Router']();var auth=require(_0x98ee('0x3'));var interaction=require(_0x98ee('0x4'));var config=require(_0x98ee('0x5'));var controller=require('./mailSubstatus.controller');router[_0x98ee('0x6')]('/',auth[_0x98ee('0x7')](),controller[_0x98ee('0x8')]);router[_0x98ee('0x6')](_0x98ee('0x9'),auth[_0x98ee('0x7')](),controller[_0x98ee('0xa')]);router['get'](_0x98ee('0xb'),auth[_0x98ee('0x7')](),controller[_0x98ee('0xc')]);router[_0x98ee('0xd')]('/',auth[_0x98ee('0x7')](),controller['create']);router[_0x98ee('0xe')](_0x98ee('0xb'),auth[_0x98ee('0x7')](),controller[_0x98ee('0xf')]);router[_0x98ee('0x10')](_0x98ee('0xb'),auth[_0x98ee('0x7')](),controller[_0x98ee('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1a87199..a3384fe 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 _0x430c=['sequelize','name','STRING'];(function(_0x124bc0,_0x2c3aec){var _0x1023c2=function(_0x3adc75){while(--_0x3adc75){_0x124bc0['push'](_0x124bc0['shift']());}};_0x1023c2(++_0x2c3aec);}(_0x430c,0x1a1));var _0xc430=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x430c[_0x21b706];return _0x13b94a;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc430('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc430('0x2')]}}; \ No newline at end of file +var _0x3e4d=['STRING','sequelize'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x325a2c,_0x1897a8){_0x325a2c=_0x325a2c-0x0;var _0x80cb3d=_0x3e4d[_0x325a2c];return _0x80cb3d;};'use strict';var Sequelize=require(_0xd3e4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3e4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 253545c..ae17c22 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 _0x0854=['MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map'];(function(_0x4d5930,_0x1debcd){var _0x1f9323=function(_0x2f49ed){while(--_0x2f49ed){_0x4d5930['push'](_0x4d5930['shift']());}};_0x1f9323(++_0x1debcd);}(_0x0854,0xf8));var _0x4085=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0854[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4085('0x0'));var rimraf=require(_0x4085('0x1'));var zipdir=require(_0x4085('0x2'));var jsonpatch=require(_0x4085('0x3'));var rp=require(_0x4085('0x4'));var moment=require(_0x4085('0x5'));var BPromise=require(_0x4085('0x6'));var Mustache=require(_0x4085('0x7'));var util=require(_0x4085('0x8'));var path=require(_0x4085('0x9'));var sox=require('sox');var csv=require(_0x4085('0xa'));var ejs=require(_0x4085('0xb'));var fs=require('fs');var _=require(_0x4085('0xc'));var squel=require(_0x4085('0xd'));var crypto=require('crypto');var jsforce=require(_0x4085('0xe'));var deskjs=require(_0x4085('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4085('0x10'));var Papa=require(_0x4085('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4085('0x12'));var as=require(_0x4085('0x13'));var hardwareService=require(_0x4085('0x14'));var logger=require(_0x4085('0x15'))(_0x4085('0x16'));var utils=require(_0x4085('0x17'));var config=require(_0x4085('0x18'));var db=require(_0x4085('0x19'))['db'];function respondWithStatusCode(_0x1cefc3,_0x72135d){_0x72135d=_0x72135d||0xcc;return function(_0x24ca76){if(_0x24ca76){return _0x1cefc3[_0x4085('0x1a')](_0x72135d);}return _0x1cefc3['status'](_0x72135d)[_0x4085('0x1b')]();};}function respondWithResult(_0x1a8924,_0x2e36e7){_0x2e36e7=_0x2e36e7||0xc8;return function(_0x31f860){if(_0x31f860){return _0x1a8924['status'](_0x2e36e7)[_0x4085('0x1c')](_0x31f860);}};}function respondWithFilteredResult(_0x2c060d,_0xb71e84){return function(_0x41dd99){if(_0x41dd99){var _0x800edb=_0x41dd99[_0x4085('0x1d')],_0x4ce7a4=_0xb71e84[_0x4085('0x1e')],_0x21b81f=_0xb71e84['offset']+_0xb71e84['limit'],_0x3173d3;if(_0x21b81f>=_0x800edb){_0x21b81f=_0x800edb;_0x3173d3=0xc8;}else{_0x3173d3=0xce;}_0x2c060d[_0x4085('0x1f')](_0x3173d3);return _0x2c060d['set'](_0x4085('0x20'),_0x4ce7a4+'-'+_0x21b81f+'/'+_0x800edb)[_0x4085('0x1c')](_0x41dd99);}return null;};}function patchUpdates(_0x2320ad){return function(_0x352e49){try{jsonpatch[_0x4085('0x21')](_0x352e49,_0x2320ad,!![]);}catch(_0x191b81){return BPromise[_0x4085('0x22')](_0x191b81);}return _0x352e49[_0x4085('0x23')]();};}function saveUpdates(_0x243922,_0x514803){return function(_0x39612d){if(_0x39612d){return _0x39612d[_0x4085('0x24')](_0x243922)[_0x4085('0x25')](function(_0x1b711b){return _0x1b711b;});}return null;};}function removeEntity(_0x4b5206,_0x58b3d5){return function(_0x258f48){if(_0x258f48){return _0x258f48[_0x4085('0x26')]()[_0x4085('0x25')](function(){_0x4b5206['status'](0xcc)[_0x4085('0x1b')]();});}};}function handleEntityNotFound(_0x510fd8,_0x26a2b7){return function(_0x34b08b){if(!_0x34b08b){_0x510fd8['sendStatus'](0x194);}return _0x34b08b;};}function handleError(_0x203748,_0x2830ed){_0x2830ed=_0x2830ed||0x1f4;return function(_0x4127b9){logger[_0x4085('0x27')](_0x4127b9[_0x4085('0x28')]);if(_0x4127b9['name']){delete _0x4127b9[_0x4085('0x29')];}_0x203748[_0x4085('0x1f')](_0x2830ed)['send'](_0x4127b9);};}exports[_0x4085('0x2a')]=function(_0x513b8a,_0x3aa9d5){var _0x5ac0b4={},_0x49fefa={},_0x2e6965={'count':0x0,'rows':[]};var _0x3c5466=_[_0x4085('0x2b')](db[_0x4085('0x2c')][_0x4085('0x2d')],function(_0x157999){return{'name':_0x157999[_0x4085('0x2e')],'type':_0x157999[_0x4085('0x2f')][_0x4085('0x30')]};});_0x49fefa[_0x4085('0x31')]=_[_0x4085('0x2b')](_0x3c5466,_0x4085('0x29'));_0x49fefa[_0x4085('0x32')]=_[_0x4085('0x33')](_0x513b8a['query']);_0x49fefa[_0x4085('0x34')]=_[_0x4085('0x35')](_0x49fefa[_0x4085('0x31')],_0x49fefa[_0x4085('0x32')]);_0x5ac0b4['attributes']=_[_0x4085('0x35')](_0x49fefa[_0x4085('0x31')],qs[_0x4085('0x36')](_0x513b8a[_0x4085('0x32')][_0x4085('0x36')]));_0x5ac0b4['attributes']=_0x5ac0b4['attributes'][_0x4085('0x37')]?_0x5ac0b4[_0x4085('0x38')]:_0x49fefa[_0x4085('0x31')];if(!_0x513b8a['query']['hasOwnProperty']('nolimit')){_0x5ac0b4[_0x4085('0x39')]=qs[_0x4085('0x39')](_0x513b8a[_0x4085('0x32')][_0x4085('0x39')]);_0x5ac0b4[_0x4085('0x1e')]=qs[_0x4085('0x1e')](_0x513b8a[_0x4085('0x32')]['offset']);}_0x5ac0b4[_0x4085('0x3a')]=qs['sort'](_0x513b8a[_0x4085('0x32')][_0x4085('0x3b')]);_0x5ac0b4[_0x4085('0x3c')]=qs[_0x4085('0x34')](_['pick'](_0x513b8a[_0x4085('0x32')],_0x49fefa[_0x4085('0x34')]),_0x3c5466);if(_0x513b8a[_0x4085('0x32')][_0x4085('0x3d')]){_0x5ac0b4['where']=_[_0x4085('0x3e')](_0x5ac0b4[_0x4085('0x3c')],{'$or':_[_0x4085('0x2b')](_0x3c5466,function(_0xdf44bf){if(_0xdf44bf[_0x4085('0x2f')]!==_0x4085('0x3f')){var _0x15973f={};_0x15973f[_0xdf44bf['name']]={'$like':'%'+_0x513b8a[_0x4085('0x32')][_0x4085('0x3d')]+'%'};return _0x15973f;}})});}_0x5ac0b4=_[_0x4085('0x3e')]({},_0x5ac0b4,_0x513b8a[_0x4085('0x40')]);var _0x1a8752={'where':_0x5ac0b4[_0x4085('0x3c')]};return db[_0x4085('0x2c')][_0x4085('0x1d')](_0x1a8752)[_0x4085('0x25')](function(_0x2a3a58){_0x2e6965[_0x4085('0x1d')]=_0x2a3a58;if(_0x513b8a[_0x4085('0x32')][_0x4085('0x41')]){_0x5ac0b4[_0x4085('0x42')]=[{'all':!![]}];}return db[_0x4085('0x2c')]['findAll'](_0x5ac0b4);})[_0x4085('0x25')](function(_0x58d479){_0x2e6965['rows']=_0x58d479;return _0x2e6965;})[_0x4085('0x25')](respondWithFilteredResult(_0x3aa9d5,_0x5ac0b4))['catch'](handleError(_0x3aa9d5,null));};exports['show']=function(_0x39b6a7,_0x25331e){var _0x4fa275={'raw':!![],'where':{'id':_0x39b6a7[_0x4085('0x43')]['id']}},_0x331321={};_0x331321[_0x4085('0x31')]=_[_0x4085('0x33')](db[_0x4085('0x2c')][_0x4085('0x2d')]);_0x331321[_0x4085('0x32')]=_[_0x4085('0x33')](_0x39b6a7[_0x4085('0x32')]);_0x331321['filters']=_[_0x4085('0x35')](_0x331321[_0x4085('0x31')],_0x331321[_0x4085('0x32')]);_0x4fa275[_0x4085('0x38')]=_[_0x4085('0x35')](_0x331321[_0x4085('0x31')],qs[_0x4085('0x36')](_0x39b6a7[_0x4085('0x32')][_0x4085('0x36')]));_0x4fa275[_0x4085('0x38')]=_0x4fa275[_0x4085('0x38')][_0x4085('0x37')]?_0x4fa275[_0x4085('0x38')]:_0x331321[_0x4085('0x31')];if(_0x39b6a7[_0x4085('0x32')][_0x4085('0x41')]){_0x4fa275[_0x4085('0x42')]=[{'all':!![]}];}_0x4fa275=_[_0x4085('0x3e')]({},_0x4fa275,_0x39b6a7['options']);return db[_0x4085('0x2c')][_0x4085('0x44')](_0x4fa275)[_0x4085('0x25')](handleEntityNotFound(_0x25331e,null))['then'](respondWithResult(_0x25331e,null))['catch'](handleError(_0x25331e,null));};exports['create']=function(_0x4d8283,_0x2f92fb){return db['MailSubstatus'][_0x4085('0x45')](_0x4d8283['body'],{})[_0x4085('0x25')](respondWithResult(_0x2f92fb,0xc9))[_0x4085('0x46')](handleError(_0x2f92fb,null));};exports[_0x4085('0x24')]=function(_0x59623d,_0x24d096){if(_0x59623d[_0x4085('0x47')]['id']){delete _0x59623d[_0x4085('0x47')]['id'];}return db[_0x4085('0x2c')][_0x4085('0x44')]({'where':{'id':_0x59623d[_0x4085('0x43')]['id']}})[_0x4085('0x25')](handleEntityNotFound(_0x24d096,null))[_0x4085('0x25')](saveUpdates(_0x59623d[_0x4085('0x47')],null))[_0x4085('0x25')](respondWithResult(_0x24d096,null))[_0x4085('0x46')](handleError(_0x24d096,null));};exports[_0x4085('0x26')]=function(_0x4537dc,_0x51d9b5){return db[_0x4085('0x2c')][_0x4085('0x44')]({'where':{'id':_0x4537dc['params']['id']}})[_0x4085('0x25')](handleEntityNotFound(_0x51d9b5,null))['then'](removeEntity(_0x51d9b5,null))[_0x4085('0x46')](handleError(_0x51d9b5,null));};exports['describe']=function(_0x575ea5,_0x39501){return db['MailSubstatus'][_0x4085('0x48')]()[_0x4085('0x25')](respondWithResult(_0x39501,null))[_0x4085('0x46')](handleError(_0x39501,null));}; \ No newline at end of file +var _0xcae3=['rows','params','rawAttributes','length','includeAll','options','find','catch','create','body','update','destroy','describe','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','error','stack','name','send','map','MailSubstatus','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','include','findAll'];(function(_0x2e3d04,_0x202fe8){var _0x449b49=function(_0x4d0a6f){while(--_0x4d0a6f){_0x2e3d04['push'](_0x2e3d04['shift']());}};_0x449b49(++_0x202fe8);}(_0xcae3,0x125));var _0x3cae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcae3[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x3cae('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3cae('0x1'));var rp=require(_0x3cae('0x2'));var moment=require(_0x3cae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3cae('0x4'));var util=require(_0x3cae('0x5'));var path=require(_0x3cae('0x6'));var sox=require(_0x3cae('0x7'));var csv=require(_0x3cae('0x8'));var ejs=require(_0x3cae('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3cae('0xa'));var jsforce=require(_0x3cae('0xb'));var deskjs=require(_0x3cae('0xc'));var toCsv=require(_0x3cae('0x8'));var querystring=require(_0x3cae('0xd'));var Papa=require(_0x3cae('0xe'));var Redis=require(_0x3cae('0xf'));var authService=require(_0x3cae('0x10'));var qs=require(_0x3cae('0x11'));var as=require(_0x3cae('0x12'));var hardwareService=require(_0x3cae('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3cae('0x14'));var config=require(_0x3cae('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x172c34,_0x313eec){_0x313eec=_0x313eec||0xcc;return function(_0x361f2b){if(_0x361f2b){return _0x172c34[_0x3cae('0x16')](_0x313eec);}return _0x172c34[_0x3cae('0x17')](_0x313eec)[_0x3cae('0x18')]();};}function respondWithResult(_0x2d4219,_0x5498cd){_0x5498cd=_0x5498cd||0xc8;return function(_0x54a8c5){if(_0x54a8c5){return _0x2d4219['status'](_0x5498cd)[_0x3cae('0x19')](_0x54a8c5);}};}function respondWithFilteredResult(_0x14a2d5,_0x1d4a48){return function(_0x237b73){if(_0x237b73){var _0x2821e1=_0x237b73[_0x3cae('0x1a')],_0x4244cf=_0x1d4a48[_0x3cae('0x1b')],_0x1e00cc=_0x1d4a48[_0x3cae('0x1b')]+_0x1d4a48[_0x3cae('0x1c')],_0x27ccf0;if(_0x1e00cc>=_0x2821e1){_0x1e00cc=_0x2821e1;_0x27ccf0=0xc8;}else{_0x27ccf0=0xce;}_0x14a2d5[_0x3cae('0x17')](_0x27ccf0);return _0x14a2d5['set'](_0x3cae('0x1d'),_0x4244cf+'-'+_0x1e00cc+'/'+_0x2821e1)[_0x3cae('0x19')](_0x237b73);}return null;};}function patchUpdates(_0x4d0f1c){return function(_0x3de225){try{jsonpatch[_0x3cae('0x1e')](_0x3de225,_0x4d0f1c,!![]);}catch(_0x3ee0b3){return BPromise['reject'](_0x3ee0b3);}return _0x3de225[_0x3cae('0x1f')]();};}function saveUpdates(_0x43bb93,_0x243d36){return function(_0x40f940){if(_0x40f940){return _0x40f940['update'](_0x43bb93)['then'](function(_0x1002df){return _0x1002df;});}return null;};}function removeEntity(_0x341d88,_0x1bcd49){return function(_0x4d2c97){if(_0x4d2c97){return _0x4d2c97['destroy']()[_0x3cae('0x20')](function(){_0x341d88[_0x3cae('0x17')](0xcc)[_0x3cae('0x18')]();});}};}function handleEntityNotFound(_0x34cdac,_0x1a5df0){return function(_0x5935d1){if(!_0x5935d1){_0x34cdac[_0x3cae('0x16')](0x194);}return _0x5935d1;};}function handleError(_0x274d48,_0x54532b){_0x54532b=_0x54532b||0x1f4;return function(_0x372418){logger[_0x3cae('0x21')](_0x372418[_0x3cae('0x22')]);if(_0x372418['name']){delete _0x372418[_0x3cae('0x23')];}_0x274d48[_0x3cae('0x17')](_0x54532b)[_0x3cae('0x24')](_0x372418);};}exports['index']=function(_0x3642a0,_0x11e494){var _0x46bcf2={},_0x1c31ef={},_0x18e8fd={'count':0x0,'rows':[]};var _0x3f48cc=_[_0x3cae('0x25')](db[_0x3cae('0x26')]['rawAttributes'],function(_0x4575f0){return{'name':_0x4575f0[_0x3cae('0x27')],'type':_0x4575f0[_0x3cae('0x28')][_0x3cae('0x29')]};});_0x1c31ef['model']=_[_0x3cae('0x25')](_0x3f48cc,'name');_0x1c31ef[_0x3cae('0x2a')]=_[_0x3cae('0x2b')](_0x3642a0['query']);_0x1c31ef[_0x3cae('0x2c')]=_[_0x3cae('0x2d')](_0x1c31ef[_0x3cae('0x2e')],_0x1c31ef[_0x3cae('0x2a')]);_0x46bcf2[_0x3cae('0x2f')]=_[_0x3cae('0x2d')](_0x1c31ef['model'],qs[_0x3cae('0x30')](_0x3642a0[_0x3cae('0x2a')][_0x3cae('0x30')]));_0x46bcf2['attributes']=_0x46bcf2[_0x3cae('0x2f')]['length']?_0x46bcf2[_0x3cae('0x2f')]:_0x1c31ef[_0x3cae('0x2e')];if(!_0x3642a0[_0x3cae('0x2a')]['hasOwnProperty']('nolimit')){_0x46bcf2['limit']=qs[_0x3cae('0x1c')](_0x3642a0[_0x3cae('0x2a')][_0x3cae('0x1c')]);_0x46bcf2[_0x3cae('0x1b')]=qs[_0x3cae('0x1b')](_0x3642a0[_0x3cae('0x2a')][_0x3cae('0x1b')]);}_0x46bcf2[_0x3cae('0x31')]=qs[_0x3cae('0x32')](_0x3642a0[_0x3cae('0x2a')][_0x3cae('0x32')]);_0x46bcf2[_0x3cae('0x33')]=qs[_0x3cae('0x2c')](_[_0x3cae('0x34')](_0x3642a0[_0x3cae('0x2a')],_0x1c31ef[_0x3cae('0x2c')]),_0x3f48cc);if(_0x3642a0[_0x3cae('0x2a')][_0x3cae('0x35')]){_0x46bcf2[_0x3cae('0x33')]=_[_0x3cae('0x36')](_0x46bcf2[_0x3cae('0x33')],{'$or':_['map'](_0x3f48cc,function(_0x22588f){if(_0x22588f['type']!=='VIRTUAL'){var _0x26c699={};_0x26c699[_0x22588f['name']]={'$like':'%'+_0x3642a0[_0x3cae('0x2a')][_0x3cae('0x35')]+'%'};return _0x26c699;}})});}_0x46bcf2=_[_0x3cae('0x36')]({},_0x46bcf2,_0x3642a0['options']);var _0x58bce0={'where':_0x46bcf2[_0x3cae('0x33')]};return db['MailSubstatus']['count'](_0x58bce0)[_0x3cae('0x20')](function(_0x3d3a41){_0x18e8fd[_0x3cae('0x1a')]=_0x3d3a41;if(_0x3642a0['query']['includeAll']){_0x46bcf2[_0x3cae('0x37')]=[{'all':!![]}];}return db[_0x3cae('0x26')][_0x3cae('0x38')](_0x46bcf2);})[_0x3cae('0x20')](function(_0x1d7055){_0x18e8fd[_0x3cae('0x39')]=_0x1d7055;return _0x18e8fd;})[_0x3cae('0x20')](respondWithFilteredResult(_0x11e494,_0x46bcf2))['catch'](handleError(_0x11e494,null));};exports['show']=function(_0x3a78a6,_0x17e3c3){var _0x424420={'raw':!![],'where':{'id':_0x3a78a6[_0x3cae('0x3a')]['id']}},_0x43f7f9={};_0x43f7f9[_0x3cae('0x2e')]=_[_0x3cae('0x2b')](db[_0x3cae('0x26')][_0x3cae('0x3b')]);_0x43f7f9[_0x3cae('0x2a')]=_[_0x3cae('0x2b')](_0x3a78a6[_0x3cae('0x2a')]);_0x43f7f9[_0x3cae('0x2c')]=_[_0x3cae('0x2d')](_0x43f7f9['model'],_0x43f7f9[_0x3cae('0x2a')]);_0x424420[_0x3cae('0x2f')]=_[_0x3cae('0x2d')](_0x43f7f9[_0x3cae('0x2e')],qs[_0x3cae('0x30')](_0x3a78a6[_0x3cae('0x2a')][_0x3cae('0x30')]));_0x424420[_0x3cae('0x2f')]=_0x424420['attributes'][_0x3cae('0x3c')]?_0x424420['attributes']:_0x43f7f9['model'];if(_0x3a78a6['query'][_0x3cae('0x3d')]){_0x424420[_0x3cae('0x37')]=[{'all':!![]}];}_0x424420=_[_0x3cae('0x36')]({},_0x424420,_0x3a78a6[_0x3cae('0x3e')]);return db['MailSubstatus'][_0x3cae('0x3f')](_0x424420)[_0x3cae('0x20')](handleEntityNotFound(_0x17e3c3,null))[_0x3cae('0x20')](respondWithResult(_0x17e3c3,null))[_0x3cae('0x40')](handleError(_0x17e3c3,null));};exports[_0x3cae('0x41')]=function(_0x359892,_0x393490){return db[_0x3cae('0x26')]['create'](_0x359892[_0x3cae('0x42')],{})[_0x3cae('0x20')](respondWithResult(_0x393490,0xc9))[_0x3cae('0x40')](handleError(_0x393490,null));};exports[_0x3cae('0x43')]=function(_0x219912,_0x4d0024){if(_0x219912[_0x3cae('0x42')]['id']){delete _0x219912['body']['id'];}return db[_0x3cae('0x26')][_0x3cae('0x3f')]({'where':{'id':_0x219912[_0x3cae('0x3a')]['id']}})[_0x3cae('0x20')](handleEntityNotFound(_0x4d0024,null))[_0x3cae('0x20')](saveUpdates(_0x219912[_0x3cae('0x42')],null))[_0x3cae('0x20')](respondWithResult(_0x4d0024,null))[_0x3cae('0x40')](handleError(_0x4d0024,null));};exports[_0x3cae('0x44')]=function(_0x3e2099,_0x18491b){return db[_0x3cae('0x26')][_0x3cae('0x3f')]({'where':{'id':_0x3e2099['params']['id']}})['then'](handleEntityNotFound(_0x18491b,null))[_0x3cae('0x20')](removeEntity(_0x18491b,null))[_0x3cae('0x40')](handleError(_0x18491b,null));};exports[_0x3cae('0x45')]=function(_0x2c6d9e,_0x5ba11c){return db[_0x3cae('0x26')][_0x3cae('0x45')]()[_0x3cae('0x20')](respondWithResult(_0x5ba11c,null))['catch'](handleError(_0x5ba11c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 566cb15..365ea54 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 _0xe7c8=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','util','../../config/logger','api','moment'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0xe7c8,0x194));var _0x8e7c=function(_0x46f139,_0x422c14){_0x46f139=_0x46f139-0x0;var _0x5a3727=_0xe7c8[_0x46f139];return _0x5a3727;};'use strict';var _=require('lodash');var util=require(_0x8e7c('0x0'));var logger=require(_0x8e7c('0x1'))(_0x8e7c('0x2'));var moment=require(_0x8e7c('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e7c('0x4'));var fs=require('fs');var path=require(_0x8e7c('0x5'));var rimraf=require(_0x8e7c('0x6'));var config=require(_0x8e7c('0x7'));var attributes=require(_0x8e7c('0x8'));module[_0x8e7c('0x9')]=function(_0x1e4186,_0x1a92c4){return _0x1e4186[_0x8e7c('0xa')](_0x8e7c('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7506=['rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x15a03f,_0x14b92f){var _0x53d06b=function(_0x8477ce){while(--_0x8477ce){_0x15a03f['push'](_0x15a03f['shift']());}};_0x53d06b(++_0x14b92f);}(_0x7506,0x172));var _0x6750=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x7506[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x6750('0x0'));var util=require(_0x6750('0x1'));var logger=require(_0x6750('0x2'))(_0x6750('0x3'));var moment=require('moment');var BPromise=require(_0x6750('0x4'));var rp=require(_0x6750('0x5'));var fs=require('fs');var path=require(_0x6750('0x6'));var rimraf=require(_0x6750('0x7'));var config=require(_0x6750('0x8'));var attributes=require(_0x6750('0x9'));module['exports']=function(_0x33eb0c,_0x57e597){return _0x33eb0c[_0x6750('0xa')](_0x6750('0xb'),attributes,{'tableName':_0x6750('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2a2f288..d91cea4 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 _0xbdb7=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x33d7e9,_0x500ef5){_0x33d7e9=_0x33d7e9-0x0;var _0x269ff1=_0xbdb7[_0x33d7e9];return _0x269ff1;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x418269,_0x16e305){var _0x48cccd=function(_0x192f7e){while(--_0x192f7e){_0x418269['push'](_0x418269['shift']());}};_0x48cccd(++_0x16e305);}(_0xe706,0xa3));var _0x6e70=function(_0x4d4c63,_0x33ac30){_0x4d4c63=_0x4d4c63-0x0;var _0x383b63=_0xe706[_0x4d4c63];return _0x383b63;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f7677f4..b840c0c 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 _0x8795=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8795,0x161));var _0x5879=function(_0x4d421f,_0x114481){_0x4d421f=_0x4d421f-0x0;var _0x1cf5ab=_0x8795[_0x4d421f];return _0x1cf5ab;};'use strict';var multer=require(_0x5879('0x0'));var util=require(_0x5879('0x1'));var path=require('path');var timeout=require(_0x5879('0x2'));var express=require(_0x5879('0x3'));var router=express[_0x5879('0x4')]();var auth=require(_0x5879('0x5'));var interaction=require(_0x5879('0x6'));var config=require(_0x5879('0x7'));var controller=require(_0x5879('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5879('0x9')]);router['get'](_0x5879('0xa'),auth['isAuthenticated'](),controller[_0x5879('0xb')]);router['get'](_0x5879('0xc'),auth[_0x5879('0xd')](),controller[_0x5879('0xe')]);router[_0x5879('0xf')]('/',auth['isAuthenticated'](),controller[_0x5879('0x10')]);router[_0x5879('0x11')](_0x5879('0xc'),auth['isAuthenticated'](),controller[_0x5879('0x12')]);router[_0x5879('0x13')]('/:id',auth[_0x5879('0xd')](),controller[_0x5879('0x14')]);module['exports']=router; \ No newline at end of file +var _0x45a6=['Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x5623a3,_0x43cc19){var _0x1f7409=function(_0x15424c){while(--_0x15424c){_0x5623a3['push'](_0x5623a3['shift']());}};_0x1f7409(++_0x43cc19);}(_0x45a6,0xf3));var _0x645a=function(_0x41ff6e,_0x540135){_0x41ff6e=_0x41ff6e-0x0;var _0x33d458=_0x45a6[_0x41ff6e];return _0x33d458;};'use strict';var multer=require(_0x645a('0x0'));var util=require(_0x645a('0x1'));var path=require(_0x645a('0x2'));var timeout=require(_0x645a('0x3'));var express=require('express');var router=express[_0x645a('0x4')]();var auth=require(_0x645a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x645a('0x6'));var controller=require(_0x645a('0x7'));router['get']('/',auth[_0x645a('0x8')](),controller[_0x645a('0x9')]);router[_0x645a('0xa')](_0x645a('0xb'),auth[_0x645a('0x8')](),controller[_0x645a('0xc')]);router[_0x645a('0xa')](_0x645a('0xd'),auth[_0x645a('0x8')](),controller['show']);router[_0x645a('0xe')]('/',auth['isAuthenticated'](),controller[_0x645a('0xf')]);router[_0x645a('0x10')]('/:id',auth[_0x645a('0x8')](),controller[_0x645a('0x11')]);router[_0x645a('0x12')](_0x645a('0xd'),auth[_0x645a('0x8')](),controller['destroy']);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 93bc7c5..812f75d 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 _0x834d=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x5e3cd6,_0x4fd9cd){var _0x125794=function(_0x4b007c){while(--_0x4b007c){_0x5e3cd6['push'](_0x5e3cd6['shift']());}};_0x125794(++_0x4fd9cd);}(_0x834d,0x93));var _0xd834=function(_0x174b97,_0x9803d5){_0x174b97=_0x174b97-0x0;var _0x5de371=_0x834d[_0x174b97];return _0x5de371;};'use strict';var moment=require(_0xd834('0x0'));var Sequelize=require('sequelize');module[_0xd834('0x1')]={'uniqueid':{'type':Sequelize[_0xd834('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd834('0x3')](_0xd834('0x4'),_0xd834('0x5'),_0xd834('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd834('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xd834('0x8')]}}; \ No newline at end of file +var _0x7433=['account','queue','DATE','NOW','moment','exports','STRING','ENUM'];(function(_0x38e67d,_0x12ded8){var _0x1de06d=function(_0xa67021){while(--_0xa67021){_0x38e67d['push'](_0x38e67d['shift']());}};_0x1de06d(++_0x12ded8);}(_0x7433,0x144));var _0x3743=function(_0x7b8b47,_0x274711){_0x7b8b47=_0x7b8b47-0x0;var _0x5b3c2a=_0x7433[_0x7b8b47];return _0x5b3c2a;};'use strict';var moment=require(_0x3743('0x0'));var Sequelize=require('sequelize');module[_0x3743('0x1')]={'uniqueid':{'type':Sequelize[_0x3743('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3743('0x3')](_0x3743('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x3743('0x5')},'transferredAt':{'type':Sequelize[_0x3743('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3743('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3071aee..93235be 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 _0xb211=['zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','limit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','show','params','length','include','find','create','body','catch','describe','eml-format','rimraf'];(function(_0x31749b,_0x3a3f5b){var _0x27ae18=function(_0x16a90e){while(--_0x16a90e){_0x31749b['push'](_0x31749b['shift']());}};_0x27ae18(++_0x3a3f5b);}(_0xb211,0xd3));var _0x1b21=function(_0x5a5aab,_0x1ca3ea){_0x5a5aab=_0x5a5aab-0x0;var _0x1ba525=_0xb211[_0x5a5aab];return _0x1ba525;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b21('0x0'));var rimraf=require(_0x1b21('0x1'));var zipdir=require(_0x1b21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b21('0x3'));var moment=require(_0x1b21('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b21('0x5'));var path=require(_0x1b21('0x6'));var sox=require(_0x1b21('0x7'));var csv=require(_0x1b21('0x8'));var ejs=require(_0x1b21('0x9'));var fs=require('fs');var _=require(_0x1b21('0xa'));var squel=require(_0x1b21('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b21('0xc'));var deskjs=require(_0x1b21('0xd'));var toCsv=require(_0x1b21('0x8'));var querystring=require('querystring');var Papa=require(_0x1b21('0xe'));var Redis=require(_0x1b21('0xf'));var authService=require(_0x1b21('0x10'));var qs=require(_0x1b21('0x11'));var as=require(_0x1b21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1b21('0x13'));var utils=require(_0x1b21('0x14'));var config=require('../../config/environment');var db=require(_0x1b21('0x15'))['db'];function respondWithStatusCode(_0x270530,_0x5ec95c){_0x5ec95c=_0x5ec95c||0xcc;return function(_0x160c85){if(_0x160c85){return _0x270530['sendStatus'](_0x5ec95c);}return _0x270530[_0x1b21('0x16')](_0x5ec95c)[_0x1b21('0x17')]();};}function respondWithResult(_0x1671ca,_0x2aacbd){_0x2aacbd=_0x2aacbd||0xc8;return function(_0x2965b8){if(_0x2965b8){return _0x1671ca[_0x1b21('0x16')](_0x2aacbd)[_0x1b21('0x18')](_0x2965b8);}};}function respondWithFilteredResult(_0x457b48,_0x2982f0){return function(_0x54a296){if(_0x54a296){var _0x44948d=_0x54a296[_0x1b21('0x19')],_0x179f83=_0x2982f0['offset'],_0x15bd5e=_0x2982f0[_0x1b21('0x1a')]+_0x2982f0['limit'],_0x1d6ee5;if(_0x15bd5e>=_0x44948d){_0x15bd5e=_0x44948d;_0x1d6ee5=0xc8;}else{_0x1d6ee5=0xce;}_0x457b48[_0x1b21('0x16')](_0x1d6ee5);return _0x457b48[_0x1b21('0x1b')]('Content-Range',_0x179f83+'-'+_0x15bd5e+'/'+_0x44948d)[_0x1b21('0x18')](_0x54a296);}return null;};}function patchUpdates(_0x517b76){return function(_0x378668){try{jsonpatch[_0x1b21('0x1c')](_0x378668,_0x517b76,!![]);}catch(_0x1be55f){return BPromise[_0x1b21('0x1d')](_0x1be55f);}return _0x378668[_0x1b21('0x1e')]();};}function saveUpdates(_0x325649,_0x19d598){return function(_0x1c3e23){if(_0x1c3e23){return _0x1c3e23[_0x1b21('0x1f')](_0x325649)['then'](function(_0x932176){return _0x932176;});}return null;};}function removeEntity(_0x8d12dd,_0x2882bd){return function(_0x22531f){if(_0x22531f){return _0x22531f[_0x1b21('0x20')]()[_0x1b21('0x21')](function(){_0x8d12dd[_0x1b21('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae352,_0x590749){return function(_0x1b0de0){if(!_0x1b0de0){_0x5ae352[_0x1b21('0x22')](0x194);}return _0x1b0de0;};}function handleError(_0x51a608,_0x8d7348){_0x8d7348=_0x8d7348||0x1f4;return function(_0x4c1b70){logger['error'](_0x4c1b70[_0x1b21('0x23')]);if(_0x4c1b70[_0x1b21('0x24')]){delete _0x4c1b70[_0x1b21('0x24')];}_0x51a608[_0x1b21('0x16')](_0x8d7348)[_0x1b21('0x25')](_0x4c1b70);};}exports[_0x1b21('0x26')]=function(_0x4b7124,_0x10e945){var _0x15e488={},_0x330094={},_0xaf3e0a={'count':0x0,'rows':[]};var _0x18c3c9=_['map'](db[_0x1b21('0x27')][_0x1b21('0x28')],function(_0x3a46fe){return{'name':_0x3a46fe[_0x1b21('0x29')],'type':_0x3a46fe['type'][_0x1b21('0x2a')]};});_0x330094['model']=_[_0x1b21('0x2b')](_0x18c3c9,_0x1b21('0x24'));_0x330094[_0x1b21('0x2c')]=_[_0x1b21('0x2d')](_0x4b7124[_0x1b21('0x2c')]);_0x330094[_0x1b21('0x2e')]=_[_0x1b21('0x2f')](_0x330094[_0x1b21('0x30')],_0x330094['query']);_0x15e488['attributes']=_[_0x1b21('0x2f')](_0x330094['model'],qs[_0x1b21('0x31')](_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x31')]));_0x15e488[_0x1b21('0x32')]=_0x15e488['attributes']['length']?_0x15e488[_0x1b21('0x32')]:_0x330094['model'];if(!_0x4b7124[_0x1b21('0x2c')]['hasOwnProperty']('nolimit')){_0x15e488[_0x1b21('0x33')]=qs['limit'](_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x33')]);_0x15e488[_0x1b21('0x1a')]=qs[_0x1b21('0x1a')](_0x4b7124[_0x1b21('0x2c')]['offset']);}_0x15e488[_0x1b21('0x34')]=qs[_0x1b21('0x35')](_0x4b7124['query'][_0x1b21('0x35')]);_0x15e488[_0x1b21('0x36')]=qs[_0x1b21('0x2e')](_['pick'](_0x4b7124['query'],_0x330094[_0x1b21('0x2e')]),_0x18c3c9);if(_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x37')]){_0x15e488[_0x1b21('0x36')]=_[_0x1b21('0x38')](_0x15e488[_0x1b21('0x36')],{'$or':_[_0x1b21('0x2b')](_0x18c3c9,function(_0x454b2f){if(_0x454b2f[_0x1b21('0x39')]!==_0x1b21('0x3a')){var _0x16f9a7={};_0x16f9a7[_0x454b2f[_0x1b21('0x24')]]={'$like':'%'+_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x37')]+'%'};return _0x16f9a7;}})});}_0x15e488=_['merge']({},_0x15e488,_0x4b7124[_0x1b21('0x3b')]);var _0x33b22f={'where':_0x15e488[_0x1b21('0x36')]};return db['MailTransferReport'][_0x1b21('0x19')](_0x33b22f)['then'](function(_0x2fb5c4){_0xaf3e0a[_0x1b21('0x19')]=_0x2fb5c4;if(_0x4b7124[_0x1b21('0x2c')]['includeAll']){_0x15e488['include']=[{'all':!![]}];}return db[_0x1b21('0x27')][_0x1b21('0x3c')](_0x15e488);})[_0x1b21('0x21')](function(_0xe43b75){_0xaf3e0a[_0x1b21('0x3d')]=_0xe43b75;return _0xaf3e0a;})[_0x1b21('0x21')](respondWithFilteredResult(_0x10e945,_0x15e488))['catch'](handleError(_0x10e945,null));};exports[_0x1b21('0x3e')]=function(_0xeb4cd9,_0x565b60){var _0x3b9beb={'raw':!![],'where':{'id':_0xeb4cd9[_0x1b21('0x3f')]['id']}},_0x2cfe9f={};_0x2cfe9f[_0x1b21('0x30')]=_[_0x1b21('0x2d')](db[_0x1b21('0x27')]['rawAttributes']);_0x2cfe9f[_0x1b21('0x2c')]=_['keys'](_0xeb4cd9[_0x1b21('0x2c')]);_0x2cfe9f[_0x1b21('0x2e')]=_[_0x1b21('0x2f')](_0x2cfe9f[_0x1b21('0x30')],_0x2cfe9f['query']);_0x3b9beb[_0x1b21('0x32')]=_[_0x1b21('0x2f')](_0x2cfe9f['model'],qs[_0x1b21('0x31')](_0xeb4cd9[_0x1b21('0x2c')]['fields']));_0x3b9beb[_0x1b21('0x32')]=_0x3b9beb['attributes'][_0x1b21('0x40')]?_0x3b9beb[_0x1b21('0x32')]:_0x2cfe9f['model'];if(_0xeb4cd9[_0x1b21('0x2c')]['includeAll']){_0x3b9beb[_0x1b21('0x41')]=[{'all':!![]}];}_0x3b9beb=_[_0x1b21('0x38')]({},_0x3b9beb,_0xeb4cd9['options']);return db[_0x1b21('0x27')][_0x1b21('0x42')](_0x3b9beb)[_0x1b21('0x21')](handleEntityNotFound(_0x565b60,null))[_0x1b21('0x21')](respondWithResult(_0x565b60,null))['catch'](handleError(_0x565b60,null));};exports[_0x1b21('0x43')]=function(_0xa1dd4c,_0x42735e){return db[_0x1b21('0x27')][_0x1b21('0x43')](_0xa1dd4c['body'],{})[_0x1b21('0x21')](respondWithResult(_0x42735e,0xc9))['catch'](handleError(_0x42735e,null));};exports[_0x1b21('0x1f')]=function(_0x5e29bb,_0x20dde3){if(_0x5e29bb[_0x1b21('0x44')]['id']){delete _0x5e29bb['body']['id'];}return db[_0x1b21('0x27')][_0x1b21('0x42')]({'where':{'id':_0x5e29bb[_0x1b21('0x3f')]['id']}})[_0x1b21('0x21')](handleEntityNotFound(_0x20dde3,null))[_0x1b21('0x21')](saveUpdates(_0x5e29bb[_0x1b21('0x44')],null))[_0x1b21('0x21')](respondWithResult(_0x20dde3,null))[_0x1b21('0x45')](handleError(_0x20dde3,null));};exports[_0x1b21('0x20')]=function(_0x2a599b,_0x58e5ab){return db[_0x1b21('0x27')][_0x1b21('0x42')]({'where':{'id':_0x2a599b['params']['id']}})[_0x1b21('0x21')](handleEntityNotFound(_0x58e5ab,null))[_0x1b21('0x21')](removeEntity(_0x58e5ab,null))[_0x1b21('0x45')](handleError(_0x58e5ab,null));};exports['describe']=function(_0x544b9a,_0x2ff899){return db['MailTransferReport'][_0x1b21('0x46')]()[_0x1b21('0x21')](respondWithResult(_0x2ff899,null))[_0x1b21('0x45')](handleError(_0x2ff899,null));}; \ No newline at end of file +var _0x50b3=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','MailTransferReport','type','key','model','query'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x50b3,0x172));var _0x350b=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0x50b3[_0x258257];return _0xafb58a;};'use strict';var pdf=require(_0x350b('0x0'));var emlformat=require(_0x350b('0x1'));var rimraf=require(_0x350b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x350b('0x3'));var rp=require(_0x350b('0x4'));var moment=require(_0x350b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x350b('0x6'));var util=require(_0x350b('0x7'));var path=require(_0x350b('0x8'));var sox=require(_0x350b('0x9'));var csv=require(_0x350b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x350b('0xb'));var squel=require('squel');var crypto=require(_0x350b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x350b('0xd'));var toCsv=require(_0x350b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x350b('0xe'));var authService=require(_0x350b('0xf'));var qs=require(_0x350b('0x10'));var as=require(_0x350b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x350b('0x12'))('api');var utils=require(_0x350b('0x13'));var config=require(_0x350b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x598465,_0x37bc32){_0x37bc32=_0x37bc32||0xcc;return function(_0x204411){if(_0x204411){return _0x598465[_0x350b('0x15')](_0x37bc32);}return _0x598465[_0x350b('0x16')](_0x37bc32)[_0x350b('0x17')]();};}function respondWithResult(_0x54dfad,_0x4d3a8d){_0x4d3a8d=_0x4d3a8d||0xc8;return function(_0x4ec140){if(_0x4ec140){return _0x54dfad[_0x350b('0x16')](_0x4d3a8d)[_0x350b('0x18')](_0x4ec140);}};}function respondWithFilteredResult(_0x5e3002,_0x52f880){return function(_0x2f903){if(_0x2f903){var _0x381801=_0x2f903[_0x350b('0x19')],_0xc6cb13=_0x52f880[_0x350b('0x1a')],_0x357ec4=_0x52f880[_0x350b('0x1a')]+_0x52f880['limit'],_0x4e090e;if(_0x357ec4>=_0x381801){_0x357ec4=_0x381801;_0x4e090e=0xc8;}else{_0x4e090e=0xce;}_0x5e3002[_0x350b('0x16')](_0x4e090e);return _0x5e3002[_0x350b('0x1b')](_0x350b('0x1c'),_0xc6cb13+'-'+_0x357ec4+'/'+_0x381801)[_0x350b('0x18')](_0x2f903);}return null;};}function patchUpdates(_0x450507){return function(_0x987af9){try{jsonpatch[_0x350b('0x1d')](_0x987af9,_0x450507,!![]);}catch(_0x420179){return BPromise['reject'](_0x420179);}return _0x987af9[_0x350b('0x1e')]();};}function saveUpdates(_0x25b1d3,_0x59ae7c){return function(_0x9dd5bb){if(_0x9dd5bb){return _0x9dd5bb[_0x350b('0x1f')](_0x25b1d3)['then'](function(_0x499d76){return _0x499d76;});}return null;};}function removeEntity(_0x2784c7,_0x329639){return function(_0x4ae237){if(_0x4ae237){return _0x4ae237[_0x350b('0x20')]()[_0x350b('0x21')](function(){_0x2784c7[_0x350b('0x16')](0xcc)[_0x350b('0x17')]();});}};}function handleEntityNotFound(_0x1c1ae7,_0x10535c){return function(_0x2c1e9a){if(!_0x2c1e9a){_0x1c1ae7[_0x350b('0x15')](0x194);}return _0x2c1e9a;};}function handleError(_0x4d129d,_0x48c0d2){_0x48c0d2=_0x48c0d2||0x1f4;return function(_0x34c7f1){logger['error'](_0x34c7f1[_0x350b('0x22')]);if(_0x34c7f1[_0x350b('0x23')]){delete _0x34c7f1[_0x350b('0x23')];}_0x4d129d['status'](_0x48c0d2)[_0x350b('0x24')](_0x34c7f1);};}exports[_0x350b('0x25')]=function(_0x42194a,_0x2d5724){var _0x35fca1={},_0x5cfd5a={},_0x13808e={'count':0x0,'rows':[]};var _0x2e7b00=_[_0x350b('0x26')](db[_0x350b('0x27')]['rawAttributes'],function(_0x3a71bf){return{'name':_0x3a71bf['fieldName'],'type':_0x3a71bf[_0x350b('0x28')][_0x350b('0x29')]};});_0x5cfd5a[_0x350b('0x2a')]=_[_0x350b('0x26')](_0x2e7b00,'name');_0x5cfd5a[_0x350b('0x2b')]=_[_0x350b('0x2c')](_0x42194a[_0x350b('0x2b')]);_0x5cfd5a[_0x350b('0x2d')]=_[_0x350b('0x2e')](_0x5cfd5a[_0x350b('0x2a')],_0x5cfd5a[_0x350b('0x2b')]);_0x35fca1['attributes']=_[_0x350b('0x2e')](_0x5cfd5a[_0x350b('0x2a')],qs[_0x350b('0x2f')](_0x42194a[_0x350b('0x2b')][_0x350b('0x2f')]));_0x35fca1[_0x350b('0x30')]=_0x35fca1[_0x350b('0x30')][_0x350b('0x31')]?_0x35fca1['attributes']:_0x5cfd5a[_0x350b('0x2a')];if(!_0x42194a[_0x350b('0x2b')][_0x350b('0x32')]('nolimit')){_0x35fca1[_0x350b('0x33')]=qs[_0x350b('0x33')](_0x42194a[_0x350b('0x2b')]['limit']);_0x35fca1['offset']=qs[_0x350b('0x1a')](_0x42194a[_0x350b('0x2b')][_0x350b('0x1a')]);}_0x35fca1[_0x350b('0x34')]=qs[_0x350b('0x35')](_0x42194a[_0x350b('0x2b')][_0x350b('0x35')]);_0x35fca1[_0x350b('0x36')]=qs['filters'](_[_0x350b('0x37')](_0x42194a['query'],_0x5cfd5a[_0x350b('0x2d')]),_0x2e7b00);if(_0x42194a[_0x350b('0x2b')][_0x350b('0x38')]){_0x35fca1[_0x350b('0x36')]=_[_0x350b('0x39')](_0x35fca1[_0x350b('0x36')],{'$or':_[_0x350b('0x26')](_0x2e7b00,function(_0x3887c7){if(_0x3887c7[_0x350b('0x28')]!==_0x350b('0x3a')){var _0x4ecfaf={};_0x4ecfaf[_0x3887c7['name']]={'$like':'%'+_0x42194a[_0x350b('0x2b')][_0x350b('0x38')]+'%'};return _0x4ecfaf;}})});}_0x35fca1=_['merge']({},_0x35fca1,_0x42194a['options']);var _0x3f5715={'where':_0x35fca1[_0x350b('0x36')]};return db[_0x350b('0x27')][_0x350b('0x19')](_0x3f5715)[_0x350b('0x21')](function(_0x34edf0){_0x13808e[_0x350b('0x19')]=_0x34edf0;if(_0x42194a['query'][_0x350b('0x3b')]){_0x35fca1['include']=[{'all':!![]}];}return db[_0x350b('0x27')]['findAll'](_0x35fca1);})['then'](function(_0x3a45dc){_0x13808e[_0x350b('0x3c')]=_0x3a45dc;return _0x13808e;})[_0x350b('0x21')](respondWithFilteredResult(_0x2d5724,_0x35fca1))[_0x350b('0x3d')](handleError(_0x2d5724,null));};exports['show']=function(_0x3fc389,_0x3ce613){var _0x3b592d={'raw':!![],'where':{'id':_0x3fc389[_0x350b('0x3e')]['id']}},_0x2e33f8={};_0x2e33f8[_0x350b('0x2a')]=_['keys'](db[_0x350b('0x27')]['rawAttributes']);_0x2e33f8['query']=_[_0x350b('0x2c')](_0x3fc389['query']);_0x2e33f8[_0x350b('0x2d')]=_[_0x350b('0x2e')](_0x2e33f8['model'],_0x2e33f8[_0x350b('0x2b')]);_0x3b592d[_0x350b('0x30')]=_[_0x350b('0x2e')](_0x2e33f8[_0x350b('0x2a')],qs['fields'](_0x3fc389[_0x350b('0x2b')]['fields']));_0x3b592d['attributes']=_0x3b592d['attributes']['length']?_0x3b592d[_0x350b('0x30')]:_0x2e33f8[_0x350b('0x2a')];if(_0x3fc389['query']['includeAll']){_0x3b592d[_0x350b('0x3f')]=[{'all':!![]}];}_0x3b592d=_[_0x350b('0x39')]({},_0x3b592d,_0x3fc389[_0x350b('0x40')]);return db[_0x350b('0x27')][_0x350b('0x41')](_0x3b592d)[_0x350b('0x21')](handleEntityNotFound(_0x3ce613,null))[_0x350b('0x21')](respondWithResult(_0x3ce613,null))[_0x350b('0x3d')](handleError(_0x3ce613,null));};exports[_0x350b('0x42')]=function(_0x21253b,_0x56b06f){return db['MailTransferReport'][_0x350b('0x42')](_0x21253b[_0x350b('0x43')],{})[_0x350b('0x21')](respondWithResult(_0x56b06f,0xc9))['catch'](handleError(_0x56b06f,null));};exports[_0x350b('0x1f')]=function(_0x109f85,_0x57cba8){if(_0x109f85[_0x350b('0x43')]['id']){delete _0x109f85[_0x350b('0x43')]['id'];}return db[_0x350b('0x27')][_0x350b('0x41')]({'where':{'id':_0x109f85['params']['id']}})[_0x350b('0x21')](handleEntityNotFound(_0x57cba8,null))['then'](saveUpdates(_0x109f85[_0x350b('0x43')],null))[_0x350b('0x21')](respondWithResult(_0x57cba8,null))[_0x350b('0x3d')](handleError(_0x57cba8,null));};exports[_0x350b('0x20')]=function(_0x4c6c2a,_0x5e1ae5){return db['MailTransferReport']['find']({'where':{'id':_0x4c6c2a[_0x350b('0x3e')]['id']}})[_0x350b('0x21')](handleEntityNotFound(_0x5e1ae5,null))[_0x350b('0x21')](removeEntity(_0x5e1ae5,null))['catch'](handleError(_0x5e1ae5,null));};exports[_0x350b('0x44')]=function(_0x266257,_0x483d10){return db['MailTransferReport']['describe']()[_0x350b('0x21')](respondWithResult(_0x483d10,null))[_0x350b('0x3d')](handleError(_0x483d10,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2fbf0dc..b054bff 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 _0x9b81=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2ecbbf,_0x21abde){var _0x314081=function(_0x43c908){while(--_0x43c908){_0x2ecbbf['push'](_0x2ecbbf['shift']());}};_0x314081(++_0x21abde);}(_0x9b81,0x1bb));var _0x19b8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9b81[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x19b8('0x0'));var util=require(_0x19b8('0x1'));var logger=require(_0x19b8('0x2'))(_0x19b8('0x3'));var moment=require('moment');var BPromise=require(_0x19b8('0x4'));var rp=require(_0x19b8('0x5'));var fs=require('fs');var path=require(_0x19b8('0x6'));var rimraf=require(_0x19b8('0x7'));var config=require(_0x19b8('0x8'));var attributes=require(_0x19b8('0x9'));module[_0x19b8('0xa')]=function(_0x1221ef,_0x5a8c9e){return _0x1221ef[_0x19b8('0xb')](_0x19b8('0xc'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x19b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd965=['util','../../config/logger','moment','bluebird','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd965,0x87));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5d96('0x0'));var logger=require(_0x5d96('0x1'))('api');var moment=require(_0x5d96('0x2'));var BPromise=require(_0x5d96('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5d96('0x4'));module[_0x5d96('0x5')]=function(_0x46a575,_0x4d644e){return _0x46a575[_0x5d96('0x6')](_0x5d96('0x7'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5d96('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8daaec2..804aecb 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 _0x33d5=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3e4d28,_0x3face9){var _0x11a3af=function(_0x26c146){while(--_0x26c146){_0x3e4d28['push'](_0x3e4d28['shift']());}};_0x11a3af(++_0x3face9);}(_0x33d5,0xa3));var _0x533d=function(_0x17898f,_0x177e1e){_0x17898f=_0x17898f-0x0;var _0x49908d=_0x33d5[_0x17898f];return _0x49908d;};'use strict';var _=require(_0x533d('0x0'));var util=require(_0x533d('0x1'));var moment=require(_0x533d('0x2'));var BPromise=require(_0x533d('0x3'));var rs=require(_0x533d('0x4'));var fs=require('fs');var Redis=require(_0x533d('0x5'));var db=require(_0x533d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x533d('0x7'));var config=require(_0x533d('0x8'));var jayson=require(_0x533d('0x9'));var client=jayson[_0x533d('0xa')][_0x533d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174531,_0x380439,_0x71d9fd){return new BPromise(function(_0x21a3d5,_0x154307){return client[_0x533d('0xc')](_0x174531,_0x71d9fd)[_0x533d('0xd')](function(_0x4d7b76){logger[_0x533d('0xe')](_0x533d('0xf'),_0x380439,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x380439,'request\x20sent',JSON['stringify'](_0x4d7b76));if(_0x4d7b76[_0x533d('0x10')]){if(_0x4d7b76[_0x533d('0x10')]['code']===0x1f4){logger[_0x533d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x380439,_0x4d7b76[_0x533d('0x10')][_0x533d('0x11')]);return _0x154307(_0x4d7b76['error'][_0x533d('0x11')]);}logger[_0x533d('0x10')](_0x533d('0xf'),_0x380439,_0x4d7b76[_0x533d('0x10')][_0x533d('0x11')]);return _0x21a3d5(_0x4d7b76[_0x533d('0x10')][_0x533d('0x11')]);}else{logger[_0x533d('0xe')](_0x533d('0xf'),_0x380439,_0x533d('0x12'));_0x21a3d5(_0x4d7b76[_0x533d('0x13')]['message']);}})[_0x533d('0x14')](function(_0x5e6064){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x380439,_0x5e6064);_0x154307(_0x5e6064);});});} \ No newline at end of file +var _0x559e=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x359208,_0x36a877){var _0x1adcf8=function(_0x19ccf5){while(--_0x19ccf5){_0x359208['push'](_0x359208['shift']());}};_0x1adcf8(++_0x36a877);}(_0x559e,0x82));var _0xe559=function(_0x1f300b,_0x4ee744){_0x1f300b=_0x1f300b-0x0;var _0x2a4d8b=_0x559e[_0x1f300b];return _0x2a4d8b;};'use strict';var _=require(_0xe559('0x0'));var util=require(_0xe559('0x1'));var moment=require(_0xe559('0x2'));var BPromise=require('bluebird');var rs=require(_0xe559('0x3'));var fs=require('fs');var Redis=require(_0xe559('0x4'));var db=require(_0xe559('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe559('0x6'))('rpc');var config=require(_0xe559('0x7'));var jayson=require(_0xe559('0x8'));var client=jayson[_0xe559('0x9')][_0xe559('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ba2ab,_0x4f59f5,_0x582575){return new BPromise(function(_0x2d8dbd,_0x5d6ea5){return client[_0xe559('0xb')](_0x4ba2ab,_0x582575)['then'](function(_0x468979){logger['info'](_0xe559('0xc'),_0x4f59f5,_0xe559('0xd'));logger[_0xe559('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4f59f5,_0xe559('0xd'),JSON[_0xe559('0xf')](_0x468979));if(_0x468979['error']){if(_0x468979['error']['code']===0x1f4){logger[_0xe559('0x10')](_0xe559('0xc'),_0x4f59f5,_0x468979[_0xe559('0x10')][_0xe559('0x11')]);return _0x5d6ea5(_0x468979['error'][_0xe559('0x11')]);}logger[_0xe559('0x10')](_0xe559('0xc'),_0x4f59f5,_0x468979[_0xe559('0x10')]['message']);return _0x2d8dbd(_0x468979['error'][_0xe559('0x11')]);}else{logger[_0xe559('0x12')](_0xe559('0xc'),_0x4f59f5,_0xe559('0xd'));_0x2d8dbd(_0x468979[_0xe559('0x13')]['message']);}})[_0xe559('0x14')](function(_0xfa2a0d){logger[_0xe559('0x10')](_0xe559('0xc'),_0x4f59f5,_0xfa2a0d);_0x5d6ea5(_0xfa2a0d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2528570..6a74b2b 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 _0x0428=['get','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index'];(function(_0x10b47e,_0x1f8b2f){var _0x4e26d4=function(_0x170b66){while(--_0x170b66){_0x10b47e['push'](_0x10b47e['shift']());}};_0x4e26d4(++_0x1f8b2f);}(_0x0428,0xb2));var _0x8042=function(_0x1e603d,_0x14a537){_0x1e603d=_0x1e603d-0x0;var _0x542701=_0x0428[_0x1e603d];return _0x542701;};'use strict';var multer=require(_0x8042('0x0'));var util=require(_0x8042('0x1'));var path=require(_0x8042('0x2'));var timeout=require('connect-timeout');var express=require(_0x8042('0x3'));var router=express[_0x8042('0x4')]();var auth=require(_0x8042('0x5'));var interaction=require(_0x8042('0x6'));var config=require(_0x8042('0x7'));var controller=require(_0x8042('0x8'));router['get']('/',auth[_0x8042('0x9')](),controller[_0x8042('0xa')]);router[_0x8042('0xb')](_0x8042('0xc'),auth[_0x8042('0x9')](),controller['describe']);router[_0x8042('0xb')](_0x8042('0xd'),auth[_0x8042('0x9')](),controller['show']);router[_0x8042('0xe')]('/',auth[_0x8042('0x9')](),controller[_0x8042('0xf')]);router[_0x8042('0x10')](_0x8042('0xd'),auth[_0x8042('0x9')](),controller[_0x8042('0x11')]);router[_0x8042('0x12')](_0x8042('0xd'),auth[_0x8042('0x9')](),controller[_0x8042('0x13')]);module[_0x8042('0x14')]=router; \ No newline at end of file +var _0xf983=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x40f7f8,_0x45b81f){var _0x552bef=function(_0x2fd838){while(--_0x2fd838){_0x40f7f8['push'](_0x40f7f8['shift']());}};_0x552bef(++_0x45b81f);}(_0xf983,0x1ca));var _0x3f98=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xf983[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x3f98('0x0'));var util=require('util');var path=require(_0x3f98('0x1'));var timeout=require(_0x3f98('0x2'));var express=require(_0x3f98('0x3'));var router=express['Router']();var auth=require(_0x3f98('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f98('0x5'));var controller=require('./memberReport.controller');router[_0x3f98('0x6')]('/',auth[_0x3f98('0x7')](),controller[_0x3f98('0x8')]);router[_0x3f98('0x6')](_0x3f98('0x9'),auth['isAuthenticated'](),controller[_0x3f98('0xa')]);router[_0x3f98('0x6')](_0x3f98('0xb'),auth[_0x3f98('0x7')](),controller[_0x3f98('0xc')]);router[_0x3f98('0xd')]('/',auth[_0x3f98('0x7')](),controller[_0x3f98('0xe')]);router[_0x3f98('0xf')](_0x3f98('0xb'),auth[_0x3f98('0x7')](),controller['update']);router[_0x3f98('0x10')](_0x3f98('0xb'),auth['isAuthenticated'](),controller[_0x3f98('0x11')]);module[_0x3f98('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 87f5502..7515061 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 _0xc481=['setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0xf071fa,_0x1cd190){var _0x2a432a=function(_0x22873e){while(--_0x22873e){_0xf071fa['push'](_0xf071fa['shift']());}};_0x2a432a(++_0x1cd190);}(_0xc481,0xaa));var _0x1c48=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0xc481[_0x27a3cb];return _0x54ff38;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1c48('0x0'));module[_0x1c48('0x1')]={'channel':{'type':Sequelize[_0x1c48('0x2')]},'membername':{'type':Sequelize[_0x1c48('0x2')]},'interface':{'type':Sequelize[_0x1c48('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x1c48('0x3'),'comment':_0x1c48('0x4')},'duration':{'type':Sequelize[_0x1c48('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1c48('0x6')],'set':function(_0x199482){var _0x505aa6=moment(_0x199482);var _0x4447aa=moment(this[_0x1c48('0x7')]('enterAt'));var _0x17b300=_0x505aa6[_0x1c48('0x8')](_0x4447aa,_0x1c48('0x9'));this[_0x1c48('0xa')](_0x1c48('0xb'),_0x199482);this[_0x1c48('0xa')]('duration',_0x17b300||null);}},'data1':{'type':Sequelize[_0x1c48('0x2')],'comment':_0x1c48('0xc')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x1c48('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x1c48('0x2')],'comment':_0x1c48('0xd')},'data5':{'type':Sequelize[_0x1c48('0x2')],'comment':_0x1c48('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1c48('0x2')]}}; \ No newline at end of file +var _0x1510=['diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt'];(function(_0x5c4aee,_0x450e0e){var _0x286dfc=function(_0x5e45a1){while(--_0x5e45a1){_0x5c4aee['push'](_0x5c4aee['shift']());}};_0x286dfc(++_0x450e0e);}(_0x1510,0xa0));var _0x0151=function(_0x49544e,_0x34926d){_0x49544e=_0x49544e-0x0;var _0x1fa8c7=_0x1510[_0x49544e];return _0x1fa8c7;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0151('0x0')]={'channel':{'type':Sequelize[_0x0151('0x1')]},'membername':{'type':Sequelize[_0x0151('0x1')]},'interface':{'type':Sequelize[_0x0151('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x0151('0x2')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x0151('0x3')]},'exitAt':{'type':Sequelize[_0x0151('0x3')],'set':function(_0x56e176){var _0x5e9979=moment(_0x56e176);var _0x10a249=moment(this['getDataValue'](_0x0151('0x4')));var _0x4a9759=_0x5e9979[_0x0151('0x5')](_0x10a249,_0x0151('0x6'));this['setDataValue'](_0x0151('0x7'),_0x56e176);this[_0x0151('0x8')](_0x0151('0x9'),_0x4a9759||null);}},'data1':{'type':Sequelize[_0x0151('0x1')],'comment':_0x0151('0xa')},'data2':{'type':Sequelize['STRING'],'comment':_0x0151('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0x0151('0xc')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x0151('0x1')],'comment':_0x0151('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x0151('0xe')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 6589a19..87e5751 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 _0xdfdc=['destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','MemberReport','includeAll','rows','catch','show','params','include','options','find','create','body'];(function(_0xeac684,_0x38acc4){var _0xb48b7c=function(_0x5b8c4f){while(--_0x5b8c4f){_0xeac684['push'](_0xeac684['shift']());}};_0xb48b7c(++_0x38acc4);}(_0xdfdc,0x10a));var _0xcdfd=function(_0x4f9b13,_0x384bae){_0x4f9b13=_0x4f9b13-0x0;var _0x5244fa=_0xdfdc[_0x4f9b13];return _0x5244fa;};'use strict';var pdf=require(_0xcdfd('0x0'));var emlformat=require(_0xcdfd('0x1'));var rimraf=require(_0xcdfd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfd('0x3'));var moment=require(_0xcdfd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x5'));var util=require(_0xcdfd('0x6'));var path=require('path');var sox=require(_0xcdfd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcdfd('0x8'));var toCsv=require(_0xcdfd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdfd('0xa'));var authService=require(_0xcdfd('0xb'));var qs=require(_0xcdfd('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdfd('0xd'));var logger=require(_0xcdfd('0xe'))('api');var utils=require(_0xcdfd('0xf'));var config=require('../../config/environment');var db=require(_0xcdfd('0x10'))['db'];function respondWithStatusCode(_0x14bb10,_0x38dff1){_0x38dff1=_0x38dff1||0xcc;return function(_0x15ef1b){if(_0x15ef1b){return _0x14bb10[_0xcdfd('0x11')](_0x38dff1);}return _0x14bb10[_0xcdfd('0x12')](_0x38dff1)[_0xcdfd('0x13')]();};}function respondWithResult(_0x25ad3d,_0x22bcfb){_0x22bcfb=_0x22bcfb||0xc8;return function(_0x362a61){if(_0x362a61){return _0x25ad3d[_0xcdfd('0x12')](_0x22bcfb)[_0xcdfd('0x14')](_0x362a61);}};}function respondWithFilteredResult(_0x121e83,_0x4e0bb9){return function(_0x1722aa){if(_0x1722aa){var _0x28154=_0x1722aa[_0xcdfd('0x15')],_0x245789=_0x4e0bb9[_0xcdfd('0x16')],_0x3d936=_0x4e0bb9['offset']+_0x4e0bb9['limit'],_0x1f6a95;if(_0x3d936>=_0x28154){_0x3d936=_0x28154;_0x1f6a95=0xc8;}else{_0x1f6a95=0xce;}_0x121e83['status'](_0x1f6a95);return _0x121e83[_0xcdfd('0x17')](_0xcdfd('0x18'),_0x245789+'-'+_0x3d936+'/'+_0x28154)[_0xcdfd('0x14')](_0x1722aa);}return null;};}function patchUpdates(_0x30f35d){return function(_0x35ccb9){try{jsonpatch[_0xcdfd('0x19')](_0x35ccb9,_0x30f35d,!![]);}catch(_0x4b5a57){return BPromise[_0xcdfd('0x1a')](_0x4b5a57);}return _0x35ccb9[_0xcdfd('0x1b')]();};}function saveUpdates(_0x54ec0a,_0x27183d){return function(_0x31a5e4){if(_0x31a5e4){return _0x31a5e4[_0xcdfd('0x1c')](_0x54ec0a)[_0xcdfd('0x1d')](function(_0x5d1c7f){return _0x5d1c7f;});}return null;};}function removeEntity(_0x19bdb8,_0x545869){return function(_0x1f01a0){if(_0x1f01a0){return _0x1f01a0['destroy']()['then'](function(){_0x19bdb8[_0xcdfd('0x12')](0xcc)[_0xcdfd('0x13')]();});}};}function handleEntityNotFound(_0x18b7db,_0x39a79f){return function(_0x1b3d5d){if(!_0x1b3d5d){_0x18b7db[_0xcdfd('0x11')](0x194);}return _0x1b3d5d;};}function handleError(_0x50bc65,_0x141bf0){_0x141bf0=_0x141bf0||0x1f4;return function(_0x510abf){logger['error'](_0x510abf[_0xcdfd('0x1e')]);if(_0x510abf['name']){delete _0x510abf[_0xcdfd('0x1f')];}_0x50bc65['status'](_0x141bf0)[_0xcdfd('0x20')](_0x510abf);};}exports[_0xcdfd('0x21')]=function(_0x377df4,_0x13e815){var _0x3a6400={},_0x1719ed={},_0x5b66e3={'count':0x0,'rows':[]};var _0x2b3018=_[_0xcdfd('0x22')](db['MemberReport'][_0xcdfd('0x23')],function(_0x4582a1){return{'name':_0x4582a1[_0xcdfd('0x24')],'type':_0x4582a1[_0xcdfd('0x25')]['key']};});_0x1719ed['model']=_['map'](_0x2b3018,_0xcdfd('0x1f'));_0x1719ed['query']=_[_0xcdfd('0x26')](_0x377df4[_0xcdfd('0x27')]);_0x1719ed[_0xcdfd('0x28')]=_['intersection'](_0x1719ed[_0xcdfd('0x29')],_0x1719ed[_0xcdfd('0x27')]);_0x3a6400[_0xcdfd('0x2a')]=_[_0xcdfd('0x2b')](_0x1719ed[_0xcdfd('0x29')],qs[_0xcdfd('0x2c')](_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x2c')]));_0x3a6400[_0xcdfd('0x2a')]=_0x3a6400[_0xcdfd('0x2a')][_0xcdfd('0x2d')]?_0x3a6400[_0xcdfd('0x2a')]:_0x1719ed['model'];if(!_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x2e')]('nolimit')){_0x3a6400[_0xcdfd('0x2f')]=qs[_0xcdfd('0x2f')](_0x377df4['query'][_0xcdfd('0x2f')]);_0x3a6400['offset']=qs[_0xcdfd('0x16')](_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x16')]);}_0x3a6400[_0xcdfd('0x30')]=qs[_0xcdfd('0x31')](_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x31')]);_0x3a6400[_0xcdfd('0x32')]=qs['filters'](_[_0xcdfd('0x33')](_0x377df4['query'],_0x1719ed[_0xcdfd('0x28')]),_0x2b3018);if(_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x34')]){_0x3a6400[_0xcdfd('0x32')]=_['merge'](_0x3a6400['where'],{'$or':_[_0xcdfd('0x22')](_0x2b3018,function(_0x43c687){if(_0x43c687[_0xcdfd('0x25')]!=='VIRTUAL'){var _0x552793={};_0x552793[_0x43c687['name']]={'$like':'%'+_0x377df4['query'][_0xcdfd('0x34')]+'%'};return _0x552793;}})});}_0x3a6400=_['merge']({},_0x3a6400,_0x377df4['options']);var _0x3c0ae0={'where':_0x3a6400[_0xcdfd('0x32')]};return db[_0xcdfd('0x35')]['count'](_0x3c0ae0)[_0xcdfd('0x1d')](function(_0x53897a){_0x5b66e3[_0xcdfd('0x15')]=_0x53897a;if(_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x36')]){_0x3a6400['include']=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x3a6400);})[_0xcdfd('0x1d')](function(_0x49f6ce){_0x5b66e3[_0xcdfd('0x37')]=_0x49f6ce;return _0x5b66e3;})[_0xcdfd('0x1d')](respondWithFilteredResult(_0x13e815,_0x3a6400))[_0xcdfd('0x38')](handleError(_0x13e815,null));};exports[_0xcdfd('0x39')]=function(_0x341f6d,_0x58fc0e){var _0x22af21={'raw':!![],'where':{'id':_0x341f6d[_0xcdfd('0x3a')]['id']}},_0x5b8c50={};_0x5b8c50[_0xcdfd('0x29')]=_['keys'](db[_0xcdfd('0x35')][_0xcdfd('0x23')]);_0x5b8c50[_0xcdfd('0x27')]=_[_0xcdfd('0x26')](_0x341f6d['query']);_0x5b8c50[_0xcdfd('0x28')]=_[_0xcdfd('0x2b')](_0x5b8c50['model'],_0x5b8c50[_0xcdfd('0x27')]);_0x22af21[_0xcdfd('0x2a')]=_[_0xcdfd('0x2b')](_0x5b8c50[_0xcdfd('0x29')],qs[_0xcdfd('0x2c')](_0x341f6d[_0xcdfd('0x27')][_0xcdfd('0x2c')]));_0x22af21[_0xcdfd('0x2a')]=_0x22af21[_0xcdfd('0x2a')][_0xcdfd('0x2d')]?_0x22af21[_0xcdfd('0x2a')]:_0x5b8c50[_0xcdfd('0x29')];if(_0x341f6d[_0xcdfd('0x27')][_0xcdfd('0x36')]){_0x22af21[_0xcdfd('0x3b')]=[{'all':!![]}];}_0x22af21=_['merge']({},_0x22af21,_0x341f6d[_0xcdfd('0x3c')]);return db[_0xcdfd('0x35')][_0xcdfd('0x3d')](_0x22af21)[_0xcdfd('0x1d')](handleEntityNotFound(_0x58fc0e,null))[_0xcdfd('0x1d')](respondWithResult(_0x58fc0e,null))['catch'](handleError(_0x58fc0e,null));};exports[_0xcdfd('0x3e')]=function(_0x38a077,_0x5c3211){return db[_0xcdfd('0x35')][_0xcdfd('0x3e')](_0x38a077[_0xcdfd('0x3f')],{})[_0xcdfd('0x1d')](respondWithResult(_0x5c3211,0xc9))[_0xcdfd('0x38')](handleError(_0x5c3211,null));};exports[_0xcdfd('0x1c')]=function(_0x54e1b5,_0xdf67cf){if(_0x54e1b5[_0xcdfd('0x3f')]['id']){delete _0x54e1b5['body']['id'];}return db[_0xcdfd('0x35')][_0xcdfd('0x3d')]({'where':{'id':_0x54e1b5[_0xcdfd('0x3a')]['id']}})[_0xcdfd('0x1d')](handleEntityNotFound(_0xdf67cf,null))[_0xcdfd('0x1d')](saveUpdates(_0x54e1b5[_0xcdfd('0x3f')],null))['then'](respondWithResult(_0xdf67cf,null))[_0xcdfd('0x38')](handleError(_0xdf67cf,null));};exports[_0xcdfd('0x40')]=function(_0x54ce07,_0x1ec0f6){return db[_0xcdfd('0x35')][_0xcdfd('0x3d')]({'where':{'id':_0x54ce07[_0xcdfd('0x3a')]['id']}})[_0xcdfd('0x1d')](handleEntityNotFound(_0x1ec0f6,null))['then'](removeEntity(_0x1ec0f6,null))['catch'](handleError(_0x1ec0f6,null));};exports['describe']=function(_0x39c4e0,_0xb73585){return db['MemberReport'][_0xcdfd('0x41')]()[_0xcdfd('0x1d')](respondWithResult(_0xb73585,null))[_0xcdfd('0x38')](handleError(_0xb73585,null));}; \ No newline at end of file +var _0x90da=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','zip-dir','request-promise','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','MemberReport','rawAttributes'];(function(_0x108f38,_0xae2818){var _0x2c7d7c=function(_0x23f533){while(--_0x23f533){_0x108f38['push'](_0x108f38['shift']());}};_0x2c7d7c(++_0xae2818);}(_0x90da,0xef));var _0xa90d=function(_0x2ff1d9,_0x1e91e1){_0x2ff1d9=_0x2ff1d9-0x0;var _0x284953=_0x90da[_0x2ff1d9];return _0x284953;};'use strict';var pdf=require(_0xa90d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa90d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa90d('0x2'));var moment=require(_0xa90d('0x3'));var BPromise=require(_0xa90d('0x4'));var Mustache=require('mustache');var util=require(_0xa90d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa90d('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa90d('0x7'));var squel=require(_0xa90d('0x8'));var crypto=require('crypto');var jsforce=require(_0xa90d('0x9'));var deskjs=require(_0xa90d('0xa'));var toCsv=require(_0xa90d('0x6'));var querystring=require(_0xa90d('0xb'));var Papa=require(_0xa90d('0xc'));var Redis=require(_0xa90d('0xd'));var authService=require(_0xa90d('0xe'));var qs=require(_0xa90d('0xf'));var as=require(_0xa90d('0x10'));var hardwareService=require(_0xa90d('0x11'));var logger=require('../../config/logger')(_0xa90d('0x12'));var utils=require(_0xa90d('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f7e3,_0x338986){_0x338986=_0x338986||0xcc;return function(_0x355afa){if(_0x355afa){return _0x37f7e3[_0xa90d('0x14')](_0x338986);}return _0x37f7e3[_0xa90d('0x15')](_0x338986)[_0xa90d('0x16')]();};}function respondWithResult(_0x4165d5,_0x4052a7){_0x4052a7=_0x4052a7||0xc8;return function(_0x164e27){if(_0x164e27){return _0x4165d5[_0xa90d('0x15')](_0x4052a7)[_0xa90d('0x17')](_0x164e27);}};}function respondWithFilteredResult(_0x33f3a1,_0x361203){return function(_0x12a2d9){if(_0x12a2d9){var _0x3e2369=_0x12a2d9[_0xa90d('0x18')],_0x53f913=_0x361203[_0xa90d('0x19')],_0x54d25b=_0x361203['offset']+_0x361203[_0xa90d('0x1a')],_0x4b0575;if(_0x54d25b>=_0x3e2369){_0x54d25b=_0x3e2369;_0x4b0575=0xc8;}else{_0x4b0575=0xce;}_0x33f3a1[_0xa90d('0x15')](_0x4b0575);return _0x33f3a1[_0xa90d('0x1b')](_0xa90d('0x1c'),_0x53f913+'-'+_0x54d25b+'/'+_0x3e2369)[_0xa90d('0x17')](_0x12a2d9);}return null;};}function patchUpdates(_0x4eda09){return function(_0xbe4360){try{jsonpatch[_0xa90d('0x1d')](_0xbe4360,_0x4eda09,!![]);}catch(_0x2fee43){return BPromise['reject'](_0x2fee43);}return _0xbe4360[_0xa90d('0x1e')]();};}function saveUpdates(_0x40e983,_0x21d24d){return function(_0x42a7bd){if(_0x42a7bd){return _0x42a7bd[_0xa90d('0x1f')](_0x40e983)['then'](function(_0x2fb5a8){return _0x2fb5a8;});}return null;};}function removeEntity(_0x142fd7,_0x21c4b0){return function(_0x4ea9dd){if(_0x4ea9dd){return _0x4ea9dd[_0xa90d('0x20')]()[_0xa90d('0x21')](function(){_0x142fd7[_0xa90d('0x15')](0xcc)[_0xa90d('0x16')]();});}};}function handleEntityNotFound(_0x34afb3,_0x211529){return function(_0x215958){if(!_0x215958){_0x34afb3[_0xa90d('0x14')](0x194);}return _0x215958;};}function handleError(_0x2c2fac,_0x372866){_0x372866=_0x372866||0x1f4;return function(_0x237e14){logger[_0xa90d('0x22')](_0x237e14[_0xa90d('0x23')]);if(_0x237e14[_0xa90d('0x24')]){delete _0x237e14['name'];}_0x2c2fac[_0xa90d('0x15')](_0x372866)[_0xa90d('0x25')](_0x237e14);};}exports[_0xa90d('0x26')]=function(_0x117bb6,_0x1b67d4){var _0x480153={},_0x5dc36f={},_0x5764c4={'count':0x0,'rows':[]};var _0x3ee863=_['map'](db[_0xa90d('0x27')][_0xa90d('0x28')],function(_0xc919c1){return{'name':_0xc919c1[_0xa90d('0x29')],'type':_0xc919c1[_0xa90d('0x2a')][_0xa90d('0x2b')]};});_0x5dc36f[_0xa90d('0x2c')]=_['map'](_0x3ee863,_0xa90d('0x24'));_0x5dc36f[_0xa90d('0x2d')]=_[_0xa90d('0x2e')](_0x117bb6['query']);_0x5dc36f['filters']=_[_0xa90d('0x2f')](_0x5dc36f[_0xa90d('0x2c')],_0x5dc36f[_0xa90d('0x2d')]);_0x480153[_0xa90d('0x30')]=_[_0xa90d('0x2f')](_0x5dc36f[_0xa90d('0x2c')],qs[_0xa90d('0x31')](_0x117bb6[_0xa90d('0x2d')][_0xa90d('0x31')]));_0x480153[_0xa90d('0x30')]=_0x480153[_0xa90d('0x30')][_0xa90d('0x32')]?_0x480153[_0xa90d('0x30')]:_0x5dc36f[_0xa90d('0x2c')];if(!_0x117bb6[_0xa90d('0x2d')][_0xa90d('0x33')]('nolimit')){_0x480153['limit']=qs[_0xa90d('0x1a')](_0x117bb6[_0xa90d('0x2d')][_0xa90d('0x1a')]);_0x480153['offset']=qs[_0xa90d('0x19')](_0x117bb6['query'][_0xa90d('0x19')]);}_0x480153['order']=qs[_0xa90d('0x34')](_0x117bb6['query'][_0xa90d('0x34')]);_0x480153[_0xa90d('0x35')]=qs[_0xa90d('0x36')](_['pick'](_0x117bb6[_0xa90d('0x2d')],_0x5dc36f[_0xa90d('0x36')]),_0x3ee863);if(_0x117bb6['query'][_0xa90d('0x37')]){_0x480153[_0xa90d('0x35')]=_[_0xa90d('0x38')](_0x480153[_0xa90d('0x35')],{'$or':_[_0xa90d('0x39')](_0x3ee863,function(_0x1cc732){if(_0x1cc732['type']!=='VIRTUAL'){var _0x463229={};_0x463229[_0x1cc732['name']]={'$like':'%'+_0x117bb6[_0xa90d('0x2d')][_0xa90d('0x37')]+'%'};return _0x463229;}})});}_0x480153=_['merge']({},_0x480153,_0x117bb6[_0xa90d('0x3a')]);var _0x115263={'where':_0x480153[_0xa90d('0x35')]};return db[_0xa90d('0x27')][_0xa90d('0x18')](_0x115263)['then'](function(_0x4e76ad){_0x5764c4[_0xa90d('0x18')]=_0x4e76ad;if(_0x117bb6['query'][_0xa90d('0x3b')]){_0x480153[_0xa90d('0x3c')]=[{'all':!![]}];}return db[_0xa90d('0x27')][_0xa90d('0x3d')](_0x480153);})['then'](function(_0x4d744c){_0x5764c4[_0xa90d('0x3e')]=_0x4d744c;return _0x5764c4;})[_0xa90d('0x21')](respondWithFilteredResult(_0x1b67d4,_0x480153))[_0xa90d('0x3f')](handleError(_0x1b67d4,null));};exports[_0xa90d('0x40')]=function(_0x4f0823,_0x289727){var _0x5d82f3={'raw':!![],'where':{'id':_0x4f0823[_0xa90d('0x41')]['id']}},_0x2fc232={};_0x2fc232[_0xa90d('0x2c')]=_[_0xa90d('0x2e')](db[_0xa90d('0x27')]['rawAttributes']);_0x2fc232[_0xa90d('0x2d')]=_['keys'](_0x4f0823[_0xa90d('0x2d')]);_0x2fc232[_0xa90d('0x36')]=_[_0xa90d('0x2f')](_0x2fc232[_0xa90d('0x2c')],_0x2fc232[_0xa90d('0x2d')]);_0x5d82f3[_0xa90d('0x30')]=_[_0xa90d('0x2f')](_0x2fc232[_0xa90d('0x2c')],qs['fields'](_0x4f0823[_0xa90d('0x2d')][_0xa90d('0x31')]));_0x5d82f3[_0xa90d('0x30')]=_0x5d82f3[_0xa90d('0x30')][_0xa90d('0x32')]?_0x5d82f3[_0xa90d('0x30')]:_0x2fc232['model'];if(_0x4f0823[_0xa90d('0x2d')]['includeAll']){_0x5d82f3[_0xa90d('0x3c')]=[{'all':!![]}];}_0x5d82f3=_[_0xa90d('0x38')]({},_0x5d82f3,_0x4f0823[_0xa90d('0x3a')]);return db[_0xa90d('0x27')][_0xa90d('0x42')](_0x5d82f3)['then'](handleEntityNotFound(_0x289727,null))[_0xa90d('0x21')](respondWithResult(_0x289727,null))['catch'](handleError(_0x289727,null));};exports[_0xa90d('0x43')]=function(_0x1f62a3,_0x5911b3){return db[_0xa90d('0x27')][_0xa90d('0x43')](_0x1f62a3['body'],{})[_0xa90d('0x21')](respondWithResult(_0x5911b3,0xc9))[_0xa90d('0x3f')](handleError(_0x5911b3,null));};exports[_0xa90d('0x1f')]=function(_0x2019b5,_0x1ca74e){if(_0x2019b5[_0xa90d('0x44')]['id']){delete _0x2019b5[_0xa90d('0x44')]['id'];}return db['MemberReport']['find']({'where':{'id':_0x2019b5[_0xa90d('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ca74e,null))['then'](saveUpdates(_0x2019b5[_0xa90d('0x44')],null))[_0xa90d('0x21')](respondWithResult(_0x1ca74e,null))['catch'](handleError(_0x1ca74e,null));};exports[_0xa90d('0x20')]=function(_0x4b5ba6,_0x41275e){return db[_0xa90d('0x27')]['find']({'where':{'id':_0x4b5ba6[_0xa90d('0x41')]['id']}})[_0xa90d('0x21')](handleEntityNotFound(_0x41275e,null))[_0xa90d('0x21')](removeEntity(_0x41275e,null))[_0xa90d('0x3f')](handleError(_0x41275e,null));};exports[_0xa90d('0x45')]=function(_0x16eb72,_0x3740b9){return db[_0xa90d('0x27')]['describe']()['then'](respondWithResult(_0x3740b9,null))[_0xa90d('0x3f')](handleError(_0x3740b9,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1315417..a9c8b93 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 _0x723e=['rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dbaf9,_0x1cf4d8){var _0x348d92=function(_0x47fdc7){while(--_0x47fdc7){_0x3dbaf9['push'](_0x3dbaf9['shift']());}};_0x348d92(++_0x1cf4d8);}(_0x723e,0x179));var _0xe723=function(_0x402983,_0x5b1129){_0x402983=_0x402983-0x0;var _0x2dfa7e=_0x723e[_0x402983];return _0x2dfa7e;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'paranoid':![],'indexes':[{'name':_0xe723('0xd'),'fields':[_0xe723('0xe'),_0xe723('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c4e=['membername','interface','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./memberReport.attributes','define','MemberReport','report_member','membername_interface'];(function(_0x12a399,_0x188b78){var _0x38b86a=function(_0x38adf6){while(--_0x38adf6){_0x12a399['push'](_0x12a399['shift']());}};_0x38b86a(++_0x188b78);}(_0x4c4e,0x152));var _0xe4c4=function(_0x598e71,_0x868d55){_0x598e71=_0x598e71-0x0;var _0x520026=_0x4c4e[_0x598e71];return _0x520026;};'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':[{'name':_0xe4c4('0xb'),'fields':[_0xe4c4('0xc'),_0xe4c4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 66c8a84..c28b752 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 _0xe47f=['model','CreateMemberReport','create','raw','UpdateMemberReport','update','body','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','options','where','attributes','map','include'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xe47f,0xc6));var _0xfe47=function(_0xe446b9,_0x4b27df){_0xe446b9=_0xe446b9-0x0;var _0xb77c67=_0xe47f[_0xe446b9];return _0xb77c67;};'use strict';var _=require('lodash');var util=require(_0xfe47('0x0'));var moment=require(_0xfe47('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe47('0x2'));var fs=require('fs');var Redis=require(_0xfe47('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe47('0x4'));var logger=require(_0xfe47('0x5'))(_0xfe47('0x6'));var config=require(_0xfe47('0x7'));var jayson=require(_0xfe47('0x8'));var client=jayson[_0xfe47('0x9')][_0xfe47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241c04,_0x5a7e5b,_0x7aed54){return new BPromise(function(_0x2de527,_0x5cd31a){return client[_0xfe47('0xb')](_0x241c04,_0x7aed54)[_0xfe47('0xc')](function(_0x2a38df){logger['info'](_0xfe47('0xd'),_0x5a7e5b,_0xfe47('0xe'));logger[_0xfe47('0xf')](_0xfe47('0x10'),_0x5a7e5b,_0xfe47('0xe'),JSON[_0xfe47('0x11')](_0x2a38df));if(_0x2a38df[_0xfe47('0x12')]){if(_0x2a38df[_0xfe47('0x12')][_0xfe47('0x13')]===0x1f4){logger[_0xfe47('0x12')](_0xfe47('0xd'),_0x5a7e5b,_0x2a38df['error'][_0xfe47('0x14')]);return _0x5cd31a(_0x2a38df[_0xfe47('0x12')][_0xfe47('0x14')]);}logger[_0xfe47('0x12')](_0xfe47('0xd'),_0x5a7e5b,_0x2a38df[_0xfe47('0x12')][_0xfe47('0x14')]);return _0x2de527(_0x2a38df[_0xfe47('0x12')][_0xfe47('0x14')]);}else{logger[_0xfe47('0x15')](_0xfe47('0xd'),_0x5a7e5b,'request\x20sent');_0x2de527(_0x2a38df['result'][_0xfe47('0x14')]);}})[_0xfe47('0x16')](function(_0x4e09b8){logger[_0xfe47('0x12')](_0xfe47('0xd'),_0x5a7e5b,_0x4e09b8);_0x5cd31a(_0x4e09b8);});});}exports[_0xfe47('0x17')]=function(_0x4ac8a6){var _0x4e2230=this;return new Promise(function(_0x464927,_0x33a980){return db[_0xfe47('0x18')]['findAll']({'raw':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')][_0xfe47('0x1a')]||null:null,'attributes':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')][_0xfe47('0x1b')]||null:null,'limit':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')]['limit']||null:null,'include':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')]['include']?_[_0xfe47('0x1c')](_0x4ac8a6[_0xfe47('0x19')][_0xfe47('0x1d')],function(_0x117b76){return{'model':db[_0x117b76[_0xfe47('0x1e')]],'as':_0x117b76['as'],'attributes':_0x117b76['attributes'],'include':_0x117b76[_0xfe47('0x1d')]?_[_0xfe47('0x1c')](_0x117b76[_0xfe47('0x1d')],function(_0x404a51){return{'model':db[_0x404a51[_0xfe47('0x1e')]],'as':_0x404a51['as'],'attributes':_0x404a51[_0xfe47('0x1b')],'include':_0x404a51[_0xfe47('0x1d')]?_['map'](_0x404a51[_0xfe47('0x1d')],function(_0x328863){return{'model':db[_0x328863[_0xfe47('0x1e')]],'as':_0x328863['as'],'attributes':_0x328863['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe47('0xc')](function(_0x575749){logger[_0xfe47('0x15')](_0xfe47('0x17'),_0x4ac8a6);logger[_0xfe47('0xf')](_0xfe47('0x17'),_0x4ac8a6,JSON[_0xfe47('0x11')](_0x575749));_0x464927(_0x575749);})[_0xfe47('0x16')](function(_0x177816){logger[_0xfe47('0x12')]('GetMemberReport',_0x177816[_0xfe47('0x14')],_0x4ac8a6);_0x33a980(_0x4e2230[_0xfe47('0x12')](0x1f4,_0x177816[_0xfe47('0x14')]));});});};exports[_0xfe47('0x1f')]=function(_0x28fb96){var _0x506fae=this;return new Promise(function(_0x3a5502,_0x4bff90){return db[_0xfe47('0x18')][_0xfe47('0x20')](_0x28fb96['body'],{'raw':_0x28fb96[_0xfe47('0x19')]?_0x28fb96[_0xfe47('0x19')][_0xfe47('0x21')]===undefined?!![]:![]:!![]})[_0xfe47('0xc')](function(_0x4fb02c){logger[_0xfe47('0x15')](_0xfe47('0x1f'),_0x28fb96);logger[_0xfe47('0xf')](_0xfe47('0x1f'),_0x28fb96,JSON[_0xfe47('0x11')](_0x4fb02c));_0x3a5502(_0x4fb02c);})[_0xfe47('0x16')](function(_0x421923){logger['error'](_0xfe47('0x1f'),_0x421923[_0xfe47('0x14')],_0x28fb96);_0x4bff90(_0x506fae[_0xfe47('0x12')](0x1f4,_0x421923[_0xfe47('0x14')]));});});};exports[_0xfe47('0x22')]=function(_0x1c1f4c){var _0x3b8527=this;return new Promise(function(_0x450041,_0x513797){return db[_0xfe47('0x18')][_0xfe47('0x23')](_0x1c1f4c[_0xfe47('0x24')],{'raw':_0x1c1f4c['options']?_0x1c1f4c[_0xfe47('0x19')][_0xfe47('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1f4c[_0xfe47('0x19')]?_0x1c1f4c['options'][_0xfe47('0x1a')]||null:null,'attributes':_0x1c1f4c[_0xfe47('0x19')]?_0x1c1f4c[_0xfe47('0x19')][_0xfe47('0x1b')]||null:null,'limit':_0x1c1f4c[_0xfe47('0x19')]?_0x1c1f4c['options'][_0xfe47('0x25')]||null:null})[_0xfe47('0xc')](function(_0x6049db){logger[_0xfe47('0x15')](_0xfe47('0x22'),_0x1c1f4c);logger[_0xfe47('0xf')]('UpdateMemberReport',_0x1c1f4c,JSON[_0xfe47('0x11')](_0x6049db));_0x450041(_0x6049db);})['catch'](function(_0x173991){logger[_0xfe47('0x12')](_0xfe47('0x22'),_0x173991[_0xfe47('0x14')],_0x1c1f4c);_0x513797(_0x3b8527[_0xfe47('0x12')](0x1f4,_0x173991[_0xfe47('0x14')]));});});}; \ No newline at end of file +var _0x2a56=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','then','UpdateMemberReport','body','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x2a56,0x8f));var _0x62a5=function(_0x16056e,_0xcfde4){_0x16056e=_0x16056e-0x0;var _0x4f3b89=_0x2a56[_0x16056e];return _0x4f3b89;};'use strict';var _=require(_0x62a5('0x0'));var util=require('util');var moment=require(_0x62a5('0x1'));var BPromise=require(_0x62a5('0x2'));var rs=require(_0x62a5('0x3'));var fs=require('fs');var Redis=require(_0x62a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x62a5('0x5'));var logger=require(_0x62a5('0x6'))(_0x62a5('0x7'));var config=require(_0x62a5('0x8'));var jayson=require(_0x62a5('0x9'));var client=jayson['client'][_0x62a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a55a7,_0x55f7a6,_0x48a5e4){return new BPromise(function(_0x17ec75,_0x447951){return client[_0x62a5('0xb')](_0x1a55a7,_0x48a5e4)['then'](function(_0x483979){logger[_0x62a5('0xc')](_0x62a5('0xd'),_0x55f7a6,'request\x20sent');logger[_0x62a5('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x55f7a6,_0x62a5('0xf'),JSON[_0x62a5('0x10')](_0x483979));if(_0x483979[_0x62a5('0x11')]){if(_0x483979[_0x62a5('0x11')][_0x62a5('0x12')]===0x1f4){logger[_0x62a5('0x11')](_0x62a5('0xd'),_0x55f7a6,_0x483979[_0x62a5('0x11')]['message']);return _0x447951(_0x483979[_0x62a5('0x11')][_0x62a5('0x13')]);}logger[_0x62a5('0x11')](_0x62a5('0xd'),_0x55f7a6,_0x483979[_0x62a5('0x11')][_0x62a5('0x13')]);return _0x17ec75(_0x483979['error']['message']);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x55f7a6,_0x62a5('0xf'));_0x17ec75(_0x483979[_0x62a5('0x14')]['message']);}})[_0x62a5('0x15')](function(_0x467119){logger['error'](_0x62a5('0xd'),_0x55f7a6,_0x467119);_0x447951(_0x467119);});});}exports[_0x62a5('0x16')]=function(_0x3851e7){var _0x559680=this;return new Promise(function(_0x273fb2,_0x24ac50){return db[_0x62a5('0x17')]['findAll']({'raw':_0x3851e7[_0x62a5('0x18')]?_0x3851e7[_0x62a5('0x18')][_0x62a5('0x19')]===undefined?!![]:![]:!![],'where':_0x3851e7[_0x62a5('0x18')]?_0x3851e7[_0x62a5('0x18')][_0x62a5('0x1a')]||null:null,'attributes':_0x3851e7['options']?_0x3851e7['options'][_0x62a5('0x1b')]||null:null,'limit':_0x3851e7['options']?_0x3851e7[_0x62a5('0x18')][_0x62a5('0x1c')]||null:null,'include':_0x3851e7[_0x62a5('0x18')]?_0x3851e7[_0x62a5('0x18')][_0x62a5('0x1d')]?_[_0x62a5('0x1e')](_0x3851e7['options'][_0x62a5('0x1d')],function(_0xe29812){return{'model':db[_0xe29812[_0x62a5('0x1f')]],'as':_0xe29812['as'],'attributes':_0xe29812[_0x62a5('0x1b')],'include':_0xe29812[_0x62a5('0x1d')]?_[_0x62a5('0x1e')](_0xe29812['include'],function(_0x114a66){return{'model':db[_0x114a66[_0x62a5('0x1f')]],'as':_0x114a66['as'],'attributes':_0x114a66[_0x62a5('0x1b')],'include':_0x114a66[_0x62a5('0x1d')]?_['map'](_0x114a66['include'],function(_0x19f9d7){return{'model':db[_0x19f9d7['model']],'as':_0x19f9d7['as'],'attributes':_0x19f9d7[_0x62a5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10238a){logger['info'](_0x62a5('0x16'),_0x3851e7);logger[_0x62a5('0xe')](_0x62a5('0x16'),_0x3851e7,JSON[_0x62a5('0x10')](_0x10238a));_0x273fb2(_0x10238a);})[_0x62a5('0x15')](function(_0x5a660f){logger['error']('GetMemberReport',_0x5a660f[_0x62a5('0x13')],_0x3851e7);_0x24ac50(_0x559680[_0x62a5('0x11')](0x1f4,_0x5a660f[_0x62a5('0x13')]));});});};exports[_0x62a5('0x20')]=function(_0x11e9fa){var _0x420157=this;return new Promise(function(_0x4cf741,_0x20ef46){return db['MemberReport'][_0x62a5('0x21')](_0x11e9fa['body'],{'raw':_0x11e9fa['options']?_0x11e9fa['options'][_0x62a5('0x19')]===undefined?!![]:![]:!![]})[_0x62a5('0x22')](function(_0x2925ec){logger['info']('CreateMemberReport',_0x11e9fa);logger[_0x62a5('0xe')](_0x62a5('0x20'),_0x11e9fa,JSON[_0x62a5('0x10')](_0x2925ec));_0x4cf741(_0x2925ec);})[_0x62a5('0x15')](function(_0x17fc53){logger['error'](_0x62a5('0x20'),_0x17fc53[_0x62a5('0x13')],_0x11e9fa);_0x20ef46(_0x420157['error'](0x1f4,_0x17fc53[_0x62a5('0x13')]));});});};exports[_0x62a5('0x23')]=function(_0x56b455){var _0x52b395=this;return new Promise(function(_0x1e263a,_0x15a723){return db[_0x62a5('0x17')]['update'](_0x56b455[_0x62a5('0x24')],{'raw':_0x56b455[_0x62a5('0x18')]?_0x56b455['options'][_0x62a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56b455[_0x62a5('0x18')]?_0x56b455['options']['where']||null:null,'attributes':_0x56b455['options']?_0x56b455[_0x62a5('0x18')]['attributes']||null:null,'limit':_0x56b455[_0x62a5('0x18')]?_0x56b455[_0x62a5('0x18')]['limit']||null:null})[_0x62a5('0x22')](function(_0x364144){logger[_0x62a5('0xc')](_0x62a5('0x23'),_0x56b455);logger['debug'](_0x62a5('0x23'),_0x56b455,JSON[_0x62a5('0x10')](_0x364144));_0x1e263a(_0x364144);})[_0x62a5('0x15')](function(_0x130947){logger['error'](_0x62a5('0x23'),_0x130947[_0x62a5('0x13')],_0x56b455);_0x15a723(_0x52b395[_0x62a5('0x11')](0x1f4,_0x130947['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index fe37eb5..09a1cea 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 _0xed3c=['index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x587e76,_0x16aaec){var _0x54e213=function(_0x52d8fd){while(--_0x52d8fd){_0x587e76['push'](_0x587e76['shift']());}};_0x54e213(++_0x16aaec);}(_0xed3c,0x1a6));var _0xced3=function(_0x237418,_0x56e144){_0x237418=_0x237418-0x0;var _0x22393e=_0xed3c[_0x237418];return _0x22393e;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var auth=require(_0xced3('0x5'));var interaction=require(_0xced3('0x6'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xced3('0x7')]('/',controller[_0xced3('0x8')]);module[_0xced3('0x9')]=router; \ No newline at end of file +var _0x13f6=['../../config/environment','./migration.controller','get','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x13f6,0x124));var _0x613f=function(_0x57c39d,_0x4857ff){_0x57c39d=_0x57c39d-0x0;var _0x59bd1d=_0x13f6[_0x57c39d];return _0x59bd1d;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',controller['index']);module[_0x613f('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2485e0d..7cc1008 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 _0x97d9=['sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x97d9,0xda));var _0x997d=function(_0x1fe56d,_0x436977){_0x1fe56d=_0x1fe56d-0x0;var _0x49ba47=_0x97d9[_0x1fe56d];return _0x49ba47;};'use strict';var Sequelize=require(_0x997d('0x0'));module[_0x997d('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x4c7f=['exports','version','sequelize'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x4c7f,0x7d));var _0xf4c7=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x4c7f[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0xf4c7('0x0'));module[_0xf4c7('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xf4c7('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index be3e402..8fcb8e1 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 _0xf4eb=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes'];(function(_0x3a1b6e,_0x24a409){var _0x3ea1b6=function(_0x308d52){while(--_0x308d52){_0x3a1b6e['push'](_0x3a1b6e['shift']());}};_0x3ea1b6(++_0x24a409);}(_0xf4eb,0xec));var _0xbf4e=function(_0x52c424,_0x1bbfd3){_0x52c424=_0x52c424-0x0;var _0x31d568=_0xf4eb[_0x52c424];return _0x31d568;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_0x41f918,_0xbf4e('0x20'));_0x315df3['query']=_[_0xbf4e('0x26')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],_0x315df3[_0xbf4e('0x27')]);_0x38c923['attributes']=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],qs['fields'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2a')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3['model'];if(!_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2c')](_0xbf4e('0x2d'))){_0x38c923['limit']=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0x2bfccf[_0xbf4e('0x27')]['offset']);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2f')]);_0x38c923[_0xbf4e('0x30')]=qs['filters'](_['pick'](_0x2bfccf['query'],_0x315df3['filters']),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]){_0x38c923[_0xbf4e('0x30')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x30')],{'$or':_[_0xbf4e('0x25')](_0x41f918,function(_0x355b42){if(_0x355b42[_0xbf4e('0x23')]!==_0xbf4e('0x33')){var _0x54527d={};_0x54527d[_0x355b42['name']]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]+'%'};return _0x54527d;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x3f46f1={'where':_0x38c923['where']};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x3f46f1)[_0xbf4e('0x1b')](function(_0xb30f90){_0x4021a9['count']=_0xb30f90;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x34')]){_0x38c923[_0xbf4e('0x35')]=[{'all':!![]}];}return db[_0xbf4e('0x21')]['findAll'](_0x38c923);})[_0xbf4e('0x1b')](function(_0x44e96b){_0x4021a9[_0xbf4e('0x36')]=_0x44e96b;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x37')](handleError(_0x5a0a9b,null));}; \ No newline at end of file +var _0xa9e0=['save','update','then','destroy','end','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject'];(function(_0x10130a,_0x3378f5){var _0x11b3f7=function(_0x5aca56){while(--_0x5aca56){_0x10130a['push'](_0x10130a['shift']());}};_0x11b3f7(++_0x3378f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e81733d..0ce911a 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 _0xb7c8=['request-promise','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','bluebird'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb7c8,0x119));var _0x8b7c=function(_0x363dab,_0x463714){_0x363dab=_0x363dab-0x0;var _0x1f5173=_0xb7c8[_0x363dab];return _0x1f5173;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50e=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','moment','bluebird'];(function(_0x4e301d,_0x437496){var _0x3ac213=function(_0x1f531f){while(--_0x1f531f){_0x4e301d['push'](_0x4e301d['shift']());}};_0x3ac213(++_0x437496);}(_0xe50e,0xf9));var _0xee50=function(_0x29e758,_0x345372){_0x29e758=_0x29e758-0x0;var _0x4e348f=_0xe50e[_0x29e758];return _0x4e348f;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xee50('0x1'));var BPromise=require(_0xee50('0x2'));var rp=require(_0xee50('0x3'));var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require(_0xee50('0x6'));var attributes=require(_0xee50('0x7'));module[_0xee50('0x8')]=function(_0x3fe965,_0x3b0585){return _0x3fe965[_0xee50('0x9')](_0xee50('0xa'),attributes,{'tableName':_0xee50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 73031e1..f29bed9 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 _0x8384=['../../config/environment','jayson/promise','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x361aae,_0x2c854b){var _0x1b9a1c=function(_0x145ed7){while(--_0x145ed7){_0x361aae['push'](_0x361aae['shift']());}};_0x1b9a1c(++_0x2c854b);}(_0x8384,0xca));var _0x4838=function(_0x26260c,_0x3a9df0){_0x26260c=_0x26260c-0x0;var _0x21f487=_0x8384[_0x26260c];return _0x21f487;};'use strict';var _=require(_0x4838('0x0'));var util=require(_0x4838('0x1'));var moment=require(_0x4838('0x2'));var BPromise=require('bluebird');var rs=require(_0x4838('0x3'));var fs=require('fs');var Redis=require(_0x4838('0x4'));var db=require(_0x4838('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4838('0x6'))(_0x4838('0x7'));var config=require(_0x4838('0x8'));var jayson=require(_0x4838('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x247fc7,_0x2a435f,_0x3aeec7){return new BPromise(function(_0x18ef75,_0xa2d7ee){return client[_0x4838('0xa')](_0x247fc7,_0x3aeec7)['then'](function(_0x315cbd){logger[_0x4838('0xb')](_0x4838('0xc'),_0x2a435f,_0x4838('0xd'));logger[_0x4838('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x2a435f,_0x4838('0xd'),JSON[_0x4838('0xf')](_0x315cbd));if(_0x315cbd[_0x4838('0x10')]){if(_0x315cbd[_0x4838('0x10')][_0x4838('0x11')]===0x1f4){logger[_0x4838('0x10')](_0x4838('0xc'),_0x2a435f,_0x315cbd[_0x4838('0x10')][_0x4838('0x12')]);return _0xa2d7ee(_0x315cbd[_0x4838('0x10')]['message']);}logger['error'](_0x4838('0xc'),_0x2a435f,_0x315cbd[_0x4838('0x10')][_0x4838('0x12')]);return _0x18ef75(_0x315cbd[_0x4838('0x10')]['message']);}else{logger[_0x4838('0xb')]('Migration,\x20%s,\x20%s',_0x2a435f,_0x4838('0xd'));_0x18ef75(_0x315cbd[_0x4838('0x13')][_0x4838('0x12')]);}})[_0x4838('0x14')](function(_0x1c54a9){logger[_0x4838('0x10')](_0x4838('0xc'),_0x2a435f,_0x1c54a9);_0xa2d7ee(_0x1c54a9);});});} \ No newline at end of file +var _0x4689=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5ef9f3,_0x3d3869){var _0x47f73=function(_0x27c31f){while(--_0x27c31f){_0x5ef9f3['push'](_0x5ef9f3['shift']());}};_0x47f73(++_0x3d3869);}(_0x4689,0xf2));var _0x9468=function(_0xc9c314,_0x3ea106){_0xc9c314=_0xc9c314-0x0;var _0x544064=_0x4689[_0xc9c314];return _0x544064;};'use strict';var _=require('lodash');var util=require(_0x9468('0x0'));var moment=require(_0x9468('0x1'));var BPromise=require(_0x9468('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9468('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9468('0x4'));var logger=require(_0x9468('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9468('0x6'));var client=jayson[_0x9468('0x7')][_0x9468('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580cd5,_0x15d9da,_0x3af302){return new BPromise(function(_0x3be103,_0x16ff0b){return client[_0x9468('0x9')](_0x580cd5,_0x3af302)[_0x9468('0xa')](function(_0x2bf1e8){logger[_0x9468('0xb')](_0x9468('0xc'),_0x15d9da,_0x9468('0xd'));logger[_0x9468('0xe')](_0x9468('0xf'),_0x15d9da,_0x9468('0xd'),JSON[_0x9468('0x10')](_0x2bf1e8));if(_0x2bf1e8[_0x9468('0x11')]){if(_0x2bf1e8[_0x9468('0x11')][_0x9468('0x12')]===0x1f4){logger[_0x9468('0x11')]('Migration,\x20%s,\x20%s',_0x15d9da,_0x2bf1e8[_0x9468('0x11')][_0x9468('0x13')]);return _0x16ff0b(_0x2bf1e8['error'][_0x9468('0x13')]);}logger[_0x9468('0x11')]('Migration,\x20%s,\x20%s',_0x15d9da,_0x2bf1e8['error'][_0x9468('0x13')]);return _0x3be103(_0x2bf1e8['error']['message']);}else{logger['info'](_0x9468('0xc'),_0x15d9da,'request\x20sent');_0x3be103(_0x2bf1e8[_0x9468('0x14')][_0x9468('0x13')]);}})[_0x9468('0x15')](function(_0x1def60){logger[_0x9468('0x11')](_0x9468('0xc'),_0x15d9da,_0x1def60);_0x16ff0b(_0x1def60);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 1df6256..65bd422 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 _0x2cce=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./network.controller','get','/:id','isAuthenticated','show','post'];(function(_0x5705a5,_0x5496c5){var _0x1296ab=function(_0x396cc6){while(--_0x396cc6){_0x5705a5['push'](_0x5705a5['shift']());}};_0x1296ab(++_0x5496c5);}(_0x2cce,0x8e));var _0xe2cc=function(_0x41983d,_0x493b6e){_0x41983d=_0x41983d-0x0;var _0x1bff13=_0x2cce[_0x41983d];return _0x1bff13;};'use strict';var multer=require(_0xe2cc('0x0'));var util=require(_0xe2cc('0x1'));var path=require(_0xe2cc('0x2'));var timeout=require(_0xe2cc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe2cc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe2cc('0x5'));router[_0xe2cc('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe2cc('0x7'),auth[_0xe2cc('0x8')](),controller[_0xe2cc('0x9')]);router[_0xe2cc('0xa')]('/',auth['isAuthenticated'](),controller[_0xe2cc('0xb')]);router[_0xe2cc('0xc')](_0xe2cc('0x7'),auth[_0xe2cc('0x8')](),controller[_0xe2cc('0xd')]);router[_0xe2cc('0xe')](_0xe2cc('0x7'),auth['isAuthenticated'](),controller[_0xe2cc('0xf')]);module[_0xe2cc('0x10')]=router; \ No newline at end of file +var _0x7fef=['/:id','show','create','update','delete','destroy','multer','path','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x32b2cf,_0x3bb3d3){var _0xdb8e9e=function(_0x4acd06){while(--_0x4acd06){_0x32b2cf['push'](_0x32b2cf['shift']());}};_0xdb8e9e(++_0x3bb3d3);}(_0x7fef,0x110));var _0xf7fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7fef[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf7fe('0x0'));var util=require('util');var path=require(_0xf7fe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf7fe('0x2'));var interaction=require(_0xf7fe('0x3'));var config=require('../../config/environment');var controller=require(_0xf7fe('0x4'));router[_0xf7fe('0x5')]('/',auth[_0xf7fe('0x6')](),controller[_0xf7fe('0x7')]);router['get'](_0xf7fe('0x8'),auth[_0xf7fe('0x6')](),controller[_0xf7fe('0x9')]);router['post']('/',auth[_0xf7fe('0x6')](),controller[_0xf7fe('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf7fe('0xb')]);router[_0xf7fe('0xc')](_0xf7fe('0x8'),auth[_0xf7fe('0x6')](),controller[_0xf7fe('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b4e5394..36af72b 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(_0x1b4bba,_0x384921){var _0xf00e4b=function(_0x53d9bb){while(--_0x53d9bb){_0x1b4bba['push'](_0x1b4bba['shift']());}};_0xf00e4b(++_0x384921);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x4cc9ee,_0x5d7124){var _0x4f0989=function(_0x1dcfe3){while(--_0x1dcfe3){_0x4cc9ee['push'](_0x4cc9ee['shift']());}};_0x4f0989(++_0x5d7124);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 d76fefe..993b382 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 _0xb4fc=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','create','sequelize','transaction','findAll','body','type','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','server/files/templates/turn_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xe2a7ff,_0x489af9){var _0x5e2671=function(_0x36f89f){while(--_0x36f89f){_0xe2a7ff['push'](_0xe2a7ff['shift']());}};_0x5e2671(++_0x489af9);}(_0xb4fc,0xdd));var _0xcb4f=function(_0x1a87e8,_0x3c5fc8){_0x1a87e8=_0x1a87e8-0x0;var _0x27828f=_0xb4fc[_0x1a87e8];return _0x27828f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb4f('0x0'));var rimraf=require(_0xcb4f('0x1'));var zipdir=require(_0xcb4f('0x2'));var jsonpatch=require(_0xcb4f('0x3'));var rp=require(_0xcb4f('0x4'));var moment=require(_0xcb4f('0x5'));var BPromise=require(_0xcb4f('0x6'));var Mustache=require(_0xcb4f('0x7'));var util=require(_0xcb4f('0x8'));var path=require(_0xcb4f('0x9'));var sox=require(_0xcb4f('0xa'));var csv=require(_0xcb4f('0xb'));var ejs=require(_0xcb4f('0xc'));var fs=require('fs');var _=require(_0xcb4f('0xd'));var squel=require('squel');var crypto=require(_0xcb4f('0xe'));var jsforce=require(_0xcb4f('0xf'));var deskjs=require(_0xcb4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcb4f('0x11'));var Papa=require(_0xcb4f('0x12'));var Redis=require(_0xcb4f('0x13'));var authService=require(_0xcb4f('0x14'));var qs=require(_0xcb4f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb4f('0x16'));var logger=require('../../config/logger')(_0xcb4f('0x17'));var utils=require(_0xcb4f('0x18'));var config=require(_0xcb4f('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcb4f('0x1a'));var client=jayson[_0xcb4f('0x1b')][_0xcb4f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x406538,_0x53bcce,_0x10b56d){if(_0x10b56d){var _0x589fbd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x589fbd[_0xcb4f('0x1d')](_0x53bcce)){return _0x406538;}else{throw new db[(_0xcb4f('0x1e'))][(_0xcb4f('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 _0x406538;}}function respondWithRpcPromise(_0xe37ac7,_0x12477,_0x2eed72,_0x6416a6){return new BPromise(function(_0x5db859,_0x2299a0){var _0x49b15c=_0x6416a6||client;return _0x49b15c['request'](_0xe37ac7,_0x2eed72)[_0xcb4f('0x20')](function(_0x2d7a35){logger[_0xcb4f('0x21')](_0xcb4f('0x22'),_0x12477,'request\x20sent');logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x12477,_0xcb4f('0x25'),JSON[_0xcb4f('0x26')](_0x2d7a35));if(_0x2d7a35['error']){if(_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x28')]===0x1f4){logger[_0xcb4f('0x27')]('Network,\x20%s,\x20%s',_0x12477,_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);return _0x2299a0(_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);}logger[_0xcb4f('0x27')](_0xcb4f('0x22'),_0x12477,_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);return _0x5db859(_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);}else{logger[_0xcb4f('0x21')](_0xcb4f('0x22'),_0x12477,'request\x20sent');_0x5db859(_0x2d7a35['result'][_0xcb4f('0x29')]);}})[_0xcb4f('0x2a')](function(_0x4eb33c){logger[_0xcb4f('0x27')]('Network,\x20%s,\x20%s',_0x12477,_0x4eb33c);_0x2299a0(_0x4eb33c);});});}function respondWithStatusCode(_0x4ca17b,_0x4853da){_0x4853da=_0x4853da||0xcc;return function(_0x241dc4){if(_0x241dc4){return _0x4ca17b['sendStatus'](_0x4853da);}return _0x4ca17b[_0xcb4f('0x2b')](_0x4853da)[_0xcb4f('0x2c')]();};}function respondWithResult(_0xfd0b4,_0x4624f8){_0x4624f8=_0x4624f8||0xc8;return function(_0x884813){if(_0x884813){return _0xfd0b4['status'](_0x4624f8)[_0xcb4f('0x2d')](_0x884813);}};}function respondWithFilteredResult(_0x26e5fd,_0x128895){return function(_0x4c74f1){if(_0x4c74f1){var _0x5a3234=_0x4c74f1[_0xcb4f('0x2e')],_0x5d5506=_0x128895[_0xcb4f('0x2f')],_0x57e0bc=_0x128895[_0xcb4f('0x2f')]+_0x128895['limit'],_0x34e712;if(_0x57e0bc>=_0x5a3234){_0x57e0bc=_0x5a3234;_0x34e712=0xc8;}else{_0x34e712=0xce;}_0x26e5fd[_0xcb4f('0x2b')](_0x34e712);return _0x26e5fd[_0xcb4f('0x30')](_0xcb4f('0x31'),_0x5d5506+'-'+_0x57e0bc+'/'+_0x5a3234)[_0xcb4f('0x2d')](_0x4c74f1);}return null;};}function patchUpdates(_0x202975){return function(_0x579bf8){try{jsonpatch[_0xcb4f('0x32')](_0x579bf8,_0x202975,!![]);}catch(_0x1959c1){return BPromise[_0xcb4f('0x33')](_0x1959c1);}return _0x579bf8[_0xcb4f('0x34')]();};}function saveUpdates(_0x3dbe3d,_0x145298){return function(_0x24b962){if(_0x24b962){return _0x24b962[_0xcb4f('0x35')](_0x3dbe3d)[_0xcb4f('0x20')](function(_0x102efc){return _0x102efc;});}return null;};}function removeEntity(_0x1310a7,_0xa5b931){return function(_0x2788de){if(_0x2788de){return _0x2788de[_0xcb4f('0x36')]()[_0xcb4f('0x20')](function(){_0x1310a7[_0xcb4f('0x2b')](0xcc)[_0xcb4f('0x2c')]();});}};}function handleEntityNotFound(_0x5f017f,_0x572031){return function(_0x56be10){if(!_0x56be10){_0x5f017f[_0xcb4f('0x37')](0x194);}return _0x56be10;};}function handleError(_0x354c8d,_0x1b3ed6){_0x1b3ed6=_0x1b3ed6||0x1f4;return function(_0x3e1cd7){logger[_0xcb4f('0x27')](_0x3e1cd7[_0xcb4f('0x38')]);if(_0x3e1cd7[_0xcb4f('0x39')]){delete _0x3e1cd7[_0xcb4f('0x39')];}_0x354c8d[_0xcb4f('0x2b')](_0x1b3ed6)[_0xcb4f('0x3a')](_0x3e1cd7);};}exports[_0xcb4f('0x3b')]=function(_0x147ba3,_0x1140e9){var _0x379408={},_0x52806f={},_0x26d700={'count':0x0,'rows':[]};var _0x585e5e=_[_0xcb4f('0x3c')](db[_0xcb4f('0x3d')][_0xcb4f('0x3e')],function(_0xb30ed){return{'name':_0xb30ed[_0xcb4f('0x3f')],'type':_0xb30ed['type'][_0xcb4f('0x40')]};});_0x52806f[_0xcb4f('0x41')]=_[_0xcb4f('0x3c')](_0x585e5e,_0xcb4f('0x39'));_0x52806f[_0xcb4f('0x42')]=_[_0xcb4f('0x43')](_0x147ba3[_0xcb4f('0x42')]);_0x52806f[_0xcb4f('0x44')]=_[_0xcb4f('0x45')](_0x52806f[_0xcb4f('0x41')],_0x52806f[_0xcb4f('0x42')]);_0x379408['attributes']=_[_0xcb4f('0x45')](_0x52806f[_0xcb4f('0x41')],qs[_0xcb4f('0x46')](_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x46')]));_0x379408[_0xcb4f('0x47')]=_0x379408[_0xcb4f('0x47')][_0xcb4f('0x48')]?_0x379408[_0xcb4f('0x47')]:_0x52806f['model'];if(!_0x147ba3['query'][_0xcb4f('0x49')](_0xcb4f('0x4a'))){_0x379408['limit']=qs[_0xcb4f('0x4b')](_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x4b')]);_0x379408[_0xcb4f('0x2f')]=qs['offset'](_0x147ba3[_0xcb4f('0x42')]['offset']);}_0x379408[_0xcb4f('0x4c')]=qs[_0xcb4f('0x4d')](_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x4d')]);_0x379408[_0xcb4f('0x4e')]=qs['filters'](_['pick'](_0x147ba3['query'],_0x52806f[_0xcb4f('0x44')]),_0x585e5e);if(_0x147ba3[_0xcb4f('0x42')]['filter']){_0x379408['where']=_[_0xcb4f('0x4f')](_0x379408[_0xcb4f('0x4e')],{'$or':_[_0xcb4f('0x3c')](_0x585e5e,function(_0x525621){if(_0x525621['type']!==_0xcb4f('0x50')){var _0x36432e={};_0x36432e[_0x525621[_0xcb4f('0x39')]]={'$like':'%'+_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x51')]+'%'};return _0x36432e;}})});}_0x379408=_[_0xcb4f('0x4f')]({},_0x379408,_0x147ba3[_0xcb4f('0x52')]);var _0x36f334={'where':_0x379408['where']};return db['Network'][_0xcb4f('0x2e')](_0x36f334)[_0xcb4f('0x20')](function(_0x2b08ba){_0x26d700[_0xcb4f('0x2e')]=_0x2b08ba;if(_0x147ba3['query'][_0xcb4f('0x53')]){_0x379408[_0xcb4f('0x54')]=[{'all':!![]}];}return db[_0xcb4f('0x3d')]['findAll'](_0x379408);})[_0xcb4f('0x20')](function(_0x29ba22){_0x26d700[_0xcb4f('0x55')]=_0x29ba22;return _0x26d700;})[_0xcb4f('0x20')](respondWithFilteredResult(_0x1140e9,_0x379408))[_0xcb4f('0x2a')](handleError(_0x1140e9,null));};exports[_0xcb4f('0x56')]=function(_0x1e0c20,_0x8476ea){var _0xf4b2e5={'raw':!![],'where':{'id':_0x1e0c20[_0xcb4f('0x57')]['id']}},_0x98052={};_0x98052[_0xcb4f('0x41')]=_['keys'](db[_0xcb4f('0x3d')][_0xcb4f('0x3e')]);_0x98052[_0xcb4f('0x42')]=_[_0xcb4f('0x43')](_0x1e0c20['query']);_0x98052[_0xcb4f('0x44')]=_[_0xcb4f('0x45')](_0x98052[_0xcb4f('0x41')],_0x98052[_0xcb4f('0x42')]);_0xf4b2e5['attributes']=_[_0xcb4f('0x45')](_0x98052[_0xcb4f('0x41')],qs[_0xcb4f('0x46')](_0x1e0c20[_0xcb4f('0x42')]['fields']));_0xf4b2e5[_0xcb4f('0x47')]=_0xf4b2e5[_0xcb4f('0x47')][_0xcb4f('0x48')]?_0xf4b2e5[_0xcb4f('0x47')]:_0x98052[_0xcb4f('0x41')];if(_0x1e0c20[_0xcb4f('0x42')][_0xcb4f('0x53')]){_0xf4b2e5[_0xcb4f('0x54')]=[{'all':!![]}];}_0xf4b2e5=_[_0xcb4f('0x4f')]({},_0xf4b2e5,_0x1e0c20[_0xcb4f('0x52')]);return db[_0xcb4f('0x3d')]['find'](_0xf4b2e5)[_0xcb4f('0x20')](handleEntityNotFound(_0x8476ea,null))[_0xcb4f('0x20')](respondWithResult(_0x8476ea,null))['catch'](handleError(_0x8476ea,null));};exports[_0xcb4f('0x58')]=function(_0x2d4839,_0x115778,_0x1f1c5c){var _0x52df16;return db[_0xcb4f('0x59')][_0xcb4f('0x5a')](function(_0x514752){return db[_0xcb4f('0x3d')]['create'](_0x2d4839['body'],{'raw':!![]})[_0xcb4f('0x20')](function(_0x5a4a52){_0x52df16=_0x5a4a52;return db[_0xcb4f('0x3d')][_0xcb4f('0x5b')]({'where':{'type':_0x2d4839[_0xcb4f('0x5c')][_0xcb4f('0x5d')]},'raw':!![]});})[_0xcb4f('0x20')](function(_0x1b8db9){if(_0x52df16['type'][_0xcb4f('0x5e')]()==_0xcb4f('0x5f')){var _0x3ece77=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config['root'],_0xcb4f('0x62')),_0xcb4f('0x63'));var _0x58c064=ejs[_0xcb4f('0x64')](_0x3ece77,{'networks':_0x1b8db9||[]});fs[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x58c064);return respondWithRpcPromise(_0xcb4f('0x67'),'create',{'module':_0xcb4f('0x68')});}else if(_0x52df16[_0xcb4f('0x5d')]['toUpperCase']()==_0xcb4f('0x69')){var _0x40ccb0=fs[_0xcb4f('0x60')](path['join'](config[_0xcb4f('0x6a')],'server/files/templates/turn_multiple.ejs'),_0xcb4f('0x63'));var _0x2cb070=ejs[_0xcb4f('0x64')](_0x40ccb0,{'networks':_0x1b8db9||[]});fs[_0xcb4f('0x65')](_0xcb4f('0x6b'),_0x2cb070);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x58'),{'module':_0xcb4f('0x68')});}else{var _0x32f04f=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],_0xcb4f('0x6c')),_0xcb4f('0x63'));var _0x3f565e=ejs['render'](_0x32f04f,{'networks':_0x1b8db9||[]});fs[_0xcb4f('0x65')](util[_0xcb4f('0x6d')](_0xcb4f('0x6e'),_0x2d4839[_0xcb4f('0x5c')][_0xcb4f('0x5d')][_0xcb4f('0x6f')]()),_0x3f565e);return respondWithRpcPromise('Reload',_0xcb4f('0x58'),{'module':_0xcb4f('0x70')});}return null;})[_0xcb4f('0x20')](function(){return _0x52df16;});})[_0xcb4f('0x20')](respondWithResult(_0x115778,0xc9))[_0xcb4f('0x2a')](handleError(_0x115778,null));};exports[_0xcb4f('0x35')]=function(_0x41ceed,_0x10dbfa,_0x727efc){var _0x2a934e;return db['sequelize'][_0xcb4f('0x5a')](function(_0x333def){return db[_0xcb4f('0x3d')][_0xcb4f('0x71')]({'where':{'id':_0x41ceed[_0xcb4f('0x57')]['id']}})[_0xcb4f('0x20')](handleEntityNotFound(_0x10dbfa,null))[_0xcb4f('0x20')](saveUpdates(_0x41ceed[_0xcb4f('0x5c')],null))[_0xcb4f('0x20')](function(_0x45f830){if(_0x45f830){_0x2a934e=_0x45f830;return db['Network'][_0xcb4f('0x5b')]({'where':{'type':_0x2a934e[_0xcb4f('0x5d')]},'raw':!![]});}return null;})[_0xcb4f('0x20')](function(_0xdce18d){if(_0x2a934e[_0xcb4f('0x5d')][_0xcb4f('0x5e')]()=='STUN'){var _0x56f20d=fs[_0xcb4f('0x60')](path['join'](config[_0xcb4f('0x6a')],_0xcb4f('0x62')),_0xcb4f('0x63'));var _0x390aff=ejs['render'](_0x56f20d,{'networks':_0xdce18d||[]});fs[_0xcb4f('0x65')]('/etc/asterisk/stun_xcally.conf',_0x390aff);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x35'),{'module':_0xcb4f('0x68')});}else if(_0x2a934e[_0xcb4f('0x5d')][_0xcb4f('0x5e')]()==_0xcb4f('0x69')){var _0x1e8824=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],_0xcb4f('0x72')),_0xcb4f('0x63'));var _0x35aba4=ejs['render'](_0x1e8824,{'networks':_0xdce18d||[]});fs['writeFileSync'](_0xcb4f('0x6b'),_0x35aba4);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x35'),{'module':_0xcb4f('0x68')});}else{var _0x4fc4fa=fs[_0xcb4f('0x60')](path['join'](config[_0xcb4f('0x6a')],_0xcb4f('0x6c')),_0xcb4f('0x63'));var _0x3bdd8b=ejs[_0xcb4f('0x64')](_0x4fc4fa,{'networks':_0xdce18d||[]});fs[_0xcb4f('0x65')](util[_0xcb4f('0x6d')]('/etc/asterisk/sip_xcally_%s.conf',_0x41ceed[_0xcb4f('0x5c')][_0xcb4f('0x5d')][_0xcb4f('0x6f')]()),_0x3bdd8b);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x35'),{'module':'chan_sip.so'});}return null;})[_0xcb4f('0x20')](function(_0x553203){if(_0x553203){return _0x2a934e;}return null;});})[_0xcb4f('0x20')](respondWithResult(_0x10dbfa,null))[_0xcb4f('0x2a')](handleError(_0x10dbfa,null));};exports[_0xcb4f('0x36')]=function(_0x358898,_0x126697,_0x2e41f3){var _0x1f819e;return db['Network']['find']({'where':{'id':_0x358898[_0xcb4f('0x57')]['id']}})[_0xcb4f('0x20')](function(_0x596a57){_0x1f819e=_0x596a57;return _0x596a57;})['then'](handleEntityNotFound(_0x126697,null))['then'](removeEntity(_0x126697,null))[_0xcb4f('0x20')](function(){if(_0x1f819e){return db[_0xcb4f('0x3d')][_0xcb4f('0x5b')]({'where':{'type':_0x1f819e[_0xcb4f('0x5d')]},'raw':!![]});}})[_0xcb4f('0x20')](function(_0xaddc66){if(_0x1f819e[_0xcb4f('0x5d')][_0xcb4f('0x5e')]()==_0xcb4f('0x5f')){var _0x6898ec=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],_0xcb4f('0x62')),_0xcb4f('0x63'));var _0x5daba4=ejs['render'](_0x6898ec,{'networks':_0xaddc66||[]});fs['writeFileSync'](_0xcb4f('0x66'),_0x5daba4);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x36'),{'module':'res_stun_monitor.so'});}else if(_0x1f819e['type'][_0xcb4f('0x5e')]()==_0xcb4f('0x69')){var _0x13b529=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],'server/files/templates/turn_multiple.ejs'),_0xcb4f('0x63'));var _0x30b5fd=ejs[_0xcb4f('0x64')](_0x13b529,{'networks':_0xaddc66||[]});fs['writeFileSync'](_0xcb4f('0x6b'),_0x30b5fd);return respondWithRpcPromise('Reload',_0xcb4f('0x36'),{'module':_0xcb4f('0x68')});}else{var _0x17765c=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config['root'],_0xcb4f('0x6c')),'utf8');var _0x4f1a25=ejs['render'](_0x17765c,{'networks':_0xaddc66||[]});fs[_0xcb4f('0x65')](util[_0xcb4f('0x6d')](_0xcb4f('0x6e'),_0x358898[_0xcb4f('0x5c')][_0xcb4f('0x5d')][_0xcb4f('0x6f')]()),_0x4f1a25);return respondWithRpcPromise(_0xcb4f('0x67'),'destroy',{'module':_0xcb4f('0x70')});}return null;})[_0xcb4f('0x2a')](handleError(_0x126697,null));}; \ No newline at end of file +var _0x0076=['count','include','findAll','rows','catch','show','intersection','includeAll','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','Reload','res_stun_monitor.so','join','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','chan_sip.so','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','offset','limit','set','Content-Range','json','update','destroy','stack','name','index','map','Network','rawAttributes','fieldName','key','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options'];(function(_0x543eac,_0x3a39a1){var _0x16c036=function(_0x446e5d){while(--_0x446e5d){_0x543eac['push'](_0x543eac['shift']());}};_0x16c036(++_0x3a39a1);}(_0x0076,0x1e2));var _0x6007=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x0076[_0x5a9c0c];return _0x53c77d;};'use strict';var pdf=require(_0x6007('0x0'));var emlformat=require(_0x6007('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6007('0x2'));var jsonpatch=require(_0x6007('0x3'));var rp=require(_0x6007('0x4'));var moment=require(_0x6007('0x5'));var BPromise=require(_0x6007('0x6'));var Mustache=require(_0x6007('0x7'));var util=require(_0x6007('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6007('0x9'));var ejs=require(_0x6007('0xa'));var fs=require('fs');var _=require(_0x6007('0xb'));var squel=require(_0x6007('0xc'));var crypto=require(_0x6007('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6007('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6007('0xf'));var Redis=require(_0x6007('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6007('0x11'));var as=require(_0x6007('0x12'));var hardwareService=require(_0x6007('0x13'));var logger=require(_0x6007('0x14'))(_0x6007('0x15'));var utils=require(_0x6007('0x16'));var config=require(_0x6007('0x17'));var db=require(_0x6007('0x18'))['db'];var jayson=require(_0x6007('0x19'));var client=jayson['client'][_0x6007('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x56f459,_0x41f0c4,_0x14745d){if(_0x14745d){var _0x2c3832=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c3832[_0x6007('0x1b')](_0x41f0c4)){return _0x56f459;}else{throw new db[(_0x6007('0x1c'))][(_0x6007('0x1d'))](_0x6007('0x1e'));}}else{return _0x56f459;}}function respondWithRpcPromise(_0x4b5f0c,_0x214dbf,_0x3e9cd2,_0x2188a6){return new BPromise(function(_0x270d36,_0x25050c){var _0x44a8fe=_0x2188a6||client;return _0x44a8fe[_0x6007('0x1f')](_0x4b5f0c,_0x3e9cd2)[_0x6007('0x20')](function(_0x18da24){logger[_0x6007('0x21')](_0x6007('0x22'),_0x214dbf,_0x6007('0x23'));logger['debug'](_0x6007('0x24'),_0x214dbf,'request\x20sent',JSON[_0x6007('0x25')](_0x18da24));if(_0x18da24[_0x6007('0x26')]){if(_0x18da24[_0x6007('0x26')][_0x6007('0x27')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x214dbf,_0x18da24[_0x6007('0x26')][_0x6007('0x28')]);return _0x25050c(_0x18da24[_0x6007('0x26')][_0x6007('0x28')]);}logger[_0x6007('0x26')](_0x6007('0x22'),_0x214dbf,_0x18da24['error']['message']);return _0x270d36(_0x18da24[_0x6007('0x26')][_0x6007('0x28')]);}else{logger[_0x6007('0x21')]('Network,\x20%s,\x20%s',_0x214dbf,'request\x20sent');_0x270d36(_0x18da24[_0x6007('0x29')][_0x6007('0x28')]);}})['catch'](function(_0xc796c6){logger[_0x6007('0x26')](_0x6007('0x22'),_0x214dbf,_0xc796c6);_0x25050c(_0xc796c6);});});}function respondWithStatusCode(_0x19aacc,_0x188b86){_0x188b86=_0x188b86||0xcc;return function(_0x1184bf){if(_0x1184bf){return _0x19aacc[_0x6007('0x2a')](_0x188b86);}return _0x19aacc['status'](_0x188b86)[_0x6007('0x2b')]();};}function respondWithResult(_0x4cd7d,_0x1aa709){_0x1aa709=_0x1aa709||0xc8;return function(_0x4be9b4){if(_0x4be9b4){return _0x4cd7d[_0x6007('0x2c')](_0x1aa709)['json'](_0x4be9b4);}};}function respondWithFilteredResult(_0x7eea39,_0x273e60){return function(_0xea6488){if(_0xea6488){var _0x441f83=_0xea6488['count'],_0x40e1b7=_0x273e60[_0x6007('0x2d')],_0xbc1b76=_0x273e60[_0x6007('0x2d')]+_0x273e60[_0x6007('0x2e')],_0x506393;if(_0xbc1b76>=_0x441f83){_0xbc1b76=_0x441f83;_0x506393=0xc8;}else{_0x506393=0xce;}_0x7eea39['status'](_0x506393);return _0x7eea39[_0x6007('0x2f')](_0x6007('0x30'),_0x40e1b7+'-'+_0xbc1b76+'/'+_0x441f83)[_0x6007('0x31')](_0xea6488);}return null;};}function patchUpdates(_0x5d29d3){return function(_0x298940){try{jsonpatch['apply'](_0x298940,_0x5d29d3,!![]);}catch(_0x28e3f8){return BPromise['reject'](_0x28e3f8);}return _0x298940['save']();};}function saveUpdates(_0x4981e1,_0xd8dce8){return function(_0x11f709){if(_0x11f709){return _0x11f709[_0x6007('0x32')](_0x4981e1)[_0x6007('0x20')](function(_0x373467){return _0x373467;});}return null;};}function removeEntity(_0x2974d8,_0x10c6ca){return function(_0xd01992){if(_0xd01992){return _0xd01992[_0x6007('0x33')]()['then'](function(){_0x2974d8[_0x6007('0x2c')](0xcc)[_0x6007('0x2b')]();});}};}function handleEntityNotFound(_0x306d21,_0x483cbb){return function(_0x4c196a){if(!_0x4c196a){_0x306d21[_0x6007('0x2a')](0x194);}return _0x4c196a;};}function handleError(_0x4885bc,_0x1e73b6){_0x1e73b6=_0x1e73b6||0x1f4;return function(_0x2ef81e){logger[_0x6007('0x26')](_0x2ef81e[_0x6007('0x34')]);if(_0x2ef81e[_0x6007('0x35')]){delete _0x2ef81e['name'];}_0x4885bc[_0x6007('0x2c')](_0x1e73b6)['send'](_0x2ef81e);};}exports[_0x6007('0x36')]=function(_0x18468e,_0x3ac472){var _0x15659d={},_0x343e7e={},_0x113d4a={'count':0x0,'rows':[]};var _0xc36763=_[_0x6007('0x37')](db[_0x6007('0x38')][_0x6007('0x39')],function(_0x3554f5){return{'name':_0x3554f5[_0x6007('0x3a')],'type':_0x3554f5['type'][_0x6007('0x3b')]};});_0x343e7e['model']=_[_0x6007('0x37')](_0xc36763,_0x6007('0x35'));_0x343e7e[_0x6007('0x3c')]=_[_0x6007('0x3d')](_0x18468e['query']);_0x343e7e[_0x6007('0x3e')]=_['intersection'](_0x343e7e['model'],_0x343e7e[_0x6007('0x3c')]);_0x15659d[_0x6007('0x3f')]=_['intersection'](_0x343e7e['model'],qs['fields'](_0x18468e[_0x6007('0x3c')][_0x6007('0x40')]));_0x15659d[_0x6007('0x3f')]=_0x15659d[_0x6007('0x3f')][_0x6007('0x41')]?_0x15659d[_0x6007('0x3f')]:_0x343e7e[_0x6007('0x42')];if(!_0x18468e[_0x6007('0x3c')][_0x6007('0x43')](_0x6007('0x44'))){_0x15659d[_0x6007('0x2e')]=qs['limit'](_0x18468e[_0x6007('0x3c')][_0x6007('0x2e')]);_0x15659d['offset']=qs[_0x6007('0x2d')](_0x18468e[_0x6007('0x3c')][_0x6007('0x2d')]);}_0x15659d[_0x6007('0x45')]=qs[_0x6007('0x46')](_0x18468e['query'][_0x6007('0x46')]);_0x15659d['where']=qs[_0x6007('0x3e')](_[_0x6007('0x47')](_0x18468e[_0x6007('0x3c')],_0x343e7e[_0x6007('0x3e')]),_0xc36763);if(_0x18468e['query'][_0x6007('0x48')]){_0x15659d[_0x6007('0x49')]=_['merge'](_0x15659d[_0x6007('0x49')],{'$or':_['map'](_0xc36763,function(_0x1ae959){if(_0x1ae959[_0x6007('0x4a')]!==_0x6007('0x4b')){var _0x5203f3={};_0x5203f3[_0x1ae959['name']]={'$like':'%'+_0x18468e['query'][_0x6007('0x48')]+'%'};return _0x5203f3;}})});}_0x15659d=_[_0x6007('0x4c')]({},_0x15659d,_0x18468e[_0x6007('0x4d')]);var _0x178d41={'where':_0x15659d[_0x6007('0x49')]};return db[_0x6007('0x38')][_0x6007('0x4e')](_0x178d41)['then'](function(_0x5e7dda){_0x113d4a['count']=_0x5e7dda;if(_0x18468e[_0x6007('0x3c')]['includeAll']){_0x15659d[_0x6007('0x4f')]=[{'all':!![]}];}return db[_0x6007('0x38')][_0x6007('0x50')](_0x15659d);})[_0x6007('0x20')](function(_0x37bf49){_0x113d4a[_0x6007('0x51')]=_0x37bf49;return _0x113d4a;})[_0x6007('0x20')](respondWithFilteredResult(_0x3ac472,_0x15659d))[_0x6007('0x52')](handleError(_0x3ac472,null));};exports[_0x6007('0x53')]=function(_0x19522b,_0x459de3){var _0x793eb={'raw':!![],'where':{'id':_0x19522b['params']['id']}},_0x46184e={};_0x46184e['model']=_[_0x6007('0x3d')](db[_0x6007('0x38')][_0x6007('0x39')]);_0x46184e[_0x6007('0x3c')]=_[_0x6007('0x3d')](_0x19522b[_0x6007('0x3c')]);_0x46184e['filters']=_[_0x6007('0x54')](_0x46184e[_0x6007('0x42')],_0x46184e['query']);_0x793eb[_0x6007('0x3f')]=_[_0x6007('0x54')](_0x46184e[_0x6007('0x42')],qs[_0x6007('0x40')](_0x19522b[_0x6007('0x3c')][_0x6007('0x40')]));_0x793eb['attributes']=_0x793eb[_0x6007('0x3f')]['length']?_0x793eb[_0x6007('0x3f')]:_0x46184e[_0x6007('0x42')];if(_0x19522b[_0x6007('0x3c')][_0x6007('0x55')]){_0x793eb['include']=[{'all':!![]}];}_0x793eb=_['merge']({},_0x793eb,_0x19522b[_0x6007('0x4d')]);return db[_0x6007('0x38')][_0x6007('0x56')](_0x793eb)[_0x6007('0x20')](handleEntityNotFound(_0x459de3,null))[_0x6007('0x20')](respondWithResult(_0x459de3,null))[_0x6007('0x52')](handleError(_0x459de3,null));};exports[_0x6007('0x57')]=function(_0x3a4017,_0x202afa,_0x23bfb3){var _0x58a5ef;return db[_0x6007('0x58')][_0x6007('0x59')](function(_0x27103d){return db[_0x6007('0x38')][_0x6007('0x57')](_0x3a4017[_0x6007('0x5a')],{'raw':!![]})[_0x6007('0x20')](function(_0x419512){_0x58a5ef=_0x419512;return db[_0x6007('0x38')][_0x6007('0x50')]({'where':{'type':_0x3a4017[_0x6007('0x5a')][_0x6007('0x4a')]},'raw':!![]});})[_0x6007('0x20')](function(_0xbab1f3){if(_0x58a5ef[_0x6007('0x4a')][_0x6007('0x5b')]()==_0x6007('0x5c')){var _0x14bc61=fs[_0x6007('0x5d')](path['join'](config[_0x6007('0x5e')],_0x6007('0x5f')),_0x6007('0x60'));var _0x360305=ejs[_0x6007('0x61')](_0x14bc61,{'networks':_0xbab1f3||[]});fs[_0x6007('0x62')](_0x6007('0x63'),_0x360305);return respondWithRpcPromise('Reload',_0x6007('0x57'),{'module':'res_stun_monitor.so'});}else if(_0x58a5ef[_0x6007('0x4a')][_0x6007('0x5b')]()==_0x6007('0x64')){var _0x120e60=fs[_0x6007('0x5d')](path['join'](config[_0x6007('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x6007('0x60'));var _0x5a54a1=ejs[_0x6007('0x61')](_0x120e60,{'networks':_0xbab1f3||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5a54a1);return respondWithRpcPromise(_0x6007('0x65'),'create',{'module':_0x6007('0x66')});}else{var _0x3998bc=fs[_0x6007('0x5d')](path[_0x6007('0x67')](config['root'],'server/files/templates/network.ejs'),_0x6007('0x60'));var _0x5dc121=ejs[_0x6007('0x61')](_0x3998bc,{'networks':_0xbab1f3||[]});fs[_0x6007('0x62')](util['format'](_0x6007('0x68'),_0x3a4017[_0x6007('0x5a')]['type'][_0x6007('0x69')]()),_0x5dc121);return respondWithRpcPromise('Reload',_0x6007('0x57'),{'module':'chan_sip.so'});}return null;})[_0x6007('0x20')](function(){return _0x58a5ef;});})[_0x6007('0x20')](respondWithResult(_0x202afa,0xc9))[_0x6007('0x52')](handleError(_0x202afa,null));};exports[_0x6007('0x32')]=function(_0x2e6baf,_0x1b4a24,_0x2a7670){var _0x7030ca;return db[_0x6007('0x58')]['transaction'](function(_0x412da1){return db[_0x6007('0x38')]['find']({'where':{'id':_0x2e6baf[_0x6007('0x6a')]['id']}})[_0x6007('0x20')](handleEntityNotFound(_0x1b4a24,null))[_0x6007('0x20')](saveUpdates(_0x2e6baf['body'],null))[_0x6007('0x20')](function(_0x19276f){if(_0x19276f){_0x7030ca=_0x19276f;return db['Network'][_0x6007('0x50')]({'where':{'type':_0x7030ca['type']},'raw':!![]});}return null;})[_0x6007('0x20')](function(_0x88b412){if(_0x7030ca[_0x6007('0x4a')][_0x6007('0x5b')]()==_0x6007('0x5c')){var _0xf922cd=fs[_0x6007('0x5d')](path[_0x6007('0x67')](config[_0x6007('0x5e')],_0x6007('0x5f')),_0x6007('0x60'));var _0x9b2221=ejs[_0x6007('0x61')](_0xf922cd,{'networks':_0x88b412||[]});fs[_0x6007('0x62')](_0x6007('0x63'),_0x9b2221);return respondWithRpcPromise('Reload',_0x6007('0x32'),{'module':_0x6007('0x66')});}else if(_0x7030ca[_0x6007('0x4a')][_0x6007('0x5b')]()=='TURN'){var _0x3dbd2a=fs[_0x6007('0x5d')](path[_0x6007('0x67')](config[_0x6007('0x5e')],_0x6007('0x6b')),'utf8');var _0x1371db=ejs[_0x6007('0x61')](_0x3dbd2a,{'networks':_0x88b412||[]});fs[_0x6007('0x62')](_0x6007('0x6c'),_0x1371db);return respondWithRpcPromise(_0x6007('0x65'),_0x6007('0x32'),{'module':'res_stun_monitor.so'});}else{var _0x5d64ae=fs[_0x6007('0x5d')](path['join'](config[_0x6007('0x5e')],_0x6007('0x6d')),_0x6007('0x60'));var _0x4fe7c6=ejs[_0x6007('0x61')](_0x5d64ae,{'networks':_0x88b412||[]});fs['writeFileSync'](util[_0x6007('0x6e')](_0x6007('0x68'),_0x2e6baf[_0x6007('0x5a')]['type'][_0x6007('0x69')]()),_0x4fe7c6);return respondWithRpcPromise('Reload','update',{'module':_0x6007('0x6f')});}return null;})[_0x6007('0x20')](function(_0x3e71e6){if(_0x3e71e6){return _0x7030ca;}return null;});})[_0x6007('0x20')](respondWithResult(_0x1b4a24,null))[_0x6007('0x52')](handleError(_0x1b4a24,null));};exports[_0x6007('0x33')]=function(_0x1e3b36,_0x395791,_0x334adb){var _0x4316aa;return db[_0x6007('0x38')][_0x6007('0x56')]({'where':{'id':_0x1e3b36[_0x6007('0x6a')]['id']}})['then'](function(_0x29a3e8){_0x4316aa=_0x29a3e8;return _0x29a3e8;})[_0x6007('0x20')](handleEntityNotFound(_0x395791,null))['then'](removeEntity(_0x395791,null))['then'](function(){if(_0x4316aa){return db[_0x6007('0x38')]['findAll']({'where':{'type':_0x4316aa[_0x6007('0x4a')]},'raw':!![]});}})[_0x6007('0x20')](function(_0x39969a){if(_0x4316aa[_0x6007('0x4a')][_0x6007('0x5b')]()==_0x6007('0x5c')){var _0x42e618=fs[_0x6007('0x5d')](path[_0x6007('0x67')](config[_0x6007('0x5e')],'server/files/templates/stun_multiple.ejs'),_0x6007('0x60'));var _0x59bc09=ejs['render'](_0x42e618,{'networks':_0x39969a||[]});fs[_0x6007('0x62')]('/etc/asterisk/stun_xcally.conf',_0x59bc09);return respondWithRpcPromise(_0x6007('0x65'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x4316aa['type'][_0x6007('0x5b')]()==_0x6007('0x64')){var _0x3990e6=fs[_0x6007('0x5d')](path[_0x6007('0x67')](config['root'],_0x6007('0x6b')),_0x6007('0x60'));var _0x59e27a=ejs[_0x6007('0x61')](_0x3990e6,{'networks':_0x39969a||[]});fs[_0x6007('0x62')](_0x6007('0x6c'),_0x59e27a);return respondWithRpcPromise(_0x6007('0x65'),_0x6007('0x33'),{'module':_0x6007('0x66')});}else{var _0x5771b5=fs[_0x6007('0x5d')](path[_0x6007('0x67')](config[_0x6007('0x5e')],_0x6007('0x6d')),'utf8');var _0xbbc73=ejs[_0x6007('0x61')](_0x5771b5,{'networks':_0x39969a||[]});fs[_0x6007('0x62')](util[_0x6007('0x6e')](_0x6007('0x68'),_0x1e3b36[_0x6007('0x5a')]['type'][_0x6007('0x69')]()),_0xbbc73);return respondWithRpcPromise(_0x6007('0x65'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x6007('0x52')](handleError(_0x395791,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bc9b3ad..6545a46 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 _0xec56=['define','Network','network','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x74a4da,_0x197b50){var _0x476b37=function(_0x43ffd7){while(--_0x43ffd7){_0x74a4da['push'](_0x74a4da['shift']());}};_0x476b37(++_0x197b50);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2c68b5,_0x2bcb6b){_0x2c68b5=_0x2c68b5-0x0;var _0x2676d6=_0xec56[_0x2c68b5];return _0x2676d6;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc874=['../../config/logger','api','request-promise','path','rimraf','./network.attributes','exports','define','Network','network','lodash'];(function(_0x4bcca7,_0x45f5e3){var _0x1b6874=function(_0x177337){while(--_0x177337){_0x4bcca7['push'](_0x4bcca7['shift']());}};_0x1b6874(++_0x45f5e3);}(_0xc874,0x154));var _0x4c87=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xc874[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c87('0x3'));var fs=require('fs');var path=require(_0x4c87('0x4'));var rimraf=require(_0x4c87('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c87('0x6'));module[_0x4c87('0x7')]=function(_0x5d63ae,_0x46e0f5){return _0x5d63ae[_0x4c87('0x8')](_0x4c87('0x9'),attributes,{'tableName':_0x4c87('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 9554d4d..01e8d46 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 _0xafa4=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1abf3f,_0x532059){var _0x53da2b=function(_0xec0c1d){while(--_0xec0c1d){_0x1abf3f['push'](_0x1abf3f['shift']());}};_0x53da2b(++_0x532059);}(_0xafa4,0x1ca));var _0x4afa=function(_0x743621,_0x5860ef){_0x743621=_0x743621-0x0;var _0x540c4b=_0xafa4[_0x743621];return _0x540c4b;};'use strict';var _=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var moment=require(_0x4afa('0x2'));var BPromise=require(_0x4afa('0x3'));var rs=require(_0x4afa('0x4'));var fs=require('fs');var Redis=require(_0x4afa('0x5'));var db=require(_0x4afa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4afa('0x7'))('rpc');var config=require(_0x4afa('0x8'));var jayson=require(_0x4afa('0x9'));var client=jayson[_0x4afa('0xa')][_0x4afa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205840,_0x39df22,_0x5b5d65){return new BPromise(function(_0xf46be9,_0xd2d49c){return client[_0x4afa('0xc')](_0x205840,_0x5b5d65)['then'](function(_0x543203){logger[_0x4afa('0xd')](_0x4afa('0xe'),_0x39df22,_0x4afa('0xf'));logger['debug'](_0x4afa('0x10'),_0x39df22,'request\x20sent',JSON[_0x4afa('0x11')](_0x543203));if(_0x543203[_0x4afa('0x12')]){if(_0x543203[_0x4afa('0x12')]['code']===0x1f4){logger[_0x4afa('0x12')]('Network,\x20%s,\x20%s',_0x39df22,_0x543203[_0x4afa('0x12')]['message']);return _0xd2d49c(_0x543203[_0x4afa('0x12')][_0x4afa('0x13')]);}logger['error'](_0x4afa('0xe'),_0x39df22,_0x543203[_0x4afa('0x12')][_0x4afa('0x13')]);return _0xf46be9(_0x543203['error'][_0x4afa('0x13')]);}else{logger[_0x4afa('0xd')]('Network,\x20%s,\x20%s',_0x39df22,_0x4afa('0xf'));_0xf46be9(_0x543203[_0x4afa('0x14')][_0x4afa('0x13')]);}})[_0x4afa('0x15')](function(_0x3b6fdf){logger['error'](_0x4afa('0xe'),_0x39df22,_0x3b6fdf);_0xd2d49c(_0x3b6fdf);});});} \ No newline at end of file +var _0x5607=['request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s'];(function(_0x33dc14,_0x5f4a10){var _0x1f1ed8=function(_0x13fe30){while(--_0x13fe30){_0x33dc14['push'](_0x33dc14['shift']());}};_0x1f1ed8(++_0x5f4a10);}(_0x5607,0x167));var _0x7560=function(_0x5e0823,_0x1efeb7){_0x5e0823=_0x5e0823-0x0;var _0x3b98d5=_0x5607[_0x5e0823];return _0x3b98d5;};'use strict';var _=require('lodash');var util=require(_0x7560('0x0'));var moment=require(_0x7560('0x1'));var BPromise=require(_0x7560('0x2'));var rs=require(_0x7560('0x3'));var fs=require('fs');var Redis=require(_0x7560('0x4'));var db=require(_0x7560('0x5'))['db'];var utils=require(_0x7560('0x6'));var logger=require(_0x7560('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7560('0x8'));var client=jayson[_0x7560('0x9')][_0x7560('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecd9d,_0x30d4c0,_0x475d3b){return new BPromise(function(_0x3597ec,_0xb18aaf){return client[_0x7560('0xb')](_0x5ecd9d,_0x475d3b)[_0x7560('0xc')](function(_0x5da0fa){logger[_0x7560('0xd')](_0x7560('0xe'),_0x30d4c0,_0x7560('0xf'));logger['debug'](_0x7560('0x10'),_0x30d4c0,_0x7560('0xf'),JSON[_0x7560('0x11')](_0x5da0fa));if(_0x5da0fa[_0x7560('0x12')]){if(_0x5da0fa[_0x7560('0x12')]['code']===0x1f4){logger[_0x7560('0x12')](_0x7560('0xe'),_0x30d4c0,_0x5da0fa['error'][_0x7560('0x13')]);return _0xb18aaf(_0x5da0fa['error'][_0x7560('0x13')]);}logger[_0x7560('0x12')](_0x7560('0xe'),_0x30d4c0,_0x5da0fa['error'][_0x7560('0x13')]);return _0x3597ec(_0x5da0fa['error'][_0x7560('0x13')]);}else{logger[_0x7560('0xd')]('Network,\x20%s,\x20%s',_0x30d4c0,'request\x20sent');_0x3597ec(_0x5da0fa[_0x7560('0x14')][_0x7560('0x13')]);}})[_0x7560('0x15')](function(_0x1866e1){logger[_0x7560('0x12')](_0x7560('0xe'),_0x30d4c0,_0x1866e1);_0xb18aaf(_0x1866e1);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index d7b20ce..b8ff489 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 _0x37aa=['post','sendNotification','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller'];(function(_0x4a114b,_0x2b8574){var _0x293d37=function(_0x1cf096){while(--_0x1cf096){_0x4a114b['push'](_0x4a114b['shift']());}};_0x293d37(++_0x2b8574);}(_0x37aa,0xcf));var _0xa37a=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x37aa[_0x2c2980];return _0x2a20a9;};'use strict';var multer=require('multer');var util=require(_0xa37a('0x0'));var path=require(_0xa37a('0x1'));var timeout=require(_0xa37a('0x2'));var express=require(_0xa37a('0x3'));var router=express[_0xa37a('0x4')]();var auth=require(_0xa37a('0x5'));var interaction=require(_0xa37a('0x6'));var config=require(_0xa37a('0x7'));var controller=require(_0xa37a('0x8'));router[_0xa37a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa37a('0xa')]);module[_0xa37a('0xb')]=router; \ No newline at end of file +var _0x7d95=['express','Router','../../components/auth/service','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x7d95,0x1ec));var _0x57d9=function(_0x4de2e3,_0x7c3e2a){_0x4de2e3=_0x4de2e3-0x0;var _0x5df1c7=_0x7d95[_0x4de2e3];return _0x5df1c7;};'use strict';var multer=require(_0x57d9('0x0'));var util=require(_0x57d9('0x1'));var path=require(_0x57d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x57d9('0x3'));var router=express[_0x57d9('0x4')]();var auth=require(_0x57d9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x57d9('0x6'));router[_0x57d9('0x7')]('/',auth[_0x57d9('0x8')](),controller[_0x57d9('0x9')]);module[_0x57d9('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index eaa9cd9..aabb870 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 _0x6e3a=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3ea778,_0x2bde3a){var _0x83d46d=function(_0x30cef3){while(--_0x30cef3){_0x3ea778['push'](_0x3ea778['shift']());}};_0x83d46d(++_0x2bde3a);}(_0x6e3a,0x13c));var _0xa6e3=function(_0x2211cd,_0xa8741c){_0x2211cd=_0x2211cd-0x0;var _0x49a339=_0x6e3a[_0x2211cd];return _0x49a339;};'use strict';var Sequelize=require(_0xa6e3('0x0'));module[_0xa6e3('0x1')]={'body':{'type':Sequelize[_0xa6e3('0x2')]},'senderName':{'type':Sequelize[_0xa6e3('0x3')]},'recipientsId':{'type':Sequelize[_0xa6e3('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa6e3('0x3')]},'beep':{'type':Sequelize[_0xa6e3('0x4')]}}; \ No newline at end of file +var _0x3164=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x2d93ce,_0x1a23e1){var _0x10322d=function(_0x1f0538){while(--_0x1f0538){_0x2d93ce['push'](_0x2d93ce['shift']());}};_0x10322d(++_0x1a23e1);}(_0x3164,0x191));var _0x4316=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x3164[_0x590851];return _0x3b0115;};'use strict';var Sequelize=require(_0x4316('0x0'));module[_0x4316('0x1')]={'body':{'type':Sequelize[_0x4316('0x2')]},'senderName':{'type':Sequelize[_0x4316('0x3')]},'recipientsId':{'type':Sequelize[_0x4316('0x2')]},'recipientsDescription':{'type':Sequelize[_0x4316('0x3')]},'beep':{'type':Sequelize[_0x4316('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index e49e9b4..95f4c99 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 _0x285e=['whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','Notification','create','forEach','emit','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','ids','queue','Queue','push','union','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x285e,0x79));var _0xe285=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x285e[_0x4a53d];return _0x27410e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe285('0x0'));var rimraf=require(_0xe285('0x1'));var zipdir=require(_0xe285('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe285('0x3'));var moment=require(_0xe285('0x4'));var BPromise=require(_0xe285('0x5'));var Mustache=require(_0xe285('0x6'));var util=require(_0xe285('0x7'));var path=require(_0xe285('0x8'));var sox=require('sox');var csv=require(_0xe285('0x9'));var ejs=require(_0xe285('0xa'));var fs=require('fs');var _=require(_0xe285('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe285('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe285('0x9'));var querystring=require(_0xe285('0xd'));var Papa=require(_0xe285('0xe'));var Redis=require(_0xe285('0xf'));var authService=require(_0xe285('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe285('0x11'));var utils=require(_0xe285('0x12'));var config=require('../../config/environment');var db=require(_0xe285('0x13'))['db'];config[_0xe285('0x14')]=_[_0xe285('0x15')](config[_0xe285('0x14')],{'host':_0xe285('0x16'),'port':0x18eb});var socket=require(_0xe285('0x17'))(new Redis(config[_0xe285('0x14')]));require('./notification.socket')[_0xe285('0x18')](socket);function respondWithStatusCode(_0x229ea6,_0x3186d0){_0x3186d0=_0x3186d0||0xcc;return function(_0x3601b5){if(_0x3601b5){return _0x229ea6[_0xe285('0x19')](_0x3186d0);}return _0x229ea6[_0xe285('0x1a')](_0x3186d0)[_0xe285('0x1b')]();};}function respondWithResult(_0x271e4a,_0x801d48){_0x801d48=_0x801d48||0xc8;return function(_0x119eef){if(_0x119eef){return _0x271e4a['status'](_0x801d48)[_0xe285('0x1c')](_0x119eef);}};}function respondWithFilteredResult(_0x29d17f,_0x18eaeb){return function(_0x499ea9){if(_0x499ea9){var _0x5c4e33=_0x499ea9[_0xe285('0x1d')],_0x4106de=_0x18eaeb[_0xe285('0x1e')],_0x2eec21=_0x18eaeb['offset']+_0x18eaeb[_0xe285('0x1f')],_0x4334c3;if(_0x2eec21>=_0x5c4e33){_0x2eec21=_0x5c4e33;_0x4334c3=0xc8;}else{_0x4334c3=0xce;}_0x29d17f[_0xe285('0x1a')](_0x4334c3);return _0x29d17f[_0xe285('0x20')](_0xe285('0x21'),_0x4106de+'-'+_0x2eec21+'/'+_0x5c4e33)['json'](_0x499ea9);}return null;};}function patchUpdates(_0x4dd873){return function(_0x41c2ff){try{jsonpatch[_0xe285('0x22')](_0x41c2ff,_0x4dd873,!![]);}catch(_0x3e9472){return BPromise['reject'](_0x3e9472);}return _0x41c2ff[_0xe285('0x23')]();};}function saveUpdates(_0x487eb7,_0x20ba9d){return function(_0x1d715a){if(_0x1d715a){return _0x1d715a[_0xe285('0x24')](_0x487eb7)[_0xe285('0x25')](function(_0x4c88ae){return _0x4c88ae;});}return null;};}function removeEntity(_0x250cef,_0x2f157b){return function(_0x2dc565){if(_0x2dc565){return _0x2dc565[_0xe285('0x26')]()[_0xe285('0x25')](function(){_0x250cef['status'](0xcc)[_0xe285('0x1b')]();});}};}function handleEntityNotFound(_0x1b9fcf,_0x1d2854){return function(_0x4b3dfb){if(!_0x4b3dfb){_0x1b9fcf[_0xe285('0x19')](0x194);}return _0x4b3dfb;};}function handleError(_0x43cafb,_0x2a4c32){_0x2a4c32=_0x2a4c32||0x1f4;return function(_0x25a9c2){logger[_0xe285('0x27')](_0x25a9c2['stack']);if(_0x25a9c2[_0xe285('0x28')]){delete _0x25a9c2[_0xe285('0x28')];}_0x43cafb[_0xe285('0x1a')](_0x2a4c32)['send'](_0x25a9c2);};}exports[_0xe285('0x29')]=function(_0x5118ac,_0x464206,_0x69e507){if(!_0x5118ac[_0xe285('0x2a')][_0xe285('0x2b')](_0xe285('0x2c'))&&!_0x5118ac[_0xe285('0x2a')]['hasOwnProperty'](_0xe285('0x2d'))){throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x30'));}else{if(_0x5118ac[_0xe285('0x2a')]['hasOwnProperty'](_0xe285('0x2d'))&&!_0x5118ac[_0xe285('0x2a')][_0xe285('0x2b')](_0xe285('0x31'))){throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5118ac['body'][_0xe285('0x2b')](_0xe285('0x32'))){throw new db[(_0xe285('0x2e'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x9d8199=JSON['parse'](_0x5118ac['body'][_0xe285('0x32')]);}catch(_0x43b395){logger['error'](_0x43b395);throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x33'));}var _0x495cc=['chatqueue',_0xe285('0x34'),'mailqueue',_0xe285('0x35'),_0xe285('0x36'),'voicequeue',_0xe285('0x37'),'team',_0xe285('0x38')];if(_['some'](_0x9d8199,function(_0x43c480){return!_[_0xe285('0x39')](_0x495cc,_0x43c480[_0xe285('0x3a')][_0xe285('0x3b')]());})){throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x3c'));}}}var _0x256cc7={};_0x256cc7[_0xe285('0x3d')]=_0x5118ac[_0xe285('0x2a')]['hasOwnProperty'](_0xe285('0x3d'))?_0x5118ac[_0xe285('0x2a')][_0xe285('0x3d')]:_0x5118ac[_0xe285('0x38')]['fullname'];_0x256cc7[_0xe285('0x3e')]=_[_0xe285('0x3f')](_0x5118ac['body'][_0xe285('0x3e')])?null:_0x5118ac[_0xe285('0x2a')][_0xe285('0x3e')];_0x256cc7[_0xe285('0x40')]=_0x5118ac[_0xe285('0x2a')][_0xe285('0x40')]||![];_0x256cc7[_0xe285('0x41')]=_0x5118ac[_0xe285('0x38')]['id'];return getContent(_0x5118ac[_0xe285('0x2a')])[_0xe285('0x25')](function(_0x502455){_0x256cc7[_0xe285('0x2a')]=_0x502455;return getRecipients(_0x9d8199);})[_0xe285('0x25')](function(_0x44767a){_0x256cc7['recipientsId']=_[_0xe285('0x42')](_0x44767a)[_0xe285('0x43')](',');return db[_0xe285('0x44')]['transaction'](function(_0x2fe694){return db[_0xe285('0x45')][_0xe285('0x46')](_0x256cc7,{'raw':!![],'transaction':_0x2fe694})['then'](function(_0x22add7){var _0x65a314={'sender':_0x256cc7[_0xe285('0x3d')],'description':_0x256cc7[_0xe285('0x3e')],'content':_0x256cc7['body'],'beep':_0x256cc7[_0xe285('0x40')]};_0x44767a[_0xe285('0x47')](function(_0x31b9f7){_0x65a314['recipient']=_0x31b9f7;socket[_0xe285('0x48')]('notification:send',_0x65a314);});return _0x22add7;});});})[_0xe285('0x25')](respondWithResult(_0x464206,0xc9))[_0xe285('0x49')](handleError(_0x464206,null));};function getContent(_0x39c202){return new BPromise(function(_0x26de72,_0x1eb57a){if(_0x39c202[_0xe285('0x2c')]){_0x26de72(_0x39c202[_0xe285('0x2c')]);return;}return db[_0xe285('0x4a')][_0xe285('0x4b')]({'attributes':['html'],'where':{'id':_0x39c202['TemplateId']},'raw':!![]})[_0xe285('0x25')](function(_0x1657d7){if(!_0x1657d7)throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x4c'));var _0x450150=Mustache['render'](_0x1657d7[_0xe285('0x4d')],_0x39c202[_0xe285('0x31')]);_0x26de72(_0x450150);})[_0xe285('0x49')](function(_0x2334c2){_0x1eb57a(_0x2334c2);});});}function getRecipients(_0x29078f){return new BPromise(function(_0xe43022,_0x21c7ef){var _0x4d8a9f=[];var _0x3b5620=[];_0x29078f[_0xe285('0x47')](function(_0x1a9a50){var _0x1f3f5e=_[_0xe285('0x4e')](_0x1a9a50[_0xe285('0x3a')][_0xe285('0x3b')]());if(_0x1f3f5e===_0xe285('0x4f')){_0x4d8a9f=_['union'](_0x4d8a9f,_0x1a9a50[_0xe285('0x50')]);}else{if(_[_0xe285('0x39')](_0x1f3f5e,_0xe285('0x51')))_0x1f3f5e=_0x1f3f5e['replace'](_0xe285('0x51'),_0xe285('0x52'));_0x1a9a50['ids'][_0xe285('0x47')](function(_0x5f5d5c){_0x3b5620[_0xe285('0x53')](getAgents(_0x1f3f5e,_0x5f5d5c));});}});return BPromise['all'](_0x3b5620)[_0xe285('0x25')](function(_0xc610a5){_0x4d8a9f=_[_0xe285('0x54')](_0x4d8a9f,_[_0xe285('0x55')](_0xc610a5));_0xe43022(_0x4d8a9f);})[_0xe285('0x49')](function(_0x6c0f2f){_0x21c7ef(_0x6c0f2f);});});}function getAgents(_0xd1c898,_0x230420){return new BPromise(function(_0x29256d,_0xac5b6){return db[_0xd1c898][_0xe285('0x4b')]({'where':{'id':_0x230420}})[_0xe285('0x25')](function(_0x1a2d98){return _0x1a2d98[_0xe285('0x56')]({'attributes':['id'],'raw':!![]})[_0xe285('0x25')](function(_0x1f1135){var _0x399149=_[_0xe285('0x57')](_0x1f1135,'id');_0x29256d(_0x399149);});})[_0xe285('0x49')](function(_0x5a0147){_0xac5b6(_0x5a0147);});});} \ No newline at end of file +var _0x73ea=['startCase','model','union','queue','replace','ids','push','all','flatten','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./notification.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','sendNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','parse','Sequelize','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','join','transaction','Notification','create','forEach','recipient','emit','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view'];(function(_0x148f44,_0x2b8cd6){var _0x2ee5f3=function(_0x3addc9){while(--_0x3addc9){_0x148f44['push'](_0x148f44['shift']());}};_0x2ee5f3(++_0x2b8cd6);}(_0x73ea,0x6d));var _0xa73e=function(_0x13ded8,_0x116e1f){_0x13ded8=_0x13ded8-0x0;var _0x5af7de=_0x73ea[_0x13ded8];return _0x5af7de;};'use strict';var pdf=require(_0xa73e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa73e('0x1'));var zipdir=require(_0xa73e('0x2'));var jsonpatch=require(_0xa73e('0x3'));var rp=require('request-promise');var moment=require(_0xa73e('0x4'));var BPromise=require(_0xa73e('0x5'));var Mustache=require(_0xa73e('0x6'));var util=require(_0xa73e('0x7'));var path=require(_0xa73e('0x8'));var sox=require(_0xa73e('0x9'));var csv=require('to-csv');var ejs=require(_0xa73e('0xa'));var fs=require('fs');var _=require(_0xa73e('0xb'));var squel=require(_0xa73e('0xc'));var crypto=require(_0xa73e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa73e('0xe'));var toCsv=require(_0xa73e('0xf'));var querystring=require(_0xa73e('0x10'));var Papa=require(_0xa73e('0x11'));var Redis=require(_0xa73e('0x12'));var authService=require(_0xa73e('0x13'));var qs=require(_0xa73e('0x14'));var as=require(_0xa73e('0x15'));var hardwareService=require(_0xa73e('0x16'));var logger=require(_0xa73e('0x17'))(_0xa73e('0x18'));var utils=require(_0xa73e('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa73e('0x1a')]=_['defaults'](config[_0xa73e('0x1a')],{'host':_0xa73e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa73e('0x1a')]));require(_0xa73e('0x1c'))[_0xa73e('0x1d')](socket);function respondWithStatusCode(_0x4c1bad,_0x5aec23){_0x5aec23=_0x5aec23||0xcc;return function(_0xd739fe){if(_0xd739fe){return _0x4c1bad[_0xa73e('0x1e')](_0x5aec23);}return _0x4c1bad['status'](_0x5aec23)[_0xa73e('0x1f')]();};}function respondWithResult(_0xab5f87,_0x4ee2dd){_0x4ee2dd=_0x4ee2dd||0xc8;return function(_0x55e8f6){if(_0x55e8f6){return _0xab5f87[_0xa73e('0x20')](_0x4ee2dd)['json'](_0x55e8f6);}};}function respondWithFilteredResult(_0x40d3ff,_0x5ae783){return function(_0x2a6c67){if(_0x2a6c67){var _0x1211a8=_0x2a6c67[_0xa73e('0x21')],_0x235def=_0x5ae783[_0xa73e('0x22')],_0x45d23a=_0x5ae783[_0xa73e('0x22')]+_0x5ae783[_0xa73e('0x23')],_0x164ea3;if(_0x45d23a>=_0x1211a8){_0x45d23a=_0x1211a8;_0x164ea3=0xc8;}else{_0x164ea3=0xce;}_0x40d3ff[_0xa73e('0x20')](_0x164ea3);return _0x40d3ff[_0xa73e('0x24')]('Content-Range',_0x235def+'-'+_0x45d23a+'/'+_0x1211a8)[_0xa73e('0x25')](_0x2a6c67);}return null;};}function patchUpdates(_0x1e1eb5){return function(_0x48de5e){try{jsonpatch[_0xa73e('0x26')](_0x48de5e,_0x1e1eb5,!![]);}catch(_0x3358c5){return BPromise[_0xa73e('0x27')](_0x3358c5);}return _0x48de5e[_0xa73e('0x28')]();};}function saveUpdates(_0x3bcb34,_0xe21818){return function(_0x4bb377){if(_0x4bb377){return _0x4bb377[_0xa73e('0x29')](_0x3bcb34)['then'](function(_0x1040e2){return _0x1040e2;});}return null;};}function removeEntity(_0xa4533e,_0x245e8f){return function(_0x1e722b){if(_0x1e722b){return _0x1e722b[_0xa73e('0x2a')]()[_0xa73e('0x2b')](function(){_0xa4533e[_0xa73e('0x20')](0xcc)[_0xa73e('0x1f')]();});}};}function handleEntityNotFound(_0x2a3cc3,_0x1334b9){return function(_0x5e3f1e){if(!_0x5e3f1e){_0x2a3cc3['sendStatus'](0x194);}return _0x5e3f1e;};}function handleError(_0x488b38,_0x5bba72){_0x5bba72=_0x5bba72||0x1f4;return function(_0x11683c){logger[_0xa73e('0x2c')](_0x11683c[_0xa73e('0x2d')]);if(_0x11683c['name']){delete _0x11683c[_0xa73e('0x2e')];}_0x488b38[_0xa73e('0x20')](_0x5bba72)['send'](_0x11683c);};}exports[_0xa73e('0x2f')]=function(_0x45445a,_0xf553a2,_0x593b7c){if(!_0x45445a['body'][_0xa73e('0x30')]('text')&&!_0x45445a[_0xa73e('0x31')][_0xa73e('0x30')](_0xa73e('0x32'))){throw new db['Sequelize'][(_0xa73e('0x33'))](_0xa73e('0x34'));}else{if(_0x45445a['body'][_0xa73e('0x30')](_0xa73e('0x32'))&&!_0x45445a[_0xa73e('0x31')][_0xa73e('0x30')]('view')){throw new db['Sequelize'][(_0xa73e('0x33'))](_0xa73e('0x35'));}if(!_0x45445a['body']['hasOwnProperty']('recipients')){throw new db['Sequelize'][(_0xa73e('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x294c45=JSON[_0xa73e('0x36')](_0x45445a[_0xa73e('0x31')]['recipients']);}catch(_0x34499b){logger[_0xa73e('0x2c')](_0x34499b);throw new db[(_0xa73e('0x37'))]['ValidationError'](_0xa73e('0x38'));}var _0x2a4baa=[_0xa73e('0x39'),_0xa73e('0x3a'),_0xa73e('0x3b'),_0xa73e('0x3c'),_0xa73e('0x3d'),_0xa73e('0x3e'),'whatsappqueue',_0xa73e('0x3f'),_0xa73e('0x40')];if(_[_0xa73e('0x41')](_0x294c45,function(_0x2e2beb){return!_[_0xa73e('0x42')](_0x2a4baa,_0x2e2beb['model'][_0xa73e('0x43')]());})){throw new db[(_0xa73e('0x37'))][(_0xa73e('0x33'))](_0xa73e('0x44'));}}}var _0x1b6e88={};_0x1b6e88[_0xa73e('0x45')]=_0x45445a[_0xa73e('0x31')][_0xa73e('0x30')](_0xa73e('0x45'))?_0x45445a[_0xa73e('0x31')][_0xa73e('0x45')]:_0x45445a['user'][_0xa73e('0x46')];_0x1b6e88[_0xa73e('0x47')]=_[_0xa73e('0x48')](_0x45445a[_0xa73e('0x31')]['recipientsDescription'])?null:_0x45445a['body'][_0xa73e('0x47')];_0x1b6e88[_0xa73e('0x49')]=_0x45445a[_0xa73e('0x31')]['beep']||![];_0x1b6e88[_0xa73e('0x4a')]=_0x45445a['user']['id'];return getContent(_0x45445a[_0xa73e('0x31')])[_0xa73e('0x2b')](function(_0x41c09b){_0x1b6e88[_0xa73e('0x31')]=_0x41c09b;return getRecipients(_0x294c45);})[_0xa73e('0x2b')](function(_0x3b3d57){_0x1b6e88[_0xa73e('0x4b')]=_['sortBy'](_0x3b3d57)[_0xa73e('0x4c')](',');return db['sequelize'][_0xa73e('0x4d')](function(_0x8977a8){return db[_0xa73e('0x4e')][_0xa73e('0x4f')](_0x1b6e88,{'raw':!![],'transaction':_0x8977a8})[_0xa73e('0x2b')](function(_0x4d6bb7){var _0x3357a3={'sender':_0x1b6e88[_0xa73e('0x45')],'description':_0x1b6e88[_0xa73e('0x47')],'content':_0x1b6e88[_0xa73e('0x31')],'beep':_0x1b6e88[_0xa73e('0x49')]};_0x3b3d57[_0xa73e('0x50')](function(_0x4ad8a0){_0x3357a3[_0xa73e('0x51')]=_0x4ad8a0;socket[_0xa73e('0x52')]('notification:send',_0x3357a3);});return _0x4d6bb7;});});})[_0xa73e('0x2b')](respondWithResult(_0xf553a2,0xc9))[_0xa73e('0x53')](handleError(_0xf553a2,null));};function getContent(_0x3cd4dd){return new BPromise(function(_0x1ba6fe,_0x4277cd){if(_0x3cd4dd[_0xa73e('0x54')]){_0x1ba6fe(_0x3cd4dd[_0xa73e('0x54')]);return;}return db[_0xa73e('0x55')][_0xa73e('0x56')]({'attributes':[_0xa73e('0x57')],'where':{'id':_0x3cd4dd[_0xa73e('0x32')]},'raw':!![]})[_0xa73e('0x2b')](function(_0x387e2f){if(!_0x387e2f)throw new db[(_0xa73e('0x37'))][(_0xa73e('0x33'))](_0xa73e('0x58'));var _0x1e7c42=Mustache[_0xa73e('0x59')](_0x387e2f['html'],_0x3cd4dd[_0xa73e('0x5a')]);_0x1ba6fe(_0x1e7c42);})['catch'](function(_0x175df4){_0x4277cd(_0x175df4);});});}function getRecipients(_0x4109a6){return new BPromise(function(_0x18e3ef,_0x32e5e4){var _0x4db0eb=[];var _0x30f89e=[];_0x4109a6[_0xa73e('0x50')](function(_0x1b79eb){var _0x5d87b6=_[_0xa73e('0x5b')](_0x1b79eb[_0xa73e('0x5c')][_0xa73e('0x43')]());if(_0x5d87b6==='User'){_0x4db0eb=_[_0xa73e('0x5d')](_0x4db0eb,_0x1b79eb['ids']);}else{if(_[_0xa73e('0x42')](_0x5d87b6,_0xa73e('0x5e')))_0x5d87b6=_0x5d87b6[_0xa73e('0x5f')]('queue','Queue');_0x1b79eb[_0xa73e('0x60')][_0xa73e('0x50')](function(_0x1053bc){_0x30f89e[_0xa73e('0x61')](getAgents(_0x5d87b6,_0x1053bc));});}});return BPromise[_0xa73e('0x62')](_0x30f89e)[_0xa73e('0x2b')](function(_0x1ed479){_0x4db0eb=_[_0xa73e('0x5d')](_0x4db0eb,_[_0xa73e('0x63')](_0x1ed479));_0x18e3ef(_0x4db0eb);})[_0xa73e('0x53')](function(_0x3a8126){_0x32e5e4(_0x3a8126);});});}function getAgents(_0x185398,_0x39d6f1){return new BPromise(function(_0x276ad9,_0x503700){return db[_0x185398][_0xa73e('0x56')]({'where':{'id':_0x39d6f1}})[_0xa73e('0x2b')](function(_0x574ae8){return _0x574ae8['getAgents']({'attributes':['id'],'raw':!![]})[_0xa73e('0x2b')](function(_0x48c765){var _0x51e456=_['map'](_0x48c765,'id');_0x276ad9(_0x51e456);});})[_0xa73e('0x53')](function(_0x4db219){_0x503700(_0x4db219);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index d684b15..b9e1e57 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(_0x74b300,_0x1f13c2){var _0x5ae816=function(_0x14b63a){while(--_0x14b63a){_0x74b300['push'](_0x74b300['shift']());}};_0x5ae816(++_0x1f13c2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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 _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2032,0xd9));var _0x2203=function(_0x349886,_0x155249){_0x349886=_0x349886-0x0;var _0x44cd8d=_0x2032[_0x349886];return _0x44cd8d;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 82a868a..a66ed87 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 _0x757a=['./notification.attributes','exports','define','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x5b9cfd,_0x163d05){var _0x367f99=function(_0x4fe6ff){while(--_0x4fe6ff){_0x5b9cfd['push'](_0x5b9cfd['shift']());}};_0x367f99(++_0x163d05);}(_0x757a,0xde));var _0xa757=function(_0x4bc83f,_0x4ae958){_0x4bc83f=_0x4bc83f-0x0;var _0x9703d5=_0x757a[_0x4bc83f];return _0x9703d5;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('Notification',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa757('0xa'),'collate':_0xa757('0xb')});}; \ No newline at end of file +var _0x6cb4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./notification.attributes','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6cb4,0xff));var _0x46cb=function(_0x2adeec,_0x2847cd){_0x2adeec=_0x2adeec-0x0;var _0x1dff93=_0x6cb4[_0x2adeec];return _0x1dff93;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46cb('0xd'),'collate':_0x46cb('0xe')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index acd56e1..8e2f34b 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 _0xb8cc=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2c4d04,_0x52712a){var _0x5997f8=function(_0x919cc5){while(--_0x919cc5){_0x2c4d04['push'](_0x2c4d04['shift']());}};_0x5997f8(++_0x52712a);}(_0xb8cc,0x159));var _0xcb8c=function(_0x1f3774,_0x48d33c){_0x1f3774=_0x1f3774-0x0;var _0x2ee281=_0xb8cc[_0x1f3774];return _0x2ee281;};'use strict';var _=require('lodash');var util=require(_0xcb8c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb8c('0x1'));var db=require(_0xcb8c('0x2'))['db'];var utils=require(_0xcb8c('0x3'));var logger=require('../../config/logger')(_0xcb8c('0x4'));var config=require(_0xcb8c('0x5'));var jayson=require(_0xcb8c('0x6'));var client=jayson[_0xcb8c('0x7')][_0xcb8c('0x8')]({'port':0x232a});config['redis']=_[_0xcb8c('0x9')](config[_0xcb8c('0xa')],{'host':_0xcb8c('0xb'),'port':0x18eb});var socket=require(_0xcb8c('0xc'))(new Redis(config[_0xcb8c('0xa')]));require(_0xcb8c('0xd'))['register'](socket);function respondWithRpcPromise(_0x1ead3f,_0x46ee58,_0x49722a){return new BPromise(function(_0x2fe5de,_0x59e3fc){return client[_0xcb8c('0xe')](_0x1ead3f,_0x49722a)[_0xcb8c('0xf')](function(_0x145a26){logger[_0xcb8c('0x10')](_0xcb8c('0x11'),_0x46ee58,_0xcb8c('0x12'));logger[_0xcb8c('0x13')](_0xcb8c('0x14'),_0x46ee58,'request\x20sent',JSON[_0xcb8c('0x15')](_0x145a26));if(_0x145a26[_0xcb8c('0x16')]){if(_0x145a26[_0xcb8c('0x16')][_0xcb8c('0x17')]===0x1f4){logger[_0xcb8c('0x16')](_0xcb8c('0x11'),_0x46ee58,_0x145a26['error'][_0xcb8c('0x18')]);return _0x59e3fc(_0x145a26[_0xcb8c('0x16')][_0xcb8c('0x18')]);}logger['error'](_0xcb8c('0x11'),_0x46ee58,_0x145a26[_0xcb8c('0x16')][_0xcb8c('0x18')]);return _0x2fe5de(_0x145a26[_0xcb8c('0x16')]['message']);}else{logger[_0xcb8c('0x10')](_0xcb8c('0x11'),_0x46ee58,_0xcb8c('0x12'));_0x2fe5de(_0x145a26[_0xcb8c('0x19')][_0xcb8c('0x18')]);}})[_0xcb8c('0x1a')](function(_0x490c04){logger[_0xcb8c('0x16')](_0xcb8c('0x11'),_0x46ee58,_0x490c04);_0x59e3fc(_0x490c04);});});} \ No newline at end of file +var _0x67c0=['message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./notification.socket','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x67c0,0xab));var _0x067c=function(_0x125703,_0x12dd6e){_0x125703=_0x125703-0x0;var _0x43cb71=_0x67c0[_0x125703];return _0x43cb71;};'use strict';var _=require(_0x067c('0x0'));var util=require(_0x067c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x067c('0x2'));var db=require(_0x067c('0x3'))['db'];var utils=require(_0x067c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x067c('0x5'));var jayson=require(_0x067c('0x6'));var client=jayson[_0x067c('0x7')][_0x067c('0x8')]({'port':0x232a});config[_0x067c('0x9')]=_[_0x067c('0xa')](config[_0x067c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x067c('0xb'))['register'](socket);function respondWithRpcPromise(_0x2d716e,_0x40f2b3,_0x390480){return new BPromise(function(_0x1adc50,_0x5d5d94){return client[_0x067c('0xc')](_0x2d716e,_0x390480)['then'](function(_0x27f083){logger[_0x067c('0xd')](_0x067c('0xe'),_0x40f2b3,_0x067c('0xf'));logger[_0x067c('0x10')](_0x067c('0x11'),_0x40f2b3,_0x067c('0xf'),JSON[_0x067c('0x12')](_0x27f083));if(_0x27f083[_0x067c('0x13')]){if(_0x27f083[_0x067c('0x13')][_0x067c('0x14')]===0x1f4){logger[_0x067c('0x13')]('Notification,\x20%s,\x20%s',_0x40f2b3,_0x27f083[_0x067c('0x13')][_0x067c('0x15')]);return _0x5d5d94(_0x27f083['error']['message']);}logger[_0x067c('0x13')](_0x067c('0xe'),_0x40f2b3,_0x27f083['error']['message']);return _0x1adc50(_0x27f083[_0x067c('0x13')][_0x067c('0x15')]);}else{logger[_0x067c('0xd')](_0x067c('0xe'),_0x40f2b3,'request\x20sent');_0x1adc50(_0x27f083[_0x067c('0x16')]['message']);}})[_0x067c('0x17')](function(_0x5b6aea){logger[_0x067c('0x13')](_0x067c('0xe'),_0x40f2b3,_0x5b6aea);_0x5d5d94(_0x5b6aea);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 1151348..4823fde 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 _0x4c20=['save','remove','update','emit','removeListener','length','notification:','./notification.events'];(function(_0x16d487,_0x2c9aa8){var _0x47a15e=function(_0x3744ab){while(--_0x3744ab){_0x16d487['push'](_0x16d487['shift']());}};_0x47a15e(++_0x2c9aa8);}(_0x4c20,0x187));var _0x04c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c20[_0x3dd15e];return _0x231fd0;};'use strict';var NotificationEvents=require(_0x04c2('0x0'));var events=[_0x04c2('0x1'),_0x04c2('0x2'),_0x04c2('0x3')];function createListener(_0x397189,_0x118a3b){return function(_0x591d66){_0x118a3b[_0x04c2('0x4')](_0x397189,_0x591d66);};}function removeListener(_0x21a96a,_0x2ebb18){return function(){NotificationEvents[_0x04c2('0x5')](_0x21a96a,_0x2ebb18);};}exports['register']=function(_0xe70701){for(var _0x381758=0x0,_0x437365=events[_0x04c2('0x6')];_0x381758<_0x437365;_0x381758++){var _0xac59eb=events[_0x381758];var _0x303411=createListener(_0x04c2('0x7')+_0xac59eb,_0xe70701);NotificationEvents['on'](_0xac59eb,_0x303411);}}; \ No newline at end of file +var _0xd211=['length','./notification.events','save','emit','removeListener','register'];(function(_0x27d340,_0x545abe){var _0x251dbf=function(_0x527775){while(--_0x527775){_0x27d340['push'](_0x27d340['shift']());}};_0x251dbf(++_0x545abe);}(_0xd211,0xeb));var _0x1d21=function(_0x4bd70f,_0x45cd34){_0x4bd70f=_0x4bd70f-0x0;var _0x12f8d2=_0xd211[_0x4bd70f];return _0x12f8d2;};'use strict';var NotificationEvents=require(_0x1d21('0x0'));var events=[_0x1d21('0x1'),'remove','update'];function createListener(_0x3b6a06,_0x48f510){return function(_0x4ef928){_0x48f510[_0x1d21('0x2')](_0x3b6a06,_0x4ef928);};}function removeListener(_0x599975,_0x4d10f9){return function(){NotificationEvents[_0x1d21('0x3')](_0x599975,_0x4d10f9);};}exports[_0x1d21('0x4')]=function(_0x23e14a){for(var _0x3e32b3=0x0,_0x211727=events[_0x1d21('0x5')];_0x3e32b3<_0x211727;_0x3e32b3++){var _0x3b3180=events[_0x3e32b3];var _0x389a4d=createListener('notification:'+_0x3b3180,_0x23e14a);NotificationEvents['on'](_0x3b3180,_0x389a4d);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e148808..b01f29d 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 _0x9ff2=['notify','addApplications','addAgents','/:id/send','send','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/applications','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','/:id/notify'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x9ff2,0x128));var _0x29ff=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9ff2[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x29ff('0x0'));var util=require(_0x29ff('0x1'));var path=require(_0x29ff('0x2'));var timeout=require(_0x29ff('0x3'));var express=require(_0x29ff('0x4'));var router=express[_0x29ff('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x29ff('0x6'));var config=require('../../config/environment');var controller=require(_0x29ff('0x7'));router[_0x29ff('0x8')]('/',auth[_0x29ff('0x9')](),controller['index']);router[_0x29ff('0x8')](_0x29ff('0xa'),auth['isAuthenticated'](),controller[_0x29ff('0xb')]);router[_0x29ff('0x8')](_0x29ff('0xc'),auth[_0x29ff('0x9')](),controller[_0x29ff('0xd')]);router[_0x29ff('0x8')]('/:id/dispositions',auth[_0x29ff('0x9')](),controller[_0x29ff('0xe')]);router['get']('/:id/canned_answers',auth[_0x29ff('0x9')](),controller['getAnswers']);router[_0x29ff('0x8')](_0x29ff('0xf'),auth['isAuthenticated'](),controller['getApplications']);router[_0x29ff('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x29ff('0x10')]);router[_0x29ff('0x8')](_0x29ff('0x11'),auth['isAuthenticated'](),controller[_0x29ff('0x12')]);router[_0x29ff('0x13')]('/',auth[_0x29ff('0x9')](),controller['create']);router[_0x29ff('0x13')](_0x29ff('0x14'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x15')]);router[_0x29ff('0x13')](_0x29ff('0x16'),auth[_0x29ff('0x9')](),controller['addAnswer']);router[_0x29ff('0x13')](_0x29ff('0x17'),controller[_0x29ff('0x18')]);router[_0x29ff('0x13')](_0x29ff('0xf'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x19')]);router[_0x29ff('0x13')]('/:id/users',auth[_0x29ff('0x9')](),controller[_0x29ff('0x1a')]);router[_0x29ff('0x13')](_0x29ff('0x1b'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x1c')]);router['put'](_0x29ff('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x29ff('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x29ff('0x1d')](_0x29ff('0x14'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x1e')]);router[_0x29ff('0x1d')](_0x29ff('0x16'),auth[_0x29ff('0x9')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x29ff('0x9')](),controller[_0x29ff('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x3177=['isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','/:id/dispositions','addAnswer','post','/:id/notify','notify','addApplications','addAgents','/:id/send','send','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe'];(function(_0x206a69,_0x4267f8){var _0x372f0f=function(_0x1745aa){while(--_0x1745aa){_0x206a69['push'](_0x206a69['shift']());}};_0x372f0f(++_0x4267f8);}(_0x3177,0x10c));var _0x7317=function(_0xfa3cbc,_0xdf523d){_0xfa3cbc=_0xfa3cbc-0x0;var _0x445000=_0x3177[_0xfa3cbc];return _0x445000;};'use strict';var multer=require(_0x7317('0x0'));var util=require(_0x7317('0x1'));var path=require(_0x7317('0x2'));var timeout=require(_0x7317('0x3'));var express=require(_0x7317('0x4'));var router=express[_0x7317('0x5')]();var auth=require(_0x7317('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7317('0x7'));var controller=require(_0x7317('0x8'));router[_0x7317('0x9')]('/',auth['isAuthenticated'](),controller[_0x7317('0xa')]);router[_0x7317('0x9')](_0x7317('0xb'),auth[_0x7317('0xc')](),controller[_0x7317('0xd')]);router[_0x7317('0x9')](_0x7317('0xe'),auth[_0x7317('0xc')](),controller[_0x7317('0xf')]);router[_0x7317('0x9')]('/:id/dispositions',auth[_0x7317('0xc')](),controller[_0x7317('0x10')]);router['get'](_0x7317('0x11'),auth[_0x7317('0xc')](),controller[_0x7317('0x12')]);router['get'](_0x7317('0x13'),auth[_0x7317('0xc')](),controller[_0x7317('0x14')]);router[_0x7317('0x9')](_0x7317('0x15'),auth[_0x7317('0xc')](),controller[_0x7317('0x16')]);router[_0x7317('0x9')](_0x7317('0x17'),auth[_0x7317('0xc')](),controller[_0x7317('0x18')]);router['post']('/',auth[_0x7317('0xc')](),controller[_0x7317('0x19')]);router['post'](_0x7317('0x1a'),auth[_0x7317('0xc')](),controller['addDisposition']);router['post'](_0x7317('0x11'),auth['isAuthenticated'](),controller[_0x7317('0x1b')]);router[_0x7317('0x1c')](_0x7317('0x1d'),controller[_0x7317('0x1e')]);router[_0x7317('0x1c')](_0x7317('0x13'),auth['isAuthenticated'](),controller[_0x7317('0x1f')]);router['post'](_0x7317('0x17'),auth[_0x7317('0xc')](),controller[_0x7317('0x20')]);router[_0x7317('0x1c')](_0x7317('0x21'),auth['isAuthenticated'](),controller[_0x7317('0x22')]);router['put'](_0x7317('0xe'),auth[_0x7317('0xc')](),controller['update']);router[_0x7317('0x23')](_0x7317('0xe'),auth[_0x7317('0xc')](),controller[_0x7317('0x24')]);router[_0x7317('0x23')](_0x7317('0x1a'),auth[_0x7317('0xc')](),controller[_0x7317('0x25')]);router[_0x7317('0x23')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7317('0x26')]);router['delete'](_0x7317('0x17'),auth[_0x7317('0xc')](),controller['removeAgents']);module[_0x7317('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 2c6a16a..6d234cc 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 _0xeb49=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x4227dd,_0x86a1d2){var _0x2820b0=function(_0x295a9b){while(--_0x295a9b){_0x4227dd['push'](_0x4227dd['shift']());}};_0x2820b0(++_0x86a1d2);}(_0xeb49,0xc8));var _0x9eb4=function(_0x1f86da,_0x56c559){_0x1f86da=_0x1f86da-0x0;var _0x27ec11=_0xeb49[_0x1f86da];return _0x27ec11;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9eb4('0x0'));module['exports']={'name':{'type':Sequelize[_0x9eb4('0x1')],'unique':_0x9eb4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9eb4('0x1')]},'token':{'type':Sequelize[_0x9eb4('0x1')],'defaultValue':function(){return rs[_0x9eb4('0x3')]();}},'replyUri':{'type':Sequelize[_0x9eb4('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9eb4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9eb4('0x4')],'defaultValue':function(){return _0x9eb4('0x5');}},'notificationSound':{'type':Sequelize[_0x9eb4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9eb4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9eb4('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9eb4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9eb4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9eb4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9eb4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9eb4('0x6')],'defaultValue':![],'comment':_0x9eb4('0x9'),'set':function(_0x4f2b65){if(!_0x4f2b65)this[_0x9eb4('0xa')](_0x9eb4('0xb'),null);this['setDataValue'](_0x9eb4('0xc'),_0x4f2b65);}}}; \ No newline at end of file +var _0xf6e2=['randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x26802a,_0x2b02a5){var _0x4e5ca4=function(_0x53f3a3){while(--_0x53f3a3){_0x26802a['push'](_0x26802a['shift']());}};_0x4e5ca4(++_0x2b02a5);}(_0xf6e2,0x15d));var _0x2f6e=function(_0x78dcc7,_0x4c6f8f){_0x78dcc7=_0x78dcc7-0x0;var _0x221b64=_0xf6e2[_0x78dcc7];return _0x221b64;};'use strict';var Sequelize=require(_0x2f6e('0x0'));var rs=require(_0x2f6e('0x1'));module[_0x2f6e('0x2')]={'name':{'type':Sequelize[_0x2f6e('0x3')],'unique':_0x2f6e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2f6e('0x3')]},'token':{'type':Sequelize[_0x2f6e('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2f6e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2f6e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2f6e('0x5')],'defaultValue':function(){return _0x2f6e('0x6');}},'notificationSound':{'type':Sequelize[_0x2f6e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2f6e('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2f6e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2f6e('0x3')]},'queueTransfer':{'type':Sequelize[_0x2f6e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2f6e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2f6e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2f6e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f6e('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2f6e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2f6e('0x7')],'defaultValue':![],'comment':_0x2f6e('0xa'),'set':function(_0x10b522){if(!_0x10b522)this[_0x2f6e('0xb')](_0x2f6e('0xc'),null);this[_0x2f6e('0xb')](_0x2f6e('0xd'),_0x10b522);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1a43dfd..c0b1d02 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 _0x7d6f=['findOne','CannedAnswer','removeAnswers','notify','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','priority','account','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','order','filters','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','nolimit','sort','ids','OpenchannelAccountId','getAnswers'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x7d6f,0x104));var _0xf7d6=function(_0x381568,_0x45619b){_0x381568=_0x381568-0x0;var _0x51e327=_0x7d6f[_0x381568];return _0x51e327;};'use strict';var pdf=require(_0xf7d6('0x0'));var emlformat=require(_0xf7d6('0x1'));var rimraf=require(_0xf7d6('0x2'));var zipdir=require(_0xf7d6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf7d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7d6('0x5'));var util=require(_0xf7d6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf7d6('0x7'));var ejs=require(_0xf7d6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf7d6('0x9'));var crypto=require(_0xf7d6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf7d6('0x7'));var querystring=require(_0xf7d6('0xb'));var Papa=require(_0xf7d6('0xc'));var Redis=require(_0xf7d6('0xd'));var authService=require(_0xf7d6('0xe'));var qs=require(_0xf7d6('0xf'));var as=require(_0xf7d6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7d6('0x11'))(_0xf7d6('0x12'));var utils=require('../../config/utils');var config=require(_0xf7d6('0x13'));var db=require('../../mysqldb')['db'];config[_0xf7d6('0x14')]=_[_0xf7d6('0x15')](config['redis'],{'host':_0xf7d6('0x16'),'port':0x18eb});var socket=require(_0xf7d6('0x17'))(new Redis(config[_0xf7d6('0x14')]));require('./openchannelAccount.socket')[_0xf7d6('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf7d6('0x19')][_0xf7d6('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x316682,_0x3dc73f,_0x12a5c0){if(_0x12a5c0){var _0x528451=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x528451[_0xf7d6('0x1b')](_0x3dc73f)){return _0x316682;}else{throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x1e'));}}else{return _0x316682;}}function respondWithRpcPromise(_0x57d564,_0xca9ed9,_0x8fc549,_0x5208e6){return new BPromise(function(_0x5eadac,_0x7c3072){var _0x3d2b5e=_0x5208e6||client;return _0x3d2b5e[_0xf7d6('0x1f')](_0x57d564,_0x8fc549)[_0xf7d6('0x20')](function(_0x1fe2b5){logger['info'](_0xf7d6('0x21'),_0xca9ed9,_0xf7d6('0x22'));logger[_0xf7d6('0x23')](_0xf7d6('0x24'),_0xca9ed9,_0xf7d6('0x22'),JSON[_0xf7d6('0x25')](_0x1fe2b5));if(_0x1fe2b5[_0xf7d6('0x26')]){if(_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x27')]===0x1f4){logger[_0xf7d6('0x26')](_0xf7d6('0x21'),_0xca9ed9,_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x28')]);return _0x7c3072(_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x28')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xca9ed9,_0x1fe2b5['error']['message']);return _0x5eadac(_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x28')]);}else{logger['info'](_0xf7d6('0x21'),_0xca9ed9,_0xf7d6('0x22'));_0x5eadac(_0x1fe2b5[_0xf7d6('0x29')][_0xf7d6('0x28')]);}})[_0xf7d6('0x2a')](function(_0x2ebf1c){logger[_0xf7d6('0x26')](_0xf7d6('0x21'),_0xca9ed9,_0x2ebf1c);_0x7c3072(_0x2ebf1c);});});}function respondWithStatusCode(_0x5b6a23,_0x3464bf){_0x3464bf=_0x3464bf||0xcc;return function(_0x97c786){if(_0x97c786){return _0x5b6a23[_0xf7d6('0x2b')](_0x3464bf);}return _0x5b6a23[_0xf7d6('0x2c')](_0x3464bf)['end']();};}function respondWithResult(_0x525168,_0xd4f3d9){_0xd4f3d9=_0xd4f3d9||0xc8;return function(_0x161aa0){if(_0x161aa0){return _0x525168[_0xf7d6('0x2c')](_0xd4f3d9)[_0xf7d6('0x2d')](_0x161aa0);}};}function respondWithFilteredResult(_0x34c1ad,_0x50ea8d){return function(_0x198c69){if(_0x198c69){var _0x2f929a=_0x198c69['count'],_0x1a7279=_0x50ea8d['offset'],_0x1b9ef1=_0x50ea8d[_0xf7d6('0x2e')]+_0x50ea8d['limit'],_0x4b74ff;if(_0x1b9ef1>=_0x2f929a){_0x1b9ef1=_0x2f929a;_0x4b74ff=0xc8;}else{_0x4b74ff=0xce;}_0x34c1ad[_0xf7d6('0x2c')](_0x4b74ff);return _0x34c1ad[_0xf7d6('0x2f')](_0xf7d6('0x30'),_0x1a7279+'-'+_0x1b9ef1+'/'+_0x2f929a)['json'](_0x198c69);}return null;};}function patchUpdates(_0x29450b){return function(_0x2ad500){try{jsonpatch[_0xf7d6('0x31')](_0x2ad500,_0x29450b,!![]);}catch(_0x4f32f1){return BPromise['reject'](_0x4f32f1);}return _0x2ad500[_0xf7d6('0x32')]();};}function saveUpdates(_0x220b51,_0x31bb37){return function(_0x48d48f){if(_0x48d48f){return _0x48d48f[_0xf7d6('0x33')](_0x220b51)[_0xf7d6('0x20')](function(_0x2255e0){return _0x2255e0;});}return null;};}function removeEntity(_0x5b816d,_0x1266be){return function(_0x386bca){if(_0x386bca){return _0x386bca[_0xf7d6('0x34')]()[_0xf7d6('0x20')](function(){var _0x1f347b=_0x386bca[_0xf7d6('0x35')]({'plain':!![]});var _0x3bd0b3=_0xf7d6('0x36');return db['UserProfileResource'][_0xf7d6('0x34')]({'where':{'type':_0x3bd0b3,'resourceId':_0x1f347b['id']}})[_0xf7d6('0x20')](function(){return _0x386bca;});})[_0xf7d6('0x20')](function(){_0x5b816d[_0xf7d6('0x2c')](0xcc)[_0xf7d6('0x37')]();});}};}function handleEntityNotFound(_0x467f82,_0x5ec6a1){return function(_0x5f5408){if(!_0x5f5408){_0x467f82['sendStatus'](0x194);}return _0x5f5408;};}function handleError(_0x1fb2c4,_0x2a72f4){_0x2a72f4=_0x2a72f4||0x1f4;return function(_0x22b7e6){logger[_0xf7d6('0x26')](_0x22b7e6[_0xf7d6('0x38')]);if(_0x22b7e6[_0xf7d6('0x39')]){delete _0x22b7e6[_0xf7d6('0x39')];}_0x1fb2c4[_0xf7d6('0x2c')](_0x2a72f4)[_0xf7d6('0x3a')](_0x22b7e6);};}exports[_0xf7d6('0x3b')]=function(_0x5f007c,_0x5cc843){var _0x4e77f4={'include':[{'model':db[_0xf7d6('0x3c')],'as':_0xf7d6('0x3d')}]},_0x23b71d={},_0x26999a={'count':0x0,'rows':[]};var _0x1805ee=_[_0xf7d6('0x3e')](db[_0xf7d6('0x3f')][_0xf7d6('0x40')],function(_0x51547b){return{'name':_0x51547b['fieldName'],'type':_0x51547b[_0xf7d6('0x41')][_0xf7d6('0x42')]};});_0x23b71d[_0xf7d6('0x43')]=_['map'](_0x1805ee,_0xf7d6('0x39'));_0x23b71d['query']=_[_0xf7d6('0x44')](_0x5f007c[_0xf7d6('0x45')]);_0x23b71d['filters']=_[_0xf7d6('0x46')](_0x23b71d['model'],_0x23b71d[_0xf7d6('0x45')]);_0x4e77f4[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x23b71d[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x5f007c['query']['fields']));_0x4e77f4['attributes']=_0x4e77f4[_0xf7d6('0x47')]['length']?_0x4e77f4['attributes']:_0x23b71d[_0xf7d6('0x43')];if(!_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x49')]('nolimit')){_0x4e77f4[_0xf7d6('0x4a')]=qs[_0xf7d6('0x4a')](_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x4e77f4['offset']=qs[_0xf7d6('0x2e')](_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x4e77f4[_0xf7d6('0x4b')]=qs['sort'](_0x5f007c[_0xf7d6('0x45')]['sort']);_0x4e77f4['where']=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x5f007c[_0xf7d6('0x45')],_0x23b71d[_0xf7d6('0x4c')]),_0x1805ee);if(_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x4e77f4[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x4e77f4[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x1805ee,function(_0x3feba4){if(_0x3feba4[_0xf7d6('0x41')]!==_0xf7d6('0x51')){var _0x38d9c4={};_0x38d9c4[_0x3feba4['name']]={'$like':'%'+_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x38d9c4;}})});}_0x4e77f4=_[_0xf7d6('0x50')]({},_0x4e77f4,_0x5f007c[_0xf7d6('0x52')]);var _0x4bae9b={'where':_0x4e77f4['where']};return db[_0xf7d6('0x3f')][_0xf7d6('0x53')](_0x4bae9b)[_0xf7d6('0x20')](function(_0x58a072){_0x26999a[_0xf7d6('0x53')]=_0x58a072;if(_0x5f007c[_0xf7d6('0x45')]['includeAll']){_0x4e77f4[_0xf7d6('0x54')]=[{'all':!![]}];}return db[_0xf7d6('0x3f')][_0xf7d6('0x55')](_0x4e77f4);})['then'](function(_0x4109dc){_0x26999a[_0xf7d6('0x56')]=_0x4109dc;return _0x26999a;})[_0xf7d6('0x20')](respondWithFilteredResult(_0x5cc843,_0x4e77f4))[_0xf7d6('0x2a')](handleError(_0x5cc843,null));};exports[_0xf7d6('0x57')]=function(_0x32bca0,_0x271c9b){var _0xff4894={'raw':![],'where':{'id':_0x32bca0[_0xf7d6('0x58')]['id']},'include':[{'model':db[_0xf7d6('0x3c')],'as':_0xf7d6('0x3d')}]},_0x2cdde6={};_0x2cdde6[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x3f')][_0xf7d6('0x40')]);_0x2cdde6['query']=_[_0xf7d6('0x44')](_0x32bca0[_0xf7d6('0x45')]);_0x2cdde6[_0xf7d6('0x4c')]=_[_0xf7d6('0x46')](_0x2cdde6[_0xf7d6('0x43')],_0x2cdde6[_0xf7d6('0x45')]);_0xff4894[_0xf7d6('0x47')]=_['intersection'](_0x2cdde6[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x32bca0[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0xff4894[_0xf7d6('0x47')]=_0xff4894[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0xff4894[_0xf7d6('0x47')]:_0x2cdde6[_0xf7d6('0x43')];if(_0x32bca0[_0xf7d6('0x45')][_0xf7d6('0x5a')]){_0xff4894[_0xf7d6('0x54')]=[{'all':!![]}];}_0xff4894=_[_0xf7d6('0x50')]({},_0xff4894,_0x32bca0[_0xf7d6('0x52')]);return db['OpenchannelAccount'][_0xf7d6('0x5b')](_0xff4894)[_0xf7d6('0x20')](handleEntityNotFound(_0x271c9b,null))[_0xf7d6('0x20')](respondWithResult(_0x271c9b,null))[_0xf7d6('0x2a')](handleError(_0x271c9b,null));};exports[_0xf7d6('0x5c')]=function(_0x7353ad,_0xf84d60){return db[_0xf7d6('0x3f')][_0xf7d6('0x5c')](_0x7353ad['body'],{})[_0xf7d6('0x20')](function(_0x565ed1){var _0x3339cc=_0x7353ad[_0xf7d6('0x5d')]['get']({'plain':!![]});if(!_0x3339cc)throw new Error(_0xf7d6('0x5e'));if(_0x3339cc[_0xf7d6('0x5f')]==='user'){var _0x4ecaf4=_0x565ed1[_0xf7d6('0x35')]({'plain':!![]});var _0x151e84='OpenchannelAccounts';return db['UserProfileSection'][_0xf7d6('0x5b')]({'where':{'name':_0x151e84,'userProfileId':_0x3339cc[_0xf7d6('0x60')]},'raw':!![]})[_0xf7d6('0x20')](function(_0x12efa6){if(_0x12efa6&&_0x12efa6[_0xf7d6('0x61')]===0x0){return db[_0xf7d6('0x62')][_0xf7d6('0x5c')]({'name':_0x4ecaf4[_0xf7d6('0x39')],'resourceId':_0x4ecaf4['id'],'type':_0x12efa6[_0xf7d6('0x39')],'sectionId':_0x12efa6['id']},{})[_0xf7d6('0x20')](function(){return _0x565ed1;});}else{return _0x565ed1;}})[_0xf7d6('0x2a')](function(_0x48475f){logger[_0xf7d6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48475f);throw _0x48475f;});}return _0x565ed1;})[_0xf7d6('0x20')](respondWithResult(_0xf84d60,0xc9))[_0xf7d6('0x2a')](handleError(_0xf84d60,null));};exports[_0xf7d6('0x33')]=function(_0x24330f,_0x3a0e62){if(_0x24330f[_0xf7d6('0x63')]['id']){delete _0x24330f[_0xf7d6('0x63')]['id'];}return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x24330f[_0xf7d6('0x58')]['id']},'include':[{'model':db[_0xf7d6('0x3c')],'as':_0xf7d6('0x3d')}]})[_0xf7d6('0x20')](handleEntityNotFound(_0x3a0e62,null))['then'](saveUpdates(_0x24330f['body'],null))[_0xf7d6('0x20')](respondWithResult(_0x3a0e62,null))[_0xf7d6('0x2a')](handleError(_0x3a0e62,null));};exports[_0xf7d6('0x34')]=function(_0x3bd855,_0x275b5d){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x3bd855[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x275b5d,null))[_0xf7d6('0x20')](removeEntity(_0x275b5d,null))[_0xf7d6('0x2a')](handleError(_0x275b5d,null));};exports[_0xf7d6('0x64')]=function(_0x474ef0,_0x4f29b4){return db[_0xf7d6('0x3f')][_0xf7d6('0x64')]()['then'](respondWithResult(_0x4f29b4,null))['catch'](handleError(_0x4f29b4,null));};exports[_0xf7d6('0x65')]=function(_0x417c1d,_0x172fed,_0x2ddcfd){if(_0x417c1d['body']['id']){delete _0x417c1d[_0xf7d6('0x63')]['id'];}return db[_0xf7d6('0x3f')]['find']({'where':{'id':_0x417c1d[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x172fed,null))[_0xf7d6('0x20')](function(_0x2c9f24){if(_0x2c9f24){_0x417c1d[_0xf7d6('0x63')][_0xf7d6('0x66')]=_0x2c9f24['id'];return db[_0xf7d6('0x67')]['create'](_0x417c1d[_0xf7d6('0x63')]);}})[_0xf7d6('0x20')](respondWithResult(_0x172fed,null))[_0xf7d6('0x2a')](handleError(_0x172fed,null));};exports[_0xf7d6('0x68')]=function(_0x54164e,_0x4c0e60,_0x281d24){var _0x32b34d={'raw':![],'where':{}};var _0x4a072e={};var _0x1a6e01={'count':0x0,'rows':[]};return db[_0xf7d6('0x3f')]['findOne']({'where':{'id':_0x54164e[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x4c0e60,null))[_0xf7d6('0x20')](function(_0x175042){if(_0x175042){_0x4a072e[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x67')][_0xf7d6('0x40')]);_0x4a072e[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x54164e[_0xf7d6('0x45')]);_0x4a072e['filters']=_[_0xf7d6('0x46')](_0x4a072e[_0xf7d6('0x43')],_0x4a072e['query']);_0x32b34d[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x4a072e[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0x32b34d['attributes']=_0x32b34d[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x32b34d[_0xf7d6('0x47')]:_0x4a072e['model'];if(!_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x49')](_0xf7d6('0x69'))){_0x32b34d[_0xf7d6('0x4a')]=qs[_0xf7d6('0x4a')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x32b34d[_0xf7d6('0x2e')]=qs[_0xf7d6('0x2e')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x32b34d['order']=qs[_0xf7d6('0x6a')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x32b34d[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x54164e[_0xf7d6('0x45')],_0x4a072e['filters']));_0x32b34d[_0xf7d6('0x4f')]['OpenchannelAccountId']=_0x175042['id'];if(_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x32b34d[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x32b34d[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x32b34d[_0xf7d6('0x47')],function(_0x47934e){var _0x196879={};_0x196879[_0x47934e]={'$like':'%'+_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x196879;})});}_0x32b34d=_['merge']({},_0x32b34d,_0x54164e[_0xf7d6('0x52')]);return db[_0xf7d6('0x67')][_0xf7d6('0x53')]({'where':_0x32b34d['where']})['then'](function(_0x53575b){_0x1a6e01['count']=_0x53575b;if(_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x5a')]){_0x32b34d['include']=[{'all':!![]}];}return db[_0xf7d6('0x67')][_0xf7d6('0x55')](_0x32b34d);})[_0xf7d6('0x20')](function(_0x5aa159){_0x1a6e01[_0xf7d6('0x56')]=_0x5aa159;return _0x1a6e01;});}})[_0xf7d6('0x20')](respondWithFilteredResult(_0x4c0e60,_0x32b34d))['catch'](handleError(_0x4c0e60,null));};exports['removeDispositions']=function(_0x3072fb,_0x59579a,_0x57bbd5){return db[_0xf7d6('0x3f')]['find']({'where':{'id':_0x3072fb['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x59579a,null))[_0xf7d6('0x20')](function(_0x44e3e5){if(_0x44e3e5){return _0x44e3e5['removeDispositions'](_0x3072fb[_0xf7d6('0x45')][_0xf7d6('0x6b')]);}})['then'](respondWithStatusCode(_0x59579a,null))[_0xf7d6('0x2a')](handleError(_0x59579a,null));};exports['addAnswer']=function(_0x5df76e,_0x5afd31,_0x14fb84){if(_0x5df76e[_0xf7d6('0x63')]['id']){delete _0x5df76e[_0xf7d6('0x63')]['id'];}return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x5df76e['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x5afd31,null))[_0xf7d6('0x20')](function(_0x22af52){if(_0x22af52){_0x5df76e[_0xf7d6('0x63')][_0xf7d6('0x6c')]=_0x22af52['id'];return db['CannedAnswer']['create'](_0x5df76e[_0xf7d6('0x63')]);}})[_0xf7d6('0x20')](respondWithResult(_0x5afd31,null))[_0xf7d6('0x2a')](handleError(_0x5afd31,null));};exports[_0xf7d6('0x6d')]=function(_0x4fa510,_0x20baea,_0xd28a43){var _0x4b6dac={'raw':![],'where':{}};var _0x244d13={};var _0xf9f9da={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf7d6('0x6e')]({'where':{'id':_0x4fa510[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x20baea,null))[_0xf7d6('0x20')](function(_0x2c1f99){if(_0x2c1f99){_0x244d13[_0xf7d6('0x43')]=_['keys'](db['CannedAnswer'][_0xf7d6('0x40')]);_0x244d13[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x4fa510[_0xf7d6('0x45')]);_0x244d13[_0xf7d6('0x4c')]=_['intersection'](_0x244d13[_0xf7d6('0x43')],_0x244d13[_0xf7d6('0x45')]);_0x4b6dac[_0xf7d6('0x47')]=_['intersection'](_0x244d13[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0x4b6dac[_0xf7d6('0x47')]=_0x4b6dac[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x4b6dac['attributes']:_0x244d13[_0xf7d6('0x43')];if(!_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x49')](_0xf7d6('0x69'))){_0x4b6dac[_0xf7d6('0x4a')]=qs[_0xf7d6('0x4a')](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x4b6dac[_0xf7d6('0x2e')]=qs['offset'](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x4b6dac[_0xf7d6('0x4b')]=qs[_0xf7d6('0x6a')](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x4b6dac[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_['pick'](_0x4fa510[_0xf7d6('0x45')],_0x244d13[_0xf7d6('0x4c')]));_0x4b6dac[_0xf7d6('0x4f')][_0xf7d6('0x6c')]=_0x2c1f99['id'];if(_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x4b6dac[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x4b6dac[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x4b6dac[_0xf7d6('0x47')],function(_0x26dca1){var _0x242246={};_0x242246[_0x26dca1]={'$like':'%'+_0x4fa510[_0xf7d6('0x45')]['filter']+'%'};return _0x242246;})});}_0x4b6dac=_[_0xf7d6('0x50')]({},_0x4b6dac,_0x4fa510[_0xf7d6('0x52')]);return db[_0xf7d6('0x6f')][_0xf7d6('0x53')]({'where':_0x4b6dac[_0xf7d6('0x4f')]})[_0xf7d6('0x20')](function(_0x23e617){_0xf9f9da[_0xf7d6('0x53')]=_0x23e617;if(_0x4fa510[_0xf7d6('0x45')]['includeAll']){_0x4b6dac[_0xf7d6('0x54')]=[{'all':!![]}];}return db[_0xf7d6('0x6f')][_0xf7d6('0x55')](_0x4b6dac);})['then'](function(_0x2a3b49){_0xf9f9da[_0xf7d6('0x56')]=_0x2a3b49;return _0xf9f9da;});}})[_0xf7d6('0x20')](respondWithFilteredResult(_0x20baea,_0x4b6dac))[_0xf7d6('0x2a')](handleError(_0x20baea,null));};exports[_0xf7d6('0x70')]=function(_0x1e53ce,_0x3e78f3,_0x2b2d76){return db['OpenchannelAccount'][_0xf7d6('0x5b')]({'where':{'id':_0x1e53ce['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x3e78f3,null))[_0xf7d6('0x20')](function(_0xfd2ffc){if(_0xfd2ffc){return _0xfd2ffc[_0xf7d6('0x70')](_0x1e53ce[_0xf7d6('0x45')][_0xf7d6('0x6b')]);}})[_0xf7d6('0x20')](respondWithStatusCode(_0x3e78f3,null))['catch'](handleError(_0x3e78f3,null));};exports[_0xf7d6('0x71')]=function(_0x180d05,_0xa89ce9,_0xd9d8db){var _0x1e9b8e={'body':_0x180d05['body'],'channel':'openchannel'};var _0x359419=[];var _0x3ed499=[];var _0x3e5bb4={};var _0x828195=![];return db[_0xf7d6('0x72')][_0xf7d6('0x64')]()[_0xf7d6('0x20')](function(_0xd0e52a){if(!_0xd0e52a){throw new db['Sequelize']['ValidationError'](_0xf7d6('0x73'));}_0x359419=_[_0xf7d6('0x74')](_['keys'](_0xd0e52a),[_0xf7d6('0x75'),_0xf7d6('0x76')]);_0x3ed499=_[_0xf7d6('0x74')](_[_0xf7d6('0x44')](_0xd0e52a),['createdAt','updatedAt',_0xf7d6('0x77'),_0xf7d6('0x78')]);if(_0x180d05['body']['id']){delete _0x180d05[_0xf7d6('0x63')]['id'];}if(_['isNil'](_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x79')])){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7a'));}if(_[_0xf7d6('0x7b')](_0x180d05[_0xf7d6('0x63')]['body'])||_0x180d05[_0xf7d6('0x63')]['body']===''){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7c'));}if(_[_0xf7d6('0x7b')](_0x180d05['body'][_0xf7d6('0x7d')])){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7e')+_0x3ed499);}if(!_['includes'](_0x3ed499,_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x7d')])){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7f')+_0x3ed499);}_0x3e5bb4[_0x180d05[_0xf7d6('0x63')]['mapKey']]=_0x180d05['body'][_0xf7d6('0x79')];})[_0xf7d6('0x20')](function(){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x180d05['params']['id']},'include':[{'model':db['CmList'],'as':_0xf7d6('0x80'),'include':[{'model':db[_0xf7d6('0x72')],'as':_0xf7d6('0x81'),'where':_0x3e5bb4,'limit':0x1,'order':[[_0xf7d6('0x76'),_0xf7d6('0x82')]]}]},{'model':db[_0xf7d6('0x83')],'as':_0xf7d6('0x84')}]});})[_0xf7d6('0x20')](handleEntityNotFound(_0xa89ce9,null))[_0xf7d6('0x20')](function(_0x57aa5f){if(_0x57aa5f&&_0x57aa5f[_0xf7d6('0x80')]){_0x1e9b8e['account']=_0x57aa5f;_0x1e9b8e[_0xf7d6('0x85')]=_0x57aa5f[_0xf7d6('0x84')];_0x1e9b8e[_0xf7d6('0x86')]=_0x57aa5f[_0xf7d6('0x80')];_0x1e9b8e[_0xf7d6('0x85')]=_['orderBy'](_0x1e9b8e[_0xf7d6('0x85')],[_0xf7d6('0x87')],['asc']);if(_0x1e9b8e[_0xf7d6('0x88')]['Applications']){delete _0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x84')];}if(_0x1e9b8e[_0xf7d6('0x88')]['List']&&_0x1e9b8e['account']['List'][_0xf7d6('0x81')][_0xf7d6('0x59')]){return _0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x80')][_0xf7d6('0x81')][0x0];}var _0x25dfe4=_[_0xf7d6('0x15')](_0x180d05[_0xf7d6('0x63')],{'firstName':_0x180d05[_0xf7d6('0x63')]['from'],'ListId':_0x57aa5f['ListId']});_0x25dfe4[_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x7d')]]=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x79')];return db[_0xf7d6('0x72')][_0xf7d6('0x5c')](_0x25dfe4,{'fields':_0x359419,'raw':!![]});}})['then'](handleEntityNotFound(_0xa89ce9,null))[_0xf7d6('0x20')](function(_0x468ccc){_0x1e9b8e[_0xf7d6('0x89')]=_0x468ccc;if(_0x468ccc){var _0x522ea4={'ContactId':_0x468ccc['id'],'OpenchannelAccountId':_0x180d05[_0xf7d6('0x58')]['id'],'from':(_0x468ccc[_0xf7d6('0x8a')]||'')+'\x20'+(_0x468ccc['lastName']||'')};var _0x500ffc={'OpenchannelAccountId':_0x180d05[_0xf7d6('0x58')]['id'],'closed':![]};if(_0x180d05['body'][_0xf7d6('0x8b')]){_0x500ffc['threadId']=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')];return db[_0xf7d6('0x8c')]['find']({'where':_0x500ffc})[_0xf7d6('0x20')](function(_0x61af24){if(_0x61af24){return[_0x61af24,![]];}_0x522ea4[_0xf7d6('0x8b')]=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')];_0x522ea4['externalUrl']=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8d')];return db[_0xf7d6('0x8c')][_0xf7d6('0x5c')](_0x522ea4)['then'](function(_0x599392){return[_0x599392,!![]];});});}else{_0x500ffc['threadId']=null;}_0x500ffc['ContactId']=_0x468ccc['id'];return db['OpenchannelInteraction']['find']({'where':_0x500ffc})[_0xf7d6('0x20')](function(_0x333f4a){if(_0x333f4a){return[_0x333f4a,![]];}return db[_0xf7d6('0x8c')]['create'](_0x522ea4)[_0xf7d6('0x20')](function(_0x309694){return[_0x309694,!![]];});});}})[_0xf7d6('0x8e')](function(_0xe7a2a4,_0x3c3c8c){if(_0xe7a2a4){_0x828195=_0x3c3c8c;if(!_0x3c3c8c){var _0x4bf6df={'from':(_0x1e9b8e[_0xf7d6('0x89')][_0xf7d6('0x8a')]||'')+'\x20'+(_0x1e9b8e['contact']['lastName']||'')};if(_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')]&&_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8f')]&&_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')]!=_0x180d05[_0xf7d6('0x63')]['messageId']){_0x4bf6df[_0xf7d6('0x8b')]=_0x180d05['body'][_0xf7d6('0x8f')];}return _0xe7a2a4[_0xf7d6('0x33')](_0x4bf6df);}else{return _0xe7a2a4;}}})[_0xf7d6('0x20')](function(_0x387472){_0x1e9b8e[_0xf7d6('0x90')]=_0x387472[_0xf7d6('0x35')]({'plain':!![]});_0x1e9b8e[_0xf7d6('0x90')][_0xf7d6('0x91')]=_0x828195;if(_0x1e9b8e['interaction']['created']){if(_0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x92')]){_0x1e9b8e['applications'][_0xf7d6('0x93')]({'id':0x0,'priority':_0x1e9b8e[_0xf7d6('0x85')]['length']+0x1,'app':_0xf7d6('0x94'),'appdata':_0xf7d6('0x95'),'interval':_0xf7d6('0x96')});}}return db[_0xf7d6('0x97')]['create']({'body':_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x63')],'OpenchannelAccountId':_0x180d05[_0xf7d6('0x58')]['id'],'OpenchannelInteractionId':_0x387472['id'],'direction':'in','ContactId':_0x1e9b8e[_0xf7d6('0x89')]['id'],'AttachmentId':_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x98')]});})[_0xf7d6('0x20')](function(_0x254399){_0x1e9b8e[_0xf7d6('0x28')]=_0x254399;if(_0x1e9b8e[_0xf7d6('0x90')]['UserId']){return db[_0xf7d6('0x99')][_0xf7d6('0x5b')]({'attributes':['id','name'],'where':{'id':_0x1e9b8e[_0xf7d6('0x90')]['UserId']}})['then'](function(_0x546adc){if(_0x546adc){_0x1e9b8e[_0xf7d6('0x85')][_0xf7d6('0x9a')]({'id':0x0,'priority':0x0,'app':_0xf7d6('0x9b'),'appdata':_0x546adc[_0xf7d6('0x39')]+','+(_0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x9c')]||0xa),'interval':_0xf7d6('0x96')});_0x1e9b8e[_0xf7d6('0x9d')]=![];}return respondWithRpcPromise(_0xf7d6('0x9e'),_0xf7d6('0x9f'),_0x1e9b8e);});}return respondWithRpcPromise(_0xf7d6('0x9e'),_0xf7d6('0x9f'),_0x1e9b8e);})[_0xf7d6('0x20')](function(_0x1a1d42){respondWithRpcPromise(_0xf7d6('0xa0'),_0xf7d6('0xa0'),{'event':_0xf7d6('0x71'),'message':_0x1a1d42},client9002);return _0x1a1d42;})[_0xf7d6('0x20')](respondWithResult(_0xa89ce9,null))[_0xf7d6('0x2a')](handleError(_0xa89ce9,null));};exports[_0xf7d6('0xa1')]=function(_0x23047e,_0x1ba04b,_0x20771a){return db['OpenchannelAccount'][_0xf7d6('0x6e')]({'where':{'id':_0x23047e[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x1ba04b,null))[_0xf7d6('0x20')](function(_0x501366){if(_0x501366){return db[_0xf7d6('0xa2')][_0xf7d6('0xa3')](function(_0x4e629f){return db[_0xf7d6('0x83')][_0xf7d6('0x34')]({'where':{'OpenchannelAccountId':_0x23047e['params']['id']},'transaction':_0x4e629f})['then'](function(_0x2aa553){var _0x413550=_['map'](_0x23047e['body'],function(_0x33e079){_0x33e079[_0xf7d6('0x6c')]=_0x23047e['params']['id'];return _0x33e079;});return db[_0xf7d6('0x83')][_0xf7d6('0xa4')](_0x413550,{'transaction':_0x4e629f});});})[_0xf7d6('0x20')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x23047e[_0xf7d6('0x58')]['id']},'order':_0xf7d6('0x87')});});}})[_0xf7d6('0x20')](respondWithResult(_0x1ba04b,null))[_0xf7d6('0x2a')](handleError(_0x1ba04b,null));};exports[_0xf7d6('0xa5')]=function(_0x347836,_0x23368f,_0xbae4e2){var _0x38b176={};var _0x4f5b4f={};var _0x260eb5;var _0x427344;return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0x347836['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x23368f,null))[_0xf7d6('0x20')](function(_0x26e5c7){if(_0x26e5c7){_0x260eb5=_0x26e5c7;_0x4f5b4f[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x83')]['rawAttributes']);_0x4f5b4f[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x347836[_0xf7d6('0x45')]);_0x4f5b4f['filters']=_['intersection'](_0x4f5b4f[_0xf7d6('0x43')],_0x4f5b4f[_0xf7d6('0x45')]);_0x38b176[_0xf7d6('0x47')]=_['intersection'](_0x4f5b4f[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0x38b176['attributes']=_0x38b176[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x38b176['attributes']:_0x4f5b4f[_0xf7d6('0x43')];_0x38b176['order']=qs[_0xf7d6('0x6a')](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x38b176[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x347836['query'],_0x4f5b4f[_0xf7d6('0x4c')]));if(_0x347836['query'][_0xf7d6('0x4e')]){_0x38b176[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x38b176[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x38b176[_0xf7d6('0x47')],function(_0x41f062){var _0x3b7a60={};_0x3b7a60[_0x41f062]={'$like':'%'+_0x347836[_0xf7d6('0x45')]['filter']+'%'};return _0x3b7a60;})});}_0x38b176=_['merge']({},_0x38b176,_0x347836['options']);return _0x260eb5[_0xf7d6('0xa5')](_0x38b176);}})[_0xf7d6('0x20')](function(_0xeaf723){if(_0xeaf723){_0x427344=_0xeaf723['length'];if(!_0x347836['query']['hasOwnProperty'](_0xf7d6('0x69'))){_0x38b176['limit']=qs['limit'](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x38b176[_0xf7d6('0x2e')]=qs['offset'](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}return _0x260eb5[_0xf7d6('0xa5')](_0x38b176);}})[_0xf7d6('0x20')](function(_0x19c1e3){if(_0x19c1e3){return _0x19c1e3?{'count':_0x427344,'rows':_0x19c1e3}:null;}})[_0xf7d6('0x20')](respondWithResult(_0x23368f,null))['catch'](handleError(_0x23368f,null));};exports[_0xf7d6('0xa6')]=function(_0x5c3d50,_0x4dd3d3,_0x57a086){var _0x5a7c80={'raw':![],'where':{}};var _0x36f3eb={};var _0x43cb24={'count':0x0,'rows':[]};return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0x5c3d50[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x4dd3d3,null))[_0xf7d6('0x20')](function(_0x326fcb){if(_0x326fcb){_0x36f3eb[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x8c')][_0xf7d6('0x40')]);_0x36f3eb[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x5c3d50[_0xf7d6('0x45')]);_0x36f3eb['filters']=_[_0xf7d6('0x46')](_0x36f3eb[_0xf7d6('0x43')],_0x36f3eb[_0xf7d6('0x45')]);_0x5a7c80[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x36f3eb[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x5c3d50['query'][_0xf7d6('0x48')]));_0x5a7c80[_0xf7d6('0x47')]=_0x5a7c80[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x5a7c80[_0xf7d6('0x47')]:_0x36f3eb['model'];if(!_0x5c3d50[_0xf7d6('0x45')]['hasOwnProperty'](_0xf7d6('0x69'))){_0x5a7c80['limit']=qs[_0xf7d6('0x4a')](_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x5a7c80['offset']=qs[_0xf7d6('0x2e')](_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x5a7c80[_0xf7d6('0x4b')]=qs[_0xf7d6('0x6a')](_0x5c3d50[_0xf7d6('0x45')]['sort']);_0x5a7c80[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x5c3d50['query'],_0x36f3eb[_0xf7d6('0x4c')]));_0x5a7c80['where'][_0xf7d6('0x6c')]=_0x326fcb['id'];if(_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x5a7c80[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x5a7c80[_0xf7d6('0x4f')],{'$or':_['map'](_0x5a7c80[_0xf7d6('0x47')],function(_0x57e0b8){var _0x8b21b6={};_0x8b21b6[_0x57e0b8]={'$like':'%'+_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x8b21b6;})});}_0x5a7c80=_[_0xf7d6('0x50')]({},_0x5a7c80,_0x5c3d50[_0xf7d6('0x52')]);return db[_0xf7d6('0x8c')][_0xf7d6('0x53')]({'where':_0x5a7c80[_0xf7d6('0x4f')]})[_0xf7d6('0x20')](function(_0xa8b42){_0x43cb24[_0xf7d6('0x53')]=_0xa8b42;if(_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x5a')]){_0x5a7c80[_0xf7d6('0x54')]=[{'model':db[_0xf7d6('0x72')],'as':_0xf7d6('0xa7'),'required':![]},{'model':db['User'],'as':_0xf7d6('0xa8'),'attributes':[_0xf7d6('0x39'),_0xf7d6('0xa9'),_0xf7d6('0xaa')],'required':![]},{'model':db['Tag'],'as':_0xf7d6('0xab'),'attributes':['id','name',_0xf7d6('0xac')],'where':_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0xad')]?{'id':_0x5c3d50['query'][_0xf7d6('0xad')]}:undefined,'required':_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0xad')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5a7c80);})[_0xf7d6('0x20')](function(_0x52eb26){_0x43cb24['rows']=_0x52eb26;return _0x43cb24;});}})[_0xf7d6('0x20')](respondWithFilteredResult(_0x4dd3d3,_0x5a7c80))['catch'](handleError(_0x4dd3d3,null));};exports[_0xf7d6('0xae')]=function(_0x18569b,_0x50e6be,_0x4b4fff){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x18569b[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x50e6be,null))[_0xf7d6('0x20')](function(_0x3f0a1a){if(_0x3f0a1a){return _0x3f0a1a[_0xf7d6('0xae')](_0x18569b['body'][_0xf7d6('0x6b')],_[_0xf7d6('0xaf')](_0x18569b[_0xf7d6('0x63')],[_0xf7d6('0x6b'),'id'])||{})[_0xf7d6('0x8e')](function(_0x20db37){for(var _0x1e2e4c=0x0;_0x1e2e4c<_0x18569b[_0xf7d6('0x63')]['ids'][_0xf7d6('0x59')];_0x1e2e4c+=0x1){socket[_0xf7d6('0xb0')](_0xf7d6('0xb1'),{'UserId':_0x18569b[_0xf7d6('0x63')]['ids'][_0x1e2e4c],'OpenchannelAccountId':_0x18569b['params']['id']});}return _0x20db37;});}})['then'](respondWithResult(_0x50e6be,null))['catch'](handleError(_0x50e6be,null));};exports[_0xf7d6('0xb2')]=function(_0x158605,_0x172d98,_0x275e6c){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x158605[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x172d98,null))[_0xf7d6('0x20')](function(_0x249d67){if(_0x249d67){return _0x249d67[_0xf7d6('0xb2')](_0x158605['query']['ids'])['then'](function(){if(_[_0xf7d6('0xb3')](_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')])){for(var _0x19bbb5=0x0;_0x19bbb5<_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')][_0xf7d6('0x59')];_0x19bbb5+=0x1){socket[_0xf7d6('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')][_0x19bbb5]),'OpenchannelAccountId':Number(_0x158605[_0xf7d6('0x58')]['id'])});}}else{socket[_0xf7d6('0xb0')](_0xf7d6('0xb4'),{'UserId':Number(_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')]),'OpenchannelAccountId':Number(_0x158605['params']['id'])});}});}})['then'](respondWithStatusCode(_0x172d98,null))[_0xf7d6('0x2a')](handleError(_0x172d98,null));};exports[_0xf7d6('0xb5')]=function(_0x316b72,_0x596e30,_0x30fc0c){var _0x2648de={};var _0x5a9afa={};var _0xa4eb58;var _0x398147;return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0x316b72[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x596e30,null))[_0xf7d6('0x20')](function(_0x48e5d0){if(_0x48e5d0){_0xa4eb58=_0x48e5d0;_0x5a9afa[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x99')][_0xf7d6('0x40')]);_0x5a9afa[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x316b72[_0xf7d6('0x45')]);_0x5a9afa[_0xf7d6('0x4c')]=_[_0xf7d6('0x46')](_0x5a9afa['model'],_0x5a9afa[_0xf7d6('0x45')]);_0x2648de[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x5a9afa[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x316b72['query']['fields']));_0x2648de['attributes']=_0x2648de['attributes'][_0xf7d6('0x59')]?_0x2648de[_0xf7d6('0x47')]:_0x5a9afa[_0xf7d6('0x43')];_0x2648de[_0xf7d6('0x4b')]=qs[_0xf7d6('0x6a')](_0x316b72[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x2648de[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x316b72['query'],_0x5a9afa[_0xf7d6('0x4c')]));if(_0x316b72[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x2648de['where']=_[_0xf7d6('0x50')](_0x2648de[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x2648de[_0xf7d6('0x47')],function(_0x3ff6ab){var _0x188d5e={};_0x188d5e[_0x3ff6ab]={'$like':'%'+_0x316b72[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x188d5e;})});}_0x2648de=_[_0xf7d6('0x50')]({},_0x2648de,_0x316b72[_0xf7d6('0x52')]);return _0xa4eb58[_0xf7d6('0xb5')](_0x2648de);}})[_0xf7d6('0x20')](function(_0x9159fd){if(_0x9159fd){_0x398147=_0x9159fd[_0xf7d6('0x59')];if(!_0x316b72['query'][_0xf7d6('0x49')](_0xf7d6('0x69'))){_0x2648de['limit']=qs[_0xf7d6('0x4a')](_0x316b72[_0xf7d6('0x45')]['limit']);_0x2648de[_0xf7d6('0x2e')]=qs['offset'](_0x316b72[_0xf7d6('0x45')]['offset']);}return _0xa4eb58[_0xf7d6('0xb5')](_0x2648de);}})['then'](function(_0x33ed33){if(_0x33ed33){return _0x33ed33?{'count':_0x398147,'rows':_0x33ed33}:null;}})[_0xf7d6('0x20')](respondWithResult(_0x596e30,null))[_0xf7d6('0x2a')](handleError(_0x596e30,null));};exports[_0xf7d6('0x3a')]=function(_0xb0ffc,_0x44aec1,_0xa01d24){var _0x4179ab,_0x881e1a,_0x540cf8;if(_[_0xf7d6('0x7b')](_0xb0ffc[_0xf7d6('0x63')][_0xf7d6('0x63')])||_0xb0ffc['body']['body']===''){throw new db[(_0xf7d6('0x1c'))]['ValidationError'](_0xf7d6('0x7c'));}if(_['isNil'](_0xb0ffc['body']['to'])){}_0x4179ab=_0xb0ffc[_0xf7d6('0x63')]['to'];return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0xb0ffc[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x44aec1,null))[_0xf7d6('0x20')](function(_0x4354fe){if(_0x4354fe){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x4354fe['id']},'include':[{'model':db['CmList'],'as':_0xf7d6('0x80'),'include':[{'model':db['CmContact'],'as':_0xf7d6('0x81'),'where':{[_0x4354fe[_0xf7d6('0x7d')]]:_0x4179ab},'limit':0x1,'order':[[_0xf7d6('0x76'),_0xf7d6('0x82')]]}]}]})[_0xf7d6('0x20')](handleEntityNotFound(_0x44aec1,null))[_0xf7d6('0x20')](function(_0x50f2f6){if(_0x50f2f6&&_0x50f2f6[_0xf7d6('0x80')]){_0x881e1a=_0x50f2f6[_0xf7d6('0x35')]({'plain':!![]});if(_0x881e1a[_0xf7d6('0x80')]&&_0x881e1a[_0xf7d6('0x80')]['Contacts'][_0xf7d6('0x59')]){return _0x881e1a[_0xf7d6('0x80')][_0xf7d6('0x81')][0x0];}return db[_0xf7d6('0x72')][_0xf7d6('0x5c')](_[_0xf7d6('0x15')](_0xb0ffc[_0xf7d6('0x63')],{'firstName':_0x4179ab,[_0x50f2f6[_0xf7d6('0x7d')]]:_0x4179ab,'phone':_0x4179ab,'ListId':_0x881e1a[_0xf7d6('0x78')]}));}})['then'](handleEntityNotFound(_0x44aec1,null))['then'](function(_0x3c0fea){if(_0x3c0fea){_0x540cf8=_0x3c0fea;return db[_0xf7d6('0x8c')][_0xf7d6('0x5b')]({'where':{'ContactId':_0x540cf8['id'],'closed':![],'OpenchannelAccountId':_0x881e1a['id']}})['then'](function(_0x1007a7){if(_0x1007a7){return[_0x1007a7,![]];}return db[_0xf7d6('0x8c')][_0xf7d6('0x5c')]({'UserId':_0xb0ffc[_0xf7d6('0x5d')]['id'],'ContactId':_0x540cf8['id'],'OpenchannelAccountId':_0x881e1a['id'],'lastMsgDirection':_0xf7d6('0xb6'),'Messages':[_[_0xf7d6('0x50')](_0xb0ffc[_0xf7d6('0x63')],{'read':![],'body':_0xb0ffc[_0xf7d6('0x63')][_0xf7d6('0x63')],'OpenchannelAccountId':_0x881e1a['id'],'UserId':_0xb0ffc[_0xf7d6('0x5d')]['id'],'ContactId':_0x540cf8['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xf7d6('0xb7')}]})[_0xf7d6('0x20')](function(_0x2ab26d){return[_0x2ab26d,!![]];});});}})['spread'](function(_0x401a8f,_0x2d168f){if(_0x2d168f){return _0x401a8f;}return db[_0xf7d6('0x97')][_0xf7d6('0x5c')](_['merge'](_0xb0ffc[_0xf7d6('0x63')],{'read':![],'body':_0xb0ffc[_0xf7d6('0x63')][_0xf7d6('0x63')],'OpenchannelAccountId':_0x881e1a['id'],'OpenchannelInteractionId':_0x401a8f['id'],'UserId':_0xb0ffc['user']['id'],'ContactId':_0x540cf8['id']}))[_0xf7d6('0x20')](function(_0x4f7855){_0x401a8f['dataValues'][_0xf7d6('0xb7')]=[];_0x401a8f[_0xf7d6('0xb8')][_0xf7d6('0xb7')][_0xf7d6('0x93')](_0x4f7855[_0xf7d6('0xb8')]);return _0x401a8f;});});}})[_0xf7d6('0x20')](respondWithResult(_0x44aec1,null))[_0xf7d6('0x2a')](handleError(_0x44aec1,null));}; \ No newline at end of file +var _0xdbe5=['catch','params','attributes','find','create','body','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','OpenchannelAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','Contacts','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','bulkCreate','priority','getApplications','pick','Contact','Owner','fullname','internal','Tag','color','addAgents','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','defaults','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./openchannelAccount.socket','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','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','update','get','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','length','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','rows'];(function(_0x1d3943,_0x32ca85){var _0x166795=function(_0x48c26b){while(--_0x48c26b){_0x1d3943['push'](_0x1d3943['shift']());}};_0x166795(++_0x32ca85);}(_0xdbe5,0x11c));var _0x5dbe=function(_0x39e227,_0x21fa81){_0x39e227=_0x39e227-0x0;var _0x558d73=_0xdbe5[_0x39e227];return _0x558d73;};'use strict';var pdf=require(_0x5dbe('0x0'));var emlformat=require(_0x5dbe('0x1'));var rimraf=require(_0x5dbe('0x2'));var zipdir=require(_0x5dbe('0x3'));var jsonpatch=require(_0x5dbe('0x4'));var rp=require(_0x5dbe('0x5'));var moment=require(_0x5dbe('0x6'));var BPromise=require(_0x5dbe('0x7'));var Mustache=require(_0x5dbe('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5dbe('0x9'));var ejs=require(_0x5dbe('0xa'));var fs=require('fs');var _=require(_0x5dbe('0xb'));var squel=require(_0x5dbe('0xc'));var crypto=require(_0x5dbe('0xd'));var jsforce=require(_0x5dbe('0xe'));var deskjs=require(_0x5dbe('0xf'));var toCsv=require(_0x5dbe('0x9'));var querystring=require(_0x5dbe('0x10'));var Papa=require(_0x5dbe('0x11'));var Redis=require('ioredis');var authService=require(_0x5dbe('0x12'));var qs=require(_0x5dbe('0x13'));var as=require(_0x5dbe('0x14'));var hardwareService=require(_0x5dbe('0x15'));var logger=require(_0x5dbe('0x16'))(_0x5dbe('0x17'));var utils=require(_0x5dbe('0x18'));var config=require(_0x5dbe('0x19'));var db=require(_0x5dbe('0x1a'))['db'];config[_0x5dbe('0x1b')]=_['defaults'](config[_0x5dbe('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5dbe('0x1b')]));require(_0x5dbe('0x1c'))['register'](socket);var jayson=require(_0x5dbe('0x1d'));var client=jayson[_0x5dbe('0x1e')][_0x5dbe('0x1f')]({'port':0x232c});var client9002=jayson[_0x5dbe('0x1e')][_0x5dbe('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x40367c,_0x4847ce,_0x17b53c){if(_0x17b53c){var _0x3abfa7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3abfa7['test'](_0x4847ce)){return _0x40367c;}else{throw new db[(_0x5dbe('0x20'))][(_0x5dbe('0x21'))](_0x5dbe('0x22'));}}else{return _0x40367c;}}function respondWithRpcPromise(_0x2d132f,_0x5d6765,_0x1f2bba,_0x1033f9){return new BPromise(function(_0x3e5cc9,_0x41a07c){var _0x4cc8fc=_0x1033f9||client;return _0x4cc8fc['request'](_0x2d132f,_0x1f2bba)[_0x5dbe('0x23')](function(_0x570a7c){logger['info'](_0x5dbe('0x24'),_0x5d6765,_0x5dbe('0x25'));logger[_0x5dbe('0x26')](_0x5dbe('0x27'),_0x5d6765,_0x5dbe('0x25'),JSON[_0x5dbe('0x28')](_0x570a7c));if(_0x570a7c[_0x5dbe('0x29')]){if(_0x570a7c[_0x5dbe('0x29')][_0x5dbe('0x2a')]===0x1f4){logger[_0x5dbe('0x29')](_0x5dbe('0x24'),_0x5d6765,_0x570a7c[_0x5dbe('0x29')][_0x5dbe('0x2b')]);return _0x41a07c(_0x570a7c[_0x5dbe('0x29')][_0x5dbe('0x2b')]);}logger[_0x5dbe('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d6765,_0x570a7c[_0x5dbe('0x29')][_0x5dbe('0x2b')]);return _0x3e5cc9(_0x570a7c['error'][_0x5dbe('0x2b')]);}else{logger[_0x5dbe('0x2c')](_0x5dbe('0x24'),_0x5d6765,_0x5dbe('0x25'));_0x3e5cc9(_0x570a7c[_0x5dbe('0x2d')]['message']);}})['catch'](function(_0x154e58){logger[_0x5dbe('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d6765,_0x154e58);_0x41a07c(_0x154e58);});});}function respondWithStatusCode(_0x201ad4,_0x5ac1a2){_0x5ac1a2=_0x5ac1a2||0xcc;return function(_0x547f90){if(_0x547f90){return _0x201ad4[_0x5dbe('0x2e')](_0x5ac1a2);}return _0x201ad4['status'](_0x5ac1a2)[_0x5dbe('0x2f')]();};}function respondWithResult(_0x38ab1b,_0x4e783f){_0x4e783f=_0x4e783f||0xc8;return function(_0x195e75){if(_0x195e75){return _0x38ab1b['status'](_0x4e783f)[_0x5dbe('0x30')](_0x195e75);}};}function respondWithFilteredResult(_0x1c0ad2,_0x319693){return function(_0x26dbf0){if(_0x26dbf0){var _0x10c2fc=_0x26dbf0['count'],_0xdc467=_0x319693[_0x5dbe('0x31')],_0x4aeb8c=_0x319693[_0x5dbe('0x31')]+_0x319693[_0x5dbe('0x32')],_0x47a4a1;if(_0x4aeb8c>=_0x10c2fc){_0x4aeb8c=_0x10c2fc;_0x47a4a1=0xc8;}else{_0x47a4a1=0xce;}_0x1c0ad2[_0x5dbe('0x33')](_0x47a4a1);return _0x1c0ad2[_0x5dbe('0x34')](_0x5dbe('0x35'),_0xdc467+'-'+_0x4aeb8c+'/'+_0x10c2fc)[_0x5dbe('0x30')](_0x26dbf0);}return null;};}function patchUpdates(_0x182499){return function(_0x5f163d){try{jsonpatch['apply'](_0x5f163d,_0x182499,!![]);}catch(_0x3f02c7){return BPromise[_0x5dbe('0x36')](_0x3f02c7);}return _0x5f163d['save']();};}function saveUpdates(_0x53f3fa,_0x40fd80){return function(_0x1a6065){if(_0x1a6065){return _0x1a6065[_0x5dbe('0x37')](_0x53f3fa)[_0x5dbe('0x23')](function(_0x3361f6){return _0x3361f6;});}return null;};}function removeEntity(_0x3ac9d2,_0x4ad25b){return function(_0x1e3527){if(_0x1e3527){return _0x1e3527['destroy']()[_0x5dbe('0x23')](function(){var _0x5dfdc8=_0x1e3527[_0x5dbe('0x38')]({'plain':!![]});var _0x2e960e='OpenchannelAccounts';return db[_0x5dbe('0x39')]['destroy']({'where':{'type':_0x2e960e,'resourceId':_0x5dfdc8['id']}})[_0x5dbe('0x23')](function(){return _0x1e3527;});})[_0x5dbe('0x23')](function(){_0x3ac9d2['status'](0xcc)[_0x5dbe('0x2f')]();});}};}function handleEntityNotFound(_0x44a49e,_0x59c845){return function(_0x3a7cee){if(!_0x3a7cee){_0x44a49e[_0x5dbe('0x2e')](0x194);}return _0x3a7cee;};}function handleError(_0x37b6eb,_0x1a3bc2){_0x1a3bc2=_0x1a3bc2||0x1f4;return function(_0x3caead){logger[_0x5dbe('0x29')](_0x3caead[_0x5dbe('0x3a')]);if(_0x3caead[_0x5dbe('0x3b')]){delete _0x3caead['name'];}_0x37b6eb[_0x5dbe('0x33')](_0x1a3bc2)['send'](_0x3caead);};}exports['index']=function(_0x22cf6a,_0x8e9ef6){var _0x1ed603={'include':[{'model':db[_0x5dbe('0x3c')],'as':_0x5dbe('0x3d')}]},_0x4181d9={},_0x2beae3={'count':0x0,'rows':[]};var _0xba9c14=_[_0x5dbe('0x3e')](db[_0x5dbe('0x3f')][_0x5dbe('0x40')],function(_0x1d9ecb){return{'name':_0x1d9ecb[_0x5dbe('0x41')],'type':_0x1d9ecb[_0x5dbe('0x42')][_0x5dbe('0x43')]};});_0x4181d9[_0x5dbe('0x44')]=_[_0x5dbe('0x3e')](_0xba9c14,_0x5dbe('0x3b'));_0x4181d9['query']=_[_0x5dbe('0x45')](_0x22cf6a['query']);_0x4181d9[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0x4181d9[_0x5dbe('0x44')],_0x4181d9[_0x5dbe('0x48')]);_0x1ed603['attributes']=_[_0x5dbe('0x47')](_0x4181d9['model'],qs[_0x5dbe('0x49')](_0x22cf6a['query'][_0x5dbe('0x49')]));_0x1ed603['attributes']=_0x1ed603['attributes'][_0x5dbe('0x4a')]?_0x1ed603['attributes']:_0x4181d9[_0x5dbe('0x44')];if(!_0x22cf6a[_0x5dbe('0x48')]['hasOwnProperty'](_0x5dbe('0x4b'))){_0x1ed603[_0x5dbe('0x32')]=qs[_0x5dbe('0x32')](_0x22cf6a[_0x5dbe('0x48')][_0x5dbe('0x32')]);_0x1ed603[_0x5dbe('0x31')]=qs[_0x5dbe('0x31')](_0x22cf6a[_0x5dbe('0x48')][_0x5dbe('0x31')]);}_0x1ed603[_0x5dbe('0x4c')]=qs['sort'](_0x22cf6a[_0x5dbe('0x48')][_0x5dbe('0x4d')]);_0x1ed603[_0x5dbe('0x4e')]=qs[_0x5dbe('0x46')](_['pick'](_0x22cf6a['query'],_0x4181d9[_0x5dbe('0x46')]),_0xba9c14);if(_0x22cf6a[_0x5dbe('0x48')][_0x5dbe('0x4f')]){_0x1ed603[_0x5dbe('0x4e')]=_['merge'](_0x1ed603[_0x5dbe('0x4e')],{'$or':_[_0x5dbe('0x3e')](_0xba9c14,function(_0x48c82a){if(_0x48c82a[_0x5dbe('0x42')]!=='VIRTUAL'){var _0x119fb2={};_0x119fb2[_0x48c82a['name']]={'$like':'%'+_0x22cf6a[_0x5dbe('0x48')][_0x5dbe('0x4f')]+'%'};return _0x119fb2;}})});}_0x1ed603=_[_0x5dbe('0x50')]({},_0x1ed603,_0x22cf6a[_0x5dbe('0x51')]);var _0x2570f6={'where':_0x1ed603[_0x5dbe('0x4e')]};return db[_0x5dbe('0x3f')][_0x5dbe('0x52')](_0x2570f6)[_0x5dbe('0x23')](function(_0x529f2d){_0x2beae3[_0x5dbe('0x52')]=_0x529f2d;if(_0x22cf6a[_0x5dbe('0x48')][_0x5dbe('0x53')]){_0x1ed603[_0x5dbe('0x54')]=[{'all':!![]}];}return db[_0x5dbe('0x3f')]['findAll'](_0x1ed603);})[_0x5dbe('0x23')](function(_0x574733){_0x2beae3[_0x5dbe('0x55')]=_0x574733;return _0x2beae3;})[_0x5dbe('0x23')](respondWithFilteredResult(_0x8e9ef6,_0x1ed603))[_0x5dbe('0x56')](handleError(_0x8e9ef6,null));};exports['show']=function(_0x382ac5,_0x28e39a){var _0x383792={'raw':![],'where':{'id':_0x382ac5[_0x5dbe('0x57')]['id']},'include':[{'model':db[_0x5dbe('0x3c')],'as':_0x5dbe('0x3d')}]},_0xa8ab5c={};_0xa8ab5c['model']=_[_0x5dbe('0x45')](db['OpenchannelAccount'][_0x5dbe('0x40')]);_0xa8ab5c[_0x5dbe('0x48')]=_['keys'](_0x382ac5[_0x5dbe('0x48')]);_0xa8ab5c[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0xa8ab5c[_0x5dbe('0x44')],_0xa8ab5c['query']);_0x383792[_0x5dbe('0x58')]=_['intersection'](_0xa8ab5c[_0x5dbe('0x44')],qs[_0x5dbe('0x49')](_0x382ac5[_0x5dbe('0x48')][_0x5dbe('0x49')]));_0x383792[_0x5dbe('0x58')]=_0x383792['attributes'][_0x5dbe('0x4a')]?_0x383792[_0x5dbe('0x58')]:_0xa8ab5c['model'];if(_0x382ac5[_0x5dbe('0x48')][_0x5dbe('0x53')]){_0x383792[_0x5dbe('0x54')]=[{'all':!![]}];}_0x383792=_['merge']({},_0x383792,_0x382ac5[_0x5dbe('0x51')]);return db[_0x5dbe('0x3f')][_0x5dbe('0x59')](_0x383792)[_0x5dbe('0x23')](handleEntityNotFound(_0x28e39a,null))[_0x5dbe('0x23')](respondWithResult(_0x28e39a,null))[_0x5dbe('0x56')](handleError(_0x28e39a,null));};exports[_0x5dbe('0x5a')]=function(_0x181da1,_0x5abade){return db[_0x5dbe('0x3f')][_0x5dbe('0x5a')](_0x181da1[_0x5dbe('0x5b')],{})[_0x5dbe('0x23')](function(_0x42e870){var _0x4bdcbf=_0x181da1[_0x5dbe('0x5c')][_0x5dbe('0x38')]({'plain':!![]});if(!_0x4bdcbf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bdcbf['role']===_0x5dbe('0x5c')){var _0x5e74fd=_0x42e870[_0x5dbe('0x38')]({'plain':!![]});var _0x31cd0f=_0x5dbe('0x5d');return db[_0x5dbe('0x5e')][_0x5dbe('0x59')]({'where':{'name':_0x31cd0f,'userProfileId':_0x4bdcbf[_0x5dbe('0x5f')]},'raw':!![]})[_0x5dbe('0x23')](function(_0x32bcad){if(_0x32bcad&&_0x32bcad[_0x5dbe('0x60')]===0x0){return db[_0x5dbe('0x39')]['create']({'name':_0x5e74fd[_0x5dbe('0x3b')],'resourceId':_0x5e74fd['id'],'type':_0x32bcad[_0x5dbe('0x3b')],'sectionId':_0x32bcad['id']},{})[_0x5dbe('0x23')](function(){return _0x42e870;});}else{return _0x42e870;}})[_0x5dbe('0x56')](function(_0x2a9be7){logger[_0x5dbe('0x29')](_0x5dbe('0x61'),_0x2a9be7);throw _0x2a9be7;});}return _0x42e870;})[_0x5dbe('0x23')](respondWithResult(_0x5abade,0xc9))[_0x5dbe('0x56')](handleError(_0x5abade,null));};exports[_0x5dbe('0x37')]=function(_0x1f0956,_0x5e2544){if(_0x1f0956[_0x5dbe('0x5b')]['id']){delete _0x1f0956[_0x5dbe('0x5b')]['id'];}return db[_0x5dbe('0x3f')][_0x5dbe('0x59')]({'where':{'id':_0x1f0956['params']['id']},'include':[{'model':db['Pause'],'as':_0x5dbe('0x3d')}]})[_0x5dbe('0x23')](handleEntityNotFound(_0x5e2544,null))['then'](saveUpdates(_0x1f0956[_0x5dbe('0x5b')],null))[_0x5dbe('0x23')](respondWithResult(_0x5e2544,null))['catch'](handleError(_0x5e2544,null));};exports[_0x5dbe('0x62')]=function(_0x2f9a44,_0x4303b4){return db['OpenchannelAccount'][_0x5dbe('0x59')]({'where':{'id':_0x2f9a44[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x4303b4,null))[_0x5dbe('0x23')](removeEntity(_0x4303b4,null))[_0x5dbe('0x56')](handleError(_0x4303b4,null));};exports[_0x5dbe('0x63')]=function(_0x179e92,_0x2282d0){return db[_0x5dbe('0x3f')][_0x5dbe('0x63')]()[_0x5dbe('0x23')](respondWithResult(_0x2282d0,null))['catch'](handleError(_0x2282d0,null));};exports[_0x5dbe('0x64')]=function(_0x5e902d,_0x5d9d6d,_0x89aa77){if(_0x5e902d[_0x5dbe('0x5b')]['id']){delete _0x5e902d[_0x5dbe('0x5b')]['id'];}return db[_0x5dbe('0x3f')][_0x5dbe('0x59')]({'where':{'id':_0x5e902d[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x5d9d6d,null))[_0x5dbe('0x23')](function(_0x5ccaf9){if(_0x5ccaf9){_0x5e902d[_0x5dbe('0x5b')][_0x5dbe('0x65')]=_0x5ccaf9['id'];return db[_0x5dbe('0x66')][_0x5dbe('0x5a')](_0x5e902d['body']);}})[_0x5dbe('0x23')](respondWithResult(_0x5d9d6d,null))[_0x5dbe('0x56')](handleError(_0x5d9d6d,null));};exports[_0x5dbe('0x67')]=function(_0x4bd00c,_0x37c310,_0x4a770e){var _0x58446a={'raw':![],'where':{}};var _0x2a85b6={};var _0x3b3b40={'count':0x0,'rows':[]};return db[_0x5dbe('0x3f')][_0x5dbe('0x68')]({'where':{'id':_0x4bd00c[_0x5dbe('0x57')]['id']}})['then'](handleEntityNotFound(_0x37c310,null))['then'](function(_0x567594){if(_0x567594){_0x2a85b6[_0x5dbe('0x44')]=_[_0x5dbe('0x45')](db[_0x5dbe('0x66')]['rawAttributes']);_0x2a85b6[_0x5dbe('0x48')]=_[_0x5dbe('0x45')](_0x4bd00c[_0x5dbe('0x48')]);_0x2a85b6[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0x2a85b6[_0x5dbe('0x44')],_0x2a85b6['query']);_0x58446a[_0x5dbe('0x58')]=_[_0x5dbe('0x47')](_0x2a85b6['model'],qs[_0x5dbe('0x49')](_0x4bd00c[_0x5dbe('0x48')]['fields']));_0x58446a[_0x5dbe('0x58')]=_0x58446a[_0x5dbe('0x58')][_0x5dbe('0x4a')]?_0x58446a[_0x5dbe('0x58')]:_0x2a85b6[_0x5dbe('0x44')];if(!_0x4bd00c[_0x5dbe('0x48')][_0x5dbe('0x69')]('nolimit')){_0x58446a[_0x5dbe('0x32')]=qs[_0x5dbe('0x32')](_0x4bd00c[_0x5dbe('0x48')][_0x5dbe('0x32')]);_0x58446a[_0x5dbe('0x31')]=qs[_0x5dbe('0x31')](_0x4bd00c[_0x5dbe('0x48')]['offset']);}_0x58446a[_0x5dbe('0x4c')]=qs[_0x5dbe('0x4d')](_0x4bd00c['query'][_0x5dbe('0x4d')]);_0x58446a[_0x5dbe('0x4e')]=qs[_0x5dbe('0x46')](_['pick'](_0x4bd00c['query'],_0x2a85b6[_0x5dbe('0x46')]));_0x58446a[_0x5dbe('0x4e')][_0x5dbe('0x6a')]=_0x567594['id'];if(_0x4bd00c[_0x5dbe('0x48')][_0x5dbe('0x4f')]){_0x58446a[_0x5dbe('0x4e')]=_['merge'](_0x58446a[_0x5dbe('0x4e')],{'$or':_[_0x5dbe('0x3e')](_0x58446a[_0x5dbe('0x58')],function(_0x2c6a8d){var _0x1c05df={};_0x1c05df[_0x2c6a8d]={'$like':'%'+_0x4bd00c[_0x5dbe('0x48')][_0x5dbe('0x4f')]+'%'};return _0x1c05df;})});}_0x58446a=_[_0x5dbe('0x50')]({},_0x58446a,_0x4bd00c[_0x5dbe('0x51')]);return db[_0x5dbe('0x66')]['count']({'where':_0x58446a[_0x5dbe('0x4e')]})[_0x5dbe('0x23')](function(_0x2292e1){_0x3b3b40['count']=_0x2292e1;if(_0x4bd00c[_0x5dbe('0x48')][_0x5dbe('0x53')]){_0x58446a[_0x5dbe('0x54')]=[{'all':!![]}];}return db[_0x5dbe('0x66')][_0x5dbe('0x6b')](_0x58446a);})['then'](function(_0x3b6991){_0x3b3b40[_0x5dbe('0x55')]=_0x3b6991;return _0x3b3b40;});}})['then'](respondWithFilteredResult(_0x37c310,_0x58446a))['catch'](handleError(_0x37c310,null));};exports[_0x5dbe('0x6c')]=function(_0x4dc087,_0x135637,_0xa22735){return db['OpenchannelAccount']['find']({'where':{'id':_0x4dc087[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x135637,null))['then'](function(_0x21c628){if(_0x21c628){return _0x21c628[_0x5dbe('0x6c')](_0x4dc087[_0x5dbe('0x48')]['ids']);}})[_0x5dbe('0x23')](respondWithStatusCode(_0x135637,null))[_0x5dbe('0x56')](handleError(_0x135637,null));};exports[_0x5dbe('0x6d')]=function(_0x116a60,_0x3bfa75,_0x218548){if(_0x116a60['body']['id']){delete _0x116a60[_0x5dbe('0x5b')]['id'];}return db[_0x5dbe('0x3f')][_0x5dbe('0x59')]({'where':{'id':_0x116a60[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x3bfa75,null))['then'](function(_0x3db66b){if(_0x3db66b){_0x116a60[_0x5dbe('0x5b')][_0x5dbe('0x6a')]=_0x3db66b['id'];return db[_0x5dbe('0x6e')][_0x5dbe('0x5a')](_0x116a60[_0x5dbe('0x5b')]);}})[_0x5dbe('0x23')](respondWithResult(_0x3bfa75,null))['catch'](handleError(_0x3bfa75,null));};exports['getAnswers']=function(_0x133c29,_0x4eb4d8,_0x2b7725){var _0x4bec5d={'raw':![],'where':{}};var _0x1b25c9={};var _0xb94fd1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x5dbe('0x68')]({'where':{'id':_0x133c29['params']['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x4eb4d8,null))[_0x5dbe('0x23')](function(_0x586c58){if(_0x586c58){_0x1b25c9['model']=_['keys'](db[_0x5dbe('0x6e')]['rawAttributes']);_0x1b25c9['query']=_[_0x5dbe('0x45')](_0x133c29['query']);_0x1b25c9[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0x1b25c9[_0x5dbe('0x44')],_0x1b25c9[_0x5dbe('0x48')]);_0x4bec5d['attributes']=_[_0x5dbe('0x47')](_0x1b25c9[_0x5dbe('0x44')],qs[_0x5dbe('0x49')](_0x133c29[_0x5dbe('0x48')]['fields']));_0x4bec5d[_0x5dbe('0x58')]=_0x4bec5d[_0x5dbe('0x58')]['length']?_0x4bec5d[_0x5dbe('0x58')]:_0x1b25c9[_0x5dbe('0x44')];if(!_0x133c29[_0x5dbe('0x48')][_0x5dbe('0x69')]('nolimit')){_0x4bec5d[_0x5dbe('0x32')]=qs[_0x5dbe('0x32')](_0x133c29[_0x5dbe('0x48')][_0x5dbe('0x32')]);_0x4bec5d[_0x5dbe('0x31')]=qs[_0x5dbe('0x31')](_0x133c29[_0x5dbe('0x48')][_0x5dbe('0x31')]);}_0x4bec5d['order']=qs[_0x5dbe('0x4d')](_0x133c29[_0x5dbe('0x48')][_0x5dbe('0x4d')]);_0x4bec5d['where']=qs['filters'](_['pick'](_0x133c29[_0x5dbe('0x48')],_0x1b25c9[_0x5dbe('0x46')]));_0x4bec5d[_0x5dbe('0x4e')][_0x5dbe('0x6a')]=_0x586c58['id'];if(_0x133c29['query'][_0x5dbe('0x4f')]){_0x4bec5d[_0x5dbe('0x4e')]=_[_0x5dbe('0x50')](_0x4bec5d[_0x5dbe('0x4e')],{'$or':_[_0x5dbe('0x3e')](_0x4bec5d[_0x5dbe('0x58')],function(_0x2afe0d){var _0x2ee711={};_0x2ee711[_0x2afe0d]={'$like':'%'+_0x133c29[_0x5dbe('0x48')][_0x5dbe('0x4f')]+'%'};return _0x2ee711;})});}_0x4bec5d=_[_0x5dbe('0x50')]({},_0x4bec5d,_0x133c29['options']);return db['CannedAnswer'][_0x5dbe('0x52')]({'where':_0x4bec5d['where']})['then'](function(_0x1f8f6d){_0xb94fd1[_0x5dbe('0x52')]=_0x1f8f6d;if(_0x133c29['query']['includeAll']){_0x4bec5d[_0x5dbe('0x54')]=[{'all':!![]}];}return db[_0x5dbe('0x6e')][_0x5dbe('0x6b')](_0x4bec5d);})[_0x5dbe('0x23')](function(_0x5e1c0a){_0xb94fd1[_0x5dbe('0x55')]=_0x5e1c0a;return _0xb94fd1;});}})[_0x5dbe('0x23')](respondWithFilteredResult(_0x4eb4d8,_0x4bec5d))[_0x5dbe('0x56')](handleError(_0x4eb4d8,null));};exports['removeAnswers']=function(_0x3dc6f6,_0x13a40f,_0x5bb32d){return db['OpenchannelAccount'][_0x5dbe('0x59')]({'where':{'id':_0x3dc6f6[_0x5dbe('0x57')]['id']}})['then'](handleEntityNotFound(_0x13a40f,null))[_0x5dbe('0x23')](function(_0x229f91){if(_0x229f91){return _0x229f91[_0x5dbe('0x6f')](_0x3dc6f6[_0x5dbe('0x48')]['ids']);}})[_0x5dbe('0x23')](respondWithStatusCode(_0x13a40f,null))['catch'](handleError(_0x13a40f,null));};exports['notify']=function(_0x270d91,_0x1c685c,_0x1ce2f6){var _0x3531ee={'body':_0x270d91[_0x5dbe('0x5b')],'channel':'openchannel'};var _0x240e99=[];var _0x59c1b0=[];var _0x165a56={};var _0x3eb47c=![];return db[_0x5dbe('0x70')][_0x5dbe('0x63')]()[_0x5dbe('0x23')](function(_0x20de7c){if(!_0x20de7c){throw new db[(_0x5dbe('0x20'))][(_0x5dbe('0x21'))](_0x5dbe('0x71'));}_0x240e99=_['difference'](_['keys'](_0x20de7c),[_0x5dbe('0x72'),_0x5dbe('0x73')]);_0x59c1b0=_[_0x5dbe('0x74')](_['keys'](_0x20de7c),['createdAt',_0x5dbe('0x73'),_0x5dbe('0x75'),_0x5dbe('0x76')]);if(_0x270d91[_0x5dbe('0x5b')]['id']){delete _0x270d91[_0x5dbe('0x5b')]['id'];}if(_[_0x5dbe('0x77')](_0x270d91['body'][_0x5dbe('0x78')])){throw new db['Sequelize'][(_0x5dbe('0x21'))]('from\x20is\x20mandatory');}if(_[_0x5dbe('0x77')](_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x5b')])||_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x5b')]===''){throw new db[(_0x5dbe('0x20'))][(_0x5dbe('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5dbe('0x77')](_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x79')])){throw new db[(_0x5dbe('0x20'))][(_0x5dbe('0x21'))](_0x5dbe('0x7a')+_0x59c1b0);}if(!_[_0x5dbe('0x7b')](_0x59c1b0,_0x270d91[_0x5dbe('0x5b')]['mapKey'])){throw new db[(_0x5dbe('0x20'))][(_0x5dbe('0x21'))](_0x5dbe('0x7c')+_0x59c1b0);}_0x165a56[_0x270d91['body'][_0x5dbe('0x79')]]=_0x270d91[_0x5dbe('0x5b')]['from'];})['then'](function(){return db[_0x5dbe('0x3f')][_0x5dbe('0x59')]({'where':{'id':_0x270d91[_0x5dbe('0x57')]['id']},'include':[{'model':db[_0x5dbe('0x7d')],'as':_0x5dbe('0x7e'),'include':[{'model':db[_0x5dbe('0x70')],'as':'Contacts','where':_0x165a56,'limit':0x1,'order':[['updatedAt',_0x5dbe('0x7f')]]}]},{'model':db[_0x5dbe('0x80')],'as':_0x5dbe('0x81')}]});})[_0x5dbe('0x23')](handleEntityNotFound(_0x1c685c,null))[_0x5dbe('0x23')](function(_0x55bfd3){if(_0x55bfd3&&_0x55bfd3['List']){_0x3531ee[_0x5dbe('0x82')]=_0x55bfd3;_0x3531ee['applications']=_0x55bfd3[_0x5dbe('0x81')];_0x3531ee[_0x5dbe('0x83')]=_0x55bfd3[_0x5dbe('0x7e')];_0x3531ee[_0x5dbe('0x84')]=_[_0x5dbe('0x85')](_0x3531ee[_0x5dbe('0x84')],['priority'],['asc']);if(_0x3531ee['account']['Applications']){delete _0x3531ee['account'][_0x5dbe('0x81')];}if(_0x3531ee[_0x5dbe('0x82')][_0x5dbe('0x7e')]&&_0x3531ee[_0x5dbe('0x82')][_0x5dbe('0x7e')][_0x5dbe('0x86')][_0x5dbe('0x4a')]){return _0x3531ee['account'][_0x5dbe('0x7e')][_0x5dbe('0x86')][0x0];}var _0xde4c26=_['defaults'](_0x270d91['body'],{'firstName':_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x78')],'ListId':_0x55bfd3[_0x5dbe('0x76')]});_0xde4c26[_0x270d91[_0x5dbe('0x5b')]['mapKey']]=_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x78')];return db[_0x5dbe('0x70')]['create'](_0xde4c26,{'fields':_0x240e99,'raw':!![]});}})[_0x5dbe('0x23')](handleEntityNotFound(_0x1c685c,null))[_0x5dbe('0x23')](function(_0x23657c){_0x3531ee['contact']=_0x23657c;if(_0x23657c){var _0x4cae1f={'ContactId':_0x23657c['id'],'OpenchannelAccountId':_0x270d91[_0x5dbe('0x57')]['id'],'from':(_0x23657c[_0x5dbe('0x87')]||'')+'\x20'+(_0x23657c[_0x5dbe('0x88')]||'')};var _0x4110be={'OpenchannelAccountId':_0x270d91[_0x5dbe('0x57')]['id'],'closed':![]};if(_0x270d91[_0x5dbe('0x5b')]['threadId']){_0x4110be[_0x5dbe('0x89')]=_0x270d91['body'][_0x5dbe('0x89')];return db[_0x5dbe('0x8a')][_0x5dbe('0x59')]({'where':_0x4110be})[_0x5dbe('0x23')](function(_0x15e8e7){if(_0x15e8e7){return[_0x15e8e7,![]];}_0x4cae1f[_0x5dbe('0x89')]=_0x270d91['body'][_0x5dbe('0x89')];_0x4cae1f[_0x5dbe('0x8b')]=_0x270d91[_0x5dbe('0x5b')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0x4cae1f)['then'](function(_0x7aa16e){return[_0x7aa16e,!![]];});});}else{_0x4110be['threadId']=null;}_0x4110be[_0x5dbe('0x8c')]=_0x23657c['id'];return db[_0x5dbe('0x8a')][_0x5dbe('0x59')]({'where':_0x4110be})['then'](function(_0x3892c6){if(_0x3892c6){return[_0x3892c6,![]];}return db['OpenchannelInteraction'][_0x5dbe('0x5a')](_0x4cae1f)[_0x5dbe('0x23')](function(_0x4953d3){return[_0x4953d3,!![]];});});}})[_0x5dbe('0x8d')](function(_0x139860,_0xa47c7c){if(_0x139860){_0x3eb47c=_0xa47c7c;if(!_0xa47c7c){var _0x16cee2={'from':(_0x3531ee[_0x5dbe('0x8e')][_0x5dbe('0x87')]||'')+'\x20'+(_0x3531ee['contact']['lastName']||'')};if(_0x270d91['body'][_0x5dbe('0x89')]&&_0x270d91[_0x5dbe('0x5b')]['messageId']&&_0x270d91['body']['threadId']!=_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x8f')]){_0x16cee2[_0x5dbe('0x89')]=_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x8f')];}return _0x139860[_0x5dbe('0x37')](_0x16cee2);}else{return _0x139860;}}})['then'](function(_0x4ade95){_0x3531ee[_0x5dbe('0x90')]=_0x4ade95[_0x5dbe('0x38')]({'plain':!![]});_0x3531ee[_0x5dbe('0x90')][_0x5dbe('0x91')]=_0x3eb47c;if(_0x3531ee[_0x5dbe('0x90')][_0x5dbe('0x91')]){if(_0x3531ee['account'][_0x5dbe('0x92')]){_0x3531ee[_0x5dbe('0x84')][_0x5dbe('0x93')]({'id':0x0,'priority':_0x3531ee[_0x5dbe('0x84')][_0x5dbe('0x4a')]+0x1,'app':_0x5dbe('0x94'),'appdata':_0x5dbe('0x95'),'interval':_0x5dbe('0x96')});}}return db[_0x5dbe('0x97')][_0x5dbe('0x5a')]({'body':_0x270d91[_0x5dbe('0x5b')][_0x5dbe('0x5b')],'OpenchannelAccountId':_0x270d91[_0x5dbe('0x57')]['id'],'OpenchannelInteractionId':_0x4ade95['id'],'direction':'in','ContactId':_0x3531ee[_0x5dbe('0x8e')]['id'],'AttachmentId':_0x270d91['body'][_0x5dbe('0x98')]});})[_0x5dbe('0x23')](function(_0x4f2d62){_0x3531ee[_0x5dbe('0x2b')]=_0x4f2d62;if(_0x3531ee[_0x5dbe('0x90')][_0x5dbe('0x99')]){return db[_0x5dbe('0x9a')]['find']({'attributes':['id',_0x5dbe('0x3b')],'where':{'id':_0x3531ee['interaction'][_0x5dbe('0x99')]}})[_0x5dbe('0x23')](function(_0x312538){if(_0x312538){_0x3531ee['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5dbe('0x9b'),'appdata':_0x312538[_0x5dbe('0x3b')]+','+(_0x3531ee[_0x5dbe('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x5dbe('0x96')});_0x3531ee[_0x5dbe('0x9c')]=![];}return respondWithRpcPromise(_0x5dbe('0x9d'),_0x5dbe('0x9e'),_0x3531ee);});}return respondWithRpcPromise(_0x5dbe('0x9d'),_0x5dbe('0x9e'),_0x3531ee);})[_0x5dbe('0x23')](function(_0x1b1db4){respondWithRpcPromise(_0x5dbe('0x9f'),_0x5dbe('0x9f'),{'event':'notify','message':_0x1b1db4},client9002);return _0x1b1db4;})[_0x5dbe('0x23')](respondWithResult(_0x1c685c,null))[_0x5dbe('0x56')](handleError(_0x1c685c,null));};exports['addApplications']=function(_0x305b93,_0x408866,_0x5dc736){return db[_0x5dbe('0x3f')][_0x5dbe('0x68')]({'where':{'id':_0x305b93['params']['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x408866,null))[_0x5dbe('0x23')](function(_0x56ad7a){if(_0x56ad7a){return db[_0x5dbe('0xa0')][_0x5dbe('0xa1')](function(_0x429b98){return db['OpenchannelApplication'][_0x5dbe('0x62')]({'where':{'OpenchannelAccountId':_0x305b93['params']['id']},'transaction':_0x429b98})[_0x5dbe('0x23')](function(_0x5b6b08){var _0x3a5884=_[_0x5dbe('0x3e')](_0x305b93[_0x5dbe('0x5b')],function(_0x449b16){_0x449b16[_0x5dbe('0x6a')]=_0x305b93['params']['id'];return _0x449b16;});return db[_0x5dbe('0x80')][_0x5dbe('0xa2')](_0x3a5884,{'transaction':_0x429b98});});})['then'](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x305b93[_0x5dbe('0x57')]['id']},'order':_0x5dbe('0xa3')});});}})[_0x5dbe('0x23')](respondWithResult(_0x408866,null))['catch'](handleError(_0x408866,null));};exports[_0x5dbe('0xa4')]=function(_0x2c9f0c,_0x2e96f5,_0x3ac1e5){var _0x59ba5f={};var _0x5487b9={};var _0x4c2864;var _0x19eed9;return db[_0x5dbe('0x3f')][_0x5dbe('0x68')]({'where':{'id':_0x2c9f0c[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x2e96f5,null))[_0x5dbe('0x23')](function(_0x37925c){if(_0x37925c){_0x4c2864=_0x37925c;_0x5487b9[_0x5dbe('0x44')]=_[_0x5dbe('0x45')](db[_0x5dbe('0x80')][_0x5dbe('0x40')]);_0x5487b9[_0x5dbe('0x48')]=_[_0x5dbe('0x45')](_0x2c9f0c[_0x5dbe('0x48')]);_0x5487b9[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0x5487b9[_0x5dbe('0x44')],_0x5487b9[_0x5dbe('0x48')]);_0x59ba5f['attributes']=_[_0x5dbe('0x47')](_0x5487b9[_0x5dbe('0x44')],qs[_0x5dbe('0x49')](_0x2c9f0c[_0x5dbe('0x48')]['fields']));_0x59ba5f[_0x5dbe('0x58')]=_0x59ba5f[_0x5dbe('0x58')][_0x5dbe('0x4a')]?_0x59ba5f[_0x5dbe('0x58')]:_0x5487b9[_0x5dbe('0x44')];_0x59ba5f['order']=qs[_0x5dbe('0x4d')](_0x2c9f0c[_0x5dbe('0x48')][_0x5dbe('0x4d')]);_0x59ba5f[_0x5dbe('0x4e')]=qs[_0x5dbe('0x46')](_['pick'](_0x2c9f0c[_0x5dbe('0x48')],_0x5487b9[_0x5dbe('0x46')]));if(_0x2c9f0c[_0x5dbe('0x48')][_0x5dbe('0x4f')]){_0x59ba5f[_0x5dbe('0x4e')]=_[_0x5dbe('0x50')](_0x59ba5f['where'],{'$or':_['map'](_0x59ba5f[_0x5dbe('0x58')],function(_0xd62895){var _0x468fb3={};_0x468fb3[_0xd62895]={'$like':'%'+_0x2c9f0c[_0x5dbe('0x48')][_0x5dbe('0x4f')]+'%'};return _0x468fb3;})});}_0x59ba5f=_['merge']({},_0x59ba5f,_0x2c9f0c[_0x5dbe('0x51')]);return _0x4c2864[_0x5dbe('0xa4')](_0x59ba5f);}})[_0x5dbe('0x23')](function(_0x29f399){if(_0x29f399){_0x19eed9=_0x29f399[_0x5dbe('0x4a')];if(!_0x2c9f0c[_0x5dbe('0x48')]['hasOwnProperty']('nolimit')){_0x59ba5f['limit']=qs[_0x5dbe('0x32')](_0x2c9f0c[_0x5dbe('0x48')][_0x5dbe('0x32')]);_0x59ba5f[_0x5dbe('0x31')]=qs[_0x5dbe('0x31')](_0x2c9f0c['query'][_0x5dbe('0x31')]);}return _0x4c2864[_0x5dbe('0xa4')](_0x59ba5f);}})['then'](function(_0x9fccea){if(_0x9fccea){return _0x9fccea?{'count':_0x19eed9,'rows':_0x9fccea}:null;}})['then'](respondWithResult(_0x2e96f5,null))['catch'](handleError(_0x2e96f5,null));};exports['getInteractions']=function(_0x2807c1,_0x18cfed,_0x22ff1b){var _0x23aed5={'raw':![],'where':{}};var _0x59f177={};var _0x3cf793={'count':0x0,'rows':[]};return db[_0x5dbe('0x3f')][_0x5dbe('0x68')]({'where':{'id':_0x2807c1[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x18cfed,null))[_0x5dbe('0x23')](function(_0x6830e0){if(_0x6830e0){_0x59f177[_0x5dbe('0x44')]=_[_0x5dbe('0x45')](db['OpenchannelInteraction']['rawAttributes']);_0x59f177[_0x5dbe('0x48')]=_[_0x5dbe('0x45')](_0x2807c1['query']);_0x59f177[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0x59f177[_0x5dbe('0x44')],_0x59f177['query']);_0x23aed5[_0x5dbe('0x58')]=_[_0x5dbe('0x47')](_0x59f177['model'],qs[_0x5dbe('0x49')](_0x2807c1[_0x5dbe('0x48')][_0x5dbe('0x49')]));_0x23aed5[_0x5dbe('0x58')]=_0x23aed5[_0x5dbe('0x58')]['length']?_0x23aed5[_0x5dbe('0x58')]:_0x59f177['model'];if(!_0x2807c1[_0x5dbe('0x48')][_0x5dbe('0x69')]('nolimit')){_0x23aed5[_0x5dbe('0x32')]=qs[_0x5dbe('0x32')](_0x2807c1[_0x5dbe('0x48')][_0x5dbe('0x32')]);_0x23aed5[_0x5dbe('0x31')]=qs[_0x5dbe('0x31')](_0x2807c1[_0x5dbe('0x48')]['offset']);}_0x23aed5[_0x5dbe('0x4c')]=qs[_0x5dbe('0x4d')](_0x2807c1[_0x5dbe('0x48')]['sort']);_0x23aed5[_0x5dbe('0x4e')]=qs[_0x5dbe('0x46')](_[_0x5dbe('0xa5')](_0x2807c1[_0x5dbe('0x48')],_0x59f177[_0x5dbe('0x46')]));_0x23aed5[_0x5dbe('0x4e')][_0x5dbe('0x6a')]=_0x6830e0['id'];if(_0x2807c1[_0x5dbe('0x48')][_0x5dbe('0x4f')]){_0x23aed5['where']=_[_0x5dbe('0x50')](_0x23aed5['where'],{'$or':_['map'](_0x23aed5[_0x5dbe('0x58')],function(_0x1e1756){var _0x2551ba={};_0x2551ba[_0x1e1756]={'$like':'%'+_0x2807c1[_0x5dbe('0x48')][_0x5dbe('0x4f')]+'%'};return _0x2551ba;})});}_0x23aed5=_[_0x5dbe('0x50')]({},_0x23aed5,_0x2807c1[_0x5dbe('0x51')]);return db[_0x5dbe('0x8a')][_0x5dbe('0x52')]({'where':_0x23aed5[_0x5dbe('0x4e')]})[_0x5dbe('0x23')](function(_0x24748e){_0x3cf793['count']=_0x24748e;if(_0x2807c1[_0x5dbe('0x48')][_0x5dbe('0x53')]){_0x23aed5[_0x5dbe('0x54')]=[{'model':db[_0x5dbe('0x70')],'as':_0x5dbe('0xa6'),'required':![]},{'model':db[_0x5dbe('0x9a')],'as':_0x5dbe('0xa7'),'attributes':[_0x5dbe('0x3b'),_0x5dbe('0xa8'),_0x5dbe('0xa9')],'required':![]},{'model':db[_0x5dbe('0xaa')],'as':'Tags','attributes':['id',_0x5dbe('0x3b'),_0x5dbe('0xab')],'where':_0x2807c1['query']['tag']?{'id':_0x2807c1['query']['tag']}:undefined,'required':_0x2807c1[_0x5dbe('0x48')]['tag']?!![]:![]}];}return db[_0x5dbe('0x8a')]['findAll'](_0x23aed5);})[_0x5dbe('0x23')](function(_0x1c7a5a){_0x3cf793[_0x5dbe('0x55')]=_0x1c7a5a;return _0x3cf793;});}})['then'](respondWithFilteredResult(_0x18cfed,_0x23aed5))['catch'](handleError(_0x18cfed,null));};exports[_0x5dbe('0xac')]=function(_0x14e715,_0x1351d0,_0x3de572){return db[_0x5dbe('0x3f')][_0x5dbe('0x59')]({'where':{'id':_0x14e715[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x1351d0,null))[_0x5dbe('0x23')](function(_0x8b9477){if(_0x8b9477){return _0x8b9477[_0x5dbe('0xac')](_0x14e715[_0x5dbe('0x5b')][_0x5dbe('0xad')],_['omit'](_0x14e715[_0x5dbe('0x5b')],[_0x5dbe('0xad'),'id'])||{})[_0x5dbe('0x8d')](function(_0x1a8f20){for(var _0x38b88d=0x0;_0x38b88d<_0x14e715['body'][_0x5dbe('0xad')][_0x5dbe('0x4a')];_0x38b88d+=0x1){socket[_0x5dbe('0xae')](_0x5dbe('0xaf'),{'UserId':_0x14e715[_0x5dbe('0x5b')][_0x5dbe('0xad')][_0x38b88d],'OpenchannelAccountId':_0x14e715['params']['id']});}return _0x1a8f20;});}})[_0x5dbe('0x23')](respondWithResult(_0x1351d0,null))[_0x5dbe('0x56')](handleError(_0x1351d0,null));};exports[_0x5dbe('0xb0')]=function(_0x4d5627,_0x354f0a,_0x5cee9a){return db[_0x5dbe('0x3f')][_0x5dbe('0x59')]({'where':{'id':_0x4d5627[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x354f0a,null))[_0x5dbe('0x23')](function(_0x231c72){if(_0x231c72){return _0x231c72[_0x5dbe('0xb0')](_0x4d5627['query'][_0x5dbe('0xad')])[_0x5dbe('0x23')](function(){if(_[_0x5dbe('0xb1')](_0x4d5627['query'][_0x5dbe('0xad')])){for(var _0x2b6e96=0x0;_0x2b6e96<_0x4d5627[_0x5dbe('0x48')][_0x5dbe('0xad')]['length'];_0x2b6e96+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4d5627[_0x5dbe('0x48')][_0x5dbe('0xad')][_0x2b6e96]),'OpenchannelAccountId':Number(_0x4d5627[_0x5dbe('0x57')]['id'])});}}else{socket[_0x5dbe('0xae')](_0x5dbe('0xb2'),{'UserId':Number(_0x4d5627['query'][_0x5dbe('0xad')]),'OpenchannelAccountId':Number(_0x4d5627[_0x5dbe('0x57')]['id'])});}});}})[_0x5dbe('0x23')](respondWithStatusCode(_0x354f0a,null))[_0x5dbe('0x56')](handleError(_0x354f0a,null));};exports['getAgents']=function(_0x32e025,_0x13aec4,_0x97a82e){var _0x3077b2={};var _0x452d21={};var _0x3df385;var _0x1b6506;return db[_0x5dbe('0x3f')][_0x5dbe('0x68')]({'where':{'id':_0x32e025[_0x5dbe('0x57')]['id']}})[_0x5dbe('0x23')](handleEntityNotFound(_0x13aec4,null))['then'](function(_0x59f501){if(_0x59f501){_0x3df385=_0x59f501;_0x452d21[_0x5dbe('0x44')]=_[_0x5dbe('0x45')](db[_0x5dbe('0x9a')]['rawAttributes']);_0x452d21[_0x5dbe('0x48')]=_[_0x5dbe('0x45')](_0x32e025[_0x5dbe('0x48')]);_0x452d21[_0x5dbe('0x46')]=_[_0x5dbe('0x47')](_0x452d21[_0x5dbe('0x44')],_0x452d21[_0x5dbe('0x48')]);_0x3077b2[_0x5dbe('0x58')]=_[_0x5dbe('0x47')](_0x452d21[_0x5dbe('0x44')],qs['fields'](_0x32e025[_0x5dbe('0x48')]['fields']));_0x3077b2[_0x5dbe('0x58')]=_0x3077b2[_0x5dbe('0x58')][_0x5dbe('0x4a')]?_0x3077b2[_0x5dbe('0x58')]:_0x452d21[_0x5dbe('0x44')];_0x3077b2['order']=qs[_0x5dbe('0x4d')](_0x32e025[_0x5dbe('0x48')][_0x5dbe('0x4d')]);_0x3077b2[_0x5dbe('0x4e')]=qs[_0x5dbe('0x46')](_['pick'](_0x32e025[_0x5dbe('0x48')],_0x452d21[_0x5dbe('0x46')]));if(_0x32e025[_0x5dbe('0x48')][_0x5dbe('0x4f')]){_0x3077b2[_0x5dbe('0x4e')]=_[_0x5dbe('0x50')](_0x3077b2[_0x5dbe('0x4e')],{'$or':_[_0x5dbe('0x3e')](_0x3077b2['attributes'],function(_0x28c6d0){var _0x252d9f={};_0x252d9f[_0x28c6d0]={'$like':'%'+_0x32e025[_0x5dbe('0x48')][_0x5dbe('0x4f')]+'%'};return _0x252d9f;})});}_0x3077b2=_[_0x5dbe('0x50')]({},_0x3077b2,_0x32e025[_0x5dbe('0x51')]);return _0x3df385[_0x5dbe('0xb3')](_0x3077b2);}})[_0x5dbe('0x23')](function(_0x260298){if(_0x260298){_0x1b6506=_0x260298[_0x5dbe('0x4a')];if(!_0x32e025[_0x5dbe('0x48')]['hasOwnProperty'](_0x5dbe('0x4b'))){_0x3077b2[_0x5dbe('0x32')]=qs[_0x5dbe('0x32')](_0x32e025[_0x5dbe('0x48')]['limit']);_0x3077b2[_0x5dbe('0x31')]=qs[_0x5dbe('0x31')](_0x32e025['query'][_0x5dbe('0x31')]);}return _0x3df385['getAgents'](_0x3077b2);}})[_0x5dbe('0x23')](function(_0x31a4e7){if(_0x31a4e7){return _0x31a4e7?{'count':_0x1b6506,'rows':_0x31a4e7}:null;}})['then'](respondWithResult(_0x13aec4,null))[_0x5dbe('0x56')](handleError(_0x13aec4,null));};exports[_0x5dbe('0xb4')]=function(_0x4055fa,_0x4985bc,_0x1339e2){var _0x2924c2,_0x4c03d5,_0x3e087c;if(_[_0x5dbe('0x77')](_0x4055fa[_0x5dbe('0x5b')][_0x5dbe('0x5b')])||_0x4055fa[_0x5dbe('0x5b')][_0x5dbe('0x5b')]===''){throw new db[(_0x5dbe('0x20'))]['ValidationError'](_0x5dbe('0xb5'));}if(_[_0x5dbe('0x77')](_0x4055fa[_0x5dbe('0x5b')]['to'])){}_0x2924c2=_0x4055fa[_0x5dbe('0x5b')]['to'];return db[_0x5dbe('0x3f')]['findOne']({'where':{'id':_0x4055fa[_0x5dbe('0x57')]['id']}})['then'](handleEntityNotFound(_0x4985bc,null))[_0x5dbe('0x23')](function(_0x48fbd1){if(_0x48fbd1){return db[_0x5dbe('0x3f')]['find']({'where':{'id':_0x48fbd1['id']},'include':[{'model':db[_0x5dbe('0x7d')],'as':_0x5dbe('0x7e'),'include':[{'model':db['CmContact'],'as':_0x5dbe('0x86'),'where':{[_0x48fbd1[_0x5dbe('0x79')]]:_0x2924c2},'limit':0x1,'order':[[_0x5dbe('0x73'),_0x5dbe('0x7f')]]}]}]})['then'](handleEntityNotFound(_0x4985bc,null))[_0x5dbe('0x23')](function(_0x1724ae){if(_0x1724ae&&_0x1724ae[_0x5dbe('0x7e')]){_0x4c03d5=_0x1724ae['get']({'plain':!![]});if(_0x4c03d5[_0x5dbe('0x7e')]&&_0x4c03d5[_0x5dbe('0x7e')]['Contacts'][_0x5dbe('0x4a')]){return _0x4c03d5[_0x5dbe('0x7e')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x5dbe('0xb6')](_0x4055fa[_0x5dbe('0x5b')],{'firstName':_0x2924c2,[_0x1724ae[_0x5dbe('0x79')]]:_0x2924c2,'phone':_0x2924c2,'ListId':_0x4c03d5[_0x5dbe('0x76')]}));}})[_0x5dbe('0x23')](handleEntityNotFound(_0x4985bc,null))['then'](function(_0x29ceb1){if(_0x29ceb1){_0x3e087c=_0x29ceb1;return db[_0x5dbe('0x8a')][_0x5dbe('0x59')]({'where':{'ContactId':_0x3e087c['id'],'closed':![],'OpenchannelAccountId':_0x4c03d5['id']}})['then'](function(_0x2cbe94){if(_0x2cbe94){return[_0x2cbe94,![]];}return db[_0x5dbe('0x8a')][_0x5dbe('0x5a')]({'UserId':_0x4055fa[_0x5dbe('0x5c')]['id'],'ContactId':_0x3e087c['id'],'OpenchannelAccountId':_0x4c03d5['id'],'lastMsgDirection':'out','Messages':[_[_0x5dbe('0x50')](_0x4055fa[_0x5dbe('0x5b')],{'read':![],'body':_0x4055fa[_0x5dbe('0x5b')][_0x5dbe('0x5b')],'OpenchannelAccountId':_0x4c03d5['id'],'UserId':_0x4055fa[_0x5dbe('0x5c')]['id'],'ContactId':_0x3e087c['id']})]},{'include':[{'model':db[_0x5dbe('0x97')],'as':_0x5dbe('0xb7')}]})[_0x5dbe('0x23')](function(_0x2ebe7){return[_0x2ebe7,!![]];});});}})[_0x5dbe('0x8d')](function(_0x1fc257,_0x3d70ed){if(_0x3d70ed){return _0x1fc257;}return db[_0x5dbe('0x97')][_0x5dbe('0x5a')](_[_0x5dbe('0x50')](_0x4055fa[_0x5dbe('0x5b')],{'read':![],'body':_0x4055fa[_0x5dbe('0x5b')]['body'],'OpenchannelAccountId':_0x4c03d5['id'],'OpenchannelInteractionId':_0x1fc257['id'],'UserId':_0x4055fa[_0x5dbe('0x5c')]['id'],'ContactId':_0x3e087c['id']}))['then'](function(_0x551701){_0x1fc257[_0x5dbe('0xb8')][_0x5dbe('0xb7')]=[];_0x1fc257[_0x5dbe('0xb8')][_0x5dbe('0xb7')]['push'](_0x551701[_0x5dbe('0xb8')]);return _0x1fc257;});});}})[_0x5dbe('0x23')](respondWithResult(_0x4985bc,null))['catch'](handleError(_0x4985bc,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a697258..e0135a0 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 _0xd433=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd433,0xe2));var _0x3d43=function(_0x34c6d1,_0x5a42b0){_0x34c6d1=_0x34c6d1-0x0;var _0x922a38=_0xd433[_0x34c6d1];return _0x922a38;};'use strict';var EventEmitter=require(_0x3d43('0x0'));var OpenchannelAccount=require(_0x3d43('0x1'))['db'][_0x3d43('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3d43('0x3')](0x0);var events={'afterCreate':_0x3d43('0x4'),'afterUpdate':_0x3d43('0x5'),'afterDestroy':_0x3d43('0x6')};function emitEvent(_0x1f5e0e){return function(_0x1f3efc,_0x28fc39,_0x2a6fd5){OpenchannelAccountEvents[_0x3d43('0x7')](_0x1f5e0e+':'+_0x1f3efc['id'],_0x1f3efc);OpenchannelAccountEvents[_0x3d43('0x7')](_0x1f5e0e,_0x1f3efc);_0x2a6fd5(null);};}for(var e in events){if(events[_0x3d43('0x8')](e)){var event=events[e];OpenchannelAccount[_0x3d43('0x9')](e,emitEvent(event));}}module[_0x3d43('0xa')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0ef3=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ef3,0x86));var _0x30ef=function(_0x5f3309,_0x37871b){_0x5f3309=_0x5f3309-0x0;var _0xea65ec=_0x0ef3[_0x5f3309];return _0xea65ec;};'use strict';var EventEmitter=require(_0x30ef('0x0'));var OpenchannelAccount=require(_0x30ef('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x30ef('0x2'),'afterUpdate':_0x30ef('0x3'),'afterDestroy':_0x30ef('0x4')};function emitEvent(_0x4d446c){return function(_0x567299,_0x588f80,_0x38d356){OpenchannelAccountEvents['emit'](_0x4d446c+':'+_0x567299['id'],_0x567299);OpenchannelAccountEvents['emit'](_0x4d446c,_0x567299);_0x38d356(null);};}for(var e in events){if(events[_0x30ef('0x5')](e)){var event=events[e];OpenchannelAccount[_0x30ef('0x6')](e,emitEvent(event));}}module[_0x30ef('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b2894be..78f1755 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 _0x9ccf=['rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x3b11e0,_0x1bd26c){var _0x4bc5f8=function(_0xb03375){while(--_0xb03375){_0x3b11e0['push'](_0x3b11e0['shift']());}};_0x4bc5f8(++_0x1bd26c);}(_0x9ccf,0xbb));var _0xf9cc=function(_0x458959,_0x4cdf7a){_0x458959=_0x458959-0x0;var _0xde7ff6=_0x9ccf[_0x458959];return _0xde7ff6;};'use strict';var _=require(_0xf9cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf9cc('0x1'));var moment=require(_0xf9cc('0x2'));var BPromise=require(_0xf9cc('0x3'));var rp=require(_0xf9cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9cc('0x5'));var config=require(_0xf9cc('0x6'));var attributes=require(_0xf9cc('0x7'));module[_0xf9cc('0x8')]=function(_0x421e7d,_0x57e6f1){return _0x421e7d[_0xf9cc('0x9')](_0xf9cc('0xa'),attributes,{'tableName':_0xf9cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c91=['bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','OpenchannelAccount','openchannel_accounts','lodash','util','api'];(function(_0x3c34b4,_0x250dc1){var _0x12d7de=function(_0x31d195){while(--_0x31d195){_0x3c34b4['push'](_0x3c34b4['shift']());}};_0x12d7de(++_0x250dc1);}(_0x5c91,0xed));var _0x15c9=function(_0x116ada,_0x1e58ac){_0x116ada=_0x116ada-0x0;var _0x4d52ef=_0x5c91[_0x116ada];return _0x4d52ef;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var logger=require('../../config/logger')(_0x15c9('0x2'));var moment=require('moment');var BPromise=require(_0x15c9('0x3'));var rp=require(_0x15c9('0x4'));var fs=require('fs');var path=require(_0x15c9('0x5'));var rimraf=require(_0x15c9('0x6'));var config=require('../../config/environment');var attributes=require(_0x15c9('0x7'));module['exports']=function(_0x2930cb,_0x7c2403){return _0x2930cb['define'](_0x15c9('0x8'),attributes,{'tableName':_0x15c9('0x9'),'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 0edcc58..e5b70d6 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 _0xc69c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x46688a,_0x52b8d4){var _0x4b7d58=function(_0x385c0b){while(--_0x385c0b){_0x46688a['push'](_0x46688a['shift']());}};_0x4b7d58(++_0x52b8d4);}(_0xc69c,0x190));var _0xcc69=function(_0x226e5b,_0x4935ed){_0x226e5b=_0x226e5b-0x0;var _0x3c44d3=_0xc69c[_0x226e5b];return _0x3c44d3;};'use strict';var _=require(_0xcc69('0x0'));var util=require(_0xcc69('0x1'));var moment=require(_0xcc69('0x2'));var BPromise=require(_0xcc69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc69('0x4'))['db'];var utils=require(_0xcc69('0x5'));var logger=require(_0xcc69('0x6'))(_0xcc69('0x7'));var config=require(_0xcc69('0x8'));var jayson=require(_0xcc69('0x9'));var client=jayson[_0xcc69('0xa')]['http']({'port':0x232a});config['redis']=_[_0xcc69('0xb')](config[_0xcc69('0xc')],{'host':_0xcc69('0xd'),'port':0x18eb});var socket=require(_0xcc69('0xe'))(new Redis(config['redis']));require(_0xcc69('0xf'))[_0xcc69('0x10')](socket);function respondWithRpcPromise(_0x265c26,_0x254e7e,_0x317048){return new BPromise(function(_0x452523,_0x21980b){return client['request'](_0x265c26,_0x317048)['then'](function(_0x27aeeb){logger[_0xcc69('0x11')](_0xcc69('0x12'),_0x254e7e,_0xcc69('0x13'));logger[_0xcc69('0x14')](_0xcc69('0x15'),_0x254e7e,_0xcc69('0x13'),JSON[_0xcc69('0x16')](_0x27aeeb));if(_0x27aeeb[_0xcc69('0x17')]){if(_0x27aeeb['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x254e7e,_0x27aeeb['error'][_0xcc69('0x18')]);return _0x21980b(_0x27aeeb[_0xcc69('0x17')][_0xcc69('0x18')]);}logger[_0xcc69('0x17')](_0xcc69('0x12'),_0x254e7e,_0x27aeeb[_0xcc69('0x17')][_0xcc69('0x18')]);return _0x452523(_0x27aeeb[_0xcc69('0x17')]['message']);}else{logger[_0xcc69('0x11')](_0xcc69('0x12'),_0x254e7e,'request\x20sent');_0x452523(_0x27aeeb[_0xcc69('0x19')]['message']);}})[_0xcc69('0x1a')](function(_0x4dd351){logger[_0xcc69('0x17')](_0xcc69('0x12'),_0x254e7e,_0x4dd351);_0x21980b(_0x4dd351);});});} \ No newline at end of file +var _0xfb68=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','then','info'];(function(_0x3fbd6a,_0x49c430){var _0x4e6f60=function(_0x49e3d5){while(--_0x49e3d5){_0x3fbd6a['push'](_0x3fbd6a['shift']());}};_0x4e6f60(++_0x49c430);}(_0xfb68,0x95));var _0x8fb6=function(_0x2f8594,_0x13e4b8){_0x2f8594=_0x2f8594-0x0;var _0x23abd2=_0xfb68[_0x2f8594];return _0x23abd2;};'use strict';var _=require(_0x8fb6('0x0'));var util=require('util');var moment=require(_0x8fb6('0x1'));var BPromise=require(_0x8fb6('0x2'));var rs=require(_0x8fb6('0x3'));var fs=require('fs');var Redis=require(_0x8fb6('0x4'));var db=require(_0x8fb6('0x5'))['db'];var utils=require(_0x8fb6('0x6'));var logger=require(_0x8fb6('0x7'))(_0x8fb6('0x8'));var config=require('../../config/environment');var jayson=require(_0x8fb6('0x9'));var client=jayson[_0x8fb6('0xa')][_0x8fb6('0xb')]({'port':0x232a});config[_0x8fb6('0xc')]=_[_0x8fb6('0xd')](config[_0x8fb6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8fb6('0xe'))(new Redis(config[_0x8fb6('0xc')]));require(_0x8fb6('0xf'))[_0x8fb6('0x10')](socket);function respondWithRpcPromise(_0x2ed144,_0x5a2d46,_0x2890c4){return new BPromise(function(_0x229eca,_0x5d8bb7){return client['request'](_0x2ed144,_0x2890c4)[_0x8fb6('0x11')](function(_0x12949f){logger[_0x8fb6('0x12')](_0x8fb6('0x13'),_0x5a2d46,_0x8fb6('0x14'));logger[_0x8fb6('0x15')](_0x8fb6('0x16'),_0x5a2d46,_0x8fb6('0x14'),JSON[_0x8fb6('0x17')](_0x12949f));if(_0x12949f[_0x8fb6('0x18')]){if(_0x12949f[_0x8fb6('0x18')][_0x8fb6('0x19')]===0x1f4){logger['error'](_0x8fb6('0x13'),_0x5a2d46,_0x12949f['error'][_0x8fb6('0x1a')]);return _0x5d8bb7(_0x12949f['error'][_0x8fb6('0x1a')]);}logger[_0x8fb6('0x18')](_0x8fb6('0x13'),_0x5a2d46,_0x12949f[_0x8fb6('0x18')][_0x8fb6('0x1a')]);return _0x229eca(_0x12949f['error'][_0x8fb6('0x1a')]);}else{logger['info'](_0x8fb6('0x13'),_0x5a2d46,'request\x20sent');_0x229eca(_0x12949f['result']['message']);}})[_0x8fb6('0x1b')](function(_0x333805){logger[_0x8fb6('0x18')](_0x8fb6('0x13'),_0x5a2d46,_0x333805);_0x5d8bb7(_0x333805);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c7d4cbe..89a953d 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 _0x1a4d=['length','openchannelAccount:','update','emit','register'];(function(_0x5e2c70,_0x108e64){var _0x1e6cbc=function(_0x46e5fd){while(--_0x46e5fd){_0x5e2c70['push'](_0x5e2c70['shift']());}};_0x1e6cbc(++_0x108e64);}(_0x1a4d,0xc0));var _0xd1a4=function(_0xcc7ca9,_0x5a1bab){_0xcc7ca9=_0xcc7ca9-0x0;var _0x87a113=_0x1a4d[_0xcc7ca9];return _0x87a113;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0xd1a4('0x0')];function createListener(_0x285f64,_0x16db98){return function(_0x50c978){_0x16db98[_0xd1a4('0x1')](_0x285f64,_0x50c978);};}function removeListener(_0x39a591,_0x323f34){return function(){OpenchannelAccountEvents['removeListener'](_0x39a591,_0x323f34);};}exports[_0xd1a4('0x2')]=function(_0x40caf1){for(var _0x26e960=0x0,_0x187ba9=events[_0xd1a4('0x3')];_0x26e960<_0x187ba9;_0x26e960++){var _0x465eb1=events[_0x26e960];var _0x38505f=createListener(_0xd1a4('0x4')+_0x465eb1,_0x40caf1);OpenchannelAccountEvents['on'](_0x465eb1,_0x38505f);}}; \ No newline at end of file +var _0xef29=['removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x4043eb,_0x110b02){var _0x30139e=function(_0x550597){while(--_0x550597){_0x4043eb['push'](_0x4043eb['shift']());}};_0x30139e(++_0x110b02);}(_0xef29,0x1b3));var _0x9ef2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xef29[_0x4565bf];return _0x5610ba;};'use strict';var OpenchannelAccountEvents=require(_0x9ef2('0x0'));var events=[_0x9ef2('0x1'),_0x9ef2('0x2'),_0x9ef2('0x3')];function createListener(_0x3065b9,_0x536e41){return function(_0x464bec){_0x536e41[_0x9ef2('0x4')](_0x3065b9,_0x464bec);};}function removeListener(_0x1528b4,_0xc66d98){return function(){OpenchannelAccountEvents[_0x9ef2('0x5')](_0x1528b4,_0xc66d98);};}exports[_0x9ef2('0x6')]=function(_0x5b70de){for(var _0x18d1b3=0x0,_0x218ad4=events['length'];_0x18d1b3<_0x218ad4;_0x18d1b3++){var _0x287726=events[_0x18d1b3];var _0x2c447c=createListener(_0x9ef2('0x7')+_0x287726,_0x5b70de);OpenchannelAccountEvents['on'](_0x287726,_0x2c447c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a247365..c901f73 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 _0x3524=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x156faf,_0x1f46b4){var _0x39d899=function(_0x2baa8c){while(--_0x2baa8c){_0x156faf['push'](_0x156faf['shift']());}};_0x39d899(++_0x1f46b4);}(_0x3524,0x1c3));var _0x4352=function(_0x1b00d0,_0x265b67){_0x1b00d0=_0x1b00d0-0x0;var _0x31446c=_0x3524[_0x1b00d0];return _0x31446c;};'use strict';var multer=require(_0x4352('0x0'));var util=require(_0x4352('0x1'));var path=require(_0x4352('0x2'));var timeout=require(_0x4352('0x3'));var express=require(_0x4352('0x4'));var router=express[_0x4352('0x5')]();var auth=require(_0x4352('0x6'));var interaction=require(_0x4352('0x7'));var config=require(_0x4352('0x8'));var controller=require(_0x4352('0x9'));router[_0x4352('0xa')]('/',auth[_0x4352('0xb')](),controller[_0x4352('0xc')]);router[_0x4352('0xa')](_0x4352('0xd'),auth[_0x4352('0xb')](),controller[_0x4352('0xe')]);router['post']('/',auth[_0x4352('0xb')](),controller[_0x4352('0xf')]);router[_0x4352('0x10')](_0x4352('0xd'),auth[_0x4352('0xb')](),controller['update']);router['delete'](_0x4352('0xd'),auth[_0x4352('0xb')](),controller[_0x4352('0x11')]);module[_0x4352('0x12')]=router; \ No newline at end of file +var _0x116c=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x3c18e9,_0x29db38){var _0x377ca3=function(_0x7a6bcf){while(--_0x7a6bcf){_0x3c18e9['push'](_0x3c18e9['shift']());}};_0x377ca3(++_0x29db38);}(_0x116c,0x18e));var _0xc116=function(_0xc1e24e,_0x3867c5){_0xc1e24e=_0xc1e24e-0x0;var _0x1723b8=_0x116c[_0xc1e24e];return _0x1723b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc116('0x0'));var timeout=require(_0xc116('0x1'));var express=require(_0xc116('0x2'));var router=express[_0xc116('0x3')]();var auth=require(_0xc116('0x4'));var interaction=require(_0xc116('0x5'));var config=require(_0xc116('0x6'));var controller=require(_0xc116('0x7'));router[_0xc116('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc116('0x9'),auth[_0xc116('0xa')](),controller[_0xc116('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc116('0xc')]);router[_0xc116('0xd')](_0xc116('0x9'),auth[_0xc116('0xa')](),controller[_0xc116('0xe')]);router[_0xc116('0xf')](_0xc116('0x9'),auth['isAuthenticated'](),controller[_0xc116('0x10')]);module[_0xc116('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 16546e9..c967706 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 _0x027b=['noop','sequelize','INTEGER','STRING'];(function(_0x502d25,_0x5a7663){var _0x4d9ac0=function(_0x2378b3){while(--_0x2378b3){_0x502d25['push'](_0x502d25['shift']());}};_0x4d9ac0(++_0x5a7663);}(_0x027b,0xb9));var _0xb027=function(_0x439cda,_0x559bbb){_0x439cda=_0x439cda-0x0;var _0x226008=_0x027b[_0x439cda];return _0x226008;};'use strict';var Sequelize=require(_0xb027('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb027('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb027('0x2')],'allowNull':![],'defaultValue':_0xb027('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb027('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc65a=['sequelize','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x5b4acc,_0x3d714f){var _0x23a74f=function(_0x2daa5a){while(--_0x2daa5a){_0x5b4acc['push'](_0x5b4acc['shift']());}};_0x23a74f(++_0x3d714f);}(_0xc65a,0xfa));var _0xac65=function(_0x53562d,_0x495508){_0x53562d=_0x53562d-0x0;var _0x4018df=_0xc65a[_0x53562d];return _0x4018df;};'use strict';var Sequelize=require(_0xac65('0x0'));module['exports']={'priority':{'type':Sequelize[_0xac65('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xac65('0x2')]()},'description':{'type':Sequelize[_0xac65('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xac65('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 30842eb..f826d48 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 _0xa7d3=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','length','include','merge','find','catch','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel'];(function(_0x2336ea,_0x46e872){var _0x216bf9=function(_0x14a50d){while(--_0x14a50d){_0x2336ea['push'](_0x2336ea['shift']());}};_0x216bf9(++_0x46e872);}(_0xa7d3,0x7f));var _0x3a7d=function(_0x596e23,_0x3356e1){_0x596e23=_0x596e23-0x0;var _0x3fcb54=_0xa7d3[_0x596e23];return _0x3fcb54;};'use strict';var pdf=require(_0x3a7d('0x0'));var emlformat=require(_0x3a7d('0x1'));var rimraf=require(_0x3a7d('0x2'));var zipdir=require(_0x3a7d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a7d('0x4'));var moment=require(_0x3a7d('0x5'));var BPromise=require(_0x3a7d('0x6'));var Mustache=require('mustache');var util=require(_0x3a7d('0x7'));var path=require(_0x3a7d('0x8'));var sox=require(_0x3a7d('0x9'));var csv=require(_0x3a7d('0xa'));var ejs=require(_0x3a7d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3a7d('0xc'));var crypto=require('crypto');var jsforce=require(_0x3a7d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a7d('0xa'));var querystring=require(_0x3a7d('0xe'));var Papa=require(_0x3a7d('0xf'));var Redis=require('ioredis');var authService=require(_0x3a7d('0x10'));var qs=require(_0x3a7d('0x11'));var as=require(_0x3a7d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a7d('0x13'))('api');var utils=require(_0x3a7d('0x14'));var config=require(_0x3a7d('0x15'));var db=require(_0x3a7d('0x16'))['db'];function respondWithStatusCode(_0x50f8a0,_0x34b5e5){_0x34b5e5=_0x34b5e5||0xcc;return function(_0xe1e8df){if(_0xe1e8df){return _0x50f8a0['sendStatus'](_0x34b5e5);}return _0x50f8a0['status'](_0x34b5e5)[_0x3a7d('0x17')]();};}function respondWithResult(_0x3afdff,_0x1b7529){_0x1b7529=_0x1b7529||0xc8;return function(_0x4de369){if(_0x4de369){return _0x3afdff[_0x3a7d('0x18')](_0x1b7529)[_0x3a7d('0x19')](_0x4de369);}};}function respondWithFilteredResult(_0x5cb25f,_0x200036){return function(_0x508cb4){if(_0x508cb4){var _0x569e7c=_0x508cb4[_0x3a7d('0x1a')],_0x3ab87e=_0x200036[_0x3a7d('0x1b')],_0x3fe24a=_0x200036[_0x3a7d('0x1b')]+_0x200036[_0x3a7d('0x1c')],_0x216de7;if(_0x3fe24a>=_0x569e7c){_0x3fe24a=_0x569e7c;_0x216de7=0xc8;}else{_0x216de7=0xce;}_0x5cb25f[_0x3a7d('0x18')](_0x216de7);return _0x5cb25f['set']('Content-Range',_0x3ab87e+'-'+_0x3fe24a+'/'+_0x569e7c)['json'](_0x508cb4);}return null;};}function patchUpdates(_0x37da33){return function(_0x2eabba){try{jsonpatch[_0x3a7d('0x1d')](_0x2eabba,_0x37da33,!![]);}catch(_0x43bd9d){return BPromise[_0x3a7d('0x1e')](_0x43bd9d);}return _0x2eabba[_0x3a7d('0x1f')]();};}function saveUpdates(_0x1e1df5,_0x49c145){return function(_0xd131ea){if(_0xd131ea){return _0xd131ea[_0x3a7d('0x20')](_0x1e1df5)[_0x3a7d('0x21')](function(_0x35e06f){return _0x35e06f;});}return null;};}function removeEntity(_0x3ba4bc,_0x2a50bd){return function(_0xea6752){if(_0xea6752){return _0xea6752['destroy']()[_0x3a7d('0x21')](function(){_0x3ba4bc[_0x3a7d('0x18')](0xcc)[_0x3a7d('0x17')]();});}};}function handleEntityNotFound(_0x1d78bd,_0x4919e8){return function(_0x34b4ca){if(!_0x34b4ca){_0x1d78bd[_0x3a7d('0x22')](0x194);}return _0x34b4ca;};}function handleError(_0x5cd6c7,_0xa177ce){_0xa177ce=_0xa177ce||0x1f4;return function(_0x1fc94d){logger['error'](_0x1fc94d[_0x3a7d('0x23')]);if(_0x1fc94d['name']){delete _0x1fc94d[_0x3a7d('0x24')];}_0x5cd6c7['status'](_0xa177ce)[_0x3a7d('0x25')](_0x1fc94d);};}exports[_0x3a7d('0x26')]=function(_0x45c8db,_0x13c062){var _0x4c40bf={},_0x30cf52={},_0x2bebea={'count':0x0,'rows':[]};var _0x558b71=_[_0x3a7d('0x27')](db[_0x3a7d('0x28')][_0x3a7d('0x29')],function(_0x2d3ece){return{'name':_0x2d3ece['fieldName'],'type':_0x2d3ece[_0x3a7d('0x2a')][_0x3a7d('0x2b')]};});_0x30cf52['model']=_[_0x3a7d('0x27')](_0x558b71,_0x3a7d('0x24'));_0x30cf52[_0x3a7d('0x2c')]=_[_0x3a7d('0x2d')](_0x45c8db['query']);_0x30cf52['filters']=_[_0x3a7d('0x2e')](_0x30cf52[_0x3a7d('0x2f')],_0x30cf52[_0x3a7d('0x2c')]);_0x4c40bf[_0x3a7d('0x30')]=_[_0x3a7d('0x2e')](_0x30cf52[_0x3a7d('0x2f')],qs[_0x3a7d('0x31')](_0x45c8db['query'][_0x3a7d('0x31')]));_0x4c40bf[_0x3a7d('0x30')]=_0x4c40bf[_0x3a7d('0x30')]['length']?_0x4c40bf['attributes']:_0x30cf52['model'];if(!_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x32')](_0x3a7d('0x33'))){_0x4c40bf[_0x3a7d('0x1c')]=qs[_0x3a7d('0x1c')](_0x45c8db[_0x3a7d('0x2c')]['limit']);_0x4c40bf[_0x3a7d('0x1b')]=qs[_0x3a7d('0x1b')](_0x45c8db[_0x3a7d('0x2c')]['offset']);}_0x4c40bf[_0x3a7d('0x34')]=qs[_0x3a7d('0x35')](_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x35')]);_0x4c40bf[_0x3a7d('0x36')]=qs[_0x3a7d('0x37')](_[_0x3a7d('0x38')](_0x45c8db[_0x3a7d('0x2c')],_0x30cf52['filters']),_0x558b71);if(_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x39')]){_0x4c40bf[_0x3a7d('0x36')]=_['merge'](_0x4c40bf[_0x3a7d('0x36')],{'$or':_['map'](_0x558b71,function(_0x4ea943){if(_0x4ea943[_0x3a7d('0x2a')]!==_0x3a7d('0x3a')){var _0x2aa843={};_0x2aa843[_0x4ea943[_0x3a7d('0x24')]]={'$like':'%'+_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x39')]+'%'};return _0x2aa843;}})});}_0x4c40bf=_['merge']({},_0x4c40bf,_0x45c8db[_0x3a7d('0x3b')]);var _0x55a364={'where':_0x4c40bf[_0x3a7d('0x36')]};return db[_0x3a7d('0x28')][_0x3a7d('0x1a')](_0x55a364)[_0x3a7d('0x21')](function(_0x4eaa92){_0x2bebea[_0x3a7d('0x1a')]=_0x4eaa92;if(_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x3c')]){_0x4c40bf['include']=[{'all':!![]}];}return db[_0x3a7d('0x28')]['findAll'](_0x4c40bf);})['then'](function(_0x2c9c61){_0x2bebea['rows']=_0x2c9c61;return _0x2bebea;})[_0x3a7d('0x21')](respondWithFilteredResult(_0x13c062,_0x4c40bf))['catch'](handleError(_0x13c062,null));};exports['show']=function(_0x8883fd,_0x1fb2dc){var _0x41b221={'raw':!![],'where':{'id':_0x8883fd['params']['id']}},_0x41ae60={};_0x41ae60[_0x3a7d('0x2f')]=_['keys'](db['OpenchannelApplication'][_0x3a7d('0x29')]);_0x41ae60[_0x3a7d('0x2c')]=_[_0x3a7d('0x2d')](_0x8883fd[_0x3a7d('0x2c')]);_0x41ae60[_0x3a7d('0x37')]=_[_0x3a7d('0x2e')](_0x41ae60['model'],_0x41ae60[_0x3a7d('0x2c')]);_0x41b221['attributes']=_[_0x3a7d('0x2e')](_0x41ae60[_0x3a7d('0x2f')],qs[_0x3a7d('0x31')](_0x8883fd[_0x3a7d('0x2c')][_0x3a7d('0x31')]));_0x41b221[_0x3a7d('0x30')]=_0x41b221['attributes'][_0x3a7d('0x3d')]?_0x41b221['attributes']:_0x41ae60[_0x3a7d('0x2f')];if(_0x8883fd['query'][_0x3a7d('0x3c')]){_0x41b221[_0x3a7d('0x3e')]=[{'all':!![]}];}_0x41b221=_[_0x3a7d('0x3f')]({},_0x41b221,_0x8883fd[_0x3a7d('0x3b')]);return db[_0x3a7d('0x28')][_0x3a7d('0x40')](_0x41b221)[_0x3a7d('0x21')](handleEntityNotFound(_0x1fb2dc,null))[_0x3a7d('0x21')](respondWithResult(_0x1fb2dc,null))[_0x3a7d('0x41')](handleError(_0x1fb2dc,null));};exports['create']=function(_0x5094b1,_0x21c3ac){return db['OpenchannelApplication'][_0x3a7d('0x42')](_0x5094b1[_0x3a7d('0x43')],{})['then'](respondWithResult(_0x21c3ac,0xc9))[_0x3a7d('0x41')](handleError(_0x21c3ac,null));};exports[_0x3a7d('0x20')]=function(_0x14b5db,_0x35df60){if(_0x14b5db[_0x3a7d('0x43')]['id']){delete _0x14b5db[_0x3a7d('0x43')]['id'];}return db[_0x3a7d('0x28')][_0x3a7d('0x40')]({'where':{'id':_0x14b5db['params']['id']}})[_0x3a7d('0x21')](handleEntityNotFound(_0x35df60,null))[_0x3a7d('0x21')](saveUpdates(_0x14b5db['body'],null))[_0x3a7d('0x21')](respondWithResult(_0x35df60,null))['catch'](handleError(_0x35df60,null));};exports[_0x3a7d('0x44')]=function(_0x15aa7c,_0x1fe905){return db[_0x3a7d('0x28')]['find']({'where':{'id':_0x15aa7c[_0x3a7d('0x45')]['id']}})[_0x3a7d('0x21')](handleEntityNotFound(_0x1fe905,null))[_0x3a7d('0x21')](removeEntity(_0x1fe905,null))[_0x3a7d('0x41')](handleError(_0x1fe905,null));}; \ No newline at end of file +var _0x98af=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','map','VIRTUAL','count','includeAll','include','rows','catch','show','options','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98af,0x69));var _0xf98a=function(_0x3f4ba6,_0x35998a){_0x3f4ba6=_0x3f4ba6-0x0;var _0xb38f37=_0x98af[_0x3f4ba6];return _0xb38f37;};'use strict';var pdf=require(_0xf98a('0x0'));var emlformat=require(_0xf98a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf98a('0x2'));var jsonpatch=require(_0xf98a('0x3'));var rp=require('request-promise');var moment=require(_0xf98a('0x4'));var BPromise=require(_0xf98a('0x5'));var Mustache=require(_0xf98a('0x6'));var util=require(_0xf98a('0x7'));var path=require('path');var sox=require(_0xf98a('0x8'));var csv=require(_0xf98a('0x9'));var ejs=require(_0xf98a('0xa'));var fs=require('fs');var _=require(_0xf98a('0xb'));var squel=require(_0xf98a('0xc'));var crypto=require('crypto');var jsforce=require(_0xf98a('0xd'));var deskjs=require(_0xf98a('0xe'));var toCsv=require(_0xf98a('0x9'));var querystring=require(_0xf98a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf98a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf98a('0x11'));var hardwareService=require(_0xf98a('0x12'));var logger=require(_0xf98a('0x13'))(_0xf98a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf98a('0x15'))['db'];function respondWithStatusCode(_0xdb141,_0x1010bf){_0x1010bf=_0x1010bf||0xcc;return function(_0x14c068){if(_0x14c068){return _0xdb141[_0xf98a('0x16')](_0x1010bf);}return _0xdb141[_0xf98a('0x17')](_0x1010bf)['end']();};}function respondWithResult(_0x4dc9bf,_0x55e9d9){_0x55e9d9=_0x55e9d9||0xc8;return function(_0x10ec24){if(_0x10ec24){return _0x4dc9bf[_0xf98a('0x17')](_0x55e9d9)[_0xf98a('0x18')](_0x10ec24);}};}function respondWithFilteredResult(_0x39c2a2,_0x347548){return function(_0xa7b3bd){if(_0xa7b3bd){var _0x974d50=_0xa7b3bd['count'],_0x3c65f1=_0x347548[_0xf98a('0x19')],_0x2f5fb6=_0x347548[_0xf98a('0x19')]+_0x347548['limit'],_0x34a378;if(_0x2f5fb6>=_0x974d50){_0x2f5fb6=_0x974d50;_0x34a378=0xc8;}else{_0x34a378=0xce;}_0x39c2a2[_0xf98a('0x17')](_0x34a378);return _0x39c2a2[_0xf98a('0x1a')](_0xf98a('0x1b'),_0x3c65f1+'-'+_0x2f5fb6+'/'+_0x974d50)[_0xf98a('0x18')](_0xa7b3bd);}return null;};}function patchUpdates(_0x1a59ae){return function(_0x2eb65a){try{jsonpatch['apply'](_0x2eb65a,_0x1a59ae,!![]);}catch(_0x2ce178){return BPromise[_0xf98a('0x1c')](_0x2ce178);}return _0x2eb65a[_0xf98a('0x1d')]();};}function saveUpdates(_0x2aae7a,_0xd16368){return function(_0x467eb3){if(_0x467eb3){return _0x467eb3[_0xf98a('0x1e')](_0x2aae7a)[_0xf98a('0x1f')](function(_0x49a1af){return _0x49a1af;});}return null;};}function removeEntity(_0x4b74e7,_0x3e7527){return function(_0x68b966){if(_0x68b966){return _0x68b966[_0xf98a('0x20')]()[_0xf98a('0x1f')](function(){_0x4b74e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3f2f,_0x2da4ea){return function(_0x1ba281){if(!_0x1ba281){_0x2e3f2f[_0xf98a('0x16')](0x194);}return _0x1ba281;};}function handleError(_0x5577ce,_0x3fcfe2){_0x3fcfe2=_0x3fcfe2||0x1f4;return function(_0x33892a){logger[_0xf98a('0x21')](_0x33892a[_0xf98a('0x22')]);if(_0x33892a['name']){delete _0x33892a[_0xf98a('0x23')];}_0x5577ce[_0xf98a('0x17')](_0x3fcfe2)[_0xf98a('0x24')](_0x33892a);};}exports[_0xf98a('0x25')]=function(_0x1a2ada,_0x52cbcf){var _0x5937b2={},_0x147a04={},_0x25bd20={'count':0x0,'rows':[]};var _0x5a1b76=_['map'](db[_0xf98a('0x26')][_0xf98a('0x27')],function(_0x454b9e){return{'name':_0x454b9e[_0xf98a('0x28')],'type':_0x454b9e[_0xf98a('0x29')][_0xf98a('0x2a')]};});_0x147a04[_0xf98a('0x2b')]=_['map'](_0x5a1b76,'name');_0x147a04[_0xf98a('0x2c')]=_[_0xf98a('0x2d')](_0x1a2ada['query']);_0x147a04[_0xf98a('0x2e')]=_[_0xf98a('0x2f')](_0x147a04[_0xf98a('0x2b')],_0x147a04[_0xf98a('0x2c')]);_0x5937b2['attributes']=_[_0xf98a('0x2f')](_0x147a04[_0xf98a('0x2b')],qs[_0xf98a('0x30')](_0x1a2ada[_0xf98a('0x2c')][_0xf98a('0x30')]));_0x5937b2['attributes']=_0x5937b2['attributes'][_0xf98a('0x31')]?_0x5937b2[_0xf98a('0x32')]:_0x147a04['model'];if(!_0x1a2ada[_0xf98a('0x2c')][_0xf98a('0x33')](_0xf98a('0x34'))){_0x5937b2[_0xf98a('0x35')]=qs['limit'](_0x1a2ada[_0xf98a('0x2c')]['limit']);_0x5937b2[_0xf98a('0x19')]=qs[_0xf98a('0x19')](_0x1a2ada[_0xf98a('0x2c')][_0xf98a('0x19')]);}_0x5937b2['order']=qs[_0xf98a('0x36')](_0x1a2ada[_0xf98a('0x2c')][_0xf98a('0x36')]);_0x5937b2['where']=qs[_0xf98a('0x2e')](_[_0xf98a('0x37')](_0x1a2ada[_0xf98a('0x2c')],_0x147a04['filters']),_0x5a1b76);if(_0x1a2ada[_0xf98a('0x2c')][_0xf98a('0x38')]){_0x5937b2[_0xf98a('0x39')]=_[_0xf98a('0x3a')](_0x5937b2[_0xf98a('0x39')],{'$or':_[_0xf98a('0x3b')](_0x5a1b76,function(_0x408195){if(_0x408195[_0xf98a('0x29')]!==_0xf98a('0x3c')){var _0x2989ff={};_0x2989ff[_0x408195[_0xf98a('0x23')]]={'$like':'%'+_0x1a2ada['query'][_0xf98a('0x38')]+'%'};return _0x2989ff;}})});}_0x5937b2=_[_0xf98a('0x3a')]({},_0x5937b2,_0x1a2ada['options']);var _0xb37025={'where':_0x5937b2['where']};return db['OpenchannelApplication'][_0xf98a('0x3d')](_0xb37025)['then'](function(_0x14412d){_0x25bd20[_0xf98a('0x3d')]=_0x14412d;if(_0x1a2ada[_0xf98a('0x2c')][_0xf98a('0x3e')]){_0x5937b2[_0xf98a('0x3f')]=[{'all':!![]}];}return db[_0xf98a('0x26')]['findAll'](_0x5937b2);})[_0xf98a('0x1f')](function(_0x186ff2){_0x25bd20[_0xf98a('0x40')]=_0x186ff2;return _0x25bd20;})[_0xf98a('0x1f')](respondWithFilteredResult(_0x52cbcf,_0x5937b2))[_0xf98a('0x41')](handleError(_0x52cbcf,null));};exports[_0xf98a('0x42')]=function(_0x387652,_0x44049e){var _0x58ab08={'raw':!![],'where':{'id':_0x387652['params']['id']}},_0xe7688e={};_0xe7688e[_0xf98a('0x2b')]=_[_0xf98a('0x2d')](db[_0xf98a('0x26')]['rawAttributes']);_0xe7688e['query']=_[_0xf98a('0x2d')](_0x387652[_0xf98a('0x2c')]);_0xe7688e[_0xf98a('0x2e')]=_[_0xf98a('0x2f')](_0xe7688e[_0xf98a('0x2b')],_0xe7688e['query']);_0x58ab08['attributes']=_[_0xf98a('0x2f')](_0xe7688e[_0xf98a('0x2b')],qs[_0xf98a('0x30')](_0x387652[_0xf98a('0x2c')][_0xf98a('0x30')]));_0x58ab08[_0xf98a('0x32')]=_0x58ab08[_0xf98a('0x32')]['length']?_0x58ab08['attributes']:_0xe7688e['model'];if(_0x387652[_0xf98a('0x2c')][_0xf98a('0x3e')]){_0x58ab08['include']=[{'all':!![]}];}_0x58ab08=_[_0xf98a('0x3a')]({},_0x58ab08,_0x387652[_0xf98a('0x43')]);return db[_0xf98a('0x26')][_0xf98a('0x44')](_0x58ab08)[_0xf98a('0x1f')](handleEntityNotFound(_0x44049e,null))['then'](respondWithResult(_0x44049e,null))[_0xf98a('0x41')](handleError(_0x44049e,null));};exports[_0xf98a('0x45')]=function(_0x92d257,_0x1f55dd){return db[_0xf98a('0x26')]['create'](_0x92d257[_0xf98a('0x46')],{})[_0xf98a('0x1f')](respondWithResult(_0x1f55dd,0xc9))[_0xf98a('0x41')](handleError(_0x1f55dd,null));};exports[_0xf98a('0x1e')]=function(_0x52b0d1,_0xb7dc87){if(_0x52b0d1['body']['id']){delete _0x52b0d1[_0xf98a('0x46')]['id'];}return db[_0xf98a('0x26')][_0xf98a('0x44')]({'where':{'id':_0x52b0d1[_0xf98a('0x47')]['id']}})[_0xf98a('0x1f')](handleEntityNotFound(_0xb7dc87,null))[_0xf98a('0x1f')](saveUpdates(_0x52b0d1[_0xf98a('0x46')],null))[_0xf98a('0x1f')](respondWithResult(_0xb7dc87,null))[_0xf98a('0x41')](handleError(_0xb7dc87,null));};exports[_0xf98a('0x20')]=function(_0x4451b3,_0x69e206){return db[_0xf98a('0x26')][_0xf98a('0x44')]({'where':{'id':_0x4451b3['params']['id']}})['then'](handleEntityNotFound(_0x69e206,null))[_0xf98a('0x1f')](removeEntity(_0x69e206,null))[_0xf98a('0x41')](handleError(_0x69e206,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fac441b..9fbab57 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 _0x0322=['request-promise','path','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3f3fc3,_0x3f8c8a){var _0x519981=function(_0x30bcd7){while(--_0x30bcd7){_0x3f3fc3['push'](_0x3f3fc3['shift']());}};_0x519981(++_0x3f8c8a);}(_0x0322,0x70));var _0x2032=function(_0x4cee17,_0xda2b5){_0x4cee17=_0x4cee17-0x0;var _0x1d3b07=_0x0322[_0x4cee17];return _0x1d3b07;};'use strict';var _=require(_0x2032('0x0'));var util=require(_0x2032('0x1'));var logger=require(_0x2032('0x2'))(_0x2032('0x3'));var moment=require('moment');var BPromise=require(_0x2032('0x4'));var rp=require(_0x2032('0x5'));var fs=require('fs');var path=require(_0x2032('0x6'));var rimraf=require('rimraf');var config=require(_0x2032('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x34886e,_0x11c18a){return _0x34886e[_0x2032('0x8')](_0x2032('0x9'),attributes,{'tableName':_0x2032('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2032('0xb'),'collate':_0x2032('0xc')});}; \ No newline at end of file +var _0x19b7=['util','moment','path','rimraf','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x524e23,_0x1e2aa7){var _0x231413=function(_0x22ac35){while(--_0x22ac35){_0x524e23['push'](_0x524e23['shift']());}};_0x231413(++_0x1e2aa7);}(_0x19b7,0x104));var _0x719b=function(_0x454057,_0x503088){_0x454057=_0x454057-0x0;var _0x4ce245=_0x19b7[_0x454057];return _0x4ce245;};'use strict';var _=require('lodash');var util=require(_0x719b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x719b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x719b('0x2'));var rimraf=require(_0x719b('0x3'));var config=require(_0x719b('0x4'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x1ad2af,_0x479fef){return _0x1ad2af[_0x719b('0x5')](_0x719b('0x6'),attributes,{'tableName':_0x719b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x719b('0x8'),'collate':_0x719b('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ed5ef7e..15fc879 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(_0x5adb28,_0x503295){var _0x450bd9=function(_0x3eca17){while(--_0x3eca17){_0x5adb28['push'](_0x5adb28['shift']());}};_0x450bd9(++_0x503295);}(_0xb10b,0x12a));var _0xbb10=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xb10b[_0x419e17];return _0x1f2044;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x47da5b,_0x38d881){var _0x5e938e=function(_0x2b5989){while(--_0x2b5989){_0x47da5b['push'](_0x47da5b['shift']());}};_0x5e938e(++_0x38d881);}(_0xb10b,0x12a));var _0xbb10=function(_0x50c710,_0x504134){_0x50c710=_0x50c710-0x0;var _0x2d5f79=_0xb10b[_0x50c710];return _0x2d5f79;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3e03200..1f07250 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 _0xe485=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','post','addMessage','/:id/tags','openchannel','addTags','tracked','update','openchannelinteraction:destroy','destroy','delete','multer','util','path','connect-timeout'];(function(_0x2b0875,_0x21ff12){var _0xedb8d7=function(_0x33ebf6){while(--_0x33ebf6){_0x2b0875['push'](_0x2b0875['shift']());}};_0xedb8d7(++_0x21ff12);}(_0xe485,0xb9));var _0x5e48=function(_0x3515b7,_0x28602f){_0x3515b7=_0x3515b7-0x0;var _0x3a5230=_0xe485[_0x3515b7];return _0x3a5230;};'use strict';var multer=require(_0x5e48('0x0'));var util=require(_0x5e48('0x1'));var path=require(_0x5e48('0x2'));var timeout=require(_0x5e48('0x3'));var express=require(_0x5e48('0x4'));var router=express['Router']();var auth=require(_0x5e48('0x5'));var interaction=require(_0x5e48('0x6'));var config=require(_0x5e48('0x7'));var controller=require(_0x5e48('0x8'));router[_0x5e48('0x9')]('/',auth[_0x5e48('0xa')](),controller[_0x5e48('0xb')]);router[_0x5e48('0x9')](_0x5e48('0xc'),auth[_0x5e48('0xa')](),controller[_0x5e48('0xd')]);router[_0x5e48('0x9')](_0x5e48('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5e48('0x9')](_0x5e48('0xf'),auth[_0x5e48('0xa')](),controller['getMessages']);router[_0x5e48('0x9')](_0x5e48('0x10'),auth[_0x5e48('0xa')](),controller['download']);router[_0x5e48('0x11')]('/',auth[_0x5e48('0xa')](),controller['create']);router[_0x5e48('0x11')](_0x5e48('0xf'),auth[_0x5e48('0xa')](),controller[_0x5e48('0x12')]);router[_0x5e48('0x11')](_0x5e48('0x13'),auth[_0x5e48('0xa')](),interaction['tracked'](_0x5e48('0x14'),'openchannelinteraction:addtags'),controller[_0x5e48('0x15')]);router['put'](_0x5e48('0xe'),auth[_0x5e48('0xa')](),interaction[_0x5e48('0x16')](_0x5e48('0x14'),'openchannelinteraction:update'),controller[_0x5e48('0x17')]);router['delete']('/:id',auth[_0x5e48('0xa')](),interaction['tracked']('openchannel',_0x5e48('0x18')),controller[_0x5e48('0x19')]);router[_0x5e48('0x1a')](_0x5e48('0x13'),auth[_0x5e48('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x8bc8=['delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','getMessages','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy'];(function(_0xf7e58e,_0x2ab3f9){var _0x2f7103=function(_0x100363){while(--_0x100363){_0xf7e58e['push'](_0xf7e58e['shift']());}};_0x2f7103(++_0x2ab3f9);}(_0x8bc8,0x9e));var _0x88bc=function(_0x5bc4ca,_0x21f738){_0x5bc4ca=_0x5bc4ca-0x0;var _0x12bf3b=_0x8bc8[_0x5bc4ca];return _0x12bf3b;};'use strict';var multer=require('multer');var util=require(_0x88bc('0x0'));var path=require(_0x88bc('0x1'));var timeout=require(_0x88bc('0x2'));var express=require(_0x88bc('0x3'));var router=express[_0x88bc('0x4')]();var auth=require(_0x88bc('0x5'));var interaction=require(_0x88bc('0x6'));var config=require(_0x88bc('0x7'));var controller=require(_0x88bc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x88bc('0x9')](_0x88bc('0xa'),auth[_0x88bc('0xb')](),controller[_0x88bc('0xc')]);router[_0x88bc('0x9')]('/:id',auth[_0x88bc('0xb')](),controller['show']);router[_0x88bc('0x9')]('/:id/messages',auth[_0x88bc('0xb')](),controller[_0x88bc('0xd')]);router[_0x88bc('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x88bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x88bc('0xe')](_0x88bc('0xf'),auth[_0x88bc('0xb')](),controller[_0x88bc('0x10')]);router['post'](_0x88bc('0x11'),auth[_0x88bc('0xb')](),interaction[_0x88bc('0x12')](_0x88bc('0x13'),_0x88bc('0x14')),controller[_0x88bc('0x15')]);router[_0x88bc('0x16')](_0x88bc('0x17'),auth['isAuthenticated'](),interaction[_0x88bc('0x12')](_0x88bc('0x13'),_0x88bc('0x18')),controller[_0x88bc('0x19')]);router['delete'](_0x88bc('0x17'),auth['isAuthenticated'](),interaction[_0x88bc('0x12')](_0x88bc('0x13'),_0x88bc('0x1a')),controller[_0x88bc('0x1b')]);router[_0x88bc('0x1c')](_0x88bc('0x11'),auth[_0x88bc('0xb')](),controller[_0x88bc('0x1d')]);module[_0x88bc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4f26da3..03e8ff6 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 _0xd803=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3f46b0,_0x7a813a){var _0x2873fe=function(_0x46194c){while(--_0x46194c){_0x3f46b0['push'](_0x3f46b0['shift']());}};_0x2873fe(++_0x7a813a);}(_0xd803,0x188));var _0x3d80=function(_0x111b23,_0x3b34b2){_0x111b23=_0x111b23-0x0;var _0x54dd4c=_0xd803[_0x111b23];return _0x54dd4c;};'use strict';var Sequelize=require(_0x3d80('0x0'));module[_0x3d80('0x1')]={'closed':{'type':Sequelize[_0x3d80('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3d80('0x3')]},'disposition':{'type':Sequelize[_0x3d80('0x4')]},'note':{'type':Sequelize[_0x3d80('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x3d80('0x4')]},'lastMsgAt':{'type':Sequelize[_0x3d80('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3d80('0x5')]('in',_0x3d80('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3d80('0x4')]}}; \ No newline at end of file +var _0x0d72=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x59e008,_0x19cd68){var _0x5c1f5e=function(_0x2a55cf){while(--_0x2a55cf){_0x59e008['push'](_0x59e008['shift']());}};_0x5c1f5e(++_0x19cd68);}(_0x0d72,0x18a));var _0x20d7=function(_0x5438e1,_0x395fdf){_0x5438e1=_0x5438e1-0x0;var _0x47b297=_0x0d72[_0x5438e1];return _0x47b297;};'use strict';var Sequelize=require(_0x20d7('0x0'));module['exports']={'closed':{'type':Sequelize[_0x20d7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x20d7('0x2')]},'disposition':{'type':Sequelize[_0x20d7('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x20d7('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x20d7('0x3')]},'lastMsgAt':{'type':Sequelize[_0x20d7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x20d7('0x4')]('in',_0x20d7('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7f98ae8..e0654cd 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 _0x2e51=['count','offset','limit','Content-Range','json','save','update','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','then','catch','index','OpenchannelInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','select','field','color','tools_tags','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','start','some','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rawAttributes','include','merge','options','create','describe','addMessage','OpenchannelMessage','params','ids','omit','findOne','nolimit','format','includeAll','findAll','rows','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','unix','root','server','files','join','transcript-%d-%s.zip','User','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','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','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','out','renderFile','views','toFile','transcript-','download','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end'];(function(_0x47abc8,_0x14dd00){var _0x87cf98=function(_0x30a96a){while(--_0x30a96a){_0x47abc8['push'](_0x47abc8['shift']());}};_0x87cf98(++_0x14dd00);}(_0x2e51,0x1b9));var _0x12e5=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x2e51[_0x8a969d];return _0x1d8dc7;};'use strict';var pdf=require(_0x12e5('0x0'));var emlformat=require(_0x12e5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x12e5('0x2'));var jsonpatch=require(_0x12e5('0x3'));var rp=require(_0x12e5('0x4'));var moment=require(_0x12e5('0x5'));var BPromise=require(_0x12e5('0x6'));var Mustache=require(_0x12e5('0x7'));var util=require('util');var path=require(_0x12e5('0x8'));var sox=require('sox');var csv=require(_0x12e5('0x9'));var ejs=require(_0x12e5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12e5('0xb'));var crypto=require(_0x12e5('0xc'));var jsforce=require(_0x12e5('0xd'));var deskjs=require(_0x12e5('0xe'));var toCsv=require(_0x12e5('0x9'));var querystring=require('querystring');var Papa=require(_0x12e5('0xf'));var Redis=require(_0x12e5('0x10'));var authService=require(_0x12e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x12e5('0x12'));var hardwareService=require(_0x12e5('0x13'));var logger=require(_0x12e5('0x14'))('api');var utils=require(_0x12e5('0x15'));var config=require(_0x12e5('0x16'));var db=require(_0x12e5('0x17'))['db'];config['redis']=_[_0x12e5('0x18')](config[_0x12e5('0x19')],{'host':_0x12e5('0x1a'),'port':0x18eb});var socket=require(_0x12e5('0x1b'))(new Redis(config[_0x12e5('0x19')]));require(_0x12e5('0x1c'))[_0x12e5('0x1d')](socket);function respondWithStatusCode(_0xc39c4d,_0xb1ee43){_0xb1ee43=_0xb1ee43||0xcc;return function(_0x30b703){if(_0x30b703){return _0xc39c4d[_0x12e5('0x1e')](_0xb1ee43);}return _0xc39c4d[_0x12e5('0x1f')](_0xb1ee43)[_0x12e5('0x20')]();};}function respondWithResult(_0x2577de,_0x5ea564){_0x5ea564=_0x5ea564||0xc8;return function(_0x169342){if(_0x169342){return _0x2577de[_0x12e5('0x1f')](_0x5ea564)['json'](_0x169342);}};}function respondWithFilteredResult(_0xc81f52,_0x588891){return function(_0x2b0a00){if(_0x2b0a00){var _0x145283=_0x2b0a00[_0x12e5('0x21')],_0x5e4c52=_0x588891[_0x12e5('0x22')],_0x413f02=_0x588891['offset']+_0x588891[_0x12e5('0x23')],_0x450c4d;if(_0x413f02>=_0x145283){_0x413f02=_0x145283;_0x450c4d=0xc8;}else{_0x450c4d=0xce;}_0xc81f52['status'](_0x450c4d);return _0xc81f52['set'](_0x12e5('0x24'),_0x5e4c52+'-'+_0x413f02+'/'+_0x145283)[_0x12e5('0x25')](_0x2b0a00);}return null;};}function patchUpdates(_0x5208fe){return function(_0x39e1d2){try{jsonpatch['apply'](_0x39e1d2,_0x5208fe,!![]);}catch(_0x4a09ad){return BPromise['reject'](_0x4a09ad);}return _0x39e1d2[_0x12e5('0x26')]();};}function saveUpdates(_0x676021,_0x4f8196){return function(_0x58d9bd){if(_0x58d9bd){return _0x58d9bd[_0x12e5('0x27')](_0x676021)['then'](function(_0x32bbf7){return _0x32bbf7;});}return null;};}function removeEntity(_0x1f4cb2,_0x2217ba){return function(_0x2562b9){if(_0x2562b9){return _0x2562b9[_0x12e5('0x28')]()['then'](function(){_0x1f4cb2[_0x12e5('0x1f')](0xcc)[_0x12e5('0x20')]();});}};}function handleEntityNotFound(_0x574923,_0x44a8af){return function(_0x26b4ce){if(!_0x26b4ce){_0x574923['sendStatus'](0x194);}return _0x26b4ce;};}function handleError(_0x8f4efb,_0x1ee4b5){_0x1ee4b5=_0x1ee4b5||0x1f4;return function(_0x5c43f4){logger[_0x12e5('0x29')](_0x5c43f4[_0x12e5('0x2a')]);if(_0x5c43f4[_0x12e5('0x2b')]){delete _0x5c43f4[_0x12e5('0x2b')];}_0x8f4efb[_0x12e5('0x1f')](_0x1ee4b5)[_0x12e5('0x2c')](_0x5c43f4);};}function getInteractionUsers(_0x492677,_0x557a25){return new BPromise(function(_0x47867d,_0x16ea3d){try{if(_0x557a25[_0x492677['id']]){_0x492677[_0x12e5('0x2d')]=_[_0x12e5('0x2e')](_0x557a25[_0x492677['id']],function(_0x2c4484){return{'id':_0x2c4484['id'],'fullname':_0x2c4484[_0x12e5('0x2f')]};});}}catch(_0x3bcfb4){_0x16ea3d(_0x3bcfb4);}_0x47867d(_0x492677);});}function getInteractionTags(_0x4624ca,_0x20f35c){return new BPromise(function(_0x4744b4,_0x510cf6){try{if(_0x4624ca[_0x12e5('0x30')]){_0x4624ca[_0x12e5('0x31')]=[];_0x4624ca[_0x12e5('0x30')][_0x12e5('0x32')](',')[_0x12e5('0x33')](function(_0x586669){_0x4624ca[_0x12e5('0x31')][_0x12e5('0x34')](_0x20f35c[_0x586669]);});}delete _0x4624ca[_0x12e5('0x30')];}catch(_0x7fe51d){_0x510cf6(_0x7fe51d);}_0x4744b4(_0x4624ca);});}function updateOpenchannelInteraction(_0x550d62,_0x18e232,_0x10c0a9){return new BPromise(function(_0x3ce37c,_0x573fac){return getInteractionUsers(_0x550d62,_0x10c0a9)[_0x12e5('0x35')](function(_0x1834e1){return getInteractionTags(_0x1834e1,_0x18e232);})[_0x12e5('0x35')](function(_0x130934){_0x3ce37c(_0x130934);})[_0x12e5('0x36')](function(_0x310513){_0x573fac(_0x310513);});});}exports[_0x12e5('0x37')]=function(_0xfb4b98,_0x3d9ddf){var _0x5b82a0={},_0x530a48={},_0x486075={'count':0x0,'rows':[]};var _0x287936=_['map'](db[_0x12e5('0x38')]['rawAttributes'],function(_0x147b4e){return{'name':_0x147b4e[_0x12e5('0x39')],'type':_0x147b4e[_0x12e5('0x3a')][_0x12e5('0x3b')]};});_0x530a48[_0x12e5('0x3c')]=_[_0x12e5('0x2e')](_0x287936,_0x12e5('0x2b'));_0x530a48[_0x12e5('0x3d')]=_[_0x12e5('0x3e')](_0xfb4b98[_0x12e5('0x3d')]);_0x530a48[_0x12e5('0x3f')]=_[_0x12e5('0x40')](_0x530a48[_0x12e5('0x3c')],_0x530a48[_0x12e5('0x3d')]);_0x5b82a0[_0x12e5('0x41')]=_[_0x12e5('0x40')](_0x530a48[_0x12e5('0x3c')],qs[_0x12e5('0x42')](_0xfb4b98['query'][_0x12e5('0x42')]));_0x5b82a0[_0x12e5('0x41')]=_0x5b82a0[_0x12e5('0x41')][_0x12e5('0x43')]?_0x5b82a0['attributes']:_0x530a48['model'];if(!_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x44')]('nolimit')){_0x5b82a0[_0x12e5('0x23')]=qs[_0x12e5('0x23')](_0xfb4b98['query'][_0x12e5('0x23')]);_0x5b82a0['offset']=qs[_0x12e5('0x22')](_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x22')]);}_0x5b82a0[_0x12e5('0x45')]=qs[_0x12e5('0x46')](_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x46')]);_0x5b82a0['where']=qs[_0x12e5('0x3f')](_[_0x12e5('0x47')](_0xfb4b98[_0x12e5('0x3d')],_0x530a48[_0x12e5('0x3f')]),_0x287936);var _0x4a9937=[];var _0x3fb638=squel[_0x12e5('0x48')]()[_0x12e5('0x49')]('id')[_0x12e5('0x49')]('name')[_0x12e5('0x49')](_0x12e5('0x4a'))['from'](_0x12e5('0x4b'));var _0x24a400=squel[_0x12e5('0x48')]()[_0x12e5('0x49')]('u.id')[_0x12e5('0x49')](_0x12e5('0x4c'))[_0x12e5('0x49')]('ui.OpenchannelInteractionId')[_0x12e5('0x4d')]('user_has_openchannel_interactions','ui')[_0x12e5('0x4e')](_0x12e5('0x4f'),'u',_0x12e5('0x50'));var _0x3da4ed=squel[_0x12e5('0x48')]()['from'](_0x12e5('0x51'),'i')[_0x12e5('0x4e')](_0x12e5('0x52'),'c',_0x12e5('0x53'))[_0x12e5('0x4e')]('users','o',_0x12e5('0x54'))[_0x12e5('0x4e')](_0x12e5('0x55'),'a',_0x12e5('0x56'))[_0x12e5('0x4e')](_0x12e5('0x57'),'me',_0x12e5('0x58'))[_0x12e5('0x4e')]('openchannel_interaction_has_tags','it',_0x12e5('0x59'))['left_join'](_0x12e5('0x4b'),'t',_0x12e5('0x5a'));var _0x12eeee=squel['expr']();var _0x578046=[];var _0x5968a6=squel['expr']();var _0x463515;if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x5b')]){_0x463515=as[_0x12e5('0x5c')](_0xfb4b98['query']['search']);var _0x12b1ab=_0x463515[_0x12e5('0x5d')];for(var _0x298f70=0x0;_0x298f70<_0x463515['conditions']['length'];_0x298f70++){var _0x1d1ef2=_0x463515[_0x12e5('0x5e')][_0x298f70];var _0x34c9a5='i';var _0x363531=_['find'](_0x287936,['name',_0x1d1ef2[_0x12e5('0x49')]]);if(!_0x363531){switch(_0x1d1ef2['field']){case _0x12e5('0x5f'):if(_0x1d1ef2['value']==0x1){_0x3da4ed[_0x12e5('0x60')]('`'+_0x1d1ef2[_0x12e5('0x49')]+_0x12e5('0x61'));}else{_0x3da4ed[_0x12e5('0x60')]('`'+_0x1d1ef2['field']+_0x12e5('0x62'));}break;case _0x12e5('0x63'):if(_0x1d1ef2['operator']===_0x12e5('0x64')){if(_0x1d1ef2[_0x12e5('0x65')][_0x12e5('0x32')]('\x20')[_0x12e5('0x43')]>0x1){_0x12eeee[_0x12b1ab](_0x12e5('0x66'),qs['getFullTextValue'](_0x1d1ef2[_0x12e5('0x65')]),null);}else{var _0x47773d='%'+_0x1d1ef2[_0x12e5('0x65')]+'%';_0x12eeee[_0x12b1ab](_0x12e5('0x67'),_0x47773d,_0x47773d,_0x47773d);}}else{_0x363531=_[_0x12e5('0x68')](_0x287936,[_0x12e5('0x2b'),_0x12e5('0x69')]);_0x1d1ef2[_0x12e5('0x49')]=_0x12e5('0x69');_0xaf9093=as[_0x12e5('0x6a')](_0x34c9a5,_0x363531[_0x12e5('0x3a')],_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093['text'],_0xaf9093[_0x12e5('0x65')]['start'],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);}break;case _0x12e5('0x6b'):var _0x185842=_0x1d1ef2[_0x12e5('0x65')][_0x12e5('0x32')](',')[_0x12e5('0x2e')](function(_0x5570f3){return Number(_0x5570f3);});_0x185842['forEach'](function(_0x484b8f){_0x5968a6['or'](_0x12e5('0x6c'),'%,'+_0x484b8f+',%');});_0x578046=_[_0x12e5('0x6d')](_0x578046,_0x185842);break;case'User':if(_0x1d1ef2[_0x12e5('0x6e')]==='$substring'){_0x12eeee[_0x12b1ab](_0x12e5('0x6f'),'%'+_0x1d1ef2[_0x12e5('0x65')]+'%',null);}else{_0x363531=_[_0x12e5('0x68')](_0x287936,['name','UserId']);_0x1d1ef2['field']=_0x12e5('0x70');_0xaf9093=as[_0x12e5('0x6a')](_0x34c9a5,_0x363531[_0x12e5('0x3a')],_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093['text'],_0xaf9093['value']['start'],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);}break;case _0x12e5('0x71'):_0xaf9093=as[_0x12e5('0x6a')]('me',null,_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093[_0x12e5('0x72')],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x73')],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);break;}}else{var _0xaf9093=as[_0x12e5('0x6a')](_0x34c9a5,_0x363531[_0x12e5('0x3a')],_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093[_0x12e5('0x72')],_0xaf9093[_0x12e5('0x65')]['start'],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);}}}else{var _0x3136e1=_(_0xfb4b98[_0x12e5('0x3d')])[_0x12e5('0x3e')]()[_0x12e5('0x2e')](function(_0x25791d){return _[_0x12e5('0x74')](_0x287936,[_0x12e5('0x2b'),_0x25791d])?_0x25791d:undefined;})['compact']()[_0x12e5('0x65')]();if(!_[_0x12e5('0x75')](_0x3136e1)){_0x3136e1['forEach'](function(_0x5c21e2){if(_0x5c21e2==='OpenchannelAccountId'){_0x3da4ed[_0x12e5('0x76')](_0x12e5('0x77'),[][_0x12e5('0x78')](_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2]));}else if(_0x5c21e2===_0x12e5('0x79')){var _0x14fa4c=JSON['parse'](_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2])[_0x12e5('0x7a')];var _0x161604=JSON['parse'](_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2])[_0x12e5('0x7b')];_0x3da4ed[_0x12e5('0x76')](_0x12e5('0x7c'),_0x14fa4c,_0x161604);}else{if(_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2]===_0x12e5('0x7d')){_0x3da4ed[_0x12e5('0x76')]('i.'+_0x5c21e2+_0x12e5('0x7e'));}else{_0x3da4ed['where']('i.'+_0x5c21e2+'\x20=\x20?',_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2]);}}});}if(_0xfb4b98[_0x12e5('0x3d')]['read']){if(_0xfb4b98['query'][_0x12e5('0x7f')]==0x1){_0x3da4ed['having'](_0x12e5('0x80'));}else{_0x3da4ed[_0x12e5('0x60')](_0x12e5('0x81'));}}if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x82')]){_0x578046=_[_0x12e5('0x83')](_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x82')])?_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x82')]:new Array(_0xfb4b98['query'][_0x12e5('0x82')]);_0x578046[_0x12e5('0x33')](function(_0x58bae4){_0x5968a6['or'](_0x12e5('0x6c'),'%,'+_0x58bae4+',%');});}if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x84')]){var _0x46336e=_0xfb4b98[_0x12e5('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x12e5('0x85'));if(qs[_0x12e5('0x86')](_0x46336e)){_0x12eeee['or'](_0x12e5('0x87'),_0x46336e+'%');}else{_0x12eeee['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x12e5('0x88')](_0x46336e))['or']('i.from\x20LIKE\x20?',_0x46336e+'%')['or'](_0x12e5('0x89'),_0x46336e+'%');}}}_0x3da4ed[_0x12e5('0x76')](_0x12eeee);_0x3da4ed['group'](_0x12e5('0x8a'));var _0x430528={'type':db['Sequelize'][_0x12e5('0x8b')][_0x12e5('0x8c')],'raw':!![]};var _0x24a224=_0x3da4ed[_0x12e5('0x8d')]();_0x24a224['field'](_0x12e5('0x8a'));_0x24a224['field'](_0x12e5('0x8e'),_0x12e5('0x5f'));if(_0x5b82a0[_0x12e5('0x45')]){_0x5b82a0['order'][_0x12e5('0x33')](function(_0x375121){_0x3da4ed[_0x12e5('0x45')]('i.'+_0x375121[0x0],_0x375121[0x1]===_0x12e5('0x8f')?![]:!![]);});}if(!_[_0x12e5('0x75')](_0x578046)){_0x3da4ed['having'](_0x5968a6);_0x24a224[_0x12e5('0x76')](_0x12e5('0x90'),_0x578046);}BPromise[_0x12e5('0x91')]()[_0x12e5('0x35')](function(){if(!_0x463515){if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x92')]||_0xfb4b98[_0x12e5('0x3d')]['journey'])return;_0x24a224[_0x12e5('0x76')](_0x12e5('0x93'));_0x3da4ed['where'](_0x12e5('0x93'));return;}return _0xfb4b98[_0x12e5('0x94')][_0x12e5('0x95')]({'attributes':['id'],'raw':!![]})[_0x12e5('0x35')](function(_0x1d1c69){if(_['isEmpty'](_0x1d1c69)){_0x24a224['where'](_0x12e5('0x96'));_0x3da4ed['where'](_0x12e5('0x96'));}else{_0x24a224[_0x12e5('0x76')](_0x12e5('0x77'),_[_0x12e5('0x2e')](_0x1d1c69,'id'));_0x3da4ed[_0x12e5('0x76')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x12e5('0x2e')](_0x1d1c69,'id'));}});})[_0x12e5('0x35')](function(){db['sequelize'][_0x12e5('0x3d')](_0x24a224[_0x12e5('0x97')](),_0x430528)['then'](function(_0x3f7d23){_0x486075[_0x12e5('0x21')]=_0x3f7d23['length'];if(_0x486075['count']===0x0)return[];return db['sequelize'][_0x12e5('0x3d')](_0x3fb638[_0x12e5('0x97')](),_0x430528)['then'](function(_0x571351){_0x4a9937=_[_0x12e5('0x98')](_0x571351,'id');_0x430528=_['merge'](_0x430528,{'model':db[_0x12e5('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x42')]){_0x5b82a0[_0x12e5('0x41')]['forEach'](function(_0x5584e8){_0x3da4ed[_0x12e5('0x49')]('i.'+_0x5584e8);});}else{_0x3da4ed['field'](_0x12e5('0x8e'),'unreadMessages');_0x3da4ed[_0x12e5('0x49')](_0x12e5('0x99'),'Account.key');_0x3da4ed[_0x12e5('0x49')](_0x12e5('0x9a'),_0x12e5('0x9b'));_0x3da4ed['field']('i.*');_0x3da4ed[_0x12e5('0x49')]('c.firstName',_0x12e5('0x9c'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0x9d'),_0x12e5('0x9e'));_0x3da4ed['field'](_0x12e5('0x9f'),_0x12e5('0xa0'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa1'),_0x12e5('0xa2'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa3'),_0x12e5('0xa4'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa5'),'Contact.fax');_0x3da4ed['field'](_0x12e5('0xa6'),'Owner.fullname');_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa7'),_0x12e5('0xa8'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa9'),_0x12e5('0x30'));}if(_0x5b82a0[_0x12e5('0x23')])_0x3da4ed[_0x12e5('0x23')](_0x5b82a0['limit']);if(_0x5b82a0['offset'])_0x3da4ed[_0x12e5('0x22')](_0x5b82a0[_0x12e5('0x22')]);return db[_0x12e5('0xaa')][_0x12e5('0x3d')](_0x3da4ed['toString'](),_0x430528);})[_0x12e5('0x35')](function(_0x34bf65){_0x24a400[_0x12e5('0x76')](_0x12e5('0xab'),_['map'](_0x34bf65,'id'));return db[_0x12e5('0xaa')][_0x12e5('0x3d')](_0x24a400[_0x12e5('0x97')](),_0x430528)[_0x12e5('0x35')](function(_0x16f370){var _0x5a8875=_['groupBy'](_0x16f370,_0x12e5('0xac'));var _0x473cb1=[];_0x34bf65[_0x12e5('0x33')](function(_0x577fe7){_0x473cb1[_0x12e5('0x34')](updateOpenchannelInteraction(_0x577fe7,_0x4a9937,_0x5a8875));});return BPromise['all'](_0x473cb1);});});})[_0x12e5('0x35')](function(_0x1c03af){_0x486075['rows']=_0x1c03af;return _0x486075;})['then'](respondWithFilteredResult(_0x3d9ddf,_0x5b82a0));})[_0x12e5('0x36')](handleError(_0x3d9ddf,null));};exports['show']=function(_0x40788d,_0x1275aa){var _0x3bc077={'raw':![],'where':{'id':_0x40788d['params']['id']}},_0x53ced8={};_0x53ced8[_0x12e5('0x3c')]=_[_0x12e5('0x3e')](db[_0x12e5('0x38')][_0x12e5('0xad')]);_0x53ced8[_0x12e5('0x3d')]=_[_0x12e5('0x3e')](_0x40788d['query']);_0x53ced8[_0x12e5('0x3f')]=_[_0x12e5('0x40')](_0x53ced8[_0x12e5('0x3c')],_0x53ced8['query']);_0x3bc077[_0x12e5('0x41')]=_[_0x12e5('0x40')](_0x53ced8[_0x12e5('0x3c')],qs[_0x12e5('0x42')](_0x40788d[_0x12e5('0x3d')]['fields']));_0x3bc077['attributes']=_0x3bc077['attributes'][_0x12e5('0x43')]?_0x3bc077['attributes']:_0x53ced8['model'];if(_0x40788d['query']['includeAll']){_0x3bc077[_0x12e5('0xae')]=[{'all':!![]}];}_0x3bc077=_[_0x12e5('0xaf')]({},_0x3bc077,_0x40788d[_0x12e5('0xb0')]);return db[_0x12e5('0x38')][_0x12e5('0x68')](_0x3bc077)[_0x12e5('0x35')](handleEntityNotFound(_0x1275aa,null))[_0x12e5('0x35')](respondWithResult(_0x1275aa,null))[_0x12e5('0x36')](handleError(_0x1275aa,null));};exports[_0x12e5('0xb1')]=function(_0x5a2267,_0x890370){return db[_0x12e5('0x38')][_0x12e5('0xb1')](_0x5a2267[_0x12e5('0x71')],{})[_0x12e5('0x35')](respondWithResult(_0x890370,0xc9))[_0x12e5('0x36')](handleError(_0x890370,null));};exports['update']=function(_0x29628b,_0x57446b){if(_0x29628b['body']['id']){delete _0x29628b[_0x12e5('0x71')]['id'];}return db['OpenchannelInteraction'][_0x12e5('0x68')]({'where':{'id':_0x29628b['params']['id']}})['then'](handleEntityNotFound(_0x57446b,null))['then'](saveUpdates(_0x29628b[_0x12e5('0x71')],null))[_0x12e5('0x35')](respondWithResult(_0x57446b,null))[_0x12e5('0x36')](handleError(_0x57446b,null));};exports[_0x12e5('0x28')]=function(_0x47e7eb,_0x2c58f3){return db[_0x12e5('0x38')][_0x12e5('0x68')]({'where':{'id':_0x47e7eb['params']['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x2c58f3,null))[_0x12e5('0x35')](removeEntity(_0x2c58f3,null))[_0x12e5('0x36')](handleError(_0x2c58f3,null));};exports[_0x12e5('0xb2')]=function(_0x39cc71,_0x545f83){return db[_0x12e5('0x38')][_0x12e5('0xb2')]()['then'](respondWithResult(_0x545f83,null))[_0x12e5('0x36')](handleError(_0x545f83,null));};exports[_0x12e5('0xb3')]=function(_0x3647c7,_0x5072c0,_0x45c0bb){return db[_0x12e5('0xb4')][_0x12e5('0x68')]({'where':{'id':_0x3647c7[_0x12e5('0xb5')]['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x5072c0,null))[_0x12e5('0x35')](function(_0x10221a){if(_0x10221a){return _0x10221a['addMessage'](_0x3647c7['body'][_0x12e5('0xb6')],_[_0x12e5('0xb7')](_0x3647c7[_0x12e5('0x71')],[_0x12e5('0xb6'),'id'])||{});}})[_0x12e5('0x35')](respondWithResult(_0x5072c0,null))['catch'](handleError(_0x5072c0,null));};exports['getMessages']=function(_0x57b101,_0x706ca6,_0x5881dd){var _0x245848={'raw':![],'where':{}};var _0x518ee1={};var _0x1d6cff={'count':0x0,'rows':[]};return db[_0x12e5('0x38')][_0x12e5('0xb8')]({'where':{'id':_0x57b101['params']['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x706ca6,null))[_0x12e5('0x35')](function(_0x2be0ae){if(_0x2be0ae){_0x518ee1[_0x12e5('0x3c')]=_[_0x12e5('0x3e')](db[_0x12e5('0xb4')]['rawAttributes']);_0x518ee1[_0x12e5('0x3d')]=_[_0x12e5('0x3e')](_0x57b101[_0x12e5('0x3d')]);_0x518ee1['filters']=_[_0x12e5('0x40')](_0x518ee1[_0x12e5('0x3c')],_0x518ee1[_0x12e5('0x3d')]);_0x245848[_0x12e5('0x41')]=_[_0x12e5('0x40')](_0x518ee1[_0x12e5('0x3c')],qs['fields'](_0x57b101['query'][_0x12e5('0x42')]));_0x245848[_0x12e5('0x41')]=_0x245848[_0x12e5('0x41')][_0x12e5('0x43')]?_0x245848['attributes']:_0x518ee1[_0x12e5('0x3c')];if(!_0x57b101[_0x12e5('0x3d')][_0x12e5('0x44')](_0x12e5('0xb9'))){_0x245848[_0x12e5('0x23')]=qs[_0x12e5('0x23')](_0x57b101[_0x12e5('0x3d')][_0x12e5('0x23')]);_0x245848[_0x12e5('0x22')]=qs[_0x12e5('0x22')](_0x57b101[_0x12e5('0x3d')][_0x12e5('0x22')]);}_0x245848[_0x12e5('0x45')]=qs[_0x12e5('0x46')](_0x57b101['query'][_0x12e5('0x46')]);_0x245848[_0x12e5('0x76')]=qs[_0x12e5('0x3f')](_[_0x12e5('0x47')](_0x57b101[_0x12e5('0x3d')],_0x518ee1[_0x12e5('0x3f')]));_0x245848[_0x12e5('0x76')][_0x12e5('0xac')]=_0x2be0ae['id'];if(_0x57b101[_0x12e5('0x3d')][_0x12e5('0x84')]){_0x245848[_0x12e5('0x76')]=_['merge'](_0x245848[_0x12e5('0x76')],{'$or':_[_0x12e5('0x2e')](_0x245848['attributes'],function(_0x1b1965){var _0x573be2={};_0x573be2[_0x1b1965]={'$like':'%'+_0x57b101[_0x12e5('0x3d')]['filter']+'%'};return _0x573be2;})});}if(_0x57b101[_0x12e5('0x3d')][_0x12e5('0x7a')]){var _0x2768fa=_0x57b101[_0x12e5('0x3d')][_0x12e5('0x7a')][_0x12e5('0x32')](',');var _0x200de9={};_0x200de9[_0x2768fa[0x0]]={'$gte':moment(_0x2768fa[0x1])[_0x12e5('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x245848[_0x12e5('0x76')]=_[_0x12e5('0xaf')](_0x245848[_0x12e5('0x76')],_0x200de9);}_0x245848=_['merge']({},_0x245848,_0x57b101[_0x12e5('0xb0')]);return db['OpenchannelMessage'][_0x12e5('0x21')]({'where':_0x245848['where']})['then'](function(_0x3078e0){_0x1d6cff[_0x12e5('0x21')]=_0x3078e0;if(_0x57b101[_0x12e5('0x3d')][_0x12e5('0xbb')]){_0x245848['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x12e5('0xbc')](_0x245848);})[_0x12e5('0x35')](function(_0x4a65ad){_0x1d6cff[_0x12e5('0xbd')]=_0x4a65ad;return _0x1d6cff;});}})[_0x12e5('0x35')](respondWithFilteredResult(_0x706ca6,_0x245848))[_0x12e5('0x36')](handleError(_0x706ca6,null));};exports[_0x12e5('0xbe')]=function(_0xd73ee7,_0x59f235,_0x3bd871){return db[_0x12e5('0x38')][_0x12e5('0x68')]({'where':{'id':_0xd73ee7[_0x12e5('0xb5')]['id']}})['then'](handleEntityNotFound(_0x59f235,null))[_0x12e5('0x35')](function(_0x28073e){if(_0x28073e){return _0x28073e[_0x12e5('0xbf')](_0xd73ee7[_0x12e5('0x71')][_0x12e5('0xb6')],_[_0x12e5('0xb7')](_0xd73ee7['body'],['ids','id'])||{})[_0x12e5('0xc0')](function(){return db[_0x12e5('0x6b')][_0x12e5('0xbc')]({'attributes':['id',_0x12e5('0x2b'),'color'],'where':{'id':_0xd73ee7['body'][_0x12e5('0xb6')]}});})[_0x12e5('0x35')](function(_0x50d99e){socket['emit'](_0x12e5('0xc1'),{'id':Number(_0xd73ee7['params']['id']),'tags':_0x50d99e||[]});return{'id':Number(_0xd73ee7[_0x12e5('0xb5')]['id']),'tags':_0x50d99e||[]};});}})[_0x12e5('0x35')](respondWithResult(_0x59f235,null))['catch'](handleError(_0x59f235,null));};exports[_0x12e5('0xc2')]=function(_0x46ef24,_0x5a48fc,_0xdb9668){return db['OpenchannelInteraction'][_0x12e5('0x68')]({'where':{'id':_0x46ef24[_0x12e5('0xb5')]['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x5a48fc,null))['then'](function(_0x11685a){if(_0x11685a){return _0x11685a['removeTags'](_0x46ef24[_0x12e5('0x3d')][_0x12e5('0xb6')]);}})[_0x12e5('0x35')](respondWithStatusCode(_0x5a48fc,null))[_0x12e5('0x36')](handleError(_0x5a48fc,null));};exports['download']=function(_0x2742f7,_0x88a82c){var _0x293262=moment()[_0x12e5('0xc3')]()[_0x12e5('0x97')]();var _0x570457=path['join'](config[_0x12e5('0xc4')],_0x12e5('0xc5'),_0x12e5('0xc6'),'tmp');var _0xda8603=path[_0x12e5('0xc7')](config[_0x12e5('0xc4')],_0x12e5('0xc5'),_0x12e5('0xc6'),'attachments');var _0x5beb4c=path[_0x12e5('0xc7')](_0x570457,_0x293262);var _0x3eb6e5=util['format'](_0x12e5('0xc8'),_0x2742f7[_0x12e5('0xb5')]['id'],_0x293262);var _0x39ea54=path[_0x12e5('0xc7')](_0x570457,_0x3eb6e5);var _0x119eb7=[];_0x119eb7[_0x12e5('0x34')]({'model':db[_0x12e5('0xc9')],'as':'User','attributes':['id',_0x12e5('0x2f')],'raw':!![]});_0x119eb7['push']({'model':db['CmContact'],'as':_0x12e5('0x63'),'attributes':['id',_0x12e5('0xca'),_0x12e5('0xcb')],'raw':!![]});if(_0x2742f7[_0x12e5('0x3d')][_0x12e5('0xcc')]){_0x119eb7[_0x12e5('0x34')]({'model':db[_0x12e5('0xcd')],'as':_0x12e5('0xcd'),'raw':!![]});}var _0x5b8f03=[{'model':db[_0x12e5('0xb4')],'as':_0x12e5('0xce'),'attributes':['id',_0x12e5('0x71'),'createdAt',_0x12e5('0xcf'),_0x12e5('0xd0'),_0x12e5('0x7f')],'include':_0x119eb7}];_0x5b8f03[_0x12e5('0x34')]({'model':db['OpenchannelAccount'],'as':_0x12e5('0xd1'),'attributes':['id',_0x12e5('0x2b')]});_0x5b8f03['push']({'model':db[_0x12e5('0xc9')],'as':_0x12e5('0xd2'),'attributes':['id',_0x12e5('0x2f')]});return db[_0x12e5('0x38')][_0x12e5('0x68')]({'where':{'id':_0x2742f7['params']['id']},'include':_0x5b8f03})[_0x12e5('0x35')](handleEntityNotFound(_0x88a82c,null))[_0x12e5('0x35')](function(_0x2b69df){if(_0x2b69df){var _0x45de0d=_0x2b69df[_0x12e5('0xd3')]({'plain':!![]});fs[_0x12e5('0xd4')](_0x5beb4c);var _0x3beaf3={'format':'A4','border':_0x12e5('0xd5'),'header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x12e5('0xd6'),'contents':{'default':util[_0x12e5('0xba')](_0x12e5('0xd7'),util[_0x12e5('0xba')](_0x12e5('0xd8'),_0x12e5('0xd9'),_0x45de0d['id']),moment()[_0x12e5('0xba')]('YYYY-MM-DD')[_0x12e5('0x97')]())}}};var _0x575960={'channel':_0x12e5('0xd9'),'account':_0x45de0d[_0x12e5('0xd1')][_0x12e5('0x2b')],'agent':_0x45de0d['Owner']?_0x45de0d[_0x12e5('0xd2')][_0x12e5('0x2f')]:_0x12e5('0xda'),'createdAt':moment(_0x45de0d[_0x12e5('0x79')])['format'](_0x12e5('0xdb'))[_0x12e5('0x97')](),'closedAt':_0x45de0d[_0x12e5('0xdc')]?moment(_0x45de0d[_0x12e5('0xdd')])['format'](_0x12e5('0xdb'))[_0x12e5('0x97')]():'','disposition':_0x45de0d[_0x12e5('0xde')],'visibility':_0x45de0d[_0x12e5('0xdf')]?_0x12e5('0xe0'):'Private','messages':_(_0x45de0d[_0x12e5('0xce')])[_0x12e5('0x84')]({'secret':![]})['map'](function(_0x1b80a5){if(_0x1b80a5[_0x12e5('0xcd')]){var _0x35a3a0=path[_0x12e5('0xc7')](_0xda8603,_0x1b80a5[_0x12e5('0xcd')][_0x12e5('0xe1')]);if(fs[_0x12e5('0xe2')](_0x35a3a0)){fs[_0x12e5('0xe3')](_0x35a3a0)[_0x12e5('0xe4')](fs['createWriteStream'](path[_0x12e5('0xc7')](_0x5beb4c,_0x1b80a5[_0x12e5('0xcd')][_0x12e5('0xe1')])));}}return{'date':moment(_0x1b80a5['createdAt'])[_0x12e5('0xba')](_0x12e5('0xdb'))['toString'](),'sender':_0x1b80a5[_0x12e5('0xcf')]==='out'?_0x1b80a5[_0x12e5('0xc9')]?_0x1b80a5[_0x12e5('0xc9')][_0x12e5('0x2f')]:'System':_0x1b80a5['Contact']['firstName']+(_0x1b80a5[_0x12e5('0x63')][_0x12e5('0xcb')]?'\x20'+_0x1b80a5['Contact']['lastName']:''),'body':_0x1b80a5[_0x12e5('0xcd')]?_0x1b80a5[_0x12e5('0xcd')][_0x12e5('0xe1')]:_0x1b80a5[_0x12e5('0x71')],'direction':_0x1b80a5[_0x12e5('0xcf')]===_0x12e5('0xe5')?'A':'C','secret':_0x1b80a5[_0x12e5('0xd0')],'read':_0x1b80a5[_0x12e5('0x7f')],'attachment':_0x1b80a5['Attachment']};})[_0x12e5('0x65')]()};return ejs[_0x12e5('0xe6')](path['join'](config['root'],_0x12e5('0xc5'),_0x12e5('0xe7'),'downloadInteraction.html'),{'interaction':_0x575960})['then'](function(_0x44d120){return new BPromise(function(_0x172076,_0x5b3069){pdf[_0x12e5('0xb1')](_0x44d120,_0x3beaf3)[_0x12e5('0xe8')](path[_0x12e5('0xc7')](_0x5beb4c,_0x12e5('0xe9')+_0x45de0d['id']+'-'+_0x293262+'.pdf'),function(_0x285302,_0x2c651c){if(_0x285302)return _0x5b3069(_0x285302);_0x172076(_0x2c651c);});});})[_0x12e5('0x35')](function(){return new BPromise(function(_0x338813,_0x4cd970){zipdir(_0x5beb4c,{'saveTo':_0x39ea54},function(_0x3cda41,_0x28e009){if(_0x3cda41)return _0x4cd970(_0x3cda41);return _0x338813(_0x28e009);});})['then'](function(){return new BPromise(function(_0x277791,_0x2826c2){rimraf(_0x5beb4c,function(_0x236256){if(_0x236256)_0x2826c2(_0x236256);return _0x277791();});});})[_0x12e5('0x35')](function(){return _0x88a82c[_0x12e5('0xea')](_0x39ea54,_0x3eb6e5,function(_0x508918){if(_0x508918){console['log'](_0x12e5('0xeb'),_0x508918);}else{fs[_0x12e5('0xec')](_0x39ea54);}});});});}else{return _0x88a82c[_0x12e5('0x1e')](0xc8);}})[_0x12e5('0x36')](handleError(_0x88a82c,null));}; \ No newline at end of file +var _0xe44b=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','Users','map','Tags','TagIds','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','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)','find','ContactId','buildExpression','type','text','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','all','rows','show','includeAll','include','options','create','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','sort','OpenchannelInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','openchannelInteractionTags:save','download','unix','join','root','server','files','tmp','format','fullname','CmContact','firstName','attachments','Attachment','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','lastName','out','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x41bf78,_0x2d90f3){var _0x218c33=function(_0x5805d3){while(--_0x5805d3){_0x41bf78['push'](_0x41bf78['shift']());}};_0x218c33(++_0x2d90f3);}(_0xe44b,0xe9));var _0xbe44=function(_0x324271,_0x59e968){_0x324271=_0x324271-0x0;var _0x31ef5a=_0xe44b[_0x324271];return _0x31ef5a;};'use strict';var pdf=require(_0xbe44('0x0'));var emlformat=require(_0xbe44('0x1'));var rimraf=require(_0xbe44('0x2'));var zipdir=require(_0xbe44('0x3'));var jsonpatch=require(_0xbe44('0x4'));var rp=require(_0xbe44('0x5'));var moment=require(_0xbe44('0x6'));var BPromise=require(_0xbe44('0x7'));var Mustache=require(_0xbe44('0x8'));var util=require('util');var path=require(_0xbe44('0x9'));var sox=require(_0xbe44('0xa'));var csv=require(_0xbe44('0xb'));var ejs=require(_0xbe44('0xc'));var fs=require('fs');var _=require(_0xbe44('0xd'));var squel=require('squel');var crypto=require(_0xbe44('0xe'));var jsforce=require(_0xbe44('0xf'));var deskjs=require(_0xbe44('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbe44('0x11'));var Papa=require('papaparse');var Redis=require(_0xbe44('0x12'));var authService=require(_0xbe44('0x13'));var qs=require(_0xbe44('0x14'));var as=require(_0xbe44('0x15'));var hardwareService=require(_0xbe44('0x16'));var logger=require(_0xbe44('0x17'))('api');var utils=require(_0xbe44('0x18'));var config=require(_0xbe44('0x19'));var db=require(_0xbe44('0x1a'))['db'];config[_0xbe44('0x1b')]=_[_0xbe44('0x1c')](config[_0xbe44('0x1b')],{'host':_0xbe44('0x1d'),'port':0x18eb});var socket=require(_0xbe44('0x1e'))(new Redis(config[_0xbe44('0x1b')]));require(_0xbe44('0x1f'))[_0xbe44('0x20')](socket);function respondWithStatusCode(_0x49de74,_0x5a0414){_0x5a0414=_0x5a0414||0xcc;return function(_0x4c0310){if(_0x4c0310){return _0x49de74[_0xbe44('0x21')](_0x5a0414);}return _0x49de74[_0xbe44('0x22')](_0x5a0414)['end']();};}function respondWithResult(_0x2d339c,_0x4cfe85){_0x4cfe85=_0x4cfe85||0xc8;return function(_0x5e3351){if(_0x5e3351){return _0x2d339c[_0xbe44('0x22')](_0x4cfe85)[_0xbe44('0x23')](_0x5e3351);}};}function respondWithFilteredResult(_0x1810f6,_0x5e2056){return function(_0xd9fb25){if(_0xd9fb25){var _0x23ed85=_0xd9fb25[_0xbe44('0x24')],_0x1a6a9c=_0x5e2056[_0xbe44('0x25')],_0x436212=_0x5e2056['offset']+_0x5e2056[_0xbe44('0x26')],_0xf982ed;if(_0x436212>=_0x23ed85){_0x436212=_0x23ed85;_0xf982ed=0xc8;}else{_0xf982ed=0xce;}_0x1810f6[_0xbe44('0x22')](_0xf982ed);return _0x1810f6[_0xbe44('0x27')](_0xbe44('0x28'),_0x1a6a9c+'-'+_0x436212+'/'+_0x23ed85)[_0xbe44('0x23')](_0xd9fb25);}return null;};}function patchUpdates(_0x18b430){return function(_0x11e362){try{jsonpatch[_0xbe44('0x29')](_0x11e362,_0x18b430,!![]);}catch(_0x171c56){return BPromise[_0xbe44('0x2a')](_0x171c56);}return _0x11e362[_0xbe44('0x2b')]();};}function saveUpdates(_0x2fd49f,_0x2eaa28){return function(_0x3c5838){if(_0x3c5838){return _0x3c5838[_0xbe44('0x2c')](_0x2fd49f)[_0xbe44('0x2d')](function(_0x4c7fc3){return _0x4c7fc3;});}return null;};}function removeEntity(_0x4dc1e0,_0x2e9b81){return function(_0x4335d6){if(_0x4335d6){return _0x4335d6['destroy']()[_0xbe44('0x2d')](function(){_0x4dc1e0[_0xbe44('0x22')](0xcc)[_0xbe44('0x2e')]();});}};}function handleEntityNotFound(_0x383ecd,_0xcbde19){return function(_0x140d63){if(!_0x140d63){_0x383ecd[_0xbe44('0x21')](0x194);}return _0x140d63;};}function handleError(_0x272c25,_0x59551b){_0x59551b=_0x59551b||0x1f4;return function(_0x3540a3){logger[_0xbe44('0x2f')](_0x3540a3[_0xbe44('0x30')]);if(_0x3540a3[_0xbe44('0x31')]){delete _0x3540a3[_0xbe44('0x31')];}_0x272c25[_0xbe44('0x22')](_0x59551b)[_0xbe44('0x32')](_0x3540a3);};}function getInteractionUsers(_0x5a3029,_0xedfd53){return new BPromise(function(_0x464b84,_0x3304fc){try{if(_0xedfd53[_0x5a3029['id']]){_0x5a3029[_0xbe44('0x33')]=_[_0xbe44('0x34')](_0xedfd53[_0x5a3029['id']],function(_0x2ca7d6){return{'id':_0x2ca7d6['id'],'fullname':_0x2ca7d6['fullname']};});}}catch(_0x507fa5){_0x3304fc(_0x507fa5);}_0x464b84(_0x5a3029);});}function getInteractionTags(_0x15720a,_0x2d3572){return new BPromise(function(_0x52af21,_0x3abda2){try{if(_0x15720a['TagIds']){_0x15720a[_0xbe44('0x35')]=[];_0x15720a[_0xbe44('0x36')]['split'](',')[_0xbe44('0x37')](function(_0xbe145c){_0x15720a['Tags'][_0xbe44('0x38')](_0x2d3572[_0xbe145c]);});}delete _0x15720a['TagIds'];}catch(_0x51b7a8){_0x3abda2(_0x51b7a8);}_0x52af21(_0x15720a);});}function updateOpenchannelInteraction(_0x2e358f,_0x3ddfab,_0xd581b0){return new BPromise(function(_0x2cc481,_0x28462b){return getInteractionUsers(_0x2e358f,_0xd581b0)[_0xbe44('0x2d')](function(_0x7a1d97){return getInteractionTags(_0x7a1d97,_0x3ddfab);})['then'](function(_0x368169){_0x2cc481(_0x368169);})[_0xbe44('0x39')](function(_0x4f7caa){_0x28462b(_0x4f7caa);});});}exports[_0xbe44('0x3a')]=function(_0x1e034c,_0x2173b4){var _0x1cdb3d={},_0xac4c06={},_0x22d0a5={'count':0x0,'rows':[]};var _0x31f470=_['map'](db[_0xbe44('0x3b')][_0xbe44('0x3c')],function(_0x3fe49a){return{'name':_0x3fe49a[_0xbe44('0x3d')],'type':_0x3fe49a['type']['key']};});_0xac4c06[_0xbe44('0x3e')]=_['map'](_0x31f470,_0xbe44('0x31'));_0xac4c06[_0xbe44('0x3f')]=_[_0xbe44('0x40')](_0x1e034c['query']);_0xac4c06[_0xbe44('0x41')]=_[_0xbe44('0x42')](_0xac4c06[_0xbe44('0x3e')],_0xac4c06['query']);_0x1cdb3d['attributes']=_[_0xbe44('0x42')](_0xac4c06['model'],qs['fields'](_0x1e034c[_0xbe44('0x3f')]['fields']));_0x1cdb3d[_0xbe44('0x43')]=_0x1cdb3d[_0xbe44('0x43')][_0xbe44('0x44')]?_0x1cdb3d[_0xbe44('0x43')]:_0xac4c06[_0xbe44('0x3e')];if(!_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x45')](_0xbe44('0x46'))){_0x1cdb3d[_0xbe44('0x26')]=qs[_0xbe44('0x26')](_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x26')]);_0x1cdb3d[_0xbe44('0x25')]=qs['offset'](_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x25')]);}_0x1cdb3d[_0xbe44('0x47')]=qs['sort'](_0x1e034c[_0xbe44('0x3f')]['sort']);_0x1cdb3d[_0xbe44('0x48')]=qs[_0xbe44('0x41')](_[_0xbe44('0x49')](_0x1e034c[_0xbe44('0x3f')],_0xac4c06[_0xbe44('0x41')]),_0x31f470);var _0x1e2f44=[];var _0xf34482=squel[_0xbe44('0x4a')]()['field']('id')[_0xbe44('0x4b')](_0xbe44('0x31'))['field'](_0xbe44('0x4c'))[_0xbe44('0x4d')](_0xbe44('0x4e'));var _0x1be142=squel[_0xbe44('0x4a')]()[_0xbe44('0x4b')]('u.id')['field'](_0xbe44('0x4f'))[_0xbe44('0x4b')](_0xbe44('0x50'))[_0xbe44('0x4d')]('user_has_openchannel_interactions','ui')[_0xbe44('0x51')](_0xbe44('0x52'),'u',_0xbe44('0x53'));var _0x477e37=squel[_0xbe44('0x4a')]()[_0xbe44('0x4d')](_0xbe44('0x54'),'i')['left_join'](_0xbe44('0x55'),'c',_0xbe44('0x56'))[_0xbe44('0x51')](_0xbe44('0x52'),'o',_0xbe44('0x57'))[_0xbe44('0x51')]('openchannel_accounts','a',_0xbe44('0x58'))[_0xbe44('0x51')](_0xbe44('0x59'),'me',_0xbe44('0x5a'))[_0xbe44('0x51')](_0xbe44('0x5b'),'it',_0xbe44('0x5c'))[_0xbe44('0x51')](_0xbe44('0x4e'),'t',_0xbe44('0x5d'));var _0x444539=squel['expr']();var _0x5bd626=[];var _0x58ea3e=squel[_0xbe44('0x5e')]();var _0x20970f;if(_0x1e034c['query']['search']){_0x20970f=as[_0xbe44('0x5f')](_0x1e034c[_0xbe44('0x3f')]['search']);var _0x55dee6=_0x20970f[_0xbe44('0x60')];for(var _0x39c297=0x0;_0x39c297<_0x20970f[_0xbe44('0x61')]['length'];_0x39c297++){var _0x346ffb=_0x20970f[_0xbe44('0x61')][_0x39c297];var _0x1cc748='i';var _0x54fb89=_['find'](_0x31f470,[_0xbe44('0x31'),_0x346ffb['field']]);if(!_0x54fb89){switch(_0x346ffb['field']){case _0xbe44('0x62'):if(_0x346ffb[_0xbe44('0x63')]==0x1){_0x477e37[_0xbe44('0x64')]('`'+_0x346ffb[_0xbe44('0x4b')]+_0xbe44('0x65'));}else{_0x477e37[_0xbe44('0x64')]('`'+_0x346ffb[_0xbe44('0x4b')]+_0xbe44('0x66'));}break;case _0xbe44('0x67'):if(_0x346ffb[_0xbe44('0x68')]===_0xbe44('0x69')){if(_0x346ffb[_0xbe44('0x63')]['split']('\x20')[_0xbe44('0x44')]>0x1){_0x444539[_0x55dee6](_0xbe44('0x6a'),qs['getFullTextValue'](_0x346ffb[_0xbe44('0x63')]),null);}else{var _0x1b9d60='%'+_0x346ffb[_0xbe44('0x63')]+'%';_0x444539[_0x55dee6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b9d60,_0x1b9d60,_0x1b9d60);}}else{_0x54fb89=_[_0xbe44('0x6b')](_0x31f470,[_0xbe44('0x31'),_0xbe44('0x6c')]);_0x346ffb[_0xbe44('0x4b')]=_0xbe44('0x6c');_0x154300=as[_0xbe44('0x6d')](_0x1cc748,_0x54fb89[_0xbe44('0x6e')],_0x346ffb);_0x444539[_0x55dee6](_0x154300[_0xbe44('0x6f')],_0x154300[_0xbe44('0x63')]['start'],_0x154300[_0xbe44('0x63')][_0xbe44('0x2e')]);}break;case _0xbe44('0x70'):var _0x128c17=_0x346ffb['value'][_0xbe44('0x71')](',')['map'](function(_0x5e2414){return Number(_0x5e2414);});_0x128c17[_0xbe44('0x37')](function(_0x81f888){_0x58ea3e['or'](_0xbe44('0x72'),'%,'+_0x81f888+',%');});_0x5bd626=_[_0xbe44('0x73')](_0x5bd626,_0x128c17);break;case _0xbe44('0x74'):if(_0x346ffb[_0xbe44('0x68')]==='$substring'){_0x444539[_0x55dee6](_0xbe44('0x75'),'%'+_0x346ffb[_0xbe44('0x63')]+'%',null);}else{_0x54fb89=_[_0xbe44('0x6b')](_0x31f470,[_0xbe44('0x31'),_0xbe44('0x76')]);_0x346ffb[_0xbe44('0x4b')]=_0xbe44('0x76');_0x154300=as['buildExpression'](_0x1cc748,_0x54fb89[_0xbe44('0x6e')],_0x346ffb);_0x444539[_0x55dee6](_0x154300['text'],_0x154300[_0xbe44('0x63')][_0xbe44('0x77')],_0x154300['value'][_0xbe44('0x2e')]);}break;case _0xbe44('0x78'):_0x154300=as['buildExpression']('me',null,_0x346ffb);_0x444539[_0x55dee6](_0x154300['text'],_0x154300[_0xbe44('0x63')][_0xbe44('0x77')],_0x154300[_0xbe44('0x63')][_0xbe44('0x2e')]);break;}}else{var _0x154300=as[_0xbe44('0x6d')](_0x1cc748,_0x54fb89[_0xbe44('0x6e')],_0x346ffb);_0x444539[_0x55dee6](_0x154300[_0xbe44('0x6f')],_0x154300[_0xbe44('0x63')][_0xbe44('0x77')],_0x154300[_0xbe44('0x63')][_0xbe44('0x2e')]);}}}else{var _0x1eca6c=_(_0x1e034c[_0xbe44('0x3f')])[_0xbe44('0x40')]()[_0xbe44('0x34')](function(_0x281296){return _['some'](_0x31f470,[_0xbe44('0x31'),_0x281296])?_0x281296:undefined;})[_0xbe44('0x79')]()[_0xbe44('0x63')]();if(!_[_0xbe44('0x7a')](_0x1eca6c)){_0x1eca6c['forEach'](function(_0x5c818b){if(_0x5c818b===_0xbe44('0x7b')){_0x477e37[_0xbe44('0x48')](_0xbe44('0x7c'),[][_0xbe44('0x7d')](_0x1e034c[_0xbe44('0x3f')][_0x5c818b]));}else if(_0x5c818b===_0xbe44('0x7e')){var _0x51620d=JSON[_0xbe44('0x7f')](_0x1e034c[_0xbe44('0x3f')][_0x5c818b])['$gte'];var _0x2512df=JSON['parse'](_0x1e034c[_0xbe44('0x3f')][_0x5c818b])[_0xbe44('0x80')];_0x477e37[_0xbe44('0x48')](_0xbe44('0x81'),_0x51620d,_0x2512df);}else{if(_0x1e034c[_0xbe44('0x3f')][_0x5c818b]===_0xbe44('0x82')){_0x477e37['where']('i.'+_0x5c818b+_0xbe44('0x83'));}else{_0x477e37['where']('i.'+_0x5c818b+_0xbe44('0x84'),_0x1e034c['query'][_0x5c818b]);}}});}if(_0x1e034c['query'][_0xbe44('0x85')]){if(_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x85')]==0x1){_0x477e37['having'](_0xbe44('0x86'));}else{_0x477e37[_0xbe44('0x64')](_0xbe44('0x87'));}}if(_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x88')]){_0x5bd626=_[_0xbe44('0x89')](_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x88')])?_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x88')]:new Array(_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x88')]);_0x5bd626[_0xbe44('0x37')](function(_0x33b4f9){_0x58ea3e['or'](_0xbe44('0x72'),'%,'+_0x33b4f9+',%');});}if(_0x1e034c['query'][_0xbe44('0x8a')]){var _0x576c04=_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x8a')][_0xbe44('0x8b')]('\x5c','\x5c\x5c')[_0xbe44('0x8b')]('\x27\x27',_0xbe44('0x8c'));if(qs[_0xbe44('0x8d')](_0x576c04)){_0x444539['or'](_0xbe44('0x8e'),_0x576c04+'%');}else{_0x444539['or'](_0xbe44('0x8f'),qs[_0xbe44('0x90')](_0x576c04))['or']('i.from\x20LIKE\x20?',_0x576c04+'%')['or'](_0xbe44('0x91'),_0x576c04+'%');}}}_0x477e37[_0xbe44('0x48')](_0x444539);_0x477e37[_0xbe44('0x92')]('i.id');var _0x1e3d3d={'type':db[_0xbe44('0x93')][_0xbe44('0x94')][_0xbe44('0x95')],'raw':!![]};var _0x32df1d=_0x477e37[_0xbe44('0x96')]();_0x32df1d['field']('i.id');_0x32df1d[_0xbe44('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbe44('0x62'));if(_0x1cdb3d[_0xbe44('0x47')]){_0x1cdb3d[_0xbe44('0x47')][_0xbe44('0x37')](function(_0x41ff67){_0x477e37[_0xbe44('0x47')]('i.'+_0x41ff67[0x0],_0x41ff67[0x1]===_0xbe44('0x97')?![]:!![]);});}if(!_[_0xbe44('0x7a')](_0x5bd626)){_0x477e37[_0xbe44('0x64')](_0x58ea3e);_0x32df1d[_0xbe44('0x48')](_0xbe44('0x98'),_0x5bd626);}BPromise[_0xbe44('0x99')]()[_0xbe44('0x2d')](function(){if(!_0x20970f){if(_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x7b')]||_0x1e034c[_0xbe44('0x3f')][_0xbe44('0x9a')])return;_0x32df1d[_0xbe44('0x48')](_0xbe44('0x9b'));_0x477e37[_0xbe44('0x48')](_0xbe44('0x9b'));return;}return _0x1e034c[_0xbe44('0x9c')][_0xbe44('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ecfb9){if(_[_0xbe44('0x7a')](_0x3ecfb9)){_0x32df1d['where'](_0xbe44('0x9e'));_0x477e37[_0xbe44('0x48')](_0xbe44('0x9e'));}else{_0x32df1d['where'](_0xbe44('0x7c'),_[_0xbe44('0x34')](_0x3ecfb9,'id'));_0x477e37[_0xbe44('0x48')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xbe44('0x34')](_0x3ecfb9,'id'));}});})[_0xbe44('0x2d')](function(){db[_0xbe44('0x9f')][_0xbe44('0x3f')](_0x32df1d[_0xbe44('0xa0')](),_0x1e3d3d)[_0xbe44('0x2d')](function(_0x5d1605){_0x22d0a5[_0xbe44('0x24')]=_0x5d1605[_0xbe44('0x44')];if(_0x22d0a5[_0xbe44('0x24')]===0x0)return[];return db['sequelize']['query'](_0xf34482['toString'](),_0x1e3d3d)['then'](function(_0x3766ad){_0x1e2f44=_[_0xbe44('0xa1')](_0x3766ad,'id');_0x1e3d3d=_[_0xbe44('0xa2')](_0x1e3d3d,{'model':db[_0xbe44('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e034c[_0xbe44('0x3f')][_0xbe44('0xa3')]){_0x1cdb3d['attributes'][_0xbe44('0x37')](function(_0x523266){_0x477e37['field']('i.'+_0x523266);});}else{_0x477e37[_0xbe44('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbe44('0x62'));_0x477e37[_0xbe44('0x4b')](_0xbe44('0xa4'),_0xbe44('0xa5'));_0x477e37[_0xbe44('0x4b')](_0xbe44('0xa6'),_0xbe44('0xa7'));_0x477e37[_0xbe44('0x4b')]('i.*');_0x477e37['field'](_0xbe44('0xa8'),'Contact.firstName');_0x477e37[_0xbe44('0x4b')]('c.lastName','Contact.lastName');_0x477e37[_0xbe44('0x4b')](_0xbe44('0xa9'),_0xbe44('0xaa'));_0x477e37[_0xbe44('0x4b')](_0xbe44('0xab'),_0xbe44('0xac'));_0x477e37['field'](_0xbe44('0xad'),_0xbe44('0xae'));_0x477e37['field']('c.fax','Contact.fax');_0x477e37['field'](_0xbe44('0xaf'),_0xbe44('0xb0'));_0x477e37[_0xbe44('0x4b')](_0xbe44('0xb1'),_0xbe44('0xb2'));_0x477e37[_0xbe44('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbe44('0x36'));}if(_0x1cdb3d['limit'])_0x477e37[_0xbe44('0x26')](_0x1cdb3d['limit']);if(_0x1cdb3d['offset'])_0x477e37[_0xbe44('0x25')](_0x1cdb3d[_0xbe44('0x25')]);return db[_0xbe44('0x9f')][_0xbe44('0x3f')](_0x477e37[_0xbe44('0xa0')](),_0x1e3d3d);})[_0xbe44('0x2d')](function(_0x3ba0bb){_0x1be142[_0xbe44('0x48')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x3ba0bb,'id'));return db['sequelize'][_0xbe44('0x3f')](_0x1be142['toString'](),_0x1e3d3d)[_0xbe44('0x2d')](function(_0x393947){var _0x41dc4d=_['groupBy'](_0x393947,'OpenchannelInteractionId');var _0x48d921=[];_0x3ba0bb[_0xbe44('0x37')](function(_0x4ab353){_0x48d921[_0xbe44('0x38')](updateOpenchannelInteraction(_0x4ab353,_0x1e2f44,_0x41dc4d));});return BPromise[_0xbe44('0xb3')](_0x48d921);});});})[_0xbe44('0x2d')](function(_0x5d35d4){_0x22d0a5[_0xbe44('0xb4')]=_0x5d35d4;return _0x22d0a5;})[_0xbe44('0x2d')](respondWithFilteredResult(_0x2173b4,_0x1cdb3d));})[_0xbe44('0x39')](handleError(_0x2173b4,null));};exports[_0xbe44('0xb5')]=function(_0x32faf7,_0x2eabf3){var _0x4630b3={'raw':![],'where':{'id':_0x32faf7['params']['id']}},_0x29a7ce={};_0x29a7ce['model']=_[_0xbe44('0x40')](db[_0xbe44('0x3b')][_0xbe44('0x3c')]);_0x29a7ce['query']=_[_0xbe44('0x40')](_0x32faf7[_0xbe44('0x3f')]);_0x29a7ce[_0xbe44('0x41')]=_[_0xbe44('0x42')](_0x29a7ce[_0xbe44('0x3e')],_0x29a7ce[_0xbe44('0x3f')]);_0x4630b3[_0xbe44('0x43')]=_[_0xbe44('0x42')](_0x29a7ce['model'],qs[_0xbe44('0xa3')](_0x32faf7[_0xbe44('0x3f')][_0xbe44('0xa3')]));_0x4630b3[_0xbe44('0x43')]=_0x4630b3['attributes'][_0xbe44('0x44')]?_0x4630b3[_0xbe44('0x43')]:_0x29a7ce[_0xbe44('0x3e')];if(_0x32faf7['query'][_0xbe44('0xb6')]){_0x4630b3[_0xbe44('0xb7')]=[{'all':!![]}];}_0x4630b3=_[_0xbe44('0xa2')]({},_0x4630b3,_0x32faf7[_0xbe44('0xb8')]);return db[_0xbe44('0x3b')][_0xbe44('0x6b')](_0x4630b3)[_0xbe44('0x2d')](handleEntityNotFound(_0x2eabf3,null))[_0xbe44('0x2d')](respondWithResult(_0x2eabf3,null))['catch'](handleError(_0x2eabf3,null));};exports[_0xbe44('0xb9')]=function(_0x563a8e,_0x463b5c){return db[_0xbe44('0x3b')][_0xbe44('0xb9')](_0x563a8e['body'],{})[_0xbe44('0x2d')](respondWithResult(_0x463b5c,0xc9))[_0xbe44('0x39')](handleError(_0x463b5c,null));};exports[_0xbe44('0x2c')]=function(_0x171ef3,_0x429e72){if(_0x171ef3[_0xbe44('0x78')]['id']){delete _0x171ef3[_0xbe44('0x78')]['id'];}return db['OpenchannelInteraction'][_0xbe44('0x6b')]({'where':{'id':_0x171ef3[_0xbe44('0xba')]['id']}})[_0xbe44('0x2d')](handleEntityNotFound(_0x429e72,null))[_0xbe44('0x2d')](saveUpdates(_0x171ef3[_0xbe44('0x78')],null))[_0xbe44('0x2d')](respondWithResult(_0x429e72,null))[_0xbe44('0x39')](handleError(_0x429e72,null));};exports['destroy']=function(_0x103506,_0x847163){return db[_0xbe44('0x3b')][_0xbe44('0x6b')]({'where':{'id':_0x103506[_0xbe44('0xba')]['id']}})[_0xbe44('0x2d')](handleEntityNotFound(_0x847163,null))['then'](removeEntity(_0x847163,null))[_0xbe44('0x39')](handleError(_0x847163,null));};exports['describe']=function(_0x11080f,_0x3552fe){return db[_0xbe44('0x3b')][_0xbe44('0xbb')]()[_0xbe44('0x2d')](respondWithResult(_0x3552fe,null))[_0xbe44('0x39')](handleError(_0x3552fe,null));};exports[_0xbe44('0xbc')]=function(_0x3d40b0,_0x24556b,_0x22b384){return db[_0xbe44('0xbd')][_0xbe44('0x6b')]({'where':{'id':_0x3d40b0[_0xbe44('0xba')]['id']}})[_0xbe44('0x2d')](handleEntityNotFound(_0x24556b,null))[_0xbe44('0x2d')](function(_0x31eaa1){if(_0x31eaa1){return _0x31eaa1[_0xbe44('0xbc')](_0x3d40b0[_0xbe44('0x78')][_0xbe44('0xbe')],_[_0xbe44('0xbf')](_0x3d40b0[_0xbe44('0x78')],['ids','id'])||{});}})['then'](respondWithResult(_0x24556b,null))[_0xbe44('0x39')](handleError(_0x24556b,null));};exports[_0xbe44('0xc0')]=function(_0x32aee4,_0x4eb83c,_0x515aee){var _0x5b1217={'raw':![],'where':{}};var _0x37d9e8={};var _0x5c396b={'count':0x0,'rows':[]};return db[_0xbe44('0x3b')][_0xbe44('0xc1')]({'where':{'id':_0x32aee4['params']['id']}})['then'](handleEntityNotFound(_0x4eb83c,null))[_0xbe44('0x2d')](function(_0x279c0c){if(_0x279c0c){_0x37d9e8[_0xbe44('0x3e')]=_[_0xbe44('0x40')](db['OpenchannelMessage'][_0xbe44('0x3c')]);_0x37d9e8[_0xbe44('0x3f')]=_[_0xbe44('0x40')](_0x32aee4[_0xbe44('0x3f')]);_0x37d9e8[_0xbe44('0x41')]=_[_0xbe44('0x42')](_0x37d9e8[_0xbe44('0x3e')],_0x37d9e8[_0xbe44('0x3f')]);_0x5b1217[_0xbe44('0x43')]=_[_0xbe44('0x42')](_0x37d9e8[_0xbe44('0x3e')],qs[_0xbe44('0xa3')](_0x32aee4['query']['fields']));_0x5b1217[_0xbe44('0x43')]=_0x5b1217[_0xbe44('0x43')][_0xbe44('0x44')]?_0x5b1217[_0xbe44('0x43')]:_0x37d9e8[_0xbe44('0x3e')];if(!_0x32aee4[_0xbe44('0x3f')][_0xbe44('0x45')](_0xbe44('0x46'))){_0x5b1217[_0xbe44('0x26')]=qs[_0xbe44('0x26')](_0x32aee4['query']['limit']);_0x5b1217[_0xbe44('0x25')]=qs[_0xbe44('0x25')](_0x32aee4['query'][_0xbe44('0x25')]);}_0x5b1217[_0xbe44('0x47')]=qs[_0xbe44('0xc2')](_0x32aee4['query']['sort']);_0x5b1217[_0xbe44('0x48')]=qs[_0xbe44('0x41')](_['pick'](_0x32aee4[_0xbe44('0x3f')],_0x37d9e8['filters']));_0x5b1217[_0xbe44('0x48')][_0xbe44('0xc3')]=_0x279c0c['id'];if(_0x32aee4[_0xbe44('0x3f')][_0xbe44('0x8a')]){_0x5b1217[_0xbe44('0x48')]=_[_0xbe44('0xa2')](_0x5b1217[_0xbe44('0x48')],{'$or':_[_0xbe44('0x34')](_0x5b1217[_0xbe44('0x43')],function(_0x53e7af){var _0x91383e={};_0x91383e[_0x53e7af]={'$like':'%'+_0x32aee4[_0xbe44('0x3f')][_0xbe44('0x8a')]+'%'};return _0x91383e;})});}if(_0x32aee4['query'][_0xbe44('0xc4')]){var _0x1ce8db=_0x32aee4[_0xbe44('0x3f')][_0xbe44('0xc4')][_0xbe44('0x71')](',');var _0xeb871a={};_0xeb871a[_0x1ce8db[0x0]]={'$gte':moment(_0x1ce8db[0x1])['format'](_0xbe44('0xc5'))};_0x5b1217[_0xbe44('0x48')]=_[_0xbe44('0xa2')](_0x5b1217[_0xbe44('0x48')],_0xeb871a);}_0x5b1217=_['merge']({},_0x5b1217,_0x32aee4[_0xbe44('0xb8')]);return db['OpenchannelMessage']['count']({'where':_0x5b1217[_0xbe44('0x48')]})['then'](function(_0x4393d3){_0x5c396b[_0xbe44('0x24')]=_0x4393d3;if(_0x32aee4[_0xbe44('0x3f')]['includeAll']){_0x5b1217['include']=[{'all':!![]}];}return db[_0xbe44('0xbd')][_0xbe44('0xc6')](_0x5b1217);})['then'](function(_0x288a9c){_0x5c396b[_0xbe44('0xb4')]=_0x288a9c;return _0x5c396b;});}})['then'](respondWithFilteredResult(_0x4eb83c,_0x5b1217))['catch'](handleError(_0x4eb83c,null));};exports['addTags']=function(_0x572f82,_0x3a0104,_0x39d8ac){return db['OpenchannelInteraction'][_0xbe44('0x6b')]({'where':{'id':_0x572f82[_0xbe44('0xba')]['id']}})[_0xbe44('0x2d')](handleEntityNotFound(_0x3a0104,null))[_0xbe44('0x2d')](function(_0x3a6618){if(_0x3a6618){return _0x3a6618[_0xbe44('0xc7')](_0x572f82[_0xbe44('0x78')]['ids'],_[_0xbe44('0xbf')](_0x572f82[_0xbe44('0x78')],[_0xbe44('0xbe'),'id'])||{})['spread'](function(){return db[_0xbe44('0x70')][_0xbe44('0xc6')]({'attributes':['id',_0xbe44('0x31'),'color'],'where':{'id':_0x572f82[_0xbe44('0x78')]['ids']}});})[_0xbe44('0x2d')](function(_0x61ba25){socket['emit'](_0xbe44('0xc8'),{'id':Number(_0x572f82[_0xbe44('0xba')]['id']),'tags':_0x61ba25||[]});return{'id':Number(_0x572f82['params']['id']),'tags':_0x61ba25||[]};});}})[_0xbe44('0x2d')](respondWithResult(_0x3a0104,null))[_0xbe44('0x39')](handleError(_0x3a0104,null));};exports['removeTags']=function(_0xc433ea,_0x656043,_0x429543){return db[_0xbe44('0x3b')][_0xbe44('0x6b')]({'where':{'id':_0xc433ea[_0xbe44('0xba')]['id']}})['then'](handleEntityNotFound(_0x656043,null))[_0xbe44('0x2d')](function(_0x284254){if(_0x284254){return _0x284254['removeTags'](_0xc433ea['query'][_0xbe44('0xbe')]);}})[_0xbe44('0x2d')](respondWithStatusCode(_0x656043,null))[_0xbe44('0x39')](handleError(_0x656043,null));};exports[_0xbe44('0xc9')]=function(_0x4ba7d2,_0x49a1c8){var _0x32f8fb=moment()[_0xbe44('0xca')]()['toString']();var _0x3483c3=path[_0xbe44('0xcb')](config[_0xbe44('0xcc')],_0xbe44('0xcd'),_0xbe44('0xce'),_0xbe44('0xcf'));var _0x4b7340=path[_0xbe44('0xcb')](config[_0xbe44('0xcc')],_0xbe44('0xcd'),_0xbe44('0xce'),'attachments');var _0x37474f=path[_0xbe44('0xcb')](_0x3483c3,_0x32f8fb);var _0x1cf52e=util[_0xbe44('0xd0')]('transcript-%d-%s.zip',_0x4ba7d2['params']['id'],_0x32f8fb);var _0x196cfd=path[_0xbe44('0xcb')](_0x3483c3,_0x1cf52e);var _0x48f2bf=[];_0x48f2bf[_0xbe44('0x38')]({'model':db['User'],'as':_0xbe44('0x74'),'attributes':['id',_0xbe44('0xd1')],'raw':!![]});_0x48f2bf[_0xbe44('0x38')]({'model':db[_0xbe44('0xd2')],'as':_0xbe44('0x67'),'attributes':['id',_0xbe44('0xd3'),'lastName'],'raw':!![]});if(_0x4ba7d2[_0xbe44('0x3f')][_0xbe44('0xd4')]){_0x48f2bf[_0xbe44('0x38')]({'model':db[_0xbe44('0xd5')],'as':_0xbe44('0xd5'),'raw':!![]});}var _0x590f08=[{'model':db[_0xbe44('0xbd')],'as':'Messages','attributes':['id',_0xbe44('0x78'),_0xbe44('0x7e'),_0xbe44('0xd6'),_0xbe44('0xd7'),_0xbe44('0x85')],'include':_0x48f2bf}];_0x590f08[_0xbe44('0x38')]({'model':db[_0xbe44('0xd8')],'as':_0xbe44('0xd9'),'attributes':['id',_0xbe44('0x31')]});_0x590f08[_0xbe44('0x38')]({'model':db['User'],'as':_0xbe44('0xda'),'attributes':['id','fullname']});return db[_0xbe44('0x3b')][_0xbe44('0x6b')]({'where':{'id':_0x4ba7d2['params']['id']},'include':_0x590f08})[_0xbe44('0x2d')](handleEntityNotFound(_0x49a1c8,null))[_0xbe44('0x2d')](function(_0x3fde26){if(_0x3fde26){var _0x26095e=_0x3fde26['get']({'plain':!![]});fs[_0xbe44('0xdb')](_0x37474f);var _0x20e54a={'format':'A4','border':_0xbe44('0xdc'),'header':{'height':_0xbe44('0xdd'),'contents':{'first':_0xbe44('0xde')}},'footer':{'height':_0xbe44('0xdf'),'contents':{'default':util[_0xbe44('0xd0')](_0xbe44('0xe0'),util[_0xbe44('0xd0')](_0xbe44('0xe1'),_0xbe44('0xe2'),_0x26095e['id']),moment()[_0xbe44('0xd0')](_0xbe44('0xe3'))['toString']())}}};var _0x5d7166={'channel':'Openchannel','account':_0x26095e['Account'][_0xbe44('0x31')],'agent':_0x26095e[_0xbe44('0xda')]?_0x26095e['Owner'][_0xbe44('0xd1')]:_0xbe44('0xe4'),'createdAt':moment(_0x26095e[_0xbe44('0x7e')])[_0xbe44('0xd0')](_0xbe44('0xc5'))['toString'](),'closedAt':_0x26095e[_0xbe44('0xe5')]?moment(_0x26095e[_0xbe44('0xe6')])[_0xbe44('0xd0')](_0xbe44('0xc5'))['toString']():'','disposition':_0x26095e['disposition'],'visibility':_0x26095e[_0xbe44('0xe7')]?_0xbe44('0xe8'):_0xbe44('0xe9'),'messages':_(_0x26095e['Messages'])[_0xbe44('0x8a')]({'secret':![]})[_0xbe44('0x34')](function(_0x4fb348){if(_0x4fb348[_0xbe44('0xd5')]){var _0x533082=path[_0xbe44('0xcb')](_0x4b7340,_0x4fb348['Attachment']['basename']);if(fs[_0xbe44('0xea')](_0x533082)){fs[_0xbe44('0xeb')](_0x533082)[_0xbe44('0xec')](fs[_0xbe44('0xed')](path[_0xbe44('0xcb')](_0x37474f,_0x4fb348[_0xbe44('0xd5')][_0xbe44('0xee')])));}}return{'date':moment(_0x4fb348[_0xbe44('0x7e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbe44('0xa0')](),'sender':_0x4fb348[_0xbe44('0xd6')]==='out'?_0x4fb348[_0xbe44('0x74')]?_0x4fb348['User'][_0xbe44('0xd1')]:'System':_0x4fb348[_0xbe44('0x67')][_0xbe44('0xd3')]+(_0x4fb348[_0xbe44('0x67')][_0xbe44('0xef')]?'\x20'+_0x4fb348['Contact'][_0xbe44('0xef')]:''),'body':_0x4fb348['Attachment']?_0x4fb348[_0xbe44('0xd5')][_0xbe44('0xee')]:_0x4fb348[_0xbe44('0x78')],'direction':_0x4fb348[_0xbe44('0xd6')]===_0xbe44('0xf0')?'A':'C','secret':_0x4fb348[_0xbe44('0xd7')],'read':_0x4fb348[_0xbe44('0x85')],'attachment':_0x4fb348['Attachment']};})[_0xbe44('0x63')]()};return ejs[_0xbe44('0xf1')](path[_0xbe44('0xcb')](config[_0xbe44('0xcc')],_0xbe44('0xcd'),'views',_0xbe44('0xf2')),{'interaction':_0x5d7166})['then'](function(_0xac0e97){return new BPromise(function(_0x536c14,_0x505635){pdf['create'](_0xac0e97,_0x20e54a)[_0xbe44('0xf3')](path[_0xbe44('0xcb')](_0x37474f,_0xbe44('0xf4')+_0x26095e['id']+'-'+_0x32f8fb+_0xbe44('0xf5')),function(_0x425ac9,_0x454202){if(_0x425ac9)return _0x505635(_0x425ac9);_0x536c14(_0x454202);});});})[_0xbe44('0x2d')](function(){return new BPromise(function(_0x1cb990,_0x527478){zipdir(_0x37474f,{'saveTo':_0x196cfd},function(_0x52218a,_0x1662a8){if(_0x52218a)return _0x527478(_0x52218a);return _0x1cb990(_0x1662a8);});})[_0xbe44('0x2d')](function(){return new BPromise(function(_0x5e00bd,_0x2d3744){rimraf(_0x37474f,function(_0x3199e8){if(_0x3199e8)_0x2d3744(_0x3199e8);return _0x5e00bd();});});})['then'](function(){return _0x49a1c8[_0xbe44('0xc9')](_0x196cfd,_0x1cf52e,function(_0x36e8c5){if(_0x36e8c5){console[_0xbe44('0xf6')](_0xbe44('0xf7'),_0x36e8c5);}else{fs[_0xbe44('0xf8')](_0x196cfd);}});});});}else{return _0x49a1c8[_0xbe44('0x21')](0xc8);}})[_0xbe44('0x39')](handleError(_0x49a1c8,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index df89273..7d1cc0f 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 _0x6063=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x3cc31a,_0x4bbb08){var _0xe50e0c=function(_0x319830){while(--_0x319830){_0x3cc31a['push'](_0x3cc31a['shift']());}};_0xe50e0c(++_0x4bbb08);}(_0x6063,0x1c5));var _0x3606=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6063[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x3606('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x3606('0x1')];var OpenchannelMessage=require(_0x3606('0x2'))['db'][_0x3606('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3606('0x4'),'afterUpdate':_0x3606('0x5'),'afterDestroy':_0x3606('0x6')};function emitEvent(_0x2eef90){return function(_0x2365a6,_0x292dbf,_0x2c882f){_0x2365a6[_0x3606('0x7')]({'attributes':['id'],'raw':!![]})[_0x3606('0x8')](function(_0x52fb25){_0x2365a6[_0x3606('0x9')](_0x3606('0xa'),_0x52fb25['map'](function(_0x554434){return{'id':_0x554434['id']};}));return OpenchannelMessage[_0x3606('0xb')]({'where':{'OpenchannelInteractionId':_0x2365a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3606('0x8')](function(_0x4ede4d){_0x2365a6[_0x3606('0x9')](_0x3606('0xc'),_0x4ede4d['length']);OpenchannelInteractionEvents[_0x3606('0xd')](_0x2eef90+':'+_0x2365a6['id'],_0x2365a6);OpenchannelInteractionEvents[_0x3606('0xd')](_0x2eef90,_0x2365a6);_0x2c882f(null);})['catch'](_0x2c882f(null));};}for(var e in events){if(events[_0x3606('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x3606('0xf')](e,emitEvent(event));}}module[_0x3606('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x59b6=['unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','findAll'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x59b6,0x1e5));var _0x659b=function(_0x43a59d,_0x2820e8){_0x43a59d=_0x43a59d-0x0;var _0x52b6e8=_0x59b6[_0x43a59d];return _0x52b6e8;};'use strict';var EventEmitter=require(_0x659b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x659b('0x1'))['db'][_0x659b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x659b('0x3')](0x0);var events={'afterCreate':_0x659b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x486d17){return function(_0x58800b,_0x14de84,_0x56112b){_0x58800b[_0x659b('0x5')]({'attributes':['id'],'raw':!![]})[_0x659b('0x6')](function(_0x1b43e3){_0x58800b[_0x659b('0x7')](_0x659b('0x8'),_0x1b43e3['map'](function(_0x9785fc){return{'id':_0x9785fc['id']};}));return OpenchannelMessage[_0x659b('0x9')]({'where':{'OpenchannelInteractionId':_0x58800b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x434752){_0x58800b[_0x659b('0x7')](_0x659b('0xa'),_0x434752['length']);OpenchannelInteractionEvents[_0x659b('0xb')](_0x486d17+':'+_0x58800b['id'],_0x58800b);OpenchannelInteractionEvents[_0x659b('0xb')](_0x486d17,_0x58800b);_0x56112b(null);})[_0x659b('0xc')](_0x56112b(null));};}for(var e in events){if(events[_0x659b('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x659b('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index fc25a33..158dba1 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 _0xfbff=['exports','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x1b2618,_0x1b1af3){var _0x37de91=function(_0xbbb3a5){while(--_0xbbb3a5){_0x1b2618['push'](_0x1b2618['shift']());}};_0x37de91(++_0x1b1af3);}(_0xfbff,0x1ef));var _0xffbf=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xfbff[_0x10004e];return _0x5af990;};'use strict';var _=require(_0xffbf('0x0'));var util=require(_0xffbf('0x1'));var logger=require('../../config/logger')(_0xffbf('0x2'));var moment=require(_0xffbf('0x3'));var BPromise=require(_0xffbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffbf('0x5'));var rimraf=require(_0xffbf('0x6'));var config=require(_0xffbf('0x7'));var attributes=require(_0xffbf('0x8'));module[_0xffbf('0x9')]=function(_0x45ff49,_0x1136e2){return _0x45ff49['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51aafb,_0xebd4f2,_0x417df0){if(_0x51aafb[_0xffbf('0xa')](_0xffbf('0xb'))){_0x51aafb[_0xffbf('0xc')]=moment()['format'](_0xffbf('0xd'));}_0x417df0(null,_0x51aafb);}}});}; \ No newline at end of file +var _0xbbc0=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x27d19b,_0x288033){var _0x336e22=function(_0x379f91){while(--_0x379f91){_0x27d19b['push'](_0x27d19b['shift']());}};_0x336e22(++_0x288033);}(_0xbbc0,0x1ca));var _0x0bbc=function(_0x15165e,_0x47648c){_0x15165e=_0x15165e-0x0;var _0x3383e3=_0xbbc0[_0x15165e];return _0x3383e3;};'use strict';var _=require(_0x0bbc('0x0'));var util=require(_0x0bbc('0x1'));var logger=require(_0x0bbc('0x2'))('api');var moment=require(_0x0bbc('0x3'));var BPromise=require('bluebird');var rp=require(_0x0bbc('0x4'));var fs=require('fs');var path=require(_0x0bbc('0x5'));var rimraf=require(_0x0bbc('0x6'));var config=require(_0x0bbc('0x7'));var attributes=require(_0x0bbc('0x8'));module[_0x0bbc('0x9')]=function(_0x37d8c7,_0x5873ab){return _0x37d8c7[_0x0bbc('0xa')](_0x0bbc('0xb'),attributes,{'tableName':_0x0bbc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3028ad,_0x2bcfde,_0x3a32f4){if(_0x3028ad[_0x0bbc('0xd')]('closed')){_0x3028ad['closedAt']=moment()[_0x0bbc('0xe')](_0x0bbc('0xf'));}_0x3a32f4(null,_0x3028ad);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 50dc087..90c98c0 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 _0x308b=['result','UpdateOpenchannelInteraction','body','options','where','attributes','stringify','OpenchannelInteraction','addTags','omit','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2ddea4,_0x3b4d83){var _0xb3eb2=function(_0x11ab0a){while(--_0x11ab0a){_0x2ddea4['push'](_0x2ddea4['shift']());}};_0xb3eb2(++_0x3b4d83);}(_0x308b,0x1d4));var _0xb308=function(_0x3326e5,_0x35dfd4){_0x3326e5=_0x3326e5-0x0;var _0x4ad0b7=_0x308b[_0x3326e5];return _0x4ad0b7;};'use strict';var _=require(_0xb308('0x0'));var util=require(_0xb308('0x1'));var moment=require(_0xb308('0x2'));var BPromise=require(_0xb308('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb308('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb308('0x5'));var logger=require(_0xb308('0x6'))(_0xb308('0x7'));var config=require(_0xb308('0x8'));var jayson=require(_0xb308('0x9'));var client=jayson[_0xb308('0xa')][_0xb308('0xb')]({'port':0x232a});config[_0xb308('0xc')]=_[_0xb308('0xd')](config[_0xb308('0xc')],{'host':_0xb308('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb308('0xc')]));require(_0xb308('0xf'))[_0xb308('0x10')](socket);function respondWithRpcPromise(_0x404e75,_0x4e55e6,_0x2886d6){return new BPromise(function(_0x2b27d9,_0x40db7a){return client[_0xb308('0x11')](_0x404e75,_0x2886d6)[_0xb308('0x12')](function(_0x22d6e9){logger[_0xb308('0x13')](_0xb308('0x14'),_0x4e55e6,_0xb308('0x15'));logger[_0xb308('0x16')](_0xb308('0x17'),_0x4e55e6,_0xb308('0x15'),JSON['stringify'](_0x22d6e9));if(_0x22d6e9[_0xb308('0x18')]){if(_0x22d6e9[_0xb308('0x18')]['code']===0x1f4){logger[_0xb308('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4e55e6,_0x22d6e9[_0xb308('0x18')][_0xb308('0x19')]);return _0x40db7a(_0x22d6e9[_0xb308('0x18')]['message']);}logger[_0xb308('0x18')](_0xb308('0x14'),_0x4e55e6,_0x22d6e9[_0xb308('0x18')][_0xb308('0x19')]);return _0x2b27d9(_0x22d6e9[_0xb308('0x18')]['message']);}else{logger[_0xb308('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4e55e6,_0xb308('0x15'));_0x2b27d9(_0x22d6e9[_0xb308('0x1a')]['message']);}})['catch'](function(_0x278e86){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4e55e6,_0x278e86);_0x40db7a(_0x278e86);});});}exports[_0xb308('0x1b')]=function(_0x830cb7){var _0x477277=this;return new Promise(function(_0x59e362,_0x1ac39e){return db['OpenchannelInteraction']['update'](_0x830cb7[_0xb308('0x1c')],{'raw':_0x830cb7[_0xb308('0x1d')]?_0x830cb7[_0xb308('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x830cb7['options']?_0x830cb7['options'][_0xb308('0x1e')]||null:null,'attributes':_0x830cb7['options']?_0x830cb7['options'][_0xb308('0x1f')]||null:null,'limit':_0x830cb7[_0xb308('0x1d')]?_0x830cb7[_0xb308('0x1d')]['limit']||null:null})['then'](function(_0x267ae8){logger[_0xb308('0x13')](_0xb308('0x1b'),_0x830cb7);logger[_0xb308('0x16')](_0xb308('0x1b'),_0x830cb7,JSON[_0xb308('0x20')](_0x267ae8));_0x59e362(_0x267ae8);})['catch'](function(_0x210cbc){logger[_0xb308('0x18')]('UpdateOpenchannelInteraction',_0x210cbc[_0xb308('0x19')],_0x830cb7);_0x1ac39e(_0x477277[_0xb308('0x18')](0x1f4,_0x210cbc['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1be074){return new Promise(function(_0x3b32dc,_0x5926f2){return db[_0xb308('0x21')]['find']({'where':_0x1be074['options']?_0x1be074[_0xb308('0x1d')][_0xb308('0x1e')]||null:null})[_0xb308('0x12')](function(_0x4f9410){if(_0x4f9410){return _0x4f9410[_0xb308('0x22')](_0x1be074['body']['ids'],_[_0xb308('0x23')](_0x1be074['body'],['ids','id'])||{});}})['spread'](function(_0x514013){logger[_0xb308('0x13')](_0xb308('0x24'),_0x1be074);logger[_0xb308('0x16')](_0xb308('0x24'),_0x1be074,JSON[_0xb308('0x20')](_0x514013));_0x3b32dc(_0x514013);})[_0xb308('0x25')](function(_0x1bf20a){logger[_0xb308('0x18')]('AddTags',_0x1bf20a[_0xb308('0x19')],_0x1be074);_0x5926f2(_this['error'](0x1f4,_0x1bf20a[_0xb308('0x19')]));});});}; \ No newline at end of file +var _0x9a24=['result','catch','OpenchannelInteraction','update','body','options','where','limit','stringify','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','request','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0x23ec6f,_0x4bdf25){var _0xd05a98=function(_0x5c562b){while(--_0x5c562b){_0x23ec6f['push'](_0x23ec6f['shift']());}};_0xd05a98(++_0x4bdf25);}(_0x9a24,0x102));var _0x49a2=function(_0x599b30,_0x45fca0){_0x599b30=_0x599b30-0x0;var _0xc90e76=_0x9a24[_0x599b30];return _0xc90e76;};'use strict';var _=require(_0x49a2('0x0'));var util=require('util');var moment=require(_0x49a2('0x1'));var BPromise=require(_0x49a2('0x2'));var rs=require(_0x49a2('0x3'));var fs=require('fs');var Redis=require(_0x49a2('0x4'));var db=require(_0x49a2('0x5'))['db'];var utils=require(_0x49a2('0x6'));var logger=require(_0x49a2('0x7'))('rpc');var config=require(_0x49a2('0x8'));var jayson=require(_0x49a2('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x49a2('0xa')]=_['defaults'](config[_0x49a2('0xa')],{'host':_0x49a2('0xb'),'port':0x18eb});var socket=require(_0x49a2('0xc'))(new Redis(config[_0x49a2('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2eec4d,_0x2dc550,_0x219f8d){return new BPromise(function(_0x34360d,_0x387ba0){return client[_0x49a2('0xd')](_0x2eec4d,_0x219f8d)['then'](function(_0x4beb50){logger['info'](_0x49a2('0xe'),_0x2dc550,'request\x20sent');logger[_0x49a2('0xf')](_0x49a2('0x10'),_0x2dc550,_0x49a2('0x11'),JSON['stringify'](_0x4beb50));if(_0x4beb50[_0x49a2('0x12')]){if(_0x4beb50[_0x49a2('0x12')][_0x49a2('0x13')]===0x1f4){logger[_0x49a2('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2dc550,_0x4beb50[_0x49a2('0x12')][_0x49a2('0x14')]);return _0x387ba0(_0x4beb50[_0x49a2('0x12')][_0x49a2('0x14')]);}logger[_0x49a2('0x12')](_0x49a2('0xe'),_0x2dc550,_0x4beb50[_0x49a2('0x12')]['message']);return _0x34360d(_0x4beb50[_0x49a2('0x12')][_0x49a2('0x14')]);}else{logger[_0x49a2('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2dc550,_0x49a2('0x11'));_0x34360d(_0x4beb50[_0x49a2('0x16')][_0x49a2('0x14')]);}})[_0x49a2('0x17')](function(_0x3b2e57){logger[_0x49a2('0x12')](_0x49a2('0xe'),_0x2dc550,_0x3b2e57);_0x387ba0(_0x3b2e57);});});}exports['UpdateOpenchannelInteraction']=function(_0x1a7062){var _0x5e7f76=this;return new Promise(function(_0x2eb694,_0x236f88){return db[_0x49a2('0x18')][_0x49a2('0x19')](_0x1a7062[_0x49a2('0x1a')],{'raw':_0x1a7062['options']?_0x1a7062[_0x49a2('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a7062[_0x49a2('0x1b')]?_0x1a7062['options'][_0x49a2('0x1c')]||null:null,'attributes':_0x1a7062['options']?_0x1a7062[_0x49a2('0x1b')]['attributes']||null:null,'limit':_0x1a7062[_0x49a2('0x1b')]?_0x1a7062[_0x49a2('0x1b')][_0x49a2('0x1d')]||null:null})['then'](function(_0x2f123c){logger['info']('UpdateOpenchannelInteraction',_0x1a7062);logger['debug']('UpdateOpenchannelInteraction',_0x1a7062,JSON[_0x49a2('0x1e')](_0x2f123c));_0x2eb694(_0x2f123c);})[_0x49a2('0x17')](function(_0x457076){logger[_0x49a2('0x12')](_0x49a2('0x1f'),_0x457076[_0x49a2('0x14')],_0x1a7062);_0x236f88(_0x5e7f76[_0x49a2('0x12')](0x1f4,_0x457076[_0x49a2('0x14')]));});});};exports[_0x49a2('0x20')]=function(_0x34885c){return new Promise(function(_0x1e6e54,_0x5a28db){return db['OpenchannelInteraction'][_0x49a2('0x21')]({'where':_0x34885c[_0x49a2('0x1b')]?_0x34885c[_0x49a2('0x1b')]['where']||null:null})[_0x49a2('0x22')](function(_0x33bb17){if(_0x33bb17){return _0x33bb17[_0x49a2('0x23')](_0x34885c[_0x49a2('0x1a')][_0x49a2('0x24')],_[_0x49a2('0x25')](_0x34885c[_0x49a2('0x1a')],['ids','id'])||{});}})[_0x49a2('0x26')](function(_0x5f47b0){logger['info'](_0x49a2('0x27'),_0x34885c);logger['debug']('AddTags',_0x34885c,JSON[_0x49a2('0x1e')](_0x5f47b0));_0x1e6e54(_0x5f47b0);})[_0x49a2('0x17')](function(_0x1c52fa){logger['error']('AddTags',_0x1c52fa[_0x49a2('0x14')],_0x34885c);_0x5a28db(_this[_0x49a2('0x12')](0x1f4,_0x1c52fa[_0x49a2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 0183a4a..81899f3 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 _0x1468=['remove','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x1468,0x7e));var _0x8146=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x1468[_0x5cbf0e];return _0x1c76f8;};'use strict';var OpenchannelInteractionEvents=require(_0x8146('0x0'));var events=[_0x8146('0x1'),_0x8146('0x2'),'update'];function createListener(_0x357e9f,_0x2f2947){return function(_0x9a37e9){_0x2f2947[_0x8146('0x3')](_0x357e9f,_0x9a37e9);};}function removeListener(_0xfd302f,_0x5434e7){return function(){OpenchannelInteractionEvents[_0x8146('0x4')](_0xfd302f,_0x5434e7);};}exports[_0x8146('0x5')]=function(_0x46840e){for(var _0xd118e6=0x0,_0x18f460=events[_0x8146('0x6')];_0xd118e6<_0x18f460;_0xd118e6++){var _0x25513e=events[_0xd118e6];var _0x39a9f=createListener(_0x8146('0x7')+_0x25513e,_0x46840e);OpenchannelInteractionEvents['on'](_0x25513e,_0x39a9f);}}; \ No newline at end of file +var _0x6867=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x2be2cb,_0x25b13f){var _0x12c0fc=function(_0x3fd274){while(--_0x3fd274){_0x2be2cb['push'](_0x2be2cb['shift']());}};_0x12c0fc(++_0x25b13f);}(_0x6867,0x1d4));var _0x7686=function(_0x427d13,_0x337433){_0x427d13=_0x427d13-0x0;var _0x2dc7de=_0x6867[_0x427d13];return _0x2dc7de;};'use strict';var OpenchannelInteractionEvents=require(_0x7686('0x0'));var events=[_0x7686('0x1'),_0x7686('0x2'),'update'];function createListener(_0x3a9247,_0x598d09){return function(_0x21b7ba){_0x598d09[_0x7686('0x3')](_0x3a9247,_0x21b7ba);};}function removeListener(_0xacadcb,_0x4e7523){return function(){OpenchannelInteractionEvents[_0x7686('0x4')](_0xacadcb,_0x4e7523);};}exports[_0x7686('0x5')]=function(_0x3893ab){for(var _0x2c83f1=0x0,_0xe28dad=events[_0x7686('0x6')];_0x2c83f1<_0xe28dad;_0x2c83f1++){var _0x40bf2f=events[_0x2c83f1];var _0x4336b7=createListener(_0x7686('0x7')+_0x40bf2f,_0x3893ab);OpenchannelInteractionEvents['on'](_0x40bf2f,_0x4336b7);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0e82c0d..b682054 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 _0x0aa1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','/:id','show','post','tracked','openchannel','create','put','update','/:id/accept','accept','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x448fb9,_0x3f319f){var _0x2a079a=function(_0x33cd9d){while(--_0x33cd9d){_0x448fb9['push'](_0x448fb9['shift']());}};_0x2a079a(++_0x3f319f);}(_0x0aa1,0x17b));var _0x10aa=function(_0x127529,_0x170aac){_0x127529=_0x127529-0x0;var _0x2fe27a=_0x0aa1[_0x127529];return _0x2fe27a;};'use strict';var multer=require(_0x10aa('0x0'));var util=require('util');var path=require(_0x10aa('0x1'));var timeout=require(_0x10aa('0x2'));var express=require(_0x10aa('0x3'));var router=express[_0x10aa('0x4')]();var auth=require(_0x10aa('0x5'));var interaction=require(_0x10aa('0x6'));var config=require(_0x10aa('0x7'));var controller=require(_0x10aa('0x8'));router[_0x10aa('0x9')]('/',auth[_0x10aa('0xa')](),controller['index']);router[_0x10aa('0x9')](_0x10aa('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x10aa('0xc'),auth[_0x10aa('0xa')](),controller[_0x10aa('0xd')]);router[_0x10aa('0xe')]('/',auth[_0x10aa('0xa')](),interaction[_0x10aa('0xf')](_0x10aa('0x10'),'openchannelmessage:create'),controller[_0x10aa('0x11')]);router[_0x10aa('0x12')](_0x10aa('0xc'),auth['isAuthenticated'](),controller[_0x10aa('0x13')]);router[_0x10aa('0x12')](_0x10aa('0x14'),auth[_0x10aa('0xa')](),controller[_0x10aa('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x10aa('0x16')](_0x10aa('0xc'),auth[_0x10aa('0xa')](),controller[_0x10aa('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4922=['openchannel','openchannelmessage:create','create','put','/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x6a3d18,_0x115cf4){var _0x40642a=function(_0x235941){while(--_0x235941){_0x6a3d18['push'](_0x6a3d18['shift']());}};_0x40642a(++_0x115cf4);}(_0x4922,0x9f));var _0x2492=function(_0x538af4,_0x38f152){_0x538af4=_0x538af4-0x0;var _0x28d15f=_0x4922[_0x538af4];return _0x28d15f;};'use strict';var multer=require(_0x2492('0x0'));var util=require(_0x2492('0x1'));var path=require(_0x2492('0x2'));var timeout=require(_0x2492('0x3'));var express=require(_0x2492('0x4'));var router=express[_0x2492('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2492('0x6'));var controller=require(_0x2492('0x7'));router['get']('/',auth[_0x2492('0x8')](),controller[_0x2492('0x9')]);router[_0x2492('0xa')](_0x2492('0xb'),auth[_0x2492('0x8')](),controller[_0x2492('0xc')]);router[_0x2492('0xa')](_0x2492('0xd'),auth[_0x2492('0x8')](),controller[_0x2492('0xe')]);router[_0x2492('0xf')]('/',auth[_0x2492('0x8')](),interaction['tracked'](_0x2492('0x10'),_0x2492('0x11')),controller[_0x2492('0x12')]);router[_0x2492('0x13')]('/:id',auth[_0x2492('0x8')](),controller['update']);router[_0x2492('0x13')](_0x2492('0x14'),auth[_0x2492('0x8')](),controller[_0x2492('0x15')]);router[_0x2492('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x2492('0x16')](_0x2492('0xd'),auth[_0x2492('0x8')](),controller[_0x2492('0x17')]);module[_0x2492('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index e423edc..007ed64 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 _0x3cf4=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x43730b,_0x2097c1){var _0x4cf115=function(_0x4012de){while(--_0x4012de){_0x43730b['push'](_0x43730b['shift']());}};_0x4cf115(++_0x2097c1);}(_0x3cf4,0xc0));var _0x43cf=function(_0x4f076b,_0x50fa9e){_0x4f076b=_0x4f076b-0x0;var _0x151fc3=_0x3cf4[_0x4f076b];return _0x151fc3;};'use strict';var Sequelize=require(_0x43cf('0x0'));module[_0x43cf('0x1')]={'body':{'type':Sequelize[_0x43cf('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x43cf('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x43cf('0x4')]('in',_0x43cf('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x43cf('0x6')]}}; \ No newline at end of file +var _0x8ebb=['DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1d95da,_0x41da5f){var _0x520789=function(_0x464f91){while(--_0x464f91){_0x1d95da['push'](_0x1d95da['shift']());}};_0x520789(++_0x41da5f);}(_0x8ebb,0xdf));var _0xb8eb=function(_0x4882a0,_0x172794){_0x4882a0=_0x4882a0-0x0;var _0x301078=_0x8ebb[_0x4882a0];return _0x301078;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xb8eb('0x0')](_0xb8eb('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb8eb('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb8eb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb8eb('0x3')]('in',_0xb8eb('0x4')),'defaultValue':_0xb8eb('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb8eb('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 604a80a..d1eac1f 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 _0x941a=['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','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','key','model','keys','query','filters','attributes','intersection','fields','length','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelMessage','count','includeAll','include','findAll','catch','show','params','find','create','body','describe','openchannel-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./openchannelMessage.socket','jayson/promise','client','http','test'];(function(_0x462e0a,_0x5cc82f){var _0x361149=function(_0x6b7325){while(--_0x6b7325){_0x462e0a['push'](_0x462e0a['shift']());}};_0x361149(++_0x5cc82f);}(_0x941a,0xcb));var _0xa941=function(_0x115afe,_0x18664b){_0x115afe=_0x115afe-0x0;var _0x4a6cf6=_0x941a[_0x115afe];return _0x4a6cf6;};'use strict';var pdf=require(_0xa941('0x0'));var emlformat=require(_0xa941('0x1'));var rimraf=require(_0xa941('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa941('0x3'));var rp=require('request-promise');var moment=require(_0xa941('0x4'));var BPromise=require(_0xa941('0x5'));var Mustache=require(_0xa941('0x6'));var util=require(_0xa941('0x7'));var path=require(_0xa941('0x8'));var sox=require(_0xa941('0x9'));var csv=require(_0xa941('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa941('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa941('0xc'));var toCsv=require(_0xa941('0xa'));var querystring=require(_0xa941('0xd'));var Papa=require(_0xa941('0xe'));var Redis=require(_0xa941('0xf'));var authService=require(_0xa941('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa941('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa941('0x12'))('api');var utils=require(_0xa941('0x13'));var config=require(_0xa941('0x14'));var db=require(_0xa941('0x15'))['db'];config[_0xa941('0x16')]=_[_0xa941('0x17')](config[_0xa941('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa941('0x16')]));require(_0xa941('0x18'))['register'](socket);var jayson=require(_0xa941('0x19'));var client=jayson[_0xa941('0x1a')][_0xa941('0x1b')]({'port':0x232c});var client9002=jayson[_0xa941('0x1a')][_0xa941('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3698e7,_0xa68918,_0x2b3c85){if(_0x2b3c85){var _0x440bf7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x440bf7[_0xa941('0x1c')](_0xa68918)){return _0x3698e7;}else{throw new db[(_0xa941('0x1d'))]['ValidationError'](_0xa941('0x1e'));}}else{return _0x3698e7;}}function respondWithRpcPromise(_0x1077af,_0x2935dc,_0x1e5902,_0x4a434d){return new BPromise(function(_0x3ff697,_0x1fd7db){var _0x85e941=_0x4a434d||client;return _0x85e941['request'](_0x1077af,_0x1e5902)[_0xa941('0x1f')](function(_0x13a626){logger['info'](_0xa941('0x20'),_0x2935dc,_0xa941('0x21'));logger[_0xa941('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2935dc,_0xa941('0x21'),JSON[_0xa941('0x23')](_0x13a626));if(_0x13a626[_0xa941('0x24')]){if(_0x13a626[_0xa941('0x24')][_0xa941('0x25')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2935dc,_0x13a626[_0xa941('0x24')][_0xa941('0x26')]);return _0x1fd7db(_0x13a626[_0xa941('0x24')][_0xa941('0x26')]);}logger[_0xa941('0x24')](_0xa941('0x20'),_0x2935dc,_0x13a626[_0xa941('0x24')]['message']);return _0x3ff697(_0x13a626['error']['message']);}else{logger[_0xa941('0x27')](_0xa941('0x20'),_0x2935dc,_0xa941('0x21'));_0x3ff697(_0x13a626[_0xa941('0x28')][_0xa941('0x26')]);}})['catch'](function(_0x41c11d){logger[_0xa941('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x2935dc,_0x41c11d);_0x1fd7db(_0x41c11d);});});}function respondWithStatusCode(_0x20a53b,_0x9c3305){_0x9c3305=_0x9c3305||0xcc;return function(_0x335dff){if(_0x335dff){return _0x20a53b[_0xa941('0x29')](_0x9c3305);}return _0x20a53b['status'](_0x9c3305)[_0xa941('0x2a')]();};}function respondWithResult(_0x159fe8,_0x1833a8){_0x1833a8=_0x1833a8||0xc8;return function(_0x2915ea){if(_0x2915ea){return _0x159fe8[_0xa941('0x2b')](_0x1833a8)[_0xa941('0x2c')](_0x2915ea);}};}function respondWithFilteredResult(_0x2bb95d,_0x1f1529){return function(_0x3f5071){if(_0x3f5071){var _0x508365=_0x3f5071['count'],_0xb49c=_0x1f1529[_0xa941('0x2d')],_0x381413=_0x1f1529[_0xa941('0x2d')]+_0x1f1529['limit'],_0x3c533b;if(_0x381413>=_0x508365){_0x381413=_0x508365;_0x3c533b=0xc8;}else{_0x3c533b=0xce;}_0x2bb95d[_0xa941('0x2b')](_0x3c533b);return _0x2bb95d[_0xa941('0x2e')](_0xa941('0x2f'),_0xb49c+'-'+_0x381413+'/'+_0x508365)[_0xa941('0x2c')](_0x3f5071);}return null;};}function patchUpdates(_0x29230e){return function(_0x31ad2f){try{jsonpatch[_0xa941('0x30')](_0x31ad2f,_0x29230e,!![]);}catch(_0x2f337f){return BPromise[_0xa941('0x31')](_0x2f337f);}return _0x31ad2f[_0xa941('0x32')]();};}function saveUpdates(_0x304c42,_0x492afe){return function(_0x11b50a){if(_0x11b50a){return _0x11b50a[_0xa941('0x33')](_0x304c42)[_0xa941('0x1f')](function(_0x41fc70){return _0x41fc70;});}return null;};}function removeEntity(_0x25cb52,_0x7eb409){return function(_0xb1fdf3){if(_0xb1fdf3){return _0xb1fdf3[_0xa941('0x34')]()[_0xa941('0x1f')](function(){_0x25cb52[_0xa941('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125eb8,_0x4922d1){return function(_0x4ef379){if(!_0x4ef379){_0x125eb8[_0xa941('0x29')](0x194);}return _0x4ef379;};}function handleError(_0x191a77,_0x4c245a){_0x4c245a=_0x4c245a||0x1f4;return function(_0x26ed70){logger[_0xa941('0x24')](_0x26ed70[_0xa941('0x35')]);if(_0x26ed70[_0xa941('0x36')]){delete _0x26ed70[_0xa941('0x36')];}_0x191a77[_0xa941('0x2b')](_0x4c245a)[_0xa941('0x37')](_0x26ed70);};}exports[_0xa941('0x38')]=function(_0x4467b3,_0x23b1b4){var _0x492270={},_0x574482={},_0x37e4b6={'count':0x0,'rows':[]};var _0x5e14aa=_[_0xa941('0x39')](db['OpenchannelMessage']['rawAttributes'],function(_0x3fcffb){return{'name':_0x3fcffb['fieldName'],'type':_0x3fcffb['type'][_0xa941('0x3a')]};});_0x574482[_0xa941('0x3b')]=_[_0xa941('0x39')](_0x5e14aa,_0xa941('0x36'));_0x574482['query']=_[_0xa941('0x3c')](_0x4467b3[_0xa941('0x3d')]);_0x574482[_0xa941('0x3e')]=_['intersection'](_0x574482['model'],_0x574482[_0xa941('0x3d')]);_0x492270[_0xa941('0x3f')]=_[_0xa941('0x40')](_0x574482[_0xa941('0x3b')],qs[_0xa941('0x41')](_0x4467b3[_0xa941('0x3d')][_0xa941('0x41')]));_0x492270[_0xa941('0x3f')]=_0x492270[_0xa941('0x3f')][_0xa941('0x42')]?_0x492270['attributes']:_0x574482[_0xa941('0x3b')];if(!_0x4467b3[_0xa941('0x3d')]['hasOwnProperty']('nolimit')){_0x492270['limit']=qs[_0xa941('0x43')](_0x4467b3['query']['limit']);_0x492270[_0xa941('0x2d')]=qs['offset'](_0x4467b3[_0xa941('0x3d')][_0xa941('0x2d')]);}_0x492270[_0xa941('0x44')]=qs[_0xa941('0x45')](_0x4467b3['query']['sort']);_0x492270['where']=qs[_0xa941('0x3e')](_[_0xa941('0x46')](_0x4467b3['query'],_0x574482[_0xa941('0x3e')]),_0x5e14aa);if(_0x4467b3[_0xa941('0x3d')][_0xa941('0x47')]){_0x492270[_0xa941('0x48')]=_[_0xa941('0x49')](_0x492270[_0xa941('0x48')],{'$or':_[_0xa941('0x39')](_0x5e14aa,function(_0x116d4d){if(_0x116d4d[_0xa941('0x4a')]!==_0xa941('0x4b')){var _0x2c2a91={};_0x2c2a91[_0x116d4d[_0xa941('0x36')]]={'$like':'%'+_0x4467b3[_0xa941('0x3d')][_0xa941('0x47')]+'%'};return _0x2c2a91;}})});}_0x492270=_[_0xa941('0x49')]({},_0x492270,_0x4467b3[_0xa941('0x4c')]);var _0x57bccb={'where':_0x492270['where']};return db[_0xa941('0x4d')][_0xa941('0x4e')](_0x57bccb)[_0xa941('0x1f')](function(_0x33123f){_0x37e4b6[_0xa941('0x4e')]=_0x33123f;if(_0x4467b3[_0xa941('0x3d')][_0xa941('0x4f')]){_0x492270[_0xa941('0x50')]=[{'all':!![]}];}return db[_0xa941('0x4d')][_0xa941('0x51')](_0x492270);})['then'](function(_0x32370b){_0x37e4b6['rows']=_0x32370b;return _0x37e4b6;})[_0xa941('0x1f')](respondWithFilteredResult(_0x23b1b4,_0x492270))[_0xa941('0x52')](handleError(_0x23b1b4,null));};exports[_0xa941('0x53')]=function(_0x3ac249,_0x1c3596){var _0x1cc6cd={'raw':!![],'where':{'id':_0x3ac249[_0xa941('0x54')]['id']}},_0x3b3597={};_0x3b3597[_0xa941('0x3b')]=_[_0xa941('0x3c')](db['OpenchannelMessage']['rawAttributes']);_0x3b3597[_0xa941('0x3d')]=_['keys'](_0x3ac249[_0xa941('0x3d')]);_0x3b3597[_0xa941('0x3e')]=_[_0xa941('0x40')](_0x3b3597['model'],_0x3b3597[_0xa941('0x3d')]);_0x1cc6cd[_0xa941('0x3f')]=_[_0xa941('0x40')](_0x3b3597[_0xa941('0x3b')],qs['fields'](_0x3ac249['query'][_0xa941('0x41')]));_0x1cc6cd[_0xa941('0x3f')]=_0x1cc6cd[_0xa941('0x3f')][_0xa941('0x42')]?_0x1cc6cd[_0xa941('0x3f')]:_0x3b3597[_0xa941('0x3b')];if(_0x3ac249[_0xa941('0x3d')][_0xa941('0x4f')]){_0x1cc6cd[_0xa941('0x50')]=[{'all':!![]}];}_0x1cc6cd=_[_0xa941('0x49')]({},_0x1cc6cd,_0x3ac249[_0xa941('0x4c')]);return db[_0xa941('0x4d')][_0xa941('0x55')](_0x1cc6cd)['then'](handleEntityNotFound(_0x1c3596,null))[_0xa941('0x1f')](respondWithResult(_0x1c3596,null))[_0xa941('0x52')](handleError(_0x1c3596,null));};exports[_0xa941('0x56')]=function(_0x434cfb,_0x28bd87){return db['OpenchannelMessage']['create'](_0x434cfb['body'],{})['then'](respondWithResult(_0x28bd87,0xc9))['catch'](handleError(_0x28bd87,null));};exports[_0xa941('0x33')]=function(_0x2b2019,_0x4aabca){if(_0x2b2019['body']['id']){delete _0x2b2019['body']['id'];}return db[_0xa941('0x4d')]['find']({'where':{'id':_0x2b2019[_0xa941('0x54')]['id']}})[_0xa941('0x1f')](handleEntityNotFound(_0x4aabca,null))['then'](saveUpdates(_0x2b2019[_0xa941('0x57')],null))[_0xa941('0x1f')](respondWithResult(_0x4aabca,null))['catch'](handleError(_0x4aabca,null));};exports['destroy']=function(_0x39cd2f,_0x26c3e0){return db[_0xa941('0x4d')][_0xa941('0x55')]({'where':{'id':_0x39cd2f[_0xa941('0x54')]['id']}})['then'](handleEntityNotFound(_0x26c3e0,null))[_0xa941('0x1f')](removeEntity(_0x26c3e0,null))[_0xa941('0x52')](handleError(_0x26c3e0,null));};exports[_0xa941('0x58')]=function(_0x3b67b7,_0x31657e){return db[_0xa941('0x4d')][_0xa941('0x58')]()[_0xa941('0x1f')](respondWithResult(_0x31657e,null))[_0xa941('0x52')](handleError(_0x31657e,null));};var interaction_log=require('../../config/logger')(_0xa941('0x59'));exports[_0xa941('0x5a')]=function(_0x2cba24,_0x4d663b,_0x49253f){var _0x159bc3={'channel':'openchannel'};if(_0x2cba24[_0xa941('0x57')]['id']){delete _0x2cba24[_0xa941('0x57')]['id'];}_0x2cba24['body'][_0xa941('0x5b')]=!![];_0x2cba24['body']['readAt']=moment()[_0xa941('0x5c')](_0xa941('0x5d'));_0x2cba24[_0xa941('0x57')][_0xa941('0x5e')]=_0x2cba24[_0xa941('0x57')]['UserId']||_0x2cba24[_0xa941('0x5f')]['id'];return db[_0xa941('0x4d')][_0xa941('0x55')]({'where':{'id':_0x2cba24['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xa941('0x60')}]})[_0xa941('0x1f')](handleEntityNotFound(_0x4d663b,null))[_0xa941('0x1f')](saveUpdates(_0x2cba24[_0xa941('0x57')],null))['then'](function(_0x93a5dd){if(_0x93a5dd){_0x159bc3['message']=_0x93a5dd['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xa941('0x55')]({'where':{'id':_0x93a5dd[_0xa941('0x61')]}});}return null;})[_0xa941('0x1f')](handleEntityNotFound(_0x4d663b,null))[_0xa941('0x1f')](function(_0x25b647){if(_0x25b647){return _0x25b647[_0xa941('0x33')]({'UserId':_0x2cba24[_0xa941('0x57')][_0xa941('0x5e')],'read1stAt':_['isNil'](_0x25b647['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xa12869){if(_0xa12869){_0x159bc3[_0xa941('0x62')]=_0xa12869[_0xa941('0x63')]({'plain':!![]});interaction_log[_0xa941('0x27')](_0xa941('0x64'),_0x2cba24[_0xa941('0x5f')]['id'],_0x2cba24[_0xa941('0x5f')]['name'],_0x2cba24[_0xa941('0x5f')][_0xa941('0x65')],_0x159bc3['interaction']['id'],_0x2cba24[_0xa941('0x57')]?JSON['stringify'](_0x2cba24[_0xa941('0x57')]):_0xa941('0x66'));return respondWithRpcPromise(_0xa941('0x67'),_0xa941('0x68'),_0x159bc3);}return null;})['then'](function(_0x961703){if(_0x961703){if(_0x2cba24[_0xa941('0x57')][_0xa941('0x69')]){_0x159bc3[_0xa941('0x26')][_0xa941('0x6a')]=util[_0xa941('0x5c')](_0xa941('0x6b'),_0x2cba24['user'][_0xa941('0x36')]);_0x159bc3[_0xa941('0x26')][_0xa941('0x6c')]=_0x159bc3['channel'];_0x159bc3['message'][_0xa941('0x6d')]=_0xa941('0x5a');return respondWithRpcPromise(_0xa941('0x6e'),_0xa941('0x6e'),{'event':'acceptmessage','message':_0x159bc3[_0xa941('0x26')]},client9002)[_0xa941('0x1f')](function(){return _0x159bc3;});}return _0x159bc3;}return null;})[_0xa941('0x1f')](respondWithResult(_0x4d663b,null))['catch'](handleError(_0x4d663b,null));};var interaction_log=require(_0xa941('0x12'))('openchannel-interactions');exports['reject']=function(_0x4fefc4,_0x3e49d8,_0x2a2f93){var _0x38dc7e={'agent':{},'channel':'openchannel'};if(_0x4fefc4[_0xa941('0x57')]['id']){delete _0x4fefc4[_0xa941('0x57')]['id'];}_0x4fefc4[_0xa941('0x57')][_0xa941('0x5e')]=_0x4fefc4[_0xa941('0x57')]['UserId']||_0x4fefc4[_0xa941('0x5f')]['id'];_0x38dc7e[_0xa941('0x6f')]['id']=_0x4fefc4[_0xa941('0x57')][_0xa941('0x5e')];return db['OpenchannelMessage'][_0xa941('0x55')]({'where':{'id':_0x4fefc4[_0xa941('0x54')]['id'],'UserId':null}})[_0xa941('0x1f')](handleEntityNotFound(_0x3e49d8,null))[_0xa941('0x1f')](function(_0x590498){if(_0x590498){_0x38dc7e[_0xa941('0x26')]=_0x590498[_0xa941('0x63')]({'plain':!![]});return db[_0xa941('0x70')][_0xa941('0x55')]({'where':{'id':_0x590498[_0xa941('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3e49d8,null))['then'](function(_0x486384){if(_0x486384){_0x38dc7e[_0xa941('0x62')]=_0x486384['get']({'plain':!![]});interaction_log[_0xa941('0x27')](_0xa941('0x71'),_0x4fefc4[_0xa941('0x5f')]['id'],_0x4fefc4[_0xa941('0x5f')]['name'],_0x4fefc4[_0xa941('0x5f')][_0xa941('0x65')],_0x38dc7e[_0xa941('0x62')]['id'],_0x4fefc4['body']?JSON[_0xa941('0x23')](_0x4fefc4[_0xa941('0x57')]):_0xa941('0x66'));return respondWithRpcPromise(_0xa941('0x72'),'rejectMessage',_0x38dc7e);}return null;})['then'](function(_0xa402f4){if(_0xa402f4){_0xa402f4[_0xa941('0x26')][_0xa941('0x6a')]=util[_0xa941('0x5c')](_0xa941('0x6b'),_0x4fefc4['user']['name']);_0xa402f4[_0xa941('0x26')][_0xa941('0x6c')]=_0x38dc7e[_0xa941('0x6c')];_0xa402f4[_0xa941('0x26')][_0xa941('0x6d')]=_0xa941('0x31');respondWithRpcPromise(_0xa941('0x6e'),'EventManager',{'event':_0xa941('0x73'),'message':_0xa402f4[_0xa941('0x26')]},client9002);return _0x38dc7e;}return null;})[_0xa941('0x1f')](respondWithResult(_0x3e49d8,null))[_0xa941('0x52')](handleError(_0x3e49d8,null));}; \ No newline at end of file +var _0x32b5=['destroy','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','agent','null','RejectMessage','SIP/%s','reject','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','Sequelize','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','count','offset','set','Content-Range','apply','save','update','end','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','filter','options','includeAll','findAll','rows','show','intersection','include','find','catch','create','body','params'];(function(_0x7686e9,_0x4e974c){var _0x4aa905=function(_0x22c349){while(--_0x22c349){_0x7686e9['push'](_0x7686e9['shift']());}};_0x4aa905(++_0x4e974c);}(_0x32b5,0x123));var _0x532b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x32b5[_0x1facfa];return _0x9ec701;};'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(_0x532b('0x6'));var BPromise=require(_0x532b('0x7'));var Mustache=require(_0x532b('0x8'));var util=require(_0x532b('0x9'));var path=require(_0x532b('0xa'));var sox=require(_0x532b('0xb'));var csv=require(_0x532b('0xc'));var ejs=require(_0x532b('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x532b('0xe'));var jsforce=require(_0x532b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x532b('0xc'));var querystring=require(_0x532b('0x10'));var Papa=require(_0x532b('0x11'));var Redis=require(_0x532b('0x12'));var authService=require(_0x532b('0x13'));var qs=require(_0x532b('0x14'));var as=require(_0x532b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x532b('0x16'))(_0x532b('0x17'));var utils=require(_0x532b('0x18'));var config=require(_0x532b('0x19'));var db=require(_0x532b('0x1a'))['db'];config[_0x532b('0x1b')]=_[_0x532b('0x1c')](config[_0x532b('0x1b')],{'host':_0x532b('0x1d'),'port':0x18eb});var socket=require(_0x532b('0x1e'))(new Redis(config[_0x532b('0x1b')]));require(_0x532b('0x1f'))[_0x532b('0x20')](socket);var jayson=require(_0x532b('0x21'));var client=jayson[_0x532b('0x22')][_0x532b('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x532b('0x23')]({'port':0x232a});function checkPasswordPattern(_0x1a966f,_0x366014,_0x551f60){if(_0x551f60){var _0x4a5948=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a5948['test'](_0x366014)){return _0x1a966f;}else{throw new db[(_0x532b('0x24'))]['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 _0x1a966f;}}function respondWithRpcPromise(_0x3bd56a,_0x17202d,_0x2535fc,_0x2e9414){return new BPromise(function(_0x1a5c0c,_0x9c510f){var _0x164e56=_0x2e9414||client;return _0x164e56[_0x532b('0x25')](_0x3bd56a,_0x2535fc)[_0x532b('0x26')](function(_0x597394){logger[_0x532b('0x27')](_0x532b('0x28'),_0x17202d,_0x532b('0x29'));logger[_0x532b('0x2a')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x17202d,_0x532b('0x29'),JSON[_0x532b('0x2b')](_0x597394));if(_0x597394[_0x532b('0x2c')]){if(_0x597394[_0x532b('0x2c')][_0x532b('0x2d')]===0x1f4){logger[_0x532b('0x2c')]('OpenchannelMessage,\x20%s,\x20%s',_0x17202d,_0x597394['error'][_0x532b('0x2e')]);return _0x9c510f(_0x597394[_0x532b('0x2c')]['message']);}logger['error'](_0x532b('0x28'),_0x17202d,_0x597394[_0x532b('0x2c')]['message']);return _0x1a5c0c(_0x597394['error']['message']);}else{logger[_0x532b('0x27')](_0x532b('0x28'),_0x17202d,'request\x20sent');_0x1a5c0c(_0x597394[_0x532b('0x2f')][_0x532b('0x2e')]);}})['catch'](function(_0x716064){logger[_0x532b('0x2c')](_0x532b('0x28'),_0x17202d,_0x716064);_0x9c510f(_0x716064);});});}function respondWithStatusCode(_0x430b23,_0x1ce7cf){_0x1ce7cf=_0x1ce7cf||0xcc;return function(_0x13a4e9){if(_0x13a4e9){return _0x430b23['sendStatus'](_0x1ce7cf);}return _0x430b23[_0x532b('0x30')](_0x1ce7cf)['end']();};}function respondWithResult(_0x2f8c38,_0x3a748e){_0x3a748e=_0x3a748e||0xc8;return function(_0x4988a3){if(_0x4988a3){return _0x2f8c38[_0x532b('0x30')](_0x3a748e)[_0x532b('0x31')](_0x4988a3);}};}function respondWithFilteredResult(_0x192f50,_0x3f07a9){return function(_0x5a7765){if(_0x5a7765){var _0x27346d=_0x5a7765[_0x532b('0x32')],_0x468338=_0x3f07a9[_0x532b('0x33')],_0x574d58=_0x3f07a9['offset']+_0x3f07a9['limit'],_0x2f4663;if(_0x574d58>=_0x27346d){_0x574d58=_0x27346d;_0x2f4663=0xc8;}else{_0x2f4663=0xce;}_0x192f50['status'](_0x2f4663);return _0x192f50[_0x532b('0x34')](_0x532b('0x35'),_0x468338+'-'+_0x574d58+'/'+_0x27346d)[_0x532b('0x31')](_0x5a7765);}return null;};}function patchUpdates(_0x4c32bd){return function(_0x351fa2){try{jsonpatch[_0x532b('0x36')](_0x351fa2,_0x4c32bd,!![]);}catch(_0x32dd80){return BPromise['reject'](_0x32dd80);}return _0x351fa2[_0x532b('0x37')]();};}function saveUpdates(_0x574d54,_0x44c705){return function(_0x33d3f0){if(_0x33d3f0){return _0x33d3f0[_0x532b('0x38')](_0x574d54)['then'](function(_0x10b445){return _0x10b445;});}return null;};}function removeEntity(_0x1769a2,_0x19e8ec){return function(_0x1368a2){if(_0x1368a2){return _0x1368a2['destroy']()[_0x532b('0x26')](function(){_0x1769a2[_0x532b('0x30')](0xcc)[_0x532b('0x39')]();});}};}function handleEntityNotFound(_0x66635e,_0x4cd5cc){return function(_0x37d501){if(!_0x37d501){_0x66635e[_0x532b('0x3a')](0x194);}return _0x37d501;};}function handleError(_0x4bc5ee,_0x34698a){_0x34698a=_0x34698a||0x1f4;return function(_0x125597){logger[_0x532b('0x2c')](_0x125597[_0x532b('0x3b')]);if(_0x125597[_0x532b('0x3c')]){delete _0x125597[_0x532b('0x3c')];}_0x4bc5ee[_0x532b('0x30')](_0x34698a)['send'](_0x125597);};}exports[_0x532b('0x3d')]=function(_0x4b0e96,_0x5d2d7b){var _0x231be8={},_0x1be539={},_0x26f806={'count':0x0,'rows':[]};var _0x478e10=_[_0x532b('0x3e')](db[_0x532b('0x3f')][_0x532b('0x40')],function(_0x314518){return{'name':_0x314518[_0x532b('0x41')],'type':_0x314518[_0x532b('0x42')]['key']};});_0x1be539[_0x532b('0x43')]=_[_0x532b('0x3e')](_0x478e10,'name');_0x1be539[_0x532b('0x44')]=_[_0x532b('0x45')](_0x4b0e96['query']);_0x1be539[_0x532b('0x46')]=_['intersection'](_0x1be539[_0x532b('0x43')],_0x1be539[_0x532b('0x44')]);_0x231be8[_0x532b('0x47')]=_['intersection'](_0x1be539[_0x532b('0x43')],qs[_0x532b('0x48')](_0x4b0e96[_0x532b('0x44')][_0x532b('0x48')]));_0x231be8[_0x532b('0x47')]=_0x231be8[_0x532b('0x47')][_0x532b('0x49')]?_0x231be8[_0x532b('0x47')]:_0x1be539['model'];if(!_0x4b0e96[_0x532b('0x44')][_0x532b('0x4a')]('nolimit')){_0x231be8['limit']=qs[_0x532b('0x4b')](_0x4b0e96[_0x532b('0x44')]['limit']);_0x231be8[_0x532b('0x33')]=qs['offset'](_0x4b0e96[_0x532b('0x44')][_0x532b('0x33')]);}_0x231be8[_0x532b('0x4c')]=qs[_0x532b('0x4d')](_0x4b0e96[_0x532b('0x44')][_0x532b('0x4d')]);_0x231be8[_0x532b('0x4e')]=qs[_0x532b('0x46')](_['pick'](_0x4b0e96[_0x532b('0x44')],_0x1be539[_0x532b('0x46')]),_0x478e10);if(_0x4b0e96[_0x532b('0x44')]['filter']){_0x231be8['where']=_[_0x532b('0x4f')](_0x231be8['where'],{'$or':_[_0x532b('0x3e')](_0x478e10,function(_0x253eff){if(_0x253eff['type']!=='VIRTUAL'){var _0x3caa82={};_0x3caa82[_0x253eff[_0x532b('0x3c')]]={'$like':'%'+_0x4b0e96[_0x532b('0x44')][_0x532b('0x50')]+'%'};return _0x3caa82;}})});}_0x231be8=_[_0x532b('0x4f')]({},_0x231be8,_0x4b0e96[_0x532b('0x51')]);var _0x23d0db={'where':_0x231be8['where']};return db[_0x532b('0x3f')]['count'](_0x23d0db)[_0x532b('0x26')](function(_0x28f73d){_0x26f806['count']=_0x28f73d;if(_0x4b0e96[_0x532b('0x44')][_0x532b('0x52')]){_0x231be8['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x532b('0x53')](_0x231be8);})[_0x532b('0x26')](function(_0x1738b0){_0x26f806[_0x532b('0x54')]=_0x1738b0;return _0x26f806;})[_0x532b('0x26')](respondWithFilteredResult(_0x5d2d7b,_0x231be8))['catch'](handleError(_0x5d2d7b,null));};exports[_0x532b('0x55')]=function(_0x2e33dc,_0x5e9f6d){var _0x3826ca={'raw':!![],'where':{'id':_0x2e33dc['params']['id']}},_0x330a0a={};_0x330a0a[_0x532b('0x43')]=_[_0x532b('0x45')](db['OpenchannelMessage'][_0x532b('0x40')]);_0x330a0a[_0x532b('0x44')]=_[_0x532b('0x45')](_0x2e33dc[_0x532b('0x44')]);_0x330a0a['filters']=_[_0x532b('0x56')](_0x330a0a[_0x532b('0x43')],_0x330a0a[_0x532b('0x44')]);_0x3826ca[_0x532b('0x47')]=_[_0x532b('0x56')](_0x330a0a['model'],qs['fields'](_0x2e33dc[_0x532b('0x44')]['fields']));_0x3826ca[_0x532b('0x47')]=_0x3826ca[_0x532b('0x47')]['length']?_0x3826ca[_0x532b('0x47')]:_0x330a0a[_0x532b('0x43')];if(_0x2e33dc[_0x532b('0x44')][_0x532b('0x52')]){_0x3826ca[_0x532b('0x57')]=[{'all':!![]}];}_0x3826ca=_[_0x532b('0x4f')]({},_0x3826ca,_0x2e33dc['options']);return db[_0x532b('0x3f')][_0x532b('0x58')](_0x3826ca)[_0x532b('0x26')](handleEntityNotFound(_0x5e9f6d,null))[_0x532b('0x26')](respondWithResult(_0x5e9f6d,null))[_0x532b('0x59')](handleError(_0x5e9f6d,null));};exports[_0x532b('0x5a')]=function(_0x2be29c,_0x51257a){return db[_0x532b('0x3f')][_0x532b('0x5a')](_0x2be29c[_0x532b('0x5b')],{})['then'](respondWithResult(_0x51257a,0xc9))['catch'](handleError(_0x51257a,null));};exports[_0x532b('0x38')]=function(_0x2842dd,_0x64d4a6){if(_0x2842dd['body']['id']){delete _0x2842dd[_0x532b('0x5b')]['id'];}return db[_0x532b('0x3f')][_0x532b('0x58')]({'where':{'id':_0x2842dd[_0x532b('0x5c')]['id']}})[_0x532b('0x26')](handleEntityNotFound(_0x64d4a6,null))['then'](saveUpdates(_0x2842dd['body'],null))[_0x532b('0x26')](respondWithResult(_0x64d4a6,null))[_0x532b('0x59')](handleError(_0x64d4a6,null));};exports[_0x532b('0x5d')]=function(_0x391650,_0x46f088){return db[_0x532b('0x3f')][_0x532b('0x58')]({'where':{'id':_0x391650['params']['id']}})[_0x532b('0x26')](handleEntityNotFound(_0x46f088,null))[_0x532b('0x26')](removeEntity(_0x46f088,null))[_0x532b('0x59')](handleError(_0x46f088,null));};exports[_0x532b('0x5e')]=function(_0x50ea13,_0x31d351){return db[_0x532b('0x3f')][_0x532b('0x5e')]()['then'](respondWithResult(_0x31d351,null))[_0x532b('0x59')](handleError(_0x31d351,null));};var interaction_log=require(_0x532b('0x16'))(_0x532b('0x5f'));exports['accept']=function(_0x20b70c,_0x10c162,_0x1782f3){var _0x7bacdb={'channel':_0x532b('0x60')};if(_0x20b70c['body']['id']){delete _0x20b70c['body']['id'];}_0x20b70c[_0x532b('0x5b')][_0x532b('0x61')]=!![];_0x20b70c[_0x532b('0x5b')][_0x532b('0x62')]=moment()[_0x532b('0x63')](_0x532b('0x64'));_0x20b70c['body'][_0x532b('0x65')]=_0x20b70c[_0x532b('0x5b')][_0x532b('0x65')]||_0x20b70c['user']['id'];return db[_0x532b('0x3f')][_0x532b('0x58')]({'where':{'id':_0x20b70c[_0x532b('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x532b('0x66')],'as':_0x532b('0x67')}]})['then'](handleEntityNotFound(_0x10c162,null))[_0x532b('0x26')](saveUpdates(_0x20b70c[_0x532b('0x5b')],null))[_0x532b('0x26')](function(_0x52dc88){if(_0x52dc88){_0x7bacdb[_0x532b('0x2e')]=_0x52dc88[_0x532b('0x68')]({'plain':!![]});return db[_0x532b('0x69')]['find']({'where':{'id':_0x52dc88[_0x532b('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x10c162,null))[_0x532b('0x26')](function(_0x3c786a){if(_0x3c786a){return _0x3c786a[_0x532b('0x38')]({'UserId':_0x20b70c[_0x532b('0x5b')][_0x532b('0x65')],'read1stAt':_[_0x532b('0x6b')](_0x3c786a[_0x532b('0x6c')])?moment()[_0x532b('0x63')](_0x532b('0x64')):undefined});}return null;})[_0x532b('0x26')](function(_0x33201d){if(_0x33201d){_0x7bacdb[_0x532b('0x6d')]=_0x33201d[_0x532b('0x68')]({'plain':!![]});interaction_log['info'](_0x532b('0x6e'),_0x20b70c[_0x532b('0x6f')]['id'],_0x20b70c[_0x532b('0x6f')][_0x532b('0x3c')],_0x20b70c[_0x532b('0x6f')][_0x532b('0x70')],_0x7bacdb[_0x532b('0x6d')]['id'],_0x20b70c[_0x532b('0x5b')]?JSON[_0x532b('0x2b')](_0x20b70c[_0x532b('0x5b')]):'null');return respondWithRpcPromise(_0x532b('0x71'),_0x532b('0x72'),_0x7bacdb);}return null;})[_0x532b('0x26')](function(_0x12d16e){if(_0x12d16e){if(_0x20b70c['body'][_0x532b('0x73')]){_0x7bacdb[_0x532b('0x2e')][_0x532b('0x74')]=util[_0x532b('0x63')]('SIP/%s',_0x20b70c[_0x532b('0x6f')][_0x532b('0x3c')]);_0x7bacdb[_0x532b('0x2e')][_0x532b('0x75')]=_0x7bacdb['channel'];_0x7bacdb[_0x532b('0x2e')][_0x532b('0x76')]=_0x532b('0x77');return respondWithRpcPromise(_0x532b('0x78'),_0x532b('0x78'),{'event':_0x532b('0x79'),'message':_0x7bacdb[_0x532b('0x2e')]},client9002)[_0x532b('0x26')](function(){return _0x7bacdb;});}return _0x7bacdb;}return null;})['then'](respondWithResult(_0x10c162,null))[_0x532b('0x59')](handleError(_0x10c162,null));};var interaction_log=require(_0x532b('0x16'))(_0x532b('0x5f'));exports['reject']=function(_0x3dba7b,_0x298e8b,_0xecb57c){var _0x4e8fda={'agent':{},'channel':_0x532b('0x60')};if(_0x3dba7b[_0x532b('0x5b')]['id']){delete _0x3dba7b[_0x532b('0x5b')]['id'];}_0x3dba7b[_0x532b('0x5b')][_0x532b('0x65')]=_0x3dba7b['body'][_0x532b('0x65')]||_0x3dba7b[_0x532b('0x6f')]['id'];_0x4e8fda[_0x532b('0x7a')]['id']=_0x3dba7b['body'][_0x532b('0x65')];return db[_0x532b('0x3f')][_0x532b('0x58')]({'where':{'id':_0x3dba7b['params']['id'],'UserId':null}})[_0x532b('0x26')](handleEntityNotFound(_0x298e8b,null))[_0x532b('0x26')](function(_0x29d6a8){if(_0x29d6a8){_0x4e8fda[_0x532b('0x2e')]=_0x29d6a8['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x532b('0x58')]({'where':{'id':_0x29d6a8[_0x532b('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x298e8b,null))[_0x532b('0x26')](function(_0x7555f9){if(_0x7555f9){_0x4e8fda[_0x532b('0x6d')]=_0x7555f9['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3dba7b[_0x532b('0x6f')]['id'],_0x3dba7b[_0x532b('0x6f')]['name'],_0x3dba7b[_0x532b('0x6f')]['role'],_0x4e8fda[_0x532b('0x6d')]['id'],_0x3dba7b[_0x532b('0x5b')]?JSON[_0x532b('0x2b')](_0x3dba7b[_0x532b('0x5b')]):_0x532b('0x7b'));return respondWithRpcPromise(_0x532b('0x7c'),'rejectMessage',_0x4e8fda);}return null;})[_0x532b('0x26')](function(_0x5c7759){if(_0x5c7759){_0x5c7759[_0x532b('0x2e')][_0x532b('0x74')]=util[_0x532b('0x63')](_0x532b('0x7d'),_0x3dba7b['user'][_0x532b('0x3c')]);_0x5c7759[_0x532b('0x2e')][_0x532b('0x75')]=_0x4e8fda[_0x532b('0x75')];_0x5c7759[_0x532b('0x2e')][_0x532b('0x76')]=_0x532b('0x7e');respondWithRpcPromise(_0x532b('0x78'),'EventManager',{'event':_0x532b('0x7f'),'message':_0x5c7759['message']},client9002);return _0x4e8fda;}return null;})['then'](respondWithResult(_0x298e8b,null))[_0x532b('0x59')](handleError(_0x298e8b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a8f833f..c1bc324 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 _0x9ef8=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x9ef8,0x14f));var _0x89ef=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x9ef8[_0x3c2b2e];return _0x27a338;};'use strict';var EventEmitter=require(_0x89ef('0x0'));var OpenchannelMessage=require(_0x89ef('0x1'))['db'][_0x89ef('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x89ef('0x3'),'afterUpdate':_0x89ef('0x4'),'afterDestroy':_0x89ef('0x5')};function emitEvent(_0x57568e){return function(_0x121af1,_0x1160fe,_0x497c79){OpenchannelMessageEvents[_0x89ef('0x6')](_0x57568e+':'+_0x121af1['id'],_0x121af1);OpenchannelMessageEvents[_0x89ef('0x6')](_0x57568e,_0x121af1);_0x497c79(null);};}for(var e in events){if(events[_0x89ef('0x7')](e)){var event=events[e];OpenchannelMessage[_0x89ef('0x8')](e,emitEvent(event));}}module[_0x89ef('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x5eff=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x3b662b,_0x5dab5a){var _0x1c968a=function(_0x323d92){while(--_0x323d92){_0x3b662b['push'](_0x3b662b['shift']());}};_0x1c968a(++_0x5dab5a);}(_0x5eff,0x1d8));var _0xf5ef=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5eff[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xf5ef('0x0'));var OpenchannelMessage=require(_0xf5ef('0x1'))['db'][_0xf5ef('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf5ef('0x3')](0x0);var events={'afterCreate':_0xf5ef('0x4'),'afterUpdate':'update','afterDestroy':_0xf5ef('0x5')};function emitEvent(_0x1a9b47){return function(_0x3fd0b8,_0x454182,_0x3b26ab){OpenchannelMessageEvents['emit'](_0x1a9b47+':'+_0x3fd0b8['id'],_0x3fd0b8);OpenchannelMessageEvents[_0xf5ef('0x6')](_0x1a9b47,_0x3fd0b8);_0x3b26ab(null);};}for(var e in events){if(events[_0xf5ef('0x7')](e)){var event=events[e];OpenchannelMessage[_0xf5ef('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 48b25e4..1bd7f60 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 _0x432b=['body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt','error','out','CmContact','describe','then','OpenchannelAccount','OpenchannelInteraction','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','method','GET','POST','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x47c112,_0x3b3f62){var _0x2eb251=function(_0x4706bf){while(--_0x4706bf){_0x47c112['push'](_0x47c112['shift']());}};_0x2eb251(++_0x3b3f62);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var moment=require(_0xb432('0x3'));var BPromise=require(_0xb432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb432('0x5'));var config=require('../../config/environment');var attributes=require(_0xb432('0x6'));module['exports']=function(_0x143093,_0x3f1a78){return _0x143093[_0xb432('0x7')](_0xb432('0x8'),attributes,{'tableName':_0xb432('0x9'),'paranoid':![],'indexes':[{'name':_0xb432('0xa'),'fields':[_0xb432('0xb')],'type':_0xb432('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e4302,_0x12adbe,_0xca5a23){var _0x2bc6e5=_0x143093[_0xb432('0xd')];var _0x28fdde=_0x4e4302[_0xb432('0xe')]({'plain':!![]});if(_0x28fdde['direction']['toLowerCase']()==='in'||_0x28fdde[_0xb432('0xf')][_0xb432('0x10')]()==='out'&&!_0x28fdde[_0xb432('0x11')]&&!_[_0xb432('0x12')](_0x28fdde[_0xb432('0x13')])){_0x2bc6e5['OpenchannelInteraction'][_0xb432('0x14')]({'where':{'id':_0x28fdde[_0xb432('0x15')]}})['then'](function(_0x272c47){if(_0x272c47){_0x272c47[_0xb432('0x16')]({'lastMsgAt':_0x28fdde[_0xb432('0x17')],'lastMsgDirection':_0x28fdde[_0xb432('0xf')][_0xb432('0x10')]()});}})['catch'](function(_0x5e4aae){console[_0xb432('0x18')](_0x5e4aae);});}if(_0x28fdde[_0xb432('0xf')]===_0xb432('0x19')&&!_0x28fdde[_0xb432('0x11')]){var _0x27365c;_0x2bc6e5[_0xb432('0x1a')][_0xb432('0x1b')]()[_0xb432('0x1c')](function(_0x375775){return _0x2bc6e5[_0xb432('0x1d')]['find']({'where':{'id':_0x28fdde['OpenchannelAccountId']},'include':[{'model':_0x2bc6e5[_0xb432('0x1e')],'as':_0xb432('0x1f'),'where':{'id':_0x28fdde[_0xb432('0x15')]},'limit':0x1,'include':[{'model':_0x2bc6e5[_0xb432('0x1a')],'as':'Contact','attributes':_[_0xb432('0x20')](_0x375775)}]}]});})[_0xb432('0x1c')](function(_0x284b5a){_0x27365c=_0x284b5a[_0xb432('0xe')]({'plain':!![]});if(_0x27365c&&_0x27365c[_0xb432('0x21')]){logger[_0xb432('0x22')](_0xb432('0x23'),_0xb432('0x24'),util['format'](_0xb432('0x25'),_0x28fdde['id'],_0x27365c[_0xb432('0x21')]));if(_0x27365c['Interactions']&&_0x27365c[_0xb432('0x1f')][_0xb432('0x26')]){_0x28fdde[_0xb432('0x27')]=_[_0xb432('0x28')](_0x27365c[_0xb432('0x1f')][0x0],_0xb432('0x29'));_0x28fdde[_0xb432('0x29')]=_0x27365c[_0xb432('0x1f')][0x0][_0xb432('0x29')];}var _0x12adbe={'method':'POST','uri':encodeURI(_0x27365c[_0xb432('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x12adbe[_0xb432('0x2a')]){case _0xb432('0x2b'):_0x12adbe['qs']=_0x28fdde;break;case _0xb432('0x2c'):_0x12adbe[_0xb432('0xb')]=_0x28fdde;break;}return rp(_0x12adbe)[_0xb432('0x1c')](function(_0x5ce616){logger[_0xb432('0x22')](_0xb432('0x23'),_0xb432('0x24'),util[_0xb432('0x2d')](_0xb432('0x2e'),_0x28fdde['id'],_0x27365c[_0xb432('0x21')]));if(_0x5ce616[_0xb432('0xb')][_0xb432('0x2f')]&&_0x5ce616[_0xb432('0xb')]['threadId']!=_0x28fdde[_0xb432('0x27')][_0xb432('0x2f')]){return _0x2bc6e5[_0xb432('0x1e')][_0xb432('0x16')]({'threadId':_0x5ce616[_0xb432('0xb')][_0xb432('0x2f')]},{'logging':!![],'where':{'id':_0x28fdde[_0xb432('0x27')]['id']}});}else{return;}})[_0xb432('0x1c')](function(){return _0x4e4302[_0xb432('0x16')]({'read':!![]});})[_0xb432('0x30')](function(_0x405737){logger[_0xb432('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0xb432('0x24'),util['inspect'](_0x405737,{'showHidden':![],'depth':null}));_0xca5a23();});}else{_0xca5a23();}})[_0xb432('0x31')](function(){_0xca5a23();});}else{_0xca5a23();}}},'charset':_0xb432('0x32'),'collate':_0xb432('0x33')});}; \ No newline at end of file +var _0x99c9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','error','CmContact','describe','then','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','GET','info','threadId','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x6f029b,_0x388ce5){var _0x42c618=function(_0x3b018f){while(--_0x3b018f){_0x6f029b['push'](_0x6f029b['shift']());}};_0x42c618(++_0x388ce5);}(_0x99c9,0x13c));var _0x999c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x99c9[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require(_0x999c('0x5'));var rp=require(_0x999c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var attributes=require(_0x999c('0x9'));module[_0x999c('0xa')]=function(_0x2bdd73,_0x14df32){return _0x2bdd73[_0x999c('0xb')](_0x999c('0xc'),attributes,{'tableName':_0x999c('0xd'),'paranoid':![],'indexes':[{'name':_0x999c('0xe'),'fields':[_0x999c('0xf')],'type':_0x999c('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32984f,_0x395321,_0x4dd585){var _0x1f3f8f=_0x2bdd73[_0x999c('0x11')];var _0x574ba0=_0x32984f[_0x999c('0x12')]({'plain':!![]});if(_0x574ba0[_0x999c('0x13')][_0x999c('0x14')]()==='in'||_0x574ba0[_0x999c('0x13')][_0x999c('0x14')]()===_0x999c('0x15')&&!_0x574ba0[_0x999c('0x16')]&&!_[_0x999c('0x17')](_0x574ba0[_0x999c('0x18')])){_0x1f3f8f[_0x999c('0x19')][_0x999c('0x1a')]({'where':{'id':_0x574ba0[_0x999c('0x1b')]}})['then'](function(_0x15f812){if(_0x15f812){_0x15f812[_0x999c('0x1c')]({'lastMsgAt':_0x574ba0['createdAt'],'lastMsgDirection':_0x574ba0['direction']['toLowerCase']()});}})[_0x999c('0x1d')](function(_0xb3e981){console[_0x999c('0x1e')](_0xb3e981);});}if(_0x574ba0[_0x999c('0x13')]===_0x999c('0x15')&&!_0x574ba0['secret']){var _0x226437;_0x1f3f8f[_0x999c('0x1f')][_0x999c('0x20')]()[_0x999c('0x21')](function(_0x110486){return _0x1f3f8f['OpenchannelAccount'][_0x999c('0x22')]({'where':{'id':_0x574ba0[_0x999c('0x23')]},'include':[{'model':_0x1f3f8f[_0x999c('0x19')],'as':_0x999c('0x24'),'where':{'id':_0x574ba0[_0x999c('0x1b')]},'limit':0x1,'include':[{'model':_0x1f3f8f['CmContact'],'as':_0x999c('0x25'),'attributes':_[_0x999c('0x26')](_0x110486)}]}]});})[_0x999c('0x21')](function(_0x1ec406){_0x226437=_0x1ec406[_0x999c('0x12')]({'plain':!![]});if(_0x226437&&_0x226437[_0x999c('0x27')]){logger['info'](_0x999c('0x28'),_0x999c('0x29'),util[_0x999c('0x2a')](_0x999c('0x2b'),_0x574ba0['id'],_0x226437[_0x999c('0x27')]));if(_0x226437[_0x999c('0x24')]&&_0x226437[_0x999c('0x24')][_0x999c('0x2c')]){_0x574ba0[_0x999c('0x2d')]=_[_0x999c('0x2e')](_0x226437[_0x999c('0x24')][0x0],'Contact');_0x574ba0[_0x999c('0x25')]=_0x226437[_0x999c('0x24')][0x0][_0x999c('0x25')];}var _0x395321={'method':_0x999c('0x2f'),'uri':encodeURI(_0x226437[_0x999c('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x395321['method']){case _0x999c('0x30'):_0x395321['qs']=_0x574ba0;break;case _0x999c('0x2f'):_0x395321[_0x999c('0xf')]=_0x574ba0;break;}return rp(_0x395321)['then'](function(_0x1abac6){logger[_0x999c('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x999c('0x29'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x574ba0['id'],_0x226437[_0x999c('0x27')]));if(_0x1abac6[_0x999c('0xf')][_0x999c('0x32')]&&_0x1abac6[_0x999c('0xf')][_0x999c('0x32')]!=_0x574ba0[_0x999c('0x2d')][_0x999c('0x32')]){return _0x1f3f8f[_0x999c('0x19')][_0x999c('0x1c')]({'threadId':_0x1abac6[_0x999c('0xf')]['threadId']},{'logging':!![],'where':{'id':_0x574ba0[_0x999c('0x2d')]['id']}});}else{return;}})[_0x999c('0x21')](function(){return _0x32984f[_0x999c('0x1c')]({'read':!![]});})[_0x999c('0x1d')](function(_0x11b1e5){logger[_0x999c('0x1e')](_0x999c('0x28'),_0x999c('0x29'),util['inspect'](_0x11b1e5,{'showHidden':![],'depth':null}));_0x4dd585();});}else{_0x4dd585();}})['finally'](function(){_0x4dd585();});}else{_0x4dd585();}}},'charset':_0x999c('0x33'),'collate':_0x999c('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index fef3f94..adf98d6 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 _0x1bb4=['create','body','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','./openchannelMessage.socket','register','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelMessage'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x3e7045,_0x3d28ad){_0x3e7045=_0x3e7045-0x0;var _0x2cd0cc=_0x1bb4[_0x3e7045];return _0x2cd0cc;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var moment=require(_0x41bb('0x2'));var BPromise=require(_0x41bb('0x3'));var rs=require(_0x41bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41bb('0x6'))('rpc');var config=require(_0x41bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41bb('0x8')][_0x41bb('0x9')]({'port':0x232a});config[_0x41bb('0xa')]=_['defaults'](config[_0x41bb('0xa')],{'host':_0x41bb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41bb('0xa')]));require(_0x41bb('0xc'))[_0x41bb('0xd')](socket);function respondWithRpcPromise(_0x570b82,_0xabb584,_0x25e298){return new BPromise(function(_0x27ce2d,_0x238449){return client[_0x41bb('0xe')](_0x570b82,_0x25e298)['then'](function(_0x78af1d){logger[_0x41bb('0xf')](_0x41bb('0x10'),_0xabb584,_0x41bb('0x11'));logger[_0x41bb('0x12')](_0x41bb('0x13'),_0xabb584,_0x41bb('0x11'),JSON[_0x41bb('0x14')](_0x78af1d));if(_0x78af1d['error']){if(_0x78af1d['error']['code']===0x1f4){logger[_0x41bb('0x15')](_0x41bb('0x10'),_0xabb584,_0x78af1d[_0x41bb('0x15')]['message']);return _0x238449(_0x78af1d['error'][_0x41bb('0x16')]);}logger[_0x41bb('0x15')](_0x41bb('0x10'),_0xabb584,_0x78af1d[_0x41bb('0x15')][_0x41bb('0x16')]);return _0x27ce2d(_0x78af1d['error'][_0x41bb('0x16')]);}else{logger['info'](_0x41bb('0x10'),_0xabb584,_0x41bb('0x11'));_0x27ce2d(_0x78af1d['result'][_0x41bb('0x16')]);}})[_0x41bb('0x17')](function(_0x57617b){logger['error'](_0x41bb('0x10'),_0xabb584,_0x57617b);_0x238449(_0x57617b);});});}exports['CreateOpenchannelMessage']=function(_0x38260a){var _0x4737db=this;return new Promise(function(_0x2d6b67,_0x2be518){return db[_0x41bb('0x18')][_0x41bb('0x19')](_0x38260a[_0x41bb('0x1a')],{'raw':_0x38260a[_0x41bb('0x1b')]?_0x38260a[_0x41bb('0x1b')][_0x41bb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x29b356){logger[_0x41bb('0xf')](_0x41bb('0x1d'),_0x38260a);logger[_0x41bb('0x12')]('CreateOpenchannelMessage',_0x38260a,JSON['stringify'](_0x29b356));_0x2d6b67(_0x29b356);})[_0x41bb('0x17')](function(_0x1d4909){logger[_0x41bb('0x15')]('CreateOpenchannelMessage',_0x1d4909[_0x41bb('0x16')],_0x38260a);_0x2be518(_0x4737db[_0x41bb('0x15')](0x1f4,_0x1d4909['message']));});});}; \ No newline at end of file +var _0x0650=['CreateOpenchannelMessage','options','then','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch'];(function(_0x11789e,_0x3af92f){var _0x3a77df=function(_0x59dacc){while(--_0x59dacc){_0x11789e['push'](_0x11789e['shift']());}};_0x3a77df(++_0x3af92f);}(_0x0650,0xed));var _0x0065=function(_0x50859e,_0x2c958a){_0x50859e=_0x50859e-0x0;var _0x5847a2=_0x0650[_0x50859e];return _0x5847a2;};'use strict';var _=require(_0x0065('0x0'));var util=require('util');var moment=require(_0x0065('0x1'));var BPromise=require(_0x0065('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0065('0x4'));var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require('../../config/environment');var jayson=require(_0x0065('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0065('0x8')](config[_0x0065('0x9')],{'host':_0x0065('0xa'),'port':0x18eb});var socket=require(_0x0065('0xb'))(new Redis(config[_0x0065('0x9')]));require(_0x0065('0xc'))[_0x0065('0xd')](socket);function respondWithRpcPromise(_0x3e96dd,_0x409066,_0x5907e4){return new BPromise(function(_0x2850c0,_0xda5ef2){return client['request'](_0x3e96dd,_0x5907e4)['then'](function(_0x4c8f33){logger[_0x0065('0xe')](_0x0065('0xf'),_0x409066,'request\x20sent');logger[_0x0065('0x10')](_0x0065('0x11'),_0x409066,'request\x20sent',JSON[_0x0065('0x12')](_0x4c8f33));if(_0x4c8f33[_0x0065('0x13')]){if(_0x4c8f33['error']['code']===0x1f4){logger[_0x0065('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x409066,_0x4c8f33['error'][_0x0065('0x14')]);return _0xda5ef2(_0x4c8f33['error'][_0x0065('0x14')]);}logger['error'](_0x0065('0xf'),_0x409066,_0x4c8f33[_0x0065('0x13')][_0x0065('0x14')]);return _0x2850c0(_0x4c8f33[_0x0065('0x13')][_0x0065('0x14')]);}else{logger[_0x0065('0xe')](_0x0065('0xf'),_0x409066,_0x0065('0x15'));_0x2850c0(_0x4c8f33['result'][_0x0065('0x14')]);}})[_0x0065('0x16')](function(_0x49de99){logger[_0x0065('0x13')](_0x0065('0xf'),_0x409066,_0x49de99);_0xda5ef2(_0x49de99);});});}exports[_0x0065('0x17')]=function(_0x2eed20){var _0x44c2e0=this;return new Promise(function(_0x3eee18,_0x319e7a){return db['OpenchannelMessage']['create'](_0x2eed20['body'],{'raw':_0x2eed20[_0x0065('0x18')]?_0x2eed20[_0x0065('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0065('0x19')](function(_0x5f1733){logger[_0x0065('0xe')](_0x0065('0x17'),_0x2eed20);logger[_0x0065('0x10')](_0x0065('0x17'),_0x2eed20,JSON[_0x0065('0x12')](_0x5f1733));_0x3eee18(_0x5f1733);})[_0x0065('0x16')](function(_0x3503e){logger['error'](_0x0065('0x17'),_0x3503e['message'],_0x2eed20);_0x319e7a(_0x44c2e0['error'](0x1f4,_0x3503e[_0x0065('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 833237f..a7cbe18 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 _0xbdb7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0xbdb7[_0x671369];return _0x33f2b4;};'use strict';var OpenchannelMessageEvents=require(_0x7bdb('0x0'));var events=[_0x7bdb('0x1'),_0x7bdb('0x2'),_0x7bdb('0x3')];function createListener(_0x23c326,_0x433850){return function(_0x4496ac){_0x433850[_0x7bdb('0x4')](_0x23c326,_0x4496ac);};}function removeListener(_0x46c068,_0x47aec5){return function(){OpenchannelMessageEvents[_0x7bdb('0x5')](_0x46c068,_0x47aec5);};}exports['register']=function(_0x4b5fff){for(var _0xffdc86=0x0,_0x1e23a3=events['length'];_0xffdc86<_0x1e23a3;_0xffdc86++){var _0x513cba=events[_0xffdc86];var _0x468041=createListener(_0x7bdb('0x6')+_0x513cba,_0x4b5fff);OpenchannelMessageEvents['on'](_0x513cba,_0x468041);}}; \ No newline at end of file +var _0xbdb7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x58f57f,_0x23028c){_0x58f57f=_0x58f57f-0x0;var _0x318b7f=_0xbdb7[_0x58f57f];return _0x318b7f;};'use strict';var OpenchannelMessageEvents=require(_0x7bdb('0x0'));var events=[_0x7bdb('0x1'),_0x7bdb('0x2'),_0x7bdb('0x3')];function createListener(_0x23c326,_0x433850){return function(_0x4496ac){_0x433850[_0x7bdb('0x4')](_0x23c326,_0x4496ac);};}function removeListener(_0x46c068,_0x47aec5){return function(){OpenchannelMessageEvents[_0x7bdb('0x5')](_0x46c068,_0x47aec5);};}exports['register']=function(_0x4b5fff){for(var _0xffdc86=0x0,_0x1e23a3=events['length'];_0xffdc86<_0x1e23a3;_0xffdc86++){var _0x513cba=events[_0xffdc86];var _0x468041=createListener(_0x7bdb('0x6')+_0x513cba,_0x4b5fff);OpenchannelMessageEvents['on'](_0x513cba,_0x468041);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 154e0e1..a17dcd1 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 _0xcd05=['update','destroy','delete','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0x20a196,_0x16409f){var _0x27953e=function(_0x1616fe){while(--_0x1616fe){_0x20a196['push'](_0x20a196['shift']());}};_0x27953e(++_0x16409f);}(_0xcd05,0x163));var _0x5cd0=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xcd05[_0x4d6ac0];return _0x5296c4;};'use strict';var multer=require(_0x5cd0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cd0('0x1'));var router=express[_0x5cd0('0x2')]();var auth=require(_0x5cd0('0x3'));var interaction=require(_0x5cd0('0x4'));var config=require('../../config/environment');var controller=require(_0x5cd0('0x5'));router[_0x5cd0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5cd0('0x7'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x9')]);router[_0x5cd0('0x6')](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xb')]);router['get'](_0x5cd0('0xc'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xd')]);router[_0x5cd0('0x6')]('/:id/teams',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xe')]);router[_0x5cd0('0x6')](_0x5cd0('0xf'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x10')]);router[_0x5cd0('0x11')]('/',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x12')]);router[_0x5cd0('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5cd0('0x11')](_0x5cd0('0xf'),auth['isAuthenticated'](),controller[_0x5cd0('0x13')]);router['put'](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x14')]);router['delete']('/:id',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x15')]);router[_0x5cd0('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x5cd0('0x16')](_0x5cd0('0xf'),auth['isAuthenticated'](),controller[_0x5cd0('0x17')]);module[_0x5cd0('0x18')]=router; \ No newline at end of file +var _0x6f7b=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x39faf9,_0x560228){var _0x1cd6fc=function(_0x46baa5){while(--_0x46baa5){_0x39faf9['push'](_0x39faf9['shift']());}};_0x1cd6fc(++_0x560228);}(_0x6f7b,0x168));var _0xb6f7=function(_0x3940e3,_0x2052d0){_0x3940e3=_0x3940e3-0x0;var _0x1cc83b=_0x6f7b[_0x3940e3];return _0x1cc83b;};'use strict';var multer=require('multer');var util=require(_0xb6f7('0x0'));var path=require(_0xb6f7('0x1'));var timeout=require(_0xb6f7('0x2'));var express=require(_0xb6f7('0x3'));var router=express[_0xb6f7('0x4')]();var auth=require(_0xb6f7('0x5'));var interaction=require(_0xb6f7('0x6'));var config=require('../../config/environment');var controller=require(_0xb6f7('0x7'));router['get']('/',auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x9')]);router[_0xb6f7('0xa')](_0xb6f7('0xb'),auth['isAuthenticated'](),controller[_0xb6f7('0xc')]);router[_0xb6f7('0xa')](_0xb6f7('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb6f7('0xe'),auth[_0xb6f7('0x8')](),controller[_0xb6f7('0xf')]);router[_0xb6f7('0xa')](_0xb6f7('0x10'),auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x11')]);router[_0xb6f7('0xa')](_0xb6f7('0x12'),auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x13')]);router[_0xb6f7('0x14')]('/',auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x15')]);router[_0xb6f7('0x14')](_0xb6f7('0x10'),auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x16')]);router[_0xb6f7('0x14')](_0xb6f7('0x12'),auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x17')]);router[_0xb6f7('0x18')](_0xb6f7('0xd'),auth['isAuthenticated'](),controller[_0xb6f7('0x19')]);router[_0xb6f7('0x1a')](_0xb6f7('0xd'),auth[_0xb6f7('0x8')](),controller['destroy']);router[_0xb6f7('0x1a')](_0xb6f7('0x10'),auth[_0xb6f7('0x8')](),controller['removeTeams']);router[_0xb6f7('0x1a')](_0xb6f7('0x12'),auth[_0xb6f7('0x8')](),controller[_0xb6f7('0x1b')]);module[_0xb6f7('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 8d72537..9e0274e 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 _0xef0f=['sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x4c0567,_0x52eca7){var _0x2c06db=function(_0x1c3e7d){while(--_0x1c3e7d){_0x4c0567['push'](_0x4c0567['shift']());}};_0x2c06db(++_0x52eca7);}(_0xef0f,0x168));var _0xfef0=function(_0x22af13,_0x30663){_0x22af13=_0x22af13-0x0;var _0x478f13=_0xef0f[_0x22af13];return _0x478f13;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfef0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfef0('0x3')](_0xfef0('0x4'),_0xfef0('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x720f=['ENUM','beepall','exports','STRING','name','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x720f,0x80));var _0xf720=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x720f[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require('sequelize');module[_0xf720('0x0')]={'name':{'type':Sequelize[_0xf720('0x1')],'unique':_0xf720('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf720('0x1')]},'timeout':{'type':Sequelize[_0xf720('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf720('0x4')]('rrmemory',_0xf720('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a18c51e..d72c495 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 _0x3fe0=['OpenchannelQueue','findAll','rows','catch','show','params','keys','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','openchannelPause','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0x3fe0,0x1e1));var _0x03fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fe0[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x03fe('0x0'));var emlformat=require(_0x03fe('0x1'));var rimraf=require(_0x03fe('0x2'));var zipdir=require(_0x03fe('0x3'));var jsonpatch=require(_0x03fe('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03fe('0x5'));var util=require(_0x03fe('0x6'));var path=require(_0x03fe('0x7'));var sox=require(_0x03fe('0x8'));var csv=require(_0x03fe('0x9'));var ejs=require(_0x03fe('0xa'));var fs=require('fs');var _=require(_0x03fe('0xb'));var squel=require(_0x03fe('0xc'));var crypto=require(_0x03fe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x03fe('0xe'));var toCsv=require(_0x03fe('0x9'));var querystring=require('querystring');var Papa=require(_0x03fe('0xf'));var Redis=require(_0x03fe('0x10'));var authService=require(_0x03fe('0x11'));var qs=require(_0x03fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03fe('0x13'))(_0x03fe('0x14'));var utils=require(_0x03fe('0x15'));var config=require(_0x03fe('0x16'));var db=require(_0x03fe('0x17'))['db'];config[_0x03fe('0x18')]=_['defaults'](config[_0x03fe('0x18')],{'host':_0x03fe('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03fe('0x18')]));require(_0x03fe('0x1a'))[_0x03fe('0x1b')](socket);function respondWithStatusCode(_0x36ac38,_0x59233e){_0x59233e=_0x59233e||0xcc;return function(_0x45bf49){if(_0x45bf49){return _0x36ac38[_0x03fe('0x1c')](_0x59233e);}return _0x36ac38[_0x03fe('0x1d')](_0x59233e)[_0x03fe('0x1e')]();};}function respondWithResult(_0x5ada1c,_0x153f3d){_0x153f3d=_0x153f3d||0xc8;return function(_0x295ff6){if(_0x295ff6){return _0x5ada1c[_0x03fe('0x1d')](_0x153f3d)['json'](_0x295ff6);}};}function respondWithFilteredResult(_0x55209a,_0x2c8979){return function(_0xcc14e2){if(_0xcc14e2){var _0x2d35b3=_0xcc14e2[_0x03fe('0x1f')],_0x3490b2=_0x2c8979[_0x03fe('0x20')],_0x3ac86e=_0x2c8979['offset']+_0x2c8979['limit'],_0xc55a56;if(_0x3ac86e>=_0x2d35b3){_0x3ac86e=_0x2d35b3;_0xc55a56=0xc8;}else{_0xc55a56=0xce;}_0x55209a[_0x03fe('0x1d')](_0xc55a56);return _0x55209a[_0x03fe('0x21')](_0x03fe('0x22'),_0x3490b2+'-'+_0x3ac86e+'/'+_0x2d35b3)[_0x03fe('0x23')](_0xcc14e2);}return null;};}function patchUpdates(_0x118aa4){return function(_0x361e57){try{jsonpatch['apply'](_0x361e57,_0x118aa4,!![]);}catch(_0x411caa){return BPromise[_0x03fe('0x24')](_0x411caa);}return _0x361e57[_0x03fe('0x25')]();};}function saveUpdates(_0x34cb31,_0x2c4cac){return function(_0xdaed03){if(_0xdaed03){return _0xdaed03[_0x03fe('0x26')](_0x34cb31)[_0x03fe('0x27')](function(_0x34dc59){return _0x34dc59;});}return null;};}function removeEntity(_0x3e4fe8,_0x3b1fd1){return function(_0xdec90b){if(_0xdec90b){return _0xdec90b['destroy']()['then'](function(){var _0xeaec79=_0xdec90b[_0x03fe('0x28')]({'plain':!![]});var _0x47ebde=_0x03fe('0x29');return db[_0x03fe('0x2a')][_0x03fe('0x2b')]({'where':{'type':_0x47ebde,'resourceId':_0xeaec79['id']}})[_0x03fe('0x27')](function(){return _0xdec90b;});})[_0x03fe('0x27')](function(){_0x3e4fe8[_0x03fe('0x1d')](0xcc)[_0x03fe('0x1e')]();});}};}function handleEntityNotFound(_0x153efe,_0x44248c){return function(_0x28f5ee){if(!_0x28f5ee){_0x153efe[_0x03fe('0x1c')](0x194);}return _0x28f5ee;};}function handleError(_0x3ab767,_0x342ce2){_0x342ce2=_0x342ce2||0x1f4;return function(_0x4ce40b){logger[_0x03fe('0x2c')](_0x4ce40b['stack']);if(_0x4ce40b[_0x03fe('0x2d')]){delete _0x4ce40b['name'];}_0x3ab767['status'](_0x342ce2)[_0x03fe('0x2e')](_0x4ce40b);};}exports[_0x03fe('0x2f')]=function(_0x40118c,_0xea0533){var _0x327cbb={},_0x25aead={},_0x355c11={'count':0x0,'rows':[]};var _0xcfa0b2=_[_0x03fe('0x30')](db['OpenchannelQueue'][_0x03fe('0x31')],function(_0x480499){return{'name':_0x480499['fieldName'],'type':_0x480499[_0x03fe('0x32')]['key']};});_0x25aead[_0x03fe('0x33')]=_['map'](_0xcfa0b2,'name');_0x25aead[_0x03fe('0x34')]=_['keys'](_0x40118c['query']);_0x25aead[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x25aead[_0x03fe('0x33')],_0x25aead[_0x03fe('0x34')]);_0x327cbb[_0x03fe('0x37')]=_[_0x03fe('0x36')](_0x25aead[_0x03fe('0x33')],qs[_0x03fe('0x38')](_0x40118c[_0x03fe('0x34')]['fields']));_0x327cbb['attributes']=_0x327cbb[_0x03fe('0x37')]['length']?_0x327cbb[_0x03fe('0x37')]:_0x25aead[_0x03fe('0x33')];if(!_0x40118c[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x327cbb[_0x03fe('0x3b')]=qs[_0x03fe('0x3b')](_0x40118c[_0x03fe('0x34')][_0x03fe('0x3b')]);_0x327cbb['offset']=qs['offset'](_0x40118c['query']['offset']);}_0x327cbb[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x40118c['query'][_0x03fe('0x3d')]);_0x327cbb[_0x03fe('0x3e')]=qs[_0x03fe('0x35')](_[_0x03fe('0x3f')](_0x40118c[_0x03fe('0x34')],_0x25aead[_0x03fe('0x35')]),_0xcfa0b2);if(_0x40118c[_0x03fe('0x34')]['filter']){_0x327cbb[_0x03fe('0x3e')]=_['merge'](_0x327cbb[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0xcfa0b2,function(_0x379849){if(_0x379849[_0x03fe('0x32')]!=='VIRTUAL'){var _0x4ee294={};_0x4ee294[_0x379849[_0x03fe('0x2d')]]={'$like':'%'+_0x40118c[_0x03fe('0x34')][_0x03fe('0x40')]+'%'};return _0x4ee294;}})});}_0x327cbb=_[_0x03fe('0x41')]({},_0x327cbb,_0x40118c['options']);var _0x3118f0={'where':_0x327cbb[_0x03fe('0x3e')]};return db['OpenchannelQueue'][_0x03fe('0x1f')](_0x3118f0)[_0x03fe('0x27')](function(_0x369495){_0x355c11[_0x03fe('0x1f')]=_0x369495;if(_0x40118c[_0x03fe('0x34')]['includeAll']){_0x327cbb[_0x03fe('0x42')]=[{'all':!![]}];}return db[_0x03fe('0x43')][_0x03fe('0x44')](_0x327cbb);})[_0x03fe('0x27')](function(_0x32cf0a){_0x355c11[_0x03fe('0x45')]=_0x32cf0a;return _0x355c11;})[_0x03fe('0x27')](respondWithFilteredResult(_0xea0533,_0x327cbb))[_0x03fe('0x46')](handleError(_0xea0533,null));};exports[_0x03fe('0x47')]=function(_0xb8bed8,_0x58537b){var _0x9b7456={'raw':!![],'where':{'id':_0xb8bed8[_0x03fe('0x48')]['id']}},_0x38d949={};_0x38d949[_0x03fe('0x33')]=_[_0x03fe('0x49')](db[_0x03fe('0x43')][_0x03fe('0x31')]);_0x38d949[_0x03fe('0x34')]=_['keys'](_0xb8bed8[_0x03fe('0x34')]);_0x38d949[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x38d949[_0x03fe('0x33')],_0x38d949[_0x03fe('0x34')]);_0x9b7456['attributes']=_[_0x03fe('0x36')](_0x38d949[_0x03fe('0x33')],qs[_0x03fe('0x38')](_0xb8bed8['query']['fields']));_0x9b7456[_0x03fe('0x37')]=_0x9b7456['attributes'][_0x03fe('0x4a')]?_0x9b7456[_0x03fe('0x37')]:_0x38d949[_0x03fe('0x33')];if(_0xb8bed8[_0x03fe('0x34')]['includeAll']){_0x9b7456[_0x03fe('0x42')]=[{'all':!![]}];}_0x9b7456=_['merge']({},_0x9b7456,_0xb8bed8[_0x03fe('0x4b')]);return db['OpenchannelQueue']['find'](_0x9b7456)[_0x03fe('0x27')](handleEntityNotFound(_0x58537b,null))['then'](respondWithResult(_0x58537b,null))[_0x03fe('0x46')](handleError(_0x58537b,null));};exports[_0x03fe('0x4c')]=function(_0x46e85c,_0x5d37ed){return db[_0x03fe('0x43')]['create'](_0x46e85c[_0x03fe('0x4d')],{})[_0x03fe('0x27')](function(_0x3172f9){var _0x591eda=_0x46e85c['user'][_0x03fe('0x28')]({'plain':!![]});if(!_0x591eda)throw new Error(_0x03fe('0x4e'));if(_0x591eda[_0x03fe('0x4f')]===_0x03fe('0x50')){var _0x420d85=_0x3172f9[_0x03fe('0x28')]({'plain':!![]});var _0x5471fc=_0x03fe('0x29');return db[_0x03fe('0x51')][_0x03fe('0x52')]({'where':{'name':_0x5471fc,'userProfileId':_0x591eda['userProfileId']},'raw':!![]})[_0x03fe('0x27')](function(_0x366211){if(_0x366211&&_0x366211[_0x03fe('0x53')]===0x0){return db['UserProfileResource'][_0x03fe('0x4c')]({'name':_0x420d85[_0x03fe('0x2d')],'resourceId':_0x420d85['id'],'type':_0x366211['name'],'sectionId':_0x366211['id']},{})[_0x03fe('0x27')](function(){return _0x3172f9;});}else{return _0x3172f9;}})[_0x03fe('0x46')](function(_0x4d6e7f){logger['error'](_0x03fe('0x54'),_0x4d6e7f);throw _0x4d6e7f;});}return _0x3172f9;})[_0x03fe('0x27')](respondWithResult(_0x5d37ed,0xc9))[_0x03fe('0x46')](handleError(_0x5d37ed,null));};exports[_0x03fe('0x26')]=function(_0x2e87fc,_0x4b2d1c){if(_0x2e87fc[_0x03fe('0x4d')]['id']){delete _0x2e87fc[_0x03fe('0x4d')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x2e87fc[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x4b2d1c,null))[_0x03fe('0x27')](saveUpdates(_0x2e87fc['body'],null))[_0x03fe('0x27')](respondWithResult(_0x4b2d1c,null))[_0x03fe('0x46')](handleError(_0x4b2d1c,null));};exports[_0x03fe('0x2b')]=function(_0x398884,_0x5a94ec){return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x398884[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x5a94ec,null))[_0x03fe('0x27')](removeEntity(_0x5a94ec,null))[_0x03fe('0x46')](handleError(_0x5a94ec,null));};exports[_0x03fe('0x55')]=function(_0xc5d803,_0x445cfc){return db[_0x03fe('0x43')][_0x03fe('0x55')]()[_0x03fe('0x27')](respondWithResult(_0x445cfc,null))[_0x03fe('0x46')](handleError(_0x445cfc,null));};exports[_0x03fe('0x56')]=function(_0x5f3d79,_0x511f9d,_0x22032e){var _0x48670a={'raw':!![],'where':{}},_0x446706={},_0xe91aa9;return db[_0x03fe('0x43')][_0x03fe('0x57')]({'where':{'id':_0x5f3d79[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x511f9d,null))[_0x03fe('0x27')](function(_0x12f4f8){if(_0x12f4f8){_0xe91aa9=_0x12f4f8['get']({'plain':!![]});_0x446706[_0x03fe('0x33')]=_[_0x03fe('0x49')](db[_0x03fe('0x58')][_0x03fe('0x31')]);_0x446706['query']=_['keys'](_0x5f3d79[_0x03fe('0x34')]);_0x446706['filters']=_[_0x03fe('0x36')](_0x446706[_0x03fe('0x33')],_0x446706[_0x03fe('0x34')]);_0x48670a[_0x03fe('0x37')]=_[_0x03fe('0x36')](_0x446706['model'],qs['fields'](_0x5f3d79[_0x03fe('0x34')]['fields']));_0x48670a[_0x03fe('0x37')]=_0x48670a['attributes']['length']?_0x48670a['attributes']:_0x446706[_0x03fe('0x33')];if(!_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x48670a[_0x03fe('0x3b')]=qs['limit'](_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x3b')]);_0x48670a['offset']=qs[_0x03fe('0x20')](_0x5f3d79['query'][_0x03fe('0x20')]);}_0x48670a[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x3d')]);_0x48670a['where']=qs[_0x03fe('0x35')](_['pick'](_0x5f3d79[_0x03fe('0x34')],_0x446706[_0x03fe('0x35')]));_0x48670a[_0x03fe('0x3e')][_0x03fe('0x59')]=_0x12f4f8['id'];if(_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x40')]){_0x48670a[_0x03fe('0x3e')]=_[_0x03fe('0x41')](_0x48670a[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0x48670a[_0x03fe('0x37')],function(_0x510163){var _0x3143e4={};_0x3143e4[_0x510163]={'$like':'%'+_0x5f3d79['query']['filter']+'%'};return _0x3143e4;})});}_0x48670a=_[_0x03fe('0x41')]({},_0x48670a,_0x5f3d79[_0x03fe('0x4b')]);return db[_0x03fe('0x58')]['findAll'](_0x48670a);}})[_0x03fe('0x27')](function(_0xca9dec){if(_0xca9dec){return db[_0x03fe('0x5a')]['findAndCountAll']({'where':{'id':_[_0x03fe('0x30')](_0xca9dec,_0x03fe('0x5b')),'role':'agent'},'attributes':['id','name',_0x03fe('0x5c'),'updatedAt',_0x03fe('0x5d')]});}})[_0x03fe('0x27')](function(_0x31e46b){if(_0x31e46b){return{'count':_0x31e46b['count'],'rows':_[_0x03fe('0x30')](_0x31e46b['rows'],function(_0x384b8b){return{'membername':_0x384b8b[_0x03fe('0x2d')],'UserId':_0x384b8b['id'],'queue_name':_0xe91aa9[_0x03fe('0x2d')],'OpenchannelQueueId':_0xe91aa9['id'],'interface':util['format']('%s/%s',_0x03fe('0x5e'),_0x384b8b[_0x03fe('0x2d')]),'penalty':0x0,'paused':_0x384b8b[_0x03fe('0x5c')],'createdAt':_0x384b8b[_0x03fe('0x5d')],'updatedAt':_0x384b8b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x03fe('0x27')](respondWithFilteredResult(_0x511f9d,_0x48670a))[_0x03fe('0x46')](handleError(_0x511f9d,null));};exports[_0x03fe('0x5f')]=function(_0x283764,_0x2a7b2c,_0x3b4d5a){var _0x91e951={};var _0x5bba73={};var _0x2401f7;var _0x23d94b;return db[_0x03fe('0x43')][_0x03fe('0x57')]({'where':{'id':_0x283764[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x2a7b2c,null))[_0x03fe('0x27')](function(_0x2ac5f1){if(_0x2ac5f1){_0x2401f7=_0x2ac5f1;_0x5bba73['model']=_['keys'](db[_0x03fe('0x60')]['rawAttributes']);_0x5bba73[_0x03fe('0x34')]=_[_0x03fe('0x49')](_0x283764[_0x03fe('0x34')]);_0x5bba73[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x5bba73[_0x03fe('0x33')],_0x5bba73['query']);_0x91e951[_0x03fe('0x37')]=_[_0x03fe('0x36')](_0x5bba73['model'],qs[_0x03fe('0x38')](_0x283764[_0x03fe('0x34')][_0x03fe('0x38')]));_0x91e951[_0x03fe('0x37')]=_0x91e951[_0x03fe('0x37')]['length']?_0x91e951[_0x03fe('0x37')]:_0x5bba73[_0x03fe('0x33')];_0x91e951[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x283764[_0x03fe('0x34')][_0x03fe('0x3d')]);_0x91e951[_0x03fe('0x3e')]=qs[_0x03fe('0x35')](_['pick'](_0x283764['query'],_0x5bba73['filters']));if(_0x283764[_0x03fe('0x34')][_0x03fe('0x40')]){_0x91e951[_0x03fe('0x3e')]=_[_0x03fe('0x41')](_0x91e951[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0x91e951[_0x03fe('0x37')],function(_0x39ec73){var _0x3a9395={};_0x3a9395[_0x39ec73]={'$like':'%'+_0x283764[_0x03fe('0x34')]['filter']+'%'};return _0x3a9395;})});}_0x91e951=_[_0x03fe('0x41')]({},_0x91e951,_0x283764[_0x03fe('0x4b')]);return _0x2401f7[_0x03fe('0x5f')](_0x91e951);}})[_0x03fe('0x27')](function(_0xb587ff){if(_0xb587ff){_0x23d94b=_0xb587ff[_0x03fe('0x4a')];if(!_0x283764[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x91e951['limit']=qs[_0x03fe('0x3b')](_0x283764[_0x03fe('0x34')][_0x03fe('0x3b')]);_0x91e951[_0x03fe('0x20')]=qs[_0x03fe('0x20')](_0x283764['query']['offset']);}return _0x2401f7[_0x03fe('0x5f')](_0x91e951);}})[_0x03fe('0x27')](function(_0x6d6961){if(_0x6d6961){return _0x6d6961?{'count':_0x23d94b,'rows':_0x6d6961}:null;}})[_0x03fe('0x27')](respondWithResult(_0x2a7b2c,null))[_0x03fe('0x46')](handleError(_0x2a7b2c,null));};exports[_0x03fe('0x61')]=function(_0x125d8d,_0x46cb6e,_0x307050){var _0x32fe92=_0x125d8d['body'][_0x03fe('0x62')];return db[_0x03fe('0x60')][_0x03fe('0x44')]({'where':{'id':_0x32fe92},'attributes':['id'],'include':[{'model':db[_0x03fe('0x5a')],'as':_0x03fe('0x63'),'attributes':['id',_0x03fe('0x2d'),_0x03fe('0x64'),_0x03fe('0x65'),_0x03fe('0x66')],'raw':!![]}]})[_0x03fe('0x27')](function(_0x2ea876){if(_0x2ea876){var _0x11535c=_[_0x03fe('0x67')](_0x2ea876,function(_0x499497){var _0x19a57a=_0x499497[_0x03fe('0x28')]({'plain':!![]});return _0x19a57a[_0x03fe('0x63')];});return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x125d8d['params']['id']}})[_0x03fe('0x27')](function(_0x50af9c){return db[_0x03fe('0x68')][_0x03fe('0x69')](function(_0x17cab2){return _0x50af9c['addTeams'](_0x32fe92,{'transaction':_0x17cab2})[_0x03fe('0x27')](function(){return BPromise[_0x03fe('0x6a')](_0x11535c,function(_0x5dff1c){return db['UserOpenchannelQueue'][_0x03fe('0x6b')]({'where':{'UserId':_0x5dff1c['id'],'OpenchannelQueueId':_0x125d8d[_0x03fe('0x48')]['id']},'transaction':_0x17cab2});});})[_0x03fe('0x27')](function(){_0x11535c[_0x03fe('0x6c')](function(_0x2fa876){socket[_0x03fe('0x6d')](_0x03fe('0x6e'),{'UserId':_0x2fa876['id'],'OpenchannelQueueId':_0x50af9c['id']});});});});});}})[_0x03fe('0x27')](respondWithStatusCode(_0x46cb6e,null))['catch'](handleError(_0x46cb6e,null));};exports['removeTeams']=function(_0x38a7ee,_0x1d956e,_0x543045){return db[_0x03fe('0x60')][_0x03fe('0x44')]({'where':{'id':_0x38a7ee[_0x03fe('0x34')][_0x03fe('0x62')]},'attributes':['id'],'include':[{'model':db[_0x03fe('0x5a')],'as':_0x03fe('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d956e,null))[_0x03fe('0x27')](function(_0x1ef184){var _0x52626b=_['map'](_0x1ef184,'id');var _0x51b582=[];var _0x775abf=[];var _0xf238c8=squel['select']();_0xf238c8[_0x03fe('0x6f')]('tq.TeamId')[_0x03fe('0x70')](_0x03fe('0x71'),'tq')[_0x03fe('0x72')](_0x03fe('0x73'),'ut',_0x03fe('0x74'))[_0x03fe('0x3e')](_0x03fe('0x75'),_0x38a7ee[_0x03fe('0x48')]['id']);for(var _0x44cab0=0x0;_0x44cab0<_0x1ef184['length'];_0x44cab0+=0x1){let _0x113b8e=_0x1ef184[_0x44cab0];for(var _0x26db8f=0x0;_0x26db8f<_0x113b8e[_0x03fe('0x63')][_0x03fe('0x4a')];_0x26db8f+=0x1){let _0x524229=_0x113b8e[_0x03fe('0x63')][_0x26db8f];var _0x2210b9=_0xf238c8['clone']();_0x2210b9[_0x03fe('0x3e')](_0x03fe('0x76'),_0x524229['id']);_0x775abf[_0x03fe('0x77')](db[_0x03fe('0x68')][_0x03fe('0x34')](_0x2210b9[_0x03fe('0x78')](),{'type':db['sequelize'][_0x03fe('0x79')][_0x03fe('0x7a')]})[_0x03fe('0x27')](function(_0x33f1b4){if(_0x33f1b4[_0x03fe('0x4a')]===0x1){return _0x524229['id'];}else{var _0x4eec0a=_[_0x03fe('0x7b')](_[_0x03fe('0x30')](_0x33f1b4,_0x03fe('0x7c')),function(_0x15a234){return _[_0x03fe('0x7d')](_0x52626b,_0x15a234);});if(_0x4eec0a){return _0x524229['id'];}}}));}}return BPromise['all'](_0x775abf)[_0x03fe('0x27')](function(_0xaaf08a){_0x51b582=_(_0x51b582)[_0x03fe('0x7e')](_0xaaf08a)[_0x03fe('0x7f')]()[_0x03fe('0x80')]();return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x38a7ee[_0x03fe('0x48')]['id']}})['then'](function(_0x384577){return db['sequelize'][_0x03fe('0x69')](function(_0x2962f5){return _0x384577[_0x03fe('0x81')](_0x38a7ee[_0x03fe('0x34')][_0x03fe('0x62')],{'transaction':_0x2962f5})['then'](function(){if(!_['isEmpty'](_0x51b582)){return _0x384577[_0x03fe('0x82')](_0x51b582,{'transaction':_0x2962f5});}})[_0x03fe('0x27')](function(){_0x51b582[_0x03fe('0x6c')](function(_0x24b7c9){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x24b7c9,'OpenchannelQueueId':_0x384577['id']});});});});});});})[_0x03fe('0x27')](respondWithStatusCode(_0x1d956e,null))[_0x03fe('0x46')](handleError(_0x1d956e,null));};exports[_0x03fe('0x83')]=function(_0x55f256,_0x1d339b,_0x485d12){return db['OpenchannelQueue'][_0x03fe('0x52')]({'where':{'id':_0x55f256[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x1d339b,null))['then'](function(_0xf6e73c){if(_0xf6e73c){return _0xf6e73c[_0x03fe('0x83')](_0x55f256[_0x03fe('0x4d')][_0x03fe('0x62')],_[_0x03fe('0x84')](_0x55f256[_0x03fe('0x4d')],[_0x03fe('0x62'),'id'])||{})[_0x03fe('0x85')](function(_0x5c0e34){for(var _0x21a5c0=0x0;_0x21a5c0<_0x55f256[_0x03fe('0x4d')][_0x03fe('0x62')][_0x03fe('0x4a')];_0x21a5c0+=0x1){socket[_0x03fe('0x6d')](_0x03fe('0x6e'),{'UserId':_0x55f256[_0x03fe('0x4d')][_0x03fe('0x62')][_0x21a5c0],'OpenchannelQueueId':_0x55f256[_0x03fe('0x48')]['id']});}return _0x5c0e34;});}})[_0x03fe('0x27')](respondWithResult(_0x1d339b,null))[_0x03fe('0x46')](handleError(_0x1d339b,null));};exports[_0x03fe('0x82')]=function(_0x158f76,_0x5e9b6b,_0x215e7b){return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x158f76[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x5e9b6b,null))[_0x03fe('0x27')](function(_0x323abf){if(_0x323abf){return _0x323abf['removeAgents'](_0x158f76[_0x03fe('0x34')][_0x03fe('0x62')])['then'](function(){if(_[_0x03fe('0x86')](_0x158f76[_0x03fe('0x34')]['ids'])){for(var _0x2573e8=0x0;_0x2573e8<_0x158f76[_0x03fe('0x34')]['ids']['length'];_0x2573e8+=0x1){socket['emit'](_0x03fe('0x87'),{'UserId':Number(_0x158f76[_0x03fe('0x34')][_0x03fe('0x62')][_0x2573e8]),'OpenchannelQueueId':Number(_0x158f76['params']['id'])});}}else{socket['emit'](_0x03fe('0x87'),{'UserId':Number(_0x158f76['query']['ids']),'OpenchannelQueueId':Number(_0x158f76[_0x03fe('0x48')]['id'])});}});}})[_0x03fe('0x27')](respondWithStatusCode(_0x5e9b6b,null))[_0x03fe('0x46')](handleError(_0x5e9b6b,null));};exports[_0x03fe('0x88')]=function(_0x9e2a6b,_0xd4e46,_0x58b57a){var _0x41a361={};var _0x40918a={};var _0x4681c7;var _0x590cc7;return db[_0x03fe('0x43')]['findOne']({'where':{'id':_0x9e2a6b[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0xd4e46,null))[_0x03fe('0x27')](function(_0x57c49e){if(_0x57c49e){_0x4681c7=_0x57c49e;_0x40918a[_0x03fe('0x33')]=_['keys'](db[_0x03fe('0x5a')][_0x03fe('0x31')]);_0x40918a['query']=_[_0x03fe('0x49')](_0x9e2a6b['query']);_0x40918a[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x40918a['model'],_0x40918a['query']);_0x41a361['attributes']=_[_0x03fe('0x36')](_0x40918a[_0x03fe('0x33')],qs[_0x03fe('0x38')](_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x38')]));_0x41a361[_0x03fe('0x37')]=_0x41a361['attributes'][_0x03fe('0x4a')]?_0x41a361[_0x03fe('0x37')]:_0x40918a[_0x03fe('0x33')];_0x41a361[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x3d')]);_0x41a361[_0x03fe('0x3e')]=qs[_0x03fe('0x35')](_['pick'](_0x9e2a6b[_0x03fe('0x34')],_0x40918a['filters']));if(_0x9e2a6b['query'][_0x03fe('0x40')]){_0x41a361[_0x03fe('0x3e')]=_[_0x03fe('0x41')](_0x41a361[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0x41a361[_0x03fe('0x37')],function(_0x1631bc){var _0x39fcf7={};_0x39fcf7[_0x1631bc]={'$like':'%'+_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x40')]+'%'};return _0x39fcf7;})});}_0x41a361=_[_0x03fe('0x41')]({},_0x41a361,_0x9e2a6b[_0x03fe('0x4b')]);return _0x4681c7['getAgents'](_0x41a361);}})[_0x03fe('0x27')](function(_0x2911f6){if(_0x2911f6){_0x590cc7=_0x2911f6[_0x03fe('0x4a')];if(!_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x41a361[_0x03fe('0x3b')]=qs[_0x03fe('0x3b')](_0x9e2a6b['query'][_0x03fe('0x3b')]);_0x41a361[_0x03fe('0x20')]=qs[_0x03fe('0x20')](_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x20')]);}return _0x4681c7[_0x03fe('0x88')](_0x41a361);}})[_0x03fe('0x27')](function(_0x3f8de3){if(_0x3f8de3){return _0x3f8de3?{'count':_0x590cc7,'rows':_0x3f8de3}:null;}})[_0x03fe('0x27')](respondWithResult(_0xd4e46,null))[_0x03fe('0x46')](handleError(_0xd4e46,null));}; \ No newline at end of file +var _0x6e6f=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','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','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','removeTeams','field','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count'];(function(_0x1b2f1c,_0x4d0dcb){var _0x220a3c=function(_0xffb3ec){while(--_0xffb3ec){_0x1b2f1c['push'](_0x1b2f1c['shift']());}};_0x220a3c(++_0x4d0dcb);}(_0x6e6f,0xf5));var _0xf6e6=function(_0x53feda,_0x8d5d13){_0x53feda=_0x53feda-0x0;var _0x2c0b4f=_0x6e6f[_0x53feda];return _0x2c0b4f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf6e6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6e6('0x1'));var moment=require(_0xf6e6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf6e6('0x3'));var util=require(_0xf6e6('0x4'));var path=require(_0xf6e6('0x5'));var sox=require(_0xf6e6('0x6'));var csv=require(_0xf6e6('0x7'));var ejs=require(_0xf6e6('0x8'));var fs=require('fs');var _=require(_0xf6e6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf6e6('0xa'));var deskjs=require(_0xf6e6('0xb'));var toCsv=require(_0xf6e6('0x7'));var querystring=require(_0xf6e6('0xc'));var Papa=require(_0xf6e6('0xd'));var Redis=require(_0xf6e6('0xe'));var authService=require(_0xf6e6('0xf'));var qs=require(_0xf6e6('0x10'));var as=require(_0xf6e6('0x11'));var hardwareService=require(_0xf6e6('0x12'));var logger=require(_0xf6e6('0x13'))(_0xf6e6('0x14'));var utils=require(_0xf6e6('0x15'));var config=require(_0xf6e6('0x16'));var db=require('../../mysqldb')['db'];config[_0xf6e6('0x17')]=_[_0xf6e6('0x18')](config[_0xf6e6('0x17')],{'host':_0xf6e6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6e6('0x17')]));require(_0xf6e6('0x1a'))[_0xf6e6('0x1b')](socket);function respondWithStatusCode(_0x243ea3,_0x1ee5d5){_0x1ee5d5=_0x1ee5d5||0xcc;return function(_0x375774){if(_0x375774){return _0x243ea3[_0xf6e6('0x1c')](_0x1ee5d5);}return _0x243ea3[_0xf6e6('0x1d')](_0x1ee5d5)[_0xf6e6('0x1e')]();};}function respondWithResult(_0x4585fe,_0x256d59){_0x256d59=_0x256d59||0xc8;return function(_0x52f6e9){if(_0x52f6e9){return _0x4585fe[_0xf6e6('0x1d')](_0x256d59)[_0xf6e6('0x1f')](_0x52f6e9);}};}function respondWithFilteredResult(_0x4be672,_0x1dcb08){return function(_0x2a40ba){if(_0x2a40ba){var _0x335518=_0x2a40ba[_0xf6e6('0x20')],_0x4ad326=_0x1dcb08[_0xf6e6('0x21')],_0x4480b5=_0x1dcb08[_0xf6e6('0x21')]+_0x1dcb08[_0xf6e6('0x22')],_0x16c821;if(_0x4480b5>=_0x335518){_0x4480b5=_0x335518;_0x16c821=0xc8;}else{_0x16c821=0xce;}_0x4be672[_0xf6e6('0x1d')](_0x16c821);return _0x4be672[_0xf6e6('0x23')](_0xf6e6('0x24'),_0x4ad326+'-'+_0x4480b5+'/'+_0x335518)[_0xf6e6('0x1f')](_0x2a40ba);}return null;};}function patchUpdates(_0x257c57){return function(_0x208bc2){try{jsonpatch[_0xf6e6('0x25')](_0x208bc2,_0x257c57,!![]);}catch(_0x14581c){return BPromise[_0xf6e6('0x26')](_0x14581c);}return _0x208bc2[_0xf6e6('0x27')]();};}function saveUpdates(_0x462083,_0x39f73a){return function(_0x5748d1){if(_0x5748d1){return _0x5748d1[_0xf6e6('0x28')](_0x462083)[_0xf6e6('0x29')](function(_0x4cca06){return _0x4cca06;});}return null;};}function removeEntity(_0x63c266,_0x1d06e2){return function(_0x4f758d){if(_0x4f758d){return _0x4f758d[_0xf6e6('0x2a')]()['then'](function(){var _0x4bdf78=_0x4f758d[_0xf6e6('0x2b')]({'plain':!![]});var _0x21286e='OpenchannelQueues';return db['UserProfileResource'][_0xf6e6('0x2a')]({'where':{'type':_0x21286e,'resourceId':_0x4bdf78['id']}})[_0xf6e6('0x29')](function(){return _0x4f758d;});})[_0xf6e6('0x29')](function(){_0x63c266[_0xf6e6('0x1d')](0xcc)[_0xf6e6('0x1e')]();});}};}function handleEntityNotFound(_0x2b41e0,_0x1d6d52){return function(_0x3c16a0){if(!_0x3c16a0){_0x2b41e0['sendStatus'](0x194);}return _0x3c16a0;};}function handleError(_0x39ca78,_0xadd233){_0xadd233=_0xadd233||0x1f4;return function(_0x18baab){logger[_0xf6e6('0x2c')](_0x18baab[_0xf6e6('0x2d')]);if(_0x18baab['name']){delete _0x18baab[_0xf6e6('0x2e')];}_0x39ca78[_0xf6e6('0x1d')](_0xadd233)[_0xf6e6('0x2f')](_0x18baab);};}exports[_0xf6e6('0x30')]=function(_0x5a829f,_0x4c2778){var _0x998548={},_0x180665={},_0x3ed3f5={'count':0x0,'rows':[]};var _0x14ef28=_[_0xf6e6('0x31')](db[_0xf6e6('0x32')][_0xf6e6('0x33')],function(_0x411b1f){return{'name':_0x411b1f[_0xf6e6('0x34')],'type':_0x411b1f[_0xf6e6('0x35')][_0xf6e6('0x36')]};});_0x180665[_0xf6e6('0x37')]=_[_0xf6e6('0x31')](_0x14ef28,_0xf6e6('0x2e'));_0x180665[_0xf6e6('0x38')]=_[_0xf6e6('0x39')](_0x5a829f['query']);_0x180665[_0xf6e6('0x3a')]=_['intersection'](_0x180665[_0xf6e6('0x37')],_0x180665[_0xf6e6('0x38')]);_0x998548[_0xf6e6('0x3b')]=_[_0xf6e6('0x3c')](_0x180665[_0xf6e6('0x37')],qs[_0xf6e6('0x3d')](_0x5a829f[_0xf6e6('0x38')]['fields']));_0x998548['attributes']=_0x998548[_0xf6e6('0x3b')][_0xf6e6('0x3e')]?_0x998548[_0xf6e6('0x3b')]:_0x180665[_0xf6e6('0x37')];if(!_0x5a829f['query']['hasOwnProperty'](_0xf6e6('0x3f'))){_0x998548[_0xf6e6('0x22')]=qs[_0xf6e6('0x22')](_0x5a829f[_0xf6e6('0x38')]['limit']);_0x998548[_0xf6e6('0x21')]=qs[_0xf6e6('0x21')](_0x5a829f[_0xf6e6('0x38')][_0xf6e6('0x21')]);}_0x998548[_0xf6e6('0x40')]=qs[_0xf6e6('0x41')](_0x5a829f['query'][_0xf6e6('0x41')]);_0x998548['where']=qs['filters'](_[_0xf6e6('0x42')](_0x5a829f[_0xf6e6('0x38')],_0x180665['filters']),_0x14ef28);if(_0x5a829f[_0xf6e6('0x38')]['filter']){_0x998548[_0xf6e6('0x43')]=_[_0xf6e6('0x44')](_0x998548['where'],{'$or':_['map'](_0x14ef28,function(_0x197357){if(_0x197357[_0xf6e6('0x35')]!=='VIRTUAL'){var _0x1e6a23={};_0x1e6a23[_0x197357[_0xf6e6('0x2e')]]={'$like':'%'+_0x5a829f['query'][_0xf6e6('0x45')]+'%'};return _0x1e6a23;}})});}_0x998548=_[_0xf6e6('0x44')]({},_0x998548,_0x5a829f[_0xf6e6('0x46')]);var _0x4c50f7={'where':_0x998548['where']};return db[_0xf6e6('0x32')][_0xf6e6('0x20')](_0x4c50f7)['then'](function(_0x20b9fd){_0x3ed3f5['count']=_0x20b9fd;if(_0x5a829f['query'][_0xf6e6('0x47')]){_0x998548[_0xf6e6('0x48')]=[{'all':!![]}];}return db[_0xf6e6('0x32')][_0xf6e6('0x49')](_0x998548);})[_0xf6e6('0x29')](function(_0x15e23c){_0x3ed3f5[_0xf6e6('0x4a')]=_0x15e23c;return _0x3ed3f5;})[_0xf6e6('0x29')](respondWithFilteredResult(_0x4c2778,_0x998548))[_0xf6e6('0x4b')](handleError(_0x4c2778,null));};exports[_0xf6e6('0x4c')]=function(_0x4c1709,_0x4c7cf2){var _0x144052={'raw':!![],'where':{'id':_0x4c1709[_0xf6e6('0x4d')]['id']}},_0x3adc9a={};_0x3adc9a[_0xf6e6('0x37')]=_[_0xf6e6('0x39')](db[_0xf6e6('0x32')][_0xf6e6('0x33')]);_0x3adc9a[_0xf6e6('0x38')]=_[_0xf6e6('0x39')](_0x4c1709[_0xf6e6('0x38')]);_0x3adc9a[_0xf6e6('0x3a')]=_[_0xf6e6('0x3c')](_0x3adc9a['model'],_0x3adc9a['query']);_0x144052[_0xf6e6('0x3b')]=_[_0xf6e6('0x3c')](_0x3adc9a[_0xf6e6('0x37')],qs[_0xf6e6('0x3d')](_0x4c1709[_0xf6e6('0x38')][_0xf6e6('0x3d')]));_0x144052[_0xf6e6('0x3b')]=_0x144052[_0xf6e6('0x3b')][_0xf6e6('0x3e')]?_0x144052[_0xf6e6('0x3b')]:_0x3adc9a[_0xf6e6('0x37')];if(_0x4c1709[_0xf6e6('0x38')][_0xf6e6('0x47')]){_0x144052[_0xf6e6('0x48')]=[{'all':!![]}];}_0x144052=_['merge']({},_0x144052,_0x4c1709[_0xf6e6('0x46')]);return db[_0xf6e6('0x32')][_0xf6e6('0x4e')](_0x144052)['then'](handleEntityNotFound(_0x4c7cf2,null))[_0xf6e6('0x29')](respondWithResult(_0x4c7cf2,null))[_0xf6e6('0x4b')](handleError(_0x4c7cf2,null));};exports[_0xf6e6('0x4f')]=function(_0x277b1e,_0x4eb77d){return db[_0xf6e6('0x32')]['create'](_0x277b1e[_0xf6e6('0x50')],{})[_0xf6e6('0x29')](function(_0x161217){var _0x582ac9=_0x277b1e[_0xf6e6('0x51')]['get']({'plain':!![]});if(!_0x582ac9)throw new Error(_0xf6e6('0x52'));if(_0x582ac9[_0xf6e6('0x53')]==='user'){var _0x440236=_0x161217[_0xf6e6('0x2b')]({'plain':!![]});var _0xfb6001='OpenchannelQueues';return db['UserProfileSection'][_0xf6e6('0x4e')]({'where':{'name':_0xfb6001,'userProfileId':_0x582ac9[_0xf6e6('0x54')]},'raw':!![]})[_0xf6e6('0x29')](function(_0x368382){if(_0x368382&&_0x368382[_0xf6e6('0x55')]===0x0){return db[_0xf6e6('0x56')][_0xf6e6('0x4f')]({'name':_0x440236['name'],'resourceId':_0x440236['id'],'type':_0x368382[_0xf6e6('0x2e')],'sectionId':_0x368382['id']},{})['then'](function(){return _0x161217;});}else{return _0x161217;}})['catch'](function(_0xeea479){logger['error'](_0xf6e6('0x57'),_0xeea479);throw _0xeea479;});}return _0x161217;})[_0xf6e6('0x29')](respondWithResult(_0x4eb77d,0xc9))[_0xf6e6('0x4b')](handleError(_0x4eb77d,null));};exports['update']=function(_0x1980f1,_0x29be19){if(_0x1980f1['body']['id']){delete _0x1980f1['body']['id'];}return db[_0xf6e6('0x32')]['find']({'where':{'id':_0x1980f1['params']['id']}})[_0xf6e6('0x29')](handleEntityNotFound(_0x29be19,null))[_0xf6e6('0x29')](saveUpdates(_0x1980f1['body'],null))[_0xf6e6('0x29')](respondWithResult(_0x29be19,null))[_0xf6e6('0x4b')](handleError(_0x29be19,null));};exports[_0xf6e6('0x2a')]=function(_0x176568,_0x28614e){return db[_0xf6e6('0x32')][_0xf6e6('0x4e')]({'where':{'id':_0x176568[_0xf6e6('0x4d')]['id']}})[_0xf6e6('0x29')](handleEntityNotFound(_0x28614e,null))['then'](removeEntity(_0x28614e,null))['catch'](handleError(_0x28614e,null));};exports[_0xf6e6('0x58')]=function(_0x368967,_0x23bc84){return db[_0xf6e6('0x32')]['describe']()[_0xf6e6('0x29')](respondWithResult(_0x23bc84,null))[_0xf6e6('0x4b')](handleError(_0x23bc84,null));};exports[_0xf6e6('0x59')]=function(_0x78963a,_0x37217d,_0x2589ce){var _0x252b98={'raw':!![],'where':{}},_0x2be0e2={},_0x2e8f40;return db[_0xf6e6('0x32')][_0xf6e6('0x5a')]({'where':{'id':_0x78963a[_0xf6e6('0x4d')]['id']}})[_0xf6e6('0x29')](handleEntityNotFound(_0x37217d,null))[_0xf6e6('0x29')](function(_0x406377){if(_0x406377){_0x2e8f40=_0x406377[_0xf6e6('0x2b')]({'plain':!![]});_0x2be0e2[_0xf6e6('0x37')]=_['keys'](db[_0xf6e6('0x5b')]['rawAttributes']);_0x2be0e2[_0xf6e6('0x38')]=_[_0xf6e6('0x39')](_0x78963a['query']);_0x2be0e2[_0xf6e6('0x3a')]=_[_0xf6e6('0x3c')](_0x2be0e2[_0xf6e6('0x37')],_0x2be0e2[_0xf6e6('0x38')]);_0x252b98[_0xf6e6('0x3b')]=_[_0xf6e6('0x3c')](_0x2be0e2[_0xf6e6('0x37')],qs[_0xf6e6('0x3d')](_0x78963a[_0xf6e6('0x38')]['fields']));_0x252b98[_0xf6e6('0x3b')]=_0x252b98[_0xf6e6('0x3b')]['length']?_0x252b98[_0xf6e6('0x3b')]:_0x2be0e2['model'];if(!_0x78963a[_0xf6e6('0x38')][_0xf6e6('0x5c')]('nolimit')){_0x252b98[_0xf6e6('0x22')]=qs[_0xf6e6('0x22')](_0x78963a[_0xf6e6('0x38')][_0xf6e6('0x22')]);_0x252b98[_0xf6e6('0x21')]=qs[_0xf6e6('0x21')](_0x78963a[_0xf6e6('0x38')]['offset']);}_0x252b98[_0xf6e6('0x40')]=qs[_0xf6e6('0x41')](_0x78963a[_0xf6e6('0x38')][_0xf6e6('0x41')]);_0x252b98[_0xf6e6('0x43')]=qs['filters'](_[_0xf6e6('0x42')](_0x78963a[_0xf6e6('0x38')],_0x2be0e2['filters']));_0x252b98[_0xf6e6('0x43')]['OpenchannelQueueId']=_0x406377['id'];if(_0x78963a[_0xf6e6('0x38')]['filter']){_0x252b98[_0xf6e6('0x43')]=_[_0xf6e6('0x44')](_0x252b98[_0xf6e6('0x43')],{'$or':_[_0xf6e6('0x31')](_0x252b98[_0xf6e6('0x3b')],function(_0x1c4300){var _0x3ad265={};_0x3ad265[_0x1c4300]={'$like':'%'+_0x78963a[_0xf6e6('0x38')][_0xf6e6('0x45')]+'%'};return _0x3ad265;})});}_0x252b98=_['merge']({},_0x252b98,_0x78963a['options']);return db['UserOpenchannelQueue'][_0xf6e6('0x49')](_0x252b98);}})['then'](function(_0x3eb7d8){if(_0x3eb7d8){return db[_0xf6e6('0x5d')][_0xf6e6('0x5e')]({'where':{'id':_[_0xf6e6('0x31')](_0x3eb7d8,'UserId'),'role':_0xf6e6('0x5f')},'attributes':['id',_0xf6e6('0x2e'),_0xf6e6('0x60'),_0xf6e6('0x61'),_0xf6e6('0x62')]});}})['then'](function(_0x24ca9f){if(_0x24ca9f){return{'count':_0x24ca9f[_0xf6e6('0x20')],'rows':_[_0xf6e6('0x31')](_0x24ca9f[_0xf6e6('0x4a')],function(_0x2402a6){return{'membername':_0x2402a6[_0xf6e6('0x2e')],'UserId':_0x2402a6['id'],'queue_name':_0x2e8f40[_0xf6e6('0x2e')],'OpenchannelQueueId':_0x2e8f40['id'],'interface':util[_0xf6e6('0x63')](_0xf6e6('0x64'),_0xf6e6('0x65'),_0x2402a6[_0xf6e6('0x2e')]),'penalty':0x0,'paused':_0x2402a6[_0xf6e6('0x60')],'createdAt':_0x2402a6['createdAt'],'updatedAt':_0x2402a6[_0xf6e6('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf6e6('0x29')](respondWithFilteredResult(_0x37217d,_0x252b98))['catch'](handleError(_0x37217d,null));};exports[_0xf6e6('0x66')]=function(_0x5b181a,_0x3b9cce,_0xd77353){var _0x2c84d8={};var _0x1e9ca6={};var _0x5a8cc5;var _0x47b831;return db['OpenchannelQueue'][_0xf6e6('0x5a')]({'where':{'id':_0x5b181a[_0xf6e6('0x4d')]['id']}})[_0xf6e6('0x29')](handleEntityNotFound(_0x3b9cce,null))['then'](function(_0x4eb20c){if(_0x4eb20c){_0x5a8cc5=_0x4eb20c;_0x1e9ca6[_0xf6e6('0x37')]=_[_0xf6e6('0x39')](db[_0xf6e6('0x67')][_0xf6e6('0x33')]);_0x1e9ca6[_0xf6e6('0x38')]=_[_0xf6e6('0x39')](_0x5b181a[_0xf6e6('0x38')]);_0x1e9ca6[_0xf6e6('0x3a')]=_[_0xf6e6('0x3c')](_0x1e9ca6[_0xf6e6('0x37')],_0x1e9ca6[_0xf6e6('0x38')]);_0x2c84d8['attributes']=_[_0xf6e6('0x3c')](_0x1e9ca6[_0xf6e6('0x37')],qs['fields'](_0x5b181a[_0xf6e6('0x38')][_0xf6e6('0x3d')]));_0x2c84d8[_0xf6e6('0x3b')]=_0x2c84d8[_0xf6e6('0x3b')][_0xf6e6('0x3e')]?_0x2c84d8['attributes']:_0x1e9ca6[_0xf6e6('0x37')];_0x2c84d8[_0xf6e6('0x40')]=qs[_0xf6e6('0x41')](_0x5b181a[_0xf6e6('0x38')][_0xf6e6('0x41')]);_0x2c84d8[_0xf6e6('0x43')]=qs[_0xf6e6('0x3a')](_[_0xf6e6('0x42')](_0x5b181a['query'],_0x1e9ca6['filters']));if(_0x5b181a[_0xf6e6('0x38')][_0xf6e6('0x45')]){_0x2c84d8['where']=_['merge'](_0x2c84d8[_0xf6e6('0x43')],{'$or':_[_0xf6e6('0x31')](_0x2c84d8[_0xf6e6('0x3b')],function(_0x18729f){var _0x59a078={};_0x59a078[_0x18729f]={'$like':'%'+_0x5b181a[_0xf6e6('0x38')][_0xf6e6('0x45')]+'%'};return _0x59a078;})});}_0x2c84d8=_[_0xf6e6('0x44')]({},_0x2c84d8,_0x5b181a[_0xf6e6('0x46')]);return _0x5a8cc5[_0xf6e6('0x66')](_0x2c84d8);}})[_0xf6e6('0x29')](function(_0x2e6784){if(_0x2e6784){_0x47b831=_0x2e6784['length'];if(!_0x5b181a['query'][_0xf6e6('0x5c')](_0xf6e6('0x3f'))){_0x2c84d8['limit']=qs[_0xf6e6('0x22')](_0x5b181a[_0xf6e6('0x38')][_0xf6e6('0x22')]);_0x2c84d8[_0xf6e6('0x21')]=qs[_0xf6e6('0x21')](_0x5b181a['query'][_0xf6e6('0x21')]);}return _0x5a8cc5[_0xf6e6('0x66')](_0x2c84d8);}})[_0xf6e6('0x29')](function(_0x491f05){if(_0x491f05){return _0x491f05?{'count':_0x47b831,'rows':_0x491f05}:null;}})['then'](respondWithResult(_0x3b9cce,null))['catch'](handleError(_0x3b9cce,null));};exports[_0xf6e6('0x68')]=function(_0x220ff0,_0x280ab6,_0x3661c8){var _0x2d6143=_0x220ff0[_0xf6e6('0x50')][_0xf6e6('0x69')];return db[_0xf6e6('0x67')][_0xf6e6('0x49')]({'where':{'id':_0x2d6143},'attributes':['id'],'include':[{'model':db[_0xf6e6('0x5d')],'as':_0xf6e6('0x6a'),'attributes':['id','name',_0xf6e6('0x6b'),_0xf6e6('0x6c'),_0xf6e6('0x6d')],'raw':!![]}]})['then'](function(_0x134d71){if(_0x134d71){var _0x82484c=_['flatMap'](_0x134d71,function(_0x28d5c0){var _0x4fc85e=_0x28d5c0[_0xf6e6('0x2b')]({'plain':!![]});return _0x4fc85e[_0xf6e6('0x6a')];});return db[_0xf6e6('0x32')]['find']({'where':{'id':_0x220ff0[_0xf6e6('0x4d')]['id']}})['then'](function(_0x58b9cb){return db[_0xf6e6('0x6e')][_0xf6e6('0x6f')](function(_0x388fbd){return _0x58b9cb['addTeams'](_0x2d6143,{'transaction':_0x388fbd})[_0xf6e6('0x29')](function(){return BPromise[_0xf6e6('0x70')](_0x82484c,function(_0x23aee5){return db[_0xf6e6('0x5b')]['findOrCreate']({'where':{'UserId':_0x23aee5['id'],'OpenchannelQueueId':_0x220ff0['params']['id']},'transaction':_0x388fbd});});})[_0xf6e6('0x29')](function(){_0x82484c['forEach'](function(_0x258329){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x258329['id'],'OpenchannelQueueId':_0x58b9cb['id']});});});});});}})[_0xf6e6('0x29')](respondWithStatusCode(_0x280ab6,null))[_0xf6e6('0x4b')](handleError(_0x280ab6,null));};exports[_0xf6e6('0x71')]=function(_0x164a3a,_0xce3241,_0x210468){return db[_0xf6e6('0x67')][_0xf6e6('0x49')]({'where':{'id':_0x164a3a[_0xf6e6('0x38')][_0xf6e6('0x69')]},'attributes':['id'],'include':[{'model':db[_0xf6e6('0x5d')],'as':_0xf6e6('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf6e6('0x29')](handleEntityNotFound(_0xce3241,null))['then'](function(_0x5295e5){var _0x411233=_[_0xf6e6('0x31')](_0x5295e5,'id');var _0x2761de=[];var _0x5540d8=[];var _0x4b760e=squel['select']();_0x4b760e[_0xf6e6('0x72')](_0xf6e6('0x73'))[_0xf6e6('0x74')]('team_has_openchannel_queues','tq')[_0xf6e6('0x75')](_0xf6e6('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf6e6('0x43')](_0xf6e6('0x77'),_0x164a3a[_0xf6e6('0x4d')]['id']);for(var _0x1a5a1c=0x0;_0x1a5a1c<_0x5295e5['length'];_0x1a5a1c+=0x1){let _0x43921b=_0x5295e5[_0x1a5a1c];for(var _0x23e807=0x0;_0x23e807<_0x43921b[_0xf6e6('0x6a')][_0xf6e6('0x3e')];_0x23e807+=0x1){let _0xcf3a83=_0x43921b['Agents'][_0x23e807];var _0x25642d=_0x4b760e[_0xf6e6('0x78')]();_0x25642d[_0xf6e6('0x43')](_0xf6e6('0x79'),_0xcf3a83['id']);_0x5540d8[_0xf6e6('0x7a')](db['sequelize'][_0xf6e6('0x38')](_0x25642d[_0xf6e6('0x7b')](),{'type':db['sequelize'][_0xf6e6('0x7c')][_0xf6e6('0x7d')]})[_0xf6e6('0x29')](function(_0x4c1ae2){if(_0x4c1ae2[_0xf6e6('0x3e')]===0x1){return _0xcf3a83['id'];}else{var _0xae6f44=_[_0xf6e6('0x7e')](_[_0xf6e6('0x31')](_0x4c1ae2,'TeamId'),function(_0x23a69e){return _[_0xf6e6('0x7f')](_0x411233,_0x23a69e);});if(_0xae6f44){return _0xcf3a83['id'];}}}));}}return BPromise['all'](_0x5540d8)[_0xf6e6('0x29')](function(_0x5c9aef){_0x2761de=_(_0x2761de)['union'](_0x5c9aef)[_0xf6e6('0x80')]()['value']();return db[_0xf6e6('0x32')][_0xf6e6('0x4e')]({'where':{'id':_0x164a3a[_0xf6e6('0x4d')]['id']}})[_0xf6e6('0x29')](function(_0x326864){return db[_0xf6e6('0x6e')][_0xf6e6('0x6f')](function(_0x2f7736){return _0x326864[_0xf6e6('0x71')](_0x164a3a[_0xf6e6('0x38')][_0xf6e6('0x69')],{'transaction':_0x2f7736})[_0xf6e6('0x29')](function(){if(!_['isEmpty'](_0x2761de)){return _0x326864[_0xf6e6('0x81')](_0x2761de,{'transaction':_0x2f7736});}})['then'](function(){_0x2761de[_0xf6e6('0x82')](function(_0x3a128e){socket[_0xf6e6('0x83')](_0xf6e6('0x84'),{'UserId':_0x3a128e,'OpenchannelQueueId':_0x326864['id']});});});});});});})[_0xf6e6('0x29')](respondWithStatusCode(_0xce3241,null))[_0xf6e6('0x4b')](handleError(_0xce3241,null));};exports[_0xf6e6('0x85')]=function(_0x6d2c87,_0x2f4230,_0x582d9b){return db[_0xf6e6('0x32')]['find']({'where':{'id':_0x6d2c87['params']['id']}})[_0xf6e6('0x29')](handleEntityNotFound(_0x2f4230,null))['then'](function(_0x182a16){if(_0x182a16){return _0x182a16['addAgents'](_0x6d2c87[_0xf6e6('0x50')][_0xf6e6('0x69')],_[_0xf6e6('0x86')](_0x6d2c87[_0xf6e6('0x50')],['ids','id'])||{})[_0xf6e6('0x87')](function(_0x4a8c8f){for(var _0x5a6a95=0x0;_0x5a6a95<_0x6d2c87[_0xf6e6('0x50')][_0xf6e6('0x69')][_0xf6e6('0x3e')];_0x5a6a95+=0x1){socket[_0xf6e6('0x83')](_0xf6e6('0x88'),{'UserId':_0x6d2c87[_0xf6e6('0x50')][_0xf6e6('0x69')][_0x5a6a95],'OpenchannelQueueId':_0x6d2c87[_0xf6e6('0x4d')]['id']});}return _0x4a8c8f;});}})[_0xf6e6('0x29')](respondWithResult(_0x2f4230,null))[_0xf6e6('0x4b')](handleError(_0x2f4230,null));};exports['removeAgents']=function(_0x9d7e51,_0x4e20ec,_0x2e1362){return db[_0xf6e6('0x32')][_0xf6e6('0x4e')]({'where':{'id':_0x9d7e51[_0xf6e6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e20ec,null))[_0xf6e6('0x29')](function(_0x6a976f){if(_0x6a976f){return _0x6a976f[_0xf6e6('0x81')](_0x9d7e51[_0xf6e6('0x38')]['ids'])[_0xf6e6('0x29')](function(){if(_[_0xf6e6('0x89')](_0x9d7e51['query'][_0xf6e6('0x69')])){for(var _0x5d111f=0x0;_0x5d111f<_0x9d7e51[_0xf6e6('0x38')][_0xf6e6('0x69')]['length'];_0x5d111f+=0x1){socket[_0xf6e6('0x83')](_0xf6e6('0x84'),{'UserId':Number(_0x9d7e51[_0xf6e6('0x38')]['ids'][_0x5d111f]),'OpenchannelQueueId':Number(_0x9d7e51[_0xf6e6('0x4d')]['id'])});}}else{socket[_0xf6e6('0x83')](_0xf6e6('0x84'),{'UserId':Number(_0x9d7e51[_0xf6e6('0x38')][_0xf6e6('0x69')]),'OpenchannelQueueId':Number(_0x9d7e51[_0xf6e6('0x4d')]['id'])});}});}})[_0xf6e6('0x29')](respondWithStatusCode(_0x4e20ec,null))[_0xf6e6('0x4b')](handleError(_0x4e20ec,null));};exports[_0xf6e6('0x8a')]=function(_0x2dd515,_0x48e114,_0xf517c){var _0x1cc447={};var _0x149a98={};var _0x1e7d42;var _0x2323d1;return db[_0xf6e6('0x32')][_0xf6e6('0x5a')]({'where':{'id':_0x2dd515[_0xf6e6('0x4d')]['id']}})[_0xf6e6('0x29')](handleEntityNotFound(_0x48e114,null))[_0xf6e6('0x29')](function(_0x234ca3){if(_0x234ca3){_0x1e7d42=_0x234ca3;_0x149a98[_0xf6e6('0x37')]=_['keys'](db[_0xf6e6('0x5d')][_0xf6e6('0x33')]);_0x149a98[_0xf6e6('0x38')]=_[_0xf6e6('0x39')](_0x2dd515[_0xf6e6('0x38')]);_0x149a98[_0xf6e6('0x3a')]=_[_0xf6e6('0x3c')](_0x149a98[_0xf6e6('0x37')],_0x149a98[_0xf6e6('0x38')]);_0x1cc447[_0xf6e6('0x3b')]=_[_0xf6e6('0x3c')](_0x149a98[_0xf6e6('0x37')],qs[_0xf6e6('0x3d')](_0x2dd515['query'][_0xf6e6('0x3d')]));_0x1cc447[_0xf6e6('0x3b')]=_0x1cc447['attributes'][_0xf6e6('0x3e')]?_0x1cc447['attributes']:_0x149a98[_0xf6e6('0x37')];_0x1cc447[_0xf6e6('0x40')]=qs[_0xf6e6('0x41')](_0x2dd515[_0xf6e6('0x38')][_0xf6e6('0x41')]);_0x1cc447[_0xf6e6('0x43')]=qs['filters'](_[_0xf6e6('0x42')](_0x2dd515[_0xf6e6('0x38')],_0x149a98['filters']));if(_0x2dd515[_0xf6e6('0x38')]['filter']){_0x1cc447['where']=_[_0xf6e6('0x44')](_0x1cc447[_0xf6e6('0x43')],{'$or':_[_0xf6e6('0x31')](_0x1cc447[_0xf6e6('0x3b')],function(_0x170ae8){var _0x1c2941={};_0x1c2941[_0x170ae8]={'$like':'%'+_0x2dd515[_0xf6e6('0x38')]['filter']+'%'};return _0x1c2941;})});}_0x1cc447=_[_0xf6e6('0x44')]({},_0x1cc447,_0x2dd515['options']);return _0x1e7d42['getAgents'](_0x1cc447);}})[_0xf6e6('0x29')](function(_0x2a6661){if(_0x2a6661){_0x2323d1=_0x2a6661[_0xf6e6('0x3e')];if(!_0x2dd515[_0xf6e6('0x38')][_0xf6e6('0x5c')](_0xf6e6('0x3f'))){_0x1cc447[_0xf6e6('0x22')]=qs[_0xf6e6('0x22')](_0x2dd515[_0xf6e6('0x38')][_0xf6e6('0x22')]);_0x1cc447[_0xf6e6('0x21')]=qs['offset'](_0x2dd515[_0xf6e6('0x38')][_0xf6e6('0x21')]);}return _0x1e7d42['getAgents'](_0x1cc447);}})[_0xf6e6('0x29')](function(_0x3dafaf){if(_0x3dafaf){return _0x3dafaf?{'count':_0x2323d1,'rows':_0x3dafaf}:null;}})[_0xf6e6('0x29')](respondWithResult(_0x48e114,null))['catch'](handleError(_0x48e114,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 874e0cc..a01e022 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 _0xd71b=['OpenchannelQueue','save','update','remove','emit','../../mysqldb'];(function(_0x454f02,_0x32ce79){var _0x3369f7=function(_0x4c455c){while(--_0x4c455c){_0x454f02['push'](_0x454f02['shift']());}};_0x3369f7(++_0x32ce79);}(_0xd71b,0x1bb));var _0xbd71=function(_0x3640ab,_0x18bf07){_0x3640ab=_0x3640ab-0x0;var _0x46af89=_0xd71b[_0x3640ab];return _0x46af89;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xbd71('0x0'))['db'][_0xbd71('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd71('0x2'),'afterUpdate':_0xbd71('0x3'),'afterDestroy':_0xbd71('0x4')};function emitEvent(_0x2da3ec){return function(_0xf712e9,_0x469770,_0x113fdc){OpenchannelQueueEvents[_0xbd71('0x5')](_0x2da3ec+':'+_0xf712e9['id'],_0xf712e9);OpenchannelQueueEvents[_0xbd71('0x5')](_0x2da3ec,_0xf712e9);_0x113fdc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xf7fc=['hook','exports','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xf7fc,0x12a));var _0xcf7f=function(_0x5159d7,_0x24afba){_0x5159d7=_0x5159d7-0x0;var _0xf5cec1=_0xf7fc[_0x5159d7];return _0xf5cec1;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0xcf7f('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xcf7f('0x1')](0x0);var events={'afterCreate':_0xcf7f('0x2'),'afterUpdate':'update','afterDestroy':_0xcf7f('0x3')};function emitEvent(_0x31b0b8){return function(_0x3836a5,_0x56c9a0,_0x370913){OpenchannelQueueEvents[_0xcf7f('0x4')](_0x31b0b8+':'+_0x3836a5['id'],_0x3836a5);OpenchannelQueueEvents[_0xcf7f('0x4')](_0x31b0b8,_0x3836a5);_0x370913(null);};}for(var e in events){if(events[_0xcf7f('0x5')](e)){var event=events[e];OpenchannelQueue[_0xcf7f('0x6')](e,emitEvent(event));}}module[_0xcf7f('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 65f3bdf..4a2dff4 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 _0xe4a0=['rimraf','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x710d39,_0x36485b){var _0x5406e2=function(_0x49c8d3){while(--_0x49c8d3){_0x710d39['push'](_0x710d39['shift']());}};_0x5406e2(++_0x36485b);}(_0xe4a0,0x1f4));var _0x0e4a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe4a0[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0e4a('0x0'));var util=require(_0x0e4a('0x1'));var logger=require('../../config/logger')(_0x0e4a('0x2'));var moment=require('moment');var BPromise=require(_0x0e4a('0x3'));var rp=require(_0x0e4a('0x4'));var fs=require('fs');var path=require(_0x0e4a('0x5'));var rimraf=require(_0x0e4a('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e4a('0x7'));module[_0x0e4a('0x8')]=function(_0x1b8027,_0x53591d){return _0x1b8027[_0x0e4a('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x0e4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53dd=['path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','api','moment','bluebird','request-promise'];(function(_0x4a28e5,_0x478883){var _0x37b10f=function(_0x42f33f){while(--_0x42f33f){_0x4a28e5['push'](_0x4a28e5['shift']());}};_0x37b10f(++_0x478883);}(_0x53dd,0x10f));var _0xd53d=function(_0x1e86bb,_0x38220f){_0x1e86bb=_0x1e86bb-0x0;var _0x2d781e=_0x53dd[_0x1e86bb];return _0x2d781e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd53d('0x0'));var moment=require(_0xd53d('0x1'));var BPromise=require(_0xd53d('0x2'));var rp=require(_0xd53d('0x3'));var fs=require('fs');var path=require(_0xd53d('0x4'));var rimraf=require(_0xd53d('0x5'));var config=require(_0xd53d('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xd53d('0x7')]=function(_0x2c247e,_0x2fdcdb){return _0x2c247e[_0xd53d('0x8')](_0xd53d('0x9'),attributes,{'tableName':_0xd53d('0xa'),'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 a3c2ce9..8932b46 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 _0x28ef=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','find','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','defaults','redis','localhost','./openchannelQueue.socket','register','request','then'];(function(_0x1503ac,_0x5d7ad5){var _0x3183e1=function(_0x3d8650){while(--_0x3d8650){_0x1503ac['push'](_0x1503ac['shift']());}};_0x3183e1(++_0x5d7ad5);}(_0x28ef,0x7a));var _0xf28e=function(_0x217c84,_0x45539f){_0x217c84=_0x217c84-0x0;var _0x8d46de=_0x28ef[_0x217c84];return _0x8d46de;};'use strict';var _=require('lodash');var util=require(_0xf28e('0x0'));var moment=require('moment');var BPromise=require(_0xf28e('0x1'));var rs=require(_0xf28e('0x2'));var fs=require('fs');var Redis=require(_0xf28e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf28e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf28e('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf28e('0x6')]({'port':0x232a});config['redis']=_[_0xf28e('0x7')](config[_0xf28e('0x8')],{'host':_0xf28e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf28e('0x8')]));require(_0xf28e('0xa'))[_0xf28e('0xb')](socket);function respondWithRpcPromise(_0x1a206f,_0x5ee95b,_0x5badd6){return new BPromise(function(_0x488f98,_0x52243e){return client[_0xf28e('0xc')](_0x1a206f,_0x5badd6)[_0xf28e('0xd')](function(_0x2d1c8f){logger[_0xf28e('0xe')](_0xf28e('0xf'),_0x5ee95b,_0xf28e('0x10'));logger[_0xf28e('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5ee95b,_0xf28e('0x10'),JSON[_0xf28e('0x12')](_0x2d1c8f));if(_0x2d1c8f[_0xf28e('0x13')]){if(_0x2d1c8f['error']['code']===0x1f4){logger[_0xf28e('0x13')](_0xf28e('0xf'),_0x5ee95b,_0x2d1c8f[_0xf28e('0x13')][_0xf28e('0x14')]);return _0x52243e(_0x2d1c8f[_0xf28e('0x13')]['message']);}logger['error'](_0xf28e('0xf'),_0x5ee95b,_0x2d1c8f[_0xf28e('0x13')][_0xf28e('0x14')]);return _0x488f98(_0x2d1c8f['error'][_0xf28e('0x14')]);}else{logger['info'](_0xf28e('0xf'),_0x5ee95b,_0xf28e('0x10'));_0x488f98(_0x2d1c8f['result']['message']);}})[_0xf28e('0x15')](function(_0x5cf98e){logger[_0xf28e('0x13')](_0xf28e('0xf'),_0x5ee95b,_0x5cf98e);_0x52243e(_0x5cf98e);});});}exports[_0xf28e('0x16')]=function(_0x43df03){var _0x306437=this;return new Promise(function(_0x1450b2,_0x1e1557){return db[_0xf28e('0x17')]['findAll']({'raw':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')][_0xf28e('0x19')]===undefined?!![]:![]:!![],'where':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')][_0xf28e('0x1a')]||null:null,'attributes':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')][_0xf28e('0x1b')]||null:null,'limit':_0x43df03['options']?_0x43df03[_0xf28e('0x18')][_0xf28e('0x1c')]||null:null,'include':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')]['include']?_[_0xf28e('0x1d')](_0x43df03['options'][_0xf28e('0x1e')],function(_0xe85b94){return{'model':db[_0xe85b94['model']],'as':_0xe85b94['as'],'attributes':_0xe85b94[_0xf28e('0x1b')],'include':_0xe85b94[_0xf28e('0x1e')]?_[_0xf28e('0x1d')](_0xe85b94[_0xf28e('0x1e')],function(_0x172f31){return{'model':db[_0x172f31[_0xf28e('0x1f')]],'as':_0x172f31['as'],'attributes':_0x172f31[_0xf28e('0x1b')],'include':_0x172f31[_0xf28e('0x1e')]?_[_0xf28e('0x1d')](_0x172f31[_0xf28e('0x1e')],function(_0x93fa46){return{'model':db[_0x93fa46['model']],'as':_0x93fa46['as'],'attributes':_0x93fa46[_0xf28e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf28e('0xd')](function(_0x3cae2a){logger[_0xf28e('0xe')](_0xf28e('0x16'),_0x43df03);logger['debug'](_0xf28e('0x16'),_0x43df03,JSON['stringify'](_0x3cae2a));_0x1450b2(_0x3cae2a);})['catch'](function(_0xca4931){logger[_0xf28e('0x13')](_0xf28e('0x16'),_0xca4931[_0xf28e('0x14')],_0x43df03);_0x1e1557(_0x306437[_0xf28e('0x13')](0x1f4,_0xca4931[_0xf28e('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0x19eee0){var _0x403992=this;return new Promise(function(_0x57d67f,_0x450214){return db[_0xf28e('0x17')][_0xf28e('0x20')]({'raw':_0x19eee0['options']?_0x19eee0['options'][_0xf28e('0x19')]===undefined?!![]:![]:!![],'where':_0x19eee0[_0xf28e('0x18')]?_0x19eee0[_0xf28e('0x18')][_0xf28e('0x1a')]||null:null,'attributes':_0x19eee0['options']?_0x19eee0['options'][_0xf28e('0x1b')]||null:null,'include':_0x19eee0[_0xf28e('0x18')]?_0x19eee0[_0xf28e('0x18')]['include']?_[_0xf28e('0x1d')](_0x19eee0[_0xf28e('0x18')][_0xf28e('0x1e')],function(_0x82cb05){return{'model':db[_0x82cb05[_0xf28e('0x1f')]],'as':_0x82cb05['as'],'attributes':_0x82cb05['attributes'],'include':_0x82cb05['include']?_['map'](_0x82cb05['include'],function(_0x3e6101){return{'model':db[_0x3e6101[_0xf28e('0x1f')]],'as':_0x3e6101['as'],'attributes':_0x3e6101['attributes'],'include':_0x3e6101[_0xf28e('0x1e')]?_[_0xf28e('0x1d')](_0x3e6101[_0xf28e('0x1e')],function(_0x3d591a){return{'model':db[_0x3d591a[_0xf28e('0x1f')]],'as':_0x3d591a['as'],'attributes':_0x3d591a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ccaa5){logger[_0xf28e('0xe')]('ShowOpenchannelQueue',_0x19eee0);logger[_0xf28e('0x11')](_0xf28e('0x21'),_0x19eee0,JSON[_0xf28e('0x12')](_0x5ccaa5));_0x57d67f(_0x5ccaa5);})[_0xf28e('0x15')](function(_0x5cec8e){logger[_0xf28e('0x13')]('ShowOpenchannelQueue',_0x5cec8e[_0xf28e('0x14')],_0x19eee0);_0x450214(_0x403992[_0xf28e('0x13')](0x1f4,_0x5cec8e[_0xf28e('0x14')]));});});}; \ No newline at end of file +var _0xabb4=['localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueue,\x20%s,\x20%s','catch','GetOpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','OpenchannelQueue','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x4ce85b,_0x48a3a8){var _0x113d86=function(_0x2c8d42){while(--_0x2c8d42){_0x4ce85b['push'](_0x4ce85b['shift']());}};_0x113d86(++_0x48a3a8);}(_0xabb4,0xff));var _0x4abb=function(_0x6e8ac2,_0x2be4a7){_0x6e8ac2=_0x6e8ac2-0x0;var _0x33bf19=_0xabb4[_0x6e8ac2];return _0x33bf19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4abb('0x0'));var BPromise=require(_0x4abb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4abb('0x2'));var db=require(_0x4abb('0x3'))['db'];var utils=require(_0x4abb('0x4'));var logger=require('../../config/logger')(_0x4abb('0x5'));var config=require(_0x4abb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4abb('0x7')][_0x4abb('0x8')]({'port':0x232a});config['redis']=_[_0x4abb('0x9')](config[_0x4abb('0xa')],{'host':_0x4abb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4abb('0xa')]));require(_0x4abb('0xc'))[_0x4abb('0xd')](socket);function respondWithRpcPromise(_0x5b2708,_0x426c4b,_0x1a0f1d){return new BPromise(function(_0x1eeae7,_0x1b8398){return client[_0x4abb('0xe')](_0x5b2708,_0x1a0f1d)[_0x4abb('0xf')](function(_0x14fcc2){logger[_0x4abb('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x426c4b,_0x4abb('0x11'));logger[_0x4abb('0x12')](_0x4abb('0x13'),_0x426c4b,'request\x20sent',JSON['stringify'](_0x14fcc2));if(_0x14fcc2[_0x4abb('0x14')]){if(_0x14fcc2[_0x4abb('0x14')][_0x4abb('0x15')]===0x1f4){logger[_0x4abb('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x426c4b,_0x14fcc2[_0x4abb('0x14')][_0x4abb('0x16')]);return _0x1b8398(_0x14fcc2['error'][_0x4abb('0x16')]);}logger['error'](_0x4abb('0x17'),_0x426c4b,_0x14fcc2[_0x4abb('0x14')][_0x4abb('0x16')]);return _0x1eeae7(_0x14fcc2[_0x4abb('0x14')][_0x4abb('0x16')]);}else{logger[_0x4abb('0x10')](_0x4abb('0x17'),_0x426c4b,_0x4abb('0x11'));_0x1eeae7(_0x14fcc2['result'][_0x4abb('0x16')]);}})[_0x4abb('0x18')](function(_0x39f5d0){logger[_0x4abb('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x426c4b,_0x39f5d0);_0x1b8398(_0x39f5d0);});});}exports[_0x4abb('0x19')]=function(_0x49f199){var _0x3d2c8f=this;return new Promise(function(_0x3a769c,_0x1e7c49){return db['OpenchannelQueue'][_0x4abb('0x1a')]({'raw':_0x49f199[_0x4abb('0x1b')]?_0x49f199['options']['raw']===undefined?!![]:![]:!![],'where':_0x49f199[_0x4abb('0x1b')]?_0x49f199[_0x4abb('0x1b')][_0x4abb('0x1c')]||null:null,'attributes':_0x49f199['options']?_0x49f199[_0x4abb('0x1b')][_0x4abb('0x1d')]||null:null,'limit':_0x49f199[_0x4abb('0x1b')]?_0x49f199['options'][_0x4abb('0x1e')]||null:null,'include':_0x49f199[_0x4abb('0x1b')]?_0x49f199[_0x4abb('0x1b')][_0x4abb('0x1f')]?_[_0x4abb('0x20')](_0x49f199[_0x4abb('0x1b')][_0x4abb('0x1f')],function(_0x1b1790){return{'model':db[_0x1b1790[_0x4abb('0x21')]],'as':_0x1b1790['as'],'attributes':_0x1b1790['attributes'],'include':_0x1b1790[_0x4abb('0x1f')]?_[_0x4abb('0x20')](_0x1b1790[_0x4abb('0x1f')],function(_0x36d843){return{'model':db[_0x36d843[_0x4abb('0x21')]],'as':_0x36d843['as'],'attributes':_0x36d843[_0x4abb('0x1d')],'include':_0x36d843[_0x4abb('0x1f')]?_[_0x4abb('0x20')](_0x36d843['include'],function(_0x5e3427){return{'model':db[_0x5e3427[_0x4abb('0x21')]],'as':_0x5e3427['as'],'attributes':_0x5e3427[_0x4abb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4abb('0xf')](function(_0x5b19fe){logger['info'](_0x4abb('0x19'),_0x49f199);logger['debug'](_0x4abb('0x19'),_0x49f199,JSON[_0x4abb('0x22')](_0x5b19fe));_0x3a769c(_0x5b19fe);})[_0x4abb('0x18')](function(_0x26e939){logger[_0x4abb('0x14')](_0x4abb('0x19'),_0x26e939[_0x4abb('0x16')],_0x49f199);_0x1e7c49(_0x3d2c8f[_0x4abb('0x14')](0x1f4,_0x26e939['message']));});});};exports[_0x4abb('0x23')]=function(_0x3e6fae){var _0x472dcc=this;return new Promise(function(_0x3e2135,_0x51ba56){return db[_0x4abb('0x24')][_0x4abb('0x25')]({'raw':_0x3e6fae[_0x4abb('0x1b')]?_0x3e6fae[_0x4abb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3e6fae['options']?_0x3e6fae[_0x4abb('0x1b')]['where']||null:null,'attributes':_0x3e6fae[_0x4abb('0x1b')]?_0x3e6fae['options'][_0x4abb('0x1d')]||null:null,'include':_0x3e6fae[_0x4abb('0x1b')]?_0x3e6fae[_0x4abb('0x1b')][_0x4abb('0x1f')]?_[_0x4abb('0x20')](_0x3e6fae['options']['include'],function(_0x1aa256){return{'model':db[_0x1aa256[_0x4abb('0x21')]],'as':_0x1aa256['as'],'attributes':_0x1aa256[_0x4abb('0x1d')],'include':_0x1aa256[_0x4abb('0x1f')]?_['map'](_0x1aa256['include'],function(_0x2d9132){return{'model':db[_0x2d9132[_0x4abb('0x21')]],'as':_0x2d9132['as'],'attributes':_0x2d9132[_0x4abb('0x1d')],'include':_0x2d9132['include']?_[_0x4abb('0x20')](_0x2d9132['include'],function(_0x133116){return{'model':db[_0x133116[_0x4abb('0x21')]],'as':_0x133116['as'],'attributes':_0x133116[_0x4abb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4abb('0xf')](function(_0x5920b5){logger['info'](_0x4abb('0x23'),_0x3e6fae);logger[_0x4abb('0x12')](_0x4abb('0x23'),_0x3e6fae,JSON[_0x4abb('0x22')](_0x5920b5));_0x3e2135(_0x5920b5);})[_0x4abb('0x18')](function(_0x6bec66){logger[_0x4abb('0x14')](_0x4abb('0x23'),_0x6bec66[_0x4abb('0x16')],_0x3e6fae);_0x51ba56(_0x472dcc[_0x4abb('0x14')](0x1f4,_0x6bec66[_0x4abb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 379a816..f9122d2 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 _0x0dd6=['remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x55e7fc,_0x415229){var _0x4b7604=function(_0x3aa945){while(--_0x3aa945){_0x55e7fc['push'](_0x55e7fc['shift']());}};_0x4b7604(++_0x415229);}(_0x0dd6,0x7d));var _0x60dd=function(_0x2fffff,_0x415518){_0x2fffff=_0x2fffff-0x0;var _0x4f2a2c=_0x0dd6[_0x2fffff];return _0x4f2a2c;};'use strict';var OpenchannelQueueEvents=require(_0x60dd('0x0'));var events=['save',_0x60dd('0x1'),_0x60dd('0x2')];function createListener(_0x46f6e9,_0x49a6e0){return function(_0x2ffff0){_0x49a6e0[_0x60dd('0x3')](_0x46f6e9,_0x2ffff0);};}function removeListener(_0x5607ef,_0x2e7192){return function(){OpenchannelQueueEvents[_0x60dd('0x4')](_0x5607ef,_0x2e7192);};}exports[_0x60dd('0x5')]=function(_0x5bd13a){for(var _0xc24bf6=0x0,_0x19f97e=events['length'];_0xc24bf6<_0x19f97e;_0xc24bf6++){var _0x1d69ca=events[_0xc24bf6];var _0x1a5f44=createListener(_0x60dd('0x6')+_0x1d69ca,_0x5bd13a);OpenchannelQueueEvents['on'](_0x1d69ca,_0x1a5f44);}}; \ No newline at end of file +var _0x7bb8=['emit','removeListener','length','openchannelQueue:','remove','update'];(function(_0x3120ba,_0x9a48e0){var _0x2a0794=function(_0x4cc433){while(--_0x4cc433){_0x3120ba['push'](_0x3120ba['shift']());}};_0x2a0794(++_0x9a48e0);}(_0x7bb8,0xb8));var _0x87bb=function(_0x4c7ee9,_0x2d459d){_0x4c7ee9=_0x4c7ee9-0x0;var _0x40b2e9=_0x7bb8[_0x4c7ee9];return _0x40b2e9;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x87bb('0x0'),_0x87bb('0x1')];function createListener(_0x5279f4,_0x58ed9f){return function(_0x46f9f5){_0x58ed9f[_0x87bb('0x2')](_0x5279f4,_0x46f9f5);};}function removeListener(_0x36f44a,_0x4feae8){return function(){OpenchannelQueueEvents[_0x87bb('0x3')](_0x36f44a,_0x4feae8);};}exports['register']=function(_0x824003){for(var _0xef5c35=0x0,_0x645e7c=events[_0x87bb('0x4')];_0xef5c35<_0x645e7c;_0xef5c35++){var _0x1c8648=events[_0xef5c35];var _0x1c0502=createListener(_0x87bb('0x5')+_0x1c8648,_0x824003);OpenchannelQueueEvents['on'](_0x1c8648,_0x1c0502);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f97840c..562a455 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 _0x2e95=['./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x520612,_0x112776){var _0x386075=function(_0x54a77f){while(--_0x54a77f){_0x520612['push'](_0x520612['shift']());}};_0x386075(++_0x112776);}(_0x2e95,0x13e));var _0x52e9=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x2e95[_0x421cf8];return _0x145c48;};'use strict';var multer=require('multer');var util=require(_0x52e9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x52e9('0x1'));var router=express[_0x52e9('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x52e9('0x3'));var config=require(_0x52e9('0x4'));var controller=require(_0x52e9('0x5'));router['get']('/',auth[_0x52e9('0x6')](),controller[_0x52e9('0x7')]);router[_0x52e9('0x8')](_0x52e9('0x9'),auth[_0x52e9('0x6')](),controller[_0x52e9('0xa')]);router[_0x52e9('0x8')](_0x52e9('0xb'),auth['isAuthenticated'](),controller[_0x52e9('0xc')]);router['post']('/',auth[_0x52e9('0x6')](),controller[_0x52e9('0xd')]);router['put'](_0x52e9('0xb'),auth[_0x52e9('0x6')](),controller['update']);router[_0x52e9('0xe')](_0x52e9('0xb'),auth['isAuthenticated'](),controller[_0x52e9('0xf')]);module[_0x52e9('0x10')]=router; \ No newline at end of file +var _0x3c6b=['update','multer','path','Router','../../components/auth/service','./openchannelQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put'];(function(_0x11c9d7,_0x29c9f0){var _0x31bcbb=function(_0x21a706){while(--_0x21a706){_0x11c9d7['push'](_0x11c9d7['shift']());}};_0x31bcbb(++_0x29c9f0);}(_0x3c6b,0x191));var _0xb3c6=function(_0xbf6bb2,_0x55ce47){_0xbf6bb2=_0xbf6bb2-0x0;var _0x54e71f=_0x3c6b[_0xbf6bb2];return _0x54e71f;};'use strict';var multer=require(_0xb3c6('0x0'));var util=require('util');var path=require(_0xb3c6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb3c6('0x2')]();var auth=require(_0xb3c6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3c6('0x4'));router['get']('/',auth[_0xb3c6('0x5')](),controller[_0xb3c6('0x6')]);router['get'](_0xb3c6('0x7'),auth['isAuthenticated'](),controller[_0xb3c6('0x8')]);router[_0xb3c6('0x9')](_0xb3c6('0xa'),auth[_0xb3c6('0x5')](),controller[_0xb3c6('0xb')]);router[_0xb3c6('0xc')]('/',auth[_0xb3c6('0x5')](),controller[_0xb3c6('0xd')]);router[_0xb3c6('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb3c6('0xf')]);router['delete'](_0xb3c6('0xa'),auth['isAuthenticated'](),controller['destroy']);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 dc155a2..a0b2993 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 _0xc1ff=['moment','sequelize','exports','STRING','DATE'];(function(_0x2824b8,_0x1fe599){var _0x16913a=function(_0x107149){while(--_0x107149){_0x2824b8['push'](_0x2824b8['shift']());}};_0x16913a(++_0x1fe599);}(_0xc1ff,0x1c2));var _0xfc1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ff[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfc1f('0x0'));var Sequelize=require(_0xfc1f('0x1'));module[_0xfc1f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfc1f('0x3')]},'joinAt':{'type':Sequelize[_0xfc1f('0x4')]},'leaveAt':{'type':Sequelize[_0xfc1f('0x4')]},'acceptAt':{'type':Sequelize[_0xfc1f('0x4')]},'exitAt':{'type':Sequelize[_0xfc1f('0x4')]},'reason':{'type':Sequelize[_0xfc1f('0x3')]}}; \ No newline at end of file +var _0xcba6=['sequelize','exports','STRING','DATE'];(function(_0x52e9fa,_0x584b69){var _0x175185=function(_0xdb3228){while(--_0xdb3228){_0x52e9fa['push'](_0x52e9fa['shift']());}};_0x175185(++_0x584b69);}(_0xcba6,0x15c));var _0x6cba=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcba6[_0x17d9e3];return _0x14192d;};'use strict';var moment=require('moment');var Sequelize=require(_0x6cba('0x0'));module[_0x6cba('0x1')]={'uniqueid':{'type':Sequelize[_0x6cba('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6cba('0x2')]},'joinAt':{'type':Sequelize[_0x6cba('0x3')]},'leaveAt':{'type':Sequelize[_0x6cba('0x3')]},'acceptAt':{'type':Sequelize[_0x6cba('0x3')]},'exitAt':{'type':Sequelize[_0x6cba('0x3')]},'reason':{'type':Sequelize[_0x6cba('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 738867e..79a6890 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 _0xae75=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','apply','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x49f765,_0x15d520){var _0x2cceb7=function(_0x149fd3){while(--_0x149fd3){_0x49f765['push'](_0x49f765['shift']());}};_0x2cceb7(++_0x15d520);}(_0xae75,0xce));var _0x5ae7=function(_0x188097,_0x198463){_0x188097=_0x188097-0x0;var _0x3566f1=_0xae75[_0x188097];return _0x3566f1;};'use strict';var pdf=require(_0x5ae7('0x0'));var emlformat=require(_0x5ae7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5ae7('0x2'));var jsonpatch=require(_0x5ae7('0x3'));var rp=require(_0x5ae7('0x4'));var moment=require(_0x5ae7('0x5'));var BPromise=require(_0x5ae7('0x6'));var Mustache=require(_0x5ae7('0x7'));var util=require(_0x5ae7('0x8'));var path=require(_0x5ae7('0x9'));var sox=require(_0x5ae7('0xa'));var csv=require(_0x5ae7('0xb'));var ejs=require(_0x5ae7('0xc'));var fs=require('fs');var _=require(_0x5ae7('0xd'));var squel=require(_0x5ae7('0xe'));var crypto=require(_0x5ae7('0xf'));var jsforce=require(_0x5ae7('0x10'));var deskjs=require(_0x5ae7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5ae7('0x12'));var Papa=require(_0x5ae7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ae7('0x14'));var as=require(_0x5ae7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ae7('0x16'))('api');var utils=require(_0x5ae7('0x17'));var config=require('../../config/environment');var db=require(_0x5ae7('0x18'))['db'];function respondWithStatusCode(_0x3c4e78,_0x13c028){_0x13c028=_0x13c028||0xcc;return function(_0x111069){if(_0x111069){return _0x3c4e78[_0x5ae7('0x19')](_0x13c028);}return _0x3c4e78[_0x5ae7('0x1a')](_0x13c028)['end']();};}function respondWithResult(_0x3751b2,_0xc761fd){_0xc761fd=_0xc761fd||0xc8;return function(_0x4cd96c){if(_0x4cd96c){return _0x3751b2[_0x5ae7('0x1a')](_0xc761fd)[_0x5ae7('0x1b')](_0x4cd96c);}};}function respondWithFilteredResult(_0x3212d1,_0x3144f9){return function(_0xf5322e){if(_0xf5322e){var _0x2e35e1=_0xf5322e[_0x5ae7('0x1c')],_0x31951e=_0x3144f9['offset'],_0x2236b3=_0x3144f9['offset']+_0x3144f9['limit'],_0x53266d;if(_0x2236b3>=_0x2e35e1){_0x2236b3=_0x2e35e1;_0x53266d=0xc8;}else{_0x53266d=0xce;}_0x3212d1[_0x5ae7('0x1a')](_0x53266d);return _0x3212d1['set']('Content-Range',_0x31951e+'-'+_0x2236b3+'/'+_0x2e35e1)['json'](_0xf5322e);}return null;};}function patchUpdates(_0x558b3e){return function(_0xdca84){try{jsonpatch[_0x5ae7('0x1d')](_0xdca84,_0x558b3e,!![]);}catch(_0x1db886){return BPromise[_0x5ae7('0x1e')](_0x1db886);}return _0xdca84['save']();};}function saveUpdates(_0x35a7a5,_0x3d2a70){return function(_0x29951a){if(_0x29951a){return _0x29951a[_0x5ae7('0x1f')](_0x35a7a5)[_0x5ae7('0x20')](function(_0x23b4e9){return _0x23b4e9;});}return null;};}function removeEntity(_0xd3c34c,_0x2e7a72){return function(_0x4084d3){if(_0x4084d3){return _0x4084d3[_0x5ae7('0x21')]()[_0x5ae7('0x20')](function(){_0xd3c34c[_0x5ae7('0x1a')](0xcc)[_0x5ae7('0x22')]();});}};}function handleEntityNotFound(_0x4d5207,_0x2a7976){return function(_0x1fb6c3){if(!_0x1fb6c3){_0x4d5207[_0x5ae7('0x19')](0x194);}return _0x1fb6c3;};}function handleError(_0x3e0e72,_0x2b0649){_0x2b0649=_0x2b0649||0x1f4;return function(_0x5cac2d){logger[_0x5ae7('0x23')](_0x5cac2d[_0x5ae7('0x24')]);if(_0x5cac2d[_0x5ae7('0x25')]){delete _0x5cac2d[_0x5ae7('0x25')];}_0x3e0e72[_0x5ae7('0x1a')](_0x2b0649)['send'](_0x5cac2d);};}exports[_0x5ae7('0x26')]=function(_0x3c8724,_0x5b35bf){var _0x22fe04={},_0x1c0402={},_0x26f71b={'count':0x0,'rows':[]};var _0x3864fd=_[_0x5ae7('0x27')](db[_0x5ae7('0x28')][_0x5ae7('0x29')],function(_0x3f6c46){return{'name':_0x3f6c46[_0x5ae7('0x2a')],'type':_0x3f6c46['type'][_0x5ae7('0x2b')]};});_0x1c0402[_0x5ae7('0x2c')]=_[_0x5ae7('0x27')](_0x3864fd,_0x5ae7('0x25'));_0x1c0402[_0x5ae7('0x2d')]=_[_0x5ae7('0x2e')](_0x3c8724[_0x5ae7('0x2d')]);_0x1c0402['filters']=_['intersection'](_0x1c0402['model'],_0x1c0402[_0x5ae7('0x2d')]);_0x22fe04[_0x5ae7('0x2f')]=_[_0x5ae7('0x30')](_0x1c0402['model'],qs[_0x5ae7('0x31')](_0x3c8724['query'][_0x5ae7('0x31')]));_0x22fe04[_0x5ae7('0x2f')]=_0x22fe04[_0x5ae7('0x2f')][_0x5ae7('0x32')]?_0x22fe04[_0x5ae7('0x2f')]:_0x1c0402[_0x5ae7('0x2c')];if(!_0x3c8724[_0x5ae7('0x2d')]['hasOwnProperty'](_0x5ae7('0x33'))){_0x22fe04['limit']=qs['limit'](_0x3c8724['query'][_0x5ae7('0x34')]);_0x22fe04[_0x5ae7('0x35')]=qs[_0x5ae7('0x35')](_0x3c8724[_0x5ae7('0x2d')]['offset']);}_0x22fe04[_0x5ae7('0x36')]=qs[_0x5ae7('0x37')](_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x37')]);_0x22fe04[_0x5ae7('0x38')]=qs[_0x5ae7('0x39')](_[_0x5ae7('0x3a')](_0x3c8724[_0x5ae7('0x2d')],_0x1c0402[_0x5ae7('0x39')]),_0x3864fd);if(_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x3b')]){_0x22fe04[_0x5ae7('0x38')]=_[_0x5ae7('0x3c')](_0x22fe04[_0x5ae7('0x38')],{'$or':_['map'](_0x3864fd,function(_0x270b29){if(_0x270b29['type']!==_0x5ae7('0x3d')){var _0x588bc5={};_0x588bc5[_0x270b29['name']]={'$like':'%'+_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x3b')]+'%'};return _0x588bc5;}})});}_0x22fe04=_[_0x5ae7('0x3c')]({},_0x22fe04,_0x3c8724[_0x5ae7('0x3e')]);var _0x3b9861={'where':_0x22fe04['where']};return db[_0x5ae7('0x28')][_0x5ae7('0x1c')](_0x3b9861)[_0x5ae7('0x20')](function(_0x351822){_0x26f71b[_0x5ae7('0x1c')]=_0x351822;if(_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x3f')]){_0x22fe04[_0x5ae7('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5ae7('0x41')](_0x22fe04);})[_0x5ae7('0x20')](function(_0x3da282){_0x26f71b[_0x5ae7('0x42')]=_0x3da282;return _0x26f71b;})[_0x5ae7('0x20')](respondWithFilteredResult(_0x5b35bf,_0x22fe04))[_0x5ae7('0x43')](handleError(_0x5b35bf,null));};exports[_0x5ae7('0x44')]=function(_0x5cbb5e,_0x2174a6){var _0x4f8469={'raw':!![],'where':{'id':_0x5cbb5e[_0x5ae7('0x45')]['id']}},_0x3b0285={};_0x3b0285[_0x5ae7('0x2c')]=_[_0x5ae7('0x2e')](db[_0x5ae7('0x28')][_0x5ae7('0x29')]);_0x3b0285[_0x5ae7('0x2d')]=_[_0x5ae7('0x2e')](_0x5cbb5e[_0x5ae7('0x2d')]);_0x3b0285[_0x5ae7('0x39')]=_[_0x5ae7('0x30')](_0x3b0285[_0x5ae7('0x2c')],_0x3b0285[_0x5ae7('0x2d')]);_0x4f8469[_0x5ae7('0x2f')]=_[_0x5ae7('0x30')](_0x3b0285[_0x5ae7('0x2c')],qs[_0x5ae7('0x31')](_0x5cbb5e[_0x5ae7('0x2d')]['fields']));_0x4f8469['attributes']=_0x4f8469[_0x5ae7('0x2f')][_0x5ae7('0x32')]?_0x4f8469['attributes']:_0x3b0285['model'];if(_0x5cbb5e[_0x5ae7('0x2d')][_0x5ae7('0x3f')]){_0x4f8469['include']=[{'all':!![]}];}_0x4f8469=_[_0x5ae7('0x3c')]({},_0x4f8469,_0x5cbb5e[_0x5ae7('0x3e')]);return db[_0x5ae7('0x28')][_0x5ae7('0x46')](_0x4f8469)['then'](handleEntityNotFound(_0x2174a6,null))['then'](respondWithResult(_0x2174a6,null))['catch'](handleError(_0x2174a6,null));};exports[_0x5ae7('0x47')]=function(_0x240123,_0xd7b7a1){return db[_0x5ae7('0x28')]['create'](_0x240123[_0x5ae7('0x48')],{})[_0x5ae7('0x20')](respondWithResult(_0xd7b7a1,0xc9))[_0x5ae7('0x43')](handleError(_0xd7b7a1,null));};exports[_0x5ae7('0x1f')]=function(_0x2db1e6,_0x1b75e8){if(_0x2db1e6[_0x5ae7('0x48')]['id']){delete _0x2db1e6[_0x5ae7('0x48')]['id'];}return db[_0x5ae7('0x28')][_0x5ae7('0x46')]({'where':{'id':_0x2db1e6['params']['id']}})[_0x5ae7('0x20')](handleEntityNotFound(_0x1b75e8,null))[_0x5ae7('0x20')](saveUpdates(_0x2db1e6[_0x5ae7('0x48')],null))[_0x5ae7('0x20')](respondWithResult(_0x1b75e8,null))[_0x5ae7('0x43')](handleError(_0x1b75e8,null));};exports[_0x5ae7('0x21')]=function(_0xb0941b,_0x2a9eca){return db['OpenchannelQueueReport'][_0x5ae7('0x46')]({'where':{'id':_0xb0941b[_0x5ae7('0x45')]['id']}})[_0x5ae7('0x20')](handleEntityNotFound(_0x2a9eca,null))[_0x5ae7('0x20')](removeEntity(_0x2a9eca,null))['catch'](handleError(_0x2a9eca,null));};exports[_0x5ae7('0x49')]=function(_0x3894df,_0x5c6fe0){return db[_0x5ae7('0x28')][_0x5ae7('0x49')]()[_0x5ae7('0x20')](respondWithResult(_0x5c6fe0,null))['catch'](handleError(_0x5c6fe0,null));}; \ No newline at end of file +var _0x2c27=['create','body','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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','json','count','offset','set','Content-Range','reject','update','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','include','options','find'];(function(_0x1673af,_0x4a64c1){var _0x4c1990=function(_0x3eb780){while(--_0x3eb780){_0x1673af['push'](_0x1673af['shift']());}};_0x4c1990(++_0x4a64c1);}(_0x2c27,0x9f));var _0x72c2=function(_0x48654d,_0x1960dd){_0x48654d=_0x48654d-0x0;var _0x1cc79d=_0x2c27[_0x48654d];return _0x1cc79d;};'use strict';var pdf=require(_0x72c2('0x0'));var emlformat=require(_0x72c2('0x1'));var rimraf=require(_0x72c2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72c2('0x3'));var rp=require(_0x72c2('0x4'));var moment=require('moment');var BPromise=require(_0x72c2('0x5'));var Mustache=require(_0x72c2('0x6'));var util=require(_0x72c2('0x7'));var path=require(_0x72c2('0x8'));var sox=require(_0x72c2('0x9'));var csv=require(_0x72c2('0xa'));var ejs=require(_0x72c2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72c2('0xc'));var crypto=require(_0x72c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x72c2('0xe'));var toCsv=require(_0x72c2('0xa'));var querystring=require(_0x72c2('0xf'));var Papa=require(_0x72c2('0x10'));var Redis=require(_0x72c2('0x11'));var authService=require(_0x72c2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72c2('0x13'));var hardwareService=require(_0x72c2('0x14'));var logger=require(_0x72c2('0x15'))(_0x72c2('0x16'));var utils=require(_0x72c2('0x17'));var config=require(_0x72c2('0x18'));var db=require(_0x72c2('0x19'))['db'];function respondWithStatusCode(_0x503e3c,_0x28a604){_0x28a604=_0x28a604||0xcc;return function(_0xe4da48){if(_0xe4da48){return _0x503e3c[_0x72c2('0x1a')](_0x28a604);}return _0x503e3c[_0x72c2('0x1b')](_0x28a604)[_0x72c2('0x1c')]();};}function respondWithResult(_0x2b89af,_0x505cf5){_0x505cf5=_0x505cf5||0xc8;return function(_0x36f881){if(_0x36f881){return _0x2b89af['status'](_0x505cf5)[_0x72c2('0x1d')](_0x36f881);}};}function respondWithFilteredResult(_0x583e28,_0x2a4078){return function(_0x50d82f){if(_0x50d82f){var _0x586e8d=_0x50d82f[_0x72c2('0x1e')],_0x70c9e1=_0x2a4078[_0x72c2('0x1f')],_0x23d63f=_0x2a4078[_0x72c2('0x1f')]+_0x2a4078['limit'],_0x51648a;if(_0x23d63f>=_0x586e8d){_0x23d63f=_0x586e8d;_0x51648a=0xc8;}else{_0x51648a=0xce;}_0x583e28[_0x72c2('0x1b')](_0x51648a);return _0x583e28[_0x72c2('0x20')](_0x72c2('0x21'),_0x70c9e1+'-'+_0x23d63f+'/'+_0x586e8d)[_0x72c2('0x1d')](_0x50d82f);}return null;};}function patchUpdates(_0x283956){return function(_0x66c543){try{jsonpatch['apply'](_0x66c543,_0x283956,!![]);}catch(_0x5d4f77){return BPromise[_0x72c2('0x22')](_0x5d4f77);}return _0x66c543['save']();};}function saveUpdates(_0x5ffd18,_0x5509d9){return function(_0x2453be){if(_0x2453be){return _0x2453be[_0x72c2('0x23')](_0x5ffd18)[_0x72c2('0x24')](function(_0x2cdd1b){return _0x2cdd1b;});}return null;};}function removeEntity(_0x18129d,_0x3c1789){return function(_0x3d449d){if(_0x3d449d){return _0x3d449d['destroy']()[_0x72c2('0x24')](function(){_0x18129d[_0x72c2('0x1b')](0xcc)[_0x72c2('0x1c')]();});}};}function handleEntityNotFound(_0x5f070f,_0x1ddf16){return function(_0x4851ee){if(!_0x4851ee){_0x5f070f[_0x72c2('0x1a')](0x194);}return _0x4851ee;};}function handleError(_0x260523,_0xf2b3e2){_0xf2b3e2=_0xf2b3e2||0x1f4;return function(_0x4fa67f){logger[_0x72c2('0x25')](_0x4fa67f['stack']);if(_0x4fa67f[_0x72c2('0x26')]){delete _0x4fa67f[_0x72c2('0x26')];}_0x260523[_0x72c2('0x1b')](_0xf2b3e2)[_0x72c2('0x27')](_0x4fa67f);};}exports[_0x72c2('0x28')]=function(_0x589039,_0x2b87a1){var _0x94495={},_0x1e414a={},_0x45e80a={'count':0x0,'rows':[]};var _0x573898=_[_0x72c2('0x29')](db[_0x72c2('0x2a')][_0x72c2('0x2b')],function(_0x477be6){return{'name':_0x477be6[_0x72c2('0x2c')],'type':_0x477be6['type'][_0x72c2('0x2d')]};});_0x1e414a[_0x72c2('0x2e')]=_[_0x72c2('0x29')](_0x573898,_0x72c2('0x26'));_0x1e414a['query']=_[_0x72c2('0x2f')](_0x589039[_0x72c2('0x30')]);_0x1e414a[_0x72c2('0x31')]=_['intersection'](_0x1e414a[_0x72c2('0x2e')],_0x1e414a[_0x72c2('0x30')]);_0x94495[_0x72c2('0x32')]=_[_0x72c2('0x33')](_0x1e414a[_0x72c2('0x2e')],qs[_0x72c2('0x34')](_0x589039['query'][_0x72c2('0x34')]));_0x94495['attributes']=_0x94495['attributes'][_0x72c2('0x35')]?_0x94495['attributes']:_0x1e414a[_0x72c2('0x2e')];if(!_0x589039[_0x72c2('0x30')][_0x72c2('0x36')](_0x72c2('0x37'))){_0x94495[_0x72c2('0x38')]=qs[_0x72c2('0x38')](_0x589039['query'][_0x72c2('0x38')]);_0x94495[_0x72c2('0x1f')]=qs[_0x72c2('0x1f')](_0x589039[_0x72c2('0x30')][_0x72c2('0x1f')]);}_0x94495[_0x72c2('0x39')]=qs[_0x72c2('0x3a')](_0x589039[_0x72c2('0x30')][_0x72c2('0x3a')]);_0x94495[_0x72c2('0x3b')]=qs[_0x72c2('0x31')](_[_0x72c2('0x3c')](_0x589039[_0x72c2('0x30')],_0x1e414a['filters']),_0x573898);if(_0x589039['query'][_0x72c2('0x3d')]){_0x94495['where']=_[_0x72c2('0x3e')](_0x94495[_0x72c2('0x3b')],{'$or':_['map'](_0x573898,function(_0x1a2711){if(_0x1a2711[_0x72c2('0x3f')]!==_0x72c2('0x40')){var _0x5f5bd3={};_0x5f5bd3[_0x1a2711[_0x72c2('0x26')]]={'$like':'%'+_0x589039[_0x72c2('0x30')][_0x72c2('0x3d')]+'%'};return _0x5f5bd3;}})});}_0x94495=_[_0x72c2('0x3e')]({},_0x94495,_0x589039['options']);var _0x8fde71={'where':_0x94495['where']};return db['OpenchannelQueueReport'][_0x72c2('0x1e')](_0x8fde71)[_0x72c2('0x24')](function(_0x553cda){_0x45e80a[_0x72c2('0x1e')]=_0x553cda;if(_0x589039['query'][_0x72c2('0x41')]){_0x94495['include']=[{'all':!![]}];}return db[_0x72c2('0x2a')][_0x72c2('0x42')](_0x94495);})[_0x72c2('0x24')](function(_0x40e8d2){_0x45e80a[_0x72c2('0x43')]=_0x40e8d2;return _0x45e80a;})['then'](respondWithFilteredResult(_0x2b87a1,_0x94495))[_0x72c2('0x44')](handleError(_0x2b87a1,null));};exports['show']=function(_0x223891,_0x378de6){var _0xec7fb8={'raw':!![],'where':{'id':_0x223891['params']['id']}},_0x58cd94={};_0x58cd94['model']=_[_0x72c2('0x2f')](db['OpenchannelQueueReport']['rawAttributes']);_0x58cd94[_0x72c2('0x30')]=_[_0x72c2('0x2f')](_0x223891[_0x72c2('0x30')]);_0x58cd94[_0x72c2('0x31')]=_['intersection'](_0x58cd94['model'],_0x58cd94[_0x72c2('0x30')]);_0xec7fb8[_0x72c2('0x32')]=_['intersection'](_0x58cd94['model'],qs[_0x72c2('0x34')](_0x223891[_0x72c2('0x30')][_0x72c2('0x34')]));_0xec7fb8[_0x72c2('0x32')]=_0xec7fb8[_0x72c2('0x32')][_0x72c2('0x35')]?_0xec7fb8['attributes']:_0x58cd94[_0x72c2('0x2e')];if(_0x223891[_0x72c2('0x30')][_0x72c2('0x41')]){_0xec7fb8[_0x72c2('0x45')]=[{'all':!![]}];}_0xec7fb8=_[_0x72c2('0x3e')]({},_0xec7fb8,_0x223891[_0x72c2('0x46')]);return db[_0x72c2('0x2a')][_0x72c2('0x47')](_0xec7fb8)[_0x72c2('0x24')](handleEntityNotFound(_0x378de6,null))[_0x72c2('0x24')](respondWithResult(_0x378de6,null))[_0x72c2('0x44')](handleError(_0x378de6,null));};exports[_0x72c2('0x48')]=function(_0x2b28b8,_0x53ea6c){return db[_0x72c2('0x2a')][_0x72c2('0x48')](_0x2b28b8[_0x72c2('0x49')],{})[_0x72c2('0x24')](respondWithResult(_0x53ea6c,0xc9))[_0x72c2('0x44')](handleError(_0x53ea6c,null));};exports['update']=function(_0x405d74,_0x1ef966){if(_0x405d74[_0x72c2('0x49')]['id']){delete _0x405d74[_0x72c2('0x49')]['id'];}return db['OpenchannelQueueReport'][_0x72c2('0x47')]({'where':{'id':_0x405d74[_0x72c2('0x4a')]['id']}})[_0x72c2('0x24')](handleEntityNotFound(_0x1ef966,null))[_0x72c2('0x24')](saveUpdates(_0x405d74[_0x72c2('0x49')],null))['then'](respondWithResult(_0x1ef966,null))[_0x72c2('0x44')](handleError(_0x1ef966,null));};exports[_0x72c2('0x4b')]=function(_0x20ff56,_0x4b9d00){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x20ff56[_0x72c2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b9d00,null))[_0x72c2('0x24')](removeEntity(_0x4b9d00,null))[_0x72c2('0x44')](handleError(_0x4b9d00,null));};exports[_0x72c2('0x4c')]=function(_0x1c2146,_0x517200){return db['OpenchannelQueueReport'][_0x72c2('0x4c')]()[_0x72c2('0x24')](respondWithResult(_0x517200,null))[_0x72c2('0x44')](handleError(_0x517200,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 687542a..1f0d7f4 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 _0x1342=['./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1342,0x131));var _0x2134=function(_0x3ebd38,_0x459828){_0x3ebd38=_0x3ebd38-0x0;var _0x59d797=_0x1342[_0x3ebd38];return _0x59d797;};'use strict';var _=require(_0x2134('0x0'));var util=require(_0x2134('0x1'));var logger=require(_0x2134('0x2'))(_0x2134('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2134('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2134('0x5'));var config=require(_0x2134('0x6'));var attributes=require(_0x2134('0x7'));module[_0x2134('0x8')]=function(_0xc7200c,_0x2e84c6){return _0xc7200c[_0x2134('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x2134('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2134('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae2=['api','moment','bluebird','request-promise','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger'];(function(_0x40ff4d,_0x72c2dd){var _0xc6b831=function(_0x22cec6){while(--_0x22cec6){_0x40ff4d['push'](_0x40ff4d['shift']());}};_0xc6b831(++_0x72c2dd);}(_0x2ae2,0x73));var _0x22ae=function(_0x5a5ad8,_0x34911c){_0x5a5ad8=_0x5a5ad8-0x0;var _0x5512e5=_0x2ae2[_0x5a5ad8];return _0x5512e5;};'use strict';var _=require('lodash');var util=require(_0x22ae('0x0'));var logger=require(_0x22ae('0x1'))(_0x22ae('0x2'));var moment=require(_0x22ae('0x3'));var BPromise=require(_0x22ae('0x4'));var rp=require(_0x22ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x22ae('0x6'));var attributes=require(_0x22ae('0x7'));module[_0x22ae('0x8')]=function(_0x29a16a,_0x4e3854){return _0x29a16a[_0x22ae('0x9')](_0x22ae('0xa'),attributes,{'tableName':_0x22ae('0xb'),'paranoid':![],'indexes':[{'name':_0x22ae('0xc'),'fields':[_0x22ae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 2799da7..90b23db 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 _0x0424=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','attributes','limit','UpdateOpenchannelQueueReport','moment','bluebird','randomstring'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x0424,0x159));var _0x4042=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x0424[_0x318dda];return _0x3f97ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['create'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xb72021){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('CreateOpenchannelQueueReport',_0x466077,JSON[_0x4042('0xf')](_0xb72021));_0xe5c1ec(_0xb72021);})[_0x4042('0x14')](function(_0xd6fe6c){logger[_0x4042('0x10')](_0x4042('0x15'),_0xd6fe6c['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0xd6fe6c[_0x4042('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1daee8){var _0x5877d3=this;return new Promise(function(_0x271b82,_0x2c5fcf){return db[_0x4042('0x16')]['update'](_0x1daee8[_0x4042('0x17')],{'raw':_0x1daee8[_0x4042('0x18')]?_0x1daee8[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1daee8[_0x4042('0x18')]?_0x1daee8['options']['where']||null:null,'attributes':_0x1daee8[_0x4042('0x18')]?_0x1daee8[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'limit':_0x1daee8[_0x4042('0x18')]?_0x1daee8[_0x4042('0x18')][_0x4042('0x1b')]||null:null})['then'](function(_0x33733b){logger[_0x4042('0x12')]('UpdateOpenchannelQueueReport',_0x1daee8);logger[_0x4042('0xd')](_0x4042('0x1c'),_0x1daee8,JSON[_0x4042('0xf')](_0x33733b));_0x271b82(_0x33733b);})['catch'](function(_0x56d49a){logger[_0x4042('0x10')](_0x4042('0x1c'),_0x56d49a['message'],_0x1daee8);_0x2c5fcf(_0x5877d3[_0x4042('0x10')](0x1f4,_0x56d49a[_0x4042('0x11')]));});});}; \ No newline at end of file +var _0x33af=['raw','attributes','limit','UpdateOpenchannelQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options'];(function(_0x2c6cb6,_0x281fa6){var _0x4ef9b4=function(_0x5bde2f){while(--_0x5bde2f){_0x2c6cb6['push'](_0x2c6cb6['shift']());}};_0x4ef9b4(++_0x281fa6);}(_0x33af,0xec));var _0xf33a=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x33af[_0x58175c];return _0x55b88f;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});}exports[_0xf33a('0x15')]=function(_0x524109){var _0x2946ef=this;return new Promise(function(_0x23d9e2,_0x38d69a){return db[_0xf33a('0x16')]['create'](_0x524109[_0xf33a('0x17')],{'raw':_0x524109[_0xf33a('0x18')]?_0x524109[_0xf33a('0x18')][_0xf33a('0x19')]===undefined?!![]:![]:!![]})[_0xf33a('0xa')](function(_0x6cdf7b){logger[_0xf33a('0xb')](_0xf33a('0x15'),_0x524109);logger[_0xf33a('0xe')](_0xf33a('0x15'),_0x524109,JSON['stringify'](_0x6cdf7b));_0x23d9e2(_0x6cdf7b);})[_0xf33a('0x14')](function(_0x272e60){logger[_0xf33a('0x10')](_0xf33a('0x15'),_0x272e60[_0xf33a('0x12')],_0x524109);_0x38d69a(_0x2946ef['error'](0x1f4,_0x272e60[_0xf33a('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x492986){var _0x3f9ef7=this;return new Promise(function(_0x394468,_0x17b12d){return db[_0xf33a('0x16')]['update'](_0x492986[_0xf33a('0x17')],{'raw':_0x492986[_0xf33a('0x18')]?_0x492986['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x492986[_0xf33a('0x18')]?_0x492986['options']['where']||null:null,'attributes':_0x492986[_0xf33a('0x18')]?_0x492986['options'][_0xf33a('0x1a')]||null:null,'limit':_0x492986['options']?_0x492986[_0xf33a('0x18')][_0xf33a('0x1b')]||null:null})[_0xf33a('0xa')](function(_0x729fca){logger[_0xf33a('0xb')](_0xf33a('0x1c'),_0x492986);logger[_0xf33a('0xe')](_0xf33a('0x1c'),_0x492986,JSON[_0xf33a('0xf')](_0x729fca));_0x394468(_0x729fca);})[_0xf33a('0x14')](function(_0x77b7c1){logger[_0xf33a('0x10')](_0xf33a('0x1c'),_0x77b7c1[_0xf33a('0x12')],_0x492986);_0x17b12d(_0x3f9ef7[_0xf33a('0x10')](0x1f4,_0x77b7c1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 70d2ca0..afd0401 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(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 23e8d2c..c559827 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 _0x8357=['ENUM','queue','moment','exports'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x8357,0x6a));var _0x7835=function(_0x1632c2,_0x220490){_0x1632c2=_0x1632c2-0x0;var _0x6ee2d3=_0x8357[_0x1632c2];return _0x6ee2d3;};'use strict';var moment=require(_0x7835('0x0'));var Sequelize=require('sequelize');module[_0x7835('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7835('0x2')]('account','agent',_0x7835('0x3')),'allowNull':![],'defaultValue':_0x7835('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x8b9b=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x467a05,_0x23c7d3){var _0x149d54=function(_0x16e8ab){while(--_0x16e8ab){_0x467a05['push'](_0x467a05['shift']());}};_0x149d54(++_0x23c7d3);}(_0x8b9b,0x144));var _0xb8b9=function(_0x5cc3b6,_0x249e4f){_0x5cc3b6=_0x5cc3b6-0x0;var _0x3ea2e0=_0x8b9b[_0x5cc3b6];return _0x3ea2e0;};'use strict';var moment=require(_0xb8b9('0x0'));var Sequelize=require(_0xb8b9('0x1'));module[_0xb8b9('0x2')]={'uniqueid':{'type':Sequelize[_0xb8b9('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb8b9('0x4')](_0xb8b9('0x5'),_0xb8b9('0x6'),_0xb8b9('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb8b9('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xb8b9('0x9')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 72b91e9..0c1d8f3 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 _0x9345=['destroy','error','stack','name','index','map','OpenchannelTransferReport','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9345,0x6c));var _0x5934=function(_0x59166d,_0x415c2d){_0x59166d=_0x59166d-0x0;var _0x2184e1=_0x9345[_0x59166d];return _0x2184e1;};'use strict';var pdf=require(_0x5934('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5934('0x1'));var zipdir=require(_0x5934('0x2'));var jsonpatch=require(_0x5934('0x3'));var rp=require('request-promise');var moment=require(_0x5934('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5934('0x5'));var util=require(_0x5934('0x6'));var path=require('path');var sox=require(_0x5934('0x7'));var csv=require('to-csv');var ejs=require(_0x5934('0x8'));var fs=require('fs');var _=require(_0x5934('0x9'));var squel=require(_0x5934('0xa'));var crypto=require('crypto');var jsforce=require(_0x5934('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5934('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5934('0xd'));var as=require(_0x5934('0xe'));var hardwareService=require(_0x5934('0xf'));var logger=require('../../config/logger')(_0x5934('0x10'));var utils=require(_0x5934('0x11'));var config=require(_0x5934('0x12'));var db=require(_0x5934('0x13'))['db'];function respondWithStatusCode(_0x32b939,_0x410e3f){_0x410e3f=_0x410e3f||0xcc;return function(_0x55a4bf){if(_0x55a4bf){return _0x32b939[_0x5934('0x14')](_0x410e3f);}return _0x32b939[_0x5934('0x15')](_0x410e3f)[_0x5934('0x16')]();};}function respondWithResult(_0x5e5037,_0x2b9e84){_0x2b9e84=_0x2b9e84||0xc8;return function(_0x313d2d){if(_0x313d2d){return _0x5e5037[_0x5934('0x15')](_0x2b9e84)[_0x5934('0x17')](_0x313d2d);}};}function respondWithFilteredResult(_0x47c88f,_0x179b48){return function(_0x2d9eb2){if(_0x2d9eb2){var _0x592054=_0x2d9eb2[_0x5934('0x18')],_0x1e59d9=_0x179b48['offset'],_0x20a2c3=_0x179b48[_0x5934('0x19')]+_0x179b48[_0x5934('0x1a')],_0x58652e;if(_0x20a2c3>=_0x592054){_0x20a2c3=_0x592054;_0x58652e=0xc8;}else{_0x58652e=0xce;}_0x47c88f[_0x5934('0x15')](_0x58652e);return _0x47c88f[_0x5934('0x1b')](_0x5934('0x1c'),_0x1e59d9+'-'+_0x20a2c3+'/'+_0x592054)['json'](_0x2d9eb2);}return null;};}function patchUpdates(_0x485eeb){return function(_0x2be7a7){try{jsonpatch[_0x5934('0x1d')](_0x2be7a7,_0x485eeb,!![]);}catch(_0x2aa9f1){return BPromise[_0x5934('0x1e')](_0x2aa9f1);}return _0x2be7a7[_0x5934('0x1f')]();};}function saveUpdates(_0x59d5b2,_0x506ebc){return function(_0x154ad3){if(_0x154ad3){return _0x154ad3[_0x5934('0x20')](_0x59d5b2)[_0x5934('0x21')](function(_0x3b7706){return _0x3b7706;});}return null;};}function removeEntity(_0x30050e,_0x27f30f){return function(_0x21ef3e){if(_0x21ef3e){return _0x21ef3e[_0x5934('0x22')]()[_0x5934('0x21')](function(){_0x30050e[_0x5934('0x15')](0xcc)[_0x5934('0x16')]();});}};}function handleEntityNotFound(_0x332d51,_0xce46e3){return function(_0x435812){if(!_0x435812){_0x332d51[_0x5934('0x14')](0x194);}return _0x435812;};}function handleError(_0x3362c5,_0x566364){_0x566364=_0x566364||0x1f4;return function(_0x2eb616){logger[_0x5934('0x23')](_0x2eb616[_0x5934('0x24')]);if(_0x2eb616[_0x5934('0x25')]){delete _0x2eb616['name'];}_0x3362c5[_0x5934('0x15')](_0x566364)['send'](_0x2eb616);};}exports[_0x5934('0x26')]=function(_0x21ea4e,_0x5a5b7d){var _0x10feb0={},_0x3f218c={},_0x44f5bf={'count':0x0,'rows':[]};var _0x1a259d=_[_0x5934('0x27')](db[_0x5934('0x28')]['rawAttributes'],function(_0x2a8a43){return{'name':_0x2a8a43[_0x5934('0x29')],'type':_0x2a8a43[_0x5934('0x2a')][_0x5934('0x2b')]};});_0x3f218c['model']=_['map'](_0x1a259d,_0x5934('0x25'));_0x3f218c['query']=_[_0x5934('0x2c')](_0x21ea4e['query']);_0x3f218c[_0x5934('0x2d')]=_[_0x5934('0x2e')](_0x3f218c[_0x5934('0x2f')],_0x3f218c[_0x5934('0x30')]);_0x10feb0[_0x5934('0x31')]=_['intersection'](_0x3f218c[_0x5934('0x2f')],qs['fields'](_0x21ea4e['query'][_0x5934('0x32')]));_0x10feb0[_0x5934('0x31')]=_0x10feb0['attributes']['length']?_0x10feb0[_0x5934('0x31')]:_0x3f218c[_0x5934('0x2f')];if(!_0x21ea4e[_0x5934('0x30')]['hasOwnProperty'](_0x5934('0x33'))){_0x10feb0[_0x5934('0x1a')]=qs['limit'](_0x21ea4e[_0x5934('0x30')]['limit']);_0x10feb0['offset']=qs['offset'](_0x21ea4e[_0x5934('0x30')][_0x5934('0x19')]);}_0x10feb0[_0x5934('0x34')]=qs[_0x5934('0x35')](_0x21ea4e[_0x5934('0x30')][_0x5934('0x35')]);_0x10feb0[_0x5934('0x36')]=qs[_0x5934('0x2d')](_[_0x5934('0x37')](_0x21ea4e[_0x5934('0x30')],_0x3f218c[_0x5934('0x2d')]),_0x1a259d);if(_0x21ea4e['query']['filter']){_0x10feb0[_0x5934('0x36')]=_['merge'](_0x10feb0[_0x5934('0x36')],{'$or':_['map'](_0x1a259d,function(_0x162dc2){if(_0x162dc2['type']!==_0x5934('0x38')){var _0x3258fe={};_0x3258fe[_0x162dc2[_0x5934('0x25')]]={'$like':'%'+_0x21ea4e[_0x5934('0x30')]['filter']+'%'};return _0x3258fe;}})});}_0x10feb0=_[_0x5934('0x39')]({},_0x10feb0,_0x21ea4e[_0x5934('0x3a')]);var _0x272cfb={'where':_0x10feb0[_0x5934('0x36')]};return db['OpenchannelTransferReport']['count'](_0x272cfb)[_0x5934('0x21')](function(_0x6bd94f){_0x44f5bf[_0x5934('0x18')]=_0x6bd94f;if(_0x21ea4e[_0x5934('0x30')]['includeAll']){_0x10feb0[_0x5934('0x3b')]=[{'all':!![]}];}return db[_0x5934('0x28')][_0x5934('0x3c')](_0x10feb0);})[_0x5934('0x21')](function(_0x3b26db){_0x44f5bf[_0x5934('0x3d')]=_0x3b26db;return _0x44f5bf;})[_0x5934('0x21')](respondWithFilteredResult(_0x5a5b7d,_0x10feb0))[_0x5934('0x3e')](handleError(_0x5a5b7d,null));};exports[_0x5934('0x3f')]=function(_0x5c4bbb,_0x4effb0){var _0x1c42ae={'raw':!![],'where':{'id':_0x5c4bbb[_0x5934('0x40')]['id']}},_0x23b10b={};_0x23b10b['model']=_[_0x5934('0x2c')](db[_0x5934('0x28')][_0x5934('0x41')]);_0x23b10b[_0x5934('0x30')]=_[_0x5934('0x2c')](_0x5c4bbb[_0x5934('0x30')]);_0x23b10b[_0x5934('0x2d')]=_['intersection'](_0x23b10b[_0x5934('0x2f')],_0x23b10b[_0x5934('0x30')]);_0x1c42ae['attributes']=_[_0x5934('0x2e')](_0x23b10b[_0x5934('0x2f')],qs['fields'](_0x5c4bbb['query']['fields']));_0x1c42ae[_0x5934('0x31')]=_0x1c42ae['attributes'][_0x5934('0x42')]?_0x1c42ae['attributes']:_0x23b10b[_0x5934('0x2f')];if(_0x5c4bbb[_0x5934('0x30')]['includeAll']){_0x1c42ae[_0x5934('0x3b')]=[{'all':!![]}];}_0x1c42ae=_[_0x5934('0x39')]({},_0x1c42ae,_0x5c4bbb[_0x5934('0x3a')]);return db[_0x5934('0x28')]['find'](_0x1c42ae)[_0x5934('0x21')](handleEntityNotFound(_0x4effb0,null))['then'](respondWithResult(_0x4effb0,null))[_0x5934('0x3e')](handleError(_0x4effb0,null));};exports[_0x5934('0x43')]=function(_0x48272b,_0x538674){return db[_0x5934('0x28')][_0x5934('0x43')](_0x48272b[_0x5934('0x44')],{})[_0x5934('0x21')](respondWithResult(_0x538674,0xc9))[_0x5934('0x3e')](handleError(_0x538674,null));};exports[_0x5934('0x20')]=function(_0x1a7b21,_0x16d35a){if(_0x1a7b21[_0x5934('0x44')]['id']){delete _0x1a7b21[_0x5934('0x44')]['id'];}return db['OpenchannelTransferReport'][_0x5934('0x45')]({'where':{'id':_0x1a7b21[_0x5934('0x40')]['id']}})[_0x5934('0x21')](handleEntityNotFound(_0x16d35a,null))[_0x5934('0x21')](saveUpdates(_0x1a7b21[_0x5934('0x44')],null))[_0x5934('0x21')](respondWithResult(_0x16d35a,null))[_0x5934('0x3e')](handleError(_0x16d35a,null));};exports[_0x5934('0x22')]=function(_0x3d8091,_0x4773fc){return db[_0x5934('0x28')][_0x5934('0x45')]({'where':{'id':_0x3d8091[_0x5934('0x40')]['id']}})[_0x5934('0x21')](handleEntityNotFound(_0x4773fc,null))['then'](removeEntity(_0x4773fc,null))[_0x5934('0x3e')](handleError(_0x4773fc,null));};exports[_0x5934('0x46')]=function(_0x151a93,_0x2f5c6d){return db[_0x5934('0x28')][_0x5934('0x46')]()['then'](respondWithResult(_0x2f5c6d,null))[_0x5934('0x3e')](handleError(_0x2f5c6d,null));}; \ No newline at end of file +var _0xcfe5=['describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','then','error','name','send','map','OpenchannelTransferReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','rows','show','params','include','options','find','catch','create','body'];(function(_0x5dfb47,_0x25bef7){var _0x2d42a6=function(_0x47cc28){while(--_0x47cc28){_0x5dfb47['push'](_0x5dfb47['shift']());}};_0x2d42a6(++_0x25bef7);}(_0xcfe5,0x1f2));var _0x5cfe=function(_0x14bd60,_0x73b2f9){_0x14bd60=_0x14bd60-0x0;var _0x4b0a31=_0xcfe5[_0x14bd60];return _0x4b0a31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cfe('0x0'));var rimraf=require(_0x5cfe('0x1'));var zipdir=require(_0x5cfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cfe('0x3'));var moment=require('moment');var BPromise=require(_0x5cfe('0x4'));var Mustache=require('mustache');var util=require(_0x5cfe('0x5'));var path=require(_0x5cfe('0x6'));var sox=require(_0x5cfe('0x7'));var csv=require(_0x5cfe('0x8'));var ejs=require(_0x5cfe('0x9'));var fs=require('fs');var _=require(_0x5cfe('0xa'));var squel=require(_0x5cfe('0xb'));var crypto=require(_0x5cfe('0xc'));var jsforce=require(_0x5cfe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5cfe('0x8'));var querystring=require(_0x5cfe('0xe'));var Papa=require(_0x5cfe('0xf'));var Redis=require(_0x5cfe('0x10'));var authService=require(_0x5cfe('0x11'));var qs=require(_0x5cfe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5cfe('0x13'));var logger=require(_0x5cfe('0x14'))(_0x5cfe('0x15'));var utils=require(_0x5cfe('0x16'));var config=require(_0x5cfe('0x17'));var db=require(_0x5cfe('0x18'))['db'];function respondWithStatusCode(_0x56d960,_0xebef56){_0xebef56=_0xebef56||0xcc;return function(_0x5c8b1e){if(_0x5c8b1e){return _0x56d960[_0x5cfe('0x19')](_0xebef56);}return _0x56d960[_0x5cfe('0x1a')](_0xebef56)[_0x5cfe('0x1b')]();};}function respondWithResult(_0x209342,_0x42431a){_0x42431a=_0x42431a||0xc8;return function(_0x329f52){if(_0x329f52){return _0x209342[_0x5cfe('0x1a')](_0x42431a)[_0x5cfe('0x1c')](_0x329f52);}};}function respondWithFilteredResult(_0x47f52e,_0x5db3da){return function(_0x2a19af){if(_0x2a19af){var _0x424b98=_0x2a19af[_0x5cfe('0x1d')],_0x279636=_0x5db3da[_0x5cfe('0x1e')],_0x5c615d=_0x5db3da[_0x5cfe('0x1e')]+_0x5db3da[_0x5cfe('0x1f')],_0x415716;if(_0x5c615d>=_0x424b98){_0x5c615d=_0x424b98;_0x415716=0xc8;}else{_0x415716=0xce;}_0x47f52e['status'](_0x415716);return _0x47f52e[_0x5cfe('0x20')](_0x5cfe('0x21'),_0x279636+'-'+_0x5c615d+'/'+_0x424b98)[_0x5cfe('0x1c')](_0x2a19af);}return null;};}function patchUpdates(_0x268f68){return function(_0x5840de){try{jsonpatch['apply'](_0x5840de,_0x268f68,!![]);}catch(_0x13a095){return BPromise['reject'](_0x13a095);}return _0x5840de['save']();};}function saveUpdates(_0xee2bbd,_0x51b3b4){return function(_0x7a51ba){if(_0x7a51ba){return _0x7a51ba[_0x5cfe('0x22')](_0xee2bbd)['then'](function(_0x130f7e){return _0x130f7e;});}return null;};}function removeEntity(_0x33f75b,_0x3a38c3){return function(_0x4bb23a){if(_0x4bb23a){return _0x4bb23a[_0x5cfe('0x23')]()[_0x5cfe('0x24')](function(){_0x33f75b['status'](0xcc)[_0x5cfe('0x1b')]();});}};}function handleEntityNotFound(_0x2e9982,_0x2ef75f){return function(_0x292d94){if(!_0x292d94){_0x2e9982[_0x5cfe('0x19')](0x194);}return _0x292d94;};}function handleError(_0xaa258b,_0xaf5735){_0xaf5735=_0xaf5735||0x1f4;return function(_0x1f5189){logger[_0x5cfe('0x25')](_0x1f5189['stack']);if(_0x1f5189[_0x5cfe('0x26')]){delete _0x1f5189[_0x5cfe('0x26')];}_0xaa258b['status'](_0xaf5735)[_0x5cfe('0x27')](_0x1f5189);};}exports['index']=function(_0x43d65b,_0x524f0f){var _0x4940f4={},_0x161f9b={},_0x32a5b7={'count':0x0,'rows':[]};var _0x3cc406=_[_0x5cfe('0x28')](db[_0x5cfe('0x29')][_0x5cfe('0x2a')],function(_0x575313){return{'name':_0x575313['fieldName'],'type':_0x575313[_0x5cfe('0x2b')]['key']};});_0x161f9b[_0x5cfe('0x2c')]=_[_0x5cfe('0x28')](_0x3cc406,_0x5cfe('0x26'));_0x161f9b['query']=_[_0x5cfe('0x2d')](_0x43d65b[_0x5cfe('0x2e')]);_0x161f9b[_0x5cfe('0x2f')]=_[_0x5cfe('0x30')](_0x161f9b['model'],_0x161f9b[_0x5cfe('0x2e')]);_0x4940f4[_0x5cfe('0x31')]=_['intersection'](_0x161f9b[_0x5cfe('0x2c')],qs[_0x5cfe('0x32')](_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x32')]));_0x4940f4[_0x5cfe('0x31')]=_0x4940f4['attributes'][_0x5cfe('0x33')]?_0x4940f4['attributes']:_0x161f9b[_0x5cfe('0x2c')];if(!_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x34')](_0x5cfe('0x35'))){_0x4940f4['limit']=qs[_0x5cfe('0x1f')](_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x1f')]);_0x4940f4[_0x5cfe('0x1e')]=qs[_0x5cfe('0x1e')](_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x1e')]);}_0x4940f4[_0x5cfe('0x36')]=qs[_0x5cfe('0x37')](_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x37')]);_0x4940f4['where']=qs[_0x5cfe('0x2f')](_['pick'](_0x43d65b[_0x5cfe('0x2e')],_0x161f9b[_0x5cfe('0x2f')]),_0x3cc406);if(_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x38')]){_0x4940f4['where']=_[_0x5cfe('0x39')](_0x4940f4[_0x5cfe('0x3a')],{'$or':_[_0x5cfe('0x28')](_0x3cc406,function(_0x54c580){if(_0x54c580[_0x5cfe('0x2b')]!==_0x5cfe('0x3b')){var _0x378cbb={};_0x378cbb[_0x54c580[_0x5cfe('0x26')]]={'$like':'%'+_0x43d65b['query'][_0x5cfe('0x38')]+'%'};return _0x378cbb;}})});}_0x4940f4=_['merge']({},_0x4940f4,_0x43d65b['options']);var _0x5ac0ed={'where':_0x4940f4[_0x5cfe('0x3a')]};return db[_0x5cfe('0x29')]['count'](_0x5ac0ed)[_0x5cfe('0x24')](function(_0x5dae23){_0x32a5b7[_0x5cfe('0x1d')]=_0x5dae23;if(_0x43d65b[_0x5cfe('0x2e')][_0x5cfe('0x3c')]){_0x4940f4['include']=[{'all':!![]}];}return db[_0x5cfe('0x29')]['findAll'](_0x4940f4);})[_0x5cfe('0x24')](function(_0x1019bf){_0x32a5b7[_0x5cfe('0x3d')]=_0x1019bf;return _0x32a5b7;})[_0x5cfe('0x24')](respondWithFilteredResult(_0x524f0f,_0x4940f4))['catch'](handleError(_0x524f0f,null));};exports[_0x5cfe('0x3e')]=function(_0x465107,_0x5aa7d4){var _0x4adc7b={'raw':!![],'where':{'id':_0x465107[_0x5cfe('0x3f')]['id']}},_0x11646b={};_0x11646b[_0x5cfe('0x2c')]=_[_0x5cfe('0x2d')](db[_0x5cfe('0x29')][_0x5cfe('0x2a')]);_0x11646b[_0x5cfe('0x2e')]=_['keys'](_0x465107[_0x5cfe('0x2e')]);_0x11646b[_0x5cfe('0x2f')]=_[_0x5cfe('0x30')](_0x11646b[_0x5cfe('0x2c')],_0x11646b[_0x5cfe('0x2e')]);_0x4adc7b['attributes']=_[_0x5cfe('0x30')](_0x11646b[_0x5cfe('0x2c')],qs[_0x5cfe('0x32')](_0x465107[_0x5cfe('0x2e')][_0x5cfe('0x32')]));_0x4adc7b[_0x5cfe('0x31')]=_0x4adc7b[_0x5cfe('0x31')][_0x5cfe('0x33')]?_0x4adc7b[_0x5cfe('0x31')]:_0x11646b[_0x5cfe('0x2c')];if(_0x465107[_0x5cfe('0x2e')][_0x5cfe('0x3c')]){_0x4adc7b[_0x5cfe('0x40')]=[{'all':!![]}];}_0x4adc7b=_['merge']({},_0x4adc7b,_0x465107[_0x5cfe('0x41')]);return db[_0x5cfe('0x29')][_0x5cfe('0x42')](_0x4adc7b)['then'](handleEntityNotFound(_0x5aa7d4,null))['then'](respondWithResult(_0x5aa7d4,null))[_0x5cfe('0x43')](handleError(_0x5aa7d4,null));};exports[_0x5cfe('0x44')]=function(_0x2c0c46,_0x13999c){return db['OpenchannelTransferReport'][_0x5cfe('0x44')](_0x2c0c46[_0x5cfe('0x45')],{})[_0x5cfe('0x24')](respondWithResult(_0x13999c,0xc9))['catch'](handleError(_0x13999c,null));};exports[_0x5cfe('0x22')]=function(_0x3ca258,_0x181061){if(_0x3ca258['body']['id']){delete _0x3ca258[_0x5cfe('0x45')]['id'];}return db[_0x5cfe('0x29')][_0x5cfe('0x42')]({'where':{'id':_0x3ca258[_0x5cfe('0x3f')]['id']}})[_0x5cfe('0x24')](handleEntityNotFound(_0x181061,null))[_0x5cfe('0x24')](saveUpdates(_0x3ca258[_0x5cfe('0x45')],null))[_0x5cfe('0x24')](respondWithResult(_0x181061,null))[_0x5cfe('0x43')](handleError(_0x181061,null));};exports[_0x5cfe('0x23')]=function(_0x266c38,_0x485860){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x266c38[_0x5cfe('0x3f')]['id']}})[_0x5cfe('0x24')](handleEntityNotFound(_0x485860,null))[_0x5cfe('0x24')](removeEntity(_0x485860,null))[_0x5cfe('0x43')](handleError(_0x485860,null));};exports[_0x5cfe('0x46')]=function(_0x54e8a4,_0x393dc8){return db[_0x5cfe('0x29')][_0x5cfe('0x46')]()[_0x5cfe('0x24')](respondWithResult(_0x393dc8,null))[_0x5cfe('0x43')](handleError(_0x393dc8,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8b2d170..08a4822 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 _0xfc9b=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x5aa1bd,_0x5597cc){var _0x39660d=function(_0x5a083b){while(--_0x5a083b){_0x5aa1bd['push'](_0x5aa1bd['shift']());}};_0x39660d(++_0x5597cc);}(_0xfc9b,0x74));var _0xbfc9=function(_0x3778c2,_0x1f13ba){_0x3778c2=_0x3778c2-0x0;var _0xe3717a=_0xfc9b[_0x3778c2];return _0xe3717a;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var logger=require(_0xbfc9('0x2'))(_0xbfc9('0x3'));var moment=require(_0xbfc9('0x4'));var BPromise=require(_0xbfc9('0x5'));var rp=require(_0xbfc9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfc9('0x7'));var config=require('../../config/environment');var attributes=require(_0xbfc9('0x8'));module[_0xbfc9('0x9')]=function(_0x523ff1,_0x1dbece){return _0x523ff1[_0xbfc9('0xa')](_0xbfc9('0xb'),attributes,{'tableName':_0xbfc9('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbfc9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdcd=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xdfdc('0x0'));var logger=require(_0xdfdc('0x1'))(_0xdfdc('0x2'));var moment=require('moment');var BPromise=require(_0xdfdc('0x3'));var rp=require(_0xdfdc('0x4'));var fs=require('fs');var path=require(_0xdfdc('0x5'));var rimraf=require(_0xdfdc('0x6'));var config=require(_0xdfdc('0x7'));var attributes=require(_0xdfdc('0x8'));module[_0xdfdc('0x9')]=function(_0x31b119,_0x1984bf){return _0x31b119[_0xdfdc('0xa')](_0xdfdc('0xb'),attributes,{'tableName':_0xdfdc('0xc'),'paranoid':![],'indexes':[{'name':_0xdfdc('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a14b50d..9211304 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 _0x7c24=['client','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3b1a38,_0x5ccd3f){var _0x2c1330=function(_0x51fd55){while(--_0x51fd55){_0x3b1a38['push'](_0x3b1a38['shift']());}};_0x2c1330(++_0x5ccd3f);}(_0x7c24,0x186));var _0x47c2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7c24[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var moment=require(_0x47c2('0x2'));var BPromise=require(_0x47c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47c2('0x4'));var db=require(_0x47c2('0x5'))['db'];var utils=require(_0x47c2('0x6'));var logger=require(_0x47c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x47c2('0x8'));var client=jayson[_0x47c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x280b64,_0x2d477f,_0x2a2189){return new BPromise(function(_0x186644,_0x241961){return client['request'](_0x280b64,_0x2a2189)[_0x47c2('0xa')](function(_0x11172a){logger['info'](_0x47c2('0xb'),_0x2d477f,'request\x20sent');logger[_0x47c2('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2d477f,_0x47c2('0xd'),JSON[_0x47c2('0xe')](_0x11172a));if(_0x11172a[_0x47c2('0xf')]){if(_0x11172a[_0x47c2('0xf')][_0x47c2('0x10')]===0x1f4){logger[_0x47c2('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d477f,_0x11172a[_0x47c2('0xf')][_0x47c2('0x11')]);return _0x241961(_0x11172a['error']['message']);}logger[_0x47c2('0xf')](_0x47c2('0xb'),_0x2d477f,_0x11172a[_0x47c2('0xf')]['message']);return _0x186644(_0x11172a['error']['message']);}else{logger[_0x47c2('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d477f,_0x47c2('0xd'));_0x186644(_0x11172a[_0x47c2('0x13')][_0x47c2('0x11')]);}})[_0x47c2('0x14')](function(_0x4a3866){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d477f,_0x4a3866);_0x241961(_0x4a3866);});});} \ No newline at end of file +var _0x27e3=['error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3c769d,_0x215272){var _0x1c19e2=function(_0x3ddc0d){while(--_0x3ddc0d){_0x3c769d['push'](_0x3c769d['shift']());}};_0x1c19e2(++_0x215272);}(_0x27e3,0x15d));var _0x327e=function(_0x5104bc,_0x257a07){_0x5104bc=_0x5104bc-0x0;var _0xf32f36=_0x27e3[_0x5104bc];return _0xf32f36;};'use strict';var _=require('lodash');var util=require(_0x327e('0x0'));var moment=require(_0x327e('0x1'));var BPromise=require(_0x327e('0x2'));var rs=require(_0x327e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x327e('0x4'))['db'];var utils=require(_0x327e('0x5'));var logger=require(_0x327e('0x6'))(_0x327e('0x7'));var config=require(_0x327e('0x8'));var jayson=require(_0x327e('0x9'));var client=jayson[_0x327e('0xa')][_0x327e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d72d2,_0x3b56e9,_0x47b4a4){return new BPromise(function(_0x561ba9,_0x5e8aa3){return client[_0x327e('0xc')](_0x2d72d2,_0x47b4a4)[_0x327e('0xd')](function(_0x4cfd1d){logger[_0x327e('0xe')](_0x327e('0xf'),_0x3b56e9,_0x327e('0x10'));logger[_0x327e('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x3b56e9,_0x327e('0x10'),JSON[_0x327e('0x12')](_0x4cfd1d));if(_0x4cfd1d[_0x327e('0x13')]){if(_0x4cfd1d[_0x327e('0x13')][_0x327e('0x14')]===0x1f4){logger[_0x327e('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b56e9,_0x4cfd1d[_0x327e('0x13')][_0x327e('0x15')]);return _0x5e8aa3(_0x4cfd1d[_0x327e('0x13')][_0x327e('0x15')]);}logger[_0x327e('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b56e9,_0x4cfd1d[_0x327e('0x13')]['message']);return _0x561ba9(_0x4cfd1d[_0x327e('0x13')][_0x327e('0x15')]);}else{logger[_0x327e('0xe')](_0x327e('0xf'),_0x3b56e9,_0x327e('0x10'));_0x561ba9(_0x4cfd1d[_0x327e('0x16')][_0x327e('0x15')]);}})['catch'](function(_0x567423){logger['error'](_0x327e('0xf'),_0x3b56e9,_0x567423);_0x5e8aa3(_0x567423);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 02a25fe..014c17f 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 _0x860a=['./pause.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a0b56,_0x220ebf){var _0x7274eb=function(_0x1fa51a){while(--_0x1fa51a){_0x2a0b56['push'](_0x2a0b56['shift']());}};_0x7274eb(++_0x220ebf);}(_0x860a,0x19b));var _0xa860=function(_0x3cb36d,_0x1ddc72){_0x3cb36d=_0x3cb36d-0x0;var _0x15ba7b=_0x860a[_0x3cb36d];return _0x15ba7b;};'use strict';var multer=require(_0xa860('0x0'));var util=require(_0xa860('0x1'));var path=require(_0xa860('0x2'));var timeout=require(_0xa860('0x3'));var express=require(_0xa860('0x4'));var router=express[_0xa860('0x5')]();var auth=require(_0xa860('0x6'));var interaction=require(_0xa860('0x7'));var config=require(_0xa860('0x8'));var controller=require(_0xa860('0x9'));router['get']('/',auth[_0xa860('0xa')](),controller[_0xa860('0xb')]);router[_0xa860('0xc')](_0xa860('0xd'),auth['isAuthenticated'](),controller[_0xa860('0xe')]);router[_0xa860('0xf')]('/',auth[_0xa860('0xa')](),controller[_0xa860('0x10')]);router[_0xa860('0x11')](_0xa860('0xd'),auth[_0xa860('0xa')](),controller[_0xa860('0x12')]);router['delete'](_0xa860('0xd'),auth[_0xa860('0xa')](),controller[_0xa860('0x13')]);module[_0xa860('0x14')]=router; \ No newline at end of file +var _0xe475=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x348e4b,_0x1785d0){var _0x1b6669=function(_0x484c2e){while(--_0x484c2e){_0x348e4b['push'](_0x348e4b['shift']());}};_0x1b6669(++_0x1785d0);}(_0xe475,0x117));var _0x5e47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe475[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5e47('0x0'));var path=require(_0x5e47('0x1'));var timeout=require(_0x5e47('0x2'));var express=require('express');var router=express[_0x5e47('0x3')]();var auth=require(_0x5e47('0x4'));var interaction=require(_0x5e47('0x5'));var config=require(_0x5e47('0x6'));var controller=require(_0x5e47('0x7'));router[_0x5e47('0x8')]('/',auth[_0x5e47('0x9')](),controller[_0x5e47('0xa')]);router[_0x5e47('0x8')](_0x5e47('0xb'),auth[_0x5e47('0x9')](),controller[_0x5e47('0xc')]);router[_0x5e47('0xd')]('/',auth[_0x5e47('0x9')](),controller[_0x5e47('0xe')]);router[_0x5e47('0xf')]('/:id',auth[_0x5e47('0x9')](),controller[_0x5e47('0x10')]);router[_0x5e47('0x11')](_0x5e47('0xb'),auth['isAuthenticated'](),controller[_0x5e47('0x12')]);module[_0x5e47('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0909c5a..ca080d8 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 _0x9d12=['name','STRING','exports'];(function(_0xcb99ad,_0x9fc335){var _0x3b9913=function(_0x962573){while(--_0x962573){_0xcb99ad['push'](_0xcb99ad['shift']());}};_0x3b9913(++_0x9fc335);}(_0x9d12,0xbc));var _0x29d1=function(_0x58b4cc,_0x22a59d){_0x58b4cc=_0x58b4cc-0x0;var _0x3f355b=_0x9d12[_0x58b4cc];return _0x3f355b;};'use strict';var Sequelize=require('sequelize');module[_0x29d1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x29d1('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x29d1('0x2')]}}; \ No newline at end of file +var _0x0262=['exports','STRING','name','sequelize'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x0262,0x19b));var _0x2026=function(_0x29fb28,_0x5177d5){_0x29fb28=_0x29fb28-0x0;var _0x1d488f=_0x0262[_0x29fb28];return _0x1d488f;};'use strict';var Sequelize=require(_0x2026('0x0'));module[_0x2026('0x1')]={'name':{'type':Sequelize[_0x2026('0x2')],'unique':_0x2026('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2026('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c22c2ca..2eb73c3 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 _0xf413=['include','findAll','rows','catch','show','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll'];(function(_0x423a9a,_0x2ec223){var _0x564475=function(_0x33b25a){while(--_0x33b25a){_0x423a9a['push'](_0x423a9a['shift']());}};_0x564475(++_0x2ec223);}(_0xf413,0x1b1));var _0x3f41=function(_0x590151,_0x5ed644){_0x590151=_0x590151-0x0;var _0x25abb8=_0xf413[_0x590151];return _0x25abb8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f41('0x0'));var rimraf=require(_0x3f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f41('0x2'));var rp=require(_0x3f41('0x3'));var moment=require('moment');var BPromise=require(_0x3f41('0x4'));var Mustache=require(_0x3f41('0x5'));var util=require(_0x3f41('0x6'));var path=require(_0x3f41('0x7'));var sox=require(_0x3f41('0x8'));var csv=require(_0x3f41('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f41('0xa'));var squel=require(_0x3f41('0xb'));var crypto=require(_0x3f41('0xc'));var jsforce=require(_0x3f41('0xd'));var deskjs=require(_0x3f41('0xe'));var toCsv=require(_0x3f41('0x9'));var querystring=require(_0x3f41('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f41('0x10'));var authService=require(_0x3f41('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3f41('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f41('0x13'))('api');var utils=require(_0x3f41('0x14'));var config=require(_0x3f41('0x15'));var db=require(_0x3f41('0x16'))['db'];function respondWithStatusCode(_0x5a9a31,_0x19ee3a){_0x19ee3a=_0x19ee3a||0xcc;return function(_0x1dfb6f){if(_0x1dfb6f){return _0x5a9a31[_0x3f41('0x17')](_0x19ee3a);}return _0x5a9a31[_0x3f41('0x18')](_0x19ee3a)[_0x3f41('0x19')]();};}function respondWithResult(_0x595a8c,_0x2595ab){_0x2595ab=_0x2595ab||0xc8;return function(_0x390ce5){if(_0x390ce5){return _0x595a8c['status'](_0x2595ab)[_0x3f41('0x1a')](_0x390ce5);}};}function respondWithFilteredResult(_0x5580bc,_0x22fd67){return function(_0x4f65df){if(_0x4f65df){var _0x236c3f=_0x4f65df['count'],_0x2fd86e=_0x22fd67[_0x3f41('0x1b')],_0x3b6254=_0x22fd67[_0x3f41('0x1b')]+_0x22fd67[_0x3f41('0x1c')],_0x48ffc0;if(_0x3b6254>=_0x236c3f){_0x3b6254=_0x236c3f;_0x48ffc0=0xc8;}else{_0x48ffc0=0xce;}_0x5580bc['status'](_0x48ffc0);return _0x5580bc[_0x3f41('0x1d')](_0x3f41('0x1e'),_0x2fd86e+'-'+_0x3b6254+'/'+_0x236c3f)['json'](_0x4f65df);}return null;};}function patchUpdates(_0x598209){return function(_0x4947dc){try{jsonpatch[_0x3f41('0x1f')](_0x4947dc,_0x598209,!![]);}catch(_0x3a5337){return BPromise[_0x3f41('0x20')](_0x3a5337);}return _0x4947dc[_0x3f41('0x21')]();};}function saveUpdates(_0x563f97,_0x1056c3){return function(_0x324757){if(_0x324757){return _0x324757['update'](_0x563f97)[_0x3f41('0x22')](function(_0xa47f85){return _0xa47f85;});}return null;};}function removeEntity(_0x22f792,_0x19d0da){return function(_0x153459){if(_0x153459){return _0x153459[_0x3f41('0x23')]()[_0x3f41('0x22')](function(){var _0x3573d2=_0x153459[_0x3f41('0x24')]({'plain':!![]});var _0x257318=_0x3f41('0x25');return db[_0x3f41('0x26')]['destroy']({'where':{'type':_0x257318,'resourceId':_0x3573d2['id']}})['then'](function(){return _0x153459;});})[_0x3f41('0x22')](function(){_0x22f792[_0x3f41('0x18')](0xcc)[_0x3f41('0x19')]();});}};}function handleEntityNotFound(_0x25a4d1,_0x3edaed){return function(_0x1227cf){if(!_0x1227cf){_0x25a4d1[_0x3f41('0x17')](0x194);}return _0x1227cf;};}function handleError(_0x5e32c7,_0x44626a){_0x44626a=_0x44626a||0x1f4;return function(_0x2537e4){logger[_0x3f41('0x27')](_0x2537e4[_0x3f41('0x28')]);if(_0x2537e4['name']){delete _0x2537e4[_0x3f41('0x29')];}_0x5e32c7[_0x3f41('0x18')](_0x44626a)[_0x3f41('0x2a')](_0x2537e4);};}exports[_0x3f41('0x2b')]=function(_0xda0ee6,_0x3ea7b5){var _0x5627f8={},_0x1b2417={},_0x105a0f={'count':0x0,'rows':[]};var _0x3df8eb=_[_0x3f41('0x2c')](db[_0x3f41('0x2d')][_0x3f41('0x2e')],function(_0x19e075){return{'name':_0x19e075['fieldName'],'type':_0x19e075[_0x3f41('0x2f')][_0x3f41('0x30')]};});_0x1b2417['model']=_[_0x3f41('0x2c')](_0x3df8eb,_0x3f41('0x29'));_0x1b2417['query']=_[_0x3f41('0x31')](_0xda0ee6[_0x3f41('0x32')]);_0x1b2417[_0x3f41('0x33')]=_[_0x3f41('0x34')](_0x1b2417[_0x3f41('0x35')],_0x1b2417[_0x3f41('0x32')]);_0x5627f8[_0x3f41('0x36')]=_[_0x3f41('0x34')](_0x1b2417[_0x3f41('0x35')],qs['fields'](_0xda0ee6['query']['fields']));_0x5627f8[_0x3f41('0x36')]=_0x5627f8[_0x3f41('0x36')]['length']?_0x5627f8[_0x3f41('0x36')]:_0x1b2417[_0x3f41('0x35')];if(!_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x37')]('nolimit')){_0x5627f8['limit']=qs['limit'](_0xda0ee6['query'][_0x3f41('0x1c')]);_0x5627f8[_0x3f41('0x1b')]=qs['offset'](_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x1b')]);}_0x5627f8[_0x3f41('0x38')]=qs[_0x3f41('0x39')](_0xda0ee6['query'][_0x3f41('0x39')]);_0x5627f8[_0x3f41('0x3a')]=qs['filters'](_[_0x3f41('0x3b')](_0xda0ee6[_0x3f41('0x32')],_0x1b2417[_0x3f41('0x33')]),_0x3df8eb);if(_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x3c')]){_0x5627f8[_0x3f41('0x3a')]=_['merge'](_0x5627f8[_0x3f41('0x3a')],{'$or':_[_0x3f41('0x2c')](_0x3df8eb,function(_0x2e1c37){if(_0x2e1c37[_0x3f41('0x2f')]!==_0x3f41('0x3d')){var _0x454a0a={};_0x454a0a[_0x2e1c37[_0x3f41('0x29')]]={'$like':'%'+_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x3c')]+'%'};return _0x454a0a;}})});}_0x5627f8=_[_0x3f41('0x3e')]({},_0x5627f8,_0xda0ee6['options']);var _0x46d056={'where':_0x5627f8[_0x3f41('0x3a')]};return db[_0x3f41('0x2d')][_0x3f41('0x3f')](_0x46d056)[_0x3f41('0x22')](function(_0x14c7a0){_0x105a0f[_0x3f41('0x3f')]=_0x14c7a0;if(_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x40')]){_0x5627f8[_0x3f41('0x41')]=[{'all':!![]}];}return db[_0x3f41('0x2d')][_0x3f41('0x42')](_0x5627f8);})[_0x3f41('0x22')](function(_0x5aea07){_0x105a0f[_0x3f41('0x43')]=_0x5aea07;return _0x105a0f;})['then'](respondWithFilteredResult(_0x3ea7b5,_0x5627f8))[_0x3f41('0x44')](handleError(_0x3ea7b5,null));};exports[_0x3f41('0x45')]=function(_0x57b6ca,_0x2f8b2f){var _0x4fbf74={'raw':!![],'where':{'id':_0x57b6ca['params']['id']}},_0x3207c0={};_0x3207c0[_0x3f41('0x35')]=_['keys'](db['Pause'][_0x3f41('0x2e')]);_0x3207c0[_0x3f41('0x32')]=_['keys'](_0x57b6ca[_0x3f41('0x32')]);_0x3207c0[_0x3f41('0x33')]=_['intersection'](_0x3207c0[_0x3f41('0x35')],_0x3207c0[_0x3f41('0x32')]);_0x4fbf74[_0x3f41('0x36')]=_[_0x3f41('0x34')](_0x3207c0[_0x3f41('0x35')],qs[_0x3f41('0x46')](_0x57b6ca[_0x3f41('0x32')][_0x3f41('0x46')]));_0x4fbf74[_0x3f41('0x36')]=_0x4fbf74['attributes'][_0x3f41('0x47')]?_0x4fbf74[_0x3f41('0x36')]:_0x3207c0[_0x3f41('0x35')];if(_0x57b6ca[_0x3f41('0x32')][_0x3f41('0x40')]){_0x4fbf74['include']=[{'all':!![]}];}_0x4fbf74=_[_0x3f41('0x3e')]({},_0x4fbf74,_0x57b6ca['options']);return db[_0x3f41('0x2d')][_0x3f41('0x48')](_0x4fbf74)[_0x3f41('0x22')](handleEntityNotFound(_0x2f8b2f,null))[_0x3f41('0x22')](respondWithResult(_0x2f8b2f,null))[_0x3f41('0x44')](handleError(_0x2f8b2f,null));};exports['create']=function(_0x1ed830,_0xb19131){return db[_0x3f41('0x2d')][_0x3f41('0x49')](_0x1ed830[_0x3f41('0x4a')],{})[_0x3f41('0x22')](function(_0x1d8f4f){var _0x3d19fd=_0x1ed830[_0x3f41('0x4b')][_0x3f41('0x24')]({'plain':!![]});if(!_0x3d19fd)throw new Error(_0x3f41('0x4c'));if(_0x3d19fd[_0x3f41('0x4d')]===_0x3f41('0x4b')){var _0x3311d6=_0x1d8f4f['get']({'plain':!![]});var _0x2e624c='Pauses';return db[_0x3f41('0x4e')][_0x3f41('0x48')]({'where':{'name':_0x2e624c,'userProfileId':_0x3d19fd[_0x3f41('0x4f')]},'raw':!![]})[_0x3f41('0x22')](function(_0x4a939d){if(_0x4a939d&&_0x4a939d[_0x3f41('0x50')]===0x0){return db[_0x3f41('0x26')][_0x3f41('0x49')]({'name':_0x3311d6[_0x3f41('0x29')],'resourceId':_0x3311d6['id'],'type':_0x4a939d[_0x3f41('0x29')],'sectionId':_0x4a939d['id']},{})[_0x3f41('0x22')](function(){return _0x1d8f4f;});}else{return _0x1d8f4f;}})[_0x3f41('0x44')](function(_0x435231){logger[_0x3f41('0x27')](_0x3f41('0x51'),_0x435231);throw _0x435231;});}return _0x1d8f4f;})[_0x3f41('0x22')](respondWithResult(_0xb19131,0xc9))[_0x3f41('0x44')](handleError(_0xb19131,null));};exports['update']=function(_0x46746d,_0x568881){if(_0x46746d['body']['id']){delete _0x46746d['body']['id'];}return db[_0x3f41('0x2d')][_0x3f41('0x48')]({'where':{'id':_0x46746d[_0x3f41('0x52')]['id']}})[_0x3f41('0x22')](handleEntityNotFound(_0x568881,null))[_0x3f41('0x22')](saveUpdates(_0x46746d[_0x3f41('0x4a')],null))[_0x3f41('0x22')](respondWithResult(_0x568881,null))[_0x3f41('0x44')](handleError(_0x568881,null));};exports[_0x3f41('0x23')]=function(_0x53c3d6,_0x20a912){return db[_0x3f41('0x2d')][_0x3f41('0x48')]({'where':{'id':_0x53c3d6[_0x3f41('0x52')]['id']}})['then'](handleEntityNotFound(_0x20a912,null))['then'](removeEntity(_0x20a912,null))[_0x3f41('0x44')](handleError(_0x20a912,null));}; \ No newline at end of file +var _0x2d1c=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','Pause','count','includeAll','include','rows','catch','show','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','crypto','desk.js'];(function(_0xecbbdb,_0x42f39c){var _0x360ded=function(_0x1ec20b){while(--_0x1ec20b){_0xecbbdb['push'](_0xecbbdb['shift']());}};_0x360ded(++_0x42f39c);}(_0x2d1c,0x1d4));var _0xc2d1=function(_0x1680ab,_0x36558f){_0x1680ab=_0x1680ab-0x0;var _0x1fc2d2=_0x2d1c[_0x1680ab];return _0x1fc2d2;};'use strict';var pdf=require(_0xc2d1('0x0'));var emlformat=require(_0xc2d1('0x1'));var rimraf=require(_0xc2d1('0x2'));var zipdir=require(_0xc2d1('0x3'));var jsonpatch=require(_0xc2d1('0x4'));var rp=require(_0xc2d1('0x5'));var moment=require('moment');var BPromise=require(_0xc2d1('0x6'));var Mustache=require('mustache');var util=require(_0xc2d1('0x7'));var path=require(_0xc2d1('0x8'));var sox=require(_0xc2d1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc2d1('0xb'));var toCsv=require(_0xc2d1('0xc'));var querystring=require(_0xc2d1('0xd'));var Papa=require(_0xc2d1('0xe'));var Redis=require(_0xc2d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc2d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc2d1('0x11'));var utils=require(_0xc2d1('0x12'));var config=require(_0xc2d1('0x13'));var db=require(_0xc2d1('0x14'))['db'];function respondWithStatusCode(_0x1c4bfa,_0x54b3ee){_0x54b3ee=_0x54b3ee||0xcc;return function(_0x4c01fc){if(_0x4c01fc){return _0x1c4bfa[_0xc2d1('0x15')](_0x54b3ee);}return _0x1c4bfa[_0xc2d1('0x16')](_0x54b3ee)[_0xc2d1('0x17')]();};}function respondWithResult(_0x4bae8c,_0x4a3f6){_0x4a3f6=_0x4a3f6||0xc8;return function(_0x18bdaa){if(_0x18bdaa){return _0x4bae8c['status'](_0x4a3f6)[_0xc2d1('0x18')](_0x18bdaa);}};}function respondWithFilteredResult(_0x345549,_0x501730){return function(_0x273f94){if(_0x273f94){var _0x386b0f=_0x273f94['count'],_0x5cf597=_0x501730[_0xc2d1('0x19')],_0x45ae20=_0x501730[_0xc2d1('0x19')]+_0x501730[_0xc2d1('0x1a')],_0x5695d6;if(_0x45ae20>=_0x386b0f){_0x45ae20=_0x386b0f;_0x5695d6=0xc8;}else{_0x5695d6=0xce;}_0x345549[_0xc2d1('0x16')](_0x5695d6);return _0x345549[_0xc2d1('0x1b')](_0xc2d1('0x1c'),_0x5cf597+'-'+_0x45ae20+'/'+_0x386b0f)[_0xc2d1('0x18')](_0x273f94);}return null;};}function patchUpdates(_0x30f6a8){return function(_0x433bab){try{jsonpatch['apply'](_0x433bab,_0x30f6a8,!![]);}catch(_0x33ad5b){return BPromise[_0xc2d1('0x1d')](_0x33ad5b);}return _0x433bab[_0xc2d1('0x1e')]();};}function saveUpdates(_0x1caf4b,_0x4bb415){return function(_0x9970f8){if(_0x9970f8){return _0x9970f8[_0xc2d1('0x1f')](_0x1caf4b)[_0xc2d1('0x20')](function(_0x5c0630){return _0x5c0630;});}return null;};}function removeEntity(_0x3dc505,_0x405b39){return function(_0x314063){if(_0x314063){return _0x314063[_0xc2d1('0x21')]()['then'](function(){var _0x576068=_0x314063[_0xc2d1('0x22')]({'plain':!![]});var _0x4a420d=_0xc2d1('0x23');return db[_0xc2d1('0x24')]['destroy']({'where':{'type':_0x4a420d,'resourceId':_0x576068['id']}})[_0xc2d1('0x20')](function(){return _0x314063;});})[_0xc2d1('0x20')](function(){_0x3dc505[_0xc2d1('0x16')](0xcc)[_0xc2d1('0x17')]();});}};}function handleEntityNotFound(_0x375941,_0x245c17){return function(_0x2a5fe5){if(!_0x2a5fe5){_0x375941[_0xc2d1('0x15')](0x194);}return _0x2a5fe5;};}function handleError(_0x2199c2,_0x3ecc9b){_0x3ecc9b=_0x3ecc9b||0x1f4;return function(_0x12fe22){logger[_0xc2d1('0x25')](_0x12fe22[_0xc2d1('0x26')]);if(_0x12fe22[_0xc2d1('0x27')]){delete _0x12fe22[_0xc2d1('0x27')];}_0x2199c2[_0xc2d1('0x16')](_0x3ecc9b)['send'](_0x12fe22);};}exports[_0xc2d1('0x28')]=function(_0xc03b1c,_0x3b1393){var _0xebee9d={},_0xd053f1={},_0x1c95bd={'count':0x0,'rows':[]};var _0x2dc63c=_[_0xc2d1('0x29')](db['Pause'][_0xc2d1('0x2a')],function(_0x4cf2e8){return{'name':_0x4cf2e8[_0xc2d1('0x2b')],'type':_0x4cf2e8[_0xc2d1('0x2c')][_0xc2d1('0x2d')]};});_0xd053f1[_0xc2d1('0x2e')]=_[_0xc2d1('0x29')](_0x2dc63c,_0xc2d1('0x27'));_0xd053f1[_0xc2d1('0x2f')]=_[_0xc2d1('0x30')](_0xc03b1c[_0xc2d1('0x2f')]);_0xd053f1[_0xc2d1('0x31')]=_[_0xc2d1('0x32')](_0xd053f1[_0xc2d1('0x2e')],_0xd053f1[_0xc2d1('0x2f')]);_0xebee9d['attributes']=_[_0xc2d1('0x32')](_0xd053f1[_0xc2d1('0x2e')],qs[_0xc2d1('0x33')](_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x33')]));_0xebee9d[_0xc2d1('0x34')]=_0xebee9d['attributes']['length']?_0xebee9d[_0xc2d1('0x34')]:_0xd053f1[_0xc2d1('0x2e')];if(!_0xc03b1c[_0xc2d1('0x2f')]['hasOwnProperty'](_0xc2d1('0x35'))){_0xebee9d[_0xc2d1('0x1a')]=qs[_0xc2d1('0x1a')](_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x1a')]);_0xebee9d[_0xc2d1('0x19')]=qs[_0xc2d1('0x19')](_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x19')]);}_0xebee9d[_0xc2d1('0x36')]=qs[_0xc2d1('0x37')](_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x37')]);_0xebee9d['where']=qs[_0xc2d1('0x31')](_[_0xc2d1('0x38')](_0xc03b1c[_0xc2d1('0x2f')],_0xd053f1[_0xc2d1('0x31')]),_0x2dc63c);if(_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x39')]){_0xebee9d['where']=_[_0xc2d1('0x3a')](_0xebee9d['where'],{'$or':_[_0xc2d1('0x29')](_0x2dc63c,function(_0x40fdea){if(_0x40fdea[_0xc2d1('0x2c')]!==_0xc2d1('0x3b')){var _0x214c7d={};_0x214c7d[_0x40fdea[_0xc2d1('0x27')]]={'$like':'%'+_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x39')]+'%'};return _0x214c7d;}})});}_0xebee9d=_[_0xc2d1('0x3a')]({},_0xebee9d,_0xc03b1c[_0xc2d1('0x3c')]);var _0x1dced8={'where':_0xebee9d[_0xc2d1('0x3d')]};return db[_0xc2d1('0x3e')][_0xc2d1('0x3f')](_0x1dced8)['then'](function(_0x165e01){_0x1c95bd['count']=_0x165e01;if(_0xc03b1c[_0xc2d1('0x2f')][_0xc2d1('0x40')]){_0xebee9d[_0xc2d1('0x41')]=[{'all':!![]}];}return db[_0xc2d1('0x3e')]['findAll'](_0xebee9d);})[_0xc2d1('0x20')](function(_0x402b71){_0x1c95bd[_0xc2d1('0x42')]=_0x402b71;return _0x1c95bd;})[_0xc2d1('0x20')](respondWithFilteredResult(_0x3b1393,_0xebee9d))[_0xc2d1('0x43')](handleError(_0x3b1393,null));};exports[_0xc2d1('0x44')]=function(_0x481761,_0x40e2b4){var _0x581e9d={'raw':!![],'where':{'id':_0x481761['params']['id']}},_0x53ca75={};_0x53ca75[_0xc2d1('0x2e')]=_[_0xc2d1('0x30')](db['Pause'][_0xc2d1('0x2a')]);_0x53ca75[_0xc2d1('0x2f')]=_[_0xc2d1('0x30')](_0x481761[_0xc2d1('0x2f')]);_0x53ca75[_0xc2d1('0x31')]=_[_0xc2d1('0x32')](_0x53ca75[_0xc2d1('0x2e')],_0x53ca75[_0xc2d1('0x2f')]);_0x581e9d[_0xc2d1('0x34')]=_[_0xc2d1('0x32')](_0x53ca75[_0xc2d1('0x2e')],qs[_0xc2d1('0x33')](_0x481761[_0xc2d1('0x2f')]['fields']));_0x581e9d[_0xc2d1('0x34')]=_0x581e9d['attributes'][_0xc2d1('0x45')]?_0x581e9d[_0xc2d1('0x34')]:_0x53ca75[_0xc2d1('0x2e')];if(_0x481761[_0xc2d1('0x2f')][_0xc2d1('0x40')]){_0x581e9d[_0xc2d1('0x41')]=[{'all':!![]}];}_0x581e9d=_[_0xc2d1('0x3a')]({},_0x581e9d,_0x481761[_0xc2d1('0x3c')]);return db[_0xc2d1('0x3e')][_0xc2d1('0x46')](_0x581e9d)[_0xc2d1('0x20')](handleEntityNotFound(_0x40e2b4,null))[_0xc2d1('0x20')](respondWithResult(_0x40e2b4,null))['catch'](handleError(_0x40e2b4,null));};exports[_0xc2d1('0x47')]=function(_0x457ad2,_0x41887b){return db[_0xc2d1('0x3e')][_0xc2d1('0x47')](_0x457ad2[_0xc2d1('0x48')],{})[_0xc2d1('0x20')](function(_0x3d2d87){var _0x57ac51=_0x457ad2['user'][_0xc2d1('0x22')]({'plain':!![]});if(!_0x57ac51)throw new Error(_0xc2d1('0x49'));if(_0x57ac51[_0xc2d1('0x4a')]===_0xc2d1('0x4b')){var _0x3e46ca=_0x3d2d87[_0xc2d1('0x22')]({'plain':!![]});var _0x11021e=_0xc2d1('0x23');return db[_0xc2d1('0x4c')][_0xc2d1('0x46')]({'where':{'name':_0x11021e,'userProfileId':_0x57ac51[_0xc2d1('0x4d')]},'raw':!![]})[_0xc2d1('0x20')](function(_0x200c1a){if(_0x200c1a&&_0x200c1a[_0xc2d1('0x4e')]===0x0){return db[_0xc2d1('0x24')][_0xc2d1('0x47')]({'name':_0x3e46ca[_0xc2d1('0x27')],'resourceId':_0x3e46ca['id'],'type':_0x200c1a[_0xc2d1('0x27')],'sectionId':_0x200c1a['id']},{})[_0xc2d1('0x20')](function(){return _0x3d2d87;});}else{return _0x3d2d87;}})['catch'](function(_0x154da0){logger[_0xc2d1('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x154da0);throw _0x154da0;});}return _0x3d2d87;})[_0xc2d1('0x20')](respondWithResult(_0x41887b,0xc9))[_0xc2d1('0x43')](handleError(_0x41887b,null));};exports[_0xc2d1('0x1f')]=function(_0x5aeb24,_0xd76d96){if(_0x5aeb24[_0xc2d1('0x48')]['id']){delete _0x5aeb24[_0xc2d1('0x48')]['id'];}return db[_0xc2d1('0x3e')]['find']({'where':{'id':_0x5aeb24[_0xc2d1('0x4f')]['id']}})[_0xc2d1('0x20')](handleEntityNotFound(_0xd76d96,null))[_0xc2d1('0x20')](saveUpdates(_0x5aeb24[_0xc2d1('0x48')],null))['then'](respondWithResult(_0xd76d96,null))['catch'](handleError(_0xd76d96,null));};exports[_0xc2d1('0x21')]=function(_0x4bed59,_0x2dd115){return db[_0xc2d1('0x3e')][_0xc2d1('0x46')]({'where':{'id':_0x4bed59[_0xc2d1('0x4f')]['id']}})[_0xc2d1('0x20')](handleEntityNotFound(_0x2dd115,null))[_0xc2d1('0x20')](removeEntity(_0x2dd115,null))[_0xc2d1('0x43')](handleError(_0x2dd115,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 23b58ef..b71d3a4 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 _0xb0b2=['define','Pause','tools_pauses','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb0b2,0x85));var _0x2b0b=function(_0x355f98,_0x58c2e1){_0x355f98=_0x355f98-0x0;var _0x41dfdc=_0xb0b2[_0x355f98];return _0x41dfdc;};'use strict';var _=require('lodash');var util=require(_0x2b0b('0x0'));var logger=require(_0x2b0b('0x1'))('api');var moment=require(_0x2b0b('0x2'));var BPromise=require(_0x2b0b('0x3'));var rp=require(_0x2b0b('0x4'));var fs=require('fs');var path=require(_0x2b0b('0x5'));var rimraf=require(_0x2b0b('0x6'));var config=require(_0x2b0b('0x7'));var attributes=require(_0x2b0b('0x8'));module[_0x2b0b('0x9')]=function(_0x197f2c,_0xabcf97){return _0x197f2c[_0x2b0b('0xa')](_0x2b0b('0xb'),attributes,{'tableName':_0x2b0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0594=['../../config/logger','api','request-promise','path','../../config/environment','./pause.attributes','exports','define','Pause','lodash'];(function(_0x4a28a1,_0x1ff5bf){var _0x653ce8=function(_0x41514c){while(--_0x41514c){_0x4a28a1['push'](_0x4a28a1['shift']());}};_0x653ce8(++_0x1ff5bf);}(_0x0594,0x6d));var _0x4059=function(_0x5ea61b,_0x330993){_0x5ea61b=_0x5ea61b-0x0;var _0x273395=_0x0594[_0x5ea61b];return _0x273395;};'use strict';var _=require(_0x4059('0x0'));var util=require('util');var logger=require(_0x4059('0x1'))(_0x4059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4059('0x3'));var fs=require('fs');var path=require(_0x4059('0x4'));var rimraf=require('rimraf');var config=require(_0x4059('0x5'));var attributes=require(_0x4059('0x6'));module[_0x4059('0x7')]=function(_0x86c07f,_0x594491){return _0x86c07f[_0x4059('0x8')](_0x4059('0x9'),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 edab13c..eedfc12 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 _0xa512=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Pause,\x20%s,\x20%s','message','info','result','catch','ShowPause','Pause','find','options','raw','attributes','include','map','model','util','moment','bluebird','ioredis'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa512,0x18f));var _0x2a51=function(_0x5c2cfc,_0x225457){_0x5c2cfc=_0x5c2cfc-0x0;var _0x39ef01=_0xa512[_0x5c2cfc];return _0x39ef01;};'use strict';var _=require('lodash');var util=require(_0x2a51('0x0'));var moment=require(_0x2a51('0x1'));var BPromise=require(_0x2a51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a51('0x3'));var db=require(_0x2a51('0x4'))['db'];var utils=require(_0x2a51('0x5'));var logger=require('../../config/logger')(_0x2a51('0x6'));var config=require(_0x2a51('0x7'));var jayson=require(_0x2a51('0x8'));var client=jayson[_0x2a51('0x9')][_0x2a51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32113a,_0x884e8e,_0x18c08f){return new BPromise(function(_0x2eb3dc,_0x1c104b){return client['request'](_0x32113a,_0x18c08f)[_0x2a51('0xb')](function(_0x4c4be5){logger['info']('Pause,\x20%s,\x20%s',_0x884e8e,'request\x20sent');logger[_0x2a51('0xc')](_0x2a51('0xd'),_0x884e8e,_0x2a51('0xe'),JSON[_0x2a51('0xf')](_0x4c4be5));if(_0x4c4be5[_0x2a51('0x10')]){if(_0x4c4be5[_0x2a51('0x10')]['code']===0x1f4){logger[_0x2a51('0x10')](_0x2a51('0x11'),_0x884e8e,_0x4c4be5[_0x2a51('0x10')]['message']);return _0x1c104b(_0x4c4be5[_0x2a51('0x10')][_0x2a51('0x12')]);}logger[_0x2a51('0x10')](_0x2a51('0x11'),_0x884e8e,_0x4c4be5[_0x2a51('0x10')][_0x2a51('0x12')]);return _0x2eb3dc(_0x4c4be5['error']['message']);}else{logger[_0x2a51('0x13')]('Pause,\x20%s,\x20%s',_0x884e8e,_0x2a51('0xe'));_0x2eb3dc(_0x4c4be5[_0x2a51('0x14')][_0x2a51('0x12')]);}})[_0x2a51('0x15')](function(_0x4ca614){logger[_0x2a51('0x10')](_0x2a51('0x11'),_0x884e8e,_0x4ca614);_0x1c104b(_0x4ca614);});});}exports[_0x2a51('0x16')]=function(_0x26ccea){var _0x549202=this;return new Promise(function(_0x4af3e9,_0x1b115b){return db[_0x2a51('0x17')][_0x2a51('0x18')]({'raw':_0x26ccea[_0x2a51('0x19')]?_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1a')]===undefined?!![]:![]:!![],'where':_0x26ccea[_0x2a51('0x19')]?_0x26ccea['options']['where']||null:null,'attributes':_0x26ccea[_0x2a51('0x19')]?_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1b')]||null:null,'include':_0x26ccea[_0x2a51('0x19')]?_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1c')]?_[_0x2a51('0x1d')](_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1c')],function(_0x2f6a6f){return{'model':db[_0x2f6a6f['model']],'as':_0x2f6a6f['as'],'attributes':_0x2f6a6f[_0x2a51('0x1b')],'include':_0x2f6a6f[_0x2a51('0x1c')]?_['map'](_0x2f6a6f['include'],function(_0x58d245){return{'model':db[_0x58d245[_0x2a51('0x1e')]],'as':_0x58d245['as'],'attributes':_0x58d245['attributes'],'include':_0x58d245[_0x2a51('0x1c')]?_[_0x2a51('0x1d')](_0x58d245['include'],function(_0x10e8f8){return{'model':db[_0x10e8f8[_0x2a51('0x1e')]],'as':_0x10e8f8['as'],'attributes':_0x10e8f8[_0x2a51('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7298bd){logger[_0x2a51('0x13')](_0x2a51('0x16'),_0x26ccea);logger[_0x2a51('0xc')](_0x2a51('0x16'),_0x26ccea,JSON[_0x2a51('0xf')](_0x7298bd));_0x4af3e9(_0x7298bd);})['catch'](function(_0x53b08c){logger[_0x2a51('0x10')]('ShowPause',_0x53b08c['message'],_0x26ccea);_0x1b115b(_0x549202[_0x2a51('0x10')](0x1f4,_0x53b08c[_0x2a51('0x12')]));});});}; \ No newline at end of file +var _0x90a8=['model','ShowPause','stringify','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Pause,\x20%s,\x20%s','message','result','catch','Pause','find','options','attributes','include','map'];(function(_0x38f1ca,_0x23dacf){var _0x4a8dc0=function(_0x53b626){while(--_0x53b626){_0x38f1ca['push'](_0x38f1ca['shift']());}};_0x4a8dc0(++_0x23dacf);}(_0x90a8,0x11a));var _0x890a=function(_0x40eedb,_0x4fb12c){_0x40eedb=_0x40eedb-0x0;var _0x56818d=_0x90a8[_0x40eedb];return _0x56818d;};'use strict';var _=require('lodash');var util=require(_0x890a('0x0'));var moment=require(_0x890a('0x1'));var BPromise=require('bluebird');var rs=require(_0x890a('0x2'));var fs=require('fs');var Redis=require(_0x890a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x890a('0x4'));var logger=require(_0x890a('0x5'))(_0x890a('0x6'));var config=require(_0x890a('0x7'));var jayson=require(_0x890a('0x8'));var client=jayson[_0x890a('0x9')][_0x890a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x128bbd,_0x314201,_0x5b6fae){return new BPromise(function(_0xedc955,_0x1c7b49){return client[_0x890a('0xb')](_0x128bbd,_0x5b6fae)[_0x890a('0xc')](function(_0x46165a){logger[_0x890a('0xd')]('Pause,\x20%s,\x20%s',_0x314201,'request\x20sent');logger['debug'](_0x890a('0xe'),_0x314201,_0x890a('0xf'),JSON['stringify'](_0x46165a));if(_0x46165a[_0x890a('0x10')]){if(_0x46165a[_0x890a('0x10')][_0x890a('0x11')]===0x1f4){logger[_0x890a('0x10')](_0x890a('0x12'),_0x314201,_0x46165a['error'][_0x890a('0x13')]);return _0x1c7b49(_0x46165a['error'][_0x890a('0x13')]);}logger[_0x890a('0x10')]('Pause,\x20%s,\x20%s',_0x314201,_0x46165a['error'][_0x890a('0x13')]);return _0xedc955(_0x46165a[_0x890a('0x10')][_0x890a('0x13')]);}else{logger[_0x890a('0xd')](_0x890a('0x12'),_0x314201,'request\x20sent');_0xedc955(_0x46165a[_0x890a('0x14')][_0x890a('0x13')]);}})[_0x890a('0x15')](function(_0x34f6de){logger[_0x890a('0x10')](_0x890a('0x12'),_0x314201,_0x34f6de);_0x1c7b49(_0x34f6de);});});}exports['ShowPause']=function(_0x5ab6bc){var _0x578e4c=this;return new Promise(function(_0x1317ef,_0x382b62){return db[_0x890a('0x16')][_0x890a('0x17')]({'raw':_0x5ab6bc['options']?_0x5ab6bc[_0x890a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5ab6bc['options']?_0x5ab6bc[_0x890a('0x18')]['where']||null:null,'attributes':_0x5ab6bc[_0x890a('0x18')]?_0x5ab6bc[_0x890a('0x18')][_0x890a('0x19')]||null:null,'include':_0x5ab6bc[_0x890a('0x18')]?_0x5ab6bc[_0x890a('0x18')][_0x890a('0x1a')]?_['map'](_0x5ab6bc[_0x890a('0x18')][_0x890a('0x1a')],function(_0x43b794){return{'model':db[_0x43b794['model']],'as':_0x43b794['as'],'attributes':_0x43b794['attributes'],'include':_0x43b794['include']?_[_0x890a('0x1b')](_0x43b794[_0x890a('0x1a')],function(_0x380e8b){return{'model':db[_0x380e8b[_0x890a('0x1c')]],'as':_0x380e8b['as'],'attributes':_0x380e8b[_0x890a('0x19')],'include':_0x380e8b[_0x890a('0x1a')]?_[_0x890a('0x1b')](_0x380e8b['include'],function(_0x2d3d20){return{'model':db[_0x2d3d20[_0x890a('0x1c')]],'as':_0x2d3d20['as'],'attributes':_0x2d3d20['attributes']};}):[]};}):[]};}):[]:[]})[_0x890a('0xc')](function(_0x497663){logger['info']('ShowPause',_0x5ab6bc);logger['debug'](_0x890a('0x1d'),_0x5ab6bc,JSON[_0x890a('0x1e')](_0x497663));_0x1317ef(_0x497663);})['catch'](function(_0x5461b1){logger[_0x890a('0x10')](_0x890a('0x1d'),_0x5461b1[_0x890a('0x13')],_0x5ab6bc);_0x382b62(_0x578e4c[_0x890a('0x10')](0x1f4,_0x5461b1[_0x890a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 3e52fb1..6341b86 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 _0xe6c4=['/:id/download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id'];(function(_0x12e73c,_0x2cbe1d){var _0x4c41cb=function(_0x10283b){while(--_0x10283b){_0x12e73c['push'](_0x12e73c['shift']());}};_0x4c41cb(++_0x2cbe1d);}(_0xe6c4,0xc2));var _0x4e6c=function(_0x26462c,_0x2cfe36){_0x26462c=_0x26462c-0x0;var _0xabeb8a=_0xe6c4[_0x26462c];return _0xabeb8a;};'use strict';var multer=require(_0x4e6c('0x0'));var util=require(_0x4e6c('0x1'));var path=require(_0x4e6c('0x2'));var timeout=require(_0x4e6c('0x3'));var express=require(_0x4e6c('0x4'));var router=express[_0x4e6c('0x5')]();var auth=require(_0x4e6c('0x6'));var interaction=require(_0x4e6c('0x7'));var config=require(_0x4e6c('0x8'));var controller=require(_0x4e6c('0x9'));router[_0x4e6c('0xa')]('/',auth[_0x4e6c('0xb')](),controller[_0x4e6c('0xc')]);router[_0x4e6c('0xa')](_0x4e6c('0xd'),controller[_0x4e6c('0xe')]);router[_0x4e6c('0xa')](_0x4e6c('0xf'),auth[_0x4e6c('0xb')](),controller['show']);router['get'](_0x4e6c('0x10'),auth[_0x4e6c('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x4e6c('0x11')]({'destination':function(_0x1e55e9,_0x5c8452,_0x183793){_0x183793(null,path[_0x4e6c('0x12')](config[_0x4e6c('0x13')],'server/files/plugins'));},'filename':function(_0x237281,_0x495a7a,_0x3d3b3a){_0x495a7a[_0x4e6c('0x14')]=_0x495a7a[_0x4e6c('0x14')][_0x4e6c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3b3a(null,util[_0x4e6c('0x16')](_0x4e6c('0x17'),path[_0x4e6c('0x18')](_0x495a7a['originalname'],path['extname'](_0x495a7a[_0x4e6c('0x14')])),Date['now'](),path[_0x4e6c('0x19')](_0x495a7a['originalname'])));}})});router[_0x4e6c('0x1a')]('/',upload[_0x4e6c('0x1b')](_0x4e6c('0x1c')),controller[_0x4e6c('0x1d')]);router[_0x4e6c('0x1a')](_0x4e6c('0xd'),controller[_0x4e6c('0x1e')]);router[_0x4e6c('0x1f')](_0x4e6c('0xf'),auth[_0x4e6c('0xb')](),controller[_0x4e6c('0x20')]);router[_0x4e6c('0x21')](_0x4e6c('0xf'),auth[_0x4e6c('0xb')](),controller[_0x4e6c('0x21')]);module[_0x4e6c('0x22')]=router; \ No newline at end of file +var _0x4383=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','webhookGet','isAuthenticated','show','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','upload','post','/webhook','webhookPost','put','/:id','update','delete'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x4383,0xa6));var _0x3438=function(_0x15f608,_0x23b508){_0x15f608=_0x15f608-0x0;var _0x185022=_0x4383[_0x15f608];return _0x185022;};'use strict';var multer=require(_0x3438('0x0'));var util=require('util');var path=require(_0x3438('0x1'));var timeout=require(_0x3438('0x2'));var express=require(_0x3438('0x3'));var router=express[_0x3438('0x4')]();var auth=require(_0x3438('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3438('0x6'));var controller=require(_0x3438('0x7'));router[_0x3438('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3438('0x8')]('/webhook',controller[_0x3438('0x9')]);router['get']('/:id',auth[_0x3438('0xa')](),controller[_0x3438('0xb')]);router[_0x3438('0x8')]('/:id/download',auth[_0x3438('0xa')](),controller[_0x3438('0xc')]);var upload=multer({'storage':multer[_0x3438('0xd')]({'destination':function(_0x59512a,_0x4b3e5e,_0x5c83c6){_0x5c83c6(null,path[_0x3438('0xe')](config[_0x3438('0xf')],_0x3438('0x10')));},'filename':function(_0x2b630d,_0x2431e2,_0x20f094){_0x2431e2[_0x3438('0x11')]=_0x2431e2[_0x3438('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20f094(null,util[_0x3438('0x12')](_0x3438('0x13'),path[_0x3438('0x14')](_0x2431e2[_0x3438('0x11')],path[_0x3438('0x15')](_0x2431e2[_0x3438('0x11')])),Date[_0x3438('0x16')](),path[_0x3438('0x15')](_0x2431e2['originalname'])));}})});router['post']('/',upload[_0x3438('0x17')]('file'),controller[_0x3438('0x18')]);router[_0x3438('0x19')](_0x3438('0x1a'),controller[_0x3438('0x1b')]);router[_0x3438('0x1c')](_0x3438('0x1d'),auth[_0x3438('0xa')](),controller[_0x3438('0x1e')]);router[_0x3438('0x1f')](_0x3438('0x1d'),auth['isAuthenticated'](),controller[_0x3438('0x1f')]);module[_0x3438('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 00fdbec..77a0e91 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 _0x190d=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM','html','script','TEXT'];(function(_0x471eb0,_0x1f54c8){var _0x2d9f31=function(_0x3ea4cb){while(--_0x3ea4cb){_0x471eb0['push'](_0x471eb0['shift']());}};_0x2d9f31(++_0x1f54c8);}(_0x190d,0x13b));var _0xd190=function(_0x49949e,_0x5b8339){_0x49949e=_0x49949e-0x0;var _0x3cd1c4=_0x190d[_0x49949e];return _0x3cd1c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd190('0x0')](_0xd190('0x1'),_0xd190('0x2'))},'description':{'type':Sequelize[_0xd190('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd190('0x4')],'comment':_0xd190('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd190('0x6')},'sidebar':{'type':Sequelize[_0xd190('0x0')]('adminOnly',_0xd190('0x7'),_0xd190('0x8'),_0xd190('0x9')),'defaultValue':_0xd190('0x8'),'comment':_0xd190('0xa')},'icon':{'type':Sequelize[_0xd190('0x4')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd190('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xd190('0x4')]}}; \ No newline at end of file +var _0xb493=['STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xb493,0x99));var _0x3b49=function(_0x4dbd3b,_0x38069b){_0x4dbd3b=_0x4dbd3b-0x0;var _0x5a1c0d=_0xb493[_0x4dbd3b];return _0x5a1c0d;};'use strict';var Sequelize=require(_0x3b49('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b49('0x1')]},'type':{'type':Sequelize['ENUM'](_0x3b49('0x2'),_0x3b49('0x3'))},'description':{'type':Sequelize[_0x3b49('0x4')]},'version':{'type':Sequelize[_0x3b49('0x4')]},'path':{'type':Sequelize[_0x3b49('0x1')],'comment':_0x3b49('0x5')},'active':{'type':Sequelize[_0x3b49('0x6')],'defaultValue':0x0,'comment':_0x3b49('0x7')},'sidebar':{'type':Sequelize[_0x3b49('0x8')](_0x3b49('0x9'),_0x3b49('0xa'),_0x3b49('0xb'),_0x3b49('0xc')),'defaultValue':_0x3b49('0xb'),'comment':_0x3b49('0xd')},'icon':{'type':Sequelize[_0x3b49('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x3b49('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x3b49('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index db6fec9..195c73f 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 _0xb18e=['lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','hostname','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Plugin','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','catch','download','join','root','server/files/plugins','createWriteStream','zip','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','basename','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure'];(function(_0x8e379,_0x31fc7d){var _0x542cde=function(_0x3e0061){while(--_0x3e0061){_0x8e379['push'](_0x8e379['shift']());}};_0x542cde(++_0x31fc7d);}(_0xb18e,0x189));var _0xeb18=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xb18e[_0x28b0a1];return _0x21470c;};'use strict';var pdf=require(_0xeb18('0x0'));var emlformat=require(_0xeb18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb18('0x3'));var moment=require(_0xeb18('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeb18('0x5'));var util=require('util');var path=require(_0xeb18('0x6'));var sox=require(_0xeb18('0x7'));var csv=require('to-csv');var ejs=require(_0xeb18('0x8'));var fs=require('fs');var _=require(_0xeb18('0x9'));var squel=require(_0xeb18('0xa'));var crypto=require('crypto');var jsforce=require(_0xeb18('0xb'));var deskjs=require(_0xeb18('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeb18('0xd'));var Papa=require(_0xeb18('0xe'));var extract=require(_0xeb18('0xf'));var rimraf=require(_0xeb18('0x10'));var archiver=require(_0xeb18('0x11'));var Redis=require(_0xeb18('0x12'));var authService=require(_0xeb18('0x13'));var qs=require(_0xeb18('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb18('0x15'));var logger=require('../../config/logger')(_0xeb18('0x16'));var utils=require('../../config/utils');var config=require(_0xeb18('0x17'));var db=require(_0xeb18('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xeb18('0x19')](socket);function respondWithStatusCode(_0x567c07,_0x15dff3){_0x15dff3=_0x15dff3||0xcc;return function(_0xd00e23){if(_0xd00e23){return _0x567c07[_0xeb18('0x1a')](_0x15dff3);}return _0x567c07[_0xeb18('0x1b')](_0x15dff3)[_0xeb18('0x1c')]();};}function respondWithResult(_0x5672a1,_0x365507){_0x365507=_0x365507||0xc8;return function(_0x49f2d0){if(_0x49f2d0){return _0x5672a1[_0xeb18('0x1b')](_0x365507)[_0xeb18('0x1d')](_0x49f2d0);}};}function respondWithFilteredResult(_0x184a96,_0x107150){return function(_0x19ce8d){if(_0x19ce8d){var _0x5129b9=_0x19ce8d[_0xeb18('0x1e')],_0x588218=_0x107150[_0xeb18('0x1f')],_0xd2af3f=_0x107150[_0xeb18('0x1f')]+_0x107150[_0xeb18('0x20')],_0x54c42d;if(_0xd2af3f>=_0x5129b9){_0xd2af3f=_0x5129b9;_0x54c42d=0xc8;}else{_0x54c42d=0xce;}_0x184a96[_0xeb18('0x1b')](_0x54c42d);return _0x184a96[_0xeb18('0x21')](_0xeb18('0x22'),_0x588218+'-'+_0xd2af3f+'/'+_0x5129b9)[_0xeb18('0x1d')](_0x19ce8d);}return null;};}function patchUpdates(_0x597774){return function(_0x5c35ac){try{jsonpatch[_0xeb18('0x23')](_0x5c35ac,_0x597774,!![]);}catch(_0x5e4d1d){return BPromise[_0xeb18('0x24')](_0x5e4d1d);}return _0x5c35ac[_0xeb18('0x25')]();};}function saveUpdates(_0x426824,_0x1f189c){return function(_0x444444){if(_0x444444){return _0x444444[_0xeb18('0x26')](_0x426824)[_0xeb18('0x27')](function(_0x270102){return _0x270102;});}return null;};}function removeEntity(_0x2c6222,_0x1b02b0){return function(_0x3c3b3b){if(_0x3c3b3b){return _0x3c3b3b[_0xeb18('0x28')]()[_0xeb18('0x27')](function(){var _0x343336=_0x3c3b3b[_0xeb18('0x29')]({'plain':!![]});var _0xd55d1b='Plugins';return db[_0xeb18('0x2a')][_0xeb18('0x28')]({'where':{'type':_0xd55d1b,'resourceId':_0x343336['id']}})[_0xeb18('0x27')](function(){return _0x3c3b3b;});})[_0xeb18('0x27')](function(){_0x2c6222['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188641,_0x31d8cc){return function(_0x13d456){if(!_0x13d456){_0x188641[_0xeb18('0x1a')](0x194);}return _0x13d456;};}function handleError(_0x1a96ff,_0x8c36a2){_0x8c36a2=_0x8c36a2||0x1f4;return function(_0x5728f5){logger['error'](_0x5728f5[_0xeb18('0x2b')]);if(_0x5728f5[_0xeb18('0x2c')]){delete _0x5728f5[_0xeb18('0x2c')];}_0x1a96ff[_0xeb18('0x1b')](_0x8c36a2)[_0xeb18('0x2d')](_0x5728f5);};}exports[_0xeb18('0x2e')]=function(_0xe79b3,_0x3c6235){var _0x33c0a9={},_0x2544d9={},_0x36dc1d={'count':0x0,'rows':[]};var _0x54b0f8=_[_0xeb18('0x2f')](db[_0xeb18('0x30')][_0xeb18('0x31')],function(_0x5e51f4){return{'name':_0x5e51f4['fieldName'],'type':_0x5e51f4[_0xeb18('0x32')]['key']};});_0x2544d9[_0xeb18('0x33')]=_[_0xeb18('0x2f')](_0x54b0f8,_0xeb18('0x2c'));_0x2544d9['query']=_[_0xeb18('0x34')](_0xe79b3[_0xeb18('0x35')]);_0x2544d9[_0xeb18('0x36')]=_[_0xeb18('0x37')](_0x2544d9[_0xeb18('0x33')],_0x2544d9[_0xeb18('0x35')]);_0x33c0a9[_0xeb18('0x38')]=_['intersection'](_0x2544d9[_0xeb18('0x33')],qs[_0xeb18('0x39')](_0xe79b3[_0xeb18('0x35')][_0xeb18('0x39')]));_0x33c0a9[_0xeb18('0x38')]=_0x33c0a9[_0xeb18('0x38')]['length']?_0x33c0a9['attributes']:_0x2544d9[_0xeb18('0x33')];if(!_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3a')]('nolimit')){_0x33c0a9[_0xeb18('0x20')]=qs[_0xeb18('0x20')](_0xe79b3[_0xeb18('0x35')]['limit']);_0x33c0a9[_0xeb18('0x1f')]=qs[_0xeb18('0x1f')](_0xe79b3[_0xeb18('0x35')]['offset']);}_0x33c0a9[_0xeb18('0x3b')]=qs[_0xeb18('0x3c')](_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3c')]);_0x33c0a9[_0xeb18('0x3d')]=qs['filters'](_[_0xeb18('0x3e')](_0xe79b3[_0xeb18('0x35')],_0x2544d9[_0xeb18('0x36')]),_0x54b0f8);if(_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3f')]){_0x33c0a9[_0xeb18('0x3d')]=_[_0xeb18('0x40')](_0x33c0a9['where'],{'$or':_['map'](_0x54b0f8,function(_0x3f34fe){if(_0x3f34fe[_0xeb18('0x32')]!==_0xeb18('0x41')){var _0x515e35={};_0x515e35[_0x3f34fe[_0xeb18('0x2c')]]={'$like':'%'+_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3f')]+'%'};return _0x515e35;}})});}_0x33c0a9=_[_0xeb18('0x40')]({},_0x33c0a9,_0xe79b3[_0xeb18('0x42')]);var _0x5395ee={'where':_0x33c0a9[_0xeb18('0x3d')]};return db[_0xeb18('0x30')]['count'](_0x5395ee)[_0xeb18('0x27')](function(_0x110b52){_0x36dc1d[_0xeb18('0x1e')]=_0x110b52;if(_0xe79b3[_0xeb18('0x35')][_0xeb18('0x43')]){_0x33c0a9[_0xeb18('0x44')]=[{'all':!![]}];}return db[_0xeb18('0x30')][_0xeb18('0x45')](_0x33c0a9);})[_0xeb18('0x27')](function(_0x4edd6b){_0x36dc1d['rows']=_0x4edd6b;return _0x36dc1d;})[_0xeb18('0x27')](respondWithFilteredResult(_0x3c6235,_0x33c0a9))['catch'](handleError(_0x3c6235,null));};exports['show']=function(_0x1e3601,_0x4c7c15){var _0x21de58={'raw':!![],'where':{'id':_0x1e3601[_0xeb18('0x46')]['id']}},_0x592cf4={};_0x592cf4[_0xeb18('0x33')]=_[_0xeb18('0x34')](db[_0xeb18('0x30')][_0xeb18('0x31')]);_0x592cf4[_0xeb18('0x35')]=_['keys'](_0x1e3601[_0xeb18('0x35')]);_0x592cf4[_0xeb18('0x36')]=_['intersection'](_0x592cf4[_0xeb18('0x33')],_0x592cf4[_0xeb18('0x35')]);_0x21de58[_0xeb18('0x38')]=_[_0xeb18('0x37')](_0x592cf4[_0xeb18('0x33')],qs[_0xeb18('0x39')](_0x1e3601[_0xeb18('0x35')][_0xeb18('0x39')]));_0x21de58[_0xeb18('0x38')]=_0x21de58[_0xeb18('0x38')][_0xeb18('0x47')]?_0x21de58['attributes']:_0x592cf4[_0xeb18('0x33')];if(_0x1e3601[_0xeb18('0x35')][_0xeb18('0x43')]){_0x21de58[_0xeb18('0x44')]=[{'all':!![]}];}_0x21de58=_[_0xeb18('0x40')]({},_0x21de58,_0x1e3601[_0xeb18('0x42')]);return db[_0xeb18('0x30')][_0xeb18('0x48')](_0x21de58)[_0xeb18('0x27')](handleEntityNotFound(_0x4c7c15,null))['then'](respondWithResult(_0x4c7c15,null))[_0xeb18('0x49')](handleError(_0x4c7c15,null));};exports[_0xeb18('0x4a')]=function(_0x1ce40b,_0x2e99a6,_0x26dec3){return db[_0xeb18('0x30')][_0xeb18('0x48')]({'where':{'id':_0x1ce40b[_0xeb18('0x46')]['id']},'attributes':['name',_0xeb18('0x6')],'raw':!![]})[_0xeb18('0x27')](handleEntityNotFound(_0x2e99a6,null))[_0xeb18('0x27')](function(_0x25f92f){if(_0x25f92f){var _0x400fce=path[_0xeb18('0x4b')](config[_0xeb18('0x4c')],_0xeb18('0x4d'),util['format']('%s.zip',path['basename'](_0x25f92f['path'])));var _0x794462=fs[_0xeb18('0x4e')](_0x400fce);var _0x3b8e55=archiver(_0xeb18('0x4f'),{'zlib':{'level':0x9}});_0x3b8e55['on']('warning',function(_0x533ac7){if(_0x533ac7['code']===_0xeb18('0x50')){logger[_0xeb18('0x51')](_0x533ac7);}else{throw new db[(_0xeb18('0x52'))]['Error'](_0xeb18('0x53'));}});_0x3b8e55['on'](_0xeb18('0x51'),function(_0x2128e5){throw new db[(_0xeb18('0x52'))][(_0xeb18('0x54'))](_0xeb18('0x53'));});_0x3b8e55[_0xeb18('0x55')](_0x794462);_0x3b8e55[_0xeb18('0x56')](_0xeb18('0x57'),{'cwd':path['join'](config['root'],_0xeb18('0x4d'),path[_0xeb18('0x58')](_0x25f92f[_0xeb18('0x6')])),'ignore':[path[_0xeb18('0x4b')](path['basename'](_0x25f92f['path']),_0xeb18('0x59')),path['join'](path['basename'](_0x25f92f['path']),'attachments/**/*')],'nodir':!![]})[_0xeb18('0x5a')]();_0x794462['on'](_0xeb18('0x5b'),function(){if(!fs[_0xeb18('0x5c')](_0x400fce)){throw new db[(_0xeb18('0x52'))]['Error'](_0xeb18('0x5d'));}return _0x2e99a6['download'](_0x400fce,util[_0xeb18('0x5e')]('%s.zip',path[_0xeb18('0x5f')](_0x25f92f[_0xeb18('0x6')])),function(_0x5e07b2){if(_0x5e07b2){throw new db['Sequelize'][(_0xeb18('0x54'))](_0xeb18('0x60'));}fs['unlinkSync'](_0x400fce);logger['info'](_0xeb18('0x61'));logger[_0xeb18('0x62')]('Temporary\x20file\x20removed');});});}return null;})[_0xeb18('0x49')](handleError(_0x2e99a6,null));};exports[_0xeb18('0x63')]=function(_0x12cb77,_0x422b33,_0x449ce6){var _0x426d96=path[_0xeb18('0x5f')](_0x12cb77['file'][_0xeb18('0x64')],path[_0xeb18('0x65')](_0x12cb77['file']['filename']));var _0x425aeb=path[_0xeb18('0x4b')](config[_0xeb18('0x4c')],_0xeb18('0x4d'),_0x12cb77[_0xeb18('0x66')][_0xeb18('0x64')]);var _0x517348=path[_0xeb18('0x4b')](config[_0xeb18('0x4c')],_0xeb18('0x4d'),_0x426d96);logger['info'](_0xeb18('0x67'),_0x425aeb);logger[_0xeb18('0x62')]('Plugin\x20upload\x20destination:\x20%s',_0x517348);try{fs[_0xeb18('0x68')](_0x425aeb,parseInt(_0xeb18('0x69'),0x8));extract(_0x425aeb,{'dir':_0x517348},function(_0x20810a){if(_0x20810a){logger[_0xeb18('0x51')](_0x20810a);handleError(_0x20810a,!![]);};var _0xca8ff9=fs[_0xeb18('0x6a')](_0x517348);if(_0xca8ff9['length']>0x1){removeReferences(_0x425aeb,_0x517348);logger[_0xeb18('0x51')](_0xeb18('0x6b'));return _0x449ce6(new Error(_0xeb18('0x6b')));}var _0x5ee149=fs[_0xeb18('0x6c')](path['join'](_0x517348,_0xca8ff9[0x0]));if(_0x5ee149[_0xeb18('0x6d')]()){removeReferences(_0x425aeb,_0x517348);logger['error']('Invalid\x20plugin\x20structure');return _0x449ce6(new Error(_0xeb18('0x6b')));}if(_0x5ee149[_0xeb18('0x6e')]()){var _0x2161b5=fs['readdirSync'](path['join'](_0x517348,_0xca8ff9[0x0]));if(_0x2161b5[_0xeb18('0x47')]===0x0){removeReferences(_0x425aeb,_0x517348);logger[_0xeb18('0x51')](_0xeb18('0x6b'));return _0x449ce6(new Error('Invalid\x20plugin\x20structure'));}var _0x3f5b2d=_0x2161b5[_0xeb18('0x6f')](function(_0x138c93){return _0x138c93===_0xeb18('0x70');});if(!_0x3f5b2d){return _0x449ce6(new Error(_0xeb18('0x71')));}var _0x16d26a=fs[_0xeb18('0x72')](path[_0xeb18('0x4b')](_0x517348,_0xca8ff9[0x0],_0xeb18('0x70')));var _0x37ec67=JSON[_0xeb18('0x73')](_0x16d26a);if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x2c')]){return _0x449ce6(new Error(_0xeb18('0x75')));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x32')]){return _0x449ce6(new Error(_0xeb18('0x76')));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x77')]){return _0x449ce6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x78')]){return _0x449ce6(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x37ec67[_0xeb18('0x32')]===_0xeb18('0x79')){if(_0xeb18('0x74')==typeof _0x37ec67['parameters'][_0xeb18('0x7a')]){return _0x449ce6(new Error(_0xeb18('0x7b')));}if(_0xeb18('0x74')==typeof _0x37ec67['parameters'][_0xeb18('0x7a')][_0xeb18('0x7c')]&&'undefined'==typeof _0x37ec67['parameters'][_0xeb18('0x7a')][_0xeb18('0x7d')]){return _0x449ce6(new Error(_0xeb18('0x7e')));}}else if(_0x37ec67['type']===_0xeb18('0x7f')){if('undefined'==typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x80')]){return _0x449ce6(new Error(_0xeb18('0x81')));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x82')]){return _0x449ce6(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x449ce6(new Error(_0xeb18('0x83')));}var _0x5a79bf=_0x37ec67[_0xeb18('0x2c')];var _0x384a1f=_0x37ec67['description'];var _0x4fa03e=_0x37ec67['type'];var _0x51ae62=_0x37ec67[_0xeb18('0x84')]?_0x37ec67['sidebar']:_0xeb18('0x85');var _0x127d51=_0x37ec67[_0xeb18('0x86')]?_0x37ec67['icon']:_0xeb18('0x87');var _0x159f48='';var _0x44b2de='';var _0x311a3c='';var _0x10d667='';var _0x583556=_0x37ec67['version'];if(_0x4fa03e===_0xeb18('0x79')){if(_0xeb18('0x74')!=typeof _0x37ec67['parameters'][_0xeb18('0x7a')]['admin']){var _0x4979f4=_0x37ec67['parameters'][_0xeb18('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4979f4)){_0x159f48=path['join'](_0xeb18('0x88'),_0x426d96,_0xca8ff9[0x0],_0x4979f4);}else{_0x159f48=_0x4979f4;}}else{logger[_0xeb18('0x62')](_0xeb18('0x89'));}if(_0xeb18('0x74')!=typeof _0x37ec67[_0xeb18('0x78')]['views'][_0xeb18('0x7d')]){var _0x4f26c6=_0x37ec67[_0xeb18('0x78')][_0xeb18('0x7a')][_0xeb18('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xeb18('0x8a')](_0x4f26c6)){_0x44b2de=path['join']('plugins',_0x426d96,_0xca8ff9[0x0],_0x4f26c6);}else{_0x44b2de=_0x4f26c6;}}else{logger[_0xeb18('0x62')](_0xeb18('0x8b'));}}else if(_0x4fa03e===_0xeb18('0x7f')){_0x311a3c=_0x37ec67['parameters'][_0xeb18('0x80')];_0x10d667=_0x37ec67[_0xeb18('0x78')]['scriptPath'];if(_0xeb18('0x74')!=typeof _0x37ec67['parameters']['views']){if('undefined'!=typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x7a')]['admin']){var _0x4979f4=_0x37ec67['parameters'][_0xeb18('0x7a')][_0xeb18('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4979f4)){_0x159f48=path[_0xeb18('0x4b')](_0xeb18('0x88'),_0x426d96,_0xca8ff9[0x0],_0x4979f4);}else{_0x159f48=_0x4979f4;}}if(_0xeb18('0x74')!=typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x7a')][_0xeb18('0x7d')]){var _0x4f26c6=_0x37ec67['parameters'][_0xeb18('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xeb18('0x8a')](_0x4f26c6)){_0x44b2de=path[_0xeb18('0x4b')](_0xeb18('0x88'),_0x426d96,_0xca8ff9[0x0],_0x4f26c6);}else{_0x44b2de=_0x4f26c6;}}}}var _0x5d20cb={'name':_0x5a79bf,'description':_0x384a1f,'path':path[_0xeb18('0x4b')](_0x426d96,_0xca8ff9[0x0]),'type':_0x4fa03e,'sidebar':_0x51ae62,'icon':_0x127d51,'adminUrl':_0x159f48,'agentUrl':_0x44b2de,'scriptName':_0x311a3c,'scriptPath':_0x10d667,'version':_0x583556};removeReferences(_0x425aeb,null);return db[_0xeb18('0x30')]['create'](_0x5d20cb)[_0xeb18('0x27')](function(_0xebccb4){var _0x4848ee={'role':_0x12cb77[_0xeb18('0x8c')]['role'],'userProfileId':_0x12cb77['body']['userProfileId']};if(!_0x4848ee)throw new Error(_0xeb18('0x8d'));if(_0x4848ee[_0xeb18('0x8e')]===_0xeb18('0x8f')){var _0x31d696=_0xebccb4['get']({'plain':!![]});return db[_0xeb18('0x90')][_0xeb18('0x48')]({'where':{'name':_0xeb18('0x91'),'userProfileId':_0x4848ee['userProfileId']},'raw':!![]})['then'](function(_0x395fe4){if(_0x395fe4&&_0x395fe4[_0xeb18('0x92')]===0x0){return db[_0xeb18('0x2a')]['create']({'name':_0x31d696['name'],'resourceId':_0x31d696['id'],'type':_0x395fe4['name'],'sectionId':_0x395fe4['id']},{})[_0xeb18('0x27')](function(){return _0xebccb4;});}else{return _0xebccb4;}})[_0xeb18('0x49')](function(_0x2cd8f3){logger[_0xeb18('0x51')](_0xeb18('0x93'),_0x2cd8f3);throw _0x2cd8f3;});}return _0xebccb4;})[_0xeb18('0x27')](respondWithResult(_0x422b33,null))[_0xeb18('0x49')](handleError(_0x422b33,null));}});}catch(_0x274b72){_0x422b33[_0xeb18('0x1b')](0x1f4)[_0xeb18('0x2d')](_0x274b72);}};function removeReferences(_0x188a4d,_0x1d72df){try{if(_0x188a4d){fs[_0xeb18('0x94')](_0x188a4d);logger[_0xeb18('0x62')](_0xeb18('0x95'));}if(_0x1d72df){rimraf(_0x1d72df,function(){});logger[_0xeb18('0x62')](_0xeb18('0x96'));}}catch(_0x1a305c){logger[_0xeb18('0x51')](_0x1a305c);}}exports[_0xeb18('0x26')]=function(_0x377f24,_0x2c28a3,_0x486407){return db[_0xeb18('0x30')]['find']({'where':{'id':_0x377f24[_0xeb18('0x46')]['id']}})[_0xeb18('0x27')](handleEntityNotFound(_0x2c28a3,null))[_0xeb18('0x27')](saveUpdates(_0x377f24[_0xeb18('0x8c')],null))[_0xeb18('0x27')](respondWithResult(_0x2c28a3,null))[_0xeb18('0x49')](handleError(_0x2c28a3,null));};exports[_0xeb18('0x97')]=function(_0x563e44,_0x4e20a1,_0x3f2fd4){return db['Plugin'][_0xeb18('0x48')]({'where':{'id':_0x563e44[_0xeb18('0x46')]['id']}})[_0xeb18('0x27')](function(_0x1e1c7d){if(_0x1e1c7d){return _0x1e1c7d[_0xeb18('0x28')]();}})[_0xeb18('0x27')](function(_0x2c453a){rimraf(path['join'](config[_0xeb18('0x4c')],'server/files/plugins',path[_0xeb18('0x58')](_0x2c453a[_0xeb18('0x6')])),function(){});return _0x2c453a;})[_0xeb18('0x27')](handleEntityNotFound(_0x4e20a1,null))[_0xeb18('0x27')](respondWithStatusCode(_0x4e20a1,null))[_0xeb18('0x49')](handleError(_0x4e20a1,null));};exports['webhookGet']=function(_0x3bbc45,_0x3da2a3,_0x4c556f){return BPromise['resolve']()[_0xeb18('0x27')](function(){if(!_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x6')]){throw new Error(_0xeb18('0x98'));}if(!_0x3bbc45[_0xeb18('0x35')]['port']){throw new Error(_0xeb18('0x99'));}var _0x32d483=_0x3bbc45[_0xeb18('0x35')]['hostname']?_0x3bbc45[_0xeb18('0x35')]['hostname']+':'+_0x3bbc45['query'][_0xeb18('0x9a')]:_0xeb18('0x9b')+_0x3bbc45['query']['port'];var _0x29a8ca=_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x1d')]?_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x1d')]:!![];var _0x5252a2=_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x9c')]?_0x3bbc45[_0xeb18('0x35')]['encoding']:null;var _0xcb882a={'method':_0x3bbc45[_0xeb18('0x9d')],'uri':util['format'](_0xeb18('0x9e'),_0x32d483,_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x6')]),'json':_0x29a8ca,'resolveWithFullResponse':!![],'encoding':_0x5252a2,'qs':_0x3bbc45[_0xeb18('0x35')]};if(_0x3bbc45[_0xeb18('0x9f')]){_0xcb882a[_0xeb18('0x9f')]=_0x3bbc45[_0xeb18('0x9f')];if(_0xcb882a[_0xeb18('0x9f')]['content-length']){delete _0xcb882a[_0xeb18('0x9f')][_0xeb18('0xa0')];}}if(_0xcb882a['headers'][_0xeb18('0xa1')]){delete _0xcb882a[_0xeb18('0x9f')][_0xeb18('0xa1')];}return rp(_0xcb882a);})[_0xeb18('0x27')](function(_0x41943a){if(_0x41943a){_0x3da2a3[_0xeb18('0x21')](_0x41943a[_0xeb18('0x9f')]);logger['info'](_0x41943a[_0xeb18('0x8c')]);if(_[_0xeb18('0xa2')](_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x6')],'download')&&_0x41943a[_0xeb18('0xa3')]==0x1f4){return _0x3da2a3[_0xeb18('0x1a')](_0x41943a['statusCode']);}else{return _0x3da2a3['status'](_0x41943a[_0xeb18('0xa3')])[_0xeb18('0x2d')](_0x41943a[_0xeb18('0x8c')]);}}else{return _0x3da2a3[_0xeb18('0x1a')](0xc8);}})[_0xeb18('0x49')](handleError(_0x3da2a3,null));};exports[_0xeb18('0xa4')]=function(_0x1b9a3f,_0x251c66,_0x135d6c){return BPromise[_0xeb18('0xa5')]()[_0xeb18('0x27')](function(){if(!_0x1b9a3f[_0xeb18('0x35')]['path']){throw new Error(_0xeb18('0x98'));}if(!_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0x9a')]){throw new Error(_0xeb18('0x99'));}var _0x1c3da5=_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0xa6')]?_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0xa6')]+':'+_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0x9a')]:_0xeb18('0x9b')+_0x1b9a3f['query'][_0xeb18('0x9a')];var _0x5b1af4=_0x1b9a3f['query']['json']?_0x1b9a3f['query'][_0xeb18('0x1d')]:!![];var _0x7703e6=_0x1b9a3f['query'][_0xeb18('0x9c')]?_0x1b9a3f['query'][_0xeb18('0x9c')]:null;var _0x10a49e={'method':_0x1b9a3f[_0xeb18('0x9d')],'uri':util['format'](_0xeb18('0x9e'),_0x1c3da5,_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0x6')]),'json':_0x5b1af4,'resolveWithFullResponse':!![],'encoding':_0x7703e6,'body':_0x1b9a3f[_0xeb18('0x8c')]};if(_0x1b9a3f['headers']){_0x10a49e['headers']=_0x1b9a3f[_0xeb18('0x9f')];if(_0x10a49e['headers'][_0xeb18('0xa0')]){delete _0x10a49e['headers'][_0xeb18('0xa0')];}}if(_0x10a49e[_0xeb18('0x9f')][_0xeb18('0xa1')]){delete _0x10a49e[_0xeb18('0x9f')][_0xeb18('0xa1')];}return rp(_0x10a49e);})[_0xeb18('0x27')](function(_0x21f0da){if(_0x21f0da){_0x251c66['set'](_0x21f0da[_0xeb18('0x9f')]);logger[_0xeb18('0x62')](_0x21f0da[_0xeb18('0x8c')]);return _0x251c66[_0xeb18('0x1b')](_0x21f0da[_0xeb18('0xa3')])[_0xeb18('0x2d')](_0x21f0da[_0xeb18('0x8c')]);}else{return _0x251c66[_0xeb18('0x1a')](0xc8);}})['catch'](handleError(_0x251c66,null));}; \ No newline at end of file +var _0xf23b=['end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','index','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','name','merge','includeAll','include','Plugin','findAll','rows','catch','show','rawAttributes','options','find','download','params','path','join','root','server/files/plugins','%s.zip','warning','code','ENOENT','Sequelize','Error','pipe','dirname','basename','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','resolve','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status'];(function(_0x397cf6,_0x91543f){var _0x47f0d8=function(_0x5e1515){while(--_0x5e1515){_0x397cf6['push'](_0x397cf6['shift']());}};_0x47f0d8(++_0x91543f);}(_0xf23b,0x1d6));var _0xbf23=function(_0x181f3a,_0x43d2e6){_0x181f3a=_0x181f3a-0x0;var _0x87fd32=_0xf23b[_0x181f3a];return _0x87fd32;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf23('0x0'));var rimraf=require(_0xbf23('0x1'));var zipdir=require(_0xbf23('0x2'));var jsonpatch=require(_0xbf23('0x3'));var rp=require(_0xbf23('0x4'));var moment=require(_0xbf23('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf23('0x6'));var path=require('path');var sox=require(_0xbf23('0x7'));var csv=require(_0xbf23('0x8'));var ejs=require(_0xbf23('0x9'));var fs=require('fs');var _=require(_0xbf23('0xa'));var squel=require(_0xbf23('0xb'));var crypto=require(_0xbf23('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbf23('0xd'));var toCsv=require(_0xbf23('0x8'));var querystring=require(_0xbf23('0xe'));var Papa=require('papaparse');var extract=require(_0xbf23('0xf'));var rimraf=require(_0xbf23('0x1'));var archiver=require(_0xbf23('0x10'));var Redis=require(_0xbf23('0x11'));var authService=require(_0xbf23('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbf23('0x13'));var hardwareService=require(_0xbf23('0x14'));var logger=require('../../config/logger')(_0xbf23('0x15'));var utils=require(_0xbf23('0x16'));var config=require(_0xbf23('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbf23('0x18')](config[_0xbf23('0x19')],{'host':_0xbf23('0x1a'),'port':0x18eb});var socket=require(_0xbf23('0x1b'))(new Redis(config[_0xbf23('0x19')]));require(_0xbf23('0x1c'))['register'](socket);function respondWithStatusCode(_0x59ace3,_0x3d998a){_0x3d998a=_0x3d998a||0xcc;return function(_0xf5cc85){if(_0xf5cc85){return _0x59ace3[_0xbf23('0x1d')](_0x3d998a);}return _0x59ace3[_0xbf23('0x1e')](_0x3d998a)[_0xbf23('0x1f')]();};}function respondWithResult(_0xa92cd7,_0x3cb163){_0x3cb163=_0x3cb163||0xc8;return function(_0x496fd6){if(_0x496fd6){return _0xa92cd7[_0xbf23('0x1e')](_0x3cb163)[_0xbf23('0x20')](_0x496fd6);}};}function respondWithFilteredResult(_0x6d51ab,_0x476999){return function(_0x2336db){if(_0x2336db){var _0x5dd2b6=_0x2336db[_0xbf23('0x21')],_0x4b18b4=_0x476999['offset'],_0x476fe5=_0x476999[_0xbf23('0x22')]+_0x476999[_0xbf23('0x23')],_0x579515;if(_0x476fe5>=_0x5dd2b6){_0x476fe5=_0x5dd2b6;_0x579515=0xc8;}else{_0x579515=0xce;}_0x6d51ab['status'](_0x579515);return _0x6d51ab['set'](_0xbf23('0x24'),_0x4b18b4+'-'+_0x476fe5+'/'+_0x5dd2b6)[_0xbf23('0x20')](_0x2336db);}return null;};}function patchUpdates(_0x26fde4){return function(_0x325976){try{jsonpatch[_0xbf23('0x25')](_0x325976,_0x26fde4,!![]);}catch(_0x3ee7b4){return BPromise[_0xbf23('0x26')](_0x3ee7b4);}return _0x325976[_0xbf23('0x27')]();};}function saveUpdates(_0x48d461,_0x451e4a){return function(_0x4d4e3b){if(_0x4d4e3b){return _0x4d4e3b[_0xbf23('0x28')](_0x48d461)[_0xbf23('0x29')](function(_0x456ac1){return _0x456ac1;});}return null;};}function removeEntity(_0x5ce2e4,_0x489e8c){return function(_0x151a29){if(_0x151a29){return _0x151a29['destroy']()['then'](function(){var _0x25caa2=_0x151a29[_0xbf23('0x2a')]({'plain':!![]});var _0x3ed099='Plugins';return db[_0xbf23('0x2b')][_0xbf23('0x2c')]({'where':{'type':_0x3ed099,'resourceId':_0x25caa2['id']}})[_0xbf23('0x29')](function(){return _0x151a29;});})[_0xbf23('0x29')](function(){_0x5ce2e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ee8f,_0x4fc06d){return function(_0x50c850){if(!_0x50c850){_0x46ee8f[_0xbf23('0x1d')](0x194);}return _0x50c850;};}function handleError(_0x2b82f3,_0x1c6767){_0x1c6767=_0x1c6767||0x1f4;return function(_0x33b3eb){logger[_0xbf23('0x2d')](_0x33b3eb[_0xbf23('0x2e')]);if(_0x33b3eb['name']){delete _0x33b3eb['name'];}_0x2b82f3[_0xbf23('0x1e')](_0x1c6767)['send'](_0x33b3eb);};}exports[_0xbf23('0x2f')]=function(_0x4ecfec,_0x4fe1bc){var _0x461da8={},_0x542e77={},_0x4c4eb5={'count':0x0,'rows':[]};var _0x1bb018=_['map'](db['Plugin']['rawAttributes'],function(_0xbbace){return{'name':_0xbbace[_0xbf23('0x30')],'type':_0xbbace[_0xbf23('0x31')][_0xbf23('0x32')]};});_0x542e77[_0xbf23('0x33')]=_['map'](_0x1bb018,'name');_0x542e77['query']=_[_0xbf23('0x34')](_0x4ecfec['query']);_0x542e77[_0xbf23('0x35')]=_[_0xbf23('0x36')](_0x542e77[_0xbf23('0x33')],_0x542e77[_0xbf23('0x37')]);_0x461da8[_0xbf23('0x38')]=_[_0xbf23('0x36')](_0x542e77[_0xbf23('0x33')],qs[_0xbf23('0x39')](_0x4ecfec[_0xbf23('0x37')][_0xbf23('0x39')]));_0x461da8[_0xbf23('0x38')]=_0x461da8[_0xbf23('0x38')][_0xbf23('0x3a')]?_0x461da8[_0xbf23('0x38')]:_0x542e77[_0xbf23('0x33')];if(!_0x4ecfec[_0xbf23('0x37')]['hasOwnProperty'](_0xbf23('0x3b'))){_0x461da8[_0xbf23('0x23')]=qs[_0xbf23('0x23')](_0x4ecfec[_0xbf23('0x37')][_0xbf23('0x23')]);_0x461da8[_0xbf23('0x22')]=qs[_0xbf23('0x22')](_0x4ecfec[_0xbf23('0x37')][_0xbf23('0x22')]);}_0x461da8[_0xbf23('0x3c')]=qs[_0xbf23('0x3d')](_0x4ecfec[_0xbf23('0x37')][_0xbf23('0x3d')]);_0x461da8[_0xbf23('0x3e')]=qs[_0xbf23('0x35')](_[_0xbf23('0x3f')](_0x4ecfec['query'],_0x542e77[_0xbf23('0x35')]),_0x1bb018);if(_0x4ecfec[_0xbf23('0x37')][_0xbf23('0x40')]){_0x461da8['where']=_['merge'](_0x461da8['where'],{'$or':_[_0xbf23('0x41')](_0x1bb018,function(_0x32f63e){if(_0x32f63e[_0xbf23('0x31')]!==_0xbf23('0x42')){var _0x1de28c={};_0x1de28c[_0x32f63e[_0xbf23('0x43')]]={'$like':'%'+_0x4ecfec[_0xbf23('0x37')]['filter']+'%'};return _0x1de28c;}})});}_0x461da8=_[_0xbf23('0x44')]({},_0x461da8,_0x4ecfec['options']);var _0x2cf282={'where':_0x461da8[_0xbf23('0x3e')]};return db['Plugin']['count'](_0x2cf282)[_0xbf23('0x29')](function(_0x2059d5){_0x4c4eb5[_0xbf23('0x21')]=_0x2059d5;if(_0x4ecfec[_0xbf23('0x37')][_0xbf23('0x45')]){_0x461da8[_0xbf23('0x46')]=[{'all':!![]}];}return db[_0xbf23('0x47')][_0xbf23('0x48')](_0x461da8);})['then'](function(_0x1627b0){_0x4c4eb5[_0xbf23('0x49')]=_0x1627b0;return _0x4c4eb5;})[_0xbf23('0x29')](respondWithFilteredResult(_0x4fe1bc,_0x461da8))[_0xbf23('0x4a')](handleError(_0x4fe1bc,null));};exports[_0xbf23('0x4b')]=function(_0x691c62,_0x48b215){var _0x4d209d={'raw':!![],'where':{'id':_0x691c62['params']['id']}},_0x16086d={};_0x16086d[_0xbf23('0x33')]=_[_0xbf23('0x34')](db[_0xbf23('0x47')][_0xbf23('0x4c')]);_0x16086d['query']=_['keys'](_0x691c62['query']);_0x16086d['filters']=_[_0xbf23('0x36')](_0x16086d[_0xbf23('0x33')],_0x16086d[_0xbf23('0x37')]);_0x4d209d[_0xbf23('0x38')]=_[_0xbf23('0x36')](_0x16086d['model'],qs[_0xbf23('0x39')](_0x691c62[_0xbf23('0x37')][_0xbf23('0x39')]));_0x4d209d[_0xbf23('0x38')]=_0x4d209d['attributes'][_0xbf23('0x3a')]?_0x4d209d[_0xbf23('0x38')]:_0x16086d[_0xbf23('0x33')];if(_0x691c62['query'][_0xbf23('0x45')]){_0x4d209d[_0xbf23('0x46')]=[{'all':!![]}];}_0x4d209d=_[_0xbf23('0x44')]({},_0x4d209d,_0x691c62[_0xbf23('0x4d')]);return db[_0xbf23('0x47')][_0xbf23('0x4e')](_0x4d209d)[_0xbf23('0x29')](handleEntityNotFound(_0x48b215,null))[_0xbf23('0x29')](respondWithResult(_0x48b215,null))[_0xbf23('0x4a')](handleError(_0x48b215,null));};exports[_0xbf23('0x4f')]=function(_0x4d2a6c,_0x5651c2,_0x24637a){return db[_0xbf23('0x47')]['find']({'where':{'id':_0x4d2a6c[_0xbf23('0x50')]['id']},'attributes':['name',_0xbf23('0x51')],'raw':!![]})[_0xbf23('0x29')](handleEntityNotFound(_0x5651c2,null))[_0xbf23('0x29')](function(_0x2b2dd8){if(_0x2b2dd8){var _0x4591de=path[_0xbf23('0x52')](config[_0xbf23('0x53')],_0xbf23('0x54'),util['format'](_0xbf23('0x55'),path['basename'](_0x2b2dd8[_0xbf23('0x51')])));var _0x5b1c85=fs['createWriteStream'](_0x4591de);var _0xc92b6b=archiver('zip',{'zlib':{'level':0x9}});_0xc92b6b['on'](_0xbf23('0x56'),function(_0x51eda1){if(_0x51eda1[_0xbf23('0x57')]===_0xbf23('0x58')){logger['error'](_0x51eda1);}else{throw new db[(_0xbf23('0x59'))][(_0xbf23('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xc92b6b['on'](_0xbf23('0x2d'),function(_0x12bd52){throw new db[(_0xbf23('0x59'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xc92b6b[_0xbf23('0x5b')](_0x5b1c85);_0xc92b6b['glob']('**/*',{'cwd':path[_0xbf23('0x52')](config['root'],_0xbf23('0x54'),path[_0xbf23('0x5c')](_0x2b2dd8['path'])),'ignore':[path[_0xbf23('0x52')](path[_0xbf23('0x5d')](_0x2b2dd8[_0xbf23('0x51')]),'node_modules/**/*'),path[_0xbf23('0x52')](path[_0xbf23('0x5d')](_0x2b2dd8[_0xbf23('0x51')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x5b1c85['on'](_0xbf23('0x5e'),function(){if(!fs[_0xbf23('0x5f')](_0x4591de)){throw new db['Sequelize'][(_0xbf23('0x5a'))](_0xbf23('0x60'));}return _0x5651c2['download'](_0x4591de,util[_0xbf23('0x61')]('%s.zip',path[_0xbf23('0x5d')](_0x2b2dd8[_0xbf23('0x51')])),function(_0x2e3c2){if(_0x2e3c2){throw new db[(_0xbf23('0x59'))][(_0xbf23('0x5a'))](_0xbf23('0x62'));}fs['unlinkSync'](_0x4591de);logger[_0xbf23('0x63')]('Download\x20completed');logger[_0xbf23('0x63')](_0xbf23('0x64'));});});}return null;})[_0xbf23('0x4a')](handleError(_0x5651c2,null));};exports['upload']=function(_0x4a4048,_0x13e120,_0x52df3d){var _0x541250=path[_0xbf23('0x5d')](_0x4a4048[_0xbf23('0x65')]['filename'],path[_0xbf23('0x66')](_0x4a4048[_0xbf23('0x65')]['filename']));var _0x1fa116=path[_0xbf23('0x52')](config['root'],_0xbf23('0x54'),_0x4a4048[_0xbf23('0x65')][_0xbf23('0x67')]);var _0x37ade8=path[_0xbf23('0x52')](config[_0xbf23('0x53')],_0xbf23('0x54'),_0x541250);logger[_0xbf23('0x63')](_0xbf23('0x68'),_0x1fa116);logger[_0xbf23('0x63')](_0xbf23('0x69'),_0x37ade8);try{fs[_0xbf23('0x6a')](_0x1fa116,parseInt(_0xbf23('0x6b'),0x8));extract(_0x1fa116,{'dir':_0x37ade8},function(_0x2b6dce){if(_0x2b6dce){logger[_0xbf23('0x2d')](_0x2b6dce);handleError(_0x2b6dce,!![]);};var _0x1c182f=fs[_0xbf23('0x6c')](_0x37ade8);if(_0x1c182f[_0xbf23('0x3a')]>0x1){removeReferences(_0x1fa116,_0x37ade8);logger[_0xbf23('0x2d')]('Invalid\x20plugin\x20structure');return _0x52df3d(new Error(_0xbf23('0x6d')));}var _0x25308a=fs[_0xbf23('0x6e')](path[_0xbf23('0x52')](_0x37ade8,_0x1c182f[0x0]));if(_0x25308a[_0xbf23('0x6f')]()){removeReferences(_0x1fa116,_0x37ade8);logger['error']('Invalid\x20plugin\x20structure');return _0x52df3d(new Error('Invalid\x20plugin\x20structure'));}if(_0x25308a[_0xbf23('0x70')]()){var _0x5e1508=fs[_0xbf23('0x6c')](path[_0xbf23('0x52')](_0x37ade8,_0x1c182f[0x0]));if(_0x5e1508[_0xbf23('0x3a')]===0x0){removeReferences(_0x1fa116,_0x37ade8);logger[_0xbf23('0x2d')](_0xbf23('0x6d'));return _0x52df3d(new Error(_0xbf23('0x6d')));}var _0x1a39b6=_0x5e1508[_0xbf23('0x71')](function(_0x1387f3){return _0x1387f3===_0xbf23('0x72');});if(!_0x1a39b6){return _0x52df3d(new Error('Plugin\x20manifest\x20missing'));}var _0x4b7f7a=fs[_0xbf23('0x73')](path[_0xbf23('0x52')](_0x37ade8,_0x1c182f[0x0],_0xbf23('0x72')));var _0x2e4170=JSON[_0xbf23('0x74')](_0x4b7f7a);if(_0xbf23('0x75')==typeof _0x2e4170['name']){return _0x52df3d(new Error(_0xbf23('0x76')));}if(_0xbf23('0x75')==typeof _0x2e4170[_0xbf23('0x31')]){return _0x52df3d(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xbf23('0x75')==typeof _0x2e4170[_0xbf23('0x77')]){return _0x52df3d(new Error(_0xbf23('0x78')));}if(_0xbf23('0x75')==typeof _0x2e4170[_0xbf23('0x79')]){return _0x52df3d(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2e4170['type']===_0xbf23('0x7a')){if('undefined'==typeof _0x2e4170[_0xbf23('0x79')][_0xbf23('0x7b')]){return _0x52df3d(new Error(_0xbf23('0x7c')));}if('undefined'==typeof _0x2e4170['parameters'][_0xbf23('0x7b')][_0xbf23('0x7d')]&&_0xbf23('0x75')==typeof _0x2e4170[_0xbf23('0x79')][_0xbf23('0x7b')][_0xbf23('0x7e')]){return _0x52df3d(new Error(_0xbf23('0x7f')));}}else if(_0x2e4170[_0xbf23('0x31')]===_0xbf23('0x80')){if('undefined'==typeof _0x2e4170[_0xbf23('0x79')]['scriptName']){return _0x52df3d(new Error(_0xbf23('0x81')));}if(_0xbf23('0x75')==typeof _0x2e4170[_0xbf23('0x79')][_0xbf23('0x82')]){return _0x52df3d(new Error(_0xbf23('0x83')));}}else{return _0x52df3d(new Error(_0xbf23('0x84')));}var _0x2a93ae=_0x2e4170[_0xbf23('0x43')];var _0x4d5218=_0x2e4170[_0xbf23('0x85')];var _0x705553=_0x2e4170['type'];var _0x1c8a89=_0x2e4170['sidebar']?_0x2e4170['sidebar']:'always';var _0x4c822f=_0x2e4170[_0xbf23('0x86')]?_0x2e4170[_0xbf23('0x86')]:_0xbf23('0x87');var _0x5b73d3='';var _0x48d547='';var _0x1fedeb='';var _0x45b9a8='';var _0x34d73a=_0x2e4170['version'];if(_0x705553===_0xbf23('0x7a')){if(_0xbf23('0x75')!=typeof _0x2e4170[_0xbf23('0x79')][_0xbf23('0x7b')]['admin']){var _0x28074e=_0x2e4170[_0xbf23('0x79')][_0xbf23('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xbf23('0x88')](_0x28074e)){_0x5b73d3=path[_0xbf23('0x52')](_0xbf23('0x89'),_0x541250,_0x1c182f[0x0],_0x28074e);}else{_0x5b73d3=_0x28074e;}}else{logger[_0xbf23('0x63')](_0xbf23('0x8a'));}if('undefined'!=typeof _0x2e4170[_0xbf23('0x79')][_0xbf23('0x7b')][_0xbf23('0x7e')]){var _0x25200d=_0x2e4170[_0xbf23('0x79')]['views'][_0xbf23('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xbf23('0x88')](_0x25200d)){_0x48d547=path[_0xbf23('0x52')](_0xbf23('0x89'),_0x541250,_0x1c182f[0x0],_0x25200d);}else{_0x48d547=_0x25200d;}}else{logger[_0xbf23('0x63')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x705553==='script'){_0x1fedeb=_0x2e4170[_0xbf23('0x79')]['scriptName'];_0x45b9a8=_0x2e4170['parameters'][_0xbf23('0x82')];if('undefined'!=typeof _0x2e4170['parameters'][_0xbf23('0x7b')]){if(_0xbf23('0x75')!=typeof _0x2e4170['parameters'][_0xbf23('0x7b')][_0xbf23('0x7d')]){var _0x28074e=_0x2e4170[_0xbf23('0x79')][_0xbf23('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xbf23('0x88')](_0x28074e)){_0x5b73d3=path[_0xbf23('0x52')]('plugins',_0x541250,_0x1c182f[0x0],_0x28074e);}else{_0x5b73d3=_0x28074e;}}if(_0xbf23('0x75')!=typeof _0x2e4170[_0xbf23('0x79')]['views'][_0xbf23('0x7e')]){var _0x25200d=_0x2e4170['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x25200d)){_0x48d547=path[_0xbf23('0x52')]('plugins',_0x541250,_0x1c182f[0x0],_0x25200d);}else{_0x48d547=_0x25200d;}}}}var _0x5b6ab1={'name':_0x2a93ae,'description':_0x4d5218,'path':path[_0xbf23('0x52')](_0x541250,_0x1c182f[0x0]),'type':_0x705553,'sidebar':_0x1c8a89,'icon':_0x4c822f,'adminUrl':_0x5b73d3,'agentUrl':_0x48d547,'scriptName':_0x1fedeb,'scriptPath':_0x45b9a8,'version':_0x34d73a};removeReferences(_0x1fa116,null);return db['Plugin']['create'](_0x5b6ab1)[_0xbf23('0x29')](function(_0x42f529){var _0x3446c0={'role':_0x4a4048['body'][_0xbf23('0x8b')],'userProfileId':_0x4a4048[_0xbf23('0x8c')][_0xbf23('0x8d')]};if(!_0x3446c0)throw new Error(_0xbf23('0x8e'));if(_0x3446c0['role']===_0xbf23('0x8f')){var _0x185277=_0x42f529[_0xbf23('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0xbf23('0x4e')]({'where':{'name':_0xbf23('0x90'),'userProfileId':_0x3446c0[_0xbf23('0x8d')]},'raw':!![]})[_0xbf23('0x29')](function(_0x17b99d){if(_0x17b99d&&_0x17b99d[_0xbf23('0x91')]===0x0){return db[_0xbf23('0x2b')]['create']({'name':_0x185277['name'],'resourceId':_0x185277['id'],'type':_0x17b99d[_0xbf23('0x43')],'sectionId':_0x17b99d['id']},{})[_0xbf23('0x29')](function(){return _0x42f529;});}else{return _0x42f529;}})[_0xbf23('0x4a')](function(_0x21d429){logger[_0xbf23('0x2d')](_0xbf23('0x92'),_0x21d429);throw _0x21d429;});}return _0x42f529;})[_0xbf23('0x29')](respondWithResult(_0x13e120,null))[_0xbf23('0x4a')](handleError(_0x13e120,null));}});}catch(_0x4a8d33){_0x13e120['status'](0x1f4)[_0xbf23('0x93')](_0x4a8d33);}};function removeReferences(_0x4864a6,_0x4181d5){try{if(_0x4864a6){fs[_0xbf23('0x94')](_0x4864a6);logger[_0xbf23('0x63')](_0xbf23('0x95'));}if(_0x4181d5){rimraf(_0x4181d5,function(){});logger[_0xbf23('0x63')]('Extracted\x20folder\x20removed');}}catch(_0x32ebf4){logger['error'](_0x32ebf4);}}exports['update']=function(_0x34fcee,_0x44f251,_0x5318b4){return db[_0xbf23('0x47')][_0xbf23('0x4e')]({'where':{'id':_0x34fcee[_0xbf23('0x50')]['id']}})[_0xbf23('0x29')](handleEntityNotFound(_0x44f251,null))['then'](saveUpdates(_0x34fcee[_0xbf23('0x8c')],null))[_0xbf23('0x29')](respondWithResult(_0x44f251,null))[_0xbf23('0x4a')](handleError(_0x44f251,null));};exports[_0xbf23('0x96')]=function(_0x58111a,_0x31ef01,_0x4e71c5){return db[_0xbf23('0x47')][_0xbf23('0x4e')]({'where':{'id':_0x58111a[_0xbf23('0x50')]['id']}})[_0xbf23('0x29')](function(_0x491db3){if(_0x491db3){return _0x491db3[_0xbf23('0x2c')]();}})[_0xbf23('0x29')](function(_0x173b7e){rimraf(path[_0xbf23('0x52')](config[_0xbf23('0x53')],_0xbf23('0x54'),path[_0xbf23('0x5c')](_0x173b7e[_0xbf23('0x51')])),function(){});return _0x173b7e;})[_0xbf23('0x29')](handleEntityNotFound(_0x31ef01,null))['then'](respondWithStatusCode(_0x31ef01,null))[_0xbf23('0x4a')](handleError(_0x31ef01,null));};exports[_0xbf23('0x97')]=function(_0x2f6908,_0x483f10,_0x409411){return BPromise['resolve']()[_0xbf23('0x29')](function(){if(!_0x2f6908['query'][_0xbf23('0x51')]){throw new Error(_0xbf23('0x98'));}if(!_0x2f6908[_0xbf23('0x37')]['port']){throw new Error(_0xbf23('0x99'));}var _0x1f6656=_0x2f6908[_0xbf23('0x37')][_0xbf23('0x9a')]?_0x2f6908['query'][_0xbf23('0x9a')]+':'+_0x2f6908['query'][_0xbf23('0x9b')]:_0xbf23('0x9c')+_0x2f6908[_0xbf23('0x37')][_0xbf23('0x9b')];var _0x4aaa9e=_0x2f6908[_0xbf23('0x37')]['json']?_0x2f6908[_0xbf23('0x37')][_0xbf23('0x20')]:!![];var _0x2259bf=_0x2f6908[_0xbf23('0x37')][_0xbf23('0x9d')]?_0x2f6908[_0xbf23('0x37')][_0xbf23('0x9d')]:null;var _0x4b69ea={'method':_0x2f6908[_0xbf23('0x9e')],'uri':util[_0xbf23('0x61')](_0xbf23('0x9f'),_0x1f6656,_0x2f6908['query']['path']),'json':_0x4aaa9e,'resolveWithFullResponse':!![],'encoding':_0x2259bf,'qs':_0x2f6908[_0xbf23('0x37')]};if(_0x2f6908['headers']){_0x4b69ea[_0xbf23('0xa0')]=_0x2f6908[_0xbf23('0xa0')];if(_0x4b69ea[_0xbf23('0xa0')][_0xbf23('0xa1')]){delete _0x4b69ea['headers']['content-length'];}}if(_0x4b69ea[_0xbf23('0xa0')]['content-type']){delete _0x4b69ea[_0xbf23('0xa0')][_0xbf23('0xa2')];}return rp(_0x4b69ea);})[_0xbf23('0x29')](function(_0x244f6a){if(_0x244f6a){_0x483f10[_0xbf23('0xa3')](_0x244f6a[_0xbf23('0xa0')]);logger[_0xbf23('0x63')](_0x244f6a[_0xbf23('0x8c')]);if(_['endsWith'](_0x2f6908[_0xbf23('0x37')][_0xbf23('0x51')],_0xbf23('0x4f'))&&_0x244f6a[_0xbf23('0xa4')]==0x1f4){return _0x483f10[_0xbf23('0x1d')](_0x244f6a[_0xbf23('0xa4')]);}else{return _0x483f10['status'](_0x244f6a['statusCode'])[_0xbf23('0x93')](_0x244f6a[_0xbf23('0x8c')]);}}else{return _0x483f10['sendStatus'](0xc8);}})[_0xbf23('0x4a')](handleError(_0x483f10,null));};exports[_0xbf23('0xa5')]=function(_0x4a9375,_0x4f623e,_0x44955f){return BPromise[_0xbf23('0xa6')]()[_0xbf23('0x29')](function(){if(!_0x4a9375['query'][_0xbf23('0x51')]){throw new Error(_0xbf23('0x98'));}if(!_0x4a9375['query'][_0xbf23('0x9b')]){throw new Error(_0xbf23('0x99'));}var _0x2126c0=_0x4a9375[_0xbf23('0x37')][_0xbf23('0x9a')]?_0x4a9375[_0xbf23('0x37')][_0xbf23('0x9a')]+':'+_0x4a9375[_0xbf23('0x37')][_0xbf23('0x9b')]:_0xbf23('0x9c')+_0x4a9375[_0xbf23('0x37')][_0xbf23('0x9b')];var _0x4237e4=_0x4a9375['query'][_0xbf23('0x20')]?_0x4a9375[_0xbf23('0x37')]['json']:!![];var _0x4e13ee=_0x4a9375['query']['encoding']?_0x4a9375[_0xbf23('0x37')][_0xbf23('0x9d')]:null;var _0x2f1e37={'method':_0x4a9375['method'],'uri':util[_0xbf23('0x61')](_0xbf23('0x9f'),_0x2126c0,_0x4a9375[_0xbf23('0x37')][_0xbf23('0x51')]),'json':_0x4237e4,'resolveWithFullResponse':!![],'encoding':_0x4e13ee,'body':_0x4a9375[_0xbf23('0x8c')]};if(_0x4a9375[_0xbf23('0xa0')]){_0x2f1e37['headers']=_0x4a9375['headers'];if(_0x2f1e37['headers'][_0xbf23('0xa1')]){delete _0x2f1e37[_0xbf23('0xa0')][_0xbf23('0xa1')];}}if(_0x2f1e37[_0xbf23('0xa0')][_0xbf23('0xa2')]){delete _0x2f1e37['headers'][_0xbf23('0xa2')];}return rp(_0x2f1e37);})[_0xbf23('0x29')](function(_0x40e65d){if(_0x40e65d){_0x4f623e[_0xbf23('0xa3')](_0x40e65d[_0xbf23('0xa0')]);logger['info'](_0x40e65d[_0xbf23('0x8c')]);return _0x4f623e['status'](_0x40e65d[_0xbf23('0xa4')])[_0xbf23('0x93')](_0x40e65d[_0xbf23('0x8c')]);}else{return _0x4f623e[_0xbf23('0x1d')](0xc8);}})[_0xbf23('0x4a')](handleError(_0x4f623e,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a92889b..94a6c41 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 _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0xd781('0x0'));var Plugin=require(_0xd781('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){PluginEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);PluginEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=PluginEvents; \ No newline at end of file +var _0xb145=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3c4feb,_0x2d82b2){var _0x77a197=function(_0x5c26a4){while(--_0x5c26a4){_0x3c4feb['push'](_0x3c4feb['shift']());}};_0x77a197(++_0x2d82b2);}(_0xb145,0xa3));var _0x5b14=function(_0x4809fc,_0x311ece){_0x4809fc=_0x4809fc-0x0;var _0x5925ce=_0xb145[_0x4809fc];return _0x5925ce;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){PluginEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);PluginEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 8e5602c..bc76831 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 _0x9b24=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Plugin','plugins'];(function(_0x4c0c0d,_0x564581){var _0x21a5d3=function(_0x22b1ce){while(--_0x22b1ce){_0x4c0c0d['push'](_0x4c0c0d['shift']());}};_0x21a5d3(++_0x564581);}(_0x9b24,0x145));var _0x49b2=function(_0x58578f,_0x3fcf7c){_0x58578f=_0x58578f-0x0;var _0x1702e7=_0x9b24[_0x58578f];return _0x1702e7;};'use strict';var _=require(_0x49b2('0x0'));var util=require(_0x49b2('0x1'));var logger=require(_0x49b2('0x2'))(_0x49b2('0x3'));var moment=require(_0x49b2('0x4'));var BPromise=require(_0x49b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49b2('0x6'));var rimraf=require(_0x49b2('0x7'));var config=require(_0x49b2('0x8'));var attributes=require('./plugin.attributes');module[_0x49b2('0x9')]=function(_0x465654,_0x14a81f){return _0x465654[_0x49b2('0xa')](_0x49b2('0xb'),attributes,{'tableName':_0x49b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fd6=['../../config/logger','api','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins','lodash','util'];(function(_0x28d657,_0x28279e){var _0x3057e9=function(_0x452fbc){while(--_0x452fbc){_0x28d657['push'](_0x28d657['shift']());}};_0x3057e9(++_0x28279e);}(_0x8fd6,0x1ae));var _0x68fd=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x8fd6[_0x50aea5];return _0x4657f1;};'use strict';var _=require(_0x68fd('0x0'));var util=require(_0x68fd('0x1'));var logger=require(_0x68fd('0x2'))(_0x68fd('0x3'));var moment=require('moment');var BPromise=require(_0x68fd('0x4'));var rp=require(_0x68fd('0x5'));var fs=require('fs');var path=require(_0x68fd('0x6'));var rimraf=require(_0x68fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x68fd('0x8'));module[_0x68fd('0x9')]=function(_0x40447d,_0x2524ea){return _0x40447d[_0x68fd('0xa')]('Plugin',attributes,{'tableName':_0x68fd('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 7f8f8fc..adda8c0 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 _0xf133=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','request\x20sent','result','catch','CreatePlugin','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x321888,_0x39b754){var _0x438e7=function(_0x262aa5){while(--_0x262aa5){_0x321888['push'](_0x321888['shift']());}};_0x438e7(++_0x39b754);}(_0xf133,0xb3));var _0x3f13=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf133[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3f13('0x0'));var util=require('util');var moment=require(_0x3f13('0x1'));var BPromise=require(_0x3f13('0x2'));var rs=require(_0x3f13('0x3'));var fs=require('fs');var Redis=require(_0x3f13('0x4'));var db=require(_0x3f13('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f13('0x6'));var config=require(_0x3f13('0x7'));var jayson=require(_0x3f13('0x8'));var client=jayson[_0x3f13('0x9')][_0x3f13('0xa')]({'port':0x232a});config[_0x3f13('0xb')]=_[_0x3f13('0xc')](config[_0x3f13('0xb')],{'host':_0x3f13('0xd'),'port':0x18eb});var socket=require(_0x3f13('0xe'))(new Redis(config[_0x3f13('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x4dceda,_0xc5067e,_0x7e4501){return new BPromise(function(_0x5ac8d8,_0x3b9c29){return client['request'](_0x4dceda,_0x7e4501)[_0x3f13('0xf')](function(_0x48722a){logger[_0x3f13('0x10')]('Plugin,\x20%s,\x20%s',_0xc5067e,'request\x20sent');logger[_0x3f13('0x11')](_0x3f13('0x12'),_0xc5067e,'request\x20sent',JSON[_0x3f13('0x13')](_0x48722a));if(_0x48722a['error']){if(_0x48722a[_0x3f13('0x14')][_0x3f13('0x15')]===0x1f4){logger[_0x3f13('0x14')](_0x3f13('0x16'),_0xc5067e,_0x48722a['error'][_0x3f13('0x17')]);return _0x3b9c29(_0x48722a['error'][_0x3f13('0x17')]);}logger[_0x3f13('0x14')]('Plugin,\x20%s,\x20%s',_0xc5067e,_0x48722a[_0x3f13('0x14')][_0x3f13('0x17')]);return _0x5ac8d8(_0x48722a[_0x3f13('0x14')][_0x3f13('0x17')]);}else{logger[_0x3f13('0x10')]('Plugin,\x20%s,\x20%s',_0xc5067e,_0x3f13('0x18'));_0x5ac8d8(_0x48722a[_0x3f13('0x19')][_0x3f13('0x17')]);}})[_0x3f13('0x1a')](function(_0x18f5dc){logger['error'](_0x3f13('0x16'),_0xc5067e,_0x18f5dc);_0x3b9c29(_0x18f5dc);});});}exports[_0x3f13('0x1b')]=function(_0x1cd498){var _0x1833e9=this;return new Promise(function(_0xc5e66f,_0x3af7e2){return db['Plugin'][_0x3f13('0x1c')](_0x1cd498['body'],{'raw':_0x1cd498[_0x3f13('0x1d')]?_0x1cd498[_0x3f13('0x1d')][_0x3f13('0x1e')]===undefined?!![]:![]:!![]})[_0x3f13('0xf')](function(_0x3297eb){logger['info']('CreatePlugin',_0x1cd498);logger[_0x3f13('0x11')](_0x3f13('0x1b'),_0x1cd498,JSON[_0x3f13('0x13')](_0x3297eb));_0xc5e66f(_0x3297eb);})[_0x3f13('0x1a')](function(_0x4fdf98){logger[_0x3f13('0x14')]('CreatePlugin',_0x4fdf98[_0x3f13('0x17')],_0x1cd498);_0x3af7e2(_0x1833e9[_0x3f13('0x14')](0x1f4,_0x4fdf98[_0x3f13('0x17')]));});});}; \ No newline at end of file +var _0xc5b5=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then'];(function(_0x5641d9,_0x1de53b){var _0x1b1f89=function(_0x27b5b3){while(--_0x27b5b3){_0x5641d9['push'](_0x5641d9['shift']());}};_0x1b1f89(++_0x1de53b);}(_0xc5b5,0x15a));var _0x5c5b=function(_0xf64500,_0x410815){_0xf64500=_0xf64500-0x0;var _0x58a6e0=_0xc5b5[_0xf64500];return _0x58a6e0;};'use strict';var _=require(_0x5c5b('0x0'));var util=require(_0x5c5b('0x1'));var moment=require(_0x5c5b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c5b('0x3'));var db=require(_0x5c5b('0x4'))['db'];var utils=require(_0x5c5b('0x5'));var logger=require(_0x5c5b('0x6'))(_0x5c5b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c5b('0x8')][_0x5c5b('0x9')]({'port':0x232a});config[_0x5c5b('0xa')]=_[_0x5c5b('0xb')](config[_0x5c5b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c5b('0xc'))(new Redis(config[_0x5c5b('0xa')]));require(_0x5c5b('0xd'))[_0x5c5b('0xe')](socket);function respondWithRpcPromise(_0x553b4c,_0x1db9e4,_0x2e5780){return new BPromise(function(_0x52c4eb,_0x47a3db){return client[_0x5c5b('0xf')](_0x553b4c,_0x2e5780)[_0x5c5b('0x10')](function(_0x337fb8){logger[_0x5c5b('0x11')](_0x5c5b('0x12'),_0x1db9e4,_0x5c5b('0x13'));logger[_0x5c5b('0x14')](_0x5c5b('0x15'),_0x1db9e4,'request\x20sent',JSON[_0x5c5b('0x16')](_0x337fb8));if(_0x337fb8[_0x5c5b('0x17')]){if(_0x337fb8[_0x5c5b('0x17')][_0x5c5b('0x18')]===0x1f4){logger[_0x5c5b('0x17')]('Plugin,\x20%s,\x20%s',_0x1db9e4,_0x337fb8[_0x5c5b('0x17')][_0x5c5b('0x19')]);return _0x47a3db(_0x337fb8[_0x5c5b('0x17')][_0x5c5b('0x19')]);}logger[_0x5c5b('0x17')](_0x5c5b('0x12'),_0x1db9e4,_0x337fb8[_0x5c5b('0x17')][_0x5c5b('0x19')]);return _0x52c4eb(_0x337fb8[_0x5c5b('0x17')][_0x5c5b('0x19')]);}else{logger[_0x5c5b('0x11')](_0x5c5b('0x12'),_0x1db9e4,'request\x20sent');_0x52c4eb(_0x337fb8[_0x5c5b('0x1a')][_0x5c5b('0x19')]);}})[_0x5c5b('0x1b')](function(_0x39267b){logger['error']('Plugin,\x20%s,\x20%s',_0x1db9e4,_0x39267b);_0x47a3db(_0x39267b);});});}exports[_0x5c5b('0x1c')]=function(_0x5eb15c){var _0x5b8e00=this;return new Promise(function(_0x58729c,_0x48db72){return db[_0x5c5b('0x1d')][_0x5c5b('0x1e')](_0x5eb15c[_0x5c5b('0x1f')],{'raw':_0x5eb15c['options']?_0x5eb15c['options'][_0x5c5b('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x193d6e){logger['info'](_0x5c5b('0x1c'),_0x5eb15c);logger[_0x5c5b('0x14')]('CreatePlugin',_0x5eb15c,JSON[_0x5c5b('0x16')](_0x193d6e));_0x58729c(_0x193d6e);})[_0x5c5b('0x1b')](function(_0x994063){logger['error']('CreatePlugin',_0x994063[_0x5c5b('0x19')],_0x5eb15c);_0x48db72(_0x5b8e00['error'](0x1f4,_0x994063['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index d944999..49474c6 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 _0xd7e0=['removeListener','register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x3b8a5b,_0x238cb5){var _0x26acb5=function(_0xe0ee0b){while(--_0xe0ee0b){_0x3b8a5b['push'](_0x3b8a5b['shift']());}};_0x26acb5(++_0x238cb5);}(_0xd7e0,0xb3));var _0x0d7e=function(_0x495e65,_0x5375e4){_0x495e65=_0x495e65-0x0;var _0x518b5d=_0xd7e0[_0x495e65];return _0x518b5d;};'use strict';var PluginEvents=require(_0x0d7e('0x0'));var events=[_0x0d7e('0x1'),_0x0d7e('0x2'),_0x0d7e('0x3')];function createListener(_0x4cd800,_0x272b61){return function(_0x10956f){_0x272b61[_0x0d7e('0x4')](_0x4cd800,_0x10956f);};}function removeListener(_0x16f266,_0x4f4641){return function(){PluginEvents[_0x0d7e('0x5')](_0x16f266,_0x4f4641);};}exports[_0x0d7e('0x6')]=function(_0x287b21){for(var _0x112bd5=0x0,_0x2d0db2=events['length'];_0x112bd5<_0x2d0db2;_0x112bd5++){var _0x49581d=events[_0x112bd5];var _0x5d1084=createListener(_0x0d7e('0x7')+_0x49581d,_0x287b21);PluginEvents['on'](_0x49581d,_0x5d1084);}}; \ No newline at end of file +var _0x72f6=['remove','emit','removeListener','register','length','./plugin.events','save'];(function(_0x33b5bc,_0x46d509){var _0x382e39=function(_0x120736){while(--_0x120736){_0x33b5bc['push'](_0x33b5bc['shift']());}};_0x382e39(++_0x46d509);}(_0x72f6,0x1a9));var _0x672f=function(_0x4c9560,_0x372552){_0x4c9560=_0x4c9560-0x0;var _0x43e323=_0x72f6[_0x4c9560];return _0x43e323;};'use strict';var PluginEvents=require(_0x672f('0x0'));var events=[_0x672f('0x1'),_0x672f('0x2'),'update'];function createListener(_0x2628a9,_0x3c453b){return function(_0x17ae6c){_0x3c453b[_0x672f('0x3')](_0x2628a9,_0x17ae6c);};}function removeListener(_0x4c4261,_0x403bf0){return function(){PluginEvents[_0x672f('0x4')](_0x4c4261,_0x403bf0);};}exports[_0x672f('0x5')]=function(_0x56d5c8){for(var _0x5cdec=0x0,_0x2b7630=events[_0x672f('0x6')];_0x5cdec<_0x2b7630;_0x5cdec++){var _0xdea452=events[_0x5cdec];var _0x19c0d2=createListener('plugin:'+_0xdea452,_0x56d5c8);PluginEvents['on'](_0xdea452,_0x19c0d2);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b5b0527..18f8475 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 _0x727f=['update','delete','exports','./pm2.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x3d7c8e,_0x2c0844){var _0x35eebb=function(_0x5221b1){while(--_0x5221b1){_0x3d7c8e['push'](_0x3d7c8e['shift']());}};_0x35eebb(++_0x2c0844);}(_0x727f,0xa8));var _0xf727=function(_0x2bd9be,_0x58a38d){_0x2bd9be=_0x2bd9be-0x0;var _0x4db59e=_0x727f[_0x2bd9be];return _0x4db59e;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xf727('0x0'));router[_0xf727('0x1')]('/',auth[_0xf727('0x2')](),controller[_0xf727('0x3')]);router[_0xf727('0x1')](_0xf727('0x4'),auth['isAuthenticated'](),controller[_0xf727('0x5')]);router[_0xf727('0x6')]('/',auth[_0xf727('0x2')](),controller['create']);router[_0xf727('0x7')](_0xf727('0x4'),auth[_0xf727('0x2')](),controller[_0xf727('0x8')]);router[_0xf727('0x9')](_0xf727('0x4'),auth[_0xf727('0x2')](),controller['destroy']);module[_0xf727('0xa')]=router; \ No newline at end of file +var _0x5945=['create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x5945,0x110));var _0x5594=function(_0x37ad1c,_0x247bd6){_0x37ad1c=_0x37ad1c-0x0;var _0xedeefb=_0x5945[_0x37ad1c];return _0xedeefb;};'use strict';var express=require(_0x5594('0x0'));var router=express[_0x5594('0x1')]();var auth=require(_0x5594('0x2'));var controller=require('./pm2.controller');router[_0x5594('0x3')]('/',auth[_0x5594('0x4')](),controller[_0x5594('0x5')]);router[_0x5594('0x3')](_0x5594('0x6'),auth[_0x5594('0x4')](),controller[_0x5594('0x7')]);router['post']('/',auth[_0x5594('0x4')](),controller[_0x5594('0x8')]);router[_0x5594('0x9')]('/:id',auth[_0x5594('0x4')](),controller[_0x5594('0xa')]);router[_0x5594('0xb')](_0x5594('0x6'),auth[_0x5594('0x4')](),controller[_0x5594('0xc')]);module[_0x5594('0xd')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index c25c81f..0b54c27 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 _0x59d3=['json','error','stack','name','status','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus'];(function(_0x37c0fb,_0x4bc9fc){var _0x3fd689=function(_0x3cb043){while(--_0x3cb043){_0x37c0fb['push'](_0x37c0fb['shift']());}};_0x3fd689(++_0x4bc9fc);}(_0x59d3,0xf0));var _0x359d=function(_0xfcba78,_0x492334){_0xfcba78=_0xfcba78-0x0;var _0x1048b9=_0x59d3[_0xfcba78];return _0x1048b9;};'use strict';var _=require(_0x359d('0x0'));var pm2=require(_0x359d('0x1'));var logger=require(_0x359d('0x2'))('api');var path=require('path');var exec=require(_0x359d('0x3'))['exec'];var BPromise=require(_0x359d('0x4'));function handleEntityNotFound(_0x198f89,_0x2cbae7){return function(_0x23dbdf){if(!_0x23dbdf){_0x198f89[_0x359d('0x5')](0x194);;}return _0x23dbdf;};}function respondWithResult(_0x364a7a,_0x3d2dea){_0x3d2dea=_0x3d2dea||0xc8;return function(_0x14f6fd){if(_0x14f6fd){return _0x364a7a['status'](_0x3d2dea)[_0x359d('0x6')](_0x14f6fd);}return null;};}function handleError(_0x451a92,_0x22473e){_0x22473e=_0x22473e||0x1f4;return function(_0x260d54){logger[_0x359d('0x7')](_0x260d54[_0x359d('0x8')]);if(_0x260d54['name']){delete _0x260d54[_0x359d('0x9')];}_0x451a92[_0x359d('0xa')](_0x22473e)['send'](_0x260d54);};}function execChildProcess(){return new BPromise(function(_0x47079c,_0x44c66d){exec(_0x359d('0xb'),function(_0xfda42,_0x1f3741,_0x43f034){logger[_0x359d('0xc')](_0x1f3741);logger['info'](_0x43f034);if(_0xfda42){logger['error'](_0xfda42);return _0x44c66d(_0xfda42);}return _0x47079c(_0x1f3741);});});}exports[_0x359d('0xd')]=function(_0x433b78,_0x3731e1){return pm2[_0x359d('0xe')]()[_0x359d('0xf')](function(_0x57b5b3){if(_0x57b5b3){var _0x43533c=_[_0x359d('0x10')](_0x57b5b3,function(_0x905a48){return _0x905a48[_0x359d('0x9')]===_0x359d('0x11')||_0x905a48[_0x359d('0x9')]===_0x359d('0x12');});return{'rows':_0x43533c,'count':_0x43533c[_0x359d('0x13')]};}return null;})[_0x359d('0xf')](respondWithResult(_0x3731e1,null))[_0x359d('0x14')](handleError(_0x3731e1,null));};exports[_0x359d('0x15')]=function(_0x41a6b9,_0x253290){return pm2[_0x359d('0x16')](_0x41a6b9[_0x359d('0x17')]['id'])['then'](respondWithResult(_0x253290,null))['then'](handleEntityNotFound(_0x253290,null))[_0x359d('0x14')](handleError(_0x253290,null));};exports[_0x359d('0x18')]=function(_0x5cd14b,_0x3dd0c5){if(_0x5cd14b[_0x359d('0x19')][_0x359d('0x9')]&&_0x5cd14b[_0x359d('0x19')][_0x359d('0x1a')]){var _0x6654e1=path[_0x359d('0x1b')](__dirname,'../../files/plugins',_0x5cd14b[_0x359d('0x19')][_0x359d('0x1a')]);var _0x1b3100=process[_0x359d('0x1c')]();process[_0x359d('0x1d')](path['dirname'](_0x6654e1));return execChildProcess()['then'](function(_0x467473){process[_0x359d('0x1d')](_0x1b3100);return pm2[_0x359d('0x1e')]({'name':_0x5cd14b[_0x359d('0x19')][_0x359d('0x9')],'script':_0x6654e1});})[_0x359d('0xf')](function(_0x19f1d6){pm2['dump']();return _0x19f1d6[0x0];})[_0x359d('0xf')](respondWithResult(_0x3dd0c5,0xc9))[_0x359d('0x14')](handleError(_0x3dd0c5,null));}else{return _0x3dd0c5[_0x359d('0xa')](0x1f4)[_0x359d('0x1f')]({'message':_0x359d('0x20')});}};exports[_0x359d('0x21')]=function(_0x37179e,_0x166b0e){if(_0x37179e[_0x359d('0x19')]['id']){delete _0x37179e['body']['id'];}var _0x3ea9c1={'online':_0x359d('0x22'),'stopped':_0x359d('0x23')};if(_0x3ea9c1[_0x359d('0x24')](_0x37179e['body'][_0x359d('0xa')])){return pm2[_0x3ea9c1[_0x37179e[_0x359d('0x19')][_0x359d('0xa')]]](_0x37179e[_0x359d('0x17')]['id'])[_0x359d('0xf')](respondWithResult(_0x166b0e,0xc8))[_0x359d('0x14')](handleError(_0x166b0e,null));}else{return _0x166b0e[_0x359d('0xa')](0x1f4)['send']({'message':_0x359d('0x25')});}};exports['destroy']=function(_0x37b686,_0x1512fe){if(_0x37b686[_0x359d('0x19')]['id']){delete _0x37b686[_0x359d('0x19')]['id'];}if(_0x37b686[_0x359d('0x17')]['id']){return pm2[_0x359d('0x26')](_0x37b686[_0x359d('0x17')]['id'])['then'](function(_0x3cfdfd){pm2[_0x359d('0x27')]();return _0x3cfdfd[0x0];})[_0x359d('0xf')](respondWithResult(_0x1512fe,null))['catch'](handleError(_0x1512fe,null));}else{return _0x1512fe[_0x359d('0xa')](0x1f4)[_0x359d('0x1f')]({'message':_0x359d('0x28')});}}; \ No newline at end of file +var _0x85dc=['bluebird','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','hasOwnProperty','Unknown\x20status','destroy','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x85dc,0x18a));var _0xc85d=function(_0x488b2e,_0x418f06){_0x488b2e=_0x488b2e-0x0;var _0x247710=_0x85dc[_0x488b2e];return _0x247710;};'use strict';var _=require(_0xc85d('0x0'));var pm2=require(_0xc85d('0x1'));var logger=require(_0xc85d('0x2'))(_0xc85d('0x3'));var path=require(_0xc85d('0x4'));var exec=require(_0xc85d('0x5'))['exec'];var BPromise=require(_0xc85d('0x6'));function handleEntityNotFound(_0x1c93e8,_0x2c76d5){return function(_0xf78d7f){if(!_0xf78d7f){_0x1c93e8[_0xc85d('0x7')](0x194);;}return _0xf78d7f;};}function respondWithResult(_0x5d0f5b,_0xbc6507){_0xbc6507=_0xbc6507||0xc8;return function(_0x4e60d2){if(_0x4e60d2){return _0x5d0f5b[_0xc85d('0x8')](_0xbc6507)['json'](_0x4e60d2);}return null;};}function handleError(_0x1dadc6,_0x195f20){_0x195f20=_0x195f20||0x1f4;return function(_0xda6df4){logger[_0xc85d('0x9')](_0xda6df4['stack']);if(_0xda6df4['name']){delete _0xda6df4[_0xc85d('0xa')];}_0x1dadc6[_0xc85d('0x8')](_0x195f20)[_0xc85d('0xb')](_0xda6df4);};}function execChildProcess(){return new BPromise(function(_0x4c238a,_0x42a0df){exec(_0xc85d('0xc'),function(_0x5d56db,_0x31ae37,_0x339ff7){logger[_0xc85d('0xd')](_0x31ae37);logger[_0xc85d('0xd')](_0x339ff7);if(_0x5d56db){logger[_0xc85d('0x9')](_0x5d56db);return _0x42a0df(_0x5d56db);}return _0x4c238a(_0x31ae37);});});}exports[_0xc85d('0xe')]=function(_0x2c496a,_0x5bf6b1){return pm2[_0xc85d('0xf')]()[_0xc85d('0x10')](function(_0x4eb366){if(_0x4eb366){var _0x23debb=_[_0xc85d('0x11')](_0x4eb366,function(_0x162315){return _0x162315[_0xc85d('0xa')]===_0xc85d('0x12')||_0x162315[_0xc85d('0xa')]==='motion2';});return{'rows':_0x23debb,'count':_0x23debb[_0xc85d('0x13')]};}return null;})[_0xc85d('0x10')](respondWithResult(_0x5bf6b1,null))[_0xc85d('0x14')](handleError(_0x5bf6b1,null));};exports[_0xc85d('0x15')]=function(_0x47f015,_0x304862){return pm2[_0xc85d('0x16')](_0x47f015['params']['id'])[_0xc85d('0x10')](respondWithResult(_0x304862,null))[_0xc85d('0x10')](handleEntityNotFound(_0x304862,null))[_0xc85d('0x14')](handleError(_0x304862,null));};exports[_0xc85d('0x17')]=function(_0x6d29ef,_0x4b8401){if(_0x6d29ef[_0xc85d('0x18')][_0xc85d('0xa')]&&_0x6d29ef[_0xc85d('0x18')][_0xc85d('0x19')]){var _0x1a93c5=path[_0xc85d('0x1a')](__dirname,_0xc85d('0x1b'),_0x6d29ef['body'][_0xc85d('0x19')]);var _0x33c9ba=process[_0xc85d('0x1c')]();process[_0xc85d('0x1d')](path[_0xc85d('0x1e')](_0x1a93c5));return execChildProcess()[_0xc85d('0x10')](function(_0x19f77d){process[_0xc85d('0x1d')](_0x33c9ba);return pm2[_0xc85d('0x1f')]({'name':_0x6d29ef[_0xc85d('0x18')][_0xc85d('0xa')],'script':_0x1a93c5});})['then'](function(_0x9b8784){pm2[_0xc85d('0x20')]();return _0x9b8784[0x0];})[_0xc85d('0x10')](respondWithResult(_0x4b8401,0xc9))[_0xc85d('0x14')](handleError(_0x4b8401,null));}else{return _0x4b8401[_0xc85d('0x8')](0x1f4)[_0xc85d('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xc85d('0x21')]=function(_0x407a31,_0x4fa0d1){if(_0x407a31[_0xc85d('0x18')]['id']){delete _0x407a31[_0xc85d('0x18')]['id'];}var _0x5e9344={'online':'restart','stopped':'stop'};if(_0x5e9344[_0xc85d('0x22')](_0x407a31[_0xc85d('0x18')][_0xc85d('0x8')])){return pm2[_0x5e9344[_0x407a31[_0xc85d('0x18')]['status']]](_0x407a31['params']['id'])['then'](respondWithResult(_0x4fa0d1,0xc8))[_0xc85d('0x14')](handleError(_0x4fa0d1,null));}else{return _0x4fa0d1[_0xc85d('0x8')](0x1f4)[_0xc85d('0xb')]({'message':_0xc85d('0x23')});}};exports[_0xc85d('0x24')]=function(_0x769f21,_0x1e64d8){if(_0x769f21[_0xc85d('0x18')]['id']){delete _0x769f21['body']['id'];}if(_0x769f21[_0xc85d('0x25')]['id']){return pm2[_0xc85d('0x26')](_0x769f21[_0xc85d('0x25')]['id'])['then'](function(_0x7a4dfd){pm2[_0xc85d('0x20')]();return _0x7a4dfd[0x0];})[_0xc85d('0x10')](respondWithResult(_0x1e64d8,null))['catch'](handleError(_0x1e64d8,null));}else{return _0x1e64d8['status'](0x1f4)[_0xc85d('0xb')]({'message':_0xc85d('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4f87846..6bfb99e 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 _0x5093=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3bf34b,_0x1bef7d){var _0x2d070a=function(_0x7f6171){while(--_0x7f6171){_0x3bf34b['push'](_0x3bf34b['shift']());}};_0x2d070a(++_0x1bef7d);}(_0x5093,0xde));var _0x3509=function(_0x5b6744,_0x49c9c2){_0x5b6744=_0x5b6744-0x0;var _0x43d97a=_0x5093[_0x5b6744];return _0x43d97a;};'use strict';var multer=require(_0x3509('0x0'));var util=require(_0x3509('0x1'));var path=require(_0x3509('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3509('0x3'));var interaction=require(_0x3509('0x4'));var config=require(_0x3509('0x5'));module['exports']=router; \ No newline at end of file +var _0x1dea=['exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x2a03d5,_0x318ac3){var _0x4204e5=function(_0x53a977){while(--_0x53a977){_0x2a03d5['push'](_0x2a03d5['shift']());}};_0x4204e5(++_0x318ac3);}(_0x1dea,0x19e));var _0xa1de=function(_0x2b8362,_0x40a6d6){_0x2b8362=_0x2b8362-0x0;var _0x51c46a=_0x1dea[_0x2b8362];return _0x51c46a;};'use strict';var multer=require(_0xa1de('0x0'));var util=require(_0xa1de('0x1'));var path=require(_0xa1de('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1de('0x3'));var router=express[_0xa1de('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa1de('0x5'));var config=require('../../config/environment');module[_0xa1de('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 344b747..87477f4 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 _0x92c2=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x380f77,_0x32cb01){var _0x59bca4=function(_0x5ef98e){while(--_0x5ef98e){_0x380f77['push'](_0x380f77['shift']());}};_0x59bca4(++_0x32cb01);}(_0x92c2,0x8d));var _0x292c=function(_0x54847d,_0x1ae421){_0x54847d=_0x54847d-0x0;var _0x166562=_0x92c2[_0x54847d];return _0x166562;};'use strict';var Sequelize=require(_0x292c('0x0'));module[_0x292c('0x1')]={'state':{'type':Sequelize[_0x292c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x292c('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x292c('0x3')]},'starttime':{'type':Sequelize[_0x292c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x292c('0x3')]},'campaigntype':{'type':Sequelize[_0x292c('0x3')]},'membername':{'type':Sequelize[_0x292c('0x3')]}}; \ No newline at end of file +var _0x3490=['sequelize','INTEGER','STRING','DATE'];(function(_0x4a58b8,_0x556e21){var _0x5ebfac=function(_0x5f0b4a){while(--_0x5f0b4a){_0x4a58b8['push'](_0x4a58b8['shift']());}};_0x5ebfac(++_0x556e21);}(_0x3490,0x9c));var _0x0349=function(_0x1ddf0b,_0x19661f){_0x1ddf0b=_0x1ddf0b-0x0;var _0x80f5e0=_0x3490[_0x1ddf0b];return _0x80f5e0;};'use strict';var Sequelize=require(_0x0349('0x0'));module['exports']={'state':{'type':Sequelize[_0x0349('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0349('0x2')]},'scheduledat':{'type':Sequelize[_0x0349('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0349('0x3')]},'responsetime':{'type':Sequelize[_0x0349('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0349('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0349('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 69ed639..295fac0 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 _0x8811=['path','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','api','bluebird','request-promise'];(function(_0x3a0cad,_0x555373){var _0x525205=function(_0x58f6d0){while(--_0x58f6d0){_0x3a0cad['push'](_0x3a0cad['shift']());}};_0x525205(++_0x555373);}(_0x8811,0x1db));var _0x1881=function(_0x1127ea,_0xd1c88b){_0x1127ea=_0x1127ea-0x0;var _0x4aa481=_0x8811[_0x1127ea];return _0x4aa481;};'use strict';var _=require(_0x1881('0x0'));var util=require(_0x1881('0x1'));var logger=require('../../config/logger')(_0x1881('0x2'));var moment=require('moment');var BPromise=require(_0x1881('0x3'));var rp=require(_0x1881('0x4'));var fs=require('fs');var path=require(_0x1881('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1881('0x6'));module[_0x1881('0x7')]=function(_0x5dbf1f,_0x26c3a2){return _0x5dbf1f[_0x1881('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x1881('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11fb=['rimraf','../../config/environment','exports','define','ReportAgentPreview','../../config/logger','api','moment','request-promise','path'];(function(_0x184e76,_0x23ffe4){var _0x437e9b=function(_0x501b8c){while(--_0x501b8c){_0x184e76['push'](_0x184e76['shift']());}};_0x437e9b(++_0x23ffe4);}(_0x11fb,0x18b));var _0xb11f=function(_0x4a15ac,_0x4fe70d){_0x4a15ac=_0x4a15ac-0x0;var _0x3f5847=_0x11fb[_0x4a15ac];return _0x3f5847;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb11f('0x0'))(_0xb11f('0x1'));var moment=require(_0xb11f('0x2'));var BPromise=require('bluebird');var rp=require(_0xb11f('0x3'));var fs=require('fs');var path=require(_0xb11f('0x4'));var rimraf=require(_0xb11f('0x5'));var config=require(_0xb11f('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xb11f('0x7')]=function(_0x2b4215,_0x44e3c4){return _0x2b4215[_0xb11f('0x8')](_0xb11f('0x9'),attributes,{'tableName':'report_agent_preview','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 c61b5c2..b8893b7 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 _0x3c9a=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','debug','lodash'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x3c9a,0x103));var _0xa3c9=function(_0x1be3ba,_0x562e06){_0x1be3ba=_0x1be3ba-0x0;var _0x24bb7b=_0x3c9a[_0x1be3ba];return _0x24bb7b;};'use strict';var _=require(_0xa3c9('0x0'));var util=require(_0xa3c9('0x1'));var moment=require('moment');var BPromise=require(_0xa3c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3c9('0x3'));var db=require(_0xa3c9('0x4'))['db'];var utils=require(_0xa3c9('0x5'));var logger=require(_0xa3c9('0x6'))(_0xa3c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa3c9('0x8'));var client=jayson[_0xa3c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x111106,_0x5d00a8,_0x234ebb){return new BPromise(function(_0x54524e,_0xe5535c){return client[_0xa3c9('0xa')](_0x111106,_0x234ebb)[_0xa3c9('0xb')](function(_0x19a265){logger[_0xa3c9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d00a8,_0xa3c9('0xd'));logger['debug'](_0xa3c9('0xe'),_0x5d00a8,_0xa3c9('0xd'),JSON[_0xa3c9('0xf')](_0x19a265));if(_0x19a265['error']){if(_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x11')]===0x1f4){logger[_0xa3c9('0x10')](_0xa3c9('0x12'),_0x5d00a8,_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x13')]);return _0xe5535c(_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x13')]);}logger[_0xa3c9('0x10')](_0xa3c9('0x12'),_0x5d00a8,_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x13')]);return _0x54524e(_0x19a265['error'][_0xa3c9('0x13')]);}else{logger[_0xa3c9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d00a8,_0xa3c9('0xd'));_0x54524e(_0x19a265[_0xa3c9('0x14')][_0xa3c9('0x13')]);}})[_0xa3c9('0x15')](function(_0x395e23){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5d00a8,_0x395e23);_0xe5535c(_0x395e23);});});}exports[_0xa3c9('0x16')]=function(_0x3c2c66){var _0x2143bf=this;return new Promise(function(_0xed0eb7,_0x5db4d9){return db[_0xa3c9('0x17')]['create'](_0x3c2c66[_0xa3c9('0x18')],{'raw':_0x3c2c66['options']?_0x3c2c66['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5a85ec){logger['info']('CreateReportAgentPreview',_0x3c2c66);logger[_0xa3c9('0x19')](_0xa3c9('0x16'),_0x3c2c66,JSON[_0xa3c9('0xf')](_0x5a85ec));_0xed0eb7(_0x5a85ec);})['catch'](function(_0x434099){logger[_0xa3c9('0x10')]('CreateReportAgentPreview',_0x434099[_0xa3c9('0x13')],_0x3c2c66);_0x5db4d9(_0x2143bf[_0xa3c9('0x10')](0x1f4,_0x434099[_0xa3c9('0x13')]));});});}; \ No newline at end of file +var _0x9488=['client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ReportAgentPreview','options','raw','CreateReportAgentPreview','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3199ac,_0x320f59){var _0x33504b=function(_0x2daa48){while(--_0x2daa48){_0x3199ac['push'](_0x3199ac['shift']());}};_0x33504b(++_0x320f59);}(_0x9488,0x130));var _0x8948=function(_0x309dd7,_0x24adc3){_0x309dd7=_0x309dd7-0x0;var _0x40431e=_0x9488[_0x309dd7];return _0x40431e;};'use strict';var _=require(_0x8948('0x0'));var util=require(_0x8948('0x1'));var moment=require(_0x8948('0x2'));var BPromise=require(_0x8948('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8948('0x4'));var logger=require(_0x8948('0x5'))(_0x8948('0x6'));var config=require('../../config/environment');var jayson=require(_0x8948('0x7'));var client=jayson[_0x8948('0x8')][_0x8948('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28e8c3,_0x4d274c,_0x4d6e45){return new BPromise(function(_0x205fa6,_0x517d70){return client[_0x8948('0xa')](_0x28e8c3,_0x4d6e45)[_0x8948('0xb')](function(_0xe4cedc){logger[_0x8948('0xc')](_0x8948('0xd'),_0x4d274c,_0x8948('0xe'));logger[_0x8948('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4d274c,_0x8948('0xe'),JSON['stringify'](_0xe4cedc));if(_0xe4cedc['error']){if(_0xe4cedc[_0x8948('0x10')][_0x8948('0x11')]===0x1f4){logger['error'](_0x8948('0xd'),_0x4d274c,_0xe4cedc[_0x8948('0x10')][_0x8948('0x12')]);return _0x517d70(_0xe4cedc['error'][_0x8948('0x12')]);}logger[_0x8948('0x10')](_0x8948('0xd'),_0x4d274c,_0xe4cedc[_0x8948('0x10')]['message']);return _0x205fa6(_0xe4cedc[_0x8948('0x10')][_0x8948('0x12')]);}else{logger[_0x8948('0xc')](_0x8948('0xd'),_0x4d274c,'request\x20sent');_0x205fa6(_0xe4cedc[_0x8948('0x13')][_0x8948('0x12')]);}})[_0x8948('0x14')](function(_0x327f4b){logger['error'](_0x8948('0xd'),_0x4d274c,_0x327f4b);_0x517d70(_0x327f4b);});});}exports['CreateReportAgentPreview']=function(_0x367b2d){var _0x2261ed=this;return new Promise(function(_0x134571,_0x569e40){return db[_0x8948('0x15')]['create'](_0x367b2d['body'],{'raw':_0x367b2d[_0x8948('0x16')]?_0x367b2d[_0x8948('0x16')][_0x8948('0x17')]===undefined?!![]:![]:!![]})[_0x8948('0xb')](function(_0x4caacc){logger[_0x8948('0xc')](_0x8948('0x18'),_0x367b2d);logger[_0x8948('0xf')](_0x8948('0x18'),_0x367b2d,JSON[_0x8948('0x19')](_0x4caacc));_0x134571(_0x4caacc);})[_0x8948('0x14')](function(_0x1c964a){logger[_0x8948('0x10')](_0x8948('0x18'),_0x1c964a[_0x8948('0x12')],_0x367b2d);_0x569e40(_0x2261ed['error'](0x1f4,_0x1c964a[_0x8948('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2b9aeb3..697e97c 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 _0xaa9d=['chatQueues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xaa9d,0x168));var _0xdaa9=function(_0x51ca5d,_0x8506ef){_0x51ca5d=_0x51ca5d-0x0;var _0x4ab656=_0xaa9d[_0x51ca5d];return _0x4ab656;};'use strict';var multer=require(_0xdaa9('0x0'));var util=require(_0xdaa9('0x1'));var path=require(_0xdaa9('0x2'));var express=require(_0xdaa9('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xdaa9('0x4'));router['get'](_0xdaa9('0x5'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x7')]);router[_0xdaa9('0x8')](_0xdaa9('0x9'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0xa')]);router[_0xdaa9('0x8')](_0xdaa9('0xb'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0xc')]);router[_0xdaa9('0x8')](_0xdaa9('0xd'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0xdaa9('0xe'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0xf')]);router[_0xdaa9('0x8')](_0xdaa9('0x10'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x11')]);router[_0xdaa9('0x8')](_0xdaa9('0x12'),auth[_0xdaa9('0x6')](),controller['mailAccounts']);router['get']('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xdaa9('0x8')](_0xdaa9('0x13'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x14')]);router['get'](_0xdaa9('0x15'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0xdaa9('0x16'),auth[_0xdaa9('0x6')](),controller['faxQueues']);router[_0xdaa9('0x8')](_0xdaa9('0x17'),auth['isAuthenticated'](),controller[_0xdaa9('0x18')]);router[_0xdaa9('0x8')](_0xdaa9('0x19'),auth['isAuthenticated'](),controller[_0xdaa9('0x1a')]);router[_0xdaa9('0x8')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xdaa9('0x8')](_0xdaa9('0x1b'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x1c')]);router['get'](_0xdaa9('0x1d'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x1e')]);router[_0xdaa9('0x8')](_0xdaa9('0x1f'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x20')]);router[_0xdaa9('0x8')](_0xdaa9('0x21'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x22')]);router[_0xdaa9('0x8')](_0xdaa9('0x23'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x24')]);router[_0xdaa9('0x8')](_0xdaa9('0x25'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x26')]);router[_0xdaa9('0x27')](_0xdaa9('0x28'),auth['isAuthenticated'](),controller[_0xdaa9('0x29')]);router[_0xdaa9('0x8')](_0xdaa9('0x2a'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x2b')]);router['get'](_0xdaa9('0x2c'),auth[_0xdaa9('0x6')](),controller['trunks']);router[_0xdaa9('0x8')]('/campaigns',auth[_0xdaa9('0x6')](),controller['campaigns']);router[_0xdaa9('0x8')](_0xdaa9('0x2d'),auth[_0xdaa9('0x6')](),controller['faxAccounts']);router['get'](_0xdaa9('0x2e'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x2f')]);router[_0xdaa9('0x8')](_0xdaa9('0x30'),auth[_0xdaa9('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xdaa9('0x8')](_0xdaa9('0x31'),auth[_0xdaa9('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0xdaa9('0x8')]('/sms/queues/waitinginteractions',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x32')]);router[_0xdaa9('0x8')](_0xdaa9('0x33'),auth[_0xdaa9('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xdaa9('0x8')](_0xdaa9('0x34'),auth['isAuthenticated'](),controller[_0xdaa9('0x35')]);router['post']('/mail/queues/:id/notify',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')](_0xdaa9('0x37')));router[_0xdaa9('0x8')](_0xdaa9('0x38'),auth['isAuthenticated'](),controller[_0xdaa9('0x39')]);router[_0xdaa9('0x3a')](_0xdaa9('0x3b'),auth['isAuthenticated'](),controller['queueNotify'](_0xdaa9('0x3c')));router['get'](_0xdaa9('0x3d'),auth[_0xdaa9('0x6')](),controller['showChatQueues']);router[_0xdaa9('0x3a')]('/fax/queues/:id/notify',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')](_0xdaa9('0x3e')));router[_0xdaa9('0x8')](_0xdaa9('0x3f'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x40')]);router[_0xdaa9('0x3a')](_0xdaa9('0x41'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')](_0xdaa9('0x42')));router[_0xdaa9('0x8')](_0xdaa9('0x43'),auth[_0xdaa9('0x6')](),controller['showOpenchannelQueues']);router[_0xdaa9('0x3a')](_0xdaa9('0x44'),auth[_0xdaa9('0x6')](),controller['queueNotify'](_0xdaa9('0x45')));router[_0xdaa9('0x3a')]('/whatsapp/queues/:id/notify',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')]('whatsapp'));router[_0xdaa9('0x8')](_0xdaa9('0x46'),auth[_0xdaa9('0x6')](),controller['showSmsQueues']);router[_0xdaa9('0x8')](_0xdaa9('0x47'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x48')]);router[_0xdaa9('0x3a')](_0xdaa9('0x49'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x4a')]);module['exports']=router; \ No newline at end of file +var _0xb302=['/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xb302,0x106));var _0x2b30=function(_0x3d8067,_0x3ec5e5){_0x3d8067=_0x3d8067-0x0;var _0x14f92c=_0xb302[_0x3d8067];return _0x14f92c;};'use strict';var multer=require(_0x2b30('0x0'));var util=require(_0x2b30('0x1'));var path=require(_0x2b30('0x2'));var express=require(_0x2b30('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x2b30('0x4')](_0x2b30('0x5'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x7')]);router[_0x2b30('0x4')](_0x2b30('0x8'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x9')]);router[_0x2b30('0x4')](_0x2b30('0xa'),auth['isAuthenticated'](),controller[_0x2b30('0xb')]);router[_0x2b30('0x4')](_0x2b30('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x2b30('0x4')]('/chat/queues',auth['isAuthenticated'](),controller[_0x2b30('0xd')]);router['get'](_0x2b30('0xe'),auth[_0x2b30('0x6')](),controller['mailQueues']);router[_0x2b30('0x4')](_0x2b30('0xf'),auth[_0x2b30('0x6')](),controller['mailAccounts']);router[_0x2b30('0x4')]('/openchannel/queues',auth[_0x2b30('0x6')](),controller[_0x2b30('0x10')]);router[_0x2b30('0x4')](_0x2b30('0x11'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x12')]);router['get']('/whatsapp/queues',auth[_0x2b30('0x6')](),controller[_0x2b30('0x13')]);router[_0x2b30('0x4')](_0x2b30('0x14'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x15')]);router[_0x2b30('0x4')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x2b30('0x16')]);router[_0x2b30('0x4')](_0x2b30('0x17'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x18')]);router[_0x2b30('0x4')](_0x2b30('0x19'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x1a')]);router[_0x2b30('0x4')](_0x2b30('0x1b'),auth[_0x2b30('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x2b30('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x2b30('0x6')](),controller[_0x2b30('0x1c')]);router['get']('/voice/queues/:id',auth[_0x2b30('0x6')](),controller[_0x2b30('0x1d')]);router[_0x2b30('0x4')](_0x2b30('0x1e'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x1f')]);router[_0x2b30('0x4')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x2b30('0x20')]);router[_0x2b30('0x4')](_0x2b30('0x21'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x22')]);router['put'](_0x2b30('0x23'),auth[_0x2b30('0x6')](),controller['agentCapacity']);router[_0x2b30('0x4')](_0x2b30('0x24'),auth['isAuthenticated'](),controller['telephones']);router[_0x2b30('0x4')](_0x2b30('0x25'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x26')]);router[_0x2b30('0x4')](_0x2b30('0x27'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x28')]);router[_0x2b30('0x4')](_0x2b30('0x29'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x2a')]);router[_0x2b30('0x4')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x2b30('0x2b')]);router[_0x2b30('0x4')]('/mail/queues/waitinginteractions',auth[_0x2b30('0x6')](),controller[_0x2b30('0x2c')]);router[_0x2b30('0x4')](_0x2b30('0x2d'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x2e')]);router[_0x2b30('0x4')](_0x2b30('0x2f'),auth[_0x2b30('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0x2b30('0x4')](_0x2b30('0x30'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x31')]);router[_0x2b30('0x4')](_0x2b30('0x32'),auth['isAuthenticated'](),controller[_0x2b30('0x33')]);router[_0x2b30('0x34')]('/mail/queues/:id/notify',auth[_0x2b30('0x6')](),controller[_0x2b30('0x35')](_0x2b30('0x36')));router[_0x2b30('0x4')](_0x2b30('0x37'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x38')]);router[_0x2b30('0x34')](_0x2b30('0x39'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x35')](_0x2b30('0x3a')));router[_0x2b30('0x4')](_0x2b30('0x3b'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x3c')]);router['post'](_0x2b30('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0x2b30('0x3e')));router[_0x2b30('0x4')](_0x2b30('0x3f'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x40')]);router[_0x2b30('0x34')](_0x2b30('0x41'),auth['isAuthenticated'](),controller[_0x2b30('0x35')](_0x2b30('0x42')));router[_0x2b30('0x4')](_0x2b30('0x43'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x44')]);router[_0x2b30('0x34')](_0x2b30('0x45'),auth['isAuthenticated'](),controller[_0x2b30('0x35')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x2b30('0x35')](_0x2b30('0x46')));router[_0x2b30('0x4')](_0x2b30('0x47'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x48')]);router[_0x2b30('0x4')](_0x2b30('0x49'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x4a')]);router[_0x2b30('0x34')](_0x2b30('0x4b'),auth[_0x2b30('0x6')](),controller[_0x2b30('0x4c')]);module[_0x2b30('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1531ec2..6c0e18e 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 _0x7e46=['status','json','sendStatus','stack','isNil','find','rows','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','body','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','updateAttributes','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','MessageId','create','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch'];(function(_0x947ac6,_0x8451bd){var _0xecbb79=function(_0x2b62d2){while(--_0x2b62d2){_0x947ac6['push'](_0x947ac6['shift']());}};_0xecbb79(++_0x8451bd);}(_0x7e46,0x1d4));var _0x67e4=function(_0x424d29,_0x4d1113){_0x424d29=_0x424d29-0x0;var _0x2e3b20=_0x7e46[_0x424d29];return _0x2e3b20;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x67e4('0x0'))['db'];var logger=require(_0x67e4('0x1'))(_0x67e4('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x67e4('0x3')]['http']({'port':0x232a});var mailClient=jayson['client'][_0x67e4('0x4')]({'port':0x232b});var routingClient=jayson['client'][_0x67e4('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x30c432,_0x4b43b5,_0x41f1c1){return new BPromise(function(_0x45f95b,_0x6e1d97){var _0x621153=_0x41f1c1?_0x41f1c1:amiClient;return _0x621153[_0x67e4('0x5')](_0x30c432,_0x4b43b5)[_0x67e4('0x6')](function(_0x507590){if(_0x507590[_0x67e4('0x7')]){if(_0x507590[_0x67e4('0x7')][_0x67e4('0x8')]===0x1f4){return _0x6e1d97(_0x507590[_0x67e4('0x7')][_0x67e4('0x9')]);}return _0x45f95b(_0x507590[_0x67e4('0x7')]['message']);}else{_0x45f95b(_0x507590[_0x67e4('0xa')]);}})[_0x67e4('0xb')](function(_0x30b3c7){_0x6e1d97(_0x30b3c7);});});}function respondWithResult(_0x39a803,_0x3c89e5){_0x3c89e5=_0x3c89e5||0xc8;return function(_0x372ca9){if(_0x372ca9){return _0x39a803[_0x67e4('0xc')](_0x3c89e5)[_0x67e4('0xd')](_0x372ca9);}return _0x39a803[_0x67e4('0xe')](0x194);};}function handleError(_0x486bba,_0x28ef50){_0x28ef50=_0x28ef50||0x1f4;return function(_0x24e0b0){logger['error'](_0x24e0b0[_0x67e4('0xf')]);if(_0x24e0b0['name']){delete _0x24e0b0['name'];}_0x486bba[_0x67e4('0xc')](_0x28ef50)['send'](_0x24e0b0);};}function findById(_0x1a5e57){return function(_0x5a3298){if(!_['isNil'](_0x1a5e57)&&!_[_0x67e4('0x10')](_0x5a3298)&&!_[_0x67e4('0x10')](_0x5a3298['rows'])){return _[_0x67e4('0x11')](_0x5a3298[_0x67e4('0x12')],function(_0x53b3e4){return _0x53b3e4['id']==_0x1a5e57;});}return null;};}exports[_0x67e4('0x13')]=function(_0x40d354,_0x57d773){return respondWithRpcPromise('VoiceChannels',_0x40d354[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x57d773,null))[_0x67e4('0xb')](handleError(_0x57d773,null));};exports[_0x67e4('0x15')]=function(_0x944f4e,_0x52be57){return respondWithRpcPromise(_0x67e4('0x16'),_[_0x67e4('0x17')](_0x944f4e[_0x67e4('0x14')],_0x944f4e[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x52be57,null))[_0x67e4('0xb')](handleError(_0x52be57,null));};exports[_0x67e4('0x19')]=function(_0x435f98,_0x4dc914){return respondWithRpcPromise(_0x67e4('0x1a'),_[_0x67e4('0x17')](_0x435f98[_0x67e4('0x14')],_0x435f98[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x4dc914,null))[_0x67e4('0xb')](handleError(_0x4dc914,null));};exports['voiceQueues']=function(_0x471db6,_0x3453b9){return respondWithRpcPromise('VoiceQueues',_0x471db6[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x3453b9,null))[_0x67e4('0xb')](handleError(_0x3453b9,null));};exports[_0x67e4('0x1b')]=function(_0x2d3b90,_0x47c3a5){return respondWithRpcPromise(_0x67e4('0x1c'),_0x2d3b90[_0x67e4('0x14')])[_0x67e4('0x6')](findById(_0x2d3b90[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x47c3a5,null))[_0x67e4('0xb')](handleError(_0x47c3a5,null));};exports[_0x67e4('0x1d')]=function(_0x57bee0,_0x311ebb){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x67e4('0x17')](_0x57bee0[_0x67e4('0x14')],_0x57bee0[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x311ebb,null))[_0x67e4('0xb')](handleError(_0x311ebb,null));};exports[_0x67e4('0x1e')]=function(_0x3540bb,_0x1cef69){return respondWithRpcPromise(_0x67e4('0x1f'),_0x3540bb['query'])[_0x67e4('0x6')](respondWithResult(_0x1cef69,null))[_0x67e4('0xb')](handleError(_0x1cef69,null));};exports['voiceQueuesChannel']=function(_0x34f7f4,_0x16da62){return respondWithRpcPromise(_0x67e4('0x20'),_[_0x67e4('0x17')](_0x34f7f4['query'],_0x34f7f4[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x16da62,null))[_0x67e4('0xb')](handleError(_0x16da62,null));};exports[_0x67e4('0x21')]=function(_0x19941f,_0x2f5f3e){return respondWithRpcPromise(_0x67e4('0x22'),_[_0x67e4('0x17')](_0x19941f[_0x67e4('0x14')],_0x19941f[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x2f5f3e,null))['catch'](handleError(_0x2f5f3e,null));};exports['voiceQueuesChannelRedirect']=function(_0x370ba9,_0x4e6072){return respondWithRpcPromise(_0x67e4('0x23'),_[_0x67e4('0x17')](_0x370ba9[_0x67e4('0x14')],_0x370ba9['params']))[_0x67e4('0x6')](respondWithResult(_0x4e6072,null))['catch'](handleError(_0x4e6072,null));};exports[_0x67e4('0x24')]=function(_0x1495ae,_0x104083){return respondWithRpcPromise(_0x67e4('0x25'),_0x1495ae[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x104083,null))[_0x67e4('0xb')](handleError(_0x104083,null));};exports['outboundChannels']=function(_0x1191ba,_0x30aead){return respondWithRpcPromise(_0x67e4('0x26'),_0x1191ba['query'])[_0x67e4('0x6')](respondWithResult(_0x30aead,null))['catch'](handleError(_0x30aead,null));};exports[_0x67e4('0x27')]=function(_0xd37b56,_0x13ec6c){var _0x438c3c;return respondWithRpcPromise(_0x67e4('0x28'),_0xd37b56[_0x67e4('0x14')])[_0x67e4('0x6')](function(_0x4cea83){_0x438c3c=_0x4cea83;return respondWithRpcPromise('Agents',_0xd37b56[_0x67e4('0x14')],routingClient);})[_0x67e4('0x6')](function(_0x155915){return _[_0x67e4('0x17')]({},_0x155915,_0x438c3c);})[_0x67e4('0x6')](respondWithResult(_0x13ec6c,null))[_0x67e4('0xb')](handleError(_0x13ec6c,null));};exports['agentCapacity']=function(_0x381521,_0x3b5751){if(_0x381521[_0x67e4('0x29')]&&_0x381521[_0x67e4('0x29')]['interaction']&&_0x381521['user']&&_0x381521[_0x67e4('0x2a')][_0x67e4('0x2b')]){for(var _0x471515 in _0x381521[_0x67e4('0x29')]['interaction']){if(_0x381521[_0x67e4('0x29')]['interaction'][_0x67e4('0x2c')](_0x471515)){db[_0x67e4('0x2d')][_0x67e4('0x2e')]({'where':{'channel':_0x471515,'membername':_0x381521[_0x67e4('0x2a')]['name'],'type':_0x67e4('0x2f'),'exitAt':null,'uniqueid':_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515]&&_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515][_0x67e4('0x31')]?{'$notIn':_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515]}:{'$ne':null}}})[_0x67e4('0x6')](function(_0x334dec){var _0x1d8d72=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3fb488=0x0,_0x5a57f3=_0x334dec[_0x67e4('0x31')];_0x3fb488<_0x5a57f3;_0x3fb488+=0x1){_0x334dec[_0x3fb488][_0x67e4('0x32')]({'exitAt':_0x1d8d72});}});for(var _0x4177ba=0x0;_0x4177ba<_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515][_0x67e4('0x31')];_0x4177ba+=0x1){db['MemberReport'][_0x67e4('0x33')]({'where':{'channel':_0x471515,'membername':_0x381521[_0x67e4('0x2a')]['name'],'type':_0x67e4('0x2f'),'uniqueid':_0x381521[_0x67e4('0x29')]['interaction'][_0x471515][_0x4177ba],'exitAt':null},'defaults':{'channel':_0x471515,'membername':_0x381521[_0x67e4('0x2a')][_0x67e4('0x2b')],'interface':_['isNil'](_0x381521['user'][_0x67e4('0x34')])?util[_0x67e4('0x35')]('SIP/%s',_0x381521[_0x67e4('0x2a')]['name']):_0x381521[_0x67e4('0x2a')][_0x67e4('0x34')],'type':_0x67e4('0x2f'),'enterAt':moment()[_0x67e4('0x35')](_0x67e4('0x36')),'role':_0x67e4('0x37'),'internal':_0x381521['user'][_0x67e4('0x38')],'uniqueid':_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515][_0x4177ba]}});}}}}return respondWithRpcPromise(_0x67e4('0x39'),{'id':_0x381521[_0x67e4('0x18')]['id'],'capacity':_0x381521[_0x67e4('0x29')][_0x67e4('0x3a')]},routingClient)[_0x67e4('0x6')](respondWithResult(_0x3b5751,null))[_0x67e4('0xb')](handleError(_0x3b5751,null));};exports['telephones']=function(_0x5c01bb,_0x4f521d){return respondWithRpcPromise(_0x67e4('0x3b'),_0x5c01bb[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x4f521d,null))['catch'](handleError(_0x4f521d,null));};exports['trunks']=function(_0x4c0603,_0x1a50c5){return respondWithRpcPromise(_0x67e4('0x3c'),_0x4c0603[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x1a50c5,null))['catch'](handleError(_0x1a50c5,null));};exports[_0x67e4('0x3d')]=function(_0x58ce1f,_0x4286d6){return respondWithRpcPromise('Campaigns',_0x58ce1f[_0x67e4('0x14')])['then'](respondWithResult(_0x4286d6,null))['catch'](handleError(_0x4286d6,null));};exports[_0x67e4('0x3e')]=function(_0x2c5884,_0x1d942d){return respondWithRpcPromise(_0x67e4('0x3f'),_0x2c5884[_0x67e4('0x14')],routingClient)['then'](respondWithResult(_0x1d942d,null))[_0x67e4('0xb')](handleError(_0x1d942d,null));};exports[_0x67e4('0x40')]=function(_0x17c3fb,_0x3ea969){return respondWithRpcPromise(_0x67e4('0x3f'),_0x17c3fb[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](findById(_0x17c3fb[_0x67e4('0x18')]['id']))['then'](respondWithResult(_0x3ea969,null))[_0x67e4('0xb')](handleError(_0x3ea969,null));};exports[_0x67e4('0x41')]=function(_0x4a1d66,_0x4700f8){return respondWithRpcPromise(_0x67e4('0x42'),_0x4a1d66[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0x4700f8,null))[_0x67e4('0xb')](handleError(_0x4700f8,null));};exports[_0x67e4('0x43')]=function(_0x2b36c7,_0x3878ee){return respondWithRpcPromise(_0x67e4('0x42'),_0x2b36c7[_0x67e4('0x14')],routingClient)['then'](findById(_0x2b36c7[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x3878ee,null))[_0x67e4('0xb')](handleError(_0x3878ee,null));};exports['mailAccounts']=function(_0x1e2155,_0x35ce37){return respondWithRpcPromise(_0x67e4('0x44'),_0x1e2155[_0x67e4('0x14')],mailClient)['then'](respondWithResult(_0x35ce37,null))['catch'](handleError(_0x35ce37,null));};exports[_0x67e4('0x45')]=function(_0x899c36,_0xf339a){return respondWithRpcPromise(_0x67e4('0x46'),_0x899c36[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0xf339a,null))['catch'](handleError(_0xf339a,null));};exports[_0x67e4('0x47')]=function(_0x3b7520,_0x45c894){return respondWithRpcPromise('OpenchannelQueues',_0x3b7520[_0x67e4('0x14')],routingClient)['then'](findById(_0x3b7520[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x45c894,null))[_0x67e4('0xb')](handleError(_0x45c894,null));};exports[_0x67e4('0x48')]=function(_0x3683bb,_0x456c2d){return respondWithRpcPromise(_0x67e4('0x49'),_0x3683bb['query'],routingClient)['then'](respondWithResult(_0x456c2d,null))[_0x67e4('0xb')](handleError(_0x456c2d,null));};exports[_0x67e4('0x4a')]=function(_0x2bf8d6,_0x233e34){return respondWithRpcPromise(_0x67e4('0x49'),_0x2bf8d6[_0x67e4('0x14')],routingClient)['then'](findById(_0x2bf8d6['params']['id']))[_0x67e4('0x6')](respondWithResult(_0x233e34,null))['catch'](handleError(_0x233e34,null));};exports[_0x67e4('0x4b')]=function(_0x34e0d5,_0x269246){return respondWithRpcPromise('WhatsappQueues',_0x34e0d5[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0x269246,null))[_0x67e4('0xb')](handleError(_0x269246,null));};exports[_0x67e4('0x4c')]=function(_0x3d556c,_0xb8e0d7){return respondWithRpcPromise(_0x67e4('0x4d'),_0x3d556c['query'],routingClient)[_0x67e4('0x6')](findById(_0x3d556c[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0xb8e0d7,null))['catch'](handleError(_0xb8e0d7,null));};exports[_0x67e4('0x4e')]=function(_0x528999,_0xd9d98a){return respondWithRpcPromise(_0x67e4('0x4f'),_0x528999[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0xd9d98a,null))[_0x67e4('0xb')](handleError(_0xd9d98a,null));};exports[_0x67e4('0x50')]=function(_0x3bf9f4,_0x320bd7){return respondWithRpcPromise(_0x67e4('0x4f'),_0x3bf9f4[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](findById(_0x3bf9f4[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x320bd7,null))[_0x67e4('0xb')](handleError(_0x320bd7,null));};exports[_0x67e4('0x51')]=function(_0x12c78b,_0x15ac44){return respondWithRpcPromise(_0x67e4('0x52'),_0x12c78b['query'])[_0x67e4('0x6')](respondWithResult(_0x15ac44,null))[_0x67e4('0xb')](handleError(_0x15ac44,null));};exports['chatQueuesWaitingInteractions']=function(_0x478d55,_0x3bb2b0){return respondWithRpcPromise(_0x67e4('0x53'),_0x478d55['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x3bb2b0,null))[_0x67e4('0xb')](handleError(_0x3bb2b0,null));};exports[_0x67e4('0x54')]=function(_0xed5729,_0x350281){return respondWithRpcPromise(_0x67e4('0x55'),_0xed5729['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x350281,null))['catch'](handleError(_0x350281,null));};exports[_0x67e4('0x56')]=function(_0x58d03b,_0x120210){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58d03b['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x120210,null))['catch'](handleError(_0x120210,null));};exports[_0x67e4('0x57')]=function(_0x55949c,_0x22a19b){return respondWithRpcPromise(_0x67e4('0x58'),_0x55949c['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x22a19b,null))[_0x67e4('0xb')](handleError(_0x22a19b,null));};exports[_0x67e4('0x59')]=function(_0x2d4f66,_0x30937d){return respondWithRpcPromise(_0x67e4('0x5a'),_0x2d4f66[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0x30937d,null))[_0x67e4('0xb')](handleError(_0x30937d,null));};exports[_0x67e4('0x5b')]=function(_0x5be828,_0x1bf588){return respondWithRpcPromise(_0x67e4('0x5c'),_0x5be828[_0x67e4('0x14')],routingClient)['then'](respondWithResult(_0x1bf588,null))[_0x67e4('0xb')](handleError(_0x1bf588,null));};exports[_0x67e4('0x5d')]=function(_0x476332){return function(_0x17b662,_0x41afc6){var _0xc9aa8c,_0x206799;var _0x340ab8=_[_0x67e4('0x5e')](_0x476332);var _0x397200=_0x476332===_0x67e4('0x5f')?_0x67e4('0x60'):_0x67e4('0x61');return db[_0x340ab8+'Queue'][_0x67e4('0x62')]({'raw':!![],'where':{'id':_0x17b662[_0x67e4('0x18')]['id']}})['then'](function(_0x5eb894){if(_[_0x67e4('0x10')](_0x5eb894)){throw new Error(_0x340ab8+_0x67e4('0x63'));}_0xc9aa8c=_0x5eb894;return db[_0x340ab8+_0x67e4('0x64')]['findOne']({'where':{'id':_0x17b662[_0x67e4('0x29')]['messageId']},'include':[{'model':db[_0x340ab8+_0x67e4('0x65')],'as':_0x67e4('0x65')},{'model':db[_0x340ab8+_0x397200],'as':_0x67e4('0x61')}]});})[_0x67e4('0x6')](function(_0x3ea7f1){if(_[_0x67e4('0x10')](_0x3ea7f1)){throw new Error(_0x340ab8+_0x67e4('0x66'));}_0x206799=_0x3ea7f1;return _0x3ea7f1[_0x67e4('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x67e4('0x6')](function(){var _0x160afd={'uniqueid':_0x476332+'.'+_0x206799['id']+'.'+_0x206799['Interaction']['id'],'FromUserId':_0x17b662[_0x67e4('0x2a')]['id'],'type':_0x67e4('0x68')};_0x160afd[_0x340ab8+'MessageId']=_0x206799['id'];_0x160afd[_0x340ab8+_0x67e4('0x69')]=_0x206799[_0x67e4('0x65')]['id'];_0x160afd[_0x67e4('0x6a')+_0x340ab8+_0x397200+'Id']=_0x206799[_0x67e4('0x61')]['id'];_0x160afd['To'+_0x340ab8+_0x67e4('0x6b')]=_0xc9aa8c['id'];return db[_0x340ab8+_0x67e4('0x6c')]['create'](_0x160afd);})[_0x67e4('0x6')](function(){return respondWithRpcPromise(_0x67e4('0x6d'),{'channel':_0x476332,'interaction':_0x206799['Interaction'],'message':_0x206799,'account':_0x206799[_0x67e4('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x67e4('0x68'),'appdata':_0xc9aa8c['name']+','+(_0x206799[_0x67e4('0x61')][_0x67e4('0x6e')]||0x12c),'interval':_0x67e4('0x6f')}]},routingClient);})[_0x67e4('0x6')](respondWithResult(_0x41afc6,null))[_0x67e4('0xb')](handleError(_0x41afc6,null));};};exports[_0x67e4('0x70')]=function(_0x1786ef,_0xdd39b3){var _0x418e3f,_0x3dfb1c;if(_[_0x67e4('0x10')](_0x1786ef[_0x67e4('0x29')][_0x67e4('0x71')])){throw new Error(_0x67e4('0x72'));}var _0x23714d=_0x1786ef[_0x67e4('0x29')][_0x67e4('0x71')];var _0x5c3e44=_['capitalize'](_0x23714d);var _0x1fbcd3=_0x23714d===_0x67e4('0x5f')?_0x67e4('0x60'):_0x67e4('0x61');return db[_0x67e4('0x73')]['findOne']({'raw':!![],'where':{'id':_0x1786ef['params']['id'],'role':_0x67e4('0x37')}})[_0x67e4('0x6')](function(_0x401e2e){if(_[_0x67e4('0x10')](_0x401e2e)){throw new Error(_0x67e4('0x74'));}_0x418e3f=_0x401e2e;return db[_0x5c3e44+_0x67e4('0x64')][_0x67e4('0x62')]({'where':{'id':_0x1786ef[_0x67e4('0x29')][_0x67e4('0x75')]},'include':[{'model':db[_0x5c3e44+'Interaction'],'as':_0x67e4('0x65')},{'model':db[_0x5c3e44+_0x1fbcd3],'as':_0x67e4('0x61')}]});})['then'](function(_0x3b93e6){if(_['isNil'](_0x3b93e6)){throw new Error(_0x5c3e44+'\x20Message\x20not\x20found');}_0x3dfb1c=_0x3b93e6;return _0x3b93e6[_0x67e4('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x67e4('0x6')](function(){var _0x33f597={'uniqueid':_0x23714d+'.'+_0x3dfb1c['id']+'.'+_0x3dfb1c['Interaction']['id'],'FromUserId':_0x1786ef[_0x67e4('0x2a')]['id'],'type':'queue','ToUserId':_0x418e3f['id']};_0x33f597[_0x5c3e44+_0x67e4('0x76')]=_0x3dfb1c['id'];_0x33f597[_0x5c3e44+_0x67e4('0x69')]=_0x3dfb1c['Interaction']['id'];_0x33f597[_0x67e4('0x6a')+_0x5c3e44+_0x1fbcd3+'Id']=_0x3dfb1c[_0x67e4('0x61')]['id'];return db[_0x5c3e44+_0x67e4('0x6c')][_0x67e4('0x77')](_0x33f597);})[_0x67e4('0x6')](function(){return respondWithRpcPromise('Start',{'channel':_0x23714d,'interaction':_0x3dfb1c[_0x67e4('0x65')],'message':_0x3dfb1c,'account':_0x3dfb1c[_0x67e4('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x418e3f[_0x67e4('0x2b')]+','+(_0x3dfb1c[_0x67e4('0x61')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x67e4('0x6')](respondWithResult(_0xdd39b3,null))[_0x67e4('0xb')](handleError(_0xdd39b3,null));}; \ No newline at end of file +var _0x6988=['TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','agentTransferTimeout','bluebird','moment','lodash','util','api','jayson/promise','client','http','request','then','error','code','message','catch','json','sendStatus','name','status','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','findOne','\x20Queue\x20not\x20found','Message','update','Interaction','queue','MessageId','InteractionId'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6988,0x81));var _0x8698=function(_0x406e26,_0x445384){_0x406e26=_0x406e26-0x0;var _0x53bdd7=_0x6988[_0x406e26];return _0x53bdd7;};'use strict';var BPromise=require(_0x8698('0x0'));var moment=require(_0x8698('0x1'));var _=require(_0x8698('0x2'));var util=require(_0x8698('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8698('0x4'));var jayson=require(_0x8698('0x5'));var amiClient=jayson[_0x8698('0x6')][_0x8698('0x7')]({'port':0x232a});var mailClient=jayson['client'][_0x8698('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x8698('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x465d39,_0x2a137f,_0x170630){return new BPromise(function(_0x29af84,_0x2511c0){var _0x4bb810=_0x170630?_0x170630:amiClient;return _0x4bb810[_0x8698('0x8')](_0x465d39,_0x2a137f)[_0x8698('0x9')](function(_0x269797){if(_0x269797[_0x8698('0xa')]){if(_0x269797[_0x8698('0xa')][_0x8698('0xb')]===0x1f4){return _0x2511c0(_0x269797['error'][_0x8698('0xc')]);}return _0x29af84(_0x269797[_0x8698('0xa')][_0x8698('0xc')]);}else{_0x29af84(_0x269797['result']);}})[_0x8698('0xd')](function(_0x5abee8){_0x2511c0(_0x5abee8);});});}function respondWithResult(_0x5ba336,_0x28587c){_0x28587c=_0x28587c||0xc8;return function(_0x510f8b){if(_0x510f8b){return _0x5ba336['status'](_0x28587c)[_0x8698('0xe')](_0x510f8b);}return _0x5ba336[_0x8698('0xf')](0x194);};}function handleError(_0x246d98,_0x2b0c5f){_0x2b0c5f=_0x2b0c5f||0x1f4;return function(_0x21037d){logger['error'](_0x21037d['stack']);if(_0x21037d['name']){delete _0x21037d[_0x8698('0x10')];}_0x246d98[_0x8698('0x11')](_0x2b0c5f)['send'](_0x21037d);};}function findById(_0x48de87){return function(_0x7040fe){if(!_[_0x8698('0x12')](_0x48de87)&&!_[_0x8698('0x12')](_0x7040fe)&&!_['isNil'](_0x7040fe[_0x8698('0x13')])){return _[_0x8698('0x14')](_0x7040fe[_0x8698('0x13')],function(_0x4a1da8){return _0x4a1da8['id']==_0x48de87;});}return null;};}exports['voiceChannels']=function(_0x40a2fb,_0x4cb18e){return respondWithRpcPromise(_0x8698('0x15'),_0x40a2fb[_0x8698('0x16')])[_0x8698('0x9')](respondWithResult(_0x4cb18e,null))['catch'](handleError(_0x4cb18e,null));};exports[_0x8698('0x17')]=function(_0x20b2c7,_0x3fdc69){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x20b2c7[_0x8698('0x16')],_0x20b2c7[_0x8698('0x18')]))[_0x8698('0x9')](respondWithResult(_0x3fdc69,null))[_0x8698('0xd')](handleError(_0x3fdc69,null));};exports['voiceChannelStopMixMonitor']=function(_0x4cff8a,_0x19f93f){return respondWithRpcPromise(_0x8698('0x19'),_[_0x8698('0x1a')](_0x4cff8a[_0x8698('0x16')],_0x4cff8a[_0x8698('0x18')]))['then'](respondWithResult(_0x19f93f,null))[_0x8698('0xd')](handleError(_0x19f93f,null));};exports[_0x8698('0x1b')]=function(_0xa7c78c,_0x5d8766){return respondWithRpcPromise(_0x8698('0x1c'),_0xa7c78c['query'])[_0x8698('0x9')](respondWithResult(_0x5d8766,null))['catch'](handleError(_0x5d8766,null));};exports['showVoiceQueues']=function(_0x168dd0,_0x2fda49){return respondWithRpcPromise(_0x8698('0x1c'),_0x168dd0[_0x8698('0x16')])[_0x8698('0x9')](findById(_0x168dd0['params']['id']))[_0x8698('0x9')](respondWithResult(_0x2fda49,null))['catch'](handleError(_0x2fda49,null));};exports[_0x8698('0x1d')]=function(_0x42c5c4,_0x275c9e){return respondWithRpcPromise(_0x8698('0x1e'),_[_0x8698('0x1a')](_0x42c5c4['query'],_0x42c5c4['params']))[_0x8698('0x9')](respondWithResult(_0x275c9e,null))['catch'](handleError(_0x275c9e,null));};exports[_0x8698('0x1f')]=function(_0x4d3bf4,_0x3d26ec){return respondWithRpcPromise(_0x8698('0x20'),_0x4d3bf4[_0x8698('0x16')])[_0x8698('0x9')](respondWithResult(_0x3d26ec,null))['catch'](handleError(_0x3d26ec,null));};exports[_0x8698('0x21')]=function(_0x54a294,_0x1995b1){return respondWithRpcPromise(_0x8698('0x22'),_[_0x8698('0x1a')](_0x54a294[_0x8698('0x16')],_0x54a294[_0x8698('0x18')]))[_0x8698('0x9')](respondWithResult(_0x1995b1,null))[_0x8698('0xd')](handleError(_0x1995b1,null));};exports[_0x8698('0x23')]=function(_0x1f82eb,_0x47f9ad){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x8698('0x1a')](_0x1f82eb[_0x8698('0x16')],_0x1f82eb[_0x8698('0x18')]))['then'](respondWithResult(_0x47f9ad,null))['catch'](handleError(_0x47f9ad,null));};exports['voiceQueuesChannelRedirect']=function(_0x15ee30,_0x4f050f){return respondWithRpcPromise(_0x8698('0x24'),_[_0x8698('0x1a')](_0x15ee30['query'],_0x15ee30[_0x8698('0x18')]))['then'](respondWithResult(_0x4f050f,null))[_0x8698('0xd')](handleError(_0x4f050f,null));};exports['outbound']=function(_0x5b54ca,_0x2bfbad){return respondWithRpcPromise(_0x8698('0x25'),_0x5b54ca[_0x8698('0x16')])[_0x8698('0x9')](respondWithResult(_0x2bfbad,null))[_0x8698('0xd')](handleError(_0x2bfbad,null));};exports['outboundChannels']=function(_0x398fac,_0x4dcab2){return respondWithRpcPromise(_0x8698('0x26'),_0x398fac[_0x8698('0x16')])['then'](respondWithResult(_0x4dcab2,null))[_0x8698('0xd')](handleError(_0x4dcab2,null));};exports[_0x8698('0x27')]=function(_0x379c55,_0x5bba45){var _0x29cdd3;return respondWithRpcPromise(_0x8698('0x28'),_0x379c55[_0x8698('0x16')])['then'](function(_0x291e5a){_0x29cdd3=_0x291e5a;return respondWithRpcPromise(_0x8698('0x28'),_0x379c55['query'],routingClient);})[_0x8698('0x9')](function(_0x17a9f0){return _[_0x8698('0x1a')]({},_0x17a9f0,_0x29cdd3);})[_0x8698('0x9')](respondWithResult(_0x5bba45,null))[_0x8698('0xd')](handleError(_0x5bba45,null));};exports['agentCapacity']=function(_0x163b44,_0x42e8b9){if(_0x163b44[_0x8698('0x29')]&&_0x163b44[_0x8698('0x29')][_0x8698('0x2a')]&&_0x163b44[_0x8698('0x2b')]&&_0x163b44['user'][_0x8698('0x10')]){for(var _0x258900 in _0x163b44['body']['interaction']){if(_0x163b44[_0x8698('0x29')]['interaction'][_0x8698('0x2c')](_0x258900)){db[_0x8698('0x2d')][_0x8698('0x2e')]({'where':{'channel':_0x258900,'membername':_0x163b44[_0x8698('0x2b')][_0x8698('0x10')],'type':_0x8698('0x2f'),'exitAt':null,'uniqueid':_0x163b44[_0x8698('0x29')][_0x8698('0x2a')][_0x258900]&&_0x163b44[_0x8698('0x29')]['interaction'][_0x258900]['length']?{'$notIn':_0x163b44[_0x8698('0x29')][_0x8698('0x2a')][_0x258900]}:{'$ne':null}}})[_0x8698('0x9')](function(_0x5ce065){var _0x26200b=moment()[_0x8698('0x30')](_0x8698('0x31'));for(var _0x2bf43d=0x0,_0x217885=_0x5ce065[_0x8698('0x32')];_0x2bf43d<_0x217885;_0x2bf43d+=0x1){_0x5ce065[_0x2bf43d][_0x8698('0x33')]({'exitAt':_0x26200b});}});for(var _0xfc1c52=0x0;_0xfc1c52<_0x163b44['body'][_0x8698('0x2a')][_0x258900][_0x8698('0x32')];_0xfc1c52+=0x1){db[_0x8698('0x2d')][_0x8698('0x34')]({'where':{'channel':_0x258900,'membername':_0x163b44[_0x8698('0x2b')][_0x8698('0x10')],'type':_0x8698('0x2f'),'uniqueid':_0x163b44[_0x8698('0x29')][_0x8698('0x2a')][_0x258900][_0xfc1c52],'exitAt':null},'defaults':{'channel':_0x258900,'membername':_0x163b44[_0x8698('0x2b')][_0x8698('0x10')],'interface':_[_0x8698('0x12')](_0x163b44[_0x8698('0x2b')][_0x8698('0x35')])?util[_0x8698('0x30')](_0x8698('0x36'),_0x163b44['user']['name']):_0x163b44[_0x8698('0x2b')][_0x8698('0x35')],'type':_0x8698('0x2f'),'enterAt':moment()['format'](_0x8698('0x31')),'role':_0x8698('0x37'),'internal':_0x163b44[_0x8698('0x2b')]['internal'],'uniqueid':_0x163b44[_0x8698('0x29')][_0x8698('0x2a')][_0x258900][_0xfc1c52]}});}}}}return respondWithRpcPromise(_0x8698('0x38'),{'id':_0x163b44['params']['id'],'capacity':_0x163b44[_0x8698('0x29')][_0x8698('0x39')]},routingClient)[_0x8698('0x9')](respondWithResult(_0x42e8b9,null))[_0x8698('0xd')](handleError(_0x42e8b9,null));};exports[_0x8698('0x3a')]=function(_0x1c4ebc,_0x47cc85){return respondWithRpcPromise(_0x8698('0x3b'),_0x1c4ebc[_0x8698('0x16')])[_0x8698('0x9')](respondWithResult(_0x47cc85,null))['catch'](handleError(_0x47cc85,null));};exports[_0x8698('0x3c')]=function(_0x3a60f5,_0x4e3a90){return respondWithRpcPromise('Trunks',_0x3a60f5[_0x8698('0x16')])[_0x8698('0x9')](respondWithResult(_0x4e3a90,null))[_0x8698('0xd')](handleError(_0x4e3a90,null));};exports[_0x8698('0x3d')]=function(_0x1f2fd3,_0x3183e5){return respondWithRpcPromise(_0x8698('0x3e'),_0x1f2fd3[_0x8698('0x16')])['then'](respondWithResult(_0x3183e5,null))[_0x8698('0xd')](handleError(_0x3183e5,null));};exports[_0x8698('0x3f')]=function(_0x5bc8fe,_0x276f67){return respondWithRpcPromise('ChatQueues',_0x5bc8fe[_0x8698('0x16')],routingClient)[_0x8698('0x9')](respondWithResult(_0x276f67,null))[_0x8698('0xd')](handleError(_0x276f67,null));};exports[_0x8698('0x40')]=function(_0x13e95c,_0x208a42){return respondWithRpcPromise(_0x8698('0x41'),_0x13e95c[_0x8698('0x16')],routingClient)['then'](findById(_0x13e95c['params']['id']))['then'](respondWithResult(_0x208a42,null))[_0x8698('0xd')](handleError(_0x208a42,null));};exports[_0x8698('0x42')]=function(_0x52f56a,_0x2babc6){return respondWithRpcPromise(_0x8698('0x43'),_0x52f56a[_0x8698('0x16')],routingClient)[_0x8698('0x9')](respondWithResult(_0x2babc6,null))[_0x8698('0xd')](handleError(_0x2babc6,null));};exports['showMailQueues']=function(_0x592985,_0x4ea16f){return respondWithRpcPromise('MailQueues',_0x592985[_0x8698('0x16')],routingClient)[_0x8698('0x9')](findById(_0x592985[_0x8698('0x18')]['id']))[_0x8698('0x9')](respondWithResult(_0x4ea16f,null))[_0x8698('0xd')](handleError(_0x4ea16f,null));};exports['mailAccounts']=function(_0x5cabf2,_0xc7a5a8){return respondWithRpcPromise(_0x8698('0x44'),_0x5cabf2[_0x8698('0x16')],mailClient)[_0x8698('0x9')](respondWithResult(_0xc7a5a8,null))[_0x8698('0xd')](handleError(_0xc7a5a8,null));};exports[_0x8698('0x45')]=function(_0x123fce,_0x5ca14c){return respondWithRpcPromise(_0x8698('0x46'),_0x123fce[_0x8698('0x16')],routingClient)[_0x8698('0x9')](respondWithResult(_0x5ca14c,null))[_0x8698('0xd')](handleError(_0x5ca14c,null));};exports['showOpenchannelQueues']=function(_0x5237b2,_0x544232){return respondWithRpcPromise('OpenchannelQueues',_0x5237b2[_0x8698('0x16')],routingClient)[_0x8698('0x9')](findById(_0x5237b2['params']['id']))[_0x8698('0x9')](respondWithResult(_0x544232,null))[_0x8698('0xd')](handleError(_0x544232,null));};exports[_0x8698('0x47')]=function(_0x9171dd,_0x2a5159){return respondWithRpcPromise(_0x8698('0x48'),_0x9171dd['query'],routingClient)[_0x8698('0x9')](respondWithResult(_0x2a5159,null))[_0x8698('0xd')](handleError(_0x2a5159,null));};exports[_0x8698('0x49')]=function(_0xadfff4,_0x2d8111){return respondWithRpcPromise('SmsQueues',_0xadfff4['query'],routingClient)[_0x8698('0x9')](findById(_0xadfff4['params']['id']))[_0x8698('0x9')](respondWithResult(_0x2d8111,null))['catch'](handleError(_0x2d8111,null));};exports['whatsappQueues']=function(_0x3db2bb,_0x56e009){return respondWithRpcPromise('WhatsappQueues',_0x3db2bb[_0x8698('0x16')],routingClient)[_0x8698('0x9')](respondWithResult(_0x56e009,null))[_0x8698('0xd')](handleError(_0x56e009,null));};exports[_0x8698('0x4a')]=function(_0x2fbc86,_0x31795f){return respondWithRpcPromise(_0x8698('0x4b'),_0x2fbc86[_0x8698('0x16')],routingClient)['then'](findById(_0x2fbc86[_0x8698('0x18')]['id']))[_0x8698('0x9')](respondWithResult(_0x31795f,null))[_0x8698('0xd')](handleError(_0x31795f,null));};exports[_0x8698('0x4c')]=function(_0x301e89,_0x5da344){return respondWithRpcPromise(_0x8698('0x4d'),_0x301e89[_0x8698('0x16')],routingClient)['then'](respondWithResult(_0x5da344,null))['catch'](handleError(_0x5da344,null));};exports['showFaxQueues']=function(_0x546f39,_0xf4f511){return respondWithRpcPromise(_0x8698('0x4d'),_0x546f39[_0x8698('0x16')],routingClient)[_0x8698('0x9')](findById(_0x546f39[_0x8698('0x18')]['id']))['then'](respondWithResult(_0xf4f511,null))[_0x8698('0xd')](handleError(_0xf4f511,null));};exports[_0x8698('0x4e')]=function(_0x577bbd,_0x396896){return respondWithRpcPromise(_0x8698('0x4f'),_0x577bbd[_0x8698('0x16')])[_0x8698('0x9')](respondWithResult(_0x396896,null))[_0x8698('0xd')](handleError(_0x396896,null));};exports[_0x8698('0x50')]=function(_0x5777f5,_0x2928ae){return respondWithRpcPromise(_0x8698('0x51'),_0x5777f5['query'],routingClient)[_0x8698('0x9')](respondWithResult(_0x2928ae,null))[_0x8698('0xd')](handleError(_0x2928ae,null));};exports[_0x8698('0x52')]=function(_0x1a9008,_0x2997f0){return respondWithRpcPromise(_0x8698('0x53'),_0x1a9008[_0x8698('0x16')],routingClient)[_0x8698('0x9')](respondWithResult(_0x2997f0,null))[_0x8698('0xd')](handleError(_0x2997f0,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x25cd8d,_0x2b4ca1){return respondWithRpcPromise(_0x8698('0x54'),_0x25cd8d[_0x8698('0x16')],routingClient)[_0x8698('0x9')](respondWithResult(_0x2b4ca1,null))[_0x8698('0xd')](handleError(_0x2b4ca1,null));};exports[_0x8698('0x55')]=function(_0x2f4906,_0x1af35e){return respondWithRpcPromise(_0x8698('0x56'),_0x2f4906['query'],routingClient)[_0x8698('0x9')](respondWithResult(_0x1af35e,null))[_0x8698('0xd')](handleError(_0x1af35e,null));};exports[_0x8698('0x57')]=function(_0x17e5ed,_0x175274){return respondWithRpcPromise(_0x8698('0x58'),_0x17e5ed[_0x8698('0x16')],routingClient)['then'](respondWithResult(_0x175274,null))[_0x8698('0xd')](handleError(_0x175274,null));};exports[_0x8698('0x59')]=function(_0xe48cc1,_0x4a84ad){return respondWithRpcPromise(_0x8698('0x5a'),_0xe48cc1['query'],routingClient)[_0x8698('0x9')](respondWithResult(_0x4a84ad,null))[_0x8698('0xd')](handleError(_0x4a84ad,null));};exports[_0x8698('0x5b')]=function(_0x5345fd){return function(_0xe4a874,_0x38735b){var _0x1bcf00,_0x18acc7;var _0x1dcb9a=_[_0x8698('0x5c')](_0x5345fd);var _0x4f1194=_0x5345fd==='chat'?_0x8698('0x5d'):_0x8698('0x5e');return db[_0x1dcb9a+'Queue'][_0x8698('0x5f')]({'raw':!![],'where':{'id':_0xe4a874[_0x8698('0x18')]['id']}})['then'](function(_0x3d538b){if(_['isNil'](_0x3d538b)){throw new Error(_0x1dcb9a+_0x8698('0x60'));}_0x1bcf00=_0x3d538b;return db[_0x1dcb9a+_0x8698('0x61')][_0x8698('0x5f')]({'where':{'id':_0xe4a874['body']['messageId']},'include':[{'model':db[_0x1dcb9a+'Interaction'],'as':'Interaction'},{'model':db[_0x1dcb9a+_0x4f1194],'as':'Account'}]});})[_0x8698('0x9')](function(_0x4b6ca2){if(_['isNil'](_0x4b6ca2)){throw new Error(_0x1dcb9a+'\x20Message\x20not\x20found');}_0x18acc7=_0x4b6ca2;return _0x4b6ca2[_0x8698('0x62')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8698('0x9')](function(){var _0x579463={'uniqueid':_0x5345fd+'.'+_0x18acc7['id']+'.'+_0x18acc7[_0x8698('0x63')]['id'],'FromUserId':_0xe4a874[_0x8698('0x2b')]['id'],'type':_0x8698('0x64')};_0x579463[_0x1dcb9a+_0x8698('0x65')]=_0x18acc7['id'];_0x579463[_0x1dcb9a+_0x8698('0x66')]=_0x18acc7[_0x8698('0x63')]['id'];_0x579463['From'+_0x1dcb9a+_0x4f1194+'Id']=_0x18acc7[_0x8698('0x5e')]['id'];_0x579463['To'+_0x1dcb9a+'QueueId']=_0x1bcf00['id'];return db[_0x1dcb9a+_0x8698('0x67')]['create'](_0x579463);})['then'](function(){return respondWithRpcPromise(_0x8698('0x68'),{'channel':_0x5345fd,'interaction':_0x18acc7[_0x8698('0x63')],'message':_0x18acc7,'account':_0x18acc7[_0x8698('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8698('0x64'),'appdata':_0x1bcf00['name']+','+(_0x18acc7['Account'][_0x8698('0x69')]||0x12c),'interval':_0x8698('0x6a')}]},routingClient);})[_0x8698('0x9')](respondWithResult(_0x38735b,null))[_0x8698('0xd')](handleError(_0x38735b,null));};};exports[_0x8698('0x6b')]=function(_0x4bb35f,_0x5b2e0b){var _0x3df9b0,_0x5c65e2;if(_[_0x8698('0x12')](_0x4bb35f[_0x8698('0x29')][_0x8698('0x6c')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x303a29=_0x4bb35f[_0x8698('0x29')]['channel'];var _0x2e5fd6=_[_0x8698('0x5c')](_0x303a29);var _0x33f24e=_0x303a29==='chat'?_0x8698('0x5d'):_0x8698('0x5e');return db[_0x8698('0x6d')][_0x8698('0x5f')]({'raw':!![],'where':{'id':_0x4bb35f[_0x8698('0x18')]['id'],'role':_0x8698('0x37')}})[_0x8698('0x9')](function(_0x32963e){if(_['isNil'](_0x32963e)){throw new Error(_0x8698('0x6e'));}_0x3df9b0=_0x32963e;return db[_0x2e5fd6+_0x8698('0x61')][_0x8698('0x5f')]({'where':{'id':_0x4bb35f[_0x8698('0x29')][_0x8698('0x6f')]},'include':[{'model':db[_0x2e5fd6+'Interaction'],'as':_0x8698('0x63')},{'model':db[_0x2e5fd6+_0x33f24e],'as':_0x8698('0x5e')}]});})[_0x8698('0x9')](function(_0xcb7d71){if(_[_0x8698('0x12')](_0xcb7d71)){throw new Error(_0x2e5fd6+_0x8698('0x70'));}_0x5c65e2=_0xcb7d71;return _0xcb7d71[_0x8698('0x62')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x23f40c={'uniqueid':_0x303a29+'.'+_0x5c65e2['id']+'.'+_0x5c65e2[_0x8698('0x63')]['id'],'FromUserId':_0x4bb35f[_0x8698('0x2b')]['id'],'type':'queue','ToUserId':_0x3df9b0['id']};_0x23f40c[_0x2e5fd6+_0x8698('0x65')]=_0x5c65e2['id'];_0x23f40c[_0x2e5fd6+_0x8698('0x66')]=_0x5c65e2[_0x8698('0x63')]['id'];_0x23f40c[_0x8698('0x71')+_0x2e5fd6+_0x33f24e+'Id']=_0x5c65e2[_0x8698('0x5e')]['id'];return db[_0x2e5fd6+'TransferReport'][_0x8698('0x72')](_0x23f40c);})[_0x8698('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x303a29,'interaction':_0x5c65e2[_0x8698('0x63')],'message':_0x5c65e2,'account':_0x5c65e2[_0x8698('0x5e')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3df9b0['name']+','+(_0x5c65e2['Account'][_0x8698('0x73')]||0x12c),'interval':_0x8698('0x6a')}]},routingClient);})[_0x8698('0x9')](respondWithResult(_0x5b2e0b,null))[_0x8698('0xd')](handleError(_0x5b2e0b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 99de8e2..759ef24 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 _0x67a0=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run','post','put','update','delete'];(function(_0x4d502e,_0x950daa){var _0x45eac8=function(_0x535d62){while(--_0x535d62){_0x4d502e['push'](_0x4d502e['shift']());}};_0x45eac8(++_0x950daa);}(_0x67a0,0x1a0));var _0x067a=function(_0xf41ba7,_0x5d943f){_0xf41ba7=_0xf41ba7-0x0;var _0x3d6d97=_0x67a0[_0xf41ba7];return _0x3d6d97;};'use strict';var multer=require(_0x067a('0x0'));var util=require(_0x067a('0x1'));var path=require('path');var timeout=require(_0x067a('0x2'));var express=require(_0x067a('0x3'));var router=express[_0x067a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x067a('0x5'));var config=require(_0x067a('0x6'));var controller=require('./schedule.controller');router[_0x067a('0x7')]('/',auth[_0x067a('0x8')](),controller[_0x067a('0x9')]);router[_0x067a('0x7')](_0x067a('0xa'),auth[_0x067a('0x8')](),controller['show']);router[_0x067a('0x7')](_0x067a('0xb'),auth[_0x067a('0x8')](),controller['run']);router[_0x067a('0xc')]('/',auth[_0x067a('0x8')](),controller['create']);router[_0x067a('0xd')](_0x067a('0xa'),auth['isAuthenticated'](),controller[_0x067a('0xe')]);router[_0x067a('0xf')](_0x067a('0xa'),auth['isAuthenticated'](),controller[_0x067a('0x10')]);module[_0x067a('0x11')]=router; \ No newline at end of file +var _0x51ae=['../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','run','post','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x319fe0,_0xdaeae6){var _0x52d6ca=function(_0x388304){while(--_0x388304){_0x319fe0['push'](_0x319fe0['shift']());}};_0x52d6ca(++_0xdaeae6);}(_0x51ae,0x8b));var _0xe51a=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x51ae[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0xe51a('0x0'));var util=require(_0xe51a('0x1'));var path=require('path');var timeout=require(_0xe51a('0x2'));var express=require('express');var router=express[_0xe51a('0x3')]();var auth=require(_0xe51a('0x4'));var interaction=require(_0xe51a('0x5'));var config=require(_0xe51a('0x6'));var controller=require(_0xe51a('0x7'));router[_0xe51a('0x8')]('/',auth[_0xe51a('0x9')](),controller[_0xe51a('0xa')]);router['get']('/:id',auth[_0xe51a('0x9')](),controller[_0xe51a('0xb')]);router[_0xe51a('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xe51a('0xc')]);router[_0xe51a('0xd')]('/',auth[_0xe51a('0x9')](),controller['create']);router['put'](_0xe51a('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe51a('0xf')](_0xe51a('0xe'),auth['isAuthenticated'](),controller[_0xe51a('0x10')]);module[_0xe51a('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 5864ffe..b9d8103 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 _0x44ff=['TEXT','exports','STRING','DATE','INTEGER','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','ENUM','custom','default','BOOLEAN'];(function(_0x36cc88,_0x5d3b0e){var _0x1faf9a=function(_0x15819e){while(--_0x15819e){_0x36cc88['push'](_0x36cc88['shift']());}};_0x1faf9a(++_0x5d3b0e);}(_0x44ff,0x1c3));var _0xf44f=function(_0x547427,_0x2d569c){_0x547427=_0x547427-0x0;var _0x381bbc=_0x44ff[_0x547427];return _0x381bbc;};'use strict';var Sequelize=require('sequelize');module[_0xf44f('0x0')]={'name':{'type':Sequelize[_0xf44f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf44f('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xf44f('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf44f('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xf44f('0x4'),_0xf44f('0x5'),_0xf44f('0x6'),'days',_0xf44f('0x7'),_0xf44f('0x8')),'allowNull':![],'defaultValue':_0xf44f('0x9')},'output':{'type':Sequelize['ENUM'](_0xf44f('0xa'),_0xf44f('0xb'),_0xf44f('0xc')),'allowNull':![],'defaultValue':_0xf44f('0xa')},'type':{'type':Sequelize[_0xf44f('0xd')](_0xf44f('0xe'),_0xf44f('0xf')),'allowNull':![],'defaultValue':_0xf44f('0xe')},'sendMail':{'type':Sequelize[_0xf44f('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xf44f('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xf44f('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xf44f('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9f02=['BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','weeks','days','csv','pdf','xlsx','custom','TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9f02,0x68));var _0x29f0=function(_0x56a98b,_0x13d95f){_0x56a98b=_0x56a98b-0x0;var _0x59cc4c=_0x9f02[_0x56a98b];return _0x59cc4c;};'use strict';var Sequelize=require(_0x29f0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x29f0('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x29f0('0x2')],'allowNull':![],'defaultValue':_0x29f0('0x3')},'startAt':{'type':Sequelize[_0x29f0('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x29f0('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x29f0('0x5')]('years',_0x29f0('0x6'),_0x29f0('0x7'),_0x29f0('0x8'),'days','hours','minutes'),'allowNull':![],'defaultValue':_0x29f0('0x9')},'output':{'type':Sequelize['ENUM'](_0x29f0('0xa'),_0x29f0('0xb'),_0x29f0('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x29f0('0xd'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x29f0('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x29f0('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 381a348..8a5452f 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 _0xf3d4=['body','user','get','role','autoAssociation','params','run','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf3d4,0x1db));var _0x4f3d=function(_0x4913f9,_0x37e9f8){_0x4913f9=_0x4913f9-0x0;var _0xc1e224=_0xf3d4[_0x4913f9];return _0xc1e224;};'use strict';var pdf=require(_0x4f3d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f3d('0x1'));var jsonpatch=require(_0x4f3d('0x2'));var rp=require(_0x4f3d('0x3'));var moment=require(_0x4f3d('0x4'));var BPromise=require(_0x4f3d('0x5'));var Mustache=require(_0x4f3d('0x6'));var util=require(_0x4f3d('0x7'));var path=require(_0x4f3d('0x8'));var sox=require(_0x4f3d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f3d('0xa'));var squel=require(_0x4f3d('0xb'));var crypto=require(_0x4f3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4f3d('0xd'));var toCsv=require(_0x4f3d('0xe'));var querystring=require('querystring');var Papa=require(_0x4f3d('0xf'));var Redis=require('ioredis');var authService=require(_0x4f3d('0x10'));var qs=require(_0x4f3d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4f3d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4f3d('0x13'))['db'];function respondWithStatusCode(_0xdd01b5,_0x216e5e){_0x216e5e=_0x216e5e||0xcc;return function(_0x2a36e6){if(_0x2a36e6){return _0xdd01b5[_0x4f3d('0x14')](_0x216e5e);}return _0xdd01b5[_0x4f3d('0x15')](_0x216e5e)[_0x4f3d('0x16')]();};}function respondWithResult(_0x55b4bc,_0xbea1af){_0xbea1af=_0xbea1af||0xc8;return function(_0x4c87b2){if(_0x4c87b2){return _0x55b4bc[_0x4f3d('0x15')](_0xbea1af)[_0x4f3d('0x17')](_0x4c87b2);}};}function respondWithFilteredResult(_0x46b953,_0x16d0fd){return function(_0x1f0e39){if(_0x1f0e39){var _0x4c6007=_0x1f0e39[_0x4f3d('0x18')],_0x5f4fb9=_0x16d0fd[_0x4f3d('0x19')],_0x36021c=_0x16d0fd[_0x4f3d('0x19')]+_0x16d0fd[_0x4f3d('0x1a')],_0x98f683;if(_0x36021c>=_0x4c6007){_0x36021c=_0x4c6007;_0x98f683=0xc8;}else{_0x98f683=0xce;}_0x46b953[_0x4f3d('0x15')](_0x98f683);return _0x46b953[_0x4f3d('0x1b')](_0x4f3d('0x1c'),_0x5f4fb9+'-'+_0x36021c+'/'+_0x4c6007)[_0x4f3d('0x17')](_0x1f0e39);}return null;};}function patchUpdates(_0x31669c){return function(_0x4d0214){try{jsonpatch[_0x4f3d('0x1d')](_0x4d0214,_0x31669c,!![]);}catch(_0x4212f9){return BPromise[_0x4f3d('0x1e')](_0x4212f9);}return _0x4d0214[_0x4f3d('0x1f')]();};}function saveUpdates(_0x4182b4,_0xb962d2){return function(_0x1675eb){if(_0x1675eb){return _0x1675eb[_0x4f3d('0x20')](_0x4182b4)[_0x4f3d('0x21')](function(_0x1c756d){return _0x1c756d;});}return null;};}function removeEntity(_0x5afc1c,_0x4c9d49){return function(_0x257f21){if(_0x257f21){return _0x257f21[_0x4f3d('0x22')]()[_0x4f3d('0x21')](function(){var _0x5aa3c8=_0x257f21['get']({'plain':!![]});var _0x1d4c16=_0x4f3d('0x23');return db[_0x4f3d('0x24')][_0x4f3d('0x22')]({'where':{'type':_0x1d4c16,'resourceId':_0x5aa3c8['id']}})[_0x4f3d('0x21')](function(){return _0x257f21;});})['then'](function(){_0x5afc1c[_0x4f3d('0x15')](0xcc)[_0x4f3d('0x16')]();});}};}function handleEntityNotFound(_0x1347bf,_0x3822de){return function(_0x1c434b){if(!_0x1c434b){_0x1347bf[_0x4f3d('0x14')](0x194);}return _0x1c434b;};}function handleError(_0x31a4a5,_0x16ba3a){_0x16ba3a=_0x16ba3a||0x1f4;return function(_0x238964){logger[_0x4f3d('0x25')](_0x238964['stack']);if(_0x238964[_0x4f3d('0x26')]){delete _0x238964['name'];}_0x31a4a5[_0x4f3d('0x15')](_0x16ba3a)[_0x4f3d('0x27')](_0x238964);};}exports[_0x4f3d('0x28')]=function(_0x351f00,_0x2abfb3){var _0x11c5b3={},_0xa27eb9={},_0x14a8f7={'count':0x0,'rows':[]};var _0x7cb4bf=_[_0x4f3d('0x29')](db[_0x4f3d('0x2a')]['rawAttributes'],function(_0x1d2a11){return{'name':_0x1d2a11[_0x4f3d('0x2b')],'type':_0x1d2a11[_0x4f3d('0x2c')][_0x4f3d('0x2d')]};});_0xa27eb9[_0x4f3d('0x2e')]=_[_0x4f3d('0x29')](_0x7cb4bf,'name');_0xa27eb9[_0x4f3d('0x2f')]=_[_0x4f3d('0x30')](_0x351f00[_0x4f3d('0x2f')]);_0xa27eb9[_0x4f3d('0x31')]=_[_0x4f3d('0x32')](_0xa27eb9[_0x4f3d('0x2e')],_0xa27eb9[_0x4f3d('0x2f')]);_0x11c5b3['attributes']=_[_0x4f3d('0x32')](_0xa27eb9['model'],qs[_0x4f3d('0x33')](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x33')]));_0x11c5b3['attributes']=_0x11c5b3[_0x4f3d('0x34')]['length']?_0x11c5b3[_0x4f3d('0x34')]:_0xa27eb9[_0x4f3d('0x2e')];if(!_0x351f00['query'][_0x4f3d('0x35')](_0x4f3d('0x36'))){_0x11c5b3[_0x4f3d('0x1a')]=qs[_0x4f3d('0x1a')](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x1a')]);_0x11c5b3['offset']=qs[_0x4f3d('0x19')](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x19')]);}_0x11c5b3[_0x4f3d('0x37')]=qs['sort'](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x38')]);_0x11c5b3[_0x4f3d('0x39')]=qs[_0x4f3d('0x31')](_[_0x4f3d('0x3a')](_0x351f00[_0x4f3d('0x2f')],_0xa27eb9[_0x4f3d('0x31')]),_0x7cb4bf);if(_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x3b')]){_0x11c5b3[_0x4f3d('0x39')]=_[_0x4f3d('0x3c')](_0x11c5b3['where'],{'$or':_[_0x4f3d('0x29')](_0x7cb4bf,function(_0x27d51f){if(_0x27d51f[_0x4f3d('0x2c')]!==_0x4f3d('0x3d')){var _0x4782d4={};_0x4782d4[_0x27d51f[_0x4f3d('0x26')]]={'$like':'%'+_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x3b')]+'%'};return _0x4782d4;}})});}_0x11c5b3=_[_0x4f3d('0x3c')]({},_0x11c5b3,_0x351f00[_0x4f3d('0x3e')]);var _0x40640a={'where':_0x11c5b3[_0x4f3d('0x39')]};return db[_0x4f3d('0x2a')][_0x4f3d('0x18')](_0x40640a)[_0x4f3d('0x21')](function(_0x40a107){_0x14a8f7[_0x4f3d('0x18')]=_0x40a107;if(_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x3f')]){_0x11c5b3[_0x4f3d('0x40')]=[{'all':!![]}];}return db[_0x4f3d('0x2a')][_0x4f3d('0x41')](_0x11c5b3);})[_0x4f3d('0x21')](function(_0x1c6715){_0x14a8f7['rows']=_0x1c6715;return _0x14a8f7;})[_0x4f3d('0x21')](respondWithFilteredResult(_0x2abfb3,_0x11c5b3))[_0x4f3d('0x42')](handleError(_0x2abfb3,null));};exports[_0x4f3d('0x43')]=function(_0x1056f1,_0x26a94b){var _0x36124d={'raw':![],'where':{'id':_0x1056f1['params']['id']}},_0x560b58={};_0x560b58[_0x4f3d('0x2e')]=_[_0x4f3d('0x30')](db[_0x4f3d('0x2a')]['rawAttributes']);_0x560b58[_0x4f3d('0x2f')]=_[_0x4f3d('0x30')](_0x1056f1['query']);_0x560b58[_0x4f3d('0x31')]=_[_0x4f3d('0x32')](_0x560b58[_0x4f3d('0x2e')],_0x560b58[_0x4f3d('0x2f')]);_0x36124d[_0x4f3d('0x34')]=_[_0x4f3d('0x32')](_0x560b58[_0x4f3d('0x2e')],qs[_0x4f3d('0x33')](_0x1056f1[_0x4f3d('0x2f')][_0x4f3d('0x33')]));_0x36124d['attributes']=_0x36124d[_0x4f3d('0x34')][_0x4f3d('0x44')]?_0x36124d[_0x4f3d('0x34')]:_0x560b58[_0x4f3d('0x2e')];if(_0x1056f1['query'][_0x4f3d('0x3f')]){_0x36124d[_0x4f3d('0x40')]=[{'all':!![]}];}_0x36124d=_['merge']({},_0x36124d,_0x1056f1[_0x4f3d('0x3e')]);return db[_0x4f3d('0x2a')][_0x4f3d('0x45')](_0x36124d)[_0x4f3d('0x21')](handleEntityNotFound(_0x26a94b,null))[_0x4f3d('0x21')](respondWithResult(_0x26a94b,null))[_0x4f3d('0x42')](handleError(_0x26a94b,null));};exports[_0x4f3d('0x46')]=function(_0x2f69a1,_0x4aa605){return db['Schedule']['create'](_0x2f69a1[_0x4f3d('0x47')],{})[_0x4f3d('0x21')](function(_0x1d9b49){var _0x4df6b9=_0x2f69a1[_0x4f3d('0x48')][_0x4f3d('0x49')]({'plain':!![]});if(!_0x4df6b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df6b9[_0x4f3d('0x4a')]===_0x4f3d('0x48')){var _0x35341c=_0x1d9b49[_0x4f3d('0x49')]({'plain':!![]});var _0xec0fd0=_0x4f3d('0x23');return db['UserProfileSection']['find']({'where':{'name':_0xec0fd0,'userProfileId':_0x4df6b9['userProfileId']},'raw':!![]})[_0x4f3d('0x21')](function(_0x4e3f8c){if(_0x4e3f8c&&_0x4e3f8c[_0x4f3d('0x4b')]===0x0){return db[_0x4f3d('0x24')][_0x4f3d('0x46')]({'name':_0x35341c[_0x4f3d('0x26')],'resourceId':_0x35341c['id'],'type':_0x4e3f8c['name'],'sectionId':_0x4e3f8c['id']},{})[_0x4f3d('0x21')](function(){return _0x1d9b49;});}else{return _0x1d9b49;}})[_0x4f3d('0x42')](function(_0x3987b0){logger[_0x4f3d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3987b0);throw _0x3987b0;});}return _0x1d9b49;})[_0x4f3d('0x21')](respondWithResult(_0x4aa605,0xc9))[_0x4f3d('0x42')](handleError(_0x4aa605,null));};exports[_0x4f3d('0x20')]=function(_0x240a99,_0x3cf0f7){if(_0x240a99['body']['id']){delete _0x240a99[_0x4f3d('0x47')]['id'];}return db[_0x4f3d('0x2a')][_0x4f3d('0x45')]({'where':{'id':_0x240a99[_0x4f3d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3cf0f7,null))[_0x4f3d('0x21')](saveUpdates(_0x240a99[_0x4f3d('0x47')],null))[_0x4f3d('0x21')](respondWithResult(_0x3cf0f7,null))[_0x4f3d('0x42')](handleError(_0x3cf0f7,null));};exports[_0x4f3d('0x22')]=function(_0x3b5599,_0xc27325){return db[_0x4f3d('0x2a')][_0x4f3d('0x45')]({'where':{'id':_0x3b5599[_0x4f3d('0x4c')]['id']}})[_0x4f3d('0x21')](handleEntityNotFound(_0xc27325,null))[_0x4f3d('0x21')](removeEntity(_0xc27325,null))['catch'](handleError(_0xc27325,null));};exports[_0x4f3d('0x4d')]=function(_0x4d981e,_0xbb0c64,_0x5a2426){var _0xb40c9e=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x4d981e[_0x4f3d('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbb0c64,null))[_0x4f3d('0x21')](function(){_0xb40c9e[_0x4f3d('0x4d')](_0x4d981e[_0x4f3d('0x4c')]['id']);})['then'](respondWithStatusCode(_0xbb0c64,null))['catch'](handleError(_0xbb0c64,null));}; \ No newline at end of file +var _0x3d8d=['send','map','Schedule','rawAttributes','type','query','keys','model','attributes','intersection','fields','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Scheduler','error','name'];(function(_0x27db60,_0x50f9df){var _0x15ff66=function(_0x508fe4){while(--_0x508fe4){_0x27db60['push'](_0x27db60['shift']());}};_0x15ff66(++_0x50f9df);}(_0x3d8d,0xca));var _0xd3d8=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x3d8d[_0x3a3758];return _0x1a9234;};'use strict';var pdf=require(_0xd3d8('0x0'));var emlformat=require(_0xd3d8('0x1'));var rimraf=require(_0xd3d8('0x2'));var zipdir=require(_0xd3d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3d8('0x4'));var moment=require(_0xd3d8('0x5'));var BPromise=require(_0xd3d8('0x6'));var Mustache=require('mustache');var util=require(_0xd3d8('0x7'));var path=require('path');var sox=require(_0xd3d8('0x8'));var csv=require(_0xd3d8('0x9'));var ejs=require(_0xd3d8('0xa'));var fs=require('fs');var _=require(_0xd3d8('0xb'));var squel=require('squel');var crypto=require(_0xd3d8('0xc'));var jsforce=require(_0xd3d8('0xd'));var deskjs=require(_0xd3d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd3d8('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3d8('0x10'));var authService=require(_0xd3d8('0x11'));var qs=require(_0xd3d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3d8('0x13'));var logger=require(_0xd3d8('0x14'))(_0xd3d8('0x15'));var utils=require(_0xd3d8('0x16'));var config=require('../../config/environment');var db=require(_0xd3d8('0x17'))['db'];function respondWithStatusCode(_0x51d6e5,_0x1efd36){_0x1efd36=_0x1efd36||0xcc;return function(_0x58a5e0){if(_0x58a5e0){return _0x51d6e5[_0xd3d8('0x18')](_0x1efd36);}return _0x51d6e5[_0xd3d8('0x19')](_0x1efd36)[_0xd3d8('0x1a')]();};}function respondWithResult(_0x151d8c,_0x584f62){_0x584f62=_0x584f62||0xc8;return function(_0x1c9b06){if(_0x1c9b06){return _0x151d8c[_0xd3d8('0x19')](_0x584f62)[_0xd3d8('0x1b')](_0x1c9b06);}};}function respondWithFilteredResult(_0x1a952c,_0x127d89){return function(_0xef46e7){if(_0xef46e7){var _0x3bc02d=_0xef46e7['count'],_0x2efd09=_0x127d89['offset'],_0x1703b9=_0x127d89[_0xd3d8('0x1c')]+_0x127d89[_0xd3d8('0x1d')],_0x275660;if(_0x1703b9>=_0x3bc02d){_0x1703b9=_0x3bc02d;_0x275660=0xc8;}else{_0x275660=0xce;}_0x1a952c[_0xd3d8('0x19')](_0x275660);return _0x1a952c[_0xd3d8('0x1e')](_0xd3d8('0x1f'),_0x2efd09+'-'+_0x1703b9+'/'+_0x3bc02d)[_0xd3d8('0x1b')](_0xef46e7);}return null;};}function patchUpdates(_0xb4d192){return function(_0x4a81ed){try{jsonpatch[_0xd3d8('0x20')](_0x4a81ed,_0xb4d192,!![]);}catch(_0x14d3b1){return BPromise[_0xd3d8('0x21')](_0x14d3b1);}return _0x4a81ed['save']();};}function saveUpdates(_0x55215c,_0x1679b8){return function(_0x9ea94){if(_0x9ea94){return _0x9ea94[_0xd3d8('0x22')](_0x55215c)['then'](function(_0x429abd){return _0x429abd;});}return null;};}function removeEntity(_0x3804d6,_0x79f37f){return function(_0x1ec71f){if(_0x1ec71f){return _0x1ec71f[_0xd3d8('0x23')]()[_0xd3d8('0x24')](function(){var _0x11eb36=_0x1ec71f[_0xd3d8('0x25')]({'plain':!![]});var _0x21ee00=_0xd3d8('0x26');return db['UserProfileResource'][_0xd3d8('0x23')]({'where':{'type':_0x21ee00,'resourceId':_0x11eb36['id']}})[_0xd3d8('0x24')](function(){return _0x1ec71f;});})[_0xd3d8('0x24')](function(){_0x3804d6[_0xd3d8('0x19')](0xcc)[_0xd3d8('0x1a')]();});}};}function handleEntityNotFound(_0x2ce69a,_0x200e88){return function(_0x1b69ef){if(!_0x1b69ef){_0x2ce69a[_0xd3d8('0x18')](0x194);}return _0x1b69ef;};}function handleError(_0x93a188,_0x492a93){_0x492a93=_0x492a93||0x1f4;return function(_0x485a90){logger[_0xd3d8('0x27')](_0x485a90['stack']);if(_0x485a90[_0xd3d8('0x28')]){delete _0x485a90[_0xd3d8('0x28')];}_0x93a188[_0xd3d8('0x19')](_0x492a93)[_0xd3d8('0x29')](_0x485a90);};}exports['index']=function(_0x577933,_0x13e288){var _0x2c09ab={},_0x27d9a0={},_0x3123b8={'count':0x0,'rows':[]};var _0x451b3d=_[_0xd3d8('0x2a')](db[_0xd3d8('0x2b')][_0xd3d8('0x2c')],function(_0x186697){return{'name':_0x186697['fieldName'],'type':_0x186697[_0xd3d8('0x2d')]['key']};});_0x27d9a0['model']=_[_0xd3d8('0x2a')](_0x451b3d,_0xd3d8('0x28'));_0x27d9a0[_0xd3d8('0x2e')]=_[_0xd3d8('0x2f')](_0x577933[_0xd3d8('0x2e')]);_0x27d9a0['filters']=_['intersection'](_0x27d9a0[_0xd3d8('0x30')],_0x27d9a0[_0xd3d8('0x2e')]);_0x2c09ab[_0xd3d8('0x31')]=_[_0xd3d8('0x32')](_0x27d9a0['model'],qs[_0xd3d8('0x33')](_0x577933[_0xd3d8('0x2e')][_0xd3d8('0x33')]));_0x2c09ab[_0xd3d8('0x31')]=_0x2c09ab[_0xd3d8('0x31')]['length']?_0x2c09ab[_0xd3d8('0x31')]:_0x27d9a0[_0xd3d8('0x30')];if(!_0x577933['query']['hasOwnProperty'](_0xd3d8('0x34'))){_0x2c09ab[_0xd3d8('0x1d')]=qs[_0xd3d8('0x1d')](_0x577933[_0xd3d8('0x2e')][_0xd3d8('0x1d')]);_0x2c09ab[_0xd3d8('0x1c')]=qs[_0xd3d8('0x1c')](_0x577933['query'][_0xd3d8('0x1c')]);}_0x2c09ab[_0xd3d8('0x35')]=qs[_0xd3d8('0x36')](_0x577933['query'][_0xd3d8('0x36')]);_0x2c09ab['where']=qs[_0xd3d8('0x37')](_['pick'](_0x577933['query'],_0x27d9a0[_0xd3d8('0x37')]),_0x451b3d);if(_0x577933['query'][_0xd3d8('0x38')]){_0x2c09ab[_0xd3d8('0x39')]=_[_0xd3d8('0x3a')](_0x2c09ab[_0xd3d8('0x39')],{'$or':_['map'](_0x451b3d,function(_0x2fabfc){if(_0x2fabfc[_0xd3d8('0x2d')]!==_0xd3d8('0x3b')){var _0x4be801={};_0x4be801[_0x2fabfc[_0xd3d8('0x28')]]={'$like':'%'+_0x577933[_0xd3d8('0x2e')][_0xd3d8('0x38')]+'%'};return _0x4be801;}})});}_0x2c09ab=_[_0xd3d8('0x3a')]({},_0x2c09ab,_0x577933[_0xd3d8('0x3c')]);var _0x20c3f0={'where':_0x2c09ab[_0xd3d8('0x39')]};return db['Schedule'][_0xd3d8('0x3d')](_0x20c3f0)[_0xd3d8('0x24')](function(_0x5adaae){_0x3123b8[_0xd3d8('0x3d')]=_0x5adaae;if(_0x577933[_0xd3d8('0x2e')][_0xd3d8('0x3e')]){_0x2c09ab['include']=[{'all':!![]}];}return db['Schedule'][_0xd3d8('0x3f')](_0x2c09ab);})[_0xd3d8('0x24')](function(_0x409abb){_0x3123b8[_0xd3d8('0x40')]=_0x409abb;return _0x3123b8;})['then'](respondWithFilteredResult(_0x13e288,_0x2c09ab))[_0xd3d8('0x41')](handleError(_0x13e288,null));};exports['show']=function(_0x389645,_0x309da8){var _0x3c23b3={'raw':![],'where':{'id':_0x389645['params']['id']}},_0xb806fa={};_0xb806fa[_0xd3d8('0x30')]=_[_0xd3d8('0x2f')](db[_0xd3d8('0x2b')]['rawAttributes']);_0xb806fa[_0xd3d8('0x2e')]=_[_0xd3d8('0x2f')](_0x389645[_0xd3d8('0x2e')]);_0xb806fa[_0xd3d8('0x37')]=_[_0xd3d8('0x32')](_0xb806fa[_0xd3d8('0x30')],_0xb806fa['query']);_0x3c23b3['attributes']=_['intersection'](_0xb806fa[_0xd3d8('0x30')],qs[_0xd3d8('0x33')](_0x389645[_0xd3d8('0x2e')][_0xd3d8('0x33')]));_0x3c23b3[_0xd3d8('0x31')]=_0x3c23b3[_0xd3d8('0x31')][_0xd3d8('0x42')]?_0x3c23b3['attributes']:_0xb806fa[_0xd3d8('0x30')];if(_0x389645[_0xd3d8('0x2e')][_0xd3d8('0x3e')]){_0x3c23b3[_0xd3d8('0x43')]=[{'all':!![]}];}_0x3c23b3=_[_0xd3d8('0x3a')]({},_0x3c23b3,_0x389645[_0xd3d8('0x3c')]);return db[_0xd3d8('0x2b')]['find'](_0x3c23b3)[_0xd3d8('0x24')](handleEntityNotFound(_0x309da8,null))[_0xd3d8('0x24')](respondWithResult(_0x309da8,null))[_0xd3d8('0x41')](handleError(_0x309da8,null));};exports['create']=function(_0x2a4eea,_0x5e7422){return db[_0xd3d8('0x2b')][_0xd3d8('0x44')](_0x2a4eea[_0xd3d8('0x45')],{})['then'](function(_0x56c626){var _0x29ea1a=_0x2a4eea['user'][_0xd3d8('0x25')]({'plain':!![]});if(!_0x29ea1a)throw new Error(_0xd3d8('0x46'));if(_0x29ea1a[_0xd3d8('0x47')]===_0xd3d8('0x48')){var _0x449902=_0x56c626[_0xd3d8('0x25')]({'plain':!![]});var _0x482e9a=_0xd3d8('0x26');return db['UserProfileSection'][_0xd3d8('0x49')]({'where':{'name':_0x482e9a,'userProfileId':_0x29ea1a[_0xd3d8('0x4a')]},'raw':!![]})['then'](function(_0x384fee){if(_0x384fee&&_0x384fee[_0xd3d8('0x4b')]===0x0){return db[_0xd3d8('0x4c')][_0xd3d8('0x44')]({'name':_0x449902[_0xd3d8('0x28')],'resourceId':_0x449902['id'],'type':_0x384fee['name'],'sectionId':_0x384fee['id']},{})[_0xd3d8('0x24')](function(){return _0x56c626;});}else{return _0x56c626;}})[_0xd3d8('0x41')](function(_0x3f1746){logger[_0xd3d8('0x27')](_0xd3d8('0x4d'),_0x3f1746);throw _0x3f1746;});}return _0x56c626;})[_0xd3d8('0x24')](respondWithResult(_0x5e7422,0xc9))[_0xd3d8('0x41')](handleError(_0x5e7422,null));};exports[_0xd3d8('0x22')]=function(_0x2a491c,_0x5bca64){if(_0x2a491c[_0xd3d8('0x45')]['id']){delete _0x2a491c[_0xd3d8('0x45')]['id'];}return db[_0xd3d8('0x2b')][_0xd3d8('0x49')]({'where':{'id':_0x2a491c[_0xd3d8('0x4e')]['id']}})[_0xd3d8('0x24')](handleEntityNotFound(_0x5bca64,null))[_0xd3d8('0x24')](saveUpdates(_0x2a491c['body'],null))['then'](respondWithResult(_0x5bca64,null))[_0xd3d8('0x41')](handleError(_0x5bca64,null));};exports['destroy']=function(_0x5214a0,_0xdeb88d){return db['Schedule'][_0xd3d8('0x49')]({'where':{'id':_0x5214a0[_0xd3d8('0x4e')]['id']}})[_0xd3d8('0x24')](handleEntityNotFound(_0xdeb88d,null))[_0xd3d8('0x24')](removeEntity(_0xdeb88d,null))['catch'](handleError(_0xdeb88d,null));};exports[_0xd3d8('0x4f')]=function(_0x45e495,_0x4b3712,_0x583826){var _0x36c9fd=require(_0xd3d8('0x50'));return db[_0xd3d8('0x2b')][_0xd3d8('0x49')]({'where':{'id':_0x45e495['params']['id']},'raw':!![]})[_0xd3d8('0x24')](handleEntityNotFound(_0x4b3712,null))[_0xd3d8('0x24')](function(){_0x36c9fd['run'](_0x45e495[_0xd3d8('0x4e')]['id']);})[_0xd3d8('0x24')](respondWithStatusCode(_0x4b3712,null))[_0xd3d8('0x41')](handleError(_0x4b3712,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0103c52..8935930 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 _0xfd5a=['request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xfd5a,0x140));var _0xafd5=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfd5a[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xafd5('0x0'));var util=require(_0xafd5('0x1'));var logger=require(_0xafd5('0x2'))('api');var moment=require(_0xafd5('0x3'));var BPromise=require(_0xafd5('0x4'));var rp=require(_0xafd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafd5('0x6'));var config=require(_0xafd5('0x7'));var attributes=require(_0xafd5('0x8'));module[_0xafd5('0x9')]=function(_0x1f1dfd,_0x23f8a6){return _0x1f1dfd[_0xafd5('0xa')](_0xafd5('0xb'),attributes,{'tableName':_0xafd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9e9=['../../config/logger','api','moment','bluebird','rimraf','./schedule.attributes','exports','define','Schedule','lodash'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe9e9,0x199));var _0x9e9e=function(_0xe19e8c,_0x6b4066){_0xe19e8c=_0xe19e8c-0x0;var _0x4bb6d7=_0xe9e9[_0xe19e8c];return _0x4bb6d7;};'use strict';var _=require(_0x9e9e('0x0'));var util=require('util');var logger=require(_0x9e9e('0x1'))(_0x9e9e('0x2'));var moment=require(_0x9e9e('0x3'));var BPromise=require(_0x9e9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e9e('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e9e('0x6'));module[_0x9e9e('0x7')]=function(_0x1a0405,_0x16df2f){return _0x1a0405[_0x9e9e('0x8')](_0x9e9e('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b608750..b3abbea 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 _0x338e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x3e6fcf,_0x5857a2){var _0x485b82=function(_0x34aa05){while(--_0x34aa05){_0x3e6fcf['push'](_0x3e6fcf['shift']());}};_0x485b82(++_0x5857a2);}(_0x338e,0x16c));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe338('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe338('0x1'));var rs=require(_0xe338('0x2'));var fs=require('fs');var Redis=require(_0xe338('0x3'));var db=require(_0xe338('0x4'))['db'];var utils=require(_0xe338('0x5'));var logger=require(_0xe338('0x6'))(_0xe338('0x7'));var config=require(_0xe338('0x8'));var jayson=require(_0xe338('0x9'));var client=jayson['client'][_0xe338('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c4cd,_0x37d6fe,_0x19e46b){return new BPromise(function(_0x784358,_0x5815d2){return client[_0xe338('0xb')](_0x44c4cd,_0x19e46b)[_0xe338('0xc')](function(_0x5456ce){logger[_0xe338('0xd')](_0xe338('0xe'),_0x37d6fe,_0xe338('0xf'));logger[_0xe338('0x10')](_0xe338('0x11'),_0x37d6fe,'request\x20sent',JSON[_0xe338('0x12')](_0x5456ce));if(_0x5456ce[_0xe338('0x13')]){if(_0x5456ce[_0xe338('0x13')]['code']===0x1f4){logger['error'](_0xe338('0xe'),_0x37d6fe,_0x5456ce[_0xe338('0x13')][_0xe338('0x14')]);return _0x5815d2(_0x5456ce[_0xe338('0x13')][_0xe338('0x14')]);}logger[_0xe338('0x13')](_0xe338('0xe'),_0x37d6fe,_0x5456ce[_0xe338('0x13')][_0xe338('0x14')]);return _0x784358(_0x5456ce[_0xe338('0x13')]['message']);}else{logger['info'](_0xe338('0xe'),_0x37d6fe,_0xe338('0xf'));_0x784358(_0x5456ce[_0xe338('0x15')][_0xe338('0x14')]);}})[_0xe338('0x16')](function(_0x4b7515){logger[_0xe338('0x13')](_0xe338('0xe'),_0x37d6fe,_0x4b7515);_0x5815d2(_0x4b7515);});});} \ No newline at end of file +var _0x0052=['jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x147bae,_0x355fd6){var _0x55d8c0=function(_0xc37649){while(--_0xc37649){_0x147bae['push'](_0x147bae['shift']());}};_0x55d8c0(++_0x355fd6);}(_0x0052,0x1b1));var _0x2005=function(_0xd80fd6,_0x122523){_0xd80fd6=_0xd80fd6-0x0;var _0x5243a6=_0x0052[_0xd80fd6];return _0x5243a6;};'use strict';var _=require('lodash');var util=require(_0x2005('0x0'));var moment=require('moment');var BPromise=require(_0x2005('0x1'));var rs=require(_0x2005('0x2'));var fs=require('fs');var Redis=require(_0x2005('0x3'));var db=require(_0x2005('0x4'))['db'];var utils=require(_0x2005('0x5'));var logger=require('../../config/logger')(_0x2005('0x6'));var config=require(_0x2005('0x7'));var jayson=require(_0x2005('0x8'));var client=jayson['client'][_0x2005('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a4748,_0x333218,_0x526082){return new BPromise(function(_0x51a55d,_0x45f9eb){return client['request'](_0x1a4748,_0x526082)[_0x2005('0xa')](function(_0x2cc909){logger[_0x2005('0xb')](_0x2005('0xc'),_0x333218,_0x2005('0xd'));logger[_0x2005('0xe')](_0x2005('0xf'),_0x333218,_0x2005('0xd'),JSON[_0x2005('0x10')](_0x2cc909));if(_0x2cc909[_0x2005('0x11')]){if(_0x2cc909[_0x2005('0x11')][_0x2005('0x12')]===0x1f4){logger[_0x2005('0x11')](_0x2005('0xc'),_0x333218,_0x2cc909[_0x2005('0x11')][_0x2005('0x13')]);return _0x45f9eb(_0x2cc909[_0x2005('0x11')][_0x2005('0x13')]);}logger[_0x2005('0x11')](_0x2005('0xc'),_0x333218,_0x2cc909['error']['message']);return _0x51a55d(_0x2cc909[_0x2005('0x11')][_0x2005('0x13')]);}else{logger[_0x2005('0xb')](_0x2005('0xc'),_0x333218,_0x2005('0xd'));_0x51a55d(_0x2cc909['result'][_0x2005('0x13')]);}})[_0x2005('0x14')](function(_0x21505f){logger[_0x2005('0x11')](_0x2005('0xc'),_0x333218,_0x21505f);_0x45f9eb(_0x21505f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index bfbb817..8d8d4bb 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 _0x99f7=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x99f7,0x1ca));var _0x799f=function(_0x46f4a9,_0x38e63f){_0x46f4a9=_0x46f4a9-0x0;var _0x4cdb88=_0x99f7[_0x46f4a9];return _0x4cdb88;};'use strict';var multer=require(_0x799f('0x0'));var util=require(_0x799f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x799f('0x2'));var router=express['Router']();var auth=require(_0x799f('0x3'));var interaction=require(_0x799f('0x4'));var config=require(_0x799f('0x5'));var controller=require(_0x799f('0x6'));router[_0x799f('0x7')]('/',auth['isAuthenticated'](),controller[_0x799f('0x8')]);router[_0x799f('0x7')](_0x799f('0x9'),auth[_0x799f('0xa')](),controller[_0x799f('0xb')]);router[_0x799f('0x7')](_0x799f('0xc'),auth['isAuthenticated'](),controller[_0x799f('0xd')]);router['get'](_0x799f('0xe'),auth[_0x799f('0xa')](),controller[_0x799f('0xf')]);router[_0x799f('0x10')]('/',auth[_0x799f('0xa')](),controller[_0x799f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x799f('0x12')]);router[_0x799f('0x13')](_0x799f('0xc'),auth[_0x799f('0xa')](),controller[_0x799f('0x14')]);module[_0x799f('0x15')]=router; \ No newline at end of file +var _0x1d65=['isAuthenticated','index','describe','/:id','show','download','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','./screenRecording.controller','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1d65,0x162));var _0x51d6=function(_0x3b97cc,_0x451983){_0x3b97cc=_0x3b97cc-0x0;var _0x599f04=_0x1d65[_0x3b97cc];return _0x599f04;};'use strict';var multer=require('multer');var util=require(_0x51d6('0x0'));var path=require('path');var timeout=require(_0x51d6('0x1'));var express=require(_0x51d6('0x2'));var router=express[_0x51d6('0x3')]();var auth=require(_0x51d6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51d6('0x5'));router[_0x51d6('0x6')]('/',auth[_0x51d6('0x7')](),controller[_0x51d6('0x8')]);router[_0x51d6('0x6')]('/describe',auth[_0x51d6('0x7')](),controller[_0x51d6('0x9')]);router[_0x51d6('0x6')](_0x51d6('0xa'),auth[_0x51d6('0x7')](),controller[_0x51d6('0xb')]);router[_0x51d6('0x6')]('/:id/download',auth[_0x51d6('0x7')](),controller[_0x51d6('0xc')]);router['post']('/',auth[_0x51d6('0x7')](),controller[_0x51d6('0xd')]);router[_0x51d6('0xe')](_0x51d6('0xa'),auth[_0x51d6('0x7')](),controller[_0x51d6('0xf')]);router[_0x51d6('0x10')](_0x51d6('0xa'),auth['isAuthenticated'](),controller[_0x51d6('0x11')]);module[_0x51d6('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1fac65e..e2ccdf9 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 _0x8958=['INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','getDataValue','extname','value','STRING','replace'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x8958,0x93));var _0x8895=function(_0x323626,_0x23a399){_0x323626=_0x323626-0x0;var _0x32d9c7=_0x8958[_0x323626];return _0x32d9c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8895('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8895('0x1')]('value')?path[_0x8895('0x2')](this[_0x8895('0x1')](_0x8895('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8895('0x4')]},'value':{'type':Sequelize[_0x8895('0x4')],'set':function(_0x124e1e){var _0x40cec6=_0x124e1e[_0x8895('0x5')](/\\/g,'/');this['setDataValue'](_0x8895('0x3'),_0x40cec6);}},'rating':{'type':Sequelize[_0x8895('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8895('0x6')],'set':function(_0x24fe49){this[_0x8895('0x7')](_0x8895('0x8'),moment()[_0x8895('0x9')](_0x24fe49,'ms'));this[_0x8895('0x7')](_0x8895('0xa'),moment());this[_0x8895('0x7')]('duration',_0x24fe49);}},'startedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0x8')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0xa')))[_0x8895('0xc')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0xf')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'updatedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0x10')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}}}; \ No newline at end of file +var _0x425d=['exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment'];(function(_0x5ca22d,_0x67e266){var _0x4dd3d8=function(_0x22590a){while(--_0x22590a){_0x5ca22d['push'](_0x5ca22d['shift']());}};_0x4dd3d8(++_0x67e266);}(_0x425d,0x1e0));var _0xd425=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x425d[_0x513254];return _0x384c92;};'use strict';var Sequelize=require(_0xd425('0x0'));var moment=require('moment');var path=require(_0xd425('0x1'));var config=require(_0xd425('0x2'));module[_0xd425('0x3')]={'format':{'type':Sequelize[_0xd425('0x4')],'get':function(){return this[_0xd425('0x5')](_0xd425('0x6'))?path[_0xd425('0x7')](this['getDataValue'](_0xd425('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xd425('0x8')]},'channel':{'type':Sequelize[_0xd425('0x8')]},'value':{'type':Sequelize[_0xd425('0x8')],'set':function(_0x1d97d9){var _0x1d2ed0=_0x1d97d9['replace'](/\\/g,'/');this[_0xd425('0x9')](_0xd425('0x6'),_0x1d2ed0);}},'rating':{'type':Sequelize[_0xd425('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd425('0xa')],'set':function(_0x2db9da){this[_0xd425('0x9')](_0xd425('0xb'),moment()[_0xd425('0xc')](_0x2db9da,'ms'));this[_0xd425('0x9')](_0xd425('0xd'),moment());this[_0xd425('0x9')](_0xd425('0xe'),_0x2db9da);}},'startedAt':{'type':Sequelize[_0xd425('0xf')],'get':function(){return moment(this[_0xd425('0x5')](_0xd425('0xb')))[_0xd425('0x10')](_0xd425('0x11'))[_0xd425('0x12')]();}},'closedAt':{'type':Sequelize[_0xd425('0xf')],'get':function(){return moment(this[_0xd425('0x5')]('closedAt'))[_0xd425('0x10')](_0xd425('0x11'))[_0xd425('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd425('0x5')](_0xd425('0x13')))[_0xd425('0x10')](_0xd425('0x11'))[_0xd425('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd425('0x5')](_0xd425('0x14')))[_0xd425('0x10')](_0xd425('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8d874db..9a4ab4c 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 _0xd484=['rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','params','length','find','create','body','duration','closedAt','describe','../../components/encryptor','uniqueid','value','root','server/files/screen_recordings','%s.cypher','secrets','recording','join','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording'];(function(_0x216f7d,_0x496249){var _0xc49d7f=function(_0x27be52){while(--_0x27be52){_0x216f7d['push'](_0x216f7d['shift']());}};_0xc49d7f(++_0x496249);}(_0xd484,0xff));var _0x4d48=function(_0xdb7519,_0x5b4c5b){_0xdb7519=_0xdb7519-0x0;var _0xb5ee9=_0xd484[_0xdb7519];return _0xb5ee9;};'use strict';var pdf=require(_0x4d48('0x0'));var emlformat=require(_0x4d48('0x1'));var rimraf=require(_0x4d48('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d48('0x3'));var rp=require('request-promise');var moment=require(_0x4d48('0x4'));var BPromise=require(_0x4d48('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d48('0x6'));var sox=require(_0x4d48('0x7'));var csv=require(_0x4d48('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d48('0x9'));var squel=require(_0x4d48('0xa'));var crypto=require(_0x4d48('0xb'));var jsforce=require(_0x4d48('0xc'));var deskjs=require(_0x4d48('0xd'));var toCsv=require(_0x4d48('0x8'));var querystring=require('querystring');var Papa=require(_0x4d48('0xe'));var Redis=require('ioredis');var authService=require(_0x4d48('0xf'));var qs=require(_0x4d48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d48('0x11'));var logger=require('../../config/logger')(_0x4d48('0x12'));var utils=require(_0x4d48('0x13'));var config=require(_0x4d48('0x14'));var db=require(_0x4d48('0x15'))['db'];function respondWithStatusCode(_0x35ecb6,_0xd3799b){_0xd3799b=_0xd3799b||0xcc;return function(_0x108c0c){if(_0x108c0c){return _0x35ecb6[_0x4d48('0x16')](_0xd3799b);}return _0x35ecb6[_0x4d48('0x17')](_0xd3799b)[_0x4d48('0x18')]();};}function respondWithResult(_0x55aa8e,_0x12eab4){_0x12eab4=_0x12eab4||0xc8;return function(_0x4a4cec){if(_0x4a4cec){return _0x55aa8e[_0x4d48('0x17')](_0x12eab4)[_0x4d48('0x19')](_0x4a4cec);}};}function respondWithFilteredResult(_0x20edc7,_0x5bdb48){return function(_0x1be7f9){if(_0x1be7f9){var _0x115267=_0x1be7f9[_0x4d48('0x1a')],_0x3249c5=_0x5bdb48[_0x4d48('0x1b')],_0x13db0d=_0x5bdb48[_0x4d48('0x1b')]+_0x5bdb48[_0x4d48('0x1c')],_0x5e5734;if(_0x13db0d>=_0x115267){_0x13db0d=_0x115267;_0x5e5734=0xc8;}else{_0x5e5734=0xce;}_0x20edc7[_0x4d48('0x17')](_0x5e5734);return _0x20edc7[_0x4d48('0x1d')](_0x4d48('0x1e'),_0x3249c5+'-'+_0x13db0d+'/'+_0x115267)[_0x4d48('0x19')](_0x1be7f9);}return null;};}function patchUpdates(_0xab60ad){return function(_0x3a0e9d){try{jsonpatch[_0x4d48('0x1f')](_0x3a0e9d,_0xab60ad,!![]);}catch(_0xd915c7){return BPromise[_0x4d48('0x20')](_0xd915c7);}return _0x3a0e9d[_0x4d48('0x21')]();};}function saveUpdates(_0xd7785d,_0x8f3636){return function(_0x5ec013){if(_0x5ec013){return _0x5ec013['update'](_0xd7785d)[_0x4d48('0x22')](function(_0x1ef05){return _0x1ef05;});}return null;};}function removeEntity(_0x14074d,_0x5e0ce1){return function(_0x1a7467){if(_0x1a7467){return _0x1a7467[_0x4d48('0x23')]()[_0x4d48('0x22')](function(){_0x14074d[_0x4d48('0x17')](0xcc)[_0x4d48('0x18')]();});}};}function handleEntityNotFound(_0x4657f,_0x1e375a){return function(_0x58c27d){if(!_0x58c27d){_0x4657f[_0x4d48('0x16')](0x194);}return _0x58c27d;};}function handleError(_0x1121e4,_0x2b3df8){_0x2b3df8=_0x2b3df8||0x1f4;return function(_0x308958){logger[_0x4d48('0x24')](_0x308958['stack']);if(_0x308958[_0x4d48('0x25')]){delete _0x308958[_0x4d48('0x25')];}_0x1121e4[_0x4d48('0x17')](_0x2b3df8)[_0x4d48('0x26')](_0x308958);};}exports[_0x4d48('0x27')]=function(_0x469422,_0x13c3a5){var _0x56b62d={},_0x393530={},_0x1bada6={'count':0x0,'rows':[]};var _0x524146=_[_0x4d48('0x28')](db[_0x4d48('0x29')][_0x4d48('0x2a')],function(_0x5c852b){return{'name':_0x5c852b[_0x4d48('0x2b')],'type':_0x5c852b[_0x4d48('0x2c')][_0x4d48('0x2d')]};});_0x393530[_0x4d48('0x2e')]=_[_0x4d48('0x2f')](_['map'](_0x524146,'name'),[_0x4d48('0x30')]);_0x393530[_0x4d48('0x31')]=_[_0x4d48('0x32')](_0x469422[_0x4d48('0x31')]);_0x393530[_0x4d48('0x33')]=_[_0x4d48('0x34')](_0x393530[_0x4d48('0x2e')],_0x393530[_0x4d48('0x31')]);_0x56b62d[_0x4d48('0x35')]=_[_0x4d48('0x34')](_0x393530['model'],qs[_0x4d48('0x36')](_0x469422[_0x4d48('0x31')][_0x4d48('0x36')]));_0x56b62d['attributes']=_0x56b62d[_0x4d48('0x35')]['length']?_0x56b62d[_0x4d48('0x35')]:_0x393530['model'];if(!_0x469422[_0x4d48('0x31')]['hasOwnProperty']('nolimit')){_0x56b62d[_0x4d48('0x1c')]=qs['limit'](_0x469422[_0x4d48('0x31')]['limit']);_0x56b62d[_0x4d48('0x1b')]=qs[_0x4d48('0x1b')](_0x469422[_0x4d48('0x31')][_0x4d48('0x1b')]);}_0x56b62d[_0x4d48('0x37')]=qs['sort'](_0x469422[_0x4d48('0x31')][_0x4d48('0x38')]);_0x56b62d[_0x4d48('0x39')]=qs[_0x4d48('0x33')](_[_0x4d48('0x3a')](_0x469422['query'],_0x393530['filters']),_0x524146);if(_0x469422[_0x4d48('0x31')][_0x4d48('0x3b')]){_0x56b62d[_0x4d48('0x39')]=_[_0x4d48('0x3c')](_0x56b62d[_0x4d48('0x39')],{'$or':_['map'](_0x524146,function(_0x3b798f){if(_0x3b798f['type']!==_0x4d48('0x3d')){var _0x1d8e17={};_0x1d8e17[_0x3b798f[_0x4d48('0x25')]]={'$like':'%'+_0x469422[_0x4d48('0x31')][_0x4d48('0x3b')]+'%'};return _0x1d8e17;}})});}_0x56b62d=_[_0x4d48('0x3c')]({},_0x56b62d,_0x469422['options']);var _0x47dacc={'where':_0x56b62d['where']};return db[_0x4d48('0x29')][_0x4d48('0x1a')](_0x47dacc)[_0x4d48('0x22')](function(_0x4a8f55){_0x1bada6['count']=_0x4a8f55;if(_0x469422[_0x4d48('0x31')][_0x4d48('0x3e')]){_0x56b62d[_0x4d48('0x3f')]=[{'all':!![]}];}return db[_0x4d48('0x29')]['findAll'](_0x56b62d);})[_0x4d48('0x22')](function(_0x45d1e3){_0x1bada6['rows']=_0x45d1e3;return _0x1bada6;})[_0x4d48('0x22')](respondWithFilteredResult(_0x13c3a5,_0x56b62d))[_0x4d48('0x40')](handleError(_0x13c3a5,null));};exports['show']=function(_0x86fad9,_0x57846a){var _0x813988={'raw':![],'where':{'id':_0x86fad9[_0x4d48('0x41')]['id']}},_0x28f33a={};_0x28f33a[_0x4d48('0x2e')]=_[_0x4d48('0x32')](db[_0x4d48('0x29')][_0x4d48('0x2a')]);_0x28f33a['query']=_[_0x4d48('0x32')](_0x86fad9[_0x4d48('0x31')]);_0x28f33a[_0x4d48('0x33')]=_[_0x4d48('0x34')](_0x28f33a[_0x4d48('0x2e')],_0x28f33a[_0x4d48('0x31')]);_0x813988[_0x4d48('0x35')]=_['intersection'](_0x28f33a[_0x4d48('0x2e')],qs[_0x4d48('0x36')](_0x86fad9['query']['fields']));_0x813988['attributes']=_0x813988['attributes'][_0x4d48('0x42')]?_0x813988['attributes']:_0x28f33a[_0x4d48('0x2e')];if(_0x86fad9[_0x4d48('0x31')][_0x4d48('0x3e')]){_0x813988[_0x4d48('0x3f')]=[{'all':!![]}];}_0x813988=_[_0x4d48('0x3c')]({},_0x813988,_0x86fad9['options']);return db[_0x4d48('0x29')][_0x4d48('0x43')](_0x813988)['then'](handleEntityNotFound(_0x57846a,null))[_0x4d48('0x22')](respondWithResult(_0x57846a,null))[_0x4d48('0x40')](handleError(_0x57846a,null));};exports[_0x4d48('0x44')]=function(_0x5d28d9,_0x3dd055){return db[_0x4d48('0x29')]['create'](_0x5d28d9[_0x4d48('0x45')],{})[_0x4d48('0x22')](respondWithResult(_0x3dd055,0xc9))[_0x4d48('0x40')](handleError(_0x3dd055,null));};exports['update']=function(_0x1904a8,_0xb319a7){if(_0x1904a8['body']['id']){delete _0x1904a8[_0x4d48('0x45')]['id'];}delete _0x1904a8[_0x4d48('0x45')][_0x4d48('0x46')];delete _0x1904a8[_0x4d48('0x45')]['createdAt'];delete _0x1904a8['body'][_0x4d48('0x47')];delete _0x1904a8[_0x4d48('0x45')]['value'];return db['ScreenRecording']['find']({'where':{'id':_0x1904a8[_0x4d48('0x41')]['id']}})[_0x4d48('0x22')](handleEntityNotFound(_0xb319a7,null))[_0x4d48('0x22')](saveUpdates(_0x1904a8[_0x4d48('0x45')],null))[_0x4d48('0x22')](respondWithResult(_0xb319a7,null))['catch'](handleError(_0xb319a7,null));};exports[_0x4d48('0x48')]=function(_0x4c45a4,_0xa90b6f){return db['ScreenRecording'][_0x4d48('0x48')]()['then'](respondWithResult(_0xa90b6f,null))[_0x4d48('0x40')](handleError(_0xa90b6f,null));};exports['download']=function(_0xece93b,_0x31cb97,_0x322112){var _0x17770a=require(_0x4d48('0x49'));var _0x3adaf6=![];var _0x301a56={};if(_0xece93b[_0x4d48('0x31')][_0x4d48('0x2c')]&&_0xece93b[_0x4d48('0x31')][_0x4d48('0x2c')]===_0x4d48('0x4a')){_0x301a56[_0x4d48('0x4a')]=_0xece93b[_0x4d48('0x41')]['id'];}else{_0x301a56['id']=_0xece93b[_0x4d48('0x41')]['id'];}return db[_0x4d48('0x29')][_0x4d48('0x43')]({'where':_0x301a56,'attributes':['id',_0x4d48('0x4b')],'raw':!![]})[_0x4d48('0x22')](handleEntityNotFound(_0x31cb97,null))[_0x4d48('0x22')](function(_0x554825){if(_0x554825){var _0x5157df=path['join'](config[_0x4d48('0x4c')],_0x4d48('0x4d'),_0x554825[_0x4d48('0x4b')]);var _0x3cf0ab=util[_0x4d48('0x30')](_0x4d48('0x4e'),_0x5157df);if(fs['existsSync'](_0x3cf0ab)){_0x3adaf6=!![];return _0x17770a['decryptFile'](_0x3cf0ab,_0x5157df,config[_0x4d48('0x4f')][_0x4d48('0x50')])['then'](function(){return _0x554825;});}return _0x554825;}})['then'](function(_0x1d5ff2){if(_0x1d5ff2){var _0x5e9a95=path[_0x4d48('0x51')](config['root'],'server/files/screen_recordings',_0x1d5ff2[_0x4d48('0x4b')]);if(!fs['existsSync'](_0x5e9a95)){throw new db['Sequelize'][(_0x4d48('0x52'))]('ScreenRecording\x20not\x20found');}if(_0x1d5ff2[_0x4d48('0x53')]){return _0x31cb97[_0x4d48('0x54')](_0x5e9a95,_0x1d5ff2['filename']+path[_0x4d48('0x55')](_0x5e9a95),function(){if(_0x3adaf6){fs['unlink'](_0x5e9a95);}});}else{return _0x31cb97[_0x4d48('0x54')](_0x5e9a95,function(_0x104569){if(_0x3adaf6){fs[_0x4d48('0x56')](_0x5e9a95);}});}}})[_0x4d48('0x40')](function(_0x2cde87){if(_0x2cde87[_0x4d48('0x57')]===_0x4d48('0x58')){_0x31cb97[_0x4d48('0x17')](0x194)[_0x4d48('0x26')](_0x4d48('0x59'));}else{return handleError(_0x31cb97,null);}});};exports[_0x4d48('0x23')]=function(_0x434c33,_0x1690f4){return db['ScreenRecording'][_0x4d48('0x43')]({'where':{'id':_0x434c33[_0x4d48('0x41')]['id']}})[_0x4d48('0x22')](function(_0x98824){if(!_0x98824)throw new ReferenceError(_0x4d48('0x5a'));return _0x98824;})[_0x4d48('0x22')](function(_0x10abbc){var _0x323ee4=path['join'](config['root'],'server/files/screen_recordings',_0x10abbc[_0x4d48('0x4b')]);logger[_0x4d48('0x5b')](_0x4d48('0x5c'),_0x323ee4);if(!_[_0x4d48('0x5d')](_0x10abbc['value'])&&fs[_0x4d48('0x5e')](_0x323ee4)){logger[_0x4d48('0x5b')](_0x4d48('0x5f')+_0x323ee4+_0x4d48('0x60'));fs[_0x4d48('0x61')](_0x323ee4);}_0x323ee4=_0x323ee4+_0x4d48('0x62');if(!_[_0x4d48('0x5d')](_0x10abbc['value'])&&fs[_0x4d48('0x5e')](_0x323ee4)){logger[_0x4d48('0x5b')](_0x4d48('0x5f')+_0x323ee4+_0x4d48('0x60'));fs['unlinkSync'](_0x323ee4);}return _0x10abbc;})[_0x4d48('0x22')](function(_0x5f2226){if(!_0x5f2226)throw new InternalError();return _0x5f2226['destroy']();})[_0x4d48('0x22')](function(){_0x1690f4[_0x4d48('0x17')](0xcc)[_0x4d48('0x18')]();})[_0x4d48('0x40')](handleError(_0x1690f4,null));}; \ No newline at end of file +var _0xb338=['secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ScreenRecording','then','includeAll','include','findAll','rows','catch','show','find','body','update','duration','createdAt','value','describe','download','uniqueid','params','join','root','server/files/screen_recordings','format','decryptFile'];(function(_0x5a6150,_0x5df91f){var _0x4cd8f2=function(_0x26f6aa){while(--_0x26f6aa){_0x5a6150['push'](_0x5a6150['shift']());}};_0x4cd8f2(++_0x5df91f);}(_0xb338,0x130));var _0x8b33=function(_0x28e655,_0xb50ac){_0x28e655=_0x28e655-0x0;var _0x267f07=_0xb338[_0x28e655];return _0x267f07;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b33('0x0'));var rimraf=require(_0x8b33('0x1'));var zipdir=require(_0x8b33('0x2'));var jsonpatch=require(_0x8b33('0x3'));var rp=require('request-promise');var moment=require(_0x8b33('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8b33('0x5'));var path=require(_0x8b33('0x6'));var sox=require(_0x8b33('0x7'));var csv=require(_0x8b33('0x8'));var ejs=require(_0x8b33('0x9'));var fs=require('fs');var _=require(_0x8b33('0xa'));var squel=require(_0x8b33('0xb'));var crypto=require(_0x8b33('0xc'));var jsforce=require(_0x8b33('0xd'));var deskjs=require(_0x8b33('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b33('0xf'));var qs=require(_0x8b33('0x10'));var as=require(_0x8b33('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b33('0x12'))(_0x8b33('0x13'));var utils=require('../../config/utils');var config=require(_0x8b33('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x155724,_0x1e1538){_0x1e1538=_0x1e1538||0xcc;return function(_0x459397){if(_0x459397){return _0x155724[_0x8b33('0x15')](_0x1e1538);}return _0x155724[_0x8b33('0x16')](_0x1e1538)[_0x8b33('0x17')]();};}function respondWithResult(_0x56d6bb,_0x21e0a5){_0x21e0a5=_0x21e0a5||0xc8;return function(_0x5dfe5e){if(_0x5dfe5e){return _0x56d6bb[_0x8b33('0x16')](_0x21e0a5)['json'](_0x5dfe5e);}};}function respondWithFilteredResult(_0x70815f,_0x569d91){return function(_0x18557f){if(_0x18557f){var _0x2f6e2d=_0x18557f[_0x8b33('0x18')],_0x1ac263=_0x569d91[_0x8b33('0x19')],_0x706124=_0x569d91['offset']+_0x569d91[_0x8b33('0x1a')],_0x4be20c;if(_0x706124>=_0x2f6e2d){_0x706124=_0x2f6e2d;_0x4be20c=0xc8;}else{_0x4be20c=0xce;}_0x70815f[_0x8b33('0x16')](_0x4be20c);return _0x70815f[_0x8b33('0x1b')](_0x8b33('0x1c'),_0x1ac263+'-'+_0x706124+'/'+_0x2f6e2d)['json'](_0x18557f);}return null;};}function patchUpdates(_0x5ad69d){return function(_0x239a65){try{jsonpatch[_0x8b33('0x1d')](_0x239a65,_0x5ad69d,!![]);}catch(_0x239c6b){return BPromise['reject'](_0x239c6b);}return _0x239a65[_0x8b33('0x1e')]();};}function saveUpdates(_0xe7e4ba,_0x513989){return function(_0x598801){if(_0x598801){return _0x598801['update'](_0xe7e4ba)['then'](function(_0x36129d){return _0x36129d;});}return null;};}function removeEntity(_0x537f79,_0x256a0c){return function(_0x1fd150){if(_0x1fd150){return _0x1fd150[_0x8b33('0x1f')]()['then'](function(){_0x537f79[_0x8b33('0x16')](0xcc)[_0x8b33('0x17')]();});}};}function handleEntityNotFound(_0x41b5e1,_0x31ac86){return function(_0x18b892){if(!_0x18b892){_0x41b5e1['sendStatus'](0x194);}return _0x18b892;};}function handleError(_0x461e09,_0x3ab759){_0x3ab759=_0x3ab759||0x1f4;return function(_0x1a1f4b){logger[_0x8b33('0x20')](_0x1a1f4b[_0x8b33('0x21')]);if(_0x1a1f4b[_0x8b33('0x22')]){delete _0x1a1f4b[_0x8b33('0x22')];}_0x461e09['status'](_0x3ab759)[_0x8b33('0x23')](_0x1a1f4b);};}exports[_0x8b33('0x24')]=function(_0x5a8d7a,_0x572de7){var _0x1c996f={},_0x47c84e={},_0x54027e={'count':0x0,'rows':[]};var _0x1273dc=_[_0x8b33('0x25')](db['ScreenRecording'][_0x8b33('0x26')],function(_0x31539b){return{'name':_0x31539b['fieldName'],'type':_0x31539b['type'][_0x8b33('0x27')]};});_0x47c84e[_0x8b33('0x28')]=_['differenceBy'](_[_0x8b33('0x25')](_0x1273dc,_0x8b33('0x22')),['format']);_0x47c84e[_0x8b33('0x29')]=_[_0x8b33('0x2a')](_0x5a8d7a[_0x8b33('0x29')]);_0x47c84e[_0x8b33('0x2b')]=_[_0x8b33('0x2c')](_0x47c84e['model'],_0x47c84e[_0x8b33('0x29')]);_0x1c996f['attributes']=_[_0x8b33('0x2c')](_0x47c84e[_0x8b33('0x28')],qs[_0x8b33('0x2d')](_0x5a8d7a['query'][_0x8b33('0x2d')]));_0x1c996f[_0x8b33('0x2e')]=_0x1c996f[_0x8b33('0x2e')][_0x8b33('0x2f')]?_0x1c996f['attributes']:_0x47c84e['model'];if(!_0x5a8d7a[_0x8b33('0x29')]['hasOwnProperty'](_0x8b33('0x30'))){_0x1c996f[_0x8b33('0x1a')]=qs[_0x8b33('0x1a')](_0x5a8d7a['query']['limit']);_0x1c996f[_0x8b33('0x19')]=qs[_0x8b33('0x19')](_0x5a8d7a[_0x8b33('0x29')][_0x8b33('0x19')]);}_0x1c996f[_0x8b33('0x31')]=qs['sort'](_0x5a8d7a[_0x8b33('0x29')][_0x8b33('0x32')]);_0x1c996f[_0x8b33('0x33')]=qs[_0x8b33('0x2b')](_['pick'](_0x5a8d7a[_0x8b33('0x29')],_0x47c84e['filters']),_0x1273dc);if(_0x5a8d7a[_0x8b33('0x29')][_0x8b33('0x34')]){_0x1c996f['where']=_[_0x8b33('0x35')](_0x1c996f[_0x8b33('0x33')],{'$or':_[_0x8b33('0x25')](_0x1273dc,function(_0x5c3a6a){if(_0x5c3a6a[_0x8b33('0x36')]!==_0x8b33('0x37')){var _0x1674c0={};_0x1674c0[_0x5c3a6a[_0x8b33('0x22')]]={'$like':'%'+_0x5a8d7a[_0x8b33('0x29')]['filter']+'%'};return _0x1674c0;}})});}_0x1c996f=_['merge']({},_0x1c996f,_0x5a8d7a[_0x8b33('0x38')]);var _0x216b5d={'where':_0x1c996f[_0x8b33('0x33')]};return db[_0x8b33('0x39')][_0x8b33('0x18')](_0x216b5d)[_0x8b33('0x3a')](function(_0x4b050f){_0x54027e[_0x8b33('0x18')]=_0x4b050f;if(_0x5a8d7a[_0x8b33('0x29')][_0x8b33('0x3b')]){_0x1c996f[_0x8b33('0x3c')]=[{'all':!![]}];}return db[_0x8b33('0x39')][_0x8b33('0x3d')](_0x1c996f);})[_0x8b33('0x3a')](function(_0x32c663){_0x54027e[_0x8b33('0x3e')]=_0x32c663;return _0x54027e;})[_0x8b33('0x3a')](respondWithFilteredResult(_0x572de7,_0x1c996f))[_0x8b33('0x3f')](handleError(_0x572de7,null));};exports[_0x8b33('0x40')]=function(_0x26809b,_0x2db812){var _0x403fa6={'raw':![],'where':{'id':_0x26809b['params']['id']}},_0x5e1693={};_0x5e1693[_0x8b33('0x28')]=_[_0x8b33('0x2a')](db[_0x8b33('0x39')]['rawAttributes']);_0x5e1693[_0x8b33('0x29')]=_[_0x8b33('0x2a')](_0x26809b[_0x8b33('0x29')]);_0x5e1693[_0x8b33('0x2b')]=_['intersection'](_0x5e1693[_0x8b33('0x28')],_0x5e1693[_0x8b33('0x29')]);_0x403fa6[_0x8b33('0x2e')]=_['intersection'](_0x5e1693[_0x8b33('0x28')],qs['fields'](_0x26809b[_0x8b33('0x29')][_0x8b33('0x2d')]));_0x403fa6[_0x8b33('0x2e')]=_0x403fa6[_0x8b33('0x2e')][_0x8b33('0x2f')]?_0x403fa6[_0x8b33('0x2e')]:_0x5e1693[_0x8b33('0x28')];if(_0x26809b[_0x8b33('0x29')]['includeAll']){_0x403fa6[_0x8b33('0x3c')]=[{'all':!![]}];}_0x403fa6=_[_0x8b33('0x35')]({},_0x403fa6,_0x26809b[_0x8b33('0x38')]);return db[_0x8b33('0x39')][_0x8b33('0x41')](_0x403fa6)[_0x8b33('0x3a')](handleEntityNotFound(_0x2db812,null))['then'](respondWithResult(_0x2db812,null))[_0x8b33('0x3f')](handleError(_0x2db812,null));};exports['create']=function(_0x2e098a,_0x18e337){return db[_0x8b33('0x39')]['create'](_0x2e098a[_0x8b33('0x42')],{})[_0x8b33('0x3a')](respondWithResult(_0x18e337,0xc9))[_0x8b33('0x3f')](handleError(_0x18e337,null));};exports[_0x8b33('0x43')]=function(_0x6f2bfa,_0x3a1501){if(_0x6f2bfa[_0x8b33('0x42')]['id']){delete _0x6f2bfa[_0x8b33('0x42')]['id'];}delete _0x6f2bfa['body'][_0x8b33('0x44')];delete _0x6f2bfa['body'][_0x8b33('0x45')];delete _0x6f2bfa[_0x8b33('0x42')]['closedAt'];delete _0x6f2bfa[_0x8b33('0x42')][_0x8b33('0x46')];return db[_0x8b33('0x39')][_0x8b33('0x41')]({'where':{'id':_0x6f2bfa['params']['id']}})['then'](handleEntityNotFound(_0x3a1501,null))[_0x8b33('0x3a')](saveUpdates(_0x6f2bfa['body'],null))[_0x8b33('0x3a')](respondWithResult(_0x3a1501,null))[_0x8b33('0x3f')](handleError(_0x3a1501,null));};exports[_0x8b33('0x47')]=function(_0x5c345d,_0x12c9ae){return db['ScreenRecording'][_0x8b33('0x47')]()[_0x8b33('0x3a')](respondWithResult(_0x12c9ae,null))[_0x8b33('0x3f')](handleError(_0x12c9ae,null));};exports[_0x8b33('0x48')]=function(_0x2cb569,_0x580ab6,_0x104a1e){var _0x1ed47c=require('../../components/encryptor');var _0x4c0ef2=![];var _0x5a1763={};if(_0x2cb569[_0x8b33('0x29')]['type']&&_0x2cb569[_0x8b33('0x29')][_0x8b33('0x36')]==='uniqueid'){_0x5a1763[_0x8b33('0x49')]=_0x2cb569[_0x8b33('0x4a')]['id'];}else{_0x5a1763['id']=_0x2cb569[_0x8b33('0x4a')]['id'];}return db['ScreenRecording']['find']({'where':_0x5a1763,'attributes':['id',_0x8b33('0x46')],'raw':!![]})[_0x8b33('0x3a')](handleEntityNotFound(_0x580ab6,null))[_0x8b33('0x3a')](function(_0x11b894){if(_0x11b894){var _0x1443ae=path[_0x8b33('0x4b')](config[_0x8b33('0x4c')],_0x8b33('0x4d'),_0x11b894[_0x8b33('0x46')]);var _0x39e909=util[_0x8b33('0x4e')]('%s.cypher',_0x1443ae);if(fs['existsSync'](_0x39e909)){_0x4c0ef2=!![];return _0x1ed47c[_0x8b33('0x4f')](_0x39e909,_0x1443ae,config[_0x8b33('0x50')][_0x8b33('0x51')])[_0x8b33('0x3a')](function(){return _0x11b894;});}return _0x11b894;}})['then'](function(_0x14063e){if(_0x14063e){var _0x5b5b53=path['join'](config[_0x8b33('0x4c')],'server/files/screen_recordings',_0x14063e[_0x8b33('0x46')]);if(!fs[_0x8b33('0x52')](_0x5b5b53)){throw new db[(_0x8b33('0x53'))][(_0x8b33('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x14063e[_0x8b33('0x55')]){return _0x580ab6[_0x8b33('0x48')](_0x5b5b53,_0x14063e[_0x8b33('0x55')]+path[_0x8b33('0x56')](_0x5b5b53),function(){if(_0x4c0ef2){fs[_0x8b33('0x57')](_0x5b5b53);}});}else{return _0x580ab6['download'](_0x5b5b53,function(_0x1146d7){if(_0x4c0ef2){fs['unlink'](_0x5b5b53);}});}}})[_0x8b33('0x3f')](function(_0x1e0206){if(_0x1e0206[_0x8b33('0x58')]==='ScreenRecording\x20not\x20found'){_0x580ab6[_0x8b33('0x16')](0x194)['send'](_0x8b33('0x59'));}else{return handleError(_0x580ab6,null);}});};exports['destroy']=function(_0x566279,_0x713b7e){return db['ScreenRecording'][_0x8b33('0x41')]({'where':{'id':_0x566279['params']['id']}})['then'](function(_0x2fed0f){if(!_0x2fed0f)throw new ReferenceError('Entity\x20not\x20found');return _0x2fed0f;})['then'](function(_0x344e6c){var _0x6b519=path[_0x8b33('0x4b')](config[_0x8b33('0x4c')],_0x8b33('0x4d'),_0x344e6c[_0x8b33('0x46')]);logger[_0x8b33('0x5a')](_0x8b33('0x5b'),_0x6b519);if(!_[_0x8b33('0x5c')](_0x344e6c[_0x8b33('0x46')])&&fs[_0x8b33('0x52')](_0x6b519)){logger[_0x8b33('0x5a')]('File:\x20\x22'+_0x6b519+_0x8b33('0x5d'));fs[_0x8b33('0x5e')](_0x6b519);}_0x6b519=_0x6b519+'.cypher';if(!_['isNil'](_0x344e6c[_0x8b33('0x46')])&&fs[_0x8b33('0x52')](_0x6b519)){logger[_0x8b33('0x5a')](_0x8b33('0x5f')+_0x6b519+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8b33('0x5e')](_0x6b519);}return _0x344e6c;})[_0x8b33('0x3a')](function(_0x42d144){if(!_0x42d144)throw new InternalError();return _0x42d144[_0x8b33('0x1f')]();})['then'](function(){_0x713b7e[_0x8b33('0x16')](0xcc)[_0x8b33('0x17')]();})[_0x8b33('0x3f')](handleError(_0x713b7e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 34c660b..e17606a 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 _0x438b=['ScreenRecording','screen_recordings','interactionid','util','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2106f8,_0x2c93c2){var _0x583655=function(_0x3a43be){while(--_0x3a43be){_0x2106f8['push'](_0x2106f8['shift']());}};_0x583655(++_0x2c93c2);}(_0x438b,0x67));var _0xb438=function(_0x4a60da,_0x30f27c){_0x4a60da=_0x4a60da-0x0;var _0x33b9f8=_0x438b[_0x4a60da];return _0x33b9f8;};'use strict';var _=require('lodash');var util=require(_0xb438('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb438('0x1'));var rp=require(_0xb438('0x2'));var fs=require('fs');var path=require(_0xb438('0x3'));var rimraf=require('rimraf');var config=require(_0xb438('0x4'));var attributes=require('./screenRecording.attributes');module[_0xb438('0x5')]=function(_0x401248,_0x69489d){return _0x401248[_0xb438('0x6')](_0xb438('0x7'),attributes,{'tableName':_0xb438('0x8'),'paranoid':![],'indexes':[{'name':_0xb438('0x9'),'fields':[_0xb438('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb337=['exports','screen_recordings','interactionid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xb337,0x175));var _0x7b33=function(_0x143e88,_0x55e4ae){_0x143e88=_0x143e88-0x0;var _0x7509af=_0xb337[_0x143e88];return _0x7509af;};'use strict';var _=require(_0x7b33('0x0'));var util=require(_0x7b33('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7b33('0x2'));var BPromise=require(_0x7b33('0x3'));var rp=require(_0x7b33('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b33('0x5'));var config=require(_0x7b33('0x6'));var attributes=require('./screenRecording.attributes');module[_0x7b33('0x7')]=function(_0x470fb0,_0x5b1ff9){return _0x470fb0['define']('ScreenRecording',attributes,{'tableName':_0x7b33('0x8'),'paranoid':![],'indexes':[{'name':_0x7b33('0x9'),'fields':[_0x7b33('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ead5d12..8132f77 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(_0x213a21,_0x33374a){var _0x2e912a=function(_0xeef62c){while(--_0xeef62c){_0x213a21['push'](_0x213a21['shift']());}};_0x2e912a(++_0x33374a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4491d9,_0x23fdc2){var _0x350fd1=function(_0x518d27){while(--_0x518d27){_0x4491d9['push'](_0x4491d9['shift']());}};_0x350fd1(++_0x23fdc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 290acf6..8eb97e9 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 _0x3350=['format','%s%s','logo','extname','post','single','addLogo','diskStorage','logologin','originalname','file','addLogoLogin','preferred','addPreferred','favicon','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','join','root','server/files/images/logos/'];(function(_0x1e05fb,_0x4b5db9){var _0x3abdde=function(_0x4371cf){while(--_0x4371cf){_0x1e05fb['push'](_0x1e05fb['shift']());}};_0x3abdde(++_0x4b5db9);}(_0x3350,0x83));var _0x0335=function(_0xc85033,_0x4e7f90){_0xc85033=_0xc85033-0x0;var _0xb76a4f=_0x3350[_0xc85033];return _0xb76a4f;};'use strict';var multer=require(_0x0335('0x0'));var util=require(_0x0335('0x1'));var path=require(_0x0335('0x2'));var timeout=require(_0x0335('0x3'));var express=require(_0x0335('0x4'));var router=express[_0x0335('0x5')]();var auth=require(_0x0335('0x6'));var interaction=require(_0x0335('0x7'));var config=require(_0x0335('0x8'));var controller=require('./setting.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0335('0x9')]);router[_0x0335('0xa')]('/:id',controller[_0x0335('0xb')]);router['get'](_0x0335('0xc'),controller['getLogo']);router[_0x0335('0xa')](_0x0335('0xd'),controller[_0x0335('0xe')]);router[_0x0335('0xa')](_0x0335('0xf'),controller['gdpr']);router['get'](_0x0335('0x10'),controller['getPreferred']);router[_0x0335('0xa')](_0x0335('0x11'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24d71a,_0x2eb7ce,_0x2d7799){_0x2d7799(null,path[_0x0335('0x12')](config[_0x0335('0x13')],_0x0335('0x14')));},'filename':function(_0x3624e9,_0x37318b,_0x396afa){_0x396afa(null,util[_0x0335('0x15')](_0x0335('0x16'),_0x0335('0x17'),path[_0x0335('0x18')](_0x37318b['originalname'])));}})});router[_0x0335('0x19')](_0x0335('0xc'),upload[_0x0335('0x1a')]('file'),controller[_0x0335('0x1b')]);var upload=multer({'storage':multer[_0x0335('0x1c')]({'destination':function(_0x47743d,_0x32019c,_0x39f630){_0x39f630(null,path[_0x0335('0x12')](config[_0x0335('0x13')],'server/files/images/logos/'));},'filename':function(_0x50813c,_0x54a895,_0x5d3e3c){_0x5d3e3c(null,util[_0x0335('0x15')](_0x0335('0x16'),_0x0335('0x1d'),path[_0x0335('0x18')](_0x54a895[_0x0335('0x1e')])));}})});router[_0x0335('0x19')](_0x0335('0xd'),upload[_0x0335('0x1a')](_0x0335('0x1f')),controller[_0x0335('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xab6f9d,_0x517133,_0x530d62){_0x530d62(null,path[_0x0335('0x12')](config[_0x0335('0x13')],_0x0335('0x14')));},'filename':function(_0x1157ee,_0x95a67a,_0x19ea07){_0x19ea07(null,util[_0x0335('0x15')](_0x0335('0x16'),_0x0335('0x21'),path['extname'](_0x95a67a['originalname'])));}})});router[_0x0335('0x19')](_0x0335('0x10'),upload[_0x0335('0x1a')]('file'),controller[_0x0335('0x22')]);var upload=multer({'storage':multer[_0x0335('0x1c')]({'destination':function(_0x3ab207,_0xa0625f,_0x4ed082){_0x4ed082(null,path['join'](config[_0x0335('0x13')],_0x0335('0x14')));},'filename':function(_0x57c820,_0x701aba,_0x124728){_0x124728(null,util['format'](_0x0335('0x16'),_0x0335('0x23'),path[_0x0335('0x18')](_0x701aba['originalname'])));}})});router[_0x0335('0x19')]('/:id/favicon',upload['single'](_0x0335('0x1f')),controller['addFavicon']);router['put']('/:id',auth[_0x0335('0x24')](),controller['update']);module[_0x0335('0x25')]=router; \ No newline at end of file +var _0xd499=['getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','single','file','addLogo','server/files/images/logos/','logologin','post','addLogoLogin','favicon','addFavicon','put','update','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login'];(function(_0xfaf333,_0x28ced4){var _0x445deb=function(_0xf48ae0){while(--_0xf48ae0){_0xfaf333['push'](_0xfaf333['shift']());}};_0x445deb(++_0x28ced4);}(_0xd499,0xc3));var _0x9d49=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0xd499[_0x594e11];return _0x5418ad;};'use strict';var multer=require(_0x9d49('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9d49('0x1'));var express=require('express');var router=express[_0x9d49('0x2')]();var auth=require(_0x9d49('0x3'));var interaction=require(_0x9d49('0x4'));var config=require(_0x9d49('0x5'));var controller=require(_0x9d49('0x6'));router[_0x9d49('0x7')]('/',auth[_0x9d49('0x8')](),controller[_0x9d49('0x9')]);router['get'](_0x9d49('0xa'),controller[_0x9d49('0xb')]);router[_0x9d49('0x7')](_0x9d49('0xc'),controller[_0x9d49('0xd')]);router[_0x9d49('0x7')](_0x9d49('0xe'),controller[_0x9d49('0xf')]);router[_0x9d49('0x7')](_0x9d49('0x10'),controller[_0x9d49('0x11')]);router['get'](_0x9d49('0x12'),controller[_0x9d49('0x13')]);router[_0x9d49('0x7')](_0x9d49('0x14'),controller[_0x9d49('0x15')]);var upload=multer({'storage':multer[_0x9d49('0x16')]({'destination':function(_0x2d64ca,_0x1a9982,_0x590fd3){_0x590fd3(null,path[_0x9d49('0x17')](config[_0x9d49('0x18')],'server/files/images/logos/'));},'filename':function(_0x322087,_0x4d637b,_0x27192e){_0x27192e(null,util[_0x9d49('0x19')](_0x9d49('0x1a'),_0x9d49('0x1b'),path[_0x9d49('0x1c')](_0x4d637b[_0x9d49('0x1d')])));}})});router['post'](_0x9d49('0xc'),upload[_0x9d49('0x1e')](_0x9d49('0x1f')),controller[_0x9d49('0x20')]);var upload=multer({'storage':multer[_0x9d49('0x16')]({'destination':function(_0x60f2fb,_0x160c22,_0x2ed4dd){_0x2ed4dd(null,path['join'](config[_0x9d49('0x18')],_0x9d49('0x21')));},'filename':function(_0x3c67b0,_0x358ea0,_0x5026c0){_0x5026c0(null,util[_0x9d49('0x19')](_0x9d49('0x1a'),_0x9d49('0x22'),path[_0x9d49('0x1c')](_0x358ea0['originalname'])));}})});router[_0x9d49('0x23')]('/:id/logo_login',upload[_0x9d49('0x1e')](_0x9d49('0x1f')),controller[_0x9d49('0x24')]);var upload=multer({'storage':multer[_0x9d49('0x16')]({'destination':function(_0x3b2879,_0x76b25c,_0x416ffc){_0x416ffc(null,path[_0x9d49('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x34161d,_0xa4c49c,_0x39c5a4){_0x39c5a4(null,util[_0x9d49('0x19')](_0x9d49('0x1a'),'preferred',path[_0x9d49('0x1c')](_0xa4c49c[_0x9d49('0x1d')])));}})});router[_0x9d49('0x23')](_0x9d49('0x12'),upload['single'](_0x9d49('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x9d49('0x16')]({'destination':function(_0x1c1602,_0xd980b6,_0x491c1){_0x491c1(null,path[_0x9d49('0x17')](config[_0x9d49('0x18')],'server/files/images/logos/'));},'filename':function(_0x372ed2,_0x2bcacd,_0x3e9b19){_0x3e9b19(null,util[_0x9d49('0x19')](_0x9d49('0x1a'),_0x9d49('0x25'),path[_0x9d49('0x1c')](_0x2bcacd['originalname'])));}})});router[_0x9d49('0x23')](_0x9d49('0x14'),upload[_0x9d49('0x1e')](_0x9d49('0x1f')),controller[_0x9d49('0x26')]);router[_0x9d49('0x27')](_0x9d49('0xa'),auth['isAuthenticated'](),controller[_0x9d49('0x28')]);module[_0x9d49('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 40e4913..dbc0263 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 _0xa42f=['exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa42f,0x19d));var _0xfa42=function(_0x595faf,_0x3c2d14){_0x595faf=_0x595faf-0x0;var _0x130cf2=_0xa42f[_0x595faf];return _0x130cf2;};'use strict';var Sequelize=require(_0xfa42('0x0'));module[_0xfa42('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xfa42('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xfa42('0x3')](0xb),'unique':_0xfa42('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xfa42('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xfa42('0x5')],'defaultValue':_0xfa42('0x6')},'logo':{'type':Sequelize[_0xfa42('0x5')]},'defaultLogo':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xfa42('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xfa42('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xfa42('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xfa42('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xfa42('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xfa42('0x5')],'defaultValue':_0xfa42('0x8')},'enableEmailPreview':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xfa42('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xfa42('0x5')]},'defaultFavicon':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xfa42('0x3')]},'transcribeRegion':{'type':Sequelize[_0xfa42('0x5')]},'sentiment':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xfa42('0x3')]},'sentimentRegion':{'type':Sequelize[_0xfa42('0x5')]},'language':{'type':Sequelize[_0xfa42('0x5')]},'bucket':{'type':Sequelize[_0xfa42('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ad9=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5ad9,0x158));var _0x95ad=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5ad9[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x95ad('0x0'));module[_0x95ad('0x1')]={'min_internal':{'type':Sequelize[_0x95ad('0x2')](0xb),'unique':_0x95ad('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x95ad('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x95ad('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x95ad('0x5')]},'defaultLogo':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x95ad('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x95ad('0x5')]},'turnaddr':{'type':Sequelize[_0x95ad('0x5')]},'turnusername':{'type':Sequelize[_0x95ad('0x5')]},'turnpassword':{'type':Sequelize[_0x95ad('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x95ad('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x95ad('0x5')],'defaultValue':_0x95ad('0x7')},'enableEmailPreview':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x95ad('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x95ad('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x95ad('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x95ad('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x95ad('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x95ad('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x95ad('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x95ad('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x95ad('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x95ad('0x5')]},'defaultFavicon':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x95ad('0x5')]},'sentiment':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x95ad('0x2')]},'sentimentRegion':{'type':Sequelize[_0x95ad('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x95ad('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x95ad('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0b4dd6d..5dc2c63 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 _0x0fbd=['keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','length','options','find','body','params','file','filename','logo','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','set','json','apply','reject','update','destroy','name','index','map','Setting','rawAttributes','fieldName','key','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0fbd,0x125));var _0xd0fb=function(_0x3025e7,_0x105d6a){_0x3025e7=_0x3025e7-0x0;var _0x4dae32=_0x0fbd[_0x3025e7];return _0x4dae32;};'use strict';var pdf=require(_0xd0fb('0x0'));var emlformat=require(_0xd0fb('0x1'));var rimraf=require(_0xd0fb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0fb('0x3'));var rp=require(_0xd0fb('0x4'));var moment=require(_0xd0fb('0x5'));var BPromise=require(_0xd0fb('0x6'));var Mustache=require(_0xd0fb('0x7'));var util=require(_0xd0fb('0x8'));var path=require('path');var sox=require(_0xd0fb('0x9'));var csv=require('to-csv');var ejs=require(_0xd0fb('0xa'));var fs=require('fs');var _=require(_0xd0fb('0xb'));var squel=require(_0xd0fb('0xc'));var crypto=require(_0xd0fb('0xd'));var jsforce=require(_0xd0fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd0fb('0xf'));var querystring=require(_0xd0fb('0x10'));var Papa=require(_0xd0fb('0x11'));var Redis=require(_0xd0fb('0x12'));var authService=require(_0xd0fb('0x13'));var qs=require(_0xd0fb('0x14'));var as=require(_0xd0fb('0x15'));var hardwareService=require(_0xd0fb('0x16'));var logger=require(_0xd0fb('0x17'))(_0xd0fb('0x18'));var utils=require('../../config/utils');var config=require(_0xd0fb('0x19'));var db=require(_0xd0fb('0x1a'))['db'];var jayson=require(_0xd0fb('0x1b'));var client=jayson[_0xd0fb('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x57a60a,_0xf859a7,_0x1acd14){if(_0x1acd14){var _0x306e75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x306e75['test'](_0xf859a7)){return _0x57a60a;}else{throw new db[(_0xd0fb('0x1d'))][(_0xd0fb('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 _0x57a60a;}}function respondWithRpcPromise(_0x4b0643,_0x3930bd,_0x3f60ce,_0x39cf61){return new BPromise(function(_0xf01745,_0x510bdf){var _0x4152ae=_0x39cf61||client;return _0x4152ae[_0xd0fb('0x1f')](_0x4b0643,_0x3f60ce)[_0xd0fb('0x20')](function(_0x3c32a2){logger[_0xd0fb('0x21')]('Setting,\x20%s,\x20%s',_0x3930bd,_0xd0fb('0x22'));logger[_0xd0fb('0x23')](_0xd0fb('0x24'),_0x3930bd,_0xd0fb('0x22'),JSON[_0xd0fb('0x25')](_0x3c32a2));if(_0x3c32a2[_0xd0fb('0x26')]){if(_0x3c32a2[_0xd0fb('0x26')]['code']===0x1f4){logger[_0xd0fb('0x26')](_0xd0fb('0x27'),_0x3930bd,_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);return _0x510bdf(_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);}logger[_0xd0fb('0x26')]('Setting,\x20%s,\x20%s',_0x3930bd,_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);return _0xf01745(_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3930bd,_0xd0fb('0x22'));_0xf01745(_0x3c32a2[_0xd0fb('0x29')][_0xd0fb('0x28')]);}})['catch'](function(_0x162cea){logger[_0xd0fb('0x26')](_0xd0fb('0x27'),_0x3930bd,_0x162cea);_0x510bdf(_0x162cea);});});}function respondWithStatusCode(_0x2f654f,_0x31dc1f){_0x31dc1f=_0x31dc1f||0xcc;return function(_0x1c762c){if(_0x1c762c){return _0x2f654f[_0xd0fb('0x2a')](_0x31dc1f);}return _0x2f654f[_0xd0fb('0x2b')](_0x31dc1f)[_0xd0fb('0x2c')]();};}function respondWithResult(_0x4fd2f4,_0x3c35f9){_0x3c35f9=_0x3c35f9||0xc8;return function(_0x36751d){if(_0x36751d){return _0x4fd2f4[_0xd0fb('0x2b')](_0x3c35f9)['json'](_0x36751d);}};}function respondWithFilteredResult(_0x36c01b,_0x21a080){return function(_0x367641){if(_0x367641){var _0xd114ad=_0x367641[_0xd0fb('0x2d')],_0xaf2e60=_0x21a080['offset'],_0x5083ae=_0x21a080[_0xd0fb('0x2e')]+_0x21a080['limit'],_0xec2d8f;if(_0x5083ae>=_0xd114ad){_0x5083ae=_0xd114ad;_0xec2d8f=0xc8;}else{_0xec2d8f=0xce;}_0x36c01b['status'](_0xec2d8f);return _0x36c01b[_0xd0fb('0x2f')]('Content-Range',_0xaf2e60+'-'+_0x5083ae+'/'+_0xd114ad)[_0xd0fb('0x30')](_0x367641);}return null;};}function patchUpdates(_0xb9481e){return function(_0x20a4ca){try{jsonpatch[_0xd0fb('0x31')](_0x20a4ca,_0xb9481e,!![]);}catch(_0x1f4fd2){return BPromise[_0xd0fb('0x32')](_0x1f4fd2);}return _0x20a4ca['save']();};}function saveUpdates(_0x1d2623,_0x4ba9db){return function(_0x4da6cc){if(_0x4da6cc){return _0x4da6cc[_0xd0fb('0x33')](_0x1d2623)['then'](function(_0x445cb2){return _0x445cb2;});}return null;};}function removeEntity(_0x2d911d,_0x3787fe){return function(_0x108f8a){if(_0x108f8a){return _0x108f8a[_0xd0fb('0x34')]()[_0xd0fb('0x20')](function(){_0x2d911d[_0xd0fb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4427,_0x569fd5){return function(_0x10820d){if(!_0x10820d){_0x2b4427['sendStatus'](0x194);}return _0x10820d;};}function handleError(_0x3303cf,_0x38c14f){_0x38c14f=_0x38c14f||0x1f4;return function(_0x103b95){logger[_0xd0fb('0x26')](_0x103b95['stack']);if(_0x103b95[_0xd0fb('0x35')]){delete _0x103b95['name'];}_0x3303cf[_0xd0fb('0x2b')](_0x38c14f)['send'](_0x103b95);};}exports[_0xd0fb('0x36')]=function(_0x10aa74,_0x36ac4e){var _0xde1c8b={},_0x5675aa={},_0x2a190d={'count':0x0,'rows':[]};var _0x25a71a=_[_0xd0fb('0x37')](db[_0xd0fb('0x38')][_0xd0fb('0x39')],function(_0x5cbf2f){return{'name':_0x5cbf2f[_0xd0fb('0x3a')],'type':_0x5cbf2f['type'][_0xd0fb('0x3b')]};});_0x5675aa['model']=_[_0xd0fb('0x37')](_0x25a71a,_0xd0fb('0x35'));_0x5675aa[_0xd0fb('0x3c')]=_[_0xd0fb('0x3d')](_0x10aa74[_0xd0fb('0x3c')]);_0x5675aa[_0xd0fb('0x3e')]=_[_0xd0fb('0x3f')](_0x5675aa[_0xd0fb('0x40')],_0x5675aa[_0xd0fb('0x3c')]);_0xde1c8b[_0xd0fb('0x41')]=_['intersection'](_0x5675aa[_0xd0fb('0x40')],qs[_0xd0fb('0x42')](_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x42')]));_0xde1c8b[_0xd0fb('0x41')]=_0xde1c8b[_0xd0fb('0x41')]['length']?_0xde1c8b[_0xd0fb('0x41')]:_0x5675aa[_0xd0fb('0x40')];if(!_0x10aa74['query'][_0xd0fb('0x43')](_0xd0fb('0x44'))){_0xde1c8b['limit']=qs['limit'](_0x10aa74[_0xd0fb('0x3c')]['limit']);_0xde1c8b['offset']=qs[_0xd0fb('0x2e')](_0x10aa74[_0xd0fb('0x3c')]['offset']);}_0xde1c8b[_0xd0fb('0x45')]=qs['sort'](_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x46')]);_0xde1c8b[_0xd0fb('0x47')]=qs['filters'](_[_0xd0fb('0x48')](_0x10aa74['query'],_0x5675aa[_0xd0fb('0x3e')]),_0x25a71a);if(_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x49')]){_0xde1c8b[_0xd0fb('0x47')]=_[_0xd0fb('0x4a')](_0xde1c8b[_0xd0fb('0x47')],{'$or':_['map'](_0x25a71a,function(_0x33ad67){if(_0x33ad67[_0xd0fb('0x4b')]!=='VIRTUAL'){var _0x1a467f={};_0x1a467f[_0x33ad67[_0xd0fb('0x35')]]={'$like':'%'+_0x10aa74['query'][_0xd0fb('0x49')]+'%'};return _0x1a467f;}})});}_0xde1c8b=_[_0xd0fb('0x4a')]({},_0xde1c8b,_0x10aa74['options']);var _0x2642a9={'where':_0xde1c8b[_0xd0fb('0x47')]};return db[_0xd0fb('0x38')]['count'](_0x2642a9)['then'](function(_0x1617bc){_0x2a190d[_0xd0fb('0x2d')]=_0x1617bc;if(_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x4c')]){_0xde1c8b[_0xd0fb('0x4d')]=[{'all':!![]}];}return db[_0xd0fb('0x38')]['findAll'](_0xde1c8b);})[_0xd0fb('0x20')](function(_0x25ec9b){_0x2a190d[_0xd0fb('0x4e')]=_0x25ec9b;return _0x2a190d;})[_0xd0fb('0x20')](respondWithFilteredResult(_0x36ac4e,_0xde1c8b))[_0xd0fb('0x4f')](handleError(_0x36ac4e,null));};exports[_0xd0fb('0x50')]=function(_0x1f2d4c,_0x5b9636){var _0x33ccde={'raw':![],'where':{'id':_0x1f2d4c['params']['id']}},_0x22fc28={};_0x22fc28[_0xd0fb('0x40')]=_['keys'](db[_0xd0fb('0x38')]['rawAttributes']);_0x22fc28[_0xd0fb('0x3c')]=_[_0xd0fb('0x3d')](_0x1f2d4c['query']);_0x22fc28[_0xd0fb('0x3e')]=_[_0xd0fb('0x3f')](_0x22fc28[_0xd0fb('0x40')],_0x22fc28[_0xd0fb('0x3c')]);_0x33ccde[_0xd0fb('0x41')]=_[_0xd0fb('0x3f')](_0x22fc28['model'],qs[_0xd0fb('0x42')](_0x1f2d4c[_0xd0fb('0x3c')][_0xd0fb('0x42')]));_0x33ccde[_0xd0fb('0x41')]=_0x33ccde['attributes'][_0xd0fb('0x51')]?_0x33ccde[_0xd0fb('0x41')]:_0x22fc28[_0xd0fb('0x40')];if(_0x1f2d4c[_0xd0fb('0x3c')][_0xd0fb('0x4c')]){_0x33ccde[_0xd0fb('0x4d')]=[{'all':!![]}];}_0x33ccde=_[_0xd0fb('0x4a')]({},_0x33ccde,_0x1f2d4c[_0xd0fb('0x52')]);return db[_0xd0fb('0x38')][_0xd0fb('0x53')](_0x33ccde)['then'](handleEntityNotFound(_0x5b9636,null))['then'](respondWithResult(_0x5b9636,null))[_0xd0fb('0x4f')](handleError(_0x5b9636,null));};exports['update']=function(_0x328fbf,_0x1ce39e){if(_0x328fbf[_0xd0fb('0x54')]['id']){delete _0x328fbf['body']['id'];}return db['Setting'][_0xd0fb('0x53')]({'where':{'id':_0x328fbf[_0xd0fb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ce39e,null))[_0xd0fb('0x20')](saveUpdates(_0x328fbf[_0xd0fb('0x54')],null))['then'](respondWithResult(_0x1ce39e,null))[_0xd0fb('0x4f')](handleError(_0x1ce39e,null));};exports['addLogo']=function(_0x113e0f,_0x4b42f5,_0x46c7b1){if(_0x113e0f[_0xd0fb('0x56')]&&_0x113e0f['file'][_0xd0fb('0x57')]){_0x113e0f['body'][_0xd0fb('0x58')]=_0x113e0f['file'][_0xd0fb('0x57')];}return db['Setting']['find']({'where':{'id':_0x113e0f['params']['id']}})[_0xd0fb('0x20')](handleEntityNotFound(_0x4b42f5,null))[_0xd0fb('0x20')](saveUpdates(_0x113e0f['body'],null))[_0xd0fb('0x20')](respondWithResult(_0x4b42f5,null))[_0xd0fb('0x4f')](handleError(_0x4b42f5,null));};exports['addLogoLogin']=function(_0x316b3b,_0x35a87,_0x346851){if(_0x316b3b['file']&&_0x316b3b[_0xd0fb('0x56')]['filename']){_0x316b3b[_0xd0fb('0x54')][_0xd0fb('0x59')]=_0x316b3b[_0xd0fb('0x56')]['filename'];}return db[_0xd0fb('0x38')][_0xd0fb('0x53')]({'where':{'id':_0x316b3b['params']['id']}})['then'](handleEntityNotFound(_0x35a87,null))['then'](saveUpdates(_0x316b3b[_0xd0fb('0x54')],null))[_0xd0fb('0x20')](respondWithResult(_0x35a87,null))[_0xd0fb('0x4f')](handleError(_0x35a87,null));};var utilLicense=require(_0xd0fb('0x5a'));exports[_0xd0fb('0x5b')]=function(_0x36de7c,_0x5a7801,_0x2d48ef){var _0x59f31b='server/files/images/logos';var _0x3b1d49={'custom':![]};return utilLicense[_0xd0fb('0x5c')]()['then'](function(_0x4da2c8){if(_0x4da2c8){_0x3b1d49=_0x4da2c8;}return db[_0xd0fb('0x38')][_0xd0fb('0x53')]({'where':{'id':_0x36de7c['params']['id']},'attributes':[_0xd0fb('0x58'),_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),_0xd0fb('0x60'),_0xd0fb('0x61'),'defaultFavicon'],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x5a7801,null))['then'](function(_0x7392bb){if(_0x7392bb){var _0x3a6985=_0x7392bb['logo']&&fs['existsSync'](path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')](_0x7392bb['logo'])))?path['join'](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')](_0x7392bb['logo'])):path['join'](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')](_0xd0fb('0x65')));var _0x13f610=_0xd0fb('0x66')+_[_0xd0fb('0x67')](_0xd0fb('0x58'));if(_0x7392bb[_0x13f610]||!_0x3b1d49[_0xd0fb('0x68')]){_0x3a6985=path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')]('default_logo.svg'));}if(!fs[_0xd0fb('0x69')](_0x3a6985)){throw new db['Sequelize'][(_0xd0fb('0x1e'))](_[_0xd0fb('0x67')](_0xd0fb('0x58'))+_0xd0fb('0x6a'));}return _0x5a7801[_0xd0fb('0x6b')](_0x3a6985);}})['catch'](handleError(_0x5a7801,null));};var utilLicense=require(_0xd0fb('0x5a'));exports[_0xd0fb('0x6c')]=function(_0x37e839,_0x45221c,_0x41a947){var _0x21c399=_0xd0fb('0x6d');var _0xe7a6e2={'custom':![]};return utilLicense['getLicense']()[_0xd0fb('0x20')](function(_0x3743db){if(_0x3743db){_0xe7a6e2=_0x3743db;}return db['Setting'][_0xd0fb('0x53')]({'where':{'id':_0x37e839[_0xd0fb('0x55')]['id']},'attributes':[_0xd0fb('0x58'),_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),'defaultLoginLogo',_0xd0fb('0x61'),_0xd0fb('0x6e')],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x45221c,null))[_0xd0fb('0x20')](function(_0x58dea6){if(_0x58dea6){var _0xc1c841=_0x58dea6[_0xd0fb('0x59')]&&fs[_0xd0fb('0x69')](path[_0xd0fb('0x62')](config['root'],_0x21c399,_[_0xd0fb('0x64')](_0x58dea6['loginLogo'])))?path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x21c399,_[_0xd0fb('0x64')](_0x58dea6['loginLogo'])):path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x21c399,_[_0xd0fb('0x64')](_0xd0fb('0x6f')));var _0xa9c8ae='default'+_[_0xd0fb('0x67')](_0xd0fb('0x59'));if(_0x58dea6[_0xa9c8ae]||!_0xe7a6e2[_0xd0fb('0x68')]){_0xc1c841=path['join'](config[_0xd0fb('0x63')],_0x21c399,_['toLower'](_0xd0fb('0x6f')));}if(!fs['existsSync'](_0xc1c841)){throw new db[(_0xd0fb('0x1d'))][(_0xd0fb('0x1e'))](_[_0xd0fb('0x67')](_0xd0fb('0x59'))+_0xd0fb('0x6a'));}return _0x45221c[_0xd0fb('0x6b')](_0xc1c841);}})[_0xd0fb('0x4f')](handleError(_0x45221c,null));};exports[_0xd0fb('0x70')]=function(_0xc842f0,_0x14c5b8){return db[_0xd0fb('0x38')]['find']({'where':{'id':_0xc842f0[_0xd0fb('0x55')]['id']},'attributes':[_0xd0fb('0x71')]})[_0xd0fb('0x20')](respondWithResult(_0x14c5b8,null))[_0xd0fb('0x4f')](handleError(_0x14c5b8,null));};exports[_0xd0fb('0x72')]=function(_0x3b953b,_0x3e7c17,_0x3419ff){if(_0x3b953b[_0xd0fb('0x56')]&&_0x3b953b[_0xd0fb('0x56')][_0xd0fb('0x57')]){_0x3b953b[_0xd0fb('0x54')][_0xd0fb('0x5d')]=_0x3b953b[_0xd0fb('0x56')][_0xd0fb('0x57')];}return db[_0xd0fb('0x38')]['find']({'where':{'id':_0x3b953b[_0xd0fb('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e7c17,null))[_0xd0fb('0x20')](saveUpdates(_0x3b953b['body'],null))[_0xd0fb('0x20')](respondWithResult(_0x3e7c17,null))[_0xd0fb('0x4f')](handleError(_0x3e7c17,null));};var utilLicense=require(_0xd0fb('0x5a'));exports['getPreferred']=function(_0x2f47ee,_0x346ea1,_0x4b67ac){var _0x557167=_0xd0fb('0x6d');var _0x4fc5dd={'custom':![]};return utilLicense[_0xd0fb('0x5c')]()[_0xd0fb('0x20')](function(_0x5f0823){if(_0x5f0823){_0x4fc5dd=_0x5f0823;}return db['Setting']['find']({'where':{'id':_0x2f47ee[_0xd0fb('0x55')]['id']},'attributes':['logo',_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),_0xd0fb('0x60'),_0xd0fb('0x61'),_0xd0fb('0x6e')],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x346ea1,null))[_0xd0fb('0x20')](function(_0x5430ad){if(_0x5430ad){var _0x3424d3=_0x5430ad[_0xd0fb('0x5d')]&&fs[_0xd0fb('0x69')](path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x557167,_[_0xd0fb('0x64')](_0x5430ad[_0xd0fb('0x5d')])))?path[_0xd0fb('0x62')](config['root'],_0x557167,_['toLower'](_0x5430ad['preferred'])):path['join'](config[_0xd0fb('0x63')],_0x557167,_['toLower'](_0xd0fb('0x73')));var _0xfc2052=_0xd0fb('0x66')+_[_0xd0fb('0x67')](_0xd0fb('0x5d'));if(_0x5430ad[_0xfc2052]||!_0x4fc5dd['custom']||!_0x4fc5dd[_0xd0fb('0x5d')]){_0x3424d3=path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x557167,_[_0xd0fb('0x64')](_0xd0fb('0x73')));}if(!fs[_0xd0fb('0x69')](_0x3424d3)){throw new db[(_0xd0fb('0x1d'))]['ValidationError'](_[_0xd0fb('0x67')](_0xd0fb('0x5d'))+_0xd0fb('0x6a'));}return _0x346ea1['download'](_0x3424d3);}})[_0xd0fb('0x4f')](handleError(_0x346ea1,null));};exports[_0xd0fb('0x74')]=function(_0x2a755f,_0x419116,_0x2346d0){if(_0x2a755f[_0xd0fb('0x56')]&&_0x2a755f[_0xd0fb('0x56')][_0xd0fb('0x57')]){_0x2a755f[_0xd0fb('0x54')]['favicon']=_0x2a755f['file'][_0xd0fb('0x57')];}return db['Setting'][_0xd0fb('0x53')]({'where':{'id':_0x2a755f[_0xd0fb('0x55')]['id']}})[_0xd0fb('0x20')](handleEntityNotFound(_0x419116,null))['then'](saveUpdates(_0x2a755f[_0xd0fb('0x54')],null))[_0xd0fb('0x20')](respondWithResult(_0x419116,null))[_0xd0fb('0x4f')](handleError(_0x419116,null));};var utilLicense=require(_0xd0fb('0x5a'));exports['getFavicon']=function(_0x5e3bc7,_0x4a9a8b,_0x5dd350){var _0x5596b4='server/files/images/logos';var _0x26a62c={'custom':![]};return utilLicense[_0xd0fb('0x5c')]()['then'](function(_0x50f585){if(_0x50f585){_0x26a62c=_0x50f585;}return db[_0xd0fb('0x38')][_0xd0fb('0x53')]({'where':{'id':_0x5e3bc7[_0xd0fb('0x55')]['id']},'attributes':['logo',_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),'defaultLoginLogo',_0xd0fb('0x61'),_0xd0fb('0x6e')],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x4a9a8b,null))['then'](function(_0x53a824){if(_0x53a824){var _0x3b156b=_0x53a824[_0xd0fb('0x5e')]&&fs['existsSync'](path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x5596b4,_[_0xd0fb('0x64')](_0x53a824[_0xd0fb('0x5e')])))?path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x5596b4,_[_0xd0fb('0x64')](_0x53a824[_0xd0fb('0x5e')])):path['join'](config['root'],_0x5596b4,_[_0xd0fb('0x64')](_0xd0fb('0x75')));var _0x2b86e4=_0xd0fb('0x66')+_[_0xd0fb('0x67')](_0xd0fb('0x5e'));if(_0x53a824[_0x2b86e4]||!_0x26a62c['custom']){_0x3b156b=path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x5596b4,_[_0xd0fb('0x64')](_0xd0fb('0x75')));}if(!fs['existsSync'](_0x3b156b)){throw new db['Sequelize'][(_0xd0fb('0x1e'))](_[_0xd0fb('0x67')](_0xd0fb('0x5e'))+'\x20not\x20found');}return _0x4a9a8b[_0xd0fb('0x6b')](_0x3b156b);}})[_0xd0fb('0x4f')](handleError(_0x4a9a8b,null));}; \ No newline at end of file +var _0x89b1=['filter','options','Setting','includeAll','findAll','rows','show','params','keys','find','body','addLogo','file','logo','addLogoLogin','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','securePassword','addPreferred','default_preferred.png','addFavicon','html-pdf','rimraf','request-promise','mustache','util','path','sox','crypto','jsforce','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','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','rawAttributes','type','map','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x20e2e8,_0x17e10e){var _0x54f9a4=function(_0x53d1b5){while(--_0x53d1b5){_0x20e2e8['push'](_0x20e2e8['shift']());}};_0x54f9a4(++_0x17e10e);}(_0x89b1,0x18a));var _0x189b=function(_0x29b585,_0x512952){_0x29b585=_0x29b585-0x0;var _0x3d26c1=_0x89b1[_0x29b585];return _0x3d26c1;};'use strict';var pdf=require(_0x189b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x189b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x189b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x189b('0x3'));var util=require(_0x189b('0x4'));var path=require(_0x189b('0x5'));var sox=require(_0x189b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x189b('0x7'));var jsforce=require(_0x189b('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x189b('0x9'));var Papa=require('papaparse');var Redis=require(_0x189b('0xa'));var authService=require(_0x189b('0xb'));var qs=require(_0x189b('0xc'));var as=require(_0x189b('0xd'));var hardwareService=require(_0x189b('0xe'));var logger=require(_0x189b('0xf'))(_0x189b('0x10'));var utils=require(_0x189b('0x11'));var config=require(_0x189b('0x12'));var db=require(_0x189b('0x13'))['db'];var jayson=require(_0x189b('0x14'));var client=jayson[_0x189b('0x15')][_0x189b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x4ca076,_0x1fd74c,_0x58bc4a){if(_0x58bc4a){var _0x2dbc3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2dbc3a[_0x189b('0x17')](_0x1fd74c)){return _0x4ca076;}else{throw new db[(_0x189b('0x18'))][(_0x189b('0x19'))](_0x189b('0x1a'));}}else{return _0x4ca076;}}function respondWithRpcPromise(_0x41d408,_0x4b9ddc,_0x4f9b0b,_0x48e459){return new BPromise(function(_0x564060,_0x21a89c){var _0x23df00=_0x48e459||client;return _0x23df00['request'](_0x41d408,_0x4f9b0b)[_0x189b('0x1b')](function(_0x373bee){logger[_0x189b('0x1c')](_0x189b('0x1d'),_0x4b9ddc,_0x189b('0x1e'));logger[_0x189b('0x1f')](_0x189b('0x20'),_0x4b9ddc,'request\x20sent',JSON[_0x189b('0x21')](_0x373bee));if(_0x373bee[_0x189b('0x22')]){if(_0x373bee[_0x189b('0x22')][_0x189b('0x23')]===0x1f4){logger[_0x189b('0x22')](_0x189b('0x1d'),_0x4b9ddc,_0x373bee[_0x189b('0x22')][_0x189b('0x24')]);return _0x21a89c(_0x373bee[_0x189b('0x22')][_0x189b('0x24')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4b9ddc,_0x373bee[_0x189b('0x22')]['message']);return _0x564060(_0x373bee[_0x189b('0x22')][_0x189b('0x24')]);}else{logger[_0x189b('0x1c')](_0x189b('0x1d'),_0x4b9ddc,'request\x20sent');_0x564060(_0x373bee[_0x189b('0x25')][_0x189b('0x24')]);}})[_0x189b('0x26')](function(_0x346834){logger['error'](_0x189b('0x1d'),_0x4b9ddc,_0x346834);_0x21a89c(_0x346834);});});}function respondWithStatusCode(_0x2a17dd,_0x530580){_0x530580=_0x530580||0xcc;return function(_0x2b12db){if(_0x2b12db){return _0x2a17dd[_0x189b('0x27')](_0x530580);}return _0x2a17dd[_0x189b('0x28')](_0x530580)[_0x189b('0x29')]();};}function respondWithResult(_0x508bf7,_0xb2d7ca){_0xb2d7ca=_0xb2d7ca||0xc8;return function(_0x1a1ec0){if(_0x1a1ec0){return _0x508bf7[_0x189b('0x28')](_0xb2d7ca)[_0x189b('0x2a')](_0x1a1ec0);}};}function respondWithFilteredResult(_0x43450e,_0x4cdd07){return function(_0x1cfff3){if(_0x1cfff3){var _0x21b4db=_0x1cfff3[_0x189b('0x2b')],_0x4fb9f5=_0x4cdd07[_0x189b('0x2c')],_0x371825=_0x4cdd07[_0x189b('0x2c')]+_0x4cdd07[_0x189b('0x2d')],_0x3f376a;if(_0x371825>=_0x21b4db){_0x371825=_0x21b4db;_0x3f376a=0xc8;}else{_0x3f376a=0xce;}_0x43450e[_0x189b('0x28')](_0x3f376a);return _0x43450e[_0x189b('0x2e')](_0x189b('0x2f'),_0x4fb9f5+'-'+_0x371825+'/'+_0x21b4db)['json'](_0x1cfff3);}return null;};}function patchUpdates(_0x3041a2){return function(_0x1b259f){try{jsonpatch[_0x189b('0x30')](_0x1b259f,_0x3041a2,!![]);}catch(_0x4eb579){return BPromise[_0x189b('0x31')](_0x4eb579);}return _0x1b259f[_0x189b('0x32')]();};}function saveUpdates(_0x4e5a1f,_0x424fa5){return function(_0x4296be){if(_0x4296be){return _0x4296be[_0x189b('0x33')](_0x4e5a1f)['then'](function(_0x229451){return _0x229451;});}return null;};}function removeEntity(_0x30dc92,_0x127206){return function(_0x17aa85){if(_0x17aa85){return _0x17aa85[_0x189b('0x34')]()[_0x189b('0x1b')](function(){_0x30dc92[_0x189b('0x28')](0xcc)[_0x189b('0x29')]();});}};}function handleEntityNotFound(_0x1050c4,_0x3f4023){return function(_0x23eebe){if(!_0x23eebe){_0x1050c4[_0x189b('0x27')](0x194);}return _0x23eebe;};}function handleError(_0x1e698d,_0x9792f2){_0x9792f2=_0x9792f2||0x1f4;return function(_0x1dc5d1){logger['error'](_0x1dc5d1[_0x189b('0x35')]);if(_0x1dc5d1[_0x189b('0x36')]){delete _0x1dc5d1[_0x189b('0x36')];}_0x1e698d['status'](_0x9792f2)[_0x189b('0x37')](_0x1dc5d1);};}exports['index']=function(_0x5de340,_0x43202a){var _0x3f0c0f={},_0xc36c3e={},_0x55f875={'count':0x0,'rows':[]};var _0x961808=_['map'](db['Setting'][_0x189b('0x38')],function(_0x5f5db3){return{'name':_0x5f5db3['fieldName'],'type':_0x5f5db3[_0x189b('0x39')]['key']};});_0xc36c3e['model']=_[_0x189b('0x3a')](_0x961808,'name');_0xc36c3e['query']=_['keys'](_0x5de340['query']);_0xc36c3e[_0x189b('0x3b')]=_[_0x189b('0x3c')](_0xc36c3e[_0x189b('0x3d')],_0xc36c3e[_0x189b('0x3e')]);_0x3f0c0f['attributes']=_[_0x189b('0x3c')](_0xc36c3e[_0x189b('0x3d')],qs[_0x189b('0x3f')](_0x5de340[_0x189b('0x3e')][_0x189b('0x3f')]));_0x3f0c0f[_0x189b('0x40')]=_0x3f0c0f[_0x189b('0x40')][_0x189b('0x41')]?_0x3f0c0f[_0x189b('0x40')]:_0xc36c3e[_0x189b('0x3d')];if(!_0x5de340[_0x189b('0x3e')][_0x189b('0x42')](_0x189b('0x43'))){_0x3f0c0f[_0x189b('0x2d')]=qs[_0x189b('0x2d')](_0x5de340[_0x189b('0x3e')][_0x189b('0x2d')]);_0x3f0c0f[_0x189b('0x2c')]=qs['offset'](_0x5de340['query']['offset']);}_0x3f0c0f[_0x189b('0x44')]=qs[_0x189b('0x45')](_0x5de340['query'][_0x189b('0x45')]);_0x3f0c0f[_0x189b('0x46')]=qs[_0x189b('0x3b')](_[_0x189b('0x47')](_0x5de340['query'],_0xc36c3e['filters']),_0x961808);if(_0x5de340[_0x189b('0x3e')]['filter']){_0x3f0c0f[_0x189b('0x46')]=_[_0x189b('0x48')](_0x3f0c0f[_0x189b('0x46')],{'$or':_[_0x189b('0x3a')](_0x961808,function(_0x546682){if(_0x546682[_0x189b('0x39')]!==_0x189b('0x49')){var _0x19eca3={};_0x19eca3[_0x546682[_0x189b('0x36')]]={'$like':'%'+_0x5de340[_0x189b('0x3e')][_0x189b('0x4a')]+'%'};return _0x19eca3;}})});}_0x3f0c0f=_['merge']({},_0x3f0c0f,_0x5de340[_0x189b('0x4b')]);var _0x5a886e={'where':_0x3f0c0f[_0x189b('0x46')]};return db[_0x189b('0x4c')][_0x189b('0x2b')](_0x5a886e)[_0x189b('0x1b')](function(_0x3bb403){_0x55f875['count']=_0x3bb403;if(_0x5de340[_0x189b('0x3e')][_0x189b('0x4d')]){_0x3f0c0f['include']=[{'all':!![]}];}return db[_0x189b('0x4c')][_0x189b('0x4e')](_0x3f0c0f);})['then'](function(_0x4cf399){_0x55f875[_0x189b('0x4f')]=_0x4cf399;return _0x55f875;})[_0x189b('0x1b')](respondWithFilteredResult(_0x43202a,_0x3f0c0f))[_0x189b('0x26')](handleError(_0x43202a,null));};exports[_0x189b('0x50')]=function(_0x1f66eb,_0xc3273b){var _0x500472={'raw':![],'where':{'id':_0x1f66eb[_0x189b('0x51')]['id']}},_0x188e34={};_0x188e34[_0x189b('0x3d')]=_[_0x189b('0x52')](db[_0x189b('0x4c')]['rawAttributes']);_0x188e34[_0x189b('0x3e')]=_['keys'](_0x1f66eb[_0x189b('0x3e')]);_0x188e34[_0x189b('0x3b')]=_['intersection'](_0x188e34[_0x189b('0x3d')],_0x188e34[_0x189b('0x3e')]);_0x500472['attributes']=_[_0x189b('0x3c')](_0x188e34[_0x189b('0x3d')],qs['fields'](_0x1f66eb[_0x189b('0x3e')]['fields']));_0x500472[_0x189b('0x40')]=_0x500472['attributes'][_0x189b('0x41')]?_0x500472['attributes']:_0x188e34[_0x189b('0x3d')];if(_0x1f66eb[_0x189b('0x3e')][_0x189b('0x4d')]){_0x500472['include']=[{'all':!![]}];}_0x500472=_[_0x189b('0x48')]({},_0x500472,_0x1f66eb[_0x189b('0x4b')]);return db[_0x189b('0x4c')][_0x189b('0x53')](_0x500472)['then'](handleEntityNotFound(_0xc3273b,null))[_0x189b('0x1b')](respondWithResult(_0xc3273b,null))[_0x189b('0x26')](handleError(_0xc3273b,null));};exports['update']=function(_0x7c1c3e,_0x4d6327){if(_0x7c1c3e[_0x189b('0x54')]['id']){delete _0x7c1c3e[_0x189b('0x54')]['id'];}return db['Setting'][_0x189b('0x53')]({'where':{'id':_0x7c1c3e[_0x189b('0x51')]['id']}})['then'](handleEntityNotFound(_0x4d6327,null))[_0x189b('0x1b')](saveUpdates(_0x7c1c3e[_0x189b('0x54')],null))[_0x189b('0x1b')](respondWithResult(_0x4d6327,null))[_0x189b('0x26')](handleError(_0x4d6327,null));};exports[_0x189b('0x55')]=function(_0x7c6348,_0x54cf3e,_0x1060af){if(_0x7c6348[_0x189b('0x56')]&&_0x7c6348[_0x189b('0x56')]['filename']){_0x7c6348['body'][_0x189b('0x57')]=_0x7c6348[_0x189b('0x56')]['filename'];}return db[_0x189b('0x4c')][_0x189b('0x53')]({'where':{'id':_0x7c6348[_0x189b('0x51')]['id']}})[_0x189b('0x1b')](handleEntityNotFound(_0x54cf3e,null))[_0x189b('0x1b')](saveUpdates(_0x7c6348[_0x189b('0x54')],null))['then'](respondWithResult(_0x54cf3e,null))[_0x189b('0x26')](handleError(_0x54cf3e,null));};exports[_0x189b('0x58')]=function(_0x316a04,_0x11c872,_0x213709){if(_0x316a04['file']&&_0x316a04['file'][_0x189b('0x59')]){_0x316a04[_0x189b('0x54')][_0x189b('0x5a')]=_0x316a04[_0x189b('0x56')][_0x189b('0x59')];}return db[_0x189b('0x4c')][_0x189b('0x53')]({'where':{'id':_0x316a04[_0x189b('0x51')]['id']}})[_0x189b('0x1b')](handleEntityNotFound(_0x11c872,null))[_0x189b('0x1b')](saveUpdates(_0x316a04[_0x189b('0x54')],null))[_0x189b('0x1b')](respondWithResult(_0x11c872,null))[_0x189b('0x26')](handleError(_0x11c872,null));};var utilLicense=require(_0x189b('0x5b'));exports[_0x189b('0x5c')]=function(_0x1e300e,_0x167df2,_0x43de0a){var _0x3cda77=_0x189b('0x5d');var _0x1e797c={'custom':![]};return utilLicense[_0x189b('0x5e')]()[_0x189b('0x1b')](function(_0x1c77b9){if(_0x1c77b9){_0x1e797c=_0x1c77b9;}return db[_0x189b('0x4c')]['find']({'where':{'id':_0x1e300e[_0x189b('0x51')]['id']},'attributes':[_0x189b('0x57'),_0x189b('0x5a'),_0x189b('0x5f'),_0x189b('0x60'),_0x189b('0x61'),_0x189b('0x62'),_0x189b('0x63'),'defaultFavicon'],'raw':!![]});})[_0x189b('0x1b')](handleEntityNotFound(_0x167df2,null))[_0x189b('0x1b')](function(_0x307a92){if(_0x307a92){var _0x3051d0=_0x307a92[_0x189b('0x57')]&&fs[_0x189b('0x64')](path[_0x189b('0x65')](config[_0x189b('0x66')],_0x3cda77,_[_0x189b('0x67')](_0x307a92['logo'])))?path['join'](config[_0x189b('0x66')],_0x3cda77,_['toLower'](_0x307a92['logo'])):path['join'](config[_0x189b('0x66')],_0x3cda77,_[_0x189b('0x67')](_0x189b('0x68')));var _0x4171d3=_0x189b('0x69')+_[_0x189b('0x6a')](_0x189b('0x57'));if(_0x307a92[_0x4171d3]||!_0x1e797c[_0x189b('0x6b')]){_0x3051d0=path[_0x189b('0x65')](config[_0x189b('0x66')],_0x3cda77,_[_0x189b('0x67')](_0x189b('0x68')));}if(!fs[_0x189b('0x64')](_0x3051d0)){throw new db['Sequelize'][(_0x189b('0x19'))](_['upperFirst'](_0x189b('0x57'))+_0x189b('0x6c'));}return _0x167df2[_0x189b('0x6d')](_0x3051d0);}})['catch'](handleError(_0x167df2,null));};var utilLicense=require(_0x189b('0x5b'));exports[_0x189b('0x6e')]=function(_0x5067a8,_0x466695,_0x392b67){var _0x5c9872=_0x189b('0x5d');var _0x538723={'custom':![]};return utilLicense[_0x189b('0x5e')]()[_0x189b('0x1b')](function(_0x4c7d7f){if(_0x4c7d7f){_0x538723=_0x4c7d7f;}return db[_0x189b('0x4c')]['find']({'where':{'id':_0x5067a8[_0x189b('0x51')]['id']},'attributes':[_0x189b('0x57'),_0x189b('0x5a'),_0x189b('0x5f'),_0x189b('0x60'),_0x189b('0x61'),_0x189b('0x62'),_0x189b('0x63'),_0x189b('0x6f')],'raw':!![]});})[_0x189b('0x1b')](handleEntityNotFound(_0x466695,null))[_0x189b('0x1b')](function(_0x4c4018){if(_0x4c4018){var _0x413b10=_0x4c4018['loginLogo']&&fs[_0x189b('0x64')](path[_0x189b('0x65')](config['root'],_0x5c9872,_[_0x189b('0x67')](_0x4c4018['loginLogo'])))?path['join'](config['root'],_0x5c9872,_[_0x189b('0x67')](_0x4c4018[_0x189b('0x5a')])):path[_0x189b('0x65')](config[_0x189b('0x66')],_0x5c9872,_[_0x189b('0x67')]('default_loginLogo.svg'));var _0x4cbe59=_0x189b('0x69')+_['upperFirst'](_0x189b('0x5a'));if(_0x4c4018[_0x4cbe59]||!_0x538723[_0x189b('0x6b')]){_0x413b10=path[_0x189b('0x65')](config[_0x189b('0x66')],_0x5c9872,_[_0x189b('0x67')](_0x189b('0x70')));}if(!fs[_0x189b('0x64')](_0x413b10)){throw new db[(_0x189b('0x18'))][(_0x189b('0x19'))](_[_0x189b('0x6a')](_0x189b('0x5a'))+_0x189b('0x6c'));}return _0x466695['download'](_0x413b10);}})[_0x189b('0x26')](handleError(_0x466695,null));};exports['gdpr']=function(_0x528918,_0x2038ef){return db[_0x189b('0x4c')][_0x189b('0x53')]({'where':{'id':_0x528918[_0x189b('0x51')]['id']},'attributes':[_0x189b('0x71')]})[_0x189b('0x1b')](respondWithResult(_0x2038ef,null))['catch'](handleError(_0x2038ef,null));};exports[_0x189b('0x72')]=function(_0x518f9c,_0x20fe0c,_0x3a381f){if(_0x518f9c[_0x189b('0x56')]&&_0x518f9c[_0x189b('0x56')][_0x189b('0x59')]){_0x518f9c[_0x189b('0x54')][_0x189b('0x5f')]=_0x518f9c['file'][_0x189b('0x59')];}return db[_0x189b('0x4c')][_0x189b('0x53')]({'where':{'id':_0x518f9c[_0x189b('0x51')]['id']}})[_0x189b('0x1b')](handleEntityNotFound(_0x20fe0c,null))[_0x189b('0x1b')](saveUpdates(_0x518f9c['body'],null))[_0x189b('0x1b')](respondWithResult(_0x20fe0c,null))['catch'](handleError(_0x20fe0c,null));};var utilLicense=require(_0x189b('0x5b'));exports['getPreferred']=function(_0x5c43b4,_0x125562,_0x40788b){var _0x434722='server/files/images/logos';var _0x362508={'custom':![]};return utilLicense[_0x189b('0x5e')]()['then'](function(_0x546610){if(_0x546610){_0x362508=_0x546610;}return db[_0x189b('0x4c')]['find']({'where':{'id':_0x5c43b4[_0x189b('0x51')]['id']},'attributes':[_0x189b('0x57'),_0x189b('0x5a'),'preferred',_0x189b('0x60'),_0x189b('0x61'),_0x189b('0x62'),'defaultPreferred',_0x189b('0x6f')],'raw':!![]});})[_0x189b('0x1b')](handleEntityNotFound(_0x125562,null))['then'](function(_0x5ebd69){if(_0x5ebd69){var _0x1fa33c=_0x5ebd69[_0x189b('0x5f')]&&fs['existsSync'](path['join'](config[_0x189b('0x66')],_0x434722,_[_0x189b('0x67')](_0x5ebd69[_0x189b('0x5f')])))?path['join'](config[_0x189b('0x66')],_0x434722,_[_0x189b('0x67')](_0x5ebd69[_0x189b('0x5f')])):path[_0x189b('0x65')](config[_0x189b('0x66')],_0x434722,_[_0x189b('0x67')]('default_preferred.png'));var _0x3bc194=_0x189b('0x69')+_['upperFirst'](_0x189b('0x5f'));if(_0x5ebd69[_0x3bc194]||!_0x362508[_0x189b('0x6b')]||!_0x362508['preferred']){_0x1fa33c=path['join'](config[_0x189b('0x66')],_0x434722,_['toLower'](_0x189b('0x73')));}if(!fs[_0x189b('0x64')](_0x1fa33c)){throw new db[(_0x189b('0x18'))][(_0x189b('0x19'))](_['upperFirst'](_0x189b('0x5f'))+_0x189b('0x6c'));}return _0x125562['download'](_0x1fa33c);}})[_0x189b('0x26')](handleError(_0x125562,null));};exports[_0x189b('0x74')]=function(_0x5b0046,_0x400cc4,_0x3070ce){if(_0x5b0046[_0x189b('0x56')]&&_0x5b0046[_0x189b('0x56')]['filename']){_0x5b0046[_0x189b('0x54')]['favicon']=_0x5b0046[_0x189b('0x56')]['filename'];}return db['Setting']['find']({'where':{'id':_0x5b0046[_0x189b('0x51')]['id']}})['then'](handleEntityNotFound(_0x400cc4,null))['then'](saveUpdates(_0x5b0046[_0x189b('0x54')],null))[_0x189b('0x1b')](respondWithResult(_0x400cc4,null))[_0x189b('0x26')](handleError(_0x400cc4,null));};var utilLicense=require(_0x189b('0x5b'));exports['getFavicon']=function(_0xb25278,_0x3b9b6c,_0xde8a6c){var _0x58875c=_0x189b('0x5d');var _0x399166={'custom':![]};return utilLicense[_0x189b('0x5e')]()[_0x189b('0x1b')](function(_0x41aada){if(_0x41aada){_0x399166=_0x41aada;}return db[_0x189b('0x4c')][_0x189b('0x53')]({'where':{'id':_0xb25278['params']['id']},'attributes':[_0x189b('0x57'),'loginLogo',_0x189b('0x5f'),_0x189b('0x60'),_0x189b('0x61'),_0x189b('0x62'),_0x189b('0x63'),_0x189b('0x6f')],'raw':!![]});})['then'](handleEntityNotFound(_0x3b9b6c,null))[_0x189b('0x1b')](function(_0x48daf8){if(_0x48daf8){var _0x18a040=_0x48daf8[_0x189b('0x60')]&&fs[_0x189b('0x64')](path[_0x189b('0x65')](config[_0x189b('0x66')],_0x58875c,_['toLower'](_0x48daf8['favicon'])))?path[_0x189b('0x65')](config[_0x189b('0x66')],_0x58875c,_['toLower'](_0x48daf8['favicon'])):path[_0x189b('0x65')](config[_0x189b('0x66')],_0x58875c,_[_0x189b('0x67')]('default_favicon.ico'));var _0x197010=_0x189b('0x69')+_[_0x189b('0x6a')](_0x189b('0x60'));if(_0x48daf8[_0x197010]||!_0x399166[_0x189b('0x6b')]){_0x18a040=path[_0x189b('0x65')](config[_0x189b('0x66')],_0x58875c,_[_0x189b('0x67')]('default_favicon.ico'));}if(!fs[_0x189b('0x64')](_0x18a040)){throw new db[(_0x189b('0x18'))][(_0x189b('0x19'))](_[_0x189b('0x6a')](_0x189b('0x60'))+_0x189b('0x6c'));}return _0x3b9b6c[_0x189b('0x6d')](_0x18a040);}})[_0x189b('0x26')](handleError(_0x3b9b6c,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2e868a9..c6f91d0 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 _0x6d8b=['rimraf','../../config/environment','./setting.attributes','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x1c7f5a,_0x4bd7c7){var _0xca6269=function(_0xdf406b){while(--_0xdf406b){_0x1c7f5a['push'](_0x1c7f5a['shift']());}};_0xca6269(++_0x4bd7c7);}(_0x6d8b,0x156));var _0xb6d8=function(_0x3126af,_0x1486cb){_0x3126af=_0x3126af-0x0;var _0x97340c=_0x6d8b[_0x3126af];return _0x97340c;};'use strict';var _=require(_0xb6d8('0x0'));var util=require('util');var logger=require(_0xb6d8('0x1'))(_0xb6d8('0x2'));var moment=require(_0xb6d8('0x3'));var BPromise=require(_0xb6d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6d8('0x5'));var rimraf=require(_0xb6d8('0x6'));var config=require(_0xb6d8('0x7'));var attributes=require(_0xb6d8('0x8'));module['exports']=function(_0x140acf,_0x341dc9){return _0x140acf[_0xb6d8('0x9')](_0xb6d8('0xa'),attributes,{'tableName':_0xb6d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66e=['moment','bluebird','path','rimraf','../../config/environment','exports','define','settings','lodash','../../config/logger'];(function(_0xc75d5b,_0x3e3907){var _0x46cbdd=function(_0x32cb77){while(--_0x32cb77){_0xc75d5b['push'](_0xc75d5b['shift']());}};_0x46cbdd(++_0x3e3907);}(_0xe66e,0x1b6));var _0xee66=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe66e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xee66('0x0'));var util=require('util');var logger=require(_0xee66('0x1'))('api');var moment=require(_0xee66('0x2'));var BPromise=require(_0xee66('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee66('0x4'));var rimraf=require(_0xee66('0x5'));var config=require(_0xee66('0x6'));var attributes=require('./setting.attributes');module[_0xee66('0x7')]=function(_0x3c4457,_0x291180){return _0x3c4457[_0xee66('0x8')]('Setting',attributes,{'tableName':_0xee66('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 55b7f4f..b842f40 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 _0x1b5a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x1b5a,0x125));var _0xa1b5=function(_0x19d2ce,_0x39490a){_0x19d2ce=_0x19d2ce-0x0;var _0x38a263=_0x1b5a[_0x19d2ce];return _0x38a263;};'use strict';var _=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var moment=require('moment');var BPromise=require(_0xa1b5('0x2'));var rs=require(_0xa1b5('0x3'));var fs=require('fs');var Redis=require(_0xa1b5('0x4'));var db=require(_0xa1b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1b5('0x6'))(_0xa1b5('0x7'));var config=require(_0xa1b5('0x8'));var jayson=require(_0xa1b5('0x9'));var client=jayson[_0xa1b5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbf464,_0x305002,_0x1ef83b){return new BPromise(function(_0x159bc0,_0x560e8e){return client[_0xa1b5('0xb')](_0xbf464,_0x1ef83b)[_0xa1b5('0xc')](function(_0x1d2635){logger[_0xa1b5('0xd')](_0xa1b5('0xe'),_0x305002,'request\x20sent');logger[_0xa1b5('0xf')](_0xa1b5('0x10'),_0x305002,_0xa1b5('0x11'),JSON['stringify'](_0x1d2635));if(_0x1d2635[_0xa1b5('0x12')]){if(_0x1d2635[_0xa1b5('0x12')][_0xa1b5('0x13')]===0x1f4){logger[_0xa1b5('0x12')](_0xa1b5('0xe'),_0x305002,_0x1d2635['error'][_0xa1b5('0x14')]);return _0x560e8e(_0x1d2635[_0xa1b5('0x12')][_0xa1b5('0x14')]);}logger['error'](_0xa1b5('0xe'),_0x305002,_0x1d2635[_0xa1b5('0x12')][_0xa1b5('0x14')]);return _0x159bc0(_0x1d2635[_0xa1b5('0x12')]['message']);}else{logger['info'](_0xa1b5('0xe'),_0x305002,_0xa1b5('0x11'));_0x159bc0(_0x1d2635[_0xa1b5('0x15')][_0xa1b5('0x14')]);}})[_0xa1b5('0x16')](function(_0x3137fe){logger['error']('Setting,\x20%s,\x20%s',_0x305002,_0x3137fe);_0x560e8e(_0x3137fe);});});} \ No newline at end of file +var _0xd5b8=['Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5d8fe7,_0xd030b0){var _0x52687c=function(_0x5e4449){while(--_0x5e4449){_0x5d8fe7['push'](_0x5d8fe7['shift']());}};_0x52687c(++_0xd030b0);}(_0xd5b8,0x171));var _0x8d5b=function(_0x227299,_0x3bf26b){_0x227299=_0x227299-0x0;var _0x4ff857=_0xd5b8[_0x227299];return _0x4ff857;};'use strict';var _=require(_0x8d5b('0x0'));var util=require(_0x8d5b('0x1'));var moment=require('moment');var BPromise=require(_0x8d5b('0x2'));var rs=require(_0x8d5b('0x3'));var fs=require('fs');var Redis=require(_0x8d5b('0x4'));var db=require(_0x8d5b('0x5'))['db'];var utils=require(_0x8d5b('0x6'));var logger=require(_0x8d5b('0x7'))(_0x8d5b('0x8'));var config=require(_0x8d5b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d5b('0xa')][_0x8d5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28de7a,_0x5332cc,_0x5df107){return new BPromise(function(_0x406488,_0x11d6e0){return client[_0x8d5b('0xc')](_0x28de7a,_0x5df107)[_0x8d5b('0xd')](function(_0xa78ea){logger[_0x8d5b('0xe')](_0x8d5b('0xf'),_0x5332cc,'request\x20sent');logger[_0x8d5b('0x10')](_0x8d5b('0x11'),_0x5332cc,_0x8d5b('0x12'),JSON[_0x8d5b('0x13')](_0xa78ea));if(_0xa78ea[_0x8d5b('0x14')]){if(_0xa78ea[_0x8d5b('0x14')]['code']===0x1f4){logger[_0x8d5b('0x14')]('Setting,\x20%s,\x20%s',_0x5332cc,_0xa78ea[_0x8d5b('0x14')][_0x8d5b('0x15')]);return _0x11d6e0(_0xa78ea[_0x8d5b('0x14')][_0x8d5b('0x15')]);}logger[_0x8d5b('0x14')]('Setting,\x20%s,\x20%s',_0x5332cc,_0xa78ea['error'][_0x8d5b('0x15')]);return _0x406488(_0xa78ea[_0x8d5b('0x14')]['message']);}else{logger[_0x8d5b('0xe')]('Setting,\x20%s,\x20%s',_0x5332cc,'request\x20sent');_0x406488(_0xa78ea[_0x8d5b('0x16')][_0x8d5b('0x15')]);}})[_0x8d5b('0x17')](function(_0x4a68d2){logger[_0x8d5b('0x14')](_0x8d5b('0xf'),_0x5332cc,_0x4a68d2);_0x11d6e0(_0x4a68d2);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5493880..2771490 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 _0x3980=['/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','send','/:id/status','status','addAgents','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','./smsAccount.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x3980,0xf3));var _0x0398=function(_0x27aaf2,_0x586ec1){_0x27aaf2=_0x27aaf2-0x0;var _0x14c15c=_0x3980[_0x27aaf2];return _0x14c15c;};'use strict';var multer=require(_0x0398('0x0'));var util=require(_0x0398('0x1'));var path=require(_0x0398('0x2'));var timeout=require('connect-timeout');var express=require(_0x0398('0x3'));var router=express[_0x0398('0x4')]();var auth=require(_0x0398('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0398('0x6'));router[_0x0398('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0398('0x7')](_0x0398('0x8'),auth['isAuthenticated'](),controller[_0x0398('0x9')]);router[_0x0398('0x7')](_0x0398('0xa'),auth[_0x0398('0xb')](),controller[_0x0398('0xc')]);router[_0x0398('0x7')]('/:id/dispositions',auth[_0x0398('0xb')](),controller['getDispositions']);router[_0x0398('0x7')](_0x0398('0xd'),auth[_0x0398('0xb')](),controller[_0x0398('0xe')]);router[_0x0398('0x7')](_0x0398('0xf'),auth[_0x0398('0xb')](),controller['getApplications']);router['get'](_0x0398('0x10'),auth['isAuthenticated'](),controller[_0x0398('0x11')]);router[_0x0398('0x7')]('/:id/status',controller[_0x0398('0x12')]);router['get'](_0x0398('0x13'),auth[_0x0398('0xb')](),controller[_0x0398('0x14')]);router[_0x0398('0x15')]('/',auth[_0x0398('0xb')](),controller['create']);router[_0x0398('0x15')](_0x0398('0x16'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x0398('0xd'),auth['isAuthenticated'](),controller[_0x0398('0x17')]);router[_0x0398('0x15')](_0x0398('0x18'),controller[_0x0398('0x19')]);router[_0x0398('0x15')](_0x0398('0xf'),auth['isAuthenticated'](),controller[_0x0398('0x1a')]);router[_0x0398('0x15')]('/:id/send',auth['isAuthenticated'](),controller[_0x0398('0x1b')]);router[_0x0398('0x15')](_0x0398('0x1c'),controller[_0x0398('0x1d')]);router[_0x0398('0x15')](_0x0398('0x13'),auth[_0x0398('0xb')](),controller[_0x0398('0x1e')]);router[_0x0398('0x1f')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0398('0x20')](_0x0398('0xa'),auth[_0x0398('0xb')](),controller[_0x0398('0x21')]);router[_0x0398('0x20')](_0x0398('0x16'),auth['isAuthenticated'](),controller[_0x0398('0x22')]);router['delete'](_0x0398('0xd'),auth[_0x0398('0xb')](),controller[_0x0398('0x23')]);router['delete'](_0x0398('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0398('0x24')]=router; \ No newline at end of file +var _0x3051=['/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','/:id/notify','addApplications','send','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/interactions','getInteractions'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x3051,0x85));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1305('0x0'));var express=require(_0x1305('0x1'));var router=express[_0x1305('0x2')]();var auth=require(_0x1305('0x3'));var interaction=require(_0x1305('0x4'));var config=require('../../config/environment');var controller=require(_0x1305('0x5'));router[_0x1305('0x6')]('/',auth[_0x1305('0x7')](),controller[_0x1305('0x8')]);router[_0x1305('0x6')](_0x1305('0x9'),auth[_0x1305('0x7')](),controller[_0x1305('0xa')]);router[_0x1305('0x6')](_0x1305('0xb'),auth[_0x1305('0x7')](),controller[_0x1305('0xc')]);router['get'](_0x1305('0xd'),auth[_0x1305('0x7')](),controller[_0x1305('0xe')]);router[_0x1305('0x6')]('/:id/canned_answers',auth[_0x1305('0x7')](),controller[_0x1305('0xf')]);router['get'](_0x1305('0x10'),auth[_0x1305('0x7')](),controller['getApplications']);router[_0x1305('0x6')](_0x1305('0x11'),auth[_0x1305('0x7')](),controller[_0x1305('0x12')]);router[_0x1305('0x6')](_0x1305('0x13'),controller[_0x1305('0x14')]);router[_0x1305('0x6')](_0x1305('0x15'),auth[_0x1305('0x7')](),controller[_0x1305('0x16')]);router[_0x1305('0x17')]('/',auth[_0x1305('0x7')](),controller[_0x1305('0x18')]);router[_0x1305('0x17')](_0x1305('0xd'),auth[_0x1305('0x7')](),controller[_0x1305('0x19')]);router[_0x1305('0x17')](_0x1305('0x1a'),auth[_0x1305('0x7')](),controller['addAnswer']);router[_0x1305('0x17')](_0x1305('0x1b'),controller['notify']);router[_0x1305('0x17')](_0x1305('0x10'),auth['isAuthenticated'](),controller[_0x1305('0x1c')]);router[_0x1305('0x17')]('/:id/send',auth[_0x1305('0x7')](),controller[_0x1305('0x1d')]);router[_0x1305('0x17')](_0x1305('0x13'),controller['status']);router[_0x1305('0x17')]('/:id/users',auth[_0x1305('0x7')](),controller[_0x1305('0x1e')]);router[_0x1305('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x1305('0x20')]);router['delete'](_0x1305('0xb'),auth['isAuthenticated'](),controller[_0x1305('0x21')]);router['delete']('/:id/dispositions',auth[_0x1305('0x7')](),controller[_0x1305('0x22')]);router[_0x1305('0x23')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1305('0x24')]);router['delete'](_0x1305('0x15'),auth[_0x1305('0x7')](),controller['removeAgents']);module[_0x1305('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 893b1f8..5e39c35 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 _0xf181=['skebby','clicksend','plivo','csc','infobip','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','twilio'];(function(_0x4762a8,_0x4d5cfe){var _0x436955=function(_0x7291fe){while(--_0x7291fe){_0x4762a8['push'](_0x4762a8['shift']());}};_0x436955(++_0x4d5cfe);}(_0xf181,0x6c));var _0x1f18=function(_0x50696d,_0xa93340){_0x50696d=_0x50696d-0x0;var _0x2449c2=_0xf181[_0x50696d];return _0x2449c2;};'use strict';var Sequelize=require(_0x1f18('0x0'));var rs=require(_0x1f18('0x1'));module[_0x1f18('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1f18('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1f18('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1f18('0x3')],'defaultValue':function(){return rs[_0x1f18('0x4')]();}},'phone':{'type':Sequelize[_0x1f18('0x3')]},'type':{'type':Sequelize['ENUM'](_0x1f18('0x5'),_0x1f18('0x6'),'connectel',_0x1f18('0x7'),_0x1f18('0x8'),'clickatell',_0x1f18('0x9'),_0x1f18('0xa'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x1f18('0x3')]},'authToken':{'type':Sequelize[_0x1f18('0x3')]},'smsMethod':{'type':Sequelize[_0x1f18('0xb')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1f18('0x3')]},'apiKey':{'type':Sequelize[_0x1f18('0x3')]},'senderString':{'type':Sequelize[_0x1f18('0x3')]},'deliveryReport':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x1f18('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1f18('0xd');}},'notificationSound':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f18('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f18('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f18('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1f18('0xf'),'set':function(_0x39db09){if(!_0x39db09)this[_0x1f18('0x10')](_0x1f18('0x11'),null);this[_0x1f18('0x10')](_0x1f18('0x12'),_0x39db09);}}}; \ No newline at end of file +var _0x5f39=['intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','infobip'];(function(_0x1176bd,_0x28190b){var _0x4b82d0=function(_0x1d5c14){while(--_0x1d5c14){_0x1176bd['push'](_0x1176bd['shift']());}};_0x4b82d0(++_0x28190b);}(_0x5f39,0x9b));var _0x95f3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5f39[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x95f3('0x0'));var rs=require(_0x95f3('0x1'));module[_0x95f3('0x2')]={'name':{'type':Sequelize[_0x95f3('0x3')],'unique':_0x95f3('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x95f3('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x95f3('0x5')]();}},'phone':{'type':Sequelize[_0x95f3('0x3')]},'type':{'type':Sequelize[_0x95f3('0x6')](_0x95f3('0x7'),_0x95f3('0x8'),_0x95f3('0x9'),_0x95f3('0xa'),'plivo',_0x95f3('0xb'),'csc',_0x95f3('0xc'),_0x95f3('0xd'))},'accountSid':{'type':Sequelize[_0x95f3('0x3')]},'authId':{'type':Sequelize[_0x95f3('0x3')]},'authToken':{'type':Sequelize[_0x95f3('0x3')]},'smsMethod':{'type':Sequelize[_0x95f3('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x95f3('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x95f3('0x3')]},'deliveryReport':{'type':Sequelize[_0x95f3('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x95f3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x95f3('0xf')],'defaultValue':function(){return _0x95f3('0x10');}},'notificationSound':{'type':Sequelize[_0x95f3('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x95f3('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x95f3('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x95f3('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x95f3('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x95f3('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x95f3('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x95f3('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x95f3('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x95f3('0xe')],'defaultValue':![],'comment':_0x95f3('0x12'),'set':function(_0x55bbdc){if(!_0x55bbdc)this[_0x95f3('0x13')](_0x95f3('0x14'),null);this[_0x95f3('0x13')]('mandatoryDisposition',_0x55bbdc);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c74f174..be1d37c 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x50ef6a,_0x1407e7){var _0x155d0b=function(_0x2d59b8){while(--_0x2d59b8){_0x50ef6a['push'](_0x50ef6a['shift']());}};_0x155d0b(++_0x1407e7);}(_0x7a54,0x106));var _0x47a5=function(_0x45dfac,_0x498178){_0x45dfac=_0x45dfac-0x0;var _0x59509a=_0x7a54[_0x45dfac];return _0x59509a;};'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 c90e8b0..912dce4 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 _0x1196=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x26e39b,_0x3195a5){var _0x33f2c3=function(_0xdf6431){while(--_0xdf6431){_0x26e39b['push'](_0x26e39b['shift']());}};_0x33f2c3(++_0x3195a5);}(_0x1196,0x173));var _0x6119=function(_0x210d9e,_0x450d25){_0x210d9e=_0x210d9e-0x0;var _0x36f7fc=_0x1196[_0x210d9e];return _0x36f7fc;};'use strict';var EventEmitter=require(_0x6119('0x0'));var SmsAccount=require(_0x6119('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6119('0x2')](0x0);var events={'afterCreate':_0x6119('0x3'),'afterUpdate':_0x6119('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18cde4){return function(_0x3f3192,_0x211d73,_0x4ecc78){SmsAccountEvents[_0x6119('0x5')](_0x18cde4+':'+_0x3f3192['id'],_0x3f3192);SmsAccountEvents[_0x6119('0x5')](_0x18cde4,_0x3f3192);_0x4ecc78(null);};}for(var e in events){if(events[_0x6119('0x6')](e)){var event=events[e];SmsAccount[_0x6119('0x7')](e,emitEvent(event));}}module[_0x6119('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x9e6e=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x44a582,_0x2f9173){var _0x26312c=function(_0x55befc){while(--_0x55befc){_0x44a582['push'](_0x44a582['shift']());}};_0x26312c(++_0x2f9173);}(_0x9e6e,0x160));var _0xe9e6=function(_0x57909e,_0x26084f){_0x57909e=_0x57909e-0x0;var _0x21d6cc=_0x9e6e[_0x57909e];return _0x21d6cc;};'use strict';var EventEmitter=require(_0xe9e6('0x0'));var SmsAccount=require(_0xe9e6('0x1'))['db'][_0xe9e6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe9e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9e6('0x4'),'afterDestroy':_0xe9e6('0x5')};function emitEvent(_0x446455){return function(_0x4a2f13,_0x13e652,_0x40b467){SmsAccountEvents['emit'](_0x446455+':'+_0x4a2f13['id'],_0x4a2f13);SmsAccountEvents[_0xe9e6('0x6')](_0x446455,_0x4a2f13);_0x40b467(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xe9e6('0x7')](e,emitEvent(event));}}module[_0xe9e6('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ce43fda..fa3f9c7 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(_0x164e8a,_0x55c331){var _0x3eb716=function(_0x352563){while(--_0x352563){_0x164e8a['push'](_0x164e8a['shift']());}};_0x3eb716(++_0x55c331);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x57b061,_0x210910){var _0x558991=function(_0x225ed9){while(--_0x225ed9){_0x57b061['push'](_0x57b061['shift']());}};_0x558991(++_0x210910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 d8799ac..8cbedff 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 _0x4872=['./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','SmsAccount','find','options','attributes','map','include','model','ShowSmsAccount','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter'];(function(_0x58cde7,_0x4fb3af){var _0x25d6d7=function(_0x236394){while(--_0x236394){_0x58cde7['push'](_0x58cde7['shift']());}};_0x25d6d7(++_0x4fb3af);}(_0x4872,0x1f0));var _0x2487=function(_0xf48d27,_0xc761af){_0xf48d27=_0xf48d27-0x0;var _0x172722=_0x4872[_0xf48d27];return _0x172722;};'use strict';var _=require(_0x2487('0x0'));var util=require(_0x2487('0x1'));var moment=require(_0x2487('0x2'));var BPromise=require('bluebird');var rs=require(_0x2487('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2487('0x4'))['db'];var utils=require(_0x2487('0x5'));var logger=require(_0x2487('0x6'))(_0x2487('0x7'));var config=require(_0x2487('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2487('0x9')][_0x2487('0xa')]({'port':0x232a});config[_0x2487('0xb')]=_[_0x2487('0xc')](config[_0x2487('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2487('0xd'))(new Redis(config[_0x2487('0xb')]));require(_0x2487('0xe'))['register'](socket);function respondWithRpcPromise(_0x379485,_0x3b243f,_0x23849f){return new BPromise(function(_0x27b472,_0x356e24){return client[_0x2487('0xf')](_0x379485,_0x23849f)[_0x2487('0x10')](function(_0x23e679){logger[_0x2487('0x11')](_0x2487('0x12'),_0x3b243f,_0x2487('0x13'));logger[_0x2487('0x14')](_0x2487('0x15'),_0x3b243f,_0x2487('0x13'),JSON['stringify'](_0x23e679));if(_0x23e679[_0x2487('0x16')]){if(_0x23e679[_0x2487('0x16')]['code']===0x1f4){logger[_0x2487('0x16')](_0x2487('0x12'),_0x3b243f,_0x23e679['error'][_0x2487('0x17')]);return _0x356e24(_0x23e679[_0x2487('0x16')]['message']);}logger['error'](_0x2487('0x12'),_0x3b243f,_0x23e679[_0x2487('0x16')]['message']);return _0x27b472(_0x23e679['error'][_0x2487('0x17')]);}else{logger[_0x2487('0x11')](_0x2487('0x12'),_0x3b243f,'request\x20sent');_0x27b472(_0x23e679[_0x2487('0x18')][_0x2487('0x17')]);}})['catch'](function(_0x46cbf1){logger['error'](_0x2487('0x12'),_0x3b243f,_0x46cbf1);_0x356e24(_0x46cbf1);});});}exports['ShowSmsAccount']=function(_0x3cf922){var _0x29120a=this;return new Promise(function(_0x52f097,_0x2f620b){return db[_0x2487('0x19')][_0x2487('0x1a')]({'raw':_0x3cf922['options']?_0x3cf922['options']['raw']===undefined?!![]:![]:!![],'where':_0x3cf922[_0x2487('0x1b')]?_0x3cf922['options']['where']||null:null,'attributes':_0x3cf922[_0x2487('0x1b')]?_0x3cf922[_0x2487('0x1b')][_0x2487('0x1c')]||null:null,'include':_0x3cf922[_0x2487('0x1b')]?_0x3cf922[_0x2487('0x1b')]['include']?_[_0x2487('0x1d')](_0x3cf922[_0x2487('0x1b')][_0x2487('0x1e')],function(_0x1895a5){return{'model':db[_0x1895a5[_0x2487('0x1f')]],'as':_0x1895a5['as'],'attributes':_0x1895a5['attributes'],'include':_0x1895a5[_0x2487('0x1e')]?_[_0x2487('0x1d')](_0x1895a5[_0x2487('0x1e')],function(_0x1a9995){return{'model':db[_0x1a9995[_0x2487('0x1f')]],'as':_0x1a9995['as'],'attributes':_0x1a9995['attributes'],'include':_0x1a9995[_0x2487('0x1e')]?_[_0x2487('0x1d')](_0x1a9995[_0x2487('0x1e')],function(_0x1268dd){return{'model':db[_0x1268dd['model']],'as':_0x1268dd['as'],'attributes':_0x1268dd[_0x2487('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2487('0x10')](function(_0x367af6){logger[_0x2487('0x11')](_0x2487('0x20'),_0x3cf922);logger['debug']('ShowSmsAccount',_0x3cf922,JSON['stringify'](_0x367af6));_0x52f097(_0x367af6);})[_0x2487('0x21')](function(_0x335d94){logger[_0x2487('0x16')](_0x2487('0x20'),_0x335d94[_0x2487('0x17')],_0x3cf922);_0x2f620b(_0x29120a[_0x2487('0x16')](0x1f4,_0x335d94[_0x2487('0x17')]));});});}; \ No newline at end of file +var _0xa8cc=['include','map','model','ShowSmsAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','SmsAccount,\x20%s,\x20%s','result','catch','find','options','raw','where','attributes'];(function(_0x7acb86,_0x2c146a){var _0x15fa39=function(_0x138d41){while(--_0x138d41){_0x7acb86['push'](_0x7acb86['shift']());}};_0x15fa39(++_0x2c146a);}(_0xa8cc,0x1f2));var _0xca8c=function(_0x46d8ba,_0x36da80){_0x46d8ba=_0x46d8ba-0x0;var _0x3fb559=_0xa8cc[_0x46d8ba];return _0x3fb559;};'use strict';var _=require(_0xca8c('0x0'));var util=require(_0xca8c('0x1'));var moment=require('moment');var BPromise=require(_0xca8c('0x2'));var rs=require(_0xca8c('0x3'));var fs=require('fs');var Redis=require(_0xca8c('0x4'));var db=require(_0xca8c('0x5'))['db'];var utils=require(_0xca8c('0x6'));var logger=require(_0xca8c('0x7'))(_0xca8c('0x8'));var config=require(_0xca8c('0x9'));var jayson=require(_0xca8c('0xa'));var client=jayson[_0xca8c('0xb')][_0xca8c('0xc')]({'port':0x232a});config[_0xca8c('0xd')]=_[_0xca8c('0xe')](config['redis'],{'host':_0xca8c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xca8c('0x10'))[_0xca8c('0x11')](socket);function respondWithRpcPromise(_0x582491,_0x494421,_0x20485c){return new BPromise(function(_0x3c3128,_0x4d0e9e){return client['request'](_0x582491,_0x20485c)[_0xca8c('0x12')](function(_0x3709ce){logger['info']('SmsAccount,\x20%s,\x20%s',_0x494421,_0xca8c('0x13'));logger[_0xca8c('0x14')](_0xca8c('0x15'),_0x494421,_0xca8c('0x13'),JSON[_0xca8c('0x16')](_0x3709ce));if(_0x3709ce[_0xca8c('0x17')]){if(_0x3709ce['error']['code']===0x1f4){logger[_0xca8c('0x17')]('SmsAccount,\x20%s,\x20%s',_0x494421,_0x3709ce[_0xca8c('0x17')][_0xca8c('0x18')]);return _0x4d0e9e(_0x3709ce[_0xca8c('0x17')]['message']);}logger[_0xca8c('0x17')]('SmsAccount,\x20%s,\x20%s',_0x494421,_0x3709ce[_0xca8c('0x17')][_0xca8c('0x18')]);return _0x3c3128(_0x3709ce[_0xca8c('0x17')][_0xca8c('0x18')]);}else{logger[_0xca8c('0x19')](_0xca8c('0x1a'),_0x494421,_0xca8c('0x13'));_0x3c3128(_0x3709ce[_0xca8c('0x1b')][_0xca8c('0x18')]);}})[_0xca8c('0x1c')](function(_0x352755){logger[_0xca8c('0x17')](_0xca8c('0x1a'),_0x494421,_0x352755);_0x4d0e9e(_0x352755);});});}exports['ShowSmsAccount']=function(_0x358c44){var _0x49f3c8=this;return new Promise(function(_0x45c8ae,_0x2509ce){return db['SmsAccount'][_0xca8c('0x1d')]({'raw':_0x358c44[_0xca8c('0x1e')]?_0x358c44['options'][_0xca8c('0x1f')]===undefined?!![]:![]:!![],'where':_0x358c44['options']?_0x358c44['options'][_0xca8c('0x20')]||null:null,'attributes':_0x358c44[_0xca8c('0x1e')]?_0x358c44[_0xca8c('0x1e')][_0xca8c('0x21')]||null:null,'include':_0x358c44['options']?_0x358c44[_0xca8c('0x1e')][_0xca8c('0x22')]?_[_0xca8c('0x23')](_0x358c44[_0xca8c('0x1e')][_0xca8c('0x22')],function(_0x59b5b2){return{'model':db[_0x59b5b2[_0xca8c('0x24')]],'as':_0x59b5b2['as'],'attributes':_0x59b5b2['attributes'],'include':_0x59b5b2['include']?_[_0xca8c('0x23')](_0x59b5b2[_0xca8c('0x22')],function(_0xf4b828){return{'model':db[_0xf4b828[_0xca8c('0x24')]],'as':_0xf4b828['as'],'attributes':_0xf4b828[_0xca8c('0x21')],'include':_0xf4b828[_0xca8c('0x22')]?_[_0xca8c('0x23')](_0xf4b828['include'],function(_0x5b9344){return{'model':db[_0x5b9344[_0xca8c('0x24')]],'as':_0x5b9344['as'],'attributes':_0x5b9344['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ef037){logger[_0xca8c('0x19')](_0xca8c('0x25'),_0x358c44);logger[_0xca8c('0x14')](_0xca8c('0x25'),_0x358c44,JSON[_0xca8c('0x16')](_0x5ef037));_0x45c8ae(_0x5ef037);})[_0xca8c('0x1c')](function(_0x1dd3b2){logger[_0xca8c('0x17')](_0xca8c('0x25'),_0x1dd3b2[_0xca8c('0x18')],_0x358c44);_0x2509ce(_0x49f3c8[_0xca8c('0x17')](0x1f4,_0x1dd3b2[_0xca8c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2c1fd6b..96d921a 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 _0x783c=['update','./smsAccount.events','remove'];(function(_0x39b4b2,_0x1573fb){var _0x515bff=function(_0x5b9f6e){while(--_0x5b9f6e){_0x39b4b2['push'](_0x39b4b2['shift']());}};_0x515bff(++_0x1573fb);}(_0x783c,0xaf));var _0xc783=function(_0x39f6c5,_0x3c28d9){_0x39f6c5=_0x39f6c5-0x0;var _0x200953=_0x783c[_0x39f6c5];return _0x200953;};'use strict';var SmsAccountEvents=require(_0xc783('0x0'));var events=['save',_0xc783('0x1'),_0xc783('0x2')];function createListener(_0x2ae078,_0x5ed5e1){return function(_0x215704){_0x5ed5e1['emit'](_0x2ae078,_0x215704);};}function removeListener(_0x19d54f,_0x3a9330){return function(){SmsAccountEvents['removeListener'](_0x19d54f,_0x3a9330);};}exports['register']=function(_0x547328){for(var _0x39731f=0x0,_0x4f8d2d=events['length'];_0x39731f<_0x4f8d2d;_0x39731f++){var _0x62cf50=events[_0x39731f];var _0x2ad159=createListener('smsAccount:'+_0x62cf50,_0x547328);SmsAccountEvents['on'](_0x62cf50,_0x2ad159);}}; \ No newline at end of file +var _0x95e0=['remove','emit','removeListener','register','smsAccount:'];(function(_0x20f6bd,_0x5388a2){var _0x2bac41=function(_0x3398fa){while(--_0x3398fa){_0x20f6bd['push'](_0x20f6bd['shift']());}};_0x2bac41(++_0x5388a2);}(_0x95e0,0x163));var _0x095e=function(_0x2f5fea,_0x1d30b1){_0x2f5fea=_0x2f5fea-0x0;var _0x388020=_0x95e0[_0x2f5fea];return _0x388020;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0x095e('0x0'),'update'];function createListener(_0x135f18,_0x37b611){return function(_0xf14bad){_0x37b611[_0x095e('0x1')](_0x135f18,_0xf14bad);};}function removeListener(_0x5668ff,_0x2ac786){return function(){SmsAccountEvents[_0x095e('0x2')](_0x5668ff,_0x2ac786);};}exports[_0x095e('0x3')]=function(_0x22a8c8){for(var _0x11f256=0x0,_0x56039e=events['length'];_0x11f256<_0x56039e;_0x11f256++){var _0x5b39e1=events[_0x11f256];var _0x50975c=createListener(_0x095e('0x4')+_0x5b39e1,_0x22a8c8);SmsAccountEvents['on'](_0x5b39e1,_0x50975c);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 851ff4c..adc8f3a 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 _0x07a4=['put','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x281056,_0x3cae15){var _0x3c3112=function(_0x241500){while(--_0x241500){_0x281056['push'](_0x281056['shift']());}};_0x3c3112(++_0x3cae15);}(_0x07a4,0xac));var _0x407a=function(_0x3447d4,_0x41f025){_0x3447d4=_0x3447d4-0x0;var _0xa921fd=_0x07a4[_0x3447d4];return _0xa921fd;};'use strict';var multer=require(_0x407a('0x0'));var util=require(_0x407a('0x1'));var path=require(_0x407a('0x2'));var timeout=require(_0x407a('0x3'));var express=require(_0x407a('0x4'));var router=express[_0x407a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x407a('0x6'));var config=require(_0x407a('0x7'));var controller=require('./smsApplication.controller');router[_0x407a('0x8')]('/',auth['isAuthenticated'](),controller[_0x407a('0x9')]);router[_0x407a('0x8')](_0x407a('0xa'),auth[_0x407a('0xb')](),controller[_0x407a('0xc')]);router[_0x407a('0xd')]('/',auth[_0x407a('0xb')](),controller[_0x407a('0xe')]);router[_0x407a('0xf')](_0x407a('0xa'),auth[_0x407a('0xb')](),controller['update']);router['delete'](_0x407a('0xa'),auth[_0x407a('0xb')](),controller[_0x407a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0323=['./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x452ed3,_0x8a2e28){var _0x170774=function(_0x5581c5){while(--_0x5581c5){_0x452ed3['push'](_0x452ed3['shift']());}};_0x170774(++_0x8a2e28);}(_0x0323,0x99));var _0x3032=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x0323[_0x35c1db];return _0x4173ff;};'use strict';var multer=require(_0x3032('0x0'));var util=require(_0x3032('0x1'));var path=require(_0x3032('0x2'));var timeout=require(_0x3032('0x3'));var express=require(_0x3032('0x4'));var router=express['Router']();var auth=require(_0x3032('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3032('0x6'));var controller=require(_0x3032('0x7'));router[_0x3032('0x8')]('/',auth[_0x3032('0x9')](),controller[_0x3032('0xa')]);router[_0x3032('0x8')](_0x3032('0xb'),auth[_0x3032('0x9')](),controller[_0x3032('0xc')]);router[_0x3032('0xd')]('/',auth[_0x3032('0x9')](),controller[_0x3032('0xe')]);router[_0x3032('0xf')](_0x3032('0xb'),auth[_0x3032('0x9')](),controller[_0x3032('0x10')]);router[_0x3032('0x11')](_0x3032('0xb'),auth['isAuthenticated'](),controller[_0x3032('0x12')]);module[_0x3032('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9d65466..b870659 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 _0xb669=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x26a2e0,_0x1b3d51){var _0x37d004=function(_0x109050){while(--_0x109050){_0x26a2e0['push'](_0x26a2e0['shift']());}};_0x37d004(++_0x1b3d51);}(_0xb669,0x11f));var _0x9b66=function(_0x389fb0,_0x40ccad){_0x389fb0=_0x389fb0-0x0;var _0x142b70=_0xb669[_0x389fb0];return _0x142b70;};'use strict';var Sequelize=require(_0x9b66('0x0'));module[_0x9b66('0x1')]={'priority':{'type':Sequelize[_0x9b66('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9b66('0x3')],'allowNull':![],'defaultValue':_0x9b66('0x4')},'appdata':{'type':Sequelize[_0x9b66('0x5')]()},'description':{'type':Sequelize[_0x9b66('0x3')]},'interval':{'type':Sequelize[_0x9b66('0x3')],'defaultValue':_0x9b66('0x6')}}; \ No newline at end of file +var _0xe080=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4d5d3c,_0x3ebac3){var _0x376188=function(_0x3b4200){while(--_0x3b4200){_0x4d5d3c['push'](_0x4d5d3c['shift']());}};_0x376188(++_0x3ebac3);}(_0xe080,0x90));var _0x0e08=function(_0x30491c,_0x33035f){_0x30491c=_0x30491c-0x0;var _0x15b19c=_0xe080[_0x30491c];return _0x15b19c;};'use strict';var Sequelize=require(_0x0e08('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0e08('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0e08('0x2')},'appdata':{'type':Sequelize[_0x0e08('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0e08('0x4')],'defaultValue':_0x0e08('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 384fe6c..de435af 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 _0xa30a=['body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa30('0x0'));var emlformat=require(_0xaa30('0x1'));var rimraf=require(_0xaa30('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa30('0x3'));var rp=require(_0xaa30('0x4'));var moment=require(_0xaa30('0x5'));var BPromise=require(_0xaa30('0x6'));var Mustache=require(_0xaa30('0x7'));var util=require(_0xaa30('0x8'));var path=require(_0xaa30('0x9'));var sox=require('sox');var csv=require(_0xaa30('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xa'));var querystring=require(_0xaa30('0xf'));var Papa=require(_0xaa30('0x10'));var Redis=require(_0xaa30('0x11'));var authService=require(_0xaa30('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x13'));var logger=require('../../config/logger')(_0xaa30('0x14'));var utils=require(_0xaa30('0x15'));var config=require(_0xaa30('0x16'));var db=require(_0xaa30('0x17'))['db'];function respondWithStatusCode(_0x589229,_0xec992f){_0xec992f=_0xec992f||0xcc;return function(_0x3de2d1){if(_0x3de2d1){return _0x589229[_0xaa30('0x18')](_0xec992f);}return _0x589229['status'](_0xec992f)[_0xaa30('0x19')]();};}function respondWithResult(_0xdea23a,_0x25c02e){_0x25c02e=_0x25c02e||0xc8;return function(_0x14de74){if(_0x14de74){return _0xdea23a[_0xaa30('0x1a')](_0x25c02e)[_0xaa30('0x1b')](_0x14de74);}};}function respondWithFilteredResult(_0x3240e9,_0x3b8095){return function(_0x2e37af){if(_0x2e37af){var _0xfae724=_0x2e37af['count'],_0x519518=_0x3b8095[_0xaa30('0x1c')],_0x91839d=_0x3b8095[_0xaa30('0x1c')]+_0x3b8095[_0xaa30('0x1d')],_0x591478;if(_0x91839d>=_0xfae724){_0x91839d=_0xfae724;_0x591478=0xc8;}else{_0x591478=0xce;}_0x3240e9['status'](_0x591478);return _0x3240e9['set']('Content-Range',_0x519518+'-'+_0x91839d+'/'+_0xfae724)[_0xaa30('0x1b')](_0x2e37af);}return null;};}function patchUpdates(_0x4acdfa){return function(_0xfb02ab){try{jsonpatch[_0xaa30('0x1e')](_0xfb02ab,_0x4acdfa,!![]);}catch(_0x48561d){return BPromise['reject'](_0x48561d);}return _0xfb02ab['save']();};}function saveUpdates(_0x3cbf92,_0x3e4f1d){return function(_0x61b85){if(_0x61b85){return _0x61b85[_0xaa30('0x1f')](_0x3cbf92)[_0xaa30('0x20')](function(_0x4aacfd){return _0x4aacfd;});}return null;};}function removeEntity(_0x3f6295,_0x24bb25){return function(_0x2e16e7){if(_0x2e16e7){return _0x2e16e7[_0xaa30('0x21')]()[_0xaa30('0x20')](function(){_0x3f6295['status'](0xcc)[_0xaa30('0x19')]();});}};}function handleEntityNotFound(_0x13128a,_0x2fecdd){return function(_0x326f84){if(!_0x326f84){_0x13128a['sendStatus'](0x194);}return _0x326f84;};}function handleError(_0x14d7fa,_0x1be54c){_0x1be54c=_0x1be54c||0x1f4;return function(_0x19ba52){logger[_0xaa30('0x22')](_0x19ba52[_0xaa30('0x23')]);if(_0x19ba52[_0xaa30('0x24')]){delete _0x19ba52['name'];}_0x14d7fa[_0xaa30('0x1a')](_0x1be54c)[_0xaa30('0x25')](_0x19ba52);};}exports['index']=function(_0xb043e4,_0x5b3efb){var _0x2da4da={},_0x33a0c9={},_0x2aabf8={'count':0x0,'rows':[]};var _0xd1eb3a=_[_0xaa30('0x26')](db[_0xaa30('0x27')][_0xaa30('0x28')],function(_0x39f708){return{'name':_0x39f708[_0xaa30('0x29')],'type':_0x39f708[_0xaa30('0x2a')][_0xaa30('0x2b')]};});_0x33a0c9[_0xaa30('0x2c')]=_[_0xaa30('0x26')](_0xd1eb3a,_0xaa30('0x24'));_0x33a0c9[_0xaa30('0x2d')]=_[_0xaa30('0x2e')](_0xb043e4[_0xaa30('0x2d')]);_0x33a0c9[_0xaa30('0x2f')]=_['intersection'](_0x33a0c9[_0xaa30('0x2c')],_0x33a0c9[_0xaa30('0x2d')]);_0x2da4da[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x33a0c9[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0xb043e4['query']['fields']));_0x2da4da['attributes']=_0x2da4da[_0xaa30('0x30')][_0xaa30('0x33')]?_0x2da4da[_0xaa30('0x30')]:_0x33a0c9[_0xaa30('0x2c')];if(!_0xb043e4[_0xaa30('0x2d')]['hasOwnProperty']('nolimit')){_0x2da4da[_0xaa30('0x1d')]=qs[_0xaa30('0x1d')](_0xb043e4['query'][_0xaa30('0x1d')]);_0x2da4da['offset']=qs[_0xaa30('0x1c')](_0xb043e4['query'][_0xaa30('0x1c')]);}_0x2da4da[_0xaa30('0x34')]=qs['sort'](_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x35')]);_0x2da4da[_0xaa30('0x36')]=qs[_0xaa30('0x2f')](_[_0xaa30('0x37')](_0xb043e4[_0xaa30('0x2d')],_0x33a0c9['filters']),_0xd1eb3a);if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]){_0x2da4da['where']=_[_0xaa30('0x39')](_0x2da4da[_0xaa30('0x36')],{'$or':_[_0xaa30('0x26')](_0xd1eb3a,function(_0x557012){if(_0x557012['type']!==_0xaa30('0x3a')){var _0x21ffb0={};_0x21ffb0[_0x557012[_0xaa30('0x24')]]={'$like':'%'+_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]+'%'};return _0x21ffb0;}})});}_0x2da4da=_[_0xaa30('0x39')]({},_0x2da4da,_0xb043e4['options']);var _0x5ca1b0={'where':_0x2da4da[_0xaa30('0x36')]};return db[_0xaa30('0x27')][_0xaa30('0x3b')](_0x5ca1b0)['then'](function(_0x244bca){_0x2aabf8[_0xaa30('0x3b')]=_0x244bca;if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x3c')]){_0x2da4da['include']=[{'all':!![]}];}return db[_0xaa30('0x27')][_0xaa30('0x3d')](_0x2da4da);})[_0xaa30('0x20')](function(_0x480795){_0x2aabf8[_0xaa30('0x3e')]=_0x480795;return _0x2aabf8;})['then'](respondWithFilteredResult(_0x5b3efb,_0x2da4da))[_0xaa30('0x3f')](handleError(_0x5b3efb,null));};exports[_0xaa30('0x40')]=function(_0x22dfa5,_0x7b6a6b){var _0x13f08f={'raw':!![],'where':{'id':_0x22dfa5[_0xaa30('0x41')]['id']}},_0x4478cc={};_0x4478cc[_0xaa30('0x2c')]=_['keys'](db['SmsApplication'][_0xaa30('0x28')]);_0x4478cc['query']=_['keys'](_0x22dfa5['query']);_0x4478cc[_0xaa30('0x2f')]=_['intersection'](_0x4478cc[_0xaa30('0x2c')],_0x4478cc['query']);_0x13f08f[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x4478cc[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0x22dfa5[_0xaa30('0x2d')][_0xaa30('0x32')]));_0x13f08f[_0xaa30('0x30')]=_0x13f08f[_0xaa30('0x30')][_0xaa30('0x33')]?_0x13f08f[_0xaa30('0x30')]:_0x4478cc[_0xaa30('0x2c')];if(_0x22dfa5['query'][_0xaa30('0x3c')]){_0x13f08f[_0xaa30('0x42')]=[{'all':!![]}];}_0x13f08f=_[_0xaa30('0x39')]({},_0x13f08f,_0x22dfa5[_0xaa30('0x43')]);return db[_0xaa30('0x27')]['find'](_0x13f08f)['then'](handleEntityNotFound(_0x7b6a6b,null))[_0xaa30('0x20')](respondWithResult(_0x7b6a6b,null))['catch'](handleError(_0x7b6a6b,null));};exports[_0xaa30('0x44')]=function(_0xbf9edd,_0xef3564){return db[_0xaa30('0x27')][_0xaa30('0x44')](_0xbf9edd[_0xaa30('0x45')],{})[_0xaa30('0x20')](respondWithResult(_0xef3564,0xc9))['catch'](handleError(_0xef3564,null));};exports[_0xaa30('0x1f')]=function(_0x6c9da6,_0xfa14bf){if(_0x6c9da6['body']['id']){delete _0x6c9da6[_0xaa30('0x45')]['id'];}return db[_0xaa30('0x27')]['find']({'where':{'id':_0x6c9da6[_0xaa30('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa14bf,null))[_0xaa30('0x20')](saveUpdates(_0x6c9da6['body'],null))['then'](respondWithResult(_0xfa14bf,null))[_0xaa30('0x3f')](handleError(_0xfa14bf,null));};exports['destroy']=function(_0x56389c,_0xf6a737){return db[_0xaa30('0x27')][_0xaa30('0x46')]({'where':{'id':_0x56389c[_0xaa30('0x41')]['id']}})[_0xaa30('0x20')](handleEntityNotFound(_0xf6a737,null))[_0xaa30('0x20')](removeEntity(_0xf6a737,null))['catch'](handleError(_0xf6a737,null));}; \ No newline at end of file +var _0xaebd=['VIRTUAL','merge','SmsApplication','includeAll','findAll','rows','catch','include','options','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x2c1eb8,_0x14d162){var _0x321103=function(_0x59e7ea){while(--_0x59e7ea){_0x2c1eb8['push'](_0x2c1eb8['shift']());}};_0x321103(++_0x14d162);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0xaebd[_0x4200e3];return _0x26ac37;};'use strict';var pdf=require(_0xdaeb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdaeb('0x1'));var zipdir=require(_0xdaeb('0x2'));var jsonpatch=require(_0xdaeb('0x3'));var rp=require(_0xdaeb('0x4'));var moment=require(_0xdaeb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdaeb('0x6'));var util=require(_0xdaeb('0x7'));var path=require(_0xdaeb('0x8'));var sox=require(_0xdaeb('0x9'));var csv=require(_0xdaeb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0xa'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29a4bd,_0x5aedaa){_0x5aedaa=_0x5aedaa||0xcc;return function(_0x4ee3cc){if(_0x4ee3cc){return _0x29a4bd[_0xdaeb('0x14')](_0x5aedaa);}return _0x29a4bd[_0xdaeb('0x15')](_0x5aedaa)[_0xdaeb('0x16')]();};}function respondWithResult(_0x1ca86d,_0x1f31be){_0x1f31be=_0x1f31be||0xc8;return function(_0xc6c611){if(_0xc6c611){return _0x1ca86d['status'](_0x1f31be)['json'](_0xc6c611);}};}function respondWithFilteredResult(_0x96371f,_0x306bdb){return function(_0x34b2fe){if(_0x34b2fe){var _0x18ec4e=_0x34b2fe['count'],_0x538a25=_0x306bdb['offset'],_0x4c3bf3=_0x306bdb[_0xdaeb('0x17')]+_0x306bdb[_0xdaeb('0x18')],_0x24b898;if(_0x4c3bf3>=_0x18ec4e){_0x4c3bf3=_0x18ec4e;_0x24b898=0xc8;}else{_0x24b898=0xce;}_0x96371f[_0xdaeb('0x15')](_0x24b898);return _0x96371f[_0xdaeb('0x19')](_0xdaeb('0x1a'),_0x538a25+'-'+_0x4c3bf3+'/'+_0x18ec4e)[_0xdaeb('0x1b')](_0x34b2fe);}return null;};}function patchUpdates(_0x501f77){return function(_0x22089c){try{jsonpatch['apply'](_0x22089c,_0x501f77,!![]);}catch(_0x16d5e3){return BPromise[_0xdaeb('0x1c')](_0x16d5e3);}return _0x22089c[_0xdaeb('0x1d')]();};}function saveUpdates(_0x5360ce,_0x4e97e0){return function(_0x13563c){if(_0x13563c){return _0x13563c[_0xdaeb('0x1e')](_0x5360ce)[_0xdaeb('0x1f')](function(_0x236ccb){return _0x236ccb;});}return null;};}function removeEntity(_0xc274f8,_0x536aae){return function(_0x597bb7){if(_0x597bb7){return _0x597bb7[_0xdaeb('0x20')]()[_0xdaeb('0x1f')](function(){_0xc274f8[_0xdaeb('0x15')](0xcc)[_0xdaeb('0x16')]();});}};}function handleEntityNotFound(_0x39dfae,_0x55c825){return function(_0x254c3b){if(!_0x254c3b){_0x39dfae['sendStatus'](0x194);}return _0x254c3b;};}function handleError(_0x130c35,_0x398616){_0x398616=_0x398616||0x1f4;return function(_0x451101){logger[_0xdaeb('0x21')](_0x451101[_0xdaeb('0x22')]);if(_0x451101['name']){delete _0x451101[_0xdaeb('0x23')];}_0x130c35[_0xdaeb('0x15')](_0x398616)[_0xdaeb('0x24')](_0x451101);};}exports['index']=function(_0x57c2c4,_0x43095f){var _0x4e7f44={},_0x5045f8={},_0x16cee7={'count':0x0,'rows':[]};var _0x1ff9af=_[_0xdaeb('0x25')](db['SmsApplication']['rawAttributes'],function(_0x32966f){return{'name':_0x32966f[_0xdaeb('0x26')],'type':_0x32966f[_0xdaeb('0x27')]['key']};});_0x5045f8[_0xdaeb('0x28')]=_['map'](_0x1ff9af,'name');_0x5045f8[_0xdaeb('0x29')]=_[_0xdaeb('0x2a')](_0x57c2c4[_0xdaeb('0x29')]);_0x5045f8[_0xdaeb('0x2b')]=_[_0xdaeb('0x2c')](_0x5045f8[_0xdaeb('0x28')],_0x5045f8[_0xdaeb('0x29')]);_0x4e7f44['attributes']=_[_0xdaeb('0x2c')](_0x5045f8[_0xdaeb('0x28')],qs[_0xdaeb('0x2d')](_0x57c2c4[_0xdaeb('0x29')][_0xdaeb('0x2d')]));_0x4e7f44['attributes']=_0x4e7f44[_0xdaeb('0x2e')][_0xdaeb('0x2f')]?_0x4e7f44['attributes']:_0x5045f8[_0xdaeb('0x28')];if(!_0x57c2c4[_0xdaeb('0x29')][_0xdaeb('0x30')](_0xdaeb('0x31'))){_0x4e7f44[_0xdaeb('0x18')]=qs[_0xdaeb('0x18')](_0x57c2c4[_0xdaeb('0x29')][_0xdaeb('0x18')]);_0x4e7f44[_0xdaeb('0x17')]=qs[_0xdaeb('0x17')](_0x57c2c4['query']['offset']);}_0x4e7f44[_0xdaeb('0x32')]=qs['sort'](_0x57c2c4[_0xdaeb('0x29')][_0xdaeb('0x33')]);_0x4e7f44[_0xdaeb('0x34')]=qs[_0xdaeb('0x2b')](_[_0xdaeb('0x35')](_0x57c2c4[_0xdaeb('0x29')],_0x5045f8['filters']),_0x1ff9af);if(_0x57c2c4[_0xdaeb('0x29')][_0xdaeb('0x36')]){_0x4e7f44[_0xdaeb('0x34')]=_['merge'](_0x4e7f44[_0xdaeb('0x34')],{'$or':_[_0xdaeb('0x25')](_0x1ff9af,function(_0x30080b){if(_0x30080b[_0xdaeb('0x27')]!==_0xdaeb('0x37')){var _0x168bd5={};_0x168bd5[_0x30080b[_0xdaeb('0x23')]]={'$like':'%'+_0x57c2c4['query'][_0xdaeb('0x36')]+'%'};return _0x168bd5;}})});}_0x4e7f44=_[_0xdaeb('0x38')]({},_0x4e7f44,_0x57c2c4['options']);var _0x50c6db={'where':_0x4e7f44[_0xdaeb('0x34')]};return db[_0xdaeb('0x39')]['count'](_0x50c6db)[_0xdaeb('0x1f')](function(_0x2e46fb){_0x16cee7['count']=_0x2e46fb;if(_0x57c2c4[_0xdaeb('0x29')][_0xdaeb('0x3a')]){_0x4e7f44['include']=[{'all':!![]}];}return db['SmsApplication'][_0xdaeb('0x3b')](_0x4e7f44);})[_0xdaeb('0x1f')](function(_0x157c06){_0x16cee7[_0xdaeb('0x3c')]=_0x157c06;return _0x16cee7;})[_0xdaeb('0x1f')](respondWithFilteredResult(_0x43095f,_0x4e7f44))[_0xdaeb('0x3d')](handleError(_0x43095f,null));};exports['show']=function(_0x2091b1,_0x4f5745){var _0x46aa44={'raw':!![],'where':{'id':_0x2091b1['params']['id']}},_0x5c0817={};_0x5c0817[_0xdaeb('0x28')]=_['keys'](db[_0xdaeb('0x39')]['rawAttributes']);_0x5c0817[_0xdaeb('0x29')]=_[_0xdaeb('0x2a')](_0x2091b1[_0xdaeb('0x29')]);_0x5c0817[_0xdaeb('0x2b')]=_['intersection'](_0x5c0817[_0xdaeb('0x28')],_0x5c0817['query']);_0x46aa44[_0xdaeb('0x2e')]=_[_0xdaeb('0x2c')](_0x5c0817[_0xdaeb('0x28')],qs['fields'](_0x2091b1[_0xdaeb('0x29')][_0xdaeb('0x2d')]));_0x46aa44[_0xdaeb('0x2e')]=_0x46aa44[_0xdaeb('0x2e')][_0xdaeb('0x2f')]?_0x46aa44[_0xdaeb('0x2e')]:_0x5c0817[_0xdaeb('0x28')];if(_0x2091b1[_0xdaeb('0x29')][_0xdaeb('0x3a')]){_0x46aa44[_0xdaeb('0x3e')]=[{'all':!![]}];}_0x46aa44=_[_0xdaeb('0x38')]({},_0x46aa44,_0x2091b1[_0xdaeb('0x3f')]);return db['SmsApplication'][_0xdaeb('0x40')](_0x46aa44)[_0xdaeb('0x1f')](handleEntityNotFound(_0x4f5745,null))['then'](respondWithResult(_0x4f5745,null))['catch'](handleError(_0x4f5745,null));};exports[_0xdaeb('0x41')]=function(_0x2b4a3e,_0x3fa2fe){return db['SmsApplication'][_0xdaeb('0x41')](_0x2b4a3e[_0xdaeb('0x42')],{})[_0xdaeb('0x1f')](respondWithResult(_0x3fa2fe,0xc9))[_0xdaeb('0x3d')](handleError(_0x3fa2fe,null));};exports[_0xdaeb('0x1e')]=function(_0x45344b,_0x27870b){if(_0x45344b[_0xdaeb('0x42')]['id']){delete _0x45344b['body']['id'];}return db[_0xdaeb('0x39')][_0xdaeb('0x40')]({'where':{'id':_0x45344b['params']['id']}})[_0xdaeb('0x1f')](handleEntityNotFound(_0x27870b,null))['then'](saveUpdates(_0x45344b[_0xdaeb('0x42')],null))[_0xdaeb('0x1f')](respondWithResult(_0x27870b,null))[_0xdaeb('0x3d')](handleError(_0x27870b,null));};exports[_0xdaeb('0x20')]=function(_0x5df403,_0x449f64){return db[_0xdaeb('0x39')][_0xdaeb('0x40')]({'where':{'id':_0x5df403[_0xdaeb('0x43')]['id']}})['then'](handleEntityNotFound(_0x449f64,null))['then'](removeEntity(_0x449f64,null))[_0xdaeb('0x3d')](handleError(_0x449f64,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4fc19c1..2b62e85 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 _0x496e=['api','bluebird','request-promise','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5ebc57,_0x40f17d){var _0x49f5ef=function(_0x71114b){while(--_0x71114b){_0x5ebc57['push'](_0x5ebc57['shift']());}};_0x49f5ef(++_0x40f17d);}(_0x496e,0xe2));var _0xe496=function(_0x425b08,_0x5afd33){_0x425b08=_0x425b08-0x0;var _0x4ee8ec=_0x496e[_0x425b08];return _0x4ee8ec;};'use strict';var _=require(_0xe496('0x0'));var util=require('util');var logger=require(_0xe496('0x1'))(_0xe496('0x2'));var moment=require('moment');var BPromise=require(_0xe496('0x3'));var rp=require(_0xe496('0x4'));var fs=require('fs');var path=require(_0xe496('0x5'));var rimraf=require(_0xe496('0x6'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xe496('0x7')]=function(_0x1d84f5,_0x56c8ed){return _0x1d84f5[_0xe496('0x8')](_0xe496('0x9'),attributes,{'tableName':_0xe496('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe496('0xb')});}; \ No newline at end of file +var _0xfd6c=['lodash','util','api','bluebird','request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1bb889,_0x49c4b5){var _0xd8b76d=function(_0x1df471){while(--_0x1df471){_0x1bb889['push'](_0x1bb889['shift']());}};_0xd8b76d(++_0x49c4b5);}(_0xfd6c,0x1e0));var _0xcfd6=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xfd6c[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xcfd6('0x0'));var util=require(_0xcfd6('0x1'));var logger=require('../../config/logger')(_0xcfd6('0x2'));var moment=require('moment');var BPromise=require(_0xcfd6('0x3'));var rp=require(_0xcfd6('0x4'));var fs=require('fs');var path=require(_0xcfd6('0x5'));var rimraf=require(_0xcfd6('0x6'));var config=require('../../config/environment');var attributes=require(_0xcfd6('0x7'));module['exports']=function(_0x500993,_0x2c85e4){return _0x500993[_0xcfd6('0x8')](_0xcfd6('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcfd6('0xa'),'collate':_0xcfd6('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f44bf2b..82c6a43 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 _0x5c1f=['code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x556ddd,_0x492976){var _0x51c518=function(_0x55e214){while(--_0x55e214){_0x556ddd['push'](_0x556ddd['shift']());}};_0x51c518(++_0x492976);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x5c1f[_0x2c6810];return _0x213881;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5c1('0x3'));var db=require(_0xf5c1('0x4'))['db'];var utils=require(_0xf5c1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf5c1('0x6'));var client=jayson[_0xf5c1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a073,_0x21bb02,_0x12128b){return new BPromise(function(_0x40cad7,_0x5e3ef8){return client['request'](_0x34a073,_0x12128b)['then'](function(_0x4bd3a9){logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));logger[_0xf5c1('0xb')](_0xf5c1('0xc'),_0x21bb02,_0xf5c1('0xa'),JSON[_0xf5c1('0xd')](_0x4bd3a9));if(_0x4bd3a9[_0xf5c1('0xe')]){if(_0x4bd3a9['error'][_0xf5c1('0xf')]===0x1f4){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x5e3ef8(_0x4bd3a9['error'][_0xf5c1('0x10')]);}logger['error'](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x40cad7(_0x4bd3a9['error'][_0xf5c1('0x10')]);}else{logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));_0x40cad7(_0x4bd3a9['result'][_0xf5c1('0x10')]);}})[_0xf5c1('0x11')](function(_0x312d6b){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x312d6b);_0x5e3ef8(_0x312d6b);});});} \ No newline at end of file +var _0xfdb3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','bluebird','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdb3,0x10c));var _0x3fdb=function(_0xd9b743,_0x56a449){_0xd9b743=_0xd9b743-0x0;var _0x4aa02b=_0xfdb3[_0xd9b743];return _0x4aa02b;};'use strict';var _=require(_0x3fdb('0x0'));var util=require(_0x3fdb('0x1'));var moment=require('moment');var BPromise=require(_0x3fdb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fdb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fdb('0x4'))(_0x3fdb('0x5'));var config=require(_0x3fdb('0x6'));var jayson=require(_0x3fdb('0x7'));var client=jayson[_0x3fdb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3433d8,_0x4fe9c,_0x102a21){return new BPromise(function(_0x53f026,_0x262e8a){return client['request'](_0x3433d8,_0x102a21)[_0x3fdb('0x9')](function(_0x23346f){logger[_0x3fdb('0xa')](_0x3fdb('0xb'),_0x4fe9c,_0x3fdb('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4fe9c,'request\x20sent',JSON['stringify'](_0x23346f));if(_0x23346f[_0x3fdb('0xd')]){if(_0x23346f[_0x3fdb('0xd')][_0x3fdb('0xe')]===0x1f4){logger[_0x3fdb('0xd')](_0x3fdb('0xb'),_0x4fe9c,_0x23346f[_0x3fdb('0xd')][_0x3fdb('0xf')]);return _0x262e8a(_0x23346f[_0x3fdb('0xd')][_0x3fdb('0xf')]);}logger[_0x3fdb('0xd')]('SmsApplication,\x20%s,\x20%s',_0x4fe9c,_0x23346f[_0x3fdb('0xd')][_0x3fdb('0xf')]);return _0x53f026(_0x23346f['error'][_0x3fdb('0xf')]);}else{logger[_0x3fdb('0xa')](_0x3fdb('0xb'),_0x4fe9c,_0x3fdb('0xc'));_0x53f026(_0x23346f['result']['message']);}})['catch'](function(_0x193aed){logger[_0x3fdb('0xd')](_0x3fdb('0xb'),_0x4fe9c,_0x193aed);_0x262e8a(_0x193aed);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index aeae7d0..e5770f3 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 _0x28f2=['describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x28f2,0x193));var _0x228f=function(_0x2c6d62,_0x12b382){_0x2c6d62=_0x2c6d62-0x0;var _0x5ccef0=_0x28f2[_0x2c6d62];return _0x5ccef0;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var auth=require(_0x228f('0x5'));var interaction=require(_0x228f('0x6'));var config=require(_0x228f('0x7'));var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router['get'](_0x228f('0xc'),auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0x9')](_0x228f('0xe'),auth['isAuthenticated'](),controller[_0x228f('0xf')]);router['get'](_0x228f('0x10'),auth[_0x228f('0xa')](),controller['getMessages']);router[_0x228f('0x9')](_0x228f('0x11'),auth[_0x228f('0xa')](),controller[_0x228f('0x12')]);router[_0x228f('0x13')]('/',auth['isAuthenticated'](),controller[_0x228f('0x14')]);router[_0x228f('0x13')](_0x228f('0x10'),auth[_0x228f('0xa')](),controller[_0x228f('0x15')]);router[_0x228f('0x13')](_0x228f('0x16'),auth[_0x228f('0xa')](),interaction['tracked'](_0x228f('0x17'),_0x228f('0x18')),controller[_0x228f('0x19')]);router[_0x228f('0x1a')](_0x228f('0xe'),auth[_0x228f('0xa')](),interaction[_0x228f('0x1b')]('sms',_0x228f('0x1c')),controller['update']);router[_0x228f('0x1d')](_0x228f('0xe'),auth[_0x228f('0xa')](),interaction['tracked'](_0x228f('0x17'),'smsinteraction:destroy'),controller[_0x228f('0x1e')]);router['delete'](_0x228f('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0x228f('0x1f')]=router; \ No newline at end of file +var _0x5ed9=['Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','download','post','create','addMessage','tracked','sms','smsinteraction:addtags','put','update','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5ed9[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var path=require('path');var timeout=require(_0x95ed('0x2'));var express=require(_0x95ed('0x3'));var router=express[_0x95ed('0x4')]();var auth=require(_0x95ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95ed('0x6'));var controller=require(_0x95ed('0x7'));router[_0x95ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x95ed('0x9')]);router['get'](_0x95ed('0xa'),auth[_0x95ed('0xb')](),controller[_0x95ed('0xc')]);router[_0x95ed('0x8')](_0x95ed('0xd'),auth[_0x95ed('0xb')](),controller['show']);router[_0x95ed('0x8')](_0x95ed('0xe'),auth[_0x95ed('0xb')](),controller['getMessages']);router[_0x95ed('0x8')]('/:id/download',auth[_0x95ed('0xb')](),controller[_0x95ed('0xf')]);router[_0x95ed('0x10')]('/',auth[_0x95ed('0xb')](),controller[_0x95ed('0x11')]);router['post']('/:id/messages',auth[_0x95ed('0xb')](),controller[_0x95ed('0x12')]);router['post']('/:id/tags',auth[_0x95ed('0xb')](),interaction[_0x95ed('0x13')](_0x95ed('0x14'),_0x95ed('0x15')),controller['addTags']);router[_0x95ed('0x16')](_0x95ed('0xd'),auth[_0x95ed('0xb')](),interaction[_0x95ed('0x13')](_0x95ed('0x14'),'smsinteraction:update'),controller[_0x95ed('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x95ed('0x13')]('sms',_0x95ed('0x18')),controller[_0x95ed('0x19')]);router['delete'](_0x95ed('0x1a'),auth[_0x95ed('0xb')](),controller[_0x95ed('0x1b')]);module[_0x95ed('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 28c0f35..988776c 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x757a,0xde));var _0xa757=function(_0x339a82,_0x544447){_0x339a82=_0x339a82-0x0;var _0x31e2c1=_0x757a[_0x339a82];return _0x31e2c1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x28e5e4,_0x410bce){var _0x1df612=function(_0x5e20bf){while(--_0x5e20bf){_0x28e5e4['push'](_0x28e5e4['shift']());}};_0x1df612(++_0x410bce);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0xb10b[_0x2f06e0];return _0xf2711b;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 852133e..654599f 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 _0x6f0d=['union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','isEmpty','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','sequelize','toString','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','options','create','body','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','smsInteractionTags:save','removeTags','download','files','tmp','join','root','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','SmsAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','closedAt','disposition','out','System','secret','renderFile','server','views','downloadInteraction.html','toFile','transcript-','log','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','users','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','start','Tag'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x542533,_0x579fd2){_0x542533=_0x542533-0x0;var _0x2d2cf9=_0x6f0d[_0x542533];return _0x2d2cf9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6f0('0x0'));var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require(_0xd6f0('0x3'));var rp=require('request-promise');var moment=require(_0xd6f0('0x4'));var BPromise=require(_0xd6f0('0x5'));var Mustache=require(_0xd6f0('0x6'));var util=require(_0xd6f0('0x7'));var path=require(_0xd6f0('0x8'));var sox=require('sox');var csv=require(_0xd6f0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var db=require(_0xd6f0('0x17'))['db'];config[_0xd6f0('0x18')]=_[_0xd6f0('0x19')](config[_0xd6f0('0x18')],{'host':_0xd6f0('0x1a'),'port':0x18eb});var socket=require(_0xd6f0('0x1b'))(new Redis(config[_0xd6f0('0x18')]));require(_0xd6f0('0x1c'))[_0xd6f0('0x1d')](socket);function respondWithStatusCode(_0x4ab979,_0x2b3f32){_0x2b3f32=_0x2b3f32||0xcc;return function(_0x354846){if(_0x354846){return _0x4ab979['sendStatus'](_0x2b3f32);}return _0x4ab979[_0xd6f0('0x1e')](_0x2b3f32)['end']();};}function respondWithResult(_0x3f4851,_0x154e3e){_0x154e3e=_0x154e3e||0xc8;return function(_0x41bd99){if(_0x41bd99){return _0x3f4851[_0xd6f0('0x1e')](_0x154e3e)[_0xd6f0('0x1f')](_0x41bd99);}};}function respondWithFilteredResult(_0x61defb,_0x25da0c){return function(_0x29fbb9){if(_0x29fbb9){var _0x2e71bd=_0x29fbb9[_0xd6f0('0x20')],_0x1862a9=_0x25da0c[_0xd6f0('0x21')],_0x23ab6c=_0x25da0c[_0xd6f0('0x21')]+_0x25da0c[_0xd6f0('0x22')],_0x17e7c6;if(_0x23ab6c>=_0x2e71bd){_0x23ab6c=_0x2e71bd;_0x17e7c6=0xc8;}else{_0x17e7c6=0xce;}_0x61defb['status'](_0x17e7c6);return _0x61defb['set'](_0xd6f0('0x23'),_0x1862a9+'-'+_0x23ab6c+'/'+_0x2e71bd)[_0xd6f0('0x1f')](_0x29fbb9);}return null;};}function patchUpdates(_0x1158dc){return function(_0x54300d){try{jsonpatch[_0xd6f0('0x24')](_0x54300d,_0x1158dc,!![]);}catch(_0x19a545){return BPromise['reject'](_0x19a545);}return _0x54300d[_0xd6f0('0x25')]();};}function saveUpdates(_0x515687,_0x1ee584){return function(_0x1c9d90){if(_0x1c9d90){return _0x1c9d90['update'](_0x515687)[_0xd6f0('0x26')](function(_0x45e99c){return _0x45e99c;});}return null;};}function removeEntity(_0x5ea2dd,_0x3dbdc3){return function(_0x402070){if(_0x402070){return _0x402070[_0xd6f0('0x27')]()['then'](function(){_0x5ea2dd[_0xd6f0('0x1e')](0xcc)[_0xd6f0('0x28')]();});}};}function handleEntityNotFound(_0x5ecb16,_0xcea0ae){return function(_0x551be8){if(!_0x551be8){_0x5ecb16[_0xd6f0('0x29')](0x194);}return _0x551be8;};}function handleError(_0x3fb5c3,_0x1630dc){_0x1630dc=_0x1630dc||0x1f4;return function(_0x3c1bff){logger[_0xd6f0('0x2a')](_0x3c1bff[_0xd6f0('0x2b')]);if(_0x3c1bff[_0xd6f0('0x2c')]){delete _0x3c1bff[_0xd6f0('0x2c')];}_0x3fb5c3['status'](_0x1630dc)[_0xd6f0('0x2d')](_0x3c1bff);};}function getInteractionUsers(_0x1982d3,_0x55656c){return new BPromise(function(_0x38a3e9,_0x385947){try{if(_0x55656c[_0x1982d3['id']]){_0x1982d3[_0xd6f0('0x2e')]=_[_0xd6f0('0x2f')](_0x55656c[_0x1982d3['id']],function(_0x1a3967){return{'id':_0x1a3967['id'],'fullname':_0x1a3967[_0xd6f0('0x30')]};});}}catch(_0x351fda){_0x385947(_0x351fda);}_0x38a3e9(_0x1982d3);});}function getInteractionTags(_0x3151f8,_0x465cf9){return new BPromise(function(_0x43f72f,_0x1dff9b){try{if(_0x3151f8[_0xd6f0('0x31')]){_0x3151f8[_0xd6f0('0x32')]=[];_0x3151f8[_0xd6f0('0x31')][_0xd6f0('0x33')](',')[_0xd6f0('0x34')](function(_0x31c493){_0x3151f8[_0xd6f0('0x32')][_0xd6f0('0x35')](_0x465cf9[_0x31c493]);});}delete _0x3151f8[_0xd6f0('0x31')];}catch(_0x3906ca){_0x1dff9b(_0x3906ca);}_0x43f72f(_0x3151f8);});}function updateSmsInteraction(_0x26ab29,_0x4a8ebe,_0x11124c){return new BPromise(function(_0x4ed523,_0x58d2c5){return getInteractionUsers(_0x26ab29,_0x11124c)[_0xd6f0('0x26')](function(_0x52e894){return getInteractionTags(_0x52e894,_0x4a8ebe);})[_0xd6f0('0x26')](function(_0x27ad7e){_0x4ed523(_0x27ad7e);})[_0xd6f0('0x36')](function(_0x5c482f){_0x58d2c5(_0x5c482f);});});}exports[_0xd6f0('0x37')]=function(_0x4e5f97,_0x27b5b0){var _0xbe1408={},_0x42c01a={},_0x1eecf0={'count':0x0,'rows':[]};var _0x518751=_['map'](db['SmsInteraction'][_0xd6f0('0x38')],function(_0xe2958d){return{'name':_0xe2958d['fieldName'],'type':_0xe2958d[_0xd6f0('0x39')]['key']};});_0x42c01a[_0xd6f0('0x3a')]=_[_0xd6f0('0x2f')](_0x518751,_0xd6f0('0x2c'));_0x42c01a[_0xd6f0('0x3b')]=_[_0xd6f0('0x3c')](_0x4e5f97[_0xd6f0('0x3b')]);_0x42c01a[_0xd6f0('0x3d')]=_['intersection'](_0x42c01a['model'],_0x42c01a[_0xd6f0('0x3b')]);_0xbe1408[_0xd6f0('0x3e')]=_[_0xd6f0('0x3f')](_0x42c01a['model'],qs['fields'](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x40')]));_0xbe1408[_0xd6f0('0x3e')]=_0xbe1408[_0xd6f0('0x3e')][_0xd6f0('0x41')]?_0xbe1408[_0xd6f0('0x3e')]:_0x42c01a[_0xd6f0('0x3a')];if(!_0x4e5f97[_0xd6f0('0x3b')]['hasOwnProperty'](_0xd6f0('0x42'))){_0xbe1408[_0xd6f0('0x22')]=qs[_0xd6f0('0x22')](_0x4e5f97[_0xd6f0('0x3b')]['limit']);_0xbe1408[_0xd6f0('0x21')]=qs[_0xd6f0('0x21')](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x21')]);}_0xbe1408[_0xd6f0('0x43')]=qs['sort'](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x44')]);_0xbe1408[_0xd6f0('0x45')]=qs['filters'](_[_0xd6f0('0x46')](_0x4e5f97[_0xd6f0('0x3b')],_0x42c01a['filters']),_0x518751);var _0x516ffd=[];var _0x9cffd4=squel[_0xd6f0('0x47')]()[_0xd6f0('0x48')]('id')['field'](_0xd6f0('0x2c'))[_0xd6f0('0x48')]('color')[_0xd6f0('0x49')](_0xd6f0('0x4a'));var _0x2930c5=squel[_0xd6f0('0x47')]()['field'](_0xd6f0('0x4b'))[_0xd6f0('0x48')](_0xd6f0('0x4c'))[_0xd6f0('0x48')](_0xd6f0('0x4d'))[_0xd6f0('0x49')](_0xd6f0('0x4e'),'ui')[_0xd6f0('0x4f')]('users','u',_0xd6f0('0x50'));var _0x3d42ca=squel['select']()[_0xd6f0('0x49')](_0xd6f0('0x51'),'i')[_0xd6f0('0x4f')](_0xd6f0('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd6f0('0x4f')](_0xd6f0('0x53'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xd6f0('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0xd6f0('0x4f')](_0xd6f0('0x55'),'me',_0xd6f0('0x56'))['left_join'](_0xd6f0('0x57'),'it',_0xd6f0('0x58'))[_0xd6f0('0x4f')](_0xd6f0('0x4a'),'t',_0xd6f0('0x59'));var _0x4c42ce=squel[_0xd6f0('0x5a')]();var _0x5189a7=[];var _0x416a94=squel[_0xd6f0('0x5a')]();var _0x2eb338;if(_0x4e5f97[_0xd6f0('0x3b')]['search']){_0x2eb338=as['parseSearch'](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x5b')]);var _0x56904a=_0x2eb338[_0xd6f0('0x5c')];for(var _0x56c448=0x0;_0x56c448<_0x2eb338[_0xd6f0('0x5d')][_0xd6f0('0x41')];_0x56c448++){var _0x49618b=_0x2eb338[_0xd6f0('0x5d')][_0x56c448];var _0x30082c='i';var _0x4d6bc0=_[_0xd6f0('0x5e')](_0x518751,[_0xd6f0('0x2c'),_0x49618b[_0xd6f0('0x48')]]);if(!_0x4d6bc0){switch(_0x49618b[_0xd6f0('0x48')]){case _0xd6f0('0x5f'):if(_0x49618b[_0xd6f0('0x60')]==0x1){_0x3d42ca[_0xd6f0('0x61')]('`'+_0x49618b[_0xd6f0('0x48')]+'`\x20=\x200');}else{_0x3d42ca[_0xd6f0('0x61')]('`'+_0x49618b[_0xd6f0('0x48')]+_0xd6f0('0x62'));}break;case _0xd6f0('0x63'):if(_0x49618b[_0xd6f0('0x64')]===_0xd6f0('0x65')){if(_0x49618b[_0xd6f0('0x60')][_0xd6f0('0x33')]('\x20')[_0xd6f0('0x41')]>0x1){_0x4c42ce[_0x56904a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd6f0('0x66')](_0x49618b['value']),null);}else{var _0x5505fd='%'+_0x49618b[_0xd6f0('0x60')]+'%';_0x4c42ce[_0x56904a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5505fd,_0x5505fd,_0x5505fd);}}else{_0x4d6bc0=_['find'](_0x518751,[_0xd6f0('0x2c'),_0xd6f0('0x67')]);_0x49618b[_0xd6f0('0x48')]='ContactId';_0x269dd7=as[_0xd6f0('0x68')](_0x30082c,_0x4d6bc0[_0xd6f0('0x39')],_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7['value'][_0xd6f0('0x6a')],_0x269dd7[_0xd6f0('0x60')]['end']);}break;case _0xd6f0('0x6b'):var _0x328e0a=_0x49618b['value'][_0xd6f0('0x33')](',')[_0xd6f0('0x2f')](function(_0x22e511){return Number(_0x22e511);});_0x328e0a[_0xd6f0('0x34')](function(_0x3e6533){_0x416a94['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e6533+',%');});_0x5189a7=_[_0xd6f0('0x6c')](_0x5189a7,_0x328e0a);break;case _0xd6f0('0x6d'):if(_0x49618b['operator']===_0xd6f0('0x65')){_0x4c42ce[_0x56904a](_0xd6f0('0x6e'),'%'+_0x49618b[_0xd6f0('0x60')]+'%',null);}else{_0x4d6bc0=_['find'](_0x518751,[_0xd6f0('0x2c'),'UserId']);_0x49618b['field']='UserId';_0x269dd7=as['buildExpression'](_0x30082c,_0x4d6bc0[_0xd6f0('0x39')],_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7[_0xd6f0('0x60')][_0xd6f0('0x6a')],_0x269dd7['value'][_0xd6f0('0x28')]);}break;case'body':_0x269dd7=as[_0xd6f0('0x68')]('me',null,_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7[_0xd6f0('0x60')]['start'],_0x269dd7[_0xd6f0('0x60')][_0xd6f0('0x28')]);break;}}else{var _0x269dd7=as[_0xd6f0('0x68')](_0x30082c,_0x4d6bc0['type'],_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7[_0xd6f0('0x60')][_0xd6f0('0x6a')],_0x269dd7['value'][_0xd6f0('0x28')]);}}}else{var _0x3e74c9=_(_0x4e5f97[_0xd6f0('0x3b')])[_0xd6f0('0x3c')]()['map'](function(_0x1bde72){return _[_0xd6f0('0x6f')](_0x518751,[_0xd6f0('0x2c'),_0x1bde72])?_0x1bde72:undefined;})[_0xd6f0('0x70')]()['value']();if(!_['isEmpty'](_0x3e74c9)){_0x3e74c9['forEach'](function(_0x5ed780){if(_0x5ed780===_0xd6f0('0x71')){_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x72'),[][_0xd6f0('0x73')](_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780]));}else if(_0x5ed780===_0xd6f0('0x74')){var _0x39f937=JSON[_0xd6f0('0x75')](_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780])['$gte'];var _0x55f96e=JSON[_0xd6f0('0x75')](_0x4e5f97['query'][_0x5ed780])[_0xd6f0('0x76')];_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x77'),_0x39f937,_0x55f96e);}else{if(_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780]===_0xd6f0('0x78')){_0x3d42ca[_0xd6f0('0x45')]('i.'+_0x5ed780+_0xd6f0('0x79'));}else{_0x3d42ca['where']('i.'+_0x5ed780+_0xd6f0('0x7a'),_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780]);}}});}if(_0x4e5f97[_0xd6f0('0x3b')]['read']){if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7b')]==0x1){_0x3d42ca['having'](_0xd6f0('0x7c'));}else{_0x3d42ca[_0xd6f0('0x61')](_0xd6f0('0x7d'));}}if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7e')]){_0x5189a7=_[_0xd6f0('0x7f')](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7e')])?_0x4e5f97[_0xd6f0('0x3b')]['tag']:new Array(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7e')]);_0x5189a7[_0xd6f0('0x34')](function(_0x46cfba){_0x416a94['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46cfba+',%');});}if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x80')]){var _0x1e0e54=_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x80')][_0xd6f0('0x81')]('\x5c','\x5c\x5c')[_0xd6f0('0x81')]('\x27\x27',_0xd6f0('0x82'));if(qs[_0xd6f0('0x83')](_0x1e0e54)){_0x4c42ce['or'](_0xd6f0('0x84'),_0x1e0e54+'%')['or']('i.phone\x20LIKE\x20?',_0x1e0e54+'%');}else{_0x4c42ce['or'](_0xd6f0('0x85'),qs[_0xd6f0('0x66')](_0x1e0e54))['or'](_0xd6f0('0x86'),_0x1e0e54+'%');}}}_0x3d42ca['where'](_0x4c42ce);_0x3d42ca[_0xd6f0('0x87')](_0xd6f0('0x88'));var _0x343650={'type':db[_0xd6f0('0x89')][_0xd6f0('0x8a')][_0xd6f0('0x8b')],'raw':!![]};var _0x1c7f08=_0x3d42ca[_0xd6f0('0x8c')]();_0x1c7f08[_0xd6f0('0x48')](_0xd6f0('0x88'));_0x1c7f08[_0xd6f0('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xbe1408[_0xd6f0('0x43')]){_0xbe1408[_0xd6f0('0x43')][_0xd6f0('0x34')](function(_0x44088b){_0x3d42ca[_0xd6f0('0x43')]('i.'+_0x44088b[0x0],_0x44088b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd6f0('0x8d')](_0x5189a7)){_0x3d42ca[_0xd6f0('0x61')](_0x416a94);_0x1c7f08['where'](_0xd6f0('0x8e'),_0x5189a7);}BPromise['resolve']()[_0xd6f0('0x26')](function(){if(!_0x2eb338){if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x71')]||_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x8f')])return;_0x1c7f08['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x90'));return;}return _0x4e5f97['user'][_0xd6f0('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x52bf7f){if(_[_0xd6f0('0x8d')](_0x52bf7f)){_0x1c7f08['where']('i.SmsAccountId\x20IS\x20NULL');_0x3d42ca['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x1c7f08[_0xd6f0('0x45')](_0xd6f0('0x72'),_[_0xd6f0('0x2f')](_0x52bf7f,'id'));_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x72'),_[_0xd6f0('0x2f')](_0x52bf7f,'id'));}});})[_0xd6f0('0x26')](function(){db[_0xd6f0('0x92')][_0xd6f0('0x3b')](_0x1c7f08['toString'](),_0x343650)[_0xd6f0('0x26')](function(_0x540609){_0x1eecf0['count']=_0x540609[_0xd6f0('0x41')];if(_0x1eecf0[_0xd6f0('0x20')]===0x0)return[];return db[_0xd6f0('0x92')]['query'](_0x9cffd4[_0xd6f0('0x93')](),_0x343650)[_0xd6f0('0x26')](function(_0xc0585c){_0x516ffd=_[_0xd6f0('0x94')](_0xc0585c,'id');_0x343650=_[_0xd6f0('0x95')](_0x343650,{'model':db[_0xd6f0('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x40')]){_0xbe1408['attributes'][_0xd6f0('0x34')](function(_0x37a29b){_0x3d42ca['field']('i.'+_0x37a29b);});}else{_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x97'),_0xd6f0('0x5f'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x98'),_0xd6f0('0x99'));_0x3d42ca[_0xd6f0('0x48')]('a.mandatoryDisposition',_0xd6f0('0x9a'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x9b'));_0x3d42ca['field']('c.firstName','Contact.firstName');_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x9c'),_0xd6f0('0x9d'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x9e'),_0xd6f0('0x9f'));_0x3d42ca['field'](_0xd6f0('0xa0'),_0xd6f0('0xa1'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0xa2'),'Contact.mobile');_0x3d42ca[_0xd6f0('0x48')]('c.fax',_0xd6f0('0xa3'));_0x3d42ca['field'](_0xd6f0('0xa4'),_0xd6f0('0xa5'));_0x3d42ca['field'](_0xd6f0('0xa6'),_0xd6f0('0xa7'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0xa8'),_0xd6f0('0x31'));}if(_0xbe1408[_0xd6f0('0x22')])_0x3d42ca[_0xd6f0('0x22')](_0xbe1408[_0xd6f0('0x22')]);if(_0xbe1408[_0xd6f0('0x21')])_0x3d42ca[_0xd6f0('0x21')](_0xbe1408[_0xd6f0('0x21')]);return db[_0xd6f0('0x92')][_0xd6f0('0x3b')](_0x3d42ca[_0xd6f0('0x93')](),_0x343650);})['then'](function(_0x119865){_0x2930c5[_0xd6f0('0x45')](_0xd6f0('0xa9'),_[_0xd6f0('0x2f')](_0x119865,'id'));return db[_0xd6f0('0x92')][_0xd6f0('0x3b')](_0x2930c5[_0xd6f0('0x93')](),_0x343650)[_0xd6f0('0x26')](function(_0x5d0600){var _0x38fc48=_[_0xd6f0('0xaa')](_0x5d0600,_0xd6f0('0xab'));var _0xcefe48=[];_0x119865[_0xd6f0('0x34')](function(_0x515d68){_0xcefe48['push'](updateSmsInteraction(_0x515d68,_0x516ffd,_0x38fc48));});return BPromise[_0xd6f0('0xac')](_0xcefe48);});});})[_0xd6f0('0x26')](function(_0x374e0b){_0x1eecf0[_0xd6f0('0xad')]=_0x374e0b;return _0x1eecf0;})[_0xd6f0('0x26')](respondWithFilteredResult(_0x27b5b0,_0xbe1408));})['catch'](handleError(_0x27b5b0,null));};exports[_0xd6f0('0xae')]=function(_0xb5c516,_0x2d0d8a){var _0x425ada={'raw':![],'where':{'id':_0xb5c516[_0xd6f0('0xaf')]['id']}},_0x57d201={};_0x57d201[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](db[_0xd6f0('0x96')][_0xd6f0('0x38')]);_0x57d201[_0xd6f0('0x3b')]=_['keys'](_0xb5c516['query']);_0x57d201[_0xd6f0('0x3d')]=_['intersection'](_0x57d201[_0xd6f0('0x3a')],_0x57d201['query']);_0x425ada[_0xd6f0('0x3e')]=_[_0xd6f0('0x3f')](_0x57d201['model'],qs[_0xd6f0('0x40')](_0xb5c516['query'][_0xd6f0('0x40')]));_0x425ada[_0xd6f0('0x3e')]=_0x425ada[_0xd6f0('0x3e')][_0xd6f0('0x41')]?_0x425ada['attributes']:_0x57d201[_0xd6f0('0x3a')];if(_0xb5c516[_0xd6f0('0x3b')][_0xd6f0('0xb0')]){_0x425ada['include']=[{'all':!![]}];}_0x425ada=_[_0xd6f0('0x95')]({},_0x425ada,_0xb5c516[_0xd6f0('0xb1')]);return db[_0xd6f0('0x96')]['find'](_0x425ada)['then'](handleEntityNotFound(_0x2d0d8a,null))[_0xd6f0('0x26')](respondWithResult(_0x2d0d8a,null))[_0xd6f0('0x36')](handleError(_0x2d0d8a,null));};exports[_0xd6f0('0xb2')]=function(_0x4b113a,_0x40d4b3){return db[_0xd6f0('0x96')][_0xd6f0('0xb2')](_0x4b113a[_0xd6f0('0xb3')],{})[_0xd6f0('0x26')](respondWithResult(_0x40d4b3,0xc9))[_0xd6f0('0x36')](handleError(_0x40d4b3,null));};exports[_0xd6f0('0xb4')]=function(_0x5eeff2,_0x27715b){if(_0x5eeff2['body']['id']){delete _0x5eeff2[_0xd6f0('0xb3')]['id'];}return db[_0xd6f0('0x96')][_0xd6f0('0x5e')]({'where':{'id':_0x5eeff2['params']['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x27715b,null))['then'](saveUpdates(_0x5eeff2['body'],null))[_0xd6f0('0x26')](respondWithResult(_0x27715b,null))[_0xd6f0('0x36')](handleError(_0x27715b,null));};exports[_0xd6f0('0x27')]=function(_0x5b270f,_0x446896){return db['SmsInteraction']['find']({'where':{'id':_0x5b270f[_0xd6f0('0xaf')]['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x446896,null))[_0xd6f0('0x26')](removeEntity(_0x446896,null))[_0xd6f0('0x36')](handleError(_0x446896,null));};exports[_0xd6f0('0xb5')]=function(_0x468cf5,_0x5aab52){return db[_0xd6f0('0x96')]['describe']()[_0xd6f0('0x26')](respondWithResult(_0x5aab52,null))['catch'](handleError(_0x5aab52,null));};exports[_0xd6f0('0xb6')]=function(_0x1dce9c,_0x58c187,_0x212920){return db[_0xd6f0('0xb7')][_0xd6f0('0x5e')]({'where':{'id':_0x1dce9c[_0xd6f0('0xaf')]['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x58c187,null))[_0xd6f0('0x26')](function(_0xd905e3){if(_0xd905e3){return _0xd905e3[_0xd6f0('0xb6')](_0x1dce9c['body'][_0xd6f0('0xb8')],_[_0xd6f0('0xb9')](_0x1dce9c['body'],[_0xd6f0('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x58c187,null))[_0xd6f0('0x36')](handleError(_0x58c187,null));};exports[_0xd6f0('0xba')]=function(_0x26aafd,_0x89a039,_0x4e2fa0){var _0x4f98a6={'raw':![],'where':{}};var _0x3638b7={};var _0x16160d={'count':0x0,'rows':[]};return db[_0xd6f0('0x96')][_0xd6f0('0xbb')]({'where':{'id':_0x26aafd[_0xd6f0('0xaf')]['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x89a039,null))[_0xd6f0('0x26')](function(_0x563c11){if(_0x563c11){_0x3638b7[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](db[_0xd6f0('0xb7')][_0xd6f0('0x38')]);_0x3638b7['query']=_[_0xd6f0('0x3c')](_0x26aafd['query']);_0x3638b7['filters']=_[_0xd6f0('0x3f')](_0x3638b7['model'],_0x3638b7[_0xd6f0('0x3b')]);_0x4f98a6[_0xd6f0('0x3e')]=_[_0xd6f0('0x3f')](_0x3638b7[_0xd6f0('0x3a')],qs[_0xd6f0('0x40')](_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x40')]));_0x4f98a6['attributes']=_0x4f98a6[_0xd6f0('0x3e')][_0xd6f0('0x41')]?_0x4f98a6[_0xd6f0('0x3e')]:_0x3638b7['model'];if(!_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0xbc')](_0xd6f0('0x42'))){_0x4f98a6[_0xd6f0('0x22')]=qs['limit'](_0x26aafd[_0xd6f0('0x3b')]['limit']);_0x4f98a6[_0xd6f0('0x21')]=qs['offset'](_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x21')]);}_0x4f98a6[_0xd6f0('0x43')]=qs[_0xd6f0('0x44')](_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x44')]);_0x4f98a6[_0xd6f0('0x45')]=qs['filters'](_['pick'](_0x26aafd[_0xd6f0('0x3b')],_0x3638b7['filters']));_0x4f98a6[_0xd6f0('0x45')][_0xd6f0('0xab')]=_0x563c11['id'];if(_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x80')]){_0x4f98a6[_0xd6f0('0x45')]=_[_0xd6f0('0x95')](_0x4f98a6[_0xd6f0('0x45')],{'$or':_[_0xd6f0('0x2f')](_0x4f98a6[_0xd6f0('0x3e')],function(_0x33ae30){var _0x37df8d={};_0x37df8d[_0x33ae30]={'$like':'%'+_0x26aafd['query'][_0xd6f0('0x80')]+'%'};return _0x37df8d;})});}if(_0x26aafd['query'][_0xd6f0('0xbd')]){var _0x210946=_0x26aafd['query'][_0xd6f0('0xbd')][_0xd6f0('0x33')](',');var _0x3704e6={};_0x3704e6[_0x210946[0x0]]={'$gte':moment(_0x210946[0x1])[_0xd6f0('0xbe')](_0xd6f0('0xbf'))};_0x4f98a6[_0xd6f0('0x45')]=_[_0xd6f0('0x95')](_0x4f98a6[_0xd6f0('0x45')],_0x3704e6);}_0x4f98a6=_[_0xd6f0('0x95')]({},_0x4f98a6,_0x26aafd['options']);return db[_0xd6f0('0xb7')][_0xd6f0('0x20')]({'where':_0x4f98a6['where']})[_0xd6f0('0x26')](function(_0x592b10){_0x16160d['count']=_0x592b10;if(_0x26aafd['query'][_0xd6f0('0xb0')]){_0x4f98a6[_0xd6f0('0xc0')]=[{'all':!![]}];}return db['SmsMessage'][_0xd6f0('0xc1')](_0x4f98a6);})[_0xd6f0('0x26')](function(_0x3fb73f){_0x16160d[_0xd6f0('0xad')]=_0x3fb73f;return _0x16160d;});}})[_0xd6f0('0x26')](respondWithFilteredResult(_0x89a039,_0x4f98a6))[_0xd6f0('0x36')](handleError(_0x89a039,null));};exports[_0xd6f0('0xc2')]=function(_0x340ca1,_0x560a37,_0x2859ab){return db[_0xd6f0('0x96')]['find']({'where':{'id':_0x340ca1[_0xd6f0('0xaf')]['id']}})['then'](handleEntityNotFound(_0x560a37,null))[_0xd6f0('0x26')](function(_0x6752ae){if(_0x6752ae){return _0x6752ae[_0xd6f0('0xc3')](_0x340ca1[_0xd6f0('0xb3')]['ids'],_[_0xd6f0('0xb9')](_0x340ca1['body'],['ids','id'])||{})[_0xd6f0('0xc4')](function(){return db[_0xd6f0('0x6b')][_0xd6f0('0xc1')]({'attributes':['id','name',_0xd6f0('0xc5')],'where':{'id':_0x340ca1[_0xd6f0('0xb3')][_0xd6f0('0xb8')]}});})[_0xd6f0('0x26')](function(_0x259b01){socket['emit'](_0xd6f0('0xc6'),{'id':Number(_0x340ca1[_0xd6f0('0xaf')]['id']),'tags':_0x259b01||[]});return{'id':Number(_0x340ca1['params']['id']),'tags':_0x259b01||[]};});}})[_0xd6f0('0x26')](respondWithResult(_0x560a37,null))['catch'](handleError(_0x560a37,null));};exports[_0xd6f0('0xc7')]=function(_0x38c3ca,_0x46f385,_0x30f693){return db[_0xd6f0('0x96')][_0xd6f0('0x5e')]({'where':{'id':_0x38c3ca[_0xd6f0('0xaf')]['id']}})['then'](handleEntityNotFound(_0x46f385,null))['then'](function(_0x1f0880){if(_0x1f0880){return _0x1f0880['removeTags'](_0x38c3ca[_0xd6f0('0x3b')][_0xd6f0('0xb8')]);}})[_0xd6f0('0x26')](respondWithStatusCode(_0x46f385,null))['catch'](handleError(_0x46f385,null));};exports[_0xd6f0('0xc8')]=function(_0x498cc2,_0x39f781){var _0x2e2fc5=moment()['unix']()[_0xd6f0('0x93')]();var _0xc4e8c=path['join'](config['root'],'server',_0xd6f0('0xc9'),_0xd6f0('0xca'));var _0x3c5883=path[_0xd6f0('0xcb')](config[_0xd6f0('0xcc')],'server',_0xd6f0('0xc9'),_0xd6f0('0xcd'));var _0x1e908d=path[_0xd6f0('0xcb')](_0xc4e8c,_0x2e2fc5);var _0x211c2a=util[_0xd6f0('0xbe')](_0xd6f0('0xce'),_0x498cc2[_0xd6f0('0xaf')]['id'],_0x2e2fc5);var _0xa4c4e3=path[_0xd6f0('0xcb')](_0xc4e8c,_0x211c2a);var _0x6bc094=[];_0x6bc094[_0xd6f0('0x35')]({'model':db[_0xd6f0('0x6d')],'as':_0xd6f0('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0x6bc094['push']({'model':db[_0xd6f0('0xcf')],'as':_0xd6f0('0x63'),'attributes':['id','firstName',_0xd6f0('0xd0')],'raw':!![]});var _0x2f7e8f=[{'model':db[_0xd6f0('0xb7')],'as':_0xd6f0('0xd1'),'attributes':['id',_0xd6f0('0xb3'),_0xd6f0('0x74'),_0xd6f0('0xd2'),'secret',_0xd6f0('0x7b')],'include':_0x6bc094}];_0x2f7e8f[_0xd6f0('0x35')]({'model':db[_0xd6f0('0xd3')],'as':_0xd6f0('0xd4'),'attributes':['id','name']});_0x2f7e8f[_0xd6f0('0x35')]({'model':db[_0xd6f0('0x6d')],'as':_0xd6f0('0xd5'),'attributes':['id','fullname']});return db[_0xd6f0('0x96')]['find']({'where':{'id':_0x498cc2[_0xd6f0('0xaf')]['id']},'include':_0x2f7e8f})[_0xd6f0('0x26')](handleEntityNotFound(_0x39f781,null))[_0xd6f0('0x26')](function(_0x2aa249){if(_0x2aa249){var _0x356b9b=_0x2aa249[_0xd6f0('0xd6')]({'plain':!![]});fs[_0xd6f0('0xd7')](_0x1e908d);var _0x1c2650={'format':'A4','border':_0xd6f0('0xd8'),'header':{'height':_0xd6f0('0xd9'),'contents':{'first':_0xd6f0('0xda')}},'footer':{'height':_0xd6f0('0xdb'),'contents':{'default':util[_0xd6f0('0xbe')](_0xd6f0('0xdc'),util[_0xd6f0('0xbe')](_0xd6f0('0xdd'),'Sms',_0x356b9b['id']),moment()[_0xd6f0('0xbe')](_0xd6f0('0xde'))[_0xd6f0('0x93')]())}}};var _0x1b50a5={'channel':'Sms','account':_0x356b9b[_0xd6f0('0xd4')]['name'],'agent':_0x356b9b['Owner']?_0x356b9b[_0xd6f0('0xd5')]['fullname']:_0xd6f0('0xdf'),'createdAt':moment(_0x356b9b[_0xd6f0('0x74')])[_0xd6f0('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6f0('0x93')](),'closedAt':_0x356b9b['closed']?moment(_0x356b9b[_0xd6f0('0xe0')])[_0xd6f0('0xbe')](_0xd6f0('0xbf'))['toString']():'','disposition':_0x356b9b[_0xd6f0('0xe1')],'messages':_(_0x356b9b[_0xd6f0('0xd1')])[_0xd6f0('0x80')]({'secret':![]})[_0xd6f0('0x2f')](function(_0x108dd8){return{'date':moment(_0x108dd8[_0xd6f0('0x74')])['format'](_0xd6f0('0xbf'))[_0xd6f0('0x93')](),'sender':_0x108dd8[_0xd6f0('0xd2')]===_0xd6f0('0xe2')?_0x108dd8['User']?_0x108dd8[_0xd6f0('0x6d')]['fullname']:_0xd6f0('0xe3'):_0x108dd8['Contact']['firstName']+(_0x108dd8[_0xd6f0('0x63')][_0xd6f0('0xd0')]?'\x20'+_0x108dd8[_0xd6f0('0x63')]['lastName']:''),'body':_0x108dd8[_0xd6f0('0xb3')],'direction':_0x108dd8['direction']===_0xd6f0('0xe2')?'A':'C','secret':_0x108dd8[_0xd6f0('0xe4')],'read':_0x108dd8[_0xd6f0('0x7b')]};})[_0xd6f0('0x60')]()};return ejs[_0xd6f0('0xe5')](path[_0xd6f0('0xcb')](config[_0xd6f0('0xcc')],_0xd6f0('0xe6'),_0xd6f0('0xe7'),_0xd6f0('0xe8')),{'interaction':_0x1b50a5})[_0xd6f0('0x26')](function(_0x1b4af2){return new BPromise(function(_0x4b964b,_0x4d99ac){pdf[_0xd6f0('0xb2')](_0x1b4af2,_0x1c2650)[_0xd6f0('0xe9')](path[_0xd6f0('0xcb')](_0x1e908d,_0xd6f0('0xea')+_0x356b9b['id']+'-'+_0x2e2fc5+'.pdf'),function(_0x27e590,_0x5e4556){if(_0x27e590)return _0x4d99ac(_0x27e590);_0x4b964b(_0x5e4556);});});})[_0xd6f0('0x26')](function(){return new BPromise(function(_0x220e81,_0x3f32e6){zipdir(_0x1e908d,{'saveTo':_0xa4c4e3},function(_0x1244e7,_0x4649d2){if(_0x1244e7)return _0x3f32e6(_0x1244e7);return _0x220e81(_0x4649d2);});})['then'](function(){return new BPromise(function(_0x2ce814,_0x174f35){rimraf(_0x1e908d,function(_0x4c3b1d){if(_0x4c3b1d)_0x174f35(_0x4c3b1d);return _0x2ce814();});});})[_0xd6f0('0x26')](function(){return _0x39f781[_0xd6f0('0xc8')](_0xa4c4e3,_0x211c2a,function(_0x2e7576){if(_0x2e7576){console[_0xd6f0('0xeb')]('err',_0x2e7576);}else{fs['unlinkSync'](_0xa4c4e3);}});});});}else{return _0x39f781[_0xd6f0('0x29')](0xc8);}})[_0xd6f0('0x36')](handleError(_0x39f781,null));}; \ No newline at end of file +var _0x5db8=['fullname','Tags','TagIds','forEach','push','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','sort','where','field','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','SmsAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','attributes','a.key','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','catch','params','includeAll','options','create','update','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','pick','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','findAll','color','emit','smsInteractionTags:save','removeTags','unix','join','server','tmp','root','attachments','User','CmContact','firstName','lastName','Messages','direction','secret','Account','Owner','get','40px','30px','format','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','N.A.','closed','closedAt','disposition','out','System','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','Users','map'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5db8,0xbb));var _0x85db=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x5db8[_0x1f44e4];return _0x591989;};'use strict';var pdf=require(_0x85db('0x0'));var emlformat=require(_0x85db('0x1'));var rimraf=require(_0x85db('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85db('0x3'));var rp=require(_0x85db('0x4'));var moment=require(_0x85db('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85db('0x6'));var path=require(_0x85db('0x7'));var sox=require(_0x85db('0x8'));var csv=require(_0x85db('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var Redis=require(_0x85db('0xf'));var authService=require(_0x85db('0x10'));var qs=require(_0x85db('0x11'));var as=require(_0x85db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85db('0x13'));var config=require(_0x85db('0x14'));var db=require('../../mysqldb')['db'];config[_0x85db('0x15')]=_['defaults'](config[_0x85db('0x15')],{'host':_0x85db('0x16'),'port':0x18eb});var socket=require(_0x85db('0x17'))(new Redis(config[_0x85db('0x15')]));require(_0x85db('0x18'))[_0x85db('0x19')](socket);function respondWithStatusCode(_0x2b7507,_0x25ec64){_0x25ec64=_0x25ec64||0xcc;return function(_0x3ca181){if(_0x3ca181){return _0x2b7507[_0x85db('0x1a')](_0x25ec64);}return _0x2b7507[_0x85db('0x1b')](_0x25ec64)[_0x85db('0x1c')]();};}function respondWithResult(_0x2be61d,_0x5ccfef){_0x5ccfef=_0x5ccfef||0xc8;return function(_0x27bd65){if(_0x27bd65){return _0x2be61d[_0x85db('0x1b')](_0x5ccfef)[_0x85db('0x1d')](_0x27bd65);}};}function respondWithFilteredResult(_0xc8fec5,_0x2ecd71){return function(_0x396afa){if(_0x396afa){var _0x3209b3=_0x396afa[_0x85db('0x1e')],_0x56d3b2=_0x2ecd71[_0x85db('0x1f')],_0x37ac04=_0x2ecd71[_0x85db('0x1f')]+_0x2ecd71[_0x85db('0x20')],_0xf89937;if(_0x37ac04>=_0x3209b3){_0x37ac04=_0x3209b3;_0xf89937=0xc8;}else{_0xf89937=0xce;}_0xc8fec5[_0x85db('0x1b')](_0xf89937);return _0xc8fec5[_0x85db('0x21')](_0x85db('0x22'),_0x56d3b2+'-'+_0x37ac04+'/'+_0x3209b3)[_0x85db('0x1d')](_0x396afa);}return null;};}function patchUpdates(_0x5c37d7){return function(_0x36a2af){try{jsonpatch[_0x85db('0x23')](_0x36a2af,_0x5c37d7,!![]);}catch(_0xc812d2){return BPromise[_0x85db('0x24')](_0xc812d2);}return _0x36a2af[_0x85db('0x25')]();};}function saveUpdates(_0x3842d7,_0x3a7148){return function(_0x3ba348){if(_0x3ba348){return _0x3ba348['update'](_0x3842d7)[_0x85db('0x26')](function(_0x2534bc){return _0x2534bc;});}return null;};}function removeEntity(_0x57fe5b,_0x3381ec){return function(_0x28f493){if(_0x28f493){return _0x28f493[_0x85db('0x27')]()['then'](function(){_0x57fe5b[_0x85db('0x1b')](0xcc)[_0x85db('0x1c')]();});}};}function handleEntityNotFound(_0x1b1980,_0x54ba03){return function(_0x5467ad){if(!_0x5467ad){_0x1b1980['sendStatus'](0x194);}return _0x5467ad;};}function handleError(_0x1e4ddb,_0x105bb9){_0x105bb9=_0x105bb9||0x1f4;return function(_0x33448e){logger['error'](_0x33448e[_0x85db('0x28')]);if(_0x33448e[_0x85db('0x29')]){delete _0x33448e[_0x85db('0x29')];}_0x1e4ddb['status'](_0x105bb9)['send'](_0x33448e);};}function getInteractionUsers(_0x299013,_0x137e42){return new BPromise(function(_0x18963a,_0x226540){try{if(_0x137e42[_0x299013['id']]){_0x299013[_0x85db('0x2a')]=_[_0x85db('0x2b')](_0x137e42[_0x299013['id']],function(_0x8af4a4){return{'id':_0x8af4a4['id'],'fullname':_0x8af4a4[_0x85db('0x2c')]};});}}catch(_0x6ee161){_0x226540(_0x6ee161);}_0x18963a(_0x299013);});}function getInteractionTags(_0x1edc8d,_0x580e90){return new BPromise(function(_0x4a15b9,_0x13ad98){try{if(_0x1edc8d['TagIds']){_0x1edc8d[_0x85db('0x2d')]=[];_0x1edc8d[_0x85db('0x2e')]['split'](',')[_0x85db('0x2f')](function(_0x26ca6f){_0x1edc8d[_0x85db('0x2d')][_0x85db('0x30')](_0x580e90[_0x26ca6f]);});}delete _0x1edc8d['TagIds'];}catch(_0x3079fc){_0x13ad98(_0x3079fc);}_0x4a15b9(_0x1edc8d);});}function updateSmsInteraction(_0x25f20f,_0x21a077,_0x41fe15){return new BPromise(function(_0x2ec392,_0x4808a4){return getInteractionUsers(_0x25f20f,_0x41fe15)[_0x85db('0x26')](function(_0x1b7325){return getInteractionTags(_0x1b7325,_0x21a077);})[_0x85db('0x26')](function(_0xd0d27){_0x2ec392(_0xd0d27);})['catch'](function(_0xfe3cd9){_0x4808a4(_0xfe3cd9);});});}exports[_0x85db('0x31')]=function(_0x2a07ee,_0x536398){var _0x550194={},_0x11d5b7={},_0x3639bc={'count':0x0,'rows':[]};var _0x4980b7=_[_0x85db('0x2b')](db[_0x85db('0x32')][_0x85db('0x33')],function(_0x240325){return{'name':_0x240325[_0x85db('0x34')],'type':_0x240325[_0x85db('0x35')][_0x85db('0x36')]};});_0x11d5b7[_0x85db('0x37')]=_[_0x85db('0x2b')](_0x4980b7,_0x85db('0x29'));_0x11d5b7[_0x85db('0x38')]=_[_0x85db('0x39')](_0x2a07ee['query']);_0x11d5b7[_0x85db('0x3a')]=_[_0x85db('0x3b')](_0x11d5b7[_0x85db('0x37')],_0x11d5b7[_0x85db('0x38')]);_0x550194['attributes']=_[_0x85db('0x3b')](_0x11d5b7[_0x85db('0x37')],qs[_0x85db('0x3c')](_0x2a07ee[_0x85db('0x38')]['fields']));_0x550194['attributes']=_0x550194['attributes']['length']?_0x550194['attributes']:_0x11d5b7[_0x85db('0x37')];if(!_0x2a07ee[_0x85db('0x38')][_0x85db('0x3d')](_0x85db('0x3e'))){_0x550194[_0x85db('0x20')]=qs['limit'](_0x2a07ee['query'][_0x85db('0x20')]);_0x550194['offset']=qs[_0x85db('0x1f')](_0x2a07ee[_0x85db('0x38')]['offset']);}_0x550194['order']=qs[_0x85db('0x3f')](_0x2a07ee[_0x85db('0x38')][_0x85db('0x3f')]);_0x550194[_0x85db('0x40')]=qs[_0x85db('0x3a')](_['pick'](_0x2a07ee[_0x85db('0x38')],_0x11d5b7[_0x85db('0x3a')]),_0x4980b7);var _0x115720=[];var _0x5be721=squel['select']()['field']('id')[_0x85db('0x41')](_0x85db('0x29'))[_0x85db('0x41')]('color')['from'](_0x85db('0x42'));var _0x48f3ae=squel[_0x85db('0x43')]()[_0x85db('0x41')](_0x85db('0x44'))['field'](_0x85db('0x45'))[_0x85db('0x41')](_0x85db('0x46'))[_0x85db('0x47')](_0x85db('0x48'),'ui')[_0x85db('0x49')](_0x85db('0x4a'),'u',_0x85db('0x4b'));var _0x15e79a=squel['select']()[_0x85db('0x47')](_0x85db('0x4c'),'i')[_0x85db('0x49')](_0x85db('0x4d'),'c',_0x85db('0x4e'))[_0x85db('0x49')]('users','o',_0x85db('0x4f'))[_0x85db('0x49')](_0x85db('0x50'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x85db('0x51'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x85db('0x49')](_0x85db('0x52'),'it',_0x85db('0x53'))[_0x85db('0x49')](_0x85db('0x42'),'t','t.id\x20=\x20it.TagId');var _0x5d44ef=squel[_0x85db('0x54')]();var _0x8a2d42=[];var _0x8d01f=squel[_0x85db('0x54')]();var _0x1b6157;if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x55')]){_0x1b6157=as[_0x85db('0x56')](_0x2a07ee[_0x85db('0x38')][_0x85db('0x55')]);var _0x5e0f2b=_0x1b6157[_0x85db('0x57')];for(var _0x2c4ae4=0x0;_0x2c4ae4<_0x1b6157['conditions']['length'];_0x2c4ae4++){var _0x8697f5=_0x1b6157[_0x85db('0x58')][_0x2c4ae4];var _0x47f8c2='i';var _0x58f674=_[_0x85db('0x59')](_0x4980b7,[_0x85db('0x29'),_0x8697f5['field']]);if(!_0x58f674){switch(_0x8697f5[_0x85db('0x41')]){case _0x85db('0x5a'):if(_0x8697f5[_0x85db('0x5b')]==0x1){_0x15e79a[_0x85db('0x5c')]('`'+_0x8697f5[_0x85db('0x41')]+_0x85db('0x5d'));}else{_0x15e79a[_0x85db('0x5c')]('`'+_0x8697f5[_0x85db('0x41')]+_0x85db('0x5e'));}break;case _0x85db('0x5f'):if(_0x8697f5['operator']==='$substring'){if(_0x8697f5[_0x85db('0x5b')][_0x85db('0x60')]('\x20')[_0x85db('0x61')]>0x1){_0x5d44ef[_0x5e0f2b](_0x85db('0x62'),qs[_0x85db('0x63')](_0x8697f5[_0x85db('0x5b')]),null);}else{var _0x745266='%'+_0x8697f5[_0x85db('0x5b')]+'%';_0x5d44ef[_0x5e0f2b](_0x85db('0x64'),_0x745266,_0x745266,_0x745266);}}else{_0x58f674=_[_0x85db('0x59')](_0x4980b7,[_0x85db('0x29'),_0x85db('0x65')]);_0x8697f5[_0x85db('0x41')]=_0x85db('0x65');_0x427250=as['buildExpression'](_0x47f8c2,_0x58f674[_0x85db('0x35')],_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250[_0x85db('0x66')],_0x427250['value'][_0x85db('0x67')],_0x427250[_0x85db('0x5b')][_0x85db('0x1c')]);}break;case _0x85db('0x68'):var _0x992a63=_0x8697f5[_0x85db('0x5b')][_0x85db('0x60')](',')['map'](function(_0x35760e){return Number(_0x35760e);});_0x992a63[_0x85db('0x2f')](function(_0x4d7e50){_0x8d01f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4d7e50+',%');});_0x8a2d42=_[_0x85db('0x69')](_0x8a2d42,_0x992a63);break;case'User':if(_0x8697f5[_0x85db('0x6a')]===_0x85db('0x6b')){_0x5d44ef[_0x5e0f2b](_0x85db('0x6c'),'%'+_0x8697f5[_0x85db('0x5b')]+'%',null);}else{_0x58f674=_['find'](_0x4980b7,[_0x85db('0x29'),'UserId']);_0x8697f5['field']='UserId';_0x427250=as[_0x85db('0x6d')](_0x47f8c2,_0x58f674[_0x85db('0x35')],_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250['text'],_0x427250[_0x85db('0x5b')][_0x85db('0x67')],_0x427250['value'][_0x85db('0x1c')]);}break;case _0x85db('0x6e'):_0x427250=as[_0x85db('0x6d')]('me',null,_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250[_0x85db('0x66')],_0x427250[_0x85db('0x5b')][_0x85db('0x67')],_0x427250['value'][_0x85db('0x1c')]);break;}}else{var _0x427250=as[_0x85db('0x6d')](_0x47f8c2,_0x58f674[_0x85db('0x35')],_0x8697f5);_0x5d44ef[_0x5e0f2b](_0x427250[_0x85db('0x66')],_0x427250[_0x85db('0x5b')][_0x85db('0x67')],_0x427250[_0x85db('0x5b')]['end']);}}}else{var _0x4bf237=_(_0x2a07ee['query'])['keys']()[_0x85db('0x2b')](function(_0x38f37f){return _[_0x85db('0x6f')](_0x4980b7,[_0x85db('0x29'),_0x38f37f])?_0x38f37f:undefined;})[_0x85db('0x70')]()[_0x85db('0x5b')]();if(!_['isEmpty'](_0x4bf237)){_0x4bf237[_0x85db('0x2f')](function(_0x6e3240){if(_0x6e3240===_0x85db('0x71')){_0x15e79a[_0x85db('0x40')]('i.SmsAccountId\x20IN\x20?',[][_0x85db('0x72')](_0x2a07ee[_0x85db('0x38')][_0x6e3240]));}else if(_0x6e3240===_0x85db('0x73')){var _0x1aa93a=JSON[_0x85db('0x74')](_0x2a07ee[_0x85db('0x38')][_0x6e3240])[_0x85db('0x75')];var _0x2af26e=JSON[_0x85db('0x74')](_0x2a07ee[_0x85db('0x38')][_0x6e3240])['$lte'];_0x15e79a[_0x85db('0x40')](_0x85db('0x76'),_0x1aa93a,_0x2af26e);}else{if(_0x2a07ee[_0x85db('0x38')][_0x6e3240]===_0x85db('0x77')){_0x15e79a[_0x85db('0x40')]('i.'+_0x6e3240+'\x20IS\x20NULL');}else{_0x15e79a[_0x85db('0x40')]('i.'+_0x6e3240+_0x85db('0x78'),_0x2a07ee[_0x85db('0x38')][_0x6e3240]);}}});}if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x79')]){if(_0x2a07ee['query'][_0x85db('0x79')]==0x1){_0x15e79a[_0x85db('0x5c')](_0x85db('0x7a'));}else{_0x15e79a['having'](_0x85db('0x7b'));}}if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x7c')]){_0x8a2d42=_['isArray'](_0x2a07ee[_0x85db('0x38')][_0x85db('0x7c')])?_0x2a07ee['query'][_0x85db('0x7c')]:new Array(_0x2a07ee[_0x85db('0x38')][_0x85db('0x7c')]);_0x8a2d42[_0x85db('0x2f')](function(_0x1ee2eb){_0x8d01f['or'](_0x85db('0x7d'),'%,'+_0x1ee2eb+',%');});}if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x7e')]){var _0x22a37a=_0x2a07ee[_0x85db('0x38')][_0x85db('0x7e')][_0x85db('0x7f')]('\x5c','\x5c\x5c')[_0x85db('0x7f')]('\x27\x27',_0x85db('0x80'));if(qs[_0x85db('0x81')](_0x22a37a)){_0x5d44ef['or']('i.id\x20LIKE\x20?',_0x22a37a+'%')['or'](_0x85db('0x82'),_0x22a37a+'%');}else{_0x5d44ef['or'](_0x85db('0x83'),qs[_0x85db('0x63')](_0x22a37a))['or'](_0x85db('0x84'),_0x22a37a+'%');}}}_0x15e79a['where'](_0x5d44ef);_0x15e79a['group'](_0x85db('0x85'));var _0x522a4a={'type':db[_0x85db('0x86')][_0x85db('0x87')][_0x85db('0x88')],'raw':!![]};var _0x59bca4=_0x15e79a[_0x85db('0x89')]();_0x59bca4[_0x85db('0x41')](_0x85db('0x85'));_0x59bca4[_0x85db('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x85db('0x5a'));if(_0x550194['order']){_0x550194[_0x85db('0x8a')][_0x85db('0x2f')](function(_0x78a07c){_0x15e79a[_0x85db('0x8a')]('i.'+_0x78a07c[0x0],_0x78a07c[0x1]===_0x85db('0x8b')?![]:!![]);});}if(!_[_0x85db('0x8c')](_0x8a2d42)){_0x15e79a[_0x85db('0x5c')](_0x8d01f);_0x59bca4[_0x85db('0x40')](_0x85db('0x8d'),_0x8a2d42);}BPromise[_0x85db('0x8e')]()[_0x85db('0x26')](function(){if(!_0x1b6157){if(_0x2a07ee[_0x85db('0x38')][_0x85db('0x71')]||_0x2a07ee['query'][_0x85db('0x8f')])return;_0x59bca4['where'](_0x85db('0x90'));_0x15e79a[_0x85db('0x40')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2a07ee[_0x85db('0x91')][_0x85db('0x92')]({'attributes':['id'],'raw':!![]})[_0x85db('0x26')](function(_0x502300){if(_[_0x85db('0x8c')](_0x502300)){_0x59bca4['where'](_0x85db('0x93'));_0x15e79a['where'](_0x85db('0x93'));}else{_0x59bca4[_0x85db('0x40')]('i.SmsAccountId\x20IN\x20?',_[_0x85db('0x2b')](_0x502300,'id'));_0x15e79a[_0x85db('0x40')](_0x85db('0x94'),_[_0x85db('0x2b')](_0x502300,'id'));}});})[_0x85db('0x26')](function(){db[_0x85db('0x95')]['query'](_0x59bca4[_0x85db('0x96')](),_0x522a4a)[_0x85db('0x26')](function(_0x3eb52c){_0x3639bc['count']=_0x3eb52c[_0x85db('0x61')];if(_0x3639bc[_0x85db('0x1e')]===0x0)return[];return db[_0x85db('0x95')][_0x85db('0x38')](_0x5be721[_0x85db('0x96')](),_0x522a4a)[_0x85db('0x26')](function(_0x13fd5){_0x115720=_[_0x85db('0x97')](_0x13fd5,'id');_0x522a4a=_[_0x85db('0x98')](_0x522a4a,{'model':db[_0x85db('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a07ee[_0x85db('0x38')]['fields']){_0x550194[_0x85db('0x99')][_0x85db('0x2f')](function(_0xdcb072){_0x15e79a['field']('i.'+_0xdcb072);});}else{_0x15e79a[_0x85db('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x85db('0x5a'));_0x15e79a['field'](_0x85db('0x9a'),'Account.key');_0x15e79a[_0x85db('0x41')]('a.mandatoryDisposition',_0x85db('0x9b'));_0x15e79a[_0x85db('0x41')]('i.*');_0x15e79a[_0x85db('0x41')]('c.firstName','Contact.firstName');_0x15e79a[_0x85db('0x41')](_0x85db('0x9c'),_0x85db('0x9d'));_0x15e79a[_0x85db('0x41')](_0x85db('0x9e'),_0x85db('0x9f'));_0x15e79a['field'](_0x85db('0xa0'),_0x85db('0xa1'));_0x15e79a[_0x85db('0x41')](_0x85db('0xa2'),_0x85db('0xa3'));_0x15e79a['field'](_0x85db('0xa4'),'Contact.fax');_0x15e79a[_0x85db('0x41')](_0x85db('0xa5'),_0x85db('0xa6'));_0x15e79a['field']('o.internal',_0x85db('0xa7'));_0x15e79a['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x550194[_0x85db('0x20')])_0x15e79a[_0x85db('0x20')](_0x550194[_0x85db('0x20')]);if(_0x550194[_0x85db('0x1f')])_0x15e79a[_0x85db('0x1f')](_0x550194[_0x85db('0x1f')]);return db[_0x85db('0x95')]['query'](_0x15e79a[_0x85db('0x96')](),_0x522a4a);})[_0x85db('0x26')](function(_0x43d786){_0x48f3ae[_0x85db('0x40')](_0x85db('0xa8'),_[_0x85db('0x2b')](_0x43d786,'id'));return db['sequelize'][_0x85db('0x38')](_0x48f3ae['toString'](),_0x522a4a)['then'](function(_0x15c530){var _0x332cab=_[_0x85db('0xa9')](_0x15c530,_0x85db('0xaa'));var _0x198415=[];_0x43d786[_0x85db('0x2f')](function(_0x8566c3){_0x198415[_0x85db('0x30')](updateSmsInteraction(_0x8566c3,_0x115720,_0x332cab));});return BPromise['all'](_0x198415);});});})[_0x85db('0x26')](function(_0x1d97b9){_0x3639bc[_0x85db('0xab')]=_0x1d97b9;return _0x3639bc;})[_0x85db('0x26')](respondWithFilteredResult(_0x536398,_0x550194));})[_0x85db('0xac')](handleError(_0x536398,null));};exports['show']=function(_0xf6fbf0,_0x392253){var _0x283c67={'raw':![],'where':{'id':_0xf6fbf0[_0x85db('0xad')]['id']}},_0x393ec2={};_0x393ec2['model']=_[_0x85db('0x39')](db[_0x85db('0x32')]['rawAttributes']);_0x393ec2[_0x85db('0x38')]=_[_0x85db('0x39')](_0xf6fbf0[_0x85db('0x38')]);_0x393ec2[_0x85db('0x3a')]=_['intersection'](_0x393ec2[_0x85db('0x37')],_0x393ec2['query']);_0x283c67[_0x85db('0x99')]=_[_0x85db('0x3b')](_0x393ec2[_0x85db('0x37')],qs['fields'](_0xf6fbf0[_0x85db('0x38')][_0x85db('0x3c')]));_0x283c67[_0x85db('0x99')]=_0x283c67[_0x85db('0x99')]['length']?_0x283c67[_0x85db('0x99')]:_0x393ec2['model'];if(_0xf6fbf0[_0x85db('0x38')][_0x85db('0xae')]){_0x283c67['include']=[{'all':!![]}];}_0x283c67=_['merge']({},_0x283c67,_0xf6fbf0[_0x85db('0xaf')]);return db['SmsInteraction'][_0x85db('0x59')](_0x283c67)[_0x85db('0x26')](handleEntityNotFound(_0x392253,null))['then'](respondWithResult(_0x392253,null))[_0x85db('0xac')](handleError(_0x392253,null));};exports[_0x85db('0xb0')]=function(_0xe6ec04,_0x593907){return db['SmsInteraction']['create'](_0xe6ec04[_0x85db('0x6e')],{})[_0x85db('0x26')](respondWithResult(_0x593907,0xc9))[_0x85db('0xac')](handleError(_0x593907,null));};exports[_0x85db('0xb1')]=function(_0x2750a7,_0x4177c9){if(_0x2750a7[_0x85db('0x6e')]['id']){delete _0x2750a7[_0x85db('0x6e')]['id'];}return db[_0x85db('0x32')][_0x85db('0x59')]({'where':{'id':_0x2750a7['params']['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x4177c9,null))[_0x85db('0x26')](saveUpdates(_0x2750a7[_0x85db('0x6e')],null))[_0x85db('0x26')](respondWithResult(_0x4177c9,null))[_0x85db('0xac')](handleError(_0x4177c9,null));};exports[_0x85db('0x27')]=function(_0x3598b7,_0x13aeed){return db['SmsInteraction'][_0x85db('0x59')]({'where':{'id':_0x3598b7[_0x85db('0xad')]['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x13aeed,null))[_0x85db('0x26')](removeEntity(_0x13aeed,null))[_0x85db('0xac')](handleError(_0x13aeed,null));};exports[_0x85db('0xb2')]=function(_0x4ae8c4,_0x836a34){return db[_0x85db('0x32')]['describe']()['then'](respondWithResult(_0x836a34,null))[_0x85db('0xac')](handleError(_0x836a34,null));};exports[_0x85db('0xb3')]=function(_0x19cfa9,_0x4f9d67,_0xb3a075){return db['SmsMessage'][_0x85db('0x59')]({'where':{'id':_0x19cfa9['params']['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x4f9d67,null))[_0x85db('0x26')](function(_0x37314a){if(_0x37314a){return _0x37314a[_0x85db('0xb3')](_0x19cfa9[_0x85db('0x6e')][_0x85db('0xb4')],_[_0x85db('0xb5')](_0x19cfa9[_0x85db('0x6e')],[_0x85db('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x4f9d67,null))[_0x85db('0xac')](handleError(_0x4f9d67,null));};exports[_0x85db('0xb6')]=function(_0x16cd11,_0x5532b0,_0x59ea88){var _0x409f9e={'raw':![],'where':{}};var _0x3c8346={};var _0x106542={'count':0x0,'rows':[]};return db[_0x85db('0x32')][_0x85db('0xb7')]({'where':{'id':_0x16cd11['params']['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x5532b0,null))[_0x85db('0x26')](function(_0x51385c){if(_0x51385c){_0x3c8346[_0x85db('0x37')]=_[_0x85db('0x39')](db[_0x85db('0xb8')][_0x85db('0x33')]);_0x3c8346[_0x85db('0x38')]=_[_0x85db('0x39')](_0x16cd11['query']);_0x3c8346['filters']=_[_0x85db('0x3b')](_0x3c8346[_0x85db('0x37')],_0x3c8346[_0x85db('0x38')]);_0x409f9e[_0x85db('0x99')]=_[_0x85db('0x3b')](_0x3c8346[_0x85db('0x37')],qs[_0x85db('0x3c')](_0x16cd11[_0x85db('0x38')]['fields']));_0x409f9e[_0x85db('0x99')]=_0x409f9e['attributes']['length']?_0x409f9e['attributes']:_0x3c8346['model'];if(!_0x16cd11[_0x85db('0x38')][_0x85db('0x3d')](_0x85db('0x3e'))){_0x409f9e['limit']=qs['limit'](_0x16cd11[_0x85db('0x38')][_0x85db('0x20')]);_0x409f9e[_0x85db('0x1f')]=qs['offset'](_0x16cd11[_0x85db('0x38')][_0x85db('0x1f')]);}_0x409f9e[_0x85db('0x8a')]=qs[_0x85db('0x3f')](_0x16cd11['query'][_0x85db('0x3f')]);_0x409f9e[_0x85db('0x40')]=qs['filters'](_[_0x85db('0xb9')](_0x16cd11[_0x85db('0x38')],_0x3c8346[_0x85db('0x3a')]));_0x409f9e[_0x85db('0x40')]['SmsInteractionId']=_0x51385c['id'];if(_0x16cd11[_0x85db('0x38')][_0x85db('0x7e')]){_0x409f9e[_0x85db('0x40')]=_[_0x85db('0x98')](_0x409f9e['where'],{'$or':_['map'](_0x409f9e['attributes'],function(_0x3f5cd2){var _0xa8f3c6={};_0xa8f3c6[_0x3f5cd2]={'$like':'%'+_0x16cd11[_0x85db('0x38')][_0x85db('0x7e')]+'%'};return _0xa8f3c6;})});}if(_0x16cd11[_0x85db('0x38')][_0x85db('0x75')]){var _0x164cdc=_0x16cd11[_0x85db('0x38')][_0x85db('0x75')]['split'](',');var _0xb82b7f={};_0xb82b7f[_0x164cdc[0x0]]={'$gte':moment(_0x164cdc[0x1])['format'](_0x85db('0xba'))};_0x409f9e[_0x85db('0x40')]=_[_0x85db('0x98')](_0x409f9e[_0x85db('0x40')],_0xb82b7f);}_0x409f9e=_[_0x85db('0x98')]({},_0x409f9e,_0x16cd11[_0x85db('0xaf')]);return db[_0x85db('0xb8')][_0x85db('0x1e')]({'where':_0x409f9e[_0x85db('0x40')]})[_0x85db('0x26')](function(_0x132f92){_0x106542['count']=_0x132f92;if(_0x16cd11['query'][_0x85db('0xae')]){_0x409f9e[_0x85db('0xbb')]=[{'all':!![]}];}return db[_0x85db('0xb8')]['findAll'](_0x409f9e);})[_0x85db('0x26')](function(_0x30e51c){_0x106542[_0x85db('0xab')]=_0x30e51c;return _0x106542;});}})[_0x85db('0x26')](respondWithFilteredResult(_0x5532b0,_0x409f9e))[_0x85db('0xac')](handleError(_0x5532b0,null));};exports[_0x85db('0xbc')]=function(_0x2472f0,_0x1b20a1,_0x2d1739){return db['SmsInteraction'][_0x85db('0x59')]({'where':{'id':_0x2472f0[_0x85db('0xad')]['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x1b20a1,null))[_0x85db('0x26')](function(_0x3fdecd){if(_0x3fdecd){return _0x3fdecd[_0x85db('0xbd')](_0x2472f0[_0x85db('0x6e')]['ids'],_[_0x85db('0xb5')](_0x2472f0[_0x85db('0x6e')],[_0x85db('0xb4'),'id'])||{})[_0x85db('0xbe')](function(){return db['Tag'][_0x85db('0xbf')]({'attributes':['id',_0x85db('0x29'),_0x85db('0xc0')],'where':{'id':_0x2472f0[_0x85db('0x6e')][_0x85db('0xb4')]}});})[_0x85db('0x26')](function(_0x45b430){socket[_0x85db('0xc1')](_0x85db('0xc2'),{'id':Number(_0x2472f0[_0x85db('0xad')]['id']),'tags':_0x45b430||[]});return{'id':Number(_0x2472f0['params']['id']),'tags':_0x45b430||[]};});}})[_0x85db('0x26')](respondWithResult(_0x1b20a1,null))[_0x85db('0xac')](handleError(_0x1b20a1,null));};exports['removeTags']=function(_0x125f6c,_0x91ce6c,_0x13a5a2){return db[_0x85db('0x32')][_0x85db('0x59')]({'where':{'id':_0x125f6c[_0x85db('0xad')]['id']}})[_0x85db('0x26')](handleEntityNotFound(_0x91ce6c,null))[_0x85db('0x26')](function(_0x585bbe){if(_0x585bbe){return _0x585bbe[_0x85db('0xc3')](_0x125f6c[_0x85db('0x38')]['ids']);}})[_0x85db('0x26')](respondWithStatusCode(_0x91ce6c,null))['catch'](handleError(_0x91ce6c,null));};exports['download']=function(_0x45b004,_0x1b1018){var _0x2bd580=moment()[_0x85db('0xc4')]()[_0x85db('0x96')]();var _0x328e4c=path[_0x85db('0xc5')](config['root'],_0x85db('0xc6'),'files',_0x85db('0xc7'));var _0x723186=path[_0x85db('0xc5')](config[_0x85db('0xc8')],_0x85db('0xc6'),'files',_0x85db('0xc9'));var _0x467df0=path['join'](_0x328e4c,_0x2bd580);var _0x21e516=util['format']('transcript-%d-%s.zip',_0x45b004[_0x85db('0xad')]['id'],_0x2bd580);var _0x43c521=path['join'](_0x328e4c,_0x21e516);var _0x3c1c48=[];_0x3c1c48[_0x85db('0x30')]({'model':db[_0x85db('0xca')],'as':'User','attributes':['id',_0x85db('0x2c')],'raw':!![]});_0x3c1c48[_0x85db('0x30')]({'model':db[_0x85db('0xcb')],'as':'Contact','attributes':['id',_0x85db('0xcc'),_0x85db('0xcd')],'raw':!![]});var _0x8121ad=[{'model':db[_0x85db('0xb8')],'as':_0x85db('0xce'),'attributes':['id',_0x85db('0x6e'),_0x85db('0x73'),_0x85db('0xcf'),_0x85db('0xd0'),_0x85db('0x79')],'include':_0x3c1c48}];_0x8121ad[_0x85db('0x30')]({'model':db['SmsAccount'],'as':_0x85db('0xd1'),'attributes':['id','name']});_0x8121ad[_0x85db('0x30')]({'model':db['User'],'as':_0x85db('0xd2'),'attributes':['id',_0x85db('0x2c')]});return db[_0x85db('0x32')][_0x85db('0x59')]({'where':{'id':_0x45b004[_0x85db('0xad')]['id']},'include':_0x8121ad})[_0x85db('0x26')](handleEntityNotFound(_0x1b1018,null))[_0x85db('0x26')](function(_0x1c8b7b){if(_0x1c8b7b){var _0x5cf9f4=_0x1c8b7b[_0x85db('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x467df0);var _0xe94a7a={'format':'A4','border':'10px','header':{'height':_0x85db('0xd4'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x85db('0xd5'),'contents':{'default':util[_0x85db('0xd6')](_0x85db('0xd7'),util[_0x85db('0xd6')]('%s\x20#%d',_0x85db('0xd8'),_0x5cf9f4['id']),moment()[_0x85db('0xd6')](_0x85db('0xd9'))[_0x85db('0x96')]())}}};var _0x51c81e={'channel':_0x85db('0xd8'),'account':_0x5cf9f4[_0x85db('0xd1')][_0x85db('0x29')],'agent':_0x5cf9f4[_0x85db('0xd2')]?_0x5cf9f4[_0x85db('0xd2')][_0x85db('0x2c')]:_0x85db('0xda'),'createdAt':moment(_0x5cf9f4[_0x85db('0x73')])['format'](_0x85db('0xba'))['toString'](),'closedAt':_0x5cf9f4[_0x85db('0xdb')]?moment(_0x5cf9f4[_0x85db('0xdc')])['format'](_0x85db('0xba'))[_0x85db('0x96')]():'','disposition':_0x5cf9f4[_0x85db('0xdd')],'messages':_(_0x5cf9f4[_0x85db('0xce')])[_0x85db('0x7e')]({'secret':![]})['map'](function(_0x729d78){return{'date':moment(_0x729d78[_0x85db('0x73')])['format'](_0x85db('0xba'))[_0x85db('0x96')](),'sender':_0x729d78[_0x85db('0xcf')]===_0x85db('0xde')?_0x729d78[_0x85db('0xca')]?_0x729d78[_0x85db('0xca')][_0x85db('0x2c')]:_0x85db('0xdf'):_0x729d78[_0x85db('0x5f')][_0x85db('0xcc')]+(_0x729d78[_0x85db('0x5f')][_0x85db('0xcd')]?'\x20'+_0x729d78[_0x85db('0x5f')][_0x85db('0xcd')]:''),'body':_0x729d78[_0x85db('0x6e')],'direction':_0x729d78[_0x85db('0xcf')]===_0x85db('0xde')?'A':'C','secret':_0x729d78['secret'],'read':_0x729d78['read']};})[_0x85db('0x5b')]()};return ejs[_0x85db('0xe0')](path['join'](config[_0x85db('0xc8')],_0x85db('0xc6'),'views',_0x85db('0xe1')),{'interaction':_0x51c81e})[_0x85db('0x26')](function(_0x478fba){return new BPromise(function(_0x4d08e6,_0x2d604f){pdf[_0x85db('0xb0')](_0x478fba,_0xe94a7a)['toFile'](path['join'](_0x467df0,_0x85db('0xe2')+_0x5cf9f4['id']+'-'+_0x2bd580+_0x85db('0xe3')),function(_0x2e0d08,_0x33d5f9){if(_0x2e0d08)return _0x2d604f(_0x2e0d08);_0x4d08e6(_0x33d5f9);});});})[_0x85db('0x26')](function(){return new BPromise(function(_0x227852,_0x454a34){zipdir(_0x467df0,{'saveTo':_0x43c521},function(_0x46dce1,_0x7fb59e){if(_0x46dce1)return _0x454a34(_0x46dce1);return _0x227852(_0x7fb59e);});})[_0x85db('0x26')](function(){return new BPromise(function(_0x1d3c49,_0x289dc9){rimraf(_0x467df0,function(_0x516d35){if(_0x516d35)_0x289dc9(_0x516d35);return _0x1d3c49();});});})['then'](function(){return _0x1b1018['download'](_0x43c521,_0x21e516,function(_0x57b26a){if(_0x57b26a){console[_0x85db('0xe4')](_0x85db('0xe5'),_0x57b26a);}else{fs[_0x85db('0xe6')](_0x43c521);}});});});}else{return _0x1b1018[_0x85db('0x1a')](0xc8);}})[_0x85db('0xac')](handleError(_0x1b1018,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f455c18..64022a1 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 _0xd67b=['map','findAll','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue','Users'];(function(_0x4d4c66,_0x557376){var _0x3e2a3b=function(_0x107067){while(--_0x107067){_0x4d4c66['push'](_0x4d4c66['shift']());}};_0x3e2a3b(++_0x557376);}(_0xd67b,0x133));var _0xbd67=function(_0x1e8533,_0x42deba){_0x1e8533=_0x1e8533-0x0;var _0xa44709=_0xd67b[_0x1e8533];return _0xa44709;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xbd67('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0xbd67('0x0'))['db'][_0xbd67('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xbd67('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbd67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1bf96){return function(_0x5a827b,_0x309962,_0xa5c384){_0x5a827b[_0xbd67('0x4')]({'attributes':['id'],'raw':!![]})[_0xbd67('0x5')](function(_0x1860c9){_0x5a827b[_0xbd67('0x6')](_0xbd67('0x7'),_0x1860c9[_0xbd67('0x8')](function(_0x1da7f1){return{'id':_0x1da7f1['id']};}));return SmsMessage[_0xbd67('0x9')]({'where':{'SmsInteractionId':_0x5a827b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbd67('0x5')](function(_0x3a7f43){_0x5a827b[_0xbd67('0x6')]('unreadMessages',_0x3a7f43['length']);SmsInteractionEvents[_0xbd67('0xa')](_0x1bf96+':'+_0x5a827b['id'],_0x5a827b);SmsInteractionEvents['emit'](_0x1bf96,_0x5a827b);_0xa5c384(null);})[_0xbd67('0xb')](_0xa5c384(null));};}for(var e in events){if(events[_0xbd67('0xc')](e)){var event=events[e];SmsInteraction[_0xbd67('0xd')](e,emitEvent(event));}}module[_0xbd67('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x0309=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','SmsMessage'];(function(_0x166886,_0x382754){var _0x29b31f=function(_0x21fa1f){while(--_0x21fa1f){_0x166886['push'](_0x166886['shift']());}};_0x29b31f(++_0x382754);}(_0x0309,0x165));var _0x9030=function(_0x3706a6,_0x5f040c){_0x3706a6=_0x3706a6-0x0;var _0x3203ba=_0x0309[_0x3706a6];return _0x3203ba;};'use strict';var EventEmitter=require(_0x9030('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x9030('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x9030('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9030('0x3')](0x0);var events={'afterCreate':_0x9030('0x4'),'afterUpdate':_0x9030('0x5'),'afterDestroy':_0x9030('0x6')};function emitEvent(_0x2e6276){return function(_0xcbbe57,_0x482786,_0x5a3334){_0xcbbe57[_0x9030('0x7')]({'attributes':['id'],'raw':!![]})[_0x9030('0x8')](function(_0x4f2d84){_0xcbbe57[_0x9030('0x9')]('Users',_0x4f2d84[_0x9030('0xa')](function(_0x32d47d){return{'id':_0x32d47d['id']};}));return SmsMessage[_0x9030('0xb')]({'where':{'SmsInteractionId':_0xcbbe57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xe2c28b){_0xcbbe57[_0x9030('0x9')](_0x9030('0xc'),_0xe2c28b['length']);SmsInteractionEvents[_0x9030('0xd')](_0x2e6276+':'+_0xcbbe57['id'],_0xcbbe57);SmsInteractionEvents[_0x9030('0xd')](_0x2e6276,_0xcbbe57);_0x5a3334(null);})[_0x9030('0xe')](_0x5a3334(null));};}for(var e in events){if(events[_0x9030('0xf')](e)){var event=events[e];SmsInteraction[_0x9030('0x10')](e,emitEvent(event));}}module[_0x9030('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 ef0d235..ca466b7 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 _0x4af7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xe212e7,_0x2a7f83){var _0xfa290c=function(_0x23330f){while(--_0x23330f){_0xe212e7['push'](_0xe212e7['shift']());}};_0xfa290c(++_0x2a7f83);}(_0x4af7,0x121));var _0x74af=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x4af7[_0xfedc72];return _0x2c7c78;};'use strict';var _=require('lodash');var util=require(_0x74af('0x0'));var logger=require(_0x74af('0x1'))('api');var moment=require(_0x74af('0x2'));var BPromise=require(_0x74af('0x3'));var rp=require(_0x74af('0x4'));var fs=require('fs');var path=require(_0x74af('0x5'));var rimraf=require(_0x74af('0x6'));var config=require(_0x74af('0x7'));var attributes=require(_0x74af('0x8'));module[_0x74af('0x9')]=function(_0x523604,_0x42d092){return _0x523604['define'](_0x74af('0xa'),attributes,{'tableName':_0x74af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39bbe1,_0x1cbb82,_0x20d5a7){if(_0x39bbe1[_0x74af('0xc')](_0x74af('0xd'))){_0x39bbe1[_0x74af('0xe')]=moment()[_0x74af('0xf')](_0x74af('0x10'));}_0x20d5a7(null,_0x39bbe1);}}});}; \ No newline at end of file +var _0x997d=['./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x188d1b,_0x10d96d){var _0x3c7d67=function(_0x238ee5){while(--_0x238ee5){_0x188d1b['push'](_0x188d1b['shift']());}};_0x3c7d67(++_0x10d96d);}(_0x997d,0x181));var _0xd997=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0x997d[_0x2eec1f];return _0x543075;};'use strict';var _=require(_0xd997('0x0'));var util=require(_0xd997('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd997('0x2'));var BPromise=require(_0xd997('0x3'));var rp=require(_0xd997('0x4'));var fs=require('fs');var path=require(_0xd997('0x5'));var rimraf=require('rimraf');var config=require(_0xd997('0x6'));var attributes=require(_0xd997('0x7'));module[_0xd997('0x8')]=function(_0xcb443c,_0xcedc23){return _0xcb443c[_0xd997('0x9')](_0xd997('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1000ad,_0x34dcb3,_0x223e5d){if(_0x1000ad[_0xd997('0xb')](_0xd997('0xc'))){_0x1000ad['closedAt']=moment()['format'](_0xd997('0xd'));}_0x223e5d(null,_0x1000ad);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 398ff16..a8d06fa 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 _0x3aec=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x131614,_0x87a6e){var _0x33a5b3=function(_0x5911fa){while(--_0x5911fa){_0x131614['push'](_0x131614['shift']());}};_0x33a5b3(++_0x87a6e);}(_0x3aec,0x78));var _0xc3ae=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x3aec[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0xc3ae('0x0'));var util=require(_0xc3ae('0x1'));var moment=require(_0xc3ae('0x2'));var BPromise=require(_0xc3ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ae('0x4'));var db=require(_0xc3ae('0x5'))['db'];var utils=require(_0xc3ae('0x6'));var logger=require(_0xc3ae('0x7'))(_0xc3ae('0x8'));var config=require(_0xc3ae('0x9'));var jayson=require(_0xc3ae('0xa'));var client=jayson[_0xc3ae('0xb')][_0xc3ae('0xc')]({'port':0x232a});config[_0xc3ae('0xd')]=_['defaults'](config[_0xc3ae('0xd')],{'host':_0xc3ae('0xe'),'port':0x18eb});var socket=require(_0xc3ae('0xf'))(new Redis(config[_0xc3ae('0xd')]));require(_0xc3ae('0x10'))[_0xc3ae('0x11')](socket);function respondWithRpcPromise(_0x2f5416,_0x3e28af,_0x2ecc20){return new BPromise(function(_0x58c1d7,_0x1db974){return client['request'](_0x2f5416,_0x2ecc20)['then'](function(_0x5824e5){logger[_0xc3ae('0x12')](_0xc3ae('0x13'),_0x3e28af,'request\x20sent');logger['debug'](_0xc3ae('0x14'),_0x3e28af,_0xc3ae('0x15'),JSON[_0xc3ae('0x16')](_0x5824e5));if(_0x5824e5['error']){if(_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x18')]===0x1f4){logger[_0xc3ae('0x17')](_0xc3ae('0x13'),_0x3e28af,_0x5824e5['error']['message']);return _0x1db974(_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x19')]);}logger[_0xc3ae('0x17')](_0xc3ae('0x13'),_0x3e28af,_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x19')]);return _0x58c1d7(_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x19')]);}else{logger['info'](_0xc3ae('0x13'),_0x3e28af,_0xc3ae('0x15'));_0x58c1d7(_0x5824e5['result'][_0xc3ae('0x19')]);}})[_0xc3ae('0x1a')](function(_0x430373){logger[_0xc3ae('0x17')](_0xc3ae('0x13'),_0x3e28af,_0x430373);_0x1db974(_0x430373);});});}exports['UpdateSmsInteraction']=function(_0x20ddfe){var _0x47d7bd=this;return new Promise(function(_0x5a332d,_0x40b954){return db[_0xc3ae('0x1b')][_0xc3ae('0x1c')](_0x20ddfe[_0xc3ae('0x1d')],{'raw':_0x20ddfe[_0xc3ae('0x1e')]?_0x20ddfe[_0xc3ae('0x1e')][_0xc3ae('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ddfe['options']?_0x20ddfe[_0xc3ae('0x1e')]['where']||null:null,'attributes':_0x20ddfe[_0xc3ae('0x1e')]?_0x20ddfe[_0xc3ae('0x1e')][_0xc3ae('0x20')]||null:null,'limit':_0x20ddfe['options']?_0x20ddfe[_0xc3ae('0x1e')][_0xc3ae('0x21')]||null:null})['then'](function(_0x311b77){logger[_0xc3ae('0x12')](_0xc3ae('0x22'),_0x20ddfe);logger[_0xc3ae('0x23')](_0xc3ae('0x22'),_0x20ddfe,JSON[_0xc3ae('0x16')](_0x311b77));_0x5a332d(_0x311b77);})['catch'](function(_0x2a3f66){logger[_0xc3ae('0x17')](_0xc3ae('0x22'),_0x2a3f66[_0xc3ae('0x19')],_0x20ddfe);_0x40b954(_0x47d7bd['error'](0x1f4,_0x2a3f66[_0xc3ae('0x19')]));});});};exports[_0xc3ae('0x24')]=function(_0x901ce8){return new Promise(function(_0x271812,_0x33bce0){return db['SmsInteraction'][_0xc3ae('0x25')]({'where':_0x901ce8['options']?_0x901ce8[_0xc3ae('0x1e')][_0xc3ae('0x26')]||null:null})['then'](function(_0x42a6fe){if(_0x42a6fe){return _0x42a6fe[_0xc3ae('0x27')](_0x901ce8[_0xc3ae('0x1d')][_0xc3ae('0x28')],_[_0xc3ae('0x29')](_0x901ce8[_0xc3ae('0x1d')],[_0xc3ae('0x28'),'id'])||{});}})['spread'](function(_0x59a0aa){logger[_0xc3ae('0x12')](_0xc3ae('0x2a'),_0x901ce8);logger[_0xc3ae('0x23')](_0xc3ae('0x2a'),_0x901ce8,JSON[_0xc3ae('0x16')](_0x59a0aa));_0x271812(_0x59a0aa);})[_0xc3ae('0x1a')](function(_0x555a29){logger[_0xc3ae('0x17')](_0xc3ae('0x2a'),_0x555a29[_0xc3ae('0x19')],_0x901ce8);_0x33bce0(_this['error'](0x1f4,_0x555a29[_0xc3ae('0x19')]));});});}; \ No newline at end of file +var _0x86be=['catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1f03e6,_0xea8efa){var _0x125621=function(_0x5424b8){while(--_0x5424b8){_0x1f03e6['push'](_0x1f03e6['shift']());}};_0x125621(++_0xea8efa);}(_0x86be,0x13f));var _0xe86b=function(_0x3b0dbc,_0x2661bd){_0x3b0dbc=_0x3b0dbc-0x0;var _0x527897=_0x86be[_0x3b0dbc];return _0x527897;};'use strict';var _=require('lodash');var util=require(_0xe86b('0x0'));var moment=require('moment');var BPromise=require(_0xe86b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe86b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe86b('0x3'));var logger=require(_0xe86b('0x4'))(_0xe86b('0x5'));var config=require(_0xe86b('0x6'));var jayson=require(_0xe86b('0x7'));var client=jayson[_0xe86b('0x8')][_0xe86b('0x9')]({'port':0x232a});config[_0xe86b('0xa')]=_['defaults'](config[_0xe86b('0xa')],{'host':_0xe86b('0xb'),'port':0x18eb});var socket=require(_0xe86b('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xe86b('0xd')](socket);function respondWithRpcPromise(_0x231a3e,_0x1181bd,_0x3e97ea){return new BPromise(function(_0x75e020,_0x3ff1f2){return client[_0xe86b('0xe')](_0x231a3e,_0x3e97ea)['then'](function(_0x512cf0){logger[_0xe86b('0xf')](_0xe86b('0x10'),_0x1181bd,_0xe86b('0x11'));logger[_0xe86b('0x12')](_0xe86b('0x13'),_0x1181bd,_0xe86b('0x11'),JSON[_0xe86b('0x14')](_0x512cf0));if(_0x512cf0[_0xe86b('0x15')]){if(_0x512cf0[_0xe86b('0x15')][_0xe86b('0x16')]===0x1f4){logger[_0xe86b('0x15')](_0xe86b('0x10'),_0x1181bd,_0x512cf0[_0xe86b('0x15')][_0xe86b('0x17')]);return _0x3ff1f2(_0x512cf0['error'][_0xe86b('0x17')]);}logger['error'](_0xe86b('0x10'),_0x1181bd,_0x512cf0['error'][_0xe86b('0x17')]);return _0x75e020(_0x512cf0[_0xe86b('0x15')][_0xe86b('0x17')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x1181bd,_0xe86b('0x11'));_0x75e020(_0x512cf0[_0xe86b('0x18')][_0xe86b('0x17')]);}})[_0xe86b('0x19')](function(_0x14f252){logger[_0xe86b('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x1181bd,_0x14f252);_0x3ff1f2(_0x14f252);});});}exports[_0xe86b('0x1a')]=function(_0x575b2b){var _0x4a98c9=this;return new Promise(function(_0x292c7d,_0x594173){return db[_0xe86b('0x1b')][_0xe86b('0x1c')](_0x575b2b[_0xe86b('0x1d')],{'raw':_0x575b2b[_0xe86b('0x1e')]?_0x575b2b[_0xe86b('0x1e')][_0xe86b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x575b2b[_0xe86b('0x1e')]?_0x575b2b['options'][_0xe86b('0x20')]||null:null,'attributes':_0x575b2b[_0xe86b('0x1e')]?_0x575b2b['options'][_0xe86b('0x21')]||null:null,'limit':_0x575b2b[_0xe86b('0x1e')]?_0x575b2b[_0xe86b('0x1e')][_0xe86b('0x22')]||null:null})[_0xe86b('0x23')](function(_0x56f394){logger[_0xe86b('0xf')](_0xe86b('0x1a'),_0x575b2b);logger[_0xe86b('0x12')](_0xe86b('0x1a'),_0x575b2b,JSON[_0xe86b('0x14')](_0x56f394));_0x292c7d(_0x56f394);})[_0xe86b('0x19')](function(_0x5148aa){logger[_0xe86b('0x15')](_0xe86b('0x1a'),_0x5148aa['message'],_0x575b2b);_0x594173(_0x4a98c9[_0xe86b('0x15')](0x1f4,_0x5148aa[_0xe86b('0x17')]));});});};exports[_0xe86b('0x24')]=function(_0x38e902){return new Promise(function(_0x34d68b,_0x35640a){return db[_0xe86b('0x1b')][_0xe86b('0x25')]({'where':_0x38e902[_0xe86b('0x1e')]?_0x38e902['options'][_0xe86b('0x20')]||null:null})[_0xe86b('0x23')](function(_0x250882){if(_0x250882){return _0x250882[_0xe86b('0x26')](_0x38e902[_0xe86b('0x1d')][_0xe86b('0x27')],_[_0xe86b('0x28')](_0x38e902[_0xe86b('0x1d')],[_0xe86b('0x27'),'id'])||{});}})[_0xe86b('0x29')](function(_0x43e094){logger[_0xe86b('0xf')](_0xe86b('0x2a'),_0x38e902);logger[_0xe86b('0x12')]('AddTags',_0x38e902,JSON[_0xe86b('0x14')](_0x43e094));_0x34d68b(_0x43e094);})[_0xe86b('0x19')](function(_0x2e974f){logger[_0xe86b('0x15')](_0xe86b('0x2a'),_0x2e974f[_0xe86b('0x17')],_0x38e902);_0x35640a(_this['error'](0x1f4,_0x2e974f[_0xe86b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 73d6ca1..dcb1fea 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x455fea,_0x51f808){_0x455fea=_0x455fea-0x0;var _0x32f39b=_0xb10b[_0x455fea];return _0x32f39b;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x396882,_0x361617){var _0x55efc7=function(_0x42549e){while(--_0x42549e){_0x396882['push'](_0x396882['shift']());}};_0x55efc7(++_0x361617);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 479dc9a..a657cc8 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 _0x1d45=['reject','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','sms','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x1d45,0xc1));var _0x51d4=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x1d45[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require(_0x51d4('0x0'));var path=require(_0x51d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x51d4('0x2'));var router=express[_0x51d4('0x3')]();var auth=require(_0x51d4('0x4'));var interaction=require(_0x51d4('0x5'));var config=require(_0x51d4('0x6'));var controller=require(_0x51d4('0x7'));router[_0x51d4('0x8')]('/',auth[_0x51d4('0x9')](),controller[_0x51d4('0xa')]);router['get']('/describe',auth[_0x51d4('0x9')](),controller[_0x51d4('0xb')]);router[_0x51d4('0x8')](_0x51d4('0xc'),auth[_0x51d4('0x9')](),controller[_0x51d4('0xd')]);router[_0x51d4('0xe')]('/',auth[_0x51d4('0x9')](),interaction['tracked'](_0x51d4('0xf'),_0x51d4('0x10')),controller[_0x51d4('0x11')]);router[_0x51d4('0xe')]('/:id/status',controller[_0x51d4('0x12')]);router[_0x51d4('0x13')](_0x51d4('0xc'),auth[_0x51d4('0x9')](),controller['update']);router[_0x51d4('0x13')](_0x51d4('0x14'),auth[_0x51d4('0x9')](),controller[_0x51d4('0x15')]);router[_0x51d4('0x13')](_0x51d4('0x16'),auth[_0x51d4('0x9')](),controller[_0x51d4('0x17')]);router[_0x51d4('0x18')](_0x51d4('0xc'),auth[_0x51d4('0x9')](),controller[_0x51d4('0x19')]);module[_0x51d4('0x1a')]=router; \ No newline at end of file +var _0x513f=['smsmessage:create','/:id/status','put','update','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','sms'];(function(_0x5a7569,_0x4eaefe){var _0x27ca44=function(_0x59d492){while(--_0x59d492){_0x5a7569['push'](_0x5a7569['shift']());}};_0x27ca44(++_0x4eaefe);}(_0x513f,0xe9));var _0xf513=function(_0x428ef1,_0x178844){_0x428ef1=_0x428ef1-0x0;var _0x2f89b4=_0x513f[_0x428ef1];return _0x2f89b4;};'use strict';var multer=require(_0xf513('0x0'));var util=require(_0xf513('0x1'));var path=require(_0xf513('0x2'));var timeout=require('connect-timeout');var express=require(_0xf513('0x3'));var router=express[_0xf513('0x4')]();var auth=require(_0xf513('0x5'));var interaction=require(_0xf513('0x6'));var config=require('../../config/environment');var controller=require(_0xf513('0x7'));router[_0xf513('0x8')]('/',auth['isAuthenticated'](),controller[_0xf513('0x9')]);router[_0xf513('0x8')](_0xf513('0xa'),auth[_0xf513('0xb')](),controller[_0xf513('0xc')]);router[_0xf513('0x8')](_0xf513('0xd'),auth[_0xf513('0xb')](),controller[_0xf513('0xe')]);router[_0xf513('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xf513('0x10'),_0xf513('0x11')),controller['create']);router[_0xf513('0xf')](_0xf513('0x12'),controller['status']);router[_0xf513('0x13')](_0xf513('0xd'),auth[_0xf513('0xb')](),controller[_0xf513('0x14')]);router[_0xf513('0x13')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xf513('0x13')](_0xf513('0x15'),auth['isAuthenticated'](),controller[_0xf513('0x16')]);router['delete'](_0xf513('0xd'),auth[_0xf513('0xb')](),controller[_0xf513('0x17')]);module[_0xf513('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 722144d..1282b90 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 _0x2127=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x41f936,_0x217ec3){var _0x11a6fe=function(_0x551da4){while(--_0x551da4){_0x41f936['push'](_0x41f936['shift']());}};_0x11a6fe(++_0x217ec3);}(_0x2127,0x8a));var _0x7212=function(_0x5c85b0,_0x2981fb){_0x5c85b0=_0x5c85b0-0x0;var _0x42b216=_0x2127[_0x5c85b0];return _0x42b216;};'use strict';var Sequelize=require(_0x7212('0x0'));module[_0x7212('0x1')]={'body':{'type':Sequelize[_0x7212('0x2')](_0x7212('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7212('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7212('0x5')]('in',_0x7212('0x6')),'defaultValue':_0x7212('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7212('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x7212('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xcdd0=['ENUM','out','STRING','sequelize','exports','medium','BOOLEAN'];(function(_0x33b233,_0xd8107e){var _0x206d11=function(_0x3ebdb1){while(--_0x3ebdb1){_0x33b233['push'](_0x33b233['shift']());}};_0x206d11(++_0xd8107e);}(_0xcdd0,0x184));var _0x0cdd=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xcdd0[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x0cdd('0x0'));module[_0x0cdd('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0cdd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0cdd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0cdd('0x4')]('in',_0x0cdd('0x5')),'defaultValue':_0x0cdd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0cdd('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0cdd('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0cdd('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ef43591..b54284e 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 _0x4058=['[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','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','defaults','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','find','create','body','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','accept','EventManager','acceptmessage','agent'];(function(_0x763d08,_0x434cf5){var _0x4ef90f=function(_0x4ff8a0){while(--_0x4ff8a0){_0x763d08['push'](_0x763d08['shift']());}};_0x4ef90f(++_0x434cf5);}(_0x4058,0x129));var _0x8405=function(_0x4b71c7,_0x155cde){_0x4b71c7=_0x4b71c7-0x0;var _0x10b764=_0x4058[_0x4b71c7];return _0x10b764;};'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'];config['redis']=_[_0x8405('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x8405('0x16')](socket);var jayson=require(_0x8405('0x17'));var client=jayson['client'][_0x8405('0x18')]({'port':0x232c});var client9002=jayson[_0x8405('0x19')][_0x8405('0x18')]({'port':0x232a});function checkPasswordPattern(_0x422822,_0x58eb66,_0x218fe7){if(_0x218fe7){var _0x2d7601=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d7601[_0x8405('0x1a')](_0x58eb66)){return _0x422822;}else{throw new db[(_0x8405('0x1b'))][(_0x8405('0x1c'))](_0x8405('0x1d'));}}else{return _0x422822;}}function respondWithRpcPromise(_0x2d067e,_0x358633,_0x30a506,_0x1e608f){return new BPromise(function(_0x34c79c,_0x21376d){var _0x131857=_0x1e608f||client;return _0x131857[_0x8405('0x1e')](_0x2d067e,_0x30a506)[_0x8405('0x1f')](function(_0x42c191){logger[_0x8405('0x20')](_0x8405('0x21'),_0x358633,_0x8405('0x22'));logger[_0x8405('0x23')](_0x8405('0x24'),_0x358633,_0x8405('0x22'),JSON[_0x8405('0x25')](_0x42c191));if(_0x42c191[_0x8405('0x26')]){if(_0x42c191[_0x8405('0x26')][_0x8405('0x27')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x358633,_0x42c191[_0x8405('0x26')][_0x8405('0x28')]);return _0x21376d(_0x42c191[_0x8405('0x26')]['message']);}logger[_0x8405('0x26')]('SmsMessage,\x20%s,\x20%s',_0x358633,_0x42c191[_0x8405('0x26')]['message']);return _0x34c79c(_0x42c191[_0x8405('0x26')][_0x8405('0x28')]);}else{logger[_0x8405('0x20')](_0x8405('0x21'),_0x358633,_0x8405('0x22'));_0x34c79c(_0x42c191[_0x8405('0x29')][_0x8405('0x28')]);}})[_0x8405('0x2a')](function(_0x44b495){logger[_0x8405('0x26')](_0x8405('0x21'),_0x358633,_0x44b495);_0x21376d(_0x44b495);});});}function respondWithStatusCode(_0x293789,_0x53bb61){_0x53bb61=_0x53bb61||0xcc;return function(_0x132c0f){if(_0x132c0f){return _0x293789['sendStatus'](_0x53bb61);}return _0x293789['status'](_0x53bb61)[_0x8405('0x2b')]();};}function respondWithResult(_0x41f06a,_0x3022cc){_0x3022cc=_0x3022cc||0xc8;return function(_0x26d5ec){if(_0x26d5ec){return _0x41f06a[_0x8405('0x2c')](_0x3022cc)[_0x8405('0x2d')](_0x26d5ec);}};}function respondWithFilteredResult(_0x45fd8f,_0xa1efa2){return function(_0x7e216b){if(_0x7e216b){var _0xe019ff=_0x7e216b['count'],_0x20bca3=_0xa1efa2[_0x8405('0x2e')],_0x3b14e5=_0xa1efa2[_0x8405('0x2e')]+_0xa1efa2['limit'],_0xcbee2b;if(_0x3b14e5>=_0xe019ff){_0x3b14e5=_0xe019ff;_0xcbee2b=0xc8;}else{_0xcbee2b=0xce;}_0x45fd8f[_0x8405('0x2c')](_0xcbee2b);return _0x45fd8f[_0x8405('0x2f')](_0x8405('0x30'),_0x20bca3+'-'+_0x3b14e5+'/'+_0xe019ff)['json'](_0x7e216b);}return null;};}function patchUpdates(_0x130bd2){return function(_0x42c28f){try{jsonpatch[_0x8405('0x31')](_0x42c28f,_0x130bd2,!![]);}catch(_0x518f27){return BPromise[_0x8405('0x32')](_0x518f27);}return _0x42c28f[_0x8405('0x33')]();};}function saveUpdates(_0x50c891,_0x1ebf6f){return function(_0x5e67de){if(_0x5e67de){return _0x5e67de[_0x8405('0x34')](_0x50c891)[_0x8405('0x1f')](function(_0xa0e7a5){return _0xa0e7a5;});}return null;};}function removeEntity(_0xe8de32,_0xafcc64){return function(_0x2b0929){if(_0x2b0929){return _0x2b0929[_0x8405('0x35')]()[_0x8405('0x1f')](function(){_0xe8de32[_0x8405('0x2c')](0xcc)[_0x8405('0x2b')]();});}};}function handleEntityNotFound(_0x2ddb8d,_0x3b774d){return function(_0x4cd2bf){if(!_0x4cd2bf){_0x2ddb8d[_0x8405('0x36')](0x194);}return _0x4cd2bf;};}function handleError(_0x4c174c,_0x47fbb0){_0x47fbb0=_0x47fbb0||0x1f4;return function(_0x39f2a8){logger[_0x8405('0x26')](_0x39f2a8['stack']);if(_0x39f2a8[_0x8405('0x37')]){delete _0x39f2a8[_0x8405('0x37')];}_0x4c174c[_0x8405('0x2c')](_0x47fbb0)[_0x8405('0x38')](_0x39f2a8);};}exports[_0x8405('0x39')]=function(_0x565324,_0x40b6e0){var _0x968b59={},_0x177600={},_0x2d1e0a={'count':0x0,'rows':[]};var _0x451faa=_['map'](db[_0x8405('0x3a')][_0x8405('0x3b')],function(_0xac5f4b){return{'name':_0xac5f4b[_0x8405('0x3c')],'type':_0xac5f4b[_0x8405('0x3d')][_0x8405('0x3e')]};});_0x177600['model']=_[_0x8405('0x3f')](_0x451faa,_0x8405('0x37'));_0x177600[_0x8405('0x40')]=_[_0x8405('0x41')](_0x565324[_0x8405('0x40')]);_0x177600[_0x8405('0x42')]=_[_0x8405('0x43')](_0x177600['model'],_0x177600[_0x8405('0x40')]);_0x968b59['attributes']=_[_0x8405('0x43')](_0x177600[_0x8405('0x44')],qs['fields'](_0x565324[_0x8405('0x40')][_0x8405('0x45')]));_0x968b59[_0x8405('0x46')]=_0x968b59[_0x8405('0x46')][_0x8405('0x47')]?_0x968b59[_0x8405('0x46')]:_0x177600[_0x8405('0x44')];if(!_0x565324[_0x8405('0x40')][_0x8405('0x48')](_0x8405('0x49'))){_0x968b59['limit']=qs['limit'](_0x565324[_0x8405('0x40')]['limit']);_0x968b59[_0x8405('0x2e')]=qs[_0x8405('0x2e')](_0x565324[_0x8405('0x40')]['offset']);}_0x968b59[_0x8405('0x4a')]=qs[_0x8405('0x4b')](_0x565324['query'][_0x8405('0x4b')]);_0x968b59[_0x8405('0x4c')]=qs[_0x8405('0x42')](_[_0x8405('0x4d')](_0x565324[_0x8405('0x40')],_0x177600[_0x8405('0x42')]),_0x451faa);if(_0x565324[_0x8405('0x40')]['filter']){_0x968b59['where']=_['merge'](_0x968b59[_0x8405('0x4c')],{'$or':_[_0x8405('0x3f')](_0x451faa,function(_0x1c0350){if(_0x1c0350[_0x8405('0x3d')]!=='VIRTUAL'){var _0x51ffcc={};_0x51ffcc[_0x1c0350[_0x8405('0x37')]]={'$like':'%'+_0x565324[_0x8405('0x40')][_0x8405('0x4e')]+'%'};return _0x51ffcc;}})});}_0x968b59=_[_0x8405('0x4f')]({},_0x968b59,_0x565324[_0x8405('0x50')]);var _0x3c516f={'where':_0x968b59[_0x8405('0x4c')]};return db[_0x8405('0x3a')]['count'](_0x3c516f)[_0x8405('0x1f')](function(_0x4e9c9e){_0x2d1e0a[_0x8405('0x51')]=_0x4e9c9e;if(_0x565324[_0x8405('0x40')][_0x8405('0x52')]){_0x968b59[_0x8405('0x53')]=[{'all':!![]}];}return db[_0x8405('0x3a')][_0x8405('0x54')](_0x968b59);})[_0x8405('0x1f')](function(_0x32fb03){_0x2d1e0a['rows']=_0x32fb03;return _0x2d1e0a;})[_0x8405('0x1f')](respondWithFilteredResult(_0x40b6e0,_0x968b59))[_0x8405('0x2a')](handleError(_0x40b6e0,null));};exports[_0x8405('0x55')]=function(_0x3e4473,_0x5d733d){var _0x53b60b={'raw':!![],'where':{'id':_0x3e4473[_0x8405('0x56')]['id']}},_0x3ca145={};_0x3ca145[_0x8405('0x44')]=_[_0x8405('0x41')](db[_0x8405('0x3a')][_0x8405('0x3b')]);_0x3ca145[_0x8405('0x40')]=_['keys'](_0x3e4473['query']);_0x3ca145[_0x8405('0x42')]=_['intersection'](_0x3ca145[_0x8405('0x44')],_0x3ca145[_0x8405('0x40')]);_0x53b60b[_0x8405('0x46')]=_['intersection'](_0x3ca145['model'],qs[_0x8405('0x45')](_0x3e4473['query'][_0x8405('0x45')]));_0x53b60b[_0x8405('0x46')]=_0x53b60b[_0x8405('0x46')][_0x8405('0x47')]?_0x53b60b[_0x8405('0x46')]:_0x3ca145[_0x8405('0x44')];if(_0x3e4473[_0x8405('0x40')][_0x8405('0x52')]){_0x53b60b[_0x8405('0x53')]=[{'all':!![]}];}_0x53b60b=_['merge']({},_0x53b60b,_0x3e4473[_0x8405('0x50')]);return db[_0x8405('0x3a')][_0x8405('0x57')](_0x53b60b)[_0x8405('0x1f')](handleEntityNotFound(_0x5d733d,null))['then'](respondWithResult(_0x5d733d,null))[_0x8405('0x2a')](handleError(_0x5d733d,null));};exports[_0x8405('0x58')]=function(_0x47760c,_0x22d378){return db[_0x8405('0x3a')][_0x8405('0x58')](_0x47760c['body'],{})[_0x8405('0x1f')](respondWithResult(_0x22d378,0xc9))[_0x8405('0x2a')](handleError(_0x22d378,null));};exports[_0x8405('0x34')]=function(_0x550f08,_0x43a0f4){if(_0x550f08[_0x8405('0x59')]['id']){delete _0x550f08[_0x8405('0x59')]['id'];}return db[_0x8405('0x3a')][_0x8405('0x57')]({'where':{'id':_0x550f08[_0x8405('0x56')]['id']}})[_0x8405('0x1f')](handleEntityNotFound(_0x43a0f4,null))[_0x8405('0x1f')](saveUpdates(_0x550f08[_0x8405('0x59')],null))[_0x8405('0x1f')](respondWithResult(_0x43a0f4,null))['catch'](handleError(_0x43a0f4,null));};exports[_0x8405('0x35')]=function(_0x5a2a1a,_0x28ba4f){return db['SmsMessage'][_0x8405('0x57')]({'where':{'id':_0x5a2a1a[_0x8405('0x56')]['id']}})[_0x8405('0x1f')](handleEntityNotFound(_0x28ba4f,null))[_0x8405('0x1f')](removeEntity(_0x28ba4f,null))[_0x8405('0x2a')](handleError(_0x28ba4f,null));};exports['describe']=function(_0x350e04,_0x48f7a7){return db['SmsMessage'][_0x8405('0x5a')]()['then'](respondWithResult(_0x48f7a7,null))[_0x8405('0x2a')](handleError(_0x48f7a7,null));};var interaction_log=require(_0x8405('0x13'))(_0x8405('0x5b'));exports['accept']=function(_0x37793c,_0x2dd310,_0x2b4013){var _0x1f5c6e={'channel':_0x8405('0x5c')};if(_0x37793c[_0x8405('0x59')]['id']){delete _0x37793c['body']['id'];}_0x37793c[_0x8405('0x59')][_0x8405('0x5d')]=!![];_0x37793c[_0x8405('0x59')]['readAt']=moment()['format'](_0x8405('0x5e'));_0x37793c[_0x8405('0x59')][_0x8405('0x5f')]=_0x37793c[_0x8405('0x59')][_0x8405('0x5f')]||_0x37793c['user']['id'];return db['SmsMessage']['find']({'where':{'id':_0x37793c[_0x8405('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x8405('0x60')],'as':_0x8405('0x61')}]})[_0x8405('0x1f')](handleEntityNotFound(_0x2dd310,null))[_0x8405('0x1f')](saveUpdates(_0x37793c[_0x8405('0x59')],null))[_0x8405('0x1f')](function(_0x22ce58){if(_0x22ce58){_0x1f5c6e[_0x8405('0x28')]=_0x22ce58[_0x8405('0x62')]({'plain':!![]});return db[_0x8405('0x63')][_0x8405('0x57')]({'where':{'id':_0x22ce58['SmsInteractionId']}});}return null;})[_0x8405('0x1f')](handleEntityNotFound(_0x2dd310,null))[_0x8405('0x1f')](function(_0x50c8e2){if(_0x50c8e2){return _0x50c8e2[_0x8405('0x34')]({'UserId':_0x37793c[_0x8405('0x59')][_0x8405('0x5f')],'read1stAt':_[_0x8405('0x64')](_0x50c8e2[_0x8405('0x65')])?moment()[_0x8405('0x66')](_0x8405('0x5e')):undefined});}return null;})[_0x8405('0x1f')](function(_0xe0f908){if(_0xe0f908){_0x1f5c6e['interaction']=_0xe0f908[_0x8405('0x62')]({'plain':!![]});interaction_log[_0x8405('0x20')](_0x8405('0x67'),_0x37793c['user']['id'],_0x37793c[_0x8405('0x68')][_0x8405('0x37')],_0x37793c[_0x8405('0x68')][_0x8405('0x69')],_0x1f5c6e[_0x8405('0x6a')]['id'],_0x37793c['body']?JSON[_0x8405('0x25')](_0x37793c[_0x8405('0x59')]):_0x8405('0x6b'));return respondWithRpcPromise(_0x8405('0x6c'),_0x8405('0x6d'),_0x1f5c6e);}return null;})[_0x8405('0x1f')](function(_0x8875e3){if(_0x8875e3){if(_0x37793c[_0x8405('0x59')][_0x8405('0x6e')]){_0x1f5c6e['message'][_0x8405('0x6f')]=util['format'](_0x8405('0x70'),_0x37793c[_0x8405('0x68')]['name']);_0x1f5c6e['message']['channel']=_0x1f5c6e['channel'];_0x1f5c6e[_0x8405('0x28')]['event']=_0x8405('0x71');return respondWithRpcPromise(_0x8405('0x72'),_0x8405('0x72'),{'event':_0x8405('0x73'),'message':_0x1f5c6e[_0x8405('0x28')]},client9002)[_0x8405('0x1f')](function(){return _0x1f5c6e;});}return _0x1f5c6e;}return null;})[_0x8405('0x1f')](respondWithResult(_0x2dd310,null))['catch'](handleError(_0x2dd310,null));};var interaction_log=require(_0x8405('0x13'))(_0x8405('0x5b'));exports['reject']=function(_0x55f959,_0x48b045,_0x4eea07){var _0x4d6e0c={'agent':{},'channel':'sms'};if(_0x55f959[_0x8405('0x59')]['id']){delete _0x55f959[_0x8405('0x59')]['id'];}_0x55f959[_0x8405('0x59')][_0x8405('0x5f')]=_0x55f959[_0x8405('0x59')]['UserId']||_0x55f959[_0x8405('0x68')]['id'];_0x4d6e0c[_0x8405('0x74')]['id']=_0x55f959[_0x8405('0x59')][_0x8405('0x5f')];return db[_0x8405('0x3a')]['find']({'where':{'id':_0x55f959[_0x8405('0x56')]['id'],'UserId':null}})[_0x8405('0x1f')](handleEntityNotFound(_0x48b045,null))[_0x8405('0x1f')](function(_0x32766f){if(_0x32766f){_0x4d6e0c[_0x8405('0x28')]=_0x32766f[_0x8405('0x62')]({'plain':!![]});return db[_0x8405('0x63')][_0x8405('0x57')]({'where':{'id':_0x32766f['SmsInteractionId']}});}return null;})[_0x8405('0x1f')](handleEntityNotFound(_0x48b045,null))[_0x8405('0x1f')](function(_0x2d3847){if(_0x2d3847){_0x4d6e0c[_0x8405('0x6a')]=_0x2d3847[_0x8405('0x62')]({'plain':!![]});interaction_log[_0x8405('0x20')](_0x8405('0x75'),_0x55f959[_0x8405('0x68')]['id'],_0x55f959[_0x8405('0x68')][_0x8405('0x37')],_0x55f959[_0x8405('0x68')][_0x8405('0x69')],_0x4d6e0c[_0x8405('0x6a')]['id'],_0x55f959[_0x8405('0x59')]?JSON[_0x8405('0x25')](_0x55f959[_0x8405('0x59')]):'null');return respondWithRpcPromise(_0x8405('0x76'),_0x8405('0x77'),_0x4d6e0c);}return null;})[_0x8405('0x1f')](function(_0x5b2b2b){if(_0x5b2b2b){_0x5b2b2b[_0x8405('0x28')][_0x8405('0x6f')]=util[_0x8405('0x66')](_0x8405('0x70'),_0x55f959[_0x8405('0x68')][_0x8405('0x37')]);_0x5b2b2b[_0x8405('0x28')][_0x8405('0x78')]=_0x4d6e0c[_0x8405('0x78')];_0x5b2b2b[_0x8405('0x28')]['event']='reject';respondWithRpcPromise(_0x8405('0x72'),_0x8405('0x72'),{'event':'rejectmessage','message':_0x5b2b2b[_0x8405('0x28')]},client9002);return _0x4d6e0c;}return null;})[_0x8405('0x1f')](respondWithResult(_0x48b045,null))[_0x8405('0x2a')](handleError(_0x48b045,null));};exports['status']=function(_0x537624,_0x4d185e,_0x4ed271){if(_0x537624[_0x8405('0x59')]['id']){delete _0x537624[_0x8405('0x59')]['id'];}var _0x37a642;return db['SmsMessage'][_0x8405('0x57')]({'where':{'id':_0x537624[_0x8405('0x56')]['id']}})[_0x8405('0x1f')](handleEntityNotFound(_0x4d185e,null))[_0x8405('0x1f')](function(_0x496893){if(_0x496893){_0x37a642=_0x496893;return db['SmsAccount'][_0x8405('0x57')]({'where':{'id':_0x496893[_0x8405('0x79')]}});}})['then'](handleEntityNotFound(_0x4d185e,null))[_0x8405('0x1f')](function(_0x1bbb21){if(_0x1bbb21){logger[_0x8405('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x2c'),_0x8405('0x7a'),_0x1bbb21[_0x8405('0x3d')],util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));switch(_0x1bbb21[_0x8405('0x3d')]){case _0x8405('0x7c'):if(_0x537624[_0x8405('0x59')][_0x8405('0x7d')]&&_0x537624[_0x8405('0x59')]['MessageSid']===_0x37a642[_0x8405('0x7e')]){return _0x37a642[_0x8405('0x34')]({'read':!![]});}else{logger[_0x8405('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8405('0x7f'):if(_0x537624[_0x8405('0x59')]['MessageUUID']&&_0x537624[_0x8405('0x59')][_0x8405('0x80')]===_0x37a642[_0x8405('0x7e')]&&_[_0x8405('0x81')]([_0x8405('0x82'),_0x8405('0x83')],_0x537624[_0x8405('0x59')][_0x8405('0x84')])>=0x0){return _0x37a642[_0x8405('0x34')]({'read':!![]});}else{logger[_0x8405('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8405('0x85'),util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8405('0x86'):var _0x689ca1=_0x537624[_0x8405('0x59')][_0x8405('0x87')][0x0];if(_0x689ca1[_0x8405('0x2c')][_0x8405('0x88')]==='DELIVERED'){return _0x37a642[_0x8405('0x34')]({'read':!![]});}else{logger[_0x8405('0x26')](_0x8405('0x89'),'status',_0x8405('0x86'),util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x37a642;}})['then'](respondWithResult(_0x4d185e,null))['catch'](handleError(_0x4d185e,null));}; \ No newline at end of file +var _0x2a41=['MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','count','offset','status','Content-Range','apply','save','destroy','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SmsMessage','include','rows','catch','params','rawAttributes','includeAll','create','body','update','find','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','SmsInteraction','SmsInteractionId','isNil','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2a41,0x126));var _0x12a4=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x2a41[_0x28509b];return _0x1e0b6;};'use strict';var pdf=require(_0x12a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x12a4('0x1'));var zipdir=require(_0x12a4('0x2'));var jsonpatch=require(_0x12a4('0x3'));var rp=require(_0x12a4('0x4'));var moment=require(_0x12a4('0x5'));var BPromise=require(_0x12a4('0x6'));var Mustache=require(_0x12a4('0x7'));var util=require(_0x12a4('0x8'));var path=require(_0x12a4('0x9'));var sox=require('sox');var csv=require(_0x12a4('0xa'));var ejs=require(_0x12a4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x12a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x12a4('0xd'));var toCsv=require(_0x12a4('0xa'));var querystring=require(_0x12a4('0xe'));var Papa=require(_0x12a4('0xf'));var Redis=require(_0x12a4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x12a4('0x11'));var as=require(_0x12a4('0x12'));var hardwareService=require(_0x12a4('0x13'));var logger=require(_0x12a4('0x14'))(_0x12a4('0x15'));var utils=require(_0x12a4('0x16'));var config=require(_0x12a4('0x17'));var db=require(_0x12a4('0x18'))['db'];config[_0x12a4('0x19')]=_[_0x12a4('0x1a')](config[_0x12a4('0x19')],{'host':_0x12a4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12a4('0x19')]));require(_0x12a4('0x1c'))[_0x12a4('0x1d')](socket);var jayson=require(_0x12a4('0x1e'));var client=jayson[_0x12a4('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x12a4('0x20')]({'port':0x232a});function checkPasswordPattern(_0x2ccfce,_0x2428ba,_0x1cce66){if(_0x1cce66){var _0x5f5d38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f5d38[_0x12a4('0x21')](_0x2428ba)){return _0x2ccfce;}else{throw new db[(_0x12a4('0x22'))][(_0x12a4('0x23'))](_0x12a4('0x24'));}}else{return _0x2ccfce;}}function respondWithRpcPromise(_0x3023b6,_0xe274e1,_0x4d7c49,_0x1a6bbe){return new BPromise(function(_0x3a783c,_0x3a3328){var _0x5db6a2=_0x1a6bbe||client;return _0x5db6a2['request'](_0x3023b6,_0x4d7c49)[_0x12a4('0x25')](function(_0x68998e){logger[_0x12a4('0x26')](_0x12a4('0x27'),_0xe274e1,_0x12a4('0x28'));logger['debug'](_0x12a4('0x29'),_0xe274e1,'request\x20sent',JSON[_0x12a4('0x2a')](_0x68998e));if(_0x68998e[_0x12a4('0x2b')]){if(_0x68998e[_0x12a4('0x2b')][_0x12a4('0x2c')]===0x1f4){logger[_0x12a4('0x2b')]('SmsMessage,\x20%s,\x20%s',_0xe274e1,_0x68998e[_0x12a4('0x2b')][_0x12a4('0x2d')]);return _0x3a3328(_0x68998e[_0x12a4('0x2b')][_0x12a4('0x2d')]);}logger['error'](_0x12a4('0x27'),_0xe274e1,_0x68998e[_0x12a4('0x2b')][_0x12a4('0x2d')]);return _0x3a783c(_0x68998e['error'][_0x12a4('0x2d')]);}else{logger[_0x12a4('0x26')]('SmsMessage,\x20%s,\x20%s',_0xe274e1,_0x12a4('0x28'));_0x3a783c(_0x68998e[_0x12a4('0x2e')]['message']);}})['catch'](function(_0x5e4616){logger[_0x12a4('0x2b')](_0x12a4('0x27'),_0xe274e1,_0x5e4616);_0x3a3328(_0x5e4616);});});}function respondWithStatusCode(_0x3314da,_0x1c34df){_0x1c34df=_0x1c34df||0xcc;return function(_0x4843f8){if(_0x4843f8){return _0x3314da[_0x12a4('0x2f')](_0x1c34df);}return _0x3314da['status'](_0x1c34df)[_0x12a4('0x30')]();};}function respondWithResult(_0x3c5584,_0x377466){_0x377466=_0x377466||0xc8;return function(_0x15adb7){if(_0x15adb7){return _0x3c5584['status'](_0x377466)[_0x12a4('0x31')](_0x15adb7);}};}function respondWithFilteredResult(_0x35f941,_0x4e38f7){return function(_0x283668){if(_0x283668){var _0x4cff97=_0x283668[_0x12a4('0x32')],_0x36edf3=_0x4e38f7[_0x12a4('0x33')],_0x2de4d5=_0x4e38f7[_0x12a4('0x33')]+_0x4e38f7['limit'],_0x534ab5;if(_0x2de4d5>=_0x4cff97){_0x2de4d5=_0x4cff97;_0x534ab5=0xc8;}else{_0x534ab5=0xce;}_0x35f941[_0x12a4('0x34')](_0x534ab5);return _0x35f941['set'](_0x12a4('0x35'),_0x36edf3+'-'+_0x2de4d5+'/'+_0x4cff97)[_0x12a4('0x31')](_0x283668);}return null;};}function patchUpdates(_0x3b4d75){return function(_0x37994a){try{jsonpatch[_0x12a4('0x36')](_0x37994a,_0x3b4d75,!![]);}catch(_0x38f86d){return BPromise['reject'](_0x38f86d);}return _0x37994a[_0x12a4('0x37')]();};}function saveUpdates(_0x473ce8,_0x3080e3){return function(_0x5ebeb1){if(_0x5ebeb1){return _0x5ebeb1['update'](_0x473ce8)[_0x12a4('0x25')](function(_0x499c20){return _0x499c20;});}return null;};}function removeEntity(_0x41696b,_0x3b8f1a){return function(_0x54bd3e){if(_0x54bd3e){return _0x54bd3e[_0x12a4('0x38')]()[_0x12a4('0x25')](function(){_0x41696b[_0x12a4('0x34')](0xcc)[_0x12a4('0x30')]();});}};}function handleEntityNotFound(_0x57850b,_0x728b01){return function(_0xf4b016){if(!_0xf4b016){_0x57850b[_0x12a4('0x2f')](0x194);}return _0xf4b016;};}function handleError(_0xa1a00e,_0x3c6476){_0x3c6476=_0x3c6476||0x1f4;return function(_0x4e7598){logger['error'](_0x4e7598[_0x12a4('0x39')]);if(_0x4e7598['name']){delete _0x4e7598[_0x12a4('0x3a')];}_0xa1a00e[_0x12a4('0x34')](_0x3c6476)[_0x12a4('0x3b')](_0x4e7598);};}exports[_0x12a4('0x3c')]=function(_0x2323cc,_0xc9d539){var _0x4427d1={},_0x18923c={},_0x445af7={'count':0x0,'rows':[]};var _0x31e9bb=_['map'](db['SmsMessage']['rawAttributes'],function(_0x174241){return{'name':_0x174241[_0x12a4('0x3d')],'type':_0x174241['type'][_0x12a4('0x3e')]};});_0x18923c[_0x12a4('0x3f')]=_[_0x12a4('0x40')](_0x31e9bb,_0x12a4('0x3a'));_0x18923c[_0x12a4('0x41')]=_[_0x12a4('0x42')](_0x2323cc[_0x12a4('0x41')]);_0x18923c[_0x12a4('0x43')]=_[_0x12a4('0x44')](_0x18923c['model'],_0x18923c[_0x12a4('0x41')]);_0x4427d1['attributes']=_[_0x12a4('0x44')](_0x18923c[_0x12a4('0x3f')],qs[_0x12a4('0x45')](_0x2323cc[_0x12a4('0x41')][_0x12a4('0x45')]));_0x4427d1['attributes']=_0x4427d1[_0x12a4('0x46')][_0x12a4('0x47')]?_0x4427d1[_0x12a4('0x46')]:_0x18923c[_0x12a4('0x3f')];if(!_0x2323cc[_0x12a4('0x41')][_0x12a4('0x48')](_0x12a4('0x49'))){_0x4427d1['limit']=qs[_0x12a4('0x4a')](_0x2323cc[_0x12a4('0x41')][_0x12a4('0x4a')]);_0x4427d1[_0x12a4('0x33')]=qs[_0x12a4('0x33')](_0x2323cc[_0x12a4('0x41')][_0x12a4('0x33')]);}_0x4427d1[_0x12a4('0x4b')]=qs[_0x12a4('0x4c')](_0x2323cc[_0x12a4('0x41')][_0x12a4('0x4c')]);_0x4427d1['where']=qs[_0x12a4('0x43')](_[_0x12a4('0x4d')](_0x2323cc[_0x12a4('0x41')],_0x18923c['filters']),_0x31e9bb);if(_0x2323cc['query'][_0x12a4('0x4e')]){_0x4427d1[_0x12a4('0x4f')]=_[_0x12a4('0x50')](_0x4427d1['where'],{'$or':_[_0x12a4('0x40')](_0x31e9bb,function(_0x2f4e47){if(_0x2f4e47[_0x12a4('0x51')]!==_0x12a4('0x52')){var _0x520cff={};_0x520cff[_0x2f4e47['name']]={'$like':'%'+_0x2323cc['query']['filter']+'%'};return _0x520cff;}})});}_0x4427d1=_[_0x12a4('0x50')]({},_0x4427d1,_0x2323cc[_0x12a4('0x53')]);var _0x213f0f={'where':_0x4427d1[_0x12a4('0x4f')]};return db[_0x12a4('0x54')]['count'](_0x213f0f)[_0x12a4('0x25')](function(_0x2342d6){_0x445af7[_0x12a4('0x32')]=_0x2342d6;if(_0x2323cc['query']['includeAll']){_0x4427d1[_0x12a4('0x55')]=[{'all':!![]}];}return db[_0x12a4('0x54')]['findAll'](_0x4427d1);})['then'](function(_0x586915){_0x445af7[_0x12a4('0x56')]=_0x586915;return _0x445af7;})[_0x12a4('0x25')](respondWithFilteredResult(_0xc9d539,_0x4427d1))[_0x12a4('0x57')](handleError(_0xc9d539,null));};exports['show']=function(_0x403d90,_0x270fbb){var _0x5b428b={'raw':!![],'where':{'id':_0x403d90[_0x12a4('0x58')]['id']}},_0x18e925={};_0x18e925[_0x12a4('0x3f')]=_[_0x12a4('0x42')](db[_0x12a4('0x54')][_0x12a4('0x59')]);_0x18e925['query']=_[_0x12a4('0x42')](_0x403d90['query']);_0x18e925[_0x12a4('0x43')]=_[_0x12a4('0x44')](_0x18e925[_0x12a4('0x3f')],_0x18e925[_0x12a4('0x41')]);_0x5b428b[_0x12a4('0x46')]=_[_0x12a4('0x44')](_0x18e925[_0x12a4('0x3f')],qs['fields'](_0x403d90[_0x12a4('0x41')][_0x12a4('0x45')]));_0x5b428b[_0x12a4('0x46')]=_0x5b428b[_0x12a4('0x46')][_0x12a4('0x47')]?_0x5b428b[_0x12a4('0x46')]:_0x18e925[_0x12a4('0x3f')];if(_0x403d90[_0x12a4('0x41')][_0x12a4('0x5a')]){_0x5b428b[_0x12a4('0x55')]=[{'all':!![]}];}_0x5b428b=_[_0x12a4('0x50')]({},_0x5b428b,_0x403d90[_0x12a4('0x53')]);return db[_0x12a4('0x54')]['find'](_0x5b428b)[_0x12a4('0x25')](handleEntityNotFound(_0x270fbb,null))[_0x12a4('0x25')](respondWithResult(_0x270fbb,null))[_0x12a4('0x57')](handleError(_0x270fbb,null));};exports[_0x12a4('0x5b')]=function(_0x5c5bcc,_0x2c95a8){return db['SmsMessage'][_0x12a4('0x5b')](_0x5c5bcc[_0x12a4('0x5c')],{})[_0x12a4('0x25')](respondWithResult(_0x2c95a8,0xc9))[_0x12a4('0x57')](handleError(_0x2c95a8,null));};exports[_0x12a4('0x5d')]=function(_0x21bc35,_0x43cb38){if(_0x21bc35[_0x12a4('0x5c')]['id']){delete _0x21bc35['body']['id'];}return db[_0x12a4('0x54')]['find']({'where':{'id':_0x21bc35[_0x12a4('0x58')]['id']}})[_0x12a4('0x25')](handleEntityNotFound(_0x43cb38,null))[_0x12a4('0x25')](saveUpdates(_0x21bc35[_0x12a4('0x5c')],null))[_0x12a4('0x25')](respondWithResult(_0x43cb38,null))[_0x12a4('0x57')](handleError(_0x43cb38,null));};exports[_0x12a4('0x38')]=function(_0x48bbc7,_0xcc63bd){return db[_0x12a4('0x54')][_0x12a4('0x5e')]({'where':{'id':_0x48bbc7[_0x12a4('0x58')]['id']}})[_0x12a4('0x25')](handleEntityNotFound(_0xcc63bd,null))[_0x12a4('0x25')](removeEntity(_0xcc63bd,null))['catch'](handleError(_0xcc63bd,null));};exports[_0x12a4('0x5f')]=function(_0x48fd04,_0x5f038a){return db[_0x12a4('0x54')][_0x12a4('0x5f')]()[_0x12a4('0x25')](respondWithResult(_0x5f038a,null))[_0x12a4('0x57')](handleError(_0x5f038a,null));};var interaction_log=require('../../config/logger')(_0x12a4('0x60'));exports[_0x12a4('0x61')]=function(_0x5e4ce0,_0x108c1a,_0x17f1fd){var _0x4bbe35={'channel':'sms'};if(_0x5e4ce0[_0x12a4('0x5c')]['id']){delete _0x5e4ce0['body']['id'];}_0x5e4ce0[_0x12a4('0x5c')][_0x12a4('0x62')]=!![];_0x5e4ce0['body'][_0x12a4('0x63')]=moment()['format'](_0x12a4('0x64'));_0x5e4ce0['body'][_0x12a4('0x65')]=_0x5e4ce0[_0x12a4('0x5c')][_0x12a4('0x65')]||_0x5e4ce0['user']['id'];return db[_0x12a4('0x54')]['find']({'where':{'id':_0x5e4ce0[_0x12a4('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x12a4('0x66')}]})['then'](handleEntityNotFound(_0x108c1a,null))[_0x12a4('0x25')](saveUpdates(_0x5e4ce0['body'],null))[_0x12a4('0x25')](function(_0x43e2c0){if(_0x43e2c0){_0x4bbe35[_0x12a4('0x2d')]=_0x43e2c0[_0x12a4('0x67')]({'plain':!![]});return db[_0x12a4('0x68')]['find']({'where':{'id':_0x43e2c0[_0x12a4('0x69')]}});}return null;})[_0x12a4('0x25')](handleEntityNotFound(_0x108c1a,null))[_0x12a4('0x25')](function(_0x94b874){if(_0x94b874){return _0x94b874[_0x12a4('0x5d')]({'UserId':_0x5e4ce0['body'][_0x12a4('0x65')],'read1stAt':_[_0x12a4('0x6a')](_0x94b874['read1stAt'])?moment()[_0x12a4('0x6b')](_0x12a4('0x64')):undefined});}return null;})[_0x12a4('0x25')](function(_0x4072ab){if(_0x4072ab){_0x4bbe35[_0x12a4('0x6c')]=_0x4072ab[_0x12a4('0x67')]({'plain':!![]});interaction_log['info'](_0x12a4('0x6d'),_0x5e4ce0[_0x12a4('0x6e')]['id'],_0x5e4ce0[_0x12a4('0x6e')][_0x12a4('0x3a')],_0x5e4ce0[_0x12a4('0x6e')]['role'],_0x4bbe35[_0x12a4('0x6c')]['id'],_0x5e4ce0['body']?JSON[_0x12a4('0x2a')](_0x5e4ce0[_0x12a4('0x5c')]):_0x12a4('0x6f'));return respondWithRpcPromise(_0x12a4('0x70'),'acceptMessage',_0x4bbe35);}return null;})[_0x12a4('0x25')](function(_0x64fb8d){if(_0x64fb8d){if(_0x5e4ce0[_0x12a4('0x5c')][_0x12a4('0x71')]){_0x4bbe35[_0x12a4('0x2d')][_0x12a4('0x72')]=util[_0x12a4('0x6b')]('SIP/%s',_0x5e4ce0[_0x12a4('0x6e')][_0x12a4('0x3a')]);_0x4bbe35[_0x12a4('0x2d')][_0x12a4('0x73')]=_0x4bbe35[_0x12a4('0x73')];_0x4bbe35[_0x12a4('0x2d')][_0x12a4('0x74')]=_0x12a4('0x61');return respondWithRpcPromise(_0x12a4('0x75'),_0x12a4('0x75'),{'event':_0x12a4('0x76'),'message':_0x4bbe35[_0x12a4('0x2d')]},client9002)[_0x12a4('0x25')](function(){return _0x4bbe35;});}return _0x4bbe35;}return null;})[_0x12a4('0x25')](respondWithResult(_0x108c1a,null))['catch'](handleError(_0x108c1a,null));};var interaction_log=require(_0x12a4('0x14'))(_0x12a4('0x60'));exports[_0x12a4('0x77')]=function(_0x28c3ad,_0x47dd26,_0x49894a){var _0x5ce731={'agent':{},'channel':'sms'};if(_0x28c3ad[_0x12a4('0x5c')]['id']){delete _0x28c3ad['body']['id'];}_0x28c3ad[_0x12a4('0x5c')][_0x12a4('0x65')]=_0x28c3ad['body']['UserId']||_0x28c3ad[_0x12a4('0x6e')]['id'];_0x5ce731[_0x12a4('0x78')]['id']=_0x28c3ad['body'][_0x12a4('0x65')];return db['SmsMessage'][_0x12a4('0x5e')]({'where':{'id':_0x28c3ad[_0x12a4('0x58')]['id'],'UserId':null}})[_0x12a4('0x25')](handleEntityNotFound(_0x47dd26,null))[_0x12a4('0x25')](function(_0x494c59){if(_0x494c59){_0x5ce731['message']=_0x494c59[_0x12a4('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x12a4('0x5e')]({'where':{'id':_0x494c59[_0x12a4('0x69')]}});}return null;})[_0x12a4('0x25')](handleEntityNotFound(_0x47dd26,null))[_0x12a4('0x25')](function(_0x1dd515){if(_0x1dd515){_0x5ce731[_0x12a4('0x6c')]=_0x1dd515[_0x12a4('0x67')]({'plain':!![]});interaction_log[_0x12a4('0x26')](_0x12a4('0x79'),_0x28c3ad[_0x12a4('0x6e')]['id'],_0x28c3ad[_0x12a4('0x6e')][_0x12a4('0x3a')],_0x28c3ad[_0x12a4('0x6e')][_0x12a4('0x7a')],_0x5ce731['interaction']['id'],_0x28c3ad[_0x12a4('0x5c')]?JSON[_0x12a4('0x2a')](_0x28c3ad[_0x12a4('0x5c')]):_0x12a4('0x6f'));return respondWithRpcPromise(_0x12a4('0x7b'),_0x12a4('0x7c'),_0x5ce731);}return null;})[_0x12a4('0x25')](function(_0x295032){if(_0x295032){_0x295032[_0x12a4('0x2d')][_0x12a4('0x72')]=util[_0x12a4('0x6b')]('SIP/%s',_0x28c3ad[_0x12a4('0x6e')][_0x12a4('0x3a')]);_0x295032[_0x12a4('0x2d')][_0x12a4('0x73')]=_0x5ce731[_0x12a4('0x73')];_0x295032[_0x12a4('0x2d')]['event']=_0x12a4('0x77');respondWithRpcPromise(_0x12a4('0x75'),_0x12a4('0x75'),{'event':'rejectmessage','message':_0x295032['message']},client9002);return _0x5ce731;}return null;})['then'](respondWithResult(_0x47dd26,null))['catch'](handleError(_0x47dd26,null));};exports['status']=function(_0x4bb953,_0x310623,_0xa2e1fc){if(_0x4bb953[_0x12a4('0x5c')]['id']){delete _0x4bb953[_0x12a4('0x5c')]['id'];}var _0x3e3afe;return db[_0x12a4('0x54')][_0x12a4('0x5e')]({'where':{'id':_0x4bb953[_0x12a4('0x58')]['id']}})[_0x12a4('0x25')](handleEntityNotFound(_0x310623,null))[_0x12a4('0x25')](function(_0x1afd81){if(_0x1afd81){_0x3e3afe=_0x1afd81;return db[_0x12a4('0x7d')][_0x12a4('0x5e')]({'where':{'id':_0x1afd81[_0x12a4('0x7e')]}});}})[_0x12a4('0x25')](handleEntityNotFound(_0x310623,null))[_0x12a4('0x25')](function(_0x3ecceb){if(_0x3ecceb){logger[_0x12a4('0x7f')](_0x12a4('0x29'),'status',_0x12a4('0x80'),_0x3ecceb[_0x12a4('0x51')],util[_0x12a4('0x81')](_0x4bb953[_0x12a4('0x5c')],{'showHidden':![],'depth':null}));switch(_0x3ecceb[_0x12a4('0x51')]){case _0x12a4('0x82'):if(_0x4bb953[_0x12a4('0x5c')][_0x12a4('0x83')]&&_0x4bb953[_0x12a4('0x5c')][_0x12a4('0x83')]===_0x3e3afe[_0x12a4('0x84')]){return _0x3e3afe['update']({'read':!![]});}else{logger[_0x12a4('0x2b')](_0x12a4('0x85'),'status',_0x12a4('0x82'),util[_0x12a4('0x81')](_0x4bb953[_0x12a4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x12a4('0x86'):if(_0x4bb953[_0x12a4('0x5c')][_0x12a4('0x87')]&&_0x4bb953['body']['MessageUUID']===_0x3e3afe[_0x12a4('0x84')]&&_[_0x12a4('0x88')]([_0x12a4('0x89'),_0x12a4('0x8a')],_0x4bb953['body'][_0x12a4('0x8b')])>=0x0){return _0x3e3afe[_0x12a4('0x5d')]({'read':!![]});}else{logger['error'](_0x12a4('0x85'),'status',_0x12a4('0x8c'),util[_0x12a4('0x81')](_0x4bb953[_0x12a4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x12a4('0x8d'):var _0xbfa3ee=_0x4bb953[_0x12a4('0x5c')]['results'][0x0];if(_0xbfa3ee[_0x12a4('0x34')]['groupName']===_0x12a4('0x8e')){return _0x3e3afe[_0x12a4('0x5d')]({'read':!![]});}else{logger[_0x12a4('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x12a4('0x34'),'infobip',util['inspect'](_0x4bb953[_0x12a4('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x3e3afe;}})[_0x12a4('0x25')](respondWithResult(_0x310623,null))[_0x12a4('0x57')](handleError(_0x310623,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ae761eb..453ec76 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 _0xbcce=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x56f4a0,_0x45922a){var _0xbb731b=function(_0x1b39c5){while(--_0x1b39c5){_0x56f4a0['push'](_0x56f4a0['shift']());}};_0xbb731b(++_0x45922a);}(_0xbcce,0x1ee));var _0xebcc=function(_0x5965dc,_0x4dcb0a){_0x5965dc=_0x5965dc-0x0;var _0x5c82d1=_0xbcce[_0x5965dc];return _0x5c82d1;};'use strict';var EventEmitter=require(_0xebcc('0x0'));var SmsMessage=require(_0xebcc('0x1'))['db'][_0xebcc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xebcc('0x3')](0x0);var events={'afterCreate':_0xebcc('0x4'),'afterUpdate':_0xebcc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3a3f8a){return function(_0x4932c8,_0x47e328,_0x320e12){SmsMessageEvents[_0xebcc('0x6')](_0x3a3f8a+':'+_0x4932c8['id'],_0x4932c8);SmsMessageEvents[_0xebcc('0x6')](_0x3a3f8a,_0x4932c8);_0x320e12(null);};}for(var e in events){if(events[_0xebcc('0x7')](e)){var event=events[e];SmsMessage[_0xebcc('0x8')](e,emitEvent(event));}}module[_0xebcc('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x376e=['hasOwnProperty','exports','SmsMessage','setMaxListeners','save','remove','emit'];(function(_0xbf9376,_0x2787bf){var _0x4721ed=function(_0x582b1e){while(--_0x582b1e){_0xbf9376['push'](_0xbf9376['shift']());}};_0x4721ed(++_0x2787bf);}(_0x376e,0x160));var _0xe376=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x376e[_0x5ddaac];return _0x2a9c58;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xe376('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe376('0x1')](0x0);var events={'afterCreate':_0xe376('0x2'),'afterUpdate':'update','afterDestroy':_0xe376('0x3')};function emitEvent(_0x2b7ce6){return function(_0x31d3ef,_0x4887ac,_0x5672e9){SmsMessageEvents[_0xe376('0x4')](_0x2b7ce6+':'+_0x31d3ef['id'],_0x31d3ef);SmsMessageEvents[_0xe376('0x4')](_0x2b7ce6,_0x31d3ef);_0x5672e9(null);};}for(var e in events){if(events[_0xe376('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xe376('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1613569..9757df3 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 _0xc3c7=['sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','senderString','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','/external/get/send.php?','clickatell','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage'];(function(_0x4e3f19,_0x2998f3){var _0x1bb71b=function(_0x56b9bd){while(--_0x56b9bd){_0x4e3f19['push'](_0x4e3f19['shift']());}};_0x1bb71b(++_0x2998f3);}(_0xc3c7,0x1d5));var _0x7c3c=function(_0x3f88d7,_0x44425d){_0x3f88d7=_0x3f88d7-0x0;var _0x1833b3=_0xc3c7[_0x3f88d7];return _0x1833b3;};'use strict';var _=require(_0x7c3c('0x0'));var util=require(_0x7c3c('0x1'));var logger=require(_0x7c3c('0x2'))(_0x7c3c('0x3'));var moment=require('moment');var BPromise=require(_0x7c3c('0x4'));var rp=require(_0x7c3c('0x5'));var fs=require('fs');var path=require(_0x7c3c('0x6'));var rimraf=require(_0x7c3c('0x7'));var config=require(_0x7c3c('0x8'));var attributes=require('./smsMessage.attributes');module[_0x7c3c('0x9')]=function(_0x463c74,_0x485dac){return _0x463c74['define'](_0x7c3c('0xa'),attributes,{'tableName':_0x7c3c('0xb'),'paranoid':![],'indexes':[{'name':_0x7c3c('0xc'),'fields':['messageId']},{'name':_0x7c3c('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x399eef,_0x3b3940,_0x55045e){var _0x5900a9=_0x463c74[_0x7c3c('0xe')];var _0x2beafa=_0x399eef[_0x7c3c('0xf')]({'plain':!![]});if(_0x2beafa[_0x7c3c('0x10')]['toLowerCase']()==='in'||_0x2beafa[_0x7c3c('0x10')][_0x7c3c('0x11')]()===_0x7c3c('0x12')&&!_0x2beafa['secret']&&!_[_0x7c3c('0x13')](_0x2beafa[_0x7c3c('0x14')])){_0x5900a9[_0x7c3c('0x15')][_0x7c3c('0x16')]({'where':{'id':_0x2beafa['SmsInteractionId']}})[_0x7c3c('0x17')](function(_0x59121d){if(_0x59121d){_0x59121d[_0x7c3c('0x18')]({'lastMsgAt':_0x2beafa[_0x7c3c('0x19')],'lastMsgDirection':_0x2beafa[_0x7c3c('0x10')][_0x7c3c('0x11')]()});}})['catch'](function(_0x5a5ca9){console[_0x7c3c('0x1a')](_0x5a5ca9);});}if(_0x2beafa[_0x7c3c('0x10')]===_0x7c3c('0x12')&&!_0x2beafa[_0x7c3c('0x1b')]){var _0x8f4e04;_0x5900a9['SmsAccount'][_0x7c3c('0x1c')]({'where':{'id':_0x2beafa[_0x7c3c('0x1d')]},'raw':!![]})[_0x7c3c('0x17')](function(_0x39815a){_0x8f4e04=_0x39815a;if(_0x8f4e04&&_0x8f4e04[_0x7c3c('0x1e')]){switch(_0x8f4e04['type']){case _0x7c3c('0x1f'):var _0x1ba415=require(_0x7c3c('0x1f'));if(_0x8f4e04[_0x7c3c('0x20')]&&_0x8f4e04[_0x7c3c('0x21')]&&_0x8f4e04[_0x7c3c('0x22')]){var _0x4f0233=new _0x1ba415(_0x8f4e04[_0x7c3c('0x20')],_0x8f4e04['authToken']);_0x4f0233[_0x7c3c('0x23')]['create']({'body':_0x2beafa['body'],'to':_0x2beafa[_0x7c3c('0x22')],'from':_0x8f4e04[_0x7c3c('0x22')],'statusCallback':_0x8f4e04[_0x7c3c('0x24')]+_0x7c3c('0x25')+_0x2beafa['id']+_0x7c3c('0x26')+_0x8f4e04[_0x7c3c('0x27')]})[_0x7c3c('0x17')](function(_0x588172){if(_0x588172[_0x7c3c('0x28')]){return _0x399eef[_0x7c3c('0x18')]({'messageId':_0x588172[_0x7c3c('0x28')]});}})[_0x7c3c('0x29')](function(_0x8348ae){logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x1f'),util['inspect'](_0x8348ae,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'twilio',_0x7c3c('0x2c'));}break;case _0x7c3c('0x2d'):var _0x40f42e=_0x7c3c('0x2e');if(_0x8f4e04[_0x7c3c('0x2f')]&&_0x8f4e04[_0x7c3c('0x30')]){var _0x33769b={'recipient':[_0x2beafa[_0x7c3c('0x22')]],'message':_0x2beafa[_0x7c3c('0x31')],'message_type':_0x8f4e04['smsMethod']};if(_0x8f4e04[_0x7c3c('0x32')]&&_0x8f4e04[_0x7c3c('0x32')]!=='SI'){_0x33769b['sender']=_0x8f4e04[_0x7c3c('0x22')];}var _0x3f3bd7={'url':_0x40f42e+'login?username='+_0x8f4e04[_0x7c3c('0x2f')]+_0x7c3c('0x33')+_0x8f4e04[_0x7c3c('0x30')],'method':_0x7c3c('0x34')};rp(_0x3f3bd7)[_0x7c3c('0x17')](function(_0x5a338c){var _0x3ea8ad=_0x5a338c[_0x7c3c('0x35')](';');var _0x11754e={'user_key':_0x3ea8ad[0x0],'session_key':_0x3ea8ad[0x1]};_0x3f3bd7={'url':_0x40f42e+_0x7c3c('0x36'),'method':_0x7c3c('0x37'),'headers':{'user_key':_0x11754e[_0x7c3c('0x38')],'Session_key':_0x11754e[_0x7c3c('0x39')]},'json':!![],'body':_0x33769b};return rp(_0x3f3bd7);})[_0x7c3c('0x17')](function(_0xf47904){if(_0xf47904['total_sent']>=0x1){var _0x212e47={'messageId':_0xf47904[_0x7c3c('0x3a')]};if(_0x8f4e04[_0x7c3c('0x32')]!=='GP'||!_0x8f4e04[_0x7c3c('0x3b')]){_0x212e47[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x212e47);}else{return logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c3c('0x2b'),_0x7c3c('0x2d'),util[_0x7c3c('0x3d')](_0xf47904,{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x1fce3f){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x2d'),util[_0x7c3c('0x3d')](_0x1fce3f,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x2d'),_0x7c3c('0x3e'));}break;case'connectel':if(_0x8f4e04['authToken']){var _0xc5a44f={'recipient':_0x2beafa[_0x7c3c('0x22')],'message':_0x2beafa[_0x7c3c('0x31')],'sender':_0x8f4e04['senderString']||_0x8f4e04['phone'],'authorization':_0x8f4e04[_0x7c3c('0x21')]};var _0x3b3940={'method':_0x7c3c('0x37'),'uri':_0x7c3c('0x3f'),'body':_0xc5a44f,'json':!![]};rp(_0x3b3940)['then'](function(_0x35b050){var _0x12d42d={'messageId':_0x35b050[_0x7c3c('0x40')]};if(!_0x8f4e04['deliveryReport']){_0x12d42d[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x12d42d);})['catch'](function(_0x11ff38){logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x41'),util[_0x7c3c('0x3d')](_0x11ff38,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x41'),_0x7c3c('0x42'));}break;case'clicksend':if(_0x8f4e04[_0x7c3c('0x2f')]&&_0x8f4e04[_0x7c3c('0x30')]){var _0xc5a44f={'messages':[{'source':_0x7c3c('0x43'),'to':_0x2beafa['phone'],'body':_0x2beafa[_0x7c3c('0x31')],'from':_0x8f4e04['senderString']||_0x8f4e04['phone']}]};var _0x299bab=util[_0x7c3c('0x44')](_0x7c3c('0x45'),_0x8f4e04[_0x7c3c('0x2f')],_0x8f4e04[_0x7c3c('0x30')]);var _0x3b3940={'method':_0x7c3c('0x37'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xc5a44f,'headers':{'Authorization':util[_0x7c3c('0x44')](_0x7c3c('0x46'),new Buffer(_0x299bab)[_0x7c3c('0x47')](_0x7c3c('0x48')))},'json':!![]};rp(_0x3b3940)[_0x7c3c('0x17')](function(_0x1be0c2){if(_0x1be0c2['http_code']>=0xc8&&_0x1be0c2[_0x7c3c('0x49')]<=0xce){if(_0x1be0c2[_0x7c3c('0x4a')]&&_0x1be0c2[_0x7c3c('0x4a')][_0x7c3c('0x4b')]>0x0){var _0x19c1fa=_[_0x7c3c('0x4c')](_0x1be0c2[_0x7c3c('0x4a')][_0x7c3c('0x23')]);var _0x53db1c={'messageId':_0x19c1fa[_0x7c3c('0x4d')]};if(!_0x8f4e04[_0x7c3c('0x3b')]){_0x53db1c[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x53db1c);}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x4e'),util[_0x7c3c('0x3d')](_0x1be0c2,{'showHidden':![],'depth':null}));}}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'clickSend',util[_0x7c3c('0x3d')](_0x1be0c2,{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0xb2c145){logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'clickSend',util[_0x7c3c('0x3d')](_0xb2c145,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x4e'),_0x7c3c('0x3e'));}break;case _0x7c3c('0x4f'):if(_0x8f4e04[_0x7c3c('0x50')]&&_0x8f4e04[_0x7c3c('0x21')]){var _0xc5a44f={'dst':_0x2beafa[_0x7c3c('0x22')],'text':_0x2beafa[_0x7c3c('0x31')],'src':_0x8f4e04[_0x7c3c('0x51')]||_0x8f4e04[_0x7c3c('0x22')],'url':_0x8f4e04['remote']+_0x7c3c('0x25')+_0x2beafa['id']+_0x7c3c('0x26')+_0x8f4e04[_0x7c3c('0x27')]};var _0x299bab=util[_0x7c3c('0x44')]('%s:%s',_0x8f4e04[_0x7c3c('0x50')],_0x8f4e04['authToken']);var _0x3b3940={'method':'POST','uri':util['format'](_0x7c3c('0x52'),_0x8f4e04[_0x7c3c('0x50')]),'body':_0xc5a44f,'headers':{'Authorization':util[_0x7c3c('0x44')](_0x7c3c('0x46'),new Buffer(_0x299bab)['toString'](_0x7c3c('0x48')))},'json':!![]};rp(_0x3b3940)['then'](function(_0x154385){var _0x5881a3={'messageId':_0x154385[_0x7c3c('0x53')][0x0]};return _0x399eef[_0x7c3c('0x18')](_0x5881a3);})[_0x7c3c('0x29')](function(_0x44609c){logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x4f'),util[_0x7c3c('0x3d')](_0x44609c,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'plivo',_0x7c3c('0x54'));}break;case _0x7c3c('0x55'):if(_0x8f4e04[_0x7c3c('0x2f')]&&_0x8f4e04[_0x7c3c('0x30')]){if(_0x8f4e04['baseUrl']){var _0x5c5722={'method':_0x7c3c('0x37'),'uri':_0x8f4e04[_0x7c3c('0x56')]+_0x7c3c('0x57'),'body':{'username':_0x8f4e04['username'],'password':_0x8f4e04['password']},'json':!![]};return rp(_0x5c5722)[_0x7c3c('0x17')](function(_0x1097e4){var _0x2e4e1f={'method':'POST','uri':_0x8f4e04[_0x7c3c('0x56')]+_0x7c3c('0x58'),'body':{'messages':[{'from':_0x8f4e04[_0x7c3c('0x22')],'destinations':[{'to':_0x2beafa['phone']}],'text':_0x2beafa[_0x7c3c('0x31')],'notifyUrl':_0x8f4e04[_0x7c3c('0x24')]+_0x7c3c('0x25')+_0x2beafa['id']+'/status?token='+_0x8f4e04['token'],'notifyContentType':_0x7c3c('0x59'),'callbackData':_0x8f4e04['phone']+';'+_0x2beafa[_0x7c3c('0x31')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1097e4[_0x7c3c('0x27')]},'json':!![]};return rp(_0x2e4e1f)['then'](function(_0x133d82){if(_0x133d82[_0x7c3c('0x23')]){var _0x4fdc4a={'messageId':_0x133d82['messages'][0x0][_0x7c3c('0xc')]};if(!_0x8f4e04['deliveryReport']){_0x4fdc4a[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x4fdc4a);}else{return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'infobip',util[_0x7c3c('0x3d')](_0x133d82,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xaf9d6c){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x55'),util[_0x7c3c('0x3d')](_0xaf9d6c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x55'),_0x7c3c('0x5a'));}}else{logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c3c('0x2b'),_0x7c3c('0x55'),_0x7c3c('0x3e'));}break;case _0x7c3c('0x5b'):var _0x177dad=require(_0x7c3c('0x5c'));if(_0x8f4e04['apiKey']){var _0x4e0acc={};_0x4e0acc[_0x7c3c('0x5d')]=_0x8f4e04['username'];_0x4e0acc[_0x7c3c('0x22')]=_0x2beafa[_0x7c3c('0x22')];_0x4e0acc['sender']=_0x8f4e04[_0x7c3c('0x22')];_0x4e0acc[_0x7c3c('0x5e')]=_0x2beafa[_0x7c3c('0x31')];_0x4e0acc[_0x7c3c('0x5f')]=+new Date();var _0xa14cfb='';var _0x54bad8='';var _0x424c2e=Object[_0x7c3c('0x60')](_0x4e0acc);_0x424c2e[_0x7c3c('0x61')]();for(var _0x3a9a58=0x0;_0x3a9a58<_0x424c2e[_0x7c3c('0x62')];_0x3a9a58++){if(_0xa14cfb!=''){_0xa14cfb+='&';}_0xa14cfb+=_0x424c2e[_0x3a9a58]+'='+encodeURIComponent(_0x4e0acc[_0x424c2e[_0x3a9a58]]);_0x54bad8+=_0x4e0acc[_0x424c2e[_0x3a9a58]];}_0x54bad8+=_0x8f4e04[_0x7c3c('0x63')];_0x54bad8=_0x177dad[_0x7c3c('0x64')](_0x7c3c('0x65'))[_0x7c3c('0x18')](_0x54bad8)[_0x7c3c('0x66')](_0x7c3c('0x67'));if(_0xa14cfb!==''){_0xa14cfb+='&';}_0xa14cfb+='signature='+_0x54bad8;var _0x3f3bd7={'method':'GET','uri':_0x8f4e04['baseUrl']+_0x7c3c('0x68')+_0xa14cfb,'json':!![]};return rp(_0x3f3bd7)[_0x7c3c('0x17')](function(_0x9a1d4a){var _0x7d7feb=Object[_0x7c3c('0x60')](_0x9a1d4a);if(_0x9a1d4a[_0x7d7feb[0x0]][_0x7c3c('0x1a')]&&parseInt(_0x9a1d4a[_0x7d7feb[0x0]][_0x7c3c('0x1a')])===0x0){var _0x392d1b={'messageId':_0x9a1d4a[_0x7d7feb[0x0]]['id_sms']};if(!_0x8f4e04[_0x7c3c('0x3b')]){_0x392d1b[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x392d1b);}else{return logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c3c('0x5b'),util[_0x7c3c('0x3d')](_0x9a1d4a[_0x7c3c('0x1a')],{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x3f13db){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x5b'),util[_0x7c3c('0x3d')](_0x3f13db,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x7c3c('0x69'):if(_0x8f4e04[_0x7c3c('0x63')]){var _0x2f1813={'method':_0x7c3c('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x8f4e04[_0x7c3c('0x63')]},'body':{'content':_0x2beafa[_0x7c3c('0x31')],'to':[_0x2beafa['phone']],'from':_0x8f4e04[_0x7c3c('0x22')],'binary':![],'clientMessageId':_0x7c3c('0x6a'),'charset':_0x7c3c('0x6b')},'json':!![]};rp(_0x2f1813)[_0x7c3c('0x17')](function(_0x468f4c){if(!_0x468f4c['error']){var _0x208338={'messageId':_0x468f4c[_0x7c3c('0x23')][0x0][_0x7c3c('0x6c')]};if(!_0x8f4e04['deliveryReport']){_0x208338[_0x7c3c('0x3c')]=!![];}return _0x399eef['update'](_0x208338);}else{return logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x69'),util['inspect'](_0x468f4c[_0x7c3c('0x1a')],{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x1544fb){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x69'),util['inspect'](_0x1544fb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x69'),_0x7c3c('0x6d'));}break;case'intelepeer':if(_0x8f4e04['apiKey']){var _0x509eaf={};var _0x3f3bd7={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7c3c('0x6e')+_0x8f4e04['apiKey'],'Content-Type':_0x7c3c('0x59')},'body':{'from':_0x8f4e04[_0x7c3c('0x22')],'to':_0x2beafa[_0x7c3c('0x22')],'text':_0x2beafa[_0x7c3c('0x31')]},'json':!![]};return rp(_0x3f3bd7)[_0x7c3c('0x17')](function(_0xb21d32){if(_0xb21d32['code']==0xca){_0x509eaf[_0x7c3c('0x6f')]=_0xb21d32;var _0xd1394b={'method':_0x7c3c('0x37'),'uri':_0x7c3c('0x70'),'headers':{'Authorization':_0x7c3c('0x6e')+_0x8f4e04[_0x7c3c('0x63')],'Content-Type':_0x7c3c('0x59')},'body':{'refid':_0x509eaf['message'][_0x7c3c('0x71')]},'json':!![]};return rp(_0xd1394b)[_0x7c3c('0x17')](function(_0x17d4e6){_0x509eaf[_0x7c3c('0x72')]=_0x17d4e6;var _0x323bc4={'messageId':_0x509eaf['message'][_0x7c3c('0x71')],'read':!![]};return _0x399eef[_0x7c3c('0x18')](_0x323bc4);});}else{return logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'intelepeer',util['inspect'](_0xb21d32,{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x4795b5){return logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c3c('0x73'),util['inspect'](_0x4795b5,{'showHidden':![],'depth':null}));});}else{return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x73'),_0x7c3c('0x74'));}break;}}})[_0x7c3c('0x75')](function(){_0x55045e();});}else{_0x55045e();}}},'charset':_0x7c3c('0x76'),'collate':_0x7c3c('0x77')});}; \ No newline at end of file +var _0x75ed=['../../config/environment','./smsMessage.attributes','exports','SmsMessage','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','findOne','SmsInteractionId','update','catch','error','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','clicksend','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','head','data','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','crypto','apiKey','login','text','sort','length','createHash','md5','digest','signature=','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x75ed,0xdb));var _0xd75e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75ed[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd75e('0x0'));var util=require(_0xd75e('0x1'));var logger=require(_0xd75e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd75e('0x3'));var fs=require('fs');var path=require(_0xd75e('0x4'));var rimraf=require('rimraf');var config=require(_0xd75e('0x5'));var attributes=require(_0xd75e('0x6'));module[_0xd75e('0x7')]=function(_0x1034a9,_0x1e7de3){return _0x1034a9['define'](_0xd75e('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xd75e('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xd75e('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5386ad,_0x352579,_0x5f5787){var _0x543fc6=_0x1034a9[_0xd75e('0xb')];var _0x1ff790=_0x5386ad[_0xd75e('0xc')]({'plain':!![]});if(_0x1ff790[_0xd75e('0xd')][_0xd75e('0xe')]()==='in'||_0x1ff790['direction'][_0xd75e('0xe')]()===_0xd75e('0xf')&&!_0x1ff790[_0xd75e('0x10')]&&!_[_0xd75e('0x11')](_0x1ff790['UserId'])){_0x543fc6['SmsInteraction'][_0xd75e('0x12')]({'where':{'id':_0x1ff790[_0xd75e('0x13')]}})['then'](function(_0x1ba2d8){if(_0x1ba2d8){_0x1ba2d8[_0xd75e('0x14')]({'lastMsgAt':_0x1ff790['createdAt'],'lastMsgDirection':_0x1ff790[_0xd75e('0xd')][_0xd75e('0xe')]()});}})[_0xd75e('0x15')](function(_0xa5d00d){console[_0xd75e('0x16')](_0xa5d00d);});}if(_0x1ff790[_0xd75e('0xd')]==='out'&&!_0x1ff790[_0xd75e('0x10')]){var _0x4ee446;_0x543fc6['SmsAccount'][_0xd75e('0x17')]({'where':{'id':_0x1ff790[_0xd75e('0x18')]},'raw':!![]})[_0xd75e('0x19')](function(_0x48abcc){_0x4ee446=_0x48abcc;if(_0x4ee446&&_0x4ee446[_0xd75e('0x1a')]){switch(_0x4ee446[_0xd75e('0x1a')]){case _0xd75e('0x1b'):var _0x5475e6=require(_0xd75e('0x1b'));if(_0x4ee446[_0xd75e('0x1c')]&&_0x4ee446[_0xd75e('0x1d')]&&_0x4ee446[_0xd75e('0x1e')]){var _0x272e81=new _0x5475e6(_0x4ee446['accountSid'],_0x4ee446[_0xd75e('0x1d')]);_0x272e81[_0xd75e('0x1f')][_0xd75e('0x20')]({'body':_0x1ff790[_0xd75e('0xa')],'to':_0x1ff790['phone'],'from':_0x4ee446[_0xd75e('0x1e')],'statusCallback':_0x4ee446[_0xd75e('0x21')]+_0xd75e('0x22')+_0x1ff790['id']+_0xd75e('0x23')+_0x4ee446[_0xd75e('0x24')]})[_0xd75e('0x19')](function(_0x3e6b69){if(_0x3e6b69[_0xd75e('0x25')]){return _0x5386ad['update']({'messageId':_0x3e6b69['sid']});}})[_0xd75e('0x15')](function(_0x183d9d){logger['error'](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x1b'),util[_0xd75e('0x28')](_0x183d9d,{'showHidden':![],'depth':null}));});}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),'afterCreate',_0xd75e('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x50bdc3=_0xd75e('0x29');if(_0x4ee446['username']&&_0x4ee446[_0xd75e('0x2a')]){var _0x31e75b={'recipient':[_0x1ff790[_0xd75e('0x1e')]],'message':_0x1ff790['body'],'message_type':_0x4ee446[_0xd75e('0x2b')]};if(_0x4ee446[_0xd75e('0x2b')]&&_0x4ee446[_0xd75e('0x2b')]!=='SI'){_0x31e75b[_0xd75e('0x2c')]=_0x4ee446['phone'];}var _0xa2e8be={'url':_0x50bdc3+_0xd75e('0x2d')+_0x4ee446[_0xd75e('0x2e')]+'&password='+_0x4ee446[_0xd75e('0x2a')],'method':'GET'};rp(_0xa2e8be)['then'](function(_0x72dbe){var _0x36d8ad=_0x72dbe['split'](';');var _0x1fd85f={'user_key':_0x36d8ad[0x0],'session_key':_0x36d8ad[0x1]};_0xa2e8be={'url':_0x50bdc3+_0xd75e('0x2f'),'method':_0xd75e('0x30'),'headers':{'user_key':_0x1fd85f[_0xd75e('0x31')],'Session_key':_0x1fd85f[_0xd75e('0x32')]},'json':!![],'body':_0x31e75b};return rp(_0xa2e8be);})[_0xd75e('0x19')](function(_0x355e84){if(_0x355e84[_0xd75e('0x33')]>=0x1){var _0x379192={'messageId':_0x355e84[_0xd75e('0x34')]};if(_0x4ee446[_0xd75e('0x2b')]!=='GP'||!_0x4ee446[_0xd75e('0x35')]){_0x379192[_0xd75e('0x36')]=!![];}return _0x5386ad['update'](_0x379192);}else{return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x37'),util[_0xd75e('0x28')](_0x355e84,{'showHidden':![],'depth':null}));}})[_0xd75e('0x15')](function(_0x44f18f){return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x37'),util[_0xd75e('0x28')](_0x44f18f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x37'),_0xd75e('0x38'));}break;case _0xd75e('0x39'):if(_0x4ee446[_0xd75e('0x1d')]){var _0x190f8d={'recipient':_0x1ff790[_0xd75e('0x1e')],'message':_0x1ff790[_0xd75e('0xa')],'sender':_0x4ee446['senderString']||_0x4ee446['phone'],'authorization':_0x4ee446[_0xd75e('0x1d')]};var _0x352579={'method':_0xd75e('0x30'),'uri':_0xd75e('0x3a'),'body':_0x190f8d,'json':!![]};rp(_0x352579)['then'](function(_0x3983d2){var _0x1871a0={'messageId':_0x3983d2[_0xd75e('0x3b')]};if(!_0x4ee446['deliveryReport']){_0x1871a0[_0xd75e('0x36')]=!![];}return _0x5386ad[_0xd75e('0x14')](_0x1871a0);})[_0xd75e('0x15')](function(_0x463049){logger[_0xd75e('0x16')](_0xd75e('0x26'),'afterCreate',_0xd75e('0x39'),util['inspect'](_0x463049,{'showHidden':![],'depth':null}));});}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case _0xd75e('0x3c'):if(_0x4ee446[_0xd75e('0x2e')]&&_0x4ee446['password']){var _0x190f8d={'messages':[{'source':'xCALLY\x20Motion','to':_0x1ff790[_0xd75e('0x1e')],'body':_0x1ff790[_0xd75e('0xa')],'from':_0x4ee446[_0xd75e('0x3d')]||_0x4ee446[_0xd75e('0x1e')]}]};var _0xf5bfaf=util[_0xd75e('0x3e')](_0xd75e('0x3f'),_0x4ee446[_0xd75e('0x2e')],_0x4ee446[_0xd75e('0x2a')]);var _0x352579={'method':'POST','uri':_0xd75e('0x40'),'body':_0x190f8d,'headers':{'Authorization':util['format'](_0xd75e('0x41'),new Buffer(_0xf5bfaf)[_0xd75e('0x42')](_0xd75e('0x43')))},'json':!![]};rp(_0x352579)['then'](function(_0x24144a){if(_0x24144a['http_code']>=0xc8&&_0x24144a[_0xd75e('0x44')]<=0xce){if(_0x24144a['data']&&_0x24144a['data'][_0xd75e('0x45')]>0x0){var _0x2483d6=_[_0xd75e('0x46')](_0x24144a[_0xd75e('0x47')][_0xd75e('0x1f')]);var _0x5c2de9={'messageId':_0x2483d6['message_id']};if(!_0x4ee446[_0xd75e('0x35')]){_0x5c2de9[_0xd75e('0x36')]=!![];}return _0x5386ad[_0xd75e('0x14')](_0x5c2de9);}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),'clickSend',util[_0xd75e('0x28')](_0x24144a,{'showHidden':![],'depth':null}));}}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x48'),util[_0xd75e('0x28')](_0x24144a,{'showHidden':![],'depth':null}));}})[_0xd75e('0x15')](function(_0x157910){logger[_0xd75e('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd75e('0x27'),_0xd75e('0x48'),util[_0xd75e('0x28')](_0x157910,{'showHidden':![],'depth':null}));});}else{logger[_0xd75e('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd75e('0x27'),_0xd75e('0x48'),_0xd75e('0x38'));}break;case _0xd75e('0x49'):if(_0x4ee446[_0xd75e('0x4a')]&&_0x4ee446[_0xd75e('0x1d')]){var _0x190f8d={'dst':_0x1ff790[_0xd75e('0x1e')],'text':_0x1ff790[_0xd75e('0xa')],'src':_0x4ee446[_0xd75e('0x3d')]||_0x4ee446['phone'],'url':_0x4ee446[_0xd75e('0x21')]+_0xd75e('0x22')+_0x1ff790['id']+'/status?token='+_0x4ee446['token']};var _0xf5bfaf=util[_0xd75e('0x3e')](_0xd75e('0x3f'),_0x4ee446[_0xd75e('0x4a')],_0x4ee446[_0xd75e('0x1d')]);var _0x352579={'method':_0xd75e('0x30'),'uri':util[_0xd75e('0x3e')](_0xd75e('0x4b'),_0x4ee446[_0xd75e('0x4a')]),'body':_0x190f8d,'headers':{'Authorization':util[_0xd75e('0x3e')](_0xd75e('0x41'),new Buffer(_0xf5bfaf)['toString'](_0xd75e('0x43')))},'json':!![]};rp(_0x352579)[_0xd75e('0x19')](function(_0x4c4c8c){var _0x368d1c={'messageId':_0x4c4c8c['message_uuid'][0x0]};return _0x5386ad['update'](_0x368d1c);})[_0xd75e('0x15')](function(_0x13ff86){logger[_0xd75e('0x16')](_0xd75e('0x26'),'afterCreate',_0xd75e('0x49'),util[_0xd75e('0x28')](_0x13ff86,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd75e('0x27'),_0xd75e('0x49'),_0xd75e('0x4c'));}break;case _0xd75e('0x4d'):if(_0x4ee446[_0xd75e('0x2e')]&&_0x4ee446[_0xd75e('0x2a')]){if(_0x4ee446[_0xd75e('0x4e')]){var _0x41aeb6={'method':_0xd75e('0x30'),'uri':_0x4ee446[_0xd75e('0x4e')]+_0xd75e('0x4f'),'body':{'username':_0x4ee446[_0xd75e('0x2e')],'password':_0x4ee446['password']},'json':!![]};return rp(_0x41aeb6)[_0xd75e('0x19')](function(_0x513597){var _0x4ca955={'method':_0xd75e('0x30'),'uri':_0x4ee446[_0xd75e('0x4e')]+_0xd75e('0x50'),'body':{'messages':[{'from':_0x4ee446[_0xd75e('0x1e')],'destinations':[{'to':_0x1ff790['phone']}],'text':_0x1ff790[_0xd75e('0xa')],'notifyUrl':_0x4ee446['remote']+'/api/sms/messages/'+_0x1ff790['id']+_0xd75e('0x23')+_0x4ee446['token'],'notifyContentType':_0xd75e('0x51'),'callbackData':_0x4ee446[_0xd75e('0x1e')]+';'+_0x1ff790['body']}]},'headers':{'Authorization':_0xd75e('0x52')+_0x513597[_0xd75e('0x24')]},'json':!![]};return rp(_0x4ca955)[_0xd75e('0x19')](function(_0x8fdf29){if(_0x8fdf29['messages']){var _0x3a6ef1={'messageId':_0x8fdf29['messages'][0x0][_0xd75e('0x9')]};if(!_0x4ee446[_0xd75e('0x35')]){_0x3a6ef1['read']=!![];}return _0x5386ad['update'](_0x3a6ef1);}else{return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x4d'),util[_0xd75e('0x28')](_0x8fdf29,{'showHidden':![],'depth':null}));}});})[_0xd75e('0x15')](function(_0x5e65cb){return logger[_0xd75e('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd75e('0x27'),_0xd75e('0x4d'),util[_0xd75e('0x28')](_0x5e65cb,{'showHidden':![],'depth':null}));});}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x257696=require(_0xd75e('0x53'));if(_0x4ee446[_0xd75e('0x54')]){var _0x4360f4={};_0x4360f4[_0xd75e('0x55')]=_0x4ee446[_0xd75e('0x2e')];_0x4360f4[_0xd75e('0x1e')]=_0x1ff790['phone'];_0x4360f4[_0xd75e('0x2c')]=_0x4ee446['phone'];_0x4360f4[_0xd75e('0x56')]=_0x1ff790[_0xd75e('0xa')];_0x4360f4['timestamp']=+new Date();var _0x5af277='';var _0x2092b8='';var _0x507a56=Object['keys'](_0x4360f4);_0x507a56[_0xd75e('0x57')]();for(var _0x419d89=0x0;_0x419d89<_0x507a56[_0xd75e('0x58')];_0x419d89++){if(_0x5af277!=''){_0x5af277+='&';}_0x5af277+=_0x507a56[_0x419d89]+'='+encodeURIComponent(_0x4360f4[_0x507a56[_0x419d89]]);_0x2092b8+=_0x4360f4[_0x507a56[_0x419d89]];}_0x2092b8+=_0x4ee446['apiKey'];_0x2092b8=_0x257696[_0xd75e('0x59')](_0xd75e('0x5a'))[_0xd75e('0x14')](_0x2092b8)[_0xd75e('0x5b')]('hex');if(_0x5af277!==''){_0x5af277+='&';}_0x5af277+=_0xd75e('0x5c')+_0x2092b8;var _0xa2e8be={'method':_0xd75e('0x5d'),'uri':_0x4ee446['baseUrl']+_0xd75e('0x5e')+_0x5af277,'json':!![]};return rp(_0xa2e8be)[_0xd75e('0x19')](function(_0x8fa20f){var _0x1241c7=Object['keys'](_0x8fa20f);if(_0x8fa20f[_0x1241c7[0x0]][_0xd75e('0x16')]&&parseInt(_0x8fa20f[_0x1241c7[0x0]]['error'])===0x0){var _0x355dea={'messageId':_0x8fa20f[_0x1241c7[0x0]][_0xd75e('0x5f')]};if(!_0x4ee446['deliveryReport']){_0x355dea[_0xd75e('0x36')]=!![];}return _0x5386ad[_0xd75e('0x14')](_0x355dea);}else{return logger['error'](_0xd75e('0x26'),_0xd75e('0x27'),'csc',util[_0xd75e('0x28')](_0x8fa20f[_0xd75e('0x16')],{'showHidden':![],'depth':null}));}})[_0xd75e('0x15')](function(_0x549d12){return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x60'),util['inspect'](_0x549d12,{'showHidden':![],'depth':null}));});}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x60'),_0xd75e('0x61'));}break;case _0xd75e('0x62'):if(_0x4ee446[_0xd75e('0x54')]){var _0x35e847={'method':_0xd75e('0x30'),'uri':_0xd75e('0x63'),'headers':{'Authorization':_0x4ee446[_0xd75e('0x54')]},'body':{'content':_0x1ff790[_0xd75e('0xa')],'to':[_0x1ff790[_0xd75e('0x1e')]],'from':_0x4ee446['phone'],'binary':![],'clientMessageId':_0xd75e('0x64'),'charset':_0xd75e('0x65')},'json':!![]};rp(_0x35e847)[_0xd75e('0x19')](function(_0x209272){if(!_0x209272[_0xd75e('0x16')]){var _0x88fefa={'messageId':_0x209272['messages'][0x0]['apiMessageId']};if(!_0x4ee446[_0xd75e('0x35')]){_0x88fefa[_0xd75e('0x36')]=!![];}return _0x5386ad[_0xd75e('0x14')](_0x88fefa);}else{return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x62'),util[_0xd75e('0x28')](_0x209272['error'],{'showHidden':![],'depth':null}));}})[_0xd75e('0x15')](function(_0x3ffba2){return logger['error'](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x62'),util[_0xd75e('0x28')](_0x3ffba2,{'showHidden':![],'depth':null}));});}else{logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),'clickatell',_0xd75e('0x61'));}break;case _0xd75e('0x66'):if(_0x4ee446[_0xd75e('0x54')]){var _0x4476f1={};var _0xa2e8be={'method':_0xd75e('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xd75e('0x67')+_0x4ee446[_0xd75e('0x54')],'Content-Type':_0xd75e('0x51')},'body':{'from':_0x4ee446[_0xd75e('0x1e')],'to':_0x1ff790[_0xd75e('0x1e')],'text':_0x1ff790[_0xd75e('0xa')]},'json':!![]};return rp(_0xa2e8be)[_0xd75e('0x19')](function(_0x5eafaf){if(_0x5eafaf['code']==0xca){_0x4476f1[_0xd75e('0x68')]=_0x5eafaf;var _0x139fc8={'method':'POST','uri':_0xd75e('0x69'),'headers':{'Authorization':_0xd75e('0x67')+_0x4ee446[_0xd75e('0x54')],'Content-Type':'application/json'},'body':{'refid':_0x4476f1[_0xd75e('0x68')]['refid']},'json':!![]};return rp(_0x139fc8)['then'](function(_0x100009){_0x4476f1[_0xd75e('0x6a')]=_0x100009;var _0x6ff170={'messageId':_0x4476f1[_0xd75e('0x68')][_0xd75e('0x6b')],'read':!![]};return _0x5386ad['update'](_0x6ff170);});}else{return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x66'),util['inspect'](_0x5eafaf,{'showHidden':![],'depth':null}));}})[_0xd75e('0x15')](function(_0x47db1b){return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x66'),util[_0xd75e('0x28')](_0x47db1b,{'showHidden':![],'depth':null}));});}else{return logger[_0xd75e('0x16')](_0xd75e('0x26'),_0xd75e('0x27'),_0xd75e('0x66'),_0xd75e('0x6c'));}break;}}})[_0xd75e('0x6d')](function(){_0x5f5787();});}else{_0x5f5787();}}},'charset':_0xd75e('0x6e'),'collate':_0xd75e('0x6f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1d61f06..dccef11 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 _0xda2d=['body','options','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xda2d,0x102));var _0xdda2=function(_0x34ff42,_0x4d41a7){_0x34ff42=_0x34ff42-0x0;var _0x5e39cb=_0xda2d[_0x34ff42];return _0x5e39cb;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['create'](_0x337b0b[_0xdda2('0x1e')],{'raw':_0x337b0b[_0xdda2('0x1f')]?_0x337b0b[_0xdda2('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xdda2('0x11')](function(_0x5a9bb8){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger['debug'](_0xdda2('0x1c'),_0x337b0b,JSON[_0xdda2('0x15')](_0x5a9bb8));_0x6fdede(_0x5a9bb8);})[_0xdda2('0x1b')](function(_0x13b0f3){logger[_0xdda2('0x16')]('CreateSmsMessage',_0x13b0f3[_0xdda2('0x18')],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x13b0f3[_0xdda2('0x18')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xdb28,0x106));var _0x8db2=function(_0x18cf35,_0x5c9058){_0x18cf35=_0x18cf35-0x0;var _0x2f44ec=_0xdb28[_0x18cf35];return _0x2f44ec;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('SmsMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateSmsMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateSmsMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0a849ed..d74ed7e 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 _0x3205=['update','emit','length','smsMessage:','./smsMessage.events','save'];(function(_0x5c68b1,_0x4ac4b1){var _0x6bba3=function(_0x1bf0a3){while(--_0x1bf0a3){_0x5c68b1['push'](_0x5c68b1['shift']());}};_0x6bba3(++_0x4ac4b1);}(_0x3205,0x1f0));var _0x5320=function(_0x2629a6,_0x3a908d){_0x2629a6=_0x2629a6-0x0;var _0x49f5bd=_0x3205[_0x2629a6];return _0x49f5bd;};'use strict';var SmsMessageEvents=require(_0x5320('0x0'));var events=[_0x5320('0x1'),'remove',_0x5320('0x2')];function createListener(_0x5a19fe,_0x5ae1c6){return function(_0x51ba6a){_0x5ae1c6[_0x5320('0x3')](_0x5a19fe,_0x51ba6a);};}function removeListener(_0x36cedc,_0x40a580){return function(){SmsMessageEvents['removeListener'](_0x36cedc,_0x40a580);};}exports['register']=function(_0x43e2b0){for(var _0xe603c6=0x0,_0xbd07c8=events[_0x5320('0x4')];_0xe603c6<_0xbd07c8;_0xe603c6++){var _0x5b128d=events[_0xe603c6];var _0x3b7a7c=createListener(_0x5320('0x5')+_0x5b128d,_0x43e2b0);SmsMessageEvents['on'](_0x5b128d,_0x3b7a7c);}}; \ No newline at end of file +var _0x3861=['removeListener','smsMessage:','./smsMessage.events','remove','emit'];(function(_0x343a9b,_0x5aa0c0){var _0x1521a9=function(_0x3efc15){while(--_0x3efc15){_0x343a9b['push'](_0x343a9b['shift']());}};_0x1521a9(++_0x5aa0c0);}(_0x3861,0x1ec));var _0x1386=function(_0x3c349f,_0x366b88){_0x3c349f=_0x3c349f-0x0;var _0x3870cd=_0x3861[_0x3c349f];return _0x3870cd;};'use strict';var SmsMessageEvents=require(_0x1386('0x0'));var events=['save',_0x1386('0x1'),'update'];function createListener(_0x6d137a,_0x37db6e){return function(_0x3fbb73){_0x37db6e[_0x1386('0x2')](_0x6d137a,_0x3fbb73);};}function removeListener(_0x5e487c,_0x2fefc1){return function(){SmsMessageEvents[_0x1386('0x3')](_0x5e487c,_0x2fefc1);};}exports['register']=function(_0x5d705f){for(var _0x391bd0=0x0,_0x322921=events['length'];_0x391bd0<_0x322921;_0x391bd0++){var _0x254e5f=events[_0x391bd0];var _0x1d76f6=createListener(_0x1386('0x4')+_0x254e5f,_0x5d705f);SmsMessageEvents['on'](_0x254e5f,_0x1d76f6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 28b0613..44112eb 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 _0x0c42=['/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x2b049b,_0x250f3a){var _0x29bbeb=function(_0x2e408d){while(--_0x2e408d){_0x2b049b['push'](_0x2b049b['shift']());}};_0x29bbeb(++_0x250f3a);}(_0x0c42,0x191));var _0x20c4=function(_0x2d8d67,_0x1d084d){_0x2d8d67=_0x2d8d67-0x0;var _0x42a068=_0x0c42[_0x2d8d67];return _0x42a068;};'use strict';var multer=require(_0x20c4('0x0'));var util=require(_0x20c4('0x1'));var path=require(_0x20c4('0x2'));var timeout=require(_0x20c4('0x3'));var express=require(_0x20c4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x20c4('0x5'));var config=require(_0x20c4('0x6'));var controller=require(_0x20c4('0x7'));router[_0x20c4('0x8')]('/',auth[_0x20c4('0x9')](),controller['index']);router[_0x20c4('0x8')]('/describe',auth[_0x20c4('0x9')](),controller['describe']);router[_0x20c4('0x8')](_0x20c4('0xa'),auth[_0x20c4('0x9')](),controller['show']);router[_0x20c4('0x8')](_0x20c4('0xb'),auth[_0x20c4('0x9')](),controller[_0x20c4('0xc')]);router[_0x20c4('0x8')](_0x20c4('0xd'),auth[_0x20c4('0x9')](),controller[_0x20c4('0xe')]);router[_0x20c4('0x8')](_0x20c4('0xf'),auth[_0x20c4('0x9')](),controller[_0x20c4('0x10')]);router[_0x20c4('0x11')]('/',auth['isAuthenticated'](),controller[_0x20c4('0x12')]);router['post'](_0x20c4('0xd'),auth[_0x20c4('0x9')](),controller['addTeams']);router[_0x20c4('0x11')]('/:id/users',auth[_0x20c4('0x9')](),controller[_0x20c4('0x13')]);router[_0x20c4('0x14')]('/:id',auth[_0x20c4('0x9')](),controller[_0x20c4('0x15')]);router[_0x20c4('0x16')](_0x20c4('0xa'),auth[_0x20c4('0x9')](),controller[_0x20c4('0x17')]);router[_0x20c4('0x16')](_0x20c4('0xd'),auth[_0x20c4('0x9')](),controller[_0x20c4('0x18')]);router[_0x20c4('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x20c4('0x19')]);module['exports']=router; \ No newline at end of file +var _0xdc86=['/:id/users','getAgents','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams'];(function(_0x45e302,_0xbe25c7){var _0x593680=function(_0x172b83){while(--_0x172b83){_0x45e302['push'](_0x45e302['shift']());}};_0x593680(++_0xbe25c7);}(_0xdc86,0x118));var _0x6dc8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xdc86[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require('multer');var util=require(_0x6dc8('0x0'));var path=require('path');var timeout=require(_0x6dc8('0x1'));var express=require('express');var router=express[_0x6dc8('0x2')]();var auth=require(_0x6dc8('0x3'));var interaction=require(_0x6dc8('0x4'));var config=require(_0x6dc8('0x5'));var controller=require(_0x6dc8('0x6'));router['get']('/',auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x8')]);router[_0x6dc8('0x9')](_0x6dc8('0xa'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0xb')]);router[_0x6dc8('0x9')](_0x6dc8('0xc'),auth['isAuthenticated'](),controller[_0x6dc8('0xd')]);router['get'](_0x6dc8('0xe'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0xf')]);router[_0x6dc8('0x9')]('/:id/teams',auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x10')]);router[_0x6dc8('0x9')](_0x6dc8('0x11'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x12')]);router['post']('/',auth[_0x6dc8('0x7')](),controller['create']);router['post'](_0x6dc8('0x13'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x14')]);router['post'](_0x6dc8('0x11'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x15')]);router[_0x6dc8('0x16')](_0x6dc8('0xc'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x17')]);router[_0x6dc8('0x18')](_0x6dc8('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x6dc8('0x18')](_0x6dc8('0x13'),auth[_0x6dc8('0x7')](),controller[_0x6dc8('0x19')]);router[_0x6dc8('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x6dc8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f709bd7..374c436 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 _0x93d2=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2fcc5b,_0x47e1c0){var _0x198739=function(_0x282e86){while(--_0x282e86){_0x2fcc5b['push'](_0x2fcc5b['shift']());}};_0x198739(++_0x47e1c0);}(_0x93d2,0x110));var _0x293d=function(_0x2c5e72,_0x33556e){_0x2c5e72=_0x2c5e72-0x0;var _0x5e9f9a=_0x93d2[_0x2c5e72];return _0x5e9f9a;};'use strict';var Sequelize=require(_0x293d('0x0'));module[_0x293d('0x1')]={'name':{'type':Sequelize[_0x293d('0x2')],'unique':_0x293d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x293d('0x2')]},'timeout':{'type':Sequelize[_0x293d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x293d('0x5')](_0x293d('0x6'),_0x293d('0x7'),_0x293d('0x8'))}}; \ No newline at end of file +var _0x3f43=['sequelize','exports','STRING','INTEGER','rrmemory','roundrobin'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x3f43,0x1e6));var _0x33f4=function(_0x486504,_0xedeea3){_0x486504=_0x486504-0x0;var _0x397b0f=_0x3f43[_0x486504];return _0x397b0f;};'use strict';var Sequelize=require(_0x33f4('0x0'));module[_0x33f4('0x1')]={'name':{'type':Sequelize[_0x33f4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x33f4('0x2')]},'timeout':{'type':Sequelize[_0x33f4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x33f4('0x4'),'beepall',_0x33f4('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 8d73f42..8bc572e 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 _0x8ec9=['getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','./smsQueue.socket','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','destroy','SmsQueues','UserProfileResource','error','name','send','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','SmsQueue','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','isArray'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x8ec9,0x8d));var _0x98ec=function(_0x53d119,_0x4c230e){_0x53d119=_0x53d119-0x0;var _0x15f150=_0x8ec9[_0x53d119];return _0x15f150;};'use strict';var pdf=require(_0x98ec('0x0'));var emlformat=require(_0x98ec('0x1'));var rimraf=require(_0x98ec('0x2'));var zipdir=require(_0x98ec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98ec('0x4'));var moment=require(_0x98ec('0x5'));var BPromise=require(_0x98ec('0x6'));var Mustache=require(_0x98ec('0x7'));var util=require(_0x98ec('0x8'));var path=require(_0x98ec('0x9'));var sox=require(_0x98ec('0xa'));var csv=require(_0x98ec('0xb'));var ejs=require(_0x98ec('0xc'));var fs=require('fs');var _=require(_0x98ec('0xd'));var squel=require(_0x98ec('0xe'));var crypto=require('crypto');var jsforce=require(_0x98ec('0xf'));var deskjs=require(_0x98ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98ec('0x11'));var Papa=require('papaparse');var Redis=require(_0x98ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98ec('0x13'));var as=require(_0x98ec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98ec('0x15'));var utils=require(_0x98ec('0x16'));var config=require(_0x98ec('0x17'));var db=require('../../mysqldb')['db'];config[_0x98ec('0x18')]=_[_0x98ec('0x19')](config[_0x98ec('0x18')],{'host':_0x98ec('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98ec('0x18')]));require(_0x98ec('0x1b'))['register'](socket);function respondWithStatusCode(_0x5e41eb,_0x347ed3){_0x347ed3=_0x347ed3||0xcc;return function(_0x193e7a){if(_0x193e7a){return _0x5e41eb[_0x98ec('0x1c')](_0x347ed3);}return _0x5e41eb['status'](_0x347ed3)[_0x98ec('0x1d')]();};}function respondWithResult(_0x20e85d,_0x69df1b){_0x69df1b=_0x69df1b||0xc8;return function(_0x212957){if(_0x212957){return _0x20e85d[_0x98ec('0x1e')](_0x69df1b)[_0x98ec('0x1f')](_0x212957);}};}function respondWithFilteredResult(_0x40919b,_0x27b867){return function(_0x48bbf3){if(_0x48bbf3){var _0x454fd1=_0x48bbf3[_0x98ec('0x20')],_0x1debfd=_0x27b867[_0x98ec('0x21')],_0x22f588=_0x27b867[_0x98ec('0x21')]+_0x27b867[_0x98ec('0x22')],_0x3ba139;if(_0x22f588>=_0x454fd1){_0x22f588=_0x454fd1;_0x3ba139=0xc8;}else{_0x3ba139=0xce;}_0x40919b[_0x98ec('0x1e')](_0x3ba139);return _0x40919b[_0x98ec('0x23')]('Content-Range',_0x1debfd+'-'+_0x22f588+'/'+_0x454fd1)[_0x98ec('0x1f')](_0x48bbf3);}return null;};}function patchUpdates(_0x279a12){return function(_0x44f4a1){try{jsonpatch[_0x98ec('0x24')](_0x44f4a1,_0x279a12,!![]);}catch(_0x1294ce){return BPromise['reject'](_0x1294ce);}return _0x44f4a1[_0x98ec('0x25')]();};}function saveUpdates(_0x1454bb,_0x4c56be){return function(_0x116ef6){if(_0x116ef6){return _0x116ef6['update'](_0x1454bb)[_0x98ec('0x26')](function(_0x945dea){return _0x945dea;});}return null;};}function removeEntity(_0x146565,_0x5f2355){return function(_0x25bf1d){if(_0x25bf1d){return _0x25bf1d[_0x98ec('0x27')]()[_0x98ec('0x26')](function(){var _0x13a6cd=_0x25bf1d['get']({'plain':!![]});var _0x3e5edd=_0x98ec('0x28');return db[_0x98ec('0x29')][_0x98ec('0x27')]({'where':{'type':_0x3e5edd,'resourceId':_0x13a6cd['id']}})[_0x98ec('0x26')](function(){return _0x25bf1d;});})[_0x98ec('0x26')](function(){_0x146565[_0x98ec('0x1e')](0xcc)[_0x98ec('0x1d')]();});}};}function handleEntityNotFound(_0x1e82fc,_0x582536){return function(_0x1d3c44){if(!_0x1d3c44){_0x1e82fc[_0x98ec('0x1c')](0x194);}return _0x1d3c44;};}function handleError(_0x871280,_0x271a1c){_0x271a1c=_0x271a1c||0x1f4;return function(_0x2640ac){logger[_0x98ec('0x2a')](_0x2640ac['stack']);if(_0x2640ac[_0x98ec('0x2b')]){delete _0x2640ac[_0x98ec('0x2b')];}_0x871280[_0x98ec('0x1e')](_0x271a1c)[_0x98ec('0x2c')](_0x2640ac);};}exports[_0x98ec('0x2d')]=function(_0xc5beab,_0x2f0795){var _0x58b3be={},_0x4226e5={},_0x5ad966={'count':0x0,'rows':[]};var _0x5b8c92=_[_0x98ec('0x2e')](db['SmsQueue']['rawAttributes'],function(_0xa2170b){return{'name':_0xa2170b[_0x98ec('0x2f')],'type':_0xa2170b['type'][_0x98ec('0x30')]};});_0x4226e5[_0x98ec('0x31')]=_['map'](_0x5b8c92,_0x98ec('0x2b'));_0x4226e5[_0x98ec('0x32')]=_[_0x98ec('0x33')](_0xc5beab[_0x98ec('0x32')]);_0x4226e5['filters']=_['intersection'](_0x4226e5[_0x98ec('0x31')],_0x4226e5[_0x98ec('0x32')]);_0x58b3be['attributes']=_[_0x98ec('0x34')](_0x4226e5[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0xc5beab[_0x98ec('0x32')]['fields']));_0x58b3be[_0x98ec('0x36')]=_0x58b3be[_0x98ec('0x36')][_0x98ec('0x37')]?_0x58b3be[_0x98ec('0x36')]:_0x4226e5[_0x98ec('0x31')];if(!_0xc5beab[_0x98ec('0x32')][_0x98ec('0x38')](_0x98ec('0x39'))){_0x58b3be[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0xc5beab[_0x98ec('0x32')][_0x98ec('0x22')]);_0x58b3be[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0xc5beab[_0x98ec('0x32')][_0x98ec('0x21')]);}_0x58b3be[_0x98ec('0x3a')]=qs[_0x98ec('0x3b')](_0xc5beab[_0x98ec('0x32')]['sort']);_0x58b3be[_0x98ec('0x3c')]=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0xc5beab[_0x98ec('0x32')],_0x4226e5[_0x98ec('0x3d')]),_0x5b8c92);if(_0xc5beab[_0x98ec('0x32')][_0x98ec('0x3f')]){_0x58b3be['where']=_['merge'](_0x58b3be[_0x98ec('0x3c')],{'$or':_[_0x98ec('0x2e')](_0x5b8c92,function(_0x4db245){if(_0x4db245['type']!=='VIRTUAL'){var _0x594cd8={};_0x594cd8[_0x4db245[_0x98ec('0x2b')]]={'$like':'%'+_0xc5beab[_0x98ec('0x32')]['filter']+'%'};return _0x594cd8;}})});}_0x58b3be=_[_0x98ec('0x40')]({},_0x58b3be,_0xc5beab[_0x98ec('0x41')]);var _0x44085e={'where':_0x58b3be[_0x98ec('0x3c')]};return db[_0x98ec('0x42')][_0x98ec('0x20')](_0x44085e)['then'](function(_0x407ec0){_0x5ad966[_0x98ec('0x20')]=_0x407ec0;if(_0xc5beab[_0x98ec('0x32')][_0x98ec('0x43')]){_0x58b3be[_0x98ec('0x44')]=[{'all':!![]}];}return db[_0x98ec('0x42')][_0x98ec('0x45')](_0x58b3be);})[_0x98ec('0x26')](function(_0x5d18d7){_0x5ad966[_0x98ec('0x46')]=_0x5d18d7;return _0x5ad966;})['then'](respondWithFilteredResult(_0x2f0795,_0x58b3be))[_0x98ec('0x47')](handleError(_0x2f0795,null));};exports[_0x98ec('0x48')]=function(_0x4706eb,_0x157ca4){var _0x2632f0={'raw':!![],'where':{'id':_0x4706eb['params']['id']}},_0x76f303={};_0x76f303[_0x98ec('0x31')]=_[_0x98ec('0x33')](db[_0x98ec('0x42')][_0x98ec('0x49')]);_0x76f303[_0x98ec('0x32')]=_['keys'](_0x4706eb[_0x98ec('0x32')]);_0x76f303[_0x98ec('0x3d')]=_[_0x98ec('0x34')](_0x76f303[_0x98ec('0x31')],_0x76f303[_0x98ec('0x32')]);_0x2632f0[_0x98ec('0x36')]=_[_0x98ec('0x34')](_0x76f303[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0x4706eb[_0x98ec('0x32')][_0x98ec('0x35')]));_0x2632f0[_0x98ec('0x36')]=_0x2632f0[_0x98ec('0x36')][_0x98ec('0x37')]?_0x2632f0['attributes']:_0x76f303[_0x98ec('0x31')];if(_0x4706eb[_0x98ec('0x32')][_0x98ec('0x43')]){_0x2632f0[_0x98ec('0x44')]=[{'all':!![]}];}_0x2632f0=_[_0x98ec('0x40')]({},_0x2632f0,_0x4706eb[_0x98ec('0x41')]);return db[_0x98ec('0x42')][_0x98ec('0x4a')](_0x2632f0)['then'](handleEntityNotFound(_0x157ca4,null))[_0x98ec('0x26')](respondWithResult(_0x157ca4,null))[_0x98ec('0x47')](handleError(_0x157ca4,null));};exports[_0x98ec('0x4b')]=function(_0xe3d0c0,_0x5f400a){return db[_0x98ec('0x42')][_0x98ec('0x4b')](_0xe3d0c0[_0x98ec('0x4c')],{})['then'](function(_0xb05521){var _0xddd8b=_0xe3d0c0[_0x98ec('0x4d')][_0x98ec('0x4e')]({'plain':!![]});if(!_0xddd8b)throw new Error(_0x98ec('0x4f'));if(_0xddd8b[_0x98ec('0x50')]===_0x98ec('0x4d')){var _0x1abd37=_0xb05521[_0x98ec('0x4e')]({'plain':!![]});var _0x486300=_0x98ec('0x28');return db[_0x98ec('0x51')]['find']({'where':{'name':_0x486300,'userProfileId':_0xddd8b['userProfileId']},'raw':!![]})[_0x98ec('0x26')](function(_0x16b666){if(_0x16b666&&_0x16b666['autoAssociation']===0x0){return db[_0x98ec('0x29')][_0x98ec('0x4b')]({'name':_0x1abd37[_0x98ec('0x2b')],'resourceId':_0x1abd37['id'],'type':_0x16b666[_0x98ec('0x2b')],'sectionId':_0x16b666['id']},{})[_0x98ec('0x26')](function(){return _0xb05521;});}else{return _0xb05521;}})[_0x98ec('0x47')](function(_0x5ace42){logger[_0x98ec('0x2a')](_0x98ec('0x52'),_0x5ace42);throw _0x5ace42;});}return _0xb05521;})['then'](respondWithResult(_0x5f400a,0xc9))[_0x98ec('0x47')](handleError(_0x5f400a,null));};exports[_0x98ec('0x53')]=function(_0x2de672,_0x476ea7){if(_0x2de672[_0x98ec('0x4c')]['id']){delete _0x2de672['body']['id'];}return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x2de672[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x476ea7,null))[_0x98ec('0x26')](saveUpdates(_0x2de672['body'],null))[_0x98ec('0x26')](respondWithResult(_0x476ea7,null))['catch'](handleError(_0x476ea7,null));};exports[_0x98ec('0x27')]=function(_0x7feda0,_0x4f9ee2){return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x7feda0[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x4f9ee2,null))['then'](removeEntity(_0x4f9ee2,null))[_0x98ec('0x47')](handleError(_0x4f9ee2,null));};exports['describe']=function(_0x21cdac,_0x51192e){return db['SmsQueue'][_0x98ec('0x55')]()['then'](respondWithResult(_0x51192e,null))[_0x98ec('0x47')](handleError(_0x51192e,null));};exports['getMembers']=function(_0x45dc07,_0x175975,_0x88f5de){var _0x4384f6={'raw':!![],'where':{}},_0x493d81={},_0x242b81;return db['SmsQueue'][_0x98ec('0x56')]({'where':{'id':_0x45dc07[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x175975,null))[_0x98ec('0x26')](function(_0x899795){if(_0x899795){_0x242b81=_0x899795[_0x98ec('0x4e')]({'plain':!![]});_0x493d81[_0x98ec('0x31')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x493d81[_0x98ec('0x32')]=_[_0x98ec('0x33')](_0x45dc07['query']);_0x493d81[_0x98ec('0x3d')]=_[_0x98ec('0x34')](_0x493d81[_0x98ec('0x31')],_0x493d81[_0x98ec('0x32')]);_0x4384f6[_0x98ec('0x36')]=_[_0x98ec('0x34')](_0x493d81['model'],qs[_0x98ec('0x35')](_0x45dc07['query']['fields']));_0x4384f6['attributes']=_0x4384f6[_0x98ec('0x36')]['length']?_0x4384f6[_0x98ec('0x36')]:_0x493d81[_0x98ec('0x31')];if(!_0x45dc07[_0x98ec('0x32')][_0x98ec('0x38')](_0x98ec('0x39'))){_0x4384f6[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0x45dc07[_0x98ec('0x32')][_0x98ec('0x22')]);_0x4384f6[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0x45dc07['query'][_0x98ec('0x21')]);}_0x4384f6[_0x98ec('0x3a')]=qs[_0x98ec('0x3b')](_0x45dc07['query'][_0x98ec('0x3b')]);_0x4384f6[_0x98ec('0x3c')]=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0x45dc07['query'],_0x493d81['filters']));_0x4384f6[_0x98ec('0x3c')][_0x98ec('0x57')]=_0x899795['id'];if(_0x45dc07[_0x98ec('0x32')]['filter']){_0x4384f6[_0x98ec('0x3c')]=_[_0x98ec('0x40')](_0x4384f6[_0x98ec('0x3c')],{'$or':_[_0x98ec('0x2e')](_0x4384f6[_0x98ec('0x36')],function(_0x50011a){var _0x59346d={};_0x59346d[_0x50011a]={'$like':'%'+_0x45dc07['query'][_0x98ec('0x3f')]+'%'};return _0x59346d;})});}_0x4384f6=_['merge']({},_0x4384f6,_0x45dc07['options']);return db[_0x98ec('0x58')][_0x98ec('0x45')](_0x4384f6);}})[_0x98ec('0x26')](function(_0x3390e5){if(_0x3390e5){return db[_0x98ec('0x59')][_0x98ec('0x5a')]({'where':{'id':_['map'](_0x3390e5,_0x98ec('0x5b')),'role':_0x98ec('0x5c')},'attributes':['id',_0x98ec('0x2b'),'smsPause',_0x98ec('0x5d'),_0x98ec('0x5e')]});}})[_0x98ec('0x26')](function(_0x550099){if(_0x550099){return{'count':_0x550099['count'],'rows':_[_0x98ec('0x2e')](_0x550099['rows'],function(_0x4ef76f){return{'membername':_0x4ef76f[_0x98ec('0x2b')],'UserId':_0x4ef76f['id'],'queue_name':_0x242b81[_0x98ec('0x2b')],'SmsQueueId':_0x242b81['id'],'interface':util[_0x98ec('0x5f')](_0x98ec('0x60'),_0x98ec('0x61'),_0x4ef76f[_0x98ec('0x2b')]),'penalty':0x0,'paused':_0x4ef76f['smsPause'],'createdAt':_0x4ef76f[_0x98ec('0x5e')],'updatedAt':_0x4ef76f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x175975,_0x4384f6))[_0x98ec('0x47')](handleError(_0x175975,null));};exports[_0x98ec('0x62')]=function(_0x42fb21,_0x199ec0,_0x4d431c){var _0xa922f4={};var _0x326212={};var _0x5028d7;var _0x224305;return db[_0x98ec('0x42')]['findOne']({'where':{'id':_0x42fb21[_0x98ec('0x54')]['id']}})['then'](handleEntityNotFound(_0x199ec0,null))[_0x98ec('0x26')](function(_0x5eb83b){if(_0x5eb83b){_0x5028d7=_0x5eb83b;_0x326212[_0x98ec('0x31')]=_[_0x98ec('0x33')](db[_0x98ec('0x63')][_0x98ec('0x49')]);_0x326212[_0x98ec('0x32')]=_[_0x98ec('0x33')](_0x42fb21['query']);_0x326212['filters']=_[_0x98ec('0x34')](_0x326212[_0x98ec('0x31')],_0x326212[_0x98ec('0x32')]);_0xa922f4[_0x98ec('0x36')]=_[_0x98ec('0x34')](_0x326212[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x35')]));_0xa922f4['attributes']=_0xa922f4['attributes']['length']?_0xa922f4[_0x98ec('0x36')]:_0x326212['model'];_0xa922f4['order']=qs[_0x98ec('0x3b')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x3b')]);_0xa922f4[_0x98ec('0x3c')]=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0x42fb21[_0x98ec('0x32')],_0x326212[_0x98ec('0x3d')]));if(_0x42fb21[_0x98ec('0x32')][_0x98ec('0x3f')]){_0xa922f4['where']=_['merge'](_0xa922f4['where'],{'$or':_[_0x98ec('0x2e')](_0xa922f4['attributes'],function(_0x4db556){var _0x454c69={};_0x454c69[_0x4db556]={'$like':'%'+_0x42fb21[_0x98ec('0x32')][_0x98ec('0x3f')]+'%'};return _0x454c69;})});}_0xa922f4=_[_0x98ec('0x40')]({},_0xa922f4,_0x42fb21[_0x98ec('0x41')]);return _0x5028d7[_0x98ec('0x62')](_0xa922f4);}})[_0x98ec('0x26')](function(_0x35ea4d){if(_0x35ea4d){_0x224305=_0x35ea4d[_0x98ec('0x37')];if(!_0x42fb21[_0x98ec('0x32')][_0x98ec('0x38')](_0x98ec('0x39'))){_0xa922f4[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x22')]);_0xa922f4[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x21')]);}return _0x5028d7[_0x98ec('0x62')](_0xa922f4);}})[_0x98ec('0x26')](function(_0x4cbb6a){if(_0x4cbb6a){return _0x4cbb6a?{'count':_0x224305,'rows':_0x4cbb6a}:null;}})[_0x98ec('0x26')](respondWithResult(_0x199ec0,null))[_0x98ec('0x47')](handleError(_0x199ec0,null));};exports['addTeams']=function(_0x3b35ad,_0x15e2f1,_0x554442){var _0x1ddd8f=_0x3b35ad['body'][_0x98ec('0x64')];return db[_0x98ec('0x63')][_0x98ec('0x45')]({'where':{'id':_0x1ddd8f},'attributes':['id'],'include':[{'model':db[_0x98ec('0x59')],'as':_0x98ec('0x65'),'attributes':['id',_0x98ec('0x2b'),_0x98ec('0x66'),_0x98ec('0x67'),_0x98ec('0x68')],'raw':!![]}]})['then'](function(_0x15d838){if(_0x15d838){var _0x23068c=_[_0x98ec('0x69')](_0x15d838,function(_0x3b565a){var _0x32d8da=_0x3b565a['get']({'plain':!![]});return _0x32d8da[_0x98ec('0x65')];});return db[_0x98ec('0x42')]['find']({'where':{'id':_0x3b35ad[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](function(_0x2a83bb){return db[_0x98ec('0x6a')][_0x98ec('0x6b')](function(_0x2702d5){return _0x2a83bb[_0x98ec('0x6c')](_0x1ddd8f,{'transaction':_0x2702d5})[_0x98ec('0x26')](function(){return BPromise[_0x98ec('0x6d')](_0x23068c,function(_0x378546){return db[_0x98ec('0x58')][_0x98ec('0x6e')]({'where':{'UserId':_0x378546['id'],'SmsQueueId':_0x3b35ad[_0x98ec('0x54')]['id']},'transaction':_0x2702d5});});})['then'](function(){_0x23068c[_0x98ec('0x6f')](function(_0x37633d){socket[_0x98ec('0x70')](_0x98ec('0x71'),{'UserId':_0x37633d['id'],'SmsQueueId':_0x2a83bb['id']});});});});});}})['then'](respondWithStatusCode(_0x15e2f1,null))[_0x98ec('0x47')](handleError(_0x15e2f1,null));};exports[_0x98ec('0x72')]=function(_0x52c3bb,_0xeb94b9,_0x5f0f47){return db['Team'][_0x98ec('0x45')]({'where':{'id':_0x52c3bb['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x98ec('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x98ec('0x26')](handleEntityNotFound(_0xeb94b9,null))[_0x98ec('0x26')](function(_0x1d3b6d){var _0x484d1b=_[_0x98ec('0x2e')](_0x1d3b6d,'id');var _0x17aa0a=[];var _0x388eb4=[];var _0x402618=squel[_0x98ec('0x73')]();_0x402618[_0x98ec('0x74')](_0x98ec('0x75'))['from'](_0x98ec('0x76'),'tq')[_0x98ec('0x77')](_0x98ec('0x78'),'ut',_0x98ec('0x79'))[_0x98ec('0x3c')](_0x98ec('0x7a'),_0x52c3bb['params']['id']);for(var _0xa00155=0x0;_0xa00155<_0x1d3b6d[_0x98ec('0x37')];_0xa00155+=0x1){let _0x2143e8=_0x1d3b6d[_0xa00155];for(var _0x272211=0x0;_0x272211<_0x2143e8[_0x98ec('0x65')][_0x98ec('0x37')];_0x272211+=0x1){let _0x519b8d=_0x2143e8[_0x98ec('0x65')][_0x272211];var _0x38fbe0=_0x402618[_0x98ec('0x7b')]();_0x38fbe0[_0x98ec('0x3c')](_0x98ec('0x7c'),_0x519b8d['id']);_0x388eb4['push'](db[_0x98ec('0x6a')]['query'](_0x38fbe0[_0x98ec('0x7d')](),{'type':db['sequelize'][_0x98ec('0x7e')][_0x98ec('0x7f')]})[_0x98ec('0x26')](function(_0x566234){if(_0x566234[_0x98ec('0x37')]===0x1){return _0x519b8d['id'];}else{var _0x3c2606=_['every'](_[_0x98ec('0x2e')](_0x566234,_0x98ec('0x80')),function(_0x4c14df){return _[_0x98ec('0x81')](_0x484d1b,_0x4c14df);});if(_0x3c2606){return _0x519b8d['id'];}}}));}}return BPromise[_0x98ec('0x82')](_0x388eb4)[_0x98ec('0x26')](function(_0xc67385){_0x17aa0a=_(_0x17aa0a)[_0x98ec('0x83')](_0xc67385)[_0x98ec('0x84')]()[_0x98ec('0x85')]();return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x52c3bb[_0x98ec('0x54')]['id']}})['then'](function(_0x58fba5){return db['sequelize'][_0x98ec('0x6b')](function(_0x52f2c8){return _0x58fba5[_0x98ec('0x72')](_0x52c3bb[_0x98ec('0x32')][_0x98ec('0x64')],{'transaction':_0x52f2c8})[_0x98ec('0x26')](function(){if(!_[_0x98ec('0x86')](_0x17aa0a)){return _0x58fba5[_0x98ec('0x87')](_0x17aa0a,{'transaction':_0x52f2c8});}})[_0x98ec('0x26')](function(){_0x17aa0a['forEach'](function(_0x4c5646){socket[_0x98ec('0x70')](_0x98ec('0x88'),{'UserId':_0x4c5646,'SmsQueueId':_0x58fba5['id']});});});});});});})[_0x98ec('0x26')](respondWithStatusCode(_0xeb94b9,null))[_0x98ec('0x47')](handleError(_0xeb94b9,null));};exports[_0x98ec('0x89')]=function(_0x148e16,_0x5aacc3,_0x35eec2){return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x148e16[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x5aacc3,null))[_0x98ec('0x26')](function(_0x1c5085){if(_0x1c5085){return _0x1c5085[_0x98ec('0x89')](_0x148e16[_0x98ec('0x4c')]['ids'],_['omit'](_0x148e16[_0x98ec('0x4c')],[_0x98ec('0x64'),'id'])||{})['spread'](function(_0x8d5d10){for(var _0x2d1d6d=0x0;_0x2d1d6d<_0x148e16[_0x98ec('0x4c')][_0x98ec('0x64')][_0x98ec('0x37')];_0x2d1d6d+=0x1){socket[_0x98ec('0x70')](_0x98ec('0x71'),{'UserId':_0x148e16['body']['ids'][_0x2d1d6d],'SmsQueueId':_0x148e16[_0x98ec('0x54')]['id']});}return _0x8d5d10;});}})[_0x98ec('0x26')](respondWithResult(_0x5aacc3,null))[_0x98ec('0x47')](handleError(_0x5aacc3,null));};exports[_0x98ec('0x87')]=function(_0x4ced71,_0x3daafc,_0x2972f2){return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x4ced71['params']['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x3daafc,null))[_0x98ec('0x26')](function(_0x52f3ee){if(_0x52f3ee){return _0x52f3ee[_0x98ec('0x87')](_0x4ced71['query'][_0x98ec('0x64')])[_0x98ec('0x26')](function(){if(_[_0x98ec('0x8a')](_0x4ced71['query'][_0x98ec('0x64')])){for(var _0x3323fc=0x0;_0x3323fc<_0x4ced71['query'][_0x98ec('0x64')][_0x98ec('0x37')];_0x3323fc+=0x1){socket[_0x98ec('0x70')](_0x98ec('0x88'),{'UserId':Number(_0x4ced71[_0x98ec('0x32')][_0x98ec('0x64')][_0x3323fc]),'SmsQueueId':Number(_0x4ced71['params']['id'])});}}else{socket[_0x98ec('0x70')](_0x98ec('0x88'),{'UserId':Number(_0x4ced71[_0x98ec('0x32')][_0x98ec('0x64')]),'SmsQueueId':Number(_0x4ced71[_0x98ec('0x54')]['id'])});}});}})[_0x98ec('0x26')](respondWithStatusCode(_0x3daafc,null))[_0x98ec('0x47')](handleError(_0x3daafc,null));};exports[_0x98ec('0x8b')]=function(_0x13207a,_0x249c39,_0x126015){var _0x10879a={};var _0x129208={};var _0x4c9d5a;var _0x2244aa;return db[_0x98ec('0x42')][_0x98ec('0x56')]({'where':{'id':_0x13207a[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x249c39,null))['then'](function(_0x5810fe){if(_0x5810fe){_0x4c9d5a=_0x5810fe;_0x129208['model']=_[_0x98ec('0x33')](db['User'][_0x98ec('0x49')]);_0x129208[_0x98ec('0x32')]=_['keys'](_0x13207a[_0x98ec('0x32')]);_0x129208[_0x98ec('0x3d')]=_[_0x98ec('0x34')](_0x129208[_0x98ec('0x31')],_0x129208[_0x98ec('0x32')]);_0x10879a[_0x98ec('0x36')]=_['intersection'](_0x129208[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0x13207a[_0x98ec('0x32')][_0x98ec('0x35')]));_0x10879a[_0x98ec('0x36')]=_0x10879a[_0x98ec('0x36')][_0x98ec('0x37')]?_0x10879a[_0x98ec('0x36')]:_0x129208[_0x98ec('0x31')];_0x10879a[_0x98ec('0x3a')]=qs[_0x98ec('0x3b')](_0x13207a[_0x98ec('0x32')][_0x98ec('0x3b')]);_0x10879a['where']=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0x13207a[_0x98ec('0x32')],_0x129208[_0x98ec('0x3d')]));if(_0x13207a['query'][_0x98ec('0x3f')]){_0x10879a[_0x98ec('0x3c')]=_[_0x98ec('0x40')](_0x10879a[_0x98ec('0x3c')],{'$or':_[_0x98ec('0x2e')](_0x10879a[_0x98ec('0x36')],function(_0x510c10){var _0x3a61d4={};_0x3a61d4[_0x510c10]={'$like':'%'+_0x13207a[_0x98ec('0x32')][_0x98ec('0x3f')]+'%'};return _0x3a61d4;})});}_0x10879a=_[_0x98ec('0x40')]({},_0x10879a,_0x13207a[_0x98ec('0x41')]);return _0x4c9d5a[_0x98ec('0x8b')](_0x10879a);}})[_0x98ec('0x26')](function(_0x5513bc){if(_0x5513bc){_0x2244aa=_0x5513bc[_0x98ec('0x37')];if(!_0x13207a[_0x98ec('0x32')][_0x98ec('0x38')]('nolimit')){_0x10879a[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0x13207a['query'][_0x98ec('0x22')]);_0x10879a[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0x13207a['query'][_0x98ec('0x21')]);}return _0x4c9d5a[_0x98ec('0x8b')](_0x10879a);}})[_0x98ec('0x26')](function(_0x53fa7c){if(_0x53fa7c){return _0x53fa7c?{'count':_0x2244aa,'rows':_0x53fa7c}:null;}})[_0x98ec('0x26')](respondWithResult(_0x249c39,null))[_0x98ec('0x47')](handleError(_0x249c39,null));}; \ No newline at end of file +var _0x1e3a=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./smsQueue.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','params','length','nolimit','UserSmsQueue','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','Team','sort','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','removeTeams','emit','addAgents','omit','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x229532,_0x1c0e67){var _0x598c8a=function(_0x3e25ac){while(--_0x3e25ac){_0x229532['push'](_0x229532['shift']());}};_0x598c8a(++_0x1c0e67);}(_0x1e3a,0x10a));var _0xa1e3=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x1e3a[_0x32f9ca];return _0x52e083;};'use strict';var pdf=require(_0xa1e3('0x0'));var emlformat=require(_0xa1e3('0x1'));var rimraf=require(_0xa1e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1e3('0x3'));var rp=require(_0xa1e3('0x4'));var moment=require(_0xa1e3('0x5'));var BPromise=require(_0xa1e3('0x6'));var Mustache=require(_0xa1e3('0x7'));var util=require('util');var path=require(_0xa1e3('0x8'));var sox=require(_0xa1e3('0x9'));var csv=require(_0xa1e3('0xa'));var ejs=require(_0xa1e3('0xb'));var fs=require('fs');var _=require(_0xa1e3('0xc'));var squel=require(_0xa1e3('0xd'));var crypto=require(_0xa1e3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa1e3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa1e3('0x10'));var Papa=require(_0xa1e3('0x11'));var Redis=require('ioredis');var authService=require(_0xa1e3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa1e3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1e3('0x14'))(_0xa1e3('0x15'));var utils=require('../../config/utils');var config=require(_0xa1e3('0x16'));var db=require(_0xa1e3('0x17'))['db'];config['redis']=_[_0xa1e3('0x18')](config['redis'],{'host':_0xa1e3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1e3('0x1a')]));require(_0xa1e3('0x1b'))['register'](socket);function respondWithStatusCode(_0x8efd4f,_0x35a350){_0x35a350=_0x35a350||0xcc;return function(_0xe6ab65){if(_0xe6ab65){return _0x8efd4f[_0xa1e3('0x1c')](_0x35a350);}return _0x8efd4f[_0xa1e3('0x1d')](_0x35a350)[_0xa1e3('0x1e')]();};}function respondWithResult(_0x16c28a,_0x480541){_0x480541=_0x480541||0xc8;return function(_0x3b1eb8){if(_0x3b1eb8){return _0x16c28a[_0xa1e3('0x1d')](_0x480541)[_0xa1e3('0x1f')](_0x3b1eb8);}};}function respondWithFilteredResult(_0x35aa23,_0x589682){return function(_0x4e6ee1){if(_0x4e6ee1){var _0x36c4cd=_0x4e6ee1['count'],_0x49b9c1=_0x589682['offset'],_0xacce3d=_0x589682[_0xa1e3('0x20')]+_0x589682[_0xa1e3('0x21')],_0x523969;if(_0xacce3d>=_0x36c4cd){_0xacce3d=_0x36c4cd;_0x523969=0xc8;}else{_0x523969=0xce;}_0x35aa23[_0xa1e3('0x1d')](_0x523969);return _0x35aa23[_0xa1e3('0x22')](_0xa1e3('0x23'),_0x49b9c1+'-'+_0xacce3d+'/'+_0x36c4cd)[_0xa1e3('0x1f')](_0x4e6ee1);}return null;};}function patchUpdates(_0xb92fcc){return function(_0x376a4d){try{jsonpatch['apply'](_0x376a4d,_0xb92fcc,!![]);}catch(_0x5ba33b){return BPromise[_0xa1e3('0x24')](_0x5ba33b);}return _0x376a4d[_0xa1e3('0x25')]();};}function saveUpdates(_0x996d95,_0x304d4d){return function(_0x4186f8){if(_0x4186f8){return _0x4186f8[_0xa1e3('0x26')](_0x996d95)[_0xa1e3('0x27')](function(_0x1daec4){return _0x1daec4;});}return null;};}function removeEntity(_0x34bea7,_0x55950d){return function(_0x119618){if(_0x119618){return _0x119618[_0xa1e3('0x28')]()[_0xa1e3('0x27')](function(){var _0x8bd669=_0x119618[_0xa1e3('0x29')]({'plain':!![]});var _0x15273a='SmsQueues';return db[_0xa1e3('0x2a')][_0xa1e3('0x28')]({'where':{'type':_0x15273a,'resourceId':_0x8bd669['id']}})[_0xa1e3('0x27')](function(){return _0x119618;});})[_0xa1e3('0x27')](function(){_0x34bea7[_0xa1e3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2beedf,_0x2314f9){return function(_0x1ab284){if(!_0x1ab284){_0x2beedf['sendStatus'](0x194);}return _0x1ab284;};}function handleError(_0x4cd214,_0x1025c5){_0x1025c5=_0x1025c5||0x1f4;return function(_0x3b8583){logger[_0xa1e3('0x2b')](_0x3b8583[_0xa1e3('0x2c')]);if(_0x3b8583[_0xa1e3('0x2d')]){delete _0x3b8583[_0xa1e3('0x2d')];}_0x4cd214[_0xa1e3('0x1d')](_0x1025c5)[_0xa1e3('0x2e')](_0x3b8583);};}exports[_0xa1e3('0x2f')]=function(_0x1d98bb,_0x1fefd8){var _0x56175c={},_0x1da712={},_0x57a2ea={'count':0x0,'rows':[]};var _0x5b3bb6=_[_0xa1e3('0x30')](db[_0xa1e3('0x31')][_0xa1e3('0x32')],function(_0x59af4b){return{'name':_0x59af4b[_0xa1e3('0x33')],'type':_0x59af4b[_0xa1e3('0x34')][_0xa1e3('0x35')]};});_0x1da712[_0xa1e3('0x36')]=_[_0xa1e3('0x30')](_0x5b3bb6,_0xa1e3('0x2d'));_0x1da712[_0xa1e3('0x37')]=_[_0xa1e3('0x38')](_0x1d98bb[_0xa1e3('0x37')]);_0x1da712[_0xa1e3('0x39')]=_[_0xa1e3('0x3a')](_0x1da712[_0xa1e3('0x36')],_0x1da712[_0xa1e3('0x37')]);_0x56175c[_0xa1e3('0x3b')]=_[_0xa1e3('0x3a')](_0x1da712['model'],qs['fields'](_0x1d98bb['query'][_0xa1e3('0x3c')]));_0x56175c[_0xa1e3('0x3b')]=_0x56175c['attributes']['length']?_0x56175c[_0xa1e3('0x3b')]:_0x1da712['model'];if(!_0x1d98bb['query'][_0xa1e3('0x3d')]('nolimit')){_0x56175c[_0xa1e3('0x21')]=qs[_0xa1e3('0x21')](_0x1d98bb[_0xa1e3('0x37')][_0xa1e3('0x21')]);_0x56175c[_0xa1e3('0x20')]=qs['offset'](_0x1d98bb[_0xa1e3('0x37')][_0xa1e3('0x20')]);}_0x56175c[_0xa1e3('0x3e')]=qs['sort'](_0x1d98bb[_0xa1e3('0x37')]['sort']);_0x56175c[_0xa1e3('0x3f')]=qs[_0xa1e3('0x39')](_[_0xa1e3('0x40')](_0x1d98bb[_0xa1e3('0x37')],_0x1da712[_0xa1e3('0x39')]),_0x5b3bb6);if(_0x1d98bb[_0xa1e3('0x37')][_0xa1e3('0x41')]){_0x56175c['where']=_[_0xa1e3('0x42')](_0x56175c[_0xa1e3('0x3f')],{'$or':_[_0xa1e3('0x30')](_0x5b3bb6,function(_0x53bd18){if(_0x53bd18[_0xa1e3('0x34')]!==_0xa1e3('0x43')){var _0x1a19d3={};_0x1a19d3[_0x53bd18[_0xa1e3('0x2d')]]={'$like':'%'+_0x1d98bb['query'][_0xa1e3('0x41')]+'%'};return _0x1a19d3;}})});}_0x56175c=_[_0xa1e3('0x42')]({},_0x56175c,_0x1d98bb['options']);var _0x18c5ee={'where':_0x56175c['where']};return db[_0xa1e3('0x31')]['count'](_0x18c5ee)[_0xa1e3('0x27')](function(_0x5de425){_0x57a2ea[_0xa1e3('0x44')]=_0x5de425;if(_0x1d98bb['query']['includeAll']){_0x56175c['include']=[{'all':!![]}];}return db[_0xa1e3('0x31')][_0xa1e3('0x45')](_0x56175c);})['then'](function(_0x3328a1){_0x57a2ea[_0xa1e3('0x46')]=_0x3328a1;return _0x57a2ea;})['then'](respondWithFilteredResult(_0x1fefd8,_0x56175c))[_0xa1e3('0x47')](handleError(_0x1fefd8,null));};exports[_0xa1e3('0x48')]=function(_0xeca170,_0x4df734){var _0x555d8a={'raw':!![],'where':{'id':_0xeca170['params']['id']}},_0x19e746={};_0x19e746[_0xa1e3('0x36')]=_['keys'](db['SmsQueue'][_0xa1e3('0x32')]);_0x19e746[_0xa1e3('0x37')]=_[_0xa1e3('0x38')](_0xeca170[_0xa1e3('0x37')]);_0x19e746[_0xa1e3('0x39')]=_[_0xa1e3('0x3a')](_0x19e746['model'],_0x19e746[_0xa1e3('0x37')]);_0x555d8a['attributes']=_['intersection'](_0x19e746[_0xa1e3('0x36')],qs[_0xa1e3('0x3c')](_0xeca170[_0xa1e3('0x37')][_0xa1e3('0x3c')]));_0x555d8a[_0xa1e3('0x3b')]=_0x555d8a[_0xa1e3('0x3b')]['length']?_0x555d8a[_0xa1e3('0x3b')]:_0x19e746[_0xa1e3('0x36')];if(_0xeca170[_0xa1e3('0x37')][_0xa1e3('0x49')]){_0x555d8a['include']=[{'all':!![]}];}_0x555d8a=_[_0xa1e3('0x42')]({},_0x555d8a,_0xeca170[_0xa1e3('0x4a')]);return db[_0xa1e3('0x31')][_0xa1e3('0x4b')](_0x555d8a)[_0xa1e3('0x27')](handleEntityNotFound(_0x4df734,null))[_0xa1e3('0x27')](respondWithResult(_0x4df734,null))['catch'](handleError(_0x4df734,null));};exports[_0xa1e3('0x4c')]=function(_0x5dcf38,_0x6e4b12){return db['SmsQueue']['create'](_0x5dcf38['body'],{})[_0xa1e3('0x27')](function(_0x2e518f){var _0x272fb6=_0x5dcf38[_0xa1e3('0x4d')][_0xa1e3('0x29')]({'plain':!![]});if(!_0x272fb6)throw new Error(_0xa1e3('0x4e'));if(_0x272fb6[_0xa1e3('0x4f')]==='user'){var _0x30fb4a=_0x2e518f[_0xa1e3('0x29')]({'plain':!![]});var _0x35d346=_0xa1e3('0x50');return db[_0xa1e3('0x51')][_0xa1e3('0x4b')]({'where':{'name':_0x35d346,'userProfileId':_0x272fb6['userProfileId']},'raw':!![]})[_0xa1e3('0x27')](function(_0x990c82){if(_0x990c82&&_0x990c82[_0xa1e3('0x52')]===0x0){return db[_0xa1e3('0x2a')][_0xa1e3('0x4c')]({'name':_0x30fb4a[_0xa1e3('0x2d')],'resourceId':_0x30fb4a['id'],'type':_0x990c82[_0xa1e3('0x2d')],'sectionId':_0x990c82['id']},{})[_0xa1e3('0x27')](function(){return _0x2e518f;});}else{return _0x2e518f;}})['catch'](function(_0x332ac8){logger['error'](_0xa1e3('0x53'),_0x332ac8);throw _0x332ac8;});}return _0x2e518f;})['then'](respondWithResult(_0x6e4b12,0xc9))['catch'](handleError(_0x6e4b12,null));};exports[_0xa1e3('0x26')]=function(_0x20da2c,_0x173d2c){if(_0x20da2c[_0xa1e3('0x54')]['id']){delete _0x20da2c[_0xa1e3('0x54')]['id'];}return db[_0xa1e3('0x31')][_0xa1e3('0x4b')]({'where':{'id':_0x20da2c['params']['id']}})[_0xa1e3('0x27')](handleEntityNotFound(_0x173d2c,null))['then'](saveUpdates(_0x20da2c[_0xa1e3('0x54')],null))[_0xa1e3('0x27')](respondWithResult(_0x173d2c,null))[_0xa1e3('0x47')](handleError(_0x173d2c,null));};exports[_0xa1e3('0x28')]=function(_0x3f83f3,_0x590915){return db[_0xa1e3('0x31')]['find']({'where':{'id':_0x3f83f3['params']['id']}})[_0xa1e3('0x27')](handleEntityNotFound(_0x590915,null))[_0xa1e3('0x27')](removeEntity(_0x590915,null))[_0xa1e3('0x47')](handleError(_0x590915,null));};exports[_0xa1e3('0x55')]=function(_0x1018cc,_0x4787af){return db[_0xa1e3('0x31')][_0xa1e3('0x55')]()[_0xa1e3('0x27')](respondWithResult(_0x4787af,null))['catch'](handleError(_0x4787af,null));};exports[_0xa1e3('0x56')]=function(_0x19ea2b,_0x3750c2,_0x30bac7){var _0x3a4a12={'raw':!![],'where':{}},_0x8d829b={},_0x14338c;return db[_0xa1e3('0x31')][_0xa1e3('0x57')]({'where':{'id':_0x19ea2b[_0xa1e3('0x58')]['id']}})[_0xa1e3('0x27')](handleEntityNotFound(_0x3750c2,null))[_0xa1e3('0x27')](function(_0x32e5c2){if(_0x32e5c2){_0x14338c=_0x32e5c2[_0xa1e3('0x29')]({'plain':!![]});_0x8d829b['model']=_['keys'](db['UserSmsQueue'][_0xa1e3('0x32')]);_0x8d829b[_0xa1e3('0x37')]=_['keys'](_0x19ea2b[_0xa1e3('0x37')]);_0x8d829b[_0xa1e3('0x39')]=_[_0xa1e3('0x3a')](_0x8d829b[_0xa1e3('0x36')],_0x8d829b[_0xa1e3('0x37')]);_0x3a4a12['attributes']=_[_0xa1e3('0x3a')](_0x8d829b[_0xa1e3('0x36')],qs[_0xa1e3('0x3c')](_0x19ea2b[_0xa1e3('0x37')][_0xa1e3('0x3c')]));_0x3a4a12[_0xa1e3('0x3b')]=_0x3a4a12[_0xa1e3('0x3b')][_0xa1e3('0x59')]?_0x3a4a12['attributes']:_0x8d829b[_0xa1e3('0x36')];if(!_0x19ea2b['query']['hasOwnProperty'](_0xa1e3('0x5a'))){_0x3a4a12[_0xa1e3('0x21')]=qs[_0xa1e3('0x21')](_0x19ea2b[_0xa1e3('0x37')][_0xa1e3('0x21')]);_0x3a4a12[_0xa1e3('0x20')]=qs[_0xa1e3('0x20')](_0x19ea2b[_0xa1e3('0x37')][_0xa1e3('0x20')]);}_0x3a4a12[_0xa1e3('0x3e')]=qs['sort'](_0x19ea2b[_0xa1e3('0x37')]['sort']);_0x3a4a12[_0xa1e3('0x3f')]=qs[_0xa1e3('0x39')](_[_0xa1e3('0x40')](_0x19ea2b[_0xa1e3('0x37')],_0x8d829b['filters']));_0x3a4a12['where']['SmsQueueId']=_0x32e5c2['id'];if(_0x19ea2b['query'][_0xa1e3('0x41')]){_0x3a4a12[_0xa1e3('0x3f')]=_[_0xa1e3('0x42')](_0x3a4a12[_0xa1e3('0x3f')],{'$or':_['map'](_0x3a4a12[_0xa1e3('0x3b')],function(_0x17ff3c){var _0x1bf3b5={};_0x1bf3b5[_0x17ff3c]={'$like':'%'+_0x19ea2b[_0xa1e3('0x37')][_0xa1e3('0x41')]+'%'};return _0x1bf3b5;})});}_0x3a4a12=_[_0xa1e3('0x42')]({},_0x3a4a12,_0x19ea2b['options']);return db[_0xa1e3('0x5b')]['findAll'](_0x3a4a12);}})[_0xa1e3('0x27')](function(_0x429d1b){if(_0x429d1b){return db['User'][_0xa1e3('0x5c')]({'where':{'id':_[_0xa1e3('0x30')](_0x429d1b,_0xa1e3('0x5d')),'role':_0xa1e3('0x5e')},'attributes':['id',_0xa1e3('0x2d'),_0xa1e3('0x5f'),_0xa1e3('0x60'),_0xa1e3('0x61')]});}})[_0xa1e3('0x27')](function(_0x43dab0){if(_0x43dab0){return{'count':_0x43dab0[_0xa1e3('0x44')],'rows':_[_0xa1e3('0x30')](_0x43dab0[_0xa1e3('0x46')],function(_0x4a7bd2){return{'membername':_0x4a7bd2[_0xa1e3('0x2d')],'UserId':_0x4a7bd2['id'],'queue_name':_0x14338c[_0xa1e3('0x2d')],'SmsQueueId':_0x14338c['id'],'interface':util['format'](_0xa1e3('0x62'),'SIP',_0x4a7bd2['name']),'penalty':0x0,'paused':_0x4a7bd2[_0xa1e3('0x5f')],'createdAt':_0x4a7bd2[_0xa1e3('0x61')],'updatedAt':_0x4a7bd2[_0xa1e3('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3750c2,_0x3a4a12))['catch'](handleError(_0x3750c2,null));};exports[_0xa1e3('0x63')]=function(_0x234b68,_0xe6c5e2,_0x3ba01b){var _0x4c214f={};var _0x145a72={};var _0x2fef43;var _0x33318a;return db[_0xa1e3('0x31')][_0xa1e3('0x57')]({'where':{'id':_0x234b68[_0xa1e3('0x58')]['id']}})['then'](handleEntityNotFound(_0xe6c5e2,null))[_0xa1e3('0x27')](function(_0x56de13){if(_0x56de13){_0x2fef43=_0x56de13;_0x145a72['model']=_[_0xa1e3('0x38')](db[_0xa1e3('0x64')]['rawAttributes']);_0x145a72['query']=_[_0xa1e3('0x38')](_0x234b68['query']);_0x145a72[_0xa1e3('0x39')]=_[_0xa1e3('0x3a')](_0x145a72['model'],_0x145a72[_0xa1e3('0x37')]);_0x4c214f[_0xa1e3('0x3b')]=_[_0xa1e3('0x3a')](_0x145a72[_0xa1e3('0x36')],qs[_0xa1e3('0x3c')](_0x234b68[_0xa1e3('0x37')][_0xa1e3('0x3c')]));_0x4c214f[_0xa1e3('0x3b')]=_0x4c214f[_0xa1e3('0x3b')][_0xa1e3('0x59')]?_0x4c214f[_0xa1e3('0x3b')]:_0x145a72[_0xa1e3('0x36')];_0x4c214f[_0xa1e3('0x3e')]=qs[_0xa1e3('0x65')](_0x234b68[_0xa1e3('0x37')][_0xa1e3('0x65')]);_0x4c214f['where']=qs[_0xa1e3('0x39')](_['pick'](_0x234b68['query'],_0x145a72[_0xa1e3('0x39')]));if(_0x234b68[_0xa1e3('0x37')][_0xa1e3('0x41')]){_0x4c214f[_0xa1e3('0x3f')]=_[_0xa1e3('0x42')](_0x4c214f[_0xa1e3('0x3f')],{'$or':_[_0xa1e3('0x30')](_0x4c214f[_0xa1e3('0x3b')],function(_0x3a727){var _0x2e92aa={};_0x2e92aa[_0x3a727]={'$like':'%'+_0x234b68[_0xa1e3('0x37')][_0xa1e3('0x41')]+'%'};return _0x2e92aa;})});}_0x4c214f=_['merge']({},_0x4c214f,_0x234b68[_0xa1e3('0x4a')]);return _0x2fef43['getTeams'](_0x4c214f);}})[_0xa1e3('0x27')](function(_0x28e7b2){if(_0x28e7b2){_0x33318a=_0x28e7b2[_0xa1e3('0x59')];if(!_0x234b68[_0xa1e3('0x37')][_0xa1e3('0x3d')](_0xa1e3('0x5a'))){_0x4c214f['limit']=qs['limit'](_0x234b68[_0xa1e3('0x37')][_0xa1e3('0x21')]);_0x4c214f['offset']=qs[_0xa1e3('0x20')](_0x234b68[_0xa1e3('0x37')]['offset']);}return _0x2fef43[_0xa1e3('0x63')](_0x4c214f);}})[_0xa1e3('0x27')](function(_0x22d37c){if(_0x22d37c){return _0x22d37c?{'count':_0x33318a,'rows':_0x22d37c}:null;}})['then'](respondWithResult(_0xe6c5e2,null))['catch'](handleError(_0xe6c5e2,null));};exports[_0xa1e3('0x66')]=function(_0x3bbe6e,_0x1bfe0a,_0x2a4111){var _0x2545f0=_0x3bbe6e[_0xa1e3('0x54')][_0xa1e3('0x67')];return db['Team'][_0xa1e3('0x45')]({'where':{'id':_0x2545f0},'attributes':['id'],'include':[{'model':db[_0xa1e3('0x68')],'as':_0xa1e3('0x69'),'attributes':['id',_0xa1e3('0x2d'),_0xa1e3('0x6a'),_0xa1e3('0x6b'),_0xa1e3('0x6c')],'raw':!![]}]})[_0xa1e3('0x27')](function(_0x54fb0b){if(_0x54fb0b){var _0x4ff891=_[_0xa1e3('0x6d')](_0x54fb0b,function(_0x57f300){var _0x2212eb=_0x57f300['get']({'plain':!![]});return _0x2212eb[_0xa1e3('0x69')];});return db[_0xa1e3('0x31')][_0xa1e3('0x4b')]({'where':{'id':_0x3bbe6e[_0xa1e3('0x58')]['id']}})[_0xa1e3('0x27')](function(_0x165cc4){return db[_0xa1e3('0x6e')][_0xa1e3('0x6f')](function(_0x43d8de){return _0x165cc4[_0xa1e3('0x66')](_0x2545f0,{'transaction':_0x43d8de})[_0xa1e3('0x27')](function(){return BPromise[_0xa1e3('0x70')](_0x4ff891,function(_0x1711bc){return db[_0xa1e3('0x5b')]['findOrCreate']({'where':{'UserId':_0x1711bc['id'],'SmsQueueId':_0x3bbe6e[_0xa1e3('0x58')]['id']},'transaction':_0x43d8de});});})['then'](function(){_0x4ff891[_0xa1e3('0x71')](function(_0x17ea19){socket['emit']('userSmsQueue:save',{'UserId':_0x17ea19['id'],'SmsQueueId':_0x165cc4['id']});});});});});}})[_0xa1e3('0x27')](respondWithStatusCode(_0x1bfe0a,null))[_0xa1e3('0x47')](handleError(_0x1bfe0a,null));};exports['removeTeams']=function(_0xa5d05a,_0x4710aa,_0x278af4){return db[_0xa1e3('0x64')][_0xa1e3('0x45')]({'where':{'id':_0xa5d05a['query'][_0xa1e3('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa1e3('0x69'),'attributes':['id'],'raw':!![]}]})[_0xa1e3('0x27')](handleEntityNotFound(_0x4710aa,null))['then'](function(_0x510014){var _0x46a383=_['map'](_0x510014,'id');var _0x487b43=[];var _0x33fc9d=[];var _0x139e57=squel[_0xa1e3('0x72')]();_0x139e57[_0xa1e3('0x73')](_0xa1e3('0x74'))[_0xa1e3('0x75')](_0xa1e3('0x76'),'tq')[_0xa1e3('0x77')](_0xa1e3('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa1e3('0x3f')](_0xa1e3('0x79'),_0xa5d05a[_0xa1e3('0x58')]['id']);for(var _0x3b7314=0x0;_0x3b7314<_0x510014[_0xa1e3('0x59')];_0x3b7314+=0x1){let _0x13e95b=_0x510014[_0x3b7314];for(var _0x10822d=0x0;_0x10822d<_0x13e95b['Agents']['length'];_0x10822d+=0x1){let _0x414364=_0x13e95b[_0xa1e3('0x69')][_0x10822d];var _0x24a885=_0x139e57[_0xa1e3('0x7a')]();_0x24a885['where'](_0xa1e3('0x7b'),_0x414364['id']);_0x33fc9d[_0xa1e3('0x7c')](db[_0xa1e3('0x6e')][_0xa1e3('0x37')](_0x24a885[_0xa1e3('0x7d')](),{'type':db[_0xa1e3('0x6e')]['QueryTypes'][_0xa1e3('0x7e')]})[_0xa1e3('0x27')](function(_0x1c8ca8){if(_0x1c8ca8[_0xa1e3('0x59')]===0x1){return _0x414364['id'];}else{var _0x382a63=_[_0xa1e3('0x7f')](_[_0xa1e3('0x30')](_0x1c8ca8,_0xa1e3('0x80')),function(_0x480279){return _[_0xa1e3('0x81')](_0x46a383,_0x480279);});if(_0x382a63){return _0x414364['id'];}}}));}}return BPromise[_0xa1e3('0x82')](_0x33fc9d)['then'](function(_0x2c3973){_0x487b43=_(_0x487b43)[_0xa1e3('0x83')](_0x2c3973)['compact']()[_0xa1e3('0x84')]();return db[_0xa1e3('0x31')][_0xa1e3('0x4b')]({'where':{'id':_0xa5d05a[_0xa1e3('0x58')]['id']}})[_0xa1e3('0x27')](function(_0x31ff4e){return db[_0xa1e3('0x6e')][_0xa1e3('0x6f')](function(_0x191ed8){return _0x31ff4e[_0xa1e3('0x85')](_0xa5d05a[_0xa1e3('0x37')][_0xa1e3('0x67')],{'transaction':_0x191ed8})[_0xa1e3('0x27')](function(){if(!_['isEmpty'](_0x487b43)){return _0x31ff4e['removeAgents'](_0x487b43,{'transaction':_0x191ed8});}})[_0xa1e3('0x27')](function(){_0x487b43[_0xa1e3('0x71')](function(_0x1d22e9){socket[_0xa1e3('0x86')]('userSmsQueue:remove',{'UserId':_0x1d22e9,'SmsQueueId':_0x31ff4e['id']});});});});});});})[_0xa1e3('0x27')](respondWithStatusCode(_0x4710aa,null))['catch'](handleError(_0x4710aa,null));};exports[_0xa1e3('0x87')]=function(_0x576f77,_0xaf8174,_0x3b8ded){return db[_0xa1e3('0x31')][_0xa1e3('0x4b')]({'where':{'id':_0x576f77['params']['id']}})[_0xa1e3('0x27')](handleEntityNotFound(_0xaf8174,null))[_0xa1e3('0x27')](function(_0x8739f4){if(_0x8739f4){return _0x8739f4['addAgents'](_0x576f77['body'][_0xa1e3('0x67')],_[_0xa1e3('0x88')](_0x576f77[_0xa1e3('0x54')],['ids','id'])||{})['spread'](function(_0x354945){for(var _0x272246=0x0;_0x272246<_0x576f77['body'][_0xa1e3('0x67')]['length'];_0x272246+=0x1){socket[_0xa1e3('0x86')](_0xa1e3('0x89'),{'UserId':_0x576f77[_0xa1e3('0x54')][_0xa1e3('0x67')][_0x272246],'SmsQueueId':_0x576f77[_0xa1e3('0x58')]['id']});}return _0x354945;});}})[_0xa1e3('0x27')](respondWithResult(_0xaf8174,null))['catch'](handleError(_0xaf8174,null));};exports[_0xa1e3('0x8a')]=function(_0x277d10,_0xb9f429,_0x44586a){return db[_0xa1e3('0x31')]['find']({'where':{'id':_0x277d10[_0xa1e3('0x58')]['id']}})[_0xa1e3('0x27')](handleEntityNotFound(_0xb9f429,null))['then'](function(_0x2ab839){if(_0x2ab839){return _0x2ab839[_0xa1e3('0x8a')](_0x277d10['query'][_0xa1e3('0x67')])[_0xa1e3('0x27')](function(){if(_[_0xa1e3('0x8b')](_0x277d10[_0xa1e3('0x37')][_0xa1e3('0x67')])){for(var _0x30b6fc=0x0;_0x30b6fc<_0x277d10['query'][_0xa1e3('0x67')][_0xa1e3('0x59')];_0x30b6fc+=0x1){socket[_0xa1e3('0x86')](_0xa1e3('0x8c'),{'UserId':Number(_0x277d10[_0xa1e3('0x37')][_0xa1e3('0x67')][_0x30b6fc]),'SmsQueueId':Number(_0x277d10[_0xa1e3('0x58')]['id'])});}}else{socket[_0xa1e3('0x86')]('userSmsQueue:remove',{'UserId':Number(_0x277d10[_0xa1e3('0x37')][_0xa1e3('0x67')]),'SmsQueueId':Number(_0x277d10[_0xa1e3('0x58')]['id'])});}});}})[_0xa1e3('0x27')](respondWithStatusCode(_0xb9f429,null))[_0xa1e3('0x47')](handleError(_0xb9f429,null));};exports[_0xa1e3('0x8d')]=function(_0x57a454,_0x5a8403,_0x1771ac){var _0x42e0ca={};var _0x5886c2={};var _0xcbf37e;var _0x9148f0;return db[_0xa1e3('0x31')][_0xa1e3('0x57')]({'where':{'id':_0x57a454[_0xa1e3('0x58')]['id']}})[_0xa1e3('0x27')](handleEntityNotFound(_0x5a8403,null))[_0xa1e3('0x27')](function(_0x30fab7){if(_0x30fab7){_0xcbf37e=_0x30fab7;_0x5886c2[_0xa1e3('0x36')]=_['keys'](db['User'][_0xa1e3('0x32')]);_0x5886c2[_0xa1e3('0x37')]=_['keys'](_0x57a454[_0xa1e3('0x37')]);_0x5886c2[_0xa1e3('0x39')]=_[_0xa1e3('0x3a')](_0x5886c2[_0xa1e3('0x36')],_0x5886c2['query']);_0x42e0ca[_0xa1e3('0x3b')]=_[_0xa1e3('0x3a')](_0x5886c2[_0xa1e3('0x36')],qs[_0xa1e3('0x3c')](_0x57a454[_0xa1e3('0x37')][_0xa1e3('0x3c')]));_0x42e0ca[_0xa1e3('0x3b')]=_0x42e0ca[_0xa1e3('0x3b')]['length']?_0x42e0ca['attributes']:_0x5886c2[_0xa1e3('0x36')];_0x42e0ca[_0xa1e3('0x3e')]=qs['sort'](_0x57a454[_0xa1e3('0x37')]['sort']);_0x42e0ca[_0xa1e3('0x3f')]=qs[_0xa1e3('0x39')](_[_0xa1e3('0x40')](_0x57a454[_0xa1e3('0x37')],_0x5886c2[_0xa1e3('0x39')]));if(_0x57a454[_0xa1e3('0x37')]['filter']){_0x42e0ca[_0xa1e3('0x3f')]=_['merge'](_0x42e0ca['where'],{'$or':_[_0xa1e3('0x30')](_0x42e0ca[_0xa1e3('0x3b')],function(_0x1ecb0a){var _0x4425c7={};_0x4425c7[_0x1ecb0a]={'$like':'%'+_0x57a454[_0xa1e3('0x37')][_0xa1e3('0x41')]+'%'};return _0x4425c7;})});}_0x42e0ca=_['merge']({},_0x42e0ca,_0x57a454[_0xa1e3('0x4a')]);return _0xcbf37e[_0xa1e3('0x8d')](_0x42e0ca);}})[_0xa1e3('0x27')](function(_0x1a3093){if(_0x1a3093){_0x9148f0=_0x1a3093['length'];if(!_0x57a454['query'][_0xa1e3('0x3d')](_0xa1e3('0x5a'))){_0x42e0ca[_0xa1e3('0x21')]=qs[_0xa1e3('0x21')](_0x57a454[_0xa1e3('0x37')][_0xa1e3('0x21')]);_0x42e0ca[_0xa1e3('0x20')]=qs[_0xa1e3('0x20')](_0x57a454[_0xa1e3('0x37')][_0xa1e3('0x20')]);}return _0xcbf37e['getAgents'](_0x42e0ca);}})['then'](function(_0x205aa5){if(_0x205aa5){return _0x205aa5?{'count':_0x9148f0,'rows':_0x205aa5}:null;}})['then'](respondWithResult(_0x5a8403,null))[_0xa1e3('0x47')](handleError(_0x5a8403,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9b75b81..371f80d 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 _0x4ba9=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ba9,0x18f));var _0x94ba=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x4ba9[_0x562362];return _0x3a18ce;};'use strict';var EventEmitter=require(_0x94ba('0x0'));var SmsQueue=require(_0x94ba('0x1'))['db'][_0x94ba('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x94ba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x94ba('0x4'),'afterDestroy':_0x94ba('0x5')};function emitEvent(_0x23ff2e){return function(_0x50eb2d,_0x694254,_0x3aa212){SmsQueueEvents[_0x94ba('0x6')](_0x23ff2e+':'+_0x50eb2d['id'],_0x50eb2d);SmsQueueEvents[_0x94ba('0x6')](_0x23ff2e,_0x50eb2d);_0x3aa212(null);};}for(var e in events){if(events[_0x94ba('0x7')](e)){var event=events[e];SmsQueue[_0x94ba('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe36f=['exports','events','../../mysqldb','setMaxListeners','update','emit','hook'];(function(_0x5b57fd,_0x1df2b3){var _0x1a0b50=function(_0x3b2252){while(--_0x3b2252){_0x5b57fd['push'](_0x5b57fd['shift']());}};_0x1a0b50(++_0x1df2b3);}(_0xe36f,0x189));var _0xfe36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe36f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfe36('0x0'));var SmsQueue=require(_0xfe36('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfe36('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe36('0x3'),'afterDestroy':'remove'};function emitEvent(_0x44adf0){return function(_0x52a70f,_0xaf0692,_0x10a708){SmsQueueEvents[_0xfe36('0x4')](_0x44adf0+':'+_0x52a70f['id'],_0x52a70f);SmsQueueEvents['emit'](_0x44adf0,_0x52a70f);_0x10a708(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xfe36('0x5')](e,emitEvent(event));}}module[_0xfe36('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b7bd2d2..3dbc164 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 _0x7217=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x7217,0x19e));var _0x7721=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7217[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d3=['SmsQueue','sms_queues','lodash','util','api','bluebird','path','rimraf','exports'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x98d3,0x173));var _0x398d=function(_0x1534e2,_0x7246da){_0x1534e2=_0x1534e2-0x0;var _0x15899c=_0x98d3[_0x1534e2];return _0x15899c;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var logger=require('../../config/logger')(_0x398d('0x2'));var moment=require('moment');var BPromise=require(_0x398d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x398d('0x4'));var rimraf=require(_0x398d('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x398d('0x6')]=function(_0x25d38f,_0x2c3c4c){return _0x25d38f['define'](_0x398d('0x7'),attributes,{'tableName':_0x398d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 3d1e78d..f9a9937 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 _0x7465=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','SmsQueue','find','ShowSmsQueue'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7465,0x148));var _0x5746=function(_0x119c85,_0x268175){_0x119c85=_0x119c85-0x0;var _0x41d288=_0x7465[_0x119c85];return _0x41d288;};'use strict';var _=require(_0x5746('0x0'));var util=require(_0x5746('0x1'));var moment=require('moment');var BPromise=require(_0x5746('0x2'));var rs=require(_0x5746('0x3'));var fs=require('fs');var Redis=require(_0x5746('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5746('0x5'));var logger=require(_0x5746('0x6'))('rpc');var config=require(_0x5746('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5746('0x8')][_0x5746('0x9')]({'port':0x232a});config[_0x5746('0xa')]=_[_0x5746('0xb')](config['redis'],{'host':_0x5746('0xc'),'port':0x18eb});var socket=require(_0x5746('0xd'))(new Redis(config[_0x5746('0xa')]));require(_0x5746('0xe'))[_0x5746('0xf')](socket);function respondWithRpcPromise(_0x5c4a5c,_0xdc88f1,_0x479b86){return new BPromise(function(_0x190ff7,_0x4cecbb){return client['request'](_0x5c4a5c,_0x479b86)[_0x5746('0x10')](function(_0x36d507){logger[_0x5746('0x11')](_0x5746('0x12'),_0xdc88f1,_0x5746('0x13'));logger[_0x5746('0x14')](_0x5746('0x15'),_0xdc88f1,'request\x20sent',JSON[_0x5746('0x16')](_0x36d507));if(_0x36d507[_0x5746('0x17')]){if(_0x36d507[_0x5746('0x17')][_0x5746('0x18')]===0x1f4){logger[_0x5746('0x17')](_0x5746('0x12'),_0xdc88f1,_0x36d507[_0x5746('0x17')][_0x5746('0x19')]);return _0x4cecbb(_0x36d507['error'][_0x5746('0x19')]);}logger['error'](_0x5746('0x12'),_0xdc88f1,_0x36d507['error'][_0x5746('0x19')]);return _0x190ff7(_0x36d507[_0x5746('0x17')][_0x5746('0x19')]);}else{logger[_0x5746('0x11')](_0x5746('0x12'),_0xdc88f1,_0x5746('0x13'));_0x190ff7(_0x36d507[_0x5746('0x1a')][_0x5746('0x19')]);}})[_0x5746('0x1b')](function(_0x4efa5b){logger[_0x5746('0x17')](_0x5746('0x12'),_0xdc88f1,_0x4efa5b);_0x4cecbb(_0x4efa5b);});});}exports[_0x5746('0x1c')]=function(_0x16b152){var _0x17663a=this;return new Promise(function(_0x58c9ea,_0xcc3ad3){return db['SmsQueue'][_0x5746('0x1d')]({'raw':_0x16b152['options']?_0x16b152[_0x5746('0x1e')][_0x5746('0x1f')]===undefined?!![]:![]:!![],'where':_0x16b152[_0x5746('0x1e')]?_0x16b152['options'][_0x5746('0x20')]||null:null,'attributes':_0x16b152[_0x5746('0x1e')]?_0x16b152[_0x5746('0x1e')]['attributes']||null:null,'limit':_0x16b152['options']?_0x16b152[_0x5746('0x1e')][_0x5746('0x21')]||null:null,'include':_0x16b152[_0x5746('0x1e')]?_0x16b152[_0x5746('0x1e')][_0x5746('0x22')]?_[_0x5746('0x23')](_0x16b152[_0x5746('0x1e')][_0x5746('0x22')],function(_0x2b72a6){return{'model':db[_0x2b72a6[_0x5746('0x24')]],'as':_0x2b72a6['as'],'attributes':_0x2b72a6[_0x5746('0x25')],'include':_0x2b72a6['include']?_[_0x5746('0x23')](_0x2b72a6['include'],function(_0x3da561){return{'model':db[_0x3da561['model']],'as':_0x3da561['as'],'attributes':_0x3da561[_0x5746('0x25')],'include':_0x3da561[_0x5746('0x22')]?_[_0x5746('0x23')](_0x3da561[_0x5746('0x22')],function(_0x24dcdb){return{'model':db[_0x24dcdb['model']],'as':_0x24dcdb['as'],'attributes':_0x24dcdb[_0x5746('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43937f){logger[_0x5746('0x11')](_0x5746('0x1c'),_0x16b152);logger[_0x5746('0x14')](_0x5746('0x1c'),_0x16b152,JSON[_0x5746('0x16')](_0x43937f));_0x58c9ea(_0x43937f);})[_0x5746('0x1b')](function(_0x41e5e1){logger[_0x5746('0x17')](_0x5746('0x1c'),_0x41e5e1[_0x5746('0x19')],_0x16b152);_0xcc3ad3(_0x17663a[_0x5746('0x17')](0x1f4,_0x41e5e1[_0x5746('0x19')]));});});};exports['ShowSmsQueue']=function(_0xdfd2ca){var _0x57f5e7=this;return new Promise(function(_0x63c047,_0x316f4e){return db[_0x5746('0x26')][_0x5746('0x27')]({'raw':_0xdfd2ca['options']?_0xdfd2ca[_0x5746('0x1e')][_0x5746('0x1f')]===undefined?!![]:![]:!![],'where':_0xdfd2ca[_0x5746('0x1e')]?_0xdfd2ca[_0x5746('0x1e')][_0x5746('0x20')]||null:null,'attributes':_0xdfd2ca[_0x5746('0x1e')]?_0xdfd2ca['options'][_0x5746('0x25')]||null:null,'include':_0xdfd2ca[_0x5746('0x1e')]?_0xdfd2ca['options']['include']?_[_0x5746('0x23')](_0xdfd2ca[_0x5746('0x1e')][_0x5746('0x22')],function(_0x3c8706){return{'model':db[_0x3c8706[_0x5746('0x24')]],'as':_0x3c8706['as'],'attributes':_0x3c8706[_0x5746('0x25')],'include':_0x3c8706[_0x5746('0x22')]?_['map'](_0x3c8706[_0x5746('0x22')],function(_0x4ecd3c){return{'model':db[_0x4ecd3c[_0x5746('0x24')]],'as':_0x4ecd3c['as'],'attributes':_0x4ecd3c[_0x5746('0x25')],'include':_0x4ecd3c[_0x5746('0x22')]?_['map'](_0x4ecd3c[_0x5746('0x22')],function(_0x3832ad){return{'model':db[_0x3832ad[_0x5746('0x24')]],'as':_0x3832ad['as'],'attributes':_0x3832ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x5746('0x10')](function(_0x6ba7db){logger[_0x5746('0x11')](_0x5746('0x28'),_0xdfd2ca);logger[_0x5746('0x14')](_0x5746('0x28'),_0xdfd2ca,JSON[_0x5746('0x16')](_0x6ba7db));_0x63c047(_0x6ba7db);})[_0x5746('0x1b')](function(_0x31a531){logger['error']('ShowSmsQueue',_0x31a531[_0x5746('0x19')],_0xdfd2ca);_0x316f4e(_0x57f5e7[_0x5746('0x17')](0x1f4,_0x31a531[_0x5746('0x19')]));});});}; \ No newline at end of file +var _0xd073=['map','debug','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x8cc01e,_0xf8befa){var _0x53f8a0=function(_0xa8b4e){while(--_0xa8b4e){_0x8cc01e['push'](_0x8cc01e['shift']());}};_0x53f8a0(++_0xf8befa);}(_0xd073,0xcc));var _0x3d07=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd073[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x3d07('0x0'));var util=require(_0x3d07('0x1'));var moment=require(_0x3d07('0x2'));var BPromise=require(_0x3d07('0x3'));var rs=require(_0x3d07('0x4'));var fs=require('fs');var Redis=require(_0x3d07('0x5'));var db=require(_0x3d07('0x6'))['db'];var utils=require(_0x3d07('0x7'));var logger=require(_0x3d07('0x8'))(_0x3d07('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d07('0xa'));var client=jayson[_0x3d07('0xb')][_0x3d07('0xc')]({'port':0x232a});config[_0x3d07('0xd')]=_['defaults'](config[_0x3d07('0xd')],{'host':_0x3d07('0xe'),'port':0x18eb});var socket=require(_0x3d07('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x3d07('0x10')](socket);function respondWithRpcPromise(_0xe851a0,_0x3bec71,_0x5dad42){return new BPromise(function(_0x5c50a4,_0x1c2863){return client['request'](_0xe851a0,_0x5dad42)[_0x3d07('0x11')](function(_0x47907a){logger['info'](_0x3d07('0x12'),_0x3bec71,_0x3d07('0x13'));logger['debug'](_0x3d07('0x14'),_0x3bec71,'request\x20sent',JSON[_0x3d07('0x15')](_0x47907a));if(_0x47907a[_0x3d07('0x16')]){if(_0x47907a[_0x3d07('0x16')]['code']===0x1f4){logger['error'](_0x3d07('0x12'),_0x3bec71,_0x47907a[_0x3d07('0x16')]['message']);return _0x1c2863(_0x47907a['error'][_0x3d07('0x17')]);}logger[_0x3d07('0x16')](_0x3d07('0x12'),_0x3bec71,_0x47907a[_0x3d07('0x16')][_0x3d07('0x17')]);return _0x5c50a4(_0x47907a['error'][_0x3d07('0x17')]);}else{logger[_0x3d07('0x18')](_0x3d07('0x12'),_0x3bec71,_0x3d07('0x13'));_0x5c50a4(_0x47907a['result'][_0x3d07('0x17')]);}})[_0x3d07('0x19')](function(_0x4f6dd6){logger[_0x3d07('0x16')]('SmsQueue,\x20%s,\x20%s',_0x3bec71,_0x4f6dd6);_0x1c2863(_0x4f6dd6);});});}exports[_0x3d07('0x1a')]=function(_0x1786c7){var _0x349f87=this;return new Promise(function(_0x2006d4,_0x405fa5){return db[_0x3d07('0x1b')][_0x3d07('0x1c')]({'raw':_0x1786c7[_0x3d07('0x1d')]?_0x1786c7[_0x3d07('0x1d')][_0x3d07('0x1e')]===undefined?!![]:![]:!![],'where':_0x1786c7[_0x3d07('0x1d')]?_0x1786c7[_0x3d07('0x1d')][_0x3d07('0x1f')]||null:null,'attributes':_0x1786c7[_0x3d07('0x1d')]?_0x1786c7[_0x3d07('0x1d')][_0x3d07('0x20')]||null:null,'limit':_0x1786c7[_0x3d07('0x1d')]?_0x1786c7[_0x3d07('0x1d')][_0x3d07('0x21')]||null:null,'include':_0x1786c7[_0x3d07('0x1d')]?_0x1786c7[_0x3d07('0x1d')][_0x3d07('0x22')]?_['map'](_0x1786c7['options']['include'],function(_0x1d16bd){return{'model':db[_0x1d16bd[_0x3d07('0x23')]],'as':_0x1d16bd['as'],'attributes':_0x1d16bd[_0x3d07('0x20')],'include':_0x1d16bd[_0x3d07('0x22')]?_[_0x3d07('0x24')](_0x1d16bd[_0x3d07('0x22')],function(_0x564ac6){return{'model':db[_0x564ac6['model']],'as':_0x564ac6['as'],'attributes':_0x564ac6[_0x3d07('0x20')],'include':_0x564ac6[_0x3d07('0x22')]?_['map'](_0x564ac6['include'],function(_0x61091b){return{'model':db[_0x61091b[_0x3d07('0x23')]],'as':_0x61091b['as'],'attributes':_0x61091b[_0x3d07('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3d07('0x11')](function(_0x2c2972){logger['info'](_0x3d07('0x1a'),_0x1786c7);logger[_0x3d07('0x25')](_0x3d07('0x1a'),_0x1786c7,JSON[_0x3d07('0x15')](_0x2c2972));_0x2006d4(_0x2c2972);})[_0x3d07('0x19')](function(_0x3d7381){logger[_0x3d07('0x16')](_0x3d07('0x1a'),_0x3d7381[_0x3d07('0x17')],_0x1786c7);_0x405fa5(_0x349f87[_0x3d07('0x16')](0x1f4,_0x3d7381[_0x3d07('0x17')]));});});};exports['ShowSmsQueue']=function(_0x3eaf72){var _0x86720a=this;return new Promise(function(_0x506eb1,_0x206b88){return db[_0x3d07('0x1b')][_0x3d07('0x26')]({'raw':_0x3eaf72[_0x3d07('0x1d')]?_0x3eaf72[_0x3d07('0x1d')][_0x3d07('0x1e')]===undefined?!![]:![]:!![],'where':_0x3eaf72[_0x3d07('0x1d')]?_0x3eaf72[_0x3d07('0x1d')][_0x3d07('0x1f')]||null:null,'attributes':_0x3eaf72['options']?_0x3eaf72[_0x3d07('0x1d')]['attributes']||null:null,'include':_0x3eaf72[_0x3d07('0x1d')]?_0x3eaf72['options'][_0x3d07('0x22')]?_[_0x3d07('0x24')](_0x3eaf72['options'][_0x3d07('0x22')],function(_0x48eb13){return{'model':db[_0x48eb13[_0x3d07('0x23')]],'as':_0x48eb13['as'],'attributes':_0x48eb13[_0x3d07('0x20')],'include':_0x48eb13['include']?_[_0x3d07('0x24')](_0x48eb13[_0x3d07('0x22')],function(_0x525fae){return{'model':db[_0x525fae[_0x3d07('0x23')]],'as':_0x525fae['as'],'attributes':_0x525fae['attributes'],'include':_0x525fae[_0x3d07('0x22')]?_[_0x3d07('0x24')](_0x525fae['include'],function(_0x594bdf){return{'model':db[_0x594bdf['model']],'as':_0x594bdf['as'],'attributes':_0x594bdf[_0x3d07('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3d07('0x11')](function(_0x15e863){logger[_0x3d07('0x18')](_0x3d07('0x27'),_0x3eaf72);logger[_0x3d07('0x25')](_0x3d07('0x27'),_0x3eaf72,JSON[_0x3d07('0x15')](_0x15e863));_0x506eb1(_0x15e863);})[_0x3d07('0x19')](function(_0x366fb9){logger[_0x3d07('0x16')](_0x3d07('0x27'),_0x366fb9[_0x3d07('0x17')],_0x3eaf72);_0x206b88(_0x86720a[_0x3d07('0x16')](0x1f4,_0x366fb9[_0x3d07('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e1cfe02..68faef9 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 _0xba56=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xba56,0x79));var _0x6ba5=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xba56[_0x56916d];return _0x2b7f1f;};'use strict';var SmsQueueEvents=require(_0x6ba5('0x0'));var events=[_0x6ba5('0x1'),_0x6ba5('0x2'),_0x6ba5('0x3')];function createListener(_0x4a791a,_0x551cdb){return function(_0x4747ee){_0x551cdb[_0x6ba5('0x4')](_0x4a791a,_0x4747ee);};}function removeListener(_0x194e13,_0x359952){return function(){SmsQueueEvents[_0x6ba5('0x5')](_0x194e13,_0x359952);};}exports[_0x6ba5('0x6')]=function(_0x55aef1){for(var _0x4028e0=0x0,_0x592126=events['length'];_0x4028e0<_0x592126;_0x4028e0++){var _0xef4ac4=events[_0x4028e0];var _0x288769=createListener(_0x6ba5('0x7')+_0xef4ac4,_0x55aef1);SmsQueueEvents['on'](_0xef4ac4,_0x288769);}}; \ No newline at end of file +var _0x01dc=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x1673fa,_0x4a9399){var _0x369782=function(_0x3eff9a){while(--_0x3eff9a){_0x1673fa['push'](_0x1673fa['shift']());}};_0x369782(++_0x4a9399);}(_0x01dc,0xd6));var _0xc01d=function(_0x2327dd,_0x18e1c7){_0x2327dd=_0x2327dd-0x0;var _0x36b8af=_0x01dc[_0x2327dd];return _0x36b8af;};'use strict';var SmsQueueEvents=require(_0xc01d('0x0'));var events=[_0xc01d('0x1'),_0xc01d('0x2'),_0xc01d('0x3')];function createListener(_0xc05920,_0x431b95){return function(_0x2c6d35){_0x431b95[_0xc01d('0x4')](_0xc05920,_0x2c6d35);};}function removeListener(_0x3c4ced,_0x38e596){return function(){SmsQueueEvents[_0xc01d('0x5')](_0x3c4ced,_0x38e596);};}exports[_0xc01d('0x6')]=function(_0x196262){for(var _0x17ed10=0x0,_0x2b9a09=events[_0xc01d('0x7')];_0x17ed10<_0x2b9a09;_0x17ed10++){var _0x1d21eb=events[_0x17ed10];var _0x3ca84b=createListener(_0xc01d('0x8')+_0x1d21eb,_0x196262);SmsQueueEvents['on'](_0x1d21eb,_0x3ca84b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 90d8acf..58944fc 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 _0x7a72=['put','update','delete','destroy','util','path','express','../../components/auth/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','create'];(function(_0x2381fc,_0x42e102){var _0x458d9f=function(_0x385221){while(--_0x385221){_0x2381fc['push'](_0x2381fc['shift']());}};_0x458d9f(++_0x42e102);}(_0x7a72,0x1be));var _0x27a7=function(_0x29a97c,_0x370826){_0x29a97c=_0x29a97c-0x0;var _0x2cbe06=_0x7a72[_0x29a97c];return _0x2cbe06;};'use strict';var multer=require('multer');var util=require(_0x27a7('0x0'));var path=require(_0x27a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x27a7('0x2'));var router=express['Router']();var auth=require(_0x27a7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x27a7('0x4'));var controller=require('./smsQueueReport.controller');router[_0x27a7('0x5')]('/',auth['isAuthenticated'](),controller[_0x27a7('0x6')]);router[_0x27a7('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x27a7('0x7')]);router['get'](_0x27a7('0x8'),auth[_0x27a7('0x9')](),controller[_0x27a7('0xa')]);router[_0x27a7('0xb')]('/',auth['isAuthenticated'](),controller[_0x27a7('0xc')]);router[_0x27a7('0xd')](_0x27a7('0x8'),auth['isAuthenticated'](),controller[_0x27a7('0xe')]);router[_0x27a7('0xf')]('/:id',auth[_0x27a7('0x9')](),controller[_0x27a7('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9fdf=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update'];(function(_0x146295,_0x537d9c){var _0x4ce9bd=function(_0x480c88){while(--_0x480c88){_0x146295['push'](_0x146295['shift']());}};_0x4ce9bd(++_0x537d9c);}(_0x9fdf,0x157));var _0xf9fd=function(_0x14b888,_0x18999b){_0x14b888=_0x14b888-0x0;var _0x2bbe6f=_0x9fdf[_0x14b888];return _0x2bbe6f;};'use strict';var multer=require('multer');var util=require(_0xf9fd('0x0'));var path=require(_0xf9fd('0x1'));var timeout=require(_0xf9fd('0x2'));var express=require(_0xf9fd('0x3'));var router=express['Router']();var auth=require(_0xf9fd('0x4'));var interaction=require(_0xf9fd('0x5'));var config=require(_0xf9fd('0x6'));var controller=require(_0xf9fd('0x7'));router[_0xf9fd('0x8')]('/',auth[_0xf9fd('0x9')](),controller[_0xf9fd('0xa')]);router['get']('/describe',auth[_0xf9fd('0x9')](),controller[_0xf9fd('0xb')]);router['get'](_0xf9fd('0xc'),auth[_0xf9fd('0x9')](),controller['show']);router[_0xf9fd('0xd')]('/',auth[_0xf9fd('0x9')](),controller[_0xf9fd('0xe')]);router[_0xf9fd('0xf')](_0xf9fd('0xc'),auth[_0xf9fd('0x9')](),controller[_0xf9fd('0x10')]);router[_0xf9fd('0x11')](_0xf9fd('0xc'),auth['isAuthenticated'](),controller[_0xf9fd('0x12')]);module[_0xf9fd('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 4c1bc61..b2731fd 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 _0x5a52=['STRING','DATE','sequelize','exports'];(function(_0x5d4c50,_0x532e42){var _0x33557a=function(_0x480286){while(--_0x480286){_0x5d4c50['push'](_0x5d4c50['shift']());}};_0x33557a(++_0x532e42);}(_0x5a52,0xae));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var Sequelize=require(_0x25a5('0x0'));module[_0x25a5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x25a5('0x2')]},'joinAt':{'type':Sequelize[_0x25a5('0x3')]},'leaveAt':{'type':Sequelize[_0x25a5('0x3')]},'acceptAt':{'type':Sequelize[_0x25a5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb009=['STRING','DATE','moment','sequelize'];(function(_0x35515f,_0x9f5a2c){var _0x2f9807=function(_0x3a43ae){while(--_0x3a43ae){_0x35515f['push'](_0x35515f['shift']());}};_0x2f9807(++_0x9f5a2c);}(_0xb009,0x11a));var _0x9b00=function(_0x402d00,_0x46761f){_0x402d00=_0x402d00-0x0;var _0x23df42=_0xb009[_0x402d00];return _0x23df42;};'use strict';var moment=require(_0x9b00('0x0'));var Sequelize=require(_0x9b00('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9b00('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9b00('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9b00('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9b00('0x3')]},'reason':{'type':Sequelize[_0x9b00('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9792d55..5f02fa2 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(_0x7126b4,_0x5240df){var _0x43af7a=function(_0x5171a2){while(--_0x5171a2){_0x7126b4['push'](_0x7126b4['shift']());}};_0x43af7a(++_0x5240df);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _0x3e74=['save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','count','offset','status','set','Content-Range','json','apply','reject'];(function(_0x560b54,_0x3fec6f){var _0x578669=function(_0x58a1c3){while(--_0x58a1c3){_0x560b54['push'](_0x560b54['shift']());}};_0x578669(++_0x3fec6f);}(_0x3e74,0x175));var _0x43e7=function(_0x4423db,_0x205589){_0x4423db=_0x4423db-0x0;var _0x5b5a4f=_0x3e74[_0x4423db];return _0x5b5a4f;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454359,_0x4eea52){return function(_0x4c9df3){if(!_0x4c9df3){_0x454359[_0x43e7('0x14')](0x194);}return _0x4c9df3;};}function handleError(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0x1f4;return function(_0x1f0673){logger['error'](_0x1f0673[_0x43e7('0x21')]);if(_0x1f0673['name']){delete _0x1f0673[_0x43e7('0x22')];}_0x43f4ff[_0x43e7('0x17')](_0x4b2b9f)[_0x43e7('0x23')](_0x1f0673);};}exports[_0x43e7('0x24')]=function(_0x51f4d7,_0x52b7b3){var _0x805b54={},_0x501551={},_0x2dd5f={'count':0x0,'rows':[]};var _0x40dc8f=_[_0x43e7('0x25')](db[_0x43e7('0x26')]['rawAttributes'],function(_0x33a1a5){return{'name':_0x33a1a5[_0x43e7('0x27')],'type':_0x33a1a5[_0x43e7('0x28')][_0x43e7('0x29')]};});_0x501551[_0x43e7('0x2a')]=_[_0x43e7('0x25')](_0x40dc8f,_0x43e7('0x22'));_0x501551[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x51f4d7[_0x43e7('0x2b')]);_0x501551[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],_0x501551[_0x43e7('0x2b')]);_0x805b54['attributes']=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x2f')]));_0x805b54['attributes']=_0x805b54[_0x43e7('0x30')][_0x43e7('0x31')]?_0x805b54[_0x43e7('0x30')]:_0x501551[_0x43e7('0x2a')];if(!_0x51f4d7['query']['hasOwnProperty']('nolimit')){_0x805b54[_0x43e7('0x32')]=qs[_0x43e7('0x32')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x32')]);_0x805b54[_0x43e7('0x16')]=qs[_0x43e7('0x16')](_0x51f4d7['query']['offset']);}_0x805b54['order']=qs['sort'](_0x51f4d7['query']['sort']);_0x805b54['where']=qs[_0x43e7('0x2d')](_['pick'](_0x51f4d7[_0x43e7('0x2b')],_0x501551[_0x43e7('0x2d')]),_0x40dc8f);if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]){_0x805b54[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x805b54[_0x43e7('0x34')],{'$or':_['map'](_0x40dc8f,function(_0x5332d9){if(_0x5332d9['type']!==_0x43e7('0x36')){var _0xfe70e9={};_0xfe70e9[_0x5332d9[_0x43e7('0x22')]]={'$like':'%'+_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]+'%'};return _0xfe70e9;}})});}_0x805b54=_[_0x43e7('0x35')]({},_0x805b54,_0x51f4d7[_0x43e7('0x37')]);var _0x2ffd43={'where':_0x805b54['where']};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ffd43)['then'](function(_0x2d54c1){_0x2dd5f['count']=_0x2d54c1;if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x38')]){_0x805b54[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x805b54);})[_0x43e7('0x1f')](function(_0x5e731b){_0x2dd5f['rows']=_0x5e731b;return _0x2dd5f;})[_0x43e7('0x1f')](respondWithFilteredResult(_0x52b7b3,_0x805b54))[_0x43e7('0x3b')](handleError(_0x52b7b3,null));};exports[_0x43e7('0x3c')]=function(_0xc8ffa5,_0x127d77){var _0x4a4a85={'raw':!![],'where':{'id':_0xc8ffa5[_0x43e7('0x3d')]['id']}},_0x32a451={};_0x32a451['model']=_[_0x43e7('0x2c')](db['SmsQueueReport'][_0x43e7('0x3e')]);_0x32a451['query']=_[_0x43e7('0x2c')](_0xc8ffa5[_0x43e7('0x2b')]);_0x32a451[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x32a451['model'],_0x32a451['query']);_0x4a4a85[_0x43e7('0x30')]=_[_0x43e7('0x2e')](_0x32a451[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0xc8ffa5['query']['fields']));_0x4a4a85['attributes']=_0x4a4a85[_0x43e7('0x30')]['length']?_0x4a4a85[_0x43e7('0x30')]:_0x32a451['model'];if(_0xc8ffa5['query'][_0x43e7('0x38')]){_0x4a4a85['include']=[{'all':!![]}];}_0x4a4a85=_[_0x43e7('0x35')]({},_0x4a4a85,_0xc8ffa5[_0x43e7('0x37')]);return db[_0x43e7('0x26')][_0x43e7('0x3f')](_0x4a4a85)['then'](handleEntityNotFound(_0x127d77,null))[_0x43e7('0x1f')](respondWithResult(_0x127d77,null))[_0x43e7('0x3b')](handleError(_0x127d77,null));};exports[_0x43e7('0x40')]=function(_0x1fd277,_0x296dc8){return db[_0x43e7('0x26')]['create'](_0x1fd277['body'],{})[_0x43e7('0x1f')](respondWithResult(_0x296dc8,0xc9))[_0x43e7('0x3b')](handleError(_0x296dc8,null));};exports[_0x43e7('0x1e')]=function(_0x4c00a8,_0x5c1c18){if(_0x4c00a8['body']['id']){delete _0x4c00a8[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x26')]['find']({'where':{'id':_0x4c00a8[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x5c1c18,null))[_0x43e7('0x1f')](saveUpdates(_0x4c00a8['body'],null))['then'](respondWithResult(_0x5c1c18,null))['catch'](handleError(_0x5c1c18,null));};exports['destroy']=function(_0x214e7e,_0xe955fc){return db['SmsQueueReport'][_0x43e7('0x3f')]({'where':{'id':_0x214e7e[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x1f')](removeEntity(_0xe955fc,null))['catch'](handleError(_0xe955fc,null));};exports[_0x43e7('0x42')]=function(_0x483f20,_0x4bebd4){return db[_0x43e7('0x26')][_0x43e7('0x42')]()[_0x43e7('0x1f')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x3b')](handleError(_0x4bebd4,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9fa1045..9355c82 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 _0x1650=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsQueueReport','report_sms_queue','uniqueid','lodash'];(function(_0x45e9d4,_0x396832){var _0x15de55=function(_0xaff54a){while(--_0xaff54a){_0x45e9d4['push'](_0x45e9d4['shift']());}};_0x15de55(++_0x396832);}(_0x1650,0xdc));var _0x0165=function(_0x538a20,_0x5c14d6){_0x538a20=_0x538a20-0x0;var _0xec72f5=_0x1650[_0x538a20];return _0xec72f5;};'use strict';var _=require(_0x0165('0x0'));var util=require(_0x0165('0x1'));var logger=require(_0x0165('0x2'))('api');var moment=require(_0x0165('0x3'));var BPromise=require(_0x0165('0x4'));var rp=require(_0x0165('0x5'));var fs=require('fs');var path=require(_0x0165('0x6'));var rimraf=require(_0x0165('0x7'));var config=require(_0x0165('0x8'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x1e0a28,_0x4e407c){return _0x1e0a28[_0x0165('0x9')](_0x0165('0xa'),attributes,{'tableName':_0x0165('0xb'),'paranoid':![],'indexes':[{'name':_0x0165('0xc'),'fields':[_0x0165('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf960=['util','api','moment','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','lodash'];(function(_0x379efe,_0x16a136){var _0x44c0c2=function(_0x1b3c4f){while(--_0x1b3c4f){_0x379efe['push'](_0x379efe['shift']());}};_0x44c0c2(++_0x16a136);}(_0xf960,0x1eb));var _0x0f96=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xf960[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x0f96('0x0'));var util=require(_0x0f96('0x1'));var logger=require('../../config/logger')(_0x0f96('0x2'));var moment=require(_0x0f96('0x3'));var BPromise=require(_0x0f96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f96('0x5'));var config=require(_0x0f96('0x6'));var attributes=require(_0x0f96('0x7'));module[_0x0f96('0x8')]=function(_0x34800a,_0x570431){return _0x34800a[_0x0f96('0x9')]('SmsQueueReport',attributes,{'tableName':_0x0f96('0xa'),'paranoid':![],'indexes':[{'name':_0x0f96('0xb'),'fields':[_0x0f96('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 d6c4fd1..db8458d 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 _0x8ca6=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','UpdateSmsQueueReport','update','where','attributes','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x8ca6,0x199));var _0x68ca=function(_0x390925,_0x42cab0){_0x390925=_0x390925-0x0;var _0x47735b=_0x8ca6[_0x390925];return _0x47735b;};'use strict';var _=require(_0x68ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68ca('0x1'));var rs=require(_0x68ca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68ca('0x3'))['db'];var utils=require(_0x68ca('0x4'));var logger=require(_0x68ca('0x5'))(_0x68ca('0x6'));var config=require('../../config/environment');var jayson=require(_0x68ca('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb798,_0xa95e07,_0xe8af43){return new BPromise(function(_0x5d9779,_0x8c91c3){return client[_0x68ca('0x8')](_0x3cb798,_0xe8af43)['then'](function(_0x56f11d){logger['info'](_0x68ca('0x9'),_0xa95e07,_0x68ca('0xa'));logger[_0x68ca('0xb')](_0x68ca('0xc'),_0xa95e07,_0x68ca('0xa'),JSON['stringify'](_0x56f11d));if(_0x56f11d['error']){if(_0x56f11d['error']['code']===0x1f4){logger[_0x68ca('0xd')](_0x68ca('0x9'),_0xa95e07,_0x56f11d[_0x68ca('0xd')][_0x68ca('0xe')]);return _0x8c91c3(_0x56f11d[_0x68ca('0xd')][_0x68ca('0xe')]);}logger[_0x68ca('0xd')](_0x68ca('0x9'),_0xa95e07,_0x56f11d[_0x68ca('0xd')][_0x68ca('0xe')]);return _0x5d9779(_0x56f11d['error'][_0x68ca('0xe')]);}else{logger[_0x68ca('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0xa95e07,_0x68ca('0xa'));_0x5d9779(_0x56f11d['result']['message']);}})[_0x68ca('0x10')](function(_0x1657bb){logger['error'](_0x68ca('0x9'),_0xa95e07,_0x1657bb);_0x8c91c3(_0x1657bb);});});}exports[_0x68ca('0x11')]=function(_0x47f09a){var _0x20d759=this;return new Promise(function(_0x54628f,_0x29baa4){return db[_0x68ca('0x12')]['create'](_0x47f09a[_0x68ca('0x13')],{'raw':_0x47f09a[_0x68ca('0x14')]?_0x47f09a['options'][_0x68ca('0x15')]===undefined?!![]:![]:!![]})[_0x68ca('0x16')](function(_0x5ed59d){logger['info'](_0x68ca('0x11'),_0x47f09a);logger['debug'](_0x68ca('0x11'),_0x47f09a,JSON['stringify'](_0x5ed59d));_0x54628f(_0x5ed59d);})[_0x68ca('0x10')](function(_0x5e8192){logger[_0x68ca('0xd')]('CreateSmsQueueReport',_0x5e8192['message'],_0x47f09a);_0x29baa4(_0x20d759['error'](0x1f4,_0x5e8192[_0x68ca('0xe')]));});});};exports[_0x68ca('0x17')]=function(_0x4ebe22){var _0x144c7c=this;return new Promise(function(_0x2d7e5b,_0x5e352b){return db['SmsQueueReport'][_0x68ca('0x18')](_0x4ebe22[_0x68ca('0x13')],{'raw':_0x4ebe22[_0x68ca('0x14')]?_0x4ebe22[_0x68ca('0x14')][_0x68ca('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ebe22[_0x68ca('0x14')]?_0x4ebe22['options'][_0x68ca('0x19')]||null:null,'attributes':_0x4ebe22['options']?_0x4ebe22[_0x68ca('0x14')][_0x68ca('0x1a')]||null:null,'limit':_0x4ebe22[_0x68ca('0x14')]?_0x4ebe22[_0x68ca('0x14')]['limit']||null:null})[_0x68ca('0x16')](function(_0x180368){logger[_0x68ca('0xf')](_0x68ca('0x17'),_0x4ebe22);logger[_0x68ca('0xb')](_0x68ca('0x17'),_0x4ebe22,JSON[_0x68ca('0x1b')](_0x180368));_0x2d7e5b(_0x180368);})[_0x68ca('0x10')](function(_0x1726c6){logger[_0x68ca('0xd')](_0x68ca('0x17'),_0x1726c6[_0x68ca('0xe')],_0x4ebe22);_0x5e352b(_0x144c7c['error'](0x1f4,_0x1726c6[_0x68ca('0xe')]));});});}; \ No newline at end of file +var _0xc37f=['message','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s'];(function(_0x90f654,_0x4afa04){var _0x3111fb=function(_0x1ee482){while(--_0x1ee482){_0x90f654['push'](_0x90f654['shift']());}};_0x3111fb(++_0x4afa04);}(_0xc37f,0x9d));var _0xfc37=function(_0x3ab479,_0x3ad39a){_0x3ab479=_0x3ab479-0x0;var _0x57241b=_0xc37f[_0x3ab479];return _0x57241b;};'use strict';var _=require(_0xfc37('0x0'));var util=require(_0xfc37('0x1'));var moment=require(_0xfc37('0x2'));var BPromise=require(_0xfc37('0x3'));var rs=require(_0xfc37('0x4'));var fs=require('fs');var Redis=require(_0xfc37('0x5'));var db=require(_0xfc37('0x6'))['db'];var utils=require(_0xfc37('0x7'));var logger=require(_0xfc37('0x8'))(_0xfc37('0x9'));var config=require(_0xfc37('0xa'));var jayson=require(_0xfc37('0xb'));var client=jayson[_0xfc37('0xc')][_0xfc37('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c56a8,_0x301587,_0x2d3821){return new BPromise(function(_0x510175,_0x53b663){return client[_0xfc37('0xe')](_0x3c56a8,_0x2d3821)[_0xfc37('0xf')](function(_0x2cb229){logger[_0xfc37('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x301587,'request\x20sent');logger[_0xfc37('0x11')](_0xfc37('0x12'),_0x301587,'request\x20sent',JSON[_0xfc37('0x13')](_0x2cb229));if(_0x2cb229[_0xfc37('0x14')]){if(_0x2cb229[_0xfc37('0x14')][_0xfc37('0x15')]===0x1f4){logger['error'](_0xfc37('0x16'),_0x301587,_0x2cb229[_0xfc37('0x14')]['message']);return _0x53b663(_0x2cb229['error'][_0xfc37('0x17')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x301587,_0x2cb229[_0xfc37('0x14')][_0xfc37('0x17')]);return _0x510175(_0x2cb229[_0xfc37('0x14')][_0xfc37('0x17')]);}else{logger[_0xfc37('0x10')](_0xfc37('0x16'),_0x301587,_0xfc37('0x18'));_0x510175(_0x2cb229[_0xfc37('0x19')]['message']);}})[_0xfc37('0x1a')](function(_0x5265b4){logger[_0xfc37('0x14')](_0xfc37('0x16'),_0x301587,_0x5265b4);_0x53b663(_0x5265b4);});});}exports[_0xfc37('0x1b')]=function(_0x1d1da7){var _0x154aef=this;return new Promise(function(_0x5a69e0,_0x1432b0){return db[_0xfc37('0x1c')][_0xfc37('0x1d')](_0x1d1da7[_0xfc37('0x1e')],{'raw':_0x1d1da7[_0xfc37('0x1f')]?_0x1d1da7[_0xfc37('0x1f')][_0xfc37('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x4d8f79){logger['info'](_0xfc37('0x1b'),_0x1d1da7);logger[_0xfc37('0x11')](_0xfc37('0x1b'),_0x1d1da7,JSON[_0xfc37('0x13')](_0x4d8f79));_0x5a69e0(_0x4d8f79);})[_0xfc37('0x1a')](function(_0x128f9f){logger[_0xfc37('0x14')](_0xfc37('0x1b'),_0x128f9f[_0xfc37('0x17')],_0x1d1da7);_0x1432b0(_0x154aef[_0xfc37('0x14')](0x1f4,_0x128f9f[_0xfc37('0x17')]));});});};exports[_0xfc37('0x21')]=function(_0x56ff03){var _0x1eb1fb=this;return new Promise(function(_0x4c2eab,_0x5361a0){return db[_0xfc37('0x1c')][_0xfc37('0x22')](_0x56ff03[_0xfc37('0x1e')],{'raw':_0x56ff03[_0xfc37('0x1f')]?_0x56ff03[_0xfc37('0x1f')][_0xfc37('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56ff03[_0xfc37('0x1f')]?_0x56ff03['options'][_0xfc37('0x23')]||null:null,'attributes':_0x56ff03[_0xfc37('0x1f')]?_0x56ff03[_0xfc37('0x1f')]['attributes']||null:null,'limit':_0x56ff03[_0xfc37('0x1f')]?_0x56ff03['options']['limit']||null:null})[_0xfc37('0xf')](function(_0x11a511){logger[_0xfc37('0x10')](_0xfc37('0x21'),_0x56ff03);logger[_0xfc37('0x11')]('UpdateSmsQueueReport',_0x56ff03,JSON['stringify'](_0x11a511));_0x4c2eab(_0x11a511);})[_0xfc37('0x1a')](function(_0x462c11){logger[_0xfc37('0x14')](_0xfc37('0x21'),_0x462c11[_0xfc37('0x17')],_0x56ff03);_0x5361a0(_0x1eb1fb[_0xfc37('0x14')](0x1f4,_0x462c11['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index dda8f9e..26c577d 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 _0xa74f=['post','create','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x6a4fe7,_0x40a337){var _0x5e467d=function(_0x24eb0b){while(--_0x24eb0b){_0x6a4fe7['push'](_0x6a4fe7['shift']());}};_0x5e467d(++_0x40a337);}(_0xa74f,0x9a));var _0xfa74=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0xa74f[_0x594e11];return _0x5418ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var auth=require(_0xfa74('0x2'));var interaction=require(_0xfa74('0x3'));var config=require(_0xfa74('0x4'));var controller=require('./smsTransferReport.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x5')](_0xfa74('0x9'),auth['isAuthenticated'](),controller[_0xfa74('0xa')]);router[_0xfa74('0xb')]('/',auth[_0xfa74('0x7')](),controller[_0xfa74('0xc')]);router['put'](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller['update']);router[_0xfa74('0xd')](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller[_0xfa74('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),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 330e2a7..646478e 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 _0xffea=['moment','sequelize','exports','STRING','account','agent','queue','DATE','NOW'];(function(_0xe5a862,_0x5b7f20){var _0x313545=function(_0x5985cf){while(--_0x5985cf){_0xe5a862['push'](_0xe5a862['shift']());}};_0x313545(++_0x5b7f20);}(_0xffea,0x18c));var _0xaffe=function(_0x1e9b50,_0x44f9b3){_0x1e9b50=_0x1e9b50-0x0;var _0x5aa5c8=_0xffea[_0x1e9b50];return _0x5aa5c8;};'use strict';var moment=require(_0xaffe('0x0'));var Sequelize=require(_0xaffe('0x1'));module[_0xaffe('0x2')]={'uniqueid':{'type':Sequelize[_0xaffe('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaffe('0x4'),_0xaffe('0x5'),_0xaffe('0x6')),'allowNull':![],'defaultValue':_0xaffe('0x6')},'transferredAt':{'type':Sequelize[_0xaffe('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xaffe('0x8')]}}; \ No newline at end of file +var _0x97aa=['agent','queue','DATE','NOW','moment','sequelize','STRING','ENUM'];(function(_0x720d1d,_0x1df43e){var _0xfed4ba=function(_0x2b5596){while(--_0x2b5596){_0x720d1d['push'](_0x720d1d['shift']());}};_0xfed4ba(++_0x1df43e);}(_0x97aa,0x134));var _0xa97a=function(_0xc5708,_0x3d620e){_0xc5708=_0xc5708-0x0;var _0x44d6cc=_0x97aa[_0xc5708];return _0x44d6cc;};'use strict';var moment=require(_0xa97a('0x0'));var Sequelize=require(_0xa97a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa97a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa97a('0x3')]('account',_0xa97a('0x4'),_0xa97a('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa97a('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xa97a('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3ab007a..9cdebdb 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 _0xe706=['catch','create','body','destroy','describe','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','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x137132,_0x47e564){var _0x1ea26c=function(_0x4bf289){while(--_0x4bf289){_0x137132['push'](_0x137132['shift']());}};_0x1ea26c(++_0x47e564);}(_0xe706,0xa3));var _0x6e70=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0xe706[_0x53b93b];return _0x485761;};'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={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['SmsTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file +var _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x5159dd,_0x29a8f6){var _0x3eaa82=function(_0x1bf1ec){while(--_0x1bf1ec){_0x5159dd['push'](_0x5159dd['shift']());}};_0x3eaa82(++_0x29a8f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0xcb91[_0xb301d4];return _0x3b5bde;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index adfb84e..4baa2fa 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 _0xe755=['define','SmsTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x230d90,_0x2e96de){var _0x13487c=function(_0x44ff30){while(--_0x44ff30){_0x230d90['push'](_0x230d90['shift']());}};_0x13487c(++_0x2e96de);}(_0xe755,0xe7));var _0x5e75=function(_0x3b2d98,_0xaa0b26){_0x3b2d98=_0x3b2d98-0x0;var _0x256bf1=_0xe755[_0x3b2d98];return _0x256bf1;};'use strict';var _=require(_0x5e75('0x0'));var util=require('util');var logger=require(_0x5e75('0x1'))('api');var moment=require(_0x5e75('0x2'));var BPromise=require(_0x5e75('0x3'));var rp=require(_0x5e75('0x4'));var fs=require('fs');var path=require(_0x5e75('0x5'));var rimraf=require(_0x5e75('0x6'));var config=require(_0x5e75('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x5e75('0x8')]=function(_0x116b0d,_0x5d6247){return _0x116b0d[_0x5e75('0x9')](_0x5e75('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x5e75('0xb'),'fields':[_0x5e75('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce53=['../../config/logger','api','moment','request-promise','path','rimraf','./smsTransferReport.attributes','exports','SmsTransferReport','lodash','util'];(function(_0x4fcad2,_0x469f0a){var _0xf91dbc=function(_0x5d0812){while(--_0x5d0812){_0x4fcad2['push'](_0x4fcad2['shift']());}};_0xf91dbc(++_0x469f0a);}(_0xce53,0x106));var _0x3ce5=function(_0x34be3d,_0x3c6ba1){_0x34be3d=_0x34be3d-0x0;var _0xe9fe2d=_0xce53[_0x34be3d];return _0xe9fe2d;};'use strict';var _=require(_0x3ce5('0x0'));var util=require(_0x3ce5('0x1'));var logger=require(_0x3ce5('0x2'))(_0x3ce5('0x3'));var moment=require(_0x3ce5('0x4'));var BPromise=require('bluebird');var rp=require(_0x3ce5('0x5'));var fs=require('fs');var path=require(_0x3ce5('0x6'));var rimraf=require(_0x3ce5('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ce5('0x8'));module[_0x3ce5('0x9')]=function(_0x372e76,_0x23fa1e){return _0x372e76['define'](_0x3ce5('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 971b21c..8a847e3 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 _0xaeb0=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x33d159,_0x433b98){var _0x2ebbb2=function(_0x377e52){while(--_0x377e52){_0x33d159['push'](_0x33d159['shift']());}};_0x2ebbb2(++_0x433b98);}(_0xaeb0,0x152));var _0x0aeb=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xaeb0[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x0aeb('0x0'));var moment=require(_0x0aeb('0x1'));var BPromise=require(_0x0aeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aeb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aeb('0x4'));var logger=require(_0x0aeb('0x5'))(_0x0aeb('0x6'));var config=require(_0x0aeb('0x7'));var jayson=require(_0x0aeb('0x8'));var client=jayson[_0x0aeb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ed79,_0x54df15,_0x4410f9){return new BPromise(function(_0x24be3f,_0x38444b){return client[_0x0aeb('0xa')](_0x30ed79,_0x4410f9)[_0x0aeb('0xb')](function(_0x519ed9){logger[_0x0aeb('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x54df15,_0x0aeb('0xd'));logger[_0x0aeb('0xe')](_0x0aeb('0xf'),_0x54df15,_0x0aeb('0xd'),JSON[_0x0aeb('0x10')](_0x519ed9));if(_0x519ed9[_0x0aeb('0x11')]){if(_0x519ed9[_0x0aeb('0x11')][_0x0aeb('0x12')]===0x1f4){logger[_0x0aeb('0x11')](_0x0aeb('0x13'),_0x54df15,_0x519ed9['error'][_0x0aeb('0x14')]);return _0x38444b(_0x519ed9[_0x0aeb('0x11')][_0x0aeb('0x14')]);}logger[_0x0aeb('0x11')](_0x0aeb('0x13'),_0x54df15,_0x519ed9[_0x0aeb('0x11')]['message']);return _0x24be3f(_0x519ed9['error'][_0x0aeb('0x14')]);}else{logger[_0x0aeb('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x54df15,_0x0aeb('0xd'));_0x24be3f(_0x519ed9[_0x0aeb('0x15')][_0x0aeb('0x14')]);}})[_0x0aeb('0x16')](function(_0x4082bb){logger['error'](_0x0aeb('0x13'),_0x54df15,_0x4082bb);_0x38444b(_0x4082bb);});});} \ No newline at end of file +var _0x5fc1=['info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0xd1998b,_0x3a699c){var _0x5cd3f0=function(_0x1233b0){while(--_0x1233b0){_0xd1998b['push'](_0xd1998b['shift']());}};_0x5cd3f0(++_0x3a699c);}(_0x5fc1,0x14a));var _0x15fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15fc('0x0'));var util=require(_0x15fc('0x1'));var moment=require(_0x15fc('0x2'));var BPromise=require(_0x15fc('0x3'));var rs=require(_0x15fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15fc('0x6'))(_0x15fc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x15fc('0x8')][_0x15fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a7874,_0xc32ae2,_0x6e2105){return new BPromise(function(_0x955acd,_0x4466ac){return client['request'](_0x3a7874,_0x6e2105)['then'](function(_0x5517fd){logger[_0x15fc('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0xc32ae2,'request\x20sent');logger[_0x15fc('0xb')](_0x15fc('0xc'),_0xc32ae2,_0x15fc('0xd'),JSON[_0x15fc('0xe')](_0x5517fd));if(_0x5517fd['error']){if(_0x5517fd['error'][_0x15fc('0xf')]===0x1f4){logger[_0x15fc('0x10')](_0x15fc('0x11'),_0xc32ae2,_0x5517fd[_0x15fc('0x10')][_0x15fc('0x12')]);return _0x4466ac(_0x5517fd[_0x15fc('0x10')][_0x15fc('0x12')]);}logger[_0x15fc('0x10')](_0x15fc('0x11'),_0xc32ae2,_0x5517fd[_0x15fc('0x10')][_0x15fc('0x12')]);return _0x955acd(_0x5517fd[_0x15fc('0x10')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xc32ae2,_0x15fc('0xd'));_0x955acd(_0x5517fd[_0x15fc('0x13')]['message']);}})['catch'](function(_0xe635ce){logger['error'](_0x15fc('0x11'),_0xc32ae2,_0xe635ce);_0x4466ac(_0xe635ce);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index feeabae..f46b668 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 _0x27a4=['show','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','put','update','delete','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x27a4,0xd8));var _0x427a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x27a4[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x427a('0x0'));var express=require(_0x427a('0x1'));var router=express['Router']();var auth=require(_0x427a('0x2'));var interaction=require(_0x427a('0x3'));var config=require('../../config/environment');var controller=require(_0x427a('0x4'));router[_0x427a('0x5')]('/',auth['isAuthenticated'](),controller[_0x427a('0x6')]);router[_0x427a('0x5')](_0x427a('0x7'),auth['isAuthenticated'](),controller[_0x427a('0x8')]);router[_0x427a('0x5')](_0x427a('0x9'),auth[_0x427a('0xa')](),controller[_0x427a('0xb')]);var upload=multer({'storage':multer[_0x427a('0xc')]({'destination':function(_0x54ac66,_0x10c90a,_0x1469de){_0x1469de(null,path[_0x427a('0xd')](config[_0x427a('0xe')],_0x427a('0xf')));},'filename':function(_0x389a17,_0xe6a21e,_0x338d5f){_0xe6a21e[_0x427a('0x10')]=_0xe6a21e['originalname'][_0x427a('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x338d5f(null,util[_0x427a('0x12')]('%s-%s%s',path[_0x427a('0x13')](_0xe6a21e[_0x427a('0x10')],path[_0x427a('0x14')](_0xe6a21e['originalname'])),Date['now'](),path[_0x427a('0x14')](_0xe6a21e['originalname'])));}})});router[_0x427a('0x15')]('/',upload[_0x427a('0x16')](_0x427a('0x17')),controller['create']);router[_0x427a('0x18')]('/:id',auth[_0x427a('0xa')](),controller[_0x427a('0x19')]);router['delete'](_0x427a('0x7'),auth[_0x427a('0xa')](),controller[_0x427a('0x1a')]);module[_0x427a('0x1b')]=router; \ No newline at end of file +var _0x561d=['diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','post','single','file','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','/:id','isAuthenticated','show','get','/:id/download','download'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x561d,0x127));var _0xd561=function(_0x185e2e,_0x26bc2c){_0x185e2e=_0x185e2e-0x0;var _0x5a4715=_0x561d[_0x185e2e];return _0x5a4715;};'use strict';var multer=require(_0xd561('0x0'));var util=require(_0xd561('0x1'));var path=require(_0xd561('0x2'));var timeout=require(_0xd561('0x3'));var express=require(_0xd561('0x4'));var router=express[_0xd561('0x5')]();var auth=require(_0xd561('0x6'));var interaction=require(_0xd561('0x7'));var config=require('../../config/environment');var controller=require(_0xd561('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd561('0x9'),auth[_0xd561('0xa')](),controller[_0xd561('0xb')]);router[_0xd561('0xc')](_0xd561('0xd'),auth[_0xd561('0xa')](),controller[_0xd561('0xe')]);var upload=multer({'storage':multer[_0xd561('0xf')]({'destination':function(_0x282c73,_0x53f21a,_0x199f90){_0x199f90(null,path[_0xd561('0x10')](config[_0xd561('0x11')],_0xd561('0x12')));},'filename':function(_0x6db9c0,_0x39092c,_0x239165){_0x39092c[_0xd561('0x13')]=_0x39092c[_0xd561('0x13')][_0xd561('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x239165(null,util['format'](_0xd561('0x15'),path[_0xd561('0x16')](_0x39092c[_0xd561('0x13')],path['extname'](_0x39092c[_0xd561('0x13')])),Date[_0xd561('0x17')](),path[_0xd561('0x18')](_0x39092c[_0xd561('0x13')])));}})});router[_0xd561('0x19')]('/',upload[_0xd561('0x1a')](_0xd561('0x1b')),controller['create']);router[_0xd561('0x1c')](_0xd561('0x9'),auth['isAuthenticated'](),controller[_0xd561('0x1d')]);router[_0xd561('0x1e')](_0xd561('0x9'),auth[_0xd561('0xa')](),controller[_0xd561('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0bd47fe..364fc86 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 _0x2189=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x25f583,_0x5b00b8){var _0x1fab64=function(_0x9dcf23){while(--_0x9dcf23){_0x25f583['push'](_0x25f583['shift']());}};_0x1fab64(++_0x5b00b8);}(_0x2189,0x12e));var _0x9218=function(_0x2a9093,_0x1c447d){_0x2a9093=_0x2a9093-0x0;var _0x291b9e=_0x2189[_0x2a9093];return _0x291b9e;};'use strict';var Sequelize=require('sequelize');module[_0x9218('0x0')]={'name':{'type':Sequelize[_0x9218('0x1')],'unique':_0x9218('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9218('0x1')]},'display_name':{'type':Sequelize[_0x9218('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x9218('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x9218('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9218('0x4')]},'original_channelCount':{'type':Sequelize[_0x9218('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x9218('0x4')]},'converted_channelCount':{'type':Sequelize[_0x9218('0x5')]},'converted_bitRate':{'type':Sequelize[_0x9218('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x9218('0x5')]}}; \ No newline at end of file +var _0x6175=['sequelize','exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x3b5bc7,_0x1bb500){var _0x1c86c9=function(_0x2597cd){while(--_0x2597cd){_0x3b5bc7['push'](_0x3b5bc7['shift']());}};_0x1c86c9(++_0x1bb500);}(_0x6175,0x134));var _0x5617=function(_0xf738be,_0x22b790){_0xf738be=_0xf738be-0x0;var _0x3fcfd5=_0x6175[_0xf738be];return _0x3fcfd5;};'use strict';var Sequelize=require(_0x5617('0x0'));module[_0x5617('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5617('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x5617('0x3')]},'original_format':{'type':Sequelize[_0x5617('0x3')]},'original_duration':{'type':Sequelize[_0x5617('0x4')]},'original_sampleCount':{'type':Sequelize[_0x5617('0x5')]},'original_channelCount':{'type':Sequelize[_0x5617('0x6')]},'original_bitRate':{'type':Sequelize[_0x5617('0x5')]},'original_sampleRate':{'type':Sequelize[_0x5617('0x6')]},'converted_format':{'type':Sequelize[_0x5617('0x3')]},'converted_duration':{'type':Sequelize[_0x5617('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x5617('0x5')]},'converted_channelCount':{'type':Sequelize[_0x5617('0x6')]},'converted_bitRate':{'type':Sequelize[_0x5617('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x5617('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index bf87848..479e3a0 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 _0xeb6c=['rows','catch','show','params','length','options','find','download','converted_format','join','save_name','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','duration','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','Sound','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll'];(function(_0x2ddc42,_0x426454){var _0x4105df=function(_0x32a731){while(--_0x32a731){_0x2ddc42['push'](_0x2ddc42['shift']());}};_0x4105df(++_0x426454);}(_0xeb6c,0x1a7));var _0xceb6=function(_0x5a974d,_0x4bf5f3){_0x5a974d=_0x5a974d-0x0;var _0x405a84=_0xeb6c[_0x5a974d];return _0x405a84;};'use strict';var pdf=require(_0xceb6('0x0'));var emlformat=require(_0xceb6('0x1'));var rimraf=require(_0xceb6('0x2'));var zipdir=require(_0xceb6('0x3'));var jsonpatch=require(_0xceb6('0x4'));var rp=require(_0xceb6('0x5'));var moment=require('moment');var BPromise=require(_0xceb6('0x6'));var Mustache=require(_0xceb6('0x7'));var util=require('util');var path=require(_0xceb6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xceb6('0x9'));var fs=require('fs');var _=require(_0xceb6('0xa'));var squel=require(_0xceb6('0xb'));var crypto=require(_0xceb6('0xc'));var jsforce=require(_0xceb6('0xd'));var deskjs=require(_0xceb6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xceb6('0xf'));var Papa=require(_0xceb6('0x10'));var Redis=require(_0xceb6('0x11'));var authService=require(_0xceb6('0x12'));var qs=require(_0xceb6('0x13'));var as=require(_0xceb6('0x14'));var hardwareService=require(_0xceb6('0x15'));var logger=require(_0xceb6('0x16'))(_0xceb6('0x17'));var utils=require(_0xceb6('0x18'));var config=require('../../config/environment');var db=require(_0xceb6('0x19'))['db'];function respondWithStatusCode(_0x52b3e9,_0x101fcb){_0x101fcb=_0x101fcb||0xcc;return function(_0x208e12){if(_0x208e12){return _0x52b3e9[_0xceb6('0x1a')](_0x101fcb);}return _0x52b3e9['status'](_0x101fcb)[_0xceb6('0x1b')]();};}function respondWithResult(_0x5e05c3,_0x10c97c){_0x10c97c=_0x10c97c||0xc8;return function(_0x388664){if(_0x388664){return _0x5e05c3[_0xceb6('0x1c')](_0x10c97c)['json'](_0x388664);}};}function respondWithFilteredResult(_0x48bb6d,_0x4cebcc){return function(_0x351d19){if(_0x351d19){var _0x4aead9=_0x351d19[_0xceb6('0x1d')],_0x471abe=_0x4cebcc['offset'],_0x26f2dc=_0x4cebcc[_0xceb6('0x1e')]+_0x4cebcc['limit'],_0x3f118a;if(_0x26f2dc>=_0x4aead9){_0x26f2dc=_0x4aead9;_0x3f118a=0xc8;}else{_0x3f118a=0xce;}_0x48bb6d[_0xceb6('0x1c')](_0x3f118a);return _0x48bb6d['set'](_0xceb6('0x1f'),_0x471abe+'-'+_0x26f2dc+'/'+_0x4aead9)[_0xceb6('0x20')](_0x351d19);}return null;};}function patchUpdates(_0x3d5a9b){return function(_0x3473df){try{jsonpatch[_0xceb6('0x21')](_0x3473df,_0x3d5a9b,!![]);}catch(_0x32d1df){return BPromise[_0xceb6('0x22')](_0x32d1df);}return _0x3473df[_0xceb6('0x23')]();};}function saveUpdates(_0x2508fb,_0x3efc39){return function(_0x530b37){if(_0x530b37){return _0x530b37[_0xceb6('0x24')](_0x2508fb)['then'](function(_0x4b7be8){return _0x4b7be8;});}return null;};}function removeEntity(_0x50d663,_0x443007){return function(_0x417e9f){if(_0x417e9f){return _0x417e9f[_0xceb6('0x25')]()[_0xceb6('0x26')](function(){var _0x158009=_0x417e9f[_0xceb6('0x27')]({'plain':!![]});var _0xa1a095=_0xceb6('0x28');return db[_0xceb6('0x29')]['destroy']({'where':{'type':_0xa1a095,'resourceId':_0x158009['id']}})['then'](function(){return _0x417e9f;});})[_0xceb6('0x26')](function(){_0x50d663[_0xceb6('0x1c')](0xcc)[_0xceb6('0x1b')]();});}};}function handleEntityNotFound(_0x3df445,_0x3f843b){return function(_0x159c05){if(!_0x159c05){_0x3df445[_0xceb6('0x1a')](0x194);}return _0x159c05;};}function handleError(_0x5b1d20,_0x2cb99d){_0x2cb99d=_0x2cb99d||0x1f4;return function(_0xe56e5d){logger[_0xceb6('0x2a')](_0xe56e5d[_0xceb6('0x2b')]);if(_0xe56e5d[_0xceb6('0x2c')]){delete _0xe56e5d[_0xceb6('0x2c')];}_0x5b1d20[_0xceb6('0x1c')](_0x2cb99d)[_0xceb6('0x2d')](_0xe56e5d);};}exports['index']=function(_0x531316,_0x190b6b){var _0x209f70={},_0x4c7f32={},_0x52601d={'count':0x0,'rows':[]};var _0x155b67=_['map'](db[_0xceb6('0x2e')][_0xceb6('0x2f')],function(_0x51c227){return{'name':_0x51c227[_0xceb6('0x30')],'type':_0x51c227[_0xceb6('0x31')]['key']};});_0x4c7f32[_0xceb6('0x32')]=_[_0xceb6('0x33')](_0x155b67,'name');_0x4c7f32[_0xceb6('0x34')]=_[_0xceb6('0x35')](_0x531316[_0xceb6('0x34')]);_0x4c7f32['filters']=_[_0xceb6('0x36')](_0x4c7f32[_0xceb6('0x32')],_0x4c7f32['query']);_0x209f70[_0xceb6('0x37')]=_[_0xceb6('0x36')](_0x4c7f32['model'],qs[_0xceb6('0x38')](_0x531316[_0xceb6('0x34')][_0xceb6('0x38')]));_0x209f70['attributes']=_0x209f70[_0xceb6('0x37')]['length']?_0x209f70[_0xceb6('0x37')]:_0x4c7f32[_0xceb6('0x32')];if(!_0x531316[_0xceb6('0x34')][_0xceb6('0x39')](_0xceb6('0x3a'))){_0x209f70['limit']=qs[_0xceb6('0x3b')](_0x531316[_0xceb6('0x34')][_0xceb6('0x3b')]);_0x209f70[_0xceb6('0x1e')]=qs[_0xceb6('0x1e')](_0x531316[_0xceb6('0x34')][_0xceb6('0x1e')]);}_0x209f70[_0xceb6('0x3c')]=qs[_0xceb6('0x3d')](_0x531316[_0xceb6('0x34')][_0xceb6('0x3d')]);_0x209f70[_0xceb6('0x3e')]=qs[_0xceb6('0x3f')](_['pick'](_0x531316['query'],_0x4c7f32['filters']),_0x155b67);if(_0x531316['query'][_0xceb6('0x40')]){_0x209f70['where']=_[_0xceb6('0x41')](_0x209f70[_0xceb6('0x3e')],{'$or':_[_0xceb6('0x33')](_0x155b67,function(_0x1ca6e8){if(_0x1ca6e8[_0xceb6('0x31')]!==_0xceb6('0x42')){var _0x1dcce6={};_0x1dcce6[_0x1ca6e8[_0xceb6('0x2c')]]={'$like':'%'+_0x531316[_0xceb6('0x34')][_0xceb6('0x40')]+'%'};return _0x1dcce6;}})});}_0x209f70=_['merge']({},_0x209f70,_0x531316['options']);var _0x43b442={'where':_0x209f70[_0xceb6('0x3e')]};return db[_0xceb6('0x2e')][_0xceb6('0x1d')](_0x43b442)[_0xceb6('0x26')](function(_0x391ac5){_0x52601d[_0xceb6('0x1d')]=_0x391ac5;if(_0x531316[_0xceb6('0x34')]['includeAll']){_0x209f70[_0xceb6('0x43')]=[{'all':!![]}];}return db[_0xceb6('0x2e')][_0xceb6('0x44')](_0x209f70);})['then'](function(_0x3d7531){_0x52601d[_0xceb6('0x45')]=_0x3d7531;return _0x52601d;})[_0xceb6('0x26')](respondWithFilteredResult(_0x190b6b,_0x209f70))[_0xceb6('0x46')](handleError(_0x190b6b,null));};exports[_0xceb6('0x47')]=function(_0x36b8a3,_0x315f68){var _0x20555d={'raw':!![],'where':{'id':_0x36b8a3[_0xceb6('0x48')]['id']}},_0x1096a9={};_0x1096a9[_0xceb6('0x32')]=_['keys'](db[_0xceb6('0x2e')][_0xceb6('0x2f')]);_0x1096a9[_0xceb6('0x34')]=_[_0xceb6('0x35')](_0x36b8a3[_0xceb6('0x34')]);_0x1096a9[_0xceb6('0x3f')]=_[_0xceb6('0x36')](_0x1096a9[_0xceb6('0x32')],_0x1096a9[_0xceb6('0x34')]);_0x20555d['attributes']=_[_0xceb6('0x36')](_0x1096a9['model'],qs[_0xceb6('0x38')](_0x36b8a3[_0xceb6('0x34')][_0xceb6('0x38')]));_0x20555d[_0xceb6('0x37')]=_0x20555d[_0xceb6('0x37')][_0xceb6('0x49')]?_0x20555d[_0xceb6('0x37')]:_0x1096a9['model'];if(_0x36b8a3[_0xceb6('0x34')]['includeAll']){_0x20555d[_0xceb6('0x43')]=[{'all':!![]}];}_0x20555d=_['merge']({},_0x20555d,_0x36b8a3[_0xceb6('0x4a')]);return db[_0xceb6('0x2e')][_0xceb6('0x4b')](_0x20555d)[_0xceb6('0x26')](handleEntityNotFound(_0x315f68,null))[_0xceb6('0x26')](respondWithResult(_0x315f68,null))['catch'](handleError(_0x315f68,null));};exports[_0xceb6('0x4c')]=function(_0x24ef83,_0x34d875,_0x5e816a){return db[_0xceb6('0x2e')][_0xceb6('0x4b')]({'where':{'id':_0x24ef83['params']['id']},'attributes':[_0xceb6('0x2c'),'save_name',_0xceb6('0x4d')],'raw':!![]})[_0xceb6('0x26')](handleEntityNotFound(_0x34d875,null))[_0xceb6('0x26')](function(_0x48d267){if(_0x48d267){if(!fs['existsSync'](path[_0xceb6('0x4e')](config['root'],'server/files/sounds/converted',_0x48d267[_0xceb6('0x4f')]+'.'+_0x48d267[_0xceb6('0x4d')]))){throw new db[(_0xceb6('0x50'))]['ValidationError'](_0xceb6('0x51'));}return _0x34d875['download'](path[_0xceb6('0x4e')](config['root'],_0xceb6('0x52'),util[_0xceb6('0x53')](_0xceb6('0x54'),_0x48d267[_0xceb6('0x4f')],_0x48d267[_0xceb6('0x4d')])),util[_0xceb6('0x53')](_0xceb6('0x54'),_0x48d267[_0xceb6('0x2c')],_0x48d267['converted_format']));}return null;})[_0xceb6('0x46')](handleError(_0x34d875,null));};exports['create']=function(_0x1e43dd,_0x9b1574,_0x55c2d8){var _0x264547={'name':path[_0xceb6('0x55')](_0x1e43dd['file'][_0xceb6('0x56')],path[_0xceb6('0x57')](_0x1e43dd[_0xceb6('0x58')]['originalname'])),'save_name':path[_0xceb6('0x55')](_0x1e43dd[_0xceb6('0x58')]['filename'],path[_0xceb6('0x57')](_0x1e43dd[_0xceb6('0x58')][_0xceb6('0x59')])),'original_format':path['extname'](_0x1e43dd['file'][_0xceb6('0x56')])[_0xceb6('0x5a')](0x1),'converted_format':_0xceb6('0x5b')};var _0x55d450=path[_0xceb6('0x4e')](config[_0xceb6('0x5c')],_0xceb6('0x5d'),_0x1e43dd['file'][_0xceb6('0x59')]);var _0x41d3bd=path[_0xceb6('0x4e')](config['root'],_0xceb6('0x52'),util['format'](_0xceb6('0x54'),path[_0xceb6('0x55')](_0x1e43dd[_0xceb6('0x58')]['filename'],path[_0xceb6('0x57')](_0x1e43dd['file'][_0xceb6('0x59')])),_0x264547[_0xceb6('0x4d')]));logger[_0xceb6('0x5e')](_0xceb6('0x5f'),_0x55d450);logger[_0xceb6('0x5e')](_0xceb6('0x60'),_0x41d3bd);try{fs[_0xceb6('0x61')](_0x55d450,parseInt('0777',0x8));var _0x2c9864=sox[_0xceb6('0x62')](_0x55d450,_0x41d3bd,{'sampleRate':0x1f40,'format':_0xceb6('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c9864['on'](_0xceb6('0x2a'),function(_0x3ff0fd){fs[_0xceb6('0x63')](_0x55d450);_0x9b1574['status'](0x1f4)[_0xceb6('0x2d')](_0x3ff0fd);});_0x2c9864['on'](_0xceb6('0x64'),function(_0x17646a){_0x264547['original_duration']=isNaN(_0x17646a[_0xceb6('0x65')])?null:_0x17646a[_0xceb6('0x65')]*0x3e8;_0x264547['original_sampleCount']=isNaN(_0x17646a[_0xceb6('0x66')])?null:_0x17646a[_0xceb6('0x66')];_0x264547['original_channelCount']=isNaN(_0x17646a[_0xceb6('0x67')])?null:_0x17646a['channelCount'];_0x264547['original_bitRate']=isNaN(_0x17646a['bitRate'])?null:_0x17646a[_0xceb6('0x68')];_0x264547[_0xceb6('0x69')]=isNaN(_0x17646a[_0xceb6('0x6a')])?null:_0x17646a[_0xceb6('0x6a')];});_0x2c9864['on']('dest',function(_0x2a35b8){_0x264547['converted_duration']=isNaN(_0x2a35b8['duration'])?null:_0x2a35b8['duration']*0x3e8;_0x264547['converted_sampleCount']=isNaN(_0x2a35b8[_0xceb6('0x66')])?null:_0x2a35b8[_0xceb6('0x66')];_0x264547[_0xceb6('0x6b')]=isNaN(_0x2a35b8[_0xceb6('0x67')])?null:_0x2a35b8[_0xceb6('0x67')];_0x264547[_0xceb6('0x6c')]=isNaN(_0x2a35b8['bitRate'])?null:_0x2a35b8['bitRate'];_0x264547[_0xceb6('0x6d')]=isNaN(_0x2a35b8[_0xceb6('0x6a')])?null:_0x2a35b8[_0xceb6('0x6a')];});_0x2c9864['on'](_0xceb6('0x1b'),function(){fs[_0xceb6('0x61')](_0x41d3bd,parseInt(_0xceb6('0x6e'),0x8));return db[_0xceb6('0x2e')]['create'](_0x264547)['then'](function(_0x3955a4){var _0x3cf52a={'role':_0x1e43dd[_0xceb6('0x6f')][_0xceb6('0x70')],'userProfileId':_0x1e43dd[_0xceb6('0x6f')][_0xceb6('0x71')]};if(!_0x3cf52a)throw new Error(_0xceb6('0x72'));if(_0x3cf52a['role']===_0xceb6('0x73')){var _0x12d616=_0x3955a4['get']({'plain':!![]});return db[_0xceb6('0x74')][_0xceb6('0x4b')]({'where':{'name':_0xceb6('0x28'),'userProfileId':_0x3cf52a[_0xceb6('0x71')]},'raw':!![]})[_0xceb6('0x26')](function(_0xc84bdd){if(_0xc84bdd&&_0xc84bdd[_0xceb6('0x75')]===0x0){return db['UserProfileResource'][_0xceb6('0x76')]({'name':_0x12d616[_0xceb6('0x2c')],'resourceId':_0x12d616['id'],'type':_0xc84bdd['name'],'sectionId':_0xc84bdd['id']},{})[_0xceb6('0x26')](function(){return _0x3955a4;});}else{return _0x3955a4;}})['catch'](function(_0x46387e){logger[_0xceb6('0x2a')](_0xceb6('0x77'),_0x46387e);throw _0x46387e;});}return _0x3955a4;})[_0xceb6('0x26')](respondWithResult(_0x9b1574,null))[_0xceb6('0x46')](handleError(_0x9b1574,null));});_0x2c9864['start']();}catch(_0x437fce){_0x9b1574[_0xceb6('0x1c')](0x1f4)[_0xceb6('0x2d')](_0x437fce);}};exports['update']=function(_0x5fd897,_0xf9dd99,_0x35102c){return db[_0xceb6('0x2e')][_0xceb6('0x4b')]({'where':{'id':_0x5fd897[_0xceb6('0x48')]['id']}})['then'](handleEntityNotFound(_0xf9dd99,null))[_0xceb6('0x26')](saveUpdates(_[_0xceb6('0x78')](_0x5fd897[_0xceb6('0x6f')],[_0xceb6('0x2c'),_0xceb6('0x79')]),null))[_0xceb6('0x26')](respondWithResult(_0xf9dd99,null))[_0xceb6('0x46')](handleError(_0xf9dd99,null));};exports[_0xceb6('0x7a')]=function(_0x3639b8,_0x154a40,_0x3dd363){return db['Sound'][_0xceb6('0x4b')]({'where':{'id':_0x3639b8[_0xceb6('0x48')]['id']}})['then'](function(_0x13be3f){if(_0x13be3f){return _0x13be3f[_0xceb6('0x25')]();}})[_0xceb6('0x26')](function(_0x11ffda){var _0x12cf9e=path[_0xceb6('0x4e')](config[_0xceb6('0x5c')],_0xceb6('0x5d'),util[_0xceb6('0x53')]('%s.%s',_0x11ffda[_0xceb6('0x4f')],_0x11ffda['original_format']));var _0x2106be=path[_0xceb6('0x4e')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x11ffda['save_name'],_0x11ffda[_0xceb6('0x4d')]));fs[_0xceb6('0x63')](_0x12cf9e);fs[_0xceb6('0x63')](_0x2106be);return _0x11ffda;})[_0xceb6('0x26')](function(_0x227433){if(_0x227433){return _0x154a40[_0xceb6('0x1c')](0xcc)[_0xceb6('0x1b')]();}})[_0xceb6('0x26')](handleEntityNotFound(_0x154a40,null))[_0xceb6('0x46')](handleError(_0x154a40,null));}; \ No newline at end of file +var _0xd030=['converted_channelCount','converted_sampleRate','end','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Sounds','stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','Sound','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','download','converted_format','join','server/files/sounds/converted','save_name','ValidationError','format','%s.%s','basename','file','originalname','filename','extname','substring','wav','root','server/files/sounds/original','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount'];(function(_0x43aedf,_0x5a6d8a){var _0x3fe5af=function(_0x1f3da9){while(--_0x1f3da9){_0x43aedf['push'](_0x43aedf['shift']());}};_0x3fe5af(++_0x5a6d8a);}(_0xd030,0x16c));var _0x0d03=function(_0x13de9d,_0x4e8d4a){_0x13de9d=_0x13de9d-0x0;var _0x52097d=_0xd030[_0x13de9d];return _0x52097d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d03('0x1'));var jsonpatch=require(_0x0d03('0x2'));var rp=require(_0x0d03('0x3'));var moment=require(_0x0d03('0x4'));var BPromise=require(_0x0d03('0x5'));var Mustache=require(_0x0d03('0x6'));var util=require(_0x0d03('0x7'));var path=require(_0x0d03('0x8'));var sox=require('sox');var csv=require(_0x0d03('0x9'));var ejs=require(_0x0d03('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d03('0xb'));var crypto=require('crypto');var jsforce=require(_0x0d03('0xc'));var deskjs=require(_0x0d03('0xd'));var toCsv=require(_0x0d03('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d03('0xe'));var qs=require(_0x0d03('0xf'));var as=require(_0x0d03('0x10'));var hardwareService=require(_0x0d03('0x11'));var logger=require(_0x0d03('0x12'))(_0x0d03('0x13'));var utils=require(_0x0d03('0x14'));var config=require(_0x0d03('0x15'));var db=require(_0x0d03('0x16'))['db'];function respondWithStatusCode(_0x390c4d,_0x59adf5){_0x59adf5=_0x59adf5||0xcc;return function(_0x2ccbb4){if(_0x2ccbb4){return _0x390c4d[_0x0d03('0x17')](_0x59adf5);}return _0x390c4d[_0x0d03('0x18')](_0x59adf5)['end']();};}function respondWithResult(_0x292863,_0x426f52){_0x426f52=_0x426f52||0xc8;return function(_0x24b53e){if(_0x24b53e){return _0x292863['status'](_0x426f52)[_0x0d03('0x19')](_0x24b53e);}};}function respondWithFilteredResult(_0x438466,_0x3d2050){return function(_0x35c7f2){if(_0x35c7f2){var _0x57dc67=_0x35c7f2['count'],_0x40ec9b=_0x3d2050[_0x0d03('0x1a')],_0x196e09=_0x3d2050[_0x0d03('0x1a')]+_0x3d2050[_0x0d03('0x1b')],_0x1e4a8b;if(_0x196e09>=_0x57dc67){_0x196e09=_0x57dc67;_0x1e4a8b=0xc8;}else{_0x1e4a8b=0xce;}_0x438466[_0x0d03('0x18')](_0x1e4a8b);return _0x438466[_0x0d03('0x1c')](_0x0d03('0x1d'),_0x40ec9b+'-'+_0x196e09+'/'+_0x57dc67)[_0x0d03('0x19')](_0x35c7f2);}return null;};}function patchUpdates(_0x46378f){return function(_0x3719f6){try{jsonpatch['apply'](_0x3719f6,_0x46378f,!![]);}catch(_0x36b8ab){return BPromise[_0x0d03('0x1e')](_0x36b8ab);}return _0x3719f6[_0x0d03('0x1f')]();};}function saveUpdates(_0x52174d,_0x406968){return function(_0x5debae){if(_0x5debae){return _0x5debae[_0x0d03('0x20')](_0x52174d)[_0x0d03('0x21')](function(_0x8e0457){return _0x8e0457;});}return null;};}function removeEntity(_0x11e41e,_0xb0bc9b){return function(_0x34b8d9){if(_0x34b8d9){return _0x34b8d9[_0x0d03('0x22')]()[_0x0d03('0x21')](function(){var _0x26d8b7=_0x34b8d9[_0x0d03('0x23')]({'plain':!![]});var _0x5a67d0=_0x0d03('0x24');return db['UserProfileResource'][_0x0d03('0x22')]({'where':{'type':_0x5a67d0,'resourceId':_0x26d8b7['id']}})['then'](function(){return _0x34b8d9;});})[_0x0d03('0x21')](function(){_0x11e41e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xacdace,_0x4e0a20){return function(_0xe67bb2){if(!_0xe67bb2){_0xacdace[_0x0d03('0x17')](0x194);}return _0xe67bb2;};}function handleError(_0x51fe7e,_0x2d9376){_0x2d9376=_0x2d9376||0x1f4;return function(_0x262a12){logger['error'](_0x262a12[_0x0d03('0x25')]);if(_0x262a12[_0x0d03('0x26')]){delete _0x262a12[_0x0d03('0x26')];}_0x51fe7e[_0x0d03('0x18')](_0x2d9376)[_0x0d03('0x27')](_0x262a12);};}exports[_0x0d03('0x28')]=function(_0x4ebc9c,_0x467fd3){var _0x2b8827={},_0x228d00={},_0x1e71ae={'count':0x0,'rows':[]};var _0x40eb8b=_['map'](db['Sound']['rawAttributes'],function(_0x8ce938){return{'name':_0x8ce938[_0x0d03('0x29')],'type':_0x8ce938[_0x0d03('0x2a')][_0x0d03('0x2b')]};});_0x228d00['model']=_[_0x0d03('0x2c')](_0x40eb8b,'name');_0x228d00[_0x0d03('0x2d')]=_[_0x0d03('0x2e')](_0x4ebc9c['query']);_0x228d00[_0x0d03('0x2f')]=_[_0x0d03('0x30')](_0x228d00['model'],_0x228d00['query']);_0x2b8827[_0x0d03('0x31')]=_[_0x0d03('0x30')](_0x228d00[_0x0d03('0x32')],qs['fields'](_0x4ebc9c['query'][_0x0d03('0x33')]));_0x2b8827[_0x0d03('0x31')]=_0x2b8827['attributes']['length']?_0x2b8827[_0x0d03('0x31')]:_0x228d00[_0x0d03('0x32')];if(!_0x4ebc9c[_0x0d03('0x2d')][_0x0d03('0x34')]('nolimit')){_0x2b8827[_0x0d03('0x1b')]=qs[_0x0d03('0x1b')](_0x4ebc9c['query'][_0x0d03('0x1b')]);_0x2b8827[_0x0d03('0x1a')]=qs[_0x0d03('0x1a')](_0x4ebc9c[_0x0d03('0x2d')][_0x0d03('0x1a')]);}_0x2b8827[_0x0d03('0x35')]=qs[_0x0d03('0x36')](_0x4ebc9c['query'][_0x0d03('0x36')]);_0x2b8827[_0x0d03('0x37')]=qs[_0x0d03('0x2f')](_[_0x0d03('0x38')](_0x4ebc9c[_0x0d03('0x2d')],_0x228d00['filters']),_0x40eb8b);if(_0x4ebc9c[_0x0d03('0x2d')]['filter']){_0x2b8827['where']=_['merge'](_0x2b8827[_0x0d03('0x37')],{'$or':_['map'](_0x40eb8b,function(_0x3052a2){if(_0x3052a2['type']!==_0x0d03('0x39')){var _0x223e69={};_0x223e69[_0x3052a2['name']]={'$like':'%'+_0x4ebc9c[_0x0d03('0x2d')]['filter']+'%'};return _0x223e69;}})});}_0x2b8827=_[_0x0d03('0x3a')]({},_0x2b8827,_0x4ebc9c[_0x0d03('0x3b')]);var _0x5a2db9={'where':_0x2b8827[_0x0d03('0x37')]};return db[_0x0d03('0x3c')][_0x0d03('0x3d')](_0x5a2db9)[_0x0d03('0x21')](function(_0x2f786c){_0x1e71ae[_0x0d03('0x3d')]=_0x2f786c;if(_0x4ebc9c['query'][_0x0d03('0x3e')]){_0x2b8827[_0x0d03('0x3f')]=[{'all':!![]}];}return db[_0x0d03('0x3c')][_0x0d03('0x40')](_0x2b8827);})[_0x0d03('0x21')](function(_0x1922e3){_0x1e71ae[_0x0d03('0x41')]=_0x1922e3;return _0x1e71ae;})['then'](respondWithFilteredResult(_0x467fd3,_0x2b8827))[_0x0d03('0x42')](handleError(_0x467fd3,null));};exports[_0x0d03('0x43')]=function(_0x1f7d99,_0x2806eb){var _0x4f6a67={'raw':!![],'where':{'id':_0x1f7d99[_0x0d03('0x44')]['id']}},_0x57a139={};_0x57a139[_0x0d03('0x32')]=_['keys'](db[_0x0d03('0x3c')][_0x0d03('0x45')]);_0x57a139[_0x0d03('0x2d')]=_[_0x0d03('0x2e')](_0x1f7d99[_0x0d03('0x2d')]);_0x57a139[_0x0d03('0x2f')]=_[_0x0d03('0x30')](_0x57a139[_0x0d03('0x32')],_0x57a139[_0x0d03('0x2d')]);_0x4f6a67[_0x0d03('0x31')]=_[_0x0d03('0x30')](_0x57a139[_0x0d03('0x32')],qs[_0x0d03('0x33')](_0x1f7d99[_0x0d03('0x2d')][_0x0d03('0x33')]));_0x4f6a67[_0x0d03('0x31')]=_0x4f6a67['attributes'][_0x0d03('0x46')]?_0x4f6a67[_0x0d03('0x31')]:_0x57a139[_0x0d03('0x32')];if(_0x1f7d99['query']['includeAll']){_0x4f6a67[_0x0d03('0x3f')]=[{'all':!![]}];}_0x4f6a67=_[_0x0d03('0x3a')]({},_0x4f6a67,_0x1f7d99[_0x0d03('0x3b')]);return db['Sound'][_0x0d03('0x47')](_0x4f6a67)[_0x0d03('0x21')](handleEntityNotFound(_0x2806eb,null))[_0x0d03('0x21')](respondWithResult(_0x2806eb,null))[_0x0d03('0x42')](handleError(_0x2806eb,null));};exports[_0x0d03('0x48')]=function(_0x1b8606,_0x19a595,_0x38df6e){return db[_0x0d03('0x3c')][_0x0d03('0x47')]({'where':{'id':_0x1b8606[_0x0d03('0x44')]['id']},'attributes':[_0x0d03('0x26'),'save_name',_0x0d03('0x49')],'raw':!![]})[_0x0d03('0x21')](handleEntityNotFound(_0x19a595,null))[_0x0d03('0x21')](function(_0x2cd7e1){if(_0x2cd7e1){if(!fs['existsSync'](path[_0x0d03('0x4a')](config['root'],_0x0d03('0x4b'),_0x2cd7e1[_0x0d03('0x4c')]+'.'+_0x2cd7e1[_0x0d03('0x49')]))){throw new db['Sequelize'][(_0x0d03('0x4d'))]('Sound\x20not\x20found');}return _0x19a595[_0x0d03('0x48')](path[_0x0d03('0x4a')](config['root'],_0x0d03('0x4b'),util[_0x0d03('0x4e')](_0x0d03('0x4f'),_0x2cd7e1[_0x0d03('0x4c')],_0x2cd7e1['converted_format'])),util[_0x0d03('0x4e')](_0x0d03('0x4f'),_0x2cd7e1[_0x0d03('0x26')],_0x2cd7e1[_0x0d03('0x49')]));}return null;})[_0x0d03('0x42')](handleError(_0x19a595,null));};exports['create']=function(_0x1a2d5a,_0x33be8e,_0x1d689e){var _0x568639={'name':path[_0x0d03('0x50')](_0x1a2d5a[_0x0d03('0x51')][_0x0d03('0x52')],path['extname'](_0x1a2d5a[_0x0d03('0x51')][_0x0d03('0x52')])),'save_name':path[_0x0d03('0x50')](_0x1a2d5a[_0x0d03('0x51')][_0x0d03('0x53')],path['extname'](_0x1a2d5a['file'][_0x0d03('0x53')])),'original_format':path[_0x0d03('0x54')](_0x1a2d5a['file']['originalname'])[_0x0d03('0x55')](0x1),'converted_format':_0x0d03('0x56')};var _0x377279=path[_0x0d03('0x4a')](config[_0x0d03('0x57')],_0x0d03('0x58'),_0x1a2d5a[_0x0d03('0x51')][_0x0d03('0x53')]);var _0x10cc50=path[_0x0d03('0x4a')](config[_0x0d03('0x57')],_0x0d03('0x4b'),util[_0x0d03('0x4e')](_0x0d03('0x4f'),path[_0x0d03('0x50')](_0x1a2d5a['file'][_0x0d03('0x53')],path[_0x0d03('0x54')](_0x1a2d5a[_0x0d03('0x51')][_0x0d03('0x53')])),_0x568639[_0x0d03('0x49')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x377279);logger['info'](_0x0d03('0x59'),_0x10cc50);try{fs[_0x0d03('0x5a')](_0x377279,parseInt(_0x0d03('0x5b'),0x8));var _0x8de93e=sox[_0x0d03('0x5c')](_0x377279,_0x10cc50,{'sampleRate':0x1f40,'format':_0x0d03('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x8de93e['on']('error',function(_0x289e6a){fs[_0x0d03('0x5d')](_0x377279);_0x33be8e[_0x0d03('0x18')](0x1f4)['send'](_0x289e6a);});_0x8de93e['on']('src',function(_0x11db4e){_0x568639['original_duration']=isNaN(_0x11db4e[_0x0d03('0x5e')])?null:_0x11db4e[_0x0d03('0x5e')]*0x3e8;_0x568639[_0x0d03('0x5f')]=isNaN(_0x11db4e[_0x0d03('0x60')])?null:_0x11db4e['sampleCount'];_0x568639[_0x0d03('0x61')]=isNaN(_0x11db4e[_0x0d03('0x62')])?null:_0x11db4e['channelCount'];_0x568639['original_bitRate']=isNaN(_0x11db4e[_0x0d03('0x63')])?null:_0x11db4e[_0x0d03('0x63')];_0x568639[_0x0d03('0x64')]=isNaN(_0x11db4e[_0x0d03('0x65')])?null:_0x11db4e[_0x0d03('0x65')];});_0x8de93e['on'](_0x0d03('0x66'),function(_0x7f601){_0x568639['converted_duration']=isNaN(_0x7f601['duration'])?null:_0x7f601[_0x0d03('0x5e')]*0x3e8;_0x568639[_0x0d03('0x67')]=isNaN(_0x7f601['sampleCount'])?null:_0x7f601[_0x0d03('0x60')];_0x568639[_0x0d03('0x68')]=isNaN(_0x7f601['channelCount'])?null:_0x7f601[_0x0d03('0x62')];_0x568639['converted_bitRate']=isNaN(_0x7f601[_0x0d03('0x63')])?null:_0x7f601[_0x0d03('0x63')];_0x568639[_0x0d03('0x69')]=isNaN(_0x7f601['sampleRate'])?null:_0x7f601[_0x0d03('0x65')];});_0x8de93e['on'](_0x0d03('0x6a'),function(){fs[_0x0d03('0x5a')](_0x10cc50,parseInt(_0x0d03('0x5b'),0x8));return db[_0x0d03('0x3c')][_0x0d03('0x6b')](_0x568639)[_0x0d03('0x21')](function(_0x77181f){var _0x48af7a={'role':_0x1a2d5a[_0x0d03('0x6c')][_0x0d03('0x6d')],'userProfileId':_0x1a2d5a['body']['userProfileId']};if(!_0x48af7a)throw new Error(_0x0d03('0x6e'));if(_0x48af7a['role']===_0x0d03('0x6f')){var _0x4e6be0=_0x77181f[_0x0d03('0x23')]({'plain':!![]});return db[_0x0d03('0x70')][_0x0d03('0x47')]({'where':{'name':'Sounds','userProfileId':_0x48af7a['userProfileId']},'raw':!![]})[_0x0d03('0x21')](function(_0x304bc4){if(_0x304bc4&&_0x304bc4['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d03('0x6b')]({'name':_0x4e6be0[_0x0d03('0x26')],'resourceId':_0x4e6be0['id'],'type':_0x304bc4['name'],'sectionId':_0x304bc4['id']},{})[_0x0d03('0x21')](function(){return _0x77181f;});}else{return _0x77181f;}})[_0x0d03('0x42')](function(_0x48e647){logger['error'](_0x0d03('0x71'),_0x48e647);throw _0x48e647;});}return _0x77181f;})['then'](respondWithResult(_0x33be8e,null))[_0x0d03('0x42')](handleError(_0x33be8e,null));});_0x8de93e[_0x0d03('0x72')]();}catch(_0x5e0f61){_0x33be8e[_0x0d03('0x18')](0x1f4)['send'](_0x5e0f61);}};exports['update']=function(_0x162887,_0x3a5226,_0x5b7bdb){return db['Sound'][_0x0d03('0x47')]({'where':{'id':_0x162887[_0x0d03('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a5226,null))['then'](saveUpdates(_[_0x0d03('0x38')](_0x162887[_0x0d03('0x6c')],[_0x0d03('0x26'),_0x0d03('0x73')]),null))[_0x0d03('0x21')](respondWithResult(_0x3a5226,null))['catch'](handleError(_0x3a5226,null));};exports[_0x0d03('0x74')]=function(_0xa9db8c,_0x574c4b,_0x12ad24){return db['Sound']['find']({'where':{'id':_0xa9db8c[_0x0d03('0x44')]['id']}})[_0x0d03('0x21')](function(_0x273aa0){if(_0x273aa0){return _0x273aa0['destroy']();}})[_0x0d03('0x21')](function(_0x37e626){var _0x1c2011=path[_0x0d03('0x4a')](config['root'],'server/files/sounds/original',util[_0x0d03('0x4e')](_0x0d03('0x4f'),_0x37e626['save_name'],_0x37e626['original_format']));var _0xb213d3=path[_0x0d03('0x4a')](config[_0x0d03('0x57')],'server/files/sounds/converted',util[_0x0d03('0x4e')](_0x0d03('0x4f'),_0x37e626['save_name'],_0x37e626[_0x0d03('0x49')]));fs[_0x0d03('0x5d')](_0x1c2011);fs[_0x0d03('0x5d')](_0xb213d3);return _0x37e626;})['then'](function(_0x3cd0cb){if(_0x3cd0cb){return _0x574c4b[_0x0d03('0x18')](0xcc)[_0x0d03('0x6a')]();}})[_0x0d03('0x21')](handleEntityNotFound(_0x574c4b,null))[_0x0d03('0x42')](handleError(_0x574c4b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d2dfe3a..72c254c 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 _0xd347=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','define','Sound'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xd347,0x155));var _0x7d34=function(_0x5c591f,_0x2b0678){_0x5c591f=_0x5c591f-0x0;var _0x5d90b9=_0xd347[_0x5c591f];return _0x5d90b9;};'use strict';var _=require(_0x7d34('0x0'));var util=require(_0x7d34('0x1'));var logger=require('../../config/logger')(_0x7d34('0x2'));var moment=require(_0x7d34('0x3'));var BPromise=require(_0x7d34('0x4'));var rp=require(_0x7d34('0x5'));var fs=require('fs');var path=require(_0x7d34('0x6'));var rimraf=require(_0x7d34('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d34('0x8'));module['exports']=function(_0x519500,_0x2d02de){return _0x519500[_0x7d34('0x9')](_0x7d34('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a02=['Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','path','rimraf','exports','define'];(function(_0x404b24,_0xa0381e){var _0x3aa8fc=function(_0x31f567){while(--_0x31f567){_0x404b24['push'](_0x404b24['shift']());}};_0x3aa8fc(++_0xa0381e);}(_0x7a02,0x120));var _0x27a0=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x7a02[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x27a0('0x0'));var util=require(_0x27a0('0x1'));var logger=require(_0x27a0('0x2'))('api');var moment=require(_0x27a0('0x3'));var BPromise=require(_0x27a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27a0('0x5'));var rimraf=require(_0x27a0('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x27a0('0x7')]=function(_0xc4508c,_0x444671){return _0xc4508c[_0x27a0('0x8')](_0x27a0('0x9'),attributes,{'tableName':_0x27a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 87ec160..c4ed147 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 _0x768e=['request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowSound','Sound','options','raw','where','include','map','attributes','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5bc2b0,_0x4aa427){var _0x3c1b03=function(_0x1eecee){while(--_0x1eecee){_0x5bc2b0['push'](_0x5bc2b0['shift']());}};_0x3c1b03(++_0x4aa427);}(_0x768e,0x12b));var _0xe768=function(_0x1caa1e,_0x36f5a2){_0x1caa1e=_0x1caa1e-0x0;var _0x3ae08d=_0x768e[_0x1caa1e];return _0x3ae08d;};'use strict';var _=require(_0xe768('0x0'));var util=require(_0xe768('0x1'));var moment=require(_0xe768('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe768('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe768('0x4'));var logger=require(_0xe768('0x5'))(_0xe768('0x6'));var config=require(_0xe768('0x7'));var jayson=require(_0xe768('0x8'));var client=jayson[_0xe768('0x9')][_0xe768('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ecb46,_0x255a47,_0x18267e){return new BPromise(function(_0x461706,_0x345659){return client[_0xe768('0xb')](_0x1ecb46,_0x18267e)[_0xe768('0xc')](function(_0x2ced55){logger[_0xe768('0xd')](_0xe768('0xe'),_0x255a47,'request\x20sent');logger[_0xe768('0xf')](_0xe768('0x10'),_0x255a47,'request\x20sent',JSON[_0xe768('0x11')](_0x2ced55));if(_0x2ced55[_0xe768('0x12')]){if(_0x2ced55[_0xe768('0x12')][_0xe768('0x13')]===0x1f4){logger[_0xe768('0x12')](_0xe768('0xe'),_0x255a47,_0x2ced55[_0xe768('0x12')][_0xe768('0x14')]);return _0x345659(_0x2ced55[_0xe768('0x12')][_0xe768('0x14')]);}logger[_0xe768('0x12')]('Sound,\x20%s,\x20%s',_0x255a47,_0x2ced55[_0xe768('0x12')][_0xe768('0x14')]);return _0x461706(_0x2ced55['error'][_0xe768('0x14')]);}else{logger[_0xe768('0xd')](_0xe768('0xe'),_0x255a47,_0xe768('0x15'));_0x461706(_0x2ced55['result'][_0xe768('0x14')]);}})[_0xe768('0x16')](function(_0x40c8f7){logger['error'](_0xe768('0xe'),_0x255a47,_0x40c8f7);_0x345659(_0x40c8f7);});});}exports[_0xe768('0x17')]=function(_0x316993){var _0x2fa0e0=this;return new Promise(function(_0x44ff31,_0x22d55e){return db[_0xe768('0x18')]['find']({'raw':_0x316993[_0xe768('0x19')]?_0x316993[_0xe768('0x19')][_0xe768('0x1a')]===undefined?!![]:![]:!![],'where':_0x316993[_0xe768('0x19')]?_0x316993[_0xe768('0x19')][_0xe768('0x1b')]||null:null,'attributes':_0x316993[_0xe768('0x19')]?_0x316993['options']['attributes']||null:null,'include':_0x316993[_0xe768('0x19')]?_0x316993[_0xe768('0x19')][_0xe768('0x1c')]?_[_0xe768('0x1d')](_0x316993['options'][_0xe768('0x1c')],function(_0x17ad21){return{'model':db[_0x17ad21['model']],'as':_0x17ad21['as'],'attributes':_0x17ad21[_0xe768('0x1e')],'include':_0x17ad21[_0xe768('0x1c')]?_[_0xe768('0x1d')](_0x17ad21['include'],function(_0x250def){return{'model':db[_0x250def['model']],'as':_0x250def['as'],'attributes':_0x250def[_0xe768('0x1e')],'include':_0x250def[_0xe768('0x1c')]?_[_0xe768('0x1d')](_0x250def[_0xe768('0x1c')],function(_0x1366b7){return{'model':db[_0x1366b7['model']],'as':_0x1366b7['as'],'attributes':_0x1366b7[_0xe768('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe768('0xc')](function(_0x54530a){logger[_0xe768('0xd')](_0xe768('0x17'),_0x316993);logger[_0xe768('0xf')](_0xe768('0x17'),_0x316993,JSON['stringify'](_0x54530a));_0x44ff31(_0x54530a);})[_0xe768('0x16')](function(_0x5299a9){logger[_0xe768('0x12')](_0xe768('0x17'),_0x5299a9[_0xe768('0x14')],_0x316993);_0x22d55e(_0x2fa0e0[_0xe768('0x12')](0x1f4,_0x5299a9[_0xe768('0x14')]));});});}; \ No newline at end of file +var _0xe41d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','Sound,\x20%s,\x20%s','find','options','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x441f45,_0x16130c){var _0x2bc267=function(_0x44f8a4){while(--_0x44f8a4){_0x441f45['push'](_0x441f45['shift']());}};_0x2bc267(++_0x16130c);}(_0xe41d,0xef));var _0xde41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe41d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde41('0x0'));var util=require(_0xde41('0x1'));var moment=require(_0xde41('0x2'));var BPromise=require(_0xde41('0x3'));var rs=require(_0xde41('0x4'));var fs=require('fs');var Redis=require(_0xde41('0x5'));var db=require(_0xde41('0x6'))['db'];var utils=require(_0xde41('0x7'));var logger=require(_0xde41('0x8'))(_0xde41('0x9'));var config=require(_0xde41('0xa'));var jayson=require(_0xde41('0xb'));var client=jayson[_0xde41('0xc')][_0xde41('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c0e47,_0x1bbeda,_0x342304){return new BPromise(function(_0x2a3141,_0x305ae6){return client[_0xde41('0xe')](_0x3c0e47,_0x342304)[_0xde41('0xf')](function(_0x1c354f){logger[_0xde41('0x10')]('Sound,\x20%s,\x20%s',_0x1bbeda,'request\x20sent');logger[_0xde41('0x11')](_0xde41('0x12'),_0x1bbeda,_0xde41('0x13'),JSON[_0xde41('0x14')](_0x1c354f));if(_0x1c354f['error']){if(_0x1c354f['error'][_0xde41('0x15')]===0x1f4){logger[_0xde41('0x16')]('Sound,\x20%s,\x20%s',_0x1bbeda,_0x1c354f[_0xde41('0x16')][_0xde41('0x17')]);return _0x305ae6(_0x1c354f[_0xde41('0x16')][_0xde41('0x17')]);}logger[_0xde41('0x16')]('Sound,\x20%s,\x20%s',_0x1bbeda,_0x1c354f[_0xde41('0x16')][_0xde41('0x17')]);return _0x2a3141(_0x1c354f[_0xde41('0x16')][_0xde41('0x17')]);}else{logger[_0xde41('0x10')]('Sound,\x20%s,\x20%s',_0x1bbeda,_0xde41('0x13'));_0x2a3141(_0x1c354f[_0xde41('0x18')][_0xde41('0x17')]);}})[_0xde41('0x19')](function(_0x43cd49){logger[_0xde41('0x16')](_0xde41('0x1a'),_0x1bbeda,_0x43cd49);_0x305ae6(_0x43cd49);});});}exports['ShowSound']=function(_0xc6b4d){var _0x52aed2=this;return new Promise(function(_0x37fe31,_0x5d94f1){return db['Sound'][_0xde41('0x1b')]({'raw':_0xc6b4d[_0xde41('0x1c')]?_0xc6b4d[_0xde41('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xc6b4d[_0xde41('0x1c')]?_0xc6b4d[_0xde41('0x1c')][_0xde41('0x1d')]||null:null,'attributes':_0xc6b4d['options']?_0xc6b4d[_0xde41('0x1c')][_0xde41('0x1e')]||null:null,'include':_0xc6b4d['options']?_0xc6b4d['options'][_0xde41('0x1f')]?_[_0xde41('0x20')](_0xc6b4d['options']['include'],function(_0xb066b9){return{'model':db[_0xb066b9[_0xde41('0x21')]],'as':_0xb066b9['as'],'attributes':_0xb066b9['attributes'],'include':_0xb066b9[_0xde41('0x1f')]?_[_0xde41('0x20')](_0xb066b9['include'],function(_0x3ad175){return{'model':db[_0x3ad175[_0xde41('0x21')]],'as':_0x3ad175['as'],'attributes':_0x3ad175['attributes'],'include':_0x3ad175[_0xde41('0x1f')]?_[_0xde41('0x20')](_0x3ad175[_0xde41('0x1f')],function(_0x5b0547){return{'model':db[_0x5b0547[_0xde41('0x21')]],'as':_0x5b0547['as'],'attributes':_0x5b0547[_0xde41('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde41('0xf')](function(_0x3f6e69){logger[_0xde41('0x10')](_0xde41('0x22'),_0xc6b4d);logger[_0xde41('0x11')]('ShowSound',_0xc6b4d,JSON[_0xde41('0x14')](_0x3f6e69));_0x37fe31(_0x3f6e69);})[_0xde41('0x19')](function(_0x1e8434){logger['error'](_0xde41('0x22'),_0x1e8434[_0xde41('0x17')],_0xc6b4d);_0x5d94f1(_0x52aed2[_0xde41('0x16')](0x1f4,_0x1e8434[_0xde41('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d200b77..298212e 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 _0x6d47=['put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6d47,0x180));var _0x76d4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6d47[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x76d4('0x0'));var util=require(_0x76d4('0x1'));var path=require('path');var timeout=require(_0x76d4('0x2'));var express=require(_0x76d4('0x3'));var router=express[_0x76d4('0x4')]();var auth=require(_0x76d4('0x5'));var interaction=require(_0x76d4('0x6'));var config=require(_0x76d4('0x7'));var controller=require('./squareMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x76d4('0x8')]);router[_0x76d4('0x9')](_0x76d4('0xa'),auth['isAuthenticated'](),controller[_0x76d4('0xb')]);router[_0x76d4('0xc')]('/',auth[_0x76d4('0xd')](),controller[_0x76d4('0xe')]);router[_0x76d4('0xf')](_0x76d4('0xa'),auth[_0x76d4('0xd')](),controller[_0x76d4('0x10')]);router[_0x76d4('0x11')](_0x76d4('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x76d4('0x12')]=router; \ No newline at end of file +var _0xf7e8=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0xeddcc1,_0x4fcde1){var _0x515ed8=function(_0xcf42f1){while(--_0xcf42f1){_0xeddcc1['push'](_0xeddcc1['shift']());}};_0x515ed8(++_0x4fcde1);}(_0xf7e8,0x144));var _0x8f7e=function(_0x339540,_0x14b5b4){_0x339540=_0x339540-0x0;var _0x53096f=_0xf7e8[_0x339540];return _0x53096f;};'use strict';var multer=require(_0x8f7e('0x0'));var util=require(_0x8f7e('0x1'));var path=require(_0x8f7e('0x2'));var timeout=require(_0x8f7e('0x3'));var express=require('express');var router=express[_0x8f7e('0x4')]();var auth=require(_0x8f7e('0x5'));var interaction=require(_0x8f7e('0x6'));var config=require('../../config/environment');var controller=require(_0x8f7e('0x7'));router[_0x8f7e('0x8')]('/',auth[_0x8f7e('0x9')](),controller[_0x8f7e('0xa')]);router[_0x8f7e('0x8')](_0x8f7e('0xb'),auth[_0x8f7e('0x9')](),controller[_0x8f7e('0xc')]);router[_0x8f7e('0xd')]('/',auth['isAuthenticated'](),controller[_0x8f7e('0xe')]);router[_0x8f7e('0xf')]('/:id',auth[_0x8f7e('0x9')](),controller[_0x8f7e('0x10')]);router[_0x8f7e('0x11')](_0x8f7e('0xb'),auth[_0x8f7e('0x9')](),controller[_0x8f7e('0x12')]);module[_0x8f7e('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index cc31b67..1f4d48a 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 _0xdbb8=['TEXT','ENUM','out','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdbb8,0x107));var _0x8dbb=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0xdbb8[_0x2e4cbf];return _0x52840f;};'use strict';var Sequelize=require('sequelize');module[_0x8dbb('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x8dbb('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8dbb('0x2')]('in',_0x8dbb('0x3')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0x6be0=['exports','STRING','TEXT','medium','out'];(function(_0xd006e7,_0x329238){var _0x3d01aa=function(_0x30c005){while(--_0x30c005){_0xd006e7['push'](_0xd006e7['shift']());}};_0x3d01aa(++_0x329238);}(_0x6be0,0xf0));var _0x06be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x06be('0x0')]={'uniqueid':{'type':Sequelize[_0x06be('0x1')]},'body':{'type':Sequelize[_0x06be('0x2')](_0x06be('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x06be('0x4')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f011d55..d0f58ba 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 _0xfdcc=['sort','filter','where','map','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','name','send','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xfdcc,0x93));var _0xcfdc=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xfdcc[_0x31bab3];return _0x4fd382;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcfdc('0x0'));var rimraf=require(_0xcfdc('0x1'));var zipdir=require(_0xcfdc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfdc('0x3'));var moment=require(_0xcfdc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcfdc('0x5'));var util=require(_0xcfdc('0x6'));var path=require(_0xcfdc('0x7'));var sox=require(_0xcfdc('0x8'));var csv=require('to-csv');var ejs=require(_0xcfdc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcfdc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcfdc('0xb'));var querystring=require(_0xcfdc('0xc'));var Papa=require(_0xcfdc('0xd'));var Redis=require(_0xcfdc('0xe'));var authService=require(_0xcfdc('0xf'));var qs=require(_0xcfdc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcfdc('0x11'));var config=require('../../config/environment');var db=require(_0xcfdc('0x12'))['db'];function respondWithStatusCode(_0x1ab7b3,_0x2d2397){_0x2d2397=_0x2d2397||0xcc;return function(_0x2e29f6){if(_0x2e29f6){return _0x1ab7b3[_0xcfdc('0x13')](_0x2d2397);}return _0x1ab7b3[_0xcfdc('0x14')](_0x2d2397)['end']();};}function respondWithResult(_0x4a5337,_0x2065bb){_0x2065bb=_0x2065bb||0xc8;return function(_0x1195d6){if(_0x1195d6){return _0x4a5337['status'](_0x2065bb)[_0xcfdc('0x15')](_0x1195d6);}};}function respondWithFilteredResult(_0x3559b9,_0x36f58f){return function(_0xc7d70b){if(_0xc7d70b){var _0x363548=_0xc7d70b[_0xcfdc('0x16')],_0x5f116d=_0x36f58f[_0xcfdc('0x17')],_0xbd66e9=_0x36f58f[_0xcfdc('0x17')]+_0x36f58f[_0xcfdc('0x18')],_0x21b304;if(_0xbd66e9>=_0x363548){_0xbd66e9=_0x363548;_0x21b304=0xc8;}else{_0x21b304=0xce;}_0x3559b9[_0xcfdc('0x14')](_0x21b304);return _0x3559b9['set'](_0xcfdc('0x19'),_0x5f116d+'-'+_0xbd66e9+'/'+_0x363548)[_0xcfdc('0x15')](_0xc7d70b);}return null;};}function patchUpdates(_0x3f427e){return function(_0x38c734){try{jsonpatch['apply'](_0x38c734,_0x3f427e,!![]);}catch(_0x5f3c5d){return BPromise[_0xcfdc('0x1a')](_0x5f3c5d);}return _0x38c734[_0xcfdc('0x1b')]();};}function saveUpdates(_0x667e84,_0x5791df){return function(_0x4d2025){if(_0x4d2025){return _0x4d2025[_0xcfdc('0x1c')](_0x667e84)[_0xcfdc('0x1d')](function(_0x2097b8){return _0x2097b8;});}return null;};}function removeEntity(_0x5e09c5,_0x4de32c){return function(_0x363fdb){if(_0x363fdb){return _0x363fdb[_0xcfdc('0x1e')]()[_0xcfdc('0x1d')](function(){_0x5e09c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb352,_0x38171e){return function(_0x396f35){if(!_0x396f35){_0x2cb352[_0xcfdc('0x13')](0x194);}return _0x396f35;};}function handleError(_0x3994df,_0x23bb84){_0x23bb84=_0x23bb84||0x1f4;return function(_0x186827){logger[_0xcfdc('0x1f')](_0x186827['stack']);if(_0x186827[_0xcfdc('0x20')]){delete _0x186827['name'];}_0x3994df[_0xcfdc('0x14')](_0x23bb84)[_0xcfdc('0x21')](_0x186827);};}exports['index']=function(_0x57c83c,_0x4b7a27){var _0x5adced={},_0x3f5ab9={},_0x5c3abc={'count':0x0,'rows':[]};var _0x5e7043=_['map'](db[_0xcfdc('0x22')][_0xcfdc('0x23')],function(_0x10d357){return{'name':_0x10d357[_0xcfdc('0x24')],'type':_0x10d357[_0xcfdc('0x25')][_0xcfdc('0x26')]};});_0x3f5ab9[_0xcfdc('0x27')]=_['map'](_0x5e7043,'name');_0x3f5ab9[_0xcfdc('0x28')]=_[_0xcfdc('0x29')](_0x57c83c['query']);_0x3f5ab9[_0xcfdc('0x2a')]=_[_0xcfdc('0x2b')](_0x3f5ab9[_0xcfdc('0x27')],_0x3f5ab9[_0xcfdc('0x28')]);_0x5adced['attributes']=_['intersection'](_0x3f5ab9[_0xcfdc('0x27')],qs[_0xcfdc('0x2c')](_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x2c')]));_0x5adced[_0xcfdc('0x2d')]=_0x5adced[_0xcfdc('0x2d')]['length']?_0x5adced[_0xcfdc('0x2d')]:_0x3f5ab9[_0xcfdc('0x27')];if(!_0x57c83c[_0xcfdc('0x28')]['hasOwnProperty'](_0xcfdc('0x2e'))){_0x5adced[_0xcfdc('0x18')]=qs[_0xcfdc('0x18')](_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x18')]);_0x5adced[_0xcfdc('0x17')]=qs[_0xcfdc('0x17')](_0x57c83c['query']['offset']);}_0x5adced[_0xcfdc('0x2f')]=qs[_0xcfdc('0x30')](_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x30')]);_0x5adced['where']=qs['filters'](_['pick'](_0x57c83c[_0xcfdc('0x28')],_0x3f5ab9[_0xcfdc('0x2a')]),_0x5e7043);if(_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x31')]){_0x5adced[_0xcfdc('0x32')]=_['merge'](_0x5adced[_0xcfdc('0x32')],{'$or':_[_0xcfdc('0x33')](_0x5e7043,function(_0x44363b){if(_0x44363b[_0xcfdc('0x25')]!=='VIRTUAL'){var _0x1c7739={};_0x1c7739[_0x44363b[_0xcfdc('0x20')]]={'$like':'%'+_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x31')]+'%'};return _0x1c7739;}})});}_0x5adced=_[_0xcfdc('0x34')]({},_0x5adced,_0x57c83c[_0xcfdc('0x35')]);var _0x555df9={'where':_0x5adced[_0xcfdc('0x32')]};return db[_0xcfdc('0x22')][_0xcfdc('0x16')](_0x555df9)[_0xcfdc('0x1d')](function(_0x2fbeb7){_0x5c3abc[_0xcfdc('0x16')]=_0x2fbeb7;if(_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x36')]){_0x5adced[_0xcfdc('0x37')]=[{'all':!![]}];}return db['SquareMessage'][_0xcfdc('0x38')](_0x5adced);})['then'](function(_0x1e0366){_0x5c3abc[_0xcfdc('0x39')]=_0x1e0366;return _0x5c3abc;})[_0xcfdc('0x1d')](respondWithFilteredResult(_0x4b7a27,_0x5adced))[_0xcfdc('0x3a')](handleError(_0x4b7a27,null));};exports[_0xcfdc('0x3b')]=function(_0x4504cc,_0x2e92b0){var _0x15f0b0={'raw':!![],'where':{'id':_0x4504cc[_0xcfdc('0x3c')]['id']}},_0x4103ae={};_0x4103ae[_0xcfdc('0x27')]=_[_0xcfdc('0x29')](db[_0xcfdc('0x22')][_0xcfdc('0x23')]);_0x4103ae[_0xcfdc('0x28')]=_[_0xcfdc('0x29')](_0x4504cc[_0xcfdc('0x28')]);_0x4103ae['filters']=_[_0xcfdc('0x2b')](_0x4103ae[_0xcfdc('0x27')],_0x4103ae[_0xcfdc('0x28')]);_0x15f0b0[_0xcfdc('0x2d')]=_['intersection'](_0x4103ae[_0xcfdc('0x27')],qs[_0xcfdc('0x2c')](_0x4504cc[_0xcfdc('0x28')]['fields']));_0x15f0b0['attributes']=_0x15f0b0[_0xcfdc('0x2d')][_0xcfdc('0x3d')]?_0x15f0b0['attributes']:_0x4103ae[_0xcfdc('0x27')];if(_0x4504cc[_0xcfdc('0x28')][_0xcfdc('0x36')]){_0x15f0b0[_0xcfdc('0x37')]=[{'all':!![]}];}_0x15f0b0=_['merge']({},_0x15f0b0,_0x4504cc[_0xcfdc('0x35')]);return db[_0xcfdc('0x22')][_0xcfdc('0x3e')](_0x15f0b0)['then'](handleEntityNotFound(_0x2e92b0,null))['then'](respondWithResult(_0x2e92b0,null))[_0xcfdc('0x3a')](handleError(_0x2e92b0,null));};exports[_0xcfdc('0x3f')]=function(_0xd13156,_0x21beda){return db['SquareMessage'][_0xcfdc('0x3f')](_0xd13156[_0xcfdc('0x40')],{})[_0xcfdc('0x1d')](respondWithResult(_0x21beda,0xc9))[_0xcfdc('0x3a')](handleError(_0x21beda,null));};exports[_0xcfdc('0x1c')]=function(_0x581b44,_0x629324){if(_0x581b44[_0xcfdc('0x40')]['id']){delete _0x581b44[_0xcfdc('0x40')]['id'];}return db[_0xcfdc('0x22')][_0xcfdc('0x3e')]({'where':{'id':_0x581b44[_0xcfdc('0x3c')]['id']}})[_0xcfdc('0x1d')](handleEntityNotFound(_0x629324,null))[_0xcfdc('0x1d')](saveUpdates(_0x581b44['body'],null))[_0xcfdc('0x1d')](respondWithResult(_0x629324,null))[_0xcfdc('0x3a')](handleError(_0x629324,null));};exports[_0xcfdc('0x1e')]=function(_0x25278a,_0x2e1ed3){return db[_0xcfdc('0x22')][_0xcfdc('0x3e')]({'where':{'id':_0x25278a[_0xcfdc('0x3c')]['id']}})[_0xcfdc('0x1d')](handleEntityNotFound(_0x2e1ed3,null))[_0xcfdc('0x1d')](removeEntity(_0x2e1ed3,null))[_0xcfdc('0x3a')](handleError(_0x2e1ed3,null));}; \ No newline at end of file +var _0x0406=['rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','params','find','create','catch','update','body','html-pdf','eml-format'];(function(_0x2df0e1,_0x39a652){var _0x286574=function(_0x7fb39b){while(--_0x7fb39b){_0x2df0e1['push'](_0x2df0e1['shift']());}};_0x286574(++_0x39a652);}(_0x0406,0x1e8));var _0x6040=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0406[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x6040('0x0'));var emlformat=require(_0x6040('0x1'));var rimraf=require(_0x6040('0x2'));var zipdir=require(_0x6040('0x3'));var jsonpatch=require(_0x6040('0x4'));var rp=require(_0x6040('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6040('0x6'));var path=require(_0x6040('0x7'));var sox=require(_0x6040('0x8'));var csv=require(_0x6040('0x9'));var ejs=require(_0x6040('0xa'));var fs=require('fs');var _=require(_0x6040('0xb'));var squel=require('squel');var crypto=require(_0x6040('0xc'));var jsforce=require(_0x6040('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6040('0x9'));var querystring=require(_0x6040('0xe'));var Papa=require('papaparse');var Redis=require(_0x6040('0xf'));var authService=require(_0x6040('0x10'));var qs=require(_0x6040('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6040('0x12'))('api');var utils=require(_0x6040('0x13'));var config=require(_0x6040('0x14'));var db=require(_0x6040('0x15'))['db'];function respondWithStatusCode(_0x2fcbb3,_0xc4fa23){_0xc4fa23=_0xc4fa23||0xcc;return function(_0x25ac79){if(_0x25ac79){return _0x2fcbb3[_0x6040('0x16')](_0xc4fa23);}return _0x2fcbb3['status'](_0xc4fa23)[_0x6040('0x17')]();};}function respondWithResult(_0x877e46,_0x302662){_0x302662=_0x302662||0xc8;return function(_0x4245bd){if(_0x4245bd){return _0x877e46[_0x6040('0x18')](_0x302662)[_0x6040('0x19')](_0x4245bd);}};}function respondWithFilteredResult(_0x49c765,_0xafb1f3){return function(_0x18d912){if(_0x18d912){var _0x40505d=_0x18d912[_0x6040('0x1a')],_0x28314c=_0xafb1f3['offset'],_0xd11874=_0xafb1f3[_0x6040('0x1b')]+_0xafb1f3[_0x6040('0x1c')],_0x35fbc3;if(_0xd11874>=_0x40505d){_0xd11874=_0x40505d;_0x35fbc3=0xc8;}else{_0x35fbc3=0xce;}_0x49c765[_0x6040('0x18')](_0x35fbc3);return _0x49c765[_0x6040('0x1d')](_0x6040('0x1e'),_0x28314c+'-'+_0xd11874+'/'+_0x40505d)['json'](_0x18d912);}return null;};}function patchUpdates(_0x162f4c){return function(_0x407574){try{jsonpatch['apply'](_0x407574,_0x162f4c,!![]);}catch(_0x4d2667){return BPromise[_0x6040('0x1f')](_0x4d2667);}return _0x407574[_0x6040('0x20')]();};}function saveUpdates(_0x1b15e9,_0x298252){return function(_0x70ca2c){if(_0x70ca2c){return _0x70ca2c['update'](_0x1b15e9)[_0x6040('0x21')](function(_0x4929f0){return _0x4929f0;});}return null;};}function removeEntity(_0x1cad36,_0x2dea37){return function(_0x1b5adb){if(_0x1b5adb){return _0x1b5adb[_0x6040('0x22')]()[_0x6040('0x21')](function(){_0x1cad36[_0x6040('0x18')](0xcc)[_0x6040('0x17')]();});}};}function handleEntityNotFound(_0x1451ee,_0x6ab6e8){return function(_0xb2d265){if(!_0xb2d265){_0x1451ee['sendStatus'](0x194);}return _0xb2d265;};}function handleError(_0x3be48c,_0x131fa8){_0x131fa8=_0x131fa8||0x1f4;return function(_0x424a89){logger[_0x6040('0x23')](_0x424a89['stack']);if(_0x424a89[_0x6040('0x24')]){delete _0x424a89[_0x6040('0x24')];}_0x3be48c['status'](_0x131fa8)[_0x6040('0x25')](_0x424a89);};}exports['index']=function(_0x3f462d,_0x48a4af){var _0x420cd2={},_0x3fbc16={},_0x3aaa03={'count':0x0,'rows':[]};var _0x25c002=_[_0x6040('0x26')](db[_0x6040('0x27')][_0x6040('0x28')],function(_0x3bfb6b){return{'name':_0x3bfb6b[_0x6040('0x29')],'type':_0x3bfb6b[_0x6040('0x2a')][_0x6040('0x2b')]};});_0x3fbc16[_0x6040('0x2c')]=_[_0x6040('0x26')](_0x25c002,'name');_0x3fbc16[_0x6040('0x2d')]=_[_0x6040('0x2e')](_0x3f462d['query']);_0x3fbc16[_0x6040('0x2f')]=_[_0x6040('0x30')](_0x3fbc16[_0x6040('0x2c')],_0x3fbc16[_0x6040('0x2d')]);_0x420cd2['attributes']=_[_0x6040('0x30')](_0x3fbc16['model'],qs[_0x6040('0x31')](_0x3f462d['query'][_0x6040('0x31')]));_0x420cd2[_0x6040('0x32')]=_0x420cd2[_0x6040('0x32')][_0x6040('0x33')]?_0x420cd2[_0x6040('0x32')]:_0x3fbc16[_0x6040('0x2c')];if(!_0x3f462d[_0x6040('0x2d')][_0x6040('0x34')](_0x6040('0x35'))){_0x420cd2[_0x6040('0x1c')]=qs[_0x6040('0x1c')](_0x3f462d[_0x6040('0x2d')][_0x6040('0x1c')]);_0x420cd2['offset']=qs[_0x6040('0x1b')](_0x3f462d['query'][_0x6040('0x1b')]);}_0x420cd2[_0x6040('0x36')]=qs[_0x6040('0x37')](_0x3f462d['query'][_0x6040('0x37')]);_0x420cd2[_0x6040('0x38')]=qs[_0x6040('0x2f')](_[_0x6040('0x39')](_0x3f462d[_0x6040('0x2d')],_0x3fbc16['filters']),_0x25c002);if(_0x3f462d['query'][_0x6040('0x3a')]){_0x420cd2[_0x6040('0x38')]=_['merge'](_0x420cd2[_0x6040('0x38')],{'$or':_[_0x6040('0x26')](_0x25c002,function(_0xef2ecc){if(_0xef2ecc[_0x6040('0x2a')]!==_0x6040('0x3b')){var _0x22325f={};_0x22325f[_0xef2ecc[_0x6040('0x24')]]={'$like':'%'+_0x3f462d['query']['filter']+'%'};return _0x22325f;}})});}_0x420cd2=_[_0x6040('0x3c')]({},_0x420cd2,_0x3f462d[_0x6040('0x3d')]);var _0x4c924c={'where':_0x420cd2['where']};return db['SquareMessage'][_0x6040('0x1a')](_0x4c924c)[_0x6040('0x21')](function(_0xd1126e){_0x3aaa03[_0x6040('0x1a')]=_0xd1126e;if(_0x3f462d[_0x6040('0x2d')]['includeAll']){_0x420cd2[_0x6040('0x3e')]=[{'all':!![]}];}return db[_0x6040('0x27')][_0x6040('0x3f')](_0x420cd2);})[_0x6040('0x21')](function(_0x5ced06){_0x3aaa03['rows']=_0x5ced06;return _0x3aaa03;})[_0x6040('0x21')](respondWithFilteredResult(_0x48a4af,_0x420cd2))['catch'](handleError(_0x48a4af,null));};exports['show']=function(_0x1df924,_0x526c16){var _0xe93e3={'raw':!![],'where':{'id':_0x1df924[_0x6040('0x40')]['id']}},_0x2ed3e8={};_0x2ed3e8['model']=_[_0x6040('0x2e')](db['SquareMessage']['rawAttributes']);_0x2ed3e8[_0x6040('0x2d')]=_[_0x6040('0x2e')](_0x1df924[_0x6040('0x2d')]);_0x2ed3e8[_0x6040('0x2f')]=_[_0x6040('0x30')](_0x2ed3e8[_0x6040('0x2c')],_0x2ed3e8[_0x6040('0x2d')]);_0xe93e3['attributes']=_[_0x6040('0x30')](_0x2ed3e8[_0x6040('0x2c')],qs['fields'](_0x1df924[_0x6040('0x2d')][_0x6040('0x31')]));_0xe93e3['attributes']=_0xe93e3[_0x6040('0x32')][_0x6040('0x33')]?_0xe93e3['attributes']:_0x2ed3e8['model'];if(_0x1df924['query']['includeAll']){_0xe93e3[_0x6040('0x3e')]=[{'all':!![]}];}_0xe93e3=_[_0x6040('0x3c')]({},_0xe93e3,_0x1df924[_0x6040('0x3d')]);return db['SquareMessage'][_0x6040('0x41')](_0xe93e3)[_0x6040('0x21')](handleEntityNotFound(_0x526c16,null))[_0x6040('0x21')](respondWithResult(_0x526c16,null))['catch'](handleError(_0x526c16,null));};exports[_0x6040('0x42')]=function(_0x5f1995,_0x403e5c){return db['SquareMessage'][_0x6040('0x42')](_0x5f1995['body'],{})[_0x6040('0x21')](respondWithResult(_0x403e5c,0xc9))[_0x6040('0x43')](handleError(_0x403e5c,null));};exports[_0x6040('0x44')]=function(_0x12f71d,_0x586db5){if(_0x12f71d[_0x6040('0x45')]['id']){delete _0x12f71d[_0x6040('0x45')]['id'];}return db[_0x6040('0x27')][_0x6040('0x41')]({'where':{'id':_0x12f71d[_0x6040('0x40')]['id']}})['then'](handleEntityNotFound(_0x586db5,null))['then'](saveUpdates(_0x12f71d[_0x6040('0x45')],null))[_0x6040('0x21')](respondWithResult(_0x586db5,null))['catch'](handleError(_0x586db5,null));};exports[_0x6040('0x22')]=function(_0x3f48d0,_0x301722){return db['SquareMessage']['find']({'where':{'id':_0x3f48d0[_0x6040('0x40')]['id']}})[_0x6040('0x21')](handleEntityNotFound(_0x301722,null))[_0x6040('0x21')](removeEntity(_0x301722,null))[_0x6040('0x43')](handleError(_0x301722,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9d14505..fb171f4 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 _0xe2fe=['../../config/environment','exports','define','SquareMessage','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./squareMessage.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x23e8c5,_0x166081){var _0x1b9922=function(_0x539bec){while(--_0x539bec){_0x23e8c5['push'](_0x23e8c5['shift']());}};_0x1b9922(++_0x166081);}(_0x814b,0x1a2));var _0xb814=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x814b[_0x2431d6];return _0x4d0f9b;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index ef1b33d..0fc9f27 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 _0xa46e=['info','result','catch','SquareMessage','create','options','raw','CreateSquareMessage','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','SquareMessage,\x20%s,\x20%s'];(function(_0x45f42e,_0x417bb){var _0x5704b6=function(_0x4d1621){while(--_0x4d1621){_0x45f42e['push'](_0x45f42e['shift']());}};_0x5704b6(++_0x417bb);}(_0xa46e,0x8a));var _0xea46=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xa46e[_0x57add2];return _0x4e3670;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('SquareMessage,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['CreateSquareMessage']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')](_0x19d5c1['body'],{'raw':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![]})[_0xea46('0xa')](function(_0x53b8db){logger[_0xea46('0x12')]('CreateSquareMessage',_0x19d5c1);logger['debug'](_0xea46('0x19'),_0x19d5c1,JSON['stringify'](_0x53b8db));_0x5cf5dd(_0x53b8db);})['catch'](function(_0x5064d8){logger[_0xea46('0xe')](_0xea46('0x19'),_0x5064d8[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d['error'](0x1f4,_0x5064d8[_0xea46('0x10')]));});});}; \ No newline at end of file +var _0xffd6=['SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','create','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2059df,_0x367401){var _0xdd848b=function(_0x13055b){while(--_0x13055b){_0x2059df['push'](_0x2059df['shift']());}};_0xdd848b(++_0x367401);}(_0xffd6,0x97));var _0x6ffd=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xffd6[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('SquareMessage,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['SquareMessage'][_0x6ffd('0x17')](_0x889a4b[_0x6ffd('0x18')],{'raw':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x19')][_0x6ffd('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x564a11){logger[_0x6ffd('0x13')](_0x6ffd('0x16'),_0x889a4b);logger['debug'](_0x6ffd('0x16'),_0x889a4b,JSON[_0x6ffd('0xf')](_0x564a11));_0x11a609(_0x564a11);})[_0x6ffd('0x15')](function(_0x53128a){logger[_0x6ffd('0x10')](_0x6ffd('0x16'),_0x53128a['message'],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0x53128a[_0x6ffd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 251baa8..80c686b 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 _0x8f9f=['15s','test','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','show','get','/:id/test'];(function(_0x24c45d,_0xce99f8){var _0x1f2fe0=function(_0x468a8c){while(--_0x468a8c){_0x24c45d['push'](_0x24c45d['shift']());}};_0x1f2fe0(++_0xce99f8);}(_0x8f9f,0xbf));var _0xf8f9=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8f9f[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xf8f9('0x0'));var util=require(_0xf8f9('0x1'));var path=require(_0xf8f9('0x2'));var timeout=require(_0xf8f9('0x3'));var express=require(_0xf8f9('0x4'));var router=express[_0xf8f9('0x5')]();var auth=require(_0xf8f9('0x6'));var interaction=require(_0xf8f9('0x7'));var config=require(_0xf8f9('0x8'));var controller=require(_0xf8f9('0x9'));router['get']('/',auth[_0xf8f9('0xa')](),controller[_0xf8f9('0xb')]);router['get'](_0xf8f9('0xc'),auth[_0xf8f9('0xa')](),controller[_0xf8f9('0xd')]);router[_0xf8f9('0xe')](_0xf8f9('0xf'),auth[_0xf8f9('0xa')](),timeout(_0xf8f9('0x10')),controller[_0xf8f9('0x11')]);router[_0xf8f9('0x12')]('/',auth['isAuthenticated'](),controller[_0xf8f9('0x13')]);router[_0xf8f9('0x14')](_0xf8f9('0xc'),auth['isAuthenticated'](),controller[_0xf8f9('0x15')]);router['delete'](_0xf8f9('0xc'),auth[_0xf8f9('0xa')](),controller[_0xf8f9('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5fdd=['index','/:id','show','/:id/test','15s','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2f39b9,_0x3d3156){var _0x337a30=function(_0x596914){while(--_0x596914){_0x2f39b9['push'](_0x2f39b9['shift']());}};_0x337a30(++_0x3d3156);}(_0x5fdd,0x16f));var _0xd5fd=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x5fdd[_0x95942];return _0x6d7f81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd5fd('0x0'));var timeout=require(_0xd5fd('0x1'));var express=require('express');var router=express[_0xd5fd('0x2')]();var auth=require(_0xd5fd('0x3'));var interaction=require(_0xd5fd('0x4'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0xd5fd('0x5')]('/',auth[_0xd5fd('0x6')](),controller[_0xd5fd('0x7')]);router['get'](_0xd5fd('0x8'),auth[_0xd5fd('0x6')](),controller[_0xd5fd('0x9')]);router[_0xd5fd('0x5')](_0xd5fd('0xa'),auth['isAuthenticated'](),timeout(_0xd5fd('0xb')),controller['test']);router['post']('/',auth['isAuthenticated'](),controller[_0xd5fd('0xc')]);router[_0xd5fd('0xd')](_0xd5fd('0x8'),auth[_0xd5fd('0x6')](),controller[_0xd5fd('0xe')]);router[_0xd5fd('0xf')](_0xd5fd('0x8'),auth[_0xd5fd('0x6')](),controller[_0xd5fd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 268e04a..e0069ff 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 _0x8944=['name','sequelize','exports','STRING'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0x8944,0x1ed));var _0x4894=function(_0x341c34,_0x59d114){_0x341c34=_0x341c34-0x0;var _0x222581=_0x8944[_0x341c34];return _0x222581;};'use strict';var Sequelize=require(_0x4894('0x0'));module[_0x4894('0x1')]={'name':{'type':Sequelize[_0x4894('0x2')],'unique':_0x4894('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4894('0x2')]},'description':{'type':Sequelize[_0x4894('0x2')]}}; \ No newline at end of file +var _0xd72d=['name','STRING'];(function(_0x53f9e1,_0x59ca58){var _0x3f7e10=function(_0x1e0912){while(--_0x1e0912){_0x53f9e1['push'](_0x53f9e1['shift']());}};_0x3f7e10(++_0x59ca58);}(_0xd72d,0x17d));var _0xdd72=function(_0x3410bf,_0xdb1f12){_0x3410bf=_0x3410bf-0x0;var _0x353df2=_0xd72d[_0x3410bf];return _0x353df2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdd72('0x0')],'unique':_0xdd72('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xdd72('0x0')]},'description':{'type':Sequelize[_0xdd72('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e3e83ab..1bfdc1d 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 _0x7b9e=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','ODBC','error','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x577c8d,_0x420561){var _0x5c7f0d=function(_0x44abef){while(--_0x44abef){_0x577c8d['push'](_0x577c8d['shift']());}};_0x5c7f0d(++_0x420561);}(_0x7b9e,0xdc));var _0xe7b9=function(_0x44f725,_0x8221d2){_0x44f725=_0x44f725-0x0;var _0x315c33=_0x7b9e[_0x44f725];return _0x315c33;};'use strict';var pdf=require(_0xe7b9('0x0'));var emlformat=require(_0xe7b9('0x1'));var rimraf=require(_0xe7b9('0x2'));var zipdir=require(_0xe7b9('0x3'));var jsonpatch=require(_0xe7b9('0x4'));var rp=require(_0xe7b9('0x5'));var moment=require('moment');var BPromise=require(_0xe7b9('0x6'));var Mustache=require(_0xe7b9('0x7'));var util=require(_0xe7b9('0x8'));var path=require(_0xe7b9('0x9'));var sox=require(_0xe7b9('0xa'));var csv=require(_0xe7b9('0xb'));var ejs=require(_0xe7b9('0xc'));var fs=require('fs');var _=require(_0xe7b9('0xd'));var squel=require(_0xe7b9('0xe'));var crypto=require(_0xe7b9('0xf'));var jsforce=require(_0xe7b9('0x10'));var deskjs=require(_0xe7b9('0x11'));var toCsv=require(_0xe7b9('0xb'));var querystring=require('querystring');var Papa=require(_0xe7b9('0x12'));var Redis=require(_0xe7b9('0x13'));var authService=require(_0xe7b9('0x14'));var qs=require(_0xe7b9('0x15'));var as=require(_0xe7b9('0x16'));var hardwareService=require(_0xe7b9('0x17'));var logger=require(_0xe7b9('0x18'))(_0xe7b9('0x19'));var utils=require(_0xe7b9('0x1a'));var config=require(_0xe7b9('0x1b'));var db=require(_0xe7b9('0x1c'))['db'];function respondWithStatusCode(_0x38fd85,_0x503a26){_0x503a26=_0x503a26||0xcc;return function(_0x399cbf){if(_0x399cbf){return _0x38fd85[_0xe7b9('0x1d')](_0x503a26);}return _0x38fd85[_0xe7b9('0x1e')](_0x503a26)[_0xe7b9('0x1f')]();};}function respondWithResult(_0x548c32,_0x133944){_0x133944=_0x133944||0xc8;return function(_0x3f9d3f){if(_0x3f9d3f){return _0x548c32[_0xe7b9('0x1e')](_0x133944)[_0xe7b9('0x20')](_0x3f9d3f);}};}function respondWithFilteredResult(_0x31b2cf,_0x407b96){return function(_0x3dbb0d){if(_0x3dbb0d){var _0x2a23a9=_0x3dbb0d[_0xe7b9('0x21')],_0x417b4a=_0x407b96[_0xe7b9('0x22')],_0x48cdd6=_0x407b96[_0xe7b9('0x22')]+_0x407b96[_0xe7b9('0x23')],_0x41f81d;if(_0x48cdd6>=_0x2a23a9){_0x48cdd6=_0x2a23a9;_0x41f81d=0xc8;}else{_0x41f81d=0xce;}_0x31b2cf['status'](_0x41f81d);return _0x31b2cf[_0xe7b9('0x24')](_0xe7b9('0x25'),_0x417b4a+'-'+_0x48cdd6+'/'+_0x2a23a9)[_0xe7b9('0x20')](_0x3dbb0d);}return null;};}function patchUpdates(_0x431ad3){return function(_0x76ad44){try{jsonpatch[_0xe7b9('0x26')](_0x76ad44,_0x431ad3,!![]);}catch(_0x119225){return BPromise['reject'](_0x119225);}return _0x76ad44[_0xe7b9('0x27')]();};}function saveUpdates(_0x73167c,_0x5dc666){return function(_0xc7f7f){if(_0xc7f7f){return _0xc7f7f['update'](_0x73167c)[_0xe7b9('0x28')](function(_0x5d924a){return _0x5d924a;});}return null;};}function removeEntity(_0x12315e,_0xffe525){return function(_0x585ce5){if(_0x585ce5){return _0x585ce5[_0xe7b9('0x29')]()[_0xe7b9('0x28')](function(){var _0x1becfe=_0x585ce5[_0xe7b9('0x2a')]({'plain':!![]});var _0xc2bb7=_0xe7b9('0x2b');return db['UserProfileResource'][_0xe7b9('0x29')]({'where':{'type':_0xc2bb7,'resourceId':_0x1becfe['id']}})[_0xe7b9('0x28')](function(){return _0x585ce5;});})[_0xe7b9('0x28')](function(){_0x12315e[_0xe7b9('0x1e')](0xcc)[_0xe7b9('0x1f')]();});}};}function handleEntityNotFound(_0x682f3,_0x3dce68){return function(_0x1585af){if(!_0x1585af){_0x682f3[_0xe7b9('0x1d')](0x194);}return _0x1585af;};}function handleError(_0x3bc59d,_0x2c749f){_0x2c749f=_0x2c749f||0x1f4;return function(_0x2196b8){logger[_0xe7b9('0x2c')](_0x2196b8['stack']);if(_0x2196b8[_0xe7b9('0x2d')]){delete _0x2196b8[_0xe7b9('0x2d')];}_0x3bc59d['status'](_0x2c749f)[_0xe7b9('0x2e')](_0x2196b8);};}exports['index']=function(_0x107191,_0x5f258d){var _0x2c97b7={},_0x403358={},_0x10d210={'count':0x0,'rows':[]};var _0x7f6656=_[_0xe7b9('0x2f')](db[_0xe7b9('0x30')][_0xe7b9('0x31')],function(_0x15f748){return{'name':_0x15f748[_0xe7b9('0x32')],'type':_0x15f748[_0xe7b9('0x33')][_0xe7b9('0x34')]};});_0x403358['model']=_[_0xe7b9('0x2f')](_0x7f6656,_0xe7b9('0x2d'));_0x403358[_0xe7b9('0x35')]=_[_0xe7b9('0x36')](_0x107191['query']);_0x403358[_0xe7b9('0x37')]=_[_0xe7b9('0x38')](_0x403358[_0xe7b9('0x39')],_0x403358[_0xe7b9('0x35')]);_0x2c97b7['attributes']=_[_0xe7b9('0x38')](_0x403358[_0xe7b9('0x39')],qs['fields'](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x3a')]));_0x2c97b7[_0xe7b9('0x3b')]=_0x2c97b7[_0xe7b9('0x3b')][_0xe7b9('0x3c')]?_0x2c97b7[_0xe7b9('0x3b')]:_0x403358[_0xe7b9('0x39')];if(!_0x107191['query'][_0xe7b9('0x3d')](_0xe7b9('0x3e'))){_0x2c97b7[_0xe7b9('0x23')]=qs[_0xe7b9('0x23')](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x23')]);_0x2c97b7[_0xe7b9('0x22')]=qs[_0xe7b9('0x22')](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x22')]);}_0x2c97b7[_0xe7b9('0x3f')]=qs[_0xe7b9('0x40')](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x40')]);_0x2c97b7[_0xe7b9('0x41')]=qs[_0xe7b9('0x37')](_[_0xe7b9('0x42')](_0x107191[_0xe7b9('0x35')],_0x403358['filters']),_0x7f6656);if(_0x107191['query'][_0xe7b9('0x43')]){_0x2c97b7[_0xe7b9('0x41')]=_['merge'](_0x2c97b7[_0xe7b9('0x41')],{'$or':_[_0xe7b9('0x2f')](_0x7f6656,function(_0x43e151){if(_0x43e151[_0xe7b9('0x33')]!==_0xe7b9('0x44')){var _0x5e05f2={};_0x5e05f2[_0x43e151['name']]={'$like':'%'+_0x107191['query'][_0xe7b9('0x43')]+'%'};return _0x5e05f2;}})});}_0x2c97b7=_[_0xe7b9('0x45')]({},_0x2c97b7,_0x107191[_0xe7b9('0x46')]);var _0x176fcb={'where':_0x2c97b7[_0xe7b9('0x41')]};return db[_0xe7b9('0x30')][_0xe7b9('0x21')](_0x176fcb)[_0xe7b9('0x28')](function(_0x1804af){_0x10d210[_0xe7b9('0x21')]=_0x1804af;if(_0x107191[_0xe7b9('0x35')]['includeAll']){_0x2c97b7[_0xe7b9('0x47')]=[{'all':!![]}];}return db[_0xe7b9('0x30')][_0xe7b9('0x48')](_0x2c97b7);})[_0xe7b9('0x28')](function(_0x34a199){_0x10d210[_0xe7b9('0x49')]=_0x34a199;return _0x10d210;})['then'](respondWithFilteredResult(_0x5f258d,_0x2c97b7))['catch'](handleError(_0x5f258d,null));};exports[_0xe7b9('0x4a')]=function(_0x15ebdc,_0x30f612){var _0x820730={'raw':!![],'where':{'id':_0x15ebdc[_0xe7b9('0x4b')]['id']}},_0x20e138={};_0x20e138[_0xe7b9('0x39')]=_[_0xe7b9('0x36')](db[_0xe7b9('0x30')][_0xe7b9('0x31')]);_0x20e138[_0xe7b9('0x35')]=_[_0xe7b9('0x36')](_0x15ebdc[_0xe7b9('0x35')]);_0x20e138[_0xe7b9('0x37')]=_[_0xe7b9('0x38')](_0x20e138[_0xe7b9('0x39')],_0x20e138['query']);_0x820730['attributes']=_['intersection'](_0x20e138[_0xe7b9('0x39')],qs[_0xe7b9('0x3a')](_0x15ebdc[_0xe7b9('0x35')][_0xe7b9('0x3a')]));_0x820730[_0xe7b9('0x3b')]=_0x820730[_0xe7b9('0x3b')][_0xe7b9('0x3c')]?_0x820730[_0xe7b9('0x3b')]:_0x20e138[_0xe7b9('0x39')];if(_0x15ebdc['query'][_0xe7b9('0x4c')]){_0x820730[_0xe7b9('0x47')]=[{'all':!![]}];}_0x820730=_[_0xe7b9('0x45')]({},_0x820730,_0x15ebdc[_0xe7b9('0x46')]);return db[_0xe7b9('0x30')][_0xe7b9('0x4d')](_0x820730)['then'](handleEntityNotFound(_0x30f612,null))[_0xe7b9('0x28')](respondWithResult(_0x30f612,null))[_0xe7b9('0x4e')](handleError(_0x30f612,null));};exports[_0xe7b9('0x4f')]=function(_0x3e00d0,_0x4383cf){return db[_0xe7b9('0x30')]['create'](_0x3e00d0[_0xe7b9('0x50')],{})[_0xe7b9('0x28')](function(_0x1a9d3b){var _0x1af361=_0x3e00d0[_0xe7b9('0x51')][_0xe7b9('0x2a')]({'plain':!![]});if(!_0x1af361)throw new Error(_0xe7b9('0x52'));if(_0x1af361[_0xe7b9('0x53')]===_0xe7b9('0x51')){var _0xc00af8=_0x1a9d3b[_0xe7b9('0x2a')]({'plain':!![]});var _0x50d575=_0xe7b9('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x50d575,'userProfileId':_0x1af361[_0xe7b9('0x54')]},'raw':!![]})[_0xe7b9('0x28')](function(_0x351188){if(_0x351188&&_0x351188[_0xe7b9('0x55')]===0x0){return db[_0xe7b9('0x56')][_0xe7b9('0x4f')]({'name':_0xc00af8[_0xe7b9('0x2d')],'resourceId':_0xc00af8['id'],'type':_0x351188['name'],'sectionId':_0x351188['id']},{})[_0xe7b9('0x28')](function(){return _0x1a9d3b;});}else{return _0x1a9d3b;}})[_0xe7b9('0x4e')](function(_0x313639){logger[_0xe7b9('0x2c')](_0xe7b9('0x57'),_0x313639);throw _0x313639;});}return _0x1a9d3b;})[_0xe7b9('0x28')](respondWithResult(_0x4383cf,0xc9))[_0xe7b9('0x4e')](handleError(_0x4383cf,null));};exports[_0xe7b9('0x58')]=function(_0x4c3c8b,_0x502661){if(_0x4c3c8b['body']['id']){delete _0x4c3c8b[_0xe7b9('0x50')]['id'];}return db[_0xe7b9('0x30')][_0xe7b9('0x4d')]({'where':{'id':_0x4c3c8b[_0xe7b9('0x4b')]['id']}})[_0xe7b9('0x28')](handleEntityNotFound(_0x502661,null))['then'](saveUpdates(_0x4c3c8b[_0xe7b9('0x50')],null))['then'](respondWithResult(_0x502661,null))[_0xe7b9('0x4e')](handleError(_0x502661,null));};exports[_0xe7b9('0x29')]=function(_0x53bc28,_0x3ee471){return db[_0xe7b9('0x30')][_0xe7b9('0x4d')]({'where':{'id':_0x53bc28[_0xe7b9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ee471,null))['then'](removeEntity(_0x3ee471,null))[_0xe7b9('0x4e')](handleError(_0x3ee471,null));};exports['test']=function(_0x2bbebc,_0x42fe1f,_0x52f317){var _0x220de2;return db[_0xe7b9('0x30')][_0xe7b9('0x4d')]({'where':{'id':_0x2bbebc[_0xe7b9('0x4b')]['id']},'attributes':['id',_0xe7b9('0x59')]})[_0xe7b9('0x28')](handleEntityNotFound(_0x42fe1f,null))[_0xe7b9('0x28')](function(_0x49f890){if(_0x49f890){var _0x2646a9=require('odbc')();_0x2646a9[_0xe7b9('0x5a')](_0x49f890[_0xe7b9('0x59')]);_0x2646a9[_0xe7b9('0x5b')]();return _0x49f890;}})[_0xe7b9('0x28')](respondWithResult(_0x42fe1f,null))[_0xe7b9('0x4e')](handleError(_0x42fe1f,null));}; \ No newline at end of file +var _0xcf2f=['keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','then','get','ODBC','error','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','map','query'];(function(_0x1763bb,_0x151749){var _0x44c732=function(_0x99d070){while(--_0x99d070){_0x1763bb['push'](_0x1763bb['shift']());}};_0x44c732(++_0x151749);}(_0xcf2f,0xdd));var _0xfcf2=function(_0x2cb6f0,_0x52bf32){_0x2cb6f0=_0x2cb6f0-0x0;var _0x3211b4=_0xcf2f[_0x2cb6f0];return _0x3211b4;};'use strict';var pdf=require(_0xfcf2('0x0'));var emlformat=require(_0xfcf2('0x1'));var rimraf=require(_0xfcf2('0x2'));var zipdir=require(_0xfcf2('0x3'));var jsonpatch=require(_0xfcf2('0x4'));var rp=require(_0xfcf2('0x5'));var moment=require(_0xfcf2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfcf2('0x7'));var util=require(_0xfcf2('0x8'));var path=require(_0xfcf2('0x9'));var sox=require(_0xfcf2('0xa'));var csv=require(_0xfcf2('0xb'));var ejs=require(_0xfcf2('0xc'));var fs=require('fs');var _=require(_0xfcf2('0xd'));var squel=require('squel');var crypto=require(_0xfcf2('0xe'));var jsforce=require(_0xfcf2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfcf2('0x10'));var Papa=require(_0xfcf2('0x11'));var Redis=require(_0xfcf2('0x12'));var authService=require(_0xfcf2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfcf2('0x14'));var hardwareService=require(_0xfcf2('0x15'));var logger=require(_0xfcf2('0x16'))('api');var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x2dff67,_0x247d65){_0x247d65=_0x247d65||0xcc;return function(_0x4106e2){if(_0x4106e2){return _0x2dff67[_0xfcf2('0x19')](_0x247d65);}return _0x2dff67[_0xfcf2('0x1a')](_0x247d65)[_0xfcf2('0x1b')]();};}function respondWithResult(_0x1db6ce,_0xfb972e){_0xfb972e=_0xfb972e||0xc8;return function(_0x43569e){if(_0x43569e){return _0x1db6ce[_0xfcf2('0x1a')](_0xfb972e)[_0xfcf2('0x1c')](_0x43569e);}};}function respondWithFilteredResult(_0x5d5bcb,_0xb8911f){return function(_0x36d8b3){if(_0x36d8b3){var _0x21ffe4=_0x36d8b3[_0xfcf2('0x1d')],_0x4b68ce=_0xb8911f[_0xfcf2('0x1e')],_0x120401=_0xb8911f[_0xfcf2('0x1e')]+_0xb8911f['limit'],_0x47a38b;if(_0x120401>=_0x21ffe4){_0x120401=_0x21ffe4;_0x47a38b=0xc8;}else{_0x47a38b=0xce;}_0x5d5bcb[_0xfcf2('0x1a')](_0x47a38b);return _0x5d5bcb[_0xfcf2('0x1f')](_0xfcf2('0x20'),_0x4b68ce+'-'+_0x120401+'/'+_0x21ffe4)[_0xfcf2('0x1c')](_0x36d8b3);}return null;};}function patchUpdates(_0x19475f){return function(_0xd04030){try{jsonpatch['apply'](_0xd04030,_0x19475f,!![]);}catch(_0x4b60f4){return BPromise[_0xfcf2('0x21')](_0x4b60f4);}return _0xd04030['save']();};}function saveUpdates(_0x219b3b,_0x7eba71){return function(_0x8a5761){if(_0x8a5761){return _0x8a5761[_0xfcf2('0x22')](_0x219b3b)[_0xfcf2('0x23')](function(_0x44821e){return _0x44821e;});}return null;};}function removeEntity(_0x287076,_0x2aface){return function(_0x48108e){if(_0x48108e){return _0x48108e['destroy']()[_0xfcf2('0x23')](function(){var _0x2346a6=_0x48108e[_0xfcf2('0x24')]({'plain':!![]});var _0x197b29=_0xfcf2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x197b29,'resourceId':_0x2346a6['id']}})[_0xfcf2('0x23')](function(){return _0x48108e;});})[_0xfcf2('0x23')](function(){_0x287076[_0xfcf2('0x1a')](0xcc)[_0xfcf2('0x1b')]();});}};}function handleEntityNotFound(_0x2786c6,_0x31c6c6){return function(_0x17514){if(!_0x17514){_0x2786c6['sendStatus'](0x194);}return _0x17514;};}function handleError(_0x2c2bc9,_0x524ec8){_0x524ec8=_0x524ec8||0x1f4;return function(_0x3d0c0e){logger[_0xfcf2('0x26')](_0x3d0c0e['stack']);if(_0x3d0c0e[_0xfcf2('0x27')]){delete _0x3d0c0e[_0xfcf2('0x27')];}_0x2c2bc9[_0xfcf2('0x1a')](_0x524ec8)[_0xfcf2('0x28')](_0x3d0c0e);};}exports[_0xfcf2('0x29')]=function(_0x330a83,_0x191b20){var _0x3b6d20={},_0x1438de={},_0x584d43={'count':0x0,'rows':[]};var _0x40a145=_['map'](db[_0xfcf2('0x2a')][_0xfcf2('0x2b')],function(_0x5c9057){return{'name':_0x5c9057[_0xfcf2('0x2c')],'type':_0x5c9057[_0xfcf2('0x2d')][_0xfcf2('0x2e')]};});_0x1438de['model']=_[_0xfcf2('0x2f')](_0x40a145,_0xfcf2('0x27'));_0x1438de[_0xfcf2('0x30')]=_[_0xfcf2('0x31')](_0x330a83['query']);_0x1438de['filters']=_['intersection'](_0x1438de[_0xfcf2('0x32')],_0x1438de[_0xfcf2('0x30')]);_0x3b6d20[_0xfcf2('0x33')]=_[_0xfcf2('0x34')](_0x1438de[_0xfcf2('0x32')],qs[_0xfcf2('0x35')](_0x330a83['query'][_0xfcf2('0x35')]));_0x3b6d20[_0xfcf2('0x33')]=_0x3b6d20[_0xfcf2('0x33')][_0xfcf2('0x36')]?_0x3b6d20[_0xfcf2('0x33')]:_0x1438de[_0xfcf2('0x32')];if(!_0x330a83['query'][_0xfcf2('0x37')](_0xfcf2('0x38'))){_0x3b6d20[_0xfcf2('0x39')]=qs['limit'](_0x330a83[_0xfcf2('0x30')][_0xfcf2('0x39')]);_0x3b6d20['offset']=qs[_0xfcf2('0x1e')](_0x330a83[_0xfcf2('0x30')][_0xfcf2('0x1e')]);}_0x3b6d20[_0xfcf2('0x3a')]=qs[_0xfcf2('0x3b')](_0x330a83[_0xfcf2('0x30')]['sort']);_0x3b6d20['where']=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x330a83[_0xfcf2('0x30')],_0x1438de[_0xfcf2('0x3c')]),_0x40a145);if(_0x330a83[_0xfcf2('0x30')][_0xfcf2('0x3e')]){_0x3b6d20['where']=_[_0xfcf2('0x3f')](_0x3b6d20['where'],{'$or':_[_0xfcf2('0x2f')](_0x40a145,function(_0x41150f){if(_0x41150f[_0xfcf2('0x2d')]!==_0xfcf2('0x40')){var _0x4ffce7={};_0x4ffce7[_0x41150f[_0xfcf2('0x27')]]={'$like':'%'+_0x330a83[_0xfcf2('0x30')][_0xfcf2('0x3e')]+'%'};return _0x4ffce7;}})});}_0x3b6d20=_[_0xfcf2('0x3f')]({},_0x3b6d20,_0x330a83['options']);var _0x278b54={'where':_0x3b6d20[_0xfcf2('0x41')]};return db['SquareOdbc'][_0xfcf2('0x1d')](_0x278b54)['then'](function(_0x4ef82e){_0x584d43['count']=_0x4ef82e;if(_0x330a83['query'][_0xfcf2('0x42')]){_0x3b6d20[_0xfcf2('0x43')]=[{'all':!![]}];}return db[_0xfcf2('0x2a')][_0xfcf2('0x44')](_0x3b6d20);})[_0xfcf2('0x23')](function(_0x89ca51){_0x584d43[_0xfcf2('0x45')]=_0x89ca51;return _0x584d43;})[_0xfcf2('0x23')](respondWithFilteredResult(_0x191b20,_0x3b6d20))[_0xfcf2('0x46')](handleError(_0x191b20,null));};exports[_0xfcf2('0x47')]=function(_0x5b04cc,_0x36024d){var _0x501d5c={'raw':!![],'where':{'id':_0x5b04cc['params']['id']}},_0x57c332={};_0x57c332[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](db['SquareOdbc']['rawAttributes']);_0x57c332[_0xfcf2('0x30')]=_[_0xfcf2('0x31')](_0x5b04cc['query']);_0x57c332[_0xfcf2('0x3c')]=_[_0xfcf2('0x34')](_0x57c332[_0xfcf2('0x32')],_0x57c332[_0xfcf2('0x30')]);_0x501d5c[_0xfcf2('0x33')]=_['intersection'](_0x57c332[_0xfcf2('0x32')],qs[_0xfcf2('0x35')](_0x5b04cc[_0xfcf2('0x30')][_0xfcf2('0x35')]));_0x501d5c[_0xfcf2('0x33')]=_0x501d5c[_0xfcf2('0x33')][_0xfcf2('0x36')]?_0x501d5c[_0xfcf2('0x33')]:_0x57c332[_0xfcf2('0x32')];if(_0x5b04cc[_0xfcf2('0x30')][_0xfcf2('0x42')]){_0x501d5c['include']=[{'all':!![]}];}_0x501d5c=_['merge']({},_0x501d5c,_0x5b04cc[_0xfcf2('0x48')]);return db[_0xfcf2('0x2a')][_0xfcf2('0x49')](_0x501d5c)[_0xfcf2('0x23')](handleEntityNotFound(_0x36024d,null))[_0xfcf2('0x23')](respondWithResult(_0x36024d,null))[_0xfcf2('0x46')](handleError(_0x36024d,null));};exports[_0xfcf2('0x4a')]=function(_0x410dc9,_0x362cae){return db[_0xfcf2('0x2a')][_0xfcf2('0x4a')](_0x410dc9['body'],{})['then'](function(_0x47e74b){var _0x3f481d=_0x410dc9[_0xfcf2('0x4b')][_0xfcf2('0x24')]({'plain':!![]});if(!_0x3f481d)throw new Error(_0xfcf2('0x4c'));if(_0x3f481d[_0xfcf2('0x4d')]===_0xfcf2('0x4b')){var _0x1fd219=_0x47e74b['get']({'plain':!![]});var _0x5bf21a=_0xfcf2('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5bf21a,'userProfileId':_0x3f481d[_0xfcf2('0x4e')]},'raw':!![]})[_0xfcf2('0x23')](function(_0x367388){if(_0x367388&&_0x367388[_0xfcf2('0x4f')]===0x0){return db[_0xfcf2('0x50')][_0xfcf2('0x4a')]({'name':_0x1fd219[_0xfcf2('0x27')],'resourceId':_0x1fd219['id'],'type':_0x367388[_0xfcf2('0x27')],'sectionId':_0x367388['id']},{})[_0xfcf2('0x23')](function(){return _0x47e74b;});}else{return _0x47e74b;}})[_0xfcf2('0x46')](function(_0x3cb128){logger[_0xfcf2('0x26')](_0xfcf2('0x51'),_0x3cb128);throw _0x3cb128;});}return _0x47e74b;})[_0xfcf2('0x23')](respondWithResult(_0x362cae,0xc9))[_0xfcf2('0x46')](handleError(_0x362cae,null));};exports[_0xfcf2('0x22')]=function(_0x2bdb39,_0x467809){if(_0x2bdb39[_0xfcf2('0x52')]['id']){delete _0x2bdb39[_0xfcf2('0x52')]['id'];}return db[_0xfcf2('0x2a')]['find']({'where':{'id':_0x2bdb39[_0xfcf2('0x53')]['id']}})['then'](handleEntityNotFound(_0x467809,null))[_0xfcf2('0x23')](saveUpdates(_0x2bdb39['body'],null))[_0xfcf2('0x23')](respondWithResult(_0x467809,null))['catch'](handleError(_0x467809,null));};exports[_0xfcf2('0x54')]=function(_0x8e8295,_0x3e2e7a){return db[_0xfcf2('0x2a')][_0xfcf2('0x49')]({'where':{'id':_0x8e8295[_0xfcf2('0x53')]['id']}})[_0xfcf2('0x23')](handleEntityNotFound(_0x3e2e7a,null))[_0xfcf2('0x23')](removeEntity(_0x3e2e7a,null))[_0xfcf2('0x46')](handleError(_0x3e2e7a,null));};exports[_0xfcf2('0x55')]=function(_0x274d2c,_0x1d4779,_0x4c9246){var _0x4596ce;return db[_0xfcf2('0x2a')][_0xfcf2('0x49')]({'where':{'id':_0x274d2c[_0xfcf2('0x53')]['id']},'attributes':['id',_0xfcf2('0x56')]})[_0xfcf2('0x23')](handleEntityNotFound(_0x1d4779,null))[_0xfcf2('0x23')](function(_0x439e82){if(_0x439e82){var _0x1f1179=require(_0xfcf2('0x57'))();_0x1f1179[_0xfcf2('0x58')](_0x439e82[_0xfcf2('0x56')]);_0x1f1179[_0xfcf2('0x59')]();return _0x439e82;}})['then'](respondWithResult(_0x1d4779,null))[_0xfcf2('0x46')](handleError(_0x1d4779,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4b40467..43151e6 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 _0xd354=['api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger'];(function(_0x1e1c7e,_0x2a7390){var _0x21b358=function(_0x402cbe){while(--_0x402cbe){_0x1e1c7e['push'](_0x1e1c7e['shift']());}};_0x21b358(++_0x2a7390);}(_0xd354,0x1dd));var _0x4d35=function(_0x35eb4a,_0x435fea){_0x35eb4a=_0x35eb4a-0x0;var _0x122fee=_0xd354[_0x35eb4a];return _0x122fee;};'use strict';var _=require(_0x4d35('0x0'));var util=require(_0x4d35('0x1'));var logger=require(_0x4d35('0x2'))(_0x4d35('0x3'));var moment=require(_0x4d35('0x4'));var BPromise=require(_0x4d35('0x5'));var rp=require(_0x4d35('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d35('0x7'));var attributes=require(_0x4d35('0x8'));module[_0x4d35('0x9')]=function(_0x52ab8c,_0x5e336f){return _0x52ab8c[_0x4d35('0xa')]('SquareOdbc',attributes,{'tableName':_0x4d35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3785=['define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareOdbc.attributes','exports'];(function(_0x1c310f,_0x588155){var _0x101c94=function(_0x49aa67){while(--_0x49aa67){_0x1c310f['push'](_0x1c310f['shift']());}};_0x101c94(++_0x588155);}(_0x3785,0x92));var _0x5378=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x3785[_0x292f93];return _0x5a94b1;};'use strict';var _=require(_0x5378('0x0'));var util=require(_0x5378('0x1'));var logger=require(_0x5378('0x2'))(_0x5378('0x3'));var moment=require(_0x5378('0x4'));var BPromise=require(_0x5378('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5378('0x6'));var rimraf=require(_0x5378('0x7'));var config=require('../../config/environment');var attributes=require(_0x5378('0x8'));module[_0x5378('0x9')]=function(_0x40478f,_0x3fbf27){return _0x40478f[_0x5378('0xa')](_0x5378('0xb'),attributes,{'tableName':_0x5378('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index cd65048..35ca1bb 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(_0x2a26da,_0x3dfca3){var _0x59fc7f=function(_0x46c223){while(--_0x46c223){_0x2a26da['push'](_0x2a26da['shift']());}};_0x59fc7f(++_0x3dfca3);}(_0x008c,0x188));var _0xc008=function(_0xe0f242,_0x2f4ecf){_0xe0f242=_0xe0f242-0x0;var _0x3b801a=_0x008c[_0xe0f242];return _0x3b801a;};'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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x1116ac,_0xcbe059){var _0x3e806b=function(_0x33b585){while(--_0x33b585){_0x1116ac['push'](_0x1116ac['shift']());}};_0x3e806b(++_0xcbe059);}(_0xe14b,0x93));var _0xbe14=function(_0x43e479,_0x5ccbf5){_0x43e479=_0x43e479-0x0;var _0x4ae64f=_0xe14b[_0x43e479];return _0x4ae64f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 90d7b27..3ca4858 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 _0x1c9a=['isAuthenticated','show','getUsers','post','/:id/users','addUsers','put','/:id','update','delete','destroy','removeUsers','multer','path','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get'];(function(_0x33924a,_0x46ef5b){var _0x47fc4c=function(_0x5addc5){while(--_0x5addc5){_0x33924a['push'](_0x33924a['shift']());}};_0x47fc4c(++_0x46ef5b);}(_0x1c9a,0x98));var _0xa1c9=function(_0x194266,_0x5db317){_0x194266=_0x194266-0x0;var _0x3deed0=_0x1c9a[_0x194266];return _0x3deed0;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0x7')]('/:id/users',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0xb')]('/',auth[_0xa1c9('0x8')](),controller['create']);router[_0xa1c9('0xb')](_0xa1c9('0xc'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xd')]);router[_0xa1c9('0xe')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x10')]);router[_0xa1c9('0x11')](_0xa1c9('0xf'),auth['isAuthenticated'](),controller[_0xa1c9('0x12')]);router[_0xa1c9('0x11')](_0xa1c9('0xc'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','post','create','/:id/users','addUsers','/:id','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0x5eb8[_0x32a81f];return _0x5b67a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xa')]);router[_0x85eb('0x8')]('/:id',auth[_0x85eb('0x9')](),controller[_0x85eb('0xb')]);router[_0x85eb('0x8')]('/:id/users',auth[_0x85eb('0x9')](),controller['getUsers']);router[_0x85eb('0xc')]('/',auth[_0x85eb('0x9')](),controller[_0x85eb('0xd')]);router[_0x85eb('0xc')](_0x85eb('0xe'),auth[_0x85eb('0x9')](),controller[_0x85eb('0xf')]);router['put'](_0x85eb('0x10'),auth[_0x85eb('0x9')](),controller['update']);router[_0x85eb('0x11')](_0x85eb('0x10'),auth[_0x85eb('0x9')](),controller[_0x85eb('0x12')]);router['delete']('/:id/users',auth[_0x85eb('0x9')](),controller['removeUsers']);module[_0x85eb('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9fba1f5..9687eea 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 _0xed65=['exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString','sequelize'];(function(_0x2904fa,_0xffeb4e){var _0xf14705=function(_0x3f59f0){while(--_0x3f59f0){_0x2904fa['push'](_0x2904fa['shift']());}};_0xf14705(++_0xffeb4e);}(_0xed65,0x143));var _0x5ed6=function(_0xd31621,_0x17b567){_0xd31621=_0xd31621-0x0;var _0x2e7ac0=_0xed65[_0xd31621];return _0x2e7ac0;};'use strict';var Sequelize=require(_0x5ed6('0x0'));module[_0x5ed6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5ed6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5ed6('0x3')]},'notes':{'type':Sequelize[_0x5ed6('0x4')]},'preproduction':{'type':Sequelize[_0x5ed6('0x5')](_0x5ed6('0x6')),'get':function(){if(this[_0x5ed6('0x7')](_0x5ed6('0x8'))){return this[_0x5ed6('0x7')]('preproduction')['toString'](_0x5ed6('0x9'));}}},'production':{'type':Sequelize[_0x5ed6('0x5')]('long'),'get':function(){if(this[_0x5ed6('0x7')](_0x5ed6('0xa'))){return this['getDataValue']('production')[_0x5ed6('0xb')](_0x5ed6('0x9'));}}}}; \ No newline at end of file +var _0xb342=['long','preproduction','getDataValue','BLOB','production','toString','utf8','exports','STRING','name','TEXT'];(function(_0x2f715d,_0x55e850){var _0x39045c=function(_0x4192f4){while(--_0x4192f4){_0x2f715d['push'](_0x2f715d['shift']());}};_0x39045c(++_0x55e850);}(_0xb342,0x146));var _0x2b34=function(_0xbf3f20,_0x5bf459){_0xbf3f20=_0xbf3f20-0x0;var _0x4b8870=_0xb342[_0xbf3f20];return _0x4b8870;};'use strict';var Sequelize=require('sequelize');module[_0x2b34('0x0')]={'name':{'type':Sequelize[_0x2b34('0x1')],'unique':_0x2b34('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2b34('0x1')]},'notes':{'type':Sequelize[_0x2b34('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x2b34('0x4')),'get':function(){if(this['getDataValue'](_0x2b34('0x5'))){return this[_0x2b34('0x6')](_0x2b34('0x5'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x2b34('0x7')](_0x2b34('0x4')),'get':function(){if(this[_0x2b34('0x6')](_0x2b34('0x8'))){return this[_0x2b34('0x6')](_0x2b34('0x8'))[_0x2b34('0x9')](_0x2b34('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index be14850..40f238f 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 _0xc420=['options','count','include','rows','catch','show','params','rawAttributes','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','set','apply','reject','save','update','then','end','error','stack','name','index','map','SquareProject','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x48f038,_0x2bde84){var _0x2edc62=function(_0x1e6cc8){while(--_0x1e6cc8){_0x48f038['push'](_0x48f038['shift']());}};_0x2edc62(++_0x2bde84);}(_0xc420,0x13f));var _0x0c42=function(_0x4e919d,_0x8c9bd5){_0x4e919d=_0x4e919d-0x0;var _0x1e86eb=_0xc420[_0x4e919d];return _0x1e86eb;};'use strict';var pdf=require(_0x0c42('0x0'));var emlformat=require(_0x0c42('0x1'));var rimraf=require(_0x0c42('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c42('0x3'));var rp=require(_0x0c42('0x4'));var moment=require(_0x0c42('0x5'));var BPromise=require(_0x0c42('0x6'));var Mustache=require('mustache');var util=require(_0x0c42('0x7'));var path=require(_0x0c42('0x8'));var sox=require(_0x0c42('0x9'));var csv=require('to-csv');var ejs=require(_0x0c42('0xa'));var fs=require('fs');var _=require(_0x0c42('0xb'));var squel=require(_0x0c42('0xc'));var crypto=require('crypto');var jsforce=require(_0x0c42('0xd'));var deskjs=require(_0x0c42('0xe'));var toCsv=require(_0x0c42('0xf'));var querystring=require(_0x0c42('0x10'));var Papa=require(_0x0c42('0x11'));var Redis=require('ioredis');var authService=require(_0x0c42('0x12'));var qs=require(_0x0c42('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c42('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0c42('0x15'));var config=require('../../config/environment');var db=require(_0x0c42('0x16'))['db'];config[_0x0c42('0x17')]=_[_0x0c42('0x18')](config[_0x0c42('0x17')],{'host':_0x0c42('0x19'),'port':0x18eb});var socket=require(_0x0c42('0x1a'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0c42('0x1b')](socket);function respondWithStatusCode(_0x4efbd1,_0x2fdac4){_0x2fdac4=_0x2fdac4||0xcc;return function(_0x34b6f7){if(_0x34b6f7){return _0x4efbd1[_0x0c42('0x1c')](_0x2fdac4);}return _0x4efbd1[_0x0c42('0x1d')](_0x2fdac4)['end']();};}function respondWithResult(_0x5d6a9a,_0x5d14d3){_0x5d14d3=_0x5d14d3||0xc8;return function(_0x5d8c0f){if(_0x5d8c0f){return _0x5d6a9a['status'](_0x5d14d3)[_0x0c42('0x1e')](_0x5d8c0f);}};}function respondWithFilteredResult(_0xa0ed4d,_0x1809ce){return function(_0x434d07){if(_0x434d07){var _0x2a357f=_0x434d07['count'],_0x4b7e12=_0x1809ce[_0x0c42('0x1f')],_0x49ad20=_0x1809ce[_0x0c42('0x1f')]+_0x1809ce['limit'],_0x108914;if(_0x49ad20>=_0x2a357f){_0x49ad20=_0x2a357f;_0x108914=0xc8;}else{_0x108914=0xce;}_0xa0ed4d[_0x0c42('0x1d')](_0x108914);return _0xa0ed4d[_0x0c42('0x20')]('Content-Range',_0x4b7e12+'-'+_0x49ad20+'/'+_0x2a357f)[_0x0c42('0x1e')](_0x434d07);}return null;};}function patchUpdates(_0x4c5a35){return function(_0x1e8559){try{jsonpatch[_0x0c42('0x21')](_0x1e8559,_0x4c5a35,!![]);}catch(_0x210fbe){return BPromise[_0x0c42('0x22')](_0x210fbe);}return _0x1e8559[_0x0c42('0x23')]();};}function saveUpdates(_0x119de7,_0x45762b){return function(_0x180a22){if(_0x180a22){return _0x180a22[_0x0c42('0x24')](_0x119de7)[_0x0c42('0x25')](function(_0x43a419){return _0x43a419;});}return null;};}function removeEntity(_0x564adc,_0x4da627){return function(_0x2c584a){if(_0x2c584a){return _0x2c584a['destroy']()[_0x0c42('0x25')](function(){var _0x76e7f2=_0x2c584a['get']({'plain':!![]});var _0x384492='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x384492,'resourceId':_0x76e7f2['id']}})[_0x0c42('0x25')](function(){return _0x2c584a;});})[_0x0c42('0x25')](function(){_0x564adc[_0x0c42('0x1d')](0xcc)[_0x0c42('0x26')]();});}};}function handleEntityNotFound(_0xbf4af7,_0x212fad){return function(_0x26c79c){if(!_0x26c79c){_0xbf4af7[_0x0c42('0x1c')](0x194);}return _0x26c79c;};}function handleError(_0x454968,_0x5724f4){_0x5724f4=_0x5724f4||0x1f4;return function(_0x465158){logger[_0x0c42('0x27')](_0x465158[_0x0c42('0x28')]);if(_0x465158['name']){delete _0x465158[_0x0c42('0x29')];}_0x454968['status'](_0x5724f4)['send'](_0x465158);};}exports[_0x0c42('0x2a')]=function(_0x53c83b,_0x3f67f2){var _0xa5cd42={},_0x295946={},_0x50d3d9={'count':0x0,'rows':[]};var _0x2f88d8=_[_0x0c42('0x2b')](db[_0x0c42('0x2c')]['rawAttributes'],function(_0x369787){return{'name':_0x369787[_0x0c42('0x2d')],'type':_0x369787[_0x0c42('0x2e')][_0x0c42('0x2f')]};});_0x295946['model']=_[_0x0c42('0x2b')](_0x2f88d8,_0x0c42('0x29'));_0x295946['query']=_[_0x0c42('0x30')](_0x53c83b[_0x0c42('0x31')]);_0x295946[_0x0c42('0x32')]=_[_0x0c42('0x33')](_0x295946[_0x0c42('0x34')],_0x295946['query']);_0xa5cd42[_0x0c42('0x35')]=_[_0x0c42('0x33')](_0x295946['model'],qs[_0x0c42('0x36')](_0x53c83b[_0x0c42('0x31')][_0x0c42('0x36')]));_0xa5cd42[_0x0c42('0x35')]=_0xa5cd42[_0x0c42('0x35')][_0x0c42('0x37')]?_0xa5cd42[_0x0c42('0x35')]:_0x295946[_0x0c42('0x34')];if(!_0x53c83b[_0x0c42('0x31')][_0x0c42('0x38')](_0x0c42('0x39'))){_0xa5cd42[_0x0c42('0x3a')]=qs['limit'](_0x53c83b[_0x0c42('0x31')]['limit']);_0xa5cd42[_0x0c42('0x1f')]=qs[_0x0c42('0x1f')](_0x53c83b[_0x0c42('0x31')][_0x0c42('0x1f')]);}_0xa5cd42['order']=qs[_0x0c42('0x3b')](_0x53c83b['query'][_0x0c42('0x3b')]);_0xa5cd42[_0x0c42('0x3c')]=qs[_0x0c42('0x32')](_[_0x0c42('0x3d')](_0x53c83b['query'],_0x295946[_0x0c42('0x32')]),_0x2f88d8);if(_0x53c83b[_0x0c42('0x31')]['filter']){_0xa5cd42['where']=_['merge'](_0xa5cd42[_0x0c42('0x3c')],{'$or':_['map'](_0x2f88d8,function(_0x1e9c02){if(_0x1e9c02['type']!==_0x0c42('0x3e')){var _0x279b96={};_0x279b96[_0x1e9c02[_0x0c42('0x29')]]={'$like':'%'+_0x53c83b[_0x0c42('0x31')][_0x0c42('0x3f')]+'%'};return _0x279b96;}})});}_0xa5cd42=_[_0x0c42('0x40')]({},_0xa5cd42,_0x53c83b[_0x0c42('0x41')]);var _0x20ca8d={'where':_0xa5cd42[_0x0c42('0x3c')]};return db['SquareProject'][_0x0c42('0x42')](_0x20ca8d)[_0x0c42('0x25')](function(_0x408598){_0x50d3d9[_0x0c42('0x42')]=_0x408598;if(_0x53c83b['query']['includeAll']){_0xa5cd42[_0x0c42('0x43')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0xa5cd42);})[_0x0c42('0x25')](function(_0x4a37cc){_0x50d3d9[_0x0c42('0x44')]=_0x4a37cc;return _0x50d3d9;})[_0x0c42('0x25')](respondWithFilteredResult(_0x3f67f2,_0xa5cd42))[_0x0c42('0x45')](handleError(_0x3f67f2,null));};exports[_0x0c42('0x46')]=function(_0x3b1344,_0x25b40e){var _0x289f14={'raw':![],'where':{'id':_0x3b1344[_0x0c42('0x47')]['id']}},_0x1fb6ff={};_0x1fb6ff['model']=_[_0x0c42('0x30')](db['SquareProject'][_0x0c42('0x48')]);_0x1fb6ff[_0x0c42('0x31')]=_[_0x0c42('0x30')](_0x3b1344['query']);_0x1fb6ff[_0x0c42('0x32')]=_[_0x0c42('0x33')](_0x1fb6ff['model'],_0x1fb6ff['query']);_0x289f14[_0x0c42('0x35')]=_[_0x0c42('0x33')](_0x1fb6ff[_0x0c42('0x34')],qs['fields'](_0x3b1344[_0x0c42('0x31')][_0x0c42('0x36')]));_0x289f14[_0x0c42('0x35')]=_0x289f14[_0x0c42('0x35')][_0x0c42('0x37')]?_0x289f14[_0x0c42('0x35')]:_0x1fb6ff['model'];if(_0x3b1344[_0x0c42('0x31')][_0x0c42('0x49')]){_0x289f14[_0x0c42('0x43')]=[{'all':!![]}];}_0x289f14=_[_0x0c42('0x40')]({},_0x289f14,_0x3b1344[_0x0c42('0x41')]);return db['SquareProject']['find'](_0x289f14)[_0x0c42('0x25')](handleEntityNotFound(_0x25b40e,null))[_0x0c42('0x25')](respondWithResult(_0x25b40e,null))[_0x0c42('0x45')](handleError(_0x25b40e,null));};exports[_0x0c42('0x4a')]=function(_0x1d470e,_0x13a6e1){return db[_0x0c42('0x2c')][_0x0c42('0x4a')](_0x1d470e[_0x0c42('0x4b')],{})[_0x0c42('0x25')](function(_0x4697e4){var _0x1f656e=_0x1d470e['user'][_0x0c42('0x4c')]({'plain':!![]});if(!_0x1f656e)throw new Error(_0x0c42('0x4d'));if(_0x1f656e[_0x0c42('0x4e')]==='user'){var _0x123ec1=_0x4697e4['get']({'plain':!![]});var _0x1b0c3c=_0x0c42('0x4f');return db[_0x0c42('0x50')][_0x0c42('0x51')]({'where':{'name':_0x1b0c3c,'userProfileId':_0x1f656e[_0x0c42('0x52')]},'raw':!![]})[_0x0c42('0x25')](function(_0x499196){if(_0x499196&&_0x499196['autoAssociation']===0x0){return db[_0x0c42('0x53')][_0x0c42('0x4a')]({'name':_0x123ec1['name'],'resourceId':_0x123ec1['id'],'type':_0x499196[_0x0c42('0x29')],'sectionId':_0x499196['id']},{})['then'](function(){return _0x4697e4;});}else{return _0x4697e4;}})[_0x0c42('0x45')](function(_0x586d55){logger[_0x0c42('0x27')](_0x0c42('0x54'),_0x586d55);throw _0x586d55;});}return _0x4697e4;})[_0x0c42('0x25')](respondWithResult(_0x13a6e1,0xc9))[_0x0c42('0x45')](handleError(_0x13a6e1,null));};exports[_0x0c42('0x24')]=function(_0x13e520,_0x56234e){if(_0x13e520['body']['id']){delete _0x13e520['body']['id'];}return db[_0x0c42('0x2c')]['find']({'where':{'id':_0x13e520[_0x0c42('0x47')]['id']}})['then'](handleEntityNotFound(_0x56234e,null))[_0x0c42('0x25')](saveUpdates(_0x13e520[_0x0c42('0x4b')],null))['then'](respondWithResult(_0x56234e,null))['catch'](handleError(_0x56234e,null));};exports[_0x0c42('0x55')]=function(_0x8ae20,_0x4da155){return db[_0x0c42('0x2c')][_0x0c42('0x51')]({'where':{'id':_0x8ae20[_0x0c42('0x47')]['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x4da155,null))[_0x0c42('0x25')](removeEntity(_0x4da155,null))[_0x0c42('0x45')](handleError(_0x4da155,null));};exports[_0x0c42('0x56')]=function(_0x3f680d,_0x445b71,_0x41e974){return db['SquareProject'][_0x0c42('0x51')]({'where':{'id':_0x3f680d[_0x0c42('0x47')]['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x445b71,null))['then'](function(_0x134ab7){if(_0x134ab7){return _0x134ab7[_0x0c42('0x56')](_0x3f680d[_0x0c42('0x4b')][_0x0c42('0x57')],_['omit'](_0x3f680d[_0x0c42('0x4b')],[_0x0c42('0x57'),'id'])||{});}})['then'](respondWithResult(_0x445b71,null))[_0x0c42('0x45')](handleError(_0x445b71,null));};exports[_0x0c42('0x58')]=function(_0x1a8c5c,_0x2de156,_0xd01460){return db[_0x0c42('0x2c')][_0x0c42('0x51')]({'where':{'id':_0x1a8c5c['params']['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x2de156,null))['then'](function(_0x46d72e){if(_0x46d72e){return _0x46d72e[_0x0c42('0x58')](_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')])[_0x0c42('0x25')](function(){if(_[_0x0c42('0x59')](_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')])){for(var _0xdef88c=0x0;_0xdef88c<_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')][_0x0c42('0x37')];_0xdef88c+=0x1){socket[_0x0c42('0x5a')](_0x0c42('0x5b'),{'UserId':Number(_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')][_0xdef88c]),'SquareProjectId':Number(_0x1a8c5c[_0x0c42('0x47')]['id'])});}}else{socket[_0x0c42('0x5a')](_0x0c42('0x5b'),{'UserId':Number(_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')]),'SquareProjectId':Number(_0x1a8c5c['params']['id'])});}});}})[_0x0c42('0x25')](respondWithStatusCode(_0x2de156,null))[_0x0c42('0x45')](handleError(_0x2de156,null));};exports[_0x0c42('0x5c')]=function(_0xe94826,_0x31cd0a,_0x31ae6c){var _0x57e99f={};var _0x758d9c={};var _0x485a4e;var _0x11cc52;return db[_0x0c42('0x2c')][_0x0c42('0x5d')]({'where':{'id':_0xe94826[_0x0c42('0x47')]['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x31cd0a,null))[_0x0c42('0x25')](function(_0x50a3b1){if(_0x50a3b1){_0x485a4e=_0x50a3b1;_0x758d9c[_0x0c42('0x34')]=_['keys'](db[_0x0c42('0x5e')]['rawAttributes']);_0x758d9c[_0x0c42('0x31')]=_['keys'](_0xe94826[_0x0c42('0x31')]);_0x758d9c[_0x0c42('0x32')]=_[_0x0c42('0x33')](_0x758d9c[_0x0c42('0x34')],_0x758d9c[_0x0c42('0x31')]);_0x57e99f[_0x0c42('0x35')]=_[_0x0c42('0x33')](_0x758d9c[_0x0c42('0x34')],qs[_0x0c42('0x36')](_0xe94826['query'][_0x0c42('0x36')]));_0x57e99f[_0x0c42('0x35')]=_0x57e99f[_0x0c42('0x35')][_0x0c42('0x37')]?_0x57e99f[_0x0c42('0x35')]:_0x758d9c[_0x0c42('0x34')];_0x57e99f[_0x0c42('0x5f')]=qs[_0x0c42('0x3b')](_0xe94826[_0x0c42('0x31')][_0x0c42('0x3b')]);_0x57e99f[_0x0c42('0x3c')]=qs[_0x0c42('0x32')](_['pick'](_0xe94826['query'],_0x758d9c[_0x0c42('0x32')]));if(_0xe94826['query'][_0x0c42('0x3f')]){_0x57e99f[_0x0c42('0x3c')]=_[_0x0c42('0x40')](_0x57e99f['where'],{'$or':_['map'](_0x57e99f[_0x0c42('0x35')],function(_0x22fff5){var _0xdc7109={};_0xdc7109[_0x22fff5]={'$like':'%'+_0xe94826[_0x0c42('0x31')][_0x0c42('0x3f')]+'%'};return _0xdc7109;})});}_0x57e99f=_['merge']({},_0x57e99f,_0xe94826[_0x0c42('0x41')]);return _0x485a4e[_0x0c42('0x5c')](_0x57e99f);}})[_0x0c42('0x25')](function(_0x3fa6c7){if(_0x3fa6c7){_0x11cc52=_0x3fa6c7[_0x0c42('0x37')];if(!_0xe94826[_0x0c42('0x31')]['hasOwnProperty'](_0x0c42('0x39'))){_0x57e99f[_0x0c42('0x3a')]=qs[_0x0c42('0x3a')](_0xe94826[_0x0c42('0x31')][_0x0c42('0x3a')]);_0x57e99f[_0x0c42('0x1f')]=qs['offset'](_0xe94826[_0x0c42('0x31')][_0x0c42('0x1f')]);}return _0x485a4e[_0x0c42('0x5c')](_0x57e99f);}})[_0x0c42('0x25')](function(_0x3d958d){if(_0x3d958d){return _0x3d958d?{'count':_0x11cc52,'rows':_0x3d958d}:null;}})['then'](respondWithResult(_0x31cd0a,null))['catch'](handleError(_0x31cd0a,null));}; \ No newline at end of file +var _0x24d1=['where','merge','type','VIRTUAL','filter','options','includeAll','include','catch','params','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','find','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','then','get','destroy','error','stack','name','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24d1,0x1df));var _0x124d=function(_0x21517f,_0x368c7c){_0x21517f=_0x21517f-0x0;var _0x25f1e4=_0x24d1[_0x21517f];return _0x25f1e4;};'use strict';var pdf=require(_0x124d('0x0'));var emlformat=require(_0x124d('0x1'));var rimraf=require(_0x124d('0x2'));var zipdir=require(_0x124d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x124d('0x4'));var BPromise=require(_0x124d('0x5'));var Mustache=require(_0x124d('0x6'));var util=require(_0x124d('0x7'));var path=require(_0x124d('0x8'));var sox=require('sox');var csv=require(_0x124d('0x9'));var ejs=require(_0x124d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x124d('0xb'));var crypto=require(_0x124d('0xc'));var jsforce=require(_0x124d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x124d('0x9'));var querystring=require(_0x124d('0xe'));var Papa=require(_0x124d('0xf'));var Redis=require(_0x124d('0x10'));var authService=require(_0x124d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x124d('0x12'));var hardwareService=require(_0x124d('0x13'));var logger=require(_0x124d('0x14'))(_0x124d('0x15'));var utils=require('../../config/utils');var config=require(_0x124d('0x16'));var db=require(_0x124d('0x17'))['db'];config[_0x124d('0x18')]=_['defaults'](config[_0x124d('0x18')],{'host':_0x124d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x124d('0x18')]));require('./squareProject.socket')[_0x124d('0x1a')](socket);function respondWithStatusCode(_0x12dd83,_0x470d0a){_0x470d0a=_0x470d0a||0xcc;return function(_0x3854fe){if(_0x3854fe){return _0x12dd83[_0x124d('0x1b')](_0x470d0a);}return _0x12dd83['status'](_0x470d0a)[_0x124d('0x1c')]();};}function respondWithResult(_0x204eb8,_0x24172f){_0x24172f=_0x24172f||0xc8;return function(_0x4b554b){if(_0x4b554b){return _0x204eb8['status'](_0x24172f)[_0x124d('0x1d')](_0x4b554b);}};}function respondWithFilteredResult(_0x50549f,_0x334337){return function(_0x377e00){if(_0x377e00){var _0xc2fcab=_0x377e00[_0x124d('0x1e')],_0x13d0b3=_0x334337[_0x124d('0x1f')],_0x369b01=_0x334337[_0x124d('0x1f')]+_0x334337['limit'],_0x31c309;if(_0x369b01>=_0xc2fcab){_0x369b01=_0xc2fcab;_0x31c309=0xc8;}else{_0x31c309=0xce;}_0x50549f[_0x124d('0x20')](_0x31c309);return _0x50549f[_0x124d('0x21')](_0x124d('0x22'),_0x13d0b3+'-'+_0x369b01+'/'+_0xc2fcab)[_0x124d('0x1d')](_0x377e00);}return null;};}function patchUpdates(_0x3bb56c){return function(_0x116b2d){try{jsonpatch[_0x124d('0x23')](_0x116b2d,_0x3bb56c,!![]);}catch(_0x49496b){return BPromise[_0x124d('0x24')](_0x49496b);}return _0x116b2d[_0x124d('0x25')]();};}function saveUpdates(_0x5097d7,_0xc2ef06){return function(_0x1cd11d){if(_0x1cd11d){return _0x1cd11d['update'](_0x5097d7)['then'](function(_0x114c41){return _0x114c41;});}return null;};}function removeEntity(_0x468d33,_0x1bb0d5){return function(_0x2f93e7){if(_0x2f93e7){return _0x2f93e7['destroy']()[_0x124d('0x26')](function(){var _0x5de937=_0x2f93e7[_0x124d('0x27')]({'plain':!![]});var _0x20dfee='SquareProjects';return db['UserProfileResource'][_0x124d('0x28')]({'where':{'type':_0x20dfee,'resourceId':_0x5de937['id']}})[_0x124d('0x26')](function(){return _0x2f93e7;});})[_0x124d('0x26')](function(){_0x468d33[_0x124d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e0e6,_0x1b366c){return function(_0x1f89f1){if(!_0x1f89f1){_0x19e0e6[_0x124d('0x1b')](0x194);}return _0x1f89f1;};}function handleError(_0x5816e9,_0x44eded){_0x44eded=_0x44eded||0x1f4;return function(_0x1062e2){logger[_0x124d('0x29')](_0x1062e2[_0x124d('0x2a')]);if(_0x1062e2[_0x124d('0x2b')]){delete _0x1062e2[_0x124d('0x2b')];}_0x5816e9[_0x124d('0x20')](_0x44eded)['send'](_0x1062e2);};}exports[_0x124d('0x2c')]=function(_0x28404e,_0x4dfda7){var _0x485d5c={},_0x55fbc9={},_0x756bfe={'count':0x0,'rows':[]};var _0x4cc061=_[_0x124d('0x2d')](db[_0x124d('0x2e')][_0x124d('0x2f')],function(_0x339178){return{'name':_0x339178['fieldName'],'type':_0x339178['type'][_0x124d('0x30')]};});_0x55fbc9[_0x124d('0x31')]=_[_0x124d('0x2d')](_0x4cc061,_0x124d('0x2b'));_0x55fbc9[_0x124d('0x32')]=_[_0x124d('0x33')](_0x28404e[_0x124d('0x32')]);_0x55fbc9[_0x124d('0x34')]=_[_0x124d('0x35')](_0x55fbc9[_0x124d('0x31')],_0x55fbc9[_0x124d('0x32')]);_0x485d5c['attributes']=_['intersection'](_0x55fbc9[_0x124d('0x31')],qs[_0x124d('0x36')](_0x28404e[_0x124d('0x32')]['fields']));_0x485d5c[_0x124d('0x37')]=_0x485d5c[_0x124d('0x37')][_0x124d('0x38')]?_0x485d5c[_0x124d('0x37')]:_0x55fbc9[_0x124d('0x31')];if(!_0x28404e[_0x124d('0x32')]['hasOwnProperty']('nolimit')){_0x485d5c[_0x124d('0x39')]=qs[_0x124d('0x39')](_0x28404e[_0x124d('0x32')]['limit']);_0x485d5c[_0x124d('0x1f')]=qs[_0x124d('0x1f')](_0x28404e[_0x124d('0x32')][_0x124d('0x1f')]);}_0x485d5c[_0x124d('0x3a')]=qs[_0x124d('0x3b')](_0x28404e[_0x124d('0x32')][_0x124d('0x3b')]);_0x485d5c['where']=qs[_0x124d('0x34')](_[_0x124d('0x3c')](_0x28404e[_0x124d('0x32')],_0x55fbc9[_0x124d('0x34')]),_0x4cc061);if(_0x28404e[_0x124d('0x32')]['filter']){_0x485d5c[_0x124d('0x3d')]=_[_0x124d('0x3e')](_0x485d5c[_0x124d('0x3d')],{'$or':_[_0x124d('0x2d')](_0x4cc061,function(_0x4e772c){if(_0x4e772c[_0x124d('0x3f')]!==_0x124d('0x40')){var _0x355f1e={};_0x355f1e[_0x4e772c[_0x124d('0x2b')]]={'$like':'%'+_0x28404e['query'][_0x124d('0x41')]+'%'};return _0x355f1e;}})});}_0x485d5c=_['merge']({},_0x485d5c,_0x28404e[_0x124d('0x42')]);var _0x403810={'where':_0x485d5c[_0x124d('0x3d')]};return db[_0x124d('0x2e')][_0x124d('0x1e')](_0x403810)['then'](function(_0x5400ff){_0x756bfe['count']=_0x5400ff;if(_0x28404e[_0x124d('0x32')][_0x124d('0x43')]){_0x485d5c[_0x124d('0x44')]=[{'all':!![]}];}return db[_0x124d('0x2e')]['findAll'](_0x485d5c);})['then'](function(_0x6cde02){_0x756bfe['rows']=_0x6cde02;return _0x756bfe;})[_0x124d('0x26')](respondWithFilteredResult(_0x4dfda7,_0x485d5c))[_0x124d('0x45')](handleError(_0x4dfda7,null));};exports['show']=function(_0x30da52,_0x802d18){var _0x59ebeb={'raw':![],'where':{'id':_0x30da52[_0x124d('0x46')]['id']}},_0x10e7dc={};_0x10e7dc[_0x124d('0x31')]=_['keys'](db[_0x124d('0x2e')][_0x124d('0x2f')]);_0x10e7dc[_0x124d('0x32')]=_[_0x124d('0x33')](_0x30da52[_0x124d('0x32')]);_0x10e7dc['filters']=_[_0x124d('0x35')](_0x10e7dc[_0x124d('0x31')],_0x10e7dc[_0x124d('0x32')]);_0x59ebeb['attributes']=_['intersection'](_0x10e7dc[_0x124d('0x31')],qs['fields'](_0x30da52[_0x124d('0x32')][_0x124d('0x36')]));_0x59ebeb['attributes']=_0x59ebeb['attributes'][_0x124d('0x38')]?_0x59ebeb[_0x124d('0x37')]:_0x10e7dc[_0x124d('0x31')];if(_0x30da52[_0x124d('0x32')][_0x124d('0x43')]){_0x59ebeb['include']=[{'all':!![]}];}_0x59ebeb=_[_0x124d('0x3e')]({},_0x59ebeb,_0x30da52[_0x124d('0x42')]);return db['SquareProject']['find'](_0x59ebeb)['then'](handleEntityNotFound(_0x802d18,null))[_0x124d('0x26')](respondWithResult(_0x802d18,null))[_0x124d('0x45')](handleError(_0x802d18,null));};exports['create']=function(_0x144531,_0x33eb24){return db[_0x124d('0x2e')]['create'](_0x144531['body'],{})[_0x124d('0x26')](function(_0xc839ab){var _0x30d3d5=_0x144531[_0x124d('0x47')][_0x124d('0x27')]({'plain':!![]});if(!_0x30d3d5)throw new Error(_0x124d('0x48'));if(_0x30d3d5['role']===_0x124d('0x47')){var _0x482531=_0xc839ab[_0x124d('0x27')]({'plain':!![]});var _0x3a6d71=_0x124d('0x49');return db['UserProfileSection'][_0x124d('0x4a')]({'where':{'name':_0x3a6d71,'userProfileId':_0x30d3d5[_0x124d('0x4b')]},'raw':!![]})['then'](function(_0x12dc53){if(_0x12dc53&&_0x12dc53['autoAssociation']===0x0){return db[_0x124d('0x4c')][_0x124d('0x4d')]({'name':_0x482531[_0x124d('0x2b')],'resourceId':_0x482531['id'],'type':_0x12dc53['name'],'sectionId':_0x12dc53['id']},{})[_0x124d('0x26')](function(){return _0xc839ab;});}else{return _0xc839ab;}})[_0x124d('0x45')](function(_0x4b022a){logger[_0x124d('0x29')](_0x124d('0x4e'),_0x4b022a);throw _0x4b022a;});}return _0xc839ab;})[_0x124d('0x26')](respondWithResult(_0x33eb24,0xc9))[_0x124d('0x45')](handleError(_0x33eb24,null));};exports[_0x124d('0x4f')]=function(_0x4237fb,_0x5e0cfd){if(_0x4237fb[_0x124d('0x50')]['id']){delete _0x4237fb[_0x124d('0x50')]['id'];}return db[_0x124d('0x2e')][_0x124d('0x4a')]({'where':{'id':_0x4237fb['params']['id']}})['then'](handleEntityNotFound(_0x5e0cfd,null))[_0x124d('0x26')](saveUpdates(_0x4237fb['body'],null))['then'](respondWithResult(_0x5e0cfd,null))['catch'](handleError(_0x5e0cfd,null));};exports[_0x124d('0x28')]=function(_0x1d7e60,_0x239b65){return db[_0x124d('0x2e')]['find']({'where':{'id':_0x1d7e60[_0x124d('0x46')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x239b65,null))[_0x124d('0x26')](removeEntity(_0x239b65,null))['catch'](handleError(_0x239b65,null));};exports[_0x124d('0x51')]=function(_0x357e1c,_0x339d7a,_0x371285){return db['SquareProject'][_0x124d('0x4a')]({'where':{'id':_0x357e1c[_0x124d('0x46')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x339d7a,null))[_0x124d('0x26')](function(_0x4b568c){if(_0x4b568c){return _0x4b568c[_0x124d('0x51')](_0x357e1c[_0x124d('0x50')]['ids'],_[_0x124d('0x52')](_0x357e1c[_0x124d('0x50')],[_0x124d('0x53'),'id'])||{});}})[_0x124d('0x26')](respondWithResult(_0x339d7a,null))[_0x124d('0x45')](handleError(_0x339d7a,null));};exports[_0x124d('0x54')]=function(_0x7ce1a1,_0x4117ee,_0x3e17a9){return db[_0x124d('0x2e')][_0x124d('0x4a')]({'where':{'id':_0x7ce1a1[_0x124d('0x46')]['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x4117ee,null))[_0x124d('0x26')](function(_0x523d06){if(_0x523d06){return _0x523d06['removeUsers'](_0x7ce1a1['query']['ids'])[_0x124d('0x26')](function(){if(_[_0x124d('0x55')](_0x7ce1a1[_0x124d('0x32')]['ids'])){for(var _0x4faa0f=0x0;_0x4faa0f<_0x7ce1a1['query'][_0x124d('0x53')][_0x124d('0x38')];_0x4faa0f+=0x1){socket[_0x124d('0x56')](_0x124d('0x57'),{'UserId':Number(_0x7ce1a1[_0x124d('0x32')]['ids'][_0x4faa0f]),'SquareProjectId':Number(_0x7ce1a1[_0x124d('0x46')]['id'])});}}else{socket[_0x124d('0x56')](_0x124d('0x57'),{'UserId':Number(_0x7ce1a1[_0x124d('0x32')]['ids']),'SquareProjectId':Number(_0x7ce1a1['params']['id'])});}});}})[_0x124d('0x26')](respondWithStatusCode(_0x4117ee,null))[_0x124d('0x45')](handleError(_0x4117ee,null));};exports[_0x124d('0x58')]=function(_0x249d81,_0x24211e,_0x3f130f){var _0x52cf47={};var _0x1396fc={};var _0x25e7fb;var _0x3c901d;return db[_0x124d('0x2e')]['findOne']({'where':{'id':_0x249d81['params']['id']}})[_0x124d('0x26')](handleEntityNotFound(_0x24211e,null))[_0x124d('0x26')](function(_0x435d71){if(_0x435d71){_0x25e7fb=_0x435d71;_0x1396fc['model']=_[_0x124d('0x33')](db['User'][_0x124d('0x2f')]);_0x1396fc[_0x124d('0x32')]=_[_0x124d('0x33')](_0x249d81[_0x124d('0x32')]);_0x1396fc[_0x124d('0x34')]=_['intersection'](_0x1396fc['model'],_0x1396fc['query']);_0x52cf47[_0x124d('0x37')]=_['intersection'](_0x1396fc[_0x124d('0x31')],qs[_0x124d('0x36')](_0x249d81[_0x124d('0x32')][_0x124d('0x36')]));_0x52cf47['attributes']=_0x52cf47[_0x124d('0x37')]['length']?_0x52cf47[_0x124d('0x37')]:_0x1396fc[_0x124d('0x31')];_0x52cf47[_0x124d('0x3a')]=qs[_0x124d('0x3b')](_0x249d81[_0x124d('0x32')][_0x124d('0x3b')]);_0x52cf47['where']=qs[_0x124d('0x34')](_[_0x124d('0x3c')](_0x249d81[_0x124d('0x32')],_0x1396fc[_0x124d('0x34')]));if(_0x249d81[_0x124d('0x32')][_0x124d('0x41')]){_0x52cf47[_0x124d('0x3d')]=_['merge'](_0x52cf47[_0x124d('0x3d')],{'$or':_[_0x124d('0x2d')](_0x52cf47[_0x124d('0x37')],function(_0x5d8ea5){var _0x3d4095={};_0x3d4095[_0x5d8ea5]={'$like':'%'+_0x249d81[_0x124d('0x32')][_0x124d('0x41')]+'%'};return _0x3d4095;})});}_0x52cf47=_[_0x124d('0x3e')]({},_0x52cf47,_0x249d81['options']);return _0x25e7fb['getUsers'](_0x52cf47);}})['then'](function(_0x486edc){if(_0x486edc){_0x3c901d=_0x486edc[_0x124d('0x38')];if(!_0x249d81['query'][_0x124d('0x59')]('nolimit')){_0x52cf47[_0x124d('0x39')]=qs['limit'](_0x249d81['query']['limit']);_0x52cf47[_0x124d('0x1f')]=qs['offset'](_0x249d81['query']['offset']);}return _0x25e7fb['getUsers'](_0x52cf47);}})[_0x124d('0x26')](function(_0x318f04){if(_0x318f04){return _0x318f04?{'count':_0x3c901d,'rows':_0x318f04}:null;}})[_0x124d('0x26')](respondWithResult(_0x24211e,null))[_0x124d('0x45')](handleError(_0x24211e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b1696a7..3e5b270 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 _0x20a5=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x4d81b1,_0x35da49){var _0x38c376=function(_0x4724d8){while(--_0x4724d8){_0x4d81b1['push'](_0x4d81b1['shift']());}};_0x38c376(++_0x35da49);}(_0x20a5,0x7e));var _0x520a=function(_0x380bcc,_0x57fafb){_0x380bcc=_0x380bcc-0x0;var _0x2b8d22=_0x20a5[_0x380bcc];return _0x2b8d22;};'use strict';var EventEmitter=require(_0x520a('0x0'));var SquareProject=require(_0x520a('0x1'))['db'][_0x520a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x520a('0x3')](0x0);var events={'afterCreate':_0x520a('0x4'),'afterUpdate':'update','afterDestroy':_0x520a('0x5')};function emitEvent(_0x1f1f31){return function(_0x3f356b,_0x4a6372,_0x2ec110){SquareProjectEvents[_0x520a('0x6')](_0x1f1f31+':'+_0x3f356b['id'],_0x3f356b);SquareProjectEvents['emit'](_0x1f1f31,_0x3f356b);_0x2ec110(null);};}for(var e in events){if(events[_0x520a('0x7')](e)){var event=events[e];SquareProject[_0x520a('0x8')](e,emitEvent(event));}}module[_0x520a('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x7846=['../../mysqldb','SquareProject','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d0b45,_0x567a20){var _0x3610c9=function(_0x125c77){while(--_0x125c77){_0x4d0b45['push'](_0x4d0b45['shift']());}};_0x3610c9(++_0x567a20);}(_0x7846,0xbf));var _0x6784=function(_0x43371b,_0x1cb4cf){_0x43371b=_0x43371b-0x0;var _0x19cd26=_0x7846[_0x43371b];return _0x19cd26;};'use strict';var EventEmitter=require(_0x6784('0x0'));var SquareProject=require(_0x6784('0x1'))['db'][_0x6784('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6784('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17c971){return function(_0x419f3d,_0x5a59d1,_0x38eee3){SquareProjectEvents[_0x6784('0x4')](_0x17c971+':'+_0x419f3d['id'],_0x419f3d);SquareProjectEvents[_0x6784('0x4')](_0x17c971,_0x419f3d);_0x38eee3(null);};}for(var e in events){if(events[_0x6784('0x5')](e)){var event=events[e];SquareProject[_0x6784('0x6')](e,emitEvent(event));}}module[_0x6784('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 87e12b9..9ee16f8 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','lodash','util'];(function(_0x5bc65b,_0x104ef4){var _0xf372dc=function(_0x22127b){while(--_0x22127b){_0x5bc65b['push'](_0x5bc65b['shift']());}};_0xf372dc(++_0x104ef4);}(_0xdb28,0x106));var _0x8db2=function(_0x44ff47,_0x28b83c){_0x44ff47=_0x44ff47-0x0;var _0x540826=_0xdb28[_0x44ff47];return _0x540826;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./squareProject.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4cae38,_0x1f7372){var _0x4fc0d6=function(_0x105335){while(--_0x105335){_0x4cae38['push'](_0x4cae38['shift']());}};_0x4fc0d6(++_0x1f7372);}(_0x1967,0x173));var _0x7196=function(_0x2aba91,_0x22ebc9){_0x2aba91=_0x2aba91-0x0;var _0x120433=_0x1967[_0x2aba91];return _0x120433;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d2db62f..4087df6 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 _0x9b63=['moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSquareProject','SquareProject','options','raw','where','include','model','attributes','stringify','catch','util'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x9b63,0x65));var _0x39b6=function(_0x1d69ba,_0x4090c9){_0x1d69ba=_0x1d69ba-0x0;var _0x8bab8c=_0x9b63[_0x1d69ba];return _0x8bab8c;};'use strict';var _=require('lodash');var util=require(_0x39b6('0x0'));var moment=require(_0x39b6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x39b6('0x3'))(_0x39b6('0x4'));var config=require(_0x39b6('0x5'));var jayson=require(_0x39b6('0x6'));var client=jayson[_0x39b6('0x7')][_0x39b6('0x8')]({'port':0x232a});config[_0x39b6('0x9')]=_[_0x39b6('0xa')](config[_0x39b6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x39b6('0xb'))(new Redis(config[_0x39b6('0x9')]));require('./squareProject.socket')[_0x39b6('0xc')](socket);function respondWithRpcPromise(_0x422cc3,_0x2b8a3e,_0x56752b){return new BPromise(function(_0x2311a8,_0x8586db){return client[_0x39b6('0xd')](_0x422cc3,_0x56752b)[_0x39b6('0xe')](function(_0x8c8bf8){logger['info'](_0x39b6('0xf'),_0x2b8a3e,_0x39b6('0x10'));logger[_0x39b6('0x11')](_0x39b6('0x12'),_0x2b8a3e,_0x39b6('0x10'),JSON['stringify'](_0x8c8bf8));if(_0x8c8bf8[_0x39b6('0x13')]){if(_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x14')]===0x1f4){logger[_0x39b6('0x13')](_0x39b6('0xf'),_0x2b8a3e,_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x15')]);return _0x8586db(_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x15')]);}logger[_0x39b6('0x13')]('SquareProject,\x20%s,\x20%s',_0x2b8a3e,_0x8c8bf8['error'][_0x39b6('0x15')]);return _0x2311a8(_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x15')]);}else{logger[_0x39b6('0x16')](_0x39b6('0xf'),_0x2b8a3e,_0x39b6('0x10'));_0x2311a8(_0x8c8bf8[_0x39b6('0x17')]['message']);}})['catch'](function(_0x3c858c){logger['error'](_0x39b6('0xf'),_0x2b8a3e,_0x3c858c);_0x8586db(_0x3c858c);});});}exports[_0x39b6('0x18')]=function(_0x102172){var _0x6e2062=this;return new Promise(function(_0x4994c0,_0x1c14b1){return db[_0x39b6('0x19')]['find']({'raw':_0x102172[_0x39b6('0x1a')]?_0x102172[_0x39b6('0x1a')][_0x39b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x102172['options']?_0x102172[_0x39b6('0x1a')][_0x39b6('0x1c')]||null:null,'attributes':_0x102172['options']?_0x102172[_0x39b6('0x1a')]['attributes']||null:null,'include':_0x102172['options']?_0x102172[_0x39b6('0x1a')][_0x39b6('0x1d')]?_['map'](_0x102172['options'][_0x39b6('0x1d')],function(_0x4a87c6){return{'model':db[_0x4a87c6[_0x39b6('0x1e')]],'as':_0x4a87c6['as'],'attributes':_0x4a87c6[_0x39b6('0x1f')],'include':_0x4a87c6[_0x39b6('0x1d')]?_['map'](_0x4a87c6[_0x39b6('0x1d')],function(_0x3d8cc3){return{'model':db[_0x3d8cc3[_0x39b6('0x1e')]],'as':_0x3d8cc3['as'],'attributes':_0x3d8cc3[_0x39b6('0x1f')],'include':_0x3d8cc3[_0x39b6('0x1d')]?_['map'](_0x3d8cc3[_0x39b6('0x1d')],function(_0x50803a){return{'model':db[_0x50803a[_0x39b6('0x1e')]],'as':_0x50803a['as'],'attributes':_0x50803a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xcfbcc0){logger[_0x39b6('0x16')](_0x39b6('0x18'),_0x102172);logger[_0x39b6('0x11')](_0x39b6('0x18'),_0x102172,JSON[_0x39b6('0x20')](_0xcfbcc0));_0x4994c0(_0xcfbcc0);})[_0x39b6('0x21')](function(_0x470edf){logger[_0x39b6('0x13')]('ShowSquareProject',_0x470edf['message'],_0x102172);_0x1c14b1(_0x6e2062[_0x39b6('0x13')](0x1f4,_0x470edf[_0x39b6('0x15')]));});});}; \ No newline at end of file +var _0x581d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','ShowSquareProject','find','options','attributes','include','map','model','debug','catch','lodash','moment','randomstring'];(function(_0x9ce58e,_0x44e4f3){var _0x554be0=function(_0x3895aa){while(--_0x3895aa){_0x9ce58e['push'](_0x9ce58e['shift']());}};_0x554be0(++_0x44e4f3);}(_0x581d,0xc9));var _0xd581=function(_0x27f04a,_0x44725b){_0x27f04a=_0x27f04a-0x0;var _0x5049de=_0x581d[_0x27f04a];return _0x5049de;};'use strict';var _=require(_0xd581('0x0'));var util=require('util');var moment=require(_0xd581('0x1'));var BPromise=require('bluebird');var rs=require(_0xd581('0x2'));var fs=require('fs');var Redis=require(_0xd581('0x3'));var db=require(_0xd581('0x4'))['db'];var utils=require(_0xd581('0x5'));var logger=require(_0xd581('0x6'))('rpc');var config=require(_0xd581('0x7'));var jayson=require(_0xd581('0x8'));var client=jayson[_0xd581('0x9')][_0xd581('0xa')]({'port':0x232a});config['redis']=_[_0xd581('0xb')](config[_0xd581('0xc')],{'host':_0xd581('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd581('0xc')]));require('./squareProject.socket')[_0xd581('0xe')](socket);function respondWithRpcPromise(_0x5b106e,_0x504c36,_0x5b832f){return new BPromise(function(_0x5ec6ee,_0x399431){return client[_0xd581('0xf')](_0x5b106e,_0x5b832f)[_0xd581('0x10')](function(_0x3c5371){logger[_0xd581('0x11')](_0xd581('0x12'),_0x504c36,'request\x20sent');logger['debug'](_0xd581('0x13'),_0x504c36,_0xd581('0x14'),JSON['stringify'](_0x3c5371));if(_0x3c5371['error']){if(_0x3c5371[_0xd581('0x15')][_0xd581('0x16')]===0x1f4){logger[_0xd581('0x15')]('SquareProject,\x20%s,\x20%s',_0x504c36,_0x3c5371[_0xd581('0x15')][_0xd581('0x17')]);return _0x399431(_0x3c5371[_0xd581('0x15')][_0xd581('0x17')]);}logger['error'](_0xd581('0x12'),_0x504c36,_0x3c5371[_0xd581('0x15')][_0xd581('0x17')]);return _0x5ec6ee(_0x3c5371[_0xd581('0x15')][_0xd581('0x17')]);}else{logger[_0xd581('0x11')](_0xd581('0x12'),_0x504c36,'request\x20sent');_0x5ec6ee(_0x3c5371[_0xd581('0x18')][_0xd581('0x17')]);}})['catch'](function(_0x2bf54c){logger[_0xd581('0x15')]('SquareProject,\x20%s,\x20%s',_0x504c36,_0x2bf54c);_0x399431(_0x2bf54c);});});}exports[_0xd581('0x19')]=function(_0x181186){var _0x537543=this;return new Promise(function(_0x2279e4,_0x1958ce){return db['SquareProject'][_0xd581('0x1a')]({'raw':_0x181186[_0xd581('0x1b')]?_0x181186[_0xd581('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x181186[_0xd581('0x1b')]?_0x181186[_0xd581('0x1b')]['where']||null:null,'attributes':_0x181186['options']?_0x181186['options'][_0xd581('0x1c')]||null:null,'include':_0x181186['options']?_0x181186[_0xd581('0x1b')][_0xd581('0x1d')]?_[_0xd581('0x1e')](_0x181186[_0xd581('0x1b')][_0xd581('0x1d')],function(_0x2442ff){return{'model':db[_0x2442ff['model']],'as':_0x2442ff['as'],'attributes':_0x2442ff['attributes'],'include':_0x2442ff['include']?_[_0xd581('0x1e')](_0x2442ff[_0xd581('0x1d')],function(_0x5763fc){return{'model':db[_0x5763fc['model']],'as':_0x5763fc['as'],'attributes':_0x5763fc[_0xd581('0x1c')],'include':_0x5763fc[_0xd581('0x1d')]?_[_0xd581('0x1e')](_0x5763fc['include'],function(_0x199452){return{'model':db[_0x199452[_0xd581('0x1f')]],'as':_0x199452['as'],'attributes':_0x199452[_0xd581('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd581('0x10')](function(_0x33faca){logger[_0xd581('0x11')]('ShowSquareProject',_0x181186);logger[_0xd581('0x20')](_0xd581('0x19'),_0x181186,JSON['stringify'](_0x33faca));_0x2279e4(_0x33faca);})[_0xd581('0x21')](function(_0x3888dd){logger[_0xd581('0x15')](_0xd581('0x19'),_0x3888dd[_0xd581('0x17')],_0x181186);_0x1958ce(_0x537543[_0xd581('0x15')](0x1f4,_0x3888dd[_0xd581('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9b0699b..dc1bf81 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 _0x4975=['length','./squareProject.events','remove','update','emit','removeListener','register'];(function(_0xc9d01c,_0x5819c4){var _0x56f380=function(_0x457dac){while(--_0x457dac){_0xc9d01c['push'](_0xc9d01c['shift']());}};_0x56f380(++_0x5819c4);}(_0x4975,0x86));var _0x5497=function(_0x332ddc,_0x118f54){_0x332ddc=_0x332ddc-0x0;var _0x3df124=_0x4975[_0x332ddc];return _0x3df124;};'use strict';var SquareProjectEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){SquareProjectEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('squareProject:'+_0x674a2a,_0x539a27);SquareProjectEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x4975=['length','./squareProject.events','remove','update','emit','removeListener','register'];(function(_0x3c7625,_0x541c20){var _0x187951=function(_0x28197b){while(--_0x28197b){_0x3c7625['push'](_0x3c7625['shift']());}};_0x187951(++_0x541c20);}(_0x4975,0x86));var _0x5497=function(_0x3fc310,_0x1b505f){_0x3fc310=_0x3fc310-0x0;var _0x110a55=_0x4975[_0x3fc310];return _0x110a55;};'use strict';var SquareProjectEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){SquareProjectEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('squareProject:'+_0x674a2a,_0x539a27);SquareProjectEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 41dc395..0a5e73a 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 _0xd3c3=['download','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd3c3,0x16f));var _0x3d3c=function(_0x431772,_0x365fd6){_0x431772=_0x431772-0x0;var _0x37fc76=_0xd3c3[_0x431772];return _0x37fc76;};'use strict';var multer=require(_0x3d3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d3c('0x1'));var express=require(_0x3d3c('0x2'));var router=express[_0x3d3c('0x3')]();var auth=require(_0x3d3c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d3c('0x5'));var controller=require(_0x3d3c('0x6'));router[_0x3d3c('0x7')]('/',auth[_0x3d3c('0x8')](),controller[_0x3d3c('0x9')]);router[_0x3d3c('0x7')](_0x3d3c('0xa'),auth[_0x3d3c('0x8')](),controller[_0x3d3c('0xb')]);router[_0x3d3c('0x7')](_0x3d3c('0xc'),auth['isAuthenticated'](),controller[_0x3d3c('0xd')]);router[_0x3d3c('0xe')]('/',auth[_0x3d3c('0x8')](),controller[_0x3d3c('0xf')]);router[_0x3d3c('0x10')](_0x3d3c('0xa'),auth[_0x3d3c('0x8')](),controller['update']);router[_0x3d3c('0x11')]('/:id/delete',auth['isAuthenticated'](),controller[_0x3d3c('0x12')]);module[_0x3d3c('0x13')]=router; \ No newline at end of file +var _0xc241=['update','/:id/delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','/:id','isAuthenticated','show','/:id/download','create','put'];(function(_0x103afb,_0x47dae6){var _0x1a88d4=function(_0x4648de){while(--_0x4648de){_0x103afb['push'](_0x103afb['shift']());}};_0x1a88d4(++_0x47dae6);}(_0xc241,0x1c5));var _0x1c24=function(_0x19c4f5,_0x4f33fa){_0x19c4f5=_0x19c4f5-0x0;var _0x339f8c=_0xc241[_0x19c4f5];return _0x339f8c;};'use strict';var multer=require('multer');var util=require(_0x1c24('0x0'));var path=require(_0x1c24('0x1'));var timeout=require(_0x1c24('0x2'));var express=require(_0x1c24('0x3'));var router=express[_0x1c24('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1c24('0x5'));var config=require(_0x1c24('0x6'));var controller=require(_0x1c24('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1c24('0x8')](_0x1c24('0x9'),auth[_0x1c24('0xa')](),controller[_0x1c24('0xb')]);router['get'](_0x1c24('0xc'),auth[_0x1c24('0xa')](),controller['download']);router['post']('/',auth[_0x1c24('0xa')](),controller[_0x1c24('0xd')]);router[_0x1c24('0xe')](_0x1c24('0x9'),auth['isAuthenticated'](),controller[_0x1c24('0xf')]);router['delete'](_0x1c24('0x10'),auth[_0x1c24('0xa')](),controller['destroy']);module[_0x1c24('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 317d60a..73ca275 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 _0x6960=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize'];(function(_0x12cd04,_0x391a8b){var _0x4b9427=function(_0x4ceff9){while(--_0x4ceff9){_0x12cd04['push'](_0x12cd04['shift']());}};_0x4b9427(++_0x391a8b);}(_0x6960,0xae));var _0x0696=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6960[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x0696('0x0'));module[_0x0696('0x1')]={'uniqueid':{'type':Sequelize[_0x0696('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0696('0x2')]},'context':{'type':Sequelize[_0x0696('0x2')]},'extension':{'type':Sequelize[_0x0696('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x0696('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x0696('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0696('0x3')],'get':function(){var _0x2acd2a='';var _0x300f94=this[_0x0696('0x4')](_0x0696('0x5'));if(_0x300f94){_0x2acd2a=_0x300f94['substring'](_0x300f94[_0x0696('0x6')]('.'));}return _0x2acd2a;}}}; \ No newline at end of file +var _0x442b=['savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x442b,0x6f));var _0xb442=function(_0x30c475,_0x324f29){_0x30c475=_0x30c475-0x0;var _0x56e53e=_0x442b[_0x30c475];return _0x56e53e;};'use strict';var Sequelize=require(_0xb442('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb442('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb442('0x1')]},'context':{'type':Sequelize[_0xb442('0x1')]},'extension':{'type':Sequelize[_0xb442('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xb442('0x1')]},'projectName':{'type':Sequelize[_0xb442('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xb442('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb442('0x2')],'get':function(){var _0x3cc9ae='';var _0x1129d8=this['getDataValue'](_0xb442('0x3'));if(_0x1129d8){_0x3cc9ae=_0x1129d8[_0xb442('0x4')](_0x1129d8[_0xb442('0x5')]('.'));}return _0x3cc9ae;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f536796..341427d 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 _0x6e37=['show','params','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','error','stack','name','send','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','catch'];(function(_0x5ee73b,_0x282c4c){var _0x22948a=function(_0x4bb79b){while(--_0x4bb79b){_0x5ee73b['push'](_0x5ee73b['shift']());}};_0x22948a(++_0x282c4c);}(_0x6e37,0xd9));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x76e3('0x0'));var emlformat=require(_0x76e3('0x1'));var rimraf=require(_0x76e3('0x2'));var zipdir=require(_0x76e3('0x3'));var jsonpatch=require(_0x76e3('0x4'));var rp=require('request-promise');var moment=require(_0x76e3('0x5'));var BPromise=require(_0x76e3('0x6'));var Mustache=require(_0x76e3('0x7'));var util=require(_0x76e3('0x8'));var path=require(_0x76e3('0x9'));var sox=require(_0x76e3('0xa'));var csv=require(_0x76e3('0xb'));var ejs=require(_0x76e3('0xc'));var fs=require('fs');var _=require(_0x76e3('0xd'));var squel=require(_0x76e3('0xe'));var crypto=require(_0x76e3('0xf'));var jsforce=require(_0x76e3('0x10'));var deskjs=require(_0x76e3('0x11'));var toCsv=require(_0x76e3('0xb'));var querystring=require(_0x76e3('0x12'));var Papa=require(_0x76e3('0x13'));var Redis=require(_0x76e3('0x14'));var authService=require(_0x76e3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x76e3('0x16'));var hardwareService=require(_0x76e3('0x17'));var logger=require(_0x76e3('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x76e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x472f5e,_0x4222be){_0x4222be=_0x4222be||0xcc;return function(_0x4c1b39){if(_0x4c1b39){return _0x472f5e[_0x76e3('0x1a')](_0x4222be);}return _0x472f5e[_0x76e3('0x1b')](_0x4222be)[_0x76e3('0x1c')]();};}function respondWithResult(_0x49e993,_0x127c30){_0x127c30=_0x127c30||0xc8;return function(_0x4871e7){if(_0x4871e7){return _0x49e993[_0x76e3('0x1b')](_0x127c30)[_0x76e3('0x1d')](_0x4871e7);}};}function respondWithFilteredResult(_0x48a96f,_0xe09b7){return function(_0x5d270d){if(_0x5d270d){var _0x5d7cd3=_0x5d270d[_0x76e3('0x1e')],_0x4b6d49=_0xe09b7[_0x76e3('0x1f')],_0x16924a=_0xe09b7[_0x76e3('0x1f')]+_0xe09b7[_0x76e3('0x20')],_0x22f9a1;if(_0x16924a>=_0x5d7cd3){_0x16924a=_0x5d7cd3;_0x22f9a1=0xc8;}else{_0x22f9a1=0xce;}_0x48a96f[_0x76e3('0x1b')](_0x22f9a1);return _0x48a96f['set'](_0x76e3('0x21'),_0x4b6d49+'-'+_0x16924a+'/'+_0x5d7cd3)[_0x76e3('0x1d')](_0x5d270d);}return null;};}function patchUpdates(_0x445dbd){return function(_0x2815cf){try{jsonpatch[_0x76e3('0x22')](_0x2815cf,_0x445dbd,!![]);}catch(_0x555fb2){return BPromise['reject'](_0x555fb2);}return _0x2815cf['save']();};}function saveUpdates(_0x257bb8,_0x1278b6){return function(_0x41df89){if(_0x41df89){return _0x41df89[_0x76e3('0x23')](_0x257bb8)['then'](function(_0x2cb453){return _0x2cb453;});}return null;};}function removeEntity(_0x417000,_0x5abf60){return function(_0x2bfcf7){if(_0x2bfcf7){return _0x2bfcf7['destroy']()[_0x76e3('0x24')](function(){_0x417000[_0x76e3('0x1b')](0xcc)[_0x76e3('0x1c')]();});}};}function handleEntityNotFound(_0x4cb8fd,_0x201228){return function(_0x5ba9c9){if(!_0x5ba9c9){_0x4cb8fd[_0x76e3('0x1a')](0x194);}return _0x5ba9c9;};}function handleError(_0x38834c,_0x38aafb){_0x38aafb=_0x38aafb||0x1f4;return function(_0x34aa5d){logger[_0x76e3('0x25')](_0x34aa5d[_0x76e3('0x26')]);if(_0x34aa5d['name']){delete _0x34aa5d[_0x76e3('0x27')];}_0x38834c[_0x76e3('0x1b')](_0x38aafb)[_0x76e3('0x28')](_0x34aa5d);};}exports[_0x76e3('0x29')]=function(_0x5e1111,_0x4e8c1a){var _0x3d6f18={},_0x34fd63={},_0x5bf352={'count':0x0,'rows':[]};var _0x4d8d69=_['map'](db['SquareRecording'][_0x76e3('0x2a')],function(_0x4ec592){return{'name':_0x4ec592['fieldName'],'type':_0x4ec592['type']['key']};});_0x34fd63[_0x76e3('0x2b')]=_[_0x76e3('0x2c')](_0x4d8d69,_0x76e3('0x27'));_0x34fd63[_0x76e3('0x2d')]=_[_0x76e3('0x2e')](_0x5e1111['query']);_0x34fd63[_0x76e3('0x2f')]=_[_0x76e3('0x30')](_0x34fd63[_0x76e3('0x2b')],_0x34fd63[_0x76e3('0x2d')]);_0x3d6f18[_0x76e3('0x31')]=_[_0x76e3('0x30')](_0x34fd63[_0x76e3('0x2b')],qs['fields'](_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x32')]));_0x3d6f18[_0x76e3('0x31')]=_0x3d6f18[_0x76e3('0x31')][_0x76e3('0x33')]?_0x3d6f18[_0x76e3('0x31')]:_0x34fd63[_0x76e3('0x2b')];if(!_0x5e1111[_0x76e3('0x2d')]['hasOwnProperty'](_0x76e3('0x34'))){_0x3d6f18[_0x76e3('0x20')]=qs[_0x76e3('0x20')](_0x5e1111['query'][_0x76e3('0x20')]);_0x3d6f18['offset']=qs['offset'](_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x1f')]);}_0x3d6f18['order']=qs[_0x76e3('0x35')](_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x35')]);_0x3d6f18[_0x76e3('0x36')]=qs['filters'](_[_0x76e3('0x37')](_0x5e1111['query'],_0x34fd63['filters']),_0x4d8d69);if(_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x38')]){_0x3d6f18[_0x76e3('0x36')]=_[_0x76e3('0x39')](_0x3d6f18[_0x76e3('0x36')],{'$or':_['map'](_0x4d8d69,function(_0x5eb41b){if(_0x5eb41b['type']!==_0x76e3('0x3a')){var _0x13f125={};_0x13f125[_0x5eb41b[_0x76e3('0x27')]]={'$like':'%'+_0x5e1111['query'][_0x76e3('0x38')]+'%'};return _0x13f125;}})});}_0x3d6f18=_['merge']({},_0x3d6f18,_0x5e1111[_0x76e3('0x3b')]);var _0x39d835={'where':_0x3d6f18[_0x76e3('0x36')]};return db[_0x76e3('0x3c')][_0x76e3('0x1e')](_0x39d835)[_0x76e3('0x24')](function(_0x1ed2ca){_0x5bf352[_0x76e3('0x1e')]=_0x1ed2ca;if(_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x3d')]){_0x3d6f18[_0x76e3('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x76e3('0x3f')](_0x3d6f18);})[_0x76e3('0x24')](function(_0x288d42){_0x5bf352['rows']=_0x288d42;return _0x5bf352;})[_0x76e3('0x24')](respondWithFilteredResult(_0x4e8c1a,_0x3d6f18))[_0x76e3('0x40')](handleError(_0x4e8c1a,null));};exports[_0x76e3('0x41')]=function(_0x29619f,_0x5e5c05){var _0x4ec77a={'raw':!![],'where':{'id':_0x29619f[_0x76e3('0x42')]['id']}},_0x31fc93={};_0x31fc93[_0x76e3('0x2b')]=_[_0x76e3('0x2e')](db[_0x76e3('0x3c')][_0x76e3('0x2a')]);_0x31fc93[_0x76e3('0x2d')]=_['keys'](_0x29619f[_0x76e3('0x2d')]);_0x31fc93[_0x76e3('0x2f')]=_['intersection'](_0x31fc93['model'],_0x31fc93[_0x76e3('0x2d')]);_0x4ec77a['attributes']=_['intersection'](_0x31fc93[_0x76e3('0x2b')],qs[_0x76e3('0x32')](_0x29619f[_0x76e3('0x2d')][_0x76e3('0x32')]));_0x4ec77a[_0x76e3('0x31')]=_0x4ec77a[_0x76e3('0x31')][_0x76e3('0x33')]?_0x4ec77a['attributes']:_0x31fc93['model'];if(_0x29619f[_0x76e3('0x2d')]['includeAll']){_0x4ec77a[_0x76e3('0x3e')]=[{'all':!![]}];}_0x4ec77a=_[_0x76e3('0x39')]({},_0x4ec77a,_0x29619f[_0x76e3('0x3b')]);return db['SquareRecording'][_0x76e3('0x43')](_0x4ec77a)[_0x76e3('0x24')](handleEntityNotFound(_0x5e5c05,null))[_0x76e3('0x24')](respondWithResult(_0x5e5c05,null))[_0x76e3('0x40')](handleError(_0x5e5c05,null));};exports['create']=function(_0x2cb4c1,_0x389c1b){return db[_0x76e3('0x3c')][_0x76e3('0x44')](_0x2cb4c1[_0x76e3('0x45')],{})['then'](respondWithResult(_0x389c1b,0xc9))[_0x76e3('0x40')](handleError(_0x389c1b,null));};exports[_0x76e3('0x23')]=function(_0x513ca2,_0x369b2d){if(_0x513ca2[_0x76e3('0x45')]['id']){delete _0x513ca2[_0x76e3('0x45')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x513ca2[_0x76e3('0x42')]['id']}})['then'](handleEntityNotFound(_0x369b2d,null))[_0x76e3('0x24')](saveUpdates(_0x513ca2[_0x76e3('0x45')],null))[_0x76e3('0x24')](respondWithResult(_0x369b2d,null))['catch'](handleError(_0x369b2d,null));};exports[_0x76e3('0x46')]=function(_0x4e068d,_0x2de292,_0x24b78a){var _0x1b34cd=require(_0x76e3('0x47'));var _0x127fec=![];var _0x4d1476={};if(_0x4e068d[_0x76e3('0x2d')][_0x76e3('0x48')]&&_0x4e068d[_0x76e3('0x2d')][_0x76e3('0x48')]===_0x76e3('0x49')){_0x4d1476[_0x76e3('0x49')]=_0x4e068d[_0x76e3('0x42')]['id'];}else{_0x4d1476['id']=_0x4e068d[_0x76e3('0x42')]['id'];}return db[_0x76e3('0x3c')][_0x76e3('0x43')]({'where':_0x4d1476,'attributes':['id',_0x76e3('0x4a'),_0x76e3('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x2de292,null))[_0x76e3('0x24')](function(_0x4d6f53){if(_0x4d6f53){var _0x30309a=_0x4d6f53[_0x76e3('0x4a')];var _0x3c415d=util['format'](_0x76e3('0x4c'),_0x30309a);if(fs[_0x76e3('0x4d')](_0x3c415d)){_0x127fec=!![];return _0x1b34cd[_0x76e3('0x4e')](_0x3c415d,_0x30309a,config[_0x76e3('0x4f')][_0x76e3('0x50')])['then'](function(){return _0x4d6f53;});}return _0x4d6f53;}})['then'](function(_0x2a8fe6){if(_0x2a8fe6){var _0xdbc6f1=_0x2a8fe6[_0x76e3('0x4a')];if(!fs[_0x76e3('0x4d')](_0xdbc6f1)){throw new db[(_0x76e3('0x51'))]['ValidationError'](_0x76e3('0x52'));}if(_0x2a8fe6[_0x76e3('0x4b')]){return _0x2de292[_0x76e3('0x46')](_0xdbc6f1,_0x2a8fe6[_0x76e3('0x4b')]+path[_0x76e3('0x53')](_0xdbc6f1),function(){if(_0x127fec){fs[_0x76e3('0x54')](_0xdbc6f1);}});}else{return _0x2de292[_0x76e3('0x46')](_0xdbc6f1,function(_0x32440f){if(_0x127fec){fs[_0x76e3('0x54')](_0xdbc6f1);}});}}})[_0x76e3('0x40')](function(_0x3af978){if(_0x3af978[_0x76e3('0x55')]===_0x76e3('0x52')){_0x2de292[_0x76e3('0x1b')](0x194)['send'](_0x76e3('0x56'));}else{return handleError(_0x2de292,null);}});};exports['destroy']=function(_0x216c4b,_0x52011d){return db['SquareRecording'][_0x76e3('0x43')]({'where':{'id':_0x216c4b['params']['id']}})['then'](function(_0x3b2f39){if(!_0x3b2f39)throw new ReferenceError('Entity\x20not\x20found');return _0x3b2f39;})[_0x76e3('0x24')](function(_0x531dd5){var _0x53029b=_0x531dd5['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x53029b);if(!_[_0x76e3('0x57')](_0x531dd5[_0x76e3('0x4a')])&&fs[_0x76e3('0x4d')](_0x53029b)){logger[_0x76e3('0x58')](_0x76e3('0x59')+_0x53029b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76e3('0x5a')](_0x53029b);}_0x53029b=_0x53029b+_0x76e3('0x5b');if(!_[_0x76e3('0x57')](_0x531dd5['savePath'])&&fs[_0x76e3('0x4d')](_0x53029b)){logger[_0x76e3('0x58')](_0x76e3('0x59')+_0x53029b+_0x76e3('0x5c'));fs[_0x76e3('0x5a')](_0x53029b);}return _0x531dd5;})[_0x76e3('0x24')](function(_0x535fbe){if(!_0x535fbe)throw new InternalError();return _0x535fbe[_0x76e3('0x5d')]();})[_0x76e3('0x24')](function(){_0x52011d['status'](0xcc)['end']();})[_0x76e3('0x40')](handleError(_0x52011d,null));}; \ No newline at end of file +var _0xb34e=['where','filters','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','params','../../components/encryptor','uniqueid','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','unlink','download','message','SquareRecording\x20not\x20found','Not\x20found','destroy','Entity\x20not\x20found','savePath','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','save','update','then','end','error','name','send','SquareRecording','rawAttributes','fieldName','map','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb34e,0x143));var _0xeb34=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xb34e[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0xeb34('0x0'));var emlformat=require(_0xeb34('0x1'));var rimraf=require(_0xeb34('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb34('0x3'));var rp=require(_0xeb34('0x4'));var moment=require('moment');var BPromise=require(_0xeb34('0x5'));var Mustache=require(_0xeb34('0x6'));var util=require(_0xeb34('0x7'));var path=require('path');var sox=require(_0xeb34('0x8'));var csv=require(_0xeb34('0x9'));var ejs=require(_0xeb34('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb34('0xb'));var crypto=require('crypto');var jsforce=require(_0xeb34('0xc'));var deskjs=require(_0xeb34('0xd'));var toCsv=require(_0xeb34('0x9'));var querystring=require(_0xeb34('0xe'));var Papa=require('papaparse');var Redis=require(_0xeb34('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb34('0x10'));var as=require(_0xeb34('0x11'));var hardwareService=require(_0xeb34('0x12'));var logger=require(_0xeb34('0x13'))(_0xeb34('0x14'));var utils=require(_0xeb34('0x15'));var config=require(_0xeb34('0x16'));var db=require(_0xeb34('0x17'))['db'];function respondWithStatusCode(_0x3b45cd,_0x26e5e9){_0x26e5e9=_0x26e5e9||0xcc;return function(_0x1f2c4d){if(_0x1f2c4d){return _0x3b45cd[_0xeb34('0x18')](_0x26e5e9);}return _0x3b45cd['status'](_0x26e5e9)['end']();};}function respondWithResult(_0x39cba8,_0x5638d5){_0x5638d5=_0x5638d5||0xc8;return function(_0x52f3c5){if(_0x52f3c5){return _0x39cba8[_0xeb34('0x19')](_0x5638d5)[_0xeb34('0x1a')](_0x52f3c5);}};}function respondWithFilteredResult(_0x1ae68c,_0x524263){return function(_0x56e387){if(_0x56e387){var _0x33eb1f=_0x56e387['count'],_0x2c0b59=_0x524263[_0xeb34('0x1b')],_0x509fdd=_0x524263[_0xeb34('0x1b')]+_0x524263[_0xeb34('0x1c')],_0x2908e7;if(_0x509fdd>=_0x33eb1f){_0x509fdd=_0x33eb1f;_0x2908e7=0xc8;}else{_0x2908e7=0xce;}_0x1ae68c[_0xeb34('0x19')](_0x2908e7);return _0x1ae68c['set']('Content-Range',_0x2c0b59+'-'+_0x509fdd+'/'+_0x33eb1f)[_0xeb34('0x1a')](_0x56e387);}return null;};}function patchUpdates(_0x2286fa){return function(_0x4ef040){try{jsonpatch[_0xeb34('0x1d')](_0x4ef040,_0x2286fa,!![]);}catch(_0x12ea55){return BPromise['reject'](_0x12ea55);}return _0x4ef040[_0xeb34('0x1e')]();};}function saveUpdates(_0x57dab0,_0x34565e){return function(_0x20647d){if(_0x20647d){return _0x20647d[_0xeb34('0x1f')](_0x57dab0)['then'](function(_0x319d45){return _0x319d45;});}return null;};}function removeEntity(_0x43f78e,_0x4842cb){return function(_0x4e45ec){if(_0x4e45ec){return _0x4e45ec['destroy']()[_0xeb34('0x20')](function(){_0x43f78e['status'](0xcc)[_0xeb34('0x21')]();});}};}function handleEntityNotFound(_0xe8c379,_0x5944f1){return function(_0x42c920){if(!_0x42c920){_0xe8c379[_0xeb34('0x18')](0x194);}return _0x42c920;};}function handleError(_0x16dedc,_0x1a2ae5){_0x1a2ae5=_0x1a2ae5||0x1f4;return function(_0x5dd502){logger[_0xeb34('0x22')](_0x5dd502['stack']);if(_0x5dd502[_0xeb34('0x23')]){delete _0x5dd502[_0xeb34('0x23')];}_0x16dedc['status'](_0x1a2ae5)[_0xeb34('0x24')](_0x5dd502);};}exports['index']=function(_0x10c5f4,_0x4d8544){var _0x4ba8e0={},_0x172ab8={},_0x72a7c0={'count':0x0,'rows':[]};var _0x2b0313=_['map'](db[_0xeb34('0x25')][_0xeb34('0x26')],function(_0x42a597){return{'name':_0x42a597[_0xeb34('0x27')],'type':_0x42a597['type']['key']};});_0x172ab8['model']=_[_0xeb34('0x28')](_0x2b0313,_0xeb34('0x23'));_0x172ab8[_0xeb34('0x29')]=_['keys'](_0x10c5f4['query']);_0x172ab8['filters']=_['intersection'](_0x172ab8['model'],_0x172ab8[_0xeb34('0x29')]);_0x4ba8e0[_0xeb34('0x2a')]=_['intersection'](_0x172ab8[_0xeb34('0x2b')],qs['fields'](_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x2c')]));_0x4ba8e0[_0xeb34('0x2a')]=_0x4ba8e0[_0xeb34('0x2a')][_0xeb34('0x2d')]?_0x4ba8e0[_0xeb34('0x2a')]:_0x172ab8[_0xeb34('0x2b')];if(!_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x2e')](_0xeb34('0x2f'))){_0x4ba8e0[_0xeb34('0x1c')]=qs[_0xeb34('0x1c')](_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x1c')]);_0x4ba8e0[_0xeb34('0x1b')]=qs[_0xeb34('0x1b')](_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x1b')]);}_0x4ba8e0['order']=qs[_0xeb34('0x30')](_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x30')]);_0x4ba8e0[_0xeb34('0x31')]=qs[_0xeb34('0x32')](_['pick'](_0x10c5f4[_0xeb34('0x29')],_0x172ab8['filters']),_0x2b0313);if(_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x33')]){_0x4ba8e0[_0xeb34('0x31')]=_['merge'](_0x4ba8e0[_0xeb34('0x31')],{'$or':_[_0xeb34('0x28')](_0x2b0313,function(_0x272f46){if(_0x272f46[_0xeb34('0x34')]!==_0xeb34('0x35')){var _0x557437={};_0x557437[_0x272f46['name']]={'$like':'%'+_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x33')]+'%'};return _0x557437;}})});}_0x4ba8e0=_[_0xeb34('0x36')]({},_0x4ba8e0,_0x10c5f4[_0xeb34('0x37')]);var _0xd674b0={'where':_0x4ba8e0[_0xeb34('0x31')]};return db['SquareRecording'][_0xeb34('0x38')](_0xd674b0)[_0xeb34('0x20')](function(_0x2857d1){_0x72a7c0['count']=_0x2857d1;if(_0x10c5f4[_0xeb34('0x29')][_0xeb34('0x39')]){_0x4ba8e0[_0xeb34('0x3a')]=[{'all':!![]}];}return db[_0xeb34('0x25')][_0xeb34('0x3b')](_0x4ba8e0);})[_0xeb34('0x20')](function(_0x235e5d){_0x72a7c0[_0xeb34('0x3c')]=_0x235e5d;return _0x72a7c0;})[_0xeb34('0x20')](respondWithFilteredResult(_0x4d8544,_0x4ba8e0))[_0xeb34('0x3d')](handleError(_0x4d8544,null));};exports[_0xeb34('0x3e')]=function(_0x67e55a,_0x400e67){var _0x40bcd0={'raw':!![],'where':{'id':_0x67e55a['params']['id']}},_0xa8525c={};_0xa8525c[_0xeb34('0x2b')]=_[_0xeb34('0x3f')](db[_0xeb34('0x25')][_0xeb34('0x26')]);_0xa8525c[_0xeb34('0x29')]=_[_0xeb34('0x3f')](_0x67e55a[_0xeb34('0x29')]);_0xa8525c[_0xeb34('0x32')]=_[_0xeb34('0x40')](_0xa8525c[_0xeb34('0x2b')],_0xa8525c['query']);_0x40bcd0['attributes']=_['intersection'](_0xa8525c[_0xeb34('0x2b')],qs[_0xeb34('0x2c')](_0x67e55a[_0xeb34('0x29')][_0xeb34('0x2c')]));_0x40bcd0['attributes']=_0x40bcd0[_0xeb34('0x2a')][_0xeb34('0x2d')]?_0x40bcd0['attributes']:_0xa8525c['model'];if(_0x67e55a[_0xeb34('0x29')][_0xeb34('0x39')]){_0x40bcd0['include']=[{'all':!![]}];}_0x40bcd0=_[_0xeb34('0x36')]({},_0x40bcd0,_0x67e55a[_0xeb34('0x37')]);return db[_0xeb34('0x25')][_0xeb34('0x41')](_0x40bcd0)['then'](handleEntityNotFound(_0x400e67,null))['then'](respondWithResult(_0x400e67,null))['catch'](handleError(_0x400e67,null));};exports[_0xeb34('0x42')]=function(_0x420ce5,_0x1dd098){return db[_0xeb34('0x25')][_0xeb34('0x42')](_0x420ce5['body'],{})[_0xeb34('0x20')](respondWithResult(_0x1dd098,0xc9))[_0xeb34('0x3d')](handleError(_0x1dd098,null));};exports[_0xeb34('0x1f')]=function(_0xb6bdc,_0x12267b){if(_0xb6bdc['body']['id']){delete _0xb6bdc[_0xeb34('0x43')]['id'];}return db[_0xeb34('0x25')][_0xeb34('0x41')]({'where':{'id':_0xb6bdc[_0xeb34('0x44')]['id']}})[_0xeb34('0x20')](handleEntityNotFound(_0x12267b,null))[_0xeb34('0x20')](saveUpdates(_0xb6bdc['body'],null))['then'](respondWithResult(_0x12267b,null))[_0xeb34('0x3d')](handleError(_0x12267b,null));};exports['download']=function(_0x46471b,_0xbbe661,_0x25ff23){var _0x2f4673=require(_0xeb34('0x45'));var _0x2901c4=![];var _0x578219={};if(_0x46471b['query'][_0xeb34('0x34')]&&_0x46471b[_0xeb34('0x29')][_0xeb34('0x34')]===_0xeb34('0x46')){_0x578219['uniqueid']=_0x46471b[_0xeb34('0x44')]['id'];}else{_0x578219['id']=_0x46471b[_0xeb34('0x44')]['id'];}return db['SquareRecording'][_0xeb34('0x41')]({'where':_0x578219,'attributes':['id','savePath','filename'],'raw':!![]})[_0xeb34('0x20')](handleEntityNotFound(_0xbbe661,null))[_0xeb34('0x20')](function(_0xf74133){if(_0xf74133){var _0x3f0230=_0xf74133['savePath'];var _0xc1ea67=util[_0xeb34('0x47')](_0xeb34('0x48'),_0x3f0230);if(fs[_0xeb34('0x49')](_0xc1ea67)){_0x2901c4=!![];return _0x2f4673[_0xeb34('0x4a')](_0xc1ea67,_0x3f0230,config[_0xeb34('0x4b')][_0xeb34('0x4c')])[_0xeb34('0x20')](function(){return _0xf74133;});}return _0xf74133;}})['then'](function(_0x3170bf){if(_0x3170bf){var _0x3bc50b=_0x3170bf['savePath'];if(!fs[_0xeb34('0x49')](_0x3bc50b)){throw new db[(_0xeb34('0x4d'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x3170bf[_0xeb34('0x4e')]){return _0xbbe661['download'](_0x3bc50b,_0x3170bf[_0xeb34('0x4e')]+path['extname'](_0x3bc50b),function(){if(_0x2901c4){fs[_0xeb34('0x4f')](_0x3bc50b);}});}else{return _0xbbe661[_0xeb34('0x50')](_0x3bc50b,function(_0x32d6cb){if(_0x2901c4){fs[_0xeb34('0x4f')](_0x3bc50b);}});}}})[_0xeb34('0x3d')](function(_0x736105){if(_0x736105[_0xeb34('0x51')]===_0xeb34('0x52')){_0xbbe661[_0xeb34('0x19')](0x194)[_0xeb34('0x24')](_0xeb34('0x53'));}else{return handleError(_0xbbe661,null);}});};exports[_0xeb34('0x54')]=function(_0x8e2964,_0xe21684){return db[_0xeb34('0x25')][_0xeb34('0x41')]({'where':{'id':_0x8e2964[_0xeb34('0x44')]['id']}})[_0xeb34('0x20')](function(_0x4ed444){if(!_0x4ed444)throw new ReferenceError(_0xeb34('0x55'));return _0x4ed444;})[_0xeb34('0x20')](function(_0x3de849){var _0x55b23d=_0x3de849[_0xeb34('0x56')];logger[_0xeb34('0x57')](_0xeb34('0x58'),_0x55b23d);if(!_[_0xeb34('0x59')](_0x3de849[_0xeb34('0x56')])&&fs[_0xeb34('0x49')](_0x55b23d)){logger[_0xeb34('0x57')](_0xeb34('0x5a')+_0x55b23d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x55b23d);}_0x55b23d=_0x55b23d+_0xeb34('0x5b');if(!_[_0xeb34('0x59')](_0x3de849[_0xeb34('0x56')])&&fs['existsSync'](_0x55b23d)){logger['info']('File:\x20\x22'+_0x55b23d+_0xeb34('0x5c'));fs['unlinkSync'](_0x55b23d);}return _0x3de849;})['then'](function(_0x58d86b){if(!_0x58d86b)throw new InternalError();return _0x58d86b[_0xeb34('0x54')]();})[_0xeb34('0x20')](function(){_0xe21684[_0xeb34('0x19')](0xcc)[_0xeb34('0x21')]();})['catch'](handleError(_0xe21684,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 9be46a2..5fae8cd 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 _0xb450=['../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','rimraf'];(function(_0x3afec0,_0x2c7752){var _0x90b878=function(_0x43b4aa){while(--_0x43b4aa){_0x3afec0['push'](_0x3afec0['shift']());}};_0x90b878(++_0x2c7752);}(_0xb450,0x195));var _0x0b45=function(_0x3f87f2,_0x250b96){_0x3f87f2=_0x3f87f2-0x0;var _0x2d70ac=_0xb450[_0x3f87f2];return _0x2d70ac;};'use strict';var _=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var logger=require(_0x0b45('0x2'))(_0x0b45('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(_0x0b45('0x4'));var config=require(_0x0b45('0x5'));var attributes=require('./squareRecording.attributes');module[_0x0b45('0x6')]=function(_0x260aaf,_0x1997fb){return _0x260aaf[_0x0b45('0x7')](_0x0b45('0x8'),attributes,{'tableName':_0x0b45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a87=['define','SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x16ca11,_0x5c8f1e){var _0x3c8f7e=function(_0x4cb921){while(--_0x4cb921){_0x16ca11['push'](_0x16ca11['shift']());}};_0x3c8f7e(++_0x5c8f1e);}(_0x9a87,0x148));var _0x79a8=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x9a87[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x79a8('0x0'));var util=require(_0x79a8('0x1'));var logger=require('../../config/logger')(_0x79a8('0x2'));var moment=require(_0x79a8('0x3'));var BPromise=require(_0x79a8('0x4'));var rp=require(_0x79a8('0x5'));var fs=require('fs');var path=require(_0x79a8('0x6'));var rimraf=require(_0x79a8('0x7'));var config=require(_0x79a8('0x8'));var attributes=require('./squareRecording.attributes');module[_0x79a8('0x9')]=function(_0x51b849,_0x325c32){return _0x51b849[_0x79a8('0xa')](_0x79a8('0xb'),attributes,{'tableName':_0x79a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 8f2ee5c..7b28834 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 _0x9985=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b4bef,_0x17022c){var _0x23c51b=function(_0x3bfdb6){while(--_0x3bfdb6){_0x3b4bef['push'](_0x3b4bef['shift']());}};_0x23c51b(++_0x17022c);}(_0x9985,0x176));var _0x5998=function(_0x4a584a,_0x2d893d){_0x4a584a=_0x4a584a-0x0;var _0x24d74c=_0x9985[_0x4a584a];return _0x24d74c;};'use strict';var _=require(_0x5998('0x0'));var util=require(_0x5998('0x1'));var moment=require(_0x5998('0x2'));var BPromise=require('bluebird');var rs=require(_0x5998('0x3'));var fs=require('fs');var Redis=require(_0x5998('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5998('0x5'));var logger=require(_0x5998('0x6'))(_0x5998('0x7'));var config=require('../../config/environment');var jayson=require(_0x5998('0x8'));var client=jayson[_0x5998('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eae7e,_0x446d02,_0x3aa45d){return new BPromise(function(_0x2f8be5,_0x4cfc1a){return client[_0x5998('0xa')](_0x2eae7e,_0x3aa45d)[_0x5998('0xb')](function(_0x1a5d58){logger[_0x5998('0xc')](_0x5998('0xd'),_0x446d02,_0x5998('0xe'));logger[_0x5998('0xf')](_0x5998('0x10'),_0x446d02,_0x5998('0xe'),JSON[_0x5998('0x11')](_0x1a5d58));if(_0x1a5d58[_0x5998('0x12')]){if(_0x1a5d58[_0x5998('0x12')]['code']===0x1f4){logger[_0x5998('0x12')](_0x5998('0xd'),_0x446d02,_0x1a5d58['error'][_0x5998('0x13')]);return _0x4cfc1a(_0x1a5d58[_0x5998('0x12')][_0x5998('0x13')]);}logger['error'](_0x5998('0xd'),_0x446d02,_0x1a5d58[_0x5998('0x12')][_0x5998('0x13')]);return _0x2f8be5(_0x1a5d58[_0x5998('0x12')][_0x5998('0x13')]);}else{logger[_0x5998('0xc')](_0x5998('0xd'),_0x446d02,_0x5998('0xe'));_0x2f8be5(_0x1a5d58[_0x5998('0x14')]['message']);}})['catch'](function(_0x33e60e){logger[_0x5998('0x12')](_0x5998('0xd'),_0x446d02,_0x33e60e);_0x4cfc1a(_0x33e60e);});});}exports[_0x5998('0x15')]=function(_0xe470c8){var _0x36321d=this;return new Promise(function(_0x4ba657,_0xf93471){return db[_0x5998('0x16')][_0x5998('0x17')](_0xe470c8['body'],{'raw':_0xe470c8[_0x5998('0x18')]?_0xe470c8[_0x5998('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x5998('0xb')](function(_0xb5024d){logger['info'](_0x5998('0x15'),_0xe470c8);logger['debug'](_0x5998('0x15'),_0xe470c8,JSON['stringify'](_0xb5024d));_0x4ba657(_0xb5024d);})[_0x5998('0x19')](function(_0x3ff603){logger[_0x5998('0x12')]('CreateSquareRecording',_0x3ff603[_0x5998('0x13')],_0xe470c8);_0xf93471(_0x36321d[_0x5998('0x12')](0x1f4,_0x3ff603['message']));});});}; \ No newline at end of file +var _0xad7e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','body','info','debug'];(function(_0x3ce4f4,_0x5cee09){var _0x5acbbe=function(_0x3c31c7){while(--_0x3c31c7){_0x3ce4f4['push'](_0x3ce4f4['shift']());}};_0x5acbbe(++_0x5cee09);}(_0xad7e,0x1cb));var _0xead7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xead7('0x0'));var util=require(_0xead7('0x1'));var moment=require(_0xead7('0x2'));var BPromise=require(_0xead7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xead7('0x4'));var db=require(_0xead7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xead7('0x6'))(_0xead7('0x7'));var config=require(_0xead7('0x8'));var jayson=require(_0xead7('0x9'));var client=jayson['client'][_0xead7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c3a8c,_0x1c7fe6,_0x3f5d8b){return new BPromise(function(_0x48cdc1,_0x5a2258){return client[_0xead7('0xb')](_0x5c3a8c,_0x3f5d8b)[_0xead7('0xc')](function(_0x5d4f60){logger['info'](_0xead7('0xd'),_0x1c7fe6,'request\x20sent');logger['debug'](_0xead7('0xe'),_0x1c7fe6,_0xead7('0xf'),JSON[_0xead7('0x10')](_0x5d4f60));if(_0x5d4f60['error']){if(_0x5d4f60[_0xead7('0x11')][_0xead7('0x12')]===0x1f4){logger[_0xead7('0x11')]('SquareRecording,\x20%s,\x20%s',_0x1c7fe6,_0x5d4f60[_0xead7('0x11')]['message']);return _0x5a2258(_0x5d4f60['error']['message']);}logger[_0xead7('0x11')](_0xead7('0xd'),_0x1c7fe6,_0x5d4f60['error'][_0xead7('0x13')]);return _0x48cdc1(_0x5d4f60[_0xead7('0x11')][_0xead7('0x13')]);}else{logger['info'](_0xead7('0xd'),_0x1c7fe6,_0xead7('0xf'));_0x48cdc1(_0x5d4f60[_0xead7('0x14')][_0xead7('0x13')]);}})[_0xead7('0x15')](function(_0x14c012){logger[_0xead7('0x11')](_0xead7('0xd'),_0x1c7fe6,_0x14c012);_0x5a2258(_0x14c012);});});}exports[_0xead7('0x16')]=function(_0x4b64d6){var _0x2a8382=this;return new Promise(function(_0x23a608,_0x2c72e5){return db[_0xead7('0x17')]['create'](_0x4b64d6[_0xead7('0x18')],{'raw':_0x4b64d6['options']?_0x4b64d6['options']['raw']===undefined?!![]:![]:!![]})[_0xead7('0xc')](function(_0x5a43df){logger[_0xead7('0x19')](_0xead7('0x16'),_0x4b64d6);logger[_0xead7('0x1a')]('CreateSquareRecording',_0x4b64d6,JSON[_0xead7('0x10')](_0x5a43df));_0x23a608(_0x5a43df);})[_0xead7('0x15')](function(_0x1023fd){logger[_0xead7('0x11')]('CreateSquareRecording',_0x1023fd[_0xead7('0x13')],_0x4b64d6);_0x2c72e5(_0x2a8382[_0xead7('0x11')](0x1f4,_0x1023fd[_0xead7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9ebc0c3..b14743c 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 _0x4eda=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eda,0x1ed));var _0xa4ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4eda[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xa4ed('0x0'));var util=require(_0xa4ed('0x1'));var path=require(_0xa4ed('0x2'));var timeout=require(_0xa4ed('0x3'));var express=require(_0xa4ed('0x4'));var router=express[_0xa4ed('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4ed('0x6'));var config=require(_0xa4ed('0x7'));var controller=require(_0xa4ed('0x8'));router[_0xa4ed('0x9')]('/',auth[_0xa4ed('0xa')](),controller[_0xa4ed('0xb')]);router[_0xa4ed('0x9')](_0xa4ed('0xc'),auth[_0xa4ed('0xa')](),controller['describe']);router[_0xa4ed('0x9')](_0xa4ed('0xd'),auth[_0xa4ed('0xa')](),controller[_0xa4ed('0xe')]);router['post']('/',auth[_0xa4ed('0xa')](),controller['create']);router[_0xa4ed('0xf')](_0xa4ed('0xd'),auth[_0xa4ed('0xa')](),controller[_0xa4ed('0x10')]);router[_0xa4ed('0x11')](_0xa4ed('0xd'),auth[_0xa4ed('0xa')](),controller['destroy']);module[_0xa4ed('0x12')]=router; \ No newline at end of file +var _0xfc53=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x501dbc,_0x112a28){var _0x304d18=function(_0x5260b0){while(--_0x5260b0){_0x501dbc['push'](_0x501dbc['shift']());}};_0x304d18(++_0x112a28);}(_0xfc53,0xa2));var _0x3fc5=function(_0x5bd660,_0x5df09c){_0x5bd660=_0x5bd660-0x0;var _0x3f2ee0=_0xfc53[_0x5bd660];return _0x3f2ee0;};'use strict';var multer=require(_0x3fc5('0x0'));var util=require(_0x3fc5('0x1'));var path=require(_0x3fc5('0x2'));var timeout=require('connect-timeout');var express=require(_0x3fc5('0x3'));var router=express[_0x3fc5('0x4')]();var auth=require(_0x3fc5('0x5'));var interaction=require(_0x3fc5('0x6'));var config=require(_0x3fc5('0x7'));var controller=require(_0x3fc5('0x8'));router[_0x3fc5('0x9')]('/',auth[_0x3fc5('0xa')](),controller[_0x3fc5('0xb')]);router[_0x3fc5('0x9')](_0x3fc5('0xc'),auth[_0x3fc5('0xa')](),controller[_0x3fc5('0xd')]);router[_0x3fc5('0x9')](_0x3fc5('0xe'),auth['isAuthenticated'](),controller[_0x3fc5('0xf')]);router[_0x3fc5('0x10')]('/',auth[_0x3fc5('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3fc5('0x11')]);router[_0x3fc5('0x12')](_0x3fc5('0xe'),auth[_0x3fc5('0xa')](),controller[_0x3fc5('0x13')]);module[_0x3fc5('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ac236b9..cd3621f 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 _0x4be1=['DATE','BOOLEAN','exports','STRING'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4be1,0x14a));var _0x14be=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x4be1[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require('sequelize');module[_0x14be('0x0')]={'network':{'type':Sequelize[_0x14be('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x14be('0x1')]},'channel':{'type':Sequelize[_0x14be('0x1')]},'language':{'type':Sequelize[_0x14be('0x1')]},'type':{'type':Sequelize[_0x14be('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x14be('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x14be('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x14be('0x1')]},'callingtns':{'type':Sequelize[_0x14be('0x1')]},'dnid':{'type':Sequelize[_0x14be('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x14be('0x1')]},'extension':{'type':Sequelize[_0x14be('0x1')]},'priority':{'type':Sequelize[_0x14be('0x1')]},'enhanced':{'type':Sequelize[_0x14be('0x1')]},'accountcode':{'type':Sequelize[_0x14be('0x1')]},'threadid':{'type':Sequelize[_0x14be('0x1')]},'project_name':{'type':Sequelize[_0x14be('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x14be('0x2')]},'bot':{'type':Sequelize[_0x14be('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb3c0=['STRING','DATE','BOOLEAN','exports'];(function(_0x194259,_0x116bf7){var _0x56a07a=function(_0x32f39d){while(--_0x32f39d){_0x194259['push'](_0x194259['shift']());}};_0x56a07a(++_0x116bf7);}(_0xb3c0,0x8b));var _0x0b3c=function(_0x33324b,_0x9959fe){_0x33324b=_0x33324b-0x0;var _0x4cd1d0=_0xb3c0[_0x33324b];return _0x4cd1d0;};'use strict';var Sequelize=require('sequelize');module[_0x0b3c('0x0')]={'network':{'type':Sequelize[_0x0b3c('0x1')]},'network_script':{'type':Sequelize[_0x0b3c('0x1')]},'request':{'type':Sequelize[_0x0b3c('0x1')]},'channel':{'type':Sequelize[_0x0b3c('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0b3c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0b3c('0x1')]},'calleridname':{'type':Sequelize[_0x0b3c('0x1')]},'callingpres':{'type':Sequelize[_0x0b3c('0x1')]},'callingani2':{'type':Sequelize[_0x0b3c('0x1')]},'callington':{'type':Sequelize[_0x0b3c('0x1')]},'callingtns':{'type':Sequelize[_0x0b3c('0x1')]},'dnid':{'type':Sequelize[_0x0b3c('0x1')]},'rdnis':{'type':Sequelize[_0x0b3c('0x1')]},'context':{'type':Sequelize[_0x0b3c('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x0b3c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x0b3c('0x1')]},'joinAt':{'type':Sequelize[_0x0b3c('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x0b3c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d205535..09285da 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 _0x7a24=['fast-json-patch','request-promise','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','options','find','create','body','params','describe','html-pdf','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a24,0xd2));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x47a2('0x0'));var emlformat=require(_0x47a2('0x1'));var rimraf=require(_0x47a2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a2('0x3'));var rp=require(_0x47a2('0x4'));var moment=require('moment');var BPromise=require(_0x47a2('0x5'));var Mustache=require(_0x47a2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x47a2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x47a2('0x8'));var squel=require(_0x47a2('0x9'));var crypto=require(_0x47a2('0xa'));var jsforce=require(_0x47a2('0xb'));var deskjs=require(_0x47a2('0xc'));var toCsv=require(_0x47a2('0x7'));var querystring=require(_0x47a2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x47a2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x47a2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a2('0x10'))(_0x47a2('0x11'));var utils=require(_0x47a2('0x12'));var config=require(_0x47a2('0x13'));var db=require(_0x47a2('0x14'))['db'];function respondWithStatusCode(_0x2dbb59,_0x47ff67){_0x47ff67=_0x47ff67||0xcc;return function(_0x1e51b0){if(_0x1e51b0){return _0x2dbb59[_0x47a2('0x15')](_0x47ff67);}return _0x2dbb59[_0x47a2('0x16')](_0x47ff67)[_0x47a2('0x17')]();};}function respondWithResult(_0x432e5a,_0x32b885){_0x32b885=_0x32b885||0xc8;return function(_0x44b7fb){if(_0x44b7fb){return _0x432e5a[_0x47a2('0x16')](_0x32b885)[_0x47a2('0x18')](_0x44b7fb);}};}function respondWithFilteredResult(_0x34d28c,_0x23c5b3){return function(_0x55f5c1){if(_0x55f5c1){var _0x1c55fe=_0x55f5c1[_0x47a2('0x19')],_0x2bfcee=_0x23c5b3[_0x47a2('0x1a')],_0x3cbbec=_0x23c5b3[_0x47a2('0x1a')]+_0x23c5b3[_0x47a2('0x1b')],_0x1f8ccd;if(_0x3cbbec>=_0x1c55fe){_0x3cbbec=_0x1c55fe;_0x1f8ccd=0xc8;}else{_0x1f8ccd=0xce;}_0x34d28c[_0x47a2('0x16')](_0x1f8ccd);return _0x34d28c['set'](_0x47a2('0x1c'),_0x2bfcee+'-'+_0x3cbbec+'/'+_0x1c55fe)['json'](_0x55f5c1);}return null;};}function patchUpdates(_0x20172f){return function(_0x22616d){try{jsonpatch[_0x47a2('0x1d')](_0x22616d,_0x20172f,!![]);}catch(_0x4e8915){return BPromise['reject'](_0x4e8915);}return _0x22616d[_0x47a2('0x1e')]();};}function saveUpdates(_0x4f9a03,_0x347949){return function(_0x507c9e){if(_0x507c9e){return _0x507c9e[_0x47a2('0x1f')](_0x4f9a03)[_0x47a2('0x20')](function(_0x2b8cc2){return _0x2b8cc2;});}return null;};}function removeEntity(_0x21bcf6,_0x563719){return function(_0x2f36f8){if(_0x2f36f8){return _0x2f36f8[_0x47a2('0x21')]()[_0x47a2('0x20')](function(){_0x21bcf6['status'](0xcc)[_0x47a2('0x17')]();});}};}function handleEntityNotFound(_0x3ae924,_0x440dcc){return function(_0x1ad833){if(!_0x1ad833){_0x3ae924[_0x47a2('0x15')](0x194);}return _0x1ad833;};}function handleError(_0x1cd9d6,_0x46441c){_0x46441c=_0x46441c||0x1f4;return function(_0x509ca8){logger[_0x47a2('0x22')](_0x509ca8[_0x47a2('0x23')]);if(_0x509ca8[_0x47a2('0x24')]){delete _0x509ca8[_0x47a2('0x24')];}_0x1cd9d6[_0x47a2('0x16')](_0x46441c)[_0x47a2('0x25')](_0x509ca8);};}exports['index']=function(_0x265015,_0x2cdbdb){var _0x21ee3d={},_0x372991={},_0x1d1336={'count':0x0,'rows':[]};var _0x1db8ac=_[_0x47a2('0x26')](db[_0x47a2('0x27')][_0x47a2('0x28')],function(_0x1775ed){return{'name':_0x1775ed[_0x47a2('0x29')],'type':_0x1775ed[_0x47a2('0x2a')][_0x47a2('0x2b')]};});_0x372991[_0x47a2('0x2c')]=_[_0x47a2('0x26')](_0x1db8ac,_0x47a2('0x24'));_0x372991[_0x47a2('0x2d')]=_[_0x47a2('0x2e')](_0x265015[_0x47a2('0x2d')]);_0x372991[_0x47a2('0x2f')]=_['intersection'](_0x372991[_0x47a2('0x2c')],_0x372991[_0x47a2('0x2d')]);_0x21ee3d[_0x47a2('0x30')]=_[_0x47a2('0x31')](_0x372991[_0x47a2('0x2c')],qs[_0x47a2('0x32')](_0x265015[_0x47a2('0x2d')][_0x47a2('0x32')]));_0x21ee3d[_0x47a2('0x30')]=_0x21ee3d['attributes'][_0x47a2('0x33')]?_0x21ee3d[_0x47a2('0x30')]:_0x372991[_0x47a2('0x2c')];if(!_0x265015[_0x47a2('0x2d')][_0x47a2('0x34')](_0x47a2('0x35'))){_0x21ee3d[_0x47a2('0x1b')]=qs[_0x47a2('0x1b')](_0x265015[_0x47a2('0x2d')][_0x47a2('0x1b')]);_0x21ee3d[_0x47a2('0x1a')]=qs['offset'](_0x265015[_0x47a2('0x2d')][_0x47a2('0x1a')]);}_0x21ee3d[_0x47a2('0x36')]=qs[_0x47a2('0x37')](_0x265015['query'][_0x47a2('0x37')]);_0x21ee3d[_0x47a2('0x38')]=qs[_0x47a2('0x2f')](_[_0x47a2('0x39')](_0x265015['query'],_0x372991[_0x47a2('0x2f')]),_0x1db8ac);if(_0x265015[_0x47a2('0x2d')][_0x47a2('0x3a')]){_0x21ee3d[_0x47a2('0x38')]=_['merge'](_0x21ee3d['where'],{'$or':_['map'](_0x1db8ac,function(_0x46cbc6){if(_0x46cbc6[_0x47a2('0x2a')]!==_0x47a2('0x3b')){var _0x2281c7={};_0x2281c7[_0x46cbc6[_0x47a2('0x24')]]={'$like':'%'+_0x265015[_0x47a2('0x2d')][_0x47a2('0x3a')]+'%'};return _0x2281c7;}})});}_0x21ee3d=_[_0x47a2('0x3c')]({},_0x21ee3d,_0x265015['options']);var _0x283909={'where':_0x21ee3d[_0x47a2('0x38')]};return db['SquareReport'][_0x47a2('0x19')](_0x283909)[_0x47a2('0x20')](function(_0x4d12fe){_0x1d1336['count']=_0x4d12fe;if(_0x265015[_0x47a2('0x2d')][_0x47a2('0x3d')]){_0x21ee3d[_0x47a2('0x3e')]=[{'all':!![]}];}return db[_0x47a2('0x27')][_0x47a2('0x3f')](_0x21ee3d);})[_0x47a2('0x20')](function(_0x138997){_0x1d1336['rows']=_0x138997;return _0x1d1336;})[_0x47a2('0x20')](respondWithFilteredResult(_0x2cdbdb,_0x21ee3d))[_0x47a2('0x40')](handleError(_0x2cdbdb,null));};exports['show']=function(_0x530bbf,_0x27b7c6){var _0x6a7afb={'raw':!![],'where':{'id':_0x530bbf['params']['id']}},_0xe08ecb={};_0xe08ecb['model']=_[_0x47a2('0x2e')](db['SquareReport'][_0x47a2('0x28')]);_0xe08ecb[_0x47a2('0x2d')]=_['keys'](_0x530bbf[_0x47a2('0x2d')]);_0xe08ecb['filters']=_['intersection'](_0xe08ecb[_0x47a2('0x2c')],_0xe08ecb[_0x47a2('0x2d')]);_0x6a7afb[_0x47a2('0x30')]=_[_0x47a2('0x31')](_0xe08ecb['model'],qs['fields'](_0x530bbf[_0x47a2('0x2d')]['fields']));_0x6a7afb[_0x47a2('0x30')]=_0x6a7afb['attributes'][_0x47a2('0x33')]?_0x6a7afb[_0x47a2('0x30')]:_0xe08ecb[_0x47a2('0x2c')];if(_0x530bbf[_0x47a2('0x2d')][_0x47a2('0x3d')]){_0x6a7afb[_0x47a2('0x3e')]=[{'all':!![]}];}_0x6a7afb=_[_0x47a2('0x3c')]({},_0x6a7afb,_0x530bbf[_0x47a2('0x41')]);return db['SquareReport'][_0x47a2('0x42')](_0x6a7afb)['then'](handleEntityNotFound(_0x27b7c6,null))[_0x47a2('0x20')](respondWithResult(_0x27b7c6,null))[_0x47a2('0x40')](handleError(_0x27b7c6,null));};exports[_0x47a2('0x43')]=function(_0x1b4d84,_0x2ef9c0){return db[_0x47a2('0x27')]['create'](_0x1b4d84['body'],{})[_0x47a2('0x20')](respondWithResult(_0x2ef9c0,0xc9))[_0x47a2('0x40')](handleError(_0x2ef9c0,null));};exports[_0x47a2('0x1f')]=function(_0x22df5b,_0xc1355b){if(_0x22df5b[_0x47a2('0x44')]['id']){delete _0x22df5b[_0x47a2('0x44')]['id'];}return db[_0x47a2('0x27')][_0x47a2('0x42')]({'where':{'id':_0x22df5b[_0x47a2('0x45')]['id']}})[_0x47a2('0x20')](handleEntityNotFound(_0xc1355b,null))[_0x47a2('0x20')](saveUpdates(_0x22df5b['body'],null))['then'](respondWithResult(_0xc1355b,null))[_0x47a2('0x40')](handleError(_0xc1355b,null));};exports['destroy']=function(_0x408dc0,_0x124d11){return db['SquareReport'][_0x47a2('0x42')]({'where':{'id':_0x408dc0['params']['id']}})['then'](handleEntityNotFound(_0x124d11,null))[_0x47a2('0x20')](removeEntity(_0x124d11,null))[_0x47a2('0x40')](handleError(_0x124d11,null));};exports[_0x47a2('0x46')]=function(_0x2c1a25,_0x12f847){return db[_0x47a2('0x27')][_0x47a2('0x46')]()['then'](respondWithResult(_0x12f847,null))[_0x47a2('0x40')](handleError(_0x12f847,null));}; \ No newline at end of file +var _0xe712=['bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','SquareReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','show','keys','length','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x30eab3,_0x5abc1c){var _0x1ef923=function(_0x21967c){while(--_0x21967c){_0x30eab3['push'](_0x30eab3['shift']());}};_0x1ef923(++_0x5abc1c);}(_0xe712,0x1aa));var _0x2e71=function(_0x328b16,_0x3e4f61){_0x328b16=_0x328b16-0x0;var _0x888fc1=_0xe712[_0x328b16];return _0x888fc1;};'use strict';var pdf=require(_0x2e71('0x0'));var emlformat=require(_0x2e71('0x1'));var rimraf=require(_0x2e71('0x2'));var zipdir=require(_0x2e71('0x3'));var jsonpatch=require(_0x2e71('0x4'));var rp=require('request-promise');var moment=require(_0x2e71('0x5'));var BPromise=require(_0x2e71('0x6'));var Mustache=require(_0x2e71('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2e71('0x8'));var csv=require(_0x2e71('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2e71('0xa'));var squel=require('squel');var crypto=require(_0x2e71('0xb'));var jsforce=require(_0x2e71('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2e71('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2e71('0xd'));var authService=require(_0x2e71('0xe'));var qs=require(_0x2e71('0xf'));var as=require(_0x2e71('0x10'));var hardwareService=require(_0x2e71('0x11'));var logger=require(_0x2e71('0x12'))(_0x2e71('0x13'));var utils=require(_0x2e71('0x14'));var config=require(_0x2e71('0x15'));var db=require(_0x2e71('0x16'))['db'];function respondWithStatusCode(_0x26da59,_0x2ca04b){_0x2ca04b=_0x2ca04b||0xcc;return function(_0x3ae351){if(_0x3ae351){return _0x26da59['sendStatus'](_0x2ca04b);}return _0x26da59[_0x2e71('0x17')](_0x2ca04b)[_0x2e71('0x18')]();};}function respondWithResult(_0x146076,_0x44a372){_0x44a372=_0x44a372||0xc8;return function(_0x39569a){if(_0x39569a){return _0x146076[_0x2e71('0x17')](_0x44a372)[_0x2e71('0x19')](_0x39569a);}};}function respondWithFilteredResult(_0x3fec7a,_0xe2d292){return function(_0x219362){if(_0x219362){var _0x24b9f3=_0x219362[_0x2e71('0x1a')],_0x1f0c14=_0xe2d292[_0x2e71('0x1b')],_0x5b01b4=_0xe2d292[_0x2e71('0x1b')]+_0xe2d292['limit'],_0x4da8dd;if(_0x5b01b4>=_0x24b9f3){_0x5b01b4=_0x24b9f3;_0x4da8dd=0xc8;}else{_0x4da8dd=0xce;}_0x3fec7a[_0x2e71('0x17')](_0x4da8dd);return _0x3fec7a[_0x2e71('0x1c')]('Content-Range',_0x1f0c14+'-'+_0x5b01b4+'/'+_0x24b9f3)[_0x2e71('0x19')](_0x219362);}return null;};}function patchUpdates(_0x180bdf){return function(_0x2b0a53){try{jsonpatch[_0x2e71('0x1d')](_0x2b0a53,_0x180bdf,!![]);}catch(_0x1cb5aa){return BPromise[_0x2e71('0x1e')](_0x1cb5aa);}return _0x2b0a53[_0x2e71('0x1f')]();};}function saveUpdates(_0x114cb5,_0x5bf2dd){return function(_0x487cb4){if(_0x487cb4){return _0x487cb4[_0x2e71('0x20')](_0x114cb5)[_0x2e71('0x21')](function(_0x5663d6){return _0x5663d6;});}return null;};}function removeEntity(_0x5c9f91,_0x379351){return function(_0x4fe6db){if(_0x4fe6db){return _0x4fe6db[_0x2e71('0x22')]()['then'](function(){_0x5c9f91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x109e27,_0x408ef0){return function(_0x108b89){if(!_0x108b89){_0x109e27[_0x2e71('0x23')](0x194);}return _0x108b89;};}function handleError(_0x50d0fb,_0x1ea86e){_0x1ea86e=_0x1ea86e||0x1f4;return function(_0x5e33cd){logger['error'](_0x5e33cd[_0x2e71('0x24')]);if(_0x5e33cd[_0x2e71('0x25')]){delete _0x5e33cd[_0x2e71('0x25')];}_0x50d0fb[_0x2e71('0x17')](_0x1ea86e)[_0x2e71('0x26')](_0x5e33cd);};}exports['index']=function(_0x2eb684,_0x2f0a3e){var _0x3041e7={},_0x509474={},_0x4a6fdb={'count':0x0,'rows':[]};var _0x79620d=_[_0x2e71('0x27')](db[_0x2e71('0x28')][_0x2e71('0x29')],function(_0x33176d){return{'name':_0x33176d[_0x2e71('0x2a')],'type':_0x33176d['type'][_0x2e71('0x2b')]};});_0x509474[_0x2e71('0x2c')]=_['map'](_0x79620d,_0x2e71('0x25'));_0x509474[_0x2e71('0x2d')]=_['keys'](_0x2eb684[_0x2e71('0x2d')]);_0x509474['filters']=_[_0x2e71('0x2e')](_0x509474[_0x2e71('0x2c')],_0x509474[_0x2e71('0x2d')]);_0x3041e7[_0x2e71('0x2f')]=_[_0x2e71('0x2e')](_0x509474[_0x2e71('0x2c')],qs[_0x2e71('0x30')](_0x2eb684[_0x2e71('0x2d')][_0x2e71('0x30')]));_0x3041e7[_0x2e71('0x2f')]=_0x3041e7['attributes']['length']?_0x3041e7['attributes']:_0x509474['model'];if(!_0x2eb684[_0x2e71('0x2d')][_0x2e71('0x31')](_0x2e71('0x32'))){_0x3041e7[_0x2e71('0x33')]=qs[_0x2e71('0x33')](_0x2eb684[_0x2e71('0x2d')]['limit']);_0x3041e7[_0x2e71('0x1b')]=qs[_0x2e71('0x1b')](_0x2eb684['query'][_0x2e71('0x1b')]);}_0x3041e7[_0x2e71('0x34')]=qs[_0x2e71('0x35')](_0x2eb684['query']['sort']);_0x3041e7[_0x2e71('0x36')]=qs['filters'](_[_0x2e71('0x37')](_0x2eb684['query'],_0x509474[_0x2e71('0x38')]),_0x79620d);if(_0x2eb684[_0x2e71('0x2d')][_0x2e71('0x39')]){_0x3041e7['where']=_[_0x2e71('0x3a')](_0x3041e7['where'],{'$or':_[_0x2e71('0x27')](_0x79620d,function(_0x4e122c){if(_0x4e122c[_0x2e71('0x3b')]!=='VIRTUAL'){var _0x5f1ae2={};_0x5f1ae2[_0x4e122c[_0x2e71('0x25')]]={'$like':'%'+_0x2eb684[_0x2e71('0x2d')]['filter']+'%'};return _0x5f1ae2;}})});}_0x3041e7=_['merge']({},_0x3041e7,_0x2eb684[_0x2e71('0x3c')]);var _0x2032f8={'where':_0x3041e7[_0x2e71('0x36')]};return db['SquareReport']['count'](_0x2032f8)[_0x2e71('0x21')](function(_0x135739){_0x4a6fdb[_0x2e71('0x1a')]=_0x135739;if(_0x2eb684[_0x2e71('0x2d')][_0x2e71('0x3d')]){_0x3041e7[_0x2e71('0x3e')]=[{'all':!![]}];}return db[_0x2e71('0x28')]['findAll'](_0x3041e7);})[_0x2e71('0x21')](function(_0x238d9e){_0x4a6fdb['rows']=_0x238d9e;return _0x4a6fdb;})[_0x2e71('0x21')](respondWithFilteredResult(_0x2f0a3e,_0x3041e7))['catch'](handleError(_0x2f0a3e,null));};exports[_0x2e71('0x3f')]=function(_0x362d8f,_0x49f75e){var _0x477ecb={'raw':!![],'where':{'id':_0x362d8f['params']['id']}},_0x24ccc2={};_0x24ccc2[_0x2e71('0x2c')]=_[_0x2e71('0x40')](db[_0x2e71('0x28')][_0x2e71('0x29')]);_0x24ccc2[_0x2e71('0x2d')]=_[_0x2e71('0x40')](_0x362d8f[_0x2e71('0x2d')]);_0x24ccc2[_0x2e71('0x38')]=_[_0x2e71('0x2e')](_0x24ccc2['model'],_0x24ccc2['query']);_0x477ecb[_0x2e71('0x2f')]=_[_0x2e71('0x2e')](_0x24ccc2['model'],qs[_0x2e71('0x30')](_0x362d8f[_0x2e71('0x2d')][_0x2e71('0x30')]));_0x477ecb[_0x2e71('0x2f')]=_0x477ecb[_0x2e71('0x2f')][_0x2e71('0x41')]?_0x477ecb['attributes']:_0x24ccc2[_0x2e71('0x2c')];if(_0x362d8f[_0x2e71('0x2d')][_0x2e71('0x3d')]){_0x477ecb[_0x2e71('0x3e')]=[{'all':!![]}];}_0x477ecb=_[_0x2e71('0x3a')]({},_0x477ecb,_0x362d8f[_0x2e71('0x3c')]);return db[_0x2e71('0x28')][_0x2e71('0x42')](_0x477ecb)[_0x2e71('0x21')](handleEntityNotFound(_0x49f75e,null))[_0x2e71('0x21')](respondWithResult(_0x49f75e,null))[_0x2e71('0x43')](handleError(_0x49f75e,null));};exports[_0x2e71('0x44')]=function(_0x72bc3f,_0x4b0542){return db[_0x2e71('0x28')][_0x2e71('0x44')](_0x72bc3f[_0x2e71('0x45')],{})[_0x2e71('0x21')](respondWithResult(_0x4b0542,0xc9))[_0x2e71('0x43')](handleError(_0x4b0542,null));};exports[_0x2e71('0x20')]=function(_0x2a2d8e,_0x316c28){if(_0x2a2d8e[_0x2e71('0x45')]['id']){delete _0x2a2d8e[_0x2e71('0x45')]['id'];}return db[_0x2e71('0x28')][_0x2e71('0x42')]({'where':{'id':_0x2a2d8e[_0x2e71('0x46')]['id']}})['then'](handleEntityNotFound(_0x316c28,null))[_0x2e71('0x21')](saveUpdates(_0x2a2d8e['body'],null))[_0x2e71('0x21')](respondWithResult(_0x316c28,null))['catch'](handleError(_0x316c28,null));};exports[_0x2e71('0x22')]=function(_0x34fa55,_0x4f3a6a){return db['SquareReport'][_0x2e71('0x42')]({'where':{'id':_0x34fa55[_0x2e71('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f3a6a,null))[_0x2e71('0x21')](removeEntity(_0x4f3a6a,null))[_0x2e71('0x43')](handleError(_0x4f3a6a,null));};exports[_0x2e71('0x47')]=function(_0x11da5c,_0x519cde){return db[_0x2e71('0x28')]['describe']()[_0x2e71('0x21')](respondWithResult(_0x519cde,null))[_0x2e71('0x43')](handleError(_0x519cde,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f138d54..44cab9f 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 _0xea3e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0xea3e,0x163));var _0xeea3=function(_0x410a89,_0x528790){_0x410a89=_0x410a89-0x0;var _0x4bf3cb=_0xea3e[_0x410a89];return _0x4bf3cb;};'use strict';var _=require(_0xeea3('0x0'));var util=require(_0xeea3('0x1'));var logger=require(_0xeea3('0x2'))(_0xeea3('0x3'));var moment=require(_0xeea3('0x4'));var BPromise=require(_0xeea3('0x5'));var rp=require(_0xeea3('0x6'));var fs=require('fs');var path=require(_0xeea3('0x7'));var rimraf=require(_0xeea3('0x8'));var config=require(_0xeea3('0x9'));var attributes=require(_0xeea3('0xa'));module[_0xeea3('0xb')]=function(_0x2e8048,_0x3f9469){return _0x2e8048['define'](_0xeea3('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xeea3('0xd'),'fields':[_0xeea3('0xe'),_0xeea3('0xf')]},{'name':_0xeea3('0x10'),'fields':[_0xeea3('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcde4=['bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xcde4,0xdd));var _0x4cde=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xcde4[_0x22eb96];return _0x5e1adf;};'use strict';var _=require(_0x4cde('0x0'));var util=require('util');var logger=require(_0x4cde('0x1'))(_0x4cde('0x2'));var moment=require(_0x4cde('0x3'));var BPromise=require(_0x4cde('0x4'));var rp=require(_0x4cde('0x5'));var fs=require('fs');var path=require(_0x4cde('0x6'));var rimraf=require(_0x4cde('0x7'));var config=require('../../config/environment');var attributes=require(_0x4cde('0x8'));module[_0x4cde('0x9')]=function(_0x1c5438,_0x16ca9a){return _0x1c5438[_0x4cde('0xa')]('SquareReport',attributes,{'tableName':_0x4cde('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x4cde('0xc'),_0x4cde('0xd')]},{'name':_0x4cde('0xe'),'fields':[_0x4cde('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 30ba278..86d3160 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 _0xf041=['request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','create','options','raw','then','UpdateSquareReport','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x555fb7,_0x4d894e){var _0x9348f1=function(_0x25adc6){while(--_0x25adc6){_0x555fb7['push'](_0x555fb7['shift']());}};_0x9348f1(++_0x4d894e);}(_0xf041,0x90));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1f04('0x0'));var util=require('util');var moment=require(_0x1f04('0x1'));var BPromise=require(_0x1f04('0x2'));var rs=require(_0x1f04('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f04('0x4'))['db'];var utils=require(_0x1f04('0x5'));var logger=require('../../config/logger')(_0x1f04('0x6'));var config=require(_0x1f04('0x7'));var jayson=require(_0x1f04('0x8'));var client=jayson[_0x1f04('0x9')][_0x1f04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c9c84,_0xc3c194,_0x4df84a){return new BPromise(function(_0x2be561,_0x252320){return client[_0x1f04('0xb')](_0x8c9c84,_0x4df84a)['then'](function(_0x372f12){logger[_0x1f04('0xc')](_0x1f04('0xd'),_0xc3c194,_0x1f04('0xe'));logger[_0x1f04('0xf')](_0x1f04('0x10'),_0xc3c194,'request\x20sent',JSON[_0x1f04('0x11')](_0x372f12));if(_0x372f12[_0x1f04('0x12')]){if(_0x372f12[_0x1f04('0x12')][_0x1f04('0x13')]===0x1f4){logger['error'](_0x1f04('0xd'),_0xc3c194,_0x372f12[_0x1f04('0x12')][_0x1f04('0x14')]);return _0x252320(_0x372f12[_0x1f04('0x12')][_0x1f04('0x14')]);}logger[_0x1f04('0x12')](_0x1f04('0xd'),_0xc3c194,_0x372f12[_0x1f04('0x12')]['message']);return _0x2be561(_0x372f12['error'][_0x1f04('0x14')]);}else{logger['info'](_0x1f04('0xd'),_0xc3c194,_0x1f04('0xe'));_0x2be561(_0x372f12['result'][_0x1f04('0x14')]);}})[_0x1f04('0x15')](function(_0x34a7f2){logger[_0x1f04('0x12')]('SquareReport,\x20%s,\x20%s',_0xc3c194,_0x34a7f2);_0x252320(_0x34a7f2);});});}exports[_0x1f04('0x16')]=function(_0x100347){var _0x4b31ad=this;return new Promise(function(_0x46842b,_0x3ee907){return db[_0x1f04('0x17')][_0x1f04('0x18')](_0x100347['body'],{'raw':_0x100347[_0x1f04('0x19')]?_0x100347[_0x1f04('0x19')][_0x1f04('0x1a')]===undefined?!![]:![]:!![]})[_0x1f04('0x1b')](function(_0x53ebaa){logger['info']('CreateSquareReport',_0x100347);logger['debug'](_0x1f04('0x16'),_0x100347,JSON[_0x1f04('0x11')](_0x53ebaa));_0x46842b(_0x53ebaa);})['catch'](function(_0x27c6ca){logger['error'](_0x1f04('0x16'),_0x27c6ca[_0x1f04('0x14')],_0x100347);_0x3ee907(_0x4b31ad[_0x1f04('0x12')](0x1f4,_0x27c6ca[_0x1f04('0x14')]));});});};exports[_0x1f04('0x1c')]=function(_0x593095){var _0x889021=this;return new Promise(function(_0x782d69,_0x5e2ebb){return db[_0x1f04('0x17')]['update'](_0x593095['body'],{'raw':_0x593095[_0x1f04('0x19')]?_0x593095[_0x1f04('0x19')][_0x1f04('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x593095[_0x1f04('0x19')]?_0x593095[_0x1f04('0x19')]['where']||null:null,'attributes':_0x593095[_0x1f04('0x19')]?_0x593095['options'][_0x1f04('0x1d')]||null:null,'limit':_0x593095['options']?_0x593095[_0x1f04('0x19')][_0x1f04('0x1e')]||null:null})[_0x1f04('0x1b')](function(_0xaca0f1){logger['info'](_0x1f04('0x1c'),_0x593095);logger[_0x1f04('0xf')]('UpdateSquareReport',_0x593095,JSON['stringify'](_0xaca0f1));_0x782d69(_0xaca0f1);})[_0x1f04('0x15')](function(_0x5067cf){logger[_0x1f04('0x12')](_0x1f04('0x1c'),_0x5067cf[_0x1f04('0x14')],_0x593095);_0x5e2ebb(_0x889021[_0x1f04('0x12')](0x1f4,_0x5067cf[_0x1f04('0x14')]));});});}; \ No newline at end of file +var _0x4659=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','where','attributes','limit','lodash','util'];(function(_0x4d275c,_0x522396){var _0x55b75f=function(_0x47e6d3){while(--_0x47e6d3){_0x4d275c['push'](_0x4d275c['shift']());}};_0x55b75f(++_0x522396);}(_0x4659,0x1e8));var _0x9465=function(_0x234ec3,_0x21bf1f){_0x234ec3=_0x234ec3-0x0;var _0x54fae=_0x4659[_0x234ec3];return _0x54fae;};'use strict';var _=require(_0x9465('0x0'));var util=require(_0x9465('0x1'));var moment=require(_0x9465('0x2'));var BPromise=require(_0x9465('0x3'));var rs=require(_0x9465('0x4'));var fs=require('fs');var Redis=require(_0x9465('0x5'));var db=require(_0x9465('0x6'))['db'];var utils=require(_0x9465('0x7'));var logger=require('../../config/logger')(_0x9465('0x8'));var config=require(_0x9465('0x9'));var jayson=require(_0x9465('0xa'));var client=jayson[_0x9465('0xb')][_0x9465('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c4fa1,_0x265ea1,_0x1eb0e1){return new BPromise(function(_0x291a2b,_0x3febf1){return client[_0x9465('0xd')](_0x3c4fa1,_0x1eb0e1)[_0x9465('0xe')](function(_0xffe197){logger[_0x9465('0xf')]('SquareReport,\x20%s,\x20%s',_0x265ea1,'request\x20sent');logger[_0x9465('0x10')](_0x9465('0x11'),_0x265ea1,'request\x20sent',JSON[_0x9465('0x12')](_0xffe197));if(_0xffe197[_0x9465('0x13')]){if(_0xffe197['error'][_0x9465('0x14')]===0x1f4){logger[_0x9465('0x13')](_0x9465('0x15'),_0x265ea1,_0xffe197[_0x9465('0x13')][_0x9465('0x16')]);return _0x3febf1(_0xffe197[_0x9465('0x13')]['message']);}logger['error'](_0x9465('0x15'),_0x265ea1,_0xffe197[_0x9465('0x13')]['message']);return _0x291a2b(_0xffe197[_0x9465('0x13')][_0x9465('0x16')]);}else{logger[_0x9465('0xf')]('SquareReport,\x20%s,\x20%s',_0x265ea1,'request\x20sent');_0x291a2b(_0xffe197[_0x9465('0x17')][_0x9465('0x16')]);}})[_0x9465('0x18')](function(_0x35e5a4){logger[_0x9465('0x13')](_0x9465('0x15'),_0x265ea1,_0x35e5a4);_0x3febf1(_0x35e5a4);});});}exports['CreateSquareReport']=function(_0x1ad57a){var _0x582545=this;return new Promise(function(_0x95f6ee,_0x38d344){return db[_0x9465('0x19')][_0x9465('0x1a')](_0x1ad57a[_0x9465('0x1b')],{'raw':_0x1ad57a['options']?_0x1ad57a[_0x9465('0x1c')][_0x9465('0x1d')]===undefined?!![]:![]:!![]})[_0x9465('0xe')](function(_0x3fd4de){logger['info'](_0x9465('0x1e'),_0x1ad57a);logger[_0x9465('0x10')](_0x9465('0x1e'),_0x1ad57a,JSON[_0x9465('0x12')](_0x3fd4de));_0x95f6ee(_0x3fd4de);})['catch'](function(_0x21df77){logger[_0x9465('0x13')](_0x9465('0x1e'),_0x21df77['message'],_0x1ad57a);_0x38d344(_0x582545[_0x9465('0x13')](0x1f4,_0x21df77[_0x9465('0x16')]));});});};exports[_0x9465('0x1f')]=function(_0x4d235d){var _0x256170=this;return new Promise(function(_0x31b9eb,_0x2b8599){return db[_0x9465('0x19')]['update'](_0x4d235d['body'],{'raw':_0x4d235d[_0x9465('0x1c')]?_0x4d235d['options'][_0x9465('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d235d[_0x9465('0x1c')]?_0x4d235d[_0x9465('0x1c')][_0x9465('0x20')]||null:null,'attributes':_0x4d235d['options']?_0x4d235d[_0x9465('0x1c')][_0x9465('0x21')]||null:null,'limit':_0x4d235d[_0x9465('0x1c')]?_0x4d235d[_0x9465('0x1c')][_0x9465('0x22')]||null:null})[_0x9465('0xe')](function(_0x5d4be1){logger[_0x9465('0xf')](_0x9465('0x1f'),_0x4d235d);logger[_0x9465('0x10')](_0x9465('0x1f'),_0x4d235d,JSON['stringify'](_0x5d4be1));_0x31b9eb(_0x5d4be1);})[_0x9465('0x18')](function(_0x3da9d9){logger['error'](_0x9465('0x1f'),_0x3da9d9[_0x9465('0x16')],_0x4d235d);_0x2b8599(_0x256170['error'](0x1f4,_0x3da9d9[_0x9465('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ebadf12..b16ffdd 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x814b,0x1a2));var _0xb814=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x814b[_0xd67723];return _0x53b62b;};'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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x7132da,_0x5225ca){var _0x215082=function(_0x89824b){while(--_0x89824b){_0x7132da['push'](_0x7132da['shift']());}};_0x215082(++_0x5225ca);}(_0x7a54,0x106));var _0x47a5=function(_0x424c91,_0x11aa20){_0x424c91=_0x424c91-0x0;var _0x4736bd=_0x7a54[_0x424c91];return _0x4736bd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index a670271..d743b69 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 _0x9211=['STRING','TEXT','sequelize','exports'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x9211,0x14e));var _0x1921=function(_0x24529e,_0x20b864){_0x24529e=_0x24529e-0x0;var _0x4f37ba=_0x9211[_0x24529e];return _0x4f37ba;};'use strict';var Sequelize=require(_0x1921('0x0'));module[_0x1921('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x1921('0x2')]},'data':{'type':Sequelize[_0x1921('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1921('0x2')]}}; \ No newline at end of file +var _0x77d8=['TEXT','sequelize','exports','STRING'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x77d8,0xad));var _0x877d=function(_0x25c92b,_0x41b368){_0x25c92b=_0x25c92b-0x0;var _0xc59d85=_0x77d8[_0x25c92b];return _0xc59d85;};'use strict';var Sequelize=require(_0x877d('0x0'));module[_0x877d('0x1')]={'uniqueid':{'type':Sequelize[_0x877d('0x2')]},'node':{'type':Sequelize[_0x877d('0x2')]},'application':{'type':Sequelize[_0x877d('0x2')]},'data':{'type':Sequelize[_0x877d('0x3')]},'project_name':{'type':Sequelize[_0x877d('0x2')]},'callerid':{'type':Sequelize[_0x877d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 902892c..bdd30b1 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 _0xb413=['send','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb413,0x141));var _0x3b41=function(_0x1d1dd1,_0x384707){_0x1d1dd1=_0x1d1dd1-0x0;var _0x43611b=_0xb413[_0x1d1dd1];return _0x43611b;};'use strict';var pdf=require(_0x3b41('0x0'));var emlformat=require(_0x3b41('0x1'));var rimraf=require(_0x3b41('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b41('0x3'));var rp=require(_0x3b41('0x4'));var moment=require(_0x3b41('0x5'));var BPromise=require(_0x3b41('0x6'));var Mustache=require(_0x3b41('0x7'));var util=require(_0x3b41('0x8'));var path=require(_0x3b41('0x9'));var sox=require(_0x3b41('0xa'));var csv=require(_0x3b41('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b41('0xc'));var squel=require(_0x3b41('0xd'));var crypto=require(_0x3b41('0xe'));var jsforce=require(_0x3b41('0xf'));var deskjs=require(_0x3b41('0x10'));var toCsv=require(_0x3b41('0xb'));var querystring=require(_0x3b41('0x11'));var Papa=require(_0x3b41('0x12'));var Redis=require(_0x3b41('0x13'));var authService=require(_0x3b41('0x14'));var qs=require(_0x3b41('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b41('0x16'));var logger=require(_0x3b41('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3b41('0x18'))['db'];function respondWithStatusCode(_0x47dbe5,_0x5623d9){_0x5623d9=_0x5623d9||0xcc;return function(_0xe892a6){if(_0xe892a6){return _0x47dbe5[_0x3b41('0x19')](_0x5623d9);}return _0x47dbe5[_0x3b41('0x1a')](_0x5623d9)[_0x3b41('0x1b')]();};}function respondWithResult(_0x3a69d2,_0x415d05){_0x415d05=_0x415d05||0xc8;return function(_0xe53e51){if(_0xe53e51){return _0x3a69d2[_0x3b41('0x1a')](_0x415d05)['json'](_0xe53e51);}};}function respondWithFilteredResult(_0x5430f1,_0x5568f0){return function(_0x4034ca){if(_0x4034ca){var _0xc044a9=_0x4034ca[_0x3b41('0x1c')],_0x307f5a=_0x5568f0[_0x3b41('0x1d')],_0x428c3b=_0x5568f0[_0x3b41('0x1d')]+_0x5568f0['limit'],_0x9ee9ba;if(_0x428c3b>=_0xc044a9){_0x428c3b=_0xc044a9;_0x9ee9ba=0xc8;}else{_0x9ee9ba=0xce;}_0x5430f1[_0x3b41('0x1a')](_0x9ee9ba);return _0x5430f1[_0x3b41('0x1e')](_0x3b41('0x1f'),_0x307f5a+'-'+_0x428c3b+'/'+_0xc044a9)['json'](_0x4034ca);}return null;};}function patchUpdates(_0x2ade48){return function(_0x19f8b7){try{jsonpatch[_0x3b41('0x20')](_0x19f8b7,_0x2ade48,!![]);}catch(_0x4735a2){return BPromise['reject'](_0x4735a2);}return _0x19f8b7['save']();};}function saveUpdates(_0x2d7b8c,_0xe02448){return function(_0x4bef3c){if(_0x4bef3c){return _0x4bef3c[_0x3b41('0x21')](_0x2d7b8c)[_0x3b41('0x22')](function(_0x58a9aa){return _0x58a9aa;});}return null;};}function removeEntity(_0x2a6c1b,_0x48b7a2){return function(_0x86df44){if(_0x86df44){return _0x86df44[_0x3b41('0x23')]()[_0x3b41('0x22')](function(){_0x2a6c1b[_0x3b41('0x1a')](0xcc)[_0x3b41('0x1b')]();});}};}function handleEntityNotFound(_0x6cbcb4,_0x2d43e1){return function(_0xf2fb57){if(!_0xf2fb57){_0x6cbcb4[_0x3b41('0x19')](0x194);}return _0xf2fb57;};}function handleError(_0x189da5,_0x58fff6){_0x58fff6=_0x58fff6||0x1f4;return function(_0x413d64){logger[_0x3b41('0x24')](_0x413d64[_0x3b41('0x25')]);if(_0x413d64[_0x3b41('0x26')]){delete _0x413d64['name'];}_0x189da5['status'](_0x58fff6)[_0x3b41('0x27')](_0x413d64);};}exports['index']=function(_0x322dd8,_0x106ea7){var _0x33ddbe={},_0x56a3cc={},_0x25922b={'count':0x0,'rows':[]};var _0x550b34=_[_0x3b41('0x28')](db[_0x3b41('0x29')][_0x3b41('0x2a')],function(_0x40b713){return{'name':_0x40b713['fieldName'],'type':_0x40b713[_0x3b41('0x2b')][_0x3b41('0x2c')]};});_0x56a3cc[_0x3b41('0x2d')]=_[_0x3b41('0x28')](_0x550b34,_0x3b41('0x26'));_0x56a3cc[_0x3b41('0x2e')]=_[_0x3b41('0x2f')](_0x322dd8[_0x3b41('0x2e')]);_0x56a3cc[_0x3b41('0x30')]=_[_0x3b41('0x31')](_0x56a3cc[_0x3b41('0x2d')],_0x56a3cc[_0x3b41('0x2e')]);_0x33ddbe[_0x3b41('0x32')]=_[_0x3b41('0x31')](_0x56a3cc[_0x3b41('0x2d')],qs[_0x3b41('0x33')](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x33')]));_0x33ddbe[_0x3b41('0x32')]=_0x33ddbe[_0x3b41('0x32')][_0x3b41('0x34')]?_0x33ddbe[_0x3b41('0x32')]:_0x56a3cc[_0x3b41('0x2d')];if(!_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x35')]('nolimit')){_0x33ddbe[_0x3b41('0x36')]=qs['limit'](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x36')]);_0x33ddbe[_0x3b41('0x1d')]=qs[_0x3b41('0x1d')](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x1d')]);}_0x33ddbe[_0x3b41('0x37')]=qs[_0x3b41('0x38')](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x38')]);_0x33ddbe[_0x3b41('0x39')]=qs[_0x3b41('0x30')](_[_0x3b41('0x3a')](_0x322dd8[_0x3b41('0x2e')],_0x56a3cc[_0x3b41('0x30')]),_0x550b34);if(_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x3b')]){_0x33ddbe['where']=_['merge'](_0x33ddbe['where'],{'$or':_[_0x3b41('0x28')](_0x550b34,function(_0x5cea1b){if(_0x5cea1b[_0x3b41('0x2b')]!=='VIRTUAL'){var _0x49938d={};_0x49938d[_0x5cea1b[_0x3b41('0x26')]]={'$like':'%'+_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x3b')]+'%'};return _0x49938d;}})});}_0x33ddbe=_[_0x3b41('0x3c')]({},_0x33ddbe,_0x322dd8['options']);var _0x36e5e7={'where':_0x33ddbe[_0x3b41('0x39')]};return db[_0x3b41('0x29')][_0x3b41('0x1c')](_0x36e5e7)['then'](function(_0x3798ca){_0x25922b[_0x3b41('0x1c')]=_0x3798ca;if(_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x3d')]){_0x33ddbe[_0x3b41('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x33ddbe);})[_0x3b41('0x22')](function(_0x33d0b8){_0x25922b[_0x3b41('0x3f')]=_0x33d0b8;return _0x25922b;})[_0x3b41('0x22')](respondWithFilteredResult(_0x106ea7,_0x33ddbe))[_0x3b41('0x40')](handleError(_0x106ea7,null));};exports[_0x3b41('0x41')]=function(_0x3b8276,_0x69f398){var _0x5d180e={'raw':!![],'where':{'id':_0x3b8276['params']['id']}},_0x5798a9={};_0x5798a9[_0x3b41('0x2d')]=_[_0x3b41('0x2f')](db[_0x3b41('0x29')][_0x3b41('0x2a')]);_0x5798a9[_0x3b41('0x2e')]=_['keys'](_0x3b8276[_0x3b41('0x2e')]);_0x5798a9['filters']=_[_0x3b41('0x31')](_0x5798a9[_0x3b41('0x2d')],_0x5798a9[_0x3b41('0x2e')]);_0x5d180e[_0x3b41('0x32')]=_[_0x3b41('0x31')](_0x5798a9['model'],qs[_0x3b41('0x33')](_0x3b8276[_0x3b41('0x2e')][_0x3b41('0x33')]));_0x5d180e['attributes']=_0x5d180e[_0x3b41('0x32')][_0x3b41('0x34')]?_0x5d180e[_0x3b41('0x32')]:_0x5798a9['model'];if(_0x3b8276[_0x3b41('0x2e')]['includeAll']){_0x5d180e['include']=[{'all':!![]}];}_0x5d180e=_[_0x3b41('0x3c')]({},_0x5d180e,_0x3b8276[_0x3b41('0x42')]);return db[_0x3b41('0x29')][_0x3b41('0x43')](_0x5d180e)['then'](handleEntityNotFound(_0x69f398,null))[_0x3b41('0x22')](respondWithResult(_0x69f398,null))[_0x3b41('0x40')](handleError(_0x69f398,null));};exports['create']=function(_0x4e0224,_0x2de7b2){return db['SquareDetailsReport'][_0x3b41('0x44')](_0x4e0224[_0x3b41('0x45')],{})[_0x3b41('0x22')](respondWithResult(_0x2de7b2,0xc9))['catch'](handleError(_0x2de7b2,null));};exports[_0x3b41('0x21')]=function(_0x2bc9af,_0x3e17b5){if(_0x2bc9af['body']['id']){delete _0x2bc9af[_0x3b41('0x45')]['id'];}return db[_0x3b41('0x29')][_0x3b41('0x43')]({'where':{'id':_0x2bc9af[_0x3b41('0x46')]['id']}})[_0x3b41('0x22')](handleEntityNotFound(_0x3e17b5,null))[_0x3b41('0x22')](saveUpdates(_0x2bc9af['body'],null))[_0x3b41('0x22')](respondWithResult(_0x3e17b5,null))[_0x3b41('0x40')](handleError(_0x3e17b5,null));};exports[_0x3b41('0x23')]=function(_0x34f876,_0x4b5c6e){return db[_0x3b41('0x29')]['find']({'where':{'id':_0x34f876[_0x3b41('0x46')]['id']}})[_0x3b41('0x22')](handleEntityNotFound(_0x4b5c6e,null))[_0x3b41('0x22')](removeEntity(_0x4b5c6e,null))[_0x3b41('0x40')](handleError(_0x4b5c6e,null));};exports[_0x3b41('0x47')]=function(_0x1dbd4e,_0x4a36aa){return db[_0x3b41('0x29')][_0x3b41('0x47')]()[_0x3b41('0x22')](respondWithResult(_0x4a36aa,null))[_0x3b41('0x40')](handleError(_0x4a36aa,null));}; \ No newline at end of file +var _0x78b6=['send','map','SquareDetailsReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','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','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name'];(function(_0x55ff21,_0x1540f0){var _0x4baf37=function(_0x51128b){while(--_0x51128b){_0x55ff21['push'](_0x55ff21['shift']());}};_0x4baf37(++_0x1540f0);}(_0x78b6,0x14e));var _0x678b=function(_0xeea5ca,_0x2d569b){_0xeea5ca=_0xeea5ca-0x0;var _0x1fdf07=_0x78b6[_0xeea5ca];return _0x1fdf07;};'use strict';var pdf=require(_0x678b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x678b('0x1'));var jsonpatch=require(_0x678b('0x2'));var rp=require(_0x678b('0x3'));var moment=require('moment');var BPromise=require(_0x678b('0x4'));var Mustache=require('mustache');var util=require(_0x678b('0x5'));var path=require('path');var sox=require(_0x678b('0x6'));var csv=require(_0x678b('0x7'));var ejs=require(_0x678b('0x8'));var fs=require('fs');var _=require(_0x678b('0x9'));var squel=require(_0x678b('0xa'));var crypto=require(_0x678b('0xb'));var jsforce=require(_0x678b('0xc'));var deskjs=require(_0x678b('0xd'));var toCsv=require(_0x678b('0x7'));var querystring=require(_0x678b('0xe'));var Papa=require(_0x678b('0xf'));var Redis=require(_0x678b('0x10'));var authService=require(_0x678b('0x11'));var qs=require(_0x678b('0x12'));var as=require(_0x678b('0x13'));var hardwareService=require(_0x678b('0x14'));var logger=require(_0x678b('0x15'))(_0x678b('0x16'));var utils=require(_0x678b('0x17'));var config=require('../../config/environment');var db=require(_0x678b('0x18'))['db'];function respondWithStatusCode(_0x4e0633,_0x34eb9c){_0x34eb9c=_0x34eb9c||0xcc;return function(_0x52926f){if(_0x52926f){return _0x4e0633[_0x678b('0x19')](_0x34eb9c);}return _0x4e0633[_0x678b('0x1a')](_0x34eb9c)[_0x678b('0x1b')]();};}function respondWithResult(_0x42b348,_0x10f863){_0x10f863=_0x10f863||0xc8;return function(_0x379030){if(_0x379030){return _0x42b348[_0x678b('0x1a')](_0x10f863)[_0x678b('0x1c')](_0x379030);}};}function respondWithFilteredResult(_0x29ba07,_0x54174a){return function(_0x2f016b){if(_0x2f016b){var _0x1f5fd5=_0x2f016b['count'],_0xa75baa=_0x54174a[_0x678b('0x1d')],_0x3d1ddb=_0x54174a[_0x678b('0x1d')]+_0x54174a[_0x678b('0x1e')],_0x5dd3f9;if(_0x3d1ddb>=_0x1f5fd5){_0x3d1ddb=_0x1f5fd5;_0x5dd3f9=0xc8;}else{_0x5dd3f9=0xce;}_0x29ba07[_0x678b('0x1a')](_0x5dd3f9);return _0x29ba07[_0x678b('0x1f')](_0x678b('0x20'),_0xa75baa+'-'+_0x3d1ddb+'/'+_0x1f5fd5)[_0x678b('0x1c')](_0x2f016b);}return null;};}function patchUpdates(_0x22b709){return function(_0x123f53){try{jsonpatch[_0x678b('0x21')](_0x123f53,_0x22b709,!![]);}catch(_0x492c12){return BPromise[_0x678b('0x22')](_0x492c12);}return _0x123f53[_0x678b('0x23')]();};}function saveUpdates(_0x2fa30,_0x33a069){return function(_0x1043ea){if(_0x1043ea){return _0x1043ea[_0x678b('0x24')](_0x2fa30)[_0x678b('0x25')](function(_0x4a47a3){return _0x4a47a3;});}return null;};}function removeEntity(_0x30e20d,_0x4228c7){return function(_0x2c1a5c){if(_0x2c1a5c){return _0x2c1a5c[_0x678b('0x26')]()[_0x678b('0x25')](function(){_0x30e20d[_0x678b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3760,_0x270060){return function(_0x53634a){if(!_0x53634a){_0x5b3760['sendStatus'](0x194);}return _0x53634a;};}function handleError(_0x414580,_0x530281){_0x530281=_0x530281||0x1f4;return function(_0x2c412e){logger[_0x678b('0x27')](_0x2c412e['stack']);if(_0x2c412e[_0x678b('0x28')]){delete _0x2c412e[_0x678b('0x28')];}_0x414580[_0x678b('0x1a')](_0x530281)[_0x678b('0x29')](_0x2c412e);};}exports['index']=function(_0x3df816,_0x41f927){var _0x4c2bbc={},_0x294df5={},_0x41bdb2={'count':0x0,'rows':[]};var _0x292826=_[_0x678b('0x2a')](db[_0x678b('0x2b')]['rawAttributes'],function(_0x2796ae){return{'name':_0x2796ae['fieldName'],'type':_0x2796ae[_0x678b('0x2c')][_0x678b('0x2d')]};});_0x294df5['model']=_[_0x678b('0x2a')](_0x292826,_0x678b('0x28'));_0x294df5[_0x678b('0x2e')]=_[_0x678b('0x2f')](_0x3df816[_0x678b('0x2e')]);_0x294df5[_0x678b('0x30')]=_[_0x678b('0x31')](_0x294df5[_0x678b('0x32')],_0x294df5[_0x678b('0x2e')]);_0x4c2bbc[_0x678b('0x33')]=_[_0x678b('0x31')](_0x294df5['model'],qs[_0x678b('0x34')](_0x3df816[_0x678b('0x2e')]['fields']));_0x4c2bbc[_0x678b('0x33')]=_0x4c2bbc[_0x678b('0x33')][_0x678b('0x35')]?_0x4c2bbc[_0x678b('0x33')]:_0x294df5[_0x678b('0x32')];if(!_0x3df816[_0x678b('0x2e')]['hasOwnProperty'](_0x678b('0x36'))){_0x4c2bbc['limit']=qs[_0x678b('0x1e')](_0x3df816['query']['limit']);_0x4c2bbc[_0x678b('0x1d')]=qs[_0x678b('0x1d')](_0x3df816[_0x678b('0x2e')][_0x678b('0x1d')]);}_0x4c2bbc[_0x678b('0x37')]=qs[_0x678b('0x38')](_0x3df816[_0x678b('0x2e')][_0x678b('0x38')]);_0x4c2bbc[_0x678b('0x39')]=qs[_0x678b('0x30')](_[_0x678b('0x3a')](_0x3df816['query'],_0x294df5['filters']),_0x292826);if(_0x3df816['query'][_0x678b('0x3b')]){_0x4c2bbc[_0x678b('0x39')]=_[_0x678b('0x3c')](_0x4c2bbc['where'],{'$or':_['map'](_0x292826,function(_0x3154b3){if(_0x3154b3[_0x678b('0x2c')]!==_0x678b('0x3d')){var _0x283ac9={};_0x283ac9[_0x3154b3['name']]={'$like':'%'+_0x3df816[_0x678b('0x2e')]['filter']+'%'};return _0x283ac9;}})});}_0x4c2bbc=_['merge']({},_0x4c2bbc,_0x3df816[_0x678b('0x3e')]);var _0x10c317={'where':_0x4c2bbc[_0x678b('0x39')]};return db[_0x678b('0x2b')][_0x678b('0x3f')](_0x10c317)['then'](function(_0x6e9630){_0x41bdb2[_0x678b('0x3f')]=_0x6e9630;if(_0x3df816[_0x678b('0x2e')]['includeAll']){_0x4c2bbc[_0x678b('0x40')]=[{'all':!![]}];}return db[_0x678b('0x2b')][_0x678b('0x41')](_0x4c2bbc);})[_0x678b('0x25')](function(_0x21d96c){_0x41bdb2[_0x678b('0x42')]=_0x21d96c;return _0x41bdb2;})['then'](respondWithFilteredResult(_0x41f927,_0x4c2bbc))[_0x678b('0x43')](handleError(_0x41f927,null));};exports[_0x678b('0x44')]=function(_0x1874fa,_0x3020f0){var _0x22eb90={'raw':!![],'where':{'id':_0x1874fa[_0x678b('0x45')]['id']}},_0xe5fc08={};_0xe5fc08[_0x678b('0x32')]=_['keys'](db['SquareDetailsReport'][_0x678b('0x46')]);_0xe5fc08[_0x678b('0x2e')]=_['keys'](_0x1874fa[_0x678b('0x2e')]);_0xe5fc08['filters']=_[_0x678b('0x31')](_0xe5fc08['model'],_0xe5fc08[_0x678b('0x2e')]);_0x22eb90[_0x678b('0x33')]=_[_0x678b('0x31')](_0xe5fc08[_0x678b('0x32')],qs[_0x678b('0x34')](_0x1874fa[_0x678b('0x2e')]['fields']));_0x22eb90[_0x678b('0x33')]=_0x22eb90[_0x678b('0x33')]['length']?_0x22eb90[_0x678b('0x33')]:_0xe5fc08[_0x678b('0x32')];if(_0x1874fa['query']['includeAll']){_0x22eb90[_0x678b('0x40')]=[{'all':!![]}];}_0x22eb90=_[_0x678b('0x3c')]({},_0x22eb90,_0x1874fa['options']);return db['SquareDetailsReport'][_0x678b('0x47')](_0x22eb90)[_0x678b('0x25')](handleEntityNotFound(_0x3020f0,null))[_0x678b('0x25')](respondWithResult(_0x3020f0,null))[_0x678b('0x43')](handleError(_0x3020f0,null));};exports[_0x678b('0x48')]=function(_0x4b7cad,_0x4aea22){return db[_0x678b('0x2b')][_0x678b('0x48')](_0x4b7cad[_0x678b('0x49')],{})[_0x678b('0x25')](respondWithResult(_0x4aea22,0xc9))[_0x678b('0x43')](handleError(_0x4aea22,null));};exports['update']=function(_0x56e4a5,_0x1d61d9){if(_0x56e4a5['body']['id']){delete _0x56e4a5[_0x678b('0x49')]['id'];}return db[_0x678b('0x2b')][_0x678b('0x47')]({'where':{'id':_0x56e4a5[_0x678b('0x45')]['id']}})[_0x678b('0x25')](handleEntityNotFound(_0x1d61d9,null))[_0x678b('0x25')](saveUpdates(_0x56e4a5['body'],null))[_0x678b('0x25')](respondWithResult(_0x1d61d9,null))[_0x678b('0x43')](handleError(_0x1d61d9,null));};exports['destroy']=function(_0x1db146,_0x465645){return db['SquareDetailsReport'][_0x678b('0x47')]({'where':{'id':_0x1db146['params']['id']}})[_0x678b('0x25')](handleEntityNotFound(_0x465645,null))[_0x678b('0x25')](removeEntity(_0x465645,null))[_0x678b('0x43')](handleError(_0x465645,null));};exports[_0x678b('0x4a')]=function(_0x305c30,_0xd136d1){return db[_0x678b('0x2b')][_0x678b('0x4a')]()[_0x678b('0x25')](respondWithResult(_0xd136d1,null))['catch'](handleError(_0xd136d1,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1ebec30..3339b83 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 _0xce2e=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0xce2e,0x1e9));var _0xece2=function(_0x1c7291,_0x5d5bc8){_0x1c7291=_0x1c7291-0x0;var _0x15db4f=_0xce2e[_0x1c7291];return _0x15db4f;};'use strict';var _=require(_0xece2('0x0'));var util=require(_0xece2('0x1'));var logger=require(_0xece2('0x2'))(_0xece2('0x3'));var moment=require(_0xece2('0x4'));var BPromise=require('bluebird');var rp=require(_0xece2('0x5'));var fs=require('fs');var path=require(_0xece2('0x6'));var rimraf=require(_0xece2('0x7'));var config=require(_0xece2('0x8'));var attributes=require(_0xece2('0x9'));module[_0xece2('0xa')]=function(_0x3ccd62,_0x1da666){return _0x3ccd62[_0xece2('0xb')]('SquareDetailsReport',attributes,{'tableName':_0xece2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e4c=['define','SquareDetailsReport','report_square_details','lodash','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x73872a,_0x4a073e){var _0x1a8ddf=function(_0x2a9dd2){while(--_0x2a9dd2){_0x73872a['push'](_0x73872a['shift']());}};_0x1a8ddf(++_0x4a073e);}(_0x8e4c,0x17f));var _0xc8e4=function(_0x27a1e0,_0x3ff2cb){_0x27a1e0=_0x27a1e0-0x0;var _0x1ca624=_0x8e4c[_0x27a1e0];return _0x1ca624;};'use strict';var _=require(_0xc8e4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc8e4('0x1'));var BPromise=require(_0xc8e4('0x2'));var rp=require(_0xc8e4('0x3'));var fs=require('fs');var path=require(_0xc8e4('0x4'));var rimraf=require(_0xc8e4('0x5'));var config=require('../../config/environment');var attributes=require(_0xc8e4('0x6'));module['exports']=function(_0x2634c4,_0x30daab){return _0x2634c4[_0xc8e4('0x7')](_0xc8e4('0x8'),attributes,{'tableName':_0xc8e4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index ec2ca5c..e79f756 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 _0x9b49=['then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x9b49,0x1dd));var _0x99b4=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x9b49[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x99b4('0x0'));var util=require(_0x99b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x99b4('0x2'));var fs=require('fs');var Redis=require(_0x99b4('0x3'));var db=require(_0x99b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99b4('0x5'))(_0x99b4('0x6'));var config=require('../../config/environment');var jayson=require(_0x99b4('0x7'));var client=jayson['client'][_0x99b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x490881,_0x4e5bd3,_0x472ed7){return new BPromise(function(_0x43163e,_0x36236c){return client['request'](_0x490881,_0x472ed7)[_0x99b4('0x9')](function(_0xd19eac){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x4e5bd3,_0x99b4('0xa'));logger[_0x99b4('0xb')](_0x99b4('0xc'),_0x4e5bd3,_0x99b4('0xa'),JSON[_0x99b4('0xd')](_0xd19eac));if(_0xd19eac[_0x99b4('0xe')]){if(_0xd19eac[_0x99b4('0xe')][_0x99b4('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4e5bd3,_0xd19eac['error'][_0x99b4('0x10')]);return _0x36236c(_0xd19eac['error'][_0x99b4('0x10')]);}logger[_0x99b4('0xe')](_0x99b4('0x11'),_0x4e5bd3,_0xd19eac[_0x99b4('0xe')][_0x99b4('0x10')]);return _0x43163e(_0xd19eac['error'][_0x99b4('0x10')]);}else{logger[_0x99b4('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e5bd3,_0x99b4('0xa'));_0x43163e(_0xd19eac[_0x99b4('0x13')][_0x99b4('0x10')]);}})[_0x99b4('0x14')](function(_0x3aa348){logger[_0x99b4('0xe')](_0x99b4('0x11'),_0x4e5bd3,_0x3aa348);_0x36236c(_0x3aa348);});});}exports[_0x99b4('0x15')]=function(_0x3761f4){var _0x5ace8e=this;return new Promise(function(_0x4a7d53,_0x430196){return db[_0x99b4('0x16')][_0x99b4('0x17')](_0x3761f4[_0x99b4('0x18')],{'raw':_0x3761f4[_0x99b4('0x19')]?_0x3761f4[_0x99b4('0x19')][_0x99b4('0x1a')]===undefined?!![]:![]:!![]})[_0x99b4('0x9')](function(_0x522c63){logger['info'](_0x99b4('0x15'),_0x3761f4);logger[_0x99b4('0xb')](_0x99b4('0x15'),_0x3761f4,JSON[_0x99b4('0xd')](_0x522c63));_0x4a7d53(_0x522c63);})[_0x99b4('0x14')](function(_0x2db8b3){logger[_0x99b4('0xe')]('CreateSquareDetailsReport',_0x2db8b3[_0x99b4('0x10')],_0x3761f4);_0x430196(_0x5ace8e[_0x99b4('0xe')](0x1f4,_0x2db8b3['message']));});});}; \ No newline at end of file +var _0xc88e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','stringify','lodash'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xc88e,0x14f));var _0xec88=function(_0x4a3f5e,_0x2ed7d7){_0x4a3f5e=_0x4a3f5e-0x0;var _0x4f448f=_0xc88e[_0x4a3f5e];return _0x4f448f;};'use strict';var _=require(_0xec88('0x0'));var util=require(_0xec88('0x1'));var moment=require(_0xec88('0x2'));var BPromise=require(_0xec88('0x3'));var rs=require(_0xec88('0x4'));var fs=require('fs');var Redis=require(_0xec88('0x5'));var db=require(_0xec88('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xec88('0x7'))(_0xec88('0x8'));var config=require('../../config/environment');var jayson=require(_0xec88('0x9'));var client=jayson['client'][_0xec88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cdf23,_0x554576,_0x2caf51){return new BPromise(function(_0x13cbc1,_0x54901f){return client[_0xec88('0xb')](_0x4cdf23,_0x2caf51)[_0xec88('0xc')](function(_0x2608d7){logger['info'](_0xec88('0xd'),_0x554576,_0xec88('0xe'));logger[_0xec88('0xf')](_0xec88('0x10'),_0x554576,_0xec88('0xe'),JSON['stringify'](_0x2608d7));if(_0x2608d7[_0xec88('0x11')]){if(_0x2608d7[_0xec88('0x11')][_0xec88('0x12')]===0x1f4){logger['error'](_0xec88('0xd'),_0x554576,_0x2608d7[_0xec88('0x11')][_0xec88('0x13')]);return _0x54901f(_0x2608d7[_0xec88('0x11')][_0xec88('0x13')]);}logger['error'](_0xec88('0xd'),_0x554576,_0x2608d7[_0xec88('0x11')][_0xec88('0x13')]);return _0x13cbc1(_0x2608d7[_0xec88('0x11')][_0xec88('0x13')]);}else{logger[_0xec88('0x14')](_0xec88('0xd'),_0x554576,_0xec88('0xe'));_0x13cbc1(_0x2608d7['result'][_0xec88('0x13')]);}})[_0xec88('0x15')](function(_0xdc1d9b){logger[_0xec88('0x11')](_0xec88('0xd'),_0x554576,_0xdc1d9b);_0x54901f(_0xdc1d9b);});});}exports[_0xec88('0x16')]=function(_0x420e45){var _0x2e875e=this;return new Promise(function(_0x2481d8,_0x22091a){return db[_0xec88('0x17')][_0xec88('0x18')](_0x420e45[_0xec88('0x19')],{'raw':_0x420e45[_0xec88('0x1a')]?_0x420e45[_0xec88('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xec88('0xc')](function(_0x1010a1){logger[_0xec88('0x14')](_0xec88('0x16'),_0x420e45);logger['debug'](_0xec88('0x16'),_0x420e45,JSON[_0xec88('0x1b')](_0x1010a1));_0x2481d8(_0x1010a1);})[_0xec88('0x15')](function(_0x1606b0){logger['error'](_0xec88('0x16'),_0x1606b0[_0xec88('0x13')],_0x420e45);_0x22091a(_0x2e875e['error'](0x1f4,_0x1606b0[_0xec88('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3ea3101..6e11a14 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 _0xfbc6=['get','/process/:pid/kill','killProcess','express','Router','isAuthenticated','index'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xfbc6,0x1d8));var _0x6fbc=function(_0x331615,_0x13aebd){_0x331615=_0x331615-0x0;var _0x4ba773=_0xfbc6[_0x331615];return _0x4ba773;};'use strict';var express=require(_0x6fbc('0x0'));var router=express[_0x6fbc('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x6fbc('0x2')](),controller[_0x6fbc('0x3')]);router[_0x6fbc('0x4')](_0x6fbc('0x5'),auth[_0x6fbc('0x2')](),controller[_0x6fbc('0x6')]);module['exports']=router; \ No newline at end of file +var _0x708d=['exports','express','Router','../../components/auth/service','isAuthenticated','index','get','/process/:pid/kill','killProcess'];(function(_0x21d31d,_0x387b5e){var _0x2c5682=function(_0x10ca2f){while(--_0x10ca2f){_0x21d31d['push'](_0x21d31d['shift']());}};_0x2c5682(++_0x387b5e);}(_0x708d,0x145));var _0xd708=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x708d[_0x28578d];return _0x524826;};'use strict';var express=require(_0xd708('0x0'));var router=express[_0xd708('0x1')]();var auth=require(_0xd708('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0xd708('0x3')](),controller[_0xd708('0x4')]);router[_0xd708('0x5')](_0xd708('0x6'),auth[_0xd708('0x3')](),controller[_0xd708('0x7')]);module[_0xd708('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 81adb11..b8110a6 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 _0x5f02=['api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','index','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec'];(function(_0x1fa1de,_0x135b2b){var _0x12d9f6=function(_0x23e98d){while(--_0x23e98d){_0x1fa1de['push'](_0x1fa1de['shift']());}};_0x12d9f6(++_0x135b2b);}(_0x5f02,0xa6));var _0x25f0=function(_0x3f67bd,_0x597f1f){_0x3f67bd=_0x3f67bd-0x0;var _0x35a5b0=_0x5f02[_0x3f67bd];return _0x35a5b0;};'use strict';var info=require(_0x25f0('0x0'));var exec=require('child_process')[_0x25f0('0x1')];var logger=require('../../config/logger')(_0x25f0('0x2'));var util=require('util');var BPromise=require(_0x25f0('0x3'));var _=require(_0x25f0('0x4'));function handleError(_0x127271,_0x2a4994,_0x548a05){_0x2a4994=_0x2a4994||0x1f4;return function(_0x5cf1a6){logger[_0x25f0('0x5')](_0x25f0('0x6'),_0x548a05,_0x2a4994,util[_0x25f0('0x7')](_0x5cf1a6,{'showHidden':![],'depth':null}));delete _0x5cf1a6['name'];_0x127271['status'](_0x2a4994)['send'](_0x5cf1a6);};}exports[_0x25f0('0x8')]=function(_0x488cb9,_0xa6d3b2){return info['getAllData']()[_0x25f0('0x9')](function(_0x4d0f20){return _0xa6d3b2[_0x25f0('0xa')](0xc8)[_0x25f0('0xb')](_0x4d0f20);})['catch'](function(_0xbad749){return _0xa6d3b2[_0x25f0('0xa')](0x1f4)[_0x25f0('0xb')](_0xbad749);});};exports[_0x25f0('0xc')]=function(_0x3678e3,_0x2ef0fd){var _0x254de4=[_0x25f0('0xd')];return new BPromise(function(_0x58551d,_0x2d9deb){return exec(util[_0x25f0('0xe')](_0x25f0('0xf'),_0x3678e3[_0x25f0('0x10')][_0x25f0('0x11')]),function(_0x55e013,_0x314638,_0x4678b6){if(_0x55e013){return _0x2d9deb(_0x55e013);}return _0x58551d(_0x314638);});})[_0x25f0('0x9')](function(_0x2a6b60){var _0x59f386=![];var _0x36d8e7=_0x2a6b60['split'](/\n/);for(var _0x526df9=0x0,_0x180cef=_0x254de4['length'];_0x526df9<_0x180cef,_0x59f386===![];_0x526df9+=0x1){if(_0x2a6b60[_0x25f0('0x12')](_0x254de4[_0x526df9])>=0x0){_0x59f386=!![];}}if(!_0x59f386){throw new Error(util[_0x25f0('0xe')](_0x25f0('0x13'),_0x3678e3[_0x25f0('0x10')]['pid']));}process[_0x25f0('0x14')](_0x3678e3[_0x25f0('0x10')]['pid'],_0x25f0('0x15'));return _0x2ef0fd[_0x25f0('0xa')](0xc8)[_0x25f0('0xb')]({'message':util[_0x25f0('0xe')](_0x25f0('0x16'),_0x3678e3['params']['pid'])});})[_0x25f0('0x17')](handleError(_0x2ef0fd,null,_0x25f0('0xc')));}; \ No newline at end of file +var _0xfed1=['then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData'];(function(_0x522b99,_0x483967){var _0x3533ff=function(_0x4844c6){while(--_0x4844c6){_0x522b99['push'](_0x522b99['shift']());}};_0x3533ff(++_0x483967);}(_0xfed1,0x1ae));var _0x1fed=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfed1[_0x40a045];return _0x1a687c;};'use strict';var info=require('systeminformation');var exec=require(_0x1fed('0x0'))['exec'];var logger=require(_0x1fed('0x1'))(_0x1fed('0x2'));var util=require('util');var BPromise=require(_0x1fed('0x3'));var _=require('lodash');function handleError(_0x56a2b3,_0x313b07,_0xbbcb9c){_0x313b07=_0x313b07||0x1f4;return function(_0x238179){logger[_0x1fed('0x4')](_0x1fed('0x5'),_0xbbcb9c,_0x313b07,util[_0x1fed('0x6')](_0x238179,{'showHidden':![],'depth':null}));delete _0x238179[_0x1fed('0x7')];_0x56a2b3[_0x1fed('0x8')](_0x313b07)[_0x1fed('0x9')](_0x238179);};}exports[_0x1fed('0xa')]=function(_0x5b04f1,_0x52d3d0){return info[_0x1fed('0xb')]()[_0x1fed('0xc')](function(_0x5a4be4){return _0x52d3d0['status'](0xc8)[_0x1fed('0xd')](_0x5a4be4);})[_0x1fed('0xe')](function(_0x6e2320){return _0x52d3d0['status'](0x1f4)[_0x1fed('0xd')](_0x6e2320);});};exports[_0x1fed('0xf')]=function(_0xd04a09,_0x27d944){var _0x5135f2=[_0x1fed('0x10')];return new BPromise(function(_0x2a3a1d,_0x4719e8){return exec(util[_0x1fed('0x11')](_0x1fed('0x12'),_0xd04a09[_0x1fed('0x13')][_0x1fed('0x14')]),function(_0x56f64d,_0x283849,_0x45a2d7){if(_0x56f64d){return _0x4719e8(_0x56f64d);}return _0x2a3a1d(_0x283849);});})[_0x1fed('0xc')](function(_0x5947e5){var _0x31bbd6=![];var _0x652e12=_0x5947e5[_0x1fed('0x15')](/\n/);for(var _0x104713=0x0,_0x13ceb0=_0x5135f2[_0x1fed('0x16')];_0x104713<_0x13ceb0,_0x31bbd6===![];_0x104713+=0x1){if(_0x5947e5[_0x1fed('0x17')](_0x5135f2[_0x104713])>=0x0){_0x31bbd6=!![];}}if(!_0x31bbd6){throw new Error(util[_0x1fed('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xd04a09[_0x1fed('0x13')]['pid']));}process[_0x1fed('0x18')](_0xd04a09[_0x1fed('0x13')]['pid'],'SIGINT');return _0x27d944[_0x1fed('0x8')](0xc8)['json']({'message':util[_0x1fed('0x11')](_0x1fed('0x19'),_0xd04a09[_0x1fed('0x13')]['pid'])});})[_0x1fed('0xe')](handleError(_0x27d944,null,_0x1fed('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 96001ab..d56b6fb 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 _0x00bb=['/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x2e4394,_0x5a2858){var _0x4f84e0=function(_0x38ae30){while(--_0x38ae30){_0x2e4394['push'](_0x2e4394['shift']());}};_0x4f84e0(++_0x5a2858);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0xb')]('/',auth[_0xb00b('0x9')](),controller[_0xb00b('0xc')]);router['put']('/:id',auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller['destroy']);module[_0xb00b('0xf')]=router; \ No newline at end of file +var _0xf3cd=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','delete','destroy','exports','multer'];(function(_0x1195d6,_0x273e49){var _0x2c0787=function(_0x4953f0){while(--_0x4953f0){_0x1195d6['push'](_0x1195d6['shift']());}};_0x2c0787(++_0x273e49);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0xf3cd[_0x4b095c];return _0x4495e2;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['post']('/',auth[_0xdf3c('0x9')](),controller['create']);router['put'](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller['update']);router[_0xdf3c('0xe')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xf')]);module[_0xdf3c('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7369353..53048c3 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x4e227c,_0x4429fd){var _0x558d08=function(_0x3135fc){while(--_0x3135fc){_0x4e227c['push'](_0x4e227c['shift']());}};_0x558d08(++_0x4429fd);}(_0x878f,0x173));var _0xf878=function(_0x1ca7b0,_0x87ff35){_0x1ca7b0=_0x1ca7b0-0x0;var _0x4ccc7f=_0x878f[_0x1ca7b0];return _0x4ccc7f;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0xda3f=['exports','STRING'];(function(_0x31ddbb,_0x23b827){var _0x502c6f=function(_0x3ec78f){while(--_0x3ec78f){_0x31ddbb['push'](_0x31ddbb['shift']());}};_0x502c6f(++_0x23b827);}(_0xda3f,0xec));var _0xfda3=function(_0x4e058f,_0x2bd1a1){_0x4e058f=_0x4e058f-0x0;var _0x247a08=_0xda3f[_0x4e058f];return _0x247a08;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 6127537..38a258f 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 _0x3d8d=['includeAll','include','findAll','rows','catch','params','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','count'];(function(_0x2feaba,_0x4fcabc){var _0x5b36b5=function(_0x568024){while(--_0x568024){_0x2feaba['push'](_0x2feaba['shift']());}};_0x5b36b5(++_0x4fcabc);}(_0x3d8d,0xad));var _0xd3d8=function(_0x208c54,_0x120a70){_0x208c54=_0x208c54-0x0;var _0x4b0116=_0x3d8d[_0x208c54];return _0x4b0116;};'use strict';var pdf=require(_0xd3d8('0x0'));var emlformat=require(_0xd3d8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd3d8('0x2'));var jsonpatch=require(_0xd3d8('0x3'));var rp=require(_0xd3d8('0x4'));var moment=require('moment');var BPromise=require(_0xd3d8('0x5'));var Mustache=require('mustache');var util=require(_0xd3d8('0x6'));var path=require('path');var sox=require(_0xd3d8('0x7'));var csv=require('to-csv');var ejs=require(_0xd3d8('0x8'));var fs=require('fs');var _=require(_0xd3d8('0x9'));var squel=require(_0xd3d8('0xa'));var crypto=require(_0xd3d8('0xb'));var jsforce=require(_0xd3d8('0xc'));var deskjs=require(_0xd3d8('0xd'));var toCsv=require(_0xd3d8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd3d8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd3d8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3d8('0x11'));var logger=require(_0xd3d8('0x12'))(_0xd3d8('0x13'));var utils=require(_0xd3d8('0x14'));var config=require(_0xd3d8('0x15'));var db=require(_0xd3d8('0x16'))['db'];function respondWithStatusCode(_0xd241bf,_0x199620){_0x199620=_0x199620||0xcc;return function(_0x37eec){if(_0x37eec){return _0xd241bf[_0xd3d8('0x17')](_0x199620);}return _0xd241bf[_0xd3d8('0x18')](_0x199620)[_0xd3d8('0x19')]();};}function respondWithResult(_0x483a62,_0x1fe65e){_0x1fe65e=_0x1fe65e||0xc8;return function(_0x5648aa){if(_0x5648aa){return _0x483a62['status'](_0x1fe65e)[_0xd3d8('0x1a')](_0x5648aa);}};}function respondWithFilteredResult(_0x1f2066,_0x2a950c){return function(_0x563055){if(_0x563055){var _0x44eeb3=_0x563055['count'],_0x36be59=_0x2a950c[_0xd3d8('0x1b')],_0x3bd0d3=_0x2a950c['offset']+_0x2a950c[_0xd3d8('0x1c')],_0x2dfdf6;if(_0x3bd0d3>=_0x44eeb3){_0x3bd0d3=_0x44eeb3;_0x2dfdf6=0xc8;}else{_0x2dfdf6=0xce;}_0x1f2066['status'](_0x2dfdf6);return _0x1f2066['set']('Content-Range',_0x36be59+'-'+_0x3bd0d3+'/'+_0x44eeb3)['json'](_0x563055);}return null;};}function patchUpdates(_0x157eb2){return function(_0x505dcc){try{jsonpatch['apply'](_0x505dcc,_0x157eb2,!![]);}catch(_0x49ce67){return BPromise[_0xd3d8('0x1d')](_0x49ce67);}return _0x505dcc[_0xd3d8('0x1e')]();};}function saveUpdates(_0x450cb4,_0x190077){return function(_0x5a17aa){if(_0x5a17aa){return _0x5a17aa['update'](_0x450cb4)[_0xd3d8('0x1f')](function(_0x2455c7){return _0x2455c7;});}return null;};}function removeEntity(_0x431676,_0x4ac030){return function(_0x364a12){if(_0x364a12){return _0x364a12[_0xd3d8('0x20')]()[_0xd3d8('0x1f')](function(){var _0x4b5383=_0x364a12[_0xd3d8('0x21')]({'plain':!![]});var _0x2ab7a5=_0xd3d8('0x22');return db[_0xd3d8('0x23')][_0xd3d8('0x20')]({'where':{'type':_0x2ab7a5,'resourceId':_0x4b5383['id']}})[_0xd3d8('0x1f')](function(){return _0x364a12;});})['then'](function(){_0x431676[_0xd3d8('0x18')](0xcc)[_0xd3d8('0x19')]();});}};}function handleEntityNotFound(_0x1f215b,_0x3a38fb){return function(_0x23ff80){if(!_0x23ff80){_0x1f215b['sendStatus'](0x194);}return _0x23ff80;};}function handleError(_0x4a9a74,_0x4e1791){_0x4e1791=_0x4e1791||0x1f4;return function(_0x1ded20){logger[_0xd3d8('0x24')](_0x1ded20[_0xd3d8('0x25')]);if(_0x1ded20[_0xd3d8('0x26')]){delete _0x1ded20['name'];}_0x4a9a74[_0xd3d8('0x18')](_0x4e1791)[_0xd3d8('0x27')](_0x1ded20);};}exports['index']=function(_0x279137,_0x30c8bd){var _0x31dcc6={},_0x40770e={},_0x14917f={'count':0x0,'rows':[]};var _0x2c38a2=_[_0xd3d8('0x28')](db[_0xd3d8('0x29')]['rawAttributes'],function(_0x2c892a){return{'name':_0x2c892a[_0xd3d8('0x2a')],'type':_0x2c892a['type'][_0xd3d8('0x2b')]};});_0x40770e[_0xd3d8('0x2c')]=_['map'](_0x2c38a2,'name');_0x40770e[_0xd3d8('0x2d')]=_[_0xd3d8('0x2e')](_0x279137[_0xd3d8('0x2d')]);_0x40770e[_0xd3d8('0x2f')]=_[_0xd3d8('0x30')](_0x40770e['model'],_0x40770e[_0xd3d8('0x2d')]);_0x31dcc6[_0xd3d8('0x31')]=_[_0xd3d8('0x30')](_0x40770e['model'],qs[_0xd3d8('0x32')](_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x32')]));_0x31dcc6[_0xd3d8('0x31')]=_0x31dcc6[_0xd3d8('0x31')][_0xd3d8('0x33')]?_0x31dcc6[_0xd3d8('0x31')]:_0x40770e['model'];if(!_0x279137[_0xd3d8('0x2d')]['hasOwnProperty']('nolimit')){_0x31dcc6[_0xd3d8('0x1c')]=qs[_0xd3d8('0x1c')](_0x279137[_0xd3d8('0x2d')]['limit']);_0x31dcc6[_0xd3d8('0x1b')]=qs[_0xd3d8('0x1b')](_0x279137[_0xd3d8('0x2d')]['offset']);}_0x31dcc6['order']=qs[_0xd3d8('0x34')](_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x34')]);_0x31dcc6[_0xd3d8('0x35')]=qs[_0xd3d8('0x2f')](_[_0xd3d8('0x36')](_0x279137['query'],_0x40770e['filters']),_0x2c38a2);if(_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x37')]){_0x31dcc6[_0xd3d8('0x35')]=_[_0xd3d8('0x38')](_0x31dcc6[_0xd3d8('0x35')],{'$or':_[_0xd3d8('0x28')](_0x2c38a2,function(_0x348c0e){if(_0x348c0e[_0xd3d8('0x39')]!==_0xd3d8('0x3a')){var _0x3d85b4={};_0x3d85b4[_0x348c0e[_0xd3d8('0x26')]]={'$like':'%'+_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x37')]+'%'};return _0x3d85b4;}})});}_0x31dcc6=_[_0xd3d8('0x38')]({},_0x31dcc6,_0x279137[_0xd3d8('0x3b')]);var _0x3f1bee={'where':_0x31dcc6['where']};return db[_0xd3d8('0x29')][_0xd3d8('0x3c')](_0x3f1bee)[_0xd3d8('0x1f')](function(_0x8709a4){_0x14917f[_0xd3d8('0x3c')]=_0x8709a4;if(_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x3d')]){_0x31dcc6[_0xd3d8('0x3e')]=[{'all':!![]}];}return db[_0xd3d8('0x29')][_0xd3d8('0x3f')](_0x31dcc6);})['then'](function(_0x57fef4){_0x14917f[_0xd3d8('0x40')]=_0x57fef4;return _0x14917f;})[_0xd3d8('0x1f')](respondWithFilteredResult(_0x30c8bd,_0x31dcc6))[_0xd3d8('0x41')](handleError(_0x30c8bd,null));};exports['show']=function(_0x2f0b50,_0x554173){var _0x18a61c={'raw':!![],'where':{'id':_0x2f0b50[_0xd3d8('0x42')]['id']}},_0x3a537e={};_0x3a537e[_0xd3d8('0x2c')]=_[_0xd3d8('0x2e')](db[_0xd3d8('0x29')][_0xd3d8('0x43')]);_0x3a537e[_0xd3d8('0x2d')]=_[_0xd3d8('0x2e')](_0x2f0b50[_0xd3d8('0x2d')]);_0x3a537e[_0xd3d8('0x2f')]=_[_0xd3d8('0x30')](_0x3a537e[_0xd3d8('0x2c')],_0x3a537e[_0xd3d8('0x2d')]);_0x18a61c[_0xd3d8('0x31')]=_['intersection'](_0x3a537e[_0xd3d8('0x2c')],qs[_0xd3d8('0x32')](_0x2f0b50['query'][_0xd3d8('0x32')]));_0x18a61c[_0xd3d8('0x31')]=_0x18a61c[_0xd3d8('0x31')][_0xd3d8('0x33')]?_0x18a61c['attributes']:_0x3a537e['model'];if(_0x2f0b50[_0xd3d8('0x2d')][_0xd3d8('0x3d')]){_0x18a61c['include']=[{'all':!![]}];}_0x18a61c=_['merge']({},_0x18a61c,_0x2f0b50[_0xd3d8('0x3b')]);return db['Tag']['find'](_0x18a61c)[_0xd3d8('0x1f')](handleEntityNotFound(_0x554173,null))[_0xd3d8('0x1f')](respondWithResult(_0x554173,null))[_0xd3d8('0x41')](handleError(_0x554173,null));};exports['create']=function(_0x51b370,_0x1172d2){return db['Tag']['create'](_0x51b370[_0xd3d8('0x44')],{})['then'](function(_0x1f9b13){var _0x4bed3a=_0x51b370['user'][_0xd3d8('0x21')]({'plain':!![]});if(!_0x4bed3a)throw new Error(_0xd3d8('0x45'));if(_0x4bed3a[_0xd3d8('0x46')]==='user'){var _0x27236c=_0x1f9b13[_0xd3d8('0x21')]({'plain':!![]});var _0x63ea88=_0xd3d8('0x22');return db[_0xd3d8('0x47')][_0xd3d8('0x48')]({'where':{'name':_0x63ea88,'userProfileId':_0x4bed3a[_0xd3d8('0x49')]},'raw':!![]})['then'](function(_0xa66680){if(_0xa66680&&_0xa66680[_0xd3d8('0x4a')]===0x0){return db['UserProfileResource'][_0xd3d8('0x4b')]({'name':_0x27236c[_0xd3d8('0x26')],'resourceId':_0x27236c['id'],'type':_0xa66680[_0xd3d8('0x26')],'sectionId':_0xa66680['id']},{})[_0xd3d8('0x1f')](function(){return _0x1f9b13;});}else{return _0x1f9b13;}})['catch'](function(_0x354fb3){logger[_0xd3d8('0x24')](_0xd3d8('0x4c'),_0x354fb3);throw _0x354fb3;});}return _0x1f9b13;})[_0xd3d8('0x1f')](respondWithResult(_0x1172d2,0xc9))[_0xd3d8('0x41')](handleError(_0x1172d2,null));};exports[_0xd3d8('0x4d')]=function(_0x4e5012,_0x4ab489){if(_0x4e5012[_0xd3d8('0x44')]['id']){delete _0x4e5012['body']['id'];}return db['Tag'][_0xd3d8('0x48')]({'where':{'id':_0x4e5012['params']['id']}})[_0xd3d8('0x1f')](handleEntityNotFound(_0x4ab489,null))[_0xd3d8('0x1f')](saveUpdates(_0x4e5012[_0xd3d8('0x44')],null))[_0xd3d8('0x1f')](respondWithResult(_0x4ab489,null))[_0xd3d8('0x41')](handleError(_0x4ab489,null));};exports[_0xd3d8('0x20')]=function(_0x3dda5e,_0x5033c5){return db['Tag'][_0xd3d8('0x48')]({'where':{'id':_0x3dda5e[_0xd3d8('0x42')]['id']}})[_0xd3d8('0x1f')](handleEntityNotFound(_0x5033c5,null))['then'](removeEntity(_0x5033c5,null))[_0xd3d8('0x41')](handleError(_0x5033c5,null));}; \ No newline at end of file +var _0x0fd5=['model','fields','length','nolimit','order','sort','where','pick','merge','filter','include','catch','show','keys','intersection','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Tags','stack','name','send','map','Tag','rawAttributes','type','key','query','filters','attributes'];(function(_0x3ccebb,_0x80f121){var _0x2c5c99=function(_0x315766){while(--_0x315766){_0x3ccebb['push'](_0x3ccebb['shift']());}};_0x2c5c99(++_0x80f121);}(_0x0fd5,0x1a9));var _0x50fd=function(_0x4e0fd6,_0x16bc28){_0x4e0fd6=_0x4e0fd6-0x0;var _0x50a6ef=_0x0fd5[_0x4e0fd6];return _0x50a6ef;};'use strict';var pdf=require(_0x50fd('0x0'));var emlformat=require(_0x50fd('0x1'));var rimraf=require(_0x50fd('0x2'));var zipdir=require(_0x50fd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x50fd('0x4'));var Mustache=require('mustache');var util=require(_0x50fd('0x5'));var path=require(_0x50fd('0x6'));var sox=require(_0x50fd('0x7'));var csv=require(_0x50fd('0x8'));var ejs=require(_0x50fd('0x9'));var fs=require('fs');var _=require(_0x50fd('0xa'));var squel=require(_0x50fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x50fd('0xc'));var deskjs=require(_0x50fd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50fd('0xe'));var Papa=require(_0x50fd('0xf'));var Redis=require(_0x50fd('0x10'));var authService=require(_0x50fd('0x11'));var qs=require(_0x50fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x50fd('0x13'));var utils=require(_0x50fd('0x14'));var config=require(_0x50fd('0x15'));var db=require(_0x50fd('0x16'))['db'];function respondWithStatusCode(_0x20cae5,_0x3da142){_0x3da142=_0x3da142||0xcc;return function(_0x3d5f73){if(_0x3d5f73){return _0x20cae5[_0x50fd('0x17')](_0x3da142);}return _0x20cae5[_0x50fd('0x18')](_0x3da142)['end']();};}function respondWithResult(_0x496e75,_0x2f2f17){_0x2f2f17=_0x2f2f17||0xc8;return function(_0x45dc2d){if(_0x45dc2d){return _0x496e75[_0x50fd('0x18')](_0x2f2f17)['json'](_0x45dc2d);}};}function respondWithFilteredResult(_0x48caff,_0x1cd999){return function(_0x31562b){if(_0x31562b){var _0x594b31=_0x31562b[_0x50fd('0x19')],_0x9417ce=_0x1cd999[_0x50fd('0x1a')],_0x1a2f4e=_0x1cd999[_0x50fd('0x1a')]+_0x1cd999[_0x50fd('0x1b')],_0x30f9f9;if(_0x1a2f4e>=_0x594b31){_0x1a2f4e=_0x594b31;_0x30f9f9=0xc8;}else{_0x30f9f9=0xce;}_0x48caff[_0x50fd('0x18')](_0x30f9f9);return _0x48caff['set'](_0x50fd('0x1c'),_0x9417ce+'-'+_0x1a2f4e+'/'+_0x594b31)[_0x50fd('0x1d')](_0x31562b);}return null;};}function patchUpdates(_0x373d0a){return function(_0x36b919){try{jsonpatch[_0x50fd('0x1e')](_0x36b919,_0x373d0a,!![]);}catch(_0x4500ce){return BPromise[_0x50fd('0x1f')](_0x4500ce);}return _0x36b919[_0x50fd('0x20')]();};}function saveUpdates(_0x161b24,_0x488100){return function(_0x10a3eb){if(_0x10a3eb){return _0x10a3eb[_0x50fd('0x21')](_0x161b24)[_0x50fd('0x22')](function(_0x139524){return _0x139524;});}return null;};}function removeEntity(_0x505067,_0x1e650b){return function(_0x48826a){if(_0x48826a){return _0x48826a[_0x50fd('0x23')]()[_0x50fd('0x22')](function(){var _0x468246=_0x48826a[_0x50fd('0x24')]({'plain':!![]});var _0x1846ec=_0x50fd('0x25');return db['UserProfileResource'][_0x50fd('0x23')]({'where':{'type':_0x1846ec,'resourceId':_0x468246['id']}})[_0x50fd('0x22')](function(){return _0x48826a;});})[_0x50fd('0x22')](function(){_0x505067[_0x50fd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501b20,_0x20e230){return function(_0x2c71fc){if(!_0x2c71fc){_0x501b20['sendStatus'](0x194);}return _0x2c71fc;};}function handleError(_0x205baa,_0x3b5646){_0x3b5646=_0x3b5646||0x1f4;return function(_0x512139){logger['error'](_0x512139[_0x50fd('0x26')]);if(_0x512139[_0x50fd('0x27')]){delete _0x512139[_0x50fd('0x27')];}_0x205baa['status'](_0x3b5646)[_0x50fd('0x28')](_0x512139);};}exports['index']=function(_0x16c76f,_0xe455b2){var _0x59855c={},_0x386dfe={},_0x5df0bb={'count':0x0,'rows':[]};var _0x10e0cc=_[_0x50fd('0x29')](db[_0x50fd('0x2a')][_0x50fd('0x2b')],function(_0x515ae5){return{'name':_0x515ae5['fieldName'],'type':_0x515ae5[_0x50fd('0x2c')][_0x50fd('0x2d')]};});_0x386dfe['model']=_['map'](_0x10e0cc,_0x50fd('0x27'));_0x386dfe['query']=_['keys'](_0x16c76f[_0x50fd('0x2e')]);_0x386dfe[_0x50fd('0x2f')]=_['intersection'](_0x386dfe['model'],_0x386dfe['query']);_0x59855c[_0x50fd('0x30')]=_['intersection'](_0x386dfe[_0x50fd('0x31')],qs[_0x50fd('0x32')](_0x16c76f['query']['fields']));_0x59855c['attributes']=_0x59855c[_0x50fd('0x30')][_0x50fd('0x33')]?_0x59855c[_0x50fd('0x30')]:_0x386dfe['model'];if(!_0x16c76f[_0x50fd('0x2e')]['hasOwnProperty'](_0x50fd('0x34'))){_0x59855c[_0x50fd('0x1b')]=qs[_0x50fd('0x1b')](_0x16c76f[_0x50fd('0x2e')]['limit']);_0x59855c[_0x50fd('0x1a')]=qs['offset'](_0x16c76f[_0x50fd('0x2e')][_0x50fd('0x1a')]);}_0x59855c[_0x50fd('0x35')]=qs[_0x50fd('0x36')](_0x16c76f['query'][_0x50fd('0x36')]);_0x59855c[_0x50fd('0x37')]=qs[_0x50fd('0x2f')](_[_0x50fd('0x38')](_0x16c76f['query'],_0x386dfe[_0x50fd('0x2f')]),_0x10e0cc);if(_0x16c76f[_0x50fd('0x2e')]['filter']){_0x59855c[_0x50fd('0x37')]=_[_0x50fd('0x39')](_0x59855c[_0x50fd('0x37')],{'$or':_[_0x50fd('0x29')](_0x10e0cc,function(_0x52d4d8){if(_0x52d4d8[_0x50fd('0x2c')]!=='VIRTUAL'){var _0x596b32={};_0x596b32[_0x52d4d8['name']]={'$like':'%'+_0x16c76f[_0x50fd('0x2e')][_0x50fd('0x3a')]+'%'};return _0x596b32;}})});}_0x59855c=_['merge']({},_0x59855c,_0x16c76f['options']);var _0x4d8402={'where':_0x59855c['where']};return db[_0x50fd('0x2a')][_0x50fd('0x19')](_0x4d8402)['then'](function(_0x569b8f){_0x5df0bb[_0x50fd('0x19')]=_0x569b8f;if(_0x16c76f['query']['includeAll']){_0x59855c[_0x50fd('0x3b')]=[{'all':!![]}];}return db[_0x50fd('0x2a')]['findAll'](_0x59855c);})[_0x50fd('0x22')](function(_0x988159){_0x5df0bb['rows']=_0x988159;return _0x5df0bb;})['then'](respondWithFilteredResult(_0xe455b2,_0x59855c))[_0x50fd('0x3c')](handleError(_0xe455b2,null));};exports[_0x50fd('0x3d')]=function(_0x58d088,_0x47d466){var _0x2ad3fc={'raw':!![],'where':{'id':_0x58d088['params']['id']}},_0x4feba7={};_0x4feba7[_0x50fd('0x31')]=_[_0x50fd('0x3e')](db[_0x50fd('0x2a')][_0x50fd('0x2b')]);_0x4feba7['query']=_[_0x50fd('0x3e')](_0x58d088[_0x50fd('0x2e')]);_0x4feba7[_0x50fd('0x2f')]=_['intersection'](_0x4feba7[_0x50fd('0x31')],_0x4feba7['query']);_0x2ad3fc[_0x50fd('0x30')]=_[_0x50fd('0x3f')](_0x4feba7[_0x50fd('0x31')],qs[_0x50fd('0x32')](_0x58d088[_0x50fd('0x2e')][_0x50fd('0x32')]));_0x2ad3fc[_0x50fd('0x30')]=_0x2ad3fc[_0x50fd('0x30')][_0x50fd('0x33')]?_0x2ad3fc[_0x50fd('0x30')]:_0x4feba7[_0x50fd('0x31')];if(_0x58d088['query'][_0x50fd('0x40')]){_0x2ad3fc[_0x50fd('0x3b')]=[{'all':!![]}];}_0x2ad3fc=_[_0x50fd('0x39')]({},_0x2ad3fc,_0x58d088[_0x50fd('0x41')]);return db[_0x50fd('0x2a')]['find'](_0x2ad3fc)['then'](handleEntityNotFound(_0x47d466,null))[_0x50fd('0x22')](respondWithResult(_0x47d466,null))[_0x50fd('0x3c')](handleError(_0x47d466,null));};exports[_0x50fd('0x42')]=function(_0x325966,_0x278f9a){return db[_0x50fd('0x2a')][_0x50fd('0x42')](_0x325966[_0x50fd('0x43')],{})['then'](function(_0x534190){var _0x1334a9=_0x325966[_0x50fd('0x44')][_0x50fd('0x24')]({'plain':!![]});if(!_0x1334a9)throw new Error(_0x50fd('0x45'));if(_0x1334a9[_0x50fd('0x46')]===_0x50fd('0x44')){var _0x5ca4f8=_0x534190[_0x50fd('0x24')]({'plain':!![]});var _0x48def3=_0x50fd('0x25');return db[_0x50fd('0x47')][_0x50fd('0x48')]({'where':{'name':_0x48def3,'userProfileId':_0x1334a9[_0x50fd('0x49')]},'raw':!![]})[_0x50fd('0x22')](function(_0xd8104b){if(_0xd8104b&&_0xd8104b[_0x50fd('0x4a')]===0x0){return db[_0x50fd('0x4b')][_0x50fd('0x42')]({'name':_0x5ca4f8[_0x50fd('0x27')],'resourceId':_0x5ca4f8['id'],'type':_0xd8104b[_0x50fd('0x27')],'sectionId':_0xd8104b['id']},{})[_0x50fd('0x22')](function(){return _0x534190;});}else{return _0x534190;}})[_0x50fd('0x3c')](function(_0x3101c3){logger[_0x50fd('0x4c')](_0x50fd('0x4d'),_0x3101c3);throw _0x3101c3;});}return _0x534190;})[_0x50fd('0x22')](respondWithResult(_0x278f9a,0xc9))[_0x50fd('0x3c')](handleError(_0x278f9a,null));};exports['update']=function(_0x181a4e,_0x2e0e0d){if(_0x181a4e[_0x50fd('0x43')]['id']){delete _0x181a4e['body']['id'];}return db[_0x50fd('0x2a')][_0x50fd('0x48')]({'where':{'id':_0x181a4e['params']['id']}})['then'](handleEntityNotFound(_0x2e0e0d,null))[_0x50fd('0x22')](saveUpdates(_0x181a4e[_0x50fd('0x43')],null))[_0x50fd('0x22')](respondWithResult(_0x2e0e0d,null))[_0x50fd('0x3c')](handleError(_0x2e0e0d,null));};exports[_0x50fd('0x23')]=function(_0x3d9100,_0x264989){return db[_0x50fd('0x2a')][_0x50fd('0x48')]({'where':{'id':_0x3d9100[_0x50fd('0x4e')]['id']}})[_0x50fd('0x22')](handleEntityNotFound(_0x264989,null))[_0x50fd('0x22')](removeEntity(_0x264989,null))[_0x50fd('0x3c')](handleError(_0x264989,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index eddde11..377eddc 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 _0xdbb3=['util','api','bluebird','request-promise','path','rimraf','./tag.attributes','tools_tags','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdbb3,0x98));var _0x3dbb=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xdbb3[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var logger=require('../../config/logger')(_0x3dbb('0x2'));var moment=require('moment');var BPromise=require(_0x3dbb('0x3'));var rp=require(_0x3dbb('0x4'));var fs=require('fs');var path=require(_0x3dbb('0x5'));var rimraf=require(_0x3dbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x3dbb('0x7'));module['exports']=function(_0x5dac77,_0x464258){return _0x5dac77['define']('Tag',attributes,{'tableName':_0x3dbb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b17=['lodash','util','../../config/logger','bluebird','request-promise','./tag.attributes','define','tools_tags'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4b17,0xf0));var _0x74b1=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x4b17[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x74b1('0x0'));var util=require(_0x74b1('0x1'));var logger=require(_0x74b1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x74b1('0x3'));var rp=require(_0x74b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b1('0x5'));module['exports']=function(_0x563ebf,_0x31bdcc){return _0x563ebf[_0x74b1('0x6')]('Tag',attributes,{'tableName':_0x74b1('0x7'),'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 5976f1b..4716327 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 _0x22fb=['Tag,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1af1c0,_0x3d01d6){var _0x380b46=function(_0x1d32cf){while(--_0x1d32cf){_0x1af1c0['push'](_0x1af1c0['shift']());}};_0x380b46(++_0x3d01d6);}(_0x22fb,0x192));var _0xb22f=function(_0x2783a7,_0x238f88){_0x2783a7=_0x2783a7-0x0;var _0x3e287b=_0x22fb[_0x2783a7];return _0x3e287b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('Tag,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x2a3abf,_0xabfc69){var _0x5d0b81=function(_0x1c4824){while(--_0x1c4824){_0x2a3abf['push'](_0x2a3abf['shift']());}};_0x5d0b81(++_0xabfc69);}(_0x4483,0x1a3));var _0x3448=function(_0xcecfe9,_0x228c7f){_0xcecfe9=_0xcecfe9-0x0;var _0x56e925=_0x4483[_0xcecfe9];return _0x56e925;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('Tag,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 772a3c4..7105fcc 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 _0xf717=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','post','create','addQueues','/:id/users','addAgents','put','/:id','destroy','delete','removeQueues','removeAgents','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf717,0x11e));var _0x7f71=function(_0x218312,_0x532982){_0x218312=_0x218312-0x0;var _0x316e47=_0xf717[_0x218312];return _0x316e47;};'use strict';var multer=require(_0x7f71('0x0'));var util=require(_0x7f71('0x1'));var path=require('path');var timeout=require(_0x7f71('0x2'));var express=require('express');var router=express[_0x7f71('0x3')]();var auth=require(_0x7f71('0x4'));var interaction=require(_0x7f71('0x5'));var config=require(_0x7f71('0x6'));var controller=require(_0x7f71('0x7'));router[_0x7f71('0x8')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xa')]);router['get']('/:id',auth[_0x7f71('0x9')](),controller[_0x7f71('0xb')]);router[_0x7f71('0x8')](_0x7f71('0xc'),auth['isAuthenticated'](),controller['getQueues']);router['get']('/:id/users',auth[_0x7f71('0x9')](),controller['getAgents']);router[_0x7f71('0xd')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xe')]);router[_0x7f71('0xd')](_0x7f71('0xc'),auth[_0x7f71('0x9')](),controller[_0x7f71('0xf')]);router[_0x7f71('0xd')](_0x7f71('0x10'),auth[_0x7f71('0x9')](),controller[_0x7f71('0x11')]);router[_0x7f71('0x12')]('/:id',auth[_0x7f71('0x9')](),controller['update']);router['delete'](_0x7f71('0x13'),auth[_0x7f71('0x9')](),controller[_0x7f71('0x14')]);router[_0x7f71('0x15')](_0x7f71('0xc'),auth['isAuthenticated'](),controller[_0x7f71('0x16')]);router[_0x7f71('0x15')](_0x7f71('0x10'),auth[_0x7f71('0x9')](),controller[_0x7f71('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1667=['../../config/environment','get','isAuthenticated','index','/:id','/:id/queues','/:id/users','getAgents','post','addAgents','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x36cbd0,_0x2d6f30){var _0x2bfb09=function(_0x1c9c74){while(--_0x1c9c74){_0x36cbd0['push'](_0x36cbd0['shift']());}};_0x2bfb09(++_0x2d6f30);}(_0x1667,0x18a));var _0x7166=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x1667[_0x190ff6];return _0x5356d2;};'use strict';var multer=require(_0x7166('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7166('0x1'));var express=require(_0x7166('0x2'));var router=express[_0x7166('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7166('0x4'));var config=require(_0x7166('0x5'));var controller=require('./team.controller');router[_0x7166('0x6')]('/',auth[_0x7166('0x7')](),controller[_0x7166('0x8')]);router[_0x7166('0x6')](_0x7166('0x9'),auth[_0x7166('0x7')](),controller['show']);router[_0x7166('0x6')](_0x7166('0xa'),auth['isAuthenticated'](),controller['getQueues']);router['get'](_0x7166('0xb'),auth[_0x7166('0x7')](),controller[_0x7166('0xc')]);router[_0x7166('0xd')]('/',auth[_0x7166('0x7')](),controller['create']);router[_0x7166('0xd')](_0x7166('0xa'),auth[_0x7166('0x7')](),controller['addQueues']);router['post'](_0x7166('0xb'),auth[_0x7166('0x7')](),controller[_0x7166('0xe')]);router[_0x7166('0xf')](_0x7166('0x9'),auth['isAuthenticated'](),controller[_0x7166('0x10')]);router['delete'](_0x7166('0x9'),auth[_0x7166('0x7')](),controller[_0x7166('0x11')]);router['delete'](_0x7166('0xa'),auth[_0x7166('0x7')](),controller['removeQueues']);router['delete'](_0x7166('0xb'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7166('0x12')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index aee191e..41d14dc 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 _0x4302=['exports','STRING'];(function(_0x29a2c1,_0x20d6d1){var _0x5b4f2e=function(_0x341778){while(--_0x341778){_0x29a2c1['push'](_0x29a2c1['shift']());}};_0x5b4f2e(++_0x20d6d1);}(_0x4302,0x112));var _0x2430=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4302[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x2430('0x0')]={'name':{'type':Sequelize[_0x2430('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x97c1=['STRING','name','sequelize','exports'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x97c1,0xae));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'name':{'type':Sequelize[_0x197c('0x2')],'allowNull':![],'unique':_0x197c('0x3')},'description':{'type':Sequelize[_0x197c('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 0db41dc..92f6721 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 _0x3fea=['show','params','find','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','length','add','Queues','ids','removeQueues','remove','Chat','Mail','Sms','Openchannel','each','addAgents','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','omit','spread','emit','userTeam:save','voice','mail','sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','getAgents','User','pick','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Teams','end','error','name','send','index','Team','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x450baf,_0x2c9f1e){_0x450baf=_0x450baf-0x0;var _0x448041=_0x3fea[_0x450baf];return _0x448041;};'use strict';var pdf=require(_0xa3fe('0x0'));var emlformat=require(_0xa3fe('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3fe('0x2'));var rp=require(_0xa3fe('0x3'));var moment=require(_0xa3fe('0x4'));var BPromise=require(_0xa3fe('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa3fe('0x6'));var sox=require('sox');var csv=require(_0xa3fe('0x7'));var ejs=require(_0xa3fe('0x8'));var fs=require('fs');var _=require(_0xa3fe('0x9'));var squel=require(_0xa3fe('0xa'));var crypto=require(_0xa3fe('0xb'));var jsforce=require(_0xa3fe('0xc'));var deskjs=require(_0xa3fe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa3fe('0xe'));var Papa=require(_0xa3fe('0xf'));var Redis=require(_0xa3fe('0x10'));var authService=require(_0xa3fe('0x11'));var qs=require(_0xa3fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3fe('0x13'));var logger=require(_0xa3fe('0x14'))('api');var utils=require(_0xa3fe('0x15'));var config=require(_0xa3fe('0x16'));var db=require(_0xa3fe('0x17'))['db'];config['redis']=_[_0xa3fe('0x18')](config['redis'],{'host':_0xa3fe('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3fe('0x1a')]));require('./team.socket')[_0xa3fe('0x1b')](socket);function respondWithStatusCode(_0x18e180,_0x2fea55){_0x2fea55=_0x2fea55||0xcc;return function(_0x53c516){if(_0x53c516){return _0x18e180[_0xa3fe('0x1c')](_0x2fea55);}return _0x18e180[_0xa3fe('0x1d')](_0x2fea55)['end']();};}function respondWithResult(_0xde7c9,_0x37715e){_0x37715e=_0x37715e||0xc8;return function(_0x5390a4){if(_0x5390a4){return _0xde7c9[_0xa3fe('0x1d')](_0x37715e)[_0xa3fe('0x1e')](_0x5390a4);}};}function respondWithFilteredResult(_0x3f8db3,_0x296c0b){return function(_0x233e3d){if(_0x233e3d){var _0x2ff6a2=_0x233e3d[_0xa3fe('0x1f')],_0x235ed1=_0x296c0b[_0xa3fe('0x20')],_0xa250ca=_0x296c0b[_0xa3fe('0x20')]+_0x296c0b[_0xa3fe('0x21')],_0x1242fc;if(_0xa250ca>=_0x2ff6a2){_0xa250ca=_0x2ff6a2;_0x1242fc=0xc8;}else{_0x1242fc=0xce;}_0x3f8db3[_0xa3fe('0x1d')](_0x1242fc);return _0x3f8db3[_0xa3fe('0x22')](_0xa3fe('0x23'),_0x235ed1+'-'+_0xa250ca+'/'+_0x2ff6a2)['json'](_0x233e3d);}return null;};}function patchUpdates(_0x33e28c){return function(_0x2d7356){try{jsonpatch[_0xa3fe('0x24')](_0x2d7356,_0x33e28c,!![]);}catch(_0x35227c){return BPromise[_0xa3fe('0x25')](_0x35227c);}return _0x2d7356[_0xa3fe('0x26')]();};}function saveUpdates(_0x3a0bd5,_0xb649ed){return function(_0x144bf0){if(_0x144bf0){return _0x144bf0[_0xa3fe('0x27')](_0x3a0bd5)[_0xa3fe('0x28')](function(_0x1a70d7){return _0x1a70d7;});}return null;};}function removeEntity(_0x2d9e50,_0x3b5c55){return function(_0x25a536){if(_0x25a536){return _0x25a536['destroy']()['then'](function(){var _0x1b80bd=_0x25a536[_0xa3fe('0x29')]({'plain':!![]});var _0x23dd23=_0xa3fe('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x23dd23,'resourceId':_0x1b80bd['id']}})[_0xa3fe('0x28')](function(){return _0x25a536;});})[_0xa3fe('0x28')](function(){_0x2d9e50[_0xa3fe('0x1d')](0xcc)[_0xa3fe('0x2b')]();});}};}function handleEntityNotFound(_0x2806df,_0x5ba6ca){return function(_0x572083){if(!_0x572083){_0x2806df['sendStatus'](0x194);}return _0x572083;};}function handleError(_0x2f0242,_0x4507a3){_0x4507a3=_0x4507a3||0x1f4;return function(_0x19747f){logger[_0xa3fe('0x2c')](_0x19747f['stack']);if(_0x19747f[_0xa3fe('0x2d')]){delete _0x19747f[_0xa3fe('0x2d')];}_0x2f0242[_0xa3fe('0x1d')](_0x4507a3)[_0xa3fe('0x2e')](_0x19747f);};}exports[_0xa3fe('0x2f')]=function(_0x2c7e64,_0x30127b){var _0x29c988={},_0x2960c5={},_0x5179cb={'count':0x0,'rows':[]};var _0xcc6984=_['map'](db[_0xa3fe('0x30')]['rawAttributes'],function(_0x27776f){return{'name':_0x27776f['fieldName'],'type':_0x27776f[_0xa3fe('0x31')]['key']};});_0x2960c5[_0xa3fe('0x32')]=_[_0xa3fe('0x33')](_0xcc6984,_0xa3fe('0x2d'));_0x2960c5[_0xa3fe('0x34')]=_[_0xa3fe('0x35')](_0x2c7e64[_0xa3fe('0x34')]);_0x2960c5[_0xa3fe('0x36')]=_[_0xa3fe('0x37')](_0x2960c5[_0xa3fe('0x32')],_0x2960c5['query']);_0x29c988[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x2960c5[_0xa3fe('0x32')],qs[_0xa3fe('0x39')](_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x39')]));_0x29c988[_0xa3fe('0x38')]=_0x29c988[_0xa3fe('0x38')]['length']?_0x29c988[_0xa3fe('0x38')]:_0x2960c5[_0xa3fe('0x32')];if(!_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x3a')](_0xa3fe('0x3b'))){_0x29c988['limit']=qs[_0xa3fe('0x21')](_0x2c7e64[_0xa3fe('0x34')]['limit']);_0x29c988[_0xa3fe('0x20')]=qs[_0xa3fe('0x20')](_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x20')]);}_0x29c988[_0xa3fe('0x3c')]=qs[_0xa3fe('0x3d')](_0x2c7e64[_0xa3fe('0x34')]['sort']);_0x29c988['where']=qs['filters'](_['pick'](_0x2c7e64[_0xa3fe('0x34')],_0x2960c5[_0xa3fe('0x36')]),_0xcc6984);if(_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x3e')]){_0x29c988[_0xa3fe('0x3f')]=_[_0xa3fe('0x40')](_0x29c988[_0xa3fe('0x3f')],{'$or':_[_0xa3fe('0x33')](_0xcc6984,function(_0x1e56ee){if(_0x1e56ee[_0xa3fe('0x31')]!==_0xa3fe('0x41')){var _0x26aeb9={};_0x26aeb9[_0x1e56ee[_0xa3fe('0x2d')]]={'$like':'%'+_0x2c7e64['query'][_0xa3fe('0x3e')]+'%'};return _0x26aeb9;}})});}_0x29c988=_['merge']({},_0x29c988,_0x2c7e64[_0xa3fe('0x42')]);var _0x3a35f4={'where':_0x29c988['where']};return db[_0xa3fe('0x30')][_0xa3fe('0x1f')](_0x3a35f4)[_0xa3fe('0x28')](function(_0x351e1b){_0x5179cb[_0xa3fe('0x1f')]=_0x351e1b;if(_0x2c7e64['query'][_0xa3fe('0x43')]){_0x29c988[_0xa3fe('0x44')]=[{'all':!![]}];}return db[_0xa3fe('0x30')][_0xa3fe('0x45')](_0x29c988);})[_0xa3fe('0x28')](function(_0x49fa16){_0x5179cb[_0xa3fe('0x46')]=_0x49fa16;return _0x5179cb;})[_0xa3fe('0x28')](respondWithFilteredResult(_0x30127b,_0x29c988))[_0xa3fe('0x47')](handleError(_0x30127b,null));};exports[_0xa3fe('0x48')]=function(_0x3dbf95,_0x4fb8ef){var _0x2dcaf8={'raw':![],'where':{'id':_0x3dbf95[_0xa3fe('0x49')]['id']}},_0x2588cd={};_0x2588cd[_0xa3fe('0x32')]=_['keys'](db[_0xa3fe('0x30')]['rawAttributes']);_0x2588cd['query']=_[_0xa3fe('0x35')](_0x3dbf95['query']);_0x2588cd[_0xa3fe('0x36')]=_[_0xa3fe('0x37')](_0x2588cd['model'],_0x2588cd[_0xa3fe('0x34')]);_0x2dcaf8[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x2588cd[_0xa3fe('0x32')],qs[_0xa3fe('0x39')](_0x3dbf95['query']['fields']));_0x2dcaf8[_0xa3fe('0x38')]=_0x2dcaf8[_0xa3fe('0x38')]['length']?_0x2dcaf8['attributes']:_0x2588cd[_0xa3fe('0x32')];if(_0x3dbf95[_0xa3fe('0x34')][_0xa3fe('0x43')]){_0x2dcaf8[_0xa3fe('0x44')]=[{'all':!![]}];}_0x2dcaf8=_[_0xa3fe('0x40')]({},_0x2dcaf8,_0x3dbf95[_0xa3fe('0x42')]);return db[_0xa3fe('0x30')][_0xa3fe('0x4a')](_0x2dcaf8)[_0xa3fe('0x28')](handleEntityNotFound(_0x4fb8ef,null))[_0xa3fe('0x28')](respondWithResult(_0x4fb8ef,null))['catch'](handleError(_0x4fb8ef,null));};exports['create']=function(_0x3799ab,_0x3cbff7){return db[_0xa3fe('0x30')]['create'](_0x3799ab['body'],{})['then'](function(_0x4932ab){var _0x5eeb1a=_0x3799ab[_0xa3fe('0x4b')]['get']({'plain':!![]});if(!_0x5eeb1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eeb1a[_0xa3fe('0x4c')]===_0xa3fe('0x4b')){var _0x5528ec=_0x4932ab['get']({'plain':!![]});var _0x1220c7=_0xa3fe('0x2a');return db['UserProfileSection'][_0xa3fe('0x4a')]({'where':{'name':_0x1220c7,'userProfileId':_0x5eeb1a[_0xa3fe('0x4d')]},'raw':!![]})[_0xa3fe('0x28')](function(_0x3a253b){if(_0x3a253b&&_0x3a253b[_0xa3fe('0x4e')]===0x0){return db['UserProfileResource'][_0xa3fe('0x4f')]({'name':_0x5528ec[_0xa3fe('0x2d')],'resourceId':_0x5528ec['id'],'type':_0x3a253b['name'],'sectionId':_0x3a253b['id']},{})[_0xa3fe('0x28')](function(){return _0x4932ab;});}else{return _0x4932ab;}})['catch'](function(_0x2ea668){logger['error'](_0xa3fe('0x50'),_0x2ea668);throw _0x2ea668;});}return _0x4932ab;})[_0xa3fe('0x28')](respondWithResult(_0x3cbff7,0xc9))['catch'](handleError(_0x3cbff7,null));};exports[_0xa3fe('0x27')]=function(_0x63556,_0x360c28){if(_0x63556[_0xa3fe('0x51')]['id']){delete _0x63556[_0xa3fe('0x51')]['id'];}return db[_0xa3fe('0x30')][_0xa3fe('0x4a')]({'where':{'id':_0x63556['params']['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x360c28,null))['then'](saveUpdates(_0x63556[_0xa3fe('0x51')],null))['then'](respondWithResult(_0x360c28,null))[_0xa3fe('0x47')](handleError(_0x360c28,null));};exports[_0xa3fe('0x52')]=function(_0x540b40,_0x11cdb9){return db['Team'][_0xa3fe('0x4a')]({'where':{'id':_0x540b40[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x11cdb9,null))[_0xa3fe('0x28')](removeEntity(_0x11cdb9,null))[_0xa3fe('0x47')](handleError(_0x11cdb9,null));};exports[_0xa3fe('0x53')]=function(_0xd9af13,_0x5ed00a,_0x2a5e38){return db[_0xa3fe('0x30')][_0xa3fe('0x54')]({'where':{'id':_0xd9af13['params']['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x5ed00a,null))[_0xa3fe('0x28')](function(_0x1b1794){if(!_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x55')]||!utils[_0xa3fe('0x56')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x55')])){throw new db[(_0xa3fe('0x57'))][(_0xa3fe('0x58'))](_0xa3fe('0x59'));}var _0x38b99={};var _0x16fb62={};_0x16fb62['model']=_['keys'](db[_[_0xa3fe('0x5a')](_0xd9af13['query'][_0xa3fe('0x55')][_0xa3fe('0x5b')]())+_0xa3fe('0x5c')][_0xa3fe('0x5d')]);_0x16fb62[_0xa3fe('0x34')]=_[_0xa3fe('0x35')](_0xd9af13[_0xa3fe('0x34')]);_0x16fb62[_0xa3fe('0x36')]=_['intersection'](_0x16fb62[_0xa3fe('0x32')],_0x16fb62[_0xa3fe('0x34')]);_0x38b99[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x16fb62['model'],qs[_0xa3fe('0x39')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x39')]));_0x38b99[_0xa3fe('0x38')]=_0x38b99[_0xa3fe('0x38')][_0xa3fe('0x5e')]?_0x38b99[_0xa3fe('0x38')]:_0x16fb62[_0xa3fe('0x32')];_0x38b99['limit']=qs[_0xa3fe('0x21')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x21')]);_0x38b99[_0xa3fe('0x20')]=qs[_0xa3fe('0x20')](_0xd9af13['query'][_0xa3fe('0x20')]);_0x38b99[_0xa3fe('0x3c')]=qs[_0xa3fe('0x3d')](_0xd9af13[_0xa3fe('0x34')]['sort']);_0x38b99[_0xa3fe('0x3f')]=qs[_0xa3fe('0x36')](_['pick'](_0xd9af13[_0xa3fe('0x34')],_0x16fb62[_0xa3fe('0x36')]));_0x38b99=_['merge']({},_0x38b99,_0xd9af13[_0xa3fe('0x42')]);return _0x1b1794[_0xa3fe('0x29')+_[_0xa3fe('0x5a')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x55')]['toLowerCase']())+'Queues'](_0x38b99);})['then'](respondWithResult(_0x5ed00a,null))[_0xa3fe('0x47')](handleError(_0x5ed00a,null));};exports['addQueues']=function(_0x34e8ee,_0xfb87df,_0x111341){return db['Team'][_0xa3fe('0x54')]({'where':{'id':_0x34e8ee[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](function(_0x275696){if(_0x275696){if(!_0x34e8ee[_0xa3fe('0x51')]['channel']||!utils['isValidChannel'](_0x34e8ee[_0xa3fe('0x51')]['channel'])){throw new db[(_0xa3fe('0x57'))]['ValidationError'](_0xa3fe('0x59'));}return _0x275696[_0xa3fe('0x5f')+_[_0xa3fe('0x5a')](_0x34e8ee[_0xa3fe('0x51')]['channel'][_0xa3fe('0x5b')]())+_0xa3fe('0x60')](_0x34e8ee[_0xa3fe('0x51')][_0xa3fe('0x61')]);}return null;})[_0xa3fe('0x28')](handleEntityNotFound(_0xfb87df,null))[_0xa3fe('0x28')](respondWithStatusCode(_0xfb87df,null))['catch'](handleError(_0xfb87df,null));};exports[_0xa3fe('0x62')]=function(_0x1540dc,_0xb4e956,_0x2f52c3){return db[_0xa3fe('0x30')]['findOne']({'where':{'id':_0x1540dc[_0xa3fe('0x49')]['id']}})['then'](function(_0x2e1b29){if(_0x2e1b29){if(!_0x1540dc[_0xa3fe('0x34')]['channel']||!utils[_0xa3fe('0x56')](_0x1540dc[_0xa3fe('0x34')][_0xa3fe('0x55')])){throw new db[(_0xa3fe('0x57'))][(_0xa3fe('0x58'))](_0xa3fe('0x59'));}return _0x2e1b29[_0xa3fe('0x63')+_[_0xa3fe('0x5a')](_0x1540dc[_0xa3fe('0x34')][_0xa3fe('0x55')]['toLowerCase']())+'Queues'](_0x1540dc['query'][_0xa3fe('0x61')]);}return null;})['then'](handleEntityNotFound(_0xb4e956,null))[_0xa3fe('0x28')](respondWithStatusCode(_0xb4e956,null))[_0xa3fe('0x47')](handleError(_0xb4e956,null));};exports['addAgents']=function(_0xe8033b,_0x16e0f2,_0x39407e){return db[_0xa3fe('0x30')][_0xa3fe('0x4a')]({'where':{'id':_0xe8033b[_0xa3fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x16e0f2,null))[_0xa3fe('0x28')](function(_0x5d6707){if(_0x5d6707){var _0x47111d=['Voice',_0xa3fe('0x64'),_0xa3fe('0x65'),_0xa3fe('0x66'),'Fax',_0xa3fe('0x67'),'Whatsapp'];return BPromise[_0xa3fe('0x68')](_0x47111d,function(_0x290b35){return _0x5d6707[_0xa3fe('0x29')+_0x290b35+_0xa3fe('0x60')]({'attributes':['id','name']})[_0xa3fe('0x28')](function(_0x3c8b24){return BPromise[_0xa3fe('0x68')](_0x3c8b24,function(_0x215b2b){return _0x215b2b[_0xa3fe('0x69')](_0xe8033b[_0xa3fe('0x51')]['ids'])[_0xa3fe('0x28')](function(){if(_0x290b35==='Voice'){return db['User'][_0xa3fe('0x45')]({'where':{'id':_0xe8033b[_0xa3fe('0x51')][_0xa3fe('0x61')]},'attributes':['id','name','online',_0xa3fe('0x6a'),'interface'],'raw':!![]})[_0xa3fe('0x28')](function(_0x361f1e){return BPromise['each'](_['filter'](_0x361f1e,{'online':0x1}),function(_0x5d544f){return db[_0xa3fe('0x6b')][_0xa3fe('0x6c')]({'membername':_0x5d544f[_0xa3fe('0x2d')],'UserId':_0x5d544f['id'],'queue_name':_0x215b2b[_0xa3fe('0x2d')],'VoiceQueueId':_0x215b2b['id'],'interface':_[_0xa3fe('0x6d')](_0x5d544f[_0xa3fe('0x6e')])?util[_0xa3fe('0x6f')](_0xa3fe('0x70'),_0x5d544f[_0xa3fe('0x2d')]):_0x5d544f[_0xa3fe('0x6e')],'paused':_0x5d544f[_0xa3fe('0x6a')]||![],'penalty':0x0});});});}});});})[_0xa3fe('0x28')](function(){return _0x5d6707;});})['then'](function(){return _0x5d6707;});}})[_0xa3fe('0x28')](function(_0x479fc4){if(_0x479fc4){return _0x479fc4[_0xa3fe('0x69')](_0xe8033b['body'][_0xa3fe('0x61')],_[_0xa3fe('0x71')](_0xe8033b[_0xa3fe('0x51')],[_0xa3fe('0x61'),'id'])||{})[_0xa3fe('0x72')](function(_0xddebf2){for(var _0xe18e9b=0x0;_0xe18e9b<_0xe8033b[_0xa3fe('0x51')][_0xa3fe('0x61')]['length'];_0xe18e9b+=0x1){socket[_0xa3fe('0x73')](_0xa3fe('0x74'),{'UserId':_0xe8033b[_0xa3fe('0x51')]['ids'][_0xe18e9b],'TeamId':_0xe8033b['params']['id']});}return _0xddebf2;});}})[_0xa3fe('0x28')](respondWithResult(_0x16e0f2,null))[_0xa3fe('0x47')](handleError(_0x16e0f2,null));};exports['removeAgents']=function(_0xe9774e,_0x44bc7b,_0x1a8c23){return db[_0xa3fe('0x30')][_0xa3fe('0x4a')]({'where':{'id':_0xe9774e[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x44bc7b,null))[_0xa3fe('0x28')](function(_0x258a73){if(_0x258a73){return BPromise[_0xa3fe('0x68')]([_0xa3fe('0x75'),'chat',_0xa3fe('0x76'),_0xa3fe('0x77'),_0xa3fe('0x78'),_0xa3fe('0x79'),_0xa3fe('0x7a')],function(_0x12577f){return _0x258a73[_0xa3fe('0x29')+_['capitalize'](_0x12577f)+_0xa3fe('0x60')]({'attributes':['id',_0xa3fe('0x2d')]})['then'](function(_0xdd2ed1){return BPromise['each'](_0xdd2ed1,function(_0x2933db){return _0x2933db[_0xa3fe('0x7b')](_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')])[_0xa3fe('0x28')](function(){if(_0x12577f===_0xa3fe('0x75')){return db['UserVoiceQueueRt'][_0xa3fe('0x52')]({'where':{'VoiceQueueId':_0x2933db['id'],'UserId':_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')]}});}});});})['then'](function(){return _0x258a73;});})[_0xa3fe('0x28')](function(){return _0x258a73;});}})['then'](function(_0x5b9f52){if(_0x5b9f52){return _0x5b9f52[_0xa3fe('0x7b')](_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')])[_0xa3fe('0x28')](function(){if(_[_0xa3fe('0x7c')](_0xe9774e['query'][_0xa3fe('0x61')])){for(var _0x5207b6=0x0;_0x5207b6<_0xe9774e['query'][_0xa3fe('0x61')][_0xa3fe('0x5e')];_0x5207b6+=0x1){socket[_0xa3fe('0x73')](_0xa3fe('0x7d'),{'UserId':Number(_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')][_0x5207b6]),'TeamId':Number(_0xe9774e['params']['id'])});}}else{socket[_0xa3fe('0x73')]('userTeam:remove',{'UserId':Number(_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')]),'TeamId':Number(_0xe9774e[_0xa3fe('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x44bc7b,null))['catch'](handleError(_0x44bc7b,null));};exports[_0xa3fe('0x7e')]=function(_0x366b37,_0x381ed9,_0x1a6ed3){var _0x5f3f7e={};var _0x341ed3={};var _0x1ea8fc;var _0x270aeb;return db[_0xa3fe('0x30')][_0xa3fe('0x54')]({'where':{'id':_0x366b37[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x381ed9,null))[_0xa3fe('0x28')](function(_0x470b76){if(_0x470b76){_0x1ea8fc=_0x470b76;_0x341ed3[_0xa3fe('0x32')]=_['keys'](db[_0xa3fe('0x7f')][_0xa3fe('0x5d')]);_0x341ed3[_0xa3fe('0x34')]=_[_0xa3fe('0x35')](_0x366b37[_0xa3fe('0x34')]);_0x341ed3[_0xa3fe('0x36')]=_[_0xa3fe('0x37')](_0x341ed3['model'],_0x341ed3[_0xa3fe('0x34')]);_0x5f3f7e[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x341ed3[_0xa3fe('0x32')],qs[_0xa3fe('0x39')](_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x39')]));_0x5f3f7e[_0xa3fe('0x38')]=_0x5f3f7e[_0xa3fe('0x38')][_0xa3fe('0x5e')]?_0x5f3f7e[_0xa3fe('0x38')]:_0x341ed3[_0xa3fe('0x32')];_0x5f3f7e[_0xa3fe('0x3c')]=qs[_0xa3fe('0x3d')](_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x3d')]);_0x5f3f7e[_0xa3fe('0x3f')]=qs[_0xa3fe('0x36')](_[_0xa3fe('0x80')](_0x366b37[_0xa3fe('0x34')],_0x341ed3[_0xa3fe('0x36')]));if(_0x366b37['query'][_0xa3fe('0x3e')]){_0x5f3f7e[_0xa3fe('0x3f')]=_[_0xa3fe('0x40')](_0x5f3f7e[_0xa3fe('0x3f')],{'$or':_[_0xa3fe('0x33')](_0x5f3f7e['attributes'],function(_0x3d8ff7){var _0x45e8dd={};_0x45e8dd[_0x3d8ff7]={'$like':'%'+_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x3e')]+'%'};return _0x45e8dd;})});}_0x5f3f7e=_[_0xa3fe('0x40')]({},_0x5f3f7e,_0x366b37[_0xa3fe('0x42')]);return _0x1ea8fc['getAgents'](_0x5f3f7e);}})[_0xa3fe('0x28')](function(_0x106756){if(_0x106756){_0x270aeb=_0x106756[_0xa3fe('0x5e')];if(!_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x3a')](_0xa3fe('0x3b'))){_0x5f3f7e[_0xa3fe('0x21')]=qs[_0xa3fe('0x21')](_0x366b37['query'][_0xa3fe('0x21')]);_0x5f3f7e[_0xa3fe('0x20')]=qs[_0xa3fe('0x20')](_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x20')]);}return _0x1ea8fc[_0xa3fe('0x7e')](_0x5f3f7e);}})[_0xa3fe('0x28')](function(_0x534f65){if(_0x534f65){return _0x534f65?{'count':_0x270aeb,'rows':_0x534f65}:null;}})['then'](respondWithResult(_0x381ed9,null))[_0xa3fe('0x47')](handleError(_0x381ed9,null));}; \ No newline at end of file +var _0x8de8=['Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','ValidationError','add','ids','removeQueues','addAgents','Voice','Mail','Fax','Openchannel','Whatsapp','each','User','findAll','online','voicePause','format','interface','omit','userTeam:save','voice','chat','mail','openchannel','removeAgents','UserVoiceQueueRt','isArray','emit','userTeam:remove','getAgents','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','Teams','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','body','getQueues','findOne','isValidChannel','channel','Sequelize'];(function(_0x52c9f2,_0x202a11){var _0x535949=function(_0x2d77e2){while(--_0x2d77e2){_0x52c9f2['push'](_0x52c9f2['shift']());}};_0x535949(++_0x202a11);}(_0x8de8,0x19d));var _0x88de=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8de8[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x88de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88de('0x1'));var zipdir=require(_0x88de('0x2'));var jsonpatch=require(_0x88de('0x3'));var rp=require('request-promise');var moment=require(_0x88de('0x4'));var BPromise=require(_0x88de('0x5'));var Mustache=require(_0x88de('0x6'));var util=require(_0x88de('0x7'));var path=require(_0x88de('0x8'));var sox=require(_0x88de('0x9'));var csv=require('to-csv');var ejs=require(_0x88de('0xa'));var fs=require('fs');var _=require(_0x88de('0xb'));var squel=require('squel');var crypto=require(_0x88de('0xc'));var jsforce=require(_0x88de('0xd'));var deskjs=require(_0x88de('0xe'));var toCsv=require('to-csv');var querystring=require(_0x88de('0xf'));var Papa=require('papaparse');var Redis=require(_0x88de('0x10'));var authService=require(_0x88de('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x88de('0x12'));var hardwareService=require(_0x88de('0x13'));var logger=require(_0x88de('0x14'))(_0x88de('0x15'));var utils=require(_0x88de('0x16'));var config=require(_0x88de('0x17'));var db=require(_0x88de('0x18'))['db'];config[_0x88de('0x19')]=_[_0x88de('0x1a')](config[_0x88de('0x19')],{'host':_0x88de('0x1b'),'port':0x18eb});var socket=require(_0x88de('0x1c'))(new Redis(config[_0x88de('0x19')]));require(_0x88de('0x1d'))[_0x88de('0x1e')](socket);function respondWithStatusCode(_0x16465f,_0x3ec5e4){_0x3ec5e4=_0x3ec5e4||0xcc;return function(_0x22228b){if(_0x22228b){return _0x16465f['sendStatus'](_0x3ec5e4);}return _0x16465f[_0x88de('0x1f')](_0x3ec5e4)[_0x88de('0x20')]();};}function respondWithResult(_0x466a93,_0x140783){_0x140783=_0x140783||0xc8;return function(_0x124c6e){if(_0x124c6e){return _0x466a93[_0x88de('0x1f')](_0x140783)[_0x88de('0x21')](_0x124c6e);}};}function respondWithFilteredResult(_0x2dd26c,_0x4ff159){return function(_0x3611d0){if(_0x3611d0){var _0x24a23c=_0x3611d0[_0x88de('0x22')],_0x4deccf=_0x4ff159[_0x88de('0x23')],_0x12a02d=_0x4ff159[_0x88de('0x23')]+_0x4ff159[_0x88de('0x24')],_0x17628c;if(_0x12a02d>=_0x24a23c){_0x12a02d=_0x24a23c;_0x17628c=0xc8;}else{_0x17628c=0xce;}_0x2dd26c[_0x88de('0x1f')](_0x17628c);return _0x2dd26c[_0x88de('0x25')]('Content-Range',_0x4deccf+'-'+_0x12a02d+'/'+_0x24a23c)[_0x88de('0x21')](_0x3611d0);}return null;};}function patchUpdates(_0x390837){return function(_0x178ac6){try{jsonpatch[_0x88de('0x26')](_0x178ac6,_0x390837,!![]);}catch(_0x4c2240){return BPromise[_0x88de('0x27')](_0x4c2240);}return _0x178ac6['save']();};}function saveUpdates(_0x45f986,_0xce9744){return function(_0x220800){if(_0x220800){return _0x220800[_0x88de('0x28')](_0x45f986)[_0x88de('0x29')](function(_0x39fb5a){return _0x39fb5a;});}return null;};}function removeEntity(_0x1a850b,_0x2020c4){return function(_0x1d031e){if(_0x1d031e){return _0x1d031e[_0x88de('0x2a')]()[_0x88de('0x29')](function(){var _0x10b032=_0x1d031e[_0x88de('0x2b')]({'plain':!![]});var _0x5c5511=_0x88de('0x2c');return db['UserProfileResource'][_0x88de('0x2a')]({'where':{'type':_0x5c5511,'resourceId':_0x10b032['id']}})[_0x88de('0x29')](function(){return _0x1d031e;});})['then'](function(){_0x1a850b[_0x88de('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255e3f,_0x575399){return function(_0xf271f3){if(!_0xf271f3){_0x255e3f['sendStatus'](0x194);}return _0xf271f3;};}function handleError(_0x151269,_0x1def88){_0x1def88=_0x1def88||0x1f4;return function(_0x5c86f4){logger[_0x88de('0x2d')](_0x5c86f4[_0x88de('0x2e')]);if(_0x5c86f4[_0x88de('0x2f')]){delete _0x5c86f4['name'];}_0x151269['status'](_0x1def88)[_0x88de('0x30')](_0x5c86f4);};}exports[_0x88de('0x31')]=function(_0x260201,_0xbb5c88){var _0x142a9={},_0x3782ea={},_0x2f65d0={'count':0x0,'rows':[]};var _0x498b78=_[_0x88de('0x32')](db[_0x88de('0x33')][_0x88de('0x34')],function(_0xbc31c7){return{'name':_0xbc31c7[_0x88de('0x35')],'type':_0xbc31c7[_0x88de('0x36')][_0x88de('0x37')]};});_0x3782ea[_0x88de('0x38')]=_['map'](_0x498b78,_0x88de('0x2f'));_0x3782ea[_0x88de('0x39')]=_[_0x88de('0x3a')](_0x260201[_0x88de('0x39')]);_0x3782ea['filters']=_[_0x88de('0x3b')](_0x3782ea[_0x88de('0x38')],_0x3782ea['query']);_0x142a9[_0x88de('0x3c')]=_[_0x88de('0x3b')](_0x3782ea[_0x88de('0x38')],qs[_0x88de('0x3d')](_0x260201[_0x88de('0x39')]['fields']));_0x142a9[_0x88de('0x3c')]=_0x142a9[_0x88de('0x3c')][_0x88de('0x3e')]?_0x142a9['attributes']:_0x3782ea[_0x88de('0x38')];if(!_0x260201[_0x88de('0x39')]['hasOwnProperty']('nolimit')){_0x142a9[_0x88de('0x24')]=qs[_0x88de('0x24')](_0x260201[_0x88de('0x39')][_0x88de('0x24')]);_0x142a9[_0x88de('0x23')]=qs[_0x88de('0x23')](_0x260201[_0x88de('0x39')]['offset']);}_0x142a9[_0x88de('0x3f')]=qs[_0x88de('0x40')](_0x260201[_0x88de('0x39')][_0x88de('0x40')]);_0x142a9[_0x88de('0x41')]=qs[_0x88de('0x42')](_[_0x88de('0x43')](_0x260201['query'],_0x3782ea[_0x88de('0x42')]),_0x498b78);if(_0x260201[_0x88de('0x39')][_0x88de('0x44')]){_0x142a9[_0x88de('0x41')]=_['merge'](_0x142a9[_0x88de('0x41')],{'$or':_[_0x88de('0x32')](_0x498b78,function(_0x4f1155){if(_0x4f1155[_0x88de('0x36')]!==_0x88de('0x45')){var _0x5d5b09={};_0x5d5b09[_0x4f1155[_0x88de('0x2f')]]={'$like':'%'+_0x260201['query']['filter']+'%'};return _0x5d5b09;}})});}_0x142a9=_[_0x88de('0x46')]({},_0x142a9,_0x260201[_0x88de('0x47')]);var _0x29dda8={'where':_0x142a9[_0x88de('0x41')]};return db['Team']['count'](_0x29dda8)[_0x88de('0x29')](function(_0x5bbe40){_0x2f65d0['count']=_0x5bbe40;if(_0x260201[_0x88de('0x39')][_0x88de('0x48')]){_0x142a9[_0x88de('0x49')]=[{'all':!![]}];}return db[_0x88de('0x33')]['findAll'](_0x142a9);})[_0x88de('0x29')](function(_0x56adda){_0x2f65d0[_0x88de('0x4a')]=_0x56adda;return _0x2f65d0;})[_0x88de('0x29')](respondWithFilteredResult(_0xbb5c88,_0x142a9))[_0x88de('0x4b')](handleError(_0xbb5c88,null));};exports['show']=function(_0x458238,_0x5bead5){var _0x256c56={'raw':![],'where':{'id':_0x458238[_0x88de('0x4c')]['id']}},_0xa8179f={};_0xa8179f[_0x88de('0x38')]=_[_0x88de('0x3a')](db[_0x88de('0x33')][_0x88de('0x34')]);_0xa8179f[_0x88de('0x39')]=_[_0x88de('0x3a')](_0x458238['query']);_0xa8179f[_0x88de('0x42')]=_[_0x88de('0x3b')](_0xa8179f[_0x88de('0x38')],_0xa8179f[_0x88de('0x39')]);_0x256c56[_0x88de('0x3c')]=_['intersection'](_0xa8179f[_0x88de('0x38')],qs[_0x88de('0x3d')](_0x458238['query'][_0x88de('0x3d')]));_0x256c56['attributes']=_0x256c56['attributes'][_0x88de('0x3e')]?_0x256c56[_0x88de('0x3c')]:_0xa8179f[_0x88de('0x38')];if(_0x458238[_0x88de('0x39')]['includeAll']){_0x256c56['include']=[{'all':!![]}];}_0x256c56=_['merge']({},_0x256c56,_0x458238[_0x88de('0x47')]);return db[_0x88de('0x33')][_0x88de('0x4d')](_0x256c56)['then'](handleEntityNotFound(_0x5bead5,null))[_0x88de('0x29')](respondWithResult(_0x5bead5,null))['catch'](handleError(_0x5bead5,null));};exports[_0x88de('0x4e')]=function(_0xbb7042,_0x1a0a3d){return db[_0x88de('0x33')][_0x88de('0x4e')](_0xbb7042['body'],{})[_0x88de('0x29')](function(_0x24a3df){var _0x591263=_0xbb7042['user'][_0x88de('0x2b')]({'plain':!![]});if(!_0x591263)throw new Error(_0x88de('0x4f'));if(_0x591263[_0x88de('0x50')]===_0x88de('0x51')){var _0x974fb4=_0x24a3df['get']({'plain':!![]});var _0x138542=_0x88de('0x2c');return db[_0x88de('0x52')][_0x88de('0x4d')]({'where':{'name':_0x138542,'userProfileId':_0x591263['userProfileId']},'raw':!![]})[_0x88de('0x29')](function(_0x2afc9e){if(_0x2afc9e&&_0x2afc9e[_0x88de('0x53')]===0x0){return db[_0x88de('0x54')]['create']({'name':_0x974fb4['name'],'resourceId':_0x974fb4['id'],'type':_0x2afc9e[_0x88de('0x2f')],'sectionId':_0x2afc9e['id']},{})[_0x88de('0x29')](function(){return _0x24a3df;});}else{return _0x24a3df;}})[_0x88de('0x4b')](function(_0x2862b8){logger[_0x88de('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2862b8);throw _0x2862b8;});}return _0x24a3df;})[_0x88de('0x29')](respondWithResult(_0x1a0a3d,0xc9))[_0x88de('0x4b')](handleError(_0x1a0a3d,null));};exports[_0x88de('0x28')]=function(_0x1ee9a5,_0x4a64af){if(_0x1ee9a5[_0x88de('0x55')]['id']){delete _0x1ee9a5['body']['id'];}return db['Team'][_0x88de('0x4d')]({'where':{'id':_0x1ee9a5[_0x88de('0x4c')]['id']}})[_0x88de('0x29')](handleEntityNotFound(_0x4a64af,null))['then'](saveUpdates(_0x1ee9a5[_0x88de('0x55')],null))['then'](respondWithResult(_0x4a64af,null))[_0x88de('0x4b')](handleError(_0x4a64af,null));};exports[_0x88de('0x2a')]=function(_0xe78463,_0x5a5f0c){return db[_0x88de('0x33')][_0x88de('0x4d')]({'where':{'id':_0xe78463[_0x88de('0x4c')]['id']}})[_0x88de('0x29')](handleEntityNotFound(_0x5a5f0c,null))[_0x88de('0x29')](removeEntity(_0x5a5f0c,null))[_0x88de('0x4b')](handleError(_0x5a5f0c,null));};exports[_0x88de('0x56')]=function(_0x3ea9f9,_0x4ec0c4,_0x35e626){return db['Team'][_0x88de('0x57')]({'where':{'id':_0x3ea9f9['params']['id']}})[_0x88de('0x29')](handleEntityNotFound(_0x4ec0c4,null))['then'](function(_0x81dce3){if(!_0x3ea9f9[_0x88de('0x39')]['channel']||!utils[_0x88de('0x58')](_0x3ea9f9[_0x88de('0x39')][_0x88de('0x59')])){throw new db[(_0x88de('0x5a'))]['ValidationError'](_0x88de('0x5b'));}var _0x335c50={};var _0x442759={};_0x442759[_0x88de('0x38')]=_['keys'](db[_[_0x88de('0x5c')](_0x3ea9f9['query'][_0x88de('0x59')][_0x88de('0x5d')]())+'Queue'][_0x88de('0x34')]);_0x442759[_0x88de('0x39')]=_[_0x88de('0x3a')](_0x3ea9f9[_0x88de('0x39')]);_0x442759[_0x88de('0x42')]=_[_0x88de('0x3b')](_0x442759[_0x88de('0x38')],_0x442759[_0x88de('0x39')]);_0x335c50[_0x88de('0x3c')]=_['intersection'](_0x442759[_0x88de('0x38')],qs[_0x88de('0x3d')](_0x3ea9f9['query'][_0x88de('0x3d')]));_0x335c50['attributes']=_0x335c50[_0x88de('0x3c')][_0x88de('0x3e')]?_0x335c50[_0x88de('0x3c')]:_0x442759[_0x88de('0x38')];_0x335c50[_0x88de('0x24')]=qs[_0x88de('0x24')](_0x3ea9f9[_0x88de('0x39')][_0x88de('0x24')]);_0x335c50['offset']=qs['offset'](_0x3ea9f9[_0x88de('0x39')][_0x88de('0x23')]);_0x335c50[_0x88de('0x3f')]=qs[_0x88de('0x40')](_0x3ea9f9[_0x88de('0x39')][_0x88de('0x40')]);_0x335c50[_0x88de('0x41')]=qs[_0x88de('0x42')](_['pick'](_0x3ea9f9[_0x88de('0x39')],_0x442759[_0x88de('0x42')]));_0x335c50=_[_0x88de('0x46')]({},_0x335c50,_0x3ea9f9[_0x88de('0x47')]);return _0x81dce3[_0x88de('0x2b')+_[_0x88de('0x5c')](_0x3ea9f9['query']['channel']['toLowerCase']())+_0x88de('0x5e')](_0x335c50);})['then'](respondWithResult(_0x4ec0c4,null))[_0x88de('0x4b')](handleError(_0x4ec0c4,null));};exports[_0x88de('0x5f')]=function(_0x5cfe91,_0x2250d9,_0x18f146){return db[_0x88de('0x33')]['findOne']({'where':{'id':_0x5cfe91[_0x88de('0x4c')]['id']}})[_0x88de('0x29')](function(_0x4f7f6f){if(_0x4f7f6f){if(!_0x5cfe91[_0x88de('0x55')][_0x88de('0x59')]||!utils[_0x88de('0x58')](_0x5cfe91[_0x88de('0x55')][_0x88de('0x59')])){throw new db[(_0x88de('0x5a'))][(_0x88de('0x60'))](_0x88de('0x5b'));}return _0x4f7f6f[_0x88de('0x61')+_[_0x88de('0x5c')](_0x5cfe91[_0x88de('0x55')][_0x88de('0x59')][_0x88de('0x5d')]())+_0x88de('0x5e')](_0x5cfe91['body'][_0x88de('0x62')]);}return null;})[_0x88de('0x29')](handleEntityNotFound(_0x2250d9,null))[_0x88de('0x29')](respondWithStatusCode(_0x2250d9,null))[_0x88de('0x4b')](handleError(_0x2250d9,null));};exports[_0x88de('0x63')]=function(_0x3a1136,_0x3f228d,_0x4d8641){return db[_0x88de('0x33')][_0x88de('0x57')]({'where':{'id':_0x3a1136[_0x88de('0x4c')]['id']}})[_0x88de('0x29')](function(_0x1a12de){if(_0x1a12de){if(!_0x3a1136[_0x88de('0x39')]['channel']||!utils['isValidChannel'](_0x3a1136['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0x88de('0x5b'));}return _0x1a12de['remove'+_[_0x88de('0x5c')](_0x3a1136['query'][_0x88de('0x59')]['toLowerCase']())+_0x88de('0x5e')](_0x3a1136[_0x88de('0x39')][_0x88de('0x62')]);}return null;})[_0x88de('0x29')](handleEntityNotFound(_0x3f228d,null))[_0x88de('0x29')](respondWithStatusCode(_0x3f228d,null))[_0x88de('0x4b')](handleError(_0x3f228d,null));};exports[_0x88de('0x64')]=function(_0x389a3f,_0x49dd3c,_0x47a4e7){return db[_0x88de('0x33')]['find']({'where':{'id':_0x389a3f[_0x88de('0x4c')]['id']}})[_0x88de('0x29')](handleEntityNotFound(_0x49dd3c,null))[_0x88de('0x29')](function(_0x439bfa){if(_0x439bfa){var _0x1432e6=[_0x88de('0x65'),'Chat',_0x88de('0x66'),'Sms',_0x88de('0x67'),_0x88de('0x68'),_0x88de('0x69')];return BPromise[_0x88de('0x6a')](_0x1432e6,function(_0x4ea124){return _0x439bfa[_0x88de('0x2b')+_0x4ea124+_0x88de('0x5e')]({'attributes':['id',_0x88de('0x2f')]})['then'](function(_0x49e051){return BPromise['each'](_0x49e051,function(_0x58d16e){return _0x58d16e['addAgents'](_0x389a3f[_0x88de('0x55')][_0x88de('0x62')])[_0x88de('0x29')](function(){if(_0x4ea124===_0x88de('0x65')){return db[_0x88de('0x6b')][_0x88de('0x6c')]({'where':{'id':_0x389a3f['body'][_0x88de('0x62')]},'attributes':['id',_0x88de('0x2f'),_0x88de('0x6d'),_0x88de('0x6e'),'interface'],'raw':!![]})['then'](function(_0x271e60){return BPromise['each'](_[_0x88de('0x44')](_0x271e60,{'online':0x1}),function(_0x10491c){return db['UserVoiceQueueRt']['upsert']({'membername':_0x10491c['name'],'UserId':_0x10491c['id'],'queue_name':_0x58d16e[_0x88de('0x2f')],'VoiceQueueId':_0x58d16e['id'],'interface':_['isNil'](_0x10491c['interface'])?util[_0x88de('0x6f')]('SIP/%s',_0x10491c[_0x88de('0x2f')]):_0x10491c[_0x88de('0x70')],'paused':_0x10491c[_0x88de('0x6e')]||![],'penalty':0x0});});});}});});})[_0x88de('0x29')](function(){return _0x439bfa;});})[_0x88de('0x29')](function(){return _0x439bfa;});}})[_0x88de('0x29')](function(_0x14769f){if(_0x14769f){return _0x14769f[_0x88de('0x64')](_0x389a3f[_0x88de('0x55')]['ids'],_[_0x88de('0x71')](_0x389a3f[_0x88de('0x55')],[_0x88de('0x62'),'id'])||{})['spread'](function(_0x212766){for(var _0x4c5cfd=0x0;_0x4c5cfd<_0x389a3f[_0x88de('0x55')][_0x88de('0x62')]['length'];_0x4c5cfd+=0x1){socket['emit'](_0x88de('0x72'),{'UserId':_0x389a3f[_0x88de('0x55')]['ids'][_0x4c5cfd],'TeamId':_0x389a3f[_0x88de('0x4c')]['id']});}return _0x212766;});}})['then'](respondWithResult(_0x49dd3c,null))[_0x88de('0x4b')](handleError(_0x49dd3c,null));};exports['removeAgents']=function(_0x5ea882,_0x416c1a,_0xe7e730){return db[_0x88de('0x33')][_0x88de('0x4d')]({'where':{'id':_0x5ea882['params']['id']}})[_0x88de('0x29')](handleEntityNotFound(_0x416c1a,null))[_0x88de('0x29')](function(_0x4258ab){if(_0x4258ab){return BPromise[_0x88de('0x6a')]([_0x88de('0x73'),_0x88de('0x74'),_0x88de('0x75'),'sms','fax',_0x88de('0x76'),'whatsapp'],function(_0x52ad11){return _0x4258ab['get'+_['capitalize'](_0x52ad11)+'Queues']({'attributes':['id',_0x88de('0x2f')]})[_0x88de('0x29')](function(_0x528a78){return BPromise[_0x88de('0x6a')](_0x528a78,function(_0x1ec47e){return _0x1ec47e[_0x88de('0x77')](_0x5ea882[_0x88de('0x39')][_0x88de('0x62')])[_0x88de('0x29')](function(){if(_0x52ad11===_0x88de('0x73')){return db[_0x88de('0x78')][_0x88de('0x2a')]({'where':{'VoiceQueueId':_0x1ec47e['id'],'UserId':_0x5ea882['query'][_0x88de('0x62')]}});}});});})['then'](function(){return _0x4258ab;});})[_0x88de('0x29')](function(){return _0x4258ab;});}})[_0x88de('0x29')](function(_0x813922){if(_0x813922){return _0x813922[_0x88de('0x77')](_0x5ea882[_0x88de('0x39')][_0x88de('0x62')])[_0x88de('0x29')](function(){if(_[_0x88de('0x79')](_0x5ea882[_0x88de('0x39')]['ids'])){for(var _0x4e9388=0x0;_0x4e9388<_0x5ea882[_0x88de('0x39')]['ids'][_0x88de('0x3e')];_0x4e9388+=0x1){socket[_0x88de('0x7a')](_0x88de('0x7b'),{'UserId':Number(_0x5ea882[_0x88de('0x39')][_0x88de('0x62')][_0x4e9388]),'TeamId':Number(_0x5ea882[_0x88de('0x4c')]['id'])});}}else{socket[_0x88de('0x7a')]('userTeam:remove',{'UserId':Number(_0x5ea882[_0x88de('0x39')][_0x88de('0x62')]),'TeamId':Number(_0x5ea882[_0x88de('0x4c')]['id'])});}});}})[_0x88de('0x29')](respondWithStatusCode(_0x416c1a,null))[_0x88de('0x4b')](handleError(_0x416c1a,null));};exports[_0x88de('0x7c')]=function(_0x4e4505,_0x46c2e5,_0x1bd0f5){var _0x4fbd4c={};var _0x497e1f={};var _0x3886fb;var _0x1e4831;return db['Team'][_0x88de('0x57')]({'where':{'id':_0x4e4505[_0x88de('0x4c')]['id']}})[_0x88de('0x29')](handleEntityNotFound(_0x46c2e5,null))[_0x88de('0x29')](function(_0x14d582){if(_0x14d582){_0x3886fb=_0x14d582;_0x497e1f[_0x88de('0x38')]=_[_0x88de('0x3a')](db[_0x88de('0x6b')]['rawAttributes']);_0x497e1f['query']=_['keys'](_0x4e4505[_0x88de('0x39')]);_0x497e1f[_0x88de('0x42')]=_[_0x88de('0x3b')](_0x497e1f[_0x88de('0x38')],_0x497e1f['query']);_0x4fbd4c[_0x88de('0x3c')]=_['intersection'](_0x497e1f[_0x88de('0x38')],qs[_0x88de('0x3d')](_0x4e4505['query'][_0x88de('0x3d')]));_0x4fbd4c[_0x88de('0x3c')]=_0x4fbd4c[_0x88de('0x3c')][_0x88de('0x3e')]?_0x4fbd4c[_0x88de('0x3c')]:_0x497e1f['model'];_0x4fbd4c[_0x88de('0x3f')]=qs[_0x88de('0x40')](_0x4e4505['query'][_0x88de('0x40')]);_0x4fbd4c[_0x88de('0x41')]=qs['filters'](_[_0x88de('0x43')](_0x4e4505[_0x88de('0x39')],_0x497e1f[_0x88de('0x42')]));if(_0x4e4505[_0x88de('0x39')][_0x88de('0x44')]){_0x4fbd4c[_0x88de('0x41')]=_[_0x88de('0x46')](_0x4fbd4c[_0x88de('0x41')],{'$or':_[_0x88de('0x32')](_0x4fbd4c[_0x88de('0x3c')],function(_0x2f5be3){var _0x41450e={};_0x41450e[_0x2f5be3]={'$like':'%'+_0x4e4505['query'][_0x88de('0x44')]+'%'};return _0x41450e;})});}_0x4fbd4c=_[_0x88de('0x46')]({},_0x4fbd4c,_0x4e4505[_0x88de('0x47')]);return _0x3886fb['getAgents'](_0x4fbd4c);}})['then'](function(_0x476313){if(_0x476313){_0x1e4831=_0x476313[_0x88de('0x3e')];if(!_0x4e4505[_0x88de('0x39')]['hasOwnProperty'](_0x88de('0x7d'))){_0x4fbd4c[_0x88de('0x24')]=qs[_0x88de('0x24')](_0x4e4505[_0x88de('0x39')][_0x88de('0x24')]);_0x4fbd4c[_0x88de('0x23')]=qs[_0x88de('0x23')](_0x4e4505[_0x88de('0x39')][_0x88de('0x23')]);}return _0x3886fb[_0x88de('0x7c')](_0x4fbd4c);}})[_0x88de('0x29')](function(_0x461cb2){if(_0x461cb2){return _0x461cb2?{'count':_0x1e4831,'rows':_0x461cb2}:null;}})[_0x88de('0x29')](respondWithResult(_0x46c2e5,null))[_0x88de('0x4b')](handleError(_0x46c2e5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7d6499b..5352665 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 _0xe6dc=['hook','exports','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x9d2ae9,_0xe43b7e){var _0x356d6f=function(_0x2c32cf){while(--_0x2c32cf){_0x9d2ae9['push'](_0x9d2ae9['shift']());}};_0x356d6f(++_0xe43b7e);}(_0xe6dc,0xbf));var _0xce6d=function(_0x2538ea,_0x2b06ab){_0x2538ea=_0x2538ea-0x0;var _0x861643=_0xe6dc[_0x2538ea];return _0x861643;};'use strict';var EventEmitter=require('events');var Team=require(_0xce6d('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xce6d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xce6d('0x2')};function emitEvent(_0x2b9ed0){return function(_0x38ccaf,_0x32b09d,_0x2c64da){TeamEvents[_0xce6d('0x3')](_0x2b9ed0+':'+_0x38ccaf['id'],_0x38ccaf);TeamEvents[_0xce6d('0x3')](_0x2b9ed0,_0x38ccaf);_0x2c64da(null);};}for(var e in events){if(events[_0xce6d('0x4')](e)){var event=events[e];Team[_0xce6d('0x5')](e,emitEvent(event));}}module[_0xce6d('0x6')]=TeamEvents; \ No newline at end of file +var _0x7f6e=['events','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x190b51,_0x5b3786){var _0x91beb9=function(_0x35400e){while(--_0x35400e){_0x190b51['push'](_0x190b51['shift']());}};_0x91beb9(++_0x5b3786);}(_0x7f6e,0xb4));var _0xe7f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x7f6e[_0x31e29a];return _0x32d892;};'use strict';var EventEmitter=require(_0xe7f6('0x0'));var Team=require('../../mysqldb')['db'][_0xe7f6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xe7f6('0x2')](0x0);var events={'afterCreate':_0xe7f6('0x3'),'afterUpdate':_0xe7f6('0x4'),'afterDestroy':_0xe7f6('0x5')};function emitEvent(_0x27cb5b){return function(_0x2838fd,_0x148926,_0x145365){TeamEvents[_0xe7f6('0x6')](_0x27cb5b+':'+_0x2838fd['id'],_0x2838fd);TeamEvents['emit'](_0x27cb5b,_0x2838fd);_0x145365(null);};}for(var e in events){if(events[_0xe7f6('0x7')](e)){var event=events[e];Team[_0xe7f6('0x8')](e,emitEvent(event));}}module[_0xe7f6('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7d36d3b..45067c5 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 _0x7595=['teams','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Team'];(function(_0x4c22ab,_0x16b105){var _0x28a653=function(_0x461fc9){while(--_0x461fc9){_0x4c22ab['push'](_0x4c22ab['shift']());}};_0x28a653(++_0x16b105);}(_0x7595,0x64));var _0x5759=function(_0x41c088,_0x155e0f){_0x41c088=_0x41c088-0x0;var _0x273b77=_0x7595[_0x41c088];return _0x273b77;};'use strict';var _=require('lodash');var util=require(_0x5759('0x0'));var logger=require(_0x5759('0x1'))(_0x5759('0x2'));var moment=require('moment');var BPromise=require(_0x5759('0x3'));var rp=require(_0x5759('0x4'));var fs=require('fs');var path=require(_0x5759('0x5'));var rimraf=require(_0x5759('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x5759('0x7')]=function(_0x273cf9,_0xc2c7fc){return _0x273cf9[_0x5759('0x8')](_0x5759('0x9'),attributes,{'tableName':_0x5759('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a2=['request-promise','path','rimraf','../../config/environment','exports','Team','lodash','api','moment','bluebird'];(function(_0x4c16cf,_0x311772){var _0x1ac4ae=function(_0x22d19a){while(--_0x22d19a){_0x4c16cf['push'](_0x4c16cf['shift']());}};_0x1ac4ae(++_0x311772);}(_0xc2a2,0x100));var _0x2c2a=function(_0x13d337,_0x51bee4){_0x13d337=_0x13d337-0x0;var _0x26ecbb=_0xc2a2[_0x13d337];return _0x26ecbb;};'use strict';var _=require(_0x2c2a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c2a('0x1'));var moment=require(_0x2c2a('0x2'));var BPromise=require(_0x2c2a('0x3'));var rp=require(_0x2c2a('0x4'));var fs=require('fs');var path=require(_0x2c2a('0x5'));var rimraf=require(_0x2c2a('0x6'));var config=require(_0x2c2a('0x7'));var attributes=require('./team.attributes');module[_0x2c2a('0x8')]=function(_0x34ae0b,_0x47c92e){return _0x34ae0b['define'](_0x2c2a('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9652ae5..de48b2f 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 _0x2eff=['info','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message'];(function(_0x1a243c,_0x455768){var _0x147800=function(_0x4346f5){while(--_0x4346f5){_0x1a243c['push'](_0x1a243c['shift']());}};_0x147800(++_0x455768);}(_0x2eff,0x76));var _0xf2ef=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0x2eff[_0x16e824];return _0x1745ea;};'use strict';var _=require(_0xf2ef('0x0'));var util=require(_0xf2ef('0x1'));var moment=require(_0xf2ef('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf2ef('0x5'));var config=require(_0xf2ef('0x6'));var jayson=require(_0xf2ef('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf2ef('0x8')]=_[_0xf2ef('0x9')](config['redis'],{'host':_0xf2ef('0xa'),'port':0x18eb});var socket=require(_0xf2ef('0xb'))(new Redis(config[_0xf2ef('0x8')]));require('./team.socket')[_0xf2ef('0xc')](socket);function respondWithRpcPromise(_0x4fdff9,_0x3359ed,_0x22336f){return new BPromise(function(_0x1ad5b9,_0x45e341){return client[_0xf2ef('0xd')](_0x4fdff9,_0x22336f)['then'](function(_0x1dbff0){logger['info']('Team,\x20%s,\x20%s',_0x3359ed,_0xf2ef('0xe'));logger['debug'](_0xf2ef('0xf'),_0x3359ed,_0xf2ef('0xe'),JSON['stringify'](_0x1dbff0));if(_0x1dbff0['error']){if(_0x1dbff0[_0xf2ef('0x10')][_0xf2ef('0x11')]===0x1f4){logger[_0xf2ef('0x10')](_0xf2ef('0x12'),_0x3359ed,_0x1dbff0['error'][_0xf2ef('0x13')]);return _0x45e341(_0x1dbff0['error'][_0xf2ef('0x13')]);}logger[_0xf2ef('0x10')](_0xf2ef('0x12'),_0x3359ed,_0x1dbff0[_0xf2ef('0x10')][_0xf2ef('0x13')]);return _0x1ad5b9(_0x1dbff0[_0xf2ef('0x10')]['message']);}else{logger[_0xf2ef('0x14')]('Team,\x20%s,\x20%s',_0x3359ed,_0xf2ef('0xe'));_0x1ad5b9(_0x1dbff0[_0xf2ef('0x15')][_0xf2ef('0x13')]);}})[_0xf2ef('0x16')](function(_0x1d2092){logger[_0xf2ef('0x10')]('Team,\x20%s,\x20%s',_0x3359ed,_0x1d2092);_0x45e341(_0x1d2092);});});} \ No newline at end of file +var _0x5d8a=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x21b232,_0x1b9b77){var _0x54a541=function(_0x466d43){while(--_0x466d43){_0x21b232['push'](_0x21b232['shift']());}};_0x54a541(++_0x1b9b77);}(_0x5d8a,0x16e));var _0xa5d8=function(_0x318c16,_0x18f27b){_0x318c16=_0x318c16-0x0;var _0x3a72d7=_0x5d8a[_0x318c16];return _0x3a72d7;};'use strict';var _=require(_0xa5d8('0x0'));var util=require('util');var moment=require(_0xa5d8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5d8('0x2'));var fs=require('fs');var Redis=require(_0xa5d8('0x3'));var db=require(_0xa5d8('0x4'))['db'];var utils=require(_0xa5d8('0x5'));var logger=require(_0xa5d8('0x6'))(_0xa5d8('0x7'));var config=require(_0xa5d8('0x8'));var jayson=require(_0xa5d8('0x9'));var client=jayson[_0xa5d8('0xa')][_0xa5d8('0xb')]({'port':0x232a});config[_0xa5d8('0xc')]=_[_0xa5d8('0xd')](config[_0xa5d8('0xc')],{'host':_0xa5d8('0xe'),'port':0x18eb});var socket=require(_0xa5d8('0xf'))(new Redis(config[_0xa5d8('0xc')]));require(_0xa5d8('0x10'))[_0xa5d8('0x11')](socket);function respondWithRpcPromise(_0x484b3d,_0x4210da,_0xfc7306){return new BPromise(function(_0x567087,_0x35c47e){return client['request'](_0x484b3d,_0xfc7306)[_0xa5d8('0x12')](function(_0x4e7eae){logger[_0xa5d8('0x13')](_0xa5d8('0x14'),_0x4210da,_0xa5d8('0x15'));logger[_0xa5d8('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x4210da,_0xa5d8('0x15'),JSON['stringify'](_0x4e7eae));if(_0x4e7eae['error']){if(_0x4e7eae[_0xa5d8('0x17')][_0xa5d8('0x18')]===0x1f4){logger[_0xa5d8('0x17')](_0xa5d8('0x14'),_0x4210da,_0x4e7eae[_0xa5d8('0x17')][_0xa5d8('0x19')]);return _0x35c47e(_0x4e7eae['error']['message']);}logger[_0xa5d8('0x17')](_0xa5d8('0x14'),_0x4210da,_0x4e7eae['error'][_0xa5d8('0x19')]);return _0x567087(_0x4e7eae['error']['message']);}else{logger[_0xa5d8('0x13')](_0xa5d8('0x14'),_0x4210da,'request\x20sent');_0x567087(_0x4e7eae[_0xa5d8('0x1a')]['message']);}})[_0xa5d8('0x1b')](function(_0x23d4f6){logger[_0xa5d8('0x17')]('Team,\x20%s,\x20%s',_0x4210da,_0x23d4f6);_0x35c47e(_0x23d4f6);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b3a9ca2..d8fd8db 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 _0x2709=['length','./team.events','remove','update','emit','removeListener','register'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2709,0x189));var _0x9270=function(_0x1cfa2b,_0x45911a){_0x1cfa2b=_0x1cfa2b-0x0;var _0x92c2b=_0x2709[_0x1cfa2b];return _0x92c2b;};'use strict';var TeamEvents=require(_0x9270('0x0'));var events=['save',_0x9270('0x1'),_0x9270('0x2')];function createListener(_0x5e755b,_0x1d935b){return function(_0x4f5b2e){_0x1d935b[_0x9270('0x3')](_0x5e755b,_0x4f5b2e);};}function removeListener(_0x26bdf5,_0x326c2a){return function(){TeamEvents[_0x9270('0x4')](_0x26bdf5,_0x326c2a);};}exports[_0x9270('0x5')]=function(_0x446f78){for(var _0x4c71c5=0x0,_0x421b84=events[_0x9270('0x6')];_0x4c71c5<_0x421b84;_0x4c71c5++){var _0x1927c=events[_0x4c71c5];var _0x28e580=createListener('team:'+_0x1927c,_0x446f78);TeamEvents['on'](_0x1927c,_0x28e580);}}; \ No newline at end of file +var _0xd1f1=['register','length','./team.events','save','update','emit'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x46e3aa,_0x39d0f4){_0x46e3aa=_0x46e3aa-0x0;var _0x1558d1=_0xd1f1[_0x46e3aa];return _0x1558d1;};'use strict';var TeamEvents=require(_0x1d1f('0x0'));var events=[_0x1d1f('0x1'),'remove',_0x1d1f('0x2')];function createListener(_0x28750f,_0x346c36){return function(_0x42f3a0){_0x346c36[_0x1d1f('0x3')](_0x28750f,_0x42f3a0);};}function removeListener(_0x210e7f,_0x2a2bb4){return function(){TeamEvents['removeListener'](_0x210e7f,_0x2a2bb4);};}exports[_0x1d1f('0x4')]=function(_0x246882){for(var _0x68d881=0x0,_0x188cc3=events[_0x1d1f('0x5')];_0x68d881<_0x188cc3;_0x68d881++){var _0x5228f4=events[_0x68d881];var _0x4836b3=createListener('team:'+_0x5228f4,_0x246882);TeamEvents['on'](_0x5228f4,_0x4836b3);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 32912e4..95fb1cc 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 _0x4cbf=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','create','put','update','exports','multer','util'];(function(_0x14e3f9,_0x1b27f8){var _0x287c94=function(_0x54ad34){while(--_0x54ad34){_0x14e3f9['push'](_0x14e3f9['shift']());}};_0x287c94(++_0x1b27f8);}(_0x4cbf,0xb9));var _0xf4cb=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x4cbf[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0xf4cb('0x0'));var util=require(_0xf4cb('0x1'));var path=require(_0xf4cb('0x2'));var timeout=require(_0xf4cb('0x3'));var express=require(_0xf4cb('0x4'));var router=express[_0xf4cb('0x5')]();var auth=require(_0xf4cb('0x6'));var interaction=require(_0xf4cb('0x7'));var config=require('../../config/environment');var controller=require(_0xf4cb('0x8'));router['get']('/',auth[_0xf4cb('0x9')](),controller[_0xf4cb('0xa')]);router[_0xf4cb('0xb')](_0xf4cb('0xc'),auth[_0xf4cb('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4cb('0xd')]);router[_0xf4cb('0xe')](_0xf4cb('0xc'),auth['isAuthenticated'](),controller[_0xf4cb('0xf')]);router['delete'](_0xf4cb('0xc'),auth[_0xf4cb('0x9')](),controller['destroy']);module[_0xf4cb('0x10')]=router; \ No newline at end of file +var _0xdc6e=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x1f7a00,_0x341591){var _0x4b151c=function(_0x51fceb){while(--_0x51fceb){_0x1f7a00['push'](_0x1f7a00['shift']());}};_0x4b151c(++_0x341591);}(_0xdc6e,0x137));var _0xedc6=function(_0x22743d,_0x1cee11){_0x22743d=_0x22743d-0x0;var _0x3d51f0=_0xdc6e[_0x22743d];return _0x3d51f0;};'use strict';var multer=require(_0xedc6('0x0'));var util=require(_0xedc6('0x1'));var path=require(_0xedc6('0x2'));var timeout=require(_0xedc6('0x3'));var express=require(_0xedc6('0x4'));var router=express[_0xedc6('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xedc6('0x6'));var controller=require(_0xedc6('0x7'));router[_0xedc6('0x8')]('/',auth[_0xedc6('0x9')](),controller[_0xedc6('0xa')]);router[_0xedc6('0x8')](_0xedc6('0xb'),auth['isAuthenticated'](),controller[_0xedc6('0xc')]);router[_0xedc6('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xedc6('0xe')](_0xedc6('0xb'),auth['isAuthenticated'](),controller[_0xedc6('0xf')]);router[_0xedc6('0x10')](_0xedc6('0xb'),auth[_0xedc6('0x9')](),controller[_0xedc6('0x11')]);module[_0xedc6('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 773c0ec..94277ed 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 _0xf630=['sequelize','exports','STRING','TEXT'];(function(_0x5d5a09,_0x11860){var _0x582d42=function(_0x36260c){while(--_0x36260c){_0x5d5a09['push'](_0x5d5a09['shift']());}};_0x582d42(++_0x11860);}(_0xf630,0xc8));var _0x0f63=function(_0x486462,_0x1e67a2){_0x486462=_0x486462-0x0;var _0x4e18bf=_0xf630[_0x486462];return _0x4e18bf;};'use strict';var Sequelize=require(_0x0f63('0x0'));module[_0x0f63('0x1')]={'name':{'type':Sequelize[_0x0f63('0x2')]},'description':{'type':Sequelize[_0x0f63('0x2')]},'html':{'type':Sequelize[_0x0f63('0x3')]}}; \ No newline at end of file +var _0x96a0=['exports','STRING','sequelize'];(function(_0x494f7f,_0x34a09b){var _0x18ebe4=function(_0x178e2e){while(--_0x178e2e){_0x494f7f['push'](_0x494f7f['shift']());}};_0x18ebe4(++_0x34a09b);}(_0x96a0,0x1c1));var _0x096a=function(_0x30576c,_0xee6119){_0x30576c=_0x30576c-0x0;var _0x5d1bbd=_0x96a0[_0x30576c];return _0x5d1bbd;};'use strict';var Sequelize=require(_0x096a('0x0'));module[_0x096a('0x1')]={'name':{'type':Sequelize[_0x096a('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 7389bee..133b826 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 _0x4e29=['request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','Templates','UserProfileResource','destroy','error','name','send','index','Template','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4e29,0xa5));var _0x94e2=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x4e29[_0x35d59c];return _0x18cd27;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x94e2('0x0'));var zipdir=require(_0x94e2('0x1'));var jsonpatch=require(_0x94e2('0x2'));var rp=require(_0x94e2('0x3'));var moment=require(_0x94e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94e2('0x5'));var util=require(_0x94e2('0x6'));var path=require(_0x94e2('0x7'));var sox=require('sox');var csv=require(_0x94e2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x94e2('0x9'));var squel=require(_0x94e2('0xa'));var crypto=require(_0x94e2('0xb'));var jsforce=require(_0x94e2('0xc'));var deskjs=require(_0x94e2('0xd'));var toCsv=require(_0x94e2('0x8'));var querystring=require(_0x94e2('0xe'));var Papa=require(_0x94e2('0xf'));var Redis=require(_0x94e2('0x10'));var authService=require(_0x94e2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94e2('0x12'));var logger=require(_0x94e2('0x13'))(_0x94e2('0x14'));var utils=require(_0x94e2('0x15'));var config=require(_0x94e2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247103,_0x2c5a47){_0x2c5a47=_0x2c5a47||0xcc;return function(_0xf2f17a){if(_0xf2f17a){return _0x247103[_0x94e2('0x17')](_0x2c5a47);}return _0x247103['status'](_0x2c5a47)[_0x94e2('0x18')]();};}function respondWithResult(_0x5157a1,_0x3b4630){_0x3b4630=_0x3b4630||0xc8;return function(_0x204df1){if(_0x204df1){return _0x5157a1[_0x94e2('0x19')](_0x3b4630)[_0x94e2('0x1a')](_0x204df1);}};}function respondWithFilteredResult(_0x37eef0,_0x2dd3b5){return function(_0x2523c5){if(_0x2523c5){var _0x20478a=_0x2523c5[_0x94e2('0x1b')],_0x53a2f6=_0x2dd3b5[_0x94e2('0x1c')],_0x4c8391=_0x2dd3b5[_0x94e2('0x1c')]+_0x2dd3b5[_0x94e2('0x1d')],_0x6cb643;if(_0x4c8391>=_0x20478a){_0x4c8391=_0x20478a;_0x6cb643=0xc8;}else{_0x6cb643=0xce;}_0x37eef0[_0x94e2('0x19')](_0x6cb643);return _0x37eef0[_0x94e2('0x1e')]('Content-Range',_0x53a2f6+'-'+_0x4c8391+'/'+_0x20478a)[_0x94e2('0x1a')](_0x2523c5);}return null;};}function patchUpdates(_0x49b410){return function(_0x2a7af5){try{jsonpatch[_0x94e2('0x1f')](_0x2a7af5,_0x49b410,!![]);}catch(_0x279f0c){return BPromise[_0x94e2('0x20')](_0x279f0c);}return _0x2a7af5['save']();};}function saveUpdates(_0x15074a,_0x59b845){return function(_0x30cde7){if(_0x30cde7){return _0x30cde7[_0x94e2('0x21')](_0x15074a)[_0x94e2('0x22')](function(_0x24aa47){return _0x24aa47;});}return null;};}function removeEntity(_0x35ed67,_0x459f95){return function(_0x41dc30){if(_0x41dc30){return _0x41dc30['destroy']()[_0x94e2('0x22')](function(){var _0x50fb06=_0x41dc30['get']({'plain':!![]});var _0x8d7fbe=_0x94e2('0x23');return db[_0x94e2('0x24')][_0x94e2('0x25')]({'where':{'type':_0x8d7fbe,'resourceId':_0x50fb06['id']}})['then'](function(){return _0x41dc30;});})[_0x94e2('0x22')](function(){_0x35ed67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a101,_0x3beaf2){return function(_0x362428){if(!_0x362428){_0x45a101['sendStatus'](0x194);}return _0x362428;};}function handleError(_0xd1dd5e,_0x40fccd){_0x40fccd=_0x40fccd||0x1f4;return function(_0x198c50){logger[_0x94e2('0x26')](_0x198c50['stack']);if(_0x198c50[_0x94e2('0x27')]){delete _0x198c50['name'];}_0xd1dd5e[_0x94e2('0x19')](_0x40fccd)[_0x94e2('0x28')](_0x198c50);};}exports[_0x94e2('0x29')]=function(_0xe2a7f4,_0x44cf0c){var _0x395fcf={},_0x1fd7b8={},_0x374228={'count':0x0,'rows':[]};var _0x578949=_['map'](db[_0x94e2('0x2a')][_0x94e2('0x2b')],function(_0x15298c){return{'name':_0x15298c[_0x94e2('0x2c')],'type':_0x15298c['type'][_0x94e2('0x2d')]};});_0x1fd7b8[_0x94e2('0x2e')]=_[_0x94e2('0x2f')](_0x578949,_0x94e2('0x27'));_0x1fd7b8[_0x94e2('0x30')]=_[_0x94e2('0x31')](_0xe2a7f4[_0x94e2('0x30')]);_0x1fd7b8[_0x94e2('0x32')]=_[_0x94e2('0x33')](_0x1fd7b8[_0x94e2('0x2e')],_0x1fd7b8[_0x94e2('0x30')]);_0x395fcf['attributes']=_[_0x94e2('0x33')](_0x1fd7b8[_0x94e2('0x2e')],qs[_0x94e2('0x34')](_0xe2a7f4[_0x94e2('0x30')]['fields']));_0x395fcf['attributes']=_0x395fcf['attributes'][_0x94e2('0x35')]?_0x395fcf[_0x94e2('0x36')]:_0x1fd7b8[_0x94e2('0x2e')];if(!_0xe2a7f4['query'][_0x94e2('0x37')](_0x94e2('0x38'))){_0x395fcf[_0x94e2('0x1d')]=qs[_0x94e2('0x1d')](_0xe2a7f4[_0x94e2('0x30')][_0x94e2('0x1d')]);_0x395fcf[_0x94e2('0x1c')]=qs[_0x94e2('0x1c')](_0xe2a7f4[_0x94e2('0x30')]['offset']);}_0x395fcf[_0x94e2('0x39')]=qs[_0x94e2('0x3a')](_0xe2a7f4[_0x94e2('0x30')][_0x94e2('0x3a')]);_0x395fcf[_0x94e2('0x3b')]=qs[_0x94e2('0x32')](_[_0x94e2('0x3c')](_0xe2a7f4[_0x94e2('0x30')],_0x1fd7b8[_0x94e2('0x32')]),_0x578949);if(_0xe2a7f4['query'][_0x94e2('0x3d')]){_0x395fcf['where']=_[_0x94e2('0x3e')](_0x395fcf['where'],{'$or':_[_0x94e2('0x2f')](_0x578949,function(_0xb432d6){if(_0xb432d6[_0x94e2('0x3f')]!==_0x94e2('0x40')){var _0x5281f4={};_0x5281f4[_0xb432d6['name']]={'$like':'%'+_0xe2a7f4['query'][_0x94e2('0x3d')]+'%'};return _0x5281f4;}})});}_0x395fcf=_[_0x94e2('0x3e')]({},_0x395fcf,_0xe2a7f4[_0x94e2('0x41')]);var _0x3035f8={'where':_0x395fcf[_0x94e2('0x3b')]};return db[_0x94e2('0x2a')][_0x94e2('0x1b')](_0x3035f8)[_0x94e2('0x22')](function(_0x529d0b){_0x374228['count']=_0x529d0b;if(_0xe2a7f4[_0x94e2('0x30')][_0x94e2('0x42')]){_0x395fcf[_0x94e2('0x43')]=[{'all':!![]}];}return db[_0x94e2('0x2a')][_0x94e2('0x44')](_0x395fcf);})[_0x94e2('0x22')](function(_0x52880c){_0x374228[_0x94e2('0x45')]=_0x52880c;return _0x374228;})[_0x94e2('0x22')](respondWithFilteredResult(_0x44cf0c,_0x395fcf))[_0x94e2('0x46')](handleError(_0x44cf0c,null));};exports[_0x94e2('0x47')]=function(_0x2476e4,_0x333509){var _0x5ed29c={'raw':!![],'where':{'id':_0x2476e4['params']['id']}},_0x6ebf0c={};_0x6ebf0c[_0x94e2('0x2e')]=_[_0x94e2('0x31')](db[_0x94e2('0x2a')][_0x94e2('0x2b')]);_0x6ebf0c[_0x94e2('0x30')]=_[_0x94e2('0x31')](_0x2476e4[_0x94e2('0x30')]);_0x6ebf0c[_0x94e2('0x32')]=_[_0x94e2('0x33')](_0x6ebf0c[_0x94e2('0x2e')],_0x6ebf0c[_0x94e2('0x30')]);_0x5ed29c[_0x94e2('0x36')]=_[_0x94e2('0x33')](_0x6ebf0c['model'],qs[_0x94e2('0x34')](_0x2476e4[_0x94e2('0x30')][_0x94e2('0x34')]));_0x5ed29c[_0x94e2('0x36')]=_0x5ed29c[_0x94e2('0x36')]['length']?_0x5ed29c[_0x94e2('0x36')]:_0x6ebf0c[_0x94e2('0x2e')];if(_0x2476e4[_0x94e2('0x30')][_0x94e2('0x42')]){_0x5ed29c[_0x94e2('0x43')]=[{'all':!![]}];}_0x5ed29c=_[_0x94e2('0x3e')]({},_0x5ed29c,_0x2476e4['options']);return db['Template'][_0x94e2('0x48')](_0x5ed29c)[_0x94e2('0x22')](handleEntityNotFound(_0x333509,null))['then'](respondWithResult(_0x333509,null))[_0x94e2('0x46')](handleError(_0x333509,null));};exports[_0x94e2('0x49')]=function(_0x2abf4c,_0x50ba3a){return db[_0x94e2('0x2a')][_0x94e2('0x49')](_0x2abf4c[_0x94e2('0x4a')],{})[_0x94e2('0x22')](function(_0x3cddac){var _0x3a8c95=_0x2abf4c[_0x94e2('0x4b')][_0x94e2('0x4c')]({'plain':!![]});if(!_0x3a8c95)throw new Error(_0x94e2('0x4d'));if(_0x3a8c95[_0x94e2('0x4e')]===_0x94e2('0x4b')){var _0xc1c670=_0x3cddac['get']({'plain':!![]});var _0x451093=_0x94e2('0x23');return db[_0x94e2('0x4f')][_0x94e2('0x48')]({'where':{'name':_0x451093,'userProfileId':_0x3a8c95[_0x94e2('0x50')]},'raw':!![]})['then'](function(_0x1fa7cd){if(_0x1fa7cd&&_0x1fa7cd[_0x94e2('0x51')]===0x0){return db['UserProfileResource'][_0x94e2('0x49')]({'name':_0xc1c670['name'],'resourceId':_0xc1c670['id'],'type':_0x1fa7cd[_0x94e2('0x27')],'sectionId':_0x1fa7cd['id']},{})['then'](function(){return _0x3cddac;});}else{return _0x3cddac;}})[_0x94e2('0x46')](function(_0x208a86){logger[_0x94e2('0x26')](_0x94e2('0x52'),_0x208a86);throw _0x208a86;});}return _0x3cddac;})[_0x94e2('0x22')](respondWithResult(_0x50ba3a,0xc9))[_0x94e2('0x46')](handleError(_0x50ba3a,null));};exports[_0x94e2('0x21')]=function(_0x1befb7,_0x254696){if(_0x1befb7[_0x94e2('0x4a')]['id']){delete _0x1befb7[_0x94e2('0x4a')]['id'];}return db[_0x94e2('0x2a')][_0x94e2('0x48')]({'where':{'id':_0x1befb7[_0x94e2('0x53')]['id']}})[_0x94e2('0x22')](handleEntityNotFound(_0x254696,null))['then'](saveUpdates(_0x1befb7['body'],null))[_0x94e2('0x22')](respondWithResult(_0x254696,null))[_0x94e2('0x46')](handleError(_0x254696,null));};exports['destroy']=function(_0x4d62fa,_0x4a02f5){return db[_0x94e2('0x2a')][_0x94e2('0x48')]({'where':{'id':_0x4d62fa[_0x94e2('0x53')]['id']}})[_0x94e2('0x22')](handleEntityNotFound(_0x4a02f5,null))[_0x94e2('0x22')](removeEntity(_0x4a02f5,null))[_0x94e2('0x46')](handleError(_0x4a02f5,null));}; \ No newline at end of file +var _0xd083=['update','then','destroy','Templates','stack','name','index','map','Template','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','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','sendStatus','status','end','json','offset','limit','set','Content-Range','save'];(function(_0x3fb061,_0x2fe233){var _0x5c1384=function(_0x5509b1){while(--_0x5509b1){_0x3fb061['push'](_0x3fb061['shift']());}};_0x5c1384(++_0x2fe233);}(_0xd083,0x1b1));var _0x3d08=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0xd083[_0x2e4cbf];return _0x52840f;};'use strict';var pdf=require(_0x3d08('0x0'));var emlformat=require(_0x3d08('0x1'));var rimraf=require(_0x3d08('0x2'));var zipdir=require(_0x3d08('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d08('0x4'));var moment=require('moment');var BPromise=require(_0x3d08('0x5'));var Mustache=require(_0x3d08('0x6'));var util=require(_0x3d08('0x7'));var path=require('path');var sox=require(_0x3d08('0x8'));var csv=require(_0x3d08('0x9'));var ejs=require(_0x3d08('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3d08('0xb'));var crypto=require(_0x3d08('0xc'));var jsforce=require(_0x3d08('0xd'));var deskjs=require(_0x3d08('0xe'));var toCsv=require(_0x3d08('0x9'));var querystring=require(_0x3d08('0xf'));var Papa=require(_0x3d08('0x10'));var Redis=require(_0x3d08('0x11'));var authService=require(_0x3d08('0x12'));var qs=require(_0x3d08('0x13'));var as=require(_0x3d08('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d08('0x15'))(_0x3d08('0x16'));var utils=require(_0x3d08('0x17'));var config=require(_0x3d08('0x18'));var db=require(_0x3d08('0x19'))['db'];function respondWithStatusCode(_0x35b8df,_0x583764){_0x583764=_0x583764||0xcc;return function(_0x3672d2){if(_0x3672d2){return _0x35b8df[_0x3d08('0x1a')](_0x583764);}return _0x35b8df[_0x3d08('0x1b')](_0x583764)[_0x3d08('0x1c')]();};}function respondWithResult(_0x303228,_0x5a39e4){_0x5a39e4=_0x5a39e4||0xc8;return function(_0x257bde){if(_0x257bde){return _0x303228[_0x3d08('0x1b')](_0x5a39e4)[_0x3d08('0x1d')](_0x257bde);}};}function respondWithFilteredResult(_0x3a0bf8,_0x3ef748){return function(_0x8b438c){if(_0x8b438c){var _0x23db8c=_0x8b438c['count'],_0x292a98=_0x3ef748[_0x3d08('0x1e')],_0xd6d4bc=_0x3ef748[_0x3d08('0x1e')]+_0x3ef748[_0x3d08('0x1f')],_0x371445;if(_0xd6d4bc>=_0x23db8c){_0xd6d4bc=_0x23db8c;_0x371445=0xc8;}else{_0x371445=0xce;}_0x3a0bf8[_0x3d08('0x1b')](_0x371445);return _0x3a0bf8[_0x3d08('0x20')](_0x3d08('0x21'),_0x292a98+'-'+_0xd6d4bc+'/'+_0x23db8c)[_0x3d08('0x1d')](_0x8b438c);}return null;};}function patchUpdates(_0x1965d7){return function(_0x99d694){try{jsonpatch['apply'](_0x99d694,_0x1965d7,!![]);}catch(_0x3d286a){return BPromise['reject'](_0x3d286a);}return _0x99d694[_0x3d08('0x22')]();};}function saveUpdates(_0x58715c,_0x12d58a){return function(_0x33a449){if(_0x33a449){return _0x33a449[_0x3d08('0x23')](_0x58715c)[_0x3d08('0x24')](function(_0x3d3ef2){return _0x3d3ef2;});}return null;};}function removeEntity(_0x2c5905,_0x146b2a){return function(_0x38b686){if(_0x38b686){return _0x38b686[_0x3d08('0x25')]()['then'](function(){var _0x4ef592=_0x38b686['get']({'plain':!![]});var _0x2dd6f0=_0x3d08('0x26');return db['UserProfileResource'][_0x3d08('0x25')]({'where':{'type':_0x2dd6f0,'resourceId':_0x4ef592['id']}})[_0x3d08('0x24')](function(){return _0x38b686;});})[_0x3d08('0x24')](function(){_0x2c5905[_0x3d08('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38559d,_0x5dafaa){return function(_0x19d885){if(!_0x19d885){_0x38559d[_0x3d08('0x1a')](0x194);}return _0x19d885;};}function handleError(_0x5b43af,_0x3ba87f){_0x3ba87f=_0x3ba87f||0x1f4;return function(_0x1a6a00){logger['error'](_0x1a6a00[_0x3d08('0x27')]);if(_0x1a6a00[_0x3d08('0x28')]){delete _0x1a6a00[_0x3d08('0x28')];}_0x5b43af[_0x3d08('0x1b')](_0x3ba87f)['send'](_0x1a6a00);};}exports[_0x3d08('0x29')]=function(_0x320343,_0x54f8a1){var _0x57fca4={},_0x460cd6={},_0x5b91a7={'count':0x0,'rows':[]};var _0x5a441d=_[_0x3d08('0x2a')](db[_0x3d08('0x2b')]['rawAttributes'],function(_0x4b9b57){return{'name':_0x4b9b57[_0x3d08('0x2c')],'type':_0x4b9b57[_0x3d08('0x2d')]['key']};});_0x460cd6[_0x3d08('0x2e')]=_[_0x3d08('0x2a')](_0x5a441d,_0x3d08('0x28'));_0x460cd6[_0x3d08('0x2f')]=_['keys'](_0x320343['query']);_0x460cd6[_0x3d08('0x30')]=_['intersection'](_0x460cd6['model'],_0x460cd6[_0x3d08('0x2f')]);_0x57fca4[_0x3d08('0x31')]=_[_0x3d08('0x32')](_0x460cd6[_0x3d08('0x2e')],qs[_0x3d08('0x33')](_0x320343[_0x3d08('0x2f')][_0x3d08('0x33')]));_0x57fca4['attributes']=_0x57fca4['attributes'][_0x3d08('0x34')]?_0x57fca4['attributes']:_0x460cd6[_0x3d08('0x2e')];if(!_0x320343[_0x3d08('0x2f')]['hasOwnProperty'](_0x3d08('0x35'))){_0x57fca4[_0x3d08('0x1f')]=qs['limit'](_0x320343[_0x3d08('0x2f')]['limit']);_0x57fca4[_0x3d08('0x1e')]=qs[_0x3d08('0x1e')](_0x320343[_0x3d08('0x2f')][_0x3d08('0x1e')]);}_0x57fca4[_0x3d08('0x36')]=qs[_0x3d08('0x37')](_0x320343[_0x3d08('0x2f')][_0x3d08('0x37')]);_0x57fca4[_0x3d08('0x38')]=qs[_0x3d08('0x30')](_[_0x3d08('0x39')](_0x320343['query'],_0x460cd6['filters']),_0x5a441d);if(_0x320343[_0x3d08('0x2f')][_0x3d08('0x3a')]){_0x57fca4['where']=_['merge'](_0x57fca4[_0x3d08('0x38')],{'$or':_[_0x3d08('0x2a')](_0x5a441d,function(_0x4bf94a){if(_0x4bf94a[_0x3d08('0x2d')]!==_0x3d08('0x3b')){var _0x355cf8={};_0x355cf8[_0x4bf94a['name']]={'$like':'%'+_0x320343[_0x3d08('0x2f')][_0x3d08('0x3a')]+'%'};return _0x355cf8;}})});}_0x57fca4=_[_0x3d08('0x3c')]({},_0x57fca4,_0x320343[_0x3d08('0x3d')]);var _0x48a278={'where':_0x57fca4[_0x3d08('0x38')]};return db['Template'][_0x3d08('0x3e')](_0x48a278)[_0x3d08('0x24')](function(_0x58a793){_0x5b91a7['count']=_0x58a793;if(_0x320343[_0x3d08('0x2f')][_0x3d08('0x3f')]){_0x57fca4[_0x3d08('0x40')]=[{'all':!![]}];}return db[_0x3d08('0x2b')]['findAll'](_0x57fca4);})[_0x3d08('0x24')](function(_0x1cb3d2){_0x5b91a7[_0x3d08('0x41')]=_0x1cb3d2;return _0x5b91a7;})[_0x3d08('0x24')](respondWithFilteredResult(_0x54f8a1,_0x57fca4))[_0x3d08('0x42')](handleError(_0x54f8a1,null));};exports[_0x3d08('0x43')]=function(_0x5b86ad,_0x19d467){var _0x264108={'raw':!![],'where':{'id':_0x5b86ad['params']['id']}},_0x70ce67={};_0x70ce67[_0x3d08('0x2e')]=_[_0x3d08('0x44')](db[_0x3d08('0x2b')][_0x3d08('0x45')]);_0x70ce67[_0x3d08('0x2f')]=_[_0x3d08('0x44')](_0x5b86ad[_0x3d08('0x2f')]);_0x70ce67[_0x3d08('0x30')]=_['intersection'](_0x70ce67['model'],_0x70ce67['query']);_0x264108[_0x3d08('0x31')]=_['intersection'](_0x70ce67[_0x3d08('0x2e')],qs['fields'](_0x5b86ad['query'][_0x3d08('0x33')]));_0x264108[_0x3d08('0x31')]=_0x264108[_0x3d08('0x31')]['length']?_0x264108[_0x3d08('0x31')]:_0x70ce67['model'];if(_0x5b86ad[_0x3d08('0x2f')][_0x3d08('0x3f')]){_0x264108[_0x3d08('0x40')]=[{'all':!![]}];}_0x264108=_['merge']({},_0x264108,_0x5b86ad[_0x3d08('0x3d')]);return db[_0x3d08('0x2b')][_0x3d08('0x46')](_0x264108)['then'](handleEntityNotFound(_0x19d467,null))[_0x3d08('0x24')](respondWithResult(_0x19d467,null))[_0x3d08('0x42')](handleError(_0x19d467,null));};exports[_0x3d08('0x47')]=function(_0x49d8de,_0x4012bf){return db['Template']['create'](_0x49d8de['body'],{})['then'](function(_0x2fe309){var _0xcdb666=_0x49d8de['user'][_0x3d08('0x48')]({'plain':!![]});if(!_0xcdb666)throw new Error(_0x3d08('0x49'));if(_0xcdb666['role']==='user'){var _0x758c71=_0x2fe309[_0x3d08('0x48')]({'plain':!![]});var _0x31a976=_0x3d08('0x26');return db[_0x3d08('0x4a')][_0x3d08('0x46')]({'where':{'name':_0x31a976,'userProfileId':_0xcdb666['userProfileId']},'raw':!![]})['then'](function(_0x54c94e){if(_0x54c94e&&_0x54c94e['autoAssociation']===0x0){return db['UserProfileResource'][_0x3d08('0x47')]({'name':_0x758c71[_0x3d08('0x28')],'resourceId':_0x758c71['id'],'type':_0x54c94e[_0x3d08('0x28')],'sectionId':_0x54c94e['id']},{})[_0x3d08('0x24')](function(){return _0x2fe309;});}else{return _0x2fe309;}})['catch'](function(_0x16d25e){logger[_0x3d08('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16d25e);throw _0x16d25e;});}return _0x2fe309;})[_0x3d08('0x24')](respondWithResult(_0x4012bf,0xc9))[_0x3d08('0x42')](handleError(_0x4012bf,null));};exports[_0x3d08('0x23')]=function(_0x18b54d,_0x5d924c){if(_0x18b54d['body']['id']){delete _0x18b54d[_0x3d08('0x4c')]['id'];}return db[_0x3d08('0x2b')][_0x3d08('0x46')]({'where':{'id':_0x18b54d[_0x3d08('0x4d')]['id']}})[_0x3d08('0x24')](handleEntityNotFound(_0x5d924c,null))[_0x3d08('0x24')](saveUpdates(_0x18b54d[_0x3d08('0x4c')],null))[_0x3d08('0x24')](respondWithResult(_0x5d924c,null))[_0x3d08('0x42')](handleError(_0x5d924c,null));};exports[_0x3d08('0x25')]=function(_0x4bacda,_0x43106d){return db['Template'][_0x3d08('0x46')]({'where':{'id':_0x4bacda['params']['id']}})['then'](handleEntityNotFound(_0x43106d,null))[_0x3d08('0x24')](removeEntity(_0x43106d,null))[_0x3d08('0x42')](handleError(_0x43106d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 91f2a4d..5de8bbb 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 _0x7711=['rimraf','./template.attributes','exports','define','Template','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x259706,_0x2937c9){var _0x1524a8=function(_0x29fac1){while(--_0x29fac1){_0x259706['push'](_0x259706['shift']());}};_0x1524a8(++_0x2937c9);}(_0x7711,0xf7));var _0x1771=function(_0x29c5cc,_0x141127){_0x29c5cc=_0x29c5cc-0x0;var _0x402af4=_0x7711[_0x29c5cc];return _0x402af4;};'use strict';var _=require(_0x1771('0x0'));var util=require(_0x1771('0x1'));var logger=require(_0x1771('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1771('0x3'));var rp=require(_0x1771('0x4'));var fs=require('fs');var path=require(_0x1771('0x5'));var rimraf=require(_0x1771('0x6'));var config=require('../../config/environment');var attributes=require(_0x1771('0x7'));module[_0x1771('0x8')]=function(_0x509859,_0x5eef6f){return _0x509859[_0x1771('0x9')](_0x1771('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ec=['bluebird','request-promise','Template','tools_templates','util','../../config/logger','api'];(function(_0x23bd00,_0x198ccf){var _0x1c7d0c=function(_0x4cba00){while(--_0x4cba00){_0x23bd00['push'](_0x23bd00['shift']());}};_0x1c7d0c(++_0x198ccf);}(_0x32ec,0xba));var _0xc32e=function(_0x27b37e,_0x34301b){_0x27b37e=_0x27b37e-0x0;var _0x3bc3eb=_0x32ec[_0x27b37e];return _0x3bc3eb;};'use strict';var _=require('lodash');var util=require(_0xc32e('0x0'));var logger=require(_0xc32e('0x1'))(_0xc32e('0x2'));var moment=require('moment');var BPromise=require(_0xc32e('0x3'));var rp=require(_0xc32e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x37ab62,_0x3fedef){return _0x37ab62['define'](_0xc32e('0x5'),attributes,{'tableName':_0xc32e('0x6'),'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 b28598c..0820321 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 _0xfbdf=['result','catch','findAll','raw','options','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1a6399,_0x437d38){var _0x3a42d1=function(_0xeacda1){while(--_0xeacda1){_0x1a6399['push'](_0x1a6399['shift']());}};_0x3a42d1(++_0x437d38);}(_0xfbdf,0x160));var _0xffbd=function(_0x35f748,_0x2cd546){_0x35f748=_0x35f748-0x0;var _0x17ae2b=_0xfbdf[_0x35f748];return _0x17ae2b;};'use strict';var _=require(_0xffbd('0x0'));var util=require(_0xffbd('0x1'));var moment=require(_0xffbd('0x2'));var BPromise=require('bluebird');var rs=require(_0xffbd('0x3'));var fs=require('fs');var Redis=require(_0xffbd('0x4'));var db=require(_0xffbd('0x5'))['db'];var utils=require(_0xffbd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xffbd('0x7'));var jayson=require(_0xffbd('0x8'));var client=jayson[_0xffbd('0x9')][_0xffbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc2bb61,_0x5f0267,_0xd07527){return new BPromise(function(_0x29a20f,_0x33b49c){return client[_0xffbd('0xb')](_0xc2bb61,_0xd07527)[_0xffbd('0xc')](function(_0x751737){logger[_0xffbd('0xd')](_0xffbd('0xe'),_0x5f0267,_0xffbd('0xf'));logger[_0xffbd('0x10')](_0xffbd('0x11'),_0x5f0267,_0xffbd('0xf'),JSON[_0xffbd('0x12')](_0x751737));if(_0x751737[_0xffbd('0x13')]){if(_0x751737['error'][_0xffbd('0x14')]===0x1f4){logger[_0xffbd('0x13')](_0xffbd('0xe'),_0x5f0267,_0x751737[_0xffbd('0x13')][_0xffbd('0x15')]);return _0x33b49c(_0x751737[_0xffbd('0x13')][_0xffbd('0x15')]);}logger[_0xffbd('0x13')](_0xffbd('0xe'),_0x5f0267,_0x751737[_0xffbd('0x13')][_0xffbd('0x15')]);return _0x29a20f(_0x751737['error'][_0xffbd('0x15')]);}else{logger[_0xffbd('0xd')](_0xffbd('0xe'),_0x5f0267,'request\x20sent');_0x29a20f(_0x751737[_0xffbd('0x16')][_0xffbd('0x15')]);}})[_0xffbd('0x17')](function(_0x34cf71){logger['error'](_0xffbd('0xe'),_0x5f0267,_0x34cf71);_0x33b49c(_0x34cf71);});});}exports['GetTemplate']=function(_0x207a67){var _0x404b40=this;return new Promise(function(_0x57aea5,_0x763ec5){return db['Template'][_0xffbd('0x18')]({'raw':_0x207a67['options']?_0x207a67['options'][_0xffbd('0x19')]===undefined?!![]:![]:!![],'where':_0x207a67[_0xffbd('0x1a')]?_0x207a67[_0xffbd('0x1a')][_0xffbd('0x1b')]||null:null,'attributes':_0x207a67['options']?_0x207a67[_0xffbd('0x1a')][_0xffbd('0x1c')]||null:null,'limit':_0x207a67[_0xffbd('0x1a')]?_0x207a67['options'][_0xffbd('0x1d')]||null:null,'include':_0x207a67[_0xffbd('0x1a')]?_0x207a67['options'][_0xffbd('0x1e')]?_[_0xffbd('0x1f')](_0x207a67[_0xffbd('0x1a')][_0xffbd('0x1e')],function(_0x4b08a8){return{'model':db[_0x4b08a8['model']],'as':_0x4b08a8['as'],'attributes':_0x4b08a8[_0xffbd('0x1c')],'include':_0x4b08a8[_0xffbd('0x1e')]?_['map'](_0x4b08a8['include'],function(_0x310c55){return{'model':db[_0x310c55[_0xffbd('0x20')]],'as':_0x310c55['as'],'attributes':_0x310c55[_0xffbd('0x1c')],'include':_0x310c55[_0xffbd('0x1e')]?_[_0xffbd('0x1f')](_0x310c55[_0xffbd('0x1e')],function(_0x7792b6){return{'model':db[_0x7792b6[_0xffbd('0x20')]],'as':_0x7792b6['as'],'attributes':_0x7792b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xffbd('0xc')](function(_0x11fb66){logger[_0xffbd('0xd')](_0xffbd('0x21'),_0x207a67);logger['debug'](_0xffbd('0x21'),_0x207a67,JSON[_0xffbd('0x12')](_0x11fb66));_0x57aea5(_0x11fb66);})[_0xffbd('0x17')](function(_0x2f5116){logger[_0xffbd('0x13')](_0xffbd('0x21'),_0x2f5116['message'],_0x207a67);_0x763ec5(_0x404b40[_0xffbd('0x13')](0x1f4,_0x2f5116[_0xffbd('0x15')]));});});}; \ No newline at end of file +var _0x0db2=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','model','map','debug','lodash'];(function(_0x1cd29c,_0x331a03){var _0x440f42=function(_0x20d67a){while(--_0x20d67a){_0x1cd29c['push'](_0x1cd29c['shift']());}};_0x440f42(++_0x331a03);}(_0x0db2,0x116));var _0x20db=function(_0x4c40ff,_0x358e89){_0x4c40ff=_0x4c40ff-0x0;var _0x552ec9=_0x0db2[_0x4c40ff];return _0x552ec9;};'use strict';var _=require(_0x20db('0x0'));var util=require(_0x20db('0x1'));var moment=require('moment');var BPromise=require(_0x20db('0x2'));var rs=require(_0x20db('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20db('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x20db('0x5'))(_0x20db('0x6'));var config=require(_0x20db('0x7'));var jayson=require(_0x20db('0x8'));var client=jayson[_0x20db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a734,_0x37b2c5,_0x10826e){return new BPromise(function(_0x441967,_0x474de2){return client['request'](_0x30a734,_0x10826e)[_0x20db('0xa')](function(_0x1edaf2){logger[_0x20db('0xb')](_0x20db('0xc'),_0x37b2c5,_0x20db('0xd'));logger['debug'](_0x20db('0xe'),_0x37b2c5,_0x20db('0xd'),JSON[_0x20db('0xf')](_0x1edaf2));if(_0x1edaf2[_0x20db('0x10')]){if(_0x1edaf2[_0x20db('0x10')]['code']===0x1f4){logger[_0x20db('0x10')](_0x20db('0xc'),_0x37b2c5,_0x1edaf2[_0x20db('0x10')][_0x20db('0x11')]);return _0x474de2(_0x1edaf2['error'][_0x20db('0x11')]);}logger[_0x20db('0x10')]('Template,\x20%s,\x20%s',_0x37b2c5,_0x1edaf2[_0x20db('0x10')][_0x20db('0x11')]);return _0x441967(_0x1edaf2[_0x20db('0x10')][_0x20db('0x11')]);}else{logger[_0x20db('0xb')](_0x20db('0xc'),_0x37b2c5,'request\x20sent');_0x441967(_0x1edaf2[_0x20db('0x12')][_0x20db('0x11')]);}})[_0x20db('0x13')](function(_0x3e5c17){logger[_0x20db('0x10')](_0x20db('0xc'),_0x37b2c5,_0x3e5c17);_0x474de2(_0x3e5c17);});});}exports[_0x20db('0x14')]=function(_0x22541b){var _0x342e2a=this;return new Promise(function(_0xd82b2f,_0x4da9ab){return db[_0x20db('0x15')][_0x20db('0x16')]({'raw':_0x22541b[_0x20db('0x17')]?_0x22541b[_0x20db('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22541b[_0x20db('0x17')]?_0x22541b[_0x20db('0x17')][_0x20db('0x18')]||null:null,'attributes':_0x22541b[_0x20db('0x17')]?_0x22541b[_0x20db('0x17')][_0x20db('0x19')]||null:null,'limit':_0x22541b[_0x20db('0x17')]?_0x22541b['options'][_0x20db('0x1a')]||null:null,'include':_0x22541b[_0x20db('0x17')]?_0x22541b[_0x20db('0x17')][_0x20db('0x1b')]?_['map'](_0x22541b['options'][_0x20db('0x1b')],function(_0x1ceab6){return{'model':db[_0x1ceab6[_0x20db('0x1c')]],'as':_0x1ceab6['as'],'attributes':_0x1ceab6[_0x20db('0x19')],'include':_0x1ceab6['include']?_[_0x20db('0x1d')](_0x1ceab6['include'],function(_0x1eeea4){return{'model':db[_0x1eeea4[_0x20db('0x1c')]],'as':_0x1eeea4['as'],'attributes':_0x1eeea4[_0x20db('0x19')],'include':_0x1eeea4[_0x20db('0x1b')]?_[_0x20db('0x1d')](_0x1eeea4[_0x20db('0x1b')],function(_0x27c20b){return{'model':db[_0x27c20b[_0x20db('0x1c')]],'as':_0x27c20b['as'],'attributes':_0x27c20b[_0x20db('0x19')]};}):[]};}):[]};}):[]:[]})[_0x20db('0xa')](function(_0x3a60a6){logger[_0x20db('0xb')](_0x20db('0x14'),_0x22541b);logger[_0x20db('0x1e')](_0x20db('0x14'),_0x22541b,JSON[_0x20db('0xf')](_0x3a60a6));_0xd82b2f(_0x3a60a6);})[_0x20db('0x13')](function(_0x4593e5){logger[_0x20db('0x10')](_0x20db('0x14'),_0x4593e5[_0x20db('0x11')],_0x22541b);_0x4da9ab(_0x342e2a[_0x20db('0x10')](0x1f4,_0x4593e5['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4dff159..fe9ee58 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 _0xc1ce=['index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','addAllCondition','/:id/actions','addAction','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x4c96e4,_0x2fe2ea){var _0x2dd5d2=function(_0x3f040d){while(--_0x3f040d){_0x4c96e4['push'](_0x4c96e4['shift']());}};_0x2dd5d2(++_0x2fe2ea);}(_0xc1ce,0xf2));var _0xec1c=function(_0x1c3a7e,_0x506153){_0x1c3a7e=_0x1c3a7e-0x0;var _0x43d514=_0xc1ce[_0x1c3a7e];return _0x43d514;};'use strict';var multer=require(_0xec1c('0x0'));var util=require(_0xec1c('0x1'));var path=require(_0xec1c('0x2'));var timeout=require(_0xec1c('0x3'));var express=require(_0xec1c('0x4'));var router=express['Router']();var auth=require(_0xec1c('0x5'));var interaction=require(_0xec1c('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0xec1c('0x7')](),controller[_0xec1c('0x8')]);router[_0xec1c('0x9')](_0xec1c('0xa'),auth['isAuthenticated'](),controller[_0xec1c('0xb')]);router['get'](_0xec1c('0xc'),auth[_0xec1c('0x7')](),controller[_0xec1c('0xd')]);router[_0xec1c('0x9')](_0xec1c('0xe'),auth[_0xec1c('0x7')](),controller[_0xec1c('0xf')]);router[_0xec1c('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0xec1c('0x10')]('/',auth[_0xec1c('0x7')](),controller[_0xec1c('0x11')]);router[_0xec1c('0x10')](_0xec1c('0xc'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x12')]);router[_0xec1c('0x10')](_0xec1c('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0xec1c('0x13'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x14')]);router[_0xec1c('0x15')](_0xec1c('0xa'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x16')]);router[_0xec1c('0x17')](_0xec1c('0xa'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x18')]);module['exports']=router; \ No newline at end of file +var _0x85d8=['get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAction','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index'];(function(_0x522950,_0x589122){var _0x4d6b68=function(_0x51abff){while(--_0x51abff){_0x522950['push'](_0x522950['shift']());}};_0x4d6b68(++_0x589122);}(_0x85d8,0x1b0));var _0x885d=function(_0xe9bd5b,_0x51545f){_0xe9bd5b=_0xe9bd5b-0x0;var _0x1ca402=_0x85d8[_0xe9bd5b];return _0x1ca402;};'use strict';var multer=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var path=require(_0x885d('0x2'));var timeout=require(_0x885d('0x3'));var express=require(_0x885d('0x4'));var router=express['Router']();var auth=require(_0x885d('0x5'));var interaction=require(_0x885d('0x6'));var config=require(_0x885d('0x7'));var controller=require(_0x885d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x885d('0x9')]);router[_0x885d('0xa')](_0x885d('0xb'),auth[_0x885d('0xc')](),controller[_0x885d('0xd')]);router[_0x885d('0xa')](_0x885d('0xe'),auth[_0x885d('0xc')](),controller[_0x885d('0xf')]);router[_0x885d('0xa')](_0x885d('0x10'),auth[_0x885d('0xc')](),controller[_0x885d('0x11')]);router[_0x885d('0xa')](_0x885d('0x12'),auth[_0x885d('0xc')](),controller[_0x885d('0x13')]);router[_0x885d('0x14')]('/',auth[_0x885d('0xc')](),controller['create']);router['post'](_0x885d('0xe'),auth[_0x885d('0xc')](),controller['addAllCondition']);router[_0x885d('0x14')](_0x885d('0x10'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x885d('0x14')](_0x885d('0x12'),auth[_0x885d('0xc')](),controller[_0x885d('0x15')]);router[_0x885d('0x16')](_0x885d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x885d('0x17')](_0x885d('0xb'),auth[_0x885d('0xc')](),controller[_0x885d('0x18')]);module[_0x885d('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8a0caff..ac64aa1 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 _0x691b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5b3782,_0x581c67){var _0x5921ec=function(_0x125a41){while(--_0x125a41){_0x5b3782['push'](_0x5b3782['shift']());}};_0x5921ec(++_0x581c67);}(_0x691b,0x134));var _0xb691=function(_0x30daaf,_0x4e0b37){_0x30daaf=_0x30daaf-0x0;var _0x9f0f04=_0x691b[_0x30daaf];return _0x9f0f04;};'use strict';var Sequelize=require(_0xb691('0x0'));module[_0xb691('0x1')]={'name':{'type':Sequelize[_0xb691('0x2')]},'channel':{'type':Sequelize[_0xb691('0x2')]},'description':{'type':Sequelize[_0xb691('0x2')]},'status':{'type':Sequelize[_0xb691('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4879=['STRING','BOOLEAN','sequelize'];(function(_0x23f810,_0x3b03b3){var _0x2fa9dd=function(_0x358512){while(--_0x358512){_0x23f810['push'](_0x23f810['shift']());}};_0x2fa9dd(++_0x3b03b3);}(_0x4879,0x158));var _0x9487=function(_0x495b0d,_0x1c6aef){_0x495b0d=_0x495b0d-0x0;var _0x1ac214=_0x4879[_0x495b0d];return _0x1ac214;};'use strict';var Sequelize=require(_0x9487('0x0'));module['exports']={'name':{'type':Sequelize[_0x9487('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9487('0x1')]},'status':{'type':Sequelize[_0x9487('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 6b8c8ce..770f2ad 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 _0xf2c7=['api','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','includeAll','include','findAll','catch','show','options','create','body','user','role','Triggers','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','merge','getAllConditions','hasOwnProperty','getAnyConditions','addAction','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x160085,_0x4d040b){var _0x3f5f59=function(_0x12b937){while(--_0x12b937){_0x160085['push'](_0x160085['shift']());}};_0x3f5f59(++_0x4d040b);}(_0xf2c7,0xf7));var _0x7f2c=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0xf2c7[_0x4f8d61];return _0x3bc078;};'use strict';var pdf=require(_0x7f2c('0x0'));var emlformat=require(_0x7f2c('0x1'));var rimraf=require(_0x7f2c('0x2'));var zipdir=require(_0x7f2c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f2c('0x4'));var moment=require(_0x7f2c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f2c('0x6'));var path=require(_0x7f2c('0x7'));var sox=require(_0x7f2c('0x8'));var csv=require(_0x7f2c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f2c('0xa'));var squel=require(_0x7f2c('0xb'));var crypto=require(_0x7f2c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7f2c('0xd'));var Papa=require(_0x7f2c('0xe'));var Redis=require(_0x7f2c('0xf'));var authService=require(_0x7f2c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7f2c('0x11'));var hardwareService=require(_0x7f2c('0x12'));var logger=require(_0x7f2c('0x13'))(_0x7f2c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7f2c('0x15'))['db'];function respondWithStatusCode(_0x449a1d,_0x58d491){_0x58d491=_0x58d491||0xcc;return function(_0x325a1c){if(_0x325a1c){return _0x449a1d[_0x7f2c('0x16')](_0x58d491);}return _0x449a1d[_0x7f2c('0x17')](_0x58d491)['end']();};}function respondWithResult(_0x433956,_0x11433f){_0x11433f=_0x11433f||0xc8;return function(_0x19a215){if(_0x19a215){return _0x433956[_0x7f2c('0x17')](_0x11433f)['json'](_0x19a215);}};}function respondWithFilteredResult(_0x180a09,_0x1c7d1b){return function(_0x1cc4a7){if(_0x1cc4a7){var _0x4593df=_0x1cc4a7[_0x7f2c('0x18')],_0x330409=_0x1c7d1b[_0x7f2c('0x19')],_0x3e48d9=_0x1c7d1b[_0x7f2c('0x19')]+_0x1c7d1b[_0x7f2c('0x1a')],_0x21e1e6;if(_0x3e48d9>=_0x4593df){_0x3e48d9=_0x4593df;_0x21e1e6=0xc8;}else{_0x21e1e6=0xce;}_0x180a09[_0x7f2c('0x17')](_0x21e1e6);return _0x180a09[_0x7f2c('0x1b')](_0x7f2c('0x1c'),_0x330409+'-'+_0x3e48d9+'/'+_0x4593df)[_0x7f2c('0x1d')](_0x1cc4a7);}return null;};}function patchUpdates(_0x269f8e){return function(_0x35364f){try{jsonpatch[_0x7f2c('0x1e')](_0x35364f,_0x269f8e,!![]);}catch(_0x498262){return BPromise[_0x7f2c('0x1f')](_0x498262);}return _0x35364f['save']();};}function saveUpdates(_0x44db35,_0x4bf13e){return function(_0x4e0556){if(_0x4e0556){return _0x4e0556[_0x7f2c('0x20')](_0x44db35)[_0x7f2c('0x21')](function(_0x28232d){return _0x28232d;});}return null;};}function removeEntity(_0x268bd8,_0x5e1827){return function(_0xba8446){if(_0xba8446){return _0xba8446[_0x7f2c('0x22')]()[_0x7f2c('0x21')](function(){var _0x5c53bd=_0xba8446[_0x7f2c('0x23')]({'plain':!![]});var _0x59be66='Triggers';return db[_0x7f2c('0x24')][_0x7f2c('0x22')]({'where':{'type':_0x59be66,'resourceId':_0x5c53bd['id']}})[_0x7f2c('0x21')](function(){return _0xba8446;});})[_0x7f2c('0x21')](function(){_0x268bd8[_0x7f2c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa606e8,_0x5cbe14){return function(_0x1c0d78){if(!_0x1c0d78){_0xa606e8[_0x7f2c('0x16')](0x194);}return _0x1c0d78;};}function handleError(_0x1a71f5,_0x89fbe4){_0x89fbe4=_0x89fbe4||0x1f4;return function(_0x219996){logger[_0x7f2c('0x25')](_0x219996[_0x7f2c('0x26')]);if(_0x219996[_0x7f2c('0x27')]){delete _0x219996[_0x7f2c('0x27')];}_0x1a71f5[_0x7f2c('0x17')](_0x89fbe4)[_0x7f2c('0x28')](_0x219996);};}exports['index']=function(_0x4a78c8,_0x107f39){var _0x2e5826={},_0x1a2caa={},_0x29801={'count':0x0,'rows':[]};var _0x533147=_['map'](db[_0x7f2c('0x29')][_0x7f2c('0x2a')],function(_0x252e67){return{'name':_0x252e67[_0x7f2c('0x2b')],'type':_0x252e67[_0x7f2c('0x2c')]['key']};});_0x1a2caa[_0x7f2c('0x2d')]=_['map'](_0x533147,_0x7f2c('0x27'));_0x1a2caa[_0x7f2c('0x2e')]=_[_0x7f2c('0x2f')](_0x4a78c8[_0x7f2c('0x2e')]);_0x1a2caa[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0x1a2caa['model'],_0x1a2caa[_0x7f2c('0x2e')]);_0x2e5826['attributes']=_[_0x7f2c('0x31')](_0x1a2caa[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x4a78c8[_0x7f2c('0x2e')]['fields']));_0x2e5826[_0x7f2c('0x33')]=_0x2e5826[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x2e5826[_0x7f2c('0x33')]:_0x1a2caa[_0x7f2c('0x2d')];if(!_0x4a78c8[_0x7f2c('0x2e')]['hasOwnProperty'](_0x7f2c('0x35'))){_0x2e5826[_0x7f2c('0x1a')]=qs[_0x7f2c('0x1a')](_0x4a78c8['query'][_0x7f2c('0x1a')]);_0x2e5826[_0x7f2c('0x19')]=qs[_0x7f2c('0x19')](_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x19')]);}_0x2e5826[_0x7f2c('0x36')]=qs['sort'](_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x2e5826[_0x7f2c('0x38')]=qs['filters'](_[_0x7f2c('0x39')](_0x4a78c8[_0x7f2c('0x2e')],_0x1a2caa['filters']),_0x533147);if(_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x3a')]){_0x2e5826[_0x7f2c('0x38')]=_['merge'](_0x2e5826[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x533147,function(_0x4a552b){if(_0x4a552b['type']!==_0x7f2c('0x3c')){var _0x45ed53={};_0x45ed53[_0x4a552b[_0x7f2c('0x27')]]={'$like':'%'+_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x3a')]+'%'};return _0x45ed53;}})});}_0x2e5826=_['merge']({},_0x2e5826,_0x4a78c8['options']);var _0x1894d3={'where':_0x2e5826['where']};return db[_0x7f2c('0x29')][_0x7f2c('0x18')](_0x1894d3)[_0x7f2c('0x21')](function(_0x5c7c35){_0x29801[_0x7f2c('0x18')]=_0x5c7c35;if(_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x3d')]){_0x2e5826[_0x7f2c('0x3e')]=[{'all':!![]}];}return db[_0x7f2c('0x29')][_0x7f2c('0x3f')](_0x2e5826);})['then'](function(_0x1e60e0){_0x29801['rows']=_0x1e60e0;return _0x29801;})[_0x7f2c('0x21')](respondWithFilteredResult(_0x107f39,_0x2e5826))[_0x7f2c('0x40')](handleError(_0x107f39,null));};exports[_0x7f2c('0x41')]=function(_0x3afdaf,_0x1f19f0){var _0x2581dc={'raw':![],'where':{'id':_0x3afdaf['params']['id']}},_0x337c4c={};_0x337c4c[_0x7f2c('0x2d')]=_[_0x7f2c('0x2f')](db[_0x7f2c('0x29')][_0x7f2c('0x2a')]);_0x337c4c[_0x7f2c('0x2e')]=_[_0x7f2c('0x2f')](_0x3afdaf[_0x7f2c('0x2e')]);_0x337c4c[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0x337c4c['model'],_0x337c4c[_0x7f2c('0x2e')]);_0x2581dc[_0x7f2c('0x33')]=_['intersection'](_0x337c4c[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x3afdaf[_0x7f2c('0x2e')][_0x7f2c('0x32')]));_0x2581dc[_0x7f2c('0x33')]=_0x2581dc[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x2581dc[_0x7f2c('0x33')]:_0x337c4c[_0x7f2c('0x2d')];if(_0x3afdaf[_0x7f2c('0x2e')][_0x7f2c('0x3d')]){_0x2581dc['include']=[{'all':!![]}];}_0x2581dc=_['merge']({},_0x2581dc,_0x3afdaf[_0x7f2c('0x42')]);return db[_0x7f2c('0x29')]['find'](_0x2581dc)['then'](handleEntityNotFound(_0x1f19f0,null))[_0x7f2c('0x21')](respondWithResult(_0x1f19f0,null))[_0x7f2c('0x40')](handleError(_0x1f19f0,null));};exports[_0x7f2c('0x43')]=function(_0x2b0345,_0x3192fe){return db['Trigger'][_0x7f2c('0x43')](_0x2b0345[_0x7f2c('0x44')],{})['then'](function(_0x94d0f0){var _0x27a7c8=_0x2b0345[_0x7f2c('0x45')]['get']({'plain':!![]});if(!_0x27a7c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27a7c8[_0x7f2c('0x46')]===_0x7f2c('0x45')){var _0x21a547=_0x94d0f0[_0x7f2c('0x23')]({'plain':!![]});var _0x29afd6=_0x7f2c('0x47');return db[_0x7f2c('0x48')][_0x7f2c('0x49')]({'where':{'name':_0x29afd6,'userProfileId':_0x27a7c8[_0x7f2c('0x4a')]},'raw':!![]})['then'](function(_0x3c5821){if(_0x3c5821&&_0x3c5821['autoAssociation']===0x0){return db['UserProfileResource'][_0x7f2c('0x43')]({'name':_0x21a547['name'],'resourceId':_0x21a547['id'],'type':_0x3c5821[_0x7f2c('0x27')],'sectionId':_0x3c5821['id']},{})[_0x7f2c('0x21')](function(){return _0x94d0f0;});}else{return _0x94d0f0;}})[_0x7f2c('0x40')](function(_0x1e8caa){logger[_0x7f2c('0x25')](_0x7f2c('0x4b'),_0x1e8caa);throw _0x1e8caa;});}return _0x94d0f0;})[_0x7f2c('0x21')](respondWithResult(_0x3192fe,0xc9))[_0x7f2c('0x40')](handleError(_0x3192fe,null));};exports['update']=function(_0x13b634,_0x318964){if(_0x13b634[_0x7f2c('0x44')]['id']){delete _0x13b634[_0x7f2c('0x44')]['id'];}return db['Trigger'][_0x7f2c('0x49')]({'where':{'id':_0x13b634[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x318964,null))[_0x7f2c('0x21')](saveUpdates(_0x13b634[_0x7f2c('0x44')],null))[_0x7f2c('0x21')](respondWithResult(_0x318964,null))['catch'](handleError(_0x318964,null));};exports[_0x7f2c('0x22')]=function(_0x2da0fb,_0x3291f6){return db[_0x7f2c('0x29')]['find']({'where':{'id':_0x2da0fb[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x3291f6,null))[_0x7f2c('0x21')](removeEntity(_0x3291f6,null))[_0x7f2c('0x40')](handleError(_0x3291f6,null));};exports['addAllCondition']=function(_0x21607a,_0x2ff06e,_0x1ab8b3){if(_0x21607a[_0x7f2c('0x44')]['id']){delete _0x21607a[_0x7f2c('0x44')]['id'];}return db[_0x7f2c('0x29')][_0x7f2c('0x49')]({'where':{'id':_0x21607a[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x2ff06e,null))['then'](function(_0x450e3d){if(_0x450e3d){_0x21607a[_0x7f2c('0x44')][_0x7f2c('0x4d')]=_0x450e3d['id'];return db[_0x7f2c('0x4e')][_0x7f2c('0x43')](_0x21607a[_0x7f2c('0x44')]);}})[_0x7f2c('0x21')](respondWithResult(_0x2ff06e,null))[_0x7f2c('0x40')](handleError(_0x2ff06e,null));};exports[_0x7f2c('0x4f')]=function(_0x30fc81,_0x179063,_0x2b80a4){if(_0x30fc81[_0x7f2c('0x44')]['id']){delete _0x30fc81[_0x7f2c('0x44')]['id'];}return db['Trigger'][_0x7f2c('0x49')]({'where':{'id':_0x30fc81[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x179063,null))[_0x7f2c('0x21')](function(_0x218fdb){if(_0x218fdb){_0x30fc81[_0x7f2c('0x44')][_0x7f2c('0x50')]=_0x218fdb['id'];return db[_0x7f2c('0x4e')][_0x7f2c('0x43')](_0x30fc81[_0x7f2c('0x44')]);}})[_0x7f2c('0x21')](respondWithResult(_0x179063,null))[_0x7f2c('0x40')](handleError(_0x179063,null));};exports['getAllConditions']=function(_0x27b601,_0x32e0eb,_0x6fcfa1){var _0x1d15da={};var _0xb6ec43={};var _0xc2cb97;var _0x3808b5;return db[_0x7f2c('0x29')][_0x7f2c('0x51')]({'where':{'id':_0x27b601['params']['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x32e0eb,null))[_0x7f2c('0x21')](function(_0x31b58c){if(_0x31b58c){_0xc2cb97=_0x31b58c;_0xb6ec43[_0x7f2c('0x2d')]=_['keys'](db['Condition'][_0x7f2c('0x2a')]);_0xb6ec43[_0x7f2c('0x2e')]=_['keys'](_0x27b601[_0x7f2c('0x2e')]);_0xb6ec43[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0xb6ec43['model'],_0xb6ec43[_0x7f2c('0x2e')]);_0x1d15da[_0x7f2c('0x33')]=_[_0x7f2c('0x31')](_0xb6ec43[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x27b601[_0x7f2c('0x2e')]['fields']));_0x1d15da[_0x7f2c('0x33')]=_0x1d15da[_0x7f2c('0x33')]['length']?_0x1d15da[_0x7f2c('0x33')]:_0xb6ec43['model'];_0x1d15da[_0x7f2c('0x36')]=qs[_0x7f2c('0x37')](_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x1d15da[_0x7f2c('0x38')]=qs['filters'](_[_0x7f2c('0x39')](_0x27b601[_0x7f2c('0x2e')],_0xb6ec43[_0x7f2c('0x30')]));if(_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x3a')]){_0x1d15da[_0x7f2c('0x38')]=_[_0x7f2c('0x52')](_0x1d15da[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x1d15da[_0x7f2c('0x33')],function(_0x16f928){var _0xb96f0b={};_0xb96f0b[_0x16f928]={'$like':'%'+_0x27b601['query'][_0x7f2c('0x3a')]+'%'};return _0xb96f0b;})});}_0x1d15da=_[_0x7f2c('0x52')]({},_0x1d15da,_0x27b601[_0x7f2c('0x42')]);return _0xc2cb97[_0x7f2c('0x53')](_0x1d15da);}})[_0x7f2c('0x21')](function(_0x2d0da1){if(_0x2d0da1){_0x3808b5=_0x2d0da1[_0x7f2c('0x34')];if(!_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x54')]('nolimit')){_0x1d15da[_0x7f2c('0x1a')]=qs[_0x7f2c('0x1a')](_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x1a')]);_0x1d15da['offset']=qs[_0x7f2c('0x19')](_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x19')]);}return _0xc2cb97[_0x7f2c('0x53')](_0x1d15da);}})[_0x7f2c('0x21')](function(_0x462902){if(_0x462902){return _0x462902?{'count':_0x3808b5,'rows':_0x462902}:null;}})[_0x7f2c('0x21')](respondWithResult(_0x32e0eb,null))[_0x7f2c('0x40')](handleError(_0x32e0eb,null));};exports['getAnyConditions']=function(_0x118460,_0x3e747c,_0x871429){var _0x131d37={};var _0x55f64e={};var _0x5efc26;var _0x4de734;return db[_0x7f2c('0x29')]['findOne']({'where':{'id':_0x118460[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x3e747c,null))['then'](function(_0x53d950){if(_0x53d950){_0x5efc26=_0x53d950;_0x55f64e['model']=_[_0x7f2c('0x2f')](db[_0x7f2c('0x4e')]['rawAttributes']);_0x55f64e[_0x7f2c('0x2e')]=_[_0x7f2c('0x2f')](_0x118460[_0x7f2c('0x2e')]);_0x55f64e[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0x55f64e[_0x7f2c('0x2d')],_0x55f64e[_0x7f2c('0x2e')]);_0x131d37[_0x7f2c('0x33')]=_[_0x7f2c('0x31')](_0x55f64e[_0x7f2c('0x2d')],qs['fields'](_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x32')]));_0x131d37[_0x7f2c('0x33')]=_0x131d37[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x131d37[_0x7f2c('0x33')]:_0x55f64e[_0x7f2c('0x2d')];_0x131d37[_0x7f2c('0x36')]=qs[_0x7f2c('0x37')](_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x131d37[_0x7f2c('0x38')]=qs['filters'](_[_0x7f2c('0x39')](_0x118460[_0x7f2c('0x2e')],_0x55f64e[_0x7f2c('0x30')]));if(_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x3a')]){_0x131d37[_0x7f2c('0x38')]=_[_0x7f2c('0x52')](_0x131d37[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x131d37['attributes'],function(_0x33c6c2){var _0x28119a={};_0x28119a[_0x33c6c2]={'$like':'%'+_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x3a')]+'%'};return _0x28119a;})});}_0x131d37=_[_0x7f2c('0x52')]({},_0x131d37,_0x118460[_0x7f2c('0x42')]);return _0x5efc26[_0x7f2c('0x55')](_0x131d37);}})[_0x7f2c('0x21')](function(_0x3cb554){if(_0x3cb554){_0x4de734=_0x3cb554[_0x7f2c('0x34')];if(!_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x54')]('nolimit')){_0x131d37[_0x7f2c('0x1a')]=qs['limit'](_0x118460['query'][_0x7f2c('0x1a')]);_0x131d37[_0x7f2c('0x19')]=qs[_0x7f2c('0x19')](_0x118460[_0x7f2c('0x2e')]['offset']);}return _0x5efc26[_0x7f2c('0x55')](_0x131d37);}})['then'](function(_0x4db8d7){if(_0x4db8d7){return _0x4db8d7?{'count':_0x4de734,'rows':_0x4db8d7}:null;}})['then'](respondWithResult(_0x3e747c,null))[_0x7f2c('0x40')](handleError(_0x3e747c,null));};exports[_0x7f2c('0x56')]=function(_0x4f74c4,_0x4eef26,_0x5de1a3){if(_0x4f74c4[_0x7f2c('0x44')]['id']){delete _0x4f74c4['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x4f74c4[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x4eef26,null))[_0x7f2c('0x21')](function(_0x2e3aad){if(_0x2e3aad){_0x4f74c4[_0x7f2c('0x44')]['TriggerId']=_0x2e3aad['id'];return db['Action'][_0x7f2c('0x43')](_0x4f74c4[_0x7f2c('0x44')]);}})[_0x7f2c('0x21')](respondWithResult(_0x4eef26,null))['catch'](handleError(_0x4eef26,null));};exports[_0x7f2c('0x57')]=function(_0x345821,_0x6c8d1e,_0xe746af){var _0x4793eb={};var _0x4297a6={};var _0x5e4608;var _0x57e3ef;return db[_0x7f2c('0x29')][_0x7f2c('0x51')]({'where':{'id':_0x345821['params']['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x6c8d1e,null))[_0x7f2c('0x21')](function(_0x3df9a6){if(_0x3df9a6){_0x5e4608=_0x3df9a6;_0x4297a6[_0x7f2c('0x2d')]=_[_0x7f2c('0x2f')](db[_0x7f2c('0x58')]['rawAttributes']);_0x4297a6['query']=_['keys'](_0x345821[_0x7f2c('0x2e')]);_0x4297a6[_0x7f2c('0x30')]=_['intersection'](_0x4297a6[_0x7f2c('0x2d')],_0x4297a6[_0x7f2c('0x2e')]);_0x4793eb['attributes']=_[_0x7f2c('0x31')](_0x4297a6[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x345821['query']['fields']));_0x4793eb[_0x7f2c('0x33')]=_0x4793eb[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x4793eb[_0x7f2c('0x33')]:_0x4297a6['model'];_0x4793eb[_0x7f2c('0x36')]=qs['sort'](_0x345821[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x4793eb['where']=qs['filters'](_[_0x7f2c('0x39')](_0x345821['query'],_0x4297a6[_0x7f2c('0x30')]));if(_0x345821[_0x7f2c('0x2e')]['filter']){_0x4793eb[_0x7f2c('0x38')]=_['merge'](_0x4793eb[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x4793eb[_0x7f2c('0x33')],function(_0x5c9082){var _0x2a1475={};_0x2a1475[_0x5c9082]={'$like':'%'+_0x345821['query']['filter']+'%'};return _0x2a1475;})});}_0x4793eb=_['merge']({},_0x4793eb,_0x345821['options']);return _0x5e4608[_0x7f2c('0x57')](_0x4793eb);}})[_0x7f2c('0x21')](function(_0x5ca4fc){if(_0x5ca4fc){_0x57e3ef=_0x5ca4fc['length'];if(!_0x345821['query'][_0x7f2c('0x54')](_0x7f2c('0x35'))){_0x4793eb[_0x7f2c('0x1a')]=qs[_0x7f2c('0x1a')](_0x345821[_0x7f2c('0x2e')]['limit']);_0x4793eb[_0x7f2c('0x19')]=qs[_0x7f2c('0x19')](_0x345821[_0x7f2c('0x2e')][_0x7f2c('0x19')]);}return _0x5e4608[_0x7f2c('0x57')](_0x4793eb);}})[_0x7f2c('0x21')](function(_0x50bc64){if(_0x50bc64){return _0x50bc64?{'count':_0x57e3ef,'rows':_0x50bc64}:null;}})[_0x7f2c('0x21')](respondWithResult(_0x6c8d1e,null))['catch'](handleError(_0x6c8d1e,null));}; \ No newline at end of file +var _0xff1d=['findOne','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','request-promise','moment','bluebird','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','destroy','then','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','TriggerAnyId','getAllConditions'];(function(_0x31f6d4,_0x35b3c7){var _0x5e93fd=function(_0x5174a3){while(--_0x5174a3){_0x31f6d4['push'](_0x31f6d4['shift']());}};_0x5e93fd(++_0x35b3c7);}(_0xff1d,0x10d));var _0xdff1=function(_0x4e3122,_0x3a33d9){_0x4e3122=_0x4e3122-0x0;var _0x339912=_0xff1d[_0x4e3122];return _0x339912;};'use strict';var pdf=require(_0xdff1('0x0'));var emlformat=require(_0xdff1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdff1('0x2'));var moment=require(_0xdff1('0x3'));var BPromise=require(_0xdff1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdff1('0x5'));var sox=require('sox');var csv=require(_0xdff1('0x6'));var ejs=require(_0xdff1('0x7'));var fs=require('fs');var _=require(_0xdff1('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdff1('0x9'));var deskjs=require(_0xdff1('0xa'));var toCsv=require('to-csv');var querystring=require(_0xdff1('0xb'));var Papa=require('papaparse');var Redis=require(_0xdff1('0xc'));var authService=require(_0xdff1('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdff1('0xe'))(_0xdff1('0xf'));var utils=require(_0xdff1('0x10'));var config=require(_0xdff1('0x11'));var db=require(_0xdff1('0x12'))['db'];function respondWithStatusCode(_0x4fd3db,_0x4ef69f){_0x4ef69f=_0x4ef69f||0xcc;return function(_0x14c9df){if(_0x14c9df){return _0x4fd3db[_0xdff1('0x13')](_0x4ef69f);}return _0x4fd3db[_0xdff1('0x14')](_0x4ef69f)[_0xdff1('0x15')]();};}function respondWithResult(_0x5e6b6a,_0x159181){_0x159181=_0x159181||0xc8;return function(_0xd26e68){if(_0xd26e68){return _0x5e6b6a[_0xdff1('0x14')](_0x159181)[_0xdff1('0x16')](_0xd26e68);}};}function respondWithFilteredResult(_0x17a37d,_0x7db59c){return function(_0x279b13){if(_0x279b13){var _0x41f432=_0x279b13[_0xdff1('0x17')],_0x17c777=_0x7db59c[_0xdff1('0x18')],_0x7e0d4=_0x7db59c[_0xdff1('0x18')]+_0x7db59c['limit'],_0x957d5b;if(_0x7e0d4>=_0x41f432){_0x7e0d4=_0x41f432;_0x957d5b=0xc8;}else{_0x957d5b=0xce;}_0x17a37d[_0xdff1('0x14')](_0x957d5b);return _0x17a37d[_0xdff1('0x19')]('Content-Range',_0x17c777+'-'+_0x7e0d4+'/'+_0x41f432)[_0xdff1('0x16')](_0x279b13);}return null;};}function patchUpdates(_0x27c381){return function(_0x5c9105){try{jsonpatch[_0xdff1('0x1a')](_0x5c9105,_0x27c381,!![]);}catch(_0x3d886a){return BPromise[_0xdff1('0x1b')](_0x3d886a);}return _0x5c9105['save']();};}function saveUpdates(_0x5b515c,_0x550e8e){return function(_0x56f7b0){if(_0x56f7b0){return _0x56f7b0[_0xdff1('0x1c')](_0x5b515c)['then'](function(_0xab5434){return _0xab5434;});}return null;};}function removeEntity(_0x255df3,_0x3db6c5){return function(_0x575cce){if(_0x575cce){return _0x575cce[_0xdff1('0x1d')]()[_0xdff1('0x1e')](function(){var _0x279135=_0x575cce['get']({'plain':!![]});var _0xfe9e1b=_0xdff1('0x1f');return db[_0xdff1('0x20')][_0xdff1('0x1d')]({'where':{'type':_0xfe9e1b,'resourceId':_0x279135['id']}})['then'](function(){return _0x575cce;});})[_0xdff1('0x1e')](function(){_0x255df3['status'](0xcc)[_0xdff1('0x15')]();});}};}function handleEntityNotFound(_0x2f3fdd,_0x459cdd){return function(_0x4b57bb){if(!_0x4b57bb){_0x2f3fdd[_0xdff1('0x13')](0x194);}return _0x4b57bb;};}function handleError(_0x1c482b,_0x26dbaf){_0x26dbaf=_0x26dbaf||0x1f4;return function(_0x46310e){logger[_0xdff1('0x21')](_0x46310e[_0xdff1('0x22')]);if(_0x46310e[_0xdff1('0x23')]){delete _0x46310e[_0xdff1('0x23')];}_0x1c482b[_0xdff1('0x14')](_0x26dbaf)[_0xdff1('0x24')](_0x46310e);};}exports[_0xdff1('0x25')]=function(_0x12f1f5,_0x4d8def){var _0x3dabad={},_0x692445={},_0x43a347={'count':0x0,'rows':[]};var _0x3e74af=_[_0xdff1('0x26')](db[_0xdff1('0x27')][_0xdff1('0x28')],function(_0x273ace){return{'name':_0x273ace[_0xdff1('0x29')],'type':_0x273ace[_0xdff1('0x2a')][_0xdff1('0x2b')]};});_0x692445[_0xdff1('0x2c')]=_[_0xdff1('0x26')](_0x3e74af,'name');_0x692445[_0xdff1('0x2d')]=_['keys'](_0x12f1f5[_0xdff1('0x2d')]);_0x692445[_0xdff1('0x2e')]=_[_0xdff1('0x2f')](_0x692445[_0xdff1('0x2c')],_0x692445[_0xdff1('0x2d')]);_0x3dabad[_0xdff1('0x30')]=_['intersection'](_0x692445[_0xdff1('0x2c')],qs[_0xdff1('0x31')](_0x12f1f5[_0xdff1('0x2d')]['fields']));_0x3dabad[_0xdff1('0x30')]=_0x3dabad[_0xdff1('0x30')][_0xdff1('0x32')]?_0x3dabad[_0xdff1('0x30')]:_0x692445[_0xdff1('0x2c')];if(!_0x12f1f5[_0xdff1('0x2d')][_0xdff1('0x33')](_0xdff1('0x34'))){_0x3dabad[_0xdff1('0x35')]=qs['limit'](_0x12f1f5[_0xdff1('0x2d')][_0xdff1('0x35')]);_0x3dabad[_0xdff1('0x18')]=qs[_0xdff1('0x18')](_0x12f1f5[_0xdff1('0x2d')][_0xdff1('0x18')]);}_0x3dabad[_0xdff1('0x36')]=qs['sort'](_0x12f1f5[_0xdff1('0x2d')][_0xdff1('0x37')]);_0x3dabad['where']=qs[_0xdff1('0x2e')](_[_0xdff1('0x38')](_0x12f1f5[_0xdff1('0x2d')],_0x692445[_0xdff1('0x2e')]),_0x3e74af);if(_0x12f1f5['query'][_0xdff1('0x39')]){_0x3dabad[_0xdff1('0x3a')]=_['merge'](_0x3dabad[_0xdff1('0x3a')],{'$or':_[_0xdff1('0x26')](_0x3e74af,function(_0x3e4231){if(_0x3e4231[_0xdff1('0x2a')]!=='VIRTUAL'){var _0x382ed1={};_0x382ed1[_0x3e4231[_0xdff1('0x23')]]={'$like':'%'+_0x12f1f5[_0xdff1('0x2d')][_0xdff1('0x39')]+'%'};return _0x382ed1;}})});}_0x3dabad=_[_0xdff1('0x3b')]({},_0x3dabad,_0x12f1f5['options']);var _0x5ea3e9={'where':_0x3dabad[_0xdff1('0x3a')]};return db[_0xdff1('0x27')][_0xdff1('0x17')](_0x5ea3e9)[_0xdff1('0x1e')](function(_0x301af7){_0x43a347[_0xdff1('0x17')]=_0x301af7;if(_0x12f1f5[_0xdff1('0x2d')][_0xdff1('0x3c')]){_0x3dabad[_0xdff1('0x3d')]=[{'all':!![]}];}return db[_0xdff1('0x27')][_0xdff1('0x3e')](_0x3dabad);})[_0xdff1('0x1e')](function(_0xa8d368){_0x43a347[_0xdff1('0x3f')]=_0xa8d368;return _0x43a347;})[_0xdff1('0x1e')](respondWithFilteredResult(_0x4d8def,_0x3dabad))[_0xdff1('0x40')](handleError(_0x4d8def,null));};exports[_0xdff1('0x41')]=function(_0x3ace5c,_0x2ca26f){var _0x42cec2={'raw':![],'where':{'id':_0x3ace5c[_0xdff1('0x42')]['id']}},_0x2360e8={};_0x2360e8['model']=_[_0xdff1('0x43')](db[_0xdff1('0x27')][_0xdff1('0x28')]);_0x2360e8[_0xdff1('0x2d')]=_['keys'](_0x3ace5c[_0xdff1('0x2d')]);_0x2360e8[_0xdff1('0x2e')]=_[_0xdff1('0x2f')](_0x2360e8[_0xdff1('0x2c')],_0x2360e8['query']);_0x42cec2['attributes']=_[_0xdff1('0x2f')](_0x2360e8[_0xdff1('0x2c')],qs[_0xdff1('0x31')](_0x3ace5c[_0xdff1('0x2d')][_0xdff1('0x31')]));_0x42cec2[_0xdff1('0x30')]=_0x42cec2['attributes']['length']?_0x42cec2['attributes']:_0x2360e8[_0xdff1('0x2c')];if(_0x3ace5c[_0xdff1('0x2d')]['includeAll']){_0x42cec2[_0xdff1('0x3d')]=[{'all':!![]}];}_0x42cec2=_[_0xdff1('0x3b')]({},_0x42cec2,_0x3ace5c[_0xdff1('0x44')]);return db['Trigger'][_0xdff1('0x45')](_0x42cec2)[_0xdff1('0x1e')](handleEntityNotFound(_0x2ca26f,null))[_0xdff1('0x1e')](respondWithResult(_0x2ca26f,null))[_0xdff1('0x40')](handleError(_0x2ca26f,null));};exports[_0xdff1('0x46')]=function(_0x30b9ed,_0x541420){return db[_0xdff1('0x27')][_0xdff1('0x46')](_0x30b9ed[_0xdff1('0x47')],{})[_0xdff1('0x1e')](function(_0x3b287c){var _0x2753b3=_0x30b9ed[_0xdff1('0x48')][_0xdff1('0x49')]({'plain':!![]});if(!_0x2753b3)throw new Error(_0xdff1('0x4a'));if(_0x2753b3[_0xdff1('0x4b')]===_0xdff1('0x48')){var _0x5932e7=_0x3b287c[_0xdff1('0x49')]({'plain':!![]});var _0x1b582d=_0xdff1('0x1f');return db[_0xdff1('0x4c')][_0xdff1('0x45')]({'where':{'name':_0x1b582d,'userProfileId':_0x2753b3[_0xdff1('0x4d')]},'raw':!![]})[_0xdff1('0x1e')](function(_0x144df3){if(_0x144df3&&_0x144df3[_0xdff1('0x4e')]===0x0){return db[_0xdff1('0x20')][_0xdff1('0x46')]({'name':_0x5932e7[_0xdff1('0x23')],'resourceId':_0x5932e7['id'],'type':_0x144df3['name'],'sectionId':_0x144df3['id']},{})['then'](function(){return _0x3b287c;});}else{return _0x3b287c;}})['catch'](function(_0x16de1b){logger[_0xdff1('0x21')](_0xdff1('0x4f'),_0x16de1b);throw _0x16de1b;});}return _0x3b287c;})[_0xdff1('0x1e')](respondWithResult(_0x541420,0xc9))[_0xdff1('0x40')](handleError(_0x541420,null));};exports['update']=function(_0x1d60ce,_0x4b55e4){if(_0x1d60ce[_0xdff1('0x47')]['id']){delete _0x1d60ce[_0xdff1('0x47')]['id'];}return db[_0xdff1('0x27')][_0xdff1('0x45')]({'where':{'id':_0x1d60ce[_0xdff1('0x42')]['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x4b55e4,null))[_0xdff1('0x1e')](saveUpdates(_0x1d60ce[_0xdff1('0x47')],null))[_0xdff1('0x1e')](respondWithResult(_0x4b55e4,null))[_0xdff1('0x40')](handleError(_0x4b55e4,null));};exports['destroy']=function(_0x2f4ecf,_0x4c2e64){return db[_0xdff1('0x27')][_0xdff1('0x45')]({'where':{'id':_0x2f4ecf[_0xdff1('0x42')]['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x4c2e64,null))[_0xdff1('0x1e')](removeEntity(_0x4c2e64,null))[_0xdff1('0x40')](handleError(_0x4c2e64,null));};exports['addAllCondition']=function(_0xf87600,_0x49c89c,_0x550b01){if(_0xf87600[_0xdff1('0x47')]['id']){delete _0xf87600['body']['id'];}return db[_0xdff1('0x27')][_0xdff1('0x45')]({'where':{'id':_0xf87600[_0xdff1('0x42')]['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x49c89c,null))[_0xdff1('0x1e')](function(_0x10c026){if(_0x10c026){_0xf87600[_0xdff1('0x47')]['TriggerAllId']=_0x10c026['id'];return db[_0xdff1('0x50')][_0xdff1('0x46')](_0xf87600[_0xdff1('0x47')]);}})[_0xdff1('0x1e')](respondWithResult(_0x49c89c,null))[_0xdff1('0x40')](handleError(_0x49c89c,null));};exports['addAnyCondition']=function(_0x1ceebc,_0x3c48f5,_0x9491bd){if(_0x1ceebc[_0xdff1('0x47')]['id']){delete _0x1ceebc['body']['id'];}return db[_0xdff1('0x27')][_0xdff1('0x45')]({'where':{'id':_0x1ceebc[_0xdff1('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c48f5,null))[_0xdff1('0x1e')](function(_0x2dd190){if(_0x2dd190){_0x1ceebc['body'][_0xdff1('0x51')]=_0x2dd190['id'];return db['Condition'][_0xdff1('0x46')](_0x1ceebc['body']);}})['then'](respondWithResult(_0x3c48f5,null))[_0xdff1('0x40')](handleError(_0x3c48f5,null));};exports[_0xdff1('0x52')]=function(_0x15e1e4,_0x44232d,_0x27717f){var _0x4a1ac3={};var _0x277ec4={};var _0x2c25f9;var _0x5618a6;return db[_0xdff1('0x27')][_0xdff1('0x53')]({'where':{'id':_0x15e1e4[_0xdff1('0x42')]['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x44232d,null))[_0xdff1('0x1e')](function(_0x14ee30){if(_0x14ee30){_0x2c25f9=_0x14ee30;_0x277ec4[_0xdff1('0x2c')]=_[_0xdff1('0x43')](db[_0xdff1('0x50')][_0xdff1('0x28')]);_0x277ec4['query']=_[_0xdff1('0x43')](_0x15e1e4[_0xdff1('0x2d')]);_0x277ec4[_0xdff1('0x2e')]=_[_0xdff1('0x2f')](_0x277ec4[_0xdff1('0x2c')],_0x277ec4[_0xdff1('0x2d')]);_0x4a1ac3[_0xdff1('0x30')]=_['intersection'](_0x277ec4[_0xdff1('0x2c')],qs[_0xdff1('0x31')](_0x15e1e4[_0xdff1('0x2d')][_0xdff1('0x31')]));_0x4a1ac3[_0xdff1('0x30')]=_0x4a1ac3[_0xdff1('0x30')][_0xdff1('0x32')]?_0x4a1ac3[_0xdff1('0x30')]:_0x277ec4[_0xdff1('0x2c')];_0x4a1ac3[_0xdff1('0x36')]=qs[_0xdff1('0x37')](_0x15e1e4[_0xdff1('0x2d')]['sort']);_0x4a1ac3[_0xdff1('0x3a')]=qs['filters'](_[_0xdff1('0x38')](_0x15e1e4[_0xdff1('0x2d')],_0x277ec4['filters']));if(_0x15e1e4[_0xdff1('0x2d')][_0xdff1('0x39')]){_0x4a1ac3[_0xdff1('0x3a')]=_[_0xdff1('0x3b')](_0x4a1ac3[_0xdff1('0x3a')],{'$or':_[_0xdff1('0x26')](_0x4a1ac3['attributes'],function(_0x3ef6e1){var _0x37421d={};_0x37421d[_0x3ef6e1]={'$like':'%'+_0x15e1e4['query'][_0xdff1('0x39')]+'%'};return _0x37421d;})});}_0x4a1ac3=_['merge']({},_0x4a1ac3,_0x15e1e4[_0xdff1('0x44')]);return _0x2c25f9[_0xdff1('0x52')](_0x4a1ac3);}})[_0xdff1('0x1e')](function(_0x5deb21){if(_0x5deb21){_0x5618a6=_0x5deb21[_0xdff1('0x32')];if(!_0x15e1e4[_0xdff1('0x2d')][_0xdff1('0x33')](_0xdff1('0x34'))){_0x4a1ac3[_0xdff1('0x35')]=qs[_0xdff1('0x35')](_0x15e1e4['query'][_0xdff1('0x35')]);_0x4a1ac3[_0xdff1('0x18')]=qs[_0xdff1('0x18')](_0x15e1e4[_0xdff1('0x2d')][_0xdff1('0x18')]);}return _0x2c25f9[_0xdff1('0x52')](_0x4a1ac3);}})[_0xdff1('0x1e')](function(_0x42b8cf){if(_0x42b8cf){return _0x42b8cf?{'count':_0x5618a6,'rows':_0x42b8cf}:null;}})['then'](respondWithResult(_0x44232d,null))[_0xdff1('0x40')](handleError(_0x44232d,null));};exports[_0xdff1('0x54')]=function(_0x7092d3,_0x2c9615,_0x2ecf45){var _0x59a8c3={};var _0x1f9f1b={};var _0xa4e4e3;var _0x2b5999;return db[_0xdff1('0x27')]['findOne']({'where':{'id':_0x7092d3['params']['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x2c9615,null))[_0xdff1('0x1e')](function(_0x5a7e05){if(_0x5a7e05){_0xa4e4e3=_0x5a7e05;_0x1f9f1b['model']=_[_0xdff1('0x43')](db[_0xdff1('0x50')][_0xdff1('0x28')]);_0x1f9f1b['query']=_[_0xdff1('0x43')](_0x7092d3[_0xdff1('0x2d')]);_0x1f9f1b[_0xdff1('0x2e')]=_['intersection'](_0x1f9f1b['model'],_0x1f9f1b[_0xdff1('0x2d')]);_0x59a8c3[_0xdff1('0x30')]=_[_0xdff1('0x2f')](_0x1f9f1b['model'],qs[_0xdff1('0x31')](_0x7092d3[_0xdff1('0x2d')][_0xdff1('0x31')]));_0x59a8c3[_0xdff1('0x30')]=_0x59a8c3[_0xdff1('0x30')][_0xdff1('0x32')]?_0x59a8c3[_0xdff1('0x30')]:_0x1f9f1b['model'];_0x59a8c3[_0xdff1('0x36')]=qs[_0xdff1('0x37')](_0x7092d3[_0xdff1('0x2d')][_0xdff1('0x37')]);_0x59a8c3[_0xdff1('0x3a')]=qs[_0xdff1('0x2e')](_[_0xdff1('0x38')](_0x7092d3[_0xdff1('0x2d')],_0x1f9f1b[_0xdff1('0x2e')]));if(_0x7092d3['query'][_0xdff1('0x39')]){_0x59a8c3[_0xdff1('0x3a')]=_['merge'](_0x59a8c3[_0xdff1('0x3a')],{'$or':_[_0xdff1('0x26')](_0x59a8c3[_0xdff1('0x30')],function(_0x4c36d2){var _0x3da5c3={};_0x3da5c3[_0x4c36d2]={'$like':'%'+_0x7092d3[_0xdff1('0x2d')][_0xdff1('0x39')]+'%'};return _0x3da5c3;})});}_0x59a8c3=_['merge']({},_0x59a8c3,_0x7092d3[_0xdff1('0x44')]);return _0xa4e4e3['getAnyConditions'](_0x59a8c3);}})['then'](function(_0x57de6a){if(_0x57de6a){_0x2b5999=_0x57de6a[_0xdff1('0x32')];if(!_0x7092d3[_0xdff1('0x2d')][_0xdff1('0x33')]('nolimit')){_0x59a8c3['limit']=qs[_0xdff1('0x35')](_0x7092d3[_0xdff1('0x2d')]['limit']);_0x59a8c3[_0xdff1('0x18')]=qs['offset'](_0x7092d3[_0xdff1('0x2d')][_0xdff1('0x18')]);}return _0xa4e4e3['getAnyConditions'](_0x59a8c3);}})[_0xdff1('0x1e')](function(_0x30691d){if(_0x30691d){return _0x30691d?{'count':_0x2b5999,'rows':_0x30691d}:null;}})[_0xdff1('0x1e')](respondWithResult(_0x2c9615,null))['catch'](handleError(_0x2c9615,null));};exports['addAction']=function(_0x2dc35d,_0x2f9a96,_0x50b4ce){if(_0x2dc35d[_0xdff1('0x47')]['id']){delete _0x2dc35d[_0xdff1('0x47')]['id'];}return db[_0xdff1('0x27')]['find']({'where':{'id':_0x2dc35d[_0xdff1('0x42')]['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x2f9a96,null))['then'](function(_0x43d1f1){if(_0x43d1f1){_0x2dc35d[_0xdff1('0x47')][_0xdff1('0x55')]=_0x43d1f1['id'];return db[_0xdff1('0x56')]['create'](_0x2dc35d[_0xdff1('0x47')]);}})['then'](respondWithResult(_0x2f9a96,null))[_0xdff1('0x40')](handleError(_0x2f9a96,null));};exports[_0xdff1('0x57')]=function(_0x16df6f,_0x3421d0,_0x2d61a6){var _0x562320={};var _0xd0086a={};var _0x7dd79b;var _0x7ba490;return db[_0xdff1('0x27')][_0xdff1('0x53')]({'where':{'id':_0x16df6f[_0xdff1('0x42')]['id']}})[_0xdff1('0x1e')](handleEntityNotFound(_0x3421d0,null))[_0xdff1('0x1e')](function(_0x5e86d5){if(_0x5e86d5){_0x7dd79b=_0x5e86d5;_0xd0086a[_0xdff1('0x2c')]=_['keys'](db[_0xdff1('0x56')][_0xdff1('0x28')]);_0xd0086a['query']=_['keys'](_0x16df6f[_0xdff1('0x2d')]);_0xd0086a[_0xdff1('0x2e')]=_[_0xdff1('0x2f')](_0xd0086a[_0xdff1('0x2c')],_0xd0086a[_0xdff1('0x2d')]);_0x562320['attributes']=_[_0xdff1('0x2f')](_0xd0086a[_0xdff1('0x2c')],qs[_0xdff1('0x31')](_0x16df6f['query'][_0xdff1('0x31')]));_0x562320[_0xdff1('0x30')]=_0x562320['attributes'][_0xdff1('0x32')]?_0x562320[_0xdff1('0x30')]:_0xd0086a[_0xdff1('0x2c')];_0x562320[_0xdff1('0x36')]=qs[_0xdff1('0x37')](_0x16df6f[_0xdff1('0x2d')][_0xdff1('0x37')]);_0x562320[_0xdff1('0x3a')]=qs[_0xdff1('0x2e')](_[_0xdff1('0x38')](_0x16df6f['query'],_0xd0086a[_0xdff1('0x2e')]));if(_0x16df6f[_0xdff1('0x2d')][_0xdff1('0x39')]){_0x562320[_0xdff1('0x3a')]=_[_0xdff1('0x3b')](_0x562320[_0xdff1('0x3a')],{'$or':_[_0xdff1('0x26')](_0x562320['attributes'],function(_0x4ba05b){var _0x56f37a={};_0x56f37a[_0x4ba05b]={'$like':'%'+_0x16df6f[_0xdff1('0x2d')]['filter']+'%'};return _0x56f37a;})});}_0x562320=_[_0xdff1('0x3b')]({},_0x562320,_0x16df6f['options']);return _0x7dd79b[_0xdff1('0x57')](_0x562320);}})[_0xdff1('0x1e')](function(_0x68bcba){if(_0x68bcba){_0x7ba490=_0x68bcba['length'];if(!_0x16df6f[_0xdff1('0x2d')][_0xdff1('0x33')](_0xdff1('0x34'))){_0x562320['limit']=qs[_0xdff1('0x35')](_0x16df6f[_0xdff1('0x2d')][_0xdff1('0x35')]);_0x562320[_0xdff1('0x18')]=qs[_0xdff1('0x18')](_0x16df6f[_0xdff1('0x2d')][_0xdff1('0x18')]);}return _0x7dd79b[_0xdff1('0x57')](_0x562320);}})['then'](function(_0x1d65fb){if(_0x1d65fb){return _0x1d65fb?{'count':_0x7ba490,'rows':_0x1d65fb}:null;}})[_0xdff1('0x1e')](respondWithResult(_0x3421d0,null))[_0xdff1('0x40')](handleError(_0x3421d0,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 683595a..efbcc22 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x30af23,_0x1b9d6a){var _0x5cea96=function(_0x31be06){while(--_0x31be06){_0x30af23['push'](_0x30af23['shift']());}};_0x5cea96(++_0x1b9d6a);}(_0x7a54,0x106));var _0x47a5=function(_0x21f918,_0x215fe2){_0x21f918=_0x21f918-0x0;var _0x5700ae=_0x7a54[_0x21f918];return _0x5700ae;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','util'];(function(_0x3007b3,_0x226813){var _0x940f4b=function(_0x254d13){while(--_0x254d13){_0x3007b3['push'](_0x3007b3['shift']());}};_0x940f4b(++_0x226813);}(_0xdb28,0x106));var _0x8db2=function(_0x1a56ad,_0x297578){_0x1a56ad=_0x1a56ad-0x0;var _0x3bd899=_0xdb28[_0x1a56ad];return _0x3bd899;};'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 644ee1c..abfe65a 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 _0xf4f4=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','ShowTrigger','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x2e4be2,_0x48c87a){var _0x44bf97=function(_0x58cda7){while(--_0x58cda7){_0x2e4be2['push'](_0x2e4be2['shift']());}};_0x44bf97(++_0x48c87a);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x505dcb,_0x3d3646){_0x505dcb=_0x505dcb-0x0;var _0x3f1944=_0xf4f4[_0x505dcb];return _0x3f1944;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('Trigger,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')]({'raw':_0x1245c4['options']?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![],'where':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'limit':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1c')]||null:null,'include':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_['map'](_0x1245c4['options']['include'],function(_0x272125){return{'model':db[_0x272125[_0x4f4f('0x1e')]],'as':_0x272125['as'],'attributes':_0x272125['attributes'],'include':_0x272125[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x272125[_0x4f4f('0x1d')],function(_0x2ec92a){return{'model':db[_0x2ec92a[_0x4f4f('0x1e')]],'as':_0x2ec92a['as'],'attributes':_0x2ec92a[_0x4f4f('0x1b')],'include':_0x2ec92a[_0x4f4f('0x1d')]?_['map'](_0x2ec92a[_0x4f4f('0x1d')],function(_0x237cf9){return{'model':db[_0x237cf9[_0x4f4f('0x1e')]],'as':_0x237cf9['as'],'attributes':_0x237cf9[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f4f('0xb')](function(_0x4ad33d){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')]('GetTrigger',_0x1245c4,JSON['stringify'](_0x4ad33d));_0x929a0b(_0x4ad33d);})['catch'](function(_0x73b8bb){logger['error'](_0x4f4f('0x15'),_0x73b8bb[_0x4f4f('0x13')],_0x1245c4);_0x2f9397(_0x60ce2[_0x4f4f('0x11')](0x1f4,_0x73b8bb['message']));});});};exports[_0x4f4f('0x20')]=function(_0x1b6f53){var _0x5dd5a3=this;return new Promise(function(_0x413b71,_0x1a551a){return db[_0x4f4f('0x16')]['find']({'raw':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6f53['options']?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'include':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x1b6f53[_0x4f4f('0x18')]['include'],function(_0x4d87fd){return{'model':db[_0x4d87fd[_0x4f4f('0x1e')]],'as':_0x4d87fd['as'],'attributes':_0x4d87fd['attributes'],'include':_0x4d87fd[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4d87fd[_0x4f4f('0x1d')],function(_0x4215da){return{'model':db[_0x4215da[_0x4f4f('0x1e')]],'as':_0x4215da['as'],'attributes':_0x4215da[_0x4f4f('0x1b')],'include':_0x4215da[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4215da[_0x4f4f('0x1d')],function(_0x19785e){return{'model':db[_0x19785e[_0x4f4f('0x1e')]],'as':_0x19785e['as'],'attributes':_0x19785e[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411e94){logger[_0x4f4f('0xc')](_0x4f4f('0x20'),_0x1b6f53);logger[_0x4f4f('0xf')](_0x4f4f('0x20'),_0x1b6f53,JSON[_0x4f4f('0x21')](_0x411e94));_0x413b71(_0x411e94);})[_0x4f4f('0x14')](function(_0x32b077){logger[_0x4f4f('0x11')]('ShowTrigger',_0x32b077[_0x4f4f('0x13')],_0x1b6f53);_0x1a551a(_0x5dd5a3[_0x4f4f('0x11')](0x1f4,_0x32b077[_0x4f4f('0x13')]));});});}; \ No newline at end of file +var _0xfcbb=['info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then'];(function(_0x337d97,_0x19c381){var _0x53aa89=function(_0x1ee5eb){while(--_0x1ee5eb){_0x337d97['push'](_0x337d97['shift']());}};_0x53aa89(++_0x19c381);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x114545,_0x2de1c1){_0x114545=_0x114545-0x0;var _0x293c1a=_0xfcbb[_0x114545];return _0x293c1a;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('Trigger,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')]({'raw':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1a')]===undefined?!![]:![]:!![],'where':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1b')]||null:null,'attributes':_0xba1d6['options']?_0xba1d6['options'][_0xbfcb('0x1c')]||null:null,'limit':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1d')]||null:null,'include':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6['options'][_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1e')],function(_0x1651e5){return{'model':db[_0x1651e5[_0xbfcb('0x20')]],'as':_0x1651e5['as'],'attributes':_0x1651e5[_0xbfcb('0x1c')],'include':_0x1651e5[_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x1651e5[_0xbfcb('0x1e')],function(_0x1ca8c3){return{'model':db[_0x1ca8c3[_0xbfcb('0x20')]],'as':_0x1ca8c3['as'],'attributes':_0x1ca8c3[_0xbfcb('0x1c')],'include':_0x1ca8c3[_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x1ca8c3[_0xbfcb('0x1e')],function(_0x5cd703){return{'model':db[_0x5cd703[_0xbfcb('0x20')]],'as':_0x5cd703['as'],'attributes':_0x5cd703[_0xbfcb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64a69){logger[_0xbfcb('0xb')](_0xbfcb('0x16'),_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x64a69));_0x3404aa(_0x64a69);})[_0xbfcb('0x15')](function(_0x1a5db2){logger[_0xbfcb('0x10')](_0xbfcb('0x16'),_0x1a5db2['message'],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1a5db2[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x21')]=function(_0x43de3c){var _0x1f45fc=this;return new Promise(function(_0x14f6f5,_0x286fb7){return db[_0xbfcb('0x17')][_0xbfcb('0x22')]({'raw':_0x43de3c['options']?_0x43de3c[_0xbfcb('0x19')][_0xbfcb('0x1a')]===undefined?!![]:![]:!![],'where':_0x43de3c[_0xbfcb('0x19')]?_0x43de3c[_0xbfcb('0x19')]['where']||null:null,'attributes':_0x43de3c['options']?_0x43de3c[_0xbfcb('0x19')][_0xbfcb('0x1c')]||null:null,'include':_0x43de3c[_0xbfcb('0x19')]?_0x43de3c[_0xbfcb('0x19')][_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x43de3c[_0xbfcb('0x19')]['include'],function(_0x504d81){return{'model':db[_0x504d81['model']],'as':_0x504d81['as'],'attributes':_0x504d81[_0xbfcb('0x1c')],'include':_0x504d81['include']?_[_0xbfcb('0x1f')](_0x504d81[_0xbfcb('0x1e')],function(_0x505b0d){return{'model':db[_0x505b0d['model']],'as':_0x505b0d['as'],'attributes':_0x505b0d[_0xbfcb('0x1c')],'include':_0x505b0d[_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x505b0d[_0xbfcb('0x1e')],function(_0x530208){return{'model':db[_0x530208[_0xbfcb('0x20')]],'as':_0x530208['as'],'attributes':_0x530208[_0xbfcb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47ac13){logger[_0xbfcb('0xb')]('ShowTrigger',_0x43de3c);logger['debug'](_0xbfcb('0x21'),_0x43de3c,JSON[_0xbfcb('0xf')](_0x47ac13));_0x14f6f5(_0x47ac13);})[_0xbfcb('0x15')](function(_0x42ad5d){logger['error'](_0xbfcb('0x21'),_0x42ad5d[_0xbfcb('0x13')],_0x43de3c);_0x286fb7(_0x1f45fc[_0xbfcb('0x10')](0x1f4,_0x42ad5d[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3ad8551..b2b300c 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 _0x34e8=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone'];(function(_0x255019,_0x4d7269){var _0x560331=function(_0x41bf8f){while(--_0x41bf8f){_0x255019['push'](_0x255019['shift']());}};_0x560331(++_0x4d7269);}(_0x34e8,0x12c));var _0x834e=function(_0x5b1a08,_0x95fb0){_0x5b1a08=_0x5b1a08-0x0;var _0x19c178=_0x34e8[_0x5b1a08];return _0x19c178;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')](_0x834e('0xd'),auth[_0x834e('0xa')](),controller[_0x834e('0xe')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x00bb=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','/:id','isAuthenticated','show','post','/:id/clone','create','put','delete','exports','multer','util','path','express'];(function(_0x4b6a87,_0x27d4c7){var _0x4d27f9=function(_0x50839c){while(--_0x50839c){_0x4b6a87['push'](_0x4b6a87['shift']());}};_0x4d27f9(++_0x27d4c7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0xb')](_0xb00b('0xc'),auth[_0xb00b('0x9')](),controller['clone']);router['post']('/',auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller['update']);router[_0xb00b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb00b('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 18ac302..b6c5ef2 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 _0x1275=['passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','shortinfo','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1275,0x6b));var _0x5127=function(_0x3f82a5,_0x554c14){_0x3f82a5=_0x3f82a5-0x0;var _0x36543b=_0x1275[_0x3f82a5];return _0x36543b;};'use strict';var Sequelize=require(_0x5127('0x0'));module[_0x5127('0x1')]={'name':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5127('0x3'),_0x5127('0x4'),_0x5127('0x5')),'allowNull':![],'defaultValue':_0x5127('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5127('0x6')},'callingpres':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x5127('0x9'),_0x5127('0xa'),_0x5127('0xb'),_0x5127('0xc'),_0x5127('0xd'))},'deny':{'type':Sequelize[_0x5127('0x2')]},'permit':{'type':Sequelize[_0x5127('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5127('0x2')]},'remotesecret':{'type':Sequelize[_0x5127('0x2')]},'transport':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0xe'),'set':function(_0x303dcf){this[_0x5127('0xf')](_0x5127('0x10'),_0x303dcf?_0x303dcf[_0x5127('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x5127('0x10'))?this['getDataValue'](_0x5127('0x10'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5127('0x7')]('rfc2833','info',_0x5127('0x12'),_0x5127('0x13'),_0x5127('0x14')),'defaultValue':_0x5127('0x15')},'directmedia':{'type':Sequelize[_0x5127('0x7')]('yes','no',_0x5127('0x16'),_0x5127('0x17'),_0x5127('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5127('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x1a'),'set':function(_0x50298d){this[_0x5127('0xf')](_0x5127('0x1b'),_0x50298d?_0x50298d['join'](','):null);},'get':function(){return this[_0x5127('0x1c')]('nat')?this[_0x5127('0x1c')](_0x5127('0x1b'))[_0x5127('0x1d')](','):null;},'comment':_0x5127('0x1e')},'callgroup':{'type':Sequelize[_0x5127('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5127('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5127('0x2')]},'language':{'type':Sequelize[_0x5127('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x1f')},'allow':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x52ef84){this[_0x5127('0xf')](_0x5127('0x20'),_0x52ef84?_0x52ef84['join'](';'):_0x5127('0x21'));},'get':function(){return this[_0x5127('0x1c')](_0x5127('0x20'))?this[_0x5127('0x1c')](_0x5127('0x20'))[_0x5127('0x1d')](';'):null;},'comment':_0x5127('0x22')},'autoframing':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'insecure':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x23'),'set':function(_0x3ffb06){this[_0x5127('0xf')](_0x5127('0x24'),_0x3ffb06?_0x3ffb06['join'](','):null);},'get':function(){return this['getDataValue'](_0x5127('0x24'))?this['getDataValue']('insecure')['split'](','):null;},'comment':_0x5127('0x25')},'trustrpid':{'type':Sequelize[_0x5127('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5127('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no',_0x5127('0x26'))},'promiscredir':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'accountcode':{'type':Sequelize[_0x5127('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x28')},'amaflags':{'type':Sequelize[_0x5127('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no'),'defaultValue':_0x5127('0x19')},'busylevel':{'type':Sequelize[_0x5127('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x5127('0x7')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5127('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'mailbox':{'type':Sequelize[_0x5127('0x2')]},'session_timers':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x29'),_0x5127('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x5127('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x5127('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x2b'),_0x5127('0x2c')),'defaultValue':_0x5127('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x5127('0x2')]},'fromuser':{'type':Sequelize[_0x5127('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no'),'defaultValue':_0x5127('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x5127('0x2')]},'defaultuser':{'type':Sequelize[_0x5127('0x2')]},'rtptimeout':{'type':Sequelize[_0x5127('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5127('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no',_0x5127('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5127('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x5127('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x5127('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x5127('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5127('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5127('0x2')]},'maxforwards':{'type':Sequelize[_0x5127('0x27')](0xb)},'encryption':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no')},'force_avp':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'icesupport':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x5127('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5127('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x5127('0x2')]},'dtlscafile':{'type':Sequelize[_0x5127('0x2')]},'dtlscapath':{'type':Sequelize[_0x5127('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x5127('0x2e'),_0x5127('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x5127('0x2')]},'call_limit':{'type':Sequelize[_0x5127('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x5127('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x5127('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x30')},'canreinvite':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no',_0x5127('0x16'),_0x5127('0x17'),_0x5127('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5127('0x2')]},'otherFields':{'type':Sequelize[_0x5127('0x2')]},'active':{'type':Sequelize[_0x5127('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5127('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x613d=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','certificate','active','passive','BOOLEAN','exports','STRING','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport'];(function(_0x19290b,_0x7b512f){var _0x2f6c60=function(_0x137abc){while(--_0x137abc){_0x19290b['push'](_0x19290b['shift']());}};_0x2f6c60(++_0x7b512f);}(_0x613d,0xd9));var _0xd613=function(_0x2c094f,_0xe5a1b0){_0x2c094f=_0x2c094f-0x0;var _0x2f7176=_0x613d[_0x2c094f];return _0x2f7176;};'use strict';var Sequelize=require('sequelize');module[_0xd613('0x0')]={'name':{'type':Sequelize[_0xd613('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x3'),_0xd613('0x4'),'peer'),'allowNull':![],'defaultValue':_0xd613('0x3')},'context':{'type':Sequelize[_0xd613('0x1')],'allowNull':![],'defaultValue':_0xd613('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0xd613('0x6'),_0xd613('0x7'),_0xd613('0x8'),_0xd613('0x9'),_0xd613('0xa'),_0xd613('0xb'),_0xd613('0xc'),_0xd613('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xd613('0x1')]},'md5secret':{'type':Sequelize[_0xd613('0x1')]},'remotesecret':{'type':Sequelize[_0xd613('0x1')]},'transport':{'type':Sequelize[_0xd613('0x1')],'defaultValue':_0xd613('0xe'),'set':function(_0xf60fb9){this['setDataValue']('transport',_0xf60fb9?_0xf60fb9[_0xd613('0xf')](','):null);},'get':function(){return this[_0xd613('0x10')](_0xd613('0x11'))?this['getDataValue']('transport')[_0xd613('0x12')](','):null;},'comment':_0xd613('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd613('0x14'),'info','shortinfo',_0xd613('0x15'),'auto'),'defaultValue':_0xd613('0x14')},'directmedia':{'type':Sequelize[_0xd613('0x2')]('yes','no',_0xd613('0x16'),_0xd613('0x17'),_0xd613('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd613('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd613('0x1')]},'directmediadeny':{'type':Sequelize[_0xd613('0x1')]},'nat':{'type':Sequelize[_0xd613('0x1')],'defaultValue':_0xd613('0x19'),'set':function(_0x3dfbe0){this[_0xd613('0x1a')](_0xd613('0x1b'),_0x3dfbe0?_0x3dfbe0[_0xd613('0xf')](','):null);},'get':function(){return this[_0xd613('0x10')](_0xd613('0x1b'))?this['getDataValue'](_0xd613('0x1b'))[_0xd613('0x12')](','):null;},'comment':_0xd613('0x1c')},'callgroup':{'type':Sequelize[_0xd613('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xd613('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xd613('0x1')]},'language':{'type':Sequelize[_0xd613('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd613('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd613('0x1')],'defaultValue':_0xd613('0x1d')},'allow':{'type':Sequelize[_0xd613('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xcbed4f){this['setDataValue']('allow',_0xcbed4f?_0xcbed4f[_0xd613('0xf')](';'):_0xd613('0x1e'));},'get':function(){return this[_0xd613('0x10')]('allow')?this['getDataValue']('allow')[_0xd613('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'insecure':{'type':Sequelize[_0xd613('0x1')],'defaultValue':'port,invite','set':function(_0x463666){this[_0xd613('0x1a')](_0xd613('0x20'),_0x463666?_0x463666[_0xd613('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xd613('0x20'))?this[_0xd613('0x10')](_0xd613('0x20'))[_0xd613('0x12')](','):null;},'comment':_0xd613('0x21')},'trustrpid':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd613('0x2')]('yes','no',_0xd613('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no')},'useclientcode':{'type':Sequelize[_0xd613('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xd613('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xd613('0x24')},'amaflags':{'type':Sequelize[_0xd613('0x1')]},'callcounter':{'type':Sequelize[_0xd613('0x2')]('yes','no'),'defaultValue':_0xd613('0x1f')},'busylevel':{'type':Sequelize[_0xd613('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'allowsubscribe':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no')},'subscribecontext':{'type':Sequelize[_0xd613('0x1')]},'template':{'type':Sequelize[_0xd613('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no',_0xd613('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x26'),'refuse',_0xd613('0x27'))},'session_expires':{'type':Sequelize[_0xd613('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xd613('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x28'),_0xd613('0x29')),'defaultValue':_0xd613('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xd613('0x1')]},'regexten':{'type':Sequelize[_0xd613('0x1')]},'fromdomain':{'type':Sequelize[_0xd613('0x1')]},'fromuser':{'type':Sequelize[_0xd613('0x1')]},'port':{'type':Sequelize[_0xd613('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd613('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd613('0x1')]},'defaultuser':{'type':Sequelize[_0xd613('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd613('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no',_0xd613('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd613('0x1')]},'callbackextension':{'type':Sequelize[_0xd613('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xd613('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xd613('0x1')]},'contactdeny':{'type':Sequelize[_0xd613('0x1')]},'contactacl':{'type':Sequelize[_0xd613('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xd613('0x1')]},'use_q850_reason':{'type':Sequelize[_0xd613('0x1')]},'maxforwards':{'type':Sequelize[_0xd613('0x23')](0xb)},'encryption':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'force_avp':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no')},'dtlsenable':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'dtlsverify':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no','fingerprint',_0xd613('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xd613('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xd613('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xd613('0x1')]},'dtlscapath':{'type':Sequelize[_0xd613('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xd613('0x2c'),_0xd613('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd613('0x1')]},'usereqphone':{'type':Sequelize[_0xd613('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd613('0x1')]},'recordofffeature':{'type':Sequelize[_0xd613('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xd613('0x1f'),'no')},'subscribemwi':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd613('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd613('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xd613('0x2')](_0xd613('0x1f'),'no','nonat',_0xd613('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd613('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd613('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 9eaf6d8..4498367 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 _0xd3f5=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','clone','createdAt','updatedAt','omit','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x18bf5f,_0x2e048c){var _0x3fa7a5=function(_0x2ad0f6){while(--_0x2ad0f6){_0x18bf5f['push'](_0x18bf5f['shift']());}};_0x3fa7a5(++_0x2e048c);}(_0xd3f5,0x147));var _0x5d3f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd3f5[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x5d3f('0x0'));var emlformat=require(_0x5d3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5d3f('0x2'));var jsonpatch=require(_0x5d3f('0x3'));var rp=require(_0x5d3f('0x4'));var moment=require(_0x5d3f('0x5'));var BPromise=require(_0x5d3f('0x6'));var Mustache=require(_0x5d3f('0x7'));var util=require(_0x5d3f('0x8'));var path=require(_0x5d3f('0x9'));var sox=require('sox');var csv=require(_0x5d3f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5d3f('0xb'));var squel=require(_0x5d3f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d3f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5d3f('0xa'));var querystring=require('querystring');var Papa=require(_0x5d3f('0xe'));var Redis=require('ioredis');var authService=require(_0x5d3f('0xf'));var qs=require(_0x5d3f('0x10'));var as=require(_0x5d3f('0x11'));var hardwareService=require(_0x5d3f('0x12'));var logger=require(_0x5d3f('0x13'))(_0x5d3f('0x14'));var utils=require(_0x5d3f('0x15'));var config=require(_0x5d3f('0x16'));var db=require(_0x5d3f('0x17'))['db'];var jayson=require(_0x5d3f('0x18'));var client=jayson[_0x5d3f('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x2359ae,_0x3135c8,_0x1def4d){if(_0x1def4d){var _0x4171f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4171f3['test'](_0x3135c8)){return _0x2359ae;}else{throw new db[(_0x5d3f('0x1a'))][(_0x5d3f('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 _0x2359ae;}}function respondWithRpcPromise(_0x1d2189,_0x5d1342,_0xcb108e,_0x3e03ed){return new BPromise(function(_0x1f55bb,_0x166b95){var _0x3ac7d5=_0x3e03ed||client;return _0x3ac7d5[_0x5d3f('0x1c')](_0x1d2189,_0xcb108e)[_0x5d3f('0x1d')](function(_0x56b671){logger[_0x5d3f('0x1e')]('Trunk,\x20%s,\x20%s',_0x5d1342,_0x5d3f('0x1f'));logger[_0x5d3f('0x20')](_0x5d3f('0x21'),_0x5d1342,_0x5d3f('0x1f'),JSON['stringify'](_0x56b671));if(_0x56b671[_0x5d3f('0x22')]){if(_0x56b671['error'][_0x5d3f('0x23')]===0x1f4){logger[_0x5d3f('0x22')]('Trunk,\x20%s,\x20%s',_0x5d1342,_0x56b671['error'][_0x5d3f('0x24')]);return _0x166b95(_0x56b671[_0x5d3f('0x22')][_0x5d3f('0x24')]);}logger[_0x5d3f('0x22')]('Trunk,\x20%s,\x20%s',_0x5d1342,_0x56b671['error'][_0x5d3f('0x24')]);return _0x1f55bb(_0x56b671[_0x5d3f('0x22')][_0x5d3f('0x24')]);}else{logger['info'](_0x5d3f('0x25'),_0x5d1342,_0x5d3f('0x1f'));_0x1f55bb(_0x56b671['result'][_0x5d3f('0x24')]);}})['catch'](function(_0x14a8f0){logger['error'](_0x5d3f('0x25'),_0x5d1342,_0x14a8f0);_0x166b95(_0x14a8f0);});});}function respondWithStatusCode(_0x65449,_0x1544e3){_0x1544e3=_0x1544e3||0xcc;return function(_0x37345b){if(_0x37345b){return _0x65449[_0x5d3f('0x26')](_0x1544e3);}return _0x65449[_0x5d3f('0x27')](_0x1544e3)['end']();};}function respondWithResult(_0x29d2b8,_0x3f7f7f){_0x3f7f7f=_0x3f7f7f||0xc8;return function(_0x2e0f23){if(_0x2e0f23){return _0x29d2b8['status'](_0x3f7f7f)[_0x5d3f('0x28')](_0x2e0f23);}};}function respondWithFilteredResult(_0x4ecf3c,_0x5f41c3){return function(_0x4ced45){if(_0x4ced45){var _0x2f2c74=_0x4ced45[_0x5d3f('0x29')],_0x23469a=_0x5f41c3[_0x5d3f('0x2a')],_0xa9a943=_0x5f41c3[_0x5d3f('0x2a')]+_0x5f41c3[_0x5d3f('0x2b')],_0x52aaf2;if(_0xa9a943>=_0x2f2c74){_0xa9a943=_0x2f2c74;_0x52aaf2=0xc8;}else{_0x52aaf2=0xce;}_0x4ecf3c['status'](_0x52aaf2);return _0x4ecf3c['set'](_0x5d3f('0x2c'),_0x23469a+'-'+_0xa9a943+'/'+_0x2f2c74)[_0x5d3f('0x28')](_0x4ced45);}return null;};}function patchUpdates(_0x5dd308){return function(_0x5407d4){try{jsonpatch[_0x5d3f('0x2d')](_0x5407d4,_0x5dd308,!![]);}catch(_0x3cf1ae){return BPromise['reject'](_0x3cf1ae);}return _0x5407d4[_0x5d3f('0x2e')]();};}function saveUpdates(_0x41ace6,_0x702dfd){return function(_0x3bd68f){if(_0x3bd68f){return _0x3bd68f[_0x5d3f('0x2f')](_0x41ace6)[_0x5d3f('0x1d')](function(_0x3adafc){return _0x3adafc;});}return null;};}function removeEntity(_0x13e954,_0x4a813a){return function(_0x150077){if(_0x150077){return _0x150077[_0x5d3f('0x30')]()[_0x5d3f('0x1d')](function(){var _0x5d80c2=_0x150077[_0x5d3f('0x31')]({'plain':!![]});var _0xf6a9ff=_0x5d3f('0x32');return db[_0x5d3f('0x33')][_0x5d3f('0x30')]({'where':{'type':_0xf6a9ff,'resourceId':_0x5d80c2['id']}})[_0x5d3f('0x1d')](function(){return _0x150077;});})[_0x5d3f('0x1d')](function(){_0x13e954[_0x5d3f('0x27')](0xcc)[_0x5d3f('0x34')]();});}};}function handleEntityNotFound(_0x5aa315,_0xf39782){return function(_0x4fa28b){if(!_0x4fa28b){_0x5aa315[_0x5d3f('0x26')](0x194);}return _0x4fa28b;};}function handleError(_0x3c11ba,_0x4576ec){_0x4576ec=_0x4576ec||0x1f4;return function(_0x4f17cd){logger[_0x5d3f('0x22')](_0x4f17cd[_0x5d3f('0x35')]);if(_0x4f17cd['name']){delete _0x4f17cd[_0x5d3f('0x36')];}_0x3c11ba[_0x5d3f('0x27')](_0x4576ec)[_0x5d3f('0x37')](_0x4f17cd);};}exports[_0x5d3f('0x38')]=function(_0x3dccc9,_0x8313f2){var _0x426392={},_0x390810={},_0x547940={'count':0x0,'rows':[]};var _0x338341=_[_0x5d3f('0x39')](db[_0x5d3f('0x3a')][_0x5d3f('0x3b')],function(_0x337554){return{'name':_0x337554[_0x5d3f('0x3c')],'type':_0x337554[_0x5d3f('0x3d')][_0x5d3f('0x3e')]};});_0x390810['model']=_[_0x5d3f('0x39')](_0x338341,'name');_0x390810[_0x5d3f('0x3f')]=_['keys'](_0x3dccc9[_0x5d3f('0x3f')]);_0x390810[_0x5d3f('0x40')]=_[_0x5d3f('0x41')](_0x390810['model'],_0x390810['query']);_0x426392[_0x5d3f('0x42')]=_[_0x5d3f('0x41')](_0x390810[_0x5d3f('0x43')],qs[_0x5d3f('0x44')](_0x3dccc9['query'][_0x5d3f('0x44')]));_0x426392[_0x5d3f('0x42')]=_0x426392[_0x5d3f('0x42')][_0x5d3f('0x45')]?_0x426392['attributes']:_0x390810['model'];if(!_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x46')](_0x5d3f('0x47'))){_0x426392[_0x5d3f('0x2b')]=qs['limit'](_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x2b')]);_0x426392[_0x5d3f('0x2a')]=qs[_0x5d3f('0x2a')](_0x3dccc9[_0x5d3f('0x3f')]['offset']);}_0x426392[_0x5d3f('0x48')]=qs[_0x5d3f('0x49')](_0x3dccc9['query'][_0x5d3f('0x49')]);_0x426392[_0x5d3f('0x4a')]=qs[_0x5d3f('0x40')](_[_0x5d3f('0x4b')](_0x3dccc9['query'],_0x390810[_0x5d3f('0x40')]),_0x338341);if(_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x4c')]){_0x426392['where']=_[_0x5d3f('0x4d')](_0x426392[_0x5d3f('0x4a')],{'$or':_[_0x5d3f('0x39')](_0x338341,function(_0xa9313e){if(_0xa9313e[_0x5d3f('0x3d')]!==_0x5d3f('0x4e')){var _0x1339c1={};_0x1339c1[_0xa9313e[_0x5d3f('0x36')]]={'$like':'%'+_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x4c')]+'%'};return _0x1339c1;}})});}_0x426392=_[_0x5d3f('0x4d')]({},_0x426392,_0x3dccc9[_0x5d3f('0x4f')]);var _0x45c3da={'where':_0x426392['where']};return db[_0x5d3f('0x3a')][_0x5d3f('0x29')](_0x45c3da)[_0x5d3f('0x1d')](function(_0x3dcd0b){_0x547940['count']=_0x3dcd0b;if(_0x3dccc9[_0x5d3f('0x3f')]['includeAll']){_0x426392[_0x5d3f('0x50')]=[{'all':!![]}];}return db['Trunk'][_0x5d3f('0x51')](_0x426392);})[_0x5d3f('0x1d')](function(_0x398ae2){_0x547940[_0x5d3f('0x52')]=_0x398ae2;return _0x547940;})[_0x5d3f('0x1d')](respondWithFilteredResult(_0x8313f2,_0x426392))[_0x5d3f('0x53')](handleError(_0x8313f2,null));};exports[_0x5d3f('0x54')]=function(_0x1d1d8f,_0x4df43e){var _0x1debf8={'raw':![],'where':{'id':_0x1d1d8f[_0x5d3f('0x55')]['id']}},_0x3aeb6d={};_0x3aeb6d['model']=_['keys'](db[_0x5d3f('0x3a')][_0x5d3f('0x3b')]);_0x3aeb6d[_0x5d3f('0x3f')]=_[_0x5d3f('0x56')](_0x1d1d8f[_0x5d3f('0x3f')]);_0x3aeb6d[_0x5d3f('0x40')]=_[_0x5d3f('0x41')](_0x3aeb6d[_0x5d3f('0x43')],_0x3aeb6d[_0x5d3f('0x3f')]);_0x1debf8[_0x5d3f('0x42')]=_['intersection'](_0x3aeb6d[_0x5d3f('0x43')],qs[_0x5d3f('0x44')](_0x1d1d8f[_0x5d3f('0x3f')][_0x5d3f('0x44')]));_0x1debf8[_0x5d3f('0x42')]=_0x1debf8[_0x5d3f('0x42')][_0x5d3f('0x45')]?_0x1debf8['attributes']:_0x3aeb6d[_0x5d3f('0x43')];if(_0x1d1d8f[_0x5d3f('0x3f')][_0x5d3f('0x57')]){_0x1debf8[_0x5d3f('0x50')]=[{'all':!![]}];}_0x1debf8=_['merge']({},_0x1debf8,_0x1d1d8f[_0x5d3f('0x4f')]);return db[_0x5d3f('0x3a')][_0x5d3f('0x58')](_0x1debf8)[_0x5d3f('0x1d')](handleEntityNotFound(_0x4df43e,null))['then'](respondWithResult(_0x4df43e,null))[_0x5d3f('0x53')](handleError(_0x4df43e,null));};exports[_0x5d3f('0x59')]=function(_0x350ca1,_0x1a7799){var _0x2bf52f={'where':{'id':_0x350ca1['params']['id']}},_0x286fe5={};_0x286fe5[_0x5d3f('0x43')]=_['keys'](db[_0x5d3f('0x3a')][_0x5d3f('0x3b')]);_0x2bf52f[_0x5d3f('0x42')]=_['intersection'](_0x286fe5[_0x5d3f('0x43')],qs[_0x5d3f('0x44')](_0x350ca1[_0x5d3f('0x3f')]['fields']));_0x2bf52f[_0x5d3f('0x42')]=_0x2bf52f[_0x5d3f('0x42')][_0x5d3f('0x45')]?_0x2bf52f['attributes']:_0x286fe5[_0x5d3f('0x43')];if(_0x350ca1[_0x5d3f('0x3f')][_0x5d3f('0x57')]){_0x2bf52f['include']=[{'all':!![]}];}_0x2bf52f=_['merge']({},_0x2bf52f,_0x350ca1['options']);return db['Trunk'][_0x5d3f('0x58')](_0x2bf52f)[_0x5d3f('0x1d')](handleEntityNotFound(_0x1a7799,null))[_0x5d3f('0x1d')](function(_0x232745){if(_0x232745){var _0x22cc64=_0x232745['get']({'plain':!![]});_0x22cc64=qs['omit'](_0x22cc64,['id',_0x5d3f('0x5a'),_0x5d3f('0x5b')]);_0x350ca1['body']=_[_0x5d3f('0x5c')](_0x350ca1[_0x5d3f('0x5d')],['id',_0x5d3f('0x5a'),_0x5d3f('0x5b')]);return db[_0x5d3f('0x3a')][_0x5d3f('0x5e')](_[_0x5d3f('0x4d')](_0x22cc64,_0x350ca1[_0x5d3f('0x5d')]),{'include':_0x350ca1['query'][_0x5d3f('0x57')]?[{'all':!![]}]:undefined})[_0x5d3f('0x1d')](function(_0xe0acb1){var _0x2f689c=_0x350ca1[_0x5d3f('0x5f')]['get']({'plain':!![]});if(!_0x2f689c)throw new Error(_0x5d3f('0x60'));if(_0x2f689c['role']==='user'){var _0xb95f3=_0xe0acb1[_0x5d3f('0x31')]({'plain':!![]});var _0x3f1e86=_0x5d3f('0x32');return db[_0x5d3f('0x61')]['find']({'where':{'name':_0x3f1e86,'userProfileId':_0x2f689c[_0x5d3f('0x62')]},'raw':!![]})[_0x5d3f('0x1d')](function(_0x1924d1){if(_0x1924d1&&_0x1924d1[_0x5d3f('0x63')]===0x0){return db[_0x5d3f('0x33')][_0x5d3f('0x5e')]({'name':_0xb95f3[_0x5d3f('0x36')],'resourceId':_0xb95f3['id'],'type':_0x1924d1[_0x5d3f('0x36')],'sectionId':_0x1924d1['id']},{})['then'](function(){return _0xe0acb1;});}else{return _0xe0acb1;}})['catch'](function(_0x29fb86){logger['error'](_0x5d3f('0x64'),_0x29fb86);throw _0x29fb86;});}return _0xe0acb1;});}})['then'](respondWithResult(_0x1a7799,0xc9))[_0x5d3f('0x53')](handleError(_0x1a7799,null));};exports[_0x5d3f('0x5e')]=function(_0x39fbfa,_0xeadc7c,_0x1c9f44){var _0x5c46da;return db[_0x5d3f('0x3a')][_0x5d3f('0x5e')](_0x39fbfa['body'],{'raw':!![]})[_0x5d3f('0x1d')](function(_0x43e96c){_0x5c46da=_0x43e96c;return db['Trunk'][_0x5d3f('0x51')]({'raw':!![]});})[_0x5d3f('0x1d')](function(_0x3a5fec){var _0x1500c7=fs[_0x5d3f('0x65')](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x68')),_0x5d3f('0x69'));var _0x3eef35=fs['readFileSync'](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x6a')),_0x5d3f('0x69'));var _0x3ad092=ejs[_0x5d3f('0x6b')](_0x1500c7,{'trunks':_0x3a5fec||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6d'),_0x3ad092);if(_0x5c46da[_0x5d3f('0x6e')]){var _0x46efbe=ejs['render'](_0x3eef35,{'trunks':_0x3a5fec||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6f'),_0x46efbe);}})[_0x5d3f('0x1d')](function(){return respondWithRpcPromise(_0x5d3f('0x70'),_0x5d3f('0x5e'),{'module':_0x5d3f('0x71')});})[_0x5d3f('0x1d')](function(){var _0x297a27=_0x39fbfa[_0x5d3f('0x5f')]['get']({'plain':!![]});if(!_0x297a27)throw new Error(_0x5d3f('0x60'));if(_0x297a27[_0x5d3f('0x72')]===_0x5d3f('0x5f')){var _0x58d348=_0x5c46da[_0x5d3f('0x31')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x5d3f('0x32'),'userProfileId':_0x297a27[_0x5d3f('0x62')]},'raw':!![]})[_0x5d3f('0x1d')](function(_0x192429){if(_0x192429&&_0x192429[_0x5d3f('0x63')]===0x0){return db[_0x5d3f('0x33')][_0x5d3f('0x5e')]({'name':_0x58d348['name'],'resourceId':_0x58d348['id'],'type':_0x192429[_0x5d3f('0x36')],'sectionId':_0x192429['id']},{})['then'](function(){return _0x5c46da;});}else{return _0x5c46da;}})[_0x5d3f('0x53')](function(_0x41e010){logger[_0x5d3f('0x22')](_0x5d3f('0x64'),_0x41e010);throw _0x41e010;});}return _0x5c46da;})[_0x5d3f('0x1d')](respondWithResult(_0xeadc7c,0xc9))[_0x5d3f('0x53')](handleError(_0xeadc7c,null));};exports[_0x5d3f('0x2f')]=function(_0x1b5a9d,_0x2d97bf,_0x19d074){var _0x21c5c0;return db[_0x5d3f('0x3a')][_0x5d3f('0x58')]({'where':{'id':_0x1b5a9d[_0x5d3f('0x55')]['id']}})[_0x5d3f('0x1d')](handleEntityNotFound(_0x2d97bf,null))[_0x5d3f('0x1d')](saveUpdates(_0x1b5a9d['body'],null))[_0x5d3f('0x1d')](function(_0x4909f2){if(_0x4909f2){_0x21c5c0=_0x4909f2;return db[_0x5d3f('0x3a')][_0x5d3f('0x51')]({'raw':!![]});}})[_0x5d3f('0x1d')](function(_0x3600c4){if(_0x3600c4){var _0x568cc7=fs['readFileSync'](path[_0x5d3f('0x66')](config['root'],_0x5d3f('0x68')),_0x5d3f('0x69'));var _0x426e0c=fs[_0x5d3f('0x65')](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x6a')),'utf8');var _0x5116de=ejs[_0x5d3f('0x6b')](_0x568cc7,{'trunks':_0x3600c4||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6d'),_0x5116de);var _0xa3546d=ejs[_0x5d3f('0x6b')](_0x426e0c,{'trunks':_0x3600c4||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6f'),_0xa3546d);return respondWithRpcPromise(_0x5d3f('0x70'),_0x5d3f('0x2f'),{'module':'chan_sip.so'});}return null;})[_0x5d3f('0x1d')](function(_0x2175b0){if(_0x2175b0){return _0x21c5c0;}})[_0x5d3f('0x1d')](respondWithResult(_0x2d97bf,null))[_0x5d3f('0x53')](handleError(_0x2d97bf,null));};exports[_0x5d3f('0x30')]=function(_0x3735b5,_0x43e2fe,_0x3c18c1){var _0x5bcb38;return db[_0x5d3f('0x3a')][_0x5d3f('0x58')]({'where':{'id':_0x3735b5[_0x5d3f('0x55')]['id']}})[_0x5d3f('0x1d')](handleEntityNotFound(_0x43e2fe,null))['then'](removeEntity(_0x43e2fe,null))['then'](function(){return db['Trunk'][_0x5d3f('0x51')]({'raw':!![]});})['then'](function(_0x14d436){var _0xd74eda=fs['readFileSync'](path['join'](config[_0x5d3f('0x67')],_0x5d3f('0x68')),_0x5d3f('0x69'));var _0x2dab50=fs[_0x5d3f('0x65')](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x6a')),_0x5d3f('0x69'));var _0x5f21e8=ejs[_0x5d3f('0x6b')](_0xd74eda,{'trunks':_0x14d436});var _0x3ea27e=ejs[_0x5d3f('0x6b')](_0x2dab50,{'trunks':_0x14d436});fs[_0x5d3f('0x6c')](_0x5d3f('0x6d'),_0x5f21e8);fs[_0x5d3f('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x3ea27e);return respondWithRpcPromise('Reload','destroy',{'module':_0x5d3f('0x71')});})[_0x5d3f('0x53')](handleError(_0x43e2fe,null));}; \ No newline at end of file +var _0x803f=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','Trunks','UserProfileResource','end','name','send','index','map','Trunk','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','keys','include','find','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','params','findAll','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x803f,0x64));var _0xf803=function(_0x43d4ef,_0xa5eaff){_0x43d4ef=_0x43d4ef-0x0;var _0x3369f2=_0x803f[_0x43d4ef];return _0x3369f2;};'use strict';var pdf=require(_0xf803('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf803('0x1'));var zipdir=require(_0xf803('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf803('0x3'));var moment=require(_0xf803('0x4'));var BPromise=require(_0xf803('0x5'));var Mustache=require(_0xf803('0x6'));var util=require(_0xf803('0x7'));var path=require('path');var sox=require(_0xf803('0x8'));var csv=require(_0xf803('0x9'));var ejs=require(_0xf803('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf803('0xb'));var crypto=require(_0xf803('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf803('0xd'));var toCsv=require(_0xf803('0x9'));var querystring=require(_0xf803('0xe'));var Papa=require('papaparse');var Redis=require(_0xf803('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf803('0x10'));var as=require(_0xf803('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf803('0x12'))(_0xf803('0x13'));var utils=require(_0xf803('0x14'));var config=require(_0xf803('0x15'));var db=require(_0xf803('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf803('0x17')]({'port':0x232a});function checkPasswordPattern(_0x2a6ed9,_0x508df0,_0x30fc8a){if(_0x30fc8a){var _0x48fc69=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48fc69[_0xf803('0x18')](_0x508df0)){return _0x2a6ed9;}else{throw new db[(_0xf803('0x19'))][(_0xf803('0x1a'))](_0xf803('0x1b'));}}else{return _0x2a6ed9;}}function respondWithRpcPromise(_0x58a80b,_0xf08041,_0x135230,_0x3d07ca){return new BPromise(function(_0x11373e,_0x2aaef6){var _0xd170bc=_0x3d07ca||client;return _0xd170bc[_0xf803('0x1c')](_0x58a80b,_0x135230)['then'](function(_0x50a67c){logger[_0xf803('0x1d')](_0xf803('0x1e'),_0xf08041,_0xf803('0x1f'));logger[_0xf803('0x20')](_0xf803('0x21'),_0xf08041,_0xf803('0x1f'),JSON[_0xf803('0x22')](_0x50a67c));if(_0x50a67c[_0xf803('0x23')]){if(_0x50a67c[_0xf803('0x23')][_0xf803('0x24')]===0x1f4){logger['error'](_0xf803('0x1e'),_0xf08041,_0x50a67c[_0xf803('0x23')][_0xf803('0x25')]);return _0x2aaef6(_0x50a67c[_0xf803('0x23')][_0xf803('0x25')]);}logger['error'](_0xf803('0x1e'),_0xf08041,_0x50a67c[_0xf803('0x23')]['message']);return _0x11373e(_0x50a67c[_0xf803('0x23')][_0xf803('0x25')]);}else{logger[_0xf803('0x1d')](_0xf803('0x1e'),_0xf08041,_0xf803('0x1f'));_0x11373e(_0x50a67c[_0xf803('0x26')][_0xf803('0x25')]);}})[_0xf803('0x27')](function(_0x393d0c){logger[_0xf803('0x23')](_0xf803('0x1e'),_0xf08041,_0x393d0c);_0x2aaef6(_0x393d0c);});});}function respondWithStatusCode(_0x57eaab,_0x1c91c2){_0x1c91c2=_0x1c91c2||0xcc;return function(_0x38bf79){if(_0x38bf79){return _0x57eaab[_0xf803('0x28')](_0x1c91c2);}return _0x57eaab[_0xf803('0x29')](_0x1c91c2)['end']();};}function respondWithResult(_0x483890,_0x17a57a){_0x17a57a=_0x17a57a||0xc8;return function(_0xa5d34){if(_0xa5d34){return _0x483890[_0xf803('0x29')](_0x17a57a)['json'](_0xa5d34);}};}function respondWithFilteredResult(_0x8a1ab,_0x1bf56a){return function(_0x4994e9){if(_0x4994e9){var _0x572558=_0x4994e9[_0xf803('0x2a')],_0x2b8727=_0x1bf56a[_0xf803('0x2b')],_0x2e5152=_0x1bf56a[_0xf803('0x2b')]+_0x1bf56a['limit'],_0x5757c9;if(_0x2e5152>=_0x572558){_0x2e5152=_0x572558;_0x5757c9=0xc8;}else{_0x5757c9=0xce;}_0x8a1ab[_0xf803('0x29')](_0x5757c9);return _0x8a1ab[_0xf803('0x2c')](_0xf803('0x2d'),_0x2b8727+'-'+_0x2e5152+'/'+_0x572558)[_0xf803('0x2e')](_0x4994e9);}return null;};}function patchUpdates(_0x42a35c){return function(_0xd1545){try{jsonpatch[_0xf803('0x2f')](_0xd1545,_0x42a35c,!![]);}catch(_0x2ebd22){return BPromise[_0xf803('0x30')](_0x2ebd22);}return _0xd1545[_0xf803('0x31')]();};}function saveUpdates(_0x50185b,_0x46a3f8){return function(_0x5bc426){if(_0x5bc426){return _0x5bc426[_0xf803('0x32')](_0x50185b)['then'](function(_0xc6d4e8){return _0xc6d4e8;});}return null;};}function removeEntity(_0x112430,_0x466e41){return function(_0x31a071){if(_0x31a071){return _0x31a071[_0xf803('0x33')]()[_0xf803('0x34')](function(){var _0x1436d7=_0x31a071['get']({'plain':!![]});var _0x2a4daa=_0xf803('0x35');return db[_0xf803('0x36')][_0xf803('0x33')]({'where':{'type':_0x2a4daa,'resourceId':_0x1436d7['id']}})[_0xf803('0x34')](function(){return _0x31a071;});})[_0xf803('0x34')](function(){_0x112430[_0xf803('0x29')](0xcc)[_0xf803('0x37')]();});}};}function handleEntityNotFound(_0x356242,_0x3879d7){return function(_0x55dccd){if(!_0x55dccd){_0x356242['sendStatus'](0x194);}return _0x55dccd;};}function handleError(_0x3e8399,_0x5b2f05){_0x5b2f05=_0x5b2f05||0x1f4;return function(_0x51887c){logger[_0xf803('0x23')](_0x51887c['stack']);if(_0x51887c[_0xf803('0x38')]){delete _0x51887c[_0xf803('0x38')];}_0x3e8399[_0xf803('0x29')](_0x5b2f05)[_0xf803('0x39')](_0x51887c);};}exports[_0xf803('0x3a')]=function(_0x1225d1,_0x2030cc){var _0xc08c3c={},_0x450be6={},_0xc6a3c7={'count':0x0,'rows':[]};var _0x479289=_[_0xf803('0x3b')](db[_0xf803('0x3c')][_0xf803('0x3d')],function(_0xc1569c){return{'name':_0xc1569c[_0xf803('0x3e')],'type':_0xc1569c['type'][_0xf803('0x3f')]};});_0x450be6[_0xf803('0x40')]=_[_0xf803('0x3b')](_0x479289,'name');_0x450be6['query']=_['keys'](_0x1225d1[_0xf803('0x41')]);_0x450be6[_0xf803('0x42')]=_['intersection'](_0x450be6[_0xf803('0x40')],_0x450be6['query']);_0xc08c3c[_0xf803('0x43')]=_[_0xf803('0x44')](_0x450be6[_0xf803('0x40')],qs[_0xf803('0x45')](_0x1225d1[_0xf803('0x41')][_0xf803('0x45')]));_0xc08c3c[_0xf803('0x43')]=_0xc08c3c[_0xf803('0x43')][_0xf803('0x46')]?_0xc08c3c['attributes']:_0x450be6[_0xf803('0x40')];if(!_0x1225d1['query'][_0xf803('0x47')](_0xf803('0x48'))){_0xc08c3c[_0xf803('0x49')]=qs['limit'](_0x1225d1[_0xf803('0x41')]['limit']);_0xc08c3c[_0xf803('0x2b')]=qs['offset'](_0x1225d1[_0xf803('0x41')][_0xf803('0x2b')]);}_0xc08c3c['order']=qs[_0xf803('0x4a')](_0x1225d1[_0xf803('0x41')][_0xf803('0x4a')]);_0xc08c3c[_0xf803('0x4b')]=qs[_0xf803('0x42')](_[_0xf803('0x4c')](_0x1225d1[_0xf803('0x41')],_0x450be6[_0xf803('0x42')]),_0x479289);if(_0x1225d1[_0xf803('0x41')][_0xf803('0x4d')]){_0xc08c3c[_0xf803('0x4b')]=_[_0xf803('0x4e')](_0xc08c3c[_0xf803('0x4b')],{'$or':_['map'](_0x479289,function(_0x3c97c0){if(_0x3c97c0['type']!==_0xf803('0x4f')){var _0x3b3cac={};_0x3b3cac[_0x3c97c0['name']]={'$like':'%'+_0x1225d1[_0xf803('0x41')]['filter']+'%'};return _0x3b3cac;}})});}_0xc08c3c=_[_0xf803('0x4e')]({},_0xc08c3c,_0x1225d1[_0xf803('0x50')]);var _0x47b8c1={'where':_0xc08c3c[_0xf803('0x4b')]};return db[_0xf803('0x3c')][_0xf803('0x2a')](_0x47b8c1)[_0xf803('0x34')](function(_0xc529aa){_0xc6a3c7[_0xf803('0x2a')]=_0xc529aa;if(_0x1225d1[_0xf803('0x41')][_0xf803('0x51')]){_0xc08c3c['include']=[{'all':!![]}];}return db[_0xf803('0x3c')]['findAll'](_0xc08c3c);})[_0xf803('0x34')](function(_0x482fb6){_0xc6a3c7['rows']=_0x482fb6;return _0xc6a3c7;})['then'](respondWithFilteredResult(_0x2030cc,_0xc08c3c))[_0xf803('0x27')](handleError(_0x2030cc,null));};exports['show']=function(_0x10dc65,_0x4035de){var _0x3b96a2={'raw':![],'where':{'id':_0x10dc65['params']['id']}},_0x40674f={};_0x40674f[_0xf803('0x40')]=_[_0xf803('0x52')](db[_0xf803('0x3c')][_0xf803('0x3d')]);_0x40674f[_0xf803('0x41')]=_[_0xf803('0x52')](_0x10dc65[_0xf803('0x41')]);_0x40674f['filters']=_['intersection'](_0x40674f[_0xf803('0x40')],_0x40674f[_0xf803('0x41')]);_0x3b96a2['attributes']=_['intersection'](_0x40674f[_0xf803('0x40')],qs[_0xf803('0x45')](_0x10dc65[_0xf803('0x41')]['fields']));_0x3b96a2['attributes']=_0x3b96a2[_0xf803('0x43')][_0xf803('0x46')]?_0x3b96a2['attributes']:_0x40674f['model'];if(_0x10dc65[_0xf803('0x41')]['includeAll']){_0x3b96a2[_0xf803('0x53')]=[{'all':!![]}];}_0x3b96a2=_['merge']({},_0x3b96a2,_0x10dc65[_0xf803('0x50')]);return db[_0xf803('0x3c')][_0xf803('0x54')](_0x3b96a2)[_0xf803('0x34')](handleEntityNotFound(_0x4035de,null))[_0xf803('0x34')](respondWithResult(_0x4035de,null))[_0xf803('0x27')](handleError(_0x4035de,null));};exports['clone']=function(_0xd413ac,_0x2cd431){var _0x4362aa={'where':{'id':_0xd413ac['params']['id']}},_0x4989b9={};_0x4989b9[_0xf803('0x40')]=_[_0xf803('0x52')](db[_0xf803('0x3c')][_0xf803('0x3d')]);_0x4362aa[_0xf803('0x43')]=_[_0xf803('0x44')](_0x4989b9[_0xf803('0x40')],qs['fields'](_0xd413ac[_0xf803('0x41')][_0xf803('0x45')]));_0x4362aa[_0xf803('0x43')]=_0x4362aa[_0xf803('0x43')][_0xf803('0x46')]?_0x4362aa['attributes']:_0x4989b9[_0xf803('0x40')];if(_0xd413ac[_0xf803('0x41')][_0xf803('0x51')]){_0x4362aa[_0xf803('0x53')]=[{'all':!![]}];}_0x4362aa=_[_0xf803('0x4e')]({},_0x4362aa,_0xd413ac['options']);return db[_0xf803('0x3c')][_0xf803('0x54')](_0x4362aa)['then'](handleEntityNotFound(_0x2cd431,null))[_0xf803('0x34')](function(_0x211a7b){if(_0x211a7b){var _0x17f8c8=_0x211a7b[_0xf803('0x55')]({'plain':!![]});_0x17f8c8=qs[_0xf803('0x56')](_0x17f8c8,['id',_0xf803('0x57'),_0xf803('0x58')]);_0xd413ac[_0xf803('0x59')]=_[_0xf803('0x56')](_0xd413ac[_0xf803('0x59')],['id',_0xf803('0x57'),_0xf803('0x58')]);return db[_0xf803('0x3c')][_0xf803('0x5a')](_['merge'](_0x17f8c8,_0xd413ac[_0xf803('0x59')]),{'include':_0xd413ac['query'][_0xf803('0x51')]?[{'all':!![]}]:undefined})[_0xf803('0x34')](function(_0x41a70f){var _0x47164a=_0xd413ac['user']['get']({'plain':!![]});if(!_0x47164a)throw new Error(_0xf803('0x5b'));if(_0x47164a[_0xf803('0x5c')]===_0xf803('0x5d')){var _0x50046d=_0x41a70f[_0xf803('0x55')]({'plain':!![]});var _0x4b1542=_0xf803('0x35');return db[_0xf803('0x5e')][_0xf803('0x54')]({'where':{'name':_0x4b1542,'userProfileId':_0x47164a[_0xf803('0x5f')]},'raw':!![]})[_0xf803('0x34')](function(_0x28080d){if(_0x28080d&&_0x28080d[_0xf803('0x60')]===0x0){return db[_0xf803('0x36')]['create']({'name':_0x50046d[_0xf803('0x38')],'resourceId':_0x50046d['id'],'type':_0x28080d['name'],'sectionId':_0x28080d['id']},{})['then'](function(){return _0x41a70f;});}else{return _0x41a70f;}})['catch'](function(_0x56db6a){logger[_0xf803('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56db6a);throw _0x56db6a;});}return _0x41a70f;});}})[_0xf803('0x34')](respondWithResult(_0x2cd431,0xc9))[_0xf803('0x27')](handleError(_0x2cd431,null));};exports[_0xf803('0x5a')]=function(_0x23b58c,_0x571fb4,_0x188192){var _0x5958cd;return db[_0xf803('0x3c')][_0xf803('0x5a')](_0x23b58c[_0xf803('0x59')],{'raw':!![]})[_0xf803('0x34')](function(_0x357d0e){_0x5958cd=_0x357d0e;return db[_0xf803('0x3c')]['findAll']({'raw':!![]});})[_0xf803('0x34')](function(_0x1b1e05){var _0x547aa4=fs[_0xf803('0x61')](path[_0xf803('0x62')](config[_0xf803('0x63')],_0xf803('0x64')),_0xf803('0x65'));var _0x1280c2=fs[_0xf803('0x61')](path[_0xf803('0x62')](config[_0xf803('0x63')],_0xf803('0x66')),_0xf803('0x65'));var _0x228691=ejs['render'](_0x547aa4,{'trunks':_0x1b1e05||[]});fs[_0xf803('0x67')](_0xf803('0x68'),_0x228691);if(_0x5958cd['registry']){var _0x5bbc69=ejs[_0xf803('0x69')](_0x1280c2,{'trunks':_0x1b1e05||[]});fs[_0xf803('0x67')](_0xf803('0x6a'),_0x5bbc69);}})['then'](function(){return respondWithRpcPromise(_0xf803('0x6b'),_0xf803('0x5a'),{'module':_0xf803('0x6c')});})[_0xf803('0x34')](function(){var _0x2ee23f=_0x23b58c[_0xf803('0x5d')][_0xf803('0x55')]({'plain':!![]});if(!_0x2ee23f)throw new Error(_0xf803('0x5b'));if(_0x2ee23f['role']===_0xf803('0x5d')){var _0x5467bf=_0x5958cd['get']({'plain':!![]});return db[_0xf803('0x5e')][_0xf803('0x54')]({'where':{'name':_0xf803('0x35'),'userProfileId':_0x2ee23f[_0xf803('0x5f')]},'raw':!![]})[_0xf803('0x34')](function(_0x402ed6){if(_0x402ed6&&_0x402ed6[_0xf803('0x60')]===0x0){return db[_0xf803('0x36')][_0xf803('0x5a')]({'name':_0x5467bf[_0xf803('0x38')],'resourceId':_0x5467bf['id'],'type':_0x402ed6[_0xf803('0x38')],'sectionId':_0x402ed6['id']},{})[_0xf803('0x34')](function(){return _0x5958cd;});}else{return _0x5958cd;}})[_0xf803('0x27')](function(_0x3fbaa4){logger[_0xf803('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fbaa4);throw _0x3fbaa4;});}return _0x5958cd;})['then'](respondWithResult(_0x571fb4,0xc9))[_0xf803('0x27')](handleError(_0x571fb4,null));};exports['update']=function(_0x1649fa,_0x5f2f74,_0x24241b){var _0x1490be;return db[_0xf803('0x3c')][_0xf803('0x54')]({'where':{'id':_0x1649fa[_0xf803('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5f2f74,null))['then'](saveUpdates(_0x1649fa[_0xf803('0x59')],null))[_0xf803('0x34')](function(_0x304a55){if(_0x304a55){_0x1490be=_0x304a55;return db[_0xf803('0x3c')][_0xf803('0x6e')]({'raw':!![]});}})[_0xf803('0x34')](function(_0x432318){if(_0x432318){var _0x14e26e=fs[_0xf803('0x61')](path[_0xf803('0x62')](config[_0xf803('0x63')],_0xf803('0x64')),_0xf803('0x65'));var _0x439f14=fs[_0xf803('0x61')](path[_0xf803('0x62')](config['root'],_0xf803('0x66')),'utf8');var _0x3c2bd8=ejs[_0xf803('0x69')](_0x14e26e,{'trunks':_0x432318||[]});fs[_0xf803('0x67')](_0xf803('0x68'),_0x3c2bd8);var _0x554631=ejs[_0xf803('0x69')](_0x439f14,{'trunks':_0x432318||[]});fs[_0xf803('0x67')](_0xf803('0x6a'),_0x554631);return respondWithRpcPromise(_0xf803('0x6b'),_0xf803('0x32'),{'module':_0xf803('0x6c')});}return null;})[_0xf803('0x34')](function(_0xa2b37){if(_0xa2b37){return _0x1490be;}})[_0xf803('0x34')](respondWithResult(_0x5f2f74,null))['catch'](handleError(_0x5f2f74,null));};exports[_0xf803('0x33')]=function(_0x411db1,_0x3e08db,_0x243f03){var _0x34d414;return db[_0xf803('0x3c')]['find']({'where':{'id':_0x411db1[_0xf803('0x6d')]['id']}})[_0xf803('0x34')](handleEntityNotFound(_0x3e08db,null))[_0xf803('0x34')](removeEntity(_0x3e08db,null))['then'](function(){return db[_0xf803('0x3c')]['findAll']({'raw':!![]});})[_0xf803('0x34')](function(_0xd9a688){var _0x11b7b2=fs[_0xf803('0x61')](path[_0xf803('0x62')](config[_0xf803('0x63')],_0xf803('0x64')),'utf8');var _0x3330f5=fs[_0xf803('0x61')](path[_0xf803('0x62')](config['root'],_0xf803('0x66')),_0xf803('0x65'));var _0x15428f=ejs[_0xf803('0x69')](_0x11b7b2,{'trunks':_0xd9a688});var _0xc6742=ejs['render'](_0x3330f5,{'trunks':_0xd9a688});fs[_0xf803('0x67')](_0xf803('0x68'),_0x15428f);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xc6742);return respondWithRpcPromise(_0xf803('0x6b'),_0xf803('0x33'),{'module':_0xf803('0x6c')});})[_0xf803('0x27')](handleError(_0x3e08db,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 95fcb15..3cb5297 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 _0xea60=['exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','path','../../config/environment','./trunk.attributes'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xea60,0xe8));var _0x0ea6=function(_0x44349b,_0x345bb4){_0x44349b=_0x44349b-0x0;var _0x193133=_0xea60[_0x44349b];return _0x193133;};'use strict';var _=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var logger=require('../../config/logger')(_0x0ea6('0x2'));var moment=require(_0x0ea6('0x3'));var BPromise=require(_0x0ea6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ea6('0x5'));var rimraf=require('rimraf');var config=require(_0x0ea6('0x6'));var attributes=require(_0x0ea6('0x7'));module[_0x0ea6('0x8')]=function(_0x2efb2f,_0x87c70){return _0x2efb2f[_0x0ea6('0x9')](_0x0ea6('0xa'),attributes,{'tableName':_0x0ea6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c79=['path','../../config/environment','./trunk.attributes','define','Trunk','lodash','../../config/logger','api','bluebird'];(function(_0x20dc31,_0x5d3146){var _0x536e02=function(_0x11f9ff){while(--_0x11f9ff){_0x20dc31['push'](_0x20dc31['shift']());}};_0x536e02(++_0x5d3146);}(_0x2c79,0x164));var _0x92c7=function(_0x562f9f,_0x4ceb13){_0x562f9f=_0x562f9f-0x0;var _0x1ae471=_0x2c79[_0x562f9f];return _0x1ae471;};'use strict';var _=require(_0x92c7('0x0'));var util=require('util');var logger=require(_0x92c7('0x1'))(_0x92c7('0x2'));var moment=require('moment');var BPromise=require(_0x92c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92c7('0x4'));var rimraf=require('rimraf');var config=require(_0x92c7('0x5'));var attributes=require(_0x92c7('0x6'));module['exports']=function(_0x42a70d,_0x4d2d3a){return _0x42a70d[_0x92c7('0x7')](_0x92c7('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index f8f4eb9..3a35b10 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 _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x480c8a,_0x12086f){var _0xc3e46a=function(_0x5e7f70){while(--_0x5e7f70){_0x480c8a['push'](_0x480c8a['shift']());}};_0xc3e46a(++_0x12086f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0xa8bb71,_0x4c5824){var _0xef39e6=function(_0x2fa339){while(--_0x2fa339){_0xa8bb71['push'](_0xa8bb71['shift']());}};_0xef39e6(++_0x4c5824);}(_0x757a,0xde));var _0xa757=function(_0x5795d3,_0x31cee4){_0x5795d3=_0x5795d3-0x0;var _0xac295d=_0x757a[_0x5795d3];return _0xac295d;};'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']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\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']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_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 diff --git a/server/api/user/index.js b/server/api/user/index.js index 417a58a..83150e8 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 _0xf8ba=['getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','/create_many','bulkCreate','post','addContacts','root','server/files/images/','format','%s-%s','now','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','Router','../../components/interaction/service','./user.controller','isAuthenticated','index','describe','get','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xf8ba,0xb6));var _0xaf8b=function(_0x14d969,_0x522c63){_0x14d969=_0x14d969-0x0;var _0x55d55c=_0xf8ba[_0x14d969];return _0x55d55c;};'use strict';var multer=require('multer');var util=require(_0xaf8b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf8b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf8b('0x2'));var config=require('../../config/environment');var controller=require(_0xaf8b('0x3'));router['get']('/',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5')]);router['get']('/describe',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x6')]);router[_0xaf8b('0x7')]('/whoami',auth[_0xaf8b('0x4')](),controller['whoami']);router['get'](_0xaf8b('0x8'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x9')]);router[_0xaf8b('0x7')](_0xaf8b('0xa'),controller[_0xaf8b('0xb')]);router[_0xaf8b('0x7')](_0xaf8b('0xc'),auth[_0xaf8b('0x4')](),controller['getContacts']);router[_0xaf8b('0x7')](_0xaf8b('0xd'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0xe')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xaf8b('0xf')]);router[_0xaf8b('0x7')](_0xaf8b('0x10'),auth[_0xaf8b('0x4')](),controller['getGroups']);router[_0xaf8b('0x7')](_0xaf8b('0x11'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x12')]);router[_0xaf8b('0x7')]('/:id/screen_recordings',auth[_0xaf8b('0x4')](),controller['getScreenRecordings']);router[_0xaf8b('0x7')]('/:id/chat/interactions',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x13')]);router[_0xaf8b('0x7')](_0xaf8b('0x14'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x15')]);router[_0xaf8b('0x7')](_0xaf8b('0x16'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x17')]);router['get']('/:id/sms/interactions',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x18')]);router[_0xaf8b('0x7')](_0xaf8b('0x19'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x1a')]);router[_0xaf8b('0x7')](_0xaf8b('0x1b'),auth['isAuthenticated'](),controller[_0xaf8b('0x1c')]);router[_0xaf8b('0x7')](_0xaf8b('0x1d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x1e')]);router[_0xaf8b('0x7')](_0xaf8b('0x1f'),auth['isAuthenticated'](),controller[_0xaf8b('0x20')]);router[_0xaf8b('0x7')](_0xaf8b('0x21'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x22')]);router[_0xaf8b('0x7')](_0xaf8b('0x23'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x24')]);router[_0xaf8b('0x7')]('/:id/fax_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x25')]);router['get'](_0xaf8b('0x26'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x27')]);router[_0xaf8b('0x7')](_0xaf8b('0x28'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x29')]);router[_0xaf8b('0x7')](_0xaf8b('0x2a'),auth[_0xaf8b('0x4')](),controller['getSmsAccounts']);router['get'](_0xaf8b('0x2b'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x2c')]);router['get']('/:id/whatsapp_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x2d')]);router[_0xaf8b('0x7')](_0xaf8b('0x2e'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x2f')]);router[_0xaf8b('0x7')]('/:id/scheduled_calls',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x30')]);router[_0xaf8b('0x7')](_0xaf8b('0x31'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x32')]);router['post'](_0xaf8b('0x33'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x34')]);router[_0xaf8b('0x35')]('/:id/contacts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x36')]);router['post']('/',auth[_0xaf8b('0x4')](),controller['create']);router['post'](_0xaf8b('0xd'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x283723,_0x3d9960,_0x48f677){_0x48f677(null,path['join'](config[_0xaf8b('0x37')],_0xaf8b('0x38')));},'filename':function(_0x380cdf,_0xfbeedc,_0x4814b4){_0x4814b4(null,util[_0xaf8b('0x39')](_0xaf8b('0x3a'),Date[_0xaf8b('0x3b')](),_0xfbeedc['originalname']));}})});router[_0xaf8b('0x35')](_0xaf8b('0xa'),upload['single'](_0xaf8b('0x3c')),controller['addAvatar']);router[_0xaf8b('0x35')](_0xaf8b('0x3d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x3e')]);router[_0xaf8b('0x35')](_0xaf8b('0x3f'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x40')]);router[_0xaf8b('0x35')](_0xaf8b('0x41'),auth['isAuthenticated'](),controller[_0xaf8b('0x42')]);router[_0xaf8b('0x35')]('/:id/unpause',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x43')]);router[_0xaf8b('0x35')](_0xaf8b('0x1d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x44')]);router['post']('/:id/chat_interactions',auth[_0xaf8b('0x4')](),controller['addChatInteractions']);router[_0xaf8b('0x35')](_0xaf8b('0x45'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x46')]);router[_0xaf8b('0x35')](_0xaf8b('0x47'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x48')]);router[_0xaf8b('0x35')](_0xaf8b('0x49'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x4a')]);router[_0xaf8b('0x35')](_0xaf8b('0x4b'),auth[_0xaf8b('0x4')](),controller['addOpenchannelInteractions']);router[_0xaf8b('0x35')](_0xaf8b('0x4c'),auth[_0xaf8b('0x4')](),controller['addWhatsappInteractions']);router['post'](_0xaf8b('0x4d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x4e')]);router[_0xaf8b('0x35')]('/:id/mail_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x4f')]);router[_0xaf8b('0x35')]('/:id/openchannel_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x50')]);router[_0xaf8b('0x35')](_0xaf8b('0x2a'),auth[_0xaf8b('0x4')](),controller['addSmsAccounts']);router['post'](_0xaf8b('0x2b'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0xaf8b('0x35')](_0xaf8b('0x51'),auth['isAuthenticated'](),controller[_0xaf8b('0x52')]);router['post']('/:id/square_projects',auth[_0xaf8b('0x4')](),controller['addSquareProjects']);router[_0xaf8b('0x35')]('/:id/api_key',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x53')]);router[_0xaf8b('0x54')](_0xaf8b('0x8'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x55')]);router[_0xaf8b('0x54')]('/:id/password',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x56')]);router[_0xaf8b('0x57')](_0xaf8b('0xd'),auth[_0xaf8b('0x4')](),controller['removeQueues']);router[_0xaf8b('0x57')](_0xaf8b('0x1d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x58')]);router['delete']('/:id',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x59')]);router['delete'](_0xaf8b('0x5a'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5b')]);router[_0xaf8b('0x57')](_0xaf8b('0x45'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5c')]);router[_0xaf8b('0x57')]('/:id/fax_interactions',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5d')]);router[_0xaf8b('0x57')](_0xaf8b('0x49'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5e')]);router[_0xaf8b('0x57')](_0xaf8b('0x4b'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5f')]);router['delete'](_0xaf8b('0x4c'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x60')]);router['delete']('/:id/fax_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x61')]);router[_0xaf8b('0x57')](_0xaf8b('0x26'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x62')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xaf8b('0x63')]);router[_0xaf8b('0x57')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xaf8b('0x64')]);router['delete'](_0xaf8b('0x2b'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x65')]);router[_0xaf8b('0x57')](_0xaf8b('0x51'),auth[_0xaf8b('0x4')](),controller['removeWhatsappAccounts']);router[_0xaf8b('0x57')](_0xaf8b('0x2e'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x66')]);router['delete'](_0xaf8b('0x31'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x67')]);module[_0xaf8b('0x68')]=router; \ No newline at end of file +var _0x0135=['getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','/:id/square_projects','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts'];(function(_0x3b40a4,_0x285500){var _0x2dd280=function(_0x2ecf0b){while(--_0x2ecf0b){_0x3b40a4['push'](_0x3b40a4['shift']());}};_0x2dd280(++_0x285500);}(_0x0135,0x191));var _0x5013=function(_0x376251,_0xd358cb){_0x376251=_0x376251-0x0;var _0x4920d6=_0x0135[_0x376251];return _0x4920d6;};'use strict';var multer=require(_0x5013('0x0'));var util=require(_0x5013('0x1'));var path=require(_0x5013('0x2'));var timeout=require('connect-timeout');var express=require(_0x5013('0x3'));var router=express[_0x5013('0x4')]();var auth=require(_0x5013('0x5'));var interaction=require(_0x5013('0x6'));var config=require(_0x5013('0x7'));var controller=require(_0x5013('0x8'));router[_0x5013('0x9')]('/',auth[_0x5013('0xa')](),controller[_0x5013('0xb')]);router[_0x5013('0x9')](_0x5013('0xc'),auth[_0x5013('0xa')](),controller['describe']);router[_0x5013('0x9')](_0x5013('0xd'),auth[_0x5013('0xa')](),controller[_0x5013('0xe')]);router[_0x5013('0x9')](_0x5013('0xf'),auth[_0x5013('0xa')](),controller[_0x5013('0x10')]);router[_0x5013('0x9')](_0x5013('0x11'),controller[_0x5013('0x12')]);router['get'](_0x5013('0x13'),auth[_0x5013('0xa')](),controller[_0x5013('0x14')]);router[_0x5013('0x9')](_0x5013('0x15'),auth['isAuthenticated'](),controller['getQueues']);router['get'](_0x5013('0x16'),auth[_0x5013('0xa')](),controller[_0x5013('0x17')]);router[_0x5013('0x9')](_0x5013('0x18'),auth[_0x5013('0xa')](),controller[_0x5013('0x19')]);router[_0x5013('0x9')](_0x5013('0x1a'),auth[_0x5013('0xa')](),controller[_0x5013('0x1b')]);router[_0x5013('0x9')](_0x5013('0x1c'),auth[_0x5013('0xa')](),controller[_0x5013('0x1d')]);router[_0x5013('0x9')](_0x5013('0x1e'),auth[_0x5013('0xa')](),controller['getChatInteractions']);router[_0x5013('0x9')]('/:id/openchannel/interactions',auth[_0x5013('0xa')](),controller[_0x5013('0x1f')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x5013('0x20')]);router[_0x5013('0x9')](_0x5013('0x21'),auth[_0x5013('0xa')](),controller[_0x5013('0x22')]);router[_0x5013('0x9')]('/:id/fax/interactions',auth[_0x5013('0xa')](),controller[_0x5013('0x23')]);router[_0x5013('0x9')](_0x5013('0x24'),auth[_0x5013('0xa')](),controller[_0x5013('0x25')]);router['get'](_0x5013('0x26'),auth[_0x5013('0xa')](),controller[_0x5013('0x27')]);router[_0x5013('0x9')](_0x5013('0x28'),auth[_0x5013('0xa')](),controller['getLists']);router['get'](_0x5013('0x29'),auth['isAuthenticated'](),controller['getAgents']);router[_0x5013('0x9')](_0x5013('0x2a'),auth[_0x5013('0xa')](),controller[_0x5013('0x2b')]);router[_0x5013('0x9')](_0x5013('0x2c'),auth[_0x5013('0xa')](),controller[_0x5013('0x2d')]);router[_0x5013('0x9')](_0x5013('0x2e'),auth[_0x5013('0xa')](),controller[_0x5013('0x2f')]);router[_0x5013('0x9')](_0x5013('0x30'),auth[_0x5013('0xa')](),controller[_0x5013('0x31')]);router[_0x5013('0x9')](_0x5013('0x32'),auth[_0x5013('0xa')](),controller[_0x5013('0x33')]);router[_0x5013('0x9')](_0x5013('0x34'),auth[_0x5013('0xa')](),controller[_0x5013('0x35')]);router[_0x5013('0x9')](_0x5013('0x36'),auth[_0x5013('0xa')](),controller[_0x5013('0x37')]);router[_0x5013('0x9')]('/:id/square_projects',auth[_0x5013('0xa')](),controller['getSquareProjects']);router[_0x5013('0x9')](_0x5013('0x38'),auth[_0x5013('0xa')](),controller[_0x5013('0x39')]);router[_0x5013('0x9')](_0x5013('0x3a'),auth[_0x5013('0xa')](),controller[_0x5013('0x3b')]);router[_0x5013('0x3c')]('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router[_0x5013('0x3c')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x5013('0x3d')]);router[_0x5013('0x3c')]('/',auth[_0x5013('0xa')](),controller['create']);router[_0x5013('0x3c')](_0x5013('0x15'),auth[_0x5013('0xa')](),controller[_0x5013('0x3e')]);var upload=multer({'storage':multer[_0x5013('0x3f')]({'destination':function(_0x1809a6,_0x5c29d8,_0x1500a9){_0x1500a9(null,path[_0x5013('0x40')](config[_0x5013('0x41')],'server/files/images/'));},'filename':function(_0x275aa2,_0x10d3e4,_0x958789){_0x958789(null,util[_0x5013('0x42')](_0x5013('0x43'),Date[_0x5013('0x44')](),_0x10d3e4[_0x5013('0x45')]));}})});router[_0x5013('0x3c')](_0x5013('0x11'),upload[_0x5013('0x46')](_0x5013('0x47')),controller[_0x5013('0x48')]);router[_0x5013('0x3c')](_0x5013('0x49'),auth[_0x5013('0xa')](),controller[_0x5013('0x4a')]);router[_0x5013('0x3c')]('/:id/logout',auth[_0x5013('0xa')](),controller[_0x5013('0x4b')]);router[_0x5013('0x3c')]('/:id/pause',auth['isAuthenticated'](),controller[_0x5013('0x4c')]);router[_0x5013('0x3c')](_0x5013('0x4d'),auth[_0x5013('0xa')](),controller[_0x5013('0x4e')]);router[_0x5013('0x3c')](_0x5013('0x26'),auth[_0x5013('0xa')](),controller[_0x5013('0x4f')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x5013('0x50')]);router[_0x5013('0x3c')](_0x5013('0x51'),auth['isAuthenticated'](),controller[_0x5013('0x52')]);router['post'](_0x5013('0x53'),auth[_0x5013('0xa')](),controller[_0x5013('0x54')]);router[_0x5013('0x3c')](_0x5013('0x55'),auth['isAuthenticated'](),controller[_0x5013('0x56')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x5013('0x57')]);router['post'](_0x5013('0x58'),auth[_0x5013('0xa')](),controller['addWhatsappInteractions']);router['post'](_0x5013('0x2c'),auth[_0x5013('0xa')](),controller['addFaxAccounts']);router['post'](_0x5013('0x2e'),auth[_0x5013('0xa')](),controller[_0x5013('0x59')]);router[_0x5013('0x3c')](_0x5013('0x30'),auth[_0x5013('0xa')](),controller[_0x5013('0x5a')]);router[_0x5013('0x3c')](_0x5013('0x32'),auth['isAuthenticated'](),controller[_0x5013('0x5b')]);router[_0x5013('0x3c')](_0x5013('0x34'),auth[_0x5013('0xa')](),controller['addChatWebsites']);router[_0x5013('0x3c')](_0x5013('0x36'),auth[_0x5013('0xa')](),controller[_0x5013('0x5c')]);router['post']('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x5013('0x3c')](_0x5013('0x3a'),auth[_0x5013('0xa')](),controller['createApiKey']);router[_0x5013('0x5d')]('/:id',auth[_0x5013('0xa')](),controller['update']);router[_0x5013('0x5d')](_0x5013('0x5e'),auth[_0x5013('0xa')](),controller[_0x5013('0x5f')]);router[_0x5013('0x60')](_0x5013('0x15'),auth[_0x5013('0xa')](),controller[_0x5013('0x61')]);router[_0x5013('0x60')](_0x5013('0x26'),auth[_0x5013('0xa')](),controller[_0x5013('0x62')]);router[_0x5013('0x60')]('/:id',auth['isAuthenticated'](),controller[_0x5013('0x63')]);router['delete'](_0x5013('0x64'),auth['isAuthenticated'](),controller[_0x5013('0x65')]);router[_0x5013('0x60')](_0x5013('0x51'),auth[_0x5013('0xa')](),controller[_0x5013('0x66')]);router['delete'](_0x5013('0x53'),auth[_0x5013('0xa')](),controller[_0x5013('0x67')]);router[_0x5013('0x60')](_0x5013('0x55'),auth[_0x5013('0xa')](),controller[_0x5013('0x68')]);router[_0x5013('0x60')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x5013('0x69')]);router[_0x5013('0x60')](_0x5013('0x58'),auth[_0x5013('0xa')](),controller['removeWhatsappInteractions']);router[_0x5013('0x60')](_0x5013('0x2c'),auth[_0x5013('0xa')](),controller[_0x5013('0x6a')]);router[_0x5013('0x60')](_0x5013('0x2e'),auth[_0x5013('0xa')](),controller[_0x5013('0x6b')]);router[_0x5013('0x60')](_0x5013('0x30'),auth[_0x5013('0xa')](),controller['removeOpenchannelAccounts']);router['delete'](_0x5013('0x32'),auth[_0x5013('0xa')](),controller[_0x5013('0x6c')]);router[_0x5013('0x60')](_0x5013('0x34'),auth[_0x5013('0xa')](),controller['removeChatWebsites']);router[_0x5013('0x60')](_0x5013('0x36'),auth[_0x5013('0xa')](),controller[_0x5013('0x6d')]);router[_0x5013('0x60')](_0x5013('0x6e'),auth[_0x5013('0xa')](),controller['removeSquareProjects']);router[_0x5013('0x60')](_0x5013('0x3a'),auth[_0x5013('0xa')](),controller['removeApiKey']);module[_0x5013('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f6255ed..dfea459 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 _0xbeda=['rfc2833','info','shortinfo','inband','auto','update','yes','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','uac','uas','fingerprint','active','passive','actpass','nonat','update,nonat','get','isArray','encryption','force_avp','icesupport','dtlsenable','dtlscertfile','rtcp_mux','wss','avpf','dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','admin','agent','telephone','local','INTEGER','accountcode','getDataValue','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xbeda,0x8c));var _0xabed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbeda[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xabed('0x0'));var moment=require(_0xabed('0x1'));var util=require(_0xabed('0x2'));var _=require(_0xabed('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x581a73){this['setDataValue']('name',_0x581a73);this[_0xabed('0x4')](_0xabed('0x5'),_0x581a73);},'comment':_0xabed('0x6')},'fullname':{'type':Sequelize[_0xabed('0x7')],'allowNull':![],'set':function(_0x126462){this[_0xabed('0x4')]('fullname',_0x126462);this[_0xabed('0x4')](_0xabed('0x8'),util[_0xabed('0x9')](_0xabed('0xa'),_0x126462,this['getDataValue'](_0xabed('0xb'))));}},'alias':{'type':Sequelize[_0xabed('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xabed('0xc'),'validate':{'isEmail':!![]},'set':function(_0x223c40){if(_0x223c40){this['setDataValue']('email',_0x223c40[_0xabed('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xabed('0xe'),'user',_0xabed('0xf'),_0xabed('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xabed('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xabed('0x7')],'defaultValue':_0xabed('0x11')},'internal':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x206e4b){this[_0xabed('0x4')](_0xabed('0xb'),_0x206e4b);this[_0xabed('0x4')](_0xabed('0x13'),_0x206e4b);this[_0xabed('0x4')]('callerid',util[_0xabed('0x9')](_0xabed('0xa'),this[_0xabed('0x14')](_0xabed('0x15')),_0x206e4b));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xabed('0x7')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xabed('0x7')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xabed('0x7')]},'country':{'type':Sequelize[_0xabed('0x7')]},'online':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xabed('0x7')],'defaultValue':_0xabed('0x17')},'lastPauseAt':{'type':Sequelize[_0xabed('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xabed('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xabed('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0xabed('0x1a')},'context':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x1b')},'callingpres':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x1d'),_0xabed('0x1e'),'ALLOWED_FAILED_SCREEN',_0xabed('0x1f'),_0xabed('0x20'),_0xabed('0x21'),_0xabed('0x22'),_0xabed('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x24'),'set':function(_0x506796){this[_0xabed('0x4')](_0xabed('0x25'),_0x506796?_0x506796[_0xabed('0x26')](','):null);},'get':function(){return this[_0xabed('0x14')](_0xabed('0x25'))?this['getDataValue'](_0xabed('0x25'))['split'](','):null;},'comment':_0xabed('0x27')},'dtmfmode':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x28'),_0xabed('0x29'),_0xabed('0x2a'),_0xabed('0x2b'),_0xabed('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xabed('0x1c')]('yes','no','nonat',_0xabed('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x2f'),'set':function(_0x2eafac){this[_0xabed('0x4')](_0xabed('0x30'),_0x2eafac?_0x2eafac[_0xabed('0x26')](','):null);},'get':function(){return this[_0xabed('0x14')](_0xabed('0x30'))?this[_0xabed('0x14')]('nat')[_0xabed('0x31')](','):null;},'comment':_0xabed('0x32')},'callgroup':{'type':Sequelize[_0xabed('0x7')]},'namedcallgroup':{'type':Sequelize[_0xabed('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xabed('0x7')]},'language':{'type':Sequelize[_0xabed('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xabed('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xabed('0x33')},'allow':{'type':Sequelize[_0xabed('0x7')],'allowNull':![],'defaultValue':_0xabed('0x34'),'set':function(_0x580192){this[_0xabed('0x4')]('allow',_0x580192?_0x580192['join'](';'):_0xabed('0x34'));},'get':function(){return this[_0xabed('0x14')](_0xabed('0x35'))?this[_0xabed('0x14')]('allow')[_0xabed('0x31')](';'):null;},'comment':_0xabed('0x36')},'autoframing':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'set':function(_0x48c07a){this[_0xabed('0x4')](_0xabed('0x37'),_0x48c07a?_0x48c07a['join'](','):null);},'get':function(){return this[_0xabed('0x14')]('insecure')?this[_0xabed('0x14')](_0xabed('0x37'))[_0xabed('0x31')](','):null;},'comment':_0xabed('0x38')},'trustrpid':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no',_0xabed('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xabed('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x3a'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x3b'),_0xabed('0x3c')),'allowNull':!![],'defaultValue':_0xabed('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no',_0xabed('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xabed('0x3e'),_0xabed('0x3f'),_0xabed('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xabed('0x1c')]('yes','no',_0xabed('0x41'),'update',_0xabed('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xabed('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0xabed('0x18')]},'showWebBar':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0,'set':function(_0x5ec4dd){this['setDataValue']('showWebBar',_0x5ec4dd);var _0x57edb3=this[_0xabed('0x43')]({'plain':!![]});switch(_0x5ec4dd){case 0x0:case 0x1:var _0x1768ca=_0x57edb3[_0xabed('0x25')]?_[_0xabed('0x44')](_0x57edb3['transport'])?_0x57edb3[_0xabed('0x25')][_0xabed('0x26')]():_0x57edb3[_0xabed('0x25')]:_0xabed('0x24');if(_0x1768ca==='wss'){_0x1768ca=_0xabed('0x24');}this['setDataValue'](_0xabed('0x25'),_0x1768ca);this['setDataValue'](_0xabed('0x45'),'no');this['setDataValue']('avpf',null);this[_0xabed('0x4')](_0xabed('0x46'),null);this[_0xabed('0x4')](_0xabed('0x47'),null);this[_0xabed('0x4')](_0xabed('0x48'),null);this[_0xabed('0x4')]('dtlsverify',null);this[_0xabed('0x4')]('dtlssetup',null);this['setDataValue'](_0xabed('0x49'),null);this[_0xabed('0x4')]('dtlsprivatekey',null);this[_0xabed('0x4')](_0xabed('0x4a'),'no');break;case 0x2:this[_0xabed('0x4')](_0xabed('0x25'),_0xabed('0x4b'));this[_0xabed('0x4')]('encryption',_0xabed('0x2e'));this['setDataValue'](_0xabed('0x4c'),_0xabed('0x2e'));this[_0xabed('0x4')](_0xabed('0x46'),_0xabed('0x2e'));this[_0xabed('0x4')](_0xabed('0x47'),_0xabed('0x2e'));this[_0xabed('0x4')](_0xabed('0x48'),_0xabed('0x2e'));this[_0xabed('0x4')]('dtlsverify','no');this[_0xabed('0x4')](_0xabed('0x4d'),_0xabed('0x40'));this[_0xabed('0x4')](_0xabed('0x49'),_0x57edb3[_0xabed('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0xabed('0x4')](_0xabed('0x4e'),_0x57edb3['dtlsprivatekey']||_0xabed('0x4f'));this[_0xabed('0x4')]('rtcp_mux',_0xabed('0x2e'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x24fd74){this['setDataValue'](_0xabed('0x50'),_0x24fd74?_0x24fd74[_0xabed('0x26')](','):[]);},'get':function(){return this[_0xabed('0x14')](_0xabed('0x50'))?_[_0xabed('0x51')](this[_0xabed('0x14')]('permissions')['split'](','),function(_0x129a26){return parseInt(_0x129a26,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xabed('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xabed('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xabed('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xabed('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xabed('0x7')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xabed('0x52')],'get':function(){return this[_0xabed('0x14')]('phoneBarEnableScreenRecordingByAgent')?this[_0xabed('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xabed('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![],'set':function(_0x3f2c33){if(typeof _0x3f2c33===_0xabed('0x53')){var _0x59f26b=_0x3f2c33==='1'?!![]:_0x3f2c33==='0'?![]:_0x3f2c33===_0xabed('0x54')?!![]:_0x3f2c33===_0xabed('0x55')?![]:![];this[_0xabed('0x4')](_0xabed('0x56'),_0x59f26b);}else{this[_0xabed('0x4')]('screenrecording',_0x3f2c33);}}},'blocked':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![],'set':function(_0x5c2402){this[_0xabed('0x4')](_0xabed('0x57'),_0x5c2402);if(_0x5c2402===!![]){this['setDataValue'](_0xabed('0x58'),moment());this[_0xabed('0x4')](_0xabed('0x59'),0x0);}else{this[_0xabed('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xabed('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xf7cd=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','active','passive','actpass','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','internal','STRING','email','toLowerCase','ENUM','admin','user','agent','telephone','local','accountcode','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip'];(function(_0x10492f,_0x158608){var _0x517002=function(_0x2ae8e8){while(--_0x2ae8e8){_0x10492f['push'](_0x10492f['shift']());}};_0x517002(++_0x158608);}(_0xf7cd,0x98));var _0xdf7c=function(_0x20fefe,_0x1d4744){_0x20fefe=_0x20fefe-0x0;var _0xa92414=_0xf7cd[_0x20fefe];return _0xa92414;};'use strict';var Sequelize=require(_0xdf7c('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf7c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1f88bc){this[_0xdf7c('0x2')](_0xdf7c('0x1'),_0x1f88bc);this[_0xdf7c('0x2')](_0xdf7c('0x3'),_0x1f88bc);},'comment':_0xdf7c('0x4')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x13cc8a){this[_0xdf7c('0x2')]('fullname',_0x13cc8a);this['setDataValue'](_0xdf7c('0x5'),util['format'](_0xdf7c('0x6'),_0x13cc8a,this['getDataValue'](_0xdf7c('0x7'))));}},'alias':{'type':Sequelize[_0xdf7c('0x8')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf7c('0x9'),'validate':{'isEmail':!![]},'set':function(_0x37616f){if(_0x37616f){this[_0xdf7c('0x2')](_0xdf7c('0x9'),_0x37616f[_0xdf7c('0xa')]());}}},'role':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0xc'),_0xdf7c('0xd'),_0xdf7c('0xe'),_0xdf7c('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdf7c('0x8')],'defaultValue':_0xdf7c('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xdf7c('0x7'),'set':function(_0x234c56){this[_0xdf7c('0x2')]('internal',_0x234c56);this['setDataValue'](_0xdf7c('0x11'),_0x234c56);this[_0xdf7c('0x2')](_0xdf7c('0x5'),util[_0xdf7c('0x12')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xdf7c('0x13')),_0x234c56));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdf7c('0x8')]},'mobile':{'type':Sequelize[_0xdf7c('0x8')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xdf7c('0x8')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xdf7c('0x8')]},'online':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdf7c('0x15')]},'voicePause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdf7c('0x8')],'defaultValue':_0xdf7c('0x16')},'lastPauseAt':{'type':Sequelize[_0xdf7c('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdf7c('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdf7c('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdf7c('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdf7c('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdf7c('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdf7c('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![],'defaultValue':_0xdf7c('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xdf7c('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x19'),_0xdf7c('0xd'),_0xdf7c('0x1a')),'allowNull':!![],'defaultValue':_0xdf7c('0x19')},'context':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![],'defaultValue':_0xdf7c('0x1b')},'callingpres':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x1c'),_0xdf7c('0x1d'),'ALLOWED_FAILED_SCREEN',_0xdf7c('0x1e'),_0xdf7c('0x1f'),_0xdf7c('0x20'),_0xdf7c('0x21'),_0xdf7c('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![],'defaultValue':_0xdf7c('0x23'),'set':function(_0xb3ff89){this[_0xdf7c('0x2')](_0xdf7c('0x24'),_0xb3ff89?_0xb3ff89[_0xdf7c('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xdf7c('0x26')]('transport')[_0xdf7c('0x27')](','):null;},'comment':_0xdf7c('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0xdf7c('0x29'),_0xdf7c('0x2a'),'shortinfo',_0xdf7c('0x2b'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no',_0xdf7c('0x2d'),_0xdf7c('0x2e'),_0xdf7c('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4e1c20){this['setDataValue'](_0xdf7c('0x30'),_0x4e1c20?_0x4e1c20[_0xdf7c('0x25')](','):null);},'get':function(){return this[_0xdf7c('0x26')](_0xdf7c('0x30'))?this[_0xdf7c('0x26')](_0xdf7c('0x30'))[_0xdf7c('0x27')](','):null;},'comment':_0xdf7c('0x31')},'callgroup':{'type':Sequelize[_0xdf7c('0x8')]},'namedcallgroup':{'type':Sequelize[_0xdf7c('0x8')]},'pickupgroup':{'type':Sequelize[_0xdf7c('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xdf7c('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdf7c('0x8')]},'disallow':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':![],'defaultValue':_0xdf7c('0x32')},'allow':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':![],'defaultValue':_0xdf7c('0x33'),'set':function(_0xd52c25){this['setDataValue'](_0xdf7c('0x34'),_0xd52c25?_0xd52c25[_0xdf7c('0x25')](';'):_0xdf7c('0x33'));},'get':function(){return this[_0xdf7c('0x26')](_0xdf7c('0x34'))?this[_0xdf7c('0x26')](_0xdf7c('0x34'))[_0xdf7c('0x27')](';'):null;},'comment':_0xdf7c('0x35')},'autoframing':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0xaca905){this[_0xdf7c('0x2')](_0xdf7c('0x36'),_0xaca905?_0xaca905[_0xdf7c('0x25')](','):null);},'get':function(){return this[_0xdf7c('0x26')](_0xdf7c('0x36'))?this['getDataValue'](_0xdf7c('0x36'))[_0xdf7c('0x27')](','):null;},'comment':_0xdf7c('0x37')},'trustrpid':{'type':Sequelize[_0xdf7c('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xdf7c('0x2c'),'no',_0xdf7c('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xdf7c('0x2c')},'busylevel':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdf7c('0xb')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no',_0xdf7c('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x3a'),'refuse',_0xdf7c('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x3c'),_0xdf7c('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xdf7c('0x2c')},'keepalive':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x3e'),_0xdf7c('0x3f'),_0xdf7c('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdf7c('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdf7c('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdf7c('0xb')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdf7c('0xb')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no','nonat',_0xdf7c('0x2e'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xdf7c('0x15')]},'showWebBar':{'type':Sequelize[_0xdf7c('0x17')],'defaultValue':0x0,'set':function(_0x2e5454){this[_0xdf7c('0x2')](_0xdf7c('0x41'),_0x2e5454);var _0x22d0c7=this[_0xdf7c('0x42')]({'plain':!![]});switch(_0x2e5454){case 0x0:case 0x1:var _0x397fdc=_0x22d0c7[_0xdf7c('0x24')]?_[_0xdf7c('0x43')](_0x22d0c7['transport'])?_0x22d0c7['transport'][_0xdf7c('0x25')]():_0x22d0c7[_0xdf7c('0x24')]:_0xdf7c('0x23');if(_0x397fdc===_0xdf7c('0x44')){_0x397fdc='udp';}this[_0xdf7c('0x2')](_0xdf7c('0x24'),_0x397fdc);this['setDataValue']('encryption','no');this['setDataValue'](_0xdf7c('0x45'),null);this[_0xdf7c('0x2')](_0xdf7c('0x46'),null);this[_0xdf7c('0x2')](_0xdf7c('0x47'),null);this[_0xdf7c('0x2')](_0xdf7c('0x48'),null);this[_0xdf7c('0x2')]('dtlsverify',null);this[_0xdf7c('0x2')](_0xdf7c('0x49'),null);this[_0xdf7c('0x2')]('dtlscertfile',null);this['setDataValue'](_0xdf7c('0x4a'),null);this['setDataValue'](_0xdf7c('0x4b'),'no');break;case 0x2:this[_0xdf7c('0x2')](_0xdf7c('0x24'),_0xdf7c('0x44'));this[_0xdf7c('0x2')](_0xdf7c('0x4c'),_0xdf7c('0x2c'));this[_0xdf7c('0x2')](_0xdf7c('0x45'),_0xdf7c('0x2c'));this[_0xdf7c('0x2')](_0xdf7c('0x46'),_0xdf7c('0x2c'));this[_0xdf7c('0x2')](_0xdf7c('0x47'),_0xdf7c('0x2c'));this['setDataValue']('dtlsenable',_0xdf7c('0x2c'));this[_0xdf7c('0x2')](_0xdf7c('0x4d'),'no');this[_0xdf7c('0x2')](_0xdf7c('0x49'),_0xdf7c('0x40'));this[_0xdf7c('0x2')]('dtlscertfile',_0x22d0c7[_0xdf7c('0x4e')]||_0xdf7c('0x4f'));this[_0xdf7c('0x2')](_0xdf7c('0x4a'),_0x22d0c7[_0xdf7c('0x4a')]||_0xdf7c('0x50'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1e12c7){this[_0xdf7c('0x2')](_0xdf7c('0x51'),_0x1e12c7?_0x1e12c7[_0xdf7c('0x25')](','):[]);},'get':function(){return this[_0xdf7c('0x26')](_0xdf7c('0x51'))?_[_0xdf7c('0x52')](this[_0xdf7c('0x26')](_0xdf7c('0x51'))['split'](','),function(_0x159434){return parseInt(_0x159434,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xdf7c('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0xdf7c('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdf7c('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdf7c('0xb')](_0xdf7c('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdf7c('0x8')]},'passwordResetAt':{'type':Sequelize[_0xdf7c('0x15')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdf7c('0x53')],'get':function(){return this[_0xdf7c('0x26')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0xdf7c('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdf7c('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![],'set':function(_0x1272bc){if(typeof _0x1272bc==='string'){var _0xf2a971=_0x1272bc==='1'?!![]:_0x1272bc==='0'?![]:_0x1272bc==='true'?!![]:_0x1272bc===_0xdf7c('0x55')?![]:![];this[_0xdf7c('0x2')](_0xdf7c('0x56'),_0xf2a971);}else{this['setDataValue'](_0xdf7c('0x56'),_0x1272bc);}}},'blocked':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![],'set':function(_0x2d4116){this[_0xdf7c('0x2')](_0xdf7c('0x57'),_0x2d4116);if(_0x2d4116===!![]){this['setDataValue']('blockedAt',moment());this[_0xdf7c('0x2')](_0xdf7c('0x58'),0x0);}else{this[_0xdf7c('0x2')](_0xdf7c('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xdf7c('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xdf7c('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b65de19..7b6a8f0 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 _0x7096=['findAll','params','differenceBy','rawAttributes','intersection','bulkCreate','body','describe','addContacts','ids','omit','agent\x20role','admin','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','securePassword','min_internal','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','email','permissions','102','103','110','104','105','107','108','109','100','111','114','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','Setting','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','interface','isValidChannel','Unknown\x20channel','capitalize','Queues','penalty','spread','QueueId','emit','toLowerCase','Queue:save','voice','each','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','getContacts','order','options','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','rows','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','push','UserVoiceQueue.penalty','MemberReport','forEach','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','loginInPause','PAUSE','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','mail','chat','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','Openchannel','transaction','addAgent','voicePause','removeTeams','getMailQueues','Mail','Whatsapp','getOpenchannelQueues','removeAgent','getDataValue','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','lastName','Contact','VoiceQueue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','token','apiKeyNonce','API\x20key\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./user.socket','register','jayson/promise','http','test','Sequelize','ValidationError','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','role','find','name','end','sendStatus','stack','send','index','fieldName','key','model','password','salt','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','sequelize','lower','filter','count','includeAll','include','User'];(function(_0x26b191,_0x2adebb){var _0xf1f06d=function(_0xb5e4eb){while(--_0xb5e4eb){_0x26b191['push'](_0x26b191['shift']());}};_0xf1f06d(++_0x2adebb);}(_0x7096,0x10c));var _0x6709=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7096[_0x1035c1];return _0x308d67;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6709('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6709('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6709('0x2'));var moment=require(_0x6709('0x3'));var BPromise=require(_0x6709('0x4'));var Mustache=require(_0x6709('0x5'));var util=require(_0x6709('0x6'));var path=require(_0x6709('0x7'));var sox=require(_0x6709('0x8'));var csv=require(_0x6709('0x9'));var ejs=require(_0x6709('0xa'));var fs=require('fs');var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var db=require(_0x6709('0x18'))['db'];config[_0x6709('0x19')]=_[_0x6709('0x1a')](config[_0x6709('0x19')],{'host':_0x6709('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6709('0x19')]));require(_0x6709('0x1c'))[_0x6709('0x1d')](socket);var jayson=require(_0x6709('0x1e'));var client=jayson['client'][_0x6709('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x5c667c,_0x41af1f,_0x4bc059){if(_0x4bc059){var _0x149233=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x149233[_0x6709('0x20')](_0x41af1f)){return _0x5c667c;}else{throw new db[(_0x6709('0x21'))][(_0x6709('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 _0x5c667c;}}function respondWithRpcPromise(_0x52e342,_0x5c4f94,_0x3fa5b1,_0x235a54){return new BPromise(function(_0x4a732e,_0x9c1fd8){var _0x166c97=_0x235a54||client;return _0x166c97[_0x6709('0x23')](_0x52e342,_0x3fa5b1)['then'](function(_0x13cf04){logger[_0x6709('0x24')](_0x6709('0x25'),_0x5c4f94,_0x6709('0x26'));logger['debug'](_0x6709('0x27'),_0x5c4f94,_0x6709('0x26'),JSON[_0x6709('0x28')](_0x13cf04));if(_0x13cf04[_0x6709('0x29')]){if(_0x13cf04[_0x6709('0x29')][_0x6709('0x2a')]===0x1f4){logger[_0x6709('0x29')](_0x6709('0x25'),_0x5c4f94,_0x13cf04[_0x6709('0x29')][_0x6709('0x2b')]);return _0x9c1fd8(_0x13cf04[_0x6709('0x29')][_0x6709('0x2b')]);}logger['error'](_0x6709('0x25'),_0x5c4f94,_0x13cf04[_0x6709('0x29')][_0x6709('0x2b')]);return _0x4a732e(_0x13cf04['error'][_0x6709('0x2b')]);}else{logger[_0x6709('0x24')](_0x6709('0x25'),_0x5c4f94,_0x6709('0x26'));_0x4a732e(_0x13cf04['result'][_0x6709('0x2b')]);}})[_0x6709('0x2c')](function(_0x50f7d6){logger[_0x6709('0x29')](_0x6709('0x25'),_0x5c4f94,_0x50f7d6);_0x9c1fd8(_0x50f7d6);});});}function respondWithStatusCode(_0x5dbb87,_0x444b0e){_0x444b0e=_0x444b0e||0xcc;return function(_0x2499a2){if(_0x2499a2){return _0x5dbb87['sendStatus'](_0x444b0e);}return _0x5dbb87[_0x6709('0x2d')](_0x444b0e)['end']();};}function respondWithResult(_0x46a325,_0x3cd555){_0x3cd555=_0x3cd555||0xc8;return function(_0x5b6906){if(_0x5b6906){return _0x46a325[_0x6709('0x2d')](_0x3cd555)['json'](_0x5b6906);}};}function respondWithFilteredResult(_0xe066d8,_0x388aee){return function(_0x4ad1c3){if(_0x4ad1c3){var _0x1a9eea=_0x4ad1c3['count'],_0x5deff5=_0x388aee['offset'],_0x138318=_0x388aee[_0x6709('0x2e')]+_0x388aee[_0x6709('0x2f')],_0x135f46;if(_0x138318>=_0x1a9eea){_0x138318=_0x1a9eea;_0x135f46=0xc8;}else{_0x135f46=0xce;}_0xe066d8[_0x6709('0x2d')](_0x135f46);return _0xe066d8[_0x6709('0x30')](_0x6709('0x31'),_0x5deff5+'-'+_0x138318+'/'+_0x1a9eea)[_0x6709('0x32')](_0x4ad1c3);}return null;};}function patchUpdates(_0x69593c){return function(_0x402e45){try{jsonpatch[_0x6709('0x33')](_0x402e45,_0x69593c,!![]);}catch(_0x5d399b){return BPromise[_0x6709('0x34')](_0x5d399b);}return _0x402e45[_0x6709('0x35')]();};}function saveUpdates(_0x3cfbe6,_0x27e929){return function(_0x5dc856){if(_0x5dc856){return _0x5dc856[_0x6709('0x36')](_0x3cfbe6)[_0x6709('0x37')](function(_0x124e01){return _0x124e01;});}return null;};}function removeEntity(_0x1bd075,_0x4fd344){return function(_0x3bfc6d){if(_0x3bfc6d){return _0x3bfc6d[_0x6709('0x38')]()['then'](function(){var _0x8952f1=_0x3bfc6d[_0x6709('0x39')]({'plain':!![]});var _0x5aa83b=[{'name':_0x6709('0x3a'),'value':_0x6709('0x3b'),'ignore':!![]},{'name':_0x6709('0x3c'),'value':_0x6709('0x3d'),'ignore':![]},{'name':_0x6709('0x3e'),'value':_0x6709('0x3f'),'ignore':![]}];var _0x2cd68b=_(_0x5aa83b)['filter'](_0x6709('0x40'))[_0x6709('0x41')]('value')[_0x6709('0x42')]();if(_[_0x6709('0x43')](_0x2cd68b,_0x8952f1[_0x6709('0x44')])){return;}var _0x2bb89c=_[_0x6709('0x45')](_0x5aa83b,[_0x6709('0x42'),_0x8952f1['role']])[_0x6709('0x46')];return db['UserProfileResource'][_0x6709('0x38')]({'where':{'type':_0x2bb89c,'resourceId':_0x8952f1['id']}})[_0x6709('0x37')](function(){return _0x3bfc6d;});})[_0x6709('0x37')](function(){_0x1bd075['status'](0xcc)[_0x6709('0x47')]();});}};}function handleEntityNotFound(_0x300c5b,_0x2d9879){return function(_0x3f06d8){if(!_0x3f06d8){_0x300c5b[_0x6709('0x48')](0x194);}return _0x3f06d8;};}function handleError(_0x1030ee,_0x450654){_0x450654=_0x450654||0x1f4;return function(_0x4fd4af){logger[_0x6709('0x29')](_0x4fd4af[_0x6709('0x49')]);if(_0x4fd4af[_0x6709('0x46')]){delete _0x4fd4af[_0x6709('0x46')];}_0x1030ee[_0x6709('0x2d')](_0x450654)[_0x6709('0x4a')](_0x4fd4af);};}exports[_0x6709('0x4b')]=function(_0x5ef9e2,_0x5abb53){var _0x265750={},_0x3f0da1={},_0x98a12c={'count':0x0,'rows':[]};var _0x42790d=_['map'](db['User']['rawAttributes'],function(_0x3d4237){return{'name':_0x3d4237[_0x6709('0x4c')],'type':_0x3d4237['type'][_0x6709('0x4d')]};});_0x3f0da1[_0x6709('0x4e')]=_['differenceBy'](_['map'](_0x42790d,_0x6709('0x46')),[_0x6709('0x4f'),_0x6709('0x50')]);_0x3f0da1[_0x6709('0x51')]=_[_0x6709('0x52')](_0x5ef9e2['query']);_0x3f0da1[_0x6709('0x53')]=_['intersection'](_0x3f0da1[_0x6709('0x4e')],_0x3f0da1[_0x6709('0x51')]);_0x265750[_0x6709('0x54')]=_['intersection'](_0x3f0da1[_0x6709('0x4e')],qs['fields'](_0x5ef9e2['query'][_0x6709('0x55')]));_0x265750[_0x6709('0x54')]=_0x265750[_0x6709('0x54')][_0x6709('0x56')]?_0x265750[_0x6709('0x54')]:_0x3f0da1[_0x6709('0x4e')];if(!_0x5ef9e2[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x265750[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x5ef9e2[_0x6709('0x51')][_0x6709('0x2f')]);_0x265750[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x5ef9e2['query'][_0x6709('0x2e')]);}_0x265750['order']=qs['sort'](_0x5ef9e2[_0x6709('0x51')][_0x6709('0x59')]);_0x265750[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x5ef9e2[_0x6709('0x51')],_0x3f0da1[_0x6709('0x53')]),_0x42790d);if(_0x5ef9e2[_0x6709('0x51')]['filter']){_0x265750[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x265750[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x42790d,function(_0x4c01e3){if(_0x4c01e3[_0x6709('0x5d')]!=='VIRTUAL'){return db[_0x6709('0x5e')][_0x6709('0x5a')](db[_0x6709('0x5e')]['fn'](_0x6709('0x5f'),db[_0x6709('0x5e')]['col'](_0x4c01e3[_0x6709('0x46')])),{'$like':db[_0x6709('0x5e')]['fn'](_0x6709('0x5f'),'%'+_0x5ef9e2[_0x6709('0x51')][_0x6709('0x60')]+'%')});}})});}_0x265750=_['merge']({},_0x265750,_0x5ef9e2['options']);var _0x447aa5={'where':_0x265750['where']};return db['User'][_0x6709('0x61')](_0x447aa5)[_0x6709('0x37')](function(_0x1bf824){_0x98a12c[_0x6709('0x61')]=_0x1bf824;if(_0x5ef9e2[_0x6709('0x51')][_0x6709('0x62')]){_0x265750[_0x6709('0x63')]=[{'all':!![]}];}return db[_0x6709('0x64')][_0x6709('0x65')](_0x265750);})[_0x6709('0x37')](function(_0x3c6d1f){_0x98a12c['rows']=_0x3c6d1f;return _0x98a12c;})[_0x6709('0x37')](respondWithFilteredResult(_0x5abb53,_0x265750))[_0x6709('0x2c')](handleError(_0x5abb53,null));};exports['show']=function(_0x4bec85,_0x151ec8){var _0x1b7966={'raw':![],'where':{'id':_0x4bec85[_0x6709('0x66')]['id']}},_0x14bdd3={};_0x14bdd3['model']=_[_0x6709('0x67')](_['keys'](db[_0x6709('0x64')][_0x6709('0x68')]),[_0x6709('0x4f'),_0x6709('0x50')]);_0x14bdd3[_0x6709('0x51')]=_['keys'](_0x4bec85['query']);_0x14bdd3[_0x6709('0x53')]=_[_0x6709('0x69')](_0x14bdd3['model'],_0x14bdd3[_0x6709('0x51')]);_0x1b7966[_0x6709('0x54')]=_['intersection'](_0x14bdd3[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x4bec85[_0x6709('0x51')][_0x6709('0x55')]));_0x1b7966['attributes']=_0x1b7966['attributes'][_0x6709('0x56')]?_0x1b7966['attributes']:_0x14bdd3[_0x6709('0x4e')];if(_0x4bec85[_0x6709('0x51')][_0x6709('0x62')]){_0x1b7966['include']=[{'all':!![]}];}_0x1b7966=_[_0x6709('0x5c')]({},_0x1b7966,_0x4bec85['options']);return db['User'][_0x6709('0x45')](_0x1b7966)['then'](handleEntityNotFound(_0x151ec8,null))[_0x6709('0x37')](respondWithResult(_0x151ec8,null))['catch'](handleError(_0x151ec8,null));};exports[_0x6709('0x6a')]=function(_0x34f790,_0x103261){return db[_0x6709('0x64')]['bulkCreate'](_0x34f790[_0x6709('0x6b')],{'raw':![],'individualHooks':!![]})[_0x6709('0x37')](respondWithResult(_0x103261,0xc9))[_0x6709('0x2c')](handleError(_0x103261,null));};exports[_0x6709('0x36')]=function(_0x210451,_0x3d4d1c){if(_0x210451[_0x6709('0x6b')]['id']){delete _0x210451['body']['id'];}delete _0x210451[_0x6709('0x6b')][_0x6709('0x44')];return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x210451[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x3d4d1c,null))[_0x6709('0x37')](saveUpdates(_0x210451[_0x6709('0x6b')],null))[_0x6709('0x37')](respondWithResult(_0x3d4d1c,null))['catch'](handleError(_0x3d4d1c,null));};exports[_0x6709('0x6c')]=function(_0x122080,_0x50f992){return db[_0x6709('0x64')][_0x6709('0x6c')]()[_0x6709('0x37')](respondWithResult(_0x50f992,null))[_0x6709('0x2c')](handleError(_0x50f992,null));};exports[_0x6709('0x6d')]=function(_0x1df26d,_0x32db99,_0x475449){return db[_0x6709('0x64')]['find']({'where':{'id':_0x1df26d[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x32db99,null))[_0x6709('0x37')](function(_0x379020){if(_0x379020){return _0x379020[_0x6709('0x6d')](_0x1df26d[_0x6709('0x6b')][_0x6709('0x6e')],_[_0x6709('0x6f')](_0x1df26d[_0x6709('0x6b')],[_0x6709('0x6e'),'id'])||{});}})[_0x6709('0x37')](respondWithResult(_0x32db99,null))['catch'](handleError(_0x32db99,null));};var getLicense=function(_0x319b7e){return new BPromise(function(_0x47f73e,_0x566d6d){var _0x336b01=0x0;_0x319b7e[_0x6709('0x6b')][_0x6709('0x44')]===_0x6709('0x3d')&&_0x47f73e(_0x6709('0x70'));return db[_0x6709('0x64')][_0x6709('0x61')]({'where':{'$or':[{'role':_0x319b7e['body']['role']===_0x6709('0x3f')?'telephone':[_0x6709('0x71'),'user']}]}})[_0x6709('0x37')](function(_0x2f1faf){_0x336b01=_0x2f1faf;return require('../../config/license/util')['getLicense']();})['then'](function(_0x278148){var _0x2faf8f=_0x319b7e[_0x6709('0x6b')][_0x6709('0x44')]===_0x6709('0x3f')?_0x6709('0x72'):_0x6709('0x73');if(!_[_0x6709('0x74')](_0x278148[_0x2faf8f])&&_0x336b01>=_0x278148[_0x2faf8f]){return _0x566d6d({'message':_0x6709('0x75')});}return _0x47f73e(util[_0x6709('0x76')](_0x6709('0x77'),_0x2faf8f,_0x336b01));})[_0x6709('0x2c')](function(_0xde3469){return _0x566d6d(_0xde3469);});});};exports['create']=function(_0x296d9f,_0x549565){return getLicense(_0x296d9f)[_0x6709('0x37')](function(_0x31800f){if(!_0x296d9f['body']['internal']){var _0x18fe97;return db['Setting']['findById'](0x1)[_0x6709('0x37')](function(_0x3b19ae){return checkPasswordPattern(_0x3b19ae,_0x296d9f['body'][_0x6709('0x4f')],_0x3b19ae[_0x6709('0x78')]);})[_0x6709('0x37')](function(_0x3ef64c){_0x18fe97=_0x3ef64c[_0x6709('0x79')];return db['User']['max'](_0x6709('0x7a'));})[_0x6709('0x37')](function(_0x5906aa){if(_[_0x6709('0x74')](_0x5906aa)){if(_0x18fe97){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x18fe97;}else{_0x296d9f['body'][_0x6709('0x7a')]=0x1;}}else{if(_[_0x6709('0x74')](_0x18fe97)||_0x18fe97==_0x5906aa){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x5906aa+0x1;}else if(_0x18fe97>_0x5906aa){_0x296d9f['body']['internal']=_0x18fe97;}else{return db[_0x6709('0x5e')][_0x6709('0x51')](_0x6709('0x7b'),{'type':db[_0x6709('0x5e')][_0x6709('0x7c')]['SELECT']})[_0x6709('0x37')](function(_0x3e8e5c){if(_0x3e8e5c&&_0x3e8e5c['length']){for(var _0xea6d7=0x0,_0x12f077=_0x3e8e5c[_0x6709('0x56')];_0xea6d7<_0x12f077&&_[_0x6709('0x74')](_0x296d9f[_0x6709('0x6b')]['internal']);_0xea6d7++){if(_0x18fe97<=_0x3e8e5c[_0xea6d7][_0x6709('0x7d')]){_0x296d9f['body'][_0x6709('0x7a')]=_0x3e8e5c[_0xea6d7]['from'];}else if(_0x18fe97>_0x3e8e5c[_0xea6d7][_0x6709('0x7d')]&&_0x18fe97<=_0x3e8e5c[_0xea6d7]['to']){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x18fe97;}}}if(_[_0x6709('0x74')](_0x296d9f['body'][_0x6709('0x7a')])){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x5906aa+0x1;}});}}});}})[_0x6709('0x37')](function(){if(_0x296d9f[_0x6709('0x6b')][_0x6709('0x7e')]){_0x296d9f['body'][_0x6709('0x7f')]=_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')];_0x296d9f['body'][_0x6709('0x80')]={'mailbox':_0x296d9f[_0x6709('0x6b')]['internal'],'password':_0x296d9f[_0x6709('0x6b')][_0x6709('0x4f')],'fullname':_0x296d9f[_0x6709('0x6b')]['fullname'],'email':_0x296d9f[_0x6709('0x6b')][_0x6709('0x81')]};}if(_0x296d9f[_0x6709('0x6b')]&&_0x296d9f['body'][_0x6709('0x44')]===_0x6709('0x3d')){if(!_0x296d9f[_0x6709('0x6b')][_0x6709('0x82')]){_0x296d9f[_0x6709('0x6b')][_0x6709('0x82')]=['101',_0x6709('0x83'),_0x6709('0x84'),'113',_0x6709('0x85'),_0x6709('0x86'),_0x6709('0x87'),'106',_0x6709('0x88'),_0x6709('0x89'),_0x6709('0x8a'),_0x6709('0x8b'),_0x6709('0x8c'),_0x6709('0x8d')];}}return db[_0x6709('0x64')]['create'](_0x296d9f[_0x6709('0x6b')],{'include':[{'model':db[_0x6709('0x80')],'as':_0x6709('0x80')}]});})[_0x6709('0x37')](function(_0x34096e){if(_0x296d9f[_0x6709('0x6b')][_0x6709('0x44')]==='user')return _0x34096e;var _0x1d1f24=_0x296d9f['user'][_0x6709('0x39')]({'plain':!![]});if(!_0x1d1f24)throw new Error(_0x6709('0x8e'));if(_0x1d1f24[_0x6709('0x44')]===_0x6709('0x3b')){var _0x329561=_0x34096e[_0x6709('0x39')]({'plain':!![]});var _0x223fb5=[{'name':_0x6709('0x3c'),'value':_0x6709('0x3d')},{'name':_0x6709('0x3e'),'value':_0x6709('0x3f')}];var _0xcba655=_[_0x6709('0x45')](_0x223fb5,[_0x6709('0x42'),_0x329561['role']])['name'];return db[_0x6709('0x8f')][_0x6709('0x45')]({'where':{'name':_0xcba655,'userProfileId':_0x1d1f24['userProfileId']},'raw':!![]})[_0x6709('0x37')](function(_0xca17a6){if(_0xca17a6&&_0xca17a6[_0x6709('0x90')]===0x0){return db[_0x6709('0x91')][_0x6709('0x92')]({'name':_0x329561[_0x6709('0x46')],'resourceId':_0x329561['id'],'type':_0xca17a6[_0x6709('0x46')],'sectionId':_0xca17a6['id']},{})['then'](function(){return _0x34096e;});}else{return _0x34096e;}})[_0x6709('0x2c')](function(_0x2385cb){logger[_0x6709('0x29')](_0x6709('0x93'),_0x2385cb);throw _0x2385cb;});}return _0x34096e;})['then'](respondWithResult(_0x549565,0xc9))['catch'](handleError(_0x549565,null));};exports[_0x6709('0x94')]=function(_0x17d074,_0x24bb82,_0x1473ab){var _0x16a3e2=![];if(_0x17d074[_0x6709('0x6b')]['id']){delete _0x17d074[_0x6709('0x6b')]['id'];}return db[_0x6709('0x95')][_0x6709('0x96')]({'attributes':['id',_0x6709('0x78')]})[_0x6709('0x37')](function(_0x158e1d){_0x16a3e2=_0x158e1d['securePassword'];return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x17d074[_0x6709('0x66')]['id']}});})['then'](function(_0x1f1dc2){if(_0x1f1dc2){if(_0x1f1dc2['id']==_0x17d074[_0x6709('0x3b')]['id']){if(!_0x17d074['body'][_0x6709('0x97')]||!_0x17d074['body'][_0x6709('0x98')]){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0x99'));}if(!_0x1f1dc2[_0x6709('0x9a')](_0x17d074[_0x6709('0x6b')][_0x6709('0x97')])){throw new db[(_0x6709('0x21'))]['ValidationError'](_0x6709('0x9b'));}if(_0x17d074[_0x6709('0x6b')][_0x6709('0x97')]==_0x17d074['body']['newPassword']){throw new db['Sequelize'][(_0x6709('0x22'))](_0x6709('0x9c'));}return _0x1f1dc2;}else if(_0x17d074[_0x6709('0x3b')][_0x6709('0x44')]==_0x6709('0x71')){if(!_0x17d074['body'][_0x6709('0x98')]){throw new db['Sequelize'][(_0x6709('0x22'))](_0x6709('0x9d'));}return _0x1f1dc2;}else if(_0x17d074[_0x6709('0x3b')][_0x6709('0x44')]=='user'){if(!_0x17d074[_0x6709('0x6b')][_0x6709('0x98')]){throw new db['Sequelize'][(_0x6709('0x22'))](_0x6709('0x9d'));}if(_0x1f1dc2[_0x6709('0x44')]!=_0x6709('0x3d')){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0x9e'));}return _0x1f1dc2;}else{throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0x9e'));}}return null;})['then'](handleEntityNotFound(_0x24bb82,null))['then'](function(_0x49e603){return checkPasswordPattern(_0x49e603,_0x17d074['body']['newPassword'],_0x16a3e2);})['then'](saveUpdates({'password':_0x17d074['body'][_0x6709('0x98')],'passwordResetAt':_0x17d074[_0x6709('0x3b')]['id']==_0x17d074[_0x6709('0x66')]['id']?moment():null},null))[_0x6709('0x37')](respondWithResult(_0x24bb82,null))[_0x6709('0x2c')](handleError(_0x24bb82,null));};exports[_0x6709('0x9f')]=function(_0x2ba8b3,_0x44cb0e,_0x48f212){var _0x20db55=_0x2ba8b3[_0x6709('0x6b')][_0x6709('0xa0')];return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x2ba8b3[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),_0x6709('0x44'),_0x6709('0xa1'),'loginInPause','voicePause',_0x6709('0xa2')]})['then'](handleEntityNotFound(_0x44cb0e,null))['then'](function(_0x7f72eb){if(_0x7f72eb){if(!utils[_0x6709('0xa3')](_0x20db55)){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0xa4'));}return _0x7f72eb['add'+_[_0x6709('0xa5')](_0x20db55['toLowerCase']())+_0x6709('0xa6')](_0x2ba8b3[_0x6709('0x6b')]['ids'],{'penalty':_0x2ba8b3['body'][_0x6709('0xa7')]||0x0})[_0x6709('0xa8')](function(_0x5ababa){for(var _0x27812b=0x0;_0x27812b<_0x2ba8b3[_0x6709('0x6b')][_0x6709('0x6e')][_0x6709('0x56')];_0x27812b+=0x1){var _0x252797={'UserId':_0x2ba8b3[_0x6709('0x66')]['id']};_0x252797[_[_0x6709('0xa5')](_0x20db55['toLowerCase']())+_0x6709('0xa9')]=_0x2ba8b3[_0x6709('0x6b')][_0x6709('0x6e')][_0x27812b];socket[_0x6709('0xaa')](_0x6709('0x3b')+_['capitalize'](_0x20db55[_0x6709('0xab')]())+_0x6709('0xac'),_0x252797);}return _0x5ababa;})['then'](function(){if(_0x20db55==='voice'){return db['VoiceQueue'][_0x6709('0x65')]({'where':{'id':_0x2ba8b3['body'][_0x6709('0x6e')]||[]},'raw':!![],'attributes':['id',_0x6709('0x46')]});}})[_0x6709('0x37')](function(_0x2cc27d){var _0x165495=_0x7f72eb['get']({'plain':!![]});var _0x3bf7d3=[];if(_0x20db55===_0x6709('0xad')&&_0x165495[_0x6709('0x44')]===_0x6709('0x3d')&&_0x165495['online']){for(var _0xfae4b5=0x0;_0xfae4b5<_0x2cc27d['length'];_0xfae4b5+=0x1){_0x3bf7d3['push']({'membername':_0x165495[_0x6709('0x46')],'UserId':_0x165495['id'],'queue_name':_0x2cc27d[_0xfae4b5]['name'],'VoiceQueueId':_0x2cc27d[_0xfae4b5]['id'],'interface':_[_0x6709('0x74')](_0x165495[_0x6709('0xa2')])?util['format']('SIP/%s',_0x165495[_0x6709('0x46')]):_0x165495[_0x6709('0xa2')],'paused':_0x165495['voicePause']||![],'penalty':_0x2ba8b3['body'][_0x6709('0xa7')]||0x0});}return BPromise[_0x6709('0xae')](_0x3bf7d3,function(_0x5c6113){return db[_0x6709('0xaf')][_0x6709('0xb0')](_0x5c6113);});}return _0x7f72eb;});}})[_0x6709('0x37')](respondWithStatusCode(_0x44cb0e,null))[_0x6709('0x2c')](handleError(_0x44cb0e,null));};exports[_0x6709('0xb1')]=function(_0x42ca7b,_0x3d981a,_0x57839){var _0x1c503e;return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x42ca7b[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),'role']})[_0x6709('0x37')](handleEntityNotFound(_0x3d981a,null))[_0x6709('0x37')](function(_0x832179){if(_0x832179){_0x1c503e=_0x832179;if(!_0x42ca7b['query'][_0x6709('0xa0')]||!utils['isValidChannel'](_0x42ca7b[_0x6709('0x51')]['channel'])){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0xa4'));}return _0x832179[_0x6709('0xb2')+_[_0x6709('0xa5')](_0x42ca7b['query'][_0x6709('0xa0')]['toLowerCase']())+_0x6709('0xa6')](_0x42ca7b[_0x6709('0x51')][_0x6709('0x6e')]);}})['then'](function(_0x54f63d){for(var _0x1fb84e=0x0;_0x1fb84e<_0x42ca7b[_0x6709('0x51')][_0x6709('0x6e')]['length'];_0x1fb84e+=0x1){var _0x396c9b={'UserId':_0x42ca7b[_0x6709('0x66')]['id']};_0x396c9b[_[_0x6709('0xa5')](_0x42ca7b[_0x6709('0x51')][_0x6709('0xa0')][_0x6709('0xab')]())+_0x6709('0xa9')]=_0x42ca7b['query']['ids'][_0x1fb84e];socket['emit'](_0x6709('0x3b')+_['capitalize'](_0x42ca7b[_0x6709('0x51')][_0x6709('0xa0')][_0x6709('0xab')]())+_0x6709('0xb3'),_0x396c9b);}return _0x54f63d;})[_0x6709('0x37')](function(){if(_0x42ca7b['query']['channel']===_0x6709('0xad')){return db[_0x6709('0xaf')][_0x6709('0x38')]({'where':{'UserId':_0x42ca7b[_0x6709('0x66')]['id'],'VoiceQueueId':_0x42ca7b['query'][_0x6709('0x6e')]},'individualHooks':!![]})[_0x6709('0x37')](function(){return _0x1c503e;});}return _0x1c503e;})[_0x6709('0x37')](respondWithStatusCode(_0x3d981a,null))[_0x6709('0x2c')](handleError(_0x3d981a,null));};exports[_0x6709('0xb4')]=function(_0x10bf16,_0x32bb84,_0x380114){_0x10bf16[_0x6709('0x6b')][_0x6709('0xb5')]=_0x10bf16[_0x6709('0xb6')][_0x6709('0xb7')];return db[_0x6709('0x64')]['find']({'where':{'id':_0x10bf16['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x32bb84,null))['then'](saveUpdates(_0x10bf16['body'],null))[_0x6709('0x37')](respondWithResult(_0x32bb84,null))['catch'](handleError(_0x32bb84,null));};exports[_0x6709('0xb8')]=function(_0x17f7d6,_0x1a427c,_0x39a42d){var _0x3bea4e=path[_0x6709('0xb9')](config[_0x6709('0xba')],_0x6709('0xbb'));return db[_0x6709('0x64')]['find']({'where':{'id':_0x17f7d6['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x6709('0x37')](handleEntityNotFound(_0x1a427c,null))[_0x6709('0x37')](function(_0x27198d){if(_0x27198d){if(_[_0x6709('0x74')](_0x27198d[_0x6709('0xb5')])){return _0x1a427c['download'](_0x3bea4e);}else{if(!fs[_0x6709('0xbc')](path[_0x6709('0xb9')](config[_0x6709('0xba')],_0x6709('0xbd'),_0x27198d[_0x6709('0xb5')]))){return _0x1a427c[_0x6709('0xbe')](_0x3bea4e);}return _0x1a427c['download'](path['join'](config['root'],'server/files/images/',_0x27198d[_0x6709('0xb5')]));}}})[_0x6709('0x2c')](handleError(_0x1a427c,null));};exports[_0x6709('0xbf')]=function(_0x5030e9,_0x4cc5cd,_0x166855){var _0x20b176={};var _0x1b204d={};var _0x1ae2ee;var _0x55683f;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x5030e9['params']['id']}})['then'](handleEntityNotFound(_0x4cc5cd,null))[_0x6709('0x37')](function(_0x3ddebf){if(_0x3ddebf){_0x1ae2ee=_0x3ddebf;_0x1b204d['model']=_['keys'](db['CmContact']['rawAttributes']);_0x1b204d['query']=_[_0x6709('0x52')](_0x5030e9[_0x6709('0x51')]);_0x1b204d['filters']=_[_0x6709('0x69')](_0x1b204d[_0x6709('0x4e')],_0x1b204d[_0x6709('0x51')]);_0x20b176[_0x6709('0x54')]=_[_0x6709('0x69')](_0x1b204d[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x5030e9[_0x6709('0x51')][_0x6709('0x55')]));_0x20b176[_0x6709('0x54')]=_0x20b176[_0x6709('0x54')]['length']?_0x20b176[_0x6709('0x54')]:_0x1b204d[_0x6709('0x4e')];_0x20b176[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x5030e9[_0x6709('0x51')][_0x6709('0x59')]);_0x20b176[_0x6709('0x5a')]=qs[_0x6709('0x53')](_['pick'](_0x5030e9['query'],_0x1b204d[_0x6709('0x53')]));if(_0x5030e9[_0x6709('0x51')][_0x6709('0x60')]){_0x20b176[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x20b176['where'],{'$or':_[_0x6709('0x41')](_0x20b176[_0x6709('0x54')],function(_0x52c59c){var _0x25f9ae={};_0x25f9ae[_0x52c59c]={'$like':'%'+_0x5030e9['query']['filter']+'%'};return _0x25f9ae;})});}_0x20b176=_[_0x6709('0x5c')]({},_0x20b176,_0x5030e9[_0x6709('0xc1')]);return _0x1ae2ee[_0x6709('0xbf')](_0x20b176);}})['then'](function(_0x39e13c){if(_0x39e13c){_0x55683f=_0x39e13c[_0x6709('0x56')];if(_0x5030e9[_0x6709('0x51')]['hasOwnProperty'](_0x6709('0x62'))){_0x20b176[_0x6709('0x63')]=[{'model':db[_0x6709('0xc2')],'as':_0x6709('0xc3'),'required':![]},{'model':db[_0x6709('0xc4')],'as':_0x6709('0xc5'),'attributes':['id','name',_0x6709('0xc6')],'where':_0x5030e9[_0x6709('0x51')][_0x6709('0xc7')]?{'id':_0x5030e9[_0x6709('0x51')][_0x6709('0xc7')]}:undefined,'required':_0x5030e9['query']['tag']?!![]:![]}];}if(!_0x5030e9[_0x6709('0x51')]['hasOwnProperty']('nolimit')){_0x20b176['limit']=qs[_0x6709('0x2f')](_0x5030e9['query'][_0x6709('0x2f')]);_0x20b176[_0x6709('0x2e')]=qs['offset'](_0x5030e9[_0x6709('0x51')]['offset']);}return _0x1ae2ee[_0x6709('0xbf')](_0x20b176);}})[_0x6709('0x37')](function(_0x13f9c4){if(_0x13f9c4){return _0x13f9c4?{'count':_0x55683f,'rows':_0x13f9c4}:null;}})['then'](respondWithResult(_0x4cc5cd,null))['catch'](handleError(_0x4cc5cd,null));};exports[_0x6709('0xc8')]=function(_0x58e8d8,_0x241839,_0xdfe870){var _0x5a0826;var _0x294b8b;var _0x1dc08f={};var _0x512815;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x58e8d8[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),'role']})[_0x6709('0x37')](handleEntityNotFound(_0x241839,null))[_0x6709('0x37')](function(_0x31c4c0){if(!utils[_0x6709('0xa3')](_0x58e8d8[_0x6709('0x51')]['channel'])){throw new db['Sequelize'][(_0x6709('0x22'))]('Unknown\x20channel');}_0x5a0826=_0x31c4c0;var _0x396738={};_0x396738[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+_0x6709('0xc9')][_0x6709('0x68')]);_0x396738[_0x6709('0x51')]=_['keys'](_0x58e8d8['query']);_0x396738[_0x6709('0x53')]=_[_0x6709('0x69')](_0x396738[_0x6709('0x4e')],_0x396738[_0x6709('0x51')]);_0x1dc08f[_0x6709('0x54')]=_['intersection'](_0x396738[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x58e8d8[_0x6709('0x51')]['fields']));_0x1dc08f[_0x6709('0x54')]=_0x1dc08f[_0x6709('0x54')][_0x6709('0x56')]?_0x1dc08f[_0x6709('0x54')]:_0x396738[_0x6709('0x4e')];_0x1dc08f[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x58e8d8['query'][_0x6709('0x59')]);_0x1dc08f[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x58e8d8['query'],_0x396738[_0x6709('0x53')]));if(_0x58e8d8[_0x6709('0x51')]['filter']){_0x1dc08f[_0x6709('0x5a')]=_['merge'](_0x1dc08f[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x1dc08f[_0x6709('0x54')],function(_0x5860b3){var _0x7cb76c={};_0x7cb76c[_0x5860b3]={'$like':'%'+_0x58e8d8[_0x6709('0x51')]['filter']+'%'};return _0x7cb76c;})});}_0x1dc08f=_[_0x6709('0x5c')]({},_0x1dc08f,_0x58e8d8[_0x6709('0xc1')]);switch(_0x5a0826[_0x6709('0x44')]){case _0x6709('0x71'):return db[_['capitalize'](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+'Queue'][_0x6709('0x65')](_0x1dc08f);case _0x6709('0x3b'):case _0x6709('0x3d'):return _0x5a0826[_0x6709('0x39')+_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+_0x6709('0xa6')](_0x1dc08f);default:throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0xca'));}})['then'](function(_0x574b4e){_0x512815=_0x574b4e['length'];if(!_0x58e8d8[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x1dc08f[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x58e8d8[_0x6709('0x51')][_0x6709('0x2f')]);_0x1dc08f[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x58e8d8[_0x6709('0x51')]['offset']);}switch(_0x5a0826[_0x6709('0x44')]){case _0x6709('0x71'):return db[_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')]['channel'])+'Queue']['findAll'](_0x1dc08f);case _0x6709('0x3b'):case _0x6709('0x3d'):return _0x5a0826['get'+_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+_0x6709('0xa6')](_0x1dc08f);}})[_0x6709('0x37')](function(_0x5d14e5){return{'count':_0x512815,'rows':_0x5d14e5};})[_0x6709('0x37')](respondWithResult(_0x241839,null))[_0x6709('0x2c')](handleError(_0x241839,null));};exports[_0x6709('0xcb')]=function(_0x1fe96c,_0x28aa16,_0x539975){var _0x35080c={};var _0x426f2f={};var _0x266450;var _0x3f6961;return db['User'][_0x6709('0x96')]({'where':{'id':_0x1fe96c['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x28aa16,null))[_0x6709('0x37')](function(_0x514154){if(_0x514154){_0x266450=_0x514154;_0x426f2f[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xaf')][_0x6709('0x68')]);_0x426f2f[_0x6709('0x51')]=_[_0x6709('0x52')](_0x1fe96c[_0x6709('0x51')]);_0x426f2f[_0x6709('0x53')]=_[_0x6709('0x69')](_0x426f2f[_0x6709('0x4e')],_0x426f2f[_0x6709('0x51')]);_0x35080c[_0x6709('0x54')]=_['intersection'](_0x426f2f[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x1fe96c[_0x6709('0x51')][_0x6709('0x55')]));_0x35080c['attributes']=_0x35080c[_0x6709('0x54')]['length']?_0x35080c[_0x6709('0x54')]:_0x426f2f[_0x6709('0x4e')];_0x35080c['order']=qs[_0x6709('0x59')](_0x1fe96c[_0x6709('0x51')][_0x6709('0x59')]);_0x35080c[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x1fe96c[_0x6709('0x51')],_0x426f2f[_0x6709('0x53')]));if(_0x1fe96c['query'][_0x6709('0x60')]){_0x35080c[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x35080c[_0x6709('0x5a')],{'$or':_['map'](_0x35080c['attributes'],function(_0x30ae87){var _0x2388cb={};_0x2388cb[_0x30ae87]={'$like':'%'+_0x1fe96c[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x2388cb;})});}_0x35080c=_[_0x6709('0x5c')]({},_0x35080c,_0x1fe96c[_0x6709('0xc1')]);return _0x266450[_0x6709('0xcb')](_0x35080c);}})[_0x6709('0x37')](function(_0x1c4ba0){if(_0x1c4ba0){_0x3f6961=_0x1c4ba0[_0x6709('0x56')];if(!_0x1fe96c[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x35080c[_0x6709('0x2f')]=qs['limit'](_0x1fe96c[_0x6709('0x51')]['limit']);_0x35080c[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x1fe96c[_0x6709('0x51')]['offset']);}return _0x266450[_0x6709('0xcb')](_0x35080c);}})[_0x6709('0x37')](function(_0x1c2fb9){if(_0x1c2fb9){return _0x1c2fb9?{'count':_0x3f6961,'rows':_0x1c2fb9}:null;}})[_0x6709('0x37')](respondWithResult(_0x28aa16,null))[_0x6709('0x2c')](handleError(_0x28aa16,null));};exports['getGroups']=function(_0x529689,_0xe68f09,_0x5a0718){var _0x160582={};var _0x23f3d2={};var _0x53982e;var _0x94c149;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x529689[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0xe68f09,null))[_0x6709('0x37')](function(_0x1ff331){if(_0x1ff331){_0x53982e=_0x1ff331;_0x23f3d2['model']=_[_0x6709('0x52')](db[_0x6709('0xcc')][_0x6709('0x68')]);_0x23f3d2[_0x6709('0x51')]=_[_0x6709('0x52')](_0x529689[_0x6709('0x51')]);_0x23f3d2[_0x6709('0x53')]=_[_0x6709('0x69')](_0x23f3d2[_0x6709('0x4e')],_0x23f3d2[_0x6709('0x51')]);_0x160582[_0x6709('0x54')]=_[_0x6709('0x69')](_0x23f3d2[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x529689['query'][_0x6709('0x55')]));_0x160582[_0x6709('0x54')]=_0x160582['attributes'][_0x6709('0x56')]?_0x160582[_0x6709('0x54')]:_0x23f3d2[_0x6709('0x4e')];_0x160582[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x529689[_0x6709('0x51')][_0x6709('0x59')]);_0x160582[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x529689[_0x6709('0x51')],_0x23f3d2['filters']));if(_0x529689['query'][_0x6709('0x60')]){_0x160582[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x160582['where'],{'$or':_[_0x6709('0x41')](_0x160582[_0x6709('0x54')],function(_0x4d0d86){var _0x15e3cc={};_0x15e3cc[_0x4d0d86]={'$like':'%'+_0x529689[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x15e3cc;})});}_0x160582=_[_0x6709('0x5c')]({},_0x160582,_0x529689['options']);return _0x53982e['getGroups'](_0x160582);}})[_0x6709('0x37')](function(_0x569597){if(_0x569597){_0x94c149=_0x569597[_0x6709('0x56')];if(!_0x529689['query']['hasOwnProperty']('nolimit')){_0x160582[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x529689[_0x6709('0x51')][_0x6709('0x2f')]);_0x160582[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x529689['query'][_0x6709('0x2e')]);}return _0x53982e[_0x6709('0xcd')](_0x160582);}})[_0x6709('0x37')](function(_0x511ba7){if(_0x511ba7){return _0x511ba7?{'count':_0x94c149,'rows':_0x511ba7}:null;}})[_0x6709('0x37')](respondWithResult(_0xe68f09,null))['catch'](handleError(_0xe68f09,null));};exports[_0x6709('0xce')]=function(_0x3bc389,_0x2904f5,_0x17b3db){var _0x36bdd5={'raw':!![],'where':{}};var _0x14b824={};var _0x55ad03={'count':0x0,'rows':[]};return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3bc389[_0x6709('0x66')]['id']}})['then'](handleEntityNotFound(_0x2904f5,null))[_0x6709('0x37')](function(_0x3af6e3){if(_0x3af6e3){_0x14b824[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xcf')]['rawAttributes']);_0x14b824[_0x6709('0x51')]=_[_0x6709('0x52')](_0x3bc389[_0x6709('0x51')]);_0x14b824[_0x6709('0x53')]=_[_0x6709('0x69')](_0x14b824[_0x6709('0x4e')],_0x14b824[_0x6709('0x51')]);_0x36bdd5[_0x6709('0x54')]=_[_0x6709('0x69')](_0x14b824[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x3bc389[_0x6709('0x51')][_0x6709('0x55')]));_0x36bdd5[_0x6709('0x54')]=_0x36bdd5[_0x6709('0x54')][_0x6709('0x56')]?_0x36bdd5[_0x6709('0x54')]:_0x14b824[_0x6709('0x4e')];if(!_0x3bc389['query'][_0x6709('0x57')]('nolimit')){_0x36bdd5['limit']=qs['limit'](_0x3bc389[_0x6709('0x51')]['limit']);_0x36bdd5[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3bc389['query'][_0x6709('0x2e')]);}_0x36bdd5[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x3bc389['query'][_0x6709('0x59')]);_0x36bdd5[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3bc389[_0x6709('0x51')],_0x14b824['filters']));_0x36bdd5['where'][_0x6709('0xd0')]=_0x3af6e3['id'];if(_0x3bc389[_0x6709('0x51')][_0x6709('0x60')]){_0x36bdd5['where']=_['merge'](_0x36bdd5[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x36bdd5[_0x6709('0x54')],function(_0x451fd0){var _0x4b7a78={};_0x4b7a78[_0x451fd0]={'$like':'%'+_0x3bc389['query']['filter']+'%'};return _0x4b7a78;})});}_0x36bdd5=_[_0x6709('0x5c')]({},_0x36bdd5,_0x3bc389[_0x6709('0xc1')]);return db[_0x6709('0xcf')][_0x6709('0x61')]({'where':_0x36bdd5[_0x6709('0x5a')]})[_0x6709('0x37')](function(_0x2681f5){_0x55ad03[_0x6709('0x61')]=_0x2681f5;if(_0x3bc389['query'][_0x6709('0x62')]){_0x36bdd5['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x6709('0x65')](_0x36bdd5);})[_0x6709('0x37')](function(_0x290235){_0x55ad03['rows']=_0x290235;return _0x55ad03;});}})[_0x6709('0x37')](respondWithFilteredResult(_0x2904f5,_0x36bdd5))['catch'](handleError(_0x2904f5,null));};exports[_0x6709('0xd1')]=function(_0x3ff2d6,_0x174fe3,_0x5c5be3){var _0x368fca={'raw':!![],'where':{}};var _0x10bd88={};var _0x352ee4={'count':0x0,'rows':[]};return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3ff2d6['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x174fe3,null))[_0x6709('0x37')](function(_0x38956f){if(_0x38956f){_0x10bd88[_0x6709('0x4e')]=_['keys'](db[_0x6709('0xd2')][_0x6709('0x68')]);_0x10bd88[_0x6709('0x51')]=_['keys'](_0x3ff2d6['query']);_0x10bd88[_0x6709('0x53')]=_['intersection'](_0x10bd88[_0x6709('0x4e')],_0x10bd88[_0x6709('0x51')]);_0x368fca[_0x6709('0x54')]=_[_0x6709('0x69')](_0x10bd88['model'],qs[_0x6709('0x55')](_0x3ff2d6['query'][_0x6709('0x55')]));_0x368fca['attributes']=_0x368fca['attributes'][_0x6709('0x56')]?_0x368fca[_0x6709('0x54')]:_0x10bd88[_0x6709('0x4e')];if(!_0x3ff2d6['query']['hasOwnProperty'](_0x6709('0x58'))){_0x368fca['limit']=qs[_0x6709('0x2f')](_0x3ff2d6['query'][_0x6709('0x2f')]);_0x368fca[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3ff2d6['query'][_0x6709('0x2e')]);}_0x368fca[_0x6709('0xc0')]=qs['sort'](_0x3ff2d6[_0x6709('0x51')][_0x6709('0x59')]);_0x368fca[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3ff2d6[_0x6709('0x51')],_0x10bd88['filters']));_0x368fca[_0x6709('0x5a')]['UserId']=_0x38956f['id'];if(_0x3ff2d6[_0x6709('0x51')]['filter']){_0x368fca['where']=_[_0x6709('0x5c')](_0x368fca[_0x6709('0x5a')],{'$or':_['map'](_0x368fca[_0x6709('0x54')],function(_0x4612ca){var _0x180e96={};_0x180e96[_0x4612ca]={'$like':'%'+_0x3ff2d6[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x180e96;})});}_0x368fca=_[_0x6709('0x5c')]({},_0x368fca,_0x3ff2d6['options']);return db[_0x6709('0xd2')][_0x6709('0x61')]({'where':_0x368fca[_0x6709('0x5a')]})['then'](function(_0x56dab8){_0x352ee4[_0x6709('0x61')]=_0x56dab8;if(_0x3ff2d6[_0x6709('0x51')][_0x6709('0x62')]){_0x368fca[_0x6709('0x63')]=[{'all':!![]}];}return db[_0x6709('0xd2')][_0x6709('0x65')](_0x368fca);})['then'](function(_0x2ff6e0){_0x352ee4[_0x6709('0xd3')]=_0x2ff6e0;return _0x352ee4;});}})[_0x6709('0x37')](respondWithFilteredResult(_0x174fe3,_0x368fca))[_0x6709('0x2c')](handleError(_0x174fe3,null));};exports[_0x6709('0xd4')]=function(_0x3ef287,_0x7ab43c,_0x58d5b5){var _0x5f5bdc={};var _0x6963ad={};var _0x145557;var _0x4478d7;return db['User'][_0x6709('0x96')]({'where':{'id':_0x3ef287['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x7ab43c,null))[_0x6709('0x37')](function(_0x5c6d1a){if(_0x5c6d1a){_0x145557=_0x5c6d1a;_0x6963ad[_0x6709('0x4e')]=_[_0x6709('0x52')](db['ChatInteraction'][_0x6709('0x68')]);_0x6963ad[_0x6709('0x51')]=_[_0x6709('0x52')](_0x3ef287[_0x6709('0x51')]);_0x6963ad[_0x6709('0x53')]=_['intersection'](_0x6963ad[_0x6709('0x4e')],_0x6963ad[_0x6709('0x51')]);_0x5f5bdc['attributes']=_[_0x6709('0x69')](_0x6963ad[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x3ef287[_0x6709('0x51')][_0x6709('0x55')]));_0x5f5bdc[_0x6709('0x54')]=_0x5f5bdc[_0x6709('0x54')][_0x6709('0x56')]?_0x5f5bdc[_0x6709('0x54')]:_0x6963ad[_0x6709('0x4e')];_0x5f5bdc[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x3ef287[_0x6709('0x51')][_0x6709('0x59')]);_0x5f5bdc[_0x6709('0x5a')]=qs[_0x6709('0x53')](_['pick'](_0x3ef287['query'],_0x6963ad[_0x6709('0x53')]));if(_0x3ef287[_0x6709('0x51')][_0x6709('0x60')]){_0x5f5bdc[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x5f5bdc[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x5f5bdc['attributes'],function(_0x55c582){var _0x17a28d={};_0x17a28d[_0x55c582]={'$like':'%'+_0x3ef287[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x17a28d;})});}_0x5f5bdc=_[_0x6709('0x5c')]({},_0x5f5bdc,_0x3ef287[_0x6709('0xc1')]);return _0x145557[_0x6709('0xd4')](_0x5f5bdc);}})[_0x6709('0x37')](function(_0x46cc47){if(_0x46cc47){_0x4478d7=_0x46cc47[_0x6709('0x56')];if(!_0x3ef287['query'][_0x6709('0x57')]('nolimit')){_0x5f5bdc['limit']=qs[_0x6709('0x2f')](_0x3ef287[_0x6709('0x51')][_0x6709('0x2f')]);_0x5f5bdc[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3ef287[_0x6709('0x51')][_0x6709('0x2e')]);}return _0x145557['getChatInteractions'](_0x5f5bdc);}})[_0x6709('0x37')](function(_0x37aa0d){if(_0x37aa0d){return _0x37aa0d?{'count':_0x4478d7,'rows':_0x37aa0d}:null;}})[_0x6709('0x37')](respondWithResult(_0x7ab43c,null))[_0x6709('0x2c')](handleError(_0x7ab43c,null));};exports[_0x6709('0xd5')]=function(_0x402ac8,_0x56ec9f,_0x58a02f){var _0x1315b9={};var _0x5d4cd1={};var _0x5dfe16;var _0x87c13f;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x402ac8[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x56ec9f,null))[_0x6709('0x37')](function(_0x22dcd6){if(_0x22dcd6){_0x5dfe16=_0x22dcd6;_0x5d4cd1['model']=_['keys'](db[_0x6709('0xd6')][_0x6709('0x68')]);_0x5d4cd1[_0x6709('0x51')]=_[_0x6709('0x52')](_0x402ac8['query']);_0x5d4cd1[_0x6709('0x53')]=_['intersection'](_0x5d4cd1[_0x6709('0x4e')],_0x5d4cd1[_0x6709('0x51')]);_0x1315b9[_0x6709('0x54')]=_[_0x6709('0x69')](_0x5d4cd1[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x402ac8[_0x6709('0x51')][_0x6709('0x55')]));_0x1315b9[_0x6709('0x54')]=_0x1315b9[_0x6709('0x54')][_0x6709('0x56')]?_0x1315b9[_0x6709('0x54')]:_0x5d4cd1['model'];_0x1315b9[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x402ac8[_0x6709('0x51')]['sort']);_0x1315b9[_0x6709('0x5a')]=qs['filters'](_['pick'](_0x402ac8[_0x6709('0x51')],_0x5d4cd1[_0x6709('0x53')]));if(_0x402ac8[_0x6709('0x51')][_0x6709('0x60')]){_0x1315b9[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x1315b9['where'],{'$or':_[_0x6709('0x41')](_0x1315b9[_0x6709('0x54')],function(_0x1abe0e){var _0x5f57f1={};_0x5f57f1[_0x1abe0e]={'$like':'%'+_0x402ac8[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x5f57f1;})});}_0x1315b9=_[_0x6709('0x5c')]({},_0x1315b9,_0x402ac8[_0x6709('0xc1')]);return _0x5dfe16[_0x6709('0xd5')](_0x1315b9);}})['then'](function(_0x2cfa93){if(_0x2cfa93){_0x87c13f=_0x2cfa93['length'];if(!_0x402ac8[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x1315b9['limit']=qs[_0x6709('0x2f')](_0x402ac8[_0x6709('0x51')][_0x6709('0x2f')]);_0x1315b9[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x402ac8['query']['offset']);}return _0x5dfe16[_0x6709('0xd5')](_0x1315b9);}})['then'](function(_0x46eaae){if(_0x46eaae){return _0x46eaae?{'count':_0x87c13f,'rows':_0x46eaae}:null;}})['then'](respondWithResult(_0x56ec9f,null))[_0x6709('0x2c')](handleError(_0x56ec9f,null));};exports['getMailInteractions']=function(_0x28be39,_0x530187,_0xfc0fff){var _0x280f7f={'raw':!![],'where':{}};var _0x1f5df3={};var _0x25988c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x28be39[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x530187,null))[_0x6709('0x37')](function(_0x10f170){if(_0x10f170){_0x1f5df3[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xd7')]['rawAttributes']);_0x1f5df3['query']=_[_0x6709('0x52')](_0x28be39['query']);_0x1f5df3['filters']=_[_0x6709('0x69')](_0x1f5df3['model'],_0x1f5df3[_0x6709('0x51')]);_0x280f7f[_0x6709('0x54')]=_[_0x6709('0x69')](_0x1f5df3[_0x6709('0x4e')],qs['fields'](_0x28be39[_0x6709('0x51')][_0x6709('0x55')]));_0x280f7f[_0x6709('0x54')]=_0x280f7f[_0x6709('0x54')][_0x6709('0x56')]?_0x280f7f[_0x6709('0x54')]:_0x1f5df3[_0x6709('0x4e')];if(!_0x28be39['query'][_0x6709('0x57')]('nolimit')){_0x280f7f[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x28be39[_0x6709('0x51')][_0x6709('0x2f')]);_0x280f7f[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x28be39[_0x6709('0x51')]['offset']);}_0x280f7f[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x28be39['query'][_0x6709('0x59')]);_0x280f7f[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x28be39['query'],_0x1f5df3[_0x6709('0x53')]));_0x280f7f[_0x6709('0x5a')][_0x6709('0xd0')]=_0x10f170['id'];if(_0x28be39['query']['filter']){_0x280f7f[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x280f7f['where'],{'$or':_[_0x6709('0x41')](_0x280f7f[_0x6709('0x54')],function(_0x36db2d){var _0x17dd1a={};_0x17dd1a[_0x36db2d]={'$like':'%'+_0x28be39[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x17dd1a;})});}_0x280f7f=_['merge']({},_0x280f7f,_0x28be39[_0x6709('0xc1')]);return db[_0x6709('0xd7')]['count']({'where':_0x280f7f[_0x6709('0x5a')]})[_0x6709('0x37')](function(_0x410c6a){_0x25988c[_0x6709('0x61')]=_0x410c6a;if(_0x28be39[_0x6709('0x51')]['includeAll']){_0x280f7f[_0x6709('0x63')]=[{'all':!![]}];}return db[_0x6709('0xd7')][_0x6709('0x65')](_0x280f7f);})[_0x6709('0x37')](function(_0x5e92ef){_0x25988c[_0x6709('0xd3')]=_0x5e92ef;return _0x25988c;});}})[_0x6709('0x37')](respondWithFilteredResult(_0x530187,_0x280f7f))['catch'](handleError(_0x530187,null));};exports[_0x6709('0xd8')]=function(_0x266b26,_0x377ec5,_0x32fe8f){var _0x5e81c0={};var _0x272427={};var _0x14a285;var _0x4a6962;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x266b26[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x377ec5,null))[_0x6709('0x37')](function(_0x3f0b92){if(_0x3f0b92){_0x14a285=_0x3f0b92;_0x272427[_0x6709('0x4e')]=_['keys'](db[_0x6709('0xd9')]['rawAttributes']);_0x272427[_0x6709('0x51')]=_[_0x6709('0x52')](_0x266b26[_0x6709('0x51')]);_0x272427['filters']=_[_0x6709('0x69')](_0x272427[_0x6709('0x4e')],_0x272427['query']);_0x5e81c0[_0x6709('0x54')]=_[_0x6709('0x69')](_0x272427[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x266b26['query'][_0x6709('0x55')]));_0x5e81c0[_0x6709('0x54')]=_0x5e81c0[_0x6709('0x54')][_0x6709('0x56')]?_0x5e81c0[_0x6709('0x54')]:_0x272427['model'];_0x5e81c0[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x266b26['query']['sort']);_0x5e81c0[_0x6709('0x5a')]=qs['filters'](_[_0x6709('0x5b')](_0x266b26[_0x6709('0x51')],_0x272427[_0x6709('0x53')]));if(_0x266b26[_0x6709('0x51')][_0x6709('0x60')]){_0x5e81c0[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x5e81c0[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x5e81c0[_0x6709('0x54')],function(_0x53e85f){var _0x313c72={};_0x313c72[_0x53e85f]={'$like':'%'+_0x266b26[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x313c72;})});}_0x5e81c0=_['merge']({},_0x5e81c0,_0x266b26[_0x6709('0xc1')]);return _0x14a285[_0x6709('0xd8')](_0x5e81c0);}})[_0x6709('0x37')](function(_0xb15863){if(_0xb15863){_0x4a6962=_0xb15863[_0x6709('0x56')];if(!_0x266b26[_0x6709('0x51')][_0x6709('0x57')]('nolimit')){_0x5e81c0[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x266b26[_0x6709('0x51')]['limit']);_0x5e81c0[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x266b26[_0x6709('0x51')][_0x6709('0x2e')]);}return _0x14a285[_0x6709('0xd8')](_0x5e81c0);}})['then'](function(_0x15e5b8){if(_0x15e5b8){return _0x15e5b8?{'count':_0x4a6962,'rows':_0x15e5b8}:null;}})[_0x6709('0x37')](respondWithResult(_0x377ec5,null))['catch'](handleError(_0x377ec5,null));};exports[_0x6709('0xda')]=function(_0x3cf2ed,_0x2455f3,_0x445fcc){var _0x96cc20={};var _0x1ceea3={};var _0x4becda;var _0x4386cc;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3cf2ed[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x2455f3,null))['then'](function(_0x38537a){if(_0x38537a){_0x4becda=_0x38537a;_0x1ceea3['model']=_[_0x6709('0x52')](db[_0x6709('0xdb')][_0x6709('0x68')]);_0x1ceea3[_0x6709('0x51')]=_[_0x6709('0x52')](_0x3cf2ed['query']);_0x1ceea3['filters']=_[_0x6709('0x69')](_0x1ceea3[_0x6709('0x4e')],_0x1ceea3[_0x6709('0x51')]);_0x96cc20[_0x6709('0x54')]=_[_0x6709('0x69')](_0x1ceea3[_0x6709('0x4e')],qs['fields'](_0x3cf2ed[_0x6709('0x51')][_0x6709('0x55')]));_0x96cc20[_0x6709('0x54')]=_0x96cc20['attributes'][_0x6709('0x56')]?_0x96cc20[_0x6709('0x54')]:_0x1ceea3[_0x6709('0x4e')];_0x96cc20[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x3cf2ed[_0x6709('0x51')][_0x6709('0x59')]);_0x96cc20[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3cf2ed[_0x6709('0x51')],_0x1ceea3[_0x6709('0x53')]));if(_0x3cf2ed[_0x6709('0x51')][_0x6709('0x60')]){_0x96cc20[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x96cc20[_0x6709('0x5a')],{'$or':_['map'](_0x96cc20['attributes'],function(_0x3b20d8){var _0x18bbf7={};_0x18bbf7[_0x3b20d8]={'$like':'%'+_0x3cf2ed[_0x6709('0x51')]['filter']+'%'};return _0x18bbf7;})});}_0x96cc20=_[_0x6709('0x5c')]({},_0x96cc20,_0x3cf2ed['options']);return _0x4becda['getFaxInteractions'](_0x96cc20);}})[_0x6709('0x37')](function(_0x59049b){if(_0x59049b){_0x4386cc=_0x59049b[_0x6709('0x56')];if(!_0x3cf2ed[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x96cc20[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x3cf2ed['query'][_0x6709('0x2f')]);_0x96cc20['offset']=qs[_0x6709('0x2e')](_0x3cf2ed[_0x6709('0x51')]['offset']);}return _0x4becda[_0x6709('0xda')](_0x96cc20);}})['then'](function(_0x3a91fb){if(_0x3a91fb){return _0x3a91fb?{'count':_0x4386cc,'rows':_0x3a91fb}:null;}})[_0x6709('0x37')](respondWithResult(_0x2455f3,null))[_0x6709('0x2c')](handleError(_0x2455f3,null));};exports['getWhatsappInteractions']=function(_0x3ea0ec,_0x2899b9,_0x1d4cff){var _0x321f86={};var _0x59dd4a={};var _0x58190e;var _0x3b1418;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3ea0ec['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x2899b9,null))['then'](function(_0x47b830){if(_0x47b830){_0x58190e=_0x47b830;_0x59dd4a[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xdc')][_0x6709('0x68')]);_0x59dd4a[_0x6709('0x51')]=_['keys'](_0x3ea0ec['query']);_0x59dd4a['filters']=_[_0x6709('0x69')](_0x59dd4a[_0x6709('0x4e')],_0x59dd4a['query']);_0x321f86[_0x6709('0x54')]=_[_0x6709('0x69')](_0x59dd4a[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x3ea0ec['query'][_0x6709('0x55')]));_0x321f86[_0x6709('0x54')]=_0x321f86[_0x6709('0x54')][_0x6709('0x56')]?_0x321f86['attributes']:_0x59dd4a[_0x6709('0x4e')];_0x321f86['order']=qs[_0x6709('0x59')](_0x3ea0ec[_0x6709('0x51')][_0x6709('0x59')]);_0x321f86[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3ea0ec['query'],_0x59dd4a[_0x6709('0x53')]));if(_0x3ea0ec['query']['filter']){_0x321f86['where']=_['merge'](_0x321f86['where'],{'$or':_['map'](_0x321f86[_0x6709('0x54')],function(_0x4c90c5){var _0x1475df={};_0x1475df[_0x4c90c5]={'$like':'%'+_0x3ea0ec[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x1475df;})});}_0x321f86=_[_0x6709('0x5c')]({},_0x321f86,_0x3ea0ec[_0x6709('0xc1')]);return _0x58190e[_0x6709('0xdd')](_0x321f86);}})['then'](function(_0x3c3ad6){if(_0x3c3ad6){_0x3b1418=_0x3c3ad6[_0x6709('0x56')];if(!_0x3ea0ec['query'][_0x6709('0x57')]('nolimit')){_0x321f86[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x3ea0ec[_0x6709('0x51')][_0x6709('0x2f')]);_0x321f86[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3ea0ec[_0x6709('0x51')]['offset']);}return _0x58190e[_0x6709('0xdd')](_0x321f86);}})[_0x6709('0x37')](function(_0x35ff8e){if(_0x35ff8e){return _0x35ff8e?{'count':_0x3b1418,'rows':_0x35ff8e}:null;}})[_0x6709('0x37')](respondWithResult(_0x2899b9,null))[_0x6709('0x2c')](handleError(_0x2899b9,null));};exports['login']=function(_0xa2cb21,_0x37f8ef,_0x3a8d29){var _0x55b574;var _0x3c35bb;var _0x83a02;var _0x449319=!_['isNil'](_0xa2cb21[_0x6709('0x66')]['id'])?_0xa2cb21['params']['id']:!_['isNil'](_0xa2cb21[_0x6709('0x3b')]['id'])?_0xa2cb21['user']['id']:null;return db['User'][_0x6709('0x45')]({'where':{'id':_0x449319,'role':{'$or':[_0x6709('0x71'),_0x6709('0x3b'),_0x6709('0x3d')]}},'attributes':['id','name',_0x6709('0xde'),_0x6709('0xdf'),_0x6709('0x44'),_0x6709('0x7a'),'loginInPause']})[_0x6709('0x37')](function(_0x322f7f){if(_0x322f7f){if(_0x322f7f['role']===_0x6709('0x3d')){_0x55b574=_0x322f7f;if(_0xa2cb21[_0x6709('0x6b')]['interface']){_0x83a02=util['format'](_0x6709('0xe0'),_0x55b574[_0xa2cb21['body'][_0x6709('0xa2')]]);}else if(_0xa2cb21['body'][_0x6709('0xe1')]){_0x83a02=util['format'](_0x6709('0xe2'),_0xa2cb21[_0x6709('0x6b')][_0x6709('0xe1')]);}else{_0x83a02=util[_0x6709('0x76')]('SIP/%s',_0x55b574[_0x6709('0x46')]);}socket['to'](util['format'](_0x6709('0xe3'),_0x55b574[_0x6709('0x46')]))[_0x6709('0xaa')](_0x6709('0xe4'),{'ip':_0xa2cb21[_0x6709('0xe5')][_0x6709('0xe6')]||_0xa2cb21[_0x6709('0xe7')][_0x6709('0xe8')]||_0xa2cb21[_0x6709('0xe9')][_0x6709('0xe8')]||_0xa2cb21[_0x6709('0xe7')][_0x6709('0xe9')][_0x6709('0xe8')]});return db[_0x6709('0xaf')]['destroy']({'where':{'membername':_0x55b574['name']},'individualHooks':!![]});}}else{throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x55b574){return _0x55b574[_0x6709('0xea')]({'raw':!![]});}})['then'](function(_0x14b923){if(_0x55b574){var _0x1a2ad9=[];if(_0x14b923){_0x3c35bb=_0x14b923;if(_0x3c35bb[_0x6709('0x56')]){for(var _0x3094f2=0x0;_0x3094f2<_0x3c35bb[_0x6709('0x56')];_0x3094f2++){_0x1a2ad9[_0x6709('0xeb')]({'membername':_0x55b574[_0x6709('0x46')],'UserId':_0x55b574['id'],'queue_name':_0x3c35bb[_0x3094f2]['name'],'VoiceQueueId':_0x3c35bb[_0x3094f2]['id'],'interface':_0x83a02,'paused':_0x55b574['loginInPause']||![],'penalty':_0x3c35bb[_0x3094f2][_0x6709('0xec')]||0x0});}return BPromise[_0x6709('0xae')](_0x1a2ad9,function(_0x9106c5){return db[_0x6709('0xaf')][_0x6709('0xb0')](_0x9106c5);});}}}})[_0x6709('0x37')](function(){if(_0x55b574){return db[_0x6709('0xed')][_0x6709('0x65')]({'where':{'membername':_0x55b574[_0x6709('0x46')],'exitAt':null}});}})[_0x6709('0x37')](function(_0x58b66c){if(_0x55b574){var _0x414746=[];_0x58b66c[_0x6709('0xee')](function(_0x3a0f43){_0x414746[_0x6709('0xeb')](_0x3a0f43['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x6709('0xef')](_0x414746);}})[_0x6709('0x37')](function(){if(_0x55b574){var _0xbfbee6=[];var _0x402273=[];var _0x268974=utils[_0x6709('0xf0')]();var _0x2808f8={'membername':_0x55b574[_0x6709('0x46')],'interface':_0x83a02,'enterAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'role':_0x55b574[_0x6709('0x44')],'internal':_0x55b574[_0x6709('0x7a')]};_0x268974['forEach'](function(_0x49829a){_0xbfbee6['push'](_[_0x6709('0x5c')]({'channel':_0x49829a,'type':_0x6709('0xf2'),'data1':_0xa2cb21[_0x6709('0x6b')]['device'],'data2':_0x83a02},_0x2808f8));if(_0x55b574[_0x6709('0xf3')]){_0x402273[_0x6709('0xeb')](_[_0x6709('0x5c')]({'channel':_0x49829a,'type':_0x6709('0xf4'),'data1':'LOGININPAUSE'},_0x2808f8));}});return db[_0x6709('0xed')]['bulkCreate'](_0xbfbee6[_0x6709('0xf5')](_0x402273),{'individualHooks':!![]});}})[_0x6709('0x37')](function(){if(_0x55b574){return _0x55b574[_0x6709('0x36')]({'online':!![],'lastLoginAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'voicePause':_0x55b574[_0x6709('0xf3')]||![],'mailPause':_0x55b574[_0x6709('0xf3')]||![],'chatPause':_0x55b574[_0x6709('0xf3')]||![],'faxPause':_0x55b574[_0x6709('0xf3')]||![],'smsPause':_0x55b574[_0x6709('0xf3')]||![],'openchannelPause':_0x55b574['loginInPause']||![],'whatsappPause':_0x55b574[_0x6709('0xf3')]||![],'pauseType':_0x55b574[_0x6709('0xf3')]?'LOGININPAUSE':null,'interface':_0x83a02,'lastPauseAt':moment()[_0x6709('0x76')](_0x6709('0xf1'))});}})[_0x6709('0x37')](function(_0x4b2173){if(_0xa2cb21[_0x6709('0xf6')]){return _0x3a8d29();}else{return BPromise[_0x6709('0xf7')](_0x4b2173)[_0x6709('0x37')](respondWithResult(_0x37f8ef,null));}})['catch'](handleError(_0x37f8ef,null));};exports[_0x6709('0xf8')]=function(_0x162a37,_0xb6e828,_0x47ac2f){var _0x48f37a;return db['User']['find']({'where':{'id':_0x162a37[_0x6709('0x66')]['id'],'role':_0x6709('0x3d')},'attributes':['id',_0x6709('0x46'),'role']})[_0x6709('0x37')](handleEntityNotFound(_0xb6e828,null))['then'](function(_0x1588b1){if(_0x1588b1){_0x48f37a=_0x1588b1;return db['UserVoiceQueueRt'][_0x6709('0x38')]({'where':{'membername':_0x48f37a[_0x6709('0x46')]},'individualHooks':!![]});}})[_0x6709('0x37')](function(){return db[_0x6709('0xed')][_0x6709('0x65')]({'where':{'membername':_0x48f37a[_0x6709('0x46')],'exitAt':null}});})[_0x6709('0x37')](function(_0x2567fc){var _0x1e8cfc=[];_0x2567fc[_0x6709('0xee')](function(_0x223a6b){_0x1e8cfc[_0x6709('0xeb')](_0x223a6b[_0x6709('0x36')]({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1'))}));});return BPromise['all'](_0x1e8cfc);})['then'](function(){return _0x48f37a[_0x6709('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6709('0x37')](respondWithResult(_0xb6e828,null))[_0x6709('0x2c')](handleError(_0xb6e828,null));};exports['pause']=function(_0x1f188f,_0x4e4709,_0x55883b){var _0x17a159;return db[_0x6709('0xaf')][_0x6709('0x36')]({'paused':0x1},{'where':{'UserId':_0x1f188f[_0x6709('0x66')]['id']},'individualHooks':!![]})[_0x6709('0x37')](function(){return db[_0x6709('0x64')]['find']({'where':{'id':_0x1f188f[_0x6709('0x66')]['id'],'role':_0x6709('0x3d')},'attributes':['id',_0x6709('0x46'),_0x6709('0x44'),_0x6709('0x7a'),_0x6709('0xa2')]});})[_0x6709('0x37')](handleEntityNotFound(_0x4e4709,null))[_0x6709('0x37')](function(_0x24f582){if(_0x24f582){_0x17a159=_0x24f582;return respondWithRpcPromise(_0x6709('0xf9'),_0x6709('0xfa'),{'id':_0x17a159['id'],'name':_0x17a159['name'],'pause':!![]});}})[_0x6709('0x37')](function(){if(_0x17a159){return db['MemberReport'][_0x6709('0x65')]({'where':{'membername':_0x17a159[_0x6709('0x46')],'type':'PAUSE','exitAt':null}});}})[_0x6709('0x37')](function(_0x48943f){if(_0x48943f[_0x6709('0x56')]){var _0x5a14dc=moment()[_0x6709('0x76')](_0x6709('0xf1'));for(var _0x1ab6de=0x0,_0x14b649=_0x48943f['length'];_0x1ab6de<_0x14b649;_0x1ab6de++){_0x48943f[_0x1ab6de][_0x6709('0xfb')]({'exitAt':_0x5a14dc});}}})[_0x6709('0x37')](function(){var _0x15bbcc=[];var _0x149d54=utils[_0x6709('0xf0')]();_0x149d54['forEach'](function(_0x35bb0d){_0x15bbcc['push']({'channel':_0x35bb0d,'membername':_0x17a159['name'],'interface':_[_0x6709('0x74')](_0x17a159[_0x6709('0xa2')])?util[_0x6709('0x76')]('SIP/%s',_0x17a159[_0x6709('0x46')]):_0x17a159['interface'],'type':_0x6709('0xf4'),'enterAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data1':_0x1f188f['body'][_0x6709('0x5d')]||_0x6709('0xfc'),'role':_0x17a159[_0x6709('0x44')],'internal':_0x17a159[_0x6709('0x7a')]});});return db[_0x6709('0xed')][_0x6709('0x6a')](_0x15bbcc,{'individualHooks':!![]});})['then'](function(){return _0x17a159[_0x6709('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1f188f[_0x6709('0x6b')][_0x6709('0x5d')]||_0x6709('0xfc'),'lastPauseAt':moment()[_0x6709('0x76')](_0x6709('0xf1'))});})['then'](respondWithResult(_0x4e4709,null))[_0x6709('0x2c')](handleError(_0x4e4709,null));};exports['unpause']=function(_0x101d23,_0x496e1b,_0x269352){var _0x2eeb87;return db[_0x6709('0x64')]['find']({'where':{'id':_0x101d23[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),_0x6709('0x44'),'voicePause','mailPause','chatPause',_0x6709('0xfd'),'openchannelPause',_0x6709('0xfe'),_0x6709('0xff'),_0x6709('0x100'),_0x6709('0x101')]})[_0x6709('0x37')](handleEntityNotFound(_0x496e1b,null))[_0x6709('0x37')](function(_0x4e5dce){if(_0x4e5dce){_0x2eeb87=_0x4e5dce;if(_0x101d23[_0x6709('0x6b')][_0x6709('0xa0')]&&!utils['isValidChannel'](_0x101d23[_0x6709('0x6b')]['channel'])){throw new db[(_0x6709('0x21'))]['ValidationError'](_0x6709('0xa4'));}switch(_0x101d23['body'][_0x6709('0xa0')]){case _0x6709('0xad'):return respondWithRpcPromise(_0x6709('0xf9'),_0x6709('0x102'),{'id':_0x2eeb87['id'],'name':_0x2eeb87[_0x6709('0x46')],'pause':![]})[_0x6709('0x37')](function(){return db[_0x6709('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0x2eeb87['id']},'individualHooks':!![]});})[_0x6709('0x37')](function(){return db[_0x6709('0xed')]['find']({'where':{'channel':_0x101d23['body'][_0x6709('0xa0')],'membername':_0x2eeb87[_0x6709('0x46')],'type':_0x6709('0xf4'),'exitAt':null}});})['then'](function(_0xfb93fc){if(_0xfb93fc){return _0xfb93fc[_0x6709('0x36')]({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data2':_0x6709('0x103')},{'individualHooks':!![]});}return null;})[_0x6709('0x37')](function(){return _0x2eeb87['update']({'voicePause':![]});});case _0x6709('0x104'):case _0x6709('0x105'):case'fax':case'sms':case _0x6709('0x106'):case _0x6709('0x107'):return db['MemberReport'][_0x6709('0x45')]({'where':{'channel':_0x101d23[_0x6709('0x6b')][_0x6709('0xa0')],'membername':_0x2eeb87[_0x6709('0x46')],'type':_0x6709('0xf4'),'exitAt':null}})[_0x6709('0x37')](function(_0xcc5545){if(_0xcc5545){return _0xcc5545[_0x6709('0x36')]({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data2':_0x6709('0x103')},{'individualHooks':!![]});}return null;})[_0x6709('0x37')](function(){var _0x6606={};_[_0x6709('0x30')](_0x6606,util[_0x6709('0x76')](_0x6709('0x108'),_0x101d23[_0x6709('0x6b')][_0x6709('0xa0')],_0x6709('0x109')),![]);return _0x2eeb87['update'](_0x6606);});default:return respondWithRpcPromise(_0x6709('0xf9'),_0x6709('0x102'),{'id':_0x2eeb87['id'],'name':_0x2eeb87[_0x6709('0x46')],'pause':![]})[_0x6709('0x37')](function(){return db['UserVoiceQueueRt'][_0x6709('0x36')]({'paused':0x0},{'where':{'UserId':_0x2eeb87['id']}});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2eeb87['name'],'type':_0x6709('0xf4'),'exitAt':null}});})[_0x6709('0x37')](function(_0x831546){var _0xee9759=[];_0x831546[_0x6709('0xee')](function(_0x4a4c2f){_0xee9759[_0x6709('0xeb')](_0x4a4c2f['update']({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data2':_0x6709('0x103')}));});return BPromise[_0x6709('0xef')](_0xee9759);})[_0x6709('0x37')](function(){return _0x2eeb87[_0x6709('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x496e1b,null))[_0x6709('0x2c')](handleError(_0x496e1b,null));};exports[_0x6709('0x10a')]=function(_0x236eac,_0x17c21f,_0x5c7aec){var _0x24e055={};var _0x14364c={};var _0x2f0e79;var _0x5bab6c;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x236eac[_0x6709('0x66')]['id']}})['then'](handleEntityNotFound(_0x17c21f,null))[_0x6709('0x37')](function(_0x56aa6c){if(_0x56aa6c){_0x2f0e79=_0x56aa6c;_0x14364c[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0x10b')][_0x6709('0x68')]);_0x14364c[_0x6709('0x51')]=_[_0x6709('0x52')](_0x236eac['query']);_0x14364c[_0x6709('0x53')]=_['intersection'](_0x14364c[_0x6709('0x4e')],_0x14364c[_0x6709('0x51')]);_0x24e055[_0x6709('0x54')]=_['intersection'](_0x14364c[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x236eac['query'][_0x6709('0x55')]));_0x24e055[_0x6709('0x54')]=_0x24e055[_0x6709('0x54')][_0x6709('0x56')]?_0x24e055['attributes']:_0x14364c[_0x6709('0x4e')];_0x24e055[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x236eac['query']['sort']);_0x24e055[_0x6709('0x5a')]=qs['filters'](_[_0x6709('0x5b')](_0x236eac[_0x6709('0x51')],_0x14364c['filters']));if(_0x236eac[_0x6709('0x51')][_0x6709('0x60')]){_0x24e055[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x24e055[_0x6709('0x5a')],{'$or':_['map'](_0x24e055['attributes'],function(_0x5dabe4){var _0x397622={};_0x397622[_0x5dabe4]={'$like':'%'+_0x236eac[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x397622;})});}_0x24e055=_[_0x6709('0x5c')]({},_0x24e055,_0x236eac[_0x6709('0xc1')]);return _0x2f0e79[_0x6709('0x10a')](_0x24e055);}})['then'](function(_0x6d7017){if(_0x6d7017){_0x5bab6c=_0x6d7017[_0x6709('0x56')];if(!_0x236eac[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x24e055[_0x6709('0x2f')]=qs['limit'](_0x236eac[_0x6709('0x51')][_0x6709('0x2f')]);_0x24e055['offset']=qs['offset'](_0x236eac['query'][_0x6709('0x2e')]);}return _0x2f0e79[_0x6709('0x10a')](_0x24e055);}})['then'](function(_0x49f906){if(_0x49f906){return _0x49f906?{'count':_0x5bab6c,'rows':_0x49f906}:null;}})['then'](respondWithResult(_0x17c21f,null))[_0x6709('0x2c')](handleError(_0x17c21f,null));};exports[_0x6709('0x10c')]=function(_0x5551c0,_0x5bd629){return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x5551c0[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x5bd629,null))[_0x6709('0x37')](function(_0x57e7a9){if(_0x57e7a9){var _0x12547d=_0x57e7a9[_0x6709('0x39')]({'plain':!![]});return _0x57e7a9['addTeams'](_0x5551c0[_0x6709('0x6b')][_0x6709('0x6e')],_[_0x6709('0x6f')](_0x5551c0['body'],[_0x6709('0x6e'),'id'])||{})[_0x6709('0x37')](function(){for(var _0x33798d=0x0;_0x33798d<_0x5551c0[_0x6709('0x6b')][_0x6709('0x6e')][_0x6709('0x56')];_0x33798d++){var _0x22b30a=[];db[_0x6709('0x10b')][_0x6709('0x96')]({'where':{'id':_0x5551c0[_0x6709('0x6b')][_0x6709('0x6e')][_0x33798d]}})['then'](function(_0x35024a){_0x22b30a['push'](_0x35024a[_0x6709('0xea')]()[_0x6709('0x37')](function(_0x3f9550){for(var _0x1245c0=0x0;_0x1245c0<_0x3f9550[_0x6709('0x56')];_0x1245c0++){_0x3f9550[_0x1245c0][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x10e'));}return _0x3f9550;}));_0x22b30a[_0x6709('0xeb')](_0x35024a[_0x6709('0x10f')]()[_0x6709('0x37')](function(_0x83555b){for(var _0x1bfca9=0x0;_0x1bfca9<_0x83555b[_0x6709('0x56')];_0x1bfca9++){_0x83555b[_0x1bfca9][_0x6709('0x10d')]('channel',_0x6709('0x110'));}return _0x83555b;}));_0x22b30a[_0x6709('0xeb')](_0x35024a['getMailQueues']()[_0x6709('0x37')](function(_0xdc2607){for(var _0x2a74bd=0x0;_0x2a74bd<_0xdc2607[_0x6709('0x56')];_0x2a74bd++){_0xdc2607[_0x2a74bd][_0x6709('0x10d')]('channel','Mail');}return _0xdc2607;}));_0x22b30a[_0x6709('0xeb')](_0x35024a[_0x6709('0x111')]()[_0x6709('0x37')](function(_0x51b537){for(var _0x5f5d7e=0x0;_0x5f5d7e<_0x51b537[_0x6709('0x56')];_0x5f5d7e++){_0x51b537[_0x5f5d7e][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x112'));}return _0x51b537;}));_0x22b30a[_0x6709('0xeb')](_0x35024a[_0x6709('0x113')]()[_0x6709('0x37')](function(_0x4074be){for(var _0x2e28a0=0x0;_0x2e28a0<_0x4074be['length'];_0x2e28a0++){_0x4074be[_0x2e28a0][_0x6709('0x10d')](_0x6709('0xa0'),'Whatsapp');}return _0x4074be;}));_0x22b30a['push'](_0x35024a[_0x6709('0x114')]()[_0x6709('0x37')](function(_0x4964b0){for(var _0x2320ce=0x0;_0x2320ce<_0x4964b0['length'];_0x2320ce++){_0x4964b0[_0x2320ce][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x115'));}return _0x4964b0;}));_0x22b30a[_0x6709('0xeb')](_0x35024a['getOpenchannelQueues']()['then'](function(_0x3133b8){for(var _0x41501e=0x0;_0x41501e<_0x3133b8[_0x6709('0x56')];_0x41501e++){_0x3133b8[_0x41501e][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x116'));}return _0x3133b8;}));return BPromise[_0x6709('0xef')](_0x22b30a);})['then'](function(_0x403e7a){var _0x297f36=_['flatten'](_0x403e7a);_0x22b30a=[];return db[_0x6709('0x5e')][_0x6709('0x117')](function(_0x55d838){for(var _0x255471=0x0;_0x255471<_0x297f36['length'];_0x255471++){_0x22b30a['push'](_0x297f36[_0x255471][_0x6709('0x118')](_0x12547d['id']),{'transaction':_0x55d838});}return BPromise[_0x6709('0xef')](_0x22b30a)[_0x6709('0x37')](function(){if(_0x12547d[_0x6709('0xa1')]){return BPromise['each'](_[_0x6709('0x60')](_0x297f36,function(_0x16dc75){return _0x16dc75['getDataValue'](_0x6709('0xa0'))===_0x6709('0x10e');}),function(_0x332f50){return db[_0x6709('0xaf')][_0x6709('0xb0')]({'membername':_0x12547d[_0x6709('0x46')],'UserId':_0x12547d['id'],'queue_name':_0x332f50[_0x6709('0x46')],'VoiceQueueId':_0x332f50['id'],'interface':_[_0x6709('0x74')](_0x12547d[_0x6709('0xa2')])?util[_0x6709('0x76')](_0x6709('0xe2'),_0x12547d['name']):_0x12547d[_0x6709('0xa2')],'paused':_0x12547d[_0x6709('0x119')]||![],'penalty':_0x12547d[_0x6709('0xa7')]},{'transaction':_0x55d838});});}else{return;}})['then'](function(){for(var _0x144435=0x0;_0x144435<_0x297f36[_0x6709('0x56')];_0x144435++){var _0x1dcd87=_0x297f36[_0x144435]['getDataValue'](_0x6709('0xa0'));var _0x50b2a0=_0x1dcd87+_0x6709('0xa9');socket[_0x6709('0xaa')](_0x6709('0x3b')+_0x1dcd87+'Queue:save',{'UserId':_0x12547d['id'],['queueField']:_0x297f36[_0x144435]['id']});}});});});}});}})[_0x6709('0x37')](respondWithStatusCode(_0x5bd629,null))['catch'](handleError(_0x5bd629,null));};exports[_0x6709('0x11a')]=function(_0x434c3b,_0x11e562){return db['User'][_0x6709('0x96')]({'where':{'id':_0x434c3b[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x11e562,null))[_0x6709('0x37')](function(_0x3cb574){if(_0x3cb574){var _0x37a2f1=_0x3cb574[_0x6709('0x39')]({'plain':!![]});var _0x2df80c=_0x434c3b['query'][_0x6709('0x6e')];return _0x3cb574[_0x6709('0x11a')](_0x2df80c)['then'](function(){for(var _0x2b288c=0x0;_0x2b288c<_0x2df80c[_0x6709('0x56')];_0x2b288c++){var _0x573e3b=[];db[_0x6709('0x10b')][_0x6709('0x96')]({'where':{'id':_0x2df80c[_0x2b288c]}})[_0x6709('0x37')](function(_0x2cb0b1){_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0xea')]()[_0x6709('0x37')](function(_0x121c04){for(var _0x215151=0x0;_0x215151<_0x121c04[_0x6709('0x56')];_0x215151++){_0x121c04[_0x215151]['setDataValue'](_0x6709('0xa0'),'Voice');}return _0x121c04;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1['getChatQueues']()[_0x6709('0x37')](function(_0x5825f9){for(var _0x279109=0x0;_0x279109<_0x5825f9[_0x6709('0x56')];_0x279109++){_0x5825f9[_0x279109][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x110'));}return _0x5825f9;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x11b')]()[_0x6709('0x37')](function(_0x579839){for(var _0x12c032=0x0;_0x12c032<_0x579839['length'];_0x12c032++){_0x579839[_0x12c032][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x11c'));}return _0x579839;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x111')]()[_0x6709('0x37')](function(_0x21c693){for(var _0x1f9171=0x0;_0x1f9171<_0x21c693['length'];_0x1f9171++){_0x21c693[_0x1f9171]['setDataValue'](_0x6709('0xa0'),_0x6709('0x112'));}return _0x21c693;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x113')]()['then'](function(_0x32cea8){for(var _0x495261=0x0;_0x495261<_0x32cea8['length'];_0x495261++){_0x32cea8[_0x495261][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x11d'));}return _0x32cea8;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x114')]()['then'](function(_0x54171e){for(var _0x208d55=0x0;_0x208d55<_0x54171e[_0x6709('0x56')];_0x208d55++){_0x54171e[_0x208d55][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x115'));}return _0x54171e;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x11e')]()[_0x6709('0x37')](function(_0x5dfc0d){for(var _0x3d8bcd=0x0;_0x3d8bcd<_0x5dfc0d[_0x6709('0x56')];_0x3d8bcd++){_0x5dfc0d[_0x3d8bcd]['setDataValue'](_0x6709('0xa0'),_0x6709('0x116'));}return _0x5dfc0d;}));return BPromise[_0x6709('0xef')](_0x573e3b);})[_0x6709('0x37')](function(_0x127ad8){var _0x53b918=_['flatten'](_0x127ad8);_0x573e3b=[];return db['sequelize'][_0x6709('0x117')](function(_0x1fb570){for(var _0x1ee96b=0x0;_0x1ee96b<_0x53b918[_0x6709('0x56')];_0x1ee96b++){_0x573e3b[_0x6709('0xeb')](_0x53b918[_0x1ee96b][_0x6709('0x11f')](_0x37a2f1['id']),{'transaction':_0x1fb570});}return BPromise[_0x6709('0xef')](_0x573e3b)[_0x6709('0x37')](function(){if(_0x37a2f1[_0x6709('0xa1')]){return BPromise[_0x6709('0xae')](_[_0x6709('0x60')](_0x53b918,function(_0x4913a7){return _0x4913a7[_0x6709('0x120')](_0x6709('0xa0'))==='Voice';}),function(_0x4d080d){return db[_0x6709('0xaf')]['destroy']({'where':{'VoiceQueueId':_0x4d080d['id'],'UserId':_0x37a2f1['id']},'transaction':_0x1fb570});});}else{return;}})[_0x6709('0x37')](function(){for(var _0x423923=0x0;_0x423923<_0x53b918[_0x6709('0x56')];_0x423923++){var _0x44794f=_0x53b918[_0x423923]['getDataValue'](_0x6709('0xa0'));var _0x46e26d=_0x44794f+_0x6709('0xa9');socket['emit']('user'+_0x44794f+'Queue:remove',{'UserId':_0x37a2f1['id'],['queueField']:_0x53b918[_0x423923]['id']});}});});});}});}})[_0x6709('0x37')](respondWithStatusCode(_0x11e562,null))[_0x6709('0x2c')](handleError(_0x11e562,null));};exports['getLists']=function(_0x626978,_0x866ff2,_0x4ca37c){var _0x45ccc4={};var _0x2be6ec={};var _0x86fd38;var _0x1dce3c;return db['User'][_0x6709('0x96')]({'where':{'id':_0x626978[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x866ff2,null))[_0x6709('0x37')](function(_0x32c755){if(_0x32c755){_0x86fd38=_0x32c755;_0x2be6ec[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xc2')][_0x6709('0x68')]);_0x2be6ec[_0x6709('0x51')]=_[_0x6709('0x52')](_0x626978[_0x6709('0x51')]);_0x2be6ec[_0x6709('0x53')]=_[_0x6709('0x69')](_0x2be6ec[_0x6709('0x4e')],_0x2be6ec[_0x6709('0x51')]);_0x45ccc4['attributes']=_['intersection'](_0x2be6ec[_0x6709('0x4e')],qs['fields'](_0x626978[_0x6709('0x51')]['fields']));_0x45ccc4[_0x6709('0x54')]=_0x45ccc4[_0x6709('0x54')][_0x6709('0x56')]?_0x45ccc4[_0x6709('0x54')]:_0x2be6ec[_0x6709('0x4e')];_0x45ccc4['order']=qs['sort'](_0x626978['query'][_0x6709('0x59')]);_0x45ccc4[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x626978[_0x6709('0x51')],_0x2be6ec[_0x6709('0x53')]));if(_0x626978[_0x6709('0x51')][_0x6709('0x60')]){_0x45ccc4[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x45ccc4['where'],{'$or':_[_0x6709('0x41')](_0x45ccc4[_0x6709('0x54')],function(_0xcfbc0b){var _0x2be741={};_0x2be741[_0xcfbc0b]={'$like':'%'+_0x626978[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x2be741;})});}_0x45ccc4=_[_0x6709('0x5c')]({},_0x45ccc4,_0x626978['options']);return _0x86fd38[_0x6709('0x121')](_0x45ccc4);}})[_0x6709('0x37')](function(_0x3a9f44){if(_0x3a9f44){_0x1dce3c=_0x3a9f44[_0x6709('0x56')];if(!_0x626978[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x45ccc4[_0x6709('0x2f')]=qs['limit'](_0x626978[_0x6709('0x51')][_0x6709('0x2f')]);_0x45ccc4[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x626978[_0x6709('0x51')][_0x6709('0x2e')]);}return _0x86fd38[_0x6709('0x121')](_0x45ccc4);}})['then'](function(_0x5b8c14){if(_0x5b8c14){return _0x5b8c14?{'count':_0x1dce3c,'rows':_0x5b8c14}:null;}})['then'](respondWithResult(_0x866ff2,null))[_0x6709('0x2c')](handleError(_0x866ff2,null));};exports[_0x6709('0x122')]=function(_0x5b078e,_0x3f5db7,_0x2c365b){var _0x44d73f={};var _0x5c897b={};var _0x500c7b;var _0x26deaf;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x5b078e[_0x6709('0x66')]['id']}})['then'](handleEntityNotFound(_0x3f5db7,null))[_0x6709('0x37')](function(_0x36093b){if(_0x36093b){_0x500c7b=_0x36093b;_0x5c897b[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0x64')][_0x6709('0x68')]);_0x5c897b[_0x6709('0x51')]=_[_0x6709('0x52')](_0x5b078e['query']);_0x5c897b[_0x6709('0x53')]=_[_0x6709('0x69')](_0x5c897b[_0x6709('0x4e')],_0x5c897b['query']);_0x44d73f[_0x6709('0x54')]=_[_0x6709('0x69')](_0x5c897b['model'],qs['fields'](_0x5b078e['query']['fields']));_0x44d73f['attributes']=_0x44d73f[_0x6709('0x54')][_0x6709('0x56')]?_0x44d73f[_0x6709('0x54')]:_0x5c897b['model'];_0x44d73f['order']=qs[_0x6709('0x59')](_0x5b078e[_0x6709('0x51')][_0x6709('0x59')]);_0x44d73f[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x5b078e[_0x6709('0x51')],_0x5c897b['filters']));if(_0x5b078e[_0x6709('0x51')][_0x6709('0x60')]){_0x44d73f[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x44d73f[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x44d73f[_0x6709('0x54')],function(_0x58e029){var _0x2e8bfd={};_0x2e8bfd[_0x58e029]={'$like':'%'+_0x5b078e[_0x6709('0x51')]['filter']+'%'};return _0x2e8bfd;})});}_0x44d73f[_0x6709('0x4e')]=db['User'];_0x44d73f['as']=_0x6709('0x3c');_0x44d73f=_['merge']({},_0x44d73f,_0x5b078e['options']);return _0x500c7b[_0x6709('0xea')]({'include':[_0x44d73f]});}})[_0x6709('0x37')](function(_0x5d4936){if(_0x5d4936){var _0x5f5306={},_0x192458=[],_0x5d6673=0x0;for(var _0xbc95e7=0x0;_0xbc95e7<_0x5d4936[_0x6709('0x56')];_0xbc95e7+=0x1){for(var _0x570244=0x0,_0x169653;_0x570244<_0x5d4936[_0xbc95e7][_0x6709('0x3c')][_0x6709('0x56')];_0x570244+=0x1){_0x169653=_0x5d4936[_0xbc95e7]['Agents'][_0x570244]['get']({'plain':!![]});_0x5f5306[_0x169653['id']]=_0x169653;}}_0x5f5306=_['values'](_0x5f5306);for(var _0x1f6f99=qs[_0x6709('0x2e')](_0x5b078e[_0x6709('0x51')][_0x6709('0x2e')]);_0x1f6f99<_0x5f5306['length']&&_0x192458['length']=_0x53635a){_0x2dfe6e=_0x53635a;_0x107431=0xc8;}else{_0x107431=0xce;}_0x7adbea[_0x793c('0x2c')](_0x107431);return _0x7adbea[_0x793c('0x31')](_0x793c('0x32'),_0x473419+'-'+_0x2dfe6e+'/'+_0x53635a)[_0x793c('0x33')](_0x1e80b4);}return null;};}function patchUpdates(_0x5a9f07){return function(_0x50ddbb){try{jsonpatch[_0x793c('0x34')](_0x50ddbb,_0x5a9f07,!![]);}catch(_0x5468cf){return BPromise[_0x793c('0x35')](_0x5468cf);}return _0x50ddbb[_0x793c('0x36')]();};}function saveUpdates(_0x43adaf,_0x4dffa5){return function(_0x490a2c){if(_0x490a2c){return _0x490a2c[_0x793c('0x37')](_0x43adaf)[_0x793c('0x1f')](function(_0x1bf1e4){return _0x1bf1e4;});}return null;};}function removeEntity(_0x2a4834,_0x57bda2){return function(_0x36705d){if(_0x36705d){return _0x36705d['destroy']()[_0x793c('0x1f')](function(){var _0x537142=_0x36705d[_0x793c('0x38')]({'plain':!![]});var _0x14cc7d=[{'name':'Users','value':_0x793c('0x39'),'ignore':!![]},{'name':'Agents','value':_0x793c('0x3a'),'ignore':![]},{'name':_0x793c('0x3b'),'value':_0x793c('0x3c'),'ignore':![]}];var _0x41dcfa=_(_0x14cc7d)['filter'](_0x793c('0x3d'))[_0x793c('0x3e')](_0x793c('0x3f'))[_0x793c('0x3f')]();if(_['includes'](_0x41dcfa,_0x537142['role'])){return;}var _0x196523=_[_0x793c('0x40')](_0x14cc7d,['value',_0x537142[_0x793c('0x41')]])[_0x793c('0x42')];return db['UserProfileResource'][_0x793c('0x43')]({'where':{'type':_0x196523,'resourceId':_0x537142['id']}})[_0x793c('0x1f')](function(){return _0x36705d;});})['then'](function(){_0x2a4834['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8a5c,_0x6c52ac){return function(_0x3b5c7c){if(!_0x3b5c7c){_0x1b8a5c[_0x793c('0x2b')](0x194);}return _0x3b5c7c;};}function handleError(_0x20912a,_0x593633){_0x593633=_0x593633||0x1f4;return function(_0x5dd47d){logger[_0x793c('0x25')](_0x5dd47d['stack']);if(_0x5dd47d['name']){delete _0x5dd47d[_0x793c('0x42')];}_0x20912a[_0x793c('0x2c')](_0x593633)[_0x793c('0x44')](_0x5dd47d);};}exports['index']=function(_0x58a604,_0x51447e){var _0x31e378={},_0x25128f={},_0x32a62b={'count':0x0,'rows':[]};var _0x533856=_['map'](db[_0x793c('0x45')][_0x793c('0x46')],function(_0x2ced6e){return{'name':_0x2ced6e[_0x793c('0x47')],'type':_0x2ced6e[_0x793c('0x48')][_0x793c('0x49')]};});_0x25128f['model']=_['differenceBy'](_[_0x793c('0x3e')](_0x533856,_0x793c('0x42')),[_0x793c('0x4a'),_0x793c('0x4b')]);_0x25128f['query']=_[_0x793c('0x4c')](_0x58a604[_0x793c('0x4d')]);_0x25128f[_0x793c('0x4e')]=_['intersection'](_0x25128f['model'],_0x25128f[_0x793c('0x4d')]);_0x31e378[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x25128f[_0x793c('0x51')],qs[_0x793c('0x52')](_0x58a604['query'][_0x793c('0x52')]));_0x31e378[_0x793c('0x4f')]=_0x31e378['attributes'][_0x793c('0x53')]?_0x31e378['attributes']:_0x25128f[_0x793c('0x51')];if(!_0x58a604['query'][_0x793c('0x54')](_0x793c('0x55'))){_0x31e378[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x58a604[_0x793c('0x4d')][_0x793c('0x30')]);_0x31e378[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x58a604[_0x793c('0x4d')][_0x793c('0x2f')]);}_0x31e378[_0x793c('0x56')]=qs['sort'](_0x58a604[_0x793c('0x4d')][_0x793c('0x57')]);_0x31e378[_0x793c('0x58')]=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x58a604[_0x793c('0x4d')],_0x25128f['filters']),_0x533856);if(_0x58a604[_0x793c('0x4d')][_0x793c('0x5a')]){_0x31e378[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x31e378[_0x793c('0x58')],{'$or':_['map'](_0x533856,function(_0x4c8aac){if(_0x4c8aac[_0x793c('0x48')]!==_0x793c('0x5c')){return db[_0x793c('0x5d')]['where'](db['sequelize']['fn'](_0x793c('0x5e'),db[_0x793c('0x5d')][_0x793c('0x5f')](_0x4c8aac[_0x793c('0x42')])),{'$like':db['sequelize']['fn']('lower','%'+_0x58a604['query'][_0x793c('0x5a')]+'%')});}})});}_0x31e378=_[_0x793c('0x5b')]({},_0x31e378,_0x58a604[_0x793c('0x60')]);var _0x4c5cf1={'where':_0x31e378[_0x793c('0x58')]};return db[_0x793c('0x45')]['count'](_0x4c5cf1)[_0x793c('0x1f')](function(_0x39ea06){_0x32a62b[_0x793c('0x2e')]=_0x39ea06;if(_0x58a604[_0x793c('0x4d')][_0x793c('0x61')]){_0x31e378[_0x793c('0x62')]=[{'all':!![]}];}return db['User'][_0x793c('0x63')](_0x31e378);})[_0x793c('0x1f')](function(_0x1e9d40){_0x32a62b[_0x793c('0x64')]=_0x1e9d40;return _0x32a62b;})[_0x793c('0x1f')](respondWithFilteredResult(_0x51447e,_0x31e378))[_0x793c('0x2a')](handleError(_0x51447e,null));};exports['show']=function(_0x2988a5,_0x4bbdaa){var _0x3afc6d={'raw':![],'where':{'id':_0x2988a5[_0x793c('0x65')]['id']}},_0x432e8e={};_0x432e8e['model']=_[_0x793c('0x66')](_[_0x793c('0x4c')](db[_0x793c('0x45')][_0x793c('0x46')]),['password',_0x793c('0x4b')]);_0x432e8e[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x2988a5[_0x793c('0x4d')]);_0x432e8e['filters']=_[_0x793c('0x50')](_0x432e8e['model'],_0x432e8e['query']);_0x3afc6d['attributes']=_[_0x793c('0x50')](_0x432e8e['model'],qs[_0x793c('0x52')](_0x2988a5['query']['fields']));_0x3afc6d[_0x793c('0x4f')]=_0x3afc6d[_0x793c('0x4f')][_0x793c('0x53')]?_0x3afc6d[_0x793c('0x4f')]:_0x432e8e[_0x793c('0x51')];if(_0x2988a5['query'][_0x793c('0x61')]){_0x3afc6d[_0x793c('0x62')]=[{'all':!![]}];}_0x3afc6d=_[_0x793c('0x5b')]({},_0x3afc6d,_0x2988a5[_0x793c('0x60')]);return db[_0x793c('0x45')][_0x793c('0x40')](_0x3afc6d)[_0x793c('0x1f')](handleEntityNotFound(_0x4bbdaa,null))[_0x793c('0x1f')](respondWithResult(_0x4bbdaa,null))[_0x793c('0x2a')](handleError(_0x4bbdaa,null));};exports[_0x793c('0x67')]=function(_0x2faa77,_0x5088e9){return db[_0x793c('0x45')]['bulkCreate'](_0x2faa77[_0x793c('0x68')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5088e9,0xc9))[_0x793c('0x2a')](handleError(_0x5088e9,null));};exports[_0x793c('0x37')]=function(_0x40ebb0,_0xee95ce){if(_0x40ebb0[_0x793c('0x68')]['id']){delete _0x40ebb0[_0x793c('0x68')]['id'];}delete _0x40ebb0[_0x793c('0x68')][_0x793c('0x41')];return db[_0x793c('0x45')][_0x793c('0x40')]({'where':{'id':_0x40ebb0[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0xee95ce,null))[_0x793c('0x1f')](saveUpdates(_0x40ebb0['body'],null))[_0x793c('0x1f')](respondWithResult(_0xee95ce,null))[_0x793c('0x2a')](handleError(_0xee95ce,null));};exports[_0x793c('0x69')]=function(_0x4a93e8,_0xa246da){return db[_0x793c('0x45')]['describe']()[_0x793c('0x1f')](respondWithResult(_0xa246da,null))[_0x793c('0x2a')](handleError(_0xa246da,null));};exports[_0x793c('0x6a')]=function(_0x514e6a,_0x1444fd,_0x1fde8e){return db[_0x793c('0x45')][_0x793c('0x40')]({'where':{'id':_0x514e6a[_0x793c('0x65')]['id']}})['then'](handleEntityNotFound(_0x1444fd,null))['then'](function(_0x317164){if(_0x317164){return _0x317164['addContacts'](_0x514e6a['body'][_0x793c('0x6b')],_[_0x793c('0x6c')](_0x514e6a[_0x793c('0x68')],[_0x793c('0x6b'),'id'])||{});}})[_0x793c('0x1f')](respondWithResult(_0x1444fd,null))[_0x793c('0x2a')](handleError(_0x1444fd,null));};var getLicense=function(_0x5dcfa4){return new BPromise(function(_0x3a6236,_0x328961){var _0x58d4d1=0x0;_0x5dcfa4['body'][_0x793c('0x41')]===_0x793c('0x3a')&&_0x3a6236(_0x793c('0x6d'));return db[_0x793c('0x45')][_0x793c('0x2e')]({'where':{'$or':[{'role':_0x5dcfa4['body'][_0x793c('0x41')]===_0x793c('0x3c')?_0x793c('0x3c'):[_0x793c('0x6e'),_0x793c('0x39')]}]}})[_0x793c('0x1f')](function(_0x57747e){_0x58d4d1=_0x57747e;return require('../../config/license/util')[_0x793c('0x6f')]();})['then'](function(_0x286af3){var _0x4e1b40=_0x5dcfa4[_0x793c('0x68')]['role']===_0x793c('0x3c')?_0x793c('0x70'):'users';if(!_[_0x793c('0x71')](_0x286af3[_0x4e1b40])&&_0x58d4d1>=_0x286af3[_0x4e1b40]){return _0x328961({'message':_0x793c('0x72')});}return _0x3a6236(util[_0x793c('0x73')](_0x793c('0x74'),_0x4e1b40,_0x58d4d1));})[_0x793c('0x2a')](function(_0x303606){return _0x328961(_0x303606);});});};exports[_0x793c('0x75')]=function(_0x40bf58,_0x58b301){return getLicense(_0x40bf58)['then'](function(_0x5e490c){if(!_0x40bf58[_0x793c('0x68')]['internal']){var _0x1f0350;return db[_0x793c('0x76')][_0x793c('0x77')](0x1)['then'](function(_0x840bc8){return checkPasswordPattern(_0x840bc8,_0x40bf58['body'][_0x793c('0x4a')],_0x840bc8[_0x793c('0x78')]);})[_0x793c('0x1f')](function(_0x336f01){_0x1f0350=_0x336f01[_0x793c('0x79')];return db[_0x793c('0x45')][_0x793c('0x7a')]('internal');})[_0x793c('0x1f')](function(_0x7cb878){if(_[_0x793c('0x71')](_0x7cb878)){if(_0x1f0350){_0x40bf58['body'][_0x793c('0x7b')]=_0x1f0350;}else{_0x40bf58['body'][_0x793c('0x7b')]=0x1;}}else{if(_[_0x793c('0x71')](_0x1f0350)||_0x1f0350==_0x7cb878){_0x40bf58[_0x793c('0x68')][_0x793c('0x7b')]=_0x7cb878+0x1;}else if(_0x1f0350>_0x7cb878){_0x40bf58[_0x793c('0x68')]['internal']=_0x1f0350;}else{return db[_0x793c('0x5d')][_0x793c('0x4d')](_0x793c('0x7c'),{'type':db['sequelize']['QueryTypes'][_0x793c('0x7d')]})[_0x793c('0x1f')](function(_0xf35f76){if(_0xf35f76&&_0xf35f76[_0x793c('0x53')]){for(var _0x2755e3=0x0,_0x91d26=_0xf35f76[_0x793c('0x53')];_0x2755e3<_0x91d26&&_['isNil'](_0x40bf58[_0x793c('0x68')][_0x793c('0x7b')]);_0x2755e3++){if(_0x1f0350<=_0xf35f76[_0x2755e3][_0x793c('0x7e')]){_0x40bf58['body'][_0x793c('0x7b')]=_0xf35f76[_0x2755e3][_0x793c('0x7e')];}else if(_0x1f0350>_0xf35f76[_0x2755e3][_0x793c('0x7e')]&&_0x1f0350<=_0xf35f76[_0x2755e3]['to']){_0x40bf58[_0x793c('0x68')]['internal']=_0x1f0350;}}}if(_[_0x793c('0x71')](_0x40bf58[_0x793c('0x68')]['internal'])){_0x40bf58[_0x793c('0x68')][_0x793c('0x7b')]=_0x7cb878+0x1;}});}}});}})[_0x793c('0x1f')](function(){if(_0x40bf58['body'][_0x793c('0x7f')]){_0x40bf58[_0x793c('0x68')][_0x793c('0x80')]=_0x40bf58[_0x793c('0x68')][_0x793c('0x7b')];_0x40bf58[_0x793c('0x68')]['VoiceMail']={'mailbox':_0x40bf58['body'][_0x793c('0x7b')],'password':_0x40bf58[_0x793c('0x68')][_0x793c('0x4a')],'fullname':_0x40bf58[_0x793c('0x68')][_0x793c('0x81')],'email':_0x40bf58[_0x793c('0x68')][_0x793c('0x82')]};}if(_0x40bf58[_0x793c('0x68')]&&_0x40bf58[_0x793c('0x68')][_0x793c('0x41')]===_0x793c('0x3a')){if(!_0x40bf58[_0x793c('0x68')][_0x793c('0x83')]){_0x40bf58[_0x793c('0x68')][_0x793c('0x83')]=['101',_0x793c('0x84'),_0x793c('0x85'),_0x793c('0x86'),'110',_0x793c('0x87'),_0x793c('0x88'),_0x793c('0x89'),'107',_0x793c('0x8a'),_0x793c('0x8b'),_0x793c('0x8c'),'111','114'];}}return db[_0x793c('0x45')]['create'](_0x40bf58[_0x793c('0x68')],{'include':[{'model':db[_0x793c('0x8d')],'as':_0x793c('0x8d')}]});})['then'](function(_0x42bd42){if(_0x40bf58[_0x793c('0x68')][_0x793c('0x41')]===_0x793c('0x39'))return _0x42bd42;var _0x1b6b83=_0x40bf58['user'][_0x793c('0x38')]({'plain':!![]});if(!_0x1b6b83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b6b83[_0x793c('0x41')]===_0x793c('0x39')){var _0x51a14a=_0x42bd42[_0x793c('0x38')]({'plain':!![]});var _0x4b08f9=[{'name':_0x793c('0x8e'),'value':_0x793c('0x3a')},{'name':_0x793c('0x3b'),'value':_0x793c('0x3c')}];var _0x2e32e3=_['find'](_0x4b08f9,[_0x793c('0x3f'),_0x51a14a[_0x793c('0x41')]])[_0x793c('0x42')];return db[_0x793c('0x8f')][_0x793c('0x40')]({'where':{'name':_0x2e32e3,'userProfileId':_0x1b6b83[_0x793c('0x90')]},'raw':!![]})[_0x793c('0x1f')](function(_0x265e16){if(_0x265e16&&_0x265e16[_0x793c('0x91')]===0x0){return db[_0x793c('0x92')][_0x793c('0x75')]({'name':_0x51a14a[_0x793c('0x42')],'resourceId':_0x51a14a['id'],'type':_0x265e16[_0x793c('0x42')],'sectionId':_0x265e16['id']},{})[_0x793c('0x1f')](function(){return _0x42bd42;});}else{return _0x42bd42;}})[_0x793c('0x2a')](function(_0x17b4b3){logger[_0x793c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17b4b3);throw _0x17b4b3;});}return _0x42bd42;})[_0x793c('0x1f')](respondWithResult(_0x58b301,0xc9))[_0x793c('0x2a')](handleError(_0x58b301,null));};exports[_0x793c('0x93')]=function(_0x17381f,_0x4908b0,_0x515953){var _0xd23bc5=![];if(_0x17381f[_0x793c('0x68')]['id']){delete _0x17381f[_0x793c('0x68')]['id'];}return db[_0x793c('0x76')][_0x793c('0x94')]({'attributes':['id','securePassword']})[_0x793c('0x1f')](function(_0x1de90a){_0xd23bc5=_0x1de90a[_0x793c('0x78')];return db[_0x793c('0x45')]['find']({'where':{'id':_0x17381f[_0x793c('0x65')]['id']}});})[_0x793c('0x1f')](function(_0x18f0fa){if(_0x18f0fa){if(_0x18f0fa['id']==_0x17381f[_0x793c('0x39')]['id']){if(!_0x17381f['body'][_0x793c('0x95')]||!_0x17381f['body'][_0x793c('0x96')]){throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))](_0x793c('0x98'));}if(!_0x18f0fa[_0x793c('0x99')](_0x17381f[_0x793c('0x68')][_0x793c('0x95')])){throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))](_0x793c('0x9a'));}if(_0x17381f[_0x793c('0x68')][_0x793c('0x95')]==_0x17381f[_0x793c('0x68')][_0x793c('0x96')]){throw new db['Sequelize'][(_0x793c('0x97'))](_0x793c('0x9b'));}return _0x18f0fa;}else if(_0x17381f[_0x793c('0x39')][_0x793c('0x41')]=='admin'){if(!_0x17381f['body'][_0x793c('0x96')]){throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))](_0x793c('0x9c'));}return _0x18f0fa;}else if(_0x17381f['user'][_0x793c('0x41')]==_0x793c('0x39')){if(!_0x17381f[_0x793c('0x68')][_0x793c('0x96')]){throw new db[(_0x793c('0x1c'))]['ValidationError'](_0x793c('0x9c'));}if(_0x18f0fa[_0x793c('0x41')]!='agent'){throw new db['Sequelize']['ValidationError'](_0x793c('0x9d'));}return _0x18f0fa;}else{throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))](_0x793c('0x9d'));}}return null;})['then'](handleEntityNotFound(_0x4908b0,null))[_0x793c('0x1f')](function(_0x39fa34){return checkPasswordPattern(_0x39fa34,_0x17381f[_0x793c('0x68')][_0x793c('0x96')],_0xd23bc5);})[_0x793c('0x1f')](saveUpdates({'password':_0x17381f[_0x793c('0x68')][_0x793c('0x96')],'passwordResetAt':_0x17381f[_0x793c('0x39')]['id']==_0x17381f[_0x793c('0x65')]['id']?moment():null},null))[_0x793c('0x1f')](respondWithResult(_0x4908b0,null))[_0x793c('0x2a')](handleError(_0x4908b0,null));};exports['addQueues']=function(_0x1571ab,_0x95d04a,_0x5601c0){var _0x589967=_0x1571ab[_0x793c('0x68')][_0x793c('0x9e')];return db['User'][_0x793c('0x40')]({'where':{'id':_0x1571ab[_0x793c('0x65')]['id']},'attributes':['id','name',_0x793c('0x41'),_0x793c('0x9f'),_0x793c('0xa0'),_0x793c('0xa1'),_0x793c('0xa2')]})[_0x793c('0x1f')](handleEntityNotFound(_0x95d04a,null))[_0x793c('0x1f')](function(_0xe2b342){if(_0xe2b342){if(!utils[_0x793c('0xa3')](_0x589967)){throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))]('Unknown\x20channel');}return _0xe2b342['add'+_[_0x793c('0xa4')](_0x589967[_0x793c('0xa5')]())+_0x793c('0xa6')](_0x1571ab[_0x793c('0x68')]['ids'],{'penalty':_0x1571ab[_0x793c('0x68')]['penalty']||0x0})[_0x793c('0xa7')](function(_0xbaaab8){for(var _0x1c099f=0x0;_0x1c099f<_0x1571ab['body'][_0x793c('0x6b')][_0x793c('0x53')];_0x1c099f+=0x1){var _0x1c5c6c={'UserId':_0x1571ab[_0x793c('0x65')]['id']};_0x1c5c6c[_[_0x793c('0xa4')](_0x589967[_0x793c('0xa5')]())+_0x793c('0xa8')]=_0x1571ab[_0x793c('0x68')]['ids'][_0x1c099f];socket[_0x793c('0xa9')](_0x793c('0x39')+_['capitalize'](_0x589967[_0x793c('0xa5')]())+_0x793c('0xaa'),_0x1c5c6c);}return _0xbaaab8;})['then'](function(){if(_0x589967===_0x793c('0xab')){return db['VoiceQueue'][_0x793c('0x63')]({'where':{'id':_0x1571ab['body'][_0x793c('0x6b')]||[]},'raw':!![],'attributes':['id',_0x793c('0x42')]});}})[_0x793c('0x1f')](function(_0x4a568d){var _0x16eb43=_0xe2b342[_0x793c('0x38')]({'plain':!![]});var _0x2dd717=[];if(_0x589967===_0x793c('0xab')&&_0x16eb43[_0x793c('0x41')]===_0x793c('0x3a')&&_0x16eb43[_0x793c('0x9f')]){for(var _0x1433e1=0x0;_0x1433e1<_0x4a568d[_0x793c('0x53')];_0x1433e1+=0x1){_0x2dd717[_0x793c('0xac')]({'membername':_0x16eb43[_0x793c('0x42')],'UserId':_0x16eb43['id'],'queue_name':_0x4a568d[_0x1433e1][_0x793c('0x42')],'VoiceQueueId':_0x4a568d[_0x1433e1]['id'],'interface':_[_0x793c('0x71')](_0x16eb43[_0x793c('0xa2')])?util[_0x793c('0x73')](_0x793c('0xad'),_0x16eb43[_0x793c('0x42')]):_0x16eb43[_0x793c('0xa2')],'paused':_0x16eb43['voicePause']||![],'penalty':_0x1571ab[_0x793c('0x68')]['penalty']||0x0});}return BPromise[_0x793c('0xae')](_0x2dd717,function(_0x4bac3e){return db[_0x793c('0xaf')]['upsert'](_0x4bac3e);});}return _0xe2b342;});}})['then'](respondWithStatusCode(_0x95d04a,null))[_0x793c('0x2a')](handleError(_0x95d04a,null));};exports[_0x793c('0xb0')]=function(_0x55bfc1,_0x24329c,_0x5ae5ee){var _0x1e61c2;return db[_0x793c('0x45')]['find']({'where':{'id':_0x55bfc1[_0x793c('0x65')]['id']},'attributes':['id',_0x793c('0x42'),_0x793c('0x41')]})['then'](handleEntityNotFound(_0x24329c,null))[_0x793c('0x1f')](function(_0x50be27){if(_0x50be27){_0x1e61c2=_0x50be27;if(!_0x55bfc1['query'][_0x793c('0x9e')]||!utils[_0x793c('0xa3')](_0x55bfc1['query']['channel'])){throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))](_0x793c('0xb1'));}return _0x50be27['remove'+_[_0x793c('0xa4')](_0x55bfc1[_0x793c('0x4d')][_0x793c('0x9e')][_0x793c('0xa5')]())+_0x793c('0xa6')](_0x55bfc1['query'][_0x793c('0x6b')]);}})[_0x793c('0x1f')](function(_0xa4b833){for(var _0x37a256=0x0;_0x37a256<_0x55bfc1[_0x793c('0x4d')][_0x793c('0x6b')]['length'];_0x37a256+=0x1){var _0x273198={'UserId':_0x55bfc1['params']['id']};_0x273198[_[_0x793c('0xa4')](_0x55bfc1['query']['channel']['toLowerCase']())+_0x793c('0xa8')]=_0x55bfc1[_0x793c('0x4d')][_0x793c('0x6b')][_0x37a256];socket[_0x793c('0xa9')]('user'+_[_0x793c('0xa4')](_0x55bfc1[_0x793c('0x4d')][_0x793c('0x9e')][_0x793c('0xa5')]())+_0x793c('0xb2'),_0x273198);}return _0xa4b833;})['then'](function(){if(_0x55bfc1[_0x793c('0x4d')]['channel']===_0x793c('0xab')){return db['UserVoiceQueueRt'][_0x793c('0x43')]({'where':{'UserId':_0x55bfc1[_0x793c('0x65')]['id'],'VoiceQueueId':_0x55bfc1['query'][_0x793c('0x6b')]},'individualHooks':!![]})[_0x793c('0x1f')](function(){return _0x1e61c2;});}return _0x1e61c2;})[_0x793c('0x1f')](respondWithStatusCode(_0x24329c,null))[_0x793c('0x2a')](handleError(_0x24329c,null));};exports['addAvatar']=function(_0x415b0a,_0x3a9aa9,_0x2bce60){_0x415b0a[_0x793c('0x68')][_0x793c('0xb3')]=_0x415b0a[_0x793c('0xb4')][_0x793c('0xb5')];return db[_0x793c('0x45')][_0x793c('0x40')]({'where':{'id':_0x415b0a[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x3a9aa9,null))[_0x793c('0x1f')](saveUpdates(_0x415b0a[_0x793c('0x68')],null))[_0x793c('0x1f')](respondWithResult(_0x3a9aa9,null))['catch'](handleError(_0x3a9aa9,null));};exports[_0x793c('0xb6')]=function(_0xee6885,_0x4baa76,_0x161dcb){var _0x2dcc12=path['join'](config[_0x793c('0xb7')],_0x793c('0xb8'));return db[_0x793c('0x45')][_0x793c('0x40')]({'where':{'id':_0xee6885['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x793c('0x1f')](handleEntityNotFound(_0x4baa76,null))['then'](function(_0x434c6a){if(_0x434c6a){if(_['isNil'](_0x434c6a['userpic'])){return _0x4baa76[_0x793c('0xb9')](_0x2dcc12);}else{if(!fs[_0x793c('0xba')](path['join'](config[_0x793c('0xb7')],_0x793c('0xbb'),_0x434c6a[_0x793c('0xb3')]))){return _0x4baa76[_0x793c('0xb9')](_0x2dcc12);}return _0x4baa76[_0x793c('0xb9')](path[_0x793c('0xbc')](config[_0x793c('0xb7')],_0x793c('0xbb'),_0x434c6a[_0x793c('0xb3')]));}}})['catch'](handleError(_0x4baa76,null));};exports[_0x793c('0xbd')]=function(_0x854750,_0x2b7a58,_0x26c531){var _0x462116={};var _0xfaa83f={};var _0x41c2c8;var _0x35c96f;return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0x854750[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x2b7a58,null))[_0x793c('0x1f')](function(_0x54dd27){if(_0x54dd27){_0x41c2c8=_0x54dd27;_0xfaa83f[_0x793c('0x51')]=_[_0x793c('0x4c')](db[_0x793c('0xbe')][_0x793c('0x46')]);_0xfaa83f['query']=_['keys'](_0x854750[_0x793c('0x4d')]);_0xfaa83f[_0x793c('0x4e')]=_[_0x793c('0x50')](_0xfaa83f['model'],_0xfaa83f[_0x793c('0x4d')]);_0x462116['attributes']=_[_0x793c('0x50')](_0xfaa83f[_0x793c('0x51')],qs['fields'](_0x854750[_0x793c('0x4d')][_0x793c('0x52')]));_0x462116['attributes']=_0x462116['attributes']['length']?_0x462116['attributes']:_0xfaa83f[_0x793c('0x51')];_0x462116[_0x793c('0x56')]=qs['sort'](_0x854750[_0x793c('0x4d')]['sort']);_0x462116[_0x793c('0x58')]=qs['filters'](_['pick'](_0x854750[_0x793c('0x4d')],_0xfaa83f[_0x793c('0x4e')]));if(_0x854750['query'][_0x793c('0x5a')]){_0x462116[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x462116[_0x793c('0x58')],{'$or':_['map'](_0x462116['attributes'],function(_0x3c49c0){var _0x5c4c0c={};_0x5c4c0c[_0x3c49c0]={'$like':'%'+_0x854750[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x5c4c0c;})});}_0x462116=_['merge']({},_0x462116,_0x854750['options']);return _0x41c2c8[_0x793c('0xbd')](_0x462116);}})[_0x793c('0x1f')](function(_0x414dd1){if(_0x414dd1){_0x35c96f=_0x414dd1[_0x793c('0x53')];if(_0x854750['query'][_0x793c('0x54')](_0x793c('0x61'))){_0x462116[_0x793c('0x62')]=[{'model':db[_0x793c('0xbf')],'as':_0x793c('0xc0'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x793c('0x42'),_0x793c('0xc1')],'where':_0x854750['query']['tag']?{'id':_0x854750[_0x793c('0x4d')][_0x793c('0xc2')]}:undefined,'required':_0x854750[_0x793c('0x4d')][_0x793c('0xc2')]?!![]:![]}];}if(!_0x854750[_0x793c('0x4d')][_0x793c('0x54')]('nolimit')){_0x462116[_0x793c('0x30')]=qs['limit'](_0x854750[_0x793c('0x4d')][_0x793c('0x30')]);_0x462116['offset']=qs[_0x793c('0x2f')](_0x854750[_0x793c('0x4d')][_0x793c('0x2f')]);}return _0x41c2c8[_0x793c('0xbd')](_0x462116);}})['then'](function(_0x464a50){if(_0x464a50){return _0x464a50?{'count':_0x35c96f,'rows':_0x464a50}:null;}})[_0x793c('0x1f')](respondWithResult(_0x2b7a58,null))[_0x793c('0x2a')](handleError(_0x2b7a58,null));};exports[_0x793c('0xc3')]=function(_0x4d36c4,_0xfc88af,_0xeacccb){var _0x5123bb;var _0x233b30;var _0x3d4d75={};var _0x7f245a;return db[_0x793c('0x45')]['findOne']({'where':{'id':_0x4d36c4[_0x793c('0x65')]['id']},'attributes':['id','name',_0x793c('0x41')]})[_0x793c('0x1f')](handleEntityNotFound(_0xfc88af,null))[_0x793c('0x1f')](function(_0x362ac6){if(!utils[_0x793c('0xa3')](_0x4d36c4['query'][_0x793c('0x9e')])){throw new db[(_0x793c('0x1c'))]['ValidationError'](_0x793c('0xb1'));}_0x5123bb=_0x362ac6;var _0x1b7da1={};_0x1b7da1[_0x793c('0x51')]=_[_0x793c('0x4c')](db[_['capitalize'](_0x4d36c4[_0x793c('0x4d')][_0x793c('0x9e')])+'Queue'][_0x793c('0x46')]);_0x1b7da1[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x4d36c4[_0x793c('0x4d')]);_0x1b7da1[_0x793c('0x4e')]=_[_0x793c('0x50')](_0x1b7da1['model'],_0x1b7da1[_0x793c('0x4d')]);_0x3d4d75[_0x793c('0x4f')]=_['intersection'](_0x1b7da1['model'],qs[_0x793c('0x52')](_0x4d36c4['query']['fields']));_0x3d4d75[_0x793c('0x4f')]=_0x3d4d75[_0x793c('0x4f')][_0x793c('0x53')]?_0x3d4d75[_0x793c('0x4f')]:_0x1b7da1['model'];_0x3d4d75['order']=qs[_0x793c('0x57')](_0x4d36c4[_0x793c('0x4d')][_0x793c('0x57')]);_0x3d4d75[_0x793c('0x58')]=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x4d36c4[_0x793c('0x4d')],_0x1b7da1[_0x793c('0x4e')]));if(_0x4d36c4[_0x793c('0x4d')][_0x793c('0x5a')]){_0x3d4d75['where']=_[_0x793c('0x5b')](_0x3d4d75[_0x793c('0x58')],{'$or':_[_0x793c('0x3e')](_0x3d4d75[_0x793c('0x4f')],function(_0x2ae7e7){var _0x53280b={};_0x53280b[_0x2ae7e7]={'$like':'%'+_0x4d36c4[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x53280b;})});}_0x3d4d75=_[_0x793c('0x5b')]({},_0x3d4d75,_0x4d36c4[_0x793c('0x60')]);switch(_0x5123bb[_0x793c('0x41')]){case _0x793c('0x6e'):return db[_[_0x793c('0xa4')](_0x4d36c4[_0x793c('0x4d')][_0x793c('0x9e')])+_0x793c('0xc4')][_0x793c('0x63')](_0x3d4d75);case _0x793c('0x39'):case _0x793c('0x3a'):return _0x5123bb[_0x793c('0x38')+_[_0x793c('0xa4')](_0x4d36c4[_0x793c('0x4d')][_0x793c('0x9e')])+_0x793c('0xa6')](_0x3d4d75);default:throw new db[(_0x793c('0x1c'))]['ValidationError'](_0x793c('0xc5'));}})['then'](function(_0x7aad93){_0x7f245a=_0x7aad93['length'];if(!_0x4d36c4[_0x793c('0x4d')][_0x793c('0x54')](_0x793c('0x55'))){_0x3d4d75[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x4d36c4['query']['limit']);_0x3d4d75[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x4d36c4[_0x793c('0x4d')][_0x793c('0x2f')]);}switch(_0x5123bb['role']){case _0x793c('0x6e'):return db[_[_0x793c('0xa4')](_0x4d36c4[_0x793c('0x4d')][_0x793c('0x9e')])+_0x793c('0xc4')][_0x793c('0x63')](_0x3d4d75);case'user':case _0x793c('0x3a'):return _0x5123bb[_0x793c('0x38')+_[_0x793c('0xa4')](_0x4d36c4['query'][_0x793c('0x9e')])+_0x793c('0xa6')](_0x3d4d75);}})[_0x793c('0x1f')](function(_0x3f7448){return{'count':_0x7f245a,'rows':_0x3f7448};})[_0x793c('0x1f')](respondWithResult(_0xfc88af,null))[_0x793c('0x2a')](handleError(_0xfc88af,null));};exports[_0x793c('0xc6')]=function(_0x2ea118,_0x35c334,_0xb848e0){var _0x39d643={};var _0x509457={};var _0x58c742;var _0x869e7;return db['User'][_0x793c('0x94')]({'where':{'id':_0x2ea118[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x35c334,null))[_0x793c('0x1f')](function(_0x32c3a4){if(_0x32c3a4){_0x58c742=_0x32c3a4;_0x509457[_0x793c('0x51')]=_['keys'](db['UserVoiceQueueRt'][_0x793c('0x46')]);_0x509457[_0x793c('0x4d')]=_['keys'](_0x2ea118[_0x793c('0x4d')]);_0x509457[_0x793c('0x4e')]=_[_0x793c('0x50')](_0x509457['model'],_0x509457['query']);_0x39d643[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x509457['model'],qs['fields'](_0x2ea118[_0x793c('0x4d')][_0x793c('0x52')]));_0x39d643[_0x793c('0x4f')]=_0x39d643[_0x793c('0x4f')]['length']?_0x39d643['attributes']:_0x509457[_0x793c('0x51')];_0x39d643['order']=qs[_0x793c('0x57')](_0x2ea118['query']['sort']);_0x39d643['where']=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x2ea118[_0x793c('0x4d')],_0x509457['filters']));if(_0x2ea118[_0x793c('0x4d')][_0x793c('0x5a')]){_0x39d643['where']=_[_0x793c('0x5b')](_0x39d643['where'],{'$or':_['map'](_0x39d643[_0x793c('0x4f')],function(_0x29bf57){var _0x52cd0b={};_0x52cd0b[_0x29bf57]={'$like':'%'+_0x2ea118['query']['filter']+'%'};return _0x52cd0b;})});}_0x39d643=_[_0x793c('0x5b')]({},_0x39d643,_0x2ea118['options']);return _0x58c742[_0x793c('0xc6')](_0x39d643);}})['then'](function(_0x169c48){if(_0x169c48){_0x869e7=_0x169c48[_0x793c('0x53')];if(!_0x2ea118[_0x793c('0x4d')]['hasOwnProperty'](_0x793c('0x55'))){_0x39d643[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x2ea118[_0x793c('0x4d')][_0x793c('0x30')]);_0x39d643[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x2ea118[_0x793c('0x4d')][_0x793c('0x2f')]);}return _0x58c742[_0x793c('0xc6')](_0x39d643);}})[_0x793c('0x1f')](function(_0x5b9220){if(_0x5b9220){return _0x5b9220?{'count':_0x869e7,'rows':_0x5b9220}:null;}})[_0x793c('0x1f')](respondWithResult(_0x35c334,null))[_0x793c('0x2a')](handleError(_0x35c334,null));};exports[_0x793c('0xc7')]=function(_0x34d2ba,_0x26423b,_0x57bf45){var _0x5b722d={};var _0x1a26ee={};var _0x29a8fd;var _0xc001d2;return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0x34d2ba[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x26423b,null))[_0x793c('0x1f')](function(_0x19052e){if(_0x19052e){_0x29a8fd=_0x19052e;_0x1a26ee['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0x1a26ee[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x34d2ba[_0x793c('0x4d')]);_0x1a26ee[_0x793c('0x4e')]=_[_0x793c('0x50')](_0x1a26ee[_0x793c('0x51')],_0x1a26ee[_0x793c('0x4d')]);_0x5b722d[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x1a26ee[_0x793c('0x51')],qs[_0x793c('0x52')](_0x34d2ba[_0x793c('0x4d')]['fields']));_0x5b722d[_0x793c('0x4f')]=_0x5b722d[_0x793c('0x4f')][_0x793c('0x53')]?_0x5b722d[_0x793c('0x4f')]:_0x1a26ee['model'];_0x5b722d[_0x793c('0x56')]=qs[_0x793c('0x57')](_0x34d2ba[_0x793c('0x4d')]['sort']);_0x5b722d[_0x793c('0x58')]=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x34d2ba[_0x793c('0x4d')],_0x1a26ee[_0x793c('0x4e')]));if(_0x34d2ba['query']['filter']){_0x5b722d[_0x793c('0x58')]=_['merge'](_0x5b722d[_0x793c('0x58')],{'$or':_[_0x793c('0x3e')](_0x5b722d['attributes'],function(_0x3de4c4){var _0x55b757={};_0x55b757[_0x3de4c4]={'$like':'%'+_0x34d2ba[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x55b757;})});}_0x5b722d=_[_0x793c('0x5b')]({},_0x5b722d,_0x34d2ba['options']);return _0x29a8fd[_0x793c('0xc7')](_0x5b722d);}})[_0x793c('0x1f')](function(_0x59f43f){if(_0x59f43f){_0xc001d2=_0x59f43f['length'];if(!_0x34d2ba[_0x793c('0x4d')][_0x793c('0x54')](_0x793c('0x55'))){_0x5b722d[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x34d2ba[_0x793c('0x4d')][_0x793c('0x30')]);_0x5b722d[_0x793c('0x2f')]=qs['offset'](_0x34d2ba['query'][_0x793c('0x2f')]);}return _0x29a8fd[_0x793c('0xc7')](_0x5b722d);}})[_0x793c('0x1f')](function(_0x1682ad){if(_0x1682ad){return _0x1682ad?{'count':_0xc001d2,'rows':_0x1682ad}:null;}})['then'](respondWithResult(_0x26423b,null))[_0x793c('0x2a')](handleError(_0x26423b,null));};exports[_0x793c('0xc8')]=function(_0x3397b2,_0x548e6c,_0x57f6e9){var _0x56b664={'raw':!![],'where':{}};var _0x1c7558={};var _0x349b30={'count':0x0,'rows':[]};return db['User'][_0x793c('0x94')]({'where':{'id':_0x3397b2['params']['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x548e6c,null))[_0x793c('0x1f')](function(_0x2ff84c){if(_0x2ff84c){_0x1c7558[_0x793c('0x51')]=_['keys'](db[_0x793c('0xc9')]['rawAttributes']);_0x1c7558[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x3397b2[_0x793c('0x4d')]);_0x1c7558[_0x793c('0x4e')]=_['intersection'](_0x1c7558['model'],_0x1c7558[_0x793c('0x4d')]);_0x56b664[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x1c7558[_0x793c('0x51')],qs[_0x793c('0x52')](_0x3397b2[_0x793c('0x4d')][_0x793c('0x52')]));_0x56b664[_0x793c('0x4f')]=_0x56b664[_0x793c('0x4f')]['length']?_0x56b664['attributes']:_0x1c7558[_0x793c('0x51')];if(!_0x3397b2[_0x793c('0x4d')][_0x793c('0x54')](_0x793c('0x55'))){_0x56b664['limit']=qs['limit'](_0x3397b2[_0x793c('0x4d')]['limit']);_0x56b664[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x3397b2[_0x793c('0x4d')]['offset']);}_0x56b664[_0x793c('0x56')]=qs['sort'](_0x3397b2[_0x793c('0x4d')][_0x793c('0x57')]);_0x56b664[_0x793c('0x58')]=qs['filters'](_['pick'](_0x3397b2['query'],_0x1c7558[_0x793c('0x4e')]));_0x56b664[_0x793c('0x58')][_0x793c('0xca')]=_0x2ff84c['id'];if(_0x3397b2[_0x793c('0x4d')][_0x793c('0x5a')]){_0x56b664[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x56b664[_0x793c('0x58')],{'$or':_[_0x793c('0x3e')](_0x56b664['attributes'],function(_0x1972b6){var _0x51be35={};_0x51be35[_0x1972b6]={'$like':'%'+_0x3397b2[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x51be35;})});}_0x56b664=_['merge']({},_0x56b664,_0x3397b2[_0x793c('0x60')]);return db['VoiceRecording'][_0x793c('0x2e')]({'where':_0x56b664[_0x793c('0x58')]})[_0x793c('0x1f')](function(_0x356121){_0x349b30[_0x793c('0x2e')]=_0x356121;if(_0x3397b2['query'][_0x793c('0x61')]){_0x56b664[_0x793c('0x62')]=[{'all':!![]}];}return db[_0x793c('0xc9')][_0x793c('0x63')](_0x56b664);})[_0x793c('0x1f')](function(_0x431f82){_0x349b30[_0x793c('0x64')]=_0x431f82;return _0x349b30;});}})[_0x793c('0x1f')](respondWithFilteredResult(_0x548e6c,_0x56b664))[_0x793c('0x2a')](handleError(_0x548e6c,null));};exports[_0x793c('0xcb')]=function(_0x42a50f,_0x3cd952,_0x107df2){var _0x5482f1={'raw':!![],'where':{}};var _0x44508b={};var _0x549fe7={'count':0x0,'rows':[]};return db[_0x793c('0x45')]['findOne']({'where':{'id':_0x42a50f[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x3cd952,null))[_0x793c('0x1f')](function(_0x53f80c){if(_0x53f80c){_0x44508b[_0x793c('0x51')]=_['keys'](db[_0x793c('0xcc')][_0x793c('0x46')]);_0x44508b['query']=_[_0x793c('0x4c')](_0x42a50f[_0x793c('0x4d')]);_0x44508b[_0x793c('0x4e')]=_[_0x793c('0x50')](_0x44508b[_0x793c('0x51')],_0x44508b[_0x793c('0x4d')]);_0x5482f1['attributes']=_['intersection'](_0x44508b[_0x793c('0x51')],qs[_0x793c('0x52')](_0x42a50f[_0x793c('0x4d')][_0x793c('0x52')]));_0x5482f1[_0x793c('0x4f')]=_0x5482f1[_0x793c('0x4f')][_0x793c('0x53')]?_0x5482f1[_0x793c('0x4f')]:_0x44508b[_0x793c('0x51')];if(!_0x42a50f[_0x793c('0x4d')]['hasOwnProperty']('nolimit')){_0x5482f1[_0x793c('0x30')]=qs['limit'](_0x42a50f['query'][_0x793c('0x30')]);_0x5482f1['offset']=qs[_0x793c('0x2f')](_0x42a50f[_0x793c('0x4d')][_0x793c('0x2f')]);}_0x5482f1[_0x793c('0x56')]=qs[_0x793c('0x57')](_0x42a50f[_0x793c('0x4d')][_0x793c('0x57')]);_0x5482f1['where']=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x42a50f[_0x793c('0x4d')],_0x44508b[_0x793c('0x4e')]));_0x5482f1[_0x793c('0x58')]['UserId']=_0x53f80c['id'];if(_0x42a50f[_0x793c('0x4d')][_0x793c('0x5a')]){_0x5482f1[_0x793c('0x58')]=_['merge'](_0x5482f1['where'],{'$or':_['map'](_0x5482f1[_0x793c('0x4f')],function(_0x2cee9b){var _0x23a530={};_0x23a530[_0x2cee9b]={'$like':'%'+_0x42a50f[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x23a530;})});}_0x5482f1=_['merge']({},_0x5482f1,_0x42a50f['options']);return db[_0x793c('0xcc')][_0x793c('0x2e')]({'where':_0x5482f1[_0x793c('0x58')]})[_0x793c('0x1f')](function(_0x37fc2b){_0x549fe7[_0x793c('0x2e')]=_0x37fc2b;if(_0x42a50f['query'][_0x793c('0x61')]){_0x5482f1[_0x793c('0x62')]=[{'all':!![]}];}return db[_0x793c('0xcc')][_0x793c('0x63')](_0x5482f1);})['then'](function(_0x9c261c){_0x549fe7[_0x793c('0x64')]=_0x9c261c;return _0x549fe7;});}})['then'](respondWithFilteredResult(_0x3cd952,_0x5482f1))['catch'](handleError(_0x3cd952,null));};exports['getChatInteractions']=function(_0x373433,_0x3eaf1a,_0x55280c){var _0x14aee6={};var _0x1355cf={};var _0x2349a1;var _0x4865a1;return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0x373433['params']['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x3eaf1a,null))[_0x793c('0x1f')](function(_0x1b8ee5){if(_0x1b8ee5){_0x2349a1=_0x1b8ee5;_0x1355cf[_0x793c('0x51')]=_['keys'](db[_0x793c('0xcd')][_0x793c('0x46')]);_0x1355cf[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x373433[_0x793c('0x4d')]);_0x1355cf[_0x793c('0x4e')]=_['intersection'](_0x1355cf[_0x793c('0x51')],_0x1355cf[_0x793c('0x4d')]);_0x14aee6[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x1355cf[_0x793c('0x51')],qs[_0x793c('0x52')](_0x373433[_0x793c('0x4d')][_0x793c('0x52')]));_0x14aee6[_0x793c('0x4f')]=_0x14aee6[_0x793c('0x4f')][_0x793c('0x53')]?_0x14aee6[_0x793c('0x4f')]:_0x1355cf[_0x793c('0x51')];_0x14aee6[_0x793c('0x56')]=qs[_0x793c('0x57')](_0x373433[_0x793c('0x4d')][_0x793c('0x57')]);_0x14aee6['where']=qs[_0x793c('0x4e')](_['pick'](_0x373433[_0x793c('0x4d')],_0x1355cf[_0x793c('0x4e')]));if(_0x373433[_0x793c('0x4d')]['filter']){_0x14aee6[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x14aee6[_0x793c('0x58')],{'$or':_[_0x793c('0x3e')](_0x14aee6['attributes'],function(_0x36733c){var _0x293b39={};_0x293b39[_0x36733c]={'$like':'%'+_0x373433[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x293b39;})});}_0x14aee6=_[_0x793c('0x5b')]({},_0x14aee6,_0x373433[_0x793c('0x60')]);return _0x2349a1[_0x793c('0xce')](_0x14aee6);}})[_0x793c('0x1f')](function(_0x27d69c){if(_0x27d69c){_0x4865a1=_0x27d69c[_0x793c('0x53')];if(!_0x373433['query']['hasOwnProperty'](_0x793c('0x55'))){_0x14aee6[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x373433[_0x793c('0x4d')][_0x793c('0x30')]);_0x14aee6[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x373433[_0x793c('0x4d')][_0x793c('0x2f')]);}return _0x2349a1['getChatInteractions'](_0x14aee6);}})[_0x793c('0x1f')](function(_0x5f370f){if(_0x5f370f){return _0x5f370f?{'count':_0x4865a1,'rows':_0x5f370f}:null;}})[_0x793c('0x1f')](respondWithResult(_0x3eaf1a,null))['catch'](handleError(_0x3eaf1a,null));};exports[_0x793c('0xcf')]=function(_0x548ed4,_0x5e7b03,_0x4a5ea0){var _0x47671f={};var _0x3faf06={};var _0x48c015;var _0x33fead;return db['User']['findOne']({'where':{'id':_0x548ed4[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x5e7b03,null))['then'](function(_0x34ae99){if(_0x34ae99){_0x48c015=_0x34ae99;_0x3faf06[_0x793c('0x51')]=_['keys'](db['OpenchannelInteraction'][_0x793c('0x46')]);_0x3faf06[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x548ed4[_0x793c('0x4d')]);_0x3faf06[_0x793c('0x4e')]=_[_0x793c('0x50')](_0x3faf06['model'],_0x3faf06[_0x793c('0x4d')]);_0x47671f[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x3faf06[_0x793c('0x51')],qs[_0x793c('0x52')](_0x548ed4[_0x793c('0x4d')][_0x793c('0x52')]));_0x47671f[_0x793c('0x4f')]=_0x47671f[_0x793c('0x4f')][_0x793c('0x53')]?_0x47671f[_0x793c('0x4f')]:_0x3faf06[_0x793c('0x51')];_0x47671f['order']=qs[_0x793c('0x57')](_0x548ed4[_0x793c('0x4d')][_0x793c('0x57')]);_0x47671f[_0x793c('0x58')]=qs[_0x793c('0x4e')](_['pick'](_0x548ed4[_0x793c('0x4d')],_0x3faf06[_0x793c('0x4e')]));if(_0x548ed4[_0x793c('0x4d')]['filter']){_0x47671f[_0x793c('0x58')]=_['merge'](_0x47671f['where'],{'$or':_[_0x793c('0x3e')](_0x47671f[_0x793c('0x4f')],function(_0x111674){var _0x4ca440={};_0x4ca440[_0x111674]={'$like':'%'+_0x548ed4[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x4ca440;})});}_0x47671f=_[_0x793c('0x5b')]({},_0x47671f,_0x548ed4[_0x793c('0x60')]);return _0x48c015[_0x793c('0xcf')](_0x47671f);}})[_0x793c('0x1f')](function(_0x3b2da9){if(_0x3b2da9){_0x33fead=_0x3b2da9[_0x793c('0x53')];if(!_0x548ed4['query'][_0x793c('0x54')](_0x793c('0x55'))){_0x47671f[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x548ed4[_0x793c('0x4d')][_0x793c('0x30')]);_0x47671f[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x548ed4['query'][_0x793c('0x2f')]);}return _0x48c015[_0x793c('0xcf')](_0x47671f);}})['then'](function(_0x8d8b9){if(_0x8d8b9){return _0x8d8b9?{'count':_0x33fead,'rows':_0x8d8b9}:null;}})[_0x793c('0x1f')](respondWithResult(_0x5e7b03,null))['catch'](handleError(_0x5e7b03,null));};exports[_0x793c('0xd0')]=function(_0x40e124,_0x3e747c,_0x58179d){var _0x1849f0={'raw':!![],'where':{}};var _0x4120e1={};var _0x2b7968={'count':0x0,'rows':[]};return db['User'][_0x793c('0x94')]({'where':{'id':_0x40e124[_0x793c('0x65')]['id']}})['then'](handleEntityNotFound(_0x3e747c,null))[_0x793c('0x1f')](function(_0x431a6d){if(_0x431a6d){_0x4120e1[_0x793c('0x51')]=_[_0x793c('0x4c')](db[_0x793c('0xd1')]['rawAttributes']);_0x4120e1[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x40e124['query']);_0x4120e1['filters']=_[_0x793c('0x50')](_0x4120e1[_0x793c('0x51')],_0x4120e1['query']);_0x1849f0[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x4120e1['model'],qs['fields'](_0x40e124[_0x793c('0x4d')][_0x793c('0x52')]));_0x1849f0[_0x793c('0x4f')]=_0x1849f0[_0x793c('0x4f')][_0x793c('0x53')]?_0x1849f0[_0x793c('0x4f')]:_0x4120e1['model'];if(!_0x40e124['query'][_0x793c('0x54')](_0x793c('0x55'))){_0x1849f0[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x40e124[_0x793c('0x4d')][_0x793c('0x30')]);_0x1849f0[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x40e124[_0x793c('0x4d')][_0x793c('0x2f')]);}_0x1849f0['order']=qs[_0x793c('0x57')](_0x40e124[_0x793c('0x4d')][_0x793c('0x57')]);_0x1849f0[_0x793c('0x58')]=qs[_0x793c('0x4e')](_['pick'](_0x40e124[_0x793c('0x4d')],_0x4120e1[_0x793c('0x4e')]));_0x1849f0[_0x793c('0x58')][_0x793c('0xca')]=_0x431a6d['id'];if(_0x40e124[_0x793c('0x4d')]['filter']){_0x1849f0[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x1849f0['where'],{'$or':_[_0x793c('0x3e')](_0x1849f0[_0x793c('0x4f')],function(_0x2bb098){var _0x582d4d={};_0x582d4d[_0x2bb098]={'$like':'%'+_0x40e124['query'][_0x793c('0x5a')]+'%'};return _0x582d4d;})});}_0x1849f0=_['merge']({},_0x1849f0,_0x40e124[_0x793c('0x60')]);return db[_0x793c('0xd1')][_0x793c('0x2e')]({'where':_0x1849f0[_0x793c('0x58')]})[_0x793c('0x1f')](function(_0x357f2f){_0x2b7968[_0x793c('0x2e')]=_0x357f2f;if(_0x40e124[_0x793c('0x4d')]['includeAll']){_0x1849f0[_0x793c('0x62')]=[{'all':!![]}];}return db['MailInteraction'][_0x793c('0x63')](_0x1849f0);})[_0x793c('0x1f')](function(_0x1b09e5){_0x2b7968[_0x793c('0x64')]=_0x1b09e5;return _0x2b7968;});}})[_0x793c('0x1f')](respondWithFilteredResult(_0x3e747c,_0x1849f0))['catch'](handleError(_0x3e747c,null));};exports['getSmsInteractions']=function(_0x5b105b,_0x2a297e,_0x328ad0){var _0x4c5b93={};var _0x28f9a7={};var _0x1a0ad2;var _0x3c26aa;return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0x5b105b[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x2a297e,null))['then'](function(_0x3b5324){if(_0x3b5324){_0x1a0ad2=_0x3b5324;_0x28f9a7[_0x793c('0x51')]=_[_0x793c('0x4c')](db['SmsInteraction'][_0x793c('0x46')]);_0x28f9a7['query']=_[_0x793c('0x4c')](_0x5b105b['query']);_0x28f9a7[_0x793c('0x4e')]=_['intersection'](_0x28f9a7[_0x793c('0x51')],_0x28f9a7[_0x793c('0x4d')]);_0x4c5b93[_0x793c('0x4f')]=_['intersection'](_0x28f9a7[_0x793c('0x51')],qs[_0x793c('0x52')](_0x5b105b[_0x793c('0x4d')][_0x793c('0x52')]));_0x4c5b93[_0x793c('0x4f')]=_0x4c5b93[_0x793c('0x4f')][_0x793c('0x53')]?_0x4c5b93[_0x793c('0x4f')]:_0x28f9a7['model'];_0x4c5b93[_0x793c('0x56')]=qs[_0x793c('0x57')](_0x5b105b[_0x793c('0x4d')][_0x793c('0x57')]);_0x4c5b93['where']=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x5b105b['query'],_0x28f9a7[_0x793c('0x4e')]));if(_0x5b105b[_0x793c('0x4d')]['filter']){_0x4c5b93['where']=_['merge'](_0x4c5b93['where'],{'$or':_[_0x793c('0x3e')](_0x4c5b93['attributes'],function(_0x6e5433){var _0x23a545={};_0x23a545[_0x6e5433]={'$like':'%'+_0x5b105b[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x23a545;})});}_0x4c5b93=_[_0x793c('0x5b')]({},_0x4c5b93,_0x5b105b[_0x793c('0x60')]);return _0x1a0ad2['getSmsInteractions'](_0x4c5b93);}})[_0x793c('0x1f')](function(_0x40ceb1){if(_0x40ceb1){_0x3c26aa=_0x40ceb1[_0x793c('0x53')];if(!_0x5b105b['query'][_0x793c('0x54')](_0x793c('0x55'))){_0x4c5b93['limit']=qs[_0x793c('0x30')](_0x5b105b[_0x793c('0x4d')][_0x793c('0x30')]);_0x4c5b93[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x5b105b[_0x793c('0x4d')]['offset']);}return _0x1a0ad2[_0x793c('0xd2')](_0x4c5b93);}})[_0x793c('0x1f')](function(_0xe1a140){if(_0xe1a140){return _0xe1a140?{'count':_0x3c26aa,'rows':_0xe1a140}:null;}})[_0x793c('0x1f')](respondWithResult(_0x2a297e,null))[_0x793c('0x2a')](handleError(_0x2a297e,null));};exports['getFaxInteractions']=function(_0x453265,_0x4a5356,_0x6a169b){var _0x56ce5c={};var _0x110135={};var _0x56c184;var _0x5ae1a5;return db['User'][_0x793c('0x94')]({'where':{'id':_0x453265['params']['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x4a5356,null))['then'](function(_0x120952){if(_0x120952){_0x56c184=_0x120952;_0x110135['model']=_[_0x793c('0x4c')](db[_0x793c('0xd3')]['rawAttributes']);_0x110135['query']=_[_0x793c('0x4c')](_0x453265['query']);_0x110135[_0x793c('0x4e')]=_['intersection'](_0x110135[_0x793c('0x51')],_0x110135[_0x793c('0x4d')]);_0x56ce5c['attributes']=_[_0x793c('0x50')](_0x110135[_0x793c('0x51')],qs[_0x793c('0x52')](_0x453265[_0x793c('0x4d')][_0x793c('0x52')]));_0x56ce5c[_0x793c('0x4f')]=_0x56ce5c[_0x793c('0x4f')][_0x793c('0x53')]?_0x56ce5c[_0x793c('0x4f')]:_0x110135['model'];_0x56ce5c[_0x793c('0x56')]=qs[_0x793c('0x57')](_0x453265['query']['sort']);_0x56ce5c[_0x793c('0x58')]=qs['filters'](_[_0x793c('0x59')](_0x453265['query'],_0x110135['filters']));if(_0x453265['query'][_0x793c('0x5a')]){_0x56ce5c[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x56ce5c[_0x793c('0x58')],{'$or':_['map'](_0x56ce5c[_0x793c('0x4f')],function(_0x5dd3d2){var _0x38c41d={};_0x38c41d[_0x5dd3d2]={'$like':'%'+_0x453265[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x38c41d;})});}_0x56ce5c=_['merge']({},_0x56ce5c,_0x453265['options']);return _0x56c184[_0x793c('0xd4')](_0x56ce5c);}})['then'](function(_0x4266aa){if(_0x4266aa){_0x5ae1a5=_0x4266aa[_0x793c('0x53')];if(!_0x453265['query'][_0x793c('0x54')](_0x793c('0x55'))){_0x56ce5c[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x453265[_0x793c('0x4d')]['limit']);_0x56ce5c[_0x793c('0x2f')]=qs['offset'](_0x453265[_0x793c('0x4d')]['offset']);}return _0x56c184[_0x793c('0xd4')](_0x56ce5c);}})[_0x793c('0x1f')](function(_0x234ad1){if(_0x234ad1){return _0x234ad1?{'count':_0x5ae1a5,'rows':_0x234ad1}:null;}})[_0x793c('0x1f')](respondWithResult(_0x4a5356,null))['catch'](handleError(_0x4a5356,null));};exports[_0x793c('0xd5')]=function(_0x208469,_0x520a17,_0x23a400){var _0x3ff10b={};var _0x555540={};var _0x188c39;var _0x3b1a3a;return db['User'][_0x793c('0x94')]({'where':{'id':_0x208469[_0x793c('0x65')]['id']}})['then'](handleEntityNotFound(_0x520a17,null))['then'](function(_0x5e1b23){if(_0x5e1b23){_0x188c39=_0x5e1b23;_0x555540[_0x793c('0x51')]=_[_0x793c('0x4c')](db[_0x793c('0xd6')][_0x793c('0x46')]);_0x555540[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x208469[_0x793c('0x4d')]);_0x555540['filters']=_[_0x793c('0x50')](_0x555540[_0x793c('0x51')],_0x555540[_0x793c('0x4d')]);_0x3ff10b[_0x793c('0x4f')]=_['intersection'](_0x555540[_0x793c('0x51')],qs[_0x793c('0x52')](_0x208469[_0x793c('0x4d')][_0x793c('0x52')]));_0x3ff10b['attributes']=_0x3ff10b[_0x793c('0x4f')][_0x793c('0x53')]?_0x3ff10b[_0x793c('0x4f')]:_0x555540[_0x793c('0x51')];_0x3ff10b[_0x793c('0x56')]=qs[_0x793c('0x57')](_0x208469[_0x793c('0x4d')][_0x793c('0x57')]);_0x3ff10b[_0x793c('0x58')]=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x208469['query'],_0x555540['filters']));if(_0x208469[_0x793c('0x4d')][_0x793c('0x5a')]){_0x3ff10b[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x3ff10b['where'],{'$or':_[_0x793c('0x3e')](_0x3ff10b['attributes'],function(_0x1242e5){var _0x216c97={};_0x216c97[_0x1242e5]={'$like':'%'+_0x208469[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x216c97;})});}_0x3ff10b=_['merge']({},_0x3ff10b,_0x208469['options']);return _0x188c39[_0x793c('0xd5')](_0x3ff10b);}})['then'](function(_0x330c65){if(_0x330c65){_0x3b1a3a=_0x330c65['length'];if(!_0x208469[_0x793c('0x4d')][_0x793c('0x54')](_0x793c('0x55'))){_0x3ff10b[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x208469[_0x793c('0x4d')][_0x793c('0x30')]);_0x3ff10b[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x208469[_0x793c('0x4d')][_0x793c('0x2f')]);}return _0x188c39[_0x793c('0xd5')](_0x3ff10b);}})['then'](function(_0x254987){if(_0x254987){return _0x254987?{'count':_0x3b1a3a,'rows':_0x254987}:null;}})[_0x793c('0x1f')](respondWithResult(_0x520a17,null))[_0x793c('0x2a')](handleError(_0x520a17,null));};exports[_0x793c('0xd7')]=function(_0x4ba203,_0x4cc09a,_0x4fe066){var _0x1672e3;var _0x9dac09;var _0x40e1ac;var _0x49fd85=!_[_0x793c('0x71')](_0x4ba203[_0x793c('0x65')]['id'])?_0x4ba203[_0x793c('0x65')]['id']:!_['isNil'](_0x4ba203['user']['id'])?_0x4ba203[_0x793c('0x39')]['id']:null;return db['User'][_0x793c('0x40')]({'where':{'id':_0x49fd85,'role':{'$or':[_0x793c('0x6e'),'user',_0x793c('0x3a')]}},'attributes':['id',_0x793c('0x42'),'phone',_0x793c('0xd8'),'role','internal',_0x793c('0xa0')]})[_0x793c('0x1f')](function(_0x17cc8c){if(_0x17cc8c){if(_0x17cc8c[_0x793c('0x41')]===_0x793c('0x3a')){_0x1672e3=_0x17cc8c;if(_0x4ba203[_0x793c('0x68')][_0x793c('0xa2')]){_0x40e1ac=util[_0x793c('0x73')](_0x793c('0xd9'),_0x1672e3[_0x4ba203[_0x793c('0x68')][_0x793c('0xa2')]]);}else if(_0x4ba203['body'][_0x793c('0xda')]){_0x40e1ac=util['format'](_0x793c('0xad'),_0x4ba203[_0x793c('0x68')]['intrf']);}else{_0x40e1ac=util[_0x793c('0x73')](_0x793c('0xad'),_0x1672e3['name']);}socket['to'](util[_0x793c('0x73')](_0x793c('0xdb'),_0x1672e3[_0x793c('0x42')]))[_0x793c('0xa9')](_0x793c('0xdc'),{'ip':_0x4ba203[_0x793c('0xdd')][_0x793c('0xde')]||_0x4ba203[_0x793c('0xdf')][_0x793c('0xe0')]||_0x4ba203[_0x793c('0xe1')]['remoteAddress']||_0x4ba203[_0x793c('0xdf')][_0x793c('0xe1')][_0x793c('0xe0')]});return db[_0x793c('0xaf')]['destroy']({'where':{'membername':_0x1672e3['name']},'individualHooks':!![]});}}else{throw new db[(_0x793c('0x1c'))][(_0x793c('0x97'))](_0x793c('0xe2'));}})[_0x793c('0x1f')](function(){if(_0x1672e3){return _0x1672e3[_0x793c('0xe3')]({'raw':!![]});}})[_0x793c('0x1f')](function(_0x1e6c2a){if(_0x1672e3){var _0x4a574c=[];if(_0x1e6c2a){_0x9dac09=_0x1e6c2a;if(_0x9dac09[_0x793c('0x53')]){for(var _0x25eff0=0x0;_0x25eff0<_0x9dac09['length'];_0x25eff0++){_0x4a574c['push']({'membername':_0x1672e3['name'],'UserId':_0x1672e3['id'],'queue_name':_0x9dac09[_0x25eff0]['name'],'VoiceQueueId':_0x9dac09[_0x25eff0]['id'],'interface':_0x40e1ac,'paused':_0x1672e3['loginInPause']||![],'penalty':_0x9dac09[_0x25eff0][_0x793c('0xe4')]||0x0});}return BPromise[_0x793c('0xae')](_0x4a574c,function(_0x304615){return db[_0x793c('0xaf')][_0x793c('0xe5')](_0x304615);});}}}})['then'](function(){if(_0x1672e3){return db['MemberReport'][_0x793c('0x63')]({'where':{'membername':_0x1672e3[_0x793c('0x42')],'exitAt':null}});}})[_0x793c('0x1f')](function(_0x395512){if(_0x1672e3){var _0x2c7d3c=[];_0x395512[_0x793c('0xe6')](function(_0x4fc8a7){_0x2c7d3c[_0x793c('0xac')](_0x4fc8a7[_0x793c('0x37')]({'exitAt':moment()['format'](_0x793c('0xe7'))}));});return BPromise[_0x793c('0xe8')](_0x2c7d3c);}})[_0x793c('0x1f')](function(){if(_0x1672e3){var _0x59ad2b=[];var _0x62fa8e=[];var _0x46489c=utils[_0x793c('0xe9')]();var _0x1bced7={'membername':_0x1672e3['name'],'interface':_0x40e1ac,'enterAt':moment()[_0x793c('0x73')](_0x793c('0xe7')),'role':_0x1672e3[_0x793c('0x41')],'internal':_0x1672e3['internal']};_0x46489c[_0x793c('0xe6')](function(_0x1add02){_0x59ad2b[_0x793c('0xac')](_['merge']({'channel':_0x1add02,'type':_0x793c('0xea'),'data1':_0x4ba203[_0x793c('0x68')]['device'],'data2':_0x40e1ac},_0x1bced7));if(_0x1672e3['loginInPause']){_0x62fa8e[_0x793c('0xac')](_[_0x793c('0x5b')]({'channel':_0x1add02,'type':_0x793c('0xeb'),'data1':_0x793c('0xec')},_0x1bced7));}});return db[_0x793c('0xed')][_0x793c('0x67')](_0x59ad2b[_0x793c('0xee')](_0x62fa8e),{'individualHooks':!![]});}})[_0x793c('0x1f')](function(){if(_0x1672e3){return _0x1672e3[_0x793c('0x37')]({'online':!![],'lastLoginAt':moment()[_0x793c('0x73')](_0x793c('0xe7')),'voicePause':_0x1672e3[_0x793c('0xa0')]||![],'mailPause':_0x1672e3[_0x793c('0xa0')]||![],'chatPause':_0x1672e3[_0x793c('0xa0')]||![],'faxPause':_0x1672e3[_0x793c('0xa0')]||![],'smsPause':_0x1672e3[_0x793c('0xa0')]||![],'openchannelPause':_0x1672e3[_0x793c('0xa0')]||![],'whatsappPause':_0x1672e3[_0x793c('0xa0')]||![],'pauseType':_0x1672e3['loginInPause']?_0x793c('0xec'):null,'interface':_0x40e1ac,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x793c('0x1f')](function(_0x536b20){if(_0x4ba203[_0x793c('0xef')]){return _0x4fe066();}else{return BPromise['resolve'](_0x536b20)['then'](respondWithResult(_0x4cc09a,null));}})['catch'](handleError(_0x4cc09a,null));};exports[_0x793c('0xf0')]=function(_0x31e5ab,_0x25fd3a,_0x19a22e){var _0x2642e0;return db['User'][_0x793c('0x40')]({'where':{'id':_0x31e5ab[_0x793c('0x65')]['id'],'role':_0x793c('0x3a')},'attributes':['id',_0x793c('0x42'),_0x793c('0x41')]})[_0x793c('0x1f')](handleEntityNotFound(_0x25fd3a,null))[_0x793c('0x1f')](function(_0x725c23){if(_0x725c23){_0x2642e0=_0x725c23;return db[_0x793c('0xaf')]['destroy']({'where':{'membername':_0x2642e0[_0x793c('0x42')]},'individualHooks':!![]});}})[_0x793c('0x1f')](function(){return db[_0x793c('0xed')][_0x793c('0x63')]({'where':{'membername':_0x2642e0['name'],'exitAt':null}});})[_0x793c('0x1f')](function(_0x480be5){var _0x515e99=[];_0x480be5[_0x793c('0xe6')](function(_0x1793ba){_0x515e99['push'](_0x1793ba[_0x793c('0x37')]({'exitAt':moment()[_0x793c('0x73')](_0x793c('0xe7'))}));});return BPromise['all'](_0x515e99);})['then'](function(){return _0x2642e0['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x793c('0x1f')](respondWithResult(_0x25fd3a,null))['catch'](handleError(_0x25fd3a,null));};exports[_0x793c('0xf1')]=function(_0x5c4292,_0x5127fc,_0x183f23){var _0xd4c366;return db[_0x793c('0xaf')][_0x793c('0x37')]({'paused':0x1},{'where':{'UserId':_0x5c4292[_0x793c('0x65')]['id']},'individualHooks':!![]})[_0x793c('0x1f')](function(){return db[_0x793c('0x45')][_0x793c('0x40')]({'where':{'id':_0x5c4292[_0x793c('0x65')]['id'],'role':_0x793c('0x3a')},'attributes':['id',_0x793c('0x42'),_0x793c('0x41'),_0x793c('0x7b'),_0x793c('0xa2')]});})['then'](handleEntityNotFound(_0x5127fc,null))[_0x793c('0x1f')](function(_0x59ba5c){if(_0x59ba5c){_0xd4c366=_0x59ba5c;return respondWithRpcPromise(_0x793c('0xf2'),'pause',{'id':_0xd4c366['id'],'name':_0xd4c366[_0x793c('0x42')],'pause':!![]});}})['then'](function(){if(_0xd4c366){return db['MemberReport']['findAll']({'where':{'membername':_0xd4c366[_0x793c('0x42')],'type':'PAUSE','exitAt':null}});}})[_0x793c('0x1f')](function(_0x1cf43b){if(_0x1cf43b['length']){var _0x50bc31=moment()[_0x793c('0x73')](_0x793c('0xe7'));for(var _0x105113=0x0,_0x4d36ba=_0x1cf43b['length'];_0x105113<_0x4d36ba;_0x105113++){_0x1cf43b[_0x105113]['updateAttributes']({'exitAt':_0x50bc31});}}})[_0x793c('0x1f')](function(){var _0x339164=[];var _0x11cc7f=utils[_0x793c('0xe9')]();_0x11cc7f['forEach'](function(_0x17fa1d){_0x339164[_0x793c('0xac')]({'channel':_0x17fa1d,'membername':_0xd4c366[_0x793c('0x42')],'interface':_[_0x793c('0x71')](_0xd4c366[_0x793c('0xa2')])?util[_0x793c('0x73')](_0x793c('0xad'),_0xd4c366['name']):_0xd4c366[_0x793c('0xa2')],'type':_0x793c('0xeb'),'enterAt':moment()[_0x793c('0x73')](_0x793c('0xe7')),'data1':_0x5c4292[_0x793c('0x68')][_0x793c('0x48')]||_0x793c('0xf3'),'role':_0xd4c366[_0x793c('0x41')],'internal':_0xd4c366[_0x793c('0x7b')]});});return db[_0x793c('0xed')][_0x793c('0x67')](_0x339164,{'individualHooks':!![]});})['then'](function(){return _0xd4c366[_0x793c('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5c4292[_0x793c('0x68')][_0x793c('0x48')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x793c('0x73')](_0x793c('0xe7'))});})['then'](respondWithResult(_0x5127fc,null))[_0x793c('0x2a')](handleError(_0x5127fc,null));};exports[_0x793c('0xf4')]=function(_0x2fb9fc,_0x94c652,_0x47ec45){var _0x2408e8;return db['User'][_0x793c('0x40')]({'where':{'id':_0x2fb9fc[_0x793c('0x65')]['id']},'attributes':['id',_0x793c('0x42'),_0x793c('0x41'),_0x793c('0xa1'),_0x793c('0xf5'),_0x793c('0xf6'),'faxPause',_0x793c('0xf7'),_0x793c('0xf8'),_0x793c('0xf9'),_0x793c('0xfa'),'lastPauseAt']})['then'](handleEntityNotFound(_0x94c652,null))[_0x793c('0x1f')](function(_0x3fa41f){if(_0x3fa41f){_0x2408e8=_0x3fa41f;if(_0x2fb9fc[_0x793c('0x68')][_0x793c('0x9e')]&&!utils[_0x793c('0xa3')](_0x2fb9fc['body']['channel'])){throw new db['Sequelize'][(_0x793c('0x97'))](_0x793c('0xb1'));}switch(_0x2fb9fc[_0x793c('0x68')][_0x793c('0x9e')]){case _0x793c('0xab'):return respondWithRpcPromise(_0x793c('0xf2'),'unpause',{'id':_0x2408e8['id'],'name':_0x2408e8['name'],'pause':![]})[_0x793c('0x1f')](function(){return db[_0x793c('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0x2408e8['id']},'individualHooks':!![]});})[_0x793c('0x1f')](function(){return db['MemberReport'][_0x793c('0x40')]({'where':{'channel':_0x2fb9fc[_0x793c('0x68')]['channel'],'membername':_0x2408e8[_0x793c('0x42')],'type':_0x793c('0xeb'),'exitAt':null}});})['then'](function(_0x12d764){if(_0x12d764){return _0x12d764[_0x793c('0x37')]({'exitAt':moment()['format'](_0x793c('0xe7')),'data2':_0x793c('0xfb')},{'individualHooks':!![]});}return null;})[_0x793c('0x1f')](function(){return _0x2408e8['update']({'voicePause':![]});});case _0x793c('0xfc'):case _0x793c('0xfd'):case _0x793c('0xfe'):case _0x793c('0xff'):case _0x793c('0x100'):case _0x793c('0x101'):return db[_0x793c('0xed')]['find']({'where':{'channel':_0x2fb9fc[_0x793c('0x68')][_0x793c('0x9e')],'membername':_0x2408e8[_0x793c('0x42')],'type':_0x793c('0xeb'),'exitAt':null}})[_0x793c('0x1f')](function(_0x506b1f){if(_0x506b1f){return _0x506b1f[_0x793c('0x37')]({'exitAt':moment()[_0x793c('0x73')](_0x793c('0xe7')),'data2':_0x793c('0xfb')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x164857={};_[_0x793c('0x31')](_0x164857,util[_0x793c('0x73')](_0x793c('0x102'),_0x2fb9fc[_0x793c('0x68')][_0x793c('0x9e')],_0x793c('0x103')),![]);return _0x2408e8[_0x793c('0x37')](_0x164857);});default:return respondWithRpcPromise('QueuePause',_0x793c('0xf4'),{'id':_0x2408e8['id'],'name':_0x2408e8[_0x793c('0x42')],'pause':![]})[_0x793c('0x1f')](function(){return db['UserVoiceQueueRt'][_0x793c('0x37')]({'paused':0x0},{'where':{'UserId':_0x2408e8['id']}});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2408e8[_0x793c('0x42')],'type':'PAUSE','exitAt':null}});})[_0x793c('0x1f')](function(_0x67d066){var _0x331eb8=[];_0x67d066[_0x793c('0xe6')](function(_0x43a7){_0x331eb8[_0x793c('0xac')](_0x43a7[_0x793c('0x37')]({'exitAt':moment()[_0x793c('0x73')](_0x793c('0xe7')),'data2':_0x793c('0xfb')}));});return BPromise[_0x793c('0xe8')](_0x331eb8);})[_0x793c('0x1f')](function(){return _0x2408e8[_0x793c('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x793c('0x1f')](respondWithResult(_0x94c652,null))[_0x793c('0x2a')](handleError(_0x94c652,null));};exports['getTeams']=function(_0x5ae21a,_0x440831,_0x51acdc){var _0xb36e27={};var _0x34e76c={};var _0x41c8e0;var _0x1c4e86;return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0x5ae21a[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x440831,null))[_0x793c('0x1f')](function(_0x17afc6){if(_0x17afc6){_0x41c8e0=_0x17afc6;_0x34e76c[_0x793c('0x51')]=_[_0x793c('0x4c')](db[_0x793c('0x104')][_0x793c('0x46')]);_0x34e76c[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0x5ae21a[_0x793c('0x4d')]);_0x34e76c[_0x793c('0x4e')]=_['intersection'](_0x34e76c[_0x793c('0x51')],_0x34e76c[_0x793c('0x4d')]);_0xb36e27[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x34e76c[_0x793c('0x51')],qs[_0x793c('0x52')](_0x5ae21a[_0x793c('0x4d')][_0x793c('0x52')]));_0xb36e27['attributes']=_0xb36e27['attributes'][_0x793c('0x53')]?_0xb36e27['attributes']:_0x34e76c[_0x793c('0x51')];_0xb36e27[_0x793c('0x56')]=qs['sort'](_0x5ae21a['query'][_0x793c('0x57')]);_0xb36e27['where']=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0x5ae21a[_0x793c('0x4d')],_0x34e76c['filters']));if(_0x5ae21a[_0x793c('0x4d')][_0x793c('0x5a')]){_0xb36e27[_0x793c('0x58')]=_[_0x793c('0x5b')](_0xb36e27['where'],{'$or':_[_0x793c('0x3e')](_0xb36e27[_0x793c('0x4f')],function(_0x3fbcac){var _0x2f6a95={};_0x2f6a95[_0x3fbcac]={'$like':'%'+_0x5ae21a[_0x793c('0x4d')]['filter']+'%'};return _0x2f6a95;})});}_0xb36e27=_['merge']({},_0xb36e27,_0x5ae21a[_0x793c('0x60')]);return _0x41c8e0[_0x793c('0x105')](_0xb36e27);}})[_0x793c('0x1f')](function(_0x3589b0){if(_0x3589b0){_0x1c4e86=_0x3589b0[_0x793c('0x53')];if(!_0x5ae21a[_0x793c('0x4d')][_0x793c('0x54')]('nolimit')){_0xb36e27['limit']=qs['limit'](_0x5ae21a['query'][_0x793c('0x30')]);_0xb36e27[_0x793c('0x2f')]=qs[_0x793c('0x2f')](_0x5ae21a[_0x793c('0x4d')]['offset']);}return _0x41c8e0[_0x793c('0x105')](_0xb36e27);}})[_0x793c('0x1f')](function(_0x5c350d){if(_0x5c350d){return _0x5c350d?{'count':_0x1c4e86,'rows':_0x5c350d}:null;}})[_0x793c('0x1f')](respondWithResult(_0x440831,null))[_0x793c('0x2a')](handleError(_0x440831,null));};exports[_0x793c('0x106')]=function(_0x137017,_0x13cd61){return db[_0x793c('0x45')][_0x793c('0x40')]({'where':{'id':_0x137017[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x13cd61,null))['then'](function(_0xe99367){if(_0xe99367){var _0x13c9a4=_0xe99367[_0x793c('0x38')]({'plain':!![]});return _0xe99367[_0x793c('0x106')](_0x137017[_0x793c('0x68')][_0x793c('0x6b')],_[_0x793c('0x6c')](_0x137017['body'],[_0x793c('0x6b'),'id'])||{})[_0x793c('0x1f')](function(){for(var _0x567aaf=0x0;_0x567aaf<_0x137017[_0x793c('0x68')][_0x793c('0x6b')][_0x793c('0x53')];_0x567aaf++){var _0x3cce34=[];db[_0x793c('0x104')]['findOne']({'where':{'id':_0x137017[_0x793c('0x68')][_0x793c('0x6b')][_0x567aaf]}})[_0x793c('0x1f')](function(_0x3b6784){_0x3cce34['push'](_0x3b6784[_0x793c('0xe3')]()[_0x793c('0x1f')](function(_0x370e42){for(var _0x16f27a=0x0;_0x16f27a<_0x370e42[_0x793c('0x53')];_0x16f27a++){_0x370e42[_0x16f27a]['setDataValue'](_0x793c('0x9e'),_0x793c('0x107'));}return _0x370e42;}));_0x3cce34[_0x793c('0xac')](_0x3b6784[_0x793c('0x108')]()[_0x793c('0x1f')](function(_0x4425ad){for(var _0x49177e=0x0;_0x49177e<_0x4425ad[_0x793c('0x53')];_0x49177e++){_0x4425ad[_0x49177e][_0x793c('0x109')]('channel',_0x793c('0x10a'));}return _0x4425ad;}));_0x3cce34[_0x793c('0xac')](_0x3b6784['getMailQueues']()[_0x793c('0x1f')](function(_0x25f914){for(var _0x41ab6d=0x0;_0x41ab6d<_0x25f914[_0x793c('0x53')];_0x41ab6d++){_0x25f914[_0x41ab6d][_0x793c('0x109')](_0x793c('0x9e'),_0x793c('0x10b'));}return _0x25f914;}));_0x3cce34[_0x793c('0xac')](_0x3b6784['getSmsQueues']()[_0x793c('0x1f')](function(_0x2b023c){for(var _0x163cd3=0x0;_0x163cd3<_0x2b023c['length'];_0x163cd3++){_0x2b023c[_0x163cd3][_0x793c('0x109')]('channel',_0x793c('0x10c'));}return _0x2b023c;}));_0x3cce34[_0x793c('0xac')](_0x3b6784[_0x793c('0x10d')]()[_0x793c('0x1f')](function(_0x3ce129){for(var _0x4c0fc0=0x0;_0x4c0fc0<_0x3ce129[_0x793c('0x53')];_0x4c0fc0++){_0x3ce129[_0x4c0fc0][_0x793c('0x109')](_0x793c('0x9e'),_0x793c('0x10e'));}return _0x3ce129;}));_0x3cce34[_0x793c('0xac')](_0x3b6784[_0x793c('0x10f')]()[_0x793c('0x1f')](function(_0x57485d){for(var _0x1fbe17=0x0;_0x1fbe17<_0x57485d[_0x793c('0x53')];_0x1fbe17++){_0x57485d[_0x1fbe17][_0x793c('0x109')](_0x793c('0x9e'),'Fax');}return _0x57485d;}));_0x3cce34[_0x793c('0xac')](_0x3b6784[_0x793c('0x110')]()[_0x793c('0x1f')](function(_0x15aa56){for(var _0x3f7443=0x0;_0x3f7443<_0x15aa56[_0x793c('0x53')];_0x3f7443++){_0x15aa56[_0x3f7443][_0x793c('0x109')](_0x793c('0x9e'),'Openchannel');}return _0x15aa56;}));return BPromise[_0x793c('0xe8')](_0x3cce34);})[_0x793c('0x1f')](function(_0x2b5c8b){var _0x296f92=_['flatten'](_0x2b5c8b);_0x3cce34=[];return db[_0x793c('0x5d')][_0x793c('0x111')](function(_0x9c47f9){for(var _0x39cc3c=0x0;_0x39cc3c<_0x296f92['length'];_0x39cc3c++){_0x3cce34[_0x793c('0xac')](_0x296f92[_0x39cc3c][_0x793c('0x112')](_0x13c9a4['id']),{'transaction':_0x9c47f9});}return BPromise[_0x793c('0xe8')](_0x3cce34)[_0x793c('0x1f')](function(){if(_0x13c9a4[_0x793c('0x9f')]){return BPromise[_0x793c('0xae')](_['filter'](_0x296f92,function(_0x581ed0){return _0x581ed0[_0x793c('0x113')]('channel')==='Voice';}),function(_0x7b3cb4){return db[_0x793c('0xaf')]['upsert']({'membername':_0x13c9a4[_0x793c('0x42')],'UserId':_0x13c9a4['id'],'queue_name':_0x7b3cb4['name'],'VoiceQueueId':_0x7b3cb4['id'],'interface':_['isNil'](_0x13c9a4['interface'])?util[_0x793c('0x73')](_0x793c('0xad'),_0x13c9a4[_0x793c('0x42')]):_0x13c9a4[_0x793c('0xa2')],'paused':_0x13c9a4['voicePause']||![],'penalty':_0x13c9a4[_0x793c('0x114')]},{'transaction':_0x9c47f9});});}else{return;}})[_0x793c('0x1f')](function(){for(var _0x2eb01b=0x0;_0x2eb01b<_0x296f92[_0x793c('0x53')];_0x2eb01b++){var _0x5ac02d=_0x296f92[_0x2eb01b][_0x793c('0x113')](_0x793c('0x9e'));var _0x46fca8=_0x5ac02d+_0x793c('0xa8');socket[_0x793c('0xa9')](_0x793c('0x39')+_0x5ac02d+_0x793c('0xaa'),{'UserId':_0x13c9a4['id'],['queueField']:_0x296f92[_0x2eb01b]['id']});}});});});}});}})[_0x793c('0x1f')](respondWithStatusCode(_0x13cd61,null))[_0x793c('0x2a')](handleError(_0x13cd61,null));};exports[_0x793c('0x115')]=function(_0x534685,_0x33b67c){return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0x534685[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x33b67c,null))[_0x793c('0x1f')](function(_0x462bac){if(_0x462bac){var _0xbae0e1=_0x462bac[_0x793c('0x38')]({'plain':!![]});var _0x36082a=_0x534685[_0x793c('0x4d')][_0x793c('0x6b')];return _0x462bac[_0x793c('0x115')](_0x36082a)[_0x793c('0x1f')](function(){for(var _0xb0747b=0x0;_0xb0747b<_0x36082a[_0x793c('0x53')];_0xb0747b++){var _0x4a6a2e=[];db[_0x793c('0x104')][_0x793c('0x94')]({'where':{'id':_0x36082a[_0xb0747b]}})['then'](function(_0x28c701){_0x4a6a2e['push'](_0x28c701[_0x793c('0xe3')]()['then'](function(_0x57cb31){for(var _0x3de79f=0x0;_0x3de79f<_0x57cb31['length'];_0x3de79f++){_0x57cb31[_0x3de79f][_0x793c('0x109')](_0x793c('0x9e'),_0x793c('0x107'));}return _0x57cb31;}));_0x4a6a2e['push'](_0x28c701[_0x793c('0x108')]()[_0x793c('0x1f')](function(_0x1ce689){for(var _0x302764=0x0;_0x302764<_0x1ce689['length'];_0x302764++){_0x1ce689[_0x302764][_0x793c('0x109')](_0x793c('0x9e'),'Chat');}return _0x1ce689;}));_0x4a6a2e[_0x793c('0xac')](_0x28c701[_0x793c('0x116')]()[_0x793c('0x1f')](function(_0x25b749){for(var _0x2168fd=0x0;_0x2168fd<_0x25b749['length'];_0x2168fd++){_0x25b749[_0x2168fd][_0x793c('0x109')](_0x793c('0x9e'),_0x793c('0x10b'));}return _0x25b749;}));_0x4a6a2e[_0x793c('0xac')](_0x28c701['getSmsQueues']()[_0x793c('0x1f')](function(_0x3132a7){for(var _0x37c1e6=0x0;_0x37c1e6<_0x3132a7[_0x793c('0x53')];_0x37c1e6++){_0x3132a7[_0x37c1e6][_0x793c('0x109')](_0x793c('0x9e'),_0x793c('0x10c'));}return _0x3132a7;}));_0x4a6a2e[_0x793c('0xac')](_0x28c701[_0x793c('0x10d')]()[_0x793c('0x1f')](function(_0x143d18){for(var _0x44218f=0x0;_0x44218f<_0x143d18[_0x793c('0x53')];_0x44218f++){_0x143d18[_0x44218f]['setDataValue'](_0x793c('0x9e'),_0x793c('0x10e'));}return _0x143d18;}));_0x4a6a2e[_0x793c('0xac')](_0x28c701[_0x793c('0x10f')]()[_0x793c('0x1f')](function(_0x2fb4c8){for(var _0x53589c=0x0;_0x53589c<_0x2fb4c8['length'];_0x53589c++){_0x2fb4c8[_0x53589c][_0x793c('0x109')](_0x793c('0x9e'),'Fax');}return _0x2fb4c8;}));_0x4a6a2e[_0x793c('0xac')](_0x28c701[_0x793c('0x110')]()[_0x793c('0x1f')](function(_0x29b8f3){for(var _0x398631=0x0;_0x398631<_0x29b8f3['length'];_0x398631++){_0x29b8f3[_0x398631]['setDataValue'](_0x793c('0x9e'),_0x793c('0x117'));}return _0x29b8f3;}));return BPromise['all'](_0x4a6a2e);})[_0x793c('0x1f')](function(_0x221cb2){var _0x3fcd7e=_[_0x793c('0x118')](_0x221cb2);_0x4a6a2e=[];return db['sequelize']['transaction'](function(_0x5472a8){for(var _0x29e42b=0x0;_0x29e42b<_0x3fcd7e['length'];_0x29e42b++){_0x4a6a2e[_0x793c('0xac')](_0x3fcd7e[_0x29e42b]['removeAgent'](_0xbae0e1['id']),{'transaction':_0x5472a8});}return BPromise['all'](_0x4a6a2e)[_0x793c('0x1f')](function(){if(_0xbae0e1[_0x793c('0x9f')]){return BPromise[_0x793c('0xae')](_[_0x793c('0x5a')](_0x3fcd7e,function(_0x2d3feb){return _0x2d3feb[_0x793c('0x113')](_0x793c('0x9e'))===_0x793c('0x107');}),function(_0x5c639e){return db[_0x793c('0xaf')][_0x793c('0x43')]({'where':{'VoiceQueueId':_0x5c639e['id'],'UserId':_0xbae0e1['id']},'transaction':_0x5472a8});});}else{return;}})[_0x793c('0x1f')](function(){for(var _0x2eb13d=0x0;_0x2eb13d<_0x3fcd7e[_0x793c('0x53')];_0x2eb13d++){var _0x1eb5b1=_0x3fcd7e[_0x2eb13d][_0x793c('0x113')](_0x793c('0x9e'));var _0x3b8ca0=_0x1eb5b1+_0x793c('0xa8');socket[_0x793c('0xa9')]('user'+_0x1eb5b1+_0x793c('0xb2'),{'UserId':_0xbae0e1['id'],['queueField']:_0x3fcd7e[_0x2eb13d]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x33b67c,null))[_0x793c('0x2a')](handleError(_0x33b67c,null));};exports['getLists']=function(_0x5818e6,_0x213f7f,_0xfb7ca){var _0x1fee36={};var _0x44c71b={};var _0x5ce23d;var _0xb7beeb;return db['User'][_0x793c('0x94')]({'where':{'id':_0x5818e6[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x213f7f,null))[_0x793c('0x1f')](function(_0x48f6fa){if(_0x48f6fa){_0x5ce23d=_0x48f6fa;_0x44c71b[_0x793c('0x51')]=_['keys'](db[_0x793c('0xbf')][_0x793c('0x46')]);_0x44c71b[_0x793c('0x4d')]=_['keys'](_0x5818e6['query']);_0x44c71b['filters']=_[_0x793c('0x50')](_0x44c71b['model'],_0x44c71b['query']);_0x1fee36[_0x793c('0x4f')]=_[_0x793c('0x50')](_0x44c71b[_0x793c('0x51')],qs[_0x793c('0x52')](_0x5818e6[_0x793c('0x4d')]['fields']));_0x1fee36[_0x793c('0x4f')]=_0x1fee36[_0x793c('0x4f')][_0x793c('0x53')]?_0x1fee36[_0x793c('0x4f')]:_0x44c71b['model'];_0x1fee36[_0x793c('0x56')]=qs['sort'](_0x5818e6[_0x793c('0x4d')][_0x793c('0x57')]);_0x1fee36[_0x793c('0x58')]=qs[_0x793c('0x4e')](_['pick'](_0x5818e6[_0x793c('0x4d')],_0x44c71b[_0x793c('0x4e')]));if(_0x5818e6[_0x793c('0x4d')][_0x793c('0x5a')]){_0x1fee36[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x1fee36[_0x793c('0x58')],{'$or':_['map'](_0x1fee36[_0x793c('0x4f')],function(_0x20cd26){var _0x44956d={};_0x44956d[_0x20cd26]={'$like':'%'+_0x5818e6['query'][_0x793c('0x5a')]+'%'};return _0x44956d;})});}_0x1fee36=_[_0x793c('0x5b')]({},_0x1fee36,_0x5818e6['options']);return _0x5ce23d[_0x793c('0x119')](_0x1fee36);}})['then'](function(_0x5396c1){if(_0x5396c1){_0xb7beeb=_0x5396c1[_0x793c('0x53')];if(!_0x5818e6[_0x793c('0x4d')][_0x793c('0x54')](_0x793c('0x55'))){_0x1fee36[_0x793c('0x30')]=qs[_0x793c('0x30')](_0x5818e6[_0x793c('0x4d')][_0x793c('0x30')]);_0x1fee36[_0x793c('0x2f')]=qs['offset'](_0x5818e6[_0x793c('0x4d')]['offset']);}return _0x5ce23d[_0x793c('0x119')](_0x1fee36);}})[_0x793c('0x1f')](function(_0x1093cf){if(_0x1093cf){return _0x1093cf?{'count':_0xb7beeb,'rows':_0x1093cf}:null;}})[_0x793c('0x1f')](respondWithResult(_0x213f7f,null))[_0x793c('0x2a')](handleError(_0x213f7f,null));};exports[_0x793c('0x11a')]=function(_0xb5a87e,_0x58a71a,_0x18a163){var _0x184be1={};var _0x38c37d={};var _0xd432be;var _0x557d84;return db[_0x793c('0x45')][_0x793c('0x94')]({'where':{'id':_0xb5a87e[_0x793c('0x65')]['id']}})[_0x793c('0x1f')](handleEntityNotFound(_0x58a71a,null))[_0x793c('0x1f')](function(_0x182296){if(_0x182296){_0xd432be=_0x182296;_0x38c37d['model']=_[_0x793c('0x4c')](db[_0x793c('0x45')]['rawAttributes']);_0x38c37d[_0x793c('0x4d')]=_[_0x793c('0x4c')](_0xb5a87e[_0x793c('0x4d')]);_0x38c37d[_0x793c('0x4e')]=_['intersection'](_0x38c37d[_0x793c('0x51')],_0x38c37d[_0x793c('0x4d')]);_0x184be1['attributes']=_[_0x793c('0x50')](_0x38c37d[_0x793c('0x51')],qs['fields'](_0xb5a87e[_0x793c('0x4d')]['fields']));_0x184be1[_0x793c('0x4f')]=_0x184be1[_0x793c('0x4f')][_0x793c('0x53')]?_0x184be1['attributes']:_0x38c37d['model'];_0x184be1[_0x793c('0x56')]=qs[_0x793c('0x57')](_0xb5a87e[_0x793c('0x4d')]['sort']);_0x184be1['where']=qs[_0x793c('0x4e')](_[_0x793c('0x59')](_0xb5a87e[_0x793c('0x4d')],_0x38c37d['filters']));if(_0xb5a87e[_0x793c('0x4d')][_0x793c('0x5a')]){_0x184be1[_0x793c('0x58')]=_[_0x793c('0x5b')](_0x184be1['where'],{'$or':_[_0x793c('0x3e')](_0x184be1[_0x793c('0x4f')],function(_0x8178a8){var _0x1a2b3d={};_0x1a2b3d[_0x8178a8]={'$like':'%'+_0xb5a87e[_0x793c('0x4d')][_0x793c('0x5a')]+'%'};return _0x1a2b3d;})});}_0x184be1['model']=db[_0x793c('0x45')];_0x184be1['as']=_0x793c('0x8e');_0x184be1=_[_0x793c('0x5b')]({},_0x184be1,_0xb5a87e[_0x793c('0x60')]);return _0xd432be[_0x793c('0xe3')]({'include':[_0x184be1]});}})[_0x793c('0x1f')](function(_0x3bb8a6){if(_0x3bb8a6){var _0x548f3b={},_0x6e6576=[],_0x594ed5=0x0;for(var _0x18408f=0x0;_0x18408f<_0x3bb8a6[_0x793c('0x53')];_0x18408f+=0x1){for(var _0x49f97a=0x0,_0x50a8c4;_0x49f97a<_0x3bb8a6[_0x18408f][_0x793c('0x8e')][_0x793c('0x53')];_0x49f97a+=0x1){_0x50a8c4=_0x3bb8a6[_0x18408f]['Agents'][_0x49f97a][_0x793c('0x38')]({'plain':!![]});_0x548f3b[_0x50a8c4['id']]=_0x50a8c4;}}_0x548f3b=_['values'](_0x548f3b);for(var _0x655985=qs['offset'](_0xb5a87e[_0x793c('0x4d')][_0x793c('0x2f')]);_0x655985<_0x548f3b['length']&&_0x6e6576[_0x793c('0x53')]=_0x457f91['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x3237('0x10')](function(){if(_0x103443){return db[_0x3237('0x2b')][_0x3237('0x4b')]({'where':{'membername':_0x103443['name']},'individualHooks':!![]});}})['then'](function(){if(_0x103443){return _0x103443['getVoiceQueues']({'raw':!![]});}})[_0x3237('0x10')](function(_0x44681f){if(_0x103443){if(_0x44681f){var _0x38ae12=[];_0x3c6419=_0x44681f;if(_0x3c6419['length']){for(var _0x103549=0x0;_0x103549<_0x3c6419[_0x3237('0x30')];_0x103549++){_0x38ae12[_0x3237('0x33')](db[_0x3237('0x2b')][_0x3237('0x53')]({'membername':_0x103443['name'],'UserId':_0x103443['id'],'queue_name':_0x3c6419[_0x103549][_0x3237('0x28')],'VoiceQueueId':_0x3c6419[_0x103549]['id'],'interface':_0x583b95,'paused':_0x103443[_0x3237('0x54')]||![],'penalty':_0x3c6419[_0x103549][_0x3237('0x55')]||0x0}));}return BPromise[_0x3237('0x49')](_0x38ae12);}}}})[_0x3237('0x10')](function(){if(_0x103443){return db[_0x3237('0x2c')]['findAll']({'where':{'membername':_0x103443[_0x3237('0x28')],'exitAt':null}});}})[_0x3237('0x10')](function(_0x62323e){if(_0x103443){if(_0x62323e&&_0x62323e[_0x3237('0x30')]){var _0x3b5fda=[];_0x62323e[_0x3237('0x48')](function(_0x3fa3b0){_0x3b5fda['push'](_0x3fa3b0['update']({'exitAt':moment()[_0x3237('0x2e')](_0x3237('0x2f'))}));});return BPromise['all'](_0x3b5fda);}}})[_0x3237('0x10')](function(_0x31adfe){if(_0x103443){var _0x95ce39=[];var _0x1da394=[];var _0x357098=utils['getChannels']();var _0xeaf25c={'membername':_0x103443[_0x3237('0x28')],'interface':_0x583b95,'enterAt':moment()[_0x3237('0x2e')](_0x3237('0x2f')),'role':_0x103443['role'],'internal':_0x103443[_0x3237('0x29')]};_0x357098[_0x3237('0x48')](function(_0x3ae06f){_0x95ce39[_0x3237('0x33')](_['merge']({'channel':_0x3ae06f,'type':_0x3237('0x56'),'data1':_0x3237('0x57'),'data2':_0x583b95},_0xeaf25c));if(_0x103443['loginInPause']){_0x1da394[_0x3237('0x33')](_[_0x3237('0x58')]({'channel':_0x3ae06f,'type':_0x3237('0x3f'),'data1':_0x3237('0x59')},_0xeaf25c));}});return db[_0x3237('0x2c')]['bulkCreate'](_0x95ce39[_0x3237('0x5a')](_0x1da394),{'individualHooks':!![]});}})[_0x3237('0x10')](function(){if(_0x103443){return _0x103443['update']({'online':!![],'lastLoginAt':moment()[_0x3237('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x103443[_0x3237('0x54')]||![],'mailPause':_0x103443[_0x3237('0x54')]||![],'chatPause':_0x103443[_0x3237('0x54')]||![],'faxPause':_0x103443[_0x3237('0x54')]||![],'smsPause':_0x103443['loginInPause']||![],'openchannelPause':_0x103443['loginInPause']||![],'pauseType':_0x103443['loginInPause']?_0x3237('0x59'):null,'lastPauseAt':moment()['format'](_0x3237('0x2f')),'interface':_0x583b95});}})[_0x3237('0x10')](function(_0x1295b4){_0x482438(_0x1295b4);})['catch'](function(_0x30c9a6){_0x885126(_0x321465[_0x3237('0x15')](0x1f4,_0x30c9a6[_0x3237('0x17')]));});});}; \ No newline at end of file +var _0x930a=['getVoiceQueues','upsert','merge','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./user.socket','register','then','request\x20sent','debug','code','error','User,\x20%s,\x20%s','message','result','catch','GetUser','User','options','raw','where','attributes','limit','include','model','map','info','stringify','find','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','SIP/%s','type','DEFAULT\x20PAUSE','body','bulkCreate','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','set','%s%s','findAll','all','LogoutUser','destroy','length','forEach','LoginUser','mobile','phone','loginInPause','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0x930a,0x1bd));var _0xa930=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x930a[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xa930('0x0'));var util=require(_0xa930('0x1'));var moment=require(_0xa930('0x2'));var BPromise=require(_0xa930('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa930('0x4'));var db=require(_0xa930('0x5'))['db'];var utils=require(_0xa930('0x6'));var logger=require(_0xa930('0x7'))(_0xa930('0x8'));var config=require(_0xa930('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa930('0xa')]['http']({'port':0x232a});config[_0xa930('0xb')]=_[_0xa930('0xc')](config[_0xa930('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa930('0xd'))(new Redis(config[_0xa930('0xb')]));require(_0xa930('0xe'))[_0xa930('0xf')](socket);function respondWithRpcPromise(_0x359b6f,_0x31f146,_0x14ed10){return new BPromise(function(_0x37ef1b,_0x2a6f2d){return client['request'](_0x359b6f,_0x14ed10)[_0xa930('0x10')](function(_0x2c477e){logger['info']('User,\x20%s,\x20%s',_0x31f146,_0xa930('0x11'));logger[_0xa930('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x31f146,_0xa930('0x11'),JSON['stringify'](_0x2c477e));if(_0x2c477e['error']){if(_0x2c477e['error'][_0xa930('0x13')]===0x1f4){logger[_0xa930('0x14')](_0xa930('0x15'),_0x31f146,_0x2c477e[_0xa930('0x14')][_0xa930('0x16')]);return _0x2a6f2d(_0x2c477e[_0xa930('0x14')]['message']);}logger[_0xa930('0x14')](_0xa930('0x15'),_0x31f146,_0x2c477e[_0xa930('0x14')][_0xa930('0x16')]);return _0x37ef1b(_0x2c477e[_0xa930('0x14')][_0xa930('0x16')]);}else{logger['info']('User,\x20%s,\x20%s',_0x31f146,_0xa930('0x11'));_0x37ef1b(_0x2c477e[_0xa930('0x17')][_0xa930('0x16')]);}})[_0xa930('0x18')](function(_0x3fe4c5){logger[_0xa930('0x14')]('User,\x20%s,\x20%s',_0x31f146,_0x3fe4c5);_0x2a6f2d(_0x3fe4c5);});});}exports[_0xa930('0x19')]=function(_0x531ffb){var _0x33809e=this;return new Promise(function(_0x2fa03b,_0xae1e85){return db[_0xa930('0x1a')]['findAll']({'raw':_0x531ffb['options']?_0x531ffb[_0xa930('0x1b')][_0xa930('0x1c')]===undefined?!![]:![]:!![],'where':_0x531ffb[_0xa930('0x1b')]?_0x531ffb[_0xa930('0x1b')][_0xa930('0x1d')]||null:null,'attributes':_0x531ffb[_0xa930('0x1b')]?_0x531ffb['options'][_0xa930('0x1e')]||null:null,'limit':_0x531ffb['options']?_0x531ffb[_0xa930('0x1b')][_0xa930('0x1f')]||null:null,'include':_0x531ffb[_0xa930('0x1b')]?_0x531ffb[_0xa930('0x1b')][_0xa930('0x20')]?_['map'](_0x531ffb['options'][_0xa930('0x20')],function(_0x4f6458){return{'model':db[_0x4f6458[_0xa930('0x21')]],'as':_0x4f6458['as'],'attributes':_0x4f6458[_0xa930('0x1e')],'include':_0x4f6458[_0xa930('0x20')]?_['map'](_0x4f6458[_0xa930('0x20')],function(_0x1e2fa3){return{'model':db[_0x1e2fa3[_0xa930('0x21')]],'as':_0x1e2fa3['as'],'attributes':_0x1e2fa3[_0xa930('0x1e')],'include':_0x1e2fa3[_0xa930('0x20')]?_[_0xa930('0x22')](_0x1e2fa3[_0xa930('0x20')],function(_0x1dbf73){return{'model':db[_0x1dbf73[_0xa930('0x21')]],'as':_0x1dbf73['as'],'attributes':_0x1dbf73[_0xa930('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa930('0x10')](function(_0x14fcfa){logger[_0xa930('0x23')](_0xa930('0x19'),_0x531ffb);logger[_0xa930('0x12')](_0xa930('0x19'),_0x531ffb,JSON[_0xa930('0x24')](_0x14fcfa));_0x2fa03b(_0x14fcfa);})['catch'](function(_0x15e425){logger[_0xa930('0x14')]('GetUser',_0x15e425['message'],_0x531ffb);_0xae1e85(_0x33809e[_0xa930('0x14')](0x1f4,_0x15e425[_0xa930('0x16')]));});});};exports['ShowUser']=function(_0x311b46){var _0x831f5e=this;return new Promise(function(_0x295f75,_0x58caed){return db[_0xa930('0x1a')][_0xa930('0x25')]({'raw':_0x311b46['options']?_0x311b46['options'][_0xa930('0x1c')]===undefined?!![]:![]:!![],'where':_0x311b46[_0xa930('0x1b')]?_0x311b46[_0xa930('0x1b')][_0xa930('0x1d')]||null:null,'attributes':_0x311b46[_0xa930('0x1b')]?_0x311b46[_0xa930('0x1b')][_0xa930('0x1e')]||null:null,'include':_0x311b46[_0xa930('0x1b')]?_0x311b46['options']['include']?_[_0xa930('0x22')](_0x311b46[_0xa930('0x1b')][_0xa930('0x20')],function(_0x4fb4f7){return{'model':db[_0x4fb4f7[_0xa930('0x21')]],'as':_0x4fb4f7['as'],'attributes':_0x4fb4f7[_0xa930('0x1e')],'include':_0x4fb4f7['include']?_[_0xa930('0x22')](_0x4fb4f7[_0xa930('0x20')],function(_0x3a9829){return{'model':db[_0x3a9829[_0xa930('0x21')]],'as':_0x3a9829['as'],'attributes':_0x3a9829[_0xa930('0x1e')],'include':_0x3a9829['include']?_[_0xa930('0x22')](_0x3a9829[_0xa930('0x20')],function(_0x4336b2){return{'model':db[_0x4336b2[_0xa930('0x21')]],'as':_0x4336b2['as'],'attributes':_0x4336b2[_0xa930('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa930('0x10')](function(_0x1c285b){logger[_0xa930('0x23')](_0xa930('0x26'),_0x311b46);logger[_0xa930('0x12')](_0xa930('0x26'),_0x311b46,JSON[_0xa930('0x24')](_0x1c285b));_0x295f75(_0x1c285b);})[_0xa930('0x18')](function(_0x841bf1){logger[_0xa930('0x14')](_0xa930('0x26'),_0x841bf1[_0xa930('0x16')],_0x311b46);_0x58caed(_0x831f5e[_0xa930('0x14')](0x1f4,_0x841bf1['message']));});});};exports[_0xa930('0x27')]=function(_0x9a9897){var _0x5e1105=this;return new Promise(function(_0x3a6f00,_0x52f945){var _0x420165;return db['User'][_0xa930('0x25')]({'where':_0x9a9897[_0xa930('0x1b')][_0xa930('0x1d')]||{},'attributes':['id',_0xa930('0x28'),_0xa930('0x29'),_0xa930('0x2a'),_0xa930('0x2b')]})[_0xa930('0x10')](function(_0x5f4bc6){if(_0x5f4bc6){_0x420165=_0x5f4bc6;return db[_0xa930('0x2c')][_0xa930('0x2d')]({'paused':0x1},{'where':{'UserId':_0x420165['id']},'individualHooks':!![]});}})[_0xa930('0x10')](function(){if(_0x420165){return db[_0xa930('0x2e')]['findAll']({'where':{'membername':_0x420165[_0xa930('0x28')],'type':_0xa930('0x2f'),'exitAt':null}});}})[_0xa930('0x10')](function(_0x174de3){if(_0x420165){if(_0x174de3&&_0x174de3['length']){var _0x19fd35=moment()[_0xa930('0x30')](_0xa930('0x31'));for(var _0x3d552a=0x0,_0xb6ba33=_0x174de3['length'];_0x3d552a<_0xb6ba33;_0x3d552a++){_0x174de3[_0x3d552a]['updateAttributes']({'exitAt':_0x19fd35});}}}})[_0xa930('0x10')](function(){if(_0x420165){var _0x5d6b75=[];var _0x425103=utils[_0xa930('0x32')]();_0x425103['forEach'](function(_0x4a21c0){_0x5d6b75[_0xa930('0x33')]({'channel':_0x4a21c0,'membername':_0x420165[_0xa930('0x28')],'interface':_['isNil'](_0x420165[_0xa930('0x2b')])?util[_0xa930('0x30')](_0xa930('0x34'),_0x420165[_0xa930('0x28')]):_0x420165[_0xa930('0x2b')],'type':_0xa930('0x2f'),'enterAt':moment()[_0xa930('0x30')](_0xa930('0x31')),'data1':_0x9a9897['body'][_0xa930('0x35')]||_0xa930('0x36'),'role':_0x420165['role'],'internal':_0x420165[_0xa930('0x2a')],'uniqueid':_0x9a9897[_0xa930('0x37')]['uniqueid']||null});});return db['MemberReport'][_0xa930('0x38')](_0x5d6b75,{'individualHooks':!![]});}})[_0xa930('0x10')](function(){if(_0x420165){return _0x420165[_0xa930('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x9a9897[_0xa930('0x37')][_0xa930('0x35')]||_0xa930('0x36'),'lastPauseAt':moment()['format'](_0xa930('0x31'))});}})['then'](function(_0x134f6a){_0x3a6f00(_0x134f6a);})[_0xa930('0x18')](function(_0x97e6a8){_0x52f945(_0x5e1105[_0xa930('0x14')](0x1f4,_0x97e6a8[_0xa930('0x16')]));});});};exports[_0xa930('0x39')]=function(_0x70aec5){var _0x397179=this;return new Promise(function(_0x452a44,_0x1a6c94){var _0x3d8993;return db[_0xa930('0x1a')][_0xa930('0x3a')]({'where':_0x70aec5[_0xa930('0x1b')][_0xa930('0x1d')]||{},'attributes':['id',_0xa930('0x28')]})[_0xa930('0x10')](function(_0x369740){if(_0x369740){_0x3d8993=_0x369740;if(_0x70aec5['body'][_0xa930('0x3b')]&&!utils['isValidChannel'](_0x70aec5[_0xa930('0x37')]['channel'])){throw new Error(_0xa930('0x3c'));}switch(_0x70aec5[_0xa930('0x37')][_0xa930('0x3b')]){case _0xa930('0x3d'):return db[_0xa930('0x2c')][_0xa930('0x2d')]({'paused':0x0},{'where':{'UserId':_0x3d8993['id']}})[_0xa930('0x10')](function(){return db[_0xa930('0x2e')][_0xa930('0x25')]({'where':{'channel':_0x70aec5['body'][_0xa930('0x3b')],'membername':_0x3d8993['name'],'type':_0xa930('0x2f'),'exitAt':null}});})[_0xa930('0x10')](function(_0x5dc4d5){if(_0x5dc4d5){return _0x5dc4d5[_0xa930('0x2d')]({'exitAt':moment()[_0xa930('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xa930('0x3e')},{'individualHooks':!![]});}return null;})[_0xa930('0x10')](function(){return _0x3d8993['update']({'voicePause':![]});});case _0xa930('0x3f'):case _0xa930('0x40'):case _0xa930('0x41'):case _0xa930('0x42'):case _0xa930('0x43'):return db[_0xa930('0x2e')]['find']({'where':{'channel':_0x70aec5['body'][_0xa930('0x3b')],'membername':_0x3d8993[_0xa930('0x28')],'type':_0xa930('0x2f'),'exitAt':null}})[_0xa930('0x10')](function(_0x2ae20e){return _0x2ae20e['update']({'exitAt':moment()['format'](_0xa930('0x31')),'data2':'system'},{'individualHooks':!![]});})[_0xa930('0x10')](function(){var _0x5f7e30={};_[_0xa930('0x44')](_0x5f7e30,util[_0xa930('0x30')](_0xa930('0x45'),_0x70aec5['body'][_0xa930('0x3b')],'Pause'),![]);return _0x3d8993[_0xa930('0x2d')](_0x5f7e30);});default:return db[_0xa930('0x2c')][_0xa930('0x2d')]({'paused':0x0},{'where':{'UserId':_0x3d8993['id']}})[_0xa930('0x10')](function(){return db[_0xa930('0x2e')][_0xa930('0x46')]({'where':{'membername':_0x3d8993[_0xa930('0x28')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x70760d){var _0x5a676d=[];_0x70760d['forEach'](function(_0x1e13f4){_0x5a676d[_0xa930('0x33')](_0x1e13f4[_0xa930('0x2d')]({'exitAt':moment()[_0xa930('0x30')](_0xa930('0x31')),'data2':_0xa930('0x3e')}));});return BPromise[_0xa930('0x47')](_0x5a676d);})[_0xa930('0x10')](function(){return _0x3d8993[_0xa930('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xa930('0x10')](function(_0x1390e3){_0x452a44(_0x1390e3);})['catch'](function(_0x38aed1){_0x1a6c94(_0x397179['error'](0x1f4,_0x38aed1[_0xa930('0x16')]));});});};exports[_0xa930('0x48')]=function(_0x269327){var _0x56233b=this;return new Promise(function(_0x34ff7d,_0xff633b){var _0x5755c4;return db[_0xa930('0x1a')][_0xa930('0x3a')]({'where':_0x269327[_0xa930('0x1b')][_0xa930('0x1d')]||{},'attributes':['id','name']})[_0xa930('0x10')](function(_0x4b59d6){if(_0x4b59d6){_0x5755c4=_0x4b59d6;return db[_0xa930('0x2c')][_0xa930('0x49')]({'where':{'membername':_0x5755c4['name']},'individualHooks':!![]});}})[_0xa930('0x10')](function(){if(_0x5755c4){return db[_0xa930('0x2e')][_0xa930('0x46')]({'where':{'membername':_0x5755c4[_0xa930('0x28')],'exitAt':null}});}})[_0xa930('0x10')](function(_0x2d8fac){if(_0x5755c4){if(_0x2d8fac&&_0x2d8fac[_0xa930('0x4a')]){var _0x120bbc=[];_0x2d8fac[_0xa930('0x4b')](function(_0x501b91){_0x120bbc[_0xa930('0x33')](_0x501b91['update']({'exitAt':moment()[_0xa930('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa930('0x47')](_0x120bbc);}}})['then'](function(){if(_0x5755c4){return _0x5755c4['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa930('0x10')](function(_0x16abbb){_0x34ff7d(_0x16abbb);})[_0xa930('0x18')](function(_0x57f2fb){_0xff633b(_0x56233b['error'](0x1f4,_0x57f2fb[_0xa930('0x16')]));});});};exports[_0xa930('0x4c')]=function(_0x39fe86){var _0x5b3381=this;return new Promise(function(_0x20ccba,_0x5d3bda){var _0x480d7e;var _0x5f3e24;var _0x540573;var _0x2ba686;return db['User']['findOne']({'where':_0x39fe86[_0xa930('0x1b')][_0xa930('0x1d')]||{},'attributes':['id',_0xa930('0x28'),'role',_0xa930('0x4d'),_0xa930('0x4e'),_0xa930('0x2a'),_0xa930('0x4f'),_0xa930('0x2b')]})[_0xa930('0x10')](function(_0x516478){if(_0x516478){_0x480d7e=_0x516478;_0x2ba686=_0x39fe86[_0xa930('0x37')][_0xa930('0x2b')]?_0x39fe86['body'][_0xa930('0x2b')]:util['format'](_0xa930('0x34'),_0x480d7e[_0xa930('0x28')]);return db[_0xa930('0x1a')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x480d7e['id']}}});}})[_0xa930('0x10')](function(_0x11c524){if(_0x11c524){_0x540573=_0x11c524;return require('../../config/license/util')[_0xa930('0x50')]();}})[_0xa930('0x10')](function(_0xe2259d){if(_0xe2259d&&_0xe2259d[_0xa930('0x51')]&&_0x540573>=_0xe2259d[_0xa930('0x51')]){throw new Error(_0xa930('0x52'));}})['then'](function(){if(_0x480d7e){return db[_0xa930('0x2c')]['destroy']({'where':{'membername':_0x480d7e[_0xa930('0x28')]},'individualHooks':!![]});}})[_0xa930('0x10')](function(){if(_0x480d7e){return _0x480d7e[_0xa930('0x53')]({'raw':!![]});}})[_0xa930('0x10')](function(_0x2027df){if(_0x480d7e){if(_0x2027df){var _0xb73daf=[];_0x5f3e24=_0x2027df;if(_0x5f3e24['length']){for(var _0x11495d=0x0;_0x11495d<_0x5f3e24[_0xa930('0x4a')];_0x11495d++){_0xb73daf[_0xa930('0x33')](db[_0xa930('0x2c')][_0xa930('0x54')]({'membername':_0x480d7e[_0xa930('0x28')],'UserId':_0x480d7e['id'],'queue_name':_0x5f3e24[_0x11495d]['name'],'VoiceQueueId':_0x5f3e24[_0x11495d]['id'],'interface':_0x2ba686,'paused':_0x480d7e[_0xa930('0x4f')]||![],'penalty':_0x5f3e24[_0x11495d]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0xb73daf);}}}})[_0xa930('0x10')](function(){if(_0x480d7e){return db[_0xa930('0x2e')][_0xa930('0x46')]({'where':{'membername':_0x480d7e[_0xa930('0x28')],'exitAt':null}});}})['then'](function(_0xeeb54e){if(_0x480d7e){if(_0xeeb54e&&_0xeeb54e['length']){var _0x27525f=[];_0xeeb54e['forEach'](function(_0x440dd0){_0x27525f[_0xa930('0x33')](_0x440dd0[_0xa930('0x2d')]({'exitAt':moment()[_0xa930('0x30')](_0xa930('0x31'))}));});return BPromise[_0xa930('0x47')](_0x27525f);}}})[_0xa930('0x10')](function(_0x3f014b){if(_0x480d7e){var _0x207748=[];var _0x5e9ba3=[];var _0x23193a=utils['getChannels']();var _0x5b810f={'membername':_0x480d7e[_0xa930('0x28')],'interface':_0x2ba686,'enterAt':moment()[_0xa930('0x30')](_0xa930('0x31')),'role':_0x480d7e[_0xa930('0x29')],'internal':_0x480d7e['internal']};_0x23193a[_0xa930('0x4b')](function(_0x2a354f){_0x207748['push'](_[_0xa930('0x55')]({'channel':_0x2a354f,'type':'LOGIN','data1':_0xa930('0x56'),'data2':_0x2ba686},_0x5b810f));if(_0x480d7e['loginInPause']){_0x5e9ba3['push'](_[_0xa930('0x55')]({'channel':_0x2a354f,'type':_0xa930('0x2f'),'data1':_0xa930('0x57')},_0x5b810f));}});return db[_0xa930('0x2e')][_0xa930('0x38')](_0x207748['concat'](_0x5e9ba3),{'individualHooks':!![]});}})['then'](function(){if(_0x480d7e){return _0x480d7e[_0xa930('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xa930('0x30')](_0xa930('0x31')),'voicePause':_0x480d7e[_0xa930('0x4f')]||![],'mailPause':_0x480d7e[_0xa930('0x4f')]||![],'chatPause':_0x480d7e['loginInPause']||![],'faxPause':_0x480d7e[_0xa930('0x4f')]||![],'smsPause':_0x480d7e[_0xa930('0x4f')]||![],'openchannelPause':_0x480d7e[_0xa930('0x4f')]||![],'pauseType':_0x480d7e[_0xa930('0x4f')]?_0xa930('0x57'):null,'lastPauseAt':moment()[_0xa930('0x30')](_0xa930('0x31')),'interface':_0x2ba686});}})[_0xa930('0x10')](function(_0x2291af){_0x20ccba(_0x2291af);})[_0xa930('0x18')](function(_0x1988cd){_0x5d3bda(_0x5b3381['error'](0x1f4,_0x1988cd[_0xa930('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d58b53b..83e8db7 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 _0xcfcc=['remove','update','emit','removeListener','register','length','save'];(function(_0x333eba,_0x180c4e){var _0x29b4ed=function(_0x6ef490){while(--_0x6ef490){_0x333eba['push'](_0x333eba['shift']());}};_0x29b4ed(++_0x180c4e);}(_0xcfcc,0x8b));var _0xccfc=function(_0x3dc26a,_0x1f9069){_0x3dc26a=_0x3dc26a-0x0;var _0x5356bc=_0xcfcc[_0x3dc26a];return _0x5356bc;};'use strict';var UserEvents=require('./user.events');var events=[_0xccfc('0x0'),_0xccfc('0x1'),_0xccfc('0x2')];function createListener(_0x1b14ae,_0xf47010){return function(_0x76e163){_0xf47010[_0xccfc('0x3')](_0x1b14ae,_0x76e163);};}function removeListener(_0x46b31a,_0x477c5e){return function(){UserEvents[_0xccfc('0x4')](_0x46b31a,_0x477c5e);};}exports[_0xccfc('0x5')]=function(_0x2f8294){for(var _0x4151de=0x0,_0x276315=events[_0xccfc('0x6')];_0x4151de<_0x276315;_0x4151de++){var _0x40cb8a=events[_0x4151de];var _0x437c01=createListener('user:'+_0x40cb8a,_0x2f8294);UserEvents['on'](_0x40cb8a,_0x437c01);}}; \ No newline at end of file +var _0x284a=['remove','update','emit','register','length','user:','./user.events','save'];(function(_0x3f154a,_0x1b907f){var _0x5bda54=function(_0x3de669){while(--_0x3de669){_0x3f154a['push'](_0x3f154a['shift']());}};_0x5bda54(++_0x1b907f);}(_0x284a,0xd6));var _0xa284=function(_0x2dd49d,_0x3e77e6){_0x2dd49d=_0x2dd49d-0x0;var _0x325430=_0x284a[_0x2dd49d];return _0x325430;};'use strict';var UserEvents=require(_0xa284('0x0'));var events=[_0xa284('0x1'),_0xa284('0x2'),_0xa284('0x3')];function createListener(_0x5a8bbc,_0x1f2bea){return function(_0x27c6fb){_0x1f2bea[_0xa284('0x4')](_0x5a8bbc,_0x27c6fb);};}function removeListener(_0x143847,_0x1e8564){return function(){UserEvents['removeListener'](_0x143847,_0x1e8564);};}exports[_0xa284('0x5')]=function(_0x330220){for(var _0x56a82c=0x0,_0x2b764f=events[_0xa284('0x6')];_0x56a82c<_0x2b764f;_0x56a82c++){var _0x4a8e54=events[_0x56a82c];var _0x120af9=createListener(_0xa284('0x7')+_0x4a8e54,_0x330220);UserEvents['on'](_0x4a8e54,_0x120af9);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c5b142c..33d7046 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 _0x93ff=['exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4c61a1,_0x8c62ef){var _0x594b8e=function(_0x12c576){while(--_0x12c576){_0x4c61a1['push'](_0x4c61a1['shift']());}};_0x594b8e(++_0x8c62ef);}(_0x93ff,0x133));var _0xf93f=function(_0x5e13fe,_0x339218){_0x5e13fe=_0x5e13fe-0x0;var _0x26f143=_0x93ff[_0x5e13fe];return _0x26f143;};'use strict';var multer=require(_0xf93f('0x0'));var util=require(_0xf93f('0x1'));var path=require(_0xf93f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf93f('0x3')]();var auth=require(_0xf93f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xf93f('0x5')]=router; \ No newline at end of file +var _0xd88d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd88d,0xb6));var _0xdd88=function(_0x17b1b8,_0x50ccdc){_0x17b1b8=_0x17b1b8-0x0;var _0x5a0d50=_0xd88d[_0x17b1b8];return _0x5a0d50;};'use strict';var multer=require(_0xdd88('0x0'));var util=require('util');var path=require(_0xdd88('0x1'));var timeout=require(_0xdd88('0x2'));var express=require(_0xdd88('0x3'));var router=express[_0xdd88('0x4')]();var auth=require(_0xdd88('0x5'));var interaction=require(_0xdd88('0x6'));var config=require('../../config/environment');module[_0xdd88('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d34703a..6bd82f8 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x406fe7,_0xa3f94b){var _0x4882cd=function(_0xbf748d){while(--_0xbf748d){_0x406fe7['push'](_0x406fe7['shift']());}};_0x4882cd(++_0xa3f94b);}(_0xe706,0xa3));var _0x6e70=function(_0x1633a0,_0x3cdfc1){_0x1633a0=_0x1633a0-0x0;var _0x523846=_0xe706[_0x1633a0];return _0x523846;};'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 1829fc5..4fe1bb3 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 _0x5aa9=['bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','util','../../config/logger','moment'];(function(_0xc7deb7,_0x14acfb){var _0x3e6946=function(_0x3ca4c6){while(--_0x3ca4c6){_0xc7deb7['push'](_0xc7deb7['shift']());}};_0x3e6946(++_0x14acfb);}(_0x5aa9,0x1b4));var _0x95aa=function(_0x6cdf8f,_0x14f16a){_0x6cdf8f=_0x6cdf8f-0x0;var _0x34dec3=_0x5aa9[_0x6cdf8f];return _0x34dec3;};'use strict';var _=require(_0x95aa('0x0'));var util=require(_0x95aa('0x1'));var logger=require(_0x95aa('0x2'))('api');var moment=require(_0x95aa('0x3'));var BPromise=require(_0x95aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95aa('0x5'));var rimraf=require(_0x95aa('0x6'));var config=require(_0x95aa('0x7'));var attributes=require(_0x95aa('0x8'));module['exports']=function(_0x40a46f,_0x5904b2){return _0x40a46f[_0x95aa('0x9')](_0x95aa('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbc3=['./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4e58f9,_0x2e60fa){var _0x4445f5=function(_0x89abb0){while(--_0x89abb0){_0x4e58f9['push'](_0x4e58f9['shift']());}};_0x4445f5(++_0x2e60fa);}(_0xdbc3,0x112));var _0x3dbc=function(_0x23a1f4,_0x349300){_0x23a1f4=_0x23a1f4-0x0;var _0x36cc29=_0xdbc3[_0x23a1f4];return _0x36cc29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3dbc('0x0'))(_0x3dbc('0x1'));var moment=require('moment');var BPromise=require(_0x3dbc('0x2'));var rp=require(_0x3dbc('0x3'));var fs=require('fs');var path=require(_0x3dbc('0x4'));var rimraf=require(_0x3dbc('0x5'));var config=require('../../config/environment');var attributes=require(_0x3dbc('0x6'));module['exports']=function(_0x1c9d75,_0x5545a5){return _0x1c9d75[_0x3dbc('0x7')](_0x3dbc('0x8'),attributes,{'tableName':_0x3dbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 278eef9..eccbbd7 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 _0x096c=['then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x096c,0xff));var _0xc096=function(_0x38a4dd,_0x12d247){_0x38a4dd=_0x38a4dd-0x0;var _0x40d8b8=_0x096c[_0x38a4dd];return _0x40d8b8;};'use strict';var _=require('lodash');var util=require(_0xc096('0x0'));var moment=require(_0xc096('0x1'));var BPromise=require(_0xc096('0x2'));var rs=require(_0xc096('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc096('0x4'))['db'];var utils=require(_0xc096('0x5'));var logger=require(_0xc096('0x6'))(_0xc096('0x7'));var config=require(_0xc096('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc096('0x9')][_0xc096('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ed1,_0x37a010,_0x32b789){return new BPromise(function(_0x558edb,_0x121553){return client['request'](_0x4a6ed1,_0x32b789)[_0xc096('0xb')](function(_0x3b6440){logger['info'](_0xc096('0xc'),_0x37a010,_0xc096('0xd'));logger[_0xc096('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x37a010,_0xc096('0xd'),JSON[_0xc096('0xf')](_0x3b6440));if(_0x3b6440[_0xc096('0x10')]){if(_0x3b6440[_0xc096('0x10')][_0xc096('0x11')]===0x1f4){logger['error'](_0xc096('0xc'),_0x37a010,_0x3b6440[_0xc096('0x10')][_0xc096('0x12')]);return _0x121553(_0x3b6440[_0xc096('0x10')][_0xc096('0x12')]);}logger[_0xc096('0x10')](_0xc096('0xc'),_0x37a010,_0x3b6440['error'][_0xc096('0x12')]);return _0x558edb(_0x3b6440[_0xc096('0x10')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x37a010,'request\x20sent');_0x558edb(_0x3b6440['result'][_0xc096('0x12')]);}})['catch'](function(_0x2d49f4){logger['error'](_0xc096('0xc'),_0x37a010,_0x2d49f4);_0x121553(_0x2d49f4);});});} \ No newline at end of file +var _0x1c99=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0x1c2517,_0x10e32f){var _0x556787=function(_0x4c9465){while(--_0x4c9465){_0x1c2517['push'](_0x1c2517['shift']());}};_0x556787(++_0x10e32f);}(_0x1c99,0x19f));var _0x91c9=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x1c99[_0x506d2f];return _0x101255;};'use strict';var _=require(_0x91c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x91c9('0x1'));var rs=require(_0x91c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91c9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x91c9('0x4'))(_0x91c9('0x5'));var config=require('../../config/environment');var jayson=require(_0x91c9('0x6'));var client=jayson[_0x91c9('0x7')][_0x91c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40479b,_0x54dc4c,_0x304f5e){return new BPromise(function(_0x39d280,_0x35fb74){return client['request'](_0x40479b,_0x304f5e)['then'](function(_0x52b6b7){logger[_0x91c9('0x9')](_0x91c9('0xa'),_0x54dc4c,_0x91c9('0xb'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x54dc4c,'request\x20sent',JSON['stringify'](_0x52b6b7));if(_0x52b6b7[_0x91c9('0xc')]){if(_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xd')]===0x1f4){logger[_0x91c9('0xc')](_0x91c9('0xa'),_0x54dc4c,_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xe')]);return _0x35fb74(_0x52b6b7[_0x91c9('0xc')]['message']);}logger[_0x91c9('0xc')](_0x91c9('0xa'),_0x54dc4c,_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xe')]);return _0x39d280(_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xe')]);}else{logger[_0x91c9('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x54dc4c,_0x91c9('0xb'));_0x39d280(_0x52b6b7['result'][_0x91c9('0xe')]);}})[_0x91c9('0xf')](function(_0x528067){logger[_0x91c9('0xc')](_0x91c9('0xa'),_0x54dc4c,_0x528067);_0x35fb74(_0x528067);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e8f094c..c9839d1 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 _0x0b1a=['../../components/interaction/service','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2b8e2f,_0x998a4a){var _0x1ab69f=function(_0x73d264){while(--_0x73d264){_0x2b8e2f['push'](_0x2b8e2f['shift']());}};_0x1ab69f(++_0x998a4a);}(_0x0b1a,0x132));var _0xa0b1=function(_0x237ba5,_0xf18cee){_0x237ba5=_0x237ba5-0x0;var _0x3ca94d=_0x0b1a[_0x237ba5];return _0x3ca94d;};'use strict';var multer=require('multer');var util=require(_0xa0b1('0x0'));var path=require(_0xa0b1('0x1'));var timeout=require(_0xa0b1('0x2'));var express=require(_0xa0b1('0x3'));var router=express[_0xa0b1('0x4')]();var auth=require(_0xa0b1('0x5'));var interaction=require(_0xa0b1('0x6'));var config=require('../../config/environment');module[_0xa0b1('0x7')]=router; \ No newline at end of file +var _0x0687=['path','connect-timeout','express','../../components/interaction/service','exports','multer','util'];(function(_0x527914,_0x53a670){var _0x4a9b4e=function(_0x55e371){while(--_0x55e371){_0x527914['push'](_0x527914['shift']());}};_0x4a9b4e(++_0x53a670);}(_0x0687,0x101));var _0x7068=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0687[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7068('0x0'));var util=require(_0x7068('0x1'));var path=require(_0x7068('0x2'));var timeout=require(_0x7068('0x3'));var express=require(_0x7068('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7068('0x5'));var config=require('../../config/environment');module[_0x7068('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 62b17b5..f95bdba 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 _0x8603=['exports','INTEGER'];(function(_0x2a146d,_0x582664){var _0x721361=function(_0x5df666){while(--_0x5df666){_0x2a146d['push'](_0x2a146d['shift']());}};_0x721361(++_0x582664);}(_0x8603,0x190));var _0x3860=function(_0x1ea8c0,_0x1b1409){_0x1ea8c0=_0x1ea8c0-0x0;var _0x2314ce=_0x8603[_0x1ea8c0];return _0x2314ce;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'penalty':{'type':Sequelize[_0x3860('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3860('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda2d=['exports','INTEGER','STRING'];(function(_0x3d2c55,_0x2a31a0){var _0x41e741=function(_0x30f772){while(--_0x30f772){_0x3d2c55['push'](_0x3d2c55['shift']());}};_0x41e741(++_0x2a31a0);}(_0xda2d,0x102));var _0xdda2=function(_0x394a6e,_0x41ee56){_0x394a6e=_0x394a6e-0x0;var _0x391a68=_0xda2d[_0x394a6e];return _0x391a68;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'penalty':{'type':Sequelize[_0xdda2('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdda2('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xdda2('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 897f738..7648dc2 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 _0xd8b0=['define','user_has_fax_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53a35c,_0x3dcc7a){var _0x37d699=function(_0x3a477f){while(--_0x3a477f){_0x53a35c['push'](_0x53a35c['shift']());}};_0x37d699(++_0x3dcc7a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserFaxQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x4fbaf9,_0x3b8190){var _0x1d89a0=function(_0x3b650b){while(--_0x3b650b){_0x4fbaf9['push'](_0x4fbaf9['shift']());}};_0x1d89a0(++_0x3b8190);}(_0xb10b,0x12a));var _0xbb10=function(_0x36ca7f,_0x337025){_0x36ca7f=_0x36ca7f-0x0;var _0x1dedcd=_0xb10b[_0x36ca7f];return _0x1dedcd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index dd25aec..8d35c4d 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 _0x2d8e=['info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0xa72cf,_0x24a05c){var _0x263735=function(_0x21b2ae){while(--_0x21b2ae){_0xa72cf['push'](_0xa72cf['shift']());}};_0x263735(++_0x24a05c);}(_0x2d8e,0x17a));var _0xe2d8=function(_0x429370,_0x46ff4c){_0x429370=_0x429370-0x0;var _0x41a3ad=_0x2d8e[_0x429370];return _0x41a3ad;};'use strict';var _=require(_0xe2d8('0x0'));var util=require(_0xe2d8('0x1'));var moment=require(_0xe2d8('0x2'));var BPromise=require(_0xe2d8('0x3'));var rs=require(_0xe2d8('0x4'));var fs=require('fs');var Redis=require(_0xe2d8('0x5'));var db=require(_0xe2d8('0x6'))['db'];var utils=require(_0xe2d8('0x7'));var logger=require(_0xe2d8('0x8'))('rpc');var config=require(_0xe2d8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe2d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eaa11,_0x30b8e8,_0xa54798){return new BPromise(function(_0xdd1a00,_0x54bad0){return client[_0xe2d8('0xb')](_0x3eaa11,_0xa54798)[_0xe2d8('0xc')](function(_0x3c47d0){logger[_0xe2d8('0xd')](_0xe2d8('0xe'),_0x30b8e8,'request\x20sent');logger[_0xe2d8('0xf')](_0xe2d8('0x10'),_0x30b8e8,_0xe2d8('0x11'),JSON[_0xe2d8('0x12')](_0x3c47d0));if(_0x3c47d0[_0xe2d8('0x13')]){if(_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x14')]===0x1f4){logger[_0xe2d8('0x13')](_0xe2d8('0xe'),_0x30b8e8,_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);return _0x54bad0(_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);}logger[_0xe2d8('0x13')](_0xe2d8('0xe'),_0x30b8e8,_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);return _0xdd1a00(_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);}else{logger[_0xe2d8('0xd')](_0xe2d8('0xe'),_0x30b8e8,_0xe2d8('0x11'));_0xdd1a00(_0x3c47d0['result']['message']);}})[_0xe2d8('0x16')](function(_0x38747c){logger[_0xe2d8('0x13')](_0xe2d8('0xe'),_0x30b8e8,_0x38747c);_0x54bad0(_0x38747c);});});} \ No newline at end of file +var _0x82d6=['http','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UserFaxQueue,\x20%s,\x20%s','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x48eb60,_0x45ccd1){var _0x1b8656=function(_0x2e51e8){while(--_0x2e51e8){_0x48eb60['push'](_0x48eb60['shift']());}};_0x1b8656(++_0x45ccd1);}(_0x82d6,0x9e));var _0x682d=function(_0x33e4c5,_0x18c7cc){_0x33e4c5=_0x33e4c5-0x0;var _0x262c23=_0x82d6[_0x33e4c5];return _0x262c23;};'use strict';var _=require(_0x682d('0x0'));var util=require(_0x682d('0x1'));var moment=require('moment');var BPromise=require(_0x682d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x682d('0x3'))['db'];var utils=require(_0x682d('0x4'));var logger=require(_0x682d('0x5'))(_0x682d('0x6'));var config=require(_0x682d('0x7'));var jayson=require(_0x682d('0x8'));var client=jayson[_0x682d('0x9')][_0x682d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x135dd0,_0x3da4c3,_0x21f1fd){return new BPromise(function(_0x3da7c0,_0x150f30){return client['request'](_0x135dd0,_0x21f1fd)[_0x682d('0xb')](function(_0x4fc8a8){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x3da4c3,_0x682d('0xc'));logger[_0x682d('0xd')](_0x682d('0xe'),_0x3da4c3,_0x682d('0xc'),JSON['stringify'](_0x4fc8a8));if(_0x4fc8a8[_0x682d('0xf')]){if(_0x4fc8a8[_0x682d('0xf')][_0x682d('0x10')]===0x1f4){logger[_0x682d('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x3da4c3,_0x4fc8a8[_0x682d('0xf')]['message']);return _0x150f30(_0x4fc8a8[_0x682d('0xf')][_0x682d('0x11')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3da4c3,_0x4fc8a8[_0x682d('0xf')][_0x682d('0x11')]);return _0x3da7c0(_0x4fc8a8[_0x682d('0xf')][_0x682d('0x11')]);}else{logger[_0x682d('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x3da4c3,_0x682d('0xc'));_0x3da7c0(_0x4fc8a8[_0x682d('0x13')][_0x682d('0x11')]);}})['catch'](function(_0xe09656){logger['error'](_0x682d('0x14'),_0x3da4c3,_0xe09656);_0x150f30(_0xe09656);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 3eedfe4..432cea0 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 _0x8b55=['connect-timeout','Router','../../components/auth/service','../../config/environment','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b55,0x154));var _0x58b5=function(_0x4aa902,_0xc6d1b4){_0x4aa902=_0x4aa902-0x0;var _0x2ec26f=_0x8b55[_0x4aa902];return _0x2ec26f;};'use strict';var multer=require(_0x58b5('0x0'));var util=require(_0x58b5('0x1'));var path=require(_0x58b5('0x2'));var timeout=require(_0x58b5('0x3'));var express=require('express');var router=express[_0x58b5('0x4')]();var auth=require(_0x58b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x58b5('0x6'));module['exports']=router; \ No newline at end of file +var _0x0e2f=['Router','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0xd03ca,_0x103f44){var _0x26e9f2=function(_0x3d8a1c){while(--_0x3d8a1c){_0xd03ca['push'](_0xd03ca['shift']());}};_0x26e9f2(++_0x103f44);}(_0x0e2f,0xcb));var _0xf0e2=function(_0x5a4efd,_0x325bad){_0x5a4efd=_0x5a4efd-0x0;var _0x3ae398=_0x0e2f[_0x5a4efd];return _0x3ae398;};'use strict';var multer=require(_0xf0e2('0x0'));var util=require(_0xf0e2('0x1'));var path=require(_0xf0e2('0x2'));var timeout=require(_0xf0e2('0x3'));var express=require(_0xf0e2('0x4'));var router=express[_0xf0e2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf0e2('0x6'));module[_0xf0e2('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2b00fb0..bffeb86 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4a6dd2,_0xfb5f96){var _0x5a51f7=function(_0x4ab679){while(--_0x4ab679){_0x4a6dd2['push'](_0x4a6dd2['shift']());}};_0x5a51f7(++_0xfb5f96);}(_0xe706,0xa3));var _0x6e70=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xe706[_0x1d7037];return _0x4d6568;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xad57c9,_0x4472df){var _0x455ddc=function(_0x9a99dc){while(--_0x9a99dc){_0xad57c9['push'](_0xad57c9['shift']());}};_0x455ddc(++_0x4472df);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 30477d4..7e6635b 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(_0x2d3635,_0x31c669){var _0x3ab168=function(_0x219890){while(--_0x219890){_0x2d3635['push'](_0x2d3635['shift']());}};_0x3ab168(++_0x31c669);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x1b6b96,_0x4c2910){var _0x55111a=function(_0x263c7b){while(--_0x263c7b){_0x1b6b96['push'](_0x1b6b96['shift']());}};_0x55111a(++_0x4c2910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 6176bdb..b5c78a1 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 _0x35f5=['ioredis','rpc','../../config/environment','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x4d692a,_0x5c1506){var _0x9ef565=function(_0x2e17c8){while(--_0x2e17c8){_0x4d692a['push'](_0x4d692a['shift']());}};_0x9ef565(++_0x5c1506);}(_0x35f5,0x100));var _0x535f=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x35f5[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x535f('0x0'));var util=require('util');var moment=require(_0x535f('0x1'));var BPromise=require(_0x535f('0x2'));var rs=require(_0x535f('0x3'));var fs=require('fs');var Redis=require(_0x535f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x535f('0x5'));var config=require(_0x535f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x535f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a137,_0x14c55b,_0x4b3440){return new BPromise(function(_0x30802d,_0x4cc7b6){return client[_0x535f('0x8')](_0x24a137,_0x4b3440)[_0x535f('0x9')](function(_0x41e216){logger[_0x535f('0xa')](_0x535f('0xb'),_0x14c55b,_0x535f('0xc'));logger[_0x535f('0xd')](_0x535f('0xe'),_0x14c55b,'request\x20sent',JSON[_0x535f('0xf')](_0x41e216));if(_0x41e216[_0x535f('0x10')]){if(_0x41e216[_0x535f('0x10')][_0x535f('0x11')]===0x1f4){logger[_0x535f('0x10')](_0x535f('0xb'),_0x14c55b,_0x41e216['error'][_0x535f('0x12')]);return _0x4cc7b6(_0x41e216['error']['message']);}logger[_0x535f('0x10')](_0x535f('0xb'),_0x14c55b,_0x41e216[_0x535f('0x10')]['message']);return _0x30802d(_0x41e216['error'][_0x535f('0x12')]);}else{logger['info'](_0x535f('0xb'),_0x14c55b,_0x535f('0xc'));_0x30802d(_0x41e216['result']['message']);}})[_0x535f('0x13')](function(_0x571289){logger[_0x535f('0x10')](_0x535f('0xb'),_0x14c55b,_0x571289);_0x4cc7b6(_0x571289);});});} \ No newline at end of file +var _0x4e06=['stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x4e06,0x1d2));var _0x64e0=function(_0x1ed78f,_0x5ab61b){_0x1ed78f=_0x1ed78f-0x0;var _0x46f620=_0x4e06[_0x1ed78f];return _0x46f620;};'use strict';var _=require(_0x64e0('0x0'));var util=require(_0x64e0('0x1'));var moment=require(_0x64e0('0x2'));var BPromise=require(_0x64e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64e0('0x4'));var db=require(_0x64e0('0x5'))['db'];var utils=require(_0x64e0('0x6'));var logger=require(_0x64e0('0x7'))(_0x64e0('0x8'));var config=require('../../config/environment');var jayson=require(_0x64e0('0x9'));var client=jayson[_0x64e0('0xa')][_0x64e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x63dbec,_0x32b867,_0x12cd81){return new BPromise(function(_0x1f197b,_0x191e5d){return client[_0x64e0('0xc')](_0x63dbec,_0x12cd81)[_0x64e0('0xd')](function(_0xc6ad41){logger[_0x64e0('0xe')](_0x64e0('0xf'),_0x32b867,_0x64e0('0x10'));logger[_0x64e0('0x11')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x32b867,_0x64e0('0x10'),JSON[_0x64e0('0x12')](_0xc6ad41));if(_0xc6ad41[_0x64e0('0x13')]){if(_0xc6ad41[_0x64e0('0x13')]['code']===0x1f4){logger[_0x64e0('0x13')](_0x64e0('0xf'),_0x32b867,_0xc6ad41[_0x64e0('0x13')][_0x64e0('0x14')]);return _0x191e5d(_0xc6ad41[_0x64e0('0x13')][_0x64e0('0x14')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x32b867,_0xc6ad41[_0x64e0('0x13')][_0x64e0('0x14')]);return _0x1f197b(_0xc6ad41[_0x64e0('0x13')][_0x64e0('0x14')]);}else{logger[_0x64e0('0xe')](_0x64e0('0xf'),_0x32b867,'request\x20sent');_0x1f197b(_0xc6ad41['result'][_0x64e0('0x14')]);}})[_0x64e0('0x15')](function(_0x176693){logger[_0x64e0('0x13')](_0x64e0('0xf'),_0x32b867,_0x176693);_0x191e5d(_0x176693);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d61403f..a4e6071 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 _0x85f6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x1b2f77,_0x502ded){var _0x2fc6a6=function(_0x36c504){while(--_0x36c504){_0x1b2f77['push'](_0x1b2f77['shift']());}};_0x2fc6a6(++_0x502ded);}(_0x85f6,0x1ad));var _0x685f=function(_0x55864c,_0x7622b6){_0x55864c=_0x55864c-0x0;var _0x281b0e=_0x85f6[_0x55864c];return _0x281b0e;};'use strict';var multer=require(_0x685f('0x0'));var util=require(_0x685f('0x1'));var path=require(_0x685f('0x2'));var timeout=require(_0x685f('0x3'));var express=require(_0x685f('0x4'));var router=express[_0x685f('0x5')]();var auth=require(_0x685f('0x6'));var interaction=require(_0x685f('0x7'));var config=require('../../config/environment');module[_0x685f('0x8')]=router; \ No newline at end of file +var _0xc947=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','Router'];(function(_0x57ffd3,_0x52b589){var _0x48fc51=function(_0x530f99){while(--_0x530f99){_0x57ffd3['push'](_0x57ffd3['shift']());}};_0x48fc51(++_0x52b589);}(_0xc947,0x6b));var _0x7c94=function(_0x592f9a,_0x2888cc){_0x592f9a=_0x592f9a-0x0;var _0x2386d5=_0xc947[_0x592f9a];return _0x2386d5;};'use strict';var multer=require(_0x7c94('0x0'));var util=require(_0x7c94('0x1'));var path=require(_0x7c94('0x2'));var timeout=require(_0x7c94('0x3'));var express=require('express');var router=express[_0x7c94('0x4')]();var auth=require(_0x7c94('0x5'));var interaction=require(_0x7c94('0x6'));var config=require(_0x7c94('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c389982..a4b4f8d 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x10bd3d,_0x478dfb){var _0x48d6fd=function(_0xdf597f){while(--_0xdf597f){_0x10bd3d['push'](_0x10bd3d['shift']());}};_0x48d6fd(++_0x478dfb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x35db81,_0x5f1ecd){var _0x4ecb42=function(_0x3a34b3){while(--_0x3a34b3){_0x35db81['push'](_0x35db81['shift']());}};_0x4ecb42(++_0x5f1ecd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 9ead5af..4746365 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 _0x2203=['bluebird','request-promise','path','rimraf','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x5d990e,_0x4ba9f5){var _0x36c763=function(_0x52270c){while(--_0x52270c){_0x5d990e['push'](_0x5d990e['shift']());}};_0x36c763(++_0x4ba9f5);}(_0x2203,0x1c1));var _0x3220=function(_0x18ee80,_0x2adf1c){_0x18ee80=_0x18ee80-0x0;var _0x2f60c2=_0x2203[_0x18ee80];return _0x2f60c2;};'use strict';var _=require(_0x3220('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3220('0x1'));var rp=require(_0x3220('0x2'));var fs=require('fs');var path=require(_0x3220('0x3'));var rimraf=require(_0x3220('0x4'));var config=require(_0x3220('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x2a4a55,_0x45ed46){return _0x2a4a55[_0x3220('0x6')](_0x3220('0x7'),attributes,{'tableName':_0x3220('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1f8=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4b8205,_0x40737c){var _0x201ce7=function(_0x43af44){while(--_0x43af44){_0x4b8205['push'](_0x4b8205['shift']());}};_0x201ce7(++_0x40737c);}(_0xe1f8,0x65));var _0x8e1f=function(_0x765dcf,_0x1fe960){_0x765dcf=_0x765dcf-0x0;var _0x3ed00d=_0xe1f8[_0x765dcf];return _0x3ed00d;};'use strict';var _=require(_0x8e1f('0x0'));var util=require(_0x8e1f('0x1'));var logger=require(_0x8e1f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8e1f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e1f('0x4'));var rimraf=require(_0x8e1f('0x5'));var config=require(_0x8e1f('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x8e1f('0x7')]=function(_0x16022b,_0x120d58){return _0x16022b[_0x8e1f('0x8')](_0x8e1f('0x9'),attributes,{'tableName':_0x8e1f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 2c89048..7cbd1b7 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 _0xff1d=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x485907,_0x47224d){var _0x3ed143=function(_0x12e968){while(--_0x12e968){_0x485907['push'](_0x485907['shift']());}};_0x3ed143(++_0x47224d);}(_0xff1d,0x188));var _0xdff1=function(_0x3602c7,_0x5aec63){_0x3602c7=_0x3602c7-0x0;var _0x3afb86=_0xff1d[_0x3602c7];return _0x3afb86;};'use strict';var _=require(_0xdff1('0x0'));var util=require(_0xdff1('0x1'));var moment=require('moment');var BPromise=require(_0xdff1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdff1('0x3'));var db=require(_0xdff1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdff1('0x5'))('rpc');var config=require(_0xdff1('0x6'));var jayson=require(_0xdff1('0x7'));var client=jayson['client'][_0xdff1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x523e59,_0x42651f,_0x15dc29){return new BPromise(function(_0x1c225e,_0x575a45){return client[_0xdff1('0x9')](_0x523e59,_0x15dc29)[_0xdff1('0xa')](function(_0x58b511){logger[_0xdff1('0xb')](_0xdff1('0xc'),_0x42651f,_0xdff1('0xd'));logger[_0xdff1('0xe')](_0xdff1('0xf'),_0x42651f,_0xdff1('0xd'),JSON[_0xdff1('0x10')](_0x58b511));if(_0x58b511['error']){if(_0x58b511[_0xdff1('0x11')][_0xdff1('0x12')]===0x1f4){logger[_0xdff1('0x11')](_0xdff1('0xc'),_0x42651f,_0x58b511[_0xdff1('0x11')][_0xdff1('0x13')]);return _0x575a45(_0x58b511[_0xdff1('0x11')][_0xdff1('0x13')]);}logger[_0xdff1('0x11')](_0xdff1('0xc'),_0x42651f,_0x58b511[_0xdff1('0x11')][_0xdff1('0x13')]);return _0x1c225e(_0x58b511['error'][_0xdff1('0x13')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x42651f,'request\x20sent');_0x1c225e(_0x58b511[_0xdff1('0x14')][_0xdff1('0x13')]);}})[_0xdff1('0x15')](function(_0x734545){logger[_0xdff1('0x11')](_0xdff1('0xc'),_0x42651f,_0x734545);_0x575a45(_0x734545);});});} \ No newline at end of file +var _0x3848=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5ba703,_0x42de86){var _0x95d6f=function(_0x339694){while(--_0x339694){_0x5ba703['push'](_0x5ba703['shift']());}};_0x95d6f(++_0x42de86);}(_0x3848,0xd2));var _0x8384=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x3848[_0x57b236];return _0x4feb29;};'use strict';var _=require(_0x8384('0x0'));var util=require(_0x8384('0x1'));var moment=require(_0x8384('0x2'));var BPromise=require(_0x8384('0x3'));var rs=require(_0x8384('0x4'));var fs=require('fs');var Redis=require(_0x8384('0x5'));var db=require(_0x8384('0x6'))['db'];var utils=require(_0x8384('0x7'));var logger=require(_0x8384('0x8'))('rpc');var config=require(_0x8384('0x9'));var jayson=require(_0x8384('0xa'));var client=jayson[_0x8384('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3674e6,_0x338248,_0x39221e){return new BPromise(function(_0x19f54c,_0x21e953){return client[_0x8384('0xc')](_0x3674e6,_0x39221e)[_0x8384('0xd')](function(_0x612da8){logger[_0x8384('0xe')](_0x8384('0xf'),_0x338248,_0x8384('0x10'));logger[_0x8384('0x11')](_0x8384('0x12'),_0x338248,'request\x20sent',JSON['stringify'](_0x612da8));if(_0x612da8[_0x8384('0x13')]){if(_0x612da8[_0x8384('0x13')][_0x8384('0x14')]===0x1f4){logger['error'](_0x8384('0xf'),_0x338248,_0x612da8[_0x8384('0x13')][_0x8384('0x15')]);return _0x21e953(_0x612da8[_0x8384('0x13')][_0x8384('0x15')]);}logger[_0x8384('0x13')](_0x8384('0xf'),_0x338248,_0x612da8[_0x8384('0x13')][_0x8384('0x15')]);return _0x19f54c(_0x612da8['error'][_0x8384('0x15')]);}else{logger[_0x8384('0xe')](_0x8384('0xf'),_0x338248,_0x8384('0x10'));_0x19f54c(_0x612da8[_0x8384('0x16')][_0x8384('0x15')]);}})[_0x8384('0x17')](function(_0x5817e4){logger[_0x8384('0x13')](_0x8384('0xf'),_0x338248,_0x5817e4);_0x21e953(_0x5817e4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 077bbb2..824f3d2 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 _0x8205=['/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','show','get','/:id/sections','getSections'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0x8205,0x1b3));var _0x5820=function(_0x4d7908,_0x3d5ebc){_0x4d7908=_0x4d7908-0x0;var _0xaa313e=_0x8205[_0x4d7908];return _0xaa313e;};'use strict';var multer=require(_0x5820('0x0'));var util=require(_0x5820('0x1'));var path=require(_0x5820('0x2'));var timeout=require(_0x5820('0x3'));var express=require('express');var router=express[_0x5820('0x4')]();var auth=require(_0x5820('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5820('0x6'));var controller=require(_0x5820('0x7'));router['get']('/',auth[_0x5820('0x8')](),controller[_0x5820('0x9')]);router['get'](_0x5820('0xa'),auth[_0x5820('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5820('0xb')]);router[_0x5820('0xc')](_0x5820('0xd'),auth[_0x5820('0x8')](),controller[_0x5820('0xe')]);router[_0x5820('0xc')](_0x5820('0xf'),auth[_0x5820('0x8')](),controller[_0x5820('0x10')]);router[_0x5820('0x11')]('/',auth[_0x5820('0x8')](),controller[_0x5820('0x12')]);router[_0x5820('0x11')](_0x5820('0x13'),auth['isAuthenticated'](),controller[_0x5820('0x14')]);router[_0x5820('0x11')](_0x5820('0xd'),auth[_0x5820('0x8')](),controller[_0x5820('0x15')]);router[_0x5820('0x11')]('/:id/resources',auth[_0x5820('0x8')](),controller[_0x5820('0x16')]);router[_0x5820('0x17')](_0x5820('0x18'),auth['isAuthenticated'](),controller[_0x5820('0x19')]);router[_0x5820('0x1a')]('/:id',auth[_0x5820('0x8')](),controller[_0x5820('0x1b')]);router[_0x5820('0x1a')](_0x5820('0xd'),auth['isAuthenticated'](),controller[_0x5820('0x1c')]);router[_0x5820('0x1a')](_0x5820('0xf'),auth[_0x5820('0x8')](),controller[_0x5820('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xc803=['post','/:id/clone','clone','/:id/sections','addSections','put','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','getSections','/:id/resources','getResources'];(function(_0x5dd15b,_0x26ce73){var _0x4a4b0b=function(_0x3e0938){while(--_0x3e0938){_0x5dd15b['push'](_0x5dd15b['shift']());}};_0x4a4b0b(++_0x26ce73);}(_0xc803,0x11a));var _0x3c80=function(_0x36b753,_0x5075a8){_0x36b753=_0x36b753-0x0;var _0x2a643e=_0xc803[_0x36b753];return _0x2a643e;};'use strict';var multer=require(_0x3c80('0x0'));var util=require('util');var path=require(_0x3c80('0x1'));var timeout=require(_0x3c80('0x2'));var express=require(_0x3c80('0x3'));var router=express['Router']();var auth=require(_0x3c80('0x4'));var interaction=require(_0x3c80('0x5'));var config=require('../../config/environment');var controller=require(_0x3c80('0x6'));router[_0x3c80('0x7')]('/',auth[_0x3c80('0x8')](),controller['index']);router['get'](_0x3c80('0x9'),auth[_0x3c80('0x8')](),controller[_0x3c80('0xa')]);router[_0x3c80('0x7')](_0x3c80('0xb'),auth[_0x3c80('0x8')](),controller['show']);router[_0x3c80('0x7')]('/:id/sections',auth[_0x3c80('0x8')](),controller[_0x3c80('0xc')]);router['get'](_0x3c80('0xd'),auth[_0x3c80('0x8')](),controller[_0x3c80('0xe')]);router[_0x3c80('0xf')]('/',auth[_0x3c80('0x8')](),controller['create']);router['post'](_0x3c80('0x10'),auth['isAuthenticated'](),controller[_0x3c80('0x11')]);router['post'](_0x3c80('0x12'),auth[_0x3c80('0x8')](),controller[_0x3c80('0x13')]);router[_0x3c80('0xf')](_0x3c80('0xd'),auth['isAuthenticated'](),controller['addResources']);router[_0x3c80('0x14')](_0x3c80('0xb'),auth['isAuthenticated'](),controller[_0x3c80('0x15')]);router[_0x3c80('0x16')](_0x3c80('0xb'),auth[_0x3c80('0x8')](),controller[_0x3c80('0x17')]);router['delete'](_0x3c80('0x12'),auth[_0x3c80('0x8')](),controller[_0x3c80('0x18')]);router[_0x3c80('0x16')](_0x3c80('0xd'),auth['isAuthenticated'](),controller[_0x3c80('0x19')]);module[_0x3c80('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index e696bda..e795d6a 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 _0x8efe=['crudPermissions','getDataValue','exports','STRING','name','setDataValue'];(function(_0x4b3ec4,_0x3c573c){var _0x192836=function(_0x498cc0){while(--_0x498cc0){_0x4b3ec4['push'](_0x4b3ec4['shift']());}};_0x192836(++_0x3c573c);}(_0x8efe,0x1e2));var _0xe8ef=function(_0x54d751,_0x21e3ee){_0x54d751=_0x54d751-0x0;var _0x392125=_0x8efe[_0x54d751];return _0x392125;};'use strict';var Sequelize=require('sequelize');module[_0xe8ef('0x0')]={'name':{'type':Sequelize[_0xe8ef('0x1')],'allowNull':![],'unique':_0xe8ef('0x2')},'crudPermissions':{'type':Sequelize[_0xe8ef('0x1')],'set':function(_0x38e63d){this[_0xe8ef('0x3')](_0xe8ef('0x4'),_0x38e63d?_0x38e63d['join'](''):[]);},'get':function(){return this[_0xe8ef('0x5')]('crudPermissions')?this[_0xe8ef('0x5')](_0xe8ef('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe8ef('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x38fd=['exports','STRING','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x475d44,_0x4988e9){var _0x45ceac=function(_0x590037){while(--_0x590037){_0x475d44['push'](_0x475d44['shift']());}};_0x45ceac(++_0x4988e9);}(_0x38fd,0x117));var _0xd38f=function(_0x22741c,_0x1b5982){_0x22741c=_0x22741c-0x0;var _0x2d274c=_0x38fd[_0x22741c];return _0x2d274c;};'use strict';var Sequelize=require(_0xd38f('0x0'));module[_0xd38f('0x1')]={'name':{'type':Sequelize[_0xd38f('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xd38f('0x2')],'set':function(_0x297ef7){this[_0xd38f('0x3')](_0xd38f('0x4'),_0x297ef7?_0x297ef7['join'](''):[]);},'get':function(){return this['getDataValue'](_0xd38f('0x4'))?this[_0xd38f('0x5')]('crudPermissions')[_0xd38f('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd38f('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c9046b2..3f8d0fc 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 _0x4c2d=['ignore','childModel','order','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','Tag','color','tag','value','toLowerCase','squareprojects','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','CmContact','ListId','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','faxqueues','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','telephones','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','scheduler','tags','templates','Template','triggers','Trigger','trunks','variables','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','end','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','body','clone','get','omit','updatedAt','createdAt','UserProfileSection','each','autoAssociation','UserProfileResource','destroy','describe','addSections','find','transaction','sectionId','userProfileId','Resources','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','union'];(function(_0xa4585d,_0x8231b7){var _0x4e204e=function(_0x2a0e08){while(--_0x2a0e08){_0xa4585d['push'](_0xa4585d['shift']());}};_0x4e204e(++_0x8231b7);}(_0x4c2d,0x166));var _0xd4c2=function(_0x3c37d3,_0x1afaea){_0x3c37d3=_0x3c37d3-0x0;var _0x33bdd9=_0x4c2d[_0x3c37d3];return _0x33bdd9;};'use strict';var pdf=require(_0xd4c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd4c2('0x1'));var zipdir=require(_0xd4c2('0x2'));var jsonpatch=require(_0xd4c2('0x3'));var rp=require(_0xd4c2('0x4'));var moment=require(_0xd4c2('0x5'));var BPromise=require(_0xd4c2('0x6'));var Mustache=require('mustache');var util=require(_0xd4c2('0x7'));var path=require(_0xd4c2('0x8'));var sox=require(_0xd4c2('0x9'));var csv=require(_0xd4c2('0xa'));var ejs=require(_0xd4c2('0xb'));var fs=require('fs');var _=require(_0xd4c2('0xc'));var squel=require(_0xd4c2('0xd'));var crypto=require(_0xd4c2('0xe'));var jsforce=require(_0xd4c2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4c2('0x10'));var Papa=require(_0xd4c2('0x11'));var Redis=require(_0xd4c2('0x12'));var authService=require(_0xd4c2('0x13'));var qs=require(_0xd4c2('0x14'));var as=require(_0xd4c2('0x15'));var hardwareService=require(_0xd4c2('0x16'));var logger=require(_0xd4c2('0x17'))(_0xd4c2('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd4c2('0x19')]=_[_0xd4c2('0x1a')](config[_0xd4c2('0x19')],{'host':_0xd4c2('0x1b'),'port':0x18eb});var socket=require(_0xd4c2('0x1c'))(new Redis(config['redis']));require(_0xd4c2('0x1d'))[_0xd4c2('0x1e')](socket);function respondWithStatusCode(_0x38e0ad,_0x4d60b6){_0x4d60b6=_0x4d60b6||0xcc;return function(_0x1e2329){if(_0x1e2329){return _0x38e0ad[_0xd4c2('0x1f')](_0x4d60b6);}return _0x38e0ad[_0xd4c2('0x20')](_0x4d60b6)['end']();};}function respondWithResult(_0x411855,_0x31ec0e){_0x31ec0e=_0x31ec0e||0xc8;return function(_0x12d5f0){if(_0x12d5f0){return _0x411855[_0xd4c2('0x20')](_0x31ec0e)[_0xd4c2('0x21')](_0x12d5f0);}};}function respondWithFilteredResult(_0x4f89f9,_0x5e6463){return function(_0xb4c433){if(_0xb4c433){var _0x3c02ee=_0xb4c433[_0xd4c2('0x22')],_0x1b79d8=_0x5e6463[_0xd4c2('0x23')],_0x4ba2d0=_0x5e6463['offset']+_0x5e6463['limit'],_0x2e8770;if(_0x4ba2d0>=_0x3c02ee){_0x4ba2d0=_0x3c02ee;_0x2e8770=0xc8;}else{_0x2e8770=0xce;}_0x4f89f9[_0xd4c2('0x20')](_0x2e8770);return _0x4f89f9[_0xd4c2('0x24')](_0xd4c2('0x25'),_0x1b79d8+'-'+_0x4ba2d0+'/'+_0x3c02ee)[_0xd4c2('0x21')](_0xb4c433);}return null;};}function patchUpdates(_0x214b77){return function(_0x3efc4c){try{jsonpatch['apply'](_0x3efc4c,_0x214b77,!![]);}catch(_0x3ef356){return BPromise[_0xd4c2('0x26')](_0x3ef356);}return _0x3efc4c[_0xd4c2('0x27')]();};}function saveUpdates(_0x1874c9,_0x527136){return function(_0x11222a){if(_0x11222a){return _0x11222a[_0xd4c2('0x28')](_0x1874c9)[_0xd4c2('0x29')](function(_0x3bfa01){return _0x3bfa01;});}return null;};}function removeEntity(_0x47e0a0,_0x5ef2d3){return function(_0x3ee397){if(_0x3ee397){return _0x3ee397['destroy']()[_0xd4c2('0x29')](function(){_0x47e0a0[_0xd4c2('0x20')](0xcc)[_0xd4c2('0x2a')]();});}};}function handleEntityNotFound(_0x11f941,_0x1a1382){return function(_0x5c169e){if(!_0x5c169e){_0x11f941[_0xd4c2('0x1f')](0x194);}return _0x5c169e;};}function handleError(_0x55a8c4,_0x3940d1){_0x3940d1=_0x3940d1||0x1f4;return function(_0x548b76){logger[_0xd4c2('0x2b')](_0x548b76['stack']);if(_0x548b76[_0xd4c2('0x2c')]){delete _0x548b76[_0xd4c2('0x2c')];}_0x55a8c4[_0xd4c2('0x20')](_0x3940d1)[_0xd4c2('0x2d')](_0x548b76);};}exports[_0xd4c2('0x2e')]=function(_0x5189ab,_0x4438c9){var _0x356119={},_0x3a7874={},_0x1ba943={'count':0x0,'rows':[]};var _0x572253=_[_0xd4c2('0x2f')](db[_0xd4c2('0x30')][_0xd4c2('0x31')],function(_0x1d618c){return{'name':_0x1d618c[_0xd4c2('0x32')],'type':_0x1d618c[_0xd4c2('0x33')]['key']};});_0x3a7874[_0xd4c2('0x34')]=_['map'](_0x572253,'name');_0x3a7874[_0xd4c2('0x35')]=_[_0xd4c2('0x36')](_0x5189ab['query']);_0x3a7874[_0xd4c2('0x37')]=_[_0xd4c2('0x38')](_0x3a7874[_0xd4c2('0x34')],_0x3a7874[_0xd4c2('0x35')]);_0x356119[_0xd4c2('0x39')]=_['intersection'](_0x3a7874['model'],qs[_0xd4c2('0x3a')](_0x5189ab['query'][_0xd4c2('0x3a')]));_0x356119[_0xd4c2('0x39')]=_0x356119[_0xd4c2('0x39')]['length']?_0x356119[_0xd4c2('0x39')]:_0x3a7874[_0xd4c2('0x34')];if(!_0x5189ab['query'][_0xd4c2('0x3b')](_0xd4c2('0x3c'))){_0x356119[_0xd4c2('0x3d')]=qs['limit'](_0x5189ab['query'][_0xd4c2('0x3d')]);_0x356119['offset']=qs[_0xd4c2('0x23')](_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x23')]);}_0x356119['order']=qs['sort'](_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x3e')]);_0x356119[_0xd4c2('0x3f')]=qs[_0xd4c2('0x37')](_[_0xd4c2('0x40')](_0x5189ab[_0xd4c2('0x35')],_0x3a7874[_0xd4c2('0x37')]),_0x572253);if(_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x41')]){_0x356119['where']=_[_0xd4c2('0x42')](_0x356119[_0xd4c2('0x3f')],{'$or':_[_0xd4c2('0x2f')](_0x572253,function(_0x434149){if(_0x434149['type']!==_0xd4c2('0x43')){var _0x5b8a46={};_0x5b8a46[_0x434149[_0xd4c2('0x2c')]]={'$like':'%'+_0x5189ab['query'][_0xd4c2('0x41')]+'%'};return _0x5b8a46;}})});}_0x356119=_[_0xd4c2('0x42')]({},_0x356119,_0x5189ab[_0xd4c2('0x44')]);var _0x50fa8f={'where':_0x356119[_0xd4c2('0x3f')]};return db[_0xd4c2('0x30')][_0xd4c2('0x22')](_0x50fa8f)[_0xd4c2('0x29')](function(_0x2df484){_0x1ba943[_0xd4c2('0x22')]=_0x2df484;if(_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x45')]){_0x356119['include']=[{'all':!![]}];}return db[_0xd4c2('0x30')][_0xd4c2('0x46')](_0x356119);})[_0xd4c2('0x29')](function(_0x318f19){_0x1ba943[_0xd4c2('0x47')]=_0x318f19;return _0x1ba943;})['then'](respondWithFilteredResult(_0x4438c9,_0x356119))[_0xd4c2('0x48')](handleError(_0x4438c9,null));};exports[_0xd4c2('0x49')]=function(_0x5bd652,_0x4c506c){var _0x3de48f={'raw':![],'where':{'id':_0x5bd652[_0xd4c2('0x4a')]['id']}},_0x42da8e={};_0x42da8e[_0xd4c2('0x34')]=_[_0xd4c2('0x36')](db[_0xd4c2('0x30')][_0xd4c2('0x31')]);_0x42da8e['query']=_[_0xd4c2('0x36')](_0x5bd652[_0xd4c2('0x35')]);_0x42da8e['filters']=_[_0xd4c2('0x38')](_0x42da8e['model'],_0x42da8e[_0xd4c2('0x35')]);_0x3de48f['attributes']=_[_0xd4c2('0x38')](_0x42da8e['model'],qs[_0xd4c2('0x3a')](_0x5bd652['query']['fields']));_0x3de48f[_0xd4c2('0x39')]=_0x3de48f[_0xd4c2('0x39')][_0xd4c2('0x4b')]?_0x3de48f[_0xd4c2('0x39')]:_0x42da8e[_0xd4c2('0x34')];if(_0x5bd652[_0xd4c2('0x35')]['includeAll']){_0x3de48f[_0xd4c2('0x4c')]=[{'all':!![]}];}_0x3de48f=_[_0xd4c2('0x42')]({},_0x3de48f,_0x5bd652[_0xd4c2('0x44')]);return db['UserProfile']['find'](_0x3de48f)[_0xd4c2('0x29')](handleEntityNotFound(_0x4c506c,null))[_0xd4c2('0x29')](respondWithResult(_0x4c506c,null))[_0xd4c2('0x48')](handleError(_0x4c506c,null));};exports['create']=function(_0x1ef788,_0x215450){return db['UserProfile']['create'](_0x1ef788[_0xd4c2('0x4d')],{})['then'](respondWithResult(_0x215450,0xc9))[_0xd4c2('0x48')](handleError(_0x215450,null));};exports[_0xd4c2('0x4e')]=function(_0x54fe63,_0x351611){var _0x52f4cb={'where':{'id':_0x54fe63[_0xd4c2('0x4a')]['id']}},_0x557c81={};_0x557c81['model']=_['keys'](db[_0xd4c2('0x30')][_0xd4c2('0x31')]);_0x52f4cb['attributes']=_[_0xd4c2('0x38')](_0x557c81[_0xd4c2('0x34')],qs[_0xd4c2('0x3a')](_0x54fe63[_0xd4c2('0x35')][_0xd4c2('0x3a')]));_0x52f4cb['attributes']=_0x52f4cb[_0xd4c2('0x39')][_0xd4c2('0x4b')]?_0x52f4cb[_0xd4c2('0x39')]:_0x557c81['model'];if(_0x54fe63[_0xd4c2('0x35')][_0xd4c2('0x45')]){_0x52f4cb['include']=[{'all':!![]}];}_0x52f4cb=_['merge']({},_0x52f4cb,_0x54fe63[_0xd4c2('0x44')]);return db['UserProfile']['find'](_0x52f4cb)[_0xd4c2('0x29')](handleEntityNotFound(_0x351611,null))[_0xd4c2('0x29')](function(_0x2eaa04){if(_0x2eaa04){var _0x277901=_0x2eaa04[_0xd4c2('0x4f')]({'plain':!![]});_0x277901=qs[_0xd4c2('0x50')](_0x277901,['id','createdAt',_0xd4c2('0x51'),'crudPermissions']);_0x54fe63[_0xd4c2('0x4d')]=_[_0xd4c2('0x50')](_0x54fe63['body'],['id',_0xd4c2('0x52'),_0xd4c2('0x51')]);return db['sequelize']['transaction'](function(_0x4b5cf9){return db[_0xd4c2('0x30')]['create'](_[_0xd4c2('0x42')](_0x277901,_0x54fe63[_0xd4c2('0x4d')]),{'include':_0x54fe63[_0xd4c2('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b5cf9})[_0xd4c2('0x29')](function(_0x34d8f8){var _0x3076b6=_0x34d8f8[_0xd4c2('0x4f')]({'plain':!![]});return db[_0xd4c2('0x53')]['findAll']({'where':{'userProfileId':_0x54fe63['params']['id']},'raw':!![]})['then'](function(_0x5747e7){if(_0x5747e7){return BPromise[_0xd4c2('0x54')](_0x5747e7,function(_0x9e060e){return new BPromise(function(_0x49f23e,_0x343d34){if(_0x9e060e[_0xd4c2('0x55')]===null||_0x9e060e['autoAssociation']===0x1)_0x49f23e(null);return db[_0xd4c2('0x56')]['findAll']({'where':{'sectionId':_0x9e060e['id']},'raw':!![]})[_0xd4c2('0x29')](function(_0x31749f){var _0x431776=_['map'](_0x31749f,function(_0x775e18){return qs['omit'](_0x775e18,['id',_0xd4c2('0x52'),_0xd4c2('0x51'),'sectionId']);});_0x49f23e(_0x431776);})[_0xd4c2('0x48')](function(_0x5c35df){_0x343d34(_0x5c35df);});})[_0xd4c2('0x29')](function(_0x1c33da){var _0x4a5f7f=qs['omit'](_0x9e060e,['id',_0xd4c2('0x52'),_0xd4c2('0x51')]);_0x4a5f7f['userProfileId']=_0x3076b6['id'];if(_0x1c33da)_0x4a5f7f['Resources']=_0x1c33da;return _0x4a5f7f;})[_0xd4c2('0x29')](function(_0x34e1b6){return db[_0xd4c2('0x53')]['create'](_0x34e1b6,{'include':[{'model':db[_0xd4c2('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x4b5cf9});});})[_0xd4c2('0x29')](function(){return _0x3076b6;});}});});});}})[_0xd4c2('0x29')](respondWithResult(_0x351611,0xc9))[_0xd4c2('0x48')](handleError(_0x351611,null));};exports[_0xd4c2('0x28')]=function(_0x514c53,_0x1ac762){if(_0x514c53['body']['id']){delete _0x514c53[_0xd4c2('0x4d')]['id'];}return db[_0xd4c2('0x30')]['find']({'where':{'id':_0x514c53[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x1ac762,null))[_0xd4c2('0x29')](saveUpdates(_0x514c53[_0xd4c2('0x4d')],null))[_0xd4c2('0x29')](respondWithResult(_0x1ac762,null))[_0xd4c2('0x48')](handleError(_0x1ac762,null));};exports[_0xd4c2('0x57')]=function(_0x3586c3,_0x5aabbb){return db[_0xd4c2('0x30')]['find']({'where':{'id':_0x3586c3[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x5aabbb,null))[_0xd4c2('0x29')](removeEntity(_0x5aabbb,null))[_0xd4c2('0x48')](handleError(_0x5aabbb,null));};exports[_0xd4c2('0x58')]=function(_0x1de41c,_0x1036f2){return db[_0xd4c2('0x30')][_0xd4c2('0x58')]()['then'](respondWithResult(_0x1036f2,null))['catch'](handleError(_0x1036f2,null));};exports[_0xd4c2('0x59')]=function(_0x2db495,_0x4bfab6){var _0x16e779=_0x2db495[_0xd4c2('0x4d')];return db[_0xd4c2('0x30')][_0xd4c2('0x5a')]({'where':{'id':_0x2db495[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x4bfab6,null))[_0xd4c2('0x29')](function(_0x5439d2){if(_0x5439d2){return db['sequelize'][_0xd4c2('0x5b')](function(_0x5c6fe1){return db[_0xd4c2('0x53')][_0xd4c2('0x57')]({'where':{'userProfileId':_0x2db495[_0xd4c2('0x4a')]['id'],'sectionId':_[_0xd4c2('0x2f')](_0x16e779,function(_0x43cea8){return _0x43cea8[_0xd4c2('0x5c')];})},'transaction':_0x5c6fe1})[_0xd4c2('0x29')](function(){var _0x39fbd0=_['map'](_0x16e779,function(_0x10c6b1){_0x10c6b1[_0xd4c2('0x5d')]=_0x2db495['params']['id'];return _0x10c6b1;});var _0x53f32f=[];return BPromise[_0xd4c2('0x54')](_0x39fbd0,function(_0x49e72e){return db[_0xd4c2('0x53')]['create'](_0x49e72e,{'include':[{'model':db[_0xd4c2('0x56')],'as':_0xd4c2('0x5e')}],'raw':!![],'transaction':_0x5c6fe1})[_0xd4c2('0x29')](function(_0x3a24c3){_0x53f32f[_0xd4c2('0x5f')](_0x3a24c3[_0xd4c2('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x53f32f;});});});}})[_0xd4c2('0x29')](function(_0x2415f8){return _0x2415f8;})[_0xd4c2('0x29')](respondWithResult(_0x4bfab6,null))[_0xd4c2('0x48')](handleError(_0x4bfab6,null));};exports[_0xd4c2('0x60')]=function(_0x2eec06,_0x1b912a){var _0x58fcdd;return db['UserProfile'][_0xd4c2('0x5a')]({'where':{'id':_0x2eec06[_0xd4c2('0x4a')]['id']},'attributes':['id',_0xd4c2('0x2c')]})['then'](handleEntityNotFound(_0x1b912a,null))[_0xd4c2('0x29')](function(_0x6c12ad){if(_0x6c12ad){_0x58fcdd=_0x6c12ad;return db['UserProfileSection'][_0xd4c2('0x57')]({'where':{'userProfileId':_0x2eec06[_0xd4c2('0x4a')]['id'],'sectionId':_0x2eec06[_0xd4c2('0x35')][_0xd4c2('0x61')]}});}})[_0xd4c2('0x29')](function(){return _0x58fcdd;})[_0xd4c2('0x29')](respondWithStatusCode(_0x1b912a,null))[_0xd4c2('0x48')](handleError(_0x1b912a,null));};exports[_0xd4c2('0x62')]=function(_0x2b2ed7,_0x5e864a){var _0x2f0bae=[];var _0x31d8c7=[];return db[_0xd4c2('0x53')][_0xd4c2('0x46')]({'where':{'userProfileId':_0x2b2ed7[_0xd4c2('0x4a')]['id']},'raw':!![]})['then'](function(_0x352d65){_0x2f0bae=_[_0xd4c2('0x41')](_0x352d65,function(_0x402a4e){return _0x402a4e['enabled']===0x1||_[_0xd4c2('0x63')]([0x3eb,0x709],_0x402a4e[_0xd4c2('0x5c')]);});if(!_[_0xd4c2('0x64')](_0x2f0bae)){return _[_0xd4c2('0x2f')](_0x2f0bae,function(_0x27ced2){return _0x27ced2['sectionId'];});}else{return;}})['then'](function(_0x1bdbaf){if(_0x1bdbaf)_0x31d8c7=_0x1bdbaf;if(_[_0xd4c2('0x63')](_0x31d8c7,0x64)){var _0x595c9e=_['find'](_0x2f0bae,{'sectionId':0x64});return hasDefaultDashboard(_0x595c9e)[_0xd4c2('0x29')](function(_0x353233){return _[_0xd4c2('0x2f')](_0x2f0bae,function(_0x18ac5c){if(_0x18ac5c[_0xd4c2('0x5c')]===0x64){_0x18ac5c[_0xd4c2('0x65')]=_0x353233;}return _0x18ac5c;});});}else{return;}})[_0xd4c2('0x29')](function(_0x12ab44){if(_0x12ab44)_0x2f0bae=_0x12ab44;if(_['includes'](_0x31d8c7,0x3eb)){var _0x3aba8c=_[_0xd4c2('0x5a')](_0x2f0bae,{'sectionId':0x3eb});return getCustomDashboards(_0x3aba8c)[_0xd4c2('0x29')](function(_0x458f29){return _['map'](_0x2f0bae,function(_0x4ff3e9){if(_0x3aba8c['enabled']){if(_0x4ff3e9['sectionId']===0x3eb){_0x4ff3e9[_0xd4c2('0x65')]=_0x458f29;}}else{if(_0x4ff3e9[_0xd4c2('0x5c')]===0x64){_0x4ff3e9['subsections']=_0x458f29;}}return _0x4ff3e9;});});}else{return;}})[_0xd4c2('0x29')](function(_0x554b70){if(_0x554b70)_0x2f0bae=_0x554b70;if(_[_0xd4c2('0x63')](_0x31d8c7,0x709)){var _0x217d6f=_[_0xd4c2('0x5a')](_0x2f0bae,{'sectionId':0x709});return getPlugins(_0x217d6f)[_0xd4c2('0x29')](function(_0x1b047f){if(_0x217d6f['enabled']){return _[_0xd4c2('0x2f')](_0x2f0bae,function(_0x207a61){if(_0x207a61[_0xd4c2('0x5c')]===0x709){_0x207a61[_0xd4c2('0x65')]=_0x1b047f;}return _0x207a61;});}else{var _0x3dc400={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1b047f};var _0x46f18b=_[_0xd4c2('0x2f')](_0x2f0bae);_0x46f18b['push'](_0x3dc400);return _0x46f18b;}});}else{return;}})[_0xd4c2('0x29')](function(_0x92dcf0){if(_0x92dcf0)_0x2f0bae=_0x92dcf0;return _[_0xd4c2('0x41')](_0x2f0bae,[_0xd4c2('0x66'),0x1]);})[_0xd4c2('0x29')](respondWithResult(_0x5e864a,null))[_0xd4c2('0x48')](handleError(_0x5e864a,null));};function hasDefaultDashboard(_0x504564){var _0x2ff7ed=[0x65];return new BPromise(function(_0x248899,_0x467d99){try{if(_0x504564[_0xd4c2('0x55')]){_0x248899(_0x2ff7ed);}else{return db[_0xd4c2('0x56')][_0xd4c2('0x67')]({'where':{'sectionId':_0x504564['id']},'raw':!![]})['then'](function(_0x2d6adc){_0x2d6adc?_0x248899(_0x2ff7ed):_0x248899();});}}catch(_0x41d342){_0x467d99(_0x41d342);}});}function getCustomDashboards(_0x4742aa){var _0x243625=[];return new BPromise(function(_0x56c76a,_0x110db4){try{if(_0x4742aa[_0xd4c2('0x55')]){return db[_0xd4c2('0x68')][_0xd4c2('0x46')]({'raw':!![]})[_0xd4c2('0x29')](function(_0x5ddae0){_0x5ddae0[_0xd4c2('0x69')](function(_0x367051){_0x243625[_0xd4c2('0x5f')](_0x367051['id']+0x1869f);});_0x56c76a(_0x243625);});}else{return db['UserProfileResource'][_0xd4c2('0x46')]({'where':{'sectionId':_0x4742aa['id']},'raw':!![]})['then'](function(_0x136124){_0x136124[_0xd4c2('0x69')](function(_0x1d2b1b){_0x243625[_0xd4c2('0x5f')](_0x1d2b1b['resourceId']+0x1869f);});_0x56c76a(_0x243625);});}}catch(_0x48bfcc){_0x110db4(_0x48bfcc);}});}function getPlugins(_0x546c8f){var _0x476b58=[];return new BPromise(function(_0x16570f,_0x5eccb0){try{if(_0x546c8f[_0xd4c2('0x55')]){return db['Plugin']['findAll']({'raw':!![]})[_0xd4c2('0x29')](function(_0xdfdddd){_0xdfdddd[_0xd4c2('0x69')](function(_0x67c010){_0x476b58['push'](_0x67c010['id']+0x15b38);});_0x16570f(_0x476b58);});}else{return db[_0xd4c2('0x56')]['findAll']({'where':{'sectionId':_0x546c8f['id']},'raw':!![]})[_0xd4c2('0x29')](function(_0x163182){_0x163182[_0xd4c2('0x69')](function(_0x366822){_0x476b58[_0xd4c2('0x5f')](_0x366822[_0xd4c2('0x6a')]+0x15b38);});_0x16570f(_0x476b58);});}}catch(_0x5330eb){_0x5eccb0(_0x5330eb);}});}exports[_0xd4c2('0x6b')]=function(_0x578bfc,_0x3141c6){return db[_0xd4c2('0x30')]['find']({'where':{'id':_0x578bfc[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x3141c6,null))[_0xd4c2('0x29')](function(_0x23406e){if(_0x23406e){return db['sequelize'][_0xd4c2('0x5b')](function(_0x33a46e){return db[_0xd4c2('0x53')][_0xd4c2('0x46')]({'where':{'userProfileId':_0x578bfc[_0xd4c2('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xd4c2('0x29')](function(_0x48054f){if(_0x48054f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x578bfc['params']['id'],'id':_[_0xd4c2('0x2f')](_0x48054f,function(_0x43eb5a){return _0x43eb5a['id'];})},'transaction':_0x33a46e});}})['then'](function(_0x466e44){var _0x37c834=_[_0xd4c2('0x2f')](_0x578bfc['body'],function(_0x36c437){_0x36c437[_0xd4c2('0x5d')]=_0x578bfc[_0xd4c2('0x4a')]['id'];return _0x36c437;});return db[_0xd4c2('0x53')][_0xd4c2('0x6c')](_0x37c834,{'raw':!![],'transaction':_0x33a46e});})[_0xd4c2('0x29')](function(_0x1acf6b){var _0x27347c=_[_0xd4c2('0x41')](_[_0xd4c2('0x2f')](_0x1acf6b,function(_0x60d4ef){return _0x60d4ef[_0xd4c2('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x27347c){return db['UserProfileSection'][_0xd4c2('0x46')]({'where':{'userProfileId':_0x578bfc[_0xd4c2('0x4a')]['id'],'sectionId':_['map'](_0x27347c,function(_0x293523){return _0x293523[_0xd4c2('0x5c')];})},'attributes':['id',_0xd4c2('0x5c')],'raw':!![]})['then'](function(_0x5694b7){var _0x35a1b9=_[_0xd4c2('0x2f')](_0x578bfc[_0xd4c2('0x4d')],function(_0x5cd636){_0x5cd636[_0xd4c2('0x5d')]=_0x578bfc[_0xd4c2('0x4a')]['id'];return _0x5cd636;});return db['UserProfileResource'][_0xd4c2('0x6c')](_0x35a1b9,{'raw':!![],'transaction':_0x33a46e});});}})[_0xd4c2('0x48')](handleError(_0x3141c6,null));});}})['then'](function(_0x4010e7){var _0x2e0af0=_[_0xd4c2('0x2f')](_0x4010e7,function(_0x1730fc){return _0x1730fc['get']({'plain':!![]});});})[_0xd4c2('0x29')](respondWithResult(_0x3141c6,null))[_0xd4c2('0x48')](handleError(_0x3141c6,null));};exports['removeResources']=function(_0x3f57ad,_0x4c2132,_0x2850d6){return db[_0xd4c2('0x30')][_0xd4c2('0x5a')]({'where':{'id':_0x3f57ad[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x4c2132,null))[_0xd4c2('0x29')](function(_0x51b2ad){if(_0x51b2ad){return _0x51b2ad[_0xd4c2('0x6d')](_0x3f57ad[_0xd4c2('0x35')][_0xd4c2('0x61')]);}})[_0xd4c2('0x29')](respondWithStatusCode(_0x4c2132,null))[_0xd4c2('0x48')](handleError(_0x4c2132,null));};exports['getResources']=function(_0x52f233,_0x4257b2){var _0x533a5e={'raw':![],'where':{}};var _0x26c21d={};var _0x5de7ed={'count':0x0,'rows':[]};var _0x589e67=_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x6e')];if(typeof _0x589e67===_0xd4c2('0x6f')){throw new db[(_0xd4c2('0x70'))][(_0xd4c2('0x71'))](_0xd4c2('0x72'));}var _0xed514b=_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x73')]||![];var _0x22e836=getQueryModels(_0x589e67,_0xed514b);if(typeof _0x22e836['childModel']===_0xd4c2('0x6f')){throw new db[(_0xd4c2('0x70'))][(_0xd4c2('0x71'))](_0xd4c2('0x74')+_0x589e67+'\x27');}var _0x5a4354=[];if(!_[_0xd4c2('0x64')](_0x22e836[_0xd4c2('0x75')])){_0x5a4354=_0x22e836['parentSections'];}else{_0x5a4354=[{'name':_0x589e67}];}return db[_0xd4c2('0x30')]['findOne']({'where':{'id':_0x52f233[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x4257b2,null))['then'](function(_0xc4d3f7){if(_0xc4d3f7){var _0x3b88f4=[];for(var _0x39ddac=0x0;_0x39ddac<_0x5a4354[_0xd4c2('0x4b')];_0x39ddac++){_0x3b88f4[_0xd4c2('0x5f')](db[_0xd4c2('0x53')]['findOne']({'where':{'userProfileId':_0xc4d3f7['id'],'name':_0x5a4354[_0x39ddac][_0xd4c2('0x2c')]},'raw':!![]}));}return BPromise[_0xd4c2('0x76')](_0x3b88f4);}})[_0xd4c2('0x29')](function(_0x49778d){var _0x382789=_[_0xd4c2('0x41')](_0x49778d,function(_0x3aacd1){return _0x3aacd1?_0x3aacd1:undefined;});var _0x2a5fc6=_[_0xd4c2('0x41')](_0x5a4354,['ignore',!![]]);var _0x17f771=_[_0xd4c2('0x64')](_0x382789)&&_[_0xd4c2('0x64')](_0x2a5fc6)?null:_[_0xd4c2('0x77')](_0x2a5fc6,_0x382789);if(_0x17f771){var _0x18bbce=[];for(var _0x193337=0x0;_0x193337<_0x17f771[_0xd4c2('0x4b')];_0x193337++){var _0x1f81d7=_['find'](_0x5a4354,function(_0x390bfe){return _0x17f771[_0x193337]?_0x390bfe[_0xd4c2('0x2c')]===_0x17f771[_0x193337][_0xd4c2('0x2c')]:null;});if(_0x1f81d7){if(_0x17f771[_0x193337][_0xd4c2('0x78')]){_0x18bbce[_0xd4c2('0x5f')](getAllResources(_0x22e836['childModel'],_0x17f771[_0x193337]));}else{if(!_0x17f771[_0x193337][_0xd4c2('0x55')]){_0x18bbce['push'](getAllowedResources(_0x1f81d7,_0x17f771[_0x193337],_0x22e836[_0xd4c2('0x79')]));}else{if(_0x1f81d7['model']){_0x18bbce[_0xd4c2('0x5f')](getAllFilteredResources(_0x1f81d7,_0x17f771[_0x193337]));}}}}}return BPromise[_0xd4c2('0x76')](_0x18bbce);}else{return null;}})[_0xd4c2('0x29')](function(_0x36c759){var _0x9ebb31=_0x36c759;var _0x168628=null;if(_0x9ebb31){_0x168628=_0x9ebb31['length']===0x1?_0x9ebb31[0x0]:null;}if(_0x168628||_0x9ebb31){var _0x3ccdb1=db[_0x22e836['childModel']][_0xd4c2('0x31')];_0x26c21d[_0xd4c2('0x34')]=_[_0xd4c2('0x36')](_0x3ccdb1);_0x26c21d[_0xd4c2('0x35')]=_['keys'](_0x52f233[_0xd4c2('0x35')]);_0x26c21d[_0xd4c2('0x37')]=_[_0xd4c2('0x38')](_0x26c21d[_0xd4c2('0x34')],_0x26c21d['query']);_0x533a5e[_0xd4c2('0x39')]=_[_0xd4c2('0x38')](_0x26c21d[_0xd4c2('0x34')],qs['fields'](_0x52f233['query']['fields']));_0x533a5e[_0xd4c2('0x39')]=_0x533a5e[_0xd4c2('0x39')][_0xd4c2('0x4b')]?_0x533a5e[_0xd4c2('0x39')]:_0x26c21d[_0xd4c2('0x34')];if(!_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x3b')](_0xd4c2('0x3c'))){_0x533a5e['limit']=qs[_0xd4c2('0x3d')](_0x52f233['query'][_0xd4c2('0x3d')]);_0x533a5e[_0xd4c2('0x23')]=qs[_0xd4c2('0x23')](_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x23')]);}_0x533a5e[_0xd4c2('0x7a')]=qs[_0xd4c2('0x3e')](_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x3e')]);_0x533a5e[_0xd4c2('0x3f')]=qs[_0xd4c2('0x37')](_[_0xd4c2('0x40')](_0x52f233[_0xd4c2('0x35')],_0x26c21d[_0xd4c2('0x37')]));if(_0x52f233[_0xd4c2('0x35')]['filter']){_0x533a5e[_0xd4c2('0x3f')]=_['merge'](_0x533a5e[_0xd4c2('0x3f')],{'$or':_[_0xd4c2('0x2f')](_0x3ccdb1,function(_0x298395){if(_0x298395[_0xd4c2('0x33')][_0xd4c2('0x7b')]!=='VIRTUAL'){var _0x32a3e1={};_0x32a3e1[_0x298395[_0xd4c2('0x7c')]]={'$like':'%'+_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x41')]+'%'};return _0x32a3e1;}})});}var _0x17319c=[];if(_0x168628){var _0x4165e6=_[_0xd4c2('0x5a')](_0x5a4354,['name',_0x168628['name']]);if(_0x4165e6[_0xd4c2('0x7c')]){var _0x878f75={};if(_0x22e836['childModel']===_0xd4c2('0x7d')){_0x878f75[_0x4165e6[_0xd4c2('0x7e')]]=_[_0xd4c2('0x2f')](_0x168628[_0xd4c2('0x7f')],'id');}else{_0x878f75[_0x4165e6['foreignKey']]=_0x168628['associatedResources'];}_0x17319c[_0xd4c2('0x5f')](_0x878f75);}else{_0x533a5e[_0xd4c2('0x3f')]['id']=_0x168628[_0xd4c2('0x7f')];}}else{for(var _0x28c1f3=0x0;_0x28c1f3<_0x9ebb31[_0xd4c2('0x4b')];_0x28c1f3++){var _0x4165e6=_[_0xd4c2('0x5a')](_0x5a4354,['name',_0x9ebb31[_0x28c1f3][_0xd4c2('0x2c')]]);if(_0x4165e6['field']){var _0x878f75={};_0x878f75[_0x4165e6[_0xd4c2('0x7e')]]=_0x9ebb31[_0x28c1f3][_0xd4c2('0x7f')];_0x17319c[_0xd4c2('0x5f')](_0x878f75);}else{if(!_0x533a5e[_0xd4c2('0x3f')]['id'])_0x533a5e[_0xd4c2('0x3f')]['id']=[];_0x9ebb31[_0x28c1f3][_0xd4c2('0x7f')][_0xd4c2('0x69')](function(_0x389cfd){_0x533a5e[_0xd4c2('0x3f')]['id'][_0xd4c2('0x5f')](_0x389cfd);});}}}if(!_[_0xd4c2('0x64')](_0x17319c)){_0x533a5e[_0xd4c2('0x3f')]=_['merge'](_0x533a5e[_0xd4c2('0x3f')],{'$and':{'$or':_0x17319c}});}_0x533a5e=_[_0xd4c2('0x42')]({},_0x533a5e,_0x52f233[_0xd4c2('0x44')]);if(_0x168628&&!_0x168628['autoAssociation']&&_0x22e836['childModel']===_0xd4c2('0x7d')){if(_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x45')]){_0x533a5e[_0xd4c2('0x4c')]=[{'all':!![]}];}return db[_0x22e836[_0xd4c2('0x79')]][_0xd4c2('0x46')](_0x533a5e)['then'](function(_0x53d4f1){var _0x1b661b=[];_0x53d4f1[_0xd4c2('0x69')](function(_0x5d3bd9){var _0x77e11d;switch(_0x5d3bd9[_0xd4c2('0x80')]){case _0xd4c2('0x81'):_0x77e11d=_[_0xd4c2('0x5a')](_0x168628[_0xd4c2('0x7f')],function(_0x5c7c12){return _0x5c7c12['id']===_0x5d3bd9[_0xd4c2('0x82')]&&_0x5c7c12['type']===_0xd4c2('0x83');});break;case _0xd4c2('0x84'):_0x77e11d=_[_0xd4c2('0x5a')](_0x168628[_0xd4c2('0x7f')],function(_0x112ddd){return _0x112ddd['id']===_0x5d3bd9[_0xd4c2('0x82')]&&_0x112ddd[_0xd4c2('0x33')]===_0xd4c2('0x85');});break;}if(_0x77e11d)_0x1b661b['push'](_0x5d3bd9);});_0x5de7ed[_0xd4c2('0x22')]=_0x1b661b[_0xd4c2('0x4b')];_0x5de7ed[_0xd4c2('0x47')]=_0x1b661b;return _0x5de7ed;});}else{return db[_0x22e836['childModel']][_0xd4c2('0x22')]({'where':_0x533a5e[_0xd4c2('0x3f')]})[_0xd4c2('0x29')](function(_0x394722){_0x5de7ed[_0xd4c2('0x22')]=_0x394722;if(_0x52f233['query'][_0xd4c2('0x45')]){if(_0x22e836[_0xd4c2('0x79')]==='CmContact'){_0x533a5e['include']=[{'model':db[_0xd4c2('0x86')],'as':'Tags','attributes':['id','name',_0xd4c2('0x87')],'required':_0x52f233[_0xd4c2('0x35')]['tag']?!![]:![]},{'model':db[_0xd4c2('0x86')],'as':'ThroughTags','attributes':['id','name',_0xd4c2('0x87')],'through':_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x88')]?{'attributes':[],'where':{'TagId':_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x88')]||undefined}}:{},'required':_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x88')]?!![]:![]}];}else{_0x533a5e[_0xd4c2('0x4c')]=[{'all':!![]}];}}return db[_0x22e836[_0xd4c2('0x79')]][_0xd4c2('0x46')](_0x533a5e);})[_0xd4c2('0x29')](function(_0x439b73){_0x5de7ed[_0xd4c2('0x47')]=_0x439b73;return _0x5de7ed;});}}else{return _0x5de7ed;}})[_0xd4c2('0x29')](respondWithFilteredResult(_0x4257b2,_0x533a5e))[_0xd4c2('0x48')](handleError(_0x4257b2,null));};function getAllResources(_0x1d7568,_0x458d1c){return new BPromise(function(_0x5b0c79,_0x817820){if(_0x458d1c){var _0x244037=_0x458d1c[_0xd4c2('0x41')]?{[_0x458d1c['filter'][_0xd4c2('0x7c')]]:_0x458d1c[_0xd4c2('0x41')]['value']}:undefined;return db[_0x1d7568][_0xd4c2('0x46')]({'where':_0x244037,'raw':!![]})[_0xd4c2('0x29')](function(_0x42a37d){_0x458d1c[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x42a37d,'id');_0x5b0c79(_0x458d1c);})[_0xd4c2('0x48')](function(_0x444c6b){_0x817820(_0x444c6b);});}else{_0x5b0c79(null);}});}function getAllFilteredResources(_0x52430c,_0x6fd2c2){return new BPromise(function(_0x582caa,_0xf3e1e7){var _0x10512d=_0x52430c['filter']?{[_0x52430c[_0xd4c2('0x41')][_0xd4c2('0x7c')]]:_0x52430c[_0xd4c2('0x41')][_0xd4c2('0x89')]}:undefined;return db[_0x52430c['model']][_0xd4c2('0x46')]({'where':_0x10512d,'raw':!![]})['then'](function(_0x1a22a6){_0x6fd2c2[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1a22a6,function(_0x210412){return _0x210412[_0xd4c2('0x2c')];});_0x582caa(_0x6fd2c2);})[_0xd4c2('0x48')](function(_0x2c983d){_0xf3e1e7(_0x2c983d);});});}function getAllowedResources(_0x3bd912,_0x512789,_0xa82db1){return new BPromise(function(_0x386b27,_0x43a0e5){if(_0x512789){return db[_0xd4c2('0x56')]['findAll']({'where':{'sectionId':_0x512789['id']},'raw':!![]})[_0xd4c2('0x29')](function(_0x1dcdba){if(_0x3bd912[_0xd4c2('0x7c')]&&_0x3bd912[_0xd4c2('0x7c')]!=='id'){_0x512789[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1dcdba,function(_0x9345b6){return _0x9345b6[_0x3bd912[_0xd4c2('0x7c')]];});}else{if(_0xa82db1===_0xd4c2('0x7d')){_0x512789[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1dcdba,function(_0x12e79b){return{'id':_0x12e79b[_0xd4c2('0x6a')],'type':_0x12e79b[_0xd4c2('0x33')]};});}else{_0x512789[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1dcdba,function(_0x22e28d){return _0x22e28d[_0xd4c2('0x6a')];});}}_0x386b27(_0x512789);})[_0xd4c2('0x48')](function(_0x178140){_0x43a0e5(_0x178140);});}else{_0x386b27(null);}});}function getQueryModels(_0x34aebe,_0x4c188a){var _0x578eb2=_0x34aebe[_0xd4c2('0x8a')]();var _0x4810b9={'childModel':undefined,'parentSections':[]};switch(_0x578eb2){case _0xd4c2('0x8b'):_0x4810b9[_0xd4c2('0x79')]='SquareProject';break;case _0xd4c2('0x8c'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x8d');break;case _0xd4c2('0x8e'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x8f');_0x4810b9[_0xd4c2('0x75')]=[{'name':_0xd4c2('0x90'),'field':_0xd4c2('0x2c'),'foreignKey':'projectName'}];break;case _0xd4c2('0x91'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x92');break;case _0xd4c2('0x93'):_0x4810b9['childModel']=_0xd4c2('0x94');_0x4810b9[_0xd4c2('0x75')]=[{'name':'Lists','field':'id','foreignKey':_0xd4c2('0x95')}];break;case'lists':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x96');break;case _0xd4c2('0x97'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x98');break;case'globalcustomfields':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x99');break;case _0xd4c2('0x9a'):_0x4810b9[_0xd4c2('0x79')]='ChatQueue';break;case _0xd4c2('0x9b'):_0x4810b9[_0xd4c2('0x79')]='ChatWebsite';break;case _0xd4c2('0x9c'):_0x4810b9['childModel']='FaxQueue';break;case _0xd4c2('0x9d'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x9e');break;case'inboundroutes':case'internalroutes':case _0xd4c2('0x9f'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xa0');break;case _0xd4c2('0xa1'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xa2');break;case _0xd4c2('0xa3'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xa4');break;case _0xd4c2('0xa5'):_0x4810b9['childModel']=_0xd4c2('0xa6');_0x4810b9[_0xd4c2('0x75')]=[{'name':'Agents','field':_0xd4c2('0x2c'),'foreignKey':'membername','model':'User','filter':{'field':_0xd4c2('0xa7'),'value':[_0xd4c2('0xa8')]}},{'name':_0xd4c2('0xa9'),'field':_0xd4c2('0x2c'),'foreignKey':'membername','model':_0xd4c2('0xaa'),'filter':{'field':_0xd4c2('0xa7'),'value':[_0xd4c2('0xab')]}},{'name':_0xd4c2('0xac'),'field':'name','foreignKey':_0xd4c2('0xad'),'model':_0xd4c2('0xae'),'filter':{'field':_0xd4c2('0x33'),'value':[_0xd4c2('0xaf')]}},{'name':_0xd4c2('0xb0'),'field':_0xd4c2('0x2c'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xd4c2('0xb1')]}}];break;case'musiconholds':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb2');break;case _0xd4c2('0xb3'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb4');break;case _0xd4c2('0xb5'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb6');break;case _0xd4c2('0xb7'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb8');break;case'mailqueues':_0x4810b9['childModel']=_0xd4c2('0xb9');break;case _0xd4c2('0xba'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xbb');break;case'mailsubstatuses':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xbc');break;case _0xd4c2('0xbd'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xbe');break;case _0xd4c2('0xbf'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xc0');break;case _0xd4c2('0xc1'):_0x4810b9['childModel']=_0xd4c2('0xc2');break;case _0xd4c2('0xc3'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xc4');break;case _0xd4c2('0xc5'):_0x4810b9[_0xd4c2('0x79')]='WhatsappQueue';break;case _0xd4c2('0xc6'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xc7');break;case'teams':_0x4810b9[_0xd4c2('0x79')]='Team';break;case _0xd4c2('0xc8'):case _0xd4c2('0xc9'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xae');if(_0x4c188a){_0x4810b9['parentSections']=[{'name':_0xd4c2('0xac')},{'name':_0xd4c2('0xb0')}];}break;case _0xd4c2('0xca'):case _0xd4c2('0xcb'):case _0xd4c2('0xcc'):_0x4810b9['childModel']=_0xd4c2('0xaa');if(_0x4c188a){_0x4810b9[_0xd4c2('0x75')]=[{'name':'Users','filter':{'field':'role','value':[_0xd4c2('0xcd'),_0xd4c2('0xce')]},'ignore':!![]},{'name':_0xd4c2('0xcf')},{'name':_0xd4c2('0xa9')}];}break;case _0xd4c2('0xd0'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xd1');break;case _0xd4c2('0xd2'):_0x4810b9['childModel']=_0xd4c2('0xd3');break;case _0xd4c2('0xd4'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xd5');break;case _0xd4c2('0xd6'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xd7');break;case _0xd4c2('0xd8'):_0x4810b9[_0xd4c2('0x79')]='DeskAccount';break;case'zohoaccounts':_0x4810b9['childModel']=_0xd4c2('0xd9');break;case _0xd4c2('0xda'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xaa');break;case _0xd4c2('0xdb'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xdc');break;case'dispositions':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xdd');break;case _0xd4c2('0xde'):_0x4810b9['childModel']=_0xd4c2('0x68');break;case _0xd4c2('0xdf'):_0x4810b9['childModel']=_0xd4c2('0xe0');break;case _0xd4c2('0xe1'):_0x4810b9[_0xd4c2('0x79')]='Pause';break;case _0xd4c2('0xe2'):_0x4810b9['childModel']='Schedule';break;case'sounds':_0x4810b9['childModel']='Sound';break;case _0xd4c2('0xe3'):_0x4810b9[_0xd4c2('0x79')]='Tag';break;case _0xd4c2('0xe4'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xe5');break;case _0xd4c2('0xe6'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xe7');break;case _0xd4c2('0xe8'):_0x4810b9[_0xd4c2('0x79')]='Trunk';break;case _0xd4c2('0xe9'):_0x4810b9[_0xd4c2('0x79')]='Variable';break;case'plugins':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xea');break;case _0xd4c2('0xeb'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x7d');_0x4810b9[_0xd4c2('0x75')]=[{'name':_0xd4c2('0xec'),'field':'id','foreignKey':'reportId'}];break;case _0xd4c2('0xed'):_0x4810b9['childModel']=_0xd4c2('0xee');break;case'whatsappaccounts':_0x4810b9[_0xd4c2('0x79')]='WhatsappAccount';break;default:return _0x4810b9;}return _0x4810b9;} \ No newline at end of file +var _0x3cba=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','catch','clone','find','createdAt','updatedAt','omit','transaction','create','get','each','autoAssociation','UserProfileResource','userProfileId','Resources','UserProfileSection','describe','addSections','sequelize','removeSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','findOne','ignore','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','Tag','Tags','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projects','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','users','Users','admin','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','customdashboards','intervals','scheduler','Schedule','sounds','Sound','templates','Template','Trigger','trunks','Trunk','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x344bfa,_0x138105){var _0x1436bf=function(_0xdd81cc){while(--_0xdd81cc){_0x344bfa['push'](_0x344bfa['shift']());}};_0x1436bf(++_0x138105);}(_0x3cba,0xda));var _0xa3cb=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x3cba[_0x1098db];return _0x14f090;};'use strict';var pdf=require(_0xa3cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3cb('0x1'));var zipdir=require(_0xa3cb('0x2'));var jsonpatch=require(_0xa3cb('0x3'));var rp=require(_0xa3cb('0x4'));var moment=require('moment');var BPromise=require(_0xa3cb('0x5'));var Mustache=require('mustache');var util=require(_0xa3cb('0x6'));var path=require('path');var sox=require(_0xa3cb('0x7'));var csv=require(_0xa3cb('0x8'));var ejs=require(_0xa3cb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa3cb('0xa'));var crypto=require(_0xa3cb('0xb'));var jsforce=require(_0xa3cb('0xc'));var deskjs=require(_0xa3cb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa3cb('0xe'));var Papa=require(_0xa3cb('0xf'));var Redis=require('ioredis');var authService=require(_0xa3cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa3cb('0x11'));var hardwareService=require(_0xa3cb('0x12'));var logger=require(_0xa3cb('0x13'))('api');var utils=require(_0xa3cb('0x14'));var config=require(_0xa3cb('0x15'));var db=require(_0xa3cb('0x16'))['db'];config[_0xa3cb('0x17')]=_[_0xa3cb('0x18')](config[_0xa3cb('0x17')],{'host':_0xa3cb('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3cb('0x17')]));require(_0xa3cb('0x1a'))[_0xa3cb('0x1b')](socket);function respondWithStatusCode(_0x4c88ed,_0x3a972b){_0x3a972b=_0x3a972b||0xcc;return function(_0x19a2ab){if(_0x19a2ab){return _0x4c88ed[_0xa3cb('0x1c')](_0x3a972b);}return _0x4c88ed[_0xa3cb('0x1d')](_0x3a972b)[_0xa3cb('0x1e')]();};}function respondWithResult(_0x5368a6,_0xc864c6){_0xc864c6=_0xc864c6||0xc8;return function(_0x1705ba){if(_0x1705ba){return _0x5368a6[_0xa3cb('0x1d')](_0xc864c6)[_0xa3cb('0x1f')](_0x1705ba);}};}function respondWithFilteredResult(_0x4b9bdf,_0x2875f1){return function(_0x3e0002){if(_0x3e0002){var _0x317763=_0x3e0002[_0xa3cb('0x20')],_0x2cc6a6=_0x2875f1[_0xa3cb('0x21')],_0x20b38c=_0x2875f1[_0xa3cb('0x21')]+_0x2875f1[_0xa3cb('0x22')],_0x156eb7;if(_0x20b38c>=_0x317763){_0x20b38c=_0x317763;_0x156eb7=0xc8;}else{_0x156eb7=0xce;}_0x4b9bdf[_0xa3cb('0x1d')](_0x156eb7);return _0x4b9bdf['set'](_0xa3cb('0x23'),_0x2cc6a6+'-'+_0x20b38c+'/'+_0x317763)[_0xa3cb('0x1f')](_0x3e0002);}return null;};}function patchUpdates(_0x595c8e){return function(_0x1c30e5){try{jsonpatch[_0xa3cb('0x24')](_0x1c30e5,_0x595c8e,!![]);}catch(_0x449f72){return BPromise[_0xa3cb('0x25')](_0x449f72);}return _0x1c30e5[_0xa3cb('0x26')]();};}function saveUpdates(_0x22c6a7,_0x2a4269){return function(_0x39e5fa){if(_0x39e5fa){return _0x39e5fa['update'](_0x22c6a7)[_0xa3cb('0x27')](function(_0x2ffa94){return _0x2ffa94;});}return null;};}function removeEntity(_0x114e4d,_0xa61dc7){return function(_0x2cc890){if(_0x2cc890){return _0x2cc890[_0xa3cb('0x28')]()[_0xa3cb('0x27')](function(){_0x114e4d[_0xa3cb('0x1d')](0xcc)[_0xa3cb('0x1e')]();});}};}function handleEntityNotFound(_0x19ceb1,_0xc78265){return function(_0x59a36b){if(!_0x59a36b){_0x19ceb1[_0xa3cb('0x1c')](0x194);}return _0x59a36b;};}function handleError(_0xb5f795,_0x59c94d){_0x59c94d=_0x59c94d||0x1f4;return function(_0x57de10){logger[_0xa3cb('0x29')](_0x57de10[_0xa3cb('0x2a')]);if(_0x57de10[_0xa3cb('0x2b')]){delete _0x57de10[_0xa3cb('0x2b')];}_0xb5f795[_0xa3cb('0x1d')](_0x59c94d)[_0xa3cb('0x2c')](_0x57de10);};}exports['index']=function(_0x451cd6,_0x311f4a){var _0x340ceb={},_0x6550ab={},_0x31040d={'count':0x0,'rows':[]};var _0xe5df1a=_['map'](db[_0xa3cb('0x2d')][_0xa3cb('0x2e')],function(_0x1045c7){return{'name':_0x1045c7[_0xa3cb('0x2f')],'type':_0x1045c7[_0xa3cb('0x30')][_0xa3cb('0x31')]};});_0x6550ab[_0xa3cb('0x32')]=_[_0xa3cb('0x33')](_0xe5df1a,_0xa3cb('0x2b'));_0x6550ab[_0xa3cb('0x34')]=_[_0xa3cb('0x35')](_0x451cd6[_0xa3cb('0x34')]);_0x6550ab[_0xa3cb('0x36')]=_['intersection'](_0x6550ab[_0xa3cb('0x32')],_0x6550ab[_0xa3cb('0x34')]);_0x340ceb[_0xa3cb('0x37')]=_[_0xa3cb('0x38')](_0x6550ab[_0xa3cb('0x32')],qs[_0xa3cb('0x39')](_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x39')]));_0x340ceb[_0xa3cb('0x37')]=_0x340ceb[_0xa3cb('0x37')][_0xa3cb('0x3a')]?_0x340ceb[_0xa3cb('0x37')]:_0x6550ab['model'];if(!_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x3b')](_0xa3cb('0x3c'))){_0x340ceb[_0xa3cb('0x22')]=qs[_0xa3cb('0x22')](_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x22')]);_0x340ceb[_0xa3cb('0x21')]=qs[_0xa3cb('0x21')](_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x21')]);}_0x340ceb[_0xa3cb('0x3d')]=qs[_0xa3cb('0x3e')](_0x451cd6['query'][_0xa3cb('0x3e')]);_0x340ceb[_0xa3cb('0x3f')]=qs[_0xa3cb('0x36')](_[_0xa3cb('0x40')](_0x451cd6[_0xa3cb('0x34')],_0x6550ab[_0xa3cb('0x36')]),_0xe5df1a);if(_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x41')]){_0x340ceb[_0xa3cb('0x3f')]=_[_0xa3cb('0x42')](_0x340ceb[_0xa3cb('0x3f')],{'$or':_[_0xa3cb('0x33')](_0xe5df1a,function(_0x29b3ed){if(_0x29b3ed[_0xa3cb('0x30')]!==_0xa3cb('0x43')){var _0x33c588={};_0x33c588[_0x29b3ed['name']]={'$like':'%'+_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x41')]+'%'};return _0x33c588;}})});}_0x340ceb=_[_0xa3cb('0x42')]({},_0x340ceb,_0x451cd6[_0xa3cb('0x44')]);var _0x110860={'where':_0x340ceb[_0xa3cb('0x3f')]};return db[_0xa3cb('0x2d')][_0xa3cb('0x20')](_0x110860)[_0xa3cb('0x27')](function(_0x5883b1){_0x31040d[_0xa3cb('0x20')]=_0x5883b1;if(_0x451cd6[_0xa3cb('0x34')][_0xa3cb('0x45')]){_0x340ceb[_0xa3cb('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0xa3cb('0x47')](_0x340ceb);})[_0xa3cb('0x27')](function(_0x19e7d1){_0x31040d[_0xa3cb('0x48')]=_0x19e7d1;return _0x31040d;})[_0xa3cb('0x27')](respondWithFilteredResult(_0x311f4a,_0x340ceb))['catch'](handleError(_0x311f4a,null));};exports[_0xa3cb('0x49')]=function(_0x47dd58,_0x878272){var _0x27e290={'raw':![],'where':{'id':_0x47dd58[_0xa3cb('0x4a')]['id']}},_0x3215e6={};_0x3215e6[_0xa3cb('0x32')]=_[_0xa3cb('0x35')](db['UserProfile']['rawAttributes']);_0x3215e6[_0xa3cb('0x34')]=_['keys'](_0x47dd58['query']);_0x3215e6['filters']=_['intersection'](_0x3215e6[_0xa3cb('0x32')],_0x3215e6['query']);_0x27e290[_0xa3cb('0x37')]=_['intersection'](_0x3215e6[_0xa3cb('0x32')],qs[_0xa3cb('0x39')](_0x47dd58[_0xa3cb('0x34')][_0xa3cb('0x39')]));_0x27e290[_0xa3cb('0x37')]=_0x27e290[_0xa3cb('0x37')][_0xa3cb('0x3a')]?_0x27e290['attributes']:_0x3215e6[_0xa3cb('0x32')];if(_0x47dd58[_0xa3cb('0x34')]['includeAll']){_0x27e290['include']=[{'all':!![]}];}_0x27e290=_[_0xa3cb('0x42')]({},_0x27e290,_0x47dd58[_0xa3cb('0x44')]);return db[_0xa3cb('0x2d')]['find'](_0x27e290)[_0xa3cb('0x27')](handleEntityNotFound(_0x878272,null))[_0xa3cb('0x27')](respondWithResult(_0x878272,null))['catch'](handleError(_0x878272,null));};exports['create']=function(_0x3b9ce3,_0x4437e9){return db[_0xa3cb('0x2d')]['create'](_0x3b9ce3[_0xa3cb('0x4b')],{})[_0xa3cb('0x27')](respondWithResult(_0x4437e9,0xc9))[_0xa3cb('0x4c')](handleError(_0x4437e9,null));};exports[_0xa3cb('0x4d')]=function(_0x1f8868,_0x467828){var _0x1360dc={'where':{'id':_0x1f8868[_0xa3cb('0x4a')]['id']}},_0x13fadc={};_0x13fadc['model']=_['keys'](db['UserProfile'][_0xa3cb('0x2e')]);_0x1360dc[_0xa3cb('0x37')]=_['intersection'](_0x13fadc[_0xa3cb('0x32')],qs['fields'](_0x1f8868[_0xa3cb('0x34')]['fields']));_0x1360dc['attributes']=_0x1360dc['attributes']['length']?_0x1360dc[_0xa3cb('0x37')]:_0x13fadc[_0xa3cb('0x32')];if(_0x1f8868[_0xa3cb('0x34')][_0xa3cb('0x45')]){_0x1360dc[_0xa3cb('0x46')]=[{'all':!![]}];}_0x1360dc=_[_0xa3cb('0x42')]({},_0x1360dc,_0x1f8868[_0xa3cb('0x44')]);return db[_0xa3cb('0x2d')][_0xa3cb('0x4e')](_0x1360dc)['then'](handleEntityNotFound(_0x467828,null))[_0xa3cb('0x27')](function(_0x28affa){if(_0x28affa){var _0x24231e=_0x28affa['get']({'plain':!![]});_0x24231e=qs['omit'](_0x24231e,['id',_0xa3cb('0x4f'),_0xa3cb('0x50'),'crudPermissions']);_0x1f8868[_0xa3cb('0x4b')]=_[_0xa3cb('0x51')](_0x1f8868[_0xa3cb('0x4b')],['id',_0xa3cb('0x4f'),_0xa3cb('0x50')]);return db['sequelize'][_0xa3cb('0x52')](function(_0x4d1c34){return db[_0xa3cb('0x2d')][_0xa3cb('0x53')](_[_0xa3cb('0x42')](_0x24231e,_0x1f8868[_0xa3cb('0x4b')]),{'include':_0x1f8868[_0xa3cb('0x34')][_0xa3cb('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x4d1c34})['then'](function(_0x13876a){var _0x1f4c87=_0x13876a[_0xa3cb('0x54')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1f8868['params']['id']},'raw':!![]})[_0xa3cb('0x27')](function(_0x29e131){if(_0x29e131){return BPromise[_0xa3cb('0x55')](_0x29e131,function(_0x1b045c){return new BPromise(function(_0x2a12f6,_0x4fabfc){if(_0x1b045c[_0xa3cb('0x56')]===null||_0x1b045c[_0xa3cb('0x56')]===0x1)_0x2a12f6(null);return db[_0xa3cb('0x57')][_0xa3cb('0x47')]({'where':{'sectionId':_0x1b045c['id']},'raw':!![]})[_0xa3cb('0x27')](function(_0x508030){var _0x3fabe7=_[_0xa3cb('0x33')](_0x508030,function(_0x466e0e){return qs[_0xa3cb('0x51')](_0x466e0e,['id','createdAt',_0xa3cb('0x50'),'sectionId']);});_0x2a12f6(_0x3fabe7);})[_0xa3cb('0x4c')](function(_0x120d8c){_0x4fabfc(_0x120d8c);});})[_0xa3cb('0x27')](function(_0x5dec38){var _0x2e633b=qs['omit'](_0x1b045c,['id',_0xa3cb('0x4f'),_0xa3cb('0x50')]);_0x2e633b[_0xa3cb('0x58')]=_0x1f4c87['id'];if(_0x5dec38)_0x2e633b[_0xa3cb('0x59')]=_0x5dec38;return _0x2e633b;})[_0xa3cb('0x27')](function(_0x2822dc){return db[_0xa3cb('0x5a')][_0xa3cb('0x53')](_0x2822dc,{'include':[{'model':db[_0xa3cb('0x57')],'as':_0xa3cb('0x59')}],'raw':!![],'transaction':_0x4d1c34});});})['then'](function(){return _0x1f4c87;});}});});});}})[_0xa3cb('0x27')](respondWithResult(_0x467828,0xc9))[_0xa3cb('0x4c')](handleError(_0x467828,null));};exports['update']=function(_0x83666d,_0xcafc63){if(_0x83666d[_0xa3cb('0x4b')]['id']){delete _0x83666d['body']['id'];}return db[_0xa3cb('0x2d')][_0xa3cb('0x4e')]({'where':{'id':_0x83666d[_0xa3cb('0x4a')]['id']}})[_0xa3cb('0x27')](handleEntityNotFound(_0xcafc63,null))[_0xa3cb('0x27')](saveUpdates(_0x83666d[_0xa3cb('0x4b')],null))[_0xa3cb('0x27')](respondWithResult(_0xcafc63,null))['catch'](handleError(_0xcafc63,null));};exports[_0xa3cb('0x28')]=function(_0x14e7ae,_0xc1cd24){return db[_0xa3cb('0x2d')]['find']({'where':{'id':_0x14e7ae[_0xa3cb('0x4a')]['id']}})[_0xa3cb('0x27')](handleEntityNotFound(_0xc1cd24,null))[_0xa3cb('0x27')](removeEntity(_0xc1cd24,null))['catch'](handleError(_0xc1cd24,null));};exports[_0xa3cb('0x5b')]=function(_0x251e02,_0x29fe46){return db[_0xa3cb('0x2d')]['describe']()[_0xa3cb('0x27')](respondWithResult(_0x29fe46,null))['catch'](handleError(_0x29fe46,null));};exports[_0xa3cb('0x5c')]=function(_0x5446ac,_0x57b382){var _0xcce627=_0x5446ac[_0xa3cb('0x4b')];return db['UserProfile'][_0xa3cb('0x4e')]({'where':{'id':_0x5446ac[_0xa3cb('0x4a')]['id']}})[_0xa3cb('0x27')](handleEntityNotFound(_0x57b382,null))[_0xa3cb('0x27')](function(_0x348900){if(_0x348900){return db[_0xa3cb('0x5d')][_0xa3cb('0x52')](function(_0x48e4b0){return db[_0xa3cb('0x5a')]['destroy']({'where':{'userProfileId':_0x5446ac['params']['id'],'sectionId':_[_0xa3cb('0x33')](_0xcce627,function(_0x510b4f){return _0x510b4f['sectionId'];})},'transaction':_0x48e4b0})[_0xa3cb('0x27')](function(){var _0x4c79c6=_[_0xa3cb('0x33')](_0xcce627,function(_0x2fc7e1){_0x2fc7e1[_0xa3cb('0x58')]=_0x5446ac[_0xa3cb('0x4a')]['id'];return _0x2fc7e1;});var _0x1c4544=[];return BPromise[_0xa3cb('0x55')](_0x4c79c6,function(_0x33dff0){return db[_0xa3cb('0x5a')][_0xa3cb('0x53')](_0x33dff0,{'include':[{'model':db[_0xa3cb('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x48e4b0})[_0xa3cb('0x27')](function(_0x497ab2){_0x1c4544['push'](_0x497ab2[_0xa3cb('0x54')]({'plain':!![]}));});})[_0xa3cb('0x27')](function(){return _0x1c4544;});});});}})[_0xa3cb('0x27')](function(_0x4344bf){return _0x4344bf;})[_0xa3cb('0x27')](respondWithResult(_0x57b382,null))[_0xa3cb('0x4c')](handleError(_0x57b382,null));};exports[_0xa3cb('0x5e')]=function(_0x14960a,_0x56bd3d){var _0x336f4a;return db[_0xa3cb('0x2d')][_0xa3cb('0x4e')]({'where':{'id':_0x14960a[_0xa3cb('0x4a')]['id']},'attributes':['id',_0xa3cb('0x2b')]})[_0xa3cb('0x27')](handleEntityNotFound(_0x56bd3d,null))[_0xa3cb('0x27')](function(_0x1e0e2d){if(_0x1e0e2d){_0x336f4a=_0x1e0e2d;return db[_0xa3cb('0x5a')][_0xa3cb('0x28')]({'where':{'userProfileId':_0x14960a[_0xa3cb('0x4a')]['id'],'sectionId':_0x14960a[_0xa3cb('0x34')][_0xa3cb('0x5f')]}});}})[_0xa3cb('0x27')](function(){return _0x336f4a;})[_0xa3cb('0x27')](respondWithStatusCode(_0x56bd3d,null))[_0xa3cb('0x4c')](handleError(_0x56bd3d,null));};exports[_0xa3cb('0x60')]=function(_0x48249e,_0x45fd0e){var _0x15dca2=[];var _0x2532d4=[];return db['UserProfileSection'][_0xa3cb('0x47')]({'where':{'userProfileId':_0x48249e[_0xa3cb('0x4a')]['id']},'raw':!![]})[_0xa3cb('0x27')](function(_0x242b5b){_0x15dca2=_[_0xa3cb('0x41')](_0x242b5b,function(_0x2f4899){return _0x2f4899[_0xa3cb('0x61')]===0x1||_[_0xa3cb('0x62')]([0x3eb,0x709],_0x2f4899[_0xa3cb('0x63')]);});if(!_[_0xa3cb('0x64')](_0x15dca2)){return _['map'](_0x15dca2,function(_0x2c0d2d){return _0x2c0d2d[_0xa3cb('0x63')];});}else{return;}})['then'](function(_0x5439d3){if(_0x5439d3)_0x2532d4=_0x5439d3;if(_[_0xa3cb('0x62')](_0x2532d4,0x64)){var _0x1b46e9=_['find'](_0x15dca2,{'sectionId':0x64});return hasDefaultDashboard(_0x1b46e9)[_0xa3cb('0x27')](function(_0x1a033f){return _[_0xa3cb('0x33')](_0x15dca2,function(_0x69fcc){if(_0x69fcc[_0xa3cb('0x63')]===0x64){_0x69fcc[_0xa3cb('0x65')]=_0x1a033f;}return _0x69fcc;});});}else{return;}})[_0xa3cb('0x27')](function(_0x54f2b3){if(_0x54f2b3)_0x15dca2=_0x54f2b3;if(_[_0xa3cb('0x62')](_0x2532d4,0x3eb)){var _0xe0f3f3=_[_0xa3cb('0x4e')](_0x15dca2,{'sectionId':0x3eb});return getCustomDashboards(_0xe0f3f3)[_0xa3cb('0x27')](function(_0x28f9cb){return _['map'](_0x15dca2,function(_0x11ec29){if(_0xe0f3f3[_0xa3cb('0x61')]){if(_0x11ec29[_0xa3cb('0x63')]===0x3eb){_0x11ec29[_0xa3cb('0x65')]=_0x28f9cb;}}else{if(_0x11ec29[_0xa3cb('0x63')]===0x64){_0x11ec29[_0xa3cb('0x65')]=_0x28f9cb;}}return _0x11ec29;});});}else{return;}})['then'](function(_0x4d1b47){if(_0x4d1b47)_0x15dca2=_0x4d1b47;if(_[_0xa3cb('0x62')](_0x2532d4,0x709)){var _0x29624b=_[_0xa3cb('0x4e')](_0x15dca2,{'sectionId':0x709});return getPlugins(_0x29624b)[_0xa3cb('0x27')](function(_0x394895){if(_0x29624b[_0xa3cb('0x61')]){return _[_0xa3cb('0x33')](_0x15dca2,function(_0x3d71c2){if(_0x3d71c2['sectionId']===0x709){_0x3d71c2['subsections']=_0x394895;}return _0x3d71c2;});}else{var _0x235e67={'sectionId':0x76c,'enabled':0x1,'subsections':_0x394895};var _0x182192=_[_0xa3cb('0x33')](_0x15dca2);_0x182192[_0xa3cb('0x66')](_0x235e67);return _0x182192;}});}else{return;}})[_0xa3cb('0x27')](function(_0x2bd60d){if(_0x2bd60d)_0x15dca2=_0x2bd60d;return _[_0xa3cb('0x41')](_0x15dca2,['enabled',0x1]);})[_0xa3cb('0x27')](respondWithResult(_0x45fd0e,null))[_0xa3cb('0x4c')](handleError(_0x45fd0e,null));};function hasDefaultDashboard(_0x5eae0b){var _0x276fe7=[0x65];return new BPromise(function(_0x1a11b5,_0x5bd746){try{if(_0x5eae0b['autoAssociation']){_0x1a11b5(_0x276fe7);}else{return db[_0xa3cb('0x57')]['findOne']({'where':{'sectionId':_0x5eae0b['id']},'raw':!![]})['then'](function(_0x267fda){_0x267fda?_0x1a11b5(_0x276fe7):_0x1a11b5();});}}catch(_0x21ef56){_0x5bd746(_0x21ef56);}});}function getCustomDashboards(_0x4a04fa){var _0x5b695b=[];return new BPromise(function(_0x4ac0a7,_0x4d85ae){try{if(_0x4a04fa[_0xa3cb('0x56')]){return db[_0xa3cb('0x67')][_0xa3cb('0x47')]({'raw':!![]})[_0xa3cb('0x27')](function(_0x11e9d0){_0x11e9d0[_0xa3cb('0x68')](function(_0x535cb4){_0x5b695b[_0xa3cb('0x66')](_0x535cb4['id']+0x1869f);});_0x4ac0a7(_0x5b695b);});}else{return db[_0xa3cb('0x57')][_0xa3cb('0x47')]({'where':{'sectionId':_0x4a04fa['id']},'raw':!![]})[_0xa3cb('0x27')](function(_0x240478){_0x240478[_0xa3cb('0x68')](function(_0x597a3e){_0x5b695b[_0xa3cb('0x66')](_0x597a3e[_0xa3cb('0x69')]+0x1869f);});_0x4ac0a7(_0x5b695b);});}}catch(_0x3f9a1c){_0x4d85ae(_0x3f9a1c);}});}function getPlugins(_0x39b38f){var _0x4fc82d=[];return new BPromise(function(_0x19ce2f,_0x2f3c7f){try{if(_0x39b38f[_0xa3cb('0x56')]){return db[_0xa3cb('0x6a')][_0xa3cb('0x47')]({'raw':!![]})[_0xa3cb('0x27')](function(_0x46ce19){_0x46ce19[_0xa3cb('0x68')](function(_0xfac1ce){_0x4fc82d[_0xa3cb('0x66')](_0xfac1ce['id']+0x15b38);});_0x19ce2f(_0x4fc82d);});}else{return db[_0xa3cb('0x57')]['findAll']({'where':{'sectionId':_0x39b38f['id']},'raw':!![]})[_0xa3cb('0x27')](function(_0x47c3b9){_0x47c3b9[_0xa3cb('0x68')](function(_0x5c7057){_0x4fc82d[_0xa3cb('0x66')](_0x5c7057[_0xa3cb('0x69')]+0x15b38);});_0x19ce2f(_0x4fc82d);});}}catch(_0xedd493){_0x2f3c7f(_0xedd493);}});}exports[_0xa3cb('0x6b')]=function(_0x5b47ee,_0x1fc31e){return db[_0xa3cb('0x2d')][_0xa3cb('0x4e')]({'where':{'id':_0x5b47ee[_0xa3cb('0x4a')]['id']}})[_0xa3cb('0x27')](handleEntityNotFound(_0x1fc31e,null))[_0xa3cb('0x27')](function(_0x520136){if(_0x520136){return db['sequelize'][_0xa3cb('0x52')](function(_0xd2c73d){return db[_0xa3cb('0x5a')][_0xa3cb('0x47')]({'where':{'userProfileId':_0x5b47ee[_0xa3cb('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xa3cb('0x27')](function(_0x22c75b){if(_0x22c75b){return db[_0xa3cb('0x5a')]['destroy']({'where':{'userProfileId':_0x5b47ee['params']['id'],'id':_[_0xa3cb('0x33')](_0x22c75b,function(_0x50f489){return _0x50f489['id'];})},'transaction':_0xd2c73d});}})['then'](function(_0x1335f9){var _0x3deefb=_[_0xa3cb('0x33')](_0x5b47ee['body'],function(_0xa10682){_0xa10682[_0xa3cb('0x58')]=_0x5b47ee[_0xa3cb('0x4a')]['id'];return _0xa10682;});return db[_0xa3cb('0x5a')][_0xa3cb('0x6c')](_0x3deefb,{'raw':!![],'transaction':_0xd2c73d});})[_0xa3cb('0x27')](function(_0x52aa46){var _0x393fb0=_['filter'](_['map'](_0x52aa46,function(_0x231045){return _0x231045['get']({'plain':!![]});}),{'includeAll':![]});if(_0x393fb0){return db[_0xa3cb('0x5a')][_0xa3cb('0x47')]({'where':{'userProfileId':_0x5b47ee['params']['id'],'sectionId':_[_0xa3cb('0x33')](_0x393fb0,function(_0x166f25){return _0x166f25[_0xa3cb('0x63')];})},'attributes':['id',_0xa3cb('0x63')],'raw':!![]})[_0xa3cb('0x27')](function(_0x5a4952){var _0x14f6de=_['map'](_0x5b47ee[_0xa3cb('0x4b')],function(_0x318210){_0x318210[_0xa3cb('0x58')]=_0x5b47ee[_0xa3cb('0x4a')]['id'];return _0x318210;});return db[_0xa3cb('0x57')][_0xa3cb('0x6c')](_0x14f6de,{'raw':!![],'transaction':_0xd2c73d});});}})['catch'](handleError(_0x1fc31e,null));});}})['then'](function(_0x362364){var _0x3398d8=_['map'](_0x362364,function(_0x594ddd){return _0x594ddd[_0xa3cb('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x1fc31e,null))[_0xa3cb('0x4c')](handleError(_0x1fc31e,null));};exports[_0xa3cb('0x6d')]=function(_0x192c00,_0x385098,_0x17bef8){return db[_0xa3cb('0x2d')]['find']({'where':{'id':_0x192c00[_0xa3cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x385098,null))[_0xa3cb('0x27')](function(_0x331138){if(_0x331138){return _0x331138[_0xa3cb('0x6d')](_0x192c00['query'][_0xa3cb('0x5f')]);}})[_0xa3cb('0x27')](respondWithStatusCode(_0x385098,null))['catch'](handleError(_0x385098,null));};exports[_0xa3cb('0x6e')]=function(_0x212aef,_0x53fdfe){var _0xa6922d={'raw':![],'where':{}};var _0x2f2ad8={};var _0x562de8={'count':0x0,'rows':[]};var _0x2ebeb9=_0x212aef['query'][_0xa3cb('0x6f')];if(typeof _0x2ebeb9===_0xa3cb('0x70')){throw new db['Sequelize'][(_0xa3cb('0x71'))](_0xa3cb('0x72'));}var _0x53c569=_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x73')]||![];var _0x47c7e3=getQueryModels(_0x2ebeb9,_0x53c569);if(typeof _0x47c7e3[_0xa3cb('0x74')]===_0xa3cb('0x70')){throw new db['Sequelize'][(_0xa3cb('0x71'))](_0xa3cb('0x75')+_0x2ebeb9+'\x27');}var _0x19cf8d=[];if(!_['isEmpty'](_0x47c7e3[_0xa3cb('0x76')])){_0x19cf8d=_0x47c7e3[_0xa3cb('0x76')];}else{_0x19cf8d=[{'name':_0x2ebeb9}];}return db[_0xa3cb('0x2d')][_0xa3cb('0x77')]({'where':{'id':_0x212aef[_0xa3cb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53fdfe,null))[_0xa3cb('0x27')](function(_0x25585b){if(_0x25585b){var _0x3b1cfa=[];for(var _0xbbf5af=0x0;_0xbbf5af<_0x19cf8d[_0xa3cb('0x3a')];_0xbbf5af++){_0x3b1cfa['push'](db[_0xa3cb('0x5a')][_0xa3cb('0x77')]({'where':{'userProfileId':_0x25585b['id'],'name':_0x19cf8d[_0xbbf5af]['name']},'raw':!![]}));}return BPromise['all'](_0x3b1cfa);}})[_0xa3cb('0x27')](function(_0x5ef7c4){var _0x128c68=_[_0xa3cb('0x41')](_0x5ef7c4,function(_0x1edfc6){return _0x1edfc6?_0x1edfc6:undefined;});var _0xe592d5=_[_0xa3cb('0x41')](_0x19cf8d,[_0xa3cb('0x78'),!![]]);var _0xaf3f6e=_[_0xa3cb('0x64')](_0x128c68)&&_[_0xa3cb('0x64')](_0xe592d5)?null:_['union'](_0xe592d5,_0x128c68);if(_0xaf3f6e){var _0x5c6461=[];for(var _0x3b7fa0=0x0;_0x3b7fa0<_0xaf3f6e[_0xa3cb('0x3a')];_0x3b7fa0++){var _0x482074=_[_0xa3cb('0x4e')](_0x19cf8d,function(_0x412704){return _0xaf3f6e[_0x3b7fa0]?_0x412704[_0xa3cb('0x2b')]===_0xaf3f6e[_0x3b7fa0][_0xa3cb('0x2b')]:null;});if(_0x482074){if(_0xaf3f6e[_0x3b7fa0][_0xa3cb('0x78')]){_0x5c6461[_0xa3cb('0x66')](getAllResources(_0x47c7e3[_0xa3cb('0x74')],_0xaf3f6e[_0x3b7fa0]));}else{if(!_0xaf3f6e[_0x3b7fa0]['autoAssociation']){_0x5c6461['push'](getAllowedResources(_0x482074,_0xaf3f6e[_0x3b7fa0],_0x47c7e3[_0xa3cb('0x74')]));}else{if(_0x482074[_0xa3cb('0x32')]){_0x5c6461[_0xa3cb('0x66')](getAllFilteredResources(_0x482074,_0xaf3f6e[_0x3b7fa0]));}}}}}return BPromise['all'](_0x5c6461);}else{return null;}})['then'](function(_0x4d8be5){var _0x56b0c1=_0x4d8be5;var _0x395f3d=null;if(_0x56b0c1){_0x395f3d=_0x56b0c1['length']===0x1?_0x56b0c1[0x0]:null;}if(_0x395f3d||_0x56b0c1){var _0x583461=db[_0x47c7e3[_0xa3cb('0x74')]][_0xa3cb('0x2e')];_0x2f2ad8[_0xa3cb('0x32')]=_[_0xa3cb('0x35')](_0x583461);_0x2f2ad8[_0xa3cb('0x34')]=_[_0xa3cb('0x35')](_0x212aef['query']);_0x2f2ad8['filters']=_[_0xa3cb('0x38')](_0x2f2ad8[_0xa3cb('0x32')],_0x2f2ad8[_0xa3cb('0x34')]);_0xa6922d[_0xa3cb('0x37')]=_[_0xa3cb('0x38')](_0x2f2ad8[_0xa3cb('0x32')],qs[_0xa3cb('0x39')](_0x212aef['query'][_0xa3cb('0x39')]));_0xa6922d[_0xa3cb('0x37')]=_0xa6922d['attributes'][_0xa3cb('0x3a')]?_0xa6922d[_0xa3cb('0x37')]:_0x2f2ad8[_0xa3cb('0x32')];if(!_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x3b')](_0xa3cb('0x3c'))){_0xa6922d[_0xa3cb('0x22')]=qs[_0xa3cb('0x22')](_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x22')]);_0xa6922d[_0xa3cb('0x21')]=qs[_0xa3cb('0x21')](_0x212aef[_0xa3cb('0x34')]['offset']);}_0xa6922d[_0xa3cb('0x3d')]=qs[_0xa3cb('0x3e')](_0x212aef['query'][_0xa3cb('0x3e')]);_0xa6922d[_0xa3cb('0x3f')]=qs['filters'](_['pick'](_0x212aef[_0xa3cb('0x34')],_0x2f2ad8[_0xa3cb('0x36')]));if(_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x41')]){_0xa6922d[_0xa3cb('0x3f')]=_[_0xa3cb('0x42')](_0xa6922d[_0xa3cb('0x3f')],{'$or':_[_0xa3cb('0x33')](_0x583461,function(_0xeea7bd){if(_0xeea7bd[_0xa3cb('0x30')][_0xa3cb('0x31')]!==_0xa3cb('0x43')){var _0x1ce29d={};_0x1ce29d[_0xeea7bd['field']]={'$like':'%'+_0x212aef['query'][_0xa3cb('0x41')]+'%'};return _0x1ce29d;}})});}var _0x25449c=[];if(_0x395f3d){var _0x1ca9f4=_[_0xa3cb('0x4e')](_0x19cf8d,[_0xa3cb('0x2b'),_0x395f3d[_0xa3cb('0x2b')]]);if(_0x1ca9f4[_0xa3cb('0x79')]){var _0x3add47={};if(_0x47c7e3[_0xa3cb('0x74')]===_0xa3cb('0x7a')){_0x3add47[_0x1ca9f4[_0xa3cb('0x7b')]]=_[_0xa3cb('0x33')](_0x395f3d[_0xa3cb('0x7c')],'id');}else{_0x3add47[_0x1ca9f4[_0xa3cb('0x7b')]]=_0x395f3d['associatedResources'];}_0x25449c[_0xa3cb('0x66')](_0x3add47);}else{_0xa6922d[_0xa3cb('0x3f')]['id']=_0x395f3d[_0xa3cb('0x7c')];}}else{for(var _0x38244c=0x0;_0x38244c<_0x56b0c1[_0xa3cb('0x3a')];_0x38244c++){var _0x1ca9f4=_[_0xa3cb('0x4e')](_0x19cf8d,['name',_0x56b0c1[_0x38244c]['name']]);if(_0x1ca9f4[_0xa3cb('0x79')]){var _0x3add47={};_0x3add47[_0x1ca9f4[_0xa3cb('0x7b')]]=_0x56b0c1[_0x38244c][_0xa3cb('0x7c')];_0x25449c['push'](_0x3add47);}else{if(!_0xa6922d['where']['id'])_0xa6922d[_0xa3cb('0x3f')]['id']=[];_0x56b0c1[_0x38244c][_0xa3cb('0x7c')][_0xa3cb('0x68')](function(_0x38f1ef){_0xa6922d[_0xa3cb('0x3f')]['id'][_0xa3cb('0x66')](_0x38f1ef);});}}}if(!_[_0xa3cb('0x64')](_0x25449c)){_0xa6922d[_0xa3cb('0x3f')]=_[_0xa3cb('0x42')](_0xa6922d[_0xa3cb('0x3f')],{'$and':{'$or':_0x25449c}});}_0xa6922d=_['merge']({},_0xa6922d,_0x212aef[_0xa3cb('0x44')]);if(_0x395f3d&&!_0x395f3d[_0xa3cb('0x56')]&&_0x47c7e3[_0xa3cb('0x74')]===_0xa3cb('0x7a')){if(_0x212aef['query'][_0xa3cb('0x45')]){_0xa6922d[_0xa3cb('0x46')]=[{'all':!![]}];}return db[_0x47c7e3[_0xa3cb('0x74')]][_0xa3cb('0x47')](_0xa6922d)[_0xa3cb('0x27')](function(_0x595f2c){var _0x58ce33=[];_0x595f2c[_0xa3cb('0x68')](function(_0x225352){var _0x576acc;switch(_0x225352[_0xa3cb('0x7d')]){case _0xa3cb('0x7e'):_0x576acc=_[_0xa3cb('0x4e')](_0x395f3d[_0xa3cb('0x7c')],function(_0x4e71d4){return _0x4e71d4['id']===_0x225352[_0xa3cb('0x7f')]&&_0x4e71d4[_0xa3cb('0x30')]===_0xa3cb('0x80');});break;case'custom':_0x576acc=_[_0xa3cb('0x4e')](_0x395f3d[_0xa3cb('0x7c')],function(_0x109468){return _0x109468['id']===_0x225352[_0xa3cb('0x7f')]&&_0x109468[_0xa3cb('0x30')]===_0xa3cb('0x81');});break;}if(_0x576acc)_0x58ce33['push'](_0x225352);});_0x562de8[_0xa3cb('0x20')]=_0x58ce33[_0xa3cb('0x3a')];_0x562de8[_0xa3cb('0x48')]=_0x58ce33;return _0x562de8;});}else{return db[_0x47c7e3['childModel']][_0xa3cb('0x20')]({'where':_0xa6922d[_0xa3cb('0x3f')]})[_0xa3cb('0x27')](function(_0x992a44){_0x562de8[_0xa3cb('0x20')]=_0x992a44;if(_0x212aef['query'][_0xa3cb('0x45')]){if(_0x47c7e3[_0xa3cb('0x74')]==='CmContact'){_0xa6922d[_0xa3cb('0x46')]=[{'model':db[_0xa3cb('0x82')],'as':_0xa3cb('0x83'),'attributes':['id',_0xa3cb('0x2b'),'color'],'required':_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x84')]?!![]:![]},{'model':db[_0xa3cb('0x82')],'as':_0xa3cb('0x85'),'attributes':['id',_0xa3cb('0x2b'),'color'],'through':_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x84')]?{'attributes':[],'where':{'TagId':_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x84')]||undefined}}:{},'required':_0x212aef[_0xa3cb('0x34')][_0xa3cb('0x84')]?!![]:![]}];}else{_0xa6922d[_0xa3cb('0x46')]=[{'all':!![]}];}}return db[_0x47c7e3['childModel']][_0xa3cb('0x47')](_0xa6922d);})[_0xa3cb('0x27')](function(_0x1ea04f){_0x562de8[_0xa3cb('0x48')]=_0x1ea04f;return _0x562de8;});}}else{return _0x562de8;}})[_0xa3cb('0x27')](respondWithFilteredResult(_0x53fdfe,_0xa6922d))[_0xa3cb('0x4c')](handleError(_0x53fdfe,null));};function getAllResources(_0x222eca,_0x187c19){return new BPromise(function(_0x1eed98,_0x2dead7){if(_0x187c19){var _0x2d0a26=_0x187c19[_0xa3cb('0x41')]?{[_0x187c19[_0xa3cb('0x41')][_0xa3cb('0x79')]]:_0x187c19[_0xa3cb('0x41')][_0xa3cb('0x86')]}:undefined;return db[_0x222eca]['findAll']({'where':_0x2d0a26,'raw':!![]})[_0xa3cb('0x27')](function(_0x4df2b0){_0x187c19[_0xa3cb('0x7c')]=_['map'](_0x4df2b0,'id');_0x1eed98(_0x187c19);})[_0xa3cb('0x4c')](function(_0x2f0a05){_0x2dead7(_0x2f0a05);});}else{_0x1eed98(null);}});}function getAllFilteredResources(_0x568c24,_0x5520c4){return new BPromise(function(_0x15a54f,_0x26ff38){var _0x3846bf=_0x568c24['filter']?{[_0x568c24[_0xa3cb('0x41')][_0xa3cb('0x79')]]:_0x568c24[_0xa3cb('0x41')][_0xa3cb('0x86')]}:undefined;return db[_0x568c24[_0xa3cb('0x32')]][_0xa3cb('0x47')]({'where':_0x3846bf,'raw':!![]})[_0xa3cb('0x27')](function(_0x8b37d0){_0x5520c4[_0xa3cb('0x7c')]=_[_0xa3cb('0x33')](_0x8b37d0,function(_0x537542){return _0x537542['name'];});_0x15a54f(_0x5520c4);})[_0xa3cb('0x4c')](function(_0x264e70){_0x26ff38(_0x264e70);});});}function getAllowedResources(_0x2fd95b,_0x1697e7,_0x2b7828){return new BPromise(function(_0xe45db4,_0x5a7ba8){if(_0x1697e7){return db[_0xa3cb('0x57')]['findAll']({'where':{'sectionId':_0x1697e7['id']},'raw':!![]})[_0xa3cb('0x27')](function(_0x91bb7){if(_0x2fd95b['field']&&_0x2fd95b[_0xa3cb('0x79')]!=='id'){_0x1697e7[_0xa3cb('0x7c')]=_[_0xa3cb('0x33')](_0x91bb7,function(_0x34bb44){return _0x34bb44[_0x2fd95b['field']];});}else{if(_0x2b7828===_0xa3cb('0x7a')){_0x1697e7[_0xa3cb('0x7c')]=_['map'](_0x91bb7,function(_0x5e152a){return{'id':_0x5e152a[_0xa3cb('0x69')],'type':_0x5e152a[_0xa3cb('0x30')]};});}else{_0x1697e7['associatedResources']=_[_0xa3cb('0x33')](_0x91bb7,function(_0x18e959){return _0x18e959[_0xa3cb('0x69')];});}}_0xe45db4(_0x1697e7);})[_0xa3cb('0x4c')](function(_0x4aea18){_0x5a7ba8(_0x4aea18);});}else{_0xe45db4(null);}});}function getQueryModels(_0x1b2795,_0xe35e17){var _0x35eb14=_0x1b2795[_0xa3cb('0x87')]();var _0x295551={'childModel':undefined,'parentSections':[]};switch(_0x35eb14){case _0xa3cb('0x88'):_0x295551['childModel']=_0xa3cb('0x89');break;case _0xa3cb('0x8a'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x8b');break;case'squarerecordings':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x8c');_0x295551[_0xa3cb('0x76')]=[{'name':_0xa3cb('0x8d'),'field':_0xa3cb('0x2b'),'foreignKey':'projectName'}];break;case _0xa3cb('0x8e'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x8f');break;case'contacts':_0x295551['childModel']=_0xa3cb('0x90');_0x295551[_0xa3cb('0x76')]=[{'name':_0xa3cb('0x91'),'field':'id','foreignKey':_0xa3cb('0x92')}];break;case _0xa3cb('0x93'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x94');break;case _0xa3cb('0x95'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x96');break;case _0xa3cb('0x97'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x98');break;case _0xa3cb('0x99'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x9a');break;case _0xa3cb('0x9b'):_0x295551[_0xa3cb('0x74')]='ChatWebsite';break;case _0xa3cb('0x9c'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x9d');break;case _0xa3cb('0x9e'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x9f');break;case _0xa3cb('0xa0'):case _0xa3cb('0xa1'):case'outboundroutes':_0x295551[_0xa3cb('0x74')]='VoiceExtension';break;case _0xa3cb('0xa2'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xa3');break;case _0xa3cb('0xa4'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xa5');break;case _0xa3cb('0xa6'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xa7');_0x295551[_0xa3cb('0x76')]=[{'name':_0xa3cb('0xa8'),'field':_0xa3cb('0x2b'),'foreignKey':'membername','model':_0xa3cb('0xa9'),'filter':{'field':_0xa3cb('0xaa'),'value':[_0xa3cb('0xab')]}},{'name':_0xa3cb('0xac'),'field':'name','foreignKey':_0xa3cb('0xad'),'model':'User','filter':{'field':_0xa3cb('0xaa'),'value':[_0xa3cb('0xae')]}},{'name':_0xa3cb('0xaf'),'field':'name','foreignKey':'queue','model':_0xa3cb('0xb0'),'filter':{'field':'type','value':[_0xa3cb('0xb1')]}},{'name':_0xa3cb('0xb2'),'field':_0xa3cb('0x2b'),'foreignKey':_0xa3cb('0xb3'),'model':_0xa3cb('0xb0'),'filter':{'field':'type','value':['outbound']}}];break;case _0xa3cb('0xb4'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xb5');break;case _0xa3cb('0xb6'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xb7');break;case _0xa3cb('0xb8'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xb9');break;case'ivrcampaigns':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xba');break;case'mailqueues':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xbb');break;case _0xa3cb('0xbc'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xbd');break;case _0xa3cb('0xbe'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xbf');break;case _0xa3cb('0xc0'):_0x295551['childModel']=_0xa3cb('0xc1');break;case _0xa3cb('0xc2'):_0x295551[_0xa3cb('0x74')]='OpenchannelAccount';break;case _0xa3cb('0xc3'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xc4');break;case'smsaccounts':_0x295551[_0xa3cb('0x74')]='SmsAccount';break;case _0xa3cb('0xc5'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xc6');break;case _0xa3cb('0xc7'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xc8');break;case _0xa3cb('0xc9'):_0x295551['childModel']='Team';break;case _0xa3cb('0xca'):case'queuecampaigns':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xb0');if(_0xe35e17){_0x295551[_0xa3cb('0x76')]=[{'name':_0xa3cb('0xaf')},{'name':'QueueCampaigns'}];}break;case _0xa3cb('0xcb'):case'agents':case'telephones':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xa9');if(_0xe35e17){_0x295551['parentSections']=[{'name':_0xa3cb('0xcc'),'filter':{'field':'role','value':[_0xa3cb('0xcd'),_0xa3cb('0xce')]},'ignore':!![]},{'name':_0xa3cb('0xa8')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x295551['childModel']=_0xa3cb('0xcf');break;case'salesforceaccounts':_0x295551['childModel']=_0xa3cb('0xd0');break;case _0xa3cb('0xd1'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xd2');break;case _0xa3cb('0xd3'):_0x295551['childModel']=_0xa3cb('0xd4');break;case _0xa3cb('0xd5'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xd6');break;case _0xa3cb('0xd7'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xd8');break;case'vtigeraccounts':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xa9');break;case _0xa3cb('0xd9'):_0x295551['childModel']=_0xa3cb('0xda');break;case'dispositions':_0x295551['childModel']='Disposition';break;case _0xa3cb('0xdb'):_0x295551[_0xa3cb('0x74')]='Dashboard';break;case _0xa3cb('0xdc'):_0x295551['childModel']='Interval';break;case'pauses':_0x295551[_0xa3cb('0x74')]='Pause';break;case _0xa3cb('0xdd'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xde');break;case _0xa3cb('0xdf'):_0x295551['childModel']=_0xa3cb('0xe0');break;case'tags':_0x295551[_0xa3cb('0x74')]='Tag';break;case _0xa3cb('0xe1'):_0x295551['childModel']=_0xa3cb('0xe2');break;case'triggers':_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xe3');break;case _0xa3cb('0xe4'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xe5');break;case'variables':_0x295551[_0xa3cb('0x74')]='Variable';break;case _0xa3cb('0xe6'):_0x295551['childModel']=_0xa3cb('0x6a');break;case _0xa3cb('0xe7'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0x7a');_0x295551[_0xa3cb('0x76')]=[{'name':_0xa3cb('0xe8'),'field':'id','foreignKey':'reportId'}];break;case _0xa3cb('0xe9'):_0x295551[_0xa3cb('0x74')]=_0xa3cb('0xea');break;case _0xa3cb('0xc7'):_0x295551['childModel']='WhatsappAccount';break;default:return _0x295551;}return _0x295551;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f3bc275..1440073 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 _0x5204=['remove','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x59006c,_0x59645d){var _0x3510af=function(_0x21412b){while(--_0x21412b){_0x59006c['push'](_0x59006c['shift']());}};_0x3510af(++_0x59645d);}(_0x5204,0xe4));var _0x4520=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x5204[_0x124298];return _0x35ac24;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4520('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4520('0x1')](0x0);var events={'afterCreate':_0x4520('0x2'),'afterUpdate':_0x4520('0x3'),'afterDestroy':_0x4520('0x4')};function emitEvent(_0x3afae0){return function(_0x414d8b,_0x386b08,_0xf03f6a){UserProfileEvents['emit'](_0x3afae0+':'+_0x414d8b['id'],_0x414d8b);UserProfileEvents['emit'](_0x3afae0,_0x414d8b);_0xf03f6a(null);};}for(var e in events){if(events[_0x4520('0x5')](e)){var event=events[e];UserProfile[_0x4520('0x6')](e,emitEvent(event));}}module[_0x4520('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xb116=['exports','events','../../mysqldb','setMaxListeners','emit','hook'];(function(_0x5de9c0,_0x235f62){var _0x585f94=function(_0x59b61d){while(--_0x59b61d){_0x5de9c0['push'](_0x5de9c0['shift']());}};_0x585f94(++_0x235f62);}(_0xb116,0x10f));var _0x6b11=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xb116[_0x55ff79];return _0x579067;};'use strict';var EventEmitter=require(_0x6b11('0x0'));var UserProfile=require(_0x6b11('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6b11('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xfae283){return function(_0x4f7318,_0x3b5359,_0x4d9129){UserProfileEvents[_0x6b11('0x3')](_0xfae283+':'+_0x4f7318['id'],_0x4f7318);UserProfileEvents[_0x6b11('0x3')](_0xfae283,_0x4f7318);_0x4d9129(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x6b11('0x4')](e,emitEvent(event));}}module[_0x6b11('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 47c5621..7b712dd 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 _0xfc0e=['moment','bluebird','request-promise','path','rimraf','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','api'];(function(_0x27d895,_0x4791ce){var _0x204118=function(_0x833c2b){while(--_0x833c2b){_0x27d895['push'](_0x27d895['shift']());}};_0x204118(++_0x4791ce);}(_0xfc0e,0x8c));var _0xefc0=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0xfc0e[_0x115d5b];return _0x6cfc50;};'use strict';var _=require(_0xefc0('0x0'));var util=require(_0xefc0('0x1'));var logger=require('../../config/logger')(_0xefc0('0x2'));var moment=require(_0xefc0('0x3'));var BPromise=require(_0xefc0('0x4'));var rp=require(_0xefc0('0x5'));var fs=require('fs');var path=require(_0xefc0('0x6'));var rimraf=require(_0xefc0('0x7'));var config=require('../../config/environment');var attributes=require(_0xefc0('0x8'));module[_0xefc0('0x9')]=function(_0x493e97,_0x4b3690){return _0x493e97[_0xefc0('0xa')](_0xefc0('0xb'),attributes,{'tableName':_0xefc0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x124e=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','lodash','util','api','moment'];(function(_0x5ae9e1,_0x477092){var _0x449e95=function(_0x420682){while(--_0x420682){_0x5ae9e1['push'](_0x5ae9e1['shift']());}};_0x449e95(++_0x477092);}(_0x124e,0x1d0));var _0xe124=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x124e[_0x616290];return _0x453879;};'use strict';var _=require(_0xe124('0x0'));var util=require(_0xe124('0x1'));var logger=require('../../config/logger')(_0xe124('0x2'));var moment=require(_0xe124('0x3'));var BPromise=require(_0xe124('0x4'));var rp=require(_0xe124('0x5'));var fs=require('fs');var path=require(_0xe124('0x6'));var rimraf=require(_0xe124('0x7'));var config=require(_0xe124('0x8'));var attributes=require(_0xe124('0x9'));module[_0xe124('0xa')]=function(_0x55560e,_0x212eda){return _0x55560e[_0xe124('0xb')](_0xe124('0xc'),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 0a8a6b2..d822efd 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 _0xeff8=['./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x378a11,_0x4b214e){var _0x3a02e4=function(_0x1e5b47){while(--_0x1e5b47){_0x378a11['push'](_0x378a11['shift']());}};_0x3a02e4(++_0x4b214e);}(_0xeff8,0x186));var _0x8eff=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xeff8[_0x3afe18];return _0x19ed1f;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});config[_0x8eff('0xb')]=_[_0x8eff('0xc')](config['redis'],{'host':_0x8eff('0xd'),'port':0x18eb});var socket=require(_0x8eff('0xe'))(new Redis(config[_0x8eff('0xb')]));require(_0x8eff('0xf'))['register'](socket);function respondWithRpcPromise(_0x56f120,_0x359d62,_0x430b45){return new BPromise(function(_0xb2117e,_0x52d250){return client[_0x8eff('0x10')](_0x56f120,_0x430b45)[_0x8eff('0x11')](function(_0x5172a5){logger[_0x8eff('0x12')](_0x8eff('0x13'),_0x359d62,'request\x20sent');logger['debug'](_0x8eff('0x14'),_0x359d62,_0x8eff('0x15'),JSON[_0x8eff('0x16')](_0x5172a5));if(_0x5172a5[_0x8eff('0x17')]){if(_0x5172a5[_0x8eff('0x17')]['code']===0x1f4){logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);return _0x52d250(_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);}logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);return _0xb2117e(_0x5172a5[_0x8eff('0x17')]['message']);}else{logger[_0x8eff('0x12')](_0x8eff('0x13'),_0x359d62,_0x8eff('0x15'));_0xb2117e(_0x5172a5[_0x8eff('0x19')][_0x8eff('0x18')]);}})[_0x8eff('0x1a')](function(_0x38f5ee){logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x38f5ee);_0x52d250(_0x38f5ee);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xabce,0x103));var _0xeabc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xabce[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});config[_0xeabc('0x9')]=_['defaults'](config[_0xeabc('0x9')],{'host':_0xeabc('0xa'),'port':0x18eb});var socket=require(_0xeabc('0xb'))(new Redis(config['redis']));require(_0xeabc('0xc'))[_0xeabc('0xd')](socket);function respondWithRpcPromise(_0x2f73e9,_0x1b4d1b,_0x4301e4){return new BPromise(function(_0x283cdf,_0x111aaf){return client[_0xeabc('0xe')](_0x2f73e9,_0x4301e4)[_0xeabc('0xf')](function(_0xf0d9c0){logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x1b4d1b,_0xeabc('0x12'));logger[_0xeabc('0x13')](_0xeabc('0x14'),_0x1b4d1b,_0xeabc('0x12'),JSON['stringify'](_0xf0d9c0));if(_0xf0d9c0[_0xeabc('0x15')]){if(_0xf0d9c0[_0xeabc('0x15')][_0xeabc('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1b4d1b,_0xf0d9c0[_0xeabc('0x15')][_0xeabc('0x17')]);return _0x111aaf(_0xf0d9c0[_0xeabc('0x15')]['message']);}logger[_0xeabc('0x15')](_0xeabc('0x11'),_0x1b4d1b,_0xf0d9c0['error']['message']);return _0x283cdf(_0xf0d9c0[_0xeabc('0x15')]['message']);}else{logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x1b4d1b,_0xeabc('0x12'));_0x283cdf(_0xf0d9c0[_0xeabc('0x18')][_0xeabc('0x17')]);}})[_0xeabc('0x19')](function(_0x384be5){logger[_0xeabc('0x15')]('UserProfile,\x20%s,\x20%s',_0x1b4d1b,_0x384be5);_0x111aaf(_0x384be5);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2680f69..95005be 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 _0xd325=['removeListener','length','userProfile:','remove','emit'];(function(_0x2a27d1,_0x282ce8){var _0x1e0843=function(_0xd97732){while(--_0xd97732){_0x2a27d1['push'](_0x2a27d1['shift']());}};_0x1e0843(++_0x282ce8);}(_0xd325,0x14d));var _0x5d32=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xd325[_0x1dd532];return _0x3732aa;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x5d32('0x0'),'update'];function createListener(_0x208d7a,_0x2ad45f){return function(_0xa83b38){_0x2ad45f[_0x5d32('0x1')](_0x208d7a,_0xa83b38);};}function removeListener(_0x14d972,_0xf558d6){return function(){UserProfileEvents[_0x5d32('0x2')](_0x14d972,_0xf558d6);};}exports['register']=function(_0x46d614){for(var _0x464d15=0x0,_0x2ee500=events[_0x5d32('0x3')];_0x464d15<_0x2ee500;_0x464d15++){var _0x443f75=events[_0x464d15];var _0x4445be=createListener(_0x5d32('0x4')+_0x443f75,_0x46d614);UserProfileEvents['on'](_0x443f75,_0x4445be);}}; \ No newline at end of file +var _0x18a5=['remove','update','emit','removeListener','register','userProfile:','save'];(function(_0x175b2e,_0x57e971){var _0x23c877=function(_0xa536b5){while(--_0xa536b5){_0x175b2e['push'](_0x175b2e['shift']());}};_0x23c877(++_0x57e971);}(_0x18a5,0x1aa));var _0x518a=function(_0x35bed5,_0x33444f){_0x35bed5=_0x35bed5-0x0;var _0x2ac1b6=_0x18a5[_0x35bed5];return _0x2ac1b6;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x518a('0x0'),_0x518a('0x1'),_0x518a('0x2')];function createListener(_0x1b0f9e,_0xed79a7){return function(_0x3af818){_0xed79a7[_0x518a('0x3')](_0x1b0f9e,_0x3af818);};}function removeListener(_0x4230b6,_0x2ae040){return function(){UserProfileEvents[_0x518a('0x4')](_0x4230b6,_0x2ae040);};}exports[_0x518a('0x5')]=function(_0x40742a){for(var _0xff2d3a=0x0,_0x139390=events['length'];_0xff2d3a<_0x139390;_0xff2d3a++){var _0xe20f51=events[_0xff2d3a];var _0x13c26d=createListener(_0x518a('0x6')+_0xe20f51,_0x40742a);UserProfileEvents['on'](_0xe20f51,_0x13c26d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 370fd6c..e983862 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 _0xe206=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/describe','describe'];(function(_0x247176,_0x2b6f40){var _0x26839e=function(_0x210380){while(--_0x210380){_0x247176['push'](_0x247176['shift']());}};_0x26839e(++_0x2b6f40);}(_0xe206,0x1e4));var _0x6e20=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe206[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require(_0x6e20('0x0'));var path=require(_0x6e20('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e20('0x2')]();var auth=require(_0x6e20('0x3'));var interaction=require(_0x6e20('0x4'));var config=require('../../config/environment');var controller=require(_0x6e20('0x5'));router[_0x6e20('0x6')]('/',auth[_0x6e20('0x7')](),controller['index']);router['get'](_0x6e20('0x8'),auth[_0x6e20('0x7')](),controller[_0x6e20('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6e20('0xa')]);router[_0x6e20('0xb')]('/',auth[_0x6e20('0x7')](),controller[_0x6e20('0xc')]);router[_0x6e20('0xd')](_0x6e20('0xe'),auth[_0x6e20('0x7')](),controller[_0x6e20('0xf')]);router[_0x6e20('0x10')](_0x6e20('0xe'),auth[_0x6e20('0x7')](),controller[_0x6e20('0x11')]);module[_0x6e20('0x12')]=router; \ No newline at end of file +var _0x85ed=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x85ed,0x66));var _0xd85e=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x85ed[_0x324012];return _0x435cf2;};'use strict';var multer=require(_0xd85e('0x0'));var util=require(_0xd85e('0x1'));var path=require(_0xd85e('0x2'));var timeout=require(_0xd85e('0x3'));var express=require(_0xd85e('0x4'));var router=express[_0xd85e('0x5')]();var auth=require(_0xd85e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd85e('0x7'));var controller=require(_0xd85e('0x8'));router[_0xd85e('0x9')]('/',auth[_0xd85e('0xa')](),controller['index']);router[_0xd85e('0x9')](_0xd85e('0xb'),auth['isAuthenticated'](),controller[_0xd85e('0xc')]);router[_0xd85e('0x9')](_0xd85e('0xd'),auth[_0xd85e('0xa')](),controller['show']);router[_0xd85e('0xe')]('/',auth[_0xd85e('0xa')](),controller[_0xd85e('0xf')]);router[_0xd85e('0x10')](_0xd85e('0xd'),auth[_0xd85e('0xa')](),controller['update']);router[_0xd85e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd85e('0x12')]);module[_0xd85e('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index ac5fe7a..c57a3aa 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 _0xeb2c=['exports','STRING','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb2c,0xf7));var _0xceb2=function(_0x359994,_0x45527b){_0x359994=_0x359994-0x0;var _0x3e0575=_0xeb2c[_0x359994];return _0x3e0575;};'use strict';var Sequelize=require(_0xceb2('0x0'));module[_0xceb2('0x1')]={'name':{'type':Sequelize[_0xceb2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xceb2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xceb2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6340=['sequelize','INTEGER','STRING'];(function(_0x3fdc99,_0x5c124e){var _0x4b4a13=function(_0x340362){while(--_0x340362){_0x3fdc99['push'](_0x3fdc99['shift']());}};_0x4b4a13(++_0x5c124e);}(_0x6340,0x19e));var _0x0634=function(_0x3daf63,_0x25528a){_0x3daf63=_0x3daf63-0x0;var _0x558174=_0x6340[_0x3daf63];return _0x558174;};'use strict';var Sequelize=require(_0x0634('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0634('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0634('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 80542a3..da6efff 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 _0xdbf5=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','find','create','body','update','params','catch','describe','eml-format','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/advancedSearch','api','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x17d84f,_0x4b29e3){var _0x314944=function(_0x252a44){while(--_0x252a44){_0x17d84f['push'](_0x17d84f['shift']());}};_0x314944(++_0x4b29e3);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4e0517,_0x238b29){_0x4e0517=_0x4e0517-0x0;var _0x191fd2=_0xdbf5[_0x4e0517];return _0x191fd2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5dbf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5dbf('0x1'));var rp=require(_0x5dbf('0x2'));var moment=require(_0x5dbf('0x3'));var BPromise=require(_0x5dbf('0x4'));var Mustache=require(_0x5dbf('0x5'));var util=require(_0x5dbf('0x6'));var path=require(_0x5dbf('0x7'));var sox=require(_0x5dbf('0x8'));var csv=require(_0x5dbf('0x9'));var ejs=require(_0x5dbf('0xa'));var fs=require('fs');var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5dbf('0x15'))['db'];function respondWithStatusCode(_0x490b38,_0x182cec){_0x182cec=_0x182cec||0xcc;return function(_0x2bb7ed){if(_0x2bb7ed){return _0x490b38[_0x5dbf('0x16')](_0x182cec);}return _0x490b38[_0x5dbf('0x17')](_0x182cec)[_0x5dbf('0x18')]();};}function respondWithResult(_0x587e58,_0x4803ca){_0x4803ca=_0x4803ca||0xc8;return function(_0x2b4e1c){if(_0x2b4e1c){return _0x587e58[_0x5dbf('0x17')](_0x4803ca)['json'](_0x2b4e1c);}};}function respondWithFilteredResult(_0x19624e,_0x248e3c){return function(_0x23f763){if(_0x23f763){var _0x2dfa44=_0x23f763['count'],_0x181816=_0x248e3c['offset'],_0x472eb9=_0x248e3c[_0x5dbf('0x19')]+_0x248e3c[_0x5dbf('0x1a')],_0x2d32cc;if(_0x472eb9>=_0x2dfa44){_0x472eb9=_0x2dfa44;_0x2d32cc=0xc8;}else{_0x2d32cc=0xce;}_0x19624e[_0x5dbf('0x17')](_0x2d32cc);return _0x19624e[_0x5dbf('0x1b')](_0x5dbf('0x1c'),_0x181816+'-'+_0x472eb9+'/'+_0x2dfa44)['json'](_0x23f763);}return null;};}function patchUpdates(_0x11cd00){return function(_0x4dd03c){try{jsonpatch['apply'](_0x4dd03c,_0x11cd00,!![]);}catch(_0x577ca2){return BPromise[_0x5dbf('0x1d')](_0x577ca2);}return _0x4dd03c[_0x5dbf('0x1e')]();};}function saveUpdates(_0x358d46,_0x2ab57c){return function(_0x1e3cce){if(_0x1e3cce){return _0x1e3cce['update'](_0x358d46)[_0x5dbf('0x1f')](function(_0x58e9ac){return _0x58e9ac;});}return null;};}function removeEntity(_0xb68f92,_0x11cc67){return function(_0x14d133){if(_0x14d133){return _0x14d133[_0x5dbf('0x20')]()[_0x5dbf('0x1f')](function(){_0xb68f92[_0x5dbf('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(!_0x2d3e1b){_0x4027c3[_0x5dbf('0x16')](0x194);}return _0x2d3e1b;};}function handleError(_0x2763ec,_0x226b93){_0x226b93=_0x226b93||0x1f4;return function(_0x290456){logger[_0x5dbf('0x21')](_0x290456[_0x5dbf('0x22')]);if(_0x290456[_0x5dbf('0x23')]){delete _0x290456[_0x5dbf('0x23')];}_0x2763ec[_0x5dbf('0x17')](_0x226b93)[_0x5dbf('0x24')](_0x290456);};}exports[_0x5dbf('0x25')]=function(_0x729d8f,_0x17f135){var _0x466985={},_0x3f8341={},_0x159e61={'count':0x0,'rows':[]};var _0x22ec42=_[_0x5dbf('0x26')](db[_0x5dbf('0x27')][_0x5dbf('0x28')],function(_0x5768b7){return{'name':_0x5768b7[_0x5dbf('0x29')],'type':_0x5768b7[_0x5dbf('0x2a')][_0x5dbf('0x2b')]};});_0x3f8341[_0x5dbf('0x2c')]=_[_0x5dbf('0x26')](_0x22ec42,_0x5dbf('0x23'));_0x3f8341[_0x5dbf('0x2d')]=_[_0x5dbf('0x2e')](_0x729d8f[_0x5dbf('0x2d')]);_0x3f8341[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x3f8341['model'],_0x3f8341['query']);_0x466985[_0x5dbf('0x31')]=_[_0x5dbf('0x30')](_0x3f8341[_0x5dbf('0x2c')],qs[_0x5dbf('0x32')](_0x729d8f[_0x5dbf('0x2d')]['fields']));_0x466985['attributes']=_0x466985[_0x5dbf('0x31')][_0x5dbf('0x33')]?_0x466985['attributes']:_0x3f8341[_0x5dbf('0x2c')];if(!_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x34')](_0x5dbf('0x35'))){_0x466985[_0x5dbf('0x1a')]=qs['limit'](_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x1a')]);_0x466985[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x729d8f[_0x5dbf('0x2d')]['offset']);}_0x466985[_0x5dbf('0x36')]=qs[_0x5dbf('0x37')](_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x37')]);_0x466985['where']=qs[_0x5dbf('0x2f')](_[_0x5dbf('0x38')](_0x729d8f[_0x5dbf('0x2d')],_0x3f8341[_0x5dbf('0x2f')]),_0x22ec42);if(_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x39')]){_0x466985[_0x5dbf('0x3a')]=_[_0x5dbf('0x3b')](_0x466985[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x26')](_0x22ec42,function(_0x1ba835){if(_0x1ba835['type']!==_0x5dbf('0x3c')){var _0xefc995={};_0xefc995[_0x1ba835[_0x5dbf('0x23')]]={'$like':'%'+_0x729d8f['query'][_0x5dbf('0x39')]+'%'};return _0xefc995;}})});}_0x466985=_[_0x5dbf('0x3b')]({},_0x466985,_0x729d8f[_0x5dbf('0x3d')]);var _0x5b3738={'where':_0x466985[_0x5dbf('0x3a')]};return db[_0x5dbf('0x27')][_0x5dbf('0x3e')](_0x5b3738)['then'](function(_0x4527fb){_0x159e61[_0x5dbf('0x3e')]=_0x4527fb;if(_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x3f')]){_0x466985[_0x5dbf('0x40')]=[{'all':!![]}];}return db[_0x5dbf('0x27')][_0x5dbf('0x41')](_0x466985);})[_0x5dbf('0x1f')](function(_0x4b71c1){_0x159e61['rows']=_0x4b71c1;return _0x159e61;})['then'](respondWithFilteredResult(_0x17f135,_0x466985))['catch'](handleError(_0x17f135,null));};exports[_0x5dbf('0x42')]=function(_0x21122d,_0x54e5e7){var _0x3ef0eb={'raw':![],'where':{'id':_0x21122d['params']['id']}},_0x229abf={};_0x229abf[_0x5dbf('0x2c')]=_[_0x5dbf('0x2e')](db[_0x5dbf('0x27')][_0x5dbf('0x28')]);_0x229abf[_0x5dbf('0x2d')]=_[_0x5dbf('0x2e')](_0x21122d[_0x5dbf('0x2d')]);_0x229abf[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x229abf[_0x5dbf('0x2c')],_0x229abf['query']);_0x3ef0eb[_0x5dbf('0x31')]=_[_0x5dbf('0x30')](_0x229abf[_0x5dbf('0x2c')],qs['fields'](_0x21122d[_0x5dbf('0x2d')][_0x5dbf('0x32')]));_0x3ef0eb[_0x5dbf('0x31')]=_0x3ef0eb[_0x5dbf('0x31')]['length']?_0x3ef0eb[_0x5dbf('0x31')]:_0x229abf['model'];if(_0x21122d[_0x5dbf('0x2d')][_0x5dbf('0x3f')]){_0x3ef0eb[_0x5dbf('0x40')]=[{'all':!![]}];}_0x3ef0eb=_[_0x5dbf('0x3b')]({},_0x3ef0eb,_0x21122d['options']);return db['UserProfileResource'][_0x5dbf('0x43')](_0x3ef0eb)[_0x5dbf('0x1f')](handleEntityNotFound(_0x54e5e7,null))[_0x5dbf('0x1f')](respondWithResult(_0x54e5e7,null))['catch'](handleError(_0x54e5e7,null));};exports[_0x5dbf('0x44')]=function(_0x4a9a80,_0x4d8df1){return db['UserProfileResource']['create'](_0x4a9a80[_0x5dbf('0x45')],{})[_0x5dbf('0x1f')](respondWithResult(_0x4d8df1,0xc9))['catch'](handleError(_0x4d8df1,null));};exports[_0x5dbf('0x46')]=function(_0x3ba5cb,_0x4b6f30){if(_0x3ba5cb[_0x5dbf('0x45')]['id']){delete _0x3ba5cb[_0x5dbf('0x45')]['id'];}return db['UserProfileResource'][_0x5dbf('0x43')]({'where':{'id':_0x3ba5cb['params']['id']}})['then'](handleEntityNotFound(_0x4b6f30,null))[_0x5dbf('0x1f')](saveUpdates(_0x3ba5cb[_0x5dbf('0x45')],null))[_0x5dbf('0x1f')](respondWithResult(_0x4b6f30,null))['catch'](handleError(_0x4b6f30,null));};exports['destroy']=function(_0x442a43,_0x3e8612){return db[_0x5dbf('0x27')][_0x5dbf('0x43')]({'where':{'id':_0x442a43[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x1f')](handleEntityNotFound(_0x3e8612,null))[_0x5dbf('0x1f')](removeEntity(_0x3e8612,null))[_0x5dbf('0x48')](handleError(_0x3e8612,null));};exports['describe']=function(_0x3f38a0,_0x387eb7){return db[_0x5dbf('0x27')][_0x5dbf('0x49')]()[_0x5dbf('0x1f')](respondWithResult(_0x387eb7,null))[_0x5dbf('0x48')](handleError(_0x387eb7,null));}; \ No newline at end of file +var _0x9b67=['type','key','model','map','keys','query','filters','intersection','fields','attributes','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','name','send','UserProfileResource','rawAttributes','fieldName'];(function(_0x393bd1,_0x45433a){var _0x1a8526=function(_0x25b431){while(--_0x25b431){_0x393bd1['push'](_0x393bd1['shift']());}};_0x1a8526(++_0x45433a);}(_0x9b67,0xf6));var _0x79b6=function(_0xa9a175,_0x4e691d){_0xa9a175=_0xa9a175-0x0;var _0x177538=_0x9b67[_0xa9a175];return _0x177538;};'use strict';var pdf=require(_0x79b6('0x0'));var emlformat=require(_0x79b6('0x1'));var rimraf=require(_0x79b6('0x2'));var zipdir=require(_0x79b6('0x3'));var jsonpatch=require(_0x79b6('0x4'));var rp=require('request-promise');var moment=require(_0x79b6('0x5'));var BPromise=require(_0x79b6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x79b6('0x7'));var sox=require(_0x79b6('0x8'));var csv=require(_0x79b6('0x9'));var ejs=require(_0x79b6('0xa'));var fs=require('fs');var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x9'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var db=require(_0x79b6('0x17'))['db'];function respondWithStatusCode(_0x303cfb,_0x526727){_0x526727=_0x526727||0xcc;return function(_0xc05a77){if(_0xc05a77){return _0x303cfb[_0x79b6('0x18')](_0x526727);}return _0x303cfb[_0x79b6('0x19')](_0x526727)[_0x79b6('0x1a')]();};}function respondWithResult(_0x3b0721,_0x40478d){_0x40478d=_0x40478d||0xc8;return function(_0x19d5b2){if(_0x19d5b2){return _0x3b0721[_0x79b6('0x19')](_0x40478d)[_0x79b6('0x1b')](_0x19d5b2);}};}function respondWithFilteredResult(_0x114d8c,_0x2ac966){return function(_0x3563cc){if(_0x3563cc){var _0x1e8bf1=_0x3563cc[_0x79b6('0x1c')],_0x4cf491=_0x2ac966[_0x79b6('0x1d')],_0x207bcc=_0x2ac966[_0x79b6('0x1d')]+_0x2ac966[_0x79b6('0x1e')],_0x2a75d5;if(_0x207bcc>=_0x1e8bf1){_0x207bcc=_0x1e8bf1;_0x2a75d5=0xc8;}else{_0x2a75d5=0xce;}_0x114d8c[_0x79b6('0x19')](_0x2a75d5);return _0x114d8c[_0x79b6('0x1f')](_0x79b6('0x20'),_0x4cf491+'-'+_0x207bcc+'/'+_0x1e8bf1)[_0x79b6('0x1b')](_0x3563cc);}return null;};}function patchUpdates(_0x323376){return function(_0xa1a29a){try{jsonpatch[_0x79b6('0x21')](_0xa1a29a,_0x323376,!![]);}catch(_0x52a70f){return BPromise[_0x79b6('0x22')](_0x52a70f);}return _0xa1a29a['save']();};}function saveUpdates(_0x22a9eb,_0x532e65){return function(_0x28b9c2){if(_0x28b9c2){return _0x28b9c2[_0x79b6('0x23')](_0x22a9eb)[_0x79b6('0x24')](function(_0x56ebf4){return _0x56ebf4;});}return null;};}function removeEntity(_0x46304b,_0x30dc0b){return function(_0x53208a){if(_0x53208a){return _0x53208a['destroy']()[_0x79b6('0x24')](function(){_0x46304b[_0x79b6('0x19')](0xcc)[_0x79b6('0x1a')]();});}};}function handleEntityNotFound(_0x268826,_0x3b2a2a){return function(_0x488102){if(!_0x488102){_0x268826[_0x79b6('0x18')](0x194);}return _0x488102;};}function handleError(_0x280e04,_0x17eff4){_0x17eff4=_0x17eff4||0x1f4;return function(_0x26dd86){logger['error'](_0x26dd86['stack']);if(_0x26dd86[_0x79b6('0x25')]){delete _0x26dd86[_0x79b6('0x25')];}_0x280e04[_0x79b6('0x19')](_0x17eff4)[_0x79b6('0x26')](_0x26dd86);};}exports['index']=function(_0x6f6ca1,_0x52574b){var _0x400542={},_0x2fd9b5={},_0x302596={'count':0x0,'rows':[]};var _0xe03d2=_['map'](db[_0x79b6('0x27')][_0x79b6('0x28')],function(_0x53b463){return{'name':_0x53b463[_0x79b6('0x29')],'type':_0x53b463[_0x79b6('0x2a')][_0x79b6('0x2b')]};});_0x2fd9b5[_0x79b6('0x2c')]=_[_0x79b6('0x2d')](_0xe03d2,_0x79b6('0x25'));_0x2fd9b5['query']=_[_0x79b6('0x2e')](_0x6f6ca1[_0x79b6('0x2f')]);_0x2fd9b5[_0x79b6('0x30')]=_[_0x79b6('0x31')](_0x2fd9b5[_0x79b6('0x2c')],_0x2fd9b5[_0x79b6('0x2f')]);_0x400542['attributes']=_[_0x79b6('0x31')](_0x2fd9b5[_0x79b6('0x2c')],qs[_0x79b6('0x32')](_0x6f6ca1['query']['fields']));_0x400542[_0x79b6('0x33')]=_0x400542[_0x79b6('0x33')][_0x79b6('0x34')]?_0x400542[_0x79b6('0x33')]:_0x2fd9b5[_0x79b6('0x2c')];if(!_0x6f6ca1[_0x79b6('0x2f')]['hasOwnProperty']('nolimit')){_0x400542[_0x79b6('0x1e')]=qs['limit'](_0x6f6ca1[_0x79b6('0x2f')]['limit']);_0x400542[_0x79b6('0x1d')]=qs[_0x79b6('0x1d')](_0x6f6ca1['query'][_0x79b6('0x1d')]);}_0x400542[_0x79b6('0x35')]=qs['sort'](_0x6f6ca1[_0x79b6('0x2f')]['sort']);_0x400542[_0x79b6('0x36')]=qs[_0x79b6('0x30')](_[_0x79b6('0x37')](_0x6f6ca1[_0x79b6('0x2f')],_0x2fd9b5[_0x79b6('0x30')]),_0xe03d2);if(_0x6f6ca1[_0x79b6('0x2f')][_0x79b6('0x38')]){_0x400542[_0x79b6('0x36')]=_[_0x79b6('0x39')](_0x400542[_0x79b6('0x36')],{'$or':_['map'](_0xe03d2,function(_0x5179ec){if(_0x5179ec['type']!==_0x79b6('0x3a')){var _0x324a04={};_0x324a04[_0x5179ec['name']]={'$like':'%'+_0x6f6ca1[_0x79b6('0x2f')]['filter']+'%'};return _0x324a04;}})});}_0x400542=_[_0x79b6('0x39')]({},_0x400542,_0x6f6ca1[_0x79b6('0x3b')]);var _0x26abad={'where':_0x400542['where']};return db[_0x79b6('0x27')]['count'](_0x26abad)[_0x79b6('0x24')](function(_0x1bba0d){_0x302596[_0x79b6('0x1c')]=_0x1bba0d;if(_0x6f6ca1[_0x79b6('0x2f')][_0x79b6('0x3c')]){_0x400542['include']=[{'all':!![]}];}return db['UserProfileResource'][_0x79b6('0x3d')](_0x400542);})['then'](function(_0x4037c8){_0x302596[_0x79b6('0x3e')]=_0x4037c8;return _0x302596;})[_0x79b6('0x24')](respondWithFilteredResult(_0x52574b,_0x400542))[_0x79b6('0x3f')](handleError(_0x52574b,null));};exports[_0x79b6('0x40')]=function(_0x376eb2,_0x475c8c){var _0x4a7f90={'raw':![],'where':{'id':_0x376eb2[_0x79b6('0x41')]['id']}},_0x109514={};_0x109514[_0x79b6('0x2c')]=_[_0x79b6('0x2e')](db['UserProfileResource'][_0x79b6('0x28')]);_0x109514['query']=_['keys'](_0x376eb2[_0x79b6('0x2f')]);_0x109514[_0x79b6('0x30')]=_[_0x79b6('0x31')](_0x109514[_0x79b6('0x2c')],_0x109514[_0x79b6('0x2f')]);_0x4a7f90[_0x79b6('0x33')]=_[_0x79b6('0x31')](_0x109514[_0x79b6('0x2c')],qs['fields'](_0x376eb2[_0x79b6('0x2f')]['fields']));_0x4a7f90['attributes']=_0x4a7f90[_0x79b6('0x33')][_0x79b6('0x34')]?_0x4a7f90[_0x79b6('0x33')]:_0x109514[_0x79b6('0x2c')];if(_0x376eb2[_0x79b6('0x2f')][_0x79b6('0x3c')]){_0x4a7f90[_0x79b6('0x42')]=[{'all':!![]}];}_0x4a7f90=_[_0x79b6('0x39')]({},_0x4a7f90,_0x376eb2[_0x79b6('0x3b')]);return db['UserProfileResource'][_0x79b6('0x43')](_0x4a7f90)[_0x79b6('0x24')](handleEntityNotFound(_0x475c8c,null))[_0x79b6('0x24')](respondWithResult(_0x475c8c,null))[_0x79b6('0x3f')](handleError(_0x475c8c,null));};exports[_0x79b6('0x44')]=function(_0x4f1344,_0x3e335e){return db[_0x79b6('0x27')]['create'](_0x4f1344['body'],{})[_0x79b6('0x24')](respondWithResult(_0x3e335e,0xc9))[_0x79b6('0x3f')](handleError(_0x3e335e,null));};exports[_0x79b6('0x23')]=function(_0xa0c396,_0x37f4b1){if(_0xa0c396[_0x79b6('0x45')]['id']){delete _0xa0c396[_0x79b6('0x45')]['id'];}return db[_0x79b6('0x27')][_0x79b6('0x43')]({'where':{'id':_0xa0c396[_0x79b6('0x41')]['id']}})[_0x79b6('0x24')](handleEntityNotFound(_0x37f4b1,null))[_0x79b6('0x24')](saveUpdates(_0xa0c396[_0x79b6('0x45')],null))[_0x79b6('0x24')](respondWithResult(_0x37f4b1,null))[_0x79b6('0x3f')](handleError(_0x37f4b1,null));};exports[_0x79b6('0x46')]=function(_0x26ab29,_0x14fa5c){return db[_0x79b6('0x27')]['find']({'where':{'id':_0x26ab29['params']['id']}})['then'](handleEntityNotFound(_0x14fa5c,null))['then'](removeEntity(_0x14fa5c,null))['catch'](handleError(_0x14fa5c,null));};exports[_0x79b6('0x47')]=function(_0xdaef8c,_0x23d4eb){return db[_0x79b6('0x27')][_0x79b6('0x47')]()[_0x79b6('0x24')](respondWithResult(_0x23d4eb,null))['catch'](handleError(_0x23d4eb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1912f8d..bd17250 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 _0x5b02=['./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x21dace,_0x400b38){_0x21dace=_0x21dace-0x0;var _0x1c70d5=_0x5b02[_0x21dace];return _0x1c70d5;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x25b0('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['exports','define','user_profile_has_resources','compositeIndex','sectionId','../../config/logger','api','moment','bluebird','path','rimraf','./userProfileResource.attributes'];(function(_0x102db9,_0x478d36){var _0x59ee79=function(_0x917112){while(--_0x917112){_0x102db9['push'](_0x102db9['shift']());}};_0x59ee79(++_0x478d36);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xcb91[_0x3452a8];return _0x233814;};'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')]('UserProfileResource',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['resourceId',_0x1cb9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 72bdef8..20dc00c 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 _0x99e1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x99e1,0x1c4));var _0x199e=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x99e1[_0x251d9c];return _0x16ae64;};'use strict';var _=require(_0x199e('0x0'));var util=require(_0x199e('0x1'));var moment=require(_0x199e('0x2'));var BPromise=require(_0x199e('0x3'));var rs=require(_0x199e('0x4'));var fs=require('fs');var Redis=require(_0x199e('0x5'));var db=require(_0x199e('0x6'))['db'];var utils=require(_0x199e('0x7'));var logger=require(_0x199e('0x8'))(_0x199e('0x9'));var config=require(_0x199e('0xa'));var jayson=require(_0x199e('0xb'));var client=jayson[_0x199e('0xc')][_0x199e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdafd4b,_0x1472f1,_0x390c2d){return new BPromise(function(_0x1beb4d,_0xb08c34){return client[_0x199e('0xe')](_0xdafd4b,_0x390c2d)[_0x199e('0xf')](function(_0x840095){logger['info'](_0x199e('0x10'),_0x1472f1,_0x199e('0x11'));logger[_0x199e('0x12')](_0x199e('0x13'),_0x1472f1,'request\x20sent',JSON[_0x199e('0x14')](_0x840095));if(_0x840095['error']){if(_0x840095[_0x199e('0x15')][_0x199e('0x16')]===0x1f4){logger[_0x199e('0x15')](_0x199e('0x10'),_0x1472f1,_0x840095[_0x199e('0x15')]['message']);return _0xb08c34(_0x840095[_0x199e('0x15')][_0x199e('0x17')]);}logger['error'](_0x199e('0x10'),_0x1472f1,_0x840095[_0x199e('0x15')]['message']);return _0x1beb4d(_0x840095[_0x199e('0x15')][_0x199e('0x17')]);}else{logger[_0x199e('0x18')]('UserProfileResource,\x20%s,\x20%s',_0x1472f1,'request\x20sent');_0x1beb4d(_0x840095[_0x199e('0x19')][_0x199e('0x17')]);}})[_0x199e('0x1a')](function(_0x246d7e){logger[_0x199e('0x15')](_0x199e('0x10'),_0x1472f1,_0x246d7e);_0xb08c34(_0x246d7e);});});} \ No newline at end of file +var _0x968a=['request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x1f4811,_0x5aa94d){var _0x5cbfc6=function(_0x57a4cb){while(--_0x57a4cb){_0x1f4811['push'](_0x1f4811['shift']());}};_0x5cbfc6(++_0x5aa94d);}(_0x968a,0xe5));var _0xa968=function(_0x5530d0,_0x56bac6){_0x5530d0=_0x5530d0-0x0;var _0x4b4285=_0x968a[_0x5530d0];return _0x4b4285;};'use strict';var _=require('lodash');var util=require(_0xa968('0x0'));var moment=require(_0xa968('0x1'));var BPromise=require(_0xa968('0x2'));var rs=require(_0xa968('0x3'));var fs=require('fs');var Redis=require(_0xa968('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa968('0x5'));var logger=require(_0xa968('0x6'))(_0xa968('0x7'));var config=require(_0xa968('0x8'));var jayson=require(_0xa968('0x9'));var client=jayson[_0xa968('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb41f,_0x48e1b0,_0x349c0f){return new BPromise(function(_0x34885d,_0x5cf002){return client[_0xa968('0xb')](_0x4cb41f,_0x349c0f)['then'](function(_0x16b61){logger[_0xa968('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x48e1b0,_0xa968('0xd'));logger[_0xa968('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x48e1b0,'request\x20sent',JSON[_0xa968('0xf')](_0x16b61));if(_0x16b61[_0xa968('0x10')]){if(_0x16b61[_0xa968('0x10')][_0xa968('0x11')]===0x1f4){logger[_0xa968('0x10')](_0xa968('0x12'),_0x48e1b0,_0x16b61[_0xa968('0x10')]['message']);return _0x5cf002(_0x16b61['error'][_0xa968('0x13')]);}logger[_0xa968('0x10')](_0xa968('0x12'),_0x48e1b0,_0x16b61['error'][_0xa968('0x13')]);return _0x34885d(_0x16b61[_0xa968('0x10')][_0xa968('0x13')]);}else{logger[_0xa968('0xc')](_0xa968('0x12'),_0x48e1b0,_0xa968('0xd'));_0x34885d(_0x16b61[_0xa968('0x14')]['message']);}})[_0xa968('0x15')](function(_0x3cf9ef){logger['error'](_0xa968('0x12'),_0x48e1b0,_0x3cf9ef);_0x5cf002(_0x3cf9ef);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8bfef76..ce94970 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 _0x395a=['/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','put'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x395a,0x159));var _0xa395=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x395a[_0x43c8b8];return _0x413be3;};'use strict';var multer=require(_0xa395('0x0'));var util=require(_0xa395('0x1'));var path=require(_0xa395('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa395('0x3'));var interaction=require(_0xa395('0x4'));var config=require(_0xa395('0x5'));var controller=require('./userProfileSection.controller');router[_0xa395('0x6')]('/',auth[_0xa395('0x7')](),controller[_0xa395('0x8')]);router['get']('/describe',auth[_0xa395('0x7')](),controller[_0xa395('0x9')]);router[_0xa395('0x6')]('/:id',auth[_0xa395('0x7')](),controller['show']);router[_0xa395('0xa')]('/',auth[_0xa395('0x7')](),controller['create']);router[_0xa395('0xb')](_0xa395('0xc'),auth[_0xa395('0x7')](),controller[_0xa395('0xd')]);router[_0xa395('0xe')](_0xa395('0xc'),auth[_0xa395('0x7')](),controller[_0xa395('0xf')]);module[_0xa395('0x10')]=router; \ No newline at end of file +var _0x073d=['show','create','put','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x1ce4f3,_0x32c45a){var _0x5e834f=function(_0x365bcb){while(--_0x365bcb){_0x1ce4f3['push'](_0x1ce4f3['shift']());}};_0x5e834f(++_0x32c45a);}(_0x073d,0x103));var _0xd073=function(_0x49088a,_0xa2b35c){_0x49088a=_0x49088a-0x0;var _0x3a522d=_0x073d[_0x49088a];return _0x3a522d;};'use strict';var multer=require(_0xd073('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd073('0x1'));var express=require(_0xd073('0x2'));var router=express[_0xd073('0x3')]();var auth=require(_0xd073('0x4'));var interaction=require(_0xd073('0x5'));var config=require('../../config/environment');var controller=require(_0xd073('0x6'));router['get']('/',auth[_0xd073('0x7')](),controller[_0xd073('0x8')]);router[_0xd073('0x9')](_0xd073('0xa'),auth[_0xd073('0x7')](),controller[_0xd073('0xb')]);router[_0xd073('0x9')](_0xd073('0xc'),auth[_0xd073('0x7')](),controller[_0xd073('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd073('0xe')]);router[_0xd073('0xf')](_0xd073('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd073('0x10')](_0xd073('0xc'),auth[_0xd073('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5bd5e91..a2455ed 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 _0xb0de=['join','crudPermissions','getDataValue','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x31cefb,_0x10ae73){var _0x6f8b4f=function(_0x206165){while(--_0x206165){_0x31cefb['push'](_0x31cefb['shift']());}};_0x6f8b4f(++_0x10ae73);}(_0xb0de,0x148));var _0xeb0d=function(_0x4f3048,_0x5db880){_0x4f3048=_0x4f3048-0x0;var _0x53b9d4=_0xb0de[_0x4f3048];return _0x53b9d4;};'use strict';var Sequelize=require(_0xeb0d('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb0d('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xeb0d('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb0d('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb0d('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb0d('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb0d('0x1')],'set':function(_0x1f1762){this[_0xeb0d('0x4')]('crudPermissions',_0x1f1762?_0x1f1762[_0xeb0d('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xeb0d('0x6'))?this[_0xeb0d('0x7')]('crudPermissions')[_0xeb0d('0x8')](''):[];}}}; \ No newline at end of file +var _0xdefc=['crudPermissions','join','getDataValue','sequelize','exports','STRING','BOOLEAN','setDataValue'];(function(_0x468039,_0x15d693){var _0x52f100=function(_0x39f55b){while(--_0x39f55b){_0x468039['push'](_0x468039['shift']());}};_0x52f100(++_0x15d693);}(_0xdefc,0x1b3));var _0xcdef=function(_0x5820df,_0x24240a){_0x5820df=_0x5820df-0x0;var _0x7a47f1=_0xdefc[_0x5820df];return _0x7a47f1;};'use strict';var Sequelize=require(_0xcdef('0x0'));module[_0xcdef('0x1')]={'name':{'type':Sequelize[_0xcdef('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xcdef('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xcdef('0x2')],'set':function(_0x2418f0){this[_0xcdef('0x4')](_0xcdef('0x5'),_0x2418f0?_0x2418f0[_0xcdef('0x6')](''):[]);},'get':function(){return this[_0xcdef('0x7')](_0xcdef('0x5'))?this['getDataValue'](_0xcdef('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index dd049d6..e2aaf08 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 _0x91e6=['request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1cfb46,_0xf2adf0){var _0x4b490b=function(_0x56b5dd){while(--_0x56b5dd){_0x1cfb46['push'](_0x1cfb46['shift']());}};_0x4b490b(++_0xf2adf0);}(_0x91e6,0x123));var _0x691e=function(_0x460e5e,_0x305a44){_0x460e5e=_0x460e5e-0x0;var _0x5aef43=_0x91e6[_0x460e5e];return _0x5aef43;};'use strict';var pdf=require(_0x691e('0x0'));var emlformat=require(_0x691e('0x1'));var rimraf=require(_0x691e('0x2'));var zipdir=require(_0x691e('0x3'));var jsonpatch=require(_0x691e('0x4'));var rp=require(_0x691e('0x5'));var moment=require(_0x691e('0x6'));var BPromise=require(_0x691e('0x7'));var Mustache=require(_0x691e('0x8'));var util=require('util');var path=require(_0x691e('0x9'));var sox=require(_0x691e('0xa'));var csv=require(_0x691e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x691e('0xc'));var squel=require(_0x691e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x691e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x691e('0xf'));var Papa=require(_0x691e('0x10'));var Redis=require(_0x691e('0x11'));var authService=require(_0x691e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x691e('0x13'));var hardwareService=require(_0x691e('0x14'));var logger=require(_0x691e('0x15'))(_0x691e('0x16'));var utils=require(_0x691e('0x17'));var config=require('../../config/environment');var db=require(_0x691e('0x18'))['db'];function respondWithStatusCode(_0x54b0f0,_0x38b478){_0x38b478=_0x38b478||0xcc;return function(_0x39c8b3){if(_0x39c8b3){return _0x54b0f0[_0x691e('0x19')](_0x38b478);}return _0x54b0f0['status'](_0x38b478)[_0x691e('0x1a')]();};}function respondWithResult(_0x507e3d,_0x5922bb){_0x5922bb=_0x5922bb||0xc8;return function(_0x2dfa6c){if(_0x2dfa6c){return _0x507e3d[_0x691e('0x1b')](_0x5922bb)['json'](_0x2dfa6c);}};}function respondWithFilteredResult(_0x520ef6,_0x37ca73){return function(_0x33e3dd){if(_0x33e3dd){var _0x12aad3=_0x33e3dd['count'],_0x50fa02=_0x37ca73['offset'],_0x527527=_0x37ca73[_0x691e('0x1c')]+_0x37ca73[_0x691e('0x1d')],_0x1fd2c1;if(_0x527527>=_0x12aad3){_0x527527=_0x12aad3;_0x1fd2c1=0xc8;}else{_0x1fd2c1=0xce;}_0x520ef6['status'](_0x1fd2c1);return _0x520ef6[_0x691e('0x1e')](_0x691e('0x1f'),_0x50fa02+'-'+_0x527527+'/'+_0x12aad3)[_0x691e('0x20')](_0x33e3dd);}return null;};}function patchUpdates(_0x12ea4c){return function(_0x4f464f){try{jsonpatch[_0x691e('0x21')](_0x4f464f,_0x12ea4c,!![]);}catch(_0x3f97b1){return BPromise['reject'](_0x3f97b1);}return _0x4f464f['save']();};}function saveUpdates(_0x4aed54,_0x2bf89e){return function(_0x4b8768){if(_0x4b8768){return _0x4b8768[_0x691e('0x22')](_0x4aed54)[_0x691e('0x23')](function(_0x403b89){return _0x403b89;});}return null;};}function removeEntity(_0x180413,_0x413a8b){return function(_0x103f22){if(_0x103f22){return _0x103f22[_0x691e('0x24')]()[_0x691e('0x23')](function(){_0x180413['status'](0xcc)[_0x691e('0x1a')]();});}};}function handleEntityNotFound(_0x12435b,_0x3959cb){return function(_0x30842f){if(!_0x30842f){_0x12435b[_0x691e('0x19')](0x194);}return _0x30842f;};}function handleError(_0x241c8a,_0xc94614){_0xc94614=_0xc94614||0x1f4;return function(_0x5115e8){logger[_0x691e('0x25')](_0x5115e8[_0x691e('0x26')]);if(_0x5115e8[_0x691e('0x27')]){delete _0x5115e8['name'];}_0x241c8a['status'](_0xc94614)[_0x691e('0x28')](_0x5115e8);};}exports[_0x691e('0x29')]=function(_0x3eb857,_0x3557ba){var _0x124b7e={},_0x4b1844={},_0xf89be6={'count':0x0,'rows':[]};var _0x86a5ec=_[_0x691e('0x2a')](db[_0x691e('0x2b')][_0x691e('0x2c')],function(_0x9d6d59){return{'name':_0x9d6d59[_0x691e('0x2d')],'type':_0x9d6d59[_0x691e('0x2e')]['key']};});_0x4b1844['model']=_['map'](_0x86a5ec,'name');_0x4b1844[_0x691e('0x2f')]=_[_0x691e('0x30')](_0x3eb857[_0x691e('0x2f')]);_0x4b1844[_0x691e('0x31')]=_[_0x691e('0x32')](_0x4b1844[_0x691e('0x33')],_0x4b1844[_0x691e('0x2f')]);_0x124b7e[_0x691e('0x34')]=_['intersection'](_0x4b1844['model'],qs['fields'](_0x3eb857[_0x691e('0x2f')][_0x691e('0x35')]));_0x124b7e[_0x691e('0x34')]=_0x124b7e['attributes'][_0x691e('0x36')]?_0x124b7e[_0x691e('0x34')]:_0x4b1844[_0x691e('0x33')];if(!_0x3eb857[_0x691e('0x2f')][_0x691e('0x37')](_0x691e('0x38'))){_0x124b7e['limit']=qs[_0x691e('0x1d')](_0x3eb857[_0x691e('0x2f')][_0x691e('0x1d')]);_0x124b7e[_0x691e('0x1c')]=qs[_0x691e('0x1c')](_0x3eb857[_0x691e('0x2f')][_0x691e('0x1c')]);}_0x124b7e['order']=qs['sort'](_0x3eb857[_0x691e('0x2f')][_0x691e('0x39')]);_0x124b7e[_0x691e('0x3a')]=qs['filters'](_[_0x691e('0x3b')](_0x3eb857['query'],_0x4b1844['filters']),_0x86a5ec);if(_0x3eb857[_0x691e('0x2f')][_0x691e('0x3c')]){_0x124b7e[_0x691e('0x3a')]=_[_0x691e('0x3d')](_0x124b7e[_0x691e('0x3a')],{'$or':_['map'](_0x86a5ec,function(_0x1e0c4c){if(_0x1e0c4c[_0x691e('0x2e')]!==_0x691e('0x3e')){var _0x3c7a2c={};_0x3c7a2c[_0x1e0c4c[_0x691e('0x27')]]={'$like':'%'+_0x3eb857[_0x691e('0x2f')]['filter']+'%'};return _0x3c7a2c;}})});}_0x124b7e=_[_0x691e('0x3d')]({},_0x124b7e,_0x3eb857[_0x691e('0x3f')]);var _0x3b9c09={'where':_0x124b7e['where']};return db['UserProfileSection'][_0x691e('0x40')](_0x3b9c09)['then'](function(_0x5a95d5){_0xf89be6[_0x691e('0x40')]=_0x5a95d5;if(_0x3eb857[_0x691e('0x2f')][_0x691e('0x41')]){_0x124b7e['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x124b7e);})[_0x691e('0x23')](function(_0x38cb8b){_0xf89be6[_0x691e('0x42')]=_0x38cb8b;return _0xf89be6;})[_0x691e('0x23')](respondWithFilteredResult(_0x3557ba,_0x124b7e))[_0x691e('0x43')](handleError(_0x3557ba,null));};exports[_0x691e('0x44')]=function(_0x2be921,_0x5a7bc8){var _0x426655={'raw':![],'where':{'id':_0x2be921[_0x691e('0x45')]['id']}},_0x3675bd={};_0x3675bd[_0x691e('0x33')]=_[_0x691e('0x30')](db[_0x691e('0x2b')]['rawAttributes']);_0x3675bd[_0x691e('0x2f')]=_[_0x691e('0x30')](_0x2be921['query']);_0x3675bd[_0x691e('0x31')]=_[_0x691e('0x32')](_0x3675bd[_0x691e('0x33')],_0x3675bd[_0x691e('0x2f')]);_0x426655[_0x691e('0x34')]=_[_0x691e('0x32')](_0x3675bd['model'],qs[_0x691e('0x35')](_0x2be921[_0x691e('0x2f')]['fields']));_0x426655['attributes']=_0x426655[_0x691e('0x34')][_0x691e('0x36')]?_0x426655[_0x691e('0x34')]:_0x3675bd['model'];if(_0x2be921['query'][_0x691e('0x41')]){_0x426655['include']=[{'all':!![]}];}_0x426655=_[_0x691e('0x3d')]({},_0x426655,_0x2be921[_0x691e('0x3f')]);return db[_0x691e('0x2b')][_0x691e('0x46')](_0x426655)[_0x691e('0x23')](handleEntityNotFound(_0x5a7bc8,null))[_0x691e('0x23')](respondWithResult(_0x5a7bc8,null))[_0x691e('0x43')](handleError(_0x5a7bc8,null));};exports[_0x691e('0x47')]=function(_0x1bd600,_0x1dc1ed){return db[_0x691e('0x2b')]['create'](_0x1bd600['body'],{})[_0x691e('0x23')](respondWithResult(_0x1dc1ed,0xc9))[_0x691e('0x43')](handleError(_0x1dc1ed,null));};exports[_0x691e('0x22')]=function(_0x453a89,_0x321f14){if(_0x453a89[_0x691e('0x48')]['id']){delete _0x453a89[_0x691e('0x48')]['id'];}return db[_0x691e('0x2b')]['find']({'where':{'id':_0x453a89[_0x691e('0x45')]['id']}})[_0x691e('0x23')](handleEntityNotFound(_0x321f14,null))[_0x691e('0x23')](saveUpdates(_0x453a89['body'],null))[_0x691e('0x23')](respondWithResult(_0x321f14,null))['catch'](handleError(_0x321f14,null));};exports[_0x691e('0x24')]=function(_0x436daa,_0x4daf02){return db[_0x691e('0x2b')][_0x691e('0x46')]({'where':{'id':_0x436daa[_0x691e('0x45')]['id']}})[_0x691e('0x23')](handleEntityNotFound(_0x4daf02,null))[_0x691e('0x23')](removeEntity(_0x4daf02,null))[_0x691e('0x43')](handleError(_0x4daf02,null));};exports[_0x691e('0x49')]=function(_0x10b22e,_0x233aea){return db[_0x691e('0x2b')][_0x691e('0x49')]()[_0x691e('0x23')](respondWithResult(_0x233aea,null))[_0x691e('0x43')](handleError(_0x233aea,null));}; \ No newline at end of file +var _0x50fe=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','status','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2fe23e,_0x5afd8a){var _0x4a0b0e=function(_0xbd4b97){while(--_0xbd4b97){_0x2fe23e['push'](_0x2fe23e['shift']());}};_0x4a0b0e(++_0x5afd8a);}(_0x50fe,0x12a));var _0xe50f=function(_0x1b6ca1,_0x24349d){_0x1b6ca1=_0x1b6ca1-0x0;var _0x49d973=_0x50fe[_0x1b6ca1];return _0x49d973;};'use strict';var pdf=require(_0xe50f('0x0'));var emlformat=require(_0xe50f('0x1'));var rimraf=require(_0xe50f('0x2'));var zipdir=require(_0xe50f('0x3'));var jsonpatch=require(_0xe50f('0x4'));var rp=require(_0xe50f('0x5'));var moment=require(_0xe50f('0x6'));var BPromise=require(_0xe50f('0x7'));var Mustache=require(_0xe50f('0x8'));var util=require(_0xe50f('0x9'));var path=require(_0xe50f('0xa'));var sox=require(_0xe50f('0xb'));var csv=require(_0xe50f('0xc'));var ejs=require(_0xe50f('0xd'));var fs=require('fs');var _=require(_0xe50f('0xe'));var squel=require(_0xe50f('0xf'));var crypto=require('crypto');var jsforce=require(_0xe50f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe50f('0xc'));var querystring=require('querystring');var Papa=require(_0xe50f('0x11'));var Redis=require(_0xe50f('0x12'));var authService=require(_0xe50f('0x13'));var qs=require(_0xe50f('0x14'));var as=require(_0xe50f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe50f('0x16'))(_0xe50f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe50f('0x18'))['db'];function respondWithStatusCode(_0x2d7162,_0x247433){_0x247433=_0x247433||0xcc;return function(_0xd5464e){if(_0xd5464e){return _0x2d7162[_0xe50f('0x19')](_0x247433);}return _0x2d7162['status'](_0x247433)[_0xe50f('0x1a')]();};}function respondWithResult(_0x7de50e,_0x1be77b){_0x1be77b=_0x1be77b||0xc8;return function(_0x31728b){if(_0x31728b){return _0x7de50e['status'](_0x1be77b)[_0xe50f('0x1b')](_0x31728b);}};}function respondWithFilteredResult(_0x3aed23,_0x5b5ab0){return function(_0x34899b){if(_0x34899b){var _0x402666=_0x34899b[_0xe50f('0x1c')],_0x27e240=_0x5b5ab0[_0xe50f('0x1d')],_0xee24d3=_0x5b5ab0[_0xe50f('0x1d')]+_0x5b5ab0[_0xe50f('0x1e')],_0x291598;if(_0xee24d3>=_0x402666){_0xee24d3=_0x402666;_0x291598=0xc8;}else{_0x291598=0xce;}_0x3aed23['status'](_0x291598);return _0x3aed23['set'](_0xe50f('0x1f'),_0x27e240+'-'+_0xee24d3+'/'+_0x402666)[_0xe50f('0x1b')](_0x34899b);}return null;};}function patchUpdates(_0x598fef){return function(_0x408637){try{jsonpatch['apply'](_0x408637,_0x598fef,!![]);}catch(_0x5777b1){return BPromise[_0xe50f('0x20')](_0x5777b1);}return _0x408637[_0xe50f('0x21')]();};}function saveUpdates(_0x95e631,_0x40be7a){return function(_0x8c94c9){if(_0x8c94c9){return _0x8c94c9[_0xe50f('0x22')](_0x95e631)['then'](function(_0x28e180){return _0x28e180;});}return null;};}function removeEntity(_0x4beaca,_0x41b00e){return function(_0x36e678){if(_0x36e678){return _0x36e678[_0xe50f('0x23')]()[_0xe50f('0x24')](function(){_0x4beaca[_0xe50f('0x25')](0xcc)[_0xe50f('0x1a')]();});}};}function handleEntityNotFound(_0x331fd9,_0x4d9f15){return function(_0xa01752){if(!_0xa01752){_0x331fd9[_0xe50f('0x19')](0x194);}return _0xa01752;};}function handleError(_0x29ef64,_0x1aaf6b){_0x1aaf6b=_0x1aaf6b||0x1f4;return function(_0x11a45d){logger[_0xe50f('0x26')](_0x11a45d[_0xe50f('0x27')]);if(_0x11a45d[_0xe50f('0x28')]){delete _0x11a45d['name'];}_0x29ef64['status'](_0x1aaf6b)['send'](_0x11a45d);};}exports[_0xe50f('0x29')]=function(_0x5e9d55,_0x3ff6b2){var _0x15de08={},_0x151be4={},_0x5ad769={'count':0x0,'rows':[]};var _0x565e6e=_[_0xe50f('0x2a')](db[_0xe50f('0x2b')][_0xe50f('0x2c')],function(_0x2abbb6){return{'name':_0x2abbb6[_0xe50f('0x2d')],'type':_0x2abbb6['type'][_0xe50f('0x2e')]};});_0x151be4[_0xe50f('0x2f')]=_[_0xe50f('0x2a')](_0x565e6e,_0xe50f('0x28'));_0x151be4['query']=_[_0xe50f('0x30')](_0x5e9d55[_0xe50f('0x31')]);_0x151be4[_0xe50f('0x32')]=_[_0xe50f('0x33')](_0x151be4[_0xe50f('0x2f')],_0x151be4[_0xe50f('0x31')]);_0x15de08[_0xe50f('0x34')]=_['intersection'](_0x151be4['model'],qs[_0xe50f('0x35')](_0x5e9d55[_0xe50f('0x31')]['fields']));_0x15de08[_0xe50f('0x34')]=_0x15de08[_0xe50f('0x34')][_0xe50f('0x36')]?_0x15de08['attributes']:_0x151be4[_0xe50f('0x2f')];if(!_0x5e9d55['query'][_0xe50f('0x37')](_0xe50f('0x38'))){_0x15de08['limit']=qs[_0xe50f('0x1e')](_0x5e9d55[_0xe50f('0x31')][_0xe50f('0x1e')]);_0x15de08[_0xe50f('0x1d')]=qs[_0xe50f('0x1d')](_0x5e9d55[_0xe50f('0x31')][_0xe50f('0x1d')]);}_0x15de08[_0xe50f('0x39')]=qs['sort'](_0x5e9d55['query'][_0xe50f('0x3a')]);_0x15de08[_0xe50f('0x3b')]=qs[_0xe50f('0x32')](_[_0xe50f('0x3c')](_0x5e9d55['query'],_0x151be4[_0xe50f('0x32')]),_0x565e6e);if(_0x5e9d55[_0xe50f('0x31')][_0xe50f('0x3d')]){_0x15de08[_0xe50f('0x3b')]=_['merge'](_0x15de08[_0xe50f('0x3b')],{'$or':_['map'](_0x565e6e,function(_0x2cda6a){if(_0x2cda6a[_0xe50f('0x3e')]!==_0xe50f('0x3f')){var _0x5a66f8={};_0x5a66f8[_0x2cda6a[_0xe50f('0x28')]]={'$like':'%'+_0x5e9d55[_0xe50f('0x31')]['filter']+'%'};return _0x5a66f8;}})});}_0x15de08=_['merge']({},_0x15de08,_0x5e9d55['options']);var _0x31ac7f={'where':_0x15de08[_0xe50f('0x3b')]};return db[_0xe50f('0x2b')][_0xe50f('0x1c')](_0x31ac7f)[_0xe50f('0x24')](function(_0xce9a43){_0x5ad769[_0xe50f('0x1c')]=_0xce9a43;if(_0x5e9d55[_0xe50f('0x31')][_0xe50f('0x40')]){_0x15de08[_0xe50f('0x41')]=[{'all':!![]}];}return db[_0xe50f('0x2b')][_0xe50f('0x42')](_0x15de08);})[_0xe50f('0x24')](function(_0x1a649c){_0x5ad769[_0xe50f('0x43')]=_0x1a649c;return _0x5ad769;})[_0xe50f('0x24')](respondWithFilteredResult(_0x3ff6b2,_0x15de08))[_0xe50f('0x44')](handleError(_0x3ff6b2,null));};exports[_0xe50f('0x45')]=function(_0x386ed0,_0x51689d){var _0x3acd2f={'raw':![],'where':{'id':_0x386ed0[_0xe50f('0x46')]['id']}},_0x5de02b={};_0x5de02b[_0xe50f('0x2f')]=_[_0xe50f('0x30')](db[_0xe50f('0x2b')][_0xe50f('0x2c')]);_0x5de02b['query']=_['keys'](_0x386ed0[_0xe50f('0x31')]);_0x5de02b[_0xe50f('0x32')]=_[_0xe50f('0x33')](_0x5de02b[_0xe50f('0x2f')],_0x5de02b[_0xe50f('0x31')]);_0x3acd2f[_0xe50f('0x34')]=_['intersection'](_0x5de02b['model'],qs[_0xe50f('0x35')](_0x386ed0[_0xe50f('0x31')][_0xe50f('0x35')]));_0x3acd2f[_0xe50f('0x34')]=_0x3acd2f['attributes'][_0xe50f('0x36')]?_0x3acd2f[_0xe50f('0x34')]:_0x5de02b[_0xe50f('0x2f')];if(_0x386ed0[_0xe50f('0x31')]['includeAll']){_0x3acd2f[_0xe50f('0x41')]=[{'all':!![]}];}_0x3acd2f=_[_0xe50f('0x47')]({},_0x3acd2f,_0x386ed0['options']);return db[_0xe50f('0x2b')][_0xe50f('0x48')](_0x3acd2f)[_0xe50f('0x24')](handleEntityNotFound(_0x51689d,null))['then'](respondWithResult(_0x51689d,null))[_0xe50f('0x44')](handleError(_0x51689d,null));};exports[_0xe50f('0x49')]=function(_0x18fb83,_0x255795){return db['UserProfileSection'][_0xe50f('0x49')](_0x18fb83[_0xe50f('0x4a')],{})['then'](respondWithResult(_0x255795,0xc9))['catch'](handleError(_0x255795,null));};exports[_0xe50f('0x22')]=function(_0x2a9f54,_0xc9a633){if(_0x2a9f54[_0xe50f('0x4a')]['id']){delete _0x2a9f54[_0xe50f('0x4a')]['id'];}return db[_0xe50f('0x2b')][_0xe50f('0x48')]({'where':{'id':_0x2a9f54[_0xe50f('0x46')]['id']}})[_0xe50f('0x24')](handleEntityNotFound(_0xc9a633,null))[_0xe50f('0x24')](saveUpdates(_0x2a9f54['body'],null))[_0xe50f('0x24')](respondWithResult(_0xc9a633,null))['catch'](handleError(_0xc9a633,null));};exports[_0xe50f('0x23')]=function(_0x5a10dd,_0x177669){return db[_0xe50f('0x2b')][_0xe50f('0x48')]({'where':{'id':_0x5a10dd['params']['id']}})['then'](handleEntityNotFound(_0x177669,null))[_0xe50f('0x24')](removeEntity(_0x177669,null))['catch'](handleError(_0x177669,null));};exports['describe']=function(_0x23f22e,_0x4374e7){return db[_0xe50f('0x2b')][_0xe50f('0x4b')]()[_0xe50f('0x24')](respondWithResult(_0x4374e7,null))[_0xe50f('0x44')](handleError(_0x4374e7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ca49aa9..ad88778 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 _0x241d=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x41bcd5,_0x2877d8){var _0x45a42c=function(_0x5cbcdb){while(--_0x5cbcdb){_0x41bcd5['push'](_0x41bcd5['shift']());}};_0x45a42c(++_0x2877d8);}(_0x241d,0xe7));var _0xd241=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x241d[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xd241('0x0'));var util=require(_0xd241('0x1'));var logger=require(_0xd241('0x2'))('api');var moment=require(_0xd241('0x3'));var BPromise=require(_0xd241('0x4'));var rp=require(_0xd241('0x5'));var fs=require('fs');var path=require(_0xd241('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd241('0x7'));module[_0xd241('0x8')]=function(_0x8ac38a,_0x111be2){return _0x8ac38a[_0xd241('0x9')](_0xd241('0xa'),attributes,{'tableName':_0xd241('0xb'),'paranoid':![],'indexes':[{'name':_0xd241('0xc'),'fields':['sectionId',_0xd241('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4248=['api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x317144,_0x3eece0){var _0x49c923=function(_0x1e254b){while(--_0x1e254b){_0x317144['push'](_0x317144['shift']());}};_0x49c923(++_0x3eece0);}(_0x4248,0x76));var _0x8424=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0x4248[_0x2e0ffa];return _0x24d627;};'use strict';var _=require(_0x8424('0x0'));var util=require(_0x8424('0x1'));var logger=require('../../config/logger')(_0x8424('0x2'));var moment=require(_0x8424('0x3'));var BPromise=require(_0x8424('0x4'));var rp=require(_0x8424('0x5'));var fs=require('fs');var path=require(_0x8424('0x6'));var rimraf=require(_0x8424('0x7'));var config=require('../../config/environment');var attributes=require(_0x8424('0x8'));module[_0x8424('0x9')]=function(_0x45d378,_0x92f7e0){return _0x45d378[_0x8424('0xa')]('UserProfileSection',attributes,{'tableName':_0x8424('0xb'),'paranoid':![],'indexes':[{'name':_0x8424('0xc'),'fields':[_0x8424('0xd'),_0x8424('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f96c418..cc07c10 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 _0x30cb=['../../config/utils','rpc','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x14280a,_0x5930a9){var _0x3cae77=function(_0x18cf8){while(--_0x18cf8){_0x14280a['push'](_0x14280a['shift']());}};_0x3cae77(++_0x5930a9);}(_0x30cb,0xb8));var _0xb30c=function(_0x503294,_0x806171){_0x503294=_0x503294-0x0;var _0xcdf233=_0x30cb[_0x503294];return _0xcdf233;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var moment=require(_0xb30c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb30c('0x3'));var fs=require('fs');var Redis=require(_0xb30c('0x4'));var db=require(_0xb30c('0x5'))['db'];var utils=require(_0xb30c('0x6'));var logger=require('../../config/logger')(_0xb30c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb30c('0x8'));var client=jayson[_0xb30c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0614,_0x59ea19,_0x27c524){return new BPromise(function(_0x141279,_0x53a5db){return client[_0xb30c('0xa')](_0x1f0614,_0x27c524)['then'](function(_0x19463e){logger[_0xb30c('0xb')](_0xb30c('0xc'),_0x59ea19,_0xb30c('0xd'));logger['debug'](_0xb30c('0xe'),_0x59ea19,_0xb30c('0xd'),JSON[_0xb30c('0xf')](_0x19463e));if(_0x19463e[_0xb30c('0x10')]){if(_0x19463e['error']['code']===0x1f4){logger[_0xb30c('0x10')](_0xb30c('0xc'),_0x59ea19,_0x19463e[_0xb30c('0x10')]['message']);return _0x53a5db(_0x19463e[_0xb30c('0x10')][_0xb30c('0x11')]);}logger[_0xb30c('0x10')](_0xb30c('0xc'),_0x59ea19,_0x19463e[_0xb30c('0x10')][_0xb30c('0x11')]);return _0x141279(_0x19463e['error'][_0xb30c('0x11')]);}else{logger[_0xb30c('0xb')](_0xb30c('0xc'),_0x59ea19,_0xb30c('0xd'));_0x141279(_0x19463e[_0xb30c('0x12')][_0xb30c('0x11')]);}})['catch'](function(_0x8815d){logger[_0xb30c('0x10')](_0xb30c('0xc'),_0x59ea19,_0x8815d);_0x53a5db(_0x8815d);});});} \ No newline at end of file +var _0xcf8d=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xcf8d,0x6b));var _0xdcf8=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0xcf8d[_0xe15270];return _0x1e813b;};'use strict';var _=require(_0xdcf8('0x0'));var util=require(_0xdcf8('0x1'));var moment=require(_0xdcf8('0x2'));var BPromise=require(_0xdcf8('0x3'));var rs=require(_0xdcf8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcf8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdcf8('0x6'));var config=require('../../config/environment');var jayson=require(_0xdcf8('0x7'));var client=jayson[_0xdcf8('0x8')][_0xdcf8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x512f0d,_0x416d8d,_0x54e5dc){return new BPromise(function(_0x45de7a,_0x4bf6db){return client[_0xdcf8('0xa')](_0x512f0d,_0x54e5dc)['then'](function(_0x5b39b0){logger[_0xdcf8('0xb')](_0xdcf8('0xc'),_0x416d8d,_0xdcf8('0xd'));logger[_0xdcf8('0xe')](_0xdcf8('0xf'),_0x416d8d,_0xdcf8('0xd'),JSON['stringify'](_0x5b39b0));if(_0x5b39b0[_0xdcf8('0x10')]){if(_0x5b39b0['error']['code']===0x1f4){logger[_0xdcf8('0x10')](_0xdcf8('0xc'),_0x416d8d,_0x5b39b0[_0xdcf8('0x10')]['message']);return _0x4bf6db(_0x5b39b0[_0xdcf8('0x10')][_0xdcf8('0x11')]);}logger['error'](_0xdcf8('0xc'),_0x416d8d,_0x5b39b0[_0xdcf8('0x10')]['message']);return _0x45de7a(_0x5b39b0[_0xdcf8('0x10')][_0xdcf8('0x11')]);}else{logger[_0xdcf8('0xb')](_0xdcf8('0xc'),_0x416d8d,'request\x20sent');_0x45de7a(_0x5b39b0[_0xdcf8('0x12')][_0xdcf8('0x11')]);}})[_0xdcf8('0x13')](function(_0x298750){logger[_0xdcf8('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x416d8d,_0x298750);_0x4bf6db(_0x298750);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a2cd8c8..0a63965 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 _0x4b1e=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4b1e,0x12a));var _0xe4b1=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x4b1e[_0x54b283];return _0x2462b3;};'use strict';var multer=require(_0xe4b1('0x0'));var util=require(_0xe4b1('0x1'));var path=require(_0xe4b1('0x2'));var timeout=require(_0xe4b1('0x3'));var express=require(_0xe4b1('0x4'));var router=express[_0xe4b1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4b1('0x6'));var config=require('../../config/environment');module[_0xe4b1('0x7')]=router; \ No newline at end of file +var _0x14ae=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1c4ded,_0x3e3087){var _0x11bada=function(_0x4d3679){while(--_0x4d3679){_0x1c4ded['push'](_0x1c4ded['shift']());}};_0x11bada(++_0x3e3087);}(_0x14ae,0x1b0));var _0xe14a=function(_0x1ebed1,_0x14d027){_0x1ebed1=_0x1ebed1-0x0;var _0x39bfc9=_0x14ae[_0x1ebed1];return _0x39bfc9;};'use strict';var multer=require(_0xe14a('0x0'));var util=require(_0xe14a('0x1'));var path=require('path');var timeout=require(_0xe14a('0x2'));var express=require(_0xe14a('0x3'));var router=express[_0xe14a('0x4')]();var auth=require(_0xe14a('0x5'));var interaction=require(_0xe14a('0x6'));var config=require('../../config/environment');module[_0xe14a('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 3bb4132..bb1767b 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x4072be,_0x5dde18){var _0x4e21ce=function(_0x198cf7){while(--_0x198cf7){_0x4072be['push'](_0x4072be['shift']());}};_0x4e21ce(++_0x5dde18);}(_0xe706,0xa3));var _0x6e70=function(_0x48564d,_0x2c1c8c){_0x48564d=_0x48564d-0x0;var _0x2ad779=_0xe706[_0x48564d];return _0x2ad779;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1ddd1a,_0x4e71ca){var _0x19e246=function(_0x58cc2f){while(--_0x58cc2f){_0x1ddd1a['push'](_0x1ddd1a['shift']());}};_0x19e246(++_0x4e71ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index d7e5bb8..12e65c6 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 _0x0fd9=['./userSmsQueue.attributes','exports','UserSmsQueue','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2086bd,_0x2b9a85){var _0x7517c2=function(_0x484416){while(--_0x484416){_0x2086bd['push'](_0x2086bd['shift']());}};_0x7517c2(++_0x2b9a85);}(_0x0fd9,0xa3));var _0x90fd=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0fd9[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var moment=require(_0x90fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90fd('0x4'));var rimraf=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var attributes=require(_0x90fd('0x7'));module[_0x90fd('0x8')]=function(_0x23e11b,_0x5e2107){return _0x23e11b['define'](_0x90fd('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7117=['api','bluebird','request-promise','rimraf','./userSmsQueue.attributes','exports','lodash','util','../../config/logger'];(function(_0x248fc8,_0x121ebf){var _0x1ec5d1=function(_0x4784fc){while(--_0x4784fc){_0x248fc8['push'](_0x248fc8['shift']());}};_0x1ec5d1(++_0x121ebf);}(_0x7117,0x1ec));var _0x7711=function(_0x171cb0,_0x169596){_0x171cb0=_0x171cb0-0x0;var _0x121a84=_0x7117[_0x171cb0];return _0x121a84;};'use strict';var _=require(_0x7711('0x0'));var util=require(_0x7711('0x1'));var logger=require(_0x7711('0x2'))(_0x7711('0x3'));var moment=require('moment');var BPromise=require(_0x7711('0x4'));var rp=require(_0x7711('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7711('0x6'));var config=require('../../config/environment');var attributes=require(_0x7711('0x7'));module[_0x7711('0x8')]=function(_0x414dcc,_0x5ca3dc){return _0x414dcc['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5db33aa..8ebf4be 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 _0xb486=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1eeb7c,_0x40c87d){var _0x54d122=function(_0x59fe24){while(--_0x59fe24){_0x1eeb7c['push'](_0x1eeb7c['shift']());}};_0x54d122(++_0x40c87d);}(_0xb486,0xd4));var _0x6b48=function(_0x281c92,_0x244f70){_0x281c92=_0x281c92-0x0;var _0x3301bb=_0xb486[_0x281c92];return _0x3301bb;};'use strict';var _=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var moment=require(_0x6b48('0x2'));var BPromise=require(_0x6b48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b48('0x4'));var db=require(_0x6b48('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b48('0x6'))(_0x6b48('0x7'));var config=require(_0x6b48('0x8'));var jayson=require(_0x6b48('0x9'));var client=jayson[_0x6b48('0xa')][_0x6b48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a7ef2,_0x17e25c,_0x54b3b3){return new BPromise(function(_0x22707b,_0x74de32){return client[_0x6b48('0xc')](_0x1a7ef2,_0x54b3b3)[_0x6b48('0xd')](function(_0xd56b18){logger[_0x6b48('0xe')](_0x6b48('0xf'),_0x17e25c,'request\x20sent');logger[_0x6b48('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x17e25c,_0x6b48('0x11'),JSON[_0x6b48('0x12')](_0xd56b18));if(_0xd56b18[_0x6b48('0x13')]){if(_0xd56b18[_0x6b48('0x13')][_0x6b48('0x14')]===0x1f4){logger['error'](_0x6b48('0xf'),_0x17e25c,_0xd56b18[_0x6b48('0x13')]['message']);return _0x74de32(_0xd56b18[_0x6b48('0x13')]['message']);}logger[_0x6b48('0x13')](_0x6b48('0xf'),_0x17e25c,_0xd56b18['error']['message']);return _0x22707b(_0xd56b18['error'][_0x6b48('0x15')]);}else{logger[_0x6b48('0xe')](_0x6b48('0xf'),_0x17e25c,_0x6b48('0x11'));_0x22707b(_0xd56b18['result'][_0x6b48('0x15')]);}})[_0x6b48('0x16')](function(_0x49f410){logger['error'](_0x6b48('0xf'),_0x17e25c,_0x49f410);_0x74de32(_0x49f410);});});} \ No newline at end of file +var _0x16bc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x16bc,0x19c));var _0xc16b=function(_0x2c54d9,_0x1dd408){_0x2c54d9=_0x2c54d9-0x0;var _0x44035b=_0x16bc[_0x2c54d9];return _0x44035b;};'use strict';var _=require(_0xc16b('0x0'));var util=require(_0xc16b('0x1'));var moment=require(_0xc16b('0x2'));var BPromise=require(_0xc16b('0x3'));var rs=require(_0xc16b('0x4'));var fs=require('fs');var Redis=require(_0xc16b('0x5'));var db=require(_0xc16b('0x6'))['db'];var utils=require(_0xc16b('0x7'));var logger=require(_0xc16b('0x8'))('rpc');var config=require(_0xc16b('0x9'));var jayson=require(_0xc16b('0xa'));var client=jayson[_0xc16b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x69c892,_0x10b625,_0x2cf615){return new BPromise(function(_0x2ec940,_0x4d9542){return client['request'](_0x69c892,_0x2cf615)[_0xc16b('0xc')](function(_0x59c281){logger['info'](_0xc16b('0xd'),_0x10b625,_0xc16b('0xe'));logger[_0xc16b('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x10b625,_0xc16b('0xe'),JSON[_0xc16b('0x10')](_0x59c281));if(_0x59c281['error']){if(_0x59c281[_0xc16b('0x11')][_0xc16b('0x12')]===0x1f4){logger['error'](_0xc16b('0xd'),_0x10b625,_0x59c281[_0xc16b('0x11')][_0xc16b('0x13')]);return _0x4d9542(_0x59c281['error'][_0xc16b('0x13')]);}logger[_0xc16b('0x11')](_0xc16b('0xd'),_0x10b625,_0x59c281[_0xc16b('0x11')][_0xc16b('0x13')]);return _0x2ec940(_0x59c281[_0xc16b('0x11')][_0xc16b('0x13')]);}else{logger[_0xc16b('0x14')](_0xc16b('0xd'),_0x10b625,_0xc16b('0xe'));_0x2ec940(_0x59c281[_0xc16b('0x15')][_0xc16b('0x13')]);}})[_0xc16b('0x16')](function(_0x3a634d){logger[_0xc16b('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x10b625,_0x3a634d);_0x4d9542(_0x3a634d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 2536c65..5a623c1 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 _0x87de=['path','connect-timeout','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x87de,0xc2));var _0xe87d=function(_0x194e2b,_0x260485){_0x194e2b=_0x194e2b-0x0;var _0x5a1d1f=_0x87de[_0x194e2b];return _0x5a1d1f;};'use strict';var multer=require(_0xe87d('0x0'));var util=require(_0xe87d('0x1'));var path=require(_0xe87d('0x2'));var timeout=require(_0xe87d('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe87d('0x4'));var config=require(_0xe87d('0x5'));module[_0xe87d('0x6')]=router; \ No newline at end of file +var _0xd968=['util','../../components/auth/service','../../config/environment','exports'];(function(_0x13b5e4,_0x321d09){var _0x9f4d36=function(_0x105309){while(--_0x105309){_0x13b5e4['push'](_0x13b5e4['shift']());}};_0x9f4d36(++_0x321d09);}(_0xd968,0xfc));var _0x8d96=function(_0x23a5e3,_0x2f5d99){_0x23a5e3=_0x23a5e3-0x0;var _0x30851c=_0xd968[_0x23a5e3];return _0x30851c;};'use strict';var multer=require('multer');var util=require(_0x8d96('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8d96('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x8d96('0x2'));module[_0x8d96('0x3')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 205812b..d67d93d 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2d1541,_0x50d32a){var _0x43448c=function(_0x24d4b3){while(--_0x24d4b3){_0x2d1541['push'](_0x2d1541['shift']());}};_0x43448c(++_0x50d32a);}(_0xe706,0xa3));var _0x6e70=function(_0x37f212,_0x9bf1b2){_0x37f212=_0x37f212-0x0;var _0x57ba32=_0xe706[_0x37f212];return _0x57ba32;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x53c08e,_0x3f4c07){var _0x3d73ac=function(_0x1aa020){while(--_0x1aa020){_0x53c08e['push'](_0x53c08e['shift']());}};_0x3d73ac(++_0x3f4c07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ea3836a..3db4231 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 _0x10c7=['./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2fa334,_0xa351de){var _0x5b846c=function(_0x2badc6){while(--_0x2badc6){_0x2fa334['push'](_0x2fa334['shift']());}};_0x5b846c(++_0xa351de);}(_0x10c7,0xee));var _0x710c=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x10c7[_0xe1441d];return _0x2ef242;};'use strict';var _=require(_0x710c('0x0'));var util=require(_0x710c('0x1'));var logger=require(_0x710c('0x2'))(_0x710c('0x3'));var moment=require('moment');var BPromise=require(_0x710c('0x4'));var rp=require(_0x710c('0x5'));var fs=require('fs');var path=require(_0x710c('0x6'));var rimraf=require(_0x710c('0x7'));var config=require(_0x710c('0x8'));var attributes=require(_0x710c('0x9'));module['exports']=function(_0x442fcc,_0x171dd6){return _0x442fcc[_0x710c('0xa')](_0x710c('0xb'),attributes,{'tableName':_0x710c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6275=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x6275,0x10c));var _0x5627=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x6275[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x5627('0x0'));var util=require(_0x5627('0x1'));var logger=require('../../config/logger')(_0x5627('0x2'));var moment=require('moment');var BPromise=require(_0x5627('0x3'));var rp=require(_0x5627('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5627('0x5'));var config=require(_0x5627('0x6'));var attributes=require(_0x5627('0x7'));module[_0x5627('0x8')]=function(_0x904f6e,_0x11c014){return _0x904f6e[_0x5627('0x9')](_0x5627('0xa'),attributes,{'tableName':_0x5627('0xb'),'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 838fd15..d7f683c 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 _0x15a4=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x217d8a,_0x481fe3){var _0x3242f6=function(_0x2c4d77){while(--_0x2c4d77){_0x217d8a['push'](_0x217d8a['shift']());}};_0x3242f6(++_0x481fe3);}(_0x15a4,0xdb));var _0x415a=function(_0x4ea728,_0x3ba8a8){_0x4ea728=_0x4ea728-0x0;var _0x290764=_0x15a4[_0x4ea728];return _0x290764;};'use strict';var _=require('lodash');var util=require(_0x415a('0x0'));var moment=require('moment');var BPromise=require(_0x415a('0x1'));var rs=require(_0x415a('0x2'));var fs=require('fs');var Redis=require(_0x415a('0x3'));var db=require(_0x415a('0x4'))['db'];var utils=require(_0x415a('0x5'));var logger=require(_0x415a('0x6'))(_0x415a('0x7'));var config=require(_0x415a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x415a('0x9')][_0x415a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332e93,_0x144dcf,_0x402b64){return new BPromise(function(_0x372aab,_0x2b99b7){return client['request'](_0x332e93,_0x402b64)[_0x415a('0xb')](function(_0x168d95){logger[_0x415a('0xc')](_0x415a('0xd'),_0x144dcf,_0x415a('0xe'));logger[_0x415a('0xf')](_0x415a('0x10'),_0x144dcf,_0x415a('0xe'),JSON['stringify'](_0x168d95));if(_0x168d95[_0x415a('0x11')]){if(_0x168d95[_0x415a('0x11')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x144dcf,_0x168d95['error'][_0x415a('0x12')]);return _0x2b99b7(_0x168d95[_0x415a('0x11')]['message']);}logger['error'](_0x415a('0xd'),_0x144dcf,_0x168d95[_0x415a('0x11')][_0x415a('0x12')]);return _0x372aab(_0x168d95[_0x415a('0x11')][_0x415a('0x12')]);}else{logger[_0x415a('0xc')](_0x415a('0xd'),_0x144dcf,'request\x20sent');_0x372aab(_0x168d95[_0x415a('0x13')][_0x415a('0x12')]);}})[_0x415a('0x14')](function(_0x4853f1){logger[_0x415a('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x144dcf,_0x4853f1);_0x2b99b7(_0x4853f1);});});} \ No newline at end of file +var _0xa997=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0xfd30fc,_0x5e2dc9){var _0x12089a=function(_0x5a0c38){while(--_0x5a0c38){_0xfd30fc['push'](_0xfd30fc['shift']());}};_0x12089a(++_0x5e2dc9);}(_0xa997,0x166));var _0x7a99=function(_0x30121e,_0x240c86){_0x30121e=_0x30121e-0x0;var _0x4ba328=_0xa997[_0x30121e];return _0x4ba328;};'use strict';var _=require(_0x7a99('0x0'));var util=require(_0x7a99('0x1'));var moment=require(_0x7a99('0x2'));var BPromise=require(_0x7a99('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a99('0x4'));var db=require(_0x7a99('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a99('0x6'))(_0x7a99('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a99('0x8')][_0x7a99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x148618,_0x142ccb,_0x2d77db){return new BPromise(function(_0x11b82a,_0xf42e0f){return client[_0x7a99('0xa')](_0x148618,_0x2d77db)[_0x7a99('0xb')](function(_0x4de298){logger[_0x7a99('0xc')](_0x7a99('0xd'),_0x142ccb,_0x7a99('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x142ccb,_0x7a99('0xe'),JSON[_0x7a99('0xf')](_0x4de298));if(_0x4de298[_0x7a99('0x10')]){if(_0x4de298[_0x7a99('0x10')][_0x7a99('0x11')]===0x1f4){logger[_0x7a99('0x10')](_0x7a99('0xd'),_0x142ccb,_0x4de298[_0x7a99('0x10')][_0x7a99('0x12')]);return _0xf42e0f(_0x4de298[_0x7a99('0x10')]['message']);}logger[_0x7a99('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x142ccb,_0x4de298[_0x7a99('0x10')][_0x7a99('0x12')]);return _0x11b82a(_0x4de298[_0x7a99('0x10')][_0x7a99('0x12')]);}else{logger[_0x7a99('0xc')](_0x7a99('0xd'),_0x142ccb,_0x7a99('0xe'));_0x11b82a(_0x4de298['result']['message']);}})[_0x7a99('0x13')](function(_0x297f7d){logger[_0x7a99('0x10')](_0x7a99('0xd'),_0x142ccb,_0x297f7d);_0xf42e0f(_0x297f7d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6166326..3b69718 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 _0x8763=['express','Router','../../config/environment','exports','multer','util','path'];(function(_0x2cbfd8,_0x394056){var _0x8f14f8=function(_0x3308c5){while(--_0x3308c5){_0x2cbfd8['push'](_0x2cbfd8['shift']());}};_0x8f14f8(++_0x394056);}(_0x8763,0x193));var _0x3876=function(_0x17a08b,_0x3a8ff4){_0x17a08b=_0x17a08b-0x0;var _0x334837=_0x8763[_0x17a08b];return _0x334837;};'use strict';var multer=require(_0x3876('0x0'));var util=require(_0x3876('0x1'));var path=require(_0x3876('0x2'));var timeout=require('connect-timeout');var express=require(_0x3876('0x3'));var router=express[_0x3876('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3876('0x5'));module[_0x3876('0x6')]=router; \ No newline at end of file +var _0xeb2f=['../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express','../../components/auth/service'];(function(_0x3ac4f2,_0x57c011){var _0x4d22fd=function(_0x5baab3){while(--_0x5baab3){_0x3ac4f2['push'](_0x3ac4f2['shift']());}};_0x4d22fd(++_0x57c011);}(_0xeb2f,0x1d8));var _0xfeb2=function(_0xac12b,_0x3f0dfa){_0xac12b=_0xac12b-0x0;var _0x5d1fd3=_0xeb2f[_0xac12b];return _0x5d1fd3;};'use strict';var multer=require(_0xfeb2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfeb2('0x1'));var express=require(_0xfeb2('0x2'));var router=express['Router']();var auth=require(_0xfeb2('0x3'));var interaction=require(_0xfeb2('0x4'));var config=require(_0xfeb2('0x5'));module[_0xfeb2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 438d51e..7522cc9 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 _0x95c2=['STRING','INTEGER','queue_interface','Required\x20by\x20Asterisk'];(function(_0x454d98,_0x231594){var _0x4a3ab0=function(_0x42cf9c){while(--_0x42cf9c){_0x454d98['push'](_0x454d98['shift']());}};_0x4a3ab0(++_0x231594);}(_0x95c2,0xff));var _0x295c=function(_0x1a43ed,_0x1a445b){_0x1a43ed=_0x1a43ed-0x0;var _0x1f05a8=_0x95c2[_0x1a43ed];return _0x1f05a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x295c('0x0')},'membername':{'type':Sequelize[_0x295c('0x1')],'allowNull':![],'comment':_0x295c('0x0')},'UserId':{'type':Sequelize[_0x295c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x295c('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x295c('0x0')},'VoiceQueueId':{'type':Sequelize[_0x295c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x295c('0x1')],'allowNull':![],'unique':_0x295c('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x295c('0x2')](0xb),'defaultValue':0x0,'comment':_0x295c('0x0')},'paused':{'type':Sequelize[_0x295c('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xe117=['INTEGER','sequelize','exports','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x173938,_0xdb4f41){var _0x301ca1=function(_0x14df68){while(--_0x14df68){_0x173938['push'](_0x173938['shift']());}};_0x301ca1(++_0xdb4f41);}(_0xe117,0xf1));var _0x7e11=function(_0x433914,_0x53e9b0){_0x433914=_0x433914-0x0;var _0x5b6c42=_0xe117[_0x433914];return _0x5b6c42;};'use strict';var Sequelize=require(_0x7e11('0x0'));module[_0x7e11('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7e11('0x2')},'membername':{'type':Sequelize[_0x7e11('0x3')],'allowNull':![],'comment':_0x7e11('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7e11('0x3')],'allowNull':![],'unique':_0x7e11('0x4'),'comment':_0x7e11('0x2')},'VoiceQueueId':{'type':Sequelize[_0x7e11('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0x7e11('0x3')],'allowNull':![],'unique':_0x7e11('0x4'),'comment':_0x7e11('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x7e11('0x2')},'paused':{'type':Sequelize[_0x7e11('0x5')](0xb),'defaultValue':0x0,'comment':_0x7e11('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 25f9bbe..f32de80 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 _0xe784=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x534a01,_0x538722){var _0x367cc4=function(_0x4fba29){while(--_0x4fba29){_0x534a01['push'](_0x534a01['shift']());}};_0x367cc4(++_0x538722);}(_0xe784,0x144));var _0x4e78=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe784[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x4e78('0x0'))['db'][_0x4e78('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4e78('0x2')](0x0);var events={'afterCreate':_0x4e78('0x3'),'afterUpdate':_0x4e78('0x4'),'afterDestroy':_0x4e78('0x5')};function emitEvent(_0x442b22){return function(_0x7ff41c,_0x2dde4d,_0x11812f){UserVoiceQueueRtEvents[_0x4e78('0x6')](_0x442b22+':'+_0x7ff41c['id'],_0x7ff41c);UserVoiceQueueRtEvents[_0x4e78('0x6')](_0x442b22,_0x7ff41c);_0x11812f(null);};}for(var e in events){if(events[_0x4e78('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x4e78('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x45ac=['hook','exports','events','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x45ac,0x6e));var _0xc45a=function(_0xdd27d1,_0xb6f0da){_0xdd27d1=_0xdd27d1-0x0;var _0x58220e=_0x45ac[_0xdd27d1];return _0x58220e;};'use strict';var EventEmitter=require(_0xc45a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xc45a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc45a('0x2'),'afterUpdate':_0xc45a('0x3'),'afterDestroy':_0xc45a('0x4')};function emitEvent(_0x1e5f25){return function(_0x184982,_0x2adcd0,_0xa30e8d){UserVoiceQueueRtEvents[_0xc45a('0x5')](_0x1e5f25+':'+_0x184982['id'],_0x184982);UserVoiceQueueRtEvents['emit'](_0x1e5f25,_0x184982);_0xa30e8d(null);};}for(var e in events){if(events[_0xc45a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xc45a('0x7')](e,emitEvent(event));}}module[_0xc45a('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 3cf5333..8e35491 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 _0x512c=['../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','moment','bluebird','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x512c,0x13a));var _0xc512=function(_0x500f3e,_0x11d70f){_0x500f3e=_0x500f3e-0x0;var _0x40fe63=_0x512c[_0x500f3e];return _0x40fe63;};'use strict';var _=require(_0xc512('0x0'));var util=require(_0xc512('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc512('0x2'));var BPromise=require(_0xc512('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc512('0x4'));var rimraf=require(_0xc512('0x5'));var config=require(_0xc512('0x6'));var attributes=require(_0xc512('0x7'));module['exports']=function(_0x558919,_0x5a83c7){return _0x558919['define'](_0xc512('0x8'),attributes,{'tableName':_0xc512('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b98=['define','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1f27cc,_0x26744c){var _0x247aba=function(_0x3bce70){while(--_0x3bce70){_0x1f27cc['push'](_0x1f27cc['shift']());}};_0x247aba(++_0x26744c);}(_0x8b98,0xc8));var _0x88b9=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8b98[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x88b9('0x0'));var util=require(_0x88b9('0x1'));var logger=require(_0x88b9('0x2'))(_0x88b9('0x3'));var moment=require(_0x88b9('0x4'));var BPromise=require(_0x88b9('0x5'));var rp=require(_0x88b9('0x6'));var fs=require('fs');var path=require(_0x88b9('0x7'));var rimraf=require('rimraf');var config=require(_0x88b9('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x2f3323,_0xd1b5e6){return _0x2f3323[_0x88b9('0x9')](_0x88b9('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index c20111a..ca7262c 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 _0x397a=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x10d090,_0x2f7517){var _0x25a7b9=function(_0x170790){while(--_0x170790){_0x10d090['push'](_0x10d090['shift']());}};_0x25a7b9(++_0x2f7517);}(_0x397a,0x7a));var _0xa397=function(_0x29802a,_0x2d2a54){_0x29802a=_0x29802a-0x0;var _0x11eb27=_0x397a[_0x29802a];return _0x11eb27;};'use strict';var _=require(_0xa397('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa397('0x1'));var fs=require('fs');var Redis=require(_0xa397('0x2'));var db=require(_0xa397('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa397('0x4'))(_0xa397('0x5'));var config=require(_0xa397('0x6'));var jayson=require(_0xa397('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa397('0x8')]=_[_0xa397('0x9')](config[_0xa397('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa397('0xa'))(new Redis(config[_0xa397('0x8')]));require(_0xa397('0xb'))[_0xa397('0xc')](socket);function respondWithRpcPromise(_0x12868e,_0x5e27e3,_0x5262f1){return new BPromise(function(_0x14c0d9,_0x44c222){return client[_0xa397('0xd')](_0x12868e,_0x5262f1)[_0xa397('0xe')](function(_0x240f7f){logger[_0xa397('0xf')](_0xa397('0x10'),_0x5e27e3,_0xa397('0x11'));logger['debug'](_0xa397('0x12'),_0x5e27e3,'request\x20sent',JSON['stringify'](_0x240f7f));if(_0x240f7f[_0xa397('0x13')]){if(_0x240f7f[_0xa397('0x13')]['code']===0x1f4){logger['error'](_0xa397('0x10'),_0x5e27e3,_0x240f7f[_0xa397('0x13')]['message']);return _0x44c222(_0x240f7f[_0xa397('0x13')][_0xa397('0x14')]);}logger[_0xa397('0x13')](_0xa397('0x10'),_0x5e27e3,_0x240f7f[_0xa397('0x13')]['message']);return _0x14c0d9(_0x240f7f[_0xa397('0x13')][_0xa397('0x14')]);}else{logger[_0xa397('0xf')](_0xa397('0x10'),_0x5e27e3,_0xa397('0x11'));_0x14c0d9(_0x240f7f[_0xa397('0x15')][_0xa397('0x14')]);}})['catch'](function(_0x525580){logger[_0xa397('0x13')](_0xa397('0x10'),_0x5e27e3,_0x525580);_0x44c222(_0x525580);});});}exports[_0xa397('0x16')]=function(_0x4da23a){var _0x7d5c6d=this;return new Promise(function(_0x40887d,_0x447325){return db['UserVoiceQueueRt']['findAll']({'raw':_0x4da23a[_0xa397('0x17')]?_0x4da23a[_0xa397('0x17')][_0xa397('0x18')]===undefined?!![]:![]:!![],'where':_0x4da23a[_0xa397('0x17')]?_0x4da23a[_0xa397('0x17')][_0xa397('0x19')]||null:null,'attributes':[[db[_0xa397('0x1a')]['fn'](_0xa397('0x1b'),db[_0xa397('0x1a')]['fn']('IF',db[_0xa397('0x1a')][_0xa397('0x1c')](_0xa397('0x1d')))),_0xa397('0x1e')]]})[_0xa397('0xe')](function(_0x4297c4){logger[_0xa397('0xf')](_0xa397('0x16'),_0x4da23a);logger[_0xa397('0x1f')](_0xa397('0x16'),_0x4da23a,JSON[_0xa397('0x20')](_0x4297c4));_0x40887d(_0x4297c4);})['catch'](function(_0x52aad2){logger['error'](_0xa397('0x16'),_0x52aad2[_0xa397('0x14')],_0x4da23a);_0x447325(_0x7d5c6d[_0xa397('0x13')](0x1f4,_0x52aad2[_0xa397('0x14')]));});});}; \ No newline at end of file +var _0x3a69=['raw','COUNT','sequelize','outboundQueuePauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options'];(function(_0x62b463,_0x246300){var _0x33dd22=function(_0x4581ea){while(--_0x4581ea){_0x62b463['push'](_0x62b463['shift']());}};_0x33dd22(++_0x246300);}(_0x3a69,0x12c));var _0x93a6=function(_0x47d5c0,_0x5123f6){_0x47d5c0=_0x47d5c0-0x0;var _0x469704=_0x3a69[_0x47d5c0];return _0x469704;};'use strict';var _=require('lodash');var util=require(_0x93a6('0x0'));var moment=require(_0x93a6('0x1'));var BPromise=require(_0x93a6('0x2'));var rs=require(_0x93a6('0x3'));var fs=require('fs');var Redis=require(_0x93a6('0x4'));var db=require(_0x93a6('0x5'))['db'];var utils=require(_0x93a6('0x6'));var logger=require(_0x93a6('0x7'))(_0x93a6('0x8'));var config=require(_0x93a6('0x9'));var jayson=require(_0x93a6('0xa'));var client=jayson[_0x93a6('0xb')][_0x93a6('0xc')]({'port':0x232a});config[_0x93a6('0xd')]=_[_0x93a6('0xe')](config[_0x93a6('0xd')],{'host':_0x93a6('0xf'),'port':0x18eb});var socket=require(_0x93a6('0x10'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x93a6('0x11')](socket);function respondWithRpcPromise(_0x3cecb8,_0x25393a,_0x58c8b0){return new BPromise(function(_0x1c4854,_0x52a337){return client[_0x93a6('0x12')](_0x3cecb8,_0x58c8b0)[_0x93a6('0x13')](function(_0x53b140){logger[_0x93a6('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x25393a,_0x93a6('0x15'));logger[_0x93a6('0x16')](_0x93a6('0x17'),_0x25393a,'request\x20sent',JSON['stringify'](_0x53b140));if(_0x53b140[_0x93a6('0x18')]){if(_0x53b140['error'][_0x93a6('0x19')]===0x1f4){logger[_0x93a6('0x18')](_0x93a6('0x1a'),_0x25393a,_0x53b140[_0x93a6('0x18')][_0x93a6('0x1b')]);return _0x52a337(_0x53b140[_0x93a6('0x18')][_0x93a6('0x1b')]);}logger[_0x93a6('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x25393a,_0x53b140['error'][_0x93a6('0x1b')]);return _0x1c4854(_0x53b140[_0x93a6('0x18')][_0x93a6('0x1b')]);}else{logger[_0x93a6('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x25393a,_0x93a6('0x15'));_0x1c4854(_0x53b140[_0x93a6('0x1c')][_0x93a6('0x1b')]);}})[_0x93a6('0x1d')](function(_0xee868f){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x25393a,_0xee868f);_0x52a337(_0xee868f);});});}exports[_0x93a6('0x1e')]=function(_0x437082){var _0x2a913a=this;return new Promise(function(_0x1132e7,_0x58ba99){return db[_0x93a6('0x1f')]['findAll']({'raw':_0x437082[_0x93a6('0x20')]?_0x437082[_0x93a6('0x20')][_0x93a6('0x21')]===undefined?!![]:![]:!![],'where':_0x437082[_0x93a6('0x20')]?_0x437082[_0x93a6('0x20')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x93a6('0x22'),db['sequelize']['fn']('IF',db[_0x93a6('0x23')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x93a6('0x24')]]})[_0x93a6('0x13')](function(_0x37946b){logger[_0x93a6('0x14')]('GetVoiceQueueRtPauses',_0x437082);logger['debug']('GetVoiceQueueRtPauses',_0x437082,JSON['stringify'](_0x37946b));_0x1132e7(_0x37946b);})['catch'](function(_0x5a39c3){logger[_0x93a6('0x18')](_0x93a6('0x1e'),_0x5a39c3[_0x93a6('0x1b')],_0x437082);_0x58ba99(_0x2a913a[_0x93a6('0x18')](0x1f4,_0x5a39c3[_0x93a6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7686221..029a599 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 _0xca2a=['./userVoiceQueueRt.events','save','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xca2a,0xaf));var _0xaca2=function(_0x17a0db,_0x17b665){_0x17a0db=_0x17a0db-0x0;var _0x30b9d5=_0xca2a[_0x17a0db];return _0x30b9d5;};'use strict';var UserVoiceQueueRtEvents=require(_0xaca2('0x0'));var events=[_0xaca2('0x1'),'remove','update'];function createListener(_0x3d94ec,_0x202039){return function(_0x253d76){_0x202039[_0xaca2('0x2')](_0x3d94ec,_0x253d76);};}function removeListener(_0x53b040,_0x2594df){return function(){UserVoiceQueueRtEvents[_0xaca2('0x3')](_0x53b040,_0x2594df);};}exports[_0xaca2('0x4')]=function(_0x219204){for(var _0x41381a=0x0,_0x4b6d05=events[_0xaca2('0x5')];_0x41381a<_0x4b6d05;_0x41381a++){var _0x5803da=events[_0x41381a];var _0x755b56=createListener(_0xaca2('0x6')+_0x5803da,_0x219204);UserVoiceQueueRtEvents['on'](_0x5803da,_0x755b56);}}; \ No newline at end of file +var _0xf43f=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener'];(function(_0xa82131,_0x5c57a9){var _0xaf0d12=function(_0x5b044a){while(--_0x5b044a){_0xa82131['push'](_0xa82131['shift']());}};_0xaf0d12(++_0x5c57a9);}(_0xf43f,0x8e));var _0xff43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf43f[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xff43('0x0'));var events=[_0xff43('0x1'),_0xff43('0x2'),'update'];function createListener(_0x531768,_0x5a882a){return function(_0x1745c9){_0x5a882a[_0xff43('0x3')](_0x531768,_0x1745c9);};}function removeListener(_0x13abe1,_0xe919bd){return function(){UserVoiceQueueRtEvents[_0xff43('0x4')](_0x13abe1,_0xe919bd);};}exports[_0xff43('0x5')]=function(_0x3ec43a){for(var _0x3cc317=0x0,_0xa94630=events['length'];_0x3cc317<_0xa94630;_0x3cc317++){var _0x1aa795=events[_0x3cc317];var _0x4016fd=createListener(_0xff43('0x6')+_0x1aa795,_0x3ec43a);UserVoiceQueueRtEvents['on'](_0x1aa795,_0x4016fd);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index cf83c74..6f596a5 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 _0x0a33=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','multer','util'];(function(_0x5d5979,_0x3b4921){var _0x237182=function(_0xbd4df7){while(--_0xbd4df7){_0x5d5979['push'](_0x5d5979['shift']());}};_0x237182(++_0x3b4921);}(_0x0a33,0x1e8));var _0x30a3=function(_0x3a0f55,_0x1b1f65){_0x3a0f55=_0x3a0f55-0x0;var _0x129a1a=_0x0a33[_0x3a0f55];return _0x129a1a;};'use strict';var multer=require(_0x30a3('0x0'));var util=require(_0x30a3('0x1'));var path=require(_0x30a3('0x2'));var timeout=require(_0x30a3('0x3'));var express=require('express');var router=express[_0x30a3('0x4')]();var auth=require(_0x30a3('0x5'));var interaction=require(_0x30a3('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x285b=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xc07d2b,_0x1e71e){var _0x31b1ec=function(_0x4331f0){while(--_0x4331f0){_0xc07d2b['push'](_0xc07d2b['shift']());}};_0x31b1ec(++_0x1e71e);}(_0x285b,0xa5));var _0xb285=function(_0x249fa3,_0xdd0af9){_0x249fa3=_0x249fa3-0x0;var _0x5eb304=_0x285b[_0x249fa3];return _0x5eb304;};'use strict';var multer=require(_0xb285('0x0'));var util=require(_0xb285('0x1'));var path=require(_0xb285('0x2'));var timeout=require(_0xb285('0x3'));var express=require(_0xb285('0x4'));var router=express['Router']();var auth=require(_0xb285('0x5'));var interaction=require(_0xb285('0x6'));var config=require(_0xb285('0x7'));module[_0xb285('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9888aec..2298b1e 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x8f9c9,_0x25649d){var _0xcb89d=function(_0x68d43e){while(--_0x68d43e){_0x8f9c9['push'](_0x8f9c9['shift']());}};_0xcb89d(++_0x25649d);}(_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(_0x456e19,_0x56b700){var _0x297a29=function(_0xbe6a66){while(--_0xbe6a66){_0x456e19['push'](_0x456e19['shift']());}};_0x297a29(++_0x56b700);}(_0xe706,0xa3));var _0x6e70=function(_0x495c52,_0x53c0cc){_0x495c52=_0x495c52-0x0;var _0x2b4bb2=_0xe706[_0x495c52];return _0x2b4bb2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b1bac33..3002907 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 _0x323f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x323f,0x185));var _0xf323=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x323f[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xf323('0x0'));var util=require('util');var logger=require(_0xf323('0x1'))(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var rp=require(_0xf323('0x5'));var fs=require('fs');var path=require(_0xf323('0x6'));var rimraf=require(_0xf323('0x7'));var config=require(_0xf323('0x8'));var attributes=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x3e86dd,_0x317fc6){return _0x3e86dd[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065e=['util','../../config/logger','moment','bluebird','path','rimraf','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x340975,_0x23e15d){var _0x1d0747=function(_0x3072d7){while(--_0x3072d7){_0x340975['push'](_0x340975['shift']());}};_0x1d0747(++_0x23e15d);}(_0x065e,0x1e3));var _0xe065=function(_0x18d168,_0x557b6f){_0x18d168=_0x18d168-0x0;var _0x395a4d=_0x065e[_0x18d168];return _0x395a4d;};'use strict';var _=require(_0xe065('0x0'));var util=require(_0xe065('0x1'));var logger=require(_0xe065('0x2'))('api');var moment=require(_0xe065('0x3'));var BPromise=require(_0xe065('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe065('0x5'));var rimraf=require(_0xe065('0x6'));var config=require('../../config/environment');var attributes=require(_0xe065('0x7'));module['exports']=function(_0x181659,_0x38bfc5){return _0x181659[_0xe065('0x8')](_0xe065('0x9'),attributes,{'tableName':_0xe065('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 063de50..54b0724 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(_0x37aeb0,_0x587e18){var _0xe0eb67=function(_0x42d5df){while(--_0x42d5df){_0x37aeb0['push'](_0x37aeb0['shift']());}};_0xe0eb67(++_0x587e18);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0xb501aa,_0x261ade){var _0x5140db=function(_0x33a21b){while(--_0x33a21b){_0xb501aa['push'](_0xb501aa['shift']());}};_0x5140db(++_0x261ade);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 77dab6d..1e5aedf 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 _0x42bf=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x24e294,_0x14aae1){var _0x1d71d2=function(_0x3468ff){while(--_0x3468ff){_0x24e294['push'](_0x24e294['shift']());}};_0x1d71d2(++_0x14aae1);}(_0x42bf,0x18c));var _0xf42b=function(_0x25cebc,_0x399f2e){_0x25cebc=_0x25cebc-0x0;var _0xad9e2f=_0x42bf[_0x25cebc];return _0xad9e2f;};'use strict';var multer=require(_0xf42b('0x0'));var util=require(_0xf42b('0x1'));var path=require(_0xf42b('0x2'));var timeout=require(_0xf42b('0x3'));var express=require(_0xf42b('0x4'));var router=express['Router']();var auth=require(_0xf42b('0x5'));var interaction=require(_0xf42b('0x6'));var config=require(_0xf42b('0x7'));var controller=require(_0xf42b('0x8'));router[_0xf42b('0x9')]('/',auth[_0xf42b('0xa')](),controller[_0xf42b('0xb')]);router['get'](_0xf42b('0xc'),auth['isAuthenticated'](),controller[_0xf42b('0xd')]);router[_0xf42b('0xe')]('/',auth[_0xf42b('0xa')](),controller[_0xf42b('0xf')]);router[_0xf42b('0x10')](_0xf42b('0xc'),auth[_0xf42b('0xa')](),controller[_0xf42b('0x11')]);router[_0xf42b('0x12')](_0xf42b('0xc'),auth[_0xf42b('0xa')](),controller[_0xf42b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb901=['get','/:id','show','post','create','put','update','delete','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index'];(function(_0x7d76ba,_0x324abe){var _0x3c8da2=function(_0x5d52ae){while(--_0x5d52ae){_0x7d76ba['push'](_0x7d76ba['shift']());}};_0x3c8da2(++_0x324abe);}(_0xb901,0x168));var _0x1b90=function(_0x5c107d,_0x155dbe){_0x5c107d=_0x5c107d-0x0;var _0x3eaf06=_0xb901[_0x5c107d];return _0x3eaf06;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1b90('0x0'));var express=require(_0x1b90('0x1'));var router=express['Router']();var auth=require(_0x1b90('0x2'));var interaction=require(_0x1b90('0x3'));var config=require(_0x1b90('0x4'));var controller=require(_0x1b90('0x5'));router['get']('/',auth[_0x1b90('0x6')](),controller[_0x1b90('0x7')]);router[_0x1b90('0x8')](_0x1b90('0x9'),auth[_0x1b90('0x6')](),controller[_0x1b90('0xa')]);router[_0x1b90('0xb')]('/',auth[_0x1b90('0x6')](),controller[_0x1b90('0xc')]);router[_0x1b90('0xd')](_0x1b90('0x9'),auth[_0x1b90('0x6')](),controller[_0x1b90('0xe')]);router[_0x1b90('0xf')](_0x1b90('0x9'),auth[_0x1b90('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 26329c7..e73dc83 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 _0x2c15=['name','STRING','exports'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x2c15,0x77));var _0x52c1=function(_0x59d5e6,_0x3fd841){_0x59d5e6=_0x59d5e6-0x0;var _0x359118=_0x2c15[_0x59d5e6];return _0x359118;};'use strict';var Sequelize=require('sequelize');module[_0x52c1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x52c1('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x52c1('0x2')]}}; \ No newline at end of file +var _0x52bf=['STRING','sequelize'];(function(_0x2b659b,_0x3d2253){var _0x2075c8=function(_0x28c229){while(--_0x28c229){_0x2b659b['push'](_0x2b659b['shift']());}};_0x2075c8(++_0x3d2253);}(_0x52bf,0xe9));var _0xf52b=function(_0x413019,_0x2bc96b){_0x413019=_0x413019-0x0;var _0xb5490b=_0x52bf[_0x413019];return _0xb5490b;};'use strict';var Sequelize=require(_0xf52b('0x0'));module['exports']={'name':{'type':Sequelize[_0xf52b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf52b('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8a0454e..3de80b5 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 _0x0c8d=['send','index','Variable','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','fields','include','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name'];(function(_0x45a22f,_0x3b0be6){var _0x5bdeba=function(_0x19360){while(--_0x19360){_0x45a22f['push'](_0x45a22f['shift']());}};_0x5bdeba(++_0x3b0be6);}(_0x0c8d,0x79));var _0xd0c8=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x0c8d[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0c8('0x0'));var rimraf=require(_0xd0c8('0x1'));var zipdir=require(_0xd0c8('0x2'));var jsonpatch=require(_0xd0c8('0x3'));var rp=require(_0xd0c8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd0c8('0x5'));var sox=require(_0xd0c8('0x6'));var csv=require(_0xd0c8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0c8('0x8'));var squel=require('squel');var crypto=require(_0xd0c8('0x9'));var jsforce=require(_0xd0c8('0xa'));var deskjs=require(_0xd0c8('0xb'));var toCsv=require(_0xd0c8('0x7'));var querystring=require(_0xd0c8('0xc'));var Papa=require('papaparse');var Redis=require(_0xd0c8('0xd'));var authService=require(_0xd0c8('0xe'));var qs=require(_0xd0c8('0xf'));var as=require(_0xd0c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0c8('0x11'));var utils=require(_0xd0c8('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537bc6,_0x512702){_0x512702=_0x512702||0xcc;return function(_0x52b163){if(_0x52b163){return _0x537bc6[_0xd0c8('0x13')](_0x512702);}return _0x537bc6[_0xd0c8('0x14')](_0x512702)['end']();};}function respondWithResult(_0x1e8049,_0x133ea4){_0x133ea4=_0x133ea4||0xc8;return function(_0x3346f3){if(_0x3346f3){return _0x1e8049[_0xd0c8('0x14')](_0x133ea4)[_0xd0c8('0x15')](_0x3346f3);}};}function respondWithFilteredResult(_0x39f5ae,_0x112b53){return function(_0x29ce57){if(_0x29ce57){var _0x2c25e8=_0x29ce57['count'],_0x3f52c9=_0x112b53[_0xd0c8('0x16')],_0x1d100c=_0x112b53[_0xd0c8('0x16')]+_0x112b53[_0xd0c8('0x17')],_0x1903f1;if(_0x1d100c>=_0x2c25e8){_0x1d100c=_0x2c25e8;_0x1903f1=0xc8;}else{_0x1903f1=0xce;}_0x39f5ae['status'](_0x1903f1);return _0x39f5ae['set'](_0xd0c8('0x18'),_0x3f52c9+'-'+_0x1d100c+'/'+_0x2c25e8)['json'](_0x29ce57);}return null;};}function patchUpdates(_0x5e797c){return function(_0x41a4ac){try{jsonpatch[_0xd0c8('0x19')](_0x41a4ac,_0x5e797c,!![]);}catch(_0x5b6b6f){return BPromise[_0xd0c8('0x1a')](_0x5b6b6f);}return _0x41a4ac[_0xd0c8('0x1b')]();};}function saveUpdates(_0x559ddd,_0x1a5a3d){return function(_0x26bee0){if(_0x26bee0){return _0x26bee0[_0xd0c8('0x1c')](_0x559ddd)[_0xd0c8('0x1d')](function(_0x15bf62){return _0x15bf62;});}return null;};}function removeEntity(_0x2cd879,_0x145b95){return function(_0x1a05fd){if(_0x1a05fd){return _0x1a05fd[_0xd0c8('0x1e')]()[_0xd0c8('0x1d')](function(){var _0x1e3536=_0x1a05fd[_0xd0c8('0x1f')]({'plain':!![]});var _0x30d143=_0xd0c8('0x20');return db[_0xd0c8('0x21')][_0xd0c8('0x1e')]({'where':{'type':_0x30d143,'resourceId':_0x1e3536['id']}})[_0xd0c8('0x1d')](function(){return _0x1a05fd;});})[_0xd0c8('0x1d')](function(){_0x2cd879[_0xd0c8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fa75,_0xc109ee){return function(_0x41cfd9){if(!_0x41cfd9){_0x49fa75[_0xd0c8('0x13')](0x194);}return _0x41cfd9;};}function handleError(_0x2ebc92,_0x1c84e5){_0x1c84e5=_0x1c84e5||0x1f4;return function(_0x1ccb37){logger[_0xd0c8('0x22')](_0x1ccb37[_0xd0c8('0x23')]);if(_0x1ccb37[_0xd0c8('0x24')]){delete _0x1ccb37['name'];}_0x2ebc92[_0xd0c8('0x14')](_0x1c84e5)[_0xd0c8('0x25')](_0x1ccb37);};}exports[_0xd0c8('0x26')]=function(_0x5b3f45,_0x51d660){var _0x4fa819={},_0x22e125={},_0x58f2c2={'count':0x0,'rows':[]};var _0x62ecc6=_['map'](db[_0xd0c8('0x27')][_0xd0c8('0x28')],function(_0x4abb89){return{'name':_0x4abb89[_0xd0c8('0x29')],'type':_0x4abb89[_0xd0c8('0x2a')][_0xd0c8('0x2b')]};});_0x22e125['model']=_[_0xd0c8('0x2c')](_0x62ecc6,_0xd0c8('0x24'));_0x22e125[_0xd0c8('0x2d')]=_[_0xd0c8('0x2e')](_0x5b3f45[_0xd0c8('0x2d')]);_0x22e125[_0xd0c8('0x2f')]=_[_0xd0c8('0x30')](_0x22e125[_0xd0c8('0x31')],_0x22e125[_0xd0c8('0x2d')]);_0x4fa819[_0xd0c8('0x32')]=_['intersection'](_0x22e125['model'],qs['fields'](_0x5b3f45[_0xd0c8('0x2d')]['fields']));_0x4fa819[_0xd0c8('0x32')]=_0x4fa819['attributes'][_0xd0c8('0x33')]?_0x4fa819[_0xd0c8('0x32')]:_0x22e125[_0xd0c8('0x31')];if(!_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x34')](_0xd0c8('0x35'))){_0x4fa819[_0xd0c8('0x17')]=qs['limit'](_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x17')]);_0x4fa819['offset']=qs[_0xd0c8('0x16')](_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x16')]);}_0x4fa819[_0xd0c8('0x36')]=qs[_0xd0c8('0x37')](_0x5b3f45[_0xd0c8('0x2d')]['sort']);_0x4fa819[_0xd0c8('0x38')]=qs[_0xd0c8('0x2f')](_[_0xd0c8('0x39')](_0x5b3f45[_0xd0c8('0x2d')],_0x22e125[_0xd0c8('0x2f')]),_0x62ecc6);if(_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x3a')]){_0x4fa819['where']=_[_0xd0c8('0x3b')](_0x4fa819[_0xd0c8('0x38')],{'$or':_[_0xd0c8('0x2c')](_0x62ecc6,function(_0x4dfc7f){if(_0x4dfc7f[_0xd0c8('0x2a')]!==_0xd0c8('0x3c')){var _0x1da5b7={};_0x1da5b7[_0x4dfc7f[_0xd0c8('0x24')]]={'$like':'%'+_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x3a')]+'%'};return _0x1da5b7;}})});}_0x4fa819=_[_0xd0c8('0x3b')]({},_0x4fa819,_0x5b3f45['options']);var _0x41e672={'where':_0x4fa819[_0xd0c8('0x38')]};return db[_0xd0c8('0x27')][_0xd0c8('0x3d')](_0x41e672)[_0xd0c8('0x1d')](function(_0x1470c4){_0x58f2c2[_0xd0c8('0x3d')]=_0x1470c4;if(_0x5b3f45['query'][_0xd0c8('0x3e')]){_0x4fa819['include']=[{'all':!![]}];}return db[_0xd0c8('0x27')][_0xd0c8('0x3f')](_0x4fa819);})['then'](function(_0x4a478c){_0x58f2c2[_0xd0c8('0x40')]=_0x4a478c;return _0x58f2c2;})[_0xd0c8('0x1d')](respondWithFilteredResult(_0x51d660,_0x4fa819))[_0xd0c8('0x41')](handleError(_0x51d660,null));};exports[_0xd0c8('0x42')]=function(_0x4e3af0,_0x2a72c1){var _0x296d85={'raw':!![],'where':{'id':_0x4e3af0['params']['id']}},_0x1187e1={};_0x1187e1[_0xd0c8('0x31')]=_[_0xd0c8('0x2e')](db[_0xd0c8('0x27')][_0xd0c8('0x28')]);_0x1187e1[_0xd0c8('0x2d')]=_['keys'](_0x4e3af0[_0xd0c8('0x2d')]);_0x1187e1[_0xd0c8('0x2f')]=_[_0xd0c8('0x30')](_0x1187e1[_0xd0c8('0x31')],_0x1187e1[_0xd0c8('0x2d')]);_0x296d85[_0xd0c8('0x32')]=_[_0xd0c8('0x30')](_0x1187e1[_0xd0c8('0x31')],qs[_0xd0c8('0x43')](_0x4e3af0['query'][_0xd0c8('0x43')]));_0x296d85[_0xd0c8('0x32')]=_0x296d85[_0xd0c8('0x32')]['length']?_0x296d85[_0xd0c8('0x32')]:_0x1187e1['model'];if(_0x4e3af0['query']['includeAll']){_0x296d85[_0xd0c8('0x44')]=[{'all':!![]}];}_0x296d85=_[_0xd0c8('0x3b')]({},_0x296d85,_0x4e3af0[_0xd0c8('0x45')]);return db[_0xd0c8('0x27')]['find'](_0x296d85)[_0xd0c8('0x1d')](handleEntityNotFound(_0x2a72c1,null))[_0xd0c8('0x1d')](respondWithResult(_0x2a72c1,null))['catch'](handleError(_0x2a72c1,null));};exports[_0xd0c8('0x46')]=function(_0x2e598d,_0x5b9fa6){return db[_0xd0c8('0x27')][_0xd0c8('0x46')](_0x2e598d[_0xd0c8('0x47')],{})['then'](function(_0x38309c){var _0x125e10=_0x2e598d[_0xd0c8('0x48')][_0xd0c8('0x1f')]({'plain':!![]});if(!_0x125e10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x125e10[_0xd0c8('0x49')]===_0xd0c8('0x48')){var _0x544049=_0x38309c[_0xd0c8('0x1f')]({'plain':!![]});var _0x5824ca=_0xd0c8('0x20');return db[_0xd0c8('0x4a')][_0xd0c8('0x4b')]({'where':{'name':_0x5824ca,'userProfileId':_0x125e10[_0xd0c8('0x4c')]},'raw':!![]})[_0xd0c8('0x1d')](function(_0x43d401){if(_0x43d401&&_0x43d401[_0xd0c8('0x4d')]===0x0){return db['UserProfileResource'][_0xd0c8('0x46')]({'name':_0x544049[_0xd0c8('0x24')],'resourceId':_0x544049['id'],'type':_0x43d401['name'],'sectionId':_0x43d401['id']},{})[_0xd0c8('0x1d')](function(){return _0x38309c;});}else{return _0x38309c;}})[_0xd0c8('0x41')](function(_0x21d9e9){logger[_0xd0c8('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21d9e9);throw _0x21d9e9;});}return _0x38309c;})[_0xd0c8('0x1d')](respondWithResult(_0x5b9fa6,0xc9))['catch'](handleError(_0x5b9fa6,null));};exports[_0xd0c8('0x1c')]=function(_0x195af6,_0x2b47d7){if(_0x195af6['body']['id']){delete _0x195af6['body']['id'];}return db['Variable'][_0xd0c8('0x4b')]({'where':{'id':_0x195af6[_0xd0c8('0x4e')]['id']}})[_0xd0c8('0x1d')](handleEntityNotFound(_0x2b47d7,null))[_0xd0c8('0x1d')](saveUpdates(_0x195af6[_0xd0c8('0x47')],null))[_0xd0c8('0x1d')](respondWithResult(_0x2b47d7,null))[_0xd0c8('0x41')](handleError(_0x2b47d7,null));};exports[_0xd0c8('0x1e')]=function(_0x54d13e,_0x106182){return db[_0xd0c8('0x27')]['find']({'where':{'id':_0x54d13e['params']['id']}})['then'](handleEntityNotFound(_0x106182,null))['then'](removeEntity(_0x106182,null))[_0xd0c8('0x41')](handleError(_0x106182,null));}; \ No newline at end of file +var _0x3b1b=['sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','then','Variables','UserProfileResource','destroy','stack','name','send','index','map','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','merge','options','Variable','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0x3b1b,0x8a));var _0xb3b1=function(_0x2ca05f,_0x2294ec){_0x2ca05f=_0x2ca05f-0x0;var _0xeb4591=_0x3b1b[_0x2ca05f];return _0xeb4591;};'use strict';var pdf=require(_0xb3b1('0x0'));var emlformat=require(_0xb3b1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb3b1('0x2'));var jsonpatch=require(_0xb3b1('0x3'));var rp=require('request-promise');var moment=require(_0xb3b1('0x4'));var BPromise=require(_0xb3b1('0x5'));var Mustache=require('mustache');var util=require(_0xb3b1('0x6'));var path=require(_0xb3b1('0x7'));var sox=require('sox');var csv=require(_0xb3b1('0x8'));var ejs=require(_0xb3b1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb3b1('0xa'));var crypto=require(_0xb3b1('0xb'));var jsforce=require(_0xb3b1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb3b1('0x8'));var querystring=require(_0xb3b1('0xd'));var Papa=require(_0xb3b1('0xe'));var Redis=require(_0xb3b1('0xf'));var authService=require(_0xb3b1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb3b1('0x11'));var hardwareService=require(_0xb3b1('0x12'));var logger=require(_0xb3b1('0x13'))(_0xb3b1('0x14'));var utils=require(_0xb3b1('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363528,_0x4c434e){_0x4c434e=_0x4c434e||0xcc;return function(_0x2c7024){if(_0x2c7024){return _0x363528[_0xb3b1('0x16')](_0x4c434e);}return _0x363528[_0xb3b1('0x17')](_0x4c434e)[_0xb3b1('0x18')]();};}function respondWithResult(_0x5ab48e,_0x5ca2a2){_0x5ca2a2=_0x5ca2a2||0xc8;return function(_0x19ac73){if(_0x19ac73){return _0x5ab48e[_0xb3b1('0x17')](_0x5ca2a2)['json'](_0x19ac73);}};}function respondWithFilteredResult(_0x57759b,_0x35d25f){return function(_0x557b86){if(_0x557b86){var _0x37bd34=_0x557b86[_0xb3b1('0x19')],_0x5b321a=_0x35d25f[_0xb3b1('0x1a')],_0x375d47=_0x35d25f[_0xb3b1('0x1a')]+_0x35d25f[_0xb3b1('0x1b')],_0xfba4c9;if(_0x375d47>=_0x37bd34){_0x375d47=_0x37bd34;_0xfba4c9=0xc8;}else{_0xfba4c9=0xce;}_0x57759b[_0xb3b1('0x17')](_0xfba4c9);return _0x57759b[_0xb3b1('0x1c')]('Content-Range',_0x5b321a+'-'+_0x375d47+'/'+_0x37bd34)[_0xb3b1('0x1d')](_0x557b86);}return null;};}function patchUpdates(_0x10f174){return function(_0x1817ca){try{jsonpatch[_0xb3b1('0x1e')](_0x1817ca,_0x10f174,!![]);}catch(_0x297829){return BPromise[_0xb3b1('0x1f')](_0x297829);}return _0x1817ca[_0xb3b1('0x20')]();};}function saveUpdates(_0x3b63b4,_0x206732){return function(_0x52a7a9){if(_0x52a7a9){return _0x52a7a9['update'](_0x3b63b4)[_0xb3b1('0x21')](function(_0x4627f8){return _0x4627f8;});}return null;};}function removeEntity(_0x2696e6,_0x277c59){return function(_0x1ae29c){if(_0x1ae29c){return _0x1ae29c['destroy']()[_0xb3b1('0x21')](function(){var _0xc4b91a=_0x1ae29c['get']({'plain':!![]});var _0x22a3b9=_0xb3b1('0x22');return db[_0xb3b1('0x23')][_0xb3b1('0x24')]({'where':{'type':_0x22a3b9,'resourceId':_0xc4b91a['id']}})['then'](function(){return _0x1ae29c;});})[_0xb3b1('0x21')](function(){_0x2696e6[_0xb3b1('0x17')](0xcc)[_0xb3b1('0x18')]();});}};}function handleEntityNotFound(_0x177981,_0x56b936){return function(_0x236adb){if(!_0x236adb){_0x177981[_0xb3b1('0x16')](0x194);}return _0x236adb;};}function handleError(_0x231f3f,_0x3b613a){_0x3b613a=_0x3b613a||0x1f4;return function(_0x4f109a){logger['error'](_0x4f109a[_0xb3b1('0x25')]);if(_0x4f109a[_0xb3b1('0x26')]){delete _0x4f109a[_0xb3b1('0x26')];}_0x231f3f[_0xb3b1('0x17')](_0x3b613a)[_0xb3b1('0x27')](_0x4f109a);};}exports[_0xb3b1('0x28')]=function(_0x4470ee,_0xc1a229){var _0x2cbac1={},_0x4a67d2={},_0x2be37d={'count':0x0,'rows':[]};var _0x487d6e=_[_0xb3b1('0x29')](db['Variable']['rawAttributes'],function(_0x5a2b66){return{'name':_0x5a2b66[_0xb3b1('0x2a')],'type':_0x5a2b66[_0xb3b1('0x2b')]['key']};});_0x4a67d2['model']=_[_0xb3b1('0x29')](_0x487d6e,_0xb3b1('0x26'));_0x4a67d2[_0xb3b1('0x2c')]=_['keys'](_0x4470ee[_0xb3b1('0x2c')]);_0x4a67d2[_0xb3b1('0x2d')]=_['intersection'](_0x4a67d2[_0xb3b1('0x2e')],_0x4a67d2['query']);_0x2cbac1[_0xb3b1('0x2f')]=_[_0xb3b1('0x30')](_0x4a67d2[_0xb3b1('0x2e')],qs['fields'](_0x4470ee[_0xb3b1('0x2c')][_0xb3b1('0x31')]));_0x2cbac1[_0xb3b1('0x2f')]=_0x2cbac1[_0xb3b1('0x2f')][_0xb3b1('0x32')]?_0x2cbac1[_0xb3b1('0x2f')]:_0x4a67d2[_0xb3b1('0x2e')];if(!_0x4470ee['query'][_0xb3b1('0x33')]('nolimit')){_0x2cbac1[_0xb3b1('0x1b')]=qs[_0xb3b1('0x1b')](_0x4470ee[_0xb3b1('0x2c')][_0xb3b1('0x1b')]);_0x2cbac1[_0xb3b1('0x1a')]=qs[_0xb3b1('0x1a')](_0x4470ee['query'][_0xb3b1('0x1a')]);}_0x2cbac1[_0xb3b1('0x34')]=qs[_0xb3b1('0x35')](_0x4470ee[_0xb3b1('0x2c')][_0xb3b1('0x35')]);_0x2cbac1['where']=qs[_0xb3b1('0x2d')](_[_0xb3b1('0x36')](_0x4470ee['query'],_0x4a67d2[_0xb3b1('0x2d')]),_0x487d6e);if(_0x4470ee[_0xb3b1('0x2c')]['filter']){_0x2cbac1[_0xb3b1('0x37')]=_['merge'](_0x2cbac1[_0xb3b1('0x37')],{'$or':_[_0xb3b1('0x29')](_0x487d6e,function(_0x5a2f95){if(_0x5a2f95[_0xb3b1('0x2b')]!==_0xb3b1('0x38')){var _0x524f14={};_0x524f14[_0x5a2f95[_0xb3b1('0x26')]]={'$like':'%'+_0x4470ee[_0xb3b1('0x2c')]['filter']+'%'};return _0x524f14;}})});}_0x2cbac1=_[_0xb3b1('0x39')]({},_0x2cbac1,_0x4470ee[_0xb3b1('0x3a')]);var _0x185634={'where':_0x2cbac1[_0xb3b1('0x37')]};return db[_0xb3b1('0x3b')][_0xb3b1('0x19')](_0x185634)[_0xb3b1('0x21')](function(_0x2505aa){_0x2be37d['count']=_0x2505aa;if(_0x4470ee[_0xb3b1('0x2c')][_0xb3b1('0x3c')]){_0x2cbac1[_0xb3b1('0x3d')]=[{'all':!![]}];}return db[_0xb3b1('0x3b')][_0xb3b1('0x3e')](_0x2cbac1);})[_0xb3b1('0x21')](function(_0x41022e){_0x2be37d[_0xb3b1('0x3f')]=_0x41022e;return _0x2be37d;})[_0xb3b1('0x21')](respondWithFilteredResult(_0xc1a229,_0x2cbac1))[_0xb3b1('0x40')](handleError(_0xc1a229,null));};exports[_0xb3b1('0x41')]=function(_0x2867eb,_0x29fdbc){var _0x4b861c={'raw':!![],'where':{'id':_0x2867eb['params']['id']}},_0x12fb31={};_0x12fb31['model']=_[_0xb3b1('0x42')](db[_0xb3b1('0x3b')][_0xb3b1('0x43')]);_0x12fb31[_0xb3b1('0x2c')]=_[_0xb3b1('0x42')](_0x2867eb[_0xb3b1('0x2c')]);_0x12fb31['filters']=_[_0xb3b1('0x30')](_0x12fb31['model'],_0x12fb31[_0xb3b1('0x2c')]);_0x4b861c[_0xb3b1('0x2f')]=_[_0xb3b1('0x30')](_0x12fb31[_0xb3b1('0x2e')],qs[_0xb3b1('0x31')](_0x2867eb[_0xb3b1('0x2c')][_0xb3b1('0x31')]));_0x4b861c[_0xb3b1('0x2f')]=_0x4b861c['attributes']['length']?_0x4b861c[_0xb3b1('0x2f')]:_0x12fb31[_0xb3b1('0x2e')];if(_0x2867eb['query'][_0xb3b1('0x3c')]){_0x4b861c[_0xb3b1('0x3d')]=[{'all':!![]}];}_0x4b861c=_[_0xb3b1('0x39')]({},_0x4b861c,_0x2867eb[_0xb3b1('0x3a')]);return db['Variable'][_0xb3b1('0x44')](_0x4b861c)['then'](handleEntityNotFound(_0x29fdbc,null))[_0xb3b1('0x21')](respondWithResult(_0x29fdbc,null))[_0xb3b1('0x40')](handleError(_0x29fdbc,null));};exports['create']=function(_0x3b456e,_0x4f619f){return db[_0xb3b1('0x3b')]['create'](_0x3b456e[_0xb3b1('0x45')],{})[_0xb3b1('0x21')](function(_0x5014eb){var _0x88930b=_0x3b456e[_0xb3b1('0x46')]['get']({'plain':!![]});if(!_0x88930b)throw new Error(_0xb3b1('0x47'));if(_0x88930b['role']===_0xb3b1('0x46')){var _0x4cdb2c=_0x5014eb[_0xb3b1('0x48')]({'plain':!![]});var _0x26aba6='Variables';return db['UserProfileSection'][_0xb3b1('0x44')]({'where':{'name':_0x26aba6,'userProfileId':_0x88930b[_0xb3b1('0x49')]},'raw':!![]})['then'](function(_0x3021e0){if(_0x3021e0&&_0x3021e0[_0xb3b1('0x4a')]===0x0){return db['UserProfileResource'][_0xb3b1('0x4b')]({'name':_0x4cdb2c['name'],'resourceId':_0x4cdb2c['id'],'type':_0x3021e0[_0xb3b1('0x26')],'sectionId':_0x3021e0['id']},{})[_0xb3b1('0x21')](function(){return _0x5014eb;});}else{return _0x5014eb;}})[_0xb3b1('0x40')](function(_0x80e1e4){logger[_0xb3b1('0x4c')](_0xb3b1('0x4d'),_0x80e1e4);throw _0x80e1e4;});}return _0x5014eb;})['then'](respondWithResult(_0x4f619f,0xc9))['catch'](handleError(_0x4f619f,null));};exports[_0xb3b1('0x4e')]=function(_0x2c86b3,_0x144164){if(_0x2c86b3[_0xb3b1('0x45')]['id']){delete _0x2c86b3[_0xb3b1('0x45')]['id'];}return db[_0xb3b1('0x3b')][_0xb3b1('0x44')]({'where':{'id':_0x2c86b3[_0xb3b1('0x4f')]['id']}})[_0xb3b1('0x21')](handleEntityNotFound(_0x144164,null))[_0xb3b1('0x21')](saveUpdates(_0x2c86b3[_0xb3b1('0x45')],null))[_0xb3b1('0x21')](respondWithResult(_0x144164,null))[_0xb3b1('0x40')](handleError(_0x144164,null));};exports[_0xb3b1('0x24')]=function(_0x5ab693,_0x517f62){return db[_0xb3b1('0x3b')][_0xb3b1('0x44')]({'where':{'id':_0x5ab693['params']['id']}})[_0xb3b1('0x21')](handleEntityNotFound(_0x517f62,null))[_0xb3b1('0x21')](removeEntity(_0x517f62,null))[_0xb3b1('0x40')](handleError(_0x517f62,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a3df20f..4c65dfb 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 _0x0077=['tools_variables','util','api','bluebird','request-promise','rimraf','./variable.attributes','exports','define'];(function(_0xbc2e2f,_0x2e5db5){var _0x4293fc=function(_0x415ac4){while(--_0x415ac4){_0xbc2e2f['push'](_0xbc2e2f['shift']());}};_0x4293fc(++_0x2e5db5);}(_0x0077,0x64));var _0x7007=function(_0x559e6f,_0x34cfd2){_0x559e6f=_0x559e6f-0x0;var _0x345135=_0x0077[_0x559e6f];return _0x345135;};'use strict';var _=require('lodash');var util=require(_0x7007('0x0'));var logger=require('../../config/logger')(_0x7007('0x1'));var moment=require('moment');var BPromise=require(_0x7007('0x2'));var rp=require(_0x7007('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7007('0x4'));var config=require('../../config/environment');var attributes=require(_0x7007('0x5'));module[_0x7007('0x6')]=function(_0x45b7ea,_0x47798f){return _0x45b7ea[_0x7007('0x7')]('Variable',attributes,{'tableName':_0x7007('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ba=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','Variable','tools_variables','lodash','util'];(function(_0x357702,_0x203968){var _0x4dd94a=function(_0x11bc16){while(--_0x11bc16){_0x357702['push'](_0x357702['shift']());}};_0x4dd94a(++_0x203968);}(_0xb9ba,0x136));var _0xab9b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9ba[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xab9b('0x0'));var util=require(_0xab9b('0x1'));var logger=require(_0xab9b('0x2'))(_0xab9b('0x3'));var moment=require(_0xab9b('0x4'));var BPromise=require(_0xab9b('0x5'));var rp=require(_0xab9b('0x6'));var fs=require('fs');var path=require(_0xab9b('0x7'));var rimraf=require(_0xab9b('0x8'));var config=require('../../config/environment');var attributes=require(_0xab9b('0x9'));module[_0xab9b('0xa')]=function(_0x74c312,_0x1c6fdc){return _0x74c312['define'](_0xab9b('0xb'),attributes,{'tableName':_0xab9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 22aa5fd..145a81a 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 _0x142a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','find','options','raw','include','model','attributes','map','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x21ab01,_0x116a43){var _0x1a6be1=function(_0x806ff2){while(--_0x806ff2){_0x21ab01['push'](_0x21ab01['shift']());}};_0x1a6be1(++_0x116a43);}(_0x142a,0xc6));var _0xa142=function(_0x5ec933,_0x3a9505){_0x5ec933=_0x5ec933-0x0;var _0x3ad2c9=_0x142a[_0x5ec933];return _0x3ad2c9;};'use strict';var _=require(_0xa142('0x0'));var util=require(_0xa142('0x1'));var moment=require(_0xa142('0x2'));var BPromise=require(_0xa142('0x3'));var rs=require(_0xa142('0x4'));var fs=require('fs');var Redis=require(_0xa142('0x5'));var db=require(_0xa142('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa142('0x7'))(_0xa142('0x8'));var config=require(_0xa142('0x9'));var jayson=require(_0xa142('0xa'));var client=jayson[_0xa142('0xb')][_0xa142('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c8a91,_0x24f9c6,_0x5cf43c){return new BPromise(function(_0x278298,_0x4b0b14){return client[_0xa142('0xd')](_0x1c8a91,_0x5cf43c)['then'](function(_0x2bbb55){logger[_0xa142('0xe')](_0xa142('0xf'),_0x24f9c6,_0xa142('0x10'));logger[_0xa142('0x11')](_0xa142('0x12'),_0x24f9c6,'request\x20sent',JSON[_0xa142('0x13')](_0x2bbb55));if(_0x2bbb55['error']){if(_0x2bbb55['error']['code']===0x1f4){logger[_0xa142('0x14')](_0xa142('0xf'),_0x24f9c6,_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);return _0x4b0b14(_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);}logger['error'](_0xa142('0xf'),_0x24f9c6,_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);return _0x278298(_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);}else{logger[_0xa142('0xe')]('Variable,\x20%s,\x20%s',_0x24f9c6,_0xa142('0x10'));_0x278298(_0x2bbb55[_0xa142('0x16')][_0xa142('0x15')]);}})[_0xa142('0x17')](function(_0x3e5500){logger['error'](_0xa142('0xf'),_0x24f9c6,_0x3e5500);_0x4b0b14(_0x3e5500);});});}exports[_0xa142('0x18')]=function(_0x381bcf){var _0x2eabf9=this;return new Promise(function(_0x2eb226,_0x30ef64){return db[_0xa142('0x19')][_0xa142('0x1a')]({'raw':_0x381bcf[_0xa142('0x1b')]?_0x381bcf['options'][_0xa142('0x1c')]===undefined?!![]:![]:!![],'where':_0x381bcf[_0xa142('0x1b')]?_0x381bcf[_0xa142('0x1b')]['where']||null:null,'attributes':_0x381bcf[_0xa142('0x1b')]?_0x381bcf['options']['attributes']||null:null,'include':_0x381bcf[_0xa142('0x1b')]?_0x381bcf[_0xa142('0x1b')][_0xa142('0x1d')]?_['map'](_0x381bcf[_0xa142('0x1b')][_0xa142('0x1d')],function(_0x20a63e){return{'model':db[_0x20a63e[_0xa142('0x1e')]],'as':_0x20a63e['as'],'attributes':_0x20a63e['attributes'],'include':_0x20a63e[_0xa142('0x1d')]?_['map'](_0x20a63e['include'],function(_0x1536f2){return{'model':db[_0x1536f2[_0xa142('0x1e')]],'as':_0x1536f2['as'],'attributes':_0x1536f2[_0xa142('0x1f')],'include':_0x1536f2[_0xa142('0x1d')]?_[_0xa142('0x20')](_0x1536f2[_0xa142('0x1d')],function(_0x2f6f69){return{'model':db[_0x2f6f69[_0xa142('0x1e')]],'as':_0x2f6f69['as'],'attributes':_0x2f6f69[_0xa142('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa142('0x21')](function(_0x38396f){logger['info'](_0xa142('0x18'),_0x381bcf);logger[_0xa142('0x11')](_0xa142('0x18'),_0x381bcf,JSON[_0xa142('0x13')](_0x38396f));_0x2eb226(_0x38396f);})[_0xa142('0x17')](function(_0x2cc285){logger['error']('ShowVariable',_0x2cc285[_0xa142('0x15')],_0x381bcf);_0x30ef64(_0x2eabf9[_0xa142('0x14')](0x1f4,_0x2cc285[_0xa142('0x15')]));});});}; \ No newline at end of file +var _0x4ef2=['attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4ef2,0x67));var _0x24ef=function(_0x45f6f2,_0x282bbb){_0x45f6f2=_0x45f6f2-0x0;var _0x57dec5=_0x4ef2[_0x45f6f2];return _0x57dec5;};'use strict';var _=require(_0x24ef('0x0'));var util=require('util');var moment=require(_0x24ef('0x1'));var BPromise=require(_0x24ef('0x2'));var rs=require(_0x24ef('0x3'));var fs=require('fs');var Redis=require(_0x24ef('0x4'));var db=require(_0x24ef('0x5'))['db'];var utils=require(_0x24ef('0x6'));var logger=require(_0x24ef('0x7'))(_0x24ef('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24ef('0x9')][_0x24ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c1938,_0x1607d8,_0x183d86){return new BPromise(function(_0x2c5aca,_0x2fdf5){return client[_0x24ef('0xb')](_0x1c1938,_0x183d86)[_0x24ef('0xc')](function(_0x2fc3e5){logger[_0x24ef('0xd')](_0x24ef('0xe'),_0x1607d8,_0x24ef('0xf'));logger[_0x24ef('0x10')]('Variable,\x20%s,\x20%s,\x20%s',_0x1607d8,'request\x20sent',JSON[_0x24ef('0x11')](_0x2fc3e5));if(_0x2fc3e5[_0x24ef('0x12')]){if(_0x2fc3e5[_0x24ef('0x12')][_0x24ef('0x13')]===0x1f4){logger[_0x24ef('0x12')](_0x24ef('0xe'),_0x1607d8,_0x2fc3e5[_0x24ef('0x12')][_0x24ef('0x14')]);return _0x2fdf5(_0x2fc3e5[_0x24ef('0x12')][_0x24ef('0x14')]);}logger[_0x24ef('0x12')](_0x24ef('0xe'),_0x1607d8,_0x2fc3e5[_0x24ef('0x12')][_0x24ef('0x14')]);return _0x2c5aca(_0x2fc3e5[_0x24ef('0x12')][_0x24ef('0x14')]);}else{logger[_0x24ef('0xd')](_0x24ef('0xe'),_0x1607d8,_0x24ef('0xf'));_0x2c5aca(_0x2fc3e5[_0x24ef('0x15')][_0x24ef('0x14')]);}})[_0x24ef('0x16')](function(_0x5e7ee1){logger['error'](_0x24ef('0xe'),_0x1607d8,_0x5e7ee1);_0x2fdf5(_0x5e7ee1);});});}exports[_0x24ef('0x17')]=function(_0x1817d8){var _0x533194=this;return new Promise(function(_0xf74ba5,_0x57a553){return db[_0x24ef('0x18')][_0x24ef('0x19')]({'raw':_0x1817d8['options']?_0x1817d8[_0x24ef('0x1a')][_0x24ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x1817d8['options']?_0x1817d8[_0x24ef('0x1a')][_0x24ef('0x1c')]||null:null,'attributes':_0x1817d8[_0x24ef('0x1a')]?_0x1817d8[_0x24ef('0x1a')][_0x24ef('0x1d')]||null:null,'include':_0x1817d8[_0x24ef('0x1a')]?_0x1817d8[_0x24ef('0x1a')]['include']?_[_0x24ef('0x1e')](_0x1817d8[_0x24ef('0x1a')][_0x24ef('0x1f')],function(_0x530822){return{'model':db[_0x530822[_0x24ef('0x20')]],'as':_0x530822['as'],'attributes':_0x530822[_0x24ef('0x1d')],'include':_0x530822[_0x24ef('0x1f')]?_[_0x24ef('0x1e')](_0x530822[_0x24ef('0x1f')],function(_0x1d2623){return{'model':db[_0x1d2623[_0x24ef('0x20')]],'as':_0x1d2623['as'],'attributes':_0x1d2623[_0x24ef('0x1d')],'include':_0x1d2623[_0x24ef('0x1f')]?_[_0x24ef('0x1e')](_0x1d2623['include'],function(_0x4ae145){return{'model':db[_0x4ae145[_0x24ef('0x20')]],'as':_0x4ae145['as'],'attributes':_0x4ae145['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f5066){logger[_0x24ef('0xd')](_0x24ef('0x17'),_0x1817d8);logger[_0x24ef('0x10')](_0x24ef('0x17'),_0x1817d8,JSON[_0x24ef('0x11')](_0x3f5066));_0xf74ba5(_0x3f5066);})[_0x24ef('0x16')](function(_0x3b27d3){logger[_0x24ef('0x12')](_0x24ef('0x17'),_0x3b27d3['message'],_0x1817d8);_0x57a553(_0x533194[_0x24ef('0x12')](0x1f4,_0x3b27d3[_0x24ef('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index fac2126..632e946 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 _0x5569=['express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/migrations','migrations'];(function(_0x3862cd,_0x299e88){var _0x2864a1=function(_0x3aa417){while(--_0x3aa417){_0x3862cd['push'](_0x3862cd['shift']());}};_0x2864a1(++_0x299e88);}(_0x5569,0x1a4));var _0x9556=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x5569[_0x296809];return _0x18c0d3;};'use strict';var express=require(_0x9556('0x0'));var router=express['Router']();var auth=require(_0x9556('0x1'));var controller=require(_0x9556('0x2'));router[_0x9556('0x3')]('/',controller[_0x9556('0x4')]);router[_0x9556('0x3')](_0x9556('0x5'),auth[_0x9556('0x6')](),auth[_0x9556('0x7')](),controller[_0x9556('0x8')]);router[_0x9556('0x3')](_0x9556('0x9'),auth[_0x9556('0x6')](),auth[_0x9556('0x7')](),controller['reset']);router['get'](_0x9556('0xa'),auth[_0x9556('0x6')](),auth[_0x9556('0x7')](),controller[_0x9556('0xb')]);router['get']('/restart',auth['isAuthenticated'](),controller['restart']);router[_0x9556('0x3')](_0x9556('0xc'),controller[_0x9556('0xd')]);module['exports']=router; \ No newline at end of file +var _0x06c4=['exports','express','../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations'];(function(_0x4c06d6,_0x5d3bf7){var _0x59a049=function(_0x417c1c){while(--_0x417c1c){_0x4c06d6['push'](_0x4c06d6['shift']());}};_0x59a049(++_0x5d3bf7);}(_0x06c4,0x122));var _0x406c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06c4[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x406c('0x0'));var router=express['Router']();var auth=require(_0x406c('0x1'));var controller=require('./version.controller');router[_0x406c('0x2')]('/',controller[_0x406c('0x3')]);router[_0x406c('0x2')](_0x406c('0x4'),auth[_0x406c('0x5')](),auth['canUpdate'](),controller[_0x406c('0x6')]);router[_0x406c('0x2')](_0x406c('0x7'),auth['isAuthenticated'](),auth[_0x406c('0x8')](),controller[_0x406c('0x9')]);router[_0x406c('0x2')](_0x406c('0xa'),auth[_0x406c('0x5')](),auth['canUpdate'](),controller[_0x406c('0xb')]);router[_0x406c('0x2')](_0x406c('0xc'),auth[_0x406c('0x5')](),controller[_0x406c('0xd')]);router['get'](_0x406c('0xe'),controller[_0x406c('0xf')]);module[_0x406c('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a84f0f2..2bf6b9f 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 _0x5ed9=['path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','exports','query','latest','tags','json','status','fetch','origin','error','info','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','push','length','sort','sequelize','Migration','constructor','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x1130e4,_0x14fa7f){var _0x46b2fc=function(_0x463454){while(--_0x463454){_0x1130e4['push'](_0x1130e4['shift']());}};_0x46b2fc(++_0x14fa7f);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ed9[_0x138adb];return _0x1b27f2;};'use strict';var Umzug=require(_0x95ed('0x0'));var path=require(_0x95ed('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x95ed('0x2'))(module,_0x95ed('0x3'));var compareVersions=require(_0x95ed('0x4'));var exec=require(_0x95ed('0x5'))['exec'];var db=require(_0x95ed('0x6'))['db'];var config=require(_0x95ed('0x7'));var pm2=require(_0x95ed('0x8'));var logger=require('../../config/logger')(_0x95ed('0x9'));var git=require('simple-git')(config[_0x95ed('0xa')]);exports[_0x95ed('0xb')]=function(_0x3753b5,_0x1df51f){var _0x46ed43={'current':module[_0x95ed('0xc')]['version'],'phonebar':0x2};if(_0x3753b5[_0x95ed('0xd')]&&_0x3753b5[_0x95ed('0xd')][_0x95ed('0xe')]){return git['fetch']()[_0x95ed('0xf')](function(_0x478a34,_0x3a4333){_0x46ed43[_0x95ed('0xe')]=(_0x478a34?module[_0x95ed('0xc')][_0x95ed('0x3')]:_0x3a4333[_0x95ed('0xe')])||'2.0.0';return _0x1df51f['status'](0xc8)[_0x95ed('0x10')](_0x46ed43);});}else{return _0x1df51f[_0x95ed('0x11')](0xc8)['json'](_0x46ed43);}};exports['fetch']=function(_0x2782a5,_0x11671d){return git[_0x95ed('0x12')]([_0x95ed('0x13'),'master'],function(_0x213355){if(_0x213355){logger[_0x95ed('0x14')](_0x213355);return _0x11671d[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x213355);}logger[_0x95ed('0x15')]('git\x20fetch');return _0x11671d[_0x95ed('0x11')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x1ffa55,_0x58fb9e){return git[_0x95ed('0x16')]([_0x95ed('0x17'),'FETCH_HEAD'],function(_0xa5a91){if(_0xa5a91){logger[_0x95ed('0x14')](_0xa5a91);return _0x58fb9e[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0xa5a91);}logger[_0x95ed('0x15')](_0x95ed('0x18'));return _0x58fb9e[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':_0x95ed('0x19')});});};exports[_0x95ed('0x1a')]=function(_0x5887e3,_0xd798ec){exec(_0x95ed('0x1b'),function(_0x4e8a5d,_0x5d5afe,_0x54c5ae){logger[_0x95ed('0x15')](_0x5d5afe);logger[_0x95ed('0x15')](_0x54c5ae);if(_0x4e8a5d){logger[_0x95ed('0x14')](_0x4e8a5d);return _0xd798ec[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x4e8a5d);}return _0xd798ec[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':_0x5d5afe});});};exports[_0x95ed('0x1c')]=function(_0x146f74,_0x3bcb6d){return pm2[_0x95ed('0x1c')](_0x95ed('0x1d'))[_0x95ed('0x1e')](function(_0x25b1fc){logger['info'](_0x95ed('0x1f'),_0x25b1fc);return _0x3bcb6d['status'](0xc8)['json']({'output':_0x95ed('0x20')});})[_0x95ed('0x21')](function(_0x45e403){logger[_0x95ed('0x14')](_0x45e403);return _0x3bcb6d[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x45e403);});};exports[_0x95ed('0x22')]=function(_0x190620,_0x39330d){var _0x3f3ed9=fs[_0x95ed('0x23')](path[_0x95ed('0x24')](config['root'],_0x95ed('0x25'),_0x95ed('0x22')));var _0x53b1f4=[];for(var _0x28c738=0x0;_0x28c738<_0x3f3ed9['length'];_0x28c738++){var _0x5365ae=_0x3f3ed9[_0x28c738]['replace']('.js','');if(compareVersions(module['exports'][_0x95ed('0x3')],_0x5365ae)===-0x1){_0x53b1f4[_0x95ed('0x26')](_0x5365ae);}}if(_0x53b1f4[_0x95ed('0x27')]){var _0x20f565=_0x53b1f4[_0x95ed('0x28')](compareVersions);var _0x2f9d90=new Umzug({'storage':_0x95ed('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x95ed('0x2a'),'columnName':_0x95ed('0x3')},'migrations':{'params':[db[_0x95ed('0x29')]['getQueryInterface'](),db['sequelize'][_0x95ed('0x2b')],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['join'](config['root'],'server',_0x95ed('0x22')),'pattern':/\.js$/}});_0x2f9d90['up']({'migrations':_['map'](_0x20f565,function(_0x15c1b5){return _0x15c1b5+_0x95ed('0x2c');})})['then'](function(){return _0x39330d['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x95ed('0x3')]+_0x95ed('0x2d')+_[_0x95ed('0x2e')](_0x20f565),'migrations':_[_0x95ed('0x24')](_0x20f565)});})[_0x95ed('0x21')](function(_0x431690){if(_0x431690 instanceof db['sequelize'][_0x95ed('0x2f')]){return _0x39330d[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x39330d[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x431690);}});}else{return _0x39330d[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':_0x95ed('0x30')});}}; \ No newline at end of file +var _0xc177=['info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','fetch','2.0.0','status','json','master','error'];(function(_0x23b9e0,_0x46e057){var _0x237b2a=function(_0x539335){while(--_0x539335){_0x23b9e0['push'](_0x23b9e0['shift']());}};_0x237b2a(++_0x46e057);}(_0xc177,0x1b2));var _0x7c17=function(_0x2c3172,_0x100310){_0x2c3172=_0x2c3172-0x0;var _0x16f8ce=_0xc177[_0x2c3172];return _0x16f8ce;};'use strict';var Umzug=require(_0x7c17('0x0'));var path=require(_0x7c17('0x1'));var fs=require('fs');var _=require(_0x7c17('0x2'));var pkginfo=require(_0x7c17('0x3'))(module,_0x7c17('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x7c17('0x5'))[_0x7c17('0x6')];var db=require(_0x7c17('0x7'))['db'];var config=require(_0x7c17('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x7c17('0x9'))(_0x7c17('0xa'));var git=require(_0x7c17('0xb'))(config['root']);exports[_0x7c17('0xc')]=function(_0x3aa79e,_0x33dd1e){var _0x3854dd={'current':module[_0x7c17('0xd')][_0x7c17('0x4')],'phonebar':0x2};if(_0x3aa79e[_0x7c17('0xe')]&&_0x3aa79e[_0x7c17('0xe')][_0x7c17('0xf')]){return git[_0x7c17('0x10')]()['tags'](function(_0x5ec150,_0x566cff){_0x3854dd[_0x7c17('0xf')]=(_0x5ec150?module[_0x7c17('0xd')][_0x7c17('0x4')]:_0x566cff['latest'])||_0x7c17('0x11');return _0x33dd1e[_0x7c17('0x12')](0xc8)[_0x7c17('0x13')](_0x3854dd);});}else{return _0x33dd1e['status'](0xc8)['json'](_0x3854dd);}};exports[_0x7c17('0x10')]=function(_0x1220a8,_0x55e7f0){return git[_0x7c17('0x10')](['origin',_0x7c17('0x14')],function(_0x5714b6){if(_0x5714b6){logger[_0x7c17('0x15')](_0x5714b6);return _0x55e7f0[_0x7c17('0x12')](0x1f4)[_0x7c17('0x13')](_0x5714b6);}logger[_0x7c17('0x16')](_0x7c17('0x17'));return _0x55e7f0[_0x7c17('0x12')](0xc8)[_0x7c17('0x13')]({'output':_0x7c17('0x18')});});};exports[_0x7c17('0x19')]=function(_0x2ed3d3,_0x24a25d){return git[_0x7c17('0x19')]([_0x7c17('0x1a'),_0x7c17('0x1b')],function(_0x59ef3d){if(_0x59ef3d){logger[_0x7c17('0x15')](_0x59ef3d);return _0x24a25d[_0x7c17('0x12')](0x1f4)['json'](_0x59ef3d);}logger[_0x7c17('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x24a25d['status'](0xc8)[_0x7c17('0x13')]({'output':_0x7c17('0x1c')});});};exports[_0x7c17('0x1d')]=function(_0x5d5b75,_0x28a24d){exec(_0x7c17('0x1e'),function(_0x59c085,_0x3ad6b9,_0x3d69f6){logger[_0x7c17('0x16')](_0x3ad6b9);logger['info'](_0x3d69f6);if(_0x59c085){logger[_0x7c17('0x15')](_0x59c085);return _0x28a24d[_0x7c17('0x12')](0x1f4)[_0x7c17('0x13')](_0x59c085);}return _0x28a24d['status'](0xc8)[_0x7c17('0x13')]({'output':_0x3ad6b9});});};exports[_0x7c17('0x1f')]=function(_0x50b041,_0x565e05){return pm2[_0x7c17('0x1f')](_0x7c17('0x20'))[_0x7c17('0x21')](function(_0x36b5ed){logger[_0x7c17('0x16')](_0x7c17('0x22'),_0x36b5ed);return _0x565e05['status'](0xc8)[_0x7c17('0x13')]({'output':_0x7c17('0x23')});})[_0x7c17('0x24')](function(_0xf2c46c){logger[_0x7c17('0x15')](_0xf2c46c);return _0x565e05[_0x7c17('0x12')](0x1f4)[_0x7c17('0x13')](_0xf2c46c);});};exports[_0x7c17('0x25')]=function(_0x3a4a58,_0x3a2e61){var _0x4776cc=fs[_0x7c17('0x26')](path[_0x7c17('0x27')](config[_0x7c17('0x28')],_0x7c17('0x29'),_0x7c17('0x25')));var _0x4ea072=[];for(var _0x1378e7=0x0;_0x1378e7<_0x4776cc[_0x7c17('0x2a')];_0x1378e7++){var _0x4dd018=_0x4776cc[_0x1378e7][_0x7c17('0x2b')](_0x7c17('0x2c'),'');if(compareVersions(module[_0x7c17('0xd')]['version'],_0x4dd018)===-0x1){_0x4ea072[_0x7c17('0x2d')](_0x4dd018);}}if(_0x4ea072['length']){var _0x2e0c44=_0x4ea072[_0x7c17('0x2e')](compareVersions);var _0x1a1d70=new Umzug({'storage':_0x7c17('0x2f'),'storageOptions':{'model':db['Migration'],'modelName':_0x7c17('0x30'),'columnName':_0x7c17('0x4')},'migrations':{'params':[db[_0x7c17('0x2f')][_0x7c17('0x31')](),db[_0x7c17('0x2f')][_0x7c17('0x32')],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[_0x7c17('0x27')](config[_0x7c17('0x28')],'server',_0x7c17('0x25')),'pattern':/\.js$/}});_0x1a1d70['up']({'migrations':_[_0x7c17('0x33')](_0x2e0c44,function(_0x571c39){return _0x571c39+_0x7c17('0x2c');})})['then'](function(){return _0x3a2e61[_0x7c17('0x12')](0xc8)[_0x7c17('0x13')]({'output':_0x7c17('0x34')+module['exports'][_0x7c17('0x4')]+_0x7c17('0x35')+_[_0x7c17('0x36')](_0x2e0c44),'migrations':_['join'](_0x2e0c44)});})['catch'](function(_0x2f0afb){if(_0x2f0afb instanceof db['sequelize'][_0x7c17('0x37')]){return _0x3a2e61[_0x7c17('0x12')](0xc8)[_0x7c17('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x3a2e61[_0x7c17('0x12')](0x1f4)[_0x7c17('0x13')](_0x2f0afb);}});}else{return _0x3a2e61[_0x7c17('0x12')](0xc8)[_0x7c17('0x13')]({'output':_0x7c17('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index c00a62f..e642db8 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 _0xa6c7=['/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0xa6c7,0x196));var _0x7a6c=function(_0x268c52,_0x1c41e3){_0x268c52=_0x268c52-0x0;var _0x933625=_0xa6c7[_0x268c52];return _0x933625;};'use strict';var multer=require(_0x7a6c('0x0'));var util=require(_0x7a6c('0x1'));var path=require(_0x7a6c('0x2'));var timeout=require(_0x7a6c('0x3'));var express=require(_0x7a6c('0x4'));var router=express[_0x7a6c('0x5')]();var auth=require(_0x7a6c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a6c('0x7'));var controller=require(_0x7a6c('0x8'));router[_0x7a6c('0x9')]('/',auth[_0x7a6c('0xa')](),controller[_0x7a6c('0xb')]);router['get'](_0x7a6c('0xc'),auth[_0x7a6c('0xa')](),controller['describe']);router[_0x7a6c('0x9')](_0x7a6c('0xd'),auth[_0x7a6c('0xa')](),controller[_0x7a6c('0xe')]);router[_0x7a6c('0xf')]('/',auth[_0x7a6c('0xa')](),controller[_0x7a6c('0x10')]);router[_0x7a6c('0x11')](_0x7a6c('0xd'),auth['isAuthenticated'](),controller[_0x7a6c('0x12')]);router[_0x7a6c('0x13')](_0x7a6c('0xd'),auth[_0x7a6c('0xa')](),controller[_0x7a6c('0x14')]);module[_0x7a6c('0x15')]=router; \ No newline at end of file +var _0xc094=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create'];(function(_0x4a6045,_0x37294e){var _0x58c2cd=function(_0x3bcd93){while(--_0x3bcd93){_0x4a6045['push'](_0x4a6045['shift']());}};_0x58c2cd(++_0x37294e);}(_0xc094,0x116));var _0x4c09=function(_0xcb8f53,_0x2c310a){_0xcb8f53=_0xcb8f53-0x0;var _0x4ac019=_0xc094[_0xcb8f53];return _0x4ac019;};'use strict';var multer=require('multer');var util=require(_0x4c09('0x0'));var path=require(_0x4c09('0x1'));var timeout=require(_0x4c09('0x2'));var express=require(_0x4c09('0x3'));var router=express[_0x4c09('0x4')]();var auth=require(_0x4c09('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c09('0x6'));var controller=require(_0x4c09('0x7'));router[_0x4c09('0x8')]('/',auth['isAuthenticated'](),controller[_0x4c09('0x9')]);router['get']('/describe',auth[_0x4c09('0xa')](),controller[_0x4c09('0xb')]);router[_0x4c09('0x8')](_0x4c09('0xc'),auth['isAuthenticated'](),controller[_0x4c09('0xd')]);router[_0x4c09('0xe')]('/',auth[_0x4c09('0xa')](),controller[_0x4c09('0xf')]);router[_0x4c09('0x10')](_0x4c09('0xc'),auth['isAuthenticated'](),controller[_0x4c09('0x11')]);router[_0x4c09('0x12')](_0x4c09('0xc'),auth[_0x4c09('0xa')](),controller[_0x4c09('0x13')]);module[_0x4c09('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f2b57c0..4ee0b48 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 _0x33c5=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0x2056cb,_0x4eb699){var _0x209c44=function(_0x42fd2c){while(--_0x42fd2c){_0x2056cb['push'](_0x2056cb['shift']());}};_0x209c44(++_0x4eb699);}(_0x33c5,0xe6));var _0x533c=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0x33c5[_0x273f88];return _0x177ca1;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'type':{'type':Sequelize[_0x533c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x533c('0x1')]},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'queue':{'type':Sequelize[_0x533c('0x1')]},'interface':{'type':Sequelize[_0x533c('0x1')]},'membername':{'type':Sequelize[_0x533c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x533c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x533c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x533c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x533c('0x2')]},'holdtime':{'type':Sequelize[_0x533c('0x3')]},'agentcomplete':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x533c('0x3')]},'agentacw':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x533c('0x3')]},'reason':{'type':Sequelize[_0x533c('0x1')]},'lastevent':{'type':Sequelize[_0x533c('0x1')]},'channel':{'type':Sequelize[_0x533c('0x1')]},'channelstate':{'type':Sequelize[_0x533c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x533c('0x1')]},'language':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'exten':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x533c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'destcalleridnum':{'type':Sequelize[_0x533c('0x1')]},'destcalleridname':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x533c('0x1')]},'destlanguage':{'type':Sequelize[_0x533c('0x1')]},'destaccountcode':{'type':Sequelize[_0x533c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x533c('0x1')]},'destpriority':{'type':Sequelize[_0x533c('0x1')]},'destuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x533c('0x1')],'comment':_0x533c('0x5')},'transferexten':{'type':Sequelize[_0x533c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x533c('0x1')]},'agententerreason':{'type':Sequelize[_0x533c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeff8=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x3675b3,_0x3b805d){var _0x553b1b=function(_0x524537){while(--_0x524537){_0x3675b3['push'](_0x3675b3['shift']());}};_0x553b1b(++_0x3b805d);}(_0xeff8,0x186));var _0x8eff=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xeff8[_0x4bb581];return _0x316bf5;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eff('0x2')]},'calleridnum':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8eff('0x2')]},'membername':{'type':Sequelize[_0x8eff('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eff('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eff('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8eff('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eff('0x3')]},'holdtime':{'type':Sequelize[_0x8eff('0x4')]},'agentcomplete':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eff('0x4')]},'agentacw':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8eff('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8eff('0x2')]},'channelstate':{'type':Sequelize[_0x8eff('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8eff('0x2')]},'language':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eff('0x2')]},'exten':{'type':Sequelize[_0x8eff('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8eff('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eff('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eff('0x2')]},'destcontext':{'type':Sequelize[_0x8eff('0x2')]},'destexten':{'type':Sequelize[_0x8eff('0x2')]},'destpriority':{'type':Sequelize[_0x8eff('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8eff('0x2')]},'transfer':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eff('0x2')],'comment':_0x8eff('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'agententerreason':{'type':Sequelize[_0x8eff('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 a15692e..1f3646d 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 _0xdc9d=['intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x2d7c31,_0x4e567f){var _0x558ffc=function(_0x50348c){while(--_0x50348c){_0x2d7c31['push'](_0x2d7c31['shift']());}};_0x558ffc(++_0x4e567f);}(_0xdc9d,0x144));var _0xddc9=function(_0x3c2f8a,_0x1c22a8){_0x3c2f8a=_0x3c2f8a-0x0;var _0x21fdc5=_0xdc9d[_0x3c2f8a];return _0x21fdc5;};'use strict';var pdf=require(_0xddc9('0x0'));var emlformat=require(_0xddc9('0x1'));var rimraf=require(_0xddc9('0x2'));var zipdir=require(_0xddc9('0x3'));var jsonpatch=require(_0xddc9('0x4'));var rp=require(_0xddc9('0x5'));var moment=require('moment');var BPromise=require(_0xddc9('0x6'));var Mustache=require(_0xddc9('0x7'));var util=require('util');var path=require(_0xddc9('0x8'));var sox=require(_0xddc9('0x9'));var csv=require('to-csv');var ejs=require(_0xddc9('0xa'));var fs=require('fs');var _=require(_0xddc9('0xb'));var squel=require('squel');var crypto=require(_0xddc9('0xc'));var jsforce=require(_0xddc9('0xd'));var deskjs=require(_0xddc9('0xe'));var toCsv=require(_0xddc9('0xf'));var querystring=require('querystring');var Papa=require(_0xddc9('0x10'));var Redis=require(_0xddc9('0x11'));var authService=require(_0xddc9('0x12'));var qs=require(_0xddc9('0x13'));var as=require(_0xddc9('0x14'));var hardwareService=require(_0xddc9('0x15'));var logger=require(_0xddc9('0x16'))('api');var utils=require(_0xddc9('0x17'));var config=require(_0xddc9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x553c1a,_0x27ea18){_0x27ea18=_0x27ea18||0xcc;return function(_0x3fc168){if(_0x3fc168){return _0x553c1a['sendStatus'](_0x27ea18);}return _0x553c1a[_0xddc9('0x19')](_0x27ea18)[_0xddc9('0x1a')]();};}function respondWithResult(_0x477877,_0x5da090){_0x5da090=_0x5da090||0xc8;return function(_0x3a6be3){if(_0x3a6be3){return _0x477877[_0xddc9('0x19')](_0x5da090)[_0xddc9('0x1b')](_0x3a6be3);}};}function respondWithFilteredResult(_0x31c405,_0xe7fc90){return function(_0x10c7ad){if(_0x10c7ad){var _0x52314a=_0x10c7ad['count'],_0x19c137=_0xe7fc90[_0xddc9('0x1c')],_0x53686f=_0xe7fc90[_0xddc9('0x1c')]+_0xe7fc90['limit'],_0x23cb5a;if(_0x53686f>=_0x52314a){_0x53686f=_0x52314a;_0x23cb5a=0xc8;}else{_0x23cb5a=0xce;}_0x31c405[_0xddc9('0x19')](_0x23cb5a);return _0x31c405[_0xddc9('0x1d')](_0xddc9('0x1e'),_0x19c137+'-'+_0x53686f+'/'+_0x52314a)[_0xddc9('0x1b')](_0x10c7ad);}return null;};}function patchUpdates(_0x57dd97){return function(_0x310e7b){try{jsonpatch[_0xddc9('0x1f')](_0x310e7b,_0x57dd97,!![]);}catch(_0x1a7d62){return BPromise[_0xddc9('0x20')](_0x1a7d62);}return _0x310e7b['save']();};}function saveUpdates(_0x78f401,_0x4fd04c){return function(_0x2707e6){if(_0x2707e6){return _0x2707e6[_0xddc9('0x21')](_0x78f401)[_0xddc9('0x22')](function(_0x4f6bf4){return _0x4f6bf4;});}return null;};}function removeEntity(_0x3381e6,_0x57561a){return function(_0x1fbebe){if(_0x1fbebe){return _0x1fbebe[_0xddc9('0x23')]()['then'](function(){_0x3381e6[_0xddc9('0x19')](0xcc)[_0xddc9('0x1a')]();});}};}function handleEntityNotFound(_0x3eaef1,_0x55751f){return function(_0x5e1c25){if(!_0x5e1c25){_0x3eaef1['sendStatus'](0x194);}return _0x5e1c25;};}function handleError(_0x1e818c,_0x1e1bb6){_0x1e1bb6=_0x1e1bb6||0x1f4;return function(_0x6e55f6){logger[_0xddc9('0x24')](_0x6e55f6[_0xddc9('0x25')]);if(_0x6e55f6[_0xddc9('0x26')]){delete _0x6e55f6['name'];}_0x1e818c[_0xddc9('0x19')](_0x1e1bb6)[_0xddc9('0x27')](_0x6e55f6);};}exports[_0xddc9('0x28')]=function(_0x41e884,_0x24eb47){var _0x130af5={},_0x194f43={},_0x4dcf4a={'count':0x0,'rows':[]};var _0x254605=_[_0xddc9('0x29')](db[_0xddc9('0x2a')][_0xddc9('0x2b')],function(_0x29467e){return{'name':_0x29467e[_0xddc9('0x2c')],'type':_0x29467e[_0xddc9('0x2d')][_0xddc9('0x2e')]};});_0x194f43[_0xddc9('0x2f')]=_[_0xddc9('0x29')](_0x254605,_0xddc9('0x26'));_0x194f43[_0xddc9('0x30')]=_[_0xddc9('0x31')](_0x41e884[_0xddc9('0x30')]);_0x194f43[_0xddc9('0x32')]=_[_0xddc9('0x33')](_0x194f43['model'],_0x194f43[_0xddc9('0x30')]);_0x130af5[_0xddc9('0x34')]=_[_0xddc9('0x33')](_0x194f43['model'],qs[_0xddc9('0x35')](_0x41e884[_0xddc9('0x30')][_0xddc9('0x35')]));_0x130af5[_0xddc9('0x34')]=_0x130af5['attributes']['length']?_0x130af5[_0xddc9('0x34')]:_0x194f43[_0xddc9('0x2f')];if(!_0x41e884[_0xddc9('0x30')][_0xddc9('0x36')]('nolimit')){_0x130af5[_0xddc9('0x37')]=qs[_0xddc9('0x37')](_0x41e884[_0xddc9('0x30')][_0xddc9('0x37')]);_0x130af5[_0xddc9('0x1c')]=qs['offset'](_0x41e884[_0xddc9('0x30')][_0xddc9('0x1c')]);}_0x130af5[_0xddc9('0x38')]=qs[_0xddc9('0x39')](_0x41e884[_0xddc9('0x30')][_0xddc9('0x39')]);_0x130af5[_0xddc9('0x3a')]=qs[_0xddc9('0x32')](_['pick'](_0x41e884[_0xddc9('0x30')],_0x194f43[_0xddc9('0x32')]),_0x254605);if(_0x41e884['query'][_0xddc9('0x3b')]){_0x130af5[_0xddc9('0x3a')]=_[_0xddc9('0x3c')](_0x130af5[_0xddc9('0x3a')],{'$or':_[_0xddc9('0x29')](_0x254605,function(_0x517867){if(_0x517867[_0xddc9('0x2d')]!==_0xddc9('0x3d')){var _0x4989ad={};_0x4989ad[_0x517867[_0xddc9('0x26')]]={'$like':'%'+_0x41e884[_0xddc9('0x30')][_0xddc9('0x3b')]+'%'};return _0x4989ad;}})});}_0x130af5=_[_0xddc9('0x3c')]({},_0x130af5,_0x41e884[_0xddc9('0x3e')]);var _0x46ea39={'where':_0x130af5[_0xddc9('0x3a')]};return db[_0xddc9('0x2a')]['count'](_0x46ea39)[_0xddc9('0x22')](function(_0xee69f7){_0x4dcf4a[_0xddc9('0x3f')]=_0xee69f7;if(_0x41e884['query'][_0xddc9('0x40')]){_0x130af5[_0xddc9('0x41')]=[{'all':!![]}];}return db[_0xddc9('0x2a')][_0xddc9('0x42')](_0x130af5);})[_0xddc9('0x22')](function(_0x43e154){_0x4dcf4a[_0xddc9('0x43')]=_0x43e154;return _0x4dcf4a;})[_0xddc9('0x22')](respondWithFilteredResult(_0x24eb47,_0x130af5))[_0xddc9('0x44')](handleError(_0x24eb47,null));};exports['show']=function(_0x49d90e,_0x2d150a){var _0x361172={'raw':![],'where':{'id':_0x49d90e[_0xddc9('0x45')]['id']}},_0x4b3486={};_0x4b3486[_0xddc9('0x2f')]=_['keys'](db['VoiceAgentReport']['rawAttributes']);_0x4b3486[_0xddc9('0x30')]=_['keys'](_0x49d90e[_0xddc9('0x30')]);_0x4b3486['filters']=_[_0xddc9('0x33')](_0x4b3486[_0xddc9('0x2f')],_0x4b3486['query']);_0x361172[_0xddc9('0x34')]=_[_0xddc9('0x33')](_0x4b3486['model'],qs[_0xddc9('0x35')](_0x49d90e[_0xddc9('0x30')][_0xddc9('0x35')]));_0x361172[_0xddc9('0x34')]=_0x361172[_0xddc9('0x34')][_0xddc9('0x46')]?_0x361172[_0xddc9('0x34')]:_0x4b3486[_0xddc9('0x2f')];if(_0x49d90e[_0xddc9('0x30')][_0xddc9('0x40')]){_0x361172[_0xddc9('0x41')]=[{'all':!![]}];}_0x361172=_['merge']({},_0x361172,_0x49d90e[_0xddc9('0x3e')]);return db['VoiceAgentReport'][_0xddc9('0x47')](_0x361172)[_0xddc9('0x22')](handleEntityNotFound(_0x2d150a,null))['then'](respondWithResult(_0x2d150a,null))[_0xddc9('0x44')](handleError(_0x2d150a,null));};exports[_0xddc9('0x48')]=function(_0x44b061,_0x14e4c4){return db['VoiceAgentReport'][_0xddc9('0x48')](_0x44b061[_0xddc9('0x49')],{})[_0xddc9('0x22')](respondWithResult(_0x14e4c4,0xc9))[_0xddc9('0x44')](handleError(_0x14e4c4,null));};exports[_0xddc9('0x21')]=function(_0x359370,_0x506346){if(_0x359370[_0xddc9('0x49')]['id']){delete _0x359370[_0xddc9('0x49')]['id'];}return db[_0xddc9('0x2a')]['find']({'where':{'id':_0x359370[_0xddc9('0x45')]['id']}})[_0xddc9('0x22')](handleEntityNotFound(_0x506346,null))[_0xddc9('0x22')](saveUpdates(_0x359370[_0xddc9('0x49')],null))[_0xddc9('0x22')](respondWithResult(_0x506346,null))['catch'](handleError(_0x506346,null));};exports[_0xddc9('0x23')]=function(_0x210908,_0x4a09c1){return db['VoiceAgentReport']['find']({'where':{'id':_0x210908[_0xddc9('0x45')]['id']}})[_0xddc9('0x22')](handleEntityNotFound(_0x4a09c1,null))[_0xddc9('0x22')](removeEntity(_0x4a09c1,null))[_0xddc9('0x44')](handleError(_0x4a09c1,null));};exports[_0xddc9('0x4a')]=function(_0x21747e,_0x4f919c){return db['VoiceAgentReport'][_0xddc9('0x4a')]()[_0xddc9('0x22')](respondWithResult(_0x4f919c,null))['catch'](handleError(_0x4f919c,null));}; \ No newline at end of file +var _0x5b10=['attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','VoiceAgentReport','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','rawAttributes','type','key','query','filters','intersection'];(function(_0x1895cb,_0x248c9f){var _0x4ff1a2=function(_0x3e6574){while(--_0x3e6574){_0x1895cb['push'](_0x1895cb['shift']());}};_0x4ff1a2(++_0x248c9f);}(_0x5b10,0xb4));var _0x05b1=function(_0x462458,_0x1d51ff){_0x462458=_0x462458-0x0;var _0x439bb4=_0x5b10[_0x462458];return _0x439bb4;};'use strict';var pdf=require(_0x05b1('0x0'));var emlformat=require(_0x05b1('0x1'));var rimraf=require(_0x05b1('0x2'));var zipdir=require(_0x05b1('0x3'));var jsonpatch=require(_0x05b1('0x4'));var rp=require(_0x05b1('0x5'));var moment=require('moment');var BPromise=require(_0x05b1('0x6'));var Mustache=require(_0x05b1('0x7'));var util=require('util');var path=require(_0x05b1('0x8'));var sox=require(_0x05b1('0x9'));var csv=require(_0x05b1('0xa'));var ejs=require(_0x05b1('0xb'));var fs=require('fs');var _=require(_0x05b1('0xc'));var squel=require(_0x05b1('0xd'));var crypto=require(_0x05b1('0xe'));var jsforce=require(_0x05b1('0xf'));var deskjs=require(_0x05b1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x05b1('0x11'));var Papa=require('papaparse');var Redis=require(_0x05b1('0x12'));var authService=require(_0x05b1('0x13'));var qs=require(_0x05b1('0x14'));var as=require(_0x05b1('0x15'));var hardwareService=require(_0x05b1('0x16'));var logger=require(_0x05b1('0x17'))(_0x05b1('0x18'));var utils=require(_0x05b1('0x19'));var config=require(_0x05b1('0x1a'));var db=require(_0x05b1('0x1b'))['db'];function respondWithStatusCode(_0xd0b624,_0x22ffe3){_0x22ffe3=_0x22ffe3||0xcc;return function(_0x25c1a8){if(_0x25c1a8){return _0xd0b624['sendStatus'](_0x22ffe3);}return _0xd0b624[_0x05b1('0x1c')](_0x22ffe3)[_0x05b1('0x1d')]();};}function respondWithResult(_0x351115,_0x55ebb4){_0x55ebb4=_0x55ebb4||0xc8;return function(_0x4c60d0){if(_0x4c60d0){return _0x351115[_0x05b1('0x1c')](_0x55ebb4)[_0x05b1('0x1e')](_0x4c60d0);}};}function respondWithFilteredResult(_0x5d743c,_0xb7928e){return function(_0x7c6b3c){if(_0x7c6b3c){var _0x5916cf=_0x7c6b3c[_0x05b1('0x1f')],_0xa11365=_0xb7928e[_0x05b1('0x20')],_0x4584e1=_0xb7928e[_0x05b1('0x20')]+_0xb7928e[_0x05b1('0x21')],_0xd81f46;if(_0x4584e1>=_0x5916cf){_0x4584e1=_0x5916cf;_0xd81f46=0xc8;}else{_0xd81f46=0xce;}_0x5d743c['status'](_0xd81f46);return _0x5d743c[_0x05b1('0x22')](_0x05b1('0x23'),_0xa11365+'-'+_0x4584e1+'/'+_0x5916cf)['json'](_0x7c6b3c);}return null;};}function patchUpdates(_0x5cb95a){return function(_0x56d2f5){try{jsonpatch[_0x05b1('0x24')](_0x56d2f5,_0x5cb95a,!![]);}catch(_0x4256b6){return BPromise[_0x05b1('0x25')](_0x4256b6);}return _0x56d2f5[_0x05b1('0x26')]();};}function saveUpdates(_0x2f2e33,_0x5bec9e){return function(_0x52f39e){if(_0x52f39e){return _0x52f39e[_0x05b1('0x27')](_0x2f2e33)[_0x05b1('0x28')](function(_0x4b18f8){return _0x4b18f8;});}return null;};}function removeEntity(_0x2b85f7,_0x42adc4){return function(_0x40891c){if(_0x40891c){return _0x40891c['destroy']()[_0x05b1('0x28')](function(){_0x2b85f7[_0x05b1('0x1c')](0xcc)[_0x05b1('0x1d')]();});}};}function handleEntityNotFound(_0x1464b6,_0x4d9353){return function(_0x337fdd){if(!_0x337fdd){_0x1464b6['sendStatus'](0x194);}return _0x337fdd;};}function handleError(_0x44d47c,_0xa7698e){_0xa7698e=_0xa7698e||0x1f4;return function(_0x538a91){logger[_0x05b1('0x29')](_0x538a91[_0x05b1('0x2a')]);if(_0x538a91[_0x05b1('0x2b')]){delete _0x538a91[_0x05b1('0x2b')];}_0x44d47c['status'](_0xa7698e)['send'](_0x538a91);};}exports['index']=function(_0x4cfb70,_0x3f6220){var _0x1df3d5={},_0x469461={},_0xb2a99c={'count':0x0,'rows':[]};var _0x50a871=_[_0x05b1('0x2c')](db['VoiceAgentReport'][_0x05b1('0x2d')],function(_0x54ff54){return{'name':_0x54ff54['fieldName'],'type':_0x54ff54[_0x05b1('0x2e')][_0x05b1('0x2f')]};});_0x469461['model']=_['map'](_0x50a871,_0x05b1('0x2b'));_0x469461[_0x05b1('0x30')]=_['keys'](_0x4cfb70[_0x05b1('0x30')]);_0x469461[_0x05b1('0x31')]=_[_0x05b1('0x32')](_0x469461['model'],_0x469461[_0x05b1('0x30')]);_0x1df3d5[_0x05b1('0x33')]=_[_0x05b1('0x32')](_0x469461[_0x05b1('0x34')],qs[_0x05b1('0x35')](_0x4cfb70['query'][_0x05b1('0x35')]));_0x1df3d5[_0x05b1('0x33')]=_0x1df3d5[_0x05b1('0x33')][_0x05b1('0x36')]?_0x1df3d5[_0x05b1('0x33')]:_0x469461[_0x05b1('0x34')];if(!_0x4cfb70['query'][_0x05b1('0x37')](_0x05b1('0x38'))){_0x1df3d5[_0x05b1('0x21')]=qs[_0x05b1('0x21')](_0x4cfb70[_0x05b1('0x30')][_0x05b1('0x21')]);_0x1df3d5[_0x05b1('0x20')]=qs['offset'](_0x4cfb70[_0x05b1('0x30')]['offset']);}_0x1df3d5['order']=qs[_0x05b1('0x39')](_0x4cfb70[_0x05b1('0x30')][_0x05b1('0x39')]);_0x1df3d5[_0x05b1('0x3a')]=qs['filters'](_[_0x05b1('0x3b')](_0x4cfb70[_0x05b1('0x30')],_0x469461[_0x05b1('0x31')]),_0x50a871);if(_0x4cfb70[_0x05b1('0x30')]['filter']){_0x1df3d5['where']=_[_0x05b1('0x3c')](_0x1df3d5['where'],{'$or':_[_0x05b1('0x2c')](_0x50a871,function(_0x4ad8b8){if(_0x4ad8b8[_0x05b1('0x2e')]!==_0x05b1('0x3d')){var _0x1ac792={};_0x1ac792[_0x4ad8b8['name']]={'$like':'%'+_0x4cfb70['query']['filter']+'%'};return _0x1ac792;}})});}_0x1df3d5=_[_0x05b1('0x3c')]({},_0x1df3d5,_0x4cfb70[_0x05b1('0x3e')]);var _0x367e20={'where':_0x1df3d5[_0x05b1('0x3a')]};return db['VoiceAgentReport'][_0x05b1('0x1f')](_0x367e20)[_0x05b1('0x28')](function(_0x348396){_0xb2a99c[_0x05b1('0x1f')]=_0x348396;if(_0x4cfb70[_0x05b1('0x30')][_0x05b1('0x3f')]){_0x1df3d5['include']=[{'all':!![]}];}return db[_0x05b1('0x40')][_0x05b1('0x41')](_0x1df3d5);})['then'](function(_0x3e1b69){_0xb2a99c[_0x05b1('0x42')]=_0x3e1b69;return _0xb2a99c;})[_0x05b1('0x28')](respondWithFilteredResult(_0x3f6220,_0x1df3d5))[_0x05b1('0x43')](handleError(_0x3f6220,null));};exports[_0x05b1('0x44')]=function(_0x2c3ddb,_0x1a64ea){var _0x3ad369={'raw':![],'where':{'id':_0x2c3ddb[_0x05b1('0x45')]['id']}},_0xf95515={};_0xf95515[_0x05b1('0x34')]=_[_0x05b1('0x46')](db[_0x05b1('0x40')][_0x05b1('0x2d')]);_0xf95515[_0x05b1('0x30')]=_[_0x05b1('0x46')](_0x2c3ddb[_0x05b1('0x30')]);_0xf95515[_0x05b1('0x31')]=_[_0x05b1('0x32')](_0xf95515['model'],_0xf95515['query']);_0x3ad369[_0x05b1('0x33')]=_['intersection'](_0xf95515['model'],qs[_0x05b1('0x35')](_0x2c3ddb[_0x05b1('0x30')]['fields']));_0x3ad369[_0x05b1('0x33')]=_0x3ad369[_0x05b1('0x33')][_0x05b1('0x36')]?_0x3ad369[_0x05b1('0x33')]:_0xf95515[_0x05b1('0x34')];if(_0x2c3ddb[_0x05b1('0x30')][_0x05b1('0x3f')]){_0x3ad369[_0x05b1('0x47')]=[{'all':!![]}];}_0x3ad369=_[_0x05b1('0x3c')]({},_0x3ad369,_0x2c3ddb[_0x05b1('0x3e')]);return db['VoiceAgentReport'][_0x05b1('0x48')](_0x3ad369)[_0x05b1('0x28')](handleEntityNotFound(_0x1a64ea,null))[_0x05b1('0x28')](respondWithResult(_0x1a64ea,null))[_0x05b1('0x43')](handleError(_0x1a64ea,null));};exports[_0x05b1('0x49')]=function(_0x4fbdf4,_0x3a17ac){return db['VoiceAgentReport'][_0x05b1('0x49')](_0x4fbdf4['body'],{})[_0x05b1('0x28')](respondWithResult(_0x3a17ac,0xc9))[_0x05b1('0x43')](handleError(_0x3a17ac,null));};exports[_0x05b1('0x27')]=function(_0x1fcb69,_0x1999d3){if(_0x1fcb69[_0x05b1('0x4a')]['id']){delete _0x1fcb69[_0x05b1('0x4a')]['id'];}return db[_0x05b1('0x40')]['find']({'where':{'id':_0x1fcb69[_0x05b1('0x45')]['id']}})[_0x05b1('0x28')](handleEntityNotFound(_0x1999d3,null))[_0x05b1('0x28')](saveUpdates(_0x1fcb69['body'],null))[_0x05b1('0x28')](respondWithResult(_0x1999d3,null))[_0x05b1('0x43')](handleError(_0x1999d3,null));};exports[_0x05b1('0x4b')]=function(_0x4e40be,_0x76b476){return db[_0x05b1('0x40')]['find']({'where':{'id':_0x4e40be[_0x05b1('0x45')]['id']}})['then'](handleEntityNotFound(_0x76b476,null))[_0x05b1('0x28')](removeEntity(_0x76b476,null))[_0x05b1('0x43')](handleError(_0x76b476,null));};exports[_0x05b1('0x4c')]=function(_0x11f3f0,_0x1e2153){return db[_0x05b1('0x40')][_0x05b1('0x4c')]()[_0x05b1('0x28')](respondWithResult(_0x1e2153,null))[_0x05b1('0x43')](handleError(_0x1e2153,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index be4ed58..eaf5331 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 _0x70e0=['rimraf','./voiceAgentReport.attributes','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2dcb75,_0x233a51){var _0x3abd00=function(_0x3e13e0){while(--_0x3e13e0){_0x2dcb75['push'](_0x2dcb75['shift']());}};_0x3abd00(++_0x233a51);}(_0x70e0,0x17b));var _0x070e=function(_0x5350db,_0x4443b2){_0x5350db=_0x5350db-0x0;var _0x5a7721=_0x70e0[_0x5350db];return _0x5a7721;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceAgentReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x070e('0x9'),_0x070e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x54c528,_0x2bb900){var _0x5c64ec=function(_0x53d7dc){while(--_0x53d7dc){_0x54c528['push'](_0x54c528['shift']());}};_0x5c64ec(++_0x2bb900);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xcb91[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6a4ba3e..a49a890 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 _0x2579=['result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','catch','update','where','limit','UpdateVoiceAgentReport','lodash','util','bluebird','../../mysqldb','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x2579,0xeb));var _0x9257=function(_0x29d24d,_0x5c08dd){_0x29d24d=_0x29d24d-0x0;var _0x28bbee=_0x2579[_0x29d24d];return _0x28bbee;};'use strict';var _=require(_0x9257('0x0'));var util=require(_0x9257('0x1'));var moment=require('moment');var BPromise=require(_0x9257('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9257('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9257('0x4'));var config=require('../../config/environment');var jayson=require(_0x9257('0x5'));var client=jayson[_0x9257('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x325ff2,_0x26dfa9,_0xc46e11){return new BPromise(function(_0x21d490,_0xdea570){return client[_0x9257('0x7')](_0x325ff2,_0xc46e11)[_0x9257('0x8')](function(_0x211b08){logger[_0x9257('0x9')](_0x9257('0xa'),_0x26dfa9,'request\x20sent');logger['debug'](_0x9257('0xb'),_0x26dfa9,_0x9257('0xc'),JSON[_0x9257('0xd')](_0x211b08));if(_0x211b08[_0x9257('0xe')]){if(_0x211b08[_0x9257('0xe')][_0x9257('0xf')]===0x1f4){logger[_0x9257('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x26dfa9,_0x211b08[_0x9257('0xe')][_0x9257('0x10')]);return _0xdea570(_0x211b08[_0x9257('0xe')][_0x9257('0x10')]);}logger['error'](_0x9257('0xa'),_0x26dfa9,_0x211b08[_0x9257('0xe')][_0x9257('0x10')]);return _0x21d490(_0x211b08['error']['message']);}else{logger[_0x9257('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x26dfa9,_0x9257('0xc'));_0x21d490(_0x211b08[_0x9257('0x11')][_0x9257('0x10')]);}})['catch'](function(_0x57d8bb){logger[_0x9257('0xe')](_0x9257('0xa'),_0x26dfa9,_0x57d8bb);_0xdea570(_0x57d8bb);});});}exports[_0x9257('0x12')]=function(_0x23d019){var _0x2ef41a=this;return new Promise(function(_0x12e544,_0x1e5c01){return db[_0x9257('0x13')][_0x9257('0x14')](_0x23d019['body'],{'raw':_0x23d019['options']?_0x23d019[_0x9257('0x15')][_0x9257('0x16')]===undefined?!![]:![]:!![]})[_0x9257('0x8')](function(_0x30cc7f){logger[_0x9257('0x9')](_0x9257('0x12'),_0x23d019);logger['debug'](_0x9257('0x12'),_0x23d019,JSON[_0x9257('0xd')](_0x30cc7f));_0x12e544(_0x30cc7f);})[_0x9257('0x17')](function(_0x2073c8){logger['error']('CreateVoiceAgentReport',_0x2073c8[_0x9257('0x10')],_0x23d019);_0x1e5c01(_0x2ef41a[_0x9257('0xe')](0x1f4,_0x2073c8[_0x9257('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x45be94){var _0x40c7db=this;return new Promise(function(_0x5c5253,_0x532925){return db[_0x9257('0x13')][_0x9257('0x18')](_0x45be94['body'],{'raw':_0x45be94[_0x9257('0x15')]?_0x45be94[_0x9257('0x15')][_0x9257('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45be94[_0x9257('0x15')]?_0x45be94['options'][_0x9257('0x19')]||null:null,'attributes':_0x45be94['options']?_0x45be94[_0x9257('0x15')]['attributes']||null:null,'limit':_0x45be94['options']?_0x45be94[_0x9257('0x15')][_0x9257('0x1a')]||null:null})['then'](function(_0x4b3567){logger['info'](_0x9257('0x1b'),_0x45be94);logger['debug']('UpdateVoiceAgentReport',_0x45be94,JSON[_0x9257('0xd')](_0x4b3567));_0x5c5253(_0x4b3567);})[_0x9257('0x17')](function(_0x14b9e3){logger[_0x9257('0xe')](_0x9257('0x1b'),_0x14b9e3[_0x9257('0x10')],_0x45be94);_0x532925(_0x40c7db['error'](0x1f4,_0x14b9e3[_0x9257('0x10')]));});});}; \ No newline at end of file +var _0xac22=['update','body','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','VoiceAgentReport','create','options','raw','then','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x2d0077,_0x5c7505){var _0x1b23d4=function(_0x3a38b3){while(--_0x3a38b3){_0x2d0077['push'](_0x2d0077['shift']());}};_0x1b23d4(++_0x5c7505);}(_0xac22,0x158));var _0x2ac2=function(_0x209c9d,_0x32ed56){_0x209c9d=_0x209c9d-0x0;var _0x652a78=_0xac22[_0x209c9d];return _0x652a78;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var moment=require('moment');var BPromise=require(_0x2ac2('0x2'));var rs=require(_0x2ac2('0x3'));var fs=require('fs');var Redis=require(_0x2ac2('0x4'));var db=require(_0x2ac2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ac2('0x6'))(_0x2ac2('0x7'));var config=require(_0x2ac2('0x8'));var jayson=require(_0x2ac2('0x9'));var client=jayson[_0x2ac2('0xa')][_0x2ac2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56e6a2,_0x26ebc0,_0x9f58e2){return new BPromise(function(_0x445848,_0x43a589){return client[_0x2ac2('0xc')](_0x56e6a2,_0x9f58e2)['then'](function(_0x39f836){logger['info'](_0x2ac2('0xd'),_0x26ebc0,'request\x20sent');logger[_0x2ac2('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x26ebc0,_0x2ac2('0xf'),JSON[_0x2ac2('0x10')](_0x39f836));if(_0x39f836[_0x2ac2('0x11')]){if(_0x39f836[_0x2ac2('0x11')][_0x2ac2('0x12')]===0x1f4){logger[_0x2ac2('0x11')](_0x2ac2('0xd'),_0x26ebc0,_0x39f836[_0x2ac2('0x11')][_0x2ac2('0x13')]);return _0x43a589(_0x39f836[_0x2ac2('0x11')][_0x2ac2('0x13')]);}logger[_0x2ac2('0x11')](_0x2ac2('0xd'),_0x26ebc0,_0x39f836[_0x2ac2('0x11')]['message']);return _0x445848(_0x39f836[_0x2ac2('0x11')][_0x2ac2('0x13')]);}else{logger[_0x2ac2('0x14')](_0x2ac2('0xd'),_0x26ebc0,_0x2ac2('0xf'));_0x445848(_0x39f836[_0x2ac2('0x15')][_0x2ac2('0x13')]);}})[_0x2ac2('0x16')](function(_0x5beaf0){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x26ebc0,_0x5beaf0);_0x43a589(_0x5beaf0);});});}exports['CreateVoiceAgentReport']=function(_0x433e98){var _0x2370d4=this;return new Promise(function(_0x1ee4c7,_0x5e8a4d){return db[_0x2ac2('0x17')][_0x2ac2('0x18')](_0x433e98['body'],{'raw':_0x433e98[_0x2ac2('0x19')]?_0x433e98[_0x2ac2('0x19')][_0x2ac2('0x1a')]===undefined?!![]:![]:!![]})[_0x2ac2('0x1b')](function(_0x18e2d0){logger[_0x2ac2('0x14')]('CreateVoiceAgentReport',_0x433e98);logger['debug']('CreateVoiceAgentReport',_0x433e98,JSON[_0x2ac2('0x10')](_0x18e2d0));_0x1ee4c7(_0x18e2d0);})[_0x2ac2('0x16')](function(_0x5330c1){logger[_0x2ac2('0x11')](_0x2ac2('0x1c'),_0x5330c1[_0x2ac2('0x13')],_0x433e98);_0x5e8a4d(_0x2370d4['error'](0x1f4,_0x5330c1[_0x2ac2('0x13')]));});});};exports[_0x2ac2('0x1d')]=function(_0xcdd0cc){var _0x205cb8=this;return new Promise(function(_0x16dd29,_0x26e912){return db[_0x2ac2('0x17')][_0x2ac2('0x1e')](_0xcdd0cc[_0x2ac2('0x1f')],{'raw':_0xcdd0cc[_0x2ac2('0x19')]?_0xcdd0cc[_0x2ac2('0x19')][_0x2ac2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcdd0cc['options']?_0xcdd0cc[_0x2ac2('0x19')]['where']||null:null,'attributes':_0xcdd0cc[_0x2ac2('0x19')]?_0xcdd0cc[_0x2ac2('0x19')][_0x2ac2('0x20')]||null:null,'limit':_0xcdd0cc['options']?_0xcdd0cc[_0x2ac2('0x19')][_0x2ac2('0x21')]||null:null})['then'](function(_0x146511){logger[_0x2ac2('0x14')](_0x2ac2('0x1d'),_0xcdd0cc);logger[_0x2ac2('0xe')](_0x2ac2('0x1d'),_0xcdd0cc,JSON[_0x2ac2('0x10')](_0x146511));_0x16dd29(_0x146511);})['catch'](function(_0x1f609f){logger[_0x2ac2('0x11')]('UpdateVoiceAgentReport',_0x1f609f['message'],_0xcdd0cc);_0x26e912(_0x205cb8['error'](0x1f4,_0x1f609f[_0x2ac2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0c68870..19fb934 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 _0x791e=['connect-timeout','express','../../components/auth/service','isAuthenticated','index','get','describe','show','post','/:id','update','destroy','exports','multer','util','path'];(function(_0x190ccf,_0x3b3d84){var _0x2fc6a5=function(_0x4a9acf){while(--_0x4a9acf){_0x190ccf['push'](_0x190ccf['shift']());}};_0x2fc6a5(++_0x3b3d84);}(_0x791e,0x18d));var _0xe791=function(_0x3aa43e,_0x33059b){_0x3aa43e=_0x3aa43e-0x0;var _0x2dfb98=_0x791e[_0x3aa43e];return _0x2dfb98;};'use strict';var multer=require(_0xe791('0x0'));var util=require(_0xe791('0x1'));var path=require(_0xe791('0x2'));var timeout=require(_0xe791('0x3'));var express=require(_0xe791('0x4'));var router=express['Router']();var auth=require(_0xe791('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xe791('0x6')](),controller[_0xe791('0x7')]);router[_0xe791('0x8')]('/describe',auth[_0xe791('0x6')](),controller[_0xe791('0x9')]);router['get']('/:id',auth[_0xe791('0x6')](),controller[_0xe791('0xa')]);router[_0xe791('0xb')]('/',auth[_0xe791('0x6')](),controller['create']);router['put'](_0xe791('0xc'),auth[_0xe791('0x6')](),controller[_0xe791('0xd')]);router['delete'](_0xe791('0xc'),auth[_0xe791('0x6')](),controller[_0xe791('0xe')]);module[_0xe791('0xf')]=router; \ No newline at end of file +var _0xd98c=['multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x1ef4b6,_0x4755ae){var _0x3617db=function(_0x22c0aa){while(--_0x22c0aa){_0x1ef4b6['push'](_0x1ef4b6['shift']());}};_0x3617db(++_0x4755ae);}(_0xd98c,0x168));var _0xcd98=function(_0xd1146e,_0x2e738b){_0xd1146e=_0xd1146e-0x0;var _0x3454aa=_0xd98c[_0xd1146e];return _0x3454aa;};'use strict';var multer=require(_0xcd98('0x0'));var util=require(_0xcd98('0x1'));var path=require(_0xcd98('0x2'));var timeout=require(_0xcd98('0x3'));var express=require(_0xcd98('0x4'));var router=express[_0xcd98('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd98('0x6'));var controller=require(_0xcd98('0x7'));router[_0xcd98('0x8')]('/',auth[_0xcd98('0x9')](),controller[_0xcd98('0xa')]);router[_0xcd98('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xcd98('0xb')]);router['get'](_0xcd98('0xc'),auth['isAuthenticated'](),controller[_0xcd98('0xd')]);router[_0xcd98('0xe')]('/',auth['isAuthenticated'](),controller[_0xcd98('0xf')]);router[_0xcd98('0x10')](_0xcd98('0xc'),auth[_0xcd98('0x9')](),controller[_0xcd98('0x11')]);router[_0xcd98('0x12')](_0xcd98('0xc'),auth[_0xcd98('0x9')](),controller['destroy']);module[_0xcd98('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 86db313..ec620dd 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(_0x359dcf,_0x5786cf){var _0x25a5c5=function(_0x2351a7){while(--_0x2351a7){_0x359dcf['push'](_0x359dcf['shift']());}};_0x25a5c5(++_0x5786cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x1c046f,_0x149425){var _0x1616ed=function(_0x3ae5c0){while(--_0x3ae5c0){_0x1c046f['push'](_0x1c046f['shift']());}};_0x1616ed(++_0x149425);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 87976e1..1617bb8 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 _0xe514=['send','index','map','VoiceCallReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','where','filter','merge','options','count','includeAll','include','fullname','User','rows','catch','show','params','keys','length','create','body','destroy','find','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name'];(function(_0x4ed17b,_0x2b1745){var _0x24b248=function(_0x136ab1){while(--_0x136ab1){_0x4ed17b['push'](_0x4ed17b['shift']());}};_0x24b248(++_0x2b1745);}(_0xe514,0x1a3));var _0x4e51=function(_0x51e587,_0x28de13){_0x51e587=_0x51e587-0x0;var _0x1ecc53=_0xe514[_0x51e587];return _0x1ecc53;};'use strict';var pdf=require(_0x4e51('0x0'));var emlformat=require(_0x4e51('0x1'));var rimraf=require(_0x4e51('0x2'));var zipdir=require(_0x4e51('0x3'));var jsonpatch=require(_0x4e51('0x4'));var rp=require(_0x4e51('0x5'));var moment=require(_0x4e51('0x6'));var BPromise=require(_0x4e51('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e51('0x8'));var sox=require(_0x4e51('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e51('0xa'));var jsforce=require(_0x4e51('0xb'));var deskjs=require(_0x4e51('0xc'));var toCsv=require(_0x4e51('0xd'));var querystring=require(_0x4e51('0xe'));var Papa=require(_0x4e51('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e51('0x10'));var as=require(_0x4e51('0x11'));var hardwareService=require(_0x4e51('0x12'));var logger=require('../../config/logger')(_0x4e51('0x13'));var utils=require('../../config/utils');var config=require(_0x4e51('0x14'));var db=require(_0x4e51('0x15'))['db'];function respondWithStatusCode(_0x1cf705,_0x5c23ba){_0x5c23ba=_0x5c23ba||0xcc;return function(_0x4c5be8){if(_0x4c5be8){return _0x1cf705['sendStatus'](_0x5c23ba);}return _0x1cf705[_0x4e51('0x16')](_0x5c23ba)[_0x4e51('0x17')]();};}function respondWithResult(_0x45f191,_0x22b506){_0x22b506=_0x22b506||0xc8;return function(_0x441f81){if(_0x441f81){return _0x45f191[_0x4e51('0x16')](_0x22b506)['json'](_0x441f81);}};}function respondWithFilteredResult(_0x3d927d,_0x3ab233){return function(_0x19eb3f){if(_0x19eb3f){var _0x1a334e=_0x19eb3f['count'],_0x224fc2=_0x3ab233['offset'],_0xbfe793=_0x3ab233[_0x4e51('0x18')]+_0x3ab233[_0x4e51('0x19')],_0x577907;if(_0xbfe793>=_0x1a334e){_0xbfe793=_0x1a334e;_0x577907=0xc8;}else{_0x577907=0xce;}_0x3d927d[_0x4e51('0x16')](_0x577907);return _0x3d927d[_0x4e51('0x1a')](_0x4e51('0x1b'),_0x224fc2+'-'+_0xbfe793+'/'+_0x1a334e)[_0x4e51('0x1c')](_0x19eb3f);}return null;};}function patchUpdates(_0x19fa6a){return function(_0x2c6372){try{jsonpatch[_0x4e51('0x1d')](_0x2c6372,_0x19fa6a,!![]);}catch(_0x236980){return BPromise[_0x4e51('0x1e')](_0x236980);}return _0x2c6372['save']();};}function saveUpdates(_0x524ac5,_0x4817cb){return function(_0x535c1e){if(_0x535c1e){return _0x535c1e[_0x4e51('0x1f')](_0x524ac5)[_0x4e51('0x20')](function(_0x5abe97){return _0x5abe97;});}return null;};}function removeEntity(_0x1cc1e3,_0x4a9edb){return function(_0x5431a9){if(_0x5431a9){return _0x5431a9['destroy']()[_0x4e51('0x20')](function(){_0x1cc1e3[_0x4e51('0x16')](0xcc)[_0x4e51('0x17')]();});}};}function handleEntityNotFound(_0x122523,_0x282058){return function(_0x8c9ce4){if(!_0x8c9ce4){_0x122523[_0x4e51('0x21')](0x194);}return _0x8c9ce4;};}function handleError(_0x3e974d,_0x440b16){_0x440b16=_0x440b16||0x1f4;return function(_0x22e28d){logger[_0x4e51('0x22')](_0x22e28d[_0x4e51('0x23')]);if(_0x22e28d[_0x4e51('0x24')]){delete _0x22e28d[_0x4e51('0x24')];}_0x3e974d['status'](_0x440b16)[_0x4e51('0x25')](_0x22e28d);};}exports[_0x4e51('0x26')]=function(_0xd13e13,_0x2a4611){var _0x430cae={},_0x1e6f21={},_0x2309e8={'count':0x0,'rows':[]};var _0x31a9ef=_[_0x4e51('0x27')](db[_0x4e51('0x28')][_0x4e51('0x29')],function(_0x10da31){return{'name':_0x10da31[_0x4e51('0x2a')],'type':_0x10da31['type'][_0x4e51('0x2b')]};});_0x1e6f21['model']=_[_0x4e51('0x27')](_0x31a9ef,_0x4e51('0x24'));_0x1e6f21['query']=_['keys'](_0xd13e13[_0x4e51('0x2c')]);_0x1e6f21[_0x4e51('0x2d')]=_[_0x4e51('0x2e')](_0x1e6f21[_0x4e51('0x2f')],_0x1e6f21[_0x4e51('0x2c')]);_0x430cae['attributes']=_[_0x4e51('0x2e')](_0x1e6f21[_0x4e51('0x2f')],qs[_0x4e51('0x30')](_0xd13e13['query']['fields']));_0x430cae['attributes']=_0x430cae['attributes']['length']?_0x430cae[_0x4e51('0x31')]:_0x1e6f21[_0x4e51('0x2f')];if(!_0xd13e13[_0x4e51('0x2c')][_0x4e51('0x32')]('nolimit')){_0x430cae[_0x4e51('0x19')]=qs['limit'](_0xd13e13[_0x4e51('0x2c')][_0x4e51('0x19')]);_0x430cae[_0x4e51('0x18')]=qs[_0x4e51('0x18')](_0xd13e13[_0x4e51('0x2c')]['offset']);}_0x430cae[_0x4e51('0x33')]=qs[_0x4e51('0x34')](_0xd13e13[_0x4e51('0x2c')][_0x4e51('0x34')]);_0x430cae['where']=qs[_0x4e51('0x2d')](_[_0x4e51('0x35')](_0xd13e13[_0x4e51('0x2c')],_0x1e6f21[_0x4e51('0x2d')]),_0x31a9ef);if(_0xd13e13[_0x4e51('0x2c')]['filter']){_0x430cae[_0x4e51('0x36')]=_['merge'](_0x430cae['where'],{'$or':_[_0x4e51('0x27')](_0x31a9ef,function(_0x36c14a){if(_0x36c14a['type']!=='VIRTUAL'){var _0x46e18d={};_0x46e18d[_0x36c14a[_0x4e51('0x24')]]={'$like':'%'+_0xd13e13['query'][_0x4e51('0x37')]+'%'};return _0x46e18d;}})});}_0x430cae=_[_0x4e51('0x38')]({},_0x430cae,_0xd13e13[_0x4e51('0x39')]);var _0xfbb45b={'where':_0x430cae[_0x4e51('0x36')]};return db[_0x4e51('0x28')][_0x4e51('0x3a')](_0xfbb45b)[_0x4e51('0x20')](function(_0x4a2efb){_0x2309e8['count']=_0x4a2efb;if(_0xd13e13['query'][_0x4e51('0x3b')]){_0x430cae[_0x4e51('0x3c')]=[{'attributes':['id',_0x4e51('0x24'),_0x4e51('0x3d'),'alias'],'model':db[_0x4e51('0x3e')],'as':_0x4e51('0x3e')}];}return db[_0x4e51('0x28')]['findAll'](_0x430cae);})['then'](function(_0x14d348){_0x2309e8[_0x4e51('0x3f')]=_0x14d348;return _0x2309e8;})[_0x4e51('0x20')](respondWithFilteredResult(_0x2a4611,_0x430cae))[_0x4e51('0x40')](handleError(_0x2a4611,null));};exports[_0x4e51('0x41')]=function(_0x26c453,_0xfcd298){var _0x487753={'raw':!![],'where':{'id':_0x26c453[_0x4e51('0x42')]['id']}},_0x1ff702={};_0x1ff702[_0x4e51('0x2f')]=_[_0x4e51('0x43')](db[_0x4e51('0x28')][_0x4e51('0x29')]);_0x1ff702[_0x4e51('0x2c')]=_[_0x4e51('0x43')](_0x26c453[_0x4e51('0x2c')]);_0x1ff702[_0x4e51('0x2d')]=_['intersection'](_0x1ff702['model'],_0x1ff702[_0x4e51('0x2c')]);_0x487753['attributes']=_[_0x4e51('0x2e')](_0x1ff702[_0x4e51('0x2f')],qs[_0x4e51('0x30')](_0x26c453['query'][_0x4e51('0x30')]));_0x487753[_0x4e51('0x31')]=_0x487753[_0x4e51('0x31')][_0x4e51('0x44')]?_0x487753['attributes']:_0x1ff702[_0x4e51('0x2f')];if(_0x26c453[_0x4e51('0x2c')][_0x4e51('0x3b')]){_0x487753['include']=[{'all':!![]}];}_0x487753=_[_0x4e51('0x38')]({},_0x487753,_0x26c453[_0x4e51('0x39')]);return db[_0x4e51('0x28')]['find'](_0x487753)[_0x4e51('0x20')](handleEntityNotFound(_0xfcd298,null))[_0x4e51('0x20')](respondWithResult(_0xfcd298,null))['catch'](handleError(_0xfcd298,null));};exports[_0x4e51('0x45')]=function(_0x1acd17,_0x15cdb1){return db[_0x4e51('0x28')][_0x4e51('0x45')](_0x1acd17[_0x4e51('0x46')],{})['then'](respondWithResult(_0x15cdb1,0xc9))[_0x4e51('0x40')](handleError(_0x15cdb1,null));};exports[_0x4e51('0x47')]=function(_0x365926,_0x5d6a05){return db['VoiceCallReport'][_0x4e51('0x48')]({'where':{'id':_0x365926[_0x4e51('0x42')]['id']}})[_0x4e51('0x20')](handleEntityNotFound(_0x5d6a05,null))[_0x4e51('0x20')](removeEntity(_0x5d6a05,null))[_0x4e51('0x40')](handleError(_0x5d6a05,null));};exports[_0x4e51('0x49')]=function(_0x37cbf1,_0x385ee3){return db[_0x4e51('0x28')][_0x4e51('0x49')]()[_0x4e51('0x20')](respondWithResult(_0x385ee3,null))[_0x4e51('0x40')](handleError(_0x385ee3,null));};exports[_0x4e51('0x1f')]=function(_0x34aaff,_0x2aaeff){if(_0x34aaff[_0x4e51('0x46')][_0x4e51('0x4a')]){delete _0x34aaff[_0x4e51('0x46')][_0x4e51('0x4a')];}return db[_0x4e51('0x28')][_0x4e51('0x48')]({'where':{'uniqueid':_0x34aaff[_0x4e51('0x42')]['id'],'UserId':{'$or':[null,_0x34aaff[_0x4e51('0x4b')]['id']]}}})['then'](handleEntityNotFound(_0x2aaeff,null))[_0x4e51('0x20')](saveUpdates(_0x34aaff['body'],null))[_0x4e51('0x20')](respondWithResult(_0x2aaeff,null))[_0x4e51('0x40')](handleError(_0x2aaeff,null));}; \ No newline at end of file +var _0x628b=['name','send','map','VoiceCallReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','fullname','alias','User','rows','params','keys','find','create','catch','destroy','describe','update','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','apply','save','then','sendStatus','stack'];(function(_0x294a6b,_0x389e06){var _0x5d4163=function(_0x2378f2){while(--_0x2378f2){_0x294a6b['push'](_0x294a6b['shift']());}};_0x5d4163(++_0x389e06);}(_0x628b,0x110));var _0xb628=function(_0x55d3a5,_0xa419c1){_0x55d3a5=_0x55d3a5-0x0;var _0x3ae4d6=_0x628b[_0x55d3a5];return _0x3ae4d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb628('0x0'));var rimraf=require(_0xb628('0x1'));var zipdir=require(_0xb628('0x2'));var jsonpatch=require(_0xb628('0x3'));var rp=require('request-promise');var moment=require(_0xb628('0x4'));var BPromise=require(_0xb628('0x5'));var Mustache=require('mustache');var util=require(_0xb628('0x6'));var path=require(_0xb628('0x7'));var sox=require(_0xb628('0x8'));var csv=require(_0xb628('0x9'));var ejs=require(_0xb628('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb628('0xb'));var crypto=require(_0xb628('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb628('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb628('0xe'));var Papa=require(_0xb628('0xf'));var Redis=require(_0xb628('0x10'));var authService=require(_0xb628('0x11'));var qs=require(_0xb628('0x12'));var as=require(_0xb628('0x13'));var hardwareService=require(_0xb628('0x14'));var logger=require(_0xb628('0x15'))(_0xb628('0x16'));var utils=require(_0xb628('0x17'));var config=require(_0xb628('0x18'));var db=require(_0xb628('0x19'))['db'];function respondWithStatusCode(_0x3a8b3a,_0xbb6f4a){_0xbb6f4a=_0xbb6f4a||0xcc;return function(_0x441a29){if(_0x441a29){return _0x3a8b3a['sendStatus'](_0xbb6f4a);}return _0x3a8b3a[_0xb628('0x1a')](_0xbb6f4a)['end']();};}function respondWithResult(_0x35f10d,_0x57caad){_0x57caad=_0x57caad||0xc8;return function(_0x57cfc1){if(_0x57cfc1){return _0x35f10d[_0xb628('0x1a')](_0x57caad)[_0xb628('0x1b')](_0x57cfc1);}};}function respondWithFilteredResult(_0x344646,_0x2e084f){return function(_0x14aea5){if(_0x14aea5){var _0x543769=_0x14aea5['count'],_0x291952=_0x2e084f['offset'],_0x41aec8=_0x2e084f[_0xb628('0x1c')]+_0x2e084f[_0xb628('0x1d')],_0xf575ee;if(_0x41aec8>=_0x543769){_0x41aec8=_0x543769;_0xf575ee=0xc8;}else{_0xf575ee=0xce;}_0x344646[_0xb628('0x1a')](_0xf575ee);return _0x344646['set'](_0xb628('0x1e'),_0x291952+'-'+_0x41aec8+'/'+_0x543769)[_0xb628('0x1b')](_0x14aea5);}return null;};}function patchUpdates(_0x227788){return function(_0x5a0963){try{jsonpatch[_0xb628('0x1f')](_0x5a0963,_0x227788,!![]);}catch(_0x2b8b8d){return BPromise['reject'](_0x2b8b8d);}return _0x5a0963[_0xb628('0x20')]();};}function saveUpdates(_0x507022,_0x16e068){return function(_0x2c54ca){if(_0x2c54ca){return _0x2c54ca['update'](_0x507022)[_0xb628('0x21')](function(_0x30b9d2){return _0x30b9d2;});}return null;};}function removeEntity(_0x592062,_0xbceb23){return function(_0x417094){if(_0x417094){return _0x417094['destroy']()[_0xb628('0x21')](function(){_0x592062['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4129ec,_0x53b98c){return function(_0x4978cf){if(!_0x4978cf){_0x4129ec[_0xb628('0x22')](0x194);}return _0x4978cf;};}function handleError(_0x1f3828,_0x363b64){_0x363b64=_0x363b64||0x1f4;return function(_0x5c527d){logger['error'](_0x5c527d[_0xb628('0x23')]);if(_0x5c527d[_0xb628('0x24')]){delete _0x5c527d['name'];}_0x1f3828[_0xb628('0x1a')](_0x363b64)[_0xb628('0x25')](_0x5c527d);};}exports['index']=function(_0xa2bde3,_0x5569fb){var _0x4cd380={},_0x2c9797={},_0x2ad7f1={'count':0x0,'rows':[]};var _0x55e7f8=_[_0xb628('0x26')](db[_0xb628('0x27')][_0xb628('0x28')],function(_0x59f427){return{'name':_0x59f427['fieldName'],'type':_0x59f427[_0xb628('0x29')][_0xb628('0x2a')]};});_0x2c9797[_0xb628('0x2b')]=_[_0xb628('0x26')](_0x55e7f8,_0xb628('0x24'));_0x2c9797['query']=_['keys'](_0xa2bde3[_0xb628('0x2c')]);_0x2c9797[_0xb628('0x2d')]=_[_0xb628('0x2e')](_0x2c9797[_0xb628('0x2b')],_0x2c9797[_0xb628('0x2c')]);_0x4cd380['attributes']=_[_0xb628('0x2e')](_0x2c9797[_0xb628('0x2b')],qs[_0xb628('0x2f')](_0xa2bde3['query']['fields']));_0x4cd380['attributes']=_0x4cd380[_0xb628('0x30')][_0xb628('0x31')]?_0x4cd380[_0xb628('0x30')]:_0x2c9797[_0xb628('0x2b')];if(!_0xa2bde3[_0xb628('0x2c')][_0xb628('0x32')](_0xb628('0x33'))){_0x4cd380[_0xb628('0x1d')]=qs[_0xb628('0x1d')](_0xa2bde3[_0xb628('0x2c')][_0xb628('0x1d')]);_0x4cd380['offset']=qs['offset'](_0xa2bde3[_0xb628('0x2c')][_0xb628('0x1c')]);}_0x4cd380[_0xb628('0x34')]=qs[_0xb628('0x35')](_0xa2bde3[_0xb628('0x2c')][_0xb628('0x35')]);_0x4cd380[_0xb628('0x36')]=qs[_0xb628('0x2d')](_[_0xb628('0x37')](_0xa2bde3[_0xb628('0x2c')],_0x2c9797[_0xb628('0x2d')]),_0x55e7f8);if(_0xa2bde3[_0xb628('0x2c')][_0xb628('0x38')]){_0x4cd380[_0xb628('0x36')]=_['merge'](_0x4cd380['where'],{'$or':_[_0xb628('0x26')](_0x55e7f8,function(_0x300bad){if(_0x300bad[_0xb628('0x29')]!==_0xb628('0x39')){var _0x34db07={};_0x34db07[_0x300bad['name']]={'$like':'%'+_0xa2bde3[_0xb628('0x2c')]['filter']+'%'};return _0x34db07;}})});}_0x4cd380=_[_0xb628('0x3a')]({},_0x4cd380,_0xa2bde3['options']);var _0x401779={'where':_0x4cd380[_0xb628('0x36')]};return db[_0xb628('0x27')]['count'](_0x401779)[_0xb628('0x21')](function(_0x2f113b){_0x2ad7f1[_0xb628('0x3b')]=_0x2f113b;if(_0xa2bde3[_0xb628('0x2c')][_0xb628('0x3c')]){_0x4cd380[_0xb628('0x3d')]=[{'attributes':['id',_0xb628('0x24'),_0xb628('0x3e'),_0xb628('0x3f')],'model':db[_0xb628('0x40')],'as':_0xb628('0x40')}];}return db[_0xb628('0x27')]['findAll'](_0x4cd380);})[_0xb628('0x21')](function(_0x1a9a6e){_0x2ad7f1[_0xb628('0x41')]=_0x1a9a6e;return _0x2ad7f1;})[_0xb628('0x21')](respondWithFilteredResult(_0x5569fb,_0x4cd380))['catch'](handleError(_0x5569fb,null));};exports['show']=function(_0x17b3e8,_0x3a7fbd){var _0x3c5391={'raw':!![],'where':{'id':_0x17b3e8[_0xb628('0x42')]['id']}},_0x56ae26={};_0x56ae26['model']=_[_0xb628('0x43')](db['VoiceCallReport'][_0xb628('0x28')]);_0x56ae26[_0xb628('0x2c')]=_[_0xb628('0x43')](_0x17b3e8[_0xb628('0x2c')]);_0x56ae26[_0xb628('0x2d')]=_[_0xb628('0x2e')](_0x56ae26[_0xb628('0x2b')],_0x56ae26['query']);_0x3c5391[_0xb628('0x30')]=_['intersection'](_0x56ae26[_0xb628('0x2b')],qs['fields'](_0x17b3e8[_0xb628('0x2c')][_0xb628('0x2f')]));_0x3c5391[_0xb628('0x30')]=_0x3c5391['attributes'][_0xb628('0x31')]?_0x3c5391[_0xb628('0x30')]:_0x56ae26[_0xb628('0x2b')];if(_0x17b3e8[_0xb628('0x2c')]['includeAll']){_0x3c5391['include']=[{'all':!![]}];}_0x3c5391=_[_0xb628('0x3a')]({},_0x3c5391,_0x17b3e8['options']);return db[_0xb628('0x27')][_0xb628('0x44')](_0x3c5391)['then'](handleEntityNotFound(_0x3a7fbd,null))['then'](respondWithResult(_0x3a7fbd,null))['catch'](handleError(_0x3a7fbd,null));};exports[_0xb628('0x45')]=function(_0x16cd1f,_0x49b6c7){return db[_0xb628('0x27')]['create'](_0x16cd1f['body'],{})[_0xb628('0x21')](respondWithResult(_0x49b6c7,0xc9))[_0xb628('0x46')](handleError(_0x49b6c7,null));};exports[_0xb628('0x47')]=function(_0x4c4d8a,_0x3d3903){return db['VoiceCallReport'][_0xb628('0x44')]({'where':{'id':_0x4c4d8a['params']['id']}})[_0xb628('0x21')](handleEntityNotFound(_0x3d3903,null))['then'](removeEntity(_0x3d3903,null))[_0xb628('0x46')](handleError(_0x3d3903,null));};exports[_0xb628('0x48')]=function(_0x4594a6,_0x522c5b){return db[_0xb628('0x27')]['describe']()[_0xb628('0x21')](respondWithResult(_0x522c5b,null))['catch'](handleError(_0x522c5b,null));};exports[_0xb628('0x49')]=function(_0x3111c2,_0x223e28){if(_0x3111c2[_0xb628('0x4a')][_0xb628('0x4b')]){delete _0x3111c2[_0xb628('0x4a')]['uniqueid'];}return db[_0xb628('0x27')][_0xb628('0x44')]({'where':{'uniqueid':_0x3111c2[_0xb628('0x42')]['id'],'UserId':{'$or':[null,_0x3111c2[_0xb628('0x4c')]['id']]}}})['then'](handleEntityNotFound(_0x223e28,null))[_0xb628('0x21')](saveUpdates(_0x3111c2[_0xb628('0x4a')],null))[_0xb628('0x21')](respondWithResult(_0x223e28,null))[_0xb628('0x46')](handleError(_0x223e28,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4d5d615..e5092ba 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 _0x9f52=['path','rimraf','./voiceCallReport.attributes','define','report_call','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x9f52,0x1c9));var _0x29f5=function(_0x294b68,_0x3f0093){_0x294b68=_0x294b68-0x0;var _0x4b104b=_0x9f52[_0x294b68];return _0x4b104b;};'use strict';var _=require(_0x29f5('0x0'));var util=require('util');var logger=require(_0x29f5('0x1'))(_0x29f5('0x2'));var moment=require('moment');var BPromise=require(_0x29f5('0x3'));var rp=require(_0x29f5('0x4'));var fs=require('fs');var path=require(_0x29f5('0x5'));var rimraf=require(_0x29f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x29f5('0x7'));module['exports']=function(_0x57030b,_0x35daf9){return _0x57030b[_0x29f5('0x8')]('VoiceCallReport',attributes,{'tableName':_0x29f5('0x9'),'paranoid':![],'indexes':[{'fields':[_0x29f5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59fa=['path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x59fa,0x1d0));var _0xa59f=function(_0x37210e,_0x5264c0){_0x37210e=_0x37210e-0x0;var _0x79d0e7=_0x59fa[_0x37210e];return _0x79d0e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa59f('0x0'))('api');var moment=require(_0xa59f('0x1'));var BPromise=require(_0xa59f('0x2'));var rp=require(_0xa59f('0x3'));var fs=require('fs');var path=require(_0xa59f('0x4'));var rimraf=require(_0xa59f('0x5'));var config=require(_0xa59f('0x6'));var attributes=require(_0xa59f('0x7'));module[_0xa59f('0x8')]=function(_0x4e4148,_0x5a7c2c){return _0x4e4148[_0xa59f('0x9')](_0xa59f('0xa'),attributes,{'tableName':_0xa59f('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa59f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 78ab9d0..5bc21e0 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 _0x28a3=['error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','map','attributes','model','stringify','CreateVoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x28a3,0x1ba));var _0x328a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28a3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x328a('0x0'));var BPromise=require(_0x328a('0x1'));var rs=require(_0x328a('0x2'));var fs=require('fs');var Redis=require(_0x328a('0x3'));var db=require(_0x328a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x328a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x328a('0x6')][_0x328a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20820a,_0x1877da,_0xf5dd6){return new BPromise(function(_0x337e94,_0x274185){return client[_0x328a('0x8')](_0x20820a,_0xf5dd6)[_0x328a('0x9')](function(_0x56dced){logger['info'](_0x328a('0xa'),_0x1877da,_0x328a('0xb'));logger[_0x328a('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1877da,'request\x20sent',JSON['stringify'](_0x56dced));if(_0x56dced[_0x328a('0xd')]){if(_0x56dced[_0x328a('0xd')][_0x328a('0xe')]===0x1f4){logger[_0x328a('0xd')](_0x328a('0xa'),_0x1877da,_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);return _0x274185(_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);}logger[_0x328a('0xd')](_0x328a('0xa'),_0x1877da,_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);return _0x337e94(_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);}else{logger[_0x328a('0x10')](_0x328a('0xa'),_0x1877da,_0x328a('0xb'));_0x337e94(_0x56dced['result']['message']);}})[_0x328a('0x11')](function(_0x5a7565){logger[_0x328a('0xd')](_0x328a('0xa'),_0x1877da,_0x5a7565);_0x274185(_0x5a7565);});});}exports[_0x328a('0x12')]=function(_0x3b9eec){var _0x10a98b=this;return new Promise(function(_0x165402,_0x4af4f1){return db[_0x328a('0x13')][_0x328a('0x14')]({'raw':_0x3b9eec[_0x328a('0x15')]?_0x3b9eec['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b9eec[_0x328a('0x15')]?_0x3b9eec[_0x328a('0x15')][_0x328a('0x16')]||null:null,'attributes':_0x3b9eec['options']?_0x3b9eec[_0x328a('0x15')]['attributes']||null:null,'limit':_0x3b9eec['options']?_0x3b9eec['options'][_0x328a('0x17')]||null:null,'include':_0x3b9eec[_0x328a('0x15')]?_0x3b9eec['options'][_0x328a('0x18')]?_[_0x328a('0x19')](_0x3b9eec[_0x328a('0x15')][_0x328a('0x18')],function(_0x2f865e){return{'model':db[_0x2f865e['model']],'as':_0x2f865e['as'],'attributes':_0x2f865e[_0x328a('0x1a')],'include':_0x2f865e[_0x328a('0x18')]?_[_0x328a('0x19')](_0x2f865e[_0x328a('0x18')],function(_0x53b5cf){return{'model':db[_0x53b5cf[_0x328a('0x1b')]],'as':_0x53b5cf['as'],'attributes':_0x53b5cf['attributes'],'include':_0x53b5cf[_0x328a('0x18')]?_['map'](_0x53b5cf[_0x328a('0x18')],function(_0x9b5091){return{'model':db[_0x9b5091[_0x328a('0x1b')]],'as':_0x9b5091['as'],'attributes':_0x9b5091[_0x328a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x328a('0x9')](function(_0x46ab8e){logger[_0x328a('0x10')](_0x328a('0x12'),_0x3b9eec);logger['debug'](_0x328a('0x12'),_0x3b9eec,JSON[_0x328a('0x1c')](_0x46ab8e));_0x165402(_0x46ab8e);})[_0x328a('0x11')](function(_0x549ff8){logger[_0x328a('0xd')](_0x328a('0x12'),_0x549ff8['message'],_0x3b9eec);_0x4af4f1(_0x10a98b[_0x328a('0xd')](0x1f4,_0x549ff8[_0x328a('0xf')]));});});};exports[_0x328a('0x1d')]=function(_0x25815d){var _0x59a4a4=this;return new Promise(function(_0x309964,_0x34c3c9){return db[_0x328a('0x13')][_0x328a('0x1e')](_0x25815d[_0x328a('0x1f')],{'raw':_0x25815d['options']?_0x25815d['options'][_0x328a('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x5accd6){logger[_0x328a('0x10')](_0x328a('0x1d'),_0x25815d);logger[_0x328a('0xc')](_0x328a('0x1d'),_0x25815d,JSON[_0x328a('0x1c')](_0x5accd6));_0x309964(_0x5accd6);})[_0x328a('0x11')](function(_0x43ac10){logger['error'](_0x328a('0x1d'),_0x43ac10[_0x328a('0xf')],_0x25815d);_0x34c3c9(_0x59a4a4[_0x328a('0xd')](0x1f4,_0x43ac10[_0x328a('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x1f3a2a){var _0x4cd890=this;return new Promise(function(_0x456736,_0x13ffd0){return db['VoiceCallReport'][_0x328a('0x21')](_0x1f3a2a[_0x328a('0x1f')],{'raw':_0x1f3a2a[_0x328a('0x15')]?_0x1f3a2a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f3a2a['options']?_0x1f3a2a['options'][_0x328a('0x16')]||null:null,'attributes':_0x1f3a2a[_0x328a('0x15')]?_0x1f3a2a[_0x328a('0x15')][_0x328a('0x1a')]||null:null,'limit':_0x1f3a2a['options']?_0x1f3a2a['options']['limit']||null:null})['then'](function(_0x2e39af){logger[_0x328a('0x10')](_0x328a('0x22'),_0x1f3a2a);logger[_0x328a('0xc')](_0x328a('0x22'),_0x1f3a2a,JSON[_0x328a('0x1c')](_0x2e39af));_0x456736(_0x2e39af);})['catch'](function(_0x192b88){logger['error']('UpdateVoiceCallReport',_0x192b88[_0x328a('0xf')],_0x1f3a2a);_0x13ffd0(_0x4cd890['error'](0x1f4,_0x192b88[_0x328a('0xf')]));});});}; \ No newline at end of file +var _0x85dd=['stringify','catch','CreateVoiceCallReport','create','body','update','limit','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model'];(function(_0x163673,_0x5bebb9){var _0x150465=function(_0x125a0a){while(--_0x125a0a){_0x163673['push'](_0x163673['shift']());}};_0x150465(++_0x5bebb9);}(_0x85dd,0x1e8));var _0xd85d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x85dd[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xd85d('0x0'));var util=require(_0xd85d('0x1'));var moment=require('moment');var BPromise=require(_0xd85d('0x2'));var rs=require(_0xd85d('0x3'));var fs=require('fs');var Redis=require(_0xd85d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd85d('0x5'));var logger=require(_0xd85d('0x6'))(_0xd85d('0x7'));var config=require(_0xd85d('0x8'));var jayson=require(_0xd85d('0x9'));var client=jayson[_0xd85d('0xa')][_0xd85d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ab8be,_0x3b9aec,_0x4e775e){return new BPromise(function(_0x145a95,_0x191aef){return client[_0xd85d('0xc')](_0x1ab8be,_0x4e775e)[_0xd85d('0xd')](function(_0x2af4c6){logger[_0xd85d('0xe')](_0xd85d('0xf'),_0x3b9aec,'request\x20sent');logger[_0xd85d('0x10')](_0xd85d('0x11'),_0x3b9aec,'request\x20sent',JSON['stringify'](_0x2af4c6));if(_0x2af4c6['error']){if(_0x2af4c6['error']['code']===0x1f4){logger[_0xd85d('0x12')](_0xd85d('0xf'),_0x3b9aec,_0x2af4c6[_0xd85d('0x12')][_0xd85d('0x13')]);return _0x191aef(_0x2af4c6['error'][_0xd85d('0x13')]);}logger[_0xd85d('0x12')](_0xd85d('0xf'),_0x3b9aec,_0x2af4c6[_0xd85d('0x12')]['message']);return _0x145a95(_0x2af4c6['error']['message']);}else{logger['info'](_0xd85d('0xf'),_0x3b9aec,_0xd85d('0x14'));_0x145a95(_0x2af4c6[_0xd85d('0x15')][_0xd85d('0x13')]);}})['catch'](function(_0x5d1f18){logger[_0xd85d('0x12')](_0xd85d('0xf'),_0x3b9aec,_0x5d1f18);_0x191aef(_0x5d1f18);});});}exports[_0xd85d('0x16')]=function(_0x3c8ff5){var _0x4dbb33=this;return new Promise(function(_0x11bdbf,_0x130e5c){return db[_0xd85d('0x17')][_0xd85d('0x18')]({'raw':_0x3c8ff5[_0xd85d('0x19')]?_0x3c8ff5[_0xd85d('0x19')][_0xd85d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c8ff5[_0xd85d('0x19')]?_0x3c8ff5['options'][_0xd85d('0x1b')]||null:null,'attributes':_0x3c8ff5['options']?_0x3c8ff5[_0xd85d('0x19')][_0xd85d('0x1c')]||null:null,'limit':_0x3c8ff5[_0xd85d('0x19')]?_0x3c8ff5[_0xd85d('0x19')]['limit']||null:null,'include':_0x3c8ff5[_0xd85d('0x19')]?_0x3c8ff5[_0xd85d('0x19')]['include']?_[_0xd85d('0x1d')](_0x3c8ff5[_0xd85d('0x19')][_0xd85d('0x1e')],function(_0x294eb7){return{'model':db[_0x294eb7['model']],'as':_0x294eb7['as'],'attributes':_0x294eb7[_0xd85d('0x1c')],'include':_0x294eb7[_0xd85d('0x1e')]?_[_0xd85d('0x1d')](_0x294eb7[_0xd85d('0x1e')],function(_0x230ec2){return{'model':db[_0x230ec2[_0xd85d('0x1f')]],'as':_0x230ec2['as'],'attributes':_0x230ec2[_0xd85d('0x1c')],'include':_0x230ec2[_0xd85d('0x1e')]?_[_0xd85d('0x1d')](_0x230ec2[_0xd85d('0x1e')],function(_0x3ee6c8){return{'model':db[_0x3ee6c8[_0xd85d('0x1f')]],'as':_0x3ee6c8['as'],'attributes':_0x3ee6c8[_0xd85d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd85d('0xd')](function(_0x4971eb){logger['info']('GetVoiceCallReport',_0x3c8ff5);logger[_0xd85d('0x10')](_0xd85d('0x16'),_0x3c8ff5,JSON[_0xd85d('0x20')](_0x4971eb));_0x11bdbf(_0x4971eb);})[_0xd85d('0x21')](function(_0x2a418f){logger[_0xd85d('0x12')]('GetVoiceCallReport',_0x2a418f[_0xd85d('0x13')],_0x3c8ff5);_0x130e5c(_0x4dbb33[_0xd85d('0x12')](0x1f4,_0x2a418f[_0xd85d('0x13')]));});});};exports[_0xd85d('0x22')]=function(_0x59e09f){var _0xffc56a=this;return new Promise(function(_0x5802d4,_0x50ed8d){return db[_0xd85d('0x17')][_0xd85d('0x23')](_0x59e09f[_0xd85d('0x24')],{'raw':_0x59e09f[_0xd85d('0x19')]?_0x59e09f[_0xd85d('0x19')][_0xd85d('0x1a')]===undefined?!![]:![]:!![]})[_0xd85d('0xd')](function(_0xc3acfc){logger['info']('CreateVoiceCallReport',_0x59e09f);logger['debug'](_0xd85d('0x22'),_0x59e09f,JSON[_0xd85d('0x20')](_0xc3acfc));_0x5802d4(_0xc3acfc);})[_0xd85d('0x21')](function(_0x199113){logger['error'](_0xd85d('0x22'),_0x199113[_0xd85d('0x13')],_0x59e09f);_0x50ed8d(_0xffc56a[_0xd85d('0x12')](0x1f4,_0x199113['message']));});});};exports['UpdateVoiceCallReport']=function(_0x9e157f){var _0xb978a2=this;return new Promise(function(_0x28935c,_0x2f19fb){return db[_0xd85d('0x17')][_0xd85d('0x25')](_0x9e157f[_0xd85d('0x24')],{'raw':_0x9e157f[_0xd85d('0x19')]?_0x9e157f['options'][_0xd85d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9e157f[_0xd85d('0x19')]?_0x9e157f['options'][_0xd85d('0x1b')]||null:null,'attributes':_0x9e157f['options']?_0x9e157f[_0xd85d('0x19')]['attributes']||null:null,'limit':_0x9e157f[_0xd85d('0x19')]?_0x9e157f['options'][_0xd85d('0x26')]||null:null})[_0xd85d('0xd')](function(_0x878cf){logger[_0xd85d('0xe')](_0xd85d('0x27'),_0x9e157f);logger[_0xd85d('0x10')](_0xd85d('0x27'),_0x9e157f,JSON[_0xd85d('0x20')](_0x878cf));_0x28935c(_0x878cf);})[_0xd85d('0x21')](function(_0x4f5575){logger[_0xd85d('0x12')](_0xd85d('0x27'),_0x4f5575[_0xd85d('0x13')],_0x9e157f);_0x2f19fb(_0xb978a2['error'](0x1f4,_0x4f5575['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 56dc992..e9cb306 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 _0x43d7=['update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x42d10f,_0x56d428){var _0x3b874e=function(_0x7bfc9d){while(--_0x7bfc9d){_0x42d10f['push'](_0x42d10f['shift']());}};_0x3b874e(++_0x56d428);}(_0x43d7,0x7b));var _0x743d=function(_0x197793,_0x335ef4){_0x197793=_0x197793-0x0;var _0x4c52ba=_0x43d7[_0x197793];return _0x4c52ba;};'use strict';var multer=require(_0x743d('0x0'));var util=require(_0x743d('0x1'));var path=require(_0x743d('0x2'));var timeout=require('connect-timeout');var express=require(_0x743d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x743d('0x4'));var config=require(_0x743d('0x5'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x743d('0x6')](),controller[_0x743d('0x7')]);router[_0x743d('0x8')](_0x743d('0x9'),auth[_0x743d('0x6')](),controller[_0x743d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x743d('0xb')]);router[_0x743d('0xc')](_0x743d('0x9'),auth['isAuthenticated'](),controller[_0x743d('0xd')]);router[_0x743d('0xe')](_0x743d('0x9'),auth['isAuthenticated'](),controller[_0x743d('0xf')]);module[_0x743d('0x10')]=router; \ No newline at end of file +var _0x7f59=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','delete'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x7f59,0x156));var _0x97f5=function(_0x4e4088,_0x14df21){_0x4e4088=_0x4e4088-0x0;var _0x573fd9=_0x7f59[_0x4e4088];return _0x573fd9;};'use strict';var multer=require('multer');var util=require(_0x97f5('0x0'));var path=require('path');var timeout=require(_0x97f5('0x1'));var express=require(_0x97f5('0x2'));var router=express[_0x97f5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x97f5('0x4'));var config=require(_0x97f5('0x5'));var controller=require(_0x97f5('0x6'));router[_0x97f5('0x7')]('/',auth['isAuthenticated'](),controller[_0x97f5('0x8')]);router['get'](_0x97f5('0x9'),auth[_0x97f5('0xa')](),controller[_0x97f5('0xb')]);router[_0x97f5('0xc')]('/',auth['isAuthenticated'](),controller[_0x97f5('0xd')]);router['put']('/:id',auth[_0x97f5('0xa')](),controller['update']);router[_0x97f5('0xe')](_0x97f5('0x9'),auth[_0x97f5('0xa')](),controller[_0x97f5('0xf')]);module[_0x97f5('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 17c0e4a..ff95efd 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 _0x7b5c=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x391db2,_0x2af5bb){var _0x39d595=function(_0x5e35f5){while(--_0x5e35f5){_0x391db2['push'](_0x391db2['shift']());}};_0x39d595(++_0x2af5bb);}(_0x7b5c,0x11c));var _0xc7b5=function(_0x3374b1,_0x425c70){_0x3374b1=_0x3374b1-0x0;var _0x245ffe=_0x7b5c[_0x3374b1];return _0x245ffe;};'use strict';var Sequelize=require(_0xc7b5('0x0'));module[_0xc7b5('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc7b5('0x2')],'unique':_0xc7b5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc7b5('0x2')],'set':function(_0x3768e9){this['setDataValue'](_0xc7b5('0x4'),_0x3768e9?_0x3768e9[_0xc7b5('0x5')](''):[]);},'get':function(){return this[_0xc7b5('0x6')](_0xc7b5('0x4'))?this[_0xc7b5('0x6')](_0xc7b5('0x4'))[_0xc7b5('0x7')](''):[];}},'auth':{'type':Sequelize[_0xc7b5('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xc7b5('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc7b5('0x2')]}}; \ No newline at end of file +var _0xf138=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join'];(function(_0x54e698,_0x4c6d5c){var _0x1eb4a6=function(_0x210a7d){while(--_0x210a7d){_0x54e698['push'](_0x54e698['shift']());}};_0x1eb4a6(++_0x4c6d5c);}(_0xf138,0x176));var _0x8f13=function(_0x3bb083,_0x2b7bba){_0x3bb083=_0x3bb083-0x0;var _0x376962=_0xf138[_0x3bb083];return _0x376962;};'use strict';var Sequelize=require(_0x8f13('0x0'));module[_0x8f13('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x8f13('0x2')],'unique':_0x8f13('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x8f13('0x2')],'set':function(_0x1f4397){this[_0x8f13('0x4')]('options',_0x1f4397?_0x1f4397[_0x8f13('0x5')](''):[]);},'get':function(){return this[_0x8f13('0x6')](_0x8f13('0x7'))?this[_0x8f13('0x6')]('options')[_0x8f13('0x8')](''):[];}},'auth':{'type':Sequelize[_0x8f13('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x8f13('0x2')]},'record':{'type':Sequelize[_0x8f13('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8f13('0x2')]},'description':{'type':Sequelize[_0x8f13('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b707efc..bec92bc 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 _0x013b=['where','filter','options','VoiceChanSpy','include','findAll','rows','catch','show','params','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge'];(function(_0x112689,_0x1ec4af){var _0x451925=function(_0x140c41){while(--_0x140c41){_0x112689['push'](_0x112689['shift']());}};_0x451925(++_0x1ec4af);}(_0x013b,0x198));var _0xb013=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0x013b[_0x2b84d5];return _0x51452a;};'use strict';var pdf=require(_0xb013('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb013('0x1'));var zipdir=require(_0xb013('0x2'));var jsonpatch=require(_0xb013('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb013('0x4'));var Mustache=require(_0xb013('0x5'));var util=require('util');var path=require(_0xb013('0x6'));var sox=require(_0xb013('0x7'));var csv=require(_0xb013('0x8'));var ejs=require(_0xb013('0x9'));var fs=require('fs');var _=require(_0xb013('0xa'));var squel=require(_0xb013('0xb'));var crypto=require(_0xb013('0xc'));var jsforce=require(_0xb013('0xd'));var deskjs=require(_0xb013('0xe'));var toCsv=require(_0xb013('0x8'));var querystring=require(_0xb013('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb013('0x10'));var qs=require(_0xb013('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb013('0x12'));var utils=require(_0xb013('0x13'));var config=require(_0xb013('0x14'));var db=require(_0xb013('0x15'))['db'];function respondWithStatusCode(_0x94ed6a,_0x32b778){_0x32b778=_0x32b778||0xcc;return function(_0x168833){if(_0x168833){return _0x94ed6a[_0xb013('0x16')](_0x32b778);}return _0x94ed6a[_0xb013('0x17')](_0x32b778)['end']();};}function respondWithResult(_0x1256f5,_0x3e46da){_0x3e46da=_0x3e46da||0xc8;return function(_0x4527f7){if(_0x4527f7){return _0x1256f5[_0xb013('0x17')](_0x3e46da)['json'](_0x4527f7);}};}function respondWithFilteredResult(_0x1f7deb,_0x123043){return function(_0x436dbf){if(_0x436dbf){var _0x3271c0=_0x436dbf[_0xb013('0x18')],_0x246fc3=_0x123043[_0xb013('0x19')],_0x3b38d8=_0x123043[_0xb013('0x19')]+_0x123043[_0xb013('0x1a')],_0x15a36d;if(_0x3b38d8>=_0x3271c0){_0x3b38d8=_0x3271c0;_0x15a36d=0xc8;}else{_0x15a36d=0xce;}_0x1f7deb[_0xb013('0x17')](_0x15a36d);return _0x1f7deb[_0xb013('0x1b')]('Content-Range',_0x246fc3+'-'+_0x3b38d8+'/'+_0x3271c0)['json'](_0x436dbf);}return null;};}function patchUpdates(_0x3e6c16){return function(_0x1ece37){try{jsonpatch[_0xb013('0x1c')](_0x1ece37,_0x3e6c16,!![]);}catch(_0x184568){return BPromise['reject'](_0x184568);}return _0x1ece37[_0xb013('0x1d')]();};}function saveUpdates(_0x47ae52,_0x51b6c7){return function(_0x5c7317){if(_0x5c7317){return _0x5c7317[_0xb013('0x1e')](_0x47ae52)[_0xb013('0x1f')](function(_0x4b5643){return _0x4b5643;});}return null;};}function removeEntity(_0x3e49f8,_0x36cda8){return function(_0x4f02d4){if(_0x4f02d4){return _0x4f02d4[_0xb013('0x20')]()['then'](function(){var _0x1c9cd0=_0x4f02d4[_0xb013('0x21')]({'plain':!![]});var _0x24879c=_0xb013('0x22');return db[_0xb013('0x23')]['destroy']({'where':{'type':_0x24879c,'resourceId':_0x1c9cd0['id']}})[_0xb013('0x1f')](function(){return _0x4f02d4;});})['then'](function(){_0x3e49f8[_0xb013('0x17')](0xcc)[_0xb013('0x24')]();});}};}function handleEntityNotFound(_0x790739,_0x3108f0){return function(_0x40fb2f){if(!_0x40fb2f){_0x790739[_0xb013('0x16')](0x194);}return _0x40fb2f;};}function handleError(_0x25a42d,_0x3cab73){_0x3cab73=_0x3cab73||0x1f4;return function(_0x590d69){logger[_0xb013('0x25')](_0x590d69[_0xb013('0x26')]);if(_0x590d69[_0xb013('0x27')]){delete _0x590d69['name'];}_0x25a42d[_0xb013('0x17')](_0x3cab73)['send'](_0x590d69);};}exports[_0xb013('0x28')]=function(_0x357cdf,_0x210183){var _0x1144e3={},_0x3eaa70={},_0x22df71={'count':0x0,'rows':[]};var _0x930fa0=_['map'](db['VoiceChanSpy'][_0xb013('0x29')],function(_0x4f08cd){return{'name':_0x4f08cd[_0xb013('0x2a')],'type':_0x4f08cd[_0xb013('0x2b')][_0xb013('0x2c')]};});_0x3eaa70[_0xb013('0x2d')]=_[_0xb013('0x2e')](_0x930fa0,'name');_0x3eaa70[_0xb013('0x2f')]=_[_0xb013('0x30')](_0x357cdf['query']);_0x3eaa70[_0xb013('0x31')]=_[_0xb013('0x32')](_0x3eaa70['model'],_0x3eaa70[_0xb013('0x2f')]);_0x1144e3[_0xb013('0x33')]=_[_0xb013('0x32')](_0x3eaa70['model'],qs[_0xb013('0x34')](_0x357cdf[_0xb013('0x2f')][_0xb013('0x34')]));_0x1144e3[_0xb013('0x33')]=_0x1144e3[_0xb013('0x33')][_0xb013('0x35')]?_0x1144e3[_0xb013('0x33')]:_0x3eaa70['model'];if(!_0x357cdf['query'][_0xb013('0x36')](_0xb013('0x37'))){_0x1144e3[_0xb013('0x1a')]=qs['limit'](_0x357cdf['query'][_0xb013('0x1a')]);_0x1144e3[_0xb013('0x19')]=qs[_0xb013('0x19')](_0x357cdf[_0xb013('0x2f')][_0xb013('0x19')]);}_0x1144e3[_0xb013('0x38')]=qs['sort'](_0x357cdf[_0xb013('0x2f')][_0xb013('0x39')]);_0x1144e3['where']=qs[_0xb013('0x31')](_[_0xb013('0x3a')](_0x357cdf[_0xb013('0x2f')],_0x3eaa70[_0xb013('0x31')]),_0x930fa0);if(_0x357cdf[_0xb013('0x2f')]['filter']){_0x1144e3['where']=_[_0xb013('0x3b')](_0x1144e3[_0xb013('0x3c')],{'$or':_[_0xb013('0x2e')](_0x930fa0,function(_0x3f2599){if(_0x3f2599[_0xb013('0x2b')]!=='VIRTUAL'){var _0x1dcc31={};_0x1dcc31[_0x3f2599[_0xb013('0x27')]]={'$like':'%'+_0x357cdf[_0xb013('0x2f')][_0xb013('0x3d')]+'%'};return _0x1dcc31;}})});}_0x1144e3=_['merge']({},_0x1144e3,_0x357cdf[_0xb013('0x3e')]);var _0x3d042f={'where':_0x1144e3[_0xb013('0x3c')]};return db[_0xb013('0x3f')]['count'](_0x3d042f)[_0xb013('0x1f')](function(_0x52b535){_0x22df71['count']=_0x52b535;if(_0x357cdf['query']['includeAll']){_0x1144e3[_0xb013('0x40')]=[{'all':!![]}];}return db[_0xb013('0x3f')][_0xb013('0x41')](_0x1144e3);})[_0xb013('0x1f')](function(_0x3e2662){_0x22df71[_0xb013('0x42')]=_0x3e2662;return _0x22df71;})[_0xb013('0x1f')](respondWithFilteredResult(_0x210183,_0x1144e3))[_0xb013('0x43')](handleError(_0x210183,null));};exports[_0xb013('0x44')]=function(_0x374860,_0xde85f1){var _0x239069={'raw':![],'where':{'id':_0x374860[_0xb013('0x45')]['id']}},_0x55c4d2={};_0x55c4d2['model']=_['keys'](db[_0xb013('0x3f')][_0xb013('0x29')]);_0x55c4d2['query']=_[_0xb013('0x30')](_0x374860[_0xb013('0x2f')]);_0x55c4d2[_0xb013('0x31')]=_[_0xb013('0x32')](_0x55c4d2[_0xb013('0x2d')],_0x55c4d2['query']);_0x239069['attributes']=_[_0xb013('0x32')](_0x55c4d2['model'],qs[_0xb013('0x34')](_0x374860[_0xb013('0x2f')][_0xb013('0x34')]));_0x239069[_0xb013('0x33')]=_0x239069[_0xb013('0x33')]['length']?_0x239069[_0xb013('0x33')]:_0x55c4d2['model'];if(_0x374860['query']['includeAll']){_0x239069[_0xb013('0x40')]=[{'all':!![]}];}_0x239069=_[_0xb013('0x3b')]({},_0x239069,_0x374860[_0xb013('0x3e')]);return db[_0xb013('0x3f')]['find'](_0x239069)[_0xb013('0x1f')](handleEntityNotFound(_0xde85f1,null))['then'](respondWithResult(_0xde85f1,null))['catch'](handleError(_0xde85f1,null));};exports[_0xb013('0x46')]=function(_0x44d85e,_0x5056af){return db['VoiceChanSpy'][_0xb013('0x46')](_0x44d85e['body'],{})[_0xb013('0x1f')](function(_0x12b794){var _0x10176f=_0x44d85e[_0xb013('0x47')][_0xb013('0x21')]({'plain':!![]});if(!_0x10176f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10176f[_0xb013('0x48')]===_0xb013('0x47')){var _0x45e0a0=_0x12b794[_0xb013('0x21')]({'plain':!![]});var _0x3fe2c7=_0xb013('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x3fe2c7,'userProfileId':_0x10176f[_0xb013('0x49')]},'raw':!![]})['then'](function(_0x198bc0){if(_0x198bc0&&_0x198bc0[_0xb013('0x4a')]===0x0){return db[_0xb013('0x23')][_0xb013('0x46')]({'name':_0x45e0a0[_0xb013('0x27')],'resourceId':_0x45e0a0['id'],'type':_0x198bc0[_0xb013('0x27')],'sectionId':_0x198bc0['id']},{})[_0xb013('0x1f')](function(){return _0x12b794;});}else{return _0x12b794;}})[_0xb013('0x43')](function(_0x58f796){logger[_0xb013('0x25')](_0xb013('0x4b'),_0x58f796);throw _0x58f796;});}return _0x12b794;})[_0xb013('0x1f')](respondWithResult(_0x5056af,0xc9))[_0xb013('0x43')](handleError(_0x5056af,null));};exports[_0xb013('0x1e')]=function(_0x1c7513,_0x4f34ea){if(_0x1c7513['body']['id']){delete _0x1c7513[_0xb013('0x4c')]['id'];}return db['VoiceChanSpy'][_0xb013('0x4d')]({'where':{'id':_0x1c7513[_0xb013('0x45')]['id']}})[_0xb013('0x1f')](handleEntityNotFound(_0x4f34ea,null))['then'](saveUpdates(_0x1c7513[_0xb013('0x4c')],null))[_0xb013('0x1f')](respondWithResult(_0x4f34ea,null))[_0xb013('0x43')](handleError(_0x4f34ea,null));};exports[_0xb013('0x20')]=function(_0x4b6622,_0x458601){return db['VoiceChanSpy']['find']({'where':{'id':_0x4b6622[_0xb013('0x45')]['id']}})['then'](handleEntityNotFound(_0x458601,null))['then'](removeEntity(_0x458601,null))['catch'](handleError(_0x458601,null));}; \ No newline at end of file +var _0x33a6=['rows','params','keys','find','catch','create','user','error','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x33a6,0x1dd));var _0x633a=function(_0x59b2c2,_0x4194dc){_0x59b2c2=_0x59b2c2-0x0;var _0x2a40fc=_0x33a6[_0x59b2c2];return _0x2a40fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x633a('0x0'));var rimraf=require(_0x633a('0x1'));var zipdir=require(_0x633a('0x2'));var jsonpatch=require(_0x633a('0x3'));var rp=require('request-promise');var moment=require(_0x633a('0x4'));var BPromise=require(_0x633a('0x5'));var Mustache=require(_0x633a('0x6'));var util=require(_0x633a('0x7'));var path=require(_0x633a('0x8'));var sox=require(_0x633a('0x9'));var csv=require(_0x633a('0xa'));var ejs=require(_0x633a('0xb'));var fs=require('fs');var _=require(_0x633a('0xc'));var squel=require('squel');var crypto=require(_0x633a('0xd'));var jsforce=require(_0x633a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x633a('0xa'));var querystring=require(_0x633a('0xf'));var Papa=require('papaparse');var Redis=require(_0x633a('0x10'));var authService=require(_0x633a('0x11'));var qs=require(_0x633a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x633a('0x13'));var logger=require(_0x633a('0x14'))(_0x633a('0x15'));var utils=require(_0x633a('0x16'));var config=require(_0x633a('0x17'));var db=require(_0x633a('0x18'))['db'];function respondWithStatusCode(_0x11c123,_0xc21ab9){_0xc21ab9=_0xc21ab9||0xcc;return function(_0x1d7954){if(_0x1d7954){return _0x11c123[_0x633a('0x19')](_0xc21ab9);}return _0x11c123[_0x633a('0x1a')](_0xc21ab9)['end']();};}function respondWithResult(_0x2f1bcb,_0x6db26b){_0x6db26b=_0x6db26b||0xc8;return function(_0x2889ff){if(_0x2889ff){return _0x2f1bcb[_0x633a('0x1a')](_0x6db26b)[_0x633a('0x1b')](_0x2889ff);}};}function respondWithFilteredResult(_0x31e198,_0x49c3c2){return function(_0x2ba900){if(_0x2ba900){var _0x1ea4cb=_0x2ba900[_0x633a('0x1c')],_0x51e9b6=_0x49c3c2['offset'],_0x32cb6e=_0x49c3c2[_0x633a('0x1d')]+_0x49c3c2[_0x633a('0x1e')],_0x132bea;if(_0x32cb6e>=_0x1ea4cb){_0x32cb6e=_0x1ea4cb;_0x132bea=0xc8;}else{_0x132bea=0xce;}_0x31e198[_0x633a('0x1a')](_0x132bea);return _0x31e198[_0x633a('0x1f')]('Content-Range',_0x51e9b6+'-'+_0x32cb6e+'/'+_0x1ea4cb)[_0x633a('0x1b')](_0x2ba900);}return null;};}function patchUpdates(_0x14ed7e){return function(_0x2166f7){try{jsonpatch[_0x633a('0x20')](_0x2166f7,_0x14ed7e,!![]);}catch(_0x25bee1){return BPromise[_0x633a('0x21')](_0x25bee1);}return _0x2166f7[_0x633a('0x22')]();};}function saveUpdates(_0x159a3e,_0x15d97d){return function(_0x1d2c43){if(_0x1d2c43){return _0x1d2c43[_0x633a('0x23')](_0x159a3e)[_0x633a('0x24')](function(_0xb86427){return _0xb86427;});}return null;};}function removeEntity(_0x21a71a,_0x3affa9){return function(_0x5d46ce){if(_0x5d46ce){return _0x5d46ce[_0x633a('0x25')]()['then'](function(){var _0x2398b5=_0x5d46ce[_0x633a('0x26')]({'plain':!![]});var _0x3a5353='ChanSpies';return db[_0x633a('0x27')][_0x633a('0x25')]({'where':{'type':_0x3a5353,'resourceId':_0x2398b5['id']}})['then'](function(){return _0x5d46ce;});})['then'](function(){_0x21a71a[_0x633a('0x1a')](0xcc)[_0x633a('0x28')]();});}};}function handleEntityNotFound(_0x30dcbd,_0x1c8def){return function(_0x5959e4){if(!_0x5959e4){_0x30dcbd[_0x633a('0x19')](0x194);}return _0x5959e4;};}function handleError(_0x50d361,_0x3cf035){_0x3cf035=_0x3cf035||0x1f4;return function(_0x1a05ee){logger['error'](_0x1a05ee[_0x633a('0x29')]);if(_0x1a05ee[_0x633a('0x2a')]){delete _0x1a05ee[_0x633a('0x2a')];}_0x50d361[_0x633a('0x1a')](_0x3cf035)[_0x633a('0x2b')](_0x1a05ee);};}exports[_0x633a('0x2c')]=function(_0x1b6d6b,_0x316eea){var _0x5d6339={},_0x4020a6={},_0x373aad={'count':0x0,'rows':[]};var _0x4b8421=_['map'](db[_0x633a('0x2d')][_0x633a('0x2e')],function(_0x90dc84){return{'name':_0x90dc84[_0x633a('0x2f')],'type':_0x90dc84['type']['key']};});_0x4020a6['model']=_[_0x633a('0x30')](_0x4b8421,'name');_0x4020a6[_0x633a('0x31')]=_['keys'](_0x1b6d6b[_0x633a('0x31')]);_0x4020a6[_0x633a('0x32')]=_[_0x633a('0x33')](_0x4020a6[_0x633a('0x34')],_0x4020a6[_0x633a('0x31')]);_0x5d6339[_0x633a('0x35')]=_['intersection'](_0x4020a6[_0x633a('0x34')],qs[_0x633a('0x36')](_0x1b6d6b[_0x633a('0x31')][_0x633a('0x36')]));_0x5d6339[_0x633a('0x35')]=_0x5d6339['attributes'][_0x633a('0x37')]?_0x5d6339[_0x633a('0x35')]:_0x4020a6['model'];if(!_0x1b6d6b[_0x633a('0x31')]['hasOwnProperty'](_0x633a('0x38'))){_0x5d6339[_0x633a('0x1e')]=qs[_0x633a('0x1e')](_0x1b6d6b[_0x633a('0x31')][_0x633a('0x1e')]);_0x5d6339[_0x633a('0x1d')]=qs[_0x633a('0x1d')](_0x1b6d6b[_0x633a('0x31')][_0x633a('0x1d')]);}_0x5d6339[_0x633a('0x39')]=qs['sort'](_0x1b6d6b['query'][_0x633a('0x3a')]);_0x5d6339[_0x633a('0x3b')]=qs[_0x633a('0x32')](_[_0x633a('0x3c')](_0x1b6d6b['query'],_0x4020a6['filters']),_0x4b8421);if(_0x1b6d6b['query'][_0x633a('0x3d')]){_0x5d6339['where']=_[_0x633a('0x3e')](_0x5d6339[_0x633a('0x3b')],{'$or':_[_0x633a('0x30')](_0x4b8421,function(_0x4f341c){if(_0x4f341c[_0x633a('0x3f')]!==_0x633a('0x40')){var _0x8e0979={};_0x8e0979[_0x4f341c[_0x633a('0x2a')]]={'$like':'%'+_0x1b6d6b[_0x633a('0x31')][_0x633a('0x3d')]+'%'};return _0x8e0979;}})});}_0x5d6339=_['merge']({},_0x5d6339,_0x1b6d6b[_0x633a('0x41')]);var _0x46272f={'where':_0x5d6339[_0x633a('0x3b')]};return db[_0x633a('0x2d')]['count'](_0x46272f)[_0x633a('0x24')](function(_0x3ffed8){_0x373aad[_0x633a('0x1c')]=_0x3ffed8;if(_0x1b6d6b[_0x633a('0x31')][_0x633a('0x42')]){_0x5d6339[_0x633a('0x43')]=[{'all':!![]}];}return db[_0x633a('0x2d')][_0x633a('0x44')](_0x5d6339);})[_0x633a('0x24')](function(_0x3d5656){_0x373aad[_0x633a('0x45')]=_0x3d5656;return _0x373aad;})[_0x633a('0x24')](respondWithFilteredResult(_0x316eea,_0x5d6339))['catch'](handleError(_0x316eea,null));};exports['show']=function(_0x234ee9,_0x295d56){var _0x4b2106={'raw':![],'where':{'id':_0x234ee9[_0x633a('0x46')]['id']}},_0x3c54e3={};_0x3c54e3[_0x633a('0x34')]=_[_0x633a('0x47')](db[_0x633a('0x2d')]['rawAttributes']);_0x3c54e3['query']=_[_0x633a('0x47')](_0x234ee9[_0x633a('0x31')]);_0x3c54e3[_0x633a('0x32')]=_[_0x633a('0x33')](_0x3c54e3[_0x633a('0x34')],_0x3c54e3['query']);_0x4b2106[_0x633a('0x35')]=_[_0x633a('0x33')](_0x3c54e3[_0x633a('0x34')],qs[_0x633a('0x36')](_0x234ee9['query'][_0x633a('0x36')]));_0x4b2106[_0x633a('0x35')]=_0x4b2106['attributes'][_0x633a('0x37')]?_0x4b2106[_0x633a('0x35')]:_0x3c54e3[_0x633a('0x34')];if(_0x234ee9[_0x633a('0x31')][_0x633a('0x42')]){_0x4b2106[_0x633a('0x43')]=[{'all':!![]}];}_0x4b2106=_[_0x633a('0x3e')]({},_0x4b2106,_0x234ee9[_0x633a('0x41')]);return db[_0x633a('0x2d')][_0x633a('0x48')](_0x4b2106)[_0x633a('0x24')](handleEntityNotFound(_0x295d56,null))[_0x633a('0x24')](respondWithResult(_0x295d56,null))[_0x633a('0x49')](handleError(_0x295d56,null));};exports[_0x633a('0x4a')]=function(_0x301948,_0x1ab6b6){return db['VoiceChanSpy'][_0x633a('0x4a')](_0x301948['body'],{})[_0x633a('0x24')](function(_0x5b96d2){var _0xe52c7f=_0x301948[_0x633a('0x4b')][_0x633a('0x26')]({'plain':!![]});if(!_0xe52c7f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe52c7f['role']===_0x633a('0x4b')){var _0x2b1bf6=_0x5b96d2[_0x633a('0x26')]({'plain':!![]});var _0x25bd6a='ChanSpies';return db['UserProfileSection'][_0x633a('0x48')]({'where':{'name':_0x25bd6a,'userProfileId':_0xe52c7f['userProfileId']},'raw':!![]})[_0x633a('0x24')](function(_0xc856d2){if(_0xc856d2&&_0xc856d2['autoAssociation']===0x0){return db['UserProfileResource'][_0x633a('0x4a')]({'name':_0x2b1bf6[_0x633a('0x2a')],'resourceId':_0x2b1bf6['id'],'type':_0xc856d2['name'],'sectionId':_0xc856d2['id']},{})[_0x633a('0x24')](function(){return _0x5b96d2;});}else{return _0x5b96d2;}})[_0x633a('0x49')](function(_0x3e1283){logger[_0x633a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e1283);throw _0x3e1283;});}return _0x5b96d2;})[_0x633a('0x24')](respondWithResult(_0x1ab6b6,0xc9))[_0x633a('0x49')](handleError(_0x1ab6b6,null));};exports['update']=function(_0x404da8,_0x1f449b){if(_0x404da8[_0x633a('0x4d')]['id']){delete _0x404da8[_0x633a('0x4d')]['id'];}return db[_0x633a('0x2d')][_0x633a('0x48')]({'where':{'id':_0x404da8[_0x633a('0x46')]['id']}})[_0x633a('0x24')](handleEntityNotFound(_0x1f449b,null))['then'](saveUpdates(_0x404da8[_0x633a('0x4d')],null))[_0x633a('0x24')](respondWithResult(_0x1f449b,null))[_0x633a('0x49')](handleError(_0x1f449b,null));};exports[_0x633a('0x25')]=function(_0x243278,_0x3ddfcc){return db[_0x633a('0x2d')][_0x633a('0x48')]({'where':{'id':_0x243278['params']['id']}})['then'](handleEntityNotFound(_0x3ddfcc,null))[_0x633a('0x24')](removeEntity(_0x3ddfcc,null))['catch'](handleError(_0x3ddfcc,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index bee6c01..770c8fd 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf681=['CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','agent','catch','exports','models','define','VoiceChanSpy','then','VoiceExtension','destroy','bulkCreate','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','push','merge','Set'];(function(_0x3da7f2,_0x31e9ae){var _0x2f7d13=function(_0x5c4a7c){while(--_0x5c4a7c){_0x3da7f2['push'](_0x3da7f2['shift']());}};_0x2f7d13(++_0x31e9ae);}(_0xf681,0xc9));var _0x1f68=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf681[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x1f68('0x0'));var BPromise=require(_0x1f68('0x1'));var attributes=require(_0x1f68('0x2'));var getUserApplications=function(_0x2cb4fb,_0x56d4f7,_0x3f265a){var _0x4b0db4=0x1;var _0x8bf4eb=[];var _0xdea373={'context':_0x56d4f7['context']||_0x1f68('0x3'),'exten':util[_0x1f68('0x4')](_0x1f68('0x5'),_0x2cb4fb['prefix'],_0x3f265a),'type':'system','isApp':![],'ChanSpyId':_0x2cb4fb['id'],'UserId':_0x56d4f7['id']};_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0x8'),'appdata':util['format'](_0x1f68('0x9'),_0x1f68('0xa')),'priority':_0x4b0db4++},_0xdea373));if(_0x2cb4fb[_0x1f68('0xb')]){_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0xc'),'appdata':util[_0x1f68('0x4')](_0x1f68('0xd'),_0x2cb4fb['recordingFormat']),'priority':_0x4b0db4++},_0xdea373));}if(_0x2cb4fb[_0x1f68('0xe')]){_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0xf'),'appdata':_0x2cb4fb[_0x1f68('0x10')],'priority':_0x4b0db4++},_0xdea373));}_0x8bf4eb['push'](_[_0x1f68('0x7')]({'app':_0x1f68('0x11'),'appdata':util[_0x1f68('0x4')](_0x1f68('0x12'),_0x56d4f7[_0x1f68('0x13')],_0x2cb4fb[_0x1f68('0x14')]?_0x2cb4fb[_0x1f68('0x14')][_0x1f68('0x15')](''):''),'priority':_0x4b0db4++},_0xdea373));if(_0x2cb4fb[_0x1f68('0xb')]){_0x8bf4eb[_0x1f68('0x6')](_['merge']({'app':'StopMixMonitor','priority':_0x4b0db4++},_0xdea373));}return _0x8bf4eb;};var getChanSpyApplications=function(_0x1c8ba1,_0x30a60e){var _0x65c1f7=[];for(var _0x708c7c=0x0,_0x2a0b61=0x1;_0x708c7c<_0x30a60e[_0x1f68('0x16')];_0x708c7c++,_0x2a0b61=0x1){_0x65c1f7=_0x65c1f7[_0x1f68('0x17')](getUserApplications(_0x1c8ba1,_0x30a60e[_0x708c7c],_0x30a60e[_0x708c7c]['internal']));if(_0x30a60e[_0x708c7c]['internal']!=_0x30a60e[_0x708c7c][_0x1f68('0x13')]){_0x65c1f7=_0x65c1f7[_0x1f68('0x17')](getUserApplications(_0x1c8ba1,_0x30a60e[_0x708c7c],_0x30a60e[_0x708c7c]['name']));}}return _0x65c1f7;};var getChanSpyPromise=function(_0x5ecac4,_0x5e3979){return new BPromise(function(_0x597731,_0x24d5e8){return _0x5ecac4['User']['findAll']({'attributes':['id',_0x1f68('0x13'),_0x1f68('0x18')],'where':{'role':_0x1f68('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x35b8ea){if(_0x35b8ea){return _0x597731(getChanSpyApplications(_0x5e3979,_0x35b8ea));}return _0x597731([]);})[_0x1f68('0x1a')](function(_0x94d000){_0x24d5e8(_0x94d000);});});};module[_0x1f68('0x1b')]=function(_0x16d895,_0x182a35){var _0x5d888d=_0x16d895[_0x1f68('0x1c')];return _0x16d895[_0x1f68('0x1d')](_0x1f68('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31dba6,_0x5e9c12,_0x59b461){return getChanSpyPromise(_0x5d888d,_0x31dba6)[_0x1f68('0x1f')](function(_0xdb5be5){if(_0xdb5be5&&_0xdb5be5['length']){return _0x5d888d[_0x1f68('0x20')]['bulkCreate'](_0xdb5be5);}})[_0x1f68('0x1f')](function(){_0x59b461();})['catch'](function(_0x57bf30){_0x59b461(_0x57bf30);});},'afterUpdate':function(_0x13cdce,_0xde6430,_0x2ce93f){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x21')]({'where':{'ChanSpyId':_0x13cdce['id']}})['then'](function(){return getChanSpyPromise(_0x5d888d,_0x13cdce);})[_0x1f68('0x1f')](function(_0x2b5e22){if(_0x2b5e22&&_0x2b5e22[_0x1f68('0x16')]){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x22')](_0x2b5e22);}})['then'](function(){_0x2ce93f();})['catch'](function(_0x37534f){_0x2ce93f(_0x37534f);});},'afterDestroy':function(_0x403109,_0x3ad261,_0x4ad1f3){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x21')]({'where':{'ChanSpyId':_0x403109['id']}})[_0x1f68('0x1f')](function(){_0x4ad1f3();})[_0x1f68('0x1a')](function(_0x18f895){_0x4ad1f3(_0x18f895);});}}});}; \ No newline at end of file +var _0x4517=['length','concat','internal','User','findAll','agent','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','catch','destroy','bulkCreate','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','name','options','join','StopMixMonitor'];(function(_0x1e487b,_0xd6ae88){var _0x140e87=function(_0x3b6f9d){while(--_0x3b6f9d){_0x1e487b['push'](_0x1e487b['shift']());}};_0x140e87(++_0xd6ae88);}(_0x4517,0x112));var _0x7451=function(_0x55ebb2,_0x15a899){_0x55ebb2=_0x55ebb2-0x0;var _0x29c39c=_0x4517[_0x55ebb2];return _0x29c39c;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var BPromise=require(_0x7451('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x121fa7,_0xd66e4,_0x24505e){var _0x286bf4=0x1;var _0x355fbd=[];var _0x21b34c={'context':_0xd66e4[_0x7451('0x2')]||_0x7451('0x3'),'exten':util[_0x7451('0x4')](_0x7451('0x5'),_0x121fa7[_0x7451('0x6')],_0x24505e),'type':_0x7451('0x7'),'isApp':![],'ChanSpyId':_0x121fa7['id'],'UserId':_0xd66e4['id']};_0x355fbd[_0x7451('0x8')](_[_0x7451('0x9')]({'app':_0x7451('0xa'),'appdata':util[_0x7451('0x4')](_0x7451('0xb'),'chanspy'),'priority':_0x286bf4++},_0x21b34c));if(_0x121fa7[_0x7451('0xc')]){_0x355fbd[_0x7451('0x8')](_[_0x7451('0x9')]({'app':_0x7451('0xd'),'appdata':util[_0x7451('0x4')](_0x7451('0xe'),_0x121fa7[_0x7451('0xf')]),'priority':_0x286bf4++},_0x21b34c));}if(_0x121fa7['auth']){_0x355fbd['push'](_[_0x7451('0x9')]({'app':'Authenticate','appdata':_0x121fa7[_0x7451('0x10')],'priority':_0x286bf4++},_0x21b34c));}_0x355fbd[_0x7451('0x8')](_['merge']({'app':_0x7451('0x11'),'appdata':util[_0x7451('0x4')]('SIP/%s,%s',_0xd66e4[_0x7451('0x12')],_0x121fa7[_0x7451('0x13')]?_0x121fa7[_0x7451('0x13')][_0x7451('0x14')](''):''),'priority':_0x286bf4++},_0x21b34c));if(_0x121fa7['record']){_0x355fbd[_0x7451('0x8')](_[_0x7451('0x9')]({'app':_0x7451('0x15'),'priority':_0x286bf4++},_0x21b34c));}return _0x355fbd;};var getChanSpyApplications=function(_0x58c0cd,_0x4c9e54){var _0xfa4258=[];for(var _0x1db688=0x0,_0x508229=0x1;_0x1db688<_0x4c9e54[_0x7451('0x16')];_0x1db688++,_0x508229=0x1){_0xfa4258=_0xfa4258[_0x7451('0x17')](getUserApplications(_0x58c0cd,_0x4c9e54[_0x1db688],_0x4c9e54[_0x1db688][_0x7451('0x18')]));if(_0x4c9e54[_0x1db688][_0x7451('0x18')]!=_0x4c9e54[_0x1db688][_0x7451('0x12')]){_0xfa4258=_0xfa4258[_0x7451('0x17')](getUserApplications(_0x58c0cd,_0x4c9e54[_0x1db688],_0x4c9e54[_0x1db688]['name']));}}return _0xfa4258;};var getChanSpyPromise=function(_0x40dc78,_0x32e250){return new BPromise(function(_0x19c952,_0x59e07e){return _0x40dc78[_0x7451('0x19')][_0x7451('0x1a')]({'attributes':['id',_0x7451('0x12'),_0x7451('0x18')],'where':{'role':_0x7451('0x1b'),'chanspy':!![]},'raw':!![]})[_0x7451('0x1c')](function(_0x29f0bd){if(_0x29f0bd){return _0x19c952(getChanSpyApplications(_0x32e250,_0x29f0bd));}return _0x19c952([]);})['catch'](function(_0x3a0c1e){_0x59e07e(_0x3a0c1e);});});};module[_0x7451('0x1d')]=function(_0x561e12,_0x406b03){var _0x15c59b=_0x561e12[_0x7451('0x1e')];return _0x561e12['define'](_0x7451('0x1f'),attributes,{'tableName':_0x7451('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x21cc22,_0x1fc076,_0x37bc47){return getChanSpyPromise(_0x15c59b,_0x21cc22)[_0x7451('0x1c')](function(_0x3c56f1){if(_0x3c56f1&&_0x3c56f1[_0x7451('0x16')]){return _0x15c59b[_0x7451('0x21')]['bulkCreate'](_0x3c56f1);}})[_0x7451('0x1c')](function(){_0x37bc47();})[_0x7451('0x22')](function(_0x5df311){_0x37bc47(_0x5df311);});},'afterUpdate':function(_0x54bef8,_0xcc793e,_0x1edcf2){return _0x15c59b[_0x7451('0x21')][_0x7451('0x23')]({'where':{'ChanSpyId':_0x54bef8['id']}})[_0x7451('0x1c')](function(){return getChanSpyPromise(_0x15c59b,_0x54bef8);})[_0x7451('0x1c')](function(_0x4b5b26){if(_0x4b5b26&&_0x4b5b26[_0x7451('0x16')]){return _0x15c59b['VoiceExtension'][_0x7451('0x24')](_0x4b5b26);}})[_0x7451('0x1c')](function(){_0x1edcf2();})['catch'](function(_0x7da05a){_0x1edcf2(_0x7da05a);});},'afterDestroy':function(_0x4323b7,_0x40b6c3,_0x3a397e){return _0x15c59b[_0x7451('0x21')]['destroy']({'where':{'ChanSpyId':_0x4323b7['id']}})[_0x7451('0x1c')](function(){_0x3a397e();})[_0x7451('0x22')](function(_0x24ed91){_0x3a397e(_0x24ed91);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1fab20a..399cc96 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 _0x2be2=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x2be2,0x65));var _0x22be=function(_0x52ea49,_0x2dcda9){_0x52ea49=_0x52ea49-0x0;var _0x56b4fb=_0x2be2[_0x52ea49];return _0x56b4fb;};'use strict';var _=require(_0x22be('0x0'));var util=require(_0x22be('0x1'));var moment=require(_0x22be('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22be('0x3'));var db=require(_0x22be('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22be('0x5'));var config=require('../../config/environment');var jayson=require(_0x22be('0x6'));var client=jayson[_0x22be('0x7')][_0x22be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bab95,_0x521dc0,_0xea4dbe){return new BPromise(function(_0x4b7602,_0x39dbea){return client[_0x22be('0x9')](_0x1bab95,_0xea4dbe)[_0x22be('0xa')](function(_0x35a50b){logger['info'](_0x22be('0xb'),_0x521dc0,'request\x20sent');logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x521dc0,_0x22be('0xc'),JSON[_0x22be('0xd')](_0x35a50b));if(_0x35a50b['error']){if(_0x35a50b[_0x22be('0xe')][_0x22be('0xf')]===0x1f4){logger[_0x22be('0xe')](_0x22be('0xb'),_0x521dc0,_0x35a50b['error'][_0x22be('0x10')]);return _0x39dbea(_0x35a50b[_0x22be('0xe')][_0x22be('0x10')]);}logger['error'](_0x22be('0xb'),_0x521dc0,_0x35a50b[_0x22be('0xe')][_0x22be('0x10')]);return _0x4b7602(_0x35a50b[_0x22be('0xe')][_0x22be('0x10')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x521dc0,_0x22be('0xc'));_0x4b7602(_0x35a50b[_0x22be('0x11')][_0x22be('0x10')]);}})[_0x22be('0x12')](function(_0x2c3cfe){logger['error'](_0x22be('0xb'),_0x521dc0,_0x2c3cfe);_0x39dbea(_0x2c3cfe);});});} \ No newline at end of file +var _0x926a=['../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x531fdc,_0x4f2cdd){var _0x53f2db=function(_0x2056c7){while(--_0x2056c7){_0x531fdc['push'](_0x531fdc['shift']());}};_0x53f2db(++_0x4f2cdd);}(_0x926a,0x120));var _0xa926=function(_0x1c80b2,_0x3985bf){_0x1c80b2=_0x1c80b2-0x0;var _0x5b5cf2=_0x926a[_0x1c80b2];return _0x5b5cf2;};'use strict';var _=require(_0xa926('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa926('0x1'));var rs=require(_0xa926('0x2'));var fs=require('fs');var Redis=require(_0xa926('0x3'));var db=require(_0xa926('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa926('0x5'));var config=require(_0xa926('0x6'));var jayson=require(_0xa926('0x7'));var client=jayson[_0xa926('0x8')][_0xa926('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2760e0,_0x548d1e,_0x195a92){return new BPromise(function(_0x48b2a5,_0x5cecad){return client['request'](_0x2760e0,_0x195a92)[_0xa926('0xa')](function(_0x488cb2){logger[_0xa926('0xb')](_0xa926('0xc'),_0x548d1e,_0xa926('0xd'));logger[_0xa926('0xe')](_0xa926('0xf'),_0x548d1e,_0xa926('0xd'),JSON['stringify'](_0x488cb2));if(_0x488cb2[_0xa926('0x10')]){if(_0x488cb2['error'][_0xa926('0x11')]===0x1f4){logger[_0xa926('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x548d1e,_0x488cb2['error']['message']);return _0x5cecad(_0x488cb2[_0xa926('0x10')][_0xa926('0x12')]);}logger['error'](_0xa926('0xc'),_0x548d1e,_0x488cb2['error'][_0xa926('0x12')]);return _0x48b2a5(_0x488cb2[_0xa926('0x10')][_0xa926('0x12')]);}else{logger[_0xa926('0xb')](_0xa926('0xc'),_0x548d1e,_0xa926('0xd'));_0x48b2a5(_0x488cb2[_0xa926('0x13')][_0xa926('0x12')]);}})[_0xa926('0x14')](function(_0x4708aa){logger['error'](_0xa926('0xc'),_0x548d1e,_0x4708aa);_0x5cecad(_0x4708aa);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b540bde..8eaee61 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 _0x2cce=['put','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x2cce,0x19a));var _0xe2cc=function(_0xb4d24a,_0x57953e){_0xb4d24a=_0xb4d24a-0x0;var _0x1e65b5=_0x2cce[_0xb4d24a];return _0x1e65b5;};'use strict';var multer=require(_0xe2cc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe2cc('0x1'));var express=require(_0xe2cc('0x2'));var router=express[_0xe2cc('0x3')]();var auth=require(_0xe2cc('0x4'));var interaction=require(_0xe2cc('0x5'));var config=require(_0xe2cc('0x6'));var controller=require(_0xe2cc('0x7'));router['get']('/',auth[_0xe2cc('0x8')](),controller[_0xe2cc('0x9')]);router[_0xe2cc('0xa')](_0xe2cc('0xb'),auth['isAuthenticated'](),controller[_0xe2cc('0xc')]);router[_0xe2cc('0xd')]('/',auth[_0xe2cc('0x8')](),controller[_0xe2cc('0xe')]);router[_0xe2cc('0xf')]('/:id',auth[_0xe2cc('0x8')](),controller['update']);router[_0xe2cc('0x10')]('/:id',auth[_0xe2cc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x193d=['/:id','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','create','put'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x193d,0x125));var _0xd193=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x193d[_0x59d89e];return _0x554e93;};'use strict';var multer=require('multer');var util=require(_0xd193('0x0'));var path=require(_0xd193('0x1'));var timeout=require('connect-timeout');var express=require(_0xd193('0x2'));var router=express[_0xd193('0x3')]();var auth=require(_0xd193('0x4'));var interaction=require(_0xd193('0x5'));var config=require(_0xd193('0x6'));var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd193('0x7')]);router[_0xd193('0x8')]('/:id',auth[_0xd193('0x9')](),controller[_0xd193('0xa')]);router['post']('/',auth[_0xd193('0x9')](),controller[_0xd193('0xb')]);router[_0xd193('0xc')](_0xd193('0xd'),auth[_0xd193('0x9')](),controller[_0xd193('0xe')]);router['delete'](_0xd193('0xd'),auth[_0xd193('0x9')](),controller[_0xd193('0xf')]);module[_0xd193('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2153d61..0e11b3b 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(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x3e74,0x175));var _0x43e7=function(_0x5ce0bb,_0x95fdd3){_0x5ce0bb=_0x5ce0bb-0x0;var _0xfca9d7=_0x3e74[_0x5ce0bb];return _0xfca9d7;};'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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x285c3d,_0x1c52b7){var _0xf7d065=function(_0x11d483){while(--_0x11d483){_0x285c3d['push'](_0x285c3d['shift']());}};_0xf7d065(++_0x1c52b7);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c477ae1..5b0da13 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 _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file +var _0x008c=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','VoiceContext,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','status','end','count','offset','limit','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger'];(function(_0x2a0377,_0x44da1c){var _0x1f1762=function(_0x4499d1){while(--_0x4499d1){_0x2a0377['push'](_0x2a0377['shift']());}};_0x1f1762(++_0x44da1c);}(_0x008c,0x188));var _0xc008=function(_0x5b9259,_0x198473){_0x5b9259=_0x5b9259-0x0;var _0x5bbf28=_0x008c[_0x5b9259];return _0x5bbf28;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var jayson=require(_0xc008('0x17'));var client=jayson[_0xc008('0x18')][_0xc008('0x19')]({'port':0x232a});function checkPasswordPattern(_0x69726e,_0x593f7a,_0x560e28){if(_0x560e28){var _0x33f44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f44c['test'](_0x593f7a)){return _0x69726e;}else{throw new db[(_0xc008('0x1a'))][(_0xc008('0x1b'))](_0xc008('0x1c'));}}else{return _0x69726e;}}function respondWithRpcPromise(_0x339ffc,_0x3f0ecf,_0x5ee00b,_0x5e894e){return new BPromise(function(_0x4bd0f4,_0x11ef38){var _0x15a6ad=_0x5e894e||client;return _0x15a6ad[_0xc008('0x1d')](_0x339ffc,_0x5ee00b)[_0xc008('0x1e')](function(_0x4fe771){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,'request\x20sent');logger[_0xc008('0x1f')](_0xc008('0x20'),_0x3f0ecf,'request\x20sent',JSON[_0xc008('0x21')](_0x4fe771));if(_0x4fe771['error']){if(_0x4fe771['error']['code']===0x1f4){logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771['error']['message']);return _0x11ef38(_0x4fe771['error']['message']);}logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);return _0x4bd0f4(_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);}else{logger[_0xc008('0x25')]('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,_0xc008('0x26'));_0x4bd0f4(_0x4fe771['result']['message']);}})[_0xc008('0x27')](function(_0x36f358){logger[_0xc008('0x23')](_0xc008('0x22'),_0x3f0ecf,_0x36f358);_0x11ef38(_0x36f358);});});}function respondWithStatusCode(_0x5410f5,_0x48582b){_0x48582b=_0x48582b||0xcc;return function(_0x5de1e9){if(_0x5de1e9){return _0x5410f5[_0xc008('0x28')](_0x48582b);}return _0x5410f5[_0xc008('0x29')](_0x48582b)[_0xc008('0x2a')]();};}function respondWithResult(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0xc8;return function(_0x5e2aca){if(_0x5e2aca){return _0x2e31c2['status'](_0x5bebd9)['json'](_0x5e2aca);}};}function respondWithFilteredResult(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(_0x29ba43){var _0x25eae4=_0x29ba43[_0xc008('0x2b')],_0x529961=_0x3865c0[_0xc008('0x2c')],_0x24c14c=_0x3865c0['offset']+_0x3865c0[_0xc008('0x2d')],_0x32390d;if(_0x24c14c>=_0x25eae4){_0x24c14c=_0x25eae4;_0x32390d=0xc8;}else{_0x32390d=0xce;}_0x4caaf4[_0xc008('0x29')](_0x32390d);return _0x4caaf4['set']('Content-Range',_0x529961+'-'+_0x24c14c+'/'+_0x25eae4)['json'](_0x29ba43);}return null;};}function patchUpdates(_0x1032b2){return function(_0x267abd){try{jsonpatch[_0xc008('0x2e')](_0x267abd,_0x1032b2,!![]);}catch(_0x10889f){return BPromise[_0xc008('0x2f')](_0x10889f);}return _0x267abd[_0xc008('0x30')]();};}function saveUpdates(_0x294f97,_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x31')](_0x294f97)[_0xc008('0x1e')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8,_0x334a09){return function(_0x4b7fd4){if(_0x4b7fd4){return _0x4b7fd4['destroy']()[_0xc008('0x1e')](function(){var _0x165a7b=_0x4b7fd4[_0xc008('0x32')]({'plain':!![]});var _0xca0520=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x35')]({'where':{'type':_0xca0520,'resourceId':_0x165a7b['id']}})[_0xc008('0x1e')](function(){return _0x4b7fd4;});})[_0xc008('0x1e')](function(){_0x596ee8['status'](0xcc)[_0xc008('0x2a')]();});}};}function handleEntityNotFound(_0x389a40,_0x459df4){return function(_0x344bad){if(!_0x344bad){_0x389a40[_0xc008('0x28')](0x194);}return _0x344bad;};}function handleError(_0x315562,_0x1667a0){_0x1667a0=_0x1667a0||0x1f4;return function(_0x5d0e06){logger[_0xc008('0x23')](_0x5d0e06[_0xc008('0x36')]);if(_0x5d0e06['name']){delete _0x5d0e06[_0xc008('0x37')];}_0x315562[_0xc008('0x29')](_0x1667a0)['send'](_0x5d0e06);};}exports[_0xc008('0x38')]=function(_0x2e4ae1,_0x280e9b){var _0x55ff48={},_0x53b353={},_0x478810={'count':0x0,'rows':[]};var _0x234f2a=_['map'](db[_0xc008('0x39')][_0xc008('0x3a')],function(_0x6a4ccb){return{'name':_0x6a4ccb[_0xc008('0x3b')],'type':_0x6a4ccb[_0xc008('0x3c')][_0xc008('0x3d')]};});_0x53b353[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x234f2a,_0xc008('0x37'));_0x53b353[_0xc008('0x40')]=_[_0xc008('0x41')](_0x2e4ae1[_0xc008('0x40')]);_0x53b353[_0xc008('0x42')]=_[_0xc008('0x43')](_0x53b353['model'],_0x53b353[_0xc008('0x40')]);_0x55ff48[_0xc008('0x44')]=_[_0xc008('0x43')](_0x53b353[_0xc008('0x3e')],qs['fields'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x45')]));_0x55ff48[_0xc008('0x44')]=_0x55ff48[_0xc008('0x44')][_0xc008('0x46')]?_0x55ff48['attributes']:_0x53b353[_0xc008('0x3e')];if(!_0x2e4ae1[_0xc008('0x40')][_0xc008('0x47')](_0xc008('0x48'))){_0x55ff48[_0xc008('0x2d')]=qs['limit'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x2d')]);_0x55ff48[_0xc008('0x2c')]=qs[_0xc008('0x2c')](_0x2e4ae1['query'][_0xc008('0x2c')]);}_0x55ff48[_0xc008('0x49')]=qs[_0xc008('0x4a')](_0x2e4ae1['query'][_0xc008('0x4a')]);_0x55ff48['where']=qs[_0xc008('0x42')](_['pick'](_0x2e4ae1[_0xc008('0x40')],_0x53b353[_0xc008('0x42')]),_0x234f2a);if(_0x2e4ae1['query'][_0xc008('0x4b')]){_0x55ff48[_0xc008('0x4c')]=_[_0xc008('0x4d')](_0x55ff48['where'],{'$or':_[_0xc008('0x3f')](_0x234f2a,function(_0x2a9b5c){if(_0x2a9b5c[_0xc008('0x3c')]!==_0xc008('0x4e')){var _0x347629={};_0x347629[_0x2a9b5c[_0xc008('0x37')]]={'$like':'%'+_0x2e4ae1['query']['filter']+'%'};return _0x347629;}})});}_0x55ff48=_['merge']({},_0x55ff48,_0x2e4ae1[_0xc008('0x4f')]);var _0x36417a={'where':_0x55ff48[_0xc008('0x4c')]};return db[_0xc008('0x39')][_0xc008('0x2b')](_0x36417a)[_0xc008('0x1e')](function(_0x2cf641){_0x478810[_0xc008('0x2b')]=_0x2cf641;if(_0x2e4ae1['query']['includeAll']){_0x55ff48['include']=[{'all':!![]}];}return db[_0xc008('0x39')][_0xc008('0x50')](_0x55ff48);})[_0xc008('0x1e')](function(_0x511383){_0x478810[_0xc008('0x51')]=_0x511383;return _0x478810;})[_0xc008('0x1e')](respondWithFilteredResult(_0x280e9b,_0x55ff48))[_0xc008('0x27')](handleError(_0x280e9b,null));};exports[_0xc008('0x52')]=function(_0x4981b4,_0x56e4ac){var _0x17ec90={'raw':![],'where':{'id':_0x4981b4[_0xc008('0x53')]['id']}},_0x405e87={};_0x405e87[_0xc008('0x3e')]=_['keys'](db['VoiceContext'][_0xc008('0x3a')]);_0x405e87['query']=_[_0xc008('0x41')](_0x4981b4[_0xc008('0x40')]);_0x405e87[_0xc008('0x42')]=_['intersection'](_0x405e87[_0xc008('0x3e')],_0x405e87[_0xc008('0x40')]);_0x17ec90[_0xc008('0x44')]=_[_0xc008('0x43')](_0x405e87[_0xc008('0x3e')],qs['fields'](_0x4981b4[_0xc008('0x40')][_0xc008('0x45')]));_0x17ec90['attributes']=_0x17ec90[_0xc008('0x44')][_0xc008('0x46')]?_0x17ec90['attributes']:_0x405e87['model'];if(_0x4981b4[_0xc008('0x40')][_0xc008('0x54')]){_0x17ec90[_0xc008('0x55')]=[{'all':!![]}];}_0x17ec90=_[_0xc008('0x4d')]({},_0x17ec90,_0x4981b4[_0xc008('0x4f')]);return db['VoiceContext']['find'](_0x17ec90)[_0xc008('0x1e')](handleEntityNotFound(_0x56e4ac,null))['then'](respondWithResult(_0x56e4ac,null))[_0xc008('0x27')](handleError(_0x56e4ac,null));};exports[_0xc008('0x56')]=function(_0xf94fcb,_0x2f1105,_0x44f42d){var _0x27a167;return db['VoiceContext'][_0xc008('0x56')](_0xf94fcb[_0xc008('0x57')],{'raw':!![]})[_0xc008('0x1e')](function(_0x2b350c){_0x27a167=_0x2b350c;return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x4fdab4){var _0x535e6e=fs['readFileSync'](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3aeeab=ejs[_0xc008('0x5b')](_0x535e6e,{'contexts':_0x4fdab4||[]});fs[_0xc008('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3aeeab);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x56'),{'module':_0xc008('0x5e')});})['then'](function(){var _0x4022dd=_0xf94fcb['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x4022dd)throw new Error(_0xc008('0x5f'));if(_0x4022dd[_0xc008('0x60')]===_0xc008('0x61')){var _0x192c87=_0x27a167[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x62')]({'where':{'name':'Contexts','userProfileId':_0x4022dd['userProfileId']},'raw':!![]})[_0xc008('0x1e')](function(_0x30aa1e){if(_0x30aa1e&&_0x30aa1e['autoAssociation']===0x0){return db[_0xc008('0x34')][_0xc008('0x56')]({'name':_0x192c87[_0xc008('0x37')],'resourceId':_0x192c87['id'],'type':_0x30aa1e[_0xc008('0x37')],'sectionId':_0x30aa1e['id']},{})[_0xc008('0x1e')](function(){return _0x27a167;});}else{return _0x27a167;}})[_0xc008('0x27')](function(_0x12973b){logger['error'](_0xc008('0x63'),_0x12973b);throw _0x12973b;});}return _0x27a167;})[_0xc008('0x1e')](respondWithResult(_0x2f1105,0xc9))[_0xc008('0x27')](handleError(_0x2f1105,null));};exports[_0xc008('0x31')]=function(_0xb3ca0f,_0x167425,_0x249898){var _0x280249;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0xb3ca0f[_0xc008('0x53')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x167425,null))[_0xc008('0x1e')](saveUpdates(_0xb3ca0f[_0xc008('0x57')],null))['then'](function(_0x36a08e){if(_0x36a08e){_0x280249=_0x36a08e;return db[_0xc008('0x39')][_0xc008('0x50')]({'raw':!![]});}})['then'](function(_0xd7d020){var _0x3214df=fs['readFileSync'](path['join'](config[_0xc008('0x59')],_0xc008('0x5a')),_0xc008('0x64'));var _0x39083c=ejs[_0xc008('0x5b')](_0x3214df,{'contexts':_0xd7d020||[]});fs[_0xc008('0x5c')](_0xc008('0x65'),_0x39083c);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x31'),{'module':_0xc008('0x5e')});})['then'](function(){return _0x280249;})[_0xc008('0x1e')](respondWithResult(_0x167425,null))[_0xc008('0x27')](handleError(_0x167425,null));};exports[_0xc008('0x35')]=function(_0x27dc80,_0x521e67,_0x17ffb1){var _0x5975de;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0x27dc80[_0xc008('0x53')]['id']}})['then'](handleEntityNotFound(_0x521e67,null))[_0xc008('0x1e')](removeEntity(_0x521e67,null))[_0xc008('0x1e')](function(){return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x539fc8){var _0x50ee03=fs[_0xc008('0x66')](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3c30db=ejs[_0xc008('0x5b')](_0x50ee03,{'contexts':_0x539fc8});fs['writeFileSync'](_0xc008('0x65'),_0x3c30db);return respondWithRpcPromise('Reload',_0xc008('0x35'),{'module':'chan_sip.so'});})[_0xc008('0x27')](handleError(_0x521e67,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c7a495c..00d1e02 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(_0xf8eff4,_0x2bf578){var _0x2e8cc0=function(_0x2f3aa3){while(--_0x2f3aa3){_0xf8eff4['push'](_0xf8eff4['shift']());}};_0x2e8cc0(++_0x2bf578);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 4b0fe92..d0cbcd5 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 _0xc57d=['client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x40af28,_0x48ea63){var _0x4b0950=function(_0x53c0a7){while(--_0x53c0a7){_0x40af28['push'](_0x40af28['shift']());}};_0x4b0950(++_0x48ea63);}(_0xc57d,0x1c1));var _0xdc57=function(_0x5934b6,_0x18e9b2){_0x5934b6=_0x5934b6-0x0;var _0x1af769=_0xc57d[_0x5934b6];return _0x1af769;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc57('0x0'));var BPromise=require(_0xdc57('0x1'));var rs=require(_0xdc57('0x2'));var fs=require('fs');var Redis=require(_0xdc57('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc57('0x4'));var logger=require(_0xdc57('0x5'))('rpc');var config=require(_0xdc57('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdc57('0x7')][_0xdc57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x540298,_0x5c8eb4,_0x3abf1f){return new BPromise(function(_0x24c844,_0x2a5ee5){return client['request'](_0x540298,_0x3abf1f)['then'](function(_0x24f25b){logger['info'](_0xdc57('0x9'),_0x5c8eb4,_0xdc57('0xa'));logger['debug'](_0xdc57('0xb'),_0x5c8eb4,_0xdc57('0xa'),JSON[_0xdc57('0xc')](_0x24f25b));if(_0x24f25b[_0xdc57('0xd')]){if(_0x24f25b[_0xdc57('0xd')][_0xdc57('0xe')]===0x1f4){logger[_0xdc57('0xd')](_0xdc57('0x9'),_0x5c8eb4,_0x24f25b['error'][_0xdc57('0xf')]);return _0x2a5ee5(_0x24f25b[_0xdc57('0xd')][_0xdc57('0xf')]);}logger[_0xdc57('0xd')]('VoiceContext,\x20%s,\x20%s',_0x5c8eb4,_0x24f25b[_0xdc57('0xd')][_0xdc57('0xf')]);return _0x24c844(_0x24f25b['error'][_0xdc57('0xf')]);}else{logger[_0xdc57('0x10')]('VoiceContext,\x20%s,\x20%s',_0x5c8eb4,'request\x20sent');_0x24c844(_0x24f25b[_0xdc57('0x11')]['message']);}})[_0xdc57('0x12')](function(_0x32f4dd){logger[_0xdc57('0xd')](_0xdc57('0x9'),_0x5c8eb4,_0x32f4dd);_0x2a5ee5(_0x32f4dd);});});} \ No newline at end of file +var _0xd23b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5c9de3,_0x488000){var _0x490296=function(_0x4f17ac){while(--_0x4f17ac){_0x5c9de3['push'](_0x5c9de3['shift']());}};_0x490296(++_0x488000);}(_0xd23b,0x131));var _0xbd23=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd23b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xbd23('0x0'));var util=require(_0xbd23('0x1'));var moment=require(_0xbd23('0x2'));var BPromise=require(_0xbd23('0x3'));var rs=require(_0xbd23('0x4'));var fs=require('fs');var Redis=require(_0xbd23('0x5'));var db=require(_0xbd23('0x6'))['db'];var utils=require(_0xbd23('0x7'));var logger=require(_0xbd23('0x8'))(_0xbd23('0x9'));var config=require(_0xbd23('0xa'));var jayson=require(_0xbd23('0xb'));var client=jayson['client'][_0xbd23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x102e4d,_0x467459,_0xf7860a){return new BPromise(function(_0xb61402,_0x4c3548){return client[_0xbd23('0xd')](_0x102e4d,_0xf7860a)[_0xbd23('0xe')](function(_0x5c935d){logger[_0xbd23('0xf')]('VoiceContext,\x20%s,\x20%s',_0x467459,_0xbd23('0x10'));logger['debug'](_0xbd23('0x11'),_0x467459,_0xbd23('0x10'),JSON[_0xbd23('0x12')](_0x5c935d));if(_0x5c935d['error']){if(_0x5c935d[_0xbd23('0x13')][_0xbd23('0x14')]===0x1f4){logger[_0xbd23('0x13')]('VoiceContext,\x20%s,\x20%s',_0x467459,_0x5c935d[_0xbd23('0x13')]['message']);return _0x4c3548(_0x5c935d[_0xbd23('0x13')]['message']);}logger[_0xbd23('0x13')](_0xbd23('0x15'),_0x467459,_0x5c935d[_0xbd23('0x13')]['message']);return _0xb61402(_0x5c935d[_0xbd23('0x13')][_0xbd23('0x16')]);}else{logger[_0xbd23('0xf')](_0xbd23('0x15'),_0x467459,_0xbd23('0x10'));_0xb61402(_0x5c935d['result'][_0xbd23('0x16')]);}})[_0xbd23('0x17')](function(_0x3e4b96){logger[_0xbd23('0x13')]('VoiceContext,\x20%s,\x20%s',_0x467459,_0x3e4b96);_0x4c3548(_0x3e4b96);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 39f0f06..5282caa 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 _0xf670=['exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','show','create','put','/:id','update','delete'];(function(_0x2ecfca,_0x4f5d2c){var _0x3cbd36=function(_0x3f7c17){while(--_0x3f7c17){_0x2ecfca['push'](_0x2ecfca['shift']());}};_0x3cbd36(++_0x4f5d2c);}(_0xf670,0x155));var _0x0f67=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xf670[_0x3a16d4];return _0x31ea9c;};'use strict';var multer=require('multer');var util=require(_0x0f67('0x0'));var path=require('path');var timeout=require(_0x0f67('0x1'));var express=require('express');var router=express[_0x0f67('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0f67('0x3'));var config=require(_0x0f67('0x4'));var controller=require(_0x0f67('0x5'));router['get']('/',auth[_0x0f67('0x6')](),controller[_0x0f67('0x7')]);router[_0x0f67('0x8')](_0x0f67('0x9'),auth[_0x0f67('0x6')](),controller['describe']);router['get']('/:id',auth[_0x0f67('0x6')](),controller[_0x0f67('0xa')]);router['post']('/',auth[_0x0f67('0x6')](),controller[_0x0f67('0xb')]);router[_0x0f67('0xc')](_0x0f67('0xd'),auth[_0x0f67('0x6')](),controller[_0x0f67('0xe')]);router[_0x0f67('0xf')]('/:id',auth[_0x0f67('0x6')](),controller['destroy']);module[_0x0f67('0x10')]=router; \ No newline at end of file +var _0x103a=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','/describe','describe','/:id','isAuthenticated','post','create','update','delete','exports','util','path'];(function(_0x11b273,_0xfca019){var _0x2ea894=function(_0x17e1fa){while(--_0x17e1fa){_0x11b273['push'](_0x11b273['shift']());}};_0x2ea894(++_0xfca019);}(_0x103a,0x75));var _0xa103=function(_0x41cfa5,_0x41b8ef){_0x41cfa5=_0x41cfa5-0x0;var _0xae5fd7=_0x103a[_0x41cfa5];return _0xae5fd7;};'use strict';var multer=require('multer');var util=require(_0xa103('0x0'));var path=require(_0xa103('0x1'));var timeout=require(_0xa103('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa103('0x3'));var interaction=require(_0xa103('0x4'));var config=require(_0xa103('0x5'));var controller=require(_0xa103('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa103('0x7')](_0xa103('0x8'),auth['isAuthenticated'](),controller[_0xa103('0x9')]);router[_0xa103('0x7')](_0xa103('0xa'),auth[_0xa103('0xb')](),controller['show']);router[_0xa103('0xc')]('/',auth[_0xa103('0xb')](),controller[_0xa103('0xd')]);router['put']('/:id',auth[_0xa103('0xb')](),controller[_0xa103('0xe')]);router[_0xa103('0xf')]('/:id',auth[_0xa103('0xb')](),controller['destroy']);module[_0xa103('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6ae69aa..ac9cd30 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 _0x8ced=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x1bafab,_0xabb520){var _0x21a3ed=function(_0x34058a){while(--_0x34058a){_0x1bafab['push'](_0x1bafab['shift']());}};_0x21a3ed(++_0xabb520);}(_0x8ced,0x6a));var _0xd8ce=function(_0x5e9aa2,_0xd197ca){_0x5e9aa2=_0x5e9aa2-0x0;var _0xc42277=_0x8ced[_0x5e9aa2];return _0xc42277;};'use strict';var Sequelize=require(_0xd8ce('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd8ce('0x1')]},'channel':{'type':Sequelize[_0xd8ce('0x1')]},'channelstate':{'type':Sequelize[_0xd8ce('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd8ce('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd8ce('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd8ce('0x1')]},'language':{'type':Sequelize[_0xd8ce('0x1')]},'accountcode':{'type':Sequelize[_0xd8ce('0x1')]},'context':{'type':Sequelize[_0xd8ce('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd8ce('0x1')]},'destchannel':{'type':Sequelize[_0xd8ce('0x1')]},'destchannelstate':{'type':Sequelize[_0xd8ce('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd8ce('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd8ce('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd8ce('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd8ce('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd8ce('0x1')]},'destcontext':{'type':Sequelize[_0xd8ce('0x1')]},'destexten':{'type':Sequelize[_0xd8ce('0x1')]},'destpriority':{'type':Sequelize[_0xd8ce('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xd8ce('0x1')]},'dialstring':{'type':Sequelize[_0xd8ce('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd8ce('0x3')]},'answertime':{'type':Sequelize[_0xd8ce('0x3')]},'endtime':{'type':Sequelize[_0xd8ce('0x3')]},'lastevent':{'type':Sequelize[_0xd8ce('0x1')],'comment':_0xd8ce('0x4')},'routeId':{'type':Sequelize[_0xd8ce('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd8ce('0x2')]}}; \ No newline at end of file +var _0xd304=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x2b162d,_0x3232b1){var _0x51046e=function(_0x3927f0){while(--_0x3927f0){_0x2b162d['push'](_0x2b162d['shift']());}};_0x51046e(++_0x3232b1);}(_0xd304,0x189));var _0x4d30=function(_0x299ccc,_0x29374a){_0x299ccc=_0x299ccc-0x0;var _0x541783=_0xd304[_0x299ccc];return _0x541783;};'use strict';var Sequelize=require(_0x4d30('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x4d30('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4d30('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4d30('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4d30('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4d30('0x1')]},'connectedlinename':{'type':Sequelize[_0x4d30('0x1')]},'language':{'type':Sequelize[_0x4d30('0x1')]},'accountcode':{'type':Sequelize[_0x4d30('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4d30('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4d30('0x1')]},'destchannelstate':{'type':Sequelize[_0x4d30('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4d30('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4d30('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4d30('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4d30('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x4d30('0x1')]},'destlinkedid':{'type':Sequelize[_0x4d30('0x1')]},'dialstring':{'type':Sequelize[_0x4d30('0x1')]},'dialstatus':{'type':Sequelize[_0x4d30('0x1')]},'starttime':{'type':Sequelize[_0x4d30('0x3')]},'answertime':{'type':Sequelize[_0x4d30('0x3')]},'endtime':{'type':Sequelize[_0x4d30('0x3')]},'lastevent':{'type':Sequelize[_0x4d30('0x1')],'comment':_0x4d30('0x4')},'routeId':{'type':Sequelize[_0x4d30('0x2')]},'duration':{'type':Sequelize[_0x4d30('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f9bfc62..8658db0 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 _0xf9fd=['ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceDialReport','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','to-csv'];(function(_0x462548,_0x2fe430){var _0x543854=function(_0x417387){while(--_0x417387){_0x462548['push'](_0x462548['shift']());}};_0x543854(++_0x2fe430);}(_0xf9fd,0x118));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xdf9f('0x0'));var emlformat=require(_0xdf9f('0x1'));var rimraf=require(_0xdf9f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf9f('0x3'));var rp=require(_0xdf9f('0x4'));var moment=require('moment');var BPromise=require(_0xdf9f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdf9f('0x6'));var sox=require('sox');var csv=require(_0xdf9f('0x7'));var ejs=require(_0xdf9f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf9f('0x9'));var crypto=require(_0xdf9f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdf9f('0xb'));var toCsv=require(_0xdf9f('0x7'));var querystring=require('querystring');var Papa=require(_0xdf9f('0xc'));var Redis=require(_0xdf9f('0xd'));var authService=require(_0xdf9f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdf9f('0xf'));var hardwareService=require(_0xdf9f('0x10'));var logger=require(_0xdf9f('0x11'))(_0xdf9f('0x12'));var utils=require(_0xdf9f('0x13'));var config=require(_0xdf9f('0x14'));var db=require(_0xdf9f('0x15'))['db'];function respondWithStatusCode(_0x122b40,_0x59ccd9){_0x59ccd9=_0x59ccd9||0xcc;return function(_0x1bc5ef){if(_0x1bc5ef){return _0x122b40['sendStatus'](_0x59ccd9);}return _0x122b40[_0xdf9f('0x16')](_0x59ccd9)[_0xdf9f('0x17')]();};}function respondWithResult(_0x1bd711,_0x2917ef){_0x2917ef=_0x2917ef||0xc8;return function(_0x1f5b2a){if(_0x1f5b2a){return _0x1bd711[_0xdf9f('0x16')](_0x2917ef)[_0xdf9f('0x18')](_0x1f5b2a);}};}function respondWithFilteredResult(_0x5834cb,_0x136788){return function(_0x757c0b){if(_0x757c0b){var _0x180627=_0x757c0b['count'],_0x6fb173=_0x136788[_0xdf9f('0x19')],_0x4bac62=_0x136788[_0xdf9f('0x19')]+_0x136788[_0xdf9f('0x1a')],_0x33e541;if(_0x4bac62>=_0x180627){_0x4bac62=_0x180627;_0x33e541=0xc8;}else{_0x33e541=0xce;}_0x5834cb[_0xdf9f('0x16')](_0x33e541);return _0x5834cb['set'](_0xdf9f('0x1b'),_0x6fb173+'-'+_0x4bac62+'/'+_0x180627)['json'](_0x757c0b);}return null;};}function patchUpdates(_0x3ee1fc){return function(_0x22277a){try{jsonpatch[_0xdf9f('0x1c')](_0x22277a,_0x3ee1fc,!![]);}catch(_0x3786a9){return BPromise[_0xdf9f('0x1d')](_0x3786a9);}return _0x22277a[_0xdf9f('0x1e')]();};}function saveUpdates(_0x3ff17d,_0x483f7d){return function(_0xb00a11){if(_0xb00a11){return _0xb00a11[_0xdf9f('0x1f')](_0x3ff17d)['then'](function(_0x24398d){return _0x24398d;});}return null;};}function removeEntity(_0x588bcd,_0x3cde3e){return function(_0x6107bd){if(_0x6107bd){return _0x6107bd[_0xdf9f('0x20')]()[_0xdf9f('0x21')](function(){_0x588bcd[_0xdf9f('0x16')](0xcc)[_0xdf9f('0x17')]();});}};}function handleEntityNotFound(_0x569600,_0x484bd9){return function(_0x382cd5){if(!_0x382cd5){_0x569600[_0xdf9f('0x22')](0x194);}return _0x382cd5;};}function handleError(_0xcb66a8,_0x46301f){_0x46301f=_0x46301f||0x1f4;return function(_0x475853){logger[_0xdf9f('0x23')](_0x475853[_0xdf9f('0x24')]);if(_0x475853[_0xdf9f('0x25')]){delete _0x475853['name'];}_0xcb66a8[_0xdf9f('0x16')](_0x46301f)['send'](_0x475853);};}exports[_0xdf9f('0x26')]=function(_0x74ccfa,_0x3b61ca){var _0x2955b5={},_0x57b516={},_0x495c0b={'count':0x0,'rows':[]};var _0x140a8e=_[_0xdf9f('0x27')](db[_0xdf9f('0x28')]['rawAttributes'],function(_0x3dc6f0){return{'name':_0x3dc6f0[_0xdf9f('0x29')],'type':_0x3dc6f0[_0xdf9f('0x2a')]['key']};});_0x57b516[_0xdf9f('0x2b')]=_['map'](_0x140a8e,_0xdf9f('0x25'));_0x57b516[_0xdf9f('0x2c')]=_[_0xdf9f('0x2d')](_0x74ccfa[_0xdf9f('0x2c')]);_0x57b516['filters']=_[_0xdf9f('0x2e')](_0x57b516['model'],_0x57b516[_0xdf9f('0x2c')]);_0x2955b5[_0xdf9f('0x2f')]=_['intersection'](_0x57b516[_0xdf9f('0x2b')],qs[_0xdf9f('0x30')](_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x30')]));_0x2955b5['attributes']=_0x2955b5[_0xdf9f('0x2f')]['length']?_0x2955b5['attributes']:_0x57b516[_0xdf9f('0x2b')];if(!_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x31')]('nolimit')){_0x2955b5[_0xdf9f('0x1a')]=qs['limit'](_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x1a')]);_0x2955b5['offset']=qs[_0xdf9f('0x19')](_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x19')]);}_0x2955b5[_0xdf9f('0x32')]=qs[_0xdf9f('0x33')](_0x74ccfa[_0xdf9f('0x2c')]['sort']);_0x2955b5[_0xdf9f('0x34')]=qs[_0xdf9f('0x35')](_[_0xdf9f('0x36')](_0x74ccfa[_0xdf9f('0x2c')],_0x57b516[_0xdf9f('0x35')]),_0x140a8e);if(_0x74ccfa[_0xdf9f('0x2c')]['filter']){_0x2955b5[_0xdf9f('0x34')]=_[_0xdf9f('0x37')](_0x2955b5['where'],{'$or':_['map'](_0x140a8e,function(_0x4c17f3){if(_0x4c17f3[_0xdf9f('0x2a')]!==_0xdf9f('0x38')){var _0x4b5c1b={};_0x4b5c1b[_0x4c17f3[_0xdf9f('0x25')]]={'$like':'%'+_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x39')]+'%'};return _0x4b5c1b;}})});}_0x2955b5=_['merge']({},_0x2955b5,_0x74ccfa[_0xdf9f('0x3a')]);var _0x24f6e={'where':_0x2955b5[_0xdf9f('0x34')]};return db[_0xdf9f('0x28')]['count'](_0x24f6e)['then'](function(_0x10b76c){_0x495c0b[_0xdf9f('0x3b')]=_0x10b76c;if(_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x3c')]){_0x2955b5[_0xdf9f('0x3d')]=[{'all':!![]}];}return db[_0xdf9f('0x28')][_0xdf9f('0x3e')](_0x2955b5);})[_0xdf9f('0x21')](function(_0x248eb3){_0x495c0b[_0xdf9f('0x3f')]=_0x248eb3;return _0x495c0b;})[_0xdf9f('0x21')](respondWithFilteredResult(_0x3b61ca,_0x2955b5))[_0xdf9f('0x40')](handleError(_0x3b61ca,null));};exports['show']=function(_0x17c4df,_0x2dbcf0){var _0x3315c5={'raw':!![],'where':{'id':_0x17c4df['params']['id']}},_0x17d00f={};_0x17d00f[_0xdf9f('0x2b')]=_[_0xdf9f('0x2d')](db[_0xdf9f('0x28')][_0xdf9f('0x41')]);_0x17d00f[_0xdf9f('0x2c')]=_[_0xdf9f('0x2d')](_0x17c4df['query']);_0x17d00f['filters']=_[_0xdf9f('0x2e')](_0x17d00f[_0xdf9f('0x2b')],_0x17d00f[_0xdf9f('0x2c')]);_0x3315c5[_0xdf9f('0x2f')]=_[_0xdf9f('0x2e')](_0x17d00f[_0xdf9f('0x2b')],qs[_0xdf9f('0x30')](_0x17c4df[_0xdf9f('0x2c')][_0xdf9f('0x30')]));_0x3315c5[_0xdf9f('0x2f')]=_0x3315c5['attributes'][_0xdf9f('0x42')]?_0x3315c5[_0xdf9f('0x2f')]:_0x17d00f[_0xdf9f('0x2b')];if(_0x17c4df[_0xdf9f('0x2c')][_0xdf9f('0x3c')]){_0x3315c5['include']=[{'all':!![]}];}_0x3315c5=_[_0xdf9f('0x37')]({},_0x3315c5,_0x17c4df['options']);return db[_0xdf9f('0x28')][_0xdf9f('0x43')](_0x3315c5)[_0xdf9f('0x21')](handleEntityNotFound(_0x2dbcf0,null))[_0xdf9f('0x21')](respondWithResult(_0x2dbcf0,null))['catch'](handleError(_0x2dbcf0,null));};exports[_0xdf9f('0x44')]=function(_0x13ae1f,_0x455e21){return db['VoiceDialReport'][_0xdf9f('0x44')](_0x13ae1f[_0xdf9f('0x45')],{})[_0xdf9f('0x21')](respondWithResult(_0x455e21,0xc9))[_0xdf9f('0x40')](handleError(_0x455e21,null));};exports['update']=function(_0x4eeee3,_0x4aa0ad){if(_0x4eeee3[_0xdf9f('0x45')]['id']){delete _0x4eeee3['body']['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x4eeee3[_0xdf9f('0x46')]['id']}})[_0xdf9f('0x21')](handleEntityNotFound(_0x4aa0ad,null))[_0xdf9f('0x21')](saveUpdates(_0x4eeee3['body'],null))[_0xdf9f('0x21')](respondWithResult(_0x4aa0ad,null))[_0xdf9f('0x40')](handleError(_0x4aa0ad,null));};exports[_0xdf9f('0x20')]=function(_0x17708f,_0x506a46){return db['VoiceDialReport']['find']({'where':{'id':_0x17708f[_0xdf9f('0x46')]['id']}})[_0xdf9f('0x21')](handleEntityNotFound(_0x506a46,null))['then'](removeEntity(_0x506a46,null))[_0xdf9f('0x40')](handleError(_0x506a46,null));};exports['describe']=function(_0xf36b52,_0x3aff8e){return db[_0xdf9f('0x28')][_0xdf9f('0x47')]()[_0xdf9f('0x21')](respondWithResult(_0x3aff8e,null))[_0xdf9f('0x40')](handleError(_0x3aff8e,null));}; \ No newline at end of file +var _0x0694=['destroy','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','limit','sort','where','filters','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','length','options','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../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','save','update'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0x0694,0x183));var _0x4069=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x0694[_0x18a436];return _0x5c2cf8;};'use strict';var pdf=require(_0x4069('0x0'));var emlformat=require(_0x4069('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4069('0x2'));var jsonpatch=require(_0x4069('0x3'));var rp=require('request-promise');var moment=require(_0x4069('0x4'));var BPromise=require(_0x4069('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4069('0x6'));var sox=require(_0x4069('0x7'));var csv=require(_0x4069('0x8'));var ejs=require(_0x4069('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4069('0xa'));var crypto=require(_0x4069('0xb'));var jsforce=require(_0x4069('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4069('0xd'));var Papa=require(_0x4069('0xe'));var Redis=require('ioredis');var authService=require(_0x4069('0xf'));var qs=require(_0x4069('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4069('0x11'));var logger=require(_0x4069('0x12'))(_0x4069('0x13'));var utils=require(_0x4069('0x14'));var config=require(_0x4069('0x15'));var db=require(_0x4069('0x16'))['db'];function respondWithStatusCode(_0x3bfdd3,_0x21e7b7){_0x21e7b7=_0x21e7b7||0xcc;return function(_0x45aeb1){if(_0x45aeb1){return _0x3bfdd3[_0x4069('0x17')](_0x21e7b7);}return _0x3bfdd3[_0x4069('0x18')](_0x21e7b7)[_0x4069('0x19')]();};}function respondWithResult(_0x9f74c6,_0x131cba){_0x131cba=_0x131cba||0xc8;return function(_0x4d35fd){if(_0x4d35fd){return _0x9f74c6[_0x4069('0x18')](_0x131cba)[_0x4069('0x1a')](_0x4d35fd);}};}function respondWithFilteredResult(_0x3b06ee,_0x215ce7){return function(_0x4e82fc){if(_0x4e82fc){var _0x1d5f81=_0x4e82fc[_0x4069('0x1b')],_0x15323d=_0x215ce7[_0x4069('0x1c')],_0x33d695=_0x215ce7[_0x4069('0x1c')]+_0x215ce7['limit'],_0x5d085a;if(_0x33d695>=_0x1d5f81){_0x33d695=_0x1d5f81;_0x5d085a=0xc8;}else{_0x5d085a=0xce;}_0x3b06ee[_0x4069('0x18')](_0x5d085a);return _0x3b06ee[_0x4069('0x1d')](_0x4069('0x1e'),_0x15323d+'-'+_0x33d695+'/'+_0x1d5f81)[_0x4069('0x1a')](_0x4e82fc);}return null;};}function patchUpdates(_0x21c441){return function(_0x4f4bd0){try{jsonpatch['apply'](_0x4f4bd0,_0x21c441,!![]);}catch(_0x2a888d){return BPromise['reject'](_0x2a888d);}return _0x4f4bd0[_0x4069('0x1f')]();};}function saveUpdates(_0x10327d,_0x38c29c){return function(_0x284585){if(_0x284585){return _0x284585[_0x4069('0x20')](_0x10327d)['then'](function(_0x58809a){return _0x58809a;});}return null;};}function removeEntity(_0x2b9443,_0x49532a){return function(_0x859439){if(_0x859439){return _0x859439[_0x4069('0x21')]()['then'](function(){_0x2b9443[_0x4069('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d84d8,_0x34a71b){return function(_0x524b68){if(!_0x524b68){_0x5d84d8[_0x4069('0x17')](0x194);}return _0x524b68;};}function handleError(_0x1a420e,_0xe7ef14){_0xe7ef14=_0xe7ef14||0x1f4;return function(_0x575f55){logger[_0x4069('0x22')](_0x575f55[_0x4069('0x23')]);if(_0x575f55[_0x4069('0x24')]){delete _0x575f55['name'];}_0x1a420e[_0x4069('0x18')](_0xe7ef14)['send'](_0x575f55);};}exports[_0x4069('0x25')]=function(_0x4abcfc,_0x59f99a){var _0x52fcd5={},_0x338db1={},_0x54204b={'count':0x0,'rows':[]};var _0x43683b=_[_0x4069('0x26')](db[_0x4069('0x27')][_0x4069('0x28')],function(_0x13087c){return{'name':_0x13087c[_0x4069('0x29')],'type':_0x13087c['type'][_0x4069('0x2a')]};});_0x338db1[_0x4069('0x2b')]=_[_0x4069('0x26')](_0x43683b,_0x4069('0x24'));_0x338db1['query']=_[_0x4069('0x2c')](_0x4abcfc[_0x4069('0x2d')]);_0x338db1['filters']=_[_0x4069('0x2e')](_0x338db1[_0x4069('0x2b')],_0x338db1[_0x4069('0x2d')]);_0x52fcd5[_0x4069('0x2f')]=_[_0x4069('0x2e')](_0x338db1['model'],qs[_0x4069('0x30')](_0x4abcfc['query'][_0x4069('0x30')]));_0x52fcd5[_0x4069('0x2f')]=_0x52fcd5['attributes']['length']?_0x52fcd5[_0x4069('0x2f')]:_0x338db1['model'];if(!_0x4abcfc[_0x4069('0x2d')]['hasOwnProperty']('nolimit')){_0x52fcd5[_0x4069('0x31')]=qs[_0x4069('0x31')](_0x4abcfc[_0x4069('0x2d')][_0x4069('0x31')]);_0x52fcd5[_0x4069('0x1c')]=qs[_0x4069('0x1c')](_0x4abcfc['query'][_0x4069('0x1c')]);}_0x52fcd5['order']=qs[_0x4069('0x32')](_0x4abcfc[_0x4069('0x2d')]['sort']);_0x52fcd5[_0x4069('0x33')]=qs[_0x4069('0x34')](_[_0x4069('0x35')](_0x4abcfc[_0x4069('0x2d')],_0x338db1[_0x4069('0x34')]),_0x43683b);if(_0x4abcfc[_0x4069('0x2d')][_0x4069('0x36')]){_0x52fcd5[_0x4069('0x33')]=_[_0x4069('0x37')](_0x52fcd5[_0x4069('0x33')],{'$or':_[_0x4069('0x26')](_0x43683b,function(_0x146f4d){if(_0x146f4d['type']!==_0x4069('0x38')){var _0x33d784={};_0x33d784[_0x146f4d[_0x4069('0x24')]]={'$like':'%'+_0x4abcfc[_0x4069('0x2d')][_0x4069('0x36')]+'%'};return _0x33d784;}})});}_0x52fcd5=_['merge']({},_0x52fcd5,_0x4abcfc['options']);var _0x24eaa1={'where':_0x52fcd5['where']};return db['VoiceDialReport'][_0x4069('0x1b')](_0x24eaa1)[_0x4069('0x39')](function(_0x361907){_0x54204b['count']=_0x361907;if(_0x4abcfc[_0x4069('0x2d')][_0x4069('0x3a')]){_0x52fcd5[_0x4069('0x3b')]=[{'all':!![]}];}return db[_0x4069('0x27')]['findAll'](_0x52fcd5);})[_0x4069('0x39')](function(_0x3cd116){_0x54204b[_0x4069('0x3c')]=_0x3cd116;return _0x54204b;})[_0x4069('0x39')](respondWithFilteredResult(_0x59f99a,_0x52fcd5))[_0x4069('0x3d')](handleError(_0x59f99a,null));};exports[_0x4069('0x3e')]=function(_0xffc807,_0x32837e){var _0x1522d1={'raw':!![],'where':{'id':_0xffc807['params']['id']}},_0x194bb8={};_0x194bb8[_0x4069('0x2b')]=_[_0x4069('0x2c')](db[_0x4069('0x27')][_0x4069('0x28')]);_0x194bb8['query']=_['keys'](_0xffc807[_0x4069('0x2d')]);_0x194bb8[_0x4069('0x34')]=_[_0x4069('0x2e')](_0x194bb8['model'],_0x194bb8['query']);_0x1522d1['attributes']=_['intersection'](_0x194bb8['model'],qs[_0x4069('0x30')](_0xffc807[_0x4069('0x2d')][_0x4069('0x30')]));_0x1522d1['attributes']=_0x1522d1['attributes'][_0x4069('0x3f')]?_0x1522d1[_0x4069('0x2f')]:_0x194bb8[_0x4069('0x2b')];if(_0xffc807['query'][_0x4069('0x3a')]){_0x1522d1[_0x4069('0x3b')]=[{'all':!![]}];}_0x1522d1=_[_0x4069('0x37')]({},_0x1522d1,_0xffc807[_0x4069('0x40')]);return db[_0x4069('0x27')][_0x4069('0x41')](_0x1522d1)['then'](handleEntityNotFound(_0x32837e,null))['then'](respondWithResult(_0x32837e,null))['catch'](handleError(_0x32837e,null));};exports[_0x4069('0x42')]=function(_0x503ce1,_0x3a6dc7){return db[_0x4069('0x27')][_0x4069('0x42')](_0x503ce1[_0x4069('0x43')],{})['then'](respondWithResult(_0x3a6dc7,0xc9))[_0x4069('0x3d')](handleError(_0x3a6dc7,null));};exports[_0x4069('0x20')]=function(_0x54e96b,_0x37c34a){if(_0x54e96b[_0x4069('0x43')]['id']){delete _0x54e96b['body']['id'];}return db[_0x4069('0x27')][_0x4069('0x41')]({'where':{'id':_0x54e96b[_0x4069('0x44')]['id']}})[_0x4069('0x39')](handleEntityNotFound(_0x37c34a,null))[_0x4069('0x39')](saveUpdates(_0x54e96b[_0x4069('0x43')],null))[_0x4069('0x39')](respondWithResult(_0x37c34a,null))['catch'](handleError(_0x37c34a,null));};exports[_0x4069('0x21')]=function(_0x16690e,_0xa50f25){return db[_0x4069('0x27')]['find']({'where':{'id':_0x16690e[_0x4069('0x44')]['id']}})['then'](handleEntityNotFound(_0xa50f25,null))[_0x4069('0x39')](removeEntity(_0xa50f25,null))[_0x4069('0x3d')](handleError(_0xa50f25,null));};exports[_0x4069('0x45')]=function(_0xad51f7,_0x847007){return db[_0x4069('0x27')][_0x4069('0x45')]()[_0x4069('0x39')](respondWithResult(_0x847007,null))[_0x4069('0x3d')](handleError(_0x847007,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9b3f5bf..e513cfa 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 _0xc66c=['path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x1b8a76,_0x4ffd3b){var _0xb115bf=function(_0x59179d){while(--_0x59179d){_0x1b8a76['push'](_0x1b8a76['shift']());}};_0xb115bf(++_0x4ffd3b);}(_0xc66c,0x181));var _0xcc66=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc66c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xcc66('0x0'));var util=require(_0xcc66('0x1'));var logger=require(_0xcc66('0x2'))(_0xcc66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc66('0x4'));var fs=require('fs');var path=require(_0xcc66('0x5'));var rimraf=require(_0xcc66('0x6'));var config=require(_0xcc66('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xcc66('0x8')]=function(_0x5dea4b,_0x2e61bb){return _0x5dea4b[_0xcc66('0x9')](_0xcc66('0xa'),attributes,{'tableName':_0xcc66('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcc66('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5a2=['define','VoiceDialReport','report_dial','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xd5a2,0x12a));var _0x2d5a=function(_0x2f650a,_0x498dbc){_0x2f650a=_0x2f650a-0x0;var _0x470f81=_0xd5a2[_0x2f650a];return _0x470f81;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d5a('0x0'))(_0x2d5a('0x1'));var moment=require(_0x2d5a('0x2'));var BPromise=require(_0x2d5a('0x3'));var rp=require(_0x2d5a('0x4'));var fs=require('fs');var path=require(_0x2d5a('0x5'));var rimraf=require(_0x2d5a('0x6'));var config=require(_0x2d5a('0x7'));var attributes=require(_0x2d5a('0x8'));module[_0x2d5a('0x9')]=function(_0x3ed8a4,_0x4b23e2){return _0x3ed8a4[_0x2d5a('0xa')](_0x2d5a('0xb'),attributes,{'tableName':_0x2d5a('0xc'),'paranoid':![],'indexes':[{'fields':[_0x2d5a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 3e92b37..1312e1a 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 _0xbb95=['catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','where','attributes','lodash','util','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3ff235,_0x428b4d){var _0x409302=function(_0x4ef822){while(--_0x4ef822){_0x3ff235['push'](_0x3ff235['shift']());}};_0x409302(++_0x428b4d);}(_0xbb95,0x7f));var _0x5bb9=function(_0x4f2b48,_0x4ca75a){_0x4f2b48=_0x4f2b48-0x0;var _0x44015c=_0xbb95[_0x4f2b48];return _0x44015c;};'use strict';var _=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bb9('0x2'));var fs=require('fs');var Redis=require(_0x5bb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5bb9('0x5'));var client=jayson[_0x5bb9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180e69,_0x123a6a,_0x39f347){return new BPromise(function(_0x5e8b1c,_0x95777c){return client[_0x5bb9('0x7')](_0x180e69,_0x39f347)[_0x5bb9('0x8')](function(_0x267319){logger[_0x5bb9('0x9')](_0x5bb9('0xa'),_0x123a6a,_0x5bb9('0xb'));logger[_0x5bb9('0xc')](_0x5bb9('0xd'),_0x123a6a,_0x5bb9('0xb'),JSON['stringify'](_0x267319));if(_0x267319['error']){if(_0x267319[_0x5bb9('0xe')][_0x5bb9('0xf')]===0x1f4){logger[_0x5bb9('0xe')](_0x5bb9('0xa'),_0x123a6a,_0x267319[_0x5bb9('0xe')][_0x5bb9('0x10')]);return _0x95777c(_0x267319[_0x5bb9('0xe')]['message']);}logger['error'](_0x5bb9('0xa'),_0x123a6a,_0x267319[_0x5bb9('0xe')][_0x5bb9('0x10')]);return _0x5e8b1c(_0x267319['error'][_0x5bb9('0x10')]);}else{logger[_0x5bb9('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x123a6a,_0x5bb9('0xb'));_0x5e8b1c(_0x267319[_0x5bb9('0x11')][_0x5bb9('0x10')]);}})[_0x5bb9('0x12')](function(_0x119092){logger[_0x5bb9('0xe')](_0x5bb9('0xa'),_0x123a6a,_0x119092);_0x95777c(_0x119092);});});}exports['CreateVoiceDialReport']=function(_0x16b7ab){var _0x56c337=this;return new Promise(function(_0xecb76c,_0x54dcd4){return db[_0x5bb9('0x13')]['create'](_0x16b7ab[_0x5bb9('0x14')],{'raw':_0x16b7ab[_0x5bb9('0x15')]?_0x16b7ab[_0x5bb9('0x15')][_0x5bb9('0x16')]===undefined?!![]:![]:!![]})[_0x5bb9('0x8')](function(_0x2c9b5e){logger[_0x5bb9('0x9')](_0x5bb9('0x17'),_0x16b7ab);logger[_0x5bb9('0xc')]('CreateVoiceDialReport',_0x16b7ab,JSON[_0x5bb9('0x18')](_0x2c9b5e));_0xecb76c(_0x2c9b5e);})['catch'](function(_0x1949c1){logger[_0x5bb9('0xe')]('CreateVoiceDialReport',_0x1949c1[_0x5bb9('0x10')],_0x16b7ab);_0x54dcd4(_0x56c337[_0x5bb9('0xe')](0x1f4,_0x1949c1['message']));});});};exports[_0x5bb9('0x19')]=function(_0x48c553){var _0x2de62c=this;return new Promise(function(_0x4db9ae,_0x4909ea){return db[_0x5bb9('0x13')][_0x5bb9('0x1a')](_0x48c553[_0x5bb9('0x14')],{'raw':_0x48c553[_0x5bb9('0x15')]?_0x48c553[_0x5bb9('0x15')][_0x5bb9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48c553[_0x5bb9('0x15')]?_0x48c553['options'][_0x5bb9('0x1b')]||null:null,'attributes':_0x48c553[_0x5bb9('0x15')]?_0x48c553['options'][_0x5bb9('0x1c')]||null:null,'limit':_0x48c553[_0x5bb9('0x15')]?_0x48c553[_0x5bb9('0x15')]['limit']||null:null})['then'](function(_0x10f2b9){logger[_0x5bb9('0x9')]('UpdateVoiceDialReport',_0x48c553);logger[_0x5bb9('0xc')](_0x5bb9('0x19'),_0x48c553,JSON[_0x5bb9('0x18')](_0x10f2b9));_0x4db9ae(_0x10f2b9);})[_0x5bb9('0x12')](function(_0x4d9902){logger['error']('UpdateVoiceDialReport',_0x4d9902['message'],_0x48c553);_0x4909ea(_0x2de62c['error'](0x1f4,_0x4d9902[_0x5bb9('0x10')]));});});}; \ No newline at end of file +var _0x6597=['info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','update','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3606e6,_0x2c6856){var _0x41be0d=function(_0x542887){while(--_0x542887){_0x3606e6['push'](_0x3606e6['shift']());}};_0x41be0d(++_0x2c6856);}(_0x6597,0x16e));var _0x7659=function(_0xe61ee6,_0xbc6de2){_0xe61ee6=_0xe61ee6-0x0;var _0x25e82e=_0x6597[_0xe61ee6];return _0x25e82e;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var moment=require(_0x7659('0x2'));var BPromise=require('bluebird');var rs=require(_0x7659('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7659('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7659('0x5'));var jayson=require(_0x7659('0x6'));var client=jayson[_0x7659('0x7')][_0x7659('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11cb28,_0x5c4e7f,_0x5ae101){return new BPromise(function(_0x3cfb33,_0x361918){return client[_0x7659('0x9')](_0x11cb28,_0x5ae101)[_0x7659('0xa')](function(_0x597553){logger[_0x7659('0xb')](_0x7659('0xc'),_0x5c4e7f,'request\x20sent');logger[_0x7659('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5c4e7f,_0x7659('0xe'),JSON['stringify'](_0x597553));if(_0x597553[_0x7659('0xf')]){if(_0x597553[_0x7659('0xf')]['code']===0x1f4){logger[_0x7659('0xf')](_0x7659('0xc'),_0x5c4e7f,_0x597553['error'][_0x7659('0x10')]);return _0x361918(_0x597553['error']['message']);}logger[_0x7659('0xf')](_0x7659('0xc'),_0x5c4e7f,_0x597553[_0x7659('0xf')][_0x7659('0x10')]);return _0x3cfb33(_0x597553[_0x7659('0xf')]['message']);}else{logger['info'](_0x7659('0xc'),_0x5c4e7f,_0x7659('0xe'));_0x3cfb33(_0x597553[_0x7659('0x11')][_0x7659('0x10')]);}})[_0x7659('0x12')](function(_0x26a0f0){logger['error'](_0x7659('0xc'),_0x5c4e7f,_0x26a0f0);_0x361918(_0x26a0f0);});});}exports[_0x7659('0x13')]=function(_0x471b17){var _0x2f1e6c=this;return new Promise(function(_0x100953,_0x201fee){return db[_0x7659('0x14')][_0x7659('0x15')](_0x471b17[_0x7659('0x16')],{'raw':_0x471b17[_0x7659('0x17')]?_0x471b17[_0x7659('0x17')][_0x7659('0x18')]===undefined?!![]:![]:!![]})[_0x7659('0xa')](function(_0x25704c){logger[_0x7659('0xb')]('CreateVoiceDialReport',_0x471b17);logger[_0x7659('0xd')](_0x7659('0x13'),_0x471b17,JSON[_0x7659('0x19')](_0x25704c));_0x100953(_0x25704c);})[_0x7659('0x12')](function(_0x5a491d){logger['error'](_0x7659('0x13'),_0x5a491d[_0x7659('0x10')],_0x471b17);_0x201fee(_0x2f1e6c[_0x7659('0xf')](0x1f4,_0x5a491d['message']));});});};exports[_0x7659('0x1a')]=function(_0x2362ba){var _0x1824b0=this;return new Promise(function(_0x511636,_0x3cdb78){return db[_0x7659('0x14')][_0x7659('0x1b')](_0x2362ba[_0x7659('0x16')],{'raw':_0x2362ba[_0x7659('0x17')]?_0x2362ba[_0x7659('0x17')][_0x7659('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2362ba[_0x7659('0x17')]?_0x2362ba[_0x7659('0x17')]['where']||null:null,'attributes':_0x2362ba[_0x7659('0x17')]?_0x2362ba[_0x7659('0x17')]['attributes']||null:null,'limit':_0x2362ba[_0x7659('0x17')]?_0x2362ba['options'][_0x7659('0x1c')]||null:null})[_0x7659('0xa')](function(_0x28311e){logger['info'](_0x7659('0x1a'),_0x2362ba);logger[_0x7659('0xd')](_0x7659('0x1a'),_0x2362ba,JSON[_0x7659('0x19')](_0x28311e));_0x511636(_0x28311e);})[_0x7659('0x12')](function(_0x2b9602){logger[_0x7659('0xf')]('UpdateVoiceDialReport',_0x2b9602['message'],_0x2362ba);_0x3cdb78(_0x1824b0[_0x7659('0xf')](0x1f4,_0x2b9602[_0x7659('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7cc4a24..a90485b 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 _0x9931=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x9931,0x1b6));var _0x1993=function(_0x22219c,_0x54f875){_0x22219c=_0x22219c-0x0;var _0x27c3f7=_0x9931[_0x22219c];return _0x27c3f7;};'use strict';var multer=require('multer');var util=require(_0x1993('0x0'));var path=require('path');var timeout=require(_0x1993('0x1'));var express=require(_0x1993('0x2'));var router=express[_0x1993('0x3')]();var auth=require(_0x1993('0x4'));var interaction=require(_0x1993('0x5'));var config=require(_0x1993('0x6'));var controller=require(_0x1993('0x7'));router[_0x1993('0x8')]('/',auth[_0x1993('0x9')](),controller[_0x1993('0xa')]);router[_0x1993('0x8')](_0x1993('0xb'),auth[_0x1993('0x9')](),controller[_0x1993('0xc')]);router[_0x1993('0xd')]('/',auth[_0x1993('0x9')](),controller[_0x1993('0xe')]);router['post']('/:id/applications',auth[_0x1993('0x9')](),controller[_0x1993('0xf')]);router[_0x1993('0x10')](_0x1993('0xb'),auth[_0x1993('0x9')](),controller[_0x1993('0x11')]);router[_0x1993('0x12')](_0x1993('0xb'),auth[_0x1993('0x9')](),controller[_0x1993('0x13')]);module[_0x1993('0x14')]=router; \ No newline at end of file +var _0x0b6a=['get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x3ba79c,_0x1547d2){var _0xd2d1a4=function(_0x429fd1){while(--_0x429fd1){_0x3ba79c['push'](_0x3ba79c['shift']());}};_0xd2d1a4(++_0x1547d2);}(_0x0b6a,0x138));var _0xa0b6=function(_0x496fc2,_0x2af414){_0x496fc2=_0x496fc2-0x0;var _0x3c16a1=_0x0b6a[_0x496fc2];return _0x3c16a1;};'use strict';var multer=require(_0xa0b6('0x0'));var util=require(_0xa0b6('0x1'));var path=require(_0xa0b6('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0b6('0x3'));var router=express[_0xa0b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa0b6('0x5'));var config=require(_0xa0b6('0x6'));var controller=require(_0xa0b6('0x7'));router[_0xa0b6('0x8')]('/',auth[_0xa0b6('0x9')](),controller[_0xa0b6('0xa')]);router[_0xa0b6('0x8')](_0xa0b6('0xb'),auth[_0xa0b6('0x9')](),controller[_0xa0b6('0xc')]);router[_0xa0b6('0xd')]('/',auth['isAuthenticated'](),controller[_0xa0b6('0xe')]);router[_0xa0b6('0xd')](_0xa0b6('0xf'),auth[_0xa0b6('0x9')](),controller[_0xa0b6('0x10')]);router['put']('/:id',auth[_0xa0b6('0x9')](),controller['update']);router[_0xa0b6('0x11')](_0xa0b6('0xb'),auth[_0xa0b6('0x9')](),controller[_0xa0b6('0x12')]);module[_0xa0b6('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 efde30b..22c917a 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(_0x41173e,_0x233978){var _0x103b99=function(_0x785ea8){while(--_0x785ea8){_0x41173e['push'](_0x41173e['shift']());}};_0x103b99(++_0x233978);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x221a48,_0x33c154){var _0xdadcb3=function(_0x5ade41){while(--_0x5ade41){_0x221a48['push'](_0x221a48['shift']());}};_0xdadcb3(++_0x33c154);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 d71175f..2c95436 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 _0xda2d=['nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','merge','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','InboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','then','stack','send','index','VoiceExtension','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda2d,0x102));var _0xdda2=function(_0x3d75d1,_0x252be9){_0x3d75d1=_0x3d75d1-0x0;var _0x415f69=_0xda2d[_0x3d75d1];return _0x415f69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xdda2('0x19')],{'host':_0xdda2('0x1a'),'port':0x18eb});var socket=require(_0xdda2('0x1b'))(new Redis(config[_0xdda2('0x19')]));require(_0xdda2('0x1c'))[_0xdda2('0x1d')](socket);function respondWithStatusCode(_0x3490f1,_0x4df902){_0x4df902=_0x4df902||0xcc;return function(_0x79c6d4){if(_0x79c6d4){return _0x3490f1['sendStatus'](_0x4df902);}return _0x3490f1[_0xdda2('0x1e')](_0x4df902)[_0xdda2('0x1f')]();};}function respondWithResult(_0x3553d5,_0x457764){_0x457764=_0x457764||0xc8;return function(_0x1922b1){if(_0x1922b1){return _0x3553d5['status'](_0x457764)['json'](_0x1922b1);}};}function respondWithFilteredResult(_0x43f67b,_0x518c6d){return function(_0x1a5192){if(_0x1a5192){var _0x1a3b35=_0x1a5192[_0xdda2('0x20')],_0x335fb5=_0x518c6d[_0xdda2('0x21')],_0x2b6ee8=_0x518c6d[_0xdda2('0x21')]+_0x518c6d[_0xdda2('0x22')],_0x8d44b7;if(_0x2b6ee8>=_0x1a3b35){_0x2b6ee8=_0x1a3b35;_0x8d44b7=0xc8;}else{_0x8d44b7=0xce;}_0x43f67b[_0xdda2('0x1e')](_0x8d44b7);return _0x43f67b[_0xdda2('0x23')](_0xdda2('0x24'),_0x335fb5+'-'+_0x2b6ee8+'/'+_0x1a3b35)['json'](_0x1a5192);}return null;};}function patchUpdates(_0x41fe7d){return function(_0x5dfce7){try{jsonpatch[_0xdda2('0x25')](_0x5dfce7,_0x41fe7d,!![]);}catch(_0x1a4db4){return BPromise[_0xdda2('0x26')](_0x1a4db4);}return _0x5dfce7['save']();};}function saveUpdates(_0x347ee6,_0x5a9bb8){return function(_0x425489){if(_0x425489){return _0x425489[_0xdda2('0x27')](_0x347ee6)['then'](function(_0x144f1e){return _0x144f1e;});}return null;};}function removeEntity(_0xfda248,_0x2528d7){return function(_0x13b0f3){if(_0x13b0f3){return _0x13b0f3[_0xdda2('0x28')]()['then'](function(){var _0x38cdf=_0x13b0f3[_0xdda2('0x29')]({'plain':!![]});var _0x2391a5=[{'name':_0xdda2('0x2a'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xdda2('0x2b'),'ignore':![]},{'name':_0xdda2('0x2c'),'value':_0xdda2('0x2d'),'ignore':![]}];var _0x5e9e74=_(_0x2391a5)[_0xdda2('0x2e')](_0xdda2('0x2f'))[_0xdda2('0x30')](_0xdda2('0x31'))[_0xdda2('0x31')]();if(_[_0xdda2('0x32')](_0x5e9e74,_0x38cdf['type'])){return;}var _0x24c37d=_[_0xdda2('0x33')](_0x2391a5,['value',_0x38cdf[_0xdda2('0x34')]])[_0xdda2('0x35')];return db[_0xdda2('0x36')][_0xdda2('0x28')]({'where':{'type':_0x24c37d,'resourceId':_0x38cdf['id']}})['then'](function(){return _0x13b0f3;});})[_0xdda2('0x37')](function(){_0xfda248[_0xdda2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca9f3,_0x5edf7e){return function(_0x2b8cd6){if(!_0x2b8cd6){_0x1ca9f3['sendStatus'](0x194);}return _0x2b8cd6;};}function handleError(_0x53ff76,_0x510b7b){_0x510b7b=_0x510b7b||0x1f4;return function(_0x239c25){logger['error'](_0x239c25[_0xdda2('0x38')]);if(_0x239c25['name']){delete _0x239c25['name'];}_0x53ff76['status'](_0x510b7b)[_0xdda2('0x39')](_0x239c25);};}exports[_0xdda2('0x3a')]=function(_0xca6046,_0x2fd592){var _0x12e96d={},_0x644a24={},_0x2bcfba={'count':0x0,'rows':[]};var _0x1426fd=_[_0xdda2('0x30')](db[_0xdda2('0x3b')]['rawAttributes'],function(_0x461621){return{'name':_0x461621[_0xdda2('0x3c')],'type':_0x461621[_0xdda2('0x34')][_0xdda2('0x3d')]};});_0x644a24[_0xdda2('0x3e')]=_[_0xdda2('0x30')](_0x1426fd,_0xdda2('0x35'));_0x644a24['query']=_['keys'](_0xca6046[_0xdda2('0x3f')]);_0x644a24[_0xdda2('0x40')]=_[_0xdda2('0x41')](_0x644a24['model'],_0x644a24['query']);_0x12e96d[_0xdda2('0x42')]=_[_0xdda2('0x41')](_0x644a24[_0xdda2('0x3e')],qs[_0xdda2('0x43')](_0xca6046[_0xdda2('0x3f')]['fields']));_0x12e96d[_0xdda2('0x42')]=_0x12e96d[_0xdda2('0x42')]['length']?_0x12e96d['attributes']:_0x644a24[_0xdda2('0x3e')];if(!_0xca6046[_0xdda2('0x3f')][_0xdda2('0x44')](_0xdda2('0x45'))){_0x12e96d[_0xdda2('0x22')]=qs['limit'](_0xca6046[_0xdda2('0x3f')][_0xdda2('0x22')]);_0x12e96d[_0xdda2('0x21')]=qs[_0xdda2('0x21')](_0xca6046['query']['offset']);}_0x12e96d[_0xdda2('0x46')]=qs[_0xdda2('0x47')](_0xca6046[_0xdda2('0x3f')]['sort']);_0x12e96d[_0xdda2('0x48')]=qs['filters'](_[_0xdda2('0x49')](_0xca6046['query'],_0x644a24[_0xdda2('0x40')]),_0x1426fd);if(_0xca6046[_0xdda2('0x3f')][_0xdda2('0x2e')]){_0x12e96d[_0xdda2('0x48')]=_['merge'](_0x12e96d[_0xdda2('0x48')],{'$or':_['map'](_0x1426fd,function(_0x392f70){if(_0x392f70['type']!==_0xdda2('0x4a')){var _0x12589b={};_0x12589b[_0x392f70[_0xdda2('0x35')]]={'$like':'%'+_0xca6046[_0xdda2('0x3f')][_0xdda2('0x2e')]+'%'};return _0x12589b;}})});}_0x12e96d=_['merge']({},_0x12e96d,_0xca6046[_0xdda2('0x4b')]);var _0x15a616={'where':_0x12e96d['where']};return db[_0xdda2('0x3b')]['count'](_0x15a616)[_0xdda2('0x37')](function(_0x45c802){_0x2bcfba[_0xdda2('0x20')]=_0x45c802;if(_0xca6046[_0xdda2('0x3f')][_0xdda2('0x4c')]){_0x12e96d[_0xdda2('0x4d')]=[{'all':!![]}];}return db[_0xdda2('0x3b')][_0xdda2('0x4e')](_0x12e96d);})[_0xdda2('0x37')](function(_0x104a60){_0x2bcfba[_0xdda2('0x4f')]=_0x104a60;return _0x2bcfba;})[_0xdda2('0x37')](respondWithFilteredResult(_0x2fd592,_0x12e96d))[_0xdda2('0x50')](handleError(_0x2fd592,null));};exports['show']=function(_0x5cb8b5,_0x4fe8e8){var _0x36573e={'raw':![],'where':{'id':_0x5cb8b5['params']['id']}},_0x383536={};_0x383536[_0xdda2('0x3e')]=_[_0xdda2('0x51')](db[_0xdda2('0x3b')]['rawAttributes']);_0x383536[_0xdda2('0x3f')]=_[_0xdda2('0x51')](_0x5cb8b5['query']);_0x383536['filters']=_[_0xdda2('0x41')](_0x383536['model'],_0x383536[_0xdda2('0x3f')]);_0x36573e['attributes']=_[_0xdda2('0x41')](_0x383536[_0xdda2('0x3e')],qs['fields'](_0x5cb8b5['query'][_0xdda2('0x43')]));_0x36573e[_0xdda2('0x42')]=_0x36573e[_0xdda2('0x42')][_0xdda2('0x52')]?_0x36573e['attributes']:_0x383536[_0xdda2('0x3e')];if(_0x5cb8b5[_0xdda2('0x3f')][_0xdda2('0x4c')]){_0x36573e[_0xdda2('0x4d')]=[{'all':!![]}];}_0x36573e=_[_0xdda2('0x53')]({},_0x36573e,_0x5cb8b5['options']);return db[_0xdda2('0x3b')][_0xdda2('0x33')](_0x36573e)['then'](handleEntityNotFound(_0x4fe8e8,null))[_0xdda2('0x37')](respondWithResult(_0x4fe8e8,null))[_0xdda2('0x50')](handleError(_0x4fe8e8,null));};exports[_0xdda2('0x28')]=function(_0x2c2a4a,_0x161d7b){return db[_0xdda2('0x3b')]['find']({'where':{'id':_0x2c2a4a[_0xdda2('0x54')]['id']}})['then'](handleEntityNotFound(_0x161d7b,null))[_0xdda2('0x37')](removeEntity(_0x161d7b,null))['catch'](handleError(_0x161d7b,null));};exports[_0xdda2('0x55')]=function(_0x4df7cf,_0x3b5bbf){if(_0x4df7cf[_0xdda2('0x56')][_0xdda2('0x34')]===_0xdda2('0x2b')&&!_[_0xdda2('0x57')](_0x4df7cf[_0xdda2('0x56')][_0xdda2('0x58')],'_')){_0x4df7cf[_0xdda2('0x56')]['exten']='_'[_0xdda2('0x59')](_0x4df7cf[_0xdda2('0x56')][_0xdda2('0x58')]);}return db['VoiceExtension'][_0xdda2('0x55')](_0x4df7cf[_0xdda2('0x56')],{'raw':![]})['then'](function(_0x3868e7){var _0x5d9437=_0x4df7cf[_0xdda2('0x5a')][_0xdda2('0x29')]({'plain':!![]});if(!_0x5d9437)throw new Error(_0xdda2('0x5b'));if(_0x5d9437[_0xdda2('0x5c')]===_0xdda2('0x5a')){var _0x4fd561=_0x3868e7['get']({'plain':!![]});var _0x5c2cb2=[{'name':_0xdda2('0x2a'),'value':_0xdda2('0x5d')},{'name':'OutboundRoutes','value':_0xdda2('0x2b')},{'name':_0xdda2('0x2c'),'value':_0xdda2('0x2d')}];var _0x4b067e=_[_0xdda2('0x33')](_0x5c2cb2,[_0xdda2('0x31'),_0x4fd561[_0xdda2('0x34')]])['name'];return db[_0xdda2('0x5e')][_0xdda2('0x33')]({'where':{'name':_0x4b067e,'userProfileId':_0x5d9437[_0xdda2('0x5f')]},'raw':!![]})[_0xdda2('0x37')](function(_0x5d8602){if(_0x5d8602&&_0x5d8602[_0xdda2('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fd561['name'],'resourceId':_0x4fd561['id'],'type':_0x5d8602[_0xdda2('0x35')],'sectionId':_0x5d8602['id']},{})[_0xdda2('0x37')](function(){return _0x3868e7;});}else{return _0x3868e7;}})[_0xdda2('0x50')](function(_0x433cb0){logger[_0xdda2('0x61')](_0xdda2('0x62'),_0x433cb0);throw _0x433cb0;});}return _0x3868e7;})[_0xdda2('0x37')](respondWithResult(_0x3b5bbf,0xc9))[_0xdda2('0x50')](handleError(_0x3b5bbf,null));};exports[_0xdda2('0x27')]=function(_0x138c2f,_0x26e7de){if(_0x138c2f['body']['id']){delete _0x138c2f[_0xdda2('0x56')]['id'];}return db[_0xdda2('0x3b')][_0xdda2('0x33')]({'where':{'id':_0x138c2f[_0xdda2('0x54')]['id']}})[_0xdda2('0x37')](handleEntityNotFound(_0x26e7de,null))[_0xdda2('0x37')](function(_0x2affc6){if(_0x2affc6){return db['VoiceExtension'][_0xdda2('0x27')](_[_0xdda2('0x49')](_0x138c2f[_0xdda2('0x56')],[_0xdda2('0x58'),_0xdda2('0x63'),'description',_0xdda2('0x64'),_0xdda2('0x65'),_0xdda2('0x66')]),{'where':{'context':_0x2affc6[_0xdda2('0x63')],'exten':_0x2affc6[_0xdda2('0x58')]},'individualHooks':!![]})['then'](function(_0x17aaab){return _0x17aaab;});}return null;})[_0xdda2('0x37')](respondWithStatusCode(_0x26e7de,null))[_0xdda2('0x50')](handleError(_0x26e7de,null));};exports[_0xdda2('0x67')]=function(_0x1ac15a,_0x5d34d7,_0x29dd19){return db[_0xdda2('0x3b')][_0xdda2('0x68')]({'where':{'id':_0x1ac15a['params']['id']}})[_0xdda2('0x37')](handleEntityNotFound(_0x5d34d7,null))['then'](function(_0x3cc35c){if(_0x3cc35c){return db[_0xdda2('0x69')][_0xdda2('0x6a')](function(_0x5c351c){return db[_0xdda2('0x3b')][_0xdda2('0x28')]({'where':{'VoiceExtensionId':_0x1ac15a['params']['id']},'transaction':_0x5c351c})[_0xdda2('0x37')](function(_0x5adab5){var _0x3d645b=_[_0xdda2('0x30')](_0x1ac15a[_0xdda2('0x56')],function(_0x29cf1a){_0x29cf1a[_0xdda2('0x6b')]=_0x1ac15a['params']['id'];return _0x29cf1a;});return db['VoiceExtension'][_0xdda2('0x6c')](_0x3d645b,{'transaction':_0x5c351c});});})[_0xdda2('0x37')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1ac15a[_0xdda2('0x54')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xdda2('0x37')](respondWithResult(_0x5d34d7,null))[_0xdda2('0x50')](handleError(_0x5d34d7,null));}; \ No newline at end of file +var _0x57ca=['then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','pick','merge','where','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','options','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','json','apply','reject','save','update'];(function(_0x1ddd1f,_0x1ea7fe){var _0xee54ff=function(_0x391dc1){while(--_0x391dc1){_0x1ddd1f['push'](_0x1ddd1f['shift']());}};_0xee54ff(++_0x1ea7fe);}(_0x57ca,0x108));var _0xa57c=function(_0x5d4b4b,_0xf154cb){_0x5d4b4b=_0x5d4b4b-0x0;var _0x2337b8=_0x57ca[_0x5d4b4b];return _0x2337b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57c('0x2'));var rp=require(_0xa57c('0x3'));var moment=require(_0xa57c('0x4'));var BPromise=require(_0xa57c('0x5'));var Mustache=require(_0xa57c('0x6'));var util=require('util');var path=require(_0xa57c('0x7'));var sox=require(_0xa57c('0x8'));var csv=require(_0xa57c('0x9'));var ejs=require(_0xa57c('0xa'));var fs=require('fs');var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x9'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var db=require(_0xa57c('0x15'))['db'];config[_0xa57c('0x16')]=_[_0xa57c('0x17')](config[_0xa57c('0x16')],{'host':_0xa57c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0x16')]));require('./voiceExtension.socket')[_0xa57c('0x19')](socket);function respondWithStatusCode(_0x3d5995,_0x30940d){_0x30940d=_0x30940d||0xcc;return function(_0x3821d2){if(_0x3821d2){return _0x3d5995[_0xa57c('0x1a')](_0x30940d);}return _0x3d5995[_0xa57c('0x1b')](_0x30940d)[_0xa57c('0x1c')]();};}function respondWithResult(_0x4b4bdb,_0x26607a){_0x26607a=_0x26607a||0xc8;return function(_0xdf7ff6){if(_0xdf7ff6){return _0x4b4bdb[_0xa57c('0x1b')](_0x26607a)['json'](_0xdf7ff6);}};}function respondWithFilteredResult(_0x2746a0,_0x5f33f1){return function(_0x3e7afa){if(_0x3e7afa){var _0x3d781d=_0x3e7afa[_0xa57c('0x1d')],_0x93462c=_0x5f33f1[_0xa57c('0x1e')],_0xe3d505=_0x5f33f1[_0xa57c('0x1e')]+_0x5f33f1['limit'],_0x1fd0d8;if(_0xe3d505>=_0x3d781d){_0xe3d505=_0x3d781d;_0x1fd0d8=0xc8;}else{_0x1fd0d8=0xce;}_0x2746a0[_0xa57c('0x1b')](_0x1fd0d8);return _0x2746a0['set']('Content-Range',_0x93462c+'-'+_0xe3d505+'/'+_0x3d781d)[_0xa57c('0x1f')](_0x3e7afa);}return null;};}function patchUpdates(_0xa5b314){return function(_0x3eee75){try{jsonpatch[_0xa57c('0x20')](_0x3eee75,_0xa5b314,!![]);}catch(_0x49242c){return BPromise[_0xa57c('0x21')](_0x49242c);}return _0x3eee75[_0xa57c('0x22')]();};}function saveUpdates(_0x34d1bc,_0x2213b2){return function(_0x3bb969){if(_0x3bb969){return _0x3bb969[_0xa57c('0x23')](_0x34d1bc)[_0xa57c('0x24')](function(_0x42038e){return _0x42038e;});}return null;};}function removeEntity(_0x2e99ed,_0xdf65dd){return function(_0x382a26){if(_0x382a26){return _0x382a26[_0xa57c('0x25')]()[_0xa57c('0x24')](function(){var _0x10a33d=_0x382a26[_0xa57c('0x26')]({'plain':!![]});var _0x511a26=[{'name':_0xa57c('0x27'),'value':_0xa57c('0x28'),'ignore':![]},{'name':_0xa57c('0x29'),'value':_0xa57c('0x2a'),'ignore':![]},{'name':_0xa57c('0x2b'),'value':_0xa57c('0x2c'),'ignore':![]}];var _0x8ee1c0=_(_0x511a26)[_0xa57c('0x2d')](_0xa57c('0x2e'))[_0xa57c('0x2f')]('value')[_0xa57c('0x30')]();if(_['includes'](_0x8ee1c0,_0x10a33d['type'])){return;}var _0x257661=_[_0xa57c('0x31')](_0x511a26,['value',_0x10a33d[_0xa57c('0x32')]])[_0xa57c('0x33')];return db[_0xa57c('0x34')]['destroy']({'where':{'type':_0x257661,'resourceId':_0x10a33d['id']}})[_0xa57c('0x24')](function(){return _0x382a26;});})['then'](function(){_0x2e99ed[_0xa57c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3bbe,_0x51ad09){return function(_0xd4c5d4){if(!_0xd4c5d4){_0x2a3bbe['sendStatus'](0x194);}return _0xd4c5d4;};}function handleError(_0x9e02bb,_0x1d82d9){_0x1d82d9=_0x1d82d9||0x1f4;return function(_0x43c8f3){logger[_0xa57c('0x35')](_0x43c8f3[_0xa57c('0x36')]);if(_0x43c8f3[_0xa57c('0x33')]){delete _0x43c8f3[_0xa57c('0x33')];}_0x9e02bb['status'](_0x1d82d9)[_0xa57c('0x37')](_0x43c8f3);};}exports['index']=function(_0xbece0a,_0x315787){var _0x27ada0={},_0x587ce1={},_0x289174={'count':0x0,'rows':[]};var _0x4901a8=_[_0xa57c('0x2f')](db['VoiceExtension'][_0xa57c('0x38')],function(_0x494b8a){return{'name':_0x494b8a[_0xa57c('0x39')],'type':_0x494b8a[_0xa57c('0x32')]['key']};});_0x587ce1[_0xa57c('0x3a')]=_['map'](_0x4901a8,_0xa57c('0x33'));_0x587ce1['query']=_[_0xa57c('0x3b')](_0xbece0a[_0xa57c('0x3c')]);_0x587ce1[_0xa57c('0x3d')]=_[_0xa57c('0x3e')](_0x587ce1[_0xa57c('0x3a')],_0x587ce1[_0xa57c('0x3c')]);_0x27ada0['attributes']=_['intersection'](_0x587ce1[_0xa57c('0x3a')],qs[_0xa57c('0x3f')](_0xbece0a[_0xa57c('0x3c')]['fields']));_0x27ada0[_0xa57c('0x40')]=_0x27ada0['attributes'][_0xa57c('0x41')]?_0x27ada0[_0xa57c('0x40')]:_0x587ce1['model'];if(!_0xbece0a['query']['hasOwnProperty'](_0xa57c('0x42'))){_0x27ada0[_0xa57c('0x43')]=qs[_0xa57c('0x43')](_0xbece0a[_0xa57c('0x3c')][_0xa57c('0x43')]);_0x27ada0[_0xa57c('0x1e')]=qs['offset'](_0xbece0a[_0xa57c('0x3c')][_0xa57c('0x1e')]);}_0x27ada0['order']=qs['sort'](_0xbece0a[_0xa57c('0x3c')][_0xa57c('0x44')]);_0x27ada0['where']=qs[_0xa57c('0x3d')](_[_0xa57c('0x45')](_0xbece0a[_0xa57c('0x3c')],_0x587ce1[_0xa57c('0x3d')]),_0x4901a8);if(_0xbece0a[_0xa57c('0x3c')][_0xa57c('0x2d')]){_0x27ada0['where']=_[_0xa57c('0x46')](_0x27ada0['where'],{'$or':_['map'](_0x4901a8,function(_0x5b3300){if(_0x5b3300['type']!=='VIRTUAL'){var _0x39b20f={};_0x39b20f[_0x5b3300[_0xa57c('0x33')]]={'$like':'%'+_0xbece0a[_0xa57c('0x3c')]['filter']+'%'};return _0x39b20f;}})});}_0x27ada0=_['merge']({},_0x27ada0,_0xbece0a['options']);var _0x44f1e8={'where':_0x27ada0[_0xa57c('0x47')]};return db[_0xa57c('0x48')][_0xa57c('0x1d')](_0x44f1e8)[_0xa57c('0x24')](function(_0x17c5dd){_0x289174['count']=_0x17c5dd;if(_0xbece0a[_0xa57c('0x3c')][_0xa57c('0x49')]){_0x27ada0[_0xa57c('0x4a')]=[{'all':!![]}];}return db[_0xa57c('0x48')][_0xa57c('0x4b')](_0x27ada0);})[_0xa57c('0x24')](function(_0x4f2997){_0x289174[_0xa57c('0x4c')]=_0x4f2997;return _0x289174;})[_0xa57c('0x24')](respondWithFilteredResult(_0x315787,_0x27ada0))[_0xa57c('0x4d')](handleError(_0x315787,null));};exports[_0xa57c('0x4e')]=function(_0x269dfd,_0x4eb51e){var _0x209c67={'raw':![],'where':{'id':_0x269dfd[_0xa57c('0x4f')]['id']}},_0x13ede7={};_0x13ede7[_0xa57c('0x3a')]=_[_0xa57c('0x3b')](db[_0xa57c('0x48')]['rawAttributes']);_0x13ede7[_0xa57c('0x3c')]=_[_0xa57c('0x3b')](_0x269dfd[_0xa57c('0x3c')]);_0x13ede7[_0xa57c('0x3d')]=_[_0xa57c('0x3e')](_0x13ede7[_0xa57c('0x3a')],_0x13ede7['query']);_0x209c67['attributes']=_['intersection'](_0x13ede7['model'],qs[_0xa57c('0x3f')](_0x269dfd['query'][_0xa57c('0x3f')]));_0x209c67[_0xa57c('0x40')]=_0x209c67['attributes'][_0xa57c('0x41')]?_0x209c67[_0xa57c('0x40')]:_0x13ede7[_0xa57c('0x3a')];if(_0x269dfd[_0xa57c('0x3c')][_0xa57c('0x49')]){_0x209c67['include']=[{'all':!![]}];}_0x209c67=_[_0xa57c('0x46')]({},_0x209c67,_0x269dfd[_0xa57c('0x50')]);return db[_0xa57c('0x48')][_0xa57c('0x31')](_0x209c67)[_0xa57c('0x24')](handleEntityNotFound(_0x4eb51e,null))['then'](respondWithResult(_0x4eb51e,null))[_0xa57c('0x4d')](handleError(_0x4eb51e,null));};exports['destroy']=function(_0x5be160,_0x464233){return db[_0xa57c('0x48')][_0xa57c('0x31')]({'where':{'id':_0x5be160['params']['id']}})['then'](handleEntityNotFound(_0x464233,null))[_0xa57c('0x24')](removeEntity(_0x464233,null))[_0xa57c('0x4d')](handleError(_0x464233,null));};exports[_0xa57c('0x51')]=function(_0x33d451,_0x4d2899){if(_0x33d451[_0xa57c('0x52')][_0xa57c('0x32')]===_0xa57c('0x2a')&&!_['startsWith'](_0x33d451['body'][_0xa57c('0x53')],'_')){_0x33d451[_0xa57c('0x52')]['exten']='_'[_0xa57c('0x54')](_0x33d451[_0xa57c('0x52')][_0xa57c('0x53')]);}return db[_0xa57c('0x48')][_0xa57c('0x51')](_0x33d451[_0xa57c('0x52')],{'raw':![]})[_0xa57c('0x24')](function(_0x4ee02a){var _0x523a79=_0x33d451[_0xa57c('0x55')][_0xa57c('0x26')]({'plain':!![]});if(!_0x523a79)throw new Error(_0xa57c('0x56'));if(_0x523a79[_0xa57c('0x57')]===_0xa57c('0x55')){var _0x3804a3=_0x4ee02a[_0xa57c('0x26')]({'plain':!![]});var _0x4519a0=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xa57c('0x29'),'value':'outbound'},{'name':_0xa57c('0x2b'),'value':_0xa57c('0x2c')}];var _0x6c56db=_['find'](_0x4519a0,[_0xa57c('0x30'),_0x3804a3['type']])[_0xa57c('0x33')];return db['UserProfileSection'][_0xa57c('0x31')]({'where':{'name':_0x6c56db,'userProfileId':_0x523a79[_0xa57c('0x58')]},'raw':!![]})[_0xa57c('0x24')](function(_0x26a8e1){if(_0x26a8e1&&_0x26a8e1['autoAssociation']===0x0){return db[_0xa57c('0x34')][_0xa57c('0x51')]({'name':_0x3804a3[_0xa57c('0x33')],'resourceId':_0x3804a3['id'],'type':_0x26a8e1[_0xa57c('0x33')],'sectionId':_0x26a8e1['id']},{})[_0xa57c('0x24')](function(){return _0x4ee02a;});}else{return _0x4ee02a;}})['catch'](function(_0x13afd0){logger[_0xa57c('0x35')](_0xa57c('0x59'),_0x13afd0);throw _0x13afd0;});}return _0x4ee02a;})[_0xa57c('0x24')](respondWithResult(_0x4d2899,0xc9))[_0xa57c('0x4d')](handleError(_0x4d2899,null));};exports[_0xa57c('0x23')]=function(_0x143ec3,_0x419527){if(_0x143ec3[_0xa57c('0x52')]['id']){delete _0x143ec3[_0xa57c('0x52')]['id'];}return db['VoiceExtension'][_0xa57c('0x31')]({'where':{'id':_0x143ec3[_0xa57c('0x4f')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x419527,null))[_0xa57c('0x24')](function(_0x2d4fe3){if(_0x2d4fe3){return db[_0xa57c('0x48')]['update'](_[_0xa57c('0x45')](_0x143ec3[_0xa57c('0x52')],['exten',_0xa57c('0x5a'),_0xa57c('0x5b'),_0xa57c('0x5c'),_0xa57c('0x5d'),_0xa57c('0x5e')]),{'where':{'context':_0x2d4fe3[_0xa57c('0x5a')],'exten':_0x2d4fe3[_0xa57c('0x53')]},'individualHooks':!![]})['then'](function(_0xaa82e1){return _0xaa82e1;});}return null;})['then'](respondWithStatusCode(_0x419527,null))[_0xa57c('0x4d')](handleError(_0x419527,null));};exports['addApplications']=function(_0x1a8686,_0x5a0e62,_0x3ef1f1){return db[_0xa57c('0x48')]['findOne']({'where':{'id':_0x1a8686[_0xa57c('0x4f')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x5a0e62,null))[_0xa57c('0x24')](function(_0x144a5d){if(_0x144a5d){return db['sequelize'][_0xa57c('0x5f')](function(_0x13524b){return db[_0xa57c('0x48')][_0xa57c('0x25')]({'where':{'VoiceExtensionId':_0x1a8686[_0xa57c('0x4f')]['id']},'transaction':_0x13524b})[_0xa57c('0x24')](function(_0x308ce5){var _0x2a5983=_[_0xa57c('0x2f')](_0x1a8686[_0xa57c('0x52')],function(_0x1c8b97){_0x1c8b97[_0xa57c('0x60')]=_0x1a8686[_0xa57c('0x4f')]['id'];return _0x1c8b97;});return db[_0xa57c('0x48')][_0xa57c('0x61')](_0x2a5983,{'transaction':_0x13524b});});})[_0xa57c('0x24')](function(){return db['VoiceExtension'][_0xa57c('0x62')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1a8686['params']['id']},'order':_0xa57c('0x63')});});}})[_0xa57c('0x24')](respondWithResult(_0x5a0e62,null))[_0xa57c('0x4d')](handleError(_0x5a0e62,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 67341de..2c2ec0e 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 _0x9edb=['emit','hook','exports','events','../../mysqldb','VoiceExtension','save','update'];(function(_0x53721c,_0x248c6e){var _0xd36d24=function(_0x565d3f){while(--_0x565d3f){_0x53721c['push'](_0x53721c['shift']());}};_0xd36d24(++_0x248c6e);}(_0x9edb,0x7b));var _0xb9ed=function(_0x5dd30a,_0x483911){_0x5dd30a=_0x5dd30a-0x0;var _0x4616ee=_0x9edb[_0x5dd30a];return _0x4616ee;};'use strict';var EventEmitter=require(_0xb9ed('0x0'));var VoiceExtension=require(_0xb9ed('0x1'))['db'][_0xb9ed('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb9ed('0x3'),'afterUpdate':_0xb9ed('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18cd4d){return function(_0x53e6f7,_0x13709f,_0x2b1fd9){VoiceExtensionEvents[_0xb9ed('0x5')](_0x18cd4d+':'+_0x53e6f7['id'],_0x53e6f7);VoiceExtensionEvents[_0xb9ed('0x5')](_0x18cd4d,_0x53e6f7);_0x2b1fd9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb9ed('0x6')](e,emitEvent(event));}}module[_0xb9ed('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xf401=['hasOwnProperty','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x515b91,_0x18cebb){var _0x127d16=function(_0x2f9cdb){while(--_0x2f9cdb){_0x515b91['push'](_0x515b91['shift']());}};_0x127d16(++_0x18cebb);}(_0xf401,0x1b7));var _0x1f40=function(_0x511c1f,_0x4cf980){_0x511c1f=_0x511c1f-0x0;var _0x28a239=_0xf401[_0x511c1f];return _0x28a239;};'use strict';var EventEmitter=require(_0x1f40('0x0'));var VoiceExtension=require(_0x1f40('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1f40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1f40('0x3')};function emitEvent(_0x2fd5c0){return function(_0x3a13a5,_0x341871,_0x225332){VoiceExtensionEvents[_0x1f40('0x4')](_0x2fd5c0+':'+_0x3a13a5['id'],_0x3a13a5);VoiceExtensionEvents['emit'](_0x2fd5c0,_0x3a13a5);_0x225332(null);};}for(var e in events){if(events[_0x1f40('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 2e6f5b1..ef44657 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util','api','moment'];(function(_0x14e3c8,_0x195fdc){var _0x20c909=function(_0x33dad7){while(--_0x33dad7){_0x14e3c8['push'](_0x14e3c8['shift']());}};_0x20c909(++_0x195fdc);}(_0xadb5,0xad));var _0x5adb=function(_0x22cbd1,_0x22e94f){_0x22cbd1=_0x22cbd1-0x0;var _0x5af8c4=_0xadb5[_0x22cbd1];return _0x5af8c4;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','define','voice_extensions'];(function(_0x3fc4bb,_0x29af73){var _0x32db27=function(_0xc9d0ae){while(--_0xc9d0ae){_0x3fc4bb['push'](_0x3fc4bb['shift']());}};_0x32db27(++_0x29af73);}(_0x1261,0x144));var _0x1126=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x1261[_0x364cf8];return _0x6a59ee;};'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')]('VoiceExtension',attributes,{'tableName':_0x1126('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 130d91b..80b1f7e 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 _0x8ed9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','VoiceExtension','findAll','options','raw','where','map','include','model','attributes','GetVoiceExtension','stringify','catch','lodash','util'];(function(_0x42f57c,_0x579a36){var _0x30ea57=function(_0x4d149e){while(--_0x4d149e){_0x42f57c['push'](_0x42f57c['shift']());}};_0x30ea57(++_0x579a36);}(_0x8ed9,0x9a));var _0x98ed=function(_0x27998f,_0x3caf38){_0x27998f=_0x27998f-0x0;var _0x21b0ad=_0x8ed9[_0x27998f];return _0x21b0ad;};'use strict';var _=require(_0x98ed('0x0'));var util=require(_0x98ed('0x1'));var moment=require('moment');var BPromise=require(_0x98ed('0x2'));var rs=require(_0x98ed('0x3'));var fs=require('fs');var Redis=require(_0x98ed('0x4'));var db=require(_0x98ed('0x5'))['db'];var utils=require(_0x98ed('0x6'));var logger=require(_0x98ed('0x7'))(_0x98ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x98ed('0x9'));var client=jayson['client'][_0x98ed('0xa')]({'port':0x232a});config[_0x98ed('0xb')]=_['defaults'](config[_0x98ed('0xb')],{'host':_0x98ed('0xc'),'port':0x18eb});var socket=require(_0x98ed('0xd'))(new Redis(config[_0x98ed('0xb')]));require(_0x98ed('0xe'))[_0x98ed('0xf')](socket);function respondWithRpcPromise(_0x3e65aa,_0x5987ea,_0x420a94){return new BPromise(function(_0x189c5b,_0x4b638b){return client[_0x98ed('0x10')](_0x3e65aa,_0x420a94)[_0x98ed('0x11')](function(_0x3c841e){logger['info'](_0x98ed('0x12'),_0x5987ea,'request\x20sent');logger[_0x98ed('0x13')](_0x98ed('0x14'),_0x5987ea,_0x98ed('0x15'),JSON['stringify'](_0x3c841e));if(_0x3c841e[_0x98ed('0x16')]){if(_0x3c841e['error'][_0x98ed('0x17')]===0x1f4){logger[_0x98ed('0x16')](_0x98ed('0x12'),_0x5987ea,_0x3c841e[_0x98ed('0x16')][_0x98ed('0x18')]);return _0x4b638b(_0x3c841e['error'][_0x98ed('0x18')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5987ea,_0x3c841e['error'][_0x98ed('0x18')]);return _0x189c5b(_0x3c841e['error']['message']);}else{logger[_0x98ed('0x19')](_0x98ed('0x12'),_0x5987ea,_0x98ed('0x15'));_0x189c5b(_0x3c841e[_0x98ed('0x1a')][_0x98ed('0x18')]);}})['catch'](function(_0x5ab6fc){logger['error'](_0x98ed('0x12'),_0x5987ea,_0x5ab6fc);_0x4b638b(_0x5ab6fc);});});}exports['GetVoiceExtension']=function(_0x10b1c3){var _0x3b5d2e=this;return new Promise(function(_0x105a63,_0x3ddd33){return db[_0x98ed('0x1b')][_0x98ed('0x1c')]({'raw':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3[_0x98ed('0x1d')][_0x98ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3['options'][_0x98ed('0x1f')]||null:null,'attributes':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3[_0x98ed('0x1d')]['attributes']||null:null,'limit':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3['options']['limit']||null:null,'include':_0x10b1c3['options']?_0x10b1c3['options']['include']?_[_0x98ed('0x20')](_0x10b1c3['options'][_0x98ed('0x21')],function(_0x987fc5){return{'model':db[_0x987fc5[_0x98ed('0x22')]],'as':_0x987fc5['as'],'attributes':_0x987fc5[_0x98ed('0x23')],'include':_0x987fc5[_0x98ed('0x21')]?_[_0x98ed('0x20')](_0x987fc5[_0x98ed('0x21')],function(_0x52c22e){return{'model':db[_0x52c22e[_0x98ed('0x22')]],'as':_0x52c22e['as'],'attributes':_0x52c22e['attributes'],'include':_0x52c22e['include']?_[_0x98ed('0x20')](_0x52c22e[_0x98ed('0x21')],function(_0x59f353){return{'model':db[_0x59f353[_0x98ed('0x22')]],'as':_0x59f353['as'],'attributes':_0x59f353[_0x98ed('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x607a34){logger[_0x98ed('0x19')]('GetVoiceExtension',_0x10b1c3);logger['debug'](_0x98ed('0x24'),_0x10b1c3,JSON[_0x98ed('0x25')](_0x607a34));_0x105a63(_0x607a34);})[_0x98ed('0x26')](function(_0x2a6fad){logger[_0x98ed('0x16')](_0x98ed('0x24'),_0x2a6fad[_0x98ed('0x18')],_0x10b1c3);_0x3ddd33(_0x3b5d2e[_0x98ed('0x16')](0x1f4,_0x2a6fad[_0x98ed('0x18')]));});});}; \ No newline at end of file +var _0xa634=['model','attributes','map','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','GetVoiceExtension','VoiceExtension','options','limit','include'];(function(_0x592868,_0x5811a7){var _0x2116e2=function(_0x53ffbe){while(--_0x53ffbe){_0x592868['push'](_0x592868['shift']());}};_0x2116e2(++_0x5811a7);}(_0xa634,0x163));var _0x4a63=function(_0x1d4ab3,_0x48ee4d){_0x1d4ab3=_0x1d4ab3-0x0;var _0x1be200=_0xa634[_0x1d4ab3];return _0x1be200;};'use strict';var _=require(_0x4a63('0x0'));var util=require(_0x4a63('0x1'));var moment=require(_0x4a63('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a63('0x3'));var db=require(_0x4a63('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a63('0x5'));var config=require(_0x4a63('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4a63('0x7')][_0x4a63('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4a63('0x9')],{'host':_0x4a63('0xa'),'port':0x18eb});var socket=require(_0x4a63('0xb'))(new Redis(config[_0x4a63('0x9')]));require('./voiceExtension.socket')[_0x4a63('0xc')](socket);function respondWithRpcPromise(_0xabd6e7,_0xf52982,_0x5177b3){return new BPromise(function(_0x6470bd,_0x27ec15){return client[_0x4a63('0xd')](_0xabd6e7,_0x5177b3)[_0x4a63('0xe')](function(_0x297e4f){logger['info'](_0x4a63('0xf'),_0xf52982,_0x4a63('0x10'));logger[_0x4a63('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xf52982,_0x4a63('0x10'),JSON[_0x4a63('0x12')](_0x297e4f));if(_0x297e4f['error']){if(_0x297e4f['error'][_0x4a63('0x13')]===0x1f4){logger[_0x4a63('0x14')](_0x4a63('0xf'),_0xf52982,_0x297e4f[_0x4a63('0x14')][_0x4a63('0x15')]);return _0x27ec15(_0x297e4f[_0x4a63('0x14')]['message']);}logger['error'](_0x4a63('0xf'),_0xf52982,_0x297e4f[_0x4a63('0x14')][_0x4a63('0x15')]);return _0x6470bd(_0x297e4f['error'][_0x4a63('0x15')]);}else{logger[_0x4a63('0x16')]('VoiceExtension,\x20%s,\x20%s',_0xf52982,_0x4a63('0x10'));_0x6470bd(_0x297e4f['result'][_0x4a63('0x15')]);}})[_0x4a63('0x17')](function(_0x1262f7){logger[_0x4a63('0x14')](_0x4a63('0xf'),_0xf52982,_0x1262f7);_0x27ec15(_0x1262f7);});});}exports[_0x4a63('0x18')]=function(_0x3f443f){var _0x44186f=this;return new Promise(function(_0x46dc33,_0x3e021b){return db[_0x4a63('0x19')]['findAll']({'raw':_0x3f443f[_0x4a63('0x1a')]?_0x3f443f['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f443f[_0x4a63('0x1a')]?_0x3f443f[_0x4a63('0x1a')]['where']||null:null,'attributes':_0x3f443f[_0x4a63('0x1a')]?_0x3f443f[_0x4a63('0x1a')]['attributes']||null:null,'limit':_0x3f443f['options']?_0x3f443f[_0x4a63('0x1a')][_0x4a63('0x1b')]||null:null,'include':_0x3f443f[_0x4a63('0x1a')]?_0x3f443f[_0x4a63('0x1a')][_0x4a63('0x1c')]?_['map'](_0x3f443f[_0x4a63('0x1a')][_0x4a63('0x1c')],function(_0x441374){return{'model':db[_0x441374[_0x4a63('0x1d')]],'as':_0x441374['as'],'attributes':_0x441374[_0x4a63('0x1e')],'include':_0x441374['include']?_['map'](_0x441374[_0x4a63('0x1c')],function(_0x4dd9a7){return{'model':db[_0x4dd9a7['model']],'as':_0x4dd9a7['as'],'attributes':_0x4dd9a7[_0x4a63('0x1e')],'include':_0x4dd9a7['include']?_[_0x4a63('0x1f')](_0x4dd9a7['include'],function(_0x527bc9){return{'model':db[_0x527bc9[_0x4a63('0x1d')]],'as':_0x527bc9['as'],'attributes':_0x527bc9[_0x4a63('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4a63('0xe')](function(_0x1885e5){logger[_0x4a63('0x16')]('GetVoiceExtension',_0x3f443f);logger[_0x4a63('0x11')](_0x4a63('0x18'),_0x3f443f,JSON[_0x4a63('0x12')](_0x1885e5));_0x46dc33(_0x1885e5);})['catch'](function(_0x3a71cd){logger[_0x4a63('0x14')]('GetVoiceExtension',_0x3a71cd[_0x4a63('0x15')],_0x3f443f);_0x3e021b(_0x44186f[_0x4a63('0x14')](0x1f4,_0x3a71cd[_0x4a63('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e0b2961..9f33f0b 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 _0x6119=['save','update','emit','removeListener','length','voiceExtension:','./voiceExtension.events'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x6119,0xe6));var _0x9611=function(_0x407730,_0x30ca6c){_0x407730=_0x407730-0x0;var _0x299908=_0x6119[_0x407730];return _0x299908;};'use strict';var VoiceExtensionEvents=require(_0x9611('0x0'));var events=[_0x9611('0x1'),'remove',_0x9611('0x2')];function createListener(_0x4847c3,_0x54b751){return function(_0x4b4741){_0x54b751[_0x9611('0x3')](_0x4847c3,_0x4b4741);};}function removeListener(_0x171fa5,_0x582832){return function(){VoiceExtensionEvents[_0x9611('0x4')](_0x171fa5,_0x582832);};}exports['register']=function(_0x46651f){for(var _0x3e995c=0x0,_0x3bcb87=events[_0x9611('0x5')];_0x3e995c<_0x3bcb87;_0x3e995c++){var _0x4ae464=events[_0x3e995c];var _0x2a30a1=createListener(_0x9611('0x6')+_0x4ae464,_0x46651f);VoiceExtensionEvents['on'](_0x4ae464,_0x2a30a1);}}; \ No newline at end of file +var _0xd981=['register','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1f9307,_0x3043a6){var _0x16c87c=function(_0x3c7ff2){while(--_0x3c7ff2){_0x1f9307['push'](_0x1f9307['shift']());}};_0x16c87c(++_0x3043a6);}(_0xd981,0xea));var _0x1d98=function(_0x53ab5f,_0x36f5cc){_0x53ab5f=_0x53ab5f-0x0;var _0x5ce3d8=_0xd981[_0x53ab5f];return _0x5ce3d8;};'use strict';var VoiceExtensionEvents=require(_0x1d98('0x0'));var events=[_0x1d98('0x1'),_0x1d98('0x2'),_0x1d98('0x3')];function createListener(_0x53ac70,_0x39d0a1){return function(_0x491adf){_0x39d0a1[_0x1d98('0x4')](_0x53ac70,_0x491adf);};}function removeListener(_0x107155,_0x2fc4dd){return function(){VoiceExtensionEvents[_0x1d98('0x5')](_0x107155,_0x2fc4dd);};}exports[_0x1d98('0x6')]=function(_0x5a443d){for(var _0x1f9c3f=0x0,_0x3a4cb3=events['length'];_0x1f9c3f<_0x3a4cb3;_0x1f9c3f++){var _0x3242a8=events[_0x1f9c3f];var _0x146643=createListener(_0x1d98('0x7')+_0x3242a8,_0x5a443d);VoiceExtensionEvents['on'](_0x3242a8,_0x146643);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d4fe03a..2e9aa36 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 _0x9009=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','create','put','update','destroy','exports','multer'];(function(_0x3483eb,_0x1f5d3e){var _0x4f3867=function(_0x4730bf){while(--_0x4730bf){_0x3483eb['push'](_0x3483eb['shift']());}};_0x4f3867(++_0x1f5d3e);}(_0x9009,0x84));var _0x9900=function(_0x31970d,_0x313d50){_0x31970d=_0x31970d-0x0;var _0x47cd6a=_0x9009[_0x31970d];return _0x47cd6a;};'use strict';var multer=require(_0x9900('0x0'));var util=require(_0x9900('0x1'));var path=require(_0x9900('0x2'));var timeout=require(_0x9900('0x3'));var express=require(_0x9900('0x4'));var router=express['Router']();var auth=require(_0x9900('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9900('0x6'));var controller=require(_0x9900('0x7'));router[_0x9900('0x8')]('/',auth[_0x9900('0x9')](),controller[_0x9900('0xa')]);router[_0x9900('0x8')](_0x9900('0xb'),auth['isAuthenticated'](),controller[_0x9900('0xc')]);router[_0x9900('0x8')](_0x9900('0xd'),auth[_0x9900('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x9900('0xe')]);router[_0x9900('0xf')](_0x9900('0xb'),auth[_0x9900('0x9')](),controller[_0x9900('0x10')]);router['delete'](_0x9900('0xb'),auth[_0x9900('0x9')](),controller[_0x9900('0x11')]);module[_0x9900('0x12')]=router; \ No newline at end of file +var _0x3087=['show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x194171,_0x3e967b){var _0x4c6248=function(_0x4a409b){while(--_0x4a409b){_0x194171['push'](_0x194171['shift']());}};_0x4c6248(++_0x3e967b);}(_0x3087,0xa1));var _0x7308=function(_0x38bebd,_0x2f24d9){_0x38bebd=_0x38bebd-0x0;var _0x2b60ad=_0x3087[_0x38bebd];return _0x2b60ad;};'use strict';var multer=require(_0x7308('0x0'));var util=require(_0x7308('0x1'));var path=require(_0x7308('0x2'));var timeout=require(_0x7308('0x3'));var express=require('express');var router=express[_0x7308('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7308('0x5'));var controller=require(_0x7308('0x6'));router[_0x7308('0x7')]('/',auth[_0x7308('0x8')](),controller['index']);router['get']('/:id',auth[_0x7308('0x8')](),controller[_0x7308('0x9')]);router[_0x7308('0x7')]('/:id/messages',auth[_0x7308('0x8')](),controller['getMessages']);router[_0x7308('0xa')]('/',auth[_0x7308('0x8')](),controller[_0x7308('0xb')]);router[_0x7308('0xc')](_0x7308('0xd'),auth[_0x7308('0x8')](),controller[_0x7308('0xe')]);router[_0x7308('0xf')](_0x7308('0xd'),auth[_0x7308('0x8')](),controller['destroy']);module[_0x7308('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 ad8152e..c8bb07f 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 _0x4fc2=['mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0x2a4693,_0x12ad8b){var _0x105c88=function(_0x4d7371){while(--_0x4d7371){_0x2a4693['push'](_0x2a4693['shift']());}};_0x105c88(++_0x12ad8b);}(_0x4fc2,0x111));var _0x24fc=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x4fc2[_0x3c2b2e];return _0x27a338;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'customer_id':{'type':Sequelize[_0x24fc('0x2')]},'context':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':'from-voicemail','unique':_0x24fc('0x3')},'mailbox':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':'','allowNull':![],'unique':_0x24fc('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x24fc('0x2')]},'email':{'type':Sequelize[_0x24fc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58dafc){this[_0x24fc('0x4')](_0x24fc('0x5'),typeof _0x58dafc==='string'&&_0x58dafc[_0x24fc('0x6')]()?_0x58dafc[_0x24fc('0x6')]():null);}},'pager':{'type':Sequelize[_0x24fc('0x2')]},'tz':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':_0x24fc('0x7')},'attach':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x24fc('0x2')]},'callback':{'type':Sequelize[_0x24fc('0x2')]},'review':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x24fc('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'stamp':{'type':_0x24fc('0xb')},'emailsubject':{'type':Sequelize[_0x24fc('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x24fc('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x24fc('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x24fc('0xd')],'get':function(){return this[_0x24fc('0xe')]('fullname')+_0x24fc('0xf')+this[_0x24fc('0xe')](_0x24fc('0x10'));}}}; \ No newline at end of file +var _0x2032=['yes','ENUM','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x2032,0xd9));var _0x2203=function(_0x3a18dd,_0x229dad){_0x3a18dd=_0x3a18dd-0x0;var _0x12e97c=_0x2032[_0x3a18dd];return _0x12e97c;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'customer_id':{'type':Sequelize[_0x2203('0x1')]},'context':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'from-voicemail','unique':_0x2203('0x2')},'mailbox':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2203('0x1')]},'fullname':{'type':Sequelize[_0x2203('0x1')]},'email':{'type':Sequelize[_0x2203('0x1')],'validate':{'isEmail':!![]},'set':function(_0x201796){this[_0x2203('0x3')](_0x2203('0x4'),typeof _0x201796===_0x2203('0x5')&&_0x201796[_0x2203('0x6')]()?_0x201796[_0x2203('0x6')]():null);}},'pager':{'type':Sequelize[_0x2203('0x1')]},'tz':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x2203('0x1')]},'review':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2203('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2203('0x8')](_0x2203('0x7'),'no'),'defaultValue':_0x2203('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x2203('0x1')]},'emailbody':{'type':Sequelize[_0x2203('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2203('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2203('0xa')],'get':function(){return this['getDataValue'](_0x2203('0xb'))+'\x20-\x20'+this[_0x2203('0xc')](_0x2203('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 60ea807..0f066d9 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 _0x67a8=['merge','options','includeAll','include','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','order','pick','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL'];(function(_0x3fc36a,_0x463b5f){var _0x1eb364=function(_0x24c616){while(--_0x24c616){_0x3fc36a['push'](_0x3fc36a['shift']());}};_0x1eb364(++_0x463b5f);}(_0x67a8,0xbe));var _0x867a=function(_0x3735f9,_0x1ae262){_0x3735f9=_0x3735f9-0x0;var _0x1ad32=_0x67a8[_0x3735f9];return _0x1ad32;};'use strict';var pdf=require(_0x867a('0x0'));var emlformat=require(_0x867a('0x1'));var rimraf=require(_0x867a('0x2'));var zipdir=require(_0x867a('0x3'));var jsonpatch=require(_0x867a('0x4'));var rp=require(_0x867a('0x5'));var moment=require(_0x867a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x867a('0x7'));var util=require(_0x867a('0x8'));var path=require('path');var sox=require(_0x867a('0x9'));var csv=require(_0x867a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x867a('0xb'));var squel=require('squel');var crypto=require(_0x867a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x867a('0xd'));var toCsv=require(_0x867a('0xa'));var querystring=require(_0x867a('0xe'));var Papa=require(_0x867a('0xf'));var Redis=require(_0x867a('0x10'));var authService=require(_0x867a('0x11'));var qs=require(_0x867a('0x12'));var as=require(_0x867a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x867a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x867a('0x15'));var db=require(_0x867a('0x16'))['db'];function respondWithStatusCode(_0xb00eb3,_0x55f035){_0x55f035=_0x55f035||0xcc;return function(_0x40a272){if(_0x40a272){return _0xb00eb3[_0x867a('0x17')](_0x55f035);}return _0xb00eb3[_0x867a('0x18')](_0x55f035)['end']();};}function respondWithResult(_0x140f3a,_0x25817a){_0x25817a=_0x25817a||0xc8;return function(_0x19f00d){if(_0x19f00d){return _0x140f3a[_0x867a('0x18')](_0x25817a)[_0x867a('0x19')](_0x19f00d);}};}function respondWithFilteredResult(_0x196339,_0x467d04){return function(_0x20020d){if(_0x20020d){var _0x4121a0=_0x20020d[_0x867a('0x1a')],_0x5eb595=_0x467d04['offset'],_0x5baf21=_0x467d04[_0x867a('0x1b')]+_0x467d04[_0x867a('0x1c')],_0x3431bd;if(_0x5baf21>=_0x4121a0){_0x5baf21=_0x4121a0;_0x3431bd=0xc8;}else{_0x3431bd=0xce;}_0x196339[_0x867a('0x18')](_0x3431bd);return _0x196339[_0x867a('0x1d')]('Content-Range',_0x5eb595+'-'+_0x5baf21+'/'+_0x4121a0)[_0x867a('0x19')](_0x20020d);}return null;};}function patchUpdates(_0x31ebb){return function(_0x2a7ba9){try{jsonpatch[_0x867a('0x1e')](_0x2a7ba9,_0x31ebb,!![]);}catch(_0xa414b0){return BPromise['reject'](_0xa414b0);}return _0x2a7ba9[_0x867a('0x1f')]();};}function saveUpdates(_0x13a547,_0x30970f){return function(_0x14e457){if(_0x14e457){return _0x14e457[_0x867a('0x20')](_0x13a547)[_0x867a('0x21')](function(_0x39db43){return _0x39db43;});}return null;};}function removeEntity(_0x9100a1,_0x2fe8f5){return function(_0xd2946a){if(_0xd2946a){return _0xd2946a[_0x867a('0x22')]()['then'](function(){var _0x1e0811=_0xd2946a[_0x867a('0x23')]({'plain':!![]});var _0x32a7c9=_0x867a('0x24');return db[_0x867a('0x25')][_0x867a('0x22')]({'where':{'type':_0x32a7c9,'resourceId':_0x1e0811['id']}})[_0x867a('0x21')](function(){return _0xd2946a;});})[_0x867a('0x21')](function(){_0x9100a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9b04,_0xf48860){return function(_0x203a0a){if(!_0x203a0a){_0x3e9b04['sendStatus'](0x194);}return _0x203a0a;};}function handleError(_0x5cfa0e,_0x144814){_0x144814=_0x144814||0x1f4;return function(_0x3a1fca){logger[_0x867a('0x26')](_0x3a1fca[_0x867a('0x27')]);if(_0x3a1fca[_0x867a('0x28')]){delete _0x3a1fca[_0x867a('0x28')];}_0x5cfa0e[_0x867a('0x18')](_0x144814)[_0x867a('0x29')](_0x3a1fca);};}exports[_0x867a('0x2a')]=function(_0x40ea00,_0x4c632a){var _0x18e897={},_0x342c84={},_0x5645da={'count':0x0,'rows':[]};var _0x44e7f5=_[_0x867a('0x2b')](db[_0x867a('0x2c')][_0x867a('0x2d')],function(_0x39bae9){return{'name':_0x39bae9[_0x867a('0x2e')],'type':_0x39bae9['type'][_0x867a('0x2f')]};});_0x342c84[_0x867a('0x30')]=_[_0x867a('0x2b')](_0x44e7f5,'name');_0x342c84[_0x867a('0x31')]=_['keys'](_0x40ea00[_0x867a('0x31')]);_0x342c84[_0x867a('0x32')]=_[_0x867a('0x33')](_0x342c84['model'],_0x342c84['query']);_0x18e897[_0x867a('0x34')]=_['intersection'](_0x342c84[_0x867a('0x30')],qs[_0x867a('0x35')](_0x40ea00[_0x867a('0x31')]['fields']));_0x18e897[_0x867a('0x34')]=_0x18e897[_0x867a('0x34')][_0x867a('0x36')]?_0x18e897[_0x867a('0x34')]:_0x342c84[_0x867a('0x30')];if(!_0x40ea00[_0x867a('0x31')][_0x867a('0x37')](_0x867a('0x38'))){_0x18e897[_0x867a('0x1c')]=qs['limit'](_0x40ea00['query']['limit']);_0x18e897['offset']=qs['offset'](_0x40ea00[_0x867a('0x31')][_0x867a('0x1b')]);}_0x18e897['order']=qs[_0x867a('0x39')](_0x40ea00[_0x867a('0x31')][_0x867a('0x39')]);_0x18e897[_0x867a('0x3a')]=qs[_0x867a('0x32')](_['pick'](_0x40ea00[_0x867a('0x31')],_0x342c84[_0x867a('0x32')]),_0x44e7f5);if(_0x40ea00[_0x867a('0x31')][_0x867a('0x3b')]){_0x18e897[_0x867a('0x3a')]=_['merge'](_0x18e897[_0x867a('0x3a')],{'$or':_[_0x867a('0x2b')](_0x44e7f5,function(_0x2ae6c5){if(_0x2ae6c5[_0x867a('0x3c')]!==_0x867a('0x3d')){var _0x2bfa80={};_0x2bfa80[_0x2ae6c5[_0x867a('0x28')]]={'$like':'%'+_0x40ea00[_0x867a('0x31')]['filter']+'%'};return _0x2bfa80;}})});}_0x18e897=_[_0x867a('0x3e')]({},_0x18e897,_0x40ea00[_0x867a('0x3f')]);var _0x7116ab={'where':_0x18e897[_0x867a('0x3a')]};return db[_0x867a('0x2c')][_0x867a('0x1a')](_0x7116ab)[_0x867a('0x21')](function(_0x312b71){_0x5645da[_0x867a('0x1a')]=_0x312b71;if(_0x40ea00[_0x867a('0x31')][_0x867a('0x40')]){_0x18e897[_0x867a('0x41')]=[{'all':!![]}];}return db[_0x867a('0x2c')]['findAll'](_0x18e897);})[_0x867a('0x21')](function(_0x4d3217){_0x5645da['rows']=_0x4d3217;return _0x5645da;})[_0x867a('0x21')](respondWithFilteredResult(_0x4c632a,_0x18e897))[_0x867a('0x42')](handleError(_0x4c632a,null));};exports['show']=function(_0x21792d,_0x3c4fb2){var _0x3aa658={'raw':!![],'where':{'id':_0x21792d[_0x867a('0x43')]['id']}},_0x45240f={};_0x45240f[_0x867a('0x30')]=_[_0x867a('0x44')](db[_0x867a('0x2c')][_0x867a('0x2d')]);_0x45240f[_0x867a('0x31')]=_[_0x867a('0x44')](_0x21792d[_0x867a('0x31')]);_0x45240f[_0x867a('0x32')]=_['intersection'](_0x45240f[_0x867a('0x30')],_0x45240f['query']);_0x3aa658[_0x867a('0x34')]=_[_0x867a('0x33')](_0x45240f[_0x867a('0x30')],qs['fields'](_0x21792d[_0x867a('0x31')][_0x867a('0x35')]));_0x3aa658['attributes']=_0x3aa658[_0x867a('0x34')][_0x867a('0x36')]?_0x3aa658[_0x867a('0x34')]:_0x45240f['model'];if(_0x21792d['query'][_0x867a('0x40')]){_0x3aa658[_0x867a('0x41')]=[{'all':!![]}];}_0x3aa658=_[_0x867a('0x3e')]({},_0x3aa658,_0x21792d[_0x867a('0x3f')]);return db[_0x867a('0x2c')]['find'](_0x3aa658)['then'](handleEntityNotFound(_0x3c4fb2,null))['then'](respondWithResult(_0x3c4fb2,null))[_0x867a('0x42')](handleError(_0x3c4fb2,null));};exports[_0x867a('0x45')]=function(_0x4ad9be,_0x1a5385){return db[_0x867a('0x2c')]['create'](_0x4ad9be[_0x867a('0x46')],{})[_0x867a('0x21')](function(_0x5ee37f){var _0x26ed4f=_0x4ad9be['user'][_0x867a('0x23')]({'plain':!![]});if(!_0x26ed4f)throw new Error(_0x867a('0x47'));if(_0x26ed4f[_0x867a('0x48')]===_0x867a('0x49')){var _0x5832a8=_0x5ee37f[_0x867a('0x23')]({'plain':!![]});var _0x330a5a='Voicemails';return db[_0x867a('0x4a')][_0x867a('0x4b')]({'where':{'name':_0x330a5a,'userProfileId':_0x26ed4f[_0x867a('0x4c')]},'raw':!![]})[_0x867a('0x21')](function(_0x279127){if(_0x279127&&_0x279127['autoAssociation']===0x0){return db['UserProfileResource'][_0x867a('0x45')]({'name':_0x5832a8['name'],'resourceId':_0x5832a8['id'],'type':_0x279127['name'],'sectionId':_0x279127['id']},{})[_0x867a('0x21')](function(){return _0x5ee37f;});}else{return _0x5ee37f;}})[_0x867a('0x42')](function(_0x1daf09){logger[_0x867a('0x26')](_0x867a('0x4d'),_0x1daf09);throw _0x1daf09;});}return _0x5ee37f;})[_0x867a('0x21')](respondWithResult(_0x1a5385,0xc9))['catch'](handleError(_0x1a5385,null));};exports['update']=function(_0x3e3614,_0x166b20){if(_0x3e3614[_0x867a('0x46')]['id']){delete _0x3e3614[_0x867a('0x46')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e3614[_0x867a('0x43')]['id']}})['then'](handleEntityNotFound(_0x166b20,null))['then'](saveUpdates(_0x3e3614[_0x867a('0x46')],null))['then'](respondWithResult(_0x166b20,null))['catch'](handleError(_0x166b20,null));};exports[_0x867a('0x22')]=function(_0x46045c,_0x1cf647){return db[_0x867a('0x2c')][_0x867a('0x4b')]({'where':{'id':_0x46045c[_0x867a('0x43')]['id']}})[_0x867a('0x21')](handleEntityNotFound(_0x1cf647,null))['then'](removeEntity(_0x1cf647,null))[_0x867a('0x42')](handleError(_0x1cf647,null));};exports[_0x867a('0x4e')]=function(_0x20362e,_0x178a39,_0x481d1d){return db['VoiceMail']['findOne']({'where':{'id':_0x20362e['params']['id']}})[_0x867a('0x21')](handleEntityNotFound(_0x178a39,null))[_0x867a('0x21')](function(_0x404d34){var _0x5e33f0;var _0x29b47f={},_0x4de071={};_0x4de071[_0x867a('0x30')]=_['keys'](db[_0x867a('0x4f')]['rawAttributes']);_0x4de071[_0x867a('0x31')]=_[_0x867a('0x44')](_0x20362e[_0x867a('0x31')]);_0x4de071['filters']=_[_0x867a('0x33')](_0x4de071[_0x867a('0x30')],_0x4de071[_0x867a('0x31')]);_0x29b47f[_0x867a('0x34')]=_[_0x867a('0x33')](_0x4de071[_0x867a('0x30')],qs[_0x867a('0x35')](_0x20362e[_0x867a('0x31')]['fields']));_0x29b47f[_0x867a('0x34')]=_0x29b47f[_0x867a('0x34')][_0x867a('0x36')]?_0x29b47f[_0x867a('0x34')]:_0x4de071[_0x867a('0x30')];if(!_0x20362e[_0x867a('0x31')]['hasOwnProperty'](_0x867a('0x38'))){_0x29b47f[_0x867a('0x1c')]=qs['limit'](_0x20362e['query'][_0x867a('0x1c')]);_0x29b47f[_0x867a('0x1b')]=qs['offset'](_0x20362e[_0x867a('0x31')][_0x867a('0x1b')]);}_0x29b47f[_0x867a('0x50')]=qs[_0x867a('0x39')](_0x20362e['query'][_0x867a('0x39')]);_0x29b47f[_0x867a('0x3a')]=qs[_0x867a('0x32')](_[_0x867a('0x51')](_0x20362e[_0x867a('0x31')],_0x4de071[_0x867a('0x32')]));if(_0x20362e[_0x867a('0x31')][_0x867a('0x3b')]){_0x29b47f[_0x867a('0x3a')]=_[_0x867a('0x3e')](_0x29b47f[_0x867a('0x3a')],{'$or':_['map'](_0x29b47f[_0x867a('0x34')],function(_0x10924a){var _0x4c6b50={};_0x4c6b50[_0x10924a]={'$like':'%'+_0x20362e[_0x867a('0x31')][_0x867a('0x3b')]+'%'};return _0x4c6b50;})});}_0x29b47f[_0x867a('0x3a')]=_[_0x867a('0x3e')](_0x29b47f['where'],{'mailboxuser':_0x404d34[_0x867a('0x52')]});_0x29b47f=_[_0x867a('0x3e')]({},_0x29b47f,_0x20362e[_0x867a('0x3f')]);return db[_0x867a('0x4f')][_0x867a('0x53')](_0x29b47f)[_0x867a('0x21')](respondWithFilteredResult(_0x178a39,_0x29b47f));})['catch'](handleError(_0x178a39,null));}; \ No newline at end of file +var _0xf0f3=['where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','nolimit','pick','map','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','moment','bluebird','util','path','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','filter'];(function(_0x500439,_0x24b02e){var _0x476501=function(_0x1b92ca){while(--_0x1b92ca){_0x500439['push'](_0x500439['shift']());}};_0x476501(++_0x24b02e);}(_0xf0f3,0x11f));var _0x3f0f=function(_0x3b056d,_0x4e1ad1){_0x3b056d=_0x3b056d-0x0;var _0x3693b9=_0xf0f3[_0x3b056d];return _0x3693b9;};'use strict';var pdf=require(_0x3f0f('0x0'));var emlformat=require(_0x3f0f('0x1'));var rimraf=require(_0x3f0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3f0f('0x3'));var BPromise=require(_0x3f0f('0x4'));var Mustache=require('mustache');var util=require(_0x3f0f('0x5'));var path=require(_0x3f0f('0x6'));var sox=require('sox');var csv=require(_0x3f0f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3f0f('0x8'));var crypto=require('crypto');var jsforce=require(_0x3f0f('0x9'));var deskjs=require(_0x3f0f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3f0f('0xb'));var Papa=require('papaparse');var Redis=require(_0x3f0f('0xc'));var authService=require(_0x3f0f('0xd'));var qs=require(_0x3f0f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f0f('0xf'));var logger=require('../../config/logger')(_0x3f0f('0x10'));var utils=require(_0x3f0f('0x11'));var config=require(_0x3f0f('0x12'));var db=require(_0x3f0f('0x13'))['db'];function respondWithStatusCode(_0x426f62,_0x3084e9){_0x3084e9=_0x3084e9||0xcc;return function(_0x5c1365){if(_0x5c1365){return _0x426f62[_0x3f0f('0x14')](_0x3084e9);}return _0x426f62['status'](_0x3084e9)[_0x3f0f('0x15')]();};}function respondWithResult(_0x2e0276,_0x3b320a){_0x3b320a=_0x3b320a||0xc8;return function(_0x348aa4){if(_0x348aa4){return _0x2e0276[_0x3f0f('0x16')](_0x3b320a)['json'](_0x348aa4);}};}function respondWithFilteredResult(_0x2bc216,_0x201d8b){return function(_0x39ba1f){if(_0x39ba1f){var _0x3b5922=_0x39ba1f[_0x3f0f('0x17')],_0x3d1f85=_0x201d8b[_0x3f0f('0x18')],_0x21b777=_0x201d8b[_0x3f0f('0x18')]+_0x201d8b[_0x3f0f('0x19')],_0x223692;if(_0x21b777>=_0x3b5922){_0x21b777=_0x3b5922;_0x223692=0xc8;}else{_0x223692=0xce;}_0x2bc216['status'](_0x223692);return _0x2bc216[_0x3f0f('0x1a')](_0x3f0f('0x1b'),_0x3d1f85+'-'+_0x21b777+'/'+_0x3b5922)[_0x3f0f('0x1c')](_0x39ba1f);}return null;};}function patchUpdates(_0x121e78){return function(_0x1b8302){try{jsonpatch[_0x3f0f('0x1d')](_0x1b8302,_0x121e78,!![]);}catch(_0x95ec89){return BPromise[_0x3f0f('0x1e')](_0x95ec89);}return _0x1b8302['save']();};}function saveUpdates(_0x5eaff0,_0x4b1718){return function(_0x3ba1b1){if(_0x3ba1b1){return _0x3ba1b1[_0x3f0f('0x1f')](_0x5eaff0)[_0x3f0f('0x20')](function(_0x38fd31){return _0x38fd31;});}return null;};}function removeEntity(_0x5d62db,_0x2b2ac1){return function(_0x3424d0){if(_0x3424d0){return _0x3424d0[_0x3f0f('0x21')]()[_0x3f0f('0x20')](function(){var _0x3bc8d8=_0x3424d0[_0x3f0f('0x22')]({'plain':!![]});var _0xbeeda3=_0x3f0f('0x23');return db[_0x3f0f('0x24')]['destroy']({'where':{'type':_0xbeeda3,'resourceId':_0x3bc8d8['id']}})['then'](function(){return _0x3424d0;});})[_0x3f0f('0x20')](function(){_0x5d62db[_0x3f0f('0x16')](0xcc)[_0x3f0f('0x15')]();});}};}function handleEntityNotFound(_0x27c761,_0xae94fc){return function(_0x5331e4){if(!_0x5331e4){_0x27c761[_0x3f0f('0x14')](0x194);}return _0x5331e4;};}function handleError(_0x1c6487,_0x1a1841){_0x1a1841=_0x1a1841||0x1f4;return function(_0x12c2a3){logger[_0x3f0f('0x25')](_0x12c2a3[_0x3f0f('0x26')]);if(_0x12c2a3[_0x3f0f('0x27')]){delete _0x12c2a3[_0x3f0f('0x27')];}_0x1c6487[_0x3f0f('0x16')](_0x1a1841)['send'](_0x12c2a3);};}exports[_0x3f0f('0x28')]=function(_0x1ebf9c,_0x16731f){var _0x20c050={},_0x436b27={},_0xc98450={'count':0x0,'rows':[]};var _0x4d0d40=_['map'](db[_0x3f0f('0x29')][_0x3f0f('0x2a')],function(_0x33dc65){return{'name':_0x33dc65[_0x3f0f('0x2b')],'type':_0x33dc65[_0x3f0f('0x2c')][_0x3f0f('0x2d')]};});_0x436b27[_0x3f0f('0x2e')]=_['map'](_0x4d0d40,_0x3f0f('0x27'));_0x436b27[_0x3f0f('0x2f')]=_[_0x3f0f('0x30')](_0x1ebf9c[_0x3f0f('0x2f')]);_0x436b27[_0x3f0f('0x31')]=_['intersection'](_0x436b27[_0x3f0f('0x2e')],_0x436b27[_0x3f0f('0x2f')]);_0x20c050[_0x3f0f('0x32')]=_[_0x3f0f('0x33')](_0x436b27[_0x3f0f('0x2e')],qs[_0x3f0f('0x34')](_0x1ebf9c[_0x3f0f('0x2f')][_0x3f0f('0x34')]));_0x20c050[_0x3f0f('0x32')]=_0x20c050[_0x3f0f('0x32')][_0x3f0f('0x35')]?_0x20c050[_0x3f0f('0x32')]:_0x436b27['model'];if(!_0x1ebf9c[_0x3f0f('0x2f')]['hasOwnProperty']('nolimit')){_0x20c050[_0x3f0f('0x19')]=qs['limit'](_0x1ebf9c[_0x3f0f('0x2f')]['limit']);_0x20c050[_0x3f0f('0x18')]=qs['offset'](_0x1ebf9c['query'][_0x3f0f('0x18')]);}_0x20c050[_0x3f0f('0x36')]=qs[_0x3f0f('0x37')](_0x1ebf9c['query'][_0x3f0f('0x37')]);_0x20c050['where']=qs[_0x3f0f('0x31')](_['pick'](_0x1ebf9c[_0x3f0f('0x2f')],_0x436b27[_0x3f0f('0x31')]),_0x4d0d40);if(_0x1ebf9c['query'][_0x3f0f('0x38')]){_0x20c050[_0x3f0f('0x39')]=_[_0x3f0f('0x3a')](_0x20c050[_0x3f0f('0x39')],{'$or':_['map'](_0x4d0d40,function(_0x26a059){if(_0x26a059['type']!==_0x3f0f('0x3b')){var _0x276d9a={};_0x276d9a[_0x26a059[_0x3f0f('0x27')]]={'$like':'%'+_0x1ebf9c[_0x3f0f('0x2f')]['filter']+'%'};return _0x276d9a;}})});}_0x20c050=_['merge']({},_0x20c050,_0x1ebf9c[_0x3f0f('0x3c')]);var _0x15f48e={'where':_0x20c050[_0x3f0f('0x39')]};return db[_0x3f0f('0x29')][_0x3f0f('0x17')](_0x15f48e)[_0x3f0f('0x20')](function(_0x254d3a){_0xc98450[_0x3f0f('0x17')]=_0x254d3a;if(_0x1ebf9c[_0x3f0f('0x2f')]['includeAll']){_0x20c050[_0x3f0f('0x3d')]=[{'all':!![]}];}return db[_0x3f0f('0x29')]['findAll'](_0x20c050);})[_0x3f0f('0x20')](function(_0x10e960){_0xc98450[_0x3f0f('0x3e')]=_0x10e960;return _0xc98450;})[_0x3f0f('0x20')](respondWithFilteredResult(_0x16731f,_0x20c050))[_0x3f0f('0x3f')](handleError(_0x16731f,null));};exports[_0x3f0f('0x40')]=function(_0x1f6ac3,_0xc93ced){var _0xaf8f8={'raw':!![],'where':{'id':_0x1f6ac3[_0x3f0f('0x41')]['id']}},_0x3cb5ad={};_0x3cb5ad[_0x3f0f('0x2e')]=_[_0x3f0f('0x30')](db['VoiceMail'][_0x3f0f('0x2a')]);_0x3cb5ad[_0x3f0f('0x2f')]=_['keys'](_0x1f6ac3[_0x3f0f('0x2f')]);_0x3cb5ad[_0x3f0f('0x31')]=_[_0x3f0f('0x33')](_0x3cb5ad[_0x3f0f('0x2e')],_0x3cb5ad['query']);_0xaf8f8['attributes']=_['intersection'](_0x3cb5ad[_0x3f0f('0x2e')],qs[_0x3f0f('0x34')](_0x1f6ac3['query'][_0x3f0f('0x34')]));_0xaf8f8[_0x3f0f('0x32')]=_0xaf8f8[_0x3f0f('0x32')][_0x3f0f('0x35')]?_0xaf8f8[_0x3f0f('0x32')]:_0x3cb5ad[_0x3f0f('0x2e')];if(_0x1f6ac3[_0x3f0f('0x2f')][_0x3f0f('0x42')]){_0xaf8f8[_0x3f0f('0x3d')]=[{'all':!![]}];}_0xaf8f8=_['merge']({},_0xaf8f8,_0x1f6ac3['options']);return db[_0x3f0f('0x29')][_0x3f0f('0x43')](_0xaf8f8)[_0x3f0f('0x20')](handleEntityNotFound(_0xc93ced,null))[_0x3f0f('0x20')](respondWithResult(_0xc93ced,null))[_0x3f0f('0x3f')](handleError(_0xc93ced,null));};exports[_0x3f0f('0x44')]=function(_0x57c35d,_0x5ec9a3){return db[_0x3f0f('0x29')][_0x3f0f('0x44')](_0x57c35d[_0x3f0f('0x45')],{})[_0x3f0f('0x20')](function(_0xdc3c7d){var _0x4ddb3c=_0x57c35d['user'][_0x3f0f('0x22')]({'plain':!![]});if(!_0x4ddb3c)throw new Error(_0x3f0f('0x46'));if(_0x4ddb3c[_0x3f0f('0x47')]===_0x3f0f('0x48')){var _0x17a292=_0xdc3c7d[_0x3f0f('0x22')]({'plain':!![]});var _0x5834e3=_0x3f0f('0x23');return db[_0x3f0f('0x49')][_0x3f0f('0x43')]({'where':{'name':_0x5834e3,'userProfileId':_0x4ddb3c[_0x3f0f('0x4a')]},'raw':!![]})[_0x3f0f('0x20')](function(_0x51bf96){if(_0x51bf96&&_0x51bf96[_0x3f0f('0x4b')]===0x0){return db['UserProfileResource'][_0x3f0f('0x44')]({'name':_0x17a292[_0x3f0f('0x27')],'resourceId':_0x17a292['id'],'type':_0x51bf96['name'],'sectionId':_0x51bf96['id']},{})[_0x3f0f('0x20')](function(){return _0xdc3c7d;});}else{return _0xdc3c7d;}})[_0x3f0f('0x3f')](function(_0x2c7d3f){logger['error'](_0x3f0f('0x4c'),_0x2c7d3f);throw _0x2c7d3f;});}return _0xdc3c7d;})[_0x3f0f('0x20')](respondWithResult(_0x5ec9a3,0xc9))[_0x3f0f('0x3f')](handleError(_0x5ec9a3,null));};exports[_0x3f0f('0x1f')]=function(_0x287804,_0x1c352d){if(_0x287804[_0x3f0f('0x45')]['id']){delete _0x287804['body']['id'];}return db[_0x3f0f('0x29')][_0x3f0f('0x43')]({'where':{'id':_0x287804[_0x3f0f('0x41')]['id']}})[_0x3f0f('0x20')](handleEntityNotFound(_0x1c352d,null))[_0x3f0f('0x20')](saveUpdates(_0x287804[_0x3f0f('0x45')],null))[_0x3f0f('0x20')](respondWithResult(_0x1c352d,null))[_0x3f0f('0x3f')](handleError(_0x1c352d,null));};exports[_0x3f0f('0x21')]=function(_0x4e4fc6,_0x2cb3f1){return db['VoiceMail']['find']({'where':{'id':_0x4e4fc6[_0x3f0f('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cb3f1,null))[_0x3f0f('0x20')](removeEntity(_0x2cb3f1,null))[_0x3f0f('0x3f')](handleError(_0x2cb3f1,null));};exports[_0x3f0f('0x4d')]=function(_0x2c7718,_0x6b2d4a,_0x4177db){return db[_0x3f0f('0x29')][_0x3f0f('0x4e')]({'where':{'id':_0x2c7718[_0x3f0f('0x41')]['id']}})[_0x3f0f('0x20')](handleEntityNotFound(_0x6b2d4a,null))[_0x3f0f('0x20')](function(_0x449cfb){var _0x2b1a1b;var _0x151148={},_0x2b07cf={};_0x2b07cf[_0x3f0f('0x2e')]=_[_0x3f0f('0x30')](db[_0x3f0f('0x4f')][_0x3f0f('0x2a')]);_0x2b07cf[_0x3f0f('0x2f')]=_[_0x3f0f('0x30')](_0x2c7718[_0x3f0f('0x2f')]);_0x2b07cf[_0x3f0f('0x31')]=_['intersection'](_0x2b07cf['model'],_0x2b07cf[_0x3f0f('0x2f')]);_0x151148['attributes']=_[_0x3f0f('0x33')](_0x2b07cf['model'],qs['fields'](_0x2c7718['query']['fields']));_0x151148[_0x3f0f('0x32')]=_0x151148[_0x3f0f('0x32')][_0x3f0f('0x35')]?_0x151148[_0x3f0f('0x32')]:_0x2b07cf[_0x3f0f('0x2e')];if(!_0x2c7718['query'][_0x3f0f('0x50')](_0x3f0f('0x51'))){_0x151148[_0x3f0f('0x19')]=qs['limit'](_0x2c7718[_0x3f0f('0x2f')]['limit']);_0x151148[_0x3f0f('0x18')]=qs[_0x3f0f('0x18')](_0x2c7718[_0x3f0f('0x2f')]['offset']);}_0x151148[_0x3f0f('0x36')]=qs['sort'](_0x2c7718[_0x3f0f('0x2f')][_0x3f0f('0x37')]);_0x151148[_0x3f0f('0x39')]=qs['filters'](_[_0x3f0f('0x52')](_0x2c7718[_0x3f0f('0x2f')],_0x2b07cf['filters']));if(_0x2c7718['query']['filter']){_0x151148[_0x3f0f('0x39')]=_['merge'](_0x151148[_0x3f0f('0x39')],{'$or':_[_0x3f0f('0x53')](_0x151148[_0x3f0f('0x32')],function(_0x4ad9a1){var _0x5b94dd={};_0x5b94dd[_0x4ad9a1]={'$like':'%'+_0x2c7718[_0x3f0f('0x2f')][_0x3f0f('0x38')]+'%'};return _0x5b94dd;})});}_0x151148[_0x3f0f('0x39')]=_[_0x3f0f('0x3a')](_0x151148['where'],{'mailboxuser':_0x449cfb[_0x3f0f('0x54')]});_0x151148=_[_0x3f0f('0x3a')]({},_0x151148,_0x2c7718['options']);return db[_0x3f0f('0x4f')][_0x3f0f('0x55')](_0x151148)[_0x3f0f('0x20')](respondWithFilteredResult(_0x6b2d4a,_0x151148));})[_0x3f0f('0x3f')](handleError(_0x6b2d4a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6b864fd..e9d2627 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 _0xcc14=['./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1acc01,_0x5cb80c){var _0x5603f1=function(_0x5e7558){while(--_0x5e7558){_0x1acc01['push'](_0x1acc01['shift']());}};_0x5603f1(++_0x5cb80c);}(_0xcc14,0x7f));var _0x4cc1=function(_0x24755a,_0x38f540){_0x24755a=_0x24755a-0x0;var _0x41ca80=_0xcc14[_0x24755a];return _0x41ca80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4cc1('0x0'))(_0x4cc1('0x1'));var moment=require(_0x4cc1('0x2'));var BPromise=require(_0x4cc1('0x3'));var rp=require(_0x4cc1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4cc1('0x5'));module[_0x4cc1('0x6')]=function(_0x1a3578,_0x5dd8b6){return _0x1a3578[_0x4cc1('0x7')](_0x4cc1('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4cc1('0x9'),'fields':[_0x4cc1('0xa'),_0x4cc1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0ae=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','mailbox_context','mailbox','context','lodash'];(function(_0x10284e,_0x2b0a3c){var _0x2ddff5=function(_0x4d52b3){while(--_0x4d52b3){_0x10284e['push'](_0x10284e['shift']());}};_0x2ddff5(++_0x2b0a3c);}(_0xa0ae,0x103));var _0xea0a=function(_0x434010,_0x591dd5){_0x434010=_0x434010-0x0;var _0x37cab1=_0xa0ae[_0x434010];return _0x37cab1;};'use strict';var _=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var logger=require(_0xea0a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xea0a('0x3'));var rp=require(_0xea0a('0x4'));var fs=require('fs');var path=require(_0xea0a('0x5'));var rimraf=require(_0xea0a('0x6'));var config=require(_0xea0a('0x7'));var attributes=require(_0xea0a('0x8'));module[_0xea0a('0x9')]=function(_0x1cfedb,_0x554f61){return _0x1cfedb['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xea0a('0xa'),'fields':[_0xea0a('0xb'),_0xea0a('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 e67b020..35eccb1 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 _0xb001=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xb001,0xbd));var _0x1b00=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb001[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x1b00('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b00('0x1'));var fs=require('fs');var Redis=require(_0x1b00('0x2'));var db=require(_0x1b00('0x3'))['db'];var utils=require(_0x1b00('0x4'));var logger=require(_0x1b00('0x5'))(_0x1b00('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbfcd9a,_0x37789a,_0x165bc4){return new BPromise(function(_0x47ce6b,_0x48d18b){return client[_0x1b00('0x7')](_0xbfcd9a,_0x165bc4)[_0x1b00('0x8')](function(_0x4cf94e){logger[_0x1b00('0x9')](_0x1b00('0xa'),_0x37789a,'request\x20sent');logger[_0x1b00('0xb')](_0x1b00('0xc'),_0x37789a,_0x1b00('0xd'),JSON[_0x1b00('0xe')](_0x4cf94e));if(_0x4cf94e['error']){if(_0x4cf94e['error'][_0x1b00('0xf')]===0x1f4){logger['error'](_0x1b00('0xa'),_0x37789a,_0x4cf94e[_0x1b00('0x10')][_0x1b00('0x11')]);return _0x48d18b(_0x4cf94e['error'][_0x1b00('0x11')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x37789a,_0x4cf94e[_0x1b00('0x10')][_0x1b00('0x11')]);return _0x47ce6b(_0x4cf94e[_0x1b00('0x10')][_0x1b00('0x11')]);}else{logger[_0x1b00('0x9')]('VoiceMail,\x20%s,\x20%s',_0x37789a,_0x1b00('0xd'));_0x47ce6b(_0x4cf94e[_0x1b00('0x12')][_0x1b00('0x11')]);}})[_0x1b00('0x13')](function(_0x520f1e){logger[_0x1b00('0x10')](_0x1b00('0xa'),_0x37789a,_0x520f1e);_0x48d18b(_0x520f1e);});});} \ No newline at end of file +var _0x96fe=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','randomstring','../../mysqldb'];(function(_0x3d6c55,_0x5337db){var _0x4617b1=function(_0x16e3f){while(--_0x16e3f){_0x3d6c55['push'](_0x3d6c55['shift']());}};_0x4617b1(++_0x5337db);}(_0x96fe,0x151));var _0xe96f=function(_0x31124e,_0x19bca2){_0x31124e=_0x31124e-0x0;var _0x10b72d=_0x96fe[_0x31124e];return _0x10b72d;};'use strict';var _=require(_0xe96f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe96f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe96f('0x2'))['db'];var utils=require(_0xe96f('0x3'));var logger=require(_0xe96f('0x4'))(_0xe96f('0x5'));var config=require('../../config/environment');var jayson=require(_0xe96f('0x6'));var client=jayson[_0xe96f('0x7')][_0xe96f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d84c1,_0x4b3252,_0x36743e){return new BPromise(function(_0xb88e18,_0x1f0799){return client[_0xe96f('0x9')](_0x3d84c1,_0x36743e)[_0xe96f('0xa')](function(_0x17c9f5){logger[_0xe96f('0xb')](_0xe96f('0xc'),_0x4b3252,'request\x20sent');logger[_0xe96f('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4b3252,_0xe96f('0xe'),JSON[_0xe96f('0xf')](_0x17c9f5));if(_0x17c9f5['error']){if(_0x17c9f5[_0xe96f('0x10')][_0xe96f('0x11')]===0x1f4){logger['error'](_0xe96f('0xc'),_0x4b3252,_0x17c9f5[_0xe96f('0x10')][_0xe96f('0x12')]);return _0x1f0799(_0x17c9f5['error'][_0xe96f('0x12')]);}logger['error'](_0xe96f('0xc'),_0x4b3252,_0x17c9f5[_0xe96f('0x10')][_0xe96f('0x12')]);return _0xb88e18(_0x17c9f5[_0xe96f('0x10')][_0xe96f('0x12')]);}else{logger[_0xe96f('0xb')](_0xe96f('0xc'),_0x4b3252,'request\x20sent');_0xb88e18(_0x17c9f5[_0xe96f('0x13')][_0xe96f('0x12')]);}})['catch'](function(_0x1cab83){logger[_0xe96f('0x10')](_0xe96f('0xc'),_0x4b3252,_0x1cab83);_0x1f0799(_0x1cab83);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 494609b..94631ad 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 _0xe14b=['update','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x96dbf,_0x42f48a){var _0x43ce02=function(_0x5471ab){while(--_0x5471ab){_0x96dbf['push'](_0x96dbf['shift']());}};_0x43ce02(++_0x42f48a);}(_0xe14b,0x93));var _0xbe14=function(_0x590efc,_0x5e23b0){_0x590efc=_0x590efc-0x0;var _0x52524e=_0xe14b[_0x590efc];return _0x52524e;};'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('./voiceMailMessage.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['put']('/:id',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['delete'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file +var _0x687b=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x687b,0x14a));var _0xb687=function(_0x2e11d3,_0x26a29a){_0x2e11d3=_0x2e11d3-0x0;var _0x3f7f7f=_0x687b[_0x2e11d3];return _0x3f7f7f;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0x8')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0xe')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xf')]);router[_0xb687('0x10')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')]('/:id',auth[_0xb687('0x9')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b3488bb..27dfaa4 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 _0x4a56=['TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','BLOB','long'];(function(_0x122364,_0x318101){var _0x2a9d7c=function(_0x5efffa){while(--_0x5efffa){_0x122364['push'](_0x122364['shift']());}};_0x2a9d7c(++_0x318101);}(_0x4a56,0xe1));var _0x64a5=function(_0x23ef53,_0x12ca2f){_0x23ef53=_0x23ef53-0x0;var _0x3d3e10=_0x4a56[_0x23ef53];return _0x3d3e10;};'use strict';var Sequelize=require('sequelize');module[_0x64a5('0x0')]={'name':{'type':Sequelize[_0x64a5('0x1')],'get':function(_0x5e35ec){return this[_0x64a5('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x64a5('0x4')](_0x64a5('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'stamp':{'type':_0x64a5('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xf9dd=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x4e4702,_0x55bc42){var _0x38f8d2=function(_0x169f7e){while(--_0x169f7e){_0x4e4702['push'](_0x4e4702['shift']());}};_0x38f8d2(++_0x55bc42);}(_0xf9dd,0x1f1));var _0xdf9d=function(_0x987238,_0x28b2c3){_0x987238=_0x987238-0x0;var _0x3b7ce3=_0xf9dd[_0x987238];return _0x3b7ce3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf9d('0x0')],'get':function(_0x5d1a3f){return this[_0xdf9d('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xdf9d('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xdf9d('0x4')](_0xdf9d('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdf9d('0x3')],'defaultValue':''},'stamp':{'type':_0xdf9d('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 2637439..fbf7210 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 _0x8d05=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3cfd5f,_0x360ea1){var _0x3b1938=function(_0x47a79c){while(--_0x47a79c){_0x3cfd5f['push'](_0x3cfd5f['shift']());}};_0x3b1938(++_0x360ea1);}(_0x8d05,0xe8));var _0x58d0=function(_0x313903,_0x338dc6){_0x313903=_0x313903-0x0;var _0x4c6d4b=_0x8d05[_0x313903];return _0x4c6d4b;};'use strict';var pdf=require(_0x58d0('0x0'));var emlformat=require(_0x58d0('0x1'));var rimraf=require(_0x58d0('0x2'));var zipdir=require(_0x58d0('0x3'));var jsonpatch=require(_0x58d0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58d0('0x5'));var Mustache=require(_0x58d0('0x6'));var util=require(_0x58d0('0x7'));var path=require(_0x58d0('0x8'));var sox=require('sox');var csv=require(_0x58d0('0x9'));var ejs=require(_0x58d0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x58d0('0xb'));var crypto=require('crypto');var jsforce=require(_0x58d0('0xc'));var deskjs=require(_0x58d0('0xd'));var toCsv=require(_0x58d0('0x9'));var querystring=require(_0x58d0('0xe'));var Papa=require(_0x58d0('0xf'));var Redis=require('ioredis');var authService=require(_0x58d0('0x10'));var qs=require(_0x58d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58d0('0x12'));var logger=require(_0x58d0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x58d0('0x14'));var db=require(_0x58d0('0x15'))['db'];function respondWithStatusCode(_0x85352e,_0x1efa0d){_0x1efa0d=_0x1efa0d||0xcc;return function(_0xf90244){if(_0xf90244){return _0x85352e[_0x58d0('0x16')](_0x1efa0d);}return _0x85352e[_0x58d0('0x17')](_0x1efa0d)[_0x58d0('0x18')]();};}function respondWithResult(_0x28adc0,_0x5d10d4){_0x5d10d4=_0x5d10d4||0xc8;return function(_0x15528b){if(_0x15528b){return _0x28adc0[_0x58d0('0x17')](_0x5d10d4)[_0x58d0('0x19')](_0x15528b);}};}function respondWithFilteredResult(_0x20b61b,_0x9f133a){return function(_0x1e92b7){if(_0x1e92b7){var _0x3d560f=_0x1e92b7[_0x58d0('0x1a')],_0x246f48=_0x9f133a[_0x58d0('0x1b')],_0x437721=_0x9f133a[_0x58d0('0x1b')]+_0x9f133a[_0x58d0('0x1c')],_0x49f232;if(_0x437721>=_0x3d560f){_0x437721=_0x3d560f;_0x49f232=0xc8;}else{_0x49f232=0xce;}_0x20b61b[_0x58d0('0x17')](_0x49f232);return _0x20b61b[_0x58d0('0x1d')](_0x58d0('0x1e'),_0x246f48+'-'+_0x437721+'/'+_0x3d560f)[_0x58d0('0x19')](_0x1e92b7);}return null;};}function patchUpdates(_0x1e4ca2){return function(_0x924f94){try{jsonpatch[_0x58d0('0x1f')](_0x924f94,_0x1e4ca2,!![]);}catch(_0x27796a){return BPromise[_0x58d0('0x20')](_0x27796a);}return _0x924f94[_0x58d0('0x21')]();};}function saveUpdates(_0x562a87,_0x3072f9){return function(_0x9ad72a){if(_0x9ad72a){return _0x9ad72a[_0x58d0('0x22')](_0x562a87)['then'](function(_0x1d3cb4){return _0x1d3cb4;});}return null;};}function removeEntity(_0x22a3c1,_0x412583){return function(_0x575b34){if(_0x575b34){return _0x575b34[_0x58d0('0x23')]()['then'](function(){_0x22a3c1['status'](0xcc)[_0x58d0('0x18')]();});}};}function handleEntityNotFound(_0x161bf5,_0x388772){return function(_0x6c0cd0){if(!_0x6c0cd0){_0x161bf5['sendStatus'](0x194);}return _0x6c0cd0;};}function handleError(_0xca616e,_0x28b6e2){_0x28b6e2=_0x28b6e2||0x1f4;return function(_0x281bf8){logger['error'](_0x281bf8[_0x58d0('0x24')]);if(_0x281bf8[_0x58d0('0x25')]){delete _0x281bf8['name'];}_0xca616e[_0x58d0('0x17')](_0x28b6e2)[_0x58d0('0x26')](_0x281bf8);};}exports[_0x58d0('0x27')]=function(_0x41f180,_0x3e16ea){var _0x5301d8={},_0x55c899={},_0x2593d4={'count':0x0,'rows':[]};var _0x18dec5=_[_0x58d0('0x28')](db[_0x58d0('0x29')][_0x58d0('0x2a')],function(_0x4bff4f){return{'name':_0x4bff4f[_0x58d0('0x2b')],'type':_0x4bff4f['type'][_0x58d0('0x2c')]};});_0x55c899[_0x58d0('0x2d')]=_[_0x58d0('0x2e')](_[_0x58d0('0x28')](_0x18dec5,'name'),[_0x58d0('0x25')]);_0x55c899[_0x58d0('0x2f')]=_[_0x58d0('0x30')](_0x41f180['query']);_0x55c899[_0x58d0('0x31')]=_[_0x58d0('0x32')](_0x55c899[_0x58d0('0x2d')],_0x55c899[_0x58d0('0x2f')]);_0x5301d8['attributes']=_[_0x58d0('0x32')](_0x55c899[_0x58d0('0x2d')],qs[_0x58d0('0x33')](_0x41f180[_0x58d0('0x2f')][_0x58d0('0x33')]));_0x5301d8['attributes']=_0x5301d8[_0x58d0('0x34')][_0x58d0('0x35')]?_0x5301d8[_0x58d0('0x34')]:_0x55c899[_0x58d0('0x2d')];if(!_0x41f180[_0x58d0('0x2f')][_0x58d0('0x36')](_0x58d0('0x37'))){_0x5301d8[_0x58d0('0x1c')]=qs[_0x58d0('0x1c')](_0x41f180[_0x58d0('0x2f')]['limit']);_0x5301d8[_0x58d0('0x1b')]=qs[_0x58d0('0x1b')](_0x41f180[_0x58d0('0x2f')][_0x58d0('0x1b')]);}_0x5301d8[_0x58d0('0x38')]=qs[_0x58d0('0x39')](_0x41f180[_0x58d0('0x2f')]['sort']);_0x5301d8['where']=qs[_0x58d0('0x31')](_[_0x58d0('0x3a')](_0x41f180['query'],_0x55c899[_0x58d0('0x31')]),_0x18dec5);if(_0x41f180[_0x58d0('0x2f')][_0x58d0('0x3b')]){_0x5301d8[_0x58d0('0x3c')]=_[_0x58d0('0x3d')](_0x5301d8['where'],{'$or':_['map'](_0x18dec5,function(_0x3b02cc){if(_0x3b02cc['type']!=='VIRTUAL'){var _0x489884={};_0x489884[_0x3b02cc[_0x58d0('0x25')]]={'$like':'%'+_0x41f180['query'][_0x58d0('0x3b')]+'%'};return _0x489884;}})});}_0x5301d8=_['merge']({},_0x5301d8,_0x41f180[_0x58d0('0x3e')]);var _0x5eb3d2={'where':_0x5301d8['where']};return db['VoiceMailMessage'][_0x58d0('0x1a')](_0x5eb3d2)[_0x58d0('0x3f')](function(_0x5d6655){_0x2593d4[_0x58d0('0x1a')]=_0x5d6655;if(_0x41f180['query'][_0x58d0('0x40')]){_0x5301d8[_0x58d0('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x58d0('0x42')](_0x5301d8);})['then'](function(_0x9cb078){_0x2593d4[_0x58d0('0x43')]=_0x9cb078;return _0x2593d4;})[_0x58d0('0x3f')](respondWithFilteredResult(_0x3e16ea,_0x5301d8))[_0x58d0('0x44')](handleError(_0x3e16ea,null));};exports[_0x58d0('0x45')]=function(_0x492262,_0x490e03){var _0x53b007={'raw':!![],'where':{'id':_0x492262[_0x58d0('0x46')]['id']}},_0x432cb6={};_0x432cb6['model']=_[_0x58d0('0x30')](db['VoiceMailMessage']['rawAttributes']);_0x432cb6[_0x58d0('0x2f')]=_[_0x58d0('0x30')](_0x492262[_0x58d0('0x2f')]);_0x432cb6[_0x58d0('0x31')]=_[_0x58d0('0x32')](_0x432cb6['model'],_0x432cb6['query']);_0x53b007['attributes']=_[_0x58d0('0x32')](_0x432cb6[_0x58d0('0x2d')],qs[_0x58d0('0x33')](_0x492262[_0x58d0('0x2f')][_0x58d0('0x33')]));_0x53b007[_0x58d0('0x34')]=_0x53b007[_0x58d0('0x34')]['length']?_0x53b007[_0x58d0('0x34')]:_0x432cb6[_0x58d0('0x2d')];if(_0x492262['query']['includeAll']){_0x53b007[_0x58d0('0x41')]=[{'all':!![]}];}_0x53b007=_[_0x58d0('0x3d')]({},_0x53b007,_0x492262[_0x58d0('0x3e')]);return db[_0x58d0('0x29')][_0x58d0('0x47')](_0x53b007)[_0x58d0('0x3f')](handleEntityNotFound(_0x490e03,null))[_0x58d0('0x3f')](respondWithResult(_0x490e03,null))[_0x58d0('0x44')](handleError(_0x490e03,null));};exports[_0x58d0('0x48')]=function(_0x53ad38,_0x34ee2b){return db[_0x58d0('0x29')]['create'](_0x53ad38['body'],{})[_0x58d0('0x3f')](respondWithResult(_0x34ee2b,0xc9))['catch'](handleError(_0x34ee2b,null));};exports[_0x58d0('0x22')]=function(_0x4f1681,_0x593526){if(_0x4f1681[_0x58d0('0x49')]['id']){delete _0x4f1681[_0x58d0('0x49')]['id'];}return db[_0x58d0('0x29')][_0x58d0('0x47')]({'where':{'id':_0x4f1681[_0x58d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x593526,null))[_0x58d0('0x3f')](saveUpdates(_0x4f1681[_0x58d0('0x49')],null))[_0x58d0('0x3f')](respondWithResult(_0x593526,null))[_0x58d0('0x44')](handleError(_0x593526,null));};exports[_0x58d0('0x23')]=function(_0x5ddbb9,_0x550662){return db[_0x58d0('0x29')][_0x58d0('0x47')]({'where':{'id':_0x5ddbb9[_0x58d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x550662,null))[_0x58d0('0x3f')](removeEntity(_0x550662,null))['catch'](handleError(_0x550662,null));};exports[_0x58d0('0x4a')]=function(_0x312e3b,_0x1c478a,_0x5a8e99){return db['VoiceMailMessage'][_0x58d0('0x47')]({'where':{'id':_0x312e3b[_0x58d0('0x46')]['id']},'attributes':['id',_0x58d0('0x4b'),'msg_id']})[_0x58d0('0x3f')](handleEntityNotFound(_0x1c478a,null))[_0x58d0('0x3f')](function(_0x48189c){if(_0x48189c){if(!_0x48189c['recording']){throw new db[(_0x58d0('0x4c'))][(_0x58d0('0x4d'))](_0x58d0('0x4e'));}var _0xd41afa={'Content-Type':_0x58d0('0x4f'),'Content-Disposition':_0x58d0('0x50')};if(_0x48189c[_0x58d0('0x51')]){_0xd41afa['Content-Disposition']=_0x58d0('0x52')+_0x48189c[_0x58d0('0x51')]+_0x58d0('0x53');}_0x1c478a[_0x58d0('0x1d')](_0xd41afa);return _0x1c478a['send'](new Buffer(_0x48189c[_0x58d0('0x4b')]));}})['catch'](handleError(_0x1c478a,null));}; \ No newline at end of file +var _0x282b=['ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','update','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv'];(function(_0x1382c1,_0x4f35d9){var _0x3fed6e=function(_0x19edfe){while(--_0x19edfe){_0x1382c1['push'](_0x1382c1['shift']());}};_0x3fed6e(++_0x4f35d9);}(_0x282b,0xec));var _0xb282=function(_0x5eea32,_0x13bb1a){_0x5eea32=_0x5eea32-0x0;var _0x40c7e3=_0x282b[_0x5eea32];return _0x40c7e3;};'use strict';var pdf=require(_0xb282('0x0'));var emlformat=require(_0xb282('0x1'));var rimraf=require(_0xb282('0x2'));var zipdir=require(_0xb282('0x3'));var jsonpatch=require(_0xb282('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb282('0x5'));var Mustache=require('mustache');var util=require(_0xb282('0x6'));var path=require(_0xb282('0x7'));var sox=require(_0xb282('0x8'));var csv=require(_0xb282('0x9'));var ejs=require(_0xb282('0xa'));var fs=require('fs');var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d52d2,_0x338bdb){_0x338bdb=_0x338bdb||0xcc;return function(_0xc08746){if(_0xc08746){return _0x5d52d2[_0xb282('0x17')](_0x338bdb);}return _0x5d52d2[_0xb282('0x18')](_0x338bdb)[_0xb282('0x19')]();};}function respondWithResult(_0x55bd85,_0x34c595){_0x34c595=_0x34c595||0xc8;return function(_0x5adf7f){if(_0x5adf7f){return _0x55bd85[_0xb282('0x18')](_0x34c595)[_0xb282('0x1a')](_0x5adf7f);}};}function respondWithFilteredResult(_0x4af892,_0x525cfa){return function(_0x5bc7c3){if(_0x5bc7c3){var _0x13cea1=_0x5bc7c3[_0xb282('0x1b')],_0x350676=_0x525cfa['offset'],_0x7c20df=_0x525cfa[_0xb282('0x1c')]+_0x525cfa[_0xb282('0x1d')],_0xbb182;if(_0x7c20df>=_0x13cea1){_0x7c20df=_0x13cea1;_0xbb182=0xc8;}else{_0xbb182=0xce;}_0x4af892[_0xb282('0x18')](_0xbb182);return _0x4af892[_0xb282('0x1e')](_0xb282('0x1f'),_0x350676+'-'+_0x7c20df+'/'+_0x13cea1)['json'](_0x5bc7c3);}return null;};}function patchUpdates(_0x52e305){return function(_0xcea320){try{jsonpatch[_0xb282('0x20')](_0xcea320,_0x52e305,!![]);}catch(_0x599f9e){return BPromise[_0xb282('0x21')](_0x599f9e);}return _0xcea320[_0xb282('0x22')]();};}function saveUpdates(_0x2e3928,_0x438dbe){return function(_0x1c3084){if(_0x1c3084){return _0x1c3084['update'](_0x2e3928)[_0xb282('0x23')](function(_0x16a656){return _0x16a656;});}return null;};}function removeEntity(_0x1f3e12,_0x4b79d7){return function(_0x437d66){if(_0x437d66){return _0x437d66[_0xb282('0x24')]()[_0xb282('0x23')](function(){_0x1f3e12[_0xb282('0x18')](0xcc)[_0xb282('0x19')]();});}};}function handleEntityNotFound(_0x56645f,_0x4d624f){return function(_0x360f15){if(!_0x360f15){_0x56645f[_0xb282('0x17')](0x194);}return _0x360f15;};}function handleError(_0x4934f0,_0x5e828e){_0x5e828e=_0x5e828e||0x1f4;return function(_0x34774d){logger[_0xb282('0x25')](_0x34774d[_0xb282('0x26')]);if(_0x34774d[_0xb282('0x27')]){delete _0x34774d[_0xb282('0x27')];}_0x4934f0[_0xb282('0x18')](_0x5e828e)['send'](_0x34774d);};}exports[_0xb282('0x28')]=function(_0x42015c,_0x50bd73){var _0x22d895={},_0x38a1f8={},_0x2a4491={'count':0x0,'rows':[]};var _0x280940=_['map'](db[_0xb282('0x29')][_0xb282('0x2a')],function(_0xe337b8){return{'name':_0xe337b8[_0xb282('0x2b')],'type':_0xe337b8[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x38a1f8[_0xb282('0x2e')]=_['differenceBy'](_[_0xb282('0x2f')](_0x280940,_0xb282('0x27')),[_0xb282('0x27')]);_0x38a1f8[_0xb282('0x30')]=_[_0xb282('0x31')](_0x42015c['query']);_0x38a1f8[_0xb282('0x32')]=_['intersection'](_0x38a1f8[_0xb282('0x2e')],_0x38a1f8[_0xb282('0x30')]);_0x22d895[_0xb282('0x33')]=_['intersection'](_0x38a1f8[_0xb282('0x2e')],qs['fields'](_0x42015c[_0xb282('0x30')][_0xb282('0x34')]));_0x22d895[_0xb282('0x33')]=_0x22d895[_0xb282('0x33')][_0xb282('0x35')]?_0x22d895[_0xb282('0x33')]:_0x38a1f8['model'];if(!_0x42015c[_0xb282('0x30')][_0xb282('0x36')]('nolimit')){_0x22d895['limit']=qs[_0xb282('0x1d')](_0x42015c[_0xb282('0x30')][_0xb282('0x1d')]);_0x22d895['offset']=qs['offset'](_0x42015c['query'][_0xb282('0x1c')]);}_0x22d895[_0xb282('0x37')]=qs[_0xb282('0x38')](_0x42015c[_0xb282('0x30')][_0xb282('0x38')]);_0x22d895[_0xb282('0x39')]=qs[_0xb282('0x32')](_['pick'](_0x42015c[_0xb282('0x30')],_0x38a1f8['filters']),_0x280940);if(_0x42015c[_0xb282('0x30')][_0xb282('0x3a')]){_0x22d895[_0xb282('0x39')]=_['merge'](_0x22d895[_0xb282('0x39')],{'$or':_['map'](_0x280940,function(_0x3bd325){if(_0x3bd325[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x246c85={};_0x246c85[_0x3bd325['name']]={'$like':'%'+_0x42015c['query'][_0xb282('0x3a')]+'%'};return _0x246c85;}})});}_0x22d895=_[_0xb282('0x3c')]({},_0x22d895,_0x42015c[_0xb282('0x3d')]);var _0x20d56c={'where':_0x22d895['where']};return db[_0xb282('0x29')]['count'](_0x20d56c)[_0xb282('0x23')](function(_0x1a1b50){_0x2a4491['count']=_0x1a1b50;if(_0x42015c[_0xb282('0x30')][_0xb282('0x3e')]){_0x22d895[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x29')][_0xb282('0x40')](_0x22d895);})[_0xb282('0x23')](function(_0x43e87e){_0x2a4491[_0xb282('0x41')]=_0x43e87e;return _0x2a4491;})[_0xb282('0x23')](respondWithFilteredResult(_0x50bd73,_0x22d895))[_0xb282('0x42')](handleError(_0x50bd73,null));};exports[_0xb282('0x43')]=function(_0x91fe43,_0x1caff0){var _0x138a72={'raw':!![],'where':{'id':_0x91fe43[_0xb282('0x44')]['id']}},_0x309441={};_0x309441[_0xb282('0x2e')]=_[_0xb282('0x31')](db['VoiceMailMessage'][_0xb282('0x2a')]);_0x309441['query']=_[_0xb282('0x31')](_0x91fe43[_0xb282('0x30')]);_0x309441[_0xb282('0x32')]=_[_0xb282('0x45')](_0x309441[_0xb282('0x2e')],_0x309441[_0xb282('0x30')]);_0x138a72['attributes']=_['intersection'](_0x309441[_0xb282('0x2e')],qs['fields'](_0x91fe43[_0xb282('0x30')][_0xb282('0x34')]));_0x138a72['attributes']=_0x138a72[_0xb282('0x33')][_0xb282('0x35')]?_0x138a72[_0xb282('0x33')]:_0x309441['model'];if(_0x91fe43['query'][_0xb282('0x3e')]){_0x138a72['include']=[{'all':!![]}];}_0x138a72=_[_0xb282('0x3c')]({},_0x138a72,_0x91fe43[_0xb282('0x3d')]);return db[_0xb282('0x29')][_0xb282('0x46')](_0x138a72)[_0xb282('0x23')](handleEntityNotFound(_0x1caff0,null))[_0xb282('0x23')](respondWithResult(_0x1caff0,null))['catch'](handleError(_0x1caff0,null));};exports[_0xb282('0x47')]=function(_0xb0cf81,_0x8e6fb8){return db['VoiceMailMessage'][_0xb282('0x47')](_0xb0cf81['body'],{})[_0xb282('0x23')](respondWithResult(_0x8e6fb8,0xc9))['catch'](handleError(_0x8e6fb8,null));};exports[_0xb282('0x48')]=function(_0x4ac56f,_0x4f92c9){if(_0x4ac56f['body']['id']){delete _0x4ac56f[_0xb282('0x49')]['id'];}return db[_0xb282('0x29')][_0xb282('0x46')]({'where':{'id':_0x4ac56f[_0xb282('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f92c9,null))['then'](saveUpdates(_0x4ac56f['body'],null))[_0xb282('0x23')](respondWithResult(_0x4f92c9,null))[_0xb282('0x42')](handleError(_0x4f92c9,null));};exports[_0xb282('0x24')]=function(_0x1ab323,_0x4e5b3d){return db[_0xb282('0x29')][_0xb282('0x46')]({'where':{'id':_0x1ab323['params']['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x4e5b3d,null))[_0xb282('0x23')](removeEntity(_0x4e5b3d,null))[_0xb282('0x42')](handleError(_0x4e5b3d,null));};exports[_0xb282('0x4a')]=function(_0x1d356e,_0x5522be,_0x6a295c){return db[_0xb282('0x29')][_0xb282('0x46')]({'where':{'id':_0x1d356e[_0xb282('0x44')]['id']},'attributes':['id',_0xb282('0x4b'),_0xb282('0x4c')]})['then'](handleEntityNotFound(_0x5522be,null))[_0xb282('0x23')](function(_0x574653){if(_0x574653){if(!_0x574653[_0xb282('0x4b')]){throw new db[(_0xb282('0x4d'))]['ValidationError'](_0xb282('0x4e'));}var _0x3dd8cb={'Content-Type':_0xb282('0x4f'),'Content-Disposition':'attachment'};if(_0x574653['msg_id']){_0x3dd8cb[_0xb282('0x50')]=_0xb282('0x51')+_0x574653[_0xb282('0x4c')]+'.wav\x22';}_0x5522be[_0xb282('0x1e')](_0x3dd8cb);return _0x5522be['send'](new Buffer(_0x574653[_0xb282('0x4b')]));}})[_0xb282('0x42')](handleError(_0x5522be,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 76429f3..a488bb0 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 _0x1ab1=['dir','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages'];(function(_0x27c804,_0x20e64b){var _0x41b537=function(_0xf195a2){while(--_0xf195a2){_0x27c804['push'](_0x27c804['shift']());}};_0x41b537(++_0x20e64b);}(_0x1ab1,0x83));var _0x11ab=function(_0x1814f3,_0x37ed7d){_0x1814f3=_0x1814f3-0x0;var _0x513cda=_0x1ab1[_0x1814f3];return _0x513cda;};'use strict';var _=require('lodash');var util=require(_0x11ab('0x0'));var logger=require(_0x11ab('0x1'))(_0x11ab('0x2'));var moment=require(_0x11ab('0x3'));var BPromise=require(_0x11ab('0x4'));var rp=require(_0x11ab('0x5'));var fs=require('fs');var path=require(_0x11ab('0x6'));var rimraf=require('rimraf');var config=require(_0x11ab('0x7'));var attributes=require(_0x11ab('0x8'));module[_0x11ab('0x9')]=function(_0x173e17,_0x643c32){return _0x173e17['define'](_0x11ab('0xa'),attributes,{'tableName':_0x11ab('0xb'),'paranoid':![],'indexes':[{'name':_0x11ab('0xc'),'fields':[_0x11ab('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8ba2=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x78b0be,_0x5ca66b){var _0x2b631d=function(_0x8ee2d1){while(--_0x8ee2d1){_0x78b0be['push'](_0x78b0be['shift']());}};_0x2b631d(++_0x5ca66b);}(_0x8ba2,0x13f));var _0x28ba=function(_0x110085,_0x2c7a14){_0x110085=_0x110085-0x0;var _0x3f95cd=_0x8ba2[_0x110085];return _0x3f95cd;};'use strict';var _=require(_0x28ba('0x0'));var util=require(_0x28ba('0x1'));var logger=require(_0x28ba('0x2'))('api');var moment=require(_0x28ba('0x3'));var BPromise=require(_0x28ba('0x4'));var rp=require(_0x28ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28ba('0x6'));var config=require(_0x28ba('0x7'));var attributes=require(_0x28ba('0x8'));module[_0x28ba('0x9')]=function(_0x3d039d,_0x24cbfc){return _0x3d039d['define'](_0x28ba('0xa'),attributes,{'tableName':_0x28ba('0xb'),'paranoid':![],'indexes':[{'name':_0x28ba('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 df99a81..708bbb8 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x81d23e,_0x176dc5){var _0x1ec56d=function(_0x336238){while(--_0x336238){_0x81d23e['push'](_0x81d23e['shift']());}};_0x1ec56d(++_0x176dc5);}(_0xda2d,0x102));var _0xdda2=function(_0x233b33,_0x3a372f){_0x233b33=_0x233b33-0x0;var _0x3fee6a=_0xda2d[_0x233b33];return _0x3fee6a;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5354ab,_0x2af0f7){var _0x2ab6db=function(_0x28e714){while(--_0x28e714){_0x5354ab['push'](_0x5354ab['shift']());}};_0x2ab6db(++_0x2af0f7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1333c7,_0x313346){_0x1333c7=_0x1333c7-0x0;var _0x3b1232=_0x5f2f[_0x1333c7];return _0x3b1232;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index cd65928..947dc22 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 _0xe366=['getSounds','post','create','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds'];(function(_0x335054,_0x44093e){var _0x3dc99e=function(_0x397506){while(--_0x397506){_0x335054['push'](_0x335054['shift']());}};_0x3dc99e(++_0x44093e);}(_0xe366,0x199));var _0x6e36=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xe366[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x6e36('0x0'));var util=require(_0x6e36('0x1'));var path=require(_0x6e36('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e36('0x3'));var router=express[_0x6e36('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6e36('0x5'));var config=require('../../config/environment');var controller=require(_0x6e36('0x6'));router[_0x6e36('0x7')]('/',auth[_0x6e36('0x8')](),controller['index']);router[_0x6e36('0x7')](_0x6e36('0x9'),auth[_0x6e36('0x8')](),controller['show']);router[_0x6e36('0x7')](_0x6e36('0xa'),auth['isAuthenticated'](),controller[_0x6e36('0xb')]);router[_0x6e36('0xc')]('/',auth['isAuthenticated'](),controller[_0x6e36('0xd')]);router[_0x6e36('0xc')](_0x6e36('0xa'),auth[_0x6e36('0x8')](),controller[_0x6e36('0xe')]);router['put'](_0x6e36('0x9'),auth[_0x6e36('0x8')](),controller[_0x6e36('0xf')]);router[_0x6e36('0x10')](_0x6e36('0x9'),auth[_0x6e36('0x8')](),controller[_0x6e36('0x11')]);router['delete'](_0x6e36('0x12'),auth['isAuthenticated'](),controller[_0x6e36('0x13')]);module[_0x6e36('0x14')]=router; \ No newline at end of file +var _0x7352=['delete','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','destroy'];(function(_0x403484,_0x33b8ba){var _0x55b2bc=function(_0x1f9b3a){while(--_0x1f9b3a){_0x403484['push'](_0x403484['shift']());}};_0x55b2bc(++_0x33b8ba);}(_0x7352,0x64));var _0x2735=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0x7352[_0x3a0f77];return _0x54fd0c;};'use strict';var multer=require(_0x2735('0x0'));var util=require(_0x2735('0x1'));var path=require('path');var timeout=require(_0x2735('0x2'));var express=require(_0x2735('0x3'));var router=express['Router']();var auth=require(_0x2735('0x4'));var interaction=require(_0x2735('0x5'));var config=require(_0x2735('0x6'));var controller=require(_0x2735('0x7'));router[_0x2735('0x8')]('/',auth[_0x2735('0x9')](),controller[_0x2735('0xa')]);router[_0x2735('0x8')]('/:id',auth[_0x2735('0x9')](),controller['show']);router['get'](_0x2735('0xb'),auth[_0x2735('0x9')](),controller[_0x2735('0xc')]);router[_0x2735('0xd')]('/',auth['isAuthenticated'](),controller[_0x2735('0xe')]);router['post'](_0x2735('0xb'),auth[_0x2735('0x9')](),controller[_0x2735('0xf')]);router[_0x2735('0x10')](_0x2735('0x11'),auth[_0x2735('0x9')](),controller[_0x2735('0x12')]);router['delete']('/:id',auth[_0x2735('0x9')](),controller[_0x2735('0x13')]);router[_0x2735('0x14')](_0x2735('0x15'),auth[_0x2735('0x9')](),controller[_0x2735('0x16')]);module[_0x2735('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7df7891..7117272 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 _0x8c2e=['custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x22abe7,_0x16ea1a){var _0x17fc4e=function(_0x487a19){while(--_0x487a19){_0x22abe7['push'](_0x22abe7['shift']());}};_0x17fc4e(++_0x16ea1a);}(_0x8c2e,0x17c));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe8c2('0x0'));module[_0xe8c2('0x1')]={'name':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xe8c2('0x3')](_0xe8c2('0x4'),_0xe8c2('0x5'),_0xe8c2('0x6'),'quietmp3nb',_0xe8c2('0x7'),_0xe8c2('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![],'defaultValue':_0xe8c2('0x9')},'format':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'stamp':{'type':_0xe8c2('0xa')},'defaultEntry':{'type':Sequelize[_0xe8c2('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7aa5=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','quietmp3nb','quietmp3','STRING'];(function(_0x3977dc,_0x18499a){var _0x40e46e=function(_0x3ea4bc){while(--_0x3ea4bc){_0x3977dc['push'](_0x3977dc['shift']());}};_0x40e46e(++_0x18499a);}(_0x7aa5,0x10b));var _0x57aa=function(_0x54b7a6,_0x4f6cb9){_0x54b7a6=_0x54b7a6-0x0;var _0x4ecd83=_0x7aa5[_0x54b7a6];return _0x4ecd83;};'use strict';var Sequelize=require(_0x57aa('0x0'));module[_0x57aa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x57aa('0x2')},'mode':{'type':Sequelize[_0x57aa('0x3')](_0x57aa('0x4'),_0x57aa('0x5'),'mp3nb',_0x57aa('0x6'),_0x57aa('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x57aa('0x5')},'directory':{'type':Sequelize[_0x57aa('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x57aa('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x57aa('0x8')],'allowNull':!![],'defaultValue':_0x57aa('0x9')},'format':{'type':Sequelize[_0x57aa('0x8')],'allowNull':!![]},'stamp':{'type':_0x57aa('0xa')},'defaultEntry':{'type':Sequelize[_0x57aa('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 0d4a98a..a573830 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x239caf,_0xb45e6a){var _0x1813e0=function(_0x41da84){while(--_0x41da84){_0x239caf['push'](_0x239caf['shift']());}};_0x1813e0(++_0xb45e6a);}(_0xb10b,0x12a));var _0xbb10=function(_0x49155d,_0x2bb881){_0x49155d=_0x49155d-0x0;var _0x4c5f0f=_0xb10b[_0x49155d];return _0x4c5f0f;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x42dbdb,_0x53e6f0){var _0xa1f510=function(_0x34290a){while(--_0x34290a){_0x42dbdb['push'](_0x42dbdb['shift']());}};_0xa1f510(++_0x53e6f0);}(_0xb10b,0x12a));var _0xbb10=function(_0x2598f0,_0x3d61ff){_0x2598f0=_0x2598f0-0x0;var _0x4448c8=_0xb10b[_0x2598f0];return _0x4448c8;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 43c51ae..0b3b388 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 _0xb049=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','path','../../config/environment'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0xb049,0x118));var _0x9b04=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb049[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x9b04('0x0'));var util=require('util');var logger=require(_0x9b04('0x1'))(_0x9b04('0x2'));var moment=require(_0x9b04('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b04('0x4'));var rimraf=require('rimraf');var config=require(_0x9b04('0x5'));var attributes=require(_0x9b04('0x6'));module[_0x9b04('0x7')]=function(_0x1f69e1,_0x524f48){return _0x1f69e1[_0x9b04('0x8')](_0x9b04('0x9'),attributes,{'tableName':_0x9b04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccc9=['api','moment','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x41b89d,_0x5ae8f9){var _0x22a2c5=function(_0x129c8d){while(--_0x129c8d){_0x41b89d['push'](_0x41b89d['shift']());}};_0x22a2c5(++_0x5ae8f9);}(_0xccc9,0x190));var _0x9ccc=function(_0x61d355,_0x3172e1){_0x61d355=_0x61d355-0x0;var _0x31ef71=_0xccc9[_0x61d355];return _0x31ef71;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9ccc('0x0'));var moment=require(_0x9ccc('0x1'));var BPromise=require(_0x9ccc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ccc('0x3'));var rimraf=require('rimraf');var config=require(_0x9ccc('0x4'));var attributes=require(_0x9ccc('0x5'));module[_0x9ccc('0x6')]=function(_0x6a94ec,_0x42a273){return _0x6a94ec[_0x9ccc('0x7')](_0x9ccc('0x8'),attributes,{'tableName':_0x9ccc('0x9'),'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 87cf29e..9d8e576 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 _0x7ce4=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util'];(function(_0x596a82,_0x24f446){var _0x17262a=function(_0x231893){while(--_0x231893){_0x596a82['push'](_0x596a82['shift']());}};_0x17262a(++_0x24f446);}(_0x7ce4,0x14f));var _0x47ce=function(_0x4dabb1,_0x304306){_0x4dabb1=_0x4dabb1-0x0;var _0x4ab072=_0x7ce4[_0x4dabb1];return _0x4ab072;};'use strict';var _=require('lodash');var util=require(_0x47ce('0x0'));var moment=require(_0x47ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x47ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47ce('0x3'))['db'];var utils=require(_0x47ce('0x4'));var logger=require(_0x47ce('0x5'))(_0x47ce('0x6'));var config=require(_0x47ce('0x7'));var jayson=require(_0x47ce('0x8'));var client=jayson['client'][_0x47ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa3dd96,_0x5958f9,_0x2eb884){return new BPromise(function(_0x5ed1c5,_0x1edc78){return client[_0x47ce('0xa')](_0xa3dd96,_0x2eb884)[_0x47ce('0xb')](function(_0x16ad26){logger['info'](_0x47ce('0xc'),_0x5958f9,'request\x20sent');logger['debug'](_0x47ce('0xd'),_0x5958f9,_0x47ce('0xe'),JSON[_0x47ce('0xf')](_0x16ad26));if(_0x16ad26['error']){if(_0x16ad26['error'][_0x47ce('0x10')]===0x1f4){logger[_0x47ce('0x11')](_0x47ce('0xc'),_0x5958f9,_0x16ad26['error'][_0x47ce('0x12')]);return _0x1edc78(_0x16ad26['error'][_0x47ce('0x12')]);}logger[_0x47ce('0x11')](_0x47ce('0xc'),_0x5958f9,_0x16ad26[_0x47ce('0x11')]['message']);return _0x5ed1c5(_0x16ad26['error']['message']);}else{logger['info'](_0x47ce('0xc'),_0x5958f9,_0x47ce('0xe'));_0x5ed1c5(_0x16ad26[_0x47ce('0x13')][_0x47ce('0x12')]);}})[_0x47ce('0x14')](function(_0x5915be){logger[_0x47ce('0x11')](_0x47ce('0xc'),_0x5958f9,_0x5915be);_0x1edc78(_0x5915be);});});} \ No newline at end of file +var _0x842e=['rpc','jayson/promise','client','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x842e,0xd5));var _0xe842=function(_0x5ee607,_0x5ef350){_0x5ee607=_0x5ee607-0x0;var _0x49a75a=_0x842e[_0x5ee607];return _0x49a75a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe842('0x0'));var BPromise=require(_0xe842('0x1'));var rs=require(_0xe842('0x2'));var fs=require('fs');var Redis=require(_0xe842('0x3'));var db=require(_0xe842('0x4'))['db'];var utils=require(_0xe842('0x5'));var logger=require(_0xe842('0x6'))(_0xe842('0x7'));var config=require('../../config/environment');var jayson=require(_0xe842('0x8'));var client=jayson[_0xe842('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1505db,_0x107bd8,_0x1bc70e){return new BPromise(function(_0x5208ca,_0x2bf14a){return client[_0xe842('0xa')](_0x1505db,_0x1bc70e)[_0xe842('0xb')](function(_0x7f027a){logger[_0xe842('0xc')](_0xe842('0xd'),_0x107bd8,_0xe842('0xe'));logger[_0xe842('0xf')](_0xe842('0x10'),_0x107bd8,_0xe842('0xe'),JSON['stringify'](_0x7f027a));if(_0x7f027a[_0xe842('0x11')]){if(_0x7f027a['error'][_0xe842('0x12')]===0x1f4){logger[_0xe842('0x11')](_0xe842('0xd'),_0x107bd8,_0x7f027a[_0xe842('0x11')][_0xe842('0x13')]);return _0x2bf14a(_0x7f027a[_0xe842('0x11')][_0xe842('0x13')]);}logger[_0xe842('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x107bd8,_0x7f027a[_0xe842('0x11')]['message']);return _0x5208ca(_0x7f027a[_0xe842('0x11')][_0xe842('0x13')]);}else{logger[_0xe842('0xc')](_0xe842('0xd'),_0x107bd8,'request\x20sent');_0x5208ca(_0x7f027a[_0xe842('0x14')][_0xe842('0x13')]);}})[_0xe842('0x15')](function(_0x373d53){logger[_0xe842('0x11')](_0xe842('0xd'),_0x107bd8,_0x373d53);_0x2bf14a(_0x373d53);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7f1ad9b..6175a91 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 _0x5c48=['show','/:id/users','getAgents','post','create','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4a808f,_0x146501){var _0x6f28c8=function(_0x12cc81){while(--_0x12cc81){_0x4a808f['push'](_0x4a808f['shift']());}};_0x6f28c8(++_0x146501);}(_0x5c48,0xc3));var _0x85c4=function(_0x444b1b,_0x5efca4){_0x444b1b=_0x444b1b-0x0;var _0x2c0363=_0x5c48[_0x444b1b];return _0x2c0363;};'use strict';var multer=require(_0x85c4('0x0'));var util=require(_0x85c4('0x1'));var path=require(_0x85c4('0x2'));var timeout=require(_0x85c4('0x3'));var express=require('express');var router=express[_0x85c4('0x4')]();var auth=require(_0x85c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x85c4('0x6'));router[_0x85c4('0x7')]('/',auth[_0x85c4('0x8')](),controller[_0x85c4('0x9')]);router[_0x85c4('0x7')](_0x85c4('0xa'),auth[_0x85c4('0x8')](),controller[_0x85c4('0xb')]);router[_0x85c4('0x7')]('/:id',auth[_0x85c4('0x8')](),controller[_0x85c4('0xc')]);router[_0x85c4('0x7')](_0x85c4('0xd'),auth[_0x85c4('0x8')](),controller[_0x85c4('0xe')]);router[_0x85c4('0xf')]('/',auth[_0x85c4('0x8')](),controller[_0x85c4('0x10')]);router[_0x85c4('0xf')](_0x85c4('0xd'),auth[_0x85c4('0x8')](),controller['addAgents']);router['put'](_0x85c4('0x11'),auth['isAuthenticated'](),controller[_0x85c4('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85c4('0x13')]);router[_0x85c4('0x14')]('/:id/users',auth[_0x85c4('0x8')](),controller[_0x85c4('0x15')]);module[_0x85c4('0x16')]=router; \ No newline at end of file +var _0x2779=['getAgents','create','post','update','destroy','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users'];(function(_0x204190,_0x3f7343){var _0x1f8142=function(_0xbdcffa){while(--_0xbdcffa){_0x204190['push'](_0x204190['shift']());}};_0x1f8142(++_0x3f7343);}(_0x2779,0x1ea));var _0x9277=function(_0x1ce38a,_0x45dc42){_0x1ce38a=_0x1ce38a-0x0;var _0x5cc0e7=_0x2779[_0x1ce38a];return _0x5cc0e7;};'use strict';var multer=require(_0x9277('0x0'));var util=require('util');var path=require(_0x9277('0x1'));var timeout=require(_0x9277('0x2'));var express=require(_0x9277('0x3'));var router=express['Router']();var auth=require(_0x9277('0x4'));var interaction=require(_0x9277('0x5'));var config=require(_0x9277('0x6'));var controller=require(_0x9277('0x7'));router[_0x9277('0x8')]('/',auth[_0x9277('0x9')](),controller[_0x9277('0xa')]);router[_0x9277('0x8')](_0x9277('0xb'),auth[_0x9277('0x9')](),controller[_0x9277('0xc')]);router[_0x9277('0x8')](_0x9277('0xd'),auth[_0x9277('0x9')](),controller[_0x9277('0xe')]);router[_0x9277('0x8')](_0x9277('0xf'),auth[_0x9277('0x9')](),controller[_0x9277('0x10')]);router['post']('/',auth[_0x9277('0x9')](),controller[_0x9277('0x11')]);router[_0x9277('0x12')](_0x9277('0xf'),auth[_0x9277('0x9')](),controller['addAgents']);router['put'](_0x9277('0xd'),auth[_0x9277('0x9')](),controller[_0x9277('0x13')]);router['delete']('/:id',auth[_0x9277('0x9')](),controller[_0x9277('0x14')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x9277('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8360851..f221629 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 _0xa8a9=['exports','name','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x5d0a80,_0x3a16b7){var _0x10215d=function(_0xe555ea){while(--_0xe555ea){_0x5d0a80['push'](_0x5d0a80['shift']());}};_0x10215d(++_0x3a16b7);}(_0xa8a9,0x180));var _0x9a8a=function(_0x23eb6d,_0x5b0516){_0x23eb6d=_0x23eb6d-0x0;var _0x1dfed9=_0xa8a9[_0x23eb6d];return _0x1dfed9;};'use strict';var Sequelize=require(_0x9a8a('0x0'));module[_0x9a8a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9a8a('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x31c9a8){return _0x9a8a('0x3')+this[_0x9a8a('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x9a8a('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x9a8a('0x6')]}}; \ No newline at end of file +var _0xe4f2=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x2f29c9,_0x58dd8c){var _0x4c68c6=function(_0x308b9a){while(--_0x308b9a){_0x2f29c9['push'](_0x2f29c9['shift']());}};_0x4c68c6(++_0x58dd8c);}(_0xe4f2,0xf0));var _0x2e4f=function(_0x3acb0f,_0x422e6f){_0x3acb0f=_0x3acb0f-0x0;var _0x5bdb4f=_0xe4f2[_0x3acb0f];return _0x5bdb4f;};'use strict';var Sequelize=require(_0x2e4f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e4f('0x1')],'allowNull':![],'unique':_0x2e4f('0x2')},'prefix':{'type':Sequelize[_0x2e4f('0x3')],'get':function(_0x12fbfa){return _0x2e4f('0x4')+this[_0x2e4f('0x5')](_0x2e4f('0x2'))+'-';}},'description':{'type':Sequelize[_0x2e4f('0x1')]},'callerIdAll':{'type':Sequelize[_0x2e4f('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x2e4f('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9cf939f..dac024f 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 _0x1b16=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','VoicePrefix','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./voicePrefix.socket','end','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3c2c62,_0x2033c2){var _0x58bcb8=function(_0x25c172){while(--_0x25c172){_0x3c2c62['push'](_0x3c2c62['shift']());}};_0x58bcb8(++_0x2033c2);}(_0x1b16,0x1ac));var _0x61b1=function(_0xd95b05,_0x46018d){_0xd95b05=_0xd95b05-0x0;var _0x109df8=_0x1b16[_0xd95b05];return _0x109df8;};'use strict';var pdf=require(_0x61b1('0x0'));var emlformat=require(_0x61b1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61b1('0x2'));var moment=require(_0x61b1('0x3'));var BPromise=require(_0x61b1('0x4'));var Mustache=require(_0x61b1('0x5'));var util=require(_0x61b1('0x6'));var path=require(_0x61b1('0x7'));var sox=require(_0x61b1('0x8'));var csv=require(_0x61b1('0x9'));var ejs=require(_0x61b1('0xa'));var fs=require('fs');var _=require(_0x61b1('0xb'));var squel=require(_0x61b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x61b1('0xd'));var deskjs=require(_0x61b1('0xe'));var toCsv=require(_0x61b1('0x9'));var querystring=require(_0x61b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x61b1('0x10'));var authService=require(_0x61b1('0x11'));var qs=require(_0x61b1('0x12'));var as=require(_0x61b1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61b1('0x14'))(_0x61b1('0x15'));var utils=require('../../config/utils');var config=require(_0x61b1('0x16'));var db=require(_0x61b1('0x17'))['db'];config['redis']=_[_0x61b1('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x61b1('0x19'))(new Redis(config[_0x61b1('0x1a')]));require(_0x61b1('0x1b'))['register'](socket);function respondWithStatusCode(_0x1b8481,_0x28cdbd){_0x28cdbd=_0x28cdbd||0xcc;return function(_0xcaf92c){if(_0xcaf92c){return _0x1b8481['sendStatus'](_0x28cdbd);}return _0x1b8481['status'](_0x28cdbd)[_0x61b1('0x1c')]();};}function respondWithResult(_0x6f6bf,_0x3fbb57){_0x3fbb57=_0x3fbb57||0xc8;return function(_0x3f6344){if(_0x3f6344){return _0x6f6bf[_0x61b1('0x1d')](_0x3fbb57)[_0x61b1('0x1e')](_0x3f6344);}};}function respondWithFilteredResult(_0x532fb2,_0x19923d){return function(_0x1a00f4){if(_0x1a00f4){var _0x8c2092=_0x1a00f4[_0x61b1('0x1f')],_0x4bbffd=_0x19923d[_0x61b1('0x20')],_0x21c81a=_0x19923d[_0x61b1('0x20')]+_0x19923d[_0x61b1('0x21')],_0xde3eba;if(_0x21c81a>=_0x8c2092){_0x21c81a=_0x8c2092;_0xde3eba=0xc8;}else{_0xde3eba=0xce;}_0x532fb2[_0x61b1('0x1d')](_0xde3eba);return _0x532fb2['set'](_0x61b1('0x22'),_0x4bbffd+'-'+_0x21c81a+'/'+_0x8c2092)[_0x61b1('0x1e')](_0x1a00f4);}return null;};}function patchUpdates(_0x558f4c){return function(_0x27ffc3){try{jsonpatch[_0x61b1('0x23')](_0x27ffc3,_0x558f4c,!![]);}catch(_0x5811ad){return BPromise['reject'](_0x5811ad);}return _0x27ffc3[_0x61b1('0x24')]();};}function saveUpdates(_0x505407,_0x4f1cf0){return function(_0x126439){if(_0x126439){return _0x126439[_0x61b1('0x25')](_0x505407)['then'](function(_0x3def3a){return _0x3def3a;});}return null;};}function removeEntity(_0x15c018,_0x524419){return function(_0x3f12f6){if(_0x3f12f6){return _0x3f12f6[_0x61b1('0x26')]()[_0x61b1('0x27')](function(){var _0x3f1d41=_0x3f12f6[_0x61b1('0x28')]({'plain':!![]});var _0x3c990a=_0x61b1('0x29');return db[_0x61b1('0x2a')]['destroy']({'where':{'type':_0x3c990a,'resourceId':_0x3f1d41['id']}})[_0x61b1('0x27')](function(){return _0x3f12f6;});})[_0x61b1('0x27')](function(){_0x15c018['status'](0xcc)[_0x61b1('0x1c')]();});}};}function handleEntityNotFound(_0x3e901e,_0x15ef6e){return function(_0x21657f){if(!_0x21657f){_0x3e901e[_0x61b1('0x2b')](0x194);}return _0x21657f;};}function handleError(_0x19d50c,_0x23c21f){_0x23c21f=_0x23c21f||0x1f4;return function(_0x437b90){logger[_0x61b1('0x2c')](_0x437b90['stack']);if(_0x437b90[_0x61b1('0x2d')]){delete _0x437b90[_0x61b1('0x2d')];}_0x19d50c['status'](_0x23c21f)[_0x61b1('0x2e')](_0x437b90);};}exports['index']=function(_0x353f64,_0x1455a4){var _0x429c23={},_0x57ff6c={},_0x1fe5b0={'count':0x0,'rows':[]};var _0x24a987=_[_0x61b1('0x2f')](db['VoicePrefix'][_0x61b1('0x30')],function(_0x56cbd6){return{'name':_0x56cbd6[_0x61b1('0x31')],'type':_0x56cbd6[_0x61b1('0x32')][_0x61b1('0x33')]};});_0x57ff6c[_0x61b1('0x34')]=_[_0x61b1('0x2f')](_0x24a987,_0x61b1('0x2d'));_0x57ff6c[_0x61b1('0x35')]=_[_0x61b1('0x36')](_0x353f64['query']);_0x57ff6c[_0x61b1('0x37')]=_['intersection'](_0x57ff6c[_0x61b1('0x34')],_0x57ff6c['query']);_0x429c23['attributes']=_[_0x61b1('0x38')](_0x57ff6c[_0x61b1('0x34')],qs['fields'](_0x353f64[_0x61b1('0x35')][_0x61b1('0x39')]));_0x429c23[_0x61b1('0x3a')]=_0x429c23[_0x61b1('0x3a')][_0x61b1('0x3b')]?_0x429c23[_0x61b1('0x3a')]:_0x57ff6c['model'];if(!_0x353f64['query'][_0x61b1('0x3c')](_0x61b1('0x3d'))){_0x429c23[_0x61b1('0x21')]=qs[_0x61b1('0x21')](_0x353f64[_0x61b1('0x35')][_0x61b1('0x21')]);_0x429c23[_0x61b1('0x20')]=qs[_0x61b1('0x20')](_0x353f64[_0x61b1('0x35')]['offset']);}_0x429c23[_0x61b1('0x3e')]=qs['sort'](_0x353f64[_0x61b1('0x35')][_0x61b1('0x3f')]);_0x429c23[_0x61b1('0x40')]=qs[_0x61b1('0x37')](_[_0x61b1('0x41')](_0x353f64[_0x61b1('0x35')],_0x57ff6c[_0x61b1('0x37')]),_0x24a987);if(_0x353f64[_0x61b1('0x35')][_0x61b1('0x42')]){_0x429c23[_0x61b1('0x40')]=_[_0x61b1('0x43')](_0x429c23[_0x61b1('0x40')],{'$or':_['map'](_0x24a987,function(_0x26a8ee){if(_0x26a8ee[_0x61b1('0x32')]!==_0x61b1('0x44')){var _0x1e8941={};_0x1e8941[_0x26a8ee[_0x61b1('0x2d')]]={'$like':'%'+_0x353f64[_0x61b1('0x35')][_0x61b1('0x42')]+'%'};return _0x1e8941;}})});}_0x429c23=_['merge']({},_0x429c23,_0x353f64['options']);var _0x21fb1a={'where':_0x429c23[_0x61b1('0x40')]};return db['VoicePrefix'][_0x61b1('0x1f')](_0x21fb1a)['then'](function(_0x2b2be7){_0x1fe5b0[_0x61b1('0x1f')]=_0x2b2be7;if(_0x353f64['query'][_0x61b1('0x45')]){_0x429c23[_0x61b1('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0x61b1('0x47')](_0x429c23);})[_0x61b1('0x27')](function(_0x42379a){_0x1fe5b0[_0x61b1('0x48')]=_0x42379a;return _0x1fe5b0;})[_0x61b1('0x27')](respondWithFilteredResult(_0x1455a4,_0x429c23))[_0x61b1('0x49')](handleError(_0x1455a4,null));};exports[_0x61b1('0x4a')]=function(_0x14d52b,_0x38655a){var _0x7cba84={'raw':![],'where':{'id':_0x14d52b[_0x61b1('0x4b')]['id']}},_0x2a3131={};_0x2a3131[_0x61b1('0x34')]=_['keys'](db['VoicePrefix'][_0x61b1('0x30')]);_0x2a3131[_0x61b1('0x35')]=_[_0x61b1('0x36')](_0x14d52b['query']);_0x2a3131[_0x61b1('0x37')]=_[_0x61b1('0x38')](_0x2a3131[_0x61b1('0x34')],_0x2a3131[_0x61b1('0x35')]);_0x7cba84[_0x61b1('0x3a')]=_[_0x61b1('0x38')](_0x2a3131[_0x61b1('0x34')],qs[_0x61b1('0x39')](_0x14d52b[_0x61b1('0x35')][_0x61b1('0x39')]));_0x7cba84[_0x61b1('0x3a')]=_0x7cba84[_0x61b1('0x3a')][_0x61b1('0x3b')]?_0x7cba84['attributes']:_0x2a3131[_0x61b1('0x34')];if(_0x14d52b['query']['includeAll']){_0x7cba84[_0x61b1('0x46')]=[{'all':!![]}];}_0x7cba84=_[_0x61b1('0x43')]({},_0x7cba84,_0x14d52b[_0x61b1('0x4c')]);return db[_0x61b1('0x4d')][_0x61b1('0x4e')](_0x7cba84)[_0x61b1('0x27')](handleEntityNotFound(_0x38655a,null))[_0x61b1('0x27')](respondWithResult(_0x38655a,null))['catch'](handleError(_0x38655a,null));};exports[_0x61b1('0x26')]=function(_0x59ca78,_0x4240e2){return db[_0x61b1('0x4d')][_0x61b1('0x4e')]({'where':{'id':_0x59ca78[_0x61b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4240e2,null))[_0x61b1('0x27')](removeEntity(_0x4240e2,null))[_0x61b1('0x49')](handleError(_0x4240e2,null));};exports['describe']=function(_0x5d8cab,_0x46b975){return db[_0x61b1('0x4d')][_0x61b1('0x4f')]()[_0x61b1('0x27')](respondWithResult(_0x46b975,null))[_0x61b1('0x49')](handleError(_0x46b975,null));};exports[_0x61b1('0x50')]=function(_0x1c791a,_0x5f07f2){var _0x6658ec;return db[_0x61b1('0x51')][_0x61b1('0x52')](function(_0x134333){return db[_0x61b1('0x4d')][_0x61b1('0x50')](_0x1c791a[_0x61b1('0x53')],{'transaction':_0x134333})[_0x61b1('0x27')](function(_0x2d42fc){_0x6658ec=_0x2d42fc[_0x61b1('0x28')]({'plain':!![]});return db[_0x61b1('0x54')][_0x61b1('0x4e')]({'where':{'id':_0x6658ec[_0x61b1('0x55')]},'raw':!![]})[_0x61b1('0x27')](function(_0x21c983){return createVoicePrefixExtensions(_0x6658ec,_0x21c983,_0x134333);});});})[_0x61b1('0x27')](function(){var _0x35293a=_0x1c791a[_0x61b1('0x56')][_0x61b1('0x28')]({'plain':!![]});if(!_0x35293a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35293a[_0x61b1('0x57')]==='user'){var _0x1c3467=_0x6658ec;return db[_0x61b1('0x58')][_0x61b1('0x4e')]({'where':{'name':_0x61b1('0x29'),'userProfileId':_0x35293a['userProfileId']},'raw':!![]})[_0x61b1('0x27')](function(_0x39925d){if(_0x39925d&&_0x39925d[_0x61b1('0x59')]===0x0){return db[_0x61b1('0x2a')]['create']({'name':_0x1c3467[_0x61b1('0x2d')],'resourceId':_0x1c3467['id'],'type':_0x39925d['name'],'sectionId':_0x39925d['id']},{})[_0x61b1('0x27')](function(){return _0x6658ec;});}else{return _0x6658ec;}})[_0x61b1('0x49')](function(_0xf7f356){logger[_0x61b1('0x2c')](_0x61b1('0x5a'),_0xf7f356);throw _0xf7f356;});}return _0x6658ec;})['then'](respondWithResult(_0x5f07f2,null))[_0x61b1('0x49')](handleError(_0x5f07f2,null));};function Extension(_0x224e8c,_0x4758d0,_0x1c40c0,_0x263d5b){this[_0x61b1('0x5b')]='from-sip';this[_0x61b1('0x5c')]=_0x224e8c;this[_0x61b1('0x5d')]=_0x1c40c0;this[_0x61b1('0x32')]=_0x61b1('0x5e');this['description']=_0x61b1('0x5f');this['priority']=_0x4758d0;this[_0x61b1('0x60')]=_0x263d5b;}function createVoicePrefixExtensions(_0x50727a,_0x147965,_0x37d809){return new BPromise(function(_0x1508ba,_0x31f520){var _0xabb3cc=new Extension(formatPrefixName(_0x50727a[_0x61b1('0x61')]),0x1,_0x61b1('0x62'),_0x61b1('0x63'));_0xabb3cc[_0x61b1('0x64')]=_0x50727a['id'];return db[_0x61b1('0x54')][_0x61b1('0x50')](_0xabb3cc,{'transaction':_0x37d809})[_0x61b1('0x27')](function(_0x5d49b8){var _0x53fa26=_0x5d49b8[_0x61b1('0x28')]({'plain':!![]});var _0x406604=_[_0x61b1('0x2f')](addVoicePrefixExtensions(_0x50727a,_0x147965),function(_0x50e849){_0x50e849[_0x61b1('0x55')]=_0x53fa26['id'];_0x50e849[_0x61b1('0x64')]=_0x50727a['id'];return _0x50e849;});return db[_0x61b1('0x54')][_0x61b1('0x65')](_0x406604,{'transaction':_0x37d809})[_0x61b1('0x27')](function(_0x5f3c42){if(!_0x5f3c42){return _0x31f520(_0x61b1('0x66'));}else{return _0x1508ba(_0x5f3c42);}})[_0x61b1('0x49')](function(_0x3ac766){return _0x31f520(_0x3ac766);});});;});};function addVoicePrefixExtensions(_0x1085cc,_0x4f0b77){var _0xe09396=[];var _0x990d73=formatPrefixName(_0x1085cc[_0x61b1('0x61')]);_0xe09396[_0x61b1('0x67')](new Extension(_0x990d73,0x2,_0x61b1('0x68'),'CDR(prefix)='+_0x1085cc[_0x61b1('0x2d')]));if(_0x1085cc[_0x61b1('0x69')]){_0xe09396['push'](new Extension(_0x990d73,0x3,_0x61b1('0x68'),_0x61b1('0x6a')+_0x1085cc[_0x61b1('0x69')]));}else{_0xe09396[_0x61b1('0x67')](new Extension(_0x990d73,0x3,_0x61b1('0x62'),_0x61b1('0x6b')));}_0xe09396[_0x61b1('0x67')](new Extension(_0x990d73,0x4,_0x61b1('0x6c'),_0x4f0b77['context']+','+_0x61b1('0x6d')+(0x8+_0x1085cc[_0x61b1('0x2d')][_0x61b1('0x3b')])+'}'+','+0x1));return _0xe09396;}function formatPrefixName(_0x26f895){var _0x14617a='_';for(var _0x230ba8=0x0;_0x230ba8<_0x26f895[_0x61b1('0x3b')];_0x230ba8++){if(_0x26f895[_0x61b1('0x6e')](_0x230ba8)=='-'){_0x14617a+=_0x26f895['charAt'](_0x230ba8);}else{_0x14617a+='['+_0x26f895[_0x61b1('0x6e')](_0x230ba8)+']';}}_0x14617a+='.';return _0x14617a;}exports[_0x61b1('0x25')]=function(_0x2382db,_0x62a233,_0x196802){var _0x4a9968=_0x2382db[_0x61b1('0x53')];_0x4a9968[_0x61b1('0x61')]=_0x61b1('0x6f')+_0x4a9968[_0x61b1('0x2d')]+'-';return db[_0x61b1('0x51')][_0x61b1('0x52')](function(_0x166a1e){return db[_0x61b1('0x4d')]['update'](_0x4a9968,{'where':{'id':_0x4a9968['id']},'transaction':_0x166a1e})['then'](function(){return db[_0x61b1('0x54')][_0x61b1('0x26')]({'where':{'VoicePrefixId':_0x4a9968['id']},'transaction':_0x166a1e})[_0x61b1('0x27')](function(){return db['VoiceExtension'][_0x61b1('0x4e')]({'where':{'id':_0x4a9968[_0x61b1('0x55')]},'raw':!![]})[_0x61b1('0x27')](function(_0x4efb11){return createVoicePrefixExtensions(_0x4a9968,_0x4efb11,_0x166a1e);});});});})[_0x61b1('0x27')](function(){return db[_0x61b1('0x4d')][_0x61b1('0x70')](_0x4a9968['id']);})[_0x61b1('0x27')](respondWithResult(_0x62a233,null))[_0x61b1('0x49')](handleError(_0x62a233,null));};exports['addAgents']=function(_0x553637,_0x2c2dac,_0x15c79f){return db[_0x61b1('0x4d')][_0x61b1('0x4e')]({'where':{'id':_0x553637[_0x61b1('0x4b')]['id']}})[_0x61b1('0x27')](handleEntityNotFound(_0x2c2dac,null))['then'](function(_0x34d0ca){if(_0x34d0ca){return _0x34d0ca[_0x61b1('0x71')](_0x553637[_0x61b1('0x53')][_0x61b1('0x72')],_[_0x61b1('0x73')](_0x553637[_0x61b1('0x53')],['ids','id'])||{})[_0x61b1('0x74')](function(_0xe06c80){for(var _0x40a79e=0x0;_0x40a79e<_0x553637[_0x61b1('0x53')]['ids'][_0x61b1('0x3b')];_0x40a79e+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x553637['body'][_0x61b1('0x72')][_0x40a79e],'VoicePrefixId':_0x553637[_0x61b1('0x4b')]['id']});}return _0xe06c80;});}})[_0x61b1('0x27')](respondWithResult(_0x2c2dac,null))[_0x61b1('0x49')](handleError(_0x2c2dac,null));};exports[_0x61b1('0x75')]=function(_0x22ca55,_0x2f61f2,_0xcaf3c7){return db[_0x61b1('0x4d')][_0x61b1('0x4e')]({'where':{'id':_0x22ca55[_0x61b1('0x4b')]['id']}})[_0x61b1('0x27')](handleEntityNotFound(_0x2f61f2,null))[_0x61b1('0x27')](function(_0xa1b429){if(_0xa1b429){return _0xa1b429['removeAgents'](_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')])[_0x61b1('0x27')](function(){if(_[_0x61b1('0x76')](_0x22ca55['query'][_0x61b1('0x72')])){for(var _0x20cea8=0x0;_0x20cea8<_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')][_0x61b1('0x3b')];_0x20cea8+=0x1){socket[_0x61b1('0x77')](_0x61b1('0x78'),{'UserId':Number(_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')][_0x20cea8]),'VoicePrefixId':Number(_0x22ca55['params']['id'])});}}else{socket[_0x61b1('0x77')](_0x61b1('0x78'),{'UserId':Number(_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')]),'VoicePrefixId':Number(_0x22ca55[_0x61b1('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f61f2,null))[_0x61b1('0x49')](handleError(_0x2f61f2,null));};exports[_0x61b1('0x79')]=function(_0xdb9a3a,_0x41f461,_0x3e297e){var _0x126997={};var _0x3e02d6={};var _0x13f23f;var _0x30166b;return db['VoicePrefix'][_0x61b1('0x7a')]({'where':{'id':_0xdb9a3a[_0x61b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41f461,null))[_0x61b1('0x27')](function(_0x582a32){if(_0x582a32){_0x13f23f=_0x582a32;_0x3e02d6[_0x61b1('0x34')]=_[_0x61b1('0x36')](db['User'][_0x61b1('0x30')]);_0x3e02d6['query']=_[_0x61b1('0x36')](_0xdb9a3a['query']);_0x3e02d6['filters']=_[_0x61b1('0x38')](_0x3e02d6[_0x61b1('0x34')],_0x3e02d6['query']);_0x126997[_0x61b1('0x3a')]=_[_0x61b1('0x38')](_0x3e02d6['model'],qs[_0x61b1('0x39')](_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x39')]));_0x126997[_0x61b1('0x3a')]=_0x126997[_0x61b1('0x3a')][_0x61b1('0x3b')]?_0x126997[_0x61b1('0x3a')]:_0x3e02d6[_0x61b1('0x34')];_0x126997[_0x61b1('0x3e')]=qs[_0x61b1('0x3f')](_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x3f')]);_0x126997[_0x61b1('0x40')]=qs[_0x61b1('0x37')](_[_0x61b1('0x41')](_0xdb9a3a[_0x61b1('0x35')],_0x3e02d6[_0x61b1('0x37')]));if(_0xdb9a3a['query'][_0x61b1('0x42')]){_0x126997[_0x61b1('0x40')]=_['merge'](_0x126997[_0x61b1('0x40')],{'$or':_[_0x61b1('0x2f')](_0x126997[_0x61b1('0x3a')],function(_0x3d22c6){var _0x457973={};_0x457973[_0x3d22c6]={'$like':'%'+_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x42')]+'%'};return _0x457973;})});}_0x126997=_[_0x61b1('0x43')]({},_0x126997,_0xdb9a3a['options']);return _0x13f23f[_0x61b1('0x79')](_0x126997);}})[_0x61b1('0x27')](function(_0x3350bd){if(_0x3350bd){_0x30166b=_0x3350bd[_0x61b1('0x3b')];if(!_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x3c')](_0x61b1('0x3d'))){_0x126997[_0x61b1('0x21')]=qs[_0x61b1('0x21')](_0xdb9a3a['query'][_0x61b1('0x21')]);_0x126997[_0x61b1('0x20')]=qs[_0x61b1('0x20')](_0xdb9a3a[_0x61b1('0x35')]['offset']);}return _0x13f23f[_0x61b1('0x79')](_0x126997);}})[_0x61b1('0x27')](function(_0xd712f8){if(_0xd712f8){return _0xd712f8?{'count':_0x30166b,'rows':_0xd712f8}:null;}})[_0x61b1('0x27')](respondWithResult(_0x41f461,null))[_0x61b1('0x49')](handleError(_0x41f461,null));}; \ No newline at end of file +var _0x474d=['No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./voicePrefix.socket','register','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','rows','show','params','keys','length','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','context','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','callerIdAll','PREFIX-CALLERIDALL=','push','NoOp'];(function(_0x1a171d,_0x190bef){var _0xa4abc9=function(_0x369d73){while(--_0x369d73){_0x1a171d['push'](_0x1a171d['shift']());}};_0xa4abc9(++_0x190bef);}(_0x474d,0x10d));var _0xd474=function(_0x95d47d,_0x501e1c){_0x95d47d=_0x95d47d-0x0;var _0x4dd222=_0x474d[_0x95d47d];return _0x4dd222;};'use strict';var pdf=require(_0xd474('0x0'));var emlformat=require(_0xd474('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd474('0x2'));var jsonpatch=require(_0xd474('0x3'));var rp=require(_0xd474('0x4'));var moment=require(_0xd474('0x5'));var BPromise=require(_0xd474('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd474('0x7'));var sox=require('sox');var csv=require(_0xd474('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd474('0x9'));var crypto=require(_0xd474('0xa'));var jsforce=require(_0xd474('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd474('0x8'));var querystring=require(_0xd474('0xc'));var Papa=require(_0xd474('0xd'));var Redis=require(_0xd474('0xe'));var authService=require(_0xd474('0xf'));var qs=require(_0xd474('0x10'));var as=require(_0xd474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd474('0x12'))(_0xd474('0x13'));var utils=require(_0xd474('0x14'));var config=require('../../config/environment');var db=require(_0xd474('0x15'))['db'];config['redis']=_[_0xd474('0x16')](config[_0xd474('0x17')],{'host':_0xd474('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd474('0x19'))[_0xd474('0x1a')](socket);function respondWithStatusCode(_0x6c410d,_0x591b33){_0x591b33=_0x591b33||0xcc;return function(_0x495d30){if(_0x495d30){return _0x6c410d['sendStatus'](_0x591b33);}return _0x6c410d['status'](_0x591b33)[_0xd474('0x1b')]();};}function respondWithResult(_0x1d06cc,_0x4a6326){_0x4a6326=_0x4a6326||0xc8;return function(_0x36d5ca){if(_0x36d5ca){return _0x1d06cc[_0xd474('0x1c')](_0x4a6326)[_0xd474('0x1d')](_0x36d5ca);}};}function respondWithFilteredResult(_0x313584,_0x1daee8){return function(_0x5ece9a){if(_0x5ece9a){var _0x4f1954=_0x5ece9a[_0xd474('0x1e')],_0xc4644c=_0x1daee8[_0xd474('0x1f')],_0x438e52=_0x1daee8[_0xd474('0x1f')]+_0x1daee8[_0xd474('0x20')],_0x1534b4;if(_0x438e52>=_0x4f1954){_0x438e52=_0x4f1954;_0x1534b4=0xc8;}else{_0x1534b4=0xce;}_0x313584['status'](_0x1534b4);return _0x313584[_0xd474('0x21')](_0xd474('0x22'),_0xc4644c+'-'+_0x438e52+'/'+_0x4f1954)['json'](_0x5ece9a);}return null;};}function patchUpdates(_0x4cb789){return function(_0x2329ae){try{jsonpatch['apply'](_0x2329ae,_0x4cb789,!![]);}catch(_0x1d9810){return BPromise[_0xd474('0x23')](_0x1d9810);}return _0x2329ae[_0xd474('0x24')]();};}function saveUpdates(_0x2370fa,_0x57ce62){return function(_0x489fe5){if(_0x489fe5){return _0x489fe5[_0xd474('0x25')](_0x2370fa)[_0xd474('0x26')](function(_0x12b46e){return _0x12b46e;});}return null;};}function removeEntity(_0x2fbb9b,_0x844545){return function(_0x387dae){if(_0x387dae){return _0x387dae[_0xd474('0x27')]()[_0xd474('0x26')](function(){var _0x3de5f2=_0x387dae[_0xd474('0x28')]({'plain':!![]});var _0x1ee82f=_0xd474('0x29');return db[_0xd474('0x2a')]['destroy']({'where':{'type':_0x1ee82f,'resourceId':_0x3de5f2['id']}})['then'](function(){return _0x387dae;});})[_0xd474('0x26')](function(){_0x2fbb9b[_0xd474('0x1c')](0xcc)[_0xd474('0x1b')]();});}};}function handleEntityNotFound(_0x4a4425,_0x552d4b){return function(_0x138959){if(!_0x138959){_0x4a4425[_0xd474('0x2b')](0x194);}return _0x138959;};}function handleError(_0x1a867c,_0x6e2fde){_0x6e2fde=_0x6e2fde||0x1f4;return function(_0x4bc157){logger[_0xd474('0x2c')](_0x4bc157[_0xd474('0x2d')]);if(_0x4bc157['name']){delete _0x4bc157[_0xd474('0x2e')];}_0x1a867c[_0xd474('0x1c')](_0x6e2fde)[_0xd474('0x2f')](_0x4bc157);};}exports[_0xd474('0x30')]=function(_0x32ffe9,_0x708b1b){var _0x4fc612={},_0x4ec578={},_0x2c813e={'count':0x0,'rows':[]};var _0x57af4f=_[_0xd474('0x31')](db['VoicePrefix'][_0xd474('0x32')],function(_0x528c99){return{'name':_0x528c99[_0xd474('0x33')],'type':_0x528c99[_0xd474('0x34')]['key']};});_0x4ec578[_0xd474('0x35')]=_[_0xd474('0x31')](_0x57af4f,_0xd474('0x2e'));_0x4ec578[_0xd474('0x36')]=_['keys'](_0x32ffe9[_0xd474('0x36')]);_0x4ec578['filters']=_['intersection'](_0x4ec578[_0xd474('0x35')],_0x4ec578[_0xd474('0x36')]);_0x4fc612['attributes']=_[_0xd474('0x37')](_0x4ec578['model'],qs['fields'](_0x32ffe9[_0xd474('0x36')][_0xd474('0x38')]));_0x4fc612[_0xd474('0x39')]=_0x4fc612[_0xd474('0x39')]['length']?_0x4fc612[_0xd474('0x39')]:_0x4ec578['model'];if(!_0x32ffe9[_0xd474('0x36')][_0xd474('0x3a')]('nolimit')){_0x4fc612['limit']=qs['limit'](_0x32ffe9[_0xd474('0x36')]['limit']);_0x4fc612[_0xd474('0x1f')]=qs['offset'](_0x32ffe9[_0xd474('0x36')][_0xd474('0x1f')]);}_0x4fc612[_0xd474('0x3b')]=qs[_0xd474('0x3c')](_0x32ffe9['query'][_0xd474('0x3c')]);_0x4fc612[_0xd474('0x3d')]=qs[_0xd474('0x3e')](_[_0xd474('0x3f')](_0x32ffe9[_0xd474('0x36')],_0x4ec578[_0xd474('0x3e')]),_0x57af4f);if(_0x32ffe9[_0xd474('0x36')][_0xd474('0x40')]){_0x4fc612['where']=_[_0xd474('0x41')](_0x4fc612['where'],{'$or':_[_0xd474('0x31')](_0x57af4f,function(_0x592a9d){if(_0x592a9d['type']!==_0xd474('0x42')){var _0x51250e={};_0x51250e[_0x592a9d[_0xd474('0x2e')]]={'$like':'%'+_0x32ffe9[_0xd474('0x36')][_0xd474('0x40')]+'%'};return _0x51250e;}})});}_0x4fc612=_[_0xd474('0x41')]({},_0x4fc612,_0x32ffe9[_0xd474('0x43')]);var _0x1936f6={'where':_0x4fc612[_0xd474('0x3d')]};return db[_0xd474('0x44')]['count'](_0x1936f6)[_0xd474('0x26')](function(_0xff3328){_0x2c813e[_0xd474('0x1e')]=_0xff3328;if(_0x32ffe9[_0xd474('0x36')][_0xd474('0x45')]){_0x4fc612[_0xd474('0x46')]=[{'all':!![]}];}return db[_0xd474('0x44')][_0xd474('0x47')](_0x4fc612);})['then'](function(_0x6ee39c){_0x2c813e[_0xd474('0x48')]=_0x6ee39c;return _0x2c813e;})[_0xd474('0x26')](respondWithFilteredResult(_0x708b1b,_0x4fc612))['catch'](handleError(_0x708b1b,null));};exports[_0xd474('0x49')]=function(_0x32e2cb,_0x36ee57){var _0x4e6712={'raw':![],'where':{'id':_0x32e2cb[_0xd474('0x4a')]['id']}},_0x4f5818={};_0x4f5818[_0xd474('0x35')]=_[_0xd474('0x4b')](db[_0xd474('0x44')][_0xd474('0x32')]);_0x4f5818['query']=_[_0xd474('0x4b')](_0x32e2cb[_0xd474('0x36')]);_0x4f5818[_0xd474('0x3e')]=_['intersection'](_0x4f5818[_0xd474('0x35')],_0x4f5818['query']);_0x4e6712['attributes']=_['intersection'](_0x4f5818[_0xd474('0x35')],qs[_0xd474('0x38')](_0x32e2cb[_0xd474('0x36')][_0xd474('0x38')]));_0x4e6712[_0xd474('0x39')]=_0x4e6712[_0xd474('0x39')][_0xd474('0x4c')]?_0x4e6712[_0xd474('0x39')]:_0x4f5818[_0xd474('0x35')];if(_0x32e2cb['query'][_0xd474('0x45')]){_0x4e6712['include']=[{'all':!![]}];}_0x4e6712=_[_0xd474('0x41')]({},_0x4e6712,_0x32e2cb['options']);return db[_0xd474('0x44')][_0xd474('0x4d')](_0x4e6712)[_0xd474('0x26')](handleEntityNotFound(_0x36ee57,null))[_0xd474('0x26')](respondWithResult(_0x36ee57,null))[_0xd474('0x4e')](handleError(_0x36ee57,null));};exports['destroy']=function(_0x3b09c0,_0x3bef16){return db[_0xd474('0x44')][_0xd474('0x4d')]({'where':{'id':_0x3b09c0[_0xd474('0x4a')]['id']}})[_0xd474('0x26')](handleEntityNotFound(_0x3bef16,null))[_0xd474('0x26')](removeEntity(_0x3bef16,null))[_0xd474('0x4e')](handleError(_0x3bef16,null));};exports[_0xd474('0x4f')]=function(_0x57d135,_0x1bcc51){return db['VoicePrefix'][_0xd474('0x4f')]()['then'](respondWithResult(_0x1bcc51,null))['catch'](handleError(_0x1bcc51,null));};exports[_0xd474('0x50')]=function(_0x2c7de1,_0x4b6ed2){var _0x28e9ee;return db[_0xd474('0x51')][_0xd474('0x52')](function(_0x5a8c0a){return db[_0xd474('0x44')][_0xd474('0x50')](_0x2c7de1['body'],{'transaction':_0x5a8c0a})['then'](function(_0xbd3c88){_0x28e9ee=_0xbd3c88[_0xd474('0x28')]({'plain':!![]});return db[_0xd474('0x53')][_0xd474('0x4d')]({'where':{'id':_0x28e9ee[_0xd474('0x54')]},'raw':!![]})[_0xd474('0x26')](function(_0x14cf3f){return createVoicePrefixExtensions(_0x28e9ee,_0x14cf3f,_0x5a8c0a);});});})['then'](function(){var _0x20efaa=_0x2c7de1[_0xd474('0x55')]['get']({'plain':!![]});if(!_0x20efaa)throw new Error(_0xd474('0x56'));if(_0x20efaa[_0xd474('0x57')]===_0xd474('0x55')){var _0x5df60a=_0x28e9ee;return db[_0xd474('0x58')][_0xd474('0x4d')]({'where':{'name':'VoicePrefixes','userProfileId':_0x20efaa[_0xd474('0x59')]},'raw':!![]})[_0xd474('0x26')](function(_0x52106f){if(_0x52106f&&_0x52106f['autoAssociation']===0x0){return db[_0xd474('0x2a')]['create']({'name':_0x5df60a[_0xd474('0x2e')],'resourceId':_0x5df60a['id'],'type':_0x52106f['name'],'sectionId':_0x52106f['id']},{})[_0xd474('0x26')](function(){return _0x28e9ee;});}else{return _0x28e9ee;}})[_0xd474('0x4e')](function(_0x5893db){logger[_0xd474('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5893db);throw _0x5893db;});}return _0x28e9ee;})['then'](respondWithResult(_0x4b6ed2,null))[_0xd474('0x4e')](handleError(_0x4b6ed2,null));};function Extension(_0x7562b0,_0x3860e5,_0x233ea0,_0x54341b){this[_0xd474('0x5a')]=_0xd474('0x5b');this['exten']=_0x7562b0;this[_0xd474('0x5c')]=_0x233ea0;this['type']='system';this[_0xd474('0x5d')]=_0xd474('0x5e');this[_0xd474('0x5f')]=_0x3860e5;this['appdata']=_0x54341b;}function createVoicePrefixExtensions(_0x56e948,_0x247dba,_0x4b9b8b){return new BPromise(function(_0x1fe351,_0x35f00c){var _0xf4b399=new Extension(formatPrefixName(_0x56e948[_0xd474('0x60')]),0x1,'NoOp',_0xd474('0x61'));_0xf4b399[_0xd474('0x62')]=_0x56e948['id'];return db[_0xd474('0x53')][_0xd474('0x50')](_0xf4b399,{'transaction':_0x4b9b8b})['then'](function(_0x22e308){var _0x591046=_0x22e308['get']({'plain':!![]});var _0x3d55a5=_[_0xd474('0x31')](addVoicePrefixExtensions(_0x56e948,_0x247dba),function(_0x671aa2){_0x671aa2['VoiceExtensionId']=_0x591046['id'];_0x671aa2[_0xd474('0x62')]=_0x56e948['id'];return _0x671aa2;});return db['VoiceExtension'][_0xd474('0x63')](_0x3d55a5,{'transaction':_0x4b9b8b})[_0xd474('0x26')](function(_0x137358){if(!_0x137358){return _0x35f00c(_0xd474('0x64'));}else{return _0x1fe351(_0x137358);}})[_0xd474('0x4e')](function(_0x2c878d){return _0x35f00c(_0x2c878d);});});;});};function addVoicePrefixExtensions(_0x43b992,_0x545514){var _0x17dd63=[];var _0x3d4bc5=formatPrefixName(_0x43b992[_0xd474('0x60')]);_0x17dd63['push'](new Extension(_0x3d4bc5,0x2,_0xd474('0x65'),'CDR(prefix)='+_0x43b992['name']));if(_0x43b992[_0xd474('0x66')]){_0x17dd63['push'](new Extension(_0x3d4bc5,0x3,_0xd474('0x65'),_0xd474('0x67')+_0x43b992['callerIdAll']));}else{_0x17dd63[_0xd474('0x68')](new Extension(_0x3d4bc5,0x3,_0xd474('0x69'),_0xd474('0x6a')));}_0x17dd63[_0xd474('0x68')](new Extension(_0x3d4bc5,0x4,_0xd474('0x6b'),_0x545514[_0xd474('0x5a')]+','+_0xd474('0x6c')+(0x8+_0x43b992[_0xd474('0x2e')]['length'])+'}'+','+0x1));return _0x17dd63;}function formatPrefixName(_0x3feb34){var _0x12897d='_';for(var _0x322d3e=0x0;_0x322d3e<_0x3feb34[_0xd474('0x4c')];_0x322d3e++){if(_0x3feb34[_0xd474('0x6d')](_0x322d3e)=='-'){_0x12897d+=_0x3feb34[_0xd474('0x6d')](_0x322d3e);}else{_0x12897d+='['+_0x3feb34[_0xd474('0x6d')](_0x322d3e)+']';}}_0x12897d+='.';return _0x12897d;}exports[_0xd474('0x25')]=function(_0x1c7c52,_0x3dc970,_0x4a8012){var _0xfc4c4c=_0x1c7c52[_0xd474('0x6e')];_0xfc4c4c['prefix']=_0xd474('0x6f')+_0xfc4c4c[_0xd474('0x2e')]+'-';return db[_0xd474('0x51')][_0xd474('0x52')](function(_0x285eea){return db[_0xd474('0x44')]['update'](_0xfc4c4c,{'where':{'id':_0xfc4c4c['id']},'transaction':_0x285eea})[_0xd474('0x26')](function(){return db[_0xd474('0x53')][_0xd474('0x27')]({'where':{'VoicePrefixId':_0xfc4c4c['id']},'transaction':_0x285eea})[_0xd474('0x26')](function(){return db[_0xd474('0x53')][_0xd474('0x4d')]({'where':{'id':_0xfc4c4c['VoiceExtensionId']},'raw':!![]})['then'](function(_0x2eefae){return createVoicePrefixExtensions(_0xfc4c4c,_0x2eefae,_0x285eea);});});});})[_0xd474('0x26')](function(){return db[_0xd474('0x44')][_0xd474('0x70')](_0xfc4c4c['id']);})['then'](respondWithResult(_0x3dc970,null))[_0xd474('0x4e')](handleError(_0x3dc970,null));};exports['addAgents']=function(_0x133714,_0x2c6d2f,_0x38bc83){return db[_0xd474('0x44')][_0xd474('0x4d')]({'where':{'id':_0x133714[_0xd474('0x4a')]['id']}})[_0xd474('0x26')](handleEntityNotFound(_0x2c6d2f,null))[_0xd474('0x26')](function(_0x4ed210){if(_0x4ed210){return _0x4ed210[_0xd474('0x71')](_0x133714[_0xd474('0x6e')][_0xd474('0x72')],_[_0xd474('0x73')](_0x133714['body'],['ids','id'])||{})[_0xd474('0x74')](function(_0x261255){for(var _0x449f7d=0x0;_0x449f7d<_0x133714['body']['ids'][_0xd474('0x4c')];_0x449f7d+=0x1){socket[_0xd474('0x75')](_0xd474('0x76'),{'UserId':_0x133714[_0xd474('0x6e')][_0xd474('0x72')][_0x449f7d],'VoicePrefixId':_0x133714[_0xd474('0x4a')]['id']});}return _0x261255;});}})['then'](respondWithResult(_0x2c6d2f,null))[_0xd474('0x4e')](handleError(_0x2c6d2f,null));};exports[_0xd474('0x77')]=function(_0x5b33f0,_0x3c813e,_0x42bf33){return db['VoicePrefix']['find']({'where':{'id':_0x5b33f0[_0xd474('0x4a')]['id']}})[_0xd474('0x26')](handleEntityNotFound(_0x3c813e,null))['then'](function(_0x5341e7){if(_0x5341e7){return _0x5341e7[_0xd474('0x77')](_0x5b33f0[_0xd474('0x36')]['ids'])[_0xd474('0x26')](function(){if(_['isArray'](_0x5b33f0[_0xd474('0x36')]['ids'])){for(var _0x41474a=0x0;_0x41474a<_0x5b33f0[_0xd474('0x36')][_0xd474('0x72')][_0xd474('0x4c')];_0x41474a+=0x1){socket['emit'](_0xd474('0x78'),{'UserId':Number(_0x5b33f0['query'][_0xd474('0x72')][_0x41474a]),'VoicePrefixId':Number(_0x5b33f0[_0xd474('0x4a')]['id'])});}}else{socket[_0xd474('0x75')](_0xd474('0x78'),{'UserId':Number(_0x5b33f0['query'][_0xd474('0x72')]),'VoicePrefixId':Number(_0x5b33f0[_0xd474('0x4a')]['id'])});}});}})[_0xd474('0x26')](respondWithStatusCode(_0x3c813e,null))['catch'](handleError(_0x3c813e,null));};exports[_0xd474('0x79')]=function(_0x245860,_0xc8e2c5,_0x11284e){var _0x4373ac={};var _0x22f707={};var _0x187700;var _0x101048;return db['VoicePrefix'][_0xd474('0x7a')]({'where':{'id':_0x245860[_0xd474('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc8e2c5,null))[_0xd474('0x26')](function(_0x5278c3){if(_0x5278c3){_0x187700=_0x5278c3;_0x22f707[_0xd474('0x35')]=_[_0xd474('0x4b')](db[_0xd474('0x7b')][_0xd474('0x32')]);_0x22f707['query']=_[_0xd474('0x4b')](_0x245860[_0xd474('0x36')]);_0x22f707['filters']=_[_0xd474('0x37')](_0x22f707[_0xd474('0x35')],_0x22f707[_0xd474('0x36')]);_0x4373ac['attributes']=_['intersection'](_0x22f707[_0xd474('0x35')],qs[_0xd474('0x38')](_0x245860[_0xd474('0x36')][_0xd474('0x38')]));_0x4373ac['attributes']=_0x4373ac[_0xd474('0x39')]['length']?_0x4373ac['attributes']:_0x22f707[_0xd474('0x35')];_0x4373ac[_0xd474('0x3b')]=qs[_0xd474('0x3c')](_0x245860['query'][_0xd474('0x3c')]);_0x4373ac['where']=qs[_0xd474('0x3e')](_[_0xd474('0x3f')](_0x245860['query'],_0x22f707[_0xd474('0x3e')]));if(_0x245860[_0xd474('0x36')][_0xd474('0x40')]){_0x4373ac['where']=_[_0xd474('0x41')](_0x4373ac[_0xd474('0x3d')],{'$or':_[_0xd474('0x31')](_0x4373ac[_0xd474('0x39')],function(_0x402b0e){var _0x55bc30={};_0x55bc30[_0x402b0e]={'$like':'%'+_0x245860[_0xd474('0x36')][_0xd474('0x40')]+'%'};return _0x55bc30;})});}_0x4373ac=_[_0xd474('0x41')]({},_0x4373ac,_0x245860[_0xd474('0x43')]);return _0x187700[_0xd474('0x79')](_0x4373ac);}})[_0xd474('0x26')](function(_0x2754cf){if(_0x2754cf){_0x101048=_0x2754cf[_0xd474('0x4c')];if(!_0x245860[_0xd474('0x36')]['hasOwnProperty'](_0xd474('0x7c'))){_0x4373ac['limit']=qs[_0xd474('0x20')](_0x245860['query'][_0xd474('0x20')]);_0x4373ac[_0xd474('0x1f')]=qs[_0xd474('0x1f')](_0x245860['query'][_0xd474('0x1f')]);}return _0x187700['getAgents'](_0x4373ac);}})[_0xd474('0x26')](function(_0x4d6746){if(_0x4d6746){return _0x4d6746?{'count':_0x101048,'rows':_0x4d6746}:null;}})['then'](respondWithResult(_0xc8e2c5,null))[_0xd474('0x4e')](handleError(_0xc8e2c5,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e36fd1d..4431999 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x55b093,_0x532595){var _0x10dfba=function(_0x21225f){while(--_0x21225f){_0x55b093['push'](_0x55b093['shift']());}};_0x10dfba(++_0x532595);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xedd9,0xfc));var _0x9edd=function(_0x4607b2,_0x3d72e4){_0x4607b2=_0x4607b2-0x0;var _0x179c76=_0xedd9[_0x4607b2];return _0x179c76;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 305912f..f6829ad 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 _0x2c1a=['bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment'];(function(_0x4186c3,_0x1c0521){var _0x23ff6c=function(_0x459a01){while(--_0x459a01){_0x4186c3['push'](_0x4186c3['shift']());}};_0x23ff6c(++_0x1c0521);}(_0x2c1a,0x1ac));var _0xa2c1=function(_0x568b73,_0x403347){_0x568b73=_0x568b73-0x0;var _0x2ff268=_0x2c1a[_0x568b73];return _0x2ff268;};'use strict';var _=require(_0xa2c1('0x0'));var util=require('util');var logger=require(_0xa2c1('0x1'))(_0xa2c1('0x2'));var moment=require(_0xa2c1('0x3'));var BPromise=require(_0xa2c1('0x4'));var rp=require(_0xa2c1('0x5'));var fs=require('fs');var path=require(_0xa2c1('0x6'));var rimraf=require(_0xa2c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa2c1('0x8'));module[_0xa2c1('0x9')]=function(_0x11d2e7,_0x5d8c8c){return _0x11d2e7['define'](_0xa2c1('0xa'),attributes,{'tableName':_0xa2c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafac=['../../config/logger','api','moment','bluebird','request-promise','path','./voicePrefix.attributes','exports','define','VoicePrefix','lodash'];(function(_0x11cb5d,_0x4b9521){var _0x3a29f9=function(_0x30a27f){while(--_0x30a27f){_0x11cb5d['push'](_0x11cb5d['shift']());}};_0x3a29f9(++_0x4b9521);}(_0xafac,0x1b7));var _0xcafa=function(_0xfaf455,_0x13c0a9){_0xfaf455=_0xfaf455-0x0;var _0x5aaa60=_0xafac[_0xfaf455];return _0x5aaa60;};'use strict';var _=require(_0xcafa('0x0'));var util=require('util');var logger=require(_0xcafa('0x1'))(_0xcafa('0x2'));var moment=require(_0xcafa('0x3'));var BPromise=require(_0xcafa('0x4'));var rp=require(_0xcafa('0x5'));var fs=require('fs');var path=require(_0xcafa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcafa('0x7'));module[_0xcafa('0x8')]=function(_0x19a7ca,_0x55debe){return _0x19a7ca[_0xcafa('0x9')](_0xcafa('0xa'),attributes,{'tableName':'voice_prefixes','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 91e46a5..127070f 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 _0x0aa1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x535019,_0x5c68f6){var _0x2cd7f9=function(_0x3ea530){while(--_0x3ea530){_0x535019['push'](_0x535019['shift']());}};_0x2cd7f9(++_0x5c68f6);}(_0x0aa1,0x129));var _0x10aa=function(_0x257ca5,_0x3f0ecb){_0x257ca5=_0x257ca5-0x0;var _0x33c99f=_0x0aa1[_0x257ca5];return _0x33c99f;};'use strict';var _=require(_0x10aa('0x0'));var util=require('util');var moment=require(_0x10aa('0x1'));var BPromise=require('bluebird');var rs=require(_0x10aa('0x2'));var fs=require('fs');var Redis=require(_0x10aa('0x3'));var db=require(_0x10aa('0x4'))['db'];var utils=require(_0x10aa('0x5'));var logger=require(_0x10aa('0x6'))('rpc');var config=require(_0x10aa('0x7'));var jayson=require(_0x10aa('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x10aa('0x9')]=_[_0x10aa('0xa')](config[_0x10aa('0x9')],{'host':_0x10aa('0xb'),'port':0x18eb});var socket=require(_0x10aa('0xc'))(new Redis(config[_0x10aa('0x9')]));require(_0x10aa('0xd'))[_0x10aa('0xe')](socket);function respondWithRpcPromise(_0x5d9e09,_0x5b6d0f,_0x151b1a){return new BPromise(function(_0x597ea8,_0x2f928c){return client['request'](_0x5d9e09,_0x151b1a)[_0x10aa('0xf')](function(_0x47a105){logger[_0x10aa('0x10')](_0x10aa('0x11'),_0x5b6d0f,_0x10aa('0x12'));logger['debug'](_0x10aa('0x13'),_0x5b6d0f,_0x10aa('0x12'),JSON['stringify'](_0x47a105));if(_0x47a105[_0x10aa('0x14')]){if(_0x47a105[_0x10aa('0x14')][_0x10aa('0x15')]===0x1f4){logger[_0x10aa('0x14')](_0x10aa('0x11'),_0x5b6d0f,_0x47a105[_0x10aa('0x14')][_0x10aa('0x16')]);return _0x2f928c(_0x47a105[_0x10aa('0x14')][_0x10aa('0x16')]);}logger[_0x10aa('0x14')](_0x10aa('0x11'),_0x5b6d0f,_0x47a105['error'][_0x10aa('0x16')]);return _0x597ea8(_0x47a105[_0x10aa('0x14')][_0x10aa('0x16')]);}else{logger[_0x10aa('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5b6d0f,'request\x20sent');_0x597ea8(_0x47a105[_0x10aa('0x17')][_0x10aa('0x16')]);}})[_0x10aa('0x18')](function(_0x5357de){logger[_0x10aa('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x5b6d0f,_0x5357de);_0x2f928c(_0x5357de);});});} \ No newline at end of file +var _0x7360=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x54e573,_0x129035){var _0x14d781=function(_0x1eef2b){while(--_0x1eef2b){_0x54e573['push'](_0x54e573['shift']());}};_0x14d781(++_0x129035);}(_0x7360,0x1ce));var _0x0736=function(_0x153a36,_0x4afb56){_0x153a36=_0x153a36-0x0;var _0x549dcf=_0x7360[_0x153a36];return _0x549dcf;};'use strict';var _=require(_0x0736('0x0'));var util=require(_0x0736('0x1'));var moment=require(_0x0736('0x2'));var BPromise=require(_0x0736('0x3'));var rs=require(_0x0736('0x4'));var fs=require('fs');var Redis=require(_0x0736('0x5'));var db=require(_0x0736('0x6'))['db'];var utils=require(_0x0736('0x7'));var logger=require(_0x0736('0x8'))(_0x0736('0x9'));var config=require('../../config/environment');var jayson=require(_0x0736('0xa'));var client=jayson[_0x0736('0xb')][_0x0736('0xc')]({'port':0x232a});config['redis']=_[_0x0736('0xd')](config[_0x0736('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0736('0xf'))(new Redis(config[_0x0736('0xe')]));require('./voicePrefix.socket')[_0x0736('0x10')](socket);function respondWithRpcPromise(_0x9ab77a,_0x1802ca,_0x1e9ac5){return new BPromise(function(_0x5d9c7a,_0x533817){return client[_0x0736('0x11')](_0x9ab77a,_0x1e9ac5)[_0x0736('0x12')](function(_0xefce24){logger['info'](_0x0736('0x13'),_0x1802ca,_0x0736('0x14'));logger[_0x0736('0x15')](_0x0736('0x16'),_0x1802ca,_0x0736('0x14'),JSON[_0x0736('0x17')](_0xefce24));if(_0xefce24[_0x0736('0x18')]){if(_0xefce24['error'][_0x0736('0x19')]===0x1f4){logger[_0x0736('0x18')](_0x0736('0x13'),_0x1802ca,_0xefce24['error'][_0x0736('0x1a')]);return _0x533817(_0xefce24[_0x0736('0x18')][_0x0736('0x1a')]);}logger[_0x0736('0x18')](_0x0736('0x13'),_0x1802ca,_0xefce24[_0x0736('0x18')][_0x0736('0x1a')]);return _0x5d9c7a(_0xefce24['error'][_0x0736('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x1802ca,_0x0736('0x14'));_0x5d9c7a(_0xefce24[_0x0736('0x1b')][_0x0736('0x1a')]);}})[_0x0736('0x1c')](function(_0x4a3754){logger[_0x0736('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x1802ca,_0x4a3754);_0x533817(_0x4a3754);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 63c9f6d..c28caf0 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 _0xd81f=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0x1a6ac7,_0x34cda8){var _0x4d7b2=function(_0x50dc62){while(--_0x50dc62){_0x1a6ac7['push'](_0x1a6ac7['shift']());}};_0x4d7b2(++_0x34cda8);}(_0xd81f,0x1d4));var _0xfd81=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xd81f[_0x55abd9];return _0x3e5669;};'use strict';var VoicePrefixEvents=require(_0xfd81('0x0'));var events=['save',_0xfd81('0x1'),_0xfd81('0x2')];function createListener(_0x12ce53,_0x38d64e){return function(_0x274b53){_0x38d64e[_0xfd81('0x3')](_0x12ce53,_0x274b53);};}function removeListener(_0x5c07fe,_0x4998c1){return function(){VoicePrefixEvents[_0xfd81('0x4')](_0x5c07fe,_0x4998c1);};}exports[_0xfd81('0x5')]=function(_0xcb89b){for(var _0x1a3946=0x0,_0x2b635e=events[_0xfd81('0x6')];_0x1a3946<_0x2b635e;_0x1a3946++){var _0x3fb404=events[_0x1a3946];var _0x564f93=createListener(_0xfd81('0x7')+_0x3fb404,_0xcb89b);VoicePrefixEvents['on'](_0x3fb404,_0x564f93);}}; \ No newline at end of file +var _0xe41a=['voicePrefix:','save','remove','update','emit','length'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xe41a,0x1cf));var _0xae41=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xe41a[_0x139a3c];return _0x2b375b;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xae41('0x0'),_0xae41('0x1'),_0xae41('0x2')];function createListener(_0x50fa63,_0x3abf){return function(_0x4b4fb4){_0x3abf[_0xae41('0x3')](_0x50fa63,_0x4b4fb4);};}function removeListener(_0x3a369d,_0x257fd7){return function(){VoicePrefixEvents['removeListener'](_0x3a369d,_0x257fd7);};}exports['register']=function(_0x5453f8){for(var _0x31fa28=0x0,_0x40b1b1=events[_0xae41('0x4')];_0x31fa28<_0x40b1b1;_0x31fa28++){var _0x32b952=events[_0x31fa28];var _0x374b8f=createListener(_0xae41('0x5')+_0x32b952,_0x5453f8);VoicePrefixEvents['on'](_0x32b952,_0x374b8f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bcb1319..21420fe 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 _0x81db=['/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','addAgents','/:id/lists','put','update','delete','removeTeams','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','index','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories'];(function(_0x4b4bb0,_0x4c335b){var _0x3ada1f=function(_0x3ec566){while(--_0x3ec566){_0x4b4bb0['push'](_0x4b4bb0['shift']());}};_0x3ada1f(++_0x4c335b);}(_0x81db,0x1e0));var _0xb81d=function(_0x3f8ba3,_0x4fe833){_0x3f8ba3=_0x3f8ba3-0x0;var _0x1c2e73=_0x81db[_0x3f8ba3];return _0x1c2e73;};'use strict';var multer=require(_0xb81d('0x0'));var util=require(_0xb81d('0x1'));var path=require('path');var timeout=require(_0xb81d('0x2'));var express=require('express');var router=express[_0xb81d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb81d('0x4'));var config=require(_0xb81d('0x5'));var controller=require(_0xb81d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb81d('0x7')]);router[_0xb81d('0x8')](_0xb81d('0x9'),auth[_0xb81d('0xa')](),controller[_0xb81d('0xb')]);router[_0xb81d('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xb81d('0xc')]);router[_0xb81d('0x8')](_0xb81d('0xd'),auth[_0xb81d('0xa')](),controller['getHopperHistories']);router['get'](_0xb81d('0xe'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xb81d('0xa')](),controller[_0xb81d('0xf')]);router['get'](_0xb81d('0x10'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x11')]);router[_0xb81d('0x8')](_0xb81d('0x12'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x13')]);router[_0xb81d('0x8')](_0xb81d('0x14'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x15')]);router[_0xb81d('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0xb81d('0x16')]);router[_0xb81d('0x8')](_0xb81d('0x17'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x18')]);router[_0xb81d('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb81d('0x1a'),auth['isAuthenticated'](),controller[_0xb81d('0x1b')]);router[_0xb81d('0x19')](_0xb81d('0x10'),auth['isAuthenticated'](),controller[_0xb81d('0x1c')]);router[_0xb81d('0x19')](_0xb81d('0x12'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x1d')]);router['post'](_0xb81d('0x1e'),auth[_0xb81d('0xa')](),controller['addLists']);router[_0xb81d('0x19')]('/:id/blacklists',auth[_0xb81d('0xa')](),controller['addBlackLists']);router[_0xb81d('0x1f')]('/:id',auth[_0xb81d('0xa')](),controller[_0xb81d('0x20')]);router[_0xb81d('0x21')]('/:id',auth[_0xb81d('0xa')](),controller['destroy']);router[_0xb81d('0x21')](_0xb81d('0x10'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x22')]);router[_0xb81d('0x21')]('/:id/users',auth[_0xb81d('0xa')](),controller['removeAgents']);router[_0xb81d('0x21')](_0xb81d('0x1e'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x23')]);router[_0xb81d('0x21')](_0xb81d('0x17'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x24')]);module[_0xb81d('0x25')]=router; \ No newline at end of file +var _0xbd54=['../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/lists','getLists','/:id/blacklists','create','/:id/clone','clone','addTeams','post','addAgents','addLists','addBlackLists','put','update','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2940b3,_0x3a78dc){var _0x56df38=function(_0x5f2ec8){while(--_0x5f2ec8){_0x2940b3['push'](_0x2940b3['shift']());}};_0x56df38(++_0x3a78dc);}(_0xbd54,0x17c));var _0x4bd5=function(_0x5dcae8,_0x14040a){_0x5dcae8=_0x5dcae8-0x0;var _0xa7a0c6=_0xbd54[_0x5dcae8];return _0xa7a0c6;};'use strict';var multer=require(_0x4bd5('0x0'));var util=require(_0x4bd5('0x1'));var path=require(_0x4bd5('0x2'));var timeout=require(_0x4bd5('0x3'));var express=require(_0x4bd5('0x4'));var router=express[_0x4bd5('0x5')]();var auth=require(_0x4bd5('0x6'));var interaction=require(_0x4bd5('0x7'));var config=require(_0x4bd5('0x8'));var controller=require(_0x4bd5('0x9'));router[_0x4bd5('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4bd5('0xa')](_0x4bd5('0xb'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0xd')]);router[_0x4bd5('0xa')](_0x4bd5('0xe'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0xf')]);router[_0x4bd5('0xa')](_0x4bd5('0x10'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x11')]);router[_0x4bd5('0xa')](_0x4bd5('0x12'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x13')]);router[_0x4bd5('0xa')]('/:id/hopper_black',auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x14')]);router[_0x4bd5('0xa')](_0x4bd5('0x15'),auth[_0x4bd5('0xc')](),controller['getTeams']);router[_0x4bd5('0xa')](_0x4bd5('0x16'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x17')]);router[_0x4bd5('0xa')]('/:id/members',auth[_0x4bd5('0xc')](),controller['getMembers']);router['get'](_0x4bd5('0x18'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x19')]);router[_0x4bd5('0xa')](_0x4bd5('0x1a'),auth[_0x4bd5('0xc')](),controller['getBlackLists']);router['post']('/',auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x1b')]);router['post'](_0x4bd5('0x1c'),auth['isAuthenticated'](),controller[_0x4bd5('0x1d')]);router['post'](_0x4bd5('0x15'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x1e')]);router[_0x4bd5('0x1f')](_0x4bd5('0x16'),auth['isAuthenticated'](),controller[_0x4bd5('0x20')]);router[_0x4bd5('0x1f')]('/:id/lists',auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x21')]);router[_0x4bd5('0x1f')](_0x4bd5('0x1a'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x22')]);router[_0x4bd5('0x23')]('/:id',auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x24')]);router['delete'](_0x4bd5('0xb'),auth['isAuthenticated'](),controller[_0x4bd5('0x25')]);router[_0x4bd5('0x26')]('/:id/teams',auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x27')]);router[_0x4bd5('0x26')]('/:id/users',auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x28')]);router['delete'](_0x4bd5('0x18'),auth[_0x4bd5('0xc')](),controller[_0x4bd5('0x29')]);router[_0x4bd5('0x26')](_0x4bd5('0x1a'),auth['isAuthenticated'](),controller[_0x4bd5('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2bae62d..d4bd2b3 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(_0x1bad26,_0xf6f79f){var _0x23b581=function(_0x4040c9){while(--_0x4040c9){_0x1bad26['push'](_0x1bad26['shift']());}};_0x23b581(++_0xf6f79f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x52d74f,_0x4b101e){var _0x5a59f3=function(_0x1c63b4){while(--_0x1c63b4){_0x52d74f['push'](_0x52d74f['shift']());}};_0x5a59f3(++_0x4b101e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 2fcb182..379565b 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 _0xa632=['online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','SELECT','every','TeamId','all','union','compact','isEmpty','emit','addAgents','push','removeAgents','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','cm_hopper','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','ListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','insert','into','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','show','params','options','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','CmHopper','hasOwnProperty','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0xa632,0x1b2));var _0x2a63=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa632[_0x5783f4];return _0x28e380;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2a63('0x0'));var zipdir=require(_0x2a63('0x1'));var jsonpatch=require(_0x2a63('0x2'));var rp=require(_0x2a63('0x3'));var moment=require(_0x2a63('0x4'));var BPromise=require(_0x2a63('0x5'));var Mustache=require(_0x2a63('0x6'));var util=require(_0x2a63('0x7'));var path=require('path');var sox=require(_0x2a63('0x8'));var csv=require(_0x2a63('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a63('0xa'));var squel=require(_0x2a63('0xb'));var crypto=require(_0x2a63('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2a63('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2a63('0xe'));var Papa=require(_0x2a63('0xf'));var Redis=require(_0x2a63('0x10'));var authService=require(_0x2a63('0x11'));var qs=require(_0x2a63('0x12'));var as=require(_0x2a63('0x13'));var hardwareService=require(_0x2a63('0x14'));var logger=require('../../config/logger')(_0x2a63('0x15'));var utils=require(_0x2a63('0x16'));var config=require(_0x2a63('0x17'));var db=require(_0x2a63('0x18'))['db'];config[_0x2a63('0x19')]=_[_0x2a63('0x1a')](config['redis'],{'host':_0x2a63('0x1b'),'port':0x18eb});var socket=require(_0x2a63('0x1c'))(new Redis(config[_0x2a63('0x19')]));require(_0x2a63('0x1d'))['register'](socket);function respondWithStatusCode(_0x407d24,_0x2a7a98){_0x2a7a98=_0x2a7a98||0xcc;return function(_0x49252b){if(_0x49252b){return _0x407d24[_0x2a63('0x1e')](_0x2a7a98);}return _0x407d24[_0x2a63('0x1f')](_0x2a7a98)[_0x2a63('0x20')]();};}function respondWithResult(_0x174c84,_0x176a23){_0x176a23=_0x176a23||0xc8;return function(_0x1ed85b){if(_0x1ed85b){return _0x174c84['status'](_0x176a23)[_0x2a63('0x21')](_0x1ed85b);}};}function respondWithFilteredResult(_0x1b19d9,_0x12c6f0){return function(_0x5f4388){if(_0x5f4388){var _0x25b317=_0x5f4388[_0x2a63('0x22')],_0x4c0c52=_0x12c6f0[_0x2a63('0x23')],_0x4afb92=_0x12c6f0[_0x2a63('0x23')]+_0x12c6f0['limit'],_0x25fabf;if(_0x4afb92>=_0x25b317){_0x4afb92=_0x25b317;_0x25fabf=0xc8;}else{_0x25fabf=0xce;}_0x1b19d9[_0x2a63('0x1f')](_0x25fabf);return _0x1b19d9['set'](_0x2a63('0x24'),_0x4c0c52+'-'+_0x4afb92+'/'+_0x25b317)[_0x2a63('0x21')](_0x5f4388);}return null;};}function patchUpdates(_0x52d826){return function(_0x275359){try{jsonpatch[_0x2a63('0x25')](_0x275359,_0x52d826,!![]);}catch(_0x5cb694){return BPromise[_0x2a63('0x26')](_0x5cb694);}return _0x275359['save']();};}function saveUpdates(_0x3f3c3a,_0x4c22ed){return function(_0x48f024){if(_0x48f024){return _0x48f024['update'](_0x3f3c3a)['then'](function(_0x15e80c){return _0x15e80c;});}return null;};}function removeEntity(_0x266fe5,_0x2eb051){return function(_0x2fb321){if(_0x2fb321){return _0x2fb321[_0x2a63('0x27')]()[_0x2a63('0x28')](function(){var _0x107525=_0x2fb321[_0x2a63('0x29')]({'plain':!![]});var _0x2ffa14=[{'name':_0x2a63('0x2a'),'value':_0x2a63('0x2b'),'ignore':![]},{'name':_0x2a63('0x2c'),'value':_0x2a63('0x2d'),'ignore':![]}];var _0x776107=_(_0x2ffa14)[_0x2a63('0x2e')](_0x2a63('0x2f'))[_0x2a63('0x30')](_0x2a63('0x31'))[_0x2a63('0x31')]();if(_[_0x2a63('0x32')](_0x776107,_0x107525[_0x2a63('0x33')])){return;}var _0x3b4f92=_[_0x2a63('0x34')](_0x2ffa14,[_0x2a63('0x31'),_0x107525['type']])[_0x2a63('0x35')];return db[_0x2a63('0x36')][_0x2a63('0x27')]({'where':{'type':_0x3b4f92,'resourceId':_0x107525['id']}})[_0x2a63('0x28')](function(){return _0x2fb321;});})[_0x2a63('0x28')](function(){_0x266fe5[_0x2a63('0x1f')](0xcc)[_0x2a63('0x20')]();});}};}function handleEntityNotFound(_0x3c3f03,_0x5df0d6){return function(_0x4ae04b){if(!_0x4ae04b){_0x3c3f03['sendStatus'](0x194);}return _0x4ae04b;};}function handleError(_0x4b8502,_0x225637){_0x225637=_0x225637||0x1f4;return function(_0x287659){logger[_0x2a63('0x37')](_0x287659[_0x2a63('0x38')]);if(_0x287659[_0x2a63('0x35')]){delete _0x287659[_0x2a63('0x35')];}_0x4b8502[_0x2a63('0x1f')](_0x225637)[_0x2a63('0x39')](_0x287659);};}exports[_0x2a63('0x3a')]=function(_0x9c648c,_0x4531c6){var _0x96b90a={},_0x2d231e={},_0x278d2f={'count':0x0,'rows':[]};var _0x2fe468=_['map'](db[_0x2a63('0x3b')][_0x2a63('0x3c')],function(_0x52bfa0){return{'name':_0x52bfa0[_0x2a63('0x3d')],'type':_0x52bfa0[_0x2a63('0x33')][_0x2a63('0x3e')]};});_0x2d231e[_0x2a63('0x3f')]=_[_0x2a63('0x30')](_0x2fe468,_0x2a63('0x35'));_0x2d231e[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x9c648c[_0x2a63('0x40')]);_0x2d231e[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x2d231e[_0x2a63('0x3f')],_0x2d231e[_0x2a63('0x40')]);_0x96b90a[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x2d231e[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x9c648c[_0x2a63('0x40')]['fields']));_0x96b90a[_0x2a63('0x44')]=_0x96b90a[_0x2a63('0x44')][_0x2a63('0x46')]?_0x96b90a[_0x2a63('0x44')]:_0x2d231e[_0x2a63('0x3f')];if(!_0x9c648c['query']['hasOwnProperty'](_0x2a63('0x47'))){_0x96b90a[_0x2a63('0x48')]=qs['limit'](_0x9c648c[_0x2a63('0x40')]['limit']);_0x96b90a[_0x2a63('0x23')]=qs[_0x2a63('0x23')](_0x9c648c[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x96b90a[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x9c648c['query']['sort']);_0x96b90a[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x9c648c[_0x2a63('0x40')],_0x2d231e['filters']),_0x2fe468);if(_0x9c648c[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x96b90a[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x96b90a[_0x2a63('0x4b')],{'$or':_['map'](_0x2fe468,function(_0x31e4ed){if(_0x31e4ed[_0x2a63('0x33')]!==_0x2a63('0x4e')){var _0x1837ad={};_0x1837ad[_0x31e4ed[_0x2a63('0x35')]]={'$like':'%'+_0x9c648c[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x1837ad;}})});}_0x96b90a=_[_0x2a63('0x4d')]({},_0x96b90a,_0x9c648c['options']);var _0x55ba9a={'where':_0x96b90a[_0x2a63('0x4b')]};return db[_0x2a63('0x3b')][_0x2a63('0x22')](_0x55ba9a)[_0x2a63('0x28')](function(_0xc1209e){_0x278d2f['count']=_0xc1209e;if(_0x9c648c['query'][_0x2a63('0x4f')]){_0x96b90a[_0x2a63('0x50')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x96b90a);})[_0x2a63('0x28')](function(_0x48a11c){_0x278d2f[_0x2a63('0x51')]=_0x48a11c;return _0x278d2f;})[_0x2a63('0x28')](respondWithFilteredResult(_0x4531c6,_0x96b90a))['catch'](handleError(_0x4531c6,null));};exports[_0x2a63('0x52')]=function(_0x47c4e2,_0x3e1bf5){var _0x926809={'raw':![],'where':{'id':_0x47c4e2[_0x2a63('0x53')]['id']}},_0x38718d={};_0x38718d['model']=_[_0x2a63('0x41')](db[_0x2a63('0x3b')]['rawAttributes']);_0x38718d[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x47c4e2[_0x2a63('0x40')]);_0x38718d['filters']=_[_0x2a63('0x43')](_0x38718d['model'],_0x38718d[_0x2a63('0x40')]);_0x926809['attributes']=_[_0x2a63('0x43')](_0x38718d['model'],qs[_0x2a63('0x45')](_0x47c4e2[_0x2a63('0x40')][_0x2a63('0x45')]));_0x926809['attributes']=_0x926809['attributes'][_0x2a63('0x46')]?_0x926809[_0x2a63('0x44')]:_0x38718d[_0x2a63('0x3f')];if(_0x47c4e2[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x926809[_0x2a63('0x50')]=[{'all':!![]}];}_0x926809=_[_0x2a63('0x4d')]({},_0x926809,_0x47c4e2[_0x2a63('0x54')]);return db[_0x2a63('0x3b')]['find'](_0x926809)[_0x2a63('0x28')](handleEntityNotFound(_0x3e1bf5,null))[_0x2a63('0x28')](respondWithResult(_0x3e1bf5,null))[_0x2a63('0x55')](handleError(_0x3e1bf5,null));};exports[_0x2a63('0x56')]=function(_0x3db00d,_0x160bea){return db['VoiceQueue']['create'](_0x3db00d[_0x2a63('0x57')],{})[_0x2a63('0x28')](function(_0x21eb96){var _0x40b2ae=_0x3db00d[_0x2a63('0x58')][_0x2a63('0x29')]({'plain':!![]});if(!_0x40b2ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40b2ae[_0x2a63('0x59')]===_0x2a63('0x58')){var _0x4084b5=_0x21eb96[_0x2a63('0x29')]({'plain':!![]});var _0x5051c0=[{'name':_0x2a63('0x2a'),'value':_0x2a63('0x2b')},{'name':_0x2a63('0x2c'),'value':_0x2a63('0x2d')}];var _0x54e814=_[_0x2a63('0x34')](_0x5051c0,[_0x2a63('0x31'),_0x4084b5[_0x2a63('0x33')]])[_0x2a63('0x35')];return db[_0x2a63('0x5a')][_0x2a63('0x34')]({'where':{'name':_0x54e814,'userProfileId':_0x40b2ae[_0x2a63('0x5b')]},'raw':!![]})[_0x2a63('0x28')](function(_0x5bae95){if(_0x5bae95&&_0x5bae95[_0x2a63('0x5c')]===0x0){return db[_0x2a63('0x36')][_0x2a63('0x56')]({'name':_0x4084b5[_0x2a63('0x35')],'resourceId':_0x4084b5['id'],'type':_0x5bae95[_0x2a63('0x35')],'sectionId':_0x5bae95['id']},{})[_0x2a63('0x28')](function(){return _0x21eb96;});}else{return _0x21eb96;}})[_0x2a63('0x55')](function(_0x27a2e0){logger[_0x2a63('0x37')](_0x2a63('0x5d'),_0x27a2e0);throw _0x27a2e0;});}return _0x21eb96;})['then'](respondWithResult(_0x160bea,0xc9))['catch'](handleError(_0x160bea,null));};exports[_0x2a63('0x5e')]=function(_0x3ef688,_0x1e7109){var _0x18da33={'where':{'id':_0x3ef688[_0x2a63('0x53')]['id']}},_0x2330e7={};_0x2330e7[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x3b')][_0x2a63('0x3c')]);_0x18da33[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x2330e7[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x3ef688[_0x2a63('0x40')]['fields']));_0x18da33[_0x2a63('0x44')]=_0x18da33[_0x2a63('0x44')]['length']?_0x18da33[_0x2a63('0x44')]:_0x2330e7[_0x2a63('0x3f')];if(_0x3ef688[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x18da33[_0x2a63('0x50')]=[{'all':!![]}];}_0x18da33=_[_0x2a63('0x4d')]({},_0x18da33,_0x3ef688['options']);return db['VoiceQueue'][_0x2a63('0x34')](_0x18da33)[_0x2a63('0x28')](handleEntityNotFound(_0x1e7109,null))[_0x2a63('0x28')](function(_0x5d9cbe){if(_0x5d9cbe){var _0x45e613=_0x5d9cbe[_0x2a63('0x29')]({'plain':!![]});_0x45e613=qs[_0x2a63('0x5f')](_0x45e613,['id',_0x2a63('0x60'),'updatedAt']);_0x3ef688[_0x2a63('0x57')]=_['omit'](_0x3ef688[_0x2a63('0x57')],['id',_0x2a63('0x60'),_0x2a63('0x61')]);return db['VoiceQueue']['create'](_[_0x2a63('0x4d')](_0x45e613,_0x3ef688[_0x2a63('0x57')]),{'include':_0x3ef688[_0x2a63('0x40')][_0x2a63('0x4f')]?[{'all':!![]}]:undefined})[_0x2a63('0x28')](function(_0x41b699){var _0x4482ff=_0x3ef688[_0x2a63('0x58')][_0x2a63('0x29')]({'plain':!![]});if(!_0x4482ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4482ff['role']===_0x2a63('0x58')){var _0x1549c6=_0x41b699[_0x2a63('0x29')]({'plain':!![]});var _0x5ddeb8=[{'name':_0x2a63('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x2a63('0x2d')}];var _0x1d198a=_[_0x2a63('0x34')](_0x5ddeb8,['value',_0x1549c6['type']])[_0x2a63('0x35')];return db[_0x2a63('0x5a')]['find']({'where':{'name':_0x1d198a,'userProfileId':_0x4482ff[_0x2a63('0x5b')]},'raw':!![]})[_0x2a63('0x28')](function(_0x56bb89){if(_0x56bb89&&_0x56bb89[_0x2a63('0x5c')]===0x0){return db[_0x2a63('0x36')]['create']({'name':_0x1549c6[_0x2a63('0x35')],'resourceId':_0x1549c6['id'],'type':_0x56bb89[_0x2a63('0x35')],'sectionId':_0x56bb89['id']},{})['then'](function(){return _0x41b699;});}else{return _0x41b699;}})['catch'](function(_0x33ad83){logger[_0x2a63('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33ad83);throw _0x33ad83;});}return _0x41b699;});}})[_0x2a63('0x28')](respondWithResult(_0x1e7109,0xc9))[_0x2a63('0x55')](handleError(_0x1e7109,null));};exports[_0x2a63('0x62')]=function(_0x5d941e,_0x2c0ee3){if(_0x5d941e[_0x2a63('0x57')]['id']){delete _0x5d941e['body']['id'];}return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x5d941e['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x2c0ee3,null))['then'](saveUpdates(_0x5d941e['body'],null))['then'](respondWithResult(_0x2c0ee3,null))[_0x2a63('0x55')](handleError(_0x2c0ee3,null));};exports[_0x2a63('0x27')]=function(_0xa859b9,_0xd39787){return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0xa859b9[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0xd39787,null))[_0x2a63('0x28')](removeEntity(_0xd39787,null))[_0x2a63('0x55')](handleError(_0xd39787,null));};exports['getHoppers']=function(_0x5c5943,_0x5ea82b,_0x3bce34){var _0x334d7d={'raw':![],'where':{}};var _0x411d08={};var _0xc26359={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5c5943[_0x2a63('0x53')]['id']}})['then'](handleEntityNotFound(_0x5ea82b,null))['then'](function(_0x3437fe){if(_0x3437fe){_0x411d08[_0x2a63('0x3f')]=_['keys'](db[_0x2a63('0x63')][_0x2a63('0x3c')]);_0x411d08[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x5c5943[_0x2a63('0x40')]);_0x411d08[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x411d08['model'],_0x411d08[_0x2a63('0x40')]);_0x334d7d['attributes']=_[_0x2a63('0x43')](_0x411d08['model'],qs[_0x2a63('0x45')](_0x5c5943[_0x2a63('0x40')][_0x2a63('0x45')]));_0x334d7d[_0x2a63('0x44')]=_0x334d7d['attributes'][_0x2a63('0x46')]?_0x334d7d[_0x2a63('0x44')]:_0x411d08[_0x2a63('0x3f')];if(!_0x5c5943[_0x2a63('0x40')][_0x2a63('0x64')]('nolimit')){_0x334d7d[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x5c5943[_0x2a63('0x40')][_0x2a63('0x48')]);_0x334d7d[_0x2a63('0x23')]=qs[_0x2a63('0x23')](_0x5c5943[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x334d7d['order']=qs[_0x2a63('0x4a')](_0x5c5943[_0x2a63('0x40')]['sort']);_0x334d7d[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x5c5943[_0x2a63('0x40')],_0x411d08['filters']));_0x334d7d[_0x2a63('0x4b')][_0x2a63('0x65')]=_0x3437fe['id'];if(_0x5c5943[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x334d7d['where']=_[_0x2a63('0x4d')](_0x334d7d[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x334d7d['attributes'],function(_0x38e208){var _0x4f4163={};_0x4f4163[_0x38e208]={'$like':'%'+_0x5c5943['query'][_0x2a63('0x2e')]+'%'};return _0x4f4163;})});}_0x334d7d=_[_0x2a63('0x4d')]({},_0x334d7d,_0x5c5943[_0x2a63('0x54')]);return db[_0x2a63('0x63')][_0x2a63('0x22')]({'where':_0x334d7d[_0x2a63('0x4b')]})['then'](function(_0x1915fe){_0xc26359[_0x2a63('0x22')]=_0x1915fe;if(_0x5c5943[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x334d7d['include']=[{'all':!![]}];}return db[_0x2a63('0x63')][_0x2a63('0x66')](_0x334d7d);})['then'](function(_0x3f5807){_0xc26359[_0x2a63('0x51')]=_0x3f5807;return _0xc26359;});}})[_0x2a63('0x28')](respondWithFilteredResult(_0x5ea82b,_0x334d7d))[_0x2a63('0x55')](handleError(_0x5ea82b,null));};exports[_0x2a63('0x67')]=function(_0x152b3a,_0x399a36,_0x9111e9){var _0x551adf={'raw':!![],'where':{}};var _0x54b839={};var _0x1c4955={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2a63('0x68')]({'where':{'id':_0x152b3a[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x399a36,null))[_0x2a63('0x28')](function(_0xc1dfeb){if(_0xc1dfeb){_0x54b839['model']=_[_0x2a63('0x41')](db[_0x2a63('0x69')]['rawAttributes']);_0x54b839[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x152b3a[_0x2a63('0x40')]);_0x54b839['filters']=_[_0x2a63('0x43')](_0x54b839[_0x2a63('0x3f')],_0x54b839[_0x2a63('0x40')]);_0x551adf[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x54b839['model'],qs['fields'](_0x152b3a[_0x2a63('0x40')]['fields']));_0x551adf[_0x2a63('0x44')]=_0x551adf[_0x2a63('0x44')]['length']?_0x551adf[_0x2a63('0x44')]:_0x54b839['model'];if(!_0x152b3a[_0x2a63('0x40')]['hasOwnProperty'](_0x2a63('0x47'))){_0x551adf[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x152b3a[_0x2a63('0x40')][_0x2a63('0x48')]);_0x551adf['offset']=qs[_0x2a63('0x23')](_0x152b3a[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x551adf[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x152b3a[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x551adf[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x152b3a[_0x2a63('0x40')],_0x54b839[_0x2a63('0x42')]));_0x551adf[_0x2a63('0x4b')]['VoiceQueueId']=_0xc1dfeb['id'];if(_0x152b3a[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x551adf['where']=_[_0x2a63('0x4d')](_0x551adf['where'],{'$or':_[_0x2a63('0x30')](_0x551adf['attributes'],function(_0x11c3b5){var _0xace2b3={};_0xace2b3[_0x11c3b5]={'$like':'%'+_0x152b3a[_0x2a63('0x40')]['filter']+'%'};return _0xace2b3;})});}_0x551adf=_[_0x2a63('0x4d')]({},_0x551adf,_0x152b3a[_0x2a63('0x54')]);return db[_0x2a63('0x69')][_0x2a63('0x22')]({'where':_0x551adf[_0x2a63('0x4b')]})[_0x2a63('0x28')](function(_0x396139){_0x1c4955['count']=_0x396139;if(_0x152b3a['query'][_0x2a63('0x4f')]){_0x551adf[_0x2a63('0x50')]=[{'all':!![]}];}return db[_0x2a63('0x69')][_0x2a63('0x66')](_0x551adf);})[_0x2a63('0x28')](function(_0x182347){_0x1c4955[_0x2a63('0x51')]=_0x182347;return _0x1c4955;});}})[_0x2a63('0x28')](respondWithFilteredResult(_0x399a36,_0x551adf))[_0x2a63('0x55')](handleError(_0x399a36,null));};exports['getHopperFinals']=function(_0x534d85,_0x48f67e,_0xce4695){var _0x2daf9a={'raw':!![],'where':{}};var _0xfe1491={};var _0x45e5ca={'count':0x0,'rows':[]};return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0x534d85[_0x2a63('0x53')]['id']}})['then'](handleEntityNotFound(_0x48f67e,null))[_0x2a63('0x28')](function(_0x234598){if(_0x234598){_0xfe1491[_0x2a63('0x3f')]=_['keys'](db[_0x2a63('0x6a')][_0x2a63('0x3c')]);_0xfe1491[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x534d85[_0x2a63('0x40')]);_0xfe1491[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0xfe1491[_0x2a63('0x3f')],_0xfe1491[_0x2a63('0x40')]);_0x2daf9a['attributes']=_['intersection'](_0xfe1491[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x534d85[_0x2a63('0x40')][_0x2a63('0x45')]));_0x2daf9a[_0x2a63('0x44')]=_0x2daf9a[_0x2a63('0x44')][_0x2a63('0x46')]?_0x2daf9a[_0x2a63('0x44')]:_0xfe1491[_0x2a63('0x3f')];if(!_0x534d85[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x2daf9a[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x534d85[_0x2a63('0x40')][_0x2a63('0x48')]);_0x2daf9a[_0x2a63('0x23')]=qs['offset'](_0x534d85[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x2daf9a[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x534d85['query'][_0x2a63('0x4a')]);_0x2daf9a[_0x2a63('0x4b')]=qs['filters'](_['pick'](_0x534d85[_0x2a63('0x40')],_0xfe1491[_0x2a63('0x42')]));_0x2daf9a[_0x2a63('0x4b')]['VoiceQueueId']=_0x234598['id'];if(_0x534d85[_0x2a63('0x40')]['filter']){_0x2daf9a[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x2daf9a['where'],{'$or':_[_0x2a63('0x30')](_0x2daf9a[_0x2a63('0x44')],function(_0x32bf44){var _0x3334a2={};_0x3334a2[_0x32bf44]={'$like':'%'+_0x534d85[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x3334a2;})});}_0x2daf9a=_[_0x2a63('0x4d')]({},_0x2daf9a,_0x534d85[_0x2a63('0x54')]);return db[_0x2a63('0x6a')]['count']({'where':_0x2daf9a[_0x2a63('0x4b')]})[_0x2a63('0x28')](function(_0x11609d){_0x45e5ca['count']=_0x11609d;if(_0x534d85[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x2daf9a['include']=[{'all':!![]}];}return db[_0x2a63('0x6a')][_0x2a63('0x66')](_0x2daf9a);})[_0x2a63('0x28')](function(_0x1160f5){_0x45e5ca['rows']=_0x1160f5;return _0x45e5ca;});}})['then'](respondWithFilteredResult(_0x48f67e,_0x2daf9a))['catch'](handleError(_0x48f67e,null));};exports[_0x2a63('0x6b')]=function(_0xd0ce76,_0x205149,_0x37794a){var _0x3c67f1={'raw':!![],'where':{}};var _0x57d527={};var _0x3da9b5={'count':0x0,'rows':[]};return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0xd0ce76[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x205149,null))[_0x2a63('0x28')](function(_0x192c52){if(_0x192c52){_0x57d527[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x6c')][_0x2a63('0x3c')]);_0x57d527[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0xd0ce76[_0x2a63('0x40')]);_0x57d527['filters']=_['intersection'](_0x57d527['model'],_0x57d527[_0x2a63('0x40')]);_0x3c67f1[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x57d527[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x45')]));_0x3c67f1[_0x2a63('0x44')]=_0x3c67f1['attributes'][_0x2a63('0x46')]?_0x3c67f1[_0x2a63('0x44')]:_0x57d527['model'];if(!_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x3c67f1[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x48')]);_0x3c67f1['offset']=qs['offset'](_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x3c67f1['order']=qs['sort'](_0xd0ce76['query'][_0x2a63('0x4a')]);_0x3c67f1[_0x2a63('0x4b')]=qs['filters'](_['pick'](_0xd0ce76[_0x2a63('0x40')],_0x57d527[_0x2a63('0x42')]));_0x3c67f1['where']['VoiceQueueId']=_0x192c52['id'];if(_0xd0ce76['query']['filter']){_0x3c67f1[_0x2a63('0x4b')]=_['merge'](_0x3c67f1[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x3c67f1[_0x2a63('0x44')],function(_0x3732a7){var _0x5cde9b={};_0x5cde9b[_0x3732a7]={'$like':'%'+_0xd0ce76['query']['filter']+'%'};return _0x5cde9b;})});}_0x3c67f1=_[_0x2a63('0x4d')]({},_0x3c67f1,_0xd0ce76[_0x2a63('0x54')]);return db[_0x2a63('0x6c')]['count']({'where':_0x3c67f1[_0x2a63('0x4b')]})[_0x2a63('0x28')](function(_0x7a1b5b){_0x3da9b5['count']=_0x7a1b5b;if(_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x3c67f1[_0x2a63('0x50')]=[{'all':!![]}];}return db[_0x2a63('0x6c')]['findAll'](_0x3c67f1);})[_0x2a63('0x28')](function(_0x9a803e){_0x3da9b5[_0x2a63('0x51')]=_0x9a803e;return _0x3da9b5;});}})[_0x2a63('0x28')](respondWithFilteredResult(_0x205149,_0x3c67f1))[_0x2a63('0x55')](handleError(_0x205149,null));};exports['getTeams']=function(_0x45052e,_0xc3364e,_0x32bda3){var _0x528f58={};var _0x387225={};var _0x3c96a9;var _0x18a77a;return db[_0x2a63('0x3b')]['findOne']({'where':{'id':_0x45052e['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0xc3364e,null))[_0x2a63('0x28')](function(_0x2ca943){if(_0x2ca943){_0x3c96a9=_0x2ca943;_0x387225[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x6d')]['rawAttributes']);_0x387225[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x45052e['query']);_0x387225[_0x2a63('0x42')]=_['intersection'](_0x387225[_0x2a63('0x3f')],_0x387225['query']);_0x528f58[_0x2a63('0x44')]=_['intersection'](_0x387225['model'],qs['fields'](_0x45052e[_0x2a63('0x40')][_0x2a63('0x45')]));_0x528f58[_0x2a63('0x44')]=_0x528f58[_0x2a63('0x44')][_0x2a63('0x46')]?_0x528f58[_0x2a63('0x44')]:_0x387225[_0x2a63('0x3f')];_0x528f58[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x45052e[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x528f58['where']=qs['filters'](_['pick'](_0x45052e[_0x2a63('0x40')],_0x387225[_0x2a63('0x42')]));if(_0x45052e['query'][_0x2a63('0x2e')]){_0x528f58[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x528f58[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x528f58[_0x2a63('0x44')],function(_0xb9a2ce){var _0x5c8722={};_0x5c8722[_0xb9a2ce]={'$like':'%'+_0x45052e[_0x2a63('0x40')]['filter']+'%'};return _0x5c8722;})});}_0x528f58=_[_0x2a63('0x4d')]({},_0x528f58,_0x45052e[_0x2a63('0x54')]);return _0x3c96a9['getTeams'](_0x528f58);}})[_0x2a63('0x28')](function(_0x189f58){if(_0x189f58){_0x18a77a=_0x189f58[_0x2a63('0x46')];if(!_0x45052e['query']['hasOwnProperty'](_0x2a63('0x47'))){_0x528f58[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x45052e[_0x2a63('0x40')][_0x2a63('0x48')]);_0x528f58['offset']=qs[_0x2a63('0x23')](_0x45052e[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x3c96a9[_0x2a63('0x6e')](_0x528f58);}})[_0x2a63('0x28')](function(_0x30adb0){if(_0x30adb0){return _0x30adb0?{'count':_0x18a77a,'rows':_0x30adb0}:null;}})['then'](respondWithResult(_0xc3364e,null))[_0x2a63('0x55')](handleError(_0xc3364e,null));};exports[_0x2a63('0x6f')]=function(_0x487dcc,_0x33ad71,_0x58200c){var _0x431e36=_0x487dcc[_0x2a63('0x57')][_0x2a63('0x70')];var _0x5ea869=_['map'](_0x431e36,'id');return db[_0x2a63('0x6d')][_0x2a63('0x66')]({'where':{'id':_0x5ea869},'attributes':['id'],'include':[{'model':db[_0x2a63('0x71')],'as':_0x2a63('0x72'),'attributes':['id',_0x2a63('0x35'),_0x2a63('0x73'),_0x2a63('0x74'),_0x2a63('0x75')],'raw':!![]}]})[_0x2a63('0x28')](function(_0x504885){if(_0x504885){var _0x3749c8=_[_0x2a63('0x76')](_0x504885,function(_0x31fb6e){var _0x16c977=_0x31fb6e[_0x2a63('0x29')]({'plain':!![]});_0x16c977[_0x2a63('0x72')][_0x2a63('0x77')](function(_0x181b84){_0x181b84[_0x2a63('0x78')]=_['find'](_0x431e36,{'id':_0x16c977['id']})[_0x2a63('0x78')];});return _0x16c977['Agents'];});return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x487dcc['params']['id']}})[_0x2a63('0x28')](function(_0x41c58b){return db[_0x2a63('0x79')][_0x2a63('0x7a')](function(_0x2ec788){return _0x41c58b[_0x2a63('0x6f')](_0x5ea869,{'transaction':_0x2ec788})['then'](function(){return BPromise[_0x2a63('0x7b')](_0x3749c8,function(_0x2802e6){return db['UserVoiceQueue'][_0x2a63('0x7c')]({'where':{'UserId':_0x2802e6['id'],'VoiceQueueId':_0x487dcc[_0x2a63('0x53')]['id']},'defaults':{'penalty':_0x2802e6['penalty']},'transaction':_0x2ec788});});})[_0x2a63('0x28')](function(){return BPromise[_0x2a63('0x7b')](_[_0x2a63('0x2e')](_0x3749c8,{'online':!![]}),function(_0x53af41){return db[_0x2a63('0x7d')][_0x2a63('0x7e')]({'membername':_0x53af41['name'],'UserId':_0x53af41['id'],'queue_name':_0x41c58b['name'],'VoiceQueueId':_0x41c58b['id'],'interface':_[_0x2a63('0x7f')](_0x53af41[_0x2a63('0x75')])?util[_0x2a63('0x80')](_0x2a63('0x81'),_0x53af41[_0x2a63('0x35')]):_0x53af41[_0x2a63('0x75')],'paused':_0x53af41['voicePause']||![],'penalty':_0x53af41[_0x2a63('0x78')]},{'transaction':_0x2ec788});});})['then'](function(){_0x3749c8[_0x2a63('0x77')](function(_0x167c97){socket['emit'](_0x2a63('0x82'),{'UserId':_0x167c97['id'],'VoiceQueueId':_0x41c58b['id']});});});});});}})['then'](respondWithStatusCode(_0x33ad71,null))[_0x2a63('0x55')](handleError(_0x33ad71,null));};exports[_0x2a63('0x83')]=function(_0x4ed5b8,_0x3d17ac,_0x4a7a7c){return db[_0x2a63('0x6d')][_0x2a63('0x66')]({'where':{'id':_0x4ed5b8[_0x2a63('0x40')][_0x2a63('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a63('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2a63('0x28')](handleEntityNotFound(_0x3d17ac,null))[_0x2a63('0x28')](function(_0x1fdadc){var _0x500009=_[_0x2a63('0x30')](_0x1fdadc,'id');var _0x550fd5=[];var _0xaa7fa0=[];var _0x3b77d2=squel['select']();_0x3b77d2['field']('tq.TeamId')[_0x2a63('0x85')](_0x2a63('0x86'),'tq')[_0x2a63('0x87')]('user_has_teams','ut',_0x2a63('0x88'))[_0x2a63('0x4b')](_0x2a63('0x89'),_0x4ed5b8['params']['id']);for(var _0x13f124=0x0;_0x13f124<_0x1fdadc[_0x2a63('0x46')];_0x13f124+=0x1){let _0x54e74f=_0x1fdadc[_0x13f124];for(var _0x39c173=0x0;_0x39c173<_0x54e74f[_0x2a63('0x72')][_0x2a63('0x46')];_0x39c173+=0x1){let _0x2ac815=_0x54e74f[_0x2a63('0x72')][_0x39c173];var _0x26020f=_0x3b77d2[_0x2a63('0x5e')]();_0x26020f[_0x2a63('0x4b')]('ut.UserId\x20=\x20?',_0x2ac815['id']);_0xaa7fa0['push'](db['sequelize'][_0x2a63('0x40')](_0x26020f['toString'](),{'type':db[_0x2a63('0x79')]['QueryTypes'][_0x2a63('0x8a')]})[_0x2a63('0x28')](function(_0x40951d){if(_0x40951d[_0x2a63('0x46')]===0x1){return _0x2ac815['id'];}else{var _0x26735e=_[_0x2a63('0x8b')](_[_0x2a63('0x30')](_0x40951d,_0x2a63('0x8c')),function(_0x4444cf){return _[_0x2a63('0x32')](_0x500009,_0x4444cf);});if(_0x26735e){return _0x2ac815['id'];}}}));}}return BPromise[_0x2a63('0x8d')](_0xaa7fa0)[_0x2a63('0x28')](function(_0x4b3e10){_0x550fd5=_(_0x550fd5)[_0x2a63('0x8e')](_0x4b3e10)[_0x2a63('0x8f')]()['value']();return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x4ed5b8[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](function(_0x265217){return db[_0x2a63('0x79')][_0x2a63('0x7a')](function(_0x518d16){return _0x265217[_0x2a63('0x83')](_0x4ed5b8['query'][_0x2a63('0x84')],{'transaction':_0x518d16})[_0x2a63('0x28')](function(){if(!_[_0x2a63('0x90')](_0x550fd5)){return _0x265217['removeAgents'](_0x550fd5,{'transaction':_0x518d16})['then'](function(){return db[_0x2a63('0x7d')][_0x2a63('0x27')]({'where':{'VoiceQueueId':_0x4ed5b8['params']['id'],'UserId':_0x550fd5},'transaction':_0x518d16});});}})['then'](function(){_0x550fd5['forEach'](function(_0x20a7bf){socket[_0x2a63('0x91')]('userVoiceQueue:remove',{'UserId':_0x20a7bf,'VoiceQueueId':_0x265217['id']});});});});});});})['then'](respondWithStatusCode(_0x3d17ac,null))[_0x2a63('0x55')](handleError(_0x3d17ac,null));};exports[_0x2a63('0x92')]=function(_0x3dd2f9,_0x140574,_0x44ec3d){var _0x4ddeff,_0x389ec7;return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x3dd2f9[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x140574,null))[_0x2a63('0x28')](function(_0x46ac46){if(_0x46ac46){_0x389ec7=_0x46ac46;return _0x46ac46[_0x2a63('0x92')](_0x3dd2f9[_0x2a63('0x57')][_0x2a63('0x84')],_[_0x2a63('0x5f')](_0x3dd2f9['body'],[_0x2a63('0x84'),'id'])||{})['spread'](function(_0x433981){for(var _0x52f33d=0x0;_0x52f33d<_0x3dd2f9[_0x2a63('0x57')]['ids']['length'];_0x52f33d+=0x1){socket[_0x2a63('0x91')](_0x2a63('0x82'),{'UserId':_0x3dd2f9[_0x2a63('0x57')][_0x2a63('0x84')][_0x52f33d],'VoiceQueueId':_0x3dd2f9[_0x2a63('0x53')]['id']});}return _0x433981;});}})[_0x2a63('0x28')](function(_0x503eae){_0x4ddeff=_0x503eae||[];if(_0x389ec7){return db[_0x2a63('0x71')][_0x2a63('0x66')]({'where':{'id':_0x3dd2f9['body'][_0x2a63('0x84')]},'attributes':['id',_0x2a63('0x35'),_0x2a63('0x73'),_0x2a63('0x74'),'interface'],'raw':!![]});}})[_0x2a63('0x28')](function(_0x4843ea){if(!_[_0x2a63('0x90')](_0x4843ea)){var _0x15bf1f=[];for(var _0x5e5f7c=0x0;_0x5e5f7c<_0x4843ea[_0x2a63('0x46')];_0x5e5f7c++){if(_0x4843ea[_0x5e5f7c][_0x2a63('0x73')]){_0x15bf1f[_0x2a63('0x93')](db[_0x2a63('0x7d')]['upsert']({'membername':_0x4843ea[_0x5e5f7c][_0x2a63('0x35')],'UserId':_0x4843ea[_0x5e5f7c]['id'],'queue_name':_0x389ec7[_0x2a63('0x35')],'VoiceQueueId':_0x389ec7['id'],'interface':_[_0x2a63('0x7f')](_0x4843ea[_0x5e5f7c][_0x2a63('0x75')])?util[_0x2a63('0x80')](_0x2a63('0x81'),_0x4843ea[_0x5e5f7c]['name']):_0x4843ea[_0x5e5f7c][_0x2a63('0x75')],'paused':_0x4843ea[_0x5e5f7c]['voicePause']||![],'penalty':_0x3dd2f9[_0x2a63('0x57')][_0x2a63('0x78')]||0x0}));}}return BPromise[_0x2a63('0x8d')](_0x15bf1f);}})[_0x2a63('0x28')](function(){return _0x4ddeff;})['then'](respondWithResult(_0x140574,null))[_0x2a63('0x55')](handleError(_0x140574,null));};exports['removeAgents']=function(_0x33b909,_0x1303f3,_0x2a5edf){return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x33b909[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x1303f3,null))[_0x2a63('0x28')](function(_0x261178){if(_0x261178){return _0x261178[_0x2a63('0x94')](_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')])[_0x2a63('0x28')](function(){if(_['isArray'](_0x33b909['query']['ids'])){for(var _0x339b09=0x0;_0x339b09<_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')][_0x2a63('0x46')];_0x339b09+=0x1){socket[_0x2a63('0x91')](_0x2a63('0x95'),{'UserId':Number(_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')][_0x339b09]),'VoiceQueueId':Number(_0x33b909['params']['id'])});}}else{socket[_0x2a63('0x91')](_0x2a63('0x95'),{'UserId':Number(_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')]),'VoiceQueueId':Number(_0x33b909[_0x2a63('0x53')]['id'])});}});}})[_0x2a63('0x28')](function(_0x54ebc2){return db[_0x2a63('0x7d')][_0x2a63('0x27')]({'where':{'VoiceQueueId':_0x33b909[_0x2a63('0x53')]['id'],'UserId':_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')]}})[_0x2a63('0x28')](function(){return _0x54ebc2;});})['then'](respondWithStatusCode(_0x1303f3,null))[_0x2a63('0x55')](handleError(_0x1303f3,null));};exports[_0x2a63('0x96')]=function(_0x192e9b,_0x3d09eb,_0x303633){var _0x31672d={};var _0x58555c={};var _0x1ab630;var _0x260824;return db['VoiceQueue'][_0x2a63('0x68')]({'where':{'id':_0x192e9b[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x3d09eb,null))[_0x2a63('0x28')](function(_0x2b56f2){if(_0x2b56f2){_0x1ab630=_0x2b56f2;_0x58555c[_0x2a63('0x3f')]=_['keys'](db['User']['rawAttributes']);_0x58555c[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x192e9b['query']);_0x58555c[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x58555c['model'],_0x58555c[_0x2a63('0x40')]);_0x31672d['attributes']=_[_0x2a63('0x43')](_0x58555c[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x45')]));_0x31672d[_0x2a63('0x44')]=_0x31672d['attributes'][_0x2a63('0x46')]?_0x31672d[_0x2a63('0x44')]:_0x58555c[_0x2a63('0x3f')];_0x31672d['order']=qs[_0x2a63('0x4a')](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x31672d[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_['pick'](_0x192e9b['query'],_0x58555c[_0x2a63('0x42')]));if(_0x192e9b['query'][_0x2a63('0x2e')]){_0x31672d['where']=_[_0x2a63('0x4d')](_0x31672d[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x31672d['attributes'],function(_0x41baef){var _0x4a44e1={};_0x4a44e1[_0x41baef]={'$like':'%'+_0x192e9b[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x4a44e1;})});}_0x31672d=_[_0x2a63('0x4d')]({},_0x31672d,_0x192e9b[_0x2a63('0x54')]);return _0x1ab630['getAgents'](_0x31672d);}})['then'](function(_0x55dc8a){if(_0x55dc8a){_0x260824=_0x55dc8a[_0x2a63('0x46')];if(!_0x192e9b['query'][_0x2a63('0x64')](_0x2a63('0x47'))){_0x31672d[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x48')]);_0x31672d[_0x2a63('0x23')]=qs['offset'](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x1ab630[_0x2a63('0x96')](_0x31672d);}})[_0x2a63('0x28')](function(_0x45814f){if(_0x45814f){return _0x45814f?{'count':_0x260824,'rows':_0x45814f}:null;}})[_0x2a63('0x28')](respondWithResult(_0x3d09eb,null))['catch'](handleError(_0x3d09eb,null));};exports[_0x2a63('0x97')]=function(_0x5acd80,_0x5a3276,_0x4513d9){var _0x155db5={};var _0x4a37a4={};var _0x32f702;var _0x2b1859;return db[_0x2a63('0x3b')]['findOne']({'where':{'id':_0x5acd80[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x5a3276,null))[_0x2a63('0x28')](function(_0x223e67){if(_0x223e67){_0x32f702=_0x223e67;_0x4a37a4['model']=_[_0x2a63('0x41')](db[_0x2a63('0x7d')][_0x2a63('0x3c')]);_0x4a37a4[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x5acd80['query']);_0x4a37a4['filters']=_[_0x2a63('0x43')](_0x4a37a4[_0x2a63('0x3f')],_0x4a37a4[_0x2a63('0x40')]);_0x155db5[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x4a37a4[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x5acd80[_0x2a63('0x40')][_0x2a63('0x45')]));_0x155db5['attributes']=_0x155db5[_0x2a63('0x44')][_0x2a63('0x46')]?_0x155db5['attributes']:_0x4a37a4[_0x2a63('0x3f')];_0x155db5[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x5acd80[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x155db5[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_['pick'](_0x5acd80[_0x2a63('0x40')],_0x4a37a4[_0x2a63('0x42')]));if(_0x5acd80[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x155db5[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x155db5[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x155db5[_0x2a63('0x44')],function(_0x43264a){var _0x150039={};_0x150039[_0x43264a]={'$like':'%'+_0x5acd80[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x150039;})});}_0x155db5=_['merge']({},_0x155db5,_0x5acd80[_0x2a63('0x54')]);return _0x32f702[_0x2a63('0x97')](_0x155db5);}})[_0x2a63('0x28')](function(_0x226ff5){if(_0x226ff5){_0x2b1859=_0x226ff5[_0x2a63('0x46')];if(!_0x5acd80[_0x2a63('0x40')]['hasOwnProperty'](_0x2a63('0x47'))){_0x155db5[_0x2a63('0x48')]=qs['limit'](_0x5acd80['query'][_0x2a63('0x48')]);_0x155db5[_0x2a63('0x23')]=qs[_0x2a63('0x23')](_0x5acd80[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x32f702['getMembers'](_0x155db5);}})[_0x2a63('0x28')](function(_0x915d6f){return _0x915d6f?{'count':_0x2b1859,'rows':_0x915d6f}:null;})[_0x2a63('0x28')](respondWithResult(_0x5a3276,null))['catch'](handleError(_0x5a3276,null));};exports[_0x2a63('0x98')]=function(_0x253df9,_0x30dfe6,_0xca4c85){var _0x78f54a={};var _0x21f333={};var _0x46b5f1;var _0x380c38;return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0x253df9['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x30dfe6,null))[_0x2a63('0x28')](function(_0x57fb26){if(_0x57fb26){_0x46b5f1=_0x57fb26;_0x21f333[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x99')]['rawAttributes']);_0x21f333[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x253df9[_0x2a63('0x40')]);_0x21f333[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x21f333['model'],_0x21f333[_0x2a63('0x40')]);_0x78f54a[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x21f333[_0x2a63('0x3f')],qs['fields'](_0x253df9['query']['fields']));_0x78f54a[_0x2a63('0x44')]=_0x78f54a[_0x2a63('0x44')][_0x2a63('0x46')]?_0x78f54a[_0x2a63('0x44')]:_0x21f333[_0x2a63('0x3f')];_0x78f54a[_0x2a63('0x49')]=qs['sort'](_0x253df9[_0x2a63('0x40')]['sort']);_0x78f54a['where']=qs['filters'](_[_0x2a63('0x4c')](_0x253df9['query'],_0x21f333[_0x2a63('0x42')]));if(_0x253df9[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x78f54a['where']=_[_0x2a63('0x4d')](_0x78f54a[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x78f54a[_0x2a63('0x44')],function(_0x46f4b9){var _0x43efb2={};_0x43efb2[_0x46f4b9]={'$like':'%'+_0x253df9[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x43efb2;})});}_0x78f54a=_[_0x2a63('0x4d')]({},_0x78f54a,_0x253df9['options']);return _0x46b5f1[_0x2a63('0x98')](_0x78f54a);}})[_0x2a63('0x28')](function(_0x2c6498){if(_0x2c6498){_0x380c38=_0x2c6498['length'];if(!_0x253df9[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x78f54a[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x253df9[_0x2a63('0x40')]['limit']);_0x78f54a['offset']=qs[_0x2a63('0x23')](_0x253df9[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x46b5f1[_0x2a63('0x98')](_0x78f54a);}})[_0x2a63('0x28')](function(_0x3d1d10){if(_0x3d1d10){return _0x3d1d10?{'count':_0x380c38,'rows':_0x3d1d10}:null;}})[_0x2a63('0x28')](respondWithResult(_0x30dfe6,null))['catch'](handleError(_0x30dfe6,null));};exports['addLists']=function(_0x25cfa2,_0x3ef4ae,_0x547a06){var _0x487d74,_0x2f1692;return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x25cfa2['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x3ef4ae,null))['then'](function(_0x5a1c8f){if(_0x5a1c8f){_0x2f1692=_0x5a1c8f;return _0x5a1c8f[_0x2a63('0x9a')](_0x25cfa2[_0x2a63('0x57')][_0x2a63('0x84')],_[_0x2a63('0x5f')](_0x25cfa2[_0x2a63('0x57')],[_0x2a63('0x84'),'id'])||{});}return null;})[_0x2a63('0x9b')](function(_0x4ca728){var _0x2df2c9;_0x487d74=_0x4ca728||[];var _0x473929=[];if(_0x4ca728){for(var _0x56442b=0x0;_0x56442b<_0x4ca728[_0x2a63('0x46')];_0x56442b+=0x1){var _0x21530a=_0x4ca728[_0x56442b][_0x2a63('0x29')]({'plain':!![]});_0x2f1692['dialCheckDuplicateType']=_0x25cfa2[_0x2a63('0x57')][_0x2a63('0x9c')]?_0x25cfa2[_0x2a63('0x57')][_0x2a63('0x9c')]:_0x2f1692[_0x2a63('0x9c')];switch(_0x2f1692['dialCheckDuplicateType']){case _0x2a63('0x9d'):_0x2df2c9=squel['insert']()['into'](_0x2a63('0x9e'))['fromQuery']([_0x2a63('0x9f'),_0x2a63('0xa0'),_0x2a63('0xa1'),'ListId',_0x2a63('0x65'),_0x2a63('0x60'),_0x2a63('0x61')],squel[_0x2a63('0xa2')]()['field'](_0x2a63('0x9f'),'phone')[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0xa0'))[_0x2a63('0xa3')]('id','ContactId')[_0x2a63('0xa3')](_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')](),_0x2a63('0xa7'))[_0x2a63('0xa3')](_0x25cfa2['params']['id'][_0x2a63('0xa6')](),_0x2a63('0x65'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0x60'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0x61'))['from']('cm_contacts')[_0x2a63('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x21530a[_0x2a63('0xa5')]['toString']())[_0x2a63('0x4b')](_0x2a63('0xa8'))[_0x2a63('0x4b')](_0x2a63('0xa9'),squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')](_0x2a63('0xaa'))[_0x2a63('0x85')](_0x2a63('0xab'))[_0x2a63('0x4b')](_0x2a63('0x89'),_0x25cfa2['params']['id'][_0x2a63('0xa6')]()))[_0x2a63('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')]('COALESCE(phone,\x27\x27)')[_0x2a63('0x85')](_0x2a63('0x9e'))['where'](_0x2a63('0x89'),_0x25cfa2[_0x2a63('0x53')]['id'][_0x2a63('0xa6')]())))['toString']();break;case'onlyIfOpen':_0x2df2c9=squel[_0x2a63('0xac')]()[_0x2a63('0xad')](_0x2a63('0x9e'))[_0x2a63('0xae')]([_0x2a63('0x9f'),_0x2a63('0xa0'),'ContactId',_0x2a63('0xa7'),_0x2a63('0x65'),'createdAt',_0x2a63('0x61')],squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')](_0x2a63('0x9f'),_0x2a63('0x9f'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0xa0'))['field']('id','ContactId')['field'](_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')](),_0x2a63('0xa7'))[_0x2a63('0xa3')](_0x25cfa2[_0x2a63('0x53')]['id']['toString'](),'VoiceQueueId')['field'](_0x2a63('0xa4'),_0x2a63('0x60'))[_0x2a63('0xa3')]('NOW()','updatedAt')[_0x2a63('0x85')](_0x2a63('0xaf'))[_0x2a63('0x4b')](_0x2a63('0xb0'))[_0x2a63('0x4b')](_0x2a63('0xb1'),_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')]())[_0x2a63('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0x2a63('0x4b')](_0x2a63('0xa9'),squel[_0x2a63('0xa2')]()['field']('COALESCE(phone,\x27\x27)')[_0x2a63('0x85')]('cm_hopper')[_0x2a63('0x4b')](_0x2a63('0x89'),_0x25cfa2[_0x2a63('0x53')]['id'][_0x2a63('0xa6')]())))[_0x2a63('0xa6')]();break;default:_0x2df2c9=squel[_0x2a63('0xac')]()[_0x2a63('0xad')]('cm_hopper')[_0x2a63('0xae')]([_0x2a63('0x9f'),_0x2a63('0xa0'),_0x2a63('0xa1'),'ListId',_0x2a63('0x65'),_0x2a63('0x60'),'updatedAt'],squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')](_0x2a63('0x9f'),_0x2a63('0x9f'))[_0x2a63('0xa3')]('NOW()','scheduledAt')['field']('id','ContactId')['field'](_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')](),_0x2a63('0xa7'))[_0x2a63('0xa3')](_0x25cfa2[_0x2a63('0x53')]['id'][_0x2a63('0xa6')](),_0x2a63('0x65'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0x60'))[_0x2a63('0xa3')](_0x2a63('0xa4'),'updatedAt')['from'](_0x2a63('0xaf'))[_0x2a63('0x4b')](_0x2a63('0xb0'))[_0x2a63('0x4b')](_0x2a63('0xb1'),_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')]())[_0x2a63('0x4b')](_0x2a63('0xa8')))[_0x2a63('0xa6')]();}_0x473929[_0x2a63('0x93')](db['sequelize'][_0x2a63('0x40')](_0x2df2c9));}return BPromise['all'](_0x473929);}})[_0x2a63('0x28')](function(){return _0x487d74;})[_0x2a63('0x28')](respondWithResult(_0x3ef4ae,null))[_0x2a63('0x55')](handleError(_0x3ef4ae,null));};exports[_0x2a63('0xb2')]=function(_0x52f188,_0x58136b,_0x708e80){return db[_0x2a63('0x3b')]['find']({'where':{'id':_0x52f188[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x58136b,null))[_0x2a63('0x28')](function(_0x1eb828){if(_0x1eb828){return _0x1eb828[_0x2a63('0xb2')](_0x52f188[_0x2a63('0x40')][_0x2a63('0x84')]);}})[_0x2a63('0x28')](function(_0xa38c81){if(_0xa38c81){return db[_0x2a63('0x63')][_0x2a63('0x27')]({'where':{'ListId':_0x52f188[_0x2a63('0x40')][_0x2a63('0x84')],'VoiceQueueId':_0x52f188['params']['id']}})[_0x2a63('0x28')](function(){return _0xa38c81;});}})['then'](respondWithStatusCode(_0x58136b,null))[_0x2a63('0x55')](handleError(_0x58136b,null));};exports['getBlackLists']=function(_0x4b5fde,_0x3b2b80,_0x11f298){var _0x13bda1={};var _0x1e4a47={};var _0x130612;var _0xc0f4ea;return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0x4b5fde[_0x2a63('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b2b80,null))[_0x2a63('0x28')](function(_0x532253){if(_0x532253){_0x130612=_0x532253;_0x1e4a47[_0x2a63('0x3f')]=_['keys'](db[_0x2a63('0x99')][_0x2a63('0x3c')]);_0x1e4a47[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x4b5fde[_0x2a63('0x40')]);_0x1e4a47[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x1e4a47['model'],_0x1e4a47[_0x2a63('0x40')]);_0x13bda1[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x1e4a47['model'],qs[_0x2a63('0x45')](_0x4b5fde[_0x2a63('0x40')]['fields']));_0x13bda1[_0x2a63('0x44')]=_0x13bda1[_0x2a63('0x44')][_0x2a63('0x46')]?_0x13bda1[_0x2a63('0x44')]:_0x1e4a47[_0x2a63('0x3f')];_0x13bda1['order']=qs['sort'](_0x4b5fde['query'][_0x2a63('0x4a')]);_0x13bda1['where']=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x4b5fde[_0x2a63('0x40')],_0x1e4a47[_0x2a63('0x42')]));if(_0x4b5fde[_0x2a63('0x40')]['filter']){_0x13bda1['where']=_[_0x2a63('0x4d')](_0x13bda1[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x13bda1['attributes'],function(_0x5ee5b9){var _0x5ebe85={};_0x5ebe85[_0x5ee5b9]={'$like':'%'+_0x4b5fde[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x5ebe85;})});}_0x13bda1=_[_0x2a63('0x4d')]({},_0x13bda1,_0x4b5fde['options']);return _0x130612['getBlackLists'](_0x13bda1);}})['then'](function(_0x4bdcf6){if(_0x4bdcf6){_0xc0f4ea=_0x4bdcf6[_0x2a63('0x46')];if(!_0x4b5fde[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x13bda1[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x4b5fde['query'][_0x2a63('0x48')]);_0x13bda1['offset']=qs[_0x2a63('0x23')](_0x4b5fde[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x130612[_0x2a63('0xb3')](_0x13bda1);}})[_0x2a63('0x28')](function(_0x3aad2a){if(_0x3aad2a){return _0x3aad2a?{'count':_0xc0f4ea,'rows':_0x3aad2a}:null;}})[_0x2a63('0x28')](respondWithResult(_0x3b2b80,null))[_0x2a63('0x55')](handleError(_0x3b2b80,null));};exports[_0x2a63('0xb4')]=function(_0x24f8ea,_0x4f9187,_0xe9bc85){var _0x4f619e,_0x482c6b;return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x24f8ea[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x4f9187,null))[_0x2a63('0x28')](function(_0x427683){if(_0x427683){_0x482c6b=_0x427683;return _0x427683['addBlackLists'](_0x24f8ea['body'][_0x2a63('0x84')],_[_0x2a63('0x5f')](_0x24f8ea[_0x2a63('0x57')],[_0x2a63('0x84'),'id'])||{});}return null;})[_0x2a63('0x9b')](function(_0x4f84ad){var _0x324dfd;_0x4f619e=_0x4f84ad||[];var _0x3b956d=[];if(_0x4f84ad){for(var _0x52cb01=0x0;_0x52cb01<_0x4f84ad[_0x2a63('0x46')];_0x52cb01+=0x1){var _0xc001cc=_0x4f84ad[_0x52cb01][_0x2a63('0x29')]({'plain':!![]});_0x324dfd=squel[_0x2a63('0xac')]()[_0x2a63('0xad')](_0x2a63('0xb5'))[_0x2a63('0xae')]([_0x2a63('0x9f'),_0x2a63('0xa1'),_0x2a63('0xa7'),_0x2a63('0x65'),_0x2a63('0x60'),_0x2a63('0x61')],squel[_0x2a63('0xa2')]()['field']('phone',_0x2a63('0x9f'))['field']('id','ContactId')[_0x2a63('0xa3')](_0xc001cc['CmListId'][_0x2a63('0xa6')](),'ListId')[_0x2a63('0xa3')](_0x24f8ea[_0x2a63('0x53')]['id'][_0x2a63('0xa6')](),_0x2a63('0x65'))[_0x2a63('0xa3')](_0x2a63('0xa4'),'createdAt')[_0x2a63('0xa3')]('NOW()',_0x2a63('0x61'))[_0x2a63('0x85')](_0x2a63('0xaf'))[_0x2a63('0x4b')]('deletedAt\x20IS\x20NULL')[_0x2a63('0x4b')](_0x2a63('0xb1'),_0xc001cc['CmListId'][_0x2a63('0xa6')]())[_0x2a63('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x2a63('0xa6')]();_0x3b956d[_0x2a63('0x93')](db[_0x2a63('0x79')][_0x2a63('0x40')](_0x324dfd));}return BPromise['all'](_0x3b956d);}})[_0x2a63('0x28')](function(){return _0x4f619e;})['then'](respondWithResult(_0x4f9187,null))[_0x2a63('0x55')](handleError(_0x4f9187,null));};exports[_0x2a63('0xb6')]=function(_0x5cd250,_0x4e56b0,_0x7f850){return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x5cd250[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x4e56b0,null))['then'](function(_0x5d6b9e){if(_0x5d6b9e){return _0x5d6b9e[_0x2a63('0xb6')](_0x5cd250['query'][_0x2a63('0x84')]);}})[_0x2a63('0x28')](function(_0x2f9a47){if(_0x2f9a47){return db[_0x2a63('0x6c')]['destroy']({'where':{'ListId':_0x5cd250[_0x2a63('0x40')]['ids'],'VoiceQueueId':_0x5cd250[_0x2a63('0x53')]['id']}})['then'](function(){return _0x2f9a47;});}})[_0x2a63('0x28')](respondWithStatusCode(_0x4e56b0,null))[_0x2a63('0x55')](handleError(_0x4e56b0,null));}; \ No newline at end of file +var _0xc493=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','length','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','body','omit','QueueCampaigns','getHoppers','findOne','CmHopper','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','ContactId','ListId','phone','scheduledAt','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','localhost','redis','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','destroy','get','inbound','outbound','ignore','map','value','includes','find','type','UserProfileResource','then','error','name','send','VoiceQueue','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc493,0x76));var _0x3c49=function(_0x4f23ba,_0x31a525){_0x4f23ba=_0x4f23ba-0x0;var _0x35d280=_0xc493[_0x4f23ba];return _0x35d280;};'use strict';var pdf=require(_0x3c49('0x0'));var emlformat=require(_0x3c49('0x1'));var rimraf=require(_0x3c49('0x2'));var zipdir=require(_0x3c49('0x3'));var jsonpatch=require(_0x3c49('0x4'));var rp=require(_0x3c49('0x5'));var moment=require('moment');var BPromise=require(_0x3c49('0x6'));var Mustache=require(_0x3c49('0x7'));var util=require(_0x3c49('0x8'));var path=require(_0x3c49('0x9'));var sox=require(_0x3c49('0xa'));var csv=require(_0x3c49('0xb'));var ejs=require(_0x3c49('0xc'));var fs=require('fs');var _=require(_0x3c49('0xd'));var squel=require(_0x3c49('0xe'));var crypto=require(_0x3c49('0xf'));var jsforce=require(_0x3c49('0x10'));var deskjs=require(_0x3c49('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3c49('0x12'));var Papa=require(_0x3c49('0x13'));var Redis=require(_0x3c49('0x14'));var authService=require(_0x3c49('0x15'));var qs=require(_0x3c49('0x16'));var as=require(_0x3c49('0x17'));var hardwareService=require(_0x3c49('0x18'));var logger=require(_0x3c49('0x19'))(_0x3c49('0x1a'));var utils=require(_0x3c49('0x1b'));var config=require('../../config/environment');var db=require(_0x3c49('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3c49('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c49('0x1e')]));require('./voiceQueue.socket')[_0x3c49('0x1f')](socket);function respondWithStatusCode(_0x5c0de6,_0x525885){_0x525885=_0x525885||0xcc;return function(_0x26470b){if(_0x26470b){return _0x5c0de6[_0x3c49('0x20')](_0x525885);}return _0x5c0de6['status'](_0x525885)[_0x3c49('0x21')]();};}function respondWithResult(_0x621b72,_0xf9df55){_0xf9df55=_0xf9df55||0xc8;return function(_0x19b8e5){if(_0x19b8e5){return _0x621b72[_0x3c49('0x22')](_0xf9df55)[_0x3c49('0x23')](_0x19b8e5);}};}function respondWithFilteredResult(_0x45070e,_0x575ce4){return function(_0x2cf07){if(_0x2cf07){var _0x3d9a28=_0x2cf07[_0x3c49('0x24')],_0x41690c=_0x575ce4[_0x3c49('0x25')],_0xa0d04=_0x575ce4['offset']+_0x575ce4[_0x3c49('0x26')],_0x1b2e9e;if(_0xa0d04>=_0x3d9a28){_0xa0d04=_0x3d9a28;_0x1b2e9e=0xc8;}else{_0x1b2e9e=0xce;}_0x45070e['status'](_0x1b2e9e);return _0x45070e[_0x3c49('0x27')]('Content-Range',_0x41690c+'-'+_0xa0d04+'/'+_0x3d9a28)[_0x3c49('0x23')](_0x2cf07);}return null;};}function patchUpdates(_0x216d9f){return function(_0x20cac5){try{jsonpatch[_0x3c49('0x28')](_0x20cac5,_0x216d9f,!![]);}catch(_0xf6010f){return BPromise['reject'](_0xf6010f);}return _0x20cac5[_0x3c49('0x29')]();};}function saveUpdates(_0x463597,_0x5bb0e1){return function(_0x3b88fe){if(_0x3b88fe){return _0x3b88fe[_0x3c49('0x2a')](_0x463597)['then'](function(_0x1c76f9){return _0x1c76f9;});}return null;};}function removeEntity(_0x5e0028,_0x50edd2){return function(_0x5762b4){if(_0x5762b4){return _0x5762b4[_0x3c49('0x2b')]()['then'](function(){var _0x1f0b13=_0x5762b4[_0x3c49('0x2c')]({'plain':!![]});var _0x3308ad=[{'name':'VoiceQueues','value':_0x3c49('0x2d'),'ignore':![]},{'name':'QueueCampaigns','value':_0x3c49('0x2e'),'ignore':![]}];var _0x2ff431=_(_0x3308ad)['filter'](_0x3c49('0x2f'))[_0x3c49('0x30')]('value')[_0x3c49('0x31')]();if(_[_0x3c49('0x32')](_0x2ff431,_0x1f0b13['type'])){return;}var _0x3c1f1f=_[_0x3c49('0x33')](_0x3308ad,[_0x3c49('0x31'),_0x1f0b13[_0x3c49('0x34')]])['name'];return db[_0x3c49('0x35')][_0x3c49('0x2b')]({'where':{'type':_0x3c1f1f,'resourceId':_0x1f0b13['id']}})[_0x3c49('0x36')](function(){return _0x5762b4;});})[_0x3c49('0x36')](function(){_0x5e0028['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6d8a,_0x2b70b9){return function(_0x46d1bb){if(!_0x46d1bb){_0x4d6d8a['sendStatus'](0x194);}return _0x46d1bb;};}function handleError(_0x2ef64a,_0x3689a7){_0x3689a7=_0x3689a7||0x1f4;return function(_0x4e7028){logger[_0x3c49('0x37')](_0x4e7028['stack']);if(_0x4e7028[_0x3c49('0x38')]){delete _0x4e7028[_0x3c49('0x38')];}_0x2ef64a[_0x3c49('0x22')](_0x3689a7)[_0x3c49('0x39')](_0x4e7028);};}exports['index']=function(_0x1263bd,_0x47e1b0){var _0x5f231e={},_0x4dd097={},_0x445f0b={'count':0x0,'rows':[]};var _0x52cbb5=_['map'](db[_0x3c49('0x3a')][_0x3c49('0x3b')],function(_0x23d059){return{'name':_0x23d059['fieldName'],'type':_0x23d059[_0x3c49('0x34')][_0x3c49('0x3c')]};});_0x4dd097['model']=_[_0x3c49('0x30')](_0x52cbb5,_0x3c49('0x38'));_0x4dd097[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x1263bd[_0x3c49('0x3d')]);_0x4dd097[_0x3c49('0x3f')]=_[_0x3c49('0x40')](_0x4dd097[_0x3c49('0x41')],_0x4dd097[_0x3c49('0x3d')]);_0x5f231e[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x4dd097[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x1263bd[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x5f231e[_0x3c49('0x42')]=_0x5f231e[_0x3c49('0x42')]['length']?_0x5f231e[_0x3c49('0x42')]:_0x4dd097[_0x3c49('0x41')];if(!_0x1263bd['query'][_0x3c49('0x44')](_0x3c49('0x45'))){_0x5f231e[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x1263bd['query'][_0x3c49('0x26')]);_0x5f231e['offset']=qs[_0x3c49('0x25')](_0x1263bd[_0x3c49('0x3d')][_0x3c49('0x25')]);}_0x5f231e[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x1263bd['query'][_0x3c49('0x47')]);_0x5f231e[_0x3c49('0x48')]=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0x1263bd[_0x3c49('0x3d')],_0x4dd097[_0x3c49('0x3f')]),_0x52cbb5);if(_0x1263bd[_0x3c49('0x3d')]['filter']){_0x5f231e[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x5f231e[_0x3c49('0x48')],{'$or':_[_0x3c49('0x30')](_0x52cbb5,function(_0x47cb36){if(_0x47cb36[_0x3c49('0x34')]!==_0x3c49('0x4b')){var _0xaa2558={};_0xaa2558[_0x47cb36[_0x3c49('0x38')]]={'$like':'%'+_0x1263bd['query'][_0x3c49('0x4c')]+'%'};return _0xaa2558;}})});}_0x5f231e=_['merge']({},_0x5f231e,_0x1263bd[_0x3c49('0x4d')]);var _0x3e33e2={'where':_0x5f231e[_0x3c49('0x48')]};return db[_0x3c49('0x3a')][_0x3c49('0x24')](_0x3e33e2)['then'](function(_0x23a1ce){_0x445f0b[_0x3c49('0x24')]=_0x23a1ce;if(_0x1263bd[_0x3c49('0x3d')][_0x3c49('0x4e')]){_0x5f231e['include']=[{'all':!![]}];}return db[_0x3c49('0x3a')][_0x3c49('0x4f')](_0x5f231e);})[_0x3c49('0x36')](function(_0x1b0d95){_0x445f0b[_0x3c49('0x50')]=_0x1b0d95;return _0x445f0b;})[_0x3c49('0x36')](respondWithFilteredResult(_0x47e1b0,_0x5f231e))['catch'](handleError(_0x47e1b0,null));};exports[_0x3c49('0x51')]=function(_0x27e034,_0x9ca4dd){var _0x2f69be={'raw':![],'where':{'id':_0x27e034['params']['id']}},_0x14c63a={};_0x14c63a[_0x3c49('0x41')]=_[_0x3c49('0x3e')](db[_0x3c49('0x3a')][_0x3c49('0x3b')]);_0x14c63a[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x27e034['query']);_0x14c63a[_0x3c49('0x3f')]=_['intersection'](_0x14c63a[_0x3c49('0x41')],_0x14c63a['query']);_0x2f69be[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x14c63a[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x27e034[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x2f69be[_0x3c49('0x42')]=_0x2f69be[_0x3c49('0x42')][_0x3c49('0x52')]?_0x2f69be[_0x3c49('0x42')]:_0x14c63a['model'];if(_0x27e034['query'][_0x3c49('0x4e')]){_0x2f69be[_0x3c49('0x53')]=[{'all':!![]}];}_0x2f69be=_[_0x3c49('0x4a')]({},_0x2f69be,_0x27e034[_0x3c49('0x4d')]);return db['VoiceQueue']['find'](_0x2f69be)[_0x3c49('0x36')](handleEntityNotFound(_0x9ca4dd,null))[_0x3c49('0x36')](respondWithResult(_0x9ca4dd,null))[_0x3c49('0x54')](handleError(_0x9ca4dd,null));};exports[_0x3c49('0x55')]=function(_0x1a7a20,_0x3f89af){return db[_0x3c49('0x3a')]['create'](_0x1a7a20['body'],{})[_0x3c49('0x36')](function(_0x56b69d){var _0x595e17=_0x1a7a20[_0x3c49('0x56')][_0x3c49('0x2c')]({'plain':!![]});if(!_0x595e17)throw new Error(_0x3c49('0x57'));if(_0x595e17[_0x3c49('0x58')]==='user'){var _0x4097a1=_0x56b69d['get']({'plain':!![]});var _0x633d72=[{'name':_0x3c49('0x59'),'value':_0x3c49('0x2d')},{'name':'QueueCampaigns','value':_0x3c49('0x2e')}];var _0x32a7b8=_[_0x3c49('0x33')](_0x633d72,[_0x3c49('0x31'),_0x4097a1[_0x3c49('0x34')]])[_0x3c49('0x38')];return db[_0x3c49('0x5a')][_0x3c49('0x33')]({'where':{'name':_0x32a7b8,'userProfileId':_0x595e17[_0x3c49('0x5b')]},'raw':!![]})[_0x3c49('0x36')](function(_0x47588d){if(_0x47588d&&_0x47588d[_0x3c49('0x5c')]===0x0){return db['UserProfileResource'][_0x3c49('0x55')]({'name':_0x4097a1[_0x3c49('0x38')],'resourceId':_0x4097a1['id'],'type':_0x47588d[_0x3c49('0x38')],'sectionId':_0x47588d['id']},{})['then'](function(){return _0x56b69d;});}else{return _0x56b69d;}})[_0x3c49('0x54')](function(_0x2292cf){logger[_0x3c49('0x37')](_0x3c49('0x5d'),_0x2292cf);throw _0x2292cf;});}return _0x56b69d;})[_0x3c49('0x36')](respondWithResult(_0x3f89af,0xc9))[_0x3c49('0x54')](handleError(_0x3f89af,null));};exports[_0x3c49('0x5e')]=function(_0x1564ea,_0x4f29bd){var _0x53f6a9={'where':{'id':_0x1564ea[_0x3c49('0x5f')]['id']}},_0x1879a8={};_0x1879a8[_0x3c49('0x41')]=_[_0x3c49('0x3e')](db['VoiceQueue'][_0x3c49('0x3b')]);_0x53f6a9[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x1879a8[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x1564ea[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x53f6a9[_0x3c49('0x42')]=_0x53f6a9[_0x3c49('0x42')][_0x3c49('0x52')]?_0x53f6a9[_0x3c49('0x42')]:_0x1879a8['model'];if(_0x1564ea['query']['includeAll']){_0x53f6a9[_0x3c49('0x53')]=[{'all':!![]}];}_0x53f6a9=_[_0x3c49('0x4a')]({},_0x53f6a9,_0x1564ea[_0x3c49('0x4d')]);return db[_0x3c49('0x3a')][_0x3c49('0x33')](_0x53f6a9)[_0x3c49('0x36')](handleEntityNotFound(_0x4f29bd,null))[_0x3c49('0x36')](function(_0x105c91){if(_0x105c91){var _0x281a01=_0x105c91['get']({'plain':!![]});_0x281a01=qs['omit'](_0x281a01,['id',_0x3c49('0x60'),_0x3c49('0x61')]);_0x1564ea[_0x3c49('0x62')]=_[_0x3c49('0x63')](_0x1564ea[_0x3c49('0x62')],['id','createdAt','updatedAt']);return db['VoiceQueue']['create'](_[_0x3c49('0x4a')](_0x281a01,_0x1564ea['body']),{'include':_0x1564ea['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5423d7){var _0x4b9b4a=_0x1564ea[_0x3c49('0x56')][_0x3c49('0x2c')]({'plain':!![]});if(!_0x4b9b4a)throw new Error(_0x3c49('0x57'));if(_0x4b9b4a[_0x3c49('0x58')]===_0x3c49('0x56')){var _0x9cf75f=_0x5423d7[_0x3c49('0x2c')]({'plain':!![]});var _0x272f52=[{'name':_0x3c49('0x59'),'value':'inbound'},{'name':_0x3c49('0x64'),'value':_0x3c49('0x2e')}];var _0x18b959=_[_0x3c49('0x33')](_0x272f52,[_0x3c49('0x31'),_0x9cf75f['type']])[_0x3c49('0x38')];return db['UserProfileSection']['find']({'where':{'name':_0x18b959,'userProfileId':_0x4b9b4a[_0x3c49('0x5b')]},'raw':!![]})[_0x3c49('0x36')](function(_0x30bcac){if(_0x30bcac&&_0x30bcac['autoAssociation']===0x0){return db['UserProfileResource'][_0x3c49('0x55')]({'name':_0x9cf75f['name'],'resourceId':_0x9cf75f['id'],'type':_0x30bcac['name'],'sectionId':_0x30bcac['id']},{})[_0x3c49('0x36')](function(){return _0x5423d7;});}else{return _0x5423d7;}})[_0x3c49('0x54')](function(_0x529e8f){logger[_0x3c49('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x529e8f);throw _0x529e8f;});}return _0x5423d7;});}})['then'](respondWithResult(_0x4f29bd,0xc9))[_0x3c49('0x54')](handleError(_0x4f29bd,null));};exports[_0x3c49('0x2a')]=function(_0x7dcde6,_0x212c3a){if(_0x7dcde6[_0x3c49('0x62')]['id']){delete _0x7dcde6['body']['id'];}return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x7dcde6[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x212c3a,null))[_0x3c49('0x36')](saveUpdates(_0x7dcde6['body'],null))[_0x3c49('0x36')](respondWithResult(_0x212c3a,null))[_0x3c49('0x54')](handleError(_0x212c3a,null));};exports[_0x3c49('0x2b')]=function(_0x56a53e,_0x2985dc){return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x56a53e['params']['id']}})['then'](handleEntityNotFound(_0x2985dc,null))[_0x3c49('0x36')](removeEntity(_0x2985dc,null))[_0x3c49('0x54')](handleError(_0x2985dc,null));};exports[_0x3c49('0x65')]=function(_0x8c2f86,_0x4c1610,_0x17a5ca){var _0x179ec2={'raw':![],'where':{}};var _0x109663={};var _0x1bed6d={'count':0x0,'rows':[]};return db[_0x3c49('0x3a')][_0x3c49('0x66')]({'where':{'id':_0x8c2f86[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x4c1610,null))[_0x3c49('0x36')](function(_0x1f9d8f){if(_0x1f9d8f){_0x109663[_0x3c49('0x41')]=_['keys'](db['CmHopper'][_0x3c49('0x3b')]);_0x109663['query']=_[_0x3c49('0x3e')](_0x8c2f86['query']);_0x109663[_0x3c49('0x3f')]=_['intersection'](_0x109663[_0x3c49('0x41')],_0x109663[_0x3c49('0x3d')]);_0x179ec2[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x109663[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x8c2f86['query'][_0x3c49('0x43')]));_0x179ec2['attributes']=_0x179ec2[_0x3c49('0x42')][_0x3c49('0x52')]?_0x179ec2[_0x3c49('0x42')]:_0x109663[_0x3c49('0x41')];if(!_0x8c2f86[_0x3c49('0x3d')][_0x3c49('0x44')](_0x3c49('0x45'))){_0x179ec2[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x8c2f86[_0x3c49('0x3d')][_0x3c49('0x26')]);_0x179ec2[_0x3c49('0x25')]=qs['offset'](_0x8c2f86[_0x3c49('0x3d')][_0x3c49('0x25')]);}_0x179ec2[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x8c2f86[_0x3c49('0x3d')]['sort']);_0x179ec2['where']=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0x8c2f86['query'],_0x109663[_0x3c49('0x3f')]));_0x179ec2[_0x3c49('0x48')]['VoiceQueueId']=_0x1f9d8f['id'];if(_0x8c2f86[_0x3c49('0x3d')]['filter']){_0x179ec2[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x179ec2[_0x3c49('0x48')],{'$or':_[_0x3c49('0x30')](_0x179ec2[_0x3c49('0x42')],function(_0x14b539){var _0x3b47ed={};_0x3b47ed[_0x14b539]={'$like':'%'+_0x8c2f86[_0x3c49('0x3d')][_0x3c49('0x4c')]+'%'};return _0x3b47ed;})});}_0x179ec2=_[_0x3c49('0x4a')]({},_0x179ec2,_0x8c2f86[_0x3c49('0x4d')]);return db[_0x3c49('0x67')][_0x3c49('0x24')]({'where':_0x179ec2[_0x3c49('0x48')]})[_0x3c49('0x36')](function(_0xb82a91){_0x1bed6d['count']=_0xb82a91;if(_0x8c2f86[_0x3c49('0x3d')][_0x3c49('0x4e')]){_0x179ec2[_0x3c49('0x53')]=[{'all':!![]}];}return db[_0x3c49('0x67')][_0x3c49('0x4f')](_0x179ec2);})[_0x3c49('0x36')](function(_0x2caf14){_0x1bed6d[_0x3c49('0x50')]=_0x2caf14;return _0x1bed6d;});}})[_0x3c49('0x36')](respondWithFilteredResult(_0x4c1610,_0x179ec2))[_0x3c49('0x54')](handleError(_0x4c1610,null));};exports['getHopperHistories']=function(_0x1fc379,_0x333cca,_0x595e1b){var _0x4c5d9e={'raw':!![],'where':{}};var _0x15377c={};var _0xa715a3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3c49('0x66')]({'where':{'id':_0x1fc379[_0x3c49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x333cca,null))['then'](function(_0x5ab9ac){if(_0x5ab9ac){_0x15377c['model']=_['keys'](db[_0x3c49('0x68')][_0x3c49('0x3b')]);_0x15377c[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x1fc379['query']);_0x15377c[_0x3c49('0x3f')]=_[_0x3c49('0x40')](_0x15377c[_0x3c49('0x41')],_0x15377c[_0x3c49('0x3d')]);_0x4c5d9e[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x15377c[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x1fc379['query'][_0x3c49('0x43')]));_0x4c5d9e[_0x3c49('0x42')]=_0x4c5d9e['attributes'][_0x3c49('0x52')]?_0x4c5d9e['attributes']:_0x15377c[_0x3c49('0x41')];if(!_0x1fc379[_0x3c49('0x3d')]['hasOwnProperty'](_0x3c49('0x45'))){_0x4c5d9e[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x1fc379[_0x3c49('0x3d')][_0x3c49('0x26')]);_0x4c5d9e[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0x1fc379['query'][_0x3c49('0x25')]);}_0x4c5d9e[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x1fc379['query'][_0x3c49('0x47')]);_0x4c5d9e[_0x3c49('0x48')]=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0x1fc379[_0x3c49('0x3d')],_0x15377c[_0x3c49('0x3f')]));_0x4c5d9e['where'][_0x3c49('0x69')]=_0x5ab9ac['id'];if(_0x1fc379['query'][_0x3c49('0x4c')]){_0x4c5d9e['where']=_[_0x3c49('0x4a')](_0x4c5d9e['where'],{'$or':_[_0x3c49('0x30')](_0x4c5d9e[_0x3c49('0x42')],function(_0x469713){var _0x56a52a={};_0x56a52a[_0x469713]={'$like':'%'+_0x1fc379['query'][_0x3c49('0x4c')]+'%'};return _0x56a52a;})});}_0x4c5d9e=_[_0x3c49('0x4a')]({},_0x4c5d9e,_0x1fc379['options']);return db[_0x3c49('0x68')][_0x3c49('0x24')]({'where':_0x4c5d9e['where']})[_0x3c49('0x36')](function(_0x25bcdd){_0xa715a3[_0x3c49('0x24')]=_0x25bcdd;if(_0x1fc379['query'][_0x3c49('0x4e')]){_0x4c5d9e['include']=[{'all':!![]}];}return db[_0x3c49('0x68')][_0x3c49('0x4f')](_0x4c5d9e);})[_0x3c49('0x36')](function(_0x13dc5f){_0xa715a3[_0x3c49('0x50')]=_0x13dc5f;return _0xa715a3;});}})[_0x3c49('0x36')](respondWithFilteredResult(_0x333cca,_0x4c5d9e))['catch'](handleError(_0x333cca,null));};exports[_0x3c49('0x6a')]=function(_0x405db9,_0x4a1693,_0xb4c692){var _0x4b6cf1={'raw':!![],'where':{}};var _0x527763={};var _0x586cfb={'count':0x0,'rows':[]};return db[_0x3c49('0x3a')]['findOne']({'where':{'id':_0x405db9['params']['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x4a1693,null))[_0x3c49('0x36')](function(_0x100482){if(_0x100482){_0x527763[_0x3c49('0x41')]=_[_0x3c49('0x3e')](db[_0x3c49('0x6b')][_0x3c49('0x3b')]);_0x527763[_0x3c49('0x3d')]=_['keys'](_0x405db9['query']);_0x527763[_0x3c49('0x3f')]=_['intersection'](_0x527763[_0x3c49('0x41')],_0x527763[_0x3c49('0x3d')]);_0x4b6cf1[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x527763['model'],qs[_0x3c49('0x43')](_0x405db9[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x4b6cf1[_0x3c49('0x42')]=_0x4b6cf1[_0x3c49('0x42')][_0x3c49('0x52')]?_0x4b6cf1['attributes']:_0x527763['model'];if(!_0x405db9[_0x3c49('0x3d')][_0x3c49('0x44')](_0x3c49('0x45'))){_0x4b6cf1[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x405db9[_0x3c49('0x3d')][_0x3c49('0x26')]);_0x4b6cf1[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0x405db9[_0x3c49('0x3d')][_0x3c49('0x25')]);}_0x4b6cf1['order']=qs['sort'](_0x405db9[_0x3c49('0x3d')][_0x3c49('0x47')]);_0x4b6cf1['where']=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0x405db9[_0x3c49('0x3d')],_0x527763[_0x3c49('0x3f')]));_0x4b6cf1[_0x3c49('0x48')][_0x3c49('0x69')]=_0x100482['id'];if(_0x405db9[_0x3c49('0x3d')][_0x3c49('0x4c')]){_0x4b6cf1[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x4b6cf1[_0x3c49('0x48')],{'$or':_[_0x3c49('0x30')](_0x4b6cf1[_0x3c49('0x42')],function(_0x362029){var _0x2de6d5={};_0x2de6d5[_0x362029]={'$like':'%'+_0x405db9[_0x3c49('0x3d')][_0x3c49('0x4c')]+'%'};return _0x2de6d5;})});}_0x4b6cf1=_[_0x3c49('0x4a')]({},_0x4b6cf1,_0x405db9['options']);return db['CmHopperFinal'][_0x3c49('0x24')]({'where':_0x4b6cf1[_0x3c49('0x48')]})[_0x3c49('0x36')](function(_0x1ed6f5){_0x586cfb[_0x3c49('0x24')]=_0x1ed6f5;if(_0x405db9['query'][_0x3c49('0x4e')]){_0x4b6cf1['include']=[{'all':!![]}];}return db[_0x3c49('0x6b')]['findAll'](_0x4b6cf1);})[_0x3c49('0x36')](function(_0x3230a6){_0x586cfb[_0x3c49('0x50')]=_0x3230a6;return _0x586cfb;});}})[_0x3c49('0x36')](respondWithFilteredResult(_0x4a1693,_0x4b6cf1))[_0x3c49('0x54')](handleError(_0x4a1693,null));};exports[_0x3c49('0x6c')]=function(_0x336f06,_0x3a32b4,_0x27b4ab){var _0x2b2c98={'raw':!![],'where':{}};var _0x830e2b={};var _0x42216d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3c49('0x66')]({'where':{'id':_0x336f06[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x3a32b4,null))[_0x3c49('0x36')](function(_0x335ae6){if(_0x335ae6){_0x830e2b['model']=_[_0x3c49('0x3e')](db[_0x3c49('0x6d')][_0x3c49('0x3b')]);_0x830e2b[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x336f06['query']);_0x830e2b['filters']=_[_0x3c49('0x40')](_0x830e2b[_0x3c49('0x41')],_0x830e2b[_0x3c49('0x3d')]);_0x2b2c98[_0x3c49('0x42')]=_['intersection'](_0x830e2b['model'],qs['fields'](_0x336f06[_0x3c49('0x3d')]['fields']));_0x2b2c98['attributes']=_0x2b2c98[_0x3c49('0x42')][_0x3c49('0x52')]?_0x2b2c98[_0x3c49('0x42')]:_0x830e2b['model'];if(!_0x336f06[_0x3c49('0x3d')][_0x3c49('0x44')](_0x3c49('0x45'))){_0x2b2c98[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x336f06[_0x3c49('0x3d')]['limit']);_0x2b2c98[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0x336f06['query'][_0x3c49('0x25')]);}_0x2b2c98['order']=qs[_0x3c49('0x47')](_0x336f06['query'][_0x3c49('0x47')]);_0x2b2c98['where']=qs[_0x3c49('0x3f')](_['pick'](_0x336f06['query'],_0x830e2b['filters']));_0x2b2c98[_0x3c49('0x48')][_0x3c49('0x69')]=_0x335ae6['id'];if(_0x336f06['query'][_0x3c49('0x4c')]){_0x2b2c98[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x2b2c98['where'],{'$or':_['map'](_0x2b2c98[_0x3c49('0x42')],function(_0x53f228){var _0x429741={};_0x429741[_0x53f228]={'$like':'%'+_0x336f06[_0x3c49('0x3d')]['filter']+'%'};return _0x429741;})});}_0x2b2c98=_[_0x3c49('0x4a')]({},_0x2b2c98,_0x336f06[_0x3c49('0x4d')]);return db[_0x3c49('0x6d')][_0x3c49('0x24')]({'where':_0x2b2c98[_0x3c49('0x48')]})[_0x3c49('0x36')](function(_0x136602){_0x42216d[_0x3c49('0x24')]=_0x136602;if(_0x336f06[_0x3c49('0x3d')][_0x3c49('0x4e')]){_0x2b2c98[_0x3c49('0x53')]=[{'all':!![]}];}return db[_0x3c49('0x6d')][_0x3c49('0x4f')](_0x2b2c98);})[_0x3c49('0x36')](function(_0x18460e){_0x42216d['rows']=_0x18460e;return _0x42216d;});}})[_0x3c49('0x36')](respondWithFilteredResult(_0x3a32b4,_0x2b2c98))[_0x3c49('0x54')](handleError(_0x3a32b4,null));};exports[_0x3c49('0x6e')]=function(_0xe82f24,_0x1749a9,_0x558ae5){var _0x1a6d85={};var _0x356b09={};var _0x4c1353;var _0x534951;return db['VoiceQueue'][_0x3c49('0x66')]({'where':{'id':_0xe82f24[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x1749a9,null))['then'](function(_0x1f53c4){if(_0x1f53c4){_0x4c1353=_0x1f53c4;_0x356b09[_0x3c49('0x41')]=_[_0x3c49('0x3e')](db[_0x3c49('0x6f')]['rawAttributes']);_0x356b09[_0x3c49('0x3d')]=_['keys'](_0xe82f24[_0x3c49('0x3d')]);_0x356b09[_0x3c49('0x3f')]=_[_0x3c49('0x40')](_0x356b09[_0x3c49('0x41')],_0x356b09[_0x3c49('0x3d')]);_0x1a6d85[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x356b09[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0xe82f24['query']['fields']));_0x1a6d85[_0x3c49('0x42')]=_0x1a6d85[_0x3c49('0x42')]['length']?_0x1a6d85[_0x3c49('0x42')]:_0x356b09['model'];_0x1a6d85['order']=qs[_0x3c49('0x47')](_0xe82f24['query']['sort']);_0x1a6d85['where']=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0xe82f24[_0x3c49('0x3d')],_0x356b09['filters']));if(_0xe82f24[_0x3c49('0x3d')]['filter']){_0x1a6d85[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x1a6d85['where'],{'$or':_[_0x3c49('0x30')](_0x1a6d85[_0x3c49('0x42')],function(_0x55c76e){var _0x2d8865={};_0x2d8865[_0x55c76e]={'$like':'%'+_0xe82f24[_0x3c49('0x3d')]['filter']+'%'};return _0x2d8865;})});}_0x1a6d85=_['merge']({},_0x1a6d85,_0xe82f24[_0x3c49('0x4d')]);return _0x4c1353['getTeams'](_0x1a6d85);}})[_0x3c49('0x36')](function(_0x10db47){if(_0x10db47){_0x534951=_0x10db47['length'];if(!_0xe82f24[_0x3c49('0x3d')][_0x3c49('0x44')](_0x3c49('0x45'))){_0x1a6d85['limit']=qs[_0x3c49('0x26')](_0xe82f24[_0x3c49('0x3d')][_0x3c49('0x26')]);_0x1a6d85[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0xe82f24[_0x3c49('0x3d')][_0x3c49('0x25')]);}return _0x4c1353['getTeams'](_0x1a6d85);}})[_0x3c49('0x36')](function(_0x285860){if(_0x285860){return _0x285860?{'count':_0x534951,'rows':_0x285860}:null;}})['then'](respondWithResult(_0x1749a9,null))[_0x3c49('0x54')](handleError(_0x1749a9,null));};exports[_0x3c49('0x70')]=function(_0x4a6b48,_0x2114fc,_0x31cc07){var _0x38f175=_0x4a6b48['body']['teams'];var _0x1a3b62=_[_0x3c49('0x30')](_0x38f175,'id');return db['Team'][_0x3c49('0x4f')]({'where':{'id':_0x1a3b62},'attributes':['id'],'include':[{'model':db[_0x3c49('0x71')],'as':_0x3c49('0x72'),'attributes':['id','name','online',_0x3c49('0x73'),_0x3c49('0x74')],'raw':!![]}]})['then'](function(_0x53547f){if(_0x53547f){var _0xe6d827=_[_0x3c49('0x75')](_0x53547f,function(_0x1317c4){var _0x437307=_0x1317c4[_0x3c49('0x2c')]({'plain':!![]});_0x437307[_0x3c49('0x72')][_0x3c49('0x76')](function(_0x521340){_0x521340[_0x3c49('0x77')]=_[_0x3c49('0x33')](_0x38f175,{'id':_0x437307['id']})[_0x3c49('0x77')];});return _0x437307[_0x3c49('0x72')];});return db['VoiceQueue'][_0x3c49('0x33')]({'where':{'id':_0x4a6b48[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](function(_0x2a8b99){return db[_0x3c49('0x78')][_0x3c49('0x79')](function(_0xccd5c0){return _0x2a8b99[_0x3c49('0x70')](_0x1a3b62,{'transaction':_0xccd5c0})[_0x3c49('0x36')](function(){return BPromise[_0x3c49('0x7a')](_0xe6d827,function(_0x4f11a7){return db[_0x3c49('0x7b')]['findOrCreate']({'where':{'UserId':_0x4f11a7['id'],'VoiceQueueId':_0x4a6b48[_0x3c49('0x5f')]['id']},'defaults':{'penalty':_0x4f11a7[_0x3c49('0x77')]},'transaction':_0xccd5c0});});})[_0x3c49('0x36')](function(){return BPromise[_0x3c49('0x7a')](_['filter'](_0xe6d827,{'online':!![]}),function(_0x339efa){return db[_0x3c49('0x7c')][_0x3c49('0x7d')]({'membername':_0x339efa[_0x3c49('0x38')],'UserId':_0x339efa['id'],'queue_name':_0x2a8b99[_0x3c49('0x38')],'VoiceQueueId':_0x2a8b99['id'],'interface':_[_0x3c49('0x7e')](_0x339efa[_0x3c49('0x74')])?util[_0x3c49('0x7f')](_0x3c49('0x80'),_0x339efa[_0x3c49('0x38')]):_0x339efa[_0x3c49('0x74')],'paused':_0x339efa['voicePause']||![],'penalty':_0x339efa['penalty']},{'transaction':_0xccd5c0});});})['then'](function(){_0xe6d827[_0x3c49('0x76')](function(_0x4bba95){socket[_0x3c49('0x81')](_0x3c49('0x82'),{'UserId':_0x4bba95['id'],'VoiceQueueId':_0x2a8b99['id']});});});});});}})[_0x3c49('0x36')](respondWithStatusCode(_0x2114fc,null))['catch'](handleError(_0x2114fc,null));};exports[_0x3c49('0x83')]=function(_0x242750,_0x1616b9,_0x22c18f){return db['Team']['findAll']({'where':{'id':_0x242750[_0x3c49('0x3d')][_0x3c49('0x84')]},'attributes':['id'],'include':[{'model':db[_0x3c49('0x71')],'as':_0x3c49('0x72'),'attributes':['id'],'raw':!![]}]})[_0x3c49('0x36')](handleEntityNotFound(_0x1616b9,null))[_0x3c49('0x36')](function(_0x8e4c72){var _0x2fee3b=_[_0x3c49('0x30')](_0x8e4c72,'id');var _0x200015=[];var _0x3ec201=[];var _0x2a03ab=squel[_0x3c49('0x85')]();_0x2a03ab[_0x3c49('0x86')](_0x3c49('0x87'))[_0x3c49('0x88')]('team_has_voice_queues','tq')[_0x3c49('0x89')](_0x3c49('0x8a'),'ut',_0x3c49('0x8b'))[_0x3c49('0x48')]('VoiceQueueId\x20=\x20?',_0x242750[_0x3c49('0x5f')]['id']);for(var _0x2fda50=0x0;_0x2fda50<_0x8e4c72['length'];_0x2fda50+=0x1){let _0x1bc5bd=_0x8e4c72[_0x2fda50];for(var _0x25dcb1=0x0;_0x25dcb1<_0x1bc5bd[_0x3c49('0x72')][_0x3c49('0x52')];_0x25dcb1+=0x1){let _0x50fe1e=_0x1bc5bd[_0x3c49('0x72')][_0x25dcb1];var _0x4b3e85=_0x2a03ab[_0x3c49('0x5e')]();_0x4b3e85[_0x3c49('0x48')](_0x3c49('0x8c'),_0x50fe1e['id']);_0x3ec201[_0x3c49('0x8d')](db[_0x3c49('0x78')][_0x3c49('0x3d')](_0x4b3e85['toString'](),{'type':db[_0x3c49('0x78')][_0x3c49('0x8e')]['SELECT']})[_0x3c49('0x36')](function(_0x34567f){if(_0x34567f[_0x3c49('0x52')]===0x1){return _0x50fe1e['id'];}else{var _0x5a6175=_[_0x3c49('0x8f')](_[_0x3c49('0x30')](_0x34567f,_0x3c49('0x90')),function(_0x1b1954){return _[_0x3c49('0x32')](_0x2fee3b,_0x1b1954);});if(_0x5a6175){return _0x50fe1e['id'];}}}));}}return BPromise[_0x3c49('0x91')](_0x3ec201)[_0x3c49('0x36')](function(_0x263117){_0x200015=_(_0x200015)[_0x3c49('0x92')](_0x263117)['compact']()[_0x3c49('0x31')]();return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x242750[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](function(_0x158c19){return db['sequelize'][_0x3c49('0x79')](function(_0x4673cb){return _0x158c19[_0x3c49('0x83')](_0x242750[_0x3c49('0x3d')][_0x3c49('0x84')],{'transaction':_0x4673cb})['then'](function(){if(!_[_0x3c49('0x93')](_0x200015)){return _0x158c19[_0x3c49('0x94')](_0x200015,{'transaction':_0x4673cb})['then'](function(){return db[_0x3c49('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x242750[_0x3c49('0x5f')]['id'],'UserId':_0x200015},'transaction':_0x4673cb});});}})['then'](function(){_0x200015[_0x3c49('0x76')](function(_0x3addb6){socket[_0x3c49('0x81')](_0x3c49('0x95'),{'UserId':_0x3addb6,'VoiceQueueId':_0x158c19['id']});});});});});});})[_0x3c49('0x36')](respondWithStatusCode(_0x1616b9,null))[_0x3c49('0x54')](handleError(_0x1616b9,null));};exports[_0x3c49('0x96')]=function(_0x14ff23,_0x4ae3dc,_0x41976a){var _0x5b3859,_0x3c75cc;return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x14ff23[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x4ae3dc,null))['then'](function(_0x1e7a13){if(_0x1e7a13){_0x3c75cc=_0x1e7a13;return _0x1e7a13['addAgents'](_0x14ff23[_0x3c49('0x62')]['ids'],_[_0x3c49('0x63')](_0x14ff23[_0x3c49('0x62')],[_0x3c49('0x84'),'id'])||{})[_0x3c49('0x97')](function(_0x4c8c6f){for(var _0x5cd8fe=0x0;_0x5cd8fe<_0x14ff23[_0x3c49('0x62')][_0x3c49('0x84')][_0x3c49('0x52')];_0x5cd8fe+=0x1){socket[_0x3c49('0x81')]('userVoiceQueue:save',{'UserId':_0x14ff23[_0x3c49('0x62')]['ids'][_0x5cd8fe],'VoiceQueueId':_0x14ff23[_0x3c49('0x5f')]['id']});}return _0x4c8c6f;});}})[_0x3c49('0x36')](function(_0x3473db){_0x5b3859=_0x3473db||[];if(_0x3c75cc){return db[_0x3c49('0x71')][_0x3c49('0x4f')]({'where':{'id':_0x14ff23[_0x3c49('0x62')]['ids']},'attributes':['id','name',_0x3c49('0x98'),_0x3c49('0x73'),_0x3c49('0x74')],'raw':!![]});}})[_0x3c49('0x36')](function(_0x5d90c2){if(!_[_0x3c49('0x93')](_0x5d90c2)){var _0x4c7ce1=[];for(var _0x393c7c=0x0;_0x393c7c<_0x5d90c2[_0x3c49('0x52')];_0x393c7c++){if(_0x5d90c2[_0x393c7c]['online']){_0x4c7ce1[_0x3c49('0x8d')](db[_0x3c49('0x7c')]['upsert']({'membername':_0x5d90c2[_0x393c7c][_0x3c49('0x38')],'UserId':_0x5d90c2[_0x393c7c]['id'],'queue_name':_0x3c75cc[_0x3c49('0x38')],'VoiceQueueId':_0x3c75cc['id'],'interface':_[_0x3c49('0x7e')](_0x5d90c2[_0x393c7c]['interface'])?util[_0x3c49('0x7f')](_0x3c49('0x80'),_0x5d90c2[_0x393c7c][_0x3c49('0x38')]):_0x5d90c2[_0x393c7c]['interface'],'paused':_0x5d90c2[_0x393c7c][_0x3c49('0x73')]||![],'penalty':_0x14ff23[_0x3c49('0x62')][_0x3c49('0x77')]||0x0}));}}return BPromise[_0x3c49('0x91')](_0x4c7ce1);}})['then'](function(){return _0x5b3859;})[_0x3c49('0x36')](respondWithResult(_0x4ae3dc,null))[_0x3c49('0x54')](handleError(_0x4ae3dc,null));};exports[_0x3c49('0x94')]=function(_0x3d836c,_0xadc525,_0x97efc7){return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x3d836c['params']['id']}})['then'](handleEntityNotFound(_0xadc525,null))[_0x3c49('0x36')](function(_0x1b634b){if(_0x1b634b){return _0x1b634b[_0x3c49('0x94')](_0x3d836c[_0x3c49('0x3d')][_0x3c49('0x84')])[_0x3c49('0x36')](function(){if(_[_0x3c49('0x99')](_0x3d836c[_0x3c49('0x3d')]['ids'])){for(var _0x10719e=0x0;_0x10719e<_0x3d836c[_0x3c49('0x3d')][_0x3c49('0x84')]['length'];_0x10719e+=0x1){socket[_0x3c49('0x81')](_0x3c49('0x95'),{'UserId':Number(_0x3d836c[_0x3c49('0x3d')][_0x3c49('0x84')][_0x10719e]),'VoiceQueueId':Number(_0x3d836c[_0x3c49('0x5f')]['id'])});}}else{socket[_0x3c49('0x81')](_0x3c49('0x95'),{'UserId':Number(_0x3d836c[_0x3c49('0x3d')][_0x3c49('0x84')]),'VoiceQueueId':Number(_0x3d836c['params']['id'])});}});}})[_0x3c49('0x36')](function(_0x4ea71e){return db[_0x3c49('0x7c')][_0x3c49('0x2b')]({'where':{'VoiceQueueId':_0x3d836c[_0x3c49('0x5f')]['id'],'UserId':_0x3d836c['query'][_0x3c49('0x84')]}})[_0x3c49('0x36')](function(){return _0x4ea71e;});})[_0x3c49('0x36')](respondWithStatusCode(_0xadc525,null))[_0x3c49('0x54')](handleError(_0xadc525,null));};exports[_0x3c49('0x9a')]=function(_0x4d13fd,_0x1b1b0d,_0x5a3d4a){var _0x426f04={};var _0x58de54={};var _0x540a7d;var _0xf1a375;return db[_0x3c49('0x3a')]['findOne']({'where':{'id':_0x4d13fd[_0x3c49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1b1b0d,null))['then'](function(_0x900ce0){if(_0x900ce0){_0x540a7d=_0x900ce0;_0x58de54[_0x3c49('0x41')]=_[_0x3c49('0x3e')](db[_0x3c49('0x71')][_0x3c49('0x3b')]);_0x58de54[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x4d13fd[_0x3c49('0x3d')]);_0x58de54['filters']=_[_0x3c49('0x40')](_0x58de54[_0x3c49('0x41')],_0x58de54[_0x3c49('0x3d')]);_0x426f04[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x58de54[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x4d13fd[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x426f04[_0x3c49('0x42')]=_0x426f04[_0x3c49('0x42')][_0x3c49('0x52')]?_0x426f04[_0x3c49('0x42')]:_0x58de54['model'];_0x426f04[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x4d13fd[_0x3c49('0x3d')]['sort']);_0x426f04['where']=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0x4d13fd[_0x3c49('0x3d')],_0x58de54[_0x3c49('0x3f')]));if(_0x4d13fd[_0x3c49('0x3d')][_0x3c49('0x4c')]){_0x426f04['where']=_[_0x3c49('0x4a')](_0x426f04[_0x3c49('0x48')],{'$or':_['map'](_0x426f04[_0x3c49('0x42')],function(_0x405de6){var _0x4c7e66={};_0x4c7e66[_0x405de6]={'$like':'%'+_0x4d13fd[_0x3c49('0x3d')]['filter']+'%'};return _0x4c7e66;})});}_0x426f04=_[_0x3c49('0x4a')]({},_0x426f04,_0x4d13fd['options']);return _0x540a7d[_0x3c49('0x9a')](_0x426f04);}})[_0x3c49('0x36')](function(_0x455e32){if(_0x455e32){_0xf1a375=_0x455e32[_0x3c49('0x52')];if(!_0x4d13fd['query']['hasOwnProperty'](_0x3c49('0x45'))){_0x426f04[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x4d13fd[_0x3c49('0x3d')]['limit']);_0x426f04[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0x4d13fd[_0x3c49('0x3d')][_0x3c49('0x25')]);}return _0x540a7d[_0x3c49('0x9a')](_0x426f04);}})[_0x3c49('0x36')](function(_0x111a81){if(_0x111a81){return _0x111a81?{'count':_0xf1a375,'rows':_0x111a81}:null;}})[_0x3c49('0x36')](respondWithResult(_0x1b1b0d,null))['catch'](handleError(_0x1b1b0d,null));};exports[_0x3c49('0x9b')]=function(_0x6162d2,_0x572d22,_0x4352d1){var _0x1aee64={};var _0x21f9fe={};var _0x361f3d;var _0xafebcf;return db['VoiceQueue'][_0x3c49('0x66')]({'where':{'id':_0x6162d2[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x572d22,null))['then'](function(_0x4342dc){if(_0x4342dc){_0x361f3d=_0x4342dc;_0x21f9fe['model']=_[_0x3c49('0x3e')](db[_0x3c49('0x7c')][_0x3c49('0x3b')]);_0x21f9fe[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x6162d2[_0x3c49('0x3d')]);_0x21f9fe[_0x3c49('0x3f')]=_[_0x3c49('0x40')](_0x21f9fe['model'],_0x21f9fe['query']);_0x1aee64[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x21f9fe[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x6162d2[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x1aee64[_0x3c49('0x42')]=_0x1aee64[_0x3c49('0x42')][_0x3c49('0x52')]?_0x1aee64[_0x3c49('0x42')]:_0x21f9fe[_0x3c49('0x41')];_0x1aee64[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x6162d2[_0x3c49('0x3d')][_0x3c49('0x47')]);_0x1aee64['where']=qs[_0x3c49('0x3f')](_['pick'](_0x6162d2[_0x3c49('0x3d')],_0x21f9fe[_0x3c49('0x3f')]));if(_0x6162d2[_0x3c49('0x3d')]['filter']){_0x1aee64[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x1aee64[_0x3c49('0x48')],{'$or':_[_0x3c49('0x30')](_0x1aee64[_0x3c49('0x42')],function(_0x5b1589){var _0xb2f001={};_0xb2f001[_0x5b1589]={'$like':'%'+_0x6162d2[_0x3c49('0x3d')][_0x3c49('0x4c')]+'%'};return _0xb2f001;})});}_0x1aee64=_[_0x3c49('0x4a')]({},_0x1aee64,_0x6162d2[_0x3c49('0x4d')]);return _0x361f3d['getMembers'](_0x1aee64);}})[_0x3c49('0x36')](function(_0x22893d){if(_0x22893d){_0xafebcf=_0x22893d[_0x3c49('0x52')];if(!_0x6162d2['query'][_0x3c49('0x44')](_0x3c49('0x45'))){_0x1aee64[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x6162d2['query']['limit']);_0x1aee64[_0x3c49('0x25')]=qs['offset'](_0x6162d2[_0x3c49('0x3d')]['offset']);}return _0x361f3d[_0x3c49('0x9b')](_0x1aee64);}})[_0x3c49('0x36')](function(_0x1a1205){return _0x1a1205?{'count':_0xafebcf,'rows':_0x1a1205}:null;})[_0x3c49('0x36')](respondWithResult(_0x572d22,null))[_0x3c49('0x54')](handleError(_0x572d22,null));};exports[_0x3c49('0x9c')]=function(_0x347259,_0x50737f,_0x375b07){var _0x3392ba={};var _0x4e1a8a={};var _0x1e3820;var _0x41de2a;return db['VoiceQueue'][_0x3c49('0x66')]({'where':{'id':_0x347259[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x50737f,null))[_0x3c49('0x36')](function(_0x2de1f6){if(_0x2de1f6){_0x1e3820=_0x2de1f6;_0x4e1a8a[_0x3c49('0x41')]=_[_0x3c49('0x3e')](db[_0x3c49('0x9d')][_0x3c49('0x3b')]);_0x4e1a8a[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x347259['query']);_0x4e1a8a[_0x3c49('0x3f')]=_[_0x3c49('0x40')](_0x4e1a8a[_0x3c49('0x41')],_0x4e1a8a[_0x3c49('0x3d')]);_0x3392ba['attributes']=_[_0x3c49('0x40')](_0x4e1a8a[_0x3c49('0x41')],qs[_0x3c49('0x43')](_0x347259[_0x3c49('0x3d')]['fields']));_0x3392ba[_0x3c49('0x42')]=_0x3392ba['attributes'][_0x3c49('0x52')]?_0x3392ba[_0x3c49('0x42')]:_0x4e1a8a['model'];_0x3392ba[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x347259['query'][_0x3c49('0x47')]);_0x3392ba['where']=qs['filters'](_[_0x3c49('0x49')](_0x347259[_0x3c49('0x3d')],_0x4e1a8a[_0x3c49('0x3f')]));if(_0x347259['query'][_0x3c49('0x4c')]){_0x3392ba[_0x3c49('0x48')]=_[_0x3c49('0x4a')](_0x3392ba[_0x3c49('0x48')],{'$or':_[_0x3c49('0x30')](_0x3392ba[_0x3c49('0x42')],function(_0x4cfedd){var _0x25614d={};_0x25614d[_0x4cfedd]={'$like':'%'+_0x347259[_0x3c49('0x3d')][_0x3c49('0x4c')]+'%'};return _0x25614d;})});}_0x3392ba=_[_0x3c49('0x4a')]({},_0x3392ba,_0x347259[_0x3c49('0x4d')]);return _0x1e3820[_0x3c49('0x9c')](_0x3392ba);}})[_0x3c49('0x36')](function(_0x5cb63b){if(_0x5cb63b){_0x41de2a=_0x5cb63b[_0x3c49('0x52')];if(!_0x347259[_0x3c49('0x3d')][_0x3c49('0x44')](_0x3c49('0x45'))){_0x3392ba[_0x3c49('0x26')]=qs[_0x3c49('0x26')](_0x347259[_0x3c49('0x3d')][_0x3c49('0x26')]);_0x3392ba[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0x347259[_0x3c49('0x3d')][_0x3c49('0x25')]);}return _0x1e3820[_0x3c49('0x9c')](_0x3392ba);}})[_0x3c49('0x36')](function(_0x37927f){if(_0x37927f){return _0x37927f?{'count':_0x41de2a,'rows':_0x37927f}:null;}})[_0x3c49('0x36')](respondWithResult(_0x50737f,null))[_0x3c49('0x54')](handleError(_0x50737f,null));};exports['addLists']=function(_0x5502e3,_0x9b5393,_0x4fca7b){var _0xef976b,_0x26df16;return db['VoiceQueue']['find']({'where':{'id':_0x5502e3[_0x3c49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x9b5393,null))[_0x3c49('0x36')](function(_0x3e7df3){if(_0x3e7df3){_0x26df16=_0x3e7df3;return _0x3e7df3[_0x3c49('0x9e')](_0x5502e3[_0x3c49('0x62')][_0x3c49('0x84')],_[_0x3c49('0x63')](_0x5502e3[_0x3c49('0x62')],[_0x3c49('0x84'),'id'])||{});}return null;})['spread'](function(_0xf65a4a){var _0x1947bb;_0xef976b=_0xf65a4a||[];var _0x5f0b89=[];if(_0xf65a4a){for(var _0x3ec4c4=0x0;_0x3ec4c4<_0xf65a4a[_0x3c49('0x52')];_0x3ec4c4+=0x1){var _0x343589=_0xf65a4a[_0x3ec4c4][_0x3c49('0x2c')]({'plain':!![]});_0x26df16[_0x3c49('0x9f')]=_0x5502e3[_0x3c49('0x62')][_0x3c49('0x9f')]?_0x5502e3[_0x3c49('0x62')]['dialCheckDuplicateType']:_0x26df16[_0x3c49('0x9f')];switch(_0x26df16[_0x3c49('0x9f')]){case _0x3c49('0xa0'):_0x1947bb=squel[_0x3c49('0xa1')]()[_0x3c49('0xa2')]('cm_hopper')[_0x3c49('0xa3')](['phone','scheduledAt',_0x3c49('0xa4'),_0x3c49('0xa5'),_0x3c49('0x69'),'createdAt',_0x3c49('0x61')],squel[_0x3c49('0x85')]()[_0x3c49('0x86')](_0x3c49('0xa6'),_0x3c49('0xa6'))[_0x3c49('0x86')]('NOW()',_0x3c49('0xa7'))[_0x3c49('0x86')]('id',_0x3c49('0xa4'))[_0x3c49('0x86')](_0x343589[_0x3c49('0xa8')][_0x3c49('0xa9')](),_0x3c49('0xa5'))['field'](_0x5502e3['params']['id'][_0x3c49('0xa9')](),_0x3c49('0x69'))[_0x3c49('0x86')]('NOW()',_0x3c49('0x60'))[_0x3c49('0x86')](_0x3c49('0xaa'),_0x3c49('0x61'))['from'](_0x3c49('0xab'))[_0x3c49('0x48')](_0x3c49('0xac'))[_0x3c49('0x48')](_0x3c49('0xad'),_0x343589[_0x3c49('0xa8')]['toString']())[_0x3c49('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x3c49('0x48')](_0x3c49('0xae'),squel[_0x3c49('0x85')]()[_0x3c49('0x86')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x3c49('0xaf'))[_0x3c49('0x48')](_0x3c49('0xb0'),_0x5502e3[_0x3c49('0x5f')]['id'][_0x3c49('0xa9')]()))['where'](_0x3c49('0xae'),squel['select']()[_0x3c49('0x86')](_0x3c49('0xb1'))[_0x3c49('0x88')](_0x3c49('0xb2'))[_0x3c49('0x48')](_0x3c49('0xb0'),_0x5502e3[_0x3c49('0x5f')]['id']['toString']())))[_0x3c49('0xa9')]();break;case _0x3c49('0xb3'):_0x1947bb=squel[_0x3c49('0xa1')]()[_0x3c49('0xa2')](_0x3c49('0xb2'))[_0x3c49('0xa3')]([_0x3c49('0xa6'),_0x3c49('0xa7'),'ContactId',_0x3c49('0xa5'),'VoiceQueueId','createdAt',_0x3c49('0x61')],squel['select']()['field'](_0x3c49('0xa6'),'phone')[_0x3c49('0x86')](_0x3c49('0xaa'),'scheduledAt')['field']('id','ContactId')[_0x3c49('0x86')](_0x343589[_0x3c49('0xa8')][_0x3c49('0xa9')](),_0x3c49('0xa5'))[_0x3c49('0x86')](_0x5502e3['params']['id']['toString'](),_0x3c49('0x69'))[_0x3c49('0x86')]('NOW()',_0x3c49('0x60'))['field'](_0x3c49('0xaa'),_0x3c49('0x61'))[_0x3c49('0x88')](_0x3c49('0xab'))[_0x3c49('0x48')]('deletedAt\x20IS\x20NULL')[_0x3c49('0x48')](_0x3c49('0xad'),_0x343589[_0x3c49('0xa8')]['toString']())[_0x3c49('0x48')](_0x3c49('0xb4'))[_0x3c49('0x48')](_0x3c49('0xae'),squel['select']()['field'](_0x3c49('0xb1'))[_0x3c49('0x88')](_0x3c49('0xb2'))[_0x3c49('0x48')](_0x3c49('0xb0'),_0x5502e3[_0x3c49('0x5f')]['id'][_0x3c49('0xa9')]())))[_0x3c49('0xa9')]();break;default:_0x1947bb=squel['insert']()[_0x3c49('0xa2')](_0x3c49('0xb2'))[_0x3c49('0xa3')]([_0x3c49('0xa6'),'scheduledAt',_0x3c49('0xa4'),'ListId',_0x3c49('0x69'),_0x3c49('0x60'),'updatedAt'],squel['select']()[_0x3c49('0x86')]('phone',_0x3c49('0xa6'))[_0x3c49('0x86')](_0x3c49('0xaa'),_0x3c49('0xa7'))['field']('id','ContactId')[_0x3c49('0x86')](_0x343589['CmListId'][_0x3c49('0xa9')](),_0x3c49('0xa5'))['field'](_0x5502e3[_0x3c49('0x5f')]['id']['toString'](),_0x3c49('0x69'))[_0x3c49('0x86')](_0x3c49('0xaa'),'createdAt')[_0x3c49('0x86')](_0x3c49('0xaa'),_0x3c49('0x61'))[_0x3c49('0x88')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3c49('0xad'),_0x343589[_0x3c49('0xa8')][_0x3c49('0xa9')]())[_0x3c49('0x48')](_0x3c49('0xb4')))[_0x3c49('0xa9')]();}_0x5f0b89[_0x3c49('0x8d')](db['sequelize']['query'](_0x1947bb));}return BPromise['all'](_0x5f0b89);}})['then'](function(){return _0xef976b;})[_0x3c49('0x36')](respondWithResult(_0x9b5393,null))[_0x3c49('0x54')](handleError(_0x9b5393,null));};exports[_0x3c49('0xb5')]=function(_0x38bf78,_0x570879,_0x2c00e6){return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x38bf78[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x570879,null))[_0x3c49('0x36')](function(_0x3e730d){if(_0x3e730d){return _0x3e730d['removeLists'](_0x38bf78[_0x3c49('0x3d')][_0x3c49('0x84')]);}})[_0x3c49('0x36')](function(_0x3689b5){if(_0x3689b5){return db['CmHopper']['destroy']({'where':{'ListId':_0x38bf78[_0x3c49('0x3d')][_0x3c49('0x84')],'VoiceQueueId':_0x38bf78['params']['id']}})['then'](function(){return _0x3689b5;});}})[_0x3c49('0x36')](respondWithStatusCode(_0x570879,null))[_0x3c49('0x54')](handleError(_0x570879,null));};exports[_0x3c49('0xb6')]=function(_0x17fd1b,_0xe025a2,_0x93a978){var _0x5be384={};var _0x4c7568={};var _0x4ce18a;var _0x258f78;return db[_0x3c49('0x3a')][_0x3c49('0x66')]({'where':{'id':_0x17fd1b['params']['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0xe025a2,null))['then'](function(_0x108055){if(_0x108055){_0x4ce18a=_0x108055;_0x4c7568['model']=_[_0x3c49('0x3e')](db['CmList']['rawAttributes']);_0x4c7568[_0x3c49('0x3d')]=_[_0x3c49('0x3e')](_0x17fd1b[_0x3c49('0x3d')]);_0x4c7568[_0x3c49('0x3f')]=_[_0x3c49('0x40')](_0x4c7568[_0x3c49('0x41')],_0x4c7568[_0x3c49('0x3d')]);_0x5be384[_0x3c49('0x42')]=_[_0x3c49('0x40')](_0x4c7568['model'],qs['fields'](_0x17fd1b[_0x3c49('0x3d')][_0x3c49('0x43')]));_0x5be384[_0x3c49('0x42')]=_0x5be384['attributes'][_0x3c49('0x52')]?_0x5be384[_0x3c49('0x42')]:_0x4c7568[_0x3c49('0x41')];_0x5be384[_0x3c49('0x46')]=qs[_0x3c49('0x47')](_0x17fd1b[_0x3c49('0x3d')][_0x3c49('0x47')]);_0x5be384[_0x3c49('0x48')]=qs[_0x3c49('0x3f')](_[_0x3c49('0x49')](_0x17fd1b['query'],_0x4c7568[_0x3c49('0x3f')]));if(_0x17fd1b[_0x3c49('0x3d')][_0x3c49('0x4c')]){_0x5be384['where']=_[_0x3c49('0x4a')](_0x5be384['where'],{'$or':_[_0x3c49('0x30')](_0x5be384['attributes'],function(_0x23d1fd){var _0xc730c={};_0xc730c[_0x23d1fd]={'$like':'%'+_0x17fd1b[_0x3c49('0x3d')]['filter']+'%'};return _0xc730c;})});}_0x5be384=_['merge']({},_0x5be384,_0x17fd1b['options']);return _0x4ce18a[_0x3c49('0xb6')](_0x5be384);}})[_0x3c49('0x36')](function(_0x49158d){if(_0x49158d){_0x258f78=_0x49158d[_0x3c49('0x52')];if(!_0x17fd1b[_0x3c49('0x3d')][_0x3c49('0x44')](_0x3c49('0x45'))){_0x5be384[_0x3c49('0x26')]=qs['limit'](_0x17fd1b['query'][_0x3c49('0x26')]);_0x5be384[_0x3c49('0x25')]=qs[_0x3c49('0x25')](_0x17fd1b['query'][_0x3c49('0x25')]);}return _0x4ce18a[_0x3c49('0xb6')](_0x5be384);}})[_0x3c49('0x36')](function(_0x5954e5){if(_0x5954e5){return _0x5954e5?{'count':_0x258f78,'rows':_0x5954e5}:null;}})[_0x3c49('0x36')](respondWithResult(_0xe025a2,null))[_0x3c49('0x54')](handleError(_0xe025a2,null));};exports[_0x3c49('0xb7')]=function(_0x4f8173,_0x5e872a,_0x1098dc){var _0x3584f1,_0x3f12c3;return db['VoiceQueue'][_0x3c49('0x33')]({'where':{'id':_0x4f8173[_0x3c49('0x5f')]['id']}})[_0x3c49('0x36')](handleEntityNotFound(_0x5e872a,null))[_0x3c49('0x36')](function(_0x565e64){if(_0x565e64){_0x3f12c3=_0x565e64;return _0x565e64[_0x3c49('0xb7')](_0x4f8173[_0x3c49('0x62')][_0x3c49('0x84')],_[_0x3c49('0x63')](_0x4f8173[_0x3c49('0x62')],['ids','id'])||{});}return null;})[_0x3c49('0x97')](function(_0x1a04d8){var _0x1ff9fd;_0x3584f1=_0x1a04d8||[];var _0xea565=[];if(_0x1a04d8){for(var _0x2cff1a=0x0;_0x2cff1a<_0x1a04d8['length'];_0x2cff1a+=0x1){var _0x2b4f9f=_0x1a04d8[_0x2cff1a][_0x3c49('0x2c')]({'plain':!![]});_0x1ff9fd=squel[_0x3c49('0xa1')]()[_0x3c49('0xa2')](_0x3c49('0xb8'))['fromQuery']([_0x3c49('0xa6'),_0x3c49('0xa4'),'ListId',_0x3c49('0x69'),_0x3c49('0x60'),_0x3c49('0x61')],squel[_0x3c49('0x85')]()[_0x3c49('0x86')](_0x3c49('0xa6'),_0x3c49('0xa6'))['field']('id',_0x3c49('0xa4'))['field'](_0x2b4f9f['CmListId']['toString'](),_0x3c49('0xa5'))['field'](_0x4f8173[_0x3c49('0x5f')]['id'][_0x3c49('0xa9')](),'VoiceQueueId')[_0x3c49('0x86')](_0x3c49('0xaa'),_0x3c49('0x60'))[_0x3c49('0x86')](_0x3c49('0xaa'),_0x3c49('0x61'))[_0x3c49('0x88')]('cm_contacts')[_0x3c49('0x48')](_0x3c49('0xac'))[_0x3c49('0x48')](_0x3c49('0xad'),_0x2b4f9f[_0x3c49('0xa8')][_0x3c49('0xa9')]())[_0x3c49('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0xea565[_0x3c49('0x8d')](db[_0x3c49('0x78')][_0x3c49('0x3d')](_0x1ff9fd));}return BPromise[_0x3c49('0x91')](_0xea565);}})['then'](function(){return _0x3584f1;})[_0x3c49('0x36')](respondWithResult(_0x5e872a,null))[_0x3c49('0x54')](handleError(_0x5e872a,null));};exports['removeBlackLists']=function(_0x27b340,_0x5abb18,_0x7abc50){return db[_0x3c49('0x3a')][_0x3c49('0x33')]({'where':{'id':_0x27b340[_0x3c49('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5abb18,null))[_0x3c49('0x36')](function(_0x3d0fff){if(_0x3d0fff){return _0x3d0fff[_0x3c49('0xb9')](_0x27b340[_0x3c49('0x3d')]['ids']);}})[_0x3c49('0x36')](function(_0x10b42f){if(_0x10b42f){return db[_0x3c49('0x6d')][_0x3c49('0x2b')]({'where':{'ListId':_0x27b340[_0x3c49('0x3d')][_0x3c49('0x84')],'VoiceQueueId':_0x27b340[_0x3c49('0x5f')]['id']}})['then'](function(){return _0x10b42f;});}})[_0x3c49('0x36')](respondWithStatusCode(_0x5abb18,null))['catch'](handleError(_0x5abb18,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 4e0ad20..9ecc2c7 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 _0xac96=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','save','update','remove'];(function(_0x1ba19c,_0x3975e2){var _0x4e069b=function(_0xd95964){while(--_0xd95964){_0x1ba19c['push'](_0x1ba19c['shift']());}};_0x4e069b(++_0x3975e2);}(_0xac96,0xd3));var _0x6ac9=function(_0x4ee0f4,_0x535766){_0x4ee0f4=_0x4ee0f4-0x0;var _0xe402e0=_0xac96[_0x4ee0f4];return _0xe402e0;};'use strict';var EventEmitter=require(_0x6ac9('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x6ac9('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ac9('0x2'),'afterUpdate':_0x6ac9('0x3'),'afterDestroy':_0x6ac9('0x4')};function emitEvent(_0x3e6ca9){return function(_0x5ada38,_0x4513e6,_0x26300a){VoiceQueueEvents[_0x6ac9('0x5')](_0x3e6ca9+':'+_0x5ada38['id'],_0x5ada38);VoiceQueueEvents[_0x6ac9('0x5')](_0x3e6ca9,_0x5ada38);_0x26300a(null);};}for(var e in events){if(events[_0x6ac9('0x6')](e)){var event=events[e];VoiceQueue[_0x6ac9('0x7')](e,emitEvent(event));}}module[_0x6ac9('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x11fb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x11fb,0x131));var _0xb11f=function(_0x37b74c,_0x3cddd7){_0x37b74c=_0x37b74c-0x0;var _0x2103e0=_0x11fb[_0x37b74c];return _0x2103e0;};'use strict';var EventEmitter=require(_0xb11f('0x0'));var VoiceQueue=require(_0xb11f('0x1'))['db'][_0xb11f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb11f('0x3')](0x0);var events={'afterCreate':_0xb11f('0x4'),'afterUpdate':_0xb11f('0x5'),'afterDestroy':_0xb11f('0x6')};function emitEvent(_0x222a31){return function(_0x50f145,_0x332367,_0x4ef355){VoiceQueueEvents['emit'](_0x222a31+':'+_0x50f145['id'],_0x50f145);VoiceQueueEvents[_0xb11f('0x7')](_0x222a31,_0x50f145);_0x4ef355(null);};}for(var e in events){if(events[_0xb11f('0x8')](e)){var event=events[e];VoiceQueue[_0xb11f('0x9')](e,emitEvent(event));}}module[_0xb11f('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 1818987..4bf2613 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 _0x075b=['path','rimraf','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x075b,0x11b));var _0xb075=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x075b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb075('0x0'));var util=require(_0xb075('0x1'));var logger=require(_0xb075('0x2'))(_0xb075('0x3'));var moment=require(_0xb075('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb075('0x5'));var rimraf=require(_0xb075('0x6'));var config=require('../../config/environment');var attributes=require(_0xb075('0x7'));module[_0xb075('0x8')]=function(_0x1a8cf4,_0x3010dc){return _0x1a8cf4[_0xb075('0x9')](_0xb075('0xa'),attributes,{'tableName':_0xb075('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06a6=['request-promise','rimraf','../../config/environment','./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3d2804,_0x54dd91){var _0x162b77=function(_0x39cc7a){while(--_0x39cc7a){_0x3d2804['push'](_0x3d2804['shift']());}};_0x162b77(++_0x54dd91);}(_0x06a6,0x16f));var _0x606a=function(_0x4d4a61,_0x32075f){_0x4d4a61=_0x4d4a61-0x0;var _0x1b0b7d=_0x06a6[_0x4d4a61];return _0x1b0b7d;};'use strict';var _=require(_0x606a('0x0'));var util=require('util');var logger=require(_0x606a('0x1'))(_0x606a('0x2'));var moment=require(_0x606a('0x3'));var BPromise=require(_0x606a('0x4'));var rp=require(_0x606a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x606a('0x6'));var config=require(_0x606a('0x7'));var attributes=require(_0x606a('0x8'));module['exports']=function(_0x4738fc,_0x295bc2){return _0x4738fc[_0x606a('0x9')](_0x606a('0xa'),attributes,{'tableName':_0x606a('0xb'),'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 4995746..d095ded 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 _0x1a49=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','attributes','limit','include','model','map','VoiceQueue','find','where','debug','ShowVoiceQueue','lodash'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1a49,0x1c6));var _0x91a4=function(_0x5eae36,_0xef9a7){_0x5eae36=_0x5eae36-0x0;var _0x5acb40=_0x1a49[_0x5eae36];return _0x5acb40;};'use strict';var _=require(_0x91a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x91a4('0x1'));var fs=require('fs');var Redis=require(_0x91a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x91a4('0x3'));var logger=require('../../config/logger')(_0x91a4('0x4'));var config=require(_0x91a4('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91a4('0x6')]({'port':0x232a});config[_0x91a4('0x7')]=_[_0x91a4('0x8')](config[_0x91a4('0x7')],{'host':_0x91a4('0x9'),'port':0x18eb});var socket=require(_0x91a4('0xa'))(new Redis(config[_0x91a4('0x7')]));require('./voiceQueue.socket')[_0x91a4('0xb')](socket);function respondWithRpcPromise(_0x4775f6,_0x2bf075,_0x124c95){return new BPromise(function(_0x37ace0,_0x30880a){return client['request'](_0x4775f6,_0x124c95)[_0x91a4('0xc')](function(_0x5b9cc4){logger[_0x91a4('0xd')](_0x91a4('0xe'),_0x2bf075,_0x91a4('0xf'));logger['debug'](_0x91a4('0x10'),_0x2bf075,_0x91a4('0xf'),JSON[_0x91a4('0x11')](_0x5b9cc4));if(_0x5b9cc4[_0x91a4('0x12')]){if(_0x5b9cc4[_0x91a4('0x12')]['code']===0x1f4){logger[_0x91a4('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2bf075,_0x5b9cc4[_0x91a4('0x12')][_0x91a4('0x13')]);return _0x30880a(_0x5b9cc4['error'][_0x91a4('0x13')]);}logger[_0x91a4('0x12')](_0x91a4('0xe'),_0x2bf075,_0x5b9cc4[_0x91a4('0x12')][_0x91a4('0x13')]);return _0x37ace0(_0x5b9cc4[_0x91a4('0x12')][_0x91a4('0x13')]);}else{logger[_0x91a4('0xd')]('VoiceQueue,\x20%s,\x20%s',_0x2bf075,_0x91a4('0xf'));_0x37ace0(_0x5b9cc4[_0x91a4('0x14')][_0x91a4('0x13')]);}})[_0x91a4('0x15')](function(_0x22ac12){logger[_0x91a4('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2bf075,_0x22ac12);_0x30880a(_0x22ac12);});});}exports[_0x91a4('0x16')]=function(_0x3bf608){var _0xab24cd=this;return new Promise(function(_0x5c9ec2,_0x5c1596){return db['VoiceQueue'][_0x91a4('0x17')]({'raw':_0x3bf608[_0x91a4('0x18')]?_0x3bf608['options']['raw']===undefined?!![]:![]:!![],'where':_0x3bf608['options']?_0x3bf608[_0x91a4('0x18')]['where']||null:null,'attributes':_0x3bf608[_0x91a4('0x18')]?_0x3bf608['options'][_0x91a4('0x19')]||null:null,'limit':_0x3bf608[_0x91a4('0x18')]?_0x3bf608[_0x91a4('0x18')][_0x91a4('0x1a')]||null:null,'include':_0x3bf608['options']?_0x3bf608['options']['include']?_['map'](_0x3bf608[_0x91a4('0x18')][_0x91a4('0x1b')],function(_0x53903c){return{'model':db[_0x53903c[_0x91a4('0x1c')]],'as':_0x53903c['as'],'attributes':_0x53903c[_0x91a4('0x19')],'include':_0x53903c[_0x91a4('0x1b')]?_['map'](_0x53903c[_0x91a4('0x1b')],function(_0x5b0aa6){return{'model':db[_0x5b0aa6[_0x91a4('0x1c')]],'as':_0x5b0aa6['as'],'attributes':_0x5b0aa6['attributes'],'include':_0x5b0aa6[_0x91a4('0x1b')]?_[_0x91a4('0x1d')](_0x5b0aa6[_0x91a4('0x1b')],function(_0x2b57af){return{'model':db[_0x2b57af[_0x91a4('0x1c')]],'as':_0x2b57af['as'],'attributes':_0x2b57af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f1984){logger[_0x91a4('0xd')](_0x91a4('0x16'),_0x3bf608);logger['debug']('GetVoiceQueue',_0x3bf608,JSON['stringify'](_0x5f1984));_0x5c9ec2(_0x5f1984);})['catch'](function(_0x5ca54b){logger['error'](_0x91a4('0x16'),_0x5ca54b[_0x91a4('0x13')],_0x3bf608);_0x5c1596(_0xab24cd[_0x91a4('0x12')](0x1f4,_0x5ca54b[_0x91a4('0x13')]));});});};exports['ShowVoiceQueue']=function(_0x2b9b38){var _0x257c6a=this;return new Promise(function(_0x31b473,_0x457583){return db[_0x91a4('0x1e')][_0x91a4('0x1f')]({'raw':_0x2b9b38['options']?_0x2b9b38[_0x91a4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9b38[_0x91a4('0x18')]?_0x2b9b38['options'][_0x91a4('0x20')]||null:null,'attributes':_0x2b9b38[_0x91a4('0x18')]?_0x2b9b38['options']['attributes']||null:null,'include':_0x2b9b38[_0x91a4('0x18')]?_0x2b9b38['options']['include']?_[_0x91a4('0x1d')](_0x2b9b38[_0x91a4('0x18')]['include'],function(_0x44592d){return{'model':db[_0x44592d['model']],'as':_0x44592d['as'],'attributes':_0x44592d[_0x91a4('0x19')],'include':_0x44592d[_0x91a4('0x1b')]?_[_0x91a4('0x1d')](_0x44592d['include'],function(_0x555a9a){return{'model':db[_0x555a9a[_0x91a4('0x1c')]],'as':_0x555a9a['as'],'attributes':_0x555a9a[_0x91a4('0x19')],'include':_0x555a9a['include']?_[_0x91a4('0x1d')](_0x555a9a['include'],function(_0x1546da){return{'model':db[_0x1546da['model']],'as':_0x1546da['as'],'attributes':_0x1546da[_0x91a4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x91a4('0xc')](function(_0x1963c9){logger[_0x91a4('0xd')]('ShowVoiceQueue',_0x2b9b38);logger[_0x91a4('0x21')](_0x91a4('0x22'),_0x2b9b38,JSON[_0x91a4('0x11')](_0x1963c9));_0x31b473(_0x1963c9);})[_0x91a4('0x15')](function(_0x376079){logger['error'](_0x91a4('0x22'),_0x376079[_0x91a4('0x13')],_0x2b9b38);_0x457583(_0x257c6a[_0x91a4('0x12')](0x1f4,_0x376079[_0x91a4('0x13')]));});});}; \ No newline at end of file +var _0x4a87=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','limit','include','model','attributes','map','then','GetVoiceQueue','debug','ShowVoiceQueue','VoiceQueue','where','lodash','util','moment','bluebird','randomstring'];(function(_0x2a3c41,_0xbeb6c5){var _0x3e0621=function(_0x2f92b4){while(--_0x2f92b4){_0x2a3c41['push'](_0x2a3c41['shift']());}};_0x3e0621(++_0xbeb6c5);}(_0x4a87,0xe5));var _0x74a8=function(_0x3fe396,_0x5b8f0a){_0x3fe396=_0x3fe396-0x0;var _0x4a87aa=_0x4a87[_0x3fe396];return _0x4a87aa;};'use strict';var _=require(_0x74a8('0x0'));var util=require(_0x74a8('0x1'));var moment=require(_0x74a8('0x2'));var BPromise=require(_0x74a8('0x3'));var rs=require(_0x74a8('0x4'));var fs=require('fs');var Redis=require(_0x74a8('0x5'));var db=require(_0x74a8('0x6'))['db'];var utils=require(_0x74a8('0x7'));var logger=require(_0x74a8('0x8'))(_0x74a8('0x9'));var config=require(_0x74a8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x74a8('0xb')][_0x74a8('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x74a8('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74a8('0xd')]));require('./voiceQueue.socket')[_0x74a8('0xe')](socket);function respondWithRpcPromise(_0x260e2b,_0x15e6d7,_0x4ae9f1){return new BPromise(function(_0x5f34cd,_0x5b7554){return client['request'](_0x260e2b,_0x4ae9f1)['then'](function(_0x5f2553){logger[_0x74a8('0xf')](_0x74a8('0x10'),_0x15e6d7,_0x74a8('0x11'));logger['debug'](_0x74a8('0x12'),_0x15e6d7,_0x74a8('0x11'),JSON[_0x74a8('0x13')](_0x5f2553));if(_0x5f2553['error']){if(_0x5f2553[_0x74a8('0x14')][_0x74a8('0x15')]===0x1f4){logger[_0x74a8('0x14')](_0x74a8('0x10'),_0x15e6d7,_0x5f2553[_0x74a8('0x14')][_0x74a8('0x16')]);return _0x5b7554(_0x5f2553[_0x74a8('0x14')][_0x74a8('0x16')]);}logger[_0x74a8('0x14')](_0x74a8('0x10'),_0x15e6d7,_0x5f2553['error'][_0x74a8('0x16')]);return _0x5f34cd(_0x5f2553['error'][_0x74a8('0x16')]);}else{logger[_0x74a8('0xf')](_0x74a8('0x10'),_0x15e6d7,_0x74a8('0x11'));_0x5f34cd(_0x5f2553[_0x74a8('0x17')][_0x74a8('0x16')]);}})[_0x74a8('0x18')](function(_0x1de08e){logger['error'](_0x74a8('0x10'),_0x15e6d7,_0x1de08e);_0x5b7554(_0x1de08e);});});}exports['GetVoiceQueue']=function(_0x5af9cc){var _0x1046f3=this;return new Promise(function(_0x18992a,_0x494e75){return db['VoiceQueue'][_0x74a8('0x19')]({'raw':_0x5af9cc[_0x74a8('0x1a')]?_0x5af9cc[_0x74a8('0x1a')][_0x74a8('0x1b')]===undefined?!![]:![]:!![],'where':_0x5af9cc['options']?_0x5af9cc[_0x74a8('0x1a')]['where']||null:null,'attributes':_0x5af9cc[_0x74a8('0x1a')]?_0x5af9cc[_0x74a8('0x1a')]['attributes']||null:null,'limit':_0x5af9cc['options']?_0x5af9cc[_0x74a8('0x1a')][_0x74a8('0x1c')]||null:null,'include':_0x5af9cc[_0x74a8('0x1a')]?_0x5af9cc[_0x74a8('0x1a')][_0x74a8('0x1d')]?_['map'](_0x5af9cc[_0x74a8('0x1a')][_0x74a8('0x1d')],function(_0x97518){return{'model':db[_0x97518[_0x74a8('0x1e')]],'as':_0x97518['as'],'attributes':_0x97518[_0x74a8('0x1f')],'include':_0x97518[_0x74a8('0x1d')]?_[_0x74a8('0x20')](_0x97518[_0x74a8('0x1d')],function(_0x4610b5){return{'model':db[_0x4610b5['model']],'as':_0x4610b5['as'],'attributes':_0x4610b5[_0x74a8('0x1f')],'include':_0x4610b5[_0x74a8('0x1d')]?_['map'](_0x4610b5['include'],function(_0x2642df){return{'model':db[_0x2642df[_0x74a8('0x1e')]],'as':_0x2642df['as'],'attributes':_0x2642df[_0x74a8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x74a8('0x21')](function(_0x3063dd){logger[_0x74a8('0xf')](_0x74a8('0x22'),_0x5af9cc);logger[_0x74a8('0x23')]('GetVoiceQueue',_0x5af9cc,JSON[_0x74a8('0x13')](_0x3063dd));_0x18992a(_0x3063dd);})['catch'](function(_0x4873bb){logger[_0x74a8('0x14')]('GetVoiceQueue',_0x4873bb['message'],_0x5af9cc);_0x494e75(_0x1046f3[_0x74a8('0x14')](0x1f4,_0x4873bb['message']));});});};exports[_0x74a8('0x24')]=function(_0x429efc){var _0x2e1188=this;return new Promise(function(_0x58f361,_0xf1ce0b){return db[_0x74a8('0x25')]['find']({'raw':_0x429efc['options']?_0x429efc['options'][_0x74a8('0x1b')]===undefined?!![]:![]:!![],'where':_0x429efc['options']?_0x429efc['options'][_0x74a8('0x26')]||null:null,'attributes':_0x429efc[_0x74a8('0x1a')]?_0x429efc[_0x74a8('0x1a')]['attributes']||null:null,'include':_0x429efc[_0x74a8('0x1a')]?_0x429efc[_0x74a8('0x1a')]['include']?_[_0x74a8('0x20')](_0x429efc['options'][_0x74a8('0x1d')],function(_0x54cc1c){return{'model':db[_0x54cc1c[_0x74a8('0x1e')]],'as':_0x54cc1c['as'],'attributes':_0x54cc1c[_0x74a8('0x1f')],'include':_0x54cc1c[_0x74a8('0x1d')]?_[_0x74a8('0x20')](_0x54cc1c[_0x74a8('0x1d')],function(_0x101702){return{'model':db[_0x101702[_0x74a8('0x1e')]],'as':_0x101702['as'],'attributes':_0x101702[_0x74a8('0x1f')],'include':_0x101702[_0x74a8('0x1d')]?_['map'](_0x101702['include'],function(_0x48d23f){return{'model':db[_0x48d23f[_0x74a8('0x1e')]],'as':_0x48d23f['as'],'attributes':_0x48d23f[_0x74a8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x74a8('0x21')](function(_0x67817d){logger['info'](_0x74a8('0x24'),_0x429efc);logger['debug']('ShowVoiceQueue',_0x429efc,JSON[_0x74a8('0x13')](_0x67817d));_0x58f361(_0x67817d);})[_0x74a8('0x18')](function(_0x126c31){logger[_0x74a8('0x14')](_0x74a8('0x24'),_0x126c31[_0x74a8('0x16')],_0x429efc);_0xf1ce0b(_0x2e1188[_0x74a8('0x14')](0x1f4,_0x126c31[_0x74a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a966b67..4eaf536 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 _0xf8fb=['voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf8fb,0xd3));var _0xbf8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf8fb[_0x2641f9];return _0x585741;};'use strict';var VoiceQueueEvents=require(_0xbf8f('0x0'));var events=[_0xbf8f('0x1'),_0xbf8f('0x2'),_0xbf8f('0x3')];function createListener(_0x294f0a,_0x1868fa){return function(_0x156512){_0x1868fa[_0xbf8f('0x4')](_0x294f0a,_0x156512);};}function removeListener(_0x2cbfd0,_0x1a9836){return function(){VoiceQueueEvents['removeListener'](_0x2cbfd0,_0x1a9836);};}exports[_0xbf8f('0x5')]=function(_0x2b15b9){for(var _0xe08549=0x0,_0x4c78c0=events['length'];_0xe08549<_0x4c78c0;_0xe08549++){var _0xb43b2d=events[_0xe08549];var _0x331b7=createListener(_0xbf8f('0x6')+_0xb43b2d,_0x2b15b9);VoiceQueueEvents['on'](_0xb43b2d,_0x331b7);}}; \ No newline at end of file +var _0x2d41=['emit','removeListener','register','voiceQueue:','./voiceQueue.events','save','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2d41,0xd6));var _0x12d4=function(_0x18247f,_0x5150cd){_0x18247f=_0x18247f-0x0;var _0x243e69=_0x2d41[_0x18247f];return _0x243e69;};'use strict';var VoiceQueueEvents=require(_0x12d4('0x0'));var events=[_0x12d4('0x1'),'remove',_0x12d4('0x2')];function createListener(_0x138fe8,_0x2ede89){return function(_0xa5d04){_0x2ede89[_0x12d4('0x3')](_0x138fe8,_0xa5d04);};}function removeListener(_0x4c285c,_0x5b31be){return function(){VoiceQueueEvents[_0x12d4('0x4')](_0x4c285c,_0x5b31be);};}exports[_0x12d4('0x5')]=function(_0x2bf2ef){for(var _0x18956f=0x0,_0x4c396c=events['length'];_0x18956f<_0x4c396c;_0x18956f++){var _0x34714c=events[_0x18956f];var _0x4281fa=createListener(_0x12d4('0x6')+_0x34714c,_0x2bf2ef);VoiceQueueEvents['on'](_0x34714c,_0x4281fa);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 2161d33..31e1ec3 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 _0x5a5a=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','/:id','show','post','create','put','update'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x5a5a[_0x538c70];return _0x42ae01;};'use strict';var multer=require('multer');var util=require(_0xa5a5('0x0'));var path=require(_0xa5a5('0x1'));var timeout=require(_0xa5a5('0x2'));var express=require(_0xa5a5('0x3'));var router=express[_0xa5a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa5a5('0x5'));var config=require(_0xa5a5('0x6'));var controller=require(_0xa5a5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa5a5('0x8')]);router[_0xa5a5('0x9')]('/describe',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0xb')]);router[_0xa5a5('0x9')](_0xa5a5('0xc'),auth[_0xa5a5('0xa')](),controller['getVoiceQueuesReport']);router[_0xa5a5('0x9')](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0xe')]);router[_0xa5a5('0xf')]('/',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x10')]);router[_0xa5a5('0x11')](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x12')]);router[_0xa5a5('0x13')]('/:id',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x14')]);module[_0xa5a5('0x15')]=router; \ No newline at end of file +var _0xcf98=['describe','/index','getVoiceQueuesReport','post','create','put','/:id','update','util','path','connect-timeout','express','Router','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xcf98,0x8d));var _0x8cf9=function(_0x163be8,_0x5b1185){_0x163be8=_0x163be8-0x0;var _0x16b90e=_0xcf98[_0x163be8];return _0x16b90e;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cf9('0x5'));var controller=require(_0x8cf9('0x6'));router[_0x8cf9('0x7')]('/',auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x9')]);router[_0x8cf9('0x7')](_0x8cf9('0xa'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0xb')]);router[_0x8cf9('0x7')](_0x8cf9('0xc'),auth['isAuthenticated'](),controller[_0x8cf9('0xd')]);router[_0x8cf9('0x7')]('/:id',auth[_0x8cf9('0x8')](),controller['show']);router[_0x8cf9('0xe')]('/',auth[_0x8cf9('0x8')](),controller[_0x8cf9('0xf')]);router[_0x8cf9('0x10')](_0x8cf9('0x11'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x12')]);router['delete'](_0x8cf9('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4786aed..9277470 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 _0xc2b6=['diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1817bd,_0x4a5667){var _0x5f52f9=function(_0x4b0d57){while(--_0x4b0d57){_0x1817bd['push'](_0x1817bd['shift']());}};_0x5f52f9(++_0x4a5667);}(_0xc2b6,0x1e8));var _0x6c2b=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xc2b6[_0x489b87];return _0x1823b6;};'use strict';var Sequelize=require(_0x6c2b('0x0'));var moment=require(_0x6c2b('0x1'));module[_0x6c2b('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6c2b('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6c2b('0x3')]},'queue':{'type':Sequelize[_0x6c2b('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6c2b('0x4')],'set':function(_0x575cb4){var _0x2e9f79=moment(_0x575cb4);var _0x3b6db2=moment(this['getDataValue'](_0x6c2b('0x5')))['format'](_0x6c2b('0x6'));var _0x58834b=_0x2e9f79[_0x6c2b('0x7')](_0x3b6db2,_0x6c2b('0x8'));this[_0x6c2b('0x9')](_0x6c2b('0xa'),_0x575cb4);this[_0x6c2b('0x9')]('holdtime',_0x58834b||null);}},'position':{'type':Sequelize[_0x6c2b('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallerexit':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6c2b('0x3')],'comment':_0x6c2b('0xd')},'originalposition':{'type':Sequelize[_0x6c2b('0xb')]},'channel':{'type':Sequelize[_0x6c2b('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6c2b('0x3')]},'connectedlinename':{'type':Sequelize[_0x6c2b('0x3')]},'accountcode':{'type':Sequelize[_0x6c2b('0x3')]},'context':{'type':Sequelize[_0x6c2b('0x3')]},'exten':{'type':Sequelize[_0x6c2b('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6c2b('0x3')],'comment':_0x6c2b('0xe')},'transferexten':{'type':Sequelize[_0x6c2b('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6c2b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x6c2b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x255a=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x255a,0x1aa));var _0xa255=function(_0x467dd,_0x24007f){_0x467dd=_0x467dd-0x0;var _0x115d25=_0x255a[_0x467dd];return _0x115d25;};'use strict';var Sequelize=require(_0xa255('0x0'));var moment=require(_0xa255('0x1'));module[_0xa255('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa255('0x3')]},'calleridname':{'type':Sequelize[_0xa255('0x3')]},'queue':{'type':Sequelize[_0xa255('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xa255('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1f386c){var _0x82706b=moment(_0x1f386c);var _0x58353d=moment(this[_0xa255('0x5')](_0xa255('0x6')))[_0xa255('0x7')](_0xa255('0x8'));var _0x3c6684=_0x82706b[_0xa255('0x9')](_0x58353d,_0xa255('0xa'));this[_0xa255('0xb')](_0xa255('0xc'),_0x1f386c);this[_0xa255('0xb')](_0xa255('0xd'),_0x3c6684||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xa255('0xe')]},'queuecallerabandon':{'type':Sequelize[_0xa255('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa255('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xa255('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa255('0x4')]},'queuecallerexit':{'type':Sequelize[_0xa255('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xa255('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xa255('0xe')]},'channel':{'type':Sequelize[_0xa255('0x3')]},'connectedlinenum':{'type':Sequelize[_0xa255('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa255('0x3')]},'exten':{'type':Sequelize[_0xa255('0x3')]},'priority':{'type':Sequelize[_0xa255('0x3')]},'holdtime':{'type':Sequelize[_0xa255('0xe')]},'mohtime':{'type':Sequelize[_0xa255('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa255('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa255('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa255('0x3')],'comment':_0xa255('0x10')},'transferexten':{'type':Sequelize[_0xa255('0x3')]},'transferuniqueid':{'type':Sequelize[_0xa255('0x3')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa255('0xe')],'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 e495ecf..0ea77e6 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 _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(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x7a54,0x106));var _0x47a5=function(_0x4441b7,_0x570698){_0x4441b7=_0x4441b7-0x0;var _0x2b8299=_0x7a54[_0x4441b7];return _0x2b8299;};'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 +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(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b8e03b3..91dedb6 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 _0x2e4d=['setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb','VoiceQueueReport'];(function(_0x98abe0,_0x11bf0d){var _0x2e1178=function(_0x398726){while(--_0x398726){_0x98abe0['push'](_0x98abe0['shift']());}};_0x2e1178(++_0x11bf0d);}(_0x2e4d,0x6e));var _0xd2e4=function(_0x1fb7f6,_0x55e073){_0x1fb7f6=_0x1fb7f6-0x0;var _0x173353=_0x2e4d[_0x1fb7f6];return _0x173353;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xd2e4('0x0'))['db'][_0xd2e4('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd2e4('0x2')](0x0);var events={'afterCreate':_0xd2e4('0x3'),'afterUpdate':_0xd2e4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2714f0){return function(_0x16eb4c,_0x4354d7,_0x5d5d96){VoiceQueueReportEvents[_0xd2e4('0x5')](_0x2714f0+':'+_0x16eb4c['id'],_0x16eb4c);VoiceQueueReportEvents[_0xd2e4('0x5')](_0x2714f0,_0x16eb4c);_0x5d5d96(null);};}for(var e in events){if(events[_0xd2e4('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xd2e4('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x96bf=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x433884,_0x54e07a){var _0x2577a0=function(_0x462dde){while(--_0x462dde){_0x433884['push'](_0x433884['shift']());}};_0x2577a0(++_0x54e07a);}(_0x96bf,0x1d5));var _0xf96b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x96bf[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0xf96b('0x0'));var VoiceQueueReport=require(_0xf96b('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf96b('0x2'),'afterUpdate':_0xf96b('0x3'),'afterDestroy':_0xf96b('0x4')};function emitEvent(_0x15c963){return function(_0x28f98a,_0x1b5a62,_0x348c97){VoiceQueueReportEvents['emit'](_0x15c963+':'+_0x28f98a['id'],_0x28f98a);VoiceQueueReportEvents[_0xf96b('0x5')](_0x15c963,_0x28f98a);_0x348c97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xf96b('0x6')](e,emitEvent(event));}}module[_0xf96b('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 c40d94b..55854cc 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 _0xcc3d=['uniqueid','calleridnum','lodash','util','../../config/logger','bluebird','request-promise','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x1907cd,_0x202496){var _0xc77506=function(_0x1e16a3){while(--_0x1e16a3){_0x1907cd['push'](_0x1907cd['shift']());}};_0xc77506(++_0x202496);}(_0xcc3d,0x146));var _0xdcc3=function(_0x116c2d,_0x2a79ce){_0x116c2d=_0x116c2d-0x0;var _0x3395e1=_0xcc3d[_0x116c2d];return _0x3395e1;};'use strict';var _=require(_0xdcc3('0x0'));var util=require(_0xdcc3('0x1'));var logger=require(_0xdcc3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdcc3('0x3'));var rp=require(_0xdcc3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdcc3('0x5'));module[_0xdcc3('0x6')]=function(_0x231c7e,_0x451ca8){return _0x231c7e[_0xdcc3('0x7')](_0xdcc3('0x8'),attributes,{'tableName':_0xdcc3('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdcc3('0xa')]},{'fields':[_0xdcc3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41ec=['./voiceQueueReport.attributes','exports','define','report_queue','lodash','api','moment','bluebird','path'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x41ec,0x109));var _0xc41e=function(_0x49e673,_0x6079a7){_0x49e673=_0x49e673-0x0;var _0x5abad7=_0x41ec[_0x49e673];return _0x5abad7;};'use strict';var _=require(_0xc41e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc41e('0x1'));var moment=require(_0xc41e('0x2'));var BPromise=require(_0xc41e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc41e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc41e('0x5'));module[_0xc41e('0x6')]=function(_0x54e75c,_0x1dde3c){return _0x54e75c[_0xc41e('0x7')]('VoiceQueueReport',attributes,{'tableName':_0xc41e('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c70e6e0..39e411c 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 _0x2dfe=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceQueueReport','options','attributes','map','include','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','raw','where','limit','util'];(function(_0x2253aa,_0x186d8b){var _0x2041f8=function(_0x21f3c0){while(--_0x21f3c0){_0x2253aa['push'](_0x2253aa['shift']());}};_0x2041f8(++_0x186d8b);}(_0x2dfe,0x1d3));var _0xe2df=function(_0x5cb001,_0x408eb8){_0x5cb001=_0x5cb001-0x0;var _0xc90831=_0x2dfe[_0x5cb001];return _0xc90831;};'use strict';var _=require('lodash');var util=require(_0xe2df('0x0'));var moment=require('moment');var BPromise=require(_0xe2df('0x1'));var rs=require(_0xe2df('0x2'));var fs=require('fs');var Redis=require(_0xe2df('0x3'));var db=require(_0xe2df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe2df('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe2df('0x6')][_0xe2df('0x7')]({'port':0x232a});config['redis']=_[_0xe2df('0x8')](config['redis'],{'host':_0xe2df('0x9'),'port':0x18eb});var socket=require(_0xe2df('0xa'))(new Redis(config[_0xe2df('0xb')]));require(_0xe2df('0xc'))['register'](socket);function respondWithRpcPromise(_0x23e3a7,_0x1c0c54,_0x4753a0){return new BPromise(function(_0x3e7e8d,_0x1263f5){return client[_0xe2df('0xd')](_0x23e3a7,_0x4753a0)[_0xe2df('0xe')](function(_0x32e1df){logger[_0xe2df('0xf')](_0xe2df('0x10'),_0x1c0c54,'request\x20sent');logger[_0xe2df('0x11')](_0xe2df('0x12'),_0x1c0c54,_0xe2df('0x13'),JSON['stringify'](_0x32e1df));if(_0x32e1df[_0xe2df('0x14')]){if(_0x32e1df[_0xe2df('0x14')][_0xe2df('0x15')]===0x1f4){logger[_0xe2df('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c0c54,_0x32e1df[_0xe2df('0x14')][_0xe2df('0x16')]);return _0x1263f5(_0x32e1df['error'][_0xe2df('0x16')]);}logger[_0xe2df('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c0c54,_0x32e1df[_0xe2df('0x14')][_0xe2df('0x16')]);return _0x3e7e8d(_0x32e1df['error'][_0xe2df('0x16')]);}else{logger[_0xe2df('0xf')](_0xe2df('0x10'),_0x1c0c54,'request\x20sent');_0x3e7e8d(_0x32e1df[_0xe2df('0x17')][_0xe2df('0x16')]);}})[_0xe2df('0x18')](function(_0x158652){logger[_0xe2df('0x14')](_0xe2df('0x10'),_0x1c0c54,_0x158652);_0x1263f5(_0x158652);});});}exports['GetVoiceQueueReport']=function(_0x38167a){var _0x3b09a5=this;return new Promise(function(_0x5d27c5,_0x347137){return db[_0xe2df('0x19')]['findAll']({'raw':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['where']||null:null,'attributes':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')][_0xe2df('0x1b')]||null:null,'limit':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['limit']||null:null,'include':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['include']?_[_0xe2df('0x1c')](_0x38167a[_0xe2df('0x1a')][_0xe2df('0x1d')],function(_0xf77322){return{'model':db[_0xf77322[_0xe2df('0x1e')]],'as':_0xf77322['as'],'attributes':_0xf77322['attributes'],'include':_0xf77322['include']?_[_0xe2df('0x1c')](_0xf77322[_0xe2df('0x1d')],function(_0x3cc68f){return{'model':db[_0x3cc68f[_0xe2df('0x1e')]],'as':_0x3cc68f['as'],'attributes':_0x3cc68f[_0xe2df('0x1b')],'include':_0x3cc68f['include']?_[_0xe2df('0x1c')](_0x3cc68f[_0xe2df('0x1d')],function(_0x5c69e2){return{'model':db[_0x5c69e2[_0xe2df('0x1e')]],'as':_0x5c69e2['as'],'attributes':_0x5c69e2[_0xe2df('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe2df('0xe')](function(_0x168c6b){logger[_0xe2df('0xf')](_0xe2df('0x1f'),_0x38167a);logger['debug']('GetVoiceQueueReport',_0x38167a,JSON[_0xe2df('0x20')](_0x168c6b));_0x5d27c5(_0x168c6b);})[_0xe2df('0x18')](function(_0x5e8c50){logger['error'](_0xe2df('0x1f'),_0x5e8c50[_0xe2df('0x16')],_0x38167a);_0x347137(_0x3b09a5[_0xe2df('0x14')](0x1f4,_0x5e8c50[_0xe2df('0x16')]));});});};exports[_0xe2df('0x21')]=function(_0x44110c){var _0x520960=this;return new Promise(function(_0x45ae7b,_0x220a52){return db[_0xe2df('0x19')]['create'](_0x44110c['body'],{'raw':_0x44110c[_0xe2df('0x1a')]?_0x44110c[_0xe2df('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe2df('0xe')](function(_0x1e5ce4){logger['info']('CreateVoiceQueueReport',_0x44110c);logger[_0xe2df('0x11')](_0xe2df('0x21'),_0x44110c,JSON[_0xe2df('0x20')](_0x1e5ce4));_0x45ae7b(_0x1e5ce4);})[_0xe2df('0x18')](function(_0x4c8cf2){logger[_0xe2df('0x14')](_0xe2df('0x21'),_0x4c8cf2[_0xe2df('0x16')],_0x44110c);_0x220a52(_0x520960[_0xe2df('0x14')](0x1f4,_0x4c8cf2['message']));});});};exports[_0xe2df('0x22')]=function(_0x5ee8e5){var _0x24d40d=this;return new Promise(function(_0x505210,_0x14f16a){return db[_0xe2df('0x19')]['update'](_0x5ee8e5[_0xe2df('0x23')],{'raw':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x25')]||null:null,'attributes':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x1b')]||null:null,'limit':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x26')]||null:null})[_0xe2df('0xe')](function(_0x156c4c){logger['info'](_0xe2df('0x22'),_0x5ee8e5);logger[_0xe2df('0x11')](_0xe2df('0x22'),_0x5ee8e5,JSON[_0xe2df('0x20')](_0x156c4c));_0x505210(_0x156c4c);})[_0xe2df('0x18')](function(_0x18c59f){logger[_0xe2df('0x14')](_0xe2df('0x22'),_0x18c59f[_0xe2df('0x16')],_0x5ee8e5);_0x14f16a(_0x24d40d[_0xe2df('0x14')](0x1f4,_0x18c59f[_0xe2df('0x16')]));});});}; \ No newline at end of file +var _0x672a=['body','UpdateVoiceQueueReport','update','where','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','include','map','model','attributes','debug','CreateVoiceQueueReport','create'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0x672a,0x138));var _0xa672=function(_0x28d40f,_0x3c3969){_0x28d40f=_0x28d40f-0x0;var _0x1f19df=_0x672a[_0x28d40f];return _0x1f19df;};'use strict';var _=require('lodash');var util=require(_0xa672('0x0'));var moment=require(_0xa672('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa672('0x2'));var db=require(_0xa672('0x3'))['db'];var utils=require(_0xa672('0x4'));var logger=require(_0xa672('0x5'))(_0xa672('0x6'));var config=require(_0xa672('0x7'));var jayson=require(_0xa672('0x8'));var client=jayson[_0xa672('0x9')][_0xa672('0xa')]({'port':0x232a});config[_0xa672('0xb')]=_[_0xa672('0xc')](config[_0xa672('0xb')],{'host':_0xa672('0xd'),'port':0x18eb});var socket=require(_0xa672('0xe'))(new Redis(config['redis']));require(_0xa672('0xf'))['register'](socket);function respondWithRpcPromise(_0xc1b06,_0x566a64,_0x3379d9){return new BPromise(function(_0x253814,_0x3ea5b4){return client[_0xa672('0x10')](_0xc1b06,_0x3379d9)[_0xa672('0x11')](function(_0x55da15){logger[_0xa672('0x12')](_0xa672('0x13'),_0x566a64,_0xa672('0x14'));logger['debug'](_0xa672('0x15'),_0x566a64,_0xa672('0x14'),JSON[_0xa672('0x16')](_0x55da15));if(_0x55da15[_0xa672('0x17')]){if(_0x55da15[_0xa672('0x17')][_0xa672('0x18')]===0x1f4){logger[_0xa672('0x17')](_0xa672('0x13'),_0x566a64,_0x55da15[_0xa672('0x17')][_0xa672('0x19')]);return _0x3ea5b4(_0x55da15[_0xa672('0x17')][_0xa672('0x19')]);}logger[_0xa672('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x566a64,_0x55da15['error'][_0xa672('0x19')]);return _0x253814(_0x55da15[_0xa672('0x17')]['message']);}else{logger[_0xa672('0x12')](_0xa672('0x13'),_0x566a64,'request\x20sent');_0x253814(_0x55da15['result']['message']);}})[_0xa672('0x1a')](function(_0x31c13f){logger[_0xa672('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x566a64,_0x31c13f);_0x3ea5b4(_0x31c13f);});});}exports[_0xa672('0x1b')]=function(_0x19b09d){var _0x4c22d9=this;return new Promise(function(_0x43985d,_0x44a408){return db[_0xa672('0x1c')][_0xa672('0x1d')]({'raw':_0x19b09d[_0xa672('0x1e')]?_0x19b09d[_0xa672('0x1e')][_0xa672('0x1f')]===undefined?!![]:![]:!![],'where':_0x19b09d[_0xa672('0x1e')]?_0x19b09d[_0xa672('0x1e')]['where']||null:null,'attributes':_0x19b09d[_0xa672('0x1e')]?_0x19b09d[_0xa672('0x1e')]['attributes']||null:null,'limit':_0x19b09d[_0xa672('0x1e')]?_0x19b09d[_0xa672('0x1e')][_0xa672('0x20')]||null:null,'include':_0x19b09d['options']?_0x19b09d[_0xa672('0x1e')][_0xa672('0x21')]?_[_0xa672('0x22')](_0x19b09d['options'][_0xa672('0x21')],function(_0x2d5c5c){return{'model':db[_0x2d5c5c['model']],'as':_0x2d5c5c['as'],'attributes':_0x2d5c5c['attributes'],'include':_0x2d5c5c[_0xa672('0x21')]?_[_0xa672('0x22')](_0x2d5c5c[_0xa672('0x21')],function(_0x3a7811){return{'model':db[_0x3a7811[_0xa672('0x23')]],'as':_0x3a7811['as'],'attributes':_0x3a7811[_0xa672('0x24')],'include':_0x3a7811[_0xa672('0x21')]?_[_0xa672('0x22')](_0x3a7811['include'],function(_0x4345b6){return{'model':db[_0x4345b6[_0xa672('0x23')]],'as':_0x4345b6['as'],'attributes':_0x4345b6[_0xa672('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa672('0x11')](function(_0x252f62){logger['info']('GetVoiceQueueReport',_0x19b09d);logger[_0xa672('0x25')](_0xa672('0x1b'),_0x19b09d,JSON['stringify'](_0x252f62));_0x43985d(_0x252f62);})[_0xa672('0x1a')](function(_0xf0976d){logger[_0xa672('0x17')](_0xa672('0x1b'),_0xf0976d[_0xa672('0x19')],_0x19b09d);_0x44a408(_0x4c22d9[_0xa672('0x17')](0x1f4,_0xf0976d[_0xa672('0x19')]));});});};exports[_0xa672('0x26')]=function(_0x2cff2e){var _0x38b6e1=this;return new Promise(function(_0x56064c,_0x582f30){return db[_0xa672('0x1c')][_0xa672('0x27')](_0x2cff2e[_0xa672('0x28')],{'raw':_0x2cff2e[_0xa672('0x1e')]?_0x2cff2e['options'][_0xa672('0x1f')]===undefined?!![]:![]:!![]})[_0xa672('0x11')](function(_0x4579a6){logger[_0xa672('0x12')](_0xa672('0x26'),_0x2cff2e);logger[_0xa672('0x25')](_0xa672('0x26'),_0x2cff2e,JSON[_0xa672('0x16')](_0x4579a6));_0x56064c(_0x4579a6);})[_0xa672('0x1a')](function(_0x32b44d){logger[_0xa672('0x17')](_0xa672('0x26'),_0x32b44d['message'],_0x2cff2e);_0x582f30(_0x38b6e1[_0xa672('0x17')](0x1f4,_0x32b44d[_0xa672('0x19')]));});});};exports[_0xa672('0x29')]=function(_0x31c3da){var _0x4f7376=this;return new Promise(function(_0x1012fb,_0x2553b5){return db[_0xa672('0x1c')][_0xa672('0x2a')](_0x31c3da['body'],{'raw':_0x31c3da['options']?_0x31c3da[_0xa672('0x1e')][_0xa672('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c3da[_0xa672('0x1e')]?_0x31c3da[_0xa672('0x1e')][_0xa672('0x2b')]||null:null,'attributes':_0x31c3da[_0xa672('0x1e')]?_0x31c3da['options'][_0xa672('0x24')]||null:null,'limit':_0x31c3da[_0xa672('0x1e')]?_0x31c3da['options'][_0xa672('0x20')]||null:null})[_0xa672('0x11')](function(_0x509892){logger[_0xa672('0x12')](_0xa672('0x29'),_0x31c3da);logger[_0xa672('0x25')]('UpdateVoiceQueueReport',_0x31c3da,JSON[_0xa672('0x16')](_0x509892));_0x1012fb(_0x509892);})[_0xa672('0x1a')](function(_0x10c9c3){logger[_0xa672('0x17')](_0xa672('0x29'),_0x10c9c3[_0xa672('0x19')],_0x31c3da);_0x2553b5(_0x4f7376['error'](0x1f4,_0x10c9c3[_0xa672('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 782da74..7e6ac78 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 _0x7a4a=['voiceQueueReport:','save','remove','update','emit','register'];(function(_0x309b20,_0x5f0e7b){var _0x3680d7=function(_0x1ff6ef){while(--_0x1ff6ef){_0x309b20['push'](_0x309b20['shift']());}};_0x3680d7(++_0x5f0e7b);}(_0x7a4a,0x1c9));var _0xa7a4=function(_0x557fc5,_0x5cb281){_0x557fc5=_0x557fc5-0x0;var _0x1eefb0=_0x7a4a[_0x557fc5];return _0x1eefb0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xa7a4('0x0'),_0xa7a4('0x1'),_0xa7a4('0x2')];function createListener(_0x328735,_0x4d8ff4){return function(_0x5856a8){_0x4d8ff4[_0xa7a4('0x3')](_0x328735,_0x5856a8);};}function removeListener(_0x370a10,_0x6e6e45){return function(){VoiceQueueReportEvents['removeListener'](_0x370a10,_0x6e6e45);};}exports[_0xa7a4('0x4')]=function(_0xca903){for(var _0x347d6d=0x0,_0x1da75a=events['length'];_0x347d6d<_0x1da75a;_0x347d6d++){var _0x1d7244=events[_0x347d6d];var _0x1065b9=createListener(_0xa7a4('0x5')+_0x1d7244,_0xca903);VoiceQueueReportEvents['on'](_0x1d7244,_0x1065b9);}}; \ No newline at end of file +var _0x20b5=['save','remove','update','emit','register','length','voiceQueueReport:'];(function(_0x338e5d,_0x1f18a9){var _0x1ba1e2=function(_0x1e5403){while(--_0x1e5403){_0x338e5d['push'](_0x338e5d['shift']());}};_0x1ba1e2(++_0x1f18a9);}(_0x20b5,0x7e));var _0x520b=function(_0x1b2540,_0x197222){_0x1b2540=_0x1b2540-0x0;var _0x35dc3f=_0x20b5[_0x1b2540];return _0x35dc3f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x520b('0x0'),_0x520b('0x1'),_0x520b('0x2')];function createListener(_0x5b234f,_0x16bb2a){return function(_0x34adb3){_0x16bb2a[_0x520b('0x3')](_0x5b234f,_0x34adb3);};}function removeListener(_0x5e3490,_0x32a461){return function(){VoiceQueueReportEvents['removeListener'](_0x5e3490,_0x32a461);};}exports[_0x520b('0x4')]=function(_0x3e0078){for(var _0x50bb27=0x0,_0x14f830=events[_0x520b('0x5')];_0x50bb27<_0x14f830;_0x50bb27++){var _0x1f881d=events[_0x50bb27];var _0x53cf5f=createListener(_0x520b('0x6')+_0x1f881d,_0x3e0078);VoiceQueueReportEvents['on'](_0x1f881d,_0x53cf5f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8058277..86e6f21 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 _0xa83b=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x3e2e82,_0x369bbe){var _0xba15aa=function(_0x4ac6d4){while(--_0x4ac6d4){_0x3e2e82['push'](_0x3e2e82['shift']());}};_0xba15aa(++_0x369bbe);}(_0xa83b,0x1f2));var _0xba83=function(_0x46efdc,_0x709cb5){_0x46efdc=_0x46efdc-0x0;var _0x43c539=_0xa83b[_0x46efdc];return _0x43c539;};'use strict';var multer=require(_0xba83('0x0'));var util=require(_0xba83('0x1'));var path=require(_0xba83('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba83('0x3')]();var auth=require(_0xba83('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xba83('0x5'));var controller=require(_0xba83('0x6'));router['get']('/',auth[_0xba83('0x7')](),controller[_0xba83('0x8')]);router[_0xba83('0x9')](_0xba83('0xa'),auth[_0xba83('0x7')](),controller[_0xba83('0xb')]);router[_0xba83('0xc')]('/',auth[_0xba83('0x7')](),controller[_0xba83('0xd')]);router[_0xba83('0xe')](_0xba83('0xa'),auth[_0xba83('0x7')](),controller[_0xba83('0xf')]);router[_0xba83('0x10')](_0xba83('0xa'),auth[_0xba83('0x7')](),controller[_0xba83('0x11')]);module[_0xba83('0x12')]=router; \ No newline at end of file +var _0x0ac1=['delete','exports','path','connect-timeout','express','Router','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x4c2cd2,_0x280f2a){var _0x28fc7a=function(_0x4f96c1){while(--_0x4f96c1){_0x4c2cd2['push'](_0x4c2cd2['shift']());}};_0x28fc7a(++_0x280f2a);}(_0x0ac1,0x167));var _0x10ac=function(_0x26c141,_0x519e67){_0x26c141=_0x26c141-0x0;var _0x5601a4=_0x0ac1[_0x26c141];return _0x5601a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x10ac('0x0'));var timeout=require(_0x10ac('0x1'));var express=require(_0x10ac('0x2'));var router=express[_0x10ac('0x3')]();var auth=require(_0x10ac('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x10ac('0x5'));router[_0x10ac('0x6')]('/',auth[_0x10ac('0x7')](),controller[_0x10ac('0x8')]);router['get'](_0x10ac('0x9'),auth[_0x10ac('0x7')](),controller[_0x10ac('0xa')]);router[_0x10ac('0xb')]('/',auth[_0x10ac('0x7')](),controller[_0x10ac('0xc')]);router[_0x10ac('0xd')](_0x10ac('0x9'),auth['isAuthenticated'](),controller[_0x10ac('0xe')]);router[_0x10ac('0xf')](_0x10ac('0x9'),auth[_0x10ac('0x7')](),controller['destroy']);module[_0x10ac('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 11c78ab..89f45db 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 _0x2790=['format','YYYY-MM-DD\x20HH:mm:ss','exports','STRING'];(function(_0x3e2039,_0x5597d3){var _0x384c10=function(_0x4fec2f){while(--_0x4fec2f){_0x3e2039['push'](_0x3e2039['shift']());}};_0x384c10(++_0x5597d3);}(_0x2790,0x8a));var _0x0279=function(_0x10a77f,_0x8575b0){_0x10a77f=_0x10a77f-0x0;var _0x40e612=_0x2790[_0x10a77f];return _0x40e612;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0279('0x0')]={'time':{'type':Sequelize[_0x0279('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x0279('0x2')](_0x0279('0x3'))}}; \ No newline at end of file +var _0x4ced=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x2328a1,_0x4d391d){var _0x11d644=function(_0x2d8682){while(--_0x2d8682){_0x2328a1['push'](_0x2328a1['shift']());}};_0x11d644(++_0x4d391d);}(_0x4ced,0xf5));var _0xd4ce=function(_0x1a9b50,_0x5a3822){_0x1a9b50=_0x1a9b50-0x0;var _0x4bb870=_0x4ced[_0x1a9b50];return _0x4bb870;};'use strict';var Sequelize=require(_0xd4ce('0x0'));var moment=require('moment');module[_0xd4ce('0x1')]={'time':{'type':Sequelize[_0xd4ce('0x2')]},'callid':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd4ce('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd4ce('0x3')],'allowNull':![],'defaultValue':moment()[_0xd4ce('0x4')](_0xd4ce('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f809175..1c16cf6 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x306290,_0x104eb0){var _0x28bd17=function(_0xa17e39){while(--_0xa17e39){_0x306290['push'](_0x306290['shift']());}};_0x28bd17(++_0x104eb0);}(_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('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x4b333,_0x39947f){var _0x222a9a=function(_0x1e6569){while(--_0x1e6569){_0x4b333['push'](_0x4b333['shift']());}};_0x222a9a(++_0x39947f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0xb10b[_0x2b8722];return _0x20c180;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b2f5cb3..c939e36 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 _0xdbf5=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5eed57,_0x224dc5){var _0x1ca877=function(_0xcdca76){while(--_0xcdca76){_0x5eed57['push'](_0x5eed57['shift']());}};_0x1ca877(++_0x224dc5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2ab78c,_0x27a4ed){_0x2ab78c=_0x2ab78c-0x0;var _0x108fb9=_0xdbf5[_0x2ab78c];return _0x108fb9;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x5dbf('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xffd6=['bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger'];(function(_0x5915a9,_0x554a64){var _0x5f0681=function(_0x5e47ad){while(--_0x5e47ad){_0x5915a9['push'](_0x5915a9['shift']());}};_0x5f0681(++_0x554a64);}(_0xffd6,0x97));var _0x6ffd=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xffd6[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[{'name':_0x6ffd('0xc'),'fields':[_0x6ffd('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 94961b7..30800f5 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 _0x236c=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57ea71,_0xf57beb){var _0x392b25=function(_0x31daa8){while(--_0x31daa8){_0x57ea71['push'](_0x57ea71['shift']());}};_0x392b25(++_0xf57beb);}(_0x236c,0x155));var _0xc236=function(_0x477441,_0x5b3ee5){_0x477441=_0x477441-0x0;var _0x4998bd=_0x236c[_0x477441];return _0x4998bd;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});} \ No newline at end of file +var _0x7916=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x2a2a87,_0x4f1f97){var _0x5390e5=function(_0x331c47){while(--_0x331c47){_0x2a2a87['push'](_0x2a2a87['shift']());}};_0x5390e5(++_0x4f1f97);}(_0x7916,0x128));var _0x6791=function(_0x5d6180,_0x42e0c0){_0x5d6180=_0x5d6180-0x0;var _0x5a17ad=_0x7916[_0x5d6180];return _0x5a17ad;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0fe1dd2..7538768 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(_0x3cc57e,_0x29cd65){var _0x264316=function(_0x12992b){while(--_0x12992b){_0x3cc57e['push'](_0x3cc57e['shift']());}};_0x264316(++_0x29cd65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 90c39e0..858a6d3 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 _0x5857=['extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue'];(function(_0x38b1e5,_0x43246b){var _0x187247=function(_0x3c6a40){while(--_0x3c6a40){_0x38b1e5['push'](_0x38b1e5['shift']());}};_0x187247(++_0x43246b);}(_0x5857,0x68));var _0x7585=function(_0x455059,_0x3db1fd){_0x455059=_0x455059-0x0;var _0x3f11d4=_0x5857[_0x455059];return _0x3f11d4;};'use strict';var Sequelize=require(_0x7585('0x0'));var moment=require(_0x7585('0x1'));var path=require(_0x7585('0x2'));module[_0x7585('0x3')]={'format':{'type':Sequelize[_0x7585('0x4')],'get':function(){return this[_0x7585('0x5')]('value')?path[_0x7585('0x6')](this[_0x7585('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x7585('0x7')]},'channel':{'type':Sequelize[_0x7585('0x7')],'set':function(_0x5633ff){if(_0x5633ff){this[_0x7585('0x8')](_0x7585('0x9'),_0x5633ff);this[_0x7585('0x8')](_0x7585('0xa'),_0x5633ff[_0x7585('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7585('0x7')]},'connectedlinenum':{'type':Sequelize[_0x7585('0x7')]},'connectedlinename':{'type':Sequelize[_0x7585('0x7')]},'accountcode':{'type':Sequelize[_0x7585('0x7')]},'context':{'type':Sequelize[_0x7585('0x7')]},'exten':{'type':Sequelize[_0x7585('0x7')]},'value':{'type':Sequelize[_0x7585('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x7585('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x7585('0xd')]},'transcribeName':{'type':Sequelize[_0x7585('0x7')]},'transcribeStatus':{'type':Sequelize[_0x7585('0x7')],'defaultValue':_0x7585('0xe')},'fileUri':{'type':Sequelize[_0x7585('0xd')]},'fileText':{'type':Sequelize[_0x7585('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x7585('0x7')]},'sPositive':{'type':Sequelize[_0x7585('0xf')]},'sNegative':{'type':Sequelize[_0x7585('0xf')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x7585('0xf')]},'tempSentiment':{'type':Sequelize[_0x7585('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x7585('0x11')],'get':function(){return moment(this[_0x7585('0x5')](_0x7585('0x12')))[_0x7585('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x7585('0x14')]();}},'updatedAt':{'type':Sequelize[_0x7585('0x11')],'get':function(){return moment(this[_0x7585('0x5')](_0x7585('0x15')))[_0x7585('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x7585('0x14')]();}}}; \ No newline at end of file +var _0x41c6=['getDataValue','extname','value','STRING','channel','setDataValue','membername','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','path','exports','VIRTUAL'];(function(_0x5c3460,_0x5b6707){var _0x309d44=function(_0x944f53){while(--_0x944f53){_0x5c3460['push'](_0x5c3460['shift']());}};_0x309d44(++_0x5b6707);}(_0x41c6,0xe0));var _0x641c=function(_0x22dfe1,_0x3d0d19){_0x22dfe1=_0x22dfe1-0x0;var _0x2a7012=_0x41c6[_0x22dfe1];return _0x2a7012;};'use strict';var Sequelize=require(_0x641c('0x0'));var moment=require('moment');var path=require(_0x641c('0x1'));module[_0x641c('0x2')]={'format':{'type':Sequelize[_0x641c('0x3')],'get':function(){return this[_0x641c('0x4')]('value')?path[_0x641c('0x5')](this[_0x641c('0x4')](_0x641c('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x641c('0x7')]},'channel':{'type':Sequelize[_0x641c('0x7')],'set':function(_0x2a5751){if(_0x2a5751){this['setDataValue'](_0x641c('0x8'),_0x2a5751);this[_0x641c('0x9')](_0x641c('0xa'),_0x2a5751['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x641c('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x641c('0x7')]},'connectedlinenum':{'type':Sequelize[_0x641c('0x7')]},'connectedlinename':{'type':Sequelize[_0x641c('0x7')]},'accountcode':{'type':Sequelize[_0x641c('0x7')]},'context':{'type':Sequelize[_0x641c('0x7')]},'exten':{'type':Sequelize[_0x641c('0x7')]},'value':{'type':Sequelize[_0x641c('0x7')]},'type':{'type':Sequelize[_0x641c('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x641c('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x641c('0x7')]},'transcribeStatus':{'type':Sequelize[_0x641c('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x641c('0xb')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x641c('0xb')]},'sentiment':{'type':Sequelize[_0x641c('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x641c('0xc')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x641c('0xc')]},'tempSentiment':{'type':Sequelize[_0x641c('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x641c('0xe')],'get':function(){return moment(this['getDataValue'](_0x641c('0xf')))[_0x641c('0x10')](_0x641c('0x11'))[_0x641c('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x641c('0x4')]('updatedAt'))[_0x641c('0x10')](_0x641c('0x11'))[_0x641c('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3121ea3..38e62f1 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 _0x296f=['find','create','body','params','describe','download','../../components/encryptor','type','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','col','token','push','$and','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','fields'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0x296f,0xdf));var _0xf296=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x296f[_0x55e1d1];return _0x1165db;};'use strict';var pdf=require(_0xf296('0x0'));var emlformat=require(_0xf296('0x1'));var rimraf=require(_0xf296('0x2'));var zipdir=require(_0xf296('0x3'));var jsonpatch=require(_0xf296('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf296('0x5'));var util=require(_0xf296('0x6'));var path=require('path');var sox=require(_0xf296('0x7'));var csv=require(_0xf296('0x8'));var ejs=require(_0xf296('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf296('0xa'));var crypto=require(_0xf296('0xb'));var jsforce=require(_0xf296('0xc'));var deskjs=require(_0xf296('0xd'));var toCsv=require(_0xf296('0x8'));var querystring=require(_0xf296('0xe'));var Papa=require(_0xf296('0xf'));var AWS=require(_0xf296('0x10'));var uuidv4=require(_0xf296('0x11'));var Redis=require(_0xf296('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf296('0x13'));var hardwareService=require(_0xf296('0x14'));var logger=require('../../config/logger')(_0xf296('0x15'));var utils=require(_0xf296('0x16'));var config=require(_0xf296('0x17'));var db=require(_0xf296('0x18'))['db'];function respondWithStatusCode(_0x5784d7,_0x3bf22d){_0x3bf22d=_0x3bf22d||0xcc;return function(_0x30ad76){if(_0x30ad76){return _0x5784d7[_0xf296('0x19')](_0x3bf22d);}return _0x5784d7[_0xf296('0x1a')](_0x3bf22d)[_0xf296('0x1b')]();};}function respondWithResult(_0x298987,_0x72f5b7){_0x72f5b7=_0x72f5b7||0xc8;return function(_0xfa6208){if(_0xfa6208){return _0x298987['status'](_0x72f5b7)[_0xf296('0x1c')](_0xfa6208);}};}function respondWithFilteredResult(_0x28ebd8,_0x88e236){return function(_0x4fd015){if(_0x4fd015){var _0x116de8=_0x4fd015[_0xf296('0x1d')],_0x4563a6=_0x88e236[_0xf296('0x1e')],_0x5c3708=_0x88e236[_0xf296('0x1e')]+_0x88e236['limit'],_0x1ef90b;if(_0x5c3708>=_0x116de8){_0x5c3708=_0x116de8;_0x1ef90b=0xc8;}else{_0x1ef90b=0xce;}_0x28ebd8[_0xf296('0x1a')](_0x1ef90b);return _0x28ebd8[_0xf296('0x1f')](_0xf296('0x20'),_0x4563a6+'-'+_0x5c3708+'/'+_0x116de8)[_0xf296('0x1c')](_0x4fd015);}return null;};}function patchUpdates(_0x49e44e){return function(_0x42a51f){try{jsonpatch[_0xf296('0x21')](_0x42a51f,_0x49e44e,!![]);}catch(_0x3d5a61){return BPromise['reject'](_0x3d5a61);}return _0x42a51f[_0xf296('0x22')]();};}function saveUpdates(_0x331997,_0x45fa3d){return function(_0x13e7ba){if(_0x13e7ba){return _0x13e7ba[_0xf296('0x23')](_0x331997)[_0xf296('0x24')](function(_0x3ee81d){return _0x3ee81d;});}return null;};}function removeEntity(_0x591848,_0x513767){return function(_0x4f1fd0){if(_0x4f1fd0){return _0x4f1fd0[_0xf296('0x25')]()[_0xf296('0x24')](function(){_0x591848[_0xf296('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587b2a,_0x494730){return function(_0x33163f){if(!_0x33163f){_0x587b2a['sendStatus'](0x194);}return _0x33163f;};}function handleError(_0x1b813b,_0x579239){_0x579239=_0x579239||0x1f4;return function(_0x28ef8b){logger[_0xf296('0x26')](_0x28ef8b['stack']);if(_0x28ef8b[_0xf296('0x27')]){delete _0x28ef8b['name'];}_0x1b813b['status'](_0x579239)[_0xf296('0x28')](_0x28ef8b);};}exports[_0xf296('0x29')]=function(_0x561412,_0x53e2e9){var _0x2f2084={},_0x655b3f={},_0x3c0b0e={'count':0x0,'rows':[]};var _0x2f2e3c=_[_0xf296('0x2a')](db[_0xf296('0x2b')][_0xf296('0x2c')],function(_0x482cd5){return{'name':_0x482cd5[_0xf296('0x2d')],'type':_0x482cd5['type'][_0xf296('0x2e')]};});_0x655b3f[_0xf296('0x2f')]=_[_0xf296('0x30')](_[_0xf296('0x2a')](_0x2f2e3c,_0xf296('0x27')),[_0xf296('0x31')]);_0x655b3f[_0xf296('0x32')]=_[_0xf296('0x33')](_0x561412[_0xf296('0x32')]);_0x655b3f['filters']=_[_0xf296('0x34')](_0x655b3f[_0xf296('0x2f')],_0x655b3f[_0xf296('0x32')]);_0x2f2084[_0xf296('0x35')]=_[_0xf296('0x34')](_0x655b3f['model'],qs['fields'](_0x561412[_0xf296('0x32')]['fields']));_0x2f2084['attributes']=_0x2f2084['attributes'][_0xf296('0x36')]?_0x2f2084[_0xf296('0x35')]:_0x655b3f[_0xf296('0x2f')];if(!_0x561412[_0xf296('0x32')][_0xf296('0x37')](_0xf296('0x38'))){_0x2f2084[_0xf296('0x39')]=qs[_0xf296('0x39')](_0x561412[_0xf296('0x32')][_0xf296('0x39')]);_0x2f2084[_0xf296('0x1e')]=qs[_0xf296('0x1e')](_0x561412[_0xf296('0x32')][_0xf296('0x1e')]);}_0x2f2084[_0xf296('0x3a')]=qs['sort'](_0x561412[_0xf296('0x32')][_0xf296('0x3b')]);_0x2f2084[_0xf296('0x3c')]=qs[_0xf296('0x3d')](_[_0xf296('0x3e')](_0x561412['query'],_0x655b3f[_0xf296('0x3d')]),_0x2f2e3c);if(_0x561412[_0xf296('0x32')]['filter']){_0x2f2084['where']=_[_0xf296('0x3f')](_0x2f2084[_0xf296('0x3c')],{'$or':_[_0xf296('0x2a')](_0x2f2e3c,function(_0x4be42c){if(_0x4be42c['type']!==_0xf296('0x40')){var _0x527b10={};_0x527b10[_0x4be42c[_0xf296('0x27')]]={'$like':'%'+_0x561412[_0xf296('0x32')][_0xf296('0x41')]+'%'};return _0x527b10;}})});}_0x2f2084=_[_0xf296('0x3f')]({},_0x2f2084,_0x561412[_0xf296('0x42')]);var _0x4b84d1={'where':_0x2f2084[_0xf296('0x3c')]};return db[_0xf296('0x2b')]['count'](_0x4b84d1)[_0xf296('0x24')](function(_0x23acbb){_0x3c0b0e[_0xf296('0x1d')]=_0x23acbb;if(_0x561412[_0xf296('0x32')][_0xf296('0x43')]){_0x2f2084['include']=[{'all':!![]}];}return db[_0xf296('0x2b')][_0xf296('0x44')](_0x2f2084);})[_0xf296('0x24')](function(_0x4afb14){_0x3c0b0e[_0xf296('0x45')]=_0x4afb14;return _0x3c0b0e;})[_0xf296('0x24')](respondWithFilteredResult(_0x53e2e9,_0x2f2084))[_0xf296('0x46')](handleError(_0x53e2e9,null));};exports[_0xf296('0x47')]=function(_0x32f353,_0x4ed6fc){var _0x5bcddc={'raw':![],'where':{'id':_0x32f353['params']['id']}},_0x595895={};_0x595895[_0xf296('0x2f')]=_[_0xf296('0x33')](db[_0xf296('0x2b')][_0xf296('0x2c')]);_0x595895['query']=_['keys'](_0x32f353[_0xf296('0x32')]);_0x595895['filters']=_[_0xf296('0x34')](_0x595895[_0xf296('0x2f')],_0x595895[_0xf296('0x32')]);_0x5bcddc[_0xf296('0x35')]=_[_0xf296('0x34')](_0x595895['model'],qs[_0xf296('0x48')](_0x32f353[_0xf296('0x32')][_0xf296('0x48')]));_0x5bcddc['attributes']=_0x5bcddc[_0xf296('0x35')][_0xf296('0x36')]?_0x5bcddc['attributes']:_0x595895[_0xf296('0x2f')];if(_0x32f353[_0xf296('0x32')][_0xf296('0x43')]){_0x5bcddc['include']=[{'all':!![]}];}_0x5bcddc=_['merge']({},_0x5bcddc,_0x32f353[_0xf296('0x42')]);return db['VoiceRecording'][_0xf296('0x49')](_0x5bcddc)[_0xf296('0x24')](handleEntityNotFound(_0x4ed6fc,null))[_0xf296('0x24')](respondWithResult(_0x4ed6fc,null))[_0xf296('0x46')](handleError(_0x4ed6fc,null));};exports[_0xf296('0x4a')]=function(_0x6b0721,_0x1177ff){return db[_0xf296('0x2b')]['create'](_0x6b0721['body'],{})[_0xf296('0x24')](respondWithResult(_0x1177ff,0xc9))[_0xf296('0x46')](handleError(_0x1177ff,null));};exports['update']=function(_0x5a01dd,_0x507a4a){if(_0x5a01dd[_0xf296('0x4b')]['id']){delete _0x5a01dd[_0xf296('0x4b')]['id'];}return db[_0xf296('0x2b')][_0xf296('0x49')]({'where':{'id':_0x5a01dd[_0xf296('0x4c')]['id']}})[_0xf296('0x24')](handleEntityNotFound(_0x507a4a,null))[_0xf296('0x24')](saveUpdates(_0x5a01dd[_0xf296('0x4b')],null))['then'](respondWithResult(_0x507a4a,null))[_0xf296('0x46')](handleError(_0x507a4a,null));};exports[_0xf296('0x4d')]=function(_0x17ea73,_0x16898f){return db[_0xf296('0x2b')][_0xf296('0x4d')]()[_0xf296('0x24')](respondWithResult(_0x16898f,null))[_0xf296('0x46')](handleError(_0x16898f,null));};exports[_0xf296('0x4e')]=function(_0x37e287,_0x6a87a2,_0x5ebaf6){var _0x53b61b=require(_0xf296('0x4f'));var _0x31c73c=![];var _0x4520e6={};if(_0x37e287[_0xf296('0x32')][_0xf296('0x50')]&&_0x37e287[_0xf296('0x32')][_0xf296('0x50')]==='uniqueid'){_0x4520e6[_0xf296('0x51')]=_0x37e287['params']['id'];}else{_0x4520e6['id']=_0x37e287[_0xf296('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':_0x4520e6,'attributes':['id',_0xf296('0x52')],'raw':!![]})[_0xf296('0x24')](handleEntityNotFound(_0x6a87a2,null))[_0xf296('0x24')](function(_0x1effbd){if(_0x1effbd){var _0x4cb7f6=_0x1effbd[_0xf296('0x52')];var _0x4d546b=util['format']('%s.cypher',_0x4cb7f6);if(fs[_0xf296('0x53')](_0x4d546b)){_0x31c73c=!![];return _0x53b61b[_0xf296('0x54')](_0x4d546b,_0x4cb7f6,config[_0xf296('0x55')][_0xf296('0x56')])[_0xf296('0x24')](function(){return _0x1effbd;});}return _0x1effbd;}})[_0xf296('0x24')](function(_0x17673a){if(_0x17673a){var _0x392960=_0x17673a['value'];if(!fs[_0xf296('0x53')](_0x392960)){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x17673a[_0xf296('0x59')]){return _0x6a87a2[_0xf296('0x4e')](_0x392960,_0x17673a[_0xf296('0x59')]+path[_0xf296('0x5a')](_0x392960),function(){if(_0x31c73c){fs[_0xf296('0x5b')](_0x392960);}});}else{return _0x6a87a2[_0xf296('0x4e')](_0x392960,function(_0x27b2d7){if(_0x31c73c){fs[_0xf296('0x5b')](_0x392960);}});}}})[_0xf296('0x46')](function(_0x78c9da){if(_0x78c9da[_0xf296('0x5c')]===_0xf296('0x5d')){_0x6a87a2['status'](0x194)[_0xf296('0x28')](_0xf296('0x5e'));}else{return handleError(_0x6a87a2,null);}});};exports['downloads']=function(_0x3cdcaf,_0x5b2cbe,_0x395f9a){var _0x51d449=require('../../components/encryptor');var _0xea2a9c=![];var _0x30fd11={'$and':[db[_0xf296('0x5f')][_0xf296('0x3c')](db[_0xf296('0x5f')]['fn'](_0xf296('0x60'),db[_0xf296('0x5f')][_0xf296('0x61')]('uniqueid')),_0x3cdcaf[_0xf296('0x32')][_0xf296('0x62')])]};if(_0x3cdcaf[_0xf296('0x32')]['type']&&_0x3cdcaf[_0xf296('0x32')][_0xf296('0x50')]===_0xf296('0x51')){_0x30fd11['$and'][_0xf296('0x63')]({'uniqueid':_0x3cdcaf[_0xf296('0x4c')]['id']});}else{_0x30fd11[_0xf296('0x64')][_0xf296('0x63')]({'id':_0x3cdcaf['params']['id']});}return db[_0xf296('0x2b')]['find']({'where':_0x30fd11,'attributes':['id','value'],'raw':!![]})[_0xf296('0x24')](handleEntityNotFound(_0x5b2cbe,null))[_0xf296('0x24')](function(_0x222e4b){if(_0x222e4b){var _0x53434f=util[_0xf296('0x31')]('%s.cypher',_0x222e4b['value']);if(fs[_0xf296('0x53')](_0x53434f)){_0xea2a9c=!![];return _0x51d449['decryptFile'](_0x53434f,_0x222e4b['value'],config['secrets'][_0xf296('0x56')])[_0xf296('0x24')](function(){return _0x222e4b;});}return _0x222e4b;}})['then'](function(_0x26d6f2){if(_0x26d6f2){if(!fs['existsSync'](_0x26d6f2['value'])){throw new db[(_0xf296('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x26d6f2[_0xf296('0x59')]){return _0x5b2cbe['download'](_0x26d6f2['value'],_0x26d6f2[_0xf296('0x59')]+path['extname'](_0x26d6f2['value']),function(){if(_0xea2a9c){fs[_0xf296('0x5b')](_0x26d6f2['value']);}});}else{return _0x5b2cbe['download'](_0x26d6f2[_0xf296('0x52')],function(_0x2e10fe){if(_0xea2a9c){fs[_0xf296('0x5b')](_0x26d6f2[_0xf296('0x52')]);}});}}})[_0xf296('0x46')](handleError(_0x5b2cbe,null));};exports[_0xf296('0x25')]=function(_0xa77d4b,_0x3663f6){return db[_0xf296('0x2b')][_0xf296('0x49')]({'where':{'id':_0xa77d4b[_0xf296('0x4c')]['id']}})[_0xf296('0x24')](function(_0x533d8e){if(!_0x533d8e)throw new ReferenceError(_0xf296('0x65'));return _0x533d8e;})['then'](function(_0x242cd3){var _0x48bda5=_0x242cd3['value'];logger['info'](_0xf296('0x66'),_0x48bda5);if(!_['isNil'](_0x242cd3[_0xf296('0x52')])&&fs['existsSync'](_0x48bda5)){logger[_0xf296('0x67')](_0xf296('0x68')+_0x48bda5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf296('0x69')](_0x48bda5);}_0x48bda5=_0x48bda5+_0xf296('0x6a');if(!_['isNil'](_0x242cd3[_0xf296('0x52')])&&fs[_0xf296('0x53')](_0x48bda5)){logger[_0xf296('0x67')](_0xf296('0x68')+_0x48bda5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf296('0x69')](_0x48bda5);}return _0x242cd3;})['then'](function(_0x373c83){if(!_0x373c83)throw new InternalError();return _0x373c83[_0xf296('0x25')]();})[_0xf296('0x24')](function(){_0x3663f6[_0xf296('0x1a')](0xcc)[_0xf296('0x1b')]();})['catch'](handleError(_0x3663f6,null));};function getBucketslist(_0x1a5039,_0x5770a6,_0x46d1b9){return new Promise(function(_0x29cded,_0x2623cc){var _0x272145=new AWS['S3']({'accessKeyId':_0x5770a6,'secretAccessKey':_0x1a5039,'region':_0x46d1b9});_0x272145['listBuckets']({},function(_0x2eb7d7,_0x2cdce7){if(_0x2eb7d7){return _0x2623cc(_0x2eb7d7);}else{return _0x29cded(_0x2cdce7);}});});}function createBucket(_0x3a584d,_0xa1e180,_0x54c946,_0x5cd5fe){return new Promise(function(_0xde7b9c,_0x253021){var _0xba6294=new AWS['S3']({'accessKeyId':_0xa1e180,'secretAccessKey':_0x3a584d,'region':_0x54c946});_0xba6294[_0xf296('0x6b')]({'Bucket':_0x5cd5fe},function(_0x55d9e2,_0x1830da){if(_0x55d9e2){return _0x253021(_0x55d9e2);}else{return _0xde7b9c(_0x1830da);}});});}function uploadFile(_0x3d37c9,_0x564c8d,_0xfa0560,_0xae2f84,_0x5a3752,_0x5c7ba2){return new Promise(function(_0x2af879,_0x38ccd2){var _0x5529e5=new AWS['S3']({'accessKeyId':_0x564c8d,'secretAccessKey':_0x3d37c9,'region':_0xfa0560});_0x5529e5[_0xf296('0x6c')]({'Bucket':_0xae2f84,'Key':_0x5a3752,'Body':_0x5c7ba2},function(_0x2bf24,_0x2220bf){if(_0x2bf24){return _0x38ccd2(_0x2bf24);}else{return _0x2af879(_0x2220bf);}});});}function startTranscribe(_0x332ee1,_0x5e74c3,_0x16eeac,_0x4d36f5,_0x12d39d,_0x231d21){return new Promise(function(_0x515677,_0x1d76a7){var _0x194d14=new AWS[(_0xf296('0x6d'))]({'accessKeyId':_0x5e74c3,'secretAccessKey':_0x332ee1,'region':_0x16eeac});_0x194d14[_0xf296('0x6e')]({'TranscriptionJobName':_0x4d36f5,'LanguageCode':_0x12d39d,'Media':{'MediaFileUri':_0x231d21}},function(_0xf1ec1d,_0x5a28cd){if(_0xf1ec1d){return _0x1d76a7(_0xf1ec1d);}else{return _0x515677(_0x5a28cd);}});});}function transcribe(_0x45c8f2,_0x5895db,_0x99ec91,_0x2aa11f,_0x5d3972,_0x387f7b,_0x1df787){return new Promise(function(_0x49902e,_0x3ea093){var _0x587b02={};logger[_0xf296('0x67')](util[_0xf296('0x31')](_0xf296('0x6f'),_0x45c8f2,_0x5d3972));return uploadFile(_0x5895db,_0x99ec91,_0x2aa11f,_0x5d3972,path[_0xf296('0x70')](_0x387f7b),fs['readFileSync'](_0x387f7b))[_0xf296('0x24')](function(_0x1e2cd9){logger['info'](util['format'](_0xf296('0x71'),_0x45c8f2,_0x5d3972,_0x1e2cd9[_0xf296('0x72')]));_0x587b02[_0xf296('0x73')]=_0x1e2cd9[_0xf296('0x74')];_0x587b02['location']=_0x1e2cd9[_0xf296('0x72')];logger[_0xf296('0x67')](util[_0xf296('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x45c8f2));return startTranscribe(_0x5895db,_0x99ec91,_0x2aa11f,uuidv4(),_0x1df787,_0x1e2cd9[_0xf296('0x72')]);})[_0xf296('0x24')](function(_0x5e7e60){logger['info'](util[_0xf296('0x31')](_0xf296('0x75'),_0x45c8f2,_0x5e7e60[_0xf296('0x76')][_0xf296('0x77')]));_0x587b02['transcribeName']=_0x5e7e60['TranscriptionJob'][_0xf296('0x77')];_0x587b02['transcribeStatus']=_0x5e7e60['TranscriptionJob']['TranscriptionJobStatus'];return _0x49902e(_0x587b02);})['catch'](function(_0x8a7170){return _0x3ea093(_0x8a7170);});});}exports[_0xf296('0x78')]=function(_0x4de85d,_0x188155,_0x46b1e7){var _0x4e7b1c;var _0x175206;var _0x896fe4;var _0x410140=require(_0xf296('0x4f'));return db[_0xf296('0x2b')][_0xf296('0x79')]({'where':{'id':_0x4de85d['params']['id']}})['then'](function(_0x571514){if(_0x571514){var _0x447054=util[_0xf296('0x31')](_0xf296('0x7a'),_0x571514[_0xf296('0x52')]);if(fs[_0xf296('0x53')](_0x447054)){cypher=!![];return _0x410140['decryptFile'](_0x447054,_0x571514[_0xf296('0x52')],config[_0xf296('0x55')][_0xf296('0x56')])['then'](function(){return _0x571514;});}return _0x571514;}})[_0xf296('0x24')](function(_0x30838c){if(!_0x30838c){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))](_0xf296('0x7b'));}_0x175206=_0x30838c;return db['Setting'][_0xf296('0x79')]({'where':{'id':0x1}});})[_0xf296('0x24')](handleEntityNotFound(_0x188155,null))['then'](function(_0xc68666){if(_0xc68666){_0x4e7b1c=_0xc68666;if(!_0x4e7b1c[_0xf296('0x7c')]||!_0x4e7b1c[_0xf296('0x7d')]||!_0x4e7b1c[_0xf296('0x7e')]||!_0x4e7b1c[_0xf296('0x7f')]||!_0x4e7b1c[_0xf296('0x73')]){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))]('Transcribe\x20not\x20configured');}if(_0x4de85d[_0xf296('0x4b')]['runSentiment']&&(!_0x4e7b1c['sentiment']||!_0x4e7b1c[_0xf296('0x80')]||!_0x4e7b1c[_0xf296('0x81')]||!_0x4e7b1c['language']||!_0x4e7b1c[_0xf296('0x73')])){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xf296('0x82')][_0xf296('0x79')]({'where':{'id':_0x4e7b1c[_0xf296('0x7d')]}});}})[_0xf296('0x24')](function(_0xad9d3b){if(!_0xad9d3b){throw new db['Sequelize'][(_0xf296('0x58'))](_0xf296('0x83'));}if(!_0xad9d3b['data1']||!_0xad9d3b[_0xf296('0x84')]){throw new db[(_0xf296('0x57'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x896fe4=_0xad9d3b;return getBucketslist(_0x896fe4[_0xf296('0x85')],_0x896fe4[_0xf296('0x84')],_0x4e7b1c[_0xf296('0x7e')]);})[_0xf296('0x24')](function(_0x1a1e58){if(_0x1a1e58&&_0x1a1e58[_0xf296('0x86')]){var _0x519135=_[_0xf296('0x49')](_0x1a1e58['Buckets'],function(_0xd0e6fd){return _0xd0e6fd[_0xf296('0x87')]===_0x4e7b1c['bucket'];});if(!_0x519135){logger[_0xf296('0x67')](util[_0xf296('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4de85d[_0xf296('0x4c')]['id'],_0x4e7b1c['bucket']));return createBucket(_0x896fe4[_0xf296('0x85')],_0x896fe4[_0xf296('0x84')],_0x4e7b1c[_0xf296('0x7e')],_0x4e7b1c[_0xf296('0x73')]);}logger[_0xf296('0x67')](util[_0xf296('0x31')](_0xf296('0x88'),_0x4de85d['params']['id'],_0x4e7b1c['bucket']));return;}})[_0xf296('0x24')](function(_0x371e18){if(_0x175206['transcribeStatus']===_0xf296('0x89')){return transcribe(_0x4de85d['params']['id'],_0x896fe4[_0xf296('0x85')],_0x896fe4['data2'],_0x4e7b1c[_0xf296('0x7e')],_0x4e7b1c['bucket'],_0x175206['value'],_0x4e7b1c['language']);}else{logger[_0xf296('0x67')](util[_0xf296('0x31')](_0xf296('0x8a'),_0x4de85d[_0xf296('0x4c')]['id']));return{'transcribeStatus':_0xf296('0x8b')};}})[_0xf296('0x24')](function(_0x5c1304){if(_0x5c1304){_0x5c1304[_0xf296('0x8c')]=_0x4de85d[_0xf296('0x4b')][_0xf296('0x8d')];return _0x175206['updateAttributes'](_0x5c1304);}})[_0xf296('0x24')](respondWithResult(_0x188155,null))[_0xf296('0x46')](handleError(_0x188155,null));};function writeFile(_0x37b964,_0x550764){return new Promise(function(_0x749987,_0x1ca448){fs[_0xf296('0x8e')](_0x550764,_0x37b964,function(_0x14af32,_0x2ff595){if(_0x14af32){return _0x1ca448(_0x14af32);}else{return _0x749987(_0x2ff595);}});});}exports[_0xf296('0x8f')]=function(_0x4cf84a,_0xb86a13,_0x35f5f8){return db[_0xf296('0x2b')][_0xf296('0x79')]({'where':{'id':_0x4cf84a['params']['id']}})[_0xf296('0x24')](handleEntityNotFound(_0xb86a13))[_0xf296('0x24')](function(_0x4f1f39){if(_0x4f1f39&&_0x4f1f39[_0xf296('0x90')]){var _0x407445=_0x4f1f39[_0xf296('0x90')];var _0x3ab805=config[_0xf296('0x91')]+_0xf296('0x92')+_0x4f1f39['id']+'.txt';if(fs[_0xf296('0x53')](_0x3ab805)){return _0x3ab805;}return writeFile(_0x407445,_0x3ab805)[_0xf296('0x24')](function(){return _0x3ab805;});}else{throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))](_0xf296('0x93'));}})['then'](function(_0xfba1cf){return _0xb86a13[_0xf296('0x4e')](_0xfba1cf);})[_0xf296('0x46')](handleError(_0xb86a13));}; \ No newline at end of file +var _0x01bc=['transcribeName','transcribeStatus','findOne','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes','fieldName','key','model','differenceBy','map','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','ValidationError','filename','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','destroy','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName'];(function(_0x14fe3,_0x5f2668){var _0x322bd5=function(_0x15a4ba){while(--_0x15a4ba){_0x14fe3['push'](_0x14fe3['shift']());}};_0x322bd5(++_0x5f2668);}(_0x01bc,0x152));var _0xc01b=function(_0x959da5,_0x3f82c9){_0x959da5=_0x959da5-0x0;var _0x17ac64=_0x01bc[_0x959da5];return _0x17ac64;};'use strict';var pdf=require(_0xc01b('0x0'));var emlformat=require(_0xc01b('0x1'));var rimraf=require(_0xc01b('0x2'));var zipdir=require(_0xc01b('0x3'));var jsonpatch=require(_0xc01b('0x4'));var rp=require(_0xc01b('0x5'));var moment=require('moment');var BPromise=require(_0xc01b('0x6'));var Mustache=require(_0xc01b('0x7'));var util=require(_0xc01b('0x8'));var path=require(_0xc01b('0x9'));var sox=require(_0xc01b('0xa'));var csv=require('to-csv');var ejs=require(_0xc01b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc01b('0xc'));var crypto=require(_0xc01b('0xd'));var jsforce=require(_0xc01b('0xe'));var deskjs=require(_0xc01b('0xf'));var toCsv=require(_0xc01b('0x10'));var querystring=require('querystring');var Papa=require(_0xc01b('0x11'));var AWS=require(_0xc01b('0x12'));var uuidv4=require(_0xc01b('0x13'));var Redis=require(_0xc01b('0x14'));var authService=require(_0xc01b('0x15'));var qs=require(_0xc01b('0x16'));var as=require(_0xc01b('0x17'));var hardwareService=require(_0xc01b('0x18'));var logger=require(_0xc01b('0x19'))('api');var utils=require(_0xc01b('0x1a'));var config=require(_0xc01b('0x1b'));var db=require(_0xc01b('0x1c'))['db'];function respondWithStatusCode(_0x455acd,_0x5b5545){_0x5b5545=_0x5b5545||0xcc;return function(_0x189dbe){if(_0x189dbe){return _0x455acd[_0xc01b('0x1d')](_0x5b5545);}return _0x455acd[_0xc01b('0x1e')](_0x5b5545)[_0xc01b('0x1f')]();};}function respondWithResult(_0x2ff479,_0x5ea7ce){_0x5ea7ce=_0x5ea7ce||0xc8;return function(_0x3940cd){if(_0x3940cd){return _0x2ff479['status'](_0x5ea7ce)[_0xc01b('0x20')](_0x3940cd);}};}function respondWithFilteredResult(_0x3721e4,_0x2459da){return function(_0x571278){if(_0x571278){var _0x5c8815=_0x571278[_0xc01b('0x21')],_0x46dd4f=_0x2459da[_0xc01b('0x22')],_0x28bb64=_0x2459da[_0xc01b('0x22')]+_0x2459da['limit'],_0x2bba57;if(_0x28bb64>=_0x5c8815){_0x28bb64=_0x5c8815;_0x2bba57=0xc8;}else{_0x2bba57=0xce;}_0x3721e4[_0xc01b('0x1e')](_0x2bba57);return _0x3721e4[_0xc01b('0x23')](_0xc01b('0x24'),_0x46dd4f+'-'+_0x28bb64+'/'+_0x5c8815)[_0xc01b('0x20')](_0x571278);}return null;};}function patchUpdates(_0x46008b){return function(_0x548838){try{jsonpatch[_0xc01b('0x25')](_0x548838,_0x46008b,!![]);}catch(_0x121190){return BPromise[_0xc01b('0x26')](_0x121190);}return _0x548838[_0xc01b('0x27')]();};}function saveUpdates(_0x5b6cc6,_0x5bed46){return function(_0x1f9409){if(_0x1f9409){return _0x1f9409[_0xc01b('0x28')](_0x5b6cc6)[_0xc01b('0x29')](function(_0x5151cb){return _0x5151cb;});}return null;};}function removeEntity(_0x85661a,_0x44d86c){return function(_0x3e856a){if(_0x3e856a){return _0x3e856a['destroy']()[_0xc01b('0x29')](function(){_0x85661a[_0xc01b('0x1e')](0xcc)[_0xc01b('0x1f')]();});}};}function handleEntityNotFound(_0x2b9c48,_0x2935e6){return function(_0x19dfbf){if(!_0x19dfbf){_0x2b9c48['sendStatus'](0x194);}return _0x19dfbf;};}function handleError(_0x2fba5a,_0x208078){_0x208078=_0x208078||0x1f4;return function(_0x4323c6){logger['error'](_0x4323c6[_0xc01b('0x2a')]);if(_0x4323c6[_0xc01b('0x2b')]){delete _0x4323c6[_0xc01b('0x2b')];}_0x2fba5a[_0xc01b('0x1e')](_0x208078)[_0xc01b('0x2c')](_0x4323c6);};}exports[_0xc01b('0x2d')]=function(_0x59f1aa,_0x3bfa9b){var _0x4a4b2f={},_0x130886={},_0x4c709d={'count':0x0,'rows':[]};var _0xebaea5=_['map'](db['VoiceRecording'][_0xc01b('0x2e')],function(_0x12c3e6){return{'name':_0x12c3e6[_0xc01b('0x2f')],'type':_0x12c3e6['type'][_0xc01b('0x30')]};});_0x130886[_0xc01b('0x31')]=_[_0xc01b('0x32')](_[_0xc01b('0x33')](_0xebaea5,_0xc01b('0x2b')),[_0xc01b('0x34')]);_0x130886[_0xc01b('0x35')]=_[_0xc01b('0x36')](_0x59f1aa[_0xc01b('0x35')]);_0x130886[_0xc01b('0x37')]=_[_0xc01b('0x38')](_0x130886[_0xc01b('0x31')],_0x130886[_0xc01b('0x35')]);_0x4a4b2f['attributes']=_[_0xc01b('0x38')](_0x130886['model'],qs[_0xc01b('0x39')](_0x59f1aa[_0xc01b('0x35')][_0xc01b('0x39')]));_0x4a4b2f[_0xc01b('0x3a')]=_0x4a4b2f[_0xc01b('0x3a')]['length']?_0x4a4b2f[_0xc01b('0x3a')]:_0x130886[_0xc01b('0x31')];if(!_0x59f1aa[_0xc01b('0x35')][_0xc01b('0x3b')](_0xc01b('0x3c'))){_0x4a4b2f['limit']=qs[_0xc01b('0x3d')](_0x59f1aa['query'][_0xc01b('0x3d')]);_0x4a4b2f[_0xc01b('0x22')]=qs[_0xc01b('0x22')](_0x59f1aa[_0xc01b('0x35')]['offset']);}_0x4a4b2f[_0xc01b('0x3e')]=qs[_0xc01b('0x3f')](_0x59f1aa[_0xc01b('0x35')]['sort']);_0x4a4b2f[_0xc01b('0x40')]=qs[_0xc01b('0x37')](_[_0xc01b('0x41')](_0x59f1aa[_0xc01b('0x35')],_0x130886['filters']),_0xebaea5);if(_0x59f1aa['query']['filter']){_0x4a4b2f['where']=_[_0xc01b('0x42')](_0x4a4b2f[_0xc01b('0x40')],{'$or':_[_0xc01b('0x33')](_0xebaea5,function(_0x427885){if(_0x427885[_0xc01b('0x43')]!==_0xc01b('0x44')){var _0x3012d5={};_0x3012d5[_0x427885[_0xc01b('0x2b')]]={'$like':'%'+_0x59f1aa['query'][_0xc01b('0x45')]+'%'};return _0x3012d5;}})});}_0x4a4b2f=_[_0xc01b('0x42')]({},_0x4a4b2f,_0x59f1aa[_0xc01b('0x46')]);var _0x3efe6f={'where':_0x4a4b2f[_0xc01b('0x40')]};return db[_0xc01b('0x47')][_0xc01b('0x21')](_0x3efe6f)[_0xc01b('0x29')](function(_0x53fa89){_0x4c709d[_0xc01b('0x21')]=_0x53fa89;if(_0x59f1aa[_0xc01b('0x35')][_0xc01b('0x48')]){_0x4a4b2f[_0xc01b('0x49')]=[{'all':!![]}];}return db[_0xc01b('0x47')][_0xc01b('0x4a')](_0x4a4b2f);})[_0xc01b('0x29')](function(_0x45b6e5){_0x4c709d[_0xc01b('0x4b')]=_0x45b6e5;return _0x4c709d;})[_0xc01b('0x29')](respondWithFilteredResult(_0x3bfa9b,_0x4a4b2f))[_0xc01b('0x4c')](handleError(_0x3bfa9b,null));};exports[_0xc01b('0x4d')]=function(_0x3655b7,_0x3c27de){var _0xe24274={'raw':![],'where':{'id':_0x3655b7[_0xc01b('0x4e')]['id']}},_0x214d14={};_0x214d14['model']=_[_0xc01b('0x36')](db[_0xc01b('0x47')][_0xc01b('0x2e')]);_0x214d14['query']=_[_0xc01b('0x36')](_0x3655b7[_0xc01b('0x35')]);_0x214d14['filters']=_[_0xc01b('0x38')](_0x214d14[_0xc01b('0x31')],_0x214d14[_0xc01b('0x35')]);_0xe24274[_0xc01b('0x3a')]=_['intersection'](_0x214d14['model'],qs[_0xc01b('0x39')](_0x3655b7['query'][_0xc01b('0x39')]));_0xe24274[_0xc01b('0x3a')]=_0xe24274['attributes']['length']?_0xe24274[_0xc01b('0x3a')]:_0x214d14[_0xc01b('0x31')];if(_0x3655b7[_0xc01b('0x35')]['includeAll']){_0xe24274[_0xc01b('0x49')]=[{'all':!![]}];}_0xe24274=_[_0xc01b('0x42')]({},_0xe24274,_0x3655b7['options']);return db[_0xc01b('0x47')][_0xc01b('0x4f')](_0xe24274)['then'](handleEntityNotFound(_0x3c27de,null))[_0xc01b('0x29')](respondWithResult(_0x3c27de,null))[_0xc01b('0x4c')](handleError(_0x3c27de,null));};exports[_0xc01b('0x50')]=function(_0x421fac,_0x4f3cac){return db[_0xc01b('0x47')]['create'](_0x421fac[_0xc01b('0x51')],{})['then'](respondWithResult(_0x4f3cac,0xc9))[_0xc01b('0x4c')](handleError(_0x4f3cac,null));};exports[_0xc01b('0x28')]=function(_0xe831fa,_0x11b45e){if(_0xe831fa['body']['id']){delete _0xe831fa[_0xc01b('0x51')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0xe831fa[_0xc01b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11b45e,null))[_0xc01b('0x29')](saveUpdates(_0xe831fa[_0xc01b('0x51')],null))[_0xc01b('0x29')](respondWithResult(_0x11b45e,null))[_0xc01b('0x4c')](handleError(_0x11b45e,null));};exports[_0xc01b('0x52')]=function(_0xd78043,_0x189d81){return db[_0xc01b('0x47')][_0xc01b('0x52')]()[_0xc01b('0x29')](respondWithResult(_0x189d81,null))[_0xc01b('0x4c')](handleError(_0x189d81,null));};exports[_0xc01b('0x53')]=function(_0x54a948,_0x54870b,_0x256858){var _0x3a92a3=require(_0xc01b('0x54'));var _0x41d513=![];var _0x52ae30={};if(_0x54a948[_0xc01b('0x35')][_0xc01b('0x43')]&&_0x54a948[_0xc01b('0x35')][_0xc01b('0x43')]===_0xc01b('0x55')){_0x52ae30['uniqueid']=_0x54a948['params']['id'];}else{_0x52ae30['id']=_0x54a948[_0xc01b('0x4e')]['id'];}return db['VoiceRecording']['find']({'where':_0x52ae30,'attributes':['id','value'],'raw':!![]})[_0xc01b('0x29')](handleEntityNotFound(_0x54870b,null))[_0xc01b('0x29')](function(_0x327c8a){if(_0x327c8a){var _0x3e5163=_0x327c8a[_0xc01b('0x56')];var _0x57dd28=util['format']('%s.cypher',_0x3e5163);if(fs[_0xc01b('0x57')](_0x57dd28)){_0x41d513=!![];return _0x3a92a3[_0xc01b('0x58')](_0x57dd28,_0x3e5163,config[_0xc01b('0x59')][_0xc01b('0x5a')])[_0xc01b('0x29')](function(){return _0x327c8a;});}return _0x327c8a;}})[_0xc01b('0x29')](function(_0x1efab4){if(_0x1efab4){var _0x13e109=_0x1efab4['value'];if(!fs['existsSync'](_0x13e109)){throw new db[(_0xc01b('0x5b'))]['ValidationError'](_0xc01b('0x5c'));}if(_0x1efab4['filename']){return _0x54870b['download'](_0x13e109,_0x1efab4['filename']+path[_0xc01b('0x5d')](_0x13e109),function(){if(_0x41d513){fs[_0xc01b('0x5e')](_0x13e109);}});}else{return _0x54870b[_0xc01b('0x53')](_0x13e109,function(_0x229f11){if(_0x41d513){fs['unlink'](_0x13e109);}});}}})[_0xc01b('0x4c')](function(_0x3bbd1d){if(_0x3bbd1d[_0xc01b('0x5f')]==='VoiceRecording\x20not\x20found'){_0x54870b[_0xc01b('0x1e')](0x194)[_0xc01b('0x2c')](_0xc01b('0x60'));}else{return handleError(_0x54870b,null);}});};exports[_0xc01b('0x61')]=function(_0x2207fa,_0x5f4572,_0x1b3a37){var _0x52adc1=require(_0xc01b('0x54'));var _0xdc61ce=![];var _0x3c7418={'$and':[db[_0xc01b('0x62')][_0xc01b('0x40')](db[_0xc01b('0x62')]['fn'](_0xc01b('0x63'),db[_0xc01b('0x62')][_0xc01b('0x64')]('uniqueid')),_0x2207fa[_0xc01b('0x35')][_0xc01b('0x65')])]};if(_0x2207fa[_0xc01b('0x35')][_0xc01b('0x43')]&&_0x2207fa[_0xc01b('0x35')][_0xc01b('0x43')]===_0xc01b('0x55')){_0x3c7418[_0xc01b('0x66')][_0xc01b('0x67')]({'uniqueid':_0x2207fa[_0xc01b('0x4e')]['id']});}else{_0x3c7418['$and']['push']({'id':_0x2207fa[_0xc01b('0x4e')]['id']});}return db[_0xc01b('0x47')]['find']({'where':_0x3c7418,'attributes':['id',_0xc01b('0x56')],'raw':!![]})[_0xc01b('0x29')](handleEntityNotFound(_0x5f4572,null))[_0xc01b('0x29')](function(_0x4d285f){if(_0x4d285f){var _0xbeef66=util[_0xc01b('0x34')](_0xc01b('0x68'),_0x4d285f[_0xc01b('0x56')]);if(fs['existsSync'](_0xbeef66)){_0xdc61ce=!![];return _0x52adc1[_0xc01b('0x58')](_0xbeef66,_0x4d285f['value'],config[_0xc01b('0x59')][_0xc01b('0x5a')])[_0xc01b('0x29')](function(){return _0x4d285f;});}return _0x4d285f;}})['then'](function(_0x17c4ed){if(_0x17c4ed){if(!fs[_0xc01b('0x57')](_0x17c4ed[_0xc01b('0x56')])){throw new db[(_0xc01b('0x5b'))][(_0xc01b('0x69'))]('VoiceRecording\x20not\x20found');}if(_0x17c4ed[_0xc01b('0x6a')]){return _0x5f4572['download'](_0x17c4ed[_0xc01b('0x56')],_0x17c4ed[_0xc01b('0x6a')]+path['extname'](_0x17c4ed[_0xc01b('0x56')]),function(){if(_0xdc61ce){fs[_0xc01b('0x5e')](_0x17c4ed[_0xc01b('0x56')]);}});}else{return _0x5f4572[_0xc01b('0x53')](_0x17c4ed[_0xc01b('0x56')],function(_0x43aab6){if(_0xdc61ce){fs[_0xc01b('0x5e')](_0x17c4ed[_0xc01b('0x56')]);}});}}})[_0xc01b('0x4c')](handleError(_0x5f4572,null));};exports['destroy']=function(_0x5cd149,_0x47e107){return db[_0xc01b('0x47')][_0xc01b('0x4f')]({'where':{'id':_0x5cd149[_0xc01b('0x4e')]['id']}})[_0xc01b('0x29')](function(_0x46f712){if(!_0x46f712)throw new ReferenceError('Entity\x20not\x20found');return _0x46f712;})['then'](function(_0x2df84b){var _0x4a3f9c=_0x2df84b[_0xc01b('0x56')];logger[_0xc01b('0x6b')](_0xc01b('0x6c'),_0x4a3f9c);if(!_[_0xc01b('0x6d')](_0x2df84b[_0xc01b('0x56')])&&fs['existsSync'](_0x4a3f9c)){logger[_0xc01b('0x6b')](_0xc01b('0x6e')+_0x4a3f9c+_0xc01b('0x6f'));fs['unlinkSync'](_0x4a3f9c);}_0x4a3f9c=_0x4a3f9c+'.cypher';if(!_[_0xc01b('0x6d')](_0x2df84b['value'])&&fs[_0xc01b('0x57')](_0x4a3f9c)){logger[_0xc01b('0x6b')]('File:\x20\x22'+_0x4a3f9c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc01b('0x70')](_0x4a3f9c);}return _0x2df84b;})[_0xc01b('0x29')](function(_0x45b2e2){if(!_0x45b2e2)throw new InternalError();return _0x45b2e2[_0xc01b('0x71')]();})[_0xc01b('0x29')](function(){_0x47e107[_0xc01b('0x1e')](0xcc)[_0xc01b('0x1f')]();})[_0xc01b('0x4c')](handleError(_0x47e107,null));};function getBucketslist(_0x2f4156,_0x57cdc2,_0x37d75e){return new Promise(function(_0x34c9cb,_0x523547){var _0x37a197=new AWS['S3']({'accessKeyId':_0x57cdc2,'secretAccessKey':_0x2f4156,'region':_0x37d75e});_0x37a197[_0xc01b('0x72')]({},function(_0x177ba2,_0x16f01e){if(_0x177ba2){return _0x523547(_0x177ba2);}else{return _0x34c9cb(_0x16f01e);}});});}function createBucket(_0x3309d4,_0x12985a,_0x2347aa,_0x234813){return new Promise(function(_0x4baf19,_0x2dffe0){var _0x9ed8f4=new AWS['S3']({'accessKeyId':_0x12985a,'secretAccessKey':_0x3309d4,'region':_0x2347aa});_0x9ed8f4[_0xc01b('0x73')]({'Bucket':_0x234813},function(_0x44eeac,_0x2e94da){if(_0x44eeac){return _0x2dffe0(_0x44eeac);}else{return _0x4baf19(_0x2e94da);}});});}function uploadFile(_0x3cc1d0,_0x43f7ec,_0x168391,_0xcfec8d,_0x23cc3b,_0x4a7fff){return new Promise(function(_0x155294,_0x15a769){var _0x1c9f32=new AWS['S3']({'accessKeyId':_0x43f7ec,'secretAccessKey':_0x3cc1d0,'region':_0x168391});_0x1c9f32[_0xc01b('0x74')]({'Bucket':_0xcfec8d,'Key':_0x23cc3b,'Body':_0x4a7fff},function(_0x1c52e5,_0x33bd24){if(_0x1c52e5){return _0x15a769(_0x1c52e5);}else{return _0x155294(_0x33bd24);}});});}function startTranscribe(_0x4e6ee9,_0x2103df,_0x55e9eb,_0x420e7e,_0xaeab82,_0x1d92c6){return new Promise(function(_0xe4be4a,_0x5a2805){var _0x13c567=new AWS['TranscribeService']({'accessKeyId':_0x2103df,'secretAccessKey':_0x4e6ee9,'region':_0x55e9eb});_0x13c567[_0xc01b('0x75')]({'TranscriptionJobName':_0x420e7e,'LanguageCode':_0xaeab82,'Media':{'MediaFileUri':_0x1d92c6}},function(_0x432b35,_0x7d7ca6){if(_0x432b35){return _0x5a2805(_0x432b35);}else{return _0xe4be4a(_0x7d7ca6);}});});}function transcribe(_0x4a6625,_0x2d8298,_0x43a0fa,_0x29117f,_0x8a353b,_0x85ab30,_0x2ded08){return new Promise(function(_0x3dc76a,_0x209a01){var _0x218bfd={};logger['info'](util[_0xc01b('0x34')](_0xc01b('0x76'),_0x4a6625,_0x8a353b));return uploadFile(_0x2d8298,_0x43a0fa,_0x29117f,_0x8a353b,path['basename'](_0x85ab30),fs['readFileSync'](_0x85ab30))[_0xc01b('0x29')](function(_0x113fa2){logger[_0xc01b('0x6b')](util[_0xc01b('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4a6625,_0x8a353b,_0x113fa2[_0xc01b('0x77')]));_0x218bfd[_0xc01b('0x78')]=_0x113fa2[_0xc01b('0x79')];_0x218bfd[_0xc01b('0x7a')]=_0x113fa2[_0xc01b('0x77')];logger[_0xc01b('0x6b')](util[_0xc01b('0x34')](_0xc01b('0x7b'),_0x4a6625));return startTranscribe(_0x2d8298,_0x43a0fa,_0x29117f,uuidv4(),_0x2ded08,_0x113fa2['Location']);})[_0xc01b('0x29')](function(_0x530ea3){logger[_0xc01b('0x6b')](util[_0xc01b('0x34')](_0xc01b('0x7c'),_0x4a6625,_0x530ea3[_0xc01b('0x7d')][_0xc01b('0x7e')]));_0x218bfd[_0xc01b('0x7f')]=_0x530ea3[_0xc01b('0x7d')][_0xc01b('0x7e')];_0x218bfd[_0xc01b('0x80')]=_0x530ea3['TranscriptionJob']['TranscriptionJobStatus'];return _0x3dc76a(_0x218bfd);})[_0xc01b('0x4c')](function(_0x1511f3){return _0x209a01(_0x1511f3);});});}exports['runTranscribe']=function(_0x430bfe,_0x1d2698,_0x36bd87){var _0xb81fc8;var _0x2935e1;var _0x181856;var _0x2f42a5=require(_0xc01b('0x54'));return db['VoiceRecording'][_0xc01b('0x81')]({'where':{'id':_0x430bfe['params']['id']}})[_0xc01b('0x29')](function(_0x569f54){if(_0x569f54){var _0x47d8f4=util[_0xc01b('0x34')](_0xc01b('0x68'),_0x569f54[_0xc01b('0x56')]);if(fs[_0xc01b('0x57')](_0x47d8f4)){cypher=!![];return _0x2f42a5[_0xc01b('0x58')](_0x47d8f4,_0x569f54[_0xc01b('0x56')],config[_0xc01b('0x59')][_0xc01b('0x5a')])[_0xc01b('0x29')](function(){return _0x569f54;});}return _0x569f54;}})['then'](function(_0x204caf){if(!_0x204caf){throw new db[(_0xc01b('0x5b'))][(_0xc01b('0x69'))]('Voice\x20Recording\x20not\x20found');}_0x2935e1=_0x204caf;return db[_0xc01b('0x82')]['findOne']({'where':{'id':0x1}});})[_0xc01b('0x29')](handleEntityNotFound(_0x1d2698,null))[_0xc01b('0x29')](function(_0x55c047){if(_0x55c047){_0xb81fc8=_0x55c047;if(!_0xb81fc8['transcribe']||!_0xb81fc8[_0xc01b('0x83')]||!_0xb81fc8[_0xc01b('0x84')]||!_0xb81fc8['language']||!_0xb81fc8[_0xc01b('0x78')]){throw new db[(_0xc01b('0x5b'))][(_0xc01b('0x69'))](_0xc01b('0x85'));}if(_0x430bfe[_0xc01b('0x51')]['runSentiment']&&(!_0xb81fc8[_0xc01b('0x86')]||!_0xb81fc8['sentimentAccountId']||!_0xb81fc8[_0xc01b('0x87')]||!_0xb81fc8[_0xc01b('0x88')]||!_0xb81fc8[_0xc01b('0x78')])){throw new db[(_0xc01b('0x5b'))][(_0xc01b('0x69'))](_0xc01b('0x89'));}return db[_0xc01b('0x8a')]['findOne']({'where':{'id':_0xb81fc8[_0xc01b('0x83')]}});}})['then'](function(_0x4df370){if(!_0x4df370){throw new db['Sequelize'][(_0xc01b('0x69'))](_0xc01b('0x8b'));}if(!_0x4df370[_0xc01b('0x8c')]||!_0x4df370[_0xc01b('0x8d')]){throw new db[(_0xc01b('0x5b'))]['ValidationError'](_0xc01b('0x8e'));}_0x181856=_0x4df370;return getBucketslist(_0x181856[_0xc01b('0x8c')],_0x181856[_0xc01b('0x8d')],_0xb81fc8[_0xc01b('0x84')]);})[_0xc01b('0x29')](function(_0x5bd2c6){if(_0x5bd2c6&&_0x5bd2c6[_0xc01b('0x8f')]){var _0x5dde6d=_[_0xc01b('0x4f')](_0x5bd2c6[_0xc01b('0x8f')],function(_0x552360){return _0x552360[_0xc01b('0x90')]===_0xb81fc8[_0xc01b('0x78')];});if(!_0x5dde6d){logger[_0xc01b('0x6b')](util[_0xc01b('0x34')](_0xc01b('0x91'),_0x430bfe[_0xc01b('0x4e')]['id'],_0xb81fc8[_0xc01b('0x78')]));return createBucket(_0x181856[_0xc01b('0x8c')],_0x181856['data2'],_0xb81fc8[_0xc01b('0x84')],_0xb81fc8[_0xc01b('0x78')]);}logger[_0xc01b('0x6b')](util[_0xc01b('0x34')](_0xc01b('0x92'),_0x430bfe['params']['id'],_0xb81fc8[_0xc01b('0x78')]));return;}})[_0xc01b('0x29')](function(_0x586736){if(_0x2935e1[_0xc01b('0x80')]===_0xc01b('0x93')){return transcribe(_0x430bfe[_0xc01b('0x4e')]['id'],_0x181856['data1'],_0x181856['data2'],_0xb81fc8[_0xc01b('0x84')],_0xb81fc8[_0xc01b('0x78')],_0x2935e1[_0xc01b('0x56')],_0xb81fc8['language']);}else{logger[_0xc01b('0x6b')](util[_0xc01b('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x430bfe[_0xc01b('0x4e')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xc01b('0x29')](function(_0x37a234){if(_0x37a234){_0x37a234[_0xc01b('0x94')]=_0x430bfe[_0xc01b('0x51')]['runSentiment'];return _0x2935e1[_0xc01b('0x95')](_0x37a234);}})[_0xc01b('0x29')](respondWithResult(_0x1d2698,null))[_0xc01b('0x4c')](handleError(_0x1d2698,null));};function writeFile(_0xa71fdd,_0x14d17e){return new Promise(function(_0x3055eb,_0x5bbbec){fs[_0xc01b('0x96')](_0x14d17e,_0xa71fdd,function(_0x4bbec4,_0x22bcea){if(_0x4bbec4){return _0x5bbbec(_0x4bbec4);}else{return _0x3055eb(_0x22bcea);}});});}exports[_0xc01b('0x97')]=function(_0x40f68f,_0x3c97d4,_0x21e358){return db['VoiceRecording'][_0xc01b('0x81')]({'where':{'id':_0x40f68f[_0xc01b('0x4e')]['id']}})[_0xc01b('0x29')](handleEntityNotFound(_0x3c97d4))[_0xc01b('0x29')](function(_0x1142f4){if(_0x1142f4&&_0x1142f4[_0xc01b('0x98')]){var _0x3e2a60=_0x1142f4[_0xc01b('0x98')];var _0x1a0339=config[_0xc01b('0x99')]+_0xc01b('0x9a')+_0x1142f4['id']+'.txt';if(fs['existsSync'](_0x1a0339)){return _0x1a0339;}return writeFile(_0x3e2a60,_0x1a0339)['then'](function(){return _0x1a0339;});}else{throw new db['Sequelize'][(_0xc01b('0x69'))]('Transcript\x20not\x20available');}})['then'](function(_0xe0d7e1){return _0x3c97d4[_0xc01b('0x53')](_0xe0d7e1);})[_0xc01b('0x4c')](handleError(_0x3c97d4));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index dd5d014..bb5c437 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 _0xa23f=['define','voice_recordings','uniqueid','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa23f,0x7c));var _0xfa23=function(_0x3475d3,_0x213e5f){_0x3475d3=_0x3475d3-0x0;var _0x78afb8=_0xa23f[_0x3475d3];return _0x78afb8;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa23('0x2'));var BPromise=require(_0xfa23('0x3'));var rp=require(_0xfa23('0x4'));var fs=require('fs');var path=require(_0xfa23('0x5'));var rimraf=require('rimraf');var config=require(_0xfa23('0x6'));var attributes=require('./voiceRecording.attributes');module[_0xfa23('0x7')]=function(_0x2df2f5,_0x4c3f4){return _0x2df2f5[_0xfa23('0x8')]('VoiceRecording',attributes,{'tableName':_0xfa23('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfa23('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e24=['request-promise','path','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xf2d9f2,_0x29743b){var _0x5ea1ba=function(_0xeb569b){while(--_0xeb569b){_0xf2d9f2['push'](_0xf2d9f2['shift']());}};_0x5ea1ba(++_0x29743b);}(_0x3e24,0x167));var _0x43e2=function(_0x4f9673,_0x4313bd){_0x4f9673=_0x4f9673-0x0;var _0x337e5e=_0x3e24[_0x4f9673];return _0x337e5e;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x43e2('0xc'),'fields':[_0x43e2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 609ec21..7840f2f 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(_0x27125a,_0x252d0d){var _0x391f7a=function(_0x4068fb){while(--_0x4068fb){_0x27125a['push'](_0x27125a['shift']());}};_0x391f7a(++_0x252d0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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 2194039..04f94f0 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 _0xb4c7=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/:id','show','post'];(function(_0x2a70d4,_0x4fc86b){var _0x1040fe=function(_0x19678c){while(--_0x19678c){_0x2a70d4['push'](_0x2a70d4['shift']());}};_0x1040fe(++_0x4fc86b);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x23beac,_0x4749da){_0x23beac=_0x23beac-0x0;var _0x399aa5=_0xb4c7[_0x23beac];return _0x399aa5;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0xd')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x13')]);module[_0x7b4c('0x14')]=router; \ No newline at end of file +var _0xc1c6=['show','post','put','/:id','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x4a58b1,_0x54a49f){var _0x1b0599=function(_0x438fcf){while(--_0x438fcf){_0x4a58b1['push'](_0x4a58b1['shift']());}};_0x1b0599(++_0x54a49f);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2204a3,_0x30fac2){_0x2204a3=_0x2204a3-0x0;var _0x1529a3=_0xc1c6[_0x2204a3];return _0x1529a3;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0xa')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xb')](_0x6c1c('0xc'),auth['isAuthenticated'](),controller[_0x6c1c('0xd')]);router[_0x6c1c('0xe')](_0x6c1c('0xc'),auth[_0x6c1c('0x7')](),controller['destroy']);module[_0x6c1c('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2d63672..58f3dac 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 _0xa3b8=['STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x3d9544,_0x51ab4c){var _0x5c47ae=function(_0xc96eac){while(--_0xc96eac){_0x3d9544['push'](_0x3d9544['shift']());}};_0x5c47ae(++_0x51ab4c);}(_0xa3b8,0x105));var _0x8a3b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa3b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8a3b('0x0'));var moment=require(_0x8a3b('0x1'));module[_0x8a3b('0x2')]={'type':{'type':Sequelize[_0x8a3b('0x3')](_0x8a3b('0x4'),'attended')},'result':{'type':Sequelize[_0x8a3b('0x5')]},'transfererchannel':{'type':Sequelize[_0x8a3b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8a3b('0x5')]},'transferercalleridname':{'type':Sequelize[_0x8a3b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8a3b('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8a3b('0x5')]},'transferercontext':{'type':Sequelize[_0x8a3b('0x5')]},'transfererexten':{'type':Sequelize[_0x8a3b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8a3b('0x5')]},'transfereechannel':{'type':Sequelize[_0x8a3b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8a3b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeexten':{'type':Sequelize[_0x8a3b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8a3b('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x8a3b('0x6'),'No')},'context':{'type':Sequelize[_0x8a3b('0x5')]},'extension':{'type':Sequelize[_0x8a3b('0x5')]}}; \ No newline at end of file +var _0xcf15=['sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xcf15,0x157));var _0x5cf1=function(_0x21b9e1,_0x1bfc06){_0x21b9e1=_0x21b9e1-0x0;var _0x190111=_0xcf15[_0x21b9e1];return _0x190111;};'use strict';var Sequelize=require(_0x5cf1('0x0'));var moment=require(_0x5cf1('0x1'));module[_0x5cf1('0x2')]={'type':{'type':Sequelize[_0x5cf1('0x3')](_0x5cf1('0x4'),_0x5cf1('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x5cf1('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x5cf1('0x6')]},'transferercontext':{'type':Sequelize[_0x5cf1('0x6')]},'transfererexten':{'type':Sequelize[_0x5cf1('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x5cf1('0x6')]},'transfereechannel':{'type':Sequelize[_0x5cf1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x5cf1('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x5cf1('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5cf1('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5cf1('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x5cf1('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x5cf1('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x5cf1('0x6')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x5cf1('0x6')]},'extension':{'type':Sequelize[_0x5cf1('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 75000f3..872b941 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 _0xc42b=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','then','destroy','end','error','stack','send','index','map','VoiceTransferReport','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','update','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf334f5,_0x5a708a){var _0x1009d0=function(_0x5979d0){while(--_0x5979d0){_0xf334f5['push'](_0xf334f5['shift']());}};_0x1009d0(++_0x5a708a);}(_0xc42b,0x109));var _0xbc42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc42b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbc42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc42('0x1'));var rp=require(_0xbc42('0x2'));var moment=require('moment');var BPromise=require(_0xbc42('0x3'));var Mustache=require(_0xbc42('0x4'));var util=require(_0xbc42('0x5'));var path=require(_0xbc42('0x6'));var sox=require('sox');var csv=require(_0xbc42('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbc42('0x8'));var crypto=require(_0xbc42('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbc42('0xa'));var toCsv=require(_0xbc42('0x7'));var querystring=require('querystring');var Papa=require(_0xbc42('0xb'));var Redis=require('ioredis');var authService=require(_0xbc42('0xc'));var qs=require(_0xbc42('0xd'));var as=require(_0xbc42('0xe'));var hardwareService=require(_0xbc42('0xf'));var logger=require(_0xbc42('0x10'))(_0xbc42('0x11'));var utils=require(_0xbc42('0x12'));var config=require(_0xbc42('0x13'));var db=require(_0xbc42('0x14'))['db'];function respondWithStatusCode(_0x49d00d,_0x3ab74f){_0x3ab74f=_0x3ab74f||0xcc;return function(_0x1c1696){if(_0x1c1696){return _0x49d00d[_0xbc42('0x15')](_0x3ab74f);}return _0x49d00d[_0xbc42('0x16')](_0x3ab74f)['end']();};}function respondWithResult(_0x4ca006,_0x3d7f92){_0x3d7f92=_0x3d7f92||0xc8;return function(_0x2c0d82){if(_0x2c0d82){return _0x4ca006[_0xbc42('0x16')](_0x3d7f92)[_0xbc42('0x17')](_0x2c0d82);}};}function respondWithFilteredResult(_0x4a08a5,_0x16e3fd){return function(_0x1ad0b3){if(_0x1ad0b3){var _0x2619bf=_0x1ad0b3[_0xbc42('0x18')],_0x4baad4=_0x16e3fd[_0xbc42('0x19')],_0x555700=_0x16e3fd[_0xbc42('0x19')]+_0x16e3fd['limit'],_0x2a12b5;if(_0x555700>=_0x2619bf){_0x555700=_0x2619bf;_0x2a12b5=0xc8;}else{_0x2a12b5=0xce;}_0x4a08a5['status'](_0x2a12b5);return _0x4a08a5[_0xbc42('0x1a')](_0xbc42('0x1b'),_0x4baad4+'-'+_0x555700+'/'+_0x2619bf)[_0xbc42('0x17')](_0x1ad0b3);}return null;};}function patchUpdates(_0x93f203){return function(_0x46a0a6){try{jsonpatch[_0xbc42('0x1c')](_0x46a0a6,_0x93f203,!![]);}catch(_0x1cb6ed){return BPromise['reject'](_0x1cb6ed);}return _0x46a0a6['save']();};}function saveUpdates(_0x529323,_0x5b17ba){return function(_0x228cef){if(_0x228cef){return _0x228cef['update'](_0x529323)[_0xbc42('0x1d')](function(_0x2c308c){return _0x2c308c;});}return null;};}function removeEntity(_0xaaf132,_0x384167){return function(_0x47ea81){if(_0x47ea81){return _0x47ea81[_0xbc42('0x1e')]()[_0xbc42('0x1d')](function(){_0xaaf132['status'](0xcc)[_0xbc42('0x1f')]();});}};}function handleEntityNotFound(_0x4e839a,_0x422e09){return function(_0x1153f3){if(!_0x1153f3){_0x4e839a[_0xbc42('0x15')](0x194);}return _0x1153f3;};}function handleError(_0x20d1d1,_0x45b523){_0x45b523=_0x45b523||0x1f4;return function(_0x1e7ed6){logger[_0xbc42('0x20')](_0x1e7ed6[_0xbc42('0x21')]);if(_0x1e7ed6['name']){delete _0x1e7ed6['name'];}_0x20d1d1[_0xbc42('0x16')](_0x45b523)[_0xbc42('0x22')](_0x1e7ed6);};}exports[_0xbc42('0x23')]=function(_0x25eabf,_0x46f876){var _0x4a8c49={},_0x3efa1d={},_0x110aab={'count':0x0,'rows':[]};var _0x1f1878=_[_0xbc42('0x24')](db[_0xbc42('0x25')]['rawAttributes'],function(_0x22c84e){return{'name':_0x22c84e[_0xbc42('0x26')],'type':_0x22c84e[_0xbc42('0x27')][_0xbc42('0x28')]};});_0x3efa1d[_0xbc42('0x29')]=_[_0xbc42('0x24')](_0x1f1878,_0xbc42('0x2a'));_0x3efa1d['query']=_[_0xbc42('0x2b')](_0x25eabf[_0xbc42('0x2c')]);_0x3efa1d[_0xbc42('0x2d')]=_['intersection'](_0x3efa1d['model'],_0x3efa1d[_0xbc42('0x2c')]);_0x4a8c49[_0xbc42('0x2e')]=_[_0xbc42('0x2f')](_0x3efa1d[_0xbc42('0x29')],qs['fields'](_0x25eabf[_0xbc42('0x2c')]['fields']));_0x4a8c49[_0xbc42('0x2e')]=_0x4a8c49[_0xbc42('0x2e')][_0xbc42('0x30')]?_0x4a8c49['attributes']:_0x3efa1d[_0xbc42('0x29')];if(!_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x31')](_0xbc42('0x32'))){_0x4a8c49['limit']=qs[_0xbc42('0x33')](_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x33')]);_0x4a8c49['offset']=qs['offset'](_0x25eabf['query'][_0xbc42('0x19')]);}_0x4a8c49['order']=qs['sort'](_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x34')]);_0x4a8c49['where']=qs[_0xbc42('0x2d')](_['pick'](_0x25eabf['query'],_0x3efa1d[_0xbc42('0x2d')]),_0x1f1878);if(_0x25eabf['query'][_0xbc42('0x35')]){_0x4a8c49[_0xbc42('0x36')]=_[_0xbc42('0x37')](_0x4a8c49[_0xbc42('0x36')],{'$or':_['map'](_0x1f1878,function(_0x3bcb92){if(_0x3bcb92[_0xbc42('0x27')]!==_0xbc42('0x38')){var _0x1b1627={};_0x1b1627[_0x3bcb92[_0xbc42('0x2a')]]={'$like':'%'+_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x35')]+'%'};return _0x1b1627;}})});}_0x4a8c49=_['merge']({},_0x4a8c49,_0x25eabf[_0xbc42('0x39')]);var _0x34c1d9={'where':_0x4a8c49[_0xbc42('0x36')]};return db[_0xbc42('0x25')][_0xbc42('0x18')](_0x34c1d9)[_0xbc42('0x1d')](function(_0x48029f){_0x110aab[_0xbc42('0x18')]=_0x48029f;if(_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x3a')]){_0x4a8c49[_0xbc42('0x3b')]=[{'all':!![]}];}return db[_0xbc42('0x25')][_0xbc42('0x3c')](_0x4a8c49);})[_0xbc42('0x1d')](function(_0x4a398c){_0x110aab[_0xbc42('0x3d')]=_0x4a398c;return _0x110aab;})[_0xbc42('0x1d')](respondWithFilteredResult(_0x46f876,_0x4a8c49))[_0xbc42('0x3e')](handleError(_0x46f876,null));};exports[_0xbc42('0x3f')]=function(_0x10a51f,_0x4df378){var _0xf32110={'raw':!![],'where':{'id':_0x10a51f[_0xbc42('0x40')]['id']}},_0x1136b9={};_0x1136b9[_0xbc42('0x29')]=_[_0xbc42('0x2b')](db['VoiceTransferReport'][_0xbc42('0x41')]);_0x1136b9[_0xbc42('0x2c')]=_['keys'](_0x10a51f['query']);_0x1136b9[_0xbc42('0x2d')]=_[_0xbc42('0x2f')](_0x1136b9[_0xbc42('0x29')],_0x1136b9['query']);_0xf32110[_0xbc42('0x2e')]=_[_0xbc42('0x2f')](_0x1136b9[_0xbc42('0x29')],qs[_0xbc42('0x42')](_0x10a51f[_0xbc42('0x2c')][_0xbc42('0x42')]));_0xf32110[_0xbc42('0x2e')]=_0xf32110['attributes']['length']?_0xf32110[_0xbc42('0x2e')]:_0x1136b9['model'];if(_0x10a51f[_0xbc42('0x2c')][_0xbc42('0x3a')]){_0xf32110[_0xbc42('0x3b')]=[{'all':!![]}];}_0xf32110=_[_0xbc42('0x37')]({},_0xf32110,_0x10a51f[_0xbc42('0x39')]);return db[_0xbc42('0x25')][_0xbc42('0x43')](_0xf32110)[_0xbc42('0x1d')](handleEntityNotFound(_0x4df378,null))[_0xbc42('0x1d')](respondWithResult(_0x4df378,null))[_0xbc42('0x3e')](handleError(_0x4df378,null));};exports['create']=function(_0x3232e5,_0x14d8dc){return db[_0xbc42('0x25')][_0xbc42('0x44')](_0x3232e5['body'],{})[_0xbc42('0x1d')](respondWithResult(_0x14d8dc,0xc9))[_0xbc42('0x3e')](handleError(_0x14d8dc,null));};exports[_0xbc42('0x45')]=function(_0x4871b2,_0x295d6d){if(_0x4871b2[_0xbc42('0x46')]['id']){delete _0x4871b2[_0xbc42('0x46')]['id'];}return db[_0xbc42('0x25')][_0xbc42('0x43')]({'where':{'id':_0x4871b2[_0xbc42('0x40')]['id']}})[_0xbc42('0x1d')](handleEntityNotFound(_0x295d6d,null))['then'](saveUpdates(_0x4871b2[_0xbc42('0x46')],null))[_0xbc42('0x1d')](respondWithResult(_0x295d6d,null))[_0xbc42('0x3e')](handleError(_0x295d6d,null));};exports[_0xbc42('0x1e')]=function(_0x2239a8,_0x3bd77e){return db[_0xbc42('0x25')][_0xbc42('0x43')]({'where':{'id':_0x2239a8[_0xbc42('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bd77e,null))[_0xbc42('0x1d')](removeEntity(_0x3bd77e,null))['catch'](handleError(_0x3bd77e,null));}; \ No newline at end of file +var _0xf827=['error','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','filter','where','merge','VIRTUAL','options','VoiceTransferReport','rows','catch','show','includeAll','include','find','create','body','params','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','update','then'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xf827,0xb6));var _0x7f82=function(_0x440c6a,_0x14b7b2){_0x440c6a=_0x440c6a-0x0;var _0x515a7d=_0xf827[_0x440c6a];return _0x515a7d;};'use strict';var pdf=require(_0x7f82('0x0'));var emlformat=require(_0x7f82('0x1'));var rimraf=require(_0x7f82('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f82('0x3'));var rp=require(_0x7f82('0x4'));var moment=require(_0x7f82('0x5'));var BPromise=require(_0x7f82('0x6'));var Mustache=require(_0x7f82('0x7'));var util=require(_0x7f82('0x8'));var path=require(_0x7f82('0x9'));var sox=require(_0x7f82('0xa'));var csv=require(_0x7f82('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f82('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f82('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f82('0xe'));var Papa=require(_0x7f82('0xf'));var Redis=require(_0x7f82('0x10'));var authService=require(_0x7f82('0x11'));var qs=require(_0x7f82('0x12'));var as=require(_0x7f82('0x13'));var hardwareService=require(_0x7f82('0x14'));var logger=require(_0x7f82('0x15'))(_0x7f82('0x16'));var utils=require(_0x7f82('0x17'));var config=require(_0x7f82('0x18'));var db=require(_0x7f82('0x19'))['db'];function respondWithStatusCode(_0x5aae09,_0x11cd6d){_0x11cd6d=_0x11cd6d||0xcc;return function(_0x3ac8cd){if(_0x3ac8cd){return _0x5aae09[_0x7f82('0x1a')](_0x11cd6d);}return _0x5aae09[_0x7f82('0x1b')](_0x11cd6d)[_0x7f82('0x1c')]();};}function respondWithResult(_0x38a3fb,_0x4089be){_0x4089be=_0x4089be||0xc8;return function(_0x6363d2){if(_0x6363d2){return _0x38a3fb['status'](_0x4089be)[_0x7f82('0x1d')](_0x6363d2);}};}function respondWithFilteredResult(_0x3e8ec,_0x120b12){return function(_0x5f12d3){if(_0x5f12d3){var _0x5140e0=_0x5f12d3[_0x7f82('0x1e')],_0x3e858e=_0x120b12['offset'],_0x5e1579=_0x120b12['offset']+_0x120b12[_0x7f82('0x1f')],_0x3f9f79;if(_0x5e1579>=_0x5140e0){_0x5e1579=_0x5140e0;_0x3f9f79=0xc8;}else{_0x3f9f79=0xce;}_0x3e8ec[_0x7f82('0x1b')](_0x3f9f79);return _0x3e8ec[_0x7f82('0x20')](_0x7f82('0x21'),_0x3e858e+'-'+_0x5e1579+'/'+_0x5140e0)['json'](_0x5f12d3);}return null;};}function patchUpdates(_0x4ce72b){return function(_0x42d2a6){try{jsonpatch['apply'](_0x42d2a6,_0x4ce72b,!![]);}catch(_0x402265){return BPromise[_0x7f82('0x22')](_0x402265);}return _0x42d2a6['save']();};}function saveUpdates(_0x13151f,_0x463113){return function(_0x177742){if(_0x177742){return _0x177742[_0x7f82('0x23')](_0x13151f)['then'](function(_0x178d74){return _0x178d74;});}return null;};}function removeEntity(_0x418d99,_0x1526da){return function(_0x52af6a){if(_0x52af6a){return _0x52af6a['destroy']()[_0x7f82('0x24')](function(){_0x418d99[_0x7f82('0x1b')](0xcc)[_0x7f82('0x1c')]();});}};}function handleEntityNotFound(_0x528cae,_0x324da7){return function(_0x470158){if(!_0x470158){_0x528cae['sendStatus'](0x194);}return _0x470158;};}function handleError(_0x104cb0,_0x2cf028){_0x2cf028=_0x2cf028||0x1f4;return function(_0x6b3f67){logger[_0x7f82('0x25')](_0x6b3f67['stack']);if(_0x6b3f67['name']){delete _0x6b3f67['name'];}_0x104cb0[_0x7f82('0x1b')](_0x2cf028)[_0x7f82('0x26')](_0x6b3f67);};}exports[_0x7f82('0x27')]=function(_0x30d08c,_0x249959){var _0x218f4f={},_0x5da71c={},_0x2caee8={'count':0x0,'rows':[]};var _0x48865a=_[_0x7f82('0x28')](db['VoiceTransferReport'][_0x7f82('0x29')],function(_0x41519d){return{'name':_0x41519d[_0x7f82('0x2a')],'type':_0x41519d[_0x7f82('0x2b')][_0x7f82('0x2c')]};});_0x5da71c[_0x7f82('0x2d')]=_[_0x7f82('0x28')](_0x48865a,_0x7f82('0x2e'));_0x5da71c['query']=_[_0x7f82('0x2f')](_0x30d08c[_0x7f82('0x30')]);_0x5da71c[_0x7f82('0x31')]=_[_0x7f82('0x32')](_0x5da71c[_0x7f82('0x2d')],_0x5da71c['query']);_0x218f4f['attributes']=_['intersection'](_0x5da71c['model'],qs[_0x7f82('0x33')](_0x30d08c['query'][_0x7f82('0x33')]));_0x218f4f[_0x7f82('0x34')]=_0x218f4f[_0x7f82('0x34')][_0x7f82('0x35')]?_0x218f4f[_0x7f82('0x34')]:_0x5da71c[_0x7f82('0x2d')];if(!_0x30d08c[_0x7f82('0x30')][_0x7f82('0x36')](_0x7f82('0x37'))){_0x218f4f[_0x7f82('0x1f')]=qs['limit'](_0x30d08c[_0x7f82('0x30')][_0x7f82('0x1f')]);_0x218f4f['offset']=qs[_0x7f82('0x38')](_0x30d08c[_0x7f82('0x30')][_0x7f82('0x38')]);}_0x218f4f['order']=qs['sort'](_0x30d08c[_0x7f82('0x30')]['sort']);_0x218f4f['where']=qs[_0x7f82('0x31')](_['pick'](_0x30d08c[_0x7f82('0x30')],_0x5da71c[_0x7f82('0x31')]),_0x48865a);if(_0x30d08c[_0x7f82('0x30')][_0x7f82('0x39')]){_0x218f4f[_0x7f82('0x3a')]=_[_0x7f82('0x3b')](_0x218f4f[_0x7f82('0x3a')],{'$or':_['map'](_0x48865a,function(_0x6123da){if(_0x6123da['type']!==_0x7f82('0x3c')){var _0x2c6640={};_0x2c6640[_0x6123da[_0x7f82('0x2e')]]={'$like':'%'+_0x30d08c['query'][_0x7f82('0x39')]+'%'};return _0x2c6640;}})});}_0x218f4f=_[_0x7f82('0x3b')]({},_0x218f4f,_0x30d08c[_0x7f82('0x3d')]);var _0x1f3920={'where':_0x218f4f[_0x7f82('0x3a')]};return db[_0x7f82('0x3e')][_0x7f82('0x1e')](_0x1f3920)[_0x7f82('0x24')](function(_0x45f838){_0x2caee8[_0x7f82('0x1e')]=_0x45f838;if(_0x30d08c[_0x7f82('0x30')]['includeAll']){_0x218f4f['include']=[{'all':!![]}];}return db[_0x7f82('0x3e')]['findAll'](_0x218f4f);})[_0x7f82('0x24')](function(_0x2ba22f){_0x2caee8[_0x7f82('0x3f')]=_0x2ba22f;return _0x2caee8;})[_0x7f82('0x24')](respondWithFilteredResult(_0x249959,_0x218f4f))[_0x7f82('0x40')](handleError(_0x249959,null));};exports[_0x7f82('0x41')]=function(_0x6cd409,_0xe0e265){var _0x27e991={'raw':!![],'where':{'id':_0x6cd409['params']['id']}},_0x55672f={};_0x55672f[_0x7f82('0x2d')]=_['keys'](db[_0x7f82('0x3e')][_0x7f82('0x29')]);_0x55672f[_0x7f82('0x30')]=_[_0x7f82('0x2f')](_0x6cd409[_0x7f82('0x30')]);_0x55672f[_0x7f82('0x31')]=_['intersection'](_0x55672f[_0x7f82('0x2d')],_0x55672f['query']);_0x27e991[_0x7f82('0x34')]=_[_0x7f82('0x32')](_0x55672f['model'],qs[_0x7f82('0x33')](_0x6cd409[_0x7f82('0x30')]['fields']));_0x27e991[_0x7f82('0x34')]=_0x27e991['attributes'][_0x7f82('0x35')]?_0x27e991[_0x7f82('0x34')]:_0x55672f['model'];if(_0x6cd409[_0x7f82('0x30')][_0x7f82('0x42')]){_0x27e991[_0x7f82('0x43')]=[{'all':!![]}];}_0x27e991=_[_0x7f82('0x3b')]({},_0x27e991,_0x6cd409[_0x7f82('0x3d')]);return db['VoiceTransferReport'][_0x7f82('0x44')](_0x27e991)[_0x7f82('0x24')](handleEntityNotFound(_0xe0e265,null))['then'](respondWithResult(_0xe0e265,null))[_0x7f82('0x40')](handleError(_0xe0e265,null));};exports[_0x7f82('0x45')]=function(_0x2c113e,_0x24676c){return db[_0x7f82('0x3e')][_0x7f82('0x45')](_0x2c113e[_0x7f82('0x46')],{})[_0x7f82('0x24')](respondWithResult(_0x24676c,0xc9))[_0x7f82('0x40')](handleError(_0x24676c,null));};exports[_0x7f82('0x23')]=function(_0x161cd9,_0x244d11){if(_0x161cd9[_0x7f82('0x46')]['id']){delete _0x161cd9[_0x7f82('0x46')]['id'];}return db[_0x7f82('0x3e')][_0x7f82('0x44')]({'where':{'id':_0x161cd9[_0x7f82('0x47')]['id']}})['then'](handleEntityNotFound(_0x244d11,null))['then'](saveUpdates(_0x161cd9['body'],null))[_0x7f82('0x24')](respondWithResult(_0x244d11,null))[_0x7f82('0x40')](handleError(_0x244d11,null));};exports[_0x7f82('0x48')]=function(_0x50bd2b,_0x3240bc){return db[_0x7f82('0x3e')][_0x7f82('0x44')]({'where':{'id':_0x50bd2b['params']['id']}})['then'](handleEntityNotFound(_0x3240bc,null))['then'](removeEntity(_0x3240bc,null))[_0x7f82('0x40')](handleError(_0x3240bc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ddd354b..adeae26 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 _0xcf64=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','report_call_transfer','util'];(function(_0x427b2a,_0x181905){var _0x239493=function(_0x3602c6){while(--_0x3602c6){_0x427b2a['push'](_0x427b2a['shift']());}};_0x239493(++_0x181905);}(_0xcf64,0x15f));var _0x4cf6=function(_0x2ed99b,_0x230ef0){_0x2ed99b=_0x2ed99b-0x0;var _0x3e8c84=_0xcf64[_0x2ed99b];return _0x3e8c84;};'use strict';var _=require('lodash');var util=require(_0x4cf6('0x0'));var logger=require(_0x4cf6('0x1'))(_0x4cf6('0x2'));var moment=require(_0x4cf6('0x3'));var BPromise=require('bluebird');var rp=require(_0x4cf6('0x4'));var fs=require('fs');var path=require(_0x4cf6('0x5'));var rimraf=require(_0x4cf6('0x6'));var config=require(_0x4cf6('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x4cf6('0x8')]=function(_0x5ab909,_0x24474d){return _0x5ab909[_0x4cf6('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x4cf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac97=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xac97,0x14a));var _0x7ac9=function(_0x2ac149,_0x59f4c3){_0x2ac149=_0x2ac149-0x0;var _0x6e04ec=_0xac97[_0x2ac149];return _0x6e04ec;};'use strict';var _=require(_0x7ac9('0x0'));var util=require(_0x7ac9('0x1'));var logger=require(_0x7ac9('0x2'))(_0x7ac9('0x3'));var moment=require('moment');var BPromise=require(_0x7ac9('0x4'));var rp=require(_0x7ac9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ac9('0x6'));var config=require(_0x7ac9('0x7'));var attributes=require(_0x7ac9('0x8'));module[_0x7ac9('0x9')]=function(_0x381065,_0x3359a1){return _0x381065[_0x7ac9('0xa')](_0x7ac9('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index bd55f2d..70380ad 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 _0x2542=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x2542,0x1b2));var _0x2254=function(_0x1b34a9,_0x7cab18){_0x1b34a9=_0x1b34a9-0x0;var _0xf9051e=_0x2542[_0x1b34a9];return _0xf9051e;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require(_0x2254('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2254('0x5'))['db'];var utils=require(_0x2254('0x6'));var logger=require(_0x2254('0x7'))(_0x2254('0x8'));var config=require('../../config/environment');var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc813c6,_0x37cb1b,_0x1cdd49){return new BPromise(function(_0x5a4e52,_0x5bf3f3){return client[_0x2254('0xb')](_0xc813c6,_0x1cdd49)[_0x2254('0xc')](function(_0x35c44e){logger[_0x2254('0xd')](_0x2254('0xe'),_0x37cb1b,_0x2254('0xf'));logger[_0x2254('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x37cb1b,_0x2254('0xf'),JSON[_0x2254('0x11')](_0x35c44e));if(_0x35c44e[_0x2254('0x12')]){if(_0x35c44e[_0x2254('0x12')][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x37cb1b,_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);return _0x5bf3f3(_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x37cb1b,_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);return _0x5a4e52(_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x37cb1b,'request\x20sent');_0x5a4e52(_0x35c44e[_0x2254('0x15')]['message']);}})['catch'](function(_0x3001c9){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x37cb1b,_0x3001c9);_0x5bf3f3(_0x3001c9);});});}exports[_0x2254('0x16')]=function(_0x19ec72){var _0xd286b3=this;return new Promise(function(_0x262d1c,_0x325cd5){return db[_0x2254('0x17')][_0x2254('0x18')](_0x19ec72[_0x2254('0x19')],{'raw':_0x19ec72[_0x2254('0x1a')]?_0x19ec72[_0x2254('0x1a')][_0x2254('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3f895c){logger[_0x2254('0xd')]('CreateVoiceTransferReport',_0x19ec72);logger['debug'](_0x2254('0x16'),_0x19ec72,JSON[_0x2254('0x11')](_0x3f895c));_0x262d1c(_0x3f895c);})[_0x2254('0x1c')](function(_0x271347){logger[_0x2254('0x12')](_0x2254('0x16'),_0x271347['message'],_0x19ec72);_0x325cd5(_0xd286b3[_0x2254('0x12')](0x1f4,_0x271347['message']));});});}; \ No newline at end of file +var _0x6b53=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x2287b8,_0x2d7020){var _0x95e898=function(_0x315bc9){while(--_0x315bc9){_0x2287b8['push'](_0x2287b8['shift']());}};_0x95e898(++_0x2d7020);}(_0x6b53,0xc6));var _0x36b5=function(_0x44f131,_0x3dadcc){_0x44f131=_0x44f131-0x0;var _0x49ec24=_0x6b53[_0x44f131];return _0x49ec24;};'use strict';var _=require(_0x36b5('0x0'));var util=require(_0x36b5('0x1'));var moment=require(_0x36b5('0x2'));var BPromise=require(_0x36b5('0x3'));var rs=require(_0x36b5('0x4'));var fs=require('fs');var Redis=require(_0x36b5('0x5'));var db=require(_0x36b5('0x6'))['db'];var utils=require(_0x36b5('0x7'));var logger=require('../../config/logger')(_0x36b5('0x8'));var config=require(_0x36b5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x36b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf9be8c,_0x20b954,_0x161c16){return new BPromise(function(_0x4bc472,_0x6d3d5b){return client[_0x36b5('0xb')](_0xf9be8c,_0x161c16)[_0x36b5('0xc')](function(_0x5b1efe){logger[_0x36b5('0xd')](_0x36b5('0xe'),_0x20b954,'request\x20sent');logger[_0x36b5('0xf')](_0x36b5('0x10'),_0x20b954,'request\x20sent',JSON['stringify'](_0x5b1efe));if(_0x5b1efe[_0x36b5('0x11')]){if(_0x5b1efe['error'][_0x36b5('0x12')]===0x1f4){logger[_0x36b5('0x11')](_0x36b5('0xe'),_0x20b954,_0x5b1efe[_0x36b5('0x11')][_0x36b5('0x13')]);return _0x6d3d5b(_0x5b1efe[_0x36b5('0x11')]['message']);}logger[_0x36b5('0x11')](_0x36b5('0xe'),_0x20b954,_0x5b1efe[_0x36b5('0x11')]['message']);return _0x4bc472(_0x5b1efe[_0x36b5('0x11')][_0x36b5('0x13')]);}else{logger[_0x36b5('0xd')](_0x36b5('0xe'),_0x20b954,_0x36b5('0x14'));_0x4bc472(_0x5b1efe[_0x36b5('0x15')]['message']);}})[_0x36b5('0x16')](function(_0x47c7ea){logger[_0x36b5('0x11')](_0x36b5('0xe'),_0x20b954,_0x47c7ea);_0x6d3d5b(_0x47c7ea);});});}exports[_0x36b5('0x17')]=function(_0x5a991b){var _0x23d0b7=this;return new Promise(function(_0x136ab6,_0x4fbeae){return db[_0x36b5('0x18')]['create'](_0x5a991b[_0x36b5('0x19')],{'raw':_0x5a991b[_0x36b5('0x1a')]?_0x5a991b['options'][_0x36b5('0x1b')]===undefined?!![]:![]:!![]})[_0x36b5('0xc')](function(_0x39a145){logger[_0x36b5('0xd')](_0x36b5('0x17'),_0x5a991b);logger[_0x36b5('0xf')](_0x36b5('0x17'),_0x5a991b,JSON[_0x36b5('0x1c')](_0x39a145));_0x136ab6(_0x39a145);})[_0x36b5('0x16')](function(_0x2eb61d){logger[_0x36b5('0x11')](_0x36b5('0x17'),_0x2eb61d[_0x36b5('0x13')],_0x5a991b);_0x4fbeae(_0x23d0b7[_0x36b5('0x11')](0x1f4,_0x2eb61d[_0x36b5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 723c0c8..84b5c70 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 _0xfaa4=['calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate','/hangup','hangup','answer','/hold','hold','/unhold','isAuthenticated','/calls'];(function(_0x31d0e0,_0x44fe32){var _0x21407b=function(_0x4d6927){while(--_0x4d6927){_0x31d0e0['push'](_0x31d0e0['shift']());}};_0x21407b(++_0x44fe32);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x3c3c80,_0x10de81){_0x3c3c80=_0x3c3c80-0x0;var _0x489e94=_0xfaa4[_0x3c3c80];return _0x489e94;};'use strict';var express=require(_0x4faa('0x0'));var router=express[_0x4faa('0x1')]();var auth=require(_0x4faa('0x2'));var controller=require(_0x4faa('0x3'));router[_0x4faa('0x4')](_0x4faa('0x5'),auth['isAuthenticated'](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x7')]);router[_0x4faa('0x4')](_0x4faa('0x8'),auth['isAuthenticated'](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x9')]);router[_0x4faa('0x4')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4faa('0xa')]);router[_0x4faa('0x4')](_0x4faa('0xb'),auth['isAuthenticated'](),auth[_0x4faa('0x6')](),controller[_0x4faa('0xc')]);router[_0x4faa('0x4')](_0x4faa('0xd'),auth[_0x4faa('0xe')](),auth['canUpdate'](),controller['unhold']);router[_0x4faa('0x4')](_0x4faa('0xf'),auth[_0x4faa('0xe')](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x10')]);router[_0x4faa('0x4')](_0x4faa('0x11'),auth[_0x4faa('0xe')](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x12')]);module[_0x4faa('0x13')]=router; \ No newline at end of file +var _0x16e4=['answer','/hold','/unhold','unhold','/calls','/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','/hangup','hangup','/answer','isAuthenticated'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x16e4,0x97));var _0x416e=function(_0x54640c,_0x26d7b2){_0x54640c=_0x54640c-0x0;var _0x274d95=_0x16e4[_0x54640c];return _0x274d95;};'use strict';var express=require(_0x416e('0x0'));var router=express[_0x416e('0x1')]();var auth=require(_0x416e('0x2'));var controller=require(_0x416e('0x3'));router[_0x416e('0x4')](_0x416e('0x5'),auth['isAuthenticated'](),auth[_0x416e('0x6')](),controller['originate']);router[_0x416e('0x4')](_0x416e('0x7'),auth['isAuthenticated'](),auth[_0x416e('0x6')](),controller[_0x416e('0x8')]);router[_0x416e('0x4')](_0x416e('0x9'),auth[_0x416e('0xa')](),auth[_0x416e('0x6')](),controller[_0x416e('0xb')]);router[_0x416e('0x4')](_0x416e('0xc'),auth['isAuthenticated'](),auth[_0x416e('0x6')](),controller['hold']);router[_0x416e('0x4')](_0x416e('0xd'),auth[_0x416e('0xa')](),auth['canUpdate'](),controller[_0x416e('0xe')]);router[_0x416e('0x4')](_0x416e('0xf'),auth['isAuthenticated'](),auth[_0x416e('0x6')](),controller['calls']);router[_0x416e('0x4')](_0x416e('0x10'),auth[_0x416e('0xa')](),auth[_0x416e('0x6')](),controller['transfer']);module[_0x416e('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 7eb16ed..6e9a30e 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 _0x44f8=['hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','result','catch','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x44f8,0xfb));var _0x844f=function(_0x1e39fa,_0x5d7a28){_0x1e39fa=_0x1e39fa-0x0;var _0x27d1a6=_0x44f8[_0x1e39fa];return _0x27d1a6;};'use strict';var path=require(_0x844f('0x0'));var fs=require('fs');var _=require(_0x844f('0x1'));var db=require(_0x844f('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x844f('0x3'));var BPromise=require(_0x844f('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x844f('0x5')]({'port':0x232a});var logger=require(_0x844f('0x6'))(_0x844f('0x7'));var Redis=require('ioredis');config[_0x844f('0x8')]=_[_0x844f('0x9')](config[_0x844f('0x8')],{'host':_0x844f('0xa'),'port':0x18eb});var io=require(_0x844f('0xb'))(new Redis(config[_0x844f('0x8')]));var Schema=require(_0x844f('0xc'));var originateValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x844f('0xe'),'required':[!![],_0x844f('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x844f('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x844f('0x11')]},'transferNumber':{'type':'string','required':[!![],_0x844f('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x5e3653,_0x29f7b4,_0x37d26a){logger[_0x844f('0x13')](_0x5e3653,_0x29f7b4,JSON[_0x844f('0x14')](_0x37d26a));io['to'](_0x5e3653)[_0x844f('0x15')](_0x29f7b4,_0x37d26a);}function handleError(_0x5873e2){return function(_0x4d8a0a){console[_0x844f('0x16')](_0x844f('0x17'),_0x4d8a0a,_0x4d8a0a instanceof RangeError);logger['error'](_0x4d8a0a[_0x844f('0x18')]);if(_0x4d8a0a instanceof RangeError){if(_0x4d8a0a[_0x844f('0x19')]){delete _0x4d8a0a[_0x844f('0x19')];}_0x5873e2[_0x844f('0x1a')](0x194)[_0x844f('0x1b')](_0x4d8a0a);}else{if(_0x4d8a0a[_0x844f('0x19')]){delete _0x4d8a0a[_0x844f('0x19')];}_0x5873e2['status'](0x1f4)[_0x844f('0x1b')](_0x4d8a0a);}};}function checkError(){return function(_0x3ce48b){if(!_0x3ce48b){throw new RangeError(_0x844f('0x1c'));}return _0x3ce48b;};}function respondWithRpcPromise(_0x3e289d,_0x53340a){return new BPromise(function(_0x164f4e,_0x30997a){var _0x3b49e2=amiClient;return _0x3b49e2[_0x844f('0x1d')](_0x3e289d,_0x53340a)[_0x844f('0x1e')](function(_0x5cf6ab){if(_0x5cf6ab[_0x844f('0x1f')]){if(_0x5cf6ab[_0x844f('0x1f')]['code']===0x1f4){return _0x30997a(_0x5cf6ab['error']['message']);}return _0x164f4e(_0x5cf6ab[_0x844f('0x1f')]['message']);}else{_0x164f4e(_0x5cf6ab[_0x844f('0x20')]);}})[_0x844f('0x21')](function(_0xead905){_0x30997a(_0xead905);});});}function getAgent(_0x5d0811){return db['User'][_0x844f('0x22')]({'where':{'id':_0x5d0811,'role':_0x844f('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x5b9f0c,_0x202aa5){return new BPromise(function(_0x3e16f8,_0x2843ab){var _0x2ab145=respondWithRpcPromise(_0x844f('0x24'));var _0x4d316d=getAgent(_0x5b9f0c);Promise['all']([_0x2ab145,_0x4d316d])[_0x844f('0x1e')](function(_0x5b40c3){var _0x76db2a=_0x5b40c3[0x0];var _0x67c13e=_0x5b40c3[0x1];var _0x9e6cc9=_[_0x844f('0x25')](_0x76db2a[_0x844f('0x26')],function(_0x394e31){return _0x394e31[_0x844f('0x27')]==_0x67c13e['id']&&_0x394e31[_0x844f('0x28')]==_0x202aa5;});if(_0x9e6cc9[_0x844f('0x29')]==0x1){_0x3e16f8(_0x67c13e);}else{_0x2843ab(new RangeError(_0x844f('0x2a')+_0x202aa5+_0x844f('0x2b')));}});});}exports[_0x844f('0x2c')]=function(_0x583ac2,_0x429443){logger['info'](_0x844f('0x2d'),_0x583ac2[_0x844f('0x2e')]);var _0x9743a9=originateValidation['validate'](_0x583ac2['body']);if(_0x9743a9['length']>0x0){return _0x429443[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x9743a9);}var _0x51badb=_0x583ac2[_0x844f('0x2e')][_0x844f('0x30')];var _0x5061ea=_0x583ac2[_0x844f('0x2e')][_0x844f('0x31')];var _0x1c59a7=_0x583ac2['body'][_0x844f('0x32')];var _0x12fbfa=_0x583ac2['body'][_0x844f('0x33')];return getAgent(_0x51badb)[_0x844f('0x1e')](function(_0x4cca8c){logger['info'](_0x844f('0x34'),_0x4cca8c[_0x844f('0x19')]);emit(util[_0x844f('0x35')](_0x844f('0x36'),_0x4cca8c[_0x844f('0x19')]),'webbar:originate',{'callNumber':_0x5061ea,'callerId':_0x1c59a7,'callbackUrl':_0x12fbfa});return _0x429443[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':'originate\x20executed!'});})[_0x844f('0x21')](handleError(_0x429443));};exports[_0x844f('0x37')]=function(_0x3495dc,_0x28b8f3){logger[_0x844f('0x13')](_0x844f('0x38'),_0x3495dc['body']);var _0xfd26f=hangupValidation[_0x844f('0xc')](_0x3495dc['body']);if(_0xfd26f['length']>0x0){return _0x28b8f3['status'](0x190)[_0x844f('0x2f')](_0xfd26f);}var _0x3ede65=_0x3495dc[_0x844f('0x2e')][_0x844f('0x30')];var _0x5ee65c=_0x3495dc[_0x844f('0x2e')][_0x844f('0x28')];return getAgent(_0x3ede65)['then'](function(_0x46afc4){logger[_0x844f('0x13')]('entityFound:',_0x46afc4[_0x844f('0x19')]);emit(util[_0x844f('0x35')]('user:%s',_0x46afc4[_0x844f('0x19')]),_0x844f('0x39'),{'sessionId':_0x5ee65c});return _0x28b8f3[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x3a')});})['catch'](handleError(_0x28b8f3));};exports[_0x844f('0x3b')]=function(_0x53045e,_0x5dcbf1){logger[_0x844f('0x13')](_0x844f('0x3c'),_0x53045e[_0x844f('0x2e')]);var _0x55510f=answerValidation[_0x844f('0xc')](_0x53045e[_0x844f('0x2e')]);if(_0x55510f[_0x844f('0x29')]>0x0){return _0x5dcbf1['status'](0x190)['json'](_0x55510f);}var _0x481b63=_0x53045e[_0x844f('0x2e')][_0x844f('0x30')];var _0x1a3506=_0x53045e['body'][_0x844f('0x28')];return getAgent(_0x481b63)[_0x844f('0x1e')](function(_0x3edd04){logger[_0x844f('0x13')](_0x844f('0x34'),_0x3edd04[_0x844f('0x19')]);emit(util['format'](_0x844f('0x36'),_0x3edd04[_0x844f('0x19')]),_0x844f('0x3d'),{'sessionId':_0x1a3506});return _0x5dcbf1[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x3e')});})[_0x844f('0x21')](handleError(_0x5dcbf1));};exports[_0x844f('0x3f')]=function(_0xeb2d61,_0x595311){logger[_0x844f('0x13')](_0x844f('0x40'),_0xeb2d61['body']);var _0x54c351=holdValidation[_0x844f('0xc')](_0xeb2d61[_0x844f('0x2e')]);if(_0x54c351[_0x844f('0x29')]>0x0){return _0x595311[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x54c351);}var _0x465f27=_0xeb2d61['body'][_0x844f('0x30')];var _0x3317ea=_0xeb2d61[_0x844f('0x2e')][_0x844f('0x28')];return getAgent(_0x465f27)[_0x844f('0x1e')](function(_0x5ba2d2){logger['info'](_0x844f('0x34'),_0x5ba2d2[_0x844f('0x19')]);emit(util[_0x844f('0x35')]('user:%s',_0x5ba2d2[_0x844f('0x19')]),'webbar:hold',{'sessionId':_0x3317ea});return _0x595311[_0x844f('0x1a')](0xc8)['json']({'error':![],'message':_0x844f('0x41')});})['catch'](handleError(_0x595311));};exports[_0x844f('0x42')]=function(_0x3d066f,_0x111666){logger['info'](_0x844f('0x43'),_0x3d066f[_0x844f('0x2e')]);var _0xb1ee4a=unholdValidation['validate'](_0x3d066f[_0x844f('0x2e')]);if(_0xb1ee4a['length']>0x0){return _0x111666[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0xb1ee4a);}var _0x41f05e=_0x3d066f['body'][_0x844f('0x30')];var _0x14e2a7=_0x3d066f['body'][_0x844f('0x28')];return getAgent(_0x41f05e)[_0x844f('0x1e')](function(_0x4ac8cb){logger[_0x844f('0x13')](_0x844f('0x34'),_0x4ac8cb[_0x844f('0x19')]);emit(util['format'](_0x844f('0x36'),_0x4ac8cb[_0x844f('0x19')]),'webbar:unhold',{'sessionId':_0x14e2a7});return _0x111666[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x44')});})['catch'](handleError(_0x111666));};exports[_0x844f('0x45')]=function(_0x566513,_0x405557){logger[_0x844f('0x13')](_0x844f('0x46'),_0x405557[_0x844f('0x2e')]);var _0x443451=callsValidation['validate'](_0x566513['body']);if(_0x443451[_0x844f('0x29')]>0x0){return _0x405557['status'](0x190)[_0x844f('0x2f')](_0x443451);}var _0xe2ccdf=_0x566513[_0x844f('0x2e')][_0x844f('0x30')];var _0x5281bf=respondWithRpcPromise(_0x844f('0x24'));var _0x13eec2=getAgent(_0xe2ccdf);return Promise['all']([_0x5281bf,_0x13eec2])[_0x844f('0x1e')](function(_0x10a489){var _0x208be9=_0x10a489[0x0];var _0x14797a=_0x10a489[0x1];var _0x366521=_[_0x844f('0x25')](_0x208be9[_0x844f('0x26')],function(_0x3ee8d3){return _0x3ee8d3['UserId']==_0x14797a['id'];});return _0x405557[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'count':_0x366521[_0x844f('0x29')],'rows':_0x366521});})[_0x844f('0x21')](handleError(_0x405557));};exports[_0x844f('0x47')]=function(_0x1c60c1,_0x79765e){logger[_0x844f('0x13')](_0x844f('0x48'),_0x1c60c1[_0x844f('0x2e')]);var _0x58a240=conferenceValidation[_0x844f('0xc')](_0x1c60c1[_0x844f('0x2e')]);if(_0x58a240['length']>0x0){return _0x79765e[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x58a240);}var _0x187a76=_0x1c60c1[_0x844f('0x2e')][_0x844f('0x30')];return getAgent(_0x187a76)['then'](function(_0x3ea4d3){logger[_0x844f('0x13')](_0x844f('0x34'),_0x3ea4d3['name']);emit(util[_0x844f('0x35')]('user:%s',_0x3ea4d3['name']),'webbar:conference');return _0x79765e['status'](0xc8)['json']({'error':![],'message':_0x844f('0x49')});})[_0x844f('0x21')](handleError(_0x79765e));};exports[_0x844f('0x4a')]=function(_0x38b62e,_0xd1444){logger[_0x844f('0x13')](_0x844f('0x4b'),_0x38b62e['body']);var _0x10ca99=transferValidation['validate'](_0x38b62e[_0x844f('0x2e')]);if(_0x10ca99['length']>0x0){return _0xd1444[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x10ca99);}var _0x59ec8e=_0x38b62e[_0x844f('0x2e')][_0x844f('0x30')];var _0xeafed6=_0x38b62e[_0x844f('0x2e')][_0x844f('0x28')];var _0x443332=_0x38b62e[_0x844f('0x2e')][_0x844f('0x4c')];return getAgent(_0x59ec8e)['then'](function(_0x53cf8a){logger[_0x844f('0x13')]('entityFound:',_0x53cf8a[_0x844f('0x19')]);emit(util[_0x844f('0x35')](_0x844f('0x36'),_0x53cf8a[_0x844f('0x19')]),_0x844f('0x4d'),{'sessionId':_0xeafed6,'transferNumber':_0x443332});return _0xd1444['status'](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x4e')});})[_0x844f('0x21')](handleError(_0xd1444));}; \ No newline at end of file +var _0xd2ea=['userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','string','userId\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json'];(function(_0x158c51,_0x4a6533){var _0x235732=function(_0xea8be5){while(--_0xea8be5){_0x158c51['push'](_0x158c51['shift']());}};_0x235732(++_0x4a6533);}(_0xd2ea,0x15f));var _0xad2e=function(_0x87c0c1,_0x4b9343){_0x87c0c1=_0x87c0c1-0x0;var _0x457844=_0xd2ea[_0x87c0c1];return _0x457844;};'use strict';var path=require(_0xad2e('0x0'));var fs=require('fs');var _=require(_0xad2e('0x1'));var db=require(_0xad2e('0x2'))['db'];var config=require(_0xad2e('0x3'));var util=require(_0xad2e('0x4'));var BPromise=require('bluebird');var jayson=require(_0xad2e('0x5'));var amiClient=jayson[_0xad2e('0x6')][_0xad2e('0x7')]({'port':0x232a});var logger=require(_0xad2e('0x8'))(_0xad2e('0x9'));var Redis=require(_0xad2e('0xa'));config[_0xad2e('0xb')]=_['defaults'](config[_0xad2e('0xb')],{'host':_0xad2e('0xc'),'port':0x18eb});var io=require(_0xad2e('0xd'))(new Redis(config['redis']));var Schema=require(_0xad2e('0xe'));var originateValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xad2e('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xad2e('0x10')},'callbackUrl':{'type':_0xad2e('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],_0xad2e('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xad2e('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],_0xad2e('0x11')]},'sessionId':{'type':_0xad2e('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xad2e('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xad2e('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],_0xad2e('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xad2e('0xf'),'required':[!![],_0xad2e('0x11')]}});function emit(_0x4180aa,_0x2546e2,_0x5941c5){logger[_0xad2e('0x12')](_0x4180aa,_0x2546e2,JSON[_0xad2e('0x13')](_0x5941c5));io['to'](_0x4180aa)[_0xad2e('0x14')](_0x2546e2,_0x5941c5);}function handleError(_0x39c5e4){return function(_0x34f946){console[_0xad2e('0x15')](_0xad2e('0x16'),_0x34f946,_0x34f946 instanceof RangeError);logger['error'](_0x34f946[_0xad2e('0x17')]);if(_0x34f946 instanceof RangeError){if(_0x34f946[_0xad2e('0x18')]){delete _0x34f946['name'];}_0x39c5e4['status'](0x194)['send'](_0x34f946);}else{if(_0x34f946['name']){delete _0x34f946[_0xad2e('0x18')];}_0x39c5e4[_0xad2e('0x19')](0x1f4)[_0xad2e('0x1a')](_0x34f946);}};}function checkError(){return function(_0x208991){if(!_0x208991){throw new RangeError(_0xad2e('0x1b'));}return _0x208991;};}function respondWithRpcPromise(_0x41109a,_0x29dc4f){return new BPromise(function(_0x23c0b6,_0x102169){var _0x154d54=amiClient;return _0x154d54[_0xad2e('0x1c')](_0x41109a,_0x29dc4f)[_0xad2e('0x1d')](function(_0xd907a9){if(_0xd907a9[_0xad2e('0x1e')]){if(_0xd907a9[_0xad2e('0x1e')][_0xad2e('0x1f')]===0x1f4){return _0x102169(_0xd907a9['error'][_0xad2e('0x20')]);}return _0x23c0b6(_0xd907a9[_0xad2e('0x1e')][_0xad2e('0x20')]);}else{_0x23c0b6(_0xd907a9[_0xad2e('0x21')]);}})[_0xad2e('0x22')](function(_0x58acc8){_0x102169(_0x58acc8);});});}function getAgent(_0x1161d5){return db[_0xad2e('0x23')][_0xad2e('0x24')]({'where':{'id':_0x1161d5,'role':'agent'}})[_0xad2e('0x1d')](checkError());}function getAgentCheckSession(_0x5d675f,_0x2b2bc2){return new BPromise(function(_0x28ef72,_0x22bc9b){var _0x11bfa9=respondWithRpcPromise(_0xad2e('0x25'));var _0x1676e5=getAgent(_0x5d675f);Promise[_0xad2e('0x26')]([_0x11bfa9,_0x1676e5])[_0xad2e('0x1d')](function(_0x52fdda){var _0x31857f=_0x52fdda[0x0];var _0x4ffa15=_0x52fdda[0x1];var _0x434934=_[_0xad2e('0x27')](_0x31857f[_0xad2e('0x28')],function(_0x4379f4){return _0x4379f4[_0xad2e('0x29')]==_0x4ffa15['id']&&_0x4379f4[_0xad2e('0x2a')]==_0x2b2bc2;});if(_0x434934[_0xad2e('0x2b')]==0x1){_0x28ef72(_0x4ffa15);}else{_0x22bc9b(new RangeError(_0xad2e('0x2c')+_0x2b2bc2+_0xad2e('0x2d')));}});});}exports[_0xad2e('0x2e')]=function(_0xcc4c66,_0x56330e){logger[_0xad2e('0x12')]('originate\x20fired:',_0xcc4c66[_0xad2e('0x2f')]);var _0x3a6419=originateValidation[_0xad2e('0xe')](_0xcc4c66[_0xad2e('0x2f')]);if(_0x3a6419[_0xad2e('0x2b')]>0x0){return _0x56330e['status'](0x190)[_0xad2e('0x30')](_0x3a6419);}var _0x27fdf0=_0xcc4c66['body'][_0xad2e('0x31')];var _0x100b35=_0xcc4c66['body'][_0xad2e('0x32')];var _0x19fd12=_0xcc4c66[_0xad2e('0x2f')][_0xad2e('0x33')];var _0x2a130a=_0xcc4c66[_0xad2e('0x2f')][_0xad2e('0x34')];return getAgent(_0x27fdf0)['then'](function(_0x41a022){logger[_0xad2e('0x12')]('entityFound:',_0x41a022[_0xad2e('0x18')]);emit(util[_0xad2e('0x35')](_0xad2e('0x36'),_0x41a022[_0xad2e('0x18')]),_0xad2e('0x37'),{'callNumber':_0x100b35,'callerId':_0x19fd12,'callbackUrl':_0x2a130a});return _0x56330e[_0xad2e('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0xad2e('0x22')](handleError(_0x56330e));};exports['hangup']=function(_0x1bf1da,_0x33c2a8){logger[_0xad2e('0x12')](_0xad2e('0x38'),_0x1bf1da[_0xad2e('0x2f')]);var _0x5d55f9=hangupValidation[_0xad2e('0xe')](_0x1bf1da[_0xad2e('0x2f')]);if(_0x5d55f9['length']>0x0){return _0x33c2a8['status'](0x190)['json'](_0x5d55f9);}var _0x274fd8=_0x1bf1da['body']['userId'];var _0x2d0018=_0x1bf1da[_0xad2e('0x2f')][_0xad2e('0x2a')];return getAgent(_0x274fd8)[_0xad2e('0x1d')](function(_0x6f4fbc){logger[_0xad2e('0x12')](_0xad2e('0x39'),_0x6f4fbc['name']);emit(util[_0xad2e('0x35')](_0xad2e('0x36'),_0x6f4fbc[_0xad2e('0x18')]),_0xad2e('0x3a'),{'sessionId':_0x2d0018});return _0x33c2a8[_0xad2e('0x19')](0xc8)['json']({'error':![],'message':_0xad2e('0x3b')});})['catch'](handleError(_0x33c2a8));};exports[_0xad2e('0x3c')]=function(_0x3de1d5,_0x21d202){logger[_0xad2e('0x12')](_0xad2e('0x3d'),_0x3de1d5[_0xad2e('0x2f')]);var _0x1abcea=answerValidation[_0xad2e('0xe')](_0x3de1d5[_0xad2e('0x2f')]);if(_0x1abcea[_0xad2e('0x2b')]>0x0){return _0x21d202[_0xad2e('0x19')](0x190)[_0xad2e('0x30')](_0x1abcea);}var _0x1d18d0=_0x3de1d5[_0xad2e('0x2f')][_0xad2e('0x31')];var _0x2ad9a0=_0x3de1d5[_0xad2e('0x2f')][_0xad2e('0x2a')];return getAgent(_0x1d18d0)[_0xad2e('0x1d')](function(_0x214c59){logger['info'](_0xad2e('0x39'),_0x214c59[_0xad2e('0x18')]);emit(util[_0xad2e('0x35')](_0xad2e('0x36'),_0x214c59[_0xad2e('0x18')]),_0xad2e('0x3e'),{'sessionId':_0x2ad9a0});return _0x21d202[_0xad2e('0x19')](0xc8)['json']({'error':![],'message':_0xad2e('0x3f')});})['catch'](handleError(_0x21d202));};exports[_0xad2e('0x40')]=function(_0x2ad66e,_0x36b103){logger[_0xad2e('0x12')](_0xad2e('0x41'),_0x2ad66e['body']);var _0xf80dd8=holdValidation[_0xad2e('0xe')](_0x2ad66e[_0xad2e('0x2f')]);if(_0xf80dd8[_0xad2e('0x2b')]>0x0){return _0x36b103[_0xad2e('0x19')](0x190)['json'](_0xf80dd8);}var _0x18ef1e=_0x2ad66e[_0xad2e('0x2f')][_0xad2e('0x31')];var _0x248f3d=_0x2ad66e['body']['sessionId'];return getAgent(_0x18ef1e)[_0xad2e('0x1d')](function(_0x343e4f){logger['info']('entityFound:',_0x343e4f[_0xad2e('0x18')]);emit(util['format'](_0xad2e('0x36'),_0x343e4f[_0xad2e('0x18')]),'webbar:hold',{'sessionId':_0x248f3d});return _0x36b103[_0xad2e('0x19')](0xc8)[_0xad2e('0x30')]({'error':![],'message':_0xad2e('0x42')});})[_0xad2e('0x22')](handleError(_0x36b103));};exports['unhold']=function(_0x527c93,_0x42d999){logger[_0xad2e('0x12')](_0xad2e('0x43'),_0x527c93[_0xad2e('0x2f')]);var _0x296b67=unholdValidation[_0xad2e('0xe')](_0x527c93[_0xad2e('0x2f')]);if(_0x296b67[_0xad2e('0x2b')]>0x0){return _0x42d999['status'](0x190)[_0xad2e('0x30')](_0x296b67);}var _0x508812=_0x527c93[_0xad2e('0x2f')][_0xad2e('0x31')];var _0x438c7f=_0x527c93[_0xad2e('0x2f')][_0xad2e('0x2a')];return getAgent(_0x508812)[_0xad2e('0x1d')](function(_0x42e8f0){logger['info'](_0xad2e('0x39'),_0x42e8f0['name']);emit(util[_0xad2e('0x35')](_0xad2e('0x36'),_0x42e8f0[_0xad2e('0x18')]),_0xad2e('0x44'),{'sessionId':_0x438c7f});return _0x42d999['status'](0xc8)[_0xad2e('0x30')]({'error':![],'message':_0xad2e('0x45')});})['catch'](handleError(_0x42d999));};exports[_0xad2e('0x46')]=function(_0x48dc29,_0x9cf57b){logger[_0xad2e('0x12')](_0xad2e('0x47'),_0x9cf57b[_0xad2e('0x2f')]);var _0x243d14=callsValidation[_0xad2e('0xe')](_0x48dc29[_0xad2e('0x2f')]);if(_0x243d14[_0xad2e('0x2b')]>0x0){return _0x9cf57b[_0xad2e('0x19')](0x190)['json'](_0x243d14);}var _0xe2d4ac=_0x48dc29[_0xad2e('0x2f')][_0xad2e('0x31')];var _0x243add=respondWithRpcPromise('VoiceChannels');var _0x5c7318=getAgent(_0xe2d4ac);return Promise[_0xad2e('0x26')]([_0x243add,_0x5c7318])[_0xad2e('0x1d')](function(_0xb03176){var _0xd3b75e=_0xb03176[0x0];var _0x450803=_0xb03176[0x1];var _0x77387e=_['filter'](_0xd3b75e[_0xad2e('0x28')],function(_0x69dcbd){return _0x69dcbd['UserId']==_0x450803['id'];});return _0x9cf57b[_0xad2e('0x19')](0xc8)[_0xad2e('0x30')]({'count':_0x77387e[_0xad2e('0x2b')],'rows':_0x77387e});})[_0xad2e('0x22')](handleError(_0x9cf57b));};exports[_0xad2e('0x48')]=function(_0x270c8d,_0x1ce266){logger[_0xad2e('0x12')](_0xad2e('0x49'),_0x270c8d[_0xad2e('0x2f')]);var _0x598d49=conferenceValidation['validate'](_0x270c8d[_0xad2e('0x2f')]);if(_0x598d49['length']>0x0){return _0x1ce266['status'](0x190)[_0xad2e('0x30')](_0x598d49);}var _0x3c3f96=_0x270c8d[_0xad2e('0x2f')]['userId'];return getAgent(_0x3c3f96)[_0xad2e('0x1d')](function(_0x337d8c){logger[_0xad2e('0x12')](_0xad2e('0x39'),_0x337d8c[_0xad2e('0x18')]);emit(util['format'](_0xad2e('0x36'),_0x337d8c['name']),'webbar:conference');return _0x1ce266['status'](0xc8)['json']({'error':![],'message':_0xad2e('0x4a')});})[_0xad2e('0x22')](handleError(_0x1ce266));};exports[_0xad2e('0x4b')]=function(_0x2bedd8,_0x32643b){logger[_0xad2e('0x12')](_0xad2e('0x4c'),_0x2bedd8[_0xad2e('0x2f')]);var _0x1a7d47=transferValidation[_0xad2e('0xe')](_0x2bedd8[_0xad2e('0x2f')]);if(_0x1a7d47['length']>0x0){return _0x32643b[_0xad2e('0x19')](0x190)[_0xad2e('0x30')](_0x1a7d47);}var _0x5832c9=_0x2bedd8['body'][_0xad2e('0x31')];var _0x49a7d9=_0x2bedd8[_0xad2e('0x2f')][_0xad2e('0x2a')];var _0x3bdd1f=_0x2bedd8[_0xad2e('0x2f')][_0xad2e('0x4d')];return getAgent(_0x5832c9)[_0xad2e('0x1d')](function(_0x10d465){logger[_0xad2e('0x12')]('entityFound:',_0x10d465[_0xad2e('0x18')]);emit(util['format']('user:%s',_0x10d465[_0xad2e('0x18')]),_0xad2e('0x4e'),{'sessionId':_0x49a7d9,'transferNumber':_0x3bdd1f});return _0x32643b['status'](0xc8)[_0xad2e('0x30')]({'error':![],'message':_0xad2e('0x4f')});})[_0xad2e('0x22')](handleError(_0x32643b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c7604ad..40410ae 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 _0xeac6=['create','addDisposition','addAnswer','addAgents','/:id/notify','/:id/send','put','update','destroy','delete','removeAnswers','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','post'];(function(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0xeac6,0x1eb));var _0x6eac=function(_0x43108e,_0x37048a){_0x43108e=_0x43108e-0x0;var _0x6de8f6=_0xeac6[_0x43108e];return _0x6de8f6;};'use strict';var multer=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var path=require(_0x6eac('0x2'));var timeout=require(_0x6eac('0x3'));var express=require(_0x6eac('0x4'));var router=express['Router']();var auth=require(_0x6eac('0x5'));var interaction=require(_0x6eac('0x6'));var config=require(_0x6eac('0x7'));var controller=require(_0x6eac('0x8'));router[_0x6eac('0x9')]('/',auth[_0x6eac('0xa')](),controller['index']);router[_0x6eac('0x9')](_0x6eac('0xb'),auth['isAuthenticated'](),controller[_0x6eac('0xc')]);router[_0x6eac('0x9')](_0x6eac('0xd'),auth['isAuthenticated'](),controller[_0x6eac('0xe')]);router[_0x6eac('0x9')](_0x6eac('0xf'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x10')]);router[_0x6eac('0x9')](_0x6eac('0x11'),auth[_0x6eac('0xa')](),controller['getAnswers']);router['get'](_0x6eac('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x6eac('0x13'),auth[_0x6eac('0xa')](),controller['getApplications']);router[_0x6eac('0x14')]('/',auth[_0x6eac('0xa')](),controller[_0x6eac('0x15')]);router['post'](_0x6eac('0xf'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x16')]);router[_0x6eac('0x14')](_0x6eac('0x11'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x17')]);router[_0x6eac('0x14')](_0x6eac('0x12'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x18')]);router['post'](_0x6eac('0x13'),auth[_0x6eac('0xa')](),controller['addApplications']);router[_0x6eac('0x14')](_0x6eac('0x19'),controller['notify']);router[_0x6eac('0x14')](_0x6eac('0x1a'),auth[_0x6eac('0xa')](),controller['send']);router[_0x6eac('0x1b')](_0x6eac('0xd'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x1c')]);router['delete'](_0x6eac('0xd'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x1d')]);router['delete']('/:id/dispositions',auth[_0x6eac('0xa')](),controller['removeDispositions']);router[_0x6eac('0x1e')]('/:id/canned_answers',auth[_0x6eac('0xa')](),controller[_0x6eac('0x1f')]);router[_0x6eac('0x1e')](_0x6eac('0x12'),auth[_0x6eac('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3413=['post','create','/:id/dispositions','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications'];(function(_0x119ef1,_0x17c4e5){var _0x33fcc5=function(_0x3fada2){while(--_0x3fada2){_0x119ef1['push'](_0x119ef1['shift']());}};_0x33fcc5(++_0x17c4e5);}(_0x3413,0x1d6));var _0x3341=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3413[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3341('0x0'));var util=require(_0x3341('0x1'));var path=require(_0x3341('0x2'));var timeout=require(_0x3341('0x3'));var express=require(_0x3341('0x4'));var router=express[_0x3341('0x5')]();var auth=require(_0x3341('0x6'));var interaction=require(_0x3341('0x7'));var config=require(_0x3341('0x8'));var controller=require(_0x3341('0x9'));router[_0x3341('0xa')]('/',auth[_0x3341('0xb')](),controller['index']);router[_0x3341('0xa')](_0x3341('0xc'),auth[_0x3341('0xb')](),controller[_0x3341('0xd')]);router[_0x3341('0xa')](_0x3341('0xe'),auth['isAuthenticated'](),controller[_0x3341('0xf')]);router[_0x3341('0xa')]('/:id/dispositions',auth[_0x3341('0xb')](),controller[_0x3341('0x10')]);router[_0x3341('0xa')](_0x3341('0x11'),auth[_0x3341('0xb')](),controller[_0x3341('0x12')]);router[_0x3341('0xa')]('/:id/users',auth[_0x3341('0xb')](),controller[_0x3341('0x13')]);router['get'](_0x3341('0x14'),auth[_0x3341('0xb')](),controller[_0x3341('0x15')]);router[_0x3341('0x16')]('/',auth[_0x3341('0xb')](),controller[_0x3341('0x17')]);router['post'](_0x3341('0x18'),auth[_0x3341('0xb')](),controller[_0x3341('0x19')]);router[_0x3341('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3341('0x1a')]);router[_0x3341('0x16')](_0x3341('0x1b'),auth[_0x3341('0xb')](),controller[_0x3341('0x1c')]);router[_0x3341('0x16')](_0x3341('0x14'),auth['isAuthenticated'](),controller[_0x3341('0x1d')]);router[_0x3341('0x16')](_0x3341('0x1e'),controller['notify']);router[_0x3341('0x16')](_0x3341('0x1f'),auth['isAuthenticated'](),controller[_0x3341('0x20')]);router[_0x3341('0x21')]('/:id',auth[_0x3341('0xb')](),controller[_0x3341('0x22')]);router[_0x3341('0x23')](_0x3341('0xe'),auth[_0x3341('0xb')](),controller[_0x3341('0x24')]);router[_0x3341('0x23')](_0x3341('0x18'),auth['isAuthenticated'](),controller[_0x3341('0x25')]);router[_0x3341('0x23')](_0x3341('0x11'),auth[_0x3341('0xb')](),controller[_0x3341('0x26')]);router['delete'](_0x3341('0x1b'),auth[_0x3341('0xb')](),controller[_0x3341('0x27')]);module[_0x3341('0x28')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index db6781c..32e3502 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 _0x2db2=['randomstring','exports','STRING','name','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2fa07f,_0x44b7bc){var _0x4183ae=function(_0x385729){while(--_0x385729){_0x2fa07f['push'](_0x2fa07f['shift']());}};_0x4183ae(++_0x44b7bc);}(_0x2db2,0x1ee));var _0x22db=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x2db2[_0x29c261];return _0x1a9335;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x22db('0x0'));module[_0x22db('0x1')]={'name':{'type':Sequelize[_0x22db('0x2')],'unique':_0x22db('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x22db('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x22db('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x22db('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x22db('0x4')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x22db('0x2')]},'notificationTemplate':{'type':Sequelize[_0x22db('0x5')],'defaultValue':function(){return _0x22db('0x6');}},'notificationSound':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22db('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22db('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22db('0x8')],'comment':_0x22db('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3bf6d8){if(!_0x3bf6d8){this[_0x22db('0xa')](_0x22db('0xb'),null);}this[_0x22db('0xa')](_0x22db('0xc'),_0x3bf6d8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf40e=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3e5150,_0x1da22a){var _0xb0f930=function(_0x15738f){while(--_0x15738f){_0x3e5150['push'](_0x3e5150['shift']());}};_0xb0f930(++_0x1da22a);}(_0xf40e,0x1c4));var _0xef40=function(_0x55eab5,_0xf7d082){_0x55eab5=_0x55eab5-0x0;var _0x39d23e=_0xf40e[_0x55eab5];return _0x39d23e;};'use strict';var Sequelize=require(_0xef40('0x0'));var rs=require(_0xef40('0x1'));module[_0xef40('0x2')]={'name':{'type':Sequelize[_0xef40('0x3')],'unique':_0xef40('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xef40('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xef40('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xef40('0x5')](_0xef40('0x6'))},'accountSid':{'type':Sequelize[_0xef40('0x3')]},'authToken':{'type':Sequelize[_0xef40('0x3')]},'notificationTemplate':{'type':Sequelize[_0xef40('0x7')],'defaultValue':function(){return _0xef40('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xef40('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef40('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef40('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef40('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef40('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xef40('0x9')],'defaultValue':![],'comment':_0xef40('0xb'),'set':function(_0x4ff957){if(!_0x4ff957){this[_0xef40('0xc')](_0xef40('0xd'),null);}this[_0xef40('0xc')](_0xef40('0xe'),_0x4ff957);}},'description':{'type':Sequelize[_0xef40('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 55c50a8..d947605 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 _0xb688=['unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rawAttributes','nolimit','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','describe','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','type','twilio','from','From','replace','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xb688,0xcf));var _0x8b68=function(_0x367432,_0x1d5c68){_0x367432=_0x367432-0x0;var _0x29cab0=_0xb688[_0x367432];return _0x29cab0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var as=require(_0x8b68('0x15'));var hardwareService=require(_0x8b68('0x16'));var logger=require(_0x8b68('0x17'))('api');var utils=require(_0x8b68('0x18'));var config=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];config[_0x8b68('0x1b')]=_[_0x8b68('0x1c')](config[_0x8b68('0x1b')],{'host':_0x8b68('0x1d'),'port':0x18eb});var socket=require(_0x8b68('0x1e'))(new Redis(config[_0x8b68('0x1b')]));require('./whatsappAccount.socket')[_0x8b68('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8b68('0x20')]({'port':0x232c});function checkPasswordPattern(_0x1554d6,_0x27d717,_0x5d3468){if(_0x5d3468){var _0x5c8d0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c8d0e[_0x8b68('0x21')](_0x27d717)){return _0x1554d6;}else{throw new db['Sequelize'][(_0x8b68('0x22'))](_0x8b68('0x23'));}}else{return _0x1554d6;}}function respondWithRpcPromise(_0x1df44f,_0x10c9c6,_0x491695,_0xd17693){return new BPromise(function(_0x203dd4,_0x4a68c7){var _0x42b3bd=_0xd17693||client;return _0x42b3bd[_0x8b68('0x24')](_0x1df44f,_0x491695)[_0x8b68('0x25')](function(_0x17f321){logger[_0x8b68('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x10c9c6,_0x8b68('0x27'));logger[_0x8b68('0x28')](_0x8b68('0x29'),_0x10c9c6,_0x8b68('0x27'),JSON[_0x8b68('0x2a')](_0x17f321));if(_0x17f321[_0x8b68('0x2b')]){if(_0x17f321['error']['code']===0x1f4){logger[_0x8b68('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x10c9c6,_0x17f321[_0x8b68('0x2b')][_0x8b68('0x2c')]);return _0x4a68c7(_0x17f321[_0x8b68('0x2b')][_0x8b68('0x2c')]);}logger[_0x8b68('0x2b')](_0x8b68('0x2d'),_0x10c9c6,_0x17f321['error'][_0x8b68('0x2c')]);return _0x203dd4(_0x17f321[_0x8b68('0x2b')]['message']);}else{logger[_0x8b68('0x26')](_0x8b68('0x2d'),_0x10c9c6,_0x8b68('0x27'));_0x203dd4(_0x17f321['result']['message']);}})['catch'](function(_0x92d186){logger[_0x8b68('0x2b')](_0x8b68('0x2d'),_0x10c9c6,_0x92d186);_0x4a68c7(_0x92d186);});});}function respondWithStatusCode(_0x583476,_0x3311c7){_0x3311c7=_0x3311c7||0xcc;return function(_0x53aaa2){if(_0x53aaa2){return _0x583476['sendStatus'](_0x3311c7);}return _0x583476[_0x8b68('0x2e')](_0x3311c7)['end']();};}function respondWithResult(_0x26cad7,_0x3ac356){_0x3ac356=_0x3ac356||0xc8;return function(_0x48e2c8){if(_0x48e2c8){return _0x26cad7['status'](_0x3ac356)[_0x8b68('0x2f')](_0x48e2c8);}};}function respondWithFilteredResult(_0x1cd230,_0x1e7c06){return function(_0xfb4f06){if(_0xfb4f06){var _0x210926=_0xfb4f06[_0x8b68('0x30')],_0x2ad2df=_0x1e7c06['offset'],_0x460c37=_0x1e7c06[_0x8b68('0x31')]+_0x1e7c06[_0x8b68('0x32')],_0x5b7ed1;if(_0x460c37>=_0x210926){_0x460c37=_0x210926;_0x5b7ed1=0xc8;}else{_0x5b7ed1=0xce;}_0x1cd230['status'](_0x5b7ed1);return _0x1cd230[_0x8b68('0x33')](_0x8b68('0x34'),_0x2ad2df+'-'+_0x460c37+'/'+_0x210926)[_0x8b68('0x2f')](_0xfb4f06);}return null;};}function patchUpdates(_0x49ce2d){return function(_0x51f169){try{jsonpatch[_0x8b68('0x35')](_0x51f169,_0x49ce2d,!![]);}catch(_0x8c11aa){return BPromise[_0x8b68('0x36')](_0x8c11aa);}return _0x51f169[_0x8b68('0x37')]();};}function saveUpdates(_0x2c0ace,_0x334b13){return function(_0x29449b){if(_0x29449b){return _0x29449b[_0x8b68('0x38')](_0x2c0ace)[_0x8b68('0x25')](function(_0x7fe301){return _0x7fe301;});}return null;};}function removeEntity(_0x49e2db,_0x15027a){return function(_0x232fa9){if(_0x232fa9){return _0x232fa9[_0x8b68('0x39')]()[_0x8b68('0x25')](function(){var _0x151277=_0x232fa9[_0x8b68('0x3a')]({'plain':!![]});var _0x2a7dd5=_0x8b68('0x3b');return db[_0x8b68('0x3c')][_0x8b68('0x39')]({'where':{'type':_0x2a7dd5,'resourceId':_0x151277['id']}})[_0x8b68('0x25')](function(){return _0x232fa9;});})['then'](function(){_0x49e2db['status'](0xcc)[_0x8b68('0x3d')]();});}};}function handleEntityNotFound(_0x262d6c,_0x23554d){return function(_0xb9b5b1){if(!_0xb9b5b1){_0x262d6c[_0x8b68('0x3e')](0x194);}return _0xb9b5b1;};}function handleError(_0xce486c,_0x75a62f){_0x75a62f=_0x75a62f||0x1f4;return function(_0x43feb3){logger['error'](_0x43feb3[_0x8b68('0x3f')]);if(_0x43feb3[_0x8b68('0x40')]){delete _0x43feb3[_0x8b68('0x40')];}_0xce486c[_0x8b68('0x2e')](_0x75a62f)[_0x8b68('0x41')](_0x43feb3);};}exports[_0x8b68('0x42')]=function(_0xff4080,_0x2dd264){var _0x517571={'include':[{'model':db[_0x8b68('0x43')],'as':_0x8b68('0x44')}]},_0x3f874c={},_0x42cc82={'count':0x0,'rows':[]};var _0x3ecc60=_[_0x8b68('0x45')](db[_0x8b68('0x46')]['rawAttributes'],function(_0x162b0c){return{'name':_0x162b0c[_0x8b68('0x47')],'type':_0x162b0c['type'][_0x8b68('0x48')]};});_0x3f874c[_0x8b68('0x49')]=_['map'](_0x3ecc60,'name');_0x3f874c['query']=_['keys'](_0xff4080[_0x8b68('0x4a')]);_0x3f874c[_0x8b68('0x4b')]=_['intersection'](_0x3f874c[_0x8b68('0x49')],_0x3f874c['query']);_0x517571[_0x8b68('0x4c')]=_[_0x8b68('0x4d')](_0x3f874c['model'],qs[_0x8b68('0x4e')](_0xff4080['query']['fields']));_0x517571['attributes']=_0x517571[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x517571[_0x8b68('0x4c')]:_0x3f874c[_0x8b68('0x49')];if(!_0xff4080['query'][_0x8b68('0x50')]('nolimit')){_0x517571[_0x8b68('0x32')]=qs[_0x8b68('0x32')](_0xff4080['query'][_0x8b68('0x32')]);_0x517571[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0xff4080[_0x8b68('0x4a')]['offset']);}_0x517571[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0xff4080[_0x8b68('0x4a')][_0x8b68('0x52')]);_0x517571[_0x8b68('0x53')]=qs[_0x8b68('0x4b')](_[_0x8b68('0x54')](_0xff4080[_0x8b68('0x4a')],_0x3f874c[_0x8b68('0x4b')]),_0x3ecc60);if(_0xff4080[_0x8b68('0x4a')][_0x8b68('0x55')]){_0x517571[_0x8b68('0x53')]=_[_0x8b68('0x56')](_0x517571[_0x8b68('0x53')],{'$or':_[_0x8b68('0x45')](_0x3ecc60,function(_0xe65007){if(_0xe65007['type']!==_0x8b68('0x57')){var _0x20681a={};_0x20681a[_0xe65007['name']]={'$like':'%'+_0xff4080[_0x8b68('0x4a')]['filter']+'%'};return _0x20681a;}})});}_0x517571=_['merge']({},_0x517571,_0xff4080['options']);var _0x1c8a3e={'where':_0x517571[_0x8b68('0x53')]};return db[_0x8b68('0x46')][_0x8b68('0x30')](_0x1c8a3e)['then'](function(_0x522f47){_0x42cc82[_0x8b68('0x30')]=_0x522f47;if(_0xff4080[_0x8b68('0x4a')][_0x8b68('0x58')]){_0x517571['include']=[{'all':!![]}];}return db[_0x8b68('0x46')][_0x8b68('0x59')](_0x517571);})['then'](function(_0x429ebb){_0x42cc82[_0x8b68('0x5a')]=_0x429ebb;return _0x42cc82;})['then'](respondWithFilteredResult(_0x2dd264,_0x517571))[_0x8b68('0x5b')](handleError(_0x2dd264,null));};exports[_0x8b68('0x5c')]=function(_0x51bf1b,_0x3f7f89){var _0x735e17={'raw':![],'where':{'id':_0x51bf1b['params']['id']},'include':[{'model':db['Pause'],'as':_0x8b68('0x44')}]},_0x48f886={};_0x48f886[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x46')]['rawAttributes']);_0x48f886['query']=_[_0x8b68('0x5d')](_0x51bf1b[_0x8b68('0x4a')]);_0x48f886[_0x8b68('0x4b')]=_['intersection'](_0x48f886[_0x8b68('0x49')],_0x48f886[_0x8b68('0x4a')]);_0x735e17[_0x8b68('0x4c')]=_['intersection'](_0x48f886[_0x8b68('0x49')],qs['fields'](_0x51bf1b[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x735e17['attributes']=_0x735e17[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x735e17[_0x8b68('0x4c')]:_0x48f886[_0x8b68('0x49')];if(_0x51bf1b[_0x8b68('0x4a')]['includeAll']){_0x735e17[_0x8b68('0x5e')]=[{'all':!![]}];}_0x735e17=_[_0x8b68('0x56')]({},_0x735e17,_0x51bf1b[_0x8b68('0x5f')]);return db[_0x8b68('0x46')][_0x8b68('0x60')](_0x735e17)[_0x8b68('0x25')](handleEntityNotFound(_0x3f7f89,null))[_0x8b68('0x25')](respondWithResult(_0x3f7f89,null))[_0x8b68('0x5b')](handleError(_0x3f7f89,null));};exports['create']=function(_0x3f423e,_0x1a85da){return db[_0x8b68('0x46')][_0x8b68('0x61')](_0x3f423e[_0x8b68('0x62')],{})[_0x8b68('0x25')](function(_0x3a90ba){var _0x37c4cb=_0x3f423e[_0x8b68('0x63')][_0x8b68('0x3a')]({'plain':!![]});if(!_0x37c4cb)throw new Error(_0x8b68('0x64'));if(_0x37c4cb[_0x8b68('0x65')]===_0x8b68('0x63')){var _0x275b31=_0x3a90ba[_0x8b68('0x3a')]({'plain':!![]});var _0xd7e86d=_0x8b68('0x3b');return db[_0x8b68('0x66')][_0x8b68('0x60')]({'where':{'name':_0xd7e86d,'userProfileId':_0x37c4cb[_0x8b68('0x67')]},'raw':!![]})['then'](function(_0xaac776){if(_0xaac776&&_0xaac776['autoAssociation']===0x0){return db['UserProfileResource'][_0x8b68('0x61')]({'name':_0x275b31['name'],'resourceId':_0x275b31['id'],'type':_0xaac776[_0x8b68('0x40')],'sectionId':_0xaac776['id']},{})[_0x8b68('0x25')](function(){return _0x3a90ba;});}else{return _0x3a90ba;}})[_0x8b68('0x5b')](function(_0x4e2980){logger[_0x8b68('0x2b')](_0x8b68('0x68'),_0x4e2980);throw _0x4e2980;});}return _0x3a90ba;})[_0x8b68('0x25')](respondWithResult(_0x1a85da,0xc9))[_0x8b68('0x5b')](handleError(_0x1a85da,null));};exports[_0x8b68('0x38')]=function(_0x3031d1,_0x368025){if(_0x3031d1['body']['id']){delete _0x3031d1['body']['id'];}return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x3031d1[_0x8b68('0x69')]['id']},'include':[{'model':db[_0x8b68('0x43')],'as':_0x8b68('0x44')}]})[_0x8b68('0x25')](handleEntityNotFound(_0x368025,null))[_0x8b68('0x25')](saveUpdates(_0x3031d1[_0x8b68('0x62')],null))[_0x8b68('0x25')](respondWithResult(_0x368025,null))[_0x8b68('0x5b')](handleError(_0x368025,null));};exports[_0x8b68('0x39')]=function(_0x2379d4,_0x316652){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x2379d4[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x316652,null))[_0x8b68('0x25')](removeEntity(_0x316652,null))['catch'](handleError(_0x316652,null));};exports['describe']=function(_0xdc096c,_0x23e01a){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x23e01a,null))[_0x8b68('0x5b')](handleError(_0x23e01a,null));};exports[_0x8b68('0x6a')]=function(_0xd5f52e,_0x3c8e0d,_0xc52321){if(_0xd5f52e['body']['id']){delete _0xd5f52e[_0x8b68('0x62')]['id'];}return db[_0x8b68('0x46')]['find']({'where':{'id':_0xd5f52e[_0x8b68('0x69')]['id']}})['then'](handleEntityNotFound(_0x3c8e0d,null))['then'](function(_0x5d8cea){if(_0x5d8cea){_0xd5f52e[_0x8b68('0x62')][_0x8b68('0x6b')]=_0x5d8cea['id'];return db[_0x8b68('0x6c')][_0x8b68('0x61')](_0xd5f52e[_0x8b68('0x62')]);}})[_0x8b68('0x25')](respondWithResult(_0x3c8e0d,null))[_0x8b68('0x5b')](handleError(_0x3c8e0d,null));};exports[_0x8b68('0x6d')]=function(_0x427752,_0x20a556,_0x55e04f){var _0x3a8d15={'raw':![],'where':{}};var _0x335b3b={};var _0x310ec9={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x427752[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x20a556,null))['then'](function(_0x1c3f37){if(_0x1c3f37){_0x335b3b[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x6c')]['rawAttributes']);_0x335b3b[_0x8b68('0x4a')]=_['keys'](_0x427752['query']);_0x335b3b[_0x8b68('0x4b')]=_['intersection'](_0x335b3b[_0x8b68('0x49')],_0x335b3b[_0x8b68('0x4a')]);_0x3a8d15['attributes']=_[_0x8b68('0x4d')](_0x335b3b[_0x8b68('0x49')],qs[_0x8b68('0x4e')](_0x427752[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x3a8d15['attributes']=_0x3a8d15[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x3a8d15[_0x8b68('0x4c')]:_0x335b3b[_0x8b68('0x49')];if(!_0x427752[_0x8b68('0x4a')]['hasOwnProperty']('nolimit')){_0x3a8d15[_0x8b68('0x32')]=qs['limit'](_0x427752[_0x8b68('0x4a')][_0x8b68('0x32')]);_0x3a8d15[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0x427752[_0x8b68('0x4a')][_0x8b68('0x31')]);}_0x3a8d15[_0x8b68('0x51')]=qs['sort'](_0x427752[_0x8b68('0x4a')]['sort']);_0x3a8d15[_0x8b68('0x53')]=qs[_0x8b68('0x4b')](_[_0x8b68('0x54')](_0x427752['query'],_0x335b3b[_0x8b68('0x4b')]));_0x3a8d15['where'][_0x8b68('0x6b')]=_0x1c3f37['id'];if(_0x427752['query'][_0x8b68('0x55')]){_0x3a8d15[_0x8b68('0x53')]=_[_0x8b68('0x56')](_0x3a8d15['where'],{'$or':_[_0x8b68('0x45')](_0x3a8d15[_0x8b68('0x4c')],function(_0x3d8a44){var _0x214fe4={};_0x214fe4[_0x3d8a44]={'$like':'%'+_0x427752[_0x8b68('0x4a')][_0x8b68('0x55')]+'%'};return _0x214fe4;})});}_0x3a8d15=_[_0x8b68('0x56')]({},_0x3a8d15,_0x427752[_0x8b68('0x5f')]);return db[_0x8b68('0x6c')]['count']({'where':_0x3a8d15[_0x8b68('0x53')]})[_0x8b68('0x25')](function(_0x9a5bec){_0x310ec9[_0x8b68('0x30')]=_0x9a5bec;if(_0x427752[_0x8b68('0x4a')]['includeAll']){_0x3a8d15[_0x8b68('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x8b68('0x59')](_0x3a8d15);})[_0x8b68('0x25')](function(_0x524763){_0x310ec9[_0x8b68('0x5a')]=_0x524763;return _0x310ec9;});}})[_0x8b68('0x25')](respondWithFilteredResult(_0x20a556,_0x3a8d15))[_0x8b68('0x5b')](handleError(_0x20a556,null));};exports['removeDispositions']=function(_0x3cca8c,_0x18ee1a,_0x43a874){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x3cca8c[_0x8b68('0x69')]['id']}})['then'](handleEntityNotFound(_0x18ee1a,null))[_0x8b68('0x25')](function(_0x14474f){if(_0x14474f){return _0x14474f[_0x8b68('0x6e')](_0x3cca8c['query'][_0x8b68('0x6f')]);}})[_0x8b68('0x25')](respondWithStatusCode(_0x18ee1a,null))[_0x8b68('0x5b')](handleError(_0x18ee1a,null));};exports[_0x8b68('0x70')]=function(_0xa02ad9,_0x377045,_0x320f42){if(_0xa02ad9[_0x8b68('0x62')]['id']){delete _0xa02ad9[_0x8b68('0x62')]['id'];}return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0xa02ad9['params']['id']}})['then'](handleEntityNotFound(_0x377045,null))[_0x8b68('0x25')](function(_0x3c6398){if(_0x3c6398){_0xa02ad9[_0x8b68('0x62')][_0x8b68('0x6b')]=_0x3c6398['id'];return db[_0x8b68('0x71')]['create'](_0xa02ad9[_0x8b68('0x62')]);}})[_0x8b68('0x25')](respondWithResult(_0x377045,null))[_0x8b68('0x5b')](handleError(_0x377045,null));};exports[_0x8b68('0x72')]=function(_0x48f60a,_0x52aa06,_0x417bc0){var _0x42a69b={'raw':![],'where':{}};var _0x2905a5={};var _0x1bf8cd={'count':0x0,'rows':[]};return db[_0x8b68('0x46')][_0x8b68('0x73')]({'where':{'id':_0x48f60a[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x52aa06,null))['then'](function(_0x7864cf){if(_0x7864cf){_0x2905a5[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x71')][_0x8b68('0x74')]);_0x2905a5[_0x8b68('0x4a')]=_['keys'](_0x48f60a[_0x8b68('0x4a')]);_0x2905a5[_0x8b68('0x4b')]=_[_0x8b68('0x4d')](_0x2905a5['model'],_0x2905a5[_0x8b68('0x4a')]);_0x42a69b['attributes']=_[_0x8b68('0x4d')](_0x2905a5['model'],qs[_0x8b68('0x4e')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x42a69b[_0x8b68('0x4c')]=_0x42a69b[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x42a69b['attributes']:_0x2905a5['model'];if(!_0x48f60a['query'][_0x8b68('0x50')](_0x8b68('0x75'))){_0x42a69b[_0x8b68('0x32')]=qs[_0x8b68('0x32')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x32')]);_0x42a69b[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x31')]);}_0x42a69b[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x52')]);_0x42a69b[_0x8b68('0x53')]=qs['filters'](_['pick'](_0x48f60a['query'],_0x2905a5[_0x8b68('0x4b')]));_0x42a69b[_0x8b68('0x53')][_0x8b68('0x6b')]=_0x7864cf['id'];if(_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x55')]){_0x42a69b['where']=_[_0x8b68('0x56')](_0x42a69b['where'],{'$or':_[_0x8b68('0x45')](_0x42a69b['attributes'],function(_0x1f9786){var _0x577e52={};_0x577e52[_0x1f9786]={'$like':'%'+_0x48f60a[_0x8b68('0x4a')]['filter']+'%'};return _0x577e52;})});}_0x42a69b=_[_0x8b68('0x56')]({},_0x42a69b,_0x48f60a[_0x8b68('0x5f')]);return db['CannedAnswer'][_0x8b68('0x30')]({'where':_0x42a69b[_0x8b68('0x53')]})['then'](function(_0x3d8d42){_0x1bf8cd['count']=_0x3d8d42;if(_0x48f60a[_0x8b68('0x4a')]['includeAll']){_0x42a69b[_0x8b68('0x5e')]=[{'all':!![]}];}return db[_0x8b68('0x71')][_0x8b68('0x59')](_0x42a69b);})[_0x8b68('0x25')](function(_0x2d24f8){_0x1bf8cd[_0x8b68('0x5a')]=_0x2d24f8;return _0x1bf8cd;});}})[_0x8b68('0x25')](respondWithFilteredResult(_0x52aa06,_0x42a69b))['catch'](handleError(_0x52aa06,null));};exports[_0x8b68('0x76')]=function(_0x2ecedc,_0x1e34f8,_0x22c8cb){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x2ecedc[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1e34f8,null))[_0x8b68('0x25')](function(_0x2bd8e4){if(_0x2bd8e4){return _0x2bd8e4[_0x8b68('0x76')](_0x2ecedc[_0x8b68('0x4a')][_0x8b68('0x6f')]);}})[_0x8b68('0x25')](respondWithStatusCode(_0x1e34f8,null))['catch'](handleError(_0x1e34f8,null));};exports[_0x8b68('0x77')]=function(_0x477cd3,_0x17bea5,_0x2e690b){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x477cd3['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x17bea5,null))[_0x8b68('0x25')](function(_0x3a24f8){if(_0x3a24f8){return _0x3a24f8[_0x8b68('0x77')](_0x477cd3[_0x8b68('0x62')][_0x8b68('0x6f')],_[_0x8b68('0x78')](_0x477cd3[_0x8b68('0x62')],[_0x8b68('0x6f'),'id'])||{})['spread'](function(_0x31d70c){for(var _0x4df181=0x0;_0x4df181<_0x477cd3['body']['ids'][_0x8b68('0x4f')];_0x4df181+=0x1){socket[_0x8b68('0x79')]('userWhatsappAccount:save',{'UserId':_0x477cd3[_0x8b68('0x62')][_0x8b68('0x6f')][_0x4df181],'WhatsappAccountId':_0x477cd3[_0x8b68('0x69')]['id']});}return _0x31d70c;});}})[_0x8b68('0x25')](respondWithResult(_0x17bea5,null))[_0x8b68('0x5b')](handleError(_0x17bea5,null));};exports[_0x8b68('0x7a')]=function(_0x466a77,_0x387644,_0x14bbfc){return db[_0x8b68('0x46')]['find']({'where':{'id':_0x466a77[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x387644,null))['then'](function(_0x1a62dd){if(_0x1a62dd){return _0x1a62dd[_0x8b68('0x7a')](_0x466a77['query']['ids'])[_0x8b68('0x25')](function(){if(_[_0x8b68('0x7b')](_0x466a77[_0x8b68('0x4a')][_0x8b68('0x6f')])){for(var _0x20d8ff=0x0;_0x20d8ff<_0x466a77[_0x8b68('0x4a')][_0x8b68('0x6f')][_0x8b68('0x4f')];_0x20d8ff+=0x1){socket['emit'](_0x8b68('0x7c'),{'UserId':Number(_0x466a77['query']['ids'][_0x20d8ff]),'WhatsappAccountId':Number(_0x466a77[_0x8b68('0x69')]['id'])});}}else{socket[_0x8b68('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x466a77[_0x8b68('0x4a')]['ids']),'WhatsappAccountId':Number(_0x466a77[_0x8b68('0x69')]['id'])});}});}})[_0x8b68('0x25')](respondWithStatusCode(_0x387644,null))[_0x8b68('0x5b')](handleError(_0x387644,null));};exports['getAgents']=function(_0x133557,_0x4fea56,_0x4b4409){var _0x1154b8={};var _0xe9810c={};var _0xd27126;var _0x2812c3;return db[_0x8b68('0x46')][_0x8b68('0x73')]({'where':{'id':_0x133557[_0x8b68('0x69')]['id']}})['then'](handleEntityNotFound(_0x4fea56,null))[_0x8b68('0x25')](function(_0x114f5){if(_0x114f5){_0xd27126=_0x114f5;_0xe9810c[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x7d')][_0x8b68('0x74')]);_0xe9810c[_0x8b68('0x4a')]=_['keys'](_0x133557[_0x8b68('0x4a')]);_0xe9810c[_0x8b68('0x4b')]=_['intersection'](_0xe9810c['model'],_0xe9810c[_0x8b68('0x4a')]);_0x1154b8[_0x8b68('0x4c')]=_['intersection'](_0xe9810c[_0x8b68('0x49')],qs[_0x8b68('0x4e')](_0x133557[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x1154b8[_0x8b68('0x4c')]=_0x1154b8[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x1154b8['attributes']:_0xe9810c[_0x8b68('0x49')];_0x1154b8[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0x133557['query']['sort']);_0x1154b8[_0x8b68('0x53')]=qs[_0x8b68('0x4b')](_[_0x8b68('0x54')](_0x133557['query'],_0xe9810c['filters']));if(_0x133557[_0x8b68('0x4a')][_0x8b68('0x55')]){_0x1154b8[_0x8b68('0x53')]=_['merge'](_0x1154b8['where'],{'$or':_['map'](_0x1154b8[_0x8b68('0x4c')],function(_0x3e7544){var _0xb1e53c={};_0xb1e53c[_0x3e7544]={'$like':'%'+_0x133557[_0x8b68('0x4a')][_0x8b68('0x55')]+'%'};return _0xb1e53c;})});}_0x1154b8=_['merge']({},_0x1154b8,_0x133557['options']);return _0xd27126[_0x8b68('0x7e')](_0x1154b8);}})['then'](function(_0x5a1823){if(_0x5a1823){_0x2812c3=_0x5a1823['length'];if(!_0x133557[_0x8b68('0x4a')][_0x8b68('0x50')](_0x8b68('0x75'))){_0x1154b8['limit']=qs[_0x8b68('0x32')](_0x133557['query'][_0x8b68('0x32')]);_0x1154b8[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0x133557[_0x8b68('0x4a')][_0x8b68('0x31')]);}return _0xd27126[_0x8b68('0x7e')](_0x1154b8);}})[_0x8b68('0x25')](function(_0x229dee){if(_0x229dee){return _0x229dee?{'count':_0x2812c3,'rows':_0x229dee}:null;}})[_0x8b68('0x25')](respondWithResult(_0x4fea56,null))[_0x8b68('0x5b')](handleError(_0x4fea56,null));};exports[_0x8b68('0x7f')]=function(_0x14e073,_0x21e601,_0x331ce4){return db[_0x8b68('0x46')][_0x8b68('0x73')]({'where':{'id':_0x14e073[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x21e601,null))[_0x8b68('0x25')](function(_0x4af96b){if(_0x4af96b){return db[_0x8b68('0x80')]['transaction'](function(_0xdb96d9){return db[_0x8b68('0x81')][_0x8b68('0x39')]({'where':{'WhatsappAccountId':_0x14e073[_0x8b68('0x69')]['id']},'transaction':_0xdb96d9})[_0x8b68('0x25')](function(_0x6b1ce1){var _0x3eebf9=_[_0x8b68('0x45')](_0x14e073[_0x8b68('0x62')],function(_0x3ed9cf){_0x3ed9cf[_0x8b68('0x6b')]=_0x14e073[_0x8b68('0x69')]['id'];return _0x3ed9cf;});return db['WhatsappApplication'][_0x8b68('0x82')](_0x3eebf9,{'transaction':_0xdb96d9});});})[_0x8b68('0x25')](function(){return db[_0x8b68('0x81')][_0x8b68('0x83')]({'where':{'WhatsappAccountId':_0x14e073[_0x8b68('0x69')]['id']},'order':_0x8b68('0x84')});});}})[_0x8b68('0x25')](respondWithResult(_0x21e601,null))[_0x8b68('0x5b')](handleError(_0x21e601,null));};exports[_0x8b68('0x85')]=function(_0x267011,_0x2ba260,_0x499eb1){var _0x1825f1={};var _0x446bf9={};var _0x17251d;var _0x421689;return db[_0x8b68('0x46')]['findOne']({'where':{'id':_0x267011[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x2ba260,null))['then'](function(_0x14021d){if(_0x14021d){_0x17251d=_0x14021d;_0x446bf9[_0x8b68('0x49')]=_['keys'](db['WhatsappApplication'][_0x8b68('0x74')]);_0x446bf9[_0x8b68('0x4a')]=_[_0x8b68('0x5d')](_0x267011[_0x8b68('0x4a')]);_0x446bf9[_0x8b68('0x4b')]=_[_0x8b68('0x4d')](_0x446bf9[_0x8b68('0x49')],_0x446bf9[_0x8b68('0x4a')]);_0x1825f1['attributes']=_[_0x8b68('0x4d')](_0x446bf9[_0x8b68('0x49')],qs[_0x8b68('0x4e')](_0x267011[_0x8b68('0x4a')]['fields']));_0x1825f1[_0x8b68('0x4c')]=_0x1825f1['attributes'][_0x8b68('0x4f')]?_0x1825f1[_0x8b68('0x4c')]:_0x446bf9[_0x8b68('0x49')];_0x1825f1[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0x267011[_0x8b68('0x4a')]['sort']);_0x1825f1['where']=qs['filters'](_['pick'](_0x267011['query'],_0x446bf9[_0x8b68('0x4b')]));if(_0x267011[_0x8b68('0x4a')]['filter']){_0x1825f1['where']=_[_0x8b68('0x56')](_0x1825f1[_0x8b68('0x53')],{'$or':_['map'](_0x1825f1[_0x8b68('0x4c')],function(_0x2a1efe){var _0x50df91={};_0x50df91[_0x2a1efe]={'$like':'%'+_0x267011['query'][_0x8b68('0x55')]+'%'};return _0x50df91;})});}_0x1825f1=_[_0x8b68('0x56')]({},_0x1825f1,_0x267011[_0x8b68('0x5f')]);return _0x17251d[_0x8b68('0x85')](_0x1825f1);}})[_0x8b68('0x25')](function(_0x1bf1ac){if(_0x1bf1ac){_0x421689=_0x1bf1ac[_0x8b68('0x4f')];if(!_0x267011[_0x8b68('0x4a')]['hasOwnProperty'](_0x8b68('0x75'))){_0x1825f1[_0x8b68('0x32')]=qs[_0x8b68('0x32')](_0x267011[_0x8b68('0x4a')][_0x8b68('0x32')]);_0x1825f1['offset']=qs[_0x8b68('0x31')](_0x267011['query'][_0x8b68('0x31')]);}return _0x17251d['getApplications'](_0x1825f1);}})[_0x8b68('0x25')](function(_0x2afa34){if(_0x2afa34){return _0x2afa34?{'count':_0x421689,'rows':_0x2afa34}:null;}})[_0x8b68('0x25')](respondWithResult(_0x2ba260,null))['catch'](handleError(_0x2ba260,null));};exports[_0x8b68('0x86')]=function(_0x4ca4ce,_0x18d02d,_0x150ff0){var _0x16eb4c={'channel':_0x8b68('0x87')};var _0x5a25d1=[];var _0x43e869=[];var _0x1b12a6={};return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x4ca4ce[_0x8b68('0x69')]['id']},'include':[{'model':db[_0x8b68('0x81')],'as':_0x8b68('0x88')}]})[_0x8b68('0x25')](handleEntityNotFound(_0x18d02d,null))[_0x8b68('0x25')](function(_0x3b1ed3){_0x16eb4c[_0x8b68('0x89')]=_0x3b1ed3;_0x16eb4c[_0x8b68('0x8a')]=_[_0x8b68('0x8b')](_0x3b1ed3[_0x8b68('0x88')],[_0x8b68('0x84')],[_0x8b68('0x8c')]);if(_0x16eb4c['account'][_0x8b68('0x88')]){delete _0x16eb4c['account'][_0x8b68('0x88')];}return db[_0x8b68('0x8d')][_0x8b68('0x8e')]();})[_0x8b68('0x25')](function(_0x30a51e){if(!_0x30a51e){throw new db[(_0x8b68('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x5a25d1=_['difference'](_[_0x8b68('0x5d')](_0x30a51e),[_0x8b68('0x90'),_0x8b68('0x91')]);_0x43e869=_[_0x8b68('0x92')](_[_0x8b68('0x5d')](_0x30a51e),[_0x8b68('0x90'),_0x8b68('0x91'),_0x8b68('0x93'),_0x8b68('0x94')]);_0x16eb4c[_0x8b68('0x62')]={'mapKey':'mobile'};if(_0x16eb4c['account'][_0x8b68('0x95')]&&_0x16eb4c['account'][_0x8b68('0x95')]===_0x8b68('0x96')){_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')]=_0x4ca4ce[_0x8b68('0x62')][_0x8b68('0x98')][_0x8b68('0x99')]('whatsapp:','');_0x16eb4c['body'][_0x8b68('0x62')]=_0x4ca4ce[_0x8b68('0x62')][_0x8b68('0x9a')];_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x9b')]=_0x4ca4ce['body'][_0x8b68('0x9c')];}if(_0x16eb4c[_0x8b68('0x62')]['id']){delete _0x16eb4c[_0x8b68('0x62')]['id'];}if(_[_0x8b68('0x9d')](_0x16eb4c[_0x8b68('0x62')]['from'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))](_0x8b68('0x9e'));}if(_[_0x8b68('0x9d')](_0x16eb4c[_0x8b68('0x62')]['body'])||_0x16eb4c[_0x8b68('0x62')]['body']===''){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8b68('0x9d')](_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x9f')])){throw new db['Sequelize'][(_0x8b68('0x22'))](_0x8b68('0xa0')+_0x43e869);}if(!_['includes'](_0x43e869,_0x16eb4c[_0x8b68('0x62')]['mapKey'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))](_0x8b68('0xa1')+_0x43e869);}_0x1b12a6[_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x9f')]]=_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')];return db[_0x8b68('0xa2')][_0x8b68('0x60')]({'where':{'id':_0x16eb4c[_0x8b68('0x89')][_0x8b68('0x94')]},'include':[{'model':db['CmContact'],'as':_0x8b68('0xa3'),'where':_0x1b12a6,'limit':0x1,'order':[['updatedAt',_0x8b68('0xa4')]]}]});})[_0x8b68('0x25')](handleEntityNotFound(_0x18d02d,null))[_0x8b68('0x25')](function(_0x5d6896){if(_0x5d6896){_0x16eb4c[_0x8b68('0xa5')]=_['omit'](_0x5d6896,[_0x8b68('0xa3')]);if(_0x5d6896[_0x8b68('0xa3')]['length']){return _0x5d6896[_0x8b68('0xa3')][0x0];}var _0x4e4c0f=_[_0x8b68('0x1c')](_0x16eb4c['body'],{'firstName':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')],'ListId':_0x5d6896['id']});_0x4e4c0f[_0x16eb4c['body'][_0x8b68('0x9f')]]=_0x16eb4c[_0x8b68('0x62')]['from'];return db['CmContact']['create'](_0x4e4c0f,{'fields':_0x5a25d1,'raw':!![]});}})[_0x8b68('0x25')](handleEntityNotFound(_0x18d02d,null))[_0x8b68('0x25')](function(_0x421fd5){if(_0x421fd5){_0x16eb4c[_0x8b68('0xa6')]=_0x421fd5;var _0x54419f={'ContactId':_0x421fd5['id'],'phone':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')],'WhatsappAccountId':_0x4ca4ce[_0x8b68('0x69')]['id']};var _0x111e8b={'ContactId':_0x421fd5['id'],'WhatsappAccountId':_0x4ca4ce[_0x8b68('0x69')]['id'],'closed':![]};return db[_0x8b68('0xa7')][_0x8b68('0x60')]({'where':_0x111e8b})[_0x8b68('0x25')](function(_0x124655){if(_0x124655){return[_0x124655,![]];}return db['WhatsappInteraction'][_0x8b68('0x61')](_0x54419f)['then'](function(_0x4e5184){return[_0x4e5184,!![]];});});}})['spread'](function(_0x3b9ba6,_0x3a2e90){_0x16eb4c[_0x8b68('0xa8')]=_0x3b9ba6[_0x8b68('0x3a')]({'plain':!![]});_0x16eb4c[_0x8b68('0xa8')][_0x8b68('0xa9')]=![];if(_0x3a2e90){if(_0x16eb4c[_0x8b68('0x89')][_0x8b68('0xaa')]){_0x16eb4c[_0x8b68('0x8a')][_0x8b68('0xab')]({'id':0x0,'priority':_0x16eb4c[_0x8b68('0x8a')][_0x8b68('0x4f')]+0x1,'app':_0x8b68('0xac'),'appdata':_0x8b68('0xad'),'interval':_0x8b68('0xae')});}_0x16eb4c[_0x8b68('0xa8')]['created']=!![];}return db[_0x8b68('0xaf')][_0x8b68('0x61')]({'phone':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')],'messageId':_0x16eb4c[_0x8b68('0x62')]['messageId'],'body':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x62')],'WhatsappAccountId':_0x4ca4ce[_0x8b68('0x69')]['id'],'WhatsappInteractionId':_0x3b9ba6['id'],'direction':'in','ContactId':_0x3b9ba6[_0x8b68('0xb0')],'AttachmentId':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0xb1')]});})[_0x8b68('0x25')](function(_0x11b4a6){_0x16eb4c[_0x8b68('0x2c')]=_0x11b4a6;if(_0x16eb4c[_0x8b68('0xa8')][_0x8b68('0xb2')]){return db[_0x8b68('0x7d')]['find']({'attributes':['id','name'],'where':{'id':_0x16eb4c[_0x8b68('0xa8')][_0x8b68('0xb2')]}})['then'](function(_0x2bb536){if(_0x2bb536){_0x16eb4c[_0x8b68('0x8a')][_0x8b68('0xb3')]({'id':0x0,'priority':0x0,'app':_0x8b68('0xb4'),'appdata':_0x2bb536[_0x8b68('0x40')]+','+(_0x16eb4c['account']['waitForTheAssignedAgent']||0xa),'interval':_0x8b68('0xae')});}return respondWithRpcPromise(_0x8b68('0xb5'),'startRouting',_0x16eb4c);});}return respondWithRpcPromise(_0x8b68('0xb5'),_0x8b68('0xb6'),_0x16eb4c);})['then'](function(_0x3791e0){if(_0x3791e0){var _0x47e2ea=0xc8;var _0x2a2758=_0x8b68('0xb7');logger[_0x8b68('0x26')](_0x8b68('0x29'),_0x2a2758,_0x47e2ea,_0x8b68('0xb8'));logger[_0x8b68('0x28')](_0x8b68('0xb9'),_0x2a2758,_0x47e2ea,_0x8b68('0xb8'),JSON['stringify'](_0x3791e0));if(_0x16eb4c[_0x8b68('0x89')]['type']==='twilio'){return _0x18d02d[_0x8b68('0x2e')](_0x47e2ea)[_0x8b68('0x33')](_0x8b68('0xba'),'text/xml')['send'](_0x8b68('0xbb'));}else{return _0x18d02d['status'](_0x47e2ea)[_0x8b68('0x2f')](_0x3791e0);}}})[_0x8b68('0x5b')](handleError(_0x18d02d,null));};exports[_0x8b68('0x41')]=function(_0x4de88e,_0x22aacc,_0x4fb7f2){var _0x5968cc,_0x26047a,_0x508455;if(_[_0x8b68('0x9d')](_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')])||_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')]===''){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))](_0x8b68('0xbc'));}if(_[_0x8b68('0x9d')](_0x4de88e[_0x8b68('0x62')]['to'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))]('to\x20is\x20mandatory');}_0x5968cc=_0x4de88e[_0x8b68('0x62')]['to'];return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x4de88e[_0x8b68('0x69')]['id']},'include':[{'model':db[_0x8b68('0xa2')],'as':_0x8b68('0xbd'),'include':[{'model':db['CmContact'],'as':_0x8b68('0xa3'),'where':{'mobile':_0x5968cc},'limit':0x1,'order':[[_0x8b68('0x91'),_0x8b68('0xa4')]]}]}]})[_0x8b68('0x25')](handleEntityNotFound(_0x22aacc,null))[_0x8b68('0x25')](function(_0x3407e6){if(_0x3407e6&&_0x3407e6[_0x8b68('0xbd')]){_0x26047a=_0x3407e6[_0x8b68('0x3a')]({'plain':!![]});if(_0x26047a[_0x8b68('0xbd')]&&_0x26047a[_0x8b68('0xbd')][_0x8b68('0xa3')][_0x8b68('0x4f')]){return _0x26047a[_0x8b68('0xbd')]['Contacts'][0x0];}return db['CmContact'][_0x8b68('0x61')](_[_0x8b68('0x1c')](_0x4de88e[_0x8b68('0x62')],{'firstName':_0x5968cc,'mobile':_0x5968cc,'phone':_0x5968cc,'ListId':_0x26047a[_0x8b68('0x94')]}));}})[_0x8b68('0x25')](handleEntityNotFound(_0x22aacc,null))[_0x8b68('0x25')](function(_0x220f3b){if(_0x220f3b){_0x508455=_0x220f3b;return db[_0x8b68('0xa7')][_0x8b68('0x60')]({'where':{'ContactId':_0x508455['id'],'closed':![],'WhatsappAccountId':_0x26047a['id']}})['then'](function(_0x5406f6){if(_0x5406f6){return[_0x5406f6,![]];}return db[_0x8b68('0xa7')]['create']({'UserId':_0x4de88e[_0x8b68('0x63')]['id'],'ContactId':_0x508455['id'],'WhatsappAccountId':_0x26047a['id'],'phone':_0x5968cc,'firstMsgDirection':_0x8b68('0xbe'),'Messages':[_[_0x8b68('0x56')](_0x4de88e[_0x8b68('0x62')],{'read':![],'body':_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')],'phone':_0x5968cc,'WhatsappAccountId':_0x26047a['id'],'UserId':_0x4de88e[_0x8b68('0x63')]['id'],'ContactId':_0x508455['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x8b68('0xbf')}]})[_0x8b68('0x25')](function(_0x1273c9){return[_0x1273c9,!![]];});});}})['spread'](function(_0x1c27e5,_0x2fc6db){if(_0x2fc6db){return _0x1c27e5;}return db[_0x8b68('0xaf')][_0x8b68('0x61')](_[_0x8b68('0x56')](_0x4de88e[_0x8b68('0x62')],{'read':![],'body':_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')],'phone':_0x5968cc,'WhatsappAccountId':_0x26047a['id'],'WhatsappInteractionId':_0x1c27e5['id'],'UserId':_0x4de88e[_0x8b68('0x63')]['id'],'ContactId':_0x508455['id']}))['then'](function(_0x2a5e48){_0x1c27e5[_0x8b68('0xc0')][_0x8b68('0xbf')]=[];_0x1c27e5[_0x8b68('0xc0')][_0x8b68('0xbf')][_0x8b68('0xab')](_0x2a5e48['dataValues']);return _0x1c27e5;});})[_0x8b68('0x25')](respondWithResult(_0x22aacc,null))[_0x8b68('0x5b')](handleError(_0x22aacc,null));}; \ No newline at end of file +var _0x9354=['then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','status','json','count','offset','Content-Range','reject','update','WhatsappAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','messageId','MessageSid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','send','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.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~!@#$%^&-_=+[{]}.'];(function(_0x1b69e4,_0x2f5ef){var _0x53778c=function(_0x56cb62){while(--_0x56cb62){_0x1b69e4['push'](_0x1b69e4['shift']());}};_0x53778c(++_0x2f5ef);}(_0x9354,0x96));var _0x4935=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x9354[_0x329664];return _0x4e346e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4935('0x16')]=_[_0x4935('0x17')](config[_0x4935('0x16')],{'host':_0x4935('0x18'),'port':0x18eb});var socket=require(_0x4935('0x19'))(new Redis(config[_0x4935('0x16')]));require(_0x4935('0x1a'))[_0x4935('0x1b')](socket);var jayson=require(_0x4935('0x1c'));var client=jayson[_0x4935('0x1d')][_0x4935('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x1799e4,_0xa41961,_0x3652c4){if(_0x3652c4){var _0x24cc99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24cc99[_0x4935('0x1f')](_0xa41961)){return _0x1799e4;}else{throw new db['Sequelize'][(_0x4935('0x20'))](_0x4935('0x21'));}}else{return _0x1799e4;}}function respondWithRpcPromise(_0x165ed3,_0x123300,_0x1f0e81,_0x429ef3){return new BPromise(function(_0x4ebc63,_0xd70eff){var _0x145277=_0x429ef3||client;return _0x145277['request'](_0x165ed3,_0x1f0e81)[_0x4935('0x22')](function(_0x10407f){logger[_0x4935('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,'request\x20sent');logger[_0x4935('0x24')](_0x4935('0x25'),_0x123300,_0x4935('0x26'),JSON[_0x4935('0x27')](_0x10407f));if(_0x10407f[_0x4935('0x28')]){if(_0x10407f[_0x4935('0x28')][_0x4935('0x29')]===0x1f4){logger[_0x4935('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);return _0xd70eff(_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);}logger[_0x4935('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,_0x10407f['error'][_0x4935('0x2a')]);return _0x4ebc63(_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);}else{logger[_0x4935('0x23')](_0x4935('0x2b'),_0x123300,_0x4935('0x26'));_0x4ebc63(_0x10407f[_0x4935('0x2c')][_0x4935('0x2a')]);}})[_0x4935('0x2d')](function(_0xf4abb2){logger[_0x4935('0x28')](_0x4935('0x2b'),_0x123300,_0xf4abb2);_0xd70eff(_0xf4abb2);});});}function respondWithStatusCode(_0x2c47ab,_0xbb00d6){_0xbb00d6=_0xbb00d6||0xcc;return function(_0x359522){if(_0x359522){return _0x2c47ab['sendStatus'](_0xbb00d6);}return _0x2c47ab['status'](_0xbb00d6)['end']();};}function respondWithResult(_0x1fc218,_0x76ea7d){_0x76ea7d=_0x76ea7d||0xc8;return function(_0x4f1163){if(_0x4f1163){return _0x1fc218[_0x4935('0x2e')](_0x76ea7d)[_0x4935('0x2f')](_0x4f1163);}};}function respondWithFilteredResult(_0x24a3b6,_0x9fe9f6){return function(_0x1198e5){if(_0x1198e5){var _0x24262e=_0x1198e5[_0x4935('0x30')],_0x28afc2=_0x9fe9f6[_0x4935('0x31')],_0x2fe6da=_0x9fe9f6['offset']+_0x9fe9f6['limit'],_0x5b3c8e;if(_0x2fe6da>=_0x24262e){_0x2fe6da=_0x24262e;_0x5b3c8e=0xc8;}else{_0x5b3c8e=0xce;}_0x24a3b6[_0x4935('0x2e')](_0x5b3c8e);return _0x24a3b6['set'](_0x4935('0x32'),_0x28afc2+'-'+_0x2fe6da+'/'+_0x24262e)[_0x4935('0x2f')](_0x1198e5);}return null;};}function patchUpdates(_0x30fbc9){return function(_0x53722a){try{jsonpatch['apply'](_0x53722a,_0x30fbc9,!![]);}catch(_0x415260){return BPromise[_0x4935('0x33')](_0x415260);}return _0x53722a['save']();};}function saveUpdates(_0x47003b,_0x3260d2){return function(_0x9bfd48){if(_0x9bfd48){return _0x9bfd48[_0x4935('0x34')](_0x47003b)[_0x4935('0x22')](function(_0x4a69bc){return _0x4a69bc;});}return null;};}function removeEntity(_0x4b5c01,_0x3d8795){return function(_0x1016cc){if(_0x1016cc){return _0x1016cc['destroy']()['then'](function(){var _0xb3d934=_0x1016cc['get']({'plain':!![]});var _0x7b45d1=_0x4935('0x35');return db[_0x4935('0x36')][_0x4935('0x37')]({'where':{'type':_0x7b45d1,'resourceId':_0xb3d934['id']}})[_0x4935('0x22')](function(){return _0x1016cc;});})[_0x4935('0x22')](function(){_0x4b5c01['status'](0xcc)[_0x4935('0x38')]();});}};}function handleEntityNotFound(_0x51b7ac,_0x365e83){return function(_0x5db44b){if(!_0x5db44b){_0x51b7ac[_0x4935('0x39')](0x194);}return _0x5db44b;};}function handleError(_0x4c5a4e,_0x27ead0){_0x27ead0=_0x27ead0||0x1f4;return function(_0x59b749){logger[_0x4935('0x28')](_0x59b749[_0x4935('0x3a')]);if(_0x59b749[_0x4935('0x3b')]){delete _0x59b749[_0x4935('0x3b')];}_0x4c5a4e[_0x4935('0x2e')](_0x27ead0)['send'](_0x59b749);};}exports['index']=function(_0x2efc45,_0x4e4820){var _0x4e8b2e={'include':[{'model':db[_0x4935('0x3c')],'as':_0x4935('0x3d')}]},_0x1552b2={},_0x5c8012={'count':0x0,'rows':[]};var _0x2d67e3=_[_0x4935('0x3e')](db[_0x4935('0x3f')]['rawAttributes'],function(_0x5d4d7f){return{'name':_0x5d4d7f[_0x4935('0x40')],'type':_0x5d4d7f[_0x4935('0x41')][_0x4935('0x42')]};});_0x1552b2[_0x4935('0x43')]=_[_0x4935('0x3e')](_0x2d67e3,_0x4935('0x3b'));_0x1552b2[_0x4935('0x44')]=_[_0x4935('0x45')](_0x2efc45['query']);_0x1552b2['filters']=_[_0x4935('0x46')](_0x1552b2[_0x4935('0x43')],_0x1552b2['query']);_0x4e8b2e[_0x4935('0x47')]=_[_0x4935('0x46')](_0x1552b2[_0x4935('0x43')],qs[_0x4935('0x48')](_0x2efc45['query']['fields']));_0x4e8b2e[_0x4935('0x47')]=_0x4e8b2e[_0x4935('0x47')]['length']?_0x4e8b2e[_0x4935('0x47')]:_0x1552b2[_0x4935('0x43')];if(!_0x2efc45[_0x4935('0x44')]['hasOwnProperty'](_0x4935('0x49'))){_0x4e8b2e[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x2efc45[_0x4935('0x44')][_0x4935('0x4a')]);_0x4e8b2e[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x2efc45[_0x4935('0x44')][_0x4935('0x31')]);}_0x4e8b2e[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x2efc45[_0x4935('0x44')][_0x4935('0x4c')]);_0x4e8b2e[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x2efc45[_0x4935('0x44')],_0x1552b2[_0x4935('0x4e')]),_0x2d67e3);if(_0x2efc45['query'][_0x4935('0x50')]){_0x4e8b2e['where']=_[_0x4935('0x51')](_0x4e8b2e[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x2d67e3,function(_0x33e94a){if(_0x33e94a['type']!==_0x4935('0x52')){var _0x9c8bad={};_0x9c8bad[_0x33e94a[_0x4935('0x3b')]]={'$like':'%'+_0x2efc45[_0x4935('0x44')][_0x4935('0x50')]+'%'};return _0x9c8bad;}})});}_0x4e8b2e=_[_0x4935('0x51')]({},_0x4e8b2e,_0x2efc45[_0x4935('0x53')]);var _0x31d137={'where':_0x4e8b2e[_0x4935('0x4d')]};return db[_0x4935('0x3f')]['count'](_0x31d137)[_0x4935('0x22')](function(_0x1c3d9c){_0x5c8012['count']=_0x1c3d9c;if(_0x2efc45[_0x4935('0x44')][_0x4935('0x54')]){_0x4e8b2e[_0x4935('0x55')]=[{'all':!![]}];}return db[_0x4935('0x3f')][_0x4935('0x56')](_0x4e8b2e);})[_0x4935('0x22')](function(_0x289c5e){_0x5c8012[_0x4935('0x57')]=_0x289c5e;return _0x5c8012;})['then'](respondWithFilteredResult(_0x4e4820,_0x4e8b2e))[_0x4935('0x2d')](handleError(_0x4e4820,null));};exports['show']=function(_0x561fa3,_0x15ce51){var _0x189071={'raw':![],'where':{'id':_0x561fa3[_0x4935('0x58')]['id']},'include':[{'model':db[_0x4935('0x3c')],'as':'mandatoryDispositionPause'}]},_0x41c6d0={};_0x41c6d0[_0x4935('0x43')]=_[_0x4935('0x45')](db[_0x4935('0x3f')][_0x4935('0x59')]);_0x41c6d0[_0x4935('0x44')]=_[_0x4935('0x45')](_0x561fa3[_0x4935('0x44')]);_0x41c6d0[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x41c6d0[_0x4935('0x43')],_0x41c6d0['query']);_0x189071[_0x4935('0x47')]=_['intersection'](_0x41c6d0[_0x4935('0x43')],qs[_0x4935('0x48')](_0x561fa3['query'][_0x4935('0x48')]));_0x189071['attributes']=_0x189071['attributes']['length']?_0x189071[_0x4935('0x47')]:_0x41c6d0[_0x4935('0x43')];if(_0x561fa3[_0x4935('0x44')][_0x4935('0x54')]){_0x189071[_0x4935('0x55')]=[{'all':!![]}];}_0x189071=_['merge']({},_0x189071,_0x561fa3['options']);return db[_0x4935('0x3f')][_0x4935('0x5a')](_0x189071)[_0x4935('0x22')](handleEntityNotFound(_0x15ce51,null))['then'](respondWithResult(_0x15ce51,null))[_0x4935('0x2d')](handleError(_0x15ce51,null));};exports[_0x4935('0x5b')]=function(_0x24141a,_0xc92288){return db['WhatsappAccount'][_0x4935('0x5b')](_0x24141a['body'],{})['then'](function(_0x513b0e){var _0x24d870=_0x24141a[_0x4935('0x5c')]['get']({'plain':!![]});if(!_0x24d870)throw new Error(_0x4935('0x5d'));if(_0x24d870[_0x4935('0x5e')]==='user'){var _0x114a96=_0x513b0e[_0x4935('0x5f')]({'plain':!![]});var _0x3551b6=_0x4935('0x35');return db[_0x4935('0x60')][_0x4935('0x5a')]({'where':{'name':_0x3551b6,'userProfileId':_0x24d870[_0x4935('0x61')]},'raw':!![]})['then'](function(_0x31b426){if(_0x31b426&&_0x31b426['autoAssociation']===0x0){return db['UserProfileResource'][_0x4935('0x5b')]({'name':_0x114a96[_0x4935('0x3b')],'resourceId':_0x114a96['id'],'type':_0x31b426['name'],'sectionId':_0x31b426['id']},{})['then'](function(){return _0x513b0e;});}else{return _0x513b0e;}})[_0x4935('0x2d')](function(_0x24841d){logger[_0x4935('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24841d);throw _0x24841d;});}return _0x513b0e;})[_0x4935('0x22')](respondWithResult(_0xc92288,0xc9))['catch'](handleError(_0xc92288,null));};exports[_0x4935('0x34')]=function(_0x3d2005,_0x10b18b){if(_0x3d2005[_0x4935('0x62')]['id']){delete _0x3d2005[_0x4935('0x62')]['id'];}return db['WhatsappAccount'][_0x4935('0x5a')]({'where':{'id':_0x3d2005[_0x4935('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x4935('0x3d')}]})[_0x4935('0x22')](handleEntityNotFound(_0x10b18b,null))[_0x4935('0x22')](saveUpdates(_0x3d2005[_0x4935('0x62')],null))[_0x4935('0x22')](respondWithResult(_0x10b18b,null))[_0x4935('0x2d')](handleError(_0x10b18b,null));};exports[_0x4935('0x37')]=function(_0x3e8b18,_0x15ebcc){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x3e8b18['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x15ebcc,null))[_0x4935('0x22')](removeEntity(_0x15ebcc,null))[_0x4935('0x2d')](handleError(_0x15ebcc,null));};exports[_0x4935('0x63')]=function(_0x45c56c,_0x95da52){return db[_0x4935('0x3f')][_0x4935('0x63')]()[_0x4935('0x22')](respondWithResult(_0x95da52,null))[_0x4935('0x2d')](handleError(_0x95da52,null));};exports[_0x4935('0x64')]=function(_0x225a1a,_0x3a427c,_0x4824fd){if(_0x225a1a['body']['id']){delete _0x225a1a[_0x4935('0x62')]['id'];}return db[_0x4935('0x3f')]['find']({'where':{'id':_0x225a1a[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x3a427c,null))['then'](function(_0x4c5cdc){if(_0x4c5cdc){_0x225a1a[_0x4935('0x62')][_0x4935('0x65')]=_0x4c5cdc['id'];return db[_0x4935('0x66')][_0x4935('0x5b')](_0x225a1a[_0x4935('0x62')]);}})['then'](respondWithResult(_0x3a427c,null))[_0x4935('0x2d')](handleError(_0x3a427c,null));};exports[_0x4935('0x67')]=function(_0x26bbe,_0x15232f,_0x583964){var _0xd97c04={'raw':![],'where':{}};var _0x4c235f={};var _0x54be3b={'count':0x0,'rows':[]};return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x26bbe['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x15232f,null))[_0x4935('0x22')](function(_0xfa309e){if(_0xfa309e){_0x4c235f['model']=_[_0x4935('0x45')](db['Disposition']['rawAttributes']);_0x4c235f[_0x4935('0x44')]=_[_0x4935('0x45')](_0x26bbe[_0x4935('0x44')]);_0x4c235f[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x4c235f[_0x4935('0x43')],_0x4c235f[_0x4935('0x44')]);_0xd97c04[_0x4935('0x47')]=_['intersection'](_0x4c235f[_0x4935('0x43')],qs[_0x4935('0x48')](_0x26bbe[_0x4935('0x44')]['fields']));_0xd97c04['attributes']=_0xd97c04[_0x4935('0x47')][_0x4935('0x69')]?_0xd97c04['attributes']:_0x4c235f[_0x4935('0x43')];if(!_0x26bbe['query']['hasOwnProperty'](_0x4935('0x49'))){_0xd97c04[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x26bbe['query']['limit']);_0xd97c04[_0x4935('0x31')]=qs['offset'](_0x26bbe[_0x4935('0x44')]['offset']);}_0xd97c04[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x26bbe[_0x4935('0x44')][_0x4935('0x4c')]);_0xd97c04[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x26bbe['query'],_0x4c235f[_0x4935('0x4e')]));_0xd97c04['where'][_0x4935('0x65')]=_0xfa309e['id'];if(_0x26bbe[_0x4935('0x44')]['filter']){_0xd97c04[_0x4935('0x4d')]=_['merge'](_0xd97c04[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0xd97c04['attributes'],function(_0x582a2c){var _0x530e9f={};_0x530e9f[_0x582a2c]={'$like':'%'+_0x26bbe[_0x4935('0x44')]['filter']+'%'};return _0x530e9f;})});}_0xd97c04=_['merge']({},_0xd97c04,_0x26bbe[_0x4935('0x53')]);return db['Disposition'][_0x4935('0x30')]({'where':_0xd97c04['where']})['then'](function(_0x5c5978){_0x54be3b[_0x4935('0x30')]=_0x5c5978;if(_0x26bbe['query'][_0x4935('0x54')]){_0xd97c04[_0x4935('0x55')]=[{'all':!![]}];}return db[_0x4935('0x66')][_0x4935('0x56')](_0xd97c04);})[_0x4935('0x22')](function(_0x4a240b){_0x54be3b[_0x4935('0x57')]=_0x4a240b;return _0x54be3b;});}})[_0x4935('0x22')](respondWithFilteredResult(_0x15232f,_0xd97c04))['catch'](handleError(_0x15232f,null));};exports[_0x4935('0x6a')]=function(_0x9d01a9,_0x50df2a,_0x1ffef1){return db[_0x4935('0x3f')]['find']({'where':{'id':_0x9d01a9[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0x50df2a,null))[_0x4935('0x22')](function(_0x453bb1){if(_0x453bb1){return _0x453bb1['removeDispositions'](_0x9d01a9[_0x4935('0x44')][_0x4935('0x6b')]);}})['then'](respondWithStatusCode(_0x50df2a,null))['catch'](handleError(_0x50df2a,null));};exports[_0x4935('0x6c')]=function(_0x14dbfa,_0x49a767,_0x27ce22){if(_0x14dbfa[_0x4935('0x62')]['id']){delete _0x14dbfa[_0x4935('0x62')]['id'];}return db[_0x4935('0x3f')]['find']({'where':{'id':_0x14dbfa[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x49a767,null))['then'](function(_0x2f7897){if(_0x2f7897){_0x14dbfa[_0x4935('0x62')][_0x4935('0x65')]=_0x2f7897['id'];return db[_0x4935('0x6d')][_0x4935('0x5b')](_0x14dbfa[_0x4935('0x62')]);}})[_0x4935('0x22')](respondWithResult(_0x49a767,null))[_0x4935('0x2d')](handleError(_0x49a767,null));};exports[_0x4935('0x6e')]=function(_0x2978d7,_0x34f3d4,_0x50a14b){var _0x394367={'raw':![],'where':{}};var _0x3e8e54={};var _0x1e6d84={'count':0x0,'rows':[]};return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x2978d7['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x34f3d4,null))[_0x4935('0x22')](function(_0x4b9b39){if(_0x4b9b39){_0x3e8e54[_0x4935('0x43')]=_[_0x4935('0x45')](db['CannedAnswer'][_0x4935('0x59')]);_0x3e8e54[_0x4935('0x44')]=_[_0x4935('0x45')](_0x2978d7['query']);_0x3e8e54[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x3e8e54[_0x4935('0x43')],_0x3e8e54[_0x4935('0x44')]);_0x394367[_0x4935('0x47')]=_['intersection'](_0x3e8e54[_0x4935('0x43')],qs[_0x4935('0x48')](_0x2978d7[_0x4935('0x44')][_0x4935('0x48')]));_0x394367[_0x4935('0x47')]=_0x394367[_0x4935('0x47')]['length']?_0x394367[_0x4935('0x47')]:_0x3e8e54[_0x4935('0x43')];if(!_0x2978d7[_0x4935('0x44')][_0x4935('0x6f')](_0x4935('0x49'))){_0x394367[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x2978d7['query'][_0x4935('0x4a')]);_0x394367[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x2978d7[_0x4935('0x44')][_0x4935('0x31')]);}_0x394367['order']=qs['sort'](_0x2978d7[_0x4935('0x44')][_0x4935('0x4c')]);_0x394367[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x2978d7['query'],_0x3e8e54[_0x4935('0x4e')]));_0x394367[_0x4935('0x4d')][_0x4935('0x65')]=_0x4b9b39['id'];if(_0x2978d7['query'][_0x4935('0x50')]){_0x394367[_0x4935('0x4d')]=_[_0x4935('0x51')](_0x394367[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x394367[_0x4935('0x47')],function(_0xe60fe){var _0x47e1dd={};_0x47e1dd[_0xe60fe]={'$like':'%'+_0x2978d7[_0x4935('0x44')]['filter']+'%'};return _0x47e1dd;})});}_0x394367=_[_0x4935('0x51')]({},_0x394367,_0x2978d7['options']);return db['CannedAnswer'][_0x4935('0x30')]({'where':_0x394367['where']})['then'](function(_0x213fe3){_0x1e6d84[_0x4935('0x30')]=_0x213fe3;if(_0x2978d7['query'][_0x4935('0x54')]){_0x394367['include']=[{'all':!![]}];}return db[_0x4935('0x6d')][_0x4935('0x56')](_0x394367);})[_0x4935('0x22')](function(_0x22a8b8){_0x1e6d84[_0x4935('0x57')]=_0x22a8b8;return _0x1e6d84;});}})[_0x4935('0x22')](respondWithFilteredResult(_0x34f3d4,_0x394367))['catch'](handleError(_0x34f3d4,null));};exports[_0x4935('0x70')]=function(_0x16b1bb,_0xce134a,_0x5d53e6){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x16b1bb[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0xce134a,null))[_0x4935('0x22')](function(_0x44031e){if(_0x44031e){return _0x44031e[_0x4935('0x70')](_0x16b1bb[_0x4935('0x44')][_0x4935('0x6b')]);}})['then'](respondWithStatusCode(_0xce134a,null))[_0x4935('0x2d')](handleError(_0xce134a,null));};exports['addAgents']=function(_0x19fe30,_0x4bc3e7,_0x17dc59){return db['WhatsappAccount'][_0x4935('0x5a')]({'where':{'id':_0x19fe30[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4bc3e7,null))['then'](function(_0x31d209){if(_0x31d209){return _0x31d209[_0x4935('0x71')](_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')],_[_0x4935('0x72')](_0x19fe30[_0x4935('0x62')],[_0x4935('0x6b'),'id'])||{})[_0x4935('0x73')](function(_0xc4ce1d){for(var _0x575ca2=0x0;_0x575ca2<_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')][_0x4935('0x69')];_0x575ca2+=0x1){socket[_0x4935('0x74')](_0x4935('0x75'),{'UserId':_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')][_0x575ca2],'WhatsappAccountId':_0x19fe30['params']['id']});}return _0xc4ce1d;});}})['then'](respondWithResult(_0x4bc3e7,null))[_0x4935('0x2d')](handleError(_0x4bc3e7,null));};exports['removeAgents']=function(_0x47ee06,_0x451ea8,_0x3a4266){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x47ee06['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x451ea8,null))[_0x4935('0x22')](function(_0x59e6b4){if(_0x59e6b4){return _0x59e6b4['removeAgents'](_0x47ee06['query']['ids'])['then'](function(){if(_[_0x4935('0x76')](_0x47ee06[_0x4935('0x44')]['ids'])){for(var _0x492bfb=0x0;_0x492bfb<_0x47ee06['query'][_0x4935('0x6b')][_0x4935('0x69')];_0x492bfb+=0x1){socket[_0x4935('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x47ee06['query']['ids'][_0x492bfb]),'WhatsappAccountId':Number(_0x47ee06[_0x4935('0x58')]['id'])});}}else{socket[_0x4935('0x74')](_0x4935('0x77'),{'UserId':Number(_0x47ee06[_0x4935('0x44')]['ids']),'WhatsappAccountId':Number(_0x47ee06[_0x4935('0x58')]['id'])});}});}})[_0x4935('0x22')](respondWithStatusCode(_0x451ea8,null))[_0x4935('0x2d')](handleError(_0x451ea8,null));};exports['getAgents']=function(_0x4f6984,_0x3568ea,_0x2f4b61){var _0x81f969={};var _0x281db3={};var _0x415fc2;var _0x255a60;return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x4f6984[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0x3568ea,null))[_0x4935('0x22')](function(_0x4120db){if(_0x4120db){_0x415fc2=_0x4120db;_0x281db3['model']=_['keys'](db[_0x4935('0x78')]['rawAttributes']);_0x281db3[_0x4935('0x44')]=_[_0x4935('0x45')](_0x4f6984['query']);_0x281db3[_0x4935('0x4e')]=_['intersection'](_0x281db3[_0x4935('0x43')],_0x281db3[_0x4935('0x44')]);_0x81f969['attributes']=_['intersection'](_0x281db3[_0x4935('0x43')],qs[_0x4935('0x48')](_0x4f6984[_0x4935('0x44')][_0x4935('0x48')]));_0x81f969[_0x4935('0x47')]=_0x81f969[_0x4935('0x47')][_0x4935('0x69')]?_0x81f969[_0x4935('0x47')]:_0x281db3['model'];_0x81f969['order']=qs[_0x4935('0x4c')](_0x4f6984[_0x4935('0x44')][_0x4935('0x4c')]);_0x81f969[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x4f6984[_0x4935('0x44')],_0x281db3[_0x4935('0x4e')]));if(_0x4f6984['query'][_0x4935('0x50')]){_0x81f969['where']=_[_0x4935('0x51')](_0x81f969['where'],{'$or':_[_0x4935('0x3e')](_0x81f969[_0x4935('0x47')],function(_0x31eaee){var _0x409d86={};_0x409d86[_0x31eaee]={'$like':'%'+_0x4f6984[_0x4935('0x44')]['filter']+'%'};return _0x409d86;})});}_0x81f969=_[_0x4935('0x51')]({},_0x81f969,_0x4f6984[_0x4935('0x53')]);return _0x415fc2[_0x4935('0x79')](_0x81f969);}})['then'](function(_0x4d4085){if(_0x4d4085){_0x255a60=_0x4d4085[_0x4935('0x69')];if(!_0x4f6984['query'][_0x4935('0x6f')](_0x4935('0x49'))){_0x81f969[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x4f6984[_0x4935('0x44')]['limit']);_0x81f969[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x4f6984[_0x4935('0x44')][_0x4935('0x31')]);}return _0x415fc2[_0x4935('0x79')](_0x81f969);}})['then'](function(_0x1058f2){if(_0x1058f2){return _0x1058f2?{'count':_0x255a60,'rows':_0x1058f2}:null;}})[_0x4935('0x22')](respondWithResult(_0x3568ea,null))[_0x4935('0x2d')](handleError(_0x3568ea,null));};exports[_0x4935('0x7a')]=function(_0x51a95e,_0x4aa286,_0x5b303b){return db['WhatsappAccount'][_0x4935('0x68')]({'where':{'id':_0x51a95e[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4aa286,null))[_0x4935('0x22')](function(_0x13921c){if(_0x13921c){return db[_0x4935('0x7b')][_0x4935('0x7c')](function(_0x9afab9){return db[_0x4935('0x7d')][_0x4935('0x37')]({'where':{'WhatsappAccountId':_0x51a95e['params']['id']},'transaction':_0x9afab9})[_0x4935('0x22')](function(_0x3508ac){var _0x37f88a=_[_0x4935('0x3e')](_0x51a95e[_0x4935('0x62')],function(_0x8ef56f){_0x8ef56f[_0x4935('0x65')]=_0x51a95e[_0x4935('0x58')]['id'];return _0x8ef56f;});return db[_0x4935('0x7d')]['bulkCreate'](_0x37f88a,{'transaction':_0x9afab9});});})['then'](function(){return db[_0x4935('0x7d')][_0x4935('0x7e')]({'where':{'WhatsappAccountId':_0x51a95e[_0x4935('0x58')]['id']},'order':_0x4935('0x7f')});});}})[_0x4935('0x22')](respondWithResult(_0x4aa286,null))[_0x4935('0x2d')](handleError(_0x4aa286,null));};exports[_0x4935('0x80')]=function(_0x15b50e,_0x4c6b62,_0xc2892a){var _0x290e25={};var _0x4f968d={};var _0x46f309;var _0x4bfd8f;return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x15b50e[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4c6b62,null))[_0x4935('0x22')](function(_0x37a095){if(_0x37a095){_0x46f309=_0x37a095;_0x4f968d[_0x4935('0x43')]=_[_0x4935('0x45')](db[_0x4935('0x7d')][_0x4935('0x59')]);_0x4f968d['query']=_[_0x4935('0x45')](_0x15b50e['query']);_0x4f968d[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x4f968d[_0x4935('0x43')],_0x4f968d[_0x4935('0x44')]);_0x290e25[_0x4935('0x47')]=_['intersection'](_0x4f968d[_0x4935('0x43')],qs[_0x4935('0x48')](_0x15b50e[_0x4935('0x44')][_0x4935('0x48')]));_0x290e25[_0x4935('0x47')]=_0x290e25[_0x4935('0x47')][_0x4935('0x69')]?_0x290e25[_0x4935('0x47')]:_0x4f968d[_0x4935('0x43')];_0x290e25[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x15b50e[_0x4935('0x44')]['sort']);_0x290e25[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x15b50e['query'],_0x4f968d[_0x4935('0x4e')]));if(_0x15b50e['query'][_0x4935('0x50')]){_0x290e25[_0x4935('0x4d')]=_[_0x4935('0x51')](_0x290e25[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x290e25['attributes'],function(_0x3450d2){var _0x380f3d={};_0x380f3d[_0x3450d2]={'$like':'%'+_0x15b50e[_0x4935('0x44')][_0x4935('0x50')]+'%'};return _0x380f3d;})});}_0x290e25=_['merge']({},_0x290e25,_0x15b50e[_0x4935('0x53')]);return _0x46f309[_0x4935('0x80')](_0x290e25);}})[_0x4935('0x22')](function(_0x44de80){if(_0x44de80){_0x4bfd8f=_0x44de80[_0x4935('0x69')];if(!_0x15b50e[_0x4935('0x44')][_0x4935('0x6f')](_0x4935('0x49'))){_0x290e25['limit']=qs[_0x4935('0x4a')](_0x15b50e[_0x4935('0x44')][_0x4935('0x4a')]);_0x290e25['offset']=qs[_0x4935('0x31')](_0x15b50e[_0x4935('0x44')]['offset']);}return _0x46f309['getApplications'](_0x290e25);}})[_0x4935('0x22')](function(_0x30f6cd){if(_0x30f6cd){return _0x30f6cd?{'count':_0x4bfd8f,'rows':_0x30f6cd}:null;}})[_0x4935('0x22')](respondWithResult(_0x4c6b62,null))['catch'](handleError(_0x4c6b62,null));};exports['notify']=function(_0x4d0fc2,_0x1488f3,_0x8ca869){var _0x215de6={'channel':_0x4935('0x81')};var _0x303e9e=[];var _0x4ccbb7=[];var _0x15c87c={};return db['WhatsappAccount']['find']({'where':{'id':_0x4d0fc2['params']['id']},'include':[{'model':db[_0x4935('0x7d')],'as':_0x4935('0x82')}]})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))['then'](function(_0x384144){_0x215de6[_0x4935('0x83')]=_0x384144;_0x215de6[_0x4935('0x84')]=_['orderBy'](_0x384144[_0x4935('0x82')],[_0x4935('0x7f')],['asc']);if(_0x215de6['account'][_0x4935('0x82')]){delete _0x215de6['account'][_0x4935('0x82')];}return db[_0x4935('0x85')]['describe']();})[_0x4935('0x22')](function(_0x47a116){if(!_0x47a116){throw new db['Sequelize'][(_0x4935('0x20'))](_0x4935('0x86'));}_0x303e9e=_[_0x4935('0x87')](_[_0x4935('0x45')](_0x47a116),[_0x4935('0x88'),_0x4935('0x89')]);_0x4ccbb7=_[_0x4935('0x87')](_['keys'](_0x47a116),[_0x4935('0x88'),'updatedAt',_0x4935('0x8a'),_0x4935('0x8b')]);_0x215de6[_0x4935('0x62')]={'mapKey':_0x4935('0x8c')};if(_0x215de6[_0x4935('0x83')][_0x4935('0x41')]&&_0x215de6['account']['type']===_0x4935('0x8d')){_0x215de6[_0x4935('0x62')][_0x4935('0x8e')]=_0x4d0fc2[_0x4935('0x62')][_0x4935('0x8f')][_0x4935('0x90')]('whatsapp:','');_0x215de6[_0x4935('0x62')][_0x4935('0x62')]=_0x4d0fc2[_0x4935('0x62')]['Body'];_0x215de6['body'][_0x4935('0x91')]=_0x4d0fc2[_0x4935('0x62')][_0x4935('0x92')];}if(_0x215de6[_0x4935('0x62')]['id']){delete _0x215de6['body']['id'];}if(_[_0x4935('0x93')](_0x215de6[_0x4935('0x62')][_0x4935('0x8e')])){throw new db['Sequelize']['ValidationError'](_0x4935('0x94'));}if(_[_0x4935('0x93')](_0x215de6['body']['body'])||_0x215de6[_0x4935('0x62')][_0x4935('0x62')]===''){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x96'));}if(_[_0x4935('0x93')](_0x215de6['body'][_0x4935('0x97')])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x98')+_0x4ccbb7);}if(!_[_0x4935('0x99')](_0x4ccbb7,_0x215de6[_0x4935('0x62')]['mapKey'])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ccbb7);}_0x15c87c[_0x215de6[_0x4935('0x62')][_0x4935('0x97')]]=_0x215de6[_0x4935('0x62')]['from'];return db[_0x4935('0x9a')]['find']({'where':{'id':_0x215de6[_0x4935('0x83')]['ListId']},'include':[{'model':db[_0x4935('0x85')],'as':'Contacts','where':_0x15c87c,'limit':0x1,'order':[[_0x4935('0x89'),_0x4935('0x9b')]]}]});})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))[_0x4935('0x22')](function(_0x480708){if(_0x480708){_0x215de6[_0x4935('0x9c')]=_[_0x4935('0x72')](_0x480708,[_0x4935('0x9d')]);if(_0x480708[_0x4935('0x9d')][_0x4935('0x69')]){return _0x480708[_0x4935('0x9d')][0x0];}var _0x512e48=_['defaults'](_0x215de6['body'],{'firstName':_0x215de6['body']['from'],'ListId':_0x480708['id']});_0x512e48[_0x215de6[_0x4935('0x62')][_0x4935('0x97')]]=_0x215de6['body'][_0x4935('0x8e')];return db['CmContact'][_0x4935('0x5b')](_0x512e48,{'fields':_0x303e9e,'raw':!![]});}})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))['then'](function(_0x59154b){if(_0x59154b){_0x215de6[_0x4935('0x9e')]=_0x59154b;var _0x9d154a={'ContactId':_0x59154b['id'],'phone':_0x215de6['body']['from'],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id']};var _0x5bc89d={'ContactId':_0x59154b['id'],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x4935('0x5a')]({'where':_0x5bc89d})[_0x4935('0x22')](function(_0x2b47e8){if(_0x2b47e8){return[_0x2b47e8,![]];}return db[_0x4935('0x9f')][_0x4935('0x5b')](_0x9d154a)[_0x4935('0x22')](function(_0x3c61a9){return[_0x3c61a9,!![]];});});}})[_0x4935('0x73')](function(_0x4e1079,_0x48b8f5){_0x215de6[_0x4935('0xa0')]=_0x4e1079[_0x4935('0x5f')]({'plain':!![]});_0x215de6[_0x4935('0xa0')]['created']=![];if(_0x48b8f5){if(_0x215de6['account'][_0x4935('0xa1')]){_0x215de6['applications'][_0x4935('0xa2')]({'id':0x0,'priority':_0x215de6[_0x4935('0x84')][_0x4935('0x69')]+0x1,'app':'close','appdata':_0x4935('0xa3'),'interval':_0x4935('0xa4')});}_0x215de6[_0x4935('0xa0')][_0x4935('0xa5')]=!![];}return db[_0x4935('0xa6')][_0x4935('0x5b')]({'phone':_0x215de6[_0x4935('0x62')][_0x4935('0x8e')],'messageId':_0x215de6[_0x4935('0x62')][_0x4935('0x91')],'body':_0x215de6[_0x4935('0x62')][_0x4935('0x62')],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id'],'WhatsappInteractionId':_0x4e1079['id'],'direction':'in','ContactId':_0x4e1079[_0x4935('0xa7')],'AttachmentId':_0x215de6['body'][_0x4935('0xa8')]});})[_0x4935('0x22')](function(_0x445218){_0x215de6[_0x4935('0x2a')]=_0x445218;if(_0x215de6[_0x4935('0xa0')][_0x4935('0xa9')]){return db[_0x4935('0x78')][_0x4935('0x5a')]({'attributes':['id',_0x4935('0x3b')],'where':{'id':_0x215de6[_0x4935('0xa0')][_0x4935('0xa9')]}})[_0x4935('0x22')](function(_0x3a3f21){if(_0x3a3f21){_0x215de6[_0x4935('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4935('0xaa'),'appdata':_0x3a3f21[_0x4935('0x3b')]+','+(_0x215de6[_0x4935('0x83')][_0x4935('0xab')]||0xa),'interval':_0x4935('0xa4')});}return respondWithRpcPromise(_0x4935('0xac'),_0x4935('0xad'),_0x215de6);});}return respondWithRpcPromise(_0x4935('0xac'),'startRouting',_0x215de6);})['then'](function(_0x4ec0bb){if(_0x4ec0bb){var _0x1e0387=0xc8;var _0xbdfff=_0x4935('0xae');logger['info'](_0x4935('0x25'),_0xbdfff,_0x1e0387,_0x4935('0xaf'));logger[_0x4935('0x24')](_0x4935('0xb0'),_0xbdfff,_0x1e0387,_0x4935('0xaf'),JSON[_0x4935('0x27')](_0x4ec0bb));if(_0x215de6[_0x4935('0x83')]['type']===_0x4935('0x8d')){return _0x1488f3[_0x4935('0x2e')](_0x1e0387)[_0x4935('0xb1')](_0x4935('0xb2'),'text/xml')[_0x4935('0xb3')]('\x0a');}else{return _0x1488f3[_0x4935('0x2e')](_0x1e0387)['json'](_0x4ec0bb);}}})[_0x4935('0x2d')](handleError(_0x1488f3,null));};exports[_0x4935('0xb3')]=function(_0x4d26cc,_0x21d58e,_0x1603a3){var _0x12b0be,_0x80f86f,_0x594ae5;if(_[_0x4935('0x93')](_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')])||_0x4d26cc[_0x4935('0x62')]['body']===''){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x96'));}if(_[_0x4935('0x93')](_0x4d26cc[_0x4935('0x62')]['to'])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))]('to\x20is\x20mandatory');}_0x12b0be=_0x4d26cc[_0x4935('0x62')]['to'];return db[_0x4935('0x3f')]['find']({'where':{'id':_0x4d26cc[_0x4935('0x58')]['id']},'include':[{'model':db[_0x4935('0x9a')],'as':'List','include':[{'model':db[_0x4935('0x85')],'as':_0x4935('0x9d'),'where':{'mobile':_0x12b0be},'limit':0x1,'order':[[_0x4935('0x89'),'DESC']]}]}]})[_0x4935('0x22')](handleEntityNotFound(_0x21d58e,null))[_0x4935('0x22')](function(_0x3414ef){if(_0x3414ef&&_0x3414ef['List']){_0x80f86f=_0x3414ef[_0x4935('0x5f')]({'plain':!![]});if(_0x80f86f[_0x4935('0xb4')]&&_0x80f86f[_0x4935('0xb4')][_0x4935('0x9d')][_0x4935('0x69')]){return _0x80f86f[_0x4935('0xb4')][_0x4935('0x9d')][0x0];}return db[_0x4935('0x85')][_0x4935('0x5b')](_[_0x4935('0x17')](_0x4d26cc[_0x4935('0x62')],{'firstName':_0x12b0be,'mobile':_0x12b0be,'phone':_0x12b0be,'ListId':_0x80f86f['ListId']}));}})[_0x4935('0x22')](handleEntityNotFound(_0x21d58e,null))['then'](function(_0x1f705e){if(_0x1f705e){_0x594ae5=_0x1f705e;return db[_0x4935('0x9f')][_0x4935('0x5a')]({'where':{'ContactId':_0x594ae5['id'],'closed':![],'WhatsappAccountId':_0x80f86f['id']}})[_0x4935('0x22')](function(_0x1ed5c3){if(_0x1ed5c3){return[_0x1ed5c3,![]];}return db['WhatsappInteraction'][_0x4935('0x5b')]({'UserId':_0x4d26cc['user']['id'],'ContactId':_0x594ae5['id'],'WhatsappAccountId':_0x80f86f['id'],'phone':_0x12b0be,'firstMsgDirection':_0x4935('0xb5'),'Messages':[_[_0x4935('0x51')](_0x4d26cc[_0x4935('0x62')],{'read':![],'body':_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')],'phone':_0x12b0be,'WhatsappAccountId':_0x80f86f['id'],'UserId':_0x4d26cc[_0x4935('0x5c')]['id'],'ContactId':_0x594ae5['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x4935('0xb6')}]})[_0x4935('0x22')](function(_0xb8fab5){return[_0xb8fab5,!![]];});});}})[_0x4935('0x73')](function(_0x5a6050,_0x16f8e2){if(_0x16f8e2){return _0x5a6050;}return db['WhatsappMessage']['create'](_[_0x4935('0x51')](_0x4d26cc['body'],{'read':![],'body':_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')],'phone':_0x12b0be,'WhatsappAccountId':_0x80f86f['id'],'WhatsappInteractionId':_0x5a6050['id'],'UserId':_0x4d26cc[_0x4935('0x5c')]['id'],'ContactId':_0x594ae5['id']}))[_0x4935('0x22')](function(_0x37f9b6){_0x5a6050[_0x4935('0xb7')]['Messages']=[];_0x5a6050['dataValues'][_0x4935('0xb6')][_0x4935('0xa2')](_0x37f9b6['dataValues']);return _0x5a6050;});})[_0x4935('0x22')](respondWithResult(_0x21d58e,null))[_0x4935('0x2d')](handleError(_0x21d58e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 1da4f07..6c08f28 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 _0x8af6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8af6,0x76));var _0x68af=function(_0x8ef6ea,_0x325bc1){_0x8ef6ea=_0x8ef6ea-0x0;var _0x5f47a6=_0x8af6[_0x8ef6ea];return _0x5f47a6;};'use strict';var EventEmitter=require(_0x68af('0x0'));var WhatsappAccount=require(_0x68af('0x1'))['db'][_0x68af('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x68af('0x3')](0x0);var events={'afterCreate':_0x68af('0x4'),'afterUpdate':_0x68af('0x5'),'afterDestroy':_0x68af('0x6')};function emitEvent(_0xe2ba54){return function(_0x1f8b3a,_0x3d1c16,_0x52bd87){WhatsappAccountEvents[_0x68af('0x7')](_0xe2ba54+':'+_0x1f8b3a['id'],_0x1f8b3a);WhatsappAccountEvents['emit'](_0xe2ba54,_0x1f8b3a);_0x52bd87(null);};}for(var e in events){if(events[_0x68af('0x8')](e)){var event=events[e];WhatsappAccount[_0x68af('0x9')](e,emitEvent(event));}}module[_0x68af('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcde7=['setMaxListeners','save','emit','hasOwnProperty','hook','WhatsappAccount'];(function(_0x5707d2,_0x539996){var _0x42a889=function(_0x54092d){while(--_0x54092d){_0x5707d2['push'](_0x5707d2['shift']());}};_0x42a889(++_0x539996);}(_0xcde7,0x65));var _0x7cde=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcde7[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x7cde('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7cde('0x1')](0x0);var events={'afterCreate':_0x7cde('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11004a){return function(_0x47962e,_0x23ec50,_0x5824bf){WhatsappAccountEvents[_0x7cde('0x3')](_0x11004a+':'+_0x47962e['id'],_0x47962e);WhatsappAccountEvents[_0x7cde('0x3')](_0x11004a,_0x47962e);_0x5824bf(null);};}for(var e in events){if(events[_0x7cde('0x4')](e)){var event=events[e];WhatsappAccount[_0x7cde('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2aedc5f..7840c07 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 _0x750d=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','api','moment','path','rimraf','../../config/environment'];(function(_0x28ff19,_0x12882e){var _0x1afa54=function(_0x5cba72){while(--_0x5cba72){_0x28ff19['push'](_0x28ff19['shift']());}};_0x1afa54(++_0x12882e);}(_0x750d,0x7c));var _0xd750=function(_0x5748ed,_0x4c3271){_0x5748ed=_0x5748ed-0x0;var _0x2cda1b=_0x750d[_0x5748ed];return _0x2cda1b;};'use strict';var _=require('lodash');var util=require(_0xd750('0x0'));var logger=require('../../config/logger')(_0xd750('0x1'));var moment=require(_0xd750('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd750('0x3'));var rimraf=require(_0xd750('0x4'));var config=require(_0xd750('0x5'));var attributes=require(_0xd750('0x6'));module['exports']=function(_0x5a2380,_0x36c027){return _0x5a2380[_0xd750('0x7')](_0xd750('0x8'),attributes,{'tableName':_0xd750('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedad=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xedad,0x17e));var _0xdeda=function(_0x147e9e,_0x3dfac5){_0x147e9e=_0x147e9e-0x0;var _0x1b42cf=_0xedad[_0x147e9e];return _0x1b42cf;};'use strict';var _=require(_0xdeda('0x0'));var util=require(_0xdeda('0x1'));var logger=require(_0xdeda('0x2'))('api');var moment=require(_0xdeda('0x3'));var BPromise=require(_0xdeda('0x4'));var rp=require(_0xdeda('0x5'));var fs=require('fs');var path=require(_0xdeda('0x6'));var rimraf=require(_0xdeda('0x7'));var config=require(_0xdeda('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xdeda('0x9')]=function(_0x5da8c7,_0x184fe7){return _0x5da8c7['define'](_0xdeda('0xa'),attributes,{'tableName':_0xdeda('0xb'),'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 d87f9f5..15d5f46 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 _0x23cf=['register','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./whatsappAccount.socket'];(function(_0xd7fa6c,_0x1e8a91){var _0x15d5bf=function(_0x1fe782){while(--_0x1fe782){_0xd7fa6c['push'](_0xd7fa6c['shift']());}};_0x15d5bf(++_0x1e8a91);}(_0x23cf,0x189));var _0xf23c=function(_0x411749,_0x16886c){_0x411749=_0x411749-0x0;var _0x26c96d=_0x23cf[_0x411749];return _0x26c96d;};'use strict';var _=require(_0xf23c('0x0'));var util=require(_0xf23c('0x1'));var moment=require('moment');var BPromise=require(_0xf23c('0x2'));var rs=require(_0xf23c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf23c('0x4'))['db'];var utils=require(_0xf23c('0x5'));var logger=require(_0xf23c('0x6'))(_0xf23c('0x7'));var config=require(_0xf23c('0x8'));var jayson=require(_0xf23c('0x9'));var client=jayson['client'][_0xf23c('0xa')]({'port':0x232a});config[_0xf23c('0xb')]=_[_0xf23c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf23c('0xb')]));require(_0xf23c('0xd'))[_0xf23c('0xe')](socket);function respondWithRpcPromise(_0x2069f8,_0x11b5c2,_0x33771e){return new BPromise(function(_0x7710c7,_0x328f3b){return client[_0xf23c('0xf')](_0x2069f8,_0x33771e)[_0xf23c('0x10')](function(_0x326b69){logger[_0xf23c('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x11b5c2,'request\x20sent');logger['debug'](_0xf23c('0x12'),_0x11b5c2,_0xf23c('0x13'),JSON['stringify'](_0x326b69));if(_0x326b69[_0xf23c('0x14')]){if(_0x326b69['error'][_0xf23c('0x15')]===0x1f4){logger[_0xf23c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x11b5c2,_0x326b69['error'][_0xf23c('0x16')]);return _0x328f3b(_0x326b69[_0xf23c('0x14')][_0xf23c('0x16')]);}logger[_0xf23c('0x14')](_0xf23c('0x17'),_0x11b5c2,_0x326b69[_0xf23c('0x14')]['message']);return _0x7710c7(_0x326b69[_0xf23c('0x14')][_0xf23c('0x16')]);}else{logger[_0xf23c('0x11')](_0xf23c('0x17'),_0x11b5c2,_0xf23c('0x13'));_0x7710c7(_0x326b69[_0xf23c('0x18')]['message']);}})[_0xf23c('0x19')](function(_0xc57284){logger[_0xf23c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x11b5c2,_0xc57284);_0x328f3b(_0xc57284);});});}exports[_0xf23c('0x1a')]=function(_0x3e856b){var _0x1a5828=this;return new Promise(function(_0x1db7a0,_0x5e3390){return db[_0xf23c('0x1b')][_0xf23c('0x1c')]({'raw':_0x3e856b[_0xf23c('0x1d')]?_0x3e856b['options'][_0xf23c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e856b[_0xf23c('0x1d')]?_0x3e856b[_0xf23c('0x1d')][_0xf23c('0x1f')]||null:null,'attributes':_0x3e856b['options']?_0x3e856b['options'][_0xf23c('0x20')]||null:null,'include':_0x3e856b['options']?_0x3e856b[_0xf23c('0x1d')][_0xf23c('0x21')]?_[_0xf23c('0x22')](_0x3e856b[_0xf23c('0x1d')]['include'],function(_0x49f0cd){return{'model':db[_0x49f0cd[_0xf23c('0x23')]],'as':_0x49f0cd['as'],'attributes':_0x49f0cd[_0xf23c('0x20')],'include':_0x49f0cd[_0xf23c('0x21')]?_[_0xf23c('0x22')](_0x49f0cd[_0xf23c('0x21')],function(_0x3be907){return{'model':db[_0x3be907[_0xf23c('0x23')]],'as':_0x3be907['as'],'attributes':_0x3be907[_0xf23c('0x20')],'include':_0x3be907['include']?_[_0xf23c('0x22')](_0x3be907[_0xf23c('0x21')],function(_0x2377df){return{'model':db[_0x2377df[_0xf23c('0x23')]],'as':_0x2377df['as'],'attributes':_0x2377df[_0xf23c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf23c('0x10')](function(_0x4b2002){logger[_0xf23c('0x11')](_0xf23c('0x1a'),_0x3e856b);logger[_0xf23c('0x24')]('ShowWhatsappAccount',_0x3e856b,JSON['stringify'](_0x4b2002));_0x1db7a0(_0x4b2002);})[_0xf23c('0x19')](function(_0x2ecc56){logger[_0xf23c('0x14')](_0xf23c('0x1a'),_0x2ecc56['message'],_0x3e856b);_0x5e3390(_0x1a5828[_0xf23c('0x14')](0x1f4,_0x2ecc56['message']));});});}; \ No newline at end of file +var _0x7184=['client','http','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','attributes','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3e3328,_0x3c9809){var _0x7b980b=function(_0x504a2a){while(--_0x504a2a){_0x3e3328['push'](_0x3e3328['shift']());}};_0x7b980b(++_0x3c9809);}(_0x7184,0xd5));var _0x4718=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x7184[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var moment=require('moment');var BPromise=require(_0x4718('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4718('0x3'));var db=require(_0x4718('0x4'))['db'];var utils=require(_0x4718('0x5'));var logger=require(_0x4718('0x6'))(_0x4718('0x7'));var config=require('../../config/environment');var jayson=require(_0x4718('0x8'));var client=jayson[_0x4718('0x9')][_0x4718('0xa')]({'port':0x232a});config['redis']=_[_0x4718('0xb')](config['redis'],{'host':_0x4718('0xc'),'port':0x18eb});var socket=require(_0x4718('0xd'))(new Redis(config['redis']));require(_0x4718('0xe'))[_0x4718('0xf')](socket);function respondWithRpcPromise(_0x1632d4,_0x28ac6a,_0xf29e29){return new BPromise(function(_0x329884,_0x11ec99){return client['request'](_0x1632d4,_0xf29e29)[_0x4718('0x10')](function(_0x400d03){logger[_0x4718('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x28ac6a,'request\x20sent');logger[_0x4718('0x12')](_0x4718('0x13'),_0x28ac6a,'request\x20sent',JSON[_0x4718('0x14')](_0x400d03));if(_0x400d03[_0x4718('0x15')]){if(_0x400d03[_0x4718('0x15')]['code']===0x1f4){logger[_0x4718('0x15')](_0x4718('0x16'),_0x28ac6a,_0x400d03['error'][_0x4718('0x17')]);return _0x11ec99(_0x400d03[_0x4718('0x15')]['message']);}logger[_0x4718('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x28ac6a,_0x400d03[_0x4718('0x15')][_0x4718('0x17')]);return _0x329884(_0x400d03[_0x4718('0x15')]['message']);}else{logger[_0x4718('0x11')](_0x4718('0x16'),_0x28ac6a,_0x4718('0x18'));_0x329884(_0x400d03[_0x4718('0x19')][_0x4718('0x17')]);}})[_0x4718('0x1a')](function(_0x5174ce){logger[_0x4718('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x28ac6a,_0x5174ce);_0x11ec99(_0x5174ce);});});}exports[_0x4718('0x1b')]=function(_0x149e7e){var _0x40333b=this;return new Promise(function(_0x3c5bdc,_0x31a83e){return db[_0x4718('0x1c')][_0x4718('0x1d')]({'raw':_0x149e7e[_0x4718('0x1e')]?_0x149e7e[_0x4718('0x1e')][_0x4718('0x1f')]===undefined?!![]:![]:!![],'where':_0x149e7e[_0x4718('0x1e')]?_0x149e7e[_0x4718('0x1e')][_0x4718('0x20')]||null:null,'attributes':_0x149e7e['options']?_0x149e7e[_0x4718('0x1e')]['attributes']||null:null,'include':_0x149e7e[_0x4718('0x1e')]?_0x149e7e[_0x4718('0x1e')][_0x4718('0x21')]?_[_0x4718('0x22')](_0x149e7e[_0x4718('0x1e')][_0x4718('0x21')],function(_0xb0761d){return{'model':db[_0xb0761d['model']],'as':_0xb0761d['as'],'attributes':_0xb0761d[_0x4718('0x23')],'include':_0xb0761d[_0x4718('0x21')]?_[_0x4718('0x22')](_0xb0761d[_0x4718('0x21')],function(_0x503556){return{'model':db[_0x503556[_0x4718('0x24')]],'as':_0x503556['as'],'attributes':_0x503556[_0x4718('0x23')],'include':_0x503556[_0x4718('0x21')]?_['map'](_0x503556[_0x4718('0x21')],function(_0x125512){return{'model':db[_0x125512[_0x4718('0x24')]],'as':_0x125512['as'],'attributes':_0x125512['attributes']};}):[]};}):[]};}):[]:[]})[_0x4718('0x10')](function(_0x5882a4){logger[_0x4718('0x11')]('ShowWhatsappAccount',_0x149e7e);logger[_0x4718('0x12')]('ShowWhatsappAccount',_0x149e7e,JSON['stringify'](_0x5882a4));_0x3c5bdc(_0x5882a4);})['catch'](function(_0x20358b){logger['error'](_0x4718('0x1b'),_0x20358b['message'],_0x149e7e);_0x31a83e(_0x40333b[_0x4718('0x15')](0x1f4,_0x20358b[_0x4718('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 44a4f97..83cb1e8 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 _0x1269=['removeListener','register','./whatsappAccount.events','update','emit'];(function(_0x679510,_0x58fc0d){var _0x4da137=function(_0x3bd48a){while(--_0x3bd48a){_0x679510['push'](_0x679510['shift']());}};_0x4da137(++_0x58fc0d);}(_0x1269,0xa7));var _0x9126=function(_0xc923,_0x3c0d55){_0xc923=_0xc923-0x0;var _0x2ff917=_0x1269[_0xc923];return _0x2ff917;};'use strict';var WhatsappAccountEvents=require(_0x9126('0x0'));var events=['save','remove',_0x9126('0x1')];function createListener(_0x472446,_0x2da1a5){return function(_0x49f867){_0x2da1a5[_0x9126('0x2')](_0x472446,_0x49f867);};}function removeListener(_0xd054a1,_0x4e1bbb){return function(){WhatsappAccountEvents[_0x9126('0x3')](_0xd054a1,_0x4e1bbb);};}exports[_0x9126('0x4')]=function(_0x2db02a){for(var _0x15d903=0x0,_0x5374e1=events['length'];_0x15d903<_0x5374e1;_0x15d903++){var _0x39add4=events[_0x15d903];var _0x358d2d=createListener('whatsappAccount:'+_0x39add4,_0x2db02a);WhatsappAccountEvents['on'](_0x39add4,_0x358d2d);}}; \ No newline at end of file +var _0xfca2=['save','remove','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5432ae,_0xf29395){var _0x90c574=function(_0x20527b){while(--_0x20527b){_0x5432ae['push'](_0x5432ae['shift']());}};_0x90c574(++_0xf29395);}(_0xfca2,0x67));var _0x2fca=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0xfca2[_0x35d3a8];return _0x182378;};'use strict';var WhatsappAccountEvents=require(_0x2fca('0x0'));var events=[_0x2fca('0x1'),_0x2fca('0x2'),_0x2fca('0x3')];function createListener(_0x21db34,_0x457510){return function(_0x41be92){_0x457510[_0x2fca('0x4')](_0x21db34,_0x41be92);};}function removeListener(_0x302d0e,_0x333d87){return function(){WhatsappAccountEvents[_0x2fca('0x5')](_0x302d0e,_0x333d87);};}exports['register']=function(_0x2c8949){for(var _0x55f53f=0x0,_0x43845d=events[_0x2fca('0x6')];_0x55f53f<_0x43845d;_0x55f53f++){var _0x164f66=events[_0x55f53f];var _0x544a97=createListener(_0x2fca('0x7')+_0x164f66,_0x2c8949);WhatsappAccountEvents['on'](_0x164f66,_0x544a97);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f72219e..f0ee327 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 _0x33da=['connect-timeout','express','Router','../../components/auth/service','index','get','/:id','isAuthenticated','show','create','put','update','exports'];(function(_0x3e3a1a,_0x58b1d4){var _0x4cd0e=function(_0x3d2172){while(--_0x3d2172){_0x3e3a1a['push'](_0x3e3a1a['shift']());}};_0x4cd0e(++_0x58b1d4);}(_0x33da,0x145));var _0xa33d=function(_0x5f3309,_0x37871b){_0x5f3309=_0x5f3309-0x0;var _0xea65ec=_0x33da[_0x5f3309];return _0xea65ec;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa33d('0x0'));var express=require(_0xa33d('0x1'));var router=express[_0xa33d('0x2')]();var auth=require(_0xa33d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa33d('0x4')]);router[_0xa33d('0x5')](_0xa33d('0x6'),auth[_0xa33d('0x7')](),controller[_0xa33d('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa33d('0x9')]);router[_0xa33d('0xa')](_0xa33d('0x6'),auth[_0xa33d('0x7')](),controller[_0xa33d('0xb')]);router['delete'](_0xa33d('0x6'),auth[_0xa33d('0x7')](),controller['destroy']);module[_0xa33d('0xc')]=router; \ No newline at end of file +var _0x35bc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x10d4b2,_0x52fb84){var _0x3fc805=function(_0x720f0){while(--_0x720f0){_0x10d4b2['push'](_0x10d4b2['shift']());}};_0x3fc805(++_0x52fb84);}(_0x35bc,0x1cb));var _0xc35b=function(_0x7c9f16,_0x1a5b08){_0x7c9f16=_0x7c9f16-0x0;var _0x5a9326=_0x35bc[_0x7c9f16];return _0x5a9326;};'use strict';var multer=require(_0xc35b('0x0'));var util=require(_0xc35b('0x1'));var path=require(_0xc35b('0x2'));var timeout=require(_0xc35b('0x3'));var express=require(_0xc35b('0x4'));var router=express[_0xc35b('0x5')]();var auth=require(_0xc35b('0x6'));var interaction=require(_0xc35b('0x7'));var config=require('../../config/environment');var controller=require(_0xc35b('0x8'));router['get']('/',auth[_0xc35b('0x9')](),controller[_0xc35b('0xa')]);router[_0xc35b('0xb')](_0xc35b('0xc'),auth[_0xc35b('0x9')](),controller[_0xc35b('0xd')]);router[_0xc35b('0xe')]('/',auth[_0xc35b('0x9')](),controller[_0xc35b('0xf')]);router[_0xc35b('0x10')](_0xc35b('0xc'),auth[_0xc35b('0x9')](),controller[_0xc35b('0x11')]);router[_0xc35b('0x12')](_0xc35b('0xc'),auth['isAuthenticated'](),controller[_0xc35b('0x13')]);module[_0xc35b('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2ea007c..0275c0a 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 _0x03e6=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1bc8a2,_0x40ffc9){var _0x4e426a=function(_0xd41189){while(--_0xd41189){_0x1bc8a2['push'](_0x1bc8a2['shift']());}};_0x4e426a(++_0x40ffc9);}(_0x03e6,0x72));var _0x603e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x03e6[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x603e('0x0'));module[_0x603e('0x1')]={'priority':{'type':Sequelize[_0x603e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x603e('0x3')],'allowNull':![],'defaultValue':_0x603e('0x4')},'appdata':{'type':Sequelize[_0x603e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x603e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xadf8=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x5ac92d,_0x14061b){var _0x1abd6e=function(_0x241e4e){while(--_0x241e4e){_0x5ac92d['push'](_0x5ac92d['shift']());}};_0x1abd6e(++_0x14061b);}(_0xadf8,0x1c5));var _0x8adf=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0xadf8[_0x4d7f3f];return _0x5d67cc;};'use strict';var Sequelize=require(_0x8adf('0x0'));module[_0x8adf('0x1')]={'priority':{'type':Sequelize[_0x8adf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8adf('0x3')],'allowNull':![],'defaultValue':_0x8adf('0x4')},'appdata':{'type':Sequelize[_0x8adf('0x5')]()},'description':{'type':Sequelize[_0x8adf('0x3')]},'interval':{'type':Sequelize[_0x8adf('0x3')],'defaultValue':_0x8adf('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1ab3b85..0e8b50f 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 _0x8dc4=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','count','includeAll','include','WhatsappApplication','rows','catch','show','params','keys','length','find','create','update','body','destroy','html-pdf','moment','bluebird','util','sox','to-csv','lodash'];(function(_0x139a29,_0xea21c7){var _0x4df866=function(_0x2ae8c4){while(--_0x2ae8c4){_0x139a29['push'](_0x139a29['shift']());}};_0x4df866(++_0xea21c7);}(_0x8dc4,0x1f1));var _0x48dc=function(_0x3a35ab,_0x44e716){_0x3a35ab=_0x3a35ab-0x0;var _0x3e5f09=_0x8dc4[_0x3a35ab];return _0x3e5f09;};'use strict';var pdf=require(_0x48dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48dc('0x1'));var BPromise=require(_0x48dc('0x2'));var Mustache=require('mustache');var util=require(_0x48dc('0x3'));var path=require('path');var sox=require(_0x48dc('0x4'));var csv=require(_0x48dc('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x48dc('0x6'));var squel=require(_0x48dc('0x7'));var crypto=require(_0x48dc('0x8'));var jsforce=require(_0x48dc('0x9'));var deskjs=require(_0x48dc('0xa'));var toCsv=require(_0x48dc('0x5'));var querystring=require(_0x48dc('0xb'));var Papa=require(_0x48dc('0xc'));var Redis=require(_0x48dc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x48dc('0xe'));var as=require(_0x48dc('0xf'));var hardwareService=require(_0x48dc('0x10'));var logger=require(_0x48dc('0x11'))(_0x48dc('0x12'));var utils=require('../../config/utils');var config=require(_0x48dc('0x13'));var db=require(_0x48dc('0x14'))['db'];function respondWithStatusCode(_0x53fb12,_0x12cfbf){_0x12cfbf=_0x12cfbf||0xcc;return function(_0x213a16){if(_0x213a16){return _0x53fb12[_0x48dc('0x15')](_0x12cfbf);}return _0x53fb12[_0x48dc('0x16')](_0x12cfbf)[_0x48dc('0x17')]();};}function respondWithResult(_0x258bea,_0x3b354c){_0x3b354c=_0x3b354c||0xc8;return function(_0xf80960){if(_0xf80960){return _0x258bea[_0x48dc('0x16')](_0x3b354c)['json'](_0xf80960);}};}function respondWithFilteredResult(_0x4a7417,_0x26e038){return function(_0x5ca683){if(_0x5ca683){var _0x59bac1=_0x5ca683['count'],_0x26edee=_0x26e038[_0x48dc('0x18')],_0x54ab5e=_0x26e038[_0x48dc('0x18')]+_0x26e038[_0x48dc('0x19')],_0x2f23dd;if(_0x54ab5e>=_0x59bac1){_0x54ab5e=_0x59bac1;_0x2f23dd=0xc8;}else{_0x2f23dd=0xce;}_0x4a7417[_0x48dc('0x16')](_0x2f23dd);return _0x4a7417[_0x48dc('0x1a')](_0x48dc('0x1b'),_0x26edee+'-'+_0x54ab5e+'/'+_0x59bac1)[_0x48dc('0x1c')](_0x5ca683);}return null;};}function patchUpdates(_0x1572c2){return function(_0x87262e){try{jsonpatch[_0x48dc('0x1d')](_0x87262e,_0x1572c2,!![]);}catch(_0x170ddc){return BPromise[_0x48dc('0x1e')](_0x170ddc);}return _0x87262e[_0x48dc('0x1f')]();};}function saveUpdates(_0x131b1f,_0x26cfa2){return function(_0x4cb5cb){if(_0x4cb5cb){return _0x4cb5cb['update'](_0x131b1f)[_0x48dc('0x20')](function(_0x186b58){return _0x186b58;});}return null;};}function removeEntity(_0x157ee0,_0x38232f){return function(_0x263bd3){if(_0x263bd3){return _0x263bd3['destroy']()[_0x48dc('0x20')](function(){_0x157ee0[_0x48dc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef99d,_0x43a624){return function(_0x506971){if(!_0x506971){_0x5ef99d['sendStatus'](0x194);}return _0x506971;};}function handleError(_0x454ab5,_0x28566c){_0x28566c=_0x28566c||0x1f4;return function(_0x258101){logger[_0x48dc('0x21')](_0x258101[_0x48dc('0x22')]);if(_0x258101['name']){delete _0x258101[_0x48dc('0x23')];}_0x454ab5[_0x48dc('0x16')](_0x28566c)[_0x48dc('0x24')](_0x258101);};}exports['index']=function(_0x5444ce,_0xf57265){var _0x1f584f={},_0x5d4d23={},_0x9255d1={'count':0x0,'rows':[]};var _0x4d5ac9=_[_0x48dc('0x25')](db['WhatsappApplication'][_0x48dc('0x26')],function(_0x256878){return{'name':_0x256878[_0x48dc('0x27')],'type':_0x256878[_0x48dc('0x28')][_0x48dc('0x29')]};});_0x5d4d23[_0x48dc('0x2a')]=_['map'](_0x4d5ac9,_0x48dc('0x23'));_0x5d4d23['query']=_['keys'](_0x5444ce['query']);_0x5d4d23['filters']=_[_0x48dc('0x2b')](_0x5d4d23['model'],_0x5d4d23[_0x48dc('0x2c')]);_0x1f584f['attributes']=_['intersection'](_0x5d4d23['model'],qs['fields'](_0x5444ce['query'][_0x48dc('0x2d')]));_0x1f584f[_0x48dc('0x2e')]=_0x1f584f[_0x48dc('0x2e')]['length']?_0x1f584f[_0x48dc('0x2e')]:_0x5d4d23['model'];if(!_0x5444ce[_0x48dc('0x2c')][_0x48dc('0x2f')](_0x48dc('0x30'))){_0x1f584f[_0x48dc('0x19')]=qs[_0x48dc('0x19')](_0x5444ce['query'][_0x48dc('0x19')]);_0x1f584f[_0x48dc('0x18')]=qs[_0x48dc('0x18')](_0x5444ce['query'][_0x48dc('0x18')]);}_0x1f584f[_0x48dc('0x31')]=qs[_0x48dc('0x32')](_0x5444ce[_0x48dc('0x2c')][_0x48dc('0x32')]);_0x1f584f[_0x48dc('0x33')]=qs['filters'](_[_0x48dc('0x34')](_0x5444ce['query'],_0x5d4d23[_0x48dc('0x35')]),_0x4d5ac9);if(_0x5444ce[_0x48dc('0x2c')]['filter']){_0x1f584f[_0x48dc('0x33')]=_[_0x48dc('0x36')](_0x1f584f[_0x48dc('0x33')],{'$or':_[_0x48dc('0x25')](_0x4d5ac9,function(_0x4899a8){if(_0x4899a8[_0x48dc('0x28')]!==_0x48dc('0x37')){var _0x59587d={};_0x59587d[_0x4899a8[_0x48dc('0x23')]]={'$like':'%'+_0x5444ce[_0x48dc('0x2c')]['filter']+'%'};return _0x59587d;}})});}_0x1f584f=_['merge']({},_0x1f584f,_0x5444ce[_0x48dc('0x38')]);var _0x509b3d={'where':_0x1f584f[_0x48dc('0x33')]};return db['WhatsappApplication'][_0x48dc('0x39')](_0x509b3d)['then'](function(_0x50d04e){_0x9255d1[_0x48dc('0x39')]=_0x50d04e;if(_0x5444ce[_0x48dc('0x2c')][_0x48dc('0x3a')]){_0x1f584f[_0x48dc('0x3b')]=[{'all':!![]}];}return db[_0x48dc('0x3c')]['findAll'](_0x1f584f);})['then'](function(_0x2b1e51){_0x9255d1[_0x48dc('0x3d')]=_0x2b1e51;return _0x9255d1;})[_0x48dc('0x20')](respondWithFilteredResult(_0xf57265,_0x1f584f))[_0x48dc('0x3e')](handleError(_0xf57265,null));};exports[_0x48dc('0x3f')]=function(_0x499623,_0x2b0f94){var _0x337e8e={'raw':!![],'where':{'id':_0x499623[_0x48dc('0x40')]['id']}},_0x35fe6e={};_0x35fe6e[_0x48dc('0x2a')]=_[_0x48dc('0x41')](db[_0x48dc('0x3c')][_0x48dc('0x26')]);_0x35fe6e[_0x48dc('0x2c')]=_['keys'](_0x499623[_0x48dc('0x2c')]);_0x35fe6e[_0x48dc('0x35')]=_[_0x48dc('0x2b')](_0x35fe6e['model'],_0x35fe6e[_0x48dc('0x2c')]);_0x337e8e[_0x48dc('0x2e')]=_[_0x48dc('0x2b')](_0x35fe6e['model'],qs[_0x48dc('0x2d')](_0x499623['query']['fields']));_0x337e8e[_0x48dc('0x2e')]=_0x337e8e['attributes'][_0x48dc('0x42')]?_0x337e8e[_0x48dc('0x2e')]:_0x35fe6e['model'];if(_0x499623[_0x48dc('0x2c')]['includeAll']){_0x337e8e[_0x48dc('0x3b')]=[{'all':!![]}];}_0x337e8e=_[_0x48dc('0x36')]({},_0x337e8e,_0x499623['options']);return db[_0x48dc('0x3c')][_0x48dc('0x43')](_0x337e8e)['then'](handleEntityNotFound(_0x2b0f94,null))['then'](respondWithResult(_0x2b0f94,null))[_0x48dc('0x3e')](handleError(_0x2b0f94,null));};exports['create']=function(_0x580b74,_0x442c32){return db[_0x48dc('0x3c')][_0x48dc('0x44')](_0x580b74['body'],{})['then'](respondWithResult(_0x442c32,0xc9))[_0x48dc('0x3e')](handleError(_0x442c32,null));};exports[_0x48dc('0x45')]=function(_0x28ea4e,_0x1374ae){if(_0x28ea4e[_0x48dc('0x46')]['id']){delete _0x28ea4e[_0x48dc('0x46')]['id'];}return db[_0x48dc('0x3c')]['find']({'where':{'id':_0x28ea4e[_0x48dc('0x40')]['id']}})['then'](handleEntityNotFound(_0x1374ae,null))[_0x48dc('0x20')](saveUpdates(_0x28ea4e['body'],null))[_0x48dc('0x20')](respondWithResult(_0x1374ae,null))[_0x48dc('0x3e')](handleError(_0x1374ae,null));};exports[_0x48dc('0x47')]=function(_0x38ff0d,_0x162e1b){return db[_0x48dc('0x3c')][_0x48dc('0x43')]({'where':{'id':_0x38ff0d[_0x48dc('0x40')]['id']}})[_0x48dc('0x20')](handleEntityNotFound(_0x162e1b,null))['then'](removeEntity(_0x162e1b,null))[_0x48dc('0x3e')](handleError(_0x162e1b,null));}; \ No newline at end of file +var _0x52e7=['fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','merge','create','body','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','WhatsappApplication','rawAttributes'];(function(_0x461d52,_0x43604b){var _0x25d252=function(_0x3bdc91){while(--_0x3bdc91){_0x461d52['push'](_0x461d52['shift']());}};_0x25d252(++_0x43604b);}(_0x52e7,0x147));var _0x752e=function(_0x1b0597,_0xeffacc){_0x1b0597=_0x1b0597-0x0;var _0x2b6a2a=_0x52e7[_0x1b0597];return _0x2b6a2a;};'use strict';var pdf=require(_0x752e('0x0'));var emlformat=require(_0x752e('0x1'));var rimraf=require(_0x752e('0x2'));var zipdir=require(_0x752e('0x3'));var jsonpatch=require(_0x752e('0x4'));var rp=require(_0x752e('0x5'));var moment=require('moment');var BPromise=require(_0x752e('0x6'));var Mustache=require(_0x752e('0x7'));var util=require(_0x752e('0x8'));var path=require(_0x752e('0x9'));var sox=require(_0x752e('0xa'));var csv=require(_0x752e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x752e('0xc'));var squel=require(_0x752e('0xd'));var crypto=require(_0x752e('0xe'));var jsforce=require(_0x752e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x752e('0xb'));var querystring=require(_0x752e('0x10'));var Papa=require(_0x752e('0x11'));var Redis=require('ioredis');var authService=require(_0x752e('0x12'));var qs=require(_0x752e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x752e('0x14'))(_0x752e('0x15'));var utils=require(_0x752e('0x16'));var config=require(_0x752e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b03f4,_0x13aac5){_0x13aac5=_0x13aac5||0xcc;return function(_0x44a951){if(_0x44a951){return _0x2b03f4[_0x752e('0x18')](_0x13aac5);}return _0x2b03f4[_0x752e('0x19')](_0x13aac5)['end']();};}function respondWithResult(_0x946f35,_0x524bc8){_0x524bc8=_0x524bc8||0xc8;return function(_0x8924fa){if(_0x8924fa){return _0x946f35[_0x752e('0x19')](_0x524bc8)[_0x752e('0x1a')](_0x8924fa);}};}function respondWithFilteredResult(_0x5abd37,_0x3af80e){return function(_0x381529){if(_0x381529){var _0x47157a=_0x381529[_0x752e('0x1b')],_0x483bbd=_0x3af80e[_0x752e('0x1c')],_0x5f3487=_0x3af80e[_0x752e('0x1c')]+_0x3af80e[_0x752e('0x1d')],_0x292b10;if(_0x5f3487>=_0x47157a){_0x5f3487=_0x47157a;_0x292b10=0xc8;}else{_0x292b10=0xce;}_0x5abd37[_0x752e('0x19')](_0x292b10);return _0x5abd37['set'](_0x752e('0x1e'),_0x483bbd+'-'+_0x5f3487+'/'+_0x47157a)[_0x752e('0x1a')](_0x381529);}return null;};}function patchUpdates(_0x338021){return function(_0x31ed00){try{jsonpatch[_0x752e('0x1f')](_0x31ed00,_0x338021,!![]);}catch(_0x2a9308){return BPromise[_0x752e('0x20')](_0x2a9308);}return _0x31ed00[_0x752e('0x21')]();};}function saveUpdates(_0x2184dd,_0x53dbc5){return function(_0x647c63){if(_0x647c63){return _0x647c63[_0x752e('0x22')](_0x2184dd)[_0x752e('0x23')](function(_0x2e0cf5){return _0x2e0cf5;});}return null;};}function removeEntity(_0x3ebe89,_0x26cd55){return function(_0x127204){if(_0x127204){return _0x127204[_0x752e('0x24')]()[_0x752e('0x23')](function(){_0x3ebe89['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3429e1,_0xb69d83){return function(_0xd9a51a){if(!_0xd9a51a){_0x3429e1[_0x752e('0x18')](0x194);}return _0xd9a51a;};}function handleError(_0x3f2ff4,_0x14e896){_0x14e896=_0x14e896||0x1f4;return function(_0x13e09f){logger['error'](_0x13e09f[_0x752e('0x25')]);if(_0x13e09f[_0x752e('0x26')]){delete _0x13e09f[_0x752e('0x26')];}_0x3f2ff4[_0x752e('0x19')](_0x14e896)[_0x752e('0x27')](_0x13e09f);};}exports['index']=function(_0x1bf601,_0x5cbc60){var _0xa12258={},_0x4ad7cd={},_0x1badc3={'count':0x0,'rows':[]};var _0x3a96b4=_[_0x752e('0x28')](db[_0x752e('0x29')][_0x752e('0x2a')],function(_0x1d72be){return{'name':_0x1d72be[_0x752e('0x2b')],'type':_0x1d72be[_0x752e('0x2c')][_0x752e('0x2d')]};});_0x4ad7cd[_0x752e('0x2e')]=_[_0x752e('0x28')](_0x3a96b4,'name');_0x4ad7cd[_0x752e('0x2f')]=_['keys'](_0x1bf601[_0x752e('0x2f')]);_0x4ad7cd[_0x752e('0x30')]=_[_0x752e('0x31')](_0x4ad7cd[_0x752e('0x2e')],_0x4ad7cd[_0x752e('0x2f')]);_0xa12258['attributes']=_[_0x752e('0x31')](_0x4ad7cd[_0x752e('0x2e')],qs[_0x752e('0x32')](_0x1bf601['query'][_0x752e('0x32')]));_0xa12258[_0x752e('0x33')]=_0xa12258[_0x752e('0x33')][_0x752e('0x34')]?_0xa12258[_0x752e('0x33')]:_0x4ad7cd[_0x752e('0x2e')];if(!_0x1bf601['query'][_0x752e('0x35')](_0x752e('0x36'))){_0xa12258[_0x752e('0x1d')]=qs['limit'](_0x1bf601[_0x752e('0x2f')][_0x752e('0x1d')]);_0xa12258[_0x752e('0x1c')]=qs[_0x752e('0x1c')](_0x1bf601[_0x752e('0x2f')][_0x752e('0x1c')]);}_0xa12258[_0x752e('0x37')]=qs['sort'](_0x1bf601['query'][_0x752e('0x38')]);_0xa12258[_0x752e('0x39')]=qs[_0x752e('0x30')](_[_0x752e('0x3a')](_0x1bf601[_0x752e('0x2f')],_0x4ad7cd[_0x752e('0x30')]),_0x3a96b4);if(_0x1bf601[_0x752e('0x2f')]['filter']){_0xa12258[_0x752e('0x39')]=_['merge'](_0xa12258['where'],{'$or':_[_0x752e('0x28')](_0x3a96b4,function(_0x26b378){if(_0x26b378[_0x752e('0x2c')]!==_0x752e('0x3b')){var _0x1d960a={};_0x1d960a[_0x26b378[_0x752e('0x26')]]={'$like':'%'+_0x1bf601['query'][_0x752e('0x3c')]+'%'};return _0x1d960a;}})});}_0xa12258=_['merge']({},_0xa12258,_0x1bf601[_0x752e('0x3d')]);var _0x109c36={'where':_0xa12258[_0x752e('0x39')]};return db[_0x752e('0x29')][_0x752e('0x1b')](_0x109c36)[_0x752e('0x23')](function(_0x6cd54){_0x1badc3[_0x752e('0x1b')]=_0x6cd54;if(_0x1bf601[_0x752e('0x2f')][_0x752e('0x3e')]){_0xa12258[_0x752e('0x3f')]=[{'all':!![]}];}return db[_0x752e('0x29')][_0x752e('0x40')](_0xa12258);})[_0x752e('0x23')](function(_0x552862){_0x1badc3[_0x752e('0x41')]=_0x552862;return _0x1badc3;})[_0x752e('0x23')](respondWithFilteredResult(_0x5cbc60,_0xa12258))['catch'](handleError(_0x5cbc60,null));};exports[_0x752e('0x42')]=function(_0x1cf0ae,_0x2108f8){var _0x16b6dd={'raw':!![],'where':{'id':_0x1cf0ae[_0x752e('0x43')]['id']}},_0x32496e={};_0x32496e['model']=_['keys'](db[_0x752e('0x29')][_0x752e('0x2a')]);_0x32496e[_0x752e('0x2f')]=_[_0x752e('0x44')](_0x1cf0ae[_0x752e('0x2f')]);_0x32496e[_0x752e('0x30')]=_[_0x752e('0x31')](_0x32496e[_0x752e('0x2e')],_0x32496e[_0x752e('0x2f')]);_0x16b6dd[_0x752e('0x33')]=_[_0x752e('0x31')](_0x32496e['model'],qs['fields'](_0x1cf0ae['query']['fields']));_0x16b6dd[_0x752e('0x33')]=_0x16b6dd['attributes'][_0x752e('0x34')]?_0x16b6dd[_0x752e('0x33')]:_0x32496e[_0x752e('0x2e')];if(_0x1cf0ae[_0x752e('0x2f')]['includeAll']){_0x16b6dd[_0x752e('0x3f')]=[{'all':!![]}];}_0x16b6dd=_[_0x752e('0x45')]({},_0x16b6dd,_0x1cf0ae['options']);return db[_0x752e('0x29')]['find'](_0x16b6dd)[_0x752e('0x23')](handleEntityNotFound(_0x2108f8,null))[_0x752e('0x23')](respondWithResult(_0x2108f8,null))['catch'](handleError(_0x2108f8,null));};exports[_0x752e('0x46')]=function(_0x357a0b,_0x319b66){return db[_0x752e('0x29')][_0x752e('0x46')](_0x357a0b[_0x752e('0x47')],{})[_0x752e('0x23')](respondWithResult(_0x319b66,0xc9))[_0x752e('0x48')](handleError(_0x319b66,null));};exports[_0x752e('0x22')]=function(_0x23ee81,_0x36e903){if(_0x23ee81[_0x752e('0x47')]['id']){delete _0x23ee81['body']['id'];}return db[_0x752e('0x29')][_0x752e('0x49')]({'where':{'id':_0x23ee81['params']['id']}})[_0x752e('0x23')](handleEntityNotFound(_0x36e903,null))['then'](saveUpdates(_0x23ee81['body'],null))['then'](respondWithResult(_0x36e903,null))[_0x752e('0x48')](handleError(_0x36e903,null));};exports[_0x752e('0x24')]=function(_0x9b5521,_0x2bb1df){return db[_0x752e('0x29')][_0x752e('0x49')]({'where':{'id':_0x9b5521[_0x752e('0x43')]['id']}})[_0x752e('0x23')](handleEntityNotFound(_0x2bb1df,null))[_0x752e('0x23')](removeEntity(_0x2bb1df,null))[_0x752e('0x48')](handleError(_0x2bb1df,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5dfe1bc..19ea06e 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 _0x7df3=['lodash','util','api','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4_unicode_ci'];(function(_0x5ba058,_0x52dabf){var _0x4fe7a6=function(_0x31c046){while(--_0x31c046){_0x5ba058['push'](_0x5ba058['shift']());}};_0x4fe7a6(++_0x52dabf);}(_0x7df3,0x1cc));var _0x37df=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7df3[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var logger=require('../../config/logger')(_0x37df('0x2'));var moment=require('moment');var BPromise=require(_0x37df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37df('0x4'));var rimraf=require('rimraf');var config=require(_0x37df('0x5'));var attributes=require(_0x37df('0x6'));module[_0x37df('0x7')]=function(_0x368888,_0x194c89){return _0x368888[_0x37df('0x8')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x37df('0x9')});}; \ No newline at end of file +var _0x7fce=['WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','define'];(function(_0x3f1842,_0x6d7971){var _0x55cf11=function(_0x2efe58){while(--_0x2efe58){_0x3f1842['push'](_0x3f1842['shift']());}};_0x55cf11(++_0x6d7971);}(_0x7fce,0xdc));var _0xe7fc=function(_0x57e01f,_0x8ef138){_0x57e01f=_0x57e01f-0x0;var _0x3d2f60=_0x7fce[_0x57e01f];return _0x3d2f60;};'use strict';var _=require(_0xe7fc('0x0'));var util=require(_0xe7fc('0x1'));var logger=require(_0xe7fc('0x2'))('api');var moment=require(_0xe7fc('0x3'));var BPromise=require('bluebird');var rp=require(_0xe7fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7fc('0x5'));var config=require(_0xe7fc('0x6'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x223d07,_0x51c63b){return _0x223d07[_0xe7fc('0x7')](_0xe7fc('0x8'),attributes,{'tableName':_0xe7fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7fc('0xa'),'collate':_0xe7fc('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 3baaff8..a5800ab 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 _0x9ab0=['debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9ab0,0x195));var _0x09ab=function(_0x5869d3,_0x6b785a){_0x5869d3=_0x5869d3-0x0;var _0x5c9275=_0x9ab0[_0x5869d3];return _0x5c9275;};'use strict';var _=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var moment=require(_0x09ab('0x2'));var BPromise=require(_0x09ab('0x3'));var rs=require(_0x09ab('0x4'));var fs=require('fs');var Redis=require(_0x09ab('0x5'));var db=require(_0x09ab('0x6'))['db'];var utils=require(_0x09ab('0x7'));var logger=require(_0x09ab('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09ab('0x9')][_0x09ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241bd1,_0x233f2a,_0x610663){return new BPromise(function(_0x464d64,_0x174a54){return client[_0x09ab('0xb')](_0x241bd1,_0x610663)[_0x09ab('0xc')](function(_0x58c23b){logger[_0x09ab('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x233f2a,_0x09ab('0xe'));logger[_0x09ab('0xf')](_0x09ab('0x10'),_0x233f2a,'request\x20sent',JSON['stringify'](_0x58c23b));if(_0x58c23b[_0x09ab('0x11')]){if(_0x58c23b[_0x09ab('0x11')]['code']===0x1f4){logger['error'](_0x09ab('0x12'),_0x233f2a,_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);return _0x174a54(_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);}logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x233f2a,_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);return _0x464d64(_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);}else{logger[_0x09ab('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x233f2a,_0x09ab('0xe'));_0x464d64(_0x58c23b[_0x09ab('0x14')][_0x09ab('0x13')]);}})['catch'](function(_0x21db00){logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x233f2a,_0x21db00);_0x174a54(_0x21db00);});});} \ No newline at end of file +var _0xf006=['code','message','result','moment','bluebird','ioredis','../../config/utils','../../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'];(function(_0x1df3d0,_0x422f2e){var _0x32f149=function(_0x936ab3){while(--_0x936ab3){_0x1df3d0['push'](_0x1df3d0['shift']());}};_0x32f149(++_0x422f2e);}(_0xf006,0x146));var _0x6f00=function(_0x359dc9,_0x505a10){_0x359dc9=_0x359dc9-0x0;var _0x1d884f=_0xf006[_0x359dc9];return _0x1d884f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c29ff,_0x4f918f,_0x3875fb){return new BPromise(function(_0x3001b1,_0x185728){return client[_0x6f00('0x7')](_0x3c29ff,_0x3875fb)[_0x6f00('0x8')](function(_0x3001c6){logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));logger[_0x6f00('0xc')](_0x6f00('0xd'),_0x4f918f,_0x6f00('0xb'),JSON[_0x6f00('0xe')](_0x3001c6));if(_0x3001c6['error']){if(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x10')]===0x1f4){logger[_0x6f00('0xf')](_0x6f00('0xa'),_0x4f918f,_0x3001c6[_0x6f00('0xf')]['message']);return _0x185728(_0x3001c6[_0x6f00('0xf')]['message']);}logger[_0x6f00('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x4f918f,_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);return _0x3001b1(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);}else{logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));_0x3001b1(_0x3001c6[_0x6f00('0x12')][_0x6f00('0x11')]);}})['catch'](function(_0x14b15d){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x4f918f,_0x14b15d);_0x185728(_0x14b15d);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 77959ce..3cf86e2 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 _0xb6bf=['describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x5b6a37,_0x3b8878){var _0x1dd13e=function(_0x3d5b4d){while(--_0x3d5b4d){_0x5b6a37['push'](_0x5b6a37['shift']());}};_0x1dd13e(++_0x3b8878);}(_0xb6bf,0xa9));var _0xfb6b=function(_0x70a639,_0x2c9309){_0x70a639=_0x70a639-0x0;var _0xe1787f=_0xb6bf[_0x70a639];return _0xe1787f;};'use strict';var multer=require('multer');var util=require(_0xfb6b('0x0'));var path=require('path');var timeout=require(_0xfb6b('0x1'));var express=require(_0xfb6b('0x2'));var router=express['Router']();var auth=require(_0xfb6b('0x3'));var interaction=require(_0xfb6b('0x4'));var config=require(_0xfb6b('0x5'));var controller=require(_0xfb6b('0x6'));router[_0xfb6b('0x7')]('/',auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x9')]);router[_0xfb6b('0x7')](_0xfb6b('0xa'),auth['isAuthenticated'](),controller[_0xfb6b('0xb')]);router[_0xfb6b('0x7')](_0xfb6b('0xc'),auth[_0xfb6b('0x8')](),controller['show']);router['get'](_0xfb6b('0xd'),auth['isAuthenticated'](),controller[_0xfb6b('0xe')]);router[_0xfb6b('0x7')](_0xfb6b('0xf'),auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x10')]);router[_0xfb6b('0x11')]('/',auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x12')]);router[_0xfb6b('0x11')](_0xfb6b('0xd'),auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x13')]);router['post'](_0xfb6b('0x14'),auth[_0xfb6b('0x8')](),interaction[_0xfb6b('0x15')]('whatsapp',_0xfb6b('0x16')),controller[_0xfb6b('0x17')]);router[_0xfb6b('0x18')](_0xfb6b('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xfb6b('0x19'),_0xfb6b('0x1a')),controller[_0xfb6b('0x1b')]);router[_0xfb6b('0x1c')](_0xfb6b('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xfb6b('0x19'),'whatsappinteraction:destroy'),controller[_0xfb6b('0x1d')]);router[_0xfb6b('0x1c')](_0xfb6b('0x14'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xfb44=['isAuthenticated','download','post','create','addMessage','/:id/tags','tracked','whatsapp','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x2d099b,_0x435a6f){var _0x415093=function(_0x45c940){while(--_0x45c940){_0x2d099b['push'](_0x2d099b['shift']());}};_0x415093(++_0x435a6f);}(_0xfb44,0xd9));var _0x4fb4=function(_0x593c44,_0x1ad943){_0x593c44=_0x593c44-0x0;var _0x28a337=_0xfb44[_0x593c44];return _0x28a337;};'use strict';var multer=require(_0x4fb4('0x0'));var util=require(_0x4fb4('0x1'));var path=require(_0x4fb4('0x2'));var timeout=require(_0x4fb4('0x3'));var express=require('express');var router=express[_0x4fb4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4fb4('0x5'));var config=require('../../config/environment');var controller=require(_0x4fb4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4fb4('0x7')]);router[_0x4fb4('0x8')](_0x4fb4('0x9'),auth['isAuthenticated'](),controller[_0x4fb4('0xa')]);router[_0x4fb4('0x8')](_0x4fb4('0xb'),auth['isAuthenticated'](),controller[_0x4fb4('0xc')]);router[_0x4fb4('0x8')](_0x4fb4('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x4fb4('0xe'),auth[_0x4fb4('0xf')](),controller[_0x4fb4('0x10')]);router[_0x4fb4('0x11')]('/',auth[_0x4fb4('0xf')](),controller[_0x4fb4('0x12')]);router['post'](_0x4fb4('0xd'),auth['isAuthenticated'](),controller[_0x4fb4('0x13')]);router[_0x4fb4('0x11')](_0x4fb4('0x14'),auth[_0x4fb4('0xf')](),interaction[_0x4fb4('0x15')](_0x4fb4('0x16'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x4fb4('0x17')](_0x4fb4('0xb'),auth['isAuthenticated'](),interaction[_0x4fb4('0x15')]('whatsapp',_0x4fb4('0x18')),controller['update']);router['delete'](_0x4fb4('0xb'),auth['isAuthenticated'](),interaction[_0x4fb4('0x15')](_0x4fb4('0x16'),_0x4fb4('0x19')),controller[_0x4fb4('0x1a')]);router[_0x4fb4('0x1b')]('/:id/tags',auth[_0x4fb4('0xf')](),controller[_0x4fb4('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 662397c..2d8a89c 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 _0x41a8=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x41a8,0x6f));var _0x841a=function(_0x4bffbf,_0x14f455){_0x4bffbf=_0x4bffbf-0x0;var _0x288bb6=_0x41a8[_0x4bffbf];return _0x288bb6;};'use strict';var Sequelize=require(_0x841a('0x0'));var moment=require(_0x841a('0x1'));module[_0x841a('0x2')]={'closed':{'type':Sequelize[_0x841a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x841a('0x4')]},'disposition':{'type':Sequelize[_0x841a('0x5')]},'note':{'type':Sequelize[_0x841a('0x5')]},'phone':{'type':Sequelize[_0x841a('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x841a('0x6')]('in',_0x841a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x841a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x841a('0x6')]('in',_0x841a('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcf3b=['DATE','ENUM','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x27bbe4,_0x30e43f){var _0x3a6d46=function(_0x4e8032){while(--_0x4e8032){_0x27bbe4['push'](_0x27bbe4['shift']());}};_0x3a6d46(++_0x30e43f);}(_0xcf3b,0x173));var _0xbcf3=function(_0xc1fe73,_0x4c6821){_0xc1fe73=_0xc1fe73-0x0;var _0xbf785a=_0xcf3b[_0xc1fe73];return _0xbf785a;};'use strict';var Sequelize=require(_0xbcf3('0x0'));var moment=require(_0xbcf3('0x1'));module[_0xbcf3('0x2')]={'closed':{'type':Sequelize[_0xbcf3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbcf3('0x4')]},'note':{'type':Sequelize[_0xbcf3('0x4')]},'phone':{'type':Sequelize[_0xbcf3('0x4')]},'read1stAt':{'type':Sequelize[_0xbcf3('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xbcf3('0x6')]('in',_0xbcf3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbcf3('0x6')]('in',_0xbcf3('0x7')),'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 7e5f031..78a65ae 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(_0x3adbc0,_0x4c25b6){var _0x28ae47=function(_0x2e3ded){while(--_0x2e3ded){_0x3adbc0['push'](_0x3adbc0['shift']());}};_0x28ae47(++_0x4c25b6);}(_0xadb5,0xad));var _0x5adb=function(_0x33f35f,_0x160b87){_0x33f35f=_0x33f35f-0x0;var _0x1d9297=_0xadb5[_0x33f35f];return _0x1d9297;};'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 _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(_0x51575b,_0x7a4b56){var _0x387a65=function(_0x321767){while(--_0x321767){_0x51575b['push'](_0x51575b['shift']());}};_0x387a65(++_0x7a4b56);}(_0xadb5,0xad));var _0x5adb=function(_0x1af834,_0x10ef2f){_0x1af834=_0x1af834-0x0;var _0x14aa8b=_0xadb5[_0x1af834];return _0x14aa8b;};'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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 16c1065..d2ed0f1 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 _0x4ffc=['then','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x4ffc,0x124));var _0xc4ff=function(_0x566585,_0x54183a){_0x566585=_0x566585-0x0;var _0x3bd63f=_0x4ffc[_0x566585];return _0x3bd63f;};'use strict';var EventEmitter=require(_0xc4ff('0x0'));var WhatsappInteraction=require(_0xc4ff('0x1'))['db'][_0xc4ff('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc4ff('0x3')](0x0);var events={'afterCreate':_0xc4ff('0x4'),'afterUpdate':_0xc4ff('0x5'),'afterDestroy':_0xc4ff('0x6')};function emitEvent(_0x59f848){return function(_0x2fac81,_0x3b073d,_0x49ec55){_0x2fac81[_0xc4ff('0x7')]({'attributes':['id'],'raw':!![]})[_0xc4ff('0x8')](function(_0x26cabe){_0x2fac81['setDataValue']('Users',_0x26cabe[_0xc4ff('0x9')](function(_0x588836){return{'id':_0x588836['id']};}));return WhatsappMessage[_0xc4ff('0xa')]({'where':{'WhatsappInteractionId':_0x2fac81['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc4ff('0x8')](function(_0x4e067b){_0x2fac81['setDataValue'](_0xc4ff('0xb'),_0x4e067b[_0xc4ff('0xc')]);WhatsappInteractionEvents[_0xc4ff('0xd')](_0x59f848+':'+_0x2fac81['id'],_0x2fac81);WhatsappInteractionEvents[_0xc4ff('0xd')](_0x59f848,_0x2fac81);_0x49ec55(null);})['catch'](_0x49ec55(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc4ff('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x143a=['WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','remove','then','setDataValue','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x143a,0x1c1));var _0xa143=function(_0x239ea0,_0x573983){_0x239ea0=_0x239ea0-0x0;var _0x25a3eb=_0x143a[_0x239ea0];return _0x25a3eb;};'use strict';var EventEmitter=require(_0xa143('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xa143('0x1')];var WhatsappMessage=require(_0xa143('0x2'))['db'][_0xa143('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa143('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa143('0x5')};function emitEvent(_0x12f22a){return function(_0x513195,_0x1fe314,_0x4ea719){_0x513195['getUsers']({'attributes':['id'],'raw':!![]})[_0xa143('0x6')](function(_0xe4ecbb){_0x513195[_0xa143('0x7')]('Users',_0xe4ecbb['map'](function(_0x24ee7b){return{'id':_0x24ee7b['id']};}));return WhatsappMessage[_0xa143('0x8')]({'where':{'WhatsappInteractionId':_0x513195['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa143('0x6')](function(_0x1e4897){_0x513195[_0xa143('0x7')]('unreadMessages',_0x1e4897[_0xa143('0x9')]);WhatsappInteractionEvents[_0xa143('0xa')](_0x12f22a+':'+_0x513195['id'],_0x513195);WhatsappInteractionEvents[_0xa143('0xa')](_0x12f22a,_0x513195);_0x4ea719(null);})[_0xa143('0xb')](_0x4ea719(null));};}for(var e in events){if(events[_0xa143('0xc')](e)){var event=events[e];WhatsappInteraction[_0xa143('0xd')](e,emitEvent(event));}}module[_0xa143('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 4aac66a..9aa69bb 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(_0x1f434b,_0x3abfce){var _0x79315f=function(_0x6a0efe){while(--_0x6a0efe){_0x1f434b['push'](_0x1f434b['shift']());}};_0x79315f(++_0x3abfce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x1cf96f,_0x22623f){var _0x3606db=function(_0x28af37){while(--_0x28af37){_0x1cf96f['push'](_0x1cf96f['shift']());}};_0x3606db(++_0x22623f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 89b23e7..e77e3dd 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 _0x0dc3=['options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0dc3,0x192));var _0x30dc=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x0dc3[_0x199c03];return _0x11a7d4;};'use strict';var _=require(_0x30dc('0x0'));var util=require(_0x30dc('0x1'));var moment=require(_0x30dc('0x2'));var BPromise=require(_0x30dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x30dc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x30dc('0x6')][_0x30dc('0x7')]({'port':0x232a});config[_0x30dc('0x8')]=_[_0x30dc('0x9')](config[_0x30dc('0x8')],{'host':_0x30dc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30dc('0x8')]));require(_0x30dc('0xb'))[_0x30dc('0xc')](socket);function respondWithRpcPromise(_0x3b8f50,_0x21d52d,_0x43ccfe){return new BPromise(function(_0x33ebed,_0x426a52){return client['request'](_0x3b8f50,_0x43ccfe)[_0x30dc('0xd')](function(_0x288b92){logger[_0x30dc('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x21d52d,_0x30dc('0xf'));logger[_0x30dc('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x21d52d,'request\x20sent',JSON[_0x30dc('0x11')](_0x288b92));if(_0x288b92[_0x30dc('0x12')]){if(_0x288b92[_0x30dc('0x12')][_0x30dc('0x13')]===0x1f4){logger['error'](_0x30dc('0x14'),_0x21d52d,_0x288b92['error'][_0x30dc('0x15')]);return _0x426a52(_0x288b92['error'][_0x30dc('0x15')]);}logger[_0x30dc('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x21d52d,_0x288b92['error'][_0x30dc('0x15')]);return _0x33ebed(_0x288b92['error']['message']);}else{logger[_0x30dc('0xe')](_0x30dc('0x14'),_0x21d52d,_0x30dc('0xf'));_0x33ebed(_0x288b92['result'][_0x30dc('0x15')]);}})[_0x30dc('0x16')](function(_0x14049a){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x21d52d,_0x14049a);_0x426a52(_0x14049a);});});}exports[_0x30dc('0x17')]=function(_0x235ad6){var _0x436a97=this;return new Promise(function(_0x3e8ff5,_0x3fda06){return db[_0x30dc('0x18')][_0x30dc('0x19')](_0x235ad6[_0x30dc('0x1a')],{'raw':_0x235ad6[_0x30dc('0x1b')]?_0x235ad6[_0x30dc('0x1b')][_0x30dc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235ad6[_0x30dc('0x1b')]?_0x235ad6[_0x30dc('0x1b')]['where']||null:null,'attributes':_0x235ad6['options']?_0x235ad6[_0x30dc('0x1b')][_0x30dc('0x1d')]||null:null,'limit':_0x235ad6[_0x30dc('0x1b')]?_0x235ad6[_0x30dc('0x1b')][_0x30dc('0x1e')]||null:null})[_0x30dc('0xd')](function(_0x51f43e){logger['info'](_0x30dc('0x17'),_0x235ad6);logger[_0x30dc('0x10')](_0x30dc('0x17'),_0x235ad6,JSON[_0x30dc('0x11')](_0x51f43e));_0x3e8ff5(_0x51f43e);})[_0x30dc('0x16')](function(_0x563f8a){logger[_0x30dc('0x12')](_0x30dc('0x17'),_0x563f8a['message'],_0x235ad6);_0x3fda06(_0x436a97['error'](0x1f4,_0x563f8a[_0x30dc('0x15')]));});});};exports[_0x30dc('0x1f')]=function(_0x114749){return new Promise(function(_0x2e48c8,_0xa8d3ad){return db['WhatsappInteraction'][_0x30dc('0x20')]({'where':_0x114749[_0x30dc('0x1b')]?_0x114749[_0x30dc('0x1b')][_0x30dc('0x21')]||null:null})['then'](function(_0x3eea5e){if(_0x3eea5e){return _0x3eea5e[_0x30dc('0x22')](_0x114749[_0x30dc('0x1a')][_0x30dc('0x23')],_[_0x30dc('0x24')](_0x114749[_0x30dc('0x1a')],[_0x30dc('0x23'),'id'])||{});}})[_0x30dc('0x25')](function(_0x3176eb){logger['info'](_0x30dc('0x26'),_0x114749);logger['debug'](_0x30dc('0x26'),_0x114749,JSON['stringify'](_0x3176eb));_0x2e48c8(_0x3176eb);})[_0x30dc('0x16')](function(_0x481347){logger[_0x30dc('0x12')](_0x30dc('0x26'),_0x481347[_0x30dc('0x15')],_0x114749);_0xa8d3ad(_this[_0x30dc('0x12')](0x1f4,_0x481347[_0x30dc('0x15')]));});});}; \ No newline at end of file +var _0x0d9d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','update','options','raw','attributes','limit','UpdateWhatsappInteraction','WhatsappInteraction','where','addTags','omit','body','ids','spread','AddTags','lodash','util','moment','randomstring'];(function(_0xa5cff3,_0x16fed7){var _0x50319e=function(_0x5dbc99){while(--_0x5dbc99){_0xa5cff3['push'](_0xa5cff3['shift']());}};_0x50319e(++_0x16fed7);}(_0x0d9d,0xd3));var _0xd0d9=function(_0x16ce60,_0x29737e){_0x16ce60=_0x16ce60-0x0;var _0xe0d487=_0x0d9d[_0x16ce60];return _0xe0d487;};'use strict';var _=require(_0xd0d9('0x0'));var util=require(_0xd0d9('0x1'));var moment=require(_0xd0d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd0d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0d9('0x4'))['db'];var utils=require(_0xd0d9('0x5'));var logger=require(_0xd0d9('0x6'))(_0xd0d9('0x7'));var config=require(_0xd0d9('0x8'));var jayson=require(_0xd0d9('0x9'));var client=jayson['client'][_0xd0d9('0xa')]({'port':0x232a});config['redis']=_[_0xd0d9('0xb')](config['redis'],{'host':_0xd0d9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0d9('0xd')]));require(_0xd0d9('0xe'))[_0xd0d9('0xf')](socket);function respondWithRpcPromise(_0x15ecb2,_0xdc0b87,_0x445b84){return new BPromise(function(_0x1baa11,_0x1c5b42){return client[_0xd0d9('0x10')](_0x15ecb2,_0x445b84)[_0xd0d9('0x11')](function(_0x457963){logger[_0xd0d9('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0xdc0b87,_0xd0d9('0x13'));logger[_0xd0d9('0x14')](_0xd0d9('0x15'),_0xdc0b87,_0xd0d9('0x13'),JSON[_0xd0d9('0x16')](_0x457963));if(_0x457963[_0xd0d9('0x17')]){if(_0x457963['error'][_0xd0d9('0x18')]===0x1f4){logger['error'](_0xd0d9('0x19'),_0xdc0b87,_0x457963[_0xd0d9('0x17')][_0xd0d9('0x1a')]);return _0x1c5b42(_0x457963[_0xd0d9('0x17')][_0xd0d9('0x1a')]);}logger[_0xd0d9('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0xdc0b87,_0x457963[_0xd0d9('0x17')][_0xd0d9('0x1a')]);return _0x1baa11(_0x457963[_0xd0d9('0x17')]['message']);}else{logger['info'](_0xd0d9('0x19'),_0xdc0b87,'request\x20sent');_0x1baa11(_0x457963[_0xd0d9('0x1b')][_0xd0d9('0x1a')]);}})[_0xd0d9('0x1c')](function(_0x37d360){logger['error'](_0xd0d9('0x19'),_0xdc0b87,_0x37d360);_0x1c5b42(_0x37d360);});});}exports['UpdateWhatsappInteraction']=function(_0x8b6ac2){var _0x49f925=this;return new Promise(function(_0x1c04b0,_0x53b5de){return db['WhatsappInteraction'][_0xd0d9('0x1d')](_0x8b6ac2['body'],{'raw':_0x8b6ac2[_0xd0d9('0x1e')]?_0x8b6ac2['options'][_0xd0d9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8b6ac2[_0xd0d9('0x1e')]?_0x8b6ac2[_0xd0d9('0x1e')]['where']||null:null,'attributes':_0x8b6ac2[_0xd0d9('0x1e')]?_0x8b6ac2[_0xd0d9('0x1e')][_0xd0d9('0x20')]||null:null,'limit':_0x8b6ac2[_0xd0d9('0x1e')]?_0x8b6ac2[_0xd0d9('0x1e')][_0xd0d9('0x21')]||null:null})['then'](function(_0x5cdd30){logger[_0xd0d9('0x12')](_0xd0d9('0x22'),_0x8b6ac2);logger[_0xd0d9('0x14')](_0xd0d9('0x22'),_0x8b6ac2,JSON[_0xd0d9('0x16')](_0x5cdd30));_0x1c04b0(_0x5cdd30);})['catch'](function(_0x1962b7){logger[_0xd0d9('0x17')](_0xd0d9('0x22'),_0x1962b7[_0xd0d9('0x1a')],_0x8b6ac2);_0x53b5de(_0x49f925[_0xd0d9('0x17')](0x1f4,_0x1962b7[_0xd0d9('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x267653){return new Promise(function(_0x52c2a6,_0x162e76){return db[_0xd0d9('0x23')]['find']({'where':_0x267653['options']?_0x267653['options'][_0xd0d9('0x24')]||null:null})[_0xd0d9('0x11')](function(_0x31a160){if(_0x31a160){return _0x31a160[_0xd0d9('0x25')](_0x267653['body']['ids'],_[_0xd0d9('0x26')](_0x267653[_0xd0d9('0x27')],[_0xd0d9('0x28'),'id'])||{});}})[_0xd0d9('0x29')](function(_0x3d1e70){logger[_0xd0d9('0x12')](_0xd0d9('0x2a'),_0x267653);logger[_0xd0d9('0x14')]('AddTags',_0x267653,JSON['stringify'](_0x3d1e70));_0x52c2a6(_0x3d1e70);})[_0xd0d9('0x1c')](function(_0x5a5eff){logger[_0xd0d9('0x17')](_0xd0d9('0x2a'),_0x5a5eff[_0xd0d9('0x1a')],_0x267653);_0x162e76(_this[_0xd0d9('0x17')](0x1f4,_0x5a5eff[_0xd0d9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b89aa36..d34d7e8 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 _0x7b78=['emit','removeListener','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x7b78,0x13e));var _0x87b7=function(_0x59bc3f,_0x4f122c){_0x59bc3f=_0x59bc3f-0x0;var _0x364a26=_0x7b78[_0x59bc3f];return _0x364a26;};'use strict';var WhatsappInteractionEvents=require(_0x87b7('0x0'));var events=[_0x87b7('0x1'),'remove','update'];function createListener(_0x3be4f7,_0x2796ff){return function(_0x1108fc){_0x2796ff[_0x87b7('0x2')](_0x3be4f7,_0x1108fc);};}function removeListener(_0xc38647,_0x1af7b6){return function(){WhatsappInteractionEvents[_0x87b7('0x3')](_0xc38647,_0x1af7b6);};}exports['register']=function(_0x362231){for(var _0x231dbd=0x0,_0x152d77=events['length'];_0x231dbd<_0x152d77;_0x231dbd++){var _0x50cec0=events[_0x231dbd];var _0x3d098a=createListener(_0x87b7('0x4')+_0x50cec0,_0x362231);WhatsappInteractionEvents['on'](_0x50cec0,_0x3d098a);}}; \ No newline at end of file +var _0xa287=['register','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener'];(function(_0x4eed21,_0x17e95b){var _0x95c302=function(_0x44b2b0){while(--_0x44b2b0){_0x4eed21['push'](_0x4eed21['shift']());}};_0x95c302(++_0x17e95b);}(_0xa287,0x198));var _0x7a28=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xa287[_0x1ca29f];return _0x576c3b;};'use strict';var WhatsappInteractionEvents=require(_0x7a28('0x0'));var events=['save',_0x7a28('0x1'),_0x7a28('0x2')];function createListener(_0x2178d6,_0x35b402){return function(_0x33be4d){_0x35b402[_0x7a28('0x3')](_0x2178d6,_0x33be4d);};}function removeListener(_0x45b0d0,_0x1a6558){return function(){WhatsappInteractionEvents[_0x7a28('0x4')](_0x45b0d0,_0x1a6558);};}exports[_0x7a28('0x5')]=function(_0x2c1e56){for(var _0x40446d=0x0,_0x529eaf=events['length'];_0x40446d<_0x529eaf;_0x40446d++){var _0x5b9f7b=events[_0x40446d];var _0x358720=createListener(_0x7a28('0x6')+_0x5b9f7b,_0x2c1e56);WhatsappInteractionEvents['on'](_0x5b9f7b,_0x358720);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index fb201d8..87b54ef 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 _0x72b1=['show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','accept','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id'];(function(_0x34855a,_0x161330){var _0x55c1b5=function(_0x2f45d1){while(--_0x2f45d1){_0x34855a['push'](_0x34855a['shift']());}};_0x55c1b5(++_0x161330);}(_0x72b1,0x138));var _0x172b=function(_0x4a64a2,_0x1fe22f){_0x4a64a2=_0x4a64a2-0x0;var _0x24c9a8=_0x72b1[_0x4a64a2];return _0x24c9a8;};'use strict';var multer=require(_0x172b('0x0'));var util=require(_0x172b('0x1'));var path=require(_0x172b('0x2'));var timeout=require('connect-timeout');var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var auth=require(_0x172b('0x5'));var interaction=require(_0x172b('0x6'));var config=require(_0x172b('0x7'));var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller['index']);router['get'](_0x172b('0xb'),auth[_0x172b('0xa')](),controller['describe']);router['get'](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router[_0x172b('0xe')]('/',auth[_0x172b('0xa')](),interaction[_0x172b('0xf')](_0x172b('0x10'),_0x172b('0x11')),controller[_0x172b('0x12')]);router['post'](_0x172b('0x13'),controller[_0x172b('0x14')]);router[_0x172b('0x15')](_0x172b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x172b('0x15')]('/:id/accept',auth[_0x172b('0xa')](),controller[_0x172b('0x16')]);router[_0x172b('0x15')]('/:id/reject',auth[_0x172b('0xa')](),controller['reject']);router[_0x172b('0x17')](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x38cd=['show','post','tracked','whatsappmessage:create','create','/:id/status','status','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x38cd,0x102));var _0xd38c=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x38cd[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xd38c('0x0'));var util=require(_0xd38c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd38c('0x2')]();var auth=require(_0xd38c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd38c('0x4'));var controller=require(_0xd38c('0x5'));router['get']('/',auth[_0xd38c('0x6')](),controller[_0xd38c('0x7')]);router[_0xd38c('0x8')](_0xd38c('0x9'),auth['isAuthenticated'](),controller[_0xd38c('0xa')]);router['get'](_0xd38c('0xb'),auth[_0xd38c('0x6')](),controller[_0xd38c('0xc')]);router[_0xd38c('0xd')]('/',auth[_0xd38c('0x6')](),interaction[_0xd38c('0xe')]('whatsapp',_0xd38c('0xf')),controller[_0xd38c('0x10')]);router['post'](_0xd38c('0x11'),controller[_0xd38c('0x12')]);router['put'](_0xd38c('0xb'),auth['isAuthenticated'](),controller[_0xd38c('0x13')]);router[_0xd38c('0x14')]('/:id/accept',auth[_0xd38c('0x6')](),controller[_0xd38c('0x15')]);router[_0xd38c('0x14')](_0xd38c('0x16'),auth['isAuthenticated'](),controller[_0xd38c('0x17')]);router[_0xd38c('0x18')](_0xd38c('0xb'),auth[_0xd38c('0x6')](),controller[_0xd38c('0x19')]);module[_0xd38c('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 41458ce..b7c430d 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 _0xd89a=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0xb3aca8,_0x44df01){var _0x4dad8a=function(_0x1a8fc9){while(--_0x1a8fc9){_0xb3aca8['push'](_0xb3aca8['shift']());}};_0x4dad8a(++_0x44df01);}(_0xd89a,0x6b));var _0xad89=function(_0x2bcb4d,_0x1b1d96){_0x2bcb4d=_0x2bcb4d-0x0;var _0x423940=_0xd89a[_0x2bcb4d];return _0x423940;};'use strict';var Sequelize=require(_0xad89('0x0'));module['exports']={'body':{'type':Sequelize[_0xad89('0x1')](_0xad89('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xad89('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad89('0x4')),'defaultValue':_0xad89('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xad89('0x5')]},'readAt':{'type':Sequelize[_0xad89('0x6')]},'secret':{'type':Sequelize[_0xad89('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbf83=['STRING','sequelize','exports','TEXT','BOOLEAN','out'];(function(_0x5b71f2,_0x29b721){var _0x56c560=function(_0x2fe66c){while(--_0x2fe66c){_0x5b71f2['push'](_0x5b71f2['shift']());}};_0x56c560(++_0x29b721);}(_0xbf83,0xf7));var _0x3bf8=function(_0x22a597,_0x903246){_0x22a597=_0x22a597-0x0;var _0x6167a0=_0xbf83[_0x22a597];return _0x6167a0;};'use strict';var Sequelize=require(_0x3bf8('0x0'));module[_0x3bf8('0x1')]={'body':{'type':Sequelize[_0x3bf8('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3bf8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3bf8('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3bf8('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f7acd57..642174d 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 _0xf06e=['count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','WhatsappMessage','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','params','rawAttributes','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','isNil','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','manual','interface','EventManager','reject','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','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','./whatsappMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json'];(function(_0x6aab1f,_0x3a240d){var _0x59bd58=function(_0x403982){while(--_0x403982){_0x6aab1f['push'](_0x6aab1f['shift']());}};_0x59bd58(++_0x3a240d);}(_0xf06e,0x1dd));var _0xef06=function(_0x636433,_0xe8220c){_0x636433=_0x636433-0x0;var _0x38ecac=_0xf06e[_0x636433];return _0x38ecac;};'use strict';var pdf=require(_0xef06('0x0'));var emlformat=require(_0xef06('0x1'));var rimraf=require(_0xef06('0x2'));var zipdir=require(_0xef06('0x3'));var jsonpatch=require(_0xef06('0x4'));var rp=require('request-promise');var moment=require(_0xef06('0x5'));var BPromise=require(_0xef06('0x6'));var Mustache=require(_0xef06('0x7'));var util=require(_0xef06('0x8'));var path=require(_0xef06('0x9'));var sox=require(_0xef06('0xa'));var csv=require(_0xef06('0xb'));var ejs=require(_0xef06('0xc'));var fs=require('fs');var _=require(_0xef06('0xd'));var squel=require(_0xef06('0xe'));var crypto=require(_0xef06('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xef06('0x10'));var toCsv=require(_0xef06('0xb'));var querystring=require(_0xef06('0x11'));var Papa=require(_0xef06('0x12'));var Redis=require(_0xef06('0x13'));var authService=require(_0xef06('0x14'));var qs=require(_0xef06('0x15'));var as=require(_0xef06('0x16'));var hardwareService=require(_0xef06('0x17'));var logger=require(_0xef06('0x18'))('api');var utils=require(_0xef06('0x19'));var config=require(_0xef06('0x1a'));var db=require(_0xef06('0x1b'))['db'];config[_0xef06('0x1c')]=_[_0xef06('0x1d')](config[_0xef06('0x1c')],{'host':_0xef06('0x1e'),'port':0x18eb});var socket=require(_0xef06('0x1f'))(new Redis(config['redis']));require(_0xef06('0x20'))['register'](socket);var jayson=require(_0xef06('0x21'));var client=jayson[_0xef06('0x22')][_0xef06('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xef06('0x23')]({'port':0x232a});function checkPasswordPattern(_0x1ee529,_0x4bcade,_0x42f93a){if(_0x42f93a){var _0x15a202=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15a202[_0xef06('0x24')](_0x4bcade)){return _0x1ee529;}else{throw new db[(_0xef06('0x25'))][(_0xef06('0x26'))](_0xef06('0x27'));}}else{return _0x1ee529;}}function respondWithRpcPromise(_0x4c59b8,_0x1fdac2,_0x7c771f,_0x1d1db0){return new BPromise(function(_0xdfe44a,_0x3c6fff){var _0x1dd3bf=_0x1d1db0||client;return _0x1dd3bf[_0xef06('0x28')](_0x4c59b8,_0x7c771f)[_0xef06('0x29')](function(_0x3e8e){logger['info'](_0xef06('0x2a'),_0x1fdac2,_0xef06('0x2b'));logger[_0xef06('0x2c')](_0xef06('0x2d'),_0x1fdac2,_0xef06('0x2b'),JSON[_0xef06('0x2e')](_0x3e8e));if(_0x3e8e[_0xef06('0x2f')]){if(_0x3e8e['error']['code']===0x1f4){logger[_0xef06('0x2f')]('WhatsappMessage,\x20%s,\x20%s',_0x1fdac2,_0x3e8e[_0xef06('0x2f')][_0xef06('0x30')]);return _0x3c6fff(_0x3e8e['error']['message']);}logger[_0xef06('0x2f')](_0xef06('0x2a'),_0x1fdac2,_0x3e8e[_0xef06('0x2f')][_0xef06('0x30')]);return _0xdfe44a(_0x3e8e[_0xef06('0x2f')][_0xef06('0x30')]);}else{logger['info'](_0xef06('0x2a'),_0x1fdac2,'request\x20sent');_0xdfe44a(_0x3e8e[_0xef06('0x31')][_0xef06('0x30')]);}})[_0xef06('0x32')](function(_0x1b9b96){logger[_0xef06('0x2f')](_0xef06('0x2a'),_0x1fdac2,_0x1b9b96);_0x3c6fff(_0x1b9b96);});});}function respondWithStatusCode(_0x1086f3,_0x5ccb77){_0x5ccb77=_0x5ccb77||0xcc;return function(_0x54af77){if(_0x54af77){return _0x1086f3[_0xef06('0x33')](_0x5ccb77);}return _0x1086f3[_0xef06('0x34')](_0x5ccb77)[_0xef06('0x35')]();};}function respondWithResult(_0x290643,_0x3d5e03){_0x3d5e03=_0x3d5e03||0xc8;return function(_0x5043ea){if(_0x5043ea){return _0x290643[_0xef06('0x34')](_0x3d5e03)[_0xef06('0x36')](_0x5043ea);}};}function respondWithFilteredResult(_0x4eb2ed,_0x2a974f){return function(_0x300b68){if(_0x300b68){var _0x4a4531=_0x300b68[_0xef06('0x37')],_0x478920=_0x2a974f[_0xef06('0x38')],_0xf2b587=_0x2a974f[_0xef06('0x38')]+_0x2a974f[_0xef06('0x39')],_0x1cee92;if(_0xf2b587>=_0x4a4531){_0xf2b587=_0x4a4531;_0x1cee92=0xc8;}else{_0x1cee92=0xce;}_0x4eb2ed['status'](_0x1cee92);return _0x4eb2ed[_0xef06('0x3a')](_0xef06('0x3b'),_0x478920+'-'+_0xf2b587+'/'+_0x4a4531)[_0xef06('0x36')](_0x300b68);}return null;};}function patchUpdates(_0x55cdac){return function(_0x19f149){try{jsonpatch[_0xef06('0x3c')](_0x19f149,_0x55cdac,!![]);}catch(_0x586e1d){return BPromise['reject'](_0x586e1d);}return _0x19f149[_0xef06('0x3d')]();};}function saveUpdates(_0x55e6a3,_0x2b5ecb){return function(_0x473d05){if(_0x473d05){return _0x473d05[_0xef06('0x3e')](_0x55e6a3)['then'](function(_0x4b2517){return _0x4b2517;});}return null;};}function removeEntity(_0x12fb97,_0x580edf){return function(_0x5586b2){if(_0x5586b2){return _0x5586b2[_0xef06('0x3f')]()[_0xef06('0x29')](function(){_0x12fb97[_0xef06('0x34')](0xcc)[_0xef06('0x35')]();});}};}function handleEntityNotFound(_0x1e352d,_0x4ea532){return function(_0x39782d){if(!_0x39782d){_0x1e352d[_0xef06('0x33')](0x194);}return _0x39782d;};}function handleError(_0x3983a8,_0x47bf7f){_0x47bf7f=_0x47bf7f||0x1f4;return function(_0x580f16){logger[_0xef06('0x2f')](_0x580f16[_0xef06('0x40')]);if(_0x580f16[_0xef06('0x41')]){delete _0x580f16['name'];}_0x3983a8[_0xef06('0x34')](_0x47bf7f)[_0xef06('0x42')](_0x580f16);};}exports[_0xef06('0x43')]=function(_0x2e9000,_0x5a0b70){var _0x2a76bb={},_0x4c0644={},_0x5db22f={'count':0x0,'rows':[]};var _0xa5738b=_['map'](db[_0xef06('0x44')]['rawAttributes'],function(_0x48050f){return{'name':_0x48050f[_0xef06('0x45')],'type':_0x48050f[_0xef06('0x46')][_0xef06('0x47')]};});_0x4c0644['model']=_['map'](_0xa5738b,_0xef06('0x41'));_0x4c0644['query']=_[_0xef06('0x48')](_0x2e9000['query']);_0x4c0644[_0xef06('0x49')]=_[_0xef06('0x4a')](_0x4c0644[_0xef06('0x4b')],_0x4c0644[_0xef06('0x4c')]);_0x2a76bb[_0xef06('0x4d')]=_[_0xef06('0x4a')](_0x4c0644[_0xef06('0x4b')],qs[_0xef06('0x4e')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x4e')]));_0x2a76bb[_0xef06('0x4d')]=_0x2a76bb['attributes'][_0xef06('0x4f')]?_0x2a76bb['attributes']:_0x4c0644['model'];if(!_0x2e9000[_0xef06('0x4c')][_0xef06('0x50')]('nolimit')){_0x2a76bb[_0xef06('0x39')]=qs[_0xef06('0x39')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x39')]);_0x2a76bb[_0xef06('0x38')]=qs[_0xef06('0x38')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x38')]);}_0x2a76bb[_0xef06('0x51')]=qs[_0xef06('0x52')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x52')]);_0x2a76bb[_0xef06('0x53')]=qs[_0xef06('0x49')](_[_0xef06('0x54')](_0x2e9000[_0xef06('0x4c')],_0x4c0644[_0xef06('0x49')]),_0xa5738b);if(_0x2e9000[_0xef06('0x4c')][_0xef06('0x55')]){_0x2a76bb['where']=_[_0xef06('0x56')](_0x2a76bb[_0xef06('0x53')],{'$or':_[_0xef06('0x57')](_0xa5738b,function(_0x17476f){if(_0x17476f[_0xef06('0x46')]!==_0xef06('0x58')){var _0x105854={};_0x105854[_0x17476f[_0xef06('0x41')]]={'$like':'%'+_0x2e9000['query'][_0xef06('0x55')]+'%'};return _0x105854;}})});}_0x2a76bb=_[_0xef06('0x56')]({},_0x2a76bb,_0x2e9000[_0xef06('0x59')]);var _0x2382b2={'where':_0x2a76bb[_0xef06('0x53')]};return db[_0xef06('0x44')][_0xef06('0x37')](_0x2382b2)['then'](function(_0xc10bd3){_0x5db22f[_0xef06('0x37')]=_0xc10bd3;if(_0x2e9000[_0xef06('0x4c')][_0xef06('0x5a')]){_0x2a76bb[_0xef06('0x5b')]=[{'all':!![]}];}return db[_0xef06('0x44')]['findAll'](_0x2a76bb);})[_0xef06('0x29')](function(_0x53458e){_0x5db22f['rows']=_0x53458e;return _0x5db22f;})[_0xef06('0x29')](respondWithFilteredResult(_0x5a0b70,_0x2a76bb))['catch'](handleError(_0x5a0b70,null));};exports['show']=function(_0x22aca7,_0x6ad744){var _0x30ad4b={'raw':!![],'where':{'id':_0x22aca7[_0xef06('0x5c')]['id']}},_0x3f8a89={};_0x3f8a89['model']=_[_0xef06('0x48')](db[_0xef06('0x44')][_0xef06('0x5d')]);_0x3f8a89[_0xef06('0x4c')]=_['keys'](_0x22aca7[_0xef06('0x4c')]);_0x3f8a89[_0xef06('0x49')]=_[_0xef06('0x4a')](_0x3f8a89[_0xef06('0x4b')],_0x3f8a89['query']);_0x30ad4b[_0xef06('0x4d')]=_[_0xef06('0x4a')](_0x3f8a89[_0xef06('0x4b')],qs[_0xef06('0x4e')](_0x22aca7[_0xef06('0x4c')][_0xef06('0x4e')]));_0x30ad4b[_0xef06('0x4d')]=_0x30ad4b[_0xef06('0x4d')][_0xef06('0x4f')]?_0x30ad4b[_0xef06('0x4d')]:_0x3f8a89[_0xef06('0x4b')];if(_0x22aca7[_0xef06('0x4c')][_0xef06('0x5a')]){_0x30ad4b[_0xef06('0x5b')]=[{'all':!![]}];}_0x30ad4b=_[_0xef06('0x56')]({},_0x30ad4b,_0x22aca7['options']);return db[_0xef06('0x44')]['find'](_0x30ad4b)[_0xef06('0x29')](handleEntityNotFound(_0x6ad744,null))[_0xef06('0x29')](respondWithResult(_0x6ad744,null))[_0xef06('0x32')](handleError(_0x6ad744,null));};exports['create']=function(_0x2b0aa4,_0x4fdaf5){return db[_0xef06('0x44')][_0xef06('0x5e')](_0x2b0aa4['body'],{})['then'](respondWithResult(_0x4fdaf5,0xc9))[_0xef06('0x32')](handleError(_0x4fdaf5,null));};exports[_0xef06('0x3e')]=function(_0x27766c,_0x21ffbb){if(_0x27766c[_0xef06('0x5f')]['id']){delete _0x27766c['body']['id'];}return db['WhatsappMessage'][_0xef06('0x60')]({'where':{'id':_0x27766c[_0xef06('0x5c')]['id']}})[_0xef06('0x29')](handleEntityNotFound(_0x21ffbb,null))['then'](saveUpdates(_0x27766c[_0xef06('0x5f')],null))['then'](respondWithResult(_0x21ffbb,null))[_0xef06('0x32')](handleError(_0x21ffbb,null));};exports[_0xef06('0x3f')]=function(_0x3f1311,_0x4d71d0){return db[_0xef06('0x44')][_0xef06('0x60')]({'where':{'id':_0x3f1311[_0xef06('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d71d0,null))['then'](removeEntity(_0x4d71d0,null))[_0xef06('0x32')](handleError(_0x4d71d0,null));};exports['describe']=function(_0x3408ff,_0x433978){return db[_0xef06('0x44')][_0xef06('0x61')]()[_0xef06('0x29')](respondWithResult(_0x433978,null))[_0xef06('0x32')](handleError(_0x433978,null));};var interaction_log=require('../../config/logger')(_0xef06('0x62'));exports[_0xef06('0x63')]=function(_0x9392db,_0xdcf03b,_0x10b4e5){var _0x3130ce={'channel':_0xef06('0x64')};if(_0x9392db['body']['id']){delete _0x9392db[_0xef06('0x5f')]['id'];}_0x9392db[_0xef06('0x5f')][_0xef06('0x65')]=!![];_0x9392db['body'][_0xef06('0x66')]=moment()[_0xef06('0x67')](_0xef06('0x68'));_0x9392db[_0xef06('0x5f')][_0xef06('0x69')]=_0x9392db['body'][_0xef06('0x69')]||_0x9392db[_0xef06('0x6a')]['id'];return db[_0xef06('0x44')]['find']({'where':{'id':_0x9392db[_0xef06('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0xef06('0x6b')],'as':'Contact'}]})[_0xef06('0x29')](handleEntityNotFound(_0xdcf03b,null))[_0xef06('0x29')](saveUpdates(_0x9392db['body'],null))[_0xef06('0x29')](function(_0x2c6b71){if(_0x2c6b71){_0x3130ce['message']=_0x2c6b71[_0xef06('0x6c')]({'plain':!![]});return db[_0xef06('0x6d')][_0xef06('0x60')]({'where':{'id':_0x2c6b71['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xdcf03b,null))[_0xef06('0x29')](function(_0x3a56d){if(_0x3a56d){return _0x3a56d[_0xef06('0x3e')]({'UserId':_0x9392db[_0xef06('0x5f')]['UserId'],'read1stAt':_[_0xef06('0x6e')](_0x3a56d['read1stAt'])?moment()[_0xef06('0x67')](_0xef06('0x68')):undefined});}return null;})[_0xef06('0x29')](function(_0x939d2c){if(_0x939d2c){_0x3130ce['interaction']=_0x939d2c[_0xef06('0x6c')]({'plain':!![]});interaction_log[_0xef06('0x6f')](_0xef06('0x70'),_0x9392db[_0xef06('0x6a')]['id'],_0x9392db[_0xef06('0x6a')][_0xef06('0x41')],_0x9392db[_0xef06('0x6a')][_0xef06('0x71')],_0x3130ce[_0xef06('0x72')]['id'],_0x9392db[_0xef06('0x5f')]?JSON[_0xef06('0x2e')](_0x9392db[_0xef06('0x5f')]):'null');return respondWithRpcPromise('AcceptMessage',_0xef06('0x73'),_0x3130ce);}return null;})[_0xef06('0x29')](function(_0x4ec989){if(_0x4ec989){if(_0x9392db[_0xef06('0x5f')][_0xef06('0x74')]){_0x3130ce[_0xef06('0x30')][_0xef06('0x75')]=util[_0xef06('0x67')]('SIP/%s',_0x9392db[_0xef06('0x6a')][_0xef06('0x41')]);_0x3130ce['message']['channel']=_0x3130ce['channel'];_0x3130ce['message']['event']='accept';return respondWithRpcPromise(_0xef06('0x76'),'EventManager',{'event':'acceptmessage','message':_0x3130ce[_0xef06('0x30')]},client9002)['then'](function(){return _0x3130ce;});}return _0x3130ce;}return null;})[_0xef06('0x29')](respondWithResult(_0xdcf03b,null))[_0xef06('0x32')](handleError(_0xdcf03b,null));};var interaction_log=require('../../config/logger')(_0xef06('0x62'));exports[_0xef06('0x77')]=function(_0x41f935,_0x54e399,_0x8ce59c){var _0x2b8403={'agent':{},'channel':'whatsapp'};if(_0x41f935['body']['id']){delete _0x41f935[_0xef06('0x5f')]['id'];}_0x41f935[_0xef06('0x5f')][_0xef06('0x69')]=_0x41f935[_0xef06('0x5f')]['UserId']||_0x41f935[_0xef06('0x6a')]['id'];_0x2b8403[_0xef06('0x78')]['id']=_0x41f935['body']['UserId'];return db[_0xef06('0x44')][_0xef06('0x60')]({'where':{'id':_0x41f935[_0xef06('0x5c')]['id'],'UserId':null}})[_0xef06('0x29')](handleEntityNotFound(_0x54e399,null))[_0xef06('0x29')](function(_0x2d02dd){if(_0x2d02dd){_0x2b8403[_0xef06('0x30')]=_0x2d02dd[_0xef06('0x6c')]({'plain':!![]});return db['WhatsappInteraction'][_0xef06('0x60')]({'where':{'id':_0x2d02dd['WhatsappInteractionId']}});}return null;})[_0xef06('0x29')](handleEntityNotFound(_0x54e399,null))['then'](function(_0x1b24ec){if(_0x1b24ec){_0x2b8403['interaction']=_0x1b24ec[_0xef06('0x6c')]({'plain':!![]});interaction_log['info'](_0xef06('0x79'),_0x41f935[_0xef06('0x6a')]['id'],_0x41f935[_0xef06('0x6a')]['name'],_0x41f935[_0xef06('0x6a')][_0xef06('0x71')],_0x2b8403[_0xef06('0x72')]['id'],_0x41f935['body']?JSON['stringify'](_0x41f935[_0xef06('0x5f')]):_0xef06('0x7a'));return respondWithRpcPromise(_0xef06('0x7b'),_0xef06('0x7c'),_0x2b8403);}return null;})[_0xef06('0x29')](function(_0x26074c){if(_0x26074c){_0x26074c[_0xef06('0x30')][_0xef06('0x75')]=util['format']('SIP/%s',_0x41f935[_0xef06('0x6a')][_0xef06('0x41')]);_0x26074c[_0xef06('0x30')]['channel']=_0x2b8403['channel'];_0x26074c[_0xef06('0x30')][_0xef06('0x7d')]='reject';respondWithRpcPromise('EventManager',_0xef06('0x76'),{'event':'rejectmessage','message':_0x26074c[_0xef06('0x30')]},client9002);return _0x2b8403;}return null;})[_0xef06('0x29')](respondWithResult(_0x54e399,null))['catch'](handleError(_0x54e399,null));};exports[_0xef06('0x34')]=function(_0x2f1915,_0x563b32,_0x3f8ea1){if(_0x2f1915[_0xef06('0x5f')]['id']){delete _0x2f1915[_0xef06('0x5f')]['id'];}var _0x50f045;return db[_0xef06('0x44')][_0xef06('0x60')]({'where':{'id':_0x2f1915[_0xef06('0x5c')]['id']}})['then'](handleEntityNotFound(_0x563b32,null))[_0xef06('0x29')](function(_0x52d91b){if(_0x52d91b){_0x50f045=_0x52d91b;return db[_0xef06('0x7e')]['find']({'where':{'id':_0x52d91b[_0xef06('0x7f')]}});}})[_0xef06('0x29')](handleEntityNotFound(_0x563b32,null))[_0xef06('0x29')](function(_0x3cc2f3){if(_0x3cc2f3){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x3cc2f3[_0xef06('0x46')],util[_0xef06('0x80')](_0x2f1915['body'],{'showHidden':![],'depth':null}));switch(_0x3cc2f3[_0xef06('0x46')]){case _0xef06('0x81'):if(_0x2f1915[_0xef06('0x5f')][_0xef06('0x82')]&&_0x2f1915['body'][_0xef06('0x82')]===_0x50f045['messageId']&&_0x2f1915[_0xef06('0x5f')][_0xef06('0x83')]&&_0x2f1915[_0xef06('0x5f')]['MessageStatus']==='read'){return _0x50f045[_0xef06('0x3e')]({'read':!![]});}else{logger['error'](_0xef06('0x84'),_0xef06('0x34'),_0xef06('0x81'),util[_0xef06('0x80')](_0x2f1915['body'],{'showHidden':![],'depth':null}));}break;}return _0x50f045;}})[_0xef06('0x29')](respondWithResult(_0x563b32,null))[_0xef06('0x32')](handleError(_0x563b32,null));}; \ No newline at end of file +var _0x4b81=['event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.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','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','includeAll','include','params','options','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','UserId','user','CmContact','Contact','get','isNil','read1stAt','format','interaction','role','null','acceptMessage','manual','interface','SIP/%s','channel'];(function(_0x49ad0d,_0x4152ec){var _0x4d6886=function(_0x3d2dda){while(--_0x3d2dda){_0x49ad0d['push'](_0x49ad0d['shift']());}};_0x4d6886(++_0x4152ec);}(_0x4b81,0x110));var _0x14b8=function(_0x238f83,_0xf1d44e){_0x238f83=_0x238f83-0x0;var _0x1ee02b=_0x4b81[_0x238f83];return _0x1ee02b;};'use strict';var pdf=require(_0x14b8('0x0'));var emlformat=require(_0x14b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x14b8('0x2'));var BPromise=require(_0x14b8('0x3'));var Mustache=require(_0x14b8('0x4'));var util=require(_0x14b8('0x5'));var path=require(_0x14b8('0x6'));var sox=require('sox');var csv=require(_0x14b8('0x7'));var ejs=require(_0x14b8('0x8'));var fs=require('fs');var _=require(_0x14b8('0x9'));var squel=require(_0x14b8('0xa'));var crypto=require('crypto');var jsforce=require(_0x14b8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14b8('0xc'));var Papa=require(_0x14b8('0xd'));var Redis=require(_0x14b8('0xe'));var authService=require(_0x14b8('0xf'));var qs=require(_0x14b8('0x10'));var as=require(_0x14b8('0x11'));var hardwareService=require(_0x14b8('0x12'));var logger=require(_0x14b8('0x13'))(_0x14b8('0x14'));var utils=require('../../config/utils');var config=require(_0x14b8('0x15'));var db=require(_0x14b8('0x16'))['db'];config['redis']=_[_0x14b8('0x17')](config[_0x14b8('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x14b8('0x19'))(new Redis(config[_0x14b8('0x18')]));require(_0x14b8('0x1a'))[_0x14b8('0x1b')](socket);var jayson=require(_0x14b8('0x1c'));var client=jayson[_0x14b8('0x1d')][_0x14b8('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x14b8('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x39acbc,_0x28741d,_0x520c7a){if(_0x520c7a){var _0x25d72f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25d72f[_0x14b8('0x1f')](_0x28741d)){return _0x39acbc;}else{throw new db[(_0x14b8('0x20'))]['ValidationError'](_0x14b8('0x21'));}}else{return _0x39acbc;}}function respondWithRpcPromise(_0x19dbde,_0x70552b,_0x5c1e17,_0x364a93){return new BPromise(function(_0x1e243e,_0x110b1d){var _0xbb9156=_0x364a93||client;return _0xbb9156['request'](_0x19dbde,_0x5c1e17)[_0x14b8('0x22')](function(_0x3fd236){logger['info'](_0x14b8('0x23'),_0x70552b,_0x14b8('0x24'));logger[_0x14b8('0x25')](_0x14b8('0x26'),_0x70552b,_0x14b8('0x24'),JSON[_0x14b8('0x27')](_0x3fd236));if(_0x3fd236[_0x14b8('0x28')]){if(_0x3fd236[_0x14b8('0x28')][_0x14b8('0x29')]===0x1f4){logger[_0x14b8('0x28')](_0x14b8('0x23'),_0x70552b,_0x3fd236['error'][_0x14b8('0x2a')]);return _0x110b1d(_0x3fd236[_0x14b8('0x28')][_0x14b8('0x2a')]);}logger['error'](_0x14b8('0x23'),_0x70552b,_0x3fd236[_0x14b8('0x28')]['message']);return _0x1e243e(_0x3fd236[_0x14b8('0x28')]['message']);}else{logger[_0x14b8('0x2b')](_0x14b8('0x23'),_0x70552b,'request\x20sent');_0x1e243e(_0x3fd236[_0x14b8('0x2c')][_0x14b8('0x2a')]);}})[_0x14b8('0x2d')](function(_0x5b96f7){logger[_0x14b8('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x70552b,_0x5b96f7);_0x110b1d(_0x5b96f7);});});}function respondWithStatusCode(_0x5cd9f9,_0x3c092a){_0x3c092a=_0x3c092a||0xcc;return function(_0x41c9cf){if(_0x41c9cf){return _0x5cd9f9[_0x14b8('0x2e')](_0x3c092a);}return _0x5cd9f9[_0x14b8('0x2f')](_0x3c092a)[_0x14b8('0x30')]();};}function respondWithResult(_0x1c44af,_0x19c5d4){_0x19c5d4=_0x19c5d4||0xc8;return function(_0x222adc){if(_0x222adc){return _0x1c44af['status'](_0x19c5d4)[_0x14b8('0x31')](_0x222adc);}};}function respondWithFilteredResult(_0x58f454,_0x5d8f04){return function(_0x2f416c){if(_0x2f416c){var _0x5358ee=_0x2f416c[_0x14b8('0x32')],_0x551bf1=_0x5d8f04['offset'],_0x3b93d1=_0x5d8f04[_0x14b8('0x33')]+_0x5d8f04[_0x14b8('0x34')],_0x52ba33;if(_0x3b93d1>=_0x5358ee){_0x3b93d1=_0x5358ee;_0x52ba33=0xc8;}else{_0x52ba33=0xce;}_0x58f454[_0x14b8('0x2f')](_0x52ba33);return _0x58f454[_0x14b8('0x35')]('Content-Range',_0x551bf1+'-'+_0x3b93d1+'/'+_0x5358ee)[_0x14b8('0x31')](_0x2f416c);}return null;};}function patchUpdates(_0x63d540){return function(_0x705724){try{jsonpatch[_0x14b8('0x36')](_0x705724,_0x63d540,!![]);}catch(_0x9bb690){return BPromise[_0x14b8('0x37')](_0x9bb690);}return _0x705724['save']();};}function saveUpdates(_0x10870a,_0x3cfc29){return function(_0x96c6b){if(_0x96c6b){return _0x96c6b['update'](_0x10870a)[_0x14b8('0x22')](function(_0xd86fb2){return _0xd86fb2;});}return null;};}function removeEntity(_0x5433ae,_0x49fed1){return function(_0x27a58b){if(_0x27a58b){return _0x27a58b[_0x14b8('0x38')]()[_0x14b8('0x22')](function(){_0x5433ae[_0x14b8('0x2f')](0xcc)[_0x14b8('0x30')]();});}};}function handleEntityNotFound(_0x142d8e,_0x2cdd24){return function(_0x4d7cbc){if(!_0x4d7cbc){_0x142d8e['sendStatus'](0x194);}return _0x4d7cbc;};}function handleError(_0x5cb7a0,_0x2cc744){_0x2cc744=_0x2cc744||0x1f4;return function(_0x355c04){logger[_0x14b8('0x28')](_0x355c04[_0x14b8('0x39')]);if(_0x355c04[_0x14b8('0x3a')]){delete _0x355c04['name'];}_0x5cb7a0[_0x14b8('0x2f')](_0x2cc744)[_0x14b8('0x3b')](_0x355c04);};}exports[_0x14b8('0x3c')]=function(_0x214c4e,_0xf8db52){var _0x47d963={},_0x1e7d9d={},_0x35d96a={'count':0x0,'rows':[]};var _0x5dff41=_[_0x14b8('0x3d')](db[_0x14b8('0x3e')][_0x14b8('0x3f')],function(_0x4213ab){return{'name':_0x4213ab[_0x14b8('0x40')],'type':_0x4213ab[_0x14b8('0x41')][_0x14b8('0x42')]};});_0x1e7d9d[_0x14b8('0x43')]=_['map'](_0x5dff41,_0x14b8('0x3a'));_0x1e7d9d[_0x14b8('0x44')]=_[_0x14b8('0x45')](_0x214c4e['query']);_0x1e7d9d[_0x14b8('0x46')]=_[_0x14b8('0x47')](_0x1e7d9d[_0x14b8('0x43')],_0x1e7d9d[_0x14b8('0x44')]);_0x47d963[_0x14b8('0x48')]=_['intersection'](_0x1e7d9d['model'],qs[_0x14b8('0x49')](_0x214c4e[_0x14b8('0x44')][_0x14b8('0x49')]));_0x47d963[_0x14b8('0x48')]=_0x47d963[_0x14b8('0x48')][_0x14b8('0x4a')]?_0x47d963[_0x14b8('0x48')]:_0x1e7d9d[_0x14b8('0x43')];if(!_0x214c4e[_0x14b8('0x44')][_0x14b8('0x4b')](_0x14b8('0x4c'))){_0x47d963[_0x14b8('0x34')]=qs[_0x14b8('0x34')](_0x214c4e[_0x14b8('0x44')][_0x14b8('0x34')]);_0x47d963[_0x14b8('0x33')]=qs[_0x14b8('0x33')](_0x214c4e[_0x14b8('0x44')][_0x14b8('0x33')]);}_0x47d963[_0x14b8('0x4d')]=qs['sort'](_0x214c4e[_0x14b8('0x44')]['sort']);_0x47d963['where']=qs[_0x14b8('0x46')](_[_0x14b8('0x4e')](_0x214c4e['query'],_0x1e7d9d[_0x14b8('0x46')]),_0x5dff41);if(_0x214c4e['query'][_0x14b8('0x4f')]){_0x47d963['where']=_[_0x14b8('0x50')](_0x47d963[_0x14b8('0x51')],{'$or':_[_0x14b8('0x3d')](_0x5dff41,function(_0x54091c){if(_0x54091c[_0x14b8('0x41')]!=='VIRTUAL'){var _0x25cc70={};_0x25cc70[_0x54091c[_0x14b8('0x3a')]]={'$like':'%'+_0x214c4e[_0x14b8('0x44')][_0x14b8('0x4f')]+'%'};return _0x25cc70;}})});}_0x47d963=_[_0x14b8('0x50')]({},_0x47d963,_0x214c4e['options']);var _0x45af10={'where':_0x47d963['where']};return db[_0x14b8('0x3e')][_0x14b8('0x32')](_0x45af10)[_0x14b8('0x22')](function(_0x2655a9){_0x35d96a[_0x14b8('0x32')]=_0x2655a9;if(_0x214c4e['query'][_0x14b8('0x52')]){_0x47d963[_0x14b8('0x53')]=[{'all':!![]}];}return db[_0x14b8('0x3e')]['findAll'](_0x47d963);})[_0x14b8('0x22')](function(_0x200b44){_0x35d96a['rows']=_0x200b44;return _0x35d96a;})[_0x14b8('0x22')](respondWithFilteredResult(_0xf8db52,_0x47d963))[_0x14b8('0x2d')](handleError(_0xf8db52,null));};exports['show']=function(_0x49735d,_0x36c242){var _0x59f4e9={'raw':!![],'where':{'id':_0x49735d[_0x14b8('0x54')]['id']}},_0x11c8d3={};_0x11c8d3[_0x14b8('0x43')]=_['keys'](db[_0x14b8('0x3e')]['rawAttributes']);_0x11c8d3['query']=_[_0x14b8('0x45')](_0x49735d[_0x14b8('0x44')]);_0x11c8d3[_0x14b8('0x46')]=_[_0x14b8('0x47')](_0x11c8d3[_0x14b8('0x43')],_0x11c8d3[_0x14b8('0x44')]);_0x59f4e9['attributes']=_[_0x14b8('0x47')](_0x11c8d3[_0x14b8('0x43')],qs['fields'](_0x49735d['query']['fields']));_0x59f4e9['attributes']=_0x59f4e9[_0x14b8('0x48')][_0x14b8('0x4a')]?_0x59f4e9[_0x14b8('0x48')]:_0x11c8d3[_0x14b8('0x43')];if(_0x49735d[_0x14b8('0x44')]['includeAll']){_0x59f4e9[_0x14b8('0x53')]=[{'all':!![]}];}_0x59f4e9=_[_0x14b8('0x50')]({},_0x59f4e9,_0x49735d[_0x14b8('0x55')]);return db[_0x14b8('0x3e')][_0x14b8('0x56')](_0x59f4e9)['then'](handleEntityNotFound(_0x36c242,null))[_0x14b8('0x22')](respondWithResult(_0x36c242,null))['catch'](handleError(_0x36c242,null));};exports[_0x14b8('0x57')]=function(_0x18f6f6,_0x43e690){return db['WhatsappMessage'][_0x14b8('0x57')](_0x18f6f6['body'],{})[_0x14b8('0x22')](respondWithResult(_0x43e690,0xc9))[_0x14b8('0x2d')](handleError(_0x43e690,null));};exports[_0x14b8('0x58')]=function(_0x13e429,_0x36bac7){if(_0x13e429['body']['id']){delete _0x13e429[_0x14b8('0x59')]['id'];}return db[_0x14b8('0x3e')][_0x14b8('0x56')]({'where':{'id':_0x13e429[_0x14b8('0x54')]['id']}})[_0x14b8('0x22')](handleEntityNotFound(_0x36bac7,null))[_0x14b8('0x22')](saveUpdates(_0x13e429['body'],null))[_0x14b8('0x22')](respondWithResult(_0x36bac7,null))[_0x14b8('0x2d')](handleError(_0x36bac7,null));};exports[_0x14b8('0x38')]=function(_0x44b1aa,_0x35bbdc){return db[_0x14b8('0x3e')][_0x14b8('0x56')]({'where':{'id':_0x44b1aa[_0x14b8('0x54')]['id']}})[_0x14b8('0x22')](handleEntityNotFound(_0x35bbdc,null))[_0x14b8('0x22')](removeEntity(_0x35bbdc,null))[_0x14b8('0x2d')](handleError(_0x35bbdc,null));};exports[_0x14b8('0x5a')]=function(_0x342459,_0x151684){return db[_0x14b8('0x3e')][_0x14b8('0x5a')]()[_0x14b8('0x22')](respondWithResult(_0x151684,null))[_0x14b8('0x2d')](handleError(_0x151684,null));};var interaction_log=require(_0x14b8('0x13'))(_0x14b8('0x5b'));exports[_0x14b8('0x5c')]=function(_0x447736,_0x2ce028,_0x33098a){var _0x160881={'channel':_0x14b8('0x5d')};if(_0x447736['body']['id']){delete _0x447736[_0x14b8('0x59')]['id'];}_0x447736[_0x14b8('0x59')][_0x14b8('0x5e')]=!![];_0x447736['body'][_0x14b8('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x447736[_0x14b8('0x59')][_0x14b8('0x60')]=_0x447736[_0x14b8('0x59')]['UserId']||_0x447736[_0x14b8('0x61')]['id'];return db[_0x14b8('0x3e')][_0x14b8('0x56')]({'where':{'id':_0x447736[_0x14b8('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x14b8('0x62')],'as':_0x14b8('0x63')}]})[_0x14b8('0x22')](handleEntityNotFound(_0x2ce028,null))[_0x14b8('0x22')](saveUpdates(_0x447736['body'],null))[_0x14b8('0x22')](function(_0x42c782){if(_0x42c782){_0x160881[_0x14b8('0x2a')]=_0x42c782[_0x14b8('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x14b8('0x56')]({'where':{'id':_0x42c782['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2ce028,null))[_0x14b8('0x22')](function(_0x5a765a){if(_0x5a765a){return _0x5a765a['update']({'UserId':_0x447736[_0x14b8('0x59')][_0x14b8('0x60')],'read1stAt':_[_0x14b8('0x65')](_0x5a765a[_0x14b8('0x66')])?moment()[_0x14b8('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x44777b){if(_0x44777b){_0x160881[_0x14b8('0x68')]=_0x44777b[_0x14b8('0x64')]({'plain':!![]});interaction_log[_0x14b8('0x2b')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x447736[_0x14b8('0x61')]['id'],_0x447736[_0x14b8('0x61')]['name'],_0x447736['user'][_0x14b8('0x69')],_0x160881[_0x14b8('0x68')]['id'],_0x447736['body']?JSON['stringify'](_0x447736['body']):_0x14b8('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x14b8('0x6b'),_0x160881);}return null;})['then'](function(_0x1cc537){if(_0x1cc537){if(_0x447736[_0x14b8('0x59')][_0x14b8('0x6c')]){_0x160881[_0x14b8('0x2a')][_0x14b8('0x6d')]=util[_0x14b8('0x67')](_0x14b8('0x6e'),_0x447736[_0x14b8('0x61')]['name']);_0x160881[_0x14b8('0x2a')][_0x14b8('0x6f')]=_0x160881[_0x14b8('0x6f')];_0x160881['message'][_0x14b8('0x70')]=_0x14b8('0x5c');return respondWithRpcPromise(_0x14b8('0x71'),_0x14b8('0x71'),{'event':_0x14b8('0x72'),'message':_0x160881['message']},client9002)[_0x14b8('0x22')](function(){return _0x160881;});}return _0x160881;}return null;})[_0x14b8('0x22')](respondWithResult(_0x2ce028,null))[_0x14b8('0x2d')](handleError(_0x2ce028,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x14b8('0x37')]=function(_0x128b8d,_0x569ff2,_0x5f0536){var _0x4249ed={'agent':{},'channel':_0x14b8('0x5d')};if(_0x128b8d[_0x14b8('0x59')]['id']){delete _0x128b8d[_0x14b8('0x59')]['id'];}_0x128b8d[_0x14b8('0x59')][_0x14b8('0x60')]=_0x128b8d['body'][_0x14b8('0x60')]||_0x128b8d[_0x14b8('0x61')]['id'];_0x4249ed[_0x14b8('0x73')]['id']=_0x128b8d['body'][_0x14b8('0x60')];return db[_0x14b8('0x3e')][_0x14b8('0x56')]({'where':{'id':_0x128b8d['params']['id'],'UserId':null}})[_0x14b8('0x22')](handleEntityNotFound(_0x569ff2,null))[_0x14b8('0x22')](function(_0x53c769){if(_0x53c769){_0x4249ed[_0x14b8('0x2a')]=_0x53c769[_0x14b8('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x14b8('0x56')]({'where':{'id':_0x53c769['WhatsappInteractionId']}});}return null;})[_0x14b8('0x22')](handleEntityNotFound(_0x569ff2,null))[_0x14b8('0x22')](function(_0x5e0c95){if(_0x5e0c95){_0x4249ed[_0x14b8('0x68')]=_0x5e0c95['get']({'plain':!![]});interaction_log[_0x14b8('0x2b')](_0x14b8('0x74'),_0x128b8d[_0x14b8('0x61')]['id'],_0x128b8d[_0x14b8('0x61')][_0x14b8('0x3a')],_0x128b8d[_0x14b8('0x61')][_0x14b8('0x69')],_0x4249ed[_0x14b8('0x68')]['id'],_0x128b8d[_0x14b8('0x59')]?JSON[_0x14b8('0x27')](_0x128b8d['body']):_0x14b8('0x6a'));return respondWithRpcPromise(_0x14b8('0x75'),'rejectMessage',_0x4249ed);}return null;})[_0x14b8('0x22')](function(_0x4b2153){if(_0x4b2153){_0x4b2153[_0x14b8('0x2a')][_0x14b8('0x6d')]=util[_0x14b8('0x67')](_0x14b8('0x6e'),_0x128b8d[_0x14b8('0x61')]['name']);_0x4b2153[_0x14b8('0x2a')][_0x14b8('0x6f')]=_0x4249ed[_0x14b8('0x6f')];_0x4b2153[_0x14b8('0x2a')][_0x14b8('0x70')]=_0x14b8('0x37');respondWithRpcPromise(_0x14b8('0x71'),'EventManager',{'event':_0x14b8('0x76'),'message':_0x4b2153[_0x14b8('0x2a')]},client9002);return _0x4249ed;}return null;})[_0x14b8('0x22')](respondWithResult(_0x569ff2,null))[_0x14b8('0x2d')](handleError(_0x569ff2,null));};exports[_0x14b8('0x2f')]=function(_0x192553,_0x43ab9b,_0x145913){if(_0x192553[_0x14b8('0x59')]['id']){delete _0x192553[_0x14b8('0x59')]['id'];}var _0x5b8191;return db['WhatsappMessage'][_0x14b8('0x56')]({'where':{'id':_0x192553[_0x14b8('0x54')]['id']}})[_0x14b8('0x22')](handleEntityNotFound(_0x43ab9b,null))[_0x14b8('0x22')](function(_0x48dadb){if(_0x48dadb){_0x5b8191=_0x48dadb;return db[_0x14b8('0x77')][_0x14b8('0x56')]({'where':{'id':_0x48dadb['WhatsappAccountId']}});}})[_0x14b8('0x22')](handleEntityNotFound(_0x43ab9b,null))[_0x14b8('0x22')](function(_0x1454d7){if(_0x1454d7){logger[_0x14b8('0x25')](_0x14b8('0x78'),_0x14b8('0x2f'),_0x14b8('0x79'),_0x1454d7[_0x14b8('0x41')],util[_0x14b8('0x7a')](_0x192553[_0x14b8('0x59')],{'showHidden':![],'depth':null}));switch(_0x1454d7['type']){case _0x14b8('0x7b'):if(_0x192553[_0x14b8('0x59')][_0x14b8('0x7c')]&&_0x192553[_0x14b8('0x59')][_0x14b8('0x7c')]===_0x5b8191[_0x14b8('0x7d')]&&_0x192553[_0x14b8('0x59')]['MessageStatus']&&_0x192553[_0x14b8('0x59')][_0x14b8('0x7e')]==='read'){return _0x5b8191['update']({'read':!![]});}else{logger[_0x14b8('0x28')](_0x14b8('0x7f'),'status',_0x14b8('0x7b'),util[_0x14b8('0x7a')](_0x192553['body'],{'showHidden':![],'depth':null}));}break;}return _0x5b8191;}})['then'](respondWithResult(_0x43ab9b,null))[_0x14b8('0x2d')](handleError(_0x43ab9b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index e4bbfb1..89ddf72 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(_0x4ca8be,_0x89738b){var _0x250f08=function(_0x39fb79){while(--_0x39fb79){_0x4ca8be['push'](_0x4ca8be['shift']());}};_0x250f08(++_0x89738b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f9f03,_0x56d035){_0x1f9f03=_0x1f9f03-0x0;var _0x3c7c89=_0x5f2f[_0x1f9f03];return _0x3c7c89;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x2ade4f,_0x47a30f){var _0x26fe7e=function(_0x22c761){while(--_0x22c761){_0x2ade4f['push'](_0x2ade4f['shift']());}};_0x26fe7e(++_0x47a30f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x54a229,_0x479dd1){_0x54a229=_0x54a229-0x0;var _0x36232e=_0x5f2f[_0x54a229];return _0x36232e;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f7dfc7e..11f9087 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 _0x0482=['whatsapp_messages','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','out','secret','findOne','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','update','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','finally','utf8mb4','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappMessage'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0x0482,0x183));var _0x2048=function(_0x35e124,_0x1d85e2){_0x35e124=_0x35e124-0x0;var _0x53c482=_0x0482[_0x35e124];return _0x53c482;};'use strict';var _=require('lodash');var util=require(_0x2048('0x0'));var logger=require('../../config/logger')(_0x2048('0x1'));var moment=require(_0x2048('0x2'));var BPromise=require(_0x2048('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2048('0x4'));var rimraf=require(_0x2048('0x5'));var config=require(_0x2048('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x2048('0x7')]=function(_0x14a8a2,_0x567405){return _0x14a8a2['define'](_0x2048('0x8'),attributes,{'tableName':_0x2048('0x9'),'paranoid':![],'indexes':[{'name':_0x2048('0xa'),'fields':[_0x2048('0xa')]},{'name':_0x2048('0xb'),'fields':[_0x2048('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x426a21,_0xca4aa7,_0x1623b9){var _0x453d52=_0x14a8a2[_0x2048('0xd')];var _0x38ddf5=_0x426a21['get']({'plain':!![]});if(_0x38ddf5[_0x2048('0xe')]['toLowerCase']()==='in'||_0x38ddf5[_0x2048('0xe')][_0x2048('0xf')]()===_0x2048('0x10')&&!_0x38ddf5[_0x2048('0x11')]&&!_['isNil'](_0x38ddf5['UserId'])){_0x453d52['WhatsappInteraction'][_0x2048('0x12')]({'where':{'id':_0x38ddf5['WhatsappInteractionId']}})['then'](function(_0x4c64fe){if(_0x4c64fe){_0x4c64fe['update']({'lastMsgAt':_0x38ddf5[_0x2048('0x13')],'lastMsgDirection':_0x38ddf5[_0x2048('0xe')][_0x2048('0xf')]()});}})[_0x2048('0x14')](function(_0x3574b1){console['error'](_0x3574b1);});}if(_0x38ddf5['direction']===_0x2048('0x10')&&!_0x38ddf5[_0x2048('0x11')]){var _0x515471;_0x453d52[_0x2048('0x15')][_0x2048('0x16')]({'where':{'id':_0x38ddf5[_0x2048('0x17')]},'raw':!![]})[_0x2048('0x18')](function(_0x41afd6){_0x515471=_0x41afd6;if(_0x515471&&_0x515471[_0x2048('0x19')]){switch(_0x515471[_0x2048('0x19')]){case _0x2048('0x1a'):var _0x6feea2=require('twilio');if(_0x515471[_0x2048('0x1b')]&&_0x515471[_0x2048('0x1c')]&&_0x515471['phone']){var _0x261e5e=new _0x6feea2(_0x515471[_0x2048('0x1b')],_0x515471['authToken']);_0x261e5e[_0x2048('0x1d')][_0x2048('0x1e')]({'body':_0x38ddf5[_0x2048('0xc')],'to':_0x2048('0x1f')+_0x38ddf5[_0x2048('0x20')],'from':_0x2048('0x1f')+_0x515471['phone'],'statusCallback':_0x515471[_0x2048('0x21')]+_0x2048('0x22')+_0x38ddf5['id']+_0x2048('0x23')+_0x515471['token']})['then'](function(_0x74f9fb){if(_0x74f9fb[_0x2048('0x24')]){return _0x426a21[_0x2048('0x25')]({'messageId':_0x74f9fb[_0x2048('0x24')]});}})[_0x2048('0x14')](function(_0x3489d1){logger[_0x2048('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2048('0x27'),_0x2048('0x1a'),util[_0x2048('0x28')](_0x3489d1,{'showHidden':![],'depth':null}));});}else{logger[_0x2048('0x26')](_0x2048('0x29'),_0x2048('0x27'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x2048('0x2a')](function(){_0x1623b9();});}else{_0x1623b9();}}},'charset':_0x2048('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2be7=['get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x2be7,0x1c4));var _0x72be=function(_0x4a30f1,_0x2e75a8){_0x4a30f1=_0x4a30f1-0x0;var _0x1e0a09=_0x2be7[_0x4a30f1];return _0x1e0a09;};'use strict';var _=require(_0x72be('0x0'));var util=require(_0x72be('0x1'));var logger=require(_0x72be('0x2'))(_0x72be('0x3'));var moment=require(_0x72be('0x4'));var BPromise=require(_0x72be('0x5'));var rp=require(_0x72be('0x6'));var fs=require('fs');var path=require(_0x72be('0x7'));var rimraf=require('rimraf');var config=require(_0x72be('0x8'));var attributes=require(_0x72be('0x9'));module[_0x72be('0xa')]=function(_0x5b8737,_0x510e0f){return _0x5b8737['define'](_0x72be('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x72be('0xc')]},{'name':_0x72be('0xd'),'fields':[_0x72be('0xe')],'type':_0x72be('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x529340,_0x43f453,_0x1b9b4b){var _0x1a2d0e=_0x5b8737['models'];var _0x50c5b6=_0x529340[_0x72be('0x10')]({'plain':!![]});if(_0x50c5b6[_0x72be('0x11')][_0x72be('0x12')]()==='in'||_0x50c5b6[_0x72be('0x11')][_0x72be('0x12')]()===_0x72be('0x13')&&!_0x50c5b6['secret']&&!_[_0x72be('0x14')](_0x50c5b6[_0x72be('0x15')])){_0x1a2d0e[_0x72be('0x16')][_0x72be('0x17')]({'where':{'id':_0x50c5b6[_0x72be('0x18')]}})['then'](function(_0x30cf2f){if(_0x30cf2f){_0x30cf2f[_0x72be('0x19')]({'lastMsgAt':_0x50c5b6[_0x72be('0x1a')],'lastMsgDirection':_0x50c5b6[_0x72be('0x11')][_0x72be('0x12')]()});}})[_0x72be('0x1b')](function(_0x3b799f){console[_0x72be('0x1c')](_0x3b799f);});}if(_0x50c5b6['direction']===_0x72be('0x13')&&!_0x50c5b6[_0x72be('0x1d')]){var _0x45d94a;_0x1a2d0e[_0x72be('0x1e')][_0x72be('0x1f')]({'where':{'id':_0x50c5b6[_0x72be('0x20')]},'raw':!![]})[_0x72be('0x21')](function(_0x523ce2){_0x45d94a=_0x523ce2;if(_0x45d94a&&_0x45d94a[_0x72be('0x22')]){switch(_0x45d94a[_0x72be('0x22')]){case _0x72be('0x23'):var _0x3ce769=require(_0x72be('0x23'));if(_0x45d94a[_0x72be('0x24')]&&_0x45d94a[_0x72be('0x25')]&&_0x45d94a['phone']){var _0x4aa717=new _0x3ce769(_0x45d94a[_0x72be('0x24')],_0x45d94a[_0x72be('0x25')]);_0x4aa717[_0x72be('0x26')][_0x72be('0x27')]({'body':_0x50c5b6[_0x72be('0xe')],'to':_0x72be('0x28')+_0x50c5b6[_0x72be('0x29')],'from':_0x72be('0x28')+_0x45d94a['phone'],'statusCallback':_0x45d94a['remote']+_0x72be('0x2a')+_0x50c5b6['id']+_0x72be('0x2b')+_0x45d94a[_0x72be('0x2c')]})[_0x72be('0x21')](function(_0x37ce54){if(_0x37ce54[_0x72be('0x2d')]){return _0x529340[_0x72be('0x19')]({'messageId':_0x37ce54[_0x72be('0x2d')]});}})['catch'](function(_0x34d749){logger[_0x72be('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x72be('0x2e'),_0x72be('0x23'),util[_0x72be('0x2f')](_0x34d749,{'showHidden':![],'depth':null}));});}else{logger[_0x72be('0x1c')](_0x72be('0x30'),_0x72be('0x2e'),_0x72be('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x72be('0x31')](function(){_0x1b9b4b();});}else{_0x1b9b4b();}}},'charset':_0x72be('0x32'),'collate':_0x72be('0x33')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c231f3c..1314c79 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 _0xc55d=['CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./whatsappMessage.socket','request','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','WhatsappMessage','create','body','options','raw','then'];(function(_0x44b4ee,_0x444cd9){var _0x5298e2=function(_0x534451){while(--_0x534451){_0x44b4ee['push'](_0x44b4ee['shift']());}};_0x5298e2(++_0x444cd9);}(_0xc55d,0xab));var _0xdc55=function(_0x192f6e,_0x519fd4){_0x192f6e=_0x192f6e-0x0;var _0x3f5b1b=_0xc55d[_0x192f6e];return _0x3f5b1b;};'use strict';var _=require(_0xdc55('0x0'));var util=require(_0xdc55('0x1'));var moment=require('moment');var BPromise=require(_0xdc55('0x2'));var rs=require(_0xdc55('0x3'));var fs=require('fs');var Redis=require(_0xdc55('0x4'));var db=require(_0xdc55('0x5'))['db'];var utils=require(_0xdc55('0x6'));var logger=require(_0xdc55('0x7'))(_0xdc55('0x8'));var config=require(_0xdc55('0x9'));var jayson=require(_0xdc55('0xa'));var client=jayson[_0xdc55('0xb')]['http']({'port':0x232a});config[_0xdc55('0xc')]=_['defaults'](config[_0xdc55('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc55('0xd'))(new Redis(config['redis']));require(_0xdc55('0xe'))['register'](socket);function respondWithRpcPromise(_0x1f3c9f,_0x456faf,_0x38a20f){return new BPromise(function(_0x42b7ea,_0x59595a){return client[_0xdc55('0xf')](_0x1f3c9f,_0x38a20f)['then'](function(_0x487ad0){logger[_0xdc55('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x456faf,'request\x20sent');logger[_0xdc55('0x11')](_0xdc55('0x12'),_0x456faf,_0xdc55('0x13'),JSON[_0xdc55('0x14')](_0x487ad0));if(_0x487ad0[_0xdc55('0x15')]){if(_0x487ad0[_0xdc55('0x15')][_0xdc55('0x16')]===0x1f4){logger[_0xdc55('0x15')](_0xdc55('0x17'),_0x456faf,_0x487ad0[_0xdc55('0x15')][_0xdc55('0x18')]);return _0x59595a(_0x487ad0[_0xdc55('0x15')][_0xdc55('0x18')]);}logger[_0xdc55('0x15')](_0xdc55('0x17'),_0x456faf,_0x487ad0[_0xdc55('0x15')][_0xdc55('0x18')]);return _0x42b7ea(_0x487ad0['error'][_0xdc55('0x18')]);}else{logger['info'](_0xdc55('0x17'),_0x456faf,_0xdc55('0x13'));_0x42b7ea(_0x487ad0[_0xdc55('0x19')]['message']);}})[_0xdc55('0x1a')](function(_0x50a6c9){logger[_0xdc55('0x15')](_0xdc55('0x17'),_0x456faf,_0x50a6c9);_0x59595a(_0x50a6c9);});});}exports['CreateWhatsappMessage']=function(_0x222f70){var _0x402cd0=this;return new Promise(function(_0x5efc89,_0x1e728c){return db[_0xdc55('0x1b')][_0xdc55('0x1c')](_0x222f70[_0xdc55('0x1d')],{'raw':_0x222f70['options']?_0x222f70[_0xdc55('0x1e')][_0xdc55('0x1f')]===undefined?!![]:![]:!![]})[_0xdc55('0x20')](function(_0x5e407c){logger[_0xdc55('0x10')](_0xdc55('0x21'),_0x222f70);logger[_0xdc55('0x11')](_0xdc55('0x21'),_0x222f70,JSON[_0xdc55('0x14')](_0x5e407c));_0x5efc89(_0x5e407c);})[_0xdc55('0x1a')](function(_0xf374f7){logger[_0xdc55('0x15')](_0xdc55('0x21'),_0xf374f7[_0xdc55('0x18')],_0x222f70);_0x1e728c(_0x402cd0[_0xdc55('0x15')](0x1f4,_0xf374f7[_0xdc55('0x18')]));});});}; \ No newline at end of file +var _0x06ce=['http','redis','defaults','localhost','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x06ce,0xca));var _0xe06c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ce[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe06c('0x0'));var util=require(_0xe06c('0x1'));var moment=require(_0xe06c('0x2'));var BPromise=require(_0xe06c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe06c('0x4'));var db=require(_0xe06c('0x5'))['db'];var utils=require(_0xe06c('0x6'));var logger=require(_0xe06c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06c('0x8')]({'port':0x232a});config[_0xe06c('0x9')]=_[_0xe06c('0xa')](config[_0xe06c('0x9')],{'host':_0xe06c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe06c('0x9')]));require(_0xe06c('0xc'))[_0xe06c('0xd')](socket);function respondWithRpcPromise(_0x134345,_0x25b159,_0x516389){return new BPromise(function(_0x18a734,_0x5dfd74){return client['request'](_0x134345,_0x516389)[_0xe06c('0xe')](function(_0x498f8d){logger[_0xe06c('0xf')](_0xe06c('0x10'),_0x25b159,_0xe06c('0x11'));logger[_0xe06c('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x25b159,_0xe06c('0x11'),JSON[_0xe06c('0x13')](_0x498f8d));if(_0x498f8d[_0xe06c('0x14')]){if(_0x498f8d[_0xe06c('0x14')][_0xe06c('0x15')]===0x1f4){logger[_0xe06c('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x25b159,_0x498f8d[_0xe06c('0x14')]['message']);return _0x5dfd74(_0x498f8d[_0xe06c('0x14')][_0xe06c('0x16')]);}logger['error'](_0xe06c('0x10'),_0x25b159,_0x498f8d[_0xe06c('0x14')][_0xe06c('0x16')]);return _0x18a734(_0x498f8d[_0xe06c('0x14')][_0xe06c('0x16')]);}else{logger[_0xe06c('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x25b159,'request\x20sent');_0x18a734(_0x498f8d[_0xe06c('0x17')][_0xe06c('0x16')]);}})['catch'](function(_0x123e65){logger[_0xe06c('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x25b159,_0x123e65);_0x5dfd74(_0x123e65);});});}exports[_0xe06c('0x18')]=function(_0x3537a3){var _0x5dba0e=this;return new Promise(function(_0x39e8f3,_0x58cb3d){return db[_0xe06c('0x19')][_0xe06c('0x1a')](_0x3537a3[_0xe06c('0x1b')],{'raw':_0x3537a3['options']?_0x3537a3[_0xe06c('0x1c')][_0xe06c('0x1d')]===undefined?!![]:![]:!![]})[_0xe06c('0xe')](function(_0x400f29){logger[_0xe06c('0xf')](_0xe06c('0x18'),_0x3537a3);logger['debug'](_0xe06c('0x18'),_0x3537a3,JSON[_0xe06c('0x13')](_0x400f29));_0x39e8f3(_0x400f29);})['catch'](function(_0x30fae6){logger[_0xe06c('0x14')](_0xe06c('0x18'),_0x30fae6[_0xe06c('0x16')],_0x3537a3);_0x58cb3d(_0x5dba0e[_0xe06c('0x14')](0x1f4,_0x30fae6[_0xe06c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 251f169..8e1fbd2 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 _0x3e30=['removeListener','register','whatsappMessage:','save','remove','emit'];(function(_0x4e6452,_0x18ec40){var _0x149c26=function(_0x570558){while(--_0x570558){_0x4e6452['push'](_0x4e6452['shift']());}};_0x149c26(++_0x18ec40);}(_0x3e30,0x1cb));var _0x03e3=function(_0x1dda39,_0x221826){_0x1dda39=_0x1dda39-0x0;var _0x269408=_0x3e30[_0x1dda39];return _0x269408;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x03e3('0x0'),_0x03e3('0x1'),'update'];function createListener(_0x39a8e1,_0x227e8f){return function(_0x237082){_0x227e8f[_0x03e3('0x2')](_0x39a8e1,_0x237082);};}function removeListener(_0x118aef,_0x398433){return function(){WhatsappMessageEvents[_0x03e3('0x3')](_0x118aef,_0x398433);};}exports[_0x03e3('0x4')]=function(_0x3ea6ce){for(var _0x4f7ace=0x0,_0x2e653a=events['length'];_0x4f7ace<_0x2e653a;_0x4f7ace++){var _0x111f2a=events[_0x4f7ace];var _0x87bad1=createListener(_0x03e3('0x5')+_0x111f2a,_0x3ea6ce);WhatsappMessageEvents['on'](_0x111f2a,_0x87bad1);}}; \ No newline at end of file +var _0x2698=['emit','removeListener','./whatsappMessage.events','remove','update'];(function(_0x5c908c,_0x4bcfab){var _0x39325f=function(_0x20b5a6){while(--_0x20b5a6){_0x5c908c['push'](_0x5c908c['shift']());}};_0x39325f(++_0x4bcfab);}(_0x2698,0x124));var _0x8269=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2698[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x8269('0x0'));var events=['save',_0x8269('0x1'),_0x8269('0x2')];function createListener(_0x26e082,_0x392316){return function(_0xbf4bfa){_0x392316[_0x8269('0x3')](_0x26e082,_0xbf4bfa);};}function removeListener(_0xd228f8,_0x37b87c){return function(){WhatsappMessageEvents[_0x8269('0x4')](_0xd228f8,_0x37b87c);};}exports['register']=function(_0x5c94cd){for(var _0x4194be=0x0,_0x3f675b=events['length'];_0x4194be<_0x3f675b;_0x4194be++){var _0xf6a78e=events[_0x4194be];var _0x7480d2=createListener('whatsappMessage:'+_0xf6a78e,_0x5c94cd);WhatsappMessageEvents['on'](_0xf6a78e,_0x7480d2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 1185867..7ce5ee0 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 _0x943c=['show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x460e2a,_0x522ed0){var _0x5d847c=function(_0x2af995){while(--_0x2af995){_0x460e2a['push'](_0x460e2a['shift']());}};_0x5d847c(++_0x522ed0);}(_0x943c,0xcc));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc943('0x0'));var util=require('util');var path=require(_0xc943('0x1'));var timeout=require(_0xc943('0x2'));var express=require(_0xc943('0x3'));var router=express['Router']();var auth=require(_0xc943('0x4'));var interaction=require(_0xc943('0x5'));var config=require(_0xc943('0x6'));var controller=require(_0xc943('0x7'));router['get']('/',auth[_0xc943('0x8')](),controller[_0xc943('0x9')]);router[_0xc943('0xa')](_0xc943('0xb'),auth[_0xc943('0x8')](),controller[_0xc943('0xc')]);router[_0xc943('0xa')]('/:id',auth[_0xc943('0x8')](),controller[_0xc943('0xd')]);router[_0xc943('0xa')](_0xc943('0xe'),auth[_0xc943('0x8')](),controller[_0xc943('0xf')]);router['get']('/:id/teams',auth[_0xc943('0x8')](),controller[_0xc943('0x10')]);router[_0xc943('0xa')](_0xc943('0x11'),auth[_0xc943('0x8')](),controller[_0xc943('0x12')]);router[_0xc943('0x13')]('/',auth[_0xc943('0x8')](),controller[_0xc943('0x14')]);router[_0xc943('0x13')](_0xc943('0x15'),auth[_0xc943('0x8')](),controller[_0xc943('0x16')]);router[_0xc943('0x13')](_0xc943('0x11'),auth[_0xc943('0x8')](),controller[_0xc943('0x17')]);router[_0xc943('0x18')]('/:id',auth[_0xc943('0x8')](),controller[_0xc943('0x19')]);router[_0xc943('0x1a')](_0xc943('0x1b'),auth[_0xc943('0x8')](),controller[_0xc943('0x1c')]);router[_0xc943('0x1a')]('/:id/teams',auth[_0xc943('0x8')](),controller[_0xc943('0x1d')]);router[_0xc943('0x1a')](_0xc943('0x11'),auth[_0xc943('0x8')](),controller['removeAgents']);module[_0xc943('0x1e')]=router; \ No newline at end of file +var _0x99c7=['create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x99c7,0xea));var _0x799c=function(_0x3766be,_0x738854){_0x3766be=_0x3766be-0x0;var _0x13394f=_0x99c7[_0x3766be];return _0x13394f;};'use strict';var multer=require(_0x799c('0x0'));var util=require('util');var path=require(_0x799c('0x1'));var timeout=require(_0x799c('0x2'));var express=require('express');var router=express[_0x799c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x799c('0x4'));var config=require(_0x799c('0x5'));var controller=require(_0x799c('0x6'));router[_0x799c('0x7')]('/',auth[_0x799c('0x8')](),controller['index']);router[_0x799c('0x7')](_0x799c('0x9'),auth[_0x799c('0x8')](),controller[_0x799c('0xa')]);router[_0x799c('0x7')]('/:id',auth[_0x799c('0x8')](),controller[_0x799c('0xb')]);router[_0x799c('0x7')](_0x799c('0xc'),auth['isAuthenticated'](),controller[_0x799c('0xd')]);router[_0x799c('0x7')](_0x799c('0xe'),auth[_0x799c('0x8')](),controller[_0x799c('0xf')]);router[_0x799c('0x7')](_0x799c('0x10'),auth[_0x799c('0x8')](),controller[_0x799c('0x11')]);router['post']('/',auth[_0x799c('0x8')](),controller[_0x799c('0x12')]);router[_0x799c('0x13')](_0x799c('0xe'),auth['isAuthenticated'](),controller[_0x799c('0x14')]);router['post']('/:id/users',auth[_0x799c('0x8')](),controller[_0x799c('0x15')]);router['put'](_0x799c('0x16'),auth[_0x799c('0x8')](),controller[_0x799c('0x17')]);router[_0x799c('0x18')](_0x799c('0x16'),auth[_0x799c('0x8')](),controller[_0x799c('0x19')]);router['delete'](_0x799c('0xe'),auth[_0x799c('0x8')](),controller[_0x799c('0x1a')]);router['delete']('/:id/users',auth[_0x799c('0x8')](),controller['removeAgents']);module[_0x799c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 494a6fd..599f6a7 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 _0xba5b=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','exports'];(function(_0x910736,_0x1cfad2){var _0x7218ff=function(_0x2b71b0){while(--_0x2b71b0){_0x910736['push'](_0x910736['shift']());}};_0x7218ff(++_0x1cfad2);}(_0xba5b,0x1cf));var _0xbba5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xba5b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xbba5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbba5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbba5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbba5('0x3')](_0xbba5('0x4'),_0xbba5('0x5'),_0xbba5('0x6'))},'description':{'type':Sequelize[_0xbba5('0x7')]}}; \ No newline at end of file +var _0xa7dc=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x9fb574,_0x2fa78c){var _0x5a7ec3=function(_0x1feb2f){while(--_0x1feb2f){_0x9fb574['push'](_0x9fb574['shift']());}};_0x5a7ec3(++_0x2fa78c);}(_0xa7dc,0x11d));var _0xca7d=function(_0x5bdc84,_0x427a10){_0x5bdc84=_0x5bdc84-0x0;var _0x1e66db=_0xa7dc[_0x5bdc84];return _0x1e66db;};'use strict';var Sequelize=require(_0xca7d('0x0'));module[_0xca7d('0x1')]={'name':{'type':Sequelize[_0xca7d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xca7d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xca7d('0x4'),_0xca7d('0x5'),_0xca7d('0x6'))},'description':{'type':Sequelize[_0xca7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e339009..cc95169 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 _0x7ed1=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','findOne','nolimit','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','WhatsappQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x7ed1,0xca));var _0x17ed=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x7ed1[_0x1b2ff7];return _0x31656a;};'use strict';var pdf=require(_0x17ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17ed('0x1'));var zipdir=require(_0x17ed('0x2'));var jsonpatch=require(_0x17ed('0x3'));var rp=require(_0x17ed('0x4'));var moment=require(_0x17ed('0x5'));var BPromise=require(_0x17ed('0x6'));var Mustache=require('mustache');var util=require(_0x17ed('0x7'));var path=require(_0x17ed('0x8'));var sox=require(_0x17ed('0x9'));var csv=require(_0x17ed('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x17ed('0xb'));var crypto=require(_0x17ed('0xc'));var jsforce=require(_0x17ed('0xd'));var deskjs=require(_0x17ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require(_0x17ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x17ed('0x16'));var db=require(_0x17ed('0x17'))['db'];config[_0x17ed('0x18')]=_[_0x17ed('0x19')](config[_0x17ed('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ed('0x1a'))(new Redis(config[_0x17ed('0x18')]));require(_0x17ed('0x1b'))['register'](socket);function respondWithStatusCode(_0x2ae9aa,_0x53ec2a){_0x53ec2a=_0x53ec2a||0xcc;return function(_0x513e5c){if(_0x513e5c){return _0x2ae9aa[_0x17ed('0x1c')](_0x53ec2a);}return _0x2ae9aa['status'](_0x53ec2a)[_0x17ed('0x1d')]();};}function respondWithResult(_0x4782c3,_0xd10a00){_0xd10a00=_0xd10a00||0xc8;return function(_0x6ccf15){if(_0x6ccf15){return _0x4782c3['status'](_0xd10a00)[_0x17ed('0x1e')](_0x6ccf15);}};}function respondWithFilteredResult(_0x172ae9,_0x20b6d2){return function(_0x5ade66){if(_0x5ade66){var _0x52518e=_0x5ade66[_0x17ed('0x1f')],_0x81e1a6=_0x20b6d2[_0x17ed('0x20')],_0x2903f3=_0x20b6d2['offset']+_0x20b6d2[_0x17ed('0x21')],_0x933215;if(_0x2903f3>=_0x52518e){_0x2903f3=_0x52518e;_0x933215=0xc8;}else{_0x933215=0xce;}_0x172ae9[_0x17ed('0x22')](_0x933215);return _0x172ae9['set'](_0x17ed('0x23'),_0x81e1a6+'-'+_0x2903f3+'/'+_0x52518e)[_0x17ed('0x1e')](_0x5ade66);}return null;};}function patchUpdates(_0x532b3a){return function(_0xc40193){try{jsonpatch[_0x17ed('0x24')](_0xc40193,_0x532b3a,!![]);}catch(_0x2298ea){return BPromise[_0x17ed('0x25')](_0x2298ea);}return _0xc40193[_0x17ed('0x26')]();};}function saveUpdates(_0x2e5f56,_0x43243e){return function(_0x50f6a3){if(_0x50f6a3){return _0x50f6a3[_0x17ed('0x27')](_0x2e5f56)[_0x17ed('0x28')](function(_0x5e1602){return _0x5e1602;});}return null;};}function removeEntity(_0x5e4f27,_0x464799){return function(_0x5d095b){if(_0x5d095b){return _0x5d095b['destroy']()['then'](function(){var _0x284c72=_0x5d095b['get']({'plain':!![]});var _0x2bbff3=_0x17ed('0x29');return db[_0x17ed('0x2a')]['destroy']({'where':{'type':_0x2bbff3,'resourceId':_0x284c72['id']}})[_0x17ed('0x28')](function(){return _0x5d095b;});})[_0x17ed('0x28')](function(){_0x5e4f27[_0x17ed('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57470d,_0x170d4f){return function(_0xb3ea65){if(!_0xb3ea65){_0x57470d[_0x17ed('0x1c')](0x194);}return _0xb3ea65;};}function handleError(_0x5a02ab,_0x38bb50){_0x38bb50=_0x38bb50||0x1f4;return function(_0x2ca36a){logger[_0x17ed('0x2b')](_0x2ca36a[_0x17ed('0x2c')]);if(_0x2ca36a['name']){delete _0x2ca36a[_0x17ed('0x2d')];}_0x5a02ab[_0x17ed('0x22')](_0x38bb50)['send'](_0x2ca36a);};}exports[_0x17ed('0x2e')]=function(_0xd0289,_0xf325ed){var _0x529966={},_0x3a9f86={},_0x4544ec={'count':0x0,'rows':[]};var _0x4087e5=_[_0x17ed('0x2f')](db['WhatsappQueue'][_0x17ed('0x30')],function(_0x508444){return{'name':_0x508444[_0x17ed('0x31')],'type':_0x508444[_0x17ed('0x32')][_0x17ed('0x33')]};});_0x3a9f86[_0x17ed('0x34')]=_['map'](_0x4087e5,_0x17ed('0x2d'));_0x3a9f86[_0x17ed('0x35')]=_[_0x17ed('0x36')](_0xd0289[_0x17ed('0x35')]);_0x3a9f86[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0x3a9f86[_0x17ed('0x34')],_0x3a9f86[_0x17ed('0x35')]);_0x529966['attributes']=_[_0x17ed('0x38')](_0x3a9f86[_0x17ed('0x34')],qs[_0x17ed('0x39')](_0xd0289[_0x17ed('0x35')][_0x17ed('0x39')]));_0x529966['attributes']=_0x529966[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0x529966['attributes']:_0x3a9f86['model'];if(!_0xd0289['query'][_0x17ed('0x3c')]('nolimit')){_0x529966[_0x17ed('0x21')]=qs[_0x17ed('0x21')](_0xd0289[_0x17ed('0x35')]['limit']);_0x529966[_0x17ed('0x20')]=qs[_0x17ed('0x20')](_0xd0289[_0x17ed('0x35')][_0x17ed('0x20')]);}_0x529966[_0x17ed('0x3d')]=qs['sort'](_0xd0289[_0x17ed('0x35')][_0x17ed('0x3e')]);_0x529966[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0xd0289[_0x17ed('0x35')],_0x3a9f86['filters']),_0x4087e5);if(_0xd0289['query'][_0x17ed('0x41')]){_0x529966[_0x17ed('0x3f')]=_['merge'](_0x529966[_0x17ed('0x3f')],{'$or':_[_0x17ed('0x2f')](_0x4087e5,function(_0x58dcac){if(_0x58dcac[_0x17ed('0x32')]!==_0x17ed('0x42')){var _0x46b1b9={};_0x46b1b9[_0x58dcac[_0x17ed('0x2d')]]={'$like':'%'+_0xd0289[_0x17ed('0x35')][_0x17ed('0x41')]+'%'};return _0x46b1b9;}})});}_0x529966=_[_0x17ed('0x43')]({},_0x529966,_0xd0289[_0x17ed('0x44')]);var _0x483179={'where':_0x529966[_0x17ed('0x3f')]};return db[_0x17ed('0x45')][_0x17ed('0x1f')](_0x483179)[_0x17ed('0x28')](function(_0x58c19a){_0x4544ec[_0x17ed('0x1f')]=_0x58c19a;if(_0xd0289[_0x17ed('0x35')][_0x17ed('0x46')]){_0x529966[_0x17ed('0x47')]=[{'all':!![]}];}return db[_0x17ed('0x45')][_0x17ed('0x48')](_0x529966);})[_0x17ed('0x28')](function(_0x1e3b59){_0x4544ec[_0x17ed('0x49')]=_0x1e3b59;return _0x4544ec;})[_0x17ed('0x28')](respondWithFilteredResult(_0xf325ed,_0x529966))[_0x17ed('0x4a')](handleError(_0xf325ed,null));};exports[_0x17ed('0x4b')]=function(_0x110f36,_0x474d2c){var _0x47d382={'raw':!![],'where':{'id':_0x110f36[_0x17ed('0x4c')]['id']}},_0xe6e696={};_0xe6e696[_0x17ed('0x34')]=_[_0x17ed('0x36')](db[_0x17ed('0x45')]['rawAttributes']);_0xe6e696[_0x17ed('0x35')]=_[_0x17ed('0x36')](_0x110f36[_0x17ed('0x35')]);_0xe6e696[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0xe6e696[_0x17ed('0x34')],_0xe6e696[_0x17ed('0x35')]);_0x47d382[_0x17ed('0x3a')]=_[_0x17ed('0x38')](_0xe6e696[_0x17ed('0x34')],qs[_0x17ed('0x39')](_0x110f36['query']['fields']));_0x47d382[_0x17ed('0x3a')]=_0x47d382[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0x47d382[_0x17ed('0x3a')]:_0xe6e696[_0x17ed('0x34')];if(_0x110f36[_0x17ed('0x35')][_0x17ed('0x46')]){_0x47d382[_0x17ed('0x47')]=[{'all':!![]}];}_0x47d382=_[_0x17ed('0x43')]({},_0x47d382,_0x110f36['options']);return db[_0x17ed('0x45')][_0x17ed('0x4d')](_0x47d382)[_0x17ed('0x28')](handleEntityNotFound(_0x474d2c,null))['then'](respondWithResult(_0x474d2c,null))['catch'](handleError(_0x474d2c,null));};exports[_0x17ed('0x4e')]=function(_0xfeff75,_0x504279){return db['WhatsappQueue']['create'](_0xfeff75[_0x17ed('0x4f')],{})[_0x17ed('0x28')](function(_0x2b2db0){var _0x3888b7=_0xfeff75[_0x17ed('0x50')][_0x17ed('0x51')]({'plain':!![]});if(!_0x3888b7)throw new Error(_0x17ed('0x52'));if(_0x3888b7[_0x17ed('0x53')]===_0x17ed('0x50')){var _0x24d5f8=_0x2b2db0[_0x17ed('0x51')]({'plain':!![]});var _0xbeff00='WhatsappQueues';return db[_0x17ed('0x54')][_0x17ed('0x4d')]({'where':{'name':_0xbeff00,'userProfileId':_0x3888b7['userProfileId']},'raw':!![]})[_0x17ed('0x28')](function(_0x57139c){if(_0x57139c&&_0x57139c[_0x17ed('0x55')]===0x0){return db[_0x17ed('0x2a')][_0x17ed('0x4e')]({'name':_0x24d5f8[_0x17ed('0x2d')],'resourceId':_0x24d5f8['id'],'type':_0x57139c['name'],'sectionId':_0x57139c['id']},{})[_0x17ed('0x28')](function(){return _0x2b2db0;});}else{return _0x2b2db0;}})['catch'](function(_0x187092){logger['error'](_0x17ed('0x56'),_0x187092);throw _0x187092;});}return _0x2b2db0;})[_0x17ed('0x28')](respondWithResult(_0x504279,0xc9))[_0x17ed('0x4a')](handleError(_0x504279,null));};exports['update']=function(_0x59a987,_0x3246ab){if(_0x59a987[_0x17ed('0x4f')]['id']){delete _0x59a987[_0x17ed('0x4f')]['id'];}return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x59a987[_0x17ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3246ab,null))['then'](saveUpdates(_0x59a987[_0x17ed('0x4f')],null))[_0x17ed('0x28')](respondWithResult(_0x3246ab,null))[_0x17ed('0x4a')](handleError(_0x3246ab,null));};exports[_0x17ed('0x57')]=function(_0x5ec1cd,_0x4968bc){return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x5ec1cd[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x4968bc,null))[_0x17ed('0x28')](removeEntity(_0x4968bc,null))[_0x17ed('0x4a')](handleError(_0x4968bc,null));};exports['describe']=function(_0x5742de,_0x4211a7){return db['WhatsappQueue'][_0x17ed('0x58')]()['then'](respondWithResult(_0x4211a7,null))[_0x17ed('0x4a')](handleError(_0x4211a7,null));};exports['getMembers']=function(_0x19155b,_0x1251fb,_0x150ee6){var _0xb16079={'raw':!![],'where':{}},_0x4a3331={},_0xc5e941;return db[_0x17ed('0x45')][_0x17ed('0x59')]({'where':{'id':_0x19155b['params']['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x1251fb,null))[_0x17ed('0x28')](function(_0x20c2ac){if(_0x20c2ac){_0xc5e941=_0x20c2ac[_0x17ed('0x51')]({'plain':!![]});_0x4a3331['model']=_[_0x17ed('0x36')](db['UserWhatsappQueue'][_0x17ed('0x30')]);_0x4a3331[_0x17ed('0x35')]=_['keys'](_0x19155b['query']);_0x4a3331[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0x4a3331[_0x17ed('0x34')],_0x4a3331['query']);_0xb16079[_0x17ed('0x3a')]=_[_0x17ed('0x38')](_0x4a3331['model'],qs['fields'](_0x19155b[_0x17ed('0x35')][_0x17ed('0x39')]));_0xb16079[_0x17ed('0x3a')]=_0xb16079[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0xb16079[_0x17ed('0x3a')]:_0x4a3331[_0x17ed('0x34')];if(!_0x19155b['query']['hasOwnProperty'](_0x17ed('0x5a'))){_0xb16079[_0x17ed('0x21')]=qs['limit'](_0x19155b['query'][_0x17ed('0x21')]);_0xb16079['offset']=qs['offset'](_0x19155b[_0x17ed('0x35')]['offset']);}_0xb16079['order']=qs[_0x17ed('0x3e')](_0x19155b[_0x17ed('0x35')]['sort']);_0xb16079[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0x19155b[_0x17ed('0x35')],_0x4a3331[_0x17ed('0x37')]));_0xb16079[_0x17ed('0x3f')][_0x17ed('0x5b')]=_0x20c2ac['id'];if(_0x19155b['query'][_0x17ed('0x41')]){_0xb16079[_0x17ed('0x3f')]=_[_0x17ed('0x43')](_0xb16079[_0x17ed('0x3f')],{'$or':_[_0x17ed('0x2f')](_0xb16079[_0x17ed('0x3a')],function(_0x162121){var _0x355214={};_0x355214[_0x162121]={'$like':'%'+_0x19155b[_0x17ed('0x35')][_0x17ed('0x41')]+'%'};return _0x355214;})});}_0xb16079=_[_0x17ed('0x43')]({},_0xb16079,_0x19155b[_0x17ed('0x44')]);return db['UserWhatsappQueue'][_0x17ed('0x48')](_0xb16079);}})['then'](function(_0x4f8f7e){if(_0x4f8f7e){return db['User'][_0x17ed('0x5c')]({'where':{'id':_[_0x17ed('0x2f')](_0x4f8f7e,_0x17ed('0x5d')),'role':_0x17ed('0x5e')},'attributes':['id','name',_0x17ed('0x5f'),_0x17ed('0x60'),_0x17ed('0x61')]});}})[_0x17ed('0x28')](function(_0x174f18){if(_0x174f18){return{'count':_0x174f18[_0x17ed('0x1f')],'rows':_[_0x17ed('0x2f')](_0x174f18[_0x17ed('0x49')],function(_0x4c7154){return{'membername':_0x4c7154['name'],'UserId':_0x4c7154['id'],'queue_name':_0xc5e941['name'],'WhatsappQueueId':_0xc5e941['id'],'interface':util['format']('%s/%s','SIP',_0x4c7154[_0x17ed('0x2d')]),'penalty':0x0,'paused':_0x4c7154[_0x17ed('0x5f')],'createdAt':_0x4c7154[_0x17ed('0x61')],'updatedAt':_0x4c7154[_0x17ed('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x17ed('0x28')](respondWithFilteredResult(_0x1251fb,_0xb16079))[_0x17ed('0x4a')](handleError(_0x1251fb,null));};exports[_0x17ed('0x62')]=function(_0x14dd2f,_0x4e4d00,_0x4b2b62){var _0x20be41={};var _0x249270={};var _0x2696e9;var _0x26277f;return db[_0x17ed('0x45')][_0x17ed('0x59')]({'where':{'id':_0x14dd2f[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x4e4d00,null))[_0x17ed('0x28')](function(_0x503f3e){if(_0x503f3e){_0x2696e9=_0x503f3e;_0x249270[_0x17ed('0x34')]=_[_0x17ed('0x36')](db[_0x17ed('0x63')][_0x17ed('0x30')]);_0x249270['query']=_[_0x17ed('0x36')](_0x14dd2f['query']);_0x249270['filters']=_[_0x17ed('0x38')](_0x249270['model'],_0x249270['query']);_0x20be41[_0x17ed('0x3a')]=_[_0x17ed('0x38')](_0x249270[_0x17ed('0x34')],qs[_0x17ed('0x39')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x39')]));_0x20be41[_0x17ed('0x3a')]=_0x20be41[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0x20be41[_0x17ed('0x3a')]:_0x249270[_0x17ed('0x34')];_0x20be41[_0x17ed('0x3d')]=qs[_0x17ed('0x3e')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x3e')]);_0x20be41[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0x14dd2f[_0x17ed('0x35')],_0x249270[_0x17ed('0x37')]));if(_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x41')]){_0x20be41[_0x17ed('0x3f')]=_['merge'](_0x20be41[_0x17ed('0x3f')],{'$or':_[_0x17ed('0x2f')](_0x20be41['attributes'],function(_0x29afd6){var _0x8dc4d8={};_0x8dc4d8[_0x29afd6]={'$like':'%'+_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x41')]+'%'};return _0x8dc4d8;})});}_0x20be41=_[_0x17ed('0x43')]({},_0x20be41,_0x14dd2f[_0x17ed('0x44')]);return _0x2696e9['getTeams'](_0x20be41);}})[_0x17ed('0x28')](function(_0x508ef1){if(_0x508ef1){_0x26277f=_0x508ef1['length'];if(!_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x3c')](_0x17ed('0x5a'))){_0x20be41[_0x17ed('0x21')]=qs[_0x17ed('0x21')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x21')]);_0x20be41[_0x17ed('0x20')]=qs[_0x17ed('0x20')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x20')]);}return _0x2696e9[_0x17ed('0x62')](_0x20be41);}})[_0x17ed('0x28')](function(_0x5560e1){if(_0x5560e1){return _0x5560e1?{'count':_0x26277f,'rows':_0x5560e1}:null;}})['then'](respondWithResult(_0x4e4d00,null))[_0x17ed('0x4a')](handleError(_0x4e4d00,null));};exports[_0x17ed('0x64')]=function(_0x1358d2,_0x6157fb,_0x5c7eef){var _0x434e10=_0x1358d2[_0x17ed('0x4f')][_0x17ed('0x65')];return db[_0x17ed('0x63')][_0x17ed('0x48')]({'where':{'id':_0x434e10},'attributes':['id'],'include':[{'model':db[_0x17ed('0x66')],'as':_0x17ed('0x67'),'attributes':['id',_0x17ed('0x2d'),_0x17ed('0x68'),_0x17ed('0x69'),_0x17ed('0x6a')],'raw':!![]}]})[_0x17ed('0x28')](function(_0x2cdc6c){if(_0x2cdc6c){var _0x1bdcb6=_[_0x17ed('0x6b')](_0x2cdc6c,function(_0x5b960d){var _0x150de4=_0x5b960d[_0x17ed('0x51')]({'plain':!![]});return _0x150de4[_0x17ed('0x67')];});return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x1358d2['params']['id']}})[_0x17ed('0x28')](function(_0x390b64){return db['sequelize']['transaction'](function(_0x528684){return _0x390b64[_0x17ed('0x64')](_0x434e10,{'transaction':_0x528684})['then'](function(){return BPromise[_0x17ed('0x6c')](_0x1bdcb6,function(_0x1892bd){return db['UserWhatsappQueue'][_0x17ed('0x6d')]({'where':{'UserId':_0x1892bd['id'],'WhatsappQueueId':_0x1358d2[_0x17ed('0x4c')]['id']},'transaction':_0x528684});});})[_0x17ed('0x28')](function(){_0x1bdcb6[_0x17ed('0x6e')](function(_0x308b91){socket[_0x17ed('0x6f')](_0x17ed('0x70'),{'UserId':_0x308b91['id'],'WhatsappQueueId':_0x390b64['id']});});});});});}})[_0x17ed('0x28')](respondWithStatusCode(_0x6157fb,null))[_0x17ed('0x4a')](handleError(_0x6157fb,null));};exports[_0x17ed('0x71')]=function(_0x4b0fe8,_0x2049ef,_0x1e34e7){return db[_0x17ed('0x63')][_0x17ed('0x48')]({'where':{'id':_0x4b0fe8[_0x17ed('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x17ed('0x28')](handleEntityNotFound(_0x2049ef,null))[_0x17ed('0x28')](function(_0x319144){var _0x4702cd=_['map'](_0x319144,'id');var _0x4b2e69=[];var _0xe97d8=[];var _0x529ebb=squel[_0x17ed('0x72')]();_0x529ebb[_0x17ed('0x73')](_0x17ed('0x74'))[_0x17ed('0x75')]('team_has_whatsapp_queues','tq')[_0x17ed('0x76')](_0x17ed('0x77'),'ut',_0x17ed('0x78'))['where'](_0x17ed('0x79'),_0x4b0fe8['params']['id']);for(var _0x1e7800=0x0;_0x1e7800<_0x319144[_0x17ed('0x3b')];_0x1e7800+=0x1){let _0x36af52=_0x319144[_0x1e7800];for(var _0x44a523=0x0;_0x44a523<_0x36af52['Agents']['length'];_0x44a523+=0x1){let _0xe49ecf=_0x36af52['Agents'][_0x44a523];var _0x12845c=_0x529ebb[_0x17ed('0x7a')]();_0x12845c[_0x17ed('0x3f')]('ut.UserId\x20=\x20?',_0xe49ecf['id']);_0xe97d8[_0x17ed('0x7b')](db['sequelize'][_0x17ed('0x35')](_0x12845c[_0x17ed('0x7c')](),{'type':db[_0x17ed('0x7d')]['QueryTypes'][_0x17ed('0x7e')]})[_0x17ed('0x28')](function(_0x4a93df){if(_0x4a93df['length']===0x1){return _0xe49ecf['id'];}else{var _0x1dc079=_[_0x17ed('0x7f')](_['map'](_0x4a93df,_0x17ed('0x80')),function(_0x2e045f){return _[_0x17ed('0x81')](_0x4702cd,_0x2e045f);});if(_0x1dc079){return _0xe49ecf['id'];}}}));}}return BPromise[_0x17ed('0x82')](_0xe97d8)['then'](function(_0x58388f){_0x4b2e69=_(_0x4b2e69)[_0x17ed('0x83')](_0x58388f)[_0x17ed('0x84')]()[_0x17ed('0x85')]();return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x4b0fe8[_0x17ed('0x4c')]['id']}})['then'](function(_0x2f686b){return db[_0x17ed('0x7d')]['transaction'](function(_0x1d2b2f){return _0x2f686b[_0x17ed('0x71')](_0x4b0fe8[_0x17ed('0x35')][_0x17ed('0x65')],{'transaction':_0x1d2b2f})['then'](function(){if(!_[_0x17ed('0x86')](_0x4b2e69)){return _0x2f686b['removeAgents'](_0x4b2e69,{'transaction':_0x1d2b2f});}})[_0x17ed('0x28')](function(){_0x4b2e69['forEach'](function(_0x5bb82b){socket['emit'](_0x17ed('0x87'),{'UserId':_0x5bb82b,'WhatsappQueueId':_0x2f686b['id']});});});});});});})[_0x17ed('0x28')](respondWithStatusCode(_0x2049ef,null))[_0x17ed('0x4a')](handleError(_0x2049ef,null));};exports['addAgents']=function(_0x138056,_0x3bee4e,_0xae1617){return db['WhatsappQueue']['find']({'where':{'id':_0x138056['params']['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x3bee4e,null))[_0x17ed('0x28')](function(_0x4b1a0d){if(_0x4b1a0d){return _0x4b1a0d[_0x17ed('0x88')](_0x138056[_0x17ed('0x4f')]['ids'],_['omit'](_0x138056[_0x17ed('0x4f')],[_0x17ed('0x65'),'id'])||{})[_0x17ed('0x89')](function(_0x44b0a4){for(var _0x538669=0x0;_0x538669<_0x138056['body']['ids']['length'];_0x538669+=0x1){socket[_0x17ed('0x6f')](_0x17ed('0x70'),{'UserId':_0x138056[_0x17ed('0x4f')]['ids'][_0x538669],'WhatsappQueueId':_0x138056['params']['id']});}return _0x44b0a4;});}})[_0x17ed('0x28')](respondWithResult(_0x3bee4e,null))[_0x17ed('0x4a')](handleError(_0x3bee4e,null));};exports[_0x17ed('0x8a')]=function(_0x40b850,_0x297f24,_0x428aa6){return db['WhatsappQueue']['find']({'where':{'id':_0x40b850[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x297f24,null))[_0x17ed('0x28')](function(_0x5d677e){if(_0x5d677e){return _0x5d677e[_0x17ed('0x8a')](_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')])[_0x17ed('0x28')](function(){if(_[_0x17ed('0x8b')](_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')])){for(var _0x17c831=0x0;_0x17c831<_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')][_0x17ed('0x3b')];_0x17c831+=0x1){socket[_0x17ed('0x6f')](_0x17ed('0x87'),{'UserId':Number(_0x40b850[_0x17ed('0x35')]['ids'][_0x17c831]),'WhatsappQueueId':Number(_0x40b850[_0x17ed('0x4c')]['id'])});}}else{socket[_0x17ed('0x6f')]('userWhatsappQueue:remove',{'UserId':Number(_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')]),'WhatsappQueueId':Number(_0x40b850[_0x17ed('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x297f24,null))[_0x17ed('0x4a')](handleError(_0x297f24,null));};exports[_0x17ed('0x8c')]=function(_0x2a3e30,_0x529dce,_0x1445f2){var _0x1612c9={};var _0x21d4a1={};var _0x300650;var _0x1388f0;return db[_0x17ed('0x45')][_0x17ed('0x59')]({'where':{'id':_0x2a3e30[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x529dce,null))[_0x17ed('0x28')](function(_0x1ad22){if(_0x1ad22){_0x300650=_0x1ad22;_0x21d4a1[_0x17ed('0x34')]=_[_0x17ed('0x36')](db[_0x17ed('0x66')]['rawAttributes']);_0x21d4a1[_0x17ed('0x35')]=_[_0x17ed('0x36')](_0x2a3e30['query']);_0x21d4a1[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0x21d4a1[_0x17ed('0x34')],_0x21d4a1['query']);_0x1612c9[_0x17ed('0x3a')]=_['intersection'](_0x21d4a1['model'],qs['fields'](_0x2a3e30['query']['fields']));_0x1612c9['attributes']=_0x1612c9['attributes'][_0x17ed('0x3b')]?_0x1612c9['attributes']:_0x21d4a1[_0x17ed('0x34')];_0x1612c9[_0x17ed('0x3d')]=qs['sort'](_0x2a3e30['query'][_0x17ed('0x3e')]);_0x1612c9[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0x2a3e30[_0x17ed('0x35')],_0x21d4a1['filters']));if(_0x2a3e30[_0x17ed('0x35')][_0x17ed('0x41')]){_0x1612c9[_0x17ed('0x3f')]=_[_0x17ed('0x43')](_0x1612c9['where'],{'$or':_[_0x17ed('0x2f')](_0x1612c9[_0x17ed('0x3a')],function(_0x23da6b){var _0x41135f={};_0x41135f[_0x23da6b]={'$like':'%'+_0x2a3e30['query']['filter']+'%'};return _0x41135f;})});}_0x1612c9=_['merge']({},_0x1612c9,_0x2a3e30[_0x17ed('0x44')]);return _0x300650[_0x17ed('0x8c')](_0x1612c9);}})[_0x17ed('0x28')](function(_0x2ff6f5){if(_0x2ff6f5){_0x1388f0=_0x2ff6f5[_0x17ed('0x3b')];if(!_0x2a3e30[_0x17ed('0x35')][_0x17ed('0x3c')]('nolimit')){_0x1612c9[_0x17ed('0x21')]=qs[_0x17ed('0x21')](_0x2a3e30[_0x17ed('0x35')][_0x17ed('0x21')]);_0x1612c9[_0x17ed('0x20')]=qs[_0x17ed('0x20')](_0x2a3e30['query']['offset']);}return _0x300650[_0x17ed('0x8c')](_0x1612c9);}})['then'](function(_0x1b09a1){if(_0x1b09a1){return _0x1b09a1?{'count':_0x1388f0,'rows':_0x1b09a1}:null;}})[_0x17ed('0x28')](respondWithResult(_0x529dce,null))[_0x17ed('0x4a')](handleError(_0x529dce,null));}; \ No newline at end of file +var _0x6208=['UserWhatsappQueue','User','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne'];(function(_0x275748,_0x3fa2cc){var _0xcfb64a=function(_0x4f25c7){while(--_0x4f25c7){_0x275748['push'](_0x275748['shift']());}};_0xcfb64a(++_0x3fa2cc);}(_0x6208,0xbd));var _0x8620=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x6208[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x8620('0x0'));var emlformat=require(_0x8620('0x1'));var rimraf=require(_0x8620('0x2'));var zipdir=require(_0x8620('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8620('0x4'));var moment=require(_0x8620('0x5'));var BPromise=require(_0x8620('0x6'));var Mustache=require(_0x8620('0x7'));var util=require(_0x8620('0x8'));var path=require(_0x8620('0x9'));var sox=require(_0x8620('0xa'));var csv=require(_0x8620('0xb'));var ejs=require(_0x8620('0xc'));var fs=require('fs');var _=require(_0x8620('0xd'));var squel=require(_0x8620('0xe'));var crypto=require(_0x8620('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8620('0x10'));var toCsv=require(_0x8620('0xb'));var querystring=require('querystring');var Papa=require(_0x8620('0x11'));var Redis=require(_0x8620('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8620('0x13'));var as=require(_0x8620('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8620('0x15'))(_0x8620('0x16'));var utils=require('../../config/utils');var config=require(_0x8620('0x17'));var db=require(_0x8620('0x18'))['db'];config['redis']=_[_0x8620('0x19')](config[_0x8620('0x1a')],{'host':_0x8620('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8620('0x1c')](socket);function respondWithStatusCode(_0x355af3,_0x3e9ef3){_0x3e9ef3=_0x3e9ef3||0xcc;return function(_0x1f5210){if(_0x1f5210){return _0x355af3[_0x8620('0x1d')](_0x3e9ef3);}return _0x355af3[_0x8620('0x1e')](_0x3e9ef3)[_0x8620('0x1f')]();};}function respondWithResult(_0x55ddc6,_0x198b1a){_0x198b1a=_0x198b1a||0xc8;return function(_0xb70491){if(_0xb70491){return _0x55ddc6[_0x8620('0x1e')](_0x198b1a)['json'](_0xb70491);}};}function respondWithFilteredResult(_0x2689f7,_0x4a5fd8){return function(_0x1c74fb){if(_0x1c74fb){var _0xfe1275=_0x1c74fb['count'],_0x19bacc=_0x4a5fd8[_0x8620('0x20')],_0x51a404=_0x4a5fd8[_0x8620('0x20')]+_0x4a5fd8[_0x8620('0x21')],_0x85b8d5;if(_0x51a404>=_0xfe1275){_0x51a404=_0xfe1275;_0x85b8d5=0xc8;}else{_0x85b8d5=0xce;}_0x2689f7[_0x8620('0x1e')](_0x85b8d5);return _0x2689f7[_0x8620('0x22')](_0x8620('0x23'),_0x19bacc+'-'+_0x51a404+'/'+_0xfe1275)[_0x8620('0x24')](_0x1c74fb);}return null;};}function patchUpdates(_0x209f4e){return function(_0xe41808){try{jsonpatch[_0x8620('0x25')](_0xe41808,_0x209f4e,!![]);}catch(_0x3c8554){return BPromise['reject'](_0x3c8554);}return _0xe41808[_0x8620('0x26')]();};}function saveUpdates(_0x375ea5,_0x308b2a){return function(_0x2587af){if(_0x2587af){return _0x2587af[_0x8620('0x27')](_0x375ea5)[_0x8620('0x28')](function(_0x332b09){return _0x332b09;});}return null;};}function removeEntity(_0x3ae577,_0x133109){return function(_0x24cda8){if(_0x24cda8){return _0x24cda8[_0x8620('0x29')]()[_0x8620('0x28')](function(){var _0x12a9d2=_0x24cda8[_0x8620('0x2a')]({'plain':!![]});var _0x35564a='WhatsappQueues';return db[_0x8620('0x2b')][_0x8620('0x29')]({'where':{'type':_0x35564a,'resourceId':_0x12a9d2['id']}})[_0x8620('0x28')](function(){return _0x24cda8;});})[_0x8620('0x28')](function(){_0x3ae577['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58dd84,_0x54fd4e){return function(_0x259390){if(!_0x259390){_0x58dd84[_0x8620('0x1d')](0x194);}return _0x259390;};}function handleError(_0x3df893,_0x4edd9d){_0x4edd9d=_0x4edd9d||0x1f4;return function(_0x422920){logger[_0x8620('0x2c')](_0x422920[_0x8620('0x2d')]);if(_0x422920[_0x8620('0x2e')]){delete _0x422920['name'];}_0x3df893[_0x8620('0x1e')](_0x4edd9d)[_0x8620('0x2f')](_0x422920);};}exports[_0x8620('0x30')]=function(_0x46878b,_0x1ddf60){var _0x16f681={},_0x164544={},_0x4b5321={'count':0x0,'rows':[]};var _0x39e06c=_['map'](db[_0x8620('0x31')][_0x8620('0x32')],function(_0xd59ad0){return{'name':_0xd59ad0['fieldName'],'type':_0xd59ad0[_0x8620('0x33')][_0x8620('0x34')]};});_0x164544[_0x8620('0x35')]=_[_0x8620('0x36')](_0x39e06c,_0x8620('0x2e'));_0x164544[_0x8620('0x37')]=_[_0x8620('0x38')](_0x46878b[_0x8620('0x37')]);_0x164544['filters']=_[_0x8620('0x39')](_0x164544[_0x8620('0x35')],_0x164544[_0x8620('0x37')]);_0x16f681[_0x8620('0x3a')]=_[_0x8620('0x39')](_0x164544['model'],qs['fields'](_0x46878b[_0x8620('0x37')][_0x8620('0x3b')]));_0x16f681[_0x8620('0x3a')]=_0x16f681[_0x8620('0x3a')]['length']?_0x16f681[_0x8620('0x3a')]:_0x164544['model'];if(!_0x46878b[_0x8620('0x37')][_0x8620('0x3c')](_0x8620('0x3d'))){_0x16f681[_0x8620('0x21')]=qs['limit'](_0x46878b[_0x8620('0x37')][_0x8620('0x21')]);_0x16f681['offset']=qs['offset'](_0x46878b[_0x8620('0x37')][_0x8620('0x20')]);}_0x16f681[_0x8620('0x3e')]=qs[_0x8620('0x3f')](_0x46878b['query']['sort']);_0x16f681['where']=qs[_0x8620('0x40')](_[_0x8620('0x41')](_0x46878b[_0x8620('0x37')],_0x164544[_0x8620('0x40')]),_0x39e06c);if(_0x46878b[_0x8620('0x37')][_0x8620('0x42')]){_0x16f681[_0x8620('0x43')]=_[_0x8620('0x44')](_0x16f681['where'],{'$or':_[_0x8620('0x36')](_0x39e06c,function(_0x2e2324){if(_0x2e2324[_0x8620('0x33')]!==_0x8620('0x45')){var _0x5e9562={};_0x5e9562[_0x2e2324[_0x8620('0x2e')]]={'$like':'%'+_0x46878b[_0x8620('0x37')]['filter']+'%'};return _0x5e9562;}})});}_0x16f681=_[_0x8620('0x44')]({},_0x16f681,_0x46878b[_0x8620('0x46')]);var _0x264e3b={'where':_0x16f681[_0x8620('0x43')]};return db[_0x8620('0x31')]['count'](_0x264e3b)[_0x8620('0x28')](function(_0x460abb){_0x4b5321[_0x8620('0x47')]=_0x460abb;if(_0x46878b['query']['includeAll']){_0x16f681[_0x8620('0x48')]=[{'all':!![]}];}return db[_0x8620('0x31')][_0x8620('0x49')](_0x16f681);})[_0x8620('0x28')](function(_0x3a2c45){_0x4b5321[_0x8620('0x4a')]=_0x3a2c45;return _0x4b5321;})['then'](respondWithFilteredResult(_0x1ddf60,_0x16f681))[_0x8620('0x4b')](handleError(_0x1ddf60,null));};exports[_0x8620('0x4c')]=function(_0x38d89d,_0x13658b){var _0x1d9ede={'raw':!![],'where':{'id':_0x38d89d[_0x8620('0x4d')]['id']}},_0x37a06e={};_0x37a06e['model']=_[_0x8620('0x38')](db[_0x8620('0x31')][_0x8620('0x32')]);_0x37a06e[_0x8620('0x37')]=_[_0x8620('0x38')](_0x38d89d[_0x8620('0x37')]);_0x37a06e[_0x8620('0x40')]=_[_0x8620('0x39')](_0x37a06e['model'],_0x37a06e[_0x8620('0x37')]);_0x1d9ede['attributes']=_['intersection'](_0x37a06e[_0x8620('0x35')],qs[_0x8620('0x3b')](_0x38d89d['query']['fields']));_0x1d9ede[_0x8620('0x3a')]=_0x1d9ede['attributes'][_0x8620('0x4e')]?_0x1d9ede[_0x8620('0x3a')]:_0x37a06e['model'];if(_0x38d89d[_0x8620('0x37')]['includeAll']){_0x1d9ede[_0x8620('0x48')]=[{'all':!![]}];}_0x1d9ede=_['merge']({},_0x1d9ede,_0x38d89d[_0x8620('0x46')]);return db[_0x8620('0x31')]['find'](_0x1d9ede)[_0x8620('0x28')](handleEntityNotFound(_0x13658b,null))[_0x8620('0x28')](respondWithResult(_0x13658b,null))[_0x8620('0x4b')](handleError(_0x13658b,null));};exports[_0x8620('0x4f')]=function(_0x290997,_0x4039b2){return db[_0x8620('0x31')]['create'](_0x290997[_0x8620('0x50')],{})[_0x8620('0x28')](function(_0x250dc0){var _0x35cbd9=_0x290997[_0x8620('0x51')][_0x8620('0x2a')]({'plain':!![]});if(!_0x35cbd9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35cbd9[_0x8620('0x52')]===_0x8620('0x51')){var _0xa56482=_0x250dc0['get']({'plain':!![]});var _0x453916='WhatsappQueues';return db[_0x8620('0x53')][_0x8620('0x54')]({'where':{'name':_0x453916,'userProfileId':_0x35cbd9[_0x8620('0x55')]},'raw':!![]})[_0x8620('0x28')](function(_0x3a496a){if(_0x3a496a&&_0x3a496a[_0x8620('0x56')]===0x0){return db['UserProfileResource'][_0x8620('0x4f')]({'name':_0xa56482[_0x8620('0x2e')],'resourceId':_0xa56482['id'],'type':_0x3a496a[_0x8620('0x2e')],'sectionId':_0x3a496a['id']},{})['then'](function(){return _0x250dc0;});}else{return _0x250dc0;}})['catch'](function(_0x430302){logger['error'](_0x8620('0x57'),_0x430302);throw _0x430302;});}return _0x250dc0;})[_0x8620('0x28')](respondWithResult(_0x4039b2,0xc9))[_0x8620('0x4b')](handleError(_0x4039b2,null));};exports[_0x8620('0x27')]=function(_0x48f39e,_0x4f22fd){if(_0x48f39e[_0x8620('0x50')]['id']){delete _0x48f39e[_0x8620('0x50')]['id'];}return db[_0x8620('0x31')][_0x8620('0x54')]({'where':{'id':_0x48f39e['params']['id']}})[_0x8620('0x28')](handleEntityNotFound(_0x4f22fd,null))[_0x8620('0x28')](saveUpdates(_0x48f39e[_0x8620('0x50')],null))[_0x8620('0x28')](respondWithResult(_0x4f22fd,null))['catch'](handleError(_0x4f22fd,null));};exports[_0x8620('0x29')]=function(_0x5d5b36,_0x10b6b9){return db[_0x8620('0x31')]['find']({'where':{'id':_0x5d5b36[_0x8620('0x4d')]['id']}})[_0x8620('0x28')](handleEntityNotFound(_0x10b6b9,null))[_0x8620('0x28')](removeEntity(_0x10b6b9,null))['catch'](handleError(_0x10b6b9,null));};exports[_0x8620('0x58')]=function(_0x56b5f7,_0xe76522){return db[_0x8620('0x31')][_0x8620('0x58')]()[_0x8620('0x28')](respondWithResult(_0xe76522,null))[_0x8620('0x4b')](handleError(_0xe76522,null));};exports[_0x8620('0x59')]=function(_0x40ec7a,_0x540184,_0x3aa9ba){var _0xbe3b76={'raw':!![],'where':{}},_0x1d22c6={},_0x217629;return db[_0x8620('0x31')][_0x8620('0x5a')]({'where':{'id':_0x40ec7a[_0x8620('0x4d')]['id']}})[_0x8620('0x28')](handleEntityNotFound(_0x540184,null))['then'](function(_0x4211dc){if(_0x4211dc){_0x217629=_0x4211dc[_0x8620('0x2a')]({'plain':!![]});_0x1d22c6[_0x8620('0x35')]=_[_0x8620('0x38')](db[_0x8620('0x5b')][_0x8620('0x32')]);_0x1d22c6[_0x8620('0x37')]=_[_0x8620('0x38')](_0x40ec7a[_0x8620('0x37')]);_0x1d22c6[_0x8620('0x40')]=_[_0x8620('0x39')](_0x1d22c6[_0x8620('0x35')],_0x1d22c6[_0x8620('0x37')]);_0xbe3b76[_0x8620('0x3a')]=_[_0x8620('0x39')](_0x1d22c6['model'],qs['fields'](_0x40ec7a[_0x8620('0x37')][_0x8620('0x3b')]));_0xbe3b76[_0x8620('0x3a')]=_0xbe3b76['attributes'][_0x8620('0x4e')]?_0xbe3b76[_0x8620('0x3a')]:_0x1d22c6[_0x8620('0x35')];if(!_0x40ec7a[_0x8620('0x37')][_0x8620('0x3c')](_0x8620('0x3d'))){_0xbe3b76[_0x8620('0x21')]=qs[_0x8620('0x21')](_0x40ec7a[_0x8620('0x37')][_0x8620('0x21')]);_0xbe3b76[_0x8620('0x20')]=qs[_0x8620('0x20')](_0x40ec7a[_0x8620('0x37')][_0x8620('0x20')]);}_0xbe3b76[_0x8620('0x3e')]=qs[_0x8620('0x3f')](_0x40ec7a[_0x8620('0x37')][_0x8620('0x3f')]);_0xbe3b76[_0x8620('0x43')]=qs[_0x8620('0x40')](_[_0x8620('0x41')](_0x40ec7a[_0x8620('0x37')],_0x1d22c6[_0x8620('0x40')]));_0xbe3b76['where']['WhatsappQueueId']=_0x4211dc['id'];if(_0x40ec7a[_0x8620('0x37')][_0x8620('0x42')]){_0xbe3b76[_0x8620('0x43')]=_['merge'](_0xbe3b76[_0x8620('0x43')],{'$or':_['map'](_0xbe3b76[_0x8620('0x3a')],function(_0x1d9076){var _0x2df782={};_0x2df782[_0x1d9076]={'$like':'%'+_0x40ec7a[_0x8620('0x37')][_0x8620('0x42')]+'%'};return _0x2df782;})});}_0xbe3b76=_[_0x8620('0x44')]({},_0xbe3b76,_0x40ec7a[_0x8620('0x46')]);return db[_0x8620('0x5b')][_0x8620('0x49')](_0xbe3b76);}})[_0x8620('0x28')](function(_0x7e73b0){if(_0x7e73b0){return db[_0x8620('0x5c')]['findAndCountAll']({'where':{'id':_[_0x8620('0x36')](_0x7e73b0,'UserId'),'role':_0x8620('0x5d')},'attributes':['id',_0x8620('0x2e'),_0x8620('0x5e'),_0x8620('0x5f'),_0x8620('0x60')]});}})[_0x8620('0x28')](function(_0x4d4a59){if(_0x4d4a59){return{'count':_0x4d4a59[_0x8620('0x47')],'rows':_['map'](_0x4d4a59[_0x8620('0x4a')],function(_0xd14b29){return{'membername':_0xd14b29[_0x8620('0x2e')],'UserId':_0xd14b29['id'],'queue_name':_0x217629[_0x8620('0x2e')],'WhatsappQueueId':_0x217629['id'],'interface':util[_0x8620('0x61')](_0x8620('0x62'),_0x8620('0x63'),_0xd14b29[_0x8620('0x2e')]),'penalty':0x0,'paused':_0xd14b29[_0x8620('0x5e')],'createdAt':_0xd14b29['createdAt'],'updatedAt':_0xd14b29[_0x8620('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8620('0x28')](respondWithFilteredResult(_0x540184,_0xbe3b76))[_0x8620('0x4b')](handleError(_0x540184,null));};exports[_0x8620('0x64')]=function(_0xd92aa1,_0x11c12d,_0x41bdaf){var _0x3f6d48={};var _0x2f384a={};var _0x340aaa;var _0x48c897;return db[_0x8620('0x31')][_0x8620('0x5a')]({'where':{'id':_0xd92aa1[_0x8620('0x4d')]['id']}})['then'](handleEntityNotFound(_0x11c12d,null))[_0x8620('0x28')](function(_0xae74ae){if(_0xae74ae){_0x340aaa=_0xae74ae;_0x2f384a[_0x8620('0x35')]=_[_0x8620('0x38')](db[_0x8620('0x65')]['rawAttributes']);_0x2f384a[_0x8620('0x37')]=_['keys'](_0xd92aa1[_0x8620('0x37')]);_0x2f384a[_0x8620('0x40')]=_['intersection'](_0x2f384a[_0x8620('0x35')],_0x2f384a['query']);_0x3f6d48[_0x8620('0x3a')]=_[_0x8620('0x39')](_0x2f384a[_0x8620('0x35')],qs[_0x8620('0x3b')](_0xd92aa1[_0x8620('0x37')][_0x8620('0x3b')]));_0x3f6d48[_0x8620('0x3a')]=_0x3f6d48[_0x8620('0x3a')][_0x8620('0x4e')]?_0x3f6d48[_0x8620('0x3a')]:_0x2f384a[_0x8620('0x35')];_0x3f6d48[_0x8620('0x3e')]=qs[_0x8620('0x3f')](_0xd92aa1[_0x8620('0x37')]['sort']);_0x3f6d48[_0x8620('0x43')]=qs[_0x8620('0x40')](_[_0x8620('0x41')](_0xd92aa1[_0x8620('0x37')],_0x2f384a['filters']));if(_0xd92aa1['query']['filter']){_0x3f6d48[_0x8620('0x43')]=_[_0x8620('0x44')](_0x3f6d48[_0x8620('0x43')],{'$or':_['map'](_0x3f6d48[_0x8620('0x3a')],function(_0x11090a){var _0x342ade={};_0x342ade[_0x11090a]={'$like':'%'+_0xd92aa1[_0x8620('0x37')][_0x8620('0x42')]+'%'};return _0x342ade;})});}_0x3f6d48=_['merge']({},_0x3f6d48,_0xd92aa1[_0x8620('0x46')]);return _0x340aaa[_0x8620('0x64')](_0x3f6d48);}})['then'](function(_0x10a13b){if(_0x10a13b){_0x48c897=_0x10a13b[_0x8620('0x4e')];if(!_0xd92aa1[_0x8620('0x37')][_0x8620('0x3c')](_0x8620('0x3d'))){_0x3f6d48[_0x8620('0x21')]=qs['limit'](_0xd92aa1['query'][_0x8620('0x21')]);_0x3f6d48['offset']=qs[_0x8620('0x20')](_0xd92aa1[_0x8620('0x37')][_0x8620('0x20')]);}return _0x340aaa[_0x8620('0x64')](_0x3f6d48);}})[_0x8620('0x28')](function(_0x23e99b){if(_0x23e99b){return _0x23e99b?{'count':_0x48c897,'rows':_0x23e99b}:null;}})[_0x8620('0x28')](respondWithResult(_0x11c12d,null))[_0x8620('0x4b')](handleError(_0x11c12d,null));};exports[_0x8620('0x66')]=function(_0x1f7860,_0x79ee00,_0x47f6b4){var _0x58f1ec=_0x1f7860[_0x8620('0x50')][_0x8620('0x67')];return db[_0x8620('0x65')][_0x8620('0x49')]({'where':{'id':_0x58f1ec},'attributes':['id'],'include':[{'model':db[_0x8620('0x5c')],'as':_0x8620('0x68'),'attributes':['id',_0x8620('0x2e'),_0x8620('0x69'),_0x8620('0x6a'),_0x8620('0x6b')],'raw':!![]}]})[_0x8620('0x28')](function(_0xa6d2ff){if(_0xa6d2ff){var _0x5ecd1a=_[_0x8620('0x6c')](_0xa6d2ff,function(_0x8eb2f5){var _0x399abf=_0x8eb2f5['get']({'plain':!![]});return _0x399abf[_0x8620('0x68')];});return db[_0x8620('0x31')]['find']({'where':{'id':_0x1f7860[_0x8620('0x4d')]['id']}})[_0x8620('0x28')](function(_0x163d6a){return db[_0x8620('0x6d')][_0x8620('0x6e')](function(_0x772a95){return _0x163d6a[_0x8620('0x66')](_0x58f1ec,{'transaction':_0x772a95})['then'](function(){return BPromise[_0x8620('0x6f')](_0x5ecd1a,function(_0x4688d0){return db[_0x8620('0x5b')][_0x8620('0x70')]({'where':{'UserId':_0x4688d0['id'],'WhatsappQueueId':_0x1f7860['params']['id']},'transaction':_0x772a95});});})[_0x8620('0x28')](function(){_0x5ecd1a[_0x8620('0x71')](function(_0x3ef54){socket['emit'](_0x8620('0x72'),{'UserId':_0x3ef54['id'],'WhatsappQueueId':_0x163d6a['id']});});});});});}})['then'](respondWithStatusCode(_0x79ee00,null))['catch'](handleError(_0x79ee00,null));};exports[_0x8620('0x73')]=function(_0x1ea156,_0x2e438e,_0x2af608){return db[_0x8620('0x65')][_0x8620('0x49')]({'where':{'id':_0x1ea156['query'][_0x8620('0x67')]},'attributes':['id'],'include':[{'model':db[_0x8620('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8620('0x28')](handleEntityNotFound(_0x2e438e,null))[_0x8620('0x28')](function(_0xac8f45){var _0x23012a=_['map'](_0xac8f45,'id');var _0x16aef9=[];var _0x7b78b9=[];var _0x53f7fc=squel[_0x8620('0x74')]();_0x53f7fc['field']('tq.TeamId')[_0x8620('0x75')](_0x8620('0x76'),'tq')[_0x8620('0x77')](_0x8620('0x78'),'ut',_0x8620('0x79'))[_0x8620('0x43')]('WhatsappQueueId\x20=\x20?',_0x1ea156[_0x8620('0x4d')]['id']);for(var _0x274a31=0x0;_0x274a31<_0xac8f45[_0x8620('0x4e')];_0x274a31+=0x1){let _0x2162be=_0xac8f45[_0x274a31];for(var _0x605c82=0x0;_0x605c82<_0x2162be[_0x8620('0x68')][_0x8620('0x4e')];_0x605c82+=0x1){let _0x51f60a=_0x2162be[_0x8620('0x68')][_0x605c82];var _0x393720=_0x53f7fc[_0x8620('0x7a')]();_0x393720[_0x8620('0x43')]('ut.UserId\x20=\x20?',_0x51f60a['id']);_0x7b78b9[_0x8620('0x7b')](db[_0x8620('0x6d')][_0x8620('0x37')](_0x393720['toString'](),{'type':db['sequelize'][_0x8620('0x7c')][_0x8620('0x7d')]})[_0x8620('0x28')](function(_0x18651c){if(_0x18651c[_0x8620('0x4e')]===0x1){return _0x51f60a['id'];}else{var _0x40be6a=_[_0x8620('0x7e')](_[_0x8620('0x36')](_0x18651c,_0x8620('0x7f')),function(_0xd4a0f9){return _[_0x8620('0x80')](_0x23012a,_0xd4a0f9);});if(_0x40be6a){return _0x51f60a['id'];}}}));}}return BPromise[_0x8620('0x81')](_0x7b78b9)[_0x8620('0x28')](function(_0x59f56a){_0x16aef9=_(_0x16aef9)[_0x8620('0x82')](_0x59f56a)[_0x8620('0x83')]()['value']();return db[_0x8620('0x31')]['find']({'where':{'id':_0x1ea156[_0x8620('0x4d')]['id']}})[_0x8620('0x28')](function(_0x1e41c8){return db[_0x8620('0x6d')][_0x8620('0x6e')](function(_0x423388){return _0x1e41c8[_0x8620('0x73')](_0x1ea156['query'][_0x8620('0x67')],{'transaction':_0x423388})[_0x8620('0x28')](function(){if(!_['isEmpty'](_0x16aef9)){return _0x1e41c8[_0x8620('0x84')](_0x16aef9,{'transaction':_0x423388});}})['then'](function(){_0x16aef9['forEach'](function(_0x5018fb){socket['emit'](_0x8620('0x85'),{'UserId':_0x5018fb,'WhatsappQueueId':_0x1e41c8['id']});});});});});});})[_0x8620('0x28')](respondWithStatusCode(_0x2e438e,null))[_0x8620('0x4b')](handleError(_0x2e438e,null));};exports[_0x8620('0x86')]=function(_0x4d2f96,_0x419108,_0x3e9371){return db[_0x8620('0x31')][_0x8620('0x54')]({'where':{'id':_0x4d2f96[_0x8620('0x4d')]['id']}})[_0x8620('0x28')](handleEntityNotFound(_0x419108,null))[_0x8620('0x28')](function(_0x2aa586){if(_0x2aa586){return _0x2aa586[_0x8620('0x86')](_0x4d2f96[_0x8620('0x50')][_0x8620('0x67')],_[_0x8620('0x87')](_0x4d2f96[_0x8620('0x50')],[_0x8620('0x67'),'id'])||{})[_0x8620('0x88')](function(_0x5812f3){for(var _0x18fe51=0x0;_0x18fe51<_0x4d2f96['body'][_0x8620('0x67')][_0x8620('0x4e')];_0x18fe51+=0x1){socket[_0x8620('0x89')](_0x8620('0x72'),{'UserId':_0x4d2f96[_0x8620('0x50')][_0x8620('0x67')][_0x18fe51],'WhatsappQueueId':_0x4d2f96['params']['id']});}return _0x5812f3;});}})[_0x8620('0x28')](respondWithResult(_0x419108,null))[_0x8620('0x4b')](handleError(_0x419108,null));};exports[_0x8620('0x84')]=function(_0x3dda49,_0x1a03c3,_0x2a209a){return db[_0x8620('0x31')]['find']({'where':{'id':_0x3dda49[_0x8620('0x4d')]['id']}})[_0x8620('0x28')](handleEntityNotFound(_0x1a03c3,null))[_0x8620('0x28')](function(_0x157c6f){if(_0x157c6f){return _0x157c6f[_0x8620('0x84')](_0x3dda49[_0x8620('0x37')][_0x8620('0x67')])[_0x8620('0x28')](function(){if(_[_0x8620('0x8a')](_0x3dda49[_0x8620('0x37')][_0x8620('0x67')])){for(var _0x56c54f=0x0;_0x56c54f<_0x3dda49[_0x8620('0x37')][_0x8620('0x67')]['length'];_0x56c54f+=0x1){socket[_0x8620('0x89')](_0x8620('0x85'),{'UserId':Number(_0x3dda49[_0x8620('0x37')][_0x8620('0x67')][_0x56c54f]),'WhatsappQueueId':Number(_0x3dda49[_0x8620('0x4d')]['id'])});}}else{socket[_0x8620('0x89')](_0x8620('0x85'),{'UserId':Number(_0x3dda49['query'][_0x8620('0x67')]),'WhatsappQueueId':Number(_0x3dda49[_0x8620('0x4d')]['id'])});}});}})[_0x8620('0x28')](respondWithStatusCode(_0x1a03c3,null))[_0x8620('0x4b')](handleError(_0x1a03c3,null));};exports[_0x8620('0x8b')]=function(_0xbbca51,_0x17e93a,_0x33b594){var _0xc0e1ef={};var _0x5d361e={};var _0x83c59f;var _0x1da9fe;return db[_0x8620('0x31')]['findOne']({'where':{'id':_0xbbca51['params']['id']}})['then'](handleEntityNotFound(_0x17e93a,null))[_0x8620('0x28')](function(_0x3166f2){if(_0x3166f2){_0x83c59f=_0x3166f2;_0x5d361e[_0x8620('0x35')]=_[_0x8620('0x38')](db[_0x8620('0x5c')]['rawAttributes']);_0x5d361e[_0x8620('0x37')]=_['keys'](_0xbbca51[_0x8620('0x37')]);_0x5d361e['filters']=_[_0x8620('0x39')](_0x5d361e[_0x8620('0x35')],_0x5d361e['query']);_0xc0e1ef[_0x8620('0x3a')]=_[_0x8620('0x39')](_0x5d361e['model'],qs[_0x8620('0x3b')](_0xbbca51['query'][_0x8620('0x3b')]));_0xc0e1ef[_0x8620('0x3a')]=_0xc0e1ef['attributes']['length']?_0xc0e1ef[_0x8620('0x3a')]:_0x5d361e[_0x8620('0x35')];_0xc0e1ef[_0x8620('0x3e')]=qs[_0x8620('0x3f')](_0xbbca51[_0x8620('0x37')][_0x8620('0x3f')]);_0xc0e1ef[_0x8620('0x43')]=qs['filters'](_[_0x8620('0x41')](_0xbbca51['query'],_0x5d361e[_0x8620('0x40')]));if(_0xbbca51[_0x8620('0x37')][_0x8620('0x42')]){_0xc0e1ef[_0x8620('0x43')]=_[_0x8620('0x44')](_0xc0e1ef[_0x8620('0x43')],{'$or':_[_0x8620('0x36')](_0xc0e1ef['attributes'],function(_0x160cef){var _0x31bd9a={};_0x31bd9a[_0x160cef]={'$like':'%'+_0xbbca51['query']['filter']+'%'};return _0x31bd9a;})});}_0xc0e1ef=_['merge']({},_0xc0e1ef,_0xbbca51['options']);return _0x83c59f[_0x8620('0x8b')](_0xc0e1ef);}})['then'](function(_0x12b5a4){if(_0x12b5a4){_0x1da9fe=_0x12b5a4[_0x8620('0x4e')];if(!_0xbbca51[_0x8620('0x37')][_0x8620('0x3c')](_0x8620('0x3d'))){_0xc0e1ef[_0x8620('0x21')]=qs[_0x8620('0x21')](_0xbbca51['query'][_0x8620('0x21')]);_0xc0e1ef['offset']=qs[_0x8620('0x20')](_0xbbca51['query'][_0x8620('0x20')]);}return _0x83c59f[_0x8620('0x8b')](_0xc0e1ef);}})[_0x8620('0x28')](function(_0x4d345f){if(_0x4d345f){return _0x4d345f?{'count':_0x1da9fe,'rows':_0x4d345f}:null;}})[_0x8620('0x28')](respondWithResult(_0x17e93a,null))['catch'](handleError(_0x17e93a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index cd604a5..89b4651 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 _0xeb07=['hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x416eed,_0x3a2a24){var _0x325487=function(_0x45656c){while(--_0x45656c){_0x416eed['push'](_0x416eed['shift']());}};_0x325487(++_0x3a2a24);}(_0xeb07,0x107));var _0x7eb0=function(_0x2d0d21,_0x37fc35){_0x2d0d21=_0x2d0d21-0x0;var _0x49fa38=_0xeb07[_0x2d0d21];return _0x49fa38;};'use strict';var EventEmitter=require(_0x7eb0('0x0'));var WhatsappQueue=require(_0x7eb0('0x1'))['db'][_0x7eb0('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7eb0('0x3')](0x0);var events={'afterCreate':_0x7eb0('0x4'),'afterUpdate':'update','afterDestroy':_0x7eb0('0x5')};function emitEvent(_0x17367a){return function(_0x86ad66,_0x575fb8,_0xf28950){WhatsappQueueEvents[_0x7eb0('0x6')](_0x17367a+':'+_0x86ad66['id'],_0x86ad66);WhatsappQueueEvents[_0x7eb0('0x6')](_0x17367a,_0x86ad66);_0xf28950(null);};}for(var e in events){if(events[_0x7eb0('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7eb0('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7afa=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x7afa,0x1c5));var _0xa7af=function(_0x1707ae,_0x3f4d6e){_0x1707ae=_0x1707ae-0x0;var _0x5d0bc0=_0x7afa[_0x1707ae];return _0x5d0bc0;};'use strict';var EventEmitter=require(_0xa7af('0x0'));var WhatsappQueue=require(_0xa7af('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa7af('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa7af('0x3'),'afterDestroy':_0xa7af('0x4')};function emitEvent(_0x37db3b){return function(_0x18d314,_0x1e30d9,_0x2be1b8){WhatsappQueueEvents[_0xa7af('0x5')](_0x37db3b+':'+_0x18d314['id'],_0x18d314);WhatsappQueueEvents[_0xa7af('0x5')](_0x37db3b,_0x18d314);_0x2be1b8(null);};}for(var e in events){if(events[_0xa7af('0x6')](e)){var event=events[e];WhatsappQueue['hook'](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 60f9880..3fcf026 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 _0xa14a=['whatsapp_queues','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','define','WhatsappQueue'];(function(_0xce4542,_0xd242f){var _0x3466fc=function(_0x3d24eb){while(--_0x3d24eb){_0xce4542['push'](_0xce4542['shift']());}};_0x3466fc(++_0xd242f);}(_0xa14a,0x121));var _0xaa14=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xa14a[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0xaa14('0x0'));var logger=require(_0xaa14('0x1'))('api');var moment=require(_0xaa14('0x2'));var BPromise=require('bluebird');var rp=require(_0xaa14('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa14('0x4'));var config=require(_0xaa14('0x5'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x208930,_0x552c33){return _0x208930[_0xaa14('0x6')](_0xaa14('0x7'),attributes,{'tableName':_0xaa14('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eb1=['WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes','define'];(function(_0x3381f4,_0x178384){var _0x116e37=function(_0x2f0032){while(--_0x2f0032){_0x3381f4['push'](_0x3381f4['shift']());}};_0x116e37(++_0x178384);}(_0x6eb1,0x199));var _0x16eb=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x6eb1[_0x3e531a];return _0x3c2574;};'use strict';var _=require('lodash');var util=require(_0x16eb('0x0'));var logger=require(_0x16eb('0x1'))(_0x16eb('0x2'));var moment=require(_0x16eb('0x3'));var BPromise=require(_0x16eb('0x4'));var rp=require(_0x16eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16eb('0x6'));var config=require('../../config/environment');var attributes=require(_0x16eb('0x7'));module['exports']=function(_0x5c321a,_0x4c99c4){return _0x5c321a[_0x16eb('0x8')](_0x16eb('0x9'),attributes,{'tableName':_0x16eb('0xa'),'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 75c4402..db60b42 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 _0xed73=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model','find','ShowWhatsappQueue','lodash','util'];(function(_0x588694,_0x3ffa87){var _0x364f80=function(_0x30d4f4){while(--_0x30d4f4){_0x588694['push'](_0x588694['shift']());}};_0x364f80(++_0x3ffa87);}(_0xed73,0x11d));var _0x3ed7=function(_0x2c44a9,_0xc4b265){_0x2c44a9=_0x2c44a9-0x0;var _0x4e22d4=_0xed73[_0x2c44a9];return _0x4e22d4;};'use strict';var _=require(_0x3ed7('0x0'));var util=require(_0x3ed7('0x1'));var moment=require('moment');var BPromise=require(_0x3ed7('0x2'));var rs=require(_0x3ed7('0x3'));var fs=require('fs');var Redis=require(_0x3ed7('0x4'));var db=require(_0x3ed7('0x5'))['db'];var utils=require(_0x3ed7('0x6'));var logger=require(_0x3ed7('0x7'))(_0x3ed7('0x8'));var config=require(_0x3ed7('0x9'));var jayson=require(_0x3ed7('0xa'));var client=jayson[_0x3ed7('0xb')][_0x3ed7('0xc')]({'port':0x232a});config[_0x3ed7('0xd')]=_[_0x3ed7('0xe')](config['redis'],{'host':_0x3ed7('0xf'),'port':0x18eb});var socket=require(_0x3ed7('0x10'))(new Redis(config[_0x3ed7('0xd')]));require('./whatsappQueue.socket')[_0x3ed7('0x11')](socket);function respondWithRpcPromise(_0x5882df,_0x91c950,_0x575d8c){return new BPromise(function(_0x5147ff,_0x20f8a6){return client[_0x3ed7('0x12')](_0x5882df,_0x575d8c)[_0x3ed7('0x13')](function(_0x36e58c){logger[_0x3ed7('0x14')](_0x3ed7('0x15'),_0x91c950,_0x3ed7('0x16'));logger[_0x3ed7('0x17')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x91c950,_0x3ed7('0x16'),JSON[_0x3ed7('0x18')](_0x36e58c));if(_0x36e58c['error']){if(_0x36e58c[_0x3ed7('0x19')][_0x3ed7('0x1a')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x91c950,_0x36e58c[_0x3ed7('0x19')][_0x3ed7('0x1b')]);return _0x20f8a6(_0x36e58c['error']['message']);}logger[_0x3ed7('0x19')](_0x3ed7('0x15'),_0x91c950,_0x36e58c[_0x3ed7('0x19')][_0x3ed7('0x1b')]);return _0x5147ff(_0x36e58c['error'][_0x3ed7('0x1b')]);}else{logger[_0x3ed7('0x14')](_0x3ed7('0x15'),_0x91c950,'request\x20sent');_0x5147ff(_0x36e58c[_0x3ed7('0x1c')][_0x3ed7('0x1b')]);}})[_0x3ed7('0x1d')](function(_0x42dd98){logger[_0x3ed7('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x91c950,_0x42dd98);_0x20f8a6(_0x42dd98);});});}exports[_0x3ed7('0x1e')]=function(_0x5a544b){var _0x23837d=this;return new Promise(function(_0x2eaf1e,_0x1cede7){return db[_0x3ed7('0x1f')][_0x3ed7('0x20')]({'raw':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b[_0x3ed7('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b[_0x3ed7('0x21')]['where']||null:null,'attributes':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b['options'][_0x3ed7('0x22')]||null:null,'limit':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b['options'][_0x3ed7('0x23')]||null:null,'include':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b['options'][_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x5a544b[_0x3ed7('0x21')][_0x3ed7('0x24')],function(_0x557130){return{'model':db[_0x557130[_0x3ed7('0x26')]],'as':_0x557130['as'],'attributes':_0x557130[_0x3ed7('0x22')],'include':_0x557130['include']?_[_0x3ed7('0x25')](_0x557130[_0x3ed7('0x24')],function(_0x17cd0e){return{'model':db[_0x17cd0e[_0x3ed7('0x26')]],'as':_0x17cd0e['as'],'attributes':_0x17cd0e[_0x3ed7('0x22')],'include':_0x17cd0e[_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x17cd0e['include'],function(_0x5ab534){return{'model':db[_0x5ab534['model']],'as':_0x5ab534['as'],'attributes':_0x5ab534['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f6b93){logger[_0x3ed7('0x14')]('GetWhatsappQueue',_0x5a544b);logger['debug'](_0x3ed7('0x1e'),_0x5a544b,JSON[_0x3ed7('0x18')](_0x1f6b93));_0x2eaf1e(_0x1f6b93);})[_0x3ed7('0x1d')](function(_0x44981a){logger[_0x3ed7('0x19')](_0x3ed7('0x1e'),_0x44981a[_0x3ed7('0x1b')],_0x5a544b);_0x1cede7(_0x23837d['error'](0x1f4,_0x44981a[_0x3ed7('0x1b')]));});});};exports['ShowWhatsappQueue']=function(_0x2444c1){var _0x2eacd9=this;return new Promise(function(_0xd8ba8c,_0x5499dc){return db['WhatsappQueue'][_0x3ed7('0x27')]({'raw':_0x2444c1['options']?_0x2444c1[_0x3ed7('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x2444c1[_0x3ed7('0x21')]?_0x2444c1[_0x3ed7('0x21')]['where']||null:null,'attributes':_0x2444c1[_0x3ed7('0x21')]?_0x2444c1[_0x3ed7('0x21')][_0x3ed7('0x22')]||null:null,'include':_0x2444c1[_0x3ed7('0x21')]?_0x2444c1['options'][_0x3ed7('0x24')]?_['map'](_0x2444c1[_0x3ed7('0x21')][_0x3ed7('0x24')],function(_0x2bc71e){return{'model':db[_0x2bc71e[_0x3ed7('0x26')]],'as':_0x2bc71e['as'],'attributes':_0x2bc71e[_0x3ed7('0x22')],'include':_0x2bc71e[_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x2bc71e[_0x3ed7('0x24')],function(_0x396590){return{'model':db[_0x396590['model']],'as':_0x396590['as'],'attributes':_0x396590[_0x3ed7('0x22')],'include':_0x396590[_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x396590[_0x3ed7('0x24')],function(_0x11a21a){return{'model':db[_0x11a21a[_0x3ed7('0x26')]],'as':_0x11a21a['as'],'attributes':_0x11a21a[_0x3ed7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3ed7('0x13')](function(_0x4d511c){logger[_0x3ed7('0x14')](_0x3ed7('0x28'),_0x2444c1);logger[_0x3ed7('0x17')]('ShowWhatsappQueue',_0x2444c1,JSON['stringify'](_0x4d511c));_0xd8ba8c(_0x4d511c);})[_0x3ed7('0x1d')](function(_0x503375){logger['error'](_0x3ed7('0x28'),_0x503375[_0x3ed7('0x1b')],_0x2444c1);_0x5499dc(_0x2eacd9['error'](0x1f4,_0x503375['message']));});});}; \ No newline at end of file +var _0xe1ff=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','include','map','model','attributes','debug','ShowWhatsappQueue','find'];(function(_0x2109f2,_0x2972be){var _0x34e21e=function(_0x216721){while(--_0x216721){_0x2109f2['push'](_0x2109f2['shift']());}};_0x34e21e(++_0x2972be);}(_0xe1ff,0x151));var _0xfe1f=function(_0x5b9b52,_0x1d8f70){_0x5b9b52=_0x5b9b52-0x0;var _0x10ad63=_0xe1ff[_0x5b9b52];return _0x10ad63;};'use strict';var _=require(_0xfe1f('0x0'));var util=require(_0xfe1f('0x1'));var moment=require(_0xfe1f('0x2'));var BPromise=require(_0xfe1f('0x3'));var rs=require(_0xfe1f('0x4'));var fs=require('fs');var Redis=require(_0xfe1f('0x5'));var db=require(_0xfe1f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe1f('0x7'))('rpc');var config=require(_0xfe1f('0x8'));var jayson=require(_0xfe1f('0x9'));var client=jayson[_0xfe1f('0xa')][_0xfe1f('0xb')]({'port':0x232a});config[_0xfe1f('0xc')]=_[_0xfe1f('0xd')](config[_0xfe1f('0xc')],{'host':_0xfe1f('0xe'),'port':0x18eb});var socket=require(_0xfe1f('0xf'))(new Redis(config[_0xfe1f('0xc')]));require(_0xfe1f('0x10'))[_0xfe1f('0x11')](socket);function respondWithRpcPromise(_0x347a09,_0x4f0c0d,_0x217fca){return new BPromise(function(_0x3c6e82,_0x28829c){return client[_0xfe1f('0x12')](_0x347a09,_0x217fca)[_0xfe1f('0x13')](function(_0x333166){logger[_0xfe1f('0x14')](_0xfe1f('0x15'),_0x4f0c0d,'request\x20sent');logger['debug'](_0xfe1f('0x16'),_0x4f0c0d,_0xfe1f('0x17'),JSON[_0xfe1f('0x18')](_0x333166));if(_0x333166['error']){if(_0x333166[_0xfe1f('0x19')]['code']===0x1f4){logger['error'](_0xfe1f('0x15'),_0x4f0c0d,_0x333166[_0xfe1f('0x19')][_0xfe1f('0x1a')]);return _0x28829c(_0x333166['error'][_0xfe1f('0x1a')]);}logger['error'](_0xfe1f('0x15'),_0x4f0c0d,_0x333166['error'][_0xfe1f('0x1a')]);return _0x3c6e82(_0x333166[_0xfe1f('0x19')][_0xfe1f('0x1a')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x4f0c0d,_0xfe1f('0x17'));_0x3c6e82(_0x333166[_0xfe1f('0x1b')][_0xfe1f('0x1a')]);}})[_0xfe1f('0x1c')](function(_0x22614c){logger[_0xfe1f('0x19')](_0xfe1f('0x15'),_0x4f0c0d,_0x22614c);_0x28829c(_0x22614c);});});}exports[_0xfe1f('0x1d')]=function(_0x5e1edc){var _0x547e66=this;return new Promise(function(_0x4e110f,_0x212eb7){return db[_0xfe1f('0x1e')][_0xfe1f('0x1f')]({'raw':_0x5e1edc[_0xfe1f('0x20')]?_0x5e1edc[_0xfe1f('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5e1edc[_0xfe1f('0x20')]?_0x5e1edc[_0xfe1f('0x20')][_0xfe1f('0x21')]||null:null,'attributes':_0x5e1edc[_0xfe1f('0x20')]?_0x5e1edc[_0xfe1f('0x20')]['attributes']||null:null,'limit':_0x5e1edc['options']?_0x5e1edc[_0xfe1f('0x20')]['limit']||null:null,'include':_0x5e1edc[_0xfe1f('0x20')]?_0x5e1edc[_0xfe1f('0x20')][_0xfe1f('0x22')]?_[_0xfe1f('0x23')](_0x5e1edc[_0xfe1f('0x20')][_0xfe1f('0x22')],function(_0x4e667f){return{'model':db[_0x4e667f[_0xfe1f('0x24')]],'as':_0x4e667f['as'],'attributes':_0x4e667f[_0xfe1f('0x25')],'include':_0x4e667f['include']?_[_0xfe1f('0x23')](_0x4e667f['include'],function(_0x5da24e){return{'model':db[_0x5da24e[_0xfe1f('0x24')]],'as':_0x5da24e['as'],'attributes':_0x5da24e[_0xfe1f('0x25')],'include':_0x5da24e[_0xfe1f('0x22')]?_[_0xfe1f('0x23')](_0x5da24e[_0xfe1f('0x22')],function(_0xd9d1c5){return{'model':db[_0xd9d1c5[_0xfe1f('0x24')]],'as':_0xd9d1c5['as'],'attributes':_0xd9d1c5[_0xfe1f('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc980b0){logger[_0xfe1f('0x14')](_0xfe1f('0x1d'),_0x5e1edc);logger[_0xfe1f('0x26')](_0xfe1f('0x1d'),_0x5e1edc,JSON['stringify'](_0xc980b0));_0x4e110f(_0xc980b0);})[_0xfe1f('0x1c')](function(_0x403475){logger[_0xfe1f('0x19')]('GetWhatsappQueue',_0x403475['message'],_0x5e1edc);_0x212eb7(_0x547e66[_0xfe1f('0x19')](0x1f4,_0x403475[_0xfe1f('0x1a')]));});});};exports[_0xfe1f('0x27')]=function(_0x44e685){var _0x35e367=this;return new Promise(function(_0x562688,_0x31c543){return db['WhatsappQueue'][_0xfe1f('0x28')]({'raw':_0x44e685['options']?_0x44e685[_0xfe1f('0x20')][_0xfe1f('0x29')]===undefined?!![]:![]:!![],'where':_0x44e685[_0xfe1f('0x20')]?_0x44e685['options'][_0xfe1f('0x21')]||null:null,'attributes':_0x44e685[_0xfe1f('0x20')]?_0x44e685['options'][_0xfe1f('0x25')]||null:null,'include':_0x44e685[_0xfe1f('0x20')]?_0x44e685[_0xfe1f('0x20')][_0xfe1f('0x22')]?_[_0xfe1f('0x23')](_0x44e685[_0xfe1f('0x20')][_0xfe1f('0x22')],function(_0x36b377){return{'model':db[_0x36b377[_0xfe1f('0x24')]],'as':_0x36b377['as'],'attributes':_0x36b377[_0xfe1f('0x25')],'include':_0x36b377['include']?_[_0xfe1f('0x23')](_0x36b377[_0xfe1f('0x22')],function(_0x5449a0){return{'model':db[_0x5449a0[_0xfe1f('0x24')]],'as':_0x5449a0['as'],'attributes':_0x5449a0[_0xfe1f('0x25')],'include':_0x5449a0['include']?_['map'](_0x5449a0[_0xfe1f('0x22')],function(_0xd7e19e){return{'model':db[_0xd7e19e['model']],'as':_0xd7e19e['as'],'attributes':_0xd7e19e[_0xfe1f('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x266a4e){logger['info']('ShowWhatsappQueue',_0x44e685);logger[_0xfe1f('0x26')](_0xfe1f('0x27'),_0x44e685,JSON['stringify'](_0x266a4e));_0x562688(_0x266a4e);})[_0xfe1f('0x1c')](function(_0x68df8b){logger['error'](_0xfe1f('0x27'),_0x68df8b[_0xfe1f('0x1a')],_0x44e685);_0x31c543(_0x35e367['error'](0x1f4,_0x68df8b[_0xfe1f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7e93fe4..a83a533 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 _0x2ba4=['./whatsappQueue.events','save','remove','update','emit','removeListener','length','whatsappQueue:'];(function(_0x27cae4,_0x1fe454){var _0x468f66=function(_0x299ed4){while(--_0x299ed4){_0x27cae4['push'](_0x27cae4['shift']());}};_0x468f66(++_0x1fe454);}(_0x2ba4,0x148));var _0x42ba=function(_0x1b5bed,_0x4c646b){_0x1b5bed=_0x1b5bed-0x0;var _0x1169db=_0x2ba4[_0x1b5bed];return _0x1169db;};'use strict';var WhatsappQueueEvents=require(_0x42ba('0x0'));var events=[_0x42ba('0x1'),_0x42ba('0x2'),_0x42ba('0x3')];function createListener(_0xbcd3b4,_0x359511){return function(_0x12f494){_0x359511[_0x42ba('0x4')](_0xbcd3b4,_0x12f494);};}function removeListener(_0x35d159,_0x31c4ca){return function(){WhatsappQueueEvents[_0x42ba('0x5')](_0x35d159,_0x31c4ca);};}exports['register']=function(_0x132e8a){for(var _0x55a4ce=0x0,_0x352d6a=events[_0x42ba('0x6')];_0x55a4ce<_0x352d6a;_0x55a4ce++){var _0x151e38=events[_0x55a4ce];var _0xc3bd92=createListener(_0x42ba('0x7')+_0x151e38,_0x132e8a);WhatsappQueueEvents['on'](_0x151e38,_0xc3bd92);}}; \ No newline at end of file +var _0x0c02=['save','remove','emit','removeListener','register','whatsappQueue:'];(function(_0x119e4a,_0x1c87aa){var _0xe18cb0=function(_0x4685f9){while(--_0x4685f9){_0x119e4a['push'](_0x119e4a['shift']());}};_0xe18cb0(++_0x1c87aa);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){WhatsappQueueEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);WhatsappQueueEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bdc6c57..8b0aed0 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 _0x4649=['index','/describe','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x97bcb8,_0x42b59d){var _0x3ca270=function(_0xd0b8c1){while(--_0xd0b8c1){_0x97bcb8['push'](_0x97bcb8['shift']());}};_0x3ca270(++_0x42b59d);}(_0x4649,0x199));var _0x9464=function(_0x1f235b,_0x5a0347){_0x1f235b=_0x1f235b-0x0;var _0x2817f4=_0x4649[_0x1f235b];return _0x2817f4;};'use strict';var multer=require(_0x9464('0x0'));var util=require('util');var path=require(_0x9464('0x1'));var timeout=require(_0x9464('0x2'));var express=require(_0x9464('0x3'));var router=express[_0x9464('0x4')]();var auth=require(_0x9464('0x5'));var interaction=require(_0x9464('0x6'));var config=require(_0x9464('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x9464('0x8')]('/',auth['isAuthenticated'](),controller[_0x9464('0x9')]);router[_0x9464('0x8')](_0x9464('0xa'),auth[_0x9464('0xb')](),controller['describe']);router[_0x9464('0x8')](_0x9464('0xc'),auth[_0x9464('0xb')](),controller[_0x9464('0xd')]);router[_0x9464('0xe')]('/',auth['isAuthenticated'](),controller[_0x9464('0xf')]);router['put'](_0x9464('0xc'),auth[_0x9464('0xb')](),controller[_0x9464('0x10')]);router[_0x9464('0x11')](_0x9464('0xc'),auth[_0x9464('0xb')](),controller['destroy']);module[_0x9464('0x12')]=router; \ No newline at end of file +var _0xb278=['index','describe','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xb278,0x15e));var _0x8b27=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb278[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x8b27('0x0'));var util=require(_0x8b27('0x1'));var path=require(_0x8b27('0x2'));var timeout=require(_0x8b27('0x3'));var express=require('express');var router=express[_0x8b27('0x4')]();var auth=require(_0x8b27('0x5'));var interaction=require(_0x8b27('0x6'));var config=require(_0x8b27('0x7'));var controller=require(_0x8b27('0x8'));router[_0x8b27('0x9')]('/',auth[_0x8b27('0xa')](),controller[_0x8b27('0xb')]);router[_0x8b27('0x9')]('/describe',auth[_0x8b27('0xa')](),controller[_0x8b27('0xc')]);router[_0x8b27('0x9')](_0x8b27('0xd'),auth[_0x8b27('0xa')](),controller[_0x8b27('0xe')]);router['post']('/',auth[_0x8b27('0xa')](),controller['create']);router[_0x8b27('0xf')](_0x8b27('0xd'),auth['isAuthenticated'](),controller[_0x8b27('0x10')]);router['delete'](_0x8b27('0xd'),auth[_0x8b27('0xa')](),controller[_0x8b27('0x11')]);module[_0x8b27('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c4d1825..fe6ccc7 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 _0x008c=['sequelize','exports','STRING','DATE'];(function(_0x2aee0e,_0x4f139e){var _0x5a2d6e=function(_0x2889fe){while(--_0x2889fe){_0x2aee0e['push'](_0x2aee0e['shift']());}};_0x5a2d6e(++_0x4f139e);}(_0x008c,0x188));var _0xc008=function(_0x387b44,_0x3ad1ba){_0x387b44=_0x387b44-0x0;var _0x55ff2d=_0x008c[_0x387b44];return _0x55ff2d;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'uniqueid':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc008('0x2')]},'joinAt':{'type':Sequelize[_0xc008('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc008('0x3')]},'exitAt':{'type':Sequelize[_0xc008('0x3')]},'reason':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file +var _0x7217=['sequelize','STRING','DATE'];(function(_0x496f7f,_0x28ac6a){var _0x1b0fdd=function(_0x13098a){while(--_0x13098a){_0x496f7f['push'](_0x496f7f['shift']());}};_0x1b0fdd(++_0x28ac6a);}(_0x7217,0x19e));var _0x7721=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x7217[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7721('0x1')]},'joinAt':{'type':Sequelize[_0x7721('0x2')]},'leaveAt':{'type':Sequelize[_0x7721('0x2')]},'acceptAt':{'type':Sequelize[_0x7721('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bfe1188..ab94964 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 _0x7d8a=['filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','update','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','sendStatus','error','stack','name','index','WhatsappQueueReport','rawAttributes','type','key','model','query'];(function(_0x1a2ef3,_0x21186c){var _0x34f4a4=function(_0x277126){while(--_0x277126){_0x1a2ef3['push'](_0x1a2ef3['shift']());}};_0x34f4a4(++_0x21186c);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x7d8a[_0x59bcb1];return _0x4a737f;};'use strict';var pdf=require(_0xa7d8('0x0'));var emlformat=require(_0xa7d8('0x1'));var rimraf=require(_0xa7d8('0x2'));var zipdir=require(_0xa7d8('0x3'));var jsonpatch=require(_0xa7d8('0x4'));var rp=require(_0xa7d8('0x5'));var moment=require(_0xa7d8('0x6'));var BPromise=require(_0xa7d8('0x7'));var Mustache=require(_0xa7d8('0x8'));var util=require(_0xa7d8('0x9'));var path=require(_0xa7d8('0xa'));var sox=require(_0xa7d8('0xb'));var csv=require(_0xa7d8('0xc'));var ejs=require(_0xa7d8('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7d8('0xe'));var crypto=require(_0xa7d8('0xf'));var jsforce=require(_0xa7d8('0x10'));var deskjs=require(_0xa7d8('0x11'));var toCsv=require(_0xa7d8('0xc'));var querystring=require('querystring');var Papa=require(_0xa7d8('0x12'));var Redis=require('ioredis');var authService=require(_0xa7d8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa7d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7d8('0x15'))(_0xa7d8('0x16'));var utils=require('../../config/utils');var config=require(_0xa7d8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1d5d,_0x161829){_0x161829=_0x161829||0xcc;return function(_0x133a94){if(_0x133a94){return _0x3c1d5d['sendStatus'](_0x161829);}return _0x3c1d5d[_0xa7d8('0x18')](_0x161829)[_0xa7d8('0x19')]();};}function respondWithResult(_0x5c8151,_0x5bfb1a){_0x5bfb1a=_0x5bfb1a||0xc8;return function(_0x5080d6){if(_0x5080d6){return _0x5c8151[_0xa7d8('0x18')](_0x5bfb1a)[_0xa7d8('0x1a')](_0x5080d6);}};}function respondWithFilteredResult(_0x4835e9,_0x2d126b){return function(_0x3452d0){if(_0x3452d0){var _0x2ae530=_0x3452d0[_0xa7d8('0x1b')],_0x2bbaf4=_0x2d126b[_0xa7d8('0x1c')],_0x21bc56=_0x2d126b[_0xa7d8('0x1c')]+_0x2d126b[_0xa7d8('0x1d')],_0x42e957;if(_0x21bc56>=_0x2ae530){_0x21bc56=_0x2ae530;_0x42e957=0xc8;}else{_0x42e957=0xce;}_0x4835e9['status'](_0x42e957);return _0x4835e9[_0xa7d8('0x1e')](_0xa7d8('0x1f'),_0x2bbaf4+'-'+_0x21bc56+'/'+_0x2ae530)['json'](_0x3452d0);}return null;};}function patchUpdates(_0x7c59b4){return function(_0x4114e7){try{jsonpatch[_0xa7d8('0x20')](_0x4114e7,_0x7c59b4,!![]);}catch(_0xc299a){return BPromise['reject'](_0xc299a);}return _0x4114e7[_0xa7d8('0x21')]();};}function saveUpdates(_0x5ec4d4,_0x33f117){return function(_0xa6614a){if(_0xa6614a){return _0xa6614a['update'](_0x5ec4d4)[_0xa7d8('0x22')](function(_0x108a6d){return _0x108a6d;});}return null;};}function removeEntity(_0x34b1ba,_0x426a20){return function(_0x46d9a9){if(_0x46d9a9){return _0x46d9a9['destroy']()[_0xa7d8('0x22')](function(){_0x34b1ba[_0xa7d8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c33f8,_0x31afb8){return function(_0x4a3fd6){if(!_0x4a3fd6){_0x2c33f8[_0xa7d8('0x23')](0x194);}return _0x4a3fd6;};}function handleError(_0x3f02a5,_0xac9707){_0xac9707=_0xac9707||0x1f4;return function(_0x22a1f2){logger[_0xa7d8('0x24')](_0x22a1f2[_0xa7d8('0x25')]);if(_0x22a1f2[_0xa7d8('0x26')]){delete _0x22a1f2['name'];}_0x3f02a5[_0xa7d8('0x18')](_0xac9707)['send'](_0x22a1f2);};}exports[_0xa7d8('0x27')]=function(_0x529df7,_0x53c475){var _0x5d3fef={},_0x491fa0={},_0x45b800={'count':0x0,'rows':[]};var _0xe0d256=_['map'](db[_0xa7d8('0x28')][_0xa7d8('0x29')],function(_0x31b73d){return{'name':_0x31b73d['fieldName'],'type':_0x31b73d[_0xa7d8('0x2a')][_0xa7d8('0x2b')]};});_0x491fa0[_0xa7d8('0x2c')]=_['map'](_0xe0d256,_0xa7d8('0x26'));_0x491fa0[_0xa7d8('0x2d')]=_['keys'](_0x529df7['query']);_0x491fa0[_0xa7d8('0x2e')]=_[_0xa7d8('0x2f')](_0x491fa0[_0xa7d8('0x2c')],_0x491fa0['query']);_0x5d3fef['attributes']=_['intersection'](_0x491fa0[_0xa7d8('0x2c')],qs[_0xa7d8('0x30')](_0x529df7['query'][_0xa7d8('0x30')]));_0x5d3fef['attributes']=_0x5d3fef[_0xa7d8('0x31')]['length']?_0x5d3fef[_0xa7d8('0x31')]:_0x491fa0[_0xa7d8('0x2c')];if(!_0x529df7[_0xa7d8('0x2d')]['hasOwnProperty'](_0xa7d8('0x32'))){_0x5d3fef[_0xa7d8('0x1d')]=qs[_0xa7d8('0x1d')](_0x529df7[_0xa7d8('0x2d')][_0xa7d8('0x1d')]);_0x5d3fef[_0xa7d8('0x1c')]=qs[_0xa7d8('0x1c')](_0x529df7[_0xa7d8('0x2d')][_0xa7d8('0x1c')]);}_0x5d3fef[_0xa7d8('0x33')]=qs[_0xa7d8('0x34')](_0x529df7['query'][_0xa7d8('0x34')]);_0x5d3fef[_0xa7d8('0x35')]=qs[_0xa7d8('0x2e')](_[_0xa7d8('0x36')](_0x529df7[_0xa7d8('0x2d')],_0x491fa0['filters']),_0xe0d256);if(_0x529df7[_0xa7d8('0x2d')][_0xa7d8('0x37')]){_0x5d3fef[_0xa7d8('0x35')]=_[_0xa7d8('0x38')](_0x5d3fef[_0xa7d8('0x35')],{'$or':_[_0xa7d8('0x39')](_0xe0d256,function(_0x194d01){if(_0x194d01[_0xa7d8('0x2a')]!==_0xa7d8('0x3a')){var _0x168478={};_0x168478[_0x194d01[_0xa7d8('0x26')]]={'$like':'%'+_0x529df7[_0xa7d8('0x2d')]['filter']+'%'};return _0x168478;}})});}_0x5d3fef=_['merge']({},_0x5d3fef,_0x529df7[_0xa7d8('0x3b')]);var _0x47d15b={'where':_0x5d3fef[_0xa7d8('0x35')]};return db['WhatsappQueueReport'][_0xa7d8('0x1b')](_0x47d15b)[_0xa7d8('0x22')](function(_0xa83e3b){_0x45b800[_0xa7d8('0x1b')]=_0xa83e3b;if(_0x529df7[_0xa7d8('0x2d')]['includeAll']){_0x5d3fef[_0xa7d8('0x3c')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa7d8('0x3d')](_0x5d3fef);})['then'](function(_0x107e80){_0x45b800[_0xa7d8('0x3e')]=_0x107e80;return _0x45b800;})[_0xa7d8('0x22')](respondWithFilteredResult(_0x53c475,_0x5d3fef))[_0xa7d8('0x3f')](handleError(_0x53c475,null));};exports[_0xa7d8('0x40')]=function(_0x13e9f2,_0x46bf3d){var _0x1b5e33={'raw':!![],'where':{'id':_0x13e9f2[_0xa7d8('0x41')]['id']}},_0x2ef2be={};_0x2ef2be[_0xa7d8('0x2c')]=_[_0xa7d8('0x42')](db[_0xa7d8('0x28')]['rawAttributes']);_0x2ef2be['query']=_[_0xa7d8('0x42')](_0x13e9f2[_0xa7d8('0x2d')]);_0x2ef2be[_0xa7d8('0x2e')]=_[_0xa7d8('0x2f')](_0x2ef2be[_0xa7d8('0x2c')],_0x2ef2be['query']);_0x1b5e33[_0xa7d8('0x31')]=_[_0xa7d8('0x2f')](_0x2ef2be[_0xa7d8('0x2c')],qs[_0xa7d8('0x30')](_0x13e9f2['query']['fields']));_0x1b5e33['attributes']=_0x1b5e33[_0xa7d8('0x31')]['length']?_0x1b5e33[_0xa7d8('0x31')]:_0x2ef2be[_0xa7d8('0x2c')];if(_0x13e9f2[_0xa7d8('0x2d')]['includeAll']){_0x1b5e33['include']=[{'all':!![]}];}_0x1b5e33=_[_0xa7d8('0x38')]({},_0x1b5e33,_0x13e9f2[_0xa7d8('0x3b')]);return db[_0xa7d8('0x28')][_0xa7d8('0x43')](_0x1b5e33)[_0xa7d8('0x22')](handleEntityNotFound(_0x46bf3d,null))[_0xa7d8('0x22')](respondWithResult(_0x46bf3d,null))[_0xa7d8('0x3f')](handleError(_0x46bf3d,null));};exports[_0xa7d8('0x44')]=function(_0x362917,_0x3ec45c){return db[_0xa7d8('0x28')][_0xa7d8('0x44')](_0x362917['body'],{})[_0xa7d8('0x22')](respondWithResult(_0x3ec45c,0xc9))['catch'](handleError(_0x3ec45c,null));};exports[_0xa7d8('0x45')]=function(_0x5666e6,_0x16321c){if(_0x5666e6[_0xa7d8('0x46')]['id']){delete _0x5666e6[_0xa7d8('0x46')]['id'];}return db[_0xa7d8('0x28')][_0xa7d8('0x43')]({'where':{'id':_0x5666e6[_0xa7d8('0x41')]['id']}})['then'](handleEntityNotFound(_0x16321c,null))[_0xa7d8('0x22')](saveUpdates(_0x5666e6[_0xa7d8('0x46')],null))['then'](respondWithResult(_0x16321c,null))['catch'](handleError(_0x16321c,null));};exports['destroy']=function(_0x4c2eae,_0x3e089c){return db['WhatsappQueueReport'][_0xa7d8('0x43')]({'where':{'id':_0x4c2eae[_0xa7d8('0x41')]['id']}})[_0xa7d8('0x22')](handleEntityNotFound(_0x3e089c,null))['then'](removeEntity(_0x3e089c,null))['catch'](handleError(_0x3e089c,null));};exports['describe']=function(_0x23e6df,_0x1688b3){return db[_0xa7d8('0x28')][_0xa7d8('0x47')]()[_0xa7d8('0x22')](respondWithResult(_0x1688b3,null))[_0xa7d8('0x3f')](handleError(_0x1688b3,null));}; \ No newline at end of file +var _0xe740=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','WhatsappQueueReport','count','includeAll','include','findAll','catch','params','keys','length','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x279b5f,_0x3ab5e6){var _0x5ad7da=function(_0x19d3f3){while(--_0x19d3f3){_0x279b5f['push'](_0x279b5f['shift']());}};_0x5ad7da(++_0x3ab5e6);}(_0xe740,0x14b));var _0x0e74=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xe740[_0x234ae1];return _0x227ba0;};'use strict';var pdf=require(_0x0e74('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e74('0x1'));var zipdir=require(_0x0e74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e74('0x3'));var moment=require('moment');var BPromise=require(_0x0e74('0x4'));var Mustache=require('mustache');var util=require(_0x0e74('0x5'));var path=require(_0x0e74('0x6'));var sox=require('sox');var csv=require(_0x0e74('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e74('0x8'));var squel=require(_0x0e74('0x9'));var crypto=require(_0x0e74('0xa'));var jsforce=require(_0x0e74('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0e74('0x7'));var querystring=require(_0x0e74('0xc'));var Papa=require(_0x0e74('0xd'));var Redis=require(_0x0e74('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0e74('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e74('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0e74('0x11'));var config=require(_0x0e74('0x12'));var db=require(_0x0e74('0x13'))['db'];function respondWithStatusCode(_0x30b078,_0x4b45f0){_0x4b45f0=_0x4b45f0||0xcc;return function(_0x3dc1b4){if(_0x3dc1b4){return _0x30b078['sendStatus'](_0x4b45f0);}return _0x30b078[_0x0e74('0x14')](_0x4b45f0)[_0x0e74('0x15')]();};}function respondWithResult(_0x209257,_0x3784b3){_0x3784b3=_0x3784b3||0xc8;return function(_0x1b0a50){if(_0x1b0a50){return _0x209257[_0x0e74('0x14')](_0x3784b3)[_0x0e74('0x16')](_0x1b0a50);}};}function respondWithFilteredResult(_0x2ac2ae,_0x3fee34){return function(_0x276f92){if(_0x276f92){var _0x1c9156=_0x276f92['count'],_0x205272=_0x3fee34[_0x0e74('0x17')],_0x2421a9=_0x3fee34[_0x0e74('0x17')]+_0x3fee34[_0x0e74('0x18')],_0x5972a0;if(_0x2421a9>=_0x1c9156){_0x2421a9=_0x1c9156;_0x5972a0=0xc8;}else{_0x5972a0=0xce;}_0x2ac2ae[_0x0e74('0x14')](_0x5972a0);return _0x2ac2ae[_0x0e74('0x19')](_0x0e74('0x1a'),_0x205272+'-'+_0x2421a9+'/'+_0x1c9156)[_0x0e74('0x16')](_0x276f92);}return null;};}function patchUpdates(_0x143fc0){return function(_0x1a0272){try{jsonpatch[_0x0e74('0x1b')](_0x1a0272,_0x143fc0,!![]);}catch(_0x205135){return BPromise['reject'](_0x205135);}return _0x1a0272[_0x0e74('0x1c')]();};}function saveUpdates(_0x46ebe6,_0x3cf369){return function(_0x24df6b){if(_0x24df6b){return _0x24df6b[_0x0e74('0x1d')](_0x46ebe6)[_0x0e74('0x1e')](function(_0x597e6f){return _0x597e6f;});}return null;};}function removeEntity(_0x314939,_0x2497a9){return function(_0x5a676c){if(_0x5a676c){return _0x5a676c[_0x0e74('0x1f')]()['then'](function(){_0x314939[_0x0e74('0x14')](0xcc)[_0x0e74('0x15')]();});}};}function handleEntityNotFound(_0x369cc8,_0x281f75){return function(_0x115ac4){if(!_0x115ac4){_0x369cc8[_0x0e74('0x20')](0x194);}return _0x115ac4;};}function handleError(_0x43dab3,_0x33f89c){_0x33f89c=_0x33f89c||0x1f4;return function(_0x25f712){logger[_0x0e74('0x21')](_0x25f712[_0x0e74('0x22')]);if(_0x25f712[_0x0e74('0x23')]){delete _0x25f712[_0x0e74('0x23')];}_0x43dab3['status'](_0x33f89c)[_0x0e74('0x24')](_0x25f712);};}exports[_0x0e74('0x25')]=function(_0xab233e,_0x50d561){var _0x9d1248={},_0x24db44={},_0x1e35e4={'count':0x0,'rows':[]};var _0x1a4863=_[_0x0e74('0x26')](db['WhatsappQueueReport'][_0x0e74('0x27')],function(_0x172870){return{'name':_0x172870[_0x0e74('0x28')],'type':_0x172870[_0x0e74('0x29')]['key']};});_0x24db44[_0x0e74('0x2a')]=_[_0x0e74('0x26')](_0x1a4863,'name');_0x24db44[_0x0e74('0x2b')]=_['keys'](_0xab233e[_0x0e74('0x2b')]);_0x24db44[_0x0e74('0x2c')]=_['intersection'](_0x24db44[_0x0e74('0x2a')],_0x24db44[_0x0e74('0x2b')]);_0x9d1248[_0x0e74('0x2d')]=_[_0x0e74('0x2e')](_0x24db44[_0x0e74('0x2a')],qs[_0x0e74('0x2f')](_0xab233e['query']['fields']));_0x9d1248[_0x0e74('0x2d')]=_0x9d1248[_0x0e74('0x2d')]['length']?_0x9d1248['attributes']:_0x24db44[_0x0e74('0x2a')];if(!_0xab233e['query'][_0x0e74('0x30')](_0x0e74('0x31'))){_0x9d1248[_0x0e74('0x18')]=qs[_0x0e74('0x18')](_0xab233e[_0x0e74('0x2b')]['limit']);_0x9d1248['offset']=qs[_0x0e74('0x17')](_0xab233e[_0x0e74('0x2b')][_0x0e74('0x17')]);}_0x9d1248[_0x0e74('0x32')]=qs['sort'](_0xab233e[_0x0e74('0x2b')]['sort']);_0x9d1248['where']=qs['filters'](_['pick'](_0xab233e[_0x0e74('0x2b')],_0x24db44[_0x0e74('0x2c')]),_0x1a4863);if(_0xab233e[_0x0e74('0x2b')][_0x0e74('0x33')]){_0x9d1248[_0x0e74('0x34')]=_[_0x0e74('0x35')](_0x9d1248[_0x0e74('0x34')],{'$or':_[_0x0e74('0x26')](_0x1a4863,function(_0x3fc00c){if(_0x3fc00c['type']!==_0x0e74('0x36')){var _0x4c2757={};_0x4c2757[_0x3fc00c[_0x0e74('0x23')]]={'$like':'%'+_0xab233e[_0x0e74('0x2b')][_0x0e74('0x33')]+'%'};return _0x4c2757;}})});}_0x9d1248=_[_0x0e74('0x35')]({},_0x9d1248,_0xab233e[_0x0e74('0x37')]);var _0x1d6c2d={'where':_0x9d1248[_0x0e74('0x34')]};return db[_0x0e74('0x38')][_0x0e74('0x39')](_0x1d6c2d)['then'](function(_0x27a81b){_0x1e35e4[_0x0e74('0x39')]=_0x27a81b;if(_0xab233e[_0x0e74('0x2b')][_0x0e74('0x3a')]){_0x9d1248[_0x0e74('0x3b')]=[{'all':!![]}];}return db[_0x0e74('0x38')][_0x0e74('0x3c')](_0x9d1248);})[_0x0e74('0x1e')](function(_0x19d204){_0x1e35e4['rows']=_0x19d204;return _0x1e35e4;})['then'](respondWithFilteredResult(_0x50d561,_0x9d1248))[_0x0e74('0x3d')](handleError(_0x50d561,null));};exports['show']=function(_0x59bdbf,_0x389783){var _0x30e90b={'raw':!![],'where':{'id':_0x59bdbf[_0x0e74('0x3e')]['id']}},_0x20c748={};_0x20c748[_0x0e74('0x2a')]=_[_0x0e74('0x3f')](db[_0x0e74('0x38')]['rawAttributes']);_0x20c748[_0x0e74('0x2b')]=_['keys'](_0x59bdbf[_0x0e74('0x2b')]);_0x20c748[_0x0e74('0x2c')]=_[_0x0e74('0x2e')](_0x20c748['model'],_0x20c748['query']);_0x30e90b['attributes']=_[_0x0e74('0x2e')](_0x20c748[_0x0e74('0x2a')],qs[_0x0e74('0x2f')](_0x59bdbf[_0x0e74('0x2b')][_0x0e74('0x2f')]));_0x30e90b[_0x0e74('0x2d')]=_0x30e90b[_0x0e74('0x2d')][_0x0e74('0x40')]?_0x30e90b['attributes']:_0x20c748['model'];if(_0x59bdbf['query'][_0x0e74('0x3a')]){_0x30e90b[_0x0e74('0x3b')]=[{'all':!![]}];}_0x30e90b=_[_0x0e74('0x35')]({},_0x30e90b,_0x59bdbf[_0x0e74('0x37')]);return db[_0x0e74('0x38')][_0x0e74('0x41')](_0x30e90b)[_0x0e74('0x1e')](handleEntityNotFound(_0x389783,null))[_0x0e74('0x1e')](respondWithResult(_0x389783,null))[_0x0e74('0x3d')](handleError(_0x389783,null));};exports['create']=function(_0xb5ba29,_0xfd2d1b){return db[_0x0e74('0x38')][_0x0e74('0x42')](_0xb5ba29[_0x0e74('0x43')],{})[_0x0e74('0x1e')](respondWithResult(_0xfd2d1b,0xc9))[_0x0e74('0x3d')](handleError(_0xfd2d1b,null));};exports[_0x0e74('0x1d')]=function(_0x1098fd,_0x29b1ac){if(_0x1098fd['body']['id']){delete _0x1098fd['body']['id'];}return db[_0x0e74('0x38')][_0x0e74('0x41')]({'where':{'id':_0x1098fd[_0x0e74('0x3e')]['id']}})['then'](handleEntityNotFound(_0x29b1ac,null))[_0x0e74('0x1e')](saveUpdates(_0x1098fd[_0x0e74('0x43')],null))[_0x0e74('0x1e')](respondWithResult(_0x29b1ac,null))[_0x0e74('0x3d')](handleError(_0x29b1ac,null));};exports[_0x0e74('0x1f')]=function(_0x9d0660,_0x2a673a){return db[_0x0e74('0x38')][_0x0e74('0x41')]({'where':{'id':_0x9d0660[_0x0e74('0x3e')]['id']}})[_0x0e74('0x1e')](handleEntityNotFound(_0x2a673a,null))['then'](removeEntity(_0x2a673a,null))[_0x0e74('0x3d')](handleError(_0x2a673a,null));};exports[_0x0e74('0x44')]=function(_0x506231,_0x43be05){return db[_0x0e74('0x38')][_0x0e74('0x44')]()[_0x0e74('0x1e')](respondWithResult(_0x43be05,null))[_0x0e74('0x3d')](handleError(_0x43be05,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index bd52290..62e7881 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 _0xe24a=['uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue'];(function(_0x285b17,_0x502c2a){var _0xc242f8=function(_0x203e08){while(--_0x203e08){_0x285b17['push'](_0x285b17['shift']());}};_0xc242f8(++_0x502c2a);}(_0xe24a,0x151));var _0xae24=function(_0x51770e,_0x83d043){_0x51770e=_0x51770e-0x0;var _0x188d92=_0xe24a[_0x51770e];return _0x188d92;};'use strict';var _=require(_0xae24('0x0'));var util=require(_0xae24('0x1'));var logger=require(_0xae24('0x2'))(_0xae24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae24('0x4'));var rimraf=require(_0xae24('0x5'));var config=require(_0xae24('0x6'));var attributes=require(_0xae24('0x7'));module[_0xae24('0x8')]=function(_0x153c78,_0x5a0807){return _0x153c78[_0xae24('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0xae24('0xa'),'paranoid':![],'indexes':[{'name':_0xae24('0xb'),'fields':[_0xae24('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cbc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api'];(function(_0x517a2e,_0x2ed0a0){var _0x463a70=function(_0x27ce3f){while(--_0x27ce3f){_0x517a2e['push'](_0x517a2e['shift']());}};_0x463a70(++_0x2ed0a0);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x40d728,_0x190ef2){_0x40d728=_0x40d728-0x0;var _0x207740=_0x1cbc[_0x40d728];return _0x207740;};'use strict';var _=require(_0xc1cb('0x0'));var util=require('util');var logger=require(_0xc1cb('0x1'))(_0xc1cb('0x2'));var moment=require(_0xc1cb('0x3'));var BPromise=require(_0xc1cb('0x4'));var rp=require(_0xc1cb('0x5'));var fs=require('fs');var path=require(_0xc1cb('0x6'));var rimraf=require(_0xc1cb('0x7'));var config=require(_0xc1cb('0x8'));var attributes=require(_0xc1cb('0x9'));module[_0xc1cb('0xa')]=function(_0x1dacec,_0x27423b){return _0x1dacec['define'](_0xc1cb('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xc1cb('0xc'),'fields':[_0xc1cb('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 280a25b..1ea5825 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 _0xd15e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','stringify','UpdateWhatsappQueueReport','update','where','limit','util','moment'];(function(_0x2e4a16,_0x3ed975){var _0x46d719=function(_0x42653f){while(--_0x42653f){_0x2e4a16['push'](_0x2e4a16['shift']());}};_0x46d719(++_0x3ed975);}(_0xd15e,0x130));var _0xed15=function(_0x43a847,_0x36df8a){_0x43a847=_0x43a847-0x0;var _0x1477ee=_0xd15e[_0x43a847];return _0x1477ee;};'use strict';var _=require('lodash');var util=require(_0xed15('0x0'));var moment=require(_0xed15('0x1'));var BPromise=require(_0xed15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed15('0x3'));var db=require(_0xed15('0x4'))['db'];var utils=require(_0xed15('0x5'));var logger=require(_0xed15('0x6'))(_0xed15('0x7'));var config=require(_0xed15('0x8'));var jayson=require(_0xed15('0x9'));var client=jayson[_0xed15('0xa')][_0xed15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47aaf0,_0x3d8d2d,_0x4166a3){return new BPromise(function(_0x3436b2,_0x3a31ea){return client[_0xed15('0xc')](_0x47aaf0,_0x4166a3)[_0xed15('0xd')](function(_0x462da6){logger[_0xed15('0xe')](_0xed15('0xf'),_0x3d8d2d,_0xed15('0x10'));logger[_0xed15('0x11')](_0xed15('0x12'),_0x3d8d2d,_0xed15('0x10'),JSON['stringify'](_0x462da6));if(_0x462da6[_0xed15('0x13')]){if(_0x462da6[_0xed15('0x13')][_0xed15('0x14')]===0x1f4){logger[_0xed15('0x13')](_0xed15('0xf'),_0x3d8d2d,_0x462da6[_0xed15('0x13')]['message']);return _0x3a31ea(_0x462da6['error'][_0xed15('0x15')]);}logger[_0xed15('0x13')](_0xed15('0xf'),_0x3d8d2d,_0x462da6[_0xed15('0x13')][_0xed15('0x15')]);return _0x3436b2(_0x462da6[_0xed15('0x13')][_0xed15('0x15')]);}else{logger[_0xed15('0xe')](_0xed15('0xf'),_0x3d8d2d,'request\x20sent');_0x3436b2(_0x462da6[_0xed15('0x16')]['message']);}})[_0xed15('0x17')](function(_0x4f45a6){logger[_0xed15('0x13')](_0xed15('0xf'),_0x3d8d2d,_0x4f45a6);_0x3a31ea(_0x4f45a6);});});}exports[_0xed15('0x18')]=function(_0x114c7a){var _0x1b22bd=this;return new Promise(function(_0x3073bf,_0x30b425){return db[_0xed15('0x19')][_0xed15('0x1a')](_0x114c7a[_0xed15('0x1b')],{'raw':_0x114c7a[_0xed15('0x1c')]?_0x114c7a[_0xed15('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xed15('0xd')](function(_0x590e66){logger['info'](_0xed15('0x18'),_0x114c7a);logger['debug']('CreateWhatsappQueueReport',_0x114c7a,JSON[_0xed15('0x1d')](_0x590e66));_0x3073bf(_0x590e66);})[_0xed15('0x17')](function(_0x40322b){logger[_0xed15('0x13')](_0xed15('0x18'),_0x40322b[_0xed15('0x15')],_0x114c7a);_0x30b425(_0x1b22bd[_0xed15('0x13')](0x1f4,_0x40322b[_0xed15('0x15')]));});});};exports[_0xed15('0x1e')]=function(_0x549be){var _0x13213c=this;return new Promise(function(_0x1316f5,_0x35a986){return db['WhatsappQueueReport'][_0xed15('0x1f')](_0x549be['body'],{'raw':_0x549be[_0xed15('0x1c')]?_0x549be[_0xed15('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549be[_0xed15('0x1c')]?_0x549be['options'][_0xed15('0x20')]||null:null,'attributes':_0x549be[_0xed15('0x1c')]?_0x549be[_0xed15('0x1c')]['attributes']||null:null,'limit':_0x549be[_0xed15('0x1c')]?_0x549be[_0xed15('0x1c')][_0xed15('0x21')]||null:null})[_0xed15('0xd')](function(_0x3bff81){logger[_0xed15('0xe')](_0xed15('0x1e'),_0x549be);logger[_0xed15('0x11')](_0xed15('0x1e'),_0x549be,JSON['stringify'](_0x3bff81));_0x1316f5(_0x3bff81);})['catch'](function(_0x58892e){logger[_0xed15('0x13')]('UpdateWhatsappQueueReport',_0x58892e[_0xed15('0x15')],_0x549be);_0x35a986(_0x13213c['error'](0x1f4,_0x58892e['message']));});});}; \ No newline at end of file +var _0x69c1=['body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','update','raw','where','limit','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x467c7c,_0x17bd60){var _0x13d8e1=function(_0x4d10c9){while(--_0x4d10c9){_0x467c7c['push'](_0x467c7c['shift']());}};_0x13d8e1(++_0x17bd60);}(_0x69c1,0xf1));var _0x169c=function(_0xdf3db6,_0x2a1952){_0xdf3db6=_0xdf3db6-0x0;var _0x4b7a65=_0x69c1[_0xdf3db6];return _0x4b7a65;};'use strict';var _=require('lodash');var util=require(_0x169c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x169c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x169c('0x2'));var logger=require(_0x169c('0x3'))(_0x169c('0x4'));var config=require(_0x169c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x169c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf38032,_0x4a8b4d,_0x3fd4b3){return new BPromise(function(_0x398f8a,_0x7931af){return client[_0x169c('0x7')](_0xf38032,_0x3fd4b3)[_0x169c('0x8')](function(_0x25f1a5){logger[_0x169c('0x9')](_0x169c('0xa'),_0x4a8b4d,_0x169c('0xb'));logger[_0x169c('0xc')](_0x169c('0xd'),_0x4a8b4d,_0x169c('0xb'),JSON[_0x169c('0xe')](_0x25f1a5));if(_0x25f1a5[_0x169c('0xf')]){if(_0x25f1a5[_0x169c('0xf')][_0x169c('0x10')]===0x1f4){logger[_0x169c('0xf')](_0x169c('0xa'),_0x4a8b4d,_0x25f1a5[_0x169c('0xf')][_0x169c('0x11')]);return _0x7931af(_0x25f1a5[_0x169c('0xf')][_0x169c('0x11')]);}logger[_0x169c('0xf')](_0x169c('0xa'),_0x4a8b4d,_0x25f1a5['error'][_0x169c('0x11')]);return _0x398f8a(_0x25f1a5[_0x169c('0xf')][_0x169c('0x11')]);}else{logger['info'](_0x169c('0xa'),_0x4a8b4d,_0x169c('0xb'));_0x398f8a(_0x25f1a5[_0x169c('0x12')][_0x169c('0x11')]);}})[_0x169c('0x13')](function(_0x2280b3){logger[_0x169c('0xf')](_0x169c('0xa'),_0x4a8b4d,_0x2280b3);_0x7931af(_0x2280b3);});});}exports['CreateWhatsappQueueReport']=function(_0x5a29f9){var _0x2a9258=this;return new Promise(function(_0x46dd7f,_0xc77bd5){return db['WhatsappQueueReport']['create'](_0x5a29f9[_0x169c('0x14')],{'raw':_0x5a29f9['options']?_0x5a29f9[_0x169c('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x291032){logger['info'](_0x169c('0x16'),_0x5a29f9);logger[_0x169c('0xc')](_0x169c('0x16'),_0x5a29f9,JSON['stringify'](_0x291032));_0x46dd7f(_0x291032);})[_0x169c('0x13')](function(_0x4ed19d){logger[_0x169c('0xf')](_0x169c('0x16'),_0x4ed19d[_0x169c('0x11')],_0x5a29f9);_0xc77bd5(_0x2a9258[_0x169c('0xf')](0x1f4,_0x4ed19d[_0x169c('0x11')]));});});};exports[_0x169c('0x17')]=function(_0x3f661b){var _0x5a4623=this;return new Promise(function(_0x83b6de,_0x4dcd4b){return db[_0x169c('0x18')][_0x169c('0x19')](_0x3f661b['body'],{'raw':_0x3f661b[_0x169c('0x15')]?_0x3f661b[_0x169c('0x15')][_0x169c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f661b[_0x169c('0x15')]?_0x3f661b[_0x169c('0x15')][_0x169c('0x1b')]||null:null,'attributes':_0x3f661b[_0x169c('0x15')]?_0x3f661b[_0x169c('0x15')]['attributes']||null:null,'limit':_0x3f661b[_0x169c('0x15')]?_0x3f661b['options'][_0x169c('0x1c')]||null:null})[_0x169c('0x8')](function(_0x37d8d2){logger[_0x169c('0x9')](_0x169c('0x17'),_0x3f661b);logger['debug'](_0x169c('0x17'),_0x3f661b,JSON[_0x169c('0xe')](_0x37d8d2));_0x83b6de(_0x37d8d2);})[_0x169c('0x13')](function(_0x113de8){logger['error'](_0x169c('0x17'),_0x113de8[_0x169c('0x11')],_0x3f661b);_0x4dcd4b(_0x5a4623[_0x169c('0xf')](0x1f4,_0x113de8[_0x169c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 89ba7a3..044a117 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 _0x289e=['show','post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3b3625,_0x10ce65){var _0x4e9f73=function(_0x2dd7c4){while(--_0x2dd7c4){_0x3b3625['push'](_0x3b3625['shift']());}};_0x4e9f73(++_0x10ce65);}(_0x289e,0xea));var _0xe289=function(_0x4b9cbe,_0x176ace){_0x4b9cbe=_0x4b9cbe-0x0;var _0x5803dc=_0x289e[_0x4b9cbe];return _0x5803dc;};'use strict';var multer=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var path=require('path');var timeout=require(_0xe289('0x2'));var express=require(_0xe289('0x3'));var router=express['Router']();var auth=require(_0xe289('0x4'));var interaction=require(_0xe289('0x5'));var config=require('../../config/environment');var controller=require(_0xe289('0x6'));router[_0xe289('0x7')]('/',auth[_0xe289('0x8')](),controller[_0xe289('0x9')]);router[_0xe289('0x7')](_0xe289('0xa'),auth[_0xe289('0x8')](),controller[_0xe289('0xb')]);router[_0xe289('0x7')](_0xe289('0xc'),auth['isAuthenticated'](),controller[_0xe289('0xd')]);router[_0xe289('0xe')]('/',auth[_0xe289('0x8')](),controller['create']);router[_0xe289('0xf')]('/:id',auth[_0xe289('0x8')](),controller[_0xe289('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe289('0x11')]);module[_0xe289('0x12')]=router; \ No newline at end of file +var _0x4e30=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x4e30,0x112));var _0x04e3=function(_0x54d79c,_0x20fd35){_0x54d79c=_0x54d79c-0x0;var _0xdb4aa0=_0x4e30[_0x54d79c];return _0xdb4aa0;};'use strict';var multer=require('multer');var util=require(_0x04e3('0x0'));var path=require(_0x04e3('0x1'));var timeout=require(_0x04e3('0x2'));var express=require(_0x04e3('0x3'));var router=express[_0x04e3('0x4')]();var auth=require(_0x04e3('0x5'));var interaction=require(_0x04e3('0x6'));var config=require(_0x04e3('0x7'));var controller=require(_0x04e3('0x8'));router[_0x04e3('0x9')]('/',auth[_0x04e3('0xa')](),controller['index']);router[_0x04e3('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x04e3('0xb')]);router[_0x04e3('0x9')](_0x04e3('0xc'),auth[_0x04e3('0xa')](),controller[_0x04e3('0xd')]);router[_0x04e3('0xe')]('/',auth[_0x04e3('0xa')](),controller[_0x04e3('0xf')]);router[_0x04e3('0x10')](_0x04e3('0xc'),auth[_0x04e3('0xa')](),controller[_0x04e3('0x11')]);router[_0x04e3('0x12')](_0x04e3('0xc'),auth[_0x04e3('0xa')](),controller[_0x04e3('0x13')]);module[_0x04e3('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c337efb..3184517 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x564b25,_0x4dc0b4){var _0xc3646c=function(_0x102ea5){while(--_0x102ea5){_0x564b25['push'](_0x564b25['shift']());}};_0xc3646c(++_0x4dc0b4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3129ac8..936b4a6 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 _0x6d88=['save','update','destroy','then','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','WhatsappTransferReport','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','count','offset','limit','status','Content-Range','json','reject'];(function(_0x25109d,_0x44aa91){var _0x5a3e8b=function(_0x36f580){while(--_0x36f580){_0x25109d['push'](_0x25109d['shift']());}};_0x5a3e8b(++_0x44aa91);}(_0x6d88,0x100));var _0x86d8=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x6d88[_0x20d54d];return _0x516e8b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d8('0x0'));var rimraf=require(_0x86d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86d8('0x2'));var rp=require('request-promise');var moment=require(_0x86d8('0x3'));var BPromise=require(_0x86d8('0x4'));var Mustache=require(_0x86d8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x86d8('0x6'));var csv=require(_0x86d8('0x7'));var ejs=require(_0x86d8('0x8'));var fs=require('fs');var _=require(_0x86d8('0x9'));var squel=require(_0x86d8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d8('0xb'));var toCsv=require(_0x86d8('0x7'));var querystring=require(_0x86d8('0xc'));var Papa=require(_0x86d8('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x86d8('0xe'));var hardwareService=require(_0x86d8('0xf'));var logger=require(_0x86d8('0x10'))(_0x86d8('0x11'));var utils=require(_0x86d8('0x12'));var config=require('../../config/environment');var db=require(_0x86d8('0x13'))['db'];function respondWithStatusCode(_0x3f24bb,_0x42de58){_0x42de58=_0x42de58||0xcc;return function(_0x4b956d){if(_0x4b956d){return _0x3f24bb['sendStatus'](_0x42de58);}return _0x3f24bb['status'](_0x42de58)[_0x86d8('0x14')]();};}function respondWithResult(_0x119446,_0x5df7ab){_0x5df7ab=_0x5df7ab||0xc8;return function(_0x21c9ca){if(_0x21c9ca){return _0x119446['status'](_0x5df7ab)['json'](_0x21c9ca);}};}function respondWithFilteredResult(_0x47ff8c,_0x17c777){return function(_0xcc7b4d){if(_0xcc7b4d){var _0x2b7c05=_0xcc7b4d[_0x86d8('0x15')],_0x1bae83=_0x17c777['offset'],_0x277c09=_0x17c777[_0x86d8('0x16')]+_0x17c777[_0x86d8('0x17')],_0x4c5597;if(_0x277c09>=_0x2b7c05){_0x277c09=_0x2b7c05;_0x4c5597=0xc8;}else{_0x4c5597=0xce;}_0x47ff8c[_0x86d8('0x18')](_0x4c5597);return _0x47ff8c['set'](_0x86d8('0x19'),_0x1bae83+'-'+_0x277c09+'/'+_0x2b7c05)[_0x86d8('0x1a')](_0xcc7b4d);}return null;};}function patchUpdates(_0x585bc1){return function(_0x126412){try{jsonpatch['apply'](_0x126412,_0x585bc1,!![]);}catch(_0x353be8){return BPromise[_0x86d8('0x1b')](_0x353be8);}return _0x126412[_0x86d8('0x1c')]();};}function saveUpdates(_0x3d7acd,_0x492bd5){return function(_0xb5409e){if(_0xb5409e){return _0xb5409e[_0x86d8('0x1d')](_0x3d7acd)['then'](function(_0x502676){return _0x502676;});}return null;};}function removeEntity(_0x7a5069,_0x8b4da2){return function(_0x4a0279){if(_0x4a0279){return _0x4a0279[_0x86d8('0x1e')]()[_0x86d8('0x1f')](function(){_0x7a5069[_0x86d8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f47f6,_0x15bc14){return function(_0x9628fb){if(!_0x9628fb){_0x5f47f6[_0x86d8('0x20')](0x194);}return _0x9628fb;};}function handleError(_0x398d5d,_0x4632fa){_0x4632fa=_0x4632fa||0x1f4;return function(_0xc37b19){logger[_0x86d8('0x21')](_0xc37b19[_0x86d8('0x22')]);if(_0xc37b19[_0x86d8('0x23')]){delete _0xc37b19[_0x86d8('0x23')];}_0x398d5d[_0x86d8('0x18')](_0x4632fa)[_0x86d8('0x24')](_0xc37b19);};}exports[_0x86d8('0x25')]=function(_0x8c2a04,_0x4ce9d8){var _0xe434b8={},_0x2eb781={},_0xea6cba={'count':0x0,'rows':[]};var _0x4b32bc=_[_0x86d8('0x26')](db['WhatsappTransferReport']['rawAttributes'],function(_0x16c9c7){return{'name':_0x16c9c7[_0x86d8('0x27')],'type':_0x16c9c7['type'][_0x86d8('0x28')]};});_0x2eb781[_0x86d8('0x29')]=_[_0x86d8('0x26')](_0x4b32bc,_0x86d8('0x23'));_0x2eb781[_0x86d8('0x2a')]=_['keys'](_0x8c2a04[_0x86d8('0x2a')]);_0x2eb781[_0x86d8('0x2b')]=_['intersection'](_0x2eb781[_0x86d8('0x29')],_0x2eb781[_0x86d8('0x2a')]);_0xe434b8[_0x86d8('0x2c')]=_[_0x86d8('0x2d')](_0x2eb781[_0x86d8('0x29')],qs[_0x86d8('0x2e')](_0x8c2a04[_0x86d8('0x2a')][_0x86d8('0x2e')]));_0xe434b8[_0x86d8('0x2c')]=_0xe434b8[_0x86d8('0x2c')]['length']?_0xe434b8['attributes']:_0x2eb781[_0x86d8('0x29')];if(!_0x8c2a04[_0x86d8('0x2a')]['hasOwnProperty'](_0x86d8('0x2f'))){_0xe434b8[_0x86d8('0x17')]=qs[_0x86d8('0x17')](_0x8c2a04[_0x86d8('0x2a')]['limit']);_0xe434b8[_0x86d8('0x16')]=qs[_0x86d8('0x16')](_0x8c2a04[_0x86d8('0x2a')]['offset']);}_0xe434b8[_0x86d8('0x30')]=qs[_0x86d8('0x31')](_0x8c2a04['query'][_0x86d8('0x31')]);_0xe434b8['where']=qs[_0x86d8('0x2b')](_[_0x86d8('0x32')](_0x8c2a04[_0x86d8('0x2a')],_0x2eb781[_0x86d8('0x2b')]),_0x4b32bc);if(_0x8c2a04[_0x86d8('0x2a')][_0x86d8('0x33')]){_0xe434b8['where']=_[_0x86d8('0x34')](_0xe434b8[_0x86d8('0x35')],{'$or':_[_0x86d8('0x26')](_0x4b32bc,function(_0x215698){if(_0x215698[_0x86d8('0x36')]!==_0x86d8('0x37')){var _0x234c02={};_0x234c02[_0x215698[_0x86d8('0x23')]]={'$like':'%'+_0x8c2a04[_0x86d8('0x2a')][_0x86d8('0x33')]+'%'};return _0x234c02;}})});}_0xe434b8=_[_0x86d8('0x34')]({},_0xe434b8,_0x8c2a04['options']);var _0x31c539={'where':_0xe434b8[_0x86d8('0x35')]};return db[_0x86d8('0x38')][_0x86d8('0x15')](_0x31c539)[_0x86d8('0x1f')](function(_0x188894){_0xea6cba['count']=_0x188894;if(_0x8c2a04[_0x86d8('0x2a')]['includeAll']){_0xe434b8[_0x86d8('0x39')]=[{'all':!![]}];}return db[_0x86d8('0x38')][_0x86d8('0x3a')](_0xe434b8);})[_0x86d8('0x1f')](function(_0x1f7f40){_0xea6cba['rows']=_0x1f7f40;return _0xea6cba;})['then'](respondWithFilteredResult(_0x4ce9d8,_0xe434b8))[_0x86d8('0x3b')](handleError(_0x4ce9d8,null));};exports[_0x86d8('0x3c')]=function(_0x420a6a,_0x53bc78){var _0x2f0955={'raw':!![],'where':{'id':_0x420a6a[_0x86d8('0x3d')]['id']}},_0xb1e3cb={};_0xb1e3cb[_0x86d8('0x29')]=_[_0x86d8('0x3e')](db[_0x86d8('0x38')][_0x86d8('0x3f')]);_0xb1e3cb['query']=_['keys'](_0x420a6a[_0x86d8('0x2a')]);_0xb1e3cb[_0x86d8('0x2b')]=_[_0x86d8('0x2d')](_0xb1e3cb[_0x86d8('0x29')],_0xb1e3cb['query']);_0x2f0955[_0x86d8('0x2c')]=_[_0x86d8('0x2d')](_0xb1e3cb[_0x86d8('0x29')],qs['fields'](_0x420a6a[_0x86d8('0x2a')][_0x86d8('0x2e')]));_0x2f0955[_0x86d8('0x2c')]=_0x2f0955[_0x86d8('0x2c')][_0x86d8('0x40')]?_0x2f0955['attributes']:_0xb1e3cb[_0x86d8('0x29')];if(_0x420a6a[_0x86d8('0x2a')][_0x86d8('0x41')]){_0x2f0955[_0x86d8('0x39')]=[{'all':!![]}];}_0x2f0955=_[_0x86d8('0x34')]({},_0x2f0955,_0x420a6a[_0x86d8('0x42')]);return db[_0x86d8('0x38')][_0x86d8('0x43')](_0x2f0955)[_0x86d8('0x1f')](handleEntityNotFound(_0x53bc78,null))['then'](respondWithResult(_0x53bc78,null))['catch'](handleError(_0x53bc78,null));};exports['create']=function(_0x1c99ef,_0x5405ec){return db[_0x86d8('0x38')][_0x86d8('0x44')](_0x1c99ef[_0x86d8('0x45')],{})['then'](respondWithResult(_0x5405ec,0xc9))[_0x86d8('0x3b')](handleError(_0x5405ec,null));};exports[_0x86d8('0x1d')]=function(_0x54c25e,_0x56289){if(_0x54c25e['body']['id']){delete _0x54c25e[_0x86d8('0x45')]['id'];}return db[_0x86d8('0x38')][_0x86d8('0x43')]({'where':{'id':_0x54c25e[_0x86d8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x56289,null))['then'](saveUpdates(_0x54c25e[_0x86d8('0x45')],null))[_0x86d8('0x1f')](respondWithResult(_0x56289,null))[_0x86d8('0x3b')](handleError(_0x56289,null));};exports['destroy']=function(_0x34f830,_0x99fcb3){return db['WhatsappTransferReport'][_0x86d8('0x43')]({'where':{'id':_0x34f830[_0x86d8('0x3d')]['id']}})[_0x86d8('0x1f')](handleEntityNotFound(_0x99fcb3,null))['then'](removeEntity(_0x99fcb3,null))[_0x86d8('0x3b')](handleError(_0x99fcb3,null));};exports[_0x86d8('0x46')]=function(_0x1c11f4,_0x552164){return db['WhatsappTransferReport'][_0x86d8('0x46')]()[_0x86d8('0x1f')](respondWithResult(_0x552164,null))[_0x86d8('0x3b')](handleError(_0x552164,null));}; \ No newline at end of file +var _0x164f=['params','include','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','then','destroy','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0x164f,0x1c9));var _0xf164=function(_0x4b2f55,_0x12acd4){_0x4b2f55=_0x4b2f55-0x0;var _0x26cd17=_0x164f[_0x4b2f55];return _0x26cd17;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf164('0x0'));var rimraf=require(_0xf164('0x1'));var zipdir=require(_0xf164('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf164('0x3'));var moment=require(_0xf164('0x4'));var BPromise=require(_0xf164('0x5'));var Mustache=require('mustache');var util=require(_0xf164('0x6'));var path=require(_0xf164('0x7'));var sox=require(_0xf164('0x8'));var csv=require(_0xf164('0x9'));var ejs=require(_0xf164('0xa'));var fs=require('fs');var _=require(_0xf164('0xb'));var squel=require(_0xf164('0xc'));var crypto=require(_0xf164('0xd'));var jsforce=require(_0xf164('0xe'));var deskjs=require(_0xf164('0xf'));var toCsv=require(_0xf164('0x9'));var querystring=require(_0xf164('0x10'));var Papa=require(_0xf164('0x11'));var Redis=require(_0xf164('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf164('0x13'));var as=require(_0xf164('0x14'));var hardwareService=require(_0xf164('0x15'));var logger=require('../../config/logger')(_0xf164('0x16'));var utils=require(_0xf164('0x17'));var config=require(_0xf164('0x18'));var db=require(_0xf164('0x19'))['db'];function respondWithStatusCode(_0x208e84,_0xb168eb){_0xb168eb=_0xb168eb||0xcc;return function(_0x206d4f){if(_0x206d4f){return _0x208e84[_0xf164('0x1a')](_0xb168eb);}return _0x208e84['status'](_0xb168eb)[_0xf164('0x1b')]();};}function respondWithResult(_0x509c8b,_0x408796){_0x408796=_0x408796||0xc8;return function(_0x103b43){if(_0x103b43){return _0x509c8b['status'](_0x408796)[_0xf164('0x1c')](_0x103b43);}};}function respondWithFilteredResult(_0x5a40dc,_0xf8bd4a){return function(_0x1c5d97){if(_0x1c5d97){var _0x32599c=_0x1c5d97[_0xf164('0x1d')],_0x26c2f7=_0xf8bd4a[_0xf164('0x1e')],_0x10d088=_0xf8bd4a[_0xf164('0x1e')]+_0xf8bd4a[_0xf164('0x1f')],_0x15f6cf;if(_0x10d088>=_0x32599c){_0x10d088=_0x32599c;_0x15f6cf=0xc8;}else{_0x15f6cf=0xce;}_0x5a40dc[_0xf164('0x20')](_0x15f6cf);return _0x5a40dc['set'](_0xf164('0x21'),_0x26c2f7+'-'+_0x10d088+'/'+_0x32599c)[_0xf164('0x1c')](_0x1c5d97);}return null;};}function patchUpdates(_0x54b072){return function(_0x4aef04){try{jsonpatch['apply'](_0x4aef04,_0x54b072,!![]);}catch(_0x4079c1){return BPromise[_0xf164('0x22')](_0x4079c1);}return _0x4aef04[_0xf164('0x23')]();};}function saveUpdates(_0x40b114,_0x1027dc){return function(_0x22e979){if(_0x22e979){return _0x22e979['update'](_0x40b114)[_0xf164('0x24')](function(_0x56f828){return _0x56f828;});}return null;};}function removeEntity(_0x4e6814,_0x3a5cc5){return function(_0x1c5326){if(_0x1c5326){return _0x1c5326[_0xf164('0x25')]()[_0xf164('0x24')](function(){_0x4e6814[_0xf164('0x20')](0xcc)[_0xf164('0x1b')]();});}};}function handleEntityNotFound(_0x40591c,_0x5db86f){return function(_0x57e1e7){if(!_0x57e1e7){_0x40591c[_0xf164('0x1a')](0x194);}return _0x57e1e7;};}function handleError(_0xa16125,_0x4e70b4){_0x4e70b4=_0x4e70b4||0x1f4;return function(_0x1390d4){logger['error'](_0x1390d4['stack']);if(_0x1390d4[_0xf164('0x26')]){delete _0x1390d4['name'];}_0xa16125[_0xf164('0x20')](_0x4e70b4)[_0xf164('0x27')](_0x1390d4);};}exports[_0xf164('0x28')]=function(_0x55e1be,_0x1b156f){var _0x17b13a={},_0x68f8e2={},_0x2e3236={'count':0x0,'rows':[]};var _0x44d4c1=_[_0xf164('0x29')](db[_0xf164('0x2a')][_0xf164('0x2b')],function(_0x411180){return{'name':_0x411180[_0xf164('0x2c')],'type':_0x411180[_0xf164('0x2d')][_0xf164('0x2e')]};});_0x68f8e2[_0xf164('0x2f')]=_[_0xf164('0x29')](_0x44d4c1,_0xf164('0x26'));_0x68f8e2['query']=_[_0xf164('0x30')](_0x55e1be['query']);_0x68f8e2[_0xf164('0x31')]=_[_0xf164('0x32')](_0x68f8e2[_0xf164('0x2f')],_0x68f8e2['query']);_0x17b13a[_0xf164('0x33')]=_[_0xf164('0x32')](_0x68f8e2[_0xf164('0x2f')],qs['fields'](_0x55e1be[_0xf164('0x34')][_0xf164('0x35')]));_0x17b13a[_0xf164('0x33')]=_0x17b13a[_0xf164('0x33')][_0xf164('0x36')]?_0x17b13a[_0xf164('0x33')]:_0x68f8e2[_0xf164('0x2f')];if(!_0x55e1be[_0xf164('0x34')][_0xf164('0x37')](_0xf164('0x38'))){_0x17b13a[_0xf164('0x1f')]=qs[_0xf164('0x1f')](_0x55e1be['query'][_0xf164('0x1f')]);_0x17b13a[_0xf164('0x1e')]=qs['offset'](_0x55e1be['query'][_0xf164('0x1e')]);}_0x17b13a['order']=qs[_0xf164('0x39')](_0x55e1be['query'][_0xf164('0x39')]);_0x17b13a[_0xf164('0x3a')]=qs[_0xf164('0x31')](_[_0xf164('0x3b')](_0x55e1be[_0xf164('0x34')],_0x68f8e2[_0xf164('0x31')]),_0x44d4c1);if(_0x55e1be[_0xf164('0x34')][_0xf164('0x3c')]){_0x17b13a[_0xf164('0x3a')]=_[_0xf164('0x3d')](_0x17b13a['where'],{'$or':_['map'](_0x44d4c1,function(_0x2f4699){if(_0x2f4699[_0xf164('0x2d')]!==_0xf164('0x3e')){var _0x27d4a9={};_0x27d4a9[_0x2f4699[_0xf164('0x26')]]={'$like':'%'+_0x55e1be[_0xf164('0x34')][_0xf164('0x3c')]+'%'};return _0x27d4a9;}})});}_0x17b13a=_[_0xf164('0x3d')]({},_0x17b13a,_0x55e1be[_0xf164('0x3f')]);var _0x2e75a1={'where':_0x17b13a[_0xf164('0x3a')]};return db[_0xf164('0x2a')][_0xf164('0x1d')](_0x2e75a1)[_0xf164('0x24')](function(_0x56c76e){_0x2e3236[_0xf164('0x1d')]=_0x56c76e;if(_0x55e1be[_0xf164('0x34')][_0xf164('0x40')]){_0x17b13a['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x17b13a);})['then'](function(_0x54459b){_0x2e3236[_0xf164('0x41')]=_0x54459b;return _0x2e3236;})[_0xf164('0x24')](respondWithFilteredResult(_0x1b156f,_0x17b13a))[_0xf164('0x42')](handleError(_0x1b156f,null));};exports[_0xf164('0x43')]=function(_0x221b03,_0x32caec){var _0x341bea={'raw':!![],'where':{'id':_0x221b03[_0xf164('0x44')]['id']}},_0x21a14e={};_0x21a14e[_0xf164('0x2f')]=_[_0xf164('0x30')](db[_0xf164('0x2a')][_0xf164('0x2b')]);_0x21a14e[_0xf164('0x34')]=_[_0xf164('0x30')](_0x221b03[_0xf164('0x34')]);_0x21a14e['filters']=_[_0xf164('0x32')](_0x21a14e[_0xf164('0x2f')],_0x21a14e[_0xf164('0x34')]);_0x341bea['attributes']=_[_0xf164('0x32')](_0x21a14e[_0xf164('0x2f')],qs[_0xf164('0x35')](_0x221b03[_0xf164('0x34')][_0xf164('0x35')]));_0x341bea[_0xf164('0x33')]=_0x341bea[_0xf164('0x33')][_0xf164('0x36')]?_0x341bea[_0xf164('0x33')]:_0x21a14e[_0xf164('0x2f')];if(_0x221b03[_0xf164('0x34')][_0xf164('0x40')]){_0x341bea[_0xf164('0x45')]=[{'all':!![]}];}_0x341bea=_[_0xf164('0x3d')]({},_0x341bea,_0x221b03[_0xf164('0x3f')]);return db[_0xf164('0x2a')][_0xf164('0x46')](_0x341bea)['then'](handleEntityNotFound(_0x32caec,null))[_0xf164('0x24')](respondWithResult(_0x32caec,null))[_0xf164('0x42')](handleError(_0x32caec,null));};exports[_0xf164('0x47')]=function(_0x357fac,_0x595503){return db[_0xf164('0x2a')][_0xf164('0x47')](_0x357fac['body'],{})[_0xf164('0x24')](respondWithResult(_0x595503,0xc9))['catch'](handleError(_0x595503,null));};exports[_0xf164('0x48')]=function(_0x83dca3,_0x41df25){if(_0x83dca3[_0xf164('0x49')]['id']){delete _0x83dca3[_0xf164('0x49')]['id'];}return db[_0xf164('0x2a')][_0xf164('0x46')]({'where':{'id':_0x83dca3[_0xf164('0x44')]['id']}})[_0xf164('0x24')](handleEntityNotFound(_0x41df25,null))['then'](saveUpdates(_0x83dca3[_0xf164('0x49')],null))[_0xf164('0x24')](respondWithResult(_0x41df25,null))[_0xf164('0x42')](handleError(_0x41df25,null));};exports[_0xf164('0x25')]=function(_0x548899,_0x320cea){return db['WhatsappTransferReport'][_0xf164('0x46')]({'where':{'id':_0x548899[_0xf164('0x44')]['id']}})[_0xf164('0x24')](handleEntityNotFound(_0x320cea,null))['then'](removeEntity(_0x320cea,null))[_0xf164('0x42')](handleError(_0x320cea,null));};exports[_0xf164('0x4a')]=function(_0x2ee52b,_0x140029){return db['WhatsappTransferReport'][_0xf164('0x4a')]()[_0xf164('0x24')](respondWithResult(_0x140029,null))[_0xf164('0x42')](handleError(_0x140029,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 511e995..7fa88cd 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 _0x50e1=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0xb3b179,_0x578dbd){var _0x62abcd=function(_0x3004ae){while(--_0x3004ae){_0xb3b179['push'](_0xb3b179['shift']());}};_0x62abcd(++_0x578dbd);}(_0x50e1,0x15e));var _0x150e=function(_0x1b8901,_0x4a8d0c){_0x1b8901=_0x1b8901-0x0;var _0x1d14a5=_0x50e1[_0x1b8901];return _0x1d14a5;};'use strict';var _=require('lodash');var util=require(_0x150e('0x0'));var logger=require(_0x150e('0x1'))(_0x150e('0x2'));var moment=require('moment');var BPromise=require(_0x150e('0x3'));var rp=require(_0x150e('0x4'));var fs=require('fs');var path=require(_0x150e('0x5'));var rimraf=require(_0x150e('0x6'));var config=require(_0x150e('0x7'));var attributes=require(_0x150e('0x8'));module[_0x150e('0x9')]=function(_0x1c9ec1,_0x5d4625){return _0x1c9ec1[_0x150e('0xa')](_0x150e('0xb'),attributes,{'tableName':_0x150e('0xc'),'paranoid':![],'indexes':[{'name':_0x150e('0xd'),'fields':[_0x150e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe686=['../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bc93d,_0xf134ac){var _0x3a0afc=function(_0x5f210b){while(--_0x5f210b){_0x2bc93d['push'](_0x2bc93d['shift']());}};_0x3a0afc(++_0xf134ac);}(_0xe686,0x19e));var _0x6e68=function(_0x9f890f,_0x121cd8){_0x9f890f=_0x9f890f-0x0;var _0x397e1d=_0xe686[_0x9f890f];return _0x397e1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e68('0x0'))('api');var moment=require(_0x6e68('0x1'));var BPromise=require(_0x6e68('0x2'));var rp=require(_0x6e68('0x3'));var fs=require('fs');var path=require(_0x6e68('0x4'));var rimraf=require(_0x6e68('0x5'));var config=require(_0x6e68('0x6'));var attributes=require(_0x6e68('0x7'));module[_0x6e68('0x8')]=function(_0x1e21be,_0x3a0e11){return _0x1e21be[_0x6e68('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x6e68('0xa'),'paranoid':![],'indexes':[{'name':_0x6e68('0xb'),'fields':[_0x6e68('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f1d221b..c4bf873 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(_0x1cc708,_0x9fda0e){var _0x5c9769=function(_0x42c8e1){while(--_0x42c8e1){_0x1cc708['push'](_0x1cc708['shift']());}};_0x5c9769(++_0x9fda0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x5904f7,_0x2009ef){var _0xa11573=function(_0x12a271){while(--_0x12a271){_0x5904f7['push'](_0x5904f7['shift']());}};_0xa11573(++_0x2009ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 8427ccc..977dd87 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70dc=['status','seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:'];(function(_0xa3770d,_0x3bb3ec){var _0x1a2c6a=function(_0xefd8cf){while(--_0xefd8cf){_0xa3770d['push'](_0xa3770d['shift']());}};_0x1a2c6a(++_0x3bb3ec);}(_0x70dc,0x1b7));var _0xc70d=function(_0xc04fbd,_0x887b61){_0xc04fbd=_0xc04fbd-0x0;var _0x548fcb=_0x70dc[_0xc04fbd];return _0x548fcb;};'use strict';var _=require(_0xc70d('0x0'));var mysqldb=require(_0xc70d('0x1'));var rpc=require(_0xc70d('0x2'));var config=require(_0xc70d('0x3'));var logger=require(_0xc70d('0x4'))(_0xc70d('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xc70d('0x6'));var transcribe=require(_0xc70d('0x7'));function main(){return mysqldb['db'][_0xc70d('0x8')]['sync']()[_0xc70d('0x9')](function(){return rpc[_0xc70d('0xa')]();})[_0xc70d('0x9')](function(_0x14e575){logger[_0xc70d('0xb')](_0x14e575);return chat['start']();})[_0xc70d('0x9')](function(){return schedule[_0xc70d('0xc')]();})[_0xc70d('0x9')](function(){return transcribe[_0xc70d('0xc')]();})[_0xc70d('0x9')](function(_0x5a95c4){logger[_0xc70d('0xb')](_0x5a95c4);return pm2[_0xc70d('0xc')](pm2Config);})['then'](function(_0x27f042){logger[_0xc70d('0xb')](_0xc70d('0xd'),_[_0xc70d('0xe')](_[_0xc70d('0xf')](_0x27f042,{'status':_0xc70d('0x10')}),_0xc70d('0x11'))[_0xc70d('0x12')]());logger['info'](_0xc70d('0x13'),_[_0xc70d('0xe')](_[_0xc70d('0xf')](_0x27f042,function(_0x25100f){return _0x25100f[_0xc70d('0x14')]!=='online';}),_0xc70d('0x11'))[_0xc70d('0x12')]()||'None');config[_0xc70d('0x15')]&&require('./config/seedDB')[_0xc70d('0x16')]();require(_0xc70d('0x17'))[_0xc70d('0x16')]();})[_0xc70d('0x18')](function(_0x17f5ba){logger[_0xc70d('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x17f5ba);process[_0xc70d('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x08dd=['./config/seedDB','default','error','lodash','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','listen','info','then','start','map','filter','online','name','join','status','None','seedDB'];(function(_0x26a123,_0x3595d3){var _0x5d0d0a=function(_0x5463c5){while(--_0x5463c5){_0x26a123['push'](_0x26a123['shift']());}};_0x5d0d0a(++_0x3595d3);}(_0x08dd,0x80));var _0xd08d=function(_0x5c1356,_0x5a3c77){_0x5c1356=_0x5c1356-0x0;var _0x1fb00e=_0x08dd[_0x5c1356];return _0x1fb00e;};'use strict';var _=require(_0xd08d('0x0'));var mysqldb=require(_0xd08d('0x1'));var rpc=require(_0xd08d('0x2'));var config=require('./config/environment');var logger=require(_0xd08d('0x3'))('app');var pm2=require(_0xd08d('0x4'));var pm2Config=require(_0xd08d('0x5'));var schedule=require(_0xd08d('0x6'));var chat=require(_0xd08d('0x7'));var transcribe=require(_0xd08d('0x8'));function main(){return mysqldb['db']['sequelize'][_0xd08d('0x9')]()['then'](function(){return rpc[_0xd08d('0xa')]();})['then'](function(_0x58bb1c){logger[_0xd08d('0xb')](_0x58bb1c);return chat['start']();})[_0xd08d('0xc')](function(){return schedule[_0xd08d('0xd')]();})['then'](function(){return transcribe['start']();})[_0xd08d('0xc')](function(_0x2d5df4){logger[_0xd08d('0xb')](_0x2d5df4);return pm2[_0xd08d('0xd')](pm2Config);})[_0xd08d('0xc')](function(_0x118067){logger[_0xd08d('0xb')]('Online\x20apps:',_[_0xd08d('0xe')](_[_0xd08d('0xf')](_0x118067,{'status':_0xd08d('0x10')}),_0xd08d('0x11'))[_0xd08d('0x12')]());logger['info']('Offline\x20apps:',_[_0xd08d('0xe')](_[_0xd08d('0xf')](_0x118067,function(_0x553708){return _0x553708[_0xd08d('0x13')]!==_0xd08d('0x10');}),'name')[_0xd08d('0x12')]()||_0xd08d('0x14'));config[_0xd08d('0x15')]&&require(_0xd08d('0x16'))[_0xd08d('0x17')]();require('./config/license')[_0xd08d('0x17')]();})['catch'](function(_0x29a0ea){logger[_0xd08d('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x29a0ea);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c15e2e7..c3057da 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 _0x8477=['Basic','then','authenticate','pass','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','apiKeyNonce','Invalid\x20API\x20access\x20key','find','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','secrets','session','name','userpic','permissions','md5secret','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','closed','status','unmanaged','json','Unmanaged.','catch','headers','authorization'];(function(_0x1f3591,_0x5688f1){var _0x2339f1=function(_0x2f6460){while(--_0x2f6460){_0x1f3591['push'](_0x1f3591['shift']());}};_0x2339f1(++_0x5688f1);}(_0x8477,0x8a));var _0x7847=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x8477[_0x4fa291];return _0x506d9b;};'use strict';var db=require(_0x7847('0x0'))['db'];var config=require(_0x7847('0x1'));var hardwareConf=require(_0x7847('0x2'));var _=require(_0x7847('0x3'));var jwt=require(_0x7847('0x4'));var expressJwt=require(_0x7847('0x5'));var compose=require(_0x7847('0x6'));var basicAuth=require(_0x7847('0x7'));var crypto=require(_0x7847('0x8'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0x7847('0x9')][_0x7847('0xa')]});var userAttributes=['id','role','fullname',_0x7847('0xb'),'internal','email',_0x7847('0xc'),_0x7847('0xd'),_0x7847('0xe'),'voicePause','chatPause',_0x7847('0xf'),'faxPause',_0x7847('0x10'),_0x7847('0x11'),'pauseType',_0x7847('0x12'),_0x7847('0x13'),_0x7847('0x14'),_0x7847('0x15'),'allowmessenger','passwordResetAt',_0x7847('0x16'),'phoneBarAutoAnswer',_0x7847('0x17'),'phoneBarDnd',_0x7847('0x18'),_0x7847('0x19'),_0x7847('0x1a'),_0x7847('0x1b'),_0x7847('0x1c'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x7847('0x1d'),_0x7847('0x1e'),_0x7847('0x1f')];exports[_0x7847('0x20')]=function(){return this[_0x7847('0x21')](!![])[_0x7847('0x22')](function(_0x369ced,_0x4d0245,_0x18c388){if(_0x369ced[_0x7847('0x23')]){_0x18c388();}else{return db[_0x7847('0x24')][_0x7847('0x25')]({'where':{'id':_0x369ced[_0x7847('0x26')]['id']},'attributes':['id','closed',_0x7847('0x27')],'raw':!![]})['then'](function(_0x5275cc){if(_0x5275cc&&_0x5275cc[_0x7847('0x28')]){return _0x4d0245[_0x7847('0x29')](_0x5275cc[_0x7847('0x27')]===_0x7847('0x2a')?0x195:0x193)[_0x7847('0x2b')]({'message':_0x5275cc[_0x7847('0x27')]===_0x7847('0x2a')?_0x7847('0x2c'):'Forbidden.'});}else{_0x18c388();}})[_0x7847('0x2d')](function(_0xef5e97){_0x18c388(_0xef5e97);});}});};exports[_0x7847('0x21')]=function isAuthenticated(_0x563624){return compose()['use'](function(_0x572d9a,_0x9ce321,_0x5e9019){if(_0x572d9a[_0x7847('0x2e')][_0x7847('0x2f')]){if(_['startsWith'](_0x572d9a[_0x7847('0x2e')][_0x7847('0x2f')],_0x7847('0x30'))){var _0x4e61aa=basicAuth(_0x572d9a);db['User']['find']({'where':{'name':_0x4e61aa[_0x7847('0xb')]}})[_0x7847('0x31')](function(_0x34b307){if(!_0x34b307||!_0x34b307[_0x7847('0x32')](_0x4e61aa[_0x7847('0x33')])){return _0x9ce321[_0x7847('0x29')](0x191)[_0x7847('0x2b')]({'message':'Wrong\x20credentials.'});}_0x572d9a['user']={'id':_0x34b307['id']};_0x5e9019();})[_0x7847('0x2d')](function(_0xe54920){_0x5e9019(_0xe54920);});}else if(_[_0x7847('0x34')](_0x572d9a[_0x7847('0x2e')][_0x7847('0x2f')],_0x7847('0x35'))){validateJwt(_0x572d9a,_0x9ce321,_0x5e9019);}else{if(_0x563624){_0x5e9019();}else{return _0x9ce321[_0x7847('0x29')](0x193)['json']({'message':_0x7847('0x36')});}}}else if(_0x572d9a[_0x7847('0x37')][_0x7847('0x38')]){try{var _0x3446cd={'audience':hardwareConf[_0x7847('0x39')](),'issuer':hardwareConf[_0x7847('0x39')]()};verifyJwt(_0x572d9a[_0x7847('0x37')][_0x7847('0x38')],_0x3446cd)[_0x7847('0x31')](function(_0x882a40){return db[_0x7847('0x3a')]['find']({'where':{'id':_0x882a40[_0x7847('0x3b')]}})[_0x7847('0x31')](function(_0x32625e){if(!_0x32625e||!_['isEqual'](_0x32625e[_0x7847('0x3c')],_0x882a40['nonce'])){return _0x9ce321['status'](0x191)[_0x7847('0x2b')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x572d9a['user']={'id':_0x32625e['id']};_0x5e9019();});})[_0x7847('0x2d')](function(){return _0x9ce321['status'](0x191)[_0x7847('0x2b')]({'message':_0x7847('0x3d')});});}catch(_0x3dc1a2){_0x5e9019(_0x3dc1a2);}}else if(_0x563624){_0x5e9019();}else{return _0x9ce321[_0x7847('0x29')](0x193)[_0x7847('0x2b')]({'message':_0x7847('0x36')});}})['use'](function(_0xd60e9b,_0x5147c8,_0x23ae01){if(_0xd60e9b[_0x7847('0x23')]){db[_0x7847('0x3a')][_0x7847('0x3e')]({'where':{'id':_0xd60e9b[_0x7847('0x23')]['id']},'attributes':userAttributes})['then'](function(_0xab37d4){if(!_0xab37d4){return _0x5147c8[_0x7847('0x29')](0x194)['json']({'message':'User\x20not\x20found.'});}_0xd60e9b[_0x7847('0x23')]=_0xab37d4;_0x23ae01();})[_0x7847('0x2d')](function(_0x150901){_0x23ae01(_0x150901);});}else if(_0x563624){_0x23ae01();}else{return _0x5147c8[_0x7847('0x29')](0x194)[_0x7847('0x2b')]({'message':_0x7847('0x3f')});}});};exports[_0x7847('0x40')]=function canUpdate(){return compose()[_0x7847('0x22')](function(_0x666a36,_0x4cdb28,_0x5cfbaf){return require('../../config/license/util')[_0x7847('0x41')]()['then'](function(_0xa9aae2){if(_0xa9aae2[_0x7847('0x42')]){_0x5cfbaf();}else{return _0x4cdb28[_0x7847('0x29')](0x193)['json']({'message':_0x7847('0x43')});}})[_0x7847('0x2d')](function(_0x1fecc7){_0x5cfbaf(_0x1fecc7);});});};exports[_0x7847('0x44')]=function(_0x37079b,_0x40c268,_0x3acf89){_0x37079b[_0x7847('0x44')]=!![];return _0x3acf89();};exports[_0x7847('0x45')]=function signToken(_0x41cc56){return signJwt(_0x41cc56);};exports[_0x7847('0x46')]=function(_0x2b7e09,_0x3755c0){if(!_0x2b7e09[_0x7847('0x23')]){return _0x3755c0['status'](0x194)[_0x7847('0x2b')]({'message':_0x7847('0x47')});}var _0x443578={'payload':{'id':_0x2b7e09[_0x7847('0x23')]['id'],'role':_0x2b7e09[_0x7847('0x23')][_0x7847('0x48')]},'options':{'expiresIn':0x15180}};return signJwt(_0x443578)[_0x7847('0x31')](function(_0x326726){_0x3755c0[_0x7847('0x49')]('motion.token',_0x326726);_0x3755c0['redirect'](_0x7847('0x4a'));})[_0x7847('0x2d')](function(_0x58e9f7){return _0x3755c0[_0x7847('0x29')](0x1f4)[_0x7847('0x4b')](_0x58e9f7);});};exports[_0x7847('0x4c')]=function(_0x32d19e){if(_[_0x7847('0x4d')](_0x32d19e['apiKeyNonce'])||_[_0x7847('0x4d')](_0x32d19e[_0x7847('0x4e')])){return null;}else{return createJwt(_0x32d19e);}};exports[_0x7847('0x4f')]=function(_0x5ba001){_0x5ba001['apiKeyNonce']=generateNonce();_0x5ba001[_0x7847('0x4e')]=generateIssuedAt();return createJwt(_0x5ba001);};exports[_0x7847('0x50')]=function(_0x9f9c94,_0x2ec232){var _0x38d0c3=_0x9f9c94[_0x7847('0x37')][_0x7847('0x38')];if(_0x38d0c3){var _0x4b43ac={'nonce':_0x2ec232[_0x7847('0x3c')],'iat':_0x2ec232['apiKeyIat'],'audience':hardwareConf[_0x7847('0x39')](),'issuer':hardwareConf[_0x7847('0x39')]()};return verifyJwt(_0x38d0c3,_0x4b43ac)[_0x7847('0x31')](function(){return generateApiKey(_0x2ec232);});}else{throw{'message':_0x7847('0x51')};}};function signJwt(_0x1b417a){var _0x79d4cc=BPromise[_0x7847('0x52')](jwt[_0x7847('0x53')],{'context':jwt});var _0x4e3db6=_0x1b417a[_0x7847('0x54')]||config[_0x7847('0x9')][_0x7847('0xa')];return new BPromise(function(_0x4b6045,_0x26a409){_0x79d4cc(_0x1b417a[_0x7847('0x55')],_0x4e3db6,_0x1b417a[_0x7847('0x56')])[_0x7847('0x31')](function(_0x321301){_0x4b6045(_0x321301);})[_0x7847('0x2d')](function(_0x537323){_0x26a409(_0x537323);});});}function verifyJwt(_0x147b52,_0x24189d,_0x2a6537){var _0x32bfdc=BPromise[_0x7847('0x52')](jwt[_0x7847('0x57')],{'context':jwt});var _0x321a85=_0x2a6537||config[_0x7847('0x9')]['session'];return new BPromise(function(_0x500a91,_0xf67d27){_0x32bfdc(_0x147b52,_0x321a85,_0x24189d)[_0x7847('0x31')](function(_0x231841){_0x500a91(_0x231841);})[_0x7847('0x2d')](function(_0x5be06c){_0xf67d27(_0x5be06c);});});}function generateNonce(){return crypto[_0x7847('0x58')](0x10)[_0x7847('0x59')](_0x7847('0x5a'));}function generateIssuedAt(){return Math[_0x7847('0x5b')](Date[_0x7847('0x5c')]()/0x3e8)['toString']();}function createJwt(_0x4952a2){var _0xf54a7c={'payload':{'iat':_0x4952a2[_0x7847('0x4e')],'nonce':_0x4952a2['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x4952a2['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x7847('0x39')]()}};return signJwt(_0xf54a7c)[_0x7847('0x31')](function(_0x3824d3){return{'iat':_0x4952a2[_0x7847('0x4e')],'nonce':_0x4952a2[_0x7847('0x3c')],'token':_0x3824d3};});} \ No newline at end of file +var _0x90f8=['faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','isChatInteractionAuthorized','isAuthenticated','use','findOne','params','closed','disposition','status','json','unmanaged','Forbidden.','catch','authorization','startsWith','headers','Basic','User','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','find','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','promisify','secret','session','payload','options','randomBytes','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','secrets','role','name','internal','email','permissions','voicePause'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x90f8,0x168));var _0x890f=function(_0x473cbb,_0x42203a){_0x473cbb=_0x473cbb-0x0;var _0x4b5d5e=_0x90f8[_0x473cbb];return _0x4b5d5e;};'use strict';var db=require(_0x890f('0x0'))['db'];var config=require(_0x890f('0x1'));var hardwareConf=require(_0x890f('0x2'));var _=require(_0x890f('0x3'));var jwt=require(_0x890f('0x4'));var expressJwt=require(_0x890f('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x890f('0x6'));var crypto=require(_0x890f('0x7'));var BPromise=require(_0x890f('0x8'));var validateJwt=expressJwt({'secret':config[_0x890f('0x9')]['session']});var userAttributes=['id',_0x890f('0xa'),'fullname',_0x890f('0xb'),_0x890f('0xc'),_0x890f('0xd'),'userpic',_0x890f('0xe'),'md5secret',_0x890f('0xf'),'chatPause','mailPause',_0x890f('0x10'),_0x890f('0x11'),_0x890f('0x12'),_0x890f('0x13'),_0x890f('0x14'),_0x890f('0x15'),_0x890f('0x16'),_0x890f('0x17'),_0x890f('0x18'),_0x890f('0x19'),'alias',_0x890f('0x1a'),'phoneBarAutoAnswerDelay',_0x890f('0x1b'),_0x890f('0x1c'),_0x890f('0x1d'),_0x890f('0x1e'),_0x890f('0x1f'),_0x890f('0x20'),_0x890f('0x21'),_0x890f('0x22'),_0x890f('0x23'),'interface','userProfileId'];exports[_0x890f('0x24')]=function(){return this[_0x890f('0x25')](!![])[_0x890f('0x26')](function(_0x2eb5e2,_0x3747fa,_0x434d30){if(_0x2eb5e2['user']){_0x434d30();}else{return db['ChatInteraction'][_0x890f('0x27')]({'where':{'id':_0x2eb5e2[_0x890f('0x28')]['id']},'attributes':['id',_0x890f('0x29'),_0x890f('0x2a')],'raw':!![]})['then'](function(_0x59784f){if(_0x59784f&&_0x59784f[_0x890f('0x29')]){return _0x3747fa[_0x890f('0x2b')](_0x59784f[_0x890f('0x2a')]==='unmanaged'?0x195:0x193)[_0x890f('0x2c')]({'message':_0x59784f[_0x890f('0x2a')]===_0x890f('0x2d')?'Unmanaged.':_0x890f('0x2e')});}else{_0x434d30();}})[_0x890f('0x2f')](function(_0xf74ae2){_0x434d30(_0xf74ae2);});}});};exports[_0x890f('0x25')]=function isAuthenticated(_0x4545c0){return compose()[_0x890f('0x26')](function(_0x42efdd,_0x321c23,_0x5ad852){if(_0x42efdd['headers'][_0x890f('0x30')]){if(_[_0x890f('0x31')](_0x42efdd[_0x890f('0x32')][_0x890f('0x30')],_0x890f('0x33'))){var _0x36d8cf=basicAuth(_0x42efdd);db[_0x890f('0x34')]['find']({'where':{'name':_0x36d8cf[_0x890f('0xb')]}})['then'](function(_0x4829f0){if(!_0x4829f0||!_0x4829f0['authenticate'](_0x36d8cf[_0x890f('0x35')])){return _0x321c23[_0x890f('0x2b')](0x191)[_0x890f('0x2c')]({'message':_0x890f('0x36')});}_0x42efdd[_0x890f('0x37')]={'id':_0x4829f0['id']};_0x5ad852();})[_0x890f('0x2f')](function(_0x417b0a){_0x5ad852(_0x417b0a);});}else if(_[_0x890f('0x31')](_0x42efdd[_0x890f('0x32')][_0x890f('0x30')],_0x890f('0x38'))){validateJwt(_0x42efdd,_0x321c23,_0x5ad852);}else{if(_0x4545c0){_0x5ad852();}else{return _0x321c23['status'](0x193)[_0x890f('0x2c')]({'message':_0x890f('0x39')});}}}else if(_0x42efdd[_0x890f('0x3a')][_0x890f('0x3b')]){try{var _0x514df0={'audience':hardwareConf[_0x890f('0x3c')](),'issuer':hardwareConf[_0x890f('0x3c')]()};verifyJwt(_0x42efdd[_0x890f('0x3a')][_0x890f('0x3b')],_0x514df0)[_0x890f('0x3d')](function(_0x58c4aa){return db[_0x890f('0x34')]['find']({'where':{'id':_0x58c4aa[_0x890f('0x3e')]}})[_0x890f('0x3d')](function(_0x4e80d6){if(!_0x4e80d6||!_[_0x890f('0x3f')](_0x4e80d6['apiKeyNonce'],_0x58c4aa[_0x890f('0x40')])){return _0x321c23[_0x890f('0x2b')](0x191)[_0x890f('0x2c')]({'message':_0x890f('0x41')});}_0x42efdd['user']={'id':_0x4e80d6['id']};_0x5ad852();});})[_0x890f('0x2f')](function(){return _0x321c23[_0x890f('0x2b')](0x191)[_0x890f('0x2c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x49f146){_0x5ad852(_0x49f146);}}else if(_0x4545c0){_0x5ad852();}else{return _0x321c23[_0x890f('0x2b')](0x193)[_0x890f('0x2c')]({'message':_0x890f('0x39')});}})[_0x890f('0x26')](function(_0x144694,_0x3a6f14,_0x5031b4){if(_0x144694['user']){db[_0x890f('0x34')][_0x890f('0x42')]({'where':{'id':_0x144694[_0x890f('0x37')]['id']},'attributes':userAttributes})[_0x890f('0x3d')](function(_0x56b71c){if(!_0x56b71c){return _0x3a6f14['status'](0x194)['json']({'message':_0x890f('0x43')});}_0x144694[_0x890f('0x37')]=_0x56b71c;_0x5031b4();})[_0x890f('0x2f')](function(_0x774f22){_0x5031b4(_0x774f22);});}else if(_0x4545c0){_0x5031b4();}else{return _0x3a6f14[_0x890f('0x2b')](0x194)[_0x890f('0x2c')]({'message':_0x890f('0x44')});}});};exports[_0x890f('0x45')]=function canUpdate(){return compose()[_0x890f('0x26')](function(_0x280b04,_0x80ab64,_0x4f9ee0){return require(_0x890f('0x46'))[_0x890f('0x47')]()[_0x890f('0x3d')](function(_0x52e00f){if(_0x52e00f[_0x890f('0x48')]){_0x4f9ee0();}else{return _0x80ab64[_0x890f('0x2b')](0x193)[_0x890f('0x2c')]({'message':_0x890f('0x49')});}})['catch'](function(_0x1b60e2){_0x4f9ee0(_0x1b60e2);});});};exports[_0x890f('0x4a')]=function(_0x4ff991,_0x360bf6,_0x1263d7){_0x4ff991[_0x890f('0x4a')]=!![];return _0x1263d7();};exports[_0x890f('0x4b')]=function signToken(_0x589d9f){return signJwt(_0x589d9f);};exports['setTokenCookie']=function(_0x42378c,_0x3d1379){if(!_0x42378c[_0x890f('0x37')]){return _0x3d1379[_0x890f('0x2b')](0x194)[_0x890f('0x2c')]({'message':_0x890f('0x4c')});}var _0x4ffc53={'payload':{'id':_0x42378c[_0x890f('0x37')]['id'],'role':_0x42378c[_0x890f('0x37')][_0x890f('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4ffc53)['then'](function(_0x5ab5bd){_0x3d1379['cookie'](_0x890f('0x4d'),_0x5ab5bd);_0x3d1379['redirect']('/dashboards/general');})[_0x890f('0x2f')](function(_0x4cf797){return _0x3d1379['status'](0x1f4)[_0x890f('0x4e')](_0x4cf797);});};exports[_0x890f('0x4f')]=function(_0x43fb32){if(_[_0x890f('0x50')](_0x43fb32['apiKeyNonce'])||_[_0x890f('0x50')](_0x43fb32[_0x890f('0x51')])){return null;}else{return createJwt(_0x43fb32);}};exports[_0x890f('0x52')]=function(_0x504404){_0x504404[_0x890f('0x53')]=generateNonce();_0x504404[_0x890f('0x51')]=generateIssuedAt();return createJwt(_0x504404);};exports[_0x890f('0x54')]=function(_0x1e4c78,_0x592af8){var _0x48b3cc=_0x1e4c78[_0x890f('0x3a')][_0x890f('0x3b')];if(_0x48b3cc){var _0x437b22={'nonce':_0x592af8['apiKeyNonce'],'iat':_0x592af8['apiKeyIat'],'audience':hardwareConf[_0x890f('0x3c')](),'issuer':hardwareConf[_0x890f('0x3c')]()};return verifyJwt(_0x48b3cc,_0x437b22)[_0x890f('0x3d')](function(){return generateApiKey(_0x592af8);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0xd5fd1f){var _0x21c627=BPromise[_0x890f('0x55')](jwt['sign'],{'context':jwt});var _0xfce507=_0xd5fd1f[_0x890f('0x56')]||config[_0x890f('0x9')][_0x890f('0x57')];return new BPromise(function(_0x35f7c4,_0x55fe48){_0x21c627(_0xd5fd1f[_0x890f('0x58')],_0xfce507,_0xd5fd1f[_0x890f('0x59')])[_0x890f('0x3d')](function(_0x204b88){_0x35f7c4(_0x204b88);})[_0x890f('0x2f')](function(_0x2ba0d6){_0x55fe48(_0x2ba0d6);});});}function verifyJwt(_0x34e8fd,_0x2bb6c4,_0x3fbe21){var _0x23d7f4=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x11e908=_0x3fbe21||config['secrets'][_0x890f('0x57')];return new BPromise(function(_0x21cd6a,_0x1b5fdf){_0x23d7f4(_0x34e8fd,_0x11e908,_0x2bb6c4)[_0x890f('0x3d')](function(_0x246dbe){_0x21cd6a(_0x246dbe);})[_0x890f('0x2f')](function(_0x12d0d5){_0x1b5fdf(_0x12d0d5);});});}function generateNonce(){return crypto[_0x890f('0x5a')](0x10)[_0x890f('0x5b')](_0x890f('0x5c'));}function generateIssuedAt(){return Math[_0x890f('0x5d')](Date['now']()/0x3e8)[_0x890f('0x5b')]();}function createJwt(_0x4cbde5){var _0x3ed6f7={'payload':{'iat':_0x4cbde5[_0x890f('0x51')],'nonce':_0x4cbde5[_0x890f('0x53')]},'options':{'algorithm':'HS512','subject':_0x4cbde5['id'][_0x890f('0x5b')](),'issuer':hardwareConf[_0x890f('0x3c')](),'audience':hardwareConf[_0x890f('0x3c')]()}};return signJwt(_0x3ed6f7)[_0x890f('0x3d')](function(_0x5ba9b0){return{'iat':_0x4cbde5[_0x890f('0x51')],'nonce':_0x4cbde5['apiKeyNonce'],'token':_0x5ba9b0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e0efd22..327d7fc 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x7f7800,_0x3539e4){var _0x13b08b=function(_0x4b3340){while(--_0x4b3340){_0x7f7800['push'](_0x7f7800['shift']());}};_0x13b08b(++_0x3539e4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file +var _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x49cc18,_0x5260f1){var _0x594f28=function(_0x4eff2f){while(--_0x4eff2f){_0x49cc18['push'](_0x49cc18['shift']());}};_0x594f28(++_0x5260f1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xcb91[_0x45bf86];return _0x1f02b7;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c32a44c..9a76efa 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 _0x4522=['Setting','find','split','splitSizeCsv','then','format','sequelize','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','mkdirSync','join','each','csv','writeFileSync','Completed','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4522,0x1a0));var _0x2452=function(_0x29863,_0x13a7e7){_0x29863=_0x29863-0x0;var _0x530d8e=_0x4522[_0x29863];return _0x530d8e;};'use strict';var util=require('util');var path=require('path');var _=require(_0x2452('0x0'));var csv=require(_0x2452('0x1'));var fs=require('fs');var BPromise=require(_0x2452('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x2452('0x3'));var db=require(_0x2452('0x4'))['db'];var dbH=require(_0x2452('0x4'))[_0x2452('0x5')];var logger=require(_0x2452('0x6'))(_0x2452('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2452('0x8')][0x2]);var QUERY=process[_0x2452('0x8')][0x3];var PATH=process[_0x2452('0x8')][0x4];function analyticExtractedReport(_0x149807,_0x3bc193){var _0x33b935={'status':_0x149807};var _0x24073f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bc193){_0x33b935[_0x2452('0x9')]=_0x3bc193;}return db[_0x2452('0xa')][_0x2452('0xb')](_0x33b935,_0x24073f);}function main(){var _0x5a38e0=0x1388;var _0x5dc630;logger[_0x2452('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2452('0xd')));return db[_0x2452('0xe')][_0x2452('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2452('0x10'),_0x2452('0x11')]})[_0x2452('0x12')](function(_0x2c1e0f){if(_0x2c1e0f){_0x5dc630=_0x2c1e0f;_0x5a38e0=_0x5dc630[_0x2452('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x2452('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2452('0x14')]['QueryTypes'][_0x2452('0x15')]});})[_0x2452('0x12')](function(_0x5d0438){if(!_0x5d0438[0x0][_0x2452('0x16')]){return analyticExtractedReport('Empty');}var _0x3dd8cc=[];var _0x734b88=0x0;var _0x461d2b=!![];if(_0x5d0438&&_0x5d0438[_0x2452('0x17')]){var _0x4e1d20=_0x5d0438[0x0][_0x2452('0x16')]%(_0x734b88+_0x5a38e0);if(_0x5dc630[_0x2452('0x10')]){for(;_0x461d2b;_0x734b88+=_0x5a38e0,_0x4e1d20=_0x5d0438[0x0]['num']%(_0x734b88+_0x5a38e0)){if(_0x4e1d20==0x0||_0x4e1d20==_0x5d0438[0x0]['num']){_0x461d2b=![];}_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](util['format'](_0x2452('0x1a'),QUERY,_0x5a38e0,_0x734b88),{'type':dbH[_0x2452('0x14')][_0x2452('0x1b')][_0x2452('0x15')]}));}}else{_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](QUERY,{'type':dbH[_0x2452('0x14')]['QueryTypes']['SELECT']}));}}var _0x1f060d=path[_0x2452('0x1c')](PATH);var _0x4bb3ff=path[_0x2452('0x1d')](PATH,_0x2452('0x1e'));var _0x1d5720=_0x5dc630[_0x2452('0x10')]&&_0x3dd8cc[_0x2452('0x17')]>0x1;var _0x397f21=[];if(!fs[_0x2452('0x1f')](path['join'](_0x1f060d,_0x4bb3ff))&&_0x1d5720){fs[_0x2452('0x20')](path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff));}return BPromise[_0x2452('0x22')](_0x3dd8cc,function(_0x231410){_0x397f21[_0x2452('0x18')](_0x231410);})['then'](function(){for(var _0x48783a=0x0;_0x48783a<_0x397f21[_0x2452('0x17')];_0x48783a+=0x1){var _0x159ba1;var _0x46fcbb=_0x397f21[_0x48783a];if(_0x1d5720){_0x159ba1=path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff,util[_0x2452('0x13')]('%s%d.%s',_0x4bb3ff,_0x48783a,_0x2452('0x23')));}else{_0x159ba1=path[_0x2452('0x21')](_0x1f060d,util['format']('%s.%s',_0x4bb3ff,_0x2452('0x23')));}fs[_0x2452('0x24')](_0x159ba1,csv(_0x46fcbb));}})[_0x2452('0x12')](function(){if(_0x1d5720){zipdir(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),{'saveTo':path[_0x2452('0x21')](_0x1f060d,util[_0x2452('0x13')]('%s.%s',_0x4bb3ff,'zip'))},function(_0x46b611,_0x454e0a){});rimraf(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),function(){});}})['then'](function(){logger[_0x2452('0xc')](util[_0x2452('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2452('0xd')));return analyticExtractedReport(_0x2452('0x25'),_0x1d5720?util[_0x2452('0x13')](_0x2452('0x26'),_0x4bb3ff,_0x1d5720?_0x2452('0x27'):_0x2452('0x23')):null);});})[_0x2452('0x28')](function(_0x115e09){logger[_0x2452('0xc')](util[_0x2452('0x13')](_0x2452('0x29'),EXTRACTED_REPORT_ID,_0x2452('0xd')),util[_0x2452('0x2a')](_0x115e09,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xe14d=['.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename'];(function(_0x59659d,_0xb17019){var _0x2adbb5=function(_0x22ea94){while(--_0x22ea94){_0x59659d['push'](_0x59659d['shift']());}};_0x2adbb5(++_0xb17019);}(_0xe14d,0x1ee));var _0xde14=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe14d[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xde14('0x0'));var path=require(_0xde14('0x1'));var _=require(_0xde14('0x2'));var csv=require(_0xde14('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xde14('0x4'));var rimraf=require(_0xde14('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xde14('0x6'))[_0xde14('0x7')];var logger=require(_0xde14('0x8'))(_0xde14('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xde14('0xa')][0x2]);var QUERY=process[_0xde14('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x5a1344,_0x1bd49d){var _0x115b7d={'status':_0x5a1344};var _0x2b0e7c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1bd49d){_0x115b7d[_0xde14('0xb')]=_0x1bd49d;}return db[_0xde14('0xc')][_0xde14('0xd')](_0x115b7d,_0x2b0e7c);}function main(){var _0xa17e8=0x1388;var _0x1ce0a2;logger['info'](util[_0xde14('0xe')](_0xde14('0xf'),EXTRACTED_REPORT_ID,_0xde14('0x10')));return db[_0xde14('0x11')][_0xde14('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xde14('0x13'),_0xde14('0x14')]})[_0xde14('0x15')](function(_0x34e28f){if(_0x34e28f){_0x1ce0a2=_0x34e28f;_0xa17e8=_0x1ce0a2[_0xde14('0x14')]||0x1388;}})[_0xde14('0x15')](function(){return dbH[_0xde14('0x16')][_0xde14('0x17')](util[_0xde14('0xe')](_0xde14('0x18'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xde14('0x19')]});})[_0xde14('0x15')](function(_0x26c1ec){if(!_0x26c1ec[0x0]['num']){return analyticExtractedReport(_0xde14('0x1a'));}var _0x31adb3=[];var _0x257390=0x0;var _0x31902a=!![];if(_0x26c1ec&&_0x26c1ec[_0xde14('0x1b')]){var _0x1b9d4b=_0x26c1ec[0x0][_0xde14('0x1c')]%(_0x257390+_0xa17e8);if(_0x1ce0a2[_0xde14('0x13')]){for(;_0x31902a;_0x257390+=_0xa17e8,_0x1b9d4b=_0x26c1ec[0x0][_0xde14('0x1c')]%(_0x257390+_0xa17e8)){if(_0x1b9d4b==0x0||_0x1b9d4b==_0x26c1ec[0x0][_0xde14('0x1c')]){_0x31902a=![];}_0x31adb3['push'](dbH[_0xde14('0x16')][_0xde14('0x17')](util[_0xde14('0xe')](_0xde14('0x1d'),QUERY,_0xa17e8,_0x257390),{'type':dbH['sequelize'][_0xde14('0x1e')]['SELECT']}));}}else{_0x31adb3[_0xde14('0x1f')](dbH['sequelize'][_0xde14('0x17')](QUERY,{'type':dbH[_0xde14('0x16')][_0xde14('0x1e')][_0xde14('0x19')]}));}}var _0x39bdc5=path[_0xde14('0x20')](PATH);var _0x40b648=path[_0xde14('0x21')](PATH,_0xde14('0x22'));var _0x163b79=_0x1ce0a2[_0xde14('0x13')]&&_0x31adb3[_0xde14('0x1b')]>0x1;var _0x8f8033=[];if(!fs['existsSync'](path[_0xde14('0x23')](_0x39bdc5,_0x40b648))&&_0x163b79){fs[_0xde14('0x24')](path[_0xde14('0x23')](_0x39bdc5,_0x40b648));}return BPromise[_0xde14('0x25')](_0x31adb3,function(_0x1bb7be){_0x8f8033[_0xde14('0x1f')](_0x1bb7be);})[_0xde14('0x15')](function(){for(var _0x23c735=0x0;_0x23c735<_0x8f8033[_0xde14('0x1b')];_0x23c735+=0x1){var _0x350a78;var _0x4eff65=_0x8f8033[_0x23c735];if(_0x163b79){_0x350a78=path[_0xde14('0x23')](_0x39bdc5,_0x40b648,util[_0xde14('0xe')](_0xde14('0x26'),_0x40b648,_0x23c735,_0xde14('0x27')));}else{_0x350a78=path['join'](_0x39bdc5,util[_0xde14('0xe')](_0xde14('0x28'),_0x40b648,_0xde14('0x27')));}fs['writeFileSync'](_0x350a78,csv(_0x4eff65));}})[_0xde14('0x15')](function(){if(_0x163b79){zipdir(path['join'](_0x39bdc5,_0x40b648),{'saveTo':path[_0xde14('0x23')](_0x39bdc5,util[_0xde14('0xe')](_0xde14('0x28'),_0x40b648,_0xde14('0x29')))},function(_0x2aca96,_0x237d3f){});rimraf(path[_0xde14('0x23')](_0x39bdc5,_0x40b648),function(){});}})[_0xde14('0x15')](function(){logger['info'](util[_0xde14('0xe')](_0xde14('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xde14('0x2b'),_0x163b79?util['format'](_0xde14('0x28'),_0x40b648,_0x163b79?_0xde14('0x29'):_0xde14('0x27')):null);});})[_0xde14('0x2c')](function(_0x13c164){logger['info'](util[_0xde14('0xe')](_0xde14('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0xde14('0x2e')](_0x13c164,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xde14('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b8e0cdb..6615260 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(_0x4a298f,_0x3edefc){var _0x1703c1=function(_0x483d57){while(--_0x483d57){_0x4a298f['push'](_0x4a298f['shift']());}};_0x1703c1(++_0x3edefc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x411c4a,_0x1769a5){_0x411c4a=_0x411c4a-0x0;var _0xdca442=_0x5f2f[_0x411c4a];return _0xdca442;};'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 _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x499e4e,_0x2f44cf){var _0x62de57=function(_0x4e0ee3){while(--_0x4e0ee3){_0x499e4e['push'](_0x499e4e['shift']());}};_0x62de57(++_0x2f44cf);}(_0xb10b,0x12a));var _0xbb10=function(_0x133296,_0xe8ff9a){_0x133296=_0x133296-0x0;var _0x193517=_0xb10b[_0x133296];return _0x193517;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 955869b..c4ff648 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 _0x1bf9=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x397b9e,_0x58e7c9){var _0x3f3231=function(_0x2e0ce0){while(--_0x2e0ce0){_0x397b9e['push'](_0x397b9e['shift']());}};_0x3f3231(++_0x58e7c9);}(_0x1bf9,0x188));var _0x91bf=function(_0x19646c,_0x577c8f){_0x19646c=_0x19646c-0x0;var _0xee2dfc=_0x1bf9[_0x19646c];return _0xee2dfc;};'use strict';var util=require(_0x91bf('0x0'));var path=require('path');var _=require(_0x91bf('0x1'));var fs=require('fs');var json2xls=require(_0x91bf('0x2'));var BPromise=require(_0x91bf('0x3'));var zipdir=require(_0x91bf('0x4'));var rimraf=require(_0x91bf('0x5'));var db=require(_0x91bf('0x6'))['db'];var dbH=require(_0x91bf('0x6'))['dbH'];var logger=require(_0x91bf('0x7'))(_0x91bf('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x91bf('0x9')][0x3];var PATH=process[_0x91bf('0x9')][0x4];function analyticExtractedReport(_0x2cd9f3,_0x15dca8){var _0x18c45f={'status':_0x2cd9f3};var _0x55780f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15dca8){_0x18c45f[_0x91bf('0xa')]=_0x15dca8;}return db[_0x91bf('0xb')]['update'](_0x18c45f,_0x55780f);}function main(){var _0x3d27ff=0x1388;var _0x5731d2;logger[_0x91bf('0xc')](util[_0x91bf('0xd')](_0x91bf('0xe'),EXTRACTED_REPORT_ID,_0x91bf('0xf')));return db[_0x91bf('0x10')][_0x91bf('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x91bf('0x12'),_0x91bf('0x13')]})[_0x91bf('0x14')](function(_0x15d01a){if(_0x15d01a){_0x5731d2=_0x15d01a;_0x3d27ff=_0x5731d2['splitSizeXlsx']||0x1388;}})[_0x91bf('0x14')](function(){return dbH[_0x91bf('0x15')]['query'](util[_0x91bf('0xd')](_0x91bf('0x16'),QUERY),{'type':dbH['sequelize'][_0x91bf('0x17')][_0x91bf('0x18')]});})[_0x91bf('0x14')](function(_0x4ecf96){if(!_0x4ecf96[0x0][_0x91bf('0x19')]){return analyticExtractedReport('Empty');}var _0x5cee06=[];var _0x302627=0x0;var _0x5d5ae7=!![];if(_0x5731d2[_0x91bf('0x12')]){if(_0x4ecf96&&_0x4ecf96[_0x91bf('0x1a')]){var _0xf8f580=_0x4ecf96[0x0][_0x91bf('0x19')]%(_0x302627+_0x3d27ff);for(;_0x5d5ae7;_0x302627+=_0x3d27ff,_0xf8f580=_0x4ecf96[0x0][_0x91bf('0x19')]%(_0x302627+_0x3d27ff)){if(_0xf8f580==0x0||_0xf8f580==_0x4ecf96[0x0][_0x91bf('0x19')]){_0x5d5ae7=![];}_0x5cee06[_0x91bf('0x1b')](dbH[_0x91bf('0x15')]['query'](util['format'](_0x91bf('0x1c'),QUERY,_0x3d27ff,_0x302627),{'type':dbH[_0x91bf('0x15')][_0x91bf('0x17')][_0x91bf('0x18')]}));}}}else{_0x5cee06[_0x91bf('0x1b')](dbH[_0x91bf('0x15')][_0x91bf('0x1d')](QUERY,{'type':dbH[_0x91bf('0x15')][_0x91bf('0x17')][_0x91bf('0x18')]}));}var _0x5d9c6e=path[_0x91bf('0x1e')](PATH);var _0x1ddefa=path[_0x91bf('0x1f')](PATH,_0x91bf('0x20'));var _0x1a0759=_0x5731d2[_0x91bf('0x12')]&&_0x5cee06[_0x91bf('0x1a')]>0x1;var _0xd4d9d6=[];if(!fs['existsSync'](path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa))&&_0x1a0759){fs[_0x91bf('0x22')](path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa));}return BPromise['each'](_0x5cee06,function(_0x3551ef){_0xd4d9d6['push'](_0x3551ef);})['then'](function(){for(var _0x5db38e=0x0;_0x5db38e<_0xd4d9d6[_0x91bf('0x1a')];_0x5db38e+=0x1){var _0x42fced;var _0xb416a0=_0xd4d9d6[_0x5db38e];if(_0x1a0759){_0x42fced=path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa,util['format'](_0x91bf('0x23'),_0x1ddefa,_0x5db38e,_0x91bf('0x24')));}else{_0x42fced=path[_0x91bf('0x21')](_0x5d9c6e,util['format'](_0x91bf('0x25'),_0x1ddefa,_0x91bf('0x24')));}fs[_0x91bf('0x26')](_0x42fced,json2xls(_0xb416a0),_0x91bf('0x27'));}})[_0x91bf('0x14')](function(){if(_0x1a0759){zipdir(path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa),{'saveTo':path[_0x91bf('0x21')](_0x5d9c6e,util[_0x91bf('0xd')](_0x91bf('0x25'),_0x1ddefa,_0x91bf('0x28')))},function(_0x1b35e2,_0x3f1092){});rimraf(path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa),function(){});}})[_0x91bf('0x14')](function(){logger[_0x91bf('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x91bf('0xf')));return analyticExtractedReport(_0x91bf('0x29'),_0x1a0759?util[_0x91bf('0xd')]('%s.%s',_0x1ddefa,_0x1a0759?_0x91bf('0x28'):'xlsx'):null);});})[_0x91bf('0x2a')](function(_0x391ed6){logger['info'](util[_0x91bf('0xd')](_0x91bf('0x2b'),EXTRACTED_REPORT_ID,_0x91bf('0xf')),util[_0x91bf('0x2c')](_0x391ed6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x91bf('0x2d'));});}main(); \ No newline at end of file +var _0xaa76=['length','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','Failed','util','path','lodash','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','num','push','dirname','.xlsx'];(function(_0x12ae5a,_0x449bf8){var _0xc1ce11=function(_0x3f1e84){while(--_0x3f1e84){_0x12ae5a['push'](_0x12ae5a['shift']());}};_0xc1ce11(++_0x449bf8);}(_0xaa76,0xbb));var _0x6aa7=function(_0x3b01c2,_0x32dd57){_0x3b01c2=_0x3b01c2-0x0;var _0x4e6966=_0xaa76[_0x3b01c2];return _0x4e6966;};'use strict';var util=require(_0x6aa7('0x0'));var path=require(_0x6aa7('0x1'));var _=require(_0x6aa7('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x6aa7('0x3'));var rimraf=require('rimraf');var db=require(_0x6aa7('0x4'))['db'];var dbH=require(_0x6aa7('0x4'))['dbH'];var logger=require(_0x6aa7('0x5'))(_0x6aa7('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x6aa7('0x7')][0x2]);var QUERY=process[_0x6aa7('0x7')][0x3];var PATH=process[_0x6aa7('0x7')][0x4];function analyticExtractedReport(_0x128cb9,_0x3915c6){var _0x5f2f35={'status':_0x128cb9};var _0x5d774c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3915c6){_0x5f2f35[_0x6aa7('0x8')]=_0x3915c6;}return db['AnalyticExtractedReport'][_0x6aa7('0x9')](_0x5f2f35,_0x5d774c);}function main(){var _0x5bde83=0x1388;var _0x2f3e20;logger[_0x6aa7('0xa')](util[_0x6aa7('0xb')](_0x6aa7('0xc'),EXTRACTED_REPORT_ID,_0x6aa7('0xd')));return db[_0x6aa7('0xe')][_0x6aa7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6aa7('0x10'),_0x6aa7('0x11')]})[_0x6aa7('0x12')](function(_0x4c9566){if(_0x4c9566){_0x2f3e20=_0x4c9566;_0x5bde83=_0x2f3e20['splitSizeXlsx']||0x1388;}})[_0x6aa7('0x12')](function(){return dbH[_0x6aa7('0x13')][_0x6aa7('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6aa7('0x13')][_0x6aa7('0x15')][_0x6aa7('0x16')]});})[_0x6aa7('0x12')](function(_0x811189){if(!_0x811189[0x0]['num']){return analyticExtractedReport(_0x6aa7('0x17'));}var _0x1a888c=[];var _0xc9ab50=0x0;var _0x5b41d4=!![];if(_0x2f3e20[_0x6aa7('0x10')]){if(_0x811189&&_0x811189['length']){var _0x207495=_0x811189[0x0][_0x6aa7('0x18')]%(_0xc9ab50+_0x5bde83);for(;_0x5b41d4;_0xc9ab50+=_0x5bde83,_0x207495=_0x811189[0x0]['num']%(_0xc9ab50+_0x5bde83)){if(_0x207495==0x0||_0x207495==_0x811189[0x0]['num']){_0x5b41d4=![];}_0x1a888c[_0x6aa7('0x19')](dbH[_0x6aa7('0x13')][_0x6aa7('0x14')](util[_0x6aa7('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5bde83,_0xc9ab50),{'type':dbH[_0x6aa7('0x13')][_0x6aa7('0x15')][_0x6aa7('0x16')]}));}}}else{_0x1a888c[_0x6aa7('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x6aa7('0x13')][_0x6aa7('0x15')][_0x6aa7('0x16')]}));}var _0x4dcb94=path[_0x6aa7('0x1a')](PATH);var _0x2f4611=path['basename'](PATH,_0x6aa7('0x1b'));var _0x1868c2=_0x2f3e20['split']&&_0x1a888c[_0x6aa7('0x1c')]>0x1;var _0xc27181=[];if(!fs[_0x6aa7('0x1d')](path[_0x6aa7('0x1e')](_0x4dcb94,_0x2f4611))&&_0x1868c2){fs[_0x6aa7('0x1f')](path['join'](_0x4dcb94,_0x2f4611));}return BPromise[_0x6aa7('0x20')](_0x1a888c,function(_0x33d58d){_0xc27181[_0x6aa7('0x19')](_0x33d58d);})['then'](function(){for(var _0xb63c5b=0x0;_0xb63c5b<_0xc27181[_0x6aa7('0x1c')];_0xb63c5b+=0x1){var _0x45b706;var _0x510743=_0xc27181[_0xb63c5b];if(_0x1868c2){_0x45b706=path[_0x6aa7('0x1e')](_0x4dcb94,_0x2f4611,util['format'](_0x6aa7('0x21'),_0x2f4611,_0xb63c5b,'xlsx'));}else{_0x45b706=path[_0x6aa7('0x1e')](_0x4dcb94,util[_0x6aa7('0xb')](_0x6aa7('0x22'),_0x2f4611,_0x6aa7('0x23')));}fs['writeFileSync'](_0x45b706,json2xls(_0x510743),_0x6aa7('0x24'));}})[_0x6aa7('0x12')](function(){if(_0x1868c2){zipdir(path[_0x6aa7('0x1e')](_0x4dcb94,_0x2f4611),{'saveTo':path['join'](_0x4dcb94,util[_0x6aa7('0xb')]('%s.%s',_0x2f4611,'zip'))},function(_0x539726,_0x3672c6){});rimraf(path['join'](_0x4dcb94,_0x2f4611),function(){});}})[_0x6aa7('0x12')](function(){logger['info'](util[_0x6aa7('0xb')](_0x6aa7('0x25'),EXTRACTED_REPORT_ID,_0x6aa7('0xd')));return analyticExtractedReport(_0x6aa7('0x26'),_0x1868c2?util[_0x6aa7('0xb')](_0x6aa7('0x22'),_0x2f4611,_0x1868c2?_0x6aa7('0x27'):_0x6aa7('0x23')):null);});})[_0x6aa7('0x28')](function(_0x343319){logger[_0x6aa7('0xa')](util[_0x6aa7('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6aa7('0xd')),util[_0x6aa7('0x29')](_0x343319,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6aa7('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9ae8c9d..a6c5eb9 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 _0x336d=['outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','tag','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','catch','error','rewrite','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x222288,_0x48bb2f){var _0x214ef5=function(_0x362ee6){while(--_0x362ee6){_0x222288['push'](_0x222288['shift']());}};_0x214ef5(++_0x48bb2f);}(_0x336d,0xae));var _0xd336=function(_0x58a5d1,_0x172d51){_0x58a5d1=_0x58a5d1-0x0;var _0x1b8574=_0x336d[_0x58a5d1];return _0x1b8574;};'use strict';var _=require('lodash');var util=require(_0xd336('0x0'));function rewrite(_0x183947,_0x3ab6df){var _0x12100f=this;return _0x183947[_0xd336('0x1')][_0xd336('0x2')][_0xd336('0x3')]({'raw':!![]})[_0xd336('0x4')](function(_0x20e120){_0x12100f[_0xd336('0x5')]=_0x20e120;return _0x183947['models']['VoiceExtension'][_0xd336('0x3')]({'where':{'IntervalId':_0x3ab6df[_0xd336('0x6')]},'raw':!![]});})[_0xd336('0x4')](function(_0x5debef){return _0x183947[_0xd336('0x1')][_0xd336('0x7')][_0xd336('0x3')]({'where':{'exten':{'$in':_[_0xd336('0x8')](_[_0xd336('0x9')](_0x5debef,_0xd336('0xa')))}},'order':[{'raw':_0xd336('0xb')}],'raw':!![]});})[_0xd336('0x4')](function(_0x2a8315){var _0x404030=_['filter'](_0x2a8315,{'priority':'1'});var _0x5c80bd=_[_0xd336('0xc')](_0x2a8315,{'isApp':0x1});var _0x2806ee=_[_0xd336('0xd')](_0x5c80bd,_0xd336('0xa'));var _0x29aa4a=[_0xd336('0xe'),_0xd336('0xf')];var _0x93e2c7=[];var _0x378e04=[];for(var _0x3fd7ea in _0x2806ee){if(_0x2806ee['hasOwnProperty'](_0x3fd7ea)){_0x12100f[_0xd336('0x10')]=0x2;_0x12100f['extensions']=[];_0x12100f[_0xd336('0x11')]=_[_0xd336('0x12')](_0x404030,{'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')]});_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':util[_0xd336('0x17')](_0xd336('0x18'),_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')]),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});if(_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')]===_0xd336('0x1b')){if(_0x12100f[_0xd336('0x11')]){_0x12100f['extensions'][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':'CDR(destination)='+(_0x12100f[_0xd336('0x11')][_0xd336('0x1c')]?'${EXTEN:'+_0x12100f[_0xd336('0x11')][_0xd336('0x1c')]+'}':'${EXTEN}'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':'CDR(routeid)='+_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')],'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});var _0x2f16dd=_0x12100f['priority']++;_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0]['type'],'app':'ExecIf','appdata':_0xd336('0x1d')+(_0x2f16dd+0x2)+_0xd336('0x1e')+(_0x2f16dd+0x1)+')','context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x2f16dd,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});if(_0x12100f[_0xd336('0x11')]){_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0x12100f['extension']['cutdigits']?_0xd336('0x1f')+_0x12100f[_0xd336('0x11')]['cutdigits']+'}':_0xd336('0x20'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0xd336('0x21')+_0x2806ee[_0x3fd7ea][0x0]['VoiceExtensionId'],'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});if(_0x12100f[_0xd336('0x11')]&&_0x12100f[_0xd336('0x11')][_0xd336('0x22')](_0xd336('0x23'))&&_0x12100f[_0xd336('0x11')][_0xd336('0x23')]!==_0xd336('0x24')){_0x12100f['extensions'][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0xd336('0x25'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f['priority']++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});_0x12100f[_0xd336('0x13')]['push']({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':'Set','appdata':_0xd336('0x26')+_0x12100f[_0xd336('0x11')][_0xd336('0x23')]||_0xd336('0x27'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});_0x12100f[_0xd336('0x13')]['push']({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0xd336('0x28'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f['priority']++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0]['type'],'app':_0xd336('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2806ee[_0x3fd7ea][0x0]['context'],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0]['VoiceExtensionId']});for(var _0x418b28=0x0,_0x3b9ecc=0x0;_0x418b28<_0x2806ee[_0x3fd7ea]['length'];_0x418b28+=0x1,_0x3b9ecc=0x0){var _0x6f1fe1=_0x2806ee[_0x3fd7ea][_0x418b28];if(_0x6f1fe1[_0xd336('0x15')]){_0x6f1fe1[_0xd336('0x15')]=_0x6f1fe1[_0xd336('0x15')][_0xd336('0x29')]();}var _0x4706f7=[];var _0x19e9d4=[];delete _0x6f1fe1['id'];delete _0x6f1fe1[_0xd336('0x2a')];delete _0x6f1fe1[_0xd336('0x2b')];var _0x30e85f=_0x6f1fe1[_0xd336('0x2c')]!=='*,*,*,*'?[_0x6f1fe1['interval']]:_0x6f1fe1[_0xd336('0x6')]?_[_0xd336('0x9')](_[_0xd336('0xc')](_0x12100f['intervals'],{'IntervalId':_0x6f1fe1[_0xd336('0x6')]}),_0xd336('0x2c')):[];if(_0x6f1fe1[_0xd336('0x22')]('tag')){if(_0x6f1fe1[_0xd336('0x2d')]&&_0x6f1fe1[_0xd336('0x2d')]!=='--'){_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1['type'],'app':'Set','appdata':'CDR(tag)='+_0x6f1fe1[_0xd336('0x2d')],'context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1['exten'],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}}if(_0x6f1fe1['type']==='outbound'&&_0x6f1fe1[_0xd336('0x22')](_0xd336('0x2f'))){if(_0x6f1fe1[_0xd336('0x2f')]){_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':_0xd336('0x30'),'appdata':_0xd336('0x31')+_0x6f1fe1['callerID']+')','context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f['length']+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}else{_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':_0xd336('0x30'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f['priority']+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}}if(_0x6f1fe1[_0xd336('0x22')]('answer')){if(_0x29aa4a[_0xd336('0x32')](_0x6f1fe1[_0xd336('0x33')][_0xd336('0x29')]())>=0x0&&_0x6f1fe1[_0xd336('0x34')]!==_0xd336('0x35')){if(_0x6f1fe1['answer']){_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':'ExecIf','appdata':_0xd336('0x36'),'context':_0x6f1fe1['context'],'exten':_0x6f1fe1['exten'],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':'Set','appdata':_0xd336('0x37'),'context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1['VoiceExtensionId']});}else{_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':'ExecIf','appdata':_0xd336('0x38'),'context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1['type'],'app':_0xd336('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1['exten'],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}}}for(var _0x3f52df=0x0;_0x3f52df<_0x30e85f[_0xd336('0x2e')];_0x3f52df+=0x1){var _0x539760=_0x12100f[_0xd336('0x10')]+_0x30e85f['length'];var _0x1fd17e=_0x3f52df===_0x30e85f[_0xd336('0x2e')]-0x1?_0x12100f['priority']+_0x4706f7[_0xd336('0x2e')]+_0x19e9d4[_0xd336('0x2e')]+0x2:_0x12100f[_0xd336('0x10')]+_0x3f52df+0x1;_0x4706f7[_0xd336('0x39')](_0x3f52df,0x0,{'type':_0x6f1fe1['type'],'app':_0xd336('0x3a'),'appdata':_0x30e85f[_0x3f52df]+'?'+_0x6f1fe1[_0xd336('0x19')]+',${EXTEN},'+_0x539760+':'+_0x6f1fe1[_0xd336('0x19')]+_0xd336('0x3b')+_0x1fd17e,'exten':_0x6f1fe1[_0xd336('0xa')],'context':_0x6f1fe1['context'],'priority':_0x12100f[_0xd336('0x10')]+_0x3f52df,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}_0x6f1fe1[_0xd336('0x10')]=_0x4706f7[_0xd336('0x2e')]?_[_0xd336('0x3c')](_0x4706f7)['priority']+0x1:_0x12100f[_0xd336('0x10')];_0x12100f['priority']=(_0x19e9d4[_0xd336('0x2e')]?_['last'](_0x19e9d4)[_0xd336('0x10')]:_0x6f1fe1[_0xd336('0x10')])+0x1;_0x12100f[_0xd336('0x13')]=_['concat'](_0x12100f[_0xd336('0x13')],_0x4706f7,[_0x6f1fe1],_0x19e9d4);}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x3d'),'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'priority':_0x12100f[_0xd336('0x10')],'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0]['VoiceExtensionId']});_0x93e2c7[_0xd336('0x14')](_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]);_0x378e04=_[_0xd336('0x3e')](_0x378e04,_0x12100f[_0xd336('0x13')]);}}return _0x183947[_0xd336('0x3f')](function(_0x1128d4){return _0x183947[_0xd336('0x1')]['VoiceExtension'][_0xd336('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x93e2c7}},'transaction':_0x1128d4})[_0xd336('0x4')](function(_0x524422){return _0x183947[_0xd336('0x1')][_0xd336('0x7')][_0xd336('0x41')](_['sortBy'](_0x378e04,_0xd336('0x10')),{'transaction':_0x1128d4});});});})[_0xd336('0x42')](function(_0x115d6c){console[_0xd336('0x43')](_0x115d6c);});}exports[_0xd336('0x44')]=rewrite; \ No newline at end of file +var _0x5cd8=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','lodash','models','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','format','VoiceExtensionId','outbound','extension','Set','cutdigits','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','appType','custom','XCALLY-MOTION-ANSWER=1'];(function(_0x2bcb83,_0x47dec0){var _0x3b43c7=function(_0x26718f){while(--_0x26718f){_0x2bcb83['push'](_0x2bcb83['shift']());}};_0x3b43c7(++_0x47dec0);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x4ebceb,_0xa86c37){_0x4ebceb=_0x4ebceb-0x0;var _0x57b46d=_0x5cd8[_0x4ebceb];return _0x57b46d;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');function rewrite(_0x24bfe8,_0x32ee64){var _0x2bfe8e=this;return _0x24bfe8[_0x85cd('0x1')]['Interval'][_0x85cd('0x2')]({'raw':!![]})['then'](function(_0x1c9dc8){_0x2bfe8e[_0x85cd('0x3')]=_0x1c9dc8;return _0x24bfe8[_0x85cd('0x1')][_0x85cd('0x4')][_0x85cd('0x2')]({'where':{'IntervalId':_0x32ee64['IntervalId']},'raw':!![]});})[_0x85cd('0x5')](function(_0x1a69c4){return _0x24bfe8['models'][_0x85cd('0x4')][_0x85cd('0x2')]({'where':{'exten':{'$in':_[_0x85cd('0x6')](_[_0x85cd('0x7')](_0x1a69c4,_0x85cd('0x8')))}},'order':[{'raw':_0x85cd('0x9')}],'raw':!![]});})[_0x85cd('0x5')](function(_0x13d545){var _0x3a28bb=_['filter'](_0x13d545,{'priority':'1'});var _0x526093=_[_0x85cd('0xa')](_0x13d545,{'isApp':0x1});var _0x2301b2=_[_0x85cd('0xb')](_0x526093,_0x85cd('0x8'));var _0x4f054b=[_0x85cd('0xc'),_0x85cd('0xd')];var _0x46432e=[];var _0x8d4f02=[];for(var _0xc695a0 in _0x2301b2){if(_0x2301b2[_0x85cd('0xe')](_0xc695a0)){_0x2bfe8e[_0x85cd('0xf')]=0x2;_0x2bfe8e[_0x85cd('0x10')]=[];_0x2bfe8e['extension']=_[_0x85cd('0x11')](_0x3a28bb,{'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')]});_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':'Set','appdata':util[_0x85cd('0x14')]('CDR(type)=%s',_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')]),'context':_0x2301b2[_0xc695a0][0x0]['context'],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e['priority']++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});if(_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')]===_0x85cd('0x16')){if(_0x2bfe8e[_0x85cd('0x17')]){_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':'CDR(destination)='+(_0x2bfe8e[_0x85cd('0x17')][_0x85cd('0x19')]?'${EXTEN:'+_0x2bfe8e['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});}_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0]['type'],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x1b')+_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')],'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});var _0xb3500f=_0x2bfe8e[_0x85cd('0xf')]++;_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0]['type'],'app':_0x85cd('0x1c'),'appdata':_0x85cd('0x1d')+(_0xb3500f+0x2)+_0x85cd('0x1e')+(_0xb3500f+0x1)+')','context':_0x2301b2[_0xc695a0][0x0]['context'],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0xb3500f,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});if(_0x2bfe8e['extension']){_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x2bfe8e['extension'][_0x85cd('0x19')]?_0x85cd('0x1f')+_0x2bfe8e[_0x85cd('0x17')][_0x85cd('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});}_0x2bfe8e['extensions'][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x20')+_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')],'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});if(_0x2bfe8e[_0x85cd('0x17')]&&_0x2bfe8e[_0x85cd('0x17')][_0x85cd('0xe')](_0x85cd('0x21'))&&_0x2bfe8e['extension'][_0x85cd('0x21')]!==_0x85cd('0x22')){_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':'Set','appdata':_0x85cd('0x23'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x2bfe8e[_0x85cd('0x10')]['push']({'type':_0x2301b2[_0xc695a0][0x0]['type'],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x24')+_0x2bfe8e['extension']['recordingFormat']||_0x85cd('0x25'),'context':_0x2301b2[_0xc695a0][0x0]['context'],'exten':_0x2301b2[_0xc695a0][0x0]['exten'],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});}}_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x26'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e[_0x85cd('0xf')]++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x27'),'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'priority':_0x2bfe8e['priority']++,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0]['VoiceExtensionId']});for(var _0x467589=0x0,_0x3494fd=0x0;_0x467589<_0x2301b2[_0xc695a0][_0x85cd('0x28')];_0x467589+=0x1,_0x3494fd=0x0){var _0x25b7c7=_0x2301b2[_0xc695a0][_0x467589];if(_0x25b7c7['type']){_0x25b7c7[_0x85cd('0x13')]=_0x25b7c7[_0x85cd('0x13')][_0x85cd('0x29')]();}var _0x4efb8e=[];var _0x1139e0=[];delete _0x25b7c7['id'];delete _0x25b7c7[_0x85cd('0x2a')];delete _0x25b7c7[_0x85cd('0x2b')];var _0xd1c180=_0x25b7c7[_0x85cd('0x2c')]!==_0x85cd('0x2d')?[_0x25b7c7['interval']]:_0x25b7c7['IntervalId']?_[_0x85cd('0x7')](_[_0x85cd('0xa')](_0x2bfe8e[_0x85cd('0x3')],{'IntervalId':_0x25b7c7['IntervalId']}),_0x85cd('0x2c')):[];if(_0x25b7c7[_0x85cd('0xe')](_0x85cd('0x2e'))){if(_0x25b7c7['tag']&&_0x25b7c7[_0x85cd('0x2e')]!=='--'){_0x4efb8e['push']({'type':_0x25b7c7['type'],'app':_0x85cd('0x18'),'appdata':_0x85cd('0x2f')+_0x25b7c7[_0x85cd('0x2e')],'context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}}if(_0x25b7c7[_0x85cd('0x13')]===_0x85cd('0x16')&&_0x25b7c7[_0x85cd('0xe')](_0x85cd('0x30'))){if(_0x25b7c7[_0x85cd('0x30')]){_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7[_0x85cd('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x25b7c7[_0x85cd('0x30')]+')','context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e[_0x85cd('0xf')]+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}else{_0x4efb8e['push']({'type':_0x25b7c7[_0x85cd('0x13')],'app':_0x85cd('0x1c'),'appdata':_0x85cd('0x31'),'context':_0x25b7c7['context'],'exten':_0x25b7c7['exten'],'priority':_0xd1c180['length']+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7['VoiceExtensionId']});}}if(_0x25b7c7[_0x85cd('0xe')]('answer')){if(_0x4f054b['indexOf'](_0x25b7c7[_0x85cd('0x32')][_0x85cd('0x29')]())>=0x0&&_0x25b7c7[_0x85cd('0x33')]!==_0x85cd('0x34')){if(_0x25b7c7['answer']){_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7[_0x85cd('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7['exten'],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7[_0x85cd('0x13')],'app':'Set','appdata':_0x85cd('0x35'),'context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}else{_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7['type'],'app':_0x85cd('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e[_0x85cd('0xf')]+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});_0x4efb8e[_0x85cd('0x12')]({'type':_0x25b7c7['type'],'app':'Set','appdata':_0x85cd('0x36'),'context':_0x25b7c7[_0x85cd('0x1a')],'exten':_0x25b7c7[_0x85cd('0x8')],'priority':_0xd1c180[_0x85cd('0x28')]+_0x2bfe8e['priority']+_0x3494fd++,'VoiceExtensionId':_0x25b7c7[_0x85cd('0x15')]});}}}for(var _0x1afbff=0x0;_0x1afbff<_0xd1c180[_0x85cd('0x28')];_0x1afbff+=0x1){var _0xbabb64=_0x2bfe8e[_0x85cd('0xf')]+_0xd1c180[_0x85cd('0x28')];var _0x3ab6d4=_0x1afbff===_0xd1c180['length']-0x1?_0x2bfe8e['priority']+_0x4efb8e[_0x85cd('0x28')]+_0x1139e0[_0x85cd('0x28')]+0x2:_0x2bfe8e[_0x85cd('0xf')]+_0x1afbff+0x1;_0x4efb8e[_0x85cd('0x37')](_0x1afbff,0x0,{'type':_0x25b7c7['type'],'app':_0x85cd('0x38'),'appdata':_0xd1c180[_0x1afbff]+'?'+_0x25b7c7[_0x85cd('0x1a')]+',${EXTEN},'+_0xbabb64+':'+_0x25b7c7[_0x85cd('0x1a')]+_0x85cd('0x39')+_0x3ab6d4,'exten':_0x25b7c7['exten'],'context':_0x25b7c7[_0x85cd('0x1a')],'priority':_0x2bfe8e['priority']+_0x1afbff,'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});}_0x25b7c7[_0x85cd('0xf')]=_0x4efb8e[_0x85cd('0x28')]?_[_0x85cd('0x3a')](_0x4efb8e)[_0x85cd('0xf')]+0x1:_0x2bfe8e[_0x85cd('0xf')];_0x2bfe8e[_0x85cd('0xf')]=(_0x1139e0['length']?_['last'](_0x1139e0)[_0x85cd('0xf')]:_0x25b7c7[_0x85cd('0xf')])+0x1;_0x2bfe8e['extensions']=_[_0x85cd('0x3b')](_0x2bfe8e[_0x85cd('0x10')],_0x4efb8e,[_0x25b7c7],_0x1139e0);}_0x2bfe8e[_0x85cd('0x10')][_0x85cd('0x12')]({'type':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x13')],'app':'Hangup','exten':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x8')],'context':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x1a')],'priority':_0x2bfe8e[_0x85cd('0xf')],'VoiceExtensionId':_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]});_0x46432e[_0x85cd('0x12')](_0x2301b2[_0xc695a0][0x0][_0x85cd('0x15')]);_0x8d4f02=_[_0x85cd('0x3b')](_0x8d4f02,_0x2bfe8e[_0x85cd('0x10')]);}}return _0x24bfe8[_0x85cd('0x3c')](function(_0x5441b3){return _0x24bfe8['models'][_0x85cd('0x4')][_0x85cd('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x46432e}},'transaction':_0x5441b3})[_0x85cd('0x5')](function(_0x4525f8){return _0x24bfe8[_0x85cd('0x1')][_0x85cd('0x4')]['bulkCreate'](_[_0x85cd('0x3e')](_0x8d4f02,_0x85cd('0xf')),{'transaction':_0x5441b3});});});})[_0x85cd('0x3f')](function(_0x5eb538){console[_0x85cd('0x40')](_0x5eb538);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index b50f05a..0808b22 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x3893e6,_0xb0912d){var _0x3c9882=function(_0x102358){while(--_0x102358){_0x3893e6['push'](_0x3893e6['shift']());}};_0x3c9882(++_0xb0912d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x457d26,_0x29ff8c){var _0x5babd5=function(_0x417cfc){while(--_0x417cfc){_0x457d26['push'](_0x457d26['shift']());}};_0x5babd5(++_0x29ff8c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0xcb91[_0x210603];return _0x1bcb7d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 954dd51..d77f80d 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x7a54,0x106));var _0x47a5=function(_0x51b2bd,_0x32581c){_0x51b2bd=_0x51b2bd-0x0;var _0x4c230c=_0x7a54[_0x51b2bd];return _0x4c230c;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x2ab5c0,_0x3e00f3){var _0x2afddf=function(_0x352e2c){while(--_0x352e2c){_0x2ab5c0['push'](_0x2ab5c0['shift']());}};_0x2afddf(++_0x3e00f3);}(_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 diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 52a44ca..e236563 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 _0xc2b5=['server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','error','message','split','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','createdAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','toString','cm_contacts.id','cm_hopper_black','ListId','updatedAt','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','insert',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','errors','code','catch','main','clone','socket_timestamp','body','ContactItemType','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','finish','unlink','complete','argv','arguments\x20\x20\x20'];(function(_0x4ba351,_0x377d32){var _0x3074a4=function(_0x417231){while(--_0x417231){_0x4ba351['push'](_0x4ba351['shift']());}};_0x3074a4(++_0x377d32);}(_0xc2b5,0x9f));var _0x5c2b=function(_0x8809b4,_0x3bdc8a){_0x8809b4=_0x8809b4-0x0;var _0xc33cb7=_0xc2b5[_0x8809b4];return _0xc33cb7;};'use strict';var fs=require('fs');var path=require(_0x5c2b('0x0'));var _=require(_0x5c2b('0x1'));var Papa=require(_0x5c2b('0x2'));var util=require(_0x5c2b('0x3'));var BPromise=require('bluebird');var moment=require(_0x5c2b('0x4'));var squel=require(_0x5c2b('0x5'));var Redis=require(_0x5c2b('0x6'));var db=require(_0x5c2b('0x7'))['db'];var config=require(_0x5c2b('0x8'));var logger=require(_0x5c2b('0x9'))(_0x5c2b('0xa'));config[_0x5c2b('0xb')]=_[_0x5c2b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c2b('0xb')]));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()[_0x5c2b('0xd')](_0x5c2b('0xe'));var tempTableName=_0x5c2b('0xf')+moment()[_0x5c2b('0xd')](_0x5c2b('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x17e255){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))*$/[_0x5c2b('0x11')](_0x17e255);}function selectNotIn(_0x3de2c1,_0x69ff98,_0x476505,_0xe7faa0,_0x25c29f){return squel[_0x5c2b('0x12')]()[_0x5c2b('0x13')](_0x5c2b('0x14'))[_0x5c2b('0x15')](_0xe7faa0)[_0x5c2b('0x16')](_0x69ff98,null,_0x69ff98+_0x5c2b('0x17')+_0xe7faa0+'.'+_0x476505)[_0x5c2b('0x18')](_0xe7faa0+'.'+_0x476505+_0x5c2b('0x19')+_0x3de2c1+'.'+_0x476505)[_0x5c2b('0x18')](_0x69ff98+_0x5c2b('0x1a')+_0x25c29f[_0x5c2b('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x474d3a,_0x5d4055){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5c2b('0x1b')][_0x5c2b('0x1c')](_0x5c2b('0x1d')+tempTableName)['spread'](function(_0x68c45b){if(_0x68c45b!==null){var _0x32b40f=[];for(var _0x5ab259=0x0;_0x5ab259<_0x68c45b[_0x5c2b('0x1e')];_0x5ab259++){var _0x2656aa=_0x68c45b[_0x5ab259];if(!_[_0x5c2b('0x1f')](_0x2656aa['phone'])){if(!_['isNil'](_0x2656aa[_0x5c2b('0x20')]))_0x32b40f[_0x5c2b('0x21')](insertAdditionalPhones(_0x2656aa));promisesContact['push']({'contact':_0x2656aa});}}}Promise[_0x5c2b('0x22')](_0x32b40f)[_0x5c2b('0x23')](function(){_0x474d3a({'val':0x1});});})['catch'](function(_0x5aaa9b){logger[_0x5c2b('0x24')](_0x5aaa9b[_0x5c2b('0x25')]);});});}function insertAdditionalPhones(_0x461f9b){return new Promise(function(_0x131d3b,_0x3c6cf7){var _0x8262e3=_0x461f9b[_0x5c2b('0x20')];if(_[_0x5c2b('0x1f')](_0x8262e3))_0x3c6cf7({'val':0x0});else{var _0x323a9a=_0x8262e3['split'](';');var _0x5b67e8=[];orderBy=0x0;for(var _0x144e00=0x0;_0x144e00<_0x323a9a['length'];_0x144e00++){_0x5b67e8[_0x5c2b('0x21')](splitAdditionalPhone(_0x461f9b['id'],_0x323a9a[_0x144e00]));}Promise['all'](_0x5b67e8)[_0x5c2b('0x23')](function(){_0x131d3b({'val':_0x323a9a[_0x5c2b('0x1e')]});});}});}function splitAdditionalPhone(_0xddd48b,_0x3b2449){return new Promise(function(_0x68aed1,_0x3f68f3){var _0x3767a9=_0x3b2449[_0x5c2b('0x26')](':');var _0x1a697c=_0x3767a9[0x0];var _0x459d66=_0x3767a9[0x1];if(_0x459d66!==''){var _0x4ff706=_0x459d66[_0x5c2b('0x26')]('|');var _0x24a179=[];for(var _0x4046a2=0x0;_0x4046a2<_0x4ff706[_0x5c2b('0x1e')];_0x4046a2++){if(_0x4ff706[_0x4046a2]!==''){var _0xa219c3=_[_0x5c2b('0x27')](promisesAdditionalPhones,{'contactId':_0xddd48b,'phone':_0x4ff706[_0x4046a2]});if(_0xa219c3[_0x5c2b('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x5c2b('0x21')]({'contactId':_0xddd48b,'contactTypeId':_0x1a697c,'phone':_0x4ff706[_0x4046a2],'orderBy':orderBy});}}}_0x68aed1({'ok':0x1});}else _0x68aed1({'res':0x0});});}function createAdditionalPhone(_0x3bb6cc,_0x1656c7,_0x2a5aec,_0x1535bd){return new Promise(function(_0x73e3b8,_0x227210){return db[_0x5c2b('0x28')][_0x5c2b('0x29')]({'where':{'CmContactId':_0x3bb6cc,'item':_0x2a5aec}})[_0x5c2b('0x23')](function(_0x394f7c){if(_0x394f7c){return db['CmContactHasItem'][_0x5c2b('0x2a')]({'ItemTypeId':_0x1656c7,'OrderBy':_0x1535bd},{'where':{'CmContactId':_0x3bb6cc,'item':_0x2a5aec}})[_0x5c2b('0x23')](function(_0x726c49){_0x73e3b8({'res':'updated'});});}else{return db['CmContactHasItem'][_0x5c2b('0x2b')]({'CmContactId':_0x3bb6cc,'item':_0x2a5aec,'ItemTypeId':_0x1656c7,'OrderBy':_0x1535bd,'ItemClass':_0x5c2b('0x2c')})[_0x5c2b('0x23')](function(_0x3a32e3){_0x73e3b8({'res':_0x5c2b('0x2d')});});}});});}function updateContact(_0x44525a){return new Promise(function(_0x18fa16,_0x579bdf){var _0x5d6fef=_0x44525a['id'];delete _0x44525a['id'];return db[_0x5c2b('0x2e')][_0x5c2b('0x2a')](_0x44525a,{'where':{'id':_0x5d6fef}})[_0x5c2b('0x23')](function(_0x16199b){updatedRows+=0x1;return db['CmHopper'][_0x5c2b('0x2a')]({'phone':_0x44525a[_0x5c2b('0x14')]},{'where':{'ContactId':_0x5d6fef}})[_0x5c2b('0x23')](function(_0xe2263d){_0x18fa16({'ret':'OK'});});});});}function insertCmHopper(_0x1d2d63,_0x28c3c7,_0x32fe58,_0x1157d2,_0x518694){var _0x30901e=[_0x5c2b('0x2f'),_0x5c2b('0x30'),'cm_contacts.id','cm_contacts.ListId',_0x28c3c7+'.'+_0x1157d2,_0x5c2b('0x31'),_0x5c2b('0x32'),_0x5c2b('0x33'),_0x5c2b('0x34'),'\x22'+_0x518694+'\x22'];return squel['insert']()[_0x5c2b('0x35')](_0x5c2b('0x36'))[_0x5c2b('0x37')]([_0x5c2b('0x14'),'scheduledat',_0x5c2b('0x38'),'ListId',_0x1157d2,_0x5c2b('0x39'),'updatedAt',_0x5c2b('0x3a'),'UserId',_0x5c2b('0x3b')],squel[_0x5c2b('0x12')]()[_0x5c2b('0x3c')](_0x30901e)[_0x5c2b('0x15')](_0x28c3c7)['join'](_0x5c2b('0x3d'),null,_0x5c2b('0x3e')+_0x28c3c7+_0x5c2b('0x3f'))[_0x5c2b('0x16')](_0x32fe58,null,_0x32fe58+'.id\x20=\x20'+_0x28c3c7+'.'+_0x1157d2)[_0x5c2b('0x18')](_0x28c3c7+_0x5c2b('0x40'),_0x1d2d63)[_0x5c2b('0x18')](_0x5c2b('0x41'),NOW)[_0x5c2b('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x28c3c7,_0x32fe58,_0x1157d2,_0x5c2b('0x36'),[_0x5c2b('0x42'),'\x22onlyIfOpen\x22']))[_0x5c2b('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x28c3c7,_0x32fe58,_0x1157d2,_0x5c2b('0x36'),['\x22always\x22'])))[_0x5c2b('0x43')]();}function insertCmHopperBlack(_0x515e1d,_0x494cd9,_0x720291,_0x207a19){var _0x2b58a6=['cm_contacts.phone',_0x5c2b('0x44'),'cm_contacts.ListId',_0x494cd9+'.'+_0x207a19,_0x5c2b('0x31'),_0x5c2b('0x32')];return squel['insert']()[_0x5c2b('0x35')](_0x5c2b('0x45'))['fromQuery']([_0x5c2b('0x14'),'ContactId',_0x5c2b('0x46'),_0x207a19,_0x5c2b('0x39'),_0x5c2b('0x47')],squel[_0x5c2b('0x12')]()[_0x5c2b('0x3c')](_0x2b58a6)['from'](_0x494cd9)[_0x5c2b('0x16')](_0x5c2b('0x3d'),null,_0x5c2b('0x3e')+_0x494cd9+'.CmListId')['join'](_0x720291,null,_0x720291+'.id\x20=\x20'+_0x494cd9+'.'+_0x207a19)['where'](_0x494cd9+'.CmListId\x20=\x20?',_0x515e1d)[_0x5c2b('0x18')](_0x5c2b('0x41'),NOW)[_0x5c2b('0x18')](_0x5c2b('0x48'),squel['select']()[_0x5c2b('0x13')](_0x5c2b('0x14'))['from'](_0x5c2b('0x45'))[_0x5c2b('0x18')](_0x5c2b('0x49'),_0x515e1d)[_0x5c2b('0x18')](_0x207a19+'\x20=\x20?',_0x494cd9+'.'+_0x207a19)))[_0x5c2b('0x43')]();}function insertCmHopperAdditionalPhones(_0x4250bd){var _0x20f5b6=[_0x5c2b('0x4a'),_0x5c2b('0x4b'),_0x5c2b('0x4c'),'cm_contact_has_items.createdAt',_0x5c2b('0x4d')];return squel['insert']()[_0x5c2b('0x35')](_0x5c2b('0x4e'))['fromQuery']([_0x5c2b('0x4f'),_0x5c2b('0x14'),_0x5c2b('0x50'),_0x5c2b('0x39'),_0x5c2b('0x47')],squel[_0x5c2b('0x12')]()[_0x5c2b('0x3c')](_0x20f5b6)['from'](_0x5c2b('0x36'))[_0x5c2b('0x16')](_0x5c2b('0x3d'),null,_0x5c2b('0x51'))[_0x5c2b('0x16')](_0x5c2b('0x52'),null,_0x5c2b('0x53'))['where'](_0x5c2b('0x54'),_0x4250bd)['where'](_0x5c2b('0x41'),NOW))[_0x5c2b('0x43')]();}function insertCmContact(_0x2ecb8e,_0x1fa808,_0x1c3d81,_0x13226f){var _0x21b33e=_[_0x5c2b('0x55')](_['keys'](_0x13226f),[_0x5c2b('0x46'),_0x5c2b('0x56'),'createdAt',_0x5c2b('0x47')]);return squel[_0x5c2b('0x57')]()[_0x5c2b('0x35')]('cm_contacts')[_0x5c2b('0x37')](_0x21b33e,squel['select']()[_0x5c2b('0x3c')](_0x21b33e)[_0x5c2b('0x15')](_0x1fa808)['where']('('+_0x1c3d81[_0x5c2b('0x16')](',')+_0x5c2b('0x58'),squel['select']()[_0x5c2b('0x3c')](_0x1c3d81)[_0x5c2b('0x15')]('cm_contacts')[_0x5c2b('0x18')](_0x5c2b('0x49'),_0x2ecb8e))[_0x5c2b('0x18')](_0x5c2b('0x59'),squel[_0x5c2b('0x12')]()[_0x5c2b('0x13')](_0x5c2b('0x5a'),_0x5c2b('0x5b'))[_0x5c2b('0x15')](_0x1fa808)['group'](_0x1c3d81['join'](','))))[_0x5c2b('0x43')]();}function handleStop(){logger[_0x5c2b('0x5c')](_0x5c2b('0x5d'));stopped=!![];}function handleUncaughtException(_0x308f60){logger[_0x5c2b('0x24')](_0x308f60[_0x5c2b('0x25')]);process[_0x5c2b('0x5e')](0x1);}function handleError(_0x10566b,_0x50918a){stats[_0x5c2b('0x5f')][_0x5c2b('0x21')]({'name':_0x50918a[_0x5c2b('0x60')],'message':_0x50918a[_0x5c2b('0x25')],'row':_0x10566b});}function handleQuery(_0x3c8351){logger[_0x5c2b('0x5c')](_0x3c8351);return db[_0x5c2b('0x1b')]['query'](_0x3c8351)['spread'](function(_0x35aebb){results['push'](_0x35aebb);})[_0x5c2b('0x61')](function(_0x197db8){logger['error'](_0x197db8[_0x5c2b('0x25')]);});}function main(_0xad8f29,_0x30a34b,_0x17f217,_0x816f8c){logger[_0x5c2b('0x5c')](_0x5c2b('0x62'),_0xad8f29,JSON['stringify'](_0x30a34b));process['send']('start');var _0x262d6e=_0x30a34b['binding'];var _0x444d49=_[_0x5c2b('0x63')](_0x262d6e);var _0x4f2d48=_0x30a34b[_0x5c2b('0x64')];var _0xb653f4=path[_0x5c2b('0x16')](config['root'],'server/files/tmp',_0x4f2d48+'.csv');logger[_0x5c2b('0x5c')](_0x5c2b('0x65'),_0x30a34b);db[_0x5c2b('0x66')][_0x5c2b('0x67')]({'raw':!![],'attributes':['id',_0x5c2b('0x68')]})['then'](function(_0xf14a45){for(var _0x52b3dc=0x0;_0x52b3dc<_0xf14a45[_0x5c2b('0x1e')];_0x52b3dc++){if(_0xf14a45[_0x52b3dc][_0x5c2b('0x68')]in _0x262d6e){contactItemTypes['push'](_0xf14a45[_0x52b3dc]);delete _0x444d49[_0xf14a45[_0x52b3dc]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x444d49[_0x5c2b('0x20')]='';var _0x5acf01=_[_0x5c2b('0x69')](_0x444d49)[_0x5c2b('0x16')]();logger[_0x5c2b('0x5c')](_0x5c2b('0x6a'),_0x5acf01);fs[_0x5c2b('0x6b')](_0xb653f4,_0x5acf01+'\x0a');Papa[_0x5c2b('0x6c')](fs[_0x5c2b('0x6d')](_0xad8f29),{'header':!![],'skipEmptyLines':!![],'step':function(_0x7685b3,_0x10cd9a){try{for(var _0x25dd08=0x0,_0xd4b199=[];_0x25dd08<_0x7685b3[_0x5c2b('0x6e')][_0x5c2b('0x1e')];_0x25dd08++){stats[_0x5c2b('0x6f')]+=0x1;if(_0x7685b3[_0x5c2b('0x5f')][_0x25dd08]){handleError(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08],_0x7685b3[_0x5c2b('0x5f')][_0x25dd08]);}else{var _0x391870=[];var _0x148972=[];for(var _0x1e24fd in _0x262d6e){let _0x3ae2ab=contactItemTypes[_0x5c2b('0x70')](_0x322e17=>_0x322e17[_0x5c2b('0x68')]===_0x1e24fd);if(_['isNil'](_0x3ae2ab)){if(_0x262d6e[_0x5c2b('0x71')](_0x1e24fd)){if(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08][_0x262d6e[_0x1e24fd]]){var _0x1b49bb=_[_0x5c2b('0x72')](_0x7685b3[_0x5c2b('0x6e')][_0x25dd08][_0x262d6e[_0x1e24fd]][_0x5c2b('0x73')](/"/g,'\x27'));switch(_0x1e24fd){case _0x5c2b('0x74'):var _0x103efd=moment(_0x1b49bb,_0x5c2b('0xe'),!![]);if(_0x103efd['isValid']()){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}else{_0x391870['push'](_0x5c2b('0x75'));}break;case _0x5c2b('0x3a'):var _0x3bf828=parseInt(_0x1b49bb);_0x1b49bb=_['isNaN'](_0x3bf828)||_0x3bf828<0x0||_0x3bf828>0x4?_0x816f8c?0x3:0x2:_0x3bf828;_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');break;case _0x5c2b('0x76'):var _0x3ee82d=parseInt(_0x1b49bb);if(_['isNumber'](_0x3ee82d)&&_['includes'](_0x17f217,_0x3ee82d)){_0xd4b199['push']('\x22'+_0x3ee82d+'\x22');}else{_0x391870[_0x5c2b('0x21')]('agent\x20not\x20exists');}break;case _0x5c2b('0x77'):if(isEmail(_0x1b49bb)){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}else{_0x391870[_0x5c2b('0x21')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x27fec3=moment(_0x1b49bb,_0x5c2b('0x78'),!![]);if(_0x27fec3[_0x5c2b('0x79')]()){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}else{_0x391870[_0x5c2b('0x21')](_0x5c2b('0x7a'));}break;default:_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}}else{switch(_0x1e24fd){case'firstName':case'phone':_0x391870[_0x5c2b('0x21')](_0x1e24fd+_0x5c2b('0x7b'));break;default:_0xd4b199[_0x5c2b('0x21')]('\x22\x22');}}}}else{var _0x28d822='';for(var _0x4a4311=0x0;_0x4a4311<_0x262d6e[_0x1e24fd][_0x5c2b('0x1e')];_0x4a4311++){var _0x1b49bb=_[_0x5c2b('0x72')](_0x7685b3[_0x5c2b('0x6e')][_0x25dd08][_0x262d6e[_0x1e24fd][_0x4a4311]][_0x5c2b('0x73')](/"/g,'\x27'));if(_0x28d822=='')_0x28d822=_0x1b49bb;else _0x28d822+='|'+_0x1b49bb;}_0x148972[_0x5c2b('0x21')](_0x3ae2ab['id']+':'+_0x28d822);}}if(hasAdditionalPhones){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x148972[_0x5c2b('0x16')](';')+'\x22');}if(_0x391870[_0x5c2b('0x1e')]){handleError(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08],{'code':'SystemRow','message':_0x391870['join']()});}else{fs[_0x5c2b('0x7c')](_0xb653f4,_0xd4b199[_0x5c2b('0x16')]()+'\x0a');}_0xd4b199=[];}if(!(stats['rows']%0xc8)){socket[_0x5c2b('0x7d')](_0x5c2b('0x7e')+_0x4f2d48,stats);stats[_0x5c2b('0x5f')]=[];}}if(stopped){logger[_0x5c2b('0x5c')](_0x5c2b('0x7f'));_0x10cd9a[_0x5c2b('0x80')]();}}catch(_0x39650a){handleError(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08],{'code':'SystemError','message':_0x39650a[_0x5c2b('0x25')]});logger[_0x5c2b('0x24')]('step',_0x39650a[_0x5c2b('0x25')]);}},'complete':function(){try{var _0x5a54a9=[];var _0x24d46f=tempTableName;_0x5a54a9[_0x5c2b('0x21')](_0x5c2b('0x81')+_0x24d46f+'\x20LIKE\x20cm_contacts;');logger[_0x5c2b('0x5c')](_0x5c2b('0x82'),contactItemTypes[_0x5c2b('0x1e')]);var _0x4cbe81=util['format'](_0x5c2b('0x83'),_0xb653f4,_0x24d46f,_0x5acf01,_0x30a34b[_0x5c2b('0x46')],_0x30a34b[_0x5c2b('0x56')]||null,NOW,NOW);if(_[_0x5c2b('0x1f')](_0x262d6e[_0x5c2b('0x74')])){_0x4cbe81+=_0x5c2b('0x84');}_0x5a54a9[_0x5c2b('0x21')](_0x4cbe81);BPromise['each'](_0x5a54a9,handleQuery)['then'](function(_0x139095){BPromise['all']([handleAdditionalPhones()])[_0x5c2b('0x23')](function(){_0x5a54a9=[];for(var _0x31b713=0x0;_0x31b713_0x4cae28['name']===_0x2a5d9c);if(_[_0x867b('0x18')](_0x4530a0)){if(_0x142b0c[_0x867b('0x6c')](_0x2a5d9c)){if(_0x3f298d['data'][_0x5910c2][_0x142b0c[_0x2a5d9c]]){var _0x25b752=_['trim'](_0x3f298d[_0x867b('0x69')][_0x5910c2][_0x142b0c[_0x2a5d9c]]['replace'](/"/g,'\x27'));switch(_0x2a5d9c){case _0x867b('0x6d'):var _0xad2e03=moment(_0x25b752,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xad2e03[_0x867b('0x6e')]()){_0x1705d4[_0x867b('0x1a')]('\x22'+_0x25b752+'\x22');}else{_0x3c7381['push'](_0x867b('0x6f'));}break;case _0x867b('0x70'):var _0x587cdf=parseInt(_0x25b752);_0x25b752=_['isNaN'](_0x587cdf)||_0x587cdf<0x0||_0x587cdf>0x4?_0x57f181?0x3:0x2:_0x587cdf;_0x1705d4[_0x867b('0x1a')]('\x22'+_0x25b752+'\x22');break;case _0x867b('0x35'):var _0x3b578e=parseInt(_0x25b752);if(_['isNumber'](_0x3b578e)&&_['includes'](_0xf7d5d2,_0x3b578e)){_0x1705d4['push']('\x22'+_0x3b578e+'\x22');}else{_0x3c7381[_0x867b('0x1a')](_0x867b('0x71'));}break;case _0x867b('0x72'):if(isEmail(_0x25b752)){_0x1705d4['push']('\x22'+_0x25b752+'\x22');}else{_0x3c7381[_0x867b('0x1a')](_0x867b('0x73'));}break;case'dateOfBirth':var _0x11ae34=moment(_0x25b752,_0x867b('0x74'),!![]);if(_0x11ae34['isValid']()){_0x1705d4[_0x867b('0x1a')]('\x22'+_0x25b752+'\x22');}else{_0x3c7381['push'](_0x867b('0x75'));}break;default:_0x1705d4['push']('\x22'+_0x25b752+'\x22');}}else{switch(_0x2a5d9c){case _0x867b('0x76'):case'phone':_0x3c7381['push'](_0x2a5d9c+_0x867b('0x77'));break;default:_0x1705d4['push']('\x22\x22');}}}}else{var _0x5c1748='';for(var _0x13889a=0x0;_0x13889a<_0x142b0c[_0x2a5d9c][_0x867b('0x20')];_0x13889a++){var _0x25b752=_['trim'](_0x3f298d[_0x867b('0x69')][_0x5910c2][_0x142b0c[_0x2a5d9c][_0x13889a]][_0x867b('0x78')](/"/g,'\x27'));if(_0x5c1748=='')_0x5c1748=_0x25b752;else _0x5c1748+='|'+_0x25b752;}_0x147049['push'](_0x4530a0['id']+':'+_0x5c1748);}}if(hasAdditionalPhones){_0x1705d4[_0x867b('0x1a')]('\x22'+_0x147049[_0x867b('0x11')](';')+'\x22');}if(_0x3c7381[_0x867b('0x20')]){handleError(_0x3f298d[_0x867b('0x69')][_0x5910c2],{'code':_0x867b('0x79'),'message':_0x3c7381['join']()});}else{fs[_0x867b('0x7a')](_0x28275e,_0x1705d4[_0x867b('0x11')]()+'\x0a');}_0x1705d4=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x867b('0x7b')+_0x5daeae,stats);stats[_0x867b('0x56')]=[];}}if(stopped){logger[_0x867b('0x58')](_0x867b('0x7c'));_0x1fbf94[_0x867b('0x7d')]();}}catch(_0x2af359){handleError(_0x3f298d[_0x867b('0x69')][_0x5910c2],{'code':'SystemError','message':_0x2af359[_0x867b('0x1e')]});logger['error']('step',_0x2af359[_0x867b('0x1e')]);}},'complete':function(){try{var _0x783dd9=[];var _0xad3f07=tempTableName;_0x783dd9['push'](_0x867b('0x7e')+_0xad3f07+_0x867b('0x7f'));logger[_0x867b('0x58')](_0x867b('0x80'),contactItemTypes[_0x867b('0x20')]);var _0x3e65c5=util[_0x867b('0xa')](_0x867b('0x81'),_0x28275e,_0xad3f07,_0x1bf2be,_0x292dfd[_0x867b('0x32')],_0x292dfd[_0x867b('0x50')]||null,NOW,NOW);if(_[_0x867b('0x18')](_0x142b0c[_0x867b('0x6d')])){_0x3e65c5+=_0x867b('0x82');}_0x783dd9[_0x867b('0x1a')](_0x3e65c5);BPromise[_0x867b('0x83')](_0x783dd9,handleQuery)[_0x867b('0x1b')](function(_0xa7c335){BPromise[_0x867b('0x21')]([handleAdditionalPhones()])[_0x867b('0x1b')](function(){_0x783dd9=[];for(var _0x5f9b93=0x0;_0x5f9b93\x20\x20');}var _0xcc0033=path['join'](config['root'],'server/files/tmp',process[_0x867b('0x8d')][0x2]);if(!fs[_0x867b('0x8e')](_0xcc0033)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x42184c={};try{_0x42184c=JSON[_0x867b('0x67')](process['argv'][0x3]);if(!_0x42184c[_0x867b('0x5e')]){throw new Error(_0x867b('0x8f'));}var _0x4015c6=0x0;if(_0x42184c['binding'][_0x867b('0x35')]){_0x4015c6=0x1;}if(!_0x42184c['ListId']){throw new Error(_0x867b('0x90'));}}catch(_0x33cb75){throw new Error(_0x867b('0x91'));}var _0x57fa3f=[];try{_0x57fa3f=_[_0x867b('0x92')](JSON[_0x867b('0x67')](process[_0x867b('0x8d')][0x4]),'id');}catch(_0x35de54){logger[_0x867b('0x58')](_0x867b('0x93'));}main(_0xcc0033,_0x42184c,_0x57fa3f,_0x4015c6);}validate();process['on'](_0x867b('0x94'),handleStop);process['on'](_0x867b('0x95'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index d727ac2..2aeeaca 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 _0x19e1=['destexten','Queue','uniqueid','Date','agentcalledAt','string','***\x20Agent\x20Info\x20***','Agent\x20Name','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','destcalleridnum','Member\x20Name','Answer\x20Time','answertime','Duration','Billable\x20Time','billableseconds','getSubjects','toLowerCase','voice','inbound','push','queue','variable','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To'];(function(_0x3c5e8b,_0x17513d){var _0x1784b6=function(_0x31cb23){while(--_0x31cb23){_0x3c5e8b['push'](_0x3c5e8b['shift']());}};_0x1784b6(++_0x17513d);}(_0x19e1,0x163));var _0x119e=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x19e1[_0x6a0266];return _0x309e00;};'use strict';exports[_0x119e('0x0')]=function(_0x42d6ce,_0x2fe89e){var _0x143a11=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x42d6ce[_0x119e('0x1')]()){case _0x119e('0x2'):switch(_0x2fe89e['toLowerCase']()){case _0x119e('0x3'):_0x143a11[_0x119e('0x4')]({'type':'variable','content':'','variableName':_0x119e('0x5')});_0x143a11['push']({'type':_0x119e('0x6'),'content':'','variableName':_0x119e('0x7')});break;case _0x119e('0x8'):_0x143a11[_0x119e('0x4')]({'type':'string','content':_0x119e('0x9'),'variableName':null});_0x143a11[_0x119e('0x4')]({'type':_0x119e('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x143a11;};exports['getDescriptions']=function(_0x391163,_0xc2c4a7){var _0x3199b1=[];switch(_0x391163[_0x119e('0x1')]()){case _0x119e('0x2'):switch(_0xc2c4a7[_0x119e('0x1')]()){case _0x119e('0x3'):_0x3199b1=[{'type':'string','content':_0x119e('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0xc'),'keyType':_0x119e('0x6'),'variableName':_0x119e('0x7')},{'type':_0x119e('0xb'),'content':'','key':'Caller\x20Name','keyType':_0x119e('0x6'),'variableName':_0x119e('0xd')},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0xe'),'keyType':_0x119e('0x6'),'variableName':_0x119e('0xf')},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x10'),'keyType':_0x119e('0x6'),'variableName':_0x119e('0x5')},{'type':_0x119e('0xb'),'content':'','key':'UniqueId','keyType':_0x119e('0x6'),'variableName':_0x119e('0x11')},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x12'),'keyType':_0x119e('0x6'),'variableName':_0x119e('0x13')},{'type':_0x119e('0x14'),'content':_0x119e('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x16'),'keyType':_0x119e('0x6'),'variableName':'destcalleridname'},{'type':_0x119e('0xb'),'content':'','key':'Agent\x20Number','keyType':_0x119e('0x6'),'variableName':'destcalleridnum'},{'type':_0x119e('0x14'),'content':_0x119e('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x119e('0x6'),'variableName':_0x119e('0x13')},{'type':_0x119e('0xb'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x119e('0x18')},{'type':'keyValue','content':'','key':_0x119e('0x19'),'keyType':_0x119e('0x6'),'variableName':_0x119e('0x1a')},{'type':'keyValue','content':'','key':_0x119e('0x1b'),'keyType':'variable','variableName':_0x119e('0x1c')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x119e('0x6'),'variableName':_0x119e('0x1d')}];break;case _0x119e('0x8'):_0x3199b1=[{'type':_0x119e('0x14'),'content':_0x119e('0xa'),'variableName':null},{'type':_0x119e('0xb'),'content':'','key':'Called\x20Number','keyType':_0x119e('0x6'),'keyContent':'','variableName':_0x119e('0x1e')},{'type':'keyValue','content':'','key':_0x119e('0x1f'),'keyType':_0x119e('0x6'),'keyContent':'','variableName':'membername'},{'type':_0x119e('0xb'),'content':'','key':'UniqueId','keyType':_0x119e('0x6'),'keyContent':'','variableName':_0x119e('0x11')},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x12'),'keyType':_0x119e('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0x119e('0x14'),'content':_0x119e('0x17')},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x20'),'keyType':_0x119e('0x6'),'keyContent':'','variableName':_0x119e('0x21')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x22'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x119e('0xb'),'content':'','key':_0x119e('0x23'),'keyType':'variable','keyContent':'','variableName':_0x119e('0x24')}];break;}}return _0x3199b1;}; \ No newline at end of file +var _0x0b0e=['Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','UniqueId','Date','answertime','Complete\x20Time','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','uniqueid','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt'];(function(_0x472ee2,_0x295444){var _0x18387b=function(_0x320611){while(--_0x320611){_0x472ee2['push'](_0x472ee2['shift']());}};_0x18387b(++_0x295444);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0x0b0e[_0x3b08de];return _0x53fbe4;};'use strict';exports[_0xe0b0('0x0')]=function(_0x503596,_0xc416e3){var _0x536e9b=[{'type':_0xe0b0('0x1'),'content':_0xe0b0('0x2'),'variableName':null}];switch(_0x503596[_0xe0b0('0x3')]()){case _0xe0b0('0x4'):switch(_0xc416e3[_0xe0b0('0x3')]()){case _0xe0b0('0x5'):_0x536e9b[_0xe0b0('0x6')]({'type':_0xe0b0('0x7'),'content':'','variableName':_0xe0b0('0x8')});_0x536e9b[_0xe0b0('0x6')]({'type':_0xe0b0('0x7'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x536e9b[_0xe0b0('0x6')]({'type':_0xe0b0('0x1'),'content':_0xe0b0('0x9'),'variableName':null});_0x536e9b[_0xe0b0('0x6')]({'type':'variable','content':'','variableName':_0xe0b0('0xa')});break;}}return _0x536e9b;};exports[_0xe0b0('0xb')]=function(_0x553d4f,_0x1fef28){var _0x2f32b6=[];switch(_0x553d4f['toLowerCase']()){case _0xe0b0('0x4'):switch(_0x1fef28[_0xe0b0('0x3')]()){case _0xe0b0('0x5'):_0x2f32b6=[{'type':'string','content':_0xe0b0('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0xe'),'keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0xf')},{'type':'keyValue','content':'','key':_0xe0b0('0x10'),'keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0x11')},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x12'),'keyType':'variable','variableName':_0xe0b0('0x13')},{'type':'keyValue','content':'','key':_0xe0b0('0x14'),'keyType':_0xe0b0('0x7'),'variableName':'queue'},{'type':_0xe0b0('0xd'),'content':'','key':'UniqueId','keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0x15')},{'type':'keyValue','content':'','key':'Date','keyType':_0xe0b0('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xe0b0('0x16')},{'type':'keyValue','content':'','key':_0xe0b0('0x17'),'keyType':'variable','variableName':_0xe0b0('0xa')},{'type':_0xe0b0('0x1'),'content':_0xe0b0('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x19'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0xe0b0('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0x1a')},{'type':'keyValue','content':'','key':_0xe0b0('0x1b'),'keyType':'variable','variableName':_0xe0b0('0x1c')},{'type':'keyValue','content':'','key':_0xe0b0('0x1d'),'keyType':'variable','variableName':_0xe0b0('0x1e')},{'type':'keyValue','content':'','key':_0xe0b0('0x1f'),'keyType':'variable','variableName':_0xe0b0('0x20')}];break;case'outbound':_0x2f32b6=[{'type':_0xe0b0('0x1'),'content':_0xe0b0('0xc'),'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x21'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0xa')},{'type':'keyValue','content':'','key':_0xe0b0('0x22'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x23'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x15')},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x24'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0xe0b0('0x1'),'content':_0xe0b0('0x18')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x25')},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x26'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x27'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x28')},{'type':_0xe0b0('0xd'),'content':'','key':'Billable\x20Time','keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x29')}];break;}}return _0x2f32b6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 103d5fb..974fe04 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 _0x1c55=['unknown','toLowerCase','toUpperCase','name','role','null','findOne','catch','error','tracked','user','query','clone','omit','html','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1c55,0x1e3));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x51c5('0x0'));var db=require(_0x51c5('0x1'))['db'];var loggers={'openchannel':require(_0x51c5('0x2'))(_0x51c5('0x3')),'mail':require(_0x51c5('0x2'))(_0x51c5('0x4')),'fax':require(_0x51c5('0x2'))(_0x51c5('0x5')),'sms':require(_0x51c5('0x2'))(_0x51c5('0x6')),'chat':require('../../config/logger')(_0x51c5('0x7')),'whatsapp':require(_0x51c5('0x2'))(_0x51c5('0x8'))};function getInteractionId(_0x41381e,_0x128d65,_0x3f76fc){if(_0x41381e&&_0x41381e[_[_0x51c5('0x9')](_0x3f76fc)+_0x51c5('0xa')]){return _0x41381e[_[_0x51c5('0x9')](_0x3f76fc)+_0x51c5('0xa')];}else if(_0x41381e&&_0x41381e['id']){return _0x41381e['id'];}else if(_0x128d65&&_0x128d65['id']){return _0x128d65['id'];}else{return _0x51c5('0xb');}}function log(_0x36b693,_0x2c1fdd,_0x5561fe,_0x59f7bc,_0x578c90,_0x4684d4){loggers[_0x578c90[_0x51c5('0xc')]()][_0x36b693]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4684d4[_0x51c5('0xd')](),_0x2c1fdd?_0x2c1fdd['id']:null,_0x2c1fdd?_0x2c1fdd[_0x51c5('0xe')]:null,_0x2c1fdd?_0x2c1fdd[_0x51c5('0xf')]:null,getInteractionId(_0x5561fe,_0x59f7bc,_0x578c90),_0x5561fe?JSON['stringify'](_0x5561fe):_0x51c5('0x10'));}function updateUser(_0x530eba,_0x377450,_0x10c886,_0x46fe03,_0x4084d5){db[_['upperFirst'](_0x46fe03)+'Interaction'][_0x51c5('0x11')]({'where':{'id':getInteractionId(_0x377450,_0x10c886,_0x46fe03)}})['then'](function(_0x585f27){if(_0x585f27){return _0x585f27['update']({'UserId':_0x530eba?_0x530eba['id']:null});}})['then'](function(_0x24305a){if(_0x24305a){log('info',_0x530eba,_0x377450,_0x10c886,_0x46fe03,_0x4084d5);}})[_0x51c5('0x12')](function(){log(_0x51c5('0x13'),_0x530eba,_0x377450,_0x10c886,_0x46fe03,_0x4084d5);});}exports[_0x51c5('0x14')]=function(_0x1b373e,_0x3c2d5b){return function(_0x187f11,_0x4252a1,_0x40c54d){var _0x5f4c33=_0x187f11[_0x51c5('0x15')];var _0x26cf79={};var _0x2dc591=_0x187f11[_0x51c5('0x16')];if(_0x26cf79){_0x26cf79=_[_0x51c5('0x17')](_0x187f11['body']);_0x26cf79=_[_0x51c5('0x18')](_0x26cf79,['body',_0x51c5('0x19'),'phone','fax','mobile']);}updateUser(_0x5f4c33,_0x26cf79,_0x2dc591,_0x1b373e,_0x3c2d5b);_0x40c54d(null);};}; \ No newline at end of file +var _0x2821=['Interaction','then','update','info','catch','error','user','clone','body','omit','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','InteractionId','toUpperCase','name','role','upperFirst'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x2821,0xc3));var _0x1282=function(_0x4d1456,_0x580ab8){_0x4d1456=_0x4d1456-0x0;var _0x41477c=_0x2821[_0x4d1456];return _0x41477c;};'use strict';var _=require(_0x1282('0x0'));var db=require(_0x1282('0x1'))['db'];var loggers={'openchannel':require(_0x1282('0x2'))(_0x1282('0x3')),'mail':require(_0x1282('0x2'))(_0x1282('0x4')),'fax':require('../../config/logger')(_0x1282('0x5')),'sms':require(_0x1282('0x2'))('sms-interactions'),'chat':require(_0x1282('0x2'))(_0x1282('0x6')),'whatsapp':require(_0x1282('0x2'))(_0x1282('0x7'))};function getInteractionId(_0xb5be26,_0x17a244,_0x296ffc){if(_0xb5be26&&_0xb5be26[_['upperFirst'](_0x296ffc)+_0x1282('0x8')]){return _0xb5be26[_['upperFirst'](_0x296ffc)+'InteractionId'];}else if(_0xb5be26&&_0xb5be26['id']){return _0xb5be26['id'];}else if(_0x17a244&&_0x17a244['id']){return _0x17a244['id'];}else{return'unknown';}}function log(_0x4557b8,_0xb4f761,_0x3aba30,_0x5c34ec,_0x1321ba,_0x1cbfdd){loggers[_0x1321ba['toLowerCase']()][_0x4557b8]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1cbfdd[_0x1282('0x9')](),_0xb4f761?_0xb4f761['id']:null,_0xb4f761?_0xb4f761[_0x1282('0xa')]:null,_0xb4f761?_0xb4f761[_0x1282('0xb')]:null,getInteractionId(_0x3aba30,_0x5c34ec,_0x1321ba),_0x3aba30?JSON['stringify'](_0x3aba30):'null');}function updateUser(_0x34edb0,_0x36097f,_0x548899,_0x1ce472,_0x2adb1e){db[_[_0x1282('0xc')](_0x1ce472)+_0x1282('0xd')]['findOne']({'where':{'id':getInteractionId(_0x36097f,_0x548899,_0x1ce472)}})[_0x1282('0xe')](function(_0x5a16bf){if(_0x5a16bf){return _0x5a16bf[_0x1282('0xf')]({'UserId':_0x34edb0?_0x34edb0['id']:null});}})[_0x1282('0xe')](function(_0x4fa391){if(_0x4fa391){log(_0x1282('0x10'),_0x34edb0,_0x36097f,_0x548899,_0x1ce472,_0x2adb1e);}})[_0x1282('0x11')](function(){log(_0x1282('0x12'),_0x34edb0,_0x36097f,_0x548899,_0x1ce472,_0x2adb1e);});}exports['tracked']=function(_0x328137,_0x1eb198){return function(_0x2d9173,_0x3c218d,_0x137878){var _0x268f74=_0x2d9173[_0x1282('0x13')];var _0x41f02e={};var _0x4fbbf1=_0x2d9173['query'];if(_0x41f02e){_0x41f02e=_[_0x1282('0x14')](_0x2d9173[_0x1282('0x15')]);_0x41f02e=_[_0x1282('0x16')](_0x41f02e,[_0x1282('0x15'),'html',_0x1282('0x17'),_0x1282('0x18'),_0x1282('0x19')]);}updateUser(_0x268f74,_0x41f02e,_0x4fbbf1,_0x328137,_0x1eb198);_0x137878(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0ebee20..88d5b6e 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 _0xed87=['catch','users','User','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x4ccf2b,_0x4a31af){var _0x4f4053=function(_0xdd3729){while(--_0xdd3729){_0x4ccf2b['push'](_0x4ccf2b['shift']());}};_0x4f4053(++_0x4a31af);}(_0xed87,0x83));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var crypto=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x7ed8('0x2'));function getValueFromLicense(_0x34b510,_0x27a401){if(_0x34b510&&_0x27a401){if(_0x27a401[_0x7ed8('0x3')]&&_0x27a401[_0x7ed8('0x4')]){var _0xf7d7bf=_0x27a401[_0x7ed8('0x3')];var _0x5015bb=_0x27a401['license'];var _0x4af3b0=_0xf7d7bf[_0x7ed8('0x5')]('-')[0x4];var _0xa605c5=_0xf7d7bf[_0x7ed8('0x5')]('-')[0x0];var _0x34e9dd=crypto['createDecipher'](_0x7ed8('0x6'),util[_0x7ed8('0x7')](_0x7ed8('0x8'),_0x4af3b0,_0xf7d7bf,_0xa605c5));var _0x5bca7a=_0x34e9dd[_0x7ed8('0x9')](_0x5015bb,_0x7ed8('0xa'),_0x7ed8('0xb'));_0x5bca7a+=_0x34e9dd['final'](_0x7ed8('0xb'));var _0x126a68=JSON['parse'](_0x5bca7a);return _0x126a68[_0x7ed8('0xc')](_0x34b510)?_0x126a68[_0x34b510]:null;}}return null;}function isLimit(_0x236527,_0x123d68,_0x2b6899,_0x4f38ef){var _0x1e0dba=_0x123d68;return compose()[_0x7ed8('0xd')](function(_0x589f52,_0x2fe60a,_0x86c001){return db['License'][_0x7ed8('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x7ed8('0xf')](function(_0x59c4d3){var _0x462250=getValueFromLicense(_0x236527,_0x59c4d3);return _0x462250?_0x462250:_0x1e0dba;})['then'](function(_0x27a723){_0x1e0dba=_0x27a723;return _0x2b6899['count'](_0x4f38ef);})[_0x7ed8('0xf')](function(_0x440ed7){if(_0x440ed7>=_0x1e0dba){return _0x2fe60a[_0x7ed8('0x10')](0x193)[_0x7ed8('0x11')]({'message':util[_0x7ed8('0x7')](_0x7ed8('0x12'),_0x236527)});}_0x86c001();})[_0x7ed8('0x13')](function(_0x3ef92e){_0x86c001(_0x3ef92e);});});}function isUserLimit(){return isLimit(_0x7ed8('0x14'),0x1,db[_0x7ed8('0x15')],{'where':{'$or':[{'role':_0x7ed8('0x16')},{'role':_0x7ed8('0x17')}]}});}exports[_0x7ed8('0x18')]=isUserLimit; \ No newline at end of file +var _0xc805=['License','findOne','then','count','catch','users','User','admin','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','hasOwnProperty','use'];(function(_0x9f1a0c,_0x14b790){var _0x34d0d4=function(_0x33bd17){while(--_0x33bd17){_0x9f1a0c['push'](_0x9f1a0c['shift']());}};_0x34d0d4(++_0x14b790);}(_0xc805,0x18f));var _0x5c80=function(_0x52a7e1,_0x189bf3){_0x52a7e1=_0x52a7e1-0x0;var _0x4f4495=_0xc805[_0x52a7e1];return _0x4f4495;};'use strict';var crypto=require('crypto');var util=require(_0x5c80('0x0'));var compose=require(_0x5c80('0x1'));var db=require(_0x5c80('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x37e37e,_0x270d62){if(_0x37e37e&&_0x270d62){if(_0x270d62[_0x5c80('0x3')]&&_0x270d62[_0x5c80('0x4')]){var _0x346a73=_0x270d62[_0x5c80('0x3')];var _0x53fb7f=_0x270d62[_0x5c80('0x4')];var _0x5a56af=_0x346a73['split']('-')[0x4];var _0x13ba78=_0x346a73[_0x5c80('0x5')]('-')[0x0];var _0x41e6a2=crypto[_0x5c80('0x6')](_0x5c80('0x7'),util[_0x5c80('0x8')](_0x5c80('0x9'),_0x5a56af,_0x346a73,_0x13ba78));var _0xdc2ad5=_0x41e6a2[_0x5c80('0xa')](_0x53fb7f,'base64',_0x5c80('0xb'));_0xdc2ad5+=_0x41e6a2['final'](_0x5c80('0xb'));var _0x3ab96a=JSON[_0x5c80('0xc')](_0xdc2ad5);return _0x3ab96a[_0x5c80('0xd')](_0x37e37e)?_0x3ab96a[_0x37e37e]:null;}}return null;}function isLimit(_0x59e139,_0xece3c,_0x1ee175,_0x54a9f1){var _0x35d661=_0xece3c;return compose()[_0x5c80('0xe')](function(_0x410bc3,_0x2e9822,_0x342e32){return db[_0x5c80('0xf')][_0x5c80('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xf39426){var _0x3b4441=getValueFromLicense(_0x59e139,_0xf39426);return _0x3b4441?_0x3b4441:_0x35d661;})[_0x5c80('0x11')](function(_0x3f2700){_0x35d661=_0x3f2700;return _0x1ee175[_0x5c80('0x12')](_0x54a9f1);})[_0x5c80('0x11')](function(_0x39cd9c){if(_0x39cd9c>=_0x35d661){return _0x2e9822['status'](0x193)['json']({'message':util[_0x5c80('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x59e139)});}_0x342e32();})[_0x5c80('0x13')](function(_0x345a2a){_0x342e32(_0x345a2a);});});}function isUserLimit(){return isLimit(_0x5c80('0x14'),0x1,db[_0x5c80('0x15')],{'where':{'$or':[{'role':_0x5c80('0x16')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index cf558f5..5f9dfd1 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 _0xf5c5=['match','forEach','filter','map','conditions','push','buildExpression','operator','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','field','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','=\x20?','$ne','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','format','hours','minutes','lodash','moment','parseSearch','startsWith','[$or]','and','[$and]','replace','split','shift'];(function(_0x1eafda,_0x42533a){var _0x238ebc=function(_0xa57274){while(--_0xa57274){_0x1eafda['push'](_0x1eafda['shift']());}};_0x238ebc(++_0x42533a);}(_0xf5c5,0xda));var _0x5f5c=function(_0x424b6b,_0x198d98){_0x424b6b=_0x424b6b-0x0;var _0x1ee284=_0xf5c5[_0x424b6b];return _0x1ee284;};'use strict';var _=require(_0x5f5c('0x0'));var moment=require(_0x5f5c('0x1'));exports[_0x5f5c('0x2')]=function(_0x5d3035){var _0x256eaa={'conditions':[]};_0x256eaa['sqlOperator']=_[_0x5f5c('0x3')](_0x5d3035,_0x5f5c('0x4'))?'or':_0x5f5c('0x5');var _0x3814ce=_0x5d3035['replace'](_0x5f5c('0x6'),'')[_0x5f5c('0x7')](_0x5f5c('0x4'),'')['split']('||');for(var _0x428f3f=0x0;_0x428f3f<_0x3814ce['length'];_0x428f3f++){var _0x123cdc=_0x3814ce[_0x428f3f]['split'](':=');var _0x384b8f=_0x123cdc[0x0];var _0x296c23=_0x123cdc['slice'](0x1);_0x296c23['forEach'](function(_0xcbaee5){var _0x38ec9a=_0xcbaee5[_0x5f5c('0x8')]('[')[_0x5f5c('0x9')]();var _0x24087d=_0xcbaee5[_0x5f5c('0xa')](/\[(.*?)\]/g);_0x24087d[_0x5f5c('0xb')](function(_0x3bd001){var _0x5341de=_0x3bd001[_0x5f5c('0x8')]('[')[_0x5f5c('0xc')](function(_0x4def42){return _0x4def42['indexOf'](']')>-0x1;})[_0x5f5c('0xd')](function(_0x47ff1a){return _0x47ff1a[_0x5f5c('0x8')](']')[0x0];})[0x0];_0x256eaa[_0x5f5c('0xe')][_0x5f5c('0xf')]({'field':_0x384b8f,'operator':_0x38ec9a,'value':_0x5341de});});});}return _0x256eaa;};exports[_0x5f5c('0x10')]=function(_0x122cbd,_0x50237e,_0x3d3d01){var _0x1aa58c={};if(_0x50237e==='DATE'){if(_0x3d3d01[_0x5f5c('0x11')]==='$eq'){_0x3d3d01[_0x5f5c('0x11')]='$between';_0x3d3d01[_0x5f5c('0x12')]+=','+_0x3d3d01['value'];}else if(_[_0x5f5c('0x13')]([_0x5f5c('0x14'),_0x5f5c('0x15')],_0x3d3d01[_0x5f5c('0x11')])){_0x3d3d01[_0x5f5c('0x12')]=moment(_0x3d3d01[_0x5f5c('0x12')])[_0x5f5c('0x16')](0x1,_0x5f5c('0x17'))['format'](_0x5f5c('0x18'));}}if(_0x3d3d01['castTo']){_0x50237e=_0x3d3d01[_0x5f5c('0x19')];_0x1aa58c['text']=_0x5f5c('0x1a')+_0x122cbd+'.'+_0x3d3d01['field']+_0x5f5c('0x1b')+_0x3d3d01[_0x5f5c('0x19')]+')\x20'+parseOperator(_0x3d3d01[_0x5f5c('0x11')]);}else{_0x1aa58c[_0x5f5c('0x1c')]=_0x122cbd+'.'+_0x3d3d01[_0x5f5c('0x1d')]+'\x20'+parseOperator(_0x3d3d01['operator']);}if(_[_0x5f5c('0x13')](['$ne','$notIn'],_0x3d3d01[_0x5f5c('0x11')]))_0x1aa58c[_0x5f5c('0x1c')]='('+_0x1aa58c['text']+_0x5f5c('0x1e')+_0x122cbd+'.'+_0x3d3d01[_0x5f5c('0x1d')]+_0x5f5c('0x1f');_0x1aa58c[_0x5f5c('0x12')]=parseValue(_0x50237e,_0x3d3d01[_0x5f5c('0x11')],_0x3d3d01['value']);return _0x1aa58c;};function parseOperator(_0x9ec9ee){var _0x572892;switch(_0x9ec9ee){case _0x5f5c('0x20'):_0x572892=_0x5f5c('0x21');break;case _0x5f5c('0x22'):_0x572892=_0x5f5c('0x23');break;case _0x5f5c('0x24'):_0x572892=_0x5f5c('0x25');break;case _0x5f5c('0x26'):_0x572892='<>\x20?';break;case _0x5f5c('0x27'):case _0x5f5c('0x28'):case _0x5f5c('0x29'):_0x572892=_0x5f5c('0x2a');break;case'$lt':_0x572892=_0x5f5c('0x2b');break;case _0x5f5c('0x14'):_0x572892=_0x5f5c('0x2c');break;case _0x5f5c('0x15'):_0x572892=_0x5f5c('0x2d');break;case _0x5f5c('0x2e'):_0x572892=_0x5f5c('0x2f');break;case _0x5f5c('0x30'):_0x572892=_0x5f5c('0x31');break;}return _0x572892;}function parseValue(_0x400b4c,_0x487435,_0x58bcd1){var _0x54776b={'start':undefined,'end':undefined};switch(_0x487435){case _0x5f5c('0x20'):case'$notIn':_0x54776b[_0x5f5c('0x32')]=_0x58bcd1[_0x5f5c('0x8')](',');break;case _0x5f5c('0x27'):_0x54776b[_0x5f5c('0x32')]='%'+_0x58bcd1+'%';break;case'$startsWith':_0x54776b['start']=_0x58bcd1+'%';break;case _0x5f5c('0x29'):_0x54776b[_0x5f5c('0x32')]='%'+_0x58bcd1;break;case'$between':var _0x4018a0=_0x58bcd1['split'](',');var _0x58bcd1=_0x4018a0[_0x5f5c('0x9')]();var _0x13f99f=_0x4018a0[_0x5f5c('0x33')]();if(_0x400b4c===_0x5f5c('0x34')){_0x58bcd1=moment(_0x58bcd1)[_0x5f5c('0x35')](0x0,!![])[_0x5f5c('0x36')]();_0x13f99f=moment(_0x13f99f)[_0x5f5c('0x35')](0x0,!![])['add'](0x17,_0x5f5c('0x37'))[_0x5f5c('0x16')](0x3b,_0x5f5c('0x38'))[_0x5f5c('0x16')](0x3b,'seconds')['format']();}_0x54776b={'start':_0x58bcd1,'end':_0x13f99f};break;default:_0x54776b[_0x5f5c('0x32')]=_0x58bcd1;break;}return _0x54776b;} \ No newline at end of file +var _0x4437=['field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','minutes','seconds','parseSearch','sqlOperator','[$or]','replace','[$and]','split','length','shift','match','filter','map','push','buildExpression','operator','$eq','$between','value','includes','add','days','format','YYYY-MM-DD','castTo','text','CAST('];(function(_0x1390a0,_0x499668){var _0x359f67=function(_0x3daff4){while(--_0x3daff4){_0x1390a0['push'](_0x1390a0['shift']());}};_0x359f67(++_0x499668);}(_0x4437,0x1a0));var _0x7443=function(_0x48dcd1,_0xb994e){_0x48dcd1=_0x48dcd1-0x0;var _0x195984=_0x4437[_0x48dcd1];return _0x195984;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x7443('0x0')]=function(_0xae3880){var _0x176892={'conditions':[]};_0x176892[_0x7443('0x1')]=_['startsWith'](_0xae3880,_0x7443('0x2'))?'or':'and';var _0x16b5de=_0xae3880[_0x7443('0x3')](_0x7443('0x4'),'')[_0x7443('0x3')]('[$or]','')[_0x7443('0x5')]('||');for(var _0x4de4d4=0x0;_0x4de4d4<_0x16b5de[_0x7443('0x6')];_0x4de4d4++){var _0x51a1b8=_0x16b5de[_0x4de4d4]['split'](':=');var _0x460a46=_0x51a1b8[0x0];var _0xa55a8c=_0x51a1b8['slice'](0x1);_0xa55a8c['forEach'](function(_0x2ac35b){var _0x1df940=_0x2ac35b['split']('[')[_0x7443('0x7')]();var _0x10ce3b=_0x2ac35b[_0x7443('0x8')](/\[(.*?)\]/g);_0x10ce3b['forEach'](function(_0x1a2bd8){var _0x4d29b0=_0x1a2bd8[_0x7443('0x5')]('[')[_0x7443('0x9')](function(_0x59983e){return _0x59983e['indexOf'](']')>-0x1;})[_0x7443('0xa')](function(_0x3159c2){return _0x3159c2[_0x7443('0x5')](']')[0x0];})[0x0];_0x176892['conditions'][_0x7443('0xb')]({'field':_0x460a46,'operator':_0x1df940,'value':_0x4d29b0});});});}return _0x176892;};exports[_0x7443('0xc')]=function(_0x45a79d,_0x48a939,_0x4f33e6){var _0x158f72={};if(_0x48a939==='DATE'){if(_0x4f33e6[_0x7443('0xd')]===_0x7443('0xe')){_0x4f33e6[_0x7443('0xd')]=_0x7443('0xf');_0x4f33e6[_0x7443('0x10')]+=','+_0x4f33e6[_0x7443('0x10')];}else if(_[_0x7443('0x11')](['$gt','$lte'],_0x4f33e6[_0x7443('0xd')])){_0x4f33e6[_0x7443('0x10')]=moment(_0x4f33e6[_0x7443('0x10')])[_0x7443('0x12')](0x1,_0x7443('0x13'))[_0x7443('0x14')](_0x7443('0x15'));}}if(_0x4f33e6[_0x7443('0x16')]){_0x48a939=_0x4f33e6[_0x7443('0x16')];_0x158f72[_0x7443('0x17')]=_0x7443('0x18')+_0x45a79d+'.'+_0x4f33e6[_0x7443('0x19')]+_0x7443('0x1a')+_0x4f33e6['castTo']+')\x20'+parseOperator(_0x4f33e6[_0x7443('0xd')]);}else{_0x158f72['text']=_0x45a79d+'.'+_0x4f33e6[_0x7443('0x19')]+'\x20'+parseOperator(_0x4f33e6[_0x7443('0xd')]);}if(_[_0x7443('0x11')]([_0x7443('0x1b'),_0x7443('0x1c')],_0x4f33e6[_0x7443('0xd')]))_0x158f72['text']='('+_0x158f72[_0x7443('0x17')]+_0x7443('0x1d')+_0x45a79d+'.'+_0x4f33e6['field']+_0x7443('0x1e');_0x158f72['value']=parseValue(_0x48a939,_0x4f33e6['operator'],_0x4f33e6['value']);return _0x158f72;};function parseOperator(_0x4ae9e6){var _0x4621c7;switch(_0x4ae9e6){case _0x7443('0x1f'):_0x4621c7=_0x7443('0x20');break;case _0x7443('0x1c'):_0x4621c7=_0x7443('0x21');break;case _0x7443('0xe'):_0x4621c7=_0x7443('0x22');break;case _0x7443('0x1b'):_0x4621c7=_0x7443('0x23');break;case _0x7443('0x24'):case'$startsWith':case _0x7443('0x25'):_0x4621c7=_0x7443('0x26');break;case'$lt':_0x4621c7='<\x20?';break;case'$gt':_0x4621c7=_0x7443('0x27');break;case _0x7443('0x28'):_0x4621c7=_0x7443('0x29');break;case _0x7443('0x2a'):_0x4621c7=_0x7443('0x2b');break;case _0x7443('0xf'):_0x4621c7=_0x7443('0x2c');break;}return _0x4621c7;}function parseValue(_0x5f30ff,_0x6b0fc9,_0x322c66){var _0x5e5018={'start':undefined,'end':undefined};switch(_0x6b0fc9){case _0x7443('0x1f'):case _0x7443('0x1c'):_0x5e5018[_0x7443('0x2d')]=_0x322c66[_0x7443('0x5')](',');break;case _0x7443('0x24'):_0x5e5018[_0x7443('0x2d')]='%'+_0x322c66+'%';break;case'$startsWith':_0x5e5018[_0x7443('0x2d')]=_0x322c66+'%';break;case _0x7443('0x25'):_0x5e5018[_0x7443('0x2d')]='%'+_0x322c66;break;case _0x7443('0xf'):var _0x43979d=_0x322c66[_0x7443('0x5')](',');var _0x322c66=_0x43979d[_0x7443('0x7')]();var _0x4ee9a2=_0x43979d['pop']();if(_0x5f30ff==='DATE'){_0x322c66=moment(_0x322c66)[_0x7443('0x2e')](0x0,!![])[_0x7443('0x14')]();_0x4ee9a2=moment(_0x4ee9a2)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0x7443('0x12')](0x3b,_0x7443('0x2f'))[_0x7443('0x12')](0x3b,_0x7443('0x30'))[_0x7443('0x14')]();}_0x5e5018={'start':_0x322c66,'end':_0x4ee9a2};break;default:_0x5e5018[_0x7443('0x2d')]=_0x322c66;break;}return _0x5e5018;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9880b95..f14c922 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 _0xde1e=['find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','length','omit','isObject','hasOwnProperty','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','join','lodash','sequelize','moment','fields','filters','isEmpty','forOwn'];(function(_0x19194b,_0x473881){var _0x37fb02=function(_0xcdd0f6){while(--_0xcdd0f6){_0x19194b['push'](_0x19194b['shift']());}};_0x37fb02(++_0x473881);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var sequelize=require(_0xede1('0x1'));var moment=require(_0xede1('0x2'));var LIMIT_VALUE=0xfa;exports[_0xede1('0x3')]=function(_0x198cb7){var _0x466322=null;if(_0x198cb7){_0x466322=_0x198cb7['split'](',');}return _0x466322;};exports[_0xede1('0x4')]=function(_0x1e766f,_0x40b40c){var _0x40a726={};if(!_[_0xede1('0x5')](_0x1e766f)){_[_0xede1('0x6')](_0x1e766f,function(_0x4e9527,_0x3a4671){try{if(_0x40b40c){var _0xeeec58=_[_0xede1('0x7')](_0x40b40c,{'name':_0x3a4671})||{};if(_0xeeec58[_0xede1('0x8')]===_0xede1('0x9')&&_[_0xede1('0xa')](_0x4e9527)){var _0x5a2cd6=JSON[_0xede1('0xb')](_0x4e9527);var _0x4bc1f1={'$gte':moment(moment(_0x5a2cd6['$gte'])[_0xede1('0xc')](_0xede1('0xd')))[_0xede1('0xe')]()[_0xede1('0xc')](),'$lte':moment(moment(_0x5a2cd6[_0xede1('0xf')])[_0xede1('0xc')]('YYYY-MM-DD'))[_0xede1('0xe')]()[_0xede1('0x10')](0x1,'s')[_0xede1('0xc')]()};_0x40a726[_0x3a4671]=_0x4bc1f1;}else{_0x40a726[_0x3a4671]=_['isArray'](_0x4e9527)?_0x4e9527:JSON['parse'](_0x4e9527);}}else{_0x40a726[_0x3a4671]=_[_0xede1('0x11')](_0x4e9527)?_0x4e9527:JSON[_0xede1('0xb')](_0x4e9527);}}catch(_0x1c7cb2){_0x40a726[_0x3a4671]=_0x4e9527[_0xede1('0x12')](',');}});}return _0x40a726;};exports[_0xede1('0x13')]=function(_0x4e3575){_0x4e3575=parseInt(_0x4e3575,0xa);if(!_0x4e3575||_0x4e3575<0x0){_0x4e3575=LIMIT_VALUE;}return _0x4e3575;};exports[_0xede1('0x14')]=function(_0x110811){_0x110811=parseInt(_0x110811,0xa);if(!_0x110811||_0x110811<0x0){_0x110811=0x0;}return _0x110811;};exports[_0xede1('0x15')]=function(_0xc3dd7d){var _0x3be8dd,_0x1600ec=null;if(_0xc3dd7d){_0x3be8dd=_0xc3dd7d[_0xede1('0x12')](',');_0x1600ec=_[_0xede1('0x16')](_0x3be8dd,function(_0x5648fb){if(_0x5648fb[_0xede1('0x17')]('-')===0x0){return[_0x5648fb===_0xede1('0x18')?sequelize[_0xede1('0x19')](sequelize[_0xede1('0x1a')](_0xede1('0x18')),_0xede1('0x1b')):_0x5648fb[_0xede1('0x1c')](0x1),_0xede1('0x1d')];}else{return[_0x5648fb===_0xede1('0x18')?sequelize[_0xede1('0x19')](sequelize[_0xede1('0x1a')]('priority'),_0xede1('0x1b')):_0x5648fb,'ASC'];}});}return _0x1600ec;};exports['omit']=function(_0x3dbcdf,_0x1a9734){if(_[_0xede1('0x5')](_0x3dbcdf)){return _0x3dbcdf;}if(_[_0xede1('0x11')](_0x3dbcdf)){for(var _0x21f76b=0x0;_0x21f76b<_0x3dbcdf[_0xede1('0x1e')];_0x21f76b+=0x1){_0x3dbcdf[_0x21f76b]=this[_0xede1('0x1f')](_0x3dbcdf[_0x21f76b],_0x1a9734);}return _0x3dbcdf;}if(!_[_0xede1('0x20')](_0x3dbcdf)){return _0x3dbcdf;}if(_['isString'](_0x1a9734)){_0x1a9734=[_0x1a9734];}if(!_[_0xede1('0x11')](_0x1a9734)){return _0x3dbcdf;}for(var _0x3c13d9=0x0;_0x3c13d9<_0x1a9734['length'];_0x3c13d9+=0x1){_['unset'](_0x3dbcdf,_0x1a9734[_0x3c13d9]);}for(var _0xfff77d in _0x3dbcdf){if(_0x3dbcdf[_0xede1('0x21')](_0xfff77d)){_0x3dbcdf[_0xfff77d]=this['omit'](_0x3dbcdf[_0xfff77d],_0x1a9734);}}return _0x3dbcdf;};exports['isNumeric']=function(_0x47fff3){return _0x47fff3[_0xede1('0x22')](RegExp(_0xede1('0x23')))?!![]:![];};exports[_0xede1('0x24')]=function(_0x1a5569){return _0x1a5569[_0xede1('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xede1('0x25')]=function(_0x2a8ebb){var _0x174ec3=[];_0x2a8ebb[_0xede1('0x12')]('\x20')[_0xede1('0x26')](function(_0x2fddb9){_0x174ec3[_0xede1('0x27')]('+'+_0x2fddb9['toString']()+'*');});return _0x174ec3[_0xede1('0x28')]('\x20');}; \ No newline at end of file +var _0x5afb=['format','YYYY-MM-DD','utc','$lte','subtract','limit','sort','indexOf','priority','cast','col','unsigned','DESC','ASC','isEmpty','isArray','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','^[0-9]*$','match','push','toString','join','lodash','sequelize','fields','split','filters','find','type','DATE','isPlainObject','parse','$gte'];(function(_0x246e1a,_0x30ee98){var _0x19a13c=function(_0x3c4cd8){while(--_0x3c4cd8){_0x246e1a['push'](_0x246e1a['shift']());}};_0x19a13c(++_0x30ee98);}(_0x5afb,0x1c9));var _0xb5af=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0x5afb[_0x4fdc46];return _0x2c178a;};'use strict';var _=require(_0xb5af('0x0'));var sequelize=require(_0xb5af('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xb5af('0x2')]=function(_0x4f14d3){var _0x5661c1=null;if(_0x4f14d3){_0x5661c1=_0x4f14d3[_0xb5af('0x3')](',');}return _0x5661c1;};exports[_0xb5af('0x4')]=function(_0x3dc64c,_0x46ac3d){var _0x34ea77={};if(!_['isEmpty'](_0x3dc64c)){_['forOwn'](_0x3dc64c,function(_0x2a870a,_0x3f882c){try{if(_0x46ac3d){var _0x37eb00=_[_0xb5af('0x5')](_0x46ac3d,{'name':_0x3f882c})||{};if(_0x37eb00[_0xb5af('0x6')]===_0xb5af('0x7')&&_[_0xb5af('0x8')](_0x2a870a)){var _0x186719=JSON[_0xb5af('0x9')](_0x2a870a);var _0x58405f={'$gte':moment(moment(_0x186719[_0xb5af('0xa')])[_0xb5af('0xb')](_0xb5af('0xc')))[_0xb5af('0xd')]()['format'](),'$lte':moment(moment(_0x186719[_0xb5af('0xe')])[_0xb5af('0xb')]('YYYY-MM-DD'))['utc']()[_0xb5af('0xf')](0x1,'s')[_0xb5af('0xb')]()};_0x34ea77[_0x3f882c]=_0x58405f;}else{_0x34ea77[_0x3f882c]=_['isArray'](_0x2a870a)?_0x2a870a:JSON[_0xb5af('0x9')](_0x2a870a);}}else{_0x34ea77[_0x3f882c]=_['isArray'](_0x2a870a)?_0x2a870a:JSON[_0xb5af('0x9')](_0x2a870a);}}catch(_0x3c90da){_0x34ea77[_0x3f882c]=_0x2a870a[_0xb5af('0x3')](',');}});}return _0x34ea77;};exports[_0xb5af('0x10')]=function(_0x4db008){_0x4db008=parseInt(_0x4db008,0xa);if(!_0x4db008||_0x4db008<0x0){_0x4db008=LIMIT_VALUE;}return _0x4db008;};exports['offset']=function(_0x9b57a9){_0x9b57a9=parseInt(_0x9b57a9,0xa);if(!_0x9b57a9||_0x9b57a9<0x0){_0x9b57a9=0x0;}return _0x9b57a9;};exports[_0xb5af('0x11')]=function(_0x1ee6fe){var _0x21a479,_0x214763=null;if(_0x1ee6fe){_0x21a479=_0x1ee6fe[_0xb5af('0x3')](',');_0x214763=_['map'](_0x21a479,function(_0x26a23e){if(_0x26a23e[_0xb5af('0x12')]('-')===0x0){return[_0x26a23e===_0xb5af('0x13')?sequelize[_0xb5af('0x14')](sequelize[_0xb5af('0x15')]('priority'),_0xb5af('0x16')):_0x26a23e['substr'](0x1),_0xb5af('0x17')];}else{return[_0x26a23e===_0xb5af('0x13')?sequelize['cast'](sequelize[_0xb5af('0x15')](_0xb5af('0x13')),_0xb5af('0x16')):_0x26a23e,_0xb5af('0x18')];}});}return _0x214763;};exports['omit']=function(_0x19c1fe,_0xa36dc4){if(_[_0xb5af('0x19')](_0x19c1fe)){return _0x19c1fe;}if(_[_0xb5af('0x1a')](_0x19c1fe)){for(var _0x4bd0e7=0x0;_0x4bd0e7<_0x19c1fe[_0xb5af('0x1b')];_0x4bd0e7+=0x1){_0x19c1fe[_0x4bd0e7]=this[_0xb5af('0x1c')](_0x19c1fe[_0x4bd0e7],_0xa36dc4);}return _0x19c1fe;}if(!_[_0xb5af('0x1d')](_0x19c1fe)){return _0x19c1fe;}if(_[_0xb5af('0x1e')](_0xa36dc4)){_0xa36dc4=[_0xa36dc4];}if(!_['isArray'](_0xa36dc4)){return _0x19c1fe;}for(var _0x224ff6=0x0;_0x224ff6<_0xa36dc4['length'];_0x224ff6+=0x1){_[_0xb5af('0x1f')](_0x19c1fe,_0xa36dc4[_0x224ff6]);}for(var _0x4724a9 in _0x19c1fe){if(_0x19c1fe[_0xb5af('0x20')](_0x4724a9)){_0x19c1fe[_0x4724a9]=this['omit'](_0x19c1fe[_0x4724a9],_0xa36dc4);}}return _0x19c1fe;};exports[_0xb5af('0x21')]=function(_0x21140c){return _0x21140c['match'](RegExp(_0xb5af('0x22')))?!![]:![];};exports['isEmail']=function(_0x228fe8){return _0x228fe8[_0xb5af('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x25ca26){var _0x27bd48=[];_0x25ca26[_0xb5af('0x3')]('\x20')['forEach'](function(_0x2acc65){_0x27bd48[_0xb5af('0x24')]('+'+_0x2acc65[_0xb5af('0x25')]()+'*');});return _0x27bd48[_0xb5af('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b3bc568..98d0efd 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8250=['/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','initialize','express','body-parser','method-override','path','passport','cors','moment','../mysqldb','default','get','env','set','appPath','join','root','public','development','client','use','json\x20replacer','split','static'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x8250,0x15e));var _0x0825=function(_0x350fe1,_0x53971c){_0x350fe1=_0x350fe1-0x0;var _0x8b53d6=_0x8250[_0x350fe1];return _0x8b53d6;};'use strict';var express=require(_0x0825('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x0825('0x1'));var methodOverride=require(_0x0825('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x0825('0x3'));var passport=require(_0x0825('0x4'));var cors=require(_0x0825('0x5'));var moment=require(_0x0825('0x6'));var config=require('./environment');var db=require(_0x0825('0x7'))['db'];exports[_0x0825('0x8')]=function(_0x1b4bfc){var _0x264fbf=_0x1b4bfc[_0x0825('0x9')](_0x0825('0xa'));if(_0x264fbf==='production'){_0x1b4bfc[_0x0825('0xb')](_0x0825('0xc'),path[_0x0825('0xd')](config[_0x0825('0xe')],_0x0825('0xf')));}if(_0x264fbf===_0x0825('0x10')||_0x264fbf==='test'){_0x1b4bfc['set'](_0x0825('0xc'),path['join'](config[_0x0825('0xe')],_0x0825('0x11')));_0x1b4bfc[_0x0825('0x12')](errorHandler());}_0x1b4bfc[_0x0825('0xb')](_0x0825('0x13'),function(_0x5825e1,_0x1b2a3c){if(this[_0x5825e1]instanceof Date){_0x1b2a3c=this[_0x5825e1]['toISOString']()[_0x0825('0x14')]('.')[0x0]+'Z';}return _0x1b2a3c;});_0x1b4bfc[_0x0825('0x12')](express[_0x0825('0x15')](_0x1b4bfc['get']('appPath')));_0x1b4bfc[_0x0825('0xb')]('views',config['root']+_0x0825('0x16'));_0x1b4bfc[_0x0825('0x17')](_0x0825('0x18'),require(_0x0825('0x19'))[_0x0825('0x1a')]);_0x1b4bfc[_0x0825('0xb')]('view\x20engine',_0x0825('0x18'));_0x1b4bfc[_0x0825('0x12')](bodyParser[_0x0825('0x1b')]({'limit':_0x0825('0x1c'),'extended':!![]}));_0x1b4bfc[_0x0825('0x12')](bodyParser[_0x0825('0x1d')]({'limit':'50mb'}));_0x1b4bfc['use'](cors());_0x1b4bfc[_0x0825('0x12')](methodOverride());_0x1b4bfc['use'](cookieParser());_0x1b4bfc[_0x0825('0x12')](passport[_0x0825('0x1e')]());}; \ No newline at end of file +var _0x8562=['get','production','set','appPath','join','root','public','development','test','client','json\x20replacer','toISOString','split','static','engine','html','ejs','view\x20engine','urlencoded','use','50mb','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default'];(function(_0xdbedfa,_0x31fbab){var _0x98145a=function(_0x388ec1){while(--_0x388ec1){_0xdbedfa['push'](_0xdbedfa['shift']());}};_0x98145a(++_0x31fbab);}(_0x8562,0x160));var _0x2856=function(_0x1e007a,_0xc87ffe){_0x1e007a=_0x1e007a-0x0;var _0x3cc6d3=_0x8562[_0x1e007a];return _0x3cc6d3;};'use strict';var express=require(_0x2856('0x0'));var favicon=require(_0x2856('0x1'));var bodyParser=require(_0x2856('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x2856('0x3'));var errorHandler=require(_0x2856('0x4'));var path=require(_0x2856('0x5'));var passport=require('passport');var cors=require(_0x2856('0x6'));var moment=require(_0x2856('0x7'));var config=require(_0x2856('0x8'));var db=require(_0x2856('0x9'))['db'];exports[_0x2856('0xa')]=function(_0x38cc78){var _0x22fa8f=_0x38cc78[_0x2856('0xb')]('env');if(_0x22fa8f===_0x2856('0xc')){_0x38cc78[_0x2856('0xd')](_0x2856('0xe'),path[_0x2856('0xf')](config[_0x2856('0x10')],_0x2856('0x11')));}if(_0x22fa8f===_0x2856('0x12')||_0x22fa8f===_0x2856('0x13')){_0x38cc78[_0x2856('0xd')](_0x2856('0xe'),path['join'](config[_0x2856('0x10')],_0x2856('0x14')));_0x38cc78['use'](errorHandler());}_0x38cc78[_0x2856('0xd')](_0x2856('0x15'),function(_0xd4af03,_0x1ec0ac){if(this[_0xd4af03]instanceof Date){_0x1ec0ac=this[_0xd4af03][_0x2856('0x16')]()[_0x2856('0x17')]('.')[0x0]+'Z';}return _0x1ec0ac;});_0x38cc78['use'](express[_0x2856('0x18')](_0x38cc78[_0x2856('0xb')](_0x2856('0xe'))));_0x38cc78[_0x2856('0xd')]('views',config[_0x2856('0x10')]+'/server/views');_0x38cc78[_0x2856('0x19')](_0x2856('0x1a'),require(_0x2856('0x1b'))['renderFile']);_0x38cc78[_0x2856('0xd')](_0x2856('0x1c'),_0x2856('0x1a'));_0x38cc78['use'](bodyParser[_0x2856('0x1d')]({'limit':'50mb','extended':!![]}));_0x38cc78[_0x2856('0x1e')](bodyParser['json']({'limit':_0x2856('0x1f')}));_0x38cc78[_0x2856('0x1e')](cors());_0x38cc78[_0x2856('0x1e')](methodOverride());_0x38cc78['use'](cookieParser());_0x38cc78[_0x2856('0x1e')](passport[_0x2856('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e0f260b..fdb980a 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 _0xfd7b=['macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','createHash','digest','hex','getUuid','platform','replace','hostname'];(function(_0x5e0ea8,_0x466f30){var _0x9565e1=function(_0x40d846){while(--_0x40d846){_0x5e0ea8['push'](_0x5e0ea8['shift']());}};_0x9565e1(++_0x466f30);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xfd7b[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xbfd7('0x0'));var machine=require(_0xbfd7('0x1'));var exec=require(_0xbfd7('0x2'))[_0xbfd7('0x3')];function getInterfaces(){var _0x1ea39e=[];var _0x1f9ae1=os[_0xbfd7('0x4')]();var _0x221ad1=_[_0xbfd7('0x5')](_[_0xbfd7('0x6')](_0x1f9ae1));for(var _0x10a705=0x0;_0x10a705<_0x221ad1[_0xbfd7('0x7')];_0x10a705++){var _0x639dd4=_0x1f9ae1[_0x221ad1[_0x10a705]]['filter'](function(_0x38b1ef){return _0x38b1ef['family']===_0xbfd7('0x8')&&_0x38b1ef['internal']===![];});_0x1ea39e=_0x1ea39e[_0xbfd7('0x9')](_0x639dd4);}return _0x1ea39e;}function getFirstInterface(){var _0x2e69a5=_[_0xbfd7('0xa')](getInterfaces());return{'macAddress':_0x2e69a5&&_0x2e69a5[_0xbfd7('0xb')]?_0x2e69a5['mac']:_0xbfd7('0xc'),'ipAddress':_0x2e69a5&&_0x2e69a5[_0xbfd7('0xd')]?_0x2e69a5['address']:'127.0.0.1'};}exports[_0xbfd7('0xe')]=getFirstInterface;function getCPUhash(){var _0x45606b=_[_0xbfd7('0x5')](os[_0xbfd7('0xf')]()[_0xbfd7('0x10')](function(_0x559eca){return _0x559eca[_0xbfd7('0x11')];}))['join'](':');return crypto[_0xbfd7('0x12')]('md5')['update'](_0x45606b)[_0xbfd7('0x13')](_0xbfd7('0x14'));}exports[_0xbfd7('0x15')]=function(){switch(os[_0xbfd7('0x16')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xbfd7('0x17')]('\x0d\x0a','');default:var _0x115a34=getFirstInterface();var _0x33d900=getCPUhash();var _0x3e8754=_0x33d900+'|'+os[_0xbfd7('0x18')]()+'|'+_0x115a34[_0xbfd7('0x19')]+'|'+_0x115a34[_0xbfd7('0x1a')];var _0x614c9d=crypto[_0xbfd7('0x12')]('md5')['update'](_0x3e8754)[_0xbfd7('0x13')](_0xbfd7('0x14'));return _0x614c9d['substring'](0x0,0x8)+'-'+_0x614c9d['substring'](0x8,0xc)+'-'+_0x614c9d[_0xbfd7('0x1b')](0xc,0x10)+'-'+_0x614c9d['substring'](0x10,0x14)+'-'+_0x614c9d['substring'](0x14);}}; \ No newline at end of file +var _0x85d0=['mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','createHash','md5','update','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','execSync','networkInterfaces','orderBy','filter','IPv4','internal','concat','head'];(function(_0x2ab254,_0x1b2760){var _0x249f7f=function(_0x48b2fe){while(--_0x48b2fe){_0x2ab254['push'](_0x2ab254['shift']());}};_0x249f7f(++_0x1b2760);}(_0x85d0,0x164));var _0x085d=function(_0x59d933,_0x394044){_0x59d933=_0x59d933-0x0;var _0x2308e4=_0x85d0[_0x59d933];return _0x2308e4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x085d('0x0')];function getInterfaces(){var _0x1716e5=[];var _0xfd8773=os[_0x085d('0x1')]();var _0x231765=_[_0x085d('0x2')](_['keys'](_0xfd8773));for(var _0x2f37ca=0x0;_0x2f37ca<_0x231765['length'];_0x2f37ca++){var _0x364f09=_0xfd8773[_0x231765[_0x2f37ca]][_0x085d('0x3')](function(_0x2a6902){return _0x2a6902['family']===_0x085d('0x4')&&_0x2a6902[_0x085d('0x5')]===![];});_0x1716e5=_0x1716e5[_0x085d('0x6')](_0x364f09);}return _0x1716e5;}function getFirstInterface(){var _0x3129a8=_[_0x085d('0x7')](getInterfaces());return{'macAddress':_0x3129a8&&_0x3129a8[_0x085d('0x8')]?_0x3129a8[_0x085d('0x8')]:_0x085d('0x9'),'ipAddress':_0x3129a8&&_0x3129a8[_0x085d('0xa')]?_0x3129a8['address']:_0x085d('0xb')};}exports[_0x085d('0xc')]=getFirstInterface;function getCPUhash(){var _0x3e6416=_[_0x085d('0x2')](os['cpus']()[_0x085d('0xd')](function(_0x2bd6ae){return _0x2bd6ae['model'];}))[_0x085d('0xe')](':');return crypto[_0x085d('0xf')](_0x085d('0x10'))[_0x085d('0x11')](_0x3e6416)['digest'](_0x085d('0x12'));}exports[_0x085d('0x13')]=function(){switch(os['platform']()){case'win32':return exec(_0x085d('0x14'),{'encoding':_0x085d('0x15')})[_0x085d('0x16')]('\x0d\x0a','');default:var _0x5f8e18=getFirstInterface();var _0x309c15=getCPUhash();var _0x5ed56a=_0x309c15+'|'+os[_0x085d('0x17')]()+'|'+_0x5f8e18[_0x085d('0x18')]+'|'+_0x5f8e18[_0x085d('0x19')];var _0x1b0a6c=crypto[_0x085d('0xf')](_0x085d('0x10'))[_0x085d('0x11')](_0x5ed56a)[_0x085d('0x1a')](_0x085d('0x12'));return _0x1b0a6c['substring'](0x0,0x8)+'-'+_0x1b0a6c[_0x085d('0x1b')](0x8,0xc)+'-'+_0x1b0a6c[_0x085d('0x1b')](0xc,0x10)+'-'+_0x1b0a6c[_0x085d('0x1b')](0x10,0x14)+'-'+_0x1b0a6c[_0x085d('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 587a4c7..9084011 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 _0xdc91=['Motion\x20License\x20Alert','Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','aes-256-ctr','secrets','update','final','base64','session','utf8','||FIELD||VALUE||\x0a','User','findOne','admin','|machineUuid|','|name|','fullname','|email|','email','getFirstInterface','ipAddress','openIssue'];(function(_0x18df6a,_0x3938b6){var _0x3b154d=function(_0x31cfc2){while(--_0x31cfc2){_0x18df6a['push'](_0x18df6a['shift']());}};_0x3b154d(++_0x3938b6);}(_0xdc91,0x8b));var _0x1dc9=function(_0x3e40e0,_0x4a3332){_0x3e40e0=_0x3e40e0-0x0;var _0x3816d1=_0xdc91[_0x3e40e0];return _0x3816d1;};'use strict';var util=require(_0x1dc9('0x0'));var crypto=require(_0x1dc9('0x1'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x1dc9('0x2'));var db=require(_0x1dc9('0x3'))['db'];var config=require(_0x1dc9('0x4'));var hardware=require(_0x1dc9('0x5'));var logger=require(_0x1dc9('0x6'))(_0x1dc9('0x7'));var jira=require(_0x1dc9('0x8'));var HOST=_0x1dc9('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5ac058){return new BPromise(function(_0x2c6e6c,_0x25a752){var _0x316995=util[_0x1dc9('0xa')](_0x1dc9('0xb'),HOST,_0x5ac058,module[_0x1dc9('0xc')][_0x1dc9('0x2')]);if(oldToken){_0x316995=util[_0x1dc9('0xa')](_0x1dc9('0xd'),HOST,_0x5ac058,module[_0x1dc9('0xc')]['version'],oldToken);}var _0x356525={'uri':_0x316995,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x356525)[_0x1dc9('0xe')](function(_0x5b29c5){_0x2c6e6c(_0x5b29c5);})[_0x1dc9('0xf')](function(_0x41f1da){_0x25a752(_0x41f1da);});});}function encryptDate(_0x4402f2){var _0x123684=crypto['createCipher'](_0x1dc9('0x10'),config[_0x1dc9('0x11')]['session']);var _0x41c335=_0x123684[_0x1dc9('0x12')](_0x4402f2,'utf8','base64');_0x41c335+=_0x123684[_0x1dc9('0x13')](_0x1dc9('0x14'));return _0x41c335;}function decryptDate(_0x38ee59){var _0x2c94b1=crypto['createDecipher']('aes-256-ctr',config[_0x1dc9('0x11')][_0x1dc9('0x15')]);var _0x5cccb9=_0x2c94b1[_0x1dc9('0x12')](_0x38ee59,_0x1dc9('0x14'),_0x1dc9('0x16'));_0x5cccb9+=_0x2c94b1[_0x1dc9('0x13')](_0x1dc9('0x16'));return _0x5cccb9;}function sendJiraAlert(_0x1e845a,_0x2442d0,_0x1e4aca){var _0x1386c9=_0x1dc9('0x17');return db[_0x1dc9('0x18')][_0x1dc9('0x19')]({'where':{'role':_0x1dc9('0x1a')},'attributes':['fullname','email'],'raw':!![]})[_0x1dc9('0xe')](function(_0x4d3818){ADMIN=_0x4d3818;_0x1386c9+='|reason|'+_0x1e4aca+'|\x0a';_0x1386c9+='|uuid|'+_0x1e845a+'|\x0a';_0x1386c9+=_0x1dc9('0x1b')+_0x2442d0+'|\x0a';_0x1386c9+=_0x1dc9('0x1c')+ADMIN[_0x1dc9('0x1d')]+'|\x0a';_0x1386c9+=_0x1dc9('0x1e')+ADMIN[_0x1dc9('0x1f')]+'|\x0a';return _0x1386c9;})[_0x1dc9('0xe')](function(_0x2b1ff8){var _0x48dd9c=hardware[_0x1dc9('0x20')]()[_0x1dc9('0x21')];return jira[_0x1dc9('0x22')]({'key':'MOTLICENSE','summary':_0x1dc9('0x23'),'description':_0x2b1ff8,'issuetype':_0x1dc9('0x24'),'oldToken':_0x1e845a,'newToken':_0x2442d0,'email':ADMIN[_0x1dc9('0x1f')],'name':ADMIN[_0x1dc9('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x48dd9c});});}function manageLicense(_0x2dfe03,_0x476111){var _0x179498=_0x476111[_0x1dc9('0x25')]({'plain':!![]});httpRequest(_0x2dfe03)[_0x1dc9('0xe')](function(_0x59f588){if(oldToken){oldToken=undefined;}if(_0x59f588['active']){if(!_0x179498[_0x1dc9('0x7')]&&_0x179498[_0x1dc9('0x7')]!=_0x59f588[_0x1dc9('0x7')]||_0x179498[_0x1dc9('0x7')]&&_0x179498[_0x1dc9('0x26')]){logger[_0x1dc9('0x27')](_0x1dc9('0x28'));}if(_0x179498[_0x1dc9('0x7')]&&!_0x179498[_0x1dc9('0x26')]&&_0x179498['license']!=_0x59f588[_0x1dc9('0x7')]){logger[_0x1dc9('0x27')](_0x1dc9('0x29'));}if(_0x179498[_0x1dc9('0x7')]&&!_0x179498[_0x1dc9('0x26')]&&_0x179498[_0x1dc9('0x7')]==_0x59f588['license']){return _0x476111;}return _0x476111['update']({'data1':_0x2dfe03,'data2':null,'license':_0x59f588[_0x1dc9('0x7')]});}else{if(_0x59f588[_0x1dc9('0x7')]||_0x179498['license']){if(!_0x179498[_0x1dc9('0x26')]){if(_0x179498[_0x1dc9('0x2a')]==_0x2dfe03){GRAY_PERIOD_REASON=_0x1dc9('0x2b');logger['info'](_0x1dc9('0x2c'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x179498[_0x1dc9('0x2a')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x179498[_0x1dc9('0x2a')],_0x2dfe03);}sendJiraAlert(_0x179498[_0x1dc9('0x2a')],_0x59f588[_0x1dc9('0x2d')],GRAY_PERIOD_REASON);logger[_0x1dc9('0x27')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x1dc9('0x2e')](),moment()['format'](_0x1dc9('0x2f')));return _0x476111[_0x1dc9('0x12')]({'data2':encryptDate(moment()[_0x1dc9('0xa')](_0x1dc9('0x2f')))});}else{if(moment()[_0x1dc9('0x30')](decryptDate(_0x179498[_0x1dc9('0x26')]),_0x1dc9('0x31'))>DAYS){logger[_0x1dc9('0x27')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x1dc9('0x2f')));return _0x476111[_0x1dc9('0x12')]({'data1':_0x2dfe03,'data2':null,'license':null});}}}else{if(_0x179498[_0x1dc9('0x2a')]!=_0x2dfe03){logger[_0x1dc9('0x27')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x179498[_0x1dc9('0x2a')],_0x2dfe03);return _0x476111['update']({'data1':_0x2dfe03,'data2':null,'license':null});}}}return _0x476111;})[_0x1dc9('0xe')](function(_0x19fc87){_0x476111=_0x19fc87;})[_0x1dc9('0xf')](function(_0x27e309){logger[_0x1dc9('0x32')](_0x27e309[_0x1dc9('0x33')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x1dc9('0x34')](),_0x476111);},TIME);});}function defaultLicense(){var _0x17bb3c=hardware[_0x1dc9('0x34')]();if(_0x17bb3c){return db[_0x1dc9('0x35')][_0x1dc9('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x17bb3c}})[_0x1dc9('0x37')](function(_0x4c2386,_0xff1a45){logger[_0x1dc9('0x27')](_0x1dc9('0x38'),_0x17bb3c);manageLicense(_0x17bb3c,_0x4c2386);})[_0x1dc9('0xf')](function(_0x5af473){logger[_0x1dc9('0x32')](_0x5af473[_0x1dc9('0x33')]);});}}exports[_0x1dc9('0x39')]=defaultLicense; \ No newline at end of file +var _0x8921=['|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','update','utf8','base64','createDecipher','session','||FIELD||VALUE||\x0a','findOne','admin','fullname','email','|uuid|','|machineUuid|'];(function(_0x1ae441,_0x5160e2){var _0x47b62c=function(_0x51f1a7){while(--_0x51f1a7){_0x1ae441['push'](_0x1ae441['shift']());}};_0x47b62c(++_0x5160e2);}(_0x8921,0x9a));var _0x1892=function(_0x1a62be,_0x2be462){_0x1a62be=_0x1a62be-0x0;var _0x356dd9=_0x8921[_0x1a62be];return _0x356dd9;};'use strict';var util=require(_0x1892('0x0'));var crypto=require('crypto');var moment=require(_0x1892('0x1'));var rp=require(_0x1892('0x2'));var BPromise=require(_0x1892('0x3'));var pkginfo=require(_0x1892('0x4'))(module,_0x1892('0x5'));var db=require(_0x1892('0x6'))['db'];var config=require(_0x1892('0x7'));var hardware=require(_0x1892('0x8'));var logger=require(_0x1892('0x9'))(_0x1892('0xa'));var jira=require(_0x1892('0xb'));var HOST=_0x1892('0xc');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x504741){return new BPromise(function(_0xfe2155,_0x6a2604){var _0x2db820=util[_0x1892('0xd')](_0x1892('0xe'),HOST,_0x504741,module[_0x1892('0xf')]['version']);if(oldToken){_0x2db820=util[_0x1892('0xd')](_0x1892('0x10'),HOST,_0x504741,module[_0x1892('0xf')][_0x1892('0x5')],oldToken);}var _0x1efeed={'uri':_0x2db820,'method':_0x1892('0x11'),'timeout':0xea60,'json':!![]};return rp(_0x1efeed)[_0x1892('0x12')](function(_0x531383){_0xfe2155(_0x531383);})[_0x1892('0x13')](function(_0x22baab){_0x6a2604(_0x22baab);});});}function encryptDate(_0xe5ef78){var _0x5b8534=crypto[_0x1892('0x14')](_0x1892('0x15'),config[_0x1892('0x16')]['session']);var _0x474d22=_0x5b8534[_0x1892('0x17')](_0xe5ef78,_0x1892('0x18'),_0x1892('0x19'));_0x474d22+=_0x5b8534['final']('base64');return _0x474d22;}function decryptDate(_0x934968){var _0x4b15ec=crypto[_0x1892('0x1a')]('aes-256-ctr',config[_0x1892('0x16')][_0x1892('0x1b')]);var _0x237451=_0x4b15ec[_0x1892('0x17')](_0x934968,_0x1892('0x19'),'utf8');_0x237451+=_0x4b15ec['final'](_0x1892('0x18'));return _0x237451;}function sendJiraAlert(_0x49937d,_0x437502,_0x5f29b5){var _0x11c2e6=_0x1892('0x1c');return db['User'][_0x1892('0x1d')]({'where':{'role':_0x1892('0x1e')},'attributes':[_0x1892('0x1f'),_0x1892('0x20')],'raw':!![]})['then'](function(_0x53f24c){ADMIN=_0x53f24c;_0x11c2e6+='|reason|'+_0x5f29b5+'|\x0a';_0x11c2e6+=_0x1892('0x21')+_0x49937d+'|\x0a';_0x11c2e6+=_0x1892('0x22')+_0x437502+'|\x0a';_0x11c2e6+='|name|'+ADMIN[_0x1892('0x1f')]+'|\x0a';_0x11c2e6+=_0x1892('0x23')+ADMIN[_0x1892('0x20')]+'|\x0a';return _0x11c2e6;})[_0x1892('0x12')](function(_0x53e3bf){var _0xff60d4=hardware[_0x1892('0x24')]()[_0x1892('0x25')];return jira[_0x1892('0x26')]({'key':'MOTLICENSE','summary':_0x1892('0x27'),'description':_0x53e3bf,'issuetype':_0x1892('0x28'),'oldToken':_0x49937d,'newToken':_0x437502,'email':ADMIN[_0x1892('0x20')],'name':ADMIN[_0x1892('0x1f')],'reason':GRAY_PERIOD_REASON,'ip':_0xff60d4});});}function manageLicense(_0x296c45,_0x11275b){var _0x8b09dc=_0x11275b[_0x1892('0x29')]({'plain':!![]});httpRequest(_0x296c45)[_0x1892('0x12')](function(_0x2c3465){if(oldToken){oldToken=undefined;}if(_0x2c3465[_0x1892('0x2a')]){if(!_0x8b09dc['license']&&_0x8b09dc[_0x1892('0xa')]!=_0x2c3465[_0x1892('0xa')]||_0x8b09dc['license']&&_0x8b09dc[_0x1892('0x2b')]){logger['info'](_0x1892('0x2c'));}if(_0x8b09dc[_0x1892('0xa')]&&!_0x8b09dc[_0x1892('0x2b')]&&_0x8b09dc[_0x1892('0xa')]!=_0x2c3465[_0x1892('0xa')]){logger['info'](_0x1892('0x2d'));}if(_0x8b09dc[_0x1892('0xa')]&&!_0x8b09dc[_0x1892('0x2b')]&&_0x8b09dc[_0x1892('0xa')]==_0x2c3465[_0x1892('0xa')]){return _0x11275b;}return _0x11275b[_0x1892('0x17')]({'data1':_0x296c45,'data2':null,'license':_0x2c3465[_0x1892('0xa')]});}else{if(_0x2c3465[_0x1892('0xa')]||_0x8b09dc[_0x1892('0xa')]){if(!_0x8b09dc['data2']){if(_0x8b09dc['data1']==_0x296c45){GRAY_PERIOD_REASON='Disabled';logger[_0x1892('0x2e')](_0x1892('0x2f'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x8b09dc['data1'];logger[_0x1892('0x2e')](_0x1892('0x30'),_0x8b09dc['data1'],_0x296c45);}sendJiraAlert(_0x8b09dc[_0x1892('0x31')],_0x2c3465[_0x1892('0x32')],GRAY_PERIOD_REASON);logger[_0x1892('0x2e')](_0x1892('0x33'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x1892('0xd')](_0x1892('0x34')));return _0x11275b['update']({'data2':encryptDate(moment()[_0x1892('0xd')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x8b09dc[_0x1892('0x2b')]),_0x1892('0x35'))>DAYS){logger['info'](_0x1892('0x36'),moment()[_0x1892('0xd')](_0x1892('0x34')));return _0x11275b[_0x1892('0x17')]({'data1':_0x296c45,'data2':null,'license':null});}}}else{if(_0x8b09dc[_0x1892('0x31')]!=_0x296c45){logger[_0x1892('0x2e')](_0x1892('0x30'),_0x8b09dc[_0x1892('0x31')],_0x296c45);return _0x11275b[_0x1892('0x17')]({'data1':_0x296c45,'data2':null,'license':null});}}}return _0x11275b;})[_0x1892('0x12')](function(_0x4974f7){_0x11275b=_0x4974f7;})[_0x1892('0x13')](function(_0x7524c2){logger[_0x1892('0x37')](_0x7524c2['message']);})[_0x1892('0x38')](function(){setTimeout(function(){manageLicense(hardware[_0x1892('0x39')](),_0x11275b);},TIME);});}function defaultLicense(){var _0x36a9f4=hardware[_0x1892('0x39')]();if(_0x36a9f4){return db['License'][_0x1892('0x3a')]({'where':{'id':0x1},'defaults':{'data1':_0x36a9f4}})[_0x1892('0x3b')](function(_0x128faf,_0x2208ba){logger[_0x1892('0x2e')](_0x1892('0x3c'),_0x36a9f4);manageLicense(_0x36a9f4,_0x128faf);})[_0x1892('0x13')](function(_0x89e8d5){logger[_0x1892('0x37')](_0x89e8d5[_0x1892('0x3d')]);});}}exports[_0x1892('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 17efcdd..2e1b75a 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 _0xd7e7=['crypto','util','lodash','moment','./hardware','../environment','license','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','demo','uuid','machineUuid','getUuid','session','base64','gray','deadline','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','Demo\x20license','find','then','checkLicense'];(function(_0x5813b1,_0xbeeba9){var _0x4ea5cd=function(_0x2e972c){while(--_0x2e972c){_0x5813b1['push'](_0x5813b1['shift']());}};_0x4ea5cd(++_0xbeeba9);}(_0xd7e7,0x10a));var _0x7d7e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7e7[_0xfae23b];return _0x200640;};'use strict';var crypto=require(_0x7d7e('0x0'));var util=require(_0x7d7e('0x1'));var _=require(_0x7d7e('0x2'));var moment=require(_0x7d7e('0x3'));var hardware=require(_0x7d7e('0x4'));var config=require(_0x7d7e('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x5e0847,_0x4bf67a){if(_0x5e0847){try{var _0x45f153=_0x4bf67a||_0x5e0847[_0x7d7e('0x6')];if(_['isEmpty'](_0x45f153)){throw new Error(_0x7d7e('0x7'));}var _0x1b4acf=_0x5e0847['data1'];var _0x15ff0b=_0x5e0847[_0x7d7e('0x8')];var _0x184d33=_0x1b4acf[_0x7d7e('0x9')]('-')[0x4];var _0x537d89=_0x1b4acf[_0x7d7e('0x9')]('-')[0x0];var _0x568ddc=crypto[_0x7d7e('0xa')](_0x7d7e('0xb'),util[_0x7d7e('0xc')](_0x7d7e('0xd'),_0x184d33,_0x1b4acf,_0x537d89));var _0x576ceb=_0x568ddc[_0x7d7e('0xe')](_0x45f153,'base64',_0x7d7e('0xf'));_0x576ceb+=_0x568ddc[_0x7d7e('0x10')](_0x7d7e('0xf'));var _0xd1919d=JSON[_0x7d7e('0x11')](_0x576ceb);_0xd1919d[_0x7d7e('0x12')]=![];_0xd1919d[_0x7d7e('0x13')]=_0x1b4acf;_0xd1919d[_0x7d7e('0x14')]=hardware[_0x7d7e('0x15')]();if(_0x15ff0b){var _0x121f3f=crypto[_0x7d7e('0xa')]('aes-256-ctr',config['secrets'][_0x7d7e('0x16')]);var _0x35af10=_0x121f3f[_0x7d7e('0xe')](_0x15ff0b,_0x7d7e('0x17'),'utf8');_0x35af10+=_0x121f3f['final'](_0x7d7e('0xf'));_0xd1919d[_0x7d7e('0x18')]=_0x35af10;_0xd1919d[_0x7d7e('0x19')]=moment(_0x35af10)['add'](0x7,_0x7d7e('0x1a'))['format']();_0xd1919d[_0x7d7e('0x1b')]=_0xd1919d['uuid']!=_0xd1919d['machineUuid']?_0x7d7e('0x1c'):_0x7d7e('0x1d');}return _0xd1919d;}catch(_0x313507){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7d7e('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7d7e('0x1f'),'uuid':_0x5e0847[_0x7d7e('0x20')],'machineUuid':hardware[_0x7d7e('0x15')](),'message':_0x313507[_0x7d7e('0x21')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7d7e('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7d7e('0x22'),'uuid':_0x5e0847[_0x7d7e('0x20')],'machineUuid':hardware[_0x7d7e('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x285b46){return db['License'][_0x7d7e('0x23')](_['defaults'](_0x285b46,{'raw':!![],'where':{'id':0x1}}))[_0x7d7e('0x24')](function(_0x1b4806){return checkLicense(_0x1b4806,null);});};exports[_0x7d7e('0x25')]=checkLicense; \ No newline at end of file +var _0xb077=['isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','demo','machineUuid','aes-256-ctr','secrets','gray','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','getLicense','License','find','defaults','then','util','moment','./hardware','../environment','license'];(function(_0x4a9eda,_0x525466){var _0x368cc5=function(_0x3a35a2){while(--_0x3a35a2){_0x4a9eda['push'](_0x4a9eda['shift']());}};_0x368cc5(++_0x525466);}(_0xb077,0x7f));var _0x7b07=function(_0x10ad66,_0x41c0e2){_0x10ad66=_0x10ad66-0x0;var _0x2a9450=_0xb077[_0x10ad66];return _0x2a9450;};'use strict';var crypto=require('crypto');var util=require(_0x7b07('0x0'));var _=require('lodash');var moment=require(_0x7b07('0x1'));var hardware=require(_0x7b07('0x2'));var config=require(_0x7b07('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x1ee381,_0x172d7b){if(_0x1ee381){try{var _0x1d3bd5=_0x172d7b||_0x1ee381[_0x7b07('0x4')];if(_[_0x7b07('0x5')](_0x1d3bd5)){throw new Error(_0x7b07('0x6'));}var _0x517d64=_0x1ee381[_0x7b07('0x7')];var _0x2ee183=_0x1ee381[_0x7b07('0x8')];var _0x44ffee=_0x517d64[_0x7b07('0x9')]('-')[0x4];var _0x289d26=_0x517d64[_0x7b07('0x9')]('-')[0x0];var _0x5a6ed8=crypto[_0x7b07('0xa')]('aes-256-ctr',util[_0x7b07('0xb')](_0x7b07('0xc'),_0x44ffee,_0x517d64,_0x289d26));var _0x55cd79=_0x5a6ed8[_0x7b07('0xd')](_0x1d3bd5,_0x7b07('0xe'),_0x7b07('0xf'));_0x55cd79+=_0x5a6ed8[_0x7b07('0x10')](_0x7b07('0xf'));var _0x371b7f=JSON['parse'](_0x55cd79);_0x371b7f[_0x7b07('0x11')]=![];_0x371b7f['uuid']=_0x517d64;_0x371b7f[_0x7b07('0x12')]=hardware['getUuid']();if(_0x2ee183){var _0x2a9c1f=crypto[_0x7b07('0xa')](_0x7b07('0x13'),config[_0x7b07('0x14')]['session']);var _0x57f247=_0x2a9c1f[_0x7b07('0xd')](_0x2ee183,'base64',_0x7b07('0xf'));_0x57f247+=_0x2a9c1f[_0x7b07('0x10')]('utf8');_0x371b7f[_0x7b07('0x15')]=_0x57f247;_0x371b7f['deadline']=moment(_0x57f247)['add'](0x7,'days')['format']();_0x371b7f[_0x7b07('0x16')]=_0x371b7f['uuid']!=_0x371b7f[_0x7b07('0x12')]?_0x7b07('0x17'):_0x7b07('0x18');}return _0x371b7f;}catch(_0xef65fc){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7b07('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7b07('0x1a'),'uuid':_0x1ee381[_0x7b07('0x7')],'machineUuid':hardware[_0x7b07('0x1b')](),'message':_0xef65fc['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7b07('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x1ee381[_0x7b07('0x7')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x7b07('0x1c')]=function(_0x59dbee){return db[_0x7b07('0x1d')][_0x7b07('0x1e')](_[_0x7b07('0x1f')](_0x59dbee,{'raw':!![],'where':{'id':0x1}}))[_0x7b07('0x20')](function(_0xdbbd95){return checkLicense(_0xdbbd95,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d72ef82..f18d1d6 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 _0x1cf1=['app-id','secret','exports','myappanuglar-secret'];(function(_0x23c459,_0x323a1a){var _0x5e7e89=function(_0x52dea8){while(--_0x52dea8){_0x23c459['push'](_0x23c459['shift']());}};_0x5e7e89(++_0x323a1a);}(_0x1cf1,0x10e));var _0x11cf=function(_0x184b9d,_0x62ad25){_0x184b9d=_0x184b9d-0x0;var _0x3c7715=_0x1cf1[_0x184b9d];return _0x3c7715;};'use strict';module[_0x11cf('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x11cf('0x1'),'GOOGLE_ID':_0x11cf('0x2'),'GOOGLE_SECRET':_0x11cf('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xf223=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4a874e,_0x5e710a){var _0x52ae67=function(_0x361f94){while(--_0x361f94){_0x4a874e['push'](_0x4a874e['shift']());}};_0x52ae67(++_0x5e710a);}(_0xf223,0xc3));var _0x3f22=function(_0xde4664,_0x20a792){_0xde4664=_0xde4664-0x0;var _0x4758d9=_0xf223[_0xde4664];return _0x4758d9;};'use strict';module[_0x3f22('0x0')]={'DOMAIN':_0x3f22('0x1'),'SESSION_SECRET':_0x3f22('0x2'),'GOOGLE_ID':_0x3f22('0x3'),'GOOGLE_SECRET':_0x3f22('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4339de9..8bde251 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9de3=['exports','Logger','transports','File','%s-%s','error','Console','env','moment','winston','path','join','/var','xcally','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x6bf16d,_0x7c0cd1){var _0x32a608=function(_0x2222da){while(--_0x2222da){_0x6bf16d['push'](_0x6bf16d['shift']());}};_0x32a608(++_0x7c0cd1);}(_0x9de3,0x8d));var _0x39de=function(_0x30be26,_0x19b327){_0x30be26=_0x30be26-0x0;var _0x54b008=_0x9de3[_0x30be26];return _0x54b008;};'use strict';var moment=require(_0x39de('0x0'));var winston=require(_0x39de('0x1'));var util=require('util');var path=require(_0x39de('0x2'));var debugLevel='INFO';function filename(_0x44fa3a,_0x1e6f34){return path[_0x39de('0x3')](_0x39de('0x4'),'log',_0x39de('0x5'),util[_0x39de('0x6')](_0x39de('0x7'),_0x44fa3a,_0x1e6f34));}function formatter(_0x21234f,_0x528a75){return util[_0x39de('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x39de('0x8')),_0x528a75[_0x39de('0x9')][_0x39de('0xa')](),_0x21234f,_0x528a75['message']);}module[_0x39de('0xb')]=function(_0x1d8589){return new winston[(_0x39de('0xc'))]({'transports':[new winston[(_0x39de('0xd'))][(_0x39de('0xe'))]({'name':util[_0x39de('0x6')](_0x39de('0xf'),_0x1d8589,_0x39de('0x10')),'filename':filename(_0x1d8589,_0x39de('0x10')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa0440c){return formatter(_0x1d8589,_0xa0440c);}}),new winston[(_0x39de('0xd'))][(_0x39de('0xe'))]({'name':util[_0x39de('0x6')](_0x39de('0xf'),_0x1d8589,'info'),'filename':filename(_0x1d8589,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ac8c7){return formatter(_0x1d8589,_0x5ac8c7);}}),new winston['transports'][(_0x39de('0x11'))]({'level':process[_0x39de('0x12')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x38a5e2){return formatter(_0x1d8589,_0x38a5e2);}})]});}; \ No newline at end of file +var _0x80bd=['path','INFO','join','/var','log','xcally','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','error','File','%s-%s','info','Console','env','winston'];(function(_0x4bec13,_0x1e3d64){var _0x2ed4a4=function(_0xc22617){while(--_0xc22617){_0x4bec13['push'](_0x4bec13['shift']());}};_0x2ed4a4(++_0x1e3d64);}(_0x80bd,0x14f));var _0xd80b=function(_0x1af46c,_0x3d28a9){_0x1af46c=_0x1af46c-0x0;var _0x2a8972=_0x80bd[_0x1af46c];return _0x2a8972;};'use strict';var moment=require('moment');var winston=require(_0xd80b('0x0'));var util=require('util');var path=require(_0xd80b('0x1'));var debugLevel=_0xd80b('0x2');function filename(_0x22df08,_0x30addd){return path[_0xd80b('0x3')](_0xd80b('0x4'),_0xd80b('0x5'),_0xd80b('0x6'),util['format'](_0xd80b('0x7'),_0x22df08,_0x30addd));}function formatter(_0xa574be,_0x5eced9){return util['format'](_0xd80b('0x8'),moment()[_0xd80b('0x9')](_0xd80b('0xa')),_0x5eced9[_0xd80b('0xb')][_0xd80b('0xc')](),_0xa574be,_0x5eced9['message']);}module[_0xd80b('0xd')]=function(_0x379af8){return new winston[(_0xd80b('0xe'))]({'transports':[new winston['transports']['File']({'name':util[_0xd80b('0x9')]('%s-%s',_0x379af8,'error'),'filename':filename(_0x379af8,'error'),'level':_0xd80b('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x37aee7){return formatter(_0x379af8,_0x37aee7);}}),new winston['transports'][(_0xd80b('0x10'))]({'name':util['format'](_0xd80b('0x11'),_0x379af8,_0xd80b('0x12')),'filename':filename(_0x379af8,'info'),'level':_0xd80b('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ce593){return formatter(_0x379af8,_0x2ce593);}}),new winston['transports'][(_0xd80b('0x13'))]({'level':process[_0xd80b('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x321424){return formatter(_0x379af8,_0x321424);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8d5c4db..bc996df 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 _0xcf33=['express','join','../../services/express/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','exports','path'];(function(_0x214104,_0x25746d){var _0x2a28a0=function(_0x1d8a58){while(--_0x1d8a58){_0x214104['push'](_0x214104['shift']());}};_0x2a28a0(++_0x25746d);}(_0xcf33,0x10d));var _0x3cf3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xcf33[_0xaa0309];return _0x5de7ce;};'use strict';var path=require(_0x3cf3('0x0'));var os=require('os');var config={'apps':[{'name':_0x3cf3('0x1'),'script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x3'))},{'name':'ami','script':path[_0x3cf3('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x3cf3('0x4'),'script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x5'))},{'name':'email','script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x6'))},{'name':'routing','script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x7'))},{'name':'xdr','script':path[_0x3cf3('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x3cf3('0x8')]=config; \ No newline at end of file +var _0xb70c=['express','join','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xb70c,0x1e0));var _0xcb70=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xb70c[_0x36884e];return _0x1cc367;};'use strict';var path=require(_0xcb70('0x0'));var os=require('os');var config={'apps':[{'name':_0xcb70('0x1'),'script':path[_0xcb70('0x2')](__dirname,_0xcb70('0x3'))},{'name':'ami','script':path[_0xcb70('0x2')](__dirname,_0xcb70('0x4'))},{'name':_0xcb70('0x5'),'script':path[_0xcb70('0x2')](__dirname,_0xcb70('0x6'))},{'name':_0xcb70('0x7'),'script':path[_0xcb70('0x2')](__dirname,_0xcb70('0x8'))},{'name':_0xcb70('0x9'),'script':path[_0xcb70('0x2')](__dirname,_0xcb70('0xa'))},{'name':_0xcb70('0xb'),'script':path[_0xcb70('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xcb70('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c90c020..f2e9be1 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 _0x847f=['disconnect','stop','restart','then','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start'];(function(_0x42b782,_0xee8501){var _0x57ddd7=function(_0x1baed6){while(--_0x1baed6){_0x42b782['push'](_0x42b782['shift']());}};_0x57ddd7(++_0xee8501);}(_0x847f,0x182));var _0xf847=function(_0x426b63,_0x3b4c07){_0x426b63=_0x426b63-0x0;var _0x1adcc0=_0x847f[_0x426b63];return _0x1adcc0;};'use strict';var pm2=require(_0xf847('0x0'));var BPromise=require(_0xf847('0x1'));var config=require(_0xf847('0x2'));function connect(){return new BPromise(function(_0x4a346f,_0x19a000){return pm2[_0xf847('0x3')](function(_0x1496e8){if(_0x1496e8){return _0x19a000(_0x1496e8);}return _0x4a346f(_0xf847('0x4'));});});};exports[_0xf847('0x5')]=function(_0x5d5964){return connect()['then'](function(){return new BPromise(function(_0x10470f,_0x1cf273){return pm2['start'](_0x5d5964,function(_0x5e7c87,_0x491c65){if(_0x5e7c87){return _0x1cf273(_0x5e7c87);}pm2[_0xf847('0x6')]();return _0x10470f(_0x491c65);});});});};exports[_0xf847('0x7')]=function(_0x18d9a7){return connect()['then'](function(){return new BPromise(function(_0x456ad8,_0x1e5a6e){return pm2[_0xf847('0x7')](_0x18d9a7,function(_0x49bb44,_0x26acc8){if(_0x49bb44){return _0x1e5a6e(_0x49bb44);}pm2['disconnect']();return _0x456ad8(_0x26acc8);});});});};exports[_0xf847('0x8')]=function(_0x2a9424){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0x47c130,_0x1fc016){return pm2['restart'](_0x2a9424,function(_0x17c044,_0x3a29bb){if(_0x17c044){return _0x1fc016(_0x17c044);}pm2[_0xf847('0x6')]();return _0x47c130(_0x3a29bb);});});});};exports[_0xf847('0xa')]=function(){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0x10e2d1,_0x34bdfc){return pm2[_0xf847('0xa')](function(_0x2c2a7b,_0x2b2c1e){if(_0x2c2a7b){return _0x34bdfc(_0x2c2a7b);}pm2[_0xf847('0x6')]();return _0x10e2d1(_0x2b2c1e);});});});};exports[_0xf847('0xb')]=function(_0x6428e){return connect()['then'](function(){return new BPromise(function(_0x1399e8,_0x10abe3){return pm2[_0xf847('0xb')](_0x6428e,function(_0x4bd4f2,_0x4e8201){if(_0x4bd4f2){return _0x10abe3(_0x4bd4f2);}pm2[_0xf847('0x6')]();return _0x1399e8(_0x4e8201);});});});};exports[_0xf847('0xc')]=function(_0x495012){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0xa7f88d,_0x34f349){return pm2[_0xf847('0xc')](_0x495012,function(_0x4299a4,_0x240ab0){if(_0x4299a4){return _0x34f349(_0x4299a4);}pm2['disconnect']();return _0xa7f88d(_0x240ab0);});});});};exports['dump']=function(){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0x25adfc,_0x54f2cb){return pm2[_0xf847('0xd')](function(_0x59e4bf){if(_0x59e4bf){return _0x54f2cb(_0x59e4bf);}return _0x25adfc('saved');});});});}; \ No newline at end of file +var _0x9b69=['start','disconnect','stop','then','restart','delete','dump','pm2','bluebird','./config','connect','connected'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b69,0xa3));var _0x99b6=function(_0x30dacb,_0xaa7f96){_0x30dacb=_0x30dacb-0x0;var _0x5082bd=_0x9b69[_0x30dacb];return _0x5082bd;};'use strict';var pm2=require(_0x99b6('0x0'));var BPromise=require(_0x99b6('0x1'));var config=require(_0x99b6('0x2'));function connect(){return new BPromise(function(_0x47c0a9,_0x4d20c1){return pm2[_0x99b6('0x3')](function(_0x5608e8){if(_0x5608e8){return _0x4d20c1(_0x5608e8);}return _0x47c0a9(_0x99b6('0x4'));});});};exports[_0x99b6('0x5')]=function(_0x293e09){return connect()['then'](function(){return new BPromise(function(_0x45628a,_0x5c4062){return pm2[_0x99b6('0x5')](_0x293e09,function(_0x319215,_0x3d96ae){if(_0x319215){return _0x5c4062(_0x319215);}pm2[_0x99b6('0x6')]();return _0x45628a(_0x3d96ae);});});});};exports[_0x99b6('0x7')]=function(_0x1d188d){return connect()[_0x99b6('0x8')](function(){return new BPromise(function(_0x29cda9,_0x1e8826){return pm2[_0x99b6('0x7')](_0x1d188d,function(_0x3081f5,_0x3f2d8e){if(_0x3081f5){return _0x1e8826(_0x3081f5);}pm2[_0x99b6('0x6')]();return _0x29cda9(_0x3f2d8e);});});});};exports[_0x99b6('0x9')]=function(_0x1bc2d3){return connect()[_0x99b6('0x8')](function(){return new BPromise(function(_0x409539,_0xb5b1da){return pm2[_0x99b6('0x9')](_0x1bc2d3,function(_0x245c3f,_0x48a408){if(_0x245c3f){return _0xb5b1da(_0x245c3f);}pm2['disconnect']();return _0x409539(_0x48a408);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x57033e,_0x565e9e){return pm2['list'](function(_0x172f35,_0x184e90){if(_0x172f35){return _0x565e9e(_0x172f35);}pm2[_0x99b6('0x6')]();return _0x57033e(_0x184e90);});});});};exports['describe']=function(_0xb63749){return connect()[_0x99b6('0x8')](function(){return new BPromise(function(_0x70b3f5,_0x417e9a){return pm2['describe'](_0xb63749,function(_0x433b59,_0x52a4da){if(_0x433b59){return _0x417e9a(_0x433b59);}pm2[_0x99b6('0x6')]();return _0x70b3f5(_0x52a4da);});});});};exports[_0x99b6('0xa')]=function(_0x453735){return connect()[_0x99b6('0x8')](function(){return new BPromise(function(_0x1a6436,_0x4cb2e7){return pm2[_0x99b6('0xa')](_0x453735,function(_0x547488,_0x25dc6a){if(_0x547488){return _0x4cb2e7(_0x547488);}pm2[_0x99b6('0x6')]();return _0x1a6436(_0x25dc6a);});});});};exports[_0x99b6('0xb')]=function(){return connect()[_0x99b6('0x8')](function(){return new BPromise(function(_0x34476d,_0xc65470){return pm2[_0x99b6('0xb')](function(_0x59045f){if(_0x59045f){return _0xc65470(_0x59045f);}return _0x34476d('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f69aa12..c9c2a13 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 _0x8f22=['find','chatTimeout','then','findAll','lastMsgAt','subtract','ChatInteraction','update','system','YYYY-MM-DD\x20HH:mm:ss','emit','error','start','moment','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x2e5917,_0x5e9fc8){var _0x3ff172=function(_0x194074){while(--_0x194074){_0x2e5917['push'](_0x2e5917['shift']());}};_0x3ff172(++_0x5e9fc8);}(_0x8f22,0x163));var _0x28f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f22[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var moment=require(_0x28f2('0x0'));var Redis=require('ioredis');var db=require(_0x28f2('0x1'))['db'];var config=require('../../config/environment');config[_0x28f2('0x2')]=_['defaults'](config[_0x28f2('0x2')],{'host':_0x28f2('0x3'),'port':0x18eb});var io=require(_0x28f2('0x4'))(new Redis(config[_0x28f2('0x2')]));function closeInteractions(){var _0x4e6fd5=0x0;var _0x3e69c6=[];return db['Setting'][_0x28f2('0x5')]({'raw':!![],'attributes':['id',_0x28f2('0x6')],'where':{'id':0x1}})[_0x28f2('0x7')](function(_0x46526a){_0x4e6fd5=_0x46526a[_0x28f2('0x6')];if(_0x4e6fd5){return db['ChatInteraction'][_0x28f2('0x8')]({'raw':!![],'attributes':['id',_0x28f2('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x28f2('0xa')](_0x46526a[_0x28f2('0x6')],'minutes')}}});}else{return[];}})['then'](function(_0x4c498a){_0x3e69c6=_0x4c498a;if(_0x4e6fd5){return db[_0x28f2('0xb')][_0x28f2('0xc')]({'closeReason':_0x28f2('0xd'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x28f2('0xe'))},{'where':{'id':_['map'](_0x3e69c6||[],'id')}});}})[_0x28f2('0x7')](function(_0x3be0be){for(var _0x43c21d=0x0;_0x43c21d<_0x3e69c6['length'];_0x43c21d++){io[_0x28f2('0xf')]('chatInteraction:update',{'id':_0x3e69c6[_0x43c21d]['id'],'closed':!![]});}})['catch'](function(_0x513d27){console[_0x28f2('0x10')](_0x513d27);});}exports[_0x28f2('0x11')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc524=['../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract','then','update','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','catch','start','moment'];(function(_0x3301df,_0x586e4d){var _0x265ab0=function(_0x124ae9){while(--_0x124ae9){_0x3301df['push'](_0x3301df['shift']());}};_0x265ab0(++_0x586e4d);}(_0xc524,0x12b));var _0x4c52=function(_0x838bb6,_0x250612){_0x838bb6=_0x838bb6-0x0;var _0xc3daf1=_0xc524[_0x838bb6];return _0xc3daf1;};'use strict';var _=require('lodash');var moment=require(_0x4c52('0x0'));var Redis=require('ioredis');var db=require(_0x4c52('0x1'))['db'];var config=require(_0x4c52('0x2'));config[_0x4c52('0x3')]=_[_0x4c52('0x4')](config[_0x4c52('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x4c52('0x5'))(new Redis(config[_0x4c52('0x3')]));function closeInteractions(){var _0x526db9=0x0;var _0x2d60a6=[];return db[_0x4c52('0x6')]['find']({'raw':!![],'attributes':['id',_0x4c52('0x7')],'where':{'id':0x1}})['then'](function(_0x155c10){_0x526db9=_0x155c10[_0x4c52('0x7')];if(_0x526db9){return db[_0x4c52('0x8')][_0x4c52('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4c52('0xa')](_0x155c10['chatTimeout'],'minutes')}}});}else{return[];}})[_0x4c52('0xb')](function(_0x2fdf27){_0x2d60a6=_0x2fdf27;if(_0x526db9){return db[_0x4c52('0x8')][_0x4c52('0xc')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x4c52('0xd')](_0x4c52('0xe'))},{'where':{'id':_[_0x4c52('0xf')](_0x2d60a6||[],'id')}});}})[_0x4c52('0xb')](function(_0x280cad){for(var _0x425682=0x0;_0x425682<_0x2d60a6[_0x4c52('0x10')];_0x425682++){io[_0x4c52('0x11')]('chatInteraction:update',{'id':_0x2d60a6[_0x425682]['id'],'closed':!![]});}})[_0x4c52('0x12')](function(_0x57538a){console['error'](_0x57538a);});}exports[_0x4c52('0x13')]=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 8980bc8..2d0ada2 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 _0x78d3=['my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','stop\x20cron','active','endAt','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','service','Smtp','MailAccount','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','toRun','index'];(function(_0x3a4c1c,_0x2409c2){var _0x3da893=function(_0x1000e1){while(--_0x1000e1){_0x3a4c1c['push'](_0x3a4c1c['shift']());}};_0x3da893(++_0x2409c2);}(_0x78d3,0x6b));var _0x378d=function(_0x5a9ab6,_0x1a97b0){_0x5a9ab6=_0x5a9ab6-0x0;var _0x54443c=_0x78d3[_0x5a9ab6];return _0x54443c;};'use strict';var fs=require('fs');var util=require(_0x378d('0x0'));var path=require(_0x378d('0x1'));var _=require(_0x378d('0x2'));var moment=require('moment');var CronJobManager=require(_0x378d('0x3'));var jayson=require(_0x378d('0x4'));var BPromise=require(_0x378d('0x5'));var logger=require(_0x378d('0x6'))(_0x378d('0x7'));var db=require(_0x378d('0x8'))['db'];var analyticCustomReportController=require(_0x378d('0x9'));var analyticDefaultReportController=require(_0x378d('0xa'));var client=jayson[_0x378d('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x32ddaa,_0x478b27){return function(){logger[_0x378d('0xc')](_0x378d('0xd'),_0x32ddaa['email']);var _0x564443=!![];var _0x418956={'tls':{'rejectUnauthorized':![]}};if(_0x32ddaa['MailAccount']['Smtp']['service']){_0x418956[_0x378d('0xe')]=_0x32ddaa['MailAccount'][_0x378d('0xf')][_0x378d('0xe')];}else{_0x418956['host']=_0x32ddaa[_0x378d('0x10')][_0x378d('0xf')]['host'];_0x418956[_0x378d('0x11')]=_0x32ddaa[_0x378d('0x10')]['Smtp'][_0x378d('0x11')];_0x418956['secure']=_0x32ddaa[_0x378d('0x10')][_0x378d('0xf')][_0x378d('0x12')];}if(_0x32ddaa[_0x378d('0x10')][_0x378d('0xf')][_0x378d('0x13')]){_0x418956['auth']={'user':_0x32ddaa['MailAccount']['Smtp'][_0x378d('0x14')],'pass':_0x32ddaa['MailAccount'][_0x378d('0xf')][_0x378d('0x15')]};}var _0x598d65={'account':_0x418956,'message':{'from':util[_0x378d('0x16')](_0x378d('0x17'),_0x32ddaa[_0x378d('0x10')][_0x378d('0x18')],_0x32ddaa[_0x378d('0x10')]['email']||_0x32ddaa[_0x378d('0x10')]['Smtp'][_0x378d('0x14')]),'to':_0x32ddaa[_0x378d('0x19')],'cc':_0x32ddaa['cc'],'bcc':_0x32ddaa[_0x378d('0x1a')],'subject':util[_0x378d('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x478b27[_0x378d('0x18')],_0x32ddaa[_0x378d('0x1b')],_0x32ddaa[_0x378d('0x1c')])}};var _0x5c4e37=path[_0x378d('0x1d')](__dirname,_0x378d('0x1e'));var _0x317429=_0x478b27[_0x378d('0x1f')];var _0x34072b=util[_0x378d('0x16')](_0x378d('0x20'),path['basename'](_0x478b27[_0x378d('0x1f')],path[_0x378d('0x21')](_0x478b27[_0x378d('0x1f')])),_0x378d('0x22'));var _0x481176=path[_0x378d('0x1d')](_0x5c4e37,_0x317429);var _0x1361df=path[_0x378d('0x1d')](_0x5c4e37,_0x34072b);if(fs[_0x378d('0x23')](_0x481176)){_0x478b27[_0x378d('0x24')]=_0x378d('0x25');_0x598d65['message'][_0x378d('0x26')]=[{'filename':_0x317429,'path':_0x481176}];_0x598d65[_0x378d('0x27')][_0x378d('0x28')]=util['format'](_0x378d('0x29'),JSON[_0x378d('0x2a')](_0x478b27,null,0x2));}else if(fs[_0x378d('0x23')](_0x1361df)){_0x478b27[_0x378d('0x24')]='Sent';_0x598d65[_0x378d('0x27')][_0x378d('0x26')]=[{'filename':_0x34072b,'path':_0x1361df}];}else{_0x598d65['message']['text']=_0x378d('0x2b');if(!_0x32ddaa[_0x378d('0x2c')]){_0x564443=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x564443){return client[_0x378d('0x2d')](_0x378d('0x2e'),_0x598d65)[_0x378d('0x2f')](function(_0x828aba){if(_0x828aba['error']){return logger[_0x378d('0x30')]('error\x20mail',JSON[_0x378d('0x2a')](_0x828aba));}return logger['info'](_0x378d('0x31'));})[_0x378d('0x32')](function(_0x7197ca){return logger[_0x378d('0x30')]('error\x20mail',JSON[_0x378d('0x2a')](_0x7197ca));});}};}function handleError(){return function(_0x66c4e7){return logger['error'](JSON['stringify'](_0x66c4e7));};}function handleResult(_0x250f2b){return function(_0x2ff047){logger['info'](_0x378d('0x33'),JSON[_0x378d('0x2a')](_0x2ff047));if(_0x250f2b[_0x378d('0x10')]&&_0x250f2b[_0x378d('0x10')][_0x378d('0xf')]&&!_[_0x378d('0x34')](_0x250f2b[_0x378d('0x19')])){setTimeout(handleSendEmail(_0x250f2b,_0x2ff047),0x3c*0x3e8);}};}function handleJob(_0x1216c1){return function(){try{if(_[_0x378d('0x34')](_0x1216c1[_0x378d('0x1b')])){return logger[_0x378d('0xc')](_0x378d('0x35'));}if(_[_0x378d('0x34')](_0x1216c1[_0x378d('0x1c')])){return logger[_0x378d('0xc')](_0x378d('0x36'));}var _0x53554e={'startDate':moment()[_0x378d('0x37')](_0x1216c1[_0x378d('0x1b')],_0x1216c1['subtractUnit'])[_0x378d('0x16')](_0x378d('0x38')),'endDate':moment()[_0x378d('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x378d('0x39'),'output':_0x1216c1['output'],'name':_0x1216c1[_0x378d('0x18')]};if(!_[_0x378d('0x34')](_0x1216c1['DefaultReportId'])){logger[_0x378d('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x1216c1[_0x378d('0x3a')]);return analyticDefaultReportController[_0x378d('0x3b')]({'id':_0x1216c1[_0x378d('0x3a')]},_0x53554e)[_0x378d('0x2f')](handleResult(_0x1216c1))['catch'](handleError());}if(!_[_0x378d('0x34')](_0x1216c1['CustomReportId'])){logger[_0x378d('0xc')](_0x378d('0x3c'),_0x1216c1['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x1216c1[_0x378d('0x3d')]},_0x53554e)[_0x378d('0x2f')](handleResult(_0x1216c1))[_0x378d('0x32')](handleError());}}catch(_0x15150f){logger[_0x378d('0x30')](JSON['stringify'](_0x15150f));}return logger['info'](_0x378d('0x3e'));};}function getJobs(_0x230619){var _0xc5961c={};if(_0x230619){_0xc5961c['id']=_0x230619;}return db[_0x378d('0x3f')][_0x378d('0x40')]({'where':_0xc5961c,'include':[{'model':db[_0x378d('0x10')],'attributes':['id',_0x378d('0x18'),_0x378d('0x19')],'include':[{'model':db[_0x378d('0x41')],'as':_0x378d('0xf')}]}]})[_0x378d('0x2f')](function(_0x36773d){var _0x3b9495=_['keys'](manager[_0x378d('0x42')]);var _0x2e9f62=_['map'](_0x36773d,function(_0x39344d){return _0x39344d['id'][_0x378d('0x43')]();});var _0x4ebb43=_[_0x378d('0x44')](_0x36773d,function(_0x59d540){return _0x59d540['id'][_0x378d('0x43')]();});var _0x1568fa=_0x230619?_0x2e9f62:_['difference'](_0x2e9f62,_0x3b9495);var _0x15b467=_[_0x378d('0x45')](_0x2e9f62,_0x3b9495);var _0x35a001=_[_0x378d('0x46')](_0x3b9495,_0x2e9f62);var _0x5a9af0;var _0x5d012e;for(_0x5a9af0=0x0;_0x5a9af0<_0x35a001[_0x378d('0x47')]&&!_0x230619;_0x5a9af0+=0x1){_0x5d012e=_0x35a001[_0x5a9af0][_0x378d('0x43')]();if(manager[_0x378d('0x48')](_0x5d012e)){manager[_0x378d('0x49')](_0x5d012e);manager[_0x378d('0x4a')](_0x5d012e);logger['info']('delete\x20cron',_0x5d012e);}}logger[_0x378d('0xc')](_0x378d('0x4b'),JSON[_0x378d('0x2a')](_0x1568fa));for(_0x5a9af0=0x0;_0x5a9af0<_0x1568fa[_0x378d('0x47')];_0x5a9af0+=0x1){_0x5d012e=_0x1568fa[_0x5a9af0]['toString']();logger['info'](_0x378d('0x4c'),_0x5d012e);if(_0x230619){logger[_0x378d('0xc')](_0x378d('0x4d'),_0x230619);logger['info'](JSON[_0x378d('0x2a')](_0x4ebb43[_0x5d012e]));BPromise[_0x378d('0x4e')]()[_0x378d('0x2f')](handleJob(_0x4ebb43[_0x5d012e]));logger[_0x378d('0xc')](_0x378d('0x4f'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e]['cron']);}else if(_0x4ebb43[_0x5d012e][_0x378d('0x50')]&&_0x4ebb43[_0x5d012e]['active']&&moment()[_0x378d('0x51')](_0x4ebb43[_0x5d012e][_0x378d('0x52')],_0x4ebb43[_0x5d012e]['endAt'])){manager[_0x378d('0x53')](_0x5d012e,_0x4ebb43[_0x5d012e][_0x378d('0x50')],handleJob(_0x4ebb43[_0x5d012e]));manager[_0x378d('0x54')](_0x5d012e);logger[_0x378d('0xc')](_0x378d('0x55'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e][_0x378d('0x50')]);}else if(manager['exists'](_0x5d012e)){manager[_0x378d('0x49')](_0x5d012e);manager[_0x378d('0x4a')](_0x5d012e);logger[_0x378d('0xc')](_0x378d('0x56'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e][_0x378d('0x50')]);}}for(_0x5a9af0=0x0,_0x5d012e;_0x5a9af0<_0x15b467[_0x378d('0x47')]&&!_0x230619;_0x5a9af0+=0x1){_0x5d012e=_0x15b467[_0x5a9af0][_0x378d('0x43')]();if(manager[_0x378d('0x48')](_0x5d012e)){if(_0x4ebb43[_0x5d012e]['cron']&&_0x4ebb43[_0x5d012e][_0x378d('0x57')]&&moment()[_0x378d('0x51')](_0x4ebb43[_0x5d012e][_0x378d('0x52')],_0x4ebb43[_0x5d012e][_0x378d('0x58')])){manager[_0x378d('0x59')](_0x5d012e,_0x4ebb43[_0x5d012e][_0x378d('0x50')],handleJob(_0x4ebb43[_0x5d012e]));logger[_0x378d('0xc')](_0x378d('0x5a'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e][_0x378d('0x50')]);}else{manager[_0x378d('0x49')](_0x5d012e);manager['deleteJob'](_0x5d012e);logger['info']('stop\x20cron',_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e]['cron']);}}}})[_0x378d('0x32')](function(_0xc612e6){logger[_0x378d('0x30')](JSON['stringify'](_0xc612e6));});}exports[_0x378d('0x5b')]=function(_0x48f2cc){return getJobs(_0x48f2cc);};exports[_0x378d('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2453=['existsSync','status','Sent','attachments','message','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','run','util','lodash','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip'];(function(_0x1bdb13,_0x42b7fd){var _0x383fec=function(_0x2cf823){while(--_0x2cf823){_0x1bdb13['push'](_0x1bdb13['shift']());}};_0x383fec(++_0x42b7fd);}(_0x2453,0x8d));var _0x3245=function(_0x441509,_0x19c4fc){_0x441509=_0x441509-0x0;var _0x48c70b=_0x2453[_0x441509];return _0x48c70b;};'use strict';var fs=require('fs');var util=require(_0x3245('0x0'));var path=require('path');var _=require(_0x3245('0x1'));var moment=require('moment');var CronJobManager=require(_0x3245('0x2'));var jayson=require(_0x3245('0x3'));var BPromise=require(_0x3245('0x4'));var logger=require('../logger')(_0x3245('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3245('0x6'));var client=jayson[_0x3245('0x7')][_0x3245('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3ee53b,_0x1a9bfd){return function(){logger[_0x3245('0x9')](_0x3245('0xa'),_0x3ee53b[_0x3245('0xb')]);var _0x96d2de=!![];var _0x4968db={'tls':{'rejectUnauthorized':![]}};if(_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')]['service']){_0x4968db['service']=_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')][_0x3245('0xe')];}else{_0x4968db[_0x3245('0xf')]=_0x3ee53b['MailAccount'][_0x3245('0xd')]['host'];_0x4968db[_0x3245('0x10')]=_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')][_0x3245('0x10')];_0x4968db['secure']=_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')][_0x3245('0x11')];}if(_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')][_0x3245('0x12')]){_0x4968db['auth']={'user':_0x3ee53b[_0x3245('0xc')]['Smtp'][_0x3245('0x13')],'pass':_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')][_0x3245('0x14')]};}var _0x2215d9={'account':_0x4968db,'message':{'from':util[_0x3245('0x15')](_0x3245('0x16'),_0x3ee53b[_0x3245('0xc')][_0x3245('0x17')],_0x3ee53b['MailAccount'][_0x3245('0xb')]||_0x3ee53b[_0x3245('0xc')][_0x3245('0xd')][_0x3245('0x13')]),'to':_0x3ee53b[_0x3245('0xb')],'cc':_0x3ee53b['cc'],'bcc':_0x3ee53b[_0x3245('0x18')],'subject':util[_0x3245('0x15')](_0x3245('0x19'),_0x1a9bfd['name'],_0x3ee53b[_0x3245('0x1a')],_0x3ee53b[_0x3245('0x1b')])}};var _0x525292=path[_0x3245('0x1c')](__dirname,_0x3245('0x1d'));var _0x3d79d8=_0x1a9bfd[_0x3245('0x1e')];var _0x3379d1=util[_0x3245('0x15')](_0x3245('0x1f'),path[_0x3245('0x20')](_0x1a9bfd[_0x3245('0x1e')],path[_0x3245('0x21')](_0x1a9bfd[_0x3245('0x1e')])),_0x3245('0x22'));var _0x493991=path[_0x3245('0x1c')](_0x525292,_0x3d79d8);var _0x49b754=path[_0x3245('0x1c')](_0x525292,_0x3379d1);if(fs[_0x3245('0x23')](_0x493991)){_0x1a9bfd[_0x3245('0x24')]=_0x3245('0x25');_0x2215d9['message'][_0x3245('0x26')]=[{'filename':_0x3d79d8,'path':_0x493991}];_0x2215d9[_0x3245('0x27')][_0x3245('0x28')]=util[_0x3245('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x3245('0x29')](_0x1a9bfd,null,0x2));}else if(fs[_0x3245('0x23')](_0x49b754)){_0x1a9bfd['status']=_0x3245('0x25');_0x2215d9[_0x3245('0x27')][_0x3245('0x26')]=[{'filename':_0x3379d1,'path':_0x49b754}];}else{_0x2215d9['message'][_0x3245('0x28')]=_0x3245('0x2a');if(!_0x3ee53b['sendIfEmpty']){_0x96d2de=![];logger[_0x3245('0x9')](_0x3245('0x2b'));}}if(_0x96d2de){return client['request'](_0x3245('0x2c'),_0x2215d9)[_0x3245('0x2d')](function(_0x18418c){if(_0x18418c[_0x3245('0x2e')]){return logger[_0x3245('0x2e')]('error\x20mail',JSON[_0x3245('0x29')](_0x18418c));}return logger[_0x3245('0x9')](_0x3245('0x2f'));})[_0x3245('0x30')](function(_0x2a8b32){return logger[_0x3245('0x2e')](_0x3245('0x31'),JSON[_0x3245('0x29')](_0x2a8b32));});}};}function handleError(){return function(_0x3dffb6){return logger['error'](JSON[_0x3245('0x29')](_0x3dffb6));};}function handleResult(_0x32a00a){return function(_0x5f22bf){logger[_0x3245('0x9')](_0x3245('0x32'),JSON[_0x3245('0x29')](_0x5f22bf));if(_0x32a00a[_0x3245('0xc')]&&_0x32a00a[_0x3245('0xc')][_0x3245('0xd')]&&!_['isNil'](_0x32a00a['email'])){setTimeout(handleSendEmail(_0x32a00a,_0x5f22bf),0x3c*0x3e8);}};}function handleJob(_0x4f0174){return function(){try{if(_[_0x3245('0x33')](_0x4f0174[_0x3245('0x1a')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x3245('0x33')](_0x4f0174[_0x3245('0x1b')])){return logger[_0x3245('0x9')](_0x3245('0x34'));}var _0x5d9bdf={'startDate':moment()[_0x3245('0x35')](_0x4f0174[_0x3245('0x1a')],_0x4f0174[_0x3245('0x1b')])[_0x3245('0x15')](_0x3245('0x36')),'endDate':moment()[_0x3245('0x15')](_0x3245('0x36')),'type':_0x3245('0x37'),'output':_0x4f0174[_0x3245('0x38')],'name':_0x4f0174[_0x3245('0x17')]};if(!_[_0x3245('0x33')](_0x4f0174[_0x3245('0x39')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4f0174[_0x3245('0x39')]);return analyticDefaultReportController[_0x3245('0x3a')]({'id':_0x4f0174[_0x3245('0x39')]},_0x5d9bdf)['then'](handleResult(_0x4f0174))[_0x3245('0x30')](handleError());}if(!_[_0x3245('0x33')](_0x4f0174[_0x3245('0x3b')])){logger['info'](_0x3245('0x3c'),_0x4f0174['CustomReportId']);return analyticCustomReportController[_0x3245('0x3a')]({'id':_0x4f0174[_0x3245('0x3b')]},_0x5d9bdf)[_0x3245('0x2d')](handleResult(_0x4f0174))['catch'](handleError());}}catch(_0x40d0bb){logger[_0x3245('0x2e')](JSON[_0x3245('0x29')](_0x40d0bb));}return logger[_0x3245('0x9')](_0x3245('0x3d'));};}function getJobs(_0x335ee4){var _0x5304b6={};if(_0x335ee4){_0x5304b6['id']=_0x335ee4;}return db[_0x3245('0x3e')][_0x3245('0x3f')]({'where':_0x5304b6,'include':[{'model':db[_0x3245('0xc')],'attributes':['id',_0x3245('0x17'),_0x3245('0xb')],'include':[{'model':db['MailServerOut'],'as':_0x3245('0xd')}]}]})[_0x3245('0x2d')](function(_0x3cceeb){var _0x5e1bf9=_[_0x3245('0x40')](manager['jobs']);var _0x39f919=_[_0x3245('0x41')](_0x3cceeb,function(_0xea3cc4){return _0xea3cc4['id']['toString']();});var _0x2c84f0=_['keyBy'](_0x3cceeb,function(_0x3c40fc){return _0x3c40fc['id'][_0x3245('0x42')]();});var _0xb4409e=_0x335ee4?_0x39f919:_[_0x3245('0x43')](_0x39f919,_0x5e1bf9);var _0x50663d=_[_0x3245('0x44')](_0x39f919,_0x5e1bf9);var _0x16cb5f=_['difference'](_0x5e1bf9,_0x39f919);var _0x29d661;var _0x4fac0e;for(_0x29d661=0x0;_0x29d661<_0x16cb5f[_0x3245('0x45')]&&!_0x335ee4;_0x29d661+=0x1){_0x4fac0e=_0x16cb5f[_0x29d661][_0x3245('0x42')]();if(manager[_0x3245('0x46')](_0x4fac0e)){manager[_0x3245('0x47')](_0x4fac0e);manager[_0x3245('0x48')](_0x4fac0e);logger[_0x3245('0x9')](_0x3245('0x49'),_0x4fac0e);}}logger[_0x3245('0x9')](_0x3245('0x4a'),JSON['stringify'](_0xb4409e));for(_0x29d661=0x0;_0x29d661<_0xb4409e[_0x3245('0x45')];_0x29d661+=0x1){_0x4fac0e=_0xb4409e[_0x29d661][_0x3245('0x42')]();logger[_0x3245('0x9')](_0x3245('0x4b'),_0x4fac0e);if(_0x335ee4){logger['info'](_0x3245('0x4c'),_0x335ee4);logger['info'](JSON[_0x3245('0x29')](_0x2c84f0[_0x4fac0e]));BPromise['resolve']()[_0x3245('0x2d')](handleJob(_0x2c84f0[_0x4fac0e]));logger[_0x3245('0x9')](_0x3245('0x4d'),_0x2c84f0[_0x4fac0e][_0x3245('0x17')],_0x2c84f0[_0x4fac0e][_0x3245('0x4e')]);}else if(_0x2c84f0[_0x4fac0e]['cron']&&_0x2c84f0[_0x4fac0e][_0x3245('0x4f')]&&moment()[_0x3245('0x50')](_0x2c84f0[_0x4fac0e][_0x3245('0x51')],_0x2c84f0[_0x4fac0e][_0x3245('0x52')])){manager[_0x3245('0x53')](_0x4fac0e,_0x2c84f0[_0x4fac0e]['cron'],handleJob(_0x2c84f0[_0x4fac0e]));manager[_0x3245('0x54')](_0x4fac0e);logger[_0x3245('0x9')](_0x3245('0x55'),_0x2c84f0[_0x4fac0e][_0x3245('0x17')],_0x2c84f0[_0x4fac0e][_0x3245('0x4e')]);}else if(manager['exists'](_0x4fac0e)){manager[_0x3245('0x47')](_0x4fac0e);manager[_0x3245('0x48')](_0x4fac0e);logger[_0x3245('0x9')]('stop\x20cron',_0x2c84f0[_0x4fac0e][_0x3245('0x17')],_0x2c84f0[_0x4fac0e][_0x3245('0x4e')]);}}for(_0x29d661=0x0,_0x4fac0e;_0x29d661<_0x50663d[_0x3245('0x45')]&&!_0x335ee4;_0x29d661+=0x1){_0x4fac0e=_0x50663d[_0x29d661][_0x3245('0x42')]();if(manager[_0x3245('0x46')](_0x4fac0e)){if(_0x2c84f0[_0x4fac0e][_0x3245('0x4e')]&&_0x2c84f0[_0x4fac0e][_0x3245('0x4f')]&&moment()['isBetween'](_0x2c84f0[_0x4fac0e][_0x3245('0x51')],_0x2c84f0[_0x4fac0e]['endAt'])){manager['update'](_0x4fac0e,_0x2c84f0[_0x4fac0e][_0x3245('0x4e')],handleJob(_0x2c84f0[_0x4fac0e]));logger[_0x3245('0x9')]('update\x20cron',_0x2c84f0[_0x4fac0e][_0x3245('0x17')],_0x2c84f0[_0x4fac0e][_0x3245('0x4e')]);}else{manager[_0x3245('0x47')](_0x4fac0e);manager[_0x3245('0x48')](_0x4fac0e);logger[_0x3245('0x9')](_0x3245('0x56'),_0x2c84f0[_0x4fac0e][_0x3245('0x17')],_0x2c84f0[_0x4fac0e][_0x3245('0x4e')]);}}}})[_0x3245('0x30')](function(_0x104865){logger[_0x3245('0x2e')](JSON[_0x3245('0x29')](_0x104865));});}exports[_0x3245('0x57')]=function(_0x10eef9){return getJobs(_0x10eef9);};exports[_0x3245('0x54')]=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 af31ecf..a86156a 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 _0xf677=['update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','forEach','push','all','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript'];(function(_0x18c8b5,_0x2a15d3){var _0x358984=function(_0xf5461){while(--_0xf5461){_0x18c8b5['push'](_0x18c8b5['shift']());}};_0x358984(++_0x2a15d3);}(_0xf677,0xb3));var _0x7f67=function(_0x4ee8f2,_0x341ceb){_0x4ee8f2=_0x4ee8f2-0x0;var _0x59d6c8=_0xf677[_0x4ee8f2];return _0x59d6c8;};var _=require('lodash');var AWS=require(_0x7f67('0x0'));var rp=require(_0x7f67('0x1'));var util=require(_0x7f67('0x2'));var BPromise=require('bluebird');var db=require(_0x7f67('0x3'))['db'];var logger=require(_0x7f67('0x4'))(_0x7f67('0x5'));function getTranscriptionJob(_0x37ff1d,_0xf4e4,_0x82ab01,_0x5d35e8){return new Promise(function(_0x285aa1,_0x5ada61){var _0x684a3a=new AWS[(_0x7f67('0x6'))]({'accessKeyId':_0xf4e4,'secretAccessKey':_0x37ff1d,'region':_0x82ab01});_0x684a3a['getTranscriptionJob']({'TranscriptionJobName':_0x5d35e8},function(_0x220695,_0x436ffc){if(_0x220695){return _0x5ada61(_0x220695);}else{return _0x285aa1(_0x436ffc);}});});}function sentiment(_0x5a018a,_0x4a9bf9,_0x28b581,_0x40933f,_0x5b090c){return new Promise(function(_0x324424,_0x85dbef){var _0x5e1e8b=new AWS['Comprehend']({'accessKeyId':_0x4a9bf9,'secretAccessKey':_0x5a018a,'region':_0x28b581});_0x5e1e8b[_0x7f67('0x7')]({'Text':_0x40933f,'LanguageCode':_0x5b090c['substring'](0x0,0x2)},function(_0x5f40b9,_0x1f91cc){if(_0x5f40b9){return _0x85dbef(_0x5f40b9);}else{return _0x324424(_0x1f91cc);}});});}function checkTranscribeJob(_0x4658d2,_0xc991f3,_0x599059){var _0x54aa57;return new BPromise(function(_0x1550a7,_0x27239f){logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0xa'),_0x4658d2['id'],_0x4658d2[_0x7f67('0xb')]));return getTranscriptionJob(_0x599059[_0x7f67('0xc')],_0x599059[_0x7f67('0xd')],_0xc991f3[_0x7f67('0xe')],_0x4658d2[_0x7f67('0xb')])[_0x7f67('0xf')](function(_0x5452c9){logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4658d2['id'],_0x4658d2[_0x7f67('0xb')],_0x5452c9[_0x7f67('0x10')][_0x7f67('0x11')]));if(!_0x4658d2[_0x7f67('0x12')]){switch(_0x5452c9[_0x7f67('0x10')][_0x7f67('0x11')]){case _0x7f67('0x13'):var _0x1399b5={'transcribeStatus':_0x5452c9['TranscriptionJob'][_0x7f67('0x11')],'fileUri':_0x5452c9['TranscriptionJob'][_0x7f67('0x14')]['TranscriptFileUri']};logger[_0x7f67('0x8')](util['format'](_0x7f67('0x15'),_0x4658d2['id']));return rp({'uri':_0x5452c9[_0x7f67('0x10')][_0x7f67('0x14')][_0x7f67('0x16')],'json':!![]})[_0x7f67('0xf')](function(_0x346690){logger[_0x7f67('0x8')](util['format'](_0x7f67('0x17'),_0x4658d2['id']));if(_0x346690&&_0x346690[_0x7f67('0x18')]&&_0x346690[_0x7f67('0x18')][_0x7f67('0x19')]&&_0x346690[_0x7f67('0x18')]['transcripts'][_0x7f67('0x1a')]){_0x1399b5['fileText']='';for(var _0x24dc70=0x0;_0x24dc70<_0x346690[_0x7f67('0x18')][_0x7f67('0x19')][_0x7f67('0x1a')];_0x24dc70++){_0x1399b5[_0x7f67('0x12')]+=_0x346690[_0x7f67('0x18')][_0x7f67('0x19')][_0x24dc70][_0x7f67('0x1b')]+'';}}return _0x4658d2[_0x7f67('0x1c')](_0x1399b5);})[_0x7f67('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4658d2['id']));if(!_0x4658d2[_0x7f67('0x1d')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x20'));}if(!_0xc991f3[_0x7f67('0x21')]||!_0xc991f3[_0x7f67('0x22')]||!_0xc991f3['sentimentRegion']||!_0xc991f3[_0x7f67('0x23')]||!_0xc991f3[_0x7f67('0x24')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1399b5[_0x7f67('0x12')]){throw new Error(_0x7f67('0x25'));}if(_0xc991f3[_0x7f67('0x22')]===_0x599059['id']){return _0x599059;}else{return db[_0x7f67('0x26')][_0x7f67('0x27')]({'where':{'id':_settings[_0x7f67('0x22')]}});}})[_0x7f67('0xf')](function(_0x28e028){if(!_0x28e028){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x28'));}if(!_0x28e028['data1']||!_0x28e028['data2']){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x29'));}_0x54aa57=_0x28e028;logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4658d2['id']));return sentiment(_0x54aa57[_0x7f67('0xc')],_0x54aa57['data2'],_0xc991f3['sentimentRegion'],_0x1399b5[_0x7f67('0x12')],_0xc991f3[_0x7f67('0x23')]);})[_0x7f67('0xf')](function(_0x38dd73){logger[_0x7f67('0x8')](util['format'](_0x7f67('0x2a'),_0x4658d2['id']));return _0x4658d2['update']({'sentiment':_0x38dd73[_0x7f67('0x2b')],'sPositive':_0x38dd73[_0x7f67('0x2c')]['Positive'],'sNegative':_0x38dd73[_0x7f67('0x2c')][_0x7f67('0x2d')],'sMixed':_0x38dd73[_0x7f67('0x2c')]['Mixed'],'sNeutral':_0x38dd73[_0x7f67('0x2c')][_0x7f67('0x2e')]});})['then'](function(){logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4658d2['id']));_0x1550a7();});case _0x7f67('0x2f'):return _0x4658d2[_0x7f67('0x1c')]({'transcribeStatus':_0x7f67('0x2f'),'failureReason':_0x5452c9['TranscriptionJob'][_0x7f67('0x30')]})[_0x7f67('0xf')](function(){logger[_0x7f67('0x8')](util['format'](_0x7f67('0x31'),_0x4658d2['id']));_0x1550a7();});default:logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0x32'),_0x4658d2['id']));break;}}else{return BPromise[_0x7f67('0x33')]()['then'](function(){if(!_0x4658d2[_0x7f67('0x1d')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x20'));}if(!_0xc991f3[_0x7f67('0x21')]||!_0xc991f3[_0x7f67('0x22')]||!_0xc991f3['sentimentRegion']||!_0xc991f3['language']||!_0xc991f3[_0x7f67('0x24')]){throw new db['Sequelize'][(_0x7f67('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4658d2[_0x7f67('0x12')]){throw new Error(_0x7f67('0x25'));}if(_0xc991f3['sentimentAccountId']===_0x599059['id']){return _0x599059;}else{return db['CloudProvider'][_0x7f67('0x27')]({'where':{'id':_settings[_0x7f67('0x22')]}});}})[_0x7f67('0xf')](function(_0x4fda36){if(!_0x4fda36){throw new db[(_0x7f67('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4fda36['data1']||!_0x4fda36[_0x7f67('0xd')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x29'));}_0x54aa57=_0x4fda36;logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0x34'),_0x4658d2['id']));return sentiment(_0x54aa57[_0x7f67('0xc')],_0x54aa57[_0x7f67('0xd')],_0xc991f3[_0x7f67('0x35')],_0x4658d2['fileText'],_0xc991f3[_0x7f67('0x23')]);})[_0x7f67('0xf')](function(_0x54d58c){logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0x2a'),_0x4658d2['id']));return _0x4658d2[_0x7f67('0x1c')]({'sentiment':_0x54d58c[_0x7f67('0x2b')],'sPositive':_0x54d58c['SentimentScore'][_0x7f67('0x36')],'sNegative':_0x54d58c[_0x7f67('0x2c')][_0x7f67('0x2d')],'sMixed':_0x54d58c['SentimentScore']['Mixed'],'sNeutral':_0x54d58c[_0x7f67('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x7f67('0xf')](function(){logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4658d2['id']));_0x1550a7();});}})[_0x7f67('0x37')](function(_0x1db09f){if(_0x1db09f){if(!_0x1db09f[_0x7f67('0x38')]||_0x1db09f[_0x7f67('0x38')]!==_0x7f67('0x39')){logger[_0x7f67('0x3a')](util[_0x7f67('0x9')](_0x7f67('0x3b'),_0x4658d2['id']),util[_0x7f67('0x3c')](_0x1db09f,{'showHidden':![],'depth':null}));}}_0x1550a7();});});}function checkTranscribe(){var _0x4e41fb;var _0x4680bf;var _0x396d46;return db[_0x7f67('0x3d')][_0x7f67('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7f67('0xf')](function(_0xf22456){if(!_0xf22456||!_0xf22456[_0x7f67('0x1a')]){throw new db['Sequelize'][(_0x7f67('0x1f'))](_0x7f67('0x3f'));}_0x4e41fb=_0xf22456;return db['Setting'][_0x7f67('0x27')]({'where':{'id':0x1}});})[_0x7f67('0xf')](function(_0x1f1928){if(!_0x1f1928){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))]('Settings\x20not\x20available');}_0x4680bf=_0x1f1928;if(!_0x4680bf[_0x7f67('0x5')]||!_0x4680bf[_0x7f67('0x40')]||!_0x4680bf[_0x7f67('0xe')]||!_0x4680bf[_0x7f67('0x23')]||!_0x4680bf[_0x7f67('0x24')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x7f67('0x26')][_0x7f67('0x27')]({'where':{'id':_0x4680bf['transcribeAccountId']}});})[_0x7f67('0xf')](function(_0xfce8d4){if(!_0xfce8d4){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x28'));}if(!_0xfce8d4['data1']||!_0xfce8d4[_0x7f67('0xd')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x29'));}_0x396d46=_0xfce8d4;var _0x4f1dde=[];_0x4e41fb[_0x7f67('0x41')](function(_0x258061){_0x4f1dde[_0x7f67('0x42')](checkTranscribeJob(_0x258061,_0x4680bf,_0x396d46));});return BPromise[_0x7f67('0x43')](_0x4f1dde);})[_0x7f67('0x37')](function(_0x1fd17f){if(_0x1fd17f){if(!_0x1fd17f['name']||_0x1fd17f[_0x7f67('0x38')]!=='SequelizeValidationError'){logger[_0x7f67('0x3a')](util[_0x7f67('0x3c')](_0x1fd17f,{'showHidden':![],'depth':null}));}}});}exports[_0x7f67('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x611e=['resolve','CloudProvider','Cloud\x20Provider\x20not\x20available','Positive','Negative','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','SequelizeValidationError','start','lodash','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Sequelize','ValidationError','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','Neutral','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed'];(function(_0x290797,_0x19bb04){var _0x5f51e9=function(_0x3d5ce2){while(--_0x3d5ce2){_0x290797['push'](_0x290797['shift']());}};_0x5f51e9(++_0x19bb04);}(_0x611e,0x1d1));var _0xe611=function(_0x9669b6,_0x45c9f7){_0x9669b6=_0x9669b6-0x0;var _0x472f00=_0x611e[_0x9669b6];return _0x472f00;};var _=require(_0xe611('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xe611('0x1'));var BPromise=require(_0xe611('0x2'));var db=require(_0xe611('0x3'))['db'];var logger=require(_0xe611('0x4'))(_0xe611('0x5'));function getTranscriptionJob(_0x4bd203,_0x4fc61a,_0x6f5736,_0x547709){return new Promise(function(_0x129048,_0xa72dc5){var _0x20a78c=new AWS[(_0xe611('0x6'))]({'accessKeyId':_0x4fc61a,'secretAccessKey':_0x4bd203,'region':_0x6f5736});_0x20a78c[_0xe611('0x7')]({'TranscriptionJobName':_0x547709},function(_0x167ad6,_0x52ced2){if(_0x167ad6){return _0xa72dc5(_0x167ad6);}else{return _0x129048(_0x52ced2);}});});}function sentiment(_0x539af6,_0x43a70c,_0xb09fbc,_0x3d82b7,_0x37454b){return new Promise(function(_0x184071,_0x5eecab){var _0x5ae624=new AWS[(_0xe611('0x8'))]({'accessKeyId':_0x43a70c,'secretAccessKey':_0x539af6,'region':_0xb09fbc});_0x5ae624[_0xe611('0x9')]({'Text':_0x3d82b7,'LanguageCode':_0x37454b[_0xe611('0xa')](0x0,0x2)},function(_0x34b9a1,_0xe4e12b){if(_0x34b9a1){return _0x5eecab(_0x34b9a1);}else{return _0x184071(_0xe4e12b);}});});}function checkTranscribeJob(_0x54ef69,_0x50abe9,_0x2819d4){var _0x2b33dd;return new BPromise(function(_0x45a58f,_0x5da821){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0xd'),_0x54ef69['id'],_0x54ef69[_0xe611('0xe')]));return getTranscriptionJob(_0x2819d4['data1'],_0x2819d4['data2'],_0x50abe9['transcribeRegion'],_0x54ef69[_0xe611('0xe')])[_0xe611('0xf')](function(_0x4960dc){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x10'),_0x54ef69['id'],_0x54ef69[_0xe611('0xe')],_0x4960dc[_0xe611('0x11')]['TranscriptionJobStatus']));if(!_0x54ef69[_0xe611('0x12')]){switch(_0x4960dc[_0xe611('0x11')]['TranscriptionJobStatus']){case _0xe611('0x13'):var _0x5d2ba9={'transcribeStatus':_0x4960dc[_0xe611('0x11')]['TranscriptionJobStatus'],'fileUri':_0x4960dc['TranscriptionJob'][_0xe611('0x14')][_0xe611('0x15')]};logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x16'),_0x54ef69['id']));return rp({'uri':_0x4960dc[_0xe611('0x11')]['Transcript'][_0xe611('0x15')],'json':!![]})[_0xe611('0xf')](function(_0x34c9b6){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x17'),_0x54ef69['id']));if(_0x34c9b6&&_0x34c9b6['results']&&_0x34c9b6[_0xe611('0x18')][_0xe611('0x19')]&&_0x34c9b6['results'][_0xe611('0x19')]['length']){_0x5d2ba9[_0xe611('0x12')]='';for(var _0x41ad75=0x0;_0x41ad75<_0x34c9b6[_0xe611('0x18')][_0xe611('0x19')]['length'];_0x41ad75++){_0x5d2ba9[_0xe611('0x12')]+=_0x34c9b6[_0xe611('0x18')][_0xe611('0x19')][_0x41ad75][_0xe611('0x1a')]+'';}}return _0x54ef69['update'](_0x5d2ba9);})[_0xe611('0xf')](function(){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x1b'),_0x54ef69['id']));if(!_0x54ef69[_0xe611('0x1c')]){throw new db['Sequelize']['ValidationError'](_0xe611('0x1d'));}if(!_0x50abe9[_0xe611('0x1e')]||!_0x50abe9[_0xe611('0x1f')]||!_0x50abe9[_0xe611('0x20')]||!_0x50abe9[_0xe611('0x21')]||!_0x50abe9[_0xe611('0x22')]){throw new db['Sequelize']['ValidationError'](_0xe611('0x23'));}if(!_0x5d2ba9[_0xe611('0x12')]){throw new Error(_0xe611('0x24'));}if(_0x50abe9['sentimentAccountId']===_0x2819d4['id']){return _0x2819d4;}else{return db['CloudProvider'][_0xe611('0x25')]({'where':{'id':_settings[_0xe611('0x1f')]}});}})[_0xe611('0xf')](function(_0x25c42e){if(!_0x25c42e){throw new db[(_0xe611('0x26'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x25c42e['data1']||!_0x25c42e['data2']){throw new db[(_0xe611('0x26'))][(_0xe611('0x27'))](_0xe611('0x28'));}_0x2b33dd=_0x25c42e;logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x29'),_0x54ef69['id']));return sentiment(_0x2b33dd[_0xe611('0x2a')],_0x2b33dd[_0xe611('0x2b')],_0x50abe9['sentimentRegion'],_0x5d2ba9[_0xe611('0x12')],_0x50abe9['language']);})[_0xe611('0xf')](function(_0x519c22){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x2c'),_0x54ef69['id']));return _0x54ef69['update']({'sentiment':_0x519c22[_0xe611('0x2d')],'sPositive':_0x519c22['SentimentScore']['Positive'],'sNegative':_0x519c22[_0xe611('0x2e')]['Negative'],'sMixed':_0x519c22[_0xe611('0x2e')][_0xe611('0x2f')],'sNeutral':_0x519c22[_0xe611('0x2e')][_0xe611('0x30')]});})[_0xe611('0xf')](function(){logger['info'](util['format'](_0xe611('0x1b'),_0x54ef69['id']));_0x45a58f();});case'FAILED':return _0x54ef69[_0xe611('0x31')]({'transcribeStatus':_0xe611('0x32'),'failureReason':_0x4960dc[_0xe611('0x11')][_0xe611('0x33')]})[_0xe611('0xf')](function(){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x1b'),_0x54ef69['id']));_0x45a58f();});default:logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x34'),_0x54ef69['id']));break;}}else{return BPromise[_0xe611('0x35')]()[_0xe611('0xf')](function(){if(!_0x54ef69[_0xe611('0x1c')]){throw new db[(_0xe611('0x26'))][(_0xe611('0x27'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x50abe9['sentiment']||!_0x50abe9['sentimentAccountId']||!_0x50abe9['sentimentRegion']||!_0x50abe9['language']||!_0x50abe9[_0xe611('0x22')]){throw new db[(_0xe611('0x26'))]['ValidationError'](_0xe611('0x23'));}if(!_0x54ef69['fileText']){throw new Error(_0xe611('0x24'));}if(_0x50abe9['sentimentAccountId']===_0x2819d4['id']){return _0x2819d4;}else{return db[_0xe611('0x36')]['findOne']({'where':{'id':_settings[_0xe611('0x1f')]}});}})[_0xe611('0xf')](function(_0x514575){if(!_0x514575){throw new db[(_0xe611('0x26'))][(_0xe611('0x27'))](_0xe611('0x37'));}if(!_0x514575[_0xe611('0x2a')]||!_0x514575[_0xe611('0x2b')]){throw new db[(_0xe611('0x26'))][(_0xe611('0x27'))](_0xe611('0x28'));}_0x2b33dd=_0x514575;logger[_0xe611('0xb')](util['format'](_0xe611('0x29'),_0x54ef69['id']));return sentiment(_0x2b33dd[_0xe611('0x2a')],_0x2b33dd['data2'],_0x50abe9[_0xe611('0x20')],_0x54ef69[_0xe611('0x12')],_0x50abe9[_0xe611('0x21')]);})[_0xe611('0xf')](function(_0x5b8652){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x2c'),_0x54ef69['id']));return _0x54ef69[_0xe611('0x31')]({'sentiment':_0x5b8652[_0xe611('0x2d')],'sPositive':_0x5b8652['SentimentScore'][_0xe611('0x38')],'sNegative':_0x5b8652['SentimentScore'][_0xe611('0x39')],'sMixed':_0x5b8652[_0xe611('0x2e')][_0xe611('0x2f')],'sNeutral':_0x5b8652[_0xe611('0x2e')][_0xe611('0x30')],'transcribeStatus':_0xe611('0x13')});})[_0xe611('0xf')](function(){logger[_0xe611('0xb')](util[_0xe611('0xc')](_0xe611('0x1b'),_0x54ef69['id']));_0x45a58f();});}})[_0xe611('0x3a')](function(_0x5549ea){if(_0x5549ea){if(!_0x5549ea[_0xe611('0x3b')]||_0x5549ea['name']!=='SequelizeValidationError'){logger['error'](util[_0xe611('0xc')](_0xe611('0x3c'),_0x54ef69['id']),util[_0xe611('0x3d')](_0x5549ea,{'showHidden':![],'depth':null}));}}_0x45a58f();});});}function checkTranscribe(){var _0xb1f16d;var _0x4acd4d;var _0x162d53;return db['VoiceRecording'][_0xe611('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xe611('0xf')](function(_0x4b4f89){if(!_0x4b4f89||!_0x4b4f89[_0xe611('0x3f')]){throw new db[(_0xe611('0x26'))][(_0xe611('0x27'))](_0xe611('0x40'));}_0xb1f16d=_0x4b4f89;return db[_0xe611('0x41')][_0xe611('0x25')]({'where':{'id':0x1}});})['then'](function(_0x5db063){if(!_0x5db063){throw new db['Sequelize'][(_0xe611('0x27'))](_0xe611('0x42'));}_0x4acd4d=_0x5db063;if(!_0x4acd4d[_0xe611('0x5')]||!_0x4acd4d[_0xe611('0x43')]||!_0x4acd4d[_0xe611('0x44')]||!_0x4acd4d['language']||!_0x4acd4d[_0xe611('0x22')]){throw new db['Sequelize'][(_0xe611('0x27'))](_0xe611('0x45'));}return db[_0xe611('0x36')][_0xe611('0x25')]({'where':{'id':_0x4acd4d[_0xe611('0x43')]}});})[_0xe611('0xf')](function(_0x59b1ff){if(!_0x59b1ff){throw new db[(_0xe611('0x26'))]['ValidationError'](_0xe611('0x37'));}if(!_0x59b1ff[_0xe611('0x2a')]||!_0x59b1ff[_0xe611('0x2b')]){throw new db[(_0xe611('0x26'))][(_0xe611('0x27'))](_0xe611('0x28'));}_0x162d53=_0x59b1ff;var _0x44242a=[];_0xb1f16d[_0xe611('0x46')](function(_0x32b1b1){_0x44242a[_0xe611('0x47')](checkTranscribeJob(_0x32b1b1,_0x4acd4d,_0x162d53));});return BPromise['all'](_0x44242a);})[_0xe611('0x3a')](function(_0x54f9de){if(_0x54f9de){if(!_0x54f9de[_0xe611('0x3b')]||_0x54f9de[_0xe611('0x3b')]!==_0xe611('0x48')){logger['error'](util[_0xe611('0x3d')](_0x54f9de,{'showHidden':![],'depth':null}));}}});}exports[_0xe611('0x49')]=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 f723e75..5ab4fa2 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a08=['push','now','Biondo','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com'];(function(_0x50e10f,_0x197f36){var _0x175521=function(_0x323d56){while(--_0x323d56){_0x50e10f['push'](_0x50e10f['shift']());}};_0x175521(++_0x197f36);}(_0x6a08,0x113));var _0x86a0=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x6a08[_0x1fb1c1];return _0x1622df;};'use strict';var util=require(_0x86a0('0x0'));var db=require(_0x86a0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x86a0('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x86a0('0x3')+i+_0x86a0('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x86a0('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x86a0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x86a0('0x6')](),'updatedAt':Date[_0x86a0('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x86a0('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x86a0('0x7')+i,'phone':0xf879fb460+i,'email':_0x86a0('0x3')+i+_0x86a0('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x86a0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x86a0('0x6')](),'updatedAt':Date[_0x86a0('0x6')]()});}db[_0x86a0('0x8')][_0x86a0('0x9')]({'where':{}})[_0x86a0('0xa')](function(){return db[_0x86a0('0x8')][_0x86a0('0xb')](contacts);})['then'](function(){console['log']('finished\x20populating',_0x86a0('0xc'));return db[_0x86a0('0xd')][_0x86a0('0x9')]({'where':{}});})['then'](function(){return db[_0x86a0('0xd')][_0x86a0('0xb')](hopper);})[_0x86a0('0xa')](function(){console[_0x86a0('0xe')](_0x86a0('0xf'),_0x86a0('0x10'));return db[_0x86a0('0x8')][_0x86a0('0xb')](contacts2);})[_0x86a0('0xa')](function(){console[_0x86a0('0xe')]('finished\x20populating',_0x86a0('0x11'));return db[_0x86a0('0xd')][_0x86a0('0xb')](hopper2);})[_0x86a0('0xa')](function(){console['log'](_0x86a0('0xf'),_0x86a0('0x12'));})[_0x86a0('0x13')](function(_0x201c36){console['log'](_0x201c36);}); \ No newline at end of file +var _0x66a4=['then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy'];(function(_0x129102,_0x3ac9c9){var _0x346551=function(_0x4040e5){while(--_0x4040e5){_0x129102['push'](_0x129102['shift']());}};_0x346551(++_0x3ac9c9);}(_0x66a4,0x1be));var _0x466a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x66a4[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x466a('0x0'));var db=require(_0x466a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x466a('0x2')]({'id':i,'firstName':_0x466a('0x3')+i,'lastName':_0x466a('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x466a('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x466a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x466a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x466a('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x466a('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x466a('0x7')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x466a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x466a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x466a('0x6')](),'updatedAt':Date[_0x466a('0x6')]()});}db[_0x466a('0x8')][_0x466a('0x9')]({'where':{}})[_0x466a('0xa')](function(){return db[_0x466a('0x8')][_0x466a('0xb')](contacts);})[_0x466a('0xa')](function(){console['log'](_0x466a('0xc'),_0x466a('0xd'));return db[_0x466a('0xe')][_0x466a('0x9')]({'where':{}});})[_0x466a('0xa')](function(){return db['CmHopper'][_0x466a('0xb')](hopper);})[_0x466a('0xa')](function(){console[_0x466a('0xf')](_0x466a('0xc'),_0x466a('0x10'));return db[_0x466a('0x8')]['bulkCreate'](contacts2);})[_0x466a('0xa')](function(){console['log'](_0x466a('0xc'),_0x466a('0x11'));return db['CmHopper'][_0x466a('0xb')](hopper2);})[_0x466a('0xa')](function(){console[_0x466a('0xf')](_0x466a('0xc'),_0x466a('0x12'));})['catch'](function(_0x1d753a){console[_0x466a('0xf')](_0x1d753a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ac0d5de..6b48132 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc969=['%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch','log','util','../mysqldb','push','format','%s%s','agent'];(function(_0x3673a8,_0x511bb0){var _0x3c2d28=function(_0x398684){while(--_0x398684){_0x3673a8['push'](_0x3673a8['shift']());}};_0x3c2d28(++_0x511bb0);}(_0xc969,0xb7));var _0x9c96=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xc969[_0x550d12];return _0x12103d;};'use strict';var util=require(_0x9c96('0x0'));var db=require(_0x9c96('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9c96('0x2')]({'name':util[_0x9c96('0x3')](_0x9c96('0x4'),_0x9c96('0x5'),i),'fullname':util[_0x9c96('0x3')](_0x9c96('0x4'),'agent',i),'email':util[_0x9c96('0x3')](_0x9c96('0x6'),_0x9c96('0x5'),i),'role':_0x9c96('0x5'),'password':_0x9c96('0x7'),'internal':0xfa0+i,'type':_0x9c96('0x8'),'transport':[_0x9c96('0x9'),'ws',_0x9c96('0xa')],'disallow':[_0x9c96('0xb')],'allow':['ulaw'],'defaultuser':util[_0x9c96('0x3')](_0x9c96('0x4'),_0x9c96('0x5'),i),'encryption':_0x9c96('0xc'),'avpf':_0x9c96('0xc'),'force_avp':_0x9c96('0xc'),'icesupport':_0x9c96('0xc'),'dtlsenable':_0x9c96('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x9c96('0xd'),'dtlssetup':_0x9c96('0xe'),'callerid':util[_0x9c96('0x3')](_0x9c96('0xf'),util[_0x9c96('0x3')](_0x9c96('0x4'),_0x9c96('0x5'),i),0xfa0+i)});}db[_0x9c96('0x10')][_0x9c96('0x11')](users)[_0x9c96('0x12')](function(){console['log']('add\x20user');})[_0x9c96('0x13')](function(_0x2697a4){console[_0x9c96('0x14')](_0x2697a4);}); \ No newline at end of file +var _0xb7be=['ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x22f35f,_0x108401){var _0x3938c0=function(_0x41cbc6){while(--_0x41cbc6){_0x22f35f['push'](_0x22f35f['shift']());}};_0x3938c0(++_0x108401);}(_0xb7be,0x9d));var _0xeb7b=function(_0x28202e,_0x5d0604){_0x28202e=_0x28202e-0x0;var _0x126f8b=_0xb7be[_0x28202e];return _0x126f8b;};'use strict';var util=require(_0xeb7b('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xeb7b('0x1')]({'name':util[_0xeb7b('0x2')](_0xeb7b('0x3'),_0xeb7b('0x4'),i),'fullname':util['format']('%s%s','agent',i),'email':util['format'](_0xeb7b('0x5'),_0xeb7b('0x4'),i),'role':'agent','password':_0xeb7b('0x6'),'internal':0xfa0+i,'type':_0xeb7b('0x7'),'transport':[_0xeb7b('0x8'),'ws',_0xeb7b('0x9')],'disallow':[_0xeb7b('0xa')],'allow':[_0xeb7b('0xb')],'defaultuser':util[_0xeb7b('0x2')](_0xeb7b('0x3'),'agent',i),'encryption':_0xeb7b('0xc'),'avpf':_0xeb7b('0xc'),'force_avp':_0xeb7b('0xc'),'icesupport':_0xeb7b('0xc'),'dtlsenable':_0xeb7b('0xc'),'dtlsverify':'no','dtlscertfile':_0xeb7b('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xeb7b('0x2')](_0xeb7b('0xe'),util[_0xeb7b('0x2')](_0xeb7b('0x3'),_0xeb7b('0x4'),i),0xfa0+i)});}db[_0xeb7b('0xf')][_0xeb7b('0x10')](users)[_0xeb7b('0x11')](function(){console[_0xeb7b('0x12')](_0xeb7b('0x13'));})[_0xeb7b('0x14')](function(_0xcadd85){console['log'](_0xcadd85);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b98435b..1621d19 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8510=['removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','Agents','name','agent','telephone','type','UserProfileSection','findOne','VoiceQueues','ChatQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','Campaign','where','format','%s:queue:%s','length','query','User','find','role','handshake','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','voice:inbound','userProfileId','FaxQueues','FaxQueue','SmsQueues','OpenchannelQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','removeFaxInteractions'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x8510,0xe0));var _0x0851=function(_0x139790,_0x466283){_0x139790=_0x139790-0x0;var _0x23d99d=_0x8510[_0x139790];return _0x23d99d;};'use strict';var _=require(_0x0851('0x0'));var util=require(_0x0851('0x1'));var BPromise=require('bluebird');var db=require(_0x0851('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x0851('0x3'),'model':db['User'],'attributes':['id',_0x0851('0x4'),'role'],'raw':!![],'where':{'role':_0x0851('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0851('0x4')],'where':{'role':_0x0851('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0851('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x0851('0x4')],'where':{'role':_0x0851('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x0851('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2e94b4,_0x45f59e,_0x129ef2){return db[_0x0851('0x8')][_0x0851('0x9')]({'where':{'name':_0x2e94b4,'userProfileId':_0x45f59e},'raw':!![]})['then'](function(_0x4c9fe1){if(_0x4c9fe1){if(_0x4c9fe1['autoAssociation']){switch(_0x2e94b4){case _0x0851('0xa'):case _0x0851('0xb'):case'FaxQueues':case'SmsQueues':case _0x0851('0xc'):case'OpenchannelQueues':case _0x0851('0xd'):return db[_0x129ef2]['findAll'](queryQueues);case _0x0851('0xe'):return db[_0x129ef2][_0x0851('0xf')](queryTelephones);case _0x0851('0x10'):return db[_0x129ef2][_0x0851('0xf')](queryTrunks);case _0x0851('0x11'):return db[_0x129ef2]['findAll'](queryCampaigns);}}else{return db[_0x0851('0x12')][_0x0851('0xf')]({'attributes':[_0x0851('0x13')],'where':{'sectionId':_0x4c9fe1['id']},'raw':!![]})[_0x0851('0x14')](function(_0x40c87e){if(_0x40c87e){var _0x351dee={'where':{'id':_['map'](_0x40c87e,_0x0851('0x13'))},'raw':!![]};switch(_0x129ef2){case'User':_0x351dee['where']['role']=_0x0851('0x6');break;case _0x0851('0x15'):_0x351dee[_0x0851('0x16')][_0x0851('0x7')]='ivr';break;}return db[_0x129ef2][_0x0851('0xf')](_0x351dee);}else{return[];}});}}else{return[];}})[_0x0851('0x14')](function(_0x15fb6c){return _0x15fb6c;});}function joinOrLeaveQueues(_0x169625,_0x446947,_0x56f6dd,_0xa70b12){_0x169625[_0x446947](util[_0x0851('0x17')](_0x0851('0x18'),_0x56f6dd,_0xa70b12[_0x0851('0x4')]));if(_0xa70b12[_0x0851('0x3')]){for(var _0xe56eca=0x0;_0xe56eca<_0xa70b12['Agents'][_0x0851('0x19')];_0xe56eca+=0x1){_0x169625[_0x446947](util['format']('user:%s',_0xa70b12[_0x0851('0x3')][_0xe56eca][_0x0851('0x4')]));}}}function joinOrLeave(_0x409788,_0x701000,_0x15ebec){var _0x5cf0af;if(_0x409788['handshake'][_0x0851('0x1a')]['id']){db[_0x0851('0x1b')][_0x0851('0x1c')]({'attributes':['id',_0x0851('0x4'),_0x0851('0x1d'),'userProfileId'],'where':{'id':_0x409788[_0x0851('0x1e')][_0x0851('0x1a')]['id']},'include':[{'model':db[_0x0851('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x0851('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0851('0x21')],'as':_0x0851('0x22'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x0851('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x0851('0x24')],'as':_0x0851('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x0851('0x26')],'as':_0x0851('0x27'),'attributes':['id'],'raw':!![]}]})[_0x0851('0x14')](function(_0x325ce5){if(_0x325ce5){_0x5cf0af=_0x325ce5;_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x28'),_0x325ce5[_0x0851('0x4')]));var _0x5e1100=[];switch(_0x325ce5[_0x0851('0x1d')]){case _0x0851('0x29'):_0x409788[_0x701000]('voice:inbound');_0x409788[_0x701000](_0x0851('0x2a'));if(queryQueues[_0x0851('0x2b')]('include')){delete queryQueues[_0x0851('0x2c')];}_0x5e1100['push'](db[_0x0851('0x2d')]['findAll'](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x2f')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db['FaxQueue'][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x30')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x31')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x32')]['findAll'](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x33')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x1b')]['findAll'](queryTelephones));_0x5e1100[_0x0851('0x2e')](db['Trunk'][_0x0851('0xf')](queryTrunks));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x15')][_0x0851('0xf')](queryCampaigns));_0x5e1100[_0x0851('0x2e')](db['User'][_0x0851('0xf')](queryAgents));break;case'user':_0x409788[_0x701000](_0x0851('0x34'));_0x409788[_0x701000]('voice:outbound');_0x5e1100[_0x0851('0x2e')](getAssociatedResources('VoiceQueues',_0x325ce5[_0x0851('0x35')],_0x0851('0x2d')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0xb'),_0x325ce5[_0x0851('0x35')],_0x0851('0x2f')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x36'),_0x325ce5[_0x0851('0x35')],_0x0851('0x37')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x38'),_0x325ce5['userProfileId'],_0x0851('0x30')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0xc'),_0x325ce5[_0x0851('0x35')],_0x0851('0x31')));_0x5e1100['push'](getAssociatedResources(_0x0851('0x39'),_0x325ce5[_0x0851('0x35')],'OpenchannelQueue'));_0x5e1100['push'](getAssociatedResources(_0x0851('0xd'),_0x325ce5[_0x0851('0x35')],_0x0851('0x33')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0xe'),_0x325ce5[_0x0851('0x35')],'User'));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x10'),_0x325ce5[_0x0851('0x35')],_0x0851('0x3a')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x11'),_0x325ce5[_0x0851('0x35')],'Campaign'));_0x5e1100['push'](db[_0x0851('0x1b')][_0x0851('0xf')](queryAgents));break;case'agent':_0x409788[_0x701000](_0x0851('0x34'));_0x409788[_0x701000]('voice:outbound');_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3b')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3c')]({'attributes':['id','name']}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3d')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3e')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3f')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100['push'](_0x325ce5[_0x0851('0x40')]({'attributes':['id','name']}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x41')]({'attributes':['id',_0x0851('0x4')]}));break;}return BPromise[_0x0851('0x42')](_0x5e1100);}})[_0x0851('0x14')](function(_0x1b0914){if(_0x1b0914&&_0x1b0914['length']){for(var _0x5b21ab=0x0;_0x5b21ab<_0x1b0914[_0x0851('0x19')];_0x5b21ab+=0x1){for(var _0x18b433=0x0;_0x18b433<_0x1b0914[_0x5b21ab][_0x0851('0x19')];_0x18b433+=0x1){switch(_0x5b21ab){case 0x0:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x43'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x1:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x44'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x2:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x45'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x3:joinOrLeaveQueues(_0x409788,_0x701000,'sms',_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x4:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x46'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x5:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x47'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x6:joinOrLeaveQueues(_0x409788,_0x701000,'whatsapp',_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x7:_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x48'),_0x1b0914[_0x5b21ab][_0x18b433]['name']));break;case 0x8:_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x49'),_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x4')]));break;case 0x9:_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x4a'),_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x7')],_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x4')]));break;case 0xa:_0x409788[_0x701000](util[_0x0851('0x17')]('user:%s',_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x4')]));break;}}}}})[_0x0851('0x14')](function(){if(_0x701000===_0x0851('0x4b')){var _0x477909=_[_0x0851('0x4c')](_0x5cf0af['ChatInteractions'],'id');return _0x5cf0af[_0x0851('0x4d')](_0x477909)[_0x0851('0x14')](function(){for(var _0x2e4600=0x0;_0x2e4600<_0x477909[_0x0851('0x19')];_0x2e4600+=0x1){_0x15ebec['emit'](_0x0851('0x4e'),{'ChatInteractionId':Number(_0x477909[_0x2e4600]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000==='leave'){var _0x20a33f=_[_0x0851('0x4c')](_0x5cf0af['MailInteractions'],'id');return _0x5cf0af['removeMailInteractions'](_0x20a33f)[_0x0851('0x14')](function(){for(var _0xb8f8f6=0x0;_0xb8f8f6<_0x20a33f[_0x0851('0x19')];_0xb8f8f6+=0x1){_0x15ebec[_0x0851('0x4f')](_0x0851('0x50'),{'MailInteractionId':Number(_0x20a33f[_0xb8f8f6]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000==='leave'){var _0x1b33b3=_[_0x0851('0x4c')](_0x5cf0af[_0x0851('0x22')],'id');return _0x5cf0af[_0x0851('0x51')](_0x1b33b3)[_0x0851('0x14')](function(){for(var _0x42c01c=0x0;_0x42c01c<_0x1b33b3['length'];_0x42c01c+=0x1){_0x15ebec[_0x0851('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1b33b3[_0x42c01c]),'UserId':Number(_0x5cf0af['id'])});}});}})['then'](function(){if(_0x701000===_0x0851('0x4b')){var _0x3e925b=_['map'](_0x5cf0af[_0x0851('0x23')],'id');return _0x5cf0af[_0x0851('0x52')](_0x3e925b)[_0x0851('0x14')](function(){for(var _0x33ac68=0x0;_0x33ac68<_0x3e925b[_0x0851('0x19')];_0x33ac68+=0x1){_0x15ebec[_0x0851('0x4f')](_0x0851('0x53'),{'SmsInteractionId':Number(_0x3e925b[_0x33ac68]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000==='leave'){var _0x2379ea=_['map'](_0x5cf0af['OpenchannelInteractions'],'id');return _0x5cf0af[_0x0851('0x54')](_0x2379ea)[_0x0851('0x14')](function(){for(var _0x3b1cfb=0x0;_0x3b1cfb<_0x2379ea[_0x0851('0x19')];_0x3b1cfb+=0x1){_0x15ebec['emit'](_0x0851('0x55'),{'OpenchannelInteractionId':Number(_0x2379ea[_0x3b1cfb]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000===_0x0851('0x4b')){var _0x410896=_[_0x0851('0x4c')](_0x5cf0af[_0x0851('0x27')],'id');return _0x5cf0af[_0x0851('0x56')](_0x410896)[_0x0851('0x14')](function(){for(var _0x94f7e3=0x0;_0x94f7e3<_0x410896['length'];_0x94f7e3+=0x1){_0x15ebec['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x410896[_0x94f7e3]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x57')](function(_0x20bc6f){_0x409788['log'](_0x20bc6f);});}}function onDisconnect(_0x20e72e,_0x583e18){joinOrLeave(_0x20e72e,_0x0851('0x4b'),_0x583e18);}function onConnect(_0x26e983){joinOrLeave(_0x26e983,_0x0851('0x58'));}exports['default']=function(_0x5d9985){_0x5d9985['on']('connection',function(_0x9b2279){_0x9b2279[_0x0851('0x59')](0x0);_0x9b2279[_0x0851('0x5a')]=_0x9b2279['request'][_0x0851('0x5b')][_0x0851('0x5c')]+':'+_0x9b2279[_0x0851('0x5d')][_0x0851('0x5b')][_0x0851('0x5e')];_0x9b2279[_0x0851('0x5f')]=new Date();_0x9b2279[_0x0851('0x60')]=function(_0x55988c){console[_0x0851('0x60')](_0x0851('0x61')+_0x9b2279[_0x0851('0x62')][_0x0851('0x4')]+'['+_0x9b2279['address']+']',_0x55988c);};_0x9b2279['on'](_0x0851('0x63'),function(){onDisconnect(_0x9b2279,_0x5d9985);_0x9b2279['log'](_0x0851('0x64'));});onConnect(_0x9b2279);_0x9b2279[_0x0851('0x60')](_0x0851('0x65'));});}; \ No newline at end of file +var _0xce49=['fax','sms','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remotePort','connectedAt','SocketIO\x20','disconnect','CONNECTED','util','name','telephone','agent','type','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','User','role','Campaign','ivr','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','VoiceQueues','OpenchannelQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length'];(function(_0x292bb9,_0x39c395){var _0x1d1c7d=function(_0x36f410){while(--_0x36f410){_0x292bb9['push'](_0x292bb9['shift']());}};_0x1d1c7d(++_0x39c395);}(_0xce49,0x132));var _0x9ce4=function(_0x4b7824,_0x2abee8){_0x4b7824=_0x4b7824-0x0;var _0x35351b=_0xce49[_0x4b7824];return _0x35351b;};'use strict';var _=require('lodash');var util=require(_0x9ce4('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x9ce4('0x1'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9ce4('0x1')],'where':{'role':_0x9ce4('0x2')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9ce4('0x1')]};var queryAgents={'raw':!![],'attributes':['id',_0x9ce4('0x1')],'where':{'role':_0x9ce4('0x3')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9ce4('0x1'),_0x9ce4('0x4')],'where':{'type':'ivr'}};function getAssociatedResources(_0x39ac65,_0x2f241e,_0x18e7d6){return db[_0x9ce4('0x5')][_0x9ce4('0x6')]({'where':{'name':_0x39ac65,'userProfileId':_0x2f241e},'raw':!![]})[_0x9ce4('0x7')](function(_0x421e1c){if(_0x421e1c){if(_0x421e1c[_0x9ce4('0x8')]){switch(_0x39ac65){case'VoiceQueues':case _0x9ce4('0x9'):case _0x9ce4('0xa'):case'SmsQueues':case _0x9ce4('0xb'):case _0x9ce4('0xc'):case _0x9ce4('0xd'):return db[_0x18e7d6][_0x9ce4('0xe')](queryQueues);case'Telephones':return db[_0x18e7d6][_0x9ce4('0xe')](queryTelephones);case _0x9ce4('0xf'):return db[_0x18e7d6][_0x9ce4('0xe')](queryTrunks);case _0x9ce4('0x10'):return db[_0x18e7d6][_0x9ce4('0xe')](queryCampaigns);}}else{return db[_0x9ce4('0x11')][_0x9ce4('0xe')]({'attributes':['resourceId'],'where':{'sectionId':_0x421e1c['id']},'raw':!![]})[_0x9ce4('0x7')](function(_0x3e66e6){if(_0x3e66e6){var _0x1a19a3={'where':{'id':_[_0x9ce4('0x12')](_0x3e66e6,_0x9ce4('0x13'))},'raw':!![]};switch(_0x18e7d6){case _0x9ce4('0x14'):_0x1a19a3['where'][_0x9ce4('0x15')]=_0x9ce4('0x2');break;case _0x9ce4('0x16'):_0x1a19a3['where']['type']=_0x9ce4('0x17');break;}return db[_0x18e7d6][_0x9ce4('0xe')](_0x1a19a3);}else{return[];}});}}else{return[];}})[_0x9ce4('0x7')](function(_0x460150){return _0x460150;});}function joinOrLeaveQueues(_0x2f344a,_0x3529ea,_0x32cde1,_0x44aad1){_0x2f344a[_0x3529ea](util[_0x9ce4('0x18')](_0x9ce4('0x19'),_0x32cde1,_0x44aad1[_0x9ce4('0x1')]));if(_0x44aad1[_0x9ce4('0x1a')]){for(var _0x59c9a5=0x0;_0x59c9a5<_0x44aad1[_0x9ce4('0x1a')]['length'];_0x59c9a5+=0x1){_0x2f344a[_0x3529ea](util[_0x9ce4('0x18')](_0x9ce4('0x1b'),_0x44aad1[_0x9ce4('0x1a')][_0x59c9a5][_0x9ce4('0x1')]));}}}function joinOrLeave(_0x598e43,_0x1ae1c9,_0x4ead4f){var _0x2384c2;if(_0x598e43[_0x9ce4('0x1c')][_0x9ce4('0x1d')]['id']){db[_0x9ce4('0x14')][_0x9ce4('0x1e')]({'attributes':['id','name',_0x9ce4('0x15'),_0x9ce4('0x1f')],'where':{'id':_0x598e43[_0x9ce4('0x1c')]['query']['id']},'include':[{'model':db[_0x9ce4('0x20')],'as':_0x9ce4('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x9ce4('0x22')],'as':_0x9ce4('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x9ce4('0x24')],'as':_0x9ce4('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x9ce4('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x9ce4('0x27')],'as':_0x9ce4('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x9ce4('0x29'),'attributes':['id'],'raw':!![]}]})[_0x9ce4('0x7')](function(_0x59171d){if(_0x59171d){_0x2384c2=_0x59171d;_0x598e43[_0x1ae1c9](util[_0x9ce4('0x18')](_0x9ce4('0x1b'),_0x59171d[_0x9ce4('0x1')]));var _0x1f4911=[];switch(_0x59171d[_0x9ce4('0x15')]){case'admin':_0x598e43[_0x1ae1c9](_0x9ce4('0x2a'));_0x598e43[_0x1ae1c9](_0x9ce4('0x2b'));if(queryQueues[_0x9ce4('0x2c')](_0x9ce4('0x2d'))){delete queryQueues[_0x9ce4('0x2d')];}_0x1f4911['push'](db['VoiceQueue'][_0x9ce4('0xe')](queryQueues));_0x1f4911[_0x9ce4('0x2e')](db[_0x9ce4('0x2f')][_0x9ce4('0xe')](queryQueues));_0x1f4911['push'](db[_0x9ce4('0x30')][_0x9ce4('0xe')](queryQueues));_0x1f4911[_0x9ce4('0x2e')](db[_0x9ce4('0x31')][_0x9ce4('0xe')](queryQueues));_0x1f4911['push'](db[_0x9ce4('0x32')][_0x9ce4('0xe')](queryQueues));_0x1f4911['push'](db['OpenchannelQueue'][_0x9ce4('0xe')](queryQueues));_0x1f4911[_0x9ce4('0x2e')](db[_0x9ce4('0x33')]['findAll'](queryQueues));_0x1f4911[_0x9ce4('0x2e')](db[_0x9ce4('0x14')][_0x9ce4('0xe')](queryTelephones));_0x1f4911[_0x9ce4('0x2e')](db[_0x9ce4('0x34')][_0x9ce4('0xe')](queryTrunks));_0x1f4911['push'](db['Campaign'][_0x9ce4('0xe')](queryCampaigns));_0x1f4911['push'](db['User'][_0x9ce4('0xe')](queryAgents));break;case _0x9ce4('0x35'):_0x598e43[_0x1ae1c9]('voice:inbound');_0x598e43[_0x1ae1c9](_0x9ce4('0x2b'));_0x1f4911['push'](getAssociatedResources(_0x9ce4('0x36'),_0x59171d[_0x9ce4('0x1f')],'VoiceQueue'));_0x1f4911[_0x9ce4('0x2e')](getAssociatedResources(_0x9ce4('0x9'),_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x2f')));_0x1f4911[_0x9ce4('0x2e')](getAssociatedResources(_0x9ce4('0xa'),_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x30')));_0x1f4911['push'](getAssociatedResources('SmsQueues',_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x31')));_0x1f4911[_0x9ce4('0x2e')](getAssociatedResources(_0x9ce4('0xb'),_0x59171d[_0x9ce4('0x1f')],'MailQueue'));_0x1f4911['push'](getAssociatedResources('OpenchannelQueues',_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x37')));_0x1f4911[_0x9ce4('0x2e')](getAssociatedResources(_0x9ce4('0xd'),_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x33')));_0x1f4911[_0x9ce4('0x2e')](getAssociatedResources(_0x9ce4('0x38'),_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x14')));_0x1f4911[_0x9ce4('0x2e')](getAssociatedResources(_0x9ce4('0xf'),_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x34')));_0x1f4911['push'](getAssociatedResources(_0x9ce4('0x10'),_0x59171d[_0x9ce4('0x1f')],_0x9ce4('0x16')));_0x1f4911[_0x9ce4('0x2e')](db[_0x9ce4('0x14')][_0x9ce4('0xe')](queryAgents));break;case _0x9ce4('0x3'):_0x598e43[_0x1ae1c9]('voice:inbound');_0x598e43[_0x1ae1c9]('voice:outbound');_0x1f4911[_0x9ce4('0x2e')](_0x59171d[_0x9ce4('0x39')]({'attributes':['id',_0x9ce4('0x1')]}));_0x1f4911[_0x9ce4('0x2e')](_0x59171d[_0x9ce4('0x3a')]({'attributes':['id','name']}));_0x1f4911[_0x9ce4('0x2e')](_0x59171d[_0x9ce4('0x3b')]({'attributes':['id',_0x9ce4('0x1')]}));_0x1f4911[_0x9ce4('0x2e')](_0x59171d[_0x9ce4('0x3c')]({'attributes':['id',_0x9ce4('0x1')]}));_0x1f4911['push'](_0x59171d[_0x9ce4('0x3d')]({'attributes':['id',_0x9ce4('0x1')]}));_0x1f4911['push'](_0x59171d[_0x9ce4('0x3e')]({'attributes':['id','name']}));_0x1f4911[_0x9ce4('0x2e')](_0x59171d[_0x9ce4('0x3f')]({'attributes':['id',_0x9ce4('0x1')]}));break;}return BPromise[_0x9ce4('0x40')](_0x1f4911);}})[_0x9ce4('0x7')](function(_0x3789e2){if(_0x3789e2&&_0x3789e2[_0x9ce4('0x41')]){for(var _0x1db9fa=0x0;_0x1db9fa<_0x3789e2[_0x9ce4('0x41')];_0x1db9fa+=0x1){for(var _0x2f3b42=0x0;_0x2f3b42<_0x3789e2[_0x1db9fa][_0x9ce4('0x41')];_0x2f3b42+=0x1){switch(_0x1db9fa){case 0x0:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,'voice',_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x1:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,'chat',_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x2:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,_0x9ce4('0x42'),_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x3:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,_0x9ce4('0x43'),_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x4:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,'mail',_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x5:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,_0x9ce4('0x44'),_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x6:joinOrLeaveQueues(_0x598e43,_0x1ae1c9,'whatsapp',_0x3789e2[_0x1db9fa][_0x2f3b42]);break;case 0x7:_0x598e43[_0x1ae1c9](util[_0x9ce4('0x18')](_0x9ce4('0x45'),_0x3789e2[_0x1db9fa][_0x2f3b42][_0x9ce4('0x1')]));break;case 0x8:_0x598e43[_0x1ae1c9](util[_0x9ce4('0x18')](_0x9ce4('0x46'),_0x3789e2[_0x1db9fa][_0x2f3b42][_0x9ce4('0x1')]));break;case 0x9:_0x598e43[_0x1ae1c9](util[_0x9ce4('0x18')](_0x9ce4('0x47'),_0x3789e2[_0x1db9fa][_0x2f3b42][_0x9ce4('0x4')],_0x3789e2[_0x1db9fa][_0x2f3b42]['name']));break;case 0xa:_0x598e43[_0x1ae1c9](util[_0x9ce4('0x18')](_0x9ce4('0x1b'),_0x3789e2[_0x1db9fa][_0x2f3b42][_0x9ce4('0x1')]));break;}}}}})[_0x9ce4('0x7')](function(){if(_0x1ae1c9===_0x9ce4('0x48')){var _0x359d10=_[_0x9ce4('0x12')](_0x2384c2['ChatInteractions'],'id');return _0x2384c2['removeChatInteractions'](_0x359d10)[_0x9ce4('0x7')](function(){for(var _0x10ec8c=0x0;_0x10ec8c<_0x359d10[_0x9ce4('0x41')];_0x10ec8c+=0x1){_0x4ead4f[_0x9ce4('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x359d10[_0x10ec8c]),'UserId':Number(_0x2384c2['id'])});}});}})[_0x9ce4('0x7')](function(){if(_0x1ae1c9===_0x9ce4('0x48')){var _0x56a3d0=_['map'](_0x2384c2[_0x9ce4('0x23')],'id');return _0x2384c2[_0x9ce4('0x4a')](_0x56a3d0)[_0x9ce4('0x7')](function(){for(var _0xd29d69=0x0;_0xd29d69<_0x56a3d0[_0x9ce4('0x41')];_0xd29d69+=0x1){_0x4ead4f[_0x9ce4('0x49')](_0x9ce4('0x4b'),{'MailInteractionId':Number(_0x56a3d0[_0xd29d69]),'UserId':Number(_0x2384c2['id'])});}});}})[_0x9ce4('0x7')](function(){if(_0x1ae1c9===_0x9ce4('0x48')){var _0xb76993=_[_0x9ce4('0x12')](_0x2384c2[_0x9ce4('0x25')],'id');return _0x2384c2[_0x9ce4('0x4c')](_0xb76993)[_0x9ce4('0x7')](function(){for(var _0x142397=0x0;_0x142397<_0xb76993[_0x9ce4('0x41')];_0x142397+=0x1){_0x4ead4f[_0x9ce4('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xb76993[_0x142397]),'UserId':Number(_0x2384c2['id'])});}});}})['then'](function(){if(_0x1ae1c9==='leave'){var _0x39a5d7=_[_0x9ce4('0x12')](_0x2384c2[_0x9ce4('0x26')],'id');return _0x2384c2['removeSmsInteractions'](_0x39a5d7)[_0x9ce4('0x7')](function(){for(var _0x55f36d=0x0;_0x55f36d<_0x39a5d7['length'];_0x55f36d+=0x1){_0x4ead4f[_0x9ce4('0x49')](_0x9ce4('0x4d'),{'SmsInteractionId':Number(_0x39a5d7[_0x55f36d]),'UserId':Number(_0x2384c2['id'])});}});}})[_0x9ce4('0x7')](function(){if(_0x1ae1c9===_0x9ce4('0x48')){var _0x387dd1=_[_0x9ce4('0x12')](_0x2384c2[_0x9ce4('0x28')],'id');return _0x2384c2['removeOpenchannelInteractions'](_0x387dd1)[_0x9ce4('0x7')](function(){for(var _0x55ce64=0x0;_0x55ce64<_0x387dd1[_0x9ce4('0x41')];_0x55ce64+=0x1){_0x4ead4f['emit'](_0x9ce4('0x4e'),{'OpenchannelInteractionId':Number(_0x387dd1[_0x55ce64]),'UserId':Number(_0x2384c2['id'])});}});}})[_0x9ce4('0x7')](function(){if(_0x1ae1c9===_0x9ce4('0x48')){var _0x2a2c14=_[_0x9ce4('0x12')](_0x2384c2[_0x9ce4('0x29')],'id');return _0x2384c2[_0x9ce4('0x4f')](_0x2a2c14)['then'](function(){for(var _0xa96bcf=0x0;_0xa96bcf<_0x2a2c14[_0x9ce4('0x41')];_0xa96bcf+=0x1){_0x4ead4f[_0x9ce4('0x49')](_0x9ce4('0x50'),{'WhatsappInteractionId':Number(_0x2a2c14[_0xa96bcf]),'UserId':Number(_0x2384c2['id'])});}});}})[_0x9ce4('0x51')](function(_0x7b7ca6){_0x598e43[_0x9ce4('0x52')](_0x7b7ca6);});}}function onDisconnect(_0x1bc711,_0x2b9519){joinOrLeave(_0x1bc711,_0x9ce4('0x48'),_0x2b9519);}function onConnect(_0x32bd5f){joinOrLeave(_0x32bd5f,_0x9ce4('0x53'));}exports[_0x9ce4('0x54')]=function(_0x1d3f71){_0x1d3f71['on'](_0x9ce4('0x55'),function(_0x59c0c0){_0x59c0c0['setMaxListeners'](0x0);_0x59c0c0[_0x9ce4('0x56')]=_0x59c0c0['request'][_0x9ce4('0x55')]['remoteAddress']+':'+_0x59c0c0[_0x9ce4('0x57')][_0x9ce4('0x55')][_0x9ce4('0x58')];_0x59c0c0[_0x9ce4('0x59')]=new Date();_0x59c0c0[_0x9ce4('0x52')]=function(_0x1bd04a){console[_0x9ce4('0x52')](_0x9ce4('0x5a')+_0x59c0c0['nsp'][_0x9ce4('0x1')]+'['+_0x59c0c0[_0x9ce4('0x56')]+']',_0x1bd04a);};_0x59c0c0['on'](_0x9ce4('0x5b'),function(){onDisconnect(_0x59c0c0,_0x1d3f71);_0x59c0c0[_0x9ce4('0x52')]('DISCONNECTED');});onConnect(_0x59c0c0);_0x59c0c0[_0x9ce4('0x52')](_0x9ce4('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a83ac2b..66ad685 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 _0xae3a=['Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','catch','get','event','direction','UserId','find','name','interface','SIP/%s','outgoingmessage','channel','opened','closed','format','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','ChatMessage','newmessage'];(function(_0x2e1416,_0x2d1269){var _0x14d79a=function(_0x525d83){while(--_0x525d83){_0x2e1416['push'](_0x2e1416['shift']());}};_0x14d79a(++_0x2d1269);}(_0xae3a,0x137));var _0xaae3=function(_0x2ab350,_0x32859f){_0x2ab350=_0x2ab350-0x0;var _0x4acac=_0xae3a[_0x2ab350];return _0x4acac;};'use strict';var util=require(_0xaae3('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xaae3('0x1'));var logger=require(_0xaae3('0x2'))(_0xaae3('0x3'));var client=jayson[_0xaae3('0x4')][_0xaae3('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xaae3('0x6'),'event':_0xaae3('0x7'),'condition':_0xaae3('0x8'),'callback':afterCreate},{'channel':_0xaae3('0x9'),'model':_0xaae3('0x6'),'event':_0xaae3('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xaae3('0x9'),'model':_0xaae3('0xb'),'event':_0xaae3('0x7'),'condition':_0xaae3('0xc'),'callback':afterCreateMessage},{'channel':_0xaae3('0xd'),'model':_0xaae3('0xe'),'event':_0xaae3('0x7'),'condition':_0xaae3('0x8'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0xaae3('0xa'),'condition':_0xaae3('0xf'),'callback':afterUpdate},{'channel':'Sms','model':_0xaae3('0x10'),'event':'afterCreate','condition':_0xaae3('0xc'),'callback':afterCreateMessage},{'channel':_0xaae3('0x11'),'model':_0xaae3('0x12'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xaae3('0x11'),'model':_0xaae3('0x12'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xaae3('0x11'),'model':_0xaae3('0x13'),'event':_0xaae3('0x7'),'condition':_0xaae3('0xc'),'callback':afterCreateMessage},{'channel':_0xaae3('0x14'),'model':_0xaae3('0x15'),'event':'afterCreate','condition':_0xaae3('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0xaae3('0x15'),'event':_0xaae3('0xa'),'condition':_0xaae3('0xf'),'callback':afterUpdate},{'channel':_0xaae3('0x14'),'model':'FaxMessage','event':_0xaae3('0x7'),'condition':_0xaae3('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xaae3('0x16'),'event':_0xaae3('0x7'),'condition':_0xaae3('0x8'),'callback':afterCreate},{'channel':_0xaae3('0x17'),'model':'MailInteraction','event':_0xaae3('0xa'),'condition':_0xaae3('0xf'),'callback':afterUpdate},{'channel':_0xaae3('0x17'),'model':_0xaae3('0x18'),'event':_0xaae3('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xaae3('0x19'),'model':_0xaae3('0x1a'),'event':_0xaae3('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xaae3('0x19'),'model':_0xaae3('0x1a'),'event':_0xaae3('0xa'),'condition':_0xaae3('0xf'),'callback':afterUpdate},{'channel':_0xaae3('0x19'),'model':_0xaae3('0x1b'),'event':_0xaae3('0x7'),'condition':_0xaae3('0xc'),'callback':afterCreateMessage}];function request(_0x3290a7){return client['request'](_0xaae3('0x1c'),_0x3290a7)[_0xaae3('0x1d')](function(_0x273d72){logger[_0xaae3('0x1e')](_0xaae3('0x1f'),_0xaae3('0x1c'),_0x273d72);if(_0x273d72[_0xaae3('0x20')]){if(_0x273d72['error']['code']===0x1f4){logger['error'](_0xaae3('0x1f'),_0xaae3('0x1c'),_0x273d72['error']);}}})[_0xaae3('0x21')](function(_0x520ad0){logger[_0xaae3('0x20')]('Trigger,\x20%s',_0xaae3('0x1c'),_0x520ad0);});}function afterCreateMessage(_0x18f4dd,_0x48721a){return function(_0x17a4b7,_0x584c4e){_0x17a4b7=_0x17a4b7[_0xaae3('0x22')]({'plain':!![]});_0x17a4b7['channel']=_0x18f4dd;_0x17a4b7[_0xaae3('0x23')]=_0x17a4b7[_0xaae3('0x24')];if(_0x17a4b7[_0xaae3('0x25')]){return db['User'][_0xaae3('0x26')]({'where':{'id':_0x17a4b7[_0xaae3('0x25')]},'attributes':['id',_0xaae3('0x27')],'raw':!![]})['then'](function(_0x5e0657){_0x17a4b7[_0xaae3('0x28')]=util['format'](_0xaae3('0x29'),_0x5e0657[_0xaae3('0x27')]);_0x17a4b7['channel']=_0x18f4dd;return request({'event':'incomingmessage','message':_0x17a4b7});})[_0xaae3('0x21')](function(_0xb56a88){console['error'](_0xb56a88);});}else{return request({'event':_0xaae3('0x2a'),'message':_0x17a4b7});}};}function afterCreate(_0x133939,_0x2cd0f9){return function(_0x4f2cef,_0x4bcc8b){_0x4f2cef=_0x4f2cef[_0xaae3('0x22')]({'plain':!![]});_0x4f2cef[_0xaae3('0x2b')]=_0x133939;_0x4f2cef['event']=_0xaae3('0x2c');return request({'event':_0x2cd0f9,'message':_0x4f2cef});};}function afterUpdate(_0x21c499,_0x5cef5d){return function(_0x4fd61c,_0x5de4e0){if(_0x4fd61c['changed'](_0xaae3('0x2d'))&&_0x4fd61c[_0xaae3('0x2d')]){_0x4fd61c=_0x4fd61c[_0xaae3('0x22')]({'plain':!![]});_0x4fd61c['channel']=_0x21c499;_0x4fd61c[_0xaae3('0x23')]=_0xaae3('0x2d');if(_0x4fd61c['UserId']){return db['User'][_0xaae3('0x26')]({'where':{'id':_0x4fd61c[_0xaae3('0x25')]},'attributes':['id',_0xaae3('0x27')],'raw':!![]})[_0xaae3('0x1d')](function(_0x3f0864){_0x4fd61c[_0xaae3('0x28')]=util[_0xaae3('0x2e')]('SIP/%s',_0x3f0864[_0xaae3('0x27')]);return request({'event':_0x5cef5d,'message':_0x4fd61c});})['catch'](function(_0x4a11c8){console[_0xaae3('0x20')](_0x4a11c8);});}else{return request({'event':_0x5cef5d,'message':_0x4fd61c});}}};}exports[_0xaae3('0x2f')]=function(){for(var _0x42de53=0x0;_0x42de53=_0x3b112f[_0x0e03('0x13')]){throw Error(_0x0e03('0x14'));}_0x541d36(_0x47d732);})[_0x0e03('0x15')](function(_0x2430dc){_0xb89d8c(_0x2430dc);});});}; \ No newline at end of file +var _0x0ecc=['sms','openchannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x0ecc,0xd0));var _0xc0ec=function(_0x137ac0,_0x1ea2ad){_0x137ac0=_0x137ac0-0x0;var _0x1327b5=_0x0ecc[_0x137ac0];return _0x1327b5;};'use strict';var _=require(_0xc0ec('0x0'));var BPromise=require(_0xc0ec('0x1'));var db=require(_0xc0ec('0x2'))['db'];var util=require(_0xc0ec('0x3'));var channels=[_0xc0ec('0x4'),_0xc0ec('0x5'),_0xc0ec('0x6'),_0xc0ec('0x7'),_0xc0ec('0x8'),'whatsapp',_0xc0ec('0x9')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x435cc7){_0x435cc7=_0x435cc7[_0xc0ec('0xa')]();return _['includes'](channels,_0x435cc7);};exports[_0xc0ec('0xb')]=function(_0x5b77bd,_0x59ccd6,_0x2097a4,_0x2cf4a1){var _0x48028e={'loginAttempts':_0x59ccd6,'blocked':_0x2097a4};if(!_[_0xc0ec('0xc')](_0x2cf4a1)){_0x48028e[_0xc0ec('0xd')]=_0x2cf4a1;}return _0x5b77bd[_0xc0ec('0xe')](_0x48028e);};exports[_0xc0ec('0xf')]=function(_0x18fed6){return new BPromise(function(_0x372469,_0x499a41){var _0xc46ed=0x0;if(_0x18fed6[_0xc0ec('0x10')]!=='agent'){_0x372469(_0x18fed6);}db[_0xc0ec('0x11')][_0xc0ec('0x12')]({'where':{'role':_0xc0ec('0x13'),'online':!![],'id':{'$ne':_0x18fed6['id']}}})[_0xc0ec('0x14')](function(_0x5e4067){_0xc46ed=_0x5e4067;return util[_0xc0ec('0xf')]();})[_0xc0ec('0x14')](function(_0x2e6fec){if(_0x2e6fec&&_0x2e6fec[_0xc0ec('0x15')]&&_0xc46ed>=_0x2e6fec['agents']){throw Error(_0xc0ec('0x16'));}_0x372469(_0x18fed6);})[_0xc0ec('0x17')](function(_0x126308){_0x499a41(_0x126308);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b0b78fa..fecf30e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9677=['404','status','render','json','exports'];(function(_0x382697,_0x26775e){var _0x51c523=function(_0x5dc923){while(--_0x5dc923){_0x382697['push'](_0x382697['shift']());}};_0x51c523(++_0x26775e);}(_0x9677,0x12b));var _0x7967=function(_0x4cd685,_0x472697){_0x4cd685=_0x4cd685-0x0;var _0x37743e=_0x9677[_0x4cd685];return _0x37743e;};'use strict';module[_0x7967('0x0')][0x194]=function pageNotFound(_0x4c3b2d,_0x1a7efc){var _0x29de52=_0x7967('0x1');var _0xcf096=0x194;var _0x50c80f={'status':_0xcf096};_0x1a7efc['status'](_0x50c80f[_0x7967('0x2')]);_0x1a7efc[_0x7967('0x3')](_0x29de52,{},function(_0x1875dd,_0x5072b8){if(_0x1875dd){return _0x1a7efc[_0x7967('0x2')](_0x50c80f[_0x7967('0x2')])[_0x7967('0x4')](_0x50c80f);}_0x1a7efc['send'](_0x5072b8);});}; \ No newline at end of file +var _0x7932=['send','status','render'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7932,0x1d5));var _0x2793=function(_0x449ed8,_0x25ce18){_0x449ed8=_0x449ed8-0x0;var _0x2b6b62=_0x7932[_0x449ed8];return _0x2b6b62;};'use strict';module['exports'][0x194]=function pageNotFound(_0x190578,_0x2bbe93){var _0x3a9d23='404';var _0x247189=0x194;var _0x3f1635={'status':_0x247189};_0x2bbe93[_0x2793('0x0')](_0x3f1635['status']);_0x2bbe93[_0x2793('0x1')](_0x3a9d23,{},function(_0x3aab08,_0x2bb280){if(_0x3aab08){return _0x2bbe93['status'](_0x3f1635[_0x2793('0x0')])['json'](_0x3f1635);}_0x2bbe93[_0x2793('0x2')](_0x2bb280);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 062ef37..577b457 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1db=['VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','uniqueid','VoiceAgentReport','Contact','MailAccountId','Imap','Dispositions','Answers','Interactions','MailApplication','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailMessage','ContactId','Tag','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','MailInteractionId','Account','restrict','IntervalId','TagId','MailQueueReport','List','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsApplication','Owner','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','chat_group_has_users','CompanyId','cm_user_has_contacts','cm_contact_has_tags','CampaignId','Automation','AutomationAllId','Any','AutomationAnyId','Action','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Descriptions','FieldId','Subject','SubjectId','Description','VariableId','SugarcrmAccount','Field','DeskField','Subjects','DescriptionId','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ServicenowConfiguration','FromId','SessionId','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_chat_queues','FromMailAccountId','FromAccount','FromUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToUserId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Contacts','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','database','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','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','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../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','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','CmContact','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_chat_websites','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','ChanSpyId','Applications','Sounds','moh_has_sounds','Members'];(function(_0x13a842,_0x26974f){var _0xd6d41a=function(_0x37758c){while(--_0x37758c){_0x13a842['push'](_0x13a842['shift']());}};_0xd6d41a(++_0x26974f);}(_0xa1db,0xb0));var _0xba1d=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0xa1db[_0x2f7270];return _0xe1d89a;};'use strict';var path=require(_0xba1d('0x0'));var config=require(_0xba1d('0x1'));var Sequelize=require(_0xba1d('0x2'));var _=require(_0xba1d('0x3'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xba1d('0x2')]=_[_0xba1d('0x4')](config['sequelize'],{'database':_0xba1d('0x5'),'username':_0xba1d('0x6'),'password':_0xba1d('0x7'),'options':{'host':_0xba1d('0x8'),'port':0xcea,'dialect':_0xba1d('0x9'),'dialectOptions':{'charset':_0xba1d('0xa')},'logging':![],'timezone':timezone[_0xba1d('0xb')](),'define':{'charset':_0xba1d('0xc'),'collate':_0xba1d('0xd')}}});config[_0xba1d('0xe')]=_[_0xba1d('0x4')](config[_0xba1d('0xe')],{'database':_0xba1d('0x5'),'username':'xcall','password':_0xba1d('0x7'),'options':{'host':_0xba1d('0x8'),'port':0xcea,'dialect':_0xba1d('0x9'),'dialectOptions':{'charset':_0xba1d('0xa')},'logging':![],'timezone':timezone[_0xba1d('0xb')](),'define':{'charset':_0xba1d('0xc'),'collate':_0xba1d('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xba1d('0x2')]['database'],config[_0xba1d('0x2')][_0xba1d('0xf')],config[_0xba1d('0x2')][_0xba1d('0x10')],config[_0xba1d('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xba1d('0x11')],config[_0xba1d('0xe')][_0xba1d('0xf')],config[_0xba1d('0xe')][_0xba1d('0x10')],config[_0xba1d('0xe')]['options'])};db['User']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x13'));db['VoiceChanSpy']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x14'));db[_0xba1d('0x15')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/voiceContext/voiceContext.model');db[_0xba1d('0x16')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x17'));db[_0xba1d('0x18')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x19'));db[_0xba1d('0x1a')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1b'));db[_0xba1d('0x1c')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1d'));db['ScreenRecording']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1e'));db['VoiceMail']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1f'));db[_0xba1d('0x20')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x21'));db[_0xba1d('0x22')]=db['sequelize']['import'](_0xba1d('0x23'));db['VoiceDialReport']=db[_0xba1d('0x2')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x24'));db[_0xba1d('0x25')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x26'));db[_0xba1d('0x27')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x28'));db[_0xba1d('0x29')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x2a'));db[_0xba1d('0x2b')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x2c'));db[_0xba1d('0x2d')]=db['sequelize'][_0xba1d('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xba1d('0x2e')]=db[_0xba1d('0x2')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x2f'));db[_0xba1d('0x30')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x31'));db['UserFaxQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0xba1d('0x32')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x33'));db['UserOpenchannelQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xba1d('0x34')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x35'));db[_0xba1d('0x36')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x37'));db[_0xba1d('0x38')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x39'));db[_0xba1d('0x3a')]=db['sequelize'][_0xba1d('0x12')]('../api/mailAccount/mailAccount.model');db[_0xba1d('0x3b')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x3c'));db[_0xba1d('0x3d')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x3e'));db[_0xba1d('0x3f')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xba1d('0x2')]['import'](_0xba1d('0x40'));db['MailApplication']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x41'));db['MailQueueReport']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x42'));db[_0xba1d('0x43')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x44'));db[_0xba1d('0x45')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0xba1d('0x46')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x47'));db[_0xba1d('0x48')]=db['sequelize']['import'](_0xba1d('0x49'));db[_0xba1d('0x4a')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x4b'));db[_0xba1d('0x4c')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x4d'));db[_0xba1d('0x4e')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x4f'));db[_0xba1d('0x50')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x51'));db['SmsInteraction']=db['sequelize']['import'](_0xba1d('0x52'));db[_0xba1d('0x53')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x54'));db[_0xba1d('0x55')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x56'));db[_0xba1d('0x57')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x58'));db[_0xba1d('0x59')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0xba1d('0x5a')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xba1d('0x5b')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x5c'));db['OpenchannelQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x5d'));db[_0xba1d('0x5e')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x5f'));db[_0xba1d('0x60')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x61'));db[_0xba1d('0x62')]=db[_0xba1d('0x2')]['import']('../api/chatApplication/chatApplication.model');db[_0xba1d('0x63')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x64'));db[_0xba1d('0x65')]=db['sequelize'][_0xba1d('0x12')]('../api/chatMessage/chatMessage.model');db[_0xba1d('0x66')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x67'));db[_0xba1d('0x68')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x69'));db[_0xba1d('0x6a')]=db[_0xba1d('0x2')]['import']('../api/chatGroup/chatGroup.model');db[_0xba1d('0x6b')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x6c'));db[_0xba1d('0x6d')]=db[_0xba1d('0x2')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x6e'));db[_0xba1d('0x6f')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x70'));db[_0xba1d('0x71')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x72'));db[_0xba1d('0x73')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x74'));db[_0xba1d('0x75')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x76'));db[_0xba1d('0x77')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x78'));db[_0xba1d('0x79')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xba1d('0x2')]['import'](_0xba1d('0x7a'));db['Automation']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x7b'));db[_0xba1d('0x7c')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x7d'));db[_0xba1d('0x7e')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x7f'));db['Condition']=db[_0xba1d('0x2')]['import']('../api/condition/condition.model');db['Interval']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x80'));db[_0xba1d('0x81')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x82'));db['Cdr']=db[_0xba1d('0x2')]['import']('../api/cdr/cdr.model');db[_0xba1d('0x83')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xba1d('0x84')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x85'));db['Sound']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/sound/sound.model');db['Tag']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x86'));db[_0xba1d('0x87')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x88'));db[_0xba1d('0x89')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x8a'));db[_0xba1d('0x8b')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x8c'));db[_0xba1d('0x8d')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x8e'));db['IntegrationReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x8f'));db[_0xba1d('0x90')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x91'));db['AnalyticDefaultReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x92'));db[_0xba1d('0x93')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x94'));db[_0xba1d('0x95')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0xba1d('0x96')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xba1d('0x97')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x98'));db[_0xba1d('0x99')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x9a'));db[_0xba1d('0x9b')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x9c'));db[_0xba1d('0x9d')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xba1d('0x2')]['import'](_0xba1d('0x9e'));db[_0xba1d('0x9f')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xba1d('0xa0')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xa1'));db['DeskAccount']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa2'));db[_0xba1d('0xa3')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xa4'));db['DeskField']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa5'));db['ZohoAccount']=db['sequelize']['import'](_0xba1d('0xa6'));db['ZohoConfiguration']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa7'));db['ZohoField']=db['sequelize']['import']('../api/intZohoField/intZohoField.model');db[_0xba1d('0xa8')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa9'));db[_0xba1d('0xaa')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xab'));db[_0xba1d('0xac')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xad'));db['FreshdeskAccount']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xae'));db[_0xba1d('0xaf')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xb0'));db['FreshdeskField']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xba1d('0xb1')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xb2'));db['VtigerConfiguration']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xba1d('0xb3')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xb4'));db['ServicenowAccount']=db['sequelize']['import'](_0xba1d('0xb5'));db['ServicenowConfiguration']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xba1d('0xb6')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xb7'));db[_0xba1d('0xb8')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xba1d('0xb9')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xba1d('0xba')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xbb'));db[_0xba1d('0xbc')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xbd'));db[_0xba1d('0xbe')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xbf'));db[_0xba1d('0xc0')]=db['sequelize'][_0xba1d('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xba1d('0x8d')]=db['sequelize'][_0xba1d('0x12')]('../api/integration/integration.model');db[_0xba1d('0xc1')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xc2'));db[_0xba1d('0xc3')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xc4'));db[_0xba1d('0xc5')]=db[_0xba1d('0x2')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xc6'));db[_0xba1d('0xc7')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xc8'));db[_0xba1d('0xc9')]=db['sequelize'][_0xba1d('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xba1d('0xca')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xcb'));db[_0xba1d('0xcc')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xcd'));db[_0xba1d('0xce')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xcf'));db[_0xba1d('0xd0')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xd1'));db[_0xba1d('0xd2')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xd3'));db[_0xba1d('0xd4')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xd5'));db[_0xba1d('0xd6')]=db['sequelize']['import'](_0xba1d('0xd7'));db['SquareRecording']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xd8'));db[_0xba1d('0xd9')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xda'));db[_0xba1d('0xdb')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xdc'));db[_0xba1d('0xdd')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xde'));db[_0xba1d('0xdf')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xe0'));db['Migration']=db[_0xba1d('0x2')]['import'](_0xba1d('0xe1'));db[_0xba1d('0xe2')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe3'));db[_0xba1d('0xe4')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe5'));db[_0xba1d('0xe6')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe7'));db[_0xba1d('0xe8')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe9'));db['FaxTransferReport']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xea'));db['OpenchannelTransferReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xeb'));db[_0xba1d('0xec')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xed'));db[_0xba1d('0xee')]=db[_0xba1d('0x2')]['import']('../api/cmList/cmList.model');db[_0xba1d('0xef')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xf0'));db[_0xba1d('0xf1')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xf2'));db[_0xba1d('0xf3')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xf4'));db[_0xba1d('0xf5')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xba1d('0xf6')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/notification/notification.model');db[_0xba1d('0xf7')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xf8'));db[_0xba1d('0xf9')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xfa'));db[_0xba1d('0xfb')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xfc'));db[_0xba1d('0xfd')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0xba1d('0xfe')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xff'));db[_0xba1d('0x100')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x101'));db[_0xba1d('0x102')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x103'));db[_0xba1d('0x104')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x105'));db[_0xba1d('0x106')][_0xba1d('0x107')](db[_0xba1d('0x108')],{'as':_0xba1d('0x108'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x10a')});db['User'][_0xba1d('0x10b')](db['VoiceRecording'],{'as':_0xba1d('0x10c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db['UserVoiceQueueRt'],{'as':_0xba1d('0x10d'),'foreignKey':'UserId'});db[_0xba1d('0x106')]['hasMany'](db['VoiceExtension'],{'as':_0xba1d('0x10e'),'onDelete':'cascade','hooks':!![]});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0x73')],{'as':'HopperFinals','foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db[_0xba1d('0x75')],{'as':'HopperHistory','foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0x77')],{'as':_0xba1d('0x77'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db['OpenchannelInteraction'],{'as':_0xba1d('0x10f'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db['ChatInteraction'],{'as':_0xba1d('0x110'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db['SmsInteraction'],{'as':_0xba1d('0x111'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0x4a')],{'as':'FaxInteractions','foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db[_0xba1d('0x3f')],{'as':_0xba1d('0x112'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0xfb')],{'as':_0xba1d('0x113'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0xf6')],{'as':_0xba1d('0x114'),'foreignKey':_0xba1d('0x115')});db[_0xba1d('0x106')][_0xba1d('0x116')](db[_0xba1d('0xf1')],{'as':_0xba1d('0xf1'),'foreignKey':_0xba1d('0x117')});db['User'][_0xba1d('0x118')](db[_0xba1d('0x6a')],{'as':_0xba1d('0x119'),'through':'chat_group_has_users'});db['User'][_0xba1d('0x118')](db[_0xba1d('0x11a')],{'as':'Contacts','through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0xba1d('0xee')],{'as':_0xba1d('0x11b'),'through':_0xba1d('0x11c')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x11d')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x3f')],{'as':_0xba1d('0x112'),'through':_0xba1d('0x11e')});db['User'][_0xba1d('0x118')](db[_0xba1d('0x63')],{'as':'ChatInteractions','through':_0xba1d('0x11f')});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x4a')],{'as':_0xba1d('0x120'),'through':_0xba1d('0x121')});db['User']['belongsToMany'](db[_0xba1d('0x122')],{'as':_0xba1d('0x111'),'through':_0xba1d('0x123')});db['User'][_0xba1d('0x118')](db[_0xba1d('0x5a')],{'as':_0xba1d('0x10f'),'through':'user_has_openchannel_interactions'});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0xfb')],{'as':_0xba1d('0x113'),'through':_0xba1d('0x124')});db[_0xba1d('0x106')][_0xba1d('0x118')](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db['MailQueue'],{'as':_0xba1d('0x125'),'through':_0xba1d('0x30'),'required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x68')],{'as':_0xba1d('0x126'),'through':_0xba1d('0x127'),'required':![],'hooks':!![]});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x4e')],{'as':_0xba1d('0x128'),'through':'UserFaxQueue','required':![]});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x55')],{'as':_0xba1d('0x129'),'through':_0xba1d('0x32'),'required':![]});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x12a')],{'as':_0xba1d('0x12b'),'through':'UserOpenchannelQueue','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x102')],{'as':_0xba1d('0x12c'),'through':'UserWhatsappQueue','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xee')],{'through':'cm_user_has_lists'});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xef')],{'as':_0xba1d('0x12d'),'through':'user_has_voice_prefixes','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x5e')],{'as':'ChatWebsites','through':_0xba1d('0x12e')});db['User'][_0xba1d('0x118')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x3a')],{'as':_0xba1d('0x12f'),'through':'user_has_mail_accounts'});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x57')],{'as':_0xba1d('0x130'),'through':_0xba1d('0x131')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x132')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0xba1d('0x118')](db[_0xba1d('0xf7')],{'as':_0xba1d('0x133'),'through':_0xba1d('0x134')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xd6')],{'as':_0xba1d('0x135'),'through':_0xba1d('0x136')});db[_0xba1d('0x137')][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xba1d('0x138')});db['VoiceContext'][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'onDelete':_0xba1d('0x109')});db[_0xba1d('0x16')][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'as':_0xba1d('0x139'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x18')][_0xba1d('0x118')](db['Sound'],{'as':_0xba1d('0x13a'),'through':_0xba1d('0x13b')});db[_0xba1d('0x1a')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xba1d('0x13c'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0x6f')],{'as':_0xba1d('0x13e'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')]['hasMany'](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':_0xba1d('0x140'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db['ReportAgentPreview'],{'as':_0xba1d('0x77'),'foreignKey':'VoiceQueueId'});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0x71')],{'as':_0xba1d('0x141'),'foreignKey':'VoiceQueueId'});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0xc9')],{'as':_0xba1d('0x142'),'foreignKey':_0xba1d('0x13d')});db['VoiceQueue'][_0xba1d('0x116')](db[_0xba1d('0x29')],{'as':_0xba1d('0x29'),'foreignKey':_0xba1d('0x143')});db[_0xba1d('0x1a')]['belongsTo'](db[_0xba1d('0x29')],{'as':_0xba1d('0x144'),'foreignKey':_0xba1d('0x145')});db['VoiceQueue'][_0xba1d('0x116')](db[_0xba1d('0x146')],{'as':_0xba1d('0x146'),'foreignKey':'IntervalId'});db[_0xba1d('0x1a')]['belongsTo'](db[_0xba1d('0x81')],{'as':_0xba1d('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xba1d('0x1a')][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x11b'),'through':_0xba1d('0x148')});db[_0xba1d('0x1a')][_0xba1d('0x118')](db['User'],{'as':_0xba1d('0x149'),'through':_0xba1d('0x2e')});db[_0xba1d('0x1a')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'as':_0xba1d('0x14a'),'through':_0xba1d('0x14b')});db[_0xba1d('0x1a')][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x14c'),'through':_0xba1d('0x14d')});db['VoiceRecording'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x106'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x14e')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x106'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x108')]['hasMany'](db['VoiceMailMessage'],{'as':_0xba1d('0x14f'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x150'),'sourceKey':_0xba1d('0x151')});db[_0xba1d('0x20')][_0xba1d('0x116')](db[_0xba1d('0x108')],{'foreignKey':'mailboxuser','targetKey':_0xba1d('0x151')});db['VoiceCallReport'][_0xba1d('0x10b')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0xba1d('0x152'),'constraints':![]});db[_0xba1d('0x22')][_0xba1d('0x10b')](db[_0xba1d('0x153')],{'as':'AgentReports','foreignKey':_0xba1d('0x152'),'constraints':![]});db[_0xba1d('0x22')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x106'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x36')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'as':_0xba1d('0x3a'),'foreignKey':_0xba1d('0x155')});db[_0xba1d('0x38')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'as':_0xba1d('0x3a'),'foreignKey':'MailAccountId'});db[_0xba1d('0x3a')][_0xba1d('0x107')](db[_0xba1d('0x36')],{'as':_0xba1d('0x156'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x3a')][_0xba1d('0x107')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xba1d('0x109')});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db['Disposition'],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x155')});db['MailAccount'][_0xba1d('0x10b')](db['CannedAnswer'],{'as':_0xba1d('0x158'),'foreignKey':'MailAccountId'});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db['MailMessage'],{'as':_0xba1d('0x14f'),'foreignKey':_0xba1d('0x155')});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db['MailInteraction'],{'as':_0xba1d('0x159')});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db[_0xba1d('0x15a')],{'as':_0xba1d('0x139')});db['MailAccount']['belongsTo'](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x3a')][_0xba1d('0x116')](db[_0xba1d('0x87')],{'as':_0xba1d('0x87'),'foreignKey':_0xba1d('0x15c')});db[_0xba1d('0x3a')][_0xba1d('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x3a')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x15e')});db[_0xba1d('0x3b')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x30')});db[_0xba1d('0x3b')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x15f'),'as':_0xba1d('0x14a')});db[_0xba1d('0x3f')][_0xba1d('0x10b')](db[_0xba1d('0x160')],{'as':'Messages','onDelete':_0xba1d('0x109'),'foreignKey':'MailInteractionId'});db[_0xba1d('0x3f')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'as':'Account','foreignKey':_0xba1d('0x155')});db[_0xba1d('0x3f')][_0xba1d('0x116')](db['CmContact'],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x3f')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':'Owner','foreignKey':'UserId'});db[_0xba1d('0x3f')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'mail_interaction_has_tags','as':_0xba1d('0x163')});db[_0xba1d('0x3f')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x164'),'as':_0xba1d('0x165')});db[_0xba1d('0x3f')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'through':_0xba1d('0x11e'),'foreignKey':'MailInteractionId'});db[_0xba1d('0x160')][_0xba1d('0x10b')](db['Attachment'],{'as':_0xba1d('0x167'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x160')]['belongsTo'](db[_0xba1d('0x106')],{'as':_0xba1d('0x106')});db['MailMessage'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db[_0xba1d('0x160')][_0xba1d('0x116')](db['MailInteraction'],{'as':_0xba1d('0x168'),'foreignKey':_0xba1d('0x169')});db['MailMessage'][_0xba1d('0x116')](db['MailAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x155')});db[_0xba1d('0x15a')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x15a')]['belongsTo'](db['MailQueue'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x15a')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'onDelete':'restrict'});db[_0xba1d('0x15a')][_0xba1d('0x116')](db['Interval'],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x16c')});db[_0xba1d('0x15a')][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x16e')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{});db['MailQueueReport'][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x16e')][_0xba1d('0x116')](db['CmContact'],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x16e')][_0xba1d('0x116')](db[_0xba1d('0x3f')],{});db[_0xba1d('0x16e')][_0xba1d('0x116')](db[_0xba1d('0x160')],{});db['MailQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x16e')][_0xba1d('0x116')](db['MailQueue'],{});db[_0xba1d('0x43')][_0xba1d('0x10b')](db[_0xba1d('0x45')],{'as':_0xba1d('0x170'),'onDelete':_0xba1d('0x109')});db['FaxAccount'][_0xba1d('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xba1d('0x171')});db['FaxAccount'][_0xba1d('0x10b')](db[_0xba1d('0x7c')],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x171')});db[_0xba1d('0x46')]['hasMany'](db[_0xba1d('0x4a')],{'as':_0xba1d('0x159')});db[_0xba1d('0x46')]['hasMany'](db[_0xba1d('0x48')],{'as':_0xba1d('0x139')});db[_0xba1d('0x46')]['hasMany'](db[_0xba1d('0x16')],{'as':_0xba1d('0x172'),'onDelete':_0xba1d('0x109')});db['FaxAccount'][_0xba1d('0x10b')](db['FaxMessage'],{'as':_0xba1d('0x14f')});db[_0xba1d('0x46')][_0xba1d('0x116')](db['Trunk'],{'as':_0xba1d('0x29')});db['FaxAccount'][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x46')][_0xba1d('0x116')](db[_0xba1d('0x81')],{'as':_0xba1d('0x147'),'foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x46')]['belongsToMany'](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x173')});db[_0xba1d('0x48')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x48')][_0xba1d('0x116')](db['FaxQueue'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x48')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db[_0xba1d('0x48')][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x4a')][_0xba1d('0x10b')](db[_0xba1d('0x4c')],{'as':_0xba1d('0x14f'),'onDelete':'cascade','foreignKey':_0xba1d('0x174')});db[_0xba1d('0x4a')]['belongsTo'](db[_0xba1d('0x46')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x171')});db['FaxInteraction']['belongsTo'](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x4a')][_0xba1d('0x116')](db['User'],{'as':'Owner','foreignKey':_0xba1d('0x10a')});db['FaxInteraction']['belongsToMany'](db[_0xba1d('0x162')],{'through':_0xba1d('0x175'),'as':_0xba1d('0x163')});db[_0xba1d('0x4a')][_0xba1d('0x118')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xba1d('0x165')});db['FaxInteraction'][_0xba1d('0x118')](db['User'],{'as':_0xba1d('0x166'),'through':'user_has_fax_interactions','foreignKey':_0xba1d('0x174')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0xba1d('0x116')](db[_0xba1d('0x4a')],{'as':'Interaction','foreignKey':_0xba1d('0x174')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db['CmContact'],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db[_0xba1d('0xe2')],{'as':_0xba1d('0xe2'),'foreignKey':_0xba1d('0x176')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db['FaxAccount'],{'as':_0xba1d('0x16a'),'foreignKey':'FaxAccountId'});db[_0xba1d('0x4e')]['belongsToMany'](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x177')});db['FaxQueue'][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x178'),'as':_0xba1d('0x14a')});db[_0xba1d('0x50')]['belongsTo'](db[_0xba1d('0x46')],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b')});db['FaxQueueReport'][_0xba1d('0x116')](db['CmContact'],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db['FaxQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x4a')],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db['FaxMessage'],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db['FaxQueue'],{});db[_0xba1d('0x132')]['hasMany'](db[_0xba1d('0x7e')],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x179')});db[_0xba1d('0x132')]['hasMany'](db['CannedAnswer'],{'as':_0xba1d('0x158'),'foreignKey':'SmsAccountId'});db[_0xba1d('0x132')][_0xba1d('0x10b')](db[_0xba1d('0x53')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xba1d('0x132')][_0xba1d('0x10b')](db['SmsInteraction'],{'as':_0xba1d('0x159')});db[_0xba1d('0x132')][_0xba1d('0x10b')](db['SmsApplication'],{'as':_0xba1d('0x139')});db[_0xba1d('0x132')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x132')]['belongsTo'](db[_0xba1d('0x81')],{'as':_0xba1d('0x147'),'foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x132')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x17a')});db[_0xba1d('0x17b')]['belongsTo'](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db['SmsApplication'][_0xba1d('0x116')](db[_0xba1d('0x55')],{'onDelete':'restrict'});db['SmsApplication'][_0xba1d('0x116')](db['SmsAccount'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x17b')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'onDelete':_0xba1d('0x16b'),'foreignKey':'IntervalId'});db['SmsApplication']['belongsTo'](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x122')][_0xba1d('0x10b')](db['SmsMessage'],{'as':_0xba1d('0x14f'),'onDelete':_0xba1d('0x109'),'foreignKey':'SmsInteractionId'});db[_0xba1d('0x122')]['belongsTo'](db['SmsAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x179')});db[_0xba1d('0x122')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x122')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x122')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'sms_interaction_has_tags','as':_0xba1d('0x163')});db[_0xba1d('0x122')]['belongsToMany'](db[_0xba1d('0x162')],{'through':_0xba1d('0x17d'),'as':_0xba1d('0x165')});db[_0xba1d('0x122')]['belongsToMany'](db['User'],{'as':'Users','through':_0xba1d('0x123'),'foreignKey':_0xba1d('0x17e')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0xba1d('0x106')});db[_0xba1d('0x53')]['belongsTo'](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db['SmsMessage'][_0xba1d('0x116')](db[_0xba1d('0x122')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x168'),'foreignKey':'SmsInteractionId'});db[_0xba1d('0x53')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0xba1d('0x179')});db[_0xba1d('0x55')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x32'),'foreignKey':_0xba1d('0x17f')});db[_0xba1d('0x55')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x180'),'as':_0xba1d('0x14a')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db['Disposition'],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x181')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db['CannedAnswer'],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x181')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db[_0xba1d('0x5a')],{'as':'Interactions','foreignKey':_0xba1d('0x181')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db[_0xba1d('0x5b')],{'as':_0xba1d('0x14f'),'foreignKey':'OpenchannelAccountId'});db[_0xba1d('0x57')][_0xba1d('0x10b')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0xba1d('0x57')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x57')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xba1d('0x15d')});db['OpenchannelAccount'][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x131')});db[_0xba1d('0x59')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x59')][_0xba1d('0x116')](db[_0xba1d('0x12a')],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x182')});db[_0xba1d('0x59')]['belongsTo'](db[_0xba1d('0x57')],{'onDelete':'restrict','foreignKey':_0xba1d('0x181')});db[_0xba1d('0x59')]['belongsTo'](db[_0xba1d('0x146')],{'onDelete':_0xba1d('0x16b'),'foreignKey':'IntervalId'});db[_0xba1d('0x59')][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x16d')});db['OpenchannelInteraction'][_0xba1d('0x10b')](db[_0xba1d('0x5b')],{'as':_0xba1d('0x14f'),'onDelete':'cascade','foreignKey':_0xba1d('0x183')});db[_0xba1d('0x5a')][_0xba1d('0x116')](db[_0xba1d('0x57')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x181')});db[_0xba1d('0x5a')]['belongsTo'](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x5a')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x5a')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x184'),'as':'Tags'});db[_0xba1d('0x5a')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'openchannel_interaction_has_tags','as':_0xba1d('0x165')});db['OpenchannelInteraction'][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'through':_0xba1d('0x185'),'foreignKey':'OpenchannelInteractionId'});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'as':'User'});db[_0xba1d('0x5b')]['belongsTo'](db[_0xba1d('0x11a')],{'onDelete':'cascade','as':_0xba1d('0x154')});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0x5a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x168'),'foreignKey':_0xba1d('0x183')});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0xe2')],{'as':'Attachment','foreignKey':_0xba1d('0x176')});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0x57')],{'as':_0xba1d('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xba1d('0x12a')]['belongsToMany'](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x186'),'foreignKey':_0xba1d('0x182')});db[_0xba1d('0x12a')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x187'),'as':_0xba1d('0x14a')});db['ChatWebsite']['hasMany'](db[_0xba1d('0x7e')],{'as':'Dispositions','foreignKey':_0xba1d('0x188')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x7c')],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db['ChatProactiveAction'],{'as':_0xba1d('0x189')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x63')],{'as':'Interactions'});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x62')],{'as':_0xba1d('0x139')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x65')],{'as':_0xba1d('0x14f')});db[_0xba1d('0x5e')]['belongsTo'](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x5e')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'as':_0xba1d('0x146'),'foreignKey':_0xba1d('0x16c')});db['ChatWebsite'][_0xba1d('0x116')](db[_0xba1d('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x5e')]['belongsToMany'](db['User'],{'as':_0xba1d('0x149'),'through':'user_has_chat_websites'});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x57')],{});db[_0xba1d('0x60')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x5a')],{});db[_0xba1d('0x60')]['belongsTo'](db[_0xba1d('0x5b')],{});db['OpenchannelQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x12a')],{});db[_0xba1d('0x62')]['belongsTo'](db['User'],{'as':_0xba1d('0x18a'),'foreignKey':_0xba1d('0x10a'),'onDelete':_0xba1d('0x16b')});db['ChatApplication'][_0xba1d('0x116')](db[_0xba1d('0x68')],{'as':_0xba1d('0x18b'),'foreignKey':_0xba1d('0x18c'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x62')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'as':_0xba1d('0x18d'),'foreignKey':_0xba1d('0x188'),'onDelete':_0xba1d('0x16b')});db['ChatApplication'][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x63')][_0xba1d('0x10b')](db[_0xba1d('0x65')],{'as':'Messages','onDelete':_0xba1d('0x109'),'foreignKey':'ChatInteractionId'});db[_0xba1d('0x63')]['belongsTo'](db[_0xba1d('0x5e')],{'as':'Account','foreignKey':_0xba1d('0x188')});db['ChatInteraction'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':'Contact','foreignKey':_0xba1d('0x161')});db['ChatInteraction'][_0xba1d('0x116')](db['User'],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x63')]['belongsToMany'](db[_0xba1d('0x162')],{'through':_0xba1d('0x18e'),'as':_0xba1d('0x163')});db[_0xba1d('0x63')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x18e'),'as':_0xba1d('0x165')});db[_0xba1d('0x63')][_0xba1d('0x118')](db['User'],{'as':_0xba1d('0x166'),'through':_0xba1d('0x11f'),'foreignKey':_0xba1d('0x18f')});db['ChatMessage']['belongsTo'](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x106')});db[_0xba1d('0x65')]['belongsTo'](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x65')][_0xba1d('0x116')](db[_0xba1d('0x63')],{'onDelete':'cascade','as':_0xba1d('0x168'),'foreignKey':'ChatInteractionId'});db[_0xba1d('0x65')][_0xba1d('0x116')](db[_0xba1d('0xe2')],{'as':'Attachment','foreignKey':_0xba1d('0x176')});db[_0xba1d('0x65')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x66')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':'Contact','foreignKey':'ContactId'});db[_0xba1d('0x66')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x68')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':'UserChatQueue','hooks':!![]});db[_0xba1d('0x68')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':'team_has_chat_queues','as':_0xba1d('0x14a')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xba1d('0x190'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6a')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x13c'),'through':_0xba1d('0x191')});db['ChatProactiveAction']['belongsTo'](db[_0xba1d('0x5e')],{'as':_0xba1d('0x18d'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x6d')][_0xba1d('0x10b')](db[_0xba1d('0x11a')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact'][_0xba1d('0x10b')](db[_0xba1d('0x6f')],{'as':'Hoppers','foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')]['hasMany'](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':'HopperHistories','foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db['ReportAgentPreview'],{'as':_0xba1d('0x77'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0xc9')],{'as':_0xba1d('0x142'),'foreignKey':'ContactId'});db[_0xba1d('0x11a')]['hasMany'](db[_0xba1d('0x5a')],{'as':_0xba1d('0x10f'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x63')],{'as':_0xba1d('0x110'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x122')],{'as':_0xba1d('0x111'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x4a')],{'as':'FaxInteractions','foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')]['hasMany'](db[_0xba1d('0x3f')],{'as':_0xba1d('0x112'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')]['belongsTo'](db[_0xba1d('0x6d')],{'as':'Company','foreignKey':_0xba1d('0x192')});db[_0xba1d('0x11a')][_0xba1d('0x116')](db['CmList'],{'as':'List','foreignKey':_0xba1d('0x15b'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x11a')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':'Users','through':_0xba1d('0x193')});db['CmContact']['belongsToMany'](db[_0xba1d('0x162')],{'as':_0xba1d('0x163'),'through':_0xba1d('0x194')});db[_0xba1d('0x11a')][_0xba1d('0x118')](db['Tag'],{'through':_0xba1d('0x194'),'as':_0xba1d('0x165')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x18a'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x1a')],{'as':_0xba1d('0x18b'),'foreignKey':_0xba1d('0x13d'),'onDelete':'cascade'});db[_0xba1d('0x6f')]['belongsTo'](db[_0xba1d('0xdf')],{'as':_0xba1d('0xdf'),'foreignKey':_0xba1d('0x195'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xba1d('0x71')]['belongsTo'](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x71')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b'),'onDelete':'cascade'});db[_0xba1d('0x71')][_0xba1d('0x116')](db[_0xba1d('0x1a')],{'as':_0xba1d('0x18b'),'foreignKey':_0xba1d('0x13d'),'onDelete':'cascade'});db[_0xba1d('0x71')][_0xba1d('0x116')](db[_0xba1d('0xdf')],{'as':_0xba1d('0xdf'),'foreignKey':'CampaignId','onDelete':_0xba1d('0x109')});db[_0xba1d('0x196')]['hasMany'](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xba1d('0x197'),'onDelete':_0xba1d('0x109'),'hooks':!![]});db[_0xba1d('0x196')]['hasMany'](db['Condition'],{'as':{'plural':_0xba1d('0x198'),'singular':'OneAny'},'foreignKey':_0xba1d('0x199'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xba1d('0x10b')](db[_0xba1d('0x19a')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xba1d('0x146')]['hasMany'](db['Interval'],{'as':_0xba1d('0x19b'),'foreignKey':'IntervalId','onDelete':_0xba1d('0x109'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xba1d('0x16')],{'as':'Extensions','foreignKey':_0xba1d('0x16c'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x146')][_0xba1d('0x10b')](db[_0xba1d('0x15a')],{'as':_0xba1d('0x19c'),'foreignKey':_0xba1d('0x16c')});db['Interval'][_0xba1d('0x10b')](db[_0xba1d('0x62')],{'as':_0xba1d('0x19d'),'foreignKey':_0xba1d('0x16c')});db['Interval'][_0xba1d('0x10b')](db['FaxApplication'],{'as':_0xba1d('0x19e'),'foreignKey':_0xba1d('0x16c')});db[_0xba1d('0x146')][_0xba1d('0x10b')](db[_0xba1d('0x17b')],{'as':_0xba1d('0x19f'),'foreignKey':_0xba1d('0x16c')});db[_0xba1d('0x84')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{});db['Schedule']['belongsTo'](db[_0xba1d('0x1a0')],{'foreignKey':_0xba1d('0x1a1')});db[_0xba1d('0x84')][_0xba1d('0x116')](db[_0xba1d('0x90')],{'foreignKey':_0xba1d('0x1a2')});db['Sound']['belongsToMany'](db[_0xba1d('0x18')],{'as':_0xba1d('0x1a3'),'through':_0xba1d('0x13b'),'onDelete':_0xba1d('0x16b')});db['Tag']['belongsToMany'](db[_0xba1d('0x11a')],{'through':_0xba1d('0x194')});db[_0xba1d('0x162')]['belongsToMany'](db[_0xba1d('0x63')],{'through':_0xba1d('0x18e')});db[_0xba1d('0x162')]['belongsToMany'](db[_0xba1d('0x3f')],{'through':_0xba1d('0x164')});db['Tag'][_0xba1d('0x118')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xba1d('0x162')][_0xba1d('0x118')](db[_0xba1d('0x4a')],{'through':_0xba1d('0x175')});db['Tag'][_0xba1d('0x118')](db[_0xba1d('0x5a')],{'through':'openchannel_interaction_has_tags'});db[_0xba1d('0x162')][_0xba1d('0x118')](db[_0xba1d('0xfb')],{'through':_0xba1d('0x1a4')});db[_0xba1d('0x89')][_0xba1d('0x10b')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xba1d('0x1a5')},'foreignKey':_0xba1d('0x1a6'),'onDelete':_0xba1d('0x109'),'hooks':!![]});db[_0xba1d('0x89')][_0xba1d('0x10b')](db['Condition'],{'as':{'plural':_0xba1d('0x1a7'),'singular':'AnyCondition'},'foreignKey':_0xba1d('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0xba1d('0x89')][_0xba1d('0x10b')](db['Action'],{'as':'Actions','foreignKey':_0xba1d('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0xba1d('0x90')][_0xba1d('0x10b')](db[_0xba1d('0x96')],{'as':_0xba1d('0x1aa'),'onDelete':'cascade','foreignKey':_0xba1d('0x1a2'),'hooks':!![]});db[_0xba1d('0x1a0')][_0xba1d('0x10b')](db[_0xba1d('0x96')],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1a1')});db[_0xba1d('0x95')][_0xba1d('0x10b')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0xba1d('0x96')]['belongsTo'](db[_0xba1d('0x95')],{'foreignKey':_0xba1d('0x1ab')});db[_0xba1d('0x99')][_0xba1d('0x10b')](db[_0xba1d('0x9b')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x9b')][_0xba1d('0x10b')](db[_0xba1d('0x9d')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0x9d')],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':'DescriptionId'});db[_0xba1d('0x9b')][_0xba1d('0x10b')](db[_0xba1d('0x9d')],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x9b')]['belongsTo'](db[_0xba1d('0x99')],{'as':'Account','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x9d')]['hasMany'](db[_0xba1d('0x9d')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xba1d('0x10b')](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xba1d('0x9d')][_0xba1d('0x116')](db['Variable'],{'as':_0xba1d('0x8b'),'foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0x1b4')][_0xba1d('0x10b')](db[_0xba1d('0x9f')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x9f')][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Subjects','onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db['SugarcrmConfiguration'][_0xba1d('0x10b')](db['SugarcrmField'],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Fields','onDelete':_0xba1d('0x109'),'foreignKey':'FieldId'});db[_0xba1d('0x9f')]['belongsTo'](db[_0xba1d('0x1b4')],{'as':'Account','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xa0')][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Subject','foreignKey':_0xba1d('0x1b1')});db['SugarcrmField'][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xba1d('0xa0')][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':_0xba1d('0x1b5'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':'Variable','foreignKey':_0xba1d('0x1b3')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db['DeskConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0x1b6')],{'as':_0xba1d('0x1b7'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db['DeskConfiguration'][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xa3')][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xa3')]['belongsTo'](db[_0xba1d('0x1b9')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db['DeskConfiguration'][_0xba1d('0x118')](db['Tag'],{'through':_0xba1d('0x1ba')});db[_0xba1d('0x1b6')][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x1b6')]['hasMany'](db[_0xba1d('0x1b6')],{'as':'Description','foreignKey':_0xba1d('0x1b8')});db['DeskField'][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x1b6')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':_0xba1d('0x8b'),'foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0x1bb')][_0xba1d('0x10b')](db[_0xba1d('0x1bc')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1bc')][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1b7'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db['ZohoConfiguration']['hasMany'](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db['ZohoConfiguration'][_0xba1d('0x116')](db[_0xba1d('0x1bb')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1bd')][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1b0'),'foreignKey':'SubjectId'});db[_0xba1d('0x1bd')][_0xba1d('0x10b')](db['ZohoField'],{'as':'Description','foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0x1bd')][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x1bd')][_0xba1d('0x116')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0xba1d('0xaa')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaa')]['hasMany'](db[_0xba1d('0xac')],{'as':_0xba1d('0x1b7'),'foreignKey':'SubjectId'});db[_0xba1d('0xaa')][_0xba1d('0x10b')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0xba1d('0xac')],{'as':_0xba1d('0x1aa'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xaa')]['belongsTo'](db['ZendeskAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaa')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x1be')});db['ZendeskField']['hasMany'](db[_0xba1d('0xac')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xac')][_0xba1d('0x10b')](db[_0xba1d('0xac')],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db[_0xba1d('0xac')][_0xba1d('0x10b')](db['ZendeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xba1d('0xac')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':_0xba1d('0x8b'),'foreignKey':'VariableId'});db[_0xba1d('0x1bf')]['hasMany'](db[_0xba1d('0xaf')],{'as':_0xba1d('0x1ac'),'onDelete':'cascade','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaf')][_0xba1d('0x10b')](db[_0xba1d('0x1c0')],{'as':_0xba1d('0x1b7'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xaf')][_0xba1d('0x10b')](db['FreshdeskField'],{'as':_0xba1d('0x1ae'),'onDelete':'cascade','foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xaf')][_0xba1d('0x10b')](db['FreshdeskField'],{'as':'Fields','onDelete':_0xba1d('0x109'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xba1d('0x116')](db['FreshdeskAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaf')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x1c1')});db['FreshdeskField']['hasMany'](db[_0xba1d('0x1c0')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x1c0')]['hasMany'](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xba1d('0x1c0')][_0xba1d('0x10b')](db[_0xba1d('0x1c0')],{'as':'Field','foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x1c0')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':_0xba1d('0x8b'),'foreignKey':'VariableId'});db[_0xba1d('0xb1')]['hasMany'](db[_0xba1d('0x1c2')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1c2')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1b7'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x1c2')]['hasMany'](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1ae'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0x1c2')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1aa'),'foreignKey':'FieldId'});db[_0xba1d('0x1c2')]['belongsTo'](db['VtigerAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db['VtigerField'][_0xba1d('0x10b')](db['VtigerField'],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xb3')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1b2'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xb3')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xb3')][_0xba1d('0x116')](db['Variable'],{'as':_0xba1d('0x8b'),'foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0x1c3')][_0xba1d('0x10b')](db[_0xba1d('0x1c4')],{'as':_0xba1d('0x1ac'),'onDelete':'cascade','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1c4')][_0xba1d('0x10b')](db['ServicenowField'],{'as':_0xba1d('0x1b7'),'foreignKey':'SubjectId'});db[_0xba1d('0x1c4')][_0xba1d('0x10b')](db[_0xba1d('0xb6')],{'as':_0xba1d('0x1ae'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0x1c4')]['hasMany'](db['ServicenowField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xba1d('0x1c4')][_0xba1d('0x116')](db['ServicenowAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xb6')][_0xba1d('0x10b')](db[_0xba1d('0xb6')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xb6')][_0xba1d('0x10b')](db['ServicenowField'],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db[_0xba1d('0xb6')]['hasMany'](db[_0xba1d('0xb6')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xb6')]['belongsTo'](db['Variable'],{'as':_0xba1d('0x8b'),'foreignKey':'VariableId'});db[_0xba1d('0xb8')][_0xba1d('0x10b')](db['Dynamics365Configuration'],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db['Dynamics365Configuration']['hasMany'](db[_0xba1d('0xba')],{'as':_0xba1d('0x1b7'),'onDelete':'cascade','foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xb9')][_0xba1d('0x10b')](db['Dynamics365Field'],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xb9')][_0xba1d('0x10b')](db[_0xba1d('0xba')],{'as':'Fields','onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xb9')][_0xba1d('0x116')](db[_0xba1d('0xb8')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xba')][_0xba1d('0x10b')](db[_0xba1d('0xba')],{'as':_0xba1d('0x1b0'),'foreignKey':'SubjectId'});db[_0xba1d('0xba')][_0xba1d('0x10b')](db['Dynamics365Field'],{'as':_0xba1d('0x1b2'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xba')]['hasMany'](db[_0xba1d('0xba')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xba')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':'Variable','foreignKey':_0xba1d('0x1b3')});db['FreshsalesAccount'][_0xba1d('0x10b')](db['FreshsalesConfiguration'],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xbe')]['hasMany'](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1b7'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xbe')]['hasMany'](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1ae'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xbe')][_0xba1d('0x10b')](db[_0xba1d('0xc0')],{'as':'Fields','foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xbe')][_0xba1d('0x116')](db[_0xba1d('0xbc')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xc0')][_0xba1d('0x10b')](db['FreshsalesField'],{'as':_0xba1d('0x1b0'),'foreignKey':'SubjectId'});db[_0xba1d('0xc0')][_0xba1d('0x10b')](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xba1d('0x10b')](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db['FreshsalesField'][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':'Variable','foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0xc3')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{});db[_0xba1d('0xc3')][_0xba1d('0x116')](db['CmList'],{'as':_0xba1d('0x16f'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':'Contact','foreignKey':_0xba1d('0x161')});db[_0xba1d('0xc3')][_0xba1d('0x116')](db[_0xba1d('0x63')],{});db[_0xba1d('0xc3')][_0xba1d('0x116')](db[_0xba1d('0x65')],{});db[_0xba1d('0xc3')][_0xba1d('0x116')](db['User'],{});db['ChatQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x68')],{});db[_0xba1d('0xc5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1c5')});db[_0xba1d('0xc5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xba1d('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':_0xba1d('0x1c6'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0xc9')][_0xba1d('0x10b')](db[_0xba1d('0x1c7')],{'foreignKey':'SessionId','onDelete':_0xba1d('0x109')});db[_0xba1d('0xca')]['belongsTo'](db['SmsAccount'],{});db[_0xba1d('0xca')][_0xba1d('0x116')](db['CmList'],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xca')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db['SmsQueueReport']['belongsTo'](db[_0xba1d('0x122')],{});db[_0xba1d('0xca')][_0xba1d('0x116')](db[_0xba1d('0x53')],{});db['SmsQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0xca')]['belongsTo'](db[_0xba1d('0x55')],{});db[_0xba1d('0xd0')][_0xba1d('0x10b')](db[_0xba1d('0xc9')],{'foreignKey':'ProjectId'});db[_0xba1d('0xd0')][_0xba1d('0x10b')](db[_0xba1d('0xc7')],{'foreignKey':'ProjectId'});db[_0xba1d('0xd0')][_0xba1d('0x10b')](db[_0xba1d('0x1c7')],{'foreignKey':_0xba1d('0x1c8')});db[_0xba1d('0xd6')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'through':_0xba1d('0x136')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x11d')});db['Team'][_0xba1d('0x118')](db['VoiceQueue'],{'through':_0xba1d('0x14b'),'as':_0xba1d('0x1c9')});db['Team'][_0xba1d('0x118')](db[_0xba1d('0x3b')],{'through':_0xba1d('0x15f'),'as':_0xba1d('0x125')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x68')],{'through':_0xba1d('0x1ca'),'as':_0xba1d('0x126')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x4e')],{'through':_0xba1d('0x178'),'as':_0xba1d('0x128')});db[_0xba1d('0xdb')]['belongsToMany'](db[_0xba1d('0x55')],{'through':_0xba1d('0x180'),'as':_0xba1d('0x129')});db['Team']['belongsToMany'](db[_0xba1d('0x12a')],{'through':'team_has_openchannel_queues','as':_0xba1d('0x12b')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x102')],{'through':'team_has_whatsapp_queues','as':_0xba1d('0x12c')});db[_0xba1d('0xdf')][_0xba1d('0x10b')](db[_0xba1d('0x6f')],{'as':_0xba1d('0x13e'),'foreignKey':_0xba1d('0x195')});db[_0xba1d('0xdf')][_0xba1d('0x10b')](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':_0xba1d('0x195')});db[_0xba1d('0xdf')][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':_0xba1d('0x140'),'foreignKey':_0xba1d('0x195')});db['Campaign'][_0xba1d('0x10b')](db[_0xba1d('0x71')],{'as':_0xba1d('0x141'),'foreignKey':_0xba1d('0x195')});db['Campaign']['belongsTo'](db[_0xba1d('0x29')],{'as':'Trunk','foreignKey':_0xba1d('0x143')});db['Campaign'][_0xba1d('0x116')](db[_0xba1d('0x29')],{'as':_0xba1d('0x144'),'foreignKey':_0xba1d('0x145')});db[_0xba1d('0xdf')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'as':'Interval','foreignKey':_0xba1d('0x16c')});db[_0xba1d('0xdf')][_0xba1d('0x116')](db['SquareProject'],{'as':_0xba1d('0xd6'),'foreignKey':'SquareProjectId'});db['Campaign'][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x11b'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x14c'),'through':'campaigns_has_cm_blacklists'});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x160')],{});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x3f')],{});db[_0xba1d('0xe6')]['belongsTo'](db[_0xba1d('0x3a')],{'foreignKey':_0xba1d('0x1cb'),'as':_0xba1d('0x1cc')});db['MailTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':'FromAgent'});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':'ToUserId','as':_0xba1d('0x1ce')});db[_0xba1d('0xe6')]['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xba1d('0x1cf')});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'foreignKey':_0xba1d('0x1d0'),'as':_0xba1d('0x1d1')});db[_0xba1d('0xe8')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x63')],{});db['ChatTransferReport'][_0xba1d('0x116')](db['ChatWebsite'],{'foreignKey':_0xba1d('0x1d2'),'as':_0xba1d('0x1cc')});db['ChatTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0xe8')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db[_0xba1d('0xe8')]['belongsTo'](db[_0xba1d('0x68')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xba1d('0x1d5')][_0xba1d('0x116')](db['FaxMessage'],{});db['FaxTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x4a')],{});db['FaxTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x46')],{'foreignKey':_0xba1d('0x1d6'),'as':'FromAccount'});db[_0xba1d('0x1d5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0x1d5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':'ToAgent'});db[_0xba1d('0x1d5')]['belongsTo'](db[_0xba1d('0x4e')],{'foreignKey':_0xba1d('0x1d7'),'as':_0xba1d('0x1cf')});db['FaxTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x46')],{'foreignKey':_0xba1d('0x1d8'),'as':_0xba1d('0x1d1')});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db[_0xba1d('0x5b')],{});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db[_0xba1d('0x5a')],{});db['OpenchannelTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x57')],{'foreignKey':_0xba1d('0x1da'),'as':_0xba1d('0x1cc')});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':'FromUserId','as':_0xba1d('0x1d3')});db['OpenchannelTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db['OpenchannelTransferReport'][_0xba1d('0x116')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xba1d('0x1cf')});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db['OpenchannelAccount'],{'foreignKey':_0xba1d('0x1db'),'as':'ToAccount'});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x53')],{});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x122')],{});db['SmsTransferReport']['belongsTo'](db[_0xba1d('0x132')],{'foreignKey':_0xba1d('0x1dc'),'as':_0xba1d('0x1cc')});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0xec')][_0xba1d('0x116')](db['User'],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x55')],{'foreignKey':_0xba1d('0x1dd'),'as':'ToQueue'});db['SmsTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x132')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xba1d('0xee')]['hasMany'](db[_0xba1d('0x7e')],{'as':_0xba1d('0x157'),'foreignKey':'ListId'});db[_0xba1d('0xee')][_0xba1d('0x10b')](db[_0xba1d('0x79')],{'as':_0xba1d('0x1de'),'foreignKey':_0xba1d('0x15b')});db['CmList'][_0xba1d('0x10b')](db['CmContact'],{'as':_0xba1d('0x1df'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xee')][_0xba1d('0x10b')](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':'ListId'});db['CmList'][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':_0xba1d('0x1e0'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xee')][_0xba1d('0x10b')](db[_0xba1d('0x77')],{'as':_0xba1d('0x77'),'foreignKey':'ListId'});db[_0xba1d('0xee')][_0xba1d('0x118')](db[_0xba1d('0x1a')],{'as':_0xba1d('0x1e1'),'through':_0xba1d('0x148')});db[_0xba1d('0xee')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xba1d('0xef')][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'as':_0xba1d('0x10e'),'onDelete':'cascade'});db[_0xba1d('0xef')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x1e2')});db[_0xba1d('0xf1')][_0xba1d('0x10b')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'foreignKey':_0xba1d('0x117')});db[_0xba1d('0xf1')][_0xba1d('0x10b')](db[_0xba1d('0xf3')],{'as':_0xba1d('0x1e3'),'foreignKey':_0xba1d('0x117'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0xf3')][_0xba1d('0x10b')](db[_0xba1d('0xf5')],{'as':_0xba1d('0x1e4'),'foreignKey':_0xba1d('0x1e5'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0xf7')][_0xba1d('0x10b')](db[_0xba1d('0x7e')],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x1e6')});db['WhatsappAccount'][_0xba1d('0x10b')](db[_0xba1d('0x7c')],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x1e6')});db[_0xba1d('0xf7')][_0xba1d('0x10b')](db['WhatsappMessage'],{'as':_0xba1d('0x14f'),'foreignKey':_0xba1d('0x1e6')});db[_0xba1d('0xf7')][_0xba1d('0x10b')](db[_0xba1d('0xfb')],{'as':_0xba1d('0x159')});db['WhatsappAccount'][_0xba1d('0x10b')](db[_0xba1d('0xf9')],{'as':_0xba1d('0x139')});db[_0xba1d('0xf7')]['belongsTo'](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xf7')][_0xba1d('0x116')](db['Pause'],{'as':_0xba1d('0x147'),'foreignKey':_0xba1d('0x15d')});db[_0xba1d('0xf7')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x134')});db[_0xba1d('0xf9')][_0xba1d('0x116')](db['User'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0xf9')][_0xba1d('0x116')](db[_0xba1d('0x102')],{'onDelete':_0xba1d('0x16b')});db['WhatsappApplication'][_0xba1d('0x116')](db[_0xba1d('0xf7')],{'onDelete':'restrict'});db[_0xba1d('0xf9')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16c')});db['WhatsappApplication'][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0xfb')]['hasMany'](db[_0xba1d('0xfd')],{'as':_0xba1d('0x14f'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1e7')});db[_0xba1d('0xfb')]['belongsTo'](db['WhatsappAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1e6')});db['WhatsappInteraction'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0xfb')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0xfb')]['belongsToMany'](db['Tag'],{'through':_0xba1d('0x1a4'),'as':_0xba1d('0x163')});db[_0xba1d('0xfb')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'whatsapp_interaction_has_tags','as':_0xba1d('0x165')});db[_0xba1d('0xfb')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xba1d('0x1e7')});db['WhatsappMessage']['belongsTo'](db[_0xba1d('0x106')],{'as':'User'});db[_0xba1d('0xfd')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db[_0xba1d('0xfd')]['belongsTo'](db[_0xba1d('0xfb')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xba1d('0x1e7')});db[_0xba1d('0xfd')]['belongsTo'](db[_0xba1d('0xf7')],{'as':_0xba1d('0x16a'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport']['belongsTo'](db[_0xba1d('0xf7')],{});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':'ListId'});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0xfb')],{});db['WhatsappQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x102')],{});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0xfd')],{});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x100')]['belongsTo'](db[_0xba1d('0xfd')],{});db['WhatsappTransferReport'][_0xba1d('0x116')](db[_0xba1d('0xfb')],{});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0xf7')],{'foreignKey':_0xba1d('0x1e8'),'as':_0xba1d('0x1cc')});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0xf7')],{'foreignKey':_0xba1d('0x1e9'),'as':_0xba1d('0x1d1')});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0x102')],{'foreignKey':_0xba1d('0x1ea'),'as':'ToQueue'});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0x100')]['belongsTo'](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db[_0xba1d('0x102')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':'UserWhatsappQueue','foreignKey':_0xba1d('0x1eb')});db[_0xba1d('0x102')]['belongsToMany'](db['Team'],{'through':'team_has_whatsapp_queues','as':_0xba1d('0x14a')});module[_0xba1d('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x207c=['sequelizeHistory','xcall','xC@LL1234','127.0.0.1','username','password','options','database','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.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','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../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','OpenchannelApplication','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileResource/userProfileResource.model','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','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','VoiceExtension','CmHopperFinal','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteractions','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','SmsAccount','SmsAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','Imap','Smtp','Disposition','CannedAnswer','MailMessage','Interactions','Applications','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Contact','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','MailApplication','restrict','TagId','Items','Dispositions','Exntensions','Owner','fax_interaction_has_tags','FaxInteractionId','AttachmentId','Account','FaxAccountId','SmsAccountId','Answers','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteraction','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','ChatQueueId','ChatWebsiteId','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','Website','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','Queue','CampaignId','All','AutomationAllId','Condition','Any','OneAny','Actions','Intervals','Extensions','MailApplications','ChatApplications','SmsApplications','AnalyticCustomReport','Sound','Mohs','whatsapp_interaction_has_tags','TriggerAllId','AnyConditions','TriggerId','Fields','CustomReportId','AnalyticFieldReport','DefaultReportId','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','Subjects','Description','DeskField','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','VtigerAccount','VtigerField','Dynamics365Configuration','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','team_has_voice_queues','VoiceQueues','team_has_fax_queues','WhatsappQueue','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','mysql','utf8mb4','name','utf8_general_ci'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x207c,0x1e8));var _0xc207=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x207c[_0x3598bb];return _0x13c837;};'use strict';var path=require('path');var config=require(_0xc207('0x0'));var Sequelize=require(_0xc207('0x1'));var _=require(_0xc207('0x2'));var jstz=require(_0xc207('0x3'));var timezone=jstz[_0xc207('0x4')]();config[_0xc207('0x1')]=_[_0xc207('0x5')](config['sequelize'],{'database':_0xc207('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc207('0x7'),'dialectOptions':{'charset':_0xc207('0x8')},'logging':![],'timezone':timezone[_0xc207('0x9')](),'define':{'charset':'utf8','collate':_0xc207('0xa')}}});config[_0xc207('0xb')]=_[_0xc207('0x5')](config['sequelizeHistory'],{'database':_0xc207('0x6'),'username':_0xc207('0xc'),'password':_0xc207('0xd'),'options':{'host':_0xc207('0xe'),'port':0xcea,'dialect':_0xc207('0x7'),'dialectOptions':{'charset':_0xc207('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc207('0x1')]['database'],config[_0xc207('0x1')][_0xc207('0xf')],config['sequelize'][_0xc207('0x10')],config[_0xc207('0x1')][_0xc207('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc207('0xb')][_0xc207('0x12')],config['sequelizeHistory'][_0xc207('0xf')],config[_0xc207('0xb')][_0xc207('0x10')],config[_0xc207('0xb')]['options'])};db['User']=db['sequelize'][_0xc207('0x13')](_0xc207('0x14'));db[_0xc207('0x15')]=db[_0xc207('0x1')]['import'](_0xc207('0x16'));db[_0xc207('0x17')]=db[_0xc207('0x1')]['import'](_0xc207('0x18'));db['VoiceExtension']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x19'));db[_0xc207('0x1a')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x1b'));db[_0xc207('0x1c')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x1d'));db[_0xc207('0x1e')]=db[_0xc207('0x1')]['import'](_0xc207('0x1f'));db['ScreenRecording']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x20'));db[_0xc207('0x21')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x22'));db[_0xc207('0x23')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x24'));db[_0xc207('0x25')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x26'));db['VoiceDialReport']=db[_0xc207('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xc207('0x27')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x28'));db[_0xc207('0x29')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x2a'));db[_0xc207('0x2b')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x2c'));db[_0xc207('0x2d')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x2e'));db[_0xc207('0x2f')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xc207('0x30')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x31'));db[_0xc207('0x32')]=db[_0xc207('0x1')]['import'](_0xc207('0x33'));db[_0xc207('0x34')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xc207('0x35')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x36'));db[_0xc207('0x37')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x38'));db[_0xc207('0x39')]=db['sequelize']['import'](_0xc207('0x3a'));db[_0xc207('0x3b')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xc207('0x3c')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x3d'));db[_0xc207('0x3e')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x3f'));db['MailServerOut']=db[_0xc207('0x1')]['import'](_0xc207('0x40'));db[_0xc207('0x41')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x42'));db[_0xc207('0x43')]=db['sequelize']['import'](_0xc207('0x44'));db[_0xc207('0x45')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0xc207('0x46')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x47'));db['MailApplication']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x48'));db[_0xc207('0x49')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x4a'));db[_0xc207('0x4b')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/dashboard/dashboard.model');db[_0xc207('0x4c')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x4d'));db[_0xc207('0x4e')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x4f'));db[_0xc207('0x50')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x51'));db['FaxInteraction']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x52'));db[_0xc207('0x53')]=db[_0xc207('0x1')]['import'](_0xc207('0x54'));db[_0xc207('0x55')]=db[_0xc207('0x1')]['import'](_0xc207('0x56'));db[_0xc207('0x57')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x58'));db[_0xc207('0x59')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x5a'));db[_0xc207('0x5b')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x5c'));db[_0xc207('0x5d')]=db['sequelize']['import'](_0xc207('0x5e'));db[_0xc207('0x5f')]=db[_0xc207('0x1')]['import'](_0xc207('0x60'));db[_0xc207('0x61')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0xc207('0x62')]=db['sequelize'][_0xc207('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0xc207('0x1')][_0xc207('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0xc207('0x13')](_0xc207('0x63'));db[_0xc207('0x64')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x65'));db[_0xc207('0x66')]=db[_0xc207('0x1')]['import'](_0xc207('0x67'));db[_0xc207('0x68')]=db['sequelize']['import'](_0xc207('0x69'));db['ChatApplication']=db['sequelize'][_0xc207('0x13')](_0xc207('0x6a'));db[_0xc207('0x6b')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x6c'));db[_0xc207('0x6d')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x6e'));db[_0xc207('0x6f')]=db['sequelize']['import'](_0xc207('0x70'));db[_0xc207('0x71')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x72'));db[_0xc207('0x73')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x74'));db['ChatProactiveAction']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x75'));db[_0xc207('0x76')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x77'));db[_0xc207('0x78')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x79'));db[_0xc207('0x7a')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x7b'));db[_0xc207('0x7c')]=db[_0xc207('0x1')]['import'](_0xc207('0x7d'));db['CmHopperFinal']=db['sequelize'][_0xc207('0x13')](_0xc207('0x7e'));db[_0xc207('0x7f')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x80'));db[_0xc207('0x81')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x82'));db[_0xc207('0x83')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x84'));db[_0xc207('0x85')]=db['sequelize'][_0xc207('0x13')]('../api/action/action.model');db[_0xc207('0x86')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x87'));db['Disposition']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x88'));db['Condition']=db['sequelize'][_0xc207('0x13')]('../api/condition/condition.model');db[_0xc207('0x89')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x8a'));db[_0xc207('0x8b')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x8c'));db['Cdr']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x8d'));db[_0xc207('0x8e')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x8f'));db[_0xc207('0x90')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x91'));db['Sound']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x92'));db[_0xc207('0x93')]=db['sequelize']['import'](_0xc207('0x94'));db[_0xc207('0x95')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/template/template.model');db[_0xc207('0x96')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/trigger/trigger.model');db[_0xc207('0x97')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/variable/variable.model');db[_0xc207('0x98')]=db['sequelize'][_0xc207('0x13')]('../api/integration/integration.model');db[_0xc207('0x99')]=db[_0xc207('0x1')]['import'](_0xc207('0x9a'));db['AnalyticCustomReport']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x9b'));db[_0xc207('0x9c')]=db[_0xc207('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xc207('0x9d')]=db[_0xc207('0x1')]['import'](_0xc207('0x9e'));db[_0xc207('0x9f')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xa0'));db['AnalyticFieldReport']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xa1'));db[_0xc207('0xa2')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xa3'));db[_0xc207('0xa4')]=db[_0xc207('0x1')]['import'](_0xc207('0xa5'));db['SalesforceField']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xa6'));db[_0xc207('0xa7')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xc207('0xa8')]=db[_0xc207('0x1')]['import'](_0xc207('0xa9'));db[_0xc207('0xaa')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xab'));db[_0xc207('0xac')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xad'));db[_0xc207('0xae')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xaf'));db['DeskField']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xb0'));db[_0xc207('0xb1')]=db['sequelize'][_0xc207('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0xc207('0xb2')]=db['sequelize']['import'](_0xc207('0xb3'));db[_0xc207('0xb4')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xb5'));db[_0xc207('0xb6')]=db['sequelize'][_0xc207('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xc207('0xb7')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xb8'));db['ZendeskField']=db[_0xc207('0x1')][_0xc207('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xc207('0xb9')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xba'));db['FreshdeskConfiguration']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xbb'));db[_0xc207('0xbc')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xbd'));db[_0xc207('0xbe')]=db['sequelize']['import'](_0xc207('0xbf'));db['VtigerField']=db['sequelize'][_0xc207('0x13')](_0xc207('0xc0'));db[_0xc207('0xc1')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xc207('0xc2')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xc3'));db[_0xc207('0xc4')]=db['sequelize']['import'](_0xc207('0xc5'));db[_0xc207('0xc6')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xc207('0x1')]['import'](_0xc207('0xc7'));db[_0xc207('0xc8')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xc9'));db['FreshsalesAccount']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xca'));db[_0xc207('0xcb')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xcc'));db[_0xc207('0xcd')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xc207('0x98')]=db['sequelize']['import'](_0xc207('0xce'));db[_0xc207('0xcf')]=db['sequelize']['import'](_0xc207('0xd0'));db[_0xc207('0xd1')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xc207('0xd2')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xd3'));db[_0xc207('0xd4')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xd5'));db['JscriptyQuestionReport']=db[_0xc207('0x1')][_0xc207('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize']['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xc207('0xd6')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xc207('0xd7')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xd8'));db[_0xc207('0xd9')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xda'));db['JscriptyProject']=db[_0xc207('0x1')]['import'](_0xc207('0xdb'));db['Setting']=db[_0xc207('0x1')]['import'](_0xc207('0xdc'));db[_0xc207('0xdd')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xde'));db[_0xc207('0xdf')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xe0'));db[_0xc207('0xe1')]=db[_0xc207('0x1')]['import'](_0xc207('0xe2'));db[_0xc207('0xe3')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xe4'));db[_0xc207('0xe5')]=db[_0xc207('0x1')]['import'](_0xc207('0xe6'));db[_0xc207('0xe7')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/license/license.model');db[_0xc207('0xe8')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xe9'));db[_0xc207('0xea')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xeb'));db[_0xc207('0xec')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xed'));db[_0xc207('0xee')]=db[_0xc207('0x1')]['import'](_0xc207('0xef'));db[_0xc207('0xf0')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xf1'));db[_0xc207('0xf2')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xf3'));db[_0xc207('0xf4')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xf5'));db[_0xc207('0xf6')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xf7'));db[_0xc207('0xf8')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xf9'));db[_0xc207('0xfa')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/cmList/cmList.model');db[_0xc207('0xfb')]=db['sequelize']['import'](_0xc207('0xfc'));db[_0xc207('0xfd')]=db['sequelize'][_0xc207('0x13')](_0xc207('0xfe'));db['UserProfileSection']=db[_0xc207('0x1')][_0xc207('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0xff'));db[_0xc207('0x100')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x101'));db[_0xc207('0x102')]=db['sequelize'][_0xc207('0x13')](_0xc207('0x103'));db[_0xc207('0x104')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x105'));db[_0xc207('0x106')]=db[_0xc207('0x1')][_0xc207('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xc207('0x107')]=db['sequelize']['import'](_0xc207('0x108'));db[_0xc207('0x109')]=db[_0xc207('0x1')][_0xc207('0x13')](_0xc207('0x10a'));db['WhatsappTransferReport']=db[_0xc207('0x1')][_0xc207('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0xc207('0x1')]['import'](_0xc207('0x10b'));db[_0xc207('0x10c')]=db[_0xc207('0x1')]['import'](_0xc207('0x10d'));db[_0xc207('0x10e')][_0xc207('0x10f')](db[_0xc207('0x21')],{'as':'VoiceMail','onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x111')});db['User'][_0xc207('0x112')](db[_0xc207('0x1e')],{'as':'Recordings','foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x30')],{'as':_0xc207('0x113'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x114')],{'as':'Extensions','onDelete':_0xc207('0x110'),'hooks':!![]});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x115')],{'as':_0xc207('0x116'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x7f')],{'as':_0xc207('0x117'),'foreignKey':_0xc207('0x111')});db['User'][_0xc207('0x112')](db['ReportAgentPreview'],{'as':_0xc207('0x81'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x6b')],{'as':_0xc207('0x118'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x5b')],{'as':_0xc207('0x119'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x11a')],{'as':_0xc207('0x11b'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x46')],{'as':_0xc207('0x11c'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x10e')]['hasMany'](db[_0xc207('0x106')],{'as':_0xc207('0x11d'),'foreignKey':'UserId'});db[_0xc207('0x10e')][_0xc207('0x112')](db[_0xc207('0x100')],{'as':'Notifications','foreignKey':_0xc207('0x11e')});db[_0xc207('0x10e')][_0xc207('0x11f')](db[_0xc207('0xfd')],{'as':_0xc207('0xfd'),'foreignKey':_0xc207('0x120')});db[_0xc207('0x10e')][_0xc207('0x121')](db['ChatGroup'],{'as':_0xc207('0x122'),'through':_0xc207('0x123')});db[_0xc207('0x10e')][_0xc207('0x121')](db['CmContact'],{'as':_0xc207('0x124'),'through':'cm_user_has_contacts'});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0xfa')],{'as':'Lists','through':_0xc207('0x125')});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0xe5')],{'through':_0xc207('0x126')});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0x46')],{'as':_0xc207('0x11c'),'through':_0xc207('0x127')});db[_0xc207('0x10e')]['belongsToMany'](db['ChatInteraction'],{'as':_0xc207('0x118'),'through':_0xc207('0x128')});db[_0xc207('0x10e')]['belongsToMany'](db[_0xc207('0x11a')],{'as':_0xc207('0x11b'),'through':_0xc207('0x129')});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0x5b')],{'as':_0xc207('0x119'),'through':'user_has_sms_interactions'});db[_0xc207('0x10e')][_0xc207('0x121')](db['OpenchannelInteraction'],{'as':_0xc207('0x12a'),'through':'user_has_openchannel_interactions'});db[_0xc207('0x10e')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0x1c')],{'as':'VoiceQueues','through':_0xc207('0x32'),'required':![]});db[_0xc207('0x10e')]['belongsToMany'](db[_0xc207('0x43')],{'as':_0xc207('0x12b'),'through':_0xc207('0x35'),'required':![]});db['User'][_0xc207('0x121')](db['ChatQueue'],{'as':_0xc207('0x12c'),'through':_0xc207('0x34'),'required':![],'hooks':!![]});db['User'][_0xc207('0x121')](db['FaxQueue'],{'as':_0xc207('0x12d'),'through':'UserFaxQueue','required':![]});db['User'][_0xc207('0x121')](db[_0xc207('0x5f')],{'as':_0xc207('0x12e'),'through':_0xc207('0x39'),'required':![]});db['User']['belongsToMany'](db[_0xc207('0x64')],{'as':_0xc207('0x12f'),'through':_0xc207('0x3b'),'required':![]});db[_0xc207('0x10e')][_0xc207('0x121')](db['WhatsappQueue'],{'as':_0xc207('0x130'),'through':'UserWhatsappQueue','required':![]});db['User'][_0xc207('0x121')](db[_0xc207('0xfa')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0xc207('0xfb')],{'as':_0xc207('0x131'),'through':_0xc207('0x132'),'required':![]});db[_0xc207('0x10e')]['belongsToMany'](db[_0xc207('0x66')],{'as':_0xc207('0x133'),'through':'user_has_chat_websites'});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0x4e')],{'as':_0xc207('0x134'),'through':_0xc207('0x135')});db[_0xc207('0x10e')][_0xc207('0x121')](db[_0xc207('0x41')],{'as':_0xc207('0x136'),'through':'user_has_mail_accounts'});db['User'][_0xc207('0x121')](db[_0xc207('0x61')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xc207('0x10e')]['belongsToMany'](db[_0xc207('0x137')],{'as':_0xc207('0x138'),'through':'user_has_sms_accounts'});db[_0xc207('0x10e')][_0xc207('0x121')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xc207('0x139')});db[_0xc207('0x10e')][_0xc207('0x121')](db['SquareProject'],{'as':_0xc207('0x13a'),'through':_0xc207('0x13b')});db[_0xc207('0x15')][_0xc207('0x112')](db['VoiceExtension'],{'as':_0xc207('0x13c'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x13d')});db[_0xc207('0x17')][_0xc207('0x112')](db[_0xc207('0x114')],{'onDelete':_0xc207('0x110')});db[_0xc207('0x114')]['hasMany'](db[_0xc207('0x114')],{'as':'Applications','onDelete':_0xc207('0x110')});db[_0xc207('0x1a')][_0xc207('0x121')](db['Sound'],{'as':_0xc207('0x13e'),'through':_0xc207('0x13f')});db['VoiceQueue']['hasMany'](db['UserVoiceQueueRt'],{'as':_0xc207('0x140'),'foreignKey':_0xc207('0x141')});db[_0xc207('0x1c')][_0xc207('0x112')](db[_0xc207('0x7a')],{'as':_0xc207('0x142'),'foreignKey':_0xc207('0x141')});db[_0xc207('0x1c')][_0xc207('0x112')](db[_0xc207('0x115')],{'as':_0xc207('0x116'),'foreignKey':_0xc207('0x141')});db[_0xc207('0x1c')][_0xc207('0x112')](db[_0xc207('0x7f')],{'as':_0xc207('0x143'),'foreignKey':_0xc207('0x141')});db[_0xc207('0x1c')][_0xc207('0x112')](db[_0xc207('0x81')],{'as':'ReportAgentPreview','foreignKey':_0xc207('0x141')});db[_0xc207('0x1c')][_0xc207('0x112')](db['CmHopperBlack'],{'as':_0xc207('0x144'),'foreignKey':'VoiceQueueId'});db[_0xc207('0x1c')][_0xc207('0x112')](db[_0xc207('0x145')],{'as':_0xc207('0x146'),'foreignKey':_0xc207('0x141')});db['VoiceQueue'][_0xc207('0x11f')](db[_0xc207('0x2d')],{'as':_0xc207('0x2d'),'foreignKey':_0xc207('0x147')});db['VoiceQueue']['belongsTo'](db[_0xc207('0x2d')],{'as':_0xc207('0x148'),'foreignKey':_0xc207('0x149')});db[_0xc207('0x1c')][_0xc207('0x11f')](db[_0xc207('0x89')],{'as':_0xc207('0x89'),'foreignKey':_0xc207('0x14a')});db[_0xc207('0x1c')][_0xc207('0x11f')](db[_0xc207('0x8b')],{'as':_0xc207('0x14b'),'foreignKey':_0xc207('0x14c')});db[_0xc207('0x1c')]['belongsToMany'](db['CmList'],{'as':_0xc207('0x14d'),'through':_0xc207('0x14e')});db[_0xc207('0x1c')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db['Team'],{'as':_0xc207('0x150'),'through':'team_has_voice_queues'});db[_0xc207('0x1c')][_0xc207('0x121')](db[_0xc207('0xfa')],{'as':_0xc207('0x151'),'through':_0xc207('0x152')});db[_0xc207('0x1e')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'as':_0xc207('0x10e'),'foreignKey':'UserId'});db['ScreenRecording'][_0xc207('0x11f')](db['User'],{'as':_0xc207('0x10e'),'foreignKey':'UserId'});db[_0xc207('0x21')][_0xc207('0x112')](db[_0xc207('0x23')],{'as':_0xc207('0x153'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xc207('0x154')});db[_0xc207('0x23')]['belongsTo'](db[_0xc207('0x21')],{'foreignKey':_0xc207('0x155'),'targetKey':_0xc207('0x154')});db['VoiceCallReport'][_0xc207('0x112')](db[_0xc207('0x29')],{'as':_0xc207('0x156'),'foreignKey':_0xc207('0x157'),'constraints':![]});db['VoiceCallReport'][_0xc207('0x112')](db[_0xc207('0x27')],{'as':_0xc207('0x158'),'foreignKey':_0xc207('0x157'),'constraints':![]});db[_0xc207('0x25')]['belongsTo'](db[_0xc207('0x10e')],{'as':_0xc207('0x10e'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x25')]['belongsTo'](db[_0xc207('0x78')],{'as':'Contact','foreignKey':_0xc207('0x159')});db[_0xc207('0x3e')]['belongsTo'](db[_0xc207('0x41')],{'as':_0xc207('0x41'),'foreignKey':_0xc207('0x15a')});db['MailServerOut'][_0xc207('0x11f')](db[_0xc207('0x41')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailAccount']['hasOne'](db[_0xc207('0x3e')],{'as':_0xc207('0x15b'),'onDelete':_0xc207('0x110')});db['MailAccount']['hasOne'](db['MailServerOut'],{'as':_0xc207('0x15c'),'onDelete':'cascade'});db[_0xc207('0x41')][_0xc207('0x112')](db[_0xc207('0x15d')],{'as':'Dispositions','foreignKey':_0xc207('0x15a')});db[_0xc207('0x41')][_0xc207('0x112')](db[_0xc207('0x15e')],{'as':'Answers','foreignKey':_0xc207('0x15a')});db['MailAccount']['hasMany'](db[_0xc207('0x15f')],{'as':_0xc207('0x153'),'foreignKey':_0xc207('0x15a')});db[_0xc207('0x41')][_0xc207('0x112')](db[_0xc207('0x46')],{'as':_0xc207('0x160')});db[_0xc207('0x41')][_0xc207('0x112')](db['MailApplication'],{'as':_0xc207('0x161')});db['MailAccount'][_0xc207('0x11f')](db['CmList'],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0x41')][_0xc207('0x11f')](db[_0xc207('0x95')],{'as':_0xc207('0x95'),'foreignKey':_0xc207('0x164')});db[_0xc207('0x41')]['belongsTo'](db['Pause'],{'as':_0xc207('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc207('0x41')]['belongsToMany'](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':'user_has_mail_accounts'});db[_0xc207('0x43')][_0xc207('0x121')](db['User'],{'as':_0xc207('0x14f'),'through':_0xc207('0x35')});db['MailQueue'][_0xc207('0x121')](db['Team'],{'through':_0xc207('0x165'),'as':_0xc207('0x150')});db[_0xc207('0x46')]['hasMany'](db[_0xc207('0x15f')],{'as':_0xc207('0x153'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x166')});db[_0xc207('0x46')]['belongsTo'](db[_0xc207('0x41')],{'as':'Account','foreignKey':_0xc207('0x15a')});db['MailInteraction'][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x46')]['belongsTo'](db[_0xc207('0x10e')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x168'),'as':_0xc207('0x169')});db[_0xc207('0x46')][_0xc207('0x121')](db['Tag'],{'through':_0xc207('0x168'),'as':_0xc207('0x16a')});db[_0xc207('0x46')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x16b'),'through':_0xc207('0x127'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0xc207('0x16c'),'onDelete':'cascade'});db[_0xc207('0x15f')]['belongsTo'](db['User'],{'as':_0xc207('0x10e')});db['MailMessage'][_0xc207('0x11f')](db[_0xc207('0x78')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x167')});db[_0xc207('0x15f')][_0xc207('0x11f')](db[_0xc207('0x46')],{'as':_0xc207('0x16d'),'foreignKey':'MailInteractionId'});db[_0xc207('0x15f')][_0xc207('0x11f')](db[_0xc207('0x41')],{'as':'Account','foreignKey':_0xc207('0x15a')});db[_0xc207('0x16e')][_0xc207('0x11f')](db['User'],{'onDelete':_0xc207('0x16f')});db[_0xc207('0x16e')][_0xc207('0x11f')](db[_0xc207('0x43')],{'onDelete':'restrict'});db[_0xc207('0x16e')]['belongsTo'](db[_0xc207('0x41')],{'onDelete':_0xc207('0x16f')});db['MailApplication'][_0xc207('0x11f')](db[_0xc207('0x89')],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x14a')});db[_0xc207('0x16e')][_0xc207('0x11f')](db[_0xc207('0x93')],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x170')});db['MailQueueReport'][_0xc207('0x11f')](db['MailAccount'],{});db[_0xc207('0x49')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0x49')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':'ContactId'});db[_0xc207('0x49')][_0xc207('0x11f')](db[_0xc207('0x46')],{});db[_0xc207('0x49')][_0xc207('0x11f')](db[_0xc207('0x15f')],{});db['MailQueueReport'][_0xc207('0x11f')](db[_0xc207('0x10e')],{});db['MailQueueReport'][_0xc207('0x11f')](db[_0xc207('0x43')],{});db[_0xc207('0x4b')][_0xc207('0x112')](db[_0xc207('0x4c')],{'as':_0xc207('0x171'),'onDelete':_0xc207('0x110')});db['FaxAccount'][_0xc207('0x112')](db['Disposition'],{'as':_0xc207('0x172'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xc207('0x112')](db[_0xc207('0x15e')],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0xc207('0x160')});db[_0xc207('0x4e')][_0xc207('0x112')](db[_0xc207('0x50')],{'as':_0xc207('0x161')});db[_0xc207('0x4e')][_0xc207('0x112')](db[_0xc207('0x114')],{'as':_0xc207('0x173'),'onDelete':_0xc207('0x110')});db['FaxAccount'][_0xc207('0x112')](db[_0xc207('0x53')],{'as':_0xc207('0x153')});db[_0xc207('0x4e')]['belongsTo'](db['Trunk'],{'as':_0xc207('0x2d')});db[_0xc207('0x4e')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0x4e')][_0xc207('0x11f')](db[_0xc207('0x8b')],{'as':_0xc207('0x14b'),'foreignKey':_0xc207('0x14c')});db[_0xc207('0x4e')]['belongsToMany'](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x135')});db['FaxApplication'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':'restrict'});db['FaxApplication'][_0xc207('0x11f')](db[_0xc207('0x55')],{'onDelete':_0xc207('0x16f')});db[_0xc207('0x50')][_0xc207('0x11f')](db[_0xc207('0x4e')],{'onDelete':_0xc207('0x16f')});db['FaxApplication'][_0xc207('0x11f')](db['Tag'],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x170')});db[_0xc207('0x11a')][_0xc207('0x112')](db[_0xc207('0x53')],{'as':'Messages','onDelete':_0xc207('0x110'),'foreignKey':'FaxInteractionId'});db[_0xc207('0x11a')][_0xc207('0x11f')](db[_0xc207('0x4e')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xc207('0x11a')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':'ContactId'});db[_0xc207('0x11a')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'as':_0xc207('0x174'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x11a')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x175'),'as':_0xc207('0x169')});db[_0xc207('0x11a')]['belongsToMany'](db[_0xc207('0x93')],{'through':_0xc207('0x175'),'as':_0xc207('0x16a')});db[_0xc207('0x11a')][_0xc207('0x121')](db['User'],{'as':_0xc207('0x16b'),'through':'user_has_fax_interactions','foreignKey':_0xc207('0x176')});db[_0xc207('0x53')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x10e')});db['FaxMessage'][_0xc207('0x11f')](db[_0xc207('0x11a')],{'as':'Interaction','foreignKey':_0xc207('0x176')});db[_0xc207('0x53')][_0xc207('0x11f')](db[_0xc207('0x78')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x167')});db[_0xc207('0x53')][_0xc207('0x11f')](db[_0xc207('0xec')],{'as':_0xc207('0xec'),'foreignKey':_0xc207('0x177')});db[_0xc207('0x53')][_0xc207('0x11f')](db['FaxAccount'],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x179')});db['FaxQueue'][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x37')});db[_0xc207('0x55')]['belongsToMany'](db[_0xc207('0xe5')],{'through':'team_has_fax_queues','as':_0xc207('0x150')});db[_0xc207('0x57')]['belongsTo'](db[_0xc207('0x4e')],{});db['FaxQueueReport'][_0xc207('0x11f')](db['CmList'],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0x57')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x57')]['belongsTo'](db[_0xc207('0x11a')],{});db[_0xc207('0x57')][_0xc207('0x11f')](db[_0xc207('0x53')],{});db[_0xc207('0x57')]['belongsTo'](db[_0xc207('0x10e')],{});db[_0xc207('0x57')]['belongsTo'](db[_0xc207('0x55')],{});db[_0xc207('0x137')][_0xc207('0x112')](db[_0xc207('0x15d')],{'as':_0xc207('0x172'),'foreignKey':_0xc207('0x17a')});db[_0xc207('0x137')][_0xc207('0x112')](db[_0xc207('0x15e')],{'as':_0xc207('0x17b'),'foreignKey':'SmsAccountId'});db[_0xc207('0x137')]['hasMany'](db['SmsMessage'],{'as':_0xc207('0x153'),'foreignKey':_0xc207('0x17a')});db[_0xc207('0x137')][_0xc207('0x112')](db[_0xc207('0x5b')],{'as':_0xc207('0x160')});db[_0xc207('0x137')][_0xc207('0x112')](db[_0xc207('0x59')],{'as':_0xc207('0x161')});db[_0xc207('0x137')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':'ListId'});db['SmsAccount'][_0xc207('0x11f')](db[_0xc207('0x8b')],{'as':'mandatoryDispositionPause','foreignKey':_0xc207('0x14c')});db[_0xc207('0x137')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x17c')});db['SmsApplication'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x16f')});db['SmsApplication'][_0xc207('0x11f')](db[_0xc207('0x5f')],{'onDelete':'restrict'});db[_0xc207('0x59')][_0xc207('0x11f')](db[_0xc207('0x137')],{'onDelete':_0xc207('0x16f')});db[_0xc207('0x59')][_0xc207('0x11f')](db[_0xc207('0x89')],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x14a')});db[_0xc207('0x59')][_0xc207('0x11f')](db[_0xc207('0x93')],{'onDelete':_0xc207('0x16f'),'foreignKey':'TagId'});db[_0xc207('0x5b')]['hasMany'](db[_0xc207('0x5d')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc207('0x17d')});db[_0xc207('0x5b')]['belongsTo'](db[_0xc207('0x137')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x17a')});db[_0xc207('0x5b')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db['SmsInteraction'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'as':_0xc207('0x174'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x5b')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x17e'),'as':'Tags'});db[_0xc207('0x5b')]['belongsToMany'](db[_0xc207('0x93')],{'through':_0xc207('0x17e'),'as':_0xc207('0x16a')});db['SmsInteraction'][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x16b'),'through':_0xc207('0x17f'),'foreignKey':_0xc207('0x17d')});db['SmsMessage']['belongsTo'](db[_0xc207('0x10e')],{'as':_0xc207('0x10e')});db[_0xc207('0x5d')][_0xc207('0x11f')](db[_0xc207('0x78')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x167')});db[_0xc207('0x5d')][_0xc207('0x11f')](db[_0xc207('0x5b')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x16d'),'foreignKey':_0xc207('0x17d')});db[_0xc207('0x5d')][_0xc207('0x11f')](db['SmsAccount'],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x17a')});db[_0xc207('0x5f')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x39'),'foreignKey':_0xc207('0x180')});db[_0xc207('0x5f')][_0xc207('0x121')](db[_0xc207('0xe5')],{'through':_0xc207('0x181'),'as':_0xc207('0x150')});db[_0xc207('0x61')][_0xc207('0x112')](db[_0xc207('0x15d')],{'as':_0xc207('0x172'),'foreignKey':_0xc207('0x182')});db['OpenchannelAccount']['hasMany'](db[_0xc207('0x15e')],{'as':'Answers','foreignKey':_0xc207('0x182')});db[_0xc207('0x61')][_0xc207('0x112')](db[_0xc207('0x183')],{'as':_0xc207('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0xc207('0x61')]['hasMany'](db[_0xc207('0x184')],{'as':_0xc207('0x153'),'foreignKey':_0xc207('0x182')});db[_0xc207('0x61')][_0xc207('0x112')](db[_0xc207('0x62')],{'as':'Applications','foreignKey':_0xc207('0x182')});db[_0xc207('0x61')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0x61')]['belongsTo'](db['Pause'],{'as':_0xc207('0x14b'),'foreignKey':_0xc207('0x14c')});db[_0xc207('0x61')][_0xc207('0x121')](db['User'],{'as':'Agents','through':_0xc207('0x185')});db['OpenchannelApplication'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x16f')});db[_0xc207('0x62')]['belongsTo'](db[_0xc207('0x64')],{'onDelete':'restrict','foreignKey':_0xc207('0x186')});db[_0xc207('0x62')]['belongsTo'](db[_0xc207('0x61')],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x182')});db[_0xc207('0x62')][_0xc207('0x11f')](db[_0xc207('0x89')],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x14a')});db[_0xc207('0x62')][_0xc207('0x11f')](db[_0xc207('0x93')],{'onDelete':'restrict','foreignKey':_0xc207('0x170')});db[_0xc207('0x183')][_0xc207('0x112')](db[_0xc207('0x184')],{'as':'Messages','onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x187')});db[_0xc207('0x183')]['belongsTo'](db[_0xc207('0x61')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x182')});db[_0xc207('0x183')][_0xc207('0x11f')](db['CmContact'],{'as':_0xc207('0x167'),'foreignKey':'ContactId'});db[_0xc207('0x183')]['belongsTo'](db[_0xc207('0x10e')],{'as':'Owner','foreignKey':_0xc207('0x111')});db[_0xc207('0x183')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x188'),'as':'Tags'});db[_0xc207('0x183')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x188'),'as':_0xc207('0x16a')});db[_0xc207('0x183')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x16b'),'through':_0xc207('0x189'),'foreignKey':_0xc207('0x187')});db['OpenchannelMessage'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x10e')});db['OpenchannelMessage'][_0xc207('0x11f')](db['CmContact'],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x167')});db['OpenchannelMessage'][_0xc207('0x11f')](db[_0xc207('0x183')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x16d'),'foreignKey':_0xc207('0x187')});db[_0xc207('0x184')]['belongsTo'](db['Attachment'],{'as':_0xc207('0xec'),'foreignKey':_0xc207('0x177')});db['OpenchannelMessage'][_0xc207('0x11f')](db[_0xc207('0x61')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x182')});db[_0xc207('0x64')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x3b'),'foreignKey':_0xc207('0x186')});db['OpenchannelQueue'][_0xc207('0x121')](db[_0xc207('0xe5')],{'through':_0xc207('0x18a'),'as':_0xc207('0x150')});db[_0xc207('0x66')]['hasMany'](db[_0xc207('0x15d')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0xc207('0x66')][_0xc207('0x112')](db[_0xc207('0x15e')],{'as':_0xc207('0x17b'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xc207('0x112')](db[_0xc207('0x18b')],{'as':'ProactiveActions'});db[_0xc207('0x66')][_0xc207('0x112')](db['ChatInteraction'],{'as':_0xc207('0x160')});db[_0xc207('0x66')][_0xc207('0x112')](db[_0xc207('0x18c')],{'as':_0xc207('0x161')});db[_0xc207('0x66')]['hasMany'](db['ChatMessage'],{'as':_0xc207('0x153')});db[_0xc207('0x66')]['belongsTo'](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db['ChatWebsite'][_0xc207('0x11f')](db[_0xc207('0x89')],{'as':_0xc207('0x89'),'foreignKey':'IntervalId'});db[_0xc207('0x66')][_0xc207('0x11f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc207('0x66')]['belongsToMany'](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xc207('0x11f')](db[_0xc207('0x61')],{});db[_0xc207('0x68')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db['OpenchannelQueueReport'][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':'Contact','foreignKey':_0xc207('0x159')});db['OpenchannelQueueReport'][_0xc207('0x11f')](db['OpenchannelInteraction'],{});db[_0xc207('0x68')][_0xc207('0x11f')](db[_0xc207('0x184')],{});db[_0xc207('0x68')][_0xc207('0x11f')](db[_0xc207('0x10e')],{});db[_0xc207('0x68')]['belongsTo'](db[_0xc207('0x64')],{});db[_0xc207('0x18c')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'as':'Agent','foreignKey':_0xc207('0x111'),'onDelete':'restrict'});db['ChatApplication'][_0xc207('0x11f')](db['ChatQueue'],{'as':'Queue','foreignKey':_0xc207('0x18d'),'onDelete':_0xc207('0x16f')});db[_0xc207('0x18c')][_0xc207('0x11f')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xc207('0x18e'),'onDelete':_0xc207('0x16f')});db[_0xc207('0x18c')]['belongsTo'](db['Tag'],{'onDelete':_0xc207('0x16f'),'foreignKey':'TagId'});db[_0xc207('0x6b')][_0xc207('0x112')](db['ChatMessage'],{'as':_0xc207('0x153'),'onDelete':_0xc207('0x110'),'foreignKey':'ChatInteractionId'});db[_0xc207('0x6b')][_0xc207('0x11f')](db[_0xc207('0x66')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x18e')});db[_0xc207('0x6b')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x6b')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'as':_0xc207('0x174'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x6b')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':'chat_interaction_has_tags','as':_0xc207('0x169')});db[_0xc207('0x6b')]['belongsToMany'](db[_0xc207('0x93')],{'through':_0xc207('0x18f'),'as':_0xc207('0x16a')});db[_0xc207('0x6b')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x16b'),'through':_0xc207('0x128'),'foreignKey':_0xc207('0x190')});db[_0xc207('0x6d')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':'cascade','as':_0xc207('0x10e')});db[_0xc207('0x6d')]['belongsTo'](db[_0xc207('0x78')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x6d')][_0xc207('0x11f')](db[_0xc207('0x6b')],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x16d'),'foreignKey':_0xc207('0x190')});db[_0xc207('0x6d')][_0xc207('0x11f')](db['Attachment'],{'as':'Attachment','foreignKey':_0xc207('0x177')});db['ChatMessage'][_0xc207('0x11f')](db[_0xc207('0x66')],{'as':_0xc207('0x178'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xc207('0x11f')](db['CmContact'],{'onDelete':_0xc207('0x110'),'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x6f')][_0xc207('0x11f')](db[_0xc207('0x66')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x18e')});db[_0xc207('0x71')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':'Agents','through':_0xc207('0x34'),'hooks':!![]});db['ChatQueue'][_0xc207('0x121')](db['Team'],{'through':_0xc207('0x191'),'as':'Teams'});db[_0xc207('0x73')][_0xc207('0x112')](db[_0xc207('0xd2')],{'as':_0xc207('0x153'),'foreignKey':_0xc207('0x192'),'onDelete':_0xc207('0x110')});db[_0xc207('0x73')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':'Members','through':_0xc207('0x123')});db[_0xc207('0x18b')]['belongsTo'](db[_0xc207('0x66')],{'as':_0xc207('0x193'),'foreignKey':_0xc207('0x18e')});db[_0xc207('0x76')][_0xc207('0x112')](db[_0xc207('0x78')],{'as':_0xc207('0x124'),'foreignKey':_0xc207('0x194')});db[_0xc207('0x78')][_0xc207('0x112')](db['CmHopper'],{'as':_0xc207('0x142'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x78')][_0xc207('0x112')](db[_0xc207('0x115')],{'as':'HopperFinals','foreignKey':_0xc207('0x159')});db[_0xc207('0x78')][_0xc207('0x112')](db[_0xc207('0x7f')],{'as':_0xc207('0x143'),'foreignKey':_0xc207('0x159')});db['CmContact'][_0xc207('0x112')](db[_0xc207('0x81')],{'as':_0xc207('0x81'),'foreignKey':'ContactId'});db['CmContact'][_0xc207('0x112')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xc207('0x159')});db[_0xc207('0x78')][_0xc207('0x112')](db[_0xc207('0x183')],{'as':_0xc207('0x12a'),'foreignKey':'ContactId','onDelete':_0xc207('0x16f')});db[_0xc207('0x78')]['hasMany'](db['ChatInteraction'],{'as':_0xc207('0x118'),'foreignKey':_0xc207('0x159'),'onDelete':'restrict'});db[_0xc207('0x78')][_0xc207('0x112')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0xc207('0x16f')});db[_0xc207('0x78')][_0xc207('0x112')](db[_0xc207('0x11a')],{'as':'FaxInteractions','foreignKey':_0xc207('0x159'),'onDelete':_0xc207('0x16f')});db[_0xc207('0x78')][_0xc207('0x112')](db[_0xc207('0x46')],{'as':_0xc207('0x11c'),'foreignKey':_0xc207('0x159'),'onDelete':_0xc207('0x16f')});db[_0xc207('0x78')][_0xc207('0x11f')](db['CmCompany'],{'as':_0xc207('0x195'),'foreignKey':_0xc207('0x194')});db[_0xc207('0x78')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163'),'onDelete':_0xc207('0x110')});db[_0xc207('0x78')][_0xc207('0x121')](db['User'],{'as':_0xc207('0x16b'),'through':_0xc207('0x196')});db[_0xc207('0x78')][_0xc207('0x121')](db[_0xc207('0x93')],{'as':'Tags','through':_0xc207('0x197')});db[_0xc207('0x78')][_0xc207('0x121')](db['Tag'],{'through':'cm_contact_has_tags','as':_0xc207('0x16a')});db[_0xc207('0x7a')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':'ContactId','onDelete':_0xc207('0x110')});db['CmHopper'][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':'ListId','onDelete':_0xc207('0x110')});db[_0xc207('0x7a')][_0xc207('0x11f')](db['User'],{'as':_0xc207('0x198'),'foreignKey':_0xc207('0x111')});db[_0xc207('0x7a')][_0xc207('0x11f')](db[_0xc207('0x1c')],{'as':_0xc207('0x199'),'foreignKey':_0xc207('0x141'),'onDelete':'cascade'});db[_0xc207('0x7a')][_0xc207('0x11f')](db[_0xc207('0xe8')],{'as':_0xc207('0xe8'),'foreignKey':_0xc207('0x19a'),'onDelete':_0xc207('0x110')});db[_0xc207('0x7a')]['belongsTo'](db[_0xc207('0x10e')],{'as':_0xc207('0x174'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db['CmContact'],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159'),'onDelete':_0xc207('0x110')});db[_0xc207('0x7c')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':'List','foreignKey':_0xc207('0x163'),'onDelete':_0xc207('0x110')});db['CmHopperBlack'][_0xc207('0x11f')](db[_0xc207('0x1c')],{'as':_0xc207('0x199'),'foreignKey':_0xc207('0x141'),'onDelete':_0xc207('0x110')});db[_0xc207('0x7c')][_0xc207('0x11f')](db[_0xc207('0xe8')],{'as':_0xc207('0xe8'),'foreignKey':'CampaignId','onDelete':_0xc207('0x110')});db[_0xc207('0x86')]['hasMany'](db['Condition'],{'as':{'plural':_0xc207('0x19b'),'singular':'OneAll'},'foreignKey':_0xc207('0x19c'),'onDelete':_0xc207('0x110'),'hooks':!![]});db[_0xc207('0x86')][_0xc207('0x112')](db[_0xc207('0x19d')],{'as':{'plural':_0xc207('0x19e'),'singular':_0xc207('0x19f')},'foreignKey':'AutomationAnyId','onDelete':_0xc207('0x110'),'hooks':!![]});db[_0xc207('0x86')][_0xc207('0x112')](db['Action'],{'as':_0xc207('0x1a0'),'foreignKey':'AutomationId','onDelete':_0xc207('0x110'),'hooks':!![]});db[_0xc207('0x89')]['hasMany'](db[_0xc207('0x89')],{'as':_0xc207('0x1a1'),'foreignKey':'IntervalId','onDelete':_0xc207('0x110'),'hooks':!![],'required':![]});db[_0xc207('0x89')][_0xc207('0x112')](db[_0xc207('0x114')],{'as':_0xc207('0x1a2'),'foreignKey':_0xc207('0x14a'),'onDelete':_0xc207('0x16f')});db['Interval'][_0xc207('0x112')](db[_0xc207('0x16e')],{'as':_0xc207('0x1a3'),'foreignKey':_0xc207('0x14a')});db[_0xc207('0x89')][_0xc207('0x112')](db[_0xc207('0x18c')],{'as':_0xc207('0x1a4'),'foreignKey':_0xc207('0x14a')});db['Interval'][_0xc207('0x112')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xc207('0x14a')});db[_0xc207('0x89')][_0xc207('0x112')](db[_0xc207('0x59')],{'as':_0xc207('0x1a5'),'foreignKey':_0xc207('0x14a')});db[_0xc207('0x90')]['belongsTo'](db[_0xc207('0x41')],{});db[_0xc207('0x90')][_0xc207('0x11f')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0xc207('0x90')][_0xc207('0x11f')](db[_0xc207('0x1a6')],{'foreignKey':'CustomReportId'});db[_0xc207('0x1a7')][_0xc207('0x121')](db[_0xc207('0x1a')],{'as':_0xc207('0x1a8'),'through':_0xc207('0x13f'),'onDelete':_0xc207('0x16f')});db[_0xc207('0x93')][_0xc207('0x121')](db['CmContact'],{'through':_0xc207('0x197')});db[_0xc207('0x93')][_0xc207('0x121')](db[_0xc207('0x6b')],{'through':_0xc207('0x18f')});db['Tag'][_0xc207('0x121')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc207('0x93')][_0xc207('0x121')](db[_0xc207('0x5b')],{'through':'sms_interaction_has_tags'});db[_0xc207('0x93')]['belongsToMany'](db[_0xc207('0x11a')],{'through':_0xc207('0x175')});db[_0xc207('0x93')][_0xc207('0x121')](db[_0xc207('0x183')],{'through':_0xc207('0x188')});db[_0xc207('0x93')]['belongsToMany'](db[_0xc207('0x106')],{'through':_0xc207('0x1a9')});db[_0xc207('0x96')][_0xc207('0x112')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0xc207('0x1aa'),'onDelete':_0xc207('0x110'),'hooks':!![]});db['Trigger'][_0xc207('0x112')](db['Condition'],{'as':{'plural':_0xc207('0x1ab'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0xc207('0x110'),'hooks':!![]});db[_0xc207('0x96')]['hasMany'](db[_0xc207('0x85')],{'as':_0xc207('0x1a0'),'foreignKey':_0xc207('0x1ac'),'onDelete':_0xc207('0x110'),'hooks':!![]});db[_0xc207('0x1a6')][_0xc207('0x112')](db['AnalyticFieldReport'],{'as':_0xc207('0x1ad'),'onDelete':'cascade','foreignKey':_0xc207('0x1ae'),'hooks':!![]});db[_0xc207('0x9c')][_0xc207('0x112')](db[_0xc207('0x1af')],{'as':_0xc207('0x1ad'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b0')});db[_0xc207('0x9f')][_0xc207('0x112')](db[_0xc207('0x1af')],{'as':_0xc207('0x1ad'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b1')});db[_0xc207('0x1af')][_0xc207('0x11f')](db[_0xc207('0x9f')],{'foreignKey':_0xc207('0x1b1')});db[_0xc207('0x1b2')][_0xc207('0x112')](db[_0xc207('0xa4')],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xa4')]['hasMany'](db[_0xc207('0x1b5')],{'as':'Subjects','onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0xa4')][_0xc207('0x112')](db[_0xc207('0x1b5')],{'as':_0xc207('0x1b7'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0xa4')][_0xc207('0x112')](db['SalesforceField'],{'as':_0xc207('0x1ad'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xa4')][_0xc207('0x11f')](db['SalesforceAccount'],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db['SalesforceField']['hasMany'](db[_0xc207('0x1b5')],{'as':_0xc207('0x1ba'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0x1b5')][_0xc207('0x112')](db[_0xc207('0x1b5')],{'as':'Description','foreignKey':_0xc207('0x1b8')});db['SalesforceField'][_0xc207('0x112')](db[_0xc207('0x1b5')],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db['SalesforceField'][_0xc207('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0xc207('0x1bc')});db[_0xc207('0xa7')][_0xc207('0x112')](db['SugarcrmConfiguration'],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xa8')][_0xc207('0x112')](db[_0xc207('0xaa')],{'as':_0xc207('0x1bd'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0xa8')]['hasMany'](db['SugarcrmField'],{'as':_0xc207('0x1b7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xc207('0xa8')][_0xc207('0x112')](db[_0xc207('0xaa')],{'as':'Fields','onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xa8')][_0xc207('0x11f')](db[_0xc207('0xa7')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xaa')]['hasMany'](db[_0xc207('0xaa')],{'as':_0xc207('0x1ba'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0xaa')][_0xc207('0x112')](db[_0xc207('0xaa')],{'as':_0xc207('0x1be'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0xaa')]['hasMany'](db[_0xc207('0xaa')],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xaa')][_0xc207('0x11f')](db[_0xc207('0x97')],{'as':_0xc207('0x97'),'foreignKey':'VariableId'});db['DeskAccount'][_0xc207('0x112')](db['DeskConfiguration'],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xae')]['hasMany'](db[_0xc207('0x1bf')],{'as':_0xc207('0x1bd'),'onDelete':_0xc207('0x110'),'foreignKey':'SubjectId'});db[_0xc207('0xae')][_0xc207('0x112')](db['DeskField'],{'as':_0xc207('0x1b7'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b8')});db['DeskConfiguration'][_0xc207('0x112')](db[_0xc207('0x1bf')],{'as':_0xc207('0x1ad'),'onDelete':'cascade','foreignKey':_0xc207('0x1b9')});db[_0xc207('0xae')][_0xc207('0x11f')](db['DeskAccount'],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db['DeskConfiguration'][_0xc207('0x121')](db[_0xc207('0x93')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0xc207('0x112')](db[_0xc207('0x1bf')],{'as':_0xc207('0x1ba'),'foreignKey':'SubjectId'});db[_0xc207('0x1bf')]['hasMany'](db['DeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField']['hasMany'](db[_0xc207('0x1bf')],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0x1bf')][_0xc207('0x11f')](db[_0xc207('0x97')],{'as':_0xc207('0x97'),'foreignKey':_0xc207('0x1bc')});db[_0xc207('0xb1')]['hasMany'](db['ZohoConfiguration'],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xb2')][_0xc207('0x112')](db[_0xc207('0xb4')],{'as':_0xc207('0x1bd'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b6')});db['ZohoConfiguration'][_0xc207('0x112')](db['ZohoField'],{'as':_0xc207('0x1b7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xc207('0x112')](db[_0xc207('0xb4')],{'as':'Fields','onDelete':_0xc207('0x110'),'foreignKey':'FieldId'});db[_0xc207('0xb2')][_0xc207('0x11f')](db[_0xc207('0xb1')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xb4')]['hasMany'](db[_0xc207('0xb4')],{'as':'Subject','foreignKey':_0xc207('0x1b6')});db[_0xc207('0xb4')][_0xc207('0x112')](db[_0xc207('0xb4')],{'as':'Description','foreignKey':_0xc207('0x1b8')});db[_0xc207('0xb4')]['hasMany'](db['ZohoField'],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xb4')]['belongsTo'](db['Variable'],{'as':_0xc207('0x97'),'foreignKey':_0xc207('0x1bc')});db['ZendeskAccount'][_0xc207('0x112')](db[_0xc207('0xb7')],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xb7')][_0xc207('0x112')](db['ZendeskField'],{'as':_0xc207('0x1bd'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0xb7')][_0xc207('0x112')](db[_0xc207('0x1c0')],{'as':_0xc207('0x1b7'),'foreignKey':_0xc207('0x1b8')});db['ZendeskConfiguration'][_0xc207('0x112')](db[_0xc207('0x1c0')],{'as':_0xc207('0x1ad'),'foreignKey':'FieldId'});db[_0xc207('0xb7')]['belongsTo'](db[_0xc207('0xb6')],{'as':_0xc207('0x178'),'foreignKey':'AccountId'});db[_0xc207('0xb7')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x1c1')});db[_0xc207('0x1c0')][_0xc207('0x112')](db[_0xc207('0x1c0')],{'as':_0xc207('0x1ba'),'foreignKey':_0xc207('0x1b6')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0xc207('0x1be'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0x1c0')][_0xc207('0x112')](db['ZendeskField'],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0x1c0')][_0xc207('0x11f')](db[_0xc207('0x97')],{'as':'Variable','foreignKey':_0xc207('0x1bc')});db[_0xc207('0xb9')][_0xc207('0x112')](db[_0xc207('0x1c2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc207('0x1b4')});db[_0xc207('0x1c2')][_0xc207('0x112')](db[_0xc207('0xbc')],{'as':_0xc207('0x1bd'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b6')});db['FreshdeskConfiguration']['hasMany'](db[_0xc207('0xbc')],{'as':_0xc207('0x1b7'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0x1c2')]['hasMany'](db[_0xc207('0xbc')],{'as':_0xc207('0x1ad'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0x1c2')][_0xc207('0x11f')](db[_0xc207('0xb9')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0x1c2')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xc207('0xbc')][_0xc207('0x112')](db[_0xc207('0xbc')],{'as':_0xc207('0x1ba'),'foreignKey':'SubjectId'});db[_0xc207('0xbc')][_0xc207('0x112')](db[_0xc207('0xbc')],{'as':_0xc207('0x1be'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0xbc')][_0xc207('0x112')](db[_0xc207('0xbc')],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xbc')][_0xc207('0x11f')](db[_0xc207('0x97')],{'as':_0xc207('0x97'),'foreignKey':'VariableId'});db[_0xc207('0x1c3')][_0xc207('0x112')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xc207('0x1b4')});db['VtigerConfiguration'][_0xc207('0x112')](db[_0xc207('0x1c4')],{'as':_0xc207('0x1bd'),'foreignKey':'SubjectId'});db[_0xc207('0xbe')][_0xc207('0x112')](db[_0xc207('0x1c4')],{'as':_0xc207('0x1b7'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0xbe')][_0xc207('0x112')](db[_0xc207('0x1c4')],{'as':_0xc207('0x1ad'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xbe')][_0xc207('0x11f')](db[_0xc207('0x1c3')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db['VtigerField'][_0xc207('0x112')](db[_0xc207('0x1c4')],{'as':'Subject','foreignKey':_0xc207('0x1b6')});db['VtigerField']['hasMany'](db[_0xc207('0x1c4')],{'as':_0xc207('0x1be'),'foreignKey':_0xc207('0x1b8')});db['VtigerField']['hasMany'](db[_0xc207('0x1c4')],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0x1c4')][_0xc207('0x11f')](db[_0xc207('0x97')],{'as':_0xc207('0x97'),'foreignKey':_0xc207('0x1bc')});db[_0xc207('0xc1')][_0xc207('0x112')](db[_0xc207('0xc2')],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xc2')]['hasMany'](db[_0xc207('0xc4')],{'as':_0xc207('0x1bd'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0xc2')][_0xc207('0x112')](db[_0xc207('0xc4')],{'as':_0xc207('0x1b7'),'foreignKey':'DescriptionId'});db[_0xc207('0xc2')][_0xc207('0x112')](db[_0xc207('0xc4')],{'as':'Fields','foreignKey':_0xc207('0x1b9')});db['ServicenowConfiguration'][_0xc207('0x11f')](db['ServicenowAccount'],{'as':_0xc207('0x178'),'foreignKey':'AccountId'});db[_0xc207('0xc4')][_0xc207('0x112')](db[_0xc207('0xc4')],{'as':_0xc207('0x1ba'),'foreignKey':'SubjectId'});db['ServicenowField'][_0xc207('0x112')](db[_0xc207('0xc4')],{'as':_0xc207('0x1be'),'foreignKey':'DescriptionId'});db[_0xc207('0xc4')][_0xc207('0x112')](db[_0xc207('0xc4')],{'as':'Field','foreignKey':'FieldId'});db[_0xc207('0xc4')]['belongsTo'](db[_0xc207('0x97')],{'as':_0xc207('0x97'),'foreignKey':_0xc207('0x1bc')});db[_0xc207('0xc6')][_0xc207('0x112')](db[_0xc207('0x1c5')],{'as':_0xc207('0x1b3'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0x1c5')][_0xc207('0x112')](db[_0xc207('0xc8')],{'as':_0xc207('0x1bd'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0x1c5')][_0xc207('0x112')](db[_0xc207('0xc8')],{'as':_0xc207('0x1b7'),'onDelete':_0xc207('0x110'),'foreignKey':'DescriptionId'});db[_0xc207('0x1c5')][_0xc207('0x112')](db[_0xc207('0xc8')],{'as':_0xc207('0x1ad'),'onDelete':_0xc207('0x110'),'foreignKey':'FieldId'});db[_0xc207('0x1c5')][_0xc207('0x11f')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xc207('0x1b4')});db['Dynamics365Field'][_0xc207('0x112')](db[_0xc207('0xc8')],{'as':_0xc207('0x1ba'),'foreignKey':_0xc207('0x1b6')});db['Dynamics365Field']['hasMany'](db[_0xc207('0xc8')],{'as':_0xc207('0x1be'),'foreignKey':_0xc207('0x1b8')});db[_0xc207('0xc8')]['hasMany'](db[_0xc207('0xc8')],{'as':'Field','foreignKey':'FieldId'});db[_0xc207('0xc8')][_0xc207('0x11f')](db['Variable'],{'as':_0xc207('0x97'),'foreignKey':_0xc207('0x1bc')});db[_0xc207('0x1c6')][_0xc207('0x112')](db[_0xc207('0xcb')],{'as':'Configurations','onDelete':_0xc207('0x110'),'foreignKey':'AccountId'});db[_0xc207('0xcb')][_0xc207('0x112')](db[_0xc207('0xcd')],{'as':_0xc207('0x1bd'),'foreignKey':_0xc207('0x1b6')});db[_0xc207('0xcb')][_0xc207('0x112')](db['FreshsalesField'],{'as':_0xc207('0x1b7'),'foreignKey':'DescriptionId'});db[_0xc207('0xcb')][_0xc207('0x112')](db['FreshsalesField'],{'as':_0xc207('0x1ad'),'foreignKey':'FieldId'});db[_0xc207('0xcb')][_0xc207('0x11f')](db[_0xc207('0x1c6')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1b4')});db[_0xc207('0xcd')][_0xc207('0x112')](db[_0xc207('0xcd')],{'as':'Subject','foreignKey':_0xc207('0x1b6')});db[_0xc207('0xcd')][_0xc207('0x112')](db[_0xc207('0xcd')],{'as':_0xc207('0x1be'),'foreignKey':'DescriptionId'});db[_0xc207('0xcd')]['hasMany'](db['FreshsalesField'],{'as':_0xc207('0x1bb'),'foreignKey':_0xc207('0x1b9')});db[_0xc207('0xcd')][_0xc207('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0xc207('0x1bc')});db[_0xc207('0xd1')][_0xc207('0x11f')](db['ChatWebsite'],{});db[_0xc207('0xd1')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0xd1')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db['ChatQueueReport'][_0xc207('0x11f')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db[_0xc207('0xd1')][_0xc207('0x11f')](db[_0xc207('0x10e')],{});db[_0xc207('0xd1')][_0xc207('0x11f')](db[_0xc207('0x71')],{});db[_0xc207('0xd2')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1c7')});db[_0xc207('0xd2')]['belongsTo'](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1c8')});db[_0xc207('0x145')][_0xc207('0x112')](db[_0xc207('0x1c9')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xc207('0x145')][_0xc207('0x112')](db[_0xc207('0xd4')],{'foreignKey':'SessionId','onDelete':_0xc207('0x110')});db[_0xc207('0xd6')]['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport'][_0xc207('0x11f')](db['CmList'],{'as':_0xc207('0x162'),'foreignKey':_0xc207('0x163')});db[_0xc207('0xd6')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0xd6')][_0xc207('0x11f')](db[_0xc207('0x5b')],{});db[_0xc207('0xd6')][_0xc207('0x11f')](db[_0xc207('0x5d')],{});db[_0xc207('0xd6')][_0xc207('0x11f')](db[_0xc207('0x10e')],{});db[_0xc207('0xd6')]['belongsTo'](db[_0xc207('0x5f')],{});db[_0xc207('0x1ca')]['hasMany'](db[_0xc207('0x145')],{'foreignKey':_0xc207('0x1cb')});db[_0xc207('0x1ca')][_0xc207('0x112')](db[_0xc207('0x1c9')],{'foreignKey':_0xc207('0x1cb')});db[_0xc207('0x1ca')][_0xc207('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0xc207('0x1cb')});db[_0xc207('0xdf')][_0xc207('0x121')](db['User'],{'as':_0xc207('0x16b'),'through':_0xc207('0x13b')});db[_0xc207('0xe5')][_0xc207('0x121')](db['User'],{'as':'Agents','through':_0xc207('0x126')});db[_0xc207('0xe5')][_0xc207('0x121')](db[_0xc207('0x1c')],{'through':_0xc207('0x1cc'),'as':_0xc207('0x1cd')});db[_0xc207('0xe5')][_0xc207('0x121')](db['MailQueue'],{'through':_0xc207('0x165'),'as':_0xc207('0x12b')});db[_0xc207('0xe5')]['belongsToMany'](db[_0xc207('0x71')],{'through':_0xc207('0x191'),'as':_0xc207('0x12c')});db[_0xc207('0xe5')][_0xc207('0x121')](db[_0xc207('0x55')],{'through':_0xc207('0x1ce'),'as':_0xc207('0x12d')});db[_0xc207('0xe5')]['belongsToMany'](db[_0xc207('0x5f')],{'through':_0xc207('0x181'),'as':_0xc207('0x12e')});db[_0xc207('0xe5')]['belongsToMany'](db[_0xc207('0x64')],{'through':_0xc207('0x18a'),'as':_0xc207('0x12f')});db[_0xc207('0xe5')][_0xc207('0x121')](db[_0xc207('0x1cf')],{'through':_0xc207('0x1d0'),'as':'WhatsappQueues'});db['Campaign'][_0xc207('0x112')](db[_0xc207('0x7a')],{'as':_0xc207('0x142'),'foreignKey':'CampaignId'});db[_0xc207('0xe8')][_0xc207('0x112')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xc207('0x19a')});db[_0xc207('0xe8')]['hasMany'](db[_0xc207('0x7f')],{'as':'HopperHistories','foreignKey':_0xc207('0x19a')});db[_0xc207('0xe8')][_0xc207('0x112')](db[_0xc207('0x7c')],{'as':'HopperBlacks','foreignKey':_0xc207('0x19a')});db[_0xc207('0xe8')][_0xc207('0x11f')](db[_0xc207('0x2d')],{'as':_0xc207('0x2d'),'foreignKey':_0xc207('0x147')});db[_0xc207('0xe8')][_0xc207('0x11f')](db[_0xc207('0x2d')],{'as':_0xc207('0x148'),'foreignKey':_0xc207('0x149')});db[_0xc207('0xe8')][_0xc207('0x11f')](db[_0xc207('0x89')],{'as':'Interval','foreignKey':_0xc207('0x14a')});db[_0xc207('0xe8')][_0xc207('0x11f')](db[_0xc207('0xdf')],{'as':_0xc207('0xdf'),'foreignKey':_0xc207('0x1d1')});db[_0xc207('0xe8')][_0xc207('0x121')](db[_0xc207('0xfa')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xc207('0xe8')]['belongsToMany'](db[_0xc207('0xfa')],{'as':'BlackLists','through':_0xc207('0x1d2')});db[_0xc207('0xf0')][_0xc207('0x11f')](db['MailMessage'],{});db[_0xc207('0xf0')][_0xc207('0x11f')](db['MailInteraction'],{});db[_0xc207('0xf0')][_0xc207('0x11f')](db[_0xc207('0x41')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0xc207('0xf0')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d3'),'as':'FromAgent'});db[_0xc207('0xf0')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d4'),'as':_0xc207('0x1d5')});db[_0xc207('0xf0')]['belongsTo'](db['MailQueue'],{'foreignKey':_0xc207('0x1d6'),'as':_0xc207('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0xc207('0x41')],{'foreignKey':_0xc207('0x1d8'),'as':_0xc207('0x1d9')});db['ChatTransferReport'][_0xc207('0x11f')](db[_0xc207('0x6d')],{});db['ChatTransferReport'][_0xc207('0x11f')](db[_0xc207('0x6b')],{});db[_0xc207('0xf2')][_0xc207('0x11f')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xc207('0xf2')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d3'),'as':_0xc207('0x1da')});db[_0xc207('0xf2')][_0xc207('0x11f')](db['User'],{'foreignKey':'ToUserId','as':_0xc207('0x1d5')});db[_0xc207('0xf2')]['belongsTo'](db[_0xc207('0x71')],{'foreignKey':_0xc207('0x1db'),'as':_0xc207('0x1d7')});db[_0xc207('0xf2')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xc207('0x1dc'),'as':_0xc207('0x1d9')});db[_0xc207('0xf4')][_0xc207('0x11f')](db['FaxMessage'],{});db[_0xc207('0xf4')][_0xc207('0x11f')](db['FaxInteraction'],{});db['FaxTransferReport'][_0xc207('0x11f')](db['FaxAccount'],{'foreignKey':_0xc207('0x1dd'),'as':_0xc207('0x1de')});db[_0xc207('0xf4')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':'FromUserId','as':_0xc207('0x1da')});db[_0xc207('0xf4')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':'ToUserId','as':_0xc207('0x1d5')});db[_0xc207('0xf4')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xc207('0x1df'),'as':'ToQueue'});db[_0xc207('0xf4')][_0xc207('0x11f')](db[_0xc207('0x4e')],{'foreignKey':_0xc207('0x1e0'),'as':_0xc207('0x1d9')});db[_0xc207('0xf6')][_0xc207('0x11f')](db[_0xc207('0x184')],{});db[_0xc207('0xf6')][_0xc207('0x11f')](db['OpenchannelInteraction'],{});db[_0xc207('0xf6')][_0xc207('0x11f')](db[_0xc207('0x61')],{'foreignKey':_0xc207('0x1e1'),'as':_0xc207('0x1de')});db['OpenchannelTransferReport'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d3'),'as':'FromAgent'});db[_0xc207('0xf6')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d4'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xc207('0x11f')](db[_0xc207('0x64')],{'foreignKey':_0xc207('0x1e2'),'as':'ToQueue'});db[_0xc207('0xf6')]['belongsTo'](db[_0xc207('0x61')],{'foreignKey':_0xc207('0x1e3'),'as':_0xc207('0x1d9')});db[_0xc207('0xf8')][_0xc207('0x11f')](db[_0xc207('0x5d')],{});db[_0xc207('0xf8')]['belongsTo'](db[_0xc207('0x5b')],{});db[_0xc207('0xf8')][_0xc207('0x11f')](db[_0xc207('0x137')],{'foreignKey':_0xc207('0x1e4'),'as':_0xc207('0x1de')});db[_0xc207('0xf8')]['belongsTo'](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d3'),'as':_0xc207('0x1da')});db[_0xc207('0xf8')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d4'),'as':_0xc207('0x1d5')});db['SmsTransferReport']['belongsTo'](db[_0xc207('0x5f')],{'foreignKey':_0xc207('0x1e5'),'as':_0xc207('0x1d7')});db[_0xc207('0xf8')][_0xc207('0x11f')](db[_0xc207('0x137')],{'foreignKey':'ToSmsAccountId','as':_0xc207('0x1d9')});db[_0xc207('0xfa')]['hasMany'](db['Disposition'],{'as':_0xc207('0x172'),'foreignKey':_0xc207('0x163')});db['CmList']['hasMany'](db[_0xc207('0x83')],{'as':_0xc207('0x1e6'),'foreignKey':_0xc207('0x163')});db[_0xc207('0xfa')][_0xc207('0x112')](db[_0xc207('0x78')],{'as':'Contacts','onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x163')});db['CmList']['hasMany'](db[_0xc207('0x115')],{'as':'HopperFinals','foreignKey':_0xc207('0x163')});db[_0xc207('0xfa')]['hasMany'](db[_0xc207('0x7f')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xc207('0xfa')]['hasMany'](db['ReportAgentPreview'],{'as':_0xc207('0x81'),'foreignKey':'ListId'});db['CmList'][_0xc207('0x121')](db[_0xc207('0x1c')],{'as':_0xc207('0x1e7'),'through':_0xc207('0x14e')});db[_0xc207('0xfa')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0xc207('0x112')](db[_0xc207('0x114')],{'as':_0xc207('0x1a2'),'onDelete':_0xc207('0x110')});db['VoicePrefix'][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x132')});db['UserProfile'][_0xc207('0x112')](db[_0xc207('0x10e')],{'as':'Users','foreignKey':_0xc207('0x120')});db[_0xc207('0xfd')][_0xc207('0x112')](db[_0xc207('0x1e8')],{'as':_0xc207('0x1e9'),'foreignKey':_0xc207('0x120'),'onDelete':_0xc207('0x110')});db[_0xc207('0x1e8')]['hasMany'](db['UserProfileResource'],{'as':_0xc207('0x1ea'),'foreignKey':_0xc207('0x1eb'),'onDelete':_0xc207('0x110')});db[_0xc207('0x102')]['hasMany'](db[_0xc207('0x15d')],{'as':_0xc207('0x172'),'foreignKey':_0xc207('0x1ec')});db[_0xc207('0x102')]['hasMany'](db[_0xc207('0x15e')],{'as':'Answers','foreignKey':_0xc207('0x1ec')});db[_0xc207('0x102')][_0xc207('0x112')](db[_0xc207('0x107')],{'as':_0xc207('0x153'),'foreignKey':_0xc207('0x1ec')});db[_0xc207('0x102')][_0xc207('0x112')](db[_0xc207('0x106')],{'as':_0xc207('0x160')});db[_0xc207('0x102')]['hasMany'](db[_0xc207('0x104')],{'as':_0xc207('0x161')});db[_0xc207('0x102')][_0xc207('0x11f')](db[_0xc207('0xfa')],{'as':'List','foreignKey':'ListId'});db[_0xc207('0x102')]['belongsTo'](db[_0xc207('0x8b')],{'as':_0xc207('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc207('0x102')][_0xc207('0x121')](db['User'],{'as':_0xc207('0x14f'),'through':'user_has_whatsapp_accounts'});db[_0xc207('0x104')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'onDelete':_0xc207('0x16f')});db[_0xc207('0x104')]['belongsTo'](db[_0xc207('0x1cf')],{'onDelete':_0xc207('0x16f')});db[_0xc207('0x104')][_0xc207('0x11f')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0xc207('0x104')][_0xc207('0x11f')](db['Interval'],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x14a')});db['WhatsappApplication'][_0xc207('0x11f')](db[_0xc207('0x93')],{'onDelete':_0xc207('0x16f'),'foreignKey':_0xc207('0x170')});db[_0xc207('0x106')]['hasMany'](db['WhatsappMessage'],{'as':_0xc207('0x153'),'onDelete':_0xc207('0x110'),'foreignKey':_0xc207('0x1ed')});db[_0xc207('0x106')][_0xc207('0x11f')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x106')][_0xc207('0x11f')](db[_0xc207('0x10e')],{'as':'Owner','foreignKey':'UserId'});db[_0xc207('0x106')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x1a9'),'as':'Tags'});db[_0xc207('0x106')][_0xc207('0x121')](db[_0xc207('0x93')],{'through':_0xc207('0x1a9'),'as':_0xc207('0x16a')});db[_0xc207('0x106')][_0xc207('0x121')](db[_0xc207('0x10e')],{'as':_0xc207('0x16b'),'through':'user_has_whatsapp_interactions','foreignKey':_0xc207('0x1ed')});db[_0xc207('0x107')]['belongsTo'](db[_0xc207('0x10e')],{'as':_0xc207('0x10e')});db['WhatsappMessage'][_0xc207('0x11f')](db[_0xc207('0x78')],{'onDelete':_0xc207('0x110'),'as':'Contact'});db[_0xc207('0x107')][_0xc207('0x11f')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xc207('0x16d'),'foreignKey':_0xc207('0x1ed')});db[_0xc207('0x107')][_0xc207('0x11f')](db[_0xc207('0x102')],{'as':_0xc207('0x178'),'foreignKey':_0xc207('0x1ec')});db[_0xc207('0x109')][_0xc207('0x11f')](db['WhatsappAccount'],{});db[_0xc207('0x109')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xc207('0x163')});db[_0xc207('0x109')][_0xc207('0x11f')](db[_0xc207('0x78')],{'as':_0xc207('0x167'),'foreignKey':_0xc207('0x159')});db[_0xc207('0x109')][_0xc207('0x11f')](db[_0xc207('0x106')],{});db['WhatsappQueueReport'][_0xc207('0x11f')](db[_0xc207('0x1cf')],{});db[_0xc207('0x109')][_0xc207('0x11f')](db[_0xc207('0x107')],{});db[_0xc207('0x109')]['belongsTo'](db[_0xc207('0x10e')],{});db[_0xc207('0x1ee')][_0xc207('0x11f')](db[_0xc207('0x107')],{});db[_0xc207('0x1ee')][_0xc207('0x11f')](db['WhatsappInteraction'],{});db[_0xc207('0x1ee')][_0xc207('0x11f')](db['WhatsappAccount'],{'foreignKey':_0xc207('0x1ef'),'as':_0xc207('0x1de')});db[_0xc207('0x1ee')][_0xc207('0x11f')](db[_0xc207('0x102')],{'foreignKey':_0xc207('0x1f0'),'as':_0xc207('0x1d9')});db[_0xc207('0x1ee')]['belongsTo'](db[_0xc207('0x1cf')],{'foreignKey':'ToQueueId','as':_0xc207('0x1d7')});db[_0xc207('0x1ee')]['belongsTo'](db[_0xc207('0x10e')],{'foreignKey':_0xc207('0x1d3'),'as':_0xc207('0x1da')});db['WhatsappTransferReport'][_0xc207('0x11f')](db[_0xc207('0x10e')],{'foreignKey':'ToUserId','as':_0xc207('0x1d5')});db[_0xc207('0x1cf')]['belongsToMany'](db[_0xc207('0x10e')],{'as':_0xc207('0x14f'),'through':_0xc207('0x3c'),'foreignKey':_0xc207('0x1f1')});db[_0xc207('0x1cf')][_0xc207('0x121')](db[_0xc207('0xe5')],{'through':'team_has_whatsapp_queues','as':_0xc207('0x150')});module[_0xc207('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b535ee3..e70e157 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29b8=['./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','join','root','/www','/demo','static','/snippet','snippet','1.0.16','/plugins','route','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./config/environment','./config/logger','api','auth','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','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)','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts'];(function(_0x2ad632,_0x134994){var _0x418653=function(_0x1066bd){while(--_0x1066bd){_0x2ad632['push'](_0x2ad632['shift']());}};_0x418653(++_0x134994);}(_0x29b8,0x1e0));var _0x829b=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x29b8[_0x359bbe];return _0x1b3353;};'use strict';var path=require(_0x829b('0x0'));var express=require(_0x829b('0x1'));var ewinston=require(_0x829b('0x2'));var util=require(_0x829b('0x3'));var errors=require('./errors');var config=require(_0x829b('0x4'));var logger=require(_0x829b('0x5'))(_0x829b('0x6'));var authLogger=require(_0x829b('0x5'))(_0x829b('0x7'));exports['default']=function(_0x43c218){_0x43c218[_0x829b('0x8')](ewinston[_0x829b('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x15cdd7,_0x44c953){return util[_0x829b('0xa')](_0x829b('0xb'),_0x15cdd7[_0x829b('0xc')],_0x15cdd7[_0x829b('0xd')][_0x829b('0xe')]?_0x15cdd7[_0x829b('0xd')]['x-forwarded-for']:_0x15cdd7[_0x829b('0xf')][_0x829b('0x10')]||_0x15cdd7['ip'],_0x15cdd7[_0x829b('0x11')],_0x44c953[_0x829b('0x12')],_0x44c953[_0x829b('0x13')],_0x15cdd7[_0x829b('0x14')]?_0x15cdd7[_0x829b('0x14')]['id']:null,_0x15cdd7['user']?_0x15cdd7[_0x829b('0x14')]['name']:null,_0x15cdd7['user']?_0x15cdd7[_0x829b('0x14')][_0x829b('0x15')]:null);}}));_0x43c218[_0x829b('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x8e5708,_0x3bcb2e){var _0x585be4=_0x829b('0x16');if(_0x8e5708['body']&&_0x8e5708[_0x829b('0x17')][_0x829b('0x18')]&&_0x8e5708[_0x829b('0x17')][_0x829b('0x19')]){_0x585be4=_0x829b('0x1a');}return util['format'](_0x585be4,_0x8e5708[_0x829b('0xc')],_0x8e5708[_0x829b('0xd')][_0x829b('0xe')]?_0x8e5708[_0x829b('0xd')][_0x829b('0xe')]:_0x8e5708[_0x829b('0xf')][_0x829b('0x10')]||_0x8e5708['ip'],_0x8e5708[_0x829b('0x11')],_0x3bcb2e[_0x829b('0x12')],_0x3bcb2e[_0x829b('0x13')],_0x8e5708[_0x829b('0x14')]?_0x8e5708['user']['id']:null,_0x8e5708[_0x829b('0x14')]?_0x8e5708[_0x829b('0x14')]['name']:null,_0x8e5708['user']?_0x8e5708[_0x829b('0x14')][_0x829b('0x15')]:null,_0x8e5708[_0x829b('0x17')]&&_0x8e5708[_0x829b('0x17')]['device']?_0x8e5708['body']['device']:'other',_0x8e5708[_0x829b('0x17')]&&_0x8e5708[_0x829b('0x17')][_0x829b('0x19')]?_0x8e5708[_0x829b('0x17')][_0x829b('0x19')]:'',_0x8e5708[_0x829b('0x17')]&&_0x8e5708[_0x829b('0x17')][_0x829b('0x1b')]?_0x8e5708[_0x829b('0x17')][_0x829b('0x1b')]:'');},'ignoreRoute':function(_0x41565e){var _0x55771d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x55771d[_0x829b('0x1c')](_0x41565e[_0x829b('0x11')]);}}));_0x43c218[_0x829b('0x8')]('/api/users',require(_0x829b('0x1d')));_0x43c218[_0x829b('0x8')](_0x829b('0x1e'),require(_0x829b('0x1f')));_0x43c218[_0x829b('0x8')](_0x829b('0x20'),require('./api/voiceContext'));_0x43c218[_0x829b('0x8')](_0x829b('0x21'),require('./api/voiceExtension'));_0x43c218['use'](_0x829b('0x22'),require('./api/voiceMusicOnHold'));_0x43c218[_0x829b('0x8')]('/api/voice/queues',require('./api/voiceQueue'));_0x43c218[_0x829b('0x8')]('/api/voice/recordings',require(_0x829b('0x23')));_0x43c218[_0x829b('0x8')]('/api/screen/recordings',require(_0x829b('0x24')));_0x43c218[_0x829b('0x8')](_0x829b('0x25'),require(_0x829b('0x26')));_0x43c218[_0x829b('0x8')]('/api/voice/mails/messages',require(_0x829b('0x27')));_0x43c218[_0x829b('0x8')]('/api/voice/calls/reports',require(_0x829b('0x28')));_0x43c218[_0x829b('0x8')](_0x829b('0x29'),require(_0x829b('0x2a')));_0x43c218['use'](_0x829b('0x2b'),require(_0x829b('0x2c')));_0x43c218['use']('/api/voice/queues/reports',require(_0x829b('0x2d')));_0x43c218[_0x829b('0x8')](_0x829b('0x2e'),require(_0x829b('0x2f')));_0x43c218[_0x829b('0x8')](_0x829b('0x30'),require(_0x829b('0x31')));_0x43c218[_0x829b('0x8')](_0x829b('0x32'),require(_0x829b('0x33')));_0x43c218[_0x829b('0x8')]('/api/mail/out_servers',require(_0x829b('0x34')));_0x43c218[_0x829b('0x8')](_0x829b('0x35'),require(_0x829b('0x36')));_0x43c218[_0x829b('0x8')](_0x829b('0x37'),require(_0x829b('0x38')));_0x43c218[_0x829b('0x8')](_0x829b('0x39'),require(_0x829b('0x3a')));_0x43c218['use'](_0x829b('0x3b'),require('./api/mailInteraction'));_0x43c218['use']('/api/mail/messages',require(_0x829b('0x3c')));_0x43c218['use'](_0x829b('0x3d'),require(_0x829b('0x3e')));_0x43c218[_0x829b('0x8')]('/api/mail/reports/queue',require(_0x829b('0x3f')));_0x43c218[_0x829b('0x8')]('/api/dashboards',require(_0x829b('0x40')));_0x43c218[_0x829b('0x8')](_0x829b('0x41'),require(_0x829b('0x42')));_0x43c218[_0x829b('0x8')](_0x829b('0x43'),require('./api/faxAccount'));_0x43c218[_0x829b('0x8')]('/api/fax/applications',require(_0x829b('0x44')));_0x43c218[_0x829b('0x8')](_0x829b('0x45'),require('./api/faxInteraction'));_0x43c218[_0x829b('0x8')](_0x829b('0x46'),require(_0x829b('0x47')));_0x43c218['use'](_0x829b('0x48'),require(_0x829b('0x49')));_0x43c218[_0x829b('0x8')](_0x829b('0x4a'),require('./api/faxQueueReport'));_0x43c218[_0x829b('0x8')](_0x829b('0x4b'),require(_0x829b('0x4c')));_0x43c218[_0x829b('0x8')](_0x829b('0x4d'),require(_0x829b('0x4e')));_0x43c218[_0x829b('0x8')](_0x829b('0x4f'),require('./api/smsInteraction'));_0x43c218['use'](_0x829b('0x50'),require('./api/smsMessage'));_0x43c218[_0x829b('0x8')]('/api/sms/queues',require(_0x829b('0x51')));_0x43c218[_0x829b('0x8')](_0x829b('0x52'),require(_0x829b('0x53')));_0x43c218['use'](_0x829b('0x54'),require(_0x829b('0x55')));_0x43c218[_0x829b('0x8')](_0x829b('0x56'),require(_0x829b('0x57')));_0x43c218[_0x829b('0x8')](_0x829b('0x58'),require(_0x829b('0x59')));_0x43c218[_0x829b('0x8')](_0x829b('0x5a'),require(_0x829b('0x5b')));_0x43c218[_0x829b('0x8')]('/api/chat/websites',require('./api/chatWebsite'));_0x43c218['use'](_0x829b('0x5c'),require('./api/openchannelQueueReport'));_0x43c218[_0x829b('0x8')](_0x829b('0x5d'),require(_0x829b('0x5e')));_0x43c218[_0x829b('0x8')](_0x829b('0x5f'),require(_0x829b('0x60')));_0x43c218[_0x829b('0x8')](_0x829b('0x61'),require('./api/chatMessage'));_0x43c218[_0x829b('0x8')](_0x829b('0x62'),require('./api/chatOfflineMessage'));_0x43c218[_0x829b('0x8')](_0x829b('0x63'),require(_0x829b('0x64')));_0x43c218[_0x829b('0x8')](_0x829b('0x65'),require('./api/chatGroup'));_0x43c218[_0x829b('0x8')](_0x829b('0x66'),require('./api/chatProactiveAction'));_0x43c218[_0x829b('0x8')](_0x829b('0x67'),require(_0x829b('0x68')));_0x43c218[_0x829b('0x8')](_0x829b('0x69'),require(_0x829b('0x6a')));_0x43c218['use'](_0x829b('0x6b'),require(_0x829b('0x6c')));_0x43c218['use'](_0x829b('0x6d'),require(_0x829b('0x6e')));_0x43c218['use'](_0x829b('0x6f'),require(_0x829b('0x70')));_0x43c218[_0x829b('0x8')](_0x829b('0x71'),require(_0x829b('0x72')));_0x43c218[_0x829b('0x8')](_0x829b('0x73'),require(_0x829b('0x74')));_0x43c218[_0x829b('0x8')]('/api/actions',require(_0x829b('0x75')));_0x43c218[_0x829b('0x8')](_0x829b('0x76'),require(_0x829b('0x77')));_0x43c218['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x43c218[_0x829b('0x8')](_0x829b('0x78'),require(_0x829b('0x79')));_0x43c218['use'](_0x829b('0x7a'),require(_0x829b('0x7b')));_0x43c218[_0x829b('0x8')]('/api/intervals',require(_0x829b('0x7c')));_0x43c218[_0x829b('0x8')]('/api/pauses',require(_0x829b('0x7d')));_0x43c218[_0x829b('0x8')](_0x829b('0x7e'),require(_0x829b('0x7f')));_0x43c218[_0x829b('0x8')](_0x829b('0x80'),require(_0x829b('0x81')));_0x43c218[_0x829b('0x8')](_0x829b('0x82'),require(_0x829b('0x83')));_0x43c218[_0x829b('0x8')](_0x829b('0x84'),require(_0x829b('0x85')));_0x43c218[_0x829b('0x8')](_0x829b('0x86'),require(_0x829b('0x87')));_0x43c218['use'](_0x829b('0x88'),require(_0x829b('0x89')));_0x43c218[_0x829b('0x8')](_0x829b('0x8a'),require('./api/trigger'));_0x43c218[_0x829b('0x8')]('/api/variables',require(_0x829b('0x8b')));_0x43c218['use']('/api/integrations',require(_0x829b('0x8c')));_0x43c218[_0x829b('0x8')](_0x829b('0x8d'),require('./api/integrationReport'));_0x43c218[_0x829b('0x8')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x43c218[_0x829b('0x8')](_0x829b('0x8e'),require(_0x829b('0x8f')));_0x43c218['use']('/api/analytics/extracted_reports',require(_0x829b('0x90')));_0x43c218['use'](_0x829b('0x91'),require(_0x829b('0x92')));_0x43c218['use'](_0x829b('0x93'),require(_0x829b('0x94')));_0x43c218['use'](_0x829b('0x95'),require('./api/analyticTreeReport'));_0x43c218[_0x829b('0x8')]('/api/integrations/salesforce/accounts',require(_0x829b('0x96')));_0x43c218[_0x829b('0x8')](_0x829b('0x97'),require(_0x829b('0x98')));_0x43c218['use'](_0x829b('0x99'),require('./api/intSalesforceField'));_0x43c218[_0x829b('0x8')](_0x829b('0x9a'),require(_0x829b('0x9b')));_0x43c218['use'](_0x829b('0x9c'),require(_0x829b('0x9d')));_0x43c218[_0x829b('0x8')]('/api/integrations/sugarcrm/fields',require(_0x829b('0x9e')));_0x43c218[_0x829b('0x8')](_0x829b('0x9f'),require(_0x829b('0xa0')));_0x43c218[_0x829b('0x8')]('/api/integrations/desk/configurations',require(_0x829b('0xa1')));_0x43c218[_0x829b('0x8')](_0x829b('0xa2'),require(_0x829b('0xa3')));_0x43c218['use'](_0x829b('0xa4'),require('./api/intZohoAccount'));_0x43c218[_0x829b('0x8')]('/api/integrations/zoho/configurations',require(_0x829b('0xa5')));_0x43c218[_0x829b('0x8')](_0x829b('0xa6'),require(_0x829b('0xa7')));_0x43c218['use'](_0x829b('0xa8'),require(_0x829b('0xa9')));_0x43c218['use'](_0x829b('0xaa'),require(_0x829b('0xab')));_0x43c218['use'](_0x829b('0xac'),require(_0x829b('0xad')));_0x43c218[_0x829b('0x8')](_0x829b('0xae'),require(_0x829b('0xaf')));_0x43c218[_0x829b('0x8')](_0x829b('0xb0'),require('./api/intFreshdeskConfiguration'));_0x43c218[_0x829b('0x8')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x43c218[_0x829b('0x8')](_0x829b('0xb1'),require(_0x829b('0xb2')));_0x43c218['use']('/api/integrations/vtiger/configurations',require(_0x829b('0xb3')));_0x43c218[_0x829b('0x8')]('/api/integrations/vtiger/fields',require(_0x829b('0xb4')));_0x43c218['use'](_0x829b('0xb5'),require(_0x829b('0xb6')));_0x43c218['use'](_0x829b('0xb7'),require('./api/intServicenowConfiguration'));_0x43c218[_0x829b('0x8')](_0x829b('0xb8'),require(_0x829b('0xb9')));_0x43c218[_0x829b('0x8')](_0x829b('0xba'),require(_0x829b('0xbb')));_0x43c218['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x43c218[_0x829b('0x8')](_0x829b('0xbc'),require(_0x829b('0xbd')));_0x43c218[_0x829b('0x8')]('/api/integrations/freshsales/accounts',require(_0x829b('0xbe')));_0x43c218[_0x829b('0x8')](_0x829b('0xbf'),require(_0x829b('0xc0')));_0x43c218[_0x829b('0x8')](_0x829b('0xc1'),require(_0x829b('0xc2')));_0x43c218['use'](_0x829b('0xc3'),require('./api/network'));_0x43c218['use'](_0x829b('0xc4'),require(_0x829b('0xc5')));_0x43c218['use'](_0x829b('0xc6'),require(_0x829b('0xc7')));_0x43c218['use'](_0x829b('0xc8'),require('./api/jscriptyAnswerReport'));_0x43c218[_0x829b('0x8')](_0x829b('0xc9'),require(_0x829b('0xca')));_0x43c218[_0x829b('0x8')]('/api/jscripty/sessions/reports',require(_0x829b('0xcb')));_0x43c218[_0x829b('0x8')](_0x829b('0xcc'),require('./api/smsQueueReport'));_0x43c218[_0x829b('0x8')](_0x829b('0xcd'),require('./api/squareReport'));_0x43c218[_0x829b('0x8')](_0x829b('0xce'),require(_0x829b('0xcf')));_0x43c218[_0x829b('0x8')](_0x829b('0xd0'),require(_0x829b('0xd1')));_0x43c218['use']('/api/settings',require(_0x829b('0xd2')));_0x43c218[_0x829b('0x8')](_0x829b('0xd3'),require('./api/squareOdbc'));_0x43c218[_0x829b('0x8')](_0x829b('0xd4'),require('./api/squareProject'));_0x43c218[_0x829b('0x8')](_0x829b('0xd5'),require(_0x829b('0xd6')));_0x43c218[_0x829b('0x8')]('/api/square/messages',require(_0x829b('0xd7')));_0x43c218[_0x829b('0x8')](_0x829b('0xd8'),require(_0x829b('0xd9')));_0x43c218[_0x829b('0x8')](_0x829b('0xda'),require(_0x829b('0xdb')));_0x43c218[_0x829b('0x8')](_0x829b('0xdc'),require(_0x829b('0xdd')));_0x43c218[_0x829b('0x8')]('/api/migrations',require('./api/migration'));_0x43c218[_0x829b('0x8')](_0x829b('0xde'),require('./api/attachment'));_0x43c218['use'](_0x829b('0xdf'),require(_0x829b('0xe0')));_0x43c218[_0x829b('0x8')](_0x829b('0xe1'),require(_0x829b('0xe2')));_0x43c218[_0x829b('0x8')](_0x829b('0xe3'),require(_0x829b('0xe4')));_0x43c218[_0x829b('0x8')]('/api/fax/reports/transfer',require(_0x829b('0xe5')));_0x43c218[_0x829b('0x8')](_0x829b('0xe6'),require(_0x829b('0xe7')));_0x43c218['use'](_0x829b('0xe8'),require(_0x829b('0xe9')));_0x43c218[_0x829b('0x8')](_0x829b('0xea'),require(_0x829b('0xeb')));_0x43c218['use'](_0x829b('0xec'),require(_0x829b('0xed')));_0x43c218['use'](_0x829b('0xee'),require(_0x829b('0xef')));_0x43c218[_0x829b('0x8')]('/api/userProfile/sections',require(_0x829b('0xf0')));_0x43c218['use'](_0x829b('0xf1'),require(_0x829b('0xf2')));_0x43c218[_0x829b('0x8')](_0x829b('0xf3'),require(_0x829b('0xf4')));_0x43c218[_0x829b('0x8')](_0x829b('0xf5'),require('./api/whatsappAccount'));_0x43c218[_0x829b('0x8')](_0x829b('0xf6'),require('./api/whatsappApplication'));_0x43c218[_0x829b('0x8')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x43c218[_0x829b('0x8')](_0x829b('0xf7'),require(_0x829b('0xf8')));_0x43c218[_0x829b('0x8')](_0x829b('0xf9'),require(_0x829b('0xfa')));_0x43c218[_0x829b('0x8')](_0x829b('0xfb'),require('./api/whatsappTransferReport'));_0x43c218[_0x829b('0x8')]('/api/whatsapp/queues',require(_0x829b('0xfc')));_0x43c218[_0x829b('0x8')](_0x829b('0xfd'),require('./api/cloudProvider'));_0x43c218[_0x829b('0x8')]('/api/auth/local',require(_0x829b('0xfe')));_0x43c218[_0x829b('0x8')](_0x829b('0xff'),require('./api/authGoogle'));_0x43c218[_0x829b('0x8')]('/api/jira',require(_0x829b('0x100')));_0x43c218[_0x829b('0x8')](_0x829b('0x101'),require('./api/rpc'));_0x43c218[_0x829b('0x8')]('/api/version',require(_0x829b('0x102')));_0x43c218['use'](_0x829b('0x103'),require('./api/system'));_0x43c218[_0x829b('0x8')](_0x829b('0x104'),require(_0x829b('0x105')));_0x43c218[_0x829b('0x8')]('/api/webbar',require(_0x829b('0x106')));_0x43c218[_0x829b('0x8')](_0x829b('0x107'),express['static'](path[_0x829b('0x108')](config[_0x829b('0x109')],'/apidoc')));_0x43c218['use'](_0x829b('0x10a'),express['static'](path[_0x829b('0x108')](config['root'],_0x829b('0x10a'))));_0x43c218[_0x829b('0x8')](_0x829b('0x10b'),express[_0x829b('0x10c')](path['join'](config[_0x829b('0x109')],_0x829b('0x10b'))));_0x43c218[_0x829b('0x8')](_0x829b('0x10d'),express['static'](path['join'](config['root'],_0x829b('0x10e'),_0x829b('0x10f'))));_0x43c218[_0x829b('0x8')](_0x829b('0x110'),express[_0x829b('0x10c')](path[_0x829b('0x108')](config[_0x829b('0x109')],'/server/files/plugins')));_0x43c218[_0x829b('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x43c218['route']('/*')['get'](function(_0x35fed4,_0x687e68){_0x687e68[_0x829b('0x112')](path[_0x829b('0x113')](_0x43c218['get'](_0x829b('0x114'))+_0x829b('0x115')));});}; \ No newline at end of file +var _0x5ef0=['get','sendFile','resolve','/index.html','path','express','express-winston','util','./errors','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','other','agent_id','agent_name','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfileSection','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x5ef0,0x119));var _0x05ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ef0[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x05ef('0x0'));var express=require(_0x05ef('0x1'));var ewinston=require(_0x05ef('0x2'));var util=require(_0x05ef('0x3'));var errors=require(_0x05ef('0x4'));var config=require('./config/environment');var logger=require(_0x05ef('0x5'))('api');var authLogger=require('./config/logger')(_0x05ef('0x6'));exports[_0x05ef('0x7')]=function(_0x1da17c){_0x1da17c[_0x05ef('0x8')](ewinston[_0x05ef('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x95b99,_0x208b55){return util['format'](_0x05ef('0xa'),_0x95b99[_0x05ef('0xb')],_0x95b99['headers']['x-forwarded-for']?_0x95b99[_0x05ef('0xc')][_0x05ef('0xd')]:_0x95b99[_0x05ef('0xe')][_0x05ef('0xf')]||_0x95b99['ip'],_0x95b99['url'],_0x208b55['statusCode'],_0x208b55[_0x05ef('0x10')],_0x95b99[_0x05ef('0x11')]?_0x95b99['user']['id']:null,_0x95b99['user']?_0x95b99[_0x05ef('0x11')][_0x05ef('0x12')]:null,_0x95b99[_0x05ef('0x11')]?_0x95b99[_0x05ef('0x11')][_0x05ef('0x13')]:null);}}));_0x1da17c[_0x05ef('0x8')](ewinston[_0x05ef('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4365de,_0x2e0e57){var _0x3d616f=_0x05ef('0x14');if(_0x4365de[_0x05ef('0x15')]&&_0x4365de[_0x05ef('0x15')][_0x05ef('0x16')]&&_0x4365de['body']['agent_id']){_0x3d616f=_0x05ef('0x17');}return util[_0x05ef('0x18')](_0x3d616f,_0x4365de['method'],_0x4365de[_0x05ef('0xc')][_0x05ef('0xd')]?_0x4365de[_0x05ef('0xc')][_0x05ef('0xd')]:_0x4365de[_0x05ef('0xe')]['remoteAddress']||_0x4365de['ip'],_0x4365de[_0x05ef('0x19')],_0x2e0e57['statusCode'],_0x2e0e57[_0x05ef('0x10')],_0x4365de[_0x05ef('0x11')]?_0x4365de[_0x05ef('0x11')]['id']:null,_0x4365de[_0x05ef('0x11')]?_0x4365de[_0x05ef('0x11')][_0x05ef('0x12')]:null,_0x4365de[_0x05ef('0x11')]?_0x4365de['user']['role']:null,_0x4365de[_0x05ef('0x15')]&&_0x4365de[_0x05ef('0x15')][_0x05ef('0x16')]?_0x4365de['body'][_0x05ef('0x16')]:_0x05ef('0x1a'),_0x4365de[_0x05ef('0x15')]&&_0x4365de[_0x05ef('0x15')][_0x05ef('0x1b')]?_0x4365de[_0x05ef('0x15')][_0x05ef('0x1b')]:'',_0x4365de[_0x05ef('0x15')]&&_0x4365de[_0x05ef('0x15')][_0x05ef('0x1c')]?_0x4365de[_0x05ef('0x15')][_0x05ef('0x1c')]:'');},'ignoreRoute':function(_0x3bbec4){var _0x4dbbb8=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4dbbb8['test'](_0x3bbec4[_0x05ef('0x19')]);}}));_0x1da17c[_0x05ef('0x8')]('/api/users',require('./api/user'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x1d'),require('./api/voiceChanSpy'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x1e'),require(_0x05ef('0x1f')));_0x1da17c[_0x05ef('0x8')]('/api/voice/extensions',require(_0x05ef('0x20')));_0x1da17c['use'](_0x05ef('0x21'),require(_0x05ef('0x22')));_0x1da17c['use'](_0x05ef('0x23'),require(_0x05ef('0x24')));_0x1da17c['use'](_0x05ef('0x25'),require(_0x05ef('0x26')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x27'),require('./api/screenRecording'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x28'),require(_0x05ef('0x29')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x2a'),require(_0x05ef('0x2b')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x2c'),require('./api/voiceCallReport'));_0x1da17c['use'](_0x05ef('0x2d'),require(_0x05ef('0x2e')));_0x1da17c[_0x05ef('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x2f'),require('./api/voiceQueueReport'));_0x1da17c[_0x05ef('0x8')]('/api/members/reports',require(_0x05ef('0x30')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x31'),require(_0x05ef('0x32')));_0x1da17c['use'](_0x05ef('0x33'),require('./api/voiceTransferReport'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x34'),require(_0x05ef('0x35')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x36'),require(_0x05ef('0x37')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x38'),require(_0x05ef('0x39')));_0x1da17c[_0x05ef('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x1da17c['use'](_0x05ef('0x3a'),require(_0x05ef('0x3b')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x3c'),require(_0x05ef('0x3d')));_0x1da17c[_0x05ef('0x8')]('/api/mail/applications',require(_0x05ef('0x3e')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x3f'),require(_0x05ef('0x40')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x41'),require(_0x05ef('0x42')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x43'),require(_0x05ef('0x44')));_0x1da17c['use'](_0x05ef('0x45'),require('./api/faxAccount'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x46'),require(_0x05ef('0x47')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x48'),require(_0x05ef('0x49')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x4a'),require(_0x05ef('0x4b')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x4c'),require('./api/faxQueue'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x4d'),require(_0x05ef('0x4e')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x4f'),require(_0x05ef('0x50')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x51'),require('./api/smsApplication'));_0x1da17c[_0x05ef('0x8')]('/api/sms/interactions',require(_0x05ef('0x52')));_0x1da17c['use'](_0x05ef('0x53'),require(_0x05ef('0x54')));_0x1da17c[_0x05ef('0x8')]('/api/sms/queues',require(_0x05ef('0x55')));_0x1da17c['use']('/api/openchannel/accounts',require(_0x05ef('0x56')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x57'),require('./api/openchannelApplication'));_0x1da17c['use'](_0x05ef('0x58'),require('./api/openchannelInteraction'));_0x1da17c['use'](_0x05ef('0x59'),require(_0x05ef('0x5a')));_0x1da17c['use'](_0x05ef('0x5b'),require(_0x05ef('0x5c')));_0x1da17c['use'](_0x05ef('0x5d'),require('./api/chatWebsite'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x5e'),require(_0x05ef('0x5f')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x60'),require('./api/chatApplication'));_0x1da17c['use']('/api/chat/interactions',require(_0x05ef('0x61')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x62'),require(_0x05ef('0x63')));_0x1da17c[_0x05ef('0x8')]('/api/chat/offline_messages',require(_0x05ef('0x64')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x65'),require(_0x05ef('0x66')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x67'),require(_0x05ef('0x68')));_0x1da17c[_0x05ef('0x8')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x69'),require(_0x05ef('0x6a')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x6b'),require(_0x05ef('0x6c')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x6d'),require(_0x05ef('0x6e')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x6f'),require(_0x05ef('0x70')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x71'),require(_0x05ef('0x72')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x73'),require(_0x05ef('0x74')));_0x1da17c[_0x05ef('0x8')]('/api/cm/custom_fields',require(_0x05ef('0x75')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x76'),require(_0x05ef('0x77')));_0x1da17c['use']('/api/automations',require(_0x05ef('0x78')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x79'),require('./api/cannedAnswer'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x7a'),require(_0x05ef('0x7b')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x7c'),require(_0x05ef('0x7d')));_0x1da17c['use'](_0x05ef('0x7e'),require('./api/interval'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x7f'),require(_0x05ef('0x80')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x81'),require('./api/cdr'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x82'),require(_0x05ef('0x83')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x84'),require('./api/schedule'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x85'),require(_0x05ef('0x86')));_0x1da17c['use'](_0x05ef('0x87'),require(_0x05ef('0x88')));_0x1da17c['use'](_0x05ef('0x89'),require(_0x05ef('0x8a')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x8b'),require(_0x05ef('0x8c')));_0x1da17c['use'](_0x05ef('0x8d'),require('./api/variable'));_0x1da17c[_0x05ef('0x8')]('/api/integrations',require('./api/integration'));_0x1da17c['use'](_0x05ef('0x8e'),require(_0x05ef('0x8f')));_0x1da17c[_0x05ef('0x8')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x1da17c[_0x05ef('0x8')]('/api/analytics/default_reports',require(_0x05ef('0x90')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x91'),require(_0x05ef('0x92')));_0x1da17c['use'](_0x05ef('0x93'),require(_0x05ef('0x94')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x95'),require(_0x05ef('0x96')));_0x1da17c[_0x05ef('0x8')]('/api/analytics/tree_reports',require(_0x05ef('0x97')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/salesforce/accounts',require(_0x05ef('0x98')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x99'),require(_0x05ef('0x9a')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x9b'),require('./api/intSalesforceField'));_0x1da17c['use'](_0x05ef('0x9c'),require(_0x05ef('0x9d')));_0x1da17c['use']('/api/integrations/sugarcrm/configurations',require(_0x05ef('0x9e')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x9f'),require('./api/intSugarcrmField'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xa0'),require(_0x05ef('0xa1')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xa2'),require(_0x05ef('0xa3')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/desk/fields',require(_0x05ef('0xa4')));_0x1da17c['use']('/api/integrations/zoho/accounts',require(_0x05ef('0xa5')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xa6'),require(_0x05ef('0xa7')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/zoho/fields',require(_0x05ef('0xa8')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xa9'),require(_0x05ef('0xaa')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xab'),require('./api/intZendeskConfiguration'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xac'),require('./api/intZendeskField'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xad'),require(_0x05ef('0xae')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xaf'),require(_0x05ef('0xb0')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/vtiger/accounts',require(_0x05ef('0xb1')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/vtiger/configurations',require(_0x05ef('0xb2')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xb3'),require(_0x05ef('0xb4')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xb5'),require('./api/intServicenowAccount'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xb6'),require(_0x05ef('0xb7')));_0x1da17c['use'](_0x05ef('0xb8'),require(_0x05ef('0xb9')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xba'),require(_0x05ef('0xbb')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/dynamics365/configurations',require(_0x05ef('0xbc')));_0x1da17c['use'](_0x05ef('0xbd'),require(_0x05ef('0xbe')));_0x1da17c['use'](_0x05ef('0xbf'),require(_0x05ef('0xc0')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xc1'),require(_0x05ef('0xc2')));_0x1da17c[_0x05ef('0x8')]('/api/integrations/freshsales/fields',require(_0x05ef('0xc3')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xc4'),require(_0x05ef('0xc5')));_0x1da17c['use'](_0x05ef('0xc6'),require(_0x05ef('0xc7')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xc8'),require(_0x05ef('0xc9')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xca'),require('./api/jscriptyAnswerReport'));_0x1da17c[_0x05ef('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x1da17c[_0x05ef('0x8')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x1da17c['use']('/api/sms/reports/queue',require(_0x05ef('0xcb')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xcc'),require(_0x05ef('0xcd')));_0x1da17c['use'](_0x05ef('0xce'),require(_0x05ef('0xcf')));_0x1da17c[_0x05ef('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xd0'),require(_0x05ef('0xd1')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xd2'),require('./api/squareOdbc'));_0x1da17c[_0x05ef('0x8')]('/api/square/projects',require(_0x05ef('0xd3')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xd4'),require(_0x05ef('0xd5')));_0x1da17c[_0x05ef('0x8')]('/api/square/messages',require('./api/squareMessage'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xd6'),require(_0x05ef('0xd7')));_0x1da17c[_0x05ef('0x8')]('/api/license',require(_0x05ef('0xd8')));_0x1da17c[_0x05ef('0x8')]('/api/campaigns',require(_0x05ef('0xd9')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xda'),require('./api/migration'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xdb'),require(_0x05ef('0xdc')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xdd'),require(_0x05ef('0xde')));_0x1da17c[_0x05ef('0x8')]('/api/mail/reports/transfer',require(_0x05ef('0xdf')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xe0'),require(_0x05ef('0xe1')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xe2'),require(_0x05ef('0xe3')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xe4'),require(_0x05ef('0xe5')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xe6'),require(_0x05ef('0xe7')));_0x1da17c[_0x05ef('0x8')]('/api/cm/lists',require(_0x05ef('0xe8')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xe9'),require(_0x05ef('0xea')));_0x1da17c['use']('/api/userProfiles',require('./api/userProfile'));_0x1da17c[_0x05ef('0x8')]('/api/userProfile/sections',require(_0x05ef('0xeb')));_0x1da17c[_0x05ef('0x8')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x1da17c[_0x05ef('0x8')]('/api/notifications',require(_0x05ef('0xec')));_0x1da17c['use'](_0x05ef('0xed'),require(_0x05ef('0xee')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xef'),require('./api/whatsappApplication'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xf0'),require('./api/whatsappInteraction'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xf1'),require(_0x05ef('0xf2')));_0x1da17c['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xf3'),require(_0x05ef('0xf4')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xf5'),require('./api/whatsappQueue'));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xf6'),require(_0x05ef('0xf7')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xf8'),require(_0x05ef('0xf9')));_0x1da17c[_0x05ef('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x1da17c['use']('/api/jira',require(_0x05ef('0xfa')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xfb'),require(_0x05ef('0xfc')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xfd'),require(_0x05ef('0xfe')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0xff'),require(_0x05ef('0x100')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x101'),require(_0x05ef('0x102')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x103'),require(_0x05ef('0x104')));_0x1da17c['use'](_0x05ef('0x105'),express['static'](path[_0x05ef('0x106')](config[_0x05ef('0x107')],_0x05ef('0x105'))));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x108'),express[_0x05ef('0x109')](path['join'](config[_0x05ef('0x107')],'/www')));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x10a'),express[_0x05ef('0x109')](path['join'](config[_0x05ef('0x107')],_0x05ef('0x10a'))));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x10b'),express[_0x05ef('0x109')](path[_0x05ef('0x106')](config[_0x05ef('0x107')],_0x05ef('0x10c'),_0x05ef('0x10d'))));_0x1da17c[_0x05ef('0x8')](_0x05ef('0x10e'),express[_0x05ef('0x109')](path[_0x05ef('0x106')](config[_0x05ef('0x107')],'/server/files/plugins')));_0x1da17c[_0x05ef('0x10f')](_0x05ef('0x110'))[_0x05ef('0x111')](errors[0x194]);_0x1da17c[_0x05ef('0x10f')]('/*')[_0x05ef('0x111')](function(_0x3d7111,_0x573b4c){_0x573b4c[_0x05ef('0x112')](path[_0x05ef('0x113')](_0x1da17c[_0x05ef('0x111')]('appPath')+_0x05ef('0x114')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index e3bf826..60d2b1c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4622=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.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/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc'];(function(_0x5bafd3,_0x474626){var _0x4aeb83=function(_0x4ab61a){while(--_0x4ab61a){_0x5bafd3['push'](_0x5bafd3['shift']());}};_0x4aeb83(++_0x474626);}(_0x4622,0xe2));var _0x2462=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x4622[_0x3cf4d3];return _0x4e547b;};'use strict';var jayson=require(_0x2462('0x0'));var BPromise=require(_0x2462('0x1'));var _=require(_0x2462('0x2'));var config=require(_0x2462('0x3'));exports['listen']=function(){return new BPromise(function(_0x2d7933,_0x5bd819){var _0x213f61={};_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/user/user.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/voiceExtension/voiceExtension.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x5')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x6')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x7')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x8')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x9')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xa')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/trunk/trunk.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xb')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xc')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xd')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xe')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/mailInteraction/mailInteraction.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0xf')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x10')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x11')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x12')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x13')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x14')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x15')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x16')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/smsInteraction/smsInteraction.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x17')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x18')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x19')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1a')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1b')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1c')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1d')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/chatInteraction/chatInteraction.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/chatMessage/chatMessage.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x1e')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1f')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x20')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x21')));_0x213f61=_['merge'](_0x213f61,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x22')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x23')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x24')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x25')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/sound/sound.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x26')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/trigger/trigger.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/variable/variable.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x27')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x28')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x29')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2a')));_0x213f61=_['merge'](_0x213f61,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2b')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2c')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2d')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2e')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2f')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x30')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x31')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x32')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x33')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x34')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/squareMessage/squareMessage.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x35')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x36')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x37')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x38')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x39')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x3a')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x3b')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x3c')));var _0x504374=jayson[_0x2462('0x3d')](_0x213f61)[_0x2462('0x3e')]();var _0x543c97=config[_0x2462('0x3f')]['port']||config[_0x2462('0x40')]+0x1;var _0x59a39e=config['rpc']['ip']||'localhost';_0x504374['on'](_0x2462('0x41'),function(_0x2b3c8d){return _0x5bd819(_0x2b3c8d);});_0x504374[_0x2462('0x42')](_0x543c97,_0x59a39e,function(){console[_0x2462('0x43')](_0x2462('0x44'),_0x59a39e,_0x543c97);require('../config/triggers')['default']();return _0x2d7933(_0x2462('0x45')+_0x59a39e+':'+_0x543c97);});});}; \ No newline at end of file +var _0x1a72=['../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc'];(function(_0x403185,_0x3a8eeb){var _0x32d118=function(_0x1dba24){while(--_0x1dba24){_0x403185['push'](_0x403185['shift']());}};_0x32d118(++_0x3a8eeb);}(_0x1a72,0xe0));var _0x21a7=function(_0x18f1df,_0x25f8d0){_0x18f1df=_0x18f1df-0x0;var _0x201d8e=_0x1a72[_0x18f1df];return _0x201d8e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x21a7('0x0'));var _=require(_0x21a7('0x1'));var config=require(_0x21a7('0x2'));exports[_0x21a7('0x3')]=function(){return new BPromise(function(_0x9341a7,_0x2ad5f){var _0x599e05={};_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x5')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x6')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x7')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/voiceRecording/voiceRecording.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x8')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x9')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0xa')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0xb')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/memberReport/memberReport.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/trunk/trunk.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0xc')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0xd')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0xe')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0xf')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x10')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/mailInteraction/mailInteraction.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x11')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x12')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x13')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x14')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x15')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/faxInteraction/faxInteraction.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/faxMessage/faxMessage.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x16')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/smsAccount/smsAccount.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x17')));_0x599e05=_['merge'](_0x599e05,require('../api/smsMessage/smsMessage.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x18')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x19')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x1a')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x1b')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x1c')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/chatInteraction/chatInteraction.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x1d')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x1e')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x1f')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x20')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x21')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x22')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x23')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/interval/interval.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x24')));_0x599e05=_['merge'](_0x599e05,require('../api/sound/sound.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x25')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x26')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x27')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x28')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x599e05=_['merge'](_0x599e05,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x29')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x2a')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x2b')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x2c')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x2d')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x2e')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x2f')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x30')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x31')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x32')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/squareRecording/squareRecording.rpc'));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x33')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x34')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x35')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x36')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x37')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x38')));_0x599e05=_['merge'](_0x599e05,require(_0x21a7('0x39')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require(_0x21a7('0x3a')));_0x599e05=_[_0x21a7('0x4')](_0x599e05,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3cf4d3=jayson[_0x21a7('0x3b')](_0x599e05)[_0x21a7('0x3c')]();var _0x501634=config['rpc'][_0x21a7('0x3d')]||config[_0x21a7('0x3d')]+0x1;var _0x39055c=config[_0x21a7('0x3e')]['ip']||_0x21a7('0x3f');_0x3cf4d3['on'](_0x21a7('0x40'),function(_0x56cb9e){return _0x2ad5f(_0x56cb9e);});_0x3cf4d3[_0x21a7('0x3')](_0x501634,_0x39055c,function(){console[_0x21a7('0x41')](_0x21a7('0x42'),_0x39055c,_0x501634);require(_0x21a7('0x43'))[_0x21a7('0x44')]();return _0x9341a7(_0x21a7('0x45')+_0x39055c+':'+_0x501634);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5dd1217..56d3d60 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 _0x9afc=['GOTO\x20%s\x20%s\x20%s','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','command=','write','prototype','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension'];(function(_0x47fca4,_0x2d6451){var _0xb0abbe=function(_0x32c1df){while(--_0x32c1df){_0x47fca4['push'](_0x47fca4['shift']());}};_0xb0abbe(++_0x2d6451);}(_0x9afc,0xa7));var _0xc9af=function(_0x3252b1,_0x54e32d){_0x3252b1=_0x3252b1-0x0;var _0x5f189d=_0x9afc[_0x3252b1];return _0x5f189d;};'use strict';var util=require(_0xc9af('0x0'));var _=require(_0xc9af('0x1'));var EventEmitter=require(_0xc9af('0x2'))['EventEmitter'];var AGIReply=require(_0xc9af('0x3'));var AGIError=require('./error');function AGIChannel(_0x552d8f){var _0x4e3d74=this,_0x1696df=new AGIReply(),_0x267de2=![],_0x5421c9={};EventEmitter['call'](_0x4e3d74);_0x552d8f[_0xc9af('0x4')](_0xc9af('0x5'));_0x552d8f['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1696df['setEncoding'](_0xc9af('0x5'));_0x1696df['on'](_0xc9af('0x6'),function(_0x9b3d4a){for(var _0x2e1372 in _0x9b3d4a){_0x4e3d74[_0x2e1372]=_0x9b3d4a[_0x2e1372];}_0x4e3d74[_0xc9af('0x7')](_0xc9af('0x8'));});_0x1696df['on'](_0xc9af('0x9'),function(_0x538599){if(_0x538599[_0xc9af('0xa')]()==_0xc9af('0xb')){_0x4e3d74[_0xc9af('0x7')]('hangup');return;}if(_0x538599[_0xc9af('0xc')](0x0,0xb)==_0xc9af('0xd')){_0x267de2=!![];}if(_0x267de2){_0x5421c9['rx']+=_0x538599+'\x0a';if(_0x538599['search']('520\x20End\x20of\x20proper')!=-0x1){_0x267de2=![];}}else{_0x5421c9['rx']=_0x538599;}if(_0x267de2){return;}if(typeof _0x5421c9['cb']==_0xc9af('0xe')){var _0x11f99b=_0x5421c9['rx'][_0xc9af('0xc')](0x0,0x3),_0x437d69=null,_0x304f1f=null;_0x11f99b=parseInt(_0x11f99b);if(isNaN(_0x11f99b)){_0x5421c9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc9af('0xf')});return;}if(_0x11f99b!=0xc8){_0x5421c9['cb'](null,{'code':_0x11f99b,'result':-0x1,'extra':'KO'});return;}_0x437d69=_0x5421c9['rx']['substring'](0x4)[_0xc9af('0x10')](_0xc9af('0x11'),'');if(_0x437d69[_0xc9af('0x12')]('\x20')!=-0x1){_0x437d69=_0x437d69[_0xc9af('0x13')](0x0,_0x437d69[_0xc9af('0x12')]('\x20'));}if(_['startsWith'](_0x437d69,'-1')){_0x437d69=parseInt(_0x437d69);}_0x304f1f=_0x5421c9['rx'][_0xc9af('0x14')]('\x20');if(_0x304f1f[_0xc9af('0x15')]==0x3){_0x304f1f=_0x304f1f[0x2][_0xc9af('0xc')](0x1,_0x304f1f[0x2][_0xc9af('0x15')]-0x1);}else if(_0x304f1f[_0xc9af('0x15')]>0x3){var _0x391b92=/\((.+)\)/;var _0x2ab015=_0x5421c9['rx']['match'](_0x391b92);if(_0x2ab015){_0x304f1f=_0x2ab015[0x1];}else{_0x304f1f=null;}}else{_0x304f1f=null;}_0x5421c9['cb'](null,{'code':_0x11f99b,'result':_0x437d69,'extra':_0x304f1f});}});_0x552d8f['on'](_0xc9af('0x16'),function(_0x46a715){_0x4e3d74['emit']('error',new AGIError(_0xc9af('0x17'),_0x46a715['code']));});_0x552d8f['on'](_0xc9af('0x18'),function(){_0x4e3d74[_0xc9af('0x7')](_0xc9af('0x18'),new AGIError(_0xc9af('0x19')));});_0x552d8f['on'](_0xc9af('0x1a'),function(){_0x4e3d74[_0xc9af('0x7')](_0xc9af('0x1a'),new AGIError(_0xc9af('0x1b')));_0x552d8f[_0xc9af('0x1c')]();});_0x552d8f[_0xc9af('0x1d')](_0x1696df);this[_0xc9af('0x1e')]=function(_0x2f56f2,_0x514c23){console[_0xc9af('0x1f')](_0xc9af('0x20'),_0x2f56f2);var _0x2f56f2=_0x2f56f2||'',_0x514c23=typeof _0x514c23==_0xc9af('0xe')?_0x514c23:new Function();_0x5421c9={'tx':_0x2f56f2,'rx':'','cb':_0x514c23};_0x552d8f[_0xc9af('0x21')](_0x2f56f2+'\x0a');},this['close']=function(){_0x552d8f['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xc9af('0x22')]['sendRequest']=function(_0xaca168){return this[_0xc9af('0x1e')]['sync'](this,_0xaca168);};AGIChannel[_0xc9af('0x22')][_0xc9af('0x23')]=function(){return this[_0xc9af('0x24')](_0xc9af('0x25'));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x26')]=function(_0xa7f5a1,_0x3a6fe5,_0x15c25d){_0xa7f5a1=_0xa7f5a1===undefined?_0xc9af('0x27'):_0xa7f5a1;_0x3a6fe5=_0x3a6fe5===undefined?'5':_0x3a6fe5;_0x15c25d=_0x15c25d===undefined?'1':_0x15c25d;return this[_0xc9af('0x24')](util['format'](_0xc9af('0x28'),_0xa7f5a1,_0x3a6fe5*0x3e8,_0x15c25d));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x29')]=function(_0x470e39){_0x470e39=_0x470e39||_0xc9af('0x2a');return this[_0xc9af('0x24')](util[_0xc9af('0x2b')]('VERBOSE\x20\x22%s\x22',_0x470e39));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x2c')]=function(_0x3aa076,_0x22a265){if(_['isArray'](_0x22a265)){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')]('EXEC\x20%s\x20%s',_0x3aa076,_0x22a265[_0xc9af('0x2d')](',')));}return this['sendRequest'](util[_0xc9af('0x2b')](_0xc9af('0x2e'),_0x3aa076,_0x22a265));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x2f')]=function(_0x5e88fa){return this['sendRequest'](util[_0xc9af('0x2b')](_0xc9af('0x30'),_0x5e88fa));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x31')]=function(_0x4a49d6){return this['sendRequest'](util[_0xc9af('0x2b')]('SET\x20EXTENSION\x20%s',_0x4a49d6));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x32')]=function(_0x214756){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x33'),_0x214756));};AGIChannel[_0xc9af('0x22')]['hangup']=function(){return this[_0xc9af('0x24')](_0xc9af('0x34'));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x35')]=function(_0x3aa4db,_0xcf4776){var _0x29d3ff=_['isBoolean'](_0xcf4776)||_[_0xc9af('0x36')](_0xcf4776)?_0xcf4776[_0xc9af('0x37')]():_0xcf4776;return this[_0xc9af('0x24')](util[_0xc9af('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3aa4db,_0x29d3ff?_0x29d3ff[_0xc9af('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x38')]=function(_0x24626a,_0x4b05fb){return this[_0xc9af('0x24')](util['format'](_0xc9af('0x39'),_0x24626a,_0x4b05fb));};AGIChannel['prototype'][_0xc9af('0x3a')]=function(_0x21049f,_0x45d94e){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x3b'),_0x21049f,_0x45d94e));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x3c')]=function(_0x3855b0,_0x2a2dc1){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x3d'),_0x3855b0,_0x2a2dc1));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x3e')]=function(_0x57aff5,_0x1693ef,_0x5f5d28){_0x1693ef=_0x1693ef||this[_0xc9af('0x3f')];_0x5f5d28=_0x5f5d28||0x1;this[_0xc9af('0x2f')](_0x57aff5);this['setExtension'](_0x1693ef);this[_0xc9af('0x32')](_0x5f5d28);return this['noop'](util['format'](_0xc9af('0x40'),_0x57aff5,_0x1693ef,_0x5f5d28));};AGIChannel['prototype']['getVariable']=function(_0x55a215){console[_0xc9af('0x1f')](_0xc9af('0x41'),_0x55a215);return this[_0xc9af('0x24')](util['format'](_0xc9af('0x42'),_0x55a215));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x43')]=function(_0x209fa8,_0x38430c,_0x31528f,_0xd50cfe,_0x395d38,_0xe4a1c7){_0x38430c=_0x38430c||_0xc9af('0x44');_0x31528f=_0x31528f||'';_0xd50cfe=_0xd50cfe===undefined?-0x1:_0xd50cfe==='-1'?-0x1:_0xd50cfe*0x3e8;_0x395d38=_0x395d38===undefined?'':'s='+_0x395d38;_0xe4a1c7=_0xe4a1c7?_0xc9af('0x45'):'';return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x46'),_0x209fa8,_0x38430c,_0x31528f,_0xd50cfe,_0xe4a1c7,_0x395d38));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x47')]=function(_0x540975,_0x4700b4){_0x4700b4=_0x4700b4||'';return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x48'),_0x540975,_0x4700b4));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x49')]=function(_0x3e23f9){return this['exec']('AGI',_0x3e23f9);};AGIChannel[_0xc9af('0x22')]['wait']=function(_0x5af153){return this[_0xc9af('0x2c')](_0xc9af('0x4a'),_0x5af153);};AGIChannel[_0xc9af('0x22')][_0xc9af('0x16')]=function(_0x3724db,_0x1c4645){this[_0xc9af('0x29')](util[_0xc9af('0x2b')](_0xc9af('0x4b'),_0x3724db['id'],_0x3724db['label'],_0x1c4645));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc9af('0x4c')]=AGIChannel; \ No newline at end of file +var _0x129d=['wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','util','events','EventEmitter','./error','call','setEncoding','headers','ready','toLowerCase','emit','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','replace','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command=','write','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','log','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x129d,0x145));var _0xd129=function(_0x5e201b,_0x160501){_0x5e201b=_0x5e201b-0x0;var _0x2bb339=_0x129d[_0x5e201b];return _0x2bb339;};'use strict';var util=require(_0xd129('0x0'));var _=require('lodash');var EventEmitter=require(_0xd129('0x1'))[_0xd129('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xd129('0x3'));function AGIChannel(_0x41fd65){var _0x3f423b=this,_0x30f1eb=new AGIReply(),_0xf8ba50=![],_0x7e2c0c={};EventEmitter[_0xd129('0x4')](_0x3f423b);_0x41fd65[_0xd129('0x5')]('utf8');_0x41fd65['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x30f1eb[_0xd129('0x5')]('utf8');_0x30f1eb['on'](_0xd129('0x6'),function(_0x263030){for(var _0x49fdf5 in _0x263030){_0x3f423b[_0x49fdf5]=_0x263030[_0x49fdf5];}_0x3f423b['emit'](_0xd129('0x7'));});_0x30f1eb['on']('line',function(_0x1aca88){if(_0x1aca88[_0xd129('0x8')]()=='hangup'){_0x3f423b[_0xd129('0x9')](_0xd129('0xa'));return;}if(_0x1aca88[_0xd129('0xb')](0x0,0xb)==_0xd129('0xc')){_0xf8ba50=!![];}if(_0xf8ba50){_0x7e2c0c['rx']+=_0x1aca88+'\x0a';if(_0x1aca88['search'](_0xd129('0xd'))!=-0x1){_0xf8ba50=![];}}else{_0x7e2c0c['rx']=_0x1aca88;}if(_0xf8ba50){return;}if(typeof _0x7e2c0c['cb']==_0xd129('0xe')){var _0xcf5a3f=_0x7e2c0c['rx'][_0xd129('0xb')](0x0,0x3),_0x277b2e=null,_0x3b3c8f=null;_0xcf5a3f=parseInt(_0xcf5a3f);if(isNaN(_0xcf5a3f)){_0x7e2c0c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xcf5a3f!=0xc8){_0x7e2c0c['cb'](null,{'code':_0xcf5a3f,'result':-0x1,'extra':'KO'});return;}_0x277b2e=_0x7e2c0c['rx']['substring'](0x4)[_0xd129('0xf')]('result=','');if(_0x277b2e[_0xd129('0x10')]('\x20')!=-0x1){_0x277b2e=_0x277b2e[_0xd129('0x11')](0x0,_0x277b2e[_0xd129('0x10')]('\x20'));}if(_[_0xd129('0x12')](_0x277b2e,'-1')){_0x277b2e=parseInt(_0x277b2e);}_0x3b3c8f=_0x7e2c0c['rx']['split']('\x20');if(_0x3b3c8f[_0xd129('0x13')]==0x3){_0x3b3c8f=_0x3b3c8f[0x2][_0xd129('0xb')](0x1,_0x3b3c8f[0x2][_0xd129('0x13')]-0x1);}else if(_0x3b3c8f[_0xd129('0x13')]>0x3){var _0x51a279=/\((.+)\)/;var _0x4b5781=_0x7e2c0c['rx'][_0xd129('0x14')](_0x51a279);if(_0x4b5781){_0x3b3c8f=_0x4b5781[0x1];}else{_0x3b3c8f=null;}}else{_0x3b3c8f=null;}_0x7e2c0c['cb'](null,{'code':_0xcf5a3f,'result':_0x277b2e,'extra':_0x3b3c8f});}});_0x41fd65['on'](_0xd129('0x15'),function(_0x42e446){_0x3f423b['emit']('error',new AGIError(_0xd129('0x16'),_0x42e446[_0xd129('0x17')]));});_0x41fd65['on']('close',function(){_0x3f423b[_0xd129('0x9')](_0xd129('0x18'),new AGIError(_0xd129('0x19')));});_0x41fd65['on']('timeout',function(){_0x3f423b[_0xd129('0x9')]('timeout',new AGIError(_0xd129('0x1a')));_0x41fd65[_0xd129('0x1b')]();});_0x41fd65[_0xd129('0x1c')](_0x30f1eb);this['command']=function(_0x4c9fd7,_0x9d72f4){console['log'](_0xd129('0x1d'),_0x4c9fd7);var _0x4c9fd7=_0x4c9fd7||'',_0x9d72f4=typeof _0x9d72f4=='function'?_0x9d72f4:new Function();_0x7e2c0c={'tx':_0x4c9fd7,'rx':'','cb':_0x9d72f4};_0x41fd65[_0xd129('0x1e')](_0x4c9fd7+'\x0a');},this[_0xd129('0x18')]=function(){_0x41fd65['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xd129('0x1f')][_0xd129('0x20')]=function(_0xee58ea){return this[_0xd129('0x21')][_0xd129('0x22')](this,_0xee58ea);};AGIChannel[_0xd129('0x1f')][_0xd129('0x23')]=function(){return this[_0xd129('0x20')](_0xd129('0x24'));};AGIChannel[_0xd129('0x1f')][_0xd129('0x25')]=function(_0x3f813a,_0x4e19b3,_0x55113d){_0x3f813a=_0x3f813a===undefined?_0xd129('0x26'):_0x3f813a;_0x4e19b3=_0x4e19b3===undefined?'5':_0x4e19b3;_0x55113d=_0x55113d===undefined?'1':_0x55113d;return this['sendRequest'](util[_0xd129('0x27')](_0xd129('0x28'),_0x3f813a,_0x4e19b3*0x3e8,_0x55113d));};AGIChannel['prototype'][_0xd129('0x29')]=function(_0x4d0b6d){_0x4d0b6d=_0x4d0b6d||_0xd129('0x2a');return this[_0xd129('0x20')](util['format'](_0xd129('0x2b'),_0x4d0b6d));};AGIChannel['prototype'][_0xd129('0x2c')]=function(_0x5c7e04,_0x425740){if(_['isArray'](_0x425740)){return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x2d'),_0x5c7e04,_0x425740[_0xd129('0x2e')](',')));}return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x2d'),_0x5c7e04,_0x425740));};AGIChannel[_0xd129('0x1f')][_0xd129('0x2f')]=function(_0x248a06){return this['sendRequest'](util['format'](_0xd129('0x30'),_0x248a06));};AGIChannel[_0xd129('0x1f')]['setExtension']=function(_0x28454f){return this[_0xd129('0x20')](util['format']('SET\x20EXTENSION\x20%s',_0x28454f));};AGIChannel[_0xd129('0x1f')][_0xd129('0x31')]=function(_0x279146){return this[_0xd129('0x20')](util['format'](_0xd129('0x32'),_0x279146));};AGIChannel[_0xd129('0x1f')][_0xd129('0xa')]=function(){return this[_0xd129('0x20')](_0xd129('0x33'));};AGIChannel[_0xd129('0x1f')]['setVariable']=function(_0x542efc,_0x374a91){var _0x2317fd=_[_0xd129('0x34')](_0x374a91)||_[_0xd129('0x35')](_0x374a91)?_0x374a91['toString']():_0x374a91;return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x36'),_0x542efc,_0x2317fd?_0x2317fd[_0xd129('0x37')]()[_0xd129('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd129('0x1f')][_0xd129('0x38')]=function(_0x1aa304,_0xd5a894){return this['sendRequest'](util[_0xd129('0x27')](_0xd129('0x39'),_0x1aa304,_0xd5a894));};AGIChannel[_0xd129('0x1f')][_0xd129('0x3a')]=function(_0x3d01ba,_0x1aa882){return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x3b'),_0x3d01ba,_0x1aa882));};AGIChannel[_0xd129('0x1f')][_0xd129('0x3c')]=function(_0x1bcfe9,_0x37a25a){return this[_0xd129('0x20')](util['format'](_0xd129('0x3d'),_0x1bcfe9,_0x37a25a));};AGIChannel['prototype']['continueAt']=function(_0x2b6063,_0x5039d8,_0x1cb8ac){_0x5039d8=_0x5039d8||this[_0xd129('0x3e')];_0x1cb8ac=_0x1cb8ac||0x1;this[_0xd129('0x2f')](_0x2b6063);this[_0xd129('0x3f')](_0x5039d8);this[_0xd129('0x31')](_0x1cb8ac);return this[_0xd129('0x29')](util[_0xd129('0x27')](_0xd129('0x40'),_0x2b6063,_0x5039d8,_0x1cb8ac));};AGIChannel[_0xd129('0x1f')][_0xd129('0x41')]=function(_0x249378){console[_0xd129('0x42')](_0xd129('0x43'),_0x249378);return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x44'),_0x249378));};AGIChannel[_0xd129('0x1f')][_0xd129('0x45')]=function(_0x204e87,_0x1b787c,_0x5b7b60,_0x2a8d23,_0x3c6dec,_0x577ac5){_0x1b787c=_0x1b787c||_0xd129('0x46');_0x5b7b60=_0x5b7b60||'';_0x2a8d23=_0x2a8d23===undefined?-0x1:_0x2a8d23==='-1'?-0x1:_0x2a8d23*0x3e8;_0x3c6dec=_0x3c6dec===undefined?'':'s='+_0x3c6dec;_0x577ac5=_0x577ac5?_0xd129('0x47'):'';return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x48'),_0x204e87,_0x1b787c,_0x5b7b60,_0x2a8d23,_0x577ac5,_0x3c6dec));};AGIChannel['prototype'][_0xd129('0x49')]=function(_0x1bd117,_0x3d9ca7){_0x3d9ca7=_0x3d9ca7||'';return this[_0xd129('0x20')](util[_0xd129('0x27')](_0xd129('0x4a'),_0x1bd117,_0x3d9ca7));};AGIChannel[_0xd129('0x1f')][_0xd129('0x4b')]=function(_0xf6d20f){return this[_0xd129('0x2c')](_0xd129('0x4c'),_0xf6d20f);};AGIChannel['prototype'][_0xd129('0x4d')]=function(_0x129833){return this[_0xd129('0x2c')](_0xd129('0x4e'),_0x129833);};AGIChannel['prototype'][_0xd129('0x15')]=function(_0x2d626a,_0x363e29){this[_0xd129('0x29')](util[_0xd129('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2d626a['id'],_0x2d626a['label'],_0x363e29));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 570f659..dbfcca1 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 _0xcd56=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0xcd56,0x1c9));var _0x6cd5=function(_0x5a166f,_0x8db7d6){_0x5a166f=_0x5a166f-0x0;var _0x5befe7=_0xcd56[_0x5a166f];return _0x5befe7;};'use strict';var util=require(_0x6cd5('0x0'));var error={'E_AGI_UNDEFINED':_0x6cd5('0x1'),'E_AGI_ARGUMENT_PORT':_0x6cd5('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6cd5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x6cd5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x6cd5('0x5'),'E_AGI_SOCKET_ERROR':_0x6cd5('0x6'),'E_AGI_SOCKET_CLOSE':_0x6cd5('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x6cd5('0x8'),'E_AGI_COMMAND_EMPTY':_0x6cd5('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6cd5('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xdc5d4f){var _0xdc5d4f=_0xdc5d4f||null,_0x1c4af9=_0x1c4af9||[],_0x25e9a3=0x1,_0x589bf9='';if(!error[_0xdc5d4f]){_0xdc5d4f='E_AGI_UNDEFINED';}_0x1c4af9[_0x6cd5('0xb')](error[_0xdc5d4f]);while(arguments[_0x25e9a3]){_0x1c4af9[_0x6cd5('0xb')](arguments[_0x25e9a3]);_0x25e9a3++;}_0x589bf9=util[_0x6cd5('0xc')][_0x6cd5('0xd')](util,_0x1c4af9);this[_0x6cd5('0xe')]=_0x589bf9;this[_0x6cd5('0xf')]=_0xdc5d4f;}module[_0x6cd5('0x10')]=AGIError; \ No newline at end of file +var _0x40b5=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','message','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.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x540b('0x0'));var error={'E_AGI_UNDEFINED':_0x540b('0x1'),'E_AGI_ARGUMENT_PORT':_0x540b('0x2'),'E_AGI_SERVER_ERROR':_0x540b('0x3'),'E_AGI_SERVER_CLOSE':_0x540b('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x540b('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x540b('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x540b('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x540b('0x8'),'E_AGI_COMMAND_EMPTY':_0x540b('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x540b('0xa'),'E_AGI_IVR_ENTRY':_0x540b('0xb')};function AGIError(_0x4e0a29){var _0x4e0a29=_0x4e0a29||null,_0x448b68=_0x448b68||[],_0x316ab7=0x1,_0x5aeb5f='';if(!error[_0x4e0a29]){_0x4e0a29='E_AGI_UNDEFINED';}_0x448b68[_0x540b('0xc')](error[_0x4e0a29]);while(arguments[_0x316ab7]){_0x448b68['push'](arguments[_0x316ab7]);_0x316ab7++;}_0x5aeb5f=util['format']['apply'](util,_0x448b68);this[_0x540b('0xd')]=_0x5aeb5f;this['name']=_0x4e0a29;}module[_0x540b('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5cdb6db..330ca46 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 _0x2547=['getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','addEdge','size','prototype','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','includes','condition\x20not\x20found','exports','../../../config/logger','agi','menu'];(function(_0x27854f,_0x395ed7){var _0x2b8fdb=function(_0x338b10){while(--_0x338b10){_0x27854f['push'](_0x27854f['shift']());}};_0x2b8fdb(++_0x395ed7);}(_0x2547,0x1cd));var _0x7254=function(_0x22993c,_0x395910){_0x22993c=_0x22993c-0x0;var _0x1ce684=_0x2547[_0x22993c];return _0x1ce684;};'use strict';var _=require('lodash');var logger=require(_0x7254('0x0'))(_0x7254('0x1'));var verticesWithRetry=[_0x7254('0x2'),_0x7254('0x3'),_0x7254('0x4')];var Graph=function(){this[_0x7254('0x5')]={};this[_0x7254('0x6')]={};this[_0x7254('0x7')]=0x0;};Graph['prototype'][_0x7254('0x8')]=function(_0x59705f){this[_0x7254('0x5')][_0x59705f['id']]=_0x59705f;this[_0x7254('0x6')][_0x59705f['id']]=[];};Graph['prototype'][_0x7254('0x9')]=function(_0x6e3d84,_0x395913,_0x5da1ec){this[_0x7254('0x6')][_0x6e3d84]['push']({'target':_0x395913,'condition':_0x5da1ec});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x7254('0xa')]=function(){return _[_0x7254('0xa')](this[_0x7254('0x5')]);};Graph[_0x7254('0xb')][_0x7254('0xc')]=function(){return this[_0x7254('0x7')];};Graph['prototype'][_0x7254('0xd')]=function(_0x5ec311){return this[_0x7254('0x5')][_0x5ec311];};Graph['prototype'][_0x7254('0xe')]=function(_0x2bfff8,_0x348d4e){if(!this[_0x7254('0x5')][_0x2bfff8]){return logger[_0x7254('0xf')](_0x7254('0x10'));}var _0x124192=_0x348d4e(this[_0x7254('0x5')][_0x2bfff8]);if(!_0x124192){return logger[_0x7254('0xf')](_0x7254('0x11'));}if(this[_0x7254('0x6')][_0x2bfff8][_0x7254('0x12')]===0x0){return logger[_0x7254('0xf')]('no\x20edge/s\x20available');}for(var _0x265293=0x0,_0x4395fb=[],_0xf47255=![];_0x265293\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','hasOwnProperty','retry','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','SQUAREROOT','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','start','vertex','VERTEX','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare'];(function(_0x53e725,_0x1cbc83){var _0x5de8e2=function(_0x3670fa){while(--_0x3670fa){_0x53e725['push'](_0x53e725['shift']());}};_0x5de8e2(++_0x1cbc83);}(_0xfb71,0x1ef));var _0x1fb7=function(_0xa60933,_0x3e8b86){_0xa60933=_0xa60933-0x0;var _0x4c62b7=_0xfb71[_0xa60933];return _0x4c62b7;};'use strict';var parser=require(_0x1fb7('0x0'));var _=require(_0x1fb7('0x1'));var syncho=require(_0x1fb7('0x2'));var util=require(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1fb7('0x5'));var utilLicense=require(_0x1fb7('0x6'));var rpc=require(_0x1fb7('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x1fb7('0x8'));var Vertices=require(_0x1fb7('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1fb7('0x5')]=_[_0x1fb7('0xa')](config[_0x1fb7('0x5')],{'ip':_0x1fb7('0xb'),'port':0x11dd});function connectionHandler(_0x4abac2){process[_0x1fb7('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4abac2);agiHandler(_0x4abac2);}catch(_0x1a9e9e){logger['error'](_0x1a9e9e[_0x1fb7('0xd')]);}});});}function listeningHandler(){console[_0x1fb7('0xe')](_0x1fb7('0xf'),config[_0x1fb7('0x5')][_0x1fb7('0x10')]);logger[_0x1fb7('0x11')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x1fb7('0x5')]['ip'],config[_0x1fb7('0x5')][_0x1fb7('0x10')]));}function errorHandler(_0x55f8ae){if(_0x55f8ae&&_0x55f8ae[_0x1fb7('0x12')]&&_0x55f8ae[_0x1fb7('0x13')]){logger[_0x1fb7('0x14')](util['format']('[%s]\x20%s',_0x55f8ae[_0x1fb7('0x12')],_0x55f8ae['message']));}else{logger['error'](util[_0x1fb7('0x15')]('[ERROR]\x20%s',_0x55f8ae[_0x1fb7('0xd')]));}}function closeHandler(){logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')](_0x1fb7('0x16'),this[_0x1fb7('0x17')],this[_0x1fb7('0x18')],this[_0x1fb7('0x19')],this[_0x1fb7('0x1a')],this[_0x1fb7('0x1b')]));try{createSquareReport(this);}catch(_0x57387e){logger[_0x1fb7('0x14')](_0x57387e[_0x1fb7('0xd')]);}}function timeoutHandler(){logger[_0x1fb7('0x11')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1fb7('0x17')],this[_0x1fb7('0x18')],this[_0x1fb7('0x19')],this[_0x1fb7('0x1a')],this[_0x1fb7('0x1b')]));}function hangupHandler(){logger['info'](util['format'](_0x1fb7('0x1c'),this[_0x1fb7('0x17')],this['calleridname'],this[_0x1fb7('0x19')],this[_0x1fb7('0x1a')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x3c47be){return parser[_0x1fb7('0x1d')](_0x3c47be,{'object':!![]})[_0x1fb7('0x1e')][_0x1fb7('0x1f')];}function addVertex(_0x10c424,_0xf41888,_0x350384){_0xf41888['agicommand']=_0x350384;if(_0xf41888[_0x1fb7('0x20')](_0x1fb7('0x21'))){_0xf41888['maxRetry']=parseInt(_0xf41888[_0x1fb7('0x21')],0xa);}_0x10c424['addVertex'](_['omit'](_0xf41888,_0x1fb7('0x22')));}function initGraph(_0x27b957,_0x2be17f){var _0x5c1800=new Graph();for(var _0x3695b6 in _0x27b957){if(_0x27b957[_0x1fb7('0x20')](_0x3695b6)){if(_[_0x1fb7('0x23')](_0x27b957[_0x3695b6])){for(var _0x434d3a=0x0;_0x434d3a<_0x27b957[_0x3695b6][_0x1fb7('0x24')];_0x434d3a+=0x1){addVertex(_0x5c1800,_0x27b957[_0x3695b6][_0x434d3a],_0x3695b6);}}else{addVertex(_0x5c1800,_0x27b957[_0x3695b6],_0x3695b6);}}}for(var _0x8fe7f9=0x0;_0x8fe7f9<_0x2be17f[_0x1fb7('0x24')];_0x8fe7f9+=0x1){if(_0x2be17f[_0x8fe7f9][_0x1fb7('0x25')]&&_0x2be17f[_0x8fe7f9][_0x1fb7('0x26')]){_0x5c1800[_0x1fb7('0x27')](_0x2be17f[_0x8fe7f9]['source'],_0x2be17f[_0x8fe7f9][_0x1fb7('0x26')],_0x2be17f[_0x8fe7f9][_0x1fb7('0x28')]);}}return _0x5c1800;}function getSquareProject(_0x42d3ca,_0x35a6c4){rpc[_0x1fb7('0x29')](_0x42d3ca)[_0x1fb7('0x2a')](function(_0x5d2713){_0x35a6c4(null,_0x5d2713);})[_0x1fb7('0x2b')](function(_0x52c07b){_0x35a6c4(null,_0x52c07b);});}function createSquareReport(_0x5f196f,_0xf96eed){rpc[_0x1fb7('0x2c')](_0x5f196f)[_0x1fb7('0x2a')](function(_0x241573){if(_0xf96eed){_0xf96eed(null,_0x241573);}})['catch'](function(_0x3683a0){if(_0xf96eed){_0xf96eed(null,_0x3683a0);}});}function setChannelVariables(_0x468dd0){for(var _0x5c0dca in _0x468dd0){if(_0x468dd0[_0x1fb7('0x20')](_0x5c0dca)){if(_0x5c0dca[_0x1fb7('0x2d')](_0x1fb7('0x2e'))===0x0){_0x468dd0[_0x5c0dca[_0x1fb7('0x2f')](0x4)]=_0x468dd0[_0x5c0dca];delete _0x468dd0[_0x5c0dca];}}}}function getLogFromObject(_0x4a5950){return util[_0x1fb7('0x30')](_0x4a5950,{'showHidden':![],'depth':null});}function agiHandler(_0x254b3f){var _0x2d2071,_0x301e66,_0x474668,_0x1cd970,_0x2e5db7;logger[_0x1fb7('0x31')]('variables',JSON['stringify'](_0x254b3f,null,0x2));logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')](_0x1fb7('0x32'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f[_0x1fb7('0x18')],_0x254b3f[_0x1fb7('0x19')],_0x254b3f[_0x1fb7('0x1a')],_0x254b3f[_0x1fb7('0x1b')]));_0x254b3f['on'](_0x1fb7('0x14'),errorHandler);_0x254b3f['on'](_0x1fb7('0x33'),closeHandler);_0x254b3f['on'](_0x1fb7('0x34'),timeoutHandler);_0x254b3f[_0x1fb7('0x35')]=![];_0x254b3f['on'](_0x1fb7('0x36'),hangupHandler);var _0x35c25b=getSquareProject[_0x1fb7('0x37')](null,_0x254b3f['arg_1']);if(_0x35c25b){if(_0x35c25b[_0x1fb7('0x38')]){_0x2d2071=getRoot(_0x35c25b[_0x1fb7('0x38')]);console[_0x1fb7('0xe')](_0x1fb7('0x39'),_0x2d2071);if(_0x2d2071&&_0x2d2071['start']){logger[_0x1fb7('0x31')]('root',JSON[_0x1fb7('0x3a')](_0x2d2071,null,0x2));_0x254b3f[_0x1fb7('0x3b')]=moment()['format'](_0x1fb7('0x3c'));_0x301e66=initGraph(_[_0x1fb7('0x3d')](_0x2d2071,_0x1fb7('0x22')),_0x2d2071[_0x1fb7('0x22')]);_0x474668=new Vertices(_0x254b3f,rpc,mailRpc);console[_0x1fb7('0xe')](_0x1fb7('0x3e'),_0x474668);logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')](_0x1fb7('0x3f'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f[_0x1fb7('0x18')],_0x254b3f[_0x1fb7('0x19')],_0x254b3f[_0x1fb7('0x1a')],_0x254b3f[_0x1fb7('0x1b')]));console[_0x1fb7('0xe')](_0x1fb7('0x40'));_0x301e66['traverseBFS'](_0x2d2071[_0x1fb7('0x41')]['id'],function(_0x115f31){try{_0x115f31=_0x474668['clear'](_0x115f31);logger['debug'](_0x1fb7('0x42'),JSON[_0x1fb7('0x3a')](_0x115f31,null,0x2));console['log'](_0x1fb7('0x43'),_0x115f31);if(_0x115f31[_0x1fb7('0x44')]===_0x1fb7('0x45')){logger['info'](_0x1fb7('0x46'));_0x254b3f[_0x1fb7('0x47')]=_0x115f31[_0x1fb7('0x47')]||_0x254b3f[_0x1fb7('0x47')];_0x254b3f[_0x1fb7('0x48')]=_0x115f31[_0x1fb7('0x48')];_0x254b3f[_0x1fb7('0x49')]=_0x115f31[_0x1fb7('0x49')]?_0x115f31[_0x1fb7('0x49')]-0x1:0x1;return null;}else if(_0x115f31&&_0x474668[_0x115f31['agicommand']]){_0x2e5db7=_0x474668[_0x115f31[_0x1fb7('0x44')]](_0x115f31);console[_0x1fb7('0xe')](_0x1fb7('0x4a'),_0x2e5db7);logger[_0x1fb7('0x11')]('response',JSON[_0x1fb7('0x3a')](_0x2e5db7,null,0x2));if(_0x2e5db7&&_0x2e5db7[_0x1fb7('0x4b')]===AGI_CODE_SUCCESS&&_0x2e5db7[_0x1fb7('0x4c')]!==AGI_RESULT_ERROR&&!_0x254b3f[_0x1fb7('0x35')]){logger[_0x1fb7('0x31')](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return _[_0x1fb7('0x4e')](_0x2e5db7[_0x1fb7('0x4c')])?null:_0x2e5db7['result'][_0x1fb7('0x4f')]();}else{logger[_0x1fb7('0x14')](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return null;}}else{logger[_0x1fb7('0x14')](_0x1fb7('0x50'));return null;}}catch(_0xa5831a){logger[_0x1fb7('0x14')](_0xa5831a['stack']);return null;}});if(_0x2d2071[_0x1fb7('0x51')]){logger[_0x1fb7('0x11')](util['format'](_0x1fb7('0x52'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f['calleridname'],_0x254b3f['callerid'],_0x254b3f['dnid'],_0x254b3f[_0x1fb7('0x1b')]));_0x301e66[_0x1fb7('0x53')](_0x2d2071['finally']['id'],function(_0x368685){try{_0x368685=_0x474668[_0x1fb7('0x54')](_0x368685);logger[_0x1fb7('0x31')](_0x1fb7('0x42'),JSON[_0x1fb7('0x3a')](_0x368685,null,0x2));if(_0x368685&&_0x474668[_0x368685[_0x1fb7('0x44')]]){_0x2e5db7=_0x474668[_0x368685[_0x1fb7('0x44')]](_0x368685);if(_0x2e5db7){logger[_0x1fb7('0x31')](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return _[_0x1fb7('0x4e')](_0x2e5db7['result'])?null:_0x2e5db7[_0x1fb7('0x4c')]['toString']();}else{logger['error'](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return null;}}else{logger[_0x1fb7('0x14')](_0x1fb7('0x50'));return null;}}catch(_0x5c6ac0){logger[_0x1fb7('0x14')](_0x5c6ac0[_0x1fb7('0xd')]);return null;}});}logger[_0x1fb7('0x11')](util['format'](_0x1fb7('0x55'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f['calleridname'],_0x254b3f['callerid'],_0x254b3f[_0x1fb7('0x1a')],_0x254b3f['uniqueid']));logger['info'](util[_0x1fb7('0x15')](_0x1fb7('0x56'),_0x254b3f[_0x1fb7('0x47')],_0x254b3f[_0x1fb7('0x48')],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1));_0x254b3f[_0x1fb7('0x57')](_0x254b3f[_0x1fb7('0x47')],_0x254b3f['extension'],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1);_0x254b3f[_0x1fb7('0x33')]();}}else{logger[_0x1fb7('0x14')](util[_0x1fb7('0x15')](_0x1fb7('0x58'),_0x254b3f[_0x1fb7('0x17')]));_0x254b3f[_0x1fb7('0x57')](_0x254b3f['context'],_0x254b3f[_0x1fb7('0x48')],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1);_0x254b3f['close']();}}else{logger['error'](util[_0x1fb7('0x15')](_0x1fb7('0x59'),_0x254b3f[_0x1fb7('0x17')]));_0x254b3f[_0x1fb7('0x57')](_0x254b3f[_0x1fb7('0x47')],_0x254b3f[_0x1fb7('0x48')],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1);_0x254b3f[_0x1fb7('0x33')]();}}function main(){var _0x52f704;return utilLicense[_0x1fb7('0x5a')]()[_0x1fb7('0x2a')](function(_0x506b6a){if(_0x506b6a){if(_0x506b6a[_0x1fb7('0x5b')]){if(_0x506b6a[_0x1fb7('0x5c')]&&_0x506b6a[_0x1fb7('0x5c')]>0x0){logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x506b6a[_0x1fb7('0x5c')]));_0x52f704=_0x506b6a[_0x1fb7('0x5c')];}else{logger[_0x1fb7('0x11')](_0x1fb7('0x5d'));}}else{logger[_0x1fb7('0x11')](_0x1fb7('0x5e'));_0x52f704=-0x1;}}})[_0x1fb7('0x2b')](function(_0x58c593){logger[_0x1fb7('0x14')]('[LICENSE]',_0x58c593[_0x1fb7('0xd')]);})[_0x1fb7('0x51')](function(){var _0x1d1343=require(_0x1fb7('0x5f'))(config[_0x1fb7('0x5')][_0x1fb7('0x10')],config[_0x1fb7('0x5')]['ip'],_0x52f704);_0x1d1343['on']('error',errorHandler);_0x1d1343['on'](_0x1fb7('0x60'),listeningHandler);_0x1d1343['on'](_0x1fb7('0x61'),connectionHandler);_0x1d1343['on'](_0x1fb7('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0xb847=['addVertex','omit','isArray','length','target','value','getSquareProject','then','catch','agi_','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','production','log','SQUAREROOT','start','YYYY-MM-DD\x20HH:mm:ss','mxCell','LOOP\x20through\x20graph','traverseBFS','debug','vertex','VERTEX','context','extension','priority','vresponse','response','code','result','isUndefined','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','close','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xb847,0x17e));var _0x7b84=function(_0x560d2a,_0x4a9f54){_0x560d2a=_0x560d2a-0x0;var _0x3df62d=_0xb847[_0x560d2a];return _0x3df62d;};'use strict';var parser=require(_0x7b84('0x0'));var _=require(_0x7b84('0x1'));var syncho=require('syncho');var util=require(_0x7b84('0x2'));var moment=require('moment');var config=require(_0x7b84('0x3'));var logger=require(_0x7b84('0x4'))(_0x7b84('0x5'));var utilLicense=require(_0x7b84('0x6'));var rpc=require(_0x7b84('0x7'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7b84('0x5')]=_[_0x7b84('0x8')](config[_0x7b84('0x5')],{'ip':_0x7b84('0x9'),'port':0x11dd});function connectionHandler(_0x17bf9b){process[_0x7b84('0xa')](function(){syncho(function(){try{setChannelVariables(_0x17bf9b);agiHandler(_0x17bf9b);}catch(_0x2841e4){logger[_0x7b84('0xb')](_0x2841e4[_0x7b84('0xc')]);}});});}function listeningHandler(){console['log'](_0x7b84('0xd'),config[_0x7b84('0x5')][_0x7b84('0xe')]);logger['info'](util['format'](_0x7b84('0xf'),config['agi']['ip'],config[_0x7b84('0x5')][_0x7b84('0xe')]));}function errorHandler(_0x45f3da){if(_0x45f3da&&_0x45f3da[_0x7b84('0x10')]&&_0x45f3da[_0x7b84('0x11')]){logger['error'](util['format']('[%s]\x20%s',_0x45f3da[_0x7b84('0x10')],_0x45f3da[_0x7b84('0x11')]));}else{logger[_0x7b84('0xb')](util[_0x7b84('0x12')](_0x7b84('0x13'),_0x45f3da[_0x7b84('0xc')]));}}function closeHandler(){logger[_0x7b84('0x14')](util[_0x7b84('0x12')](_0x7b84('0x15'),this[_0x7b84('0x16')],this[_0x7b84('0x17')],this[_0x7b84('0x18')],this[_0x7b84('0x19')],this[_0x7b84('0x1a')]));try{createSquareReport(this);}catch(_0xb2569e){logger['error'](_0xb2569e['stack']);}}function timeoutHandler(){logger[_0x7b84('0x14')](util[_0x7b84('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x7b84('0x18')],this[_0x7b84('0x19')],this[_0x7b84('0x1a')]));}function hangupHandler(){logger[_0x7b84('0x14')](util[_0x7b84('0x12')](_0x7b84('0x1b'),this[_0x7b84('0x16')],this[_0x7b84('0x17')],this['callerid'],this[_0x7b84('0x19')],this[_0x7b84('0x1a')]));this[_0x7b84('0x1c')]=!![];}function getRoot(_0x53fb34){return parser[_0x7b84('0x1d')](_0x53fb34,{'object':!![]})[_0x7b84('0x1e')]['root'];}function addVertex(_0x1ac0a8,_0x4fb367,_0x12d084){_0x4fb367[_0x7b84('0x1f')]=_0x12d084;if(_0x4fb367[_0x7b84('0x20')]('retry')){_0x4fb367['maxRetry']=parseInt(_0x4fb367['retry'],0xa);}_0x1ac0a8[_0x7b84('0x21')](_[_0x7b84('0x22')](_0x4fb367,'mxCell'));}function initGraph(_0x1b11cc,_0x344c50){var _0x4d57f5=new Graph();for(var _0x5a2697 in _0x1b11cc){if(_0x1b11cc['hasOwnProperty'](_0x5a2697)){if(_[_0x7b84('0x23')](_0x1b11cc[_0x5a2697])){for(var _0xd0b996=0x0;_0xd0b996<_0x1b11cc[_0x5a2697][_0x7b84('0x24')];_0xd0b996+=0x1){addVertex(_0x4d57f5,_0x1b11cc[_0x5a2697][_0xd0b996],_0x5a2697);}}else{addVertex(_0x4d57f5,_0x1b11cc[_0x5a2697],_0x5a2697);}}}for(var _0x393b13=0x0;_0x393b13<_0x344c50[_0x7b84('0x24')];_0x393b13+=0x1){if(_0x344c50[_0x393b13]['source']&&_0x344c50[_0x393b13]['target']){_0x4d57f5['addEdge'](_0x344c50[_0x393b13]['source'],_0x344c50[_0x393b13][_0x7b84('0x25')],_0x344c50[_0x393b13][_0x7b84('0x26')]);}}return _0x4d57f5;}function getSquareProject(_0x4df1fd,_0x2ee2d5){rpc[_0x7b84('0x27')](_0x4df1fd)[_0x7b84('0x28')](function(_0x495c7d){_0x2ee2d5(null,_0x495c7d);})[_0x7b84('0x29')](function(_0x5c836e){_0x2ee2d5(null,_0x5c836e);});}function createSquareReport(_0x334cc2,_0x59a5bc){rpc['createSquareReport'](_0x334cc2)[_0x7b84('0x28')](function(_0x5c0bea){if(_0x59a5bc){_0x59a5bc(null,_0x5c0bea);}})[_0x7b84('0x29')](function(_0x193095){if(_0x59a5bc){_0x59a5bc(null,_0x193095);}});}function setChannelVariables(_0x20c388){for(var _0x11eb5e in _0x20c388){if(_0x20c388[_0x7b84('0x20')](_0x11eb5e)){if(_0x11eb5e['indexOf'](_0x7b84('0x2a'))===0x0){_0x20c388[_0x11eb5e['substring'](0x4)]=_0x20c388[_0x11eb5e];delete _0x20c388[_0x11eb5e];}}}}function getLogFromObject(_0x34528a){return util[_0x7b84('0x2b')](_0x34528a,{'showHidden':![],'depth':null});}function agiHandler(_0x554955){var _0x17fa40,_0x3029ad,_0x11e385,_0x1c01dd,_0x552b9d;logger['debug'](_0x7b84('0x2c'),JSON[_0x7b84('0x2d')](_0x554955,null,0x2));logger[_0x7b84('0x14')](util['format'](_0x7b84('0x2e'),_0x554955[_0x7b84('0x16')],_0x554955[_0x7b84('0x17')],_0x554955[_0x7b84('0x18')],_0x554955[_0x7b84('0x19')],_0x554955['uniqueid']));_0x554955['on'](_0x7b84('0xb'),errorHandler);_0x554955['on']('close',closeHandler);_0x554955['on'](_0x7b84('0x2f'),timeoutHandler);_0x554955[_0x7b84('0x1c')]=![];_0x554955['on'](_0x7b84('0x30'),hangupHandler);var _0x36c783=getSquareProject['sync'](null,_0x554955[_0x7b84('0x16')]);if(_0x36c783){if(_0x36c783[_0x7b84('0x31')]){_0x17fa40=getRoot(_0x36c783[_0x7b84('0x31')]);console[_0x7b84('0x32')](_0x7b84('0x33'),_0x17fa40);if(_0x17fa40&&_0x17fa40[_0x7b84('0x34')]){logger['debug']('root',JSON[_0x7b84('0x2d')](_0x17fa40,null,0x2));_0x554955['joinAt']=moment()[_0x7b84('0x12')](_0x7b84('0x35'));_0x3029ad=initGraph(_[_0x7b84('0x22')](_0x17fa40,_0x7b84('0x36')),_0x17fa40['mxCell']);_0x11e385=new Vertices(_0x554955,rpc,mailRpc);console[_0x7b84('0x32')]('vertices',_0x11e385);logger['info'](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x554955[_0x7b84('0x16')],_0x554955[_0x7b84('0x17')],_0x554955[_0x7b84('0x18')],_0x554955[_0x7b84('0x19')],_0x554955[_0x7b84('0x1a')]));console[_0x7b84('0x32')](_0x7b84('0x37'));_0x3029ad[_0x7b84('0x38')](_0x17fa40[_0x7b84('0x34')]['id'],function(_0xab01ea){try{_0xab01ea=_0x11e385['clear'](_0xab01ea);logger[_0x7b84('0x39')](_0x7b84('0x3a'),JSON[_0x7b84('0x2d')](_0xab01ea,null,0x2));console[_0x7b84('0x32')](_0x7b84('0x3b'),_0xab01ea);if(_0xab01ea[_0x7b84('0x1f')]==='gotoc'){logger[_0x7b84('0x14')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x554955[_0x7b84('0x3c')]=_0xab01ea[_0x7b84('0x3c')]||_0x554955[_0x7b84('0x3c')];_0x554955[_0x7b84('0x3d')]=_0xab01ea[_0x7b84('0x3d')];_0x554955['priority']=_0xab01ea[_0x7b84('0x3e')]?_0xab01ea[_0x7b84('0x3e')]-0x1:0x1;return null;}else if(_0xab01ea&&_0x11e385[_0xab01ea[_0x7b84('0x1f')]]){_0x552b9d=_0x11e385[_0xab01ea[_0x7b84('0x1f')]](_0xab01ea);console[_0x7b84('0x32')](_0x7b84('0x3f'),_0x552b9d);logger['info'](_0x7b84('0x40'),JSON['stringify'](_0x552b9d,null,0x2));if(_0x552b9d&&_0x552b9d[_0x7b84('0x41')]===AGI_CODE_SUCCESS&&_0x552b9d[_0x7b84('0x42')]!==AGI_RESULT_ERROR&&!_0x554955[_0x7b84('0x1c')]){logger[_0x7b84('0x39')](_0x7b84('0x40'),getLogFromObject(_0x552b9d));return _[_0x7b84('0x43')](_0x552b9d['result'])?null:_0x552b9d['result'][_0x7b84('0x44')]();}else{logger[_0x7b84('0xb')](_0x7b84('0x40'),getLogFromObject(_0x552b9d));return null;}}else{logger[_0x7b84('0xb')](_0x7b84('0x45'));return null;}}catch(_0xcd9373){logger[_0x7b84('0xb')](_0xcd9373[_0x7b84('0xc')]);return null;}});if(_0x17fa40[_0x7b84('0x46')]){logger[_0x7b84('0x14')](util[_0x7b84('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x554955[_0x7b84('0x16')],_0x554955[_0x7b84('0x17')],_0x554955[_0x7b84('0x18')],_0x554955[_0x7b84('0x19')],_0x554955['uniqueid']));_0x3029ad[_0x7b84('0x38')](_0x17fa40['finally']['id'],function(_0x2f27ee){try{_0x2f27ee=_0x11e385[_0x7b84('0x47')](_0x2f27ee);logger[_0x7b84('0x39')](_0x7b84('0x3a'),JSON['stringify'](_0x2f27ee,null,0x2));if(_0x2f27ee&&_0x11e385[_0x2f27ee[_0x7b84('0x1f')]]){_0x552b9d=_0x11e385[_0x2f27ee[_0x7b84('0x1f')]](_0x2f27ee);if(_0x552b9d){logger['debug'](_0x7b84('0x40'),getLogFromObject(_0x552b9d));return _[_0x7b84('0x43')](_0x552b9d[_0x7b84('0x42')])?null:_0x552b9d[_0x7b84('0x42')][_0x7b84('0x44')]();}else{logger[_0x7b84('0xb')](_0x7b84('0x40'),getLogFromObject(_0x552b9d));return null;}}else{logger[_0x7b84('0xb')](_0x7b84('0x45'));return null;}}catch(_0x4d5979){logger[_0x7b84('0xb')](_0x4d5979['stack']);return null;}});}logger[_0x7b84('0x14')](util[_0x7b84('0x12')](_0x7b84('0x48'),_0x554955[_0x7b84('0x16')],_0x554955[_0x7b84('0x17')],_0x554955['callerid'],_0x554955[_0x7b84('0x19')],_0x554955[_0x7b84('0x1a')]));logger[_0x7b84('0x14')](util[_0x7b84('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x554955[_0x7b84('0x3c')],_0x554955['extension'],parseInt(_0x554955[_0x7b84('0x3e')],0xa)+0x1));_0x554955['continueAt'](_0x554955[_0x7b84('0x3c')],_0x554955[_0x7b84('0x3d')],parseInt(_0x554955['priority'],0xa)+0x1);_0x554955[_0x7b84('0x49')]();}}else{logger[_0x7b84('0xb')](util[_0x7b84('0x12')]('Project\x20%s\x20not\x20published',_0x554955[_0x7b84('0x16')]));_0x554955[_0x7b84('0x4a')](_0x554955[_0x7b84('0x3c')],_0x554955['extension'],parseInt(_0x554955[_0x7b84('0x3e')],0xa)+0x1);_0x554955[_0x7b84('0x49')]();}}else{logger[_0x7b84('0xb')](util[_0x7b84('0x12')]('Project\x20%s\x20not\x20found',_0x554955[_0x7b84('0x16')]));_0x554955[_0x7b84('0x4a')](_0x554955[_0x7b84('0x3c')],_0x554955[_0x7b84('0x3d')],parseInt(_0x554955[_0x7b84('0x3e')],0xa)+0x1);_0x554955[_0x7b84('0x49')]();}}function main(){var _0xdc36d3;return utilLicense[_0x7b84('0x4b')]()[_0x7b84('0x28')](function(_0x48b585){if(_0x48b585){if(_0x48b585[_0x7b84('0x4c')]){if(_0x48b585[_0x7b84('0x4d')]&&_0x48b585[_0x7b84('0x4d')]>0x0){logger['info'](util['format'](_0x7b84('0x4e'),_0x48b585[_0x7b84('0x4d')]));_0xdc36d3=_0x48b585[_0x7b84('0x4d')];}else{logger['info'](_0x7b84('0x4f'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xdc36d3=-0x1;}}})['catch'](function(_0x413796){logger[_0x7b84('0xb')](_0x7b84('0x50'),_0x413796[_0x7b84('0xc')]);})[_0x7b84('0x46')](function(){var _0x210f00=require(_0x7b84('0x51'))(config[_0x7b84('0x5')][_0x7b84('0xe')],config[_0x7b84('0x5')]['ip'],_0xdc36d3);_0x210f00['on']('error',errorHandler);_0x210f00['on'](_0x7b84('0x52'),listeningHandler);_0x210f00['on']('connection',connectionHandler);_0x210f00['on']('close',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 b55c60a..8fecc08 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4f198f,_0x518ca3){var _0x3ae1cd=function(_0x5ab2fb){while(--_0x5ab2fb){_0x4f198f['push'](_0x4f198f['shift']());}};_0x3ae1cd(++_0x518ca3);}(_0x34e8,0x12c));var _0x834e=function(_0x44b082,_0x572901){_0x44b082=_0x44b082-0x0;var _0x39255c=_0x34e8[_0x44b082];return _0x39255c;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x584d68,_0x21088d){var _0x374130=function(_0x668787){while(--_0x668787){_0x584d68['push'](_0x584d68['shift']());}};_0x374130(++_0x21088d);}(_0x34e8,0x12c));var _0x834e=function(_0x18eb74,_0x3e9141){_0x18eb74=_0x18eb74-0x0;var _0x295259=_0x34e8[_0x18eb74];return _0x295259;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 55c7d25..6e0455b 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(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0xb10b[_0x2e2c1b];return _0x43a4f2;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x4bb93d,_0x1cda9a){var _0x106b4f=function(_0x4aa8d1){while(--_0x4aa8d1){_0x4bb93d['push'](_0x4bb93d['shift']());}};_0x106b4f(++_0x1cda9a);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe86b07,_0x28ad1f){_0xe86b07=_0xe86b07-0x0;var _0x128e88=_0x5f2f[_0xe86b07];return _0x128e88;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 202daa3..49e4a90 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 _0x9fe3=['ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','dsn','getUserById','ShowUser','log','rpcreq','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById'];(function(_0x55261e,_0x1466ae){var _0x51714e=function(_0x23f5ba){while(--_0x23f5ba){_0x55261e['push'](_0x55261e['shift']());}};_0x51714e(++_0x1466ae);}(_0x9fe3,0x70));var _0x39fe=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x9fe3[_0x455c6c];return _0x488242;};'use strict';var BPromise=require(_0x39fe('0x0'));var moment=require('moment');var _=require(_0x39fe('0x1'));var util=require(_0x39fe('0x2'));var jayson=require(_0x39fe('0x3'));var client=jayson[_0x39fe('0x4')][_0x39fe('0x5')]({'port':0x2329});function request(_0x3e1876,_0x4831fe){return new BPromise(function(_0x4e25b3,_0x324bc0){return client[_0x39fe('0x6')](_0x3e1876,_0x4831fe)[_0x39fe('0x7')](function(_0x33b3db){if(_0x33b3db[_0x39fe('0x8')]){return _0x324bc0(_0x33b3db[_0x39fe('0x8')][_0x39fe('0x9')]);}else{return _0x4e25b3(_0x33b3db[_0x39fe('0xa')]);}})[_0x39fe('0xb')](function(_0x4e1b21){return _0x324bc0(_0x4e1b21);});});}exports[_0x39fe('0xc')]=function(_0x308de4){return request(_0x39fe('0xd'),{'options':{'raw':![],'where':{'name':_0x308de4},'attributes':[_0x39fe('0xe')]}});};exports[_0x39fe('0xf')]=function(_0x5df3b5){return request(_0x39fe('0x10'),{'options':{'raw':![],'where':{'id':_0x5df3b5},'include':[{'model':_0x39fe('0x11'),'as':_0x39fe('0x12')}],'attributes':['id',_0x39fe('0x13'),_0x39fe('0x14')]}});};exports[_0x39fe('0x15')]=function(_0x33b793){return request(_0x39fe('0xd'),{'options':{'where':{'id':_0x33b793},'attributes':[_0x39fe('0x13')]}});};exports[_0x39fe('0x16')]=function(_0x2bc3e6){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2bc3e6},'attributes':[_0x39fe('0x13')]}});};exports[_0x39fe('0x17')]=function(_0x315c25){return request(_0x39fe('0x18'),{'options':{'where':{'id':_0x315c25},'attributes':[_0x39fe('0x13')]}});};exports['getSquareOdbcById']=function(_0xb2bbc){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xb2bbc},'attributes':[_0x39fe('0x19')]}});};exports[_0x39fe('0x1a')]=function(_0x4f3cf2){return request(_0x39fe('0x1b'),{'options':{'where':{'id':_0x4f3cf2},'attributes':[_0x39fe('0x13')]}});};exports['getContactByPhone']=function(_0x470eca){console[_0x39fe('0x1c')](_0x39fe('0x1d'),_0x470eca);return request(_0x39fe('0x1e'),{'options':{'where':{'phone':_0x470eca[_0x39fe('0x1f')]},'attributes':['id']}});};exports[_0x39fe('0x20')]=function(_0x5e38b8){return request(_0x39fe('0x21'),{'options':{'where':{'id':_0x5e38b8},'attributes':['name']}});};exports[_0x39fe('0x22')]=function(_0x278d68){return request(_0x39fe('0x23'),{'options':{'where':{'id':_0x278d68},'attributes':[_0x39fe('0x24')]}});};exports[_0x39fe('0x25')]=function(_0x4bee94){return request(_0x39fe('0x26'),{'options':{'raw':![],'where':{'id':_0x4bee94},'include':[{'model':_0x39fe('0x27'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x32e3c1){return request(_0x39fe('0x28'),{'options':{'where':{'id':_0x32e3c1},'attributes':['id',_0x39fe('0x13')]}});};exports[_0x39fe('0x29')]=function(_0x3f7168){return request(_0x39fe('0x2a'),{'body':_0x3f7168});};exports[_0x39fe('0x2b')]=function(_0xbd7c2d){return request(_0x39fe('0x2c'),{'body':_0xbd7c2d});};exports['createSquareReport']=function(_0x1824e6){return request('CreateSquareReport',{'body':_['merge'](_0x1824e6,{'project_name':_0x1824e6[_0x39fe('0x2d')],'prev_project_name':_0x1824e6[_0x39fe('0x2e')]||'','is_subproject':_0x1824e6[_0x39fe('0x2e')]?!![]:![],'leaveAt':moment()[_0x39fe('0x2f')](_0x39fe('0x30'))})});};exports['createSquareRecording']=function(_0x1eeca2){return request(_0x39fe('0x31'),{'body':_0x1eeca2});};exports[_0x39fe('0x32')]=function(_0x51f3fc){return request(_0x39fe('0x33'),{'body':_0x51f3fc});};exports[_0x39fe('0x34')]=function(_0x1e4a05){return request(_0x39fe('0x35'),{'options':{'raw':![],'where':{'phone':_0x1e4a05['phone'],'ListId':_0x1e4a05[_0x39fe('0x36')]}}})[_0x39fe('0x7')](function(_0x11808c){if(_0x11808c){return _0x11808c;}return request('CreateCmContact',{'body':_0x1e4a05});});};exports[_0x39fe('0x37')]=function(_0x24970e){return request(_0x39fe('0x38'),{'options':{'where':{'id':_0x24970e},'attributes':[_0x39fe('0x13')]}});};exports[_0x39fe('0x39')]=function(_0x36eac6,_0x537932){return request(_0x39fe('0x3a'),{'body':{'interface':_0x537932},'options':{'where':_0x36eac6}});};exports[_0x39fe('0x3b')]=function(_0x19573b,_0x111945,_0x27cc0c){return request(_0x39fe('0x3c'),{'body':{'type':_0x111945,'uniqueid':_0x27cc0c},'options':{'where':_0x19573b}});};exports[_0x39fe('0x3d')]=function(_0x207645){return request(_0x39fe('0x3e'),{'body':{},'options':{'where':_0x207645}});};exports['agentLogout']=function(_0x248449){return request(_0x39fe('0x3f'),{'body':{},'options':{'where':_0x248449}});}; \ No newline at end of file +var _0x6b6b=['getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','util','jayson/promise','http','request','then','error','message','result','catch','getSquareProject','production','getMailAccountById','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','log','rpcreq','GetContactByPhone','ShowTrunk'];(function(_0x325d8a,_0x555c37){var _0x3287e7=function(_0xc64171){while(--_0xc64171){_0x325d8a['push'](_0x325d8a['shift']());}};_0x3287e7(++_0x555c37);}(_0x6b6b,0x1a0));var _0xb6b6=function(_0x5ac77a,_0x10c7c1){_0x5ac77a=_0x5ac77a-0x0;var _0x830047=_0x6b6b[_0x5ac77a];return _0x830047;};'use strict';var BPromise=require(_0xb6b6('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0xb6b6('0x1'));var jayson=require(_0xb6b6('0x2'));var client=jayson['client'][_0xb6b6('0x3')]({'port':0x2329});function request(_0x3a965d,_0x571e8b){return new BPromise(function(_0x3d7d1b,_0x5063eb){return client[_0xb6b6('0x4')](_0x3a965d,_0x571e8b)[_0xb6b6('0x5')](function(_0x384861){if(_0x384861[_0xb6b6('0x6')]){return _0x5063eb(_0x384861[_0xb6b6('0x6')][_0xb6b6('0x7')]);}else{return _0x3d7d1b(_0x384861[_0xb6b6('0x8')]);}})[_0xb6b6('0x9')](function(_0x2bd1f4){return _0x5063eb(_0x2bd1f4);});});}exports[_0xb6b6('0xa')]=function(_0x2ac73b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2ac73b},'attributes':[_0xb6b6('0xb')]}});};exports[_0xb6b6('0xc')]=function(_0x2088dc){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2088dc},'include':[{'model':_0xb6b6('0xd'),'as':_0xb6b6('0xe')}],'attributes':['id','name',_0xb6b6('0xf')]}});};exports[_0xb6b6('0x10')]=function(_0x147669){return request(_0xb6b6('0x11'),{'options':{'where':{'id':_0x147669},'attributes':[_0xb6b6('0x12')]}});};exports[_0xb6b6('0x13')]=function(_0x27b0b3){return request(_0xb6b6('0x14'),{'options':{'where':{'id':_0x27b0b3},'attributes':[_0xb6b6('0x12')]}});};exports[_0xb6b6('0x15')]=function(_0x1d432f){return request('ShowVariable',{'options':{'where':{'id':_0x1d432f},'attributes':['name']}});};exports[_0xb6b6('0x16')]=function(_0xeff0a8){return request(_0xb6b6('0x17'),{'options':{'where':{'id':_0xeff0a8},'attributes':[_0xb6b6('0x18')]}});};exports[_0xb6b6('0x19')]=function(_0x1b3f2f){return request(_0xb6b6('0x1a'),{'options':{'where':{'id':_0x1b3f2f},'attributes':[_0xb6b6('0x12')]}});};exports[_0xb6b6('0x1b')]=function(_0xc91d57){console[_0xb6b6('0x1c')](_0xb6b6('0x1d'),_0xc91d57);return request(_0xb6b6('0x1e'),{'options':{'where':{'phone':_0xc91d57['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x3d9aa9){return request(_0xb6b6('0x1f'),{'options':{'where':{'id':_0x3d9aa9},'attributes':[_0xb6b6('0x12')]}});};exports[_0xb6b6('0x20')]=function(_0x5e1cd2){return request(_0xb6b6('0x21'),{'options':{'where':{'id':_0x5e1cd2},'attributes':[_0xb6b6('0x22')]}});};exports[_0xb6b6('0x23')]=function(_0x2deeb0){return request(_0xb6b6('0x24'),{'options':{'raw':![],'where':{'id':_0x2deeb0},'include':[{'model':'Interval','as':_0xb6b6('0x25')}]}});};exports[_0xb6b6('0x26')]=function(_0x127f20){return request('ShowSmsAccount',{'options':{'where':{'id':_0x127f20},'attributes':['id',_0xb6b6('0x12')]}});};exports['createSmsMessage']=function(_0x24c73a){return request(_0xb6b6('0x27'),{'body':_0x24c73a});};exports[_0xb6b6('0x28')]=function(_0x526a2a){return request(_0xb6b6('0x29'),{'body':_0x526a2a});};exports[_0xb6b6('0x2a')]=function(_0x427c2d){return request(_0xb6b6('0x2b'),{'body':_[_0xb6b6('0x2c')](_0x427c2d,{'project_name':_0x427c2d[_0xb6b6('0x2d')],'prev_project_name':_0x427c2d[_0xb6b6('0x2e')]||'','is_subproject':_0x427c2d[_0xb6b6('0x2e')]?!![]:![],'leaveAt':moment()[_0xb6b6('0x2f')](_0xb6b6('0x30'))})});};exports[_0xb6b6('0x31')]=function(_0x4b47d1){return request(_0xb6b6('0x32'),{'body':_0x4b47d1});};exports['createSquareMessage']=function(_0x180528){return request('CreateSquareMessage',{'body':_0x180528});};exports['createCmContact']=function(_0x19a947){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x19a947[_0xb6b6('0x33')],'ListId':_0x19a947[_0xb6b6('0x34')]}}})[_0xb6b6('0x5')](function(_0x501e6c){if(_0x501e6c){return _0x501e6c;}return request(_0xb6b6('0x35'),{'body':_0x19a947});});};exports[_0xb6b6('0x36')]=function(_0x4baa7a){return request(_0xb6b6('0x37'),{'options':{'where':{'id':_0x4baa7a},'attributes':['name']}});};exports[_0xb6b6('0x38')]=function(_0x4247f5,_0x36f91b){return request(_0xb6b6('0x39'),{'body':{'interface':_0x36f91b},'options':{'where':_0x4247f5}});};exports[_0xb6b6('0x3a')]=function(_0x118a4b,_0x2fcfd8,_0x1726a8){return request(_0xb6b6('0x3b'),{'body':{'type':_0x2fcfd8,'uniqueid':_0x1726a8},'options':{'where':_0x118a4b}});};exports[_0xb6b6('0x3c')]=function(_0x3700eb){return request(_0xb6b6('0x3d'),{'body':{},'options':{'where':_0x3700eb}});};exports[_0xb6b6('0x3e')]=function(_0x4e8d9b){return request(_0xb6b6('0x3f'),{'body':{},'options':{'where':_0x4e8d9b}});}; \ 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 32aee46..8dcbb2e 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 _0x0e85=['./polly','./lex'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x0e85,0x7c));var _0x50e8=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x0e85[_0x38537f];return _0x141e23;};var polly=require(_0x50e8('0x0'));var lex=require(_0x50e8('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x34e5=['./lex'];(function(_0x580a59,_0x21266c){var _0x19da51=function(_0x772ac8){while(--_0x772ac8){_0x580a59['push'](_0x580a59['shift']());}};_0x19da51(++_0x21266c);}(_0x34e5,0x172));var _0x534e=function(_0x5a0f92,_0x17dc03){_0x5a0f92=_0x5a0f92-0x0;var _0x1e19df=_0x34e5[_0x5a0f92];return _0x1e19df;};var polly=require('./polly');var lex=require(_0x534e('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 2ab729b..e5f5f86 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 _0xc997=['exports'];(function(_0x1fb755,_0x43f699){var _0x484190=function(_0x20b282){while(--_0x20b282){_0x1fb755['push'](_0x1fb755['shift']());}};_0x484190(++_0x43f699);}(_0xc997,0x1ac));var _0x7c99=function(_0x598cf7,_0xe52881){_0x598cf7=_0x598cf7-0x0;var _0x4508d2=_0xc997[_0x598cf7];return _0x4508d2;};'use strict';var lex=require('./lib/api');module[_0x7c99('0x0')]=function(_0x3b4b36,_0x2032f1,_0x3997dc,_0x17f440,_0x4e5e4d,_0x2226d5){return lex(_0x3b4b36,_0x2032f1,_0x3997dc,_0x17f440,_0x4e5e4d,_0x2226d5);}; \ No newline at end of file +var _0x5db8=['exports','./lib/api'];(function(_0x27c7b1,_0x37647c){var _0x325fc1=function(_0x324c5e){while(--_0x324c5e){_0x27c7b1['push'](_0x27c7b1['shift']());}};_0x325fc1(++_0x37647c);}(_0x5db8,0xbb));var _0x85db=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x5db8[_0x31cb5f];return _0x586042;};'use strict';var lex=require(_0x85db('0x0'));module[_0x85db('0x1')]=function(_0x2d48b1,_0x4f036f,_0x14ab3d,_0x16c069,_0x42c47f,_0x491c88){return lex(_0x2d48b1,_0x4f036f,_0x14ab3d,_0x16c069,_0x42c47f,_0x491c88);}; \ 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 192effd..cfdb8f8 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 _0xe0e1=['LexRuntime','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x9584a9,_0x413cec){var _0x2b3b6e=function(_0x5d4b29){while(--_0x5d4b29){_0x9584a9['push'](_0x9584a9['shift']());}};_0x2b3b6e(++_0x413cec);}(_0xe0e1,0x146));var _0x1e0e=function(_0x1e9d21,_0x3a0e3e){_0x1e9d21=_0x1e9d21-0x0;var _0x30efcb=_0xe0e1[_0x1e9d21];return _0x30efcb;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x1e0e('0x0'));function lexResult(_0x356fbb,_0x46ebea){return new BPromise(function(_0x50304e,_0x1f832e){_0x356fbb[_0x1e0e('0x1')](_0x46ebea,function(_0x2ee711,_0x5ad8c9){if(_0x2ee711){_0x1f832e(_0x2ee711);}if(_0x5ad8c9[_0x1e0e('0x2')]){for(const _0x2b8a9f in _0x5ad8c9['slots']){if(_0x5ad8c9[_0x1e0e('0x2')][_0x1e0e('0x3')](_0x2b8a9f)){var _0x153159=_0x5ad8c9[_0x1e0e('0x2')][_0x2b8a9f];_0x5ad8c9['slot_'+_0x2b8a9f]=_0x153159;}}}_0x50304e(_0x5ad8c9);});});}module['exports']=function(_0x110544,_0x10b7db,_0x4d0585,_0x2d436d,_0x1c7840,_0x1f9475){var _0xde033c=new AWS[(_0x1e0e('0x4'))]({'accessKeyId':_0x10b7db,'secretAccessKey':_0x4d0585,'region':_0x2d436d});var _0x2c9ccf={'botAlias':'$LATEST','botName':_0x1f9475,'inputText':_0x1c7840,'userId':_0x110544};return lexResult(_0xde033c,_0x2c9ccf);}; \ No newline at end of file +var _0x9b25=['exports','LexRuntime','$LATEST','postText','slots','hasOwnProperty'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9b25,0xf9));var _0x59b2=function(_0x203bd0,_0x24f853){_0x203bd0=_0x203bd0-0x0;var _0x2c2015=_0x9b25[_0x203bd0];return _0x2c2015;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x22af43,_0x5196ca){return new BPromise(function(_0x123c52,_0x481019){_0x22af43[_0x59b2('0x0')](_0x5196ca,function(_0x318108,_0x4bc8c1){if(_0x318108){_0x481019(_0x318108);}if(_0x4bc8c1[_0x59b2('0x1')]){for(const _0xf5355b in _0x4bc8c1[_0x59b2('0x1')]){if(_0x4bc8c1[_0x59b2('0x1')][_0x59b2('0x2')](_0xf5355b)){var _0xc38ae5=_0x4bc8c1['slots'][_0xf5355b];_0x4bc8c1['slot_'+_0xf5355b]=_0xc38ae5;}}}_0x123c52(_0x4bc8c1);});});}module[_0x59b2('0x3')]=function(_0x1a27d6,_0x5c4ed8,_0x586c55,_0x2929d2,_0x211c98,_0x98595c){var _0x1d0863=new AWS[(_0x59b2('0x4'))]({'accessKeyId':_0x5c4ed8,'secretAccessKey':_0x586c55,'region':_0x2929d2});var _0x1ea20a={'botAlias':_0x59b2('0x5'),'botName':_0x98595c,'inputText':_0x211c98,'userId':_0x1a27d6};return lexResult(_0x1d0863,_0x1ea20a);}; \ 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 a35bf27..1a20e64 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 _0xff59=['./lib/api','exports'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0xff59,0x6c));var _0x9ff5=function(_0x515cd8,_0x4c78e1){_0x515cd8=_0x515cd8-0x0;var _0x23aeb3=_0xff59[_0x515cd8];return _0x23aeb3;};'use strict';var polly=require(_0x9ff5('0x0'));module[_0x9ff5('0x1')]=function(_0x219056,_0x1aa54c,_0x5351e2,_0x4b82f4,_0x1427d6,_0x3d8a17,_0x4586b3){return polly(_0x219056,_0x1aa54c,_0x5351e2,_0x4b82f4,_0x1427d6,_0x3d8a17,_0x4586b3);}; \ No newline at end of file +var _0x5467=['exports','./lib/api'];(function(_0x532c32,_0x35381d){var _0x188179=function(_0x31b4e3){while(--_0x31b4e3){_0x532c32['push'](_0x532c32['shift']());}};_0x188179(++_0x35381d);}(_0x5467,0x1b1));var _0x7546=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5467[_0x14add3];return _0x4a174f;};'use strict';var polly=require(_0x7546('0x0'));module[_0x7546('0x1')]=function(_0x225120,_0x5550b5,_0x589abe,_0x5b94e9,_0x42f933,_0xdd2e62,_0x2103c9){return polly(_0x225120,_0x5550b5,_0x589abe,_0x5b94e9,_0x42f933,_0xdd2e62,_0x2103c9);}; \ 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 3dd6a39..2ccdf4b 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 _0xe58e=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xe58e,0x10f));var _0xee58=function(_0x59379b,_0x1090b6){_0x59379b=_0x59379b-0x0;var _0xc397c7=_0xe58e[_0x59379b];return _0xc397c7;};'use strict';var fs=require('fs');var path=require(_0xee58('0x0'));var BPromise=require(_0xee58('0x1'));var rs=require(_0xee58('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x5a1eb3,_0x2bbcc3,_0x3fd2d0){return new BPromise(function(_0x312b48,_0x40a79b){_0x5a1eb3[_0xee58('0x3')](_0x2bbcc3,function(_0x4cc381,_0x7901da){if(_0x4cc381){_0x40a79b(_0x4cc381);}else if(_0x7901da){if(_0x7901da[_0xee58('0x4')]instanceof Buffer){fs[_0xee58('0x5')](_0x3fd2d0,_0x7901da[_0xee58('0x4')],function(_0x333f43){if(_0x333f43){_0x40a79b(_0x333f43);}else{_0x312b48();}});}else{_0x40a79b(new Error(_0xee58('0x6')));}}else{_0x40a79b(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x531ec8,_0x5cf98f,_0x1d84e6,_0x19a8b9,_0x38e90c,_0x55b540,_0x5913d5){var _0x89dfce=new AWS[(_0xee58('0x7'))]({'accessKeyId':_0x531ec8,'secretAccessKey':_0x5cf98f,'region':_0x1d84e6});var _0x2395ff={'Text':_0x38e90c,'TextType':_0x55b540||_0xee58('0x8'),'OutputFormat':_0xee58('0x9'),'VoiceId':_0x19a8b9};return pollyResult(_0x89dfce,_0x2395ff,_0x5913d5);}; \ No newline at end of file +var _0x469d=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Polly'];(function(_0x2a3c46,_0x33f7c9){var _0x5bd7eb=function(_0x5dac2c){while(--_0x5dac2c){_0x2a3c46['push'](_0x2a3c46['shift']());}};_0x5bd7eb(++_0x33f7c9);}(_0x469d,0x66));var _0xd469=function(_0x4a464d,_0x5c28fc){_0x4a464d=_0x4a464d-0x0;var _0x354040=_0x469d[_0x4a464d];return _0x354040;};'use strict';var fs=require('fs');var path=require(_0xd469('0x0'));var BPromise=require(_0xd469('0x1'));var rs=require(_0xd469('0x2'));var AWS=require(_0xd469('0x3'));function pollyResult(_0x5b3811,_0x43347c,_0x132126){return new BPromise(function(_0xae8e31,_0x354358){_0x5b3811[_0xd469('0x4')](_0x43347c,function(_0x1af73b,_0x3a3e67){if(_0x1af73b){_0x354358(_0x1af73b);}else if(_0x3a3e67){if(_0x3a3e67[_0xd469('0x5')]instanceof Buffer){fs[_0xd469('0x6')](_0x132126,_0x3a3e67[_0xd469('0x5')],function(_0x4fbcff){if(_0x4fbcff){_0x354358(_0x4fbcff);}else{_0xae8e31();}});}else{_0x354358(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x354358(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x609b04,_0x5959dc,_0x2375a4,_0x311ad7,_0x1c9931,_0x5ad741,_0x16e5dd){var _0x109996=new AWS[(_0xd469('0x7'))]({'accessKeyId':_0x609b04,'secretAccessKey':_0x5959dc,'region':_0x2375a4});var _0x5242b0={'Text':_0x1c9931,'TextType':_0x5ad741||_0xd469('0x8'),'OutputFormat':_0xd469('0x9'),'VoiceId':_0x311ad7};return pollyResult(_0x109996,_0x5242b0,_0x16e5dd);}; \ 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 5ece50a..99289e8 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 _0x63ad=['./lib/api','exports'];(function(_0x519006,_0x113827){var _0x165a26=function(_0x4d5047){while(--_0x4d5047){_0x519006['push'](_0x519006['shift']());}};_0x165a26(++_0x113827);}(_0x63ad,0x66));var _0xd63a=function(_0x3b72cb,_0x15f112){_0x3b72cb=_0x3b72cb-0x0;var _0x4375ae=_0x63ad[_0x3b72cb];return _0x4375ae;};'use strict';var asr=require(_0xd63a('0x0'));module[_0xd63a('0x1')]=function(_0x307b3f,_0x5c6266,_0x54cd3c,_0x5acef8){return asr(_0x307b3f,_0x5c6266,_0x54cd3c);}; \ No newline at end of file +var _0x5d52=['./lib/api','exports'];(function(_0x1043c0,_0xe385cc){var _0x298b58=function(_0xd858fd){while(--_0xd858fd){_0x1043c0['push'](_0x1043c0['shift']());}};_0x298b58(++_0xe385cc);}(_0x5d52,0xd6));var _0x25d5=function(_0x24c086,_0x58503a){_0x24c086=_0x24c086-0x0;var _0x437816=_0x5d52[_0x24c086];return _0x437816;};'use strict';var asr=require(_0x25d5('0x0'));module[_0x25d5('0x1')]=function(_0x596fc8,_0xf67166,_0x3abbdb,_0x2ac610){return asr(_0x596fc8,_0xf67166,_0x3abbdb);}; \ 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 adc2267..c2b075f 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 _0xbf33=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','8000','url'];(function(_0x3cf7d6,_0x43f198){var _0x5a9604=function(_0x4b2c0c){while(--_0x4b2c0c){_0x3cf7d6['push'](_0x3cf7d6['shift']());}};_0x5a9604(++_0x43f198);}(_0xbf33,0x137));var _0x3bf3=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xbf33[_0x4d8ed9];return _0x1e2140;};'use strict';var url=require(_0x3bf3('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x3bf3('0x1');module[_0x3bf3('0x2')]=function(_0x4f9122,_0x3226a3,_0x46fe4f){return new BPromise(function(_0x6212a8,_0x2e4c0b){var _0x4392ce;if(typeof _0x4f9122!==_0x3bf3('0x3')||_0x4f9122[_0x3bf3('0x4')]===0x0){return _0x2e4c0b(_0x3bf3('0x5'));}if(typeof _0x3226a3!=='string'||_0x3226a3[_0x3bf3('0x4')]===0x0){return _0x2e4c0b('key\x20should\x20be\x20a\x20string');}if(typeof _0x46fe4f!==_0x3bf3('0x6')&&(typeof _0x46fe4f!==_0x3bf3('0x3')||_0x46fe4f[_0x3bf3('0x4')]===0x0)){return _0x2e4c0b(_0x3bf3('0x7'));}try{_0x4392ce=fs[_0x3bf3('0x8')](_0x4f9122)[_0x3bf3('0x9')](_0x3bf3('0xa'));}catch(_0x1c67b4){return _0x2e4c0b(_0x1c67b4);}return _0x6212a8({'method':'POST','uri':host+_0x3bf3('0xb')+_0x3226a3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3bf3('0xc'),'languageCode':_0x46fe4f},'audio':{'content':_0x4392ce}},'json':!![]});});}; \ No newline at end of file +var _0x6b21=['/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x6b21,0x81));var _0x16b2=function(_0x588102,_0x5c5151){_0x588102=_0x588102-0x0;var _0x1ad0c5=_0x6b21[_0x588102];return _0x1ad0c5;};'use strict';var url=require('url');var BPromise=require(_0x16b2('0x0'));var fs=require('fs');var host=_0x16b2('0x1');module['exports']=function(_0x39397d,_0xd03974,_0x39490d){return new BPromise(function(_0x2bf974,_0x588a81){var _0x21edcb;if(typeof _0x39397d!=='string'||_0x39397d[_0x16b2('0x2')]===0x0){return _0x588a81(_0x16b2('0x3'));}if(typeof _0xd03974!==_0x16b2('0x4')||_0xd03974[_0x16b2('0x2')]===0x0){return _0x588a81('key\x20should\x20be\x20a\x20string');}if(typeof _0x39490d!==_0x16b2('0x5')&&(typeof _0x39490d!==_0x16b2('0x4')||_0x39490d[_0x16b2('0x2')]===0x0)){return _0x588a81(_0x16b2('0x6'));}try{_0x21edcb=fs[_0x16b2('0x7')](_0x39397d)[_0x16b2('0x8')](_0x16b2('0x9'));}catch(_0x29ddee){return _0x588a81(_0x29ddee);}return _0x2bf974({'method':_0x16b2('0xa'),'uri':host+_0x16b2('0xb')+_0xd03974,'body':{'config':{'encoding':_0x16b2('0xc'),'sampleRateHertz':_0x16b2('0xd'),'languageCode':_0x39490d},'audio':{'content':_0x21edcb}},'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 916e5eb..01d7c32 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 _0xf503=['./asr','exports'];(function(_0x49bced,_0x5edf1f){var _0x41909c=function(_0xc58582){while(--_0xc58582){_0x49bced['push'](_0x49bced['shift']());}};_0x41909c(++_0x5edf1f);}(_0xf503,0x11a));var _0x3f50=function(_0x2c7626,_0x6c430e){_0x2c7626=_0x2c7626-0x0;var _0x3a2add=_0xf503[_0x2c7626];return _0x3a2add;};var asr=require(_0x3f50('0x0'));module[_0x3f50('0x1')]={'asr':asr}; \ No newline at end of file +var _0xced7=['./asr','exports'];(function(_0x2cc31f,_0x8278db){var _0x5a2dd3=function(_0x4c609a){while(--_0x4c609a){_0x2cc31f['push'](_0x2cc31f['shift']());}};_0x5a2dd3(++_0x8278db);}(_0xced7,0xf2));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};var asr=require(_0x7ced('0x0'));module[_0x7ced('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 c06026a..86cbc95 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 _0x47c0=['generate','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','audioContent','chmodSync','googleTTS','goggleTTS\x20path','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','asr','unlink','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','stringify','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','sestekNDA','nda','CustomAction','CustomActionData','channelData','AudioFromTts','Data','dirName','path','url','parse','sox','request-promise','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','../../../config/logger','agi','protocol','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','end','https:','WHAT_EVER','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve'];(function(_0xfa3c5c,_0x3f68be){var _0x5df3e2=function(_0x1c7ffc){while(--_0x1c7ffc){_0xfa3c5c['push'](_0xfa3c5c['shift']());}};_0x5df3e2(++_0x3f68be);}(_0x47c0,0xa9));var _0x047c=function(_0x4088e0,_0x3484a4){_0x4088e0=_0x4088e0-0x0;var _0x183709=_0x47c0[_0x4088e0];return _0x183709;};'use strict';var fs=require('fs');var path=require(_0x047c('0x0'));var http=require('http');var https=require('https');var urlParse=require(_0x047c('0x1'))[_0x047c('0x2')];var BPromise=require('bluebird');var rs=require('randomstring');var sox=require(_0x047c('0x3'));var rp=require(_0x047c('0x4'));var util=require('util');var querystring=require('querystring');var tts=require(_0x047c('0x5'));var apiai=require(_0x047c('0x6'));var md5=require(_0x047c('0x7'));var google=require(_0x047c('0x8'));var aws=require(_0x047c('0x9'));var tilde=require(_0x047c('0xa'));var sestek=require('./sestek');var logger=require(_0x047c('0xb'))(_0x047c('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2427bd,_0x4a74fd){return new BPromise(function(_0x3ed46b,_0x13d1f8){var _0x2ebfab=urlParse(_0x2427bd);var _0xdae0b8=_0x2ebfab[_0x047c('0xd')]==='https:'?https:http;var _0x349f27={'host':_0x2ebfab[_0x047c('0xe')],'path':_0x2ebfab[_0x047c('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0xdae0b8['get'](_0x349f27,function(_0x13567f){if(_0x13567f[_0x047c('0xf')]!==0xc8){logger[_0x047c('0x10')](_0x047c('0x11')+_0x2427bd+_0x047c('0x12')+_0x13567f[_0x047c('0xf')]+'\x20('+_0x13567f[_0x047c('0x13')]+')');_0x13d1f8(new Error(_0x047c('0x11')+_0x2427bd+_0x047c('0x12')+_0x13567f['statusCode']+'\x20('+_0x13567f[_0x047c('0x13')]+')'));return;}var _0xa28fb=fs[_0x047c('0x14')](_0x4a74fd);_0xa28fb['on'](_0x047c('0x15'),function(){logger[_0x047c('0x16')](_0x047c('0x17'));_0xa28fb['close'](_0x3ed46b);});_0xa28fb['on'](_0x047c('0x10'),function(_0x25a72a){fs['unlink'](_0x4a74fd);logger[_0x047c('0x10')](_0x047c('0x18'),_0x25a72a);_0x13d1f8(_0x25a72a);});_0x13567f[_0x047c('0x19')](_0xa28fb);})['on']('error',function(_0x54d955){logger[_0x047c('0x10')](_0x54d955);_0x13d1f8(_0x54d955);})[_0x047c('0x1a')]();});}function uploadFile(_0x5d5051){return new BPromise(function(_0x50d586,_0x38d2d1){var _0x40f1a6=urlParse(_0x5d5051);var _0x4237a5=_0x40f1a6[_0x047c('0xd')]===_0x047c('0x1b')?https:http;var _0x5e0021={'host':_0x40f1a6[_0x047c('0xe')],'path':_0x40f1a6[_0x047c('0x0')],'headers':{'user-agent':_0x047c('0x1c')}};_0x4237a5[_0x047c('0x1d')](_0x5e0021,function(_0xc4145b){if(_0xc4145b[_0x047c('0xf')]!==0xc8){_0x38d2d1(new Error(_0x047c('0x11')+_0x5d5051+_0x047c('0x12')+_0xc4145b[_0x047c('0xf')]+'\x20('+_0xc4145b['statusMessage']+')'));return;}var _0x47db4a='';_0xc4145b['on'](_0x047c('0x1e'),function(_0x5d7667){_0x47db4a+=_0x5d7667;});_0xc4145b['on'](_0x047c('0x1a'),function(){_0x50d586(_0x47db4a);});})['on'](_0x047c('0x10'),function(_0x22796a){_0x38d2d1(_0x22796a);})[_0x047c('0x1a')]();});}function convertFile(_0x596289,_0x69ceac){return new BPromise(function(_0x4932c9,_0x40d81f){var _0x252a97=sox[_0x047c('0x1f')](_0x596289,_0x69ceac,{'sampleRate':0x1f40,'format':_0x047c('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x252a97['on'](_0x047c('0x10'),function(_0x42c857){logger[_0x047c('0x10')](_0x047c('0x21'),_0x42c857);_0x40d81f(_0x42c857);});_0x252a97['on'](_0x047c('0x1a'),function(){logger[_0x047c('0x16')](_0x047c('0x22'));_0x4932c9();});_0x252a97[_0x047c('0x23')]();});}function base64Decode(_0x57656f,_0x132f4f){var _0x288cd5=path[_0x047c('0x24')](__dirname,'tmp',rs[_0x047c('0x25')](0x4)+_0x047c('0x26'));fs[_0x047c('0x27')](_0x288cd5,_0x57656f,_0x047c('0x28'));return convertFile(_0x288cd5,_0x132f4f)[_0x047c('0x29')](function(){try{fs['unlink'](_0x288cd5);fs['chmodSync'](_0x132f4f,_0x047c('0x2a'));}catch(_0x2af63c){logger[_0x047c('0x10')](_0x2af63c);}return _0x132f4f[_0x047c('0x2b')]('.')[0x0];});}function base64Encode(_0x2a7125){var _0x352512=fs[_0x047c('0x2c')](_0x2a7125);return new Buffer(_0x352512)['toString'](_0x047c('0x28'));}exports[_0x047c('0x2d')]=function(_0x3c5ea2,_0x18cec3,_0x3e3a47,_0x560980,_0x1bac19,_0x25b38f){var _0x2ba760,_0x4922ec;var _0x41bd82=_0x047c('0x2e');var _0x3a1e5e='?key='+_0x3c5ea2;var _0x547da9={};if(_0x18cec3===_0x047c('0x2f')){_0x547da9[_0x047c('0x30')]={'ssml':_0x3e3a47};}else{_0x547da9[_0x047c('0x30')]={'text':_0x3e3a47};};_0x547da9[_0x047c('0x31')]={'languageCode':_0x560980,'ssmlGender':_0x1bac19};_0x547da9[_0x047c('0x32')]={'audioEncoding':_0x047c('0x33'),'sampleRateHertz':0x1f40};var _0x51b7d0={'url':_0x41bd82+_0x047c('0x34')+_0x3a1e5e,'method':_0x047c('0x35'),'json':!![],'body':_0x547da9};return rp(_0x51b7d0)['then'](function(_0x14c2ae){return new BPromise(function(_0x137edc,_0x26d83c){_0x2ba760=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x37'));var _0x4d5b4a=Buffer['from'](_0x14c2ae[_0x047c('0x38')],'base64');return fs['writeFile'](_0x2ba760,_0x4d5b4a,function(_0x1b61ff){_0x26d83c(_0x1b61ff);},function(_0x3d0a9b){fs[_0x047c('0x39')](_0x2ba760,'777');_0x137edc(_0x3d0a9b);});});})[_0x047c('0x29')](function(_0x3f6a85){_0x4922ec=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs['generate'](0x4)+'.wav');return convertFile(_0x2ba760,_0x4922ec);})['then'](function(){try{fs['unlink'](_0x2ba760);fs[_0x047c('0x39')](_0x4922ec,'777');}catch(_0x1055c2){logger[_0x047c('0x10')](_0x1055c2);}logger[_0x047c('0x16')]('googleCloudTTS\x20path',_0x4922ec['split']('.')[0x0]);return _0x4922ec[_0x047c('0x2b')]('.')[0x0];});};exports[_0x047c('0x3a')]=function(_0x2b978c,_0x151721){var _0x2f7c33,_0x6dbde2;return tts(_0x2b978c,_0x151721||'en',0x1)[_0x047c('0x29')](function(_0x9dc6be){logger[_0x047c('0x16')](_0x9dc6be);_0x2f7c33=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x37'));return downloadFile(_0x9dc6be,_0x2f7c33);})[_0x047c('0x29')](function(){_0x6dbde2=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs['generate'](0x4)+'.wav');return convertFile(_0x2f7c33,_0x6dbde2);})[_0x047c('0x29')](function(){try{fs['unlink'](_0x2f7c33);fs[_0x047c('0x39')](_0x6dbde2,_0x047c('0x2a'));}catch(_0xc776e8){logger[_0x047c('0x10')](_0xc776e8);}logger[_0x047c('0x16')](_0x047c('0x3b'),_0x6dbde2[_0x047c('0x2b')]('.')[0x0]);return _0x6dbde2[_0x047c('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x673c6b,_0x406668,_0x515fee){return google['asr'](_0x673c6b,_0x406668,_0x515fee)['then'](function(_0x58170c){logger[_0x047c('0x16')](_0x58170c['uri']);return rp(_0x58170c);})[_0x047c('0x29')](function(_0x28bfc8){var _0xf7cc89='';var _0x4cd5ad=0x0;try{fs['unlink'](_0x673c6b);}catch(_0x237494){logger['error'](_0x237494);}if(_0x28bfc8&&_0x28bfc8[_0x047c('0x3c')]){_0xf7cc89=_0x28bfc8['results'][_0x047c('0x3d')](function(_0x42e438){return _0x42e438&&_0x42e438[_0x047c('0x3e')][0x0]&&_0x42e438[_0x047c('0x3e')][0x0][_0x047c('0x3f')]?_0x42e438['alternatives'][0x0][_0x047c('0x3f')]:'';})['join']('\x0a');_0x4cd5ad=_0x28bfc8[_0x047c('0x3c')][_0x047c('0x3d')](function(_0x1f7e08){return _0x1f7e08&&_0x1f7e08[_0x047c('0x3e')][0x0]&&_0x1f7e08['alternatives'][0x0][_0x047c('0x40')]?_0x1f7e08[_0x047c('0x3e')][0x0][_0x047c('0x40')]:0x0;})[_0x047c('0x41')]('\x0a');}logger[_0x047c('0x16')](_0x047c('0x42'),_0xf7cc89);logger[_0x047c('0x16')]('googleASR\x20confidence',_0x4cd5ad);return{'transcript':_0xf7cc89,'confidence':_0x4cd5ad};})['catch'](function(_0x12f7ab){logger[_0x047c('0x10')]('[%s]\x20%s:%s',_0x12f7ab[_0x047c('0xf')],_0x12f7ab[_0x047c('0x43')],_0x12f7ab[_0x047c('0x44')]);});};exports[_0x047c('0x45')]=function(_0x4169ea,_0x374c17,_0x2181c5,_0x5cfd0f){var _0x1c6ad5=apiai(_0x374c17,{'language':_0x5cfd0f||'en'});return _0x1c6ad5[_0x047c('0x46')](_0x2181c5,{'sessionId':md5(_0x4169ea)})['then'](function(_0x515ea2){logger['info'](JSON['stringify'](_0x515ea2));return{'source':_0x515ea2[_0x047c('0x47')][_0x047c('0x48')],'resolvedQuery':_0x515ea2[_0x047c('0x47')][_0x047c('0x49')],'action':_0x515ea2[_0x047c('0x47')]['action'],'actionIncomplete':_0x515ea2[_0x047c('0x47')][_0x047c('0x4a')],'speech':_0x515ea2[_0x047c('0x47')][_0x047c('0x4b')][_0x047c('0x4c')],'score':_0x515ea2[_0x047c('0x47')][_0x047c('0x4d')],'statusCode':_0x515ea2['status'][_0x047c('0x4e')],'endConversation':_0x515ea2['result'][_0x047c('0x4f')][_0x047c('0x50')]||![],'isFallbackIntent':_0x515ea2['result'][_0x047c('0x4f')][_0x047c('0x51')]};});};exports['tildeASR']=function(_0x12260a,_0x43d4ff,_0x173165,_0x5e87f0){return tilde[_0x047c('0x52')](_0x12260a,_0x43d4ff,_0x173165,_0x5e87f0)[_0x047c('0x29')](function(_0x1aa63c){try{fs[_0x047c('0x53')](_0x12260a);}catch(_0x415aff){logger['error'](_0x415aff);}logger[_0x047c('0x16')](_0x047c('0x54'),_0x1aa63c['transcript']);logger[_0x047c('0x16')](_0x047c('0x55'),_0x1aa63c[_0x047c('0x40')]);return _0x1aa63c;});};exports[_0x047c('0x56')]=function(_0x1886c7,_0x4e0ef9,_0xa53bc6,_0x5890de,_0x476571,_0x18c068){var _0x59d23e=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+'.mp3');var _0x403497;return aws['polly'](_0x1886c7,_0x4e0ef9,_0xa53bc6,_0x5890de,_0x476571,_0x18c068,_0x59d23e)[_0x047c('0x29')](function(){_0x403497=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x26'));return convertFile(_0x59d23e,_0x403497);})[_0x047c('0x29')](function(){try{fs[_0x047c('0x53')](_0x59d23e);fs['chmodSync'](_0x403497,_0x047c('0x2a'));}catch(_0x1f9524){logger[_0x047c('0x10')](_0x1f9524);}return _0x403497[_0x047c('0x2b')]('.')[0x0];});};exports[_0x047c('0x57')]=function(_0x574b55,_0x31ebdd,_0x2ab862,_0x5952af,_0x49f923,_0xe7004b){return aws[_0x047c('0x58')](_0x574b55,_0x31ebdd,_0x2ab862,_0x5952af,_0x49f923,_0xe7004b)['then'](function(_0x484453){logger['info'](JSON[_0x047c('0x59')](_0x484453));return _0x484453;});};exports[_0x047c('0x5a')]=function(_0x5aed4a,_0x5323a0,_0xe7639a,_0x23b660){var _0x3ad210=util[_0x047c('0x5b')](_0x047c('0x5c'),ISPEECH_API,_0x5aed4a,encodeURIComponent(_0x5323a0),_0xe7639a,_0x23b660);var _0x140985=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs['generate'](0x4)+_0x047c('0x37'));var _0x215f3b;return downloadFile(_0x3ad210,_0x140985)[_0x047c('0x29')](function(){_0x215f3b=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x26'));return convertFile(_0x140985,_0x215f3b);})['then'](function(){try{fs[_0x047c('0x53')](_0x140985);fs[_0x047c('0x39')](_0x215f3b,_0x047c('0x2a'));}catch(_0x23d528){logger[_0x047c('0x10')](_0x23d528);}return _0x215f3b[_0x047c('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x4b26e7,_0x1c3a5e,_0x571539,_0x4bdf31){var _0x58020c=util[_0x047c('0x5b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c3a5e,_0x571539,base64Encode(_0x4b26e7),_0x4bdf31?util[_0x047c('0x5b')](_0x047c('0x5d'),encodeURIComponent(_0x4bdf31)):_0x047c('0x5e'));return uploadFile(_0x58020c)[_0x047c('0x29')](function(_0xb8dd44){return querystring['parse'](_0xb8dd44);});};exports[_0x047c('0x5f')]=function(_0x2793ce,_0x15a5fe){return sestek[_0x047c('0x60')](_0x2793ce,_0x15a5fe)[_0x047c('0x29')](function(_0x207071){logger[_0x047c('0x16')](JSON[_0x047c('0x59')](_0x207071));var _0x55cc14={'speech':_0x207071['text'],'action':_0x207071['channelData']?_0x207071['channelData'][_0x047c('0x61')]:undefined,'actiondata':_0x207071['channelData']?_0x207071['channelData'][_0x047c('0x62')]:undefined};if(_0x207071[_0x047c('0x63')]&&_0x207071[_0x047c('0x63')][_0x047c('0x64')]){return base64Decode(_0x207071[_0x047c('0x63')]['AudioFromTts'][_0x047c('0x65')],path[_0x047c('0x24')](__dirname,'tmp',rs[_0x047c('0x25')](0x4)+_0x047c('0x26')))[_0x047c('0x29')](function(_0x509910){_0x55cc14['audiofile']=_0x509910;return _0x55cc14;});}return _0x55cc14;});};exports[_0x047c('0x66')]=function(){return __dirname;}; \ No newline at end of file +var _0x4f41=['isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','audiofile','dirName','http','https','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','finish','info','finish\x20download\x20file','close','error','unlink','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','.mp3','audioContent','writeFile','googleTTS','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','action','speech','score','status','code','metadata'];(function(_0x28902f,_0x2a8dbf){var _0x4a4f6d=function(_0x21ece8){while(--_0x21ece8){_0x28902f['push'](_0x28902f['shift']());}};_0x4a4f6d(++_0x2a8dbf);}(_0x4f41,0x1b5));var _0x14f4=function(_0x48092d,_0x4e1c8a){_0x48092d=_0x48092d-0x0;var _0x2cb71c=_0x4f41[_0x48092d];return _0x2cb71c;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x14f4('0x0'));var https=require(_0x14f4('0x1'));var urlParse=require('url')['parse'];var BPromise=require(_0x14f4('0x2'));var rs=require(_0x14f4('0x3'));var sox=require(_0x14f4('0x4'));var rp=require(_0x14f4('0x5'));var util=require(_0x14f4('0x6'));var querystring=require(_0x14f4('0x7'));var tts=require(_0x14f4('0x8'));var apiai=require(_0x14f4('0x9'));var md5=require(_0x14f4('0xa'));var google=require(_0x14f4('0xb'));var aws=require('./aws');var tilde=require(_0x14f4('0xc'));var sestek=require(_0x14f4('0xd'));var logger=require(_0x14f4('0xe'))(_0x14f4('0xf'));var ISPEECH_API=_0x14f4('0x10');function downloadFile(_0x43e7dc,_0x368d0d){return new BPromise(function(_0xab2b75,_0x14b50f){var _0x11444e=urlParse(_0x43e7dc);var _0x4e0986=_0x11444e[_0x14f4('0x11')]===_0x14f4('0x12')?https:http;var _0x5513aa={'host':_0x11444e[_0x14f4('0x13')],'path':_0x11444e[_0x14f4('0x14')],'headers':{'user-agent':_0x14f4('0x15')}};_0x4e0986[_0x14f4('0x16')](_0x5513aa,function(_0xfe81c4){if(_0xfe81c4['statusCode']!==0xc8){logger['error']('request\x20to\x20'+_0x43e7dc+_0x14f4('0x17')+_0xfe81c4[_0x14f4('0x18')]+'\x20('+_0xfe81c4[_0x14f4('0x19')]+')');_0x14b50f(new Error(_0x14f4('0x1a')+_0x43e7dc+_0x14f4('0x17')+_0xfe81c4[_0x14f4('0x18')]+'\x20('+_0xfe81c4[_0x14f4('0x19')]+')'));return;}var _0x50216=fs['createWriteStream'](_0x368d0d);_0x50216['on'](_0x14f4('0x1b'),function(){logger[_0x14f4('0x1c')](_0x14f4('0x1d'));_0x50216[_0x14f4('0x1e')](_0xab2b75);});_0x50216['on'](_0x14f4('0x1f'),function(_0x3fa250){fs[_0x14f4('0x20')](_0x368d0d);logger[_0x14f4('0x1f')]('download\x20error',_0x3fa250);_0x14b50f(_0x3fa250);});_0xfe81c4[_0x14f4('0x21')](_0x50216);})['on'](_0x14f4('0x1f'),function(_0x2d4240){logger['error'](_0x2d4240);_0x14b50f(_0x2d4240);})[_0x14f4('0x22')]();});}function uploadFile(_0x490a03){return new BPromise(function(_0x1703ce,_0x5e511f){var _0x4db430=urlParse(_0x490a03);var _0x1f369c=_0x4db430['protocol']===_0x14f4('0x12')?https:http;var _0x234897={'host':_0x4db430[_0x14f4('0x13')],'path':_0x4db430[_0x14f4('0x14')],'headers':{'user-agent':_0x14f4('0x15')}};_0x1f369c[_0x14f4('0x16')](_0x234897,function(_0x542dd1){if(_0x542dd1[_0x14f4('0x18')]!==0xc8){_0x5e511f(new Error(_0x14f4('0x1a')+_0x490a03+'\x20failed,\x20status\x20code\x20=\x20'+_0x542dd1[_0x14f4('0x18')]+'\x20('+_0x542dd1['statusMessage']+')'));return;}var _0x2368ad='';_0x542dd1['on'](_0x14f4('0x23'),function(_0x2c89d1){_0x2368ad+=_0x2c89d1;});_0x542dd1['on'](_0x14f4('0x22'),function(){_0x1703ce(_0x2368ad);});})['on'](_0x14f4('0x1f'),function(_0x57af08){_0x5e511f(_0x57af08);})[_0x14f4('0x22')]();});}function convertFile(_0x4f513f,_0x4ce3e0){return new BPromise(function(_0x5b6b05,_0x5ad22e){var _0x230003=sox[_0x14f4('0x24')](_0x4f513f,_0x4ce3e0,{'sampleRate':0x1f40,'format':_0x14f4('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x230003['on'](_0x14f4('0x1f'),function(_0x3e8318){logger[_0x14f4('0x1f')](_0x14f4('0x26'),_0x3e8318);_0x5ad22e(_0x3e8318);});_0x230003['on'](_0x14f4('0x22'),function(){logger[_0x14f4('0x1c')](_0x14f4('0x27'));_0x5b6b05();});_0x230003[_0x14f4('0x28')]();});}function base64Decode(_0x9bbd03,_0x23abb4){var _0x8c7a6a=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs[_0x14f4('0x2b')](0x4)+_0x14f4('0x2c'));fs['writeFileSync'](_0x8c7a6a,_0x9bbd03,_0x14f4('0x2d'));return convertFile(_0x8c7a6a,_0x23abb4)[_0x14f4('0x2e')](function(){try{fs[_0x14f4('0x20')](_0x8c7a6a);fs[_0x14f4('0x2f')](_0x23abb4,_0x14f4('0x30'));}catch(_0x498c56){logger[_0x14f4('0x1f')](_0x498c56);}return _0x23abb4[_0x14f4('0x31')]('.')[0x0];});}function base64Encode(_0x268bad){var _0x224462=fs[_0x14f4('0x32')](_0x268bad);return new Buffer(_0x224462)[_0x14f4('0x33')]('base64');}exports['googleCloudTTS']=function(_0x31d1b9,_0x5dcb2a,_0x4c0e6f,_0x3fe003,_0x5a8927,_0x3de017){var _0x3dd2cd,_0x4c1853;var _0x49402a=_0x14f4('0x34');var _0x56d95b=_0x14f4('0x35')+_0x31d1b9;var _0x2d6915={};if(_0x5dcb2a==='ssml'){_0x2d6915[_0x14f4('0x36')]={'ssml':_0x4c0e6f};}else{_0x2d6915[_0x14f4('0x36')]={'text':_0x4c0e6f};};_0x2d6915[_0x14f4('0x37')]={'languageCode':_0x3fe003,'ssmlGender':_0x5a8927};_0x2d6915[_0x14f4('0x38')]={'audioEncoding':_0x14f4('0x39'),'sampleRateHertz':0x1f40};var _0xa24d5a={'url':_0x49402a+'text:synthesize'+_0x56d95b,'method':'POST','json':!![],'body':_0x2d6915};return rp(_0xa24d5a)['then'](function(_0x2befcf){return new BPromise(function(_0x2fcd4f,_0x130fd7){_0x3dd2cd=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs['generate'](0x4)+_0x14f4('0x3a'));var _0x5ac297=Buffer['from'](_0x2befcf[_0x14f4('0x3b')],_0x14f4('0x2d'));return fs[_0x14f4('0x3c')](_0x3dd2cd,_0x5ac297,function(_0x70f9e2){_0x130fd7(_0x70f9e2);},function(_0x35b434){fs['chmodSync'](_0x3dd2cd,_0x14f4('0x30'));_0x2fcd4f(_0x35b434);});});})[_0x14f4('0x2e')](function(_0x2519e0){_0x4c1853=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs['generate'](0x4)+_0x14f4('0x2c'));return convertFile(_0x3dd2cd,_0x4c1853);})[_0x14f4('0x2e')](function(){try{fs[_0x14f4('0x20')](_0x3dd2cd);fs['chmodSync'](_0x4c1853,'777');}catch(_0x280546){logger[_0x14f4('0x1f')](_0x280546);}logger[_0x14f4('0x1c')]('googleCloudTTS\x20path',_0x4c1853[_0x14f4('0x31')]('.')[0x0]);return _0x4c1853['split']('.')[0x0];});};exports[_0x14f4('0x3d')]=function(_0x4fce04,_0x583e9f){var _0x2e6d1d,_0x3e53b9;return tts(_0x4fce04,_0x583e9f||'en',0x1)['then'](function(_0x44d356){logger[_0x14f4('0x1c')](_0x44d356);_0x2e6d1d=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs['generate'](0x4)+_0x14f4('0x3a'));return downloadFile(_0x44d356,_0x2e6d1d);})[_0x14f4('0x2e')](function(){_0x3e53b9=path['resolve'](__dirname,'tmp',rs[_0x14f4('0x2b')](0x4)+_0x14f4('0x2c'));return convertFile(_0x2e6d1d,_0x3e53b9);})['then'](function(){try{fs['unlink'](_0x2e6d1d);fs[_0x14f4('0x2f')](_0x3e53b9,_0x14f4('0x30'));}catch(_0x57a5a2){logger[_0x14f4('0x1f')](_0x57a5a2);}logger[_0x14f4('0x1c')](_0x14f4('0x3e'),_0x3e53b9[_0x14f4('0x31')]('.')[0x0]);return _0x3e53b9['split']('.')[0x0];});};exports['googleASR']=function(_0x2f0465,_0x593d9f,_0x316280){return google[_0x14f4('0x3f')](_0x2f0465,_0x593d9f,_0x316280)[_0x14f4('0x2e')](function(_0x3e3e46){logger[_0x14f4('0x1c')](_0x3e3e46['uri']);return rp(_0x3e3e46);})['then'](function(_0x1d9120){var _0x201852='';var _0x923cd4=0x0;try{fs[_0x14f4('0x20')](_0x2f0465);}catch(_0x3570ff){logger[_0x14f4('0x1f')](_0x3570ff);}if(_0x1d9120&&_0x1d9120[_0x14f4('0x40')]){_0x201852=_0x1d9120[_0x14f4('0x40')][_0x14f4('0x41')](function(_0x301c0c){return _0x301c0c&&_0x301c0c[_0x14f4('0x42')][0x0]&&_0x301c0c[_0x14f4('0x42')][0x0][_0x14f4('0x43')]?_0x301c0c[_0x14f4('0x42')][0x0]['transcript']:'';})[_0x14f4('0x44')]('\x0a');_0x923cd4=_0x1d9120[_0x14f4('0x40')][_0x14f4('0x41')](function(_0x3f5b11){return _0x3f5b11&&_0x3f5b11[_0x14f4('0x42')][0x0]&&_0x3f5b11[_0x14f4('0x42')][0x0][_0x14f4('0x45')]?_0x3f5b11['alternatives'][0x0]['confidence']:0x0;})[_0x14f4('0x44')]('\x0a');}logger['info']('googleASR\x20transcription',_0x201852);logger[_0x14f4('0x1c')](_0x14f4('0x46'),_0x923cd4);return{'transcript':_0x201852,'confidence':_0x923cd4};})['catch'](function(_0x26bb7e){logger[_0x14f4('0x1f')]('[%s]\x20%s:%s',_0x26bb7e[_0x14f4('0x18')],_0x26bb7e[_0x14f4('0x47')],_0x26bb7e[_0x14f4('0x48')]);});};exports[_0x14f4('0x49')]=function(_0x5a7a72,_0x337562,_0x4a09e7,_0x152452){var _0x4c8465=apiai(_0x337562,{'language':_0x152452||'en'});return _0x4c8465[_0x14f4('0x4a')](_0x4a09e7,{'sessionId':md5(_0x5a7a72)})[_0x14f4('0x2e')](function(_0x1456cc){logger[_0x14f4('0x1c')](JSON['stringify'](_0x1456cc));return{'source':_0x1456cc[_0x14f4('0x4b')][_0x14f4('0x4c')],'resolvedQuery':_0x1456cc[_0x14f4('0x4b')]['resolvedQuery'],'action':_0x1456cc[_0x14f4('0x4b')][_0x14f4('0x4d')],'actionIncomplete':_0x1456cc[_0x14f4('0x4b')]['actionIncomplete'],'speech':_0x1456cc['result']['fulfillment'][_0x14f4('0x4e')],'score':_0x1456cc[_0x14f4('0x4b')][_0x14f4('0x4f')],'statusCode':_0x1456cc[_0x14f4('0x50')][_0x14f4('0x51')],'endConversation':_0x1456cc['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x1456cc[_0x14f4('0x4b')][_0x14f4('0x52')][_0x14f4('0x53')]};});};exports[_0x14f4('0x54')]=function(_0x11e110,_0x1a304a,_0xf6945a,_0x5acd98){return tilde[_0x14f4('0x3f')](_0x11e110,_0x1a304a,_0xf6945a,_0x5acd98)['then'](function(_0x51f1c6){try{fs[_0x14f4('0x20')](_0x11e110);}catch(_0x2e7655){logger['error'](_0x2e7655);}logger[_0x14f4('0x1c')](_0x14f4('0x55'),_0x51f1c6[_0x14f4('0x43')]);logger['info']('Tilde\x20ASR\x20confidence',_0x51f1c6[_0x14f4('0x45')]);return _0x51f1c6;});};exports[_0x14f4('0x56')]=function(_0x4edade,_0x4f39eb,_0x2637a1,_0x301b2a,_0x39692f,_0x46dc38){var _0x5814c5=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x14f4('0x3a'));var _0x87fce5;return aws[_0x14f4('0x57')](_0x4edade,_0x4f39eb,_0x2637a1,_0x301b2a,_0x39692f,_0x46dc38,_0x5814c5)['then'](function(){_0x87fce5=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs[_0x14f4('0x2b')](0x4)+_0x14f4('0x2c'));return convertFile(_0x5814c5,_0x87fce5);})['then'](function(){try{fs[_0x14f4('0x20')](_0x5814c5);fs['chmodSync'](_0x87fce5,_0x14f4('0x30'));}catch(_0x2b13ba){logger[_0x14f4('0x1f')](_0x2b13ba);}return _0x87fce5[_0x14f4('0x31')]('.')[0x0];});};exports[_0x14f4('0x58')]=function(_0x4e6b9b,_0x368b10,_0x273f10,_0x63b69,_0x3dcb72,_0xce664e){return aws[_0x14f4('0x59')](_0x4e6b9b,_0x368b10,_0x273f10,_0x63b69,_0x3dcb72,_0xce664e)['then'](function(_0x549d2e){logger[_0x14f4('0x1c')](JSON['stringify'](_0x549d2e));return _0x549d2e;});};exports['ispeechTTS']=function(_0x3e725c,_0x3ed662,_0x456e79,_0x100800){var _0x44e4a7=util[_0x14f4('0x5a')](_0x14f4('0x5b'),ISPEECH_API,_0x3e725c,encodeURIComponent(_0x3ed662),_0x456e79,_0x100800);var _0x2e515a=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs[_0x14f4('0x2b')](0x4)+_0x14f4('0x3a'));var _0x17759a;return downloadFile(_0x44e4a7,_0x2e515a)['then'](function(){_0x17759a=path[_0x14f4('0x29')](__dirname,_0x14f4('0x2a'),rs['generate'](0x4)+_0x14f4('0x2c'));return convertFile(_0x2e515a,_0x17759a);})['then'](function(){try{fs[_0x14f4('0x20')](_0x2e515a);fs[_0x14f4('0x2f')](_0x17759a,_0x14f4('0x30'));}catch(_0x517683){logger[_0x14f4('0x1f')](_0x517683);}return _0x17759a['split']('.')[0x0];});};exports['ispeechASR']=function(_0x24f8e8,_0x2c758f,_0x14485d,_0x12c502){var _0x419096=util[_0x14f4('0x5a')](_0x14f4('0x5c'),ISPEECH_API,_0x2c758f,_0x14485d,base64Encode(_0x24f8e8),_0x12c502?util[_0x14f4('0x5a')](_0x14f4('0x5d'),encodeURIComponent(_0x12c502)):_0x14f4('0x5e'));return uploadFile(_0x419096)[_0x14f4('0x2e')](function(_0x3a22f3){return querystring['parse'](_0x3a22f3);});};exports[_0x14f4('0x5f')]=function(_0x2c0a88,_0x25e753){return sestek[_0x14f4('0x60')](_0x2c0a88,_0x25e753)[_0x14f4('0x2e')](function(_0x42ee39){logger[_0x14f4('0x1c')](JSON['stringify'](_0x42ee39));var _0x506671={'speech':_0x42ee39[_0x14f4('0x61')],'action':_0x42ee39['channelData']?_0x42ee39['channelData'][_0x14f4('0x62')]:undefined,'actiondata':_0x42ee39[_0x14f4('0x63')]?_0x42ee39['channelData'][_0x14f4('0x64')]:undefined};if(_0x42ee39[_0x14f4('0x63')]&&_0x42ee39[_0x14f4('0x63')]['AudioFromTts']){return base64Decode(_0x42ee39[_0x14f4('0x63')][_0x14f4('0x65')]['Data'],path['resolve'](__dirname,_0x14f4('0x2a'),rs[_0x14f4('0x2b')](0x4)+_0x14f4('0x2c')))['then'](function(_0x4c05b7){_0x506671[_0x14f4('0x66')]=_0x4c05b7;return _0x506671;});}return _0x506671;});};exports[_0x14f4('0x67')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 3bd147f..913973e 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 _0xf3ff=['./nda'];(function(_0x37cd87,_0x125544){var _0x2f93b2=function(_0xf2888e){while(--_0xf2888e){_0x37cd87['push'](_0x37cd87['shift']());}};_0x2f93b2(++_0x125544);}(_0xf3ff,0xae));var _0xff3f=function(_0x3227ad,_0x2e193e){_0x3227ad=_0x3227ad-0x0;var _0x24ac0a=_0xf3ff[_0x3227ad];return _0x24ac0a;};var nda=require(_0xff3f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x199e=['./nda'];(function(_0x36f93d,_0x106c9e){var _0x1be721=function(_0x23359d){while(--_0x23359d){_0x36f93d['push'](_0x36f93d['shift']());}};_0x1be721(++_0x106c9e);}(_0x199e,0x1ec));var _0xe199=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x199e[_0x31bab3];return _0x4fd382;};var nda=require(_0xe199('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 9075615..d28126c 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 _0xed3d=['ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0xed3d,0xbb));var _0xded3=function(_0x16b0c6,_0x1dc29e){_0x16b0c6=_0x16b0c6-0x0;var _0x559d36=_0xed3d[_0x16b0c6];return _0x559d36;};'use strict';var rp=require(_0xded3('0x0'));var url=require(_0xded3('0x1'));var logger=require('../../../../../config/logger')(_0xded3('0x2'));module['exports']=function(_0x497955,_0x3c2632){var _0x34bd75={'method':'POST','uri':url[_0xded3('0x3')](_0x3c2632[_0xded3('0x4')],_0xded3('0x5')),'form':{'grant_type':_0xded3('0x6'),'username':_0x3c2632[_0xded3('0x7')],'password':_0x3c2632[_0xded3('0x6')]},'json':!![]};return rp(_0x34bd75)['then'](function(_0x1e93f1){var _0x432962={'method':'POST','uri':url[_0xded3('0x3')](_0x3c2632[_0xded3('0x8')],_0xded3('0x9')),'body':{'type':_0x3c2632['ndaactivity_type']||_0xded3('0xa'),'channelId':_0xded3('0xb'),'conversation':{'id':_0x497955[_0xded3('0xc')]},'from':{'id':_0x497955[_0xded3('0xd')],'name':_0x497955['calleridname']},'recipient':{'id':_0x497955[_0xded3('0xe')],'name':_0x497955[_0xded3('0xf')]},'text':_0x3c2632[_0xded3('0x10')],'channelData':{}},'headers':{'Authorization':_0xded3('0x11')+_0x1e93f1[_0xded3('0x12')]},'json':!![]};if(_0x3c2632['project']){_0x432962[_0xded3('0x13')][_0xded3('0x14')][_0xded3('0x15')]=_0x3c2632[_0xded3('0x16')];}if(_0x3c2632[_0xded3('0x17')]=='1'){_0x432962[_0xded3('0x13')][_0xded3('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xded3('0x18')};}if(_0x3c2632[_0xded3('0x19')]){_0x432962[_0xded3('0x13')]['channelData']['CustomAction']=_0x3c2632['custom_action'];if(_0x3c2632[_0xded3('0x1a')]){_0x432962[_0xded3('0x13')][_0xded3('0x14')][_0xded3('0x1b')]=_0x3c2632[_0xded3('0x1a')];}}logger[_0xded3('0x1c')](JSON[_0xded3('0x1d')](_0x432962));return rp(_0x432962);});}; \ No newline at end of file +var _0xbc71=['Nda','uniqueid','callerid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x251b4f,_0x4ffab4){var _0xac541e=function(_0x5994cc){while(--_0x5994cc){_0x251b4f['push'](_0x251b4f['shift']());}};_0xac541e(++_0x4ffab4);}(_0xbc71,0x11b));var _0x1bc7=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbc71[_0x1d1779];return _0x2377e9;};'use strict';var rp=require('request-promise');var url=require(_0x1bc7('0x0'));var logger=require(_0x1bc7('0x1'))(_0x1bc7('0x2'));module[_0x1bc7('0x3')]=function(_0x1875fa,_0x59507c){var _0x1efbe={'method':_0x1bc7('0x4'),'uri':url[_0x1bc7('0x5')](_0x59507c[_0x1bc7('0x6')],_0x1bc7('0x7')),'form':{'grant_type':_0x1bc7('0x8'),'username':_0x59507c['username'],'password':_0x59507c[_0x1bc7('0x8')]},'json':!![]};return rp(_0x1efbe)[_0x1bc7('0x9')](function(_0x4cf367){var _0x327fd8={'method':_0x1bc7('0x4'),'uri':url[_0x1bc7('0x5')](_0x59507c[_0x1bc7('0xa')],_0x1bc7('0xb')),'body':{'type':_0x59507c[_0x1bc7('0xc')]||_0x1bc7('0xd'),'channelId':_0x1bc7('0xe'),'conversation':{'id':_0x1875fa[_0x1bc7('0xf')]},'from':{'id':_0x1875fa[_0x1bc7('0x10')],'name':_0x1875fa['calleridname']},'recipient':{'id':_0x1875fa['dnid'],'name':_0x1875fa[_0x1bc7('0x11')]},'text':_0x59507c[_0x1bc7('0x12')],'channelData':{}},'headers':{'Authorization':_0x1bc7('0x13')+_0x4cf367[_0x1bc7('0x14')]},'json':!![]};if(_0x59507c[_0x1bc7('0x15')]){_0x327fd8[_0x1bc7('0x16')][_0x1bc7('0x17')][_0x1bc7('0x18')]=_0x59507c[_0x1bc7('0x15')];}if(_0x59507c[_0x1bc7('0x19')]=='1'){_0x327fd8['body'][_0x1bc7('0x17')][_0x1bc7('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1bc7('0x1b')};}if(_0x59507c[_0x1bc7('0x1c')]){_0x327fd8['body'][_0x1bc7('0x17')][_0x1bc7('0x1d')]=_0x59507c['custom_action'];if(_0x59507c[_0x1bc7('0x1e')]){_0x327fd8[_0x1bc7('0x16')][_0x1bc7('0x17')][_0x1bc7('0x1f')]=_0x59507c[_0x1bc7('0x1e')];}}logger['info'](JSON[_0x1bc7('0x20')](_0x327fd8));return rp(_0x327fd8);});}; \ 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 da25bca..d10c52a 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 _0x87d7=['./lib/api'];(function(_0x668dfe,_0x49c31b){var _0x32d759=function(_0x5622ff){while(--_0x5622ff){_0x668dfe['push'](_0x668dfe['shift']());}};_0x32d759(++_0x49c31b);}(_0x87d7,0xb4));var _0x787d=function(_0x5ddec9,_0x209a36){_0x5ddec9=_0x5ddec9-0x0;var _0x5abb94=_0x87d7[_0x5ddec9];return _0x5abb94;};'use strict';var asr=require(_0x787d('0x0'));module['exports']=function(_0x4d5ce5,_0x2993c4,_0x5729cd,_0x38fedd){return asr(_0x4d5ce5,_0x2993c4,_0x5729cd,_0x38fedd);}; \ No newline at end of file +var _0x7f14=['exports'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0x7f14,0x18b));var _0x47f1=function(_0x54784a,_0x3e9ab4){_0x54784a=_0x54784a-0x0;var _0x1044ed=_0x7f14[_0x54784a];return _0x1044ed;};'use strict';var asr=require('./lib/api');module[_0x47f1('0x0')]=function(_0x4e8c3f,_0x177c5a,_0xbbbc53,_0x2ddc38){return asr(_0x4e8c3f,_0x177c5a,_0xbbbc53,_0x2ddc38);}; \ 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 d5f9bf5..3395d7c 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 _0x56ed=['EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close'];(function(_0x53710d,_0x1a0eab){var _0x3a38c3=function(_0x15288d){while(--_0x15288d){_0x53710d['push'](_0x53710d['shift']());}};_0x3a38c3(++_0x1a0eab);}(_0x56ed,0x1f1));var _0xd56e=function(_0x4d729f,_0x52bf8b){_0x4d729f=_0x4d729f-0x0;var _0x5ce12a=_0x56ed[_0x4d729f];return _0x5ce12a;};'use strict';var BPromise=require(_0xd56e('0x0'));var _=require(_0xd56e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd56e('0x2'));var crypto=require(_0xd56e('0x3'));var logger=require('../../../../../../config/logger')(_0xd56e('0x4'));module['exports']=function(_0x547695,_0x2962c3,_0x16bb0b,_0x15f88a){return new BPromise(function(_0x2e8a2e,_0x38343a){logger[_0xd56e('0x5')](_0xd56e('0x6'),_0x15f88a||_0xd56e('0x7'));var _0x530647=new WebSocket(_0x15f88a||_0xd56e('0x7'),{'perMessageDeflate':![]});var _0x210425='';var _0x48a765='0';var _0x13cb79='1';var _0x588b50=_0xd56e('0x8');function _0x22caea(_0x32ea9b){var _0x4a4186=crypto['createHash'](_0xd56e('0x9'));_0x4a4186[_0xd56e('0xa')](_0x32ea9b);return _0x4a4186['digest'](_0xd56e('0xb'));}function _0x3934c5(){try{logger[_0xd56e('0x5')](_0xd56e('0xc'));var _0x115c50=moment()[_0xd56e('0xd')]();var _0xc6b718=_0x22caea(_0x115c50+_0x2962c3+_0x16bb0b);_0x530647[_0xd56e('0xe')](JSON[_0xd56e('0xf')]({'appID':_0x2962c3,'timestamp':_0x115c50,'appKey':_0xc6b718}));var _0x6e72d1=fs[_0xd56e('0x10')](_0x547695);_0x6e72d1['on'](_0xd56e('0x11'),function(_0x552c6a){_0x530647[_0xd56e('0xe')](_0x552c6a);});_0x6e72d1['on'](_0xd56e('0x12'),function(){_0x530647[_0xd56e('0xe')](_0xd56e('0x13'));});}catch(_0x1af703){logger[_0xd56e('0x14')](_0xd56e('0x15'),JSON[_0xd56e('0xf')](_0x1af703));_0x530647[_0xd56e('0x16')]();}}function _0x4f5b38(_0x275ce5){try{if(_0x275ce5){var _0x4cabd9=JSON[_0xd56e('0x17')](_0x275ce5);switch(_0x4cabd9[_0xd56e('0x18')]){case 0x0:if(_0x4cabd9[_0xd56e('0x19')]){if(_0x4cabd9[_0xd56e('0x19')][_0xd56e('0x1a')]){logger['info'](_0xd56e('0x1b'),JSON['stringify'](_0x4cabd9[_0xd56e('0x19')]['hypotheses']));_0x210425=_0x4cabd9['result'][_0xd56e('0x1c')][0x0][_0xd56e('0x1d')];_0x48a765=_0x4cabd9['result'][_0xd56e('0x1c')][0x0][_0xd56e('0x1e')];_0x13cb79='0';_0x588b50=_0xd56e('0x1f');_0x530647['terminate']();}}break;case 0x1:logger[_0xd56e('0x5')](_0xd56e('0x8'));_0x13cb79='1';_0x588b50=_0xd56e('0x8');break;case 0x2:logger[_0xd56e('0x5')](_0xd56e('0x20'));_0x13cb79='2';_0x588b50=_0xd56e('0x20');break;case 0x9:logger[_0xd56e('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x13cb79='9';_0x588b50=_0xd56e('0x21');break;case 0xa:logger[_0xd56e('0x5')]('Authentication\x20failed.');_0x13cb79='10';_0x588b50=_0xd56e('0x22');break;case 0xb:logger[_0xd56e('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x13cb79='11';_0x588b50=_0xd56e('0x23');}}}catch(_0x6e23e){logger[_0xd56e('0x14')](_0xd56e('0x24'),JSON[_0xd56e('0xf')](_0x6e23e));_0x530647['terminate']();}}function _0xd89d6d(){logger[_0xd56e('0x5')](_0xd56e('0x25'));_0x2e8a2e({'transcript':_0x210425,'confidence':_0x48a765,'status':_0x13cb79,'status_message':_0x588b50});}function _0x5a5cd5(_0x46f187){logger[_0xd56e('0x14')](_0xd56e('0x26'));if(!_[_0xd56e('0x27')](_0x46f187)){logger[_0xd56e('0x14')](_[_0xd56e('0x28')](_0x46f187)?JSON['stringify'](_0x46f187):_0x46f187);}}_0x530647['on'](_0xd56e('0x29'),_0x3934c5);_0x530647['on'](_0xd56e('0x2a'),_0x4f5b38);_0x530647['on'](_0xd56e('0x12'),_0xd89d6d);_0x530647['on'](_0xd56e('0x14'),_0x5a5cd5);});}; \ No newline at end of file +var _0x42af=['Tilde\x20ASR\x20hypoteses','stringify','result','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','crypto','agi','exports','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','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','terminate','parse','status','final'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0x42af,0xd9));var _0xf42a=function(_0x597bb7,_0x10a9b5){_0x597bb7=_0x597bb7-0x0;var _0x2f49e0=_0x42af[_0x597bb7];return _0x2f49e0;};'use strict';var BPromise=require('bluebird');var _=require(_0xf42a('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf42a('0x1'));var crypto=require(_0xf42a('0x2'));var logger=require('../../../../../../config/logger')(_0xf42a('0x3'));module[_0xf42a('0x4')]=function(_0x471da5,_0x63de40,_0x5e3514,_0x568bbd){return new BPromise(function(_0x185457,_0x4bc0a0){logger[_0xf42a('0x5')]('Tilde\x20URI',_0x568bbd||_0xf42a('0x6'));var _0x3220e2=new WebSocket(_0x568bbd||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3c24a0='';var _0x1dbde2='0';var _0x2d1f6e='1';var _0xbcea14=_0xf42a('0x7');function _0x1c8297(_0x414471){var _0x241449=crypto[_0xf42a('0x8')](_0xf42a('0x9'));_0x241449[_0xf42a('0xa')](_0x414471);return _0x241449[_0xf42a('0xb')]('hex');}function _0x2a0e1a(){try{logger[_0xf42a('0x5')](_0xf42a('0xc'));var _0x19f854=moment()[_0xf42a('0xd')]();var _0x17abb4=_0x1c8297(_0x19f854+_0x63de40+_0x5e3514);_0x3220e2[_0xf42a('0xe')](JSON['stringify']({'appID':_0x63de40,'timestamp':_0x19f854,'appKey':_0x17abb4}));var _0x337788=fs[_0xf42a('0xf')](_0x471da5);_0x337788['on'](_0xf42a('0x10'),function(_0x2781b1){_0x3220e2[_0xf42a('0xe')](_0x2781b1);});_0x337788['on'](_0xf42a('0x11'),function(){_0x3220e2['send']('EOS');});}catch(_0x1e0778){logger['error'](_0xf42a('0x12'),JSON['stringify'](_0x1e0778));_0x3220e2[_0xf42a('0x13')]();}}function _0x4ffcd6(_0x4daec2){try{if(_0x4daec2){var _0x2b3f2a=JSON[_0xf42a('0x14')](_0x4daec2);switch(_0x2b3f2a[_0xf42a('0x15')]){case 0x0:if(_0x2b3f2a['result']){if(_0x2b3f2a['result'][_0xf42a('0x16')]){logger['info'](_0xf42a('0x17'),JSON[_0xf42a('0x18')](_0x2b3f2a[_0xf42a('0x19')][_0xf42a('0x1a')]));_0x3c24a0=_0x2b3f2a[_0xf42a('0x19')][_0xf42a('0x1a')][0x0]['transcript'];_0x1dbde2=_0x2b3f2a[_0xf42a('0x19')][_0xf42a('0x1a')][0x0][_0xf42a('0x1b')];_0x2d1f6e='0';_0xbcea14=_0xf42a('0x1c');_0x3220e2[_0xf42a('0x13')]();}}break;case 0x1:logger['info'](_0xf42a('0x7'));_0x2d1f6e='1';_0xbcea14=_0xf42a('0x7');break;case 0x2:logger[_0xf42a('0x5')](_0xf42a('0x1d'));_0x2d1f6e='2';_0xbcea14=_0xf42a('0x1d');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d1f6e='9';_0xbcea14=_0xf42a('0x1e');break;case 0xa:logger[_0xf42a('0x5')]('Authentication\x20failed.');_0x2d1f6e='10';_0xbcea14=_0xf42a('0x1f');break;case 0xb:logger[_0xf42a('0x5')](_0xf42a('0x20'));_0x2d1f6e='11';_0xbcea14=_0xf42a('0x20');}}}catch(_0x3c815a){logger[_0xf42a('0x21')](_0xf42a('0x22'),JSON[_0xf42a('0x18')](_0x3c815a));_0x3220e2['terminate']();}}function _0x37de90(){logger[_0xf42a('0x5')](_0xf42a('0x23'));_0x185457({'transcript':_0x3c24a0,'confidence':_0x1dbde2,'status':_0x2d1f6e,'status_message':_0xbcea14});}function _0x1afdb4(_0x14f5ce){logger[_0xf42a('0x21')](_0xf42a('0x24'));if(!_[_0xf42a('0x25')](_0x14f5ce)){logger[_0xf42a('0x21')](_['isObject'](_0x14f5ce)?JSON['stringify'](_0x14f5ce):_0x14f5ce);}}_0x3220e2['on'](_0xf42a('0x26'),_0x2a0e1a);_0x3220e2['on'](_0xf42a('0x27'),_0x4ffcd6);_0x3220e2['on'](_0xf42a('0x11'),_0x37de90);_0x3220e2['on']('error',_0x1afdb4);});}; \ 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 20a2dcf..10f73e9 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6bc=['./asr','exports'];(function(_0x40a29b,_0x275b30){var _0x56e29d=function(_0x572a8f){while(--_0x572a8f){_0x40a29b['push'](_0x40a29b['shift']());}};_0x56e29d(++_0x275b30);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xd6bc[_0x525c7b];return _0x27b33e;};var asr=require(_0xcd6b('0x0'));module[_0xcd6b('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7b7f=['./asr','exports'];(function(_0x47218c,_0x4bba6f){var _0x5aee46=function(_0x47bd43){while(--_0x47bd43){_0x47218c['push'](_0x47218c['shift']());}};_0x5aee46(++_0x4bba6f);}(_0x7b7f,0x118));var _0xf7b7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7b7f[_0x5ddb1c];return _0x354adc;};var asr=require(_0xf7b7('0x0'));module[_0xf7b7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index df42389..f3f2c97 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 _0xca8d=['getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection'];(function(_0x40736a,_0x4ed684){var _0x4a47aa=function(_0x4c2144){while(--_0x4c2144){_0x40736a['push'](_0x40736a['shift']());}};_0x4a47aa(++_0x4ed684);}(_0xca8d,0x172));var _0xdca8=function(_0x3576c0,_0x196351){_0x3576c0=_0x3576c0-0x0;var _0x310e7d=_0xca8d[_0x3576c0];return _0x310e7d;};'use strict';var util=require(_0xdca8('0x0'));var net=require(_0xdca8('0x1'));var EventEmitter=require(_0xdca8('0x2'))[_0xdca8('0x3')];var AGIError=require(_0xdca8('0x4'));var AGIChannel=require(_0xdca8('0x5'));var AGIServer=function(_0x1685a4,_0x4cfc92,_0x9e965e){var _0x3bae79=this,_0x1685a4=_0x1685a4||0x11dd,_0x4cfc92=_0x4cfc92||_0xdca8('0x6'),_0x4d6383=null,_0x3366d5=0x0;EventEmitter[_0xdca8('0x7')](_0x3bae79);function _0x2f034e(){if(!_0x1685a4){_0x3bae79[_0xdca8('0x8')]('error',new AGIError(_0xdca8('0x9')));return![];}_0x4d6383=net[_0xdca8('0xa')]();_0x4d6383[_0xdca8('0xb')](_0x1685a4,_0x4cfc92);_0x4d6383['on']('listening',function(){_0x3bae79[_0xdca8('0x8')](_0xdca8('0xc'));});_0x4d6383['on'](_0xdca8('0xd'),function(_0x4712c4){_0x4d6383[_0xdca8('0xe')](function(_0x349f88,_0x3dc3e3){if(_0x349f88){_0x3bae79[_0xdca8('0x8')](_0xdca8('0xf'),new AGIError('E_AGI_SERVER_ERROR',_0x349f88));}else if(_0x9e965e&&_0x9e965e<0x0){_0x3bae79['emit'](_0xdca8('0xf'),new AGIError(_0xdca8('0x10')));_0x4712c4[_0xdca8('0x11')]();}else if(_0x9e965e&&_0x9e965e>0x0&&_0x9e965e<_0x3dc3e3){_0x3366d5+=0x1;_0x3bae79[_0xdca8('0x8')](_0xdca8('0xf'),new AGIError(_0xdca8('0x12'),_0x3366d5));_0x4712c4[_0xdca8('0x11')]();}else{var _0x198148=new AGIChannel(_0x4712c4);_0x198148['on'](_0xdca8('0x13'),function(){_0x3bae79[_0xdca8('0x8')](_0xdca8('0xd'),_0x198148);});}});});_0x4d6383['on']('error',function(_0x571809){_0x3bae79[_0xdca8('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x571809[_0xdca8('0x14')]));});_0x4d6383['on']('close',function(){_0x3bae79[_0xdca8('0x8')](_0xdca8('0x15'),new AGIError(_0xdca8('0x16')));});}process['nextTick'](function(){_0x2f034e();});};util['inherits'](AGIServer,EventEmitter);module[_0xdca8('0x17')]=function(_0x17efc8,_0x30acb9,_0x2ae928){return new AGIServer(_0x17efc8,_0x30acb9,_0x2ae928);}; \ No newline at end of file +var _0x34e5=['E_AGI_ARGUMENT_PORT','listening','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error'];(function(_0x3ccd61,_0x414da3){var _0x37def8=function(_0x3d90cd){while(--_0x3d90cd){_0x3ccd61['push'](_0x3ccd61['shift']());}};_0x37def8(++_0x414da3);}(_0x34e5,0x172));var _0x534e=function(_0x2e31c9,_0x53b228){_0x2e31c9=_0x2e31c9-0x0;var _0x517748=_0x34e5[_0x2e31c9];return _0x517748;};'use strict';var util=require('util');var net=require(_0x534e('0x0'));var EventEmitter=require('events')[_0x534e('0x1')];var AGIError=require(_0x534e('0x2'));var AGIChannel=require(_0x534e('0x3'));var AGIServer=function(_0x246650,_0x83eb2d,_0x50b790){var _0x11a158=this,_0x246650=_0x246650||0x11dd,_0x83eb2d=_0x83eb2d||_0x534e('0x4'),_0x117f0c=null,_0x436a92=0x0;EventEmitter[_0x534e('0x5')](_0x11a158);function _0x5620d4(){if(!_0x246650){_0x11a158[_0x534e('0x6')](_0x534e('0x7'),new AGIError(_0x534e('0x8')));return![];}_0x117f0c=net['createServer']();_0x117f0c['listen'](_0x246650,_0x83eb2d);_0x117f0c['on'](_0x534e('0x9'),function(){_0x11a158['emit'](_0x534e('0x9'));});_0x117f0c['on']('connection',function(_0xb30dd6){_0x117f0c[_0x534e('0xa')](function(_0x27561c,_0x529726){if(_0x27561c){_0x11a158[_0x534e('0x6')](_0x534e('0x7'),new AGIError(_0x534e('0xb'),_0x27561c));}else if(_0x50b790&&_0x50b790<0x0){_0x11a158[_0x534e('0x6')](_0x534e('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0xb30dd6[_0x534e('0xc')]();}else if(_0x50b790&&_0x50b790>0x0&&_0x50b790<_0x529726){_0x436a92+=0x1;_0x11a158[_0x534e('0x6')](_0x534e('0x7'),new AGIError(_0x534e('0xd'),_0x436a92));_0xb30dd6[_0x534e('0xc')]();}else{var _0x478027=new AGIChannel(_0xb30dd6);_0x478027['on'](_0x534e('0xe'),function(){_0x11a158[_0x534e('0x6')](_0x534e('0xf'),_0x478027);});}});});_0x117f0c['on']('error',function(_0x4171d6){_0x11a158[_0x534e('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x4171d6[_0x534e('0x10')]));});_0x117f0c['on'](_0x534e('0x11'),function(){_0x11a158[_0x534e('0x6')](_0x534e('0x11'),new AGIError(_0x534e('0x12')));});}process[_0x534e('0x13')](function(){_0x5620d4();});};util[_0x534e('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x1a7790,_0x28145f,_0x466d74){return new AGIServer(_0x1a7790,_0x28145f,_0x466d74);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 80f2ab4..8617b41 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 _0x1db2=['Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\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','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','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','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','lodash','shelljs','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','then','catch','getSquareProject','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','context','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','has','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','RES1','dialtimezone','minutestoadd','scheduledat\x20before','scheduledat','add','minutes','scheduledat\x20after','insertContact','timezones','utcOffset','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','format','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','includes','POST','toUpperCase','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','Amy','aws_text_type','awsLex','aws_secret_access_key','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','split','replaceAll','toString','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','callback_priority','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','setVariable','%s_ROWS_COUNT','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s'];(function(_0x3a61cd,_0x37c866){var _0x3c72be=function(_0x26cc76){while(--_0x26cc76){_0x3a61cd['push'](_0x3a61cd['shift']());}};_0x3c72be(++_0x37c866);}(_0x1db2,0xd9));var _0x21db=function(_0x523152,_0x1404f5){_0x523152=_0x523152-0x0;var _0x450ff2=_0x1db2[_0x523152];return _0x450ff2;};'use strict';var fs=require('fs');var path=require(_0x21db('0x0'));var util=require(_0x21db('0x1'));var _=require(_0x21db('0x2'));var sh=require(_0x21db('0x3'));var odbc=require('odbc')();var rs=require(_0x21db('0x4'));var moment=require(_0x21db('0x5'));var Mustache=require(_0x21db('0x6'));var rp=require(_0x21db('0x7'));var logger=require('../../config/logger')(_0x21db('0x8'));var config=require(_0x21db('0x9'));var shared=require(_0x21db('0xa'));var scripts=require(_0x21db('0xb'));var FILES_PATH=_0x21db('0xc');var recursiveMapAttributes=[_0x21db('0xd'),_0x21db('0xe')];var verticesWithRetry=['menu',_0x21db('0xf'),_0x21db('0x10')];var AGIVertices=function(_0x359e15,_0x186938,_0x2e16b8){this[_0x21db('0x11')]=_0x359e15;this[_0x21db('0x12')]=_0x186938;this[_0x21db('0x13')]=_0x2e16b8;};AGIVertices[_0x21db('0x14')][_0x21db('0x15')]=function(_0x3afd90,_0x2bf9fb){this[_0x21db('0x12')][_0x21db('0x16')](_0x3afd90)['then'](function(_0x10b31e){_0x2bf9fb(null,_0x10b31e?_0x10b31e[_0x21db('0x17')]:![]);})['catch'](function(_0x2dccac){_0x2bf9fb(_0x2dccac);});};AGIVertices[_0x21db('0x14')][_0x21db('0x18')]=function(_0x2f542a,_0x4b6aa5){this['rpc']['getVoiceQueueById'](_0x2f542a)[_0x21db('0x19')](function(_0x1c717c){_0x4b6aa5(null,_0x1c717c?_0x1c717c[_0x21db('0x17')]:![]);})[_0x21db('0x1a')](function(_0x4793c7){_0x4b6aa5(_0x4793c7);});};AGIVertices[_0x21db('0x14')][_0x21db('0x1b')]=function(_0x2211e7,_0x26ec54){this['rpc']['getSquareProjectById'](_0x2211e7)['then'](function(_0x5db2b6){_0x26ec54(null,_0x5db2b6?_0x5db2b6[_0x21db('0x17')]:![]);})[_0x21db('0x1a')](function(_0x471aac){_0x26ec54(_0x471aac);});};AGIVertices[_0x21db('0x14')]['getSquareOdbc']=function(_0x3cf731,_0x53a2ff){this[_0x21db('0x12')]['getSquareOdbcById'](_0x3cf731)[_0x21db('0x19')](function(_0x51371b){_0x53a2ff(null,_0x51371b?_0x51371b[_0x21db('0x1c')]:![]);})[_0x21db('0x1a')](function(_0x3eb460){_0x53a2ff(_0x3eb460);});};AGIVertices['prototype'][_0x21db('0x1d')]=function(_0x3ca554,_0x1d614f){this['rpc']['getUserById'](_0x3ca554)['then'](function(_0x1bbfd6){_0x1d614f(null,_0x1bbfd6?_0x1bbfd6['name']:![]);})[_0x21db('0x1a')](function(_0x160f5d){_0x1d614f(_0x160f5d);});};AGIVertices[_0x21db('0x14')][_0x21db('0x1e')]=function(_0x1a1e94,_0x46b4ec){this[_0x21db('0x12')][_0x21db('0x1f')](_0x1a1e94)[_0x21db('0x19')](function(_0x282db2){_0x46b4ec(null,_0x282db2?_0x282db2['name']:![]);})[_0x21db('0x1a')](function(_0x257714){_0x46b4ec(_0x257714);});};AGIVertices['prototype'][_0x21db('0x20')]=function(_0x44d0d0,_0x3390c2){var _0x1f7d0f=this;this[_0x21db('0x12')][_0x21db('0x21')](_0x44d0d0)['then'](function(_0x46e9c2){_0x3390c2(null,_0x46e9c2?_0x1f7d0f[_0x21db('0x22')](_0x46e9c2[_0x21db('0x23')]):![]);})['catch'](function(_0x4991c2){_0x3390c2(_0x4991c2);});};AGIVertices['prototype'][_0x21db('0x24')]=function(_0x19a53c,_0x1dbb2f){this[_0x21db('0x12')]['getMailAccountById'](_0x19a53c)[_0x21db('0x19')](function(_0x467c8b){_0x1dbb2f(null,_0x467c8b?_0x467c8b:![]);})[_0x21db('0x1a')](function(_0x1795e6){_0x1dbb2f(_0x1795e6);});};AGIVertices['prototype']['sendMailMessage']=function(_0x163014,_0x164ec6,_0x1a7aba){this[_0x21db('0x13')][_0x21db('0x25')](_0x163014,_0x164ec6)[_0x21db('0x19')](function(){_0x1a7aba(null);})[_0x21db('0x1a')](function(_0xf883ad){_0x1a7aba(_0xf883ad);});};AGIVertices[_0x21db('0x14')][_0x21db('0x26')]=function(_0x52c013,_0x287fc9){this['rpc']['getIntervalById'](_0x52c013)[_0x21db('0x19')](function(_0x321ae4){if(_0x321ae4){if(_0x321ae4[_0x21db('0x27')]){_0x287fc9(null,[_0x321ae4[_0x21db('0x28')]]);}else{_0x287fc9(null,_['map'](_0x321ae4[_0x21db('0x29')],_0x21db('0x28')));}}else{_0x287fc9(null,![]);}})[_0x21db('0x1a')](function(_0x5a476b){_0x287fc9(_0x5a476b);});};AGIVertices['prototype']['getSoundPath']=function(_0x12eb24){return util['format'](_0x21db('0x2a'),FILES_PATH,_0x12eb24);};AGIVertices[_0x21db('0x14')][_0x21db('0x2b')]=function(_0x382314,_0x271f69,_0x25a43f){odbc['open'](_0x382314,function(_0x521d46){if(_0x521d46){logger[_0x21db('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x521d46);_0x25a43f(_0x521d46);}else{logger[_0x21db('0x2d')](_0x21db('0x2e'));odbc[_0x21db('0x2f')](_0x271f69,function(_0x364152,_0x14fe9b){if(_0x364152){logger[_0x21db('0x2d')](_0x21db('0x30'),_0x271f69);_0x25a43f(_0x364152);}else{logger[_0x21db('0x2d')]('Query\x20executed\x20correctly\x20%s',_0x271f69);odbc[_0x21db('0x31')](function(_0x22211b){if(_0x22211b){logger[_0x21db('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x22211b);}_0x25a43f(null,_0x14fe9b);});}});}});};AGIVertices[_0x21db('0x14')]['getSmsAccount']=function(_0xd0468a,_0x12db0c){this['rpc']['getSmsAccountById'](_0xd0468a)['then'](function(_0x1a725e){_0x12db0c(null,_0x1a725e?_0x1a725e:![]);})[_0x21db('0x1a')](function(_0x1f0b6f){_0x12db0c(_0x1f0b6f);});};AGIVertices[_0x21db('0x14')][_0x21db('0x32')]=function(_0x12788f,_0x4bcb23){this[_0x21db('0x12')]['createSmsMessage'](_0x12788f)['then'](function(_0x58f298){_0x4bcb23(null,_0x58f298);})['catch'](function(_0x8de7f8){_0x4bcb23(_0x8de7f8);});};AGIVertices[_0x21db('0x14')]['createSquareDetailsReport']=function(_0x1ab1e1,_0x35a464,_0x2a508e){this[_0x21db('0x12')][_0x21db('0x33')]({'uniqueid':this['channel'][_0x21db('0x34')],'node':_0x1ab1e1['label'],'application':_0x1ab1e1['agicommand'],'data':_0x35a464||null,'project_name':this[_0x21db('0x11')][_0x21db('0x35')],'callerid':this[_0x21db('0x11')][_0x21db('0x36')]})[_0x21db('0x19')](function(_0x45cd84){if(_0x2a508e){_0x2a508e(null,_0x45cd84);}})[_0x21db('0x1a')](function(_0x4171e6){if(_0x2a508e){_0x2a508e(_0x4171e6);}});};AGIVertices[_0x21db('0x14')][_0x21db('0x37')]=function(_0x29fab0,_0x3d4428,_0x4c99c3,_0x27c86e){this[_0x21db('0x12')][_0x21db('0x37')]({'uniqueid':this[_0x21db('0x11')][_0x21db('0x34')],'callerid':this[_0x21db('0x11')][_0x21db('0x36')],'calleridname':this[_0x21db('0x11')]['calleridname'],'context':this[_0x21db('0x11')][_0x21db('0x38')],'extension':this[_0x21db('0x11')]['extension'],'priority':this[_0x21db('0x11')][_0x21db('0x39')],'accountcode':this[_0x21db('0x11')][_0x21db('0x3a')],'dnid':this['channel']['dnid'],'projectName':this[_0x21db('0x11')][_0x21db('0x35')],'saveName':_0x3d4428,'filename':_0x29fab0[_0x21db('0x3b')]||_0x3d4428,'savePath':_0x4c99c3})[_0x21db('0x19')](function(_0x29106e){_0x27c86e(null,_0x29106e);})[_0x21db('0x1a')](function(_0x5cad47){_0x27c86e(_0x5cad47);});};AGIVertices[_0x21db('0x14')]['createSquareMessage']=function(_0x2530aa,_0x31f658,_0x30fce0){this[_0x21db('0x12')][_0x21db('0x3c')]({'uniqueid':this['channel'][_0x21db('0x34')],'body':_0x2530aa,'direction':_0x31f658})[_0x21db('0x19')](function(_0x549610){if(_0x30fce0){_0x30fce0(null,_0x549610);}})[_0x21db('0x1a')](function(_0x51499a){if(_0x30fce0){_0x30fce0(_0x51499a);}});};AGIVertices['prototype'][_0x21db('0x3d')]=function(_0x1889b1,_0x2d1c45){console[_0x21db('0x3e')](_0x21db('0x3f'),_0x1889b1);console[_0x21db('0x3e')](_0x21db('0x40'),_0x2d1c45);var _0x4b7957=this;var _0xdd54a6=0x0;var _0x572043={'firstName':_[_0x21db('0x41')](_0x1889b1[_0x21db('0x17')])||_[_0x21db('0x42')](_0x1889b1['name'])?_0x21db('0x43')+Math['random']():_0x1889b1[_0x21db('0x17')],'lastName':_[_0x21db('0x41')](_0x1889b1[_0x21db('0x44')])||_[_0x21db('0x42')](_0x1889b1[_0x21db('0x44')])?null:_0x1889b1[_0x21db('0x44')],'phone':_0x1889b1[_0x21db('0x45')],'ListId':_0x1889b1['list_id'],'scheduledat':_0x1889b1[_0x21db('0x46')],'callbackUniqueid':this['channel'][_0x21db('0x34')],'tags':_0x21db('0x47'),'description':_0x21db('0x48')+_0x1889b1[_0x21db('0x46')]['toString'](),'priority':_0x1889b1['callback_priority']};if(_[_0x21db('0x49')](_0x1889b1,_0x21db('0x4a'))){if(!_[_0x21db('0x42')](_0x1889b1['dialTimezone'])){var _0x16445c=_0x1889b1['dialTimezone'];console['log'](_0x21db('0x4b'),_0x16445c);if(_0x1889b1[_0x21db('0x4a')]==_0x21db('0x4c')){this[_0x21db('0x12')][_0x21db('0x4d')]({'phone':_0x1889b1[_0x21db('0x45')]})[_0x21db('0x19')](function(_0x416c92){console[_0x21db('0x3e')](_0x21db('0x4e'),_0x416c92);var _0x28758f=_0x416c92[_0x21db('0x4a')];console['log'](_0x21db('0x4f'),_0x28758f);if(!_[_0x21db('0x42')](_0x28758f)){var _0x10bcdc=shared['timezones'][_0x28758f];console['log']('tz',_0x10bcdc);if(!_['isNil'](_0x10bcdc)){var _0x44e8c2=-0x1*_0x10bcdc['utcOffset'];console['log'](_0x21db('0x50'),_0x44e8c2);console[_0x21db('0x3e')](_0x21db('0x51'),_0x572043['scheduledat']);_0x572043[_0x21db('0x52')]=moment(_0x1889b1[_0x21db('0x52')])[_0x21db('0x53')](_0x44e8c2,_0x21db('0x54'));console[_0x21db('0x3e')](_0x21db('0x55'),_0x572043[_0x21db('0x52')]);_0x4b7957['insertContact'](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x1ad187){_0x2d1c45(null,_0x1ad187);})[_0x21db('0x1a')](function(_0x55663a){_0x2d1c45(_0x55663a);});}else{_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x32ac53){_0x2d1c45(null,_0x32ac53);})[_0x21db('0x1a')](function(_0x2045ac){_0x2d1c45(_0x2045ac);});}}else{_0x4b7957['insertContact'](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x5ab999){_0x2d1c45(null,_0x5ab999);})[_0x21db('0x1a')](function(_0x3965ff){_0x2d1c45(_0x3965ff);});}});}else{var _0xdd54a6=shared[_0x21db('0x57')][_0x16445c];if(!_['isNil'](_0xdd54a6)){var _0x1c48bb=-0x1*_0xdd54a6[_0x21db('0x58')];_0x572043['scheduledat']=moment(_0x1889b1[_0x21db('0x52')])['add'](_0x1c48bb,_0x21db('0x54'));_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0xf30f7c){_0x2d1c45(null,_0xf30f7c);})['catch'](function(_0x30d857){_0x2d1c45(_0x30d857);});}else{_0x4b7957['insertContact'](_0x572043,_0x1889b1,_0x2d1c45)['then'](function(_0x58e179){_0x2d1c45(null,_0x58e179);})['catch'](function(_0x1f87e0){_0x2d1c45(_0x1f87e0);});}}}else{_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x27f809){_0x2d1c45(null,_0x27f809);})[_0x21db('0x1a')](function(_0xe07756){_0x2d1c45(_0xe07756);});}}else{_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x54de36){_0x2d1c45(null,_0x54de36);})[_0x21db('0x1a')](function(_0x52e7a4){_0x2d1c45(_0x52e7a4);});}};AGIVertices[_0x21db('0x14')]['insertContact']=function(_0x1d407d,_0x34e5d6,_0x4faf5f){this[_0x21db('0x12')][_0x21db('0x3d')](_0x1d407d)[_0x21db('0x19')](function(_0x5376a5){_0x4faf5f(null,_0x5376a5);})[_0x21db('0x1a')](function(_0xd27363){_0x4faf5f(_0xd27363);});};AGIVertices[_0x21db('0x14')][_0x21db('0x59')]=function(_0x42554b,_0x22a1ee){this[_0x21db('0x12')][_0x21db('0x5a')](_0x42554b)[_0x21db('0x19')](function(_0xa2ba37){_0x22a1ee(null,_0xa2ba37?_0xa2ba37[_0x21db('0x17')]:![]);})['catch'](function(_0x16e0c7){_0x22a1ee(_0x16e0c7);});};AGIVertices[_0x21db('0x14')]['agentPause']=function(_0x245271,_0x4f568e,_0x379a8b){var _0x4fef9b={'role':_0x21db('0x5b')};_0x4fef9b[_0x245271]=this[_0x21db('0x11')]['callerid'];this[_0x21db('0x12')][_0x21db('0x5c')](_0x4fef9b,_0x4f568e,this[_0x21db('0x11')][_0x21db('0x34')])[_0x21db('0x19')](function(_0x1e0bd1){_0x379a8b(null,_['isNil'](_0x1e0bd1)?![]:!![]);})[_0x21db('0x1a')](function(_0x569535){logger[_0x21db('0x2c')](_0x569535);_0x379a8b(null,![]);});};AGIVertices[_0x21db('0x14')][_0x21db('0x5d')]=function(_0x1cf6de,_0x62bde8){var _0xc93b5a={'role':_0x21db('0x5b')};_0xc93b5a[_0x1cf6de]=this[_0x21db('0x11')][_0x21db('0x36')];this[_0x21db('0x12')][_0x21db('0x5d')](_0xc93b5a)[_0x21db('0x19')](function(_0x1d171a){_0x62bde8(null,_[_0x21db('0x42')](_0x1d171a)?![]:!![]);})['catch'](function(_0x325c87){logger[_0x21db('0x2c')](_0x325c87);_0x62bde8(null,![]);});};AGIVertices[_0x21db('0x14')][_0x21db('0x5e')]=function(_0x412548,_0x271b75){var _0x4a0beb={'role':_0x21db('0x5b')};_0x4a0beb[_0x412548]=this['channel'][_0x21db('0x36')];this[_0x21db('0x12')][_0x21db('0x5e')](_0x4a0beb)['then'](function(_0x1079f3){_0x271b75(null,_[_0x21db('0x42')](_0x1079f3)?![]:!![]);})[_0x21db('0x1a')](function(_0x359b99){logger[_0x21db('0x2c')](_0x359b99);_0x271b75(null,![]);});};AGIVertices[_0x21db('0x14')]['agentLogin']=function(_0x22e38f,_0x48c27e){var _0x5e2ee8={'role':_0x21db('0x5b')};_0x5e2ee8[_0x22e38f]=this[_0x21db('0x11')][_0x21db('0x36')];var _0x77666f=_0x22e38f!='internal'?util[_0x21db('0x5f')]('%s/%s@from-sip/n',_0x21db('0x60'),this[_0x21db('0x11')][_0x21db('0x36')]):undefined;this[_0x21db('0x12')][_0x21db('0x61')](_0x5e2ee8,_0x77666f)['then'](function(_0x53ac17){_0x48c27e(null,_[_0x21db('0x42')](_0x53ac17)?![]:!![]);})[_0x21db('0x1a')](function(_0x82a342){logger[_0x21db('0x2c')](_0x82a342);_0x48c27e(null,![]);});};AGIVertices['prototype'][_0x21db('0x62')]=function(_0x327dd0,_0x357207){sh[_0x21db('0x63')](_[_0x21db('0x64')](_0x327dd0),function(_0xff110e,_0x2659ce){var _0x2b0db8=_0x2659ce[_0x21db('0x65')](/(\r\n|\n|\r)/gm,'');_0x357207(null,_0x2b0db8);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x54d593,_0x3ef79b){scripts[_0x21db('0x66')](_0x54d593[_0x21db('0x67')],_0x54d593[_0x21db('0x68')]||_0x21db('0x69'),_0x54d593[_0x21db('0x69')],_0x54d593[_0x21db('0x6a')]||'en-US',_0x54d593[_0x21db('0x6b')]||_0x21db('0x6c'),_0x54d593[_0x21db('0x6d')]||_0x21db('0x6e'))['then'](function(_0x34a17b){_0x3ef79b(null,_0x34a17b);})['catch'](function(_0x50782e){_0x3ef79b(_0x50782e);});};AGIVertices[_0x21db('0x14')][_0x21db('0x6f')]=function(_0xe93798,_0x53a31e){scripts[_0x21db('0x6f')](_0xe93798[_0x21db('0x69')],_0xe93798[_0x21db('0x70')]||'en',0x1)['then'](function(_0x4a93f1){_0x53a31e(null,_0x4a93f1);})[_0x21db('0x1a')](function(_0xaa5f18){_0x53a31e(_0xaa5f18);});};AGIVertices[_0x21db('0x14')]['restAPI']=function(_0x2dc51e,_0x522fb4){var _0x1d7034={'uri':_0x2dc51e['url'],'method':_0x2dc51e[_0x21db('0x71')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2dc51e[_0x21db('0x72')])==='number'&&parseInt(_0x2dc51e[_0x21db('0x72')])>=0x1?parseInt(_0x2dc51e[_0x21db('0x72')])*0x3e8:0x5*0x3e8};if(_[_0x21db('0x73')]([_0x21db('0x74'),'PUT'],_0x1d7034[_0x21db('0x71')][_0x21db('0x75')]())){try{_0x1d7034['body']=_0x2dc51e['rawBody']?JSON['parse'](_0x2dc51e[_0x21db('0xe')]):{};}catch(_0x110fc8){logger[_0x21db('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x110fc8);}}try{_0x1d7034[_0x21db('0x76')]=_0x2dc51e[_0x21db('0xd')]?JSON[_0x21db('0x77')](_0x2dc51e[_0x21db('0xd')]):{};}catch(_0x480138){logger[_0x21db('0x2c')](_0x21db('0x78'),_0x480138);}if(_0x2dc51e['computedVariables']){try{var _0x291941=require(_0x2dc51e[_0x21db('0x79')])[_0x21db('0x7a')](this,_0x1d7034);_0x1d7034[_0x21db('0x7b')]=Mustache[_0x21db('0x7c')](_0x2dc51e[_0x21db('0x7d')],_0x291941,{},['$$','$$']);if(_0x1d7034[_0x21db('0x76')]){_0x1d7034[_0x21db('0x76')]=JSON[_0x21db('0x77')](Mustache[_0x21db('0x7c')](JSON[_0x21db('0x7e')](_0x1d7034[_0x21db('0x76')]),_0x291941,{},['$$','$$']));}if(_0x1d7034[_0x21db('0x7f')]){_0x1d7034[_0x21db('0x7f')]=JSON[_0x21db('0x77')](Mustache[_0x21db('0x7c')](JSON[_0x21db('0x7e')](_0x1d7034[_0x21db('0x7f')]),_0x291941,{},['$$','$$']));}}catch(_0x5629e8){logger[_0x21db('0x2c')](_0x21db('0x80'),_0x5629e8);}}rp(_0x1d7034)[_0x21db('0x19')](function(_0x515c51){var _0x354e3f={'statusCode':_0x515c51[_0x21db('0x81')]||0xc8,'statusMessage':_0x515c51['statusMessage']||'OK','headers':_0x515c51[_0x21db('0x76')]||{},'body':_0x515c51[_0x21db('0x7f')]||{}};_0x522fb4(null,_0x354e3f);})[_0x21db('0x1a')](function(_0x480c3a){var _0x5d526e={'statusCode':_0x480c3a[_0x21db('0x81')]||0x1f4,'statusMessage':_0x480c3a[_0x21db('0x82')]||_0x21db('0x83'),'headers':_0x480c3a[_0x21db('0x84')]['headers']||{},'body':_0x480c3a[_0x21db('0x84')][_0x21db('0x7f')]||{}};_0x522fb4(null,_0x5d526e);});};AGIVertices['prototype'][_0x21db('0x85')]=function(_0x26a775,_0x39132b){scripts[_0x21db('0x85')](this[_0x21db('0x11')][_0x21db('0x34')],_0x26a775[_0x21db('0x86')],_0x26a775[_0x21db('0x69')],_0x26a775[_0x21db('0x87')]||'en')[_0x21db('0x19')](function(_0x21c094){_0x39132b(null,_0x21c094);})[_0x21db('0x1a')](function(_0x3a74e3){_0x39132b(_0x3a74e3);});};AGIVertices['prototype'][_0x21db('0x88')]=function(_0x24e918,_0x191ec){scripts[_0x21db('0x88')](this[_0x21db('0x11')],_0x24e918)[_0x21db('0x19')](function(_0x491fa2){_0x191ec(null,_0x491fa2);})[_0x21db('0x1a')](function(_0x2d787d){_0x191ec(_0x2d787d);});};AGIVertices[_0x21db('0x14')]['ispeechTTS']=function(_0x495248,_0x24a5fa){scripts[_0x21db('0x89')](_0x495248['key'],_0x495248[_0x21db('0x69')],_0x495248[_0x21db('0x8a')]||_0x21db('0x8b'),_0x495248[_0x21db('0x8c')])[_0x21db('0x19')](function(_0x503440){_0x24a5fa(null,_0x503440);})[_0x21db('0x1a')](function(_0x56f823){_0x24a5fa(_0x56f823);});};AGIVertices[_0x21db('0x14')][_0x21db('0x8d')]=function(_0x17b5ed,_0x46f646,_0x323982){scripts['ispeechASR'](_0x46f646,_0x17b5ed[_0x21db('0x86')],_0x17b5ed['ispeech_asr_language']||_0x21db('0x8b'),this[_0x21db('0x8e')](_0x17b5ed[_0x21db('0x8f')])?_0x17b5ed[_0x21db('0x8f')]:undefined)[_0x21db('0x19')](function(_0x50ca0d){_0x323982(null,_0x50ca0d);})['catch'](function(_0x329db6){_0x323982(_0x329db6);});};AGIVertices['prototype'][_0x21db('0x90')]=function(_0x3f6be3,_0xcc6835){scripts[_0x21db('0x90')](_0x3f6be3['aws_access_key_id'],_0x3f6be3['aws_secret_access_key'],_0x3f6be3['aws_polly_region'],_0x3f6be3['aws_polly_voice']||_0x21db('0x91'),_0x3f6be3[_0x21db('0x69')],_0x3f6be3[_0x21db('0x92')]||_0x21db('0x69'))[_0x21db('0x19')](function(_0x122a96){_0xcc6835(null,_0x122a96);})[_0x21db('0x1a')](function(_0x30b714){_0xcc6835(_0x30b714);});};AGIVertices['prototype']['awsLex']=function(_0x100fe3,_0x1e5009){scripts[_0x21db('0x93')](this['channel'][_0x21db('0x34')],_0x100fe3['aws_access_key_id'],_0x100fe3[_0x21db('0x94')],_0x100fe3['aws_lex_region'],_0x100fe3[_0x21db('0x69')],_0x100fe3['aws_bot_name'])[_0x21db('0x19')](function(_0x4c5b8d){_0x1e5009(null,_0x4c5b8d);})[_0x21db('0x1a')](function(_0x451400){_0x1e5009(_0x451400);});};AGIVertices[_0x21db('0x14')][_0x21db('0x95')]=function(_0x34c54d,_0x4cf68f,_0x319636){scripts[_0x21db('0x95')](_0x4cf68f,_0x34c54d[_0x21db('0x86')],_0x34c54d[_0x21db('0x96')]||'en-US')[_0x21db('0x19')](function(_0x11a744){_0x319636(null,_0x11a744);})['catch'](function(_0x4a5c66){_0x319636(_0x4a5c66);});};AGIVertices['prototype'][_0x21db('0x97')]=function(_0x3293ef,_0x210666,_0x553de7){scripts['tildeASR'](_0x210666,_0x3293ef[_0x21db('0x98')],_0x3293ef[_0x21db('0x99')],_0x3293ef[_0x21db('0x7b')])['then'](function(_0x28be15){_0x553de7(null,_0x28be15);})[_0x21db('0x1a')](function(_0xa3db21){_0x553de7(_0xa3db21);});};AGIVertices[_0x21db('0x14')][_0x21db('0x9a')]=function(_0x6c6b2a){var _0x57896=_['includes'](verticesWithRetry,_0x6c6b2a[_0x21db('0x9b')])?_0x6c6b2a:_[_0x21db('0x9c')](_0x6c6b2a);for(var _0x207915 in _0x57896){if(_0x57896[_0x21db('0x9d')](_0x207915)){if(_0x57896[_0x207915]&&_[_0x21db('0x9e')](_0x57896[_0x207915])){if(_[_0x21db('0x73')](recursiveMapAttributes,_0x207915)){_0x57896[_0x207915]=this[_0x21db('0x9f')](_0x57896[_0x207915]);}else{_0x57896[_0x207915]=this['replaceAllVariables'](_0x57896[_0x207915]);}}}}return _0x57896;};AGIVertices['prototype'][_0x21db('0xa0')]=function(_0x628f15){for(var _0x4a3925 in _0x628f15){if(_0x628f15[_0x21db('0x9d')](_0x4a3925)){if(_[_0x21db('0xa1')](_0x628f15[_0x4a3925])){this[_0x21db('0xa0')](_0x628f15[_0x4a3925]);}else if(_['isArray'](_0x628f15[_0x4a3925])){for(var _0x9799aa=0x0;_0x9799aa<_0x628f15[_0x4a3925][_0x21db('0xa2')];_0x9799aa++){this[_0x21db('0xa0')](_0x628f15[_0x4a3925][_0x9799aa]);}}else if(_[_0x21db('0x9e')](_0x628f15[_0x4a3925])){_0x628f15[_0x4a3925]=this[_0x21db('0xa3')](_0x628f15[_0x4a3925]);}}}};AGIVertices[_0x21db('0x14')][_0x21db('0xa4')]=function(_0x565314,_0x490686){for(var _0xaa98f4 in _0x565314){if(_0x565314[_0x21db('0x9d')](_0xaa98f4)){if(_[_0x21db('0xa1')](_0x565314[_0xaa98f4])){if(!_[_0x21db('0x41')](_0x565314[_0xaa98f4])){this[_0x21db('0xa4')](_0x565314[_0xaa98f4],util[_0x21db('0x5f')](_0x21db('0xa5'),_0x490686,_0xaa98f4));}}else if(_['isArray'](_0x565314[_0xaa98f4])){for(var _0x4558ae=0x0;_0x4558ae<_0x565314[_0xaa98f4][_0x21db('0xa2')];_0x4558ae++){this[_0x21db('0xa4')](_0x565314[_0xaa98f4][_0x4558ae],util[_0x21db('0x5f')](_0x21db('0xa5'),_0x490686,_0xaa98f4+'['+_0x4558ae+']'));}}else{if(!_[_0x21db('0x42')](_0x565314[_0xaa98f4])){this[_0x21db('0x11')]['setVariable'](util[_0x21db('0x5f')](_0x21db('0xa5'),_0x490686,_0xaa98f4),_0x565314[_0xaa98f4]);}}}}};AGIVertices[_0x21db('0x14')][_0x21db('0x9f')]=function(_0x2d8b21){try{var _0x54f17b=JSON['parse'](_0x2d8b21);this[_0x21db('0xa0')](_0x54f17b);return JSON[_0x21db('0x7e')](_0x54f17b);}catch(_0x27bfa9){return this[_0x21db('0xa3')](_0x2d8b21);}};AGIVertices[_0x21db('0x14')][_0x21db('0xa3')]=function(_0x26ff89){console['log']('replaceall\x20init',_0x26ff89);var _0x35116=_0x26ff89['split']('{');for(var _0x1794e6=0x1;_0x1794e6<_0x35116[_0x21db('0xa2')];_0x1794e6+=0x1){var _0x5d7bd5=_0x35116[_0x1794e6][_0x21db('0xa6')]('}');console[_0x21db('0x3e')]('nextbracket',_0x5d7bd5);if(_0x5d7bd5[_0x21db('0xa2')]>0x1){_0x26ff89=_0x26ff89[_0x21db('0xa7')]('{'+_0x5d7bd5[0x0]+'}',this['channel'][_0x21db('0x15')](_0x5d7bd5[0x0])['extra']||_0x5d7bd5[0x0]);}}if(_0x35116[_0x21db('0xa2')]===0x1){return _0x26ff89[_0x21db('0xa8')]();}console['log'](_0x21db('0xa9'),_0x26ff89);return this[_0x21db('0xa3')](_0x26ff89);};AGIVertices[_0x21db('0x14')][_0x21db('0xaa')]=function(_0x5c78ee,_0x24dfde){var _0xa7729f=this[_0x21db('0x11')][_0x21db('0x15')](_0x5c78ee);if(_0xa7729f[_0x21db('0xab')]===-0x1){return _0xa7729f;}logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xac'),_0x24dfde,_0xa7729f['extra']));return this[_0x21db('0x11')]['setVariable'](_0x24dfde,_0xa7729f[_0x21db('0xad')]);};AGIVertices[_0x21db('0x14')]['isConfigured']=function(_0x367ce4){return _0x367ce4&&_0x367ce4!=='0'&&_0x367ce4!=='-1'&&_0x367ce4!=='';};AGIVertices[_0x21db('0x14')][_0x21db('0xae')]=function(_0x1cb0fa){this[_0x21db('0x33')]['sync'](this,_0x1cb0fa,'-');_0x1cb0fa[_0x21db('0xaf')]=_0x1cb0fa[_0x21db('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x21db('0x14')][_0x21db('0xb0')]=function(_0x87ed1c){logger['info'](util[_0x21db('0x5f')](_0x21db('0xb1'),_0x87ed1c[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x87ed1c[_0x21db('0x69')])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xb4'));}var _0x4ccd72='\x22'+_0x87ed1c[_0x21db('0x69')]+'\x22';if(this[_0x21db('0x8e')](_0x87ed1c[_0x21db('0x84')])){_0x4ccd72+=','+_0x87ed1c[_0x21db('0x84')];}var _0x3c3061=this['channel'][_0x21db('0x63')](_0x21db('0xb5'),_0x4ccd72);if(_0x3c3061[_0x21db('0xab')]===-0x1){return _0x3c3061;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4ccd72));};AGIVertices['prototype'][_0x21db('0xb6')]=function(_0x38e845){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xb7'),_0x38e845[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x38e845[_0x21db('0xb8')])){return this['channel'][_0x21db('0xb3')]('no\x20grammar\x20configured');}var _0x4b069e=_0x38e845[_0x21db('0xb8')];if(this[_0x21db('0x8e')](_0x38e845[_0x21db('0x84')])){_0x4b069e+=','+_0x38e845['options'];}var _0x43f562=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xb9'),_0x4b069e);if(_0x43f562['result']===-0x1){return _0x43f562;}var _0xdee744=this[_0x21db('0xaa')](_0x21db('0xba'),'MRCP_RECOG_CONFIDENCE');if(_0xdee744['result']===-0x1){return _0xdee744;}var _0x28b57c=this[_0x21db('0xaa')](_0x21db('0xbb'),_0x21db('0xbc'));if(_0x28b57c[_0x21db('0xab')]===-0x1){return _0x28b57c;}var _0x4ef961=this[_0x21db('0xaa')](_0x21db('0xbd'),_0x21db('0xbe'));if(_0x4ef961['result']===-0x1){return _0x4ef961;}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0xbf'),_0x4b069e));};AGIVertices[_0x21db('0x14')][_0x21db('0x8')]=function(_0x37b52b){logger['info'](util[_0x21db('0x5f')](_0x21db('0xc0'),_0x37b52b[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0x8')]([_0x37b52b[_0x21db('0xc1')],_0x37b52b[_0x21db('0xc2')]]);};AGIVertices['prototype'][_0x21db('0xc3')]=function(_0x93ec1){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x93ec1[_0x21db('0xb2')]));if(this['isConfigured'](_0x93ec1['timeout'])){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x93ec1['timeout']));var _0x5ec83a=this[_0x21db('0x11')][_0x21db('0xc4')](_0x93ec1[_0x21db('0x72')]);if(_0x5ec83a[_0x21db('0xab')]===-0x1){return _0x5ec83a;}}return this[_0x21db('0x11')][_0x21db('0xc3')]();};AGIVertices[_0x21db('0x14')]['callback']=function(_0x828f18){console[_0x21db('0x3e')]('enter\x20in\x20callbackblock',_0x828f18);logger['info'](util[_0x21db('0x5f')](_0x21db('0xc5'),_0x828f18[_0x21db('0xb2')]));if(!this['isConfigured'](_0x828f18['list_id'])){return this['channel'][_0x21db('0x2c')](_0x828f18,_0x21db('0xc6'));}_0x828f18[_0x21db('0x46')]=moment();if(this[_0x21db('0x8e')](_0x828f18[_0x21db('0xc7')])){_0x828f18[_0x21db('0x46')]=moment()['add'](_0x828f18['delay'],_0x21db('0x54'));}if(!this['isConfigured'](_0x828f18[_0x21db('0xc8')])){_0x828f18[_0x21db('0xc8')]=0x2;}console[_0x21db('0x3e')](_0x21db('0xc9'),_0x828f18);this['createCmContact']['sync'](this,_0x828f18);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xca'),_0x828f18[_0x21db('0x45')],_0x828f18['list_id'],_0x828f18[_0x21db('0x46')]));};AGIVertices[_0x21db('0x14')][_0x21db('0xcb')]=function(_0x43a4f9){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xcc'),_0x43a4f9['label']));var _0x28eaa=this[_0x21db('0x11')][_0x21db('0x63')](_0x43a4f9[_0x21db('0xcd')],_0x43a4f9[_0x21db('0x84')]);if(_0x28eaa[_0x21db('0xab')]===-0x1){return _0x28eaa;}return this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')](_0x21db('0xce'),_0x43a4f9[_0x21db('0xcd')],_0x43a4f9['options']));};AGIVertices[_0x21db('0x14')][_0x21db('0xcf')]=function(_0x594779){logger['info'](util[_0x21db('0x5f')](_0x21db('0xd0'),_0x594779[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x594779[_0x21db('0x69')])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20text\x20configured');}var _0x2366d7='\x22'+_0x594779[_0x21db('0x69')]+'\x22';if(this['isConfigured'](_0x594779[_0x21db('0x84')])){_0x2366d7+=','+_0x594779[_0x21db('0x84')];}var _0x1566b5=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xb5'),_0x2366d7);if(_0x1566b5[_0x21db('0xab')]===-0x1){return _0x1566b5;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xd1'),_0x2366d7));};AGIVertices[_0x21db('0x14')][_0x21db('0xd2')]=function(_0x51f3e2){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xd3'),_0x51f3e2['label']));if(!this[_0x21db('0x8e')](_0x51f3e2[_0x21db('0x69')])){return this['channel']['noop'](_0x21db('0xb4'));}var _0x3ac3ba='\x22'+_0x51f3e2['text']+'\x22';if(this['isConfigured'](_0x51f3e2[_0x21db('0x84')])){_0x3ac3ba+=','+_0x51f3e2[_0x21db('0x84')];}var _0x56f718=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xb5'),_0x3ac3ba);if(_0x56f718[_0x21db('0xab')]===-0x1){return _0x56f718;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xd1'),_0x3ac3ba));};AGIVertices[_0x21db('0x14')][_0x21db('0xd4')]=function(_0x20537a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xd5'),_0x20537a['label']));if(!this['isConfigured'](_0x20537a[_0x21db('0xb8')])){return this['channel'][_0x21db('0xb3')](_0x21db('0xd6'));}var _0x142179=_0x20537a[_0x21db('0xb8')];if(this[_0x21db('0x8e')](_0x20537a[_0x21db('0x84')])){_0x142179+=','+_0x20537a[_0x21db('0x84')];}var _0x578c01=this['channel'][_0x21db('0x63')](_0x21db('0xb9'),_0x142179);if(_0x578c01[_0x21db('0xab')]===-0x1){return _0x578c01;}var _0x31792b=this['getAndSetVariable'](_0x21db('0xba'),'LUMENVOX_ASR_CONFIDENCE');if(_0x31792b['result']===-0x1){return _0x31792b;}var _0x1c3ea5=this[_0x21db('0xaa')](_0x21db('0xbb'),_0x21db('0xd7'));if(_0x1c3ea5['result']===-0x1){return _0x1c3ea5;}var _0x345292=this[_0x21db('0xaa')](_0x21db('0xbd'),_0x21db('0xd8'));if(_0x345292[_0x21db('0xab')]===-0x1){return _0x345292;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xbf'),_0x142179));};AGIVertices['prototype']['sestekasr']=function(_0x202afd){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xd9'),_0x202afd[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x202afd['grammar'])){return this[_0x21db('0x11')]['noop'](_0x21db('0xd6'));}var _0x2825d7=_0x202afd[_0x21db('0xb8')];if(this['isConfigured'](_0x202afd[_0x21db('0x84')])){_0x2825d7+=','+_0x202afd[_0x21db('0x84')];}var _0x3c1f08=this[_0x21db('0x11')][_0x21db('0x63')]('MRCPRecog',_0x2825d7);if(_0x3c1f08['result']===-0x1){return _0x3c1f08;}var _0x4f026d=this[_0x21db('0xaa')](_0x21db('0xba'),_0x21db('0xda'));if(_0x4f026d[_0x21db('0xab')]===-0x1){return _0x4f026d;}var _0x2c14c2=this[_0x21db('0xaa')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x2c14c2[_0x21db('0xab')]===-0x1){return _0x2c14c2;}var _0x2d6047=this[_0x21db('0xaa')]('RECOG_INSTANCE()',_0x21db('0xdb'));if(_0x2d6047[_0x21db('0xab')]===-0x1){return _0x2d6047;}return this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')](_0x21db('0xbf'),_0x2825d7));};AGIVertices[_0x21db('0x14')]['database']=function(_0x54042a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xdc'),_0x54042a[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x54042a[_0x21db('0xdd')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x54042a,_0x21db('0xde'));}var _0x2f81c4=this[_0x21db('0xdf')][_0x21db('0x7a')](this,_0x54042a[_0x21db('0xdd')]);if(!_0x2f81c4){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x54042a,_0x21db('0xe0'));}if(!this[_0x21db('0x8e')](_0x54042a['query'])){return this['channel'][_0x21db('0x2c')](_0x54042a,_0x21db('0xe1'));}var _0x44e3c5=_0x54042a[_0x21db('0x2f')][_0x21db('0x65')](/(\r\n|\n|\r)/gm,'\x20');this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xe2'),_0x44e3c5));var _0x11a904=this[_0x21db('0x2b')]['sync'](this,_0x2f81c4,_0x44e3c5);this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x54042a,_0x44e3c5);if(!this['isConfigured'](_0x54042a[_0x21db('0xe3')])){return this[_0x21db('0x11')]['noop'](_0x21db('0xe4'));}var _0x2b0d5e=this['getVariable'][_0x21db('0x7a')](this,_0x54042a[_0x21db('0xe3')]);if(!_0x2b0d5e){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x54042a,_0x21db('0xe5'));}var _0x25c7ae=this;_0x11a904[_0x21db('0xe6')](function(_0x22edff,_0x2b6d63){Object[_0x21db('0xe7')](_0x22edff)[_0x21db('0xe6')](function(_0xb9e1a9){_0x25c7ae[_0x21db('0x11')]['setVariable'](util['format']('%s[%s][%s]',_0x2b0d5e,_0x2b6d63,_0xb9e1a9),_0x22edff[_0xb9e1a9]);});});this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0xe9'),_0x2b0d5e),_0x11a904[_0x21db('0xa2')]);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('variable\x20%s\x20set',_0x2b0d5e));};AGIVertices[_0x21db('0x14')]['dial']=function(_0x3da429){logger[_0x21db('0xea')](util[_0x21db('0x5f')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3da429['label']));if(!this[_0x21db('0x8e')](_0x3da429[_0x21db('0xeb')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3da429,_0x21db('0xec'));}var _0x1717d5=this[_0x21db('0x1d')][_0x21db('0x7a')](this,_0x3da429['sip_id']);if(!_0x1717d5){return this['channel'][_0x21db('0x2c')](_0x3da429,_0x21db('0xed'));}var _0x1f4209=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xee'),[util['format'](_0x21db('0xef'),_0x1717d5),_0x3da429[_0x21db('0x72')],_0x3da429['opts'],_0x3da429['url']]);if(_0x1f4209['result']===-0x1){return _0x1f4209;}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0xf0'),_0x21db('0xee')));};AGIVertices['prototype'][_0x21db('0xf1')]=function(_0x4126b4){logger['info'](util[_0x21db('0x5f')](_0x21db('0xf2'),_0x4126b4[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x4126b4['key'])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20key\x20configured');}if(!this[_0x21db('0x8e')](_0x4126b4[_0x21db('0x69')])){return this['channel'][_0x21db('0xb3')](_0x21db('0xb4'));}this['channel'][_0x21db('0xf3')]=!![];this['createSquareDetailsReport'](_0x4126b4);this[_0x21db('0x3c')](_0x4126b4[_0x21db('0x69')],'in');this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xf4'),_0x4126b4['text']));var _0x51dd9f=this[_0x21db('0x85')]['sync'](this,_0x4126b4);if(_0x51dd9f){for(var _0x332674 in _0x51dd9f){if(_0x51dd9f[_0x21db('0x9d')](_0x332674)){this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0xf5'),_0x332674['toUpperCase']()),_0x51dd9f[_0x332674]);}}this[_0x21db('0x3c')](_0x51dd9f[_0x21db('0xf6')],_0x21db('0xf7'));return this[_0x21db('0x11')]['noop'](util['format'](_0x21db('0xf8'),_0x51dd9f[_0x21db('0xf6')]));}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x4126b4,_0x21db('0xf9'));};AGIVertices[_0x21db('0x14')][_0x21db('0xfa')]=function(_0x1476d8){logger[_0x21db('0x2d')](util['format'](_0x21db('0xfb'),_0x1476d8[_0x21db('0xb2')]));if(!this['isConfigured'](_0x1476d8[_0x21db('0xfc')])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xfd'));}if(!this[_0x21db('0x8e')](_0x1476d8[_0x21db('0xfe')])){return this['channel'][_0x21db('0xb3')](_0x21db('0xff'));}if(!this['isConfigured'](_0x1476d8[_0x21db('0x100')])){return this[_0x21db('0x11')]['noop']('no\x20password\x20configured');}if(!this[_0x21db('0x8e')](_0x1476d8['ndassistant_url'])){return this[_0x21db('0x11')]['noop'](_0x21db('0xb4'));}this[_0x21db('0x11')]['bot']=!![];this[_0x21db('0x33')](_0x1476d8);this[_0x21db('0x3c')](_0x1476d8[_0x21db('0x69')],'in');this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x101'),_0x1476d8[_0x21db('0x69')]));var _0x3e5c06=this['sestekNDA'][_0x21db('0x7a')](this,_0x1476d8);if(_0x3e5c06){for(var _0x5aaa85 in _0x3e5c06){if(_0x3e5c06[_0x21db('0x9d')](_0x5aaa85)){this['channel'][_0x21db('0xe8')](util[_0x21db('0x5f')]('SESTEK_NDA_%s',_0x5aaa85[_0x21db('0x75')]()),_0x3e5c06[_0x5aaa85]);}}this['createSquareMessage'](_0x3e5c06[_0x21db('0xf6')],_0x21db('0xf7'));if(_0x3e5c06['audiofile']){this['channel']['noop'](util[_0x21db('0x5f')](_0x21db('0x102'),_0x3e5c06[_0x21db('0x103')]));var _0xaa7903=this[_0x21db('0x11')][_0x21db('0x104')](_0x3e5c06[_0x21db('0x103')]);try{fs[_0x21db('0x105')](_0x3e5c06[_0x21db('0x103')]+'.wav');}catch(_0x462797){logger[_0x21db('0x2c')](_0x462797);}return _0xaa7903;}else{return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x106'),_0x3e5c06[_0x21db('0xf6')]));}}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1476d8,_0x21db('0x107'));};AGIVertices[_0x21db('0x14')]['end']=function(_0x49e73e){logger[_0x21db('0x2d')](util['format'](_0x21db('0x108'),_0x49e73e[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x109'));};AGIVertices[_0x21db('0x14')][_0x21db('0x10a')]=function(_0x236799){logger['info'](util['format'](_0x21db('0x10b'),_0x236799[_0x21db('0xb2')]));var _0xa402f1='';if(_0x236799['trunk_id']){if(!this[_0x21db('0x8e')](_0x236799[_0x21db('0x10c')])){return this['channel'][_0x21db('0x2c')](_0x236799,_0x21db('0x10d'));}else{var _0x251686=parseInt(_0x236799[_0x21db('0x10c')],0xa);if(isNaN(_0x251686)){_0xa402f1=_0x236799[_0x21db('0x10c')];}else{_0xa402f1=this['getTrunk'][_0x21db('0x7a')](this,_0x236799[_0x21db('0x10c')]);if(!_0xa402f1){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x236799,_0x21db('0x10e'));}}}}else if(_0x236799[_0x21db('0x10f')]){_0xa402f1=_0x236799[_0x21db('0x10f')];}else{return this[_0x21db('0x11')]['error'](_0x236799,_0x21db('0x10d'));}var _0x5069b3=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xee'),[util['format'](_0x21db('0x110'),_0xa402f1,_0x236799['phone']),_0x236799[_0x21db('0x72')],_0x236799[_0x21db('0x111')],_0x236799['url']]);if(_0x5069b3[_0x21db('0xab')]===-0x1){return _0x5069b3;}return this['channel'][_0x21db('0xb3')](util['format'](_0x21db('0xf0'),_0x21db('0xee')));};AGIVertices[_0x21db('0x14')][_0x21db('0x112')]=function(_0x592ca7){logger[_0x21db('0x2d')](util['format'](_0x21db('0x113'),_0x592ca7[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0xb3')]('finally');};AGIVertices[_0x21db('0x14')][_0x21db('0xf')]=function(_0x260265){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x260265[_0x21db('0xb2')]));if(_0x260265[_0x21db('0xaf')]===0x0){return this[_0x21db('0xae')](_0x260265);}_0x260265['retry']-=0x1;if(!this['isConfigured'](_0x260265[_0x21db('0x114')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x260265,_0x21db('0x115'));}var _0x2e9a82=this['getSound'][_0x21db('0x7a')](this,_0x260265['file_id']);if(!_0x2e9a82){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x260265,_0x21db('0x116'));}if(!this[_0x21db('0x8e')](_0x260265[_0x21db('0xe3')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x21db('0xe4'));}var _0x52712f=this[_0x21db('0x11')][_0x21db('0x117')](_0x2e9a82,_0x260265[_0x21db('0x118')],_0x260265[_0x21db('0x119')]);var _0x117d97=_0x52712f[_0x21db('0xab')]?_0x52712f['result'][_0x21db('0xa8')]():'';logger[_0x21db('0x2d')]('test',JSON[_0x21db('0x7e')](_0x52712f));if(_0x52712f[_0x21db('0xab')]===-0x1){this[_0x21db('0x33')]['sync'](this,_0x260265,_0x117d97);return _0x52712f;}else if(_0x52712f[_0x21db('0xad')]===_0x21db('0x72')){_0x52712f['result']=_0x117d97['length']>=parseInt(_0x260265[_0x21db('0x11a')])?'x':'i';}else{_0x52712f[_0x21db('0xab')]=_0x117d97['length']>=parseInt(_0x260265[_0x21db('0x11a')])&&_0x117d97[_0x21db('0xa2')]<=parseInt(_0x260265[_0x21db('0x119')])?'x':'i';}var _0x1cf053=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x260265[_0x21db('0xe3')]);if(!_0x1cf053){return this[_0x21db('0x11')]['error'](_0x260265,'no\x20variable\x20found');}this['channel'][_0x21db('0xe8')](_0x1cf053,_0x117d97);if(this[_0x21db('0x8e')](_0x260265[_0x21db('0x11b')])){var _0x172d5b=parseInt(_0x260265[_0x21db('0x11b')],0xa);var _0x44bd43=rs[_0x21db('0x11c')]({'charset':'*','length':_0x172d5b});var _0x4bbb4c=_0x117d97[_0x21db('0xa2')];if(_0x4bbb4c>0x0){if(_0x4bbb4c>_0x172d5b){this['createSquareDetailsReport'][_0x21db('0x7a')](this,_0x260265,_0x260265[_0x21db('0x11d')]===_0x21db('0x11e')?_0x44bd43+_0x117d97['substr'](_0x172d5b):_0x117d97[_0x21db('0x11f')](0x0,_0x4bbb4c-_0x172d5b)+_0x44bd43);}else{this['createSquareDetailsReport']['sync'](this,_0x260265,rs[_0x21db('0x11c')]({'charset':'*','length':_0x4bbb4c}));}}else{this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x260265,'');}}else{this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x260265,_0x117d97);}return _0x52712f;};AGIVertices['prototype'][_0x21db('0x10')]=function(_0x5924ee){logger[_0x21db('0x2d')](util['format'](_0x21db('0x120'),_0x5924ee[_0x21db('0xb2')]));return this[_0x21db('0xf')](_0x5924ee);};AGIVertices[_0x21db('0x14')][_0x21db('0x121')]=function(_0x40720c){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x122'),_0x40720c[_0x21db('0xb2')]));this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x40720c,_0x40720c['goalname']);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('GOAL\x20%s',_0x40720c[_0x21db('0x123')]));};AGIVertices[_0x21db('0x14')][_0x21db('0x124')]=function(_0x22203e){logger['info'](util[_0x21db('0x5f')](_0x21db('0x125'),_0x22203e[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x22203e[_0x21db('0x126')])||!this[_0x21db('0x8e')](_0x22203e['aws_secret_access_key'])){return this['channel'][_0x21db('0xb3')](_0x21db('0x127'));}if(!this[_0x21db('0x8e')](_0x22203e['text'])){return this['channel']['noop'](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x128'),_0x22203e[_0x21db('0x69')]));var _0x52fa65=this['awsPolly']['sync'](this,_0x22203e);if(_0x52fa65){this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')](_0x21db('0x129'),_0x52fa65));var _0x55814c=this[_0x21db('0x11')]['streamFile'](_0x52fa65);try{fs['unlink'](_0x52fa65+_0x21db('0x12a'));}catch(_0x10c637){logger[_0x21db('0x2c')](_0x10c637);}return _0x55814c;}return this['channel'][_0x21db('0x2c')](_0x22203e,_0x21db('0x12b'));};AGIVertices[_0x21db('0x14')][_0x21db('0x12c')]=function(_0x1bd7ac){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1bd7ac['label']));if(!this[_0x21db('0x8e')](_0x1bd7ac[_0x21db('0x126')])||!this[_0x21db('0x8e')](_0x1bd7ac['aws_secret_access_key'])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x127'));}if(!this[_0x21db('0x8e')](_0x1bd7ac['aws_bot_name'])){return this[_0x21db('0x11')]['noop'](_0x21db('0x12d'));}if(!this[_0x21db('0x8e')](_0x1bd7ac['text'])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xb4'));}this['channel'][_0x21db('0xf3')]=!![];this[_0x21db('0x33')](_0x1bd7ac);this[_0x21db('0x3c')](_0x1bd7ac[_0x21db('0x69')],'in');this['channel']['noop'](util[_0x21db('0x5f')](_0x21db('0x12e'),_0x1bd7ac[_0x21db('0x69')]));var _0x40caf6=this[_0x21db('0x93')][_0x21db('0x7a')](this,_0x1bd7ac);if(_0x40caf6){for(var _0x51e43e in _0x40caf6){if(_0x40caf6[_0x21db('0x9d')](_0x51e43e)&&_[_0x21db('0x9e')](_0x40caf6[_0x51e43e])){this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')]('AWS_LEX_%s',_0x51e43e[_0x21db('0x75')]()),_0x40caf6[_0x51e43e]);}}if(_[_0x21db('0x42')](_0x40caf6[_0x21db('0x82')])){return this[_0x21db('0x11')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x21db('0x3c')](_0x40caf6['message'],_0x21db('0xf7'));return this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x12f'),_0x40caf6['message']));}}return this[_0x21db('0x11')]['error'](_0x1bd7ac,_0x21db('0x130'));};AGIVertices[_0x21db('0x14')][_0x21db('0x131')]=function(_0x33ed3f){logger[_0x21db('0x2d')](util['format'](_0x21db('0x132'),_0x33ed3f['label'],_0x33ed3f[_0x21db('0x72')]));if(!this['isConfigured'](_0x33ed3f[_0x21db('0x86')])){return this['channel'][_0x21db('0xb3')]('no\x20key\x20configured');}var _0x3cffd1=_0x21db('0x133');var _0x3d654a=util[_0x21db('0x5f')](_0x21db('0x134'),FILES_PATH,rs[_0x21db('0x11c')](0x4));var _0x292b0e=util[_0x21db('0x5f')](_0x21db('0xa5'),_0x3d654a,_0x3cffd1);var _0x196251=!![];if(_0x33ed3f[_0x21db('0x135')]==='NOBEEP'){_0x196251=![];}var _0x285958=this[_0x21db('0x11')][_0x21db('0x136')](_0x3d654a,_0x3cffd1,_0x33ed3f['intKey'],_0x33ed3f[_0x21db('0x72')],undefined,_0x196251);if(_0x285958['result']!==-0x1){this[_0x21db('0x11')][_0x21db('0xb3')](util['format']('google\x20%s\x20file\x20created',_0x292b0e));var _0x4a9bda=this['googleASR'][_0x21db('0x7a')](this,_0x33ed3f,_0x292b0e);if(_0x4a9bda){for(var _0x293460 in _0x4a9bda){if(_0x4a9bda[_0x21db('0x9d')](_0x293460)){this[_0x21db('0x11')][_0x21db('0xe8')](util['format'](_0x21db('0x137'),_0x293460[_0x21db('0x75')]()),_0x4a9bda[_0x293460]);}}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x4a9bda)));}}return _0x285958;};AGIVertices[_0x21db('0x14')]['tildeasr']=function(_0xca9130){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x138'),_0xca9130[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xca9130[_0x21db('0x98')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x139'));}if(!this[_0x21db('0x8e')](_0xca9130['appsecret'])){return this[_0x21db('0x11')]['noop'](_0x21db('0x13a'));}var _0x23b392=_0x21db('0x133');var _0x4d83e8=util[_0x21db('0x5f')](_0x21db('0x134'),FILES_PATH,rs['generate'](0x4));var _0x5e0a1e=util['format'](_0x21db('0xa5'),_0x4d83e8,_0x23b392);var _0x2cea47=!![];if(_0xca9130[_0x21db('0x135')]===_0x21db('0x13b')){_0x2cea47=![];}var _0x3d64cd=this[_0x21db('0x11')][_0x21db('0x136')](_0x4d83e8,_0x23b392,_0xca9130[_0x21db('0x13c')],_0xca9130['timeout'],undefined,_0x2cea47);if(_0x3d64cd['result']!==-0x1){this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x13d'),_0x5e0a1e));var _0x80dc9=this[_0x21db('0x97')][_0x21db('0x7a')](this,_0xca9130,_0x5e0a1e);if(_0x80dc9){for(var _0x28335d in _0x80dc9){if(_0x80dc9[_0x21db('0x9d')](_0x28335d)){this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0x13e'),_0x28335d['toUpperCase']()),_0x80dc9[_0x28335d]);}}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x13f'),JSON['stringify'](_0x80dc9)));}}return _0x3d64cd;};AGIVertices['prototype'][_0x21db('0x140')]=function(_0x33ceb7){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x141'),_0x33ceb7[_0x21db('0xb2')]));return this['channel'][_0x21db('0x142')](_0x33ceb7['context'],_0x33ceb7[_0x21db('0x143')],_0x33ceb7[_0x21db('0x39')]);};AGIVertices[_0x21db('0x14')]['gotoif']=function(_0xf3055a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xf3055a[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xf3055a['condition'])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xf3055a,'no\x20condition\x20configured');}try{var _0x18ebb5=eval(_0xf3055a['condition'])?_0x21db('0x144'):_0x21db('0x145');this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x146'),_0xf3055a[_0x21db('0x147')],_0x18ebb5));return{'code':0xc8,'result':_0x18ebb5};}catch(_0xc0cecc){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x40160b){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x40160b[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x40160b[_0x21db('0x148')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x40160b,'no\x20interval\x20configured');}var _0x2daa2a=this[_0x21db('0x26')][_0x21db('0x7a')](this,_0x40160b[_0x21db('0x148')]);if(!_0x2daa2a){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x40160b,_0x21db('0x149'));}for(var _0x5c6c08=0x0;_0x5c6c08<_0x2daa2a[_0x21db('0xa2')];_0x5c6c08+=0x1){var _0x3b6c3b=this[_0x21db('0x11')]['getVariable'](util['format'](_0x21db('0x14a'),_0x2daa2a[_0x5c6c08]));if(_0x3b6c3b['result']===-0x1){return _0x3b6c3b;}logger[_0x21db('0x2d')](util['format'](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],_0x3b6c3b[_0x21db('0xad')]));if(_0x3b6c3b[_0x21db('0xad')]==='true'){logger['info'](util[_0x21db('0x5f')](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],_0x21db('0x144')));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],_0x21db('0x144')));return{'code':0xc8,'result':_0x21db('0x144')};}else{logger[_0x21db('0x2d')](util['format'](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],'false'));this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],'false'));}}return{'code':0xc8,'result':_0x21db('0x145')};};AGIVertices[_0x21db('0x14')][_0x21db('0x14c')]=function(_0x2b262a){logger[_0x21db('0x2d')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2b262a[_0x21db('0xb2')]));return this['channel']['hangup']();};AGIVertices[_0x21db('0x14')][_0x21db('0x14d')]=function(_0x2ea5c8){logger['info'](util[_0x21db('0x5f')](_0x21db('0x14e'),_0x2ea5c8[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x2ea5c8[_0x21db('0x86')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x14f'));}var _0x5f194a=_0x21db('0x133');var _0x2ada45=util[_0x21db('0x5f')]('%s/recordings/%s',FILES_PATH,rs[_0x21db('0x11c')](0x4));var _0x2dc7ed=util[_0x21db('0x5f')](_0x21db('0xa5'),_0x2ada45,_0x5f194a);var _0x53834b=!![];if(_0x2ea5c8[_0x21db('0x135')]===_0x21db('0x13b')){_0x53834b=![];}var _0x2a6089=this[_0x21db('0x11')][_0x21db('0x136')](_0x2ada45,_0x5f194a,_0x2ea5c8[_0x21db('0x13c')],_0x2ea5c8[_0x21db('0x72')],undefined,_0x53834b);if(_0x2a6089[_0x21db('0xab')]!==-0x1){this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x150'),_0x2dc7ed));var _0x31fe76=this[_0x21db('0x8d')][_0x21db('0x7a')](this,_0x2ea5c8,_0x2dc7ed);if(_0x31fe76){for(var _0x29aec3 in _0x31fe76){if(_0x31fe76[_0x21db('0x9d')](_0x29aec3)){this[_0x21db('0x11')]['setVariable'](util[_0x21db('0x5f')]('ISPEECH_ASR_%s',_0x29aec3['toUpperCase']()),_0x31fe76[_0x29aec3]);}}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('IspeechASR\x20Result\x20%s',JSON[_0x21db('0x7e')](_0x31fe76)));}}return _0x2a6089;};AGIVertices[_0x21db('0x14')][_0x21db('0x151')]=function(_0x1826c5){logger['info'](util[_0x21db('0x5f')](_0x21db('0x152'),_0x1826c5[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x1826c5['key'])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x14f'));}if(!this['isConfigured'](_0x1826c5['text'])){return this['channel'][_0x21db('0xb3')](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x153'),_0x1826c5[_0x21db('0x69')]));var _0x38b84b=this['ispeechTTS'][_0x21db('0x7a')](this,_0x1826c5);if(_0x38b84b){this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x150'),_0x38b84b));var _0x935ee6=this[_0x21db('0x11')]['streamFile'](_0x38b84b,_0x1826c5['intKey']);try{fs['unlink'](_0x38b84b+_0x21db('0x12a'));}catch(_0x48d3e1){logger[_0x21db('0x2c')](_0x48d3e1);}return _0x935ee6;}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1826c5,_0x21db('0x154'));};AGIVertices[_0x21db('0x14')][_0x21db('0x155')]=function(_0xa0baef){logger['info'](util[_0x21db('0x5f')](_0x21db('0x156'),_0xa0baef[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xa0baef[_0x21db('0x157')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xa0baef,_0x21db('0x158'));}logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x159'),this[_0x21db('0x11')][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));var _0x2a7cd5=this[_0x21db('0x61')][_0x21db('0x7a')](this,_0xa0baef['findBy']);if(_0x2a7cd5){logger[_0x21db('0x2d')](util['format'](_0x21db('0x15a'),this['channel'][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x21db('0x11')][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0x21db('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')]['callerid'],_0xa0baef[_0x21db('0x157')]));return{'code':0xc8,'result':_0x21db('0x15c')};}};AGIVertices[_0x21db('0x14')]['logout']=function(_0x3bd897){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15d'),_0x3bd897[_0x21db('0xb2')]));if(!this['isConfigured'](_0x3bd897['findBy'])){return this['channel']['error'](_0x3bd897,_0x21db('0x158'));}logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x159'),this[_0x21db('0x11')]['callerid'],_0x3bd897[_0x21db('0x157')]));var _0x3f226b=this[_0x21db('0x5e')][_0x21db('0x7a')](this,_0x3bd897['findBy']);if(_0x3f226b){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')][_0x21db('0x36')],_0x3bd897[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x21db('0x11')][_0x21db('0x36')],_0x3bd897['findBy']));return{'code':0xc8,'result':_0x21db('0x15e')};}else{logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')][_0x21db('0x36')],_0x3bd897[_0x21db('0x157')]));this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x21db('0x11')]['callerid'],_0x3bd897[_0x21db('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x21db('0x14')][_0x21db('0x15f')]=function(_0x130c3){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x160'),_0x130c3[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x130c3[_0x21db('0x161')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x130c3,_0x21db('0x162'));}this['channel']['noop'](util['format'](_0x21db('0x163'),_0x130c3[_0x21db('0x161')]));var _0x4e86c4=eval(_0x130c3[_0x21db('0x161')]);if(!this[_0x21db('0x8e')](_0x130c3['variable_id'])){return this['channel'][_0x21db('0xb3')](_0x21db('0xe4'));}var _0x4fa01f=this['getVariable'][_0x21db('0x7a')](this,_0x130c3[_0x21db('0xe3')]);if(!_0x4fa01f){return this[_0x21db('0x11')]['error'](_0x130c3,_0x21db('0xe5'));}if(_[_0x21db('0x164')](_0x4e86c4)){var _0x4c6342=this;_0x4e86c4['forEach'](function(_0x4caf8e,_0x2c580c){_0x4c6342[_0x21db('0x11')][_0x21db('0xe8')](util['format'](_0x21db('0x165'),_0x4fa01f,_0x2c580c),_0x4caf8e);});return this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')]('variable\x20%s[key]\x20set',_0x4fa01f));}else{return this[_0x21db('0x11')][_0x21db('0xe8')](_0x4fa01f,_0x4e86c4);}};AGIVertices[_0x21db('0x14')][_0x21db('0x166')]=function(_0x308059){logger['info'](util[_0x21db('0x5f')](_0x21db('0x167'),_0x308059['label']));if(_0x308059[_0x21db('0xaf')]===0x0){return this[_0x21db('0xae')](_0x308059);}_0x308059[_0x21db('0xaf')]-=0x1;if(!this[_0x21db('0x8e')](_0x308059[_0x21db('0x114')])){return this['channel'][_0x21db('0x2c')](_0x308059,_0x21db('0x115'));}var _0x5cc99e=this[_0x21db('0x20')][_0x21db('0x7a')](this,_0x308059[_0x21db('0x114')]);if(!_0x5cc99e){return this[_0x21db('0x11')]['error'](_0x308059,_0x21db('0x116'));}var _0x2f5ae2=this[_0x21db('0x11')][_0x21db('0x117')](_0x5cc99e,_0x308059[_0x21db('0x118')],_0x308059[_0x21db('0x168')]);var _0x1e80a7=_0x2f5ae2[_0x21db('0xab')];if(_0x2f5ae2[_0x21db('0xab')]===-0x1){this[_0x21db('0x33')]['sync'](this,_0x308059,'-1');return _0x2f5ae2;}else if(_0x2f5ae2[_0x21db('0xad')]==='timeout'){_0x2f5ae2['result']=_0x2f5ae2['result']['length']>0x0?_0x2f5ae2[_0x21db('0xab')]:'t';}else if(_['isEmpty'](_0x2f5ae2[_0x21db('0xab')])){_0x2f5ae2[_0x21db('0xab')]='#';_0x1e80a7='#';}if(!this[_0x21db('0x8e')](_0x308059['variable_id'])){this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xe4'));}else{var _0x3f9460=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x308059[_0x21db('0xe3')]);if(!_0x3f9460){return this['channel'][_0x21db('0x2c')](_0x308059,_0x21db('0xe5'));}this[_0x21db('0x11')]['setVariable'](_0x3f9460,_0x1e80a7);}this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x308059,_0x1e80a7);return _0x2f5ae2;};AGIVertices[_0x21db('0x14')][_0x21db('0xb3')]=function(_0xc6af2a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xc6af2a[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0xb3')](_0xc6af2a[_0x21db('0x169')]||_0xc6af2a[_0x21db('0xb2')]);};AGIVertices[_0x21db('0x14')][_0x21db('0x16a')]=function(_0x3df800){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x16b'),_0x3df800[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x3df800['findBy'])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3df800,_0x21db('0x158'));}logger[_0x21db('0x2d')](util['format'](_0x21db('0x159'),this['channel']['callerid'],_0x3df800[_0x21db('0x157')]));var _0x20547f=this[_0x21db('0x59')][_0x21db('0x7a')](this,_0x3df800[_0x21db('0x16c')]);var _0x5e84e0=this[_0x21db('0x5c')][_0x21db('0x7a')](this,_0x3df800[_0x21db('0x157')],_0x20547f);if(_0x5e84e0){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')]['callerid'],_0x3df800['findBy']));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15a'),this['channel']['callerid'],_0x3df800['findBy']));return{'code':0xc8,'result':_0x21db('0x15e')};}else{logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x21db('0x11')][_0x21db('0x36')],_0x3df800[_0x21db('0x157')]));this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')]['callerid'],_0x3df800[_0x21db('0x157')]));return{'code':0xc8,'result':_0x21db('0x15c')};}};AGIVertices['prototype'][_0x21db('0x16d')]=function(_0xaa99c){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x16e'),_0xaa99c[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xaa99c[_0x21db('0x114')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xaa99c,_0x21db('0x115'));}var _0x396b81=this[_0x21db('0x20')][_0x21db('0x7a')](this,_0xaa99c[_0x21db('0x114')]);if(!_0x396b81){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xaa99c,'no\x20file\x20audio\x20found');}var _0x30bb26=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0x16f'),[_0x396b81,_0xaa99c[_0x21db('0x111')]]);if(_0x30bb26[_0x21db('0xab')]===-0x1){return _0x30bb26;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xce'),_0x21db('0x16f'),_0x396b81));};AGIVertices[_0x21db('0x14')][_0x21db('0x170')]=function(_0x2d3906){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x171'),_0x2d3906['label']));if(!this[_0x21db('0x8e')](_0x2d3906[_0x21db('0x172')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x2d3906,_0x21db('0x173'));}var _0x492238='';var _0x8b0e78=parseInt(_0x2d3906[_0x21db('0x172')],0xa);if(isNaN(_0x8b0e78)){_0x492238=_0x2d3906[_0x21db('0x172')];}else{_0x492238=this[_0x21db('0x18')][_0x21db('0x7a')](this,_0x2d3906[_0x21db('0x172')]);if(!_0x492238){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x2d3906,'no\x20queue\x20found');}}var _0x39a259='';if(this['isConfigured'](_0x2d3906[_0x21db('0x114')])){var _0x2ad090=this[_0x21db('0x20')][_0x21db('0x7a')](this,_0x2d3906['file_id']);if(_0x2ad090){_0x39a259=_0x2ad090;}}this[_0x21db('0x33')]['sync'](this,_0x2d3906,_0x492238);if(_0x2d3906[_0x21db('0x111')][_0x21db('0x174')]('x')<0x0){_0x2d3906['opts']+='x';}if(_0x2d3906[_0x21db('0x111')]['indexOf']('X')<0x0){_0x2d3906[_0x21db('0x111')]+='X';}this[_0x21db('0x11')][_0x21db('0xe8')]('XMCS-QUEUE',_0x492238?_0x492238[_0x21db('0x175')]():'');var _0x35c75b=this[_0x21db('0x11')][_0x21db('0x63')]('QUEUE',[_0x492238,_0x2d3906['opts'],_0x2d3906[_0x21db('0x7d')],_0x39a259,_0x2d3906[_0x21db('0x72')],_0x2d3906['agi'],_0x2d3906[_0x21db('0x176')],_0x2d3906['gosub'],'',_0x2d3906[_0x21db('0x177')]]);if(_0x35c75b[_0x21db('0xab')]===-0x1){return _0x35c75b;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xce'),_0x21db('0x178'),_0x492238));};AGIVertices['prototype'][_0x21db('0x179')]=function(_0x20f572){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x17a'),_0x20f572[_0x21db('0xb2')]));var _0x4d242a=_0x20f572[_0x21db('0x17b')]||'wav';var _0x37002d=util[_0x21db('0x5f')](_0x21db('0x17c'),this['channel'][_0x21db('0x34')],rs[_0x21db('0x11c')](0x5));var _0x4026d2=util[_0x21db('0x5f')](_0x21db('0x17d'),FILES_PATH,_0x37002d,_0x4d242a);var _0x2579e9=util[_0x21db('0x5f')](_0x21db('0x134'),FILES_PATH,_0x37002d);this[_0x21db('0x37')][_0x21db('0x7a')](this,_0x20f572,_0x37002d,_0x4026d2);this[_0x21db('0x11')][_0x21db('0xe8')]('RECORDING_SAVENAME',_0x37002d);logger['info'](_0x21db('0x17e'),_0x2579e9,_0x4d242a,_0x20f572['escape_digits'],_0x20f572[_0x21db('0x72')]);return this[_0x21db('0x11')][_0x21db('0x136')](_0x2579e9,_0x4d242a,_0x20f572[_0x21db('0x17f')],_0x20f572[_0x21db('0x72')],undefined,!![]);};AGIVertices[_0x21db('0x14')][_0x21db('0x180')]=function(_0x3c7368){logger['info'](util['format'](_0x21db('0x181'),_0x3c7368[_0x21db('0xb2')]));if(!this['isConfigured'](_0x3c7368[_0x21db('0x7d')])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20url\x20configured');}var _0x17b9ca=this[_0x21db('0x182')][_0x21db('0x7a')](this,_0x3c7368);logger['info'](util[_0x21db('0x5f')](_0x21db('0x183'),util[_0x21db('0x184')](_0x17b9ca,{'showHidden':![],'depth':null})));if(!this[_0x21db('0x8e')](_0x3c7368[_0x21db('0xe3')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x185'));}var _0x92c51f=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x3c7368[_0x21db('0xe3')]);if(!_0x92c51f){return this['channel'][_0x21db('0x2c')](_0x3c7368,'no\x20variable\x20found');}this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0x186'),_0x92c51f),_0x17b9ca[_0x21db('0x81')]?_0x17b9ca[_0x21db('0x81')]:_0x21db('0x187'));this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0x188'),_0x92c51f),_0x17b9ca[_0x21db('0x189')]?_0x17b9ca['statusMessage']:'OK');if(_0x17b9ca[_0x21db('0x7f')]){try{this[_0x21db('0xa4')](_0x17b9ca[_0x21db('0x7f')],_0x92c51f);}catch(_0x4a353c){logger[_0x21db('0x2c')](util[_0x21db('0x5f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x92c51f));}}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x18a'),_0x92c51f));};AGIVertices['prototype'][_0x21db('0x18b')]=function(_0x5512c9){logger[_0x21db('0x2d')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5512c9[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0x18c')](_0x5512c9[_0x21db('0x18d')][_0x21db('0x65')](/\s+/g,''),_0x5512c9['escape_digits']);};AGIVertices[_0x21db('0x14')][_0x21db('0x18e')]=function(_0xa7631a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x18f'),_0xa7631a[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0x190')](_0xa7631a[_0x21db('0x191')][_0x21db('0x65')](/\s+/g,''),_0xa7631a[_0x21db('0x17f')]);};AGIVertices[_0x21db('0x14')][_0x21db('0x192')]=function(_0x3dc874){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x193'),_0x3dc874['label']));return this[_0x21db('0x11')][_0x21db('0x194')](_0x3dc874[_0x21db('0x69')],_0x3dc874[_0x21db('0x17f')]);};AGIVertices[_0x21db('0x14')][_0x21db('0x195')]=function(_0x44c532){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x196'),_0x44c532[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x44c532[_0x21db('0x197')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x198'));}var _0x2085fd=this['getMailAccount'][_0x21db('0x7a')](this,_0x44c532[_0x21db('0x197')]);if(!_0x2085fd||!_0x2085fd[_0x21db('0x199')]){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x44c532,_0x21db('0x19a'));}var _0x12ca4a={'from':util[_0x21db('0x5f')](_0x21db('0x19b'),_0x2085fd['name'],_0x2085fd['email']||_0x2085fd[_0x21db('0x199')][_0x21db('0x19c')]),'to':_0x44c532['to']||'','cc':_0x44c532['cc']||'','bcc':_0x44c532[_0x21db('0x19d')]||'','subject':_0x44c532[_0x21db('0x19e')],'html':_0x44c532[_0x21db('0x69')],'text':_0x44c532['text']};var _0x4d2fec={'tls':{'rejectUnauthorized':![]}};if(_0x2085fd['Smtp'][_0x21db('0x19f')]){_0x4d2fec[_0x21db('0x19f')]=_0x2085fd[_0x21db('0x199')][_0x21db('0x19f')];}else{_0x4d2fec[_0x21db('0x1a0')]=_0x2085fd[_0x21db('0x199')][_0x21db('0x1a0')];_0x4d2fec[_0x21db('0x1a1')]=_0x2085fd[_0x21db('0x199')]['port'];_0x4d2fec['secure']=_0x2085fd[_0x21db('0x199')][_0x21db('0x1a2')];}if(_0x2085fd['Smtp'][_0x21db('0x1a3')]){_0x4d2fec[_0x21db('0x1a4')]={'user':_0x2085fd['Smtp'][_0x21db('0x19c')],'pass':_0x2085fd[_0x21db('0x199')][_0x21db('0x1a5')]};}if(this[_0x21db('0x8e')](_0x44c532[_0x21db('0x1a6')])){}logger[_0x21db('0xea')](_0x21db('0x1a7'),JSON[_0x21db('0x7e')](_0x12ca4a));this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x44c532,_0x44c532['account_id']);this[_0x21db('0x11')][_0x21db('0xb3')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x2085fd['name']));this[_0x21db('0x25')]['sync'](this,_0x4d2fec,_0x12ca4a);return this[_0x21db('0x11')]['noop'](_0x21db('0x1a8'));};AGIVertices['prototype'][_0x21db('0x1a9')]=function(_0x5d6b66){logger['info'](util['format'](_0x21db('0x1aa'),_0x5d6b66[_0x21db('0xb2')]));return this[_0x21db('0x11')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x21db('0x14')]['sendSMS']=function(_0x2c131b){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2c131b[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x2c131b['sms_account_id'])){return this[_0x21db('0x11')]['noop']('no\x20sms\x20account\x20configured');}var _0xbb02ec=this[_0x21db('0x1ab')][_0x21db('0x7a')](this,_0x2c131b[_0x21db('0x1ac')]);if(!_0xbb02ec){return this['channel']['error'](_0x2c131b,_0x21db('0x1ad'));}var _0x2771ae={'body':_0x2c131b['sms_text'],'phone':_0x2c131b['to']||'','SmsAccountId':_0xbb02ec['id']};logger[_0x21db('0xea')]('sendSMS\x20message',JSON[_0x21db('0x7e')](_0x2771ae));this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x2c131b,_0x2c131b[_0x21db('0x1ac')]);this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1ae'),_0xbb02ec['name']));this[_0x21db('0x32')][_0x21db('0x7a')](this,_0x2771ae);return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x1af'));};AGIVertices['prototype'][_0x21db('0x1b0')]=function(_0x4781ea){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4781ea[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x4781ea['variable_id'])){return this[_0x21db('0x11')]['error'](_0x4781ea,_0x21db('0x1b1'));}var _0x40e958=this['getVariable'][_0x21db('0x7a')](this,_0x4781ea[_0x21db('0xe3')]);if(!_0x40e958){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x4781ea,_0x21db('0xe5'));}return this['channel']['setVariable'](_0x40e958,_0x4781ea['variable_value']);};AGIVertices[_0x21db('0x14')][_0x21db('0x1b2')]=function(_0xf2111c){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1b3'),_0xf2111c[_0x21db('0xb2')]));this['channel']['noop'](_0x21db('0x1b4'));if(_0xf2111c[_0x21db('0xc3')]==='yes'){this[_0x21db('0x11')][_0x21db('0xb3')]('Answer');return this[_0x21db('0x11')][_0x21db('0xc3')]();}return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x1b5'));};AGIVertices[_0x21db('0x14')][_0x21db('0x1b6')]=function(_0x1e8b37){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1b7'),_0x1e8b37[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x1e8b37['project_id'])){return this['channel']['error'](_0x1e8b37,_0x21db('0x1b8'));}var _0xedec31=this['getSquareProject'][_0x21db('0x7a')](this,_0x1e8b37[_0x21db('0x1b9')]);if(!this[_0x21db('0x8e')](_0xedec31)){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1e8b37,util[_0x21db('0x5f')](_0x21db('0x1ba'),_0x1e8b37['project_id']));}if(_0xedec31===this['channel'][_0x21db('0x35')]){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1e8b37,_0x21db('0x1bb'));}this['createSquareDetailsReport']['sync'](this,_0x1e8b37,_0xedec31);var _0x58a747=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0x1bc'),util['format'](_0x21db('0x1bd'),config[_0x21db('0x8')]['host']||'127.0.0.1',_0xedec31,this[_0x21db('0x11')][_0x21db('0x35')]));if(_0x58a747[_0x21db('0xab')]===-0x1){return _0x58a747;}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0xce'),'AGI',_0xedec31));};AGIVertices['prototype'][_0x21db('0x1be')]=function(_0x83f5bb){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1bf'),_0x83f5bb['label']));var _0x47eec8=this[_0x21db('0x62')]['sync'](this,_0x83f5bb[_0x21db('0xc1')]);this['createSquareDetailsReport'][_0x21db('0x7a')](this,_0x83f5bb,_0x83f5bb[_0x21db('0xc1')]);if(this['isConfigured'](_0x83f5bb[_0x21db('0xe3')])){var _0x59a141=this['getVariable']['sync'](this,_0x83f5bb[_0x21db('0xe3')]);if(_0x59a141){this['channel']['setVariable'](_0x59a141,_0x47eec8);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1c0'),_0x83f5bb[_0x21db('0xc1')],_0x59a141));}}return this['channel']['noop'](util['format'](_0x21db('0x1c1'),_0x83f5bb['command']));};AGIVertices[_0x21db('0x14')][_0x21db('0x1c2')]=function(_0x27cda2){logger[_0x21db('0x2d')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x27cda2[_0x21db('0xb2')]));_0x27cda2[_0x21db('0x69')]=_0x27cda2[_0x21db('0x69')][_0x21db('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x27cda2[_0x21db('0x67')])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20apiKey\x20configured');}if(!this[_0x21db('0x8e')](_0x27cda2[_0x21db('0x69')])){return this['channel']['noop'](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x1c3'),_0x27cda2[_0x21db('0x69')]));var _0x53a615=this['googleCloudTTS'][_0x21db('0x7a')](this,_0x27cda2);if(_0x53a615){this['channel']['noop'](util[_0x21db('0x5f')](_0x21db('0x1c4'),_0x53a615));var _0x3d04ef=this['channel'][_0x21db('0x104')](_0x53a615);try{fs[_0x21db('0x105')](_0x53a615+_0x21db('0x12a'));}catch(_0x213c73){logger[_0x21db('0x2c')](_0x213c73);}return _0x3d04ef;}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x27cda2,_0x21db('0x1c5'));};AGIVertices[_0x21db('0x14')][_0x21db('0x1c6')]=function(_0x2d2b07){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2d2b07[_0x21db('0xb2')]));_0x2d2b07[_0x21db('0x69')]=_0x2d2b07['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x21db('0x8e')](_0x2d2b07[_0x21db('0x69')])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1c7'),_0x2d2b07[_0x21db('0x69')]));var _0x475011=this[_0x21db('0x6f')][_0x21db('0x7a')](this,_0x2d2b07);if(_0x475011){this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1c8'),_0x475011));var _0x4037d5=this['channel'][_0x21db('0x104')](_0x475011);try{fs['unlink'](_0x475011+_0x21db('0x12a'));}catch(_0x1a5f12){logger[_0x21db('0x2c')](_0x1a5f12);}return _0x4037d5;}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x2d2b07,_0x21db('0x1c9'));};AGIVertices[_0x21db('0x14')][_0x21db('0x1ca')]=function(_0x11f431){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1cb'),_0x11f431[_0x21db('0xb2')]));if(!this['isConfigured'](_0x11f431[_0x21db('0x157')])){return this['channel'][_0x21db('0x2c')](_0x11f431,'no\x20find\x20by\x20configured');}logger['info'](util[_0x21db('0x5f')](_0x21db('0x159'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));var _0x135efe=this[_0x21db('0x5d')]['sync'](this,_0x11f431[_0x21db('0x157')]);if(_0x135efe){logger['info'](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));return{'code':0xc8,'result':_0x21db('0x15e')};}else{logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')]['callerid'],_0x11f431['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x21db('0x14')][_0x21db('0x1cc')]=function(_0xe6d511){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1cd'),_0xe6d511[_0x21db('0xb2')]));var _0x3574e7=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0x1ce'),[_0xe6d511[_0x21db('0x1cf')],_0xe6d511[_0x21db('0x84')]]);if(_0x3574e7[_0x21db('0xab')]===-0x1){return _0x3574e7;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xce'),'VOICEMAIL',_0xe6d511['mailbox']));};AGIVertices[_0x21db('0x14')]['vswitch']=function(_0x3cd169){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3cd169[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x3cd169[_0x21db('0xe3')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3cd169,_0x21db('0x1b1'));}var _0x70149d=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x3cd169[_0x21db('0xe3')]);if(!_0x70149d){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3cd169,_0x21db('0xe5'));}var _0x41aa04=this[_0x21db('0x11')]['getVariable'](_0x70149d);return{'code':0xc8,'result':_0x41aa04['extra']?_0x41aa04[_0x21db('0xad')]:'-'};};String['prototype']['replaceAll']=function(_0x4cc11d,_0x49b658){return this[_0x21db('0xa6')](_0x4cc11d)[_0x21db('0x1d0')](_0x49b658);};module[_0x21db('0x1d1')]=AGIVertices; \ No newline at end of file +var _0x3bbd=['Google\x20TTS\x20is\x20unreachable','unpause','mailbox','Executed\x20command\x20%s\x20%s','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','path','util','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProjectById','name','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','dnid','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','RES1','dialtimezone','timezones','utcOffset','minutestoadd','scheduledat','add','minutes','scheduledat\x20after','insertContact','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','method','timeout','includes','POST','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','setVariable','replaceall\x20init','split','getAndSetVariable','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','continueAt','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','gotoiftime','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','QUEUE','macro','gosub','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','Smtp','email','user','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','getSquareProject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created'];(function(_0x1f7481,_0x1a90d3){var _0x3e4b86=function(_0x3e776c){while(--_0x3e776c){_0x1f7481['push'](_0x1f7481['shift']());}};_0x3e4b86(++_0x1a90d3);}(_0x3bbd,0x1d2));var _0xd3bb=function(_0x18ec0d,_0x1dff28){_0x18ec0d=_0x18ec0d-0x0;var _0x1de836=_0x3bbd[_0x18ec0d];return _0x1de836;};'use strict';var fs=require('fs');var path=require(_0xd3bb('0x0'));var util=require(_0xd3bb('0x1'));var _=require('lodash');var sh=require(_0xd3bb('0x2'));var odbc=require(_0xd3bb('0x3'))();var rs=require(_0xd3bb('0x4'));var moment=require(_0xd3bb('0x5'));var Mustache=require(_0xd3bb('0x6'));var rp=require(_0xd3bb('0x7'));var logger=require('../../config/logger')(_0xd3bb('0x8'));var config=require('../../config/environment');var shared=require(_0xd3bb('0x9'));var scripts=require(_0xd3bb('0xa'));var FILES_PATH=_0xd3bb('0xb');var recursiveMapAttributes=[_0xd3bb('0xc'),_0xd3bb('0xd')];var verticesWithRetry=[_0xd3bb('0xe'),_0xd3bb('0xf'),_0xd3bb('0x10')];var AGIVertices=function(_0xa6410d,_0x39edca,_0x361a5c){this[_0xd3bb('0x11')]=_0xa6410d;this['rpc']=_0x39edca;this[_0xd3bb('0x12')]=_0x361a5c;};AGIVertices['prototype'][_0xd3bb('0x13')]=function(_0x5b15c3,_0x172dd5){this[_0xd3bb('0x14')][_0xd3bb('0x15')](_0x5b15c3)[_0xd3bb('0x16')](function(_0x1ede9d){_0x172dd5(null,_0x1ede9d?_0x1ede9d['name']:![]);})[_0xd3bb('0x17')](function(_0x3382e9){_0x172dd5(_0x3382e9);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x19')]=function(_0x1135c8,_0x240997){this['rpc'][_0xd3bb('0x1a')](_0x1135c8)['then'](function(_0x1b53f5){_0x240997(null,_0x1b53f5?_0x1b53f5['name']:![]);})['catch'](function(_0x3fd3e5){_0x240997(_0x3fd3e5);});};AGIVertices[_0xd3bb('0x18')]['getSquareProject']=function(_0x32d66c,_0x4eaaae){this[_0xd3bb('0x14')][_0xd3bb('0x1b')](_0x32d66c)[_0xd3bb('0x16')](function(_0x241d83){_0x4eaaae(null,_0x241d83?_0x241d83[_0xd3bb('0x1c')]:![]);})['catch'](function(_0x328bab){_0x4eaaae(_0x328bab);});};AGIVertices[_0xd3bb('0x18')]['getSquareOdbc']=function(_0x3265a1,_0x3e9d7b){this[_0xd3bb('0x14')][_0xd3bb('0x1d')](_0x3265a1)[_0xd3bb('0x16')](function(_0x115ba2){_0x3e9d7b(null,_0x115ba2?_0x115ba2[_0xd3bb('0x1e')]:![]);})[_0xd3bb('0x17')](function(_0x251618){_0x3e9d7b(_0x251618);});};AGIVertices['prototype'][_0xd3bb('0x1f')]=function(_0x302856,_0x10b7ab){this[_0xd3bb('0x14')]['getUserById'](_0x302856)[_0xd3bb('0x16')](function(_0x35f340){_0x10b7ab(null,_0x35f340?_0x35f340[_0xd3bb('0x1c')]:![]);})[_0xd3bb('0x17')](function(_0x14a50d){_0x10b7ab(_0x14a50d);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x20')]=function(_0x48e18f,_0x27ae36){this['rpc'][_0xd3bb('0x21')](_0x48e18f)['then'](function(_0x44b1cd){_0x27ae36(null,_0x44b1cd?_0x44b1cd['name']:![]);})[_0xd3bb('0x17')](function(_0x1e9b03){_0x27ae36(_0x1e9b03);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x22')]=function(_0x391b1a,_0x594468){var _0x500bb9=this;this[_0xd3bb('0x14')][_0xd3bb('0x23')](_0x391b1a)[_0xd3bb('0x16')](function(_0x232057){_0x594468(null,_0x232057?_0x500bb9[_0xd3bb('0x24')](_0x232057[_0xd3bb('0x25')]):![]);})[_0xd3bb('0x17')](function(_0x4c5776){_0x594468(_0x4c5776);});};AGIVertices['prototype']['getMailAccount']=function(_0x10816f,_0x33e38d){this['rpc'][_0xd3bb('0x26')](_0x10816f)[_0xd3bb('0x16')](function(_0x321523){_0x33e38d(null,_0x321523?_0x321523:![]);})[_0xd3bb('0x17')](function(_0x44ecef){_0x33e38d(_0x44ecef);});};AGIVertices['prototype'][_0xd3bb('0x27')]=function(_0x1ef5ff,_0x535d06,_0x5d7afa){this['mailRpc']['sendMailMessage'](_0x1ef5ff,_0x535d06)[_0xd3bb('0x16')](function(){_0x5d7afa(null);})[_0xd3bb('0x17')](function(_0x223ae9){_0x5d7afa(_0x223ae9);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x28')]=function(_0x302837,_0x5dcd86){this[_0xd3bb('0x14')][_0xd3bb('0x29')](_0x302837)[_0xd3bb('0x16')](function(_0x1abf70){if(_0x1abf70){if(_0x1abf70[_0xd3bb('0x2a')]){_0x5dcd86(null,[_0x1abf70['interval']]);}else{_0x5dcd86(null,_['map'](_0x1abf70[_0xd3bb('0x2b')],_0xd3bb('0x2c')));}}else{_0x5dcd86(null,![]);}})[_0xd3bb('0x17')](function(_0x8d25b9){_0x5dcd86(_0x8d25b9);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x24')]=function(_0x2f96d9){return util['format'](_0xd3bb('0x2d'),FILES_PATH,_0x2f96d9);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x2e')]=function(_0x19c386,_0x2cca43,_0x560adc){odbc[_0xd3bb('0x2f')](_0x19c386,function(_0x24d8ca){if(_0x24d8ca){logger[_0xd3bb('0x30')](_0xd3bb('0x31'),_0x24d8ca);_0x560adc(_0x24d8ca);}else{logger[_0xd3bb('0x32')](_0xd3bb('0x33'));odbc['query'](_0x2cca43,function(_0x213824,_0x65f41){if(_0x213824){logger[_0xd3bb('0x32')](_0xd3bb('0x34'),_0x2cca43);_0x560adc(_0x213824);}else{logger[_0xd3bb('0x32')](_0xd3bb('0x35'),_0x2cca43);odbc['close'](function(_0x49cb45){if(_0x49cb45){logger[_0xd3bb('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x49cb45);}_0x560adc(null,_0x65f41);});}});}});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x36')]=function(_0x4943f2,_0x1b39fc){this[_0xd3bb('0x14')][_0xd3bb('0x37')](_0x4943f2)[_0xd3bb('0x16')](function(_0x3556ef){_0x1b39fc(null,_0x3556ef?_0x3556ef:![]);})[_0xd3bb('0x17')](function(_0x3533e5){_0x1b39fc(_0x3533e5);});};AGIVertices['prototype'][_0xd3bb('0x38')]=function(_0x3f3abf,_0x4f526d){this[_0xd3bb('0x14')][_0xd3bb('0x38')](_0x3f3abf)['then'](function(_0x1a6eb0){_0x4f526d(null,_0x1a6eb0);})[_0xd3bb('0x17')](function(_0x5f59da){_0x4f526d(_0x5f59da);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x39')]=function(_0x47e659,_0x4d5642,_0x33bc02){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0xd3bb('0x3a')],'node':_0x47e659[_0xd3bb('0x3b')],'application':_0x47e659[_0xd3bb('0x3c')],'data':_0x4d5642||null,'project_name':this[_0xd3bb('0x11')][_0xd3bb('0x3d')],'callerid':this['channel'][_0xd3bb('0x3e')]})['then'](function(_0x1816f4){if(_0x33bc02){_0x33bc02(null,_0x1816f4);}})['catch'](function(_0x1ba828){if(_0x33bc02){_0x33bc02(_0x1ba828);}});};AGIVertices[_0xd3bb('0x18')]['createSquareRecording']=function(_0x5f0860,_0x1689e3,_0x4ecc59,_0x17b1b9){this[_0xd3bb('0x14')][_0xd3bb('0x3f')]({'uniqueid':this[_0xd3bb('0x11')][_0xd3bb('0x3a')],'callerid':this['channel'][_0xd3bb('0x3e')],'calleridname':this['channel'][_0xd3bb('0x40')],'context':this[_0xd3bb('0x11')]['context'],'extension':this[_0xd3bb('0x11')]['extension'],'priority':this[_0xd3bb('0x11')][_0xd3bb('0x41')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xd3bb('0x11')][_0xd3bb('0x42')],'projectName':this[_0xd3bb('0x11')][_0xd3bb('0x3d')],'saveName':_0x1689e3,'filename':_0x5f0860['file']||_0x1689e3,'savePath':_0x4ecc59})[_0xd3bb('0x16')](function(_0x3a287d){_0x17b1b9(null,_0x3a287d);})['catch'](function(_0x5415f6){_0x17b1b9(_0x5415f6);});};AGIVertices['prototype']['createSquareMessage']=function(_0x2a9722,_0x3e0a2f,_0x40e117){this[_0xd3bb('0x14')][_0xd3bb('0x43')]({'uniqueid':this['channel'][_0xd3bb('0x3a')],'body':_0x2a9722,'direction':_0x3e0a2f})[_0xd3bb('0x16')](function(_0x181e9d){if(_0x40e117){_0x40e117(null,_0x181e9d);}})[_0xd3bb('0x17')](function(_0x282bd2){if(_0x40e117){_0x40e117(_0x282bd2);}});};AGIVertices['prototype'][_0xd3bb('0x44')]=function(_0x4d8a89,_0x419f18){console[_0xd3bb('0x45')](_0xd3bb('0x46'),_0x4d8a89);console[_0xd3bb('0x45')](_0xd3bb('0x47'),_0x419f18);var _0xe0cb8c=this;var _0x176411=0x0;var _0xb04b2c={'firstName':_[_0xd3bb('0x48')](_0x4d8a89['name'])||_[_0xd3bb('0x49')](_0x4d8a89[_0xd3bb('0x1c')])?_0xd3bb('0x4a')+Math['random']():_0x4d8a89[_0xd3bb('0x1c')],'lastName':_[_0xd3bb('0x48')](_0x4d8a89['lastName'])||_[_0xd3bb('0x49')](_0x4d8a89[_0xd3bb('0x4b')])?null:_0x4d8a89[_0xd3bb('0x4b')],'phone':_0x4d8a89[_0xd3bb('0x4c')],'ListId':_0x4d8a89[_0xd3bb('0x4d')],'scheduledat':_0x4d8a89[_0xd3bb('0x4e')],'callbackUniqueid':this['channel'][_0xd3bb('0x3a')],'tags':'callback','description':_0xd3bb('0x4f')+_0x4d8a89[_0xd3bb('0x4e')][_0xd3bb('0x50')](),'priority':_0x4d8a89[_0xd3bb('0x51')]};if(_[_0xd3bb('0x52')](_0x4d8a89,_0xd3bb('0x53'))){if(!_['isNil'](_0x4d8a89[_0xd3bb('0x53')])){var _0x50ab67=_0x4d8a89['dialTimezone'];console[_0xd3bb('0x45')]('VALUE\x20TZ',_0x50ab67);if(_0x4d8a89[_0xd3bb('0x53')]==_0xd3bb('0x54')){this['rpc'][_0xd3bb('0x55')]({'phone':_0x4d8a89[_0xd3bb('0x4c')]})[_0xd3bb('0x16')](function(_0x4e1e8f){console[_0xd3bb('0x45')](_0xd3bb('0x56'),_0x4e1e8f);var _0x116551=_0x4e1e8f[_0xd3bb('0x53')];console[_0xd3bb('0x45')](_0xd3bb('0x57'),_0x116551);if(!_[_0xd3bb('0x49')](_0x116551)){var _0x15506e=shared[_0xd3bb('0x58')][_0x116551];console[_0xd3bb('0x45')]('tz',_0x15506e);if(!_[_0xd3bb('0x49')](_0x15506e)){var _0x14e1ab=-0x1*_0x15506e[_0xd3bb('0x59')];console[_0xd3bb('0x45')](_0xd3bb('0x5a'),_0x14e1ab);console[_0xd3bb('0x45')]('scheduledat\x20before',_0xb04b2c['scheduledat']);_0xb04b2c[_0xd3bb('0x5b')]=moment(_0x4d8a89[_0xd3bb('0x5b')])[_0xd3bb('0x5c')](_0x14e1ab,_0xd3bb('0x5d'));console[_0xd3bb('0x45')](_0xd3bb('0x5e'),_0xb04b2c['scheduledat']);_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)[_0xd3bb('0x16')](function(_0x29d179){_0x419f18(null,_0x29d179);})[_0xd3bb('0x17')](function(_0x4cca24){_0x419f18(_0x4cca24);});}else{_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)[_0xd3bb('0x16')](function(_0x58ce64){_0x419f18(null,_0x58ce64);})['catch'](function(_0x4f52b8){_0x419f18(_0x4f52b8);});}}else{_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)['then'](function(_0x429435){_0x419f18(null,_0x429435);})[_0xd3bb('0x17')](function(_0x574b74){_0x419f18(_0x574b74);});}});}else{var _0x176411=shared['timezones'][_0x50ab67];if(!_['isNil'](_0x176411)){var _0x1d6b7b=-0x1*_0x176411[_0xd3bb('0x59')];_0xb04b2c[_0xd3bb('0x5b')]=moment(_0x4d8a89[_0xd3bb('0x5b')])[_0xd3bb('0x5c')](_0x1d6b7b,_0xd3bb('0x5d'));_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)[_0xd3bb('0x16')](function(_0x2cc551){_0x419f18(null,_0x2cc551);})[_0xd3bb('0x17')](function(_0x110ddf){_0x419f18(_0x110ddf);});}else{_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)[_0xd3bb('0x16')](function(_0x1ed7ad){_0x419f18(null,_0x1ed7ad);})[_0xd3bb('0x17')](function(_0x1a9fcd){_0x419f18(_0x1a9fcd);});}}}else{_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)['then'](function(_0x2b7c51){_0x419f18(null,_0x2b7c51);})[_0xd3bb('0x17')](function(_0x366ed3){_0x419f18(_0x366ed3);});}}else{_0xe0cb8c[_0xd3bb('0x5f')](_0xb04b2c,_0x4d8a89,_0x419f18)[_0xd3bb('0x16')](function(_0xb5357c){_0x419f18(null,_0xb5357c);})[_0xd3bb('0x17')](function(_0x37b18a){_0x419f18(_0x37b18a);});}};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x5f')]=function(_0xb5aa68,_0x2defea,_0x1e1042){this[_0xd3bb('0x14')]['createCmContact'](_0xb5aa68)[_0xd3bb('0x16')](function(_0x59ad45){_0x1e1042(null,_0x59ad45);})['catch'](function(_0x2dddbd){_0x1e1042(_0x2dddbd);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x60')]=function(_0x452983,_0x29a375){this[_0xd3bb('0x14')][_0xd3bb('0x61')](_0x452983)[_0xd3bb('0x16')](function(_0x427195){_0x29a375(null,_0x427195?_0x427195[_0xd3bb('0x1c')]:![]);})['catch'](function(_0x54f5c7){_0x29a375(_0x54f5c7);});};AGIVertices['prototype'][_0xd3bb('0x62')]=function(_0xa7ae2e,_0x669bf5,_0x50afdf){var _0x3997a8={'role':_0xd3bb('0x63')};_0x3997a8[_0xa7ae2e]=this[_0xd3bb('0x11')][_0xd3bb('0x3e')];this[_0xd3bb('0x14')]['agentPause'](_0x3997a8,_0x669bf5,this[_0xd3bb('0x11')][_0xd3bb('0x3a')])[_0xd3bb('0x16')](function(_0x184894){_0x50afdf(null,_[_0xd3bb('0x49')](_0x184894)?![]:!![]);})[_0xd3bb('0x17')](function(_0x8b227f){logger['error'](_0x8b227f);_0x50afdf(null,![]);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x64')]=function(_0x30474e,_0xb50d92){var _0xc0647={'role':'agent'};_0xc0647[_0x30474e]=this[_0xd3bb('0x11')][_0xd3bb('0x3e')];this[_0xd3bb('0x14')][_0xd3bb('0x64')](_0xc0647)[_0xd3bb('0x16')](function(_0x477703){_0xb50d92(null,_[_0xd3bb('0x49')](_0x477703)?![]:!![]);})['catch'](function(_0x202f00){logger['error'](_0x202f00);_0xb50d92(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x215d36,_0x4f3195){var _0x53662f={'role':_0xd3bb('0x63')};_0x53662f[_0x215d36]=this[_0xd3bb('0x11')][_0xd3bb('0x3e')];this['rpc'][_0xd3bb('0x65')](_0x53662f)[_0xd3bb('0x16')](function(_0x4ad256){_0x4f3195(null,_[_0xd3bb('0x49')](_0x4ad256)?![]:!![]);})[_0xd3bb('0x17')](function(_0x8b5317){logger[_0xd3bb('0x30')](_0x8b5317);_0x4f3195(null,![]);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x66')]=function(_0x4c0980,_0x4a8b04){var _0x2800cd={'role':'agent'};_0x2800cd[_0x4c0980]=this[_0xd3bb('0x11')][_0xd3bb('0x3e')];var _0x5b3a36=_0x4c0980!=_0xd3bb('0x67')?util['format'](_0xd3bb('0x68'),'LOCAL',this[_0xd3bb('0x11')][_0xd3bb('0x3e')]):undefined;this[_0xd3bb('0x14')][_0xd3bb('0x66')](_0x2800cd,_0x5b3a36)['then'](function(_0x138e48){_0x4a8b04(null,_[_0xd3bb('0x49')](_0x138e48)?![]:!![]);})['catch'](function(_0x40bbf2){logger[_0xd3bb('0x30')](_0x40bbf2);_0x4a8b04(null,![]);});};AGIVertices[_0xd3bb('0x18')]['shellCommand']=function(_0x3cec88,_0x4bf6f9){sh[_0xd3bb('0x69')](_['trim'](_0x3cec88),function(_0xa1c594,_0xb6a93b){var _0x4c7c2c=_0xb6a93b[_0xd3bb('0x6a')](/(\r\n|\n|\r)/gm,'');_0x4bf6f9(null,_0x4c7c2c);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x6b')]=function(_0x287746,_0x56f91d){scripts[_0xd3bb('0x6b')](_0x287746[_0xd3bb('0x6c')],_0x287746['google_cloud_tts_text_type']||'text',_0x287746[_0xd3bb('0x6d')],_0x287746[_0xd3bb('0x6e')]||_0xd3bb('0x6f'),_0x287746[_0xd3bb('0x70')]||'MALE',_0x287746[_0xd3bb('0x71')]||_0xd3bb('0x72'))[_0xd3bb('0x16')](function(_0x177128){_0x56f91d(null,_0x177128);})[_0xd3bb('0x17')](function(_0x4f5d3a){_0x56f91d(_0x4f5d3a);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x73')]=function(_0x151091,_0x2b1d8c){scripts['googleTTS'](_0x151091[_0xd3bb('0x6d')],_0x151091['google_tts_language']||'en',0x1)[_0xd3bb('0x16')](function(_0x3b16ab){_0x2b1d8c(null,_0x3b16ab);})[_0xd3bb('0x17')](function(_0x52867c){_0x2b1d8c(_0x52867c);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x74')]=function(_0x135e02,_0xa16127){var _0x19fecc={'uri':_0x135e02['url'],'method':_0x135e02[_0xd3bb('0x75')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x135e02['timeout'])==='number'&&parseInt(_0x135e02['timeout'])>=0x1?parseInt(_0x135e02[_0xd3bb('0x76')])*0x3e8:0x5*0x3e8};if(_[_0xd3bb('0x77')]([_0xd3bb('0x78'),'PUT'],_0x19fecc[_0xd3bb('0x75')][_0xd3bb('0x79')]())){try{_0x19fecc[_0xd3bb('0x7a')]=_0x135e02[_0xd3bb('0xd')]?JSON['parse'](_0x135e02['rawBody']):{};}catch(_0x3af752){logger[_0xd3bb('0x30')](_0xd3bb('0x7b'),_0x3af752);}}try{_0x19fecc['headers']=_0x135e02['rawHeaders']?JSON[_0xd3bb('0x7c')](_0x135e02['rawHeaders']):{};}catch(_0x31318c){logger[_0xd3bb('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x31318c);}if(_0x135e02['computedVariables']){try{var _0x587de9=require(_0x135e02['computedVariables'])[_0xd3bb('0x7d')](this,_0x19fecc);_0x19fecc[_0xd3bb('0x7e')]=Mustache[_0xd3bb('0x7f')](_0x135e02[_0xd3bb('0x80')],_0x587de9,{},['$$','$$']);if(_0x19fecc['headers']){_0x19fecc[_0xd3bb('0x81')]=JSON[_0xd3bb('0x7c')](Mustache[_0xd3bb('0x7f')](JSON[_0xd3bb('0x82')](_0x19fecc[_0xd3bb('0x81')]),_0x587de9,{},['$$','$$']));}if(_0x19fecc[_0xd3bb('0x7a')]){_0x19fecc[_0xd3bb('0x7a')]=JSON['parse'](Mustache[_0xd3bb('0x7f')](JSON['stringify'](_0x19fecc[_0xd3bb('0x7a')]),_0x587de9,{},['$$','$$']));}}catch(_0x10f291){logger[_0xd3bb('0x30')](_0xd3bb('0x83'),_0x10f291);}}rp(_0x19fecc)[_0xd3bb('0x16')](function(_0x4f0cdc){var _0x1cbd8f={'statusCode':_0x4f0cdc[_0xd3bb('0x84')]||0xc8,'statusMessage':_0x4f0cdc['statusMessage']||'OK','headers':_0x4f0cdc[_0xd3bb('0x81')]||{},'body':_0x4f0cdc['body']||{}};_0xa16127(null,_0x1cbd8f);})[_0xd3bb('0x17')](function(_0x18fa98){var _0x118c50={'statusCode':_0x18fa98['statusCode']||0x1f4,'statusMessage':_0x18fa98[_0xd3bb('0x85')]||_0xd3bb('0x86'),'headers':_0x18fa98[_0xd3bb('0x87')][_0xd3bb('0x81')]||{},'body':_0x18fa98[_0xd3bb('0x87')]['body']||{}};_0xa16127(null,_0x118c50);});};AGIVertices[_0xd3bb('0x18')]['googleDialogflow']=function(_0x263fea,_0x1b406d){scripts['googleDialogflow'](this[_0xd3bb('0x11')][_0xd3bb('0x3a')],_0x263fea['key'],_0x263fea[_0xd3bb('0x6d')],_0x263fea[_0xd3bb('0x88')]||'en')[_0xd3bb('0x16')](function(_0xce3ef5){_0x1b406d(null,_0xce3ef5);})[_0xd3bb('0x17')](function(_0x360766){_0x1b406d(_0x360766);});};AGIVertices[_0xd3bb('0x18')]['sestekNDA']=function(_0x3aec79,_0x18bcf8){scripts[_0xd3bb('0x89')](this['channel'],_0x3aec79)[_0xd3bb('0x16')](function(_0x2d8379){_0x18bcf8(null,_0x2d8379);})['catch'](function(_0x52e54a){_0x18bcf8(_0x52e54a);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x8a')]=function(_0x5e3e3f,_0x1e524a){scripts[_0xd3bb('0x8a')](_0x5e3e3f[_0xd3bb('0x8b')],_0x5e3e3f['text'],_0x5e3e3f[_0xd3bb('0x8c')]||_0xd3bb('0x6f'),_0x5e3e3f['speed'])['then'](function(_0x1d1433){_0x1e524a(null,_0x1d1433);})[_0xd3bb('0x17')](function(_0x32a735){_0x1e524a(_0x32a735);});};AGIVertices[_0xd3bb('0x18')]['ispeechASR']=function(_0x3dae63,_0x15adfa,_0xd7a5ea){scripts[_0xd3bb('0x8d')](_0x15adfa,_0x3dae63[_0xd3bb('0x8b')],_0x3dae63[_0xd3bb('0x8e')]||_0xd3bb('0x6f'),this[_0xd3bb('0x8f')](_0x3dae63[_0xd3bb('0x90')])?_0x3dae63[_0xd3bb('0x90')]:undefined)[_0xd3bb('0x16')](function(_0x9e94b0){_0xd7a5ea(null,_0x9e94b0);})[_0xd3bb('0x17')](function(_0x215ac6){_0xd7a5ea(_0x215ac6);});};AGIVertices['prototype']['awsPolly']=function(_0x298236,_0x3fb584){scripts[_0xd3bb('0x91')](_0x298236[_0xd3bb('0x92')],_0x298236[_0xd3bb('0x93')],_0x298236[_0xd3bb('0x94')],_0x298236['aws_polly_voice']||_0xd3bb('0x95'),_0x298236[_0xd3bb('0x6d')],_0x298236['aws_text_type']||_0xd3bb('0x6d'))[_0xd3bb('0x16')](function(_0xa305ed){_0x3fb584(null,_0xa305ed);})[_0xd3bb('0x17')](function(_0x5b335a){_0x3fb584(_0x5b335a);});};AGIVertices['prototype'][_0xd3bb('0x96')]=function(_0x19d5ae,_0x26bde2){scripts[_0xd3bb('0x96')](this[_0xd3bb('0x11')][_0xd3bb('0x3a')],_0x19d5ae['aws_access_key_id'],_0x19d5ae['aws_secret_access_key'],_0x19d5ae[_0xd3bb('0x97')],_0x19d5ae[_0xd3bb('0x6d')],_0x19d5ae[_0xd3bb('0x98')])[_0xd3bb('0x16')](function(_0x18fc93){_0x26bde2(null,_0x18fc93);})[_0xd3bb('0x17')](function(_0x252ad0){_0x26bde2(_0x252ad0);});};AGIVertices['prototype'][_0xd3bb('0x99')]=function(_0x3726bc,_0xd306fd,_0x43010b){scripts['googleASR'](_0xd306fd,_0x3726bc['key'],_0x3726bc[_0xd3bb('0x9a')]||'en-US')[_0xd3bb('0x16')](function(_0x1a6167){_0x43010b(null,_0x1a6167);})[_0xd3bb('0x17')](function(_0x2d6411){_0x43010b(_0x2d6411);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x9b')]=function(_0x317c75,_0x48c0ed,_0x544c3f){scripts['tildeASR'](_0x48c0ed,_0x317c75['appid'],_0x317c75[_0xd3bb('0x9c')],_0x317c75[_0xd3bb('0x7e')])[_0xd3bb('0x16')](function(_0x3e52b7){_0x544c3f(null,_0x3e52b7);})['catch'](function(_0x45e49a){_0x544c3f(_0x45e49a);});};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x9d')]=function(_0x33dfa8){var _0x1f6b9c=_[_0xd3bb('0x77')](verticesWithRetry,_0x33dfa8[_0xd3bb('0x3c')])?_0x33dfa8:_[_0xd3bb('0x9e')](_0x33dfa8);for(var _0x168b27 in _0x1f6b9c){if(_0x1f6b9c[_0xd3bb('0x9f')](_0x168b27)){if(_0x1f6b9c[_0x168b27]&&_[_0xd3bb('0xa0')](_0x1f6b9c[_0x168b27])){if(_[_0xd3bb('0x77')](recursiveMapAttributes,_0x168b27)){_0x1f6b9c[_0x168b27]=this[_0xd3bb('0xa1')](_0x1f6b9c[_0x168b27]);}else{_0x1f6b9c[_0x168b27]=this[_0xd3bb('0xa2')](_0x1f6b9c[_0x168b27]);}}}}return _0x1f6b9c;};AGIVertices['prototype'][_0xd3bb('0xa3')]=function(_0x41531b){for(var _0xed59a9 in _0x41531b){if(_0x41531b[_0xd3bb('0x9f')](_0xed59a9)){if(_[_0xd3bb('0xa4')](_0x41531b[_0xed59a9])){this['recursiveNodeIndex'](_0x41531b[_0xed59a9]);}else if(_[_0xd3bb('0xa5')](_0x41531b[_0xed59a9])){for(var _0xf3bd8f=0x0;_0xf3bd8f<_0x41531b[_0xed59a9][_0xd3bb('0xa6')];_0xf3bd8f++){this[_0xd3bb('0xa3')](_0x41531b[_0xed59a9][_0xf3bd8f]);}}else if(_['isString'](_0x41531b[_0xed59a9])){_0x41531b[_0xed59a9]=this[_0xd3bb('0xa2')](_0x41531b[_0xed59a9]);}}}};AGIVertices['prototype'][_0xd3bb('0xa7')]=function(_0x5a5cb9,_0x47c2d1){for(var _0x28213d in _0x5a5cb9){if(_0x5a5cb9[_0xd3bb('0x9f')](_0x28213d)){if(_[_0xd3bb('0xa4')](_0x5a5cb9[_0x28213d])){if(!_[_0xd3bb('0x48')](_0x5a5cb9[_0x28213d])){this[_0xd3bb('0xa7')](_0x5a5cb9[_0x28213d],util[_0xd3bb('0xa8')](_0xd3bb('0xa9'),_0x47c2d1,_0x28213d));}}else if(_[_0xd3bb('0xa5')](_0x5a5cb9[_0x28213d])){for(var _0x2bcd58=0x0;_0x2bcd58<_0x5a5cb9[_0x28213d][_0xd3bb('0xa6')];_0x2bcd58++){this['saveRestApiResult'](_0x5a5cb9[_0x28213d][_0x2bcd58],util[_0xd3bb('0xa8')](_0xd3bb('0xa9'),_0x47c2d1,_0x28213d+'['+_0x2bcd58+']'));}}else{if(!_[_0xd3bb('0x49')](_0x5a5cb9[_0x28213d])){this['channel'][_0xd3bb('0xaa')](util[_0xd3bb('0xa8')](_0xd3bb('0xa9'),_0x47c2d1,_0x28213d),_0x5a5cb9[_0x28213d]);}}}}};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xa1')]=function(_0x9fc9df){try{var _0x21d377=JSON[_0xd3bb('0x7c')](_0x9fc9df);this[_0xd3bb('0xa3')](_0x21d377);return JSON['stringify'](_0x21d377);}catch(_0x4f0fae){return this[_0xd3bb('0xa2')](_0x9fc9df);}};AGIVertices[_0xd3bb('0x18')]['replaceAllVariables']=function(_0x1f84ac){console[_0xd3bb('0x45')](_0xd3bb('0xab'),_0x1f84ac);var _0x1bdc6a=_0x1f84ac['split']('{');for(var _0x182a93=0x1;_0x182a93<_0x1bdc6a[_0xd3bb('0xa6')];_0x182a93+=0x1){var _0x3e99a7=_0x1bdc6a[_0x182a93][_0xd3bb('0xac')]('}');console[_0xd3bb('0x45')]('nextbracket',_0x3e99a7);if(_0x3e99a7['length']>0x1){_0x1f84ac=_0x1f84ac['replaceAll']('{'+_0x3e99a7[0x0]+'}',this['channel'][_0xd3bb('0x13')](_0x3e99a7[0x0])['extra']||_0x3e99a7[0x0]);}}if(_0x1bdc6a['length']===0x1){return _0x1f84ac[_0xd3bb('0x50')]();}console[_0xd3bb('0x45')]('replaceall\x20end',_0x1f84ac);return this['replaceAllVariables'](_0x1f84ac);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xad')]=function(_0x29ba46,_0x4d4c6d){var _0x198bc3=this[_0xd3bb('0x11')][_0xd3bb('0x13')](_0x29ba46);if(_0x198bc3['result']===-0x1){return _0x198bc3;}logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4d4c6d,_0x198bc3[_0xd3bb('0xae')]));return this['channel'][_0xd3bb('0xaa')](_0x4d4c6d,_0x198bc3[_0xd3bb('0xae')]);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x8f')]=function(_0x583138){return _0x583138&&_0x583138!=='0'&&_0x583138!=='-1'&&_0x583138!=='';};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xaf')]=function(_0x259ea4){this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0x259ea4,'-');_0x259ea4[_0xd3bb('0xb0')]=_0x259ea4[_0xd3bb('0xaf')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xd3bb('0xb1')]=function(_0x340079){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0xb2'),_0x340079['label']));if(!this[_0xd3bb('0x8f')](_0x340079[_0xd3bb('0x6d')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('no\x20text\x20configured');}var _0x17195c='\x22'+_0x340079['text']+'\x22';if(this[_0xd3bb('0x8f')](_0x340079['options'])){_0x17195c+=','+_0x340079[_0xd3bb('0x87')];}var _0x382948=this[_0xd3bb('0x11')][_0xd3bb('0x69')](_0xd3bb('0xb4'),_0x17195c);if(_0x382948[_0xd3bb('0xb5')]===-0x1){return _0x382948;}return this['channel']['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0xb6'),_0x17195c));};AGIVertices[_0xd3bb('0x18')]['mrcprecog']=function(_0x5841c3){logger[_0xd3bb('0x32')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5841c3[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x5841c3[_0xd3bb('0xb7')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xb8'));}var _0x4e89cf=_0x5841c3['grammar'];if(this[_0xd3bb('0x8f')](_0x5841c3[_0xd3bb('0x87')])){_0x4e89cf+=','+_0x5841c3['options'];}var _0x444bbd=this['channel']['exec'](_0xd3bb('0xb9'),_0x4e89cf);if(_0x444bbd[_0xd3bb('0xb5')]===-0x1){return _0x444bbd;}var _0x58c24c=this[_0xd3bb('0xad')](_0xd3bb('0xba'),_0xd3bb('0xbb'));if(_0x58c24c[_0xd3bb('0xb5')]===-0x1){return _0x58c24c;}var _0x52e208=this[_0xd3bb('0xad')](_0xd3bb('0xbc'),_0xd3bb('0xbd'));if(_0x52e208[_0xd3bb('0xb5')]===-0x1){return _0x52e208;}var _0x5184be=this[_0xd3bb('0xad')](_0xd3bb('0xbe'),'MRCP_RECOG_INSTANCE');if(_0x5184be[_0xd3bb('0xb5')]===-0x1){return _0x5184be;}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4e89cf));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x8')]=function(_0x46a542){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0xbf'),_0x46a542[_0xd3bb('0x3b')]));return this['channel'][_0xd3bb('0x8')]([_0x46a542['command'],_0x46a542[_0xd3bb('0xc0')]]);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xc1')]=function(_0x59e067){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x59e067['label']));if(this['isConfigured'](_0x59e067[_0xd3bb('0x76')])){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0xc2'),_0x59e067[_0xd3bb('0x76')]));var _0x212b5e=this['channel'][_0xd3bb('0xc3')](_0x59e067[_0xd3bb('0x76')]);if(_0x212b5e['result']===-0x1){return _0x212b5e;}}return this[_0xd3bb('0x11')][_0xd3bb('0xc1')]();};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xc4')]=function(_0xe3a399){console['log'](_0xd3bb('0xc5'),_0xe3a399);logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0xc6'),_0xe3a399['label']));if(!this[_0xd3bb('0x8f')](_0xe3a399[_0xd3bb('0x4d')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xe3a399,'no\x20list\x20selected');}_0xe3a399[_0xd3bb('0x4e')]=moment();if(this[_0xd3bb('0x8f')](_0xe3a399[_0xd3bb('0xc7')])){_0xe3a399['scheduledAt']=moment()[_0xd3bb('0x5c')](_0xe3a399[_0xd3bb('0xc7')],'minutes');}if(!this[_0xd3bb('0x8f')](_0xe3a399[_0xd3bb('0x51')])){_0xe3a399[_0xd3bb('0x51')]=0x2;}console[_0xd3bb('0x45')](_0xd3bb('0xc8'),_0xe3a399);this[_0xd3bb('0x44')][_0xd3bb('0x7d')](this,_0xe3a399);return this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0xc9'),_0xe3a399[_0xd3bb('0x4c')],_0xe3a399['list_id'],_0xe3a399[_0xd3bb('0x4e')]));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xca')]=function(_0x36399c){logger['info'](util['format'](_0xd3bb('0xcb'),_0x36399c[_0xd3bb('0x3b')]));var _0x31b569=this['channel'][_0xd3bb('0x69')](_0x36399c[_0xd3bb('0xcc')],_0x36399c[_0xd3bb('0x87')]);if(_0x31b569[_0xd3bb('0xb5')]===-0x1){return _0x31b569;}return this[_0xd3bb('0x11')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x36399c[_0xd3bb('0xcc')],_0x36399c[_0xd3bb('0x87')]));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xcd')]=function(_0x286934){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0xce'),_0x286934['label']));if(!this[_0xd3bb('0x8f')](_0x286934[_0xd3bb('0x6d')])){return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0xcf'));}var _0x57cd32='\x22'+_0x286934[_0xd3bb('0x6d')]+'\x22';if(this['isConfigured'](_0x286934['options'])){_0x57cd32+=','+_0x286934['options'];}var _0x3c0f03=this[_0xd3bb('0x11')][_0xd3bb('0x69')](_0xd3bb('0xb4'),_0x57cd32);if(_0x3c0f03[_0xd3bb('0xb5')]===-0x1){return _0x3c0f03;}return this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')]('Executed\x20command\x20MRCPSynth\x20%s',_0x57cd32));};AGIVertices['prototype'][_0xd3bb('0xd0')]=function(_0x4c0d6c){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0xd1'),_0x4c0d6c[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x4c0d6c[_0xd3bb('0x6d')])){return this['channel'][_0xd3bb('0xb3')]('no\x20text\x20configured');}var _0x14c55b='\x22'+_0x4c0d6c[_0xd3bb('0x6d')]+'\x22';if(this[_0xd3bb('0x8f')](_0x4c0d6c['options'])){_0x14c55b+=','+_0x4c0d6c[_0xd3bb('0x87')];}var _0x42776a=this['channel']['exec']('MRCPSynth',_0x14c55b);if(_0x42776a[_0xd3bb('0xb5')]===-0x1){return _0x42776a;}return this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0xb6'),_0x14c55b));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xd2')]=function(_0x3c8c3d){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0xd3'),_0x3c8c3d[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x3c8c3d[_0xd3bb('0xb7')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xb8'));}var _0x1c6bc6=_0x3c8c3d[_0xd3bb('0xb7')];if(this[_0xd3bb('0x8f')](_0x3c8c3d[_0xd3bb('0x87')])){_0x1c6bc6+=','+_0x3c8c3d[_0xd3bb('0x87')];}var _0x447bde=this['channel'][_0xd3bb('0x69')](_0xd3bb('0xb9'),_0x1c6bc6);if(_0x447bde[_0xd3bb('0xb5')]===-0x1){return _0x447bde;}var _0x2ada2d=this[_0xd3bb('0xad')]('RECOG_CONFIDENCE()',_0xd3bb('0xd4'));if(_0x2ada2d[_0xd3bb('0xb5')]===-0x1){return _0x2ada2d;}var _0x2738c6=this[_0xd3bb('0xad')](_0xd3bb('0xbc'),_0xd3bb('0xd5'));if(_0x2738c6[_0xd3bb('0xb5')]===-0x1){return _0x2738c6;}var _0xab5544=this['getAndSetVariable'](_0xd3bb('0xbe'),'LUMENVOX_ASR_INSTANCE');if(_0xab5544[_0xd3bb('0xb5')]===-0x1){return _0xab5544;}return this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0xd6'),_0x1c6bc6));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xd7')]=function(_0x5bd208){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0xd8'),_0x5bd208[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x5bd208[_0xd3bb('0xb7')])){return this['channel'][_0xd3bb('0xb3')]('no\x20grammar\x20configured');}var _0x34ada1=_0x5bd208[_0xd3bb('0xb7')];if(this[_0xd3bb('0x8f')](_0x5bd208['options'])){_0x34ada1+=','+_0x5bd208[_0xd3bb('0x87')];}var _0x2ff110=this[_0xd3bb('0x11')][_0xd3bb('0x69')](_0xd3bb('0xb9'),_0x34ada1);if(_0x2ff110[_0xd3bb('0xb5')]===-0x1){return _0x2ff110;}var _0x33d412=this[_0xd3bb('0xad')](_0xd3bb('0xba'),'SESTEK_ASR_CONFIDENCE');if(_0x33d412[_0xd3bb('0xb5')]===-0x1){return _0x33d412;}var _0x4005c9=this[_0xd3bb('0xad')](_0xd3bb('0xbc'),_0xd3bb('0xd9'));if(_0x4005c9['result']===-0x1){return _0x4005c9;}var _0x3f620b=this['getAndSetVariable'](_0xd3bb('0xbe'),_0xd3bb('0xda'));if(_0x3f620b['result']===-0x1){return _0x3f620b;}return this['channel']['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0xd6'),_0x34ada1));};AGIVertices[_0xd3bb('0x18')]['database']=function(_0xd10644){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0xdb'),_0xd10644[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0xd10644[_0xd3bb('0xdc')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xd10644,'no\x20database\x20selected');}var _0x4d9a88=this['getSquareOdbc'][_0xd3bb('0x7d')](this,_0xd10644[_0xd3bb('0xdc')]);if(!_0x4d9a88){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xd10644,_0xd3bb('0xdd'));}if(!this[_0xd3bb('0x8f')](_0xd10644[_0xd3bb('0xde')])){return this[_0xd3bb('0x11')]['error'](_0xd10644,_0xd3bb('0xdf'));}var _0x1b22e2=_0xd10644[_0xd3bb('0xde')][_0xd3bb('0x6a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0xe0'),_0x1b22e2));var _0x449e14=this[_0xd3bb('0x2e')][_0xd3bb('0x7d')](this,_0x4d9a88,_0x1b22e2);this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0xd10644,_0x1b22e2);if(!this[_0xd3bb('0x8f')](_0xd10644[_0xd3bb('0xe1')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x468d34=this['getVariable'][_0xd3bb('0x7d')](this,_0xd10644[_0xd3bb('0xe1')]);if(!_0x468d34){return this['channel'][_0xd3bb('0x30')](_0xd10644,_0xd3bb('0xe2'));}var _0x269577=this;_0x449e14[_0xd3bb('0xe3')](function(_0x942d6a,_0xaefdd7){Object[_0xd3bb('0xe4')](_0x942d6a)['forEach'](function(_0x52cc1a){_0x269577['channel'][_0xd3bb('0xaa')](util[_0xd3bb('0xa8')](_0xd3bb('0xe5'),_0x468d34,_0xaefdd7,_0x52cc1a),_0x942d6a[_0x52cc1a]);});});this[_0xd3bb('0x11')][_0xd3bb('0xaa')](util[_0xd3bb('0xa8')](_0xd3bb('0xe6'),_0x468d34),_0x449e14[_0xd3bb('0xa6')]);return this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0xe7'),_0x468d34));};AGIVertices[_0xd3bb('0x18')]['dial']=function(_0x3b9515){logger[_0xd3bb('0xe8')](util['format'](_0xd3bb('0xe9'),_0x3b9515[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x3b9515[_0xd3bb('0xea')])){return this[_0xd3bb('0x11')]['error'](_0x3b9515,_0xd3bb('0xeb'));}var _0x4bc28f=this['getUser']['sync'](this,_0x3b9515['sip_id']);if(!_0x4bc28f){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x3b9515,_0xd3bb('0xec'));}var _0x26768d=this[_0xd3bb('0x11')][_0xd3bb('0x69')]('DIAL',[util[_0xd3bb('0xa8')](_0xd3bb('0xed'),_0x4bc28f),_0x3b9515[_0xd3bb('0x76')],_0x3b9515[_0xd3bb('0xee')],_0x3b9515[_0xd3bb('0x80')]]);if(_0x26768d[_0xd3bb('0xb5')]===-0x1){return _0x26768d;}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0xef'),_0xd3bb('0xf0')));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xf1')]=function(_0x311183){logger['info'](util[_0xd3bb('0xa8')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x311183[_0xd3bb('0x3b')]));if(!this['isConfigured'](_0x311183[_0xd3bb('0x8b')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xf2'));}if(!this[_0xd3bb('0x8f')](_0x311183[_0xd3bb('0x6d')])){return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0xcf'));}this[_0xd3bb('0x11')][_0xd3bb('0xf3')]=!![];this[_0xd3bb('0x39')](_0x311183);this[_0xd3bb('0x43')](_0x311183[_0xd3bb('0x6d')],'in');this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')]('Trying\x20Dialogflow:\x20%s',_0x311183['text']));var _0x4cd309=this['googleDialogflow'][_0xd3bb('0x7d')](this,_0x311183);if(_0x4cd309){for(var _0xeefe48 in _0x4cd309){if(_0x4cd309['hasOwnProperty'](_0xeefe48)){this[_0xd3bb('0x11')][_0xd3bb('0xaa')](util['format'](_0xd3bb('0xf4'),_0xeefe48['toUpperCase']()),_0x4cd309[_0xeefe48]);}}this[_0xd3bb('0x43')](_0x4cd309[_0xd3bb('0xf5')],'out');return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0xf6'),_0x4cd309[_0xd3bb('0xf5')]));}return this[_0xd3bb('0x11')]['error'](_0x311183,_0xd3bb('0xf7'));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xf8')]=function(_0x1c3ad1){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0xf9'),_0x1c3ad1[_0xd3bb('0x3b')]));if(!this['isConfigured'](_0x1c3ad1[_0xd3bb('0xfa')])){return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0xfb'));}if(!this[_0xd3bb('0x8f')](_0x1c3ad1[_0xd3bb('0xfc')])){return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0xfd'));}if(!this[_0xd3bb('0x8f')](_0x1c3ad1[_0xd3bb('0xfe')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xff'));}if(!this['isConfigured'](_0x1c3ad1['ndassistant_url'])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xcf'));}this[_0xd3bb('0x11')][_0xd3bb('0xf3')]=!![];this[_0xd3bb('0x39')](_0x1c3ad1);this[_0xd3bb('0x43')](_0x1c3ad1[_0xd3bb('0x6d')],'in');this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format'](_0xd3bb('0x100'),_0x1c3ad1['text']));var _0x307efe=this[_0xd3bb('0x89')][_0xd3bb('0x7d')](this,_0x1c3ad1);if(_0x307efe){for(var _0x7ab4f7 in _0x307efe){if(_0x307efe[_0xd3bb('0x9f')](_0x7ab4f7)){this[_0xd3bb('0x11')]['setVariable'](util[_0xd3bb('0xa8')](_0xd3bb('0x101'),_0x7ab4f7[_0xd3bb('0x79')]()),_0x307efe[_0x7ab4f7]);}}this[_0xd3bb('0x43')](_0x307efe[_0xd3bb('0xf5')],_0xd3bb('0x102'));if(_0x307efe[_0xd3bb('0x103')]){this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x307efe[_0xd3bb('0x103')]));var _0x3858e3=this[_0xd3bb('0x11')][_0xd3bb('0x104')](_0x307efe[_0xd3bb('0x103')]);try{fs[_0xd3bb('0x105')](_0x307efe['audiofile']+'.wav');}catch(_0x33a51e){logger[_0xd3bb('0x30')](_0x33a51e);}return _0x3858e3;}else{return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format'](_0xd3bb('0x106'),_0x307efe[_0xd3bb('0xf5')]));}}return this['channel'][_0xd3bb('0x30')](_0x1c3ad1,_0xd3bb('0x107'));};AGIVertices['prototype'][_0xd3bb('0x108')]=function(_0x124ad5){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x124ad5[_0xd3bb('0x3b')]));return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('end');};AGIVertices['prototype'][_0xd3bb('0x109')]=function(_0x48b3f9){logger[_0xd3bb('0x32')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x48b3f9[_0xd3bb('0x3b')]));var _0x2b7dc2='';if(_0x48b3f9[_0xd3bb('0x10a')]){if(!this[_0xd3bb('0x8f')](_0x48b3f9[_0xd3bb('0x10a')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x48b3f9,_0xd3bb('0x10b'));}else{var _0x35d99b=parseInt(_0x48b3f9[_0xd3bb('0x10a')],0xa);if(isNaN(_0x35d99b)){_0x2b7dc2=_0x48b3f9[_0xd3bb('0x10a')];}else{_0x2b7dc2=this['getTrunk']['sync'](this,_0x48b3f9[_0xd3bb('0x10a')]);if(!_0x2b7dc2){return this[_0xd3bb('0x11')]['error'](_0x48b3f9,_0xd3bb('0x10c'));}}}}else if(_0x48b3f9['trunk_name']){_0x2b7dc2=_0x48b3f9[_0xd3bb('0x10d')];}else{return this['channel']['error'](_0x48b3f9,_0xd3bb('0x10b'));}var _0x71e06d=this['channel']['exec']('DIAL',[util[_0xd3bb('0xa8')](_0xd3bb('0x10e'),_0x2b7dc2,_0x48b3f9[_0xd3bb('0x4c')]),_0x48b3f9[_0xd3bb('0x76')],_0x48b3f9['opts'],_0x48b3f9[_0xd3bb('0x80')]]);if(_0x71e06d[_0xd3bb('0xb5')]===-0x1){return _0x71e06d;}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format'](_0xd3bb('0xef'),_0xd3bb('0xf0')));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x10f')]=function(_0x1c8994){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x110'),_0x1c8994['label']));return this[_0xd3bb('0x11')]['noop'](_0xd3bb('0x10f'));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xf')]=function(_0xb75bee){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xb75bee[_0xd3bb('0x3b')]));if(_0xb75bee[_0xd3bb('0xb0')]===0x0){return this[_0xd3bb('0xaf')](_0xb75bee);}_0xb75bee[_0xd3bb('0xb0')]-=0x1;if(!this[_0xd3bb('0x8f')](_0xb75bee[_0xd3bb('0x111')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xb75bee,_0xd3bb('0x112'));}var _0x32387b=this[_0xd3bb('0x22')][_0xd3bb('0x7d')](this,_0xb75bee[_0xd3bb('0x111')]);if(!_0x32387b){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xb75bee,'no\x20file\x20audio\x20found');}if(!this[_0xd3bb('0x8f')](_0xb75bee['variable_id'])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xd3bb('0x113'));}var _0x3bab5=this[_0xd3bb('0x11')][_0xd3bb('0x114')](_0x32387b,_0xb75bee[_0xd3bb('0x115')],_0xb75bee[_0xd3bb('0x116')]);var _0x5fb454=_0x3bab5[_0xd3bb('0xb5')]?_0x3bab5['result'][_0xd3bb('0x50')]():'';logger[_0xd3bb('0x32')]('test',JSON[_0xd3bb('0x82')](_0x3bab5));if(_0x3bab5[_0xd3bb('0xb5')]===-0x1){this['createSquareDetailsReport'][_0xd3bb('0x7d')](this,_0xb75bee,_0x5fb454);return _0x3bab5;}else if(_0x3bab5[_0xd3bb('0xae')]===_0xd3bb('0x76')){_0x3bab5[_0xd3bb('0xb5')]=_0x5fb454[_0xd3bb('0xa6')]>=parseInt(_0xb75bee[_0xd3bb('0x117')])?'x':'i';}else{_0x3bab5[_0xd3bb('0xb5')]=_0x5fb454[_0xd3bb('0xa6')]>=parseInt(_0xb75bee[_0xd3bb('0x117')])&&_0x5fb454['length']<=parseInt(_0xb75bee['maxdigit'])?'x':'i';}var _0xafad23=this[_0xd3bb('0x13')]['sync'](this,_0xb75bee[_0xd3bb('0xe1')]);if(!_0xafad23){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0xb75bee,'no\x20variable\x20found');}this[_0xd3bb('0x11')][_0xd3bb('0xaa')](_0xafad23,_0x5fb454);if(this['isConfigured'](_0xb75bee['hiddendigitsnum'])){var _0xb43ffa=parseInt(_0xb75bee[_0xd3bb('0x118')],0xa);var _0x201772=rs[_0xd3bb('0x119')]({'charset':'*','length':_0xb43ffa});var _0x3213d8=_0x5fb454[_0xd3bb('0xa6')];if(_0x3213d8>0x0){if(_0x3213d8>_0xb43ffa){this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0xb75bee,_0xb75bee['hiddendigitspos']===_0xd3bb('0x11a')?_0x201772+_0x5fb454[_0xd3bb('0x11b')](_0xb43ffa):_0x5fb454[_0xd3bb('0x11b')](0x0,_0x3213d8-_0xb43ffa)+_0x201772);}else{this['createSquareDetailsReport']['sync'](this,_0xb75bee,rs['generate']({'charset':'*','length':_0x3213d8}));}}else{this[_0xd3bb('0x39')]['sync'](this,_0xb75bee,'');}}else{this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0xb75bee,_0x5fb454);}return _0x3bab5;};AGIVertices['prototype'][_0xd3bb('0x10')]=function(_0x34bffb){logger['info'](util['format'](_0xd3bb('0x11c'),_0x34bffb['label']));return this[_0xd3bb('0xf')](_0x34bffb);};AGIVertices[_0xd3bb('0x18')]['goal']=function(_0x2caf33){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x11d'),_0x2caf33[_0xd3bb('0x3b')]));this['createSquareDetailsReport']['sync'](this,_0x2caf33,_0x2caf33[_0xd3bb('0x11e')]);return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format'](_0xd3bb('0x11f'),_0x2caf33[_0xd3bb('0x11e')]));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x120')]=function(_0x5d269e){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0x121'),_0x5d269e[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x5d269e[_0xd3bb('0x92')])||!this[_0xd3bb('0x8f')](_0x5d269e['aws_secret_access_key'])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x122'));}if(!this[_0xd3bb('0x8f')](_0x5d269e[_0xd3bb('0x6d')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xcf'));}this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('Trying\x20aws\x20Polly\x20%s',_0x5d269e[_0xd3bb('0x6d')]));var _0xafe443=this[_0xd3bb('0x91')][_0xd3bb('0x7d')](this,_0x5d269e);if(_0xafe443){this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x123'),_0xafe443));var _0x535e68=this[_0xd3bb('0x11')][_0xd3bb('0x104')](_0xafe443);try{fs['unlink'](_0xafe443+_0xd3bb('0x124'));}catch(_0x30b36c){logger[_0xd3bb('0x30')](_0x30b36c);}return _0x535e68;}return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x5d269e,_0xd3bb('0x125'));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x126')]=function(_0x63c649){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x127'),_0x63c649['label']));if(!this[_0xd3bb('0x8f')](_0x63c649[_0xd3bb('0x92')])||!this['isConfigured'](_0x63c649[_0xd3bb('0x93')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x122'));}if(!this['isConfigured'](_0x63c649['aws_bot_name'])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('no\x20bot\x20name\x20configured');}if(!this[_0xd3bb('0x8f')](_0x63c649[_0xd3bb('0x6d')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xcf'));}this['channel'][_0xd3bb('0xf3')]=!![];this[_0xd3bb('0x39')](_0x63c649);this['createSquareMessage'](_0x63c649[_0xd3bb('0x6d')],'in');this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0x128'),_0x63c649['text']));var _0x3f951b=this[_0xd3bb('0x96')][_0xd3bb('0x7d')](this,_0x63c649);if(_0x3f951b){for(var _0x562d7e in _0x3f951b){if(_0x3f951b['hasOwnProperty'](_0x562d7e)&&_[_0xd3bb('0xa0')](_0x3f951b[_0x562d7e])){this[_0xd3bb('0x11')][_0xd3bb('0xaa')](util['format']('AWS_LEX_%s',_0x562d7e[_0xd3bb('0x79')]()),_0x3f951b[_0x562d7e]);}}if(_[_0xd3bb('0x49')](_0x3f951b[_0xd3bb('0x85')])){return this[_0xd3bb('0x11')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xd3bb('0x43')](_0x3f951b[_0xd3bb('0x85')],_0xd3bb('0x102'));return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('Amazon\x20Lex\x20Result\x20%s',_0x3f951b[_0xd3bb('0x85')]));}}return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x63c649,_0xd3bb('0x129'));};AGIVertices['prototype']['googleasr']=function(_0x49a495){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x49a495[_0xd3bb('0x3b')],_0x49a495[_0xd3bb('0x76')]));if(!this[_0xd3bb('0x8f')](_0x49a495[_0xd3bb('0x8b')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('no\x20key\x20configured');}var _0x14e087=_0xd3bb('0x12a');var _0x3acdb4=util[_0xd3bb('0xa8')]('%s/recordings/%s',FILES_PATH,rs[_0xd3bb('0x119')](0x4));var _0x27fbe4=util[_0xd3bb('0xa8')]('%s.%s',_0x3acdb4,_0x14e087);var _0x1dcbfd=!![];if(_0x49a495[_0xd3bb('0x12b')]===_0xd3bb('0x12c')){_0x1dcbfd=![];}var _0x3577c2=this[_0xd3bb('0x11')]['recordFile'](_0x3acdb4,_0x14e087,_0x49a495[_0xd3bb('0x12d')],_0x49a495[_0xd3bb('0x76')],undefined,_0x1dcbfd);if(_0x3577c2[_0xd3bb('0xb5')]!==-0x1){this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0x12e'),_0x27fbe4));var _0x222f94=this[_0xd3bb('0x99')][_0xd3bb('0x7d')](this,_0x49a495,_0x27fbe4);if(_0x222f94){for(var _0x4bfe81 in _0x222f94){if(_0x222f94[_0xd3bb('0x9f')](_0x4bfe81)){this['channel'][_0xd3bb('0xaa')](util[_0xd3bb('0xa8')](_0xd3bb('0x12f'),_0x4bfe81[_0xd3bb('0x79')]()),_0x222f94[_0x4bfe81]);}}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x130'),JSON[_0xd3bb('0x82')](_0x222f94)));}}return _0x3577c2;};AGIVertices[_0xd3bb('0x18')]['tildeasr']=function(_0x25478a){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x131'),_0x25478a[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x25478a[_0xd3bb('0x132')])){return this['channel']['noop'](_0xd3bb('0x133'));}if(!this[_0xd3bb('0x8f')](_0x25478a[_0xd3bb('0x9c')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x134'));}var _0x449592=_0xd3bb('0x12a');var _0xab0ca7=util['format'](_0xd3bb('0x135'),FILES_PATH,rs[_0xd3bb('0x119')](0x4));var _0x3096fe=util['format']('%s.%s',_0xab0ca7,_0x449592);var _0x4f46bd=!![];if(_0x25478a[_0xd3bb('0x12b')]===_0xd3bb('0x12c')){_0x4f46bd=![];}var _0x3849ee=this[_0xd3bb('0x11')][_0xd3bb('0x136')](_0xab0ca7,_0x449592,_0x25478a['intKey'],_0x25478a[_0xd3bb('0x76')],undefined,_0x4f46bd);if(_0x3849ee['result']!==-0x1){this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x137'),_0x3096fe));var _0x26dc50=this[_0xd3bb('0x9b')][_0xd3bb('0x7d')](this,_0x25478a,_0x3096fe);if(_0x26dc50){for(var _0x783c65 in _0x26dc50){if(_0x26dc50[_0xd3bb('0x9f')](_0x783c65)){this[_0xd3bb('0x11')][_0xd3bb('0xaa')](util[_0xd3bb('0xa8')](_0xd3bb('0x138'),_0x783c65['toUpperCase']()),_0x26dc50[_0x783c65]);}}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x26dc50)));}}return _0x3849ee;};AGIVertices[_0xd3bb('0x18')]['gotoc']=function(_0xe4d882){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0xe4d882[_0xd3bb('0x3b')]));return this[_0xd3bb('0x11')][_0xd3bb('0x139')](_0xe4d882[_0xd3bb('0x13a')],_0xe4d882[_0xd3bb('0x13b')],_0xe4d882[_0xd3bb('0x41')]);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x13c')]=function(_0x57f991){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x13d'),_0x57f991['label']));if(!this[_0xd3bb('0x8f')](_0x57f991['condition'])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x57f991,_0xd3bb('0x13e'));}try{var _0x5561ea=eval(_0x57f991[_0xd3bb('0x13f')])?_0xd3bb('0x140'):'false';this[_0xd3bb('0x11')]['noop'](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x57f991[_0xd3bb('0x13f')],_0x5561ea));return{'code':0xc8,'result':_0x5561ea};}catch(_0x3c5398){return{'code':0xc8,'result':_0xd3bb('0x141')};}};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x142')]=function(_0x5a0e5f){logger[_0xd3bb('0x32')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a0e5f[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x5a0e5f['interval_id'])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x5a0e5f,_0xd3bb('0x143'));}var _0x13b2cf=this[_0xd3bb('0x28')][_0xd3bb('0x7d')](this,_0x5a0e5f[_0xd3bb('0x144')]);if(!_0x13b2cf){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x5a0e5f,_0xd3bb('0x145'));}for(var _0x3a4107=0x0;_0x3a4107<_0x13b2cf[_0xd3bb('0xa6')];_0x3a4107+=0x1){var _0x8ff92c=this[_0xd3bb('0x11')][_0xd3bb('0x13')](util[_0xd3bb('0xa8')](_0xd3bb('0x146'),_0x13b2cf[_0x3a4107]));if(_0x8ff92c[_0xd3bb('0xb5')]===-0x1){return _0x8ff92c;}logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x147'),_0x13b2cf[_0x3a4107],_0x8ff92c['extra']));if(_0x8ff92c[_0xd3bb('0xae')]==='true'){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x147'),_0x13b2cf[_0x3a4107],_0xd3bb('0x140')));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x147'),_0x13b2cf[_0x3a4107],_0xd3bb('0x140')));return{'code':0xc8,'result':_0xd3bb('0x140')};}else{logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('IFTIME\x20%s\x20%s',_0x13b2cf[_0x3a4107],'false'));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x147'),_0x13b2cf[_0x3a4107],_0xd3bb('0x141')));}}return{'code':0xc8,'result':_0xd3bb('0x141')};};AGIVertices['prototype']['hangup']=function(_0xbd7704){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0x148'),_0xbd7704[_0xd3bb('0x3b')]));return this[_0xd3bb('0x11')]['hangup']();};AGIVertices['prototype'][_0xd3bb('0x149')]=function(_0xe1a7be){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x14a'),_0xe1a7be['label']));if(!this[_0xd3bb('0x8f')](_0xe1a7be[_0xd3bb('0x8b')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0xf2'));}var _0x4be2a8='wav';var _0x530031=util['format'](_0xd3bb('0x135'),FILES_PATH,rs[_0xd3bb('0x119')](0x4));var _0x5cd16a=util[_0xd3bb('0xa8')]('%s.%s',_0x530031,_0x4be2a8);var _0x453e18=!![];if(_0xe1a7be['beep']===_0xd3bb('0x12c')){_0x453e18=![];}var _0x2c30b3=this['channel'][_0xd3bb('0x136')](_0x530031,_0x4be2a8,_0xe1a7be[_0xd3bb('0x12d')],_0xe1a7be[_0xd3bb('0x76')],undefined,_0x453e18);if(_0x2c30b3[_0xd3bb('0xb5')]!==-0x1){this[_0xd3bb('0x11')]['noop'](util['format'](_0xd3bb('0x14b'),_0x5cd16a));var _0x48e391=this[_0xd3bb('0x8d')][_0xd3bb('0x7d')](this,_0xe1a7be,_0x5cd16a);if(_0x48e391){for(var _0x277eeb in _0x48e391){if(_0x48e391['hasOwnProperty'](_0x277eeb)){this[_0xd3bb('0x11')]['setVariable'](util['format'](_0xd3bb('0x14c'),_0x277eeb['toUpperCase']()),_0x48e391[_0x277eeb]);}}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x14d'),JSON[_0xd3bb('0x82')](_0x48e391)));}}return _0x2c30b3;};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x14e')]=function(_0x36e078){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x14f'),_0x36e078['label']));if(!this[_0xd3bb('0x8f')](_0x36e078[_0xd3bb('0x8b')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('no\x20key\x20configured');}if(!this[_0xd3bb('0x8f')](_0x36e078[_0xd3bb('0x6d')])){return this[_0xd3bb('0x11')]['noop'](_0xd3bb('0xcf'));}this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0x150'),_0x36e078['text']));var _0x2c9895=this[_0xd3bb('0x8a')]['sync'](this,_0x36e078);if(_0x2c9895){this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x14b'),_0x2c9895));var _0x475e42=this[_0xd3bb('0x11')]['streamFile'](_0x2c9895,_0x36e078[_0xd3bb('0x12d')]);try{fs[_0xd3bb('0x105')](_0x2c9895+'.wav');}catch(_0x4ca80a){logger[_0xd3bb('0x30')](_0x4ca80a);}return _0x475e42;}return this[_0xd3bb('0x11')]['error'](_0x36e078,_0xd3bb('0x151'));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x152')]=function(_0x21510f){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0x153'),_0x21510f[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x21510f[_0xd3bb('0x154')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x21510f,_0xd3bb('0x155'));}logger['info'](util[_0xd3bb('0xa8')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd3bb('0x11')]['callerid'],_0x21510f[_0xd3bb('0x154')]));var _0x50c8ac=this[_0xd3bb('0x66')]['sync'](this,_0x21510f[_0xd3bb('0x154')]);if(_0x50c8ac){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0x156'),this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x21510f[_0xd3bb('0x154')]));this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x156'),this['channel'][_0xd3bb('0x3e')],_0x21510f[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x157')};}else{logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x21510f[_0xd3bb('0x154')]));this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd3bb('0x3e')],_0x21510f[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x158')};}};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x159')]=function(_0x3b754a){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3b754a['label']));if(!this[_0xd3bb('0x8f')](_0x3b754a['findBy'])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x3b754a,_0xd3bb('0x155'));}logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x15a'),this[_0xd3bb('0x11')]['callerid'],_0x3b754a[_0xd3bb('0x154')]));var _0x2c6327=this[_0xd3bb('0x65')][_0xd3bb('0x7d')](this,_0x3b754a[_0xd3bb('0x154')]);if(_0x2c6327){logger[_0xd3bb('0x32')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xd3bb('0x3e')],_0x3b754a[_0xd3bb('0x154')]));this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0x156'),this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x3b754a[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x157')};}else{logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x3b754a[_0xd3bb('0x154')]));this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x15b'),this['channel'][_0xd3bb('0x3e')],_0x3b754a[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x158')};}};AGIVertices['prototype'][_0xd3bb('0x15c')]=function(_0x3a3fa9){logger[_0xd3bb('0x32')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3a3fa9['label']));if(!this[_0xd3bb('0x8f')](_0x3a3fa9[_0xd3bb('0x15d')])){return this['channel'][_0xd3bb('0x30')](_0x3a3fa9,_0xd3bb('0x15e'));}this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x15f'),_0x3a3fa9[_0xd3bb('0x15d')]));var _0x4cc5dc=eval(_0x3a3fa9[_0xd3bb('0x15d')]);if(!this[_0xd3bb('0x8f')](_0x3a3fa9[_0xd3bb('0xe1')])){return this[_0xd3bb('0x11')]['noop'](_0xd3bb('0x113'));}var _0xd09b29=this[_0xd3bb('0x13')][_0xd3bb('0x7d')](this,_0x3a3fa9['variable_id']);if(!_0xd09b29){return this['channel'][_0xd3bb('0x30')](_0x3a3fa9,_0xd3bb('0xe2'));}if(_[_0xd3bb('0xa5')](_0x4cc5dc)){var _0x2876ac=this;_0x4cc5dc[_0xd3bb('0xe3')](function(_0x226b2d,_0x1faf10){_0x2876ac[_0xd3bb('0x11')]['setVariable'](util[_0xd3bb('0xa8')](_0xd3bb('0x160'),_0xd09b29,_0x1faf10),_0x226b2d);});return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('variable\x20%s[key]\x20set',_0xd09b29));}else{return this['channel'][_0xd3bb('0xaa')](_0xd09b29,_0x4cc5dc);}};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0xe')]=function(_0x3c5817){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x161'),_0x3c5817[_0xd3bb('0x3b')]));if(_0x3c5817[_0xd3bb('0xb0')]===0x0){return this['maxRetry'](_0x3c5817);}_0x3c5817[_0xd3bb('0xb0')]-=0x1;if(!this[_0xd3bb('0x8f')](_0x3c5817[_0xd3bb('0x111')])){return this['channel'][_0xd3bb('0x30')](_0x3c5817,'no\x20file\x20audio\x20selected');}var _0x4622a3=this[_0xd3bb('0x22')][_0xd3bb('0x7d')](this,_0x3c5817['file_id']);if(!_0x4622a3){return this[_0xd3bb('0x11')]['error'](_0x3c5817,_0xd3bb('0x162'));}var _0x1364d2=this[_0xd3bb('0x11')][_0xd3bb('0x114')](_0x4622a3,_0x3c5817[_0xd3bb('0x115')],_0x3c5817[_0xd3bb('0x163')]);var _0x3a7856=_0x1364d2[_0xd3bb('0xb5')];if(_0x1364d2[_0xd3bb('0xb5')]===-0x1){this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0x3c5817,'-1');return _0x1364d2;}else if(_0x1364d2[_0xd3bb('0xae')]===_0xd3bb('0x76')){_0x1364d2['result']=_0x1364d2[_0xd3bb('0xb5')]['length']>0x0?_0x1364d2[_0xd3bb('0xb5')]:'t';}else if(_[_0xd3bb('0x48')](_0x1364d2[_0xd3bb('0xb5')])){_0x1364d2['result']='#';_0x3a7856='#';}if(!this[_0xd3bb('0x8f')](_0x3c5817['variable_id'])){this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x113'));}else{var _0x5d7450=this[_0xd3bb('0x13')][_0xd3bb('0x7d')](this,_0x3c5817['variable_id']);if(!_0x5d7450){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x3c5817,_0xd3bb('0xe2'));}this[_0xd3bb('0x11')]['setVariable'](_0x5d7450,_0x3a7856);}this['createSquareDetailsReport']['sync'](this,_0x3c5817,_0x3a7856);return _0x1364d2;};AGIVertices['prototype'][_0xd3bb('0xb3')]=function(_0x4b621e){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x164'),_0x4b621e['label']));return this[_0xd3bb('0x11')]['noop'](_0x4b621e[_0xd3bb('0x165')]||_0x4b621e[_0xd3bb('0x3b')]);};AGIVertices['prototype'][_0xd3bb('0x166')]=function(_0x3d9e31){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x167'),_0x3d9e31[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x3d9e31['findBy'])){return this[_0xd3bb('0x11')]['error'](_0x3d9e31,_0xd3bb('0x155'));}logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x3d9e31[_0xd3bb('0x154')]));var _0x59b8b7=this[_0xd3bb('0x60')][_0xd3bb('0x7d')](this,_0x3d9e31['pause_id']);var _0x58e779=this['agentPause'][_0xd3bb('0x7d')](this,_0x3d9e31[_0xd3bb('0x154')],_0x59b8b7);if(_0x58e779){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x156'),this[_0xd3bb('0x11')]['callerid'],_0x3d9e31['findBy']));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x156'),this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x3d9e31[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x157')};}else{logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x3d9e31['findBy']));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x3d9e31[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x158')};}};AGIVertices[_0xd3bb('0x18')]['playback']=function(_0x27a047){logger[_0xd3bb('0x32')](util['format'](_0xd3bb('0x168'),_0x27a047[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x27a047[_0xd3bb('0x111')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x27a047,_0xd3bb('0x112'));}var _0x8faf7d=this[_0xd3bb('0x22')][_0xd3bb('0x7d')](this,_0x27a047[_0xd3bb('0x111')]);if(!_0x8faf7d){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x27a047,_0xd3bb('0x162'));}var _0x217bc8=this[_0xd3bb('0x11')]['exec']('PLAYBACK',[_0x8faf7d,_0x27a047[_0xd3bb('0xee')]]);if(_0x217bc8[_0xd3bb('0xb5')]===-0x1){return _0x217bc8;}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('Executed\x20command\x20%s\x20%s',_0xd3bb('0x169'),_0x8faf7d));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x16a')]=function(_0x13bc9c){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x16b'),_0x13bc9c[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x13bc9c['queue_id'])){return this['channel'][_0xd3bb('0x30')](_0x13bc9c,_0xd3bb('0x16c'));}var _0x50fa52='';var _0x19de4c=parseInt(_0x13bc9c[_0xd3bb('0x16d')],0xa);if(isNaN(_0x19de4c)){_0x50fa52=_0x13bc9c[_0xd3bb('0x16d')];}else{_0x50fa52=this[_0xd3bb('0x19')]['sync'](this,_0x13bc9c[_0xd3bb('0x16d')]);if(!_0x50fa52){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x13bc9c,'no\x20queue\x20found');}}var _0x21b81d='';if(this[_0xd3bb('0x8f')](_0x13bc9c[_0xd3bb('0x111')])){var _0x4acb8b=this[_0xd3bb('0x22')][_0xd3bb('0x7d')](this,_0x13bc9c[_0xd3bb('0x111')]);if(_0x4acb8b){_0x21b81d=_0x4acb8b;}}this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0x13bc9c,_0x50fa52);if(_0x13bc9c[_0xd3bb('0xee')]['indexOf']('x')<0x0){_0x13bc9c[_0xd3bb('0xee')]+='x';}if(_0x13bc9c[_0xd3bb('0xee')][_0xd3bb('0x16e')]('X')<0x0){_0x13bc9c[_0xd3bb('0xee')]+='X';}this[_0xd3bb('0x11')]['setVariable']('XMCS-QUEUE',_0x50fa52?_0x50fa52['toLowerCase']():'');var _0x62a25c=this[_0xd3bb('0x11')][_0xd3bb('0x69')](_0xd3bb('0x16f'),[_0x50fa52,_0x13bc9c['opts'],_0x13bc9c[_0xd3bb('0x80')],_0x21b81d,_0x13bc9c[_0xd3bb('0x76')],_0x13bc9c[_0xd3bb('0x8')],_0x13bc9c[_0xd3bb('0x170')],_0x13bc9c[_0xd3bb('0x171')],'',_0x13bc9c[_0xd3bb('0x172')]]);if(_0x62a25c[_0xd3bb('0xb5')]===-0x1){return _0x62a25c;}return this[_0xd3bb('0x11')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xd3bb('0x16f'),_0x50fa52));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x173')]=function(_0x2e7242){logger[_0xd3bb('0x32')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2e7242[_0xd3bb('0x3b')]));var _0x49dce7=_0x2e7242[_0xd3bb('0x174')]||_0xd3bb('0x12a');var _0x97a398=util[_0xd3bb('0xa8')]('%s_%s',this[_0xd3bb('0x11')][_0xd3bb('0x3a')],rs[_0xd3bb('0x119')](0x5));var _0xa19531=util[_0xd3bb('0xa8')](_0xd3bb('0x175'),FILES_PATH,_0x97a398,_0x49dce7);var _0x4a0a07=util['format'](_0xd3bb('0x135'),FILES_PATH,_0x97a398);this['createSquareRecording'][_0xd3bb('0x7d')](this,_0x2e7242,_0x97a398,_0xa19531);this['channel'][_0xd3bb('0xaa')](_0xd3bb('0x176'),_0x97a398);logger[_0xd3bb('0x32')](_0xd3bb('0x177'),_0x4a0a07,_0x49dce7,_0x2e7242[_0xd3bb('0x178')],_0x2e7242[_0xd3bb('0x76')]);return this[_0xd3bb('0x11')][_0xd3bb('0x136')](_0x4a0a07,_0x49dce7,_0x2e7242[_0xd3bb('0x178')],_0x2e7242[_0xd3bb('0x76')],undefined,!![]);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x179')]=function(_0x128f36){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x17a'),_0x128f36[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x128f36[_0xd3bb('0x80')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x17b'));}var _0x23cebf=this[_0xd3bb('0x74')]['sync'](this,_0x128f36);logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x17c'),util[_0xd3bb('0x17d')](_0x23cebf,{'showHidden':![],'depth':null})));if(!this[_0xd3bb('0x8f')](_0x128f36[_0xd3bb('0xe1')])){return this['channel'][_0xd3bb('0xb3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x13dfde=this[_0xd3bb('0x13')][_0xd3bb('0x7d')](this,_0x128f36[_0xd3bb('0xe1')]);if(!_0x13dfde){return this['channel'][_0xd3bb('0x30')](_0x128f36,'no\x20variable\x20found');}this[_0xd3bb('0x11')][_0xd3bb('0xaa')](util['format'](_0xd3bb('0x17e'),_0x13dfde),_0x23cebf[_0xd3bb('0x84')]?_0x23cebf[_0xd3bb('0x84')]:'200');this[_0xd3bb('0x11')][_0xd3bb('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x13dfde),_0x23cebf[_0xd3bb('0x17f')]?_0x23cebf['statusMessage']:'OK');if(_0x23cebf['body']){try{this['saveRestApiResult'](_0x23cebf[_0xd3bb('0x7a')],_0x13dfde);}catch(_0x1bbf74){logger[_0xd3bb('0x30')](util[_0xd3bb('0xa8')](_0xd3bb('0x180'),_0x13dfde));}}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format'](_0xd3bb('0xe7'),_0x13dfde));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x181')]=function(_0x52726f){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x182'),_0x52726f[_0xd3bb('0x3b')]));return this['channel'][_0xd3bb('0x183')](_0x52726f['digits'][_0xd3bb('0x6a')](/\s+/g,''),_0x52726f['escape_digits']);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x184')]=function(_0x4bae8f){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x185'),_0x4bae8f[_0xd3bb('0x3b')]));return this[_0xd3bb('0x11')][_0xd3bb('0x186')](_0x4bae8f[_0xd3bb('0x187')][_0xd3bb('0x6a')](/\s+/g,''),_0x4bae8f[_0xd3bb('0x178')]);};AGIVertices[_0xd3bb('0x18')]['sayphonetic']=function(_0x391822){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x188'),_0x391822[_0xd3bb('0x3b')]));return this['channel'][_0xd3bb('0x189')](_0x391822['text'],_0x391822['escape_digits']);};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x18a')]=function(_0x242f21){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x18b'),_0x242f21['label']));if(!this[_0xd3bb('0x8f')](_0x242f21['account_id'])){return this[_0xd3bb('0x11')]['noop']('no\x20mail\x20account\x20configured');}var _0x1fe0ab=this['getMailAccount'][_0xd3bb('0x7d')](this,_0x242f21['account_id']);if(!_0x1fe0ab||!_0x1fe0ab[_0xd3bb('0x18c')]){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x242f21,'no\x20mail\x20account\x20found');}var _0x2834a7={'from':util[_0xd3bb('0xa8')]('\x22%s\x22\x20<%s>',_0x1fe0ab[_0xd3bb('0x1c')],_0x1fe0ab[_0xd3bb('0x18d')]||_0x1fe0ab[_0xd3bb('0x18c')][_0xd3bb('0x18e')]),'to':_0x242f21['to']||'','cc':_0x242f21['cc']||'','bcc':_0x242f21['bcc']||'','subject':_0x242f21['subject'],'html':_0x242f21[_0xd3bb('0x6d')],'text':_0x242f21[_0xd3bb('0x6d')]};var _0x52557e={'tls':{'rejectUnauthorized':![]}};if(_0x1fe0ab[_0xd3bb('0x18c')][_0xd3bb('0x18f')]){_0x52557e[_0xd3bb('0x18f')]=_0x1fe0ab['Smtp'][_0xd3bb('0x18f')];}else{_0x52557e[_0xd3bb('0x190')]=_0x1fe0ab[_0xd3bb('0x18c')][_0xd3bb('0x190')];_0x52557e['port']=_0x1fe0ab[_0xd3bb('0x18c')][_0xd3bb('0x191')];_0x52557e[_0xd3bb('0x192')]=_0x1fe0ab[_0xd3bb('0x18c')]['secure'];}if(_0x1fe0ab['Smtp'][_0xd3bb('0x193')]){_0x52557e[_0xd3bb('0x194')]={'user':_0x1fe0ab[_0xd3bb('0x18c')][_0xd3bb('0x18e')],'pass':_0x1fe0ab['Smtp']['pass']};}if(this[_0xd3bb('0x8f')](_0x242f21[_0xd3bb('0x195')])){}logger[_0xd3bb('0xe8')](_0xd3bb('0x196'),JSON['stringify'](_0x2834a7));this[_0xd3bb('0x39')]['sync'](this,_0x242f21,_0x242f21[_0xd3bb('0x197')]);this['channel'][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x198'),_0x1fe0ab[_0xd3bb('0x1c')]));this[_0xd3bb('0x27')]['sync'](this,_0x52557e,_0x2834a7);return this[_0xd3bb('0x11')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x199')]=function(_0x30780d){logger['info'](util['format'](_0xd3bb('0x19a'),_0x30780d['label']));return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0x19b'));};AGIVertices['prototype']['sendSMS']=function(_0x2def66){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2def66[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x2def66['sms_account_id'])){return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0x19c'));}var _0x1acab5=this[_0xd3bb('0x36')][_0xd3bb('0x7d')](this,_0x2def66[_0xd3bb('0x19d')]);if(!_0x1acab5){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x2def66,_0xd3bb('0x19e'));}var _0x12b7c9={'body':_0x2def66[_0xd3bb('0x19f')],'phone':_0x2def66['to']||'','SmsAccountId':_0x1acab5['id']};logger[_0xd3bb('0xe8')](_0xd3bb('0x1a0'),JSON[_0xd3bb('0x82')](_0x12b7c9));this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0x2def66,_0x2def66[_0xd3bb('0x19d')]);this['channel']['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0x1a1'),_0x1acab5[_0xd3bb('0x1c')]));this[_0xd3bb('0x38')][_0xd3bb('0x7d')](this,_0x12b7c9);return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0x1a2'));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x1a3')]=function(_0x4e8ee5){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4e8ee5[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x4e8ee5[_0xd3bb('0xe1')])){return this['channel'][_0xd3bb('0x30')](_0x4e8ee5,'no\x20variable\x20selected');}var _0x5176e6=this['getVariable'][_0xd3bb('0x7d')](this,_0x4e8ee5['variable_id']);if(!_0x5176e6){return this['channel'][_0xd3bb('0x30')](_0x4e8ee5,'no\x20variable\x20found');}return this[_0xd3bb('0x11')][_0xd3bb('0xaa')](_0x5176e6,_0x4e8ee5['variable_value']);};AGIVertices['prototype'][_0xd3bb('0x1a4')]=function(_0x59be24){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x1a5'),_0x59be24[_0xd3bb('0x3b')]));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x1a6'));if(_0x59be24[_0xd3bb('0xc1')]===_0xd3bb('0x1a7')){this[_0xd3bb('0x11')]['noop'](_0xd3bb('0x1a8'));return this['channel'][_0xd3bb('0xc1')]();}return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0x1a9'));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x1aa')]=function(_0x20a47e){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x20a47e['label']));if(!this['isConfigured'](_0x20a47e['project_id'])){return this['channel']['error'](_0x20a47e,'no\x20subproject\x20selected');}var _0x444311=this[_0xd3bb('0x1ab')]['sync'](this,_0x20a47e[_0xd3bb('0x1ac')]);if(!this[_0xd3bb('0x8f')](_0x444311)){return this[_0xd3bb('0x11')]['error'](_0x20a47e,util[_0xd3bb('0xa8')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x20a47e[_0xd3bb('0x1ac')]));}if(_0x444311===this[_0xd3bb('0x11')][_0xd3bb('0x3d')]){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x20a47e,_0xd3bb('0x1ad'));}this['createSquareDetailsReport']['sync'](this,_0x20a47e,_0x444311);var _0x2cf56c=this['channel']['exec'](_0xd3bb('0x1ae'),util[_0xd3bb('0xa8')](_0xd3bb('0x1af'),config['agi'][_0xd3bb('0x190')]||'127.0.0.1',_0x444311,this[_0xd3bb('0x11')][_0xd3bb('0x3d')]));if(_0x2cf56c[_0xd3bb('0xb5')]===-0x1){return _0x2cf56c;}return this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')]('Executed\x20command\x20%s\x20%s',_0xd3bb('0x1ae'),_0x444311));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x1b0')]=function(_0xb8a0d7){logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x1b1'),_0xb8a0d7[_0xd3bb('0x3b')]));var _0x199a5c=this[_0xd3bb('0x1b2')][_0xd3bb('0x7d')](this,_0xb8a0d7[_0xd3bb('0x1b3')]);this[_0xd3bb('0x39')][_0xd3bb('0x7d')](this,_0xb8a0d7,_0xb8a0d7[_0xd3bb('0x1b3')]);if(this[_0xd3bb('0x8f')](_0xb8a0d7[_0xd3bb('0xe1')])){var _0x5011ce=this[_0xd3bb('0x13')][_0xd3bb('0x7d')](this,_0xb8a0d7[_0xd3bb('0xe1')]);if(_0x5011ce){this[_0xd3bb('0x11')]['setVariable'](_0x5011ce,_0x199a5c);return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xb8a0d7[_0xd3bb('0x1b3')],_0x5011ce));}}return this[_0xd3bb('0x11')]['noop'](util[_0xd3bb('0xa8')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xb8a0d7[_0xd3bb('0x1b3')]));};AGIVertices['prototype'][_0xd3bb('0x1b4')]=function(_0x1a7f76){logger['info'](util['format'](_0xd3bb('0x1b5'),_0x1a7f76[_0xd3bb('0x3b')]));_0x1a7f76[_0xd3bb('0x6d')]=_0x1a7f76[_0xd3bb('0x6d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1a7f76[_0xd3bb('0x6c')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](_0xd3bb('0x1b6'));}if(!this[_0xd3bb('0x8f')](_0x1a7f76[_0xd3bb('0x6d')])){return this['channel'][_0xd3bb('0xb3')](_0xd3bb('0xcf'));}this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x1b7'),_0x1a7f76[_0xd3bb('0x6d')]));var _0x730703=this[_0xd3bb('0x6b')][_0xd3bb('0x7d')](this,_0x1a7f76);if(_0x730703){this['channel']['noop'](util[_0xd3bb('0xa8')](_0xd3bb('0x1b8'),_0x730703));var _0x32f95d=this[_0xd3bb('0x11')][_0xd3bb('0x104')](_0x730703);try{fs['unlink'](_0x730703+_0xd3bb('0x124'));}catch(_0x7e2f68){logger['error'](_0x7e2f68);}return _0x32f95d;}return this[_0xd3bb('0x11')]['error'](_0x1a7f76,_0xd3bb('0x1b9'));};AGIVertices['prototype'][_0xd3bb('0x1ba')]=function(_0x84671b){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x84671b['label']));_0x84671b[_0xd3bb('0x6d')]=_0x84671b[_0xd3bb('0x6d')][_0xd3bb('0x6a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd3bb('0x8f')](_0x84671b[_0xd3bb('0x6d')])){return this[_0xd3bb('0x11')][_0xd3bb('0xb3')]('no\x20text\x20configured');}this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x84671b[_0xd3bb('0x6d')]));var _0x3fc21f=this[_0xd3bb('0x73')][_0xd3bb('0x7d')](this,_0x84671b);if(_0x3fc21f){this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x1bb'),_0x3fc21f));var _0x1a66c9=this[_0xd3bb('0x11')][_0xd3bb('0x104')](_0x3fc21f);try{fs[_0xd3bb('0x105')](_0x3fc21f+_0xd3bb('0x124'));}catch(_0x232c5d){logger[_0xd3bb('0x30')](_0x232c5d);}return _0x1a66c9;}return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x84671b,_0xd3bb('0x1bc'));};AGIVertices['prototype'][_0xd3bb('0x1bd')]=function(_0x5857c5){logger['info'](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5857c5['label']));if(!this[_0xd3bb('0x8f')](_0x5857c5[_0xd3bb('0x154')])){return this['channel']['error'](_0x5857c5,_0xd3bb('0x155'));}logger['info'](util[_0xd3bb('0xa8')](_0xd3bb('0x15a'),this[_0xd3bb('0x11')]['callerid'],_0x5857c5[_0xd3bb('0x154')]));var _0x2dec6a=this[_0xd3bb('0x64')][_0xd3bb('0x7d')](this,_0x5857c5[_0xd3bb('0x154')]);if(_0x2dec6a){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x156'),this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x5857c5[_0xd3bb('0x154')]));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd3bb('0x11')][_0xd3bb('0x3e')],_0x5857c5[_0xd3bb('0x154')]));return{'code':0xc8,'result':_0xd3bb('0x157')};}else{logger['info'](util['format'](_0xd3bb('0x15b'),this['channel'][_0xd3bb('0x3e')],_0x5857c5[_0xd3bb('0x154')]));this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x15b'),this['channel'][_0xd3bb('0x3e')],_0x5857c5[_0xd3bb('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x3ca458){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3ca458[_0xd3bb('0x3b')]));var _0x2ceb1f=this[_0xd3bb('0x11')][_0xd3bb('0x69')]('VOICEMAIL',[_0x3ca458[_0xd3bb('0x1be')],_0x3ca458[_0xd3bb('0x87')]]);if(_0x2ceb1f[_0xd3bb('0xb5')]===-0x1){return _0x2ceb1f;}return this[_0xd3bb('0x11')][_0xd3bb('0xb3')](util[_0xd3bb('0xa8')](_0xd3bb('0x1bf'),_0xd3bb('0x1c0'),_0x3ca458[_0xd3bb('0x1be')]));};AGIVertices[_0xd3bb('0x18')][_0xd3bb('0x1c1')]=function(_0x41f6ed){logger[_0xd3bb('0x32')](util[_0xd3bb('0xa8')](_0xd3bb('0x1c2'),_0x41f6ed[_0xd3bb('0x3b')]));if(!this[_0xd3bb('0x8f')](_0x41f6ed[_0xd3bb('0xe1')])){return this[_0xd3bb('0x11')][_0xd3bb('0x30')](_0x41f6ed,_0xd3bb('0x1c3'));}var _0x3af4d0=this[_0xd3bb('0x13')][_0xd3bb('0x7d')](this,_0x41f6ed['variable_id']);if(!_0x3af4d0){return this[_0xd3bb('0x11')]['error'](_0x41f6ed,_0xd3bb('0xe2'));}var _0x446cda=this[_0xd3bb('0x11')][_0xd3bb('0x13')](_0x3af4d0);return{'code':0xc8,'result':_0x446cda[_0xd3bb('0xae')]?_0x446cda['extra']:'-'};};String[_0xd3bb('0x18')][_0xd3bb('0x1c4')]=function(_0x2111f0,_0x3e8c61){return this[_0xd3bb('0xac')](_0x2111f0)[_0xd3bb('0x1c5')](_0x3e8c61);};module[_0xd3bb('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a2801cf..a3b8d2e 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','queue','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid'];(function(_0x37542e,_0x3a9480){var _0x2e61c3=function(_0x20316b){while(--_0x20316b){_0x37542e['push'](_0x37542e['shift']());}};_0x2e61c3(++_0x3a9480);}(_0x2d17,0x17e));var _0x72d1=function(_0x4ed8aa,_0x2b57ec){_0x4ed8aa=_0x4ed8aa-0x0;var _0xf4987a=_0x2d17[_0x4ed8aa];return _0xf4987a;};'use strict';var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var moment=require('moment');var ami=require(_0x72d1('0x2'));var logger=require(_0x72d1('0x3'))('acw');var RpcUser=require(_0x72d1('0x4'));var RpcVoiceAgentReport=require(_0x72d1('0x5'));function Acw(_0x55b722){this[_0x72d1('0x6')]=_0x55b722['voiceQueues'];this[_0x72d1('0x7')]=_0x55b722['agents'];this[_0x72d1('0x8')]=_0x55b722[_0x72d1('0x8')];this['channels']={};ami['on'](_0x72d1('0x9'),this[_0x72d1('0xa')][_0x72d1('0xb')](this));ami['on']('hanguprequest',this[_0x72d1('0xc')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xd'),this['syncHangup'][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xe'),this[_0x72d1('0xf')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x10'),this[_0x72d1('0x11')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x12'),this[_0x72d1('0x13')][_0x72d1('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x72d1('0x14')][_0x72d1('0xb')](this));}function getDiff(_0x4c1038){var _0x115cd7=moment()[_0x72d1('0x15')](0x0);var _0x685a27=moment(_0x4c1038)[_0x72d1('0x15')](0x0);return _0x115cd7[_0x72d1('0x16')](_0x685a27,_0x72d1('0x17'));}Acw[_0x72d1('0x18')][_0x72d1('0x19')]=function(_0x23a238){try{var _0x8d458=this;var _0x491af4=this[_0x72d1('0x1a')][_0x23a238]['interface'];var _0x3885b2=this[_0x72d1('0x1a')][_0x23a238]['queue'];var _0x1061b7=this[_0x72d1('0x6')][_0x3885b2];var _0x1ca18d=![];var _0x49caf4='ACW';if(_0x1061b7[_0x72d1('0x1b')]){if(_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')]){_0x1ca18d=!![];_0x49caf4=_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')];}}ami[_0x72d1('0x1e')]({'action':_0x72d1('0x1f'),'interface':_0x491af4,'paused':!![],'reason':_0x49caf4})['then'](function(_0x1c695c){if(_0x8d458['agents'][_0x491af4]){return RpcUser['getAgent'](_0x8d458['agents'][_0x491af4]['id'])['then'](function(_0x445985){if(_0x445985&&!_0x445985[_0x72d1('0x20')]){logger['info'](_0x72d1('0x21'),_0x23a238,_0x491af4,_0x3885b2);var _0x256dc1=_0x8d458[_0x72d1('0x1a')][_0x23a238][_0x72d1('0x22')]&&_0x8d458[_0x72d1('0x1a')][_0x23a238]['destlinkedid']?_0x8d458['channels'][_0x23a238][_0x72d1('0x23')]:_0x23a238;return RpcUser[_0x72d1('0x24')](_0x8d458[_0x72d1('0x7')][_0x491af4],_0x49caf4,_0x256dc1)[_0x72d1('0x25')](function(_0xdf6a69){if(!_0x1ca18d){_0x8d458[_0x72d1('0x8')][_0x491af4]={};logger[_0x72d1('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23a238,_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);_0x8d458['timers'][_0x491af4][_0x72d1('0x28')]=setTimeout(_0x8d458[_0x72d1('0x29')][_0x72d1('0xb')](_0x8d458,_0x491af4),_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')]*0x3e8);_0x8d458['timers'][_0x491af4][_0x72d1('0x2a')]=moment()[_0x72d1('0x2b')](_0x72d1('0x2c'));_0x8d458[_0x72d1('0x8')][_0x491af4]['uniqueid']=_0x23a238;_0x8d458[_0x72d1('0x8')][_0x491af4]['queue']=_0x3885b2;_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2d')]=function(){var _0x5cec3f=getDiff(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2a')]);clearTimeout(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x28')]);_0x8d458[_0x72d1('0x8')][_0x491af4]['timer']=![];RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x5cec3f},_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2f')],_0x491af4)['then'](function(_0x244f4a){logger[_0x72d1('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x23a238,_0x5cec3f,_0x244f4a);})[_0x72d1('0x30')](function(_0x750de6){logger[_0x72d1('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x23a238,_0x750de6);});delete _0x8d458[_0x72d1('0x8')][_0x491af4];};}});}else{logger['info'](_0x72d1('0x32'),_0x23a238,_0x491af4,_0x3885b2);}});}})[_0x72d1('0x30')](function(_0x23418d){logger[_0x72d1('0x31')](_0x72d1('0x33'),_0x23a238,_0x8d458[_0x72d1('0x6')][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);})[_0x72d1('0x34')](function(){delete _0x8d458[_0x72d1('0x1a')][_0x23a238];});}catch(_0x24be04){logger[_0x72d1('0x31')]('[ACW][START]\x20%s',_0x24be04[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x29')]=function(_0x325209){try{var _0x49e074=this;if(_0x49e074[_0x72d1('0x8')][_0x325209]){_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x28')]=![];var _0x4fb07b=_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x2f')];var _0x163538=_0x49e074['timers'][_0x325209][_0x72d1('0x36')];var _0x117440=_0x49e074[_0x72d1('0x6')][_0x163538]['acwTimeout'];logger[_0x72d1('0x26')](_0x72d1('0x37'),_0x325209);RpcUser[_0x72d1('0x38')](this[_0x72d1('0x7')][_0x325209]);RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x117440,'agentacw':!![]},_0x4fb07b,_0x325209)[_0x72d1('0x25')](function(_0xd7ec0f){logger['info'](_0x72d1('0x39'),_0x4fb07b,_0x117440,_0xd7ec0f);})[_0x72d1('0x30')](function(_0x440ac5){logger[_0x72d1('0x31')](_0x72d1('0x3a'),_0x4fb07b,_0x440ac5);});}else{logger[_0x72d1('0x31')](_0x72d1('0x3b'),_0x325209);if(_0x49e074[_0x72d1('0x8')]){logger['info'](_0x72d1('0x3c'),JSON[_0x72d1('0x3d')](_0x49e074[_0x72d1('0x8')]));}}}catch(_0x1d6704){logger[_0x72d1('0x31')](_0x72d1('0x3e'),_0x1d6704[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')]['syncAgentConnect']=function(_0x563c5a){try{if(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]&&(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['acw']||this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['mandatoryDisposition'])){if(this[_0x72d1('0x7')][_0x563c5a['interface']]){this[_0x72d1('0x1a')][_0x563c5a[_0x72d1('0x2f')]]={'queue':_0x563c5a['queue'],'interface':_0x563c5a[_0x72d1('0x3f')],'destlinkedid':_0x563c5a['destlinkedid']};}}}catch(_0x527223){logger['error'](_0x72d1('0x40'),_0x527223['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x14')]=function(_0x28332b){try{if(this['voiceQueues'][_0x28332b['queue']]&&(this[_0x72d1('0x6')][_0x28332b['queue']]['acw']||this[_0x72d1('0x6')][_0x28332b[_0x72d1('0x36')]][_0x72d1('0x1b')])){if(this['agents'][_0x28332b['interface']]){this['channels'][_0x28332b['uniqueid']]={'queue':_0x28332b[_0x72d1('0x36')],'interface':_0x28332b[_0x72d1('0x3f')]};}}}catch(_0x197483){logger[_0x72d1('0x31')](_0x72d1('0x41'),_0x197483[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xc')]=function(_0x1e2c11){try{if(this['channels'][_0x1e2c11[_0x72d1('0x2f')]]&&_[_0x72d1('0x42')](this[_0x72d1('0x1a')][_0x1e2c11['uniqueid']][_0x72d1('0x22')])){logger[_0x72d1('0x26')](_0x72d1('0x43'),_0x1e2c11['uniqueid']);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x1e2c11[_0x72d1('0x44')]]&&_['isUndefined'](this['channels'][_0x1e2c11[_0x72d1('0x44')]][_0x72d1('0x22')])){logger[_0x72d1('0x26')]('[%s][HANGUP:LINKEDID]',_0x1e2c11[_0x72d1('0x44')]);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x44')]);}}catch(_0x463670){logger[_0x72d1('0x31')](_0x72d1('0x45'),_0x463670[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x46')]=function(_0x18f986){try{if(this[_0x72d1('0x1a')][_0x18f986['uniqueid']]&&this[_0x72d1('0x1a')][_0x18f986['uniqueid']]['attended']){logger[_0x72d1('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x18f986[_0x72d1('0x2f')]);this[_0x72d1('0x19')](_0x18f986[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]]&&this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]][_0x72d1('0x22')]){logger[_0x72d1('0x26')](_0x72d1('0x47'),_0x18f986[_0x72d1('0x44')]);this['startAcw'](_0x18f986[_0x72d1('0x44')]);}}catch(_0x3da39a){logger[_0x72d1('0x31')]('[ACW][syncHangup]\x20%s',_0x3da39a['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x11')]=function(_0x16e9e7){try{if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7['transfereeuniqueid']])){this[_0x72d1('0x19')](_0x16e9e7['transfereeuniqueid']);if(this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]]=this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];}}else if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]])){this[_0x72d1('0x19')](_0x16e9e7[_0x72d1('0x4a')]);if(this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4c')]]=this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]];}}}catch(_0xb05cd9){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xb05cd9[_0x72d1('0x35')]);}};Acw['prototype'][_0x72d1('0x13')]=function(_0x359176){try{if(this[_0x72d1('0x1a')][_0x359176[_0x72d1('0x4d')]]){logger[_0x72d1('0x26')](_0x72d1('0x4e'),JSON[_0x72d1('0x3d')](_0x359176[_0x72d1('0x4d')]));this[_0x72d1('0x19')](_0x359176['transfereruniqueid']);}else if(this['channels'][_0x359176[_0x72d1('0x4f')]]){logger[_0x72d1('0x26')](_0x72d1('0x50'),JSON['stringify'](_0x359176[_0x72d1('0x4f')]));this[_0x72d1('0x19')](_0x359176['transfererlinkedid']);}}catch(_0x39d7f9){logger[_0x72d1('0x31')](_0x72d1('0x51'),_0x39d7f9[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xf')]=function(_0x102574){try{if(this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]]&&this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]][_0x72d1('0x52')]==='all'){if(this['agents'][_0x102574[_0x72d1('0x3f')]]){logger[_0x72d1('0x26')](_0x72d1('0x53'),_0x102574[_0x72d1('0x2f')],_0x102574[_0x72d1('0x3f')],_0x102574[_0x72d1('0x36')]);return RpcUser[_0x72d1('0x24')](this[_0x72d1('0x7')][_0x102574['interface']],_0x72d1('0x54'),_0x102574['uniqueid']);}}}catch(_0x475016){logger[_0x72d1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x475016['message']);}};module[_0x72d1('0x55')]=Acw; \ No newline at end of file +var _0xee14=['diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','update','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds'];(function(_0x459ee0,_0x1e950d){var _0x1b87c8=function(_0x377855){while(--_0x377855){_0x459ee0['push'](_0x459ee0['shift']());}};_0x1b87c8(++_0x1e950d);}(_0xee14,0x13a));var _0x4ee1=function(_0x40a478,_0xf749c8){_0x40a478=_0x40a478-0x0;var _0x20dba6=_0xee14[_0x40a478];return _0x20dba6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4ee1('0x0'));var ami=require(_0x4ee1('0x1'));var logger=require(_0x4ee1('0x2'))(_0x4ee1('0x3'));var RpcUser=require(_0x4ee1('0x4'));var RpcVoiceAgentReport=require(_0x4ee1('0x5'));function Acw(_0x34a0ae){this[_0x4ee1('0x6')]=_0x34a0ae[_0x4ee1('0x6')];this['agents']=_0x34a0ae[_0x4ee1('0x7')];this['timers']=_0x34a0ae[_0x4ee1('0x8')];this[_0x4ee1('0x9')]={};ami['on'](_0x4ee1('0xa'),this[_0x4ee1('0xb')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xd'),this['syncHangupRequest'][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xe'),this['syncHangup'][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xf'),this[_0x4ee1('0x10')][_0x4ee1('0xc')](this));ami['on']('attendedtransfer',this[_0x4ee1('0x11')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0x12'),this[_0x4ee1('0x13')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0x14'),this['syncAgentConnectPreview'][_0x4ee1('0xc')](this));}function getDiff(_0x461f99){var _0x1096a5=moment()[_0x4ee1('0x15')](0x0);var _0x46d2c2=moment(_0x461f99)[_0x4ee1('0x15')](0x0);return _0x1096a5[_0x4ee1('0x16')](_0x46d2c2,_0x4ee1('0x17'));}Acw[_0x4ee1('0x18')]['startAcw']=function(_0x2f9194){try{var _0x38008f=this;var _0x34651b=this[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x19')];var _0x38fc33=this[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x1a')];var _0x360056=this[_0x4ee1('0x6')][_0x38fc33];var _0x274de5=![];var _0x5d76de=_0x4ee1('0x1b');if(_0x360056[_0x4ee1('0x1c')]){if(_0x360056[_0x4ee1('0x1d')][_0x4ee1('0x1e')]){_0x274de5=!![];_0x5d76de=_0x360056[_0x4ee1('0x1d')][_0x4ee1('0x1e')];}}ami['Action']({'action':_0x4ee1('0x1f'),'interface':_0x34651b,'paused':!![],'reason':_0x5d76de})[_0x4ee1('0x20')](function(_0x46611a){if(_0x38008f[_0x4ee1('0x7')][_0x34651b]){return RpcUser[_0x4ee1('0x21')](_0x38008f[_0x4ee1('0x7')][_0x34651b]['id'])[_0x4ee1('0x20')](function(_0x40fd98){if(_0x40fd98&&!_0x40fd98[_0x4ee1('0x22')]){logger[_0x4ee1('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2f9194,_0x34651b,_0x38fc33);var _0x53d43f=_0x38008f[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x24')]&&_0x38008f[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x25')]?_0x38008f[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x25')]:_0x2f9194;return RpcUser['savePause'](_0x38008f['agents'][_0x34651b],_0x5d76de,_0x53d43f)[_0x4ee1('0x20')](function(_0x28b7e1){if(!_0x274de5){_0x38008f['timers'][_0x34651b]={};logger[_0x4ee1('0x23')](_0x4ee1('0x26'),_0x2f9194,_0x38008f[_0x4ee1('0x6')][_0x38fc33][_0x4ee1('0x27')],_0x34651b,_0x38fc33);_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x28')]=setTimeout(_0x38008f[_0x4ee1('0x29')]['bind'](_0x38008f,_0x34651b),_0x38008f[_0x4ee1('0x6')][_0x38fc33]['acwTimeout']*0x3e8);_0x38008f[_0x4ee1('0x8')][_0x34651b]['lastPauseAt']=moment()[_0x4ee1('0x2a')](_0x4ee1('0x2b'));_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x2c')]=_0x2f9194;_0x38008f[_0x4ee1('0x8')][_0x34651b]['queue']=_0x38fc33;_0x38008f[_0x4ee1('0x8')][_0x34651b]['updateAcw']=function(){var _0x121301=getDiff(_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x2d')]);clearTimeout(_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x28')]);_0x38008f['timers'][_0x34651b][_0x4ee1('0x28')]=![];RpcVoiceAgentReport[_0x4ee1('0x2e')]({'acwtime':_0x121301},_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x2c')],_0x34651b)[_0x4ee1('0x20')](function(_0x393990){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2f9194,_0x121301,_0x393990);})[_0x4ee1('0x2f')](function(_0x54482b){logger[_0x4ee1('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x2f9194,_0x54482b);});delete _0x38008f[_0x4ee1('0x8')][_0x34651b];};}});}else{logger[_0x4ee1('0x23')](_0x4ee1('0x31'),_0x2f9194,_0x34651b,_0x38fc33);}});}})[_0x4ee1('0x2f')](function(_0x9f882d){logger[_0x4ee1('0x30')](_0x4ee1('0x26'),_0x2f9194,_0x38008f[_0x4ee1('0x6')][_0x38fc33][_0x4ee1('0x27')],_0x34651b,_0x38fc33);})[_0x4ee1('0x32')](function(){delete _0x38008f[_0x4ee1('0x9')][_0x2f9194];});}catch(_0x1f3371){logger[_0x4ee1('0x30')]('[ACW][START]\x20%s',_0x1f3371[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x29')]=function(_0x50539f){try{var _0x4858f9=this;if(_0x4858f9[_0x4ee1('0x8')][_0x50539f]){_0x4858f9[_0x4ee1('0x8')][_0x50539f][_0x4ee1('0x28')]=![];var _0x1f2b4b=_0x4858f9['timers'][_0x50539f][_0x4ee1('0x2c')];var _0x2ed16f=_0x4858f9[_0x4ee1('0x8')][_0x50539f][_0x4ee1('0x1a')];var _0x2653c4=_0x4858f9[_0x4ee1('0x6')][_0x2ed16f][_0x4ee1('0x27')];logger[_0x4ee1('0x23')]('[TIMER][STOP][AGENT:%s]',_0x50539f);RpcUser[_0x4ee1('0x34')](this[_0x4ee1('0x7')][_0x50539f]);RpcVoiceAgentReport[_0x4ee1('0x2e')]({'acwtime':_0x2653c4,'agentacw':!![]},_0x1f2b4b,_0x50539f)[_0x4ee1('0x20')](function(_0x45bb22){logger[_0x4ee1('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x1f2b4b,_0x2653c4,_0x45bb22);})[_0x4ee1('0x2f')](function(_0x37176a){logger[_0x4ee1('0x30')](_0x4ee1('0x35'),_0x1f2b4b,_0x37176a);});}else{logger[_0x4ee1('0x30')](_0x4ee1('0x36'),_0x50539f);if(_0x4858f9[_0x4ee1('0x8')]){logger[_0x4ee1('0x23')](_0x4ee1('0x37'),JSON[_0x4ee1('0x38')](_0x4858f9[_0x4ee1('0x8')]));}}}catch(_0x46bf93){logger[_0x4ee1('0x30')]('[ACW][STOP]\x20%s',_0x46bf93[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')]['syncAgentConnect']=function(_0x3c759f){try{if(this['voiceQueues'][_0x3c759f[_0x4ee1('0x1a')]]&&(this['voiceQueues'][_0x3c759f[_0x4ee1('0x1a')]][_0x4ee1('0x3')]||this['voiceQueues'][_0x3c759f[_0x4ee1('0x1a')]][_0x4ee1('0x1c')])){if(this[_0x4ee1('0x7')][_0x3c759f[_0x4ee1('0x19')]]){this['channels'][_0x3c759f[_0x4ee1('0x2c')]]={'queue':_0x3c759f[_0x4ee1('0x1a')],'interface':_0x3c759f[_0x4ee1('0x19')],'destlinkedid':_0x3c759f['destlinkedid']};}}}catch(_0x4fbe92){logger[_0x4ee1('0x30')](_0x4ee1('0x39'),_0x4fbe92[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x3a')]=function(_0x4ebcca){try{if(this['voiceQueues'][_0x4ebcca[_0x4ee1('0x1a')]]&&(this[_0x4ee1('0x6')][_0x4ebcca[_0x4ee1('0x1a')]][_0x4ee1('0x3')]||this['voiceQueues'][_0x4ebcca[_0x4ee1('0x1a')]][_0x4ee1('0x1c')])){if(this['agents'][_0x4ebcca[_0x4ee1('0x19')]]){this[_0x4ee1('0x9')][_0x4ebcca[_0x4ee1('0x2c')]]={'queue':_0x4ebcca[_0x4ee1('0x1a')],'interface':_0x4ebcca[_0x4ee1('0x19')]};}}}catch(_0x154ec0){logger[_0x4ee1('0x30')](_0x4ee1('0x3b'),_0x154ec0[_0x4ee1('0x33')]);}};Acw['prototype']['syncHangupRequest']=function(_0x1a972b){try{if(this[_0x4ee1('0x9')][_0x1a972b[_0x4ee1('0x2c')]]&&_[_0x4ee1('0x3c')](this['channels'][_0x1a972b[_0x4ee1('0x2c')]][_0x4ee1('0x24')])){logger[_0x4ee1('0x23')](_0x4ee1('0x3d'),_0x1a972b[_0x4ee1('0x2c')]);this['startAcw'](_0x1a972b[_0x4ee1('0x2c')]);}else if(this[_0x4ee1('0x9')][_0x1a972b[_0x4ee1('0x3e')]]&&_['isUndefined'](this[_0x4ee1('0x9')][_0x1a972b['linkedid']][_0x4ee1('0x24')])){logger['info'](_0x4ee1('0x3f'),_0x1a972b['linkedid']);this[_0x4ee1('0x40')](_0x1a972b['linkedid']);}}catch(_0x58919){logger[_0x4ee1('0x30')](_0x4ee1('0x41'),_0x58919['message']);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x42')]=function(_0xcdb873){try{if(this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x2c')]]&&this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x2c')]]['attended']){logger['info'](_0x4ee1('0x43'),_0xcdb873[_0x4ee1('0x2c')]);this[_0x4ee1('0x40')](_0xcdb873[_0x4ee1('0x2c')]);}else if(this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x3e')]]&&this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x3e')]][_0x4ee1('0x24')]){logger[_0x4ee1('0x23')](_0x4ee1('0x44'),_0xcdb873[_0x4ee1('0x3e')]);this[_0x4ee1('0x40')](_0xcdb873['linkedid']);}}catch(_0x1bafa8){logger['error'](_0x4ee1('0x45'),_0x1bafa8[_0x4ee1('0x33')]);}};Acw['prototype'][_0x4ee1('0x11')]=function(_0x184e36){try{if(!_['isNil'](this['channels'][_0x184e36[_0x4ee1('0x46')]])){this['startAcw'](_0x184e36[_0x4ee1('0x46')]);if(this[_0x4ee1('0x9')][_0x184e36['secondtransfereruniqueid']]){this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x47')]][_0x4ee1('0x24')]=!![];this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x48')]]=this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x47')]];delete this['channels'][_0x184e36['secondtransfereruniqueid']];}}else if(!_[_0x4ee1('0x49')](this[_0x4ee1('0x9')][_0x184e36['transfertargetuniqueid']])){this[_0x4ee1('0x40')](_0x184e36[_0x4ee1('0x48')]);if(this[_0x4ee1('0x9')][_0x184e36['origtransfereruniqueid']]){this[_0x4ee1('0x9')][_0x184e36['origtransfereruniqueid']][_0x4ee1('0x24')]=!![];this['channels'][_0x184e36['transfereeuniqueid']]=this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x4a')]];delete this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x4a')]];}}}catch(_0x38e889){logger['error'](_0x4ee1('0x4b'),_0x38e889[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')]['syncBlindTransfer']=function(_0x368e82){try{if(this[_0x4ee1('0x9')][_0x368e82[_0x4ee1('0x4c')]]){logger[_0x4ee1('0x23')](_0x4ee1('0x4d'),JSON[_0x4ee1('0x38')](_0x368e82[_0x4ee1('0x4c')]));this[_0x4ee1('0x40')](_0x368e82[_0x4ee1('0x4c')]);}else if(this[_0x4ee1('0x9')][_0x368e82[_0x4ee1('0x4e')]]){logger[_0x4ee1('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x4ee1('0x38')](_0x368e82['transfererlinkedid']));this[_0x4ee1('0x40')](_0x368e82['transfererlinkedid']);}}catch(_0x15834b){logger[_0x4ee1('0x30')](_0x4ee1('0x4f'),_0x15834b[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x10')]=function(_0x342aa1){try{if(this[_0x4ee1('0x6')][_0x342aa1[_0x4ee1('0x1a')]]&&this[_0x4ee1('0x6')][_0x342aa1[_0x4ee1('0x1a')]][_0x4ee1('0x50')]==='all'){if(this[_0x4ee1('0x7')][_0x342aa1[_0x4ee1('0x19')]]){logger[_0x4ee1('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x342aa1['uniqueid'],_0x342aa1[_0x4ee1('0x19')],_0x342aa1[_0x4ee1('0x1a')]);return RpcUser['savePause'](this[_0x4ee1('0x7')][_0x342aa1[_0x4ee1('0x19')]],_0x4ee1('0x51'),_0x342aa1[_0x4ee1('0x2c')]);}}}catch(_0x42240f){logger[_0x4ee1('0x30')](_0x4ee1('0x52'),_0x42240f[_0x4ee1('0x33')]);}};module[_0x4ee1('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 33590c7..d09cfac 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 _0xb961=['devicestatelist','sippeerstatus','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','exports','asterisk-manager','bluebird','moment','lodash','ami','../../config/environment','port','asterisk','password','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList'];(function(_0x3818c2,_0x341eae){var _0x7950d9=function(_0x4df6f0){while(--_0x4df6f0){_0x3818c2['push'](_0x3818c2['shift']());}};_0x7950d9(++_0x341eae);}(_0xb961,0x138));var _0x1b96=function(_0x182fa6,_0x3270a6){_0x182fa6=_0x182fa6-0x0;var _0x288dac=_0xb961[_0x182fa6];return _0x288dac;};'use strict';var Manager=require(_0x1b96('0x0'));var BPromise=require(_0x1b96('0x1'));var moment=require(_0x1b96('0x2'));var util=require('util');var _=require(_0x1b96('0x3'));var logger=require('../../config/logger')(_0x1b96('0x4'));var config=require(_0x1b96('0x5'));var ami=new Manager(config['asterisk'][_0x1b96('0x6')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')]['username'],config[_0x1b96('0x7')][_0x1b96('0x8')],!![]);ami[_0x1b96('0x9')]();ami[_0x1b96('0xa')]=BPromise['promisify'](ami[_0x1b96('0xb')]);function error(_0x2890a3){logger[_0x1b96('0xc')](util['format'](_0x1b96('0xd'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')][_0x1b96('0x6')],util[_0x1b96('0xf')](_0x2890a3,![],null)));}function close(){logger[_0x1b96('0xc')](util[_0x1b96('0x10')](_0x1b96('0x11'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')]['port']));}ami[_0x1b96('0x12')]=function(){return function(){return ami[_0x1b96('0xa')]({'action':_0x1b96('0x13')});};};ami[_0x1b96('0x14')]=function(){return function(){return ami[_0x1b96('0xa')]({'action':_0x1b96('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x1b96('0xa')]({'action':_0x1b96('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x1b96('0x17')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x1d8e02){logger[_0x1b96('0x18')](util[_0x1b96('0x10')](_0x1b96('0x19'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')]['port']));ami[_0x1b96('0x1a')](_0x1b96('0xc'),error);ami[_0x1b96('0x1a')](_0x1b96('0x1b'),close);}ami['on'](_0x1b96('0x1c'),connect);ami['on'](_0x1b96('0x1d'),function(_0x45acbe){logger[_0x1b96('0x18')](util[_0x1b96('0x10')](_0x1b96('0x1e'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config['asterisk']['port'],util[_0x1b96('0xf')](_0x45acbe,![],null)));});ami['on'](_0x1b96('0x1f'),function(_0x132a9a){logger[_0x1b96('0x18')](util[_0x1b96('0x10')](_0x1b96('0x20'),config['asterisk'][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')][_0x1b96('0x6')]));return BPromise[_0x1b96('0x21')]()[_0x1b96('0x22')](ami[_0x1b96('0x12')]())[_0x1b96('0x22')](ami[_0x1b96('0x14')]())[_0x1b96('0x22')](ami['actionSipPeerStatus']())['then'](ami[_0x1b96('0x23')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x3af94c){console['log'](_0x3af94c);});});ami[_0x1b96('0x1a')](_0x1b96('0xc'),error);ami[_0x1b96('0x1a')]('close',close);module[_0x1b96('0x24')]=ami; \ No newline at end of file +var _0x3790=['../../config/logger','ami','../../config/environment','asterisk','username','keepConnected','Action','promisify','action','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','format','once','error','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','close','exports','asterisk-manager','bluebird','moment','util','lodash'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x3790,0xb9));var _0x0379=function(_0x104312,_0x452bd6){_0x104312=_0x104312-0x0;var _0x56f0ba=_0x3790[_0x104312];return _0x56f0ba;};'use strict';var Manager=require(_0x0379('0x0'));var BPromise=require(_0x0379('0x1'));var moment=require(_0x0379('0x2'));var util=require(_0x0379('0x3'));var _=require(_0x0379('0x4'));var logger=require(_0x0379('0x5'))(_0x0379('0x6'));var config=require(_0x0379('0x7'));var ami=new Manager(config[_0x0379('0x8')]['port'],config[_0x0379('0x8')]['ip'],config[_0x0379('0x8')][_0x0379('0x9')],config[_0x0379('0x8')]['password'],!![]);ami[_0x0379('0xa')]();ami[_0x0379('0xb')]=BPromise[_0x0379('0xc')](ami[_0x0379('0xd')]);function error(_0x79a404){logger['error'](util['format'](_0x0379('0xe'),config[_0x0379('0x8')]['username'],config[_0x0379('0x8')]['ip'],config[_0x0379('0x8')][_0x0379('0xf')],util['inspect'](_0x79a404,![],null)));}function close(){logger['error'](util['format'](_0x0379('0x10'),config[_0x0379('0x8')][_0x0379('0x9')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0x0379('0x11')]=function(){return function(){return ami['Action']({'action':_0x0379('0x12')});};};ami[_0x0379('0x13')]=function(){return function(){return ami[_0x0379('0xb')]({'action':_0x0379('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x0379('0xb')]({'action':_0x0379('0x15')});};};ami[_0x0379('0x16')]=function(){return function(){return ami[_0x0379('0xb')]({'action':'queuesummary'});};};ami[_0x0379('0x17')]=function(){return function(){return ami[_0x0379('0xb')]({'action':_0x0379('0x18')});};};function connect(_0x258cf1){logger[_0x0379('0x19')](util[_0x0379('0x1a')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x0379('0x8')][_0x0379('0x9')],config[_0x0379('0x8')]['ip'],config[_0x0379('0x8')][_0x0379('0xf')]));ami[_0x0379('0x1b')](_0x0379('0x1c'),error);ami[_0x0379('0x1b')]('close',close);}ami['on']('connect',connect);ami['on'](_0x0379('0x1d'),function(_0x26d537){logger[_0x0379('0x19')](util['format'](_0x0379('0x1e'),config[_0x0379('0x8')]['username'],config[_0x0379('0x8')]['ip'],config[_0x0379('0x8')][_0x0379('0xf')],util[_0x0379('0x1f')](_0x26d537,![],null)));});ami['on'](_0x0379('0x20'),function(_0x293ad2){logger[_0x0379('0x19')](util[_0x0379('0x1a')](_0x0379('0x21'),config[_0x0379('0x8')][_0x0379('0x9')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x0379('0x22')]()[_0x0379('0x23')](ami[_0x0379('0x11')]())[_0x0379('0x23')](ami[_0x0379('0x13')]())['then'](ami['actionSipPeerStatus']())[_0x0379('0x23')](ami['actionQueueSummary']())[_0x0379('0x23')](ami[_0x0379('0x17')]())['catch'](function(_0x353024){console['log'](_0x353024);});});ami[_0x0379('0x1b')](_0x0379('0x1c'),error);ami[_0x0379('0x1b')](_0x0379('0x24'),close);module[_0x0379('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5ccfe94..ec1a1d1 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 _0x635e=['jayson/promise','bluebird','../../config/logger','client','http','debug','rpc','error','memberReport','message','result'];(function(_0x43d457,_0x1ab41a){var _0x5e24d5=function(_0x15b5bf){while(--_0x15b5bf){_0x43d457['push'](_0x43d457['shift']());}};_0x5e24d5(++_0x1ab41a);}(_0x635e,0x1d9));var _0xe635=function(_0x213996,_0x1f78aa){_0x213996=_0x213996-0x0;var _0x5c9ac2=_0x635e[_0x213996];return _0x5c9ac2;};'use strict';var jayson=require(_0xe635('0x0'));var BPromise=require(_0xe635('0x1'));var logger=require(_0xe635('0x2'))('ami');var client=jayson[_0xe635('0x3')][_0xe635('0x4')]({'port':0x2329});client['Request']=function(_0x349749,_0x4afc09){return new BPromise(function(_0xa70ab6,_0x42f510){return client['request'](_0x349749,_0x4afc09)['then'](function(_0x1fdcfa){logger[_0xe635('0x5')](_0xe635('0x6'),'memberReport',_0x349749,_0x4afc09,_0x1fdcfa);if(_0x1fdcfa[_0xe635('0x7')]){logger[_0xe635('0x7')](_0xe635('0x6'),_0xe635('0x8'),_0x349749,_0x1fdcfa[_0xe635('0x7')][_0xe635('0x9')],_0x4afc09);return _0x42f510(_0x1fdcfa[_0xe635('0x7')][_0xe635('0x9')]);}else{return _0xa70ab6(_0x1fdcfa[_0xe635('0xa')]);}})['catch'](function(_0xae951b){logger[_0xe635('0x7')](_0xe635('0x6'),_0xe635('0x8'),_0x349749,_0xae951b,_0x4afc09);return _0x42f510(_0xae951b);});});};module['exports']=client; \ No newline at end of file +var _0x9e42=['error','memberReport','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','http','Request','request','then','debug','rpc'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9e42,0x136));var _0x29e4=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0x9e42[_0x5302fb];return _0x43e6a4;};'use strict';var jayson=require(_0x29e4('0x0'));var BPromise=require('bluebird');var logger=require(_0x29e4('0x1'))(_0x29e4('0x2'));var client=jayson[_0x29e4('0x3')][_0x29e4('0x4')]({'port':0x2329});client[_0x29e4('0x5')]=function(_0x4c297d,_0x163195){return new BPromise(function(_0x3bba69,_0x48baa3){return client[_0x29e4('0x6')](_0x4c297d,_0x163195)[_0x29e4('0x7')](function(_0x2b5756){logger[_0x29e4('0x8')](_0x29e4('0x9'),'memberReport',_0x4c297d,_0x163195,_0x2b5756);if(_0x2b5756['error']){logger[_0x29e4('0xa')](_0x29e4('0x9'),_0x29e4('0xb'),_0x4c297d,_0x2b5756['error'][_0x29e4('0xc')],_0x163195);return _0x48baa3(_0x2b5756[_0x29e4('0xa')][_0x29e4('0xc')]);}else{return _0x3bba69(_0x2b5756[_0x29e4('0xd')]);}})[_0x29e4('0xe')](function(_0x49e18e){logger[_0x29e4('0xa')](_0x29e4('0x9'),'memberReport',_0x4c297d,_0x49e18e,_0x163195);return _0x48baa3(_0x49e18e);});});};module[_0x29e4('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9b0b961..f227ff1 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 _0x6a14=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a14,0x13c));var _0x46a1=function(_0x6b6b78,_0x1173dc){_0x6b6b78=_0x6b6b78-0x0;var _0x1d1fd7=_0x6a14[_0x6b6b78];return _0x1d1fd7;};'use strict';var util=require(_0x46a1('0x0'));var _=require(_0x46a1('0x1'));var moment=require(_0x46a1('0x2'));function checkNameSurname(_0x3cec1e,_0x3fe559,_0x5035aa){var _0x2430bb='';if(!_[_0x46a1('0x3')](_0x3fe559)&&_0x46a1('0x4')===typeof _0x3fe559){_0x2430bb+=_0x3fe559;}if(!_[_0x46a1('0x3')](_0x5035aa)&&_0x46a1('0x4')===typeof _0x5035aa){_0x2430bb+='\x20'+_0x5035aa;}if(_0x2430bb!==''){return _0x2430bb;}return _0x3cec1e;}function Action(_0x88c193,_0x5ab979,_0x4acc83){this[_0x46a1('0x5')]=_0x88c193;this[_0x46a1('0x6')]=_0x4acc83||undefined;this[_0x46a1('0x7')]=checkNameSurname(_0x5ab979[_0x46a1('0x8')][_0x46a1('0x9')],_0x5ab979[_0x46a1('0x8')][_0x46a1('0xa')],_0x5ab979[_0x46a1('0x8')][_0x46a1('0xb')]);this[_0x46a1('0xc')]=_0x5ab979['Contact'][_0x46a1('0x9')];this['queue']=_0x88c193[_0x46a1('0x7')];this[_0x46a1('0xd')]=_0x5ab979[_0x46a1('0xd')]||![];this['type']=_0x88c193[_0x46a1('0xe')];this['dialQueueTimeout']=_0x88c193[_0x46a1('0xf')]||0x3;this[_0x46a1('0x10')]=_0x5ab979[_0x46a1('0x10')];this[_0x46a1('0x11')]=_0x5ab979[_0x46a1('0x11')];this[_0x46a1('0x12')]=_0x5ab979[_0x46a1('0x12')];this[_0x46a1('0x13')]=_0x5ab979[_0x46a1('0x13')];this[_0x46a1('0x14')]=_0x5ab979[_0x46a1('0x14')];this[_0x46a1('0x15')]=_0x5ab979['countdropretry'];this[_0x46a1('0x16')]=_0x5ab979[_0x46a1('0x16')];this[_0x46a1('0x17')]=_0x5ab979[_0x46a1('0x17')];this['countagentrejectretry']=_0x5ab979[_0x46a1('0x18')];this[_0x46a1('0x19')]=_0x5ab979[_0x46a1('0x19')];this['ListId']=_0x5ab979[_0x46a1('0x1a')];this[_0x46a1('0x1b')]=_0x5ab979[_0x46a1('0x1b')];this['VoiceQueueId']=_0x5ab979[_0x46a1('0x1c')];this['CampaignId']=_0x5ab979['CampaignId'];this[_0x46a1('0x1d')]=_0x5ab979['id'];this[_0x46a1('0x1e')]=_0x5ab979[_0x46a1('0x8')][_0x46a1('0xa')]||'';this[_0x46a1('0x1f')]=moment()[_0x46a1('0x20')](_0x46a1('0x21'));this[_0x46a1('0x22')]=_0x5ab979['callback'];this[_0x46a1('0x23')]=_0x5ab979['callbackuniqueid'];this[_0x46a1('0x24')]=_0x5ab979[_0x46a1('0x24')];this[_0x46a1('0x25')]=_0x5ab979[_0x46a1('0x25')];this[_0x46a1('0x26')]='';this[_0x46a1('0x27')]='';}Action[_0x46a1('0x28')][_0x46a1('0x29')]=function(){return util[_0x46a1('0x20')](_0x46a1('0x2a'),this[_0x46a1('0x7')],this[_0x46a1('0x5')][_0x46a1('0x2b')]>0x0?this[_0x46a1('0xc')][_0x46a1('0x2c')](this[_0x46a1('0x5')][_0x46a1('0x2b')]):this[_0x46a1('0xc')]);};Action[_0x46a1('0x28')][_0x46a1('0x2d')]=function(){return this[_0x46a1('0x2e')];};module[_0x46a1('0x2f')]=Action; \ No newline at end of file +var _0x41c8=['ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x41c8,0x98));var _0x841c=function(_0x317738,_0x394239){_0x317738=_0x317738-0x0;var _0x1b3e89=_0x41c8[_0x317738];return _0x1b3e89;};'use strict';var util=require(_0x841c('0x0'));var _=require(_0x841c('0x1'));var moment=require('moment');function checkNameSurname(_0x7ad3de,_0x1d1820,_0x23ca55){var _0x2bca23='';if(!_[_0x841c('0x2')](_0x1d1820)&&_0x841c('0x3')===typeof _0x1d1820){_0x2bca23+=_0x1d1820;}if(!_[_0x841c('0x2')](_0x23ca55)&&_0x841c('0x3')===typeof _0x23ca55){_0x2bca23+='\x20'+_0x23ca55;}if(_0x2bca23!==''){return _0x2bca23;}return _0x7ad3de;}function Action(_0x31e757,_0xff70f,_0x3b7561){this[_0x841c('0x4')]=_0x31e757;this[_0x841c('0x5')]=_0x3b7561||undefined;this[_0x841c('0x6')]=checkNameSurname(_0xff70f['Contact'][_0x841c('0x7')],_0xff70f[_0x841c('0x8')][_0x841c('0x9')],_0xff70f[_0x841c('0x8')][_0x841c('0xa')]);this['number']=_0xff70f['Contact'][_0x841c('0x7')];this[_0x841c('0xb')]=_0x31e757['name'];this[_0x841c('0xc')]=_0xff70f[_0x841c('0xc')]||![];this[_0x841c('0xd')]=_0x31e757['type'];this['dialQueueTimeout']=_0x31e757['dialQueueTimeout']||0x3;this[_0x841c('0xe')]=_0xff70f[_0x841c('0xe')];this[_0x841c('0xf')]=_0xff70f[_0x841c('0xf')];this['countcongestionretry']=_0xff70f[_0x841c('0x10')];this[_0x841c('0x11')]=_0xff70f[_0x841c('0x11')];this[_0x841c('0x12')]=_0xff70f['countnosuchnumberretry'];this[_0x841c('0x13')]=_0xff70f[_0x841c('0x13')];this[_0x841c('0x14')]=_0xff70f[_0x841c('0x14')];this['countmachineretry']=_0xff70f[_0x841c('0x15')];this[_0x841c('0x16')]=_0xff70f[_0x841c('0x16')];this[_0x841c('0x17')]=_0xff70f[_0x841c('0x17')];this['ListId']=_0xff70f[_0x841c('0x18')];this[_0x841c('0x19')]=_0xff70f[_0x841c('0x19')];this['VoiceQueueId']=_0xff70f[_0x841c('0x1a')];this[_0x841c('0x1b')]=_0xff70f[_0x841c('0x1b')];this['idHopper']=_0xff70f['id'];this[_0x841c('0x1c')]=_0xff70f[_0x841c('0x8')][_0x841c('0x9')]||'';this[_0x841c('0x1d')]=moment()[_0x841c('0x1e')](_0x841c('0x1f'));this[_0x841c('0x20')]=_0xff70f[_0x841c('0x20')];this[_0x841c('0x21')]=_0xff70f[_0x841c('0x21')];this[_0x841c('0x22')]=_0xff70f[_0x841c('0x22')];this['recallme']=_0xff70f[_0x841c('0x23')];this[_0x841c('0x24')]='';this[_0x841c('0x25')]='';}Action[_0x841c('0x26')]['getCaller']=function(){return util['format'](_0x841c('0x27'),this[_0x841c('0x6')],this[_0x841c('0x4')][_0x841c('0x28')]>0x0?this[_0x841c('0x29')][_0x841c('0x2a')](this[_0x841c('0x4')]['dialCutDigit']):this[_0x841c('0x29')]);};Action[_0x841c('0x26')][_0x841c('0x2b')]=function(){return this[_0x841c('0xb')];};module[_0x841c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 50ab542..b293cea 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 _0xe9ea=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2b2426,_0xf90cc){var _0x5ec929=function(_0x347412){while(--_0x347412){_0x2b2426['push'](_0x2b2426['shift']());}};_0x5ec929(++_0xf90cc);}(_0xe9ea,0x151));var _0xae9e=function(_0xf67638,_0x2b75b6){_0xf67638=_0xf67638-0x0;var _0x23e03a=_0xe9ea[_0xf67638];return _0x23e03a;};'use strict';var util=require(_0xae9e('0x0'));var _=require('lodash');var moment=require(_0xae9e('0x1'));function getSeconds(_0x5202ca,_0x492ab4){var _0x2f5cd3=moment(_0x5202ca)[_0xae9e('0x2')](0x0);var _0x171491=moment(_0x492ab4)['milliseconds'](0x0);return _0x2f5cd3[_0xae9e('0x3')](_0x171491,_0xae9e('0x4'));}function AdditionalPhone(_0x546e73){this[_0xae9e('0x5')]=_0x546e73['uniqueid'];this[_0xae9e('0x6')]=_0x546e73['scheduledat']||undefined;this[_0xae9e('0x7')]=_0x546e73[_0xae9e('0x7')];this[_0xae9e('0x8')]=_0x546e73[_0xae9e('0x7')]===_0xae9e('0x9')?_0xae9e('0xa'):_0x546e73[_0xae9e('0x7')];this[_0xae9e('0xb')]=_0x546e73['countbusyretry'];this[_0xae9e('0xc')]=_0x546e73[_0xae9e('0xc')];this[_0xae9e('0xd')]=_0x546e73[_0xae9e('0xd')];this[_0xae9e('0xe')]=_0x546e73['countbusyretry']+_0x546e73[_0xae9e('0xc')]+_0x546e73[_0xae9e('0xd')]+_0x546e73[_0xae9e('0xf')]+_0x546e73[_0xae9e('0x10')]+_0x546e73[_0xae9e('0x11')]+_0x546e73[_0xae9e('0x12')]+_0x546e73['countagentrejectretry'];this[_0xae9e('0xf')]=_0x546e73[_0xae9e('0xf')];this[_0xae9e('0x10')]=_0x546e73[_0xae9e('0x10')];this[_0xae9e('0x11')]=_0x546e73['countabandonedretry'];this[_0xae9e('0x12')]=_0x546e73[_0xae9e('0x12')];this[_0xae9e('0x13')]=_0x546e73[_0xae9e('0x13')];this['queue']=_0x546e73['queue'];this[_0xae9e('0x14')]=_0x546e73[_0xae9e('0x15')];this[_0xae9e('0x16')]=_0x546e73['number'];this[_0xae9e('0x17')]=_0x546e73['starttime'];this[_0xae9e('0x18')]=_0x546e73['responsetime'];this['endtime']=_0x546e73['responsetime'];this[_0xae9e('0x19')]=getSeconds(_0x546e73[_0xae9e('0x18')],_0x546e73['starttime']);this[_0xae9e('0x1a')]=0x0;this['talktime']=0x0;this[_0xae9e('0x1b')]=_0x546e73[_0xae9e('0x1b')];this[_0xae9e('0x1c')]=_0x546e73[_0xae9e('0x1c')];this[_0xae9e('0x1d')]=_0x546e73[_0xae9e('0x1d')];this[_0xae9e('0x1e')]=_0x546e73[_0xae9e('0x1e')];this[_0xae9e('0x1f')]=_0x546e73[_0xae9e('0x1f')];this[_0xae9e('0x20')]=_0x546e73[_0xae9e('0x20')];this[_0xae9e('0x21')]=_0x546e73[_0xae9e('0x21')];this[_0xae9e('0x22')]=_0x546e73[_0xae9e('0x22')];this[_0xae9e('0x23')]=_0x546e73['CampaignId'];this[_0xae9e('0x24')]=_0x546e73[_0xae9e('0x24')]||'';this[_0xae9e('0x25')]=_0x546e73[_0xae9e('0x25')]||'';}module[_0xae9e('0x26')]=History; \ No newline at end of file +var _0x4a05=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0x4a05,0x192));var _0x54a0=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x4a05[_0x53f402];return _0x45a76d;};'use strict';var util=require('util');var _=require(_0x54a0('0x0'));var moment=require(_0x54a0('0x1'));function getSeconds(_0x188699,_0x33bff5){var _0x4fcc4b=moment(_0x188699)[_0x54a0('0x2')](0x0);var _0xf7f51e=moment(_0x33bff5)['milliseconds'](0x0);return _0x4fcc4b[_0x54a0('0x3')](_0xf7f51e,'seconds');}function AdditionalPhone(_0x390a97){this[_0x54a0('0x4')]=_0x390a97[_0x54a0('0x4')];this['scheduledat']=_0x390a97[_0x54a0('0x5')]||undefined;this[_0x54a0('0x6')]=_0x390a97['type'];this[_0x54a0('0x7')]=_0x390a97['type']===_0x54a0('0x8')?_0x54a0('0x9'):_0x390a97[_0x54a0('0x6')];this[_0x54a0('0xa')]=_0x390a97['countbusyretry'];this[_0x54a0('0xb')]=_0x390a97[_0x54a0('0xb')];this[_0x54a0('0xc')]=_0x390a97[_0x54a0('0xc')];this[_0x54a0('0xd')]=_0x390a97[_0x54a0('0xa')]+_0x390a97['countcongestionretry']+_0x390a97['countnoanswerretry']+_0x390a97[_0x54a0('0xe')]+_0x390a97[_0x54a0('0xf')]+_0x390a97['countabandonedretry']+_0x390a97[_0x54a0('0x10')]+_0x390a97[_0x54a0('0x11')];this[_0x54a0('0xe')]=_0x390a97['countnosuchnumberretry'];this[_0x54a0('0xf')]=_0x390a97['countdropretry'];this[_0x54a0('0x12')]=_0x390a97[_0x54a0('0x12')];this[_0x54a0('0x10')]=_0x390a97[_0x54a0('0x10')];this[_0x54a0('0x11')]=_0x390a97[_0x54a0('0x11')];this['queue']=_0x390a97['queue'];this['calleridname']=_0x390a97['name'];this['calleridnum']=_0x390a97[_0x54a0('0x13')];this[_0x54a0('0x14')]=_0x390a97[_0x54a0('0x14')];this['responsetime']=_0x390a97['responsetime'];this['endtime']=_0x390a97[_0x54a0('0x15')];this['ringtime']=getSeconds(_0x390a97[_0x54a0('0x15')],_0x390a97[_0x54a0('0x14')]);this[_0x54a0('0x16')]=0x0;this[_0x54a0('0x17')]=0x0;this[_0x54a0('0x18')]=_0x390a97[_0x54a0('0x18')];this[_0x54a0('0x19')]=_0x390a97['callbackuniqueid'];this[_0x54a0('0x1a')]=_0x390a97[_0x54a0('0x1a')];this[_0x54a0('0x1b')]=_0x390a97[_0x54a0('0x1b')];this['ContactId']=_0x390a97[_0x54a0('0x1c')];this[_0x54a0('0x1d')]=_0x390a97['ListId'];this[_0x54a0('0x1e')]=_0x390a97['UserId'];this[_0x54a0('0x1f')]=_0x390a97['VoiceQueueId'];this[_0x54a0('0x20')]=_0x390a97['CampaignId'];this[_0x54a0('0x21')]=_0x390a97[_0x54a0('0x21')]||'';this[_0x54a0('0x22')]=_0x390a97[_0x54a0('0x22')]||'';}module[_0x54a0('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 38ced04..4efa65e 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 _0xe76c=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe76c,0x6e));var _0xce76=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xe76c[_0x5c9307];return _0x373e29;};'use strict';var util=require('util');var _=require(_0xce76('0x0'));var moment=require('moment');function getSeconds(_0x147b7d,_0x6aebba){var _0x3674b3=moment(_0x147b7d)[_0xce76('0x1')](0x0);var _0x48dd7a=moment(_0x6aebba)[_0xce76('0x1')](0x0);return _0x3674b3[_0xce76('0x2')](_0x48dd7a,_0xce76('0x3'));}function AgentComplete(_0x335258,_0x40189a){this[_0xce76('0x4')]=0x4;this[_0xce76('0x5')]='Answer';this['scheduledat']=_0x335258[_0xce76('0x6')];this['type']=_0x335258[_0xce76('0x7')];this[_0xce76('0x8')]=_0x335258[_0xce76('0x7')]==='outbound'?_0xce76('0x9'):_0x335258['type'];this[_0xce76('0xa')]=_0x335258[_0xce76('0xa')];this[_0xce76('0xb')]=_0x335258[_0xce76('0xb')];this[_0xce76('0xc')]=_0x335258['countnoanswerretry'];this[_0xce76('0xd')]=_0x335258['countbusyretry']+_0x335258['countcongestionretry']+_0x335258[_0xce76('0xc')]+_0x335258[_0xce76('0xe')]+_0x335258[_0xce76('0xf')]+_0x335258[_0xce76('0x10')]+_0x335258[_0xce76('0x11')]+_0x335258[_0xce76('0x12')];this[_0xce76('0xe')]=_0x335258['countnosuchnumberretry'];this[_0xce76('0xf')]=_0x335258[_0xce76('0xf')];this['countabandonedretry']=_0x335258[_0xce76('0x10')];this['countmachineretry']=_0x335258[_0xce76('0x11')];this[_0xce76('0x12')]=_0x335258[_0xce76('0x12')];this[_0xce76('0x13')]=_0x40189a[_0xce76('0x13')];this[_0xce76('0x14')]=_0x335258[_0xce76('0x15')];this[_0xce76('0x16')]=_0x335258[_0xce76('0x17')];this[_0xce76('0x18')]=_0x335258[_0xce76('0x18')];this[_0xce76('0x19')]=_0x335258['responsetime'];this[_0xce76('0x1a')]=_0x335258[_0xce76('0x1a')];this[_0xce76('0x1b')]=moment()[_0xce76('0x1c')](_0xce76('0x1d'));this['ringtime']=getSeconds(_0x335258['responsetime'],_0x335258[_0xce76('0x18')]);this[_0xce76('0x1e')]=getSeconds(_0x335258[_0xce76('0x1a')],_0x335258['responsetime']);this[_0xce76('0x1f')]=getSeconds(this['endtime'],_0x335258[_0xce76('0x1a')]);this['queue']=_0x40189a[_0xce76('0x9')];this['membername']=_0x40189a[_0xce76('0x20')];this[_0xce76('0x21')]=_0x40189a[_0xce76('0x21')];this['callback']=_0x335258['callback'];this[_0xce76('0x22')]=_0x335258[_0xce76('0x22')];this[_0xce76('0x23')]=_0x335258[_0xce76('0x23')];this[_0xce76('0x24')]=_0x335258[_0xce76('0x24')];this[_0xce76('0x25')]=_0x335258['ContactId'];this[_0xce76('0x26')]=_0x335258['ListId'];this['UserId']=_0x335258[_0xce76('0x27')];this[_0xce76('0x28')]=_0x335258[_0xce76('0x28')];this[_0xce76('0x29')]=_0x335258[_0xce76('0x29')];this['originatecalleridnum']=_0x335258[_0xce76('0x2a')]||'';this[_0xce76('0x2b')]=_0x335258[_0xce76('0x2b')]||'';}module[_0xce76('0x2c')]=AgentComplete; \ No newline at end of file +var _0x3546=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x2ea3a6,_0x473be1){var _0x4fbdcb=function(_0x4a2e2c){while(--_0x4a2e2c){_0x2ea3a6['push'](_0x2ea3a6['shift']());}};_0x4fbdcb(++_0x473be1);}(_0x3546,0x198));var _0x6354=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x3546[_0x57975f];return _0x4793b8;};'use strict';var util=require(_0x6354('0x0'));var _=require(_0x6354('0x1'));var moment=require(_0x6354('0x2'));function getSeconds(_0x139f9a,_0x54e39a){var _0x58a659=moment(_0x139f9a)[_0x6354('0x3')](0x0);var _0x2b51fd=moment(_0x54e39a)[_0x6354('0x3')](0x0);return _0x58a659['diff'](_0x2b51fd,_0x6354('0x4'));}function AgentComplete(_0x4c36ad,_0x49a174){this['state']=0x4;this[_0x6354('0x5')]=_0x6354('0x6');this['scheduledat']=_0x4c36ad[_0x6354('0x7')];this[_0x6354('0x8')]=_0x4c36ad[_0x6354('0x8')];this[_0x6354('0x9')]=_0x4c36ad['type']===_0x6354('0xa')?_0x6354('0xb'):_0x4c36ad[_0x6354('0x8')];this[_0x6354('0xc')]=_0x4c36ad[_0x6354('0xc')];this[_0x6354('0xd')]=_0x4c36ad[_0x6354('0xd')];this[_0x6354('0xe')]=_0x4c36ad[_0x6354('0xe')];this['countglobal']=_0x4c36ad[_0x6354('0xc')]+_0x4c36ad['countcongestionretry']+_0x4c36ad[_0x6354('0xe')]+_0x4c36ad[_0x6354('0xf')]+_0x4c36ad[_0x6354('0x10')]+_0x4c36ad[_0x6354('0x11')]+_0x4c36ad[_0x6354('0x12')]+_0x4c36ad['countagentrejectretry'];this[_0x6354('0xf')]=_0x4c36ad[_0x6354('0xf')];this['countdropretry']=_0x4c36ad[_0x6354('0x10')];this[_0x6354('0x11')]=_0x4c36ad[_0x6354('0x11')];this[_0x6354('0x12')]=_0x4c36ad[_0x6354('0x12')];this[_0x6354('0x13')]=_0x4c36ad[_0x6354('0x13')];this[_0x6354('0x14')]=_0x49a174['uniqueid'];this['calleridname']=_0x4c36ad['name'];this[_0x6354('0x15')]=_0x4c36ad['number'];this[_0x6354('0x16')]=_0x4c36ad[_0x6354('0x16')];this['responsetime']=_0x4c36ad[_0x6354('0x17')];this[_0x6354('0x18')]=_0x4c36ad[_0x6354('0x18')];this['endtime']=moment()[_0x6354('0x19')](_0x6354('0x1a'));this[_0x6354('0x1b')]=getSeconds(_0x4c36ad[_0x6354('0x17')],_0x4c36ad[_0x6354('0x16')]);this[_0x6354('0x1c')]=getSeconds(_0x4c36ad['answertime'],_0x4c36ad['responsetime']);this[_0x6354('0x1d')]=getSeconds(this['endtime'],_0x4c36ad[_0x6354('0x18')]);this[_0x6354('0xb')]=_0x49a174[_0x6354('0xb')];this[_0x6354('0x1e')]=_0x49a174[_0x6354('0x1e')];this[_0x6354('0x1f')]=_0x49a174[_0x6354('0x1f')];this[_0x6354('0x20')]=_0x4c36ad[_0x6354('0x20')];this[_0x6354('0x21')]=_0x4c36ad['callbackuniqueid'];this[_0x6354('0x22')]=_0x4c36ad[_0x6354('0x22')];this[_0x6354('0x23')]=_0x4c36ad['recallme'];this[_0x6354('0x24')]=_0x4c36ad['ContactId'];this[_0x6354('0x25')]=_0x4c36ad['ListId'];this[_0x6354('0x26')]=_0x4c36ad['UserId'];this[_0x6354('0x27')]=_0x4c36ad[_0x6354('0x27')];this[_0x6354('0x28')]=_0x4c36ad[_0x6354('0x28')];this['originatecalleridnum']=_0x4c36ad['originatecalleridnum']||'';this['originatecalleridname']=_0x4c36ad['originatecalleridname']||'';}module[_0x6354('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 2bbb151..de6b83f 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 _0x06f3=['countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x12d925,_0x682297){var _0x433ab0=function(_0xba55b4){while(--_0xba55b4){_0x12d925['push'](_0x12d925['shift']());}};_0x433ab0(++_0x682297);}(_0x06f3,0x16c));var _0x306f=function(_0x391df0,_0x51b2dc){_0x391df0=_0x391df0-0x0;var _0x30bec6=_0x06f3[_0x391df0];return _0x30bec6;};'use strict';var util=require(_0x306f('0x0'));var _=require(_0x306f('0x1'));var moment=require(_0x306f('0x2'));function getSeconds(_0x205fde,_0x48dfab){var _0x2f53d7=moment(_0x205fde)['milliseconds'](0x0);var _0x56a9c0=moment(_0x48dfab)[_0x306f('0x3')](0x0);return _0x2f53d7['diff'](_0x56a9c0,'seconds');}function Final(_0x26706c){this[_0x306f('0x4')]=_0x26706c['uniqueid'];this[_0x306f('0x5')]=_0x26706c[_0x306f('0x5')];this[_0x306f('0x6')]=_0x26706c[_0x306f('0x6')];this[_0x306f('0x7')]=_0x26706c[_0x306f('0x6')]==='outbound'?_0x306f('0x8'):_0x26706c['type'];this[_0x306f('0x9')]=_0x26706c['countbusyretry'];this[_0x306f('0xa')]=_0x26706c[_0x306f('0xa')];this[_0x306f('0xb')]=_0x26706c[_0x306f('0xb')];this[_0x306f('0xc')]=_0x26706c[_0x306f('0x9')]+_0x26706c[_0x306f('0xa')]+_0x26706c[_0x306f('0xb')]+_0x26706c[_0x306f('0xd')]+_0x26706c[_0x306f('0xe')]+_0x26706c[_0x306f('0xf')]+_0x26706c[_0x306f('0x10')]+_0x26706c['countagentrejectretry'];this['countnosuchnumberretry']=_0x26706c[_0x306f('0xd')];this[_0x306f('0xe')]=_0x26706c[_0x306f('0xe')];this['countabandonedretry']=_0x26706c[_0x306f('0xf')];this[_0x306f('0x10')]=_0x26706c[_0x306f('0x10')];this[_0x306f('0x11')]=_0x26706c[_0x306f('0x11')];this[_0x306f('0x8')]=_0x26706c[_0x306f('0x8')];this[_0x306f('0x12')]=_0x26706c[_0x306f('0x12')];this[_0x306f('0x13')]=_0x26706c[_0x306f('0x13')];this['starttime']=_0x26706c[_0x306f('0x14')];this[_0x306f('0x15')]=_0x26706c[_0x306f('0x15')];this[_0x306f('0x16')]=_0x26706c[_0x306f('0x15')];this[_0x306f('0x17')]=_0x26706c[_0x306f('0x17')]||0x0;this[_0x306f('0x18')]=_0x26706c[_0x306f('0x18')]||0x0;this[_0x306f('0x19')]=_0x26706c[_0x306f('0x19')]||0x0;this['callback']=_0x26706c[_0x306f('0x1a')];this[_0x306f('0x1b')]=_0x26706c['callbackuniqueid'];this[_0x306f('0x1c')]=_0x26706c['callbackat'];this[_0x306f('0x1d')]=_0x26706c['recallme'];this['ContactId']=_0x26706c[_0x306f('0x1e')];this[_0x306f('0x1f')]=_0x26706c[_0x306f('0x1f')];this['UserId']=_0x26706c[_0x306f('0x20')];this[_0x306f('0x21')]=_0x26706c[_0x306f('0x21')];this[_0x306f('0x22')]=_0x26706c['CampaignId'];this['originatecalleridnum']=_0x26706c[_0x306f('0x23')]||'';this[_0x306f('0x24')]=_0x26706c['originatecalleridname']||'';}module[_0x306f('0x25')]=Final; \ No newline at end of file +var _0x5265=['countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x204dc6,_0xf19d46){var _0x24a5eb=function(_0x21d525){while(--_0x21d525){_0x204dc6['push'](_0x204dc6['shift']());}};_0x24a5eb(++_0xf19d46);}(_0x5265,0x65));var _0x5526=function(_0x49d825,_0x18649d){_0x49d825=_0x49d825-0x0;var _0x22ed3a=_0x5265[_0x49d825];return _0x22ed3a;};'use strict';var util=require(_0x5526('0x0'));var _=require(_0x5526('0x1'));var moment=require(_0x5526('0x2'));function getSeconds(_0x215d15,_0x29a032){var _0x38fac0=moment(_0x215d15)[_0x5526('0x3')](0x0);var _0x572359=moment(_0x29a032)[_0x5526('0x3')](0x0);return _0x38fac0[_0x5526('0x4')](_0x572359,'seconds');}function Final(_0x552682){this['uniqueid']=_0x552682['uniqueid'];this[_0x5526('0x5')]=_0x552682[_0x5526('0x5')];this['type']=_0x552682[_0x5526('0x6')];this[_0x5526('0x7')]=_0x552682[_0x5526('0x6')]===_0x5526('0x8')?_0x5526('0x9'):_0x552682[_0x5526('0x6')];this[_0x5526('0xa')]=_0x552682[_0x5526('0xa')];this[_0x5526('0xb')]=_0x552682[_0x5526('0xb')];this[_0x5526('0xc')]=_0x552682['countnoanswerretry'];this[_0x5526('0xd')]=_0x552682[_0x5526('0xa')]+_0x552682['countcongestionretry']+_0x552682[_0x5526('0xc')]+_0x552682['countnosuchnumberretry']+_0x552682['countdropretry']+_0x552682[_0x5526('0xe')]+_0x552682[_0x5526('0xf')]+_0x552682['countagentrejectretry'];this[_0x5526('0x10')]=_0x552682[_0x5526('0x10')];this[_0x5526('0x11')]=_0x552682[_0x5526('0x11')];this[_0x5526('0xe')]=_0x552682[_0x5526('0xe')];this[_0x5526('0xf')]=_0x552682[_0x5526('0xf')];this[_0x5526('0x12')]=_0x552682[_0x5526('0x12')];this['queue']=_0x552682['queue'];this[_0x5526('0x13')]=_0x552682[_0x5526('0x13')];this[_0x5526('0x14')]=_0x552682['calleridnum'];this['starttime']=_0x552682[_0x5526('0x15')];this['responsetime']=_0x552682[_0x5526('0x16')];this[_0x5526('0x17')]=_0x552682[_0x5526('0x16')];this[_0x5526('0x18')]=_0x552682[_0x5526('0x18')]||0x0;this['holdtime']=_0x552682[_0x5526('0x19')]||0x0;this[_0x5526('0x1a')]=_0x552682['talktime']||0x0;this[_0x5526('0x1b')]=_0x552682[_0x5526('0x1b')];this[_0x5526('0x1c')]=_0x552682[_0x5526('0x1c')];this[_0x5526('0x1d')]=_0x552682[_0x5526('0x1d')];this[_0x5526('0x1e')]=_0x552682[_0x5526('0x1e')];this[_0x5526('0x1f')]=_0x552682['ContactId'];this[_0x5526('0x20')]=_0x552682[_0x5526('0x20')];this['UserId']=_0x552682[_0x5526('0x21')];this[_0x5526('0x22')]=_0x552682[_0x5526('0x22')];this['CampaignId']=_0x552682['CampaignId'];this['originatecalleridnum']=_0x552682[_0x5526('0x23')]||'';this['originatecalleridname']=_0x552682[_0x5526('0x24')]||'';}module[_0x5526('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 7cc343d..16a77f4 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 _0xcf17=['membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','talktime'];(function(_0x1b7948,_0x29fee4){var _0x3fee06=function(_0x48fd97){while(--_0x48fd97){_0x1b7948['push'](_0x1b7948['shift']());}};_0x3fee06(++_0x29fee4);}(_0xcf17,0x199));var _0x7cf1=function(_0x4b847c,_0x277dc5){_0x4b847c=_0x4b847c-0x0;var _0x519b29=_0xcf17[_0x4b847c];return _0x519b29;};'use strict';var util=require('util');var _=require(_0x7cf1('0x0'));var moment=require(_0x7cf1('0x1'));function getSeconds(_0x33d60d,_0x5380cd){var _0x13dbfb=moment(_0x33d60d)[_0x7cf1('0x2')](0x0);var _0x2d74e1=moment(_0x5380cd)[_0x7cf1('0x2')](0x0);return _0x13dbfb[_0x7cf1('0x3')](_0x2d74e1,_0x7cf1('0x4'));}function Hangup(_0x1b6d4c,_0x32084e){this[_0x7cf1('0x5')]=0x4;this['statedesc']=_0x7cf1('0x6');this[_0x7cf1('0x7')]=_0x1b6d4c[_0x7cf1('0x7')];this['type']=_0x1b6d4c[_0x7cf1('0x8')];this[_0x7cf1('0x9')]=_0x1b6d4c['type']===_0x7cf1('0xa')?_0x7cf1('0xb'):_0x1b6d4c['type'];this[_0x7cf1('0xc')]=_0x1b6d4c['countbusyretry'];this[_0x7cf1('0xd')]=_0x1b6d4c[_0x7cf1('0xd')];this[_0x7cf1('0xe')]=_0x1b6d4c['countnoanswerretry'];this['countglobal']=_0x1b6d4c['countbusyretry']+_0x1b6d4c['countcongestionretry']+_0x1b6d4c['countnoanswerretry']+_0x1b6d4c[_0x7cf1('0xf')]+_0x1b6d4c[_0x7cf1('0x10')]+_0x1b6d4c['countabandonedretry']+_0x1b6d4c[_0x7cf1('0x11')]+_0x1b6d4c[_0x7cf1('0x12')];this[_0x7cf1('0xf')]=_0x1b6d4c[_0x7cf1('0xf')];this['countdropretry']=_0x1b6d4c[_0x7cf1('0x10')];this[_0x7cf1('0x13')]=_0x1b6d4c[_0x7cf1('0x13')];this[_0x7cf1('0x11')]=_0x1b6d4c[_0x7cf1('0x11')];this[_0x7cf1('0x12')]=_0x1b6d4c[_0x7cf1('0x12')];this['uniqueid']=_0x32084e[_0x7cf1('0x14')];this[_0x7cf1('0x15')]=_0x1b6d4c[_0x7cf1('0x16')];this[_0x7cf1('0x17')]=_0x1b6d4c[_0x7cf1('0x18')];this[_0x7cf1('0x19')]=_0x1b6d4c[_0x7cf1('0x19')];this[_0x7cf1('0x1a')]=_0x1b6d4c[_0x7cf1('0x1a')];this[_0x7cf1('0x1b')]=moment()[_0x7cf1('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7cf1('0x1d')]=getSeconds(_0x1b6d4c['responsetime'],_0x1b6d4c[_0x7cf1('0x19')]);this['holdtime']=0x0;this[_0x7cf1('0x1e')]=getSeconds(this['endtime'],_0x1b6d4c[_0x7cf1('0x1a')]);this[_0x7cf1('0xb')]=_0x1b6d4c[_0x7cf1('0xb')];this[_0x7cf1('0x1f')]='IVR';this[_0x7cf1('0x20')]=_0x32084e[_0x7cf1('0x21')];this['callback']=_0x1b6d4c[_0x7cf1('0x22')];this[_0x7cf1('0x23')]=_0x1b6d4c[_0x7cf1('0x23')];this[_0x7cf1('0x24')]=_0x1b6d4c[_0x7cf1('0x24')];this['recallme']=_0x1b6d4c[_0x7cf1('0x25')];this[_0x7cf1('0x26')]=_0x1b6d4c[_0x7cf1('0x26')];this[_0x7cf1('0x27')]=_0x1b6d4c[_0x7cf1('0x27')];this[_0x7cf1('0x28')]=_0x1b6d4c[_0x7cf1('0x28')];this[_0x7cf1('0x29')]=_0x1b6d4c['VoiceQueueId'];this[_0x7cf1('0x2a')]=_0x1b6d4c[_0x7cf1('0x2a')];}module[_0x7cf1('0x2b')]=Hangup; \ No newline at end of file +var _0x0e60=['countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0xdc7c2b,_0x5e7990){var _0x56de57=function(_0x86d75b){while(--_0x86d75b){_0xdc7c2b['push'](_0xdc7c2b['shift']());}};_0x56de57(++_0x5e7990);}(_0x0e60,0x74));var _0x00e6=function(_0x3a3f7e,_0x54a39e){_0x3a3f7e=_0x3a3f7e-0x0;var _0x27b3a0=_0x0e60[_0x3a3f7e];return _0x27b3a0;};'use strict';var util=require('util');var _=require(_0x00e6('0x0'));var moment=require(_0x00e6('0x1'));function getSeconds(_0x211621,_0xf6dc29){var _0xaf9498=moment(_0x211621)[_0x00e6('0x2')](0x0);var _0x457bd3=moment(_0xf6dc29)['milliseconds'](0x0);return _0xaf9498[_0x00e6('0x3')](_0x457bd3,_0x00e6('0x4'));}function Hangup(_0x2cb72a,_0x5d1e13){this[_0x00e6('0x5')]=0x4;this['statedesc']=_0x00e6('0x6');this[_0x00e6('0x7')]=_0x2cb72a[_0x00e6('0x7')];this[_0x00e6('0x8')]=_0x2cb72a[_0x00e6('0x8')];this[_0x00e6('0x9')]=_0x2cb72a['type']===_0x00e6('0xa')?'queue':_0x2cb72a['type'];this[_0x00e6('0xb')]=_0x2cb72a[_0x00e6('0xb')];this[_0x00e6('0xc')]=_0x2cb72a[_0x00e6('0xc')];this[_0x00e6('0xd')]=_0x2cb72a[_0x00e6('0xd')];this[_0x00e6('0xe')]=_0x2cb72a['countbusyretry']+_0x2cb72a[_0x00e6('0xc')]+_0x2cb72a['countnoanswerretry']+_0x2cb72a[_0x00e6('0xf')]+_0x2cb72a[_0x00e6('0x10')]+_0x2cb72a[_0x00e6('0x11')]+_0x2cb72a[_0x00e6('0x12')]+_0x2cb72a['countagentrejectretry'];this[_0x00e6('0xf')]=_0x2cb72a[_0x00e6('0xf')];this[_0x00e6('0x10')]=_0x2cb72a[_0x00e6('0x10')];this[_0x00e6('0x11')]=_0x2cb72a['countabandonedretry'];this[_0x00e6('0x12')]=_0x2cb72a['countmachineretry'];this[_0x00e6('0x13')]=_0x2cb72a[_0x00e6('0x13')];this[_0x00e6('0x14')]=_0x5d1e13['uniqueid'];this[_0x00e6('0x15')]=_0x2cb72a[_0x00e6('0x16')];this['calleridnum']=_0x2cb72a[_0x00e6('0x17')];this[_0x00e6('0x18')]=_0x2cb72a[_0x00e6('0x18')];this[_0x00e6('0x19')]=_0x2cb72a[_0x00e6('0x19')];this[_0x00e6('0x1a')]=moment()['format'](_0x00e6('0x1b'));this[_0x00e6('0x1c')]=getSeconds(_0x2cb72a['responsetime'],_0x2cb72a[_0x00e6('0x18')]);this[_0x00e6('0x1d')]=0x0;this[_0x00e6('0x1e')]=getSeconds(this[_0x00e6('0x1a')],_0x2cb72a[_0x00e6('0x19')]);this[_0x00e6('0x1f')]=_0x2cb72a['queue'];this[_0x00e6('0x20')]='IVR';this[_0x00e6('0x21')]=_0x5d1e13[_0x00e6('0x22')];this['callback']=_0x2cb72a[_0x00e6('0x23')];this[_0x00e6('0x24')]=_0x2cb72a[_0x00e6('0x24')];this[_0x00e6('0x25')]=_0x2cb72a[_0x00e6('0x25')];this['recallme']=_0x2cb72a[_0x00e6('0x26')];this[_0x00e6('0x27')]=_0x2cb72a['ContactId'];this[_0x00e6('0x28')]=_0x2cb72a['ListId'];this[_0x00e6('0x29')]=_0x2cb72a[_0x00e6('0x29')];this[_0x00e6('0x2a')]=_0x2cb72a[_0x00e6('0x2a')];this['CampaignId']=_0x2cb72a[_0x00e6('0x2b')];}module[_0x00e6('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index eafbb34..2fb4404 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 _0x63e1=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x25e522,_0x1f036b){var _0x3dd697=function(_0x2b3967){while(--_0x2b3967){_0x25e522['push'](_0x25e522['shift']());}};_0x3dd697(++_0x1f036b);}(_0x63e1,0x6d));var _0x163e=function(_0x487d00,_0x180f3a){_0x487d00=_0x487d00-0x0;var _0x38af42=_0x63e1[_0x487d00];return _0x38af42;};'use strict';var util=require(_0x163e('0x0'));var _=require(_0x163e('0x1'));var moment=require('moment');function getSeconds(_0x15ab4a,_0x454878){var _0x3c7542=moment(_0x15ab4a)['milliseconds'](0x0);var _0x101b55=moment(_0x454878)[_0x163e('0x2')](0x0);return _0x3c7542['diff'](_0x101b55,_0x163e('0x3'));}function History(_0x1ab2fa){this[_0x163e('0x4')]=_0x1ab2fa['uniqueid'];this[_0x163e('0x5')]=_0x1ab2fa[_0x163e('0x5')]||undefined;this['type']=_0x1ab2fa['type'];this[_0x163e('0x6')]=_0x1ab2fa['type']===_0x163e('0x7')?_0x163e('0x8'):_0x1ab2fa['type'];this[_0x163e('0x9')]=_0x1ab2fa['countbusyretry'];this[_0x163e('0xa')]=_0x1ab2fa[_0x163e('0xa')];this[_0x163e('0xb')]=_0x1ab2fa[_0x163e('0xb')];this['countglobal']=_0x1ab2fa[_0x163e('0x9')]+_0x1ab2fa[_0x163e('0xa')]+_0x1ab2fa[_0x163e('0xb')]+_0x1ab2fa[_0x163e('0xc')]+_0x1ab2fa['countdropretry']+_0x1ab2fa[_0x163e('0xd')]+_0x1ab2fa[_0x163e('0xe')]+_0x1ab2fa['countagentrejectretry'];this[_0x163e('0xc')]=_0x1ab2fa['countnosuchnumberretry'];this['countdropretry']=_0x1ab2fa['countdropretry'];this[_0x163e('0xd')]=_0x1ab2fa[_0x163e('0xd')];this[_0x163e('0xe')]=_0x1ab2fa[_0x163e('0xe')];this[_0x163e('0xf')]=_0x1ab2fa['countagentrejectretry'];this['queue']=_0x1ab2fa[_0x163e('0x8')];this[_0x163e('0x10')]=_0x1ab2fa[_0x163e('0x11')];this['calleridnum']=_0x1ab2fa[_0x163e('0x12')];this['starttime']=_0x1ab2fa[_0x163e('0x13')];this['responsetime']=_0x1ab2fa[_0x163e('0x14')];this['endtime']=_0x1ab2fa[_0x163e('0x14')];this['ringtime']=getSeconds(_0x1ab2fa[_0x163e('0x14')],_0x1ab2fa[_0x163e('0x13')]);this['holdtime']=0x0;this[_0x163e('0x15')]=0x0;this[_0x163e('0x16')]=_0x1ab2fa[_0x163e('0x16')];this[_0x163e('0x17')]=_0x1ab2fa['callbackuniqueid'];this[_0x163e('0x18')]=_0x1ab2fa[_0x163e('0x18')];this['recallme']=_0x1ab2fa[_0x163e('0x19')];this[_0x163e('0x1a')]=_0x1ab2fa[_0x163e('0x1a')];this['ListId']=_0x1ab2fa[_0x163e('0x1b')];this[_0x163e('0x1c')]=_0x1ab2fa[_0x163e('0x1c')];this[_0x163e('0x1d')]=_0x1ab2fa[_0x163e('0x1d')];this[_0x163e('0x1e')]=_0x1ab2fa[_0x163e('0x1e')];this[_0x163e('0x1f')]=_0x1ab2fa[_0x163e('0x1f')]||'';this['originatecalleridname']=_0x1ab2fa[_0x163e('0x20')]||'';}module[_0x163e('0x21')]=History; \ No newline at end of file +var _0xc69b=['lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xc69b,0x1d3));var _0xbc69=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xc69b[_0x56138f];return _0x1acaf7;};'use strict';var util=require(_0xbc69('0x0'));var _=require(_0xbc69('0x1'));var moment=require('moment');function getSeconds(_0x3f1ece,_0x13eb39){var _0x6cb786=moment(_0x3f1ece)[_0xbc69('0x2')](0x0);var _0x1dec2b=moment(_0x13eb39)[_0xbc69('0x2')](0x0);return _0x6cb786[_0xbc69('0x3')](_0x1dec2b,_0xbc69('0x4'));}function History(_0xbe53ea){this[_0xbc69('0x5')]=_0xbe53ea[_0xbc69('0x5')];this['scheduledat']=_0xbe53ea[_0xbc69('0x6')]||undefined;this[_0xbc69('0x7')]=_0xbe53ea[_0xbc69('0x7')];this[_0xbc69('0x8')]=_0xbe53ea['type']===_0xbc69('0x9')?_0xbc69('0xa'):_0xbe53ea[_0xbc69('0x7')];this['countbusyretry']=_0xbe53ea[_0xbc69('0xb')];this['countcongestionretry']=_0xbe53ea['countcongestionretry'];this[_0xbc69('0xc')]=_0xbe53ea['countnoanswerretry'];this[_0xbc69('0xd')]=_0xbe53ea[_0xbc69('0xb')]+_0xbe53ea['countcongestionretry']+_0xbe53ea[_0xbc69('0xc')]+_0xbe53ea[_0xbc69('0xe')]+_0xbe53ea[_0xbc69('0xf')]+_0xbe53ea[_0xbc69('0x10')]+_0xbe53ea[_0xbc69('0x11')]+_0xbe53ea[_0xbc69('0x12')];this[_0xbc69('0xe')]=_0xbe53ea[_0xbc69('0xe')];this[_0xbc69('0xf')]=_0xbe53ea[_0xbc69('0xf')];this['countabandonedretry']=_0xbe53ea[_0xbc69('0x10')];this[_0xbc69('0x11')]=_0xbe53ea[_0xbc69('0x11')];this[_0xbc69('0x12')]=_0xbe53ea[_0xbc69('0x12')];this['queue']=_0xbe53ea['queue'];this[_0xbc69('0x13')]=_0xbe53ea[_0xbc69('0x14')];this[_0xbc69('0x15')]=_0xbe53ea['number'];this['starttime']=_0xbe53ea[_0xbc69('0x16')];this[_0xbc69('0x17')]=_0xbe53ea[_0xbc69('0x17')];this[_0xbc69('0x18')]=_0xbe53ea[_0xbc69('0x17')];this[_0xbc69('0x19')]=getSeconds(_0xbe53ea[_0xbc69('0x17')],_0xbe53ea[_0xbc69('0x16')]);this['holdtime']=0x0;this[_0xbc69('0x1a')]=0x0;this[_0xbc69('0x1b')]=_0xbe53ea[_0xbc69('0x1b')];this[_0xbc69('0x1c')]=_0xbe53ea[_0xbc69('0x1c')];this['callbackat']=_0xbe53ea[_0xbc69('0x1d')];this[_0xbc69('0x1e')]=_0xbe53ea[_0xbc69('0x1e')];this[_0xbc69('0x1f')]=_0xbe53ea[_0xbc69('0x1f')];this['ListId']=_0xbe53ea[_0xbc69('0x20')];this[_0xbc69('0x21')]=_0xbe53ea[_0xbc69('0x21')];this[_0xbc69('0x22')]=_0xbe53ea['VoiceQueueId'];this[_0xbc69('0x23')]=_0xbe53ea[_0xbc69('0x23')];this[_0xbc69('0x24')]=_0xbe53ea[_0xbc69('0x24')]||'';this[_0xbc69('0x25')]=_0xbe53ea[_0xbc69('0x25')]||'';}module[_0xbc69('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index ca85f14..464c373 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 _0x1048=['NOT_ACTIVE','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','sequence','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','[countReScheduled]\x20','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','reachable','SIP/%s','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','state','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','stateGlobal','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','add','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','timezones','content','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','predictive','booked','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialPrefix','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','emit','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','dialPredictiveOptimizationPercentage','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','util','lodash','bluebird','uuid','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','name','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive'];(function(_0x4d5d6b,_0x1740ec){var _0x307c7f=function(_0x2fcf9e){while(--_0x2fcf9e){_0x4d5d6b['push'](_0x4d5d6b['shift']());}};_0x307c7f(++_0x1740ec);}(_0x1048,0x186));var _0x8104=function(_0x99d73b,_0x1b0bb5){_0x99d73b=_0x99d73b-0x0;var _0x1f3138=_0x1048[_0x99d73b];return _0x1f3138;};'use strict';var util=require(_0x8104('0x0'));var _=require(_0x8104('0x1'));var BPromise=require(_0x8104('0x2'));var uuid=require(_0x8104('0x3'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x8104('0x4'))('dialer');var loggerBooked=require(_0x8104('0x4'))('booked');var loggerPredictive=require(_0x8104('0x4'))('predictive');var loggerPredictiveCalls=require(_0x8104('0x4'))(_0x8104('0x5'));var loggerSyncQueueSummary=require(_0x8104('0x4'))(_0x8104('0x6'));var ami=require(_0x8104('0x7'));config[_0x8104('0x8')]=_['defaults'](config[_0x8104('0x8')],{'host':_0x8104('0x9'),'port':0x18eb});var io=require(_0x8104('0xa'))(new Redis(config[_0x8104('0x8')]));var cmHopper=require(_0x8104('0xb'));var cmHopperFinal=require(_0x8104('0xc'));var cmHopperHistory=require(_0x8104('0xd'));var cmHopperBlack=require(_0x8104('0xe'));var voiceQueueRt=require(_0x8104('0xf'));var Action=require(_0x8104('0x10'));var History=require(_0x8104('0x11'));var Final=require('./final');var AgentComplete=require(_0x8104('0x12'));var QueueCallerAbandon=require(_0x8104('0x13'));var Hangup=require(_0x8104('0x14'));var ipAgi=process[_0x8104('0x15')][_0x8104('0x16')]||_0x8104('0x17');var strategy={'rrmemory':_0x8104('0x18'),'roundrobin':_0x8104('0x19')};var Sequence=function(){};Sequence[_0x8104('0x1a')][_0x8104('0x1b')]=function(_0x3fb5f6){this['tail']=this['tail']?this[_0x8104('0x1c')][_0x8104('0x1d')](_0x3fb5f6):_0x3fb5f6();};function Dialer(_0x2dd7a8,_0x112ae2){this['sequence']=new Sequence();this[_0x8104('0x1e')]=_0x112ae2;this[_0x8104('0x1f')]=_0x2dd7a8['voiceQueues'];this[_0x8104('0x20')]=_0x2dd7a8[_0x8104('0x20')];this[_0x8104('0x21')]=_0x2dd7a8[_0x8104('0x21')];this[_0x8104('0x22')]=_0x2dd7a8[_0x8104('0x22')];this[_0x8104('0x23')]=config[_0x8104('0x23')]||0x2;this[_0x8104('0x24')]={};this['actions']={};this[_0x8104('0x25')]={};this[_0x8104('0x26')]={};this[_0x8104('0x27')]={};this[_0x8104('0x28')]={};this[_0x8104('0x29')]={};this[_0x8104('0x2a')]={};this[_0x8104('0x2b')]={};this[_0x8104('0x2c')]={};ami['on'](_0x8104('0x2d'),this[_0x8104('0x2e')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x30'),this['syncQueueCallerAbandon'][_0x8104('0x2f')](this));ami['on']('originateresponse',this[_0x8104('0x31')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x32'),this[_0x8104('0x33')][_0x8104('0x2f')](this));ami['on']('custom:queuesummary',this[_0x8104('0x6')]['bind'](this));ami['on'](_0x8104('0x34'),this[_0x8104('0x35')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x36'),this[_0x8104('0x37')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x38'),this[_0x8104('0x39')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x3a'),this['syncQueueMember']['bind'](this));ami['on'](_0x8104('0x3b'),this['syncQueueStatusComplete'][_0x8104('0x2f')](this));this[_0x8104('0x3c')]();this[_0x8104('0x3d')]();}function isNotNull(_0x21efa3){return _0x21efa3!==null&&!_[_0x8104('0x3e')](_0x21efa3);}function checkIsLoggedIn(_0x288720,_0x4d171b){return function(){if(_0x4d171b<=0x0){_0x288720['message']=_0x8104('0x3f');throw _0x288720['name']+_0x8104('0x40');}};}function isActive(_0x9986c2){return _0x9986c2;}function checkIsActive(_0x22096a,_0x31ddd4){return function(){if(!isActive(_0x31ddd4)){_0x22096a[_0x8104('0x41')]='NOT_ACTIVE';throw _0x22096a[_0x8104('0x42')]+_0x8104('0x43');}};}function checkInterval(_0x392650){return function(){if(!isNotNull(_0x392650[_0x8104('0x44')])){_0x392650[_0x8104('0x41')]='INTERVAL_IS_NULL';throw _0x392650[_0x8104('0x42')]+_0x8104('0x45');}if(!isNotNull(_0x392650[_0x8104('0x44')][_0x8104('0x46')])){_0x392650[_0x8104('0x41')]=_0x8104('0x47');throw _0x392650[_0x8104('0x42')]+_0x8104('0x45');}if(!isNotNull(_['isEmpty'](_0x392650[_0x8104('0x44')][_0x8104('0x46')]))){_0x392650[_0x8104('0x41')]=_0x8104('0x47');throw _0x392650['name']+_0x8104('0x45');}};}function msgResponse(_0x2844f7,_0x23c045,_0x51c7ee){return{'action':_0x2844f7,'response':_0x23c045,'message':_0x51c7ee,'stack':_0x51c7ee};}function myreject(_0x14a16e){return function(_0x2fecc8){return _0x14a16e(msgResponse(_0x8104('0x48'),_0x8104('0x49'),JSON[_0x8104('0x4a')](_0x2fecc8)));};}function getSeconds(_0x2d4d82,_0xf700fa){var _0x40f6b8=moment(_0x2d4d82)[_0x8104('0x4b')](0x0);var _0x5d4f7d=moment(_0xf700fa)['milliseconds'](0x0);return _0x40f6b8[_0x8104('0x4c')](_0x5d4f7d,_0x8104('0x4d'));}function emit(_0x4a63c1,_0x5d089f,_0x52341a){io['to'](_0x4a63c1)['emit'](_0x5d089f,_0x52341a);}function emitVoiceQueueSummary(_0x34136f){if(_0x34136f[_0x8104('0x4e')]===_0x8104('0x4f')){var _0x5ea16e={'id':_0x34136f['id'],'name':_0x34136f[_0x8104('0x42')],'strategy':_0x34136f[_0x8104('0x50')],'answered':_0x34136f['answered'],'available':_0x34136f[_0x8104('0x51')],'loggedIn':_0x34136f[_0x8104('0x52')],'pTalking':_0x34136f[_0x8104('0x53')],'sumBillable':_0x34136f[_0x8104('0x54')],'sumDuration':_0x34136f['sumDuration'],'sumHoldTime':_0x34136f[_0x8104('0x55')]||0x0,'talking':_0x34136f[_0x8104('0x56')],'total':_0x34136f[_0x8104('0x57')],'type':_0x34136f[_0x8104('0x4e')],'unmanaged':_0x34136f[_0x8104('0x58')],'abandoned':_0x34136f[_0x8104('0x59')],'waiting':_0x34136f[_0x8104('0x5a')],'loggedInDb':_0x34136f['loggedInDb'],'dialActive':_0x34136f[_0x8104('0x5b')],'dialMethod':_0x34136f[_0x8104('0x5c')],'dialOriginateCallerIdName':_0x34136f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x34136f[_0x8104('0x5d')],'dialOriginateTimeout':_0x34136f[_0x8104('0x5e')],'dialPrefix':_0x34136f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x34136f[_0x8104('0x5f')],'outboundAnswerCallsDay':_0x34136f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x34136f['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x34136f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x34136f[_0x8104('0x60')],'outboundDropCallsDayACS':_0x34136f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x34136f[_0x8104('0x61')],'outboundDropCallsDayTimeout':_0x34136f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x34136f[_0x8104('0x62')],'outboundNoSuchCallsDay':_0x34136f[_0x8104('0x63')],'outboundOriginateFailureCallsDay':_0x34136f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x34136f['outboundReCallsDay'],'outboundRejectCallsDay':_0x34136f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x34136f[_0x8104('0x64')],'predictiveIntervalAnsweredCalls':_0x34136f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x34136f[_0x8104('0x65')],'predictiveIntervalAvgTalktime':_0x34136f[_0x8104('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x34136f[_0x8104('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x34136f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x34136f[_0x8104('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x34136f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x34136f[_0x8104('0x69')],'predictiveIntervalMultiplicativeFactor':_0x34136f[_0x8104('0x6a')],'predictiveIntervalPauses':_0x34136f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x34136f[_0x8104('0x6b')],'predictiveIntervalTotalCalls':_0x34136f[_0x8104('0x6c')],'message':_0x34136f[_0x8104('0x41')],'originated':_0x34136f[_0x8104('0x6d')],'erlangCalls':_0x34136f[_0x8104('0x6e')],'erlangCallToSecond':_0x34136f[_0x8104('0x6f')],'erlangAbandonmentRate':_0x34136f['erlangAbandonmentRate'],'erlangBusyFactor':_0x34136f[_0x8104('0x70')],'startPredictive':_0x34136f['startPredictive'],'startProgressive':_0x34136f[_0x8104('0x29')]};if(_0x34136f[_0x8104('0x71')]){_0x5ea16e['Trunk']={'id':_0x34136f['Trunk']['id'],'name':_0x34136f[_0x8104('0x71')][_0x8104('0x42')],'active':_0x34136f['Trunk'][_0x8104('0x72')],'callerid':_0x34136f[_0x8104('0x71')][_0x8104('0x73')]};}if(_0x34136f[_0x8104('0x44')]){_0x5ea16e['Interval']={'id':_0x34136f[_0x8104('0x44')]['id'],'name':_0x34136f[_0x8104('0x44')][_0x8104('0x42')]};}var _0x333bfe=md5(JSON[_0x8104('0x4a')](_0x5ea16e));if(_0x34136f[_0x8104('0x74')]!==_0x333bfe){_0x34136f['md5']=_0x333bfe;emit(util[_0x8104('0x75')](_0x8104('0x76'),_0x5ea16e[_0x8104('0x42')]),_0x8104('0x77'),_0x5ea16e);}}}function emitCampaignSummary(_0x3ceb35){if(_0x3ceb35[_0x8104('0x4e')]==='ivr'){emit(util[_0x8104('0x75')](_0x8104('0x78'),_0x3ceb35[_0x8104('0x42')]),_0x8104('0x79'),_0x3ceb35);}}function checkGetDataPredictive(_0x281a48){if(isNotNull(_0x281a48)){if(!_[_0x8104('0x7a')](_0x281a48)){loggerPredictive['info'](_0x8104('0x7b'));loggerPredictive[_0x8104('0x7c')](_0x8104('0x7d'),_0x281a48['predictiveIntervalTotalCalls']);loggerPredictive[_0x8104('0x7c')](_0x8104('0x7e'),_0x281a48[_0x8104('0x7f')]);loggerPredictive['info'](_0x8104('0x80'),_0x281a48['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x8104('0x81'),_0x281a48['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x281a48[_0x8104('0x65')]);loggerPredictive[_0x8104('0x7c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x281a48['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8104('0x7c')](_0x8104('0x82'));if(_0x281a48[_0x8104('0x6c')]>0x0){if(!_[_0x8104('0x3e')](_0x281a48[_0x8104('0x66')])&&_0x281a48[_0x8104('0x66')]>0x0){return!![];}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x83'));}if(!_[_0x8104('0x3e')](_0x281a48[_0x8104('0x65')])&&_0x281a48['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x84'));}}else{loggerPredictive[_0x8104('0x7c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x85'));}}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x85'));}return![];}function mergeDataErlangB(_0x144590){return function(_0x26d173){loggerPredictive[_0x8104('0x7c')](_0x8104('0x86'));loggerPredictive[_0x8104('0x7c')](_0x8104('0x87'),_0x26d173[_0x8104('0x6e')]);loggerPredictive[_0x8104('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26d173[_0x8104('0x6f')]);loggerPredictive[_0x8104('0x7c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26d173[_0x8104('0x88')]);loggerPredictive['info'](_0x8104('0x89'),_0x26d173['erlangBusyFactor']);loggerPredictive[_0x8104('0x7c')](_0x8104('0x8a'),_0x26d173[_0x8104('0x88')]);loggerPredictive[_0x8104('0x7c')](_0x8104('0x82'));_[_0x8104('0x8b')](_0x144590,_0x26d173);};}function getDiff(_0x30d292){var _0x3e03e7=moment()['milliseconds'](0x0);var _0x41a44f=moment(_0x30d292)['milliseconds'](0x0);return _0x3e03e7[_0x8104('0x4c')](_0x41a44f,_0x8104('0x4d'));}function ifInterval(_0x489578,_0x1860ba){if(_[_0x8104('0x3e')](_0x1860ba)){return![];}if(getDiff(_0x1860ba)<_0x489578*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x185c80){if(isNotNull(_0x185c80)){if(!_[_0x8104('0x3e')](_0x185c80[_0x8104('0x29')])){_0x185c80[_0x8104('0x29')]=undefined;loggerPredictive[_0x8104('0x7c')](_0x185c80[_0x8104('0x42')],_0x8104('0x8c'));}if(!_['isUndefined'](_0x185c80[_0x8104('0x28')])){_0x185c80['startPredictive']=undefined;loggerPredictive[_0x8104('0x7c')](_0x185c80['name'],_0x8104('0x8d'));}if(!_[_0x8104('0x3e')](_0x185c80[_0x8104('0x8e')])){clearInterval(_0x185c80[_0x8104('0x8e')]);_0x185c80[_0x8104('0x8e')]=undefined;loggerPredictive[_0x8104('0x7c')](_0x185c80[_0x8104('0x42')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0xaf36b3,_0x4ee59f){if(_0x4ee59f===0x0){return 0x0;}var _0x4cd7d2=0x1;for(var _0x1be545=0x1;_0x1be545<=_0x4ee59f;_0x1be545+=0x1){_0x4cd7d2=0x1+_0x4cd7d2*_0x1be545/_0xaf36b3;}return 0x1/_0x4cd7d2;}function isVoiceQueueOutbound(_0x946217){return _0x946217===_0x8104('0x4f');}function isNotPreview(_0x3f2bb0){return _0x3f2bb0!==_0x8104('0x1e');}function isCampaignIvr(_0x233a8f){return _0x233a8f===_0x8104('0x8f');}function getCallerId(_0x15431d,_0x397bfd,_0x418ff0){if(!_['isUndefined'](_0x418ff0)&&_0x8104('0x90')===typeof _0x418ff0&&!_['isEmpty'](_0x418ff0)){if(!_[_0x8104('0x3e')](_0x397bfd)&&_0x8104('0x90')===typeof _0x397bfd&&!_[_0x8104('0x7a')](_0x397bfd)){return util[_0x8104('0x75')]('\x22%s\x22\x20<%s>',_0x397bfd,_0x418ff0);}return util[_0x8104('0x75')](_0x8104('0x91'),_0x418ff0,_0x418ff0);}if(!_[_0x8104('0x3e')](_0x15431d)&&_0x8104('0x90')===typeof _0x15431d&&!_[_0x8104('0x7a')](_0x15431d)){return _0x15431d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2fbb39,_0x949220){return function(_0x93876c){freeVariablesPredictive(_0x949220);emitVoiceQueueSummary(_0x949220);emitCampaignSummary(_0x949220);loggerSyncQueueSummary[_0x8104('0x92')](_0x2fbb39,util[_0x8104('0x93')](_0x93876c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3ed1d4,_0x3c5b47){return function(_0x27fe57){loggerPredictive[_0x8104('0x92')](_0x3c5b47[_0x8104('0x42')],_0x3ed1d4);loggerPredictive[_0x8104('0x92')](_0x27fe57[_0x8104('0x94')]);freeVariablesPredictive(_0x3c5b47);};}function loggerCatch(_0x58e84a){return function(_0x451f12){logger[_0x8104('0x92')](_0x58e84a,util['inspect'](_0x451f12,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4539a7){return _0x4539a7&&!_[_0x8104('0x3e')](_0x4539a7)&&_0x4539a7[_0x8104('0x95')]>0x0;}function decremetOriginate(_0xdbd8e8){if(!_['isUndefined'](_0xdbd8e8)&&_0xdbd8e8!==null){if(_0xdbd8e8[_0x8104('0x96')](_0x8104('0x6d'))){if(_0xdbd8e8['originated']>0x0){_0xdbd8e8[_0x8104('0x6d')]-=0x1;}else{logger[_0x8104('0x92')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8104('0x92')](_0x8104('0x97'));}}function checkContactLowerLimitOriginate(_0x15ce0b,_0x18bb88,_0x1adb9d){if(_0x18bb88>_0x1adb9d){for(var _0x26a7ae=0x0;_0x26a7ae<_0x18bb88-_0x1adb9d;_0x26a7ae+=0x1){decremetOriginate(_0x15ce0b);}}}function loggerGetContactDialer(_0x12307f,_0x4fd010,_0x40c003){return function(_0x4c8b82){checkContactLowerLimitOriginate(_0x4fd010,_0x40c003,0x0);logger[_0x8104('0x92')](_0x12307f,util[_0x8104('0x93')](_0x4c8b82,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x196b4){return function(_0x4cec95){if(isNotNull(_0x4cec95)&&isNotNull(_0x4cec95[0x0])){if(_0x4cec95[0x0][_0x8104('0x98')]>0x0){_0x196b4[_0x8104('0x41')]=_0x8104('0x99');logger[_0x8104('0x7c')](_0x8104('0x9a')+_0x196b4[_0x8104('0x42')],_0x4cec95[0x0][_0x8104('0x98')],_0x8104('0x9b'));}else{_0x196b4[_0x8104('0x41')]=_0x8104('0x9c');logger['info'](_0x8104('0x9d')+_0x196b4[_0x8104('0x42')]);}}};}function notSendMessagesQueue(_0x4a8171){if(_0x4a8171['sendMessageOneNotActive']){freeVariablesPredictive(_0x4a8171);if(_0x4a8171['originated']===0x0&&_0x4a8171[_0x8104('0x56')]===0x0&&_0x4a8171[_0x8104('0x5a')]===0x0&&(_0x4a8171[_0x8104('0x53')]||0x0)===0x0){_0x4a8171[_0x8104('0x9e')]=![];_0x4a8171['available']=0x0;_0x4a8171[_0x8104('0x41')]=_0x8104('0x9f');loggerSyncQueueSummary[_0x8104('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4a8171[_0x8104('0x42')],_0x8104('0xa0'));}else{_0x4a8171[_0x8104('0x41')]=_0x8104('0xa1');loggerSyncQueueSummary[_0x8104('0x92')](_0x8104('0xa2'),_0x4a8171[_0x8104('0x42')],_0x8104('0xa3'));}emitVoiceQueueSummary(_0x4a8171);}}function notSendMessagesCampaign(_0x108c69){if(_0x108c69[_0x8104('0x9e')]){if(_0x108c69[_0x8104('0x6d')]===0x0){_0x108c69[_0x8104('0x9e')]=![];_0x108c69[_0x8104('0x41')]=_0x8104('0x9f');loggerSyncQueueSummary['error'](_0x8104('0xa4'),_0x108c69['name'],'is\x20not\x20active');}else{_0x108c69[_0x8104('0x41')]=_0x8104('0xa1');loggerSyncQueueSummary[_0x8104('0x92')](_0x8104('0xa4'),_0x108c69['name'],'is\x20disactive');}emitCampaignSummary(_0x108c69);}}function createObjHistory(_0x3e488d,_0x348d40,_0x34d37c,_0x3eec60,_0x26e693){_0x3e488d[_0x8104('0x41')]=_0x34d37c;var _0x252fbe=new Action(_0x3e488d,_0x348d40);var _0x2aceb5=new History(_0x252fbe);_0x2aceb5['state']=_0x3eec60;_0x2aceb5[_0x8104('0xa5')]=_0x26e693;_0x2aceb5[_0x8104('0xa6')]=_0x252fbe[_0x8104('0xa7')];return _0x2aceb5;}Dialer[_0x8104('0x1a')][_0x8104('0x3d')]=function(){var _0xd6d28b=this;setInterval(function(){_0xd6d28b[_0x8104('0xa8')](_0xd6d28b[_0x8104('0x26')],_0x8104('0xa9'));_0xd6d28b['clearZombieChannels'](_0xd6d28b[_0x8104('0xaa')],'[actions]');},0x32c8);};Dialer[_0x8104('0x1a')][_0x8104('0xa8')]=function(_0x97113d,_0x5bd2e2){var _0x18e6f4=this;for(var _0x50ba49 in _0x97113d){if(_0x97113d[_0x8104('0x96')](_0x50ba49)){this[_0x8104('0xab')][_0x8104('0x1b')](function(){if(!_[_0x8104('0xac')](_0x97113d[_0x50ba49])){return ami[_0x8104('0xad')]({'action':_0x8104('0xae'),'channel':_0x97113d[_0x50ba49][_0x8104('0xaf')]})['catch'](function(_0x4c78cd){if(_0x4c78cd['message']===_0x8104('0xb0')){setTimeout(function(){if(_0x97113d[_0x50ba49]&&_0x97113d[_0x50ba49][_0x8104('0x4e')]!==_0x8104('0x8f')){_0x18e6f4[_0x8104('0xb1')](_0x18e6f4[_0x8104('0x1f')][_0x97113d[_0x50ba49][_0x8104('0xb2')]]);logger[_0x8104('0x92')](_0x8104('0xb3'),_0x5bd2e2,_0x50ba49,_0x97113d[_0x50ba49]['queue']);delete _0x97113d[_0x50ba49];}if(_0x97113d[_0x50ba49]&&_0x97113d[_0x50ba49]['type']===_0x8104('0x8f')){_0x18e6f4[_0x8104('0xb1')](_0x18e6f4[_0x8104('0x20')][_0x97113d[_0x50ba49][_0x8104('0xb2')]]);logger[_0x8104('0x92')](_0x8104('0xb4'),_0x5bd2e2,_0x50ba49,_0x97113d[_0x50ba49][_0x8104('0xb2')]);delete _0x97113d[_0x50ba49];}},0x2328);}});}});}}};Dialer['prototype'][_0x8104('0xb5')]=function(_0x221b33){return BPromise['resolve']()[_0x8104('0xb6')](cmHopper['countReScheduled'](_0x221b33))[_0x8104('0xb7')](loggerCatch(_0x8104('0xb8')));};Dialer[_0x8104('0x1a')][_0x8104('0xb9')]=function(_0x571143){return BPromise[_0x8104('0xba')]()['then'](cmHopperBlack[_0x8104('0xb9')](_0x571143))[_0x8104('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x8104('0xbb')]=function(_0x997609){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopperBlack[_0x8104('0xbb')](_0x997609))[_0x8104('0xb7')](loggerCatch(_0x8104('0xbc')));};Dialer[_0x8104('0x1a')]['averageHandleTime']=function(_0x55da38){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopperHistory[_0x8104('0xbd')](_0x55da38))[_0x8104('0xb7')](loggerCatch(_0x8104('0xbe')));};Dialer[_0x8104('0x1a')][_0x8104('0xbf')]=function(_0x146460){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper[_0x8104('0xbf')](_0x146460))['catch'](loggerCatch(_0x8104('0xc0')));};Dialer[_0x8104('0x1a')]['unlockContact']=function(_0x41010a,_0x1d5bfa,_0x3e28da){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper[_0x8104('0xc1')](_0x41010a,_0x1d5bfa,_0x3e28da))['catch'](loggerCatch(_0x8104('0xc2')));};Dialer[_0x8104('0x1a')][_0x8104('0xc3')]=function(_0x5b4622,_0x37f40c,_0x1a2016,_0x4ca9d1){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper['getContactDialer'](_0x5b4622,_0x37f40c,_0x1a2016,_0x4ca9d1))[_0x8104('0xb7')](loggerCatch(_0x8104('0xc4')));};Dialer['prototype']['getContactDialerIvr']=function(_0x4ac4a1,_0x2a91bb,_0x161d6b){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper['getContactDialerIvr'](_0x4ac4a1,_0x2a91bb,_0x161d6b))[_0x8104('0xb7')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0x8104('0xc5')]=function(_0x5ce8d6){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5ce8d6))[_0x8104('0xb7')](loggerCatch(_0x8104('0xc6')));};Dialer[_0x8104('0x1a')][_0x8104('0xc7')]=function(_0x8e7d77){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper[_0x8104('0xc7')](_0x8e7d77))[_0x8104('0xb7')](loggerCatch(_0x8104('0xc8')));};Dialer['prototype']['createHistory']=function(_0x14b431){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopperHistory[_0x8104('0xc9')](_0x14b431))[_0x8104('0xb7')](loggerCatch(_0x8104('0xca')));};Dialer[_0x8104('0x1a')][_0x8104('0xb1')]=function(_0x569c3d){if(!_[_0x8104('0x3e')](_0x569c3d)&&_0x569c3d!==null){if(_0x569c3d[_0x8104('0x96')](_0x8104('0x6d'))){if(_0x569c3d[_0x8104('0x6d')]>0x0){_0x569c3d['originated']-=0x1;}else{logger[_0x8104('0x92')](_0x8104('0xcb'));}}}else{logger[_0x8104('0x92')](_0x8104('0xcc'));}};Dialer[_0x8104('0x1a')][_0x8104('0xcd')]=function(_0x5988b2,_0x1f5cc4){var _0x4a5f31=this;return function(_0x4d4b40){_0x4a5f31[_0x8104('0xb1')](_0x1f5cc4);logger[_0x8104('0x92')](_0x5988b2,util[_0x8104('0x93')](_0x4d4b40,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x8104('0xce')]=function(_0x4cbbe0,_0xe0e8ea,_0x3a99ea){var _0x3cbeb3={'state':0x19,'statedesc':_0x8104('0xcf')};this['updateOriginated'](_0xe0e8ea);this[_0x8104('0xd0')](_[_0x8104('0x8b')](_0x3cbeb3,_[_0x8104('0xd1')](_0x3a99ea,['ContactId',_0x8104('0xd2'),_0x8104('0xd3'),_0x8104('0xd4'),_0x8104('0xd5')])),'[emptyContact][createHistory]',_0x8104('0xd6'));logger[_0x8104('0x92')](_0x4cbbe0);};Dialer[_0x8104('0x1a')][_0x8104('0xd7')]=function(_0x3ccbb8){return _0x3ccbb8===_0x8104('0xd8');};Dialer['prototype']['isTrunkReachable']=function(_0x57c66c){return!_['isUndefined'](_0x57c66c)&&_0x57c66c&&!_['isUndefined'](_0x57c66c[_0x8104('0x42')])&&!_[_0x8104('0x3e')](_0x57c66c[_0x8104('0x72')])&&_0x57c66c['active']&&(this[_0x8104('0x22')][util[_0x8104('0x75')]('SIP/%s',_0x57c66c[_0x8104('0x42')])][_0x8104('0xae')]===_0x8104('0xd9')||this[_0x8104('0x22')][util[_0x8104('0x75')](_0x8104('0xda'),_0x57c66c['name'])][_0x8104('0xae')]==='unmonitored');};Dialer[_0x8104('0x1a')]['saveInDb']=function(_0x3e5c37,_0x498e28,_0x4d9b5e){this[_0x8104('0xc9')](_0x3e5c37)[_0x8104('0xb7')](loggerCatch(_0x498e28));this[_0x8104('0xc7')](_0x3e5c37)[_0x8104('0xb7')](loggerCatch(_0x4d9b5e));};Dialer[_0x8104('0x1a')][_0x8104('0x39')]=function(_0x2b5f86){var _0x56827d=this[_0x8104('0x26')][_0x2b5f86[_0x8104('0xdb')]];var _0x4b51cf;if(!_[_0x8104('0xac')](_0x2b5f86)&&!_[_0x8104('0xac')](_0x2b5f86[_0x8104('0xdc')])&&!_[_0x8104('0xac')](_0x2b5f86[_0x8104('0xdc')][_0x8104('0xdd')])&&_0x2b5f86['exten']===_0x8104('0xde')&&_0x56827d){if(_0x56827d[_0x8104('0x4e')]!=='ivr'&&this['voiceQueues'][_0x56827d[_0x8104('0xb2')]][_0x8104('0xdf')]&&_0x2b5f86['value']===_0x8104('0xe0')){delete this[_0x8104('0x26')][_0x2b5f86['uniqueid']];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]]);this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0xe1')]+=0x1;this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;_0x4b51cf=new Hangup(_0x56827d,_0x2b5f86);_0x4b51cf[_0x8104('0xe2')]=0x12;_0x4b51cf[_0x8104('0xa5')]='HangupInAMD';_0x4b51cf['membername']='AMD';this['saveInDb'](_0x4b51cf,_0x8104('0xe3'),_0x8104('0xe4'));}if(_0x56827d['type']!=='ivr'&&this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0xdf')]&&_0x2b5f86[_0x8104('0xe5')]===_0x8104('0xe6')){var _0x569442=this;return new BPromise(function(_0x3db4e5,_0x1d681e){delete _0x569442[_0x8104('0x26')][_0x2b5f86[_0x8104('0xdb')]];_0x569442['updateOriginated'](_0x569442[_0x8104('0x1f')][_0x56827d['queue']]);_0x569442[_0x8104('0x1f')][_0x56827d['queue']][_0x8104('0xe1')]+=0x1;_0x569442[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;var _0x4c3c0c=_0x569442['voiceQueues'][_0x56827d[_0x8104('0xb2')]];var _0x2f6c56=new Hangup(_0x56827d,_0x2b5f86);_0x2f6c56[_0x8104('0xe2')]=0x13;_0x2f6c56[_0x8104('0xa5')]=_0x8104('0xe7');_0x2f6c56[_0x8104('0xe8')]=_0x8104('0xe9');_0x2f6c56[_0x8104('0xea')]+=0x1;_0x2f6c56[_0x8104('0xeb')]+=0x1;_0x2f6c56[_0x8104('0xec')]=!![];_0x569442[_0x8104('0xc9')](_0x2f6c56)[_0x8104('0xb7')](loggerCatch(_0x8104('0xed')));if(_0x2f6c56[_0x8104('0xee')]+_0x2f6c56[_0x8104('0xef')]+_0x2f6c56[_0x8104('0xf0')]+_0x2f6c56[_0x8104('0xf1')]+_0x2f6c56[_0x8104('0xf2')]+_0x2f6c56[_0x8104('0xf3')]+_0x2f6c56[_0x8104('0xea')]+_0x2f6c56[_0x8104('0xf4')]>=_0x4c3c0c[_0x8104('0xf5')]){_0x569442['stateGlobal'](_0x2f6c56,_0x3db4e5,_0x1d681e,_0x8104('0xf6'));}else{if(_0x2f6c56[_0x8104('0xea')]>=_0x4c3c0c[_0x8104('0xf7')]){_0x569442[_0x8104('0xf8')](_0x2f6c56,_0x3db4e5,_0x1d681e,_0x8104('0xf9'));}else{_0x569442[_0x8104('0xbf')]({'active':![],'countmachineretry':_0x2f6c56['countmachineretry'],'scheduledat':moment()['add'](_0x4c3c0c[_0x8104('0xfa')],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x2f6c56['ContactId'],'ListId':_0x2f6c56[_0x8104('0xd2')],'VoiceQueueId':_0x2f6c56[_0x8104('0xd4')]||undefined,'CampaignId':_0x2f6c56[_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0xfd')));_0x3db4e5({'reschedule':0x1});}}});}if(_0x56827d['type']===_0x8104('0x8f')&&this[_0x8104('0x20')][_0x56827d['queue']]['dialAMDActive']&&_0x2b5f86[_0x8104('0xe5')]==='HANGUP'){delete this[_0x8104('0x26')][_0x2b5f86['uniqueid']];this['updateOriginated'](this['campaigns'][_0x56827d[_0x8104('0xb2')]]);_0x4b51cf=new Hangup(_0x56827d,_0x2b5f86);_0x4b51cf[_0x8104('0xe2')]=0x12;_0x4b51cf[_0x8104('0xa5')]=_0x8104('0xfe');_0x4b51cf[_0x8104('0xe8')]=_0x8104('0xe9');this[_0x8104('0xd0')](_0x4b51cf,'[syncHangupInAMDIvr][createHistory]',_0x8104('0xff'));}if(_0x56827d[_0x8104('0x4e')]===_0x8104('0x8f')&&this[_0x8104('0x20')][_0x56827d[_0x8104('0xb2')]][_0x8104('0xdf')]&&_0x2b5f86[_0x8104('0xe5')]===_0x8104('0xe6')){var _0x569442=this;return new BPromise(function(_0x198718,_0x165d78){delete _0x569442[_0x8104('0x26')][_0x2b5f86[_0x8104('0xdb')]];_0x569442[_0x8104('0xb1')](_0x569442['campaigns'][_0x56827d[_0x8104('0xb2')]]);_0x569442['campaigns'][_0x56827d['queue']][_0x8104('0xe1')]+=0x1;_0x569442[_0x8104('0x20')][_0x56827d[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;var _0x357e56=_0x569442[_0x8104('0x20')][_0x56827d['queue']];var _0x42182c=new Hangup(_0x56827d,_0x2b5f86);_0x42182c[_0x8104('0xe2')]=0x13;_0x42182c['statedesc']=_0x8104('0xe7');_0x42182c['membername']=_0x8104('0xe9');_0x42182c[_0x8104('0xea')]+=0x1;_0x42182c[_0x8104('0xeb')]+=0x1;_0x42182c[_0x8104('0xec')]=!![];_0x569442[_0x8104('0xc9')](_0x42182c)['catch'](loggerCatch(_0x8104('0xed')));if(_0x42182c[_0x8104('0xee')]+_0x42182c[_0x8104('0xef')]+_0x42182c[_0x8104('0xf0')]+_0x42182c['countnosuchnumberretry']+_0x42182c[_0x8104('0xf2')]+_0x42182c[_0x8104('0xf3')]+_0x42182c[_0x8104('0xea')]+_0x42182c[_0x8104('0xf4')]>=_0x357e56[_0x8104('0xf5')]){_0x569442[_0x8104('0x100')](_0x42182c,_0x198718,_0x165d78,'reason19\x20machine....');}else{if(_0x42182c[_0x8104('0xea')]>=_0x357e56[_0x8104('0xf7')]){_0x569442['createStateFinal'](_0x42182c,_0x198718,_0x165d78,_0x8104('0xf9'));}else{_0x569442[_0x8104('0xbf')]({'active':![],'countmachineretry':_0x42182c['countmachineretry'],'scheduledat':moment()['add'](_0x357e56[_0x8104('0xfa')],_0x8104('0xfb'))[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42182c[_0x8104('0x101')],'ListId':_0x42182c['ListId'],'VoiceQueueId':_0x42182c[_0x8104('0xd4')]||undefined,'CampaignId':_0x42182c[_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0xfd')));_0x198718({'reschedule':0x1});}}});}}};Dialer[_0x8104('0x1a')][_0x8104('0x35')]=function(_0x46615b){var _0x561895=this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];var _0x590eb4=this;var _0xb3d090;if(_0x561895&&_0x561895[_0x8104('0x4e')]===_0x8104('0x8f')){delete this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];this[_0x8104('0xb1')](this['campaigns'][_0x561895[_0x8104('0xb2')]]);this[_0x8104('0x20')][_0x561895[_0x8104('0xb2')]][_0x8104('0x102')]+=0x1;_0xb3d090=new Hangup(_0x561895,_0x46615b);this[_0x8104('0xc9')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x103')));this[_0x8104('0xc7')](_0xb3d090)['catch'](loggerCatch(_0x8104('0x104')));}if(_0x561895&&_0x561895[_0x8104('0x4e')]!==_0x8104('0x8f')&&isNotNull(this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]][_0x8104('0x105')])){delete this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]]);this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]][_0x8104('0xe1')]+=0x1;this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;_0xb3d090=new Hangup(_0x561895,_0x46615b);_0xb3d090['state']=0x10;_0xb3d090[_0x8104('0xa5')]=_0x8104('0x106');_0xb3d090['membername']=_0x8104('0x107');this[_0x8104('0xc9')](_0xb3d090)['catch'](loggerCatch(_0x8104('0x103')));this[_0x8104('0xc7')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x104')));}if(_0x561895&&_0x561895[_0x8104('0x4e')]!==_0x8104('0x8f')&&!isNotNull(this['voiceQueues'][_0x561895[_0x8104('0xb2')]]['dialQueueProject'])){delete this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x561895['queue']]);this[_0x8104('0x1f')][_0x561895['queue']][_0x8104('0x64')]+=0x1;_0xb3d090=new Hangup(_0x561895,_0x46615b);_0xb3d090['state']=0xc;_0xb3d090[_0x8104('0xa5')]=_0x46615b[_0x8104('0x108')];_0xb3d090[_0x8104('0xe8')]=_0x8104('0x109');this[_0x8104('0xc9')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x103')));this[_0x8104('0xc7')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x104')));}};Dialer[_0x8104('0x1a')]['syncAgentComplete']=function(_0x40530e){var _0x4f8d3a=this['uniqueId'][_0x40530e[_0x8104('0xdb')]];var _0x54f8e6=this;if(this['voiceQueues'][_0x40530e[_0x8104('0xb2')]]){if(_0x4f8d3a&&_0x4f8d3a['type']!==_0x8104('0x8f')){delete this[_0x8104('0x26')][_0x40530e[_0x8104('0xdb')]];this[_0x8104('0x1f')][_0x40530e[_0x8104('0xb2')]]['outboundAnswerCallsDay']+=0x1;var _0x105b5a=new AgentComplete(_0x4f8d3a,_0x40530e);if(_0x40530e[_0x8104('0x10a')]==='agent'){_0x105b5a['agiafterat']=this[_0x8104('0x1f')][_0x40530e[_0x8104('0xb2')]][_0x8104('0x10b')]&&this[_0x8104('0x1f')][_0x40530e[_0x8104('0xb2')]][_0x8104('0x10c')]?moment()[_0x8104('0x75')](_0x8104('0xfc')):undefined;}this[_0x8104('0xc9')](_0x105b5a)[_0x8104('0xb7')](loggerCatch(_0x8104('0x10d')));this[_0x8104('0xc7')](_0x105b5a)['catch'](loggerCatch(_0x8104('0x10e')));}}};Dialer['prototype'][_0x8104('0x2e')]=function(_0x3dd1c1){if(this[_0x8104('0x1f')][_0x3dd1c1[_0x8104('0xb2')]]){if(this[_0x8104('0x26')][_0x3dd1c1['uniqueid']]&&this[_0x8104('0x26')][_0x3dd1c1[_0x8104('0xdb')]][_0x8104('0x4e')]!==_0x8104('0x8f')){this['updateOriginated'](this['voiceQueues'][_0x3dd1c1[_0x8104('0xb2')]]);this[_0x8104('0x26')][_0x3dd1c1['uniqueid']][_0x8104('0x10f')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));}}};Dialer[_0x8104('0x1a')][_0x8104('0x110')]=function(_0x44a63){this[_0x8104('0xc9')](_0x44a63)['catch'](loggerCatch(_0x8104('0x10d')));this[_0x8104('0xc7')](_0x44a63)[_0x8104('0xb7')](loggerCatch(_0x8104('0x111')));};Dialer[_0x8104('0x1a')][_0x8104('0x112')]=function(_0x375ed1){var _0x5a79a1=this[_0x8104('0x26')][_0x375ed1['uniqueid']];var _0x2b288d=this;if(this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]){if(_0x5a79a1&&_0x5a79a1[_0x8104('0x4e')]!==_0x8104('0x8f')){delete this[_0x8104('0x26')][_0x375ed1[_0x8104('0xdb')]];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]);_0x5a79a1['droptime']=moment()['format'](_0x8104('0xfc'));var _0x112ddb=new QueueCallerAbandon(_0x5a79a1,_0x375ed1);if(getSeconds(_0x5a79a1[_0x8104('0x113')],_0x5a79a1[_0x8104('0x114')])>=_0x5a79a1[_0x8104('0x115')]){this['voiceQueues'][_0x375ed1['queue']][_0x8104('0x116')]+=0x1;this[_0x8104('0x1f')][_0x375ed1['queue']][_0x8104('0x117')]+=0x1;this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x112ddb[_0x8104('0xe2')]=0xa;_0x112ddb[_0x8104('0xa5')]=_0x8104('0x118');_0x112ddb[_0x8104('0x119')]=_0x8104('0x11a');_0x112ddb[_0x8104('0x11b')]=this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]['dialQueueProject2']?moment()[_0x8104('0x75')](_0x8104('0xfc')):undefined;_0x112ddb[_0x8104('0xf2')]+=0x1;_0x112ddb[_0x8104('0xeb')]+=0x1;if(_0x112ddb[_0x8104('0xf2')]>=this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x11c')]){this[_0x8104('0x110')](_0x112ddb);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x112ddb[_0x8104('0xf2')],'scheduledat':moment()[_0x8104('0x11d')](this[_0x8104('0x1f')][_0x375ed1['queue']][_0x8104('0x11e')],'minutes')[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x5a79a1[_0x8104('0x101')],'ListId':_0x5a79a1[_0x8104('0xd2')],'VoiceQueueId':_0x5a79a1[_0x8104('0xd4')]||undefined,'CampaignId':_0x5a79a1[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x11f')));var _0x39eaee=new History(_0x112ddb);_0x39eaee[_0x8104('0xe2')]=0xa;_0x39eaee['statedesc']=_0x8104('0x118');_0x39eaee[_0x8104('0xa7')]=moment()['format'](_0x8104('0xfc'));_0x39eaee[_0x8104('0xa6')]=_0x39eaee[_0x8104('0xa7')];_0x39eaee[_0x8104('0x120')]=_0x112ddb[_0x8104('0x120')];_0x39eaee['calleridnum']=_0x112ddb['calleridnum'];this[_0x8104('0xc9')](_0x39eaee)[_0x8104('0xb7')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x67')]+=0x1;this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x61')]+=0x1;_0x112ddb[_0x8104('0xe2')]=0xb;_0x112ddb['statedesc']=_0x8104('0x121');_0x112ddb[_0x8104('0x119')]=_0x8104('0x122');_0x112ddb[_0x8104('0xf3')]+=0x1;_0x112ddb[_0x8104('0xeb')]+=0x1;if(_0x112ddb['countabandonedretry']>=this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x123')]){this['queueCallerAbandonCreateState'](_0x112ddb);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x112ddb['countabandonedretry'],'scheduledat':moment()[_0x8104('0x11d')](this['voiceQueues'][_0x375ed1['queue']][_0x8104('0x124')],_0x8104('0xfb'))['format'](_0x8104('0xfc')),'ContactId':_0x5a79a1[_0x8104('0x101')],'ListId':_0x5a79a1[_0x8104('0xd2')],'VoiceQueueId':_0x5a79a1[_0x8104('0xd4')]||undefined,'CampaignId':_0x5a79a1['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x125')));var _0x39eaee=new History(_0x112ddb);_0x39eaee['state']=0xb;_0x39eaee[_0x8104('0xa5')]=_0x8104('0x121');_0x39eaee[_0x8104('0xa7')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));_0x39eaee[_0x8104('0xa6')]=_0x39eaee[_0x8104('0xa7')];_0x39eaee['calleridname']=_0x112ddb[_0x8104('0x120')];_0x39eaee[_0x8104('0x126')]=_0x112ddb[_0x8104('0x126')];this['createHistory'](_0x39eaee)[_0x8104('0xb7')](loggerCatch(_0x8104('0x127')));}}}}};Dialer[_0x8104('0x1a')][_0x8104('0x37')]=function(_0x80cf93){if(this[_0x8104('0xaa')][_0x80cf93[_0x8104('0xdb')]]){this[_0x8104('0xaa')][_0x80cf93['uniqueid']][_0x8104('0xaf')]=_0x80cf93[_0x8104('0xaf')];}if(this[_0x8104('0x26')][_0x80cf93[_0x8104('0xdb')]]){this[_0x8104('0x26')][_0x80cf93['uniqueid']][_0x8104('0xaf')]=_0x80cf93[_0x8104('0xaf')];}};Dialer[_0x8104('0x1a')][_0x8104('0x128')]=function(_0xc170d6){if(strategy[this[_0x8104('0x1f')][this['actions'][_0xc170d6['actionid']]['queue']][_0x8104('0x50')]]===_0x8104('0x19')){if(this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]]&&_[_0x8104('0xac')](this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0x12a')])&&_0xc170d6[_0x8104('0xae')]==='1'&&_0xc170d6['paused']==='0'){if(this[_0x8104('0x21')][_0xc170d6[_0x8104('0x12b')]]){if(!this[_0x8104('0x21')][_0xc170d6['stateinterface']]['locked']){this[_0x8104('0x21')][_0xc170d6[_0x8104('0x12b')]][_0x8104('0x12a')]=!![];this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0x12a')]=!![];this[_0x8104('0xaa')][_0xc170d6['actionid']]['stateinterface']=_0xc170d6[_0x8104('0x12b')];}}}}else if((strategy[this[_0x8104('0x1f')][this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0xb2')]][_0x8104('0x50')]]||_0x8104('0x18'))===_0x8104('0x18')){if(this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]]){if(this['agents'][_0xc170d6[_0x8104('0x12b')]]){this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0x12b')]=_0xc170d6[_0x8104('0x12b')];if(_[_0x8104('0xac')](this[_0x8104('0x2b')][this[_0x8104('0xaa')][_0xc170d6['actionid']][_0x8104('0xb2')]])){this[_0x8104('0x2b')][this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0xb2')]]=[];}this['queueBooked'][this['actions'][_0xc170d6['actionid']][_0x8104('0xb2')]][_0x8104('0x12c')](_[_0x8104('0x8b')](_['pick'](this[_0x8104('0xaa')][_0xc170d6['actionid']],[_0x8104('0x12d'),'stateinterface']),{'status':_0xc170d6['status'],'paused':_0xc170d6[_0x8104('0x12e')]}));}}}};function unlockQueueStatus(_0x2ed761,_0x4af215){setTimeout(function(){if(_[_0x8104('0x3e')](_0x2ed761[_0x8104('0x12f')])){loggerBooked[_0x8104('0x92')](_0x8104('0x130'),_0x4af215);}_0x2ed761[_0x8104('0x12f')]=!![];loggerBooked[_0x8104('0x7c')](_0x8104('0x131'),_0x4af215,JSON[_0x8104('0x4a')](_[_0x8104('0xd1')](_0x2ed761,['name',_0x8104('0x12f')])));},0x1f3);}Dialer[_0x8104('0x1a')][_0x8104('0x132')]=function(_0x29d971){var _0x317886=this;var _0x392f88=_0x317886[_0x8104('0x1f')][_0x317886[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]];if(strategy[this[_0x8104('0x1f')][this['actions'][_0x29d971['actionid']][_0x8104('0xb2')]]['strategy']]===_0x8104('0x19')){if(this['actions'][_0x29d971[_0x8104('0x129')]]&&this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0x12b')]){this[_0x8104('0x1e')]['run'](this['actions'][_0x29d971['actionid']][_0x8104('0x12d')],this[_0x8104('0xaa')][_0x29d971['actionid']]['stateinterface'])[_0x8104('0xb7')](function(_0xf2d7f){logger[_0x8104('0x92')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x8104('0x93')](_0xf2d7f,{'showHidden':![],'depth':null}));})[_0x8104('0x1d')](function(){_0x317886[_0x8104('0xb1')](_0x317886[_0x8104('0x1f')][_0x317886['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]);_0x317886[_0x8104('0x21')][_0x317886[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]]['stateinterface']][_0x8104('0x12a')]=![];delete _0x317886['actions'][_0x29d971[_0x8104('0x129')]];unlockQueueStatus(_0x392f88);});}else{this[_0x8104('0xb1')](this[_0x8104('0x1f')][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0x101')],'ListId':this['actions'][_0x29d971[_0x8104('0x129')]]['ListId'],'VoiceQueueId':this[_0x8104('0xaa')][_0x29d971['actionid']]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0x133')));delete this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]];unlockQueueStatus(_0x392f88);}}else if((strategy[this[_0x8104('0x1f')][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]]['queue']][_0x8104('0x50')]]||'rrmemory')===_0x8104('0x18')){var _0x8fd90f;if(this['actions'][_0x29d971['actionid']]&&!_['isEmpty'](this[_0x8104('0x2b')][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]])){if(this[_0x8104('0x2c')][_0x317886[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]){this[_0x8104('0x2c')][_0x317886[_0x8104('0xaa')][_0x29d971['actionid']][_0x8104('0xb2')]]=this[_0x8104('0x2c')][this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]?this[_0x8104('0x2c')][this[_0x8104('0xaa')][_0x29d971['actionid']][_0x8104('0xb2')]]:this[_0x8104('0x2b')][this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]?this[_0x8104('0x2b')][this['actions'][_0x29d971[_0x8104('0x129')]]['queue']][_0x8104('0x134')]||0x0:0x0;}this[_0x8104('0x2b')][this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]][_0x8104('0x134')]=this['queueBookedRR'][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]]['queue']];for(var _0x3fea07=0x0;_0x3fea07=0x0?!![]:![];})['catch'](myreject(_0xbe3934)));}}else{_0x592f2f[_0x8104('0x12c')](ami['Action']({'action':'command','command':util[_0x8104('0x75')](_0x8104('0x150'),_0x2e90e6,!_['isUndefined'](config[_0x8104('0x14d')][_0x5b3777])?_0x5b3777:'')})[_0x8104('0xb6')](function(_0x2efa07){return _0x2efa07[_0x8104('0x14e')]['indexOf'](_0x8104('0x151'))>=0x0?!![]:![];})['catch'](myreject(_0xbe3934)));}BPromise[_0x8104('0x152')](_0x592f2f)[_0x8104('0xb6')](function(_0x5a4ae7){var _0x38d18a=_[_0x8104('0x153')](_0x5a4ae7);if(_0x38d18a){return _0x31e189(_0x38d18a);}else{_0x345274[_0x8104('0x41')]=_0x33df64?_0x8104('0x154'):_0x8104('0x155');return _0xbe3934(msgResponse(_0x8104('0x156'),_0x8104('0x146'),'Global:\x20'+_0x33df64+'\x20'+_0x4acfba+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8104('0x93')](_0x2e90e6,{'showHidden':![],'depth':null})+_0x8104('0x157')+_0x5b3777));}})[_0x8104('0xb7')](function(_0x32154f){return _0xbe3934(msgResponse(_0x8104('0x145'),_0x8104('0x146'),JSON[_0x8104('0x4a')](_0x32154f)));});});};Dialer['prototype']['checkDialMethod']=function(_0x544310){var _0x5b018a=this;return function(){switch(_0x544310[_0x8104('0x5c')]){case _0x8104('0x158'):freeVariablesPredictive(_0x544310);_0x5b018a[_0x8104('0x159')](_0x544310,0x1);break;case _0x8104('0x15a'):freeVariablesPredictive(_0x544310);_0x5b018a[_0x8104('0x159')](_0x544310,_0x544310[_0x8104('0x15b')]);break;case _0x8104('0x15c'):_0x5b018a[_0x8104('0x15c')](_0x544310);break;case _0x8104('0x15d'):freeVariablesPredictive(_0x544310);_0x5b018a['handlePower'](_0x544310,0x1);break;default:freeVariablesPredictive(_0x544310);logger[_0x8104('0x92')](_0x8104('0x15e'),_0x544310[_0x8104('0x42')],'method\x20not\x20recognized');}};};Dialer[_0x8104('0x1a')][_0x8104('0x15f')]=function(_0x25b8a6){var _0x2d1bf9=this;return function(){_0x2d1bf9[_0x8104('0x160')](_0x25b8a6);};};Dialer[_0x8104('0x1a')][_0x8104('0x6')]=function(_0x3811ca){var _0x4dd57c=this;if(isNotPreview(_0x3811ca['dialMethod'])){if(isVoiceQueueOutbound(_0x3811ca[_0x8104('0x4e')])&&isActive(_0x3811ca[_0x8104('0x5b')])){_0x3811ca[_0x8104('0x9e')]=!![];BPromise[_0x8104('0xba')]()['then'](checkIsLoggedIn(_0x3811ca,_0x3811ca[_0x8104('0x52')]))[_0x8104('0xb6')](checkIsActive(_0x3811ca,_0x3811ca[_0x8104('0x5b')]))[_0x8104('0xb6')](checkInterval(_0x3811ca))[_0x8104('0xb6')](_0x4dd57c['checkIsTrunkReachable'](_0x3811ca))[_0x8104('0xb6')](_0x4dd57c[_0x8104('0x144')](_0x3811ca[_0x8104('0x161')],_0x3811ca[_0x8104('0x162')],_0x3811ca[_0x8104('0x42')],_0x3811ca))[_0x8104('0xb6')](_0x4dd57c['checkIfTimeIntervals'](_0x3811ca['Interval'],_0x3811ca[_0x8104('0x162')],_0x3811ca[_0x8104('0x42')],_0x3811ca))[_0x8104('0xb6')](_0x4dd57c[_0x8104('0x163')](_0x3811ca))[_0x8104('0xb7')](loggerCatchQueueSummary(_0x8104('0x164'),_0x3811ca));}else{notSendMessagesQueue(_0x3811ca);}}else{freeVariablesPredictive(_0x3811ca);}};Dialer[_0x8104('0x1a')]['syncCampaigns']=function(){var _0x2a0ad4=this;var _0x1a2bc1;for(var _0x59a1ce in this[_0x8104('0x20')]){if(this[_0x8104('0x20')][_0x8104('0x96')](_0x59a1ce)){_0x1a2bc1=this['campaigns'][_0x59a1ce];if(isCampaignIvr(_0x1a2bc1[_0x8104('0x4e')])&&isActive(_0x1a2bc1[_0x8104('0x72')])){_0x1a2bc1[_0x8104('0x9e')]=!![];BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](checkIsActive(_0x1a2bc1,_0x1a2bc1[_0x8104('0x72')]))[_0x8104('0xb6')](checkInterval(_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4['checkIsTrunkReachable'](_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4[_0x8104('0x144')](_0x1a2bc1[_0x8104('0x161')],_0x1a2bc1[_0x8104('0x162')],_0x1a2bc1[_0x8104('0x42')],_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4[_0x8104('0x165')](_0x1a2bc1[_0x8104('0x44')],_0x1a2bc1[_0x8104('0x162')],_0x1a2bc1[_0x8104('0x42')],_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4['launchHandleIvr'](_0x1a2bc1))[_0x8104('0xb7')](loggerCatchQueueSummary(_0x8104('0x166'),_0x1a2bc1));}else{notSendMessagesCampaign(_0x1a2bc1);}}}};function getCallerIdRandom(_0x5f2aaa,_0x28c4fc){var _0x31d087,_0x43e6e3,_0x34d06a;if(_0x28c4fc<=0x0){_0x28c4fc=0x1;}_0x31d087=new RegExp(_0x8104('0x167')+_0x28c4fc+'}$');_0x43e6e3=Math[_0x8104('0x168')](0xa,_0x28c4fc-0x1);_0x34d06a=Math[_0x8104('0x168')](0xa,_0x28c4fc)-0x1;return util[_0x8104('0x75')]('%s',_[_0x8104('0x169')](_0x5f2aaa,_0x31d087,_[_0x8104('0x16a')](_0x43e6e3,_0x34d06a)));}function extractCalleridName(_0x405560){var _0x2c51fa=_0x405560['match'](/"(.*?)"/);return _0x2c51fa?_0x2c51fa[0x1]:_0x405560;}function extractCalleridNumber(_0x356d01){var _0x3c172e=_0x356d01['match'](/<(.*?)>/);return _0x3c172e?_0x3c172e[0x1]:_0x356d01;}Dialer[_0x8104('0x1a')][_0x8104('0x16b')]=function(_0x22f92a,_0x22bb2a){var _0x1a7c8b=this;var _0x1db1a2=uuid['v4']();this['actions'][_0x1db1a2]=new Action(_0x22f92a,_0x22bb2a,_0x1db1a2);return new BPromise(function(_0x7311ce,_0x2e40d5){if(_[_0x8104('0x3e')](_0x22f92a)&&_0x8104('0x16c')!==typeof _0x22f92a){return _0x2e40d5(msgResponse('originate','Failure',_0x8104('0x16d')));}if(_[_0x8104('0x3e')](_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')])||_0x22bb2a[_0x8104('0x16e')]['phone']===null){return _0x2e40d5(msgResponse(_0x8104('0x170'),_0x8104('0x146'),_0x8104('0x171')));}var _0x45a739={'XMD-CALLERID':_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2][_0x8104('0x172')](),'XMD-AGI':_0x22f92a['dialQueueProject']?util[_0x8104('0x75')](_0x8104('0x173'),ipAgi,_0x22f92a[_0x8104('0x105')]):'NONE','XMD-AGIAFTER':_0x22f92a[_0x8104('0x10b')]?util[_0x8104('0x75')](_0x8104('0x173'),ipAgi,_0x22f92a['dialQueueProject2']):_0x8104('0x174'),'XMD-QUEUE':_0x22f92a[_0x8104('0x4e')]===_0x8104('0x4f')?util['format'](_0x8104('0x175'),_0x22f92a[_0x8104('0x42')],_0x22f92a['dialQueueOptions']||'',_0x22f92a[_0x8104('0x10c')]?'c':'',_0x22f92a['dialQueueTimeout']||0x3):_0x8104('0x174'),'XMD-CONTACTID':_0x22bb2a[_0x8104('0x101')],'XMD-CDRTYPE':_0x8104('0x176'),'CALLERID(all)':_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2][_0x8104('0x172')](),'XMD-AMD':_0x22f92a['dialAMDActive']?_0x8104('0x177'):_0x8104('0x174'),'XMD-DESTINATION':_0x8104('0xde')};if(_0x22f92a[_0x8104('0xdf')]){_0x45a739[_0x8104('0x178')]=_0x22f92a['dialAMDInitialSilence']||0x9c4;_0x45a739[_0x8104('0x179')]=_0x22f92a[_0x8104('0x17a')]||0x5dc;_0x45a739[_0x8104('0x17b')]=_0x22f92a[_0x8104('0x17c')]||0x320;_0x45a739[_0x8104('0x17d')]=_0x22f92a[_0x8104('0x17e')]||0x1388;_0x45a739[_0x8104('0x17f')]=_0x22f92a[_0x8104('0x180')]||0x64;_0x45a739[_0x8104('0x181')]=_0x22f92a[_0x8104('0x182')]||0x32;_0x45a739[_0x8104('0x183')]=_0x22f92a[_0x8104('0x184')]||0x3;_0x45a739[_0x8104('0x185')]=_0x22f92a[_0x8104('0x186')]||0x100;_0x45a739[_0x8104('0x187')]=_0x22f92a[_0x8104('0x188')]||0x1388;}if(_0x22f92a[_0x8104('0x4e')]===_0x8104('0x4f')){_0x45a739['XMD-VOICEQUEUEID']=_0x22bb2a[_0x8104('0xd4')];}else{_0x45a739[_0x8104('0x189')]=_0x22bb2a['CampaignId'];}for(var _0x327d3f in _0x22bb2a[_0x8104('0x16e')]){if(_0x22bb2a[_0x8104('0x16e')][_0x8104('0x96')](_0x327d3f)){if(isNotNull(_0x22bb2a[_0x8104('0x16e')][_0x327d3f])&&_0x327d3f!=='id'&&_0x327d3f!==_0x8104('0x18a')&&_0x327d3f!=='createdAt'&&_0x327d3f!==_0x8104('0x18b')){_0x45a739[util['format']('%s%s',_0x8104('0x18c'),_[_0x8104('0x18d')](_0x327d3f))]=_0x22bb2a[_0x8104('0x16e')][_0x327d3f];}}}var _0x310329=_0x1a7c8b['isTrunkReachable'](_0x22f92a[_0x8104('0x71')])?getCallerId(_0x22f92a['Trunk'][_0x8104('0x73')],_0x22f92a[_0x8104('0x18e')],_0x22f92a[_0x8104('0x18f')]>0x0?getCallerIdRandom(_0x22f92a['dialOriginateCallerIdNumber'],_0x22f92a[_0x8104('0x18f')]):_0x22f92a[_0x8104('0x5d')]):getCallerId(_[_0x8104('0xac')](_0x22f92a['TrunkBackup'])?_0x22f92a[_0x8104('0x71')]['callerid']:_0x22f92a[_0x8104('0x141')]['callerid'],_0x22f92a[_0x8104('0x18e')],_0x22f92a[_0x8104('0x18f')]>0x0?getCallerIdRandom(_0x22f92a[_0x8104('0x5d')],_0x22f92a['dialRandomLastDigitCallerIdNumber']):_0x22f92a[_0x8104('0x5d')]);if(_0x310329){_0x45a739[_0x8104('0x190')]=_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2]['originatecalleridname']=extractCalleridName(_0x310329);_0x45a739[_0x8104('0x191')]=_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2][_0x8104('0x192')]=extractCalleridNumber(_0x310329);}return ami[_0x8104('0xad')]({'actionid':_0x1db1a2,'action':_0x8104('0x170'),'channel':_0x1a7c8b[_0x8104('0x140')](_0x22f92a[_0x8104('0x71')])?util[_0x8104('0x75')](_0x8104('0x193'),_0x22f92a[_0x8104('0x71')][_0x8104('0x42')],isNotNull(_0x22f92a['dialPrefix'])?_0x22f92a['dialPrefix'][_0x8104('0x194')]()||'':'',_0x22f92a['dialCutDigit']>0x0?_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')][_0x8104('0x195')](_0x22f92a['dialCutDigit']):_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x22f92a['TrunkBackup'])?_0x22f92a[_0x8104('0x71')][_0x8104('0x42')]:_0x22f92a['TrunkBackup'][_0x8104('0x42')],isNotNull(_0x22f92a[_0x8104('0x196')])?_0x22f92a[_0x8104('0x196')][_0x8104('0x194')]()||'':'',_0x22f92a['dialCutDigit']>0x0?_0x22bb2a['Contact'][_0x8104('0x16f')][_0x8104('0x195')](_0x22f92a[_0x8104('0x197')]):_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')]),'callerid':_0x310329,'Exten':_0x8104('0xde'),'Context':_0x8104('0x198'),'Priority':'1','variable':_0x45a739,'timeout':(_0x22f92a[_0x8104('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1db1a2})['then'](function(_0x23c726){return _0x7311ce(_0x23c726);})[_0x8104('0xb7')](function(_0x1b3542){_0x22f92a[_0x8104('0x199')]+=0x1;var _0x40fb3a=new History(_0x1a7c8b['actions'][_0x1db1a2]);logger[_0x8104('0x92')](util[_0x8104('0x75')](_0x8104('0x19a'),JSON[_0x8104('0x4a')](_0x1b3542)));_0x40fb3a[_0x8104('0xe2')]=0xe;_0x40fb3a[_0x8104('0xa5')]=_0x8104('0x19b');_0x40fb3a[_0x8104('0xa7')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));_0x40fb3a['endtime']=_0x40fb3a[_0x8104('0xa7')];_0x1a7c8b[_0x8104('0xc9')](_0x40fb3a)['catch'](loggerCatch(_0x8104('0x19c')));_0x1a7c8b[_0x8104('0xc7')](_0x40fb3a)[_0x8104('0xb7')](loggerCatch(_0x8104('0x19c')))[_0x8104('0x1d')](function(){delete _0x1a7c8b[_0x8104('0xaa')][_0x1db1a2];return _0x2e40d5(msgResponse('originate',_0x8104('0x49'),_0x8104('0x19d')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x96e9ba){var _0x47ab59=this['actions'][_0x96e9ba['actionid']];var _0x38b75e=this;if(_0x47ab59){delete this[_0x8104('0xaa')][_0x96e9ba['actionid']];_0x47ab59[_0x8104('0x114')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));var _0x3a0e82=_0x47ab59[_0x8104('0x4e')]===_0x8104('0x8f')?this[_0x8104('0x20')][_0x47ab59[_0x8104('0xb2')]]:this[_0x8104('0x1f')][_0x47ab59[_0x8104('0x19e')]()];if(!this[_0x8104('0xd7')](_0x96e9ba[_0x8104('0x19f')])){this[_0x8104('0xb1')](_0x3a0e82);return this[_0x8104('0x1a0')](_0x47ab59,_0x3a0e82,_0x96e9ba)[_0x8104('0xb6')](function(_0x2e110d){})[_0x8104('0xb7')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0x8104('0x26')][_0x96e9ba[_0x8104('0xdb')]]=_0x47ab59;}}};Dialer[_0x8104('0x1a')][_0x8104('0x1a1')]=function(_0x4a1951,_0x4d86ab,_0x13ca0b){var _0x12f0f5=new History(_0x4d86ab);if(_0x12f0f5[_0x8104('0xee')]+_0x12f0f5[_0x8104('0xef')]+_0x12f0f5['countnoanswerretry']+_0x12f0f5['countnosuchnumberretry']+_0x12f0f5[_0x8104('0xf2')]+_0x12f0f5[_0x8104('0xf3')]+_0x12f0f5[_0x8104('0xea')]+_0x12f0f5[_0x8104('0xf4')]>=_0x13ca0b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4a1951){case 0x3:if(_0x12f0f5[_0x8104('0xf0')]>=_0x13ca0b['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countnoanswerretry':_0x12f0f5[_0x8104('0xf0')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b['dialNoAnswerRetryFrequency'],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})['catch'](loggerCatch(_0x8104('0x1a2')));}break;case 0x5:if(_0x12f0f5[_0x8104('0xee')]>=_0x13ca0b[_0x8104('0x1a3')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countbusyretry':_0x12f0f5[_0x8104('0xee')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x1a4')],'minutes')[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x12f0f5['countcongestionretry']>=_0x13ca0b[_0x8104('0x1a5')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countcongestionretry':_0x12f0f5[_0x8104('0xef')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x1a6')],_0x8104('0xfb'))['format'](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x1a7')));}break;case 0x0:if(_0x12f0f5[_0x8104('0xf1')]>=_0x13ca0b[_0x8104('0x1a8')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countnosuchnumberretry':_0x12f0f5['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b['dialNoSuchNumberRetryFrequency'],_0x8104('0xfb'))['format'](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5[_0x8104('0xd4')]||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x12f0f5[_0x8104('0xf2')]>=_0x13ca0b[_0x8104('0x11c')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countdropretry':_0x12f0f5[_0x8104('0xf2')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x11e')],_0x8104('0xfb'))[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12f0f5['ContactId'],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x12f0f5[_0x8104('0xf3')]>=_0x13ca0b['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countabandonedretry':_0x12f0f5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x124')],_0x8104('0xfb'))[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x125')));}break;case 0x13:if(_0x12f0f5[_0x8104('0xea')]>=_0x13ca0b[_0x8104('0xf7')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x12f0f5[_0x8104('0xea')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0xfa')],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5['ContactId'],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5[_0x8104('0xd4')]||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0xfd')));}break;case 0x14:if(_0x12f0f5[_0x8104('0xf4')]>=_0x13ca0b[_0x8104('0x1a9')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x12f0f5['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x13ca0b[_0x8104('0x1aa')],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5['ContactId'],'ListId':_0x12f0f5['ListId'],'VoiceQueueId':_0x12f0f5[_0x8104('0xd4')]||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0x1ab')));}break;default:return!![];}};Dialer[_0x8104('0x1a')][_0x8104('0x1a0')]=function(_0x368eb0,_0x4860ac,_0x5ab544){var _0x3ecdd7=this;var _0x3c0548=new History(_0x368eb0);return new BPromise(function(_0x3a972b,_0x3c6dfe){if(_[_0x8104('0x3e')](_0x4860ac)&&'object'!==typeof _0x4860ac){return _0x3c6dfe(msgResponse(_0x8104('0x1ac'),'Failure',_0x8104('0x1ad')));}if(_[_0x8104('0x3e')](_0x5ab544)&&_0x8104('0x16c')!==typeof _0x5ab544){return _0x3c6dfe(msgResponse(_0x8104('0x1ac'),_0x8104('0x146'),_0x8104('0x1ae')));}switch(_0x5ab544[_0x8104('0x10a')]){case'0':_0x4860ac['outboundNoSuchCallsDay']+=0x1;_0x3c0548['state']=0x0;_0x3c0548[_0x8104('0xa5')]='NoSuchNumber';_0x3c0548[_0x8104('0xf1')]+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;ami['emit'](_0x8104('0x1af'),ut[_0x8104('0x1b0')](_0x368eb0,'nosuchnumber'));_0x3ecdd7['createHistory'](_0x3c0548)[_0x8104('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ecdd7[_0x8104('0x1a1')](0x0,_0x368eb0,_0x4860ac)){if(_0x3c0548['countnosuchnumberretry']>=_0x4860ac[_0x8104('0x1a8')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b1'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b1'));}}break;case'3':_0x4860ac['outboundNoAnswerCallsDay']+=0x1;_0x3c0548[_0x8104('0xe2')]=0x3;_0x3c0548['statedesc']=_0x8104('0x1b2');_0x3c0548[_0x8104('0xf0')]+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;ami['emit'](_0x8104('0x1b3'),ut[_0x8104('0x1b0')](_0x368eb0,'noanswer'));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1b4')));if(_0x3ecdd7[_0x8104('0x1a1')](0x3,_0x368eb0,_0x4860ac)){if(_0x3c0548['countnoanswerretry']>=_0x4860ac[_0x8104('0x1b5')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b6'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b6'));}}break;case'5':_0x4860ac[_0x8104('0x1b7')]+=0x1;_0x3c0548['state']=0x5;_0x3c0548[_0x8104('0xa5')]=_0x8104('0x1b8');_0x3c0548[_0x8104('0xee')]+=0x1;_0x3c0548['countglobal']+=0x1;ami[_0x8104('0x1b9')]('custom:agentbusy',ut[_0x8104('0x1b0')](_0x368eb0,_0x8104('0x1ba')));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1bb')));if(_0x3ecdd7['checkRetriveMax'](0x5,_0x368eb0,_0x4860ac)){if(_0x3c0548['countbusyretry']>=_0x4860ac['dialBusyMaxRetry']){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1bc'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,'reason\x205\x20busy');}}break;case'8':_0x4860ac['outboundCongestionCallsDay']+=0x1;_0x3c0548['state']=0x8;_0x3c0548[_0x8104('0xa5')]=_0x8104('0x1bd');_0x3c0548[_0x8104('0xef')]+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;ami[_0x8104('0x1b9')](_0x8104('0x1be'),ut[_0x8104('0x1b0')](_0x368eb0,_0x8104('0x1bf')));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1c0')));if(_0x3ecdd7[_0x8104('0x1a1')](0x8,_0x368eb0,_0x4860ac)){if(_0x3c0548[_0x8104('0xef')]>=_0x4860ac[_0x8104('0x1a5')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,'reason\x208\x20congestion');}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c1'));}}break;case'11':_0x4860ac['outboundAbandonedCallsDay']+=0x1;_0x3c0548['state']=0xb;_0x3c0548['statedesc']='Abandoned';_0x3c0548['countabandonedretry']+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x127')));if(_0x3ecdd7[_0x8104('0x1a1')](0xb,_0x368eb0,_0x4860ac)){if(_0x3c0548[_0x8104('0xf3')]>=_0x4860ac[_0x8104('0x123')]){_0x3ecdd7['createStateFinal'](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c2'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c2'));}}break;case'20':_0x4860ac[_0x8104('0x1c3')]+=0x1;_0x3c0548[_0x8104('0xe2')]=0x14;_0x3c0548['statedesc']=_0x8104('0x1c4');_0x3c0548[_0x8104('0xf4')]+=0x1;_0x3c0548['countglobal']+=0x1;ami[_0x8104('0x1b9')]('custom:agentreject',ut[_0x8104('0x1b0')](_0x368eb0,_0x8104('0x1c5')));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1c6')));if(_0x3ecdd7[_0x8104('0x1a1')](0x14,_0x368eb0,_0x4860ac)){if(_0x3c0548[_0x8104('0xf4')]>=_0x4860ac[_0x8104('0x1a9')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c7'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,'reason\x2020\x20agentreject');}}break;default:_0x4860ac['outboundUnknownCallsDay']+=0x1;_0x3c0548[_0x8104('0xe2')]=0xc;_0x3c0548[_0x8104('0xa5')]=_0x5ab544[_0x8104('0x10a')];_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3ecdd7[_0x8104('0x1a1')](_0x5ab544[_0x8104('0x10a')],_0x368eb0,_0x4860ac)){if(_0x3c0548['countbusyretry']+_0x3c0548['countcongestionretry']+_0x3c0548[_0x8104('0xf0')]+_0x3c0548['countnosuchnumberretry']+_0x3c0548['countdropretry']+_0x3c0548[_0x8104('0xf3')]+_0x3c0548[_0x8104('0xea')]+_0x3c0548[_0x8104('0xf4')]>=_0x4860ac['dialGlobalMaxRetry']){_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x5ab544[_0x8104('0x10a')]);}else{_0x3ecdd7['createStateFinal'](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x5ab544[_0x8104('0x10a')]);}}}});};Dialer[_0x8104('0x1a')][_0x8104('0x100')]=function(_0x1b7f09,_0x273431,_0x235193,_0x14529){var _0xd1f53=new Final(_0x1b7f09);_0xd1f53[_0x8104('0xe2')]=0xf;_0xd1f53[_0x8104('0xa5')]=_0x8104('0x1c8');this[_0x8104('0xf8')](_0xd1f53,_0x273431,_0x235193,_0x14529);};Dialer[_0x8104('0x1a')][_0x8104('0xf8')]=function(_0x128edb,_0x251329,_0x2ae8b5,_0x546bf0){this[_0x8104('0xc7')](_0x128edb)[_0x8104('0xb6')](function(_0x309b97){return _0x251329(msgResponse('[callProgressDetecting]',_0x8104('0xd8'),_0x546bf0));})[_0x8104('0xb7')](function(_0x3f21c7){return _0x2ae8b5(msgResponse(_0x8104('0x1c9'),_0x8104('0x146'),_0x8104('0x1ca')));});};Dialer[_0x8104('0x1a')][_0x8104('0x15c')]=function(_0x6bdf7e){var _0x41bee6=this;var _0xc49970=_0x6bdf7e['dialPredictiveOptimizationPercentage']/0x64;var _0x3de1c2=_0x6bdf7e['outboundDropCallsDayTimeout']/(_0x6bdf7e[_0x8104('0x117')]+_0x6bdf7e[_0x8104('0xe1')]);var _0x32b5c5=Math[_0x8104('0x1cb')](_0x6bdf7e[_0x8104('0x6b')]*(_0x6bdf7e['predictiveIntervalMaxThreshold']/0x64));var _0x3c264d=Math[_0x8104('0x1cb')](_0x6bdf7e[_0x8104('0x6b')]*(_0x6bdf7e[_0x8104('0x1cc')]/0x64));var _0x40ed33=_0x6bdf7e[_0x8104('0x51')]+_0x6bdf7e[_0x8104('0x56')];var _0x397f3f=Math[_0x8104('0x1cd')](_0x6bdf7e['erlangCalls']*_0x6bdf7e['erlangAbandonmentRate']*_0x6bdf7e[_0x8104('0x69')]*_0x6bdf7e[_0x8104('0x6a')]);if(_[_0x8104('0x3e')](_0x6bdf7e['startProgressive'])){if(!_[_0x8104('0x3e')](_0x6bdf7e['startPredictive'])){_0x6bdf7e['startPredictive']=undefined;loggerPredictive[_0x8104('0x92')](_0x8104('0x1ce'),_0x8104('0x1cf'));}if(!_[_0x8104('0x3e')](_0x6bdf7e[_0x8104('0x8e')])){loggerPredictive['error'](_0x8104('0x1ce'),_0x8104('0x1d0'));clearInterval(_0x6bdf7e['handlePredictive']);_0x6bdf7e['handlePredictive']=undefined;}_0x6bdf7e[_0x8104('0x29')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1d1'),_0x6bdf7e[_0x8104('0x29')]);this[_0x8104('0x159')](_0x6bdf7e,0x1);}else if(ifInterval(_0x6bdf7e[_0x8104('0x1d2')],_0x6bdf7e['startProgressive'])){this['handlePower'](_0x6bdf7e,0x1);loggerPredictiveCalls['info'](_0x8104('0x1d3'),_0x6bdf7e[_0x8104('0x29')],_0x6bdf7e[_0x8104('0x42')]);_0x6bdf7e['erlangCalls']=0x0;_0x6bdf7e[_0x8104('0x1d4')]=0x0;}else if(_0xc49970<_0x3de1c2&&_0x6bdf7e[_0x8104('0x1d5')]===_0x8104('0x1d6')){freeVariablesPredictive(_0x6bdf7e);loggerPredictive['info'](_0x8104('0x1d7'),_0x8104('0x1d8'),_0x3de1c2,_0x8104('0x29'),_0x6bdf7e[_0x8104('0x42')]);}else if(_0x397f3f<_0x6bdf7e['predictiveIntervalErlangCallsDroppedCalls']&&_0x6bdf7e[_0x8104('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x6bdf7e);loggerPredictive[_0x8104('0x7c')](_0x8104('0x1d9'),_0x8104('0x1da'),_0x397f3f,_0x8104('0x1db'),_0x6bdf7e[_0x8104('0x1d4')],_0x8104('0x29'),_0x6bdf7e['name']);}else if(!ifInterval(_0x6bdf7e[_0x8104('0x1d2')],_0x6bdf7e[_0x8104('0x29')])&&_[_0x8104('0x3e')](_0x6bdf7e[_0x8104('0x28')])&&!_['isUndefined'](_0x6bdf7e['startProgressive'])){_0x6bdf7e[_0x8104('0x28')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1dc'),_0x6bdf7e[_0x8104('0x28')]);this[_0x8104('0x1dd')](_0x6bdf7e[_0x8104('0x1d2')])[_0x8104('0xb6')](this['getDataPredictive'](_0x6bdf7e))[_0x8104('0xb6')](mergeDataErlangB(_0x6bdf7e))['then'](this[_0x8104('0x1de')](_0x6bdf7e))[_0x8104('0xb7')](loggerCatchPredictive(_0x8104('0x1df'),_0x6bdf7e));}else if(!ifInterval(_0x6bdf7e[_0x8104('0x1d2')],_0x6bdf7e['startPredictive'])){_0x6bdf7e[_0x8104('0x1d4')]=0x0;_0x6bdf7e[_0x8104('0x28')]=moment()[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1e0'),_0x6bdf7e[_0x8104('0x28')]);clearInterval(_0x6bdf7e['handlePredictive']);_0x6bdf7e[_0x8104('0x8e')]=undefined;this[_0x8104('0x1dd')](_0x6bdf7e[_0x8104('0x1d2')])['then'](this[_0x8104('0x1e1')](_0x6bdf7e))[_0x8104('0xb6')](mergeDataErlangB(_0x6bdf7e))[_0x8104('0xb6')](this['startMethodPredictive'](_0x6bdf7e))[_0x8104('0xb7')](loggerCatchPredictive(_0x8104('0x1e2'),_0x6bdf7e));}else if(_0x6bdf7e['predictiveIntervalAvailable']&&_0x40ed33<_0x6bdf7e['predictiveIntervalAvailable']-_0x3c264d){freeVariablesPredictive(_0x6bdf7e);loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1e3'),_0x40ed33,')\x20are\x20less\x20than\x20threshold\x20(',_0x6bdf7e[_0x8104('0x6b')],'-',_0x3c264d,'=',_0x6bdf7e['predictiveIntervalAvailable']-_0x3c264d,')');}else if(_0x6bdf7e[_0x8104('0x6b')]&&_0x40ed33>_0x6bdf7e[_0x8104('0x6b')]+_0x32b5c5){freeVariablesPredictive(_0x6bdf7e);loggerPredictive[_0x8104('0x7c')](_0x6bdf7e['name'],_0x8104('0x1e3'),_0x40ed33,')\x20are\x20more\x20than\x20threshold\x20(',_0x6bdf7e[_0x8104('0x6b')],'+',_0x32b5c5,'=',_0x6bdf7e['predictiveIntervalAvailable']+_0x32b5c5,')');}};Dialer[_0x8104('0x1a')][_0x8104('0x1e1')]=function(_0x2a5349){var _0x4343c2=this;return function(_0x43a777){return new BPromise(function(_0x5dac41,_0x2bc7cd){_[_0x8104('0x8b')](_0x2a5349,_0x43a777[0x0]);if(checkGetDataPredictive(_0x43a777[0x0])){var _0x1b4771=_0x2a5349[_0x8104('0x6b')]=_0x2a5349[_0x8104('0x56')]+_0x2a5349[_0x8104('0x51')];var _0x390a05=_0x2a5349[_0x8104('0x1d2')]*0x3c;var _0x524381=_0x43a777[0x0][_0x8104('0x66')]+_0x43a777[0x0]['predictiveIntervalAvgHoldtime'];var _0x57f3c5=(_0x43a777[0x0][_0x8104('0x7f')]+_0x43a777[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x43a777[0x0][_0x8104('0x67')])/_0x43a777[0x0][_0x8104('0x6c')];_0x2a5349[_0x8104('0x69')]=_0x57f3c5>0x0?_0x57f3c5:0x1;switch(_0x2a5349[_0x8104('0x1d5')]){case _0x8104('0x1d6'):var _0xe77ae1=_0x2a5349['dialPredictiveOptimizationPercentage']/0x64;return _0x4343c2[_0x8104('0x1e4')](_0x1b4771,_0x390a05,_0x524381,_0x57f3c5,_0xe77ae1)[_0x8104('0xb6')](function(_0x51a33e){return _0x5dac41(_0x51a33e);});case _0x8104('0x1e5'):var _0xa54db5=_0x2a5349['dialPredictiveOptimizationPercentage']/0x64;return _0x4343c2[_0x8104('0x1e6')](_0x1b4771,_0x390a05,_0x524381,_0x57f3c5,_0xa54db5)[_0x8104('0xb6')](function(_0x22db7e){return _0x5dac41(_0x22db7e);});default:return _0x2bc7cd(msgResponse('[getDataPredictive]','Failure',_0x8104('0x1e7')));}}else{return _0x2bc7cd(msgResponse(_0x8104('0x1e8'),_0x8104('0x146'),_0x8104('0x1e9')));}});};};Dialer['prototype'][_0x8104('0x1ea')]=function(_0x2b16ab){var _0x19b8da=this;return function(_0x52b0fd){return new BPromise(function(_0x58b8a4,_0x533c30){_[_0x8104('0x8b')](_0x2b16ab,_0x52b0fd[0x0]);if(checkGetDataPredictive(_0x52b0fd[0x0])){loggerPredictive['info'](JSON[_0x8104('0x4a')](_0x52b0fd[0x0]));if(_0x2b16ab['dialPredictiveOptimization']===_0x8104('0x1d6')){return _0x19b8da['getVoiceQueueRtPauses'](_0x2b16ab['id'])[_0x8104('0xb6')](function(_0x20d5f7){var _0x4bf966=_0x2b16ab['loggedIn']-_0x20d5f7[0x0][_0x8104('0x1eb')];var _0xbdd320=_0x2b16ab['dialPredictiveInterval']*0x3c;var _0x277292=_0x52b0fd[0x0][_0x8104('0x66')]+_0x52b0fd[0x0]['predictiveIntervalAvgHoldtime'];var _0x5d8095=(_0x52b0fd[0x0]['predictiveIntervalAnsweredCalls']+_0x52b0fd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x52b0fd[0x0][_0x8104('0x67')])/_0x52b0fd[0x0][_0x8104('0x6c')];var _0x4c9a8c=_0x2b16ab[_0x8104('0x1ec')]/0x64;_0x2b16ab[_0x8104('0x1ed')]=_0x20d5f7[0x0][_0x8104('0x1eb')]||0x0;_0x2b16ab['predictiveIntervalHitRate']=_0x5d8095>0x0?_0x5d8095:0x1;return _0x19b8da[_0x8104('0x1e4')](_0x4bf966,_0xbdd320,_0x277292,_0x5d8095,_0x4c9a8c);})[_0x8104('0xb6')](function(_0x3f5017){return _0x58b8a4(_0x3f5017);})['catch'](function(_0x4215dc){return _0x533c30(msgResponse('[CatchErlangB]','Failure',JSON[_0x8104('0x4a')](_0x4215dc)));});}if(_0x2b16ab[_0x8104('0x1d5')]===_0x8104('0x1e5')){return _0x19b8da[_0x8104('0xc5')](_0x2b16ab['id'])[_0x8104('0xb6')](function(_0x173f4b){var _0x4f5265=_0x2b16ab['loggedIn']-_0x173f4b[0x0][_0x8104('0x1eb')];var _0x10f93e=_0x2b16ab[_0x8104('0x1d2')]*0x3c;var _0x2ea9db=_0x52b0fd[0x0]['predictiveIntervalAvgTalktime']+_0x52b0fd[0x0]['predictiveIntervalAvgHoldtime'];var _0x5f40f0=(_0x52b0fd[0x0]['predictiveIntervalAnsweredCalls']+_0x52b0fd[0x0][_0x8104('0x116')]+_0x52b0fd[0x0][_0x8104('0x67')])/_0x52b0fd[0x0]['predictiveIntervalTotalCalls'];var _0x3c8b33=_0x2b16ab[_0x8104('0x1ec')]/0x64;_0x2b16ab[_0x8104('0x1ed')]=_0x173f4b[0x0]['outboundQueuePauses']||0x0;_0x2b16ab[_0x8104('0x69')]=_0x5f40f0>0x0?_0x5f40f0:0x1;return _0x19b8da[_0x8104('0x1e6')](_0x4f5265,_0x10f93e,_0x2ea9db,_0x5f40f0,_0x3c8b33);})[_0x8104('0xb6')](function(_0x217d5b){return _0x58b8a4(_0x217d5b);})[_0x8104('0xb7')](function(_0x410886){return _0x533c30(msgResponse(_0x8104('0x1ee'),_0x8104('0x146'),JSON[_0x8104('0x4a')](_0x410886)));});}}else{return _0x533c30(msgResponse(_0x8104('0x1e8'),_0x8104('0x146'),_0x8104('0x1e9')));}});};};Dialer[_0x8104('0x1a')][_0x8104('0x1de')]=function(_0x5d2087){var _0xc6c767=this;return function(){var _0x2c118a=0x0;var _0x45b3b3=Math[_0x8104('0x1cd')](_0x5d2087[_0x8104('0x6f')]*0x3e8);if(_0x45b3b3>0x0){_0x45b3b3=_0x45b3b3<0x64?0x64:_0x45b3b3;loggerPredictive[_0x8104('0x7c')](_0x5d2087[_0x8104('0x42')],'one\x20call\x20every:',_0x45b3b3,_0x8104('0x4b'));_0x5d2087[_0x8104('0x8e')]=setInterval(function(){_0xc6c767[_0x8104('0x8e')](_0x5d2087);loggerPredictiveCalls[_0x8104('0x7c')](_0x8104('0x1ef'),_0x2c118a+=0x1);},_0x45b3b3);}else{loggerPredictive[_0x8104('0x7c')](_0x5d2087[_0x8104('0x42')],_0x8104('0x1f0'));}};};Dialer[_0x8104('0x1a')][_0x8104('0x1f1')]=function(_0x327057,_0x4d2507){var _0x2610f9=this;return function(_0x6ca5b8){if(_[_0x8104('0x7a')](_0x6ca5b8)){if(_[_0x8104('0xac')](_0x4d2507[_0x8104('0xd3')])||!_0x4d2507['recallme']){if(_0x327057[_0x8104('0x5c')]===_0x8104('0x15d')){_0x327057[_0x8104('0x12f')]=_['isUndefined'](_0x327057[_0x8104('0x12f')])?!![]:_0x327057[_0x8104('0x12f')];var _0x370797=uuid['v4']();_0x2610f9[_0x8104('0xaa')][_0x370797]=new Action(_0x327057,_0x4d2507,_0x370797);loggerBooked['info'](_0x8104('0x1f2'),_0x370797,_0x8104('0x1f3'),JSON[_0x8104('0x4a')](_0x327057['queueStatusComplete']),_0x8104('0x1f4'),_0x327057['name']);if(_0x327057[_0x8104('0x12f')]){_0x327057[_0x8104('0x12f')]=![];_0x2610f9[_0x8104('0x2b')][_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xb2')]]=[];ami[_0x8104('0xad')]({'actionid':_0x370797,'action':_0x8104('0x1f5'),'queue':_0x327057['name']})[_0x8104('0xb7')](function(_0x55f169){_0x2610f9[_0x8104('0xb1')](_0x327057);_0x2610f9['rescheduleContact']({'active':![],'ContactId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0x101')],'ListId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd2')],'VoiceQueueId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd4')]||undefined,'CampaignId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x1f6')));delete _0x2610f9[_0x8104('0xaa')][_0x370797];});}else{loggerBooked[_0x8104('0x7c')](_0x8104('0x1f7'),JSON['stringify'](_0x327057[_0x8104('0x12f')]),_0x8104('0x1f4'),_0x327057[_0x8104('0x42')]);_0x2610f9[_0x8104('0xb1')](_0x327057);_0x2610f9[_0x8104('0xbf')]({'active':![],'ContactId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0x101')],'ListId':_0x2610f9['actions'][_0x370797]['ListId'],'VoiceQueueId':_0x2610f9[_0x8104('0xaa')][_0x370797]['VoiceQueueId']||undefined,'CampaignId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0x1f6')));delete _0x2610f9[_0x8104('0xaa')][_0x370797];}}else{return _0x2610f9[_0x8104('0x16b')](_0x327057,_0x4d2507);}}else{if(getDiff(_0x4d2507[_0x8104('0x1f8')])<_0x327057[_0x8104('0x1f9')]*0x3c){if(_0x4d2507[_0x8104('0x1fa')]&&!_0x4d2507[_0x8104('0x1fa')][_0x8104('0x1fb')]){_0x2610f9['preview'][_0x8104('0x138')](_0x4d2507['id'])[_0x8104('0x1d')](function(){_0x2610f9[_0x8104('0xb1')](_0x327057);});}else{_0x2610f9[_0x8104('0xc1')]({'active':![]},_0x4d2507['id'],0x1)[_0x8104('0x1d')](function(){console[_0x8104('0x1fc')](_0x8104('0x1fd'));_0x2610f9[_0x8104('0xb1')](_0x327057);});}}else{_0x327057['outboundReCallsDay']+=0x1;_0x2610f9[_0x8104('0xb1')](_0x327057);if(_0x327057[_0x8104('0x1fe')]){_0x2610f9[_0x8104('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d2507[_0x8104('0x101')],'ListId':_0x4d2507['ListId'],'VoiceQueueId':_0x4d2507[_0x8104('0xd4')]||undefined,'CampaignId':_0x4d2507[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2610f9[_0x8104('0xc9')](createObjHistory(_0x327057,_0x4d2507,'RECALLINQUEUE',0x17,_0x8104('0x1ff')))['catch'](loggerCatch(_0x8104('0x200')));}else{_0x2610f9[_0x8104('0xd0')](createObjHistory(_0x327057,_0x4d2507,_0x8104('0x201'),0x16,_0x8104('0x202')),_0x8104('0x203'),_0x8104('0x204'));}}}}else{_0x327057[_0x8104('0x205')]+=0x1;_0x2610f9['saveInDb'](createObjHistory(_0x327057,_0x4d2507,_0x8104('0x206'),0xd,_0x8104('0x207')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x8104('0x208');}};};Dialer[_0x8104('0x1a')][_0x8104('0x160')]=function(_0x5b57b1){var _0x23e560=this;var _0xabd0e3=[];var _0x272427=_0x5b57b1[_0x8104('0x209')]-_0x5b57b1[_0x8104('0x6d')]-_0x5b57b1[_0x8104('0x20a')];emitCampaignSummary(_0x5b57b1);if(_0x272427>0x0){if(_0x272427>this[_0x8104('0x23')]){_0x272427=this['maxNumberOriginate'];}_0x5b57b1[_0x8104('0x20a')]+=_0x272427;this['getContactDialerIvr'](_0x5b57b1['id'],_0x272427,_0x5b57b1[_0x8104('0x20b')])[_0x8104('0xb6')](function(_0xe53ee5){_0x5b57b1['temp']-=_0x272427;_0x5b57b1['temp']=_0x5b57b1[_0x8104('0x20a')]>0x0?_0x5b57b1[_0x8104('0x20a')]:0x0;if(!checkContactEmpty(_0xe53ee5)){_0x5b57b1[_0x8104('0x41')]=_0x8104('0x9c');logger[_0x8104('0x7c')](_0x8104('0x20c')+_0x5b57b1[_0x8104('0x42')]);}else{_0x5b57b1['originated']+=_0xe53ee5[_0x8104('0x95')];_0x5b57b1[_0x8104('0x41')]=_0x8104('0x20d');for(var _0x5edf4d=0x0;_0x5edf4d<_0xe53ee5[_0x8104('0x95')];_0x5edf4d+=0x1){_0x5b57b1[_0x8104('0x20e')]+=0x1;if(_[_0x8104('0xac')](_0xe53ee5[_0x5edf4d])||_[_0x8104('0xac')](_0xe53ee5[_0x5edf4d][_0x8104('0x16e')])||_[_0x8104('0xac')](_0xe53ee5[_0x5edf4d][_0x8104('0x16e')][_0x8104('0x16f')])){_0x23e560['emptyContact'](_0x8104('0x20f'),_0x5b57b1,_0xe53ee5[_0x5edf4d]);}else{_0x23e560[_0x8104('0xbb')](_['pick'](_0xe53ee5[_0x5edf4d],[_0x8104('0xd5'),_0x8104('0x210')]))[_0x8104('0xb6')](_0x23e560[_0x8104('0x1f1')](_0x5b57b1,_0xe53ee5[_0x5edf4d]))['catch'](_0x23e560[_0x8104('0xcd')](_0x8104('0x211'),_0x5b57b1));}}}})[_0x8104('0xb7')](loggerGetContactDialer(_0x8104('0x212'),_0x5b57b1,_0x272427));}};Dialer[_0x8104('0x1a')][_0x8104('0x159')]=function(_0x36d35c,_0x5438ab){var _0x9aebb9=this;var _0xf6c3ec=[];var _0x2ccceb=_0x5438ab>=0x1?_0x5438ab:0x1;var _0x1db91d=[];if(_0x36d35c['dialMethod']===_0x8104('0x15d')){_0x2ccceb=0x1;}var _0x48f833=Math['floor'](_0x36d35c['available']*_0x2ccceb)-_0x36d35c[_0x8104('0x6d')]-_0x36d35c[_0x8104('0x20a')];emitVoiceQueueSummary(_0x36d35c);if(_0x36d35c[_0x8104('0x213')]>0x0){var _0x13dbcf=_0x36d35c['dialLimitQueue']-_0x36d35c[_0x8104('0x6d')]-_0x36d35c[_0x8104('0x56')]-_0x36d35c[_0x8104('0x20a')]-_0x36d35c[_0x8104('0x53')];if(_0x48f833>_0x13dbcf){_0x48f833=_0x13dbcf;}}if(_0x48f833>0x0){if(_0x36d35c[_0x8104('0x5c')]===_0x8104('0x15d')){_0x48f833=0x1;}if(_0x48f833>this[_0x8104('0x23')]){_0x48f833=this[_0x8104('0x23')];}_0x36d35c[_0x8104('0x20a')]+=_0x48f833;for(var _0x483d94 in this[_0x8104('0x21')]){if(this[_0x8104('0x21')]['hasOwnProperty'](_0x483d94)){if(this[_0x8104('0x21')][_0x483d94][_0x8104('0xe2')]==='not_inuse'&&this[_0x8104('0x21')][_0x483d94][_0x8104('0xae')]==='reachable'){_0xf6c3ec[_0x8104('0x12c')](this[_0x8104('0x21')][_0x483d94]['id']);}}}this['getContactDialer'](_0x36d35c['id'],_0xf6c3ec,_0x48f833,_0x36d35c[_0x8104('0x20b')])[_0x8104('0xb6')](function(_0x516c19){_0x36d35c[_0x8104('0x20a')]-=_0x48f833;_0x36d35c[_0x8104('0x20a')]=_0x36d35c[_0x8104('0x20a')]>0x0?_0x36d35c['temp']:0x0;if(!checkContactEmpty(_0x516c19)){_0x9aebb9['countReScheduled'](_0x36d35c)['then'](sendMessageReschedule(_0x36d35c))[_0x8104('0xb7')](loggerCatch(_0x8104('0xb8')));}else{_0x36d35c[_0x8104('0x6d')]+=_0x516c19[_0x8104('0x95')];_0x36d35c[_0x8104('0x41')]=_0x36d35c[_0x8104('0x5c')]===_0x8104('0x15d')?'ACTIVE':_0x8104('0x20d');for(var _0x53bfcd=0x0;_0x53bfcd<_0x516c19[_0x8104('0x95')];_0x53bfcd+=0x1){if(_[_0x8104('0xac')](_0x516c19[_0x53bfcd])||_[_0x8104('0xac')](_0x516c19[_0x53bfcd][_0x8104('0x16e')])||_[_0x8104('0xac')](_0x516c19[_0x53bfcd]['Contact'][_0x8104('0x16f')])){_0x9aebb9['emptyContact'](_0x8104('0x20f'),_0x36d35c,_0x516c19[_0x53bfcd]);}else{_0x9aebb9[_0x8104('0xb9')](_[_0x8104('0xd1')](_0x516c19[_0x53bfcd],[_0x8104('0xd4'),_0x8104('0x210')]))['then'](_0x9aebb9[_0x8104('0x1f1')](_0x36d35c,_0x516c19[_0x53bfcd]))[_0x8104('0xb7')](_0x9aebb9[_0x8104('0xcd')](_0x8104('0x20f'),_0x36d35c));}}}})[_0x8104('0xb7')](loggerGetContactDialer(_0x8104('0x214'),_0x36d35c,_0x48f833));}};Dialer['prototype'][_0x8104('0x8e')]=function(_0x4aaca2){var _0xd6655=this;if(_0x4aaca2[_0x8104('0x213')]>0x0){var _0x1d0bd7=_0x4aaca2[_0x8104('0x213')]-_0x4aaca2[_0x8104('0x6d')]-_0x4aaca2['talking'];if(_0x1d0bd7>0x0){this['tryOriginatePredictive'](_0x4aaca2);}else{loggerPredictiveCalls[_0x8104('0x7c')](_0x8104('0x215'));}}else{this[_0x8104('0x216')](_0x4aaca2);}};Dialer[_0x8104('0x1a')][_0x8104('0x216')]=function(_0x4e82cf){var _0x1e3f0a=this;var _0x17682f=[];_0x4e82cf['originated']+=0x1;for(var _0x11cc4c in this[_0x8104('0x21')]){if(this[_0x8104('0x21')][_0x8104('0x96')](_0x11cc4c)){if(this[_0x8104('0x21')][_0x11cc4c]['state']===_0x8104('0x217')&&this['agents'][_0x11cc4c][_0x8104('0xae')]===_0x8104('0xd9')){_0x17682f[_0x8104('0x12c')](this[_0x8104('0x21')][_0x11cc4c]['id']);}}}this[_0x8104('0xc3')](_0x4e82cf['id'],_0x17682f,0x1,_0x4e82cf[_0x8104('0x20b')])['then'](function(_0xca3a37){if(!checkContactEmpty(_0xca3a37)){checkContactLowerLimitOriginate(_0x4e82cf,0x1,0x0);_0x1e3f0a[_0x8104('0xb5')](_0x4e82cf)[_0x8104('0xb6')](sendMessageReschedule(_0x4e82cf))['catch'](loggerCatch(_0x8104('0xb8')));}else{_0x4e82cf['message']=_0x8104('0x20d');if(_[_0x8104('0xac')](_0xca3a37[0x0])||_[_0x8104('0xac')](_0xca3a37[0x0]['Contact'])||_[_0x8104('0xac')](_0xca3a37[0x0]['Contact'][_0x8104('0x16f')])){_0x1e3f0a[_0x8104('0xce')](_0x8104('0x20f'),_0x4e82cf,_0xca3a37[0x0]);}else{_0x1e3f0a[_0x8104('0xb9')](_[_0x8104('0xd1')](_0xca3a37[0x0],[_0x8104('0xd4'),'Contact.phone']))[_0x8104('0xb6')](_0x1e3f0a[_0x8104('0x1f1')](_0x4e82cf,_0xca3a37[0x0]))[_0x8104('0xb7')](_0x1e3f0a[_0x8104('0xcd')](_0x8104('0x218'),_0x4e82cf));}}})[_0x8104('0xb7')](loggerGetContactDialer(_0x8104('0x219'),_0x4e82cf,0x1));emitVoiceQueueSummary(_0x4e82cf);};Dialer[_0x8104('0x1a')]['abandonmentRate']=function(_0x6823e6,_0x7f5f9a,_0x80e8aa,_0x3f2bf5,_0x3be33c,_0x1f2ca2){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x8104('0x7c')](_0x8104('0x21a'),_0x6823e6);loggerPredictive[_0x8104('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7f5f9a);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21b'),_0x80e8aa);loggerPredictive['info'](_0x8104('0x21c'),_0x3f2bf5);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21d'),_0x3be33c);loggerPredictive[_0x8104('0x7c')]('---------------------------');return new BPromise(function(_0x10d436,_0x2012a3){if(_0x6823e6<=0x0||isNaN(_0x6823e6)){return _0x2012a3(msgResponse('[abandonmentRate]',_0x8104('0x49'),'m\x20=\x20'+_0x6823e6));}if(_0x80e8aa<=0x0||isNaN(_0x80e8aa)){return _0x2012a3(msgResponse(_0x8104('0x21e'),'Error',_0x8104('0x21f')+_0x80e8aa));}if(_0x3f2bf5<=0x0||isNaN(_0x3f2bf5)){return _0x2012a3(msgResponse(_0x8104('0x21e'),_0x8104('0x49'),'p\x20=\x20'+_0x3f2bf5));}if(_0x7f5f9a<=0x0||isNaN(_0x7f5f9a)){return _0x2012a3(msgResponse(_0x8104('0x21e'),_0x8104('0x49'),_0x8104('0x220')+_0x7f5f9a));}if(_0x3be33c<=0x0||isNaN(_0x3be33c)){return _0x2012a3(msgResponse(_0x8104('0x21e'),'Error','Amax\x20=\x20'+_0x3be33c));}_0x1f2ca2=_0x1f2ca2||0x0;var _0x706293=0x1/_0x80e8aa;var _0x321e2d=0x0;var _0x3cb79f=0x0;var _0x242aef=0x0;var _0x39d8e4=0x0;for(var _0x2c7fa3=0x0;_0x242aef<_0x3be33c;_0x2c7fa3+=0x1){_0x3cb79f=_0x2c7fa3/_0x7f5f9a;_0x321e2d=(_0x3f2bf5*_0x3cb79f+_0x1f2ca2)/_0x706293;_0x242aef=erlangb(_0x321e2d,_0x6823e6);_0x39d8e4=_0x321e2d/_0x6823e6*(0x1-erlangb(_0x321e2d,_0x6823e6));}return _0x10d436({'erlangCalls':_0x2c7fa3,'erlangCallToSecond':_0x7f5f9a/_0x2c7fa3,'erlangAbandonmentRate':_0x242aef,'erlangBusyFactor':_0x39d8e4});});};Dialer['prototype']['busyFactor']=function(_0x1f943a,_0xd103fd,_0x15ad81,_0x393c32,_0x4d293f,_0x5df9d2){loggerPredictive[_0x8104('0x7c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x8104('0x7c')](_0x8104('0x21a'),_0x1f943a);loggerPredictive[_0x8104('0x7c')](_0x8104('0x221'),_0xd103fd);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21b'),_0x15ad81);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21c'),_0x393c32);loggerPredictive[_0x8104('0x7c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d293f);loggerPredictive[_0x8104('0x7c')](_0x8104('0x82'));return new BPromise(function(_0x2e85ff,_0x4b4410){if(_0x1f943a<=0x0||isNaN(_0x1f943a)){return _0x4b4410(msgResponse(_0x8104('0x222'),_0x8104('0x49'),_0x8104('0x223')+_0x1f943a));}if(_0x15ad81<=0x0||isNaN(_0x15ad81)){return _0x4b4410(msgResponse('[busyFactor]',_0x8104('0x49'),_0x8104('0x21f')+_0x15ad81));}if(_0x393c32<=0x0||isNaN(_0x393c32)){return _0x4b4410(msgResponse(_0x8104('0x222'),_0x8104('0x49'),_0x8104('0x224')+_0x393c32));}if(_0xd103fd<=0x0||isNaN(_0xd103fd)){return _0x4b4410(msgResponse(_0x8104('0x222'),_0x8104('0x49'),'interval\x20=\x20'+_0xd103fd));}if(_0x4d293f<=0x0||isNaN(_0x4d293f)){return _0x4b4410(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x4d293f));}_0x5df9d2=_0x5df9d2||0x0;var _0x19ecae=0x1/_0x15ad81;var _0x190ba0=0x0;var _0x4eea8e=0x0;var _0xf9ce13=0x0;var _0x181aa0=0x0;for(var _0x33a1bc=0x0;_0x181aa0<_0x4d293f;_0x33a1bc+=0x1){_0x4eea8e=_0x33a1bc/_0xd103fd;_0x190ba0=(_0x393c32*_0x4eea8e+_0x5df9d2)/_0x19ecae;_0xf9ce13=erlangb(_0x190ba0,_0x1f943a);_0x181aa0=_0x190ba0/_0x1f943a*(0x1-erlangb(_0x190ba0,_0x1f943a));}return _0x2e85ff({'erlangCalls':_0x33a1bc,'erlangCallToSecond':_0xd103fd/_0x33a1bc,'erlangAbandonmentRate':_0xf9ce13,'erlangBusyFactor':_0x181aa0});});};module['exports']=Dialer; \ No newline at end of file +var _0xbbad=['outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','ivr','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','uniqueId','[uniqueid]','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','campaigns','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','hasOwnProperty','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','xcally-motion-dialer','dialAMDActive','value','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','agent','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','paused','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','object','reason','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','Abandoned','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dropRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','predictiveIntervalPauses','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','checkContactBlack','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./hangup','env','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','seconds','emit','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x565135,_0x330bd8){var _0x8af1c7=function(_0x4dd1b7){while(--_0x4dd1b7){_0x565135['push'](_0x565135['shift']());}};_0x8af1c7(++_0x330bd8);}(_0xbbad,0x1c0));var _0xdbba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbad[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdbba('0x0'));var _=require(_0xdbba('0x1'));var BPromise=require('bluebird');var uuid=require(_0xdbba('0x2'));var moment=require(_0xdbba('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xdbba('0x4'));var logger=require(_0xdbba('0x5'))('dialer');var loggerBooked=require(_0xdbba('0x5'))(_0xdbba('0x6'));var loggerPredictive=require(_0xdbba('0x5'))(_0xdbba('0x7'));var loggerPredictiveCalls=require(_0xdbba('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xdbba('0x5'))(_0xdbba('0x8'));var ami=require(_0xdbba('0x9'));config[_0xdbba('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdbba('0xb'))(new Redis(config[_0xdbba('0xa')]));var cmHopper=require(_0xdbba('0xc'));var cmHopperFinal=require(_0xdbba('0xd'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xdbba('0xe'));var voiceQueueRt=require(_0xdbba('0xf'));var Action=require(_0xdbba('0x10'));var History=require(_0xdbba('0x11'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xdbba('0x12'));var ipAgi=process[_0xdbba('0x13')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0xdbba('0x14')};var Sequence=function(){};Sequence['prototype'][_0xdbba('0x15')]=function(_0xd50284){this[_0xdbba('0x16')]=this[_0xdbba('0x16')]?this[_0xdbba('0x16')][_0xdbba('0x17')](_0xd50284):_0xd50284();};function Dialer(_0x16484b,_0x2bae9d){this[_0xdbba('0x18')]=new Sequence();this[_0xdbba('0x19')]=_0x2bae9d;this['voiceQueues']=_0x16484b[_0xdbba('0x1a')];this['campaigns']=_0x16484b['campaigns'];this[_0xdbba('0x1b')]=_0x16484b[_0xdbba('0x1b')];this[_0xdbba('0x1c')]=_0x16484b[_0xdbba('0x1c')];this[_0xdbba('0x1d')]=config[_0xdbba('0x1d')]||0x2;this[_0xdbba('0x1e')]={};this[_0xdbba('0x1f')]={};this[_0xdbba('0x20')]={};this['uniqueId']={};this[_0xdbba('0x21')]={};this['startPredictive']={};this[_0xdbba('0x22')]={};this['ivrOriginated']={};this[_0xdbba('0x23')]={};this[_0xdbba('0x24')]={};ami['on'](_0xdbba('0x25'),this[_0xdbba('0x26')][_0xdbba('0x27')](this));ami['on']('queuecallerabandon',this[_0xdbba('0x28')][_0xdbba('0x27')](this));ami['on'](_0xdbba('0x29'),this['syncOriginateResponse'][_0xdbba('0x27')](this));ami['on']('agentcomplete',this[_0xdbba('0x2a')][_0xdbba('0x27')](this));ami['on'](_0xdbba('0x2b'),this['syncQueueSummary'][_0xdbba('0x27')](this));ami['on'](_0xdbba('0x2c'),this[_0xdbba('0x2d')][_0xdbba('0x27')](this));ami['on'](_0xdbba('0x2e'),this[_0xdbba('0x2f')][_0xdbba('0x27')](this));ami['on'](_0xdbba('0x30'),this[_0xdbba('0x31')]['bind'](this));ami['on'](_0xdbba('0x32'),this['syncQueueMember'][_0xdbba('0x27')](this));ami['on'](_0xdbba('0x33'),this['syncQueueStatusComplete'][_0xdbba('0x27')](this));this[_0xdbba('0x34')]();this[_0xdbba('0x35')]();}function isNotNull(_0x506110){return _0x506110!==null&&!_[_0xdbba('0x36')](_0x506110);}function checkIsLoggedIn(_0x383185,_0x45dfeb){return function(){if(_0x45dfeb<=0x0){_0x383185[_0xdbba('0x37')]=_0xdbba('0x38');throw _0x383185['name']+_0xdbba('0x39');}};}function isActive(_0x2a43bb){return _0x2a43bb;}function checkIsActive(_0x392e3b,_0x19426f){return function(){if(!isActive(_0x19426f)){_0x392e3b[_0xdbba('0x37')]=_0xdbba('0x3a');throw _0x392e3b[_0xdbba('0x3b')]+_0xdbba('0x3c');}};}function checkInterval(_0x5c4c56){return function(){if(!isNotNull(_0x5c4c56['Interval'])){_0x5c4c56[_0xdbba('0x37')]=_0xdbba('0x3d');throw _0x5c4c56[_0xdbba('0x3b')]+_0xdbba('0x3e');}if(!isNotNull(_0x5c4c56[_0xdbba('0x3f')]['Intervals'])){_0x5c4c56[_0xdbba('0x37')]=_0xdbba('0x3d');throw _0x5c4c56['name']+_0xdbba('0x3e');}if(!isNotNull(_[_0xdbba('0x40')](_0x5c4c56['Interval'][_0xdbba('0x41')]))){_0x5c4c56[_0xdbba('0x37')]='INTERVAL_IS_NULL';throw _0x5c4c56[_0xdbba('0x3b')]+_0xdbba('0x3e');}};}function msgResponse(_0x215fce,_0x1f5e53,_0x458556){return{'action':_0x215fce,'response':_0x1f5e53,'message':_0x458556,'stack':_0x458556};}function myreject(_0x10d376){return function(_0x339fa2){return _0x10d376(msgResponse(_0xdbba('0x42'),'Error',JSON[_0xdbba('0x43')](_0x339fa2)));};}function getSeconds(_0x1f2b41,_0x15dfe4){var _0x24a54e=moment(_0x1f2b41)[_0xdbba('0x44')](0x0);var _0x2e8a71=moment(_0x15dfe4)[_0xdbba('0x44')](0x0);return _0x24a54e['diff'](_0x2e8a71,_0xdbba('0x45'));}function emit(_0x196e7f,_0x3e1268,_0x58737d){io['to'](_0x196e7f)[_0xdbba('0x46')](_0x3e1268,_0x58737d);}function emitVoiceQueueSummary(_0x278731){if(_0x278731['type']==='outbound'){var _0x906347={'id':_0x278731['id'],'name':_0x278731[_0xdbba('0x3b')],'strategy':_0x278731[_0xdbba('0x47')],'answered':_0x278731['answered'],'available':_0x278731[_0xdbba('0x48')],'loggedIn':_0x278731[_0xdbba('0x49')],'pTalking':_0x278731[_0xdbba('0x4a')],'sumBillable':_0x278731[_0xdbba('0x4b')],'sumDuration':_0x278731['sumDuration'],'sumHoldTime':_0x278731[_0xdbba('0x4c')]||0x0,'talking':_0x278731[_0xdbba('0x4d')],'total':_0x278731[_0xdbba('0x4e')],'type':_0x278731[_0xdbba('0x4f')],'unmanaged':_0x278731[_0xdbba('0x50')],'abandoned':_0x278731['abandoned'],'waiting':_0x278731[_0xdbba('0x51')],'loggedInDb':_0x278731[_0xdbba('0x52')],'dialActive':_0x278731[_0xdbba('0x53')],'dialMethod':_0x278731[_0xdbba('0x54')],'dialOriginateCallerIdName':_0x278731[_0xdbba('0x55')],'dialOriginateCallerIdNumber':_0x278731['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x278731['dialOriginateTimeout'],'dialPrefix':_0x278731[_0xdbba('0x56')],'outboundAnswerAgiCallsDay':_0x278731[_0xdbba('0x57')],'outboundAnswerCallsDay':_0x278731[_0xdbba('0x58')],'outboundBlacklistCallsDay':_0x278731[_0xdbba('0x59')],'outboundBusyCallsDay':_0x278731[_0xdbba('0x5a')],'outboundCongestionCallsDay':_0x278731[_0xdbba('0x5b')],'outboundDropCallsDayACS':_0x278731['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x278731[_0xdbba('0x5c')],'outboundDropCallsDayTimeout':_0x278731[_0xdbba('0x5d')],'outboundNoAnswerCallsDay':_0x278731[_0xdbba('0x5e')],'outboundNoSuchCallsDay':_0x278731[_0xdbba('0x5f')],'outboundOriginateFailureCallsDay':_0x278731[_0xdbba('0x60')],'outboundReCallsDay':_0x278731[_0xdbba('0x61')],'outboundRejectCallsDay':_0x278731[_0xdbba('0x62')],'outboundUnknownCallsDay':_0x278731[_0xdbba('0x63')],'predictiveIntervalAnsweredCalls':_0x278731[_0xdbba('0x64')],'predictiveIntervalAvgHoldtime':_0x278731[_0xdbba('0x65')],'predictiveIntervalAvgTalktime':_0x278731[_0xdbba('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x278731['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x278731[_0xdbba('0x67')],'predictiveIntervalErlangCalls':_0x278731[_0xdbba('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x278731[_0xdbba('0x69')],'predictiveIntervalHitRate':_0x278731['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x278731[_0xdbba('0x6a')],'predictiveIntervalPauses':_0x278731['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x278731[_0xdbba('0x6b')],'predictiveIntervalTotalCalls':_0x278731['predictiveIntervalTotalCalls'],'message':_0x278731['message'],'originated':_0x278731['originated'],'erlangCalls':_0x278731[_0xdbba('0x6c')],'erlangCallToSecond':_0x278731[_0xdbba('0x6d')],'erlangAbandonmentRate':_0x278731[_0xdbba('0x6e')],'erlangBusyFactor':_0x278731[_0xdbba('0x6f')],'startPredictive':_0x278731['startPredictive'],'startProgressive':_0x278731[_0xdbba('0x22')]};if(_0x278731[_0xdbba('0x70')]){_0x906347[_0xdbba('0x70')]={'id':_0x278731[_0xdbba('0x70')]['id'],'name':_0x278731[_0xdbba('0x70')][_0xdbba('0x3b')],'active':_0x278731['Trunk'][_0xdbba('0x71')],'callerid':_0x278731[_0xdbba('0x70')][_0xdbba('0x72')]};}if(_0x278731[_0xdbba('0x3f')]){_0x906347[_0xdbba('0x3f')]={'id':_0x278731[_0xdbba('0x3f')]['id'],'name':_0x278731[_0xdbba('0x3f')][_0xdbba('0x3b')]};}var _0x2d3b67=md5(JSON[_0xdbba('0x43')](_0x906347));if(_0x278731[_0xdbba('0x73')]!==_0x2d3b67){_0x278731[_0xdbba('0x73')]=_0x2d3b67;emit(util[_0xdbba('0x74')](_0xdbba('0x75'),_0x906347[_0xdbba('0x3b')]),_0xdbba('0x76'),_0x906347);}}}function emitCampaignSummary(_0x151025){if(_0x151025[_0xdbba('0x4f')]==='ivr'){emit(util['format']('campaign:ivr:%s',_0x151025[_0xdbba('0x3b')]),_0xdbba('0x77'),_0x151025);}}function checkGetDataPredictive(_0x4c9c12){if(isNotNull(_0x4c9c12)){if(!_[_0xdbba('0x40')](_0x4c9c12)){loggerPredictive[_0xdbba('0x78')](_0xdbba('0x79'));loggerPredictive[_0xdbba('0x78')](_0xdbba('0x7a'),_0x4c9c12[_0xdbba('0x7b')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x7c'),_0x4c9c12[_0xdbba('0x64')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x7d'),_0x4c9c12[_0xdbba('0x67')]);loggerPredictive[_0xdbba('0x78')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c9c12[_0xdbba('0x7e')]);loggerPredictive[_0xdbba('0x78')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c9c12[_0xdbba('0x65')]);loggerPredictive['info'](_0xdbba('0x7f'),_0x4c9c12[_0xdbba('0x66')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x80'));if(_0x4c9c12[_0xdbba('0x7b')]>0x0){if(!_[_0xdbba('0x36')](_0x4c9c12[_0xdbba('0x66')])&&_0x4c9c12[_0xdbba('0x66')]>0x0){return!![];}else{loggerPredictive['info'](_0xdbba('0x81'));}if(!_[_0xdbba('0x36')](_0x4c9c12[_0xdbba('0x65')])&&_0x4c9c12[_0xdbba('0x65')]>0x0){return!![];}else{loggerPredictive[_0xdbba('0x78')](_0xdbba('0x82'));}}else{loggerPredictive[_0xdbba('0x78')](_0xdbba('0x83'));}}else{loggerPredictive[_0xdbba('0x78')](_0xdbba('0x84'));}}else{loggerPredictive[_0xdbba('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2a950c){return function(_0x46c957){loggerPredictive['info'](_0xdbba('0x85'));loggerPredictive['info'](_0xdbba('0x86'),_0x46c957[_0xdbba('0x6c')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x87'),_0x46c957[_0xdbba('0x6d')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x88'),_0x46c957['erlangAbandonmentRate']);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x89'),_0x46c957[_0xdbba('0x6f')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x88'),_0x46c957[_0xdbba('0x6e')]);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x80'));_[_0xdbba('0x8a')](_0x2a950c,_0x46c957);};}function getDiff(_0x25e3c8){var _0x5c083d=moment()[_0xdbba('0x44')](0x0);var _0x24703b=moment(_0x25e3c8)[_0xdbba('0x44')](0x0);return _0x5c083d[_0xdbba('0x8b')](_0x24703b,_0xdbba('0x45'));}function ifInterval(_0x5a50f4,_0x3dd6f1){if(_['isUndefined'](_0x3dd6f1)){return![];}if(getDiff(_0x3dd6f1)<_0x5a50f4*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xcd7254){if(isNotNull(_0xcd7254)){if(!_[_0xdbba('0x36')](_0xcd7254['startProgressive'])){_0xcd7254[_0xdbba('0x22')]=undefined;loggerPredictive[_0xdbba('0x78')](_0xcd7254[_0xdbba('0x3b')],_0xdbba('0x8c'));}if(!_['isUndefined'](_0xcd7254[_0xdbba('0x8d')])){_0xcd7254[_0xdbba('0x8d')]=undefined;loggerPredictive[_0xdbba('0x78')](_0xcd7254[_0xdbba('0x3b')],_0xdbba('0x8e'));}if(!_[_0xdbba('0x36')](_0xcd7254['handlePredictive'])){clearInterval(_0xcd7254[_0xdbba('0x8f')]);_0xcd7254[_0xdbba('0x8f')]=undefined;loggerPredictive['info'](_0xcd7254['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x9b3569,_0x395004){if(_0x395004===0x0){return 0x0;}var _0x163d4f=0x1;for(var _0x2c0b26=0x1;_0x2c0b26<=_0x395004;_0x2c0b26+=0x1){_0x163d4f=0x1+_0x163d4f*_0x2c0b26/_0x9b3569;}return 0x1/_0x163d4f;}function isVoiceQueueOutbound(_0x40b8b8){return _0x40b8b8===_0xdbba('0x90');}function isNotPreview(_0x15cc52){return _0x15cc52!==_0xdbba('0x19');}function isCampaignIvr(_0x188d30){return _0x188d30===_0xdbba('0x91');}function getCallerId(_0x466e25,_0x168459,_0x4f430d){if(!_[_0xdbba('0x36')](_0x4f430d)&&'string'===typeof _0x4f430d&&!_[_0xdbba('0x40')](_0x4f430d)){if(!_[_0xdbba('0x36')](_0x168459)&&'string'===typeof _0x168459&&!_['isEmpty'](_0x168459)){return util[_0xdbba('0x74')](_0xdbba('0x92'),_0x168459,_0x4f430d);}return util['format']('\x22%s\x22\x20<%s>',_0x4f430d,_0x4f430d);}if(!_['isUndefined'](_0x466e25)&&'string'===typeof _0x466e25&&!_['isEmpty'](_0x466e25)){return _0x466e25;}return _0xdbba('0x93');}function loggerCatchQueueSummary(_0xc8f96d,_0x4115ff){return function(_0x51e854){freeVariablesPredictive(_0x4115ff);emitVoiceQueueSummary(_0x4115ff);emitCampaignSummary(_0x4115ff);loggerSyncQueueSummary[_0xdbba('0x94')](_0xc8f96d,util[_0xdbba('0x95')](_0x51e854,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4db79f,_0x4e153c){return function(_0x19e145){loggerPredictive['error'](_0x4e153c['name'],_0x4db79f);loggerPredictive[_0xdbba('0x94')](_0x19e145[_0xdbba('0x96')]);freeVariablesPredictive(_0x4e153c);};}function loggerCatch(_0x182cf9){return function(_0x4a7950){logger[_0xdbba('0x94')](_0x182cf9,util[_0xdbba('0x95')](_0x4a7950,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x6e9707){return _0x6e9707&&!_[_0xdbba('0x36')](_0x6e9707)&&_0x6e9707[_0xdbba('0x97')]>0x0;}function decremetOriginate(_0x21bdea){if(!_[_0xdbba('0x36')](_0x21bdea)&&_0x21bdea!==null){if(_0x21bdea['hasOwnProperty'](_0xdbba('0x98'))){if(_0x21bdea['originated']>0x0){_0x21bdea[_0xdbba('0x98')]-=0x1;}else{logger[_0xdbba('0x94')](_0xdbba('0x99'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2c6ea1,_0x27d183,_0x43310b){if(_0x27d183>_0x43310b){for(var _0x39e030=0x0;_0x39e030<_0x27d183-_0x43310b;_0x39e030+=0x1){decremetOriginate(_0x2c6ea1);}}}function loggerGetContactDialer(_0x961fef,_0x2868bd,_0x35beff){return function(_0x37722a){checkContactLowerLimitOriginate(_0x2868bd,_0x35beff,0x0);logger[_0xdbba('0x94')](_0x961fef,util[_0xdbba('0x95')](_0x37722a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4f7369){return function(_0x497634){if(isNotNull(_0x497634)&&isNotNull(_0x497634[0x0])){if(_0x497634[0x0][_0xdbba('0x9a')]>0x0){_0x4f7369[_0xdbba('0x37')]='RESCHEDULED_CONTACTS';logger[_0xdbba('0x78')](_0xdbba('0x9b')+_0x4f7369[_0xdbba('0x3b')],_0x497634[0x0][_0xdbba('0x9a')],_0xdbba('0x9c'));}else{_0x4f7369[_0xdbba('0x37')]=_0xdbba('0x9d');logger[_0xdbba('0x78')](_0xdbba('0x9e')+_0x4f7369[_0xdbba('0x3b')]);}}};}function notSendMessagesQueue(_0x2334bf){if(_0x2334bf['sendMessageOneNotActive']){freeVariablesPredictive(_0x2334bf);if(_0x2334bf[_0xdbba('0x98')]===0x0&&_0x2334bf[_0xdbba('0x4d')]===0x0&&_0x2334bf['waiting']===0x0&&(_0x2334bf[_0xdbba('0x4a')]||0x0)===0x0){_0x2334bf[_0xdbba('0x9f')]=![];_0x2334bf[_0xdbba('0x48')]=0x0;_0x2334bf[_0xdbba('0x37')]=_0xdbba('0x3a');loggerSyncQueueSummary['error'](_0xdbba('0xa0'),_0x2334bf['name'],'is\x20not\x20active');}else{_0x2334bf[_0xdbba('0x37')]=_0xdbba('0xa1');loggerSyncQueueSummary[_0xdbba('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2334bf[_0xdbba('0x3b')],'is\x20disactive');}emitVoiceQueueSummary(_0x2334bf);}}function notSendMessagesCampaign(_0x35c183){if(_0x35c183[_0xdbba('0x9f')]){if(_0x35c183[_0xdbba('0x98')]===0x0){_0x35c183['sendMessageOneNotActive']=![];_0x35c183['message']=_0xdbba('0x3a');loggerSyncQueueSummary[_0xdbba('0x94')](_0xdbba('0xa2'),_0x35c183[_0xdbba('0x3b')],'is\x20not\x20active');}else{_0x35c183[_0xdbba('0x37')]=_0xdbba('0xa1');loggerSyncQueueSummary[_0xdbba('0x94')](_0xdbba('0xa2'),_0x35c183[_0xdbba('0x3b')],'is\x20disactive');}emitCampaignSummary(_0x35c183);}}function createObjHistory(_0x15c2ae,_0x496038,_0x4b5562,_0x2dbd62,_0x138ad2){_0x15c2ae[_0xdbba('0x37')]=_0x4b5562;var _0x5a5b06=new Action(_0x15c2ae,_0x496038);var _0x1b53bf=new History(_0x5a5b06);_0x1b53bf[_0xdbba('0xa3')]=_0x2dbd62;_0x1b53bf[_0xdbba('0xa4')]=_0x138ad2;_0x1b53bf[_0xdbba('0xa5')]=_0x5a5b06[_0xdbba('0xa6')];return _0x1b53bf;}Dialer[_0xdbba('0xa7')]['loopClearZombieChannels']=function(){var _0x14e019=this;setInterval(function(){_0x14e019[_0xdbba('0xa8')](_0x14e019[_0xdbba('0xa9')],_0xdbba('0xaa'));_0x14e019[_0xdbba('0xa8')](_0x14e019[_0xdbba('0x1f')],_0xdbba('0xab'));},0x32c8);};Dialer[_0xdbba('0xa7')]['clearZombieChannels']=function(_0x277c62,_0x5e3d99){var _0x29ec10=this;for(var _0x4e2cb7 in _0x277c62){if(_0x277c62['hasOwnProperty'](_0x4e2cb7)){this[_0xdbba('0x18')][_0xdbba('0x15')](function(){if(!_[_0xdbba('0xac')](_0x277c62[_0x4e2cb7])){return ami[_0xdbba('0xad')]({'action':_0xdbba('0xae'),'channel':_0x277c62[_0x4e2cb7][_0xdbba('0xaf')]})[_0xdbba('0xb0')](function(_0xb8e98a){if(_0xb8e98a[_0xdbba('0x37')]===_0xdbba('0xb1')){setTimeout(function(){if(_0x277c62[_0x4e2cb7]&&_0x277c62[_0x4e2cb7][_0xdbba('0x4f')]!=='ivr'){_0x29ec10[_0xdbba('0xb2')](_0x29ec10[_0xdbba('0x1a')][_0x277c62[_0x4e2cb7][_0xdbba('0xb3')]]);logger[_0xdbba('0x94')]('[Dialer][checkChannel]',_0x5e3d99,_0x4e2cb7,_0x277c62[_0x4e2cb7]['queue']);delete _0x277c62[_0x4e2cb7];}if(_0x277c62[_0x4e2cb7]&&_0x277c62[_0x4e2cb7][_0xdbba('0x4f')]===_0xdbba('0x91')){_0x29ec10['updateOriginated'](_0x29ec10[_0xdbba('0xb4')][_0x277c62[_0x4e2cb7]['queue']]);logger[_0xdbba('0x94')](_0xdbba('0xb5'),_0x5e3d99,_0x4e2cb7,_0x277c62[_0x4e2cb7][_0xdbba('0xb3')]);delete _0x277c62[_0x4e2cb7];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0xb8f43b){return BPromise[_0xdbba('0xb6')]()[_0xdbba('0xb7')](cmHopper[_0xdbba('0xb8')](_0xb8f43b))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xb9')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xba')]=function(_0x54f0bb){return BPromise['resolve']()[_0xdbba('0xb7')](cmHopperBlack['checkIsBlackList'](_0x54f0bb))['catch'](loggerCatch(_0xdbba('0xbb')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xbc')]=function(_0x5bc799){return BPromise['resolve']()[_0xdbba('0xb7')](cmHopperBlack['checkIsBlackListIvr'](_0x5bc799))['catch'](loggerCatch(_0xdbba('0xbd')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xbe')]=function(_0x55d0f7){return BPromise[_0xdbba('0xb6')]()[_0xdbba('0xb7')](cmHopperHistory[_0xdbba('0xbf')](_0x55d0f7))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xc0')));};Dialer[_0xdbba('0xa7')]['rescheduleContact']=function(_0x49b8f0){return BPromise[_0xdbba('0xb6')]()['then'](cmHopper[_0xdbba('0xc1')](_0x49b8f0))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xc2')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xc3')]=function(_0x23e85c,_0x13dc65,_0x32fcfc){return BPromise['resolve']()[_0xdbba('0xb7')](cmHopper[_0xdbba('0xc3')](_0x23e85c,_0x13dc65,_0x32fcfc))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xc4')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xc5')]=function(_0x117432,_0x6fb7ae,_0x3ae4f4,_0x50cccb){return BPromise['resolve']()['then'](cmHopper[_0xdbba('0xc5')](_0x117432,_0x6fb7ae,_0x3ae4f4,_0x50cccb))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xc6')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xc7')]=function(_0x328400,_0xf32f0,_0x55ebf3){return BPromise[_0xdbba('0xb6')]()[_0xdbba('0xb7')](cmHopper[_0xdbba('0xc7')](_0x328400,_0xf32f0,_0x55ebf3))['catch'](loggerCatch(_0xdbba('0xc6')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xc8')]=function(_0xebdfa6){return BPromise['resolve']()[_0xdbba('0xb7')](voiceQueueRt[_0xdbba('0xc8')](_0xebdfa6))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xc9')));};Dialer[_0xdbba('0xa7')][_0xdbba('0xca')]=function(_0x1296a7){return BPromise[_0xdbba('0xb6')]()['then'](cmHopper[_0xdbba('0xca')](_0x1296a7))[_0xdbba('0xb0')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xdbba('0xcb')]=function(_0x3f4b3e){return BPromise['resolve']()[_0xdbba('0xb7')](cmHopperHistory[_0xdbba('0xcb')](_0x3f4b3e))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xcc')));};Dialer['prototype']['updateOriginated']=function(_0x56e8cf){if(!_[_0xdbba('0x36')](_0x56e8cf)&&_0x56e8cf!==null){if(_0x56e8cf[_0xdbba('0xcd')]('originated')){if(_0x56e8cf[_0xdbba('0x98')]>0x0){_0x56e8cf[_0xdbba('0x98')]-=0x1;}else{logger['error'](_0xdbba('0xce'));}}}else{logger['error'](_0xdbba('0xcf'));}};Dialer['prototype'][_0xdbba('0xd0')]=function(_0x11a61e,_0x5df849){var _0x25b72a=this;return function(_0x361e9c){_0x25b72a['updateOriginated'](_0x5df849);logger[_0xdbba('0x94')](_0x11a61e,util[_0xdbba('0x95')](_0x361e9c,{'showHidden':![],'depth':null}));};};Dialer[_0xdbba('0xa7')][_0xdbba('0xd1')]=function(_0x2000ab,_0x187582,_0x5455c7){var _0x4c822a={'state':0x19,'statedesc':_0xdbba('0xd2')};this['updateOriginated'](_0x187582);this[_0xdbba('0xd3')](_[_0xdbba('0x8a')](_0x4c822a,_['pick'](_0x5455c7,[_0xdbba('0xd4'),_0xdbba('0xd5'),'UserId',_0xdbba('0xd6'),'CampaignId'])),_0xdbba('0xd7'),_0xdbba('0xd8'));logger[_0xdbba('0x94')](_0x2000ab);};Dialer[_0xdbba('0xa7')][_0xdbba('0xd9')]=function(_0x5905bd){return _0x5905bd===_0xdbba('0xda');};Dialer[_0xdbba('0xa7')][_0xdbba('0xdb')]=function(_0x536cd1){return!_[_0xdbba('0x36')](_0x536cd1)&&_0x536cd1&&!_[_0xdbba('0x36')](_0x536cd1['name'])&&!_[_0xdbba('0x36')](_0x536cd1[_0xdbba('0x71')])&&_0x536cd1[_0xdbba('0x71')]&&(this[_0xdbba('0x1c')][util[_0xdbba('0x74')](_0xdbba('0xdc'),_0x536cd1['name'])][_0xdbba('0xae')]===_0xdbba('0xdd')||this[_0xdbba('0x1c')][util[_0xdbba('0x74')]('SIP/%s',_0x536cd1['name'])][_0xdbba('0xae')]===_0xdbba('0xde'));};Dialer[_0xdbba('0xa7')]['saveInDb']=function(_0x25011d,_0x1f13a5,_0x5e4035){this[_0xdbba('0xcb')](_0x25011d)[_0xdbba('0xb0')](loggerCatch(_0x1f13a5));this[_0xdbba('0xca')](_0x25011d)[_0xdbba('0xb0')](loggerCatch(_0x5e4035));};Dialer[_0xdbba('0xa7')][_0xdbba('0x31')]=function(_0x43138a){var _0x517120=this[_0xdbba('0xa9')][_0x43138a[_0xdbba('0xdf')]];var _0x6d8c6e;if(!_[_0xdbba('0xac')](_0x43138a)&&!_[_0xdbba('0xac')](_0x43138a['variable'])&&!_[_0xdbba('0xac')](_0x43138a['variable']['amdstatus'])&&_0x43138a['exten']===_0xdbba('0xe0')&&_0x517120){if(_0x517120[_0xdbba('0x4f')]!==_0xdbba('0x91')&&this[_0xdbba('0x1a')][_0x517120['queue']][_0xdbba('0xe1')]&&_0x43138a[_0xdbba('0xe2')]==='HANGUP'){delete this[_0xdbba('0xa9')][_0x43138a[_0xdbba('0xdf')]];this[_0xdbba('0xb2')](this[_0xdbba('0x1a')][_0x517120[_0xdbba('0xb3')]]);this[_0xdbba('0x1a')][_0x517120[_0xdbba('0xb3')]][_0xdbba('0x58')]+=0x1;this[_0xdbba('0x1a')][_0x517120['queue']][_0xdbba('0x57')]+=0x1;_0x6d8c6e=new Hangup(_0x517120,_0x43138a);_0x6d8c6e[_0xdbba('0xa3')]=0x12;_0x6d8c6e[_0xdbba('0xa4')]='HangupInAMD';_0x6d8c6e[_0xdbba('0xe3')]=_0xdbba('0xe4');this['saveInDb'](_0x6d8c6e,_0xdbba('0xe5'),_0xdbba('0xe6'));}if(_0x517120['type']!==_0xdbba('0x91')&&this[_0xdbba('0x1a')][_0x517120['queue']][_0xdbba('0xe1')]&&_0x43138a[_0xdbba('0xe2')]===_0xdbba('0xe7')){var _0x52298a=this;return new BPromise(function(_0x3b7e84,_0x5d3b3a){delete _0x52298a[_0xdbba('0xa9')][_0x43138a[_0xdbba('0xdf')]];_0x52298a[_0xdbba('0xb2')](_0x52298a[_0xdbba('0x1a')][_0x517120['queue']]);_0x52298a['voiceQueues'][_0x517120[_0xdbba('0xb3')]][_0xdbba('0x58')]+=0x1;_0x52298a[_0xdbba('0x1a')][_0x517120['queue']][_0xdbba('0x57')]+=0x1;var _0x5d3fb4=_0x52298a['voiceQueues'][_0x517120[_0xdbba('0xb3')]];var _0x232111=new Hangup(_0x517120,_0x43138a);_0x232111[_0xdbba('0xa3')]=0x13;_0x232111[_0xdbba('0xa4')]=_0xdbba('0xe8');_0x232111[_0xdbba('0xe3')]=_0xdbba('0xe4');_0x232111[_0xdbba('0xe9')]+=0x1;_0x232111[_0xdbba('0xea')]+=0x1;_0x232111[_0xdbba('0xeb')]=!![];_0x52298a[_0xdbba('0xcb')](_0x232111)['catch'](loggerCatch(_0xdbba('0xec')));if(_0x232111[_0xdbba('0xed')]+_0x232111[_0xdbba('0xee')]+_0x232111[_0xdbba('0xef')]+_0x232111[_0xdbba('0xf0')]+_0x232111[_0xdbba('0xf1')]+_0x232111[_0xdbba('0xf2')]+_0x232111[_0xdbba('0xe9')]+_0x232111[_0xdbba('0xf3')]>=_0x5d3fb4[_0xdbba('0xf4')]){_0x52298a[_0xdbba('0xf5')](_0x232111,_0x3b7e84,_0x5d3b3a,_0xdbba('0xf6'));}else{if(_0x232111[_0xdbba('0xe9')]>=_0x5d3fb4[_0xdbba('0xf7')]){_0x52298a[_0xdbba('0xf8')](_0x232111,_0x3b7e84,_0x5d3b3a,_0xdbba('0xf9'));}else{_0x52298a[_0xdbba('0xc1')]({'active':![],'countmachineretry':_0x232111[_0xdbba('0xe9')],'scheduledat':moment()[_0xdbba('0xfa')](_0x5d3fb4[_0xdbba('0xfb')],_0xdbba('0xfc'))[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x232111[_0xdbba('0xd4')],'ListId':_0x232111[_0xdbba('0xd5')],'VoiceQueueId':_0x232111[_0xdbba('0xd6')]||undefined,'CampaignId':_0x232111[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xff')));_0x3b7e84({'reschedule':0x1});}}});}if(_0x517120[_0xdbba('0x4f')]==='ivr'&&this[_0xdbba('0xb4')][_0x517120[_0xdbba('0xb3')]][_0xdbba('0xe1')]&&_0x43138a[_0xdbba('0xe2')]==='HANGUP'){delete this[_0xdbba('0xa9')][_0x43138a[_0xdbba('0xdf')]];this[_0xdbba('0xb2')](this[_0xdbba('0xb4')][_0x517120[_0xdbba('0xb3')]]);_0x6d8c6e=new Hangup(_0x517120,_0x43138a);_0x6d8c6e['state']=0x12;_0x6d8c6e[_0xdbba('0xa4')]=_0xdbba('0x100');_0x6d8c6e[_0xdbba('0xe3')]=_0xdbba('0xe4');this[_0xdbba('0xd3')](_0x6d8c6e,_0xdbba('0x101'),_0xdbba('0x102'));}if(_0x517120[_0xdbba('0x4f')]===_0xdbba('0x91')&&this[_0xdbba('0xb4')][_0x517120[_0xdbba('0xb3')]][_0xdbba('0xe1')]&&_0x43138a[_0xdbba('0xe2')]===_0xdbba('0xe7')){var _0x52298a=this;return new BPromise(function(_0x23fbce,_0x5cc6ee){delete _0x52298a[_0xdbba('0xa9')][_0x43138a[_0xdbba('0xdf')]];_0x52298a[_0xdbba('0xb2')](_0x52298a['campaigns'][_0x517120[_0xdbba('0xb3')]]);_0x52298a[_0xdbba('0xb4')][_0x517120[_0xdbba('0xb3')]][_0xdbba('0x58')]+=0x1;_0x52298a[_0xdbba('0xb4')][_0x517120[_0xdbba('0xb3')]][_0xdbba('0x57')]+=0x1;var _0x423005=_0x52298a['campaigns'][_0x517120['queue']];var _0x310b51=new Hangup(_0x517120,_0x43138a);_0x310b51[_0xdbba('0xa3')]=0x13;_0x310b51[_0xdbba('0xa4')]='Machine';_0x310b51['membername']=_0xdbba('0xe4');_0x310b51[_0xdbba('0xe9')]+=0x1;_0x310b51['countglobal']+=0x1;_0x310b51[_0xdbba('0xeb')]=!![];_0x52298a['createHistory'](_0x310b51)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xec')));if(_0x310b51[_0xdbba('0xed')]+_0x310b51[_0xdbba('0xee')]+_0x310b51['countnoanswerretry']+_0x310b51[_0xdbba('0xf0')]+_0x310b51['countdropretry']+_0x310b51[_0xdbba('0xf2')]+_0x310b51[_0xdbba('0xe9')]+_0x310b51['countagentrejectretry']>=_0x423005[_0xdbba('0xf4')]){_0x52298a[_0xdbba('0xf5')](_0x310b51,_0x23fbce,_0x5cc6ee,'reason19\x20machine....');}else{if(_0x310b51['countmachineretry']>=_0x423005['dialMachineMaxRetry']){_0x52298a['createStateFinal'](_0x310b51,_0x23fbce,_0x5cc6ee,_0xdbba('0xf9'));}else{_0x52298a[_0xdbba('0xc1')]({'active':![],'countmachineretry':_0x310b51[_0xdbba('0xe9')],'scheduledat':moment()['add'](_0x423005['dialMachineRetryFrequency'],'minutes')['format'](_0xdbba('0xfd')),'ContactId':_0x310b51[_0xdbba('0xd4')],'ListId':_0x310b51[_0xdbba('0xd5')],'VoiceQueueId':_0x310b51['VoiceQueueId']||undefined,'CampaignId':_0x310b51[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xff')));_0x23fbce({'reschedule':0x1});}}});}}};Dialer[_0xdbba('0xa7')][_0xdbba('0x2d')]=function(_0x40080d){var _0x2ac46b=this[_0xdbba('0xa9')][_0x40080d['uniqueid']];var _0x36f6c5=this;var _0x3050b3;if(_0x2ac46b&&_0x2ac46b[_0xdbba('0x4f')]===_0xdbba('0x91')){delete this['uniqueId'][_0x40080d[_0xdbba('0xdf')]];this[_0xdbba('0xb2')](this[_0xdbba('0xb4')][_0x2ac46b[_0xdbba('0xb3')]]);this[_0xdbba('0xb4')][_0x2ac46b[_0xdbba('0xb3')]]['ivrAnswerCallsDay']+=0x1;_0x3050b3=new Hangup(_0x2ac46b,_0x40080d);this[_0xdbba('0xcb')](_0x3050b3)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x103')));this[_0xdbba('0xca')](_0x3050b3)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x104')));}if(_0x2ac46b&&_0x2ac46b['type']!==_0xdbba('0x91')&&isNotNull(this[_0xdbba('0x1a')][_0x2ac46b['queue']][_0xdbba('0x105')])){delete this[_0xdbba('0xa9')][_0x40080d[_0xdbba('0xdf')]];this[_0xdbba('0xb2')](this[_0xdbba('0x1a')][_0x2ac46b[_0xdbba('0xb3')]]);this['voiceQueues'][_0x2ac46b[_0xdbba('0xb3')]][_0xdbba('0x58')]+=0x1;this['voiceQueues'][_0x2ac46b[_0xdbba('0xb3')]][_0xdbba('0x57')]+=0x1;_0x3050b3=new Hangup(_0x2ac46b,_0x40080d);_0x3050b3[_0xdbba('0xa3')]=0x10;_0x3050b3['statedesc']='AnswerAGI';_0x3050b3['membername']=_0xdbba('0x106');this[_0xdbba('0xcb')](_0x3050b3)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x103')));this['moveContactManagedDialer'](_0x3050b3)[_0xdbba('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x2ac46b&&_0x2ac46b['type']!==_0xdbba('0x91')&&!isNotNull(this[_0xdbba('0x1a')][_0x2ac46b['queue']][_0xdbba('0x105')])){delete this[_0xdbba('0xa9')][_0x40080d[_0xdbba('0xdf')]];this[_0xdbba('0xb2')](this[_0xdbba('0x1a')][_0x2ac46b[_0xdbba('0xb3')]]);this[_0xdbba('0x1a')][_0x2ac46b[_0xdbba('0xb3')]][_0xdbba('0x63')]+=0x1;_0x3050b3=new Hangup(_0x2ac46b,_0x40080d);_0x3050b3['state']=0xc;_0x3050b3[_0xdbba('0xa4')]=_0x40080d[_0xdbba('0x107')];_0x3050b3[_0xdbba('0xe3')]='Unknow';this[_0xdbba('0xcb')](_0x3050b3)['catch'](loggerCatch(_0xdbba('0x103')));this[_0xdbba('0xca')](_0x3050b3)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x104')));}};Dialer[_0xdbba('0xa7')][_0xdbba('0x2a')]=function(_0x43f4c0){var _0x3434e6=this[_0xdbba('0xa9')][_0x43f4c0['uniqueid']];var _0x5aa1dd=this;if(this[_0xdbba('0x1a')][_0x43f4c0['queue']]){if(_0x3434e6&&_0x3434e6[_0xdbba('0x4f')]!==_0xdbba('0x91')){delete this[_0xdbba('0xa9')][_0x43f4c0['uniqueid']];this[_0xdbba('0x1a')][_0x43f4c0[_0xdbba('0xb3')]][_0xdbba('0x58')]+=0x1;var _0x3e5f5b=new AgentComplete(_0x3434e6,_0x43f4c0);if(_0x43f4c0['reason']===_0xdbba('0x108')){_0x3e5f5b['agiafterat']=this['voiceQueues'][_0x43f4c0[_0xdbba('0xb3')]][_0xdbba('0x109')]&&this[_0xdbba('0x1a')][_0x43f4c0[_0xdbba('0xb3')]]['dialAgiAfterHangupAgent']?moment()[_0xdbba('0x74')](_0xdbba('0xfd')):undefined;}this[_0xdbba('0xcb')](_0x3e5f5b)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x10a')));this[_0xdbba('0xca')](_0x3e5f5b)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x10b')));}}};Dialer[_0xdbba('0xa7')][_0xdbba('0x26')]=function(_0x40e37a){if(this['voiceQueues'][_0x40e37a[_0xdbba('0xb3')]]){if(this[_0xdbba('0xa9')][_0x40e37a[_0xdbba('0xdf')]]&&this[_0xdbba('0xa9')][_0x40e37a[_0xdbba('0xdf')]][_0xdbba('0x4f')]!=='ivr'){this[_0xdbba('0xb2')](this[_0xdbba('0x1a')][_0x40e37a['queue']]);this[_0xdbba('0xa9')][_0x40e37a[_0xdbba('0xdf')]][_0xdbba('0x10c')]=moment()[_0xdbba('0x74')](_0xdbba('0xfd'));}}};Dialer[_0xdbba('0xa7')][_0xdbba('0x10d')]=function(_0x47baef){this[_0xdbba('0xcb')](_0x47baef)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x10a')));this[_0xdbba('0xca')](_0x47baef)['catch'](loggerCatch(_0xdbba('0x10e')));};Dialer['prototype'][_0xdbba('0x28')]=function(_0x3d9b5e){var _0x34adf9=this[_0xdbba('0xa9')][_0x3d9b5e[_0xdbba('0xdf')]];var _0x851e50=this;if(this['voiceQueues'][_0x3d9b5e[_0xdbba('0xb3')]]){if(_0x34adf9&&_0x34adf9['type']!==_0xdbba('0x91')){delete this[_0xdbba('0xa9')][_0x3d9b5e[_0xdbba('0xdf')]];this[_0xdbba('0xb2')](this['voiceQueues'][_0x3d9b5e[_0xdbba('0xb3')]]);_0x34adf9[_0xdbba('0x10f')]=moment()[_0xdbba('0x74')](_0xdbba('0xfd'));var _0x384ea6=new QueueCallerAbandon(_0x34adf9,_0x3d9b5e);if(getSeconds(_0x34adf9[_0xdbba('0x10f')],_0x34adf9[_0xdbba('0x110')])>=_0x34adf9[_0xdbba('0x111')]){this['voiceQueues'][_0x3d9b5e[_0xdbba('0xb3')]][_0xdbba('0x67')]+=0x1;this[_0xdbba('0x1a')][_0x3d9b5e[_0xdbba('0xb3')]][_0xdbba('0x5d')]+=0x1;this[_0xdbba('0x1a')][_0x3d9b5e[_0xdbba('0xb3')]][_0xdbba('0x69')]+=0x1;_0x384ea6['state']=0xa;_0x384ea6[_0xdbba('0xa4')]=_0xdbba('0x112');_0x384ea6[_0xdbba('0x113')]=_0xdbba('0x114');_0x384ea6[_0xdbba('0x115')]=this[_0xdbba('0x1a')][_0x3d9b5e['queue']][_0xdbba('0x109')]?moment()[_0xdbba('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x384ea6[_0xdbba('0xf1')]+=0x1;_0x384ea6[_0xdbba('0xea')]+=0x1;if(_0x384ea6['countdropretry']>=this['voiceQueues'][_0x3d9b5e[_0xdbba('0xb3')]][_0xdbba('0x116')]){this[_0xdbba('0x10d')](_0x384ea6);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x384ea6['countdropretry'],'scheduledat':moment()[_0xdbba('0xfa')](this[_0xdbba('0x1a')][_0x3d9b5e[_0xdbba('0xb3')]][_0xdbba('0x117')],_0xdbba('0xfc'))[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x34adf9[_0xdbba('0xd4')],'ListId':_0x34adf9[_0xdbba('0xd5')],'VoiceQueueId':_0x34adf9[_0xdbba('0xd6')]||undefined,'CampaignId':_0x34adf9['CampaignId']||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x118')));var _0x4b408c=new History(_0x384ea6);_0x4b408c[_0xdbba('0xa3')]=0xa;_0x4b408c[_0xdbba('0xa4')]='Drop';_0x4b408c['starttime']=moment()[_0xdbba('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b408c[_0xdbba('0xa5')]=_0x4b408c[_0xdbba('0xa6')];_0x4b408c[_0xdbba('0x119')]=_0x384ea6[_0xdbba('0x119')];_0x4b408c[_0xdbba('0x11a')]=_0x384ea6[_0xdbba('0x11a')];this[_0xdbba('0xcb')](_0x4b408c)[_0xdbba('0xb0')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xdbba('0x1a')][_0x3d9b5e[_0xdbba('0xb3')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xdbba('0x1a')][_0x3d9b5e['queue']][_0xdbba('0x5c')]+=0x1;_0x384ea6[_0xdbba('0xa3')]=0xb;_0x384ea6[_0xdbba('0xa4')]='Abandoned';_0x384ea6[_0xdbba('0x113')]=_0xdbba('0x11b');_0x384ea6[_0xdbba('0xf2')]+=0x1;_0x384ea6[_0xdbba('0xea')]+=0x1;if(_0x384ea6['countabandonedretry']>=this['voiceQueues'][_0x3d9b5e[_0xdbba('0xb3')]][_0xdbba('0x11c')]){this[_0xdbba('0x10d')](_0x384ea6);}else{this[_0xdbba('0xc1')]({'active':![],'countabandonedretry':_0x384ea6[_0xdbba('0xf2')],'scheduledat':moment()[_0xdbba('0xfa')](this[_0xdbba('0x1a')][_0x3d9b5e[_0xdbba('0xb3')]]['dialAbandonedRetryFrequency'],_0xdbba('0xfc'))[_0xdbba('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34adf9[_0xdbba('0xd4')],'ListId':_0x34adf9['ListId'],'VoiceQueueId':_0x34adf9['VoiceQueueId']||undefined,'CampaignId':_0x34adf9[_0xdbba('0xfe')]||undefined})['catch'](loggerCatch(_0xdbba('0x11d')));var _0x4b408c=new History(_0x384ea6);_0x4b408c[_0xdbba('0xa3')]=0xb;_0x4b408c[_0xdbba('0xa4')]='Abandoned';_0x4b408c[_0xdbba('0xa6')]=moment()[_0xdbba('0x74')](_0xdbba('0xfd'));_0x4b408c[_0xdbba('0xa5')]=_0x4b408c[_0xdbba('0xa6')];_0x4b408c['calleridname']=_0x384ea6[_0xdbba('0x119')];_0x4b408c[_0xdbba('0x11a')]=_0x384ea6[_0xdbba('0x11a')];this[_0xdbba('0xcb')](_0x4b408c)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x11e')));}}}}};Dialer[_0xdbba('0xa7')][_0xdbba('0x2f')]=function(_0x413307){if(this[_0xdbba('0x1f')][_0x413307[_0xdbba('0xdf')]]){this[_0xdbba('0x1f')][_0x413307[_0xdbba('0xdf')]][_0xdbba('0xaf')]=_0x413307['channel'];}if(this['uniqueId'][_0x413307[_0xdbba('0xdf')]]){this[_0xdbba('0xa9')][_0x413307[_0xdbba('0xdf')]][_0xdbba('0xaf')]=_0x413307['channel'];}};Dialer[_0xdbba('0xa7')][_0xdbba('0x11f')]=function(_0x11ba73){if(strategy[this[_0xdbba('0x1a')][this['actions'][_0x11ba73[_0xdbba('0x120')]][_0xdbba('0xb3')]]['strategy']]===_0xdbba('0x14')){if(this[_0xdbba('0x1f')][_0x11ba73[_0xdbba('0x120')]]&&_[_0xdbba('0xac')](this['actions'][_0x11ba73[_0xdbba('0x120')]]['locked'])&&_0x11ba73['status']==='1'&&_0x11ba73[_0xdbba('0x121')]==='0'){if(this[_0xdbba('0x1b')][_0x11ba73['stateinterface']]){if(!this[_0xdbba('0x1b')][_0x11ba73[_0xdbba('0x122')]][_0xdbba('0x123')]){this[_0xdbba('0x1b')][_0x11ba73[_0xdbba('0x122')]][_0xdbba('0x123')]=!![];this[_0xdbba('0x1f')][_0x11ba73[_0xdbba('0x120')]][_0xdbba('0x123')]=!![];this[_0xdbba('0x1f')][_0x11ba73[_0xdbba('0x120')]][_0xdbba('0x122')]=_0x11ba73[_0xdbba('0x122')];}}}}else if((strategy[this[_0xdbba('0x1a')][this[_0xdbba('0x1f')][_0x11ba73['actionid']][_0xdbba('0xb3')]]['strategy']]||'rrmemory')===_0xdbba('0x124')){if(this['actions'][_0x11ba73['actionid']]){if(this[_0xdbba('0x1b')][_0x11ba73[_0xdbba('0x122')]]){this[_0xdbba('0x1f')][_0x11ba73['actionid']][_0xdbba('0x122')]=_0x11ba73[_0xdbba('0x122')];if(_[_0xdbba('0xac')](this['queueBooked'][this[_0xdbba('0x1f')][_0x11ba73[_0xdbba('0x120')]]['queue']])){this[_0xdbba('0x23')][this[_0xdbba('0x1f')][_0x11ba73[_0xdbba('0x120')]]['queue']]=[];}this['queueBooked'][this['actions'][_0x11ba73[_0xdbba('0x120')]][_0xdbba('0xb3')]][_0xdbba('0x125')](_[_0xdbba('0x8a')](_['pick'](this[_0xdbba('0x1f')][_0x11ba73[_0xdbba('0x120')]],[_0xdbba('0x126'),_0xdbba('0x122')]),{'status':_0x11ba73['status'],'paused':_0x11ba73[_0xdbba('0x121')]}));}}}};function unlockQueueStatus(_0x167540,_0x449f36){setTimeout(function(){if(_[_0xdbba('0x36')](_0x167540[_0xdbba('0x127')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x449f36);}_0x167540[_0xdbba('0x127')]=!![];loggerBooked[_0xdbba('0x78')](_0xdbba('0x128'),_0x449f36,JSON['stringify'](_['pick'](_0x167540,[_0xdbba('0x3b'),_0xdbba('0x127')])));},0x1f3);}Dialer[_0xdbba('0xa7')][_0xdbba('0x129')]=function(_0x2d5582){var _0x13c74b=this;var _0x518304=_0x13c74b['voiceQueues'][_0x13c74b['actions'][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]];if(strategy[this[_0xdbba('0x1a')][this[_0xdbba('0x1f')][_0x2d5582['actionid']]['queue']][_0xdbba('0x47')]]===_0xdbba('0x14')){if(this[_0xdbba('0x1f')][_0x2d5582['actionid']]&&this['actions'][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0x122')]){this[_0xdbba('0x19')]['run'](this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0x126')],this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0x122')])[_0xdbba('0xb0')](function(_0xbf84d1){logger[_0xdbba('0x94')](_0xdbba('0x12a'),util[_0xdbba('0x95')](_0xbf84d1,{'showHidden':![],'depth':null}));})['finally'](function(){_0x13c74b['updateOriginated'](_0x13c74b['voiceQueues'][_0x13c74b[_0xdbba('0x1f')][_0x2d5582['actionid']][_0xdbba('0xb3')]]);_0x13c74b[_0xdbba('0x1b')][_0x13c74b[_0xdbba('0x1f')][_0x2d5582['actionid']]['stateinterface']][_0xdbba('0x123')]=![];delete _0x13c74b[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]];unlockQueueStatus(_0x518304);});}else{this[_0xdbba('0xb2')](this[_0xdbba('0x1a')][this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xd4')],'ListId':this['actions'][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xd5')],'VoiceQueueId':this[_0xdbba('0x1f')][_0x2d5582['actionid']][_0xdbba('0xd6')]||undefined,'CampaignId':this['actions'][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xdbba('0x1f')][_0x2d5582['actionid']];unlockQueueStatus(_0x518304);}}else if((strategy[this[_0xdbba('0x1a')][this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]][_0xdbba('0x47')]]||'rrmemory')===_0xdbba('0x124')){var _0x2bf836;if(this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]]&&!_[_0xdbba('0x40')](this[_0xdbba('0x23')][this[_0xdbba('0x1f')][_0x2d5582['actionid']][_0xdbba('0xb3')]])){if(this['queueBookedRR'][_0x13c74b[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]]){this[_0xdbba('0x24')][_0x13c74b[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]]=this['queueBookedRR'][this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]]?this['queueBookedRR'][this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]]:this[_0xdbba('0x23')][this[_0xdbba('0x1f')][_0x2d5582['actionid']][_0xdbba('0xb3')]]?this['queueBooked'][this[_0xdbba('0x1f')][_0x2d5582[_0xdbba('0x120')]][_0xdbba('0xb3')]][_0xdbba('0x12b')]||0x0:0x0;}this[_0xdbba('0x23')][this[_0xdbba('0x1f')][_0x2d5582['actionid']][_0xdbba('0xb3')]][_0xdbba('0x12b')]=this['queueBookedRR'][this['actions'][_0x2d5582[_0xdbba('0x120')]]['queue']];for(var _0x2af561=0x0;_0x2af561=0x0?!![]:![];})['catch'](myreject(_0x137fe6)));}}else{_0x1e6c6a[_0xdbba('0x125')](ami['Action']({'action':_0xdbba('0x147'),'command':util[_0xdbba('0x74')](_0xdbba('0x14c'),_0x3c434d,!_['isUndefined'](config[_0xdbba('0x144')][_0x43afac])?_0x43afac:'')})[_0xdbba('0xb7')](function(_0x3ff637){return _0x3ff637[_0xdbba('0x149')][_0xdbba('0x14a')]('true')>=0x0?!![]:![];})[_0xdbba('0xb0')](myreject(_0x137fe6)));}BPromise[_0xdbba('0x14d')](_0x1e6c6a)[_0xdbba('0xb7')](function(_0x32084d){var _0x185888=_[_0xdbba('0x14e')](_0x32084d);if(_0x185888){return _0x3ea488(_0x185888);}else{_0x164d1a[_0xdbba('0x37')]=_0x2a5a28?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x137fe6(msgResponse(_0xdbba('0x14f'),'Failure','Global:\x20'+_0x2a5a28+'\x20'+_0x2ad505+_0xdbba('0x150')+util['inspect'](_0x3c434d,{'showHidden':![],'depth':null})+_0xdbba('0x151')+_0x43afac));}})[_0xdbba('0xb0')](function(_0x401828){return _0x137fe6(msgResponse('ifTime',_0xdbba('0x141'),JSON['stringify'](_0x401828)));});});};Dialer[_0xdbba('0xa7')][_0xdbba('0x152')]=function(_0x471b04){var _0x2e0b69=this;return function(){switch(_0x471b04[_0xdbba('0x54')]){case _0xdbba('0x153'):freeVariablesPredictive(_0x471b04);_0x2e0b69[_0xdbba('0x154')](_0x471b04,0x1);break;case _0xdbba('0x155'):freeVariablesPredictive(_0x471b04);_0x2e0b69[_0xdbba('0x154')](_0x471b04,_0x471b04[_0xdbba('0x156')]);break;case _0xdbba('0x7'):_0x2e0b69['predictive'](_0x471b04);break;case _0xdbba('0x6'):freeVariablesPredictive(_0x471b04);_0x2e0b69[_0xdbba('0x154')](_0x471b04,0x1);break;default:freeVariablesPredictive(_0x471b04);logger['error'](_0xdbba('0x157'),_0x471b04[_0xdbba('0x3b')],_0xdbba('0x158'));}};};Dialer[_0xdbba('0xa7')][_0xdbba('0x159')]=function(_0x1e606f){var _0x2d8bcf=this;return function(){_0x2d8bcf[_0xdbba('0x15a')](_0x1e606f);};};Dialer[_0xdbba('0xa7')]['syncQueueSummary']=function(_0x1fef43){var _0x515847=this;if(isNotPreview(_0x1fef43[_0xdbba('0x54')])){if(isVoiceQueueOutbound(_0x1fef43[_0xdbba('0x4f')])&&isActive(_0x1fef43[_0xdbba('0x53')])){_0x1fef43['sendMessageOneNotActive']=!![];BPromise[_0xdbba('0xb6')]()['then'](checkIsLoggedIn(_0x1fef43,_0x1fef43['loggedIn']))[_0xdbba('0xb7')](checkIsActive(_0x1fef43,_0x1fef43[_0xdbba('0x53')]))[_0xdbba('0xb7')](checkInterval(_0x1fef43))[_0xdbba('0xb7')](_0x515847[_0xdbba('0x13a')](_0x1fef43))[_0xdbba('0xb7')](_0x515847[_0xdbba('0x13e')](_0x1fef43[_0xdbba('0x15b')],_0x1fef43['dialTimezone'],_0x1fef43[_0xdbba('0x3b')],_0x1fef43))[_0xdbba('0xb7')](_0x515847[_0xdbba('0x13f')](_0x1fef43[_0xdbba('0x3f')],_0x1fef43[_0xdbba('0x15c')],_0x1fef43[_0xdbba('0x3b')],_0x1fef43))['then'](_0x515847[_0xdbba('0x152')](_0x1fef43))['catch'](loggerCatchQueueSummary(_0xdbba('0x15d'),_0x1fef43));}else{notSendMessagesQueue(_0x1fef43);}}else{freeVariablesPredictive(_0x1fef43);}};Dialer[_0xdbba('0xa7')][_0xdbba('0x139')]=function(){var _0x4f9002=this;var _0x5d2d97;for(var _0x3f546e in this['campaigns']){if(this['campaigns']['hasOwnProperty'](_0x3f546e)){_0x5d2d97=this['campaigns'][_0x3f546e];if(isCampaignIvr(_0x5d2d97[_0xdbba('0x4f')])&&isActive(_0x5d2d97[_0xdbba('0x71')])){_0x5d2d97[_0xdbba('0x9f')]=!![];BPromise[_0xdbba('0xb6')]()[_0xdbba('0xb7')](checkIsActive(_0x5d2d97,_0x5d2d97[_0xdbba('0x71')]))['then'](checkInterval(_0x5d2d97))[_0xdbba('0xb7')](_0x4f9002[_0xdbba('0x13a')](_0x5d2d97))[_0xdbba('0xb7')](_0x4f9002['checkIfTime'](_0x5d2d97[_0xdbba('0x15b')],_0x5d2d97['dialTimezone'],_0x5d2d97[_0xdbba('0x3b')],_0x5d2d97))[_0xdbba('0xb7')](_0x4f9002[_0xdbba('0x13f')](_0x5d2d97[_0xdbba('0x3f')],_0x5d2d97[_0xdbba('0x15c')],_0x5d2d97['name'],_0x5d2d97))[_0xdbba('0xb7')](_0x4f9002[_0xdbba('0x159')](_0x5d2d97))[_0xdbba('0xb0')](loggerCatchQueueSummary('[syncCampaigns]',_0x5d2d97));}else{notSendMessagesCampaign(_0x5d2d97);}}}};function getCallerIdRandom(_0x8b378e,_0x53dd99){var _0x1e6372,_0x296b00,_0x17f5fb;if(_0x53dd99<=0x0){_0x53dd99=0x1;}_0x1e6372=new RegExp(_0xdbba('0x15e')+_0x53dd99+'}$');_0x296b00=Math[_0xdbba('0x15f')](0xa,_0x53dd99-0x1);_0x17f5fb=Math[_0xdbba('0x15f')](0xa,_0x53dd99)-0x1;return util[_0xdbba('0x74')]('%s',_['replace'](_0x8b378e,_0x1e6372,_[_0xdbba('0x160')](_0x296b00,_0x17f5fb)));}function extractCalleridName(_0x286a67){var _0x5cfa3b=_0x286a67['match'](/"(.*?)"/);return _0x5cfa3b?_0x5cfa3b[0x1]:_0x286a67;}function extractCalleridNumber(_0x12b14a){var _0x4b4eef=_0x12b14a[_0xdbba('0x161')](/<(.*?)>/);return _0x4b4eef?_0x4b4eef[0x1]:_0x12b14a;}Dialer[_0xdbba('0xa7')][_0xdbba('0x162')]=function(_0x16d84e,_0xe2cd8d){var _0xbeb5cf=this;var _0x3c64f5=uuid['v4']();this[_0xdbba('0x1f')][_0x3c64f5]=new Action(_0x16d84e,_0xe2cd8d,_0x3c64f5);return new BPromise(function(_0x3d04bc,_0x4b98a2){if(_[_0xdbba('0x36')](_0x16d84e)&&'object'!==typeof _0x16d84e){return _0x4b98a2(msgResponse(_0xdbba('0x163'),_0xdbba('0x141'),_0xdbba('0x164')));}if(_[_0xdbba('0x36')](_0xe2cd8d[_0xdbba('0x165')]['phone'])||_0xe2cd8d['Contact'][_0xdbba('0x166')]===null){return _0x4b98a2(msgResponse(_0xdbba('0x163'),'Failure',_0xdbba('0x167')));}var _0x460677={'XMD-CALLERID':_0xbeb5cf['actions'][_0x3c64f5][_0xdbba('0x168')](),'XMD-AGI':_0x16d84e['dialQueueProject']?util[_0xdbba('0x74')]('\x22agi://%s/square,%s\x22',ipAgi,_0x16d84e['dialQueueProject']):_0xdbba('0x169'),'XMD-AGIAFTER':_0x16d84e[_0xdbba('0x109')]?util[_0xdbba('0x74')](_0xdbba('0x16a'),ipAgi,_0x16d84e[_0xdbba('0x109')]):_0xdbba('0x169'),'XMD-QUEUE':_0x16d84e[_0xdbba('0x4f')]===_0xdbba('0x90')?util[_0xdbba('0x74')]('\x22%s,%s%s,,,%s\x22',_0x16d84e[_0xdbba('0x3b')],_0x16d84e[_0xdbba('0x16b')]||'',_0x16d84e['dialAgiAfterHangupAgent']?'c':'',_0x16d84e[_0xdbba('0x111')]||0x3):'NONE','XMD-CONTACTID':_0xe2cd8d['ContactId'],'XMD-CDRTYPE':_0xdbba('0x16c'),'CALLERID(all)':_0xbeb5cf[_0xdbba('0x1f')][_0x3c64f5][_0xdbba('0x168')](),'XMD-AMD':_0x16d84e['dialAMDActive']?_0xdbba('0x16d'):_0xdbba('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x16d84e[_0xdbba('0xe1')]){_0x460677[_0xdbba('0x16e')]=_0x16d84e[_0xdbba('0x16f')]||0x9c4;_0x460677[_0xdbba('0x170')]=_0x16d84e[_0xdbba('0x171')]||0x5dc;_0x460677['XMD-AMDAFTERGREETINGSILENCE']=_0x16d84e[_0xdbba('0x172')]||0x320;_0x460677[_0xdbba('0x173')]=_0x16d84e[_0xdbba('0x174')]||0x1388;_0x460677[_0xdbba('0x175')]=_0x16d84e[_0xdbba('0x176')]||0x64;_0x460677[_0xdbba('0x177')]=_0x16d84e['dialAMDBetweenWordsSilence']||0x32;_0x460677['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x16d84e[_0xdbba('0x178')]||0x3;_0x460677[_0xdbba('0x179')]=_0x16d84e[_0xdbba('0x17a')]||0x100;_0x460677[_0xdbba('0x17b')]=_0x16d84e[_0xdbba('0x17c')]||0x1388;}if(_0x16d84e[_0xdbba('0x4f')]==='outbound'){_0x460677[_0xdbba('0x17d')]=_0xe2cd8d[_0xdbba('0xd6')];}else{_0x460677[_0xdbba('0x17e')]=_0xe2cd8d[_0xdbba('0xfe')];}for(var _0x21bc89 in _0xe2cd8d[_0xdbba('0x165')]){if(_0xe2cd8d['Contact'][_0xdbba('0xcd')](_0x21bc89)){if(isNotNull(_0xe2cd8d[_0xdbba('0x165')][_0x21bc89])&&_0x21bc89!=='id'&&_0x21bc89!==_0xdbba('0x17f')&&_0x21bc89!==_0xdbba('0x180')&&_0x21bc89!==_0xdbba('0x181')){_0x460677[util[_0xdbba('0x74')]('%s%s',_0xdbba('0x182'),_['toUpper'](_0x21bc89))]=_0xe2cd8d['Contact'][_0x21bc89];}}}var _0x557365=_0xbeb5cf['isTrunkReachable'](_0x16d84e[_0xdbba('0x70')])?getCallerId(_0x16d84e['Trunk']['callerid'],_0x16d84e['dialOriginateCallerIdName'],_0x16d84e[_0xdbba('0x183')]>0x0?getCallerIdRandom(_0x16d84e[_0xdbba('0x184')],_0x16d84e['dialRandomLastDigitCallerIdNumber']):_0x16d84e[_0xdbba('0x184')]):getCallerId(_[_0xdbba('0xac')](_0x16d84e[_0xdbba('0x13b')])?_0x16d84e[_0xdbba('0x70')][_0xdbba('0x72')]:_0x16d84e[_0xdbba('0x13b')][_0xdbba('0x72')],_0x16d84e[_0xdbba('0x55')],_0x16d84e[_0xdbba('0x183')]>0x0?getCallerIdRandom(_0x16d84e['dialOriginateCallerIdNumber'],_0x16d84e[_0xdbba('0x183')]):_0x16d84e[_0xdbba('0x184')]);if(_0x557365){_0x460677[_0xdbba('0x185')]=_0xbeb5cf[_0xdbba('0x1f')][_0x3c64f5][_0xdbba('0x186')]=extractCalleridName(_0x557365);_0x460677[_0xdbba('0x187')]=_0xbeb5cf[_0xdbba('0x1f')][_0x3c64f5][_0xdbba('0x188')]=extractCalleridNumber(_0x557365);}return ami[_0xdbba('0xad')]({'actionid':_0x3c64f5,'action':'originate','channel':_0xbeb5cf[_0xdbba('0xdb')](_0x16d84e['Trunk'])?util[_0xdbba('0x74')](_0xdbba('0x189'),_0x16d84e[_0xdbba('0x70')][_0xdbba('0x3b')],isNotNull(_0x16d84e[_0xdbba('0x56')])?_0x16d84e[_0xdbba('0x56')][_0xdbba('0x18a')]()||'':'',_0x16d84e[_0xdbba('0x18b')]>0x0?_0xe2cd8d[_0xdbba('0x165')]['phone']['substring'](_0x16d84e[_0xdbba('0x18b')]):_0xe2cd8d[_0xdbba('0x165')][_0xdbba('0x166')]):util[_0xdbba('0x74')](_0xdbba('0x189'),_['isNil'](_0x16d84e[_0xdbba('0x13b')])?_0x16d84e[_0xdbba('0x70')][_0xdbba('0x3b')]:_0x16d84e['TrunkBackup'][_0xdbba('0x3b')],isNotNull(_0x16d84e['dialPrefix'])?_0x16d84e[_0xdbba('0x56')][_0xdbba('0x18a')]()||'':'',_0x16d84e[_0xdbba('0x18b')]>0x0?_0xe2cd8d[_0xdbba('0x165')]['phone']['substring'](_0x16d84e[_0xdbba('0x18b')]):_0xe2cd8d['Contact'][_0xdbba('0x166')]),'callerid':_0x557365,'Exten':_0xdbba('0xe0'),'Context':'from-sip','Priority':'1','variable':_0x460677,'timeout':(_0x16d84e[_0xdbba('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c64f5})[_0xdbba('0xb7')](function(_0x14b147){return _0x3d04bc(_0x14b147);})[_0xdbba('0xb0')](function(_0x24c93c){_0x16d84e[_0xdbba('0x60')]+=0x1;var _0x1e227a=new History(_0xbeb5cf['actions'][_0x3c64f5]);logger[_0xdbba('0x94')](util['format'](_0xdbba('0x18d'),JSON[_0xdbba('0x43')](_0x24c93c)));_0x1e227a[_0xdbba('0xa3')]=0xe;_0x1e227a['statedesc']=_0xdbba('0x18e');_0x1e227a['starttime']=moment()[_0xdbba('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e227a[_0xdbba('0xa5')]=_0x1e227a[_0xdbba('0xa6')];_0xbeb5cf[_0xdbba('0xcb')](_0x1e227a)['catch'](loggerCatch(_0xdbba('0x18f')));_0xbeb5cf[_0xdbba('0xca')](_0x1e227a)['catch'](loggerCatch('[originate][error]'))[_0xdbba('0x17')](function(){delete _0xbeb5cf['actions'][_0x3c64f5];return _0x4b98a2(msgResponse('originate',_0xdbba('0x190'),_0xdbba('0x191')));});});});};Dialer[_0xdbba('0xa7')]['syncOriginateResponse']=function(_0x51e1ec){var _0x2f94a6=this[_0xdbba('0x1f')][_0x51e1ec[_0xdbba('0x120')]];var _0x2e0f4f=this;if(_0x2f94a6){delete this[_0xdbba('0x1f')][_0x51e1ec[_0xdbba('0x120')]];_0x2f94a6[_0xdbba('0x110')]=moment()['format'](_0xdbba('0xfd'));var _0x2c55dd=_0x2f94a6[_0xdbba('0x4f')]===_0xdbba('0x91')?this[_0xdbba('0xb4')][_0x2f94a6['queue']]:this[_0xdbba('0x1a')][_0x2f94a6[_0xdbba('0x192')]()];if(!this['isSuccess'](_0x51e1ec['response'])){this[_0xdbba('0xb2')](_0x2c55dd);return this[_0xdbba('0x193')](_0x2f94a6,_0x2c55dd,_0x51e1ec)[_0xdbba('0xb7')](function(_0x41b3e5){})[_0xdbba('0xb0')](loggerCatch('[callProgressDetecting]\x20'));}else{this['uniqueId'][_0x51e1ec[_0xdbba('0xdf')]]=_0x2f94a6;}}};Dialer[_0xdbba('0xa7')][_0xdbba('0x194')]=function(_0x7b4ca0,_0x7b35a3,_0x1748eb){var _0x1973a5=new History(_0x7b35a3);if(_0x1973a5[_0xdbba('0xed')]+_0x1973a5[_0xdbba('0xee')]+_0x1973a5['countnoanswerretry']+_0x1973a5[_0xdbba('0xf0')]+_0x1973a5[_0xdbba('0xf1')]+_0x1973a5[_0xdbba('0xf2')]+_0x1973a5[_0xdbba('0xe9')]+_0x1973a5[_0xdbba('0xf3')]>=_0x1748eb[_0xdbba('0xf4')]-0x1){return!![];}switch(_0x7b4ca0){case 0x3:if(_0x1973a5[_0xdbba('0xef')]>=_0x1748eb[_0xdbba('0x195')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x1973a5['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x1748eb['dialNoAnswerRetryFrequency'],'minutes')[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x1973a5['ContactId'],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x196')));}break;case 0x5:if(_0x1973a5['countbusyretry']>=_0x1748eb[_0xdbba('0x197')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x1973a5[_0xdbba('0xed')]+=0x1,'scheduledat':moment()[_0xdbba('0xfa')](_0x1748eb[_0xdbba('0x198')],_0xdbba('0xfc'))[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x1973a5[_0xdbba('0xd4')],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x199')));}break;case 0x8:if(_0x1973a5[_0xdbba('0xee')]>=_0x1748eb[_0xdbba('0x19a')]-0x1){return!![];}else{this[_0xdbba('0xc1')]({'active':![],'countcongestionretry':_0x1973a5[_0xdbba('0xee')]+=0x1,'scheduledat':moment()['add'](_0x1748eb[_0xdbba('0x19b')],'minutes')[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x1973a5[_0xdbba('0xd4')],'ListId':_0x1973a5['ListId'],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})['catch'](loggerCatch(_0xdbba('0x19c')));}break;case 0x0:if(_0x1973a5[_0xdbba('0xf0')]>=_0x1748eb[_0xdbba('0x19d')]-0x1){return!![];}else{this[_0xdbba('0xc1')]({'active':![],'countnosuchnumberretry':_0x1973a5[_0xdbba('0xf0')]+=0x1,'scheduledat':moment()[_0xdbba('0xfa')](_0x1748eb['dialNoSuchNumberRetryFrequency'],_0xdbba('0xfc'))['format'](_0xdbba('0xfd')),'ContactId':_0x1973a5['ContactId'],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x19e')));}break;case 0xa:if(_0x1973a5[_0xdbba('0xf1')]>=_0x1748eb[_0xdbba('0x116')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1973a5[_0xdbba('0xf1')]+=0x1,'scheduledat':moment()[_0xdbba('0xfa')](_0x1748eb[_0xdbba('0x117')],_0xdbba('0xfc'))[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x1973a5[_0xdbba('0xd4')],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x1973a5[_0xdbba('0xf2')]>=_0x1748eb[_0xdbba('0x11c')]-0x1){return!![];}else{this[_0xdbba('0xc1')]({'active':![],'countabandonedretry':_0x1973a5['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x1748eb[_0xdbba('0x19f')],_0xdbba('0xfc'))[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x1973a5['ContactId'],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})['catch'](loggerCatch(_0xdbba('0x11d')));}break;case 0x13:if(_0x1973a5['countmachineretry']>=_0x1748eb[_0xdbba('0xf7')]-0x1){return!![];}else{this[_0xdbba('0xc1')]({'active':![],'countmachineretry':_0x1973a5[_0xdbba('0xe9')]+=0x1,'scheduledat':moment()[_0xdbba('0xfa')](_0x1748eb[_0xdbba('0xfb')],_0xdbba('0xfc'))['format'](_0xdbba('0xfd')),'ContactId':_0x1973a5['ContactId'],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xff')));}break;case 0x14:if(_0x1973a5[_0xdbba('0xf3')]>=_0x1748eb[_0xdbba('0x1a0')]-0x1){return!![];}else{this[_0xdbba('0xc1')]({'active':![],'countagentrejectretry':_0x1973a5[_0xdbba('0xf3')]+=0x1,'scheduledat':moment()[_0xdbba('0xfa')](_0x1748eb[_0xdbba('0x1a1')],_0xdbba('0xfc'))[_0xdbba('0x74')](_0xdbba('0xfd')),'ContactId':_0x1973a5[_0xdbba('0xd4')],'ListId':_0x1973a5[_0xdbba('0xd5')],'VoiceQueueId':_0x1973a5[_0xdbba('0xd6')]||undefined,'CampaignId':_0x1973a5[_0xdbba('0xfe')]||undefined})[_0xdbba('0xb0')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0xdbba('0xa7')][_0xdbba('0x193')]=function(_0x7dd036,_0x5a8b56,_0x3e5c2d){var _0x38af41=this;var _0x1b56b4=new History(_0x7dd036);return new BPromise(function(_0x210113,_0x1bc071){if(_[_0xdbba('0x36')](_0x5a8b56)&&'object'!==typeof _0x5a8b56){return _0x1bc071(msgResponse('[callProgressDetecting]',_0xdbba('0x141'),_0xdbba('0x1a2')));}if(_[_0xdbba('0x36')](_0x3e5c2d)&&_0xdbba('0x1a3')!==typeof _0x3e5c2d){return _0x1bc071(msgResponse('[callProgressDetecting]',_0xdbba('0x141'),'evt\x20is\x20undefine'));}switch(_0x3e5c2d[_0xdbba('0x1a4')]){case'0':_0x5a8b56[_0xdbba('0x5f')]+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0x0;_0x1b56b4[_0xdbba('0xa4')]='NoSuchNumber';_0x1b56b4['countnosuchnumberretry']+=0x1;_0x1b56b4['countglobal']+=0x1;ami[_0xdbba('0x46')](_0xdbba('0x1a5'),ut[_0xdbba('0x1a6')](_0x7dd036,_0xdbba('0x1a7')));_0x38af41[_0xdbba('0xcb')](_0x1b56b4)['catch'](loggerCatch(_0xdbba('0xec')));if(_0x38af41[_0xdbba('0x194')](0x0,_0x7dd036,_0x5a8b56)){if(_0x1b56b4['countnosuchnumberretry']>=_0x5a8b56[_0xdbba('0x19d')]){_0x38af41[_0xdbba('0xf8')](_0x1b56b4,_0x210113,_0x1bc071,'reason\x200\x20no\x20such\x20number....');}else{_0x38af41[_0xdbba('0xf5')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1a8'));}}break;case'3':_0x5a8b56['outboundNoAnswerCallsDay']+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0x3;_0x1b56b4['statedesc']=_0xdbba('0x1a9');_0x1b56b4[_0xdbba('0xef')]+=0x1;_0x1b56b4[_0xdbba('0xea')]+=0x1;ami['emit'](_0xdbba('0x1aa'),ut[_0xdbba('0x1a6')](_0x7dd036,_0xdbba('0x1ab')));_0x38af41[_0xdbba('0xcb')](_0x1b56b4)['catch'](loggerCatch(_0xdbba('0x1ac')));if(_0x38af41[_0xdbba('0x194')](0x3,_0x7dd036,_0x5a8b56)){if(_0x1b56b4['countnoanswerretry']>=_0x5a8b56[_0xdbba('0x195')]){_0x38af41[_0xdbba('0xf8')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1ad'));}else{_0x38af41[_0xdbba('0xf5')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1ad'));}}break;case'5':_0x5a8b56[_0xdbba('0x5a')]+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0x5;_0x1b56b4[_0xdbba('0xa4')]=_0xdbba('0x1ae');_0x1b56b4['countbusyretry']+=0x1;_0x1b56b4['countglobal']+=0x1;ami[_0xdbba('0x46')](_0xdbba('0x1af'),ut[_0xdbba('0x1a6')](_0x7dd036,_0xdbba('0x1b0')));_0x38af41[_0xdbba('0xcb')](_0x1b56b4)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x1b1')));if(_0x38af41[_0xdbba('0x194')](0x5,_0x7dd036,_0x5a8b56)){if(_0x1b56b4[_0xdbba('0xed')]>=_0x5a8b56[_0xdbba('0x197')]){_0x38af41['createStateFinal'](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1b2'));}else{_0x38af41[_0xdbba('0xf5')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1b2'));}}break;case'8':_0x5a8b56['outboundCongestionCallsDay']+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0x8;_0x1b56b4[_0xdbba('0xa4')]=_0xdbba('0x1b3');_0x1b56b4[_0xdbba('0xee')]+=0x1;_0x1b56b4['countglobal']+=0x1;ami[_0xdbba('0x46')](_0xdbba('0x1b4'),ut[_0xdbba('0x1a6')](_0x7dd036,_0xdbba('0x1b5')));_0x38af41[_0xdbba('0xcb')](_0x1b56b4)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x1b6')));if(_0x38af41['checkRetriveMax'](0x8,_0x7dd036,_0x5a8b56)){if(_0x1b56b4[_0xdbba('0xee')]>=_0x5a8b56[_0xdbba('0x19a')]){_0x38af41['createStateFinal'](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1b7'));}else{_0x38af41[_0xdbba('0xf5')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1b7'));}}break;case'11':_0x5a8b56['outboundAbandonedCallsDay']+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0xb;_0x1b56b4[_0xdbba('0xa4')]=_0xdbba('0x1b8');_0x1b56b4[_0xdbba('0xf2')]+=0x1;_0x1b56b4['countglobal']+=0x1;_0x38af41['createHistory'](_0x1b56b4)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x11e')));if(_0x38af41[_0xdbba('0x194')](0xb,_0x7dd036,_0x5a8b56)){if(_0x1b56b4[_0xdbba('0xf2')]>=_0x5a8b56[_0xdbba('0x11c')]){_0x38af41[_0xdbba('0xf8')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1b9'));}else{_0x38af41['stateGlobal'](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1b9'));}}break;case'20':_0x5a8b56[_0xdbba('0x62')]+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0x14;_0x1b56b4['statedesc']=_0xdbba('0x1ba');_0x1b56b4['countagentrejectretry']+=0x1;_0x1b56b4[_0xdbba('0xea')]+=0x1;ami[_0xdbba('0x46')](_0xdbba('0x1bb'),ut[_0xdbba('0x1a6')](_0x7dd036,'agentreject'));_0x38af41['createHistory'](_0x1b56b4)['catch'](loggerCatch(_0xdbba('0x1bc')));if(_0x38af41[_0xdbba('0x194')](0x14,_0x7dd036,_0x5a8b56)){if(_0x1b56b4[_0xdbba('0xf3')]>=_0x5a8b56['dialAgentRejectMaxRetry']){_0x38af41[_0xdbba('0xf8')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1bd'));}else{_0x38af41[_0xdbba('0xf5')](_0x1b56b4,_0x210113,_0x1bc071,_0xdbba('0x1bd'));}}break;default:_0x5a8b56[_0xdbba('0x63')]+=0x1;_0x1b56b4[_0xdbba('0xa3')]=0xc;_0x1b56b4['statedesc']=_0x3e5c2d['reason'];_0x38af41[_0xdbba('0xcb')](_0x1b56b4)[_0xdbba('0xb0')](loggerCatch(_0xdbba('0x1be')));if(_0x38af41[_0xdbba('0x194')](_0x3e5c2d[_0xdbba('0x1a4')],_0x7dd036,_0x5a8b56)){if(_0x1b56b4['countbusyretry']+_0x1b56b4['countcongestionretry']+_0x1b56b4[_0xdbba('0xef')]+_0x1b56b4[_0xdbba('0xf0')]+_0x1b56b4[_0xdbba('0xf1')]+_0x1b56b4['countabandonedretry']+_0x1b56b4[_0xdbba('0xe9')]+_0x1b56b4['countagentrejectretry']>=_0x5a8b56[_0xdbba('0xf4')]){_0x38af41[_0xdbba('0xf5')](_0x1b56b4,_0x210113,_0x1bc071,_0x3e5c2d[_0xdbba('0x1a4')]);}else{_0x38af41[_0xdbba('0xf8')](_0x1b56b4,_0x210113,_0x1bc071,_0x3e5c2d[_0xdbba('0x1a4')]);}}}});};Dialer[_0xdbba('0xa7')]['stateGlobal']=function(_0x4142cf,_0x234537,_0x191e4a,_0x24de51){var _0x39c6d6=new Final(_0x4142cf);_0x39c6d6[_0xdbba('0xa3')]=0xf;_0x39c6d6[_0xdbba('0xa4')]=_0xdbba('0x1bf');this['createStateFinal'](_0x39c6d6,_0x234537,_0x191e4a,_0x24de51);};Dialer[_0xdbba('0xa7')][_0xdbba('0xf8')]=function(_0x51af44,_0x50f0bd,_0x548de6,_0x5b4782){this[_0xdbba('0xca')](_0x51af44)[_0xdbba('0xb7')](function(_0x4b4e9c){return _0x50f0bd(msgResponse(_0xdbba('0x1c0'),_0xdbba('0xda'),_0x5b4782));})[_0xdbba('0xb0')](function(_0xf753e2){return _0x548de6(msgResponse(_0xdbba('0x1c1'),_0xdbba('0x141'),_0xdbba('0x1c2')));});};Dialer[_0xdbba('0xa7')][_0xdbba('0x7')]=function(_0x3f26b3){var _0x595efc=this;var _0x54c34e=_0x3f26b3[_0xdbba('0x1c3')]/0x64;var _0x53ff89=_0x3f26b3['outboundDropCallsDayTimeout']/(_0x3f26b3[_0xdbba('0x5d')]+_0x3f26b3[_0xdbba('0x58')]);var _0x4a7726=Math[_0xdbba('0x1c4')](_0x3f26b3[_0xdbba('0x6b')]*(_0x3f26b3[_0xdbba('0x1c5')]/0x64));var _0x1c623f=Math[_0xdbba('0x1c4')](_0x3f26b3[_0xdbba('0x6b')]*(_0x3f26b3[_0xdbba('0x1c6')]/0x64));var _0x35a484=_0x3f26b3['available']+_0x3f26b3['talking'];var _0x59856b=Math[_0xdbba('0x1c7')](_0x3f26b3[_0xdbba('0x6c')]*_0x3f26b3['erlangAbandonmentRate']*_0x3f26b3[_0xdbba('0x1c8')]*_0x3f26b3['predictiveIntervalMultiplicativeFactor']);if(_[_0xdbba('0x36')](_0x3f26b3['startProgressive'])){if(!_['isUndefined'](_0x3f26b3['startPredictive'])){_0x3f26b3[_0xdbba('0x8d')]=undefined;loggerPredictive['error'](_0xdbba('0x1c9'),_0xdbba('0x1ca'));}if(!_[_0xdbba('0x36')](_0x3f26b3[_0xdbba('0x8f')])){loggerPredictive[_0xdbba('0x94')](_0xdbba('0x1c9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3f26b3['handlePredictive']);_0x3f26b3[_0xdbba('0x8f')]=undefined;}_0x3f26b3[_0xdbba('0x22')]=moment()[_0xdbba('0x74')](_0xdbba('0xfd'));loggerPredictive['info'](_0x3f26b3[_0xdbba('0x3b')],_0xdbba('0x1cb'),_0x3f26b3[_0xdbba('0x22')]);this[_0xdbba('0x154')](_0x3f26b3,0x1);}else if(ifInterval(_0x3f26b3[_0xdbba('0x1cc')],_0x3f26b3[_0xdbba('0x22')])){this[_0xdbba('0x154')](_0x3f26b3,0x1);loggerPredictiveCalls['info'](_0xdbba('0x1cd'),_0x3f26b3[_0xdbba('0x22')],_0x3f26b3[_0xdbba('0x3b')]);_0x3f26b3[_0xdbba('0x6c')]=0x0;_0x3f26b3[_0xdbba('0x69')]=0x0;}else if(_0x54c34e<_0x53ff89&&_0x3f26b3[_0xdbba('0x1ce')]==='dropRate'){freeVariablesPredictive(_0x3f26b3);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x1cf'),_0xdbba('0x1d0'),_0x53ff89,_0xdbba('0x22'),_0x3f26b3[_0xdbba('0x3b')]);}else if(_0x59856b<_0x3f26b3['predictiveIntervalErlangCallsDroppedCalls']&&_0x3f26b3['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3f26b3);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xdbba('0x1d1'),_0x59856b,_0xdbba('0x1d2'),_0x3f26b3[_0xdbba('0x69')],_0xdbba('0x22'),_0x3f26b3['name']);}else if(!ifInterval(_0x3f26b3[_0xdbba('0x1cc')],_0x3f26b3[_0xdbba('0x22')])&&_[_0xdbba('0x36')](_0x3f26b3['startPredictive'])&&!_[_0xdbba('0x36')](_0x3f26b3['startProgressive'])){_0x3f26b3[_0xdbba('0x8d')]=moment()[_0xdbba('0x74')](_0xdbba('0xfd'));loggerPredictive[_0xdbba('0x78')](_0x3f26b3[_0xdbba('0x3b')],_0xdbba('0x1d3'),_0x3f26b3[_0xdbba('0x8d')]);this[_0xdbba('0xbe')](_0x3f26b3[_0xdbba('0x1cc')])['then'](this[_0xdbba('0x1d4')](_0x3f26b3))['then'](mergeDataErlangB(_0x3f26b3))[_0xdbba('0xb7')](this[_0xdbba('0x1d5')](_0x3f26b3))[_0xdbba('0xb0')](loggerCatchPredictive(_0xdbba('0x1d6'),_0x3f26b3));}else if(!ifInterval(_0x3f26b3[_0xdbba('0x1cc')],_0x3f26b3['startPredictive'])){_0x3f26b3[_0xdbba('0x69')]=0x0;_0x3f26b3['startPredictive']=moment()[_0xdbba('0x74')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xdbba('0x78')](_0x3f26b3[_0xdbba('0x3b')],_0xdbba('0x1d7'),_0x3f26b3[_0xdbba('0x8d')]);clearInterval(_0x3f26b3[_0xdbba('0x8f')]);_0x3f26b3[_0xdbba('0x8f')]=undefined;this[_0xdbba('0xbe')](_0x3f26b3[_0xdbba('0x1cc')])['then'](this[_0xdbba('0x1d4')](_0x3f26b3))[_0xdbba('0xb7')](mergeDataErlangB(_0x3f26b3))['then'](this[_0xdbba('0x1d5')](_0x3f26b3))[_0xdbba('0xb0')](loggerCatchPredictive(_0xdbba('0x1d8'),_0x3f26b3));}else if(_0x3f26b3[_0xdbba('0x6b')]&&_0x35a484<_0x3f26b3[_0xdbba('0x6b')]-_0x1c623f){freeVariablesPredictive(_0x3f26b3);loggerPredictive[_0xdbba('0x78')](_0x3f26b3['name'],_0xdbba('0x1d9'),_0x35a484,_0xdbba('0x1da'),_0x3f26b3['predictiveIntervalAvailable'],'-',_0x1c623f,'=',_0x3f26b3[_0xdbba('0x6b')]-_0x1c623f,')');}else if(_0x3f26b3[_0xdbba('0x6b')]&&_0x35a484>_0x3f26b3['predictiveIntervalAvailable']+_0x4a7726){freeVariablesPredictive(_0x3f26b3);loggerPredictive[_0xdbba('0x78')](_0x3f26b3[_0xdbba('0x3b')],_0xdbba('0x1d9'),_0x35a484,')\x20are\x20more\x20than\x20threshold\x20(',_0x3f26b3['predictiveIntervalAvailable'],'+',_0x4a7726,'=',_0x3f26b3[_0xdbba('0x6b')]+_0x4a7726,')');}};Dialer['prototype'][_0xdbba('0x1d4')]=function(_0x4c4a00){var _0x4580da=this;return function(_0x2d77f8){return new BPromise(function(_0x4ab9a0,_0x648902){_[_0xdbba('0x8a')](_0x4c4a00,_0x2d77f8[0x0]);if(checkGetDataPredictive(_0x2d77f8[0x0])){var _0x10e92f=_0x4c4a00[_0xdbba('0x6b')]=_0x4c4a00[_0xdbba('0x4d')]+_0x4c4a00[_0xdbba('0x48')];var _0x19c1cd=_0x4c4a00[_0xdbba('0x1cc')]*0x3c;var _0x3eab5a=_0x2d77f8[0x0]['predictiveIntervalAvgTalktime']+_0x2d77f8[0x0][_0xdbba('0x65')];var _0x1996d1=(_0x2d77f8[0x0][_0xdbba('0x64')]+_0x2d77f8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d77f8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2d77f8[0x0]['predictiveIntervalTotalCalls'];_0x4c4a00[_0xdbba('0x1c8')]=_0x1996d1>0x0?_0x1996d1:0x1;switch(_0x4c4a00['dialPredictiveOptimization']){case _0xdbba('0x1db'):var _0x38e036=_0x4c4a00[_0xdbba('0x1c3')]/0x64;return _0x4580da['abandonmentRate'](_0x10e92f,_0x19c1cd,_0x3eab5a,_0x1996d1,_0x38e036)[_0xdbba('0xb7')](function(_0xe2e97d){return _0x4ab9a0(_0xe2e97d);});case _0xdbba('0x1dc'):var _0x3f8130=_0x4c4a00[_0xdbba('0x1c3')]/0x64;return _0x4580da[_0xdbba('0x1dd')](_0x10e92f,_0x19c1cd,_0x3eab5a,_0x1996d1,_0x3f8130)[_0xdbba('0xb7')](function(_0x4b128d){return _0x4ab9a0(_0x4b128d);});default:return _0x648902(msgResponse(_0xdbba('0x1de'),_0xdbba('0x141'),'Unknown\x20Predictive'));}}else{return _0x648902(msgResponse(_0xdbba('0x1de'),'Failure',_0xdbba('0x1df')));}});};};Dialer[_0xdbba('0xa7')][_0xdbba('0x1e0')]=function(_0x9f03f0){var _0x36d88a=this;return function(_0x59d864){return new BPromise(function(_0x526860,_0xe9fabb){_[_0xdbba('0x8a')](_0x9f03f0,_0x59d864[0x0]);if(checkGetDataPredictive(_0x59d864[0x0])){loggerPredictive[_0xdbba('0x78')](JSON[_0xdbba('0x43')](_0x59d864[0x0]));if(_0x9f03f0[_0xdbba('0x1ce')]===_0xdbba('0x1db')){return _0x36d88a['getVoiceQueueRtPauses'](_0x9f03f0['id'])['then'](function(_0x2e946d){var _0x23ac9f=_0x9f03f0[_0xdbba('0x49')]-_0x2e946d[0x0]['outboundQueuePauses'];var _0x424a00=_0x9f03f0['dialPredictiveInterval']*0x3c;var _0x4862e2=_0x59d864[0x0]['predictiveIntervalAvgTalktime']+_0x59d864[0x0][_0xdbba('0x65')];var _0x1613a1=(_0x59d864[0x0][_0xdbba('0x64')]+_0x59d864[0x0][_0xdbba('0x67')]+_0x59d864[0x0][_0xdbba('0x7e')])/_0x59d864[0x0][_0xdbba('0x7b')];var _0x6c1f81=_0x9f03f0['dialPredictiveOptimizationPercentage']/0x64;_0x9f03f0['predictiveIntervalPauses']=_0x2e946d[0x0][_0xdbba('0x1e1')]||0x0;_0x9f03f0[_0xdbba('0x1c8')]=_0x1613a1>0x0?_0x1613a1:0x1;return _0x36d88a[_0xdbba('0x1e2')](_0x23ac9f,_0x424a00,_0x4862e2,_0x1613a1,_0x6c1f81);})['then'](function(_0xea199c){return _0x526860(_0xea199c);})['catch'](function(_0x66002d){return _0xe9fabb(msgResponse(_0xdbba('0x1e3'),_0xdbba('0x141'),JSON[_0xdbba('0x43')](_0x66002d)));});}if(_0x9f03f0[_0xdbba('0x1ce')]==='agentBusyFactor'){return _0x36d88a[_0xdbba('0xc8')](_0x9f03f0['id'])[_0xdbba('0xb7')](function(_0x315f40){var _0x396651=_0x9f03f0[_0xdbba('0x49')]-_0x315f40[0x0][_0xdbba('0x1e1')];var _0x51c928=_0x9f03f0[_0xdbba('0x1cc')]*0x3c;var _0x4a1111=_0x59d864[0x0][_0xdbba('0x66')]+_0x59d864[0x0][_0xdbba('0x65')];var _0x3ca8f0=(_0x59d864[0x0][_0xdbba('0x64')]+_0x59d864[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59d864[0x0][_0xdbba('0x7e')])/_0x59d864[0x0][_0xdbba('0x7b')];var _0x2ea0ff=_0x9f03f0[_0xdbba('0x1c3')]/0x64;_0x9f03f0[_0xdbba('0x1e4')]=_0x315f40[0x0][_0xdbba('0x1e1')]||0x0;_0x9f03f0['predictiveIntervalHitRate']=_0x3ca8f0>0x0?_0x3ca8f0:0x1;return _0x36d88a[_0xdbba('0x1dd')](_0x396651,_0x51c928,_0x4a1111,_0x3ca8f0,_0x2ea0ff);})['then'](function(_0x599e46){return _0x526860(_0x599e46);})[_0xdbba('0xb0')](function(_0x3db786){return _0xe9fabb(msgResponse(_0xdbba('0x1e3'),_0xdbba('0x141'),JSON[_0xdbba('0x43')](_0x3db786)));});}}else{return _0xe9fabb(msgResponse('[getDataPredictive]',_0xdbba('0x141'),_0xdbba('0x1df')));}});};};Dialer[_0xdbba('0xa7')][_0xdbba('0x1d5')]=function(_0x252ed3){var _0x4ccd56=this;return function(){var _0x5c4bc8=0x0;var _0x28e454=Math['floor'](_0x252ed3[_0xdbba('0x6d')]*0x3e8);if(_0x28e454>0x0){_0x28e454=_0x28e454<0x64?0x64:_0x28e454;loggerPredictive[_0xdbba('0x78')](_0x252ed3[_0xdbba('0x3b')],'one\x20call\x20every:',_0x28e454,_0xdbba('0x44'));_0x252ed3[_0xdbba('0x8f')]=setInterval(function(){_0x4ccd56[_0xdbba('0x8f')](_0x252ed3);loggerPredictiveCalls[_0xdbba('0x78')](_0xdbba('0x1e5'),_0x5c4bc8+=0x1);},_0x28e454);}else{loggerPredictive['info'](_0x252ed3['name'],_0xdbba('0x1e6'));}};};Dialer[_0xdbba('0xa7')]['checkContactBlack']=function(_0x44f800,_0x2edbb6){var _0x2f56c2=this;return function(_0x517da6){if(_['isEmpty'](_0x517da6)){if(_[_0xdbba('0xac')](_0x2edbb6[_0xdbba('0x1e7')])||!_0x2edbb6[_0xdbba('0x1e8')]){if(_0x44f800[_0xdbba('0x54')]==='booked'){_0x44f800[_0xdbba('0x127')]=_['isUndefined'](_0x44f800[_0xdbba('0x127')])?!![]:_0x44f800[_0xdbba('0x127')];var _0x4d8a18=uuid['v4']();_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18]=new Action(_0x44f800,_0x2edbb6,_0x4d8a18);loggerBooked[_0xdbba('0x78')](_0xdbba('0x1e9'),_0x4d8a18,_0xdbba('0x1ea'),JSON['stringify'](_0x44f800['queueStatusComplete']),_0xdbba('0x1eb'),_0x44f800[_0xdbba('0x3b')]);if(_0x44f800[_0xdbba('0x127')]){_0x44f800[_0xdbba('0x127')]=![];_0x2f56c2[_0xdbba('0x23')][_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18][_0xdbba('0xb3')]]=[];ami['Action']({'actionid':_0x4d8a18,'action':_0xdbba('0x1ec'),'queue':_0x44f800[_0xdbba('0x3b')]})[_0xdbba('0xb0')](function(_0x53ad3a){_0x2f56c2['updateOriginated'](_0x44f800);_0x2f56c2[_0xdbba('0xc1')]({'active':![],'ContactId':_0x2f56c2['actions'][_0x4d8a18][_0xdbba('0xd4')],'ListId':_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18]['ListId'],'VoiceQueueId':_0x2f56c2['actions'][_0x4d8a18][_0xdbba('0xd6')]||undefined,'CampaignId':_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18]['CampaignId']||undefined})[_0xdbba('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2f56c2['actions'][_0x4d8a18];});}else{loggerBooked[_0xdbba('0x78')](_0xdbba('0x1ed'),JSON[_0xdbba('0x43')](_0x44f800[_0xdbba('0x127')]),_0xdbba('0x1eb'),_0x44f800[_0xdbba('0x3b')]);_0x2f56c2[_0xdbba('0xb2')](_0x44f800);_0x2f56c2[_0xdbba('0xc1')]({'active':![],'ContactId':_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18][_0xdbba('0xd4')],'ListId':_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18]['ListId'],'VoiceQueueId':_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18][_0xdbba('0xd6')]||undefined,'CampaignId':_0x2f56c2[_0xdbba('0x1f')][_0x4d8a18][_0xdbba('0xfe')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2f56c2[_0xdbba('0x1f')][_0x4d8a18];}}else{return _0x2f56c2[_0xdbba('0x162')](_0x44f800,_0x2edbb6);}}else{if(getDiff(_0x2edbb6[_0xdbba('0x1ee')])<_0x44f800[_0xdbba('0x1ef')]*0x3c){if(_0x2edbb6[_0xdbba('0x1f0')]&&!_0x2edbb6['Agent'][_0xdbba('0x1f1')]){_0x2f56c2[_0xdbba('0x19')][_0xdbba('0x131')](_0x2edbb6['id'])['finally'](function(){_0x2f56c2[_0xdbba('0xb2')](_0x44f800);});}else{_0x2f56c2[_0xdbba('0xc3')]({'active':![]},_0x2edbb6['id'],0x1)['finally'](function(){console['log'](_0xdbba('0x1f2'));_0x2f56c2[_0xdbba('0xb2')](_0x44f800);});}}else{_0x44f800[_0xdbba('0x61')]+=0x1;_0x2f56c2[_0xdbba('0xb2')](_0x44f800);if(_0x44f800[_0xdbba('0x1f3')]){_0x2f56c2['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2edbb6['ContactId'],'ListId':_0x2edbb6[_0xdbba('0xd5')],'VoiceQueueId':_0x2edbb6[_0xdbba('0xd6')]||undefined,'CampaignId':_0x2edbb6[_0xdbba('0xfe')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2f56c2['createHistory'](createObjHistory(_0x44f800,_0x2edbb6,_0xdbba('0x1f4'),0x17,_0xdbba('0x1f5')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2f56c2[_0xdbba('0xd3')](createObjHistory(_0x44f800,_0x2edbb6,_0xdbba('0x1f6'),0x16,_0xdbba('0x1f7')),_0xdbba('0x1f8'),'[Originate][HistoryRecallClose]');}}}}else{_0x44f800['outboundBlacklistCallsDay']+=0x1;_0x2f56c2['saveInDb'](createObjHistory(_0x44f800,_0x2edbb6,_0xdbba('0x1f9'),0xd,_0xdbba('0x1fa')),_0xdbba('0x1fb'),_0xdbba('0x1fc'));throw'inBlackList';}};};Dialer[_0xdbba('0xa7')]['handleIvr']=function(_0x4de022){var _0x6caebd=this;var _0x5a73d2=[];var _0x475845=_0x4de022[_0xdbba('0x1fd')]-_0x4de022[_0xdbba('0x98')]-_0x4de022[_0xdbba('0x1fe')];emitCampaignSummary(_0x4de022);if(_0x475845>0x0){if(_0x475845>this[_0xdbba('0x1d')]){_0x475845=this[_0xdbba('0x1d')];}_0x4de022[_0xdbba('0x1fe')]+=_0x475845;this[_0xdbba('0xc7')](_0x4de022['id'],_0x475845,_0x4de022[_0xdbba('0x1ff')])[_0xdbba('0xb7')](function(_0x25ed67){_0x4de022[_0xdbba('0x1fe')]-=_0x475845;_0x4de022[_0xdbba('0x1fe')]=_0x4de022['temp']>0x0?_0x4de022['temp']:0x0;if(!checkContactEmpty(_0x25ed67)){_0x4de022[_0xdbba('0x37')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xdbba('0x78')]('[getContactCampaign2][Empty]'+_0x4de022[_0xdbba('0x3b')]);}else{_0x4de022[_0xdbba('0x98')]+=_0x25ed67['length'];_0x4de022[_0xdbba('0x37')]=_0xdbba('0x200');for(var _0x30a9c1=0x0;_0x30a9c1<_0x25ed67[_0xdbba('0x97')];_0x30a9c1+=0x1){_0x4de022['ivrTotalCallsDays']+=0x1;if(_[_0xdbba('0xac')](_0x25ed67[_0x30a9c1])||_['isNil'](_0x25ed67[_0x30a9c1][_0xdbba('0x165')])||_['isNil'](_0x25ed67[_0x30a9c1][_0xdbba('0x165')]['phone'])){_0x6caebd[_0xdbba('0xd1')](_0xdbba('0x201'),_0x4de022,_0x25ed67[_0x30a9c1]);}else{_0x6caebd['checkIsBlackListIvr'](_[_0xdbba('0x12f')](_0x25ed67[_0x30a9c1],['CampaignId','Contact.phone']))[_0xdbba('0xb7')](_0x6caebd[_0xdbba('0x202')](_0x4de022,_0x25ed67[_0x30a9c1]))[_0xdbba('0xb0')](_0x6caebd[_0xdbba('0xd0')]('[actionOriginateIvr]\x20',_0x4de022));}}}})[_0xdbba('0xb0')](loggerGetContactDialer('[getContactCampaign2]',_0x4de022,_0x475845));}};Dialer['prototype'][_0xdbba('0x154')]=function(_0x39c83f,_0x1a704f){var _0x5d601a=this;var _0x20884d=[];var _0x3dc4dc=_0x1a704f>=0x1?_0x1a704f:0x1;var _0x1e0fe2=[];if(_0x39c83f['dialMethod']===_0xdbba('0x6')){_0x3dc4dc=0x1;}var _0x3359df=Math[_0xdbba('0x1c7')](_0x39c83f[_0xdbba('0x48')]*_0x3dc4dc)-_0x39c83f[_0xdbba('0x98')]-_0x39c83f[_0xdbba('0x1fe')];emitVoiceQueueSummary(_0x39c83f);if(_0x39c83f[_0xdbba('0x203')]>0x0){var _0x3f9eee=_0x39c83f[_0xdbba('0x203')]-_0x39c83f[_0xdbba('0x98')]-_0x39c83f[_0xdbba('0x4d')]-_0x39c83f[_0xdbba('0x1fe')]-_0x39c83f[_0xdbba('0x4a')];if(_0x3359df>_0x3f9eee){_0x3359df=_0x3f9eee;}}if(_0x3359df>0x0){if(_0x39c83f[_0xdbba('0x54')]===_0xdbba('0x6')){_0x3359df=0x1;}if(_0x3359df>this[_0xdbba('0x1d')]){_0x3359df=this[_0xdbba('0x1d')];}_0x39c83f[_0xdbba('0x1fe')]+=_0x3359df;for(var _0x450d1b in this[_0xdbba('0x1b')]){if(this[_0xdbba('0x1b')][_0xdbba('0xcd')](_0x450d1b)){if(this['agents'][_0x450d1b][_0xdbba('0xa3')]===_0xdbba('0x204')&&this[_0xdbba('0x1b')][_0x450d1b]['status']===_0xdbba('0xdd')){_0x20884d[_0xdbba('0x125')](this[_0xdbba('0x1b')][_0x450d1b]['id']);}}}this[_0xdbba('0xc5')](_0x39c83f['id'],_0x20884d,_0x3359df,_0x39c83f['dialOrderByScheduledAt'])[_0xdbba('0xb7')](function(_0x1197f2){_0x39c83f['temp']-=_0x3359df;_0x39c83f[_0xdbba('0x1fe')]=_0x39c83f[_0xdbba('0x1fe')]>0x0?_0x39c83f[_0xdbba('0x1fe')]:0x0;if(!checkContactEmpty(_0x1197f2)){_0x5d601a['countReScheduled'](_0x39c83f)['then'](sendMessageReschedule(_0x39c83f))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xb9')));}else{_0x39c83f[_0xdbba('0x98')]+=_0x1197f2[_0xdbba('0x97')];_0x39c83f[_0xdbba('0x37')]=_0x39c83f['dialMethod']===_0xdbba('0x6')?_0xdbba('0x16d'):_0xdbba('0x200');for(var _0x535e45=0x0;_0x535e45<_0x1197f2[_0xdbba('0x97')];_0x535e45+=0x1){if(_['isNil'](_0x1197f2[_0x535e45])||_[_0xdbba('0xac')](_0x1197f2[_0x535e45][_0xdbba('0x165')])||_['isNil'](_0x1197f2[_0x535e45][_0xdbba('0x165')][_0xdbba('0x166')])){_0x5d601a['emptyContact'](_0xdbba('0x201'),_0x39c83f,_0x1197f2[_0x535e45]);}else{_0x5d601a[_0xdbba('0xba')](_[_0xdbba('0x12f')](_0x1197f2[_0x535e45],[_0xdbba('0xd6'),_0xdbba('0x205')]))[_0xdbba('0xb7')](_0x5d601a[_0xdbba('0x202')](_0x39c83f,_0x1197f2[_0x535e45]))[_0xdbba('0xb0')](_0x5d601a[_0xdbba('0xd0')](_0xdbba('0x201'),_0x39c83f));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x39c83f,_0x3359df));}};Dialer[_0xdbba('0xa7')]['handlePredictive']=function(_0xbd394d){var _0x556cec=this;if(_0xbd394d[_0xdbba('0x203')]>0x0){var _0x3e6323=_0xbd394d[_0xdbba('0x203')]-_0xbd394d[_0xdbba('0x98')]-_0xbd394d[_0xdbba('0x4d')];if(_0x3e6323>0x0){this[_0xdbba('0x206')](_0xbd394d);}else{loggerPredictiveCalls[_0xdbba('0x78')](_0xdbba('0x207'));}}else{this[_0xdbba('0x206')](_0xbd394d);}};Dialer[_0xdbba('0xa7')][_0xdbba('0x206')]=function(_0x26a2dd){var _0x171f1e=this;var _0xee71c8=[];_0x26a2dd[_0xdbba('0x98')]+=0x1;for(var _0x564004 in this[_0xdbba('0x1b')]){if(this['agents'][_0xdbba('0xcd')](_0x564004)){if(this[_0xdbba('0x1b')][_0x564004]['state']==='not_inuse'&&this[_0xdbba('0x1b')][_0x564004]['status']===_0xdbba('0xdd')){_0xee71c8['push'](this[_0xdbba('0x1b')][_0x564004]['id']);}}}this[_0xdbba('0xc5')](_0x26a2dd['id'],_0xee71c8,0x1,_0x26a2dd[_0xdbba('0x1ff')])[_0xdbba('0xb7')](function(_0x6e29ff){if(!checkContactEmpty(_0x6e29ff)){checkContactLowerLimitOriginate(_0x26a2dd,0x1,0x0);_0x171f1e[_0xdbba('0xb8')](_0x26a2dd)[_0xdbba('0xb7')](sendMessageReschedule(_0x26a2dd))[_0xdbba('0xb0')](loggerCatch(_0xdbba('0xb9')));}else{_0x26a2dd[_0xdbba('0x37')]=_0xdbba('0x200');if(_[_0xdbba('0xac')](_0x6e29ff[0x0])||_[_0xdbba('0xac')](_0x6e29ff[0x0][_0xdbba('0x165')])||_[_0xdbba('0xac')](_0x6e29ff[0x0][_0xdbba('0x165')][_0xdbba('0x166')])){_0x171f1e[_0xdbba('0xd1')](_0xdbba('0x201'),_0x26a2dd,_0x6e29ff[0x0]);}else{_0x171f1e[_0xdbba('0xba')](_[_0xdbba('0x12f')](_0x6e29ff[0x0],[_0xdbba('0xd6'),_0xdbba('0x205')]))[_0xdbba('0xb7')](_0x171f1e[_0xdbba('0x202')](_0x26a2dd,_0x6e29ff[0x0]))[_0xdbba('0xb0')](_0x171f1e[_0xdbba('0xd0')]('[actionOriginatePredictive]\x20',_0x26a2dd));}}})[_0xdbba('0xb0')](loggerGetContactDialer(_0xdbba('0x208'),_0x26a2dd,0x1));emitVoiceQueueSummary(_0x26a2dd);};Dialer['prototype'][_0xdbba('0x1e2')]=function(_0x7fd9a9,_0x1c43db,_0x50bd6b,_0x173d1,_0x562bf0,_0x317a81){loggerPredictive[_0xdbba('0x78')](_0xdbba('0x209'));loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20a'),_0x7fd9a9);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20b'),_0x1c43db);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20c'),_0x50bd6b);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20d'),_0x173d1);loggerPredictive['info'](_0xdbba('0x20e'),_0x562bf0);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x80'));return new BPromise(function(_0x331575,_0x21593b){if(_0x7fd9a9<=0x0||isNaN(_0x7fd9a9)){return _0x21593b(msgResponse(_0xdbba('0x20f'),_0xdbba('0x190'),_0xdbba('0x210')+_0x7fd9a9));}if(_0x50bd6b<=0x0||isNaN(_0x50bd6b)){return _0x21593b(msgResponse(_0xdbba('0x20f'),_0xdbba('0x190'),_0xdbba('0x211')+_0x50bd6b));}if(_0x173d1<=0x0||isNaN(_0x173d1)){return _0x21593b(msgResponse(_0xdbba('0x20f'),_0xdbba('0x190'),_0xdbba('0x212')+_0x173d1));}if(_0x1c43db<=0x0||isNaN(_0x1c43db)){return _0x21593b(msgResponse(_0xdbba('0x20f'),_0xdbba('0x190'),_0xdbba('0x213')+_0x1c43db));}if(_0x562bf0<=0x0||isNaN(_0x562bf0)){return _0x21593b(msgResponse(_0xdbba('0x20f'),_0xdbba('0x190'),_0xdbba('0x214')+_0x562bf0));}_0x317a81=_0x317a81||0x0;var _0x545918=0x1/_0x50bd6b;var _0x4fd8cc=0x0;var _0x2a0eeb=0x0;var _0x901122=0x0;var _0x357df1=0x0;for(var _0x31b147=0x0;_0x901122<_0x562bf0;_0x31b147+=0x1){_0x2a0eeb=_0x31b147/_0x1c43db;_0x4fd8cc=(_0x173d1*_0x2a0eeb+_0x317a81)/_0x545918;_0x901122=erlangb(_0x4fd8cc,_0x7fd9a9);_0x357df1=_0x4fd8cc/_0x7fd9a9*(0x1-erlangb(_0x4fd8cc,_0x7fd9a9));}return _0x331575({'erlangCalls':_0x31b147,'erlangCallToSecond':_0x1c43db/_0x31b147,'erlangAbandonmentRate':_0x901122,'erlangBusyFactor':_0x357df1});});};Dialer[_0xdbba('0xa7')][_0xdbba('0x1dd')]=function(_0x3ea4a4,_0x3f9d38,_0x28bc7e,_0x2be2ad,_0x4b709b,_0x1afb28){loggerPredictive['info'](_0xdbba('0x215'));loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20a'),_0x3ea4a4);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20b'),_0x3f9d38);loggerPredictive[_0xdbba('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',_0x28bc7e);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x20d'),_0x2be2ad);loggerPredictive[_0xdbba('0x78')](_0xdbba('0x216'),_0x4b709b);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x3beb35,_0x166db3){if(_0x3ea4a4<=0x0||isNaN(_0x3ea4a4)){return _0x166db3(msgResponse(_0xdbba('0x217'),'Error',_0xdbba('0x210')+_0x3ea4a4));}if(_0x28bc7e<=0x0||isNaN(_0x28bc7e)){return _0x166db3(msgResponse(_0xdbba('0x217'),_0xdbba('0x190'),_0xdbba('0x211')+_0x28bc7e));}if(_0x2be2ad<=0x0||isNaN(_0x2be2ad)){return _0x166db3(msgResponse(_0xdbba('0x217'),_0xdbba('0x190'),'p\x20=\x20'+_0x2be2ad));}if(_0x3f9d38<=0x0||isNaN(_0x3f9d38)){return _0x166db3(msgResponse(_0xdbba('0x217'),_0xdbba('0x190'),_0xdbba('0x213')+_0x3f9d38));}if(_0x4b709b<=0x0||isNaN(_0x4b709b)){return _0x166db3(msgResponse(_0xdbba('0x217'),_0xdbba('0x190'),'Umin\x20=\x20'+_0x4b709b));}_0x1afb28=_0x1afb28||0x0;var _0x316807=0x1/_0x28bc7e;var _0x231f20=0x0;var _0x388a94=0x0;var _0x4da9a5=0x0;var _0x333357=0x0;for(var _0x3cb9e7=0x0;_0x333357<_0x4b709b;_0x3cb9e7+=0x1){_0x388a94=_0x3cb9e7/_0x3f9d38;_0x231f20=(_0x2be2ad*_0x388a94+_0x1afb28)/_0x316807;_0x4da9a5=erlangb(_0x231f20,_0x3ea4a4);_0x333357=_0x231f20/_0x3ea4a4*(0x1-erlangb(_0x231f20,_0x3ea4a4));}return _0x3beb35({'erlangCalls':_0x3cb9e7,'erlangCallToSecond':_0x3f9d38/_0x3cb9e7,'erlangAbandonmentRate':_0x4da9a5,'erlangBusyFactor':_0x333357});});};module[_0xdbba('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 7103186..11ada74 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 _0x3838=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback'];(function(_0x2afc7b,_0x33dda7){var _0x391ef4=function(_0x3d906d){while(--_0x3d906d){_0x2afc7b['push'](_0x2afc7b['shift']());}};_0x391ef4(++_0x33dda7);}(_0x3838,0xe1));var _0x8383=function(_0x4fbf1d,_0x5c8ba2){_0x4fbf1d=_0x4fbf1d-0x0;var _0x2b4689=_0x3838[_0x4fbf1d];return _0x2b4689;};'use strict';var util=require(_0x8383('0x0'));var _=require(_0x8383('0x1'));var moment=require(_0x8383('0x2'));function getSeconds(_0x3d0c0a,_0x330e74){var _0x39cbec=moment(_0x3d0c0a)[_0x8383('0x3')](0x0);var _0x1c07ad=moment(_0x330e74)[_0x8383('0x3')](0x0);return _0x39cbec[_0x8383('0x4')](_0x1c07ad,_0x8383('0x5'));}function QueueCallerAbandon(_0x284e30,_0x47cb9e){this[_0x8383('0x6')]=_0x284e30[_0x8383('0x6')];this['type']=_0x284e30[_0x8383('0x7')];this['campaigntype']=_0x284e30['type']===_0x8383('0x8')?'queue':_0x284e30[_0x8383('0x7')];this[_0x8383('0x9')]=_0x284e30['countbusyretry'];this[_0x8383('0xa')]=_0x284e30['countcongestionretry'];this[_0x8383('0xb')]=_0x284e30[_0x8383('0xb')];this[_0x8383('0xc')]=_0x284e30[_0x8383('0x9')]+_0x284e30[_0x8383('0xa')]+_0x284e30[_0x8383('0xb')]+_0x284e30[_0x8383('0xd')]+_0x284e30['countdropretry']+_0x284e30[_0x8383('0xe')]+_0x284e30[_0x8383('0xf')]+_0x284e30[_0x8383('0x10')];this[_0x8383('0xd')]=_0x284e30[_0x8383('0xd')];this[_0x8383('0x11')]=_0x284e30[_0x8383('0x11')];this['countabandonedretry']=_0x284e30[_0x8383('0xe')];this['countmachineretry']=_0x284e30[_0x8383('0xf')];this[_0x8383('0x10')]=_0x284e30['countagentrejectretry'];this[_0x8383('0x12')]=_0x47cb9e[_0x8383('0x12')];this[_0x8383('0x13')]=_0x284e30['name'];this[_0x8383('0x14')]=_0x284e30['number'];this[_0x8383('0x15')]=_0x284e30[_0x8383('0x15')];this[_0x8383('0x16')]=_0x284e30[_0x8383('0x16')];this[_0x8383('0x17')]=_0x284e30[_0x8383('0x17')];this[_0x8383('0x18')]=this['droptime'];this[_0x8383('0x19')]=getSeconds(_0x284e30['responsetime'],_0x284e30['starttime']);this[_0x8383('0x1a')]=getSeconds(this[_0x8383('0x17')],_0x284e30['responsetime']);this[_0x8383('0x1b')]=0x0;this[_0x8383('0x1c')]=_0x47cb9e[_0x8383('0x1c')];this[_0x8383('0x1d')]=_0x47cb9e[_0x8383('0x1e')];this[_0x8383('0x1f')]=_0x47cb9e[_0x8383('0x1f')];this[_0x8383('0x20')]=_0x284e30['callback'];this[_0x8383('0x21')]=_0x284e30[_0x8383('0x21')];this[_0x8383('0x22')]=_0x284e30[_0x8383('0x22')];this[_0x8383('0x23')]=_0x284e30[_0x8383('0x23')];this[_0x8383('0x24')]=_0x284e30[_0x8383('0x24')];this[_0x8383('0x25')]=_0x284e30[_0x8383('0x25')];this[_0x8383('0x26')]=_0x284e30[_0x8383('0x26')];this[_0x8383('0x27')]=_0x284e30[_0x8383('0x27')];this[_0x8383('0x28')]=_0x284e30[_0x8383('0x28')];this[_0x8383('0x29')]=_0x284e30[_0x8383('0x29')]||'';this[_0x8383('0x2a')]=_0x284e30['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x3dd9=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x3dd9,0x12f));var _0x93dd=function(_0x25bc5a,_0x2f8ba6){_0x25bc5a=_0x25bc5a-0x0;var _0x3a3746=_0x3dd9[_0x25bc5a];return _0x3a3746;};'use strict';var util=require('util');var _=require(_0x93dd('0x0'));var moment=require(_0x93dd('0x1'));function getSeconds(_0xb5216,_0x14bca7){var _0x2db55c=moment(_0xb5216)[_0x93dd('0x2')](0x0);var _0x2c6b0d=moment(_0x14bca7)[_0x93dd('0x2')](0x0);return _0x2db55c[_0x93dd('0x3')](_0x2c6b0d,'seconds');}function QueueCallerAbandon(_0x35aacc,_0x3762aa){this[_0x93dd('0x4')]=_0x35aacc[_0x93dd('0x4')];this[_0x93dd('0x5')]=_0x35aacc[_0x93dd('0x5')];this['campaigntype']=_0x35aacc[_0x93dd('0x5')]===_0x93dd('0x6')?_0x93dd('0x7'):_0x35aacc[_0x93dd('0x5')];this[_0x93dd('0x8')]=_0x35aacc[_0x93dd('0x8')];this[_0x93dd('0x9')]=_0x35aacc[_0x93dd('0x9')];this[_0x93dd('0xa')]=_0x35aacc['countnoanswerretry'];this[_0x93dd('0xb')]=_0x35aacc[_0x93dd('0x8')]+_0x35aacc['countcongestionretry']+_0x35aacc[_0x93dd('0xa')]+_0x35aacc[_0x93dd('0xc')]+_0x35aacc[_0x93dd('0xd')]+_0x35aacc[_0x93dd('0xe')]+_0x35aacc[_0x93dd('0xf')]+_0x35aacc['countagentrejectretry'];this[_0x93dd('0xc')]=_0x35aacc['countnosuchnumberretry'];this[_0x93dd('0xd')]=_0x35aacc[_0x93dd('0xd')];this[_0x93dd('0xe')]=_0x35aacc[_0x93dd('0xe')];this['countmachineretry']=_0x35aacc[_0x93dd('0xf')];this[_0x93dd('0x10')]=_0x35aacc[_0x93dd('0x10')];this[_0x93dd('0x11')]=_0x3762aa[_0x93dd('0x11')];this[_0x93dd('0x12')]=_0x35aacc[_0x93dd('0x13')];this[_0x93dd('0x14')]=_0x35aacc[_0x93dd('0x15')];this['starttime']=_0x35aacc[_0x93dd('0x16')];this[_0x93dd('0x17')]=_0x35aacc['responsetime'];this[_0x93dd('0x18')]=_0x35aacc[_0x93dd('0x18')];this[_0x93dd('0x19')]=this[_0x93dd('0x18')];this['ringtime']=getSeconds(_0x35aacc[_0x93dd('0x17')],_0x35aacc[_0x93dd('0x16')]);this[_0x93dd('0x1a')]=getSeconds(this[_0x93dd('0x18')],_0x35aacc[_0x93dd('0x17')]);this[_0x93dd('0x1b')]=0x0;this[_0x93dd('0x7')]=_0x3762aa[_0x93dd('0x7')];this[_0x93dd('0x1c')]=_0x3762aa['connectedlinename'];this[_0x93dd('0x1d')]=_0x3762aa[_0x93dd('0x1d')];this[_0x93dd('0x1e')]=_0x35aacc['callback'];this[_0x93dd('0x1f')]=_0x35aacc[_0x93dd('0x1f')];this[_0x93dd('0x20')]=_0x35aacc['callbackat'];this[_0x93dd('0x21')]=_0x35aacc['recallme'];this[_0x93dd('0x22')]=_0x35aacc[_0x93dd('0x22')];this[_0x93dd('0x23')]=_0x35aacc[_0x93dd('0x23')];this[_0x93dd('0x24')]=_0x35aacc[_0x93dd('0x24')];this[_0x93dd('0x25')]=_0x35aacc['VoiceQueueId'];this[_0x93dd('0x26')]=_0x35aacc[_0x93dd('0x26')];this[_0x93dd('0x27')]=_0x35aacc[_0x93dd('0x27')]||'';this['originatecalleridname']=_0x35aacc[_0x93dd('0x28')]||'';}module[_0x93dd('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 15d714b..27c876a 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 _0xe69f=['lodash','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x23dc93,_0x5860ca){var _0x16458e=function(_0x1c864a){while(--_0x1c864a){_0x23dc93['push'](_0x23dc93['shift']());}};_0x16458e(++_0x5860ca);}(_0xe69f,0x1d4));var _0xfe69=function(_0x4fbc74,_0x30d5c4){_0x4fbc74=_0x4fbc74-0x0;var _0x37b30e=_0xe69f[_0x4fbc74];return _0x37b30e;};'use strict';var util=require('util');var _=require(_0xfe69('0x0'));var moment=require('moment');function Action(_0x166430,_0xc76381,_0x5c9ce3){this[_0xfe69('0x1')]=_0x166430||undefined;this[_0xfe69('0x2')]=util[_0xfe69('0x3')](_0xfe69('0x4'),_0xc76381[_0xfe69('0x5')],_0xc76381[_0xfe69('0x6')][_0xfe69('0x7')],_0x5c9ce3[_0xfe69('0x8')]);this['localstationid']=_0xc76381[_0xfe69('0x9')];this[_0xfe69('0xa')]=_0xc76381['headerinfo'];this[_0xfe69('0xb')]=_0x5c9ce3['path'];this[_0xfe69('0xc')]=_0x5c9ce3['AttachmentId'];}module['exports']=Action; \ No newline at end of file +var _0x6b6a=['headerinfo','path','AttachmentId','exports','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','fax','localstationid'];(function(_0x3fb32e,_0xe528f3){var _0x33dae1=function(_0x59ad20){while(--_0x59ad20){_0x3fb32e['push'](_0x3fb32e['shift']());}};_0x33dae1(++_0xe528f3);}(_0x6b6a,0x115));var _0xa6b6=function(_0x1b58b8,_0x3e1c2a){_0x1b58b8=_0x1b58b8-0x0;var _0x479502=_0x6b6a[_0x1b58b8];return _0x479502;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa6b6('0x0'));function Action(_0x3f52df,_0x5d07b9,_0x5dc51c){this[_0xa6b6('0x1')]=_0x3f52df||undefined;this[_0xa6b6('0x2')]=util['format'](_0xa6b6('0x3'),_0x5d07b9[_0xa6b6('0x4')],_0x5d07b9[_0xa6b6('0x5')][_0xa6b6('0x6')],_0x5dc51c[_0xa6b6('0x7')]);this[_0xa6b6('0x8')]=_0x5d07b9[_0xa6b6('0x8')];this['headerinfo']=_0x5d07b9[_0xa6b6('0x9')];this[_0xa6b6('0xa')]=_0x5dc51c['path'];this[_0xa6b6('0xb')]=_0x5dc51c['AttachmentId'];}module[_0xa6b6('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index f12ec01..805c79d 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 _0x6a13=['parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','update','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','Action','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','bind','varset','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','prototype','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create'];(function(_0x2d694e,_0x3c6146){var _0x498118=function(_0x203422){while(--_0x203422){_0x2d694e['push'](_0x2d694e['shift']());}};_0x498118(++_0x3c6146);}(_0x6a13,0xb6));var _0x36a1=function(_0x36eb40,_0x497c09){_0x36eb40=_0x36eb40-0x0;var _0x29fb99=_0x6a13[_0x36eb40];return _0x29fb99;};'use strict';var util=require(_0x36a1('0x0'));var _=require(_0x36a1('0x1'));var BPromise=require(_0x36a1('0x2'));var uuid=require(_0x36a1('0x3'));var moment=require(_0x36a1('0x4'));var path=require(_0x36a1('0x5'));var tiff2pdf=require(_0x36a1('0x6'));var gs=require(_0x36a1('0x7'));var logger=require('../../../config/logger')(_0x36a1('0x8'));var ami=require(_0x36a1('0x9'));var rpcDb=require(_0x36a1('0xa'));var Channel=require(_0x36a1('0xb'));var ut=require(_0x36a1('0xc'));var Action=require(_0x36a1('0xd'));var faxAccount=require(_0x36a1('0xe'));var attachment=require(_0x36a1('0xf'));var faxMessage=require(_0x36a1('0x10'));function Fax(_0x2d85d9){this['channels']={};this[_0x36a1('0x11')]=_0x2d85d9[_0x36a1('0x11')];this[_0x36a1('0x12')]=_0x2d85d9[_0x36a1('0x12')];this[_0x36a1('0x13')]={};ami['on']('newchannel',this['syncNewchannel'][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x15'),this['syncVarSet'][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x16'),this['syncNewState'][_0x36a1('0x14')](this));ami['on']('newexten',this[_0x36a1('0x17')]['bind'](this));ami['on'](_0x36a1('0x18'),this[_0x36a1('0x19')]['bind'](this));ami['on'](_0x36a1('0x1a'),this['syncReceiveFax'][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x1b'),this[_0x36a1('0x1c')][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x1d'),this[_0x36a1('0x1e')]['bind'](this));}Fax['prototype'][_0x36a1('0x1f')]=function(_0x44b181){if(_0x44b181[_0x36a1('0x20')]===_0x36a1('0x21')){for(var _0x2ba764 in this['faxAccounts']){if(this[_0x36a1('0x11')][_0x36a1('0x22')](_0x2ba764)){if(_0x44b181[_0x36a1('0x23')]===this['faxAccounts'][_0x2ba764][_0x36a1('0x24')]){this[_0x36a1('0x25')][_0x44b181['uniqueid']]={};this[_0x36a1('0x25')][_0x44b181['uniqueid']]['channel']=_0x44b181['channel'];this['channels'][_0x44b181[_0x36a1('0x26')]]['id']=this[_0x36a1('0x11')][_0x2ba764]['id'];this[_0x36a1('0x25')][_0x44b181[_0x36a1('0x26')]][_0x36a1('0x27')]=this['faxAccounts'][_0x2ba764][_0x36a1('0x27')];logger[_0x36a1('0x28')](_0x44b181['uniqueid'],_0x36a1('0x29'));}}}}if(this['actions'][_0x44b181[_0x36a1('0x26')]]){this['channels'][_0x44b181['uniqueid']]={};this[_0x36a1('0x25')][_0x44b181['uniqueid']][_0x36a1('0x2a')]=_0x44b181['channel'];logger[_0x36a1('0x28')](_0x44b181[_0x36a1('0x26')],_0x36a1('0x29'));}};Fax[_0x36a1('0x2b')]['syncVarSet']=function(_0x3f01b2){if(this[_0x36a1('0x25')][_0x3f01b2[_0x36a1('0x26')]]){for(var _0x4988e4 in _0x3f01b2[_0x36a1('0x2c')]){if(_0x3f01b2[_0x36a1('0x2c')][_0x36a1('0x22')](_0x4988e4)){this[_0x36a1('0x25')][_0x3f01b2[_0x36a1('0x26')]][_0x4988e4]=_0x3f01b2[_0x36a1('0x2d')];}}}};Fax[_0x36a1('0x2b')][_0x36a1('0x2e')]=function(_0x237a82){if(this[_0x36a1('0x25')][_0x237a82['uniqueid']]){this['channels'][_0x237a82[_0x36a1('0x26')]][_0x36a1('0x2f')]=_0x237a82['channelstate'];this[_0x36a1('0x25')][_0x237a82[_0x36a1('0x26')]][_0x36a1('0x30')]=_0x237a82[_0x36a1('0x30')];}};Fax[_0x36a1('0x2b')][_0x36a1('0x17')]=function(_0xfb89be){if(this[_0x36a1('0x25')][_0xfb89be[_0x36a1('0x26')]]){for(var _0x508610 in _0xfb89be[_0x36a1('0x2c')]){if(_0xfb89be[_0x36a1('0x2c')][_0x36a1('0x22')](_0x508610)){this['channels'][_0xfb89be[_0x36a1('0x26')]][_0x508610]=_0xfb89be[_0x36a1('0x2d')];}}}};Fax[_0x36a1('0x2b')][_0x36a1('0x19')]=function(_0x250ba3){if(this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]]){this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]][_0x36a1('0x31')]=_0x250ba3['operation'];this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]]['status']=_0x250ba3[_0x36a1('0x32')];this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]][_0x36a1('0x24')]=_0x250ba3[_0x36a1('0x24')];this[_0x36a1('0x25')][_0x250ba3['uniqueid']][_0x36a1('0x33')]=_0x250ba3['filename'];logger['info'](_0x250ba3[_0x36a1('0x26')],_0x36a1('0x34'));}};Fax[_0x36a1('0x2b')]['syncReceiveFax']=function(_0xd2333){var _0x10ffe6=this;if(this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]){var _0x817028=this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]['id'];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x35')]=_0xd2333[_0x36a1('0x35')];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x36')]=_0xd2333['pagestransferred'];this['channels'][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x24')]=_0xd2333[_0x36a1('0x24')];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]['resolution']=_0xd2333[_0x36a1('0x37')];this['channels'][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x38')]=_0xd2333[_0x36a1('0x38')];this['channels'][_0xd2333['uniqueid']][_0x36a1('0x33')]=_0xd2333[_0x36a1('0x33')];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]['calleridnum']=_0xd2333[_0x36a1('0x39')];if(this['channels'][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x36')]>0x0){tiff2pdf(_0xd2333[_0x36a1('0x33')],'/var/opt/motion2/server/files/attachments/',function(_0x48bc82){logger[_0x36a1('0x28')](_0xd2333[_0x36a1('0x26')],_0x36a1('0x3a'),_0x48bc82['message']);attachment[_0x36a1('0x3b')]({'name':path[_0x36a1('0x3c')](_0xd2333[_0x36a1('0x33')])['name'],'basename':path[_0x36a1('0x3c')](_0xd2333[_0x36a1('0x33')])[_0x36a1('0x27')]+_0x36a1('0x3d'),'type':_0x36a1('0x3e')})[_0x36a1('0x3f')](function(_0x2cf361){faxAccount['notify'](_0x817028,{'from':_0xd2333[_0x36a1('0x39')],'mapKey':_0x36a1('0x8'),'body':path[_0x36a1('0x3c')](_0xd2333[_0x36a1('0x33')])[_0x36a1('0x27')]+_0x36a1('0x3d'),'AttachmentId':_0x2cf361['id']})[_0x36a1('0x40')](function(_0x21ffae){logger[_0x36a1('0x41')](_0xd2333[_0x36a1('0x26')],_0x36a1('0x42'),JSON[_0x36a1('0x43')](_0x21ffae));});})[_0x36a1('0x40')](function(_0x4d8829){logger[_0x36a1('0x41')](_0xd2333[_0x36a1('0x26')],_0x36a1('0x44'),JSON[_0x36a1('0x43')](_0x4d8829));});});}logger[_0x36a1('0x28')](_0xd2333['uniqueid'],_0x36a1('0x44'));}};Fax['prototype']['syncOriginateResponse']=function(_0x3e4d1c){if(this[_0x36a1('0x13')][_0x3e4d1c['uniqueid']]){_['merge'](this[_0x36a1('0x25')][_0x3e4d1c[_0x36a1('0x26')]],_[_0x36a1('0x45')](_0x3e4d1c,[_0x36a1('0x46'),'reason']));}};function updateStatus(_0x56b2fa){if(_0x56b2fa['AttachmentId']){faxMessage[_0x36a1('0x47')](_0x56b2fa[_0x36a1('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x36a1('0x3f')](function(_0x2a8bca){ut[_0x36a1('0x49')]('[Fax][Message][Error][Updated]',_0x2a8bca);})[_0x36a1('0x40')](function(_0x433a1f){ut[_0x36a1('0x49')](_0x36a1('0x4a'),_0x433a1f);});}else{ut[_0x36a1('0x49')](_0x36a1('0x4b'));}}Fax['prototype'][_0x36a1('0x4c')]=function(_0x5827f9,_0x78cbda,_0xeec51){var _0x481918=this;var _0x4b0bd7={};if(_0x78cbda){_0x4b0bd7={'read':_0x78cbda};}else{_0x4b0bd7={'failMessage':_0xeec51};}if(this['actions'][_0x5827f9][_0x36a1('0x48')]){faxMessage[_0x36a1('0x47')](this[_0x36a1('0x13')][_0x5827f9][_0x36a1('0x48')],_0x4b0bd7)[_0x36a1('0x3f')](function(_0x1dc4d8){ut[_0x36a1('0x49')](_0x36a1('0x4d'),_0x1dc4d8);})[_0x36a1('0x40')](function(_0xed440a){ut[_0x36a1('0x49')](_0x36a1('0x4e'),_0xed440a);})[_0x36a1('0x4f')](function(){delete _0x481918[_0x36a1('0x25')][_0x5827f9];delete _0x481918['actions'][_0x5827f9];});}else{ut[_0x36a1('0x49')](_0x36a1('0x50'));delete this[_0x36a1('0x25')][_0x5827f9];delete this['actions'][_0x5827f9];}};Fax['prototype']['syncHangup']=function(_0x217215){var _0x44ffd5=this;if(this['channels'][_0x217215[_0x36a1('0x26')]]){if(this[_0x36a1('0x13')][_0x217215['uniqueid']]){this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]['id']=this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]]['id'];this['channels'][_0x217215['uniqueid']][_0x36a1('0x27')]=this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]][_0x36a1('0x27')];}logger[_0x36a1('0x28')](_0x217215[_0x36a1('0x26')],this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]]?_0x36a1('0x51'):_0x36a1('0x52'),JSON[_0x36a1('0x43')](this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]));if(this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]]){if(this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]['faxpages']>0x0&&this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]['faxstatus']===_0x36a1('0x53')){this[_0x36a1('0x4c')](_0x217215[_0x36a1('0x26')],!![]);}else{this['updateStatus'](_0x217215[_0x36a1('0x26')],![],this['channels'][_0x217215[_0x36a1('0x26')]][_0x36a1('0x54')]?_0x36a1('0x55')+this[_0x36a1('0x25')][_0x217215['uniqueid']][_0x36a1('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x36a1('0x2b')]['send']=function(_0x387a5e){var _0x576079=this;return new BPromise(function(_0x2d062b,_0x4a99d3){_0x576079[_0x36a1('0x56')](_0x387a5e,_0x576079['faxAccounts'][_0x387a5e[_0x36a1('0x57')]])[_0x36a1('0x3f')](function(_0x1fb6dc){ut[_0x36a1('0x49')](_0x36a1('0x58'),_0x1fb6dc);_0x2d062b(ut[_0x36a1('0x59')](_0x36a1('0x5a')));})[_0x36a1('0x40')](function(_0x2f2829){ut['logger'](_0x36a1('0x5b'),_0x2f2829);updateStatus(_0x387a5e);_0x4a99d3(ut[_0x36a1('0x59')](_0x36a1('0x5c')));});});};Fax[_0x36a1('0x2b')]['checkAfterSend']=function(_0x158e54){var _0x24abbf=this;return new BPromise(function(_0x1a94a7,_0xcdb033){var _0x1d81bd=_0x24abbf[_0x36a1('0x5d')](_0x24abbf['faxAccounts'][_0x158e54['FaxAccountId']][_0x36a1('0x5e')],_0x158e54);if(_0x1d81bd[_0x36a1('0x5f')]){_0x1a94a7(ut['message'](_0x36a1('0x60')));}else{_0xcdb033(ut[_0x36a1('0x59')](_0x1d81bd['message']));}});};function originate(_0x3e10c3,_0x4739b4,_0x407dc5){return new BPromise(function(_0x495e1b,_0x1844a5){if(_0x407dc5){var _0x2bde9e=util[_0x36a1('0x61')](_0x36a1('0x62'),path[_0x36a1('0x3c')](_0x3e10c3[_0x36a1('0x5')])['name'],_0x3e10c3[_0x36a1('0x5')]);gs['execute'](_0x2bde9e)[_0x36a1('0x3f')](function(){_0x3e10c3[_0x36a1('0x5')]=util['format'](_0x36a1('0x63'),path[_0x36a1('0x3c')](_0x3e10c3[_0x36a1('0x5')])[_0x36a1('0x64')],path[_0x36a1('0x3c')](_0x3e10c3[_0x36a1('0x5')])[_0x36a1('0x27')]);_0x4739b4[_0x36a1('0x65')]=_0x3e10c3['path'];ut[_0x36a1('0x49')](_0x36a1('0x66'),'');ami[_0x36a1('0x67')](ut[_0x36a1('0x68')](_0x3e10c3,_0x4739b4))[_0x36a1('0x3f')](function(_0x18698b){_0x495e1b(_0x18698b);})[_0x36a1('0x40')](function(_0x584dd5){_0x1844a5(_0x584dd5);});})[_0x36a1('0x40')](function(_0x27ea35){_0x1844a5(_0x27ea35);});}else{ami[_0x36a1('0x67')](ut[_0x36a1('0x68')](_0x3e10c3,_0x4739b4))[_0x36a1('0x3f')](function(_0x3ea8dd){_0x495e1b(_0x3ea8dd);})[_0x36a1('0x40')](function(_0x1b1bf0){_0x1844a5(_0x1b1bf0);});}});}Fax[_0x36a1('0x2b')][_0x36a1('0x56')]=function(_0x251bcc,_0x41baf9){var _0x1d62c1=this;return new BPromise(function(_0x110c6f,_0x479be6){var _0xd0cf94=uuid['v4']();var _0x13a23d=ut[_0x36a1('0x69')](_0x251bcc,_0x41baf9);_0x1d62c1[_0x36a1('0x13')][_0xd0cf94]=new Action(_0xd0cf94,_0x41baf9,_0x251bcc);var _0x42db7e=_0x1d62c1[_0x36a1('0x13')][_0xd0cf94];if(path[_0x36a1('0x3c')](_0x251bcc[_0x36a1('0x5')])['ext']===_0x36a1('0x3d')){originate(_0x42db7e,_0x13a23d,!![])[_0x36a1('0x3f')](function(_0x17f214){_0x110c6f(_0x17f214);})['catch'](function(_0x42777e){_0x479be6(_0x42777e);});}else{originate(_0x42db7e,_0x13a23d,![])['then'](function(_0x1926b1){_0x110c6f(_0x1926b1);})[_0x36a1('0x40')](function(_0x3c2c7c){_0x479be6(_0x3c2c7c);});}});};Fax[_0x36a1('0x2b')]['isTrunkReachable']=function(_0x3bc47e){return!_['isNil'](_0x3bc47e)&&!_[_0x36a1('0x6a')](_0x3bc47e[_0x36a1('0x27')])&&!_[_0x36a1('0x6a')](_0x3bc47e[_0x36a1('0x6b')])&&_0x3bc47e[_0x36a1('0x6b')]&&!_[_0x36a1('0x6a')](this[_0x36a1('0x12')][util[_0x36a1('0x61')](_0x36a1('0x6c'),_0x3bc47e[_0x36a1('0x27')])])&&!_[_0x36a1('0x6a')](this[_0x36a1('0x12')][util['format'](_0x36a1('0x6c'),_0x3bc47e[_0x36a1('0x27')])][_0x36a1('0x32')])&&(this['trunks'][util[_0x36a1('0x61')]('SIP/%s',_0x3bc47e[_0x36a1('0x27')])]['status']===_0x36a1('0x6d')||this[_0x36a1('0x12')][util['format'](_0x36a1('0x6c'),_0x3bc47e[_0x36a1('0x27')])][_0x36a1('0x32')]===_0x36a1('0x6e'));};Fax[_0x36a1('0x2b')][_0x36a1('0x5d')]=function(_0x1030c8,_0x5d42ce){if(!this[_0x36a1('0x6f')](_0x1030c8)){ut[_0x36a1('0x49')](_0x36a1('0x70'),_[_0x36a1('0x6a')](_0x1030c8)?'':_0x1030c8[_0x36a1('0x27')]+_0x36a1('0x71'));return{'isValid':![],'message':_0x36a1('0x72')};}if(_['isNil'](_0x5d42ce[_0x36a1('0x8')])){ut[_0x36a1('0x49')](_0x36a1('0x73'),JSON[_0x36a1('0x43')](_0x5d42ce));return{'isValid':![],'message':_0x36a1('0x74')};}if(_['isNil'](_0x5d42ce['path'])){ut['logger'](_0x36a1('0x75'),JSON[_0x36a1('0x43')](_0x5d42ce));return{'isValid':![],'message':_0x36a1('0x76')};}return{'isValid':!![],'message':_0x36a1('0x77')};};module[_0x36a1('0x78')]=Fax; \ No newline at end of file +var _0x0c53=['name','info','\x20syncNewchannel\x20','hasOwnProperty','value','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','fax','catch','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','exten','localstationid','uniqueid','channels','channel'];(function(_0x1a4134,_0x110ba3){var _0xce32ce=function(_0x56edb5){while(--_0x56edb5){_0x1a4134['push'](_0x1a4134['shift']());}};_0xce32ce(++_0x110ba3);}(_0x0c53,0xcc));var _0x30c5=function(_0x1a30e2,_0x3af185){_0x1a30e2=_0x1a30e2-0x0;var _0x5c3dc2=_0x0c53[_0x1a30e2];return _0x5c3dc2;};'use strict';var util=require(_0x30c5('0x0'));var _=require(_0x30c5('0x1'));var BPromise=require(_0x30c5('0x2'));var uuid=require('uuid');var moment=require(_0x30c5('0x3'));var path=require(_0x30c5('0x4'));var tiff2pdf=require(_0x30c5('0x5'));var gs=require(_0x30c5('0x6'));var logger=require(_0x30c5('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0x30c5('0x8'));var Channel=require('./channel');var ut=require(_0x30c5('0x9'));var Action=require(_0x30c5('0xa'));var faxAccount=require(_0x30c5('0xb'));var attachment=require(_0x30c5('0xc'));var faxMessage=require(_0x30c5('0xd'));function Fax(_0x277159){this['channels']={};this['faxAccounts']=_0x277159['faxAccounts'];this['trunks']=_0x277159['trunks'];this[_0x30c5('0xe')]={};ami['on']('newchannel',this[_0x30c5('0xf')][_0x30c5('0x10')](this));ami['on'](_0x30c5('0x11'),this[_0x30c5('0x12')][_0x30c5('0x10')](this));ami['on']('newstate',this[_0x30c5('0x13')][_0x30c5('0x10')](this));ami['on'](_0x30c5('0x14'),this[_0x30c5('0x15')]['bind'](this));ami['on']('faxstatus',this[_0x30c5('0x16')]['bind'](this));ami['on']('receivefax',this[_0x30c5('0x17')][_0x30c5('0x10')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x30c5('0x18'),this[_0x30c5('0x19')][_0x30c5('0x10')](this));}Fax[_0x30c5('0x1a')][_0x30c5('0xf')]=function(_0x4e8628){if(_0x4e8628['context']===_0x30c5('0x1b')){for(var _0x13559c in this[_0x30c5('0x1c')]){if(this[_0x30c5('0x1c')]['hasOwnProperty'](_0x13559c)){if(_0x4e8628[_0x30c5('0x1d')]===this[_0x30c5('0x1c')][_0x13559c][_0x30c5('0x1e')]){this['channels'][_0x4e8628[_0x30c5('0x1f')]]={};this[_0x30c5('0x20')][_0x4e8628[_0x30c5('0x1f')]][_0x30c5('0x21')]=_0x4e8628['channel'];this['channels'][_0x4e8628[_0x30c5('0x1f')]]['id']=this[_0x30c5('0x1c')][_0x13559c]['id'];this[_0x30c5('0x20')][_0x4e8628[_0x30c5('0x1f')]]['name']=this[_0x30c5('0x1c')][_0x13559c][_0x30c5('0x22')];logger[_0x30c5('0x23')](_0x4e8628[_0x30c5('0x1f')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x4e8628['uniqueid']]){this[_0x30c5('0x20')][_0x4e8628['uniqueid']]={};this[_0x30c5('0x20')][_0x4e8628[_0x30c5('0x1f')]][_0x30c5('0x21')]=_0x4e8628[_0x30c5('0x21')];logger[_0x30c5('0x23')](_0x4e8628[_0x30c5('0x1f')],_0x30c5('0x24'));}};Fax[_0x30c5('0x1a')]['syncVarSet']=function(_0xe8d973){if(this[_0x30c5('0x20')][_0xe8d973[_0x30c5('0x1f')]]){for(var _0x37c9f5 in _0xe8d973['variable']){if(_0xe8d973['variable'][_0x30c5('0x25')](_0x37c9f5)){this[_0x30c5('0x20')][_0xe8d973[_0x30c5('0x1f')]][_0x37c9f5]=_0xe8d973[_0x30c5('0x26')];}}}};Fax['prototype'][_0x30c5('0x13')]=function(_0x3e6bbc){if(this[_0x30c5('0x20')][_0x3e6bbc[_0x30c5('0x1f')]]){this[_0x30c5('0x20')][_0x3e6bbc[_0x30c5('0x1f')]][_0x30c5('0x27')]=_0x3e6bbc['channelstate'];this[_0x30c5('0x20')][_0x3e6bbc[_0x30c5('0x1f')]]['channelstatedesc']=_0x3e6bbc[_0x30c5('0x28')];}};Fax[_0x30c5('0x1a')][_0x30c5('0x15')]=function(_0x51c89e){if(this[_0x30c5('0x20')][_0x51c89e['uniqueid']]){for(var _0x485ad3 in _0x51c89e[_0x30c5('0x29')]){if(_0x51c89e['variable']['hasOwnProperty'](_0x485ad3)){this[_0x30c5('0x20')][_0x51c89e[_0x30c5('0x1f')]][_0x485ad3]=_0x51c89e[_0x30c5('0x26')];}}}};Fax[_0x30c5('0x1a')]['syncFaxStatus']=function(_0x9e9789){if(this['channels'][_0x9e9789[_0x30c5('0x1f')]]){this['channels'][_0x9e9789[_0x30c5('0x1f')]][_0x30c5('0x2a')]=_0x9e9789[_0x30c5('0x2a')];this[_0x30c5('0x20')][_0x9e9789[_0x30c5('0x1f')]]['status']=_0x9e9789[_0x30c5('0x2b')];this[_0x30c5('0x20')][_0x9e9789[_0x30c5('0x1f')]][_0x30c5('0x1e')]=_0x9e9789[_0x30c5('0x1e')];this[_0x30c5('0x20')][_0x9e9789['uniqueid']][_0x30c5('0x2c')]=_0x9e9789['filename'];logger['info'](_0x9e9789['uniqueid'],_0x30c5('0x2d'));}};Fax[_0x30c5('0x1a')][_0x30c5('0x17')]=function(_0x5755ca){var _0x401952=this;if(this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]]){var _0x42706d=this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]]['id'];this[_0x30c5('0x20')][_0x5755ca['uniqueid']][_0x30c5('0x2e')]=_0x5755ca[_0x30c5('0x2e')];this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]][_0x30c5('0x2f')]=_0x5755ca[_0x30c5('0x2f')];this[_0x30c5('0x20')][_0x5755ca['uniqueid']][_0x30c5('0x1e')]=_0x5755ca['localstationid'];this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]][_0x30c5('0x30')]=_0x5755ca[_0x30c5('0x30')];this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]][_0x30c5('0x31')]=_0x5755ca[_0x30c5('0x31')];this['channels'][_0x5755ca['uniqueid']][_0x30c5('0x2c')]=_0x5755ca[_0x30c5('0x2c')];this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]][_0x30c5('0x32')]=_0x5755ca[_0x30c5('0x32')];if(this[_0x30c5('0x20')][_0x5755ca[_0x30c5('0x1f')]][_0x30c5('0x2f')]>0x0){tiff2pdf(_0x5755ca[_0x30c5('0x2c')],_0x30c5('0x33'),function(_0x15739d){logger[_0x30c5('0x23')](_0x5755ca['uniqueid'],_0x30c5('0x34'),_0x15739d[_0x30c5('0x35')]);attachment['create']({'name':path['parse'](_0x5755ca[_0x30c5('0x2c')])['name'],'basename':path[_0x30c5('0x36')](_0x5755ca[_0x30c5('0x2c')])[_0x30c5('0x22')]+_0x30c5('0x37'),'type':_0x30c5('0x38')})['then'](function(_0x53d72e){faxAccount[_0x30c5('0x39')](_0x42706d,{'from':_0x5755ca[_0x30c5('0x32')],'mapKey':_0x30c5('0x3a'),'body':path[_0x30c5('0x36')](_0x5755ca[_0x30c5('0x2c')])[_0x30c5('0x22')]+_0x30c5('0x37'),'AttachmentId':_0x53d72e['id']})[_0x30c5('0x3b')](function(_0x2b3914){logger['error'](_0x5755ca[_0x30c5('0x1f')],_0x30c5('0x3c'),JSON[_0x30c5('0x3d')](_0x2b3914));});})[_0x30c5('0x3b')](function(_0x2a82e4){logger['error'](_0x5755ca[_0x30c5('0x1f')],_0x30c5('0x3e'),JSON[_0x30c5('0x3d')](_0x2a82e4));});});}logger['info'](_0x5755ca[_0x30c5('0x1f')],_0x30c5('0x3e'));}};Fax[_0x30c5('0x1a')][_0x30c5('0x19')]=function(_0xec5c10){if(this[_0x30c5('0xe')][_0xec5c10[_0x30c5('0x1f')]]){_['merge'](this[_0x30c5('0x20')][_0xec5c10[_0x30c5('0x1f')]],_[_0x30c5('0x3f')](_0xec5c10,[_0x30c5('0x40'),_0x30c5('0x41')]));}};function updateStatus(_0x8cf36d){if(_0x8cf36d[_0x30c5('0x42')]){faxMessage['update'](_0x8cf36d[_0x30c5('0x42')],{'failMessage':_0x30c5('0x43')})[_0x30c5('0x44')](function(_0x3be070){ut['logger'](_0x30c5('0x45'),_0x3be070);})[_0x30c5('0x3b')](function(_0x1c1eac){ut[_0x30c5('0x46')](_0x30c5('0x47'),_0x1c1eac);});}else{ut['logger'](_0x30c5('0x48'));}}Fax[_0x30c5('0x1a')][_0x30c5('0x49')]=function(_0x2e6600,_0x71daa8,_0x48cf8c){var _0x20af92=this;var _0x4bc97d={};if(_0x71daa8){_0x4bc97d={'read':_0x71daa8};}else{_0x4bc97d={'failMessage':_0x48cf8c};}if(this[_0x30c5('0xe')][_0x2e6600][_0x30c5('0x42')]){faxMessage[_0x30c5('0x4a')](this[_0x30c5('0xe')][_0x2e6600]['AttachmentId'],_0x4bc97d)[_0x30c5('0x44')](function(_0x26a81e){ut['logger'](_0x30c5('0x4b'),_0x26a81e);})[_0x30c5('0x3b')](function(_0x413170){ut[_0x30c5('0x46')](_0x30c5('0x4c'),_0x413170);})[_0x30c5('0x4d')](function(){delete _0x20af92[_0x30c5('0x20')][_0x2e6600];delete _0x20af92['actions'][_0x2e6600];});}else{ut['logger'](_0x30c5('0x4e'));delete this[_0x30c5('0x20')][_0x2e6600];delete this[_0x30c5('0xe')][_0x2e6600];}};Fax[_0x30c5('0x1a')][_0x30c5('0x4f')]=function(_0x3bfc68){var _0x4a45e6=this;if(this[_0x30c5('0x20')][_0x3bfc68['uniqueid']]){if(this[_0x30c5('0xe')][_0x3bfc68['uniqueid']]){this[_0x30c5('0x20')][_0x3bfc68[_0x30c5('0x1f')]]['id']=this['actions'][_0x3bfc68['uniqueid']]['id'];this['channels'][_0x3bfc68['uniqueid']]['name']=this[_0x30c5('0xe')][_0x3bfc68[_0x30c5('0x1f')]][_0x30c5('0x22')];}logger['info'](_0x3bfc68[_0x30c5('0x1f')],this[_0x30c5('0xe')][_0x3bfc68[_0x30c5('0x1f')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x30c5('0x3d')](this[_0x30c5('0x20')][_0x3bfc68[_0x30c5('0x1f')]]));if(this[_0x30c5('0xe')][_0x3bfc68['uniqueid']]){if(this['channels'][_0x3bfc68[_0x30c5('0x1f')]][_0x30c5('0x50')]>0x0&&this[_0x30c5('0x20')][_0x3bfc68[_0x30c5('0x1f')]]['faxstatus']===_0x30c5('0x51')){this['updateStatus'](_0x3bfc68[_0x30c5('0x1f')],!![]);}else{this[_0x30c5('0x49')](_0x3bfc68['uniqueid'],![],this[_0x30c5('0x20')][_0x3bfc68[_0x30c5('0x1f')]][_0x30c5('0x52')]?_0x30c5('0x53')+this[_0x30c5('0x20')][_0x3bfc68[_0x30c5('0x1f')]][_0x30c5('0x52')]:_0x30c5('0x54'));}}}};Fax[_0x30c5('0x1a')][_0x30c5('0x55')]=function(_0x128ae0){var _0x3a3d5a=this;return new BPromise(function(_0x1419ae,_0x3894e6){_0x3a3d5a[_0x30c5('0x56')](_0x128ae0,_0x3a3d5a[_0x30c5('0x1c')][_0x128ae0[_0x30c5('0x57')]])[_0x30c5('0x44')](function(_0x33f5eb){ut['logger']('[Fax][execOriginate][success]',_0x33f5eb);_0x1419ae(ut[_0x30c5('0x35')](_0x30c5('0x58')));})['catch'](function(_0x3c9117){ut['logger'](_0x30c5('0x59'),_0x3c9117);updateStatus(_0x128ae0);_0x3894e6(ut[_0x30c5('0x35')](_0x30c5('0x5a')));});});};Fax[_0x30c5('0x1a')][_0x30c5('0x5b')]=function(_0x294fa7){var _0x316727=this;return new BPromise(function(_0x353966,_0x4b4d99){var _0x277b5f=_0x316727[_0x30c5('0x5c')](_0x316727[_0x30c5('0x1c')][_0x294fa7[_0x30c5('0x57')]][_0x30c5('0x5d')],_0x294fa7);if(_0x277b5f[_0x30c5('0x5e')]){_0x353966(ut[_0x30c5('0x35')](_0x30c5('0x5f')));}else{_0x4b4d99(ut[_0x30c5('0x35')](_0x277b5f[_0x30c5('0x35')]));}});};function originate(_0x58d5f1,_0x2dc9d3,_0x1d4ddd){return new BPromise(function(_0x25ec3b,_0x1039c9){if(_0x1d4ddd){var _0x1c0984=util[_0x30c5('0x60')](_0x30c5('0x61'),path['parse'](_0x58d5f1['path'])[_0x30c5('0x22')],_0x58d5f1[_0x30c5('0x4')]);gs[_0x30c5('0x62')](_0x1c0984)[_0x30c5('0x44')](function(){_0x58d5f1[_0x30c5('0x4')]=util[_0x30c5('0x60')](_0x30c5('0x63'),path['parse'](_0x58d5f1[_0x30c5('0x4')])[_0x30c5('0x64')],path[_0x30c5('0x36')](_0x58d5f1['path'])['name']);_0x2dc9d3[_0x30c5('0x65')]=_0x58d5f1[_0x30c5('0x4')];ut[_0x30c5('0x46')](_0x30c5('0x66'),'');ami[_0x30c5('0x67')](ut[_0x30c5('0x68')](_0x58d5f1,_0x2dc9d3))[_0x30c5('0x44')](function(_0x30cb2d){_0x25ec3b(_0x30cb2d);})['catch'](function(_0x36a4de){_0x1039c9(_0x36a4de);});})['catch'](function(_0x1fdc7a){_0x1039c9(_0x1fdc7a);});}else{ami[_0x30c5('0x67')](ut[_0x30c5('0x68')](_0x58d5f1,_0x2dc9d3))[_0x30c5('0x44')](function(_0x55e75f){_0x25ec3b(_0x55e75f);})[_0x30c5('0x3b')](function(_0x1612e2){_0x1039c9(_0x1612e2);});}});}Fax[_0x30c5('0x1a')][_0x30c5('0x56')]=function(_0xc00e29,_0x293ae7){var _0x142ffd=this;return new BPromise(function(_0x588df7,_0x1f04e5){var _0x8e9b50=uuid['v4']();var _0x1636ab=ut[_0x30c5('0x69')](_0xc00e29,_0x293ae7);_0x142ffd[_0x30c5('0xe')][_0x8e9b50]=new Action(_0x8e9b50,_0x293ae7,_0xc00e29);var _0xd92b92=_0x142ffd[_0x30c5('0xe')][_0x8e9b50];if(path[_0x30c5('0x36')](_0xc00e29['path'])[_0x30c5('0x6a')]===_0x30c5('0x37')){originate(_0xd92b92,_0x1636ab,!![])[_0x30c5('0x44')](function(_0x420ec0){_0x588df7(_0x420ec0);})[_0x30c5('0x3b')](function(_0x467617){_0x1f04e5(_0x467617);});}else{originate(_0xd92b92,_0x1636ab,![])[_0x30c5('0x44')](function(_0x82451f){_0x588df7(_0x82451f);})[_0x30c5('0x3b')](function(_0x188ac8){_0x1f04e5(_0x188ac8);});}});};Fax[_0x30c5('0x1a')][_0x30c5('0x6b')]=function(_0xe2a7f6){return!_['isNil'](_0xe2a7f6)&&!_['isNil'](_0xe2a7f6[_0x30c5('0x22')])&&!_[_0x30c5('0x6c')](_0xe2a7f6[_0x30c5('0x6d')])&&_0xe2a7f6['active']&&!_[_0x30c5('0x6c')](this[_0x30c5('0x6e')][util[_0x30c5('0x60')](_0x30c5('0x6f'),_0xe2a7f6[_0x30c5('0x22')])])&&!_[_0x30c5('0x6c')](this[_0x30c5('0x6e')][util[_0x30c5('0x60')](_0x30c5('0x6f'),_0xe2a7f6[_0x30c5('0x22')])][_0x30c5('0x2b')])&&(this[_0x30c5('0x6e')][util[_0x30c5('0x60')](_0x30c5('0x6f'),_0xe2a7f6['name'])]['status']===_0x30c5('0x70')||this['trunks'][util[_0x30c5('0x60')](_0x30c5('0x6f'),_0xe2a7f6[_0x30c5('0x22')])][_0x30c5('0x2b')]==='unmonitored');};Fax['prototype'][_0x30c5('0x5c')]=function(_0x5a3a09,_0x5946cf){if(!this[_0x30c5('0x6b')](_0x5a3a09)){ut[_0x30c5('0x46')](_0x30c5('0x71'),_['isNil'](_0x5a3a09)?'':_0x5a3a09['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x30c5('0x72')};}if(_[_0x30c5('0x6c')](_0x5946cf[_0x30c5('0x3a')])){ut[_0x30c5('0x46')](_0x30c5('0x73'),JSON['stringify'](_0x5946cf));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x30c5('0x6c')](_0x5946cf[_0x30c5('0x4')])){ut[_0x30c5('0x46')](_0x30c5('0x74'),JSON[_0x30c5('0x3d')](_0x5946cf));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x30c5('0x75')};};module[_0x30c5('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index bcab75a..dcb2910 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 _0xf958=['notify','resolve','then','[Notify]\x20','util','../../../config/logger','preview','lodash','error','inspect'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xf958,0x7c));var _0x8f95=function(_0x16d7a6,_0x4dac64){_0x16d7a6=_0x16d7a6-0x0;var _0x397bc1=_0xf958[_0x16d7a6];return _0x397bc1;};'use strict';var util=require(_0x8f95('0x0'));var BPromise=require('bluebird');var logger=require(_0x8f95('0x1'))(_0x8f95('0x2'));var _=require(_0x8f95('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x347514){return function(_0x1e2494){logger[_0x8f95('0x4')](_0x347514,util[_0x8f95('0x5')](_0x1e2494,{'showHidden':![],'depth':null}));};}exports[_0x8f95('0x6')]=function(_0xf37597,_0x5a15f6){return BPromise[_0x8f95('0x7')]()[_0x8f95('0x8')](faxAccount[_0x8f95('0x6')](_0xf37597,_0x5a15f6))['catch'](loggerCatch(_0x8f95('0x9')));}; \ No newline at end of file +var _0xd16a=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','bluebird'];(function(_0x197cbf,_0x3274d6){var _0x1f1826=function(_0x2ffa4c){while(--_0x2ffa4c){_0x197cbf['push'](_0x197cbf['shift']());}};_0x1f1826(++_0x3274d6);}(_0xd16a,0x106));var _0xad16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd16a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xad16('0x0'));var BPromise=require(_0xad16('0x1'));var logger=require(_0xad16('0x2'))(_0xad16('0x3'));var _=require(_0xad16('0x4'));var faxAccount=require(_0xad16('0x5'));function loggerCatch(_0x460851){return function(_0x589a5f){logger[_0xad16('0x6')](_0x460851,util[_0xad16('0x7')](_0x589a5f,{'showHidden':![],'depth':null}));};}exports[_0xad16('0x8')]=function(_0x3f5239,_0x2f0bb9){return BPromise[_0xad16('0x9')]()[_0xad16('0xa')](faxAccount[_0xad16('0x8')](_0x3f5239,_0x2f0bb9))['catch'](loggerCatch(_0xad16('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 23a9b0b..d53876b 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 _0x9936=['info','Exec\x20gs','\x20Error\x20:','inspect','fax','bluebird','child_process','execute'];(function(_0x180af9,_0x165ec5){var _0x19d764=function(_0x3a1086){while(--_0x3a1086){_0x180af9['push'](_0x180af9['shift']());}};_0x19d764(++_0x165ec5);}(_0x9936,0x9c));var _0x6993=function(_0x567703,_0x4b1cfa){_0x567703=_0x567703-0x0;var _0x1cd94a=_0x9936[_0x567703];return _0x1cd94a;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x6993('0x0'));var BPromise=require(_0x6993('0x1'));var exec=require(_0x6993('0x2'))['exec'];exports[_0x6993('0x3')]=function(_0x13f446){return new BPromise(function(_0x22c822,_0x146563){exec(_0x13f446,function(_0x894b1b,_0x5728fc,_0x140ca8){logger[_0x6993('0x4')]('Exec\x20gs',_0x5728fc);if(_0x894b1b){logger[_0x6993('0x4')](_0x6993('0x5'),_0x6993('0x6'),util[_0x6993('0x7')](_0x894b1b,{'showHidden':![],'depth':null}),_0x5728fc,_0x140ca8);_0x146563(_0x894b1b);}_0x22c822(_0x5728fc);});});}; \ No newline at end of file +var _0xc568=['inspect','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xc568,0xc9));var _0x8c56=function(_0x2740d9,_0xfcea46){_0x2740d9=_0x2740d9-0x0;var _0x1c5f67=_0xc568[_0x2740d9];return _0x1c5f67;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x8c56('0x0'));var BPromise=require(_0x8c56('0x1'));var exec=require(_0x8c56('0x2'))['exec'];exports[_0x8c56('0x3')]=function(_0x2b14a4){return new BPromise(function(_0x3cd9a1,_0x16b2ba){exec(_0x2b14a4,function(_0x4f2f6a,_0x901c26,_0x1d2f51){logger[_0x8c56('0x4')](_0x8c56('0x5'),_0x901c26);if(_0x4f2f6a){logger[_0x8c56('0x4')](_0x8c56('0x5'),_0x8c56('0x6'),util[_0x8c56('0x7')](_0x4f2f6a,{'showHidden':![],'depth':null}),_0x901c26,_0x1d2f51);_0x16b2ba(_0x4f2f6a);}_0x3cd9a1(_0x901c26);});});}; \ 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 dc401a5..a7ec2a9 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 _0xedd9=['\x22%s\x22\x20<%s>','localstationid','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x1a5016,_0x3ee8de){var _0x23b4fe=function(_0x9d89f9){while(--_0x9d89f9){_0x1a5016['push'](_0x1a5016['shift']());}};_0x23b4fe(++_0x3ee8de);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f7492,_0x129dbe){_0x4f7492=_0x4f7492-0x0;var _0x2f8eff=_0xedd9[_0x4f7492];return _0x2f8eff;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var logger=require(_0x9edd('0x2'))(_0x9edd('0x3'));exports[_0x9edd('0x4')]=function(_0x127cbe){return{'message':_0x127cbe};};exports[_0x9edd('0x5')]=function(_0x36b53f,_0x5943b3){logger[_0x9edd('0x6')](_0x36b53f,util[_0x9edd('0x7')](_0x5943b3,{'showHidden':![],'depth':null}));};exports[_0x9edd('0x8')]=function(_0x34c1a7,_0x5319f7){var _0xf0b2d8={'XMF-ECM':_0x5319f7['ecm'],'XMF-HEADERINFO':_0x5319f7[_0x9edd('0x9')],'XMF-MINRATE':_0x5319f7[_0x9edd('0xa')],'XMF-MAXRATE':_0x5319f7[_0x9edd('0xb')],'XMF-MODEM':util[_0x9edd('0xc')]('\x22%s\x22',_0x5319f7[_0x9edd('0xd')]),'XMF-GATEWAY':_0x5319f7['gateway'],'XMF-FAXDETECT':_0x5319f7[_0x9edd('0xe')],'XMF-T38TIMEOUT':_0x5319f7[_0x9edd('0xf')],'XMF-LOCALSTATIONID':_0x5319f7['localstationid'],'XMF-PATH':_0x34c1a7[_0x9edd('0x10')]};return _0xf0b2d8;};exports[_0x9edd('0x11')]=function(_0x5b6c00,_0x30c0d7){return{'actionid':_0x5b6c00[_0x9edd('0x12')],'action':_0x9edd('0x13'),'channel':_0x5b6c00[_0x9edd('0x14')],'Exten':_0x9edd('0x15'),'Context':_0x9edd('0x16'),'Priority':'1','callerid':util[_0x9edd('0xc')](_0x9edd('0x17'),_0x5b6c00['headerinfo']?_0x5b6c00[_0x9edd('0x9')]:'',_0x5b6c00[_0x9edd('0x18')]),'variable':_0x30c0d7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5b6c00[_0x9edd('0x12')]};}; \ No newline at end of file +var _0x2e54=['addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','../../../../config/logger','fax','message','logger','inspect'];(function(_0x2f64d7,_0x2abd4e){var _0x3f94d1=function(_0x4a495d){while(--_0x4a495d){_0x2f64d7['push'](_0x2f64d7['shift']());}};_0x3f94d1(++_0x2abd4e);}(_0x2e54,0x1dd));var _0x42e5=function(_0x147272,_0x28e0ee){_0x147272=_0x147272-0x0;var _0x35fb73=_0x2e54[_0x147272];return _0x35fb73;};'use strict';var util=require(_0x42e5('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x42e5('0x1'))(_0x42e5('0x2'));exports[_0x42e5('0x3')]=function(_0x1c62bb){return{'message':_0x1c62bb};};exports[_0x42e5('0x4')]=function(_0x153440,_0x42736b){logger['info'](_0x153440,util[_0x42e5('0x5')](_0x42736b,{'showHidden':![],'depth':null}));};exports[_0x42e5('0x6')]=function(_0x38cb1b,_0x4bed10){var _0x2af5bb={'XMF-ECM':_0x4bed10['ecm'],'XMF-HEADERINFO':_0x4bed10[_0x42e5('0x7')],'XMF-MINRATE':_0x4bed10['minrate'],'XMF-MAXRATE':_0x4bed10[_0x42e5('0x8')],'XMF-MODEM':util[_0x42e5('0x9')](_0x42e5('0xa'),_0x4bed10[_0x42e5('0xb')]),'XMF-GATEWAY':_0x4bed10[_0x42e5('0xc')],'XMF-FAXDETECT':_0x4bed10[_0x42e5('0xd')],'XMF-T38TIMEOUT':_0x4bed10[_0x42e5('0xe')],'XMF-LOCALSTATIONID':_0x4bed10[_0x42e5('0xf')],'XMF-PATH':_0x38cb1b[_0x42e5('0x10')]};return _0x2af5bb;};exports['variablesAction']=function(_0x456298,_0x28b3b3){return{'actionid':_0x456298['uniqueid'],'action':_0x42e5('0x11'),'channel':_0x456298[_0x42e5('0x12')],'Exten':_0x42e5('0x13'),'Context':_0x42e5('0x14'),'Priority':'1','callerid':util[_0x42e5('0x9')](_0x42e5('0x15'),_0x456298[_0x42e5('0x7')]?_0x456298[_0x42e5('0x7')]:'',_0x456298[_0x42e5('0xf')]),'variable':_0x28b3b3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x456298[_0x42e5('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4fcce49..86f2b90 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 _0xe7f2=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0xe7f2,0x175));var _0x2e7f=function(_0x5e513a,_0xa81de6){_0x5e513a=_0x5e513a-0x0;var _0x1025cd=_0xe7f2[_0x5e513a];return _0x1025cd;};'use strict';var BPromise=require(_0x2e7f('0x0'));var util=require('util');var moment=require(_0x2e7f('0x1'));var server=require('./server');var Realtime=require(_0x2e7f('0x2'));var Report=require(_0x2e7f('0x3'));var Acw=require(_0x2e7f('0x4'));var Trigger=require(_0x2e7f('0x5'));var Dialer=require(_0x2e7f('0x6'));var Preview=require('./preview');var Fax=require(_0x2e7f('0x7'));var user=require(_0x2e7f('0x8'));var voiceQueue=require(_0x2e7f('0x9'));var voiceQueueReport=require(_0x2e7f('0xa'));var voiceCallReport=require(_0x2e7f('0xb'));var trunk=require(_0x2e7f('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x2e7f('0xd'));var cmHopperHistory=require(_0x2e7f('0xe'));var campaign=require(_0x2e7f('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x2e7f('0x10'));var zendesk=require(_0x2e7f('0x11'));var salesforce=require(_0x2e7f('0x12'));var sugarcrm=require(_0x2e7f('0x13'));var freshdesk=require(_0x2e7f('0x14'));var desk=require(_0x2e7f('0x15'));var zoho=require(_0x2e7f('0x16'));var vtiger=require(_0x2e7f('0x17'));var freshsales=require(_0x2e7f('0x18'));var servicenow=require(_0x2e7f('0x19'));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()[_0x2e7f('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2e7f('0x1a')](_0x2e7f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2e7f('0x1c')](user[_0x2e7f('0x1d')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x1e')]())[_0x2e7f('0x1c')](user[_0x2e7f('0x1f')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x20')]())[_0x2e7f('0x1c')](trunk[_0x2e7f('0x21')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x22')]())['then'](voiceQueue[_0x2e7f('0x23')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x24')]())['then'](trigger[_0x2e7f('0x25')]())[_0x2e7f('0x1c')](realtime['initTriggers']())[_0x2e7f('0x1c')](template[_0x2e7f('0x26')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x27')]())[_0x2e7f('0x1c')](zendesk[_0x2e7f('0x28')]())['then'](realtime['initZendeskAccounts']())['then'](salesforce[_0x2e7f('0x29')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x2a')]())[_0x2e7f('0x1c')](sugarcrm[_0x2e7f('0x2b')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x2c')]())[_0x2e7f('0x1c')](freshdesk[_0x2e7f('0x2d')]())[_0x2e7f('0x1c')](realtime['initFreshdeskAccounts']())[_0x2e7f('0x1c')](desk['getDeskAccounts']())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x2e')]())[_0x2e7f('0x1c')](zoho[_0x2e7f('0x2f')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x30')]())[_0x2e7f('0x1c')](vtiger[_0x2e7f('0x31')]())[_0x2e7f('0x1c')](realtime['initVtigerAccounts']())[_0x2e7f('0x1c')](freshsales[_0x2e7f('0x32')]())[_0x2e7f('0x1c')](realtime['initFreshsalesAccounts']())[_0x2e7f('0x1c')](servicenow[_0x2e7f('0x33')]())['then'](realtime[_0x2e7f('0x34')]())[_0x2e7f('0x1c')](dynamics365[_0x2e7f('0x35')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x36')]())['then'](campaign[_0x2e7f('0x37')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x38')]())[_0x2e7f('0x1c')](voiceExtension['getVoiceExtensions']())[_0x2e7f('0x1c')](realtime['initVoiceExtensions']())[_0x2e7f('0x1c')](faxAccount[_0x2e7f('0x39')]())['then'](realtime[_0x2e7f('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x2e7f('0x3b')]()[_0x2e7f('0x1c')](voiceQueueReport[_0x2e7f('0x3c')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x3d')]())[_0x2e7f('0x1c')](cmHopperHistory[_0x2e7f('0x3e')]())[_0x2e7f('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x2e7f('0x3f')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x40')]())[_0x2e7f('0x1c')](voiceCallReport[_0x2e7f('0x41')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x42')]())[_0x2e7f('0x1c')](function(_0x2c709f){})[_0x2e7f('0x43')](function(_0x15b7d7){console[_0x2e7f('0x44')](_0x15b7d7);});}function main(){return server[_0x2e7f('0x45')](realtime,preview,fax)['then'](function(_0x1290d){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x2e7f('0x46')]();setInterval(initRealtime,0x1388);})[_0x2e7f('0x43')](function(_0x152fa3){console[_0x2e7f('0x44')](_0x152fa3);});}main(); \ No newline at end of file +var _0xc7dc=['initDeskAccounts','getZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts'];(function(_0x1d1786,_0x53116d){var _0x59c5d0=function(_0x404458){while(--_0x404458){_0x1d1786['push'](_0x1d1786['shift']());}};_0x59c5d0(++_0x53116d);}(_0xc7dc,0x1a3));var _0xcc7d=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0xc7dc[_0x45cb89];return _0x5948c1;};'use strict';var BPromise=require('bluebird');var util=require(_0xcc7d('0x0'));var moment=require(_0xcc7d('0x1'));var server=require(_0xcc7d('0x2'));var Realtime=require(_0xcc7d('0x3'));var Report=require(_0xcc7d('0x4'));var Acw=require(_0xcc7d('0x5'));var Trigger=require(_0xcc7d('0x6'));var Dialer=require('./dialer');var Preview=require(_0xcc7d('0x7'));var Fax=require(_0xcc7d('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xcc7d('0x9'));var voiceQueueReport=require(_0xcc7d('0xa'));var voiceCallReport=require(_0xcc7d('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0xcc7d('0xc'));var template=require(_0xcc7d('0xd'));var cmHopperHistory=require(_0xcc7d('0xe'));var campaign=require(_0xcc7d('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xcc7d('0x10'));var zendesk=require(_0xcc7d('0x11'));var salesforce=require(_0xcc7d('0x12'));var sugarcrm=require(_0xcc7d('0x13'));var freshdesk=require(_0xcc7d('0x14'));var desk=require(_0xcc7d('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xcc7d('0x16'));var freshsales=require(_0xcc7d('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xcc7d('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcc7d('0x19')](_0xcc7d('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcc7d('0x1b')]()[_0xcc7d('0x1c')](user[_0xcc7d('0x1d')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x1e')]())['then'](user[_0xcc7d('0x1f')]())[_0xcc7d('0x1c')](realtime['initTelephones']())[_0xcc7d('0x1c')](trunk[_0xcc7d('0x20')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x21')]())[_0xcc7d('0x1c')](voiceQueue[_0xcc7d('0x22')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x23')]())[_0xcc7d('0x1c')](trigger['getTriggers']())[_0xcc7d('0x1c')](realtime['initTriggers']())[_0xcc7d('0x1c')](template['getTemplates']())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x24')]())['then'](zendesk[_0xcc7d('0x25')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x26')]())[_0xcc7d('0x1c')](salesforce[_0xcc7d('0x27')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x28')]())[_0xcc7d('0x1c')](sugarcrm[_0xcc7d('0x29')]())[_0xcc7d('0x1c')](realtime['initSugarcrmAccounts']())[_0xcc7d('0x1c')](freshdesk['getFreshdeskAccounts']())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x2a')]())[_0xcc7d('0x1c')](desk['getDeskAccounts']())['then'](realtime[_0xcc7d('0x2b')]())[_0xcc7d('0x1c')](zoho[_0xcc7d('0x2c')]())[_0xcc7d('0x1c')](realtime['initZohoAccounts']())[_0xcc7d('0x1c')](vtiger[_0xcc7d('0x2d')]())[_0xcc7d('0x1c')](realtime['initVtigerAccounts']())[_0xcc7d('0x1c')](freshsales[_0xcc7d('0x2e')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x2f')]())[_0xcc7d('0x1c')](servicenow['getServicenowAccounts']())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x30')]())['then'](dynamics365[_0xcc7d('0x31')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x32')]())['then'](campaign[_0xcc7d('0x33')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x34')]())['then'](voiceExtension[_0xcc7d('0x35')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x36')]())[_0xcc7d('0x1c')](faxAccount[_0xcc7d('0x37')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x38')]())[_0xcc7d('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xcc7d('0x1b')]()[_0xcc7d('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x39')]())['then'](cmHopperHistory[_0xcc7d('0x3a')]())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x3b')]())[_0xcc7d('0x1c')](cmHopperHistory[_0xcc7d('0x3c')]())[_0xcc7d('0x1c')](realtime['initCampaignHopperHistory']())[_0xcc7d('0x1c')](voiceCallReport['getVoiceCallReports']())[_0xcc7d('0x1c')](realtime[_0xcc7d('0x3d')]())[_0xcc7d('0x1c')](function(_0x4e4a3c){})[_0xcc7d('0x3e')](function(_0x2da542){console[_0xcc7d('0x3f')](_0x2da542);});}function main(){return server[_0xcc7d('0x40')](realtime,preview,fax)[_0xcc7d('0x1c')](function(_0x43f993){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xcc7d('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3ee3f2){console[_0xcc7d('0x3f')](_0x3ee3f2);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index ade13ea..3b50d86 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 _0x8be7=['statePause','voiceStatusTime','toNumber','format','address','user:%s','emit','exports','util','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','phone','mobile','interface','online','voiceStatus','unknown','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse'];(function(_0x5bff0,_0x20716d){var _0x3ead2e=function(_0x14f592){while(--_0x14f592){_0x5bff0['push'](_0x5bff0['shift']());}};_0x3ead2e(++_0x20716d);}(_0x8be7,0x98));var _0x78be=function(_0x2947d1,_0x5e70b0){_0x2947d1=_0x2947d1-0x0;var _0x2b36a5=_0x8be7[_0x2947d1];return _0x2b36a5;};'use strict';var _=require('lodash');var util=require(_0x78be('0x0'));var moment=require('moment');var md5=require(_0x78be('0x1'));var Redis=require(_0x78be('0x2'));var config=require(_0x78be('0x3'));config[_0x78be('0x4')]=_[_0x78be('0x5')](config[_0x78be('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x78be('0x6'))(new Redis(config[_0x78be('0x4')]));function Agent(_0x2f67e8){this['id']=_0x2f67e8['id']||0x0;this[_0x78be('0x7')]=_0x2f67e8['name']||'';this[_0x78be('0x8')]=_0x2f67e8['email']||'';this['accountcode']=_0x2f67e8[_0x78be('0x9')]||'';this[_0x78be('0xa')]=_0x2f67e8['fullname']||'';this[_0x78be('0xb')]='unknown';this[_0x78be('0xc')]=0x0;this[_0x78be('0xd')]='unknown';this['address']='';this[_0x78be('0xe')]='';this[_0x78be('0xf')]='';this[_0x78be('0x10')]='';this[_0x78be('0x11')]=_0x2f67e8[_0x78be('0x11')]||![];this[_0x78be('0x12')]=_0x78be('0x13');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x78be('0x14')]='';this[_0x78be('0x15')]=![];this[_0x78be('0x16')]=![];this[_0x78be('0x1')]='';}Agent[_0x78be('0x17')][_0x78be('0x18')]=function(_0x3484f0){var _0x4204d9;if(_0x3484f0&&_0x3484f0[_0x78be('0xb')]){_0x4204d9=_0x3484f0[_0x78be('0xb')][_0x78be('0x19')]();switch(_0x4204d9){case'not_inuse':_0x4204d9=_0x78be('0x1a');break;case _0x78be('0x1b'):_0x4204d9='talking';break;}}if(_0x4204d9&&this[_0x78be('0x12')]!==_0x4204d9||_0x3484f0[_0x78be('0x1c')]){this[_0x78be('0x1d')]=_[_0x78be('0x1e')](moment()[_0x78be('0x1f')]('x'));}if(_0x4204d9){this[_0x78be('0x12')]=_0x4204d9;}var _0x53f12c={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x78be('0x9')],'fullname':this['fullname'],'state':this[_0x78be('0xb')],'stateTime':this[_0x78be('0xc')],'status':this[_0x78be('0xd')],'address':this[_0x78be('0x20')],'online':this[_0x78be('0x11')],'voiceStatus':this[_0x78be('0x12')],'voiceStatusTime':this[_0x78be('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x78be('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x4c90ff=md5(JSON['stringify'](_0x53f12c));if(this[_0x78be('0x1')]!==_0x4c90ff){this[_0x78be('0x1')]=_0x4c90ff;io['to'](util[_0x78be('0x1f')](_0x78be('0x21'),_0x53f12c[_0x78be('0x7')]))[_0x78be('0x22')]('user:save',_0x53f12c);}};module[_0x78be('0x23')]=Agent; \ No newline at end of file +var _0x138a=['accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','state','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause','voiceStatusTime','format','onhold','stringify','user:%s','emit','user:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email'];(function(_0x2dcab5,_0x7bfa92){var _0x1af7c5=function(_0x1ca98e){while(--_0x1ca98e){_0x2dcab5['push'](_0x2dcab5['shift']());}};_0x1af7c5(++_0x7bfa92);}(_0x138a,0x117));var _0xa138=function(_0x5bfa44,_0x3b17f7){_0x5bfa44=_0x5bfa44-0x0;var _0x1b28ac=_0x138a[_0x5bfa44];return _0x1b28ac;};'use strict';var _=require(_0xa138('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0xa138('0x1'));var Redis=require(_0xa138('0x2'));var config=require(_0xa138('0x3'));config[_0xa138('0x4')]=_[_0xa138('0x5')](config[_0xa138('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa138('0x6'))(new Redis(config[_0xa138('0x4')]));function Agent(_0x4fa582){this['id']=_0x4fa582['id']||0x0;this[_0xa138('0x7')]=_0x4fa582[_0xa138('0x7')]||'';this['email']=_0x4fa582[_0xa138('0x8')]||'';this[_0xa138('0x9')]=_0x4fa582['accountcode']||'';this['fullname']=_0x4fa582[_0xa138('0xa')]||'';this['state']=_0xa138('0xb');this[_0xa138('0xc')]=0x0;this[_0xa138('0xd')]=_0xa138('0xb');this[_0xa138('0xe')]='';this['phone']='';this[_0xa138('0xf')]='';this[_0xa138('0x10')]='';this[_0xa138('0x11')]=_0x4fa582['online']||![];this['voiceStatus']=_0xa138('0xb');this['voiceStatusTime']=0x0;this[_0xa138('0x12')]='';this[_0xa138('0x13')]='';this['onhold']=![];this[_0xa138('0x14')]=![];this[_0xa138('0x1')]='';}Agent[_0xa138('0x15')]['updateStatusRealtime']=function(_0x3fe549){var _0x18e9f3;if(_0x3fe549&&_0x3fe549[_0xa138('0x16')]){_0x18e9f3=_0x3fe549[_0xa138('0x16')][_0xa138('0x17')]();switch(_0x18e9f3){case _0xa138('0x18'):_0x18e9f3='idle';break;case _0xa138('0x19'):_0x18e9f3=_0xa138('0x1a');break;}}if(_0x18e9f3&&this[_0xa138('0x1b')]!==_0x18e9f3||_0x3fe549[_0xa138('0x1c')]){this[_0xa138('0x1d')]=_['toNumber'](moment()[_0xa138('0x1e')]('x'));}if(_0x18e9f3){this[_0xa138('0x1b')]=_0x18e9f3;}var _0x565929={'id':this['id'],'name':this[_0xa138('0x7')],'email':this[_0xa138('0x8')],'accountcode':this[_0xa138('0x9')],'fullname':this['fullname'],'state':this[_0xa138('0x16')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xa138('0xe')],'online':this['online'],'voiceStatus':this[_0xa138('0x1b')],'voiceStatusTime':this[_0xa138('0x1d')],'voiceStatusCallerIdNumber':this[_0xa138('0x12')],'voiceStatusQueue':this[_0xa138('0x13')],'interface':this[_0xa138('0x10')],'onhold':this[_0xa138('0x1f')]};var _0x121ba7=md5(JSON[_0xa138('0x20')](_0x565929));if(this[_0xa138('0x1')]!==_0x121ba7){this[_0xa138('0x1')]=_0x121ba7;io['to'](util['format'](_0xa138('0x21'),_0x565929[_0xa138('0x7')]))[_0xa138('0x22')](_0xa138('0x23'),_0x565929);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b096636..76fe99c 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 _0xcd60=['dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcd60,0xf0));var _0x0cd6=function(_0x83208b,_0x5d8d6a){_0x83208b=_0x83208b-0x0;var _0x36049a=_0xcd60[_0x83208b];return _0x36049a;};'use strict';function Campaign(_0x4c4335){this['id']=_0x4c4335['id']||0x0;this[_0x0cd6('0x0')]=_0x4c4335[_0x0cd6('0x0')]||'';this[_0x0cd6('0x1')]=_0x4c4335[_0x0cd6('0x1')]||_0x0cd6('0x2');this[_0x0cd6('0x3')]=0x0;this['temp']=0x0;this[_0x0cd6('0x4')]=0x0;this[_0x0cd6('0x5')]=0x0;this[_0x0cd6('0x6')]='';this[_0x0cd6('0x7')]=!![];this[_0x0cd6('0x8')]=_0x4c4335['active'];this[_0x0cd6('0x9')]=_0x4c4335[_0x0cd6('0x9')];this['dialTimezone']=_0x4c4335[_0x0cd6('0xa')]||null;this['dialGlobalInterval']=_0x4c4335[_0x0cd6('0xb')]?_0x4c4335[_0x0cd6('0xb')]:null;this[_0x0cd6('0xc')]=_0x4c4335[_0x0cd6('0xc')];this[_0x0cd6('0xd')]=_0x4c4335['dialOriginateCallerIdNumber'];this[_0x0cd6('0xe')]=_0x4c4335[_0x0cd6('0xe')]||0x1e;this[_0x0cd6('0xf')]=_0x4c4335[_0x0cd6('0xf')];this[_0x0cd6('0x10')]=_0x4c4335['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x4c4335[_0x0cd6('0x11')];this[_0x0cd6('0x12')]=_0x4c4335[_0x0cd6('0x12')];this['dialNoAnswerMaxRetry']=_0x4c4335[_0x0cd6('0x13')];this['dialNoAnswerRetryFrequency']=_0x4c4335[_0x0cd6('0x14')];this[_0x0cd6('0x15')]=_0x4c4335[_0x0cd6('0x15')];this[_0x0cd6('0x16')]=_0x4c4335[_0x0cd6('0x16')]||0x3;this[_0x0cd6('0x17')]=_0x4c4335[_0x0cd6('0x17')]||0x96;this[_0x0cd6('0x18')]=_0x4c4335[_0x0cd6('0x18')]||0x3;this[_0x0cd6('0x19')]=_0x4c4335[_0x0cd6('0x19')]||0x96;this[_0x0cd6('0x1a')]=_0x4c4335[_0x0cd6('0x1a')]||0x3;this[_0x0cd6('0x1b')]=_0x4c4335['dialAbandonedRetryFrequency']||0x96;this[_0x0cd6('0x1c')]=_0x4c4335[_0x0cd6('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x4c4335['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x4c4335[_0x0cd6('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4c4335['dialAgentRejectRetryFrequency']||0x96;this[_0x0cd6('0x1e')]=_0x4c4335['dialOrderByScheduledAt']||_0x0cd6('0x1f');this[_0x0cd6('0x20')]=_0x4c4335[_0x0cd6('0x20')]||undefined;this[_0x0cd6('0x21')]=_0x4c4335[_0x0cd6('0x21')]||undefined;this[_0x0cd6('0x22')]=_0x4c4335[_0x0cd6('0x22')]||undefined;this[_0x0cd6('0x23')]=_0x4c4335['TrunkBackup']?_0x4c4335[_0x0cd6('0x23')]:undefined;this[_0x0cd6('0x24')]=_0x4c4335[_0x0cd6('0x24')]?_0x4c4335['Trunk']:undefined;this['Interval']=_0x4c4335['Interval']?_0x4c4335[_0x0cd6('0x25')]:undefined;this['SquareProject']=_0x4c4335['SquareProject']?_0x4c4335['SquareProject']:undefined;this['dialQueueProject']=_0x4c4335[_0x0cd6('0x26')]?_0x4c4335[_0x0cd6('0x26')][_0x0cd6('0x0')]:undefined;this[_0x0cd6('0x27')]=_0x4c4335['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x4c4335[_0x0cd6('0x28')];this['dialAMDGreeting']=_0x4c4335[_0x0cd6('0x29')];this[_0x0cd6('0x2a')]=_0x4c4335[_0x0cd6('0x2a')];this[_0x0cd6('0x2b')]=_0x4c4335[_0x0cd6('0x2b')];this[_0x0cd6('0x2c')]=_0x4c4335[_0x0cd6('0x2c')];this[_0x0cd6('0x2d')]=_0x4c4335[_0x0cd6('0x2d')];this[_0x0cd6('0x2e')]=_0x4c4335[_0x0cd6('0x2e')];this[_0x0cd6('0x2f')]=_0x4c4335[_0x0cd6('0x2f')];this[_0x0cd6('0x30')]=_0x4c4335[_0x0cd6('0x30')];}module[_0x0cd6('0x31')]=Campaign; \ No newline at end of file +var _0xf1f5=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x4dda59,_0x427407){var _0x4b4ba2=function(_0x13e535){while(--_0x13e535){_0x4dda59['push'](_0x4dda59['shift']());}};_0x4b4ba2(++_0x427407);}(_0xf1f5,0x180));var _0x5f1f=function(_0x45a881,_0x45ccbc){_0x45a881=_0x45a881-0x0;var _0x1009df=_0xf1f5[_0x45a881];return _0x1009df;};'use strict';function Campaign(_0x54a134){this['id']=_0x54a134['id']||0x0;this['name']=_0x54a134[_0x5f1f('0x0')]||'';this[_0x5f1f('0x1')]=_0x54a134[_0x5f1f('0x1')]||_0x5f1f('0x2');this[_0x5f1f('0x3')]=0x0;this[_0x5f1f('0x4')]=0x0;this[_0x5f1f('0x5')]=0x0;this[_0x5f1f('0x6')]=0x0;this[_0x5f1f('0x7')]='';this[_0x5f1f('0x8')]=!![];this[_0x5f1f('0x9')]=_0x54a134[_0x5f1f('0x9')];this[_0x5f1f('0xa')]=_0x54a134['limitCalls'];this['dialTimezone']=_0x54a134[_0x5f1f('0xb')]||null;this[_0x5f1f('0xc')]=_0x54a134[_0x5f1f('0xc')]?_0x54a134[_0x5f1f('0xc')]:null;this[_0x5f1f('0xd')]=_0x54a134[_0x5f1f('0xd')];this['dialOriginateCallerIdNumber']=_0x54a134['dialOriginateCallerIdNumber'];this[_0x5f1f('0xe')]=_0x54a134[_0x5f1f('0xe')]||0x1e;this[_0x5f1f('0xf')]=_0x54a134[_0x5f1f('0xf')];this['dialCongestionRetryFrequency']=_0x54a134[_0x5f1f('0x10')];this[_0x5f1f('0x11')]=_0x54a134[_0x5f1f('0x11')];this[_0x5f1f('0x12')]=_0x54a134[_0x5f1f('0x12')];this[_0x5f1f('0x13')]=_0x54a134[_0x5f1f('0x13')];this[_0x5f1f('0x14')]=_0x54a134[_0x5f1f('0x14')];this[_0x5f1f('0x15')]=_0x54a134[_0x5f1f('0x15')];this['dialNoSuchNumberMaxRetry']=_0x54a134['dialNoSuchNumberMaxRetry']||0x3;this[_0x5f1f('0x16')]=_0x54a134[_0x5f1f('0x16')]||0x96;this[_0x5f1f('0x17')]=_0x54a134[_0x5f1f('0x17')]||0x3;this[_0x5f1f('0x18')]=_0x54a134[_0x5f1f('0x18')]||0x96;this[_0x5f1f('0x19')]=_0x54a134['dialAbandonedMaxRetry']||0x3;this[_0x5f1f('0x1a')]=_0x54a134['dialAbandonedRetryFrequency']||0x96;this[_0x5f1f('0x1b')]=_0x54a134[_0x5f1f('0x1b')]||0x3;this[_0x5f1f('0x1c')]=_0x54a134[_0x5f1f('0x1c')]||0x96;this[_0x5f1f('0x1d')]=_0x54a134['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x54a134['dialAgentRejectRetryFrequency']||0x96;this[_0x5f1f('0x1e')]=_0x54a134[_0x5f1f('0x1e')]||_0x5f1f('0x1f');this[_0x5f1f('0x20')]=_0x54a134['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x54a134['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5f1f('0x21')]=_0x54a134['dialCutDigit']||undefined;this[_0x5f1f('0x22')]=_0x54a134[_0x5f1f('0x22')]?_0x54a134[_0x5f1f('0x22')]:undefined;this[_0x5f1f('0x23')]=_0x54a134[_0x5f1f('0x23')]?_0x54a134[_0x5f1f('0x23')]:undefined;this[_0x5f1f('0x24')]=_0x54a134[_0x5f1f('0x24')]?_0x54a134[_0x5f1f('0x24')]:undefined;this[_0x5f1f('0x25')]=_0x54a134[_0x5f1f('0x25')]?_0x54a134[_0x5f1f('0x25')]:undefined;this[_0x5f1f('0x26')]=_0x54a134[_0x5f1f('0x25')]?_0x54a134['SquareProject'][_0x5f1f('0x0')]:undefined;this[_0x5f1f('0x27')]=_0x54a134[_0x5f1f('0x27')]||![];this['dialAMDInitialSilence']=_0x54a134[_0x5f1f('0x28')];this[_0x5f1f('0x29')]=_0x54a134['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x54a134[_0x5f1f('0x2a')];this[_0x5f1f('0x2b')]=_0x54a134[_0x5f1f('0x2b')];this[_0x5f1f('0x2c')]=_0x54a134[_0x5f1f('0x2c')];this[_0x5f1f('0x2d')]=_0x54a134[_0x5f1f('0x2d')];this[_0x5f1f('0x2e')]=_0x54a134[_0x5f1f('0x2e')];this[_0x5f1f('0x2f')]=_0x54a134[_0x5f1f('0x2f')];this[_0x5f1f('0x30')]=_0x54a134[_0x5f1f('0x30')];}module[_0x5f1f('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a407acd..17abfcd 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 _0x391f=['context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','monitor','monitorFilename','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x391f,0x10c));var _0xf391=function(_0x2b794,_0x841795){_0x2b794=_0x2b794-0x0;var _0x4b7ed0=_0x391f[_0x2b794];return _0x4b7ed0;};'use strict';function Channel(){this[_0xf391('0x0')]=null;this[_0xf391('0x1')]='';this[_0xf391('0x2')]='';this[_0xf391('0x3')]=0x0;this[_0xf391('0x4')]='';this[_0xf391('0x5')]=undefined;this[_0xf391('0x6')]=undefined;this['accountcode']=0x0;this[_0xf391('0x7')]='';this[_0xf391('0x8')]=0x0;this[_0xf391('0x9')]=0x0;this[_0xf391('0xa')]=0x0;this[_0xf391('0xb')]=![];this['answertime']=null;this[_0xf391('0xc')]=null;this[_0xf391('0xd')]=![];this[_0xf391('0xe')]=![];this[_0xf391('0xf')]='';this[_0xf391('0x10')]='';this['duration']=0x0;this[_0xf391('0x11')]=0x0;this[_0xf391('0x12')]=0x0;this[_0xf391('0x13')]=null;this['tag']=null;this['disposition']=null;this[_0xf391('0x14')]=![];this[_0xf391('0x15')]=null;this['queue']=null;this['monitors']=[];this[_0xf391('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xf391('0x17')]=0x0;}module[_0xf391('0x18')]=Channel; \ No newline at end of file +var _0x01b5=['lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','abandoned'];(function(_0x228e3d,_0x280db9){var _0x353dc9=function(_0x1da81b){while(--_0x1da81b){_0x228e3d['push'](_0x228e3d['shift']());}};_0x353dc9(++_0x280db9);}(_0x01b5,0xca));var _0x501b=function(_0x3a8c8f,_0x567295){_0x3a8c8f=_0x3a8c8f-0x0;var _0x4d8b4a=_0x01b5[_0x3a8c8f];return _0x4d8b4a;};'use strict';function Channel(){this[_0x501b('0x0')]=null;this[_0x501b('0x1')]='';this[_0x501b('0x2')]='';this[_0x501b('0x3')]=0x0;this[_0x501b('0x4')]='';this[_0x501b('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x501b('0x6')]=0x0;this[_0x501b('0x7')]='';this[_0x501b('0x8')]=0x0;this[_0x501b('0x9')]=0x0;this['exten']=0x0;this[_0x501b('0xa')]=![];this[_0x501b('0xb')]=null;this[_0x501b('0xc')]=null;this['unmanaged']=![];this[_0x501b('0xd')]=![];this[_0x501b('0xe')]='';this[_0x501b('0xf')]='';this['duration']=0x0;this[_0x501b('0x10')]=0x0;this[_0x501b('0x11')]=0x0;this[_0x501b('0x12')]=null;this[_0x501b('0x13')]=null;this[_0x501b('0x14')]=null;this[_0x501b('0x15')]=![];this[_0x501b('0x16')]=null;this[_0x501b('0x17')]=null;this[_0x501b('0x18')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x501b('0x19')]=0x0;}module[_0x501b('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 870780e..f2c9334 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 _0xed1f=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xed1f,0x6a));var _0xfed1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xed1f[_0x2be8c2];return _0x97f531;};'use strict';function DeskAccount(_0x47d976){this['id']=_0x47d976['id']||0x0;this[_0xfed1('0x0')]=_0x47d976[_0xfed1('0x0')]||'';this[_0xfed1('0x1')]=_0x47d976[_0xfed1('0x1')]||'';this[_0xfed1('0x2')]=_0x47d976[_0xfed1('0x2')]||'';this[_0xfed1('0x3')]=_0x47d976[_0xfed1('0x3')]||'';this[_0xfed1('0x4')]=_0x47d976[_0xfed1('0x4')]||'';this[_0xfed1('0x5')]=_0x47d976[_0xfed1('0x5')]||'';this[_0xfed1('0x6')]=_0x47d976[_0xfed1('0x6')]||'';this[_0xfed1('0x7')]=_0x47d976[_0xfed1('0x7')]||'';this[_0xfed1('0x8')]=_0x47d976['tokenSecret']||'';this[_0xfed1('0x9')]=_0x47d976[_0xfed1('0x9')]||'';this['serverUrl']=_0x47d976[_0xfed1('0xa')]||'';this[_0xfed1('0xb')]=_0x47d976['Configurations']||{};}module[_0xfed1('0xc')]=DeskAccount; \ No newline at end of file +var _0x522b=['consumerKey','consumerSecret','token','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x31f01f,_0x1f1b13){var _0x1d4f34=function(_0x2c88c4){while(--_0x2c88c4){_0x31f01f['push'](_0x31f01f['shift']());}};_0x1d4f34(++_0x1f1b13);}(_0x522b,0x1c3));var _0xb522=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x522b[_0x54c10d];return _0x1fa703;};'use strict';function DeskAccount(_0x5dc096){this['id']=_0x5dc096['id']||0x0;this[_0xb522('0x0')]=_0x5dc096['name']||'';this[_0xb522('0x1')]=_0x5dc096['username']||'';this['remoteUri']=_0x5dc096[_0xb522('0x2')]||'';this[_0xb522('0x3')]=_0x5dc096['authType']||'';this[_0xb522('0x4')]=_0x5dc096[_0xb522('0x4')]||'';this[_0xb522('0x5')]=_0x5dc096[_0xb522('0x5')]||'';this[_0xb522('0x6')]=_0x5dc096['consumerSecret']||'';this[_0xb522('0x7')]=_0x5dc096[_0xb522('0x7')]||'';this['tokenSecret']=_0x5dc096['tokenSecret']||'';this[_0xb522('0x8')]=_0x5dc096['type']||'';this[_0xb522('0x9')]=_0x5dc096[_0xb522('0x9')]||'';this['Configurations']=_0x5dc096[_0xb522('0xa')]||{};}module[_0xb522('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index bf5f489..45fae73 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 _0xa225=['name','username','password','remoteUri','tenantId','clientId','clientSecret','Configurations','exports'];(function(_0x313dea,_0x3a9e77){var _0x3ad44f=function(_0x2e64e0){while(--_0x2e64e0){_0x313dea['push'](_0x313dea['shift']());}};_0x3ad44f(++_0x3a9e77);}(_0xa225,0x195));var _0x5a22=function(_0x20bcb0,_0xb5cbdd){_0x20bcb0=_0x20bcb0-0x0;var _0xdc4f5b=_0xa225[_0x20bcb0];return _0xdc4f5b;};'use strict';function Dynamics365Account(_0x15f714){this['id']=_0x15f714['id']||0x0;this[_0x5a22('0x0')]=_0x15f714[_0x5a22('0x0')]||'';this['username']=_0x15f714[_0x5a22('0x1')]||'';this[_0x5a22('0x2')]=_0x15f714[_0x5a22('0x2')]||'';this[_0x5a22('0x3')]=_0x15f714[_0x5a22('0x3')]||'';this[_0x5a22('0x4')]=_0x15f714['tenantId']||'';this['clientId']=_0x15f714[_0x5a22('0x5')]||'';this[_0x5a22('0x6')]=_0x15f714[_0x5a22('0x6')]||{};this['serverUrl']=_0x15f714['serverUrl']||'';this[_0x5a22('0x7')]=_0x15f714['Configurations']||{};}module[_0x5a22('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x02b9=['remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username','password'];(function(_0x449b81,_0x4b2a6f){var _0xb9b60c=function(_0x2e9e0a){while(--_0x2e9e0a){_0x449b81['push'](_0x449b81['shift']());}};_0xb9b60c(++_0x4b2a6f);}(_0x02b9,0xc3));var _0x902b=function(_0xb59849,_0x565354){_0xb59849=_0xb59849-0x0;var _0x56c7bb=_0x02b9[_0xb59849];return _0x56c7bb;};'use strict';function Dynamics365Account(_0x23b10f){this['id']=_0x23b10f['id']||0x0;this[_0x902b('0x0')]=_0x23b10f[_0x902b('0x0')]||'';this[_0x902b('0x1')]=_0x23b10f['username']||'';this[_0x902b('0x2')]=_0x23b10f[_0x902b('0x2')]||'';this[_0x902b('0x3')]=_0x23b10f['remoteUri']||'';this[_0x902b('0x4')]=_0x23b10f[_0x902b('0x4')]||'';this[_0x902b('0x5')]=_0x23b10f[_0x902b('0x5')]||'';this[_0x902b('0x6')]=_0x23b10f[_0x902b('0x6')]||{};this[_0x902b('0x7')]=_0x23b10f[_0x902b('0x7')]||'';this[_0x902b('0x8')]=_0x23b10f[_0x902b('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ab631eb..61aade0 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 _0x6d0c=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate'];(function(_0x3157c2,_0x312472){var _0x57af73=function(_0x5edc32){while(--_0x5edc32){_0x3157c2['push'](_0x3157c2['shift']());}};_0x57af73(++_0x312472);}(_0x6d0c,0x171));var _0xc6d0=function(_0x51a063,_0x675fc5){_0x51a063=_0x51a063-0x0;var _0x16f2cc=_0x6d0c[_0x51a063];return _0x16f2cc;};'use strict';function FaxAccount(_0x17113e){this['id']=_0x17113e['id']||0x0;this['name']=_0x17113e['name']||'';this[_0xc6d0('0x0')]=_0x17113e[_0xc6d0('0x0')];this[_0xc6d0('0x1')]=_0x17113e[_0xc6d0('0x1')];this[_0xc6d0('0x2')]=_0x17113e[_0xc6d0('0x2')];this[_0xc6d0('0x3')]=_0x17113e[_0xc6d0('0x3')];this[_0xc6d0('0x4')]=_0x17113e[_0xc6d0('0x4')]||0x960;this[_0xc6d0('0x5')]=_0x17113e[_0xc6d0('0x5')]||0x3840;this[_0xc6d0('0x6')]=_0x17113e[_0xc6d0('0x6')]||_0xc6d0('0x7');this[_0xc6d0('0x8')]=_0x17113e[_0xc6d0('0x8')]||'no';this['faxdetect']=_0x17113e[_0xc6d0('0x9')]||'no';this[_0xc6d0('0xa')]=_0x17113e['t38timeout']||0x1388;this[_0xc6d0('0xb')]=_0x17113e[_0xc6d0('0xb')]||_0xc6d0('0xc');this[_0xc6d0('0xd')]=_0x17113e[_0xc6d0('0xd')]?_0x17113e[_0xc6d0('0xd')]:undefined;this[_0xc6d0('0xe')]=_0x17113e[_0xc6d0('0xe')];this[_0xc6d0('0xf')]=_0x17113e[_0xc6d0('0xf')];}module[_0xc6d0('0x10')]=FaxAccount; \ No newline at end of file +var _0x0b44=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b44,0xe2));var _0x40b4=function(_0x48d9ca,_0x43f3d5){_0x48d9ca=_0x48d9ca-0x0;var _0xa23180=_0x0b44[_0x48d9ca];return _0xa23180;};'use strict';function FaxAccount(_0x22f0df){this['id']=_0x22f0df['id']||0x0;this[_0x40b4('0x0')]=_0x22f0df['name']||'';this[_0x40b4('0x1')]=_0x22f0df[_0x40b4('0x1')];this[_0x40b4('0x2')]=_0x22f0df['ecm'];this[_0x40b4('0x3')]=_0x22f0df['headerinfo'];this[_0x40b4('0x4')]=_0x22f0df[_0x40b4('0x4')];this[_0x40b4('0x5')]=_0x22f0df[_0x40b4('0x5')]||0x960;this['maxrate']=_0x22f0df['maxrate']||0x3840;this[_0x40b4('0x6')]=_0x22f0df[_0x40b4('0x6')]||_0x40b4('0x7');this[_0x40b4('0x8')]=_0x22f0df[_0x40b4('0x8')]||'no';this[_0x40b4('0x9')]=_0x22f0df[_0x40b4('0x9')]||'no';this['t38timeout']=_0x22f0df[_0x40b4('0xa')]||0x1388;this['tech']=_0x22f0df[_0x40b4('0xb')]||_0x40b4('0xc');this[_0x40b4('0xd')]=_0x22f0df[_0x40b4('0xd')]?_0x22f0df[_0x40b4('0xd')]:undefined;this[_0x40b4('0xe')]=_0x22f0df[_0x40b4('0xe')];this[_0x40b4('0xf')]=_0x22f0df[_0x40b4('0xf')];}module[_0x40b4('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 9f13593..ad1f204 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 _0x536c=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x172d7d,_0x199fe4){var _0x2c9b49=function(_0x864b2d){while(--_0x864b2d){_0x172d7d['push'](_0x172d7d['shift']());}};_0x2c9b49(++_0x199fe4);}(_0x536c,0x152));var _0xc536=function(_0x372590,_0x1ebb65){_0x372590=_0x372590-0x0;var _0x21abe6=_0x536c[_0x372590];return _0x21abe6;};'use strict';function FreshdeskAccount(_0x5211b9){this['id']=_0x5211b9['id']||0x0;this[_0xc536('0x0')]=_0x5211b9[_0xc536('0x0')]||'';this[_0xc536('0x1')]=_0x5211b9[_0xc536('0x1')]||'';this[_0xc536('0x2')]=_0x5211b9[_0xc536('0x3')]||'';this[_0xc536('0x4')]=_0x5211b9[_0xc536('0x4')]||'';this[_0xc536('0x5')]=_0x5211b9['serverUrl']||'';this[_0xc536('0x6')]=_0x5211b9[_0xc536('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x4de4=['name','username','apiKey','remoteUri','serverUrl'];(function(_0x29fbc1,_0x1aedef){var _0x457181=function(_0xd7520d){while(--_0xd7520d){_0x29fbc1['push'](_0x29fbc1['shift']());}};_0x457181(++_0x1aedef);}(_0x4de4,0x136));var _0x44de=function(_0x42408c,_0x15b22f){_0x42408c=_0x42408c-0x0;var _0x1f18a4=_0x4de4[_0x42408c];return _0x1f18a4;};'use strict';function FreshdeskAccount(_0x34bf8a){this['id']=_0x34bf8a['id']||0x0;this[_0x44de('0x0')]=_0x34bf8a[_0x44de('0x0')]||'';this[_0x44de('0x1')]=_0x34bf8a[_0x44de('0x1')]||'';this[_0x44de('0x2')]=_0x34bf8a['token']||'';this[_0x44de('0x3')]=_0x34bf8a[_0x44de('0x3')]||'';this['serverUrl']=_0x34bf8a[_0x44de('0x4')]||'';this['Configurations']=_0x34bf8a['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 214666b..3e3526c 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 _0x48a5=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2f7cc0,_0xa7ddc9){var _0x42ac73=function(_0x4d41d7){while(--_0x4d41d7){_0x2f7cc0['push'](_0x2f7cc0['shift']());}};_0x42ac73(++_0xa7ddc9);}(_0x48a5,0xeb));var _0x548a=function(_0x1d513a,_0x24b300){_0x1d513a=_0x1d513a-0x0;var _0x44c9ef=_0x48a5[_0x1d513a];return _0x44c9ef;};'use strict';function FreshsalesAccount(_0x3f49aa){this['id']=_0x3f49aa['id']||0x0;this[_0x548a('0x0')]=_0x3f49aa[_0x548a('0x0')]||'';this[_0x548a('0x1')]=_0x3f49aa[_0x548a('0x1')]||'';this[_0x548a('0x2')]=_0x3f49aa[_0x548a('0x3')]||'';this[_0x548a('0x4')]=_0x3f49aa[_0x548a('0x4')]||'';this[_0x548a('0x5')]=_0x3f49aa[_0x548a('0x5')]||'';this[_0x548a('0x6')]=_0x3f49aa[_0x548a('0x6')]||{};}module[_0x548a('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xebc0=['Configurations','exports','name','username','remoteUri'];(function(_0xf8cf60,_0x21cbed){var _0x541b89=function(_0x32f4fc){while(--_0x32f4fc){_0xf8cf60['push'](_0xf8cf60['shift']());}};_0x541b89(++_0x21cbed);}(_0xebc0,0xbb));var _0x0ebc=function(_0x115dc5,_0x4c1e6d){_0x115dc5=_0x115dc5-0x0;var _0x42b2b3=_0xebc0[_0x115dc5];return _0x42b2b3;};'use strict';function FreshsalesAccount(_0x5b3bfb){this['id']=_0x5b3bfb['id']||0x0;this[_0x0ebc('0x0')]=_0x5b3bfb[_0x0ebc('0x0')]||'';this[_0x0ebc('0x1')]=_0x5b3bfb[_0x0ebc('0x1')]||'';this['apiKey']=_0x5b3bfb['token']||'';this[_0x0ebc('0x2')]=_0x5b3bfb['remoteUri']||'';this['serverUrl']=_0x5b3bfb['serverUrl']||'';this[_0x0ebc('0x3')]=_0x5b3bfb['Configurations']||{};}module[_0x0ebc('0x4')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index df2ddeb..9160998 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 _0x3fcf=['accountcode','context','priority','assigned','lastAssignedTo','mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x1880b8,_0x57084e){var _0xeb338c=function(_0x3370d2){while(--_0x3370d2){_0x1880b8['push'](_0x1880b8['shift']());}};_0xeb338c(++_0x57084e);}(_0x3fcf,0x84));var _0xf3fc=function(_0x1ff15e,_0x4f5e38){_0x1ff15e=_0x1ff15e-0x0;var _0x407b3d=_0x3fcf[_0x1ff15e];return _0x407b3d;};'use strict';function QueueReport(){this['type']=_0xf3fc('0x0');this[_0xf3fc('0x1')]='';this[_0xf3fc('0x2')]='';this[_0xf3fc('0x3')]='';this[_0xf3fc('0x4')]='';this[_0xf3fc('0x5')]=null;this[_0xf3fc('0x6')]=null;this[_0xf3fc('0x7')]=0x1;this[_0xf3fc('0x8')]=0x1;this[_0xf3fc('0x9')]=![];this[_0xf3fc('0xa')]=null;this['queuecallercomplete']=![];this[_0xf3fc('0xb')]=null;this[_0xf3fc('0xc')]=![];this[_0xf3fc('0xd')]=null;this[_0xf3fc('0xe')]=0x1;this[_0xf3fc('0xf')]='';this[_0xf3fc('0x10')]='';this[_0xf3fc('0x11')]='';this[_0xf3fc('0x12')]='';this[_0xf3fc('0x13')]='';this['exten']='';this[_0xf3fc('0x14')]='';this['holdtime']=0x0;this[_0xf3fc('0x15')]=![];this[_0xf3fc('0x16')]='';this[_0xf3fc('0x17')]=0x0;this['variables']={};}module[_0xf3fc('0x18')]=QueueReport; \ No newline at end of file +var _0xb716=['holdtime','assigned','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','priority'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xb716,0x1c7));var _0x6b71=function(_0x52402e,_0x4e1a93){_0x52402e=_0x52402e-0x0;var _0x262182=_0xb716[_0x52402e];return _0x262182;};'use strict';function QueueReport(){this[_0x6b71('0x0')]=_0x6b71('0x1');this[_0x6b71('0x2')]='';this[_0x6b71('0x3')]='';this[_0x6b71('0x4')]='';this[_0x6b71('0x5')]='';this['queuecallerjoinAt']=null;this[_0x6b71('0x6')]=null;this[_0x6b71('0x7')]=0x1;this[_0x6b71('0x8')]=0x1;this[_0x6b71('0x9')]=![];this[_0x6b71('0xa')]=null;this[_0x6b71('0xb')]=![];this['queuecallercompleteAt']=null;this[_0x6b71('0xc')]=![];this[_0x6b71('0xd')]=null;this[_0x6b71('0xe')]=0x1;this[_0x6b71('0xf')]='';this[_0x6b71('0x10')]='';this['connectedlinename']='';this[_0x6b71('0x11')]='';this[_0x6b71('0x12')]='';this['exten']='';this[_0x6b71('0x13')]='';this[_0x6b71('0x14')]=0x0;this[_0x6b71('0x15')]=![];this['lastAssignedTo']='';this[_0x6b71('0x16')]=0x0;this[_0x6b71('0x17')]={};}module[_0x6b71('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 96f4017..20d2c65 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 _0x2db4=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x2db4,0x12a));var _0x42db=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2db4[_0x55f8b4];return _0x2475f9;};'use strict';function SalesforceAccount(_0x90a3b0){this['id']=_0x90a3b0['id']||0x0;this[_0x42db('0x0')]=_0x90a3b0[_0x42db('0x0')]||'';this[_0x42db('0x1')]=_0x90a3b0[_0x42db('0x1')]||'';this['remoteUri']=_0x90a3b0[_0x42db('0x2')]||'';this[_0x42db('0x3')]=_0x90a3b0[_0x42db('0x3')]||'';this[_0x42db('0x4')]=_0x90a3b0[_0x42db('0x4')]||'';this[_0x42db('0x5')]=_0x90a3b0[_0x42db('0x5')]||'';this[_0x42db('0x6')]=_0x90a3b0['securityToken']||'';this[_0x42db('0x7')]=_0x90a3b0[_0x42db('0x7')]||'integrationTab';this[_0x42db('0x8')]=_0x90a3b0[_0x42db('0x8')]||'';this[_0x42db('0x9')]=_0x90a3b0[_0x42db('0x9')]||{};}module[_0x42db('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x1a8b=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab','serverUrl'];(function(_0x564e08,_0x401fb5){var _0x38ffcc=function(_0x240a14){while(--_0x240a14){_0x564e08['push'](_0x564e08['shift']());}};_0x38ffcc(++_0x401fb5);}(_0x1a8b,0xbd));var _0xb1a8=function(_0x3de414,_0x2eb598){_0x3de414=_0x3de414-0x0;var _0x401fb5=_0x1a8b[_0x3de414];return _0x401fb5;};'use strict';function SalesforceAccount(_0x2a9fdf){this['id']=_0x2a9fdf['id']||0x0;this['name']=_0x2a9fdf[_0xb1a8('0x0')]||'';this['username']=_0x2a9fdf[_0xb1a8('0x1')]||'';this[_0xb1a8('0x2')]=_0x2a9fdf[_0xb1a8('0x2')]||'';this[_0xb1a8('0x3')]=_0x2a9fdf[_0xb1a8('0x3')]||'';this[_0xb1a8('0x4')]=_0x2a9fdf[_0xb1a8('0x4')]||'';this['clientSecret']=_0x2a9fdf[_0xb1a8('0x5')]||'';this[_0xb1a8('0x6')]=_0x2a9fdf[_0xb1a8('0x6')]||'';this['type']=_0x2a9fdf['type']||_0xb1a8('0x7');this[_0xb1a8('0x8')]=_0x2a9fdf[_0xb1a8('0x8')]||'';this[_0xb1a8('0x9')]=_0x2a9fdf[_0xb1a8('0x9')]||{};}module[_0xb1a8('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d9d5a6c..fd42133 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 _0x6f34=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x21b5e4,_0x45e128){var _0x478953=function(_0x488b18){while(--_0x488b18){_0x21b5e4['push'](_0x21b5e4['shift']());}};_0x478953(++_0x45e128);}(_0x6f34,0x199));var _0x46f3=function(_0x7afd2e,_0x5a9f67){_0x7afd2e=_0x7afd2e-0x0;var _0x2a8485=_0x6f34[_0x7afd2e];return _0x2a8485;};'use strict';function ServicenowAccount(_0x133e13){this['id']=_0x133e13['id']||0x0;this[_0x46f3('0x0')]=_0x133e13[_0x46f3('0x0')]||'';this['username']=_0x133e13[_0x46f3('0x1')]||'';this['password']=_0x133e13[_0x46f3('0x2')]||'';this['remoteUri']=_0x133e13[_0x46f3('0x3')]||'';this[_0x46f3('0x4')]=_0x133e13['serverUrl']||'';this['Configurations']=_0x133e13[_0x46f3('0x5')]||{};}module[_0x46f3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x1a9d=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xdd55d4,_0x43d097){var _0x281da4=function(_0x5ec373){while(--_0x5ec373){_0xdd55d4['push'](_0xdd55d4['shift']());}};_0x281da4(++_0x43d097);}(_0x1a9d,0x158));var _0xd1a9=function(_0x18c0c9,_0x3eb495){_0x18c0c9=_0x18c0c9-0x0;var _0x1de608=_0x1a9d[_0x18c0c9];return _0x1de608;};'use strict';function ServicenowAccount(_0x172bdc){this['id']=_0x172bdc['id']||0x0;this[_0xd1a9('0x0')]=_0x172bdc[_0xd1a9('0x0')]||'';this[_0xd1a9('0x1')]=_0x172bdc[_0xd1a9('0x1')]||'';this[_0xd1a9('0x2')]=_0x172bdc[_0xd1a9('0x2')]||'';this[_0xd1a9('0x3')]=_0x172bdc[_0xd1a9('0x3')]||'';this[_0xd1a9('0x4')]=_0x172bdc['serverUrl']||'';this[_0xd1a9('0x5')]=_0x172bdc[_0xd1a9('0x5')]||{};}module[_0xd1a9('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a955059..6e5bcef 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 _0xc427=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x137a46,_0x4c5534){var _0x5bd9d9=function(_0x2a910f){while(--_0x2a910f){_0x137a46['push'](_0x137a46['shift']());}};_0x5bd9d9(++_0x4c5534);}(_0xc427,0xa8));var _0x7c42=function(_0x2bfab9,_0x26a152){_0x2bfab9=_0x2bfab9-0x0;var _0x235dee=_0xc427[_0x2bfab9];return _0x235dee;};'use strict';function SugarcrmAccount(_0x30a6cb){this['id']=_0x30a6cb['id']||0x0;this[_0x7c42('0x0')]=_0x30a6cb['name']||'';this[_0x7c42('0x1')]=_0x30a6cb[_0x7c42('0x1')]||'';this[_0x7c42('0x2')]=_0x30a6cb[_0x7c42('0x2')]||'';this[_0x7c42('0x3')]=_0x30a6cb[_0x7c42('0x3')]||'';this[_0x7c42('0x4')]=_0x30a6cb['serverUrl']||'';this[_0x7c42('0x5')]=_0x30a6cb[_0x7c42('0x5')]||{};}module[_0x7c42('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x630e=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x630e,0x16b));var _0xe630=function(_0x146fab,_0xb5e429){_0x146fab=_0x146fab-0x0;var _0xa4c348=_0x630e[_0x146fab];return _0xa4c348;};'use strict';function SugarcrmAccount(_0x1f66a6){this['id']=_0x1f66a6['id']||0x0;this[_0xe630('0x0')]=_0x1f66a6[_0xe630('0x0')]||'';this[_0xe630('0x1')]=_0x1f66a6[_0xe630('0x1')]||'';this[_0xe630('0x2')]=_0x1f66a6[_0xe630('0x2')]||'';this[_0xe630('0x3')]=_0x1f66a6[_0xe630('0x3')]||'';this[_0xe630('0x4')]=_0x1f66a6[_0xe630('0x4')]||'';this[_0xe630('0x5')]=_0x1f66a6['Configurations']||{};}module[_0xe630('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 62b98be..073ae71 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 _0xb1d1=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xb1d1,0xa5));var _0x1b1d=function(_0x53d906,_0x50e4c4){_0x53d906=_0x53d906-0x0;var _0x3d8748=_0xb1d1[_0x53d906];return _0x3d8748;};'use strict';function Telephone(_0x4faf52){this['id']=_0x4faf52['id']||0x0;this[_0x1b1d('0x0')]=_0x4faf52[_0x1b1d('0x0')]||'';this['accountcode']=_0x4faf52[_0x1b1d('0x1')]||'';this[_0x1b1d('0x2')]=_0x1b1d('0x3');this[_0x1b1d('0x4')]=0x0;this[_0x1b1d('0x5')]='unknown';this[_0x1b1d('0x6')]='';}module[_0x1b1d('0x7')]=Telephone; \ No newline at end of file +var _0x6eb6=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x4e98a1,_0x35f726){var _0x1ab040=function(_0x32df55){while(--_0x32df55){_0x4e98a1['push'](_0x4e98a1['shift']());}};_0x1ab040(++_0x35f726);}(_0x6eb6,0x198));var _0x66eb=function(_0x1c0321,_0x4c10bd){_0x1c0321=_0x1c0321-0x0;var _0x285b02=_0x6eb6[_0x1c0321];return _0x285b02;};'use strict';function Telephone(_0x3c9449){this['id']=_0x3c9449['id']||0x0;this[_0x66eb('0x0')]=_0x3c9449['name']||'';this[_0x66eb('0x1')]=_0x3c9449[_0x66eb('0x1')]||'';this[_0x66eb('0x2')]=_0x66eb('0x3');this[_0x66eb('0x4')]=0x0;this[_0x66eb('0x5')]=_0x66eb('0x3');this[_0x66eb('0x6')]='';}module[_0x66eb('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index dfb719a..d7eecbd 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 _0x7b51=['exports','name','html'];(function(_0x4fcd42,_0x3e4c7c){var _0x45f44f=function(_0x1222ee){while(--_0x1222ee){_0x4fcd42['push'](_0x4fcd42['shift']());}};_0x45f44f(++_0x3e4c7c);}(_0x7b51,0x1bd));var _0x17b5=function(_0x55bf96,_0x7267a7){_0x55bf96=_0x55bf96-0x0;var _0x5092ef=_0x7b51[_0x55bf96];return _0x5092ef;};'use strict';function template(_0x463b69){this['id']=_0x463b69['id']||0x0;this[_0x17b5('0x0')]=_0x463b69[_0x17b5('0x0')]||'';this[_0x17b5('0x1')]=_0x463b69['html']||'';}module[_0x17b5('0x2')]=template; \ No newline at end of file +var _0x2cc4=['html','name'];(function(_0x392bbe,_0x25f137){var _0xe710af=function(_0x14ce29){while(--_0x14ce29){_0x392bbe['push'](_0x392bbe['shift']());}};_0xe710af(++_0x25f137);}(_0x2cc4,0xdd));var _0x42cc=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x2cc4[_0x50a004];return _0x5e9992;};'use strict';function template(_0x1e3102){this['id']=_0x1e3102['id']||0x0;this[_0x42cc('0x0')]=_0x1e3102[_0x42cc('0x0')]||'';this[_0x42cc('0x1')]=_0x1e3102[_0x42cc('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d630b3c..bc3d0ba 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 _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x2d0094,_0x167a61){var _0x4cc4ca=function(_0x352542){while(--_0x352542){_0x2d0094['push'](_0x2d0094['shift']());}};_0x4cc4ca(++_0x167a61);}(_0x6aa7,0x178));var _0x76aa=function(_0x543a45,_0x46ae0b){_0x543a45=_0x543a45-0x0;var _0x54094a=_0x6aa7[_0x543a45];return _0x54094a;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file +var _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x383cb7,_0x48d6bc){var _0x3391c6=function(_0xe3883d){while(--_0xe3883d){_0x383cb7['push'](_0x383cb7['shift']());}};_0x3391c6(++_0x48d6bc);}(_0x3e74,0x175));var _0x43e7=function(_0x505819,_0x130728){_0x505819=_0x505819-0x0;var _0xf82cb9=_0x3e74[_0x505819];return _0xf82cb9;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5238fcf..d9ebddc 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 _0x46d1=['split','host','domain','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','status','registry'];(function(_0x1c85d5,_0x1e6c4e){var _0x33f0a7=function(_0x23e047){while(--_0x23e047){_0x1c85d5['push'](_0x1c85d5['shift']());}};_0x33f0a7(++_0x1e6c4e);}(_0x46d1,0xbe));var _0x146d=function(_0x3cba8d,_0x464c17){_0x3cba8d=_0x3cba8d-0x0;var _0x2a6110=_0x46d1[_0x3cba8d];return _0x2a6110;};'use strict';function Trunk(_0x38302c){this['id']=_0x38302c['id']||0x0;this[_0x146d('0x0')]=_0x38302c[_0x146d('0x0')]||![];this[_0x146d('0x1')]=_0x38302c[_0x146d('0x1')]||'';this[_0x146d('0x2')]=_0x146d('0x3');this['stateTime']=0x0;this[_0x146d('0x4')]=_0x146d('0x3');this[_0x146d('0x5')]=_0x38302c['registry']&&_0x38302c[_0x146d('0x5')]['indexOf'](':')?_0x38302c[_0x146d('0x5')][_0x146d('0x6')](':')[0x0]:'';this[_0x146d('0x7')]='';this['port']='';this[_0x146d('0x8')]='';this['domainport']='';this[_0x146d('0x9')]='';this[_0x146d('0xa')]=_0x146d('0x3');this[_0x146d('0xb')]='';this[_0x146d('0xc')]='';}module[_0x146d('0xd')]=Trunk; \ No newline at end of file +var _0x4a45=['address','exports','active','name','unknown','stateTime','status','registry','indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x18f868,_0x48417c){var _0x330005=function(_0x293832){while(--_0x293832){_0x18f868['push'](_0x18f868['shift']());}};_0x330005(++_0x48417c);}(_0x4a45,0x6b));var _0x54a4=function(_0x51db56,_0x4bdcc6){_0x51db56=_0x51db56-0x0;var _0x1a2692=_0x4a45[_0x51db56];return _0x1a2692;};'use strict';function Trunk(_0x50f529){this['id']=_0x50f529['id']||0x0;this[_0x54a4('0x0')]=_0x50f529[_0x54a4('0x0')]||![];this[_0x54a4('0x1')]=_0x50f529[_0x54a4('0x1')]||'';this['state']=_0x54a4('0x2');this[_0x54a4('0x3')]=0x0;this[_0x54a4('0x4')]=_0x54a4('0x2');this[_0x54a4('0x5')]=_0x50f529['registry']&&_0x50f529[_0x54a4('0x5')][_0x54a4('0x6')](':')?_0x50f529[_0x54a4('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0x54a4('0x7')]='';this[_0x54a4('0x8')]='';this[_0x54a4('0x9')]='';this[_0x54a4('0xa')]='';this[_0x54a4('0xb')]='unknown';this[_0x54a4('0xc')]='';this[_0x54a4('0xd')]='';}module[_0x54a4('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9124587..651adde 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 _0x6c9a=['exten','none','mandatoryDisposition','exports'];(function(_0x118aa,_0x36110f){var _0x133bd6=function(_0x4e16a0){while(--_0x4e16a0){_0x118aa['push'](_0x118aa['shift']());}};_0x133bd6(++_0x36110f);}(_0x6c9a,0x108));var _0xa6c9=function(_0x864cc8,_0x8d492){_0x864cc8=_0x864cc8-0x0;var _0x5983c3=_0x6c9a[_0x864cc8];return _0x5983c3;};'use strict';function voiceExtension(_0xba772f){this['id']=_0xba772f['id']||0x0;this[_0xa6c9('0x0')]=_0xba772f[_0xa6c9('0x0')]||'';this['recordingFormat']=_0xba772f['recordingFormat']||_0xa6c9('0x1');this[_0xa6c9('0x2')]=_0xba772f[_0xa6c9('0x2')]||![];}module[_0xa6c9('0x3')]=voiceExtension; \ No newline at end of file +var _0x8b94=['exten','recordingFormat','mandatoryDisposition'];(function(_0x1ce87a,_0x451e11){var _0x1945bc=function(_0x1306ec){while(--_0x1306ec){_0x1ce87a['push'](_0x1ce87a['shift']());}};_0x1945bc(++_0x451e11);}(_0x8b94,0x1bc));var _0x48b9=function(_0x101bca,_0x482978){_0x101bca=_0x101bca-0x0;var _0x56af92=_0x8b94[_0x101bca];return _0x56af92;};'use strict';function voiceExtension(_0x3c8c3c){this['id']=_0x3c8c3c['id']||0x0;this[_0x48b9('0x0')]=_0x3c8c3c['exten']||'';this[_0x48b9('0x1')]=_0x3c8c3c['recordingFormat']||'none';this[_0x48b9('0x2')]=_0x3c8c3c[_0x48b9('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 4f0fd95..42ba65d 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 _0xd8fc=['dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp'];(function(_0x1fa635,_0xbede8b){var _0x4779de=function(_0x1df7d1){while(--_0x1df7d1){_0x1fa635['push'](_0x1fa635['shift']());}};_0x4779de(++_0xbede8b);}(_0xd8fc,0x14b));var _0xcd8f=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xd8fc[_0x2e3545];return _0xcf18f;};'use strict';var statusDesc=[_0xcd8f('0x0'),'not_inuse',_0xcd8f('0x1'),_0xcd8f('0x2'),'invalid',_0xcd8f('0x3'),_0xcd8f('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0xcd8f('0x5'),'wav49':_0xcd8f('0x6'),'gsm':_0xcd8f('0x7')};var strategy={'rrmemory':_0xcd8f('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x40def7){this['id']=_0x40def7['id']||0x0;this[_0xcd8f('0x9')]=_0x40def7[_0xcd8f('0x9')]||'';this[_0xcd8f('0xa')]=_0x40def7[_0xcd8f('0xa')]||'';this['type']=_0x40def7[_0xcd8f('0xb')]||_0xcd8f('0xc');this['waiting']=0x0;this['talking']=0x0;this[_0xcd8f('0xd')]=0x0;this[_0xcd8f('0xe')]=0x0;this['sumDuration']=0x0;this[_0xcd8f('0xf')]=0x0;this[_0xcd8f('0x10')]=0x0;this[_0xcd8f('0x11')]=0x0;this['abandoned']=0x0;this[_0xcd8f('0x12')]=0x0;this[_0xcd8f('0x13')]=0x0;this[_0xcd8f('0x14')]=_0x40def7['acw']||![];this['acwTimeout']=_0x40def7[_0xcd8f('0x15')]||0xa;this[_0xcd8f('0x16')]=_0x40def7[_0xcd8f('0x16')]||'no';this['sendMessageOneNotActive']=!![];this[_0xcd8f('0x17')]='';this[_0xcd8f('0x18')]=0x0;this[_0xcd8f('0x19')]=0x0;this['dialTimezone']=_0x40def7[_0xcd8f('0x1a')]||null;this['dialGlobalInterval']=_0x40def7[_0xcd8f('0x1b')]?_0x40def7[_0xcd8f('0x1b')]:null;this[_0xcd8f('0x1c')]=_0x40def7['dialActive'];this['dialMethod']=_0x40def7['dialMethod']||_0xcd8f('0x1d');this['dialLimitChannel']=_0x40def7[_0xcd8f('0x1e')]||0x0;this[_0xcd8f('0x1f')]=_0x40def7[_0xcd8f('0x1f')]||0x0;this['dialPowerLevel']=_0x40def7[_0xcd8f('0x20')]||0x1;this['dialPredictiveOptimization']=_0x40def7[_0xcd8f('0x21')]||_0xcd8f('0x22');this['dialPredictiveOptimizationPercentage']=_0x40def7[_0xcd8f('0x23')]||0.03;this[_0xcd8f('0x24')]=_0x40def7[_0xcd8f('0x24')]||0x258;this[_0xcd8f('0x25')]=_0x40def7[_0xcd8f('0x25')]||_0xcd8f('0x26');this[_0xcd8f('0x27')]=_0x40def7[_0xcd8f('0x27')]||_0xcd8f('0x26');this[_0xcd8f('0x28')]=_0x40def7[_0xcd8f('0x28')]||0x1e;this['dialQueueOptions']=_0x40def7['dialQueueOptions']||_0xcd8f('0x29');this['dialQueueTimeout']=_0x40def7[_0xcd8f('0x2a')]||0x3;this[_0xcd8f('0x2b')]=_0x40def7[_0xcd8f('0x2b')]||undefined;this[_0xcd8f('0x2c')]=_0x40def7[_0xcd8f('0x2c')]||0x3;this[_0xcd8f('0x2d')]=_0x40def7[_0xcd8f('0x2d')]||0x96;this[_0xcd8f('0x2e')]=_0x40def7[_0xcd8f('0x2e')]||0x3;this['dialBusyRetryFrequency']=_0x40def7[_0xcd8f('0x2f')]||0x96;this[_0xcd8f('0x30')]=_0x40def7[_0xcd8f('0x30')]||0x3;this[_0xcd8f('0x31')]=_0x40def7['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x40def7[_0xcd8f('0x32')]||0x3;this[_0xcd8f('0x33')]=_0x40def7[_0xcd8f('0x33')]||0x96;this[_0xcd8f('0x34')]=_0x40def7[_0xcd8f('0x34')]||0x3;this['dialDropRetryFrequency']=_0x40def7['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x40def7['dialAbandonedMaxRetry']||0x3;this[_0xcd8f('0x35')]=_0x40def7[_0xcd8f('0x35')]||0x96;this[_0xcd8f('0x36')]=_0x40def7['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x40def7[_0xcd8f('0x37')]||0x96;this['dialAgentRejectMaxRetry']=_0x40def7[_0xcd8f('0x38')]||0x3;this[_0xcd8f('0x39')]=_0x40def7[_0xcd8f('0x39')]||0x96;this['dialGlobalMaxRetry']=_0x40def7[_0xcd8f('0x3a')]||0x4;this[_0xcd8f('0x3b')]=_0x40def7[_0xcd8f('0x3b')]?_0x40def7[_0xcd8f('0x3b')]:undefined;this[_0xcd8f('0x3c')]=_0x40def7[_0xcd8f('0x3c')]?_0x40def7[_0xcd8f('0x3c')]:undefined;this['dialPrefix']=_0x40def7[_0xcd8f('0x3d')]||undefined;this[_0xcd8f('0x3e')]=_0x40def7[_0xcd8f('0x3e')]?_0x40def7[_0xcd8f('0x3e')]:undefined;this[_0xcd8f('0x3f')]=_0x40def7[_0xcd8f('0x3f')]||'DESC';this[_0xcd8f('0x40')]=_0x40def7[_0xcd8f('0x40')]||undefined;this[_0xcd8f('0x41')]=_0x40def7[_0xcd8f('0x41')]||undefined;this[_0xcd8f('0x42')]=strategy[_0x40def7[_0xcd8f('0x42')]]||_0xcd8f('0x8');this['queueStatusComplete']=!![];this[_0xcd8f('0x43')]=_0x40def7[_0xcd8f('0x43')]||![];this['dialAMDInitialSilence']=_0x40def7[_0xcd8f('0x44')];this[_0xcd8f('0x45')]=_0x40def7[_0xcd8f('0x45')];this[_0xcd8f('0x46')]=_0x40def7[_0xcd8f('0x46')];this['dialAMDTotalAnalysisTime']=_0x40def7[_0xcd8f('0x47')];this[_0xcd8f('0x48')]=_0x40def7['dialAMDMinWordLength'];this[_0xcd8f('0x49')]=_0x40def7[_0xcd8f('0x49')];this[_0xcd8f('0x4a')]=_0x40def7[_0xcd8f('0x4a')];this[_0xcd8f('0x4b')]=_0x40def7[_0xcd8f('0x4b')];this[_0xcd8f('0x4c')]=_0x40def7[_0xcd8f('0x4c')];this[_0xcd8f('0x4d')]=0x0;this[_0xcd8f('0x4e')]=0x0;this['timeout']=_0x40def7[_0xcd8f('0x4f')];this['outboundAnswerCallsDay']=0x0;this[_0xcd8f('0x50')]=0x0;this[_0xcd8f('0x51')]=0x0;this[_0xcd8f('0x52')]=0x0;this[_0xcd8f('0x53')]=0x0;this[_0xcd8f('0x54')]=0x0;this[_0xcd8f('0x55')]=0x0;this[_0xcd8f('0x56')]=0x0;this[_0xcd8f('0x57')]=0x0;this[_0xcd8f('0x58')]=0x0;this[_0xcd8f('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xcd8f('0x5a')]=0x0;this[_0xcd8f('0x5b')]=0x0;this[_0xcd8f('0x5c')]=undefined;this[_0xcd8f('0x5d')]=undefined;this[_0xcd8f('0x5e')]=undefined;this[_0xcd8f('0x5f')]=1.05;this[_0xcd8f('0x60')]=0x0;this[_0xcd8f('0x61')]=0x0;this[_0xcd8f('0x62')]=0x0;this[_0xcd8f('0x63')]=0x0;this[_0xcd8f('0x64')]=0x0;this[_0xcd8f('0x65')]=0x0;this[_0xcd8f('0x66')]=0x0;this[_0xcd8f('0x67')]=0x0;this[_0xcd8f('0x68')]=_0x40def7[_0xcd8f('0x69')]||0x14;this[_0xcd8f('0x6a')]=_0x40def7[_0xcd8f('0x69')]||0xa;this[_0xcd8f('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xcd8f('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0xcd8f('0x6d')]=0x0;this[_0xcd8f('0x6e')]=0x0;this[_0xcd8f('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x40def7[_0xcd8f('0x70')]||0x1e;this[_0xcd8f('0x71')]=_0x40def7['dialRecallInQueue']||![];this[_0xcd8f('0x72')]=_0x40def7[_0xcd8f('0x72')]||undefined;this[_0xcd8f('0x73')]=_0x40def7['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x40def7[_0xcd8f('0x74')]||![];this['monitor_format']=monitorFormat[_0x40def7['monitor_format']]?monitorFormat[_0x40def7[_0xcd8f('0xa')]]:undefined;this['mandatoryDisposition']=_0x40def7['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x40def7[_0xcd8f('0x75')]?_0x40def7[_0xcd8f('0x75')]:undefined;}module[_0xcd8f('0x76')]=VoiceQueue; \ No newline at end of file +var _0xd98d=['sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','wav','gsm','roundrobin','name','monitor_format','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','autopause'];(function(_0x3c6913,_0x3c067d){var _0x15b6a2=function(_0x47e6a8){while(--_0x47e6a8){_0x3c6913['push'](_0x3c6913['shift']());}};_0x15b6a2(++_0x3c067d);}(_0xd98d,0x1a4));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0xdd98('0x0'),_0xdd98('0x1'),_0xdd98('0x2'),_0xdd98('0x3'),'invalid',_0xdd98('0x4'),_0xdd98('0x5'),_0xdd98('0x6'),'onhold'];var monitorFormat={'wav':_0xdd98('0x7'),'wav49':'wav49','gsm':_0xdd98('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xdd98('0x9')};function VoiceQueue(_0x193582){this['id']=_0x193582['id']||0x0;this[_0xdd98('0xa')]=_0x193582['name']||'';this[_0xdd98('0xb')]=_0x193582[_0xdd98('0xb')]||'';this['type']=_0x193582['type']||_0xdd98('0xc');this[_0xdd98('0xd')]=0x0;this[_0xdd98('0xe')]=0x0;this[_0xdd98('0xf')]=0x0;this['answered']=0x0;this[_0xdd98('0x10')]=0x0;this[_0xdd98('0x11')]=0x0;this[_0xdd98('0x12')]=0x0;this['unmanaged']=0x0;this[_0xdd98('0x13')]=0x0;this['loggedIn']=0x0;this[_0xdd98('0x14')]=0x0;this['acw']=_0x193582[_0xdd98('0x15')]||![];this[_0xdd98('0x16')]=_0x193582['acwTimeout']||0xa;this[_0xdd98('0x17')]=_0x193582[_0xdd98('0x17')]||'no';this[_0xdd98('0x18')]=!![];this[_0xdd98('0x19')]='';this['originated']=0x0;this[_0xdd98('0x1a')]=0x0;this[_0xdd98('0x1b')]=_0x193582[_0xdd98('0x1b')]||null;this[_0xdd98('0x1c')]=_0x193582[_0xdd98('0x1c')]?_0x193582[_0xdd98('0x1c')]:null;this[_0xdd98('0x1d')]=_0x193582[_0xdd98('0x1d')];this[_0xdd98('0x1e')]=_0x193582[_0xdd98('0x1e')]||'progressive';this[_0xdd98('0x1f')]=_0x193582[_0xdd98('0x1f')]||0x0;this[_0xdd98('0x20')]=_0x193582[_0xdd98('0x20')]||0x0;this[_0xdd98('0x21')]=_0x193582['dialPowerLevel']||0x1;this[_0xdd98('0x22')]=_0x193582['dialPredictiveOptimization']||_0xdd98('0x23');this['dialPredictiveOptimizationPercentage']=_0x193582[_0xdd98('0x24')]||0.03;this[_0xdd98('0x25')]=_0x193582[_0xdd98('0x25')]||0x258;this[_0xdd98('0x26')]=_0x193582[_0xdd98('0x26')]||_0xdd98('0x27');this[_0xdd98('0x28')]=_0x193582[_0xdd98('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x193582[_0xdd98('0x29')]||0x1e;this[_0xdd98('0x2a')]=_0x193582[_0xdd98('0x2a')]||_0xdd98('0x2b');this[_0xdd98('0x2c')]=_0x193582['dialQueueTimeout']||0x3;this[_0xdd98('0x2d')]=_0x193582[_0xdd98('0x2d')]||undefined;this[_0xdd98('0x2e')]=_0x193582['dialCongestionMaxRetry']||0x3;this[_0xdd98('0x2f')]=_0x193582['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x193582[_0xdd98('0x30')]||0x3;this[_0xdd98('0x31')]=_0x193582[_0xdd98('0x31')]||0x96;this['dialNoAnswerMaxRetry']=_0x193582[_0xdd98('0x32')]||0x3;this[_0xdd98('0x33')]=_0x193582[_0xdd98('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x193582[_0xdd98('0x34')]||0x3;this[_0xdd98('0x35')]=_0x193582[_0xdd98('0x35')]||0x96;this['dialDropMaxRetry']=_0x193582[_0xdd98('0x36')]||0x3;this[_0xdd98('0x37')]=_0x193582[_0xdd98('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x193582[_0xdd98('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x193582['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x193582['dialMachineMaxRetry']||0x3;this[_0xdd98('0x39')]=_0x193582['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x193582[_0xdd98('0x3a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x193582['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x193582[_0xdd98('0x3b')]||0x4;this[_0xdd98('0x3c')]=_0x193582['Trunk']?_0x193582[_0xdd98('0x3c')]:undefined;this[_0xdd98('0x3d')]=_0x193582['TrunkBackup']?_0x193582[_0xdd98('0x3d')]:undefined;this[_0xdd98('0x3e')]=_0x193582['dialPrefix']||undefined;this[_0xdd98('0x3f')]=_0x193582[_0xdd98('0x3f')]?_0x193582[_0xdd98('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x193582[_0xdd98('0x40')]||_0xdd98('0x41');this[_0xdd98('0x42')]=_0x193582[_0xdd98('0x42')]||undefined;this[_0xdd98('0x43')]=_0x193582[_0xdd98('0x43')]||undefined;this[_0xdd98('0x44')]=strategy[_0x193582[_0xdd98('0x44')]]||_0xdd98('0x45');this[_0xdd98('0x46')]=!![];this['dialAMDActive']=_0x193582['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x193582['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x193582['dialAMDGreeting'];this[_0xdd98('0x47')]=_0x193582['dialAMDAfterGreetingSilence'];this[_0xdd98('0x48')]=_0x193582[_0xdd98('0x48')];this[_0xdd98('0x49')]=_0x193582[_0xdd98('0x49')];this[_0xdd98('0x4a')]=_0x193582[_0xdd98('0x4a')];this[_0xdd98('0x4b')]=_0x193582[_0xdd98('0x4b')];this[_0xdd98('0x4c')]=_0x193582['dialAMDSilenceThreshold'];this[_0xdd98('0x4d')]=_0x193582[_0xdd98('0x4d')];this['outboundRejectCallsDay']=0x0;this[_0xdd98('0x4e')]=0x0;this[_0xdd98('0x4f')]=_0x193582[_0xdd98('0x4f')];this['outboundAnswerCallsDay']=0x0;this[_0xdd98('0x50')]=0x0;this[_0xdd98('0x51')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xdd98('0x52')]=0x0;this[_0xdd98('0x53')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xdd98('0x54')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xdd98('0x55')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xdd98('0x56')]=0x0;this[_0xdd98('0x57')]=0x0;this[_0xdd98('0x58')]=0x0;this[_0xdd98('0x59')]=undefined;this[_0xdd98('0x5a')]=undefined;this['handlePredictive']=undefined;this[_0xdd98('0x5b')]=1.05;this[_0xdd98('0x5c')]=0x0;this[_0xdd98('0x5d')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xdd98('0x5e')]=0x0;this[_0xdd98('0x5f')]=0x0;this[_0xdd98('0x60')]=_0x193582['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xdd98('0x61')]=_0x193582['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xdd98('0x62')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xdd98('0x63')]=0x0;this[_0xdd98('0x64')]=0x0;this[_0xdd98('0x65')]=0x0;this[_0xdd98('0x66')]=0x0;this[_0xdd98('0x67')]=_0x193582[_0xdd98('0x67')]||0x1e;this[_0xdd98('0x68')]=_0x193582[_0xdd98('0x68')]||![];this[_0xdd98('0x69')]=_0x193582['dialQueueProject2']||undefined;this[_0xdd98('0x6a')]=_0x193582['dialAgiAfterHangupClient']||![];this[_0xdd98('0x6b')]=_0x193582[_0xdd98('0x6b')]||![];this[_0xdd98('0xb')]=monitorFormat[_0x193582[_0xdd98('0xb')]]?monitorFormat[_0x193582[_0xdd98('0xb')]]:undefined;this[_0xdd98('0x6c')]=_0x193582['mandatoryDisposition']||![];this[_0xdd98('0x6d')]=_0x193582['mandatoryDispositionPause']?_0x193582[_0xdd98('0x6d')]:undefined;}module[_0xdd98('0x6e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 51010fe..097fa75 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 _0x0f6f=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x0f6f,0xd0));var _0xf0f6=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x0f6f[_0x582274];return _0x8f14d3;};'use strict';function VtigerAccount(_0x2312e4){this['id']=_0x2312e4['id']||0x0;this[_0xf0f6('0x0')]=_0x2312e4['name']||'';this['username']=_0x2312e4[_0xf0f6('0x1')]||'';this[_0xf0f6('0x2')]=_0x2312e4[_0xf0f6('0x2')]||'';this['remoteUri']=_0x2312e4[_0xf0f6('0x3')]||'';this[_0xf0f6('0x4')]=_0x2312e4[_0xf0f6('0x4')]||'';this[_0xf0f6('0x5')]=_0x2312e4[_0xf0f6('0x5')]||{};}module[_0xf0f6('0x6')]=VtigerAccount; \ No newline at end of file +var _0x18d4=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x5de13d,_0x193ded){var _0x2e005a=function(_0x407b0a){while(--_0x407b0a){_0x5de13d['push'](_0x5de13d['shift']());}};_0x2e005a(++_0x193ded);}(_0x18d4,0x15a));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x433cd8){this['id']=_0x433cd8['id']||0x0;this[_0x418d('0x0')]=_0x433cd8[_0x418d('0x0')]||'';this['username']=_0x433cd8[_0x418d('0x1')]||'';this[_0x418d('0x2')]=_0x433cd8[_0x418d('0x2')]||'';this[_0x418d('0x3')]=_0x433cd8[_0x418d('0x3')]||'';this[_0x418d('0x4')]=_0x433cd8[_0x418d('0x4')]||'';this[_0x418d('0x5')]=_0x433cd8[_0x418d('0x5')]||{};}module[_0x418d('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 5b15ded..7af9cbd 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0x0b0e[_0x1d3892];return _0x574ff2;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x528d54,_0x10eae7){var _0x5e130d=function(_0x59be2a){while(--_0x59be2a){_0x528d54['push'](_0x528d54['shift']());}};_0x5e130d(++_0x10eae7);}(_0x2032,0xd9));var _0x2203=function(_0x23a163,_0x2be6c9){_0x23a163=_0x23a163-0x0;var _0x2ad83b=_0x2032[_0x23a163];return _0x2ad83b;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 9785890..fdaeb47 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 _0x2d93=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x2d93,0xf3));var _0x32d9=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x2d93[_0x34843e];return _0x598f7f;};'use strict';function ZohoAccount(_0x16d017){this['id']=_0x16d017['id']||0x0;this[_0x32d9('0x0')]=_0x16d017[_0x32d9('0x0')]||'';this[_0x32d9('0x1')]=_0x16d017[_0x32d9('0x1')]||'';this[_0x32d9('0x2')]=_0x16d017[_0x32d9('0x2')]||'';this[_0x32d9('0x3')]=_0x16d017[_0x32d9('0x3')]||'';this[_0x32d9('0x4')]=_0x16d017[_0x32d9('0x4')]||'';this[_0x32d9('0x5')]=_0x16d017[_0x32d9('0x5')]||'';this[_0x32d9('0x6')]=_0x16d017['serverUrl']||'';this[_0x32d9('0x7')]=_0x16d017[_0x32d9('0x7')]||'';this[_0x32d9('0x8')]=_0x16d017[_0x32d9('0x8')]||'';this[_0x32d9('0x9')]=_0x16d017['Configurations']||{};}module[_0x32d9('0xa')]=ZohoAccount; \ No newline at end of file +var _0x9354=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x9354,0x96));var _0x4935=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x9354[_0x5ff517];return _0x19a245;};'use strict';function ZohoAccount(_0x487ab6){this['id']=_0x487ab6['id']||0x0;this[_0x4935('0x0')]=_0x487ab6[_0x4935('0x0')]||'';this['description']=_0x487ab6[_0x4935('0x1')]||'';this[_0x4935('0x2')]=_0x487ab6[_0x4935('0x2')]||'';this[_0x4935('0x3')]=_0x487ab6['zone']||'';this[_0x4935('0x4')]=_0x487ab6[_0x4935('0x4')]||'';this[_0x4935('0x5')]=_0x487ab6[_0x4935('0x5')]||'';this[_0x4935('0x6')]=_0x487ab6[_0x4935('0x6')]||'';this[_0x4935('0x7')]=_0x487ab6[_0x4935('0x7')]||'';this[_0x4935('0x8')]=_0x487ab6['refreshToken']||'';this[_0x4935('0x9')]=_0x487ab6['Configurations']||{};}module[_0x4935('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 142e033..4d3d0a3 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 _0x8b4c=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','calleridnum','scheduledat','countbusyretry'];(function(_0x323c60,_0x219b72){var _0x103f23=function(_0x7695b3){while(--_0x7695b3){_0x323c60['push'](_0x323c60['shift']());}};_0x103f23(++_0x219b72);}(_0x8b4c,0xc9));var _0xc8b4=function(_0x4c93cd,_0x40a89a){_0x4c93cd=_0x4c93cd-0x0;var _0x56e308=_0x8b4c[_0x4c93cd];return _0x56e308;};'use strict';var util=require(_0xc8b4('0x0'));var _=require(_0xc8b4('0x1'));var moment=require(_0xc8b4('0x2'));function checkNameSurname(_0x591416,_0x3117ec,_0x3086d7){var _0x3727be='';if(!_['isNil'](_0x3117ec)&&'string'===typeof _0x3117ec){_0x3727be+=_0x3117ec;}if(!_[_0xc8b4('0x3')](_0x3086d7)&&_0xc8b4('0x4')===typeof _0x3086d7){_0x3727be+='\x20'+_0x3086d7;}if(_0x3727be!==''){return _0x3727be;}return _0x591416;}function Action(_0x1f6759,_0x1bc2b9,_0x383bd3,_0x10668d,_0x134ace){this[_0xc8b4('0x5')]=_0x383bd3||undefined;this[_0xc8b4('0x6')]=_0x1f6759['id'];this[_0xc8b4('0x7')]=_0x1bc2b9[_0xc8b4('0x8')];this[_0xc8b4('0x9')]=_0x1bc2b9['type'];this[_0xc8b4('0xa')]=_0xc8b4('0x7');this[_0xc8b4('0xb')]=![];this['membername']=_[_0xc8b4('0x3')](_0x1f6759[_0xc8b4('0xc')])?undefined:_0x1f6759[_0xc8b4('0xc')][_0xc8b4('0x8')];this[_0xc8b4('0xd')]=this[_0xc8b4('0xe')]?util[_0xc8b4('0xf')](_0xc8b4('0x10'),this[_0xc8b4('0xe')]):_0x10668d||undefined;this[_0xc8b4('0x11')]=checkNameSurname(_0x1f6759[_0xc8b4('0x12')][_0xc8b4('0x13')],_0x1f6759[_0xc8b4('0x12')][_0xc8b4('0x14')],_0x1f6759[_0xc8b4('0x12')]['lastName']);this['active']=_0x1f6759['active']||![];this[_0xc8b4('0x15')]=_0x1f6759[_0xc8b4('0x12')][_0xc8b4('0x13')];this[_0xc8b4('0x16')]=_0x1f6759['scheduledat'];this[_0xc8b4('0x17')]=_0x1f6759[_0xc8b4('0x17')]||0x0;this[_0xc8b4('0x18')]=_0x1f6759['countcongestionretry']||0x0;this['countnoanswerretry']=_0x1f6759[_0xc8b4('0x19')]||0x0;this[_0xc8b4('0x1a')]=(_0x1f6759[_0xc8b4('0x17')]||0x0)+(_0x1f6759[_0xc8b4('0x18')]||0x0)+(_0x1f6759[_0xc8b4('0x19')]||0x0)+(_0x1f6759['countnosuchnumberretry']||0x0)+(_0x1f6759[_0xc8b4('0x1b')]||0x0)+(_0x1f6759['countabandonedretry']||0x0)+(_0x1f6759[_0xc8b4('0x1c')]||0x0)+(_0x1f6759[_0xc8b4('0x1d')]||0x0);this[_0xc8b4('0x1e')]=_0x1f6759[_0xc8b4('0x1e')]||0x0;this[_0xc8b4('0x1b')]=_0x1f6759[_0xc8b4('0x1b')]||0x0;this['countabandonedretry']=_0x1f6759['countabandonedretry']||0x0;this[_0xc8b4('0x1c')]=_0x1f6759[_0xc8b4('0x1c')]||0x0;this[_0xc8b4('0x1d')]=_0x1f6759['countagentrejectretry']||0x0;this[_0xc8b4('0x1f')]=_0x1f6759[_0xc8b4('0x1f')];this['callbackuniqueid']=_0x1f6759[_0xc8b4('0x20')];this[_0xc8b4('0x21')]=_0x1f6759['callbackat'];this[_0xc8b4('0x22')]=_0x1f6759['recallme'];this[_0xc8b4('0x23')]=_0x1f6759['ContactId'];this[_0xc8b4('0x24')]=_0x1f6759['ListId'];this[_0xc8b4('0x25')]=_['isNil'](_0x1f6759[_0xc8b4('0xc')])?_0x1f6759[_0xc8b4('0x25')]:_0x1f6759[_0xc8b4('0xc')]['id'];this[_0xc8b4('0x26')]=_0x1f6759[_0xc8b4('0x26')];this['originatecalleridnum']='';this[_0xc8b4('0x27')]='';}Action[_0xc8b4('0x28')][_0xc8b4('0x29')]=function(){return util[_0xc8b4('0xf')](_0xc8b4('0x2a'),this[_0xc8b4('0x11')],this[_0xc8b4('0x2b')]);};module[_0xc8b4('0x2c')]=Action; \ No newline at end of file +var _0x46ed=['string','uniqueid','type','queue','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil'];(function(_0x34e4f1,_0x57b35d){var _0x1a7e8e=function(_0x54384f){while(--_0x54384f){_0x34e4f1['push'](_0x34e4f1['shift']());}};_0x1a7e8e(++_0x57b35d);}(_0x46ed,0x197));var _0xd46e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46ed[_0x4ff09b];return _0x3f5c2e;};'use strict';var util=require('util');var _=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));function checkNameSurname(_0x498832,_0x18fd84,_0x17fd25){var _0x3a0e07='';if(!_[_0xd46e('0x2')](_0x18fd84)&&_0xd46e('0x3')===typeof _0x18fd84){_0x3a0e07+=_0x18fd84;}if(!_[_0xd46e('0x2')](_0x17fd25)&&_0xd46e('0x3')===typeof _0x17fd25){_0x3a0e07+='\x20'+_0x17fd25;}if(_0x3a0e07!==''){return _0x3a0e07;}return _0x498832;}function Action(_0x48c444,_0x49efc1,_0x369bb7,_0x450612,_0x19844d){this[_0xd46e('0x4')]=_0x369bb7||undefined;this['idContact']=_0x48c444['id'];this['queue']=_0x49efc1['name'];this[_0xd46e('0x5')]=_0x49efc1['type'];this['campaigntype']=_0xd46e('0x6');this[_0xd46e('0x7')]=![];this[_0xd46e('0x8')]=_[_0xd46e('0x2')](_0x48c444[_0xd46e('0x9')])?undefined:_0x48c444[_0xd46e('0x9')]['name'];this['channelAgent']=this[_0xd46e('0x8')]?util['format'](_0xd46e('0xa'),this[_0xd46e('0x8')]):_0x450612||undefined;this[_0xd46e('0xb')]=checkNameSurname(_0x48c444[_0xd46e('0xc')][_0xd46e('0xd')],_0x48c444[_0xd46e('0xc')][_0xd46e('0xe')],_0x48c444[_0xd46e('0xc')]['lastName']);this[_0xd46e('0xf')]=_0x48c444[_0xd46e('0xf')]||![];this[_0xd46e('0x10')]=_0x48c444[_0xd46e('0xc')]['phone'];this[_0xd46e('0x11')]=_0x48c444['scheduledat'];this[_0xd46e('0x12')]=_0x48c444[_0xd46e('0x12')]||0x0;this[_0xd46e('0x13')]=_0x48c444[_0xd46e('0x13')]||0x0;this[_0xd46e('0x14')]=_0x48c444[_0xd46e('0x14')]||0x0;this[_0xd46e('0x15')]=(_0x48c444['countbusyretry']||0x0)+(_0x48c444['countcongestionretry']||0x0)+(_0x48c444['countnoanswerretry']||0x0)+(_0x48c444[_0xd46e('0x16')]||0x0)+(_0x48c444[_0xd46e('0x17')]||0x0)+(_0x48c444[_0xd46e('0x18')]||0x0)+(_0x48c444['countmachineretry']||0x0)+(_0x48c444[_0xd46e('0x19')]||0x0);this[_0xd46e('0x16')]=_0x48c444[_0xd46e('0x16')]||0x0;this[_0xd46e('0x17')]=_0x48c444['countdropretry']||0x0;this[_0xd46e('0x18')]=_0x48c444['countabandonedretry']||0x0;this[_0xd46e('0x1a')]=_0x48c444['countmachineretry']||0x0;this[_0xd46e('0x19')]=_0x48c444[_0xd46e('0x19')]||0x0;this[_0xd46e('0x1b')]=_0x48c444[_0xd46e('0x1b')];this[_0xd46e('0x1c')]=_0x48c444['callbackuniqueid'];this[_0xd46e('0x1d')]=_0x48c444[_0xd46e('0x1d')];this['recallme']=_0x48c444[_0xd46e('0x1e')];this['ContactId']=_0x48c444[_0xd46e('0x1f')];this['ListId']=_0x48c444['ListId'];this[_0xd46e('0x20')]=_[_0xd46e('0x2')](_0x48c444[_0xd46e('0x9')])?_0x48c444[_0xd46e('0x20')]:_0x48c444[_0xd46e('0x9')]['id'];this['VoiceQueueId']=_0x48c444[_0xd46e('0x21')];this[_0xd46e('0x22')]='';this[_0xd46e('0x23')]='';}Action['prototype'][_0xd46e('0x24')]=function(){return util[_0xd46e('0x25')](_0xd46e('0x26'),this[_0xd46e('0xb')],this[_0xd46e('0x27')]);};module[_0xd46e('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 d3f4ffe..d8eebb9 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 _0x6fc8=['callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','setMessage','recallMe','isNil','actions','queue','originated:\x20','pTalking','dialAnswer','contactId','Action','channel','catch','message','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','clearZombieChannel','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','answertime','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','pTalking:\x20','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','run','unlock','pick','execRun','recallme','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','unlockContact','transfer','[syncHangup][talking][transfer]','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','available','sumDuration','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active'];(function(_0x509e99,_0x159237){var _0xd06ccb=function(_0x511b25){while(--_0x511b25){_0x509e99['push'](_0x509e99['shift']());}};_0xd06ccb(++_0x159237);}(_0x6fc8,0x107));var _0x86fc=function(_0x3d5a07,_0x4b333f){_0x3d5a07=_0x3d5a07-0x0;var _0x13ecbc=_0x6fc8[_0x3d5a07];return _0x13ecbc;};'use strict';var util=require(_0x86fc('0x0'));var _=require(_0x86fc('0x1'));var BPromise=require(_0x86fc('0x2'));var uuid=require(_0x86fc('0x3'));var moment=require(_0x86fc('0x4'));var md5=require(_0x86fc('0x5'));var Redis=require(_0x86fc('0x6'));var config=require(_0x86fc('0x7'));var logger=require(_0x86fc('0x8'))(_0x86fc('0x9'));var loggerAction=require(_0x86fc('0x8'))(_0x86fc('0xa'));var ami=require(_0x86fc('0xb'));var rpcDb=require(_0x86fc('0xc'));var Action=require(_0x86fc('0xd'));var ut=require('./util/util');config[_0x86fc('0xe')]=_[_0x86fc('0xf')](config[_0x86fc('0xe')],{'host':_0x86fc('0x10'),'port':0x18eb});var io=require(_0x86fc('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x86fc('0x12')][_0x86fc('0x13')]=function(_0x3b2df8){this[_0x86fc('0x14')]=this[_0x86fc('0x14')]?this[_0x86fc('0x14')][_0x86fc('0x15')](_0x3b2df8):_0x3b2df8();};function Preview(_0x2a3e5c){this[_0x86fc('0x16')]=new Sequence();this[_0x86fc('0x17')]=_0x2a3e5c[_0x86fc('0x18')];this[_0x86fc('0x19')]=_0x2a3e5c[_0x86fc('0x19')];this['actions']={};this['agents']=_0x2a3e5c[_0x86fc('0x1a')];this[_0x86fc('0x1b')]=0x0;ami['on'](_0x86fc('0x1c'),this['syncOriginateResponse'][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x1e'),this[_0x86fc('0x1f')][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x20'),this[_0x86fc('0x21')][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x22'),this['syncDialEnd'][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x23'),this[_0x86fc('0x24')][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x25'),this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x86fc('0x26'),this[_0x86fc('0x27')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x22c1af,_0x13ee59,_0x1501f1){io['to'](_0x22c1af)[_0x86fc('0x28')](_0x13ee59,_0x1501f1);}function emitCampaignPreview(_0x4c3ed2){if(_0x4c3ed2[_0x86fc('0x29')]===_0x86fc('0x2a')){var _0xf11be9={'id':_0x4c3ed2['id'],'name':_0x4c3ed2[_0x86fc('0x2b')],'strategy':_0x4c3ed2[_0x86fc('0x2c')],'answered':_0x4c3ed2['answered'],'available':_0x4c3ed2[_0x86fc('0x2d')],'loggedIn':_0x4c3ed2['loggedIn'],'pTalking':_0x4c3ed2['pTalking'],'sumBillable':_0x4c3ed2['sumBillable'],'sumDuration':_0x4c3ed2[_0x86fc('0x2e')],'sumHoldTime':_0x4c3ed2['sumHoldTime']||0x0,'talking':_0x4c3ed2[_0x86fc('0x2f')],'total':_0x4c3ed2[_0x86fc('0x30')],'type':_0x4c3ed2[_0x86fc('0x29')],'unmanaged':_0x4c3ed2[_0x86fc('0x31')],'abandoned':_0x4c3ed2[_0x86fc('0x32')],'waiting':_0x4c3ed2[_0x86fc('0x33')],'loggedInDb':_0x4c3ed2['loggedInDb'],'dialActive':_0x4c3ed2[_0x86fc('0x34')],'dialMethod':_0x4c3ed2[_0x86fc('0x35')],'dialOriginateCallerIdName':_0x4c3ed2['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4c3ed2[_0x86fc('0x36')],'dialOriginateTimeout':_0x4c3ed2[_0x86fc('0x37')],'dialPrefix':_0x4c3ed2['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4c3ed2[_0x86fc('0x38')],'outboundAnswerCallsDay':_0x4c3ed2[_0x86fc('0x39')],'outboundBlacklistCallsDay':_0x4c3ed2[_0x86fc('0x3a')],'outboundBusyCallsDay':_0x4c3ed2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4c3ed2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4c3ed2[_0x86fc('0x3b')],'outboundDropCallsDayCallersExit':_0x4c3ed2[_0x86fc('0x3c')],'outboundDropCallsDayTimeout':_0x4c3ed2[_0x86fc('0x3d')],'outboundNoAnswerCallsDay':_0x4c3ed2[_0x86fc('0x3e')],'outboundNoSuchCallsDay':_0x4c3ed2[_0x86fc('0x3f')],'outboundOriginateFailureCallsDay':_0x4c3ed2[_0x86fc('0x40')],'outboundReCallsDay':_0x4c3ed2[_0x86fc('0x41')],'outboundRejectCallsDay':_0x4c3ed2[_0x86fc('0x42')],'outboundUnknownCallsDay':_0x4c3ed2['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4c3ed2[_0x86fc('0x43')],'predictiveIntervalAnsweredCalls':_0x4c3ed2[_0x86fc('0x44')],'predictiveIntervalAvgHoldtime':_0x4c3ed2['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4c3ed2['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4c3ed2[_0x86fc('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x4c3ed2[_0x86fc('0x46')],'predictiveIntervalErlangCalls':_0x4c3ed2[_0x86fc('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c3ed2[_0x86fc('0x48')],'predictiveIntervalHitRate':_0x4c3ed2[_0x86fc('0x49')],'predictiveIntervalMultiplicativeFactor':_0x4c3ed2[_0x86fc('0x4a')],'predictiveIntervalPauses':_0x4c3ed2[_0x86fc('0x4b')],'predictiveIntervalAvailable':_0x4c3ed2[_0x86fc('0x4c')],'predictiveIntervalTotalCalls':_0x4c3ed2['predictiveIntervalTotalCalls'],'message':_0x4c3ed2['message'],'originated':_0x4c3ed2['originated'],'erlangCalls':_0x4c3ed2['erlangCalls'],'erlangCallToSecond':_0x4c3ed2['erlangCallToSecond'],'erlangAbandonmentRate':_0x4c3ed2[_0x86fc('0x4d')],'erlangBusyFactor':_0x4c3ed2[_0x86fc('0x4e')],'startPredictive':_0x4c3ed2['startPredictive'],'startProgressive':_0x4c3ed2[_0x86fc('0x4f')]};if(_0x4c3ed2[_0x86fc('0x50')]){_0xf11be9['Trunk']={'id':_0x4c3ed2[_0x86fc('0x50')]['id'],'name':_0x4c3ed2[_0x86fc('0x50')][_0x86fc('0x2b')],'active':_0x4c3ed2[_0x86fc('0x50')][_0x86fc('0x51')],'callerid':_0x4c3ed2[_0x86fc('0x50')][_0x86fc('0x52')]};}if(_0x4c3ed2['Interval']){_0xf11be9[_0x86fc('0x53')]={'id':_0x4c3ed2[_0x86fc('0x53')]['id'],'name':_0x4c3ed2[_0x86fc('0x53')]['name']};}var _0x305d03=md5(JSON[_0x86fc('0x54')](_0xf11be9));if(_0x4c3ed2['md5']!==_0x305d03){_0x4c3ed2[_0x86fc('0x5')]=_0x305d03;emit(util[_0x86fc('0x55')]('voice:queue:%s',_0xf11be9[_0x86fc('0x2b')]),_0x86fc('0x56'),_0xf11be9);}}}function emitVoiceQueueChannelRemove(_0x4cd853){logger[_0x86fc('0x57')](_0x86fc('0x58'),JSON[_0x86fc('0x54')](_0x4cd853));emit(util[_0x86fc('0x55')](_0x86fc('0x59'),_0x4cd853[_0x86fc('0x2b')]),'voice_queue_channel:remove',_0x4cd853);}function notSendMessagesQueue(_0x4b85ac){if(_0x4b85ac[_0x86fc('0x5a')]){if(_0x4b85ac[_0x86fc('0x5b')]===0x0&&_0x4b85ac['pTalking']===0x0){_0x4b85ac['sendMessageOneNotActive']=![];_0x4b85ac['available']=0x0;_0x4b85ac[_0x86fc('0x5c')]=0x0;_0x4b85ac['message']=_0x86fc('0x5d');ut[_0x86fc('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4b85ac[_0x86fc('0x2b')]+_0x86fc('0x5f'));}else{_0x4b85ac['message']=_0x86fc('0x60');ut[_0x86fc('0x5e')](_0x86fc('0x61'),_0x4b85ac[_0x86fc('0x2b')]+_0x86fc('0x62'));}emitCampaignPreview(_0x4b85ac);}}Preview[_0x86fc('0x12')][_0x86fc('0x63')]=function(){var _0x312c18=this;setInterval(function(){_0x312c18[_0x86fc('0x64')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x4c0e6e=this[_0x86fc('0x17')];this['clockClearZombieChannels']+=0x1;for(var _0xb01c1 in _0x4c0e6e){if(_0x4c0e6e[_0x86fc('0x65')](_0xb01c1)&&(_0x4c0e6e[_0xb01c1]['dialMethod']===_0x86fc('0x9')||_0x4c0e6e[_0xb01c1]['dialMethod']===_0x86fc('0x66'))&&_0x4c0e6e[_0xb01c1][_0x86fc('0x29')]===_0x86fc('0x2a')){if(this['clockClearZombieChannels']>0x7){this[_0x86fc('0x1b')]=0x0;this['clearZombieChannels']();}}if(_0x4c0e6e[_0x86fc('0x65')](_0xb01c1)&&_0x4c0e6e[_0xb01c1][_0x86fc('0x35')]==='preview'&&_0x4c0e6e[_0xb01c1]['type']==='outbound'){if(_0x4c0e6e[_0xb01c1]['dialActive']){this[_0x86fc('0x67')](_0x4c0e6e[_0xb01c1]);this[_0x86fc('0x68')](_0x4c0e6e[_0xb01c1]);}else{notSendMessagesQueue(_0x4c0e6e[_0xb01c1]);}}}};Preview[_0x86fc('0x12')]['clearZombieChannel']=function(_0x8c1580){var _0x1d6544=this;this[_0x86fc('0x16')][_0x86fc('0x13')](function(){if(!_[_0x86fc('0x69')](_0x1d6544[_0x86fc('0x6a')][_0x8c1580])){loggerAction[_0x86fc('0x57')]('[clearZombieChannels][talking]',_0x8c1580,'Queue',_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')],_0x86fc('0x6c'),JSON[_0x86fc('0x54')](_0x1d6544[_0x86fc('0x17')][_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]][_0x86fc('0x5b')]),'pTalking:\x20',JSON[_0x86fc('0x54')](_0x1d6544[_0x86fc('0x17')][_0x1d6544[_0x86fc('0x6a')][_0x8c1580]['queue']][_0x86fc('0x6d')]),JSON[_0x86fc('0x54')](_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6e')]),JSON[_0x86fc('0x54')](_['pick'](_0x1d6544[_0x86fc('0x6a')][_0x8c1580],[_0x86fc('0x6f'),'UserId','VoiceQueueId','ListId'])));return ami[_0x86fc('0x70')]({'action':'status','channel':_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x71')]})[_0x86fc('0x72')](function(_0x11881f){if(_0x11881f[_0x86fc('0x73')]===_0x86fc('0x74')){setTimeout(function(){if(_0x1d6544['actions'][_0x8c1580]){ut[_0x86fc('0x75')](_0x1d6544[_0x86fc('0x17')][_0x1d6544['actions'][_0x8c1580]['queue']],'[clearZombieChannel]');if(_0x1d6544['actions'][_0x8c1580][_0x86fc('0x6e')]===!![]){ut[_0x86fc('0x76')](_0x1d6544[_0x86fc('0x17')][_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]],_0x86fc('0x77'));ut[_0x86fc('0x78')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8c1580,_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]);}ut[_0x86fc('0x78')](_0x86fc('0x79')+_0x8c1580,_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]);delete _0x1d6544[_0x86fc('0x6a')][_0x8c1580];}},0x2328);}});}});};Preview[_0x86fc('0x12')][_0x86fc('0x7a')]=function(){var _0x56a444=this;loggerAction['info'](_0x86fc('0x7b'),_[_0x86fc('0x7c')](this['actions']));for(var _0x179a08 in this['actions']){if(_0x56a444[_0x86fc('0x6a')][_0x86fc('0x65')](_0x179a08)){_0x56a444[_0x86fc('0x7d')](_0x179a08);}}};Preview[_0x86fc('0x12')][_0x86fc('0x68')]=function(_0x4f56f3){var _0x5e184f=this;rpcDb[_0x86fc('0x7e')](_0x4f56f3['id'],ut['agentReadyId'](this['agents']))[_0x86fc('0x7f')](function(_0x1694b9){if(!_['isNil'](_0x1694b9)){for(var _0x537821=0x0;_0x537821<_0x1694b9[_0x86fc('0x80')];_0x537821+=0x1){if(ut[_0x86fc('0x81')](_0x1694b9[_0x537821][_0x86fc('0x82')])<_0x4f56f3[_0x86fc('0x83')]*0x3c){if(_0x1694b9[_0x537821]['Agent']&&!_0x1694b9[_0x537821][_0x86fc('0x84')][_0x86fc('0x85')]){_0x5e184f['run'](_0x1694b9[_0x537821]['id'])[_0x86fc('0x7f')](ut[_0x86fc('0x86')](_0x86fc('0x87')))[_0x86fc('0x72')](ut[_0x86fc('0x86')](_0x86fc('0x87')));}else{rpcDb[_0x86fc('0x88')](_0x1694b9[_0x537821]['id']);}}else{var _0xf7d9a=new Action(_0x1694b9[_0x537821],_0x4f56f3);_0xf7d9a[_0x86fc('0x89')]=moment()['format'](_0x86fc('0x8a'));_0x4f56f3[_0x86fc('0x41')]+=0x1;ut[_0x86fc('0x8b')](_0xf7d9a,0x17,_0x86fc('0x8c'));if(_0x4f56f3[_0x86fc('0x8d')]){rpcDb[_0x86fc('0x8e')](ut[_0x86fc('0x8f')](_0x1694b9[_0x537821]));rpcDb[_0x86fc('0x90')](_0xf7d9a,_0x86fc('0x91'));}else{ut[_0x86fc('0x8b')](_0xf7d9a,0x16,'RecallFailedTimeout');rpcDb[_0x86fc('0x90')](_0xf7d9a,_0x86fc('0x92'));rpcDb[_0x86fc('0x93')](_0xf7d9a,_0x86fc('0x92'));}}}}})[_0x86fc('0x72')](ut[_0x86fc('0x86')](_0x86fc('0x94')));};Preview[_0x86fc('0x12')]['setMessage']=function(_0x5f065c){_0x5f065c['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x5f065c[_0x86fc('0x95')])){_0x5f065c['message']=_0x86fc('0x96');}else if(!ut['isActive'](_0x5f065c[_0x86fc('0x34')])){_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x5d');}else if(!this[_0x86fc('0x97')](_0x5f065c[_0x86fc('0x50')])){if(!this[_0x86fc('0x97')](_0x5f065c[_0x86fc('0x98')])){_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x99');}else{_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x9a');}}else{_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x9a');}emitCampaignPreview(_0x5f065c);};Preview[_0x86fc('0x12')]['callProgressDetectingCustomer']=function(_0x6751ae,_0x369dad,_0x42695c){var _0x5d95d2=this;var _0x2e3d1a=this[_0x86fc('0x6a')][_0x369dad];var _0x1b9c01=this[_0x86fc('0x17')][_0x2e3d1a[_0x86fc('0x6b')]];var _0x3c4583;if(_0x1b9c01){switch(_0x42695c){case'1':_0x1b9c01[_0x86fc('0x3f')]+=0x1;_0x2e3d1a['countnosuchnumberretry']+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut[_0x86fc('0x9c')](_0x2e3d1a);ut['logCustomer'](_0x2e3d1a,0x0,'NoSuchNumber');ami[_0x86fc('0x28')](_0x86fc('0x9d'),ut['buildObj'](_0x2e3d1a,_0x86fc('0x9e')));rpcDb['createCustomerHistory'](_0x2e3d1a,_0x86fc('0x9f'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut['cloneAction'](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xa2'));}else{if(_0x2e3d1a[_0x86fc('0xa3')]>=_0x1b9c01['dialNoSuchNumberMaxRetry']){rpcDb[_0x86fc('0x93')](_0x2e3d1a,_0x86fc('0xa2'));}else{rpcDb[_0x86fc('0xa4')](ut[_0x86fc('0xa5')](_0x2e3d1a,_0x86fc('0xa3'),_0x1b9c01[_0x86fc('0xa6')]),_0x2e3d1a['unlockAgent'],_0x2e3d1a[_0x86fc('0xa7')]);}}delete this[_0x86fc('0x6a')][_0x6751ae['linkedid']];break;case _0x86fc('0xa8'):var _0x580369=moment()[_0x86fc('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e3d1a[_0x86fc('0xa9')]=_0x580369;_0x2e3d1a[_0x86fc('0xaa')]=_0x580369;_0x2e3d1a['dialAnswer']=!![];_0x1b9c01['pTalking']+=0x1;logger[_0x86fc('0x57')]('[syncHangup][talking][increment]',_0x2e3d1a['uniqueid'],_0x86fc('0xab'),_0x1b9c01[_0x86fc('0x2b')],'pTalking:\x20',_0x1b9c01['pTalking']);ami[_0x86fc('0x28')](_0x86fc('0xac'),ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xae')));if(_0x1b9c01[_0x86fc('0xaf')]){ami[_0x86fc('0x28')](_0x86fc('0xb0'),ut[_0x86fc('0xb1')](_0x2e3d1a));}break;case'16':ami[_0x86fc('0x28')](_0x86fc('0xb2'),ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xb3')));emitVoiceQueueChannelRemove(ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xb3')));_0x1b9c01['outboundAnswerCallsDay']+=0x1;_0x1b9c01[_0x86fc('0x30')]+=0x1;_0x1b9c01['answered']+=0x1;ut[_0x86fc('0x76')](_0x1b9c01,_0x86fc('0xb4'));_0x2e3d1a['countglobal']=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x4,_0x86fc('0xb5'));rpcDb['createCustomerHistory'](_0x2e3d1a,_0x86fc('0xb6'));rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xb7'));rpcDb[_0x86fc('0xb8')](_0x2e3d1a);_0x1b9c01[_0x86fc('0x2e')]+=_0x2e3d1a[_0x86fc('0xb9')];_0x1b9c01[_0x86fc('0xba')]+=_0x2e3d1a[_0x86fc('0xb9')];logger[_0x86fc('0x57')](_0x86fc('0xbb'),_0x2e3d1a[_0x86fc('0xbc')],'\x20Queue',_0x1b9c01[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x1b9c01[_0x86fc('0x6d')]);delete this['actions'][_0x6751ae['linkedid']];break;case _0x86fc('0xbe'):_0x1b9c01['outboundBusyCallsDay']+=0x1;_0x2e3d1a[_0x86fc('0xbf')]+=0x1;_0x2e3d1a['countglobal']=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x5,_0x86fc('0xc0'));ami[_0x86fc('0x28')]('custom:agentbusy',ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xc1')));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xc2'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01['dialGlobalMaxRetry']){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xc4'));}else{if(_0x2e3d1a[_0x86fc('0xbf')]>=_0x1b9c01[_0x86fc('0xc5')]){rpcDb[_0x86fc('0x93')](_0x2e3d1a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x86fc('0xa5')](_0x2e3d1a,'countbusyretry',_0x1b9c01[_0x86fc('0xc6')]),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;case _0x86fc('0xc8'):_0x1b9c01[_0x86fc('0x3e')]+=0x1;_0x2e3d1a[_0x86fc('0xc9')]+=0x1;_0x2e3d1a['countglobal']=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x3,_0x86fc('0xca'));ami[_0x86fc('0x28')](_0x86fc('0xcb'),ut['buildObj'](_0x2e3d1a,'noanswer'));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xcc'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2e3d1a['countnoanswerretry']>=_0x1b9c01[_0x86fc('0xcd')]){rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xcc'));}else{rpcDb[_0x86fc('0xa4')](ut['scheduledAt'](_0x2e3d1a,'countnoanswerretry',_0x1b9c01[_0x86fc('0xce')]),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;case _0x86fc('0xcf'):_0x1b9c01[_0x86fc('0xd0')]+=0x1;_0x2e3d1a[_0x86fc('0xd1')]+=0x1;_0x2e3d1a['countglobal']=ut['totalGlobal'](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x8,_0x86fc('0xd2'));ami[_0x86fc('0x28')](_0x86fc('0xd3'),ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xd4')));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xd5'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01['dialGlobalMaxRetry']){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xd6'));}else{if(_0x2e3d1a[_0x86fc('0xd1')]>=_0x1b9c01[_0x86fc('0xd7')]){rpcDb[_0x86fc('0x93')](_0x2e3d1a,_0x86fc('0xd5'));}else{rpcDb[_0x86fc('0xa4')](ut[_0x86fc('0xa5')](_0x2e3d1a,_0x86fc('0xd1'),_0x1b9c01[_0x86fc('0xc6')]),_0x2e3d1a['unlockAgent'],_0x2e3d1a['activeContact']);}}break;case _0x86fc('0xd8'):_0x1b9c01[_0x86fc('0x42')]+=0x1;_0x2e3d1a[_0x86fc('0xd9')]+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x14,_0x86fc('0xda'));ami[_0x86fc('0x28')]('custom:agentreject',ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xdb')));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xdc'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0x14,_0x86fc('0xda'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xdd'));}else{if(_0x2e3d1a['countagentrejectretry']>=_0x1b9c01[_0x86fc('0xde')]){rpcDb[_0x86fc('0x93')](_0x2e3d1a,_0x86fc('0xdd'));}else{rpcDb[_0x86fc('0xa4')](ut[_0x86fc('0xa5')](_0x2e3d1a,_0x86fc('0xd9'),_0x1b9c01[_0x86fc('0xdf')]),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;case _0x86fc('0xe0'):_0x1b9c01['outboundAbandonedCallsDay']+=0x1;_0x2e3d1a[_0x86fc('0xe1')]+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut['totalGlobal'](_0x2e3d1a);ut['logCustomer'](_0x2e3d1a,0xb,_0x86fc('0xe2'));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xe3'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb['createCustomerFinal'](_0x3c4583,_0x86fc('0xe3'));}else{if(_0x2e3d1a[_0x86fc('0xe4')]>=_0x1b9c01[_0x86fc('0xe5')]){rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xe3'));}else{rpcDb['rescheduleContact'](ut[_0x86fc('0xa5')](_0x2e3d1a,'countabandonedretry',_0x1b9c01['dialAbandonedRetryFrequency']),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;default:if(_0x2e3d1a[_0x86fc('0x6e')]){ut['decrementTalkink'](_0x1b9c01,_0x86fc('0xe6'));ut[_0x86fc('0x78')](_0x86fc('0xe7')+_0x1b9c01[_0x86fc('0x2b')],_0x6751ae);}_0x1b9c01[_0x86fc('0xe8')]+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0xc,_0x6751ae[_0x86fc('0xe9')]||_0x6751ae['dialstatus']);rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xea'));if(ut['totalGlobal'](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,'Global');rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xeb'));}else{rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xeb'));}delete this[_0x86fc('0x6a')][_0x6751ae[_0x86fc('0xec')]];}if(!(_0x2e3d1a['dialAnswer']&&_0x42695c==='16')){ut[_0x86fc('0x75')](_0x1b9c01,_0x86fc('0xed'));logger[_0x86fc('0x57')](_0x86fc('0xee'),_0x2e3d1a[_0x86fc('0xbc')],'\x20Queue',_0x1b9c01['name'],_0x86fc('0x6c'),_0x1b9c01[_0x86fc('0x5b')]);}if(_0x42695c!==_0x86fc('0xa8')){delete this[_0x86fc('0x6a')][_0x6751ae[_0x86fc('0xec')]];delete this[_0x86fc('0x6a')][_0x6751ae[_0x86fc('0xef')]];}}};Preview['prototype'][_0x86fc('0xf0')]=function(_0x4b794d,_0x423401,_0x15e0bf){if(_[_0x86fc('0xf1')](_0x423401)&&_0x86fc('0xf2')!==typeof _0x423401){return;}if(_[_0x86fc('0xf1')](_0x15e0bf)&&'object'!==typeof _0x15e0bf){return;}switch(_0x15e0bf[_0x86fc('0xf3')]){case'0':ut[_0x86fc('0xf4')](_0x4b794d,0x0,'NoSuchNumber');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf6'));break;case'3':ut[_0x86fc('0xf4')](_0x4b794d,0x3,'NoAnswer');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf7'));break;case'5':ut['logAgent'](_0x4b794d,0x5,'Busy');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf8'));break;case'8':ut[_0x86fc('0xf4')](_0x4b794d,0x8,_0x86fc('0xd2'));rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf9'));break;case'22':ut[_0x86fc('0xf4')](_0x4b794d,0x16,'AnswerAGI');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xfa'));break;default:ut[_0x86fc('0xf4')](_0x4b794d,0xc,_0x15e0bf[_0x86fc('0xf3')]);rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf9'));}ut[_0x86fc('0x75')](_0x423401,_0x86fc('0xfb'));logger[_0x86fc('0x57')](_0x86fc('0xfc'),_0x4b794d['uniqueid'],_0x86fc('0xab'),_0x423401['name'],_0x86fc('0x6c'),_0x423401['originated']);delete this[_0x86fc('0x6a')][_0x4b794d['uniqueid']];};Preview[_0x86fc('0x12')][_0x86fc('0xfd')]=function(_0x558da0,_0x20cd83,_0x4cf133,_0x1cf098,_0x46bcc4){var _0x57ec38=this;return new BPromise(function(_0x4b9219,_0x17219b){if(_[_0x86fc('0x69')](_0x20cd83)||_[_0x86fc('0x69')](_0x20cd83[_0x86fc('0xfe')])||_['isNil'](_0x20cd83['Contact'][_0x86fc('0xff')])||_['isNil'](_0x20cd83[_0x86fc('0x100')])){_0x17219b(ut[_0x86fc('0x73')](_0x86fc('0x101'),_0x1cf098,_0x46bcc4));return;}var _0x172012=uuid['v4']();var _0x40e2ad=_0x57ec38['campaignsPreview'][_0x20cd83[_0x86fc('0x102')]['name']];var _0x2d621f=_0x4cf133?_0x57ec38['agents'][_0x4cf133]['id']:undefined;_0x57ec38['actions'][_0x172012]=new Action(_0x20cd83,_0x40e2ad,_0x172012,_0x4cf133,_0x2d621f);var _0x27535c=_0x57ec38[_0x86fc('0x6a')][_0x172012];_0x27535c[_0x86fc('0xc7')]=_0x1cf098;_0x27535c[_0x86fc('0xa7')]=_0x46bcc4;_0x27535c[_0x86fc('0x103')]=_0x4cf133;if(_[_0x86fc('0x104')](_0x558da0)){_0x57ec38[_0x86fc('0x105')](_0x27535c,_0x40e2ad,_0x20cd83,_0x4cf133)['then'](function(_0x74bd1d){logger[_0x86fc('0x57')](_0x86fc('0x106'),_0x86fc('0x107')+_0x27535c[_0x86fc('0x6b')]+'\x20IdHopper:\x20'+_0x27535c[_0x86fc('0x108')],JSON[_0x86fc('0x54')](_0x74bd1d));ami[_0x86fc('0x28')](_0x86fc('0x109'),ut[_0x86fc('0xad')](_0x27535c,_0x86fc('0x10a')));_0x4b9219(ut[_0x86fc('0x73')](_0x86fc('0x10b')));})[_0x86fc('0x72')](function(_0x28c63c){ut[_0x86fc('0x5e')](_0x86fc('0x10c'),_0x28c63c);_0x17219b(ut['message'](_0x86fc('0x10d'),_0x1cf098,_0x46bcc4));});}else{_0x40e2ad['outboundBlacklistCallsDay']+=0x1;ut[_0x86fc('0x10e')](_0x27535c);rpcDb[_0x86fc('0x10f')](_0x27535c,_0x86fc('0x110'));delete _0x57ec38['actions'][_0x172012];_0x17219b(ut[_0x86fc('0x73')](_0x86fc('0x111'),_0x1cf098,_0x46bcc4));}});};Preview['prototype']['isTrunkReachable']=function(_0x344a27){return!_[_0x86fc('0x69')](_0x344a27)&&!_[_0x86fc('0x69')](_0x344a27[_0x86fc('0x2b')])&&!_[_0x86fc('0x69')](_0x344a27['active'])&&_0x344a27[_0x86fc('0x51')]&&!_[_0x86fc('0x69')](this[_0x86fc('0x19')][util['format'](_0x86fc('0x112'),_0x344a27[_0x86fc('0x2b')])])&&!_[_0x86fc('0x69')](this[_0x86fc('0x19')][util[_0x86fc('0x55')](_0x86fc('0x112'),_0x344a27[_0x86fc('0x2b')])]['status'])&&(this[_0x86fc('0x19')][util[_0x86fc('0x55')]('SIP/%s',_0x344a27[_0x86fc('0x2b')])]['status']==='reachable'||this[_0x86fc('0x19')][util['format'](_0x86fc('0x112'),_0x344a27['name'])][_0x86fc('0x113')]===_0x86fc('0x114'));};Preview[_0x86fc('0x12')][_0x86fc('0x115')]=function(_0x1e6984,_0x5f5a14){var _0x5dbdab=this;return new BPromise(function(_0x40269e,_0x24b933){_0x5dbdab['execRun'](_0x1e6984,_0x5f5a14)[_0x86fc('0x7f')](function(_0x3b3c17){_0x40269e(_['pick'](_0x3b3c17,[_0x86fc('0x73')]));})[_0x86fc('0x72')](function(_0x1832ea){if(_0x1832ea[_0x86fc('0x116')]){rpcDb['unlockContact'](_0x1e6984);}if(_0x1832ea[_0x86fc('0x51')]){rpcDb[_0x86fc('0x88')](_0x1e6984);}_0x24b933(_[_0x86fc('0x117')](_0x1832ea,['message']));});});};Preview[_0x86fc('0x12')][_0x86fc('0x118')]=function(_0x4c9191,_0x32df48){var _0x58d7b9=this;return new BPromise(function(_0x3efb4b,_0x15fc5d){var _0x49537c,_0x463458;rpcDb['getContactPreview'](_0x4c9191)[_0x86fc('0x7f')](function(_0x29bf43){if(!_[_0x86fc('0x69')](_0x29bf43[0x0])){_0x463458=_0x29bf43[0x0][_0x86fc('0x119')]?![]:!![];_0x49537c=_0x29bf43[0x0][_0x86fc('0x119')]?!![]:![];_0x49537c=_0x32df48?!![]:_0x49537c;}var _0x5e009c=_0x58d7b9['validateContact'](_0x29bf43);if(_0x5e009c['isValid']){rpcDb[_0x86fc('0x11a')](_['pick'](_0x29bf43[0x0],[_0x86fc('0x100'),_0x86fc('0x11b')]))['then'](function(_0x8c8342){_0x58d7b9[_0x86fc('0xfd')](_0x8c8342,_0x29bf43[0x0],_0x32df48,_0x463458,_0x49537c)[_0x86fc('0x7f')](function(_0x382cc8){_0x3efb4b(_0x382cc8);})[_0x86fc('0x72')](function(_0x30fae7){_0x15fc5d(_0x30fae7);});})[_0x86fc('0x72')](function(_0x2089eb){ut[_0x86fc('0x5e')](_0x86fc('0x11c'),_0x2089eb);_0x15fc5d(ut['message'](_0x86fc('0x11d'),_0x463458,_0x49537c));});}else{_0x15fc5d(ut[_0x86fc('0x73')](_0x5e009c[_0x86fc('0x73')],_0x463458,_0x49537c));}})[_0x86fc('0x72')](function(_0x234479){ut[_0x86fc('0x5e')](_0x86fc('0x11e'),_0x234479);_0x15fc5d(ut[_0x86fc('0x73')](_0x86fc('0x11d'),![],!![]));});});};Preview[_0x86fc('0x12')][_0x86fc('0x11f')]=function(_0x1bd833){if(_['isNil'](_0x1bd833)||_[_0x86fc('0x104')](_0x1bd833)||!_[_0x86fc('0x69')](_0x1bd833[0x0][_0x86fc('0x84')])&&_[_0x86fc('0x69')](_0x1bd833[0x0][_0x86fc('0x84')][_0x86fc('0x2b')])){ut['logger'](_0x86fc('0x120'),_0x1bd833);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1f2125=this['campaignsPreview'][_0x1bd833[0x0][_0x86fc('0x102')][_0x86fc('0x2b')]];_0x1f2125['message']=_0x86fc('0x9a');if(_['isNil'](_0x1f2125)){ut[_0x86fc('0x5e')](_0x86fc('0x121'),_0x1f2125);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x1f2125[_0x86fc('0x50')])){ut[_0x86fc('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x86fc('0x122')+_0x1f2125['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x86fc('0x97')](_0x1f2125[_0x86fc('0x98')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x1f2125[_0x86fc('0x2b')]+_0x86fc('0x123'));return{'isValid':![],'message':_0x86fc('0x124')};}}if(!ut[_0x86fc('0x125')](_0x1f2125[_0x86fc('0x34')])){ut['logger'](_0x86fc('0x126'),_0x1f2125[_0x86fc('0x2b')]+_0x86fc('0x127'));return{'isValid':![],'message':_0x86fc('0x122')+_0x1f2125[_0x86fc('0x2b')]+_0x86fc('0x127')};}return{'isValid':!![],'message':_0x86fc('0x128')};};Preview['prototype']['execCall']=function(_0x13e5a6,_0x6badd,_0x8ef3ba,_0xdf202b){var _0x14559c=this;return new BPromise(function(_0x1b7c9c,_0x11c648){var _0x36ef84=_0x13e5a6[_0x86fc('0xbc')];var _0x4147ab=_0x14559c[_0x86fc('0x97')](_0x6badd['Trunk'])?util[_0x86fc('0x55')](_0x86fc('0x129'),_0x6badd[_0x86fc('0x50')][_0x86fc('0x2b')],_[_0x86fc('0x69')](_0x6badd[_0x86fc('0x12a')])?'':_0x6badd[_0x86fc('0x12a')][_0x86fc('0x12b')]()||'',_0x6badd[_0x86fc('0x12c')]>0x0?_0x8ef3ba['Contact'][_0x86fc('0xff')]['substring'](_0x6badd[_0x86fc('0x12c')]):_0x8ef3ba['Contact']['phone']):util[_0x86fc('0x55')](_0x86fc('0x129'),_[_0x86fc('0x69')](_0x6badd[_0x86fc('0x98')])?_0x6badd[_0x86fc('0x50')]['name']:_0x6badd[_0x86fc('0x98')][_0x86fc('0x2b')],_['isNil'](_0x6badd[_0x86fc('0x12a')])?'':_0x6badd[_0x86fc('0x12a')][_0x86fc('0x12b')]()||'',_0x6badd['dialCutDigit']>0x0?_0x8ef3ba[_0x86fc('0xfe')][_0x86fc('0xff')][_0x86fc('0x12d')](_0x6badd[_0x86fc('0x12c')]):_0x8ef3ba['Contact'][_0x86fc('0xff')]);var _0x2fa25d=_0x14559c[_0x86fc('0x97')](_0x6badd[_0x86fc('0x50')])?ut[_0x86fc('0x12e')](_0x6badd['Trunk'][_0x86fc('0x52')],_0x6badd[_0x86fc('0x12f')],_0x6badd[_0x86fc('0x130')]>0x0?ut[_0x86fc('0x131')](_0x6badd[_0x86fc('0x36')],_0x6badd['dialRandomLastDigitCallerIdNumber']):_0x6badd[_0x86fc('0x36')]):ut[_0x86fc('0x12e')](_[_0x86fc('0x69')](_0x6badd[_0x86fc('0x98')])?_0x6badd[_0x86fc('0x50')][_0x86fc('0x52')]:_0x6badd['TrunkBackup'][_0x86fc('0x52')],_0x6badd[_0x86fc('0x12f')],_0x6badd[_0x86fc('0x130')]>0x0?ut[_0x86fc('0x131')](_0x6badd['dialOriginateCallerIdNumber'],_0x6badd[_0x86fc('0x130')]):_0x6badd[_0x86fc('0x36')]);if(_0x2fa25d){_0x13e5a6[_0x86fc('0x132')]=ut[_0x86fc('0x133')](_0x2fa25d);_0x13e5a6[_0x86fc('0x134')]=ut[_0x86fc('0x135')](_0x2fa25d);}var _0x453d21=ut['addVariables'](_0x6badd,_0x8ef3ba,_0x4147ab,_0x2fa25d,_0x36ef84,_0x13e5a6);_[_0x86fc('0x136')](_0x13e5a6,ut['toLowerVariables'](_0x453d21));_0x13e5a6['starttime']=moment()['format'](_0x86fc('0x8a'));ami['Action'](ut[_0x86fc('0x137')](_0x13e5a6,_0x6badd,_0x453d21,_0x13e5a6[_0x86fc('0xa7')],_0xdf202b))['then'](function(_0x109ac8){_0x6badd['originated']+=0x1;logger[_0x86fc('0x57')](_0x86fc('0x138'),_0x36ef84,_0x86fc('0xab'),_0x6badd[_0x86fc('0x2b')],'originated:\x20',_0x6badd[_0x86fc('0x5b')]);_0x1b7c9c(_0x109ac8);})[_0x86fc('0x72')](function(_0x37cc0b){ut['logAgent'](_0x13e5a6,0xe,_0x86fc('0x139'));rpcDb[_0x86fc('0xf5')](_0x13e5a6,_0x86fc('0x13a'));_0x11c648(_0x37cc0b);});});};Preview[_0x86fc('0x12')][_0x86fc('0x24')]=function(_0x5c67f2){if(this[_0x86fc('0x6a')][_0x5c67f2[_0x86fc('0xec')]]){this[_0x86fc('0x6a')][_0x5c67f2[_0x86fc('0xec')]]['channel']=_0x5c67f2['channel'];}};Preview[_0x86fc('0x12')][_0x86fc('0x13b')]=function(_0x382bea){var _0x2e3307=this;var _0x1e52c2=this[_0x86fc('0x6a')][_0x382bea[_0x86fc('0x13c')]];if(_0x1e52c2){if(_0x1e52c2[_0x86fc('0x103')]&&this[_0x86fc('0x1a')][_0x1e52c2[_0x86fc('0x103')]]){ut['logLookAgent'](_0x1e52c2,this[_0x86fc('0x1a')][_0x1e52c2[_0x86fc('0x103')]][_0x86fc('0x2b')],this['agents'][_0x1e52c2[_0x86fc('0x103')]]['id']);}var _0x5d9d8a=_[_0x86fc('0x13d')](_0x1e52c2);_0x5d9d8a['responsetime']=moment()['format'](_0x86fc('0x8a'));var _0x363675=_0x2e3307[_0x86fc('0x17')][_0x1e52c2[_0x86fc('0x6b')]];if(ut['isFailure'](_0x382bea[_0x86fc('0x13e')])){if(_0x1e52c2[_0x86fc('0xc7')]){rpcDb['unlockContact'](_0x1e52c2[_0x86fc('0x108')]);}if(_0x1e52c2['activeContact']){rpcDb['disableContact'](_0x1e52c2[_0x86fc('0x108')]);}ami[_0x86fc('0x28')](_0x86fc('0x13f'),ut['buildObj'](_0x1e52c2,_0x86fc('0x140')));this[_0x86fc('0xf0')](_0x5d9d8a,_0x363675,_0x382bea);}else{_0x1e52c2[_0x86fc('0x89')]=moment()['format'](_0x86fc('0x8a'));ut[_0x86fc('0xf4')](_0x5d9d8a,0x4,_0x86fc('0xb5'));rpcDb[_0x86fc('0xf5')](_0x5d9d8a,_0x86fc('0x141'));}}};Preview[_0x86fc('0x12')][_0x86fc('0x1f')]=function(_0x3f9e78){var _0x456230=this;var _0x21cc9b=this[_0x86fc('0x6a')][_0x3f9e78[_0x86fc('0xec')]];var _0x2de89c;if(_0x21cc9b){_0x2de89c=this[_0x86fc('0x17')][_0x21cc9b[_0x86fc('0x6b')]];logger['info']('[syncHangup][talking]',_0x3f9e78[_0x86fc('0xec')],_0x86fc('0xab'),_0x2de89c[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x2de89c['pTalking']);}if(this[_0x86fc('0x6a')][_0x3f9e78['linkedid']]&&_0x3f9e78[_0x86fc('0xec')]!==_0x3f9e78[_0x86fc('0xbc')]){if(_0x3f9e78[_0x86fc('0x142')]==='16'&&this[_0x86fc('0x6a')][_0x3f9e78['linkedid']][_0x86fc('0x6e')]){this[_0x86fc('0x143')](_0x3f9e78,_0x3f9e78[_0x86fc('0xec')],_0x3f9e78[_0x86fc('0x142')]);}else if(this[_0x86fc('0x6a')][_0x3f9e78[_0x86fc('0xec')]][_0x86fc('0x6e')]){logger[_0x86fc('0x57')](_0x86fc('0x144'),_0x3f9e78['linkedid'],_0x3f9e78[_0x86fc('0x142')],_0x86fc('0xab'),_0x2de89c[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x2de89c['pTalking']);this[_0x86fc('0x143')](_0x3f9e78,_0x3f9e78['linkedid'],_0x3f9e78['cause']);}}else if(_0x21cc9b&&_[_0x86fc('0x69')](_0x21cc9b[_0x86fc('0x145')])&&_0x2de89c[_0x86fc('0x146')]&&_0x3f9e78[_0x86fc('0xec')]===_0x3f9e78['uniqueid']&&_[_0x86fc('0x69')](_0x3f9e78[_0x86fc('0xf3')])&&_0x3f9e78[_0x86fc('0x142')]==='16'&&_0x3f9e78[_0x86fc('0x147')]==='6'&&_[_0x86fc('0xf1')](_0x21cc9b['transfer'])){if(_0x21cc9b[_0x86fc('0xc7')]){rpcDb[_0x86fc('0x148')](_0x21cc9b[_0x86fc('0x108')]);}if(_0x21cc9b[_0x86fc('0xa7')]){rpcDb[_0x86fc('0x88')](_0x21cc9b[_0x86fc('0x108')]);}_0x3f9e78[_0x86fc('0xf3')]='22';this[_0x86fc('0xf0')](_0x21cc9b,_0x2de89c,_0x3f9e78);}else if(_0x21cc9b&&_0x21cc9b[_0x86fc('0x149')]){if(_0x3f9e78[_0x86fc('0x142')]==='16'&&this[_0x86fc('0x6a')][_0x3f9e78[_0x86fc('0xec')]][_0x86fc('0x6e')]){logger[_0x86fc('0x57')](_0x86fc('0x14a'),_0x3f9e78[_0x86fc('0xec')],_0x3f9e78[_0x86fc('0x142')],_0x86fc('0xab'),_0x2de89c[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x2de89c[_0x86fc('0x6d')]);this[_0x86fc('0x143')](_0x3f9e78,_0x3f9e78['linkedid'],_0x3f9e78[_0x86fc('0x142')]);}else if(this[_0x86fc('0x6a')][_0x3f9e78['linkedid']][_0x86fc('0x6e')]){logger['info'](_0x86fc('0x144'),_0x3f9e78[_0x86fc('0xec')],_0x3f9e78['cause'],_0x86fc('0xab'),_0x2de89c['name'],'pTalking:\x20',_0x2de89c[_0x86fc('0x6d')]);this['callProgressDetectingCustomer'](_0x3f9e78,_0x3f9e78[_0x86fc('0xec')],_0x3f9e78[_0x86fc('0x142')]);}}};Preview[_0x86fc('0x12')]['syncDialEnd']=function(_0x19211b){if(this[_0x86fc('0x6a')][_0x19211b[_0x86fc('0xef')]]&&_0x19211b[_0x86fc('0xef')]!==_0x19211b['destuniqueid']){this[_0x86fc('0x143')](_0x19211b,_0x19211b[_0x86fc('0xef')],_0x19211b['dialstatus']);}};Preview[_0x86fc('0x12')][_0x86fc('0x21')]=function(_0x4fafe9){if(this[_0x86fc('0x6a')][_0x4fafe9[_0x86fc('0xec')]]&&_0x4fafe9['linkedid']!==_0x4fafe9[_0x86fc('0xbc')]&&!this[_0x86fc('0x6a')][_0x4fafe9[_0x86fc('0xec')]]['dialAnswer']){if(_0x4fafe9[_0x86fc('0x142')]==='1'){this[_0x86fc('0x143')](_0x4fafe9,_0x4fafe9[_0x86fc('0xec')],_0x4fafe9[_0x86fc('0x142')]);}}};Preview[_0x86fc('0x12')][_0x86fc('0x14b')]=function(_0xf63661,_0x4b8769,_0x1e2415){if(this[_0x86fc('0x6a')][_0xf63661]){if(_['isNil'](this[_0x86fc('0x6a')][_0xf63661][_0x86fc('0x14c')])){this[_0x86fc('0x6a')][_0xf63661][_0x86fc('0x14c')]={};}this['actions'][_0xf63661][_0x86fc('0x14c')][_0x4b8769]=_0x1e2415;}};Preview[_0x86fc('0x12')][_0x86fc('0x14d')]=function(_0x1ac919){try{if(!_[_0x86fc('0x69')](_0x1ac919)){if(ut[_0x86fc('0x14e')](_[_0x86fc('0x14f')](_0x1ac919['variable'])[0x0])){this[_0x86fc('0x14b')](_0x1ac919['uniqueid'],_[_0x86fc('0x14f')](_0x1ac919[_0x86fc('0x150')])[0x0],_0x1ac919[_0x86fc('0x151')]);}}}catch(_0x34a270){logger[_0x86fc('0x152')](_0x86fc('0x153'),util[_0x86fc('0x154')](_0x34a270,{'showHidden':![],'depth':null}));}};Preview[_0x86fc('0x12')][_0x86fc('0x155')]=function(_0x33839b){if(_0x33839b){if(this['actions'][_0x33839b[_0x86fc('0x156')]]){this[_0x86fc('0x6a')][_0x33839b[_0x86fc('0x156')]][_0x86fc('0x149')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xdc40f2){if(_0xdc40f2){if(this[_0x86fc('0x6a')][_0xdc40f2[_0x86fc('0x157')]]){this[_0x86fc('0x6a')][_0xdc40f2[_0x86fc('0x157')]][_0x86fc('0x149')]=!![];}}};module[_0x86fc('0x158')]=Preview; \ No newline at end of file +var _0xc134=['dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','dialActive','recallMe','clearZombieChannel','isNil','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','UserId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','format','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','checkInBlack','VoiceQueueId','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','active','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','Contact','phone','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest'];(function(_0x403d9a,_0x4fd7ae){var _0xdbdaa2=function(_0x1da24a){while(--_0x1da24a){_0x403d9a['push'](_0x403d9a['shift']());}};_0xdbdaa2(++_0x4fd7ae);}(_0xc134,0x12a));var _0x4c13=function(_0x57204b,_0x5be145){_0x57204b=_0x57204b-0x0;var _0x2fa49c=_0xc134[_0x57204b];return _0x2fa49c;};'use strict';var util=require(_0x4c13('0x0'));var _=require(_0x4c13('0x1'));var BPromise=require(_0x4c13('0x2'));var uuid=require(_0x4c13('0x3'));var moment=require('moment');var md5=require(_0x4c13('0x4'));var Redis=require(_0x4c13('0x5'));var config=require(_0x4c13('0x6'));var logger=require(_0x4c13('0x7'))(_0x4c13('0x8'));var loggerAction=require('../../../config/logger')(_0x4c13('0x9'));var ami=require('../ami');var rpcDb=require(_0x4c13('0xa'));var Action=require(_0x4c13('0xb'));var ut=require(_0x4c13('0xc'));config['redis']=_[_0x4c13('0xd')](config[_0x4c13('0xe')],{'host':_0x4c13('0xf'),'port':0x18eb});var io=require(_0x4c13('0x10'))(new Redis(config[_0x4c13('0xe')]));var Sequence=function(){};Sequence[_0x4c13('0x11')][_0x4c13('0x12')]=function(_0xa20bac){this[_0x4c13('0x13')]=this[_0x4c13('0x13')]?this['tail'][_0x4c13('0x14')](_0xa20bac):_0xa20bac();};function Preview(_0x5b46df){this[_0x4c13('0x15')]=new Sequence();this[_0x4c13('0x16')]=_0x5b46df[_0x4c13('0x17')];this[_0x4c13('0x18')]=_0x5b46df['trunks'];this[_0x4c13('0x19')]={};this[_0x4c13('0x1a')]=_0x5b46df[_0x4c13('0x1a')];this[_0x4c13('0x1b')]=0x0;ami['on'](_0x4c13('0x1c'),this[_0x4c13('0x1d')][_0x4c13('0x1e')](this));ami['on']('hangup',this[_0x4c13('0x1f')][_0x4c13('0x1e')](this));ami['on'](_0x4c13('0x20'),this[_0x4c13('0x21')]['bind'](this));ami['on'](_0x4c13('0x22'),this[_0x4c13('0x23')]['bind'](this));ami['on'](_0x4c13('0x24'),this[_0x4c13('0x25')]['bind'](this));ami['on'](_0x4c13('0x26'),this['syncVarSet'][_0x4c13('0x1e')](this));ami['on'](_0x4c13('0x27'),this[_0x4c13('0x28')][_0x4c13('0x1e')](this));ami['on'](_0x4c13('0x29'),this[_0x4c13('0x2a')][_0x4c13('0x1e')](this));this[_0x4c13('0x2b')](this[_0x4c13('0x16')]);}function emit(_0x4c8119,_0x3a5d40,_0x4bc799){io['to'](_0x4c8119)[_0x4c13('0x2c')](_0x3a5d40,_0x4bc799);}function emitCampaignPreview(_0xae704f){if(_0xae704f[_0x4c13('0x2d')]===_0x4c13('0x2e')){var _0x5d6207={'id':_0xae704f['id'],'name':_0xae704f[_0x4c13('0x2f')],'strategy':_0xae704f[_0x4c13('0x30')],'answered':_0xae704f['answered'],'available':_0xae704f[_0x4c13('0x31')],'loggedIn':_0xae704f[_0x4c13('0x32')],'pTalking':_0xae704f[_0x4c13('0x33')],'sumBillable':_0xae704f[_0x4c13('0x34')],'sumDuration':_0xae704f[_0x4c13('0x35')],'sumHoldTime':_0xae704f[_0x4c13('0x36')]||0x0,'talking':_0xae704f[_0x4c13('0x37')],'total':_0xae704f[_0x4c13('0x38')],'type':_0xae704f['type'],'unmanaged':_0xae704f[_0x4c13('0x39')],'abandoned':_0xae704f['abandoned'],'waiting':_0xae704f[_0x4c13('0x3a')],'loggedInDb':_0xae704f['loggedInDb'],'dialActive':_0xae704f['dialActive'],'dialMethod':_0xae704f['dialMethod'],'dialOriginateCallerIdName':_0xae704f[_0x4c13('0x3b')],'dialOriginateCallerIdNumber':_0xae704f[_0x4c13('0x3c')],'dialOriginateTimeout':_0xae704f['dialOriginateTimeout'],'dialPrefix':_0xae704f['dialPrefix'],'outboundAnswerAgiCallsDay':_0xae704f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xae704f[_0x4c13('0x3d')],'outboundBlacklistCallsDay':_0xae704f[_0x4c13('0x3e')],'outboundBusyCallsDay':_0xae704f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xae704f[_0x4c13('0x3f')],'outboundDropCallsDayACS':_0xae704f[_0x4c13('0x40')],'outboundDropCallsDayCallersExit':_0xae704f[_0x4c13('0x41')],'outboundDropCallsDayTimeout':_0xae704f[_0x4c13('0x42')],'outboundNoAnswerCallsDay':_0xae704f[_0x4c13('0x43')],'outboundNoSuchCallsDay':_0xae704f[_0x4c13('0x44')],'outboundOriginateFailureCallsDay':_0xae704f[_0x4c13('0x45')],'outboundReCallsDay':_0xae704f[_0x4c13('0x46')],'outboundRejectCallsDay':_0xae704f[_0x4c13('0x47')],'outboundUnknownCallsDay':_0xae704f[_0x4c13('0x48')],'outboundAbandonedCallsDay':_0xae704f[_0x4c13('0x49')],'predictiveIntervalAnsweredCalls':_0xae704f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xae704f[_0x4c13('0x4a')],'predictiveIntervalAvgTalktime':_0xae704f[_0x4c13('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0xae704f[_0x4c13('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0xae704f[_0x4c13('0x4d')],'predictiveIntervalErlangCalls':_0xae704f[_0x4c13('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0xae704f[_0x4c13('0x4f')],'predictiveIntervalHitRate':_0xae704f[_0x4c13('0x50')],'predictiveIntervalMultiplicativeFactor':_0xae704f[_0x4c13('0x51')],'predictiveIntervalPauses':_0xae704f[_0x4c13('0x52')],'predictiveIntervalAvailable':_0xae704f['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xae704f['predictiveIntervalTotalCalls'],'message':_0xae704f[_0x4c13('0x53')],'originated':_0xae704f[_0x4c13('0x54')],'erlangCalls':_0xae704f[_0x4c13('0x55')],'erlangCallToSecond':_0xae704f[_0x4c13('0x56')],'erlangAbandonmentRate':_0xae704f[_0x4c13('0x57')],'erlangBusyFactor':_0xae704f[_0x4c13('0x58')],'startPredictive':_0xae704f[_0x4c13('0x59')],'startProgressive':_0xae704f[_0x4c13('0x5a')]};if(_0xae704f[_0x4c13('0x5b')]){_0x5d6207[_0x4c13('0x5b')]={'id':_0xae704f[_0x4c13('0x5b')]['id'],'name':_0xae704f[_0x4c13('0x5b')][_0x4c13('0x2f')],'active':_0xae704f['Trunk']['active'],'callerid':_0xae704f['Trunk'][_0x4c13('0x5c')]};}if(_0xae704f['Interval']){_0x5d6207['Interval']={'id':_0xae704f['Interval']['id'],'name':_0xae704f['Interval'][_0x4c13('0x2f')]};}var _0x25d0b5=md5(JSON['stringify'](_0x5d6207));if(_0xae704f[_0x4c13('0x4')]!==_0x25d0b5){_0xae704f[_0x4c13('0x4')]=_0x25d0b5;emit(util['format']('voice:queue:%s',_0x5d6207[_0x4c13('0x2f')]),_0x4c13('0x5d'),_0x5d6207);}}}function emitVoiceQueueChannelRemove(_0x1c2909){logger[_0x4c13('0x5e')](_0x4c13('0x5f'),JSON[_0x4c13('0x60')](_0x1c2909));emit(util['format']('voice:queue:%s',_0x1c2909[_0x4c13('0x2f')]),_0x4c13('0x61'),_0x1c2909);}function notSendMessagesQueue(_0x2f2743){if(_0x2f2743[_0x4c13('0x62')]){if(_0x2f2743[_0x4c13('0x54')]===0x0&&_0x2f2743[_0x4c13('0x33')]===0x0){_0x2f2743['sendMessageOneNotActive']=![];_0x2f2743['available']=0x0;_0x2f2743['paused']=0x0;_0x2f2743[_0x4c13('0x53')]=_0x4c13('0x63');ut[_0x4c13('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2f2743[_0x4c13('0x2f')]+_0x4c13('0x65'));}else{_0x2f2743[_0x4c13('0x53')]=_0x4c13('0x66');ut[_0x4c13('0x64')](_0x4c13('0x67'),_0x2f2743['name']+_0x4c13('0x68'));}emitCampaignPreview(_0x2f2743);}}Preview[_0x4c13('0x11')][_0x4c13('0x2b')]=function(){var _0x812671=this;setInterval(function(){_0x812671[_0x4c13('0x69')]();},0x7cf);};Preview[_0x4c13('0x11')][_0x4c13('0x69')]=function(){var _0x53354e=this[_0x4c13('0x16')];this[_0x4c13('0x1b')]+=0x1;for(var _0x1155c9 in _0x53354e){if(_0x53354e[_0x4c13('0x6a')](_0x1155c9)&&(_0x53354e[_0x1155c9][_0x4c13('0x6b')]==='preview'||_0x53354e[_0x1155c9][_0x4c13('0x6b')]==='booked')&&_0x53354e[_0x1155c9][_0x4c13('0x2d')]===_0x4c13('0x2e')){if(this[_0x4c13('0x1b')]>0x7){this[_0x4c13('0x1b')]=0x0;this[_0x4c13('0x6c')]();}}if(_0x53354e[_0x4c13('0x6a')](_0x1155c9)&&_0x53354e[_0x1155c9][_0x4c13('0x6b')]===_0x4c13('0x8')&&_0x53354e[_0x1155c9]['type']==='outbound'){if(_0x53354e[_0x1155c9][_0x4c13('0x6d')]){this['setMessage'](_0x53354e[_0x1155c9]);this[_0x4c13('0x6e')](_0x53354e[_0x1155c9]);}else{notSendMessagesQueue(_0x53354e[_0x1155c9]);}}}};Preview['prototype'][_0x4c13('0x6f')]=function(_0x406611){var _0x86e9a=this;this['sequence'][_0x4c13('0x12')](function(){if(!_[_0x4c13('0x70')](_0x86e9a[_0x4c13('0x19')][_0x406611])){loggerAction[_0x4c13('0x5e')]('[clearZombieChannels][talking]',_0x406611,_0x4c13('0x71'),_0x86e9a[_0x4c13('0x19')][_0x406611]['queue'],_0x4c13('0x72'),JSON['stringify'](_0x86e9a[_0x4c13('0x16')][_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x73')]]['originated']),_0x4c13('0x74'),JSON[_0x4c13('0x60')](_0x86e9a[_0x4c13('0x16')][_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x73')]][_0x4c13('0x33')]),JSON[_0x4c13('0x60')](_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x75')]),JSON[_0x4c13('0x60')](_[_0x4c13('0x76')](_0x86e9a[_0x4c13('0x19')][_0x406611],['contactId',_0x4c13('0x77'),'VoiceQueueId',_0x4c13('0x78')])));return ami[_0x4c13('0x79')]({'action':_0x4c13('0x7a'),'channel':_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x7b')]})[_0x4c13('0x7c')](function(_0x2ad950){if(_0x2ad950[_0x4c13('0x53')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x86e9a[_0x4c13('0x19')][_0x406611]){ut[_0x4c13('0x7d')](_0x86e9a[_0x4c13('0x16')][_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x73')]],_0x4c13('0x7e'));if(_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x75')]===!![]){ut['decrementTalkink'](_0x86e9a[_0x4c13('0x16')][_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x73')]],_0x4c13('0x7e'));ut[_0x4c13('0x7f')](_0x4c13('0x80')+_0x406611,_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x73')]);}ut[_0x4c13('0x7f')](_0x4c13('0x81')+_0x406611,_0x86e9a[_0x4c13('0x19')][_0x406611][_0x4c13('0x73')]);delete _0x86e9a['actions'][_0x406611];}},0x2328);}});}});};Preview[_0x4c13('0x11')][_0x4c13('0x6c')]=function(){var _0x2c667f=this;loggerAction[_0x4c13('0x5e')](_0x4c13('0x82'),_[_0x4c13('0x83')](this['actions']));for(var _0x214f0b in this['actions']){if(_0x2c667f['actions']['hasOwnProperty'](_0x214f0b)){_0x2c667f[_0x4c13('0x6f')](_0x214f0b);}}};Preview[_0x4c13('0x11')][_0x4c13('0x6e')]=function(_0x793eb7){var _0x5eeb1f=this;rpcDb['getContactRecallMe'](_0x793eb7['id'],ut['agentReadyId'](this[_0x4c13('0x1a')]))[_0x4c13('0x84')](function(_0x57249d){if(!_[_0x4c13('0x70')](_0x57249d)){for(var _0x38d26e=0x0;_0x38d26e<_0x57249d[_0x4c13('0x85')];_0x38d26e+=0x1){if(ut[_0x4c13('0x86')](_0x57249d[_0x38d26e][_0x4c13('0x87')])<_0x793eb7[_0x4c13('0x88')]*0x3c){if(_0x57249d[_0x38d26e][_0x4c13('0x89')]&&!_0x57249d[_0x38d26e][_0x4c13('0x89')]['voicePause']){_0x5eeb1f[_0x4c13('0x8a')](_0x57249d[_0x38d26e]['id'])[_0x4c13('0x84')](ut[_0x4c13('0x8b')](_0x4c13('0x8c')))[_0x4c13('0x7c')](ut[_0x4c13('0x8b')](_0x4c13('0x8c')));}else{rpcDb[_0x4c13('0x8d')](_0x57249d[_0x38d26e]['id']);}}else{var _0x48b6d9=new Action(_0x57249d[_0x38d26e],_0x793eb7);_0x48b6d9['starttime']=moment()[_0x4c13('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x793eb7['outboundReCallsDay']+=0x1;ut[_0x4c13('0x8f')](_0x48b6d9,0x17,'RecallInQueue');if(_0x793eb7[_0x4c13('0x90')]){rpcDb[_0x4c13('0x91')](ut[_0x4c13('0x92')](_0x57249d[_0x38d26e]));rpcDb[_0x4c13('0x93')](_0x48b6d9,_0x4c13('0x94'));}else{ut['logCustomer'](_0x48b6d9,0x16,_0x4c13('0x95'));rpcDb[_0x4c13('0x93')](_0x48b6d9,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x48b6d9,_0x4c13('0x96'));}}}}})[_0x4c13('0x7c')](ut[_0x4c13('0x8b')](_0x4c13('0x97')));};Preview['prototype']['setMessage']=function(_0x422147){_0x422147[_0x4c13('0x62')]=!![];if(ut[_0x4c13('0x98')](_0x422147[_0x4c13('0x32')])){_0x422147[_0x4c13('0x53')]=_0x4c13('0x99');}else if(!ut['isActive'](_0x422147[_0x4c13('0x6d')])){_0x422147[_0x4c13('0x53')]='NOT_ACTIVE';}else if(!this[_0x4c13('0x9a')](_0x422147[_0x4c13('0x5b')])){if(!this[_0x4c13('0x9a')](_0x422147[_0x4c13('0x9b')])){_0x422147[_0x4c13('0x53')]=_0x4c13('0x9c');}else{_0x422147['message']=_0x4c13('0x9d');}}else{_0x422147[_0x4c13('0x53')]=_0x4c13('0x9d');}emitCampaignPreview(_0x422147);};Preview[_0x4c13('0x11')][_0x4c13('0x9e')]=function(_0xb5bbae,_0x4637aa,_0x1ed743){var _0x196ee2=this;var _0x2c74a1=this[_0x4c13('0x19')][_0x4637aa];var _0x22a984=this['campaignsPreview'][_0x2c74a1[_0x4c13('0x73')]];var _0x29e007;if(_0x22a984){switch(_0x1ed743){case'1':_0x22a984[_0x4c13('0x44')]+=0x1;_0x2c74a1['countnosuchnumberretry']+=0x1;_0x2c74a1[_0x4c13('0x9f')]=ut[_0x4c13('0xa0')](_0x2c74a1);ut['logCustomer'](_0x2c74a1,0x0,_0x4c13('0xa1'));ami[_0x4c13('0x2c')](_0x4c13('0xa2'),ut[_0x4c13('0xa3')](_0x2c74a1,_0x4c13('0xa4')));rpcDb[_0x4c13('0x93')](_0x2c74a1,_0x4c13('0xa5'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984[_0x4c13('0xa6')]){_0x29e007=ut[_0x4c13('0xa7')](_0x2c74a1,0xf,_0x4c13('0xa8'));rpcDb['createCustomerFinal'](_0x29e007,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2c74a1['countnosuchnumberretry']>=_0x22a984[_0x4c13('0xa9')]){rpcDb[_0x4c13('0xaa')](_0x2c74a1,_0x4c13('0xab'));}else{rpcDb[_0x4c13('0xac')](ut[_0x4c13('0xad')](_0x2c74a1,_0x4c13('0xae'),_0x22a984[_0x4c13('0xaf')]),_0x2c74a1[_0x4c13('0xb0')],_0x2c74a1[_0x4c13('0xb1')]);}}delete this[_0x4c13('0x19')][_0xb5bbae[_0x4c13('0xb2')]];break;case'ANSWER':var _0x259e04=moment()[_0x4c13('0x8e')](_0x4c13('0xb3'));_0x2c74a1[_0x4c13('0xb4')]=_0x259e04;_0x2c74a1['answertime']=_0x259e04;_0x2c74a1[_0x4c13('0x75')]=!![];_0x22a984[_0x4c13('0x33')]+=0x1;logger['info'](_0x4c13('0xb5'),_0x2c74a1[_0x4c13('0xb6')],_0x4c13('0xb7'),_0x22a984[_0x4c13('0x2f')],_0x4c13('0x74'),_0x22a984[_0x4c13('0x33')]);ami[_0x4c13('0x2c')]('custom:agentconnect',ut[_0x4c13('0xa3')](_0x2c74a1,'connect'));if(_0x22a984[_0x4c13('0xb8')]){ami[_0x4c13('0x2c')](_0x4c13('0xb9'),ut[_0x4c13('0xba')](_0x2c74a1));}break;case'16':ami[_0x4c13('0x2c')](_0x4c13('0xbb'),ut[_0x4c13('0xa3')](_0x2c74a1,_0x4c13('0xbc')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2c74a1,_0x4c13('0xbc')));_0x22a984['outboundAnswerCallsDay']+=0x1;_0x22a984[_0x4c13('0x38')]+=0x1;_0x22a984[_0x4c13('0xbd')]+=0x1;ut[_0x4c13('0xbe')](_0x22a984,_0x4c13('0xbf'));_0x2c74a1[_0x4c13('0x9f')]=ut['totalGlobal'](_0x2c74a1);ut['logCustomer'](_0x2c74a1,0x4,'Answer');rpcDb[_0x4c13('0x93')](_0x2c74a1,_0x4c13('0xc0'));rpcDb[_0x4c13('0xaa')](_0x2c74a1,_0x4c13('0xc1'));rpcDb[_0x4c13('0xc2')](_0x2c74a1);_0x22a984[_0x4c13('0x35')]+=_0x2c74a1[_0x4c13('0xc3')];_0x22a984[_0x4c13('0x34')]+=_0x2c74a1['talktime'];logger[_0x4c13('0x5e')]('[syncHangup][talking][decrement]',_0x2c74a1[_0x4c13('0xb6')],'\x20Queue',_0x22a984['name'],_0x4c13('0x74'),_0x22a984[_0x4c13('0x33')]);delete this['actions'][_0xb5bbae[_0x4c13('0xb2')]];break;case _0x4c13('0xc4'):_0x22a984['outboundBusyCallsDay']+=0x1;_0x2c74a1['countbusyretry']+=0x1;_0x2c74a1[_0x4c13('0x9f')]=ut[_0x4c13('0xa0')](_0x2c74a1);ut[_0x4c13('0x8f')](_0x2c74a1,0x5,_0x4c13('0xc5'));ami[_0x4c13('0x2c')]('custom:agentbusy',ut[_0x4c13('0xa3')](_0x2c74a1,_0x4c13('0xc6')));rpcDb[_0x4c13('0x93')](_0x2c74a1,_0x4c13('0xc7'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984[_0x4c13('0xa6')]){_0x29e007=ut['cloneAction'](_0x2c74a1,0xf,_0x4c13('0xa8'));rpcDb[_0x4c13('0xaa')](_0x29e007,_0x4c13('0xc8'));}else{if(_0x2c74a1[_0x4c13('0xc9')]>=_0x22a984[_0x4c13('0xca')]){rpcDb['createCustomerFinal'](_0x2c74a1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x4c13('0xad')](_0x2c74a1,_0x4c13('0xc9'),_0x22a984[_0x4c13('0xcb')]),_0x2c74a1[_0x4c13('0xb0')],_0x2c74a1[_0x4c13('0xb1')]);}}break;case _0x4c13('0xcc'):_0x22a984['outboundNoAnswerCallsDay']+=0x1;_0x2c74a1[_0x4c13('0xcd')]+=0x1;_0x2c74a1['countglobal']=ut[_0x4c13('0xa0')](_0x2c74a1);ut[_0x4c13('0x8f')](_0x2c74a1,0x3,_0x4c13('0xce'));ami[_0x4c13('0x2c')](_0x4c13('0xcf'),ut[_0x4c13('0xa3')](_0x2c74a1,_0x4c13('0xd0')));rpcDb[_0x4c13('0x93')](_0x2c74a1,_0x4c13('0xd1'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984['dialGlobalMaxRetry']){_0x29e007=ut[_0x4c13('0xa7')](_0x2c74a1,0xf,'Global');rpcDb[_0x4c13('0xaa')](_0x29e007,_0x4c13('0xd2'));}else{if(_0x2c74a1[_0x4c13('0xcd')]>=_0x22a984[_0x4c13('0xd3')]){rpcDb[_0x4c13('0xaa')](_0x2c74a1,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x4c13('0xac')](ut[_0x4c13('0xad')](_0x2c74a1,_0x4c13('0xcd'),_0x22a984[_0x4c13('0xd4')]),_0x2c74a1[_0x4c13('0xb0')],_0x2c74a1['activeContact']);}}break;case'CONGESTION':_0x22a984[_0x4c13('0x3f')]+=0x1;_0x2c74a1[_0x4c13('0xd5')]+=0x1;_0x2c74a1[_0x4c13('0x9f')]=ut['totalGlobal'](_0x2c74a1);ut[_0x4c13('0x8f')](_0x2c74a1,0x8,'Congestion');ami[_0x4c13('0x2c')](_0x4c13('0xd6'),ut['buildObj'](_0x2c74a1,_0x4c13('0xd7')));rpcDb[_0x4c13('0x93')](_0x2c74a1,_0x4c13('0xd8'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984[_0x4c13('0xa6')]){_0x29e007=ut['cloneAction'](_0x2c74a1,0xf,_0x4c13('0xa8'));rpcDb[_0x4c13('0xaa')](_0x29e007,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2c74a1[_0x4c13('0xd5')]>=_0x22a984['dialCongestionMaxRetry']){rpcDb[_0x4c13('0xaa')](_0x2c74a1,_0x4c13('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0x4c13('0xad')](_0x2c74a1,_0x4c13('0xd5'),_0x22a984[_0x4c13('0xcb')]),_0x2c74a1[_0x4c13('0xb0')],_0x2c74a1[_0x4c13('0xb1')]);}}break;case _0x4c13('0xd9'):_0x22a984[_0x4c13('0x47')]+=0x1;_0x2c74a1[_0x4c13('0xda')]+=0x1;_0x2c74a1[_0x4c13('0x9f')]=ut[_0x4c13('0xa0')](_0x2c74a1);ut['logCustomer'](_0x2c74a1,0x14,_0x4c13('0xdb'));ami['emit'](_0x4c13('0xdc'),ut['buildObj'](_0x2c74a1,_0x4c13('0xdd')));rpcDb['createCustomerHistory'](_0x2c74a1,_0x4c13('0xde'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984[_0x4c13('0xa6')]){_0x29e007=ut['cloneAction'](_0x2c74a1,0x14,_0x4c13('0xdb'));rpcDb[_0x4c13('0xaa')](_0x29e007,_0x4c13('0xdf'));}else{if(_0x2c74a1[_0x4c13('0xda')]>=_0x22a984[_0x4c13('0xe0')]){rpcDb[_0x4c13('0xaa')](_0x2c74a1,_0x4c13('0xdf'));}else{rpcDb[_0x4c13('0xac')](ut[_0x4c13('0xad')](_0x2c74a1,_0x4c13('0xda'),_0x22a984[_0x4c13('0xe1')]),_0x2c74a1['unlockAgent'],_0x2c74a1['activeContact']);}}break;case'ABANDONED':_0x22a984[_0x4c13('0x49')]+=0x1;_0x2c74a1[_0x4c13('0xe2')]+=0x1;_0x2c74a1[_0x4c13('0x9f')]=ut[_0x4c13('0xa0')](_0x2c74a1);ut[_0x4c13('0x8f')](_0x2c74a1,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x2c74a1,_0x4c13('0xe3'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984[_0x4c13('0xa6')]){_0x29e007=ut['cloneAction'](_0x2c74a1,0xf,_0x4c13('0xa8'));rpcDb[_0x4c13('0xaa')](_0x29e007,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2c74a1['countabandonedetry']>=_0x22a984[_0x4c13('0xe4')]){rpcDb['createCustomerFinal'](_0x2c74a1,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x4c13('0xac')](ut['scheduledAt'](_0x2c74a1,_0x4c13('0xe2'),_0x22a984[_0x4c13('0xe5')]),_0x2c74a1['unlockAgent'],_0x2c74a1[_0x4c13('0xb1')]);}}break;default:if(_0x2c74a1[_0x4c13('0x75')]){ut[_0x4c13('0xbe')](_0x22a984,_0x4c13('0xe6'));ut['loggerError'](_0x4c13('0xe7')+_0x22a984[_0x4c13('0x2f')],_0xb5bbae);}_0x22a984[_0x4c13('0x48')]+=0x1;_0x2c74a1[_0x4c13('0x9f')]=ut['totalGlobal'](_0x2c74a1);ut['logCustomer'](_0x2c74a1,0xc,_0xb5bbae[_0x4c13('0xe8')]||_0xb5bbae[_0x4c13('0xe9')]);rpcDb[_0x4c13('0x93')](_0x2c74a1,_0x4c13('0xea'));if(ut[_0x4c13('0xa0')](_0x2c74a1)>=_0x22a984[_0x4c13('0xa6')]){_0x29e007=ut[_0x4c13('0xa7')](_0x2c74a1,0xf,_0x4c13('0xa8'));rpcDb[_0x4c13('0xaa')](_0x29e007,_0x4c13('0xeb'));}else{rpcDb['createCustomerFinal'](_0x2c74a1,_0x4c13('0xeb'));}delete this[_0x4c13('0x19')][_0xb5bbae[_0x4c13('0xb2')]];}if(!(_0x2c74a1[_0x4c13('0x75')]&&_0x1ed743==='16')){ut[_0x4c13('0x7d')](_0x22a984,_0x4c13('0xec'));logger['info'](_0x4c13('0xed'),_0x2c74a1[_0x4c13('0xb6')],_0x4c13('0xb7'),_0x22a984[_0x4c13('0x2f')],'originated:\x20',_0x22a984[_0x4c13('0x54')]);}if(_0x1ed743!==_0x4c13('0xee')){delete this['actions'][_0xb5bbae[_0x4c13('0xb2')]];delete this['actions'][_0xb5bbae[_0x4c13('0xef')]];}}};Preview['prototype'][_0x4c13('0xf0')]=function(_0x376fdc,_0x22ef84,_0x1a7b12){if(_[_0x4c13('0xf1')](_0x22ef84)&&_0x4c13('0xf2')!==typeof _0x22ef84){return;}if(_[_0x4c13('0xf1')](_0x1a7b12)&&_0x4c13('0xf2')!==typeof _0x1a7b12){return;}switch(_0x1a7b12[_0x4c13('0xf3')]){case'0':ut[_0x4c13('0xf4')](_0x376fdc,0x0,_0x4c13('0xa1'));rpcDb[_0x4c13('0xf5')](_0x376fdc,_0x4c13('0xf6'));break;case'3':ut['logAgent'](_0x376fdc,0x3,_0x4c13('0xce'));rpcDb[_0x4c13('0xf5')](_0x376fdc,_0x4c13('0xf7'));break;case'5':ut[_0x4c13('0xf4')](_0x376fdc,0x5,_0x4c13('0xc5'));rpcDb[_0x4c13('0xf5')](_0x376fdc,_0x4c13('0xf8'));break;case'8':ut['logAgent'](_0x376fdc,0x8,_0x4c13('0xf9'));rpcDb[_0x4c13('0xf5')](_0x376fdc,_0x4c13('0xfa'));break;case'22':ut[_0x4c13('0xf4')](_0x376fdc,0x16,_0x4c13('0xfb'));rpcDb['createAgentHistory'](_0x376fdc,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x4c13('0xf4')](_0x376fdc,0xc,_0x1a7b12[_0x4c13('0xf3')]);rpcDb[_0x4c13('0xf5')](_0x376fdc,_0x4c13('0xfa'));}ut[_0x4c13('0x7d')](_0x22ef84,_0x4c13('0xfc'));logger[_0x4c13('0x5e')]('[originated][decrement][callProgressDetectingAgent]',_0x376fdc[_0x4c13('0xb6')],_0x4c13('0xb7'),_0x22ef84[_0x4c13('0x2f')],'originated:\x20',_0x22ef84['originated']);delete this['actions'][_0x376fdc[_0x4c13('0xb6')]];};Preview[_0x4c13('0x11')][_0x4c13('0xfd')]=function(_0x1c6602,_0x5a48ba,_0x1f0f5f,_0x32d476,_0x3d3909){var _0x174bb3=this;return new BPromise(function(_0x26cba9,_0x24fcb2){if(_[_0x4c13('0x70')](_0x5a48ba)||_[_0x4c13('0x70')](_0x5a48ba['Contact'])||_[_0x4c13('0x70')](_0x5a48ba['Contact']['phone'])||_[_0x4c13('0x70')](_0x5a48ba[_0x4c13('0xfe')])){_0x24fcb2(ut[_0x4c13('0x53')]('Contact\x20is\x20undefined',_0x32d476,_0x3d3909));return;}var _0x69d47a=uuid['v4']();var _0x50e940=_0x174bb3[_0x4c13('0x16')][_0x5a48ba[_0x4c13('0x71')]['name']];var _0x289d84=_0x1f0f5f?_0x174bb3['agents'][_0x1f0f5f]['id']:undefined;_0x174bb3[_0x4c13('0x19')][_0x69d47a]=new Action(_0x5a48ba,_0x50e940,_0x69d47a,_0x1f0f5f,_0x289d84);var _0x363bc7=_0x174bb3[_0x4c13('0x19')][_0x69d47a];_0x363bc7[_0x4c13('0xb0')]=_0x32d476;_0x363bc7[_0x4c13('0xb1')]=_0x3d3909;_0x363bc7[_0x4c13('0xff')]=_0x1f0f5f;if(_[_0x4c13('0x100')](_0x1c6602)){_0x174bb3[_0x4c13('0x101')](_0x363bc7,_0x50e940,_0x5a48ba,_0x1f0f5f)[_0x4c13('0x84')](function(_0x527f4e){logger[_0x4c13('0x5e')]('[Preview][execCall][success]',_0x4c13('0x102')+_0x363bc7[_0x4c13('0x73')]+_0x4c13('0x103')+_0x363bc7[_0x4c13('0x104')],JSON[_0x4c13('0x60')](_0x527f4e));ami[_0x4c13('0x2c')]('custom:agentcalled',ut[_0x4c13('0xa3')](_0x363bc7,'called'));_0x26cba9(ut[_0x4c13('0x53')]('Calling'));})[_0x4c13('0x7c')](function(_0x68aee2){ut['logger'](_0x4c13('0x105'),_0x68aee2);_0x24fcb2(ut[_0x4c13('0x53')](_0x4c13('0x106'),_0x32d476,_0x3d3909));});}else{_0x50e940[_0x4c13('0x3e')]+=0x1;ut[_0x4c13('0x107')](_0x363bc7);rpcDb[_0x4c13('0x108')](_0x363bc7,'[Blacklist][error]');delete _0x174bb3[_0x4c13('0x19')][_0x69d47a];_0x24fcb2(ut[_0x4c13('0x53')]('Contact\x20in\x20black\x20List',_0x32d476,_0x3d3909));}});};Preview[_0x4c13('0x11')]['isTrunkReachable']=function(_0x123d82){return!_[_0x4c13('0x70')](_0x123d82)&&!_['isNil'](_0x123d82['name'])&&!_[_0x4c13('0x70')](_0x123d82[_0x4c13('0x109')])&&_0x123d82[_0x4c13('0x109')]&&!_['isNil'](this[_0x4c13('0x18')][util[_0x4c13('0x8e')](_0x4c13('0x10a'),_0x123d82[_0x4c13('0x2f')])])&&!_[_0x4c13('0x70')](this[_0x4c13('0x18')][util['format'](_0x4c13('0x10a'),_0x123d82[_0x4c13('0x2f')])][_0x4c13('0x7a')])&&(this[_0x4c13('0x18')][util[_0x4c13('0x8e')](_0x4c13('0x10a'),_0x123d82[_0x4c13('0x2f')])][_0x4c13('0x7a')]===_0x4c13('0x10b')||this[_0x4c13('0x18')][util['format'](_0x4c13('0x10a'),_0x123d82[_0x4c13('0x2f')])]['status']==='unmonitored');};Preview['prototype']['run']=function(_0x594a58,_0x44e755){var _0x112a5c=this;return new BPromise(function(_0x5ca24b,_0x15b971){_0x112a5c[_0x4c13('0x10c')](_0x594a58,_0x44e755)['then'](function(_0x45175e){_0x5ca24b(_[_0x4c13('0x76')](_0x45175e,['message']));})['catch'](function(_0x5e28fb){if(_0x5e28fb[_0x4c13('0x10d')]){rpcDb[_0x4c13('0x10e')](_0x594a58);}if(_0x5e28fb[_0x4c13('0x109')]){rpcDb[_0x4c13('0x8d')](_0x594a58);}_0x15b971(_['pick'](_0x5e28fb,[_0x4c13('0x53')]));});});};Preview[_0x4c13('0x11')]['execRun']=function(_0x6c10d9,_0x34699e){var _0x463148=this;return new BPromise(function(_0x308e31,_0x28b152){var _0x5823f9,_0x2912c7;rpcDb[_0x4c13('0x10f')](_0x6c10d9)[_0x4c13('0x84')](function(_0x5c2ea1){if(!_[_0x4c13('0x70')](_0x5c2ea1[0x0])){_0x2912c7=_0x5c2ea1[0x0][_0x4c13('0x110')]?![]:!![];_0x5823f9=_0x5c2ea1[0x0]['recallme']?!![]:![];_0x5823f9=_0x34699e?!![]:_0x5823f9;}var _0x12e324=_0x463148[_0x4c13('0x111')](_0x5c2ea1);if(_0x12e324['isValid']){rpcDb[_0x4c13('0x112')](_[_0x4c13('0x76')](_0x5c2ea1[0x0],[_0x4c13('0xfe'),_0x4c13('0x113')]))[_0x4c13('0x84')](function(_0x191ddc){_0x463148['checkInBlack'](_0x191ddc,_0x5c2ea1[0x0],_0x34699e,_0x2912c7,_0x5823f9)[_0x4c13('0x84')](function(_0x1d0eae){_0x308e31(_0x1d0eae);})[_0x4c13('0x7c')](function(_0x6dab95){_0x28b152(_0x6dab95);});})[_0x4c13('0x7c')](function(_0x4f612a){ut[_0x4c13('0x64')](_0x4c13('0x114'),_0x4f612a);_0x28b152(ut[_0x4c13('0x53')](_0x4c13('0x115'),_0x2912c7,_0x5823f9));});}else{_0x28b152(ut[_0x4c13('0x53')](_0x12e324[_0x4c13('0x53')],_0x2912c7,_0x5823f9));}})[_0x4c13('0x7c')](function(_0x1c54d2){ut[_0x4c13('0x64')](_0x4c13('0x116'),_0x1c54d2);_0x28b152(ut['message'](_0x4c13('0x115'),![],!![]));});});};Preview[_0x4c13('0x11')][_0x4c13('0x111')]=function(_0x40adf5){if(_[_0x4c13('0x70')](_0x40adf5)||_[_0x4c13('0x100')](_0x40adf5)||!_[_0x4c13('0x70')](_0x40adf5[0x0][_0x4c13('0x89')])&&_['isNil'](_0x40adf5[0x0][_0x4c13('0x89')]['name'])){ut[_0x4c13('0x64')]('[Preview][validateContact][Empty\x20Contact]',_0x40adf5);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1154bb=this['campaignsPreview'][_0x40adf5[0x0][_0x4c13('0x71')][_0x4c13('0x2f')]];_0x1154bb[_0x4c13('0x53')]=_0x4c13('0x9d');if(_[_0x4c13('0x70')](_0x1154bb)){ut['logger'](_0x4c13('0x117'),_0x1154bb);return{'isValid':![],'message':_0x4c13('0x118')};}if(!this[_0x4c13('0x9a')](_0x1154bb[_0x4c13('0x5b')])){ut[_0x4c13('0x64')](_0x4c13('0x119'),_0x4c13('0x11a')+_0x1154bb[_0x4c13('0x2f')]+_0x4c13('0x11b'));if(!this[_0x4c13('0x9a')](_0x1154bb[_0x4c13('0x9b')])){ut[_0x4c13('0x64')](_0x4c13('0x119'),_0x1154bb[_0x4c13('0x2f')]+_0x4c13('0x11c'));return{'isValid':![],'message':_0x4c13('0x11d')};}}if(!ut[_0x4c13('0x11e')](_0x1154bb[_0x4c13('0x6d')])){ut[_0x4c13('0x64')]('[Preview][validateContact][Campaign\x20Active]',_0x1154bb[_0x4c13('0x2f')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1154bb[_0x4c13('0x2f')]+_0x4c13('0x11f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x4c13('0x11')][_0x4c13('0x101')]=function(_0x389a04,_0x13b018,_0x2f5c0e,_0x44f6bd){var _0x1804a2=this;return new BPromise(function(_0x16100b,_0x2932b0){var _0x435832=_0x389a04[_0x4c13('0xb6')];var _0x3be90c=_0x1804a2[_0x4c13('0x9a')](_0x13b018[_0x4c13('0x5b')])?util[_0x4c13('0x8e')](_0x4c13('0x120'),_0x13b018[_0x4c13('0x5b')][_0x4c13('0x2f')],_['isNil'](_0x13b018[_0x4c13('0x121')])?'':_0x13b018[_0x4c13('0x121')][_0x4c13('0x122')]()||'',_0x13b018[_0x4c13('0x123')]>0x0?_0x2f5c0e[_0x4c13('0x124')]['phone']['substring'](_0x13b018[_0x4c13('0x123')]):_0x2f5c0e[_0x4c13('0x124')][_0x4c13('0x125')]):util[_0x4c13('0x8e')](_0x4c13('0x120'),_[_0x4c13('0x70')](_0x13b018[_0x4c13('0x9b')])?_0x13b018['Trunk'][_0x4c13('0x2f')]:_0x13b018['TrunkBackup'][_0x4c13('0x2f')],_[_0x4c13('0x70')](_0x13b018[_0x4c13('0x121')])?'':_0x13b018['dialPrefix'][_0x4c13('0x122')]()||'',_0x13b018[_0x4c13('0x123')]>0x0?_0x2f5c0e[_0x4c13('0x124')][_0x4c13('0x125')]['substring'](_0x13b018[_0x4c13('0x123')]):_0x2f5c0e['Contact'][_0x4c13('0x125')]);var _0x3d6fbd=_0x1804a2['isTrunkReachable'](_0x13b018[_0x4c13('0x5b')])?ut['getCallerId'](_0x13b018['Trunk'][_0x4c13('0x5c')],_0x13b018[_0x4c13('0x3b')],_0x13b018[_0x4c13('0x126')]>0x0?ut[_0x4c13('0x127')](_0x13b018['dialOriginateCallerIdNumber'],_0x13b018[_0x4c13('0x126')]):_0x13b018[_0x4c13('0x3c')]):ut['getCallerId'](_[_0x4c13('0x70')](_0x13b018[_0x4c13('0x9b')])?_0x13b018[_0x4c13('0x5b')]['callerid']:_0x13b018['TrunkBackup'][_0x4c13('0x5c')],_0x13b018[_0x4c13('0x3b')],_0x13b018[_0x4c13('0x126')]>0x0?ut[_0x4c13('0x127')](_0x13b018[_0x4c13('0x3c')],_0x13b018[_0x4c13('0x126')]):_0x13b018['dialOriginateCallerIdNumber']);if(_0x3d6fbd){_0x389a04[_0x4c13('0x128')]=ut[_0x4c13('0x129')](_0x3d6fbd);_0x389a04[_0x4c13('0x12a')]=ut[_0x4c13('0x12b')](_0x3d6fbd);}var _0x10d115=ut['addVariables'](_0x13b018,_0x2f5c0e,_0x3be90c,_0x3d6fbd,_0x435832,_0x389a04);_[_0x4c13('0x12c')](_0x389a04,ut[_0x4c13('0x12d')](_0x10d115));_0x389a04['starttime']=moment()[_0x4c13('0x8e')](_0x4c13('0xb3'));ami[_0x4c13('0x79')](ut['variablesAction'](_0x389a04,_0x13b018,_0x10d115,_0x389a04[_0x4c13('0xb1')],_0x44f6bd))[_0x4c13('0x84')](function(_0xbeb25d){_0x13b018[_0x4c13('0x54')]+=0x1;logger[_0x4c13('0x5e')]('[originated][increment]',_0x435832,_0x4c13('0xb7'),_0x13b018[_0x4c13('0x2f')],_0x4c13('0x72'),_0x13b018[_0x4c13('0x54')]);_0x16100b(_0xbeb25d);})[_0x4c13('0x7c')](function(_0x51c5f3){ut[_0x4c13('0xf4')](_0x389a04,0xe,'OriginateError');rpcDb[_0x4c13('0xf5')](_0x389a04,_0x4c13('0x12e'));_0x2932b0(_0x51c5f3);});});};Preview['prototype'][_0x4c13('0x25')]=function(_0x3e71d2){if(this[_0x4c13('0x19')][_0x3e71d2[_0x4c13('0xb2')]]){this[_0x4c13('0x19')][_0x3e71d2[_0x4c13('0xb2')]][_0x4c13('0x7b')]=_0x3e71d2[_0x4c13('0x7b')];}};Preview[_0x4c13('0x11')]['syncOriginateResponse']=function(_0x1fbb61){var _0x5c4c57=this;var _0x52834d=this[_0x4c13('0x19')][_0x1fbb61[_0x4c13('0x12f')]];if(_0x52834d){if(_0x52834d[_0x4c13('0xff')]&&this['agents'][_0x52834d[_0x4c13('0xff')]]){ut[_0x4c13('0x130')](_0x52834d,this['agents'][_0x52834d[_0x4c13('0xff')]]['name'],this[_0x4c13('0x1a')][_0x52834d[_0x4c13('0xff')]]['id']);}var _0x5eabcd=_[_0x4c13('0x131')](_0x52834d);_0x5eabcd[_0x4c13('0xb4')]=moment()[_0x4c13('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b2682=_0x5c4c57['campaignsPreview'][_0x52834d[_0x4c13('0x73')]];if(ut[_0x4c13('0x132')](_0x1fbb61[_0x4c13('0x133')])){if(_0x52834d['unlockAgent']){rpcDb[_0x4c13('0x10e')](_0x52834d[_0x4c13('0x104')]);}if(_0x52834d['activeContact']){rpcDb['disableContact'](_0x52834d[_0x4c13('0x104')]);}ami[_0x4c13('0x2c')](_0x4c13('0x134'),ut['buildObj'](_0x52834d,_0x4c13('0x135')));this['callProgressDetectingAgent'](_0x5eabcd,_0x3b2682,_0x1fbb61);}else{_0x52834d[_0x4c13('0x136')]=moment()[_0x4c13('0x8e')](_0x4c13('0xb3'));ut[_0x4c13('0xf4')](_0x5eabcd,0x4,_0x4c13('0x137'));rpcDb['createAgentHistory'](_0x5eabcd,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x4c13('0x11')][_0x4c13('0x1f')]=function(_0x2e8998){var _0x50b23a=this;var _0x414b1c=this[_0x4c13('0x19')][_0x2e8998[_0x4c13('0xb2')]];var _0x1d09c4;if(_0x414b1c){_0x1d09c4=this[_0x4c13('0x16')][_0x414b1c[_0x4c13('0x73')]];logger[_0x4c13('0x5e')](_0x4c13('0x138'),_0x2e8998['linkedid'],_0x4c13('0xb7'),_0x1d09c4[_0x4c13('0x2f')],_0x4c13('0x74'),_0x1d09c4[_0x4c13('0x33')]);}if(this[_0x4c13('0x19')][_0x2e8998[_0x4c13('0xb2')]]&&_0x2e8998['linkedid']!==_0x2e8998[_0x4c13('0xb6')]){if(_0x2e8998[_0x4c13('0x139')]==='16'&&this['actions'][_0x2e8998[_0x4c13('0xb2')]]['dialAnswer']){this[_0x4c13('0x9e')](_0x2e8998,_0x2e8998[_0x4c13('0xb2')],_0x2e8998[_0x4c13('0x139')]);}else if(this[_0x4c13('0x19')][_0x2e8998[_0x4c13('0xb2')]][_0x4c13('0x75')]){logger[_0x4c13('0x5e')](_0x4c13('0x13a'),_0x2e8998[_0x4c13('0xb2')],_0x2e8998[_0x4c13('0x139')],_0x4c13('0xb7'),_0x1d09c4[_0x4c13('0x2f')],_0x4c13('0x74'),_0x1d09c4[_0x4c13('0x33')]);this[_0x4c13('0x9e')](_0x2e8998,_0x2e8998[_0x4c13('0xb2')],_0x2e8998['cause']);}}else if(_0x414b1c&&_[_0x4c13('0x70')](_0x414b1c[_0x4c13('0x13b')])&&_0x1d09c4[_0x4c13('0x13c')]&&_0x2e8998['linkedid']===_0x2e8998[_0x4c13('0xb6')]&&_[_0x4c13('0x70')](_0x2e8998['reason'])&&_0x2e8998[_0x4c13('0x139')]==='16'&&_0x2e8998[_0x4c13('0x13d')]==='6'&&_['isUndefined'](_0x414b1c[_0x4c13('0x13e')])){if(_0x414b1c[_0x4c13('0xb0')]){rpcDb[_0x4c13('0x10e')](_0x414b1c['idContact']);}if(_0x414b1c['activeContact']){rpcDb['disableContact'](_0x414b1c['idContact']);}_0x2e8998[_0x4c13('0xf3')]='22';this['callProgressDetectingAgent'](_0x414b1c,_0x1d09c4,_0x2e8998);}else if(_0x414b1c&&_0x414b1c['transfer']){if(_0x2e8998[_0x4c13('0x139')]==='16'&&this[_0x4c13('0x19')][_0x2e8998[_0x4c13('0xb2')]][_0x4c13('0x75')]){logger[_0x4c13('0x5e')](_0x4c13('0x13f'),_0x2e8998[_0x4c13('0xb2')],_0x2e8998[_0x4c13('0x139')],_0x4c13('0xb7'),_0x1d09c4[_0x4c13('0x2f')],'pTalking:\x20',_0x1d09c4[_0x4c13('0x33')]);this['callProgressDetectingCustomer'](_0x2e8998,_0x2e8998[_0x4c13('0xb2')],_0x2e8998[_0x4c13('0x139')]);}else if(this['actions'][_0x2e8998[_0x4c13('0xb2')]]['dialAnswer']){logger['info'](_0x4c13('0x13a'),_0x2e8998[_0x4c13('0xb2')],_0x2e8998[_0x4c13('0x139')],_0x4c13('0xb7'),_0x1d09c4['name'],_0x4c13('0x74'),_0x1d09c4[_0x4c13('0x33')]);this[_0x4c13('0x9e')](_0x2e8998,_0x2e8998[_0x4c13('0xb2')],_0x2e8998[_0x4c13('0x139')]);}}};Preview[_0x4c13('0x11')]['syncDialEnd']=function(_0x1b8e64){if(this[_0x4c13('0x19')][_0x1b8e64[_0x4c13('0xef')]]&&_0x1b8e64['destlinkedid']!==_0x1b8e64['destuniqueid']){this[_0x4c13('0x9e')](_0x1b8e64,_0x1b8e64['destlinkedid'],_0x1b8e64[_0x4c13('0xe9')]);}};Preview[_0x4c13('0x11')]['syncHangupRequest']=function(_0x5b7d4c){if(this[_0x4c13('0x19')][_0x5b7d4c[_0x4c13('0xb2')]]&&_0x5b7d4c[_0x4c13('0xb2')]!==_0x5b7d4c[_0x4c13('0xb6')]&&!this[_0x4c13('0x19')][_0x5b7d4c[_0x4c13('0xb2')]][_0x4c13('0x75')]){if(_0x5b7d4c['cause']==='1'){this[_0x4c13('0x9e')](_0x5b7d4c,_0x5b7d4c[_0x4c13('0xb2')],_0x5b7d4c[_0x4c13('0x139')]);}}};Preview[_0x4c13('0x11')][_0x4c13('0x140')]=function(_0x316ad3,_0x223c79,_0x5c954e){if(this[_0x4c13('0x19')][_0x316ad3]){if(_['isNil'](this[_0x4c13('0x19')][_0x316ad3][_0x4c13('0x141')])){this[_0x4c13('0x19')][_0x316ad3]['variables']={};}this[_0x4c13('0x19')][_0x316ad3][_0x4c13('0x141')][_0x223c79]=_0x5c954e;}};Preview[_0x4c13('0x11')][_0x4c13('0x142')]=function(_0x318309){try{if(!_[_0x4c13('0x70')](_0x318309)){if(ut[_0x4c13('0x143')](_[_0x4c13('0x144')](_0x318309[_0x4c13('0x145')])[0x0])){this['addVariable'](_0x318309[_0x4c13('0xb6')],_[_0x4c13('0x144')](_0x318309[_0x4c13('0x145')])[0x0],_0x318309[_0x4c13('0x146')]);}}}catch(_0x19cbc1){logger[_0x4c13('0x147')](_0x4c13('0x148'),util['inspect'](_0x19cbc1,{'showHidden':![],'depth':null}));}};Preview[_0x4c13('0x11')]['syncAttendedTransfer']=function(_0x2e9d36){if(_0x2e9d36){if(this['actions'][_0x2e9d36['transfertargetlinkedid']]){this[_0x4c13('0x19')][_0x2e9d36[_0x4c13('0x149')]][_0x4c13('0x13e')]=!![];}}};Preview[_0x4c13('0x11')]['syncBlindTransfer']=function(_0x2cb47f){if(_0x2cb47f){if(this['actions'][_0x2cb47f[_0x4c13('0x14a')]]){this[_0x4c13('0x19')][_0x2cb47f[_0x4c13('0x14a')]]['transfer']=!![];}}};module[_0x4c13('0x14b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0944bb8..432ce18 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 _0x2d17=['getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','assigned','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x2d17,0x17e));var _0x72d1=function(_0x5e04a9,_0x32d083){_0x5e04a9=_0x5e04a9-0x0;var _0x1c0b59=_0x2d17[_0x5e04a9];return _0x1c0b59;};'use strict';var util=require(_0x72d1('0x0'));var BPromise=require(_0x72d1('0x1'));var logger=require('../../../config/logger')(_0x72d1('0x2'));var _=require(_0x72d1('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x72d1('0x4'));var cmHopperHistory=require(_0x72d1('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x72d1('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x72d1('0x7'));function loggerCatch(_0x50f551){return function(_0x139ba0){logger[_0x72d1('0x8')](_0x50f551,util['inspect'](_0x139ba0,{'showHidden':![],'depth':null}));};}function create(_0x477264){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopperHistory['createHistory'](_0x477264))[_0x72d1('0xb')](loggerCatch(_0x72d1('0xc')));}function createAgent(_0x283775){return BPromise['resolve']()[_0x72d1('0xa')](agentReportPreview[_0x72d1('0xd')](_0x283775))[_0x72d1('0xb')](loggerCatch(_0x72d1('0xc')));}function moveContact(_0x3cb9c2){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper[_0x72d1('0xe')](_0x3cb9c2,!![]))[_0x72d1('0xb')](loggerCatch(_0x72d1('0xf')));}exports['checkIsBlackList']=function(_0x3cd1ae){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopperBlack[_0x72d1('0x10')](_0x3cd1ae))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x11')));};exports[_0x72d1('0x12')]=function(_0x383bb){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper[_0x72d1('0x12')](_0x383bb))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x13')));};exports['createHistory']=function(_0x46fa3d,_0x5262b0){create(_0x46fa3d)[_0x72d1('0xb')](loggerCatch(_0x5262b0));moveContact(_0x46fa3d)[_0x72d1('0xb')](loggerCatch(_0x5262b0));};exports['createAgentHistory']=function(_0x1061b7,_0x1cbb45){createAgent(_0x1061b7)[_0x72d1('0xb')](loggerCatch(_0x1cbb45));};exports['createCustomerHistory']=function(_0x4925f6,_0x313d7b){create(_0x4925f6)[_0x72d1('0xb')](loggerCatch(_0x313d7b));};exports[_0x72d1('0x14')]=function(_0x1865c1,_0x8d6890){moveContact(_0x1865c1)[_0x72d1('0xb')](loggerCatch(_0x8d6890));};exports[_0x72d1('0x15')]=function(_0x5c7982,_0x1c695c,_0x56e8d3){if(_0x1c695c){_0x5c7982['UserId']=null;}if(_0x56e8d3){_0x5c7982['active']=![];}return BPromise['resolve']()[_0x72d1('0xa')](cmHopper[_0x72d1('0x15')](_0x5c7982))['catch'](loggerCatch(_0x72d1('0x16')));};exports[_0x72d1('0x17')]=function(_0x492086){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper['countReScheduled'](_0x492086))['catch'](loggerCatch(_0x72d1('0x18')));};exports[_0x72d1('0x19')]=function(_0x2f661){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper[_0x72d1('0x19')]({'UserId':null},_0x2f661,0x1))[_0x72d1('0xb')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x1ba258){return BPromise['resolve']()[_0x72d1('0xa')](cmHopper[_0x72d1('0x19')]({'active':![]},_0x1ba258,0x1))[_0x72d1('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x72d1('0x1a')]=function(_0x4c4c41){var _0x707cd0={};_0x707cd0[_0x72d1('0x1b')]=_0x4c4c41[_0x72d1('0x1b')];_0x707cd0[_0x72d1('0x1c')]=_0x4c4c41['uniqueid'];_0x707cd0[_0x72d1('0x1d')]=_0x4c4c41['calleridnum'];_0x707cd0[_0x72d1('0x1e')]=_0x4c4c41[_0x72d1('0x1e')];_0x707cd0['queue']=_0x4c4c41[_0x72d1('0x1f')];_0x707cd0[_0x72d1('0x20')]=_0x4c4c41[_0x72d1('0x21')];_0x707cd0[_0x72d1('0x22')]=_0x4c4c41[_0x72d1('0x21')];_0x707cd0['queuecallercomplete']=0x1;_0x707cd0[_0x72d1('0x23')]=_0x4c4c41[_0x72d1('0x24')];_0x707cd0[_0x72d1('0x25')]=_0x4c4c41['membername'];_0x707cd0[_0x72d1('0x26')]=_0x72d1('0x27');_0x707cd0['exten']=_0x72d1('0x28');_0x707cd0[_0x72d1('0x29')]=0x0;_0x707cd0[_0x72d1('0x2a')]=0x1;_0x707cd0['lastAssignedTo']=_0x4c4c41[_0x72d1('0x2b')];_0x707cd0['queuecallerexitreason']=_0x72d1('0x2c');return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](voiceQueueReport[_0x72d1('0x2d')](_0x707cd0))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x2e')));};exports[_0x72d1('0x2f')]=function(_0xb32ca6,_0x4006b9){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper['getContactRecallMe'](_0xb32ca6,_0x4006b9))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x30')));};exports[_0x72d1('0x31')]=function(_0x325209){return BPromise['resolve']()[_0x72d1('0xa')](cmHopper[_0x72d1('0x15')](_0x325209,!![],!![]))[_0x72d1('0xb')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x29d4=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x5350f5,_0x3aafa3){var _0x2faef5=function(_0x48d945){while(--_0x48d945){_0x5350f5['push'](_0x5350f5['shift']());}};_0x2faef5(++_0x3aafa3);}(_0x29d4,0x1a1));var _0x429d=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x29d4[_0x21aec3];return _0x288bbc;};'use strict';var util=require(_0x429d('0x0'));var BPromise=require('bluebird');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var _=require(_0x429d('0x3'));var cmHopper=require(_0x429d('0x4'));var cmHopperFinal=require(_0x429d('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x429d('0x6'));var voiceQueueRt=require(_0x429d('0x7'));var agentReportPreview=require(_0x429d('0x8'));var voiceQueueReport=require(_0x429d('0x9'));function loggerCatch(_0x1c55aa){return function(_0xa71445){logger[_0x429d('0xa')](_0x1c55aa,util[_0x429d('0xb')](_0xa71445,{'showHidden':![],'depth':null}));};}function create(_0x4befb9){return BPromise[_0x429d('0xc')]()['then'](cmHopperHistory[_0x429d('0xd')](_0x4befb9))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function createAgent(_0x5e8430){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](agentReportPreview['createHistory'](_0x5e8430))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function moveContact(_0x417f77){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x11')](_0x417f77,!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x12')));}exports['checkIsBlackList']=function(_0x1c542c){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopperBlack['checkIsBlackList'](_0x1c542c))[_0x429d('0xe')](loggerCatch(_0x429d('0x13')));};exports['getContactPreview']=function(_0x32d6b3){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x14')](_0x32d6b3))[_0x429d('0xe')](loggerCatch(_0x429d('0x15')));};exports['createHistory']=function(_0xbfe8a0,_0x53d19d){create(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));moveContact(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));};exports[_0x429d('0x16')]=function(_0x2dc57a,_0x51ef88){createAgent(_0x2dc57a)[_0x429d('0xe')](loggerCatch(_0x51ef88));};exports[_0x429d('0x17')]=function(_0x2b9e78,_0x513854){create(_0x2b9e78)[_0x429d('0xe')](loggerCatch(_0x513854));};exports[_0x429d('0x18')]=function(_0x202c4e,_0xcbf00c){moveContact(_0x202c4e)[_0x429d('0xe')](loggerCatch(_0xcbf00c));};exports[_0x429d('0x19')]=function(_0x5a4093,_0x13e309,_0x165e4d){if(_0x13e309){_0x5a4093[_0x429d('0x1a')]=null;}if(_0x165e4d){_0x5a4093['active']=![];}return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x19')](_0x5a4093))[_0x429d('0xe')](loggerCatch(_0x429d('0x1b')));};exports[_0x429d('0x1c')]=function(_0x4c6d89){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['countReScheduled'](_0x4c6d89))[_0x429d('0xe')](loggerCatch(_0x429d('0x1d')));};exports[_0x429d('0x1e')]=function(_0x11c423){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'UserId':null},_0x11c423,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x1f')));};exports[_0x429d('0x20')]=function(_0x514f1b){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'active':![]},_0x514f1b,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x21')));};exports[_0x429d('0x22')]=function(_0x2351c9){var _0xdc7bf9={};_0xdc7bf9[_0x429d('0x23')]=_0x2351c9['type'];_0xdc7bf9[_0x429d('0x24')]=_0x2351c9[_0x429d('0x24')];_0xdc7bf9['calleridnum']=_0x2351c9[_0x429d('0x25')];_0xdc7bf9[_0x429d('0x26')]=_0x2351c9[_0x429d('0x26')];_0xdc7bf9[_0x429d('0x27')]=_0x2351c9[_0x429d('0x27')];_0xdc7bf9['queuecallerjoinAt']=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x29')]=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x2a')]=0x1;_0xdc7bf9[_0x429d('0x2b')]=_0x2351c9[_0x429d('0x2c')];_0xdc7bf9['connectedlinename']=_0x2351c9['membername'];_0xdc7bf9[_0x429d('0x2d')]=_0x429d('0x2e');_0xdc7bf9['exten']='xcally-motion-preview';_0xdc7bf9[_0x429d('0x2f')]=0x0;_0xdc7bf9['assigned']=0x1;_0xdc7bf9[_0x429d('0x30')]=_0x2351c9[_0x429d('0x31')];_0xdc7bf9[_0x429d('0x32')]=_0x429d('0x33');return BPromise['resolve']()[_0x429d('0x10')](voiceQueueReport[_0x429d('0x34')](_0xdc7bf9))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x5698f5,_0x5bb435){return BPromise[_0x429d('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x5698f5,_0x5bb435))[_0x429d('0xe')](loggerCatch(_0x429d('0x35')));};exports[_0x429d('0x36')]=function(_0x30e645){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['rescheduleContact'](_0x30e645,!![],!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x37')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0511610..14e9d1d 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 _0xa1c5=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','message','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','state','ringtime','starttime','logLookAgent','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','buildAcw','not_inuse','status','reachable','seconds','CampaignId','filterKey','idContact','dialAnswer','membername','countcongestionretry','callback','callbackuniqueid','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi'];(function(_0x2c85fc,_0x423f2b){var _0x2699f5=function(_0x274e22){while(--_0x274e22){_0x2c85fc['push'](_0x2c85fc['shift']());}};_0x2699f5(++_0x423f2b);}(_0xa1c5,0x96));var _0x5a1c=function(_0x2d8401,_0x14e32a){_0x2d8401=_0x2d8401-0x0;var _0x20bf25=_0xa1c5[_0x2d8401];return _0x20bf25;};'use strict';var util=require(_0x5a1c('0x0'));var _=require(_0x5a1c('0x1'));var moment=require(_0x5a1c('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x5a1c('0x3')][_0x5a1c('0x4')]||_0x5a1c('0x5');function getSeconds(_0x4e7fcd,_0xc4a79e){var _0x2e62cc=moment(_0x4e7fcd)[_0x5a1c('0x6')](0x0);var _0x5a16d2=moment(_0xc4a79e)[_0x5a1c('0x6')](0x0);return _0x2e62cc[_0x5a1c('0x7')](_0x5a16d2,'seconds');}exports[_0x5a1c('0x8')]=function(_0x5c3668){return function(_0x33a532){logger[_0x5a1c('0x9')](_0x5c3668,util[_0x5a1c('0xa')](_0x33a532,{'showHidden':![],'depth':null}));};};exports[_0x5a1c('0xb')]=function(_0x263cd8,_0x5e6568){logger[_0x5a1c('0xc')](_0x263cd8,util['inspect'](_0x5e6568,{'showHidden':![],'depth':null}));};exports[_0x5a1c('0xd')]=function(_0x25a201,_0x497e53){logger[_0x5a1c('0x9')](_0x25a201,util[_0x5a1c('0xa')](_0x497e53,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xa94ed5){return function(_0x307279){logger['info'](_0xa94ed5,util[_0x5a1c('0xa')](_0x307279,{'showHidden':![],'depth':null}));};};exports[_0x5a1c('0xe')]=function(_0x53bbde,_0x5acb82,_0x31025d){return{'message':_0x53bbde,'unlock':_0x5acb82,'active':_0x31025d};};exports['getCallerId']=function(_0x3318c2,_0x3491c5,_0x133368){if(!_['isUndefined'](_0x133368)&&'string'===typeof _0x133368&&!_[_0x5a1c('0xf')](_0x133368)){if(!_[_0x5a1c('0x10')](_0x3491c5)&&_0x5a1c('0x11')===typeof _0x3491c5&&!_[_0x5a1c('0xf')](_0x3491c5)){return util[_0x5a1c('0x12')]('\x22%s\x22\x20<%s>',_0x3491c5,_0x133368);}return util[_0x5a1c('0x12')](_0x5a1c('0x13'),_0x133368,_0x133368);}if(!_[_0x5a1c('0x10')](_0x3318c2)&&_0x5a1c('0x11')===typeof _0x3318c2&&!_[_0x5a1c('0xf')](_0x3318c2)){return _0x3318c2;}return'\x22\x22\x20<>';};exports[_0x5a1c('0x14')]=function(_0x3e2a9f){if(_[_0x5a1c('0x15')](_0x3e2a9f)){return![];}return _0x3e2a9f;};exports[_0x5a1c('0x16')]=function(_0x493073,_0xfeb722,_0x341d40,_0x12d565,_0x1ecea4,_0x5161d4){var _0x29eb79={'XMD-QUEUE':_0xfeb722[_0x5a1c('0x17')]?_0xfeb722[_0x5a1c('0x17')][_0x5a1c('0x18')]:'','XMD-CALLERID':_0x12d565,'XMD-CALLERID-PREVIEW':_0x5161d4?util[_0x5a1c('0x12')]('\x22%s\x22\x20<%s>',_0x5161d4[_0x5a1c('0x19')],_0x5161d4[_0x5a1c('0x1a')]):_0x12d565,'XMD-DIALID':_0x1ecea4,'XMD-CONTACTID':_0xfeb722[_0x5a1c('0x1b')],'XMD-CDRTYPE':_0x5a1c('0x1c'),'CALLERID(all)':_0x12d565,'XMD-VOICEQUEUEID':_0xfeb722[_0x5a1c('0x1d')],'XMD-DIALCHANNEL':_0x341d40,'XMD-DIALTIMEOUT':_0x493073[_0x5a1c('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x5a1c('0x12')](_0x5a1c('0x1f'),_0x493073[_0x5a1c('0x20')]?'g':'',_['isEmpty'](_0x493073[_0x5a1c('0x21')])?'':_0x5a1c('0x22')),'XMD-DIALURL':_0x493073[_0x5a1c('0x23')]||'','XMD-AGI':_0x493073[_0x5a1c('0x24')]?util[_0x5a1c('0x12')](_0x5a1c('0x25'),ipAgi,_0x493073[_0x5a1c('0x24')]):_0x5a1c('0x26'),'XMD-AGIAFTER':_0x493073[_0x5a1c('0x20')]?util[_0x5a1c('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x493073[_0x5a1c('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5161d4?_0x5161d4[_0x5a1c('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x5161d4?_0x5161d4[_0x5a1c('0x28')]:'','XMD-DESTINATION':_0x5a1c('0x29')};if(!_['isEmpty'](_0x493073[_0x5a1c('0x21')])){_0x29eb79[util[_0x5a1c('0x12')]('%s',_0x5a1c('0x2a'))]=_0x493073['monitor_format'];_0x29eb79[util['format']('%s',_0x5a1c('0x2b'))]=_0x1ecea4;}if(_0xfeb722&&_0xfeb722[_0x5a1c('0x2c')]){for(var _0x5a6490 in _0xfeb722[_0x5a1c('0x2c')]){if(_0xfeb722[_0x5a1c('0x2c')][_0x5a1c('0x2d')](_0x5a6490)){if(!_[_0x5a1c('0x15')](_0xfeb722[_0x5a1c('0x2c')][_0x5a6490])&&_0x5a6490!=='id'&&_0x5a6490!==_0x5a1c('0x2e')&&_0x5a6490!==_0x5a1c('0x2f')&&_0x5a6490!==_0x5a1c('0x30')){_0x29eb79[util[_0x5a1c('0x12')](_0x5a1c('0x31'),_0x5a1c('0x32'),_[_0x5a1c('0x33')](_0x5a6490))]=_0xfeb722[_0x5a1c('0x2c')][_0x5a6490];}}}}return _0x29eb79;};exports[_0x5a1c('0x34')]=function(_0x211616){var _0xe1f1d8={};for(var _0x1e471c in _0x211616){if(_0x211616[_0x5a1c('0x2d')](_0x1e471c)){_0xe1f1d8[util[_0x5a1c('0x12')]('%s',_['toLower'](_0x1e471c))]=_0x211616[_0x1e471c];}}return{'variables':_0xe1f1d8};};exports[_0x5a1c('0x35')]=function(_0x2fbe3d,_0x9f25f7){if(!_[_0x5a1c('0x15')](_0x2fbe3d)){if(_0x2fbe3d[_0x5a1c('0x2d')](_0x5a1c('0x36'))){if(_0x2fbe3d['originated']>0x0){_0x2fbe3d[_0x5a1c('0x36')]-=0x1;}else{logger[_0x5a1c('0x9')](_0x5a1c('0x37'),_0x9f25f7);}}}else{logger[_0x5a1c('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x9f25f7);}};exports['logBlacklist']=function(_0x568d84){var _0x283594=moment()[_0x5a1c('0x12')](_0x5a1c('0x38'));_0x568d84['state']=0xd;_0x568d84[_0x5a1c('0x39')]=_0x5a1c('0x3a');_0x568d84['starttime']=_0x283594;_0x568d84[_0x5a1c('0x3b')]=_0x283594;_0x568d84[_0x5a1c('0x3c')]=_0x283594;};exports['logAgent']=function(_0x1d892f,_0x455388,_0x56e1bc){var _0x36ecda=moment()[_0x5a1c('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d892f[_0x5a1c('0x3d')]=_0x455388;_0x1d892f[_0x5a1c('0x39')]=_0x56e1bc;_0x1d892f[_0x5a1c('0x3b')]=_0x36ecda;_0x1d892f[_0x5a1c('0x3e')]=getSeconds(_0x1d892f[_0x5a1c('0x3b')],_0x1d892f[_0x5a1c('0x3f')]);};exports[_0x5a1c('0x40')]=function(_0x57936f,_0x5bc833,_0x5214b2){_0x57936f['membername']=_0x5bc833;_0x57936f['UserId']=_0x5214b2;};exports[_0x5a1c('0x41')]=function(_0x525089,_0x1b6fa2,_0x149890){var _0xaca53b=moment()[_0x5a1c('0x12')](_0x5a1c('0x38'));_0x525089[_0x5a1c('0x3d')]=_0x1b6fa2;_0x525089['statedesc']=_0x149890;_0x525089[_0x5a1c('0x3b')]=_0x525089[_0x5a1c('0x3b')]?_0x525089[_0x5a1c('0x3b')]:_0xaca53b;_0x525089[_0x5a1c('0x3c')]=_0x525089[_0x5a1c('0x3c')]?_0x525089[_0x5a1c('0x3c')]:_0xaca53b;_0x525089[_0x5a1c('0x3e')]=getSeconds(_0x525089[_0x5a1c('0x3b')]||0x0,_0x525089['starttime']||0x0);_0x525089[_0x5a1c('0x42')]=_0x525089[_0x5a1c('0x43')]?getSeconds(_0x525089['endtime'],_0x525089[_0x5a1c('0x43')]):0x0;};exports['isFailure']=function(_0x2ee685){return _0x2ee685===_0x5a1c('0x44');};exports[_0x5a1c('0x45')]=function(_0x4ec68d,_0xa8f3f6,_0x3f3294,_0x233de0,_0x1f999d){var _0x4f1271=_0x233de0?_0x5a1c('0x46'):_0x4ec68d[_0x5a1c('0x19')];_0x4f1271=_0x1f999d?_0x5a1c('0x47'):_0x4f1271;return{'actionid':_0x4ec68d[_0x5a1c('0x48')],'action':_0x5a1c('0x49'),'channel':_0x4ec68d[_0x5a1c('0x4a')],'callerid':util[_0x5a1c('0x12')](_0x5a1c('0x13'),_0x4f1271,_0x4ec68d[_0x5a1c('0x1a')]),'Exten':_0x5a1c('0x29'),'Context':_0x5a1c('0x4b'),'Priority':'1','variable':_0x3f3294,'timeout':(_0xa8f3f6['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4ec68d['uniqueid']};};exports[_0x5a1c('0x4c')]=function(_0x1450f8){return _0x1450f8['countbusyretry']+_0x1450f8['countcongestionretry']+_0x1450f8['countnoanswerretry']+_0x1450f8[_0x5a1c('0x4d')]+_0x1450f8['countnosuchnumberretry'];};exports[_0x5a1c('0x4e')]=function(_0x2be50d){var _0x4c5809=_[_0x5a1c('0x4f')](_0x2be50d);_0x4c5809[_0x5a1c('0x3d')]=0xf;_0x4c5809[_0x5a1c('0x39')]=_0x5a1c('0x50');return _0x4c5809;};exports[_0x5a1c('0x51')]=function(_0x4a9ae4,_0x593b0b,_0x2c7fee){var _0x43d38f={};_0x43d38f[_0x593b0b]=_0x4a9ae4[_0x593b0b];_0x43d38f[_0x5a1c('0x52')]=![];_0x43d38f[_0x5a1c('0x53')]=moment()[_0x5a1c('0x54')](_0x2c7fee,_0x5a1c('0x55'))[_0x5a1c('0x12')](_0x5a1c('0x38'));_0x43d38f[_0x5a1c('0x1b')]=_0x4a9ae4['ContactId'];_0x43d38f[_0x5a1c('0x56')]=_0x4a9ae4[_0x5a1c('0x56')];_0x43d38f[_0x5a1c('0x1d')]=_0x4a9ae4[_0x5a1c('0x1d')]||undefined;return _0x43d38f;};exports[_0x5a1c('0x57')]=function(_0x3dec47,_0x22089a){if(!_['isNil'](_0x3dec47)){if(_0x3dec47[_0x5a1c('0x58')]>0x0){_0x3dec47[_0x5a1c('0x58')]-=0x1;}else{logger['error'](_0x22089a,_0x5a1c('0x59'));}}else{logger[_0x5a1c('0x9')](_0x22089a,_0x5a1c('0x5a'));}};exports['IsNotLoggedIn']=function(_0x3c000f){if(_0x3c000f<=0x0){return!![];}return![];};exports[_0x5a1c('0x5b')]=function(_0x46ead5,_0x56c2f4){_0x46ead5[_0x5a1c('0x5c')]=_0x56c2f4;_0x46ead5[_0x5a1c('0x18')]=_0x46ead5[_0x5a1c('0x5d')];_0x46ead5['interface']=_0x46ead5[_0x5a1c('0x4a')];return _0x46ead5;};exports[_0x5a1c('0x5e')]=function(_0x58bc4e){var _0x279849={};_0x279849[_0x5a1c('0x5d')]=_0x58bc4e['queue'];_0x279849['interface']=_0x58bc4e[_0x5a1c('0x4a')];_0x279849['uniqueid']=_0x58bc4e[_0x5a1c('0x48')];return _0x279849;};exports['agentReadyId']=function(_0x20d8bd){var _0x379f88=[];for(var _0x2215d2 in _0x20d8bd){if(_0x20d8bd[_0x5a1c('0x2d')](_0x2215d2)){if(!_[_0x5a1c('0x15')](_0x20d8bd[_0x2215d2])&&_0x20d8bd[_0x2215d2][_0x5a1c('0x3d')]===_0x5a1c('0x5f')&&_0x20d8bd[_0x2215d2][_0x5a1c('0x60')]===_0x5a1c('0x61')){_0x379f88['push'](_0x20d8bd[_0x2215d2]['id']);}}}return _0x379f88;};exports['getDiff']=function(_0x5ce8ba){var _0x3a8566=moment()[_0x5a1c('0x6')](0x0);var _0x4cb0fe=moment(_0x5ce8ba)[_0x5a1c('0x6')](0x0);return _0x3a8566[_0x5a1c('0x7')](_0x4cb0fe,_0x5a1c('0x62'));};exports['createBody']=function(_0x58e474){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58e474[_0x5a1c('0x1b')],'ListId':_0x58e474[_0x5a1c('0x56')],'VoiceQueueId':_0x58e474['VoiceQueueId']||undefined,'CampaignId':_0x58e474[_0x5a1c('0x63')]||undefined};};exports[_0x5a1c('0x64')]=function(_0x503f49){if(_0x503f49===_0x5a1c('0x48')||_0x503f49===_0x5a1c('0x65')||_0x503f49==='queue'||_0x503f49==='type'||_0x503f49==='campaigntype'||_0x503f49===_0x5a1c('0x66')||_0x503f49===_0x5a1c('0x67')||_0x503f49===_0x5a1c('0x4a')||_0x503f49===_0x5a1c('0x19')||_0x503f49===_0x5a1c('0x52')||_0x503f49===_0x5a1c('0x1a')||_0x503f49==='scheduledat'||_0x503f49==='countbusyretry'||_0x503f49===_0x5a1c('0x68')||_0x503f49==='countnoanswerretry'||_0x503f49==='countglobal'||_0x503f49===_0x5a1c('0x69')||_0x503f49===_0x5a1c('0x6a')||_0x503f49==='callbackat'||_0x503f49==='recallme'||_0x503f49===_0x5a1c('0x1b')||_0x503f49===_0x5a1c('0x56')||_0x503f49==='UserId'||_0x503f49==='VoiceQueueId'||_0x503f49===_0x5a1c('0x6b')||_0x503f49==='xmd-voicequeueid'||_0x503f49===_0x5a1c('0x6c')||_0x503f49===_0x5a1c('0x6d')||_0x503f49===_0x5a1c('0x6e')||_0x503f49===_0x5a1c('0x6f')||_0x503f49===_0x5a1c('0x70')||_0x503f49===_0x5a1c('0x71')||_0x503f49==='xmd-dialid'||_0x503f49==='xmd-dialchannel'||_0x503f49===_0x5a1c('0x72')||_0x503f49==='xmd-cdrtype'||_0x503f49===_0x5a1c('0x73')||_0x503f49===_0x5a1c('0x74')||_0x503f49===_0x5a1c('0x75')||_0x503f49===_0x5a1c('0x76')||_0x503f49===_0x5a1c('0x77')||_0x503f49===_0x5a1c('0x78')||_0x503f49===_0x5a1c('0x79')||_0x503f49===_0x5a1c('0x7a')||_0x503f49==='rtpaudioqoslossbridged'||_0x503f49===_0x5a1c('0x7b')||_0x503f49===_0x5a1c('0x7c')||_0x503f49===_0x5a1c('0x76')||_0x503f49===_0x5a1c('0x77')||_0x503f49==='rtpaudioqosjitter'||_0x503f49==='rtpaudioqosjitterbridged'||_0x503f49===_0x5a1c('0x7a')||_0x503f49===_0x5a1c('0x7d')||_0x503f49===_0x5a1c('0x7b')||_0x503f49==='rtpaudioqosrttbridged'||_0x503f49===_0x5a1c('0x7e')||_0x503f49===_0x5a1c('0x7f')||_0x503f49===_0x5a1c('0x3d')||_0x503f49===_0x5a1c('0x39')){return![];}return!![];};exports[_0x5a1c('0x80')]=function(_0x5f26e7,_0x2d47d7){var _0x484d49,_0x42c924,_0x1ee00d;if(_0x2d47d7<=0x0){_0x2d47d7=0x1;}_0x484d49=new RegExp(_0x5a1c('0x81')+_0x2d47d7+'}$');_0x42c924=Math['pow'](0xa,_0x2d47d7-0x1);_0x1ee00d=Math['pow'](0xa,_0x2d47d7)-0x1;return util[_0x5a1c('0x12')]('%s',_[_0x5a1c('0x82')](_0x5f26e7,_0x484d49,_[_0x5a1c('0x83')](_0x42c924,_0x1ee00d)));};exports['extractCalleridName']=function(_0x59c902){var _0x1f6427=_0x59c902[_0x5a1c('0x84')](/"(.*?)"/);return _0x1f6427?_0x1f6427[0x1]:_0x59c902;};exports[_0x5a1c('0x85')]=function(_0x213ce8){var _0x14f8d4=_0x213ce8['match'](/<(.*?)>/);return _0x14f8d4?_0x14f8d4[0x1]:_0x213ce8;}; \ No newline at end of file +var _0xacc6=['timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','queue','agentReadyId','not_inuse','status','reachable','diff','createBody','CampaignId','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','error','inspect','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','logLookAgent','membername','endtime','ringtime','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','calleridnum','from-sip'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xacc6,0x150));var _0x6acc=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xacc6[_0x5a1a51];return _0x47edd7;};'use strict';var util=require(_0x6acc('0x0'));var _=require(_0x6acc('0x1'));var moment=require(_0x6acc('0x2'));var logger=require(_0x6acc('0x3'))(_0x6acc('0x4'));var ipAgi=process['env'][_0x6acc('0x5')]||_0x6acc('0x6');function getSeconds(_0x2ff2ff,_0x53dcdb){var _0x148455=moment(_0x2ff2ff)['milliseconds'](0x0);var _0xae1fa2=moment(_0x53dcdb)[_0x6acc('0x7')](0x0);return _0x148455['diff'](_0xae1fa2,_0x6acc('0x8'));}exports['loggerCatch']=function(_0x1f95e8){return function(_0x538730){logger[_0x6acc('0x9')](_0x1f95e8,util[_0x6acc('0xa')](_0x538730,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1343cb,_0x4cf4c7){logger[_0x6acc('0xb')](_0x1343cb,util[_0x6acc('0xa')](_0x4cf4c7,{'showHidden':![],'depth':null}));};exports[_0x6acc('0xc')]=function(_0x112778,_0x23779b){logger[_0x6acc('0x9')](_0x112778,util['inspect'](_0x23779b,{'showHidden':![],'depth':null}));};exports[_0x6acc('0xd')]=function(_0x6dba13){return function(_0x1d951c){logger[_0x6acc('0xb')](_0x6dba13,util[_0x6acc('0xa')](_0x1d951c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5c6aed,_0x15674a,_0x497356){return{'message':_0x5c6aed,'unlock':_0x15674a,'active':_0x497356};};exports[_0x6acc('0xe')]=function(_0x230318,_0x3c0afb,_0x2e3e01){if(!_[_0x6acc('0xf')](_0x2e3e01)&&_0x6acc('0x10')===typeof _0x2e3e01&&!_[_0x6acc('0x11')](_0x2e3e01)){if(!_[_0x6acc('0xf')](_0x3c0afb)&&_0x6acc('0x10')===typeof _0x3c0afb&&!_[_0x6acc('0x11')](_0x3c0afb)){return util[_0x6acc('0x12')](_0x6acc('0x13'),_0x3c0afb,_0x2e3e01);}return util[_0x6acc('0x12')](_0x6acc('0x13'),_0x2e3e01,_0x2e3e01);}if(!_[_0x6acc('0xf')](_0x230318)&&_0x6acc('0x10')===typeof _0x230318&&!_['isEmpty'](_0x230318)){return _0x230318;}return _0x6acc('0x14');};exports[_0x6acc('0x15')]=function(_0x37a627){if(_[_0x6acc('0x16')](_0x37a627)){return![];}return _0x37a627;};exports['addVariables']=function(_0x342043,_0x531f7c,_0x51dea7,_0x4af9e,_0x5d5382,_0x4552c7){var _0x3edf4a={'XMD-QUEUE':_0x531f7c[_0x6acc('0x17')]?_0x531f7c[_0x6acc('0x17')][_0x6acc('0x18')]:'','XMD-CALLERID':_0x4af9e,'XMD-CALLERID-PREVIEW':_0x4552c7?util['format'](_0x6acc('0x13'),_0x4552c7[_0x6acc('0x19')],_0x4552c7['calleridnum']):_0x4af9e,'XMD-DIALID':_0x5d5382,'XMD-CONTACTID':_0x531f7c[_0x6acc('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4af9e,'XMD-VOICEQUEUEID':_0x531f7c[_0x6acc('0x1b')],'XMD-DIALCHANNEL':_0x51dea7,'XMD-DIALTIMEOUT':_0x342043[_0x6acc('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x6acc('0x12')](_0x6acc('0x1d'),_0x342043['dialQueueProject2']?'g':'',_[_0x6acc('0x11')](_0x342043[_0x6acc('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x342043[_0x6acc('0x1f')]||'','XMD-AGI':_0x342043[_0x6acc('0x20')]?util[_0x6acc('0x12')](_0x6acc('0x21'),ipAgi,_0x342043[_0x6acc('0x20')]):_0x6acc('0x22'),'XMD-AGIAFTER':_0x342043[_0x6acc('0x23')]?util[_0x6acc('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x342043[_0x6acc('0x23')]):_0x6acc('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x4552c7?_0x4552c7[_0x6acc('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x4552c7?_0x4552c7[_0x6acc('0x25')]:'','XMD-DESTINATION':_0x6acc('0x26')};if(!_[_0x6acc('0x11')](_0x342043[_0x6acc('0x1e')])){_0x3edf4a[util[_0x6acc('0x12')]('%s',_0x6acc('0x27'))]=_0x342043[_0x6acc('0x1e')];_0x3edf4a[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5d5382;}if(_0x531f7c&&_0x531f7c['Contact']){for(var _0x5b6fab in _0x531f7c[_0x6acc('0x28')]){if(_0x531f7c[_0x6acc('0x28')][_0x6acc('0x29')](_0x5b6fab)){if(!_[_0x6acc('0x16')](_0x531f7c[_0x6acc('0x28')][_0x5b6fab])&&_0x5b6fab!=='id'&&_0x5b6fab!==_0x6acc('0x2a')&&_0x5b6fab!=='createdAt'&&_0x5b6fab!=='updatedAt'){_0x3edf4a[util[_0x6acc('0x12')](_0x6acc('0x2b'),_0x6acc('0x2c'),_[_0x6acc('0x2d')](_0x5b6fab))]=_0x531f7c['Contact'][_0x5b6fab];}}}}return _0x3edf4a;};exports[_0x6acc('0x2e')]=function(_0x2c0bf4){var _0x59a327={};for(var _0x46e7f5 in _0x2c0bf4){if(_0x2c0bf4[_0x6acc('0x29')](_0x46e7f5)){_0x59a327[util[_0x6acc('0x12')]('%s',_['toLower'](_0x46e7f5))]=_0x2c0bf4[_0x46e7f5];}}return{'variables':_0x59a327};};exports['updateOriginated']=function(_0xa7bd17,_0x29dc9a){if(!_['isNil'](_0xa7bd17)){if(_0xa7bd17['hasOwnProperty'](_0x6acc('0x2f'))){if(_0xa7bd17[_0x6acc('0x2f')]>0x0){_0xa7bd17[_0x6acc('0x2f')]-=0x1;}else{logger['error'](_0x6acc('0x30'),_0x29dc9a);}}}else{logger[_0x6acc('0x9')](_0x6acc('0x31'),_0x29dc9a);}};exports[_0x6acc('0x32')]=function(_0x37544d){var _0x4e52dd=moment()[_0x6acc('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x37544d[_0x6acc('0x33')]=0xd;_0x37544d[_0x6acc('0x34')]='Blacklist';_0x37544d[_0x6acc('0x35')]=_0x4e52dd;_0x37544d['responsetime']=_0x4e52dd;_0x37544d['endtime']=_0x4e52dd;};exports[_0x6acc('0x36')]=function(_0x2f28cc,_0x11290e,_0x5bf680){var _0x96474d=moment()['format'](_0x6acc('0x37'));_0x2f28cc['state']=_0x11290e;_0x2f28cc[_0x6acc('0x34')]=_0x5bf680;_0x2f28cc[_0x6acc('0x38')]=_0x96474d;_0x2f28cc['ringtime']=getSeconds(_0x2f28cc[_0x6acc('0x38')],_0x2f28cc[_0x6acc('0x35')]);};exports[_0x6acc('0x39')]=function(_0x30d01d,_0x46f7db,_0x327631){_0x30d01d[_0x6acc('0x3a')]=_0x46f7db;_0x30d01d['UserId']=_0x327631;};exports['logCustomer']=function(_0x3481ad,_0x3515dd,_0x11b0b1){var _0x540820=moment()[_0x6acc('0x12')](_0x6acc('0x37'));_0x3481ad[_0x6acc('0x33')]=_0x3515dd;_0x3481ad[_0x6acc('0x34')]=_0x11b0b1;_0x3481ad[_0x6acc('0x38')]=_0x3481ad[_0x6acc('0x38')]?_0x3481ad[_0x6acc('0x38')]:_0x540820;_0x3481ad[_0x6acc('0x3b')]=_0x3481ad[_0x6acc('0x3b')]?_0x3481ad[_0x6acc('0x3b')]:_0x540820;_0x3481ad[_0x6acc('0x3c')]=getSeconds(_0x3481ad[_0x6acc('0x38')]||0x0,_0x3481ad['starttime']||0x0);_0x3481ad['talktime']=_0x3481ad['answertime']?getSeconds(_0x3481ad[_0x6acc('0x3b')],_0x3481ad['answertime']):0x0;};exports['isFailure']=function(_0x20369a){return _0x20369a===_0x6acc('0x3d');};exports[_0x6acc('0x3e')]=function(_0xdfbb9a,_0x258ce9,_0x26c821,_0x4748d3,_0x2c0be8){var _0x1720f7=_0x4748d3?_0x6acc('0x3f'):_0xdfbb9a[_0x6acc('0x19')];_0x1720f7=_0x2c0be8?_0x6acc('0x40'):_0x1720f7;return{'actionid':_0xdfbb9a[_0x6acc('0x41')],'action':'originate','channel':_0xdfbb9a[_0x6acc('0x42')],'callerid':util[_0x6acc('0x12')]('\x22%s\x22\x20<%s>',_0x1720f7,_0xdfbb9a[_0x6acc('0x43')]),'Exten':'xcally-motion-preview','Context':_0x6acc('0x44'),'Priority':'1','variable':_0x26c821,'timeout':(_0x258ce9[_0x6acc('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0xdfbb9a['uniqueid']};};exports[_0x6acc('0x46')]=function(_0x1b5544){return _0x1b5544[_0x6acc('0x47')]+_0x1b5544[_0x6acc('0x48')]+_0x1b5544[_0x6acc('0x49')]+_0x1b5544['countagentrejectretry']+_0x1b5544[_0x6acc('0x4a')];};exports[_0x6acc('0x4b')]=function(_0x45c5e0){var _0x40c879=_[_0x6acc('0x4c')](_0x45c5e0);_0x40c879[_0x6acc('0x33')]=0xf;_0x40c879[_0x6acc('0x34')]=_0x6acc('0x4d');return _0x40c879;};exports[_0x6acc('0x4e')]=function(_0x28e601,_0x1989a6,_0x2344a7){var _0x2b4d94={};_0x2b4d94[_0x1989a6]=_0x28e601[_0x1989a6];_0x2b4d94[_0x6acc('0x4f')]=![];_0x2b4d94[_0x6acc('0x50')]=moment()[_0x6acc('0x51')](_0x2344a7,_0x6acc('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b4d94['ContactId']=_0x28e601[_0x6acc('0x1a')];_0x2b4d94[_0x6acc('0x53')]=_0x28e601['ListId'];_0x2b4d94[_0x6acc('0x1b')]=_0x28e601[_0x6acc('0x1b')]||undefined;return _0x2b4d94;};exports[_0x6acc('0x54')]=function(_0x439f3c,_0x514fa1){if(!_[_0x6acc('0x16')](_0x439f3c)){if(_0x439f3c[_0x6acc('0x55')]>0x0){_0x439f3c[_0x6acc('0x55')]-=0x1;}else{logger[_0x6acc('0x9')](_0x514fa1,_0x6acc('0x56'));}}else{logger['error'](_0x514fa1,_0x6acc('0x57'));}};exports[_0x6acc('0x58')]=function(_0x22458f){if(_0x22458f<=0x0){return!![];}return![];};exports['buildObj']=function(_0x13dfc2,_0x258e81){_0x13dfc2[_0x6acc('0x59')]=_0x258e81;_0x13dfc2[_0x6acc('0x18')]=_0x13dfc2['queue'];_0x13dfc2[_0x6acc('0x5a')]=_0x13dfc2[_0x6acc('0x42')];return _0x13dfc2;};exports['buildAcw']=function(_0x362613){var _0x48b8e1={};_0x48b8e1['queue']=_0x362613[_0x6acc('0x5b')];_0x48b8e1[_0x6acc('0x5a')]=_0x362613[_0x6acc('0x42')];_0x48b8e1[_0x6acc('0x41')]=_0x362613['uniqueid'];return _0x48b8e1;};exports[_0x6acc('0x5c')]=function(_0x38be46){var _0x5140c4=[];for(var _0xae3072 in _0x38be46){if(_0x38be46[_0x6acc('0x29')](_0xae3072)){if(!_[_0x6acc('0x16')](_0x38be46[_0xae3072])&&_0x38be46[_0xae3072][_0x6acc('0x33')]===_0x6acc('0x5d')&&_0x38be46[_0xae3072][_0x6acc('0x5e')]===_0x6acc('0x5f')){_0x5140c4['push'](_0x38be46[_0xae3072]['id']);}}}return _0x5140c4;};exports['getDiff']=function(_0x4bd863){var _0x4caf0f=moment()[_0x6acc('0x7')](0x0);var _0x493bb9=moment(_0x4bd863)[_0x6acc('0x7')](0x0);return _0x4caf0f[_0x6acc('0x60')](_0x493bb9,'seconds');};exports[_0x6acc('0x61')]=function(_0x4bcb57){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4bcb57[_0x6acc('0x1a')],'ListId':_0x4bcb57[_0x6acc('0x53')],'VoiceQueueId':_0x4bcb57[_0x6acc('0x1b')]||undefined,'CampaignId':_0x4bcb57[_0x6acc('0x62')]||undefined};};exports['filterKey']=function(_0x4cf817){if(_0x4cf817==='uniqueid'||_0x4cf817==='idContact'||_0x4cf817==='queue'||_0x4cf817===_0x6acc('0x63')||_0x4cf817===_0x6acc('0x64')||_0x4cf817===_0x6acc('0x65')||_0x4cf817===_0x6acc('0x3a')||_0x4cf817==='channelAgent'||_0x4cf817==='calleridname'||_0x4cf817===_0x6acc('0x4f')||_0x4cf817==='calleridnum'||_0x4cf817===_0x6acc('0x50')||_0x4cf817==='countbusyretry'||_0x4cf817===_0x6acc('0x48')||_0x4cf817===_0x6acc('0x49')||_0x4cf817===_0x6acc('0x66')||_0x4cf817===_0x6acc('0x67')||_0x4cf817===_0x6acc('0x68')||_0x4cf817===_0x6acc('0x69')||_0x4cf817===_0x6acc('0x6a')||_0x4cf817===_0x6acc('0x1a')||_0x4cf817===_0x6acc('0x53')||_0x4cf817===_0x6acc('0x6b')||_0x4cf817===_0x6acc('0x1b')||_0x4cf817===_0x6acc('0x6c')||_0x4cf817===_0x6acc('0x6d')||_0x4cf817===_0x6acc('0x6e')||_0x4cf817===_0x6acc('0x6f')||_0x4cf817===_0x6acc('0x70')||_0x4cf817===_0x6acc('0x71')||_0x4cf817===_0x6acc('0x72')||_0x4cf817===_0x6acc('0x73')||_0x4cf817==='xmd-dialid'||_0x4cf817===_0x6acc('0x74')||_0x4cf817==='xmd-contactid'||_0x4cf817===_0x6acc('0x75')||_0x4cf817==='xmd-callerid'||_0x4cf817===_0x6acc('0x76')||_0x4cf817==='xmd-agi'||_0x4cf817===_0x6acc('0x77')||_0x4cf817==='rtpaudioqosbridged'||_0x4cf817==='rtpaudioqosjitter'||_0x4cf817===_0x6acc('0x78')||_0x4cf817===_0x6acc('0x79')||_0x4cf817==='rtpaudioqoslossbridged'||_0x4cf817===_0x6acc('0x7a')||_0x4cf817===_0x6acc('0x7b')||_0x4cf817===_0x6acc('0x77')||_0x4cf817==='rtpaudioqosbridged'||_0x4cf817===_0x6acc('0x7c')||_0x4cf817===_0x6acc('0x78')||_0x4cf817===_0x6acc('0x79')||_0x4cf817===_0x6acc('0x7d')||_0x4cf817==='rtpaudioqosrtt'||_0x4cf817==='rtpaudioqosrttbridged'||_0x4cf817===_0x6acc('0x7e')||_0x4cf817===_0x6acc('0x7f')||_0x4cf817===_0x6acc('0x33')||_0x4cf817==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3d3547,_0x3aefe2){var _0x211f48,_0x4eb598,_0x51f5c3;if(_0x3aefe2<=0x0){_0x3aefe2=0x1;}_0x211f48=new RegExp(_0x6acc('0x80')+_0x3aefe2+'}$');_0x4eb598=Math[_0x6acc('0x81')](0xa,_0x3aefe2-0x1);_0x51f5c3=Math[_0x6acc('0x81')](0xa,_0x3aefe2)-0x1;return util['format']('%s',_[_0x6acc('0x82')](_0x3d3547,_0x211f48,_[_0x6acc('0x83')](_0x4eb598,_0x51f5c3)));};exports[_0x6acc('0x84')]=function(_0x161b88){var _0xf3f6c4=_0x161b88[_0x6acc('0x85')](/"(.*?)"/);return _0xf3f6c4?_0xf3f6c4[0x1]:_0x161b88;};exports[_0x6acc('0x86')]=function(_0x358824){var _0x1b20dd=_0x358824[_0x6acc('0x85')](/<(.*?)>/);return _0x1b20dd?_0x1b20dd[0x1]:_0x358824;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f76d0ee..573ddf1 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(_0x10e278,_0x463dbc){var _0x2aab43=function(_0x3299a1){while(--_0x3299a1){_0x10e278['push'](_0x10e278['shift']());}};_0x2aab43(++_0x463dbc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20d72e,_0x534501){_0x20d72e=_0x20d72e-0x0;var _0x2580d6=_0x5f2f[_0x20d72e];return _0x2580d6;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x3ec8e2,_0x1a74a9){var _0xbb1dc7=function(_0x5ddeb6){while(--_0x5ddeb6){_0x3ec8e2['push'](_0x3ec8e2['shift']());}};_0xbb1dc7(++_0x1a74a9);}(_0xb10b,0x12a));var _0xbb10=function(_0x34ebf3,_0x5935c5){_0x34ebf3=_0x34ebf3-0x0;var _0x3a634d=_0xb10b[_0x34ebf3];return _0x3a634d;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7057a44..fa14056 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 _0xef36=['sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','total','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initTemplates','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','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/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered'];(function(_0x1ca65d,_0x53fbc3){var _0x31cc85=function(_0x35b3bf){while(--_0x35b3bf){_0x1ca65d['push'](_0x1ca65d['shift']());}};_0x31cc85(++_0x53fbc3);}(_0xef36,0x18c));var _0x6ef3=function(_0x216544,_0x53c788){_0x216544=_0x216544-0x0;var _0xa25add=_0xef36[_0x216544];return _0xa25add;};'use strict';var BPromise=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var _=require(_0x6ef3('0x2'));var moment=require(_0x6ef3('0x3'));var Agent=require(_0x6ef3('0x4'));var Telephone=require(_0x6ef3('0x5'));var Trunk=require(_0x6ef3('0x6'));var VoiceQueue=require(_0x6ef3('0x7'));var Trigger=require('../model/trigger');var Template=require(_0x6ef3('0x8'));var Campaign=require(_0x6ef3('0x9'));var VoiceExtension=require(_0x6ef3('0xa'));var ZendeskAccount=require(_0x6ef3('0xb'));var SalesforceAccount=require(_0x6ef3('0xc'));var FreshdeskAccount=require(_0x6ef3('0xd'));var SugarcrmAccount=require(_0x6ef3('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x6ef3('0xf'));var VtigerAccount=require(_0x6ef3('0x10'));var ServicenowAccount=require(_0x6ef3('0x11'));var Dynamics365Account=require(_0x6ef3('0x12'));var FreshsalesAccount=require(_0x6ef3('0x13'));var FaxAccount=require(_0x6ef3('0x14'));var Realtime=function(){this[_0x6ef3('0x15')]={};this[_0x6ef3('0x16')]={};this[_0x6ef3('0x17')]={};this[_0x6ef3('0x18')]={};this[_0x6ef3('0x19')]={};this[_0x6ef3('0x1a')]={};this[_0x6ef3('0x1b')]={};this[_0x6ef3('0x1c')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x6ef3('0x1d')]={};this[_0x6ef3('0x1e')]={};this[_0x6ef3('0x1f')]={};this[_0x6ef3('0x20')]={};this['zendeskAccounts']={};this[_0x6ef3('0x21')]={};this[_0x6ef3('0x22')]={};this[_0x6ef3('0x23')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x6ef3('0x24')]={};this[_0x6ef3('0x25')]={};this[_0x6ef3('0x26')]={};this['freshsalesAccounts']={};this[_0x6ef3('0x27')]={};};function freeIsNotKey(_0x28d22c,_0x2ae649,_0x4f0125){var _0x4a1234=_[_0x6ef3('0x28')](_0x28d22c,function(_0x5db525,_0x391da1){return _0x5db525[_0x4f0125];});for(var _0x363912 in _0x2ae649){if(_0x2ae649[_0x6ef3('0x29')](_0x363912)){if(!_0x4a1234[_0x363912]){delete _0x2ae649[_0x363912];}}}}function freeIsNotKeySip(_0x3d2ca3,_0x457843){var _0xe51bf1=_['mapKeys'](_0x3d2ca3,function(_0x3068ee,_0x2254cb){return util[_0x6ef3('0x2a')](_0x6ef3('0x2b'),_0x3068ee[_0x6ef3('0x2c')]);});for(var _0x46e476 in _0x457843){if(_0x457843[_0x6ef3('0x29')](_0x46e476)){if(!_0xe51bf1[_0x46e476]){delete _0x457843[_0x46e476];}}}}function freeIsNotKeyAgent(_0x56a743,_0x61939f){var _0x4690e1=_[_0x6ef3('0x28')](_0x56a743,function(_0x27e049,_0x1f0b62){var _0x3b1a24=_[_0x6ef3('0x2d')](_0x27e049[_0x6ef3('0x2e')])?util['format'](_0x6ef3('0x2b'),_0x27e049[_0x6ef3('0x2c')]):_0x27e049['interface'];return _0x3b1a24;});for(var _0x5abbfd in _0x61939f){if(_0x61939f['hasOwnProperty'](_0x5abbfd)){if(!_0x4690e1[_0x5abbfd]){delete _0x61939f[_0x5abbfd];}}}}function clearVoiceCallReports(_0x42b28f){_0x42b28f['total']=0x0;_0x42b28f[_0x6ef3('0x2f')]=0x0;_0x42b28f[_0x6ef3('0x30')]=0x0;_0x42b28f[_0x6ef3('0x31')]=0x0;_0x42b28f['sumBillable']=0x0;}function clearCampaigns(_0x5e4a68){if(!_[_0x6ef3('0x32')](_0x5e4a68)){for(var _0x22f69d in _0x5e4a68){if(_0x5e4a68[_0x6ef3('0x29')](_0x22f69d)){_0x5e4a68[_0x22f69d][_0x6ef3('0x33')]=0x0;_0x5e4a68[_0x22f69d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x26c8bf){if(!_[_0x6ef3('0x32')](_0x26c8bf)){for(var _0x333bb4 in _0x26c8bf){if(_0x26c8bf['hasOwnProperty'](_0x333bb4)){_0x26c8bf[_0x333bb4][_0x6ef3('0x34')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x2f')]=0x0;_0x26c8bf[_0x333bb4]['unmanaged']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x35')]=0x0;_0x26c8bf[_0x333bb4]['sumHoldTime']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x31')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x36')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x37')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x38')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x39')]=0x0;_0x26c8bf[_0x333bb4]['outboundCongestionCallsDay']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3a')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3b')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3c')]=0x0;_0x26c8bf[_0x333bb4]['outboundDropCallsDayCallersExit']=0x0;_0x26c8bf[_0x333bb4]['outboundBlacklistCallsDay']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3d')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3e')]=0x0;_0x26c8bf[_0x333bb4]['outboundReCallsDay']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x37')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3f')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x40')]=!![];}}}}Realtime['prototype'][_0x6ef3('0x41')]=function(_0x1f2ea7,_0x5328e5){for(var _0x55476c in _0x5328e5){if(_0x1f2ea7['hasOwnProperty'](_0x55476c)){_0x1f2ea7[_0x55476c]=_0x5328e5[_0x55476c];}}};Realtime[_0x6ef3('0x42')]['initAgents']=function(){var _0x2658bc=this;return function(_0x363331){if(_0x363331){freeIsNotKeyAgent(_0x363331,_0x2658bc[_0x6ef3('0x15')]);for(var _0x3167d1=0x0,_0x2893f0={},_0x137f46={};_0x3167d1<_0x363331['length'];_0x3167d1+=0x1){_0x2893f0=_0x363331[_0x3167d1];var _0x259eac=_['isNil'](_0x2893f0['interface'])?util['format'](_0x6ef3('0x2b'),_0x2893f0['name']):_0x2893f0['interface'];if(_[_0x6ef3('0x43')](_0x2658bc[_0x6ef3('0x15')][_0x259eac])){_0x2658bc[_0x6ef3('0x15')][_0x259eac]=new Agent(_0x2893f0);}else{_0x2658bc['mergeFromDatabase'](_0x2658bc[_0x6ef3('0x15')][_0x259eac],_0x2893f0);}}}return _0x2658bc[_0x6ef3('0x15')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x44')]=function(){var _0xddabbe=this;return function(_0x3c8eb5){if(_0x3c8eb5){freeIsNotKeySip(_0x3c8eb5,_0xddabbe['telephones']);for(var _0x2996f2=0x0,_0x4e5856={},_0x3933f7={};_0x2996f2<_0x3c8eb5[_0x6ef3('0x45')];_0x2996f2+=0x1){_0x4e5856=_0x3c8eb5[_0x2996f2];if(_[_0x6ef3('0x43')](_0xddabbe['telephones'][util[_0x6ef3('0x2a')]('SIP/%s',_0x4e5856[_0x6ef3('0x2c')])])){_0xddabbe['telephones'][util[_0x6ef3('0x2a')](_0x6ef3('0x2b'),_0x4e5856[_0x6ef3('0x2c')])]=new Telephone(_0x4e5856);}else{_0xddabbe[_0x6ef3('0x41')](_0xddabbe[_0x6ef3('0x16')][util['format'](_0x6ef3('0x2b'),_0x4e5856[_0x6ef3('0x2c')])],_0x4e5856);}}}return _0xddabbe[_0x6ef3('0x16')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x46')]=function(){var _0x39dc7a=this;return function(_0x46e4b2){if(_0x46e4b2){freeIsNotKeySip(_0x46e4b2,_0x39dc7a[_0x6ef3('0x17')]);for(var _0x3a76e2=0x0,_0x3ff750={},_0x32e917={};_0x3a76e2<_0x46e4b2[_0x6ef3('0x45')];_0x3a76e2+=0x1){_0x3ff750=_0x46e4b2[_0x3a76e2];if(_[_0x6ef3('0x43')](_0x39dc7a[_0x6ef3('0x17')][util['format']('SIP/%s',_0x3ff750[_0x6ef3('0x2c')])])){_0x39dc7a[_0x6ef3('0x17')][util['format'](_0x6ef3('0x2b'),_0x3ff750[_0x6ef3('0x2c')])]=new Trunk(_0x3ff750);}else{_0x39dc7a[_0x6ef3('0x41')](_0x39dc7a[_0x6ef3('0x17')][util[_0x6ef3('0x2a')](_0x6ef3('0x2b'),_0x3ff750['name'])],_0x3ff750);}}}return _0x39dc7a[_0x6ef3('0x17')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x47')]=function(){var _0x1bff38=this;return function(_0x56e190){if(_0x56e190){freeIsNotKey(_0x56e190,_0x1bff38['voiceQueues'],_0x6ef3('0x2c'));for(var _0x525f52=0x0,_0x3236ab={},_0x430092={};_0x525f52<_0x56e190['length'];_0x525f52+=0x1){_0x3236ab=_0x56e190[_0x525f52];if(_['isUndefined'](_0x1bff38[_0x6ef3('0x18')][_0x3236ab['name']])){_0x1bff38[_0x6ef3('0x18')][_0x3236ab[_0x6ef3('0x2c')]]=new VoiceQueue(_0x3236ab);}else{_0x1bff38['mergeFromDatabase'](_0x1bff38[_0x6ef3('0x18')][_0x3236ab[_0x6ef3('0x2c')]],_0x3236ab);}}}return _0x1bff38[_0x6ef3('0x18')];};};Realtime['prototype'][_0x6ef3('0x48')]=function(){var _0x449d7c=this;return function(_0x2dd844){if(_0x2dd844){freeIsNotKey(_0x2dd844,_0x449d7c[_0x6ef3('0x19')],'id');for(var _0x1420b8=0x0,_0xb429b9={},_0x537006={};_0x1420b8<_0x2dd844[_0x6ef3('0x45')];_0x1420b8+=0x1){_0xb429b9=_0x2dd844[_0x1420b8];if(_[_0x6ef3('0x43')](_0x449d7c[_0x6ef3('0x19')][_0xb429b9['id']])){_0x449d7c[_0x6ef3('0x19')][_0xb429b9['id']]=new Trigger(_0xb429b9);}else{_0x449d7c[_0x6ef3('0x41')](_0x449d7c[_0x6ef3('0x19')][_0xb429b9['id']],_0xb429b9);}}}return _0x449d7c[_0x6ef3('0x19')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x49')]=function(){var _0x5cb275=this;return function(_0x1f4eab){if(_0x1f4eab){freeIsNotKey(_0x1f4eab,_0x5cb275[_0x6ef3('0x1b')],'id');for(var _0x137a38=0x0,_0x4f7051={},_0x12655a={};_0x137a38<_0x1f4eab[_0x6ef3('0x45')];_0x137a38+=0x1){_0x4f7051=_0x1f4eab[_0x137a38];if(_[_0x6ef3('0x43')](_0x5cb275['templates'][_0x4f7051['id']])){_0x5cb275['templates'][_0x4f7051['id']]=new Template(_0x4f7051);}else{_0x5cb275[_0x6ef3('0x41')](_0x5cb275['templates'][_0x4f7051['id']],_0x4f7051);}}}return _0x5cb275[_0x6ef3('0x1b')];};};Realtime[_0x6ef3('0x42')]['initZendeskAccounts']=function(){var _0x463e1f=this;return function(_0x2bacf8){if(_0x2bacf8){freeIsNotKey(_0x2bacf8,_0x463e1f[_0x6ef3('0x4a')],'id');for(var _0x1ef0d2=0x0,_0x301ddb={},_0x2fdbf8={};_0x1ef0d2<_0x2bacf8[_0x6ef3('0x45')];_0x1ef0d2+=0x1){_0x301ddb=_0x2bacf8[_0x1ef0d2];if(_[_0x6ef3('0x43')](_0x463e1f['zendeskAccounts'][_0x301ddb['id']])){_0x463e1f['zendeskAccounts'][_0x301ddb['id']]=new ZendeskAccount(_0x301ddb);}else{_0x463e1f[_0x6ef3('0x41')](_0x463e1f['zendeskAccounts'][_0x301ddb['id']],_0x301ddb);}}}return _0x463e1f['zendeskAccounts'];};};Realtime[_0x6ef3('0x42')]['initSalesforceAccounts']=function(){var _0x9b8dde=this;return function(_0x44d637){if(_0x44d637){freeIsNotKey(_0x44d637,_0x9b8dde[_0x6ef3('0x21')],'id');for(var _0x349d2=0x0,_0x2039fd={},_0xe8bf24={};_0x349d2<_0x44d637[_0x6ef3('0x45')];_0x349d2+=0x1){_0x2039fd=_0x44d637[_0x349d2];if(_['isUndefined'](_0x9b8dde[_0x6ef3('0x21')][_0x2039fd['id']])){_0x9b8dde['salesforceAccounts'][_0x2039fd['id']]=new SalesforceAccount(_0x2039fd);}else{_0x9b8dde[_0x6ef3('0x41')](_0x9b8dde[_0x6ef3('0x21')][_0x2039fd['id']],_0x2039fd);}}}return _0x9b8dde['salesforceAccounts'];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x4b')]=function(){var _0x34ae04=this;return function(_0x4bde8b){if(_0x4bde8b){freeIsNotKey(_0x4bde8b,_0x34ae04[_0x6ef3('0x23')],'id');for(var _0x404c15=0x0,_0x5e3d66={},_0x590861={};_0x404c15<_0x4bde8b[_0x6ef3('0x45')];_0x404c15+=0x1){_0x5e3d66=_0x4bde8b[_0x404c15];if(_[_0x6ef3('0x43')](_0x34ae04[_0x6ef3('0x23')][_0x5e3d66['id']])){_0x34ae04['freshdeskAccounts'][_0x5e3d66['id']]=new FreshdeskAccount(_0x5e3d66);}else{_0x34ae04[_0x6ef3('0x41')](_0x34ae04[_0x6ef3('0x23')][_0x5e3d66['id']],_0x5e3d66);}}}return _0x34ae04[_0x6ef3('0x23')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x4c')]=function(){var _0x23d8dc=this;return function(_0x2f8a5c){if(_0x2f8a5c){freeIsNotKey(_0x2f8a5c,_0x23d8dc[_0x6ef3('0x4d')],'id');for(var _0x38f6d4=0x0,_0x152fc6={},_0x23ffde={};_0x38f6d4<_0x2f8a5c['length'];_0x38f6d4+=0x1){_0x152fc6=_0x2f8a5c[_0x38f6d4];if(_['isUndefined'](_0x23d8dc[_0x6ef3('0x4d')][_0x152fc6['id']])){_0x23d8dc[_0x6ef3('0x4d')][_0x152fc6['id']]=new ZohoAccount(_0x152fc6);}else{_0x23d8dc['mergeFromDatabase'](_0x23d8dc[_0x6ef3('0x4d')][_0x152fc6['id']],_0x152fc6);}}}return _0x23d8dc[_0x6ef3('0x4d')];};};Realtime[_0x6ef3('0x42')]['initDeskAccounts']=function(){var _0x490982=this;return function(_0x590a25){if(_0x590a25){freeIsNotKey(_0x590a25,_0x490982[_0x6ef3('0x4e')],'id');for(var _0x41fb29=0x0,_0x6d2a50={},_0x641f1c={};_0x41fb29<_0x590a25['length'];_0x41fb29+=0x1){_0x6d2a50=_0x590a25[_0x41fb29];if(_[_0x6ef3('0x43')](_0x490982[_0x6ef3('0x4e')][_0x6d2a50['id']])){_0x490982[_0x6ef3('0x4e')][_0x6d2a50['id']]=new DeskAccount(_0x6d2a50);}else{_0x490982[_0x6ef3('0x41')](_0x490982['deskAccounts'][_0x6d2a50['id']],_0x6d2a50);}}}return _0x490982[_0x6ef3('0x4e')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x4f')]=function(){var _0x302422=this;return function(_0x2d2fe0){if(_0x2d2fe0){freeIsNotKey(_0x2d2fe0,_0x302422[_0x6ef3('0x22')],'id');for(var _0x30a406=0x0,_0x5290e3={},_0x3eb2ad={};_0x30a406<_0x2d2fe0[_0x6ef3('0x45')];_0x30a406+=0x1){_0x5290e3=_0x2d2fe0[_0x30a406];if(_[_0x6ef3('0x43')](_0x302422[_0x6ef3('0x22')][_0x5290e3['id']])){_0x302422[_0x6ef3('0x22')][_0x5290e3['id']]=new SugarcrmAccount(_0x5290e3);}else{_0x302422[_0x6ef3('0x41')](_0x302422[_0x6ef3('0x22')][_0x5290e3['id']],_0x5290e3);}}}return _0x302422[_0x6ef3('0x22')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x50')]=function(){var _0x370973=this;return function(_0x49b06e){if(_0x49b06e){freeIsNotKey(_0x49b06e,_0x370973[_0x6ef3('0x24')],'id');for(var _0x70b84f=0x0,_0x614efc={},_0x5b1bf8={};_0x70b84f<_0x49b06e[_0x6ef3('0x45')];_0x70b84f+=0x1){_0x614efc=_0x49b06e[_0x70b84f];if(_[_0x6ef3('0x43')](_0x370973[_0x6ef3('0x24')][_0x614efc['id']])){_0x370973[_0x6ef3('0x24')][_0x614efc['id']]=new VtigerAccount(_0x614efc);}else{_0x370973[_0x6ef3('0x41')](_0x370973[_0x6ef3('0x24')][_0x614efc['id']],_0x614efc);}}}return _0x370973[_0x6ef3('0x24')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x51')]=function(){var _0x591f57=this;return function(_0x13d61a){if(_0x13d61a){freeIsNotKey(_0x13d61a,_0x591f57[_0x6ef3('0x25')],'id');for(var _0x309dad=0x0,_0x534ea9={},_0x2d7617={};_0x309dad<_0x13d61a[_0x6ef3('0x45')];_0x309dad+=0x1){_0x534ea9=_0x13d61a[_0x309dad];if(_[_0x6ef3('0x43')](_0x591f57[_0x6ef3('0x25')][_0x534ea9['id']])){_0x591f57[_0x6ef3('0x25')][_0x534ea9['id']]=new ServicenowAccount(_0x534ea9);}else{_0x591f57[_0x6ef3('0x41')](_0x591f57[_0x6ef3('0x25')][_0x534ea9['id']],_0x534ea9);}}}return _0x591f57[_0x6ef3('0x25')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x52')]=function(){var _0x324448=this;return function(_0x28da4e){if(_0x28da4e){freeIsNotKey(_0x28da4e,_0x324448[_0x6ef3('0x26')],'id');for(var _0x3222e4=0x0,_0x199521={},_0x5a5e52={};_0x3222e4<_0x28da4e['length'];_0x3222e4+=0x1){_0x199521=_0x28da4e[_0x3222e4];if(_['isUndefined'](_0x324448[_0x6ef3('0x26')][_0x199521['id']])){_0x324448[_0x6ef3('0x26')][_0x199521['id']]=new Dynamics365Account(_0x199521);}else{_0x324448[_0x6ef3('0x41')](_0x324448['dynamics365Accounts'][_0x199521['id']],_0x199521);}}}return _0x324448[_0x6ef3('0x26')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x53')]=function(){var _0x4278c0=this;return function(_0x469c69){if(_0x469c69){freeIsNotKey(_0x469c69,_0x4278c0[_0x6ef3('0x54')],'id');for(var _0x42eedb=0x0,_0x19858d={},_0x19a44d={};_0x42eedb<_0x469c69[_0x6ef3('0x45')];_0x42eedb+=0x1){_0x19858d=_0x469c69[_0x42eedb];if(_[_0x6ef3('0x43')](_0x4278c0[_0x6ef3('0x54')][_0x19858d['id']])){_0x4278c0[_0x6ef3('0x54')][_0x19858d['id']]=new FreshsalesAccount(_0x19858d);}else{_0x4278c0[_0x6ef3('0x41')](_0x4278c0[_0x6ef3('0x54')][_0x19858d['id']],_0x19858d);}}}return _0x4278c0[_0x6ef3('0x54')];};};Realtime['prototype'][_0x6ef3('0x55')]=function(){var _0x4859e3=this;return function(_0x55abd8){for(var _0x48ca39=0x0;_0x48ca39<_0x55abd8[_0x6ef3('0x45')];_0x48ca39+=0x1){_[_0x6ef3('0x56')](_0x4859e3[_0x6ef3('0x18')][_0x55abd8[_0x48ca39][_0x6ef3('0x2c')]],_0x55abd8[_0x48ca39]);}return _0x4859e3[_0x6ef3('0x18')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x57')]=function(){var _0x288313=this;return function(_0x282306){clearVoiceQueues(_0x288313[_0x6ef3('0x18')]);if(_0x282306){_0x282306=_[_0x6ef3('0x58')](_0x282306,_0x6ef3('0x59'));for(var _0x27d33c in _0x282306){if(_0x282306['hasOwnProperty'](_0x27d33c)){var _0x278429={};for(var _0x3f24e7=0x0;_0x3f24e7<_0x282306[_0x27d33c][_0x6ef3('0x45')];_0x3f24e7+=0x1){var _0x6f6b19=_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5a')];if(_0x288313[_0x6ef3('0x18')][_0x6f6b19]){if(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5b')]){_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x5c')]+=0x1;}if(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5d')]){_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x35')]+=0x1;}_0x288313[_0x6ef3('0x18')][_0x6f6b19]['sumHoldTime']+=moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5e')])[_0x6ef3('0x5f')](moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x60')]),'seconds')||0x0;if(_0x3f24e7===_0x282306[_0x27d33c][_0x6ef3('0x45')]-0x1){_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x31')]+=moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x61')]||_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x62')]||_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x63')])[_0x6ef3('0x5f')](moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x60')]),'seconds')||0x0;_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x34')]+=0x1;if(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x64')]){_0x288313[_0x6ef3('0x18')][_0x6f6b19]['answered']+=0x1;_0x288313['voiceQueues'][_0x6f6b19][_0x6ef3('0x36')]+=moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x61')])['diff'](moment(_0x282306[_0x27d33c][_0x3f24e7]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x31')]+=_0x288313[_0x6ef3('0x18')][_0x6f6b19]['sumHoldTime']||0x0;}}}}}}return _0x288313[_0x6ef3('0x18')];};};Realtime[_0x6ef3('0x42')]['initVoiceCallReports']=function(){var _0x2447e2=this;return function(_0x33680c){clearVoiceCallReports(_0x2447e2[_0x6ef3('0x1c')]);if(_0x33680c){for(var _0x540069=0x0;_0x540069<_0x33680c[_0x6ef3('0x45')];_0x540069+=0x1){_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x34')]+=0x1;_0x2447e2[_0x6ef3('0x1c')]['sumDuration']+=_0x33680c[_0x540069][_0x6ef3('0x65')];if(_0x33680c[_0x540069][_0x6ef3('0x66')]===_0x6ef3('0x67')){_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x2f')]+=0x1;_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x30')]+=_0x33680c[_0x540069][_0x6ef3('0x65')]-_0x33680c[_0x540069][_0x6ef3('0x68')]||0x0;_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x36')]+=_0x33680c[_0x540069][_0x6ef3('0x68')];}}}return _0x2447e2[_0x6ef3('0x1c')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x69')]=function(){var _0x5e14fe=this;return function(_0x138e3f){if(_0x138e3f){freeIsNotKey(_0x138e3f,_0x5e14fe[_0x6ef3('0x1a')],_0x6ef3('0x2c'));for(var _0x2697d4=0x0,_0x5468f0={};_0x2697d4<_0x138e3f[_0x6ef3('0x45')];_0x2697d4+=0x1){_0x5468f0=_0x138e3f[_0x2697d4];if(_['isUndefined'](_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]])){_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]]=new Campaign(_0x5468f0);}else{_0x5e14fe['mergeFromDatabase'](_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]],_0x5468f0);_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]][_0x6ef3('0x6a')]=_0x5468f0[_0x6ef3('0x6b')]?_0x5468f0[_0x6ef3('0x6b')][_0x6ef3('0x2c')]:undefined;}}}return _0x5e14fe[_0x6ef3('0x1a')];};};Realtime['prototype'][_0x6ef3('0x6c')]=function(){var _0x24004c=this;return function(_0x10b766){if(_0x10b766){freeIsNotKey(_0x10b766,_0x24004c[_0x6ef3('0x6d')],'id');for(var _0x330589=0x0,_0x3efbad={};_0x330589<_0x10b766[_0x6ef3('0x45')];_0x330589+=0x1){_0x3efbad=_0x10b766[_0x330589];if(_['isUndefined'](_0x24004c[_0x6ef3('0x6d')][_0x3efbad['id']])){_0x24004c[_0x6ef3('0x6d')][_0x3efbad['id']]=new VoiceExtension(_0x3efbad);}else{_0x24004c[_0x6ef3('0x41')](_0x24004c[_0x6ef3('0x6d')][_0x3efbad['id']],_0x3efbad);}}}return _0x24004c[_0x6ef3('0x6d')];};};Realtime[_0x6ef3('0x42')]['initCampaignHopperHistory']=function(){var _0x794fcd=this;return function(_0x1f84e9){clearCampaigns(_0x794fcd[_0x6ef3('0x1a')]);for(var _0x4d3530=0x0;_0x4d3530<_0x1f84e9[_0x6ef3('0x45')];_0x4d3530+=0x1){_[_0x6ef3('0x56')](_0x794fcd[_0x6ef3('0x1a')][_0x1f84e9[_0x4d3530][_0x6ef3('0x2c')]],_0x1f84e9[_0x4d3530]);}return _0x794fcd['campaigns'];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x5729ab=this;return function(_0x44089a){if(_0x44089a){freeIsNotKey(_0x44089a,_0x5729ab[_0x6ef3('0x27')],'id');for(var _0xdf9649=0x0,_0x31ca21={},_0x3f0132={};_0xdf9649<_0x44089a['length'];_0xdf9649+=0x1){_0x31ca21=_0x44089a[_0xdf9649];if(_['isUndefined'](_0x5729ab[_0x6ef3('0x27')][_0x31ca21['id']])){_0x5729ab[_0x6ef3('0x27')][_0x31ca21['id']]=new FaxAccount(_0x31ca21);}else{_0x5729ab['mergeFromDatabase'](_0x5729ab['faxAccounts'][_0x31ca21['id']],_0x31ca21);}}}return _0x5729ab['faxAccounts'];};};module[_0x6ef3('0x6e')]=Realtime; \ No newline at end of file +var _0x1899=['../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','SIP/%s','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','trunks','initVoiceQueues','initTriggers','triggers','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template'];(function(_0x40d339,_0xb726c3){var _0x5cbd0b=function(_0xf239d3){while(--_0xf239d3){_0x40d339['push'](_0x40d339['shift']());}};_0x5cbd0b(++_0xb726c3);}(_0x1899,0x148));var _0x9189=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1899[_0x11005e];return _0x29338f;};'use strict';var BPromise=require(_0x9189('0x0'));var util=require('util');var _=require(_0x9189('0x1'));var moment=require(_0x9189('0x2'));var Agent=require(_0x9189('0x3'));var Telephone=require(_0x9189('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x9189('0x5'));var Trigger=require(_0x9189('0x6'));var Template=require(_0x9189('0x7'));var Campaign=require(_0x9189('0x8'));var VoiceExtension=require(_0x9189('0x9'));var ZendeskAccount=require(_0x9189('0xa'));var SalesforceAccount=require(_0x9189('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x9189('0xc'));var ZohoAccount=require(_0x9189('0xd'));var DeskAccount=require(_0x9189('0xe'));var VtigerAccount=require(_0x9189('0xf'));var ServicenowAccount=require(_0x9189('0x10'));var Dynamics365Account=require(_0x9189('0x11'));var FreshsalesAccount=require(_0x9189('0x12'));var FaxAccount=require(_0x9189('0x13'));var Realtime=function(){this[_0x9189('0x14')]={};this[_0x9189('0x15')]={};this['trunks']={};this[_0x9189('0x16')]={};this['triggers']={};this[_0x9189('0x17')]={};this[_0x9189('0x18')]={};this[_0x9189('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9189('0x1a')]={};this[_0x9189('0x1b')]={};this[_0x9189('0x1c')]={};this['outboundChannels']={};this[_0x9189('0x1d')]={};this['zendeskAccounts']={};this[_0x9189('0x1e')]={};this[_0x9189('0x1f')]={};this['freshdeskAccounts']={};this[_0x9189('0x20')]={};this[_0x9189('0x21')]={};this[_0x9189('0x22')]={};this[_0x9189('0x23')]={};this[_0x9189('0x24')]={};this['freshsalesAccounts']={};this[_0x9189('0x25')]={};};function freeIsNotKey(_0x4d2918,_0x1ff9fe,_0x42d6cc){var _0x3a0981=_[_0x9189('0x26')](_0x4d2918,function(_0xad445f,_0x25e748){return _0xad445f[_0x42d6cc];});for(var _0x4c7c1e in _0x1ff9fe){if(_0x1ff9fe[_0x9189('0x27')](_0x4c7c1e)){if(!_0x3a0981[_0x4c7c1e]){delete _0x1ff9fe[_0x4c7c1e];}}}}function freeIsNotKeySip(_0x298efa,_0x248f84){var _0x37cbe7=_[_0x9189('0x26')](_0x298efa,function(_0x37193a,_0x4c144a){return util[_0x9189('0x28')]('SIP/%s',_0x37193a[_0x9189('0x29')]);});for(var _0x52c075 in _0x248f84){if(_0x248f84[_0x9189('0x27')](_0x52c075)){if(!_0x37cbe7[_0x52c075]){delete _0x248f84[_0x52c075];}}}}function freeIsNotKeyAgent(_0x4f8f15,_0x406e8c){var _0x1d0284=_['mapKeys'](_0x4f8f15,function(_0x444b7d,_0xd2df72){var _0x28312a=_[_0x9189('0x2a')](_0x444b7d['interface'])?util[_0x9189('0x28')](_0x9189('0x2b'),_0x444b7d['name']):_0x444b7d[_0x9189('0x2c')];return _0x28312a;});for(var _0x514977 in _0x406e8c){if(_0x406e8c[_0x9189('0x27')](_0x514977)){if(!_0x1d0284[_0x514977]){delete _0x406e8c[_0x514977];}}}}function clearVoiceCallReports(_0x12bd2c){_0x12bd2c[_0x9189('0x2d')]=0x0;_0x12bd2c['answered']=0x0;_0x12bd2c[_0x9189('0x2e')]=0x0;_0x12bd2c[_0x9189('0x2f')]=0x0;_0x12bd2c[_0x9189('0x30')]=0x0;}function clearCampaigns(_0x33d3ea){if(!_[_0x9189('0x31')](_0x33d3ea)){for(var _0x5f3cc1 in _0x33d3ea){if(_0x33d3ea[_0x9189('0x27')](_0x5f3cc1)){_0x33d3ea[_0x5f3cc1][_0x9189('0x32')]=0x0;_0x33d3ea[_0x5f3cc1][_0x9189('0x33')]=0x0;}}}}function clearVoiceQueues(_0x4dcbea){if(!_[_0x9189('0x31')](_0x4dcbea)){for(var _0x3ed31a in _0x4dcbea){if(_0x4dcbea[_0x9189('0x27')](_0x3ed31a)){_0x4dcbea[_0x3ed31a][_0x9189('0x2d')]=0x0;_0x4dcbea[_0x3ed31a]['answered']=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x34')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x35')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x2e')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x2f')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x30')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x36')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x37')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x38')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x39')]=0x0;_0x4dcbea[_0x3ed31a]['outboundNoSuchCallsDay']=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x3a')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x3b')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x3c')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x3d')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x3e')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x3f')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x40')]=0x0;_0x4dcbea[_0x3ed31a]['outboundAnswerAgiCallsDay']=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x41')]=0x0;_0x4dcbea[_0x3ed31a][_0x9189('0x42')]=!![];}}}}Realtime[_0x9189('0x43')][_0x9189('0x44')]=function(_0x187b90,_0x37637b){for(var _0x48bea9 in _0x37637b){if(_0x187b90[_0x9189('0x27')](_0x48bea9)){_0x187b90[_0x48bea9]=_0x37637b[_0x48bea9];}}};Realtime[_0x9189('0x43')][_0x9189('0x45')]=function(){var _0x1dfa57=this;return function(_0x7ca44e){if(_0x7ca44e){freeIsNotKeyAgent(_0x7ca44e,_0x1dfa57[_0x9189('0x14')]);for(var _0x1fa41d=0x0,_0x4c87f7={},_0xce9db6={};_0x1fa41d<_0x7ca44e['length'];_0x1fa41d+=0x1){_0x4c87f7=_0x7ca44e[_0x1fa41d];var _0x5db4c0=_['isNil'](_0x4c87f7[_0x9189('0x2c')])?util['format'](_0x9189('0x2b'),_0x4c87f7['name']):_0x4c87f7[_0x9189('0x2c')];if(_[_0x9189('0x46')](_0x1dfa57[_0x9189('0x14')][_0x5db4c0])){_0x1dfa57[_0x9189('0x14')][_0x5db4c0]=new Agent(_0x4c87f7);}else{_0x1dfa57[_0x9189('0x44')](_0x1dfa57[_0x9189('0x14')][_0x5db4c0],_0x4c87f7);}}}return _0x1dfa57['agents'];};};Realtime[_0x9189('0x43')][_0x9189('0x47')]=function(){var _0x564756=this;return function(_0x12ce60){if(_0x12ce60){freeIsNotKeySip(_0x12ce60,_0x564756[_0x9189('0x15')]);for(var _0x34a86e=0x0,_0x415271={},_0x46936a={};_0x34a86e<_0x12ce60[_0x9189('0x48')];_0x34a86e+=0x1){_0x415271=_0x12ce60[_0x34a86e];if(_[_0x9189('0x46')](_0x564756[_0x9189('0x15')][util[_0x9189('0x28')](_0x9189('0x2b'),_0x415271[_0x9189('0x29')])])){_0x564756['telephones'][util[_0x9189('0x28')]('SIP/%s',_0x415271[_0x9189('0x29')])]=new Telephone(_0x415271);}else{_0x564756[_0x9189('0x44')](_0x564756[_0x9189('0x15')][util[_0x9189('0x28')](_0x9189('0x2b'),_0x415271['name'])],_0x415271);}}}return _0x564756[_0x9189('0x15')];};};Realtime[_0x9189('0x43')][_0x9189('0x49')]=function(){var _0x1f7631=this;return function(_0x5802e1){if(_0x5802e1){freeIsNotKeySip(_0x5802e1,_0x1f7631[_0x9189('0x4a')]);for(var _0xf7ef95=0x0,_0x248f12={},_0x1f39f0={};_0xf7ef95<_0x5802e1[_0x9189('0x48')];_0xf7ef95+=0x1){_0x248f12=_0x5802e1[_0xf7ef95];if(_[_0x9189('0x46')](_0x1f7631[_0x9189('0x4a')][util[_0x9189('0x28')](_0x9189('0x2b'),_0x248f12['name'])])){_0x1f7631[_0x9189('0x4a')][util[_0x9189('0x28')](_0x9189('0x2b'),_0x248f12[_0x9189('0x29')])]=new Trunk(_0x248f12);}else{_0x1f7631[_0x9189('0x44')](_0x1f7631[_0x9189('0x4a')][util[_0x9189('0x28')]('SIP/%s',_0x248f12[_0x9189('0x29')])],_0x248f12);}}}return _0x1f7631[_0x9189('0x4a')];};};Realtime[_0x9189('0x43')][_0x9189('0x4b')]=function(){var _0x471385=this;return function(_0x5c46c3){if(_0x5c46c3){freeIsNotKey(_0x5c46c3,_0x471385[_0x9189('0x16')],_0x9189('0x29'));for(var _0x3d0df1=0x0,_0x5da0fe={},_0x4b565b={};_0x3d0df1<_0x5c46c3['length'];_0x3d0df1+=0x1){_0x5da0fe=_0x5c46c3[_0x3d0df1];if(_['isUndefined'](_0x471385[_0x9189('0x16')][_0x5da0fe[_0x9189('0x29')]])){_0x471385[_0x9189('0x16')][_0x5da0fe['name']]=new VoiceQueue(_0x5da0fe);}else{_0x471385['mergeFromDatabase'](_0x471385[_0x9189('0x16')][_0x5da0fe[_0x9189('0x29')]],_0x5da0fe);}}}return _0x471385[_0x9189('0x16')];};};Realtime[_0x9189('0x43')][_0x9189('0x4c')]=function(){var _0xbae8a=this;return function(_0x182fc5){if(_0x182fc5){freeIsNotKey(_0x182fc5,_0xbae8a[_0x9189('0x4d')],'id');for(var _0x498603=0x0,_0x3b1f9f={},_0x40ff3f={};_0x498603<_0x182fc5[_0x9189('0x48')];_0x498603+=0x1){_0x3b1f9f=_0x182fc5[_0x498603];if(_[_0x9189('0x46')](_0xbae8a[_0x9189('0x4d')][_0x3b1f9f['id']])){_0xbae8a[_0x9189('0x4d')][_0x3b1f9f['id']]=new Trigger(_0x3b1f9f);}else{_0xbae8a['mergeFromDatabase'](_0xbae8a['triggers'][_0x3b1f9f['id']],_0x3b1f9f);}}}return _0xbae8a[_0x9189('0x4d')];};};Realtime[_0x9189('0x43')]['initTemplates']=function(){var _0x30dd4b=this;return function(_0x223bb9){if(_0x223bb9){freeIsNotKey(_0x223bb9,_0x30dd4b[_0x9189('0x18')],'id');for(var _0x2193e5=0x0,_0x4f812b={},_0x2dec55={};_0x2193e5<_0x223bb9[_0x9189('0x48')];_0x2193e5+=0x1){_0x4f812b=_0x223bb9[_0x2193e5];if(_[_0x9189('0x46')](_0x30dd4b[_0x9189('0x18')][_0x4f812b['id']])){_0x30dd4b[_0x9189('0x18')][_0x4f812b['id']]=new Template(_0x4f812b);}else{_0x30dd4b[_0x9189('0x44')](_0x30dd4b[_0x9189('0x18')][_0x4f812b['id']],_0x4f812b);}}}return _0x30dd4b[_0x9189('0x18')];};};Realtime[_0x9189('0x43')]['initZendeskAccounts']=function(){var _0x5d6fde=this;return function(_0x565e36){if(_0x565e36){freeIsNotKey(_0x565e36,_0x5d6fde['zendeskAccounts'],'id');for(var _0x3d2745=0x0,_0x46ba39={},_0x4f24fa={};_0x3d2745<_0x565e36[_0x9189('0x48')];_0x3d2745+=0x1){_0x46ba39=_0x565e36[_0x3d2745];if(_[_0x9189('0x46')](_0x5d6fde['zendeskAccounts'][_0x46ba39['id']])){_0x5d6fde[_0x9189('0x4e')][_0x46ba39['id']]=new ZendeskAccount(_0x46ba39);}else{_0x5d6fde[_0x9189('0x44')](_0x5d6fde[_0x9189('0x4e')][_0x46ba39['id']],_0x46ba39);}}}return _0x5d6fde[_0x9189('0x4e')];};};Realtime['prototype'][_0x9189('0x4f')]=function(){var _0x37b997=this;return function(_0x4a5d54){if(_0x4a5d54){freeIsNotKey(_0x4a5d54,_0x37b997[_0x9189('0x1e')],'id');for(var _0x2594d4=0x0,_0x4eab3c={},_0x537aa0={};_0x2594d4<_0x4a5d54[_0x9189('0x48')];_0x2594d4+=0x1){_0x4eab3c=_0x4a5d54[_0x2594d4];if(_[_0x9189('0x46')](_0x37b997[_0x9189('0x1e')][_0x4eab3c['id']])){_0x37b997[_0x9189('0x1e')][_0x4eab3c['id']]=new SalesforceAccount(_0x4eab3c);}else{_0x37b997['mergeFromDatabase'](_0x37b997[_0x9189('0x1e')][_0x4eab3c['id']],_0x4eab3c);}}}return _0x37b997[_0x9189('0x1e')];};};Realtime[_0x9189('0x43')][_0x9189('0x50')]=function(){var _0x40be65=this;return function(_0x584c3d){if(_0x584c3d){freeIsNotKey(_0x584c3d,_0x40be65[_0x9189('0x51')],'id');for(var _0x59082f=0x0,_0x1a3db7={},_0x3554c6={};_0x59082f<_0x584c3d[_0x9189('0x48')];_0x59082f+=0x1){_0x1a3db7=_0x584c3d[_0x59082f];if(_[_0x9189('0x46')](_0x40be65['freshdeskAccounts'][_0x1a3db7['id']])){_0x40be65[_0x9189('0x51')][_0x1a3db7['id']]=new FreshdeskAccount(_0x1a3db7);}else{_0x40be65[_0x9189('0x44')](_0x40be65[_0x9189('0x51')][_0x1a3db7['id']],_0x1a3db7);}}}return _0x40be65['freshdeskAccounts'];};};Realtime[_0x9189('0x43')][_0x9189('0x52')]=function(){var _0x5e37e6=this;return function(_0x4fa288){if(_0x4fa288){freeIsNotKey(_0x4fa288,_0x5e37e6[_0x9189('0x20')],'id');for(var _0x2b63ba=0x0,_0x5c61d4={},_0x5ca28c={};_0x2b63ba<_0x4fa288[_0x9189('0x48')];_0x2b63ba+=0x1){_0x5c61d4=_0x4fa288[_0x2b63ba];if(_[_0x9189('0x46')](_0x5e37e6[_0x9189('0x20')][_0x5c61d4['id']])){_0x5e37e6['zohoAccounts'][_0x5c61d4['id']]=new ZohoAccount(_0x5c61d4);}else{_0x5e37e6[_0x9189('0x44')](_0x5e37e6[_0x9189('0x20')][_0x5c61d4['id']],_0x5c61d4);}}}return _0x5e37e6[_0x9189('0x20')];};};Realtime[_0x9189('0x43')]['initDeskAccounts']=function(){var _0x4c9aa1=this;return function(_0x33d873){if(_0x33d873){freeIsNotKey(_0x33d873,_0x4c9aa1[_0x9189('0x21')],'id');for(var _0x225da4=0x0,_0xdd2c05={},_0xeba7a6={};_0x225da4<_0x33d873[_0x9189('0x48')];_0x225da4+=0x1){_0xdd2c05=_0x33d873[_0x225da4];if(_[_0x9189('0x46')](_0x4c9aa1[_0x9189('0x21')][_0xdd2c05['id']])){_0x4c9aa1[_0x9189('0x21')][_0xdd2c05['id']]=new DeskAccount(_0xdd2c05);}else{_0x4c9aa1[_0x9189('0x44')](_0x4c9aa1[_0x9189('0x21')][_0xdd2c05['id']],_0xdd2c05);}}}return _0x4c9aa1[_0x9189('0x21')];};};Realtime[_0x9189('0x43')][_0x9189('0x53')]=function(){var _0xc8feaf=this;return function(_0xd40b0){if(_0xd40b0){freeIsNotKey(_0xd40b0,_0xc8feaf['sugarcrmAccounts'],'id');for(var _0x4342fd=0x0,_0x41fc7f={},_0x167229={};_0x4342fd<_0xd40b0[_0x9189('0x48')];_0x4342fd+=0x1){_0x41fc7f=_0xd40b0[_0x4342fd];if(_[_0x9189('0x46')](_0xc8feaf['sugarcrmAccounts'][_0x41fc7f['id']])){_0xc8feaf['sugarcrmAccounts'][_0x41fc7f['id']]=new SugarcrmAccount(_0x41fc7f);}else{_0xc8feaf[_0x9189('0x44')](_0xc8feaf[_0x9189('0x1f')][_0x41fc7f['id']],_0x41fc7f);}}}return _0xc8feaf[_0x9189('0x1f')];};};Realtime['prototype'][_0x9189('0x54')]=function(){var _0x1bb221=this;return function(_0x5d1d0c){if(_0x5d1d0c){freeIsNotKey(_0x5d1d0c,_0x1bb221[_0x9189('0x22')],'id');for(var _0x40b8c3=0x0,_0x390a6c={},_0x5139fd={};_0x40b8c3<_0x5d1d0c['length'];_0x40b8c3+=0x1){_0x390a6c=_0x5d1d0c[_0x40b8c3];if(_[_0x9189('0x46')](_0x1bb221[_0x9189('0x22')][_0x390a6c['id']])){_0x1bb221[_0x9189('0x22')][_0x390a6c['id']]=new VtigerAccount(_0x390a6c);}else{_0x1bb221[_0x9189('0x44')](_0x1bb221['vtigerAccounts'][_0x390a6c['id']],_0x390a6c);}}}return _0x1bb221[_0x9189('0x22')];};};Realtime[_0x9189('0x43')][_0x9189('0x55')]=function(){var _0x3a9c84=this;return function(_0x2af694){if(_0x2af694){freeIsNotKey(_0x2af694,_0x3a9c84[_0x9189('0x23')],'id');for(var _0x4ceb92=0x0,_0x23881c={},_0x21b088={};_0x4ceb92<_0x2af694['length'];_0x4ceb92+=0x1){_0x23881c=_0x2af694[_0x4ceb92];if(_[_0x9189('0x46')](_0x3a9c84[_0x9189('0x23')][_0x23881c['id']])){_0x3a9c84['servicenowAccounts'][_0x23881c['id']]=new ServicenowAccount(_0x23881c);}else{_0x3a9c84[_0x9189('0x44')](_0x3a9c84['servicenowAccounts'][_0x23881c['id']],_0x23881c);}}}return _0x3a9c84[_0x9189('0x23')];};};Realtime[_0x9189('0x43')]['initDynamics365Accounts']=function(){var _0x1bacaf=this;return function(_0x2b7adc){if(_0x2b7adc){freeIsNotKey(_0x2b7adc,_0x1bacaf[_0x9189('0x24')],'id');for(var _0x1e5204=0x0,_0x221505={},_0x3281d0={};_0x1e5204<_0x2b7adc[_0x9189('0x48')];_0x1e5204+=0x1){_0x221505=_0x2b7adc[_0x1e5204];if(_[_0x9189('0x46')](_0x1bacaf[_0x9189('0x24')][_0x221505['id']])){_0x1bacaf[_0x9189('0x24')][_0x221505['id']]=new Dynamics365Account(_0x221505);}else{_0x1bacaf['mergeFromDatabase'](_0x1bacaf[_0x9189('0x24')][_0x221505['id']],_0x221505);}}}return _0x1bacaf[_0x9189('0x24')];};};Realtime[_0x9189('0x43')][_0x9189('0x56')]=function(){var _0x1019bb=this;return function(_0x51bd86){if(_0x51bd86){freeIsNotKey(_0x51bd86,_0x1019bb[_0x9189('0x57')],'id');for(var _0x3babf1=0x0,_0x131f32={},_0x18bd06={};_0x3babf1<_0x51bd86[_0x9189('0x48')];_0x3babf1+=0x1){_0x131f32=_0x51bd86[_0x3babf1];if(_[_0x9189('0x46')](_0x1019bb[_0x9189('0x57')][_0x131f32['id']])){_0x1019bb[_0x9189('0x57')][_0x131f32['id']]=new FreshsalesAccount(_0x131f32);}else{_0x1019bb['mergeFromDatabase'](_0x1019bb[_0x9189('0x57')][_0x131f32['id']],_0x131f32);}}}return _0x1019bb['freshsalesAccounts'];};};Realtime[_0x9189('0x43')][_0x9189('0x58')]=function(){var _0xbe710a=this;return function(_0x2279d2){for(var _0x2471db=0x0;_0x2471db<_0x2279d2[_0x9189('0x48')];_0x2471db+=0x1){_['merge'](_0xbe710a[_0x9189('0x16')][_0x2279d2[_0x2471db][_0x9189('0x29')]],_0x2279d2[_0x2471db]);}return _0xbe710a[_0x9189('0x16')];};};Realtime[_0x9189('0x43')]['initVoiceQueueReports']=function(){var _0x31f37e=this;return function(_0x5da9b2){clearVoiceQueues(_0x31f37e['voiceQueues']);if(_0x5da9b2){_0x5da9b2=_[_0x9189('0x59')](_0x5da9b2,'uniqueid');for(var _0x49bb57 in _0x5da9b2){if(_0x5da9b2[_0x9189('0x27')](_0x49bb57)){var _0xaf2738={};for(var _0x2c4315=0x0;_0x2c4315<_0x5da9b2[_0x49bb57][_0x9189('0x48')];_0x2c4315+=0x1){var _0x1fe818=_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x5a')];if(_0x31f37e['voiceQueues'][_0x1fe818]){if(_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x5b')]){_0x31f37e['voiceQueues'][_0x1fe818][_0x9189('0x34')]+=0x1;}if(_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x5c')]){_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x35')]+=0x1;}_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x2e')]+=moment(_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x5d')])[_0x9189('0x5e')](moment(_0x5da9b2[_0x49bb57][_0x2c4315]['queuecallerjoinAt']),_0x9189('0x5f'))||0x0;if(_0x2c4315===_0x5da9b2[_0x49bb57][_0x9189('0x48')]-0x1){_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x2f')]+=moment(_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x60')]||_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x61')]||_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x62')])['diff'](moment(_0x5da9b2[_0x49bb57][_0x2c4315]['queuecallerjoinAt']),_0x9189('0x5f'))||0x0;_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x2d')]+=0x1;if(_0x5da9b2[_0x49bb57][_0x2c4315]['queuecallercomplete']){_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x63')]+=0x1;_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x30')]+=moment(_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x60')])[_0x9189('0x5e')](moment(_0x5da9b2[_0x49bb57][_0x2c4315][_0x9189('0x5d')]),_0x9189('0x5f'))||0x0;}}else{_0x31f37e[_0x9189('0x16')][_0x1fe818][_0x9189('0x2f')]+=_0x31f37e[_0x9189('0x16')][_0x1fe818]['sumHoldTime']||0x0;}}}}}}return _0x31f37e['voiceQueues'];};};Realtime['prototype'][_0x9189('0x64')]=function(){var _0x399f68=this;return function(_0x17a759){clearVoiceCallReports(_0x399f68[_0x9189('0x19')]);if(_0x17a759){for(var _0x398bf1=0x0;_0x398bf1<_0x17a759[_0x9189('0x48')];_0x398bf1+=0x1){_0x399f68['outbound'][_0x9189('0x2d')]+=0x1;_0x399f68['outbound']['sumDuration']+=_0x17a759[_0x398bf1][_0x9189('0x65')];if(_0x17a759[_0x398bf1][_0x9189('0x66')]===_0x9189('0x67')){_0x399f68[_0x9189('0x19')][_0x9189('0x63')]+=0x1;_0x399f68[_0x9189('0x19')][_0x9189('0x2e')]+=_0x17a759[_0x398bf1]['duration']-_0x17a759[_0x398bf1][_0x9189('0x68')]||0x0;_0x399f68[_0x9189('0x19')][_0x9189('0x30')]+=_0x17a759[_0x398bf1][_0x9189('0x68')];}}}return _0x399f68[_0x9189('0x19')];};};Realtime[_0x9189('0x43')][_0x9189('0x69')]=function(){var _0x3ee5f2=this;return function(_0x204b42){if(_0x204b42){freeIsNotKey(_0x204b42,_0x3ee5f2[_0x9189('0x17')],_0x9189('0x29'));for(var _0x465718=0x0,_0x1d3195={};_0x465718<_0x204b42[_0x9189('0x48')];_0x465718+=0x1){_0x1d3195=_0x204b42[_0x465718];if(_[_0x9189('0x46')](_0x3ee5f2[_0x9189('0x17')][_0x1d3195['name']])){_0x3ee5f2['campaigns'][_0x1d3195[_0x9189('0x29')]]=new Campaign(_0x1d3195);}else{_0x3ee5f2['mergeFromDatabase'](_0x3ee5f2[_0x9189('0x17')][_0x1d3195[_0x9189('0x29')]],_0x1d3195);_0x3ee5f2['campaigns'][_0x1d3195[_0x9189('0x29')]]['dialQueueProject']=_0x1d3195['SquareProject']?_0x1d3195[_0x9189('0x6a')][_0x9189('0x29')]:undefined;}}}return _0x3ee5f2['campaigns'];};};Realtime[_0x9189('0x43')][_0x9189('0x6b')]=function(){var _0x2e4601=this;return function(_0x1e40f7){if(_0x1e40f7){freeIsNotKey(_0x1e40f7,_0x2e4601['voiceExtensions'],'id');for(var _0xd8014d=0x0,_0x103237={};_0xd8014d<_0x1e40f7['length'];_0xd8014d+=0x1){_0x103237=_0x1e40f7[_0xd8014d];if(_[_0x9189('0x46')](_0x2e4601[_0x9189('0x1a')][_0x103237['id']])){_0x2e4601[_0x9189('0x1a')][_0x103237['id']]=new VoiceExtension(_0x103237);}else{_0x2e4601[_0x9189('0x44')](_0x2e4601[_0x9189('0x1a')][_0x103237['id']],_0x103237);}}}return _0x2e4601[_0x9189('0x1a')];};};Realtime[_0x9189('0x43')][_0x9189('0x6c')]=function(){var _0x281e95=this;return function(_0x6ab231){clearCampaigns(_0x281e95[_0x9189('0x17')]);for(var _0x5ae2ae=0x0;_0x5ae2ae<_0x6ab231[_0x9189('0x48')];_0x5ae2ae+=0x1){_[_0x9189('0x6d')](_0x281e95['campaigns'][_0x6ab231[_0x5ae2ae][_0x9189('0x29')]],_0x6ab231[_0x5ae2ae]);}return _0x281e95[_0x9189('0x17')];};};Realtime[_0x9189('0x43')][_0x9189('0x6e')]=function(){var _0x23c96d=this;return function(_0xd6114){if(_0xd6114){freeIsNotKey(_0xd6114,_0x23c96d[_0x9189('0x25')],'id');for(var _0x344737=0x0,_0x33c128={},_0x1f8c97={};_0x344737<_0xd6114[_0x9189('0x48')];_0x344737+=0x1){_0x33c128=_0xd6114[_0x344737];if(_[_0x9189('0x46')](_0x23c96d[_0x9189('0x25')][_0x33c128['id']])){_0x23c96d[_0x9189('0x25')][_0x33c128['id']]=new FaxAccount(_0x33c128);}else{_0x23c96d[_0x9189('0x44')](_0x23c96d[_0x9189('0x25')][_0x33c128['id']],_0x33c128);}}}return _0x23c96d[_0x9189('0x25')];};};module[_0x9189('0x6f')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0fd65d0..0ac5d2a 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 _0xdaeb=['telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','voiceQueueReport','create','destination','exten','type','dialer','lastapplication','queue','lastdata','context','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','connectedlinenum','membername','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','lastIndexOf','blindTransfer','exports','bluebird','lodash','util','../../../config/logger','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents'];(function(_0x5537e8,_0x51968b){var _0x4b8b33=function(_0x4dcc75){while(--_0x4dcc75){_0x5537e8['push'](_0x5537e8['shift']());}};_0x4b8b33(++_0x51968b);}(_0xdaeb,0x92));var _0xbdae=function(_0x29d2ac,_0x30d2d3){_0x29d2ac=_0x29d2ac-0x0;var _0x3d5f2f=_0xdaeb[_0x29d2ac];return _0x3d5f2f;};'use strict';var BPromise=require(_0xbdae('0x0'));var _=require(_0xbdae('0x1'));var moment=require('moment');var util=require(_0xbdae('0x2'));var config=require('../../../config/environment');var logger=require(_0xbdae('0x3'))('ami');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xbdae('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xbdae('0x5'));var RpcMemberReport=require(_0xbdae('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xbdae('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xbdae('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xbdae('0x9'));var VoiceDialReport=require(_0xbdae('0xa'));var UserReport=require(_0xbdae('0xb'));function Report(_0x285456){this[_0xbdae('0xc')]=_0x285456;this[_0xbdae('0xd')]=_0x285456[_0xbdae('0xd')];this[_0xbdae('0xe')]=_0x285456[_0xbdae('0xe')];}Report[_0xbdae('0xf')][_0xbdae('0x10')]=function(_0x554459){var _0x18c34f=new VoiceQueueReport(this[_0xbdae('0xc')]);var _0x3415ee=new VoiceAgentReport(this[_0xbdae('0xc')]);var _0x100f13=new VoiceDialReport(this[_0xbdae('0xc')]);var _0x547e51=new VoiceCallReport(this['realtime']);var _0x218d9d=new UserReport(this[_0xbdae('0xc')]);if(config[_0xbdae('0x11')]&&config[_0xbdae('0x11')]['disabled']){ami['on'](_0xbdae('0x12'),this['voiceQueueReport'][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x14'),this[_0xbdae('0x15')]['bind'](this));ami['on'](_0xbdae('0x16'),this[_0xbdae('0x17')][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x18'),this[_0xbdae('0x19')][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x1a'),this['blindTransfer'][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x1b'),this[_0xbdae('0x1c')][_0xbdae('0x13')](this));}};Report[_0xbdae('0xf')][_0xbdae('0x1d')]=function(_0x4d60c1){var _0x2c3daf=undefined;_0x2c3daf=_[_0xbdae('0x1e')](this['agents'],function(_0x467771){return _0x467771[_0xbdae('0x1f')]==_0x4d60c1||_0x467771[_0xbdae('0x20')]==_0x4d60c1;});if(_['isNil'](_0x2c3daf)){var _0x39d10a=_['find'](this[_0xbdae('0xe')],function(_0x126ace){return _0x126ace[_0xbdae('0x1f')]==_0x4d60c1||_0x126ace[_0xbdae('0x20')]==_0x4d60c1;});if(_0x39d10a){_0x2c3daf=_[_0xbdae('0x1e')](this[_0xbdae('0xd')],function(_0x3fe8bb){return _0x3fe8bb[_0xbdae('0x21')]==util[_0xbdae('0x22')](_0xbdae('0x23'),_0x39d10a['name']);});}}return _0x2c3daf;};Report['prototype']['voiceQueueReport']=function(_0x149f5a){for(var _0x14a160=0x0;_0x14a160<_0x149f5a[_0xbdae('0x24')];_0x14a160+=0x1){var _0xe35118=this[_0xbdae('0x1d')](_0x149f5a[_0x14a160]['connectedlinenum']);if(_0xe35118){_0x149f5a[_0x14a160][_0xbdae('0x1f')]=_0xe35118[_0xbdae('0x1f')];_0x149f5a[_0x14a160][_0xbdae('0x25')]=!![];_0x149f5a[_0x14a160][_0xbdae('0x26')]=_0xe35118['name'];_0x149f5a[_0x14a160][_0xbdae('0x21')]=_[_0xbdae('0x27')](_0xe35118['interface'])?util['format'](_0xbdae('0x23'),_0xe35118[_0xbdae('0x20')]):_0xe35118[_0xbdae('0x21')];if(_0x149f5a[_0x14a160][_0xbdae('0x28')]){_0x149f5a[_0x14a160][_0xbdae('0x29')]=moment()[_0xbdae('0x22')](_0xbdae('0x2a'));}if(_0x149f5a[_0x14a160]['queuecallerexit']){_0x149f5a[_0x14a160][_0xbdae('0x2b')]=moment()[_0xbdae('0x22')](_0xbdae('0x2a'));}RpcMemberReport[_0xbdae('0x2c')](_0x149f5a[_0x14a160]);}RpcVoiceQueueReport[_0xbdae('0x2d')](_0x149f5a[_0x14a160]);}};function extractCalleridNumber(_0x25f4e3){var _0x256bcb=_0x25f4e3['match'](/<(.*?)>/);return _0x256bcb?_0x256bcb[0x1]:_0x25f4e3;}Report['prototype'][_0xbdae('0x15')]=function(_0x140615){_0x140615[_0xbdae('0x2e')]=_0x140615['destination']||_0x140615[_0xbdae('0x2f')];if(_0x140615[_0xbdae('0x30')]==_0xbdae('0x31')){_0x140615[_0xbdae('0x32')]=_0xbdae('0x33');_0x140615[_0xbdae('0x34')]=_0x140615['queue'];if(_0x140615['context']=='from-voip-provider'){_0x140615[_0xbdae('0x1f')]='';_0x140615[_0xbdae('0x2e')]=extractCalleridNumber(_0x140615['callerid']);}else if(_0x140615[_0xbdae('0x35')]=='from-sip'){if(_0x140615[_0xbdae('0x2e')]=='xcally-motion-preview'){_0x140615[_0xbdae('0x2e')]=extractCalleridNumber(_0x140615[_0xbdae('0x36')]);_0x140615['calleridnum']=_0x140615[_0xbdae('0x37')];_0x140615[_0xbdae('0x38')]=[_0x140615[_0xbdae('0x39')],_0x140615['channel']=_0x140615[_0xbdae('0x38')]][0x0];_0x140615[_0xbdae('0x3a')]=_0x140615['calleridpreview'];}else{_0x140615[_0xbdae('0x2e')]=_0x140615[_0xbdae('0x3b')];_0x140615['calleridnum']=_0x140615[_0xbdae('0x37')];if(_0x140615[_0xbdae('0x3c')]==_0xbdae('0x3d')){_0x140615[_0xbdae('0x1f')]=_0x140615['connectedlinenum'];}else{_0x140615['accountcode']='';}}}}else{_0x140615[_0xbdae('0x3a')]=util[_0xbdae('0x22')](_0xbdae('0x3e'),_0x140615['calleridname'],_0x140615[_0xbdae('0x3b')]);}RpcVoiceCallReport[_0xbdae('0x2d')](_0x140615);if(_0x140615[_0xbdae('0x3f')]){for(var _0x2946a9=0x0;_0x2946a9<_0x140615[_0xbdae('0x40')]['length'];_0x2946a9+=0x1){_0x140615['monitorFilename']=_0x140615[_0xbdae('0x40')][_0x2946a9][_0xbdae('0x41')];_0x140615[_0xbdae('0x42')]=_0x140615['monitors'][_0x2946a9][_0xbdae('0x42')];if(_0x140615[_0xbdae('0x2f')]==_0xbdae('0x43')){_0x140615[_0xbdae('0x3b')]=_0x140615['connectedlinenum'];_0x140615['calleridname']=_0x140615[_0xbdae('0x44')];_0x140615[_0xbdae('0x45')]=_0x140615[_0xbdae('0x1f')];_0x140615['connectedlinename']=_0x140615[_0xbdae('0x46')];_0x140615[_0xbdae('0x2f')]=_0x140615[_0xbdae('0x37')];}else if(_0x140615[_0xbdae('0x2f')]==_0xbdae('0x47')){_0x140615[_0xbdae('0x3b')]=_0x140615[_0xbdae('0x2e')];_0x140615[_0xbdae('0x2f')]=_0x140615[_0xbdae('0x37')];}RpcVoiceRecording[_0xbdae('0x2d')](_0x140615);}}};Report['prototype'][_0xbdae('0x17')]=function(_0x4dc126){if(_[_0xbdae('0x48')](_0x4dc126)){_0x4dc126[_0xbdae('0x49')](function(_0x58964f){RpcVoiceAgentReport[_0xbdae('0x2d')](_0x58964f);});}else{RpcVoiceAgentReport[_0xbdae('0x2d')](_0x4dc126);}};Report['prototype'][_0xbdae('0x19')]=function(_0x5b1b66){RpcVoiceDialReport[_0xbdae('0x2d')](_0x5b1b66);var _0x188005=undefined;var _0x1bdcd1=_0x5b1b66[_0xbdae('0x39')];if(_['startsWith'](_0x1bdcd1,_0xbdae('0x4a'))){var _0x285a76=_0x1bdcd1['substring'](_0x1bdcd1[_0xbdae('0x4b')]('/')+0x1,_0x1bdcd1[_0xbdae('0x4b')]('@'));_0x188005=_[_0xbdae('0x1e')](this['agents'],function(_0x1425de){return _0x1425de[_0xbdae('0x4c')]==_0x285a76||_0x1425de['phone']==_0x285a76||_0x1425de[_0xbdae('0x1f')]==_0x285a76;});}else{var _0x285a76=_0x1bdcd1['substring'](_0x1bdcd1[_0xbdae('0x4b')]('/')+0x1,_0x1bdcd1[_0xbdae('0x4d')]('-'));_0x188005=this['findAgent'](_0x285a76);}if(_0x188005){_0x5b1b66[_0xbdae('0x21')]=_[_0xbdae('0x27')](_0x188005[_0xbdae('0x21')])?util[_0xbdae('0x22')](_0xbdae('0x23'),_0x188005[_0xbdae('0x20')]):_0x188005[_0xbdae('0x21')];_0x5b1b66[_0xbdae('0x46')]=_0x188005['name'];_0x5b1b66[_0xbdae('0x1f')]=_0x188005[_0xbdae('0x1f')];RpcMemberReport['voiceDialReport'](_0x5b1b66);}};Report[_0xbdae('0xf')][_0xbdae('0x4e')]=function(_0x34f15f){RpcVoiceTransferReport[_0xbdae('0x4e')](_0x34f15f);};Report[_0xbdae('0xf')][_0xbdae('0x1c')]=function(_0x59a5c5){RpcVoiceTransferReport['attendedTransfer'](_0x59a5c5);};module[_0xbdae('0x4f')]=Report; \ No newline at end of file +var _0xbd99=['destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','membername','attendedTransfer','exports','bluebird','../../../config/environment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','accountcode','name','find','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match'];(function(_0x112bb2,_0x167bd7){var _0x1d692e=function(_0x1724b7){while(--_0x1724b7){_0x112bb2['push'](_0x112bb2['shift']());}};_0x1d692e(++_0x167bd7);}(_0xbd99,0x12a));var _0x9bd9=function(_0x31559a,_0x47ccfc){_0x31559a=_0x31559a-0x0;var _0x466501=_0xbd99[_0x31559a];return _0x466501;};'use strict';var BPromise=require(_0x9bd9('0x0'));var _=require('lodash');var moment=require('moment');var util=require('util');var config=require(_0x9bd9('0x1'));var logger=require(_0x9bd9('0x2'))(_0x9bd9('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9bd9('0x4'));var RpcVoiceCallReport=require(_0x9bd9('0x5'));var RpcVoiceDialReport=require(_0x9bd9('0x6'));var RpcMemberReport=require(_0x9bd9('0x7'));var RpcVoiceQueueReport=require(_0x9bd9('0x8'));var RpcVoiceRecording=require(_0x9bd9('0x9'));var RpcVoiceTransferReport=require(_0x9bd9('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9bd9('0xb'));var VoiceAgentReport=require(_0x9bd9('0xc'));var VoiceDialReport=require(_0x9bd9('0xd'));var UserReport=require(_0x9bd9('0xe'));function Report(_0x22c0ad){this['realtime']=_0x22c0ad;this[_0x9bd9('0xf')]=_0x22c0ad[_0x9bd9('0xf')];this[_0x9bd9('0x10')]=_0x22c0ad[_0x9bd9('0x10')];}Report['prototype']['sync']=function(_0x571aff){var _0x252237=new VoiceQueueReport(this['realtime']);var _0x50dfc2=new VoiceAgentReport(this['realtime']);var _0x2a79ee=new VoiceDialReport(this[_0x9bd9('0x11')]);var _0x557c4c=new VoiceCallReport(this[_0x9bd9('0x11')]);var _0x51fc1f=new UserReport(this[_0x9bd9('0x11')]);if(config[_0x9bd9('0x12')]&&config['xdr'][_0x9bd9('0x13')]){ami['on'](_0x9bd9('0x14'),this[_0x9bd9('0x15')][_0x9bd9('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x9bd9('0x17')][_0x9bd9('0x16')](this));ami['on'](_0x9bd9('0x18'),this[_0x9bd9('0x19')]['bind'](this));ami['on'](_0x9bd9('0x1a'),this[_0x9bd9('0x1b')]['bind'](this));ami['on'](_0x9bd9('0x1c'),this[_0x9bd9('0x1d')][_0x9bd9('0x16')](this));ami['on'](_0x9bd9('0x1e'),this['attendedTransfer']['bind'](this));}};Report[_0x9bd9('0x1f')][_0x9bd9('0x20')]=function(_0x6bcfea){var _0x24eb31=undefined;_0x24eb31=_['find'](this[_0x9bd9('0xf')],function(_0x5810cc){return _0x5810cc[_0x9bd9('0x21')]==_0x6bcfea||_0x5810cc[_0x9bd9('0x22')]==_0x6bcfea;});if(_['isNil'](_0x24eb31)){var _0x4cd22b=_['find'](this['telephones'],function(_0x286744){return _0x286744[_0x9bd9('0x21')]==_0x6bcfea||_0x286744[_0x9bd9('0x22')]==_0x6bcfea;});if(_0x4cd22b){_0x24eb31=_[_0x9bd9('0x23')](this[_0x9bd9('0xf')],function(_0x4fe678){return _0x4fe678['interface']==util['format'](_0x9bd9('0x24'),_0x4cd22b[_0x9bd9('0x22')]);});}}return _0x24eb31;};Report[_0x9bd9('0x1f')][_0x9bd9('0x15')]=function(_0x40db5b){for(var _0x2257a4=0x0;_0x2257a4<_0x40db5b[_0x9bd9('0x25')];_0x2257a4+=0x1){var _0x518921=this[_0x9bd9('0x20')](_0x40db5b[_0x2257a4][_0x9bd9('0x26')]);if(_0x518921){_0x40db5b[_0x2257a4][_0x9bd9('0x21')]=_0x518921[_0x9bd9('0x21')];_0x40db5b[_0x2257a4][_0x9bd9('0x27')]=!![];_0x40db5b[_0x2257a4][_0x9bd9('0x28')]=_0x518921[_0x9bd9('0x22')];_0x40db5b[_0x2257a4][_0x9bd9('0x29')]=_[_0x9bd9('0x2a')](_0x518921[_0x9bd9('0x29')])?util[_0x9bd9('0x2b')](_0x9bd9('0x24'),_0x518921[_0x9bd9('0x22')]):_0x518921[_0x9bd9('0x29')];if(_0x40db5b[_0x2257a4][_0x9bd9('0x2c')]){_0x40db5b[_0x2257a4][_0x9bd9('0x2d')]=moment()[_0x9bd9('0x2b')](_0x9bd9('0x2e'));}if(_0x40db5b[_0x2257a4][_0x9bd9('0x2f')]){_0x40db5b[_0x2257a4]['queuecallerexitAt']=moment()['format'](_0x9bd9('0x2e'));}RpcMemberReport[_0x9bd9('0x15')](_0x40db5b[_0x2257a4]);}RpcVoiceQueueReport[_0x9bd9('0x30')](_0x40db5b[_0x2257a4]);}};function extractCalleridNumber(_0x515aa4){var _0x5865c7=_0x515aa4[_0x9bd9('0x31')](/<(.*?)>/);return _0x5865c7?_0x5865c7[0x1]:_0x515aa4;}Report['prototype'][_0x9bd9('0x17')]=function(_0x1cc320){_0x1cc320[_0x9bd9('0x32')]=_0x1cc320['destination']||_0x1cc320[_0x9bd9('0x33')];if(_0x1cc320[_0x9bd9('0x34')]==_0x9bd9('0x35')){_0x1cc320[_0x9bd9('0x36')]=_0x9bd9('0x37');_0x1cc320[_0x9bd9('0x38')]=_0x1cc320[_0x9bd9('0x37')];if(_0x1cc320[_0x9bd9('0x39')]==_0x9bd9('0x3a')){_0x1cc320['accountcode']='';_0x1cc320[_0x9bd9('0x32')]=extractCalleridNumber(_0x1cc320[_0x9bd9('0x3b')]);}else if(_0x1cc320[_0x9bd9('0x39')]=='from-sip'){if(_0x1cc320['destination']=='xcally-motion-preview'){_0x1cc320[_0x9bd9('0x32')]=extractCalleridNumber(_0x1cc320[_0x9bd9('0x3c')]);_0x1cc320['calleridnum']=_0x1cc320[_0x9bd9('0x3d')];_0x1cc320[_0x9bd9('0x3e')]=[_0x1cc320[_0x9bd9('0x3f')],_0x1cc320[_0x9bd9('0x3f')]=_0x1cc320[_0x9bd9('0x3e')]][0x0];_0x1cc320[_0x9bd9('0x3b')]=_0x1cc320[_0x9bd9('0x3c')];}else{_0x1cc320[_0x9bd9('0x32')]=_0x1cc320[_0x9bd9('0x40')];_0x1cc320[_0x9bd9('0x40')]=_0x1cc320['originatecalleridnum'];if(_0x1cc320[_0x9bd9('0x41')]==_0x9bd9('0x42')){_0x1cc320[_0x9bd9('0x21')]=_0x1cc320[_0x9bd9('0x26')];}else{_0x1cc320[_0x9bd9('0x21')]='';}}}}else{_0x1cc320[_0x9bd9('0x3b')]=util[_0x9bd9('0x2b')](_0x9bd9('0x43'),_0x1cc320['calleridname'],_0x1cc320[_0x9bd9('0x40')]);}RpcVoiceCallReport['create'](_0x1cc320);if(_0x1cc320[_0x9bd9('0x44')]){for(var _0x2fae0c=0x0;_0x2fae0c<_0x1cc320[_0x9bd9('0x45')][_0x9bd9('0x25')];_0x2fae0c+=0x1){_0x1cc320[_0x9bd9('0x46')]=_0x1cc320[_0x9bd9('0x45')][_0x2fae0c][_0x9bd9('0x47')];_0x1cc320['createdAt']=_0x1cc320[_0x9bd9('0x45')][_0x2fae0c][_0x9bd9('0x48')];if(_0x1cc320[_0x9bd9('0x33')]=='xcally-motion-preview'){_0x1cc320[_0x9bd9('0x40')]=_0x1cc320[_0x9bd9('0x26')];_0x1cc320[_0x9bd9('0x49')]=_0x1cc320[_0x9bd9('0x4a')];_0x1cc320[_0x9bd9('0x26')]=_0x1cc320['accountcode'];_0x1cc320['connectedlinename']=_0x1cc320['membername'];_0x1cc320[_0x9bd9('0x33')]=_0x1cc320[_0x9bd9('0x3d')];}else if(_0x1cc320[_0x9bd9('0x33')]==_0x9bd9('0x4b')){_0x1cc320[_0x9bd9('0x40')]=_0x1cc320[_0x9bd9('0x32')];_0x1cc320[_0x9bd9('0x33')]=_0x1cc320[_0x9bd9('0x3d')];}RpcVoiceRecording['create'](_0x1cc320);}}};Report['prototype'][_0x9bd9('0x19')]=function(_0x4a6a59){if(_[_0x9bd9('0x4c')](_0x4a6a59)){_0x4a6a59[_0x9bd9('0x4d')](function(_0x575c5e){RpcVoiceAgentReport[_0x9bd9('0x30')](_0x575c5e);});}else{RpcVoiceAgentReport[_0x9bd9('0x30')](_0x4a6a59);}};Report[_0x9bd9('0x1f')][_0x9bd9('0x1b')]=function(_0x4b0da8){RpcVoiceDialReport[_0x9bd9('0x30')](_0x4b0da8);var _0x40403c=undefined;var _0x1b8dad=_0x4b0da8[_0x9bd9('0x3f')];if(_[_0x9bd9('0x4e')](_0x1b8dad,_0x9bd9('0x4f'))){var _0x1143d7=_0x1b8dad[_0x9bd9('0x50')](_0x1b8dad[_0x9bd9('0x51')]('/')+0x1,_0x1b8dad[_0x9bd9('0x51')]('@'));_0x40403c=_[_0x9bd9('0x23')](this[_0x9bd9('0xf')],function(_0x158d76){return _0x158d76[_0x9bd9('0x52')]==_0x1143d7||_0x158d76['phone']==_0x1143d7||_0x158d76['accountcode']==_0x1143d7;});}else{var _0x1143d7=_0x1b8dad[_0x9bd9('0x50')](_0x1b8dad[_0x9bd9('0x51')]('/')+0x1,_0x1b8dad[_0x9bd9('0x53')]('-'));_0x40403c=this['findAgent'](_0x1143d7);}if(_0x40403c){_0x4b0da8[_0x9bd9('0x29')]=_[_0x9bd9('0x2a')](_0x40403c['interface'])?util['format'](_0x9bd9('0x24'),_0x40403c['name']):_0x40403c[_0x9bd9('0x29')];_0x4b0da8[_0x9bd9('0x54')]=_0x40403c[_0x9bd9('0x22')];_0x4b0da8[_0x9bd9('0x21')]=_0x40403c['accountcode'];RpcMemberReport[_0x9bd9('0x1b')](_0x4b0da8);}};Report[_0x9bd9('0x1f')][_0x9bd9('0x1d')]=function(_0x2b5901){RpcVoiceTransferReport[_0x9bd9('0x1d')](_0x2b5901);};Report[_0x9bd9('0x1f')][_0x9bd9('0x55')]=function(_0x44128e){RpcVoiceTransferReport[_0x9bd9('0x55')](_0x44128e);};module[_0x9bd9('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 1f8303d..58bd67a 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 _0x4444=['emit','username','stateRegistry','state','merge','omit','event','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','agents','local','toLowerCase','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionDeviceStateList','isNotNull'];(function(_0x3179e1,_0x26a724){var _0x6c8122=function(_0x3037a1){while(--_0x3037a1){_0x3179e1['push'](_0x3179e1['shift']());}};_0x6c8122(++_0x26a724);}(_0x4444,0x1f1));var _0x4444=function(_0x1c9326,_0x4f65bd){_0x1c9326=_0x1c9326-0x0;var _0x33e2e4=_0x4444[_0x1c9326];return _0x33e2e4;};'use strict';var _=require(_0x4444('0x0'));var moment=require(_0x4444('0x1'));var BPromise=require(_0x4444('0x2'));var util=require('util');var Redis=require('ioredis');var config=require(_0x4444('0x3'));var logger=require(_0x4444('0x4'))(_0x4444('0x5'));var ami=require(_0x4444('0x6'));config[_0x4444('0x7')]=_[_0x4444('0x8')](config[_0x4444('0x7')],{'host':_0x4444('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4444('0x7')]));function UserReport(_0x17c623){this[_0x4444('0xa')]=_0x17c623['trunks'];this['agents']=_0x17c623['agents'];this[_0x4444('0xb')]=_0x17c623[_0x4444('0xb')];ami['on'](_0x4444('0xc'),this['syncRegistry']['bind'](this));ami['on'](_0x4444('0xd'),this[_0x4444('0xe')][_0x4444('0xf')](this));ami['on'](_0x4444('0x10'),this['syncDeviceState'][_0x4444('0xf')](this));ami['on'](_0x4444('0x11'),this[_0x4444('0x12')][_0x4444('0xf')](this));this[_0x4444('0x13')]();return BPromise[_0x4444('0x14')]()['then'](ami[_0x4444('0x15')]())[_0x4444('0x16')](ami['actionDeviceStateList']())[_0x4444('0x16')](ami[_0x4444('0x17')]())[_0x4444('0x18')](loggerCatch(_0x4444('0x19')));}function loggerCatch(_0xce5647){return function(_0x73e2a1){logger[_0x4444('0x1a')](_0xce5647,util[_0x4444('0x1b')](_0x73e2a1,{'showHidden':![],'depth':null}));};}UserReport[_0x4444('0x1c')][_0x4444('0x13')]=function(){setInterval(function(){BPromise[_0x4444('0x14')]()[_0x4444('0x16')](ami[_0x4444('0x15')]())['then'](ami[_0x4444('0x1d')]())[_0x4444('0x16')](ami[_0x4444('0x17')]())[_0x4444('0x18')](loggerCatch(_0x4444('0x19')));},0x32c8);};UserReport[_0x4444('0x1c')][_0x4444('0x1e')]=function(_0x561360){return _0x561360!==null&&!_['isUndefined'](_0x561360);};UserReport['prototype'][_0x4444('0x1f')]=function(_0x5cd526,_0x478498,_0x187f99){io['to'](_0x5cd526)['emit'](_0x478498,_0x187f99);};UserReport[_0x4444('0x1c')][_0x4444('0xe')]=function(_0x57e99c){try{if(this[_0x4444('0x1e')](_0x57e99c)){var _0x5f016a=_['find'](this[_0x4444('0xa')],{'registry':_0x57e99c[_0x4444('0x20')]});if(_0x5f016a){_0x57e99c[_0x4444('0x21')]=_0x57e99c[_0x4444('0x22')];_[_0x4444('0x23')](_0x5f016a,_[_0x4444('0x24')](_0x57e99c,[_0x4444('0x25'),'actionid',_0x4444('0x20'),_0x4444('0x22')]));this[_0x4444('0x1f')](util[_0x4444('0x26')](_0x4444('0x27'),_0x5f016a[_0x4444('0x28')]),_0x4444('0x29'),_0x5f016a);}}}catch(_0x1f7134){logger[_0x4444('0x1a')](_0x4444('0x2a'),util[_0x4444('0x1b')](_0x1f7134,{'showHidden':![],'depth':null}));}};UserReport[_0x4444('0x1c')]['syncDeviceState']=function(_0x300076){try{if(this[_0x4444('0x1e')](_0x300076)){if(this['agents'][_0x300076[_0x4444('0x2b')]]){if(!this[_0x4444('0x2c')][_0x300076['device']]['local']||_0x300076['state']['toLowerCase']()=='inuse'){this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]][_0x4444('0x2d')]=![];if(this['agents'][_0x300076[_0x4444('0x2b')]][_0x4444('0x22')]!==_0x300076['state'][_0x4444('0x2e')]()){this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]]['stateTime']=_[_0x4444('0x2f')](moment()[_0x4444('0x26')]('x'));}this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]][_0x4444('0x22')]=_0x300076[_0x4444('0x22')][_0x4444('0x2e')]();this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]][_0x4444('0x30')](_0x300076);}}else if(this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]]){if(this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]]['state']!==_0x300076[_0x4444('0x22')]['toLowerCase']()){this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]][_0x4444('0x31')]=_['toNumber'](moment()[_0x4444('0x26')]('x'));}this[_0x4444('0xb')][_0x300076['device']][_0x4444('0x22')]=_0x300076[_0x4444('0x22')][_0x4444('0x2e')]();this['emit'](util[_0x4444('0x26')](_0x4444('0x32'),this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]][_0x4444('0x28')]),_0x4444('0x33'),this[_0x4444('0xb')][_0x300076['device']]);}else if(this[_0x4444('0xa')][_0x300076[_0x4444('0x2b')]]){if(this[_0x4444('0xa')][_0x300076[_0x4444('0x2b')]][_0x4444('0x22')]!==_0x300076[_0x4444('0x22')]['toLowerCase']()){this['trunks'][_0x300076[_0x4444('0x2b')]][_0x4444('0x31')]=_[_0x4444('0x2f')](moment()['format']('x'));}this['trunks'][_0x300076['device']][_0x4444('0x22')]=_0x300076['state']['toLowerCase']();this[_0x4444('0x1f')](util[_0x4444('0x26')]('trunk:%s',this[_0x4444('0xa')][_0x300076[_0x4444('0x2b')]]['name']),_0x4444('0x29'),this[_0x4444('0xa')][_0x300076['device']]);}else if(_[_0x4444('0x34')](_0x300076[_0x4444('0x2b')],'Queue')){}else if(_[_0x4444('0x34')](_0x300076['device'],_0x4444('0x35'))){var _0x450764=_0x300076[_0x4444('0x2b')];var _0x5efb7c=_0x450764[_0x4444('0x36')](_0x450764['indexOf']('/')+0x1,_0x450764[_0x4444('0x37')]('@'));var _0x4237ec=_['find'](this[_0x4444('0x2c')],function(_0x40b5f2){return _0x40b5f2[_0x4444('0x38')]==_0x5efb7c||_0x40b5f2[_0x4444('0x39')]==_0x5efb7c||_0x40b5f2[_0x4444('0x3a')]==_0x5efb7c;});if(_0x4237ec){if(_0x4237ec[_0x4444('0x22')]!==_0x300076['state'][_0x4444('0x2e')]()){_0x4237ec[_0x4444('0x31')]=_[_0x4444('0x2f')](moment()[_0x4444('0x26')]('x'));}_0x4237ec[_0x4444('0x22')]=_0x300076[_0x4444('0x22')][_0x4444('0x2e')]();_0x4237ec[_0x4444('0x2d')]=!![];_0x4237ec[_0x4444('0x30')](_0x300076);}}else{}}}catch(_0x33405e){logger[_0x4444('0x1a')](_0x4444('0x3b'),util['inspect'](_0x33405e,{'showHidden':![],'depth':null}));}};UserReport[_0x4444('0x1c')][_0x4444('0x12')]=function(_0x58d536){try{if(this['isNotNull'](_0x58d536)&&this[_0x4444('0x1e')](_0x58d536[_0x4444('0x11')])){if(this['agents'][_0x58d536[_0x4444('0x3c')]]){if(!this[_0x4444('0x2c')][_0x58d536['peer']]['local']||_0x58d536[_0x4444('0x11')]['toLowerCase']()==_0x4444('0x3d')){this[_0x4444('0x2c')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x2d')]=![];this[_0x4444('0x2c')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3e')]=_0x58d536[_0x4444('0x11')]['toLowerCase']();this['agents'][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3f')]=_0x58d536['address'];this['agents'][_0x58d536[_0x4444('0x3c')]][_0x4444('0x30')](_0x58d536);}}else if(this[_0x4444('0xb')][_0x58d536[_0x4444('0x3c')]]){this[_0x4444('0xb')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3e')]=_0x58d536[_0x4444('0x11')]['toLowerCase']();this[_0x4444('0xb')][_0x58d536['peer']][_0x4444('0x3f')]=_0x58d536[_0x4444('0x3f')];this['emit'](util[_0x4444('0x26')](_0x4444('0x32'),this[_0x4444('0xb')][_0x58d536['peer']][_0x4444('0x28')]),'telephone:save',this[_0x4444('0xb')][_0x58d536['peer']]);}else if(this[_0x4444('0xa')][_0x58d536['peer']]){this[_0x4444('0xa')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3e')]=_0x58d536[_0x4444('0x11')][_0x4444('0x2e')]();this[_0x4444('0xa')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3f')]=_0x58d536[_0x4444('0x3f')];this[_0x4444('0x1f')](util[_0x4444('0x26')](_0x4444('0x27'),this[_0x4444('0xa')][_0x58d536['peer']][_0x4444('0x28')]),_0x4444('0x29'),this['trunks'][_0x58d536[_0x4444('0x3c')]]);}else{}}}catch(_0x3062ef){logger[_0x4444('0x1a')](_0x4444('0x40'),util['inspect'](_0x3062ef,{'showHidden':![],'depth':null}));}};module[_0x4444('0x41')]=UserReport; \ No newline at end of file +var _0x5b1f=['toNumber','updateStatusRealtime','telephone:save','startsWith','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','peer','status','address','telephone:%s','trunk:save','[syncPeerStatus][UserReport]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionSipPeerStatus','isUndefined','emit','isNotNull','find','username','stateRegistry','state','merge','omit','event','actionid','format','trunk:%s','name','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime'];(function(_0x3d64e9,_0x4ec0c1){var _0xe2f289=function(_0x5c3b11){while(--_0x5c3b11){_0x3d64e9['push'](_0x3d64e9['shift']());}};_0xe2f289(++_0x4ec0c1);}(_0x5b1f,0x91));var _0xf5b1=function(_0x55501b,_0x54c277){_0x55501b=_0x55501b-0x0;var _0x506936=_0x5b1f[_0x55501b];return _0x506936;};'use strict';var _=require(_0xf5b1('0x0'));var moment=require(_0xf5b1('0x1'));var BPromise=require('bluebird');var util=require(_0xf5b1('0x2'));var Redis=require('ioredis');var config=require(_0xf5b1('0x3'));var logger=require(_0xf5b1('0x4'))(_0xf5b1('0x5'));var ami=require('../ami');config[_0xf5b1('0x6')]=_[_0xf5b1('0x7')](config[_0xf5b1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf5b1('0x8'))(new Redis(config[_0xf5b1('0x6')]));function UserReport(_0x436765){this[_0xf5b1('0x9')]=_0x436765[_0xf5b1('0x9')];this[_0xf5b1('0xa')]=_0x436765[_0xf5b1('0xa')];this[_0xf5b1('0xb')]=_0x436765[_0xf5b1('0xb')];ami['on'](_0xf5b1('0xc'),this['syncRegistry']['bind'](this));ami['on']('registry',this[_0xf5b1('0xd')][_0xf5b1('0xe')](this));ami['on'](_0xf5b1('0xf'),this[_0xf5b1('0x10')][_0xf5b1('0xe')](this));ami['on'](_0xf5b1('0x11'),this[_0xf5b1('0x12')][_0xf5b1('0xe')](this));this[_0xf5b1('0x13')]();return BPromise[_0xf5b1('0x14')]()[_0xf5b1('0x15')](ami[_0xf5b1('0x16')]())[_0xf5b1('0x15')](ami[_0xf5b1('0x17')]())[_0xf5b1('0x15')](ami['actionSipPeerStatus']())[_0xf5b1('0x18')](loggerCatch(_0xf5b1('0x19')));}function loggerCatch(_0x59bfc5){return function(_0x516fe4){logger[_0xf5b1('0x1a')](_0x59bfc5,util[_0xf5b1('0x1b')](_0x516fe4,{'showHidden':![],'depth':null}));};}UserReport[_0xf5b1('0x1c')][_0xf5b1('0x13')]=function(){setInterval(function(){BPromise[_0xf5b1('0x14')]()[_0xf5b1('0x15')](ami[_0xf5b1('0x16')]())[_0xf5b1('0x15')](ami[_0xf5b1('0x17')]())['then'](ami[_0xf5b1('0x1d')]())[_0xf5b1('0x18')](loggerCatch(_0xf5b1('0x19')));},0x32c8);};UserReport[_0xf5b1('0x1c')]['isNotNull']=function(_0x145c0a){return _0x145c0a!==null&&!_[_0xf5b1('0x1e')](_0x145c0a);};UserReport['prototype'][_0xf5b1('0x1f')]=function(_0x4a0f6d,_0x5c254f,_0x23d9b0){io['to'](_0x4a0f6d)['emit'](_0x5c254f,_0x23d9b0);};UserReport['prototype'][_0xf5b1('0xd')]=function(_0x67019b){try{if(this[_0xf5b1('0x20')](_0x67019b)){var _0x2a2e9f=_[_0xf5b1('0x21')](this[_0xf5b1('0x9')],{'registry':_0x67019b[_0xf5b1('0x22')]});if(_0x2a2e9f){_0x67019b[_0xf5b1('0x23')]=_0x67019b[_0xf5b1('0x24')];_[_0xf5b1('0x25')](_0x2a2e9f,_[_0xf5b1('0x26')](_0x67019b,[_0xf5b1('0x27'),_0xf5b1('0x28'),_0xf5b1('0x22'),_0xf5b1('0x24')]));this[_0xf5b1('0x1f')](util[_0xf5b1('0x29')](_0xf5b1('0x2a'),_0x2a2e9f[_0xf5b1('0x2b')]),'trunk:save',_0x2a2e9f);}}}catch(_0x3015db){logger[_0xf5b1('0x1a')](_0xf5b1('0x2c'),util[_0xf5b1('0x1b')](_0x3015db,{'showHidden':![],'depth':null}));}};UserReport[_0xf5b1('0x1c')][_0xf5b1('0x10')]=function(_0x3e2a26){try{if(this[_0xf5b1('0x20')](_0x3e2a26)){if(this[_0xf5b1('0xa')][_0x3e2a26['device']]){if(!this[_0xf5b1('0xa')][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x2e')]||_0x3e2a26[_0xf5b1('0x24')][_0xf5b1('0x2f')]()==_0xf5b1('0x30')){this[_0xf5b1('0xa')][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x2e')]=![];if(this[_0xf5b1('0xa')][_0x3e2a26['device']][_0xf5b1('0x24')]!==_0x3e2a26[_0xf5b1('0x24')][_0xf5b1('0x2f')]()){this['agents'][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x31')]=_[_0xf5b1('0x32')](moment()['format']('x'));}this[_0xf5b1('0xa')][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x24')]=_0x3e2a26[_0xf5b1('0x24')]['toLowerCase']();this[_0xf5b1('0xa')][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x33')](_0x3e2a26);}}else if(this[_0xf5b1('0xb')][_0x3e2a26[_0xf5b1('0x2d')]]){if(this[_0xf5b1('0xb')][_0x3e2a26['device']]['state']!==_0x3e2a26[_0xf5b1('0x24')][_0xf5b1('0x2f')]()){this[_0xf5b1('0xb')][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x31')]=_[_0xf5b1('0x32')](moment()['format']('x'));}this[_0xf5b1('0xb')][_0x3e2a26[_0xf5b1('0x2d')]]['state']=_0x3e2a26[_0xf5b1('0x24')]['toLowerCase']();this[_0xf5b1('0x1f')](util[_0xf5b1('0x29')]('telephone:%s',this[_0xf5b1('0xb')][_0x3e2a26['device']][_0xf5b1('0x2b')]),_0xf5b1('0x34'),this[_0xf5b1('0xb')][_0x3e2a26[_0xf5b1('0x2d')]]);}else if(this[_0xf5b1('0x9')][_0x3e2a26[_0xf5b1('0x2d')]]){if(this['trunks'][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x24')]!==_0x3e2a26['state'][_0xf5b1('0x2f')]()){this['trunks'][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x31')]=_[_0xf5b1('0x32')](moment()['format']('x'));}this['trunks'][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x24')]=_0x3e2a26[_0xf5b1('0x24')][_0xf5b1('0x2f')]();this[_0xf5b1('0x1f')](util[_0xf5b1('0x29')](_0xf5b1('0x2a'),this[_0xf5b1('0x9')][_0x3e2a26[_0xf5b1('0x2d')]][_0xf5b1('0x2b')]),'trunk:save',this[_0xf5b1('0x9')][_0x3e2a26['device']]);}else if(_[_0xf5b1('0x35')](_0x3e2a26[_0xf5b1('0x2d')],'Queue')){}else if(_['startsWith'](_0x3e2a26[_0xf5b1('0x2d')],'Local')){var _0x4632e4=_0x3e2a26['device'];var _0x140364=_0x4632e4[_0xf5b1('0x36')](_0x4632e4[_0xf5b1('0x37')]('/')+0x1,_0x4632e4[_0xf5b1('0x37')]('@'));var _0x36b89b=_['find'](this[_0xf5b1('0xa')],function(_0x38bd58){return _0x38bd58[_0xf5b1('0x38')]==_0x140364||_0x38bd58[_0xf5b1('0x39')]==_0x140364||_0x38bd58['accountcode']==_0x140364;});if(_0x36b89b){if(_0x36b89b['state']!==_0x3e2a26[_0xf5b1('0x24')][_0xf5b1('0x2f')]()){_0x36b89b[_0xf5b1('0x31')]=_[_0xf5b1('0x32')](moment()[_0xf5b1('0x29')]('x'));}_0x36b89b[_0xf5b1('0x24')]=_0x3e2a26['state'][_0xf5b1('0x2f')]();_0x36b89b[_0xf5b1('0x2e')]=!![];_0x36b89b[_0xf5b1('0x33')](_0x3e2a26);}}else{}}}catch(_0x48b8b6){logger[_0xf5b1('0x1a')](_0xf5b1('0x3a'),util['inspect'](_0x48b8b6,{'showHidden':![],'depth':null}));}};UserReport[_0xf5b1('0x1c')]['syncPeerStatus']=function(_0x2a0b91){try{if(this['isNotNull'](_0x2a0b91)&&this[_0xf5b1('0x20')](_0x2a0b91[_0xf5b1('0x11')])){if(this[_0xf5b1('0xa')][_0x2a0b91[_0xf5b1('0x3b')]]){if(!this[_0xf5b1('0xa')][_0x2a0b91['peer']][_0xf5b1('0x2e')]||_0x2a0b91[_0xf5b1('0x11')][_0xf5b1('0x2f')]()=='registered'){this[_0xf5b1('0xa')][_0x2a0b91[_0xf5b1('0x3b')]]['local']=![];this[_0xf5b1('0xa')][_0x2a0b91[_0xf5b1('0x3b')]][_0xf5b1('0x3c')]=_0x2a0b91[_0xf5b1('0x11')]['toLowerCase']();this[_0xf5b1('0xa')][_0x2a0b91['peer']][_0xf5b1('0x3d')]=_0x2a0b91[_0xf5b1('0x3d')];this[_0xf5b1('0xa')][_0x2a0b91[_0xf5b1('0x3b')]][_0xf5b1('0x33')](_0x2a0b91);}}else if(this['telephones'][_0x2a0b91[_0xf5b1('0x3b')]]){this['telephones'][_0x2a0b91[_0xf5b1('0x3b')]][_0xf5b1('0x3c')]=_0x2a0b91['peerstatus'][_0xf5b1('0x2f')]();this[_0xf5b1('0xb')][_0x2a0b91[_0xf5b1('0x3b')]][_0xf5b1('0x3d')]=_0x2a0b91['address'];this[_0xf5b1('0x1f')](util[_0xf5b1('0x29')](_0xf5b1('0x3e'),this['telephones'][_0x2a0b91[_0xf5b1('0x3b')]][_0xf5b1('0x2b')]),_0xf5b1('0x34'),this[_0xf5b1('0xb')][_0x2a0b91[_0xf5b1('0x3b')]]);}else if(this[_0xf5b1('0x9')][_0x2a0b91[_0xf5b1('0x3b')]]){this[_0xf5b1('0x9')][_0x2a0b91[_0xf5b1('0x3b')]]['status']=_0x2a0b91['peerstatus'][_0xf5b1('0x2f')]();this[_0xf5b1('0x9')][_0x2a0b91['peer']]['address']=_0x2a0b91[_0xf5b1('0x3d')];this[_0xf5b1('0x1f')](util[_0xf5b1('0x29')](_0xf5b1('0x2a'),this[_0xf5b1('0x9')][_0x2a0b91[_0xf5b1('0x3b')]][_0xf5b1('0x2b')]),_0xf5b1('0x3f'),this['trunks'][_0x2a0b91[_0xf5b1('0x3b')]]);}else{}}}catch(_0x175284){logger[_0xf5b1('0x1a')](_0xf5b1('0x40'),util[_0xf5b1('0x1b')](_0x175284,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9082ca1..1ae983f 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 _0x4df4=['isUndefined','syncAgentCalled','isNotNull','channels','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','emit','user:%s','membername','user:called','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','destconnectedlinenum','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','inspect','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','acw','acwtime','acwTimeout','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment','ioredis','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4df4,0x142));var _0x44df=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x4df4[_0x6173fc];return _0x965fbe;};'use strict';var _=require('lodash');var moment=require(_0x44df('0x0'));var util=require('util');var Redis=require(_0x44df('0x1'));var config=require(_0x44df('0x2'));var logger=require('../../../config/logger')(_0x44df('0x3'));var ami=require('../ami');config[_0x44df('0x4')]=_[_0x44df('0x5')](config[_0x44df('0x4')],{'host':_0x44df('0x6'),'port':0x18eb});var io=require(_0x44df('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x570554){this['channels']={};this['voiceQueues']=_0x570554[_0x44df('0x8')];this[_0x44df('0x9')]=_0x570554[_0x44df('0x9')];this[_0x44df('0xa')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x44df('0xb')](this));ami['on'](_0x44df('0xc'),this['syncAgentConnect']['bind'](this));ami['on'](_0x44df('0xd'),this[_0x44df('0xe')][_0x44df('0xb')](this));ami['on'](_0x44df('0xf'),this[_0x44df('0x10')][_0x44df('0xb')](this));ami['on'](_0x44df('0x11'),this[_0x44df('0x12')][_0x44df('0xb')](this));ami['on'](_0x44df('0x13'),this['syncVarSet'][_0x44df('0xb')](this));ami['on'](_0x44df('0x14'),this['syncHangup'][_0x44df('0xb')](this));ami['on'](_0x44df('0x15'),this[_0x44df('0x16')]['bind'](this));ami['on'](_0x44df('0x17'),this[_0x44df('0x18')][_0x44df('0xb')](this));ami['on'](_0x44df('0x19'),this[_0x44df('0x1a')][_0x44df('0xb')](this));ami['on']('blindtransfer',this[_0x44df('0x1b')][_0x44df('0xb')](this));}VoiceAgentReport[_0x44df('0x1c')]['emit']=function(_0x66595f,_0x2eeff3,_0x2f94df){io['to'](_0x66595f)['emit'](_0x2eeff3,_0x2f94df);};VoiceAgentReport[_0x44df('0x1c')]['isNotNull']=function(_0x25c8a4){return _0x25c8a4!==null&&!_[_0x44df('0x1d')](_0x25c8a4);};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x1e')]=function(_0x5891ae){try{if(this[_0x44df('0x1f')](_0x5891ae)){if(_[_0x44df('0x1d')](this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]])){this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]]={};}if(_[_0x44df('0x1d')](this[_0x44df('0x20')][_0x5891ae['uniqueid']][_0x5891ae['destuniqueid']])){this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae[_0x44df('0x22')]]={'agentcalledAt':moment()[_0x44df('0x23')](_0x44df('0x24')),'lastevent':_0x44df('0x25'),'variables':this[_0x44df('0xa')][_0x5891ae['uniqueid']],'type':this[_0x44df('0x8')][_0x5891ae[_0x44df('0x26')]]?this['voiceQueues'][_0x5891ae[_0x44df('0x26')]][_0x44df('0x27')]||_0x44df('0x28'):_0x44df('0x28')};}_[_0x44df('0x29')](this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae[_0x44df('0x22')]],_[_0x44df('0x2a')](_0x5891ae,['event','privilege']));ami[_0x44df('0x2b')]('custom:agentcalled',this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae['destuniqueid']]);this[_0x44df('0x2b')](util[_0x44df('0x23')](_0x44df('0x2c'),_0x5891ae[_0x44df('0x2d')]),_0x44df('0x2e'),this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae[_0x44df('0x22')]]);}}catch(_0x371bcd){logger['error'](_0x44df('0x2f'),util['inspect'](_0x371bcd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncAgentConnect']=function(_0x125507){try{if(this[_0x44df('0x1f')](_0x125507)){if(this['channels'][_0x125507['uniqueid']]){for(var _0x16a1d2 in this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]]){if(this['channels'][_0x125507['uniqueid']][_0x44df('0x30')](_0x16a1d2)){if(_0x125507[_0x44df('0x22')]===_0x16a1d2){this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2][_0x44df('0x31')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2][_0x44df('0x32')]=_0x44df('0x33');this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x34')]=_0x125507['holdtime'];this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2]['connectedlinenum']=_0x125507[_0x44df('0x35')];this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x36')]=_0x125507[_0x44df('0x36')];this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x37')]=_0x125507[_0x44df('0x37')];this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2]['destchannelstatedesc']=_0x125507[_0x44df('0x38')];_[_0x44df('0x29')](this['agents'][_0x125507[_0x44df('0x39')]],_['pick'](_0x125507,[_0x44df('0x26'),_0x44df('0x3a')]));this[_0x44df('0x2b')](util[_0x44df('0x23')](_0x44df('0x2c'),_0x125507[_0x44df('0x2d')]),_0x44df('0x3b'),this[_0x44df('0x20')][_0x125507['uniqueid']][_0x125507[_0x44df('0x22')]]);ami[_0x44df('0x2b')]('custom:agentconnect',this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2]);}else if(!this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2]['agentringnoanswer']&&!this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x11')]){this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0xd')]=!![];this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x3c')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2][_0x44df('0x3d')]=_0x44df('0x3e');this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x32')]='answered_elsewhere';this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x3f')]=_0x125507['destuniqueid'];this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x40')]=_0x125507['membername'];ami['emit'](_0x44df('0x41'),this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2]);}}}}}}catch(_0xbb73d7){logger[_0x44df('0x42')](_0x44df('0x43'),util[_0x44df('0x44')](_0xbb73d7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0xe')]=function(_0x1ddf22){try{if(this['isNotNull'](_0x1ddf22)){if(this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]]&&this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22[_0x44df('0x22')]]){this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22[_0x44df('0x22')]][_0x44df('0xd')]=!![];this[_0x44df('0x20')][_0x1ddf22['uniqueid']][_0x1ddf22[_0x44df('0x22')]]['agentringnoanswerAt']=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x1ddf22['uniqueid']][_0x1ddf22[_0x44df('0x22')]][_0x44df('0x3d')]=_0x44df('0x45');this['channels'][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22[_0x44df('0x22')]][_0x44df('0x32')]=_0x44df('0x45');ami[_0x44df('0x2b')]('custom:agentringnoanswer',this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22['destuniqueid']]);}}}catch(_0xc2d2f1){logger[_0x44df('0x42')](_0x44df('0x46'),util['inspect'](_0xc2d2f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x10')]=function(_0x3c5e35){try{if(this[_0x44df('0x1f')](_0x3c5e35)){if(this[_0x44df('0x20')][_0x3c5e35['uniqueid']]){for(var _0xaab1a9 in this[_0x44df('0x20')][_0x3c5e35[_0x44df('0x21')]]){if(this['channels'][_0x3c5e35[_0x44df('0x21')]]['hasOwnProperty'](_0xaab1a9)&&!this[_0x44df('0x20')][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9]['agentringnoanswer']&&!this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9][_0x44df('0x11')]){this[_0x44df('0x20')][_0x3c5e35['uniqueid']][_0xaab1a9][_0x44df('0xd')]=!![];this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9][_0x44df('0x3c')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9][_0x44df('0x3d')]=_0x44df('0x47');this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9]['lastevent']=_0x44df('0x47');ami[_0x44df('0x2b')](_0x44df('0x48'),this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9]);}}}}}catch(_0x3f879a){logger[_0x44df('0x42')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x3f879a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncAgentComplete']=function(_0x29562e){try{if(this[_0x44df('0x1f')](_0x29562e)){if(this[_0x44df('0x20')][_0x29562e['uniqueid']]){for(var _0x2929f0 in this[_0x44df('0x20')][_0x29562e['uniqueid']]){if(this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x44df('0x30')](_0x2929f0)){if(this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x31')]&&!this[_0x44df('0x20')][_0x29562e['uniqueid']][_0x2929f0]['agentcomplete']){this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x11')]=!![];this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x49')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this['channels'][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x32')]=_0x44df('0x4a');this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x4b')]=_0x29562e['talktime'];this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x3d')]=_0x29562e[_0x44df('0x3d')]==_0x44df('0x4c')?'agent':_0x29562e[_0x44df('0x3d')];if(this[_0x44df('0x8')][_0x29562e[_0x44df('0x26')]]&&this['voiceQueues'][_0x29562e[_0x44df('0x26')]][_0x44df('0x4d')]){this['channels'][_0x29562e[_0x44df('0x21')]][_0x2929f0]['agentacw']=!![];this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x4e')]=this['voiceQueues'][_0x29562e[_0x44df('0x26')]][_0x44df('0x4f')];}this[_0x44df('0x9')][_0x29562e[_0x44df('0x39')]]=_[_0x44df('0x2a')](this[_0x44df('0x9')][_0x29562e[_0x44df('0x39')]],[_0x44df('0x26'),_0x44df('0x3a')]);this[_0x44df('0x2b')](util[_0x44df('0x23')]('user:%s',_0x29562e[_0x44df('0x2d')]),_0x44df('0x50'),this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0]);ami[_0x44df('0x2b')]('custom:agentcomplete',this['channels'][_0x29562e['uniqueid']][_0x2929f0]);}}}}}}catch(_0x5c93e6){logger[_0x44df('0x42')](_0x44df('0x51'),util[_0x44df('0x44')](_0x5c93e6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x44df('0x52')]=function(_0x527a57){try{if(this[_0x44df('0x1f')](_0x527a57)){this[_0x44df('0x53')](_0x527a57['uniqueid'],_[_0x44df('0x54')](_0x527a57['variable'])[0x0],_0x527a57['value']);if(this['channels'][_0x527a57['uniqueid']]){for(var _0x250c9f in this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]]){if(this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]]['hasOwnProperty'](_0x250c9f)){if(_['isUndefined'](this[_0x44df('0x20')][_0x527a57['uniqueid']][_0x250c9f][_0x44df('0xa')])){this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]][_0x250c9f][_0x44df('0xa')]={};}this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]][_0x250c9f][_0x44df('0xa')]=this[_0x44df('0xa')][_0x527a57['uniqueid']];}}}}}catch(_0x2dba0a){logger[_0x44df('0x42')](_0x44df('0x55'),util[_0x44df('0x44')](_0x2dba0a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x53')]=function(_0x38527e,_0x5ed436,_0x45c4f4){var _0x5df55c=[_0x44df('0x56'),_0x44df('0x57'),_0x44df('0x58'),_0x44df('0x59'),_0x44df('0x5a'),_0x44df('0x5b'),_0x44df('0x5c'),_0x44df('0x5d'),_0x44df('0x5e'),'sipuri',_0x44df('0x5f'),_0x44df('0x60'),'membercalls','memberdynamic','memberinterface',_0x44df('0x61'),_0x44df('0x2d'),_0x44df('0x62'),_0x44df('0x63')];if(!_[_0x44df('0x64')](_0x5ed436)&&!_['includes'](_0x5df55c,_0x5ed436)){if(_[_0x44df('0x1d')](this[_0x44df('0xa')][_0x38527e])){this['variables'][_0x38527e]={};}this['variables'][_0x38527e][_0x5ed436]=_0x45c4f4;}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x65')]=function(_0x2a534a){try{if(this[_0x44df('0x1f')](_0x2a534a)){if(this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]]){for(var _0x5e1e6d in this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]]){if(this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]][_0x44df('0x30')](_0x5e1e6d)){if(this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]][_0x5e1e6d]['reason']==_0x44df('0x4c')&&this[_0x44df('0x20')][_0x2a534a['uniqueid']][_0x5e1e6d][_0x44df('0x11')]){this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]][_0x5e1e6d][_0x44df('0x49')]=moment()[_0x44df('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x44df('0x2b')](_0x44df('0x66'),_[_0x44df('0x67')](this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]]));delete this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]];}if(this[_0x44df('0xa')][_0x2a534a['uniqueid']]){delete this[_0x44df('0xa')][_0x2a534a[_0x44df('0x21')]];}}}catch(_0x542d51){logger['error'](_0x44df('0x68'),util['inspect'](_0x542d51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncAttendedTransfer']=function(_0x41f5b7){try{if(this['isNotNull'](_0x41f5b7)){if(this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]]){for(var _0x4de61b in this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]]){if(this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']][_0x44df('0x30')](_0x4de61b)){if(_0x41f5b7['origtransfereruniqueid']===_0x4de61b){var _0xb9077e=moment();this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']][_0x4de61b][_0x44df('0x11')]=!![];this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]][_0x4de61b]['agentcompleteAt']=moment()[_0x44df('0x23')](_0x44df('0x24'));this['channels'][_0x41f5b7[_0x44df('0x69')]][_0x4de61b][_0x44df('0x3d')]=_0x44df('0x4c');this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]][_0x4de61b]['lastevent']=_0x44df('0x4a');this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']][_0x4de61b][_0x44df('0x4b')]=_0xb9077e[_0x44df('0x6a')](this['channels'][_0x41f5b7[_0x44df('0x69')]][_0x4de61b][_0x44df('0x31')],_0x44df('0x6b'));}}}}if(this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x6c')]]){var _0x41a1b2=this[_0x44df('0x20')][_0x41f5b7['secondtransfereruniqueid']];this['channels'][_0x41f5b7[_0x44df('0x6c')]]=this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]];this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']]=_0x41a1b2;}}}catch(_0x59275a){logger['error'](_0x44df('0x6d'),util['inspect'](_0x59275a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncBlindTransfer']=function(_0x519e84){try{if(this[_0x44df('0x1f')](_0x519e84)){if(this['channels'][_0x519e84['transfereeuniqueid']]){for(var _0x3859fd in this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]]){if(this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]][_0x44df('0x30')](_0x3859fd)){if(_0x519e84[_0x44df('0x6e')]===_0x3859fd){var _0x5f4f30=moment();this['channels'][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x11')]=!![];this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x49')]=_0x5f4f30;this[_0x44df('0x20')][_0x519e84['transfereeuniqueid']][_0x3859fd][_0x44df('0x3d')]=_0x44df('0x4c');this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x32')]=_0x44df('0x4a');this['channels'][_0x519e84['transfereeuniqueid']][_0x3859fd][_0x44df('0x4b')]=_0x5f4f30[_0x44df('0x6a')](this['channels'][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x31')],_0x44df('0x6b'));}}}}}}catch(_0x1b75f6){logger[_0x44df('0x42')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x44df('0x44')](_0x1b75f6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x16')]=function(_0x54e563){var _0x864224='';try{if(this['isNotNull'](_0x54e563)){if(_0x54e563[_0x44df('0x6f')]){_0x864224=_0x54e563[_0x44df('0x6f')]['substring'](0x0,_0x54e563['channel'][_0x44df('0x70')]('-'));if(this[_0x44df('0x9')][_0x864224]){this['agents'][_0x864224][_0x44df('0x71')]=!![];}}}}catch(_0x562511){logger[_0x44df('0x42')](_0x44df('0x72'),util[_0x44df('0x44')](_0x562511,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x2758c4){var _0x2f224c='';try{if(this[_0x44df('0x1f')](_0x2758c4)){if(_0x2758c4[_0x44df('0x6f')]){_0x2f224c=_0x2758c4[_0x44df('0x6f')]['substring'](0x0,_0x2758c4[_0x44df('0x6f')]['lastIndexOf']('-'));if(this['agents'][_0x2f224c]){this['agents'][_0x2f224c][_0x44df('0x71')]=![];}}}}catch(_0xc6cf64){logger[_0x44df('0x42')](_0x44df('0x73'),util[_0x44df('0x44')](_0xc6cf64,{'showHidden':![],'depth':null}));}};module[_0x44df('0x74')]=VoiceAgentReport; \ No newline at end of file +var _0xa51c=['merge','omit','event','privilege','emit','custom:agentcalled','format','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','syncAgentConnect','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:%s','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','inspect','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','user:agentcomplete','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','agentcompleteAt','custom:voiceAgentReport','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncMusicOnHoldStart','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','prototype','isNotNull','uniqueid','isUndefined','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound'];(function(_0x45b429,_0x4e2aa4){var _0x3712b0=function(_0x410755){while(--_0x410755){_0x45b429['push'](_0x45b429['shift']());}};_0x3712b0(++_0x4e2aa4);}(_0xa51c,0x1cc));var _0xca51=function(_0x15904f,_0x253df6){_0x15904f=_0x15904f-0x0;var _0x1f0b10=_0xa51c[_0x15904f];return _0x1f0b10;};'use strict';var _=require(_0xca51('0x0'));var moment=require(_0xca51('0x1'));var util=require('util');var Redis=require(_0xca51('0x2'));var config=require('../../../config/environment');var logger=require(_0xca51('0x3'))(_0xca51('0x4'));var ami=require(_0xca51('0x5'));config[_0xca51('0x6')]=_[_0xca51('0x7')](config[_0xca51('0x6')],{'host':_0xca51('0x8'),'port':0x18eb});var io=require(_0xca51('0x9'))(new Redis(config[_0xca51('0x6')]));function VoiceAgentReport(_0x539155){this[_0xca51('0xa')]={};this[_0xca51('0xb')]=_0x539155[_0xca51('0xb')];this[_0xca51('0xc')]=_0x539155[_0xca51('0xc')];this[_0xca51('0xd')]={};ami['on'](_0xca51('0xe'),this[_0xca51('0xf')][_0xca51('0x10')](this));ami['on'](_0xca51('0x11'),this['syncAgentConnect'][_0xca51('0x10')](this));ami['on'](_0xca51('0x12'),this[_0xca51('0x13')][_0xca51('0x10')](this));ami['on'](_0xca51('0x14'),this[_0xca51('0x15')]['bind'](this));ami['on'](_0xca51('0x16'),this[_0xca51('0x17')][_0xca51('0x10')](this));ami['on'](_0xca51('0x18'),this[_0xca51('0x19')][_0xca51('0x10')](this));ami['on']('hangup',this['syncHangup'][_0xca51('0x10')](this));ami['on']('musiconholdstart',this[_0xca51('0x1a')][_0xca51('0x10')](this));ami['on']('musiconholdstop',this[_0xca51('0x1b')][_0xca51('0x10')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xca51('0x1c'),this[_0xca51('0x1d')][_0xca51('0x10')](this));}VoiceAgentReport[_0xca51('0x1e')]['emit']=function(_0x1215bd,_0x4ff470,_0x3cda02){io['to'](_0x1215bd)['emit'](_0x4ff470,_0x3cda02);};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x1f')]=function(_0x5b6e99){return _0x5b6e99!==null&&!_['isUndefined'](_0x5b6e99);};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0xf')]=function(_0x53f09e){try{if(this['isNotNull'](_0x53f09e)){if(_['isUndefined'](this['channels'][_0x53f09e[_0xca51('0x20')]])){this[_0xca51('0xa')][_0x53f09e[_0xca51('0x20')]]={};}if(_[_0xca51('0x21')](this['channels'][_0x53f09e[_0xca51('0x20')]][_0x53f09e[_0xca51('0x22')]])){this[_0xca51('0xa')][_0x53f09e[_0xca51('0x20')]][_0x53f09e[_0xca51('0x22')]]={'agentcalledAt':moment()['format'](_0xca51('0x23')),'lastevent':_0xca51('0x24'),'variables':this[_0xca51('0xd')][_0x53f09e[_0xca51('0x20')]],'type':this[_0xca51('0xb')][_0x53f09e[_0xca51('0x25')]]?this[_0xca51('0xb')][_0x53f09e['queue']][_0xca51('0x26')]||_0xca51('0x27'):_0xca51('0x27')};}_[_0xca51('0x28')](this[_0xca51('0xa')][_0x53f09e[_0xca51('0x20')]][_0x53f09e[_0xca51('0x22')]],_[_0xca51('0x29')](_0x53f09e,[_0xca51('0x2a'),_0xca51('0x2b')]));ami[_0xca51('0x2c')](_0xca51('0x2d'),this['channels'][_0x53f09e[_0xca51('0x20')]][_0x53f09e[_0xca51('0x22')]]);this['emit'](util[_0xca51('0x2e')]('user:%s',_0x53f09e[_0xca51('0x2f')]),_0xca51('0x30'),this['channels'][_0x53f09e['uniqueid']][_0x53f09e[_0xca51('0x22')]]);}}catch(_0x787207){logger[_0xca51('0x31')](_0xca51('0x32'),util['inspect'](_0x787207,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xca51('0x33')]=function(_0x4ec926){try{if(this[_0xca51('0x1f')](_0x4ec926)){if(this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]]){for(var _0x1dc0a8 in this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]]){if(this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]]['hasOwnProperty'](_0x1dc0a8)){if(_0x4ec926[_0xca51('0x22')]===_0x1dc0a8){this['channels'][_0x4ec926['uniqueid']][_0x1dc0a8]['agentconnectAt']=moment()[_0xca51('0x2e')](_0xca51('0x23'));this[_0xca51('0xa')][_0x4ec926['uniqueid']][_0x1dc0a8][_0xca51('0x34')]=_0xca51('0x35');this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x36')]=_0x4ec926[_0xca51('0x36')];this['channels'][_0x4ec926['uniqueid']][_0x1dc0a8]['connectedlinenum']=_0x4ec926[_0xca51('0x37')];this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x38')]=_0x4ec926[_0xca51('0x38')];this['channels'][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x39')]=_0x4ec926[_0xca51('0x39')];this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x3a')]=_0x4ec926['destchannelstatedesc'];_[_0xca51('0x28')](this[_0xca51('0xc')][_0x4ec926[_0xca51('0x3b')]],_[_0xca51('0x3c')](_0x4ec926,[_0xca51('0x25'),_0xca51('0x3d')]));this[_0xca51('0x2c')](util[_0xca51('0x2e')](_0xca51('0x3e'),_0x4ec926[_0xca51('0x2f')]),'user:agentconnect',this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x4ec926[_0xca51('0x22')]]);ami[_0xca51('0x2c')](_0xca51('0x3f'),this['channels'][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8]);}else if(!this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x12')]&&!this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x16')]){this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8]['agentringnoanswer']=!![];this[_0xca51('0xa')][_0x4ec926['uniqueid']][_0x1dc0a8][_0xca51('0x40')]=moment()['format'](_0xca51('0x23'));this['channels'][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x41')]='answered_elsewhere';this['channels'][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x34')]=_0xca51('0x42');this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x43')]=_0x4ec926[_0xca51('0x22')];this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8][_0xca51('0x44')]=_0x4ec926[_0xca51('0x2f')];ami[_0xca51('0x2c')](_0xca51('0x45'),this[_0xca51('0xa')][_0x4ec926[_0xca51('0x20')]][_0x1dc0a8]);}}}}}}catch(_0xc0f51f){logger[_0xca51('0x31')]('[syncAgentConnect][VoiceAgentReport]',util[_0xca51('0x46')](_0xc0f51f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x13')]=function(_0x5ea15d){try{if(this[_0xca51('0x1f')](_0x5ea15d)){if(this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]]&&this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]][_0x5ea15d[_0xca51('0x22')]]){this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]][_0x5ea15d[_0xca51('0x22')]]['agentringnoanswer']=!![];this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]][_0x5ea15d[_0xca51('0x22')]][_0xca51('0x40')]=moment()[_0xca51('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]][_0x5ea15d[_0xca51('0x22')]][_0xca51('0x41')]=_0xca51('0x47');this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]][_0x5ea15d['destuniqueid']][_0xca51('0x34')]=_0xca51('0x47');ami['emit']('custom:agentringnoanswer',this[_0xca51('0xa')][_0x5ea15d[_0xca51('0x20')]][_0x5ea15d[_0xca51('0x22')]]);}}}catch(_0x117d75){logger[_0xca51('0x31')](_0xca51('0x48'),util[_0xca51('0x46')](_0x117d75,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x15')]=function(_0xb5175c){try{if(this[_0xca51('0x1f')](_0xb5175c)){if(this['channels'][_0xb5175c[_0xca51('0x20')]]){for(var _0x33d86e in this['channels'][_0xb5175c['uniqueid']]){if(this[_0xca51('0xa')][_0xb5175c[_0xca51('0x20')]][_0xca51('0x49')](_0x33d86e)&&!this[_0xca51('0xa')][_0xb5175c[_0xca51('0x20')]][_0x33d86e][_0xca51('0x12')]&&!this['channels'][_0xb5175c[_0xca51('0x20')]][_0x33d86e][_0xca51('0x16')]){this[_0xca51('0xa')][_0xb5175c[_0xca51('0x20')]][_0x33d86e][_0xca51('0x12')]=!![];this[_0xca51('0xa')][_0xb5175c[_0xca51('0x20')]][_0x33d86e]['agentringnoanswerAt']=moment()[_0xca51('0x2e')](_0xca51('0x23'));this[_0xca51('0xa')][_0xb5175c['uniqueid']][_0x33d86e][_0xca51('0x41')]=_0xca51('0x4a');this[_0xca51('0xa')][_0xb5175c[_0xca51('0x20')]][_0x33d86e][_0xca51('0x34')]='abandoned';ami[_0xca51('0x2c')]('custom:agentqueuecallerabandon',this[_0xca51('0xa')][_0xb5175c[_0xca51('0x20')]][_0x33d86e]);}}}}}catch(_0x3638f4){logger['error'](_0xca51('0x4b'),util['inspect'](_0x3638f4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x17')]=function(_0x58b738){try{if(this[_0xca51('0x1f')](_0x58b738)){if(this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]]){for(var _0x4d523a in this['channels'][_0x58b738[_0xca51('0x20')]]){if(this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0xca51('0x49')](_0x4d523a)){if(this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0x4d523a][_0xca51('0x4c')]&&!this['channels'][_0x58b738[_0xca51('0x20')]][_0x4d523a][_0xca51('0x16')]){this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0x4d523a][_0xca51('0x16')]=!![];this['channels'][_0x58b738[_0xca51('0x20')]][_0x4d523a]['agentcompleteAt']=moment()[_0xca51('0x2e')](_0xca51('0x23'));this[_0xca51('0xa')][_0x58b738['uniqueid']][_0x4d523a][_0xca51('0x34')]=_0xca51('0x4d');this[_0xca51('0xa')][_0x58b738['uniqueid']][_0x4d523a]['talktime']=_0x58b738[_0xca51('0x4e')];this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0x4d523a]['reason']=_0x58b738[_0xca51('0x41')]==_0xca51('0x4f')?'agent':_0x58b738[_0xca51('0x41')];if(this[_0xca51('0xb')][_0x58b738[_0xca51('0x25')]]&&this['voiceQueues'][_0x58b738[_0xca51('0x25')]][_0xca51('0x50')]){this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0x4d523a][_0xca51('0x51')]=!![];this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0x4d523a][_0xca51('0x52')]=this[_0xca51('0xb')][_0x58b738[_0xca51('0x25')]][_0xca51('0x53')];}this[_0xca51('0xc')][_0x58b738['interface']]=_['omit'](this[_0xca51('0xc')][_0x58b738[_0xca51('0x3b')]],[_0xca51('0x25'),_0xca51('0x3d')]);this['emit'](util['format'](_0xca51('0x3e'),_0x58b738[_0xca51('0x2f')]),_0xca51('0x54'),this[_0xca51('0xa')][_0x58b738[_0xca51('0x20')]][_0x4d523a]);ami[_0xca51('0x2c')]('custom:agentcomplete',this[_0xca51('0xa')][_0x58b738['uniqueid']][_0x4d523a]);}}}}}}catch(_0x145ada){logger[_0xca51('0x31')]('[syncAgentComplete][VoiceAgentReport]',util['inspect'](_0x145ada,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xca51('0x19')]=function(_0x200562){try{if(this[_0xca51('0x1f')](_0x200562)){this[_0xca51('0x55')](_0x200562[_0xca51('0x20')],_[_0xca51('0x56')](_0x200562[_0xca51('0x57')])[0x0],_0x200562[_0xca51('0x58')]);if(this['channels'][_0x200562[_0xca51('0x20')]]){for(var _0x469d93 in this[_0xca51('0xa')][_0x200562[_0xca51('0x20')]]){if(this[_0xca51('0xa')][_0x200562[_0xca51('0x20')]][_0xca51('0x49')](_0x469d93)){if(_[_0xca51('0x21')](this[_0xca51('0xa')][_0x200562[_0xca51('0x20')]][_0x469d93]['variables'])){this['channels'][_0x200562[_0xca51('0x20')]][_0x469d93][_0xca51('0xd')]={};}this[_0xca51('0xa')][_0x200562[_0xca51('0x20')]][_0x469d93]['variables']=this['variables'][_0x200562[_0xca51('0x20')]];}}}}}catch(_0x686773){logger[_0xca51('0x31')](_0xca51('0x59'),util[_0xca51('0x46')](_0x686773,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x55')]=function(_0x4c8d7a,_0x37a29a,_0x4cda8e){var _0x55cab0=['rtpaudioqos',_0xca51('0x5a'),_0xca51('0x5b'),_0xca51('0x5c'),_0xca51('0x5d'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xca51('0x5e'),_0xca51('0x5f'),_0xca51('0x60'),_0xca51('0x61'),_0xca51('0x62'),_0xca51('0x63'),_0xca51('0x64'),_0xca51('0x65'),_0xca51('0x66'),_0xca51('0x2f'),_0xca51('0x67'),_0xca51('0x68')];if(!_[_0xca51('0x69')](_0x37a29a)&&!_[_0xca51('0x6a')](_0x55cab0,_0x37a29a)){if(_[_0xca51('0x21')](this[_0xca51('0xd')][_0x4c8d7a])){this[_0xca51('0xd')][_0x4c8d7a]={};}this[_0xca51('0xd')][_0x4c8d7a][_0x37a29a]=_0x4cda8e;}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x6b')]=function(_0x957e2f){try{if(this[_0xca51('0x1f')](_0x957e2f)){if(this[_0xca51('0xa')][_0x957e2f[_0xca51('0x20')]]){for(var _0x470eab in this[_0xca51('0xa')][_0x957e2f['uniqueid']]){if(this[_0xca51('0xa')][_0x957e2f[_0xca51('0x20')]]['hasOwnProperty'](_0x470eab)){if(this[_0xca51('0xa')][_0x957e2f[_0xca51('0x20')]][_0x470eab][_0xca51('0x41')]==_0xca51('0x4f')&&this[_0xca51('0xa')][_0x957e2f['uniqueid']][_0x470eab][_0xca51('0x16')]){this[_0xca51('0xa')][_0x957e2f[_0xca51('0x20')]][_0x470eab][_0xca51('0x6c')]=moment()[_0xca51('0x2e')](_0xca51('0x23'));}}}ami['emit'](_0xca51('0x6d'),_['values'](this['channels'][_0x957e2f[_0xca51('0x20')]]));delete this[_0xca51('0xa')][_0x957e2f[_0xca51('0x20')]];}if(this[_0xca51('0xd')][_0x957e2f[_0xca51('0x20')]]){delete this[_0xca51('0xd')][_0x957e2f[_0xca51('0x20')]];}}}catch(_0x4b3ebc){logger[_0xca51('0x31')]('[syncHangup][VoiceAgentReport]',util[_0xca51('0x46')](_0x4b3ebc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xca51('0x6e')]=function(_0x585c64){try{if(this[_0xca51('0x1f')](_0x585c64)){if(this[_0xca51('0xa')][_0x585c64[_0xca51('0x6f')]]){for(var _0x4147fb in this[_0xca51('0xa')][_0x585c64[_0xca51('0x6f')]]){if(this[_0xca51('0xa')][_0x585c64[_0xca51('0x6f')]][_0xca51('0x49')](_0x4147fb)){if(_0x585c64[_0xca51('0x70')]===_0x4147fb){var _0x3dd660=moment();this['channels'][_0x585c64[_0xca51('0x6f')]][_0x4147fb]['agentcomplete']=!![];this[_0xca51('0xa')][_0x585c64[_0xca51('0x6f')]][_0x4147fb]['agentcompleteAt']=moment()[_0xca51('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x585c64[_0xca51('0x6f')]][_0x4147fb][_0xca51('0x41')]=_0xca51('0x4f');this[_0xca51('0xa')][_0x585c64['transfereeuniqueid']][_0x4147fb]['lastevent']=_0xca51('0x4d');this['channels'][_0x585c64['transfereeuniqueid']][_0x4147fb]['talktime']=_0x3dd660[_0xca51('0x71')](this['channels'][_0x585c64[_0xca51('0x6f')]][_0x4147fb]['agentconnectAt'],_0xca51('0x72'));}}}}if(this['channels'][_0x585c64[_0xca51('0x73')]]){var _0x1e53bd=this[_0xca51('0xa')][_0x585c64['secondtransfereruniqueid']];this[_0xca51('0xa')][_0x585c64[_0xca51('0x73')]]=this[_0xca51('0xa')][_0x585c64[_0xca51('0x6f')]];this[_0xca51('0xa')][_0x585c64[_0xca51('0x6f')]]=_0x1e53bd;}}}catch(_0x5314bb){logger[_0xca51('0x31')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0xca51('0x46')](_0x5314bb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x1d')]=function(_0x5e3e21){try{if(this[_0xca51('0x1f')](_0x5e3e21)){if(this[_0xca51('0xa')][_0x5e3e21[_0xca51('0x6f')]]){for(var _0x1659ee in this[_0xca51('0xa')][_0x5e3e21[_0xca51('0x6f')]]){if(this[_0xca51('0xa')][_0x5e3e21[_0xca51('0x6f')]][_0xca51('0x49')](_0x1659ee)){if(_0x5e3e21[_0xca51('0x74')]===_0x1659ee){var _0x3a2908=moment();this[_0xca51('0xa')][_0x5e3e21['transfereeuniqueid']][_0x1659ee]['agentcomplete']=!![];this['channels'][_0x5e3e21['transfereeuniqueid']][_0x1659ee][_0xca51('0x6c')]=_0x3a2908;this[_0xca51('0xa')][_0x5e3e21[_0xca51('0x6f')]][_0x1659ee]['reason']=_0xca51('0x4f');this['channels'][_0x5e3e21[_0xca51('0x6f')]][_0x1659ee][_0xca51('0x34')]=_0xca51('0x4d');this[_0xca51('0xa')][_0x5e3e21[_0xca51('0x6f')]][_0x1659ee][_0xca51('0x4e')]=_0x3a2908['diff'](this[_0xca51('0xa')][_0x5e3e21[_0xca51('0x6f')]][_0x1659ee]['agentconnectAt'],_0xca51('0x72'));}}}}}}catch(_0xe34d2){logger[_0xca51('0x31')](_0xca51('0x75'),util['inspect'](_0xe34d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x1a')]=function(_0x5a960d){var _0x868630='';try{if(this[_0xca51('0x1f')](_0x5a960d)){if(_0x5a960d[_0xca51('0x76')]){_0x868630=_0x5a960d[_0xca51('0x76')][_0xca51('0x77')](0x0,_0x5a960d[_0xca51('0x76')]['lastIndexOf']('-'));if(this['agents'][_0x868630]){this['agents'][_0x868630][_0xca51('0x78')]=!![];}}}}catch(_0x3e3757){logger[_0xca51('0x31')](_0xca51('0x79'),util[_0xca51('0x46')](_0x3e3757,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xca51('0x1e')][_0xca51('0x1b')]=function(_0x59c34c){var _0x411196='';try{if(this['isNotNull'](_0x59c34c)){if(_0x59c34c['channel']){_0x411196=_0x59c34c['channel'][_0xca51('0x77')](0x0,_0x59c34c[_0xca51('0x76')][_0xca51('0x7a')]('-'));if(this[_0xca51('0xc')][_0x411196]){this[_0xca51('0xc')][_0x411196][_0xca51('0x78')]=![];}}}}catch(_0x175782){logger[_0xca51('0x31')](_0xca51('0x7b'),util[_0xca51('0x46')](_0x175782,{'showHidden':![],'depth':null}));}};module[_0xca51('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 1b80ea6..059e93e 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 _0xbcba=['syncMusicOnHoldStop','resolve','then','catch','log','prototype','isUndefined','emit','syncNewCallerId','isNotNull','uniqueid','pick','keys','error','[syncNewCallerId][VoiceCallReport]','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','merge','context','from-sip','split','channel','destconnectedlinenum','exten','format','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','appdata','duration','subtract','includes','lastapplication','lastdata','applicationdata','set','startsWith','cdr(','linkedid','channelstate','answered','answertime','holdtime','diff','seconds','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','.wav49','replace','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','parse','sipcalllinkedid','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','unknown','not_inuse','invalid','unavailable','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart'];(function(_0x1235b9,_0x42c5d8){var _0x190f27=function(_0x334b5f){while(--_0x334b5f){_0x1235b9['push'](_0x1235b9['shift']());}};_0x190f27(++_0x42c5d8);}(_0xbcba,0x6d));var _0xabcb=function(_0x32795d,_0x19020c){_0x32795d=_0x32795d-0x0;var _0x4248c2=_0xbcba[_0x32795d];return _0x4248c2;};'use strict';var BPromise=require(_0xabcb('0x0'));var _=require(_0xabcb('0x1'));var moment=require('moment');var util=require(_0xabcb('0x2'));var path=require(_0xabcb('0x3'));var Redis=require(_0xabcb('0x4'));var config=require(_0xabcb('0x5'));var logger=require(_0xabcb('0x6'))(_0xabcb('0x7'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0xabcb('0x8'),_0xabcb('0x9'),'inuse','busy',_0xabcb('0xa'),_0xabcb('0xb'),'ringing','ringinuse',_0xabcb('0xc')];var applications=['set',_0xabcb('0xd'),_0xabcb('0xe'),_0xabcb('0xf'),_0xabcb('0x10'),'voicemail'];var dispositions=[_0xabcb('0x11'),_0xabcb('0x12'),_0xabcb('0x12'),_0xabcb('0x11'),_0xabcb('0x11'),_0xabcb('0x11'),_0xabcb('0x13'),_0xabcb('0x14'),'FAILED',_0xabcb('0x12'),_0xabcb('0x12')];var actions={};config[_0xabcb('0x15')]=_[_0xabcb('0x16')](config[_0xabcb('0x15')],{'host':_0xabcb('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xabcb('0x15')]));function VoiceCallReport(_0xac23e){this[_0xabcb('0x18')]=_0xac23e[_0xabcb('0x18')];this[_0xabcb('0x19')]=_0xac23e[_0xabcb('0x19')];ami['on'](_0xabcb('0x1a'),this[_0xabcb('0x1b')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x1d'),this['syncNewExten'][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x1e'),this[_0xabcb('0x1f')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x20'),this[_0xabcb('0x21')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x22'),this[_0xabcb('0x23')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x24'),this[_0xabcb('0x25')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x26'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0xabcb('0x27')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x28'),this[_0xabcb('0x29')][_0xabcb('0x1c')](this));ami['on']('musiconholdstart',this[_0xabcb('0x2a')]['bind'](this));ami['on']('musiconholdstop',this[_0xabcb('0x2b')][_0xabcb('0x1c')](this));return BPromise[_0xabcb('0x2c')]()[_0xabcb('0x2d')](ami['actionCoreShowChannels']())[_0xabcb('0x2e')](function(_0x1b972c){console[_0xabcb('0x2f')](_0x1b972c);});}VoiceCallReport[_0xabcb('0x30')]['isNotNull']=function(_0x461866){return _0x461866!==null&&!_[_0xabcb('0x31')](_0x461866);};VoiceCallReport['prototype']['emit']=function(_0x1b0938,_0x5e5533,_0x1bbf15){io['to'](_0x1b0938)[_0xabcb('0x32')](_0x5e5533,_0x1bbf15);};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x33')]=function(_0x342383){try{if(this[_0xabcb('0x34')](_0x342383)){if(_0x342383[_0xabcb('0x35')]===_0x342383['linkedid']){if(!_['isUndefined'](this[_0xabcb('0x18')][_0x342383[_0xabcb('0x35')]])){_['merge'](this[_0xabcb('0x18')][_0x342383[_0xabcb('0x35')]],_[_0xabcb('0x36')](_0x342383,_[_0xabcb('0x37')](this[_0xabcb('0x18')][_0x342383[_0xabcb('0x35')]])));}}}}catch(_0x4f2223){logger[_0xabcb('0x38')](_0xabcb('0x39'),util['inspect'](_0x4f2223,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x1f')]=function(_0x49aff7){try{if(this[_0xabcb('0x34')](_0x49aff7)){if(_0x49aff7[_0xabcb('0x35')]===_0x49aff7['linkedid']&&_0x49aff7['channel']!=_0xabcb('0x3a')){if(_['isUndefined'](this[_0xabcb('0x18')][_0x49aff7['uniqueid']])){this['channels'][_0x49aff7['uniqueid']]=new Channel();this[_0xabcb('0x18')][_0x49aff7[_0xabcb('0x35')]][_0xabcb('0x3b')]=moment()['format'](_0xabcb('0x3c'));this[_0xabcb('0x18')][_0x49aff7[_0xabcb('0x35')]][_0xabcb('0x3d')]=dispositions[_['toNumber'](_0x49aff7['channelstate'])];_[_0xabcb('0x3e')](this[_0xabcb('0x18')][_0x49aff7['uniqueid']],_[_0xabcb('0x36')](_0x49aff7,_[_0xabcb('0x37')](this[_0xabcb('0x18')][_0x49aff7['uniqueid']])));if(_0x49aff7[_0xabcb('0x3f')]===_0xabcb('0x40')){if(this[_0xabcb('0x19')][_0x49aff7['channel'][_0xabcb('0x41')]('-')[0x0]]){this[_0xabcb('0x19')][_0x49aff7[_0xabcb('0x42')]['split']('-')[0x0]][_0xabcb('0x43')]=_0x49aff7[_0xabcb('0x44')];this[_0xabcb('0x32')](util[_0xabcb('0x45')](_0xabcb('0x46'),this['agents'][_0x49aff7[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]][_0xabcb('0x47')]),_0xabcb('0x48'),{'destaccountcode':this[_0xabcb('0x19')][_0x49aff7['channel'][_0xabcb('0x41')]('-')[0x0]][_0xabcb('0x49')],'destconnectedlinenum':_0x49aff7[_0xabcb('0x44')]});}}}}}}catch(_0x228837){logger[_0xabcb('0x38')](_0xabcb('0x4a'),util[_0xabcb('0x4b')](_0x228837,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x1b')]=function(_0xb4e681){try{if(this[_0xabcb('0x34')](_0xb4e681)){if(_0xb4e681[_0xabcb('0x35')]===_0xb4e681['linkedid']&&_0xb4e681['exten']!='h'&&_0xb4e681[_0xabcb('0x42')]!='OutgoingSpoolFailed'){_0xb4e681[_0xabcb('0x4c')]=_0xb4e681['application']['toLowerCase']();_0xb4e681['applicationdata']=(_0xb4e681[_0xabcb('0x4d')]||_0xb4e681['applicationdata'])['toLowerCase']();if(_[_0xabcb('0x31')](this[_0xabcb('0x18')][_0xb4e681['uniqueid']])){this[_0xabcb('0x18')][_0xb4e681[_0xabcb('0x35')]]=new Channel();this[_0xabcb('0x18')][_0xb4e681['uniqueid']]['starttime']=_0xb4e681[_0xabcb('0x4e')]?moment()[_0xabcb('0x4f')](moment[_0xabcb('0x4e')](_0xb4e681['duration'])['seconds'](),'seconds')[_0xabcb('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xabcb('0x45')](_0xabcb('0x3c'));this[_0xabcb('0x18')][_0xb4e681['uniqueid']][_0xabcb('0x3d')]='NO\x20ANSWER';}_[_0xabcb('0x3e')](this['channels'][_0xb4e681['uniqueid']],_[_0xabcb('0x36')](_0xb4e681,_[_0xabcb('0x37')](this[_0xabcb('0x18')][_0xb4e681['uniqueid']])));if(_[_0xabcb('0x50')](applications,_0xb4e681[_0xabcb('0x4c')])){this['channels'][_0xb4e681['uniqueid']][_0xabcb('0x51')]=_0xb4e681[_0xabcb('0x4c')];this[_0xabcb('0x18')][_0xb4e681['uniqueid']][_0xabcb('0x52')]=_0xb4e681[_0xabcb('0x53')];if(_0xb4e681[_0xabcb('0x4c')]===_0xabcb('0x54')&&_[_0xabcb('0x55')](_0xb4e681[_0xabcb('0x53')],_0xabcb('0x56'))){var _0x4e0a33=_0xb4e681['applicationdata']['split']('=');var _0x12036c=_0x4e0a33[0x0]['match'](/cdr\((.*)\)/);if(_0x12036c){this['channels'][_0xb4e681[_0xabcb('0x35')]][_0x12036c[0x1]]=_0x4e0a33[0x1];}}else if(_0xb4e681[_0xabcb('0x4c')]===_0xabcb('0xd')){this[_0xabcb('0x18')][_0xb4e681['uniqueid']][_0xabcb('0xd')]=_0xb4e681[_0xabcb('0x53')][_0xabcb('0x41')](',')[0x0];}}}}}catch(_0x3e41e3){logger[_0xabcb('0x38')]('[syncNewExten][VoiceCallReport]',util[_0xabcb('0x4b')](_0x3e41e3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabcb('0x21')]=function(_0x216c38){try{if(this[_0xabcb('0x34')](_0x216c38)){if(_0x216c38[_0xabcb('0x35')]!==_0x216c38[_0xabcb('0x57')]){if(this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]){if(_0x216c38[_0xabcb('0x58')]==='6'){if(!this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x59')]){var _0x59aedd=moment();this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]['answered']=!![];this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x5a')]=_0x59aedd[_0xabcb('0x45')](_0xabcb('0x3c'));if(this['channels'][_0x216c38['linkedid']][_0xabcb('0x3b')]){this[_0xabcb('0x18')][_0x216c38['linkedid']][_0xabcb('0x5b')]=_0x59aedd[_0xabcb('0x5c')](this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]['starttime'],_0xabcb('0x5d'));}}this[_0xabcb('0x18')][_0x216c38['linkedid']][_0xabcb('0x57')]=_0x216c38[_0xabcb('0x35')];if(_0x216c38[_0xabcb('0x5e')]!==_0xabcb('0x5f')){this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x60')]=_0x216c38[_0xabcb('0x5e')];}this['channels'][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x61')]=_0x216c38['calleridname'];this['channels'][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x62')]=_0x216c38[_0xabcb('0x42')];this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]['disposition']=dispositions[_['toNumber'](_0x216c38[_0xabcb('0x58')])];if(this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')]['split']('-')[0x0]]){this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x63')]=this[_0xabcb('0x19')][_0x216c38['channel'][_0xabcb('0x41')]('-')[0x0]]['id'];this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x64')]=this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')]['split']('-')[0x0]][_0xabcb('0x47')];}}}}else{if(this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x35')]]){if(_0x216c38[_0xabcb('0x58')]==='6'){if(this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')]['split']('-')[0x0]]){this['channels'][_0x216c38[_0xabcb('0x35')]]['UserId']=this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]['id'];this['channels'][_0x216c38[_0xabcb('0x35')]][_0xabcb('0x64')]=this[_0xabcb('0x19')][_0x216c38['channel']['split']('-')[0x0]]['name'];}}}}}}catch(_0x1793d6){logger[_0xabcb('0x38')]('[syncNewState][VoiceCallReport]',util[_0xabcb('0x4b')](_0x1793d6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x65')]=function(_0xa6bc2e,_0x3b9bbc){if(this[_0xabcb('0x18')][_0xa6bc2e]){this['channels'][_0xa6bc2e]['monitor']=!![];if(_['endsWith'](_0x3b9bbc,_0xabcb('0x66'))){_0x3b9bbc=_0x3b9bbc[_0xabcb('0x67')](_0xabcb('0x66'),_0xabcb('0x68'));}this[_0xabcb('0x18')][_0xa6bc2e]['monitorFilename']=_0x3b9bbc;var _0x474c0f=_[_0xabcb('0x69')](this[_0xabcb('0x18')][_0xa6bc2e][_0xabcb('0x6a')],{'filename':_0x3b9bbc});if(_[_0xabcb('0x6b')](_0x474c0f)){this['channels'][_0xa6bc2e][_0xabcb('0x6a')][_0xabcb('0x6c')]({'filename':_0x3b9bbc,'createdAt':moment()[_0xabcb('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xabcb('0x6d')});}}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x23')]=function(_0xc7aa8b){try{if(this[_0xabcb('0x34')](_0xc7aa8b)){if(this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]&&_0xc7aa8b[_0xabcb('0x42')]!=_0xabcb('0x3a')){if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')])){if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x6f')])){this[_0xabcb('0x65')](_0xc7aa8b['uniqueid'],_0xc7aa8b[_0xabcb('0x70')]);}else if(this[_0xabcb('0x34')](_0xc7aa8b['variable'][_0xabcb('0x71')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]['calleridnum']=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x72')])){this['channels'][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x73')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x74')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x75')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x76')])){this['channels'][_0xc7aa8b[_0xabcb('0x35')]]['queue']=_0xc7aa8b[_0xabcb('0x70')][_0xabcb('0x41')](',')[0x0];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x77')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x78')]=_0xc7aa8b['value'];}else if(this['isNotNull'](_0xc7aa8b['variable'][_0xabcb('0x79')])){this['channels'][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x7a')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x7b')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x7c')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x7d')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]['queue']=_0xc7aa8b[_0xabcb('0x70')];}else if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x7e')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]['sipcalluniqueid']=_0xc7aa8b[_0xabcb('0x70')];}}}else if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x6f')])){if(_0xc7aa8b[_0xabcb('0x70')]){var _0x2181c4=path[_0xabcb('0x7f')](_0xc7aa8b[_0xabcb('0x70')])[_0xabcb('0x47')];this[_0xabcb('0x65')](_0x2181c4,_0xc7aa8b['value']);}}else if(this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x57')]]){if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')])){if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')]['sipcallid'])){this[_0xabcb('0x18')][_0xc7aa8b['linkedid']][_0xabcb('0x80')]=_0xc7aa8b[_0xabcb('0x70')];}}}}}catch(_0x2ae36b){logger[_0xabcb('0x38')]('[syncVarSet][VoiceCallReport]',util[_0xabcb('0x4b')](_0x2ae36b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x2adac1){try{if(this[_0xabcb('0x34')](_0x2adac1)){if(this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]]){var _0x36d5a7=moment();this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]]['endtime']=_0x36d5a7['format'](_0xabcb('0x3c'));this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x4e')]=_0x36d5a7['diff'](this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x3b')],'seconds');if(this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x59')]){this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x81')]=_0x36d5a7[_0xabcb('0x5c')](this[_0xabcb('0x18')][_0x2adac1['uniqueid']][_0xabcb('0x5a')],_0xabcb('0x5d'));this[_0xabcb('0x18')][_0x2adac1['uniqueid']][_0xabcb('0x5b')]=this['channels'][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x4e')]-this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x81')];}if(_0x2adac1[_0xabcb('0x3f')]==='from-sip'){if(this['agents'][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]){this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]=_[_0xabcb('0x82')](this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]],['destconnectedlinenum']);this[_0xabcb('0x32')](util['format'](_0xabcb('0x46'),this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]][_0xabcb('0x47')]),_0xabcb('0x83'),{'destaccountcode':this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]['accountcode']});}}ami[_0xabcb('0x32')](_0xabcb('0x84'),this['channels'][_0x2adac1[_0xabcb('0x35')]]);delete this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]];}}}catch(_0x44e4e4){logger['error'](_0xabcb('0x85'),util[_0xabcb('0x4b')](_0x44e4e4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x27')]=function(_0x1e6a99){try{if(this[_0xabcb('0x34')](_0x1e6a99)){if(this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]]){this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]][_0xabcb('0x87')]=_0x1e6a99[_0xabcb('0x88')];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]][_0xabcb('0x89')]=_0x1e6a99['transfertargetcalleridnum'];if(this['channels'][_0x1e6a99[_0xabcb('0x8a')]]){var _0x320faa=this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8a')]];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8a')]]=this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]];this['channels'][_0x1e6a99['transfereeuniqueid']]=_0x320faa;}}else if(this['channels'][_0x1e6a99[_0xabcb('0x8b')]]){this[_0xabcb('0x18')][_0x1e6a99['transfertargetuniqueid']][_0xabcb('0x87')]=_0x1e6a99[_0xabcb('0x88')];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8b')]][_0xabcb('0x89')]=_0x1e6a99[_0xabcb('0x8c')];if(this['channels'][_0x1e6a99[_0xabcb('0x8d')]]){var _0x320faa=this['channels'][_0x1e6a99['origtransfereruniqueid']];this[_0xabcb('0x18')][_0x1e6a99['origtransfereruniqueid']]=this[_0xabcb('0x18')][_0x1e6a99['transfertargetuniqueid']];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8b')]]=_0x320faa;}}}}catch(_0x214e6b){logger[_0xabcb('0x38')](_0xabcb('0x8e'),util['inspect'](_0x214e6b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabcb('0x29')]=function(_0x51738c){try{if(this[_0xabcb('0x34')](_0x51738c)){if(this[_0xabcb('0x18')][_0x51738c['transfereeuniqueid']]){this['channels'][_0x51738c[_0xabcb('0x86')]][_0xabcb('0x87')]=_0x51738c[_0xabcb('0x8f')];this[_0xabcb('0x18')][_0x51738c[_0xabcb('0x86')]]['transferconnectedlinenum']=_0x51738c[_0xabcb('0x90')];this[_0xabcb('0x25')]({'event':'BlindTransfer','uniqueid':_0x51738c[_0xabcb('0x86')],'context':_0x51738c[_0xabcb('0x3f')],'channel':_0x51738c[_0xabcb('0x91')]});}}}catch(_0x18b74d){logger[_0xabcb('0x38')](_0xabcb('0x92'),util[_0xabcb('0x4b')](_0x18b74d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')]['syncMusicOnHoldStart']=function(_0x5470bb){try{if(this[_0xabcb('0x34')](_0x5470bb)){if(this[_0xabcb('0x18')][_0x5470bb[_0xabcb('0x35')]]){if(!_['isNil'](this['channels'][_0x5470bb[_0xabcb('0x35')]][_0xabcb('0x5a')])){this[_0xabcb('0x18')][_0x5470bb['uniqueid']][_0xabcb('0x93')]=moment()['format'](_0xabcb('0x3c'));}}}}catch(_0x300411){logger['error'](_0xabcb('0x94'),util[_0xabcb('0x4b')](_0x300411,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabcb('0x2b')]=function(_0x48be34){try{if(this['isNotNull'](_0x48be34)){if(this[_0xabcb('0x18')][_0x48be34[_0xabcb('0x35')]]){if(!_[_0xabcb('0x6b')](this[_0xabcb('0x18')][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x93')])){this['channels'][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x95')]+=moment()[_0xabcb('0x96')](0x0)[_0xabcb('0x5c')](this[_0xabcb('0x18')][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x93')],_0xabcb('0x5d'));delete this['channels'][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x93')];}}}}catch(_0x55e83c){logger[_0xabcb('0x38')](_0xabcb('0x97'),util[_0xabcb('0x4b')](_0x55e83c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x906c=['subtract','seconds','disposition','lastdata','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','membername','name','syncMixMonitorFilename','monitor','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','rec','syncVarSet','variable','mixmonitor_filename','value','xmd-callerid','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','endtime','billableseconds','holdtime','omit','[syncHangup][VoiceCallReport]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','transferconnectedlinenum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','mohtime','milliseconds','mohstarttime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','channel','starttime','format','YYYY-MM-DD\x20HH:mm:ss','channelstate','context','from-sip','split','user:%s','accountcode','exten','[syncNewChannel][VoiceCallReport]','inspect','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','duration'];(function(_0x40f9ca,_0x41f6f6){var _0x1c0ac1=function(_0x297512){while(--_0x297512){_0x40f9ca['push'](_0x40f9ca['shift']());}};_0x1c0ac1(++_0x41f6f6);}(_0x906c,0x17d));var _0xc906=function(_0x14e665,_0xaebfb4){_0x14e665=_0x14e665-0x0;var _0x304151=_0x906c[_0x14e665];return _0x304151;};'use strict';var BPromise=require(_0xc906('0x0'));var _=require(_0xc906('0x1'));var moment=require(_0xc906('0x2'));var util=require(_0xc906('0x3'));var path=require(_0xc906('0x4'));var Redis=require(_0xc906('0x5'));var config=require(_0xc906('0x6'));var logger=require(_0xc906('0x7'))(_0xc906('0x8'));var ami=require(_0xc906('0x9'));var Channel=require(_0xc906('0xa'));var statusDesc=[_0xc906('0xb'),_0xc906('0xc'),_0xc906('0xd'),_0xc906('0xe'),'invalid','unavailable',_0xc906('0xf'),_0xc906('0x10'),_0xc906('0x11')];var applications=['set','queue','agi','dial',_0xc906('0x12'),_0xc906('0x13')];var dispositions=[_0xc906('0x14'),_0xc906('0x15'),_0xc906('0x15'),_0xc906('0x14'),'NO\x20ANSWER',_0xc906('0x14'),_0xc906('0x16'),_0xc906('0x17'),_0xc906('0x15'),_0xc906('0x15'),_0xc906('0x15')];var actions={};config[_0xc906('0x18')]=_[_0xc906('0x19')](config[_0xc906('0x18')],{'host':_0xc906('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc906('0x18')]));function VoiceCallReport(_0x393a1a){this[_0xc906('0x1b')]=_0x393a1a[_0xc906('0x1b')];this[_0xc906('0x1c')]=_0x393a1a[_0xc906('0x1c')];ami['on'](_0xc906('0x1d'),this[_0xc906('0x1e')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x20'),this[_0xc906('0x1e')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x21'),this[_0xc906('0x22')]['bind'](this));ami['on'](_0xc906('0x23'),this[_0xc906('0x24')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x25'),this['syncVarSet']['bind'](this));ami['on'](_0xc906('0x26'),this[_0xc906('0x27')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x28'),this[_0xc906('0x29')][_0xc906('0x1f')](this));ami['on']('attendedtransfer',this[_0xc906('0x2a')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x2b'),this[_0xc906('0x2c')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x2d'),this[_0xc906('0x2e')][_0xc906('0x1f')](this));ami['on'](_0xc906('0x2f'),this['syncMusicOnHoldStop'][_0xc906('0x1f')](this));return BPromise[_0xc906('0x30')]()['then'](ami[_0xc906('0x31')]())[_0xc906('0x32')](function(_0xe1825e){console['log'](_0xe1825e);});}VoiceCallReport[_0xc906('0x33')][_0xc906('0x34')]=function(_0x3c7085){return _0x3c7085!==null&&!_[_0xc906('0x35')](_0x3c7085);};VoiceCallReport[_0xc906('0x33')][_0xc906('0x36')]=function(_0x254ef7,_0x25edab,_0x164e45){io['to'](_0x254ef7)[_0xc906('0x36')](_0x25edab,_0x164e45);};VoiceCallReport['prototype'][_0xc906('0x29')]=function(_0x54c7de){try{if(this[_0xc906('0x34')](_0x54c7de)){if(_0x54c7de[_0xc906('0x37')]===_0x54c7de[_0xc906('0x38')]){if(!_[_0xc906('0x35')](this['channels'][_0x54c7de['uniqueid']])){_[_0xc906('0x39')](this['channels'][_0x54c7de[_0xc906('0x37')]],_[_0xc906('0x3a')](_0x54c7de,_[_0xc906('0x3b')](this[_0xc906('0x1b')][_0x54c7de[_0xc906('0x37')]])));}}}}catch(_0x21ab15){logger[_0xc906('0x3c')](_0xc906('0x3d'),util['inspect'](_0x21ab15,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')]['syncNewChannel']=function(_0x11abae){try{if(this['isNotNull'](_0x11abae)){if(_0x11abae['uniqueid']===_0x11abae[_0xc906('0x38')]&&_0x11abae[_0xc906('0x3e')]!='OutgoingSpoolFailed'){if(_[_0xc906('0x35')](this['channels'][_0x11abae[_0xc906('0x37')]])){this[_0xc906('0x1b')][_0x11abae[_0xc906('0x37')]]=new Channel();this[_0xc906('0x1b')][_0x11abae[_0xc906('0x37')]][_0xc906('0x3f')]=moment()[_0xc906('0x40')](_0xc906('0x41'));this[_0xc906('0x1b')][_0x11abae[_0xc906('0x37')]]['disposition']=dispositions[_['toNumber'](_0x11abae[_0xc906('0x42')])];_[_0xc906('0x39')](this[_0xc906('0x1b')][_0x11abae[_0xc906('0x37')]],_[_0xc906('0x3a')](_0x11abae,_['keys'](this[_0xc906('0x1b')][_0x11abae['uniqueid']])));if(_0x11abae[_0xc906('0x43')]===_0xc906('0x44')){if(this[_0xc906('0x1c')][_0x11abae[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]]){this[_0xc906('0x1c')][_0x11abae[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]]['destconnectedlinenum']=_0x11abae['exten'];this[_0xc906('0x36')](util['format'](_0xc906('0x46'),this[_0xc906('0x1c')][_0x11abae[_0xc906('0x3e')]['split']('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0xc906('0x1c')][_0x11abae[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]][_0xc906('0x47')],'destconnectedlinenum':_0x11abae[_0xc906('0x48')]});}}}}}}catch(_0x16c150){logger[_0xc906('0x3c')](_0xc906('0x49'),util[_0xc906('0x4a')](_0x16c150,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x39320a){try{if(this[_0xc906('0x34')](_0x39320a)){if(_0x39320a[_0xc906('0x37')]===_0x39320a[_0xc906('0x38')]&&_0x39320a[_0xc906('0x48')]!='h'&&_0x39320a[_0xc906('0x3e')]!=_0xc906('0x4b')){_0x39320a['application']=_0x39320a[_0xc906('0x4c')]['toLowerCase']();_0x39320a['applicationdata']=(_0x39320a[_0xc906('0x4d')]||_0x39320a[_0xc906('0x4e')])[_0xc906('0x4f')]();if(_[_0xc906('0x35')](this[_0xc906('0x1b')][_0x39320a[_0xc906('0x37')]])){this['channels'][_0x39320a[_0xc906('0x37')]]=new Channel();this[_0xc906('0x1b')][_0x39320a[_0xc906('0x37')]]['starttime']=_0x39320a[_0xc906('0x50')]?moment()[_0xc906('0x51')](moment[_0xc906('0x50')](_0x39320a['duration'])[_0xc906('0x52')](),_0xc906('0x52'))[_0xc906('0x40')](_0xc906('0x41')):moment()[_0xc906('0x40')](_0xc906('0x41'));this[_0xc906('0x1b')][_0x39320a['uniqueid']][_0xc906('0x53')]='NO\x20ANSWER';}_['merge'](this[_0xc906('0x1b')][_0x39320a[_0xc906('0x37')]],_['pick'](_0x39320a,_['keys'](this['channels'][_0x39320a[_0xc906('0x37')]])));if(_['includes'](applications,_0x39320a[_0xc906('0x4c')])){this[_0xc906('0x1b')][_0x39320a[_0xc906('0x37')]]['lastapplication']=_0x39320a['application'];this[_0xc906('0x1b')][_0x39320a['uniqueid']][_0xc906('0x54')]=_0x39320a[_0xc906('0x4e')];if(_0x39320a[_0xc906('0x4c')]==='set'&&_['startsWith'](_0x39320a['applicationdata'],'cdr(')){var _0xdd5dd6=_0x39320a[_0xc906('0x4e')][_0xc906('0x45')]('=');var _0xe56138=_0xdd5dd6[0x0][_0xc906('0x55')](/cdr\((.*)\)/);if(_0xe56138){this[_0xc906('0x1b')][_0x39320a[_0xc906('0x37')]][_0xe56138[0x1]]=_0xdd5dd6[0x1];}}else if(_0x39320a[_0xc906('0x4c')]===_0xc906('0x56')){this[_0xc906('0x1b')][_0x39320a[_0xc906('0x37')]][_0xc906('0x56')]=_0x39320a[_0xc906('0x4e')][_0xc906('0x45')](',')[0x0];}}}}}catch(_0x4693e6){logger[_0xc906('0x3c')](_0xc906('0x57'),util[_0xc906('0x4a')](_0x4693e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')]['syncNewState']=function(_0x3f9f44){try{if(this['isNotNull'](_0x3f9f44)){if(_0x3f9f44['uniqueid']!==_0x3f9f44[_0xc906('0x38')]){if(this[_0xc906('0x1b')][_0x3f9f44['linkedid']]){if(_0x3f9f44[_0xc906('0x42')]==='6'){if(!this[_0xc906('0x1b')][_0x3f9f44['linkedid']][_0xc906('0x58')]){var _0x2bd092=moment();this['channels'][_0x3f9f44['linkedid']][_0xc906('0x58')]=!![];this[_0xc906('0x1b')][_0x3f9f44['linkedid']][_0xc906('0x59')]=_0x2bd092[_0xc906('0x40')](_0xc906('0x41'));if(this['channels'][_0x3f9f44[_0xc906('0x38')]][_0xc906('0x3f')]){this['channels'][_0x3f9f44[_0xc906('0x38')]]['holdtime']=_0x2bd092[_0xc906('0x5a')](this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x38')]][_0xc906('0x3f')],'seconds');}}this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x38')]]['linkedid']=_0x3f9f44[_0xc906('0x37')];if(_0x3f9f44[_0xc906('0x5b')]!==_0xc906('0x5c')){this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x38')]][_0xc906('0x5d')]=_0x3f9f44[_0xc906('0x5b')];}this[_0xc906('0x1b')][_0x3f9f44['linkedid']][_0xc906('0x5e')]=_0x3f9f44[_0xc906('0x5f')];this[_0xc906('0x1b')][_0x3f9f44['linkedid']][_0xc906('0x60')]=_0x3f9f44['channel'];this[_0xc906('0x1b')][_0x3f9f44['linkedid']]['disposition']=dispositions[_[_0xc906('0x61')](_0x3f9f44[_0xc906('0x42')])];if(this[_0xc906('0x1c')][_0x3f9f44[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]]){this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x38')]][_0xc906('0x62')]=this[_0xc906('0x1c')][_0x3f9f44[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]]['id'];this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x38')]][_0xc906('0x63')]=this['agents'][_0x3f9f44['channel'][_0xc906('0x45')]('-')[0x0]][_0xc906('0x64')];}}}}else{if(this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x37')]]){if(_0x3f9f44[_0xc906('0x42')]==='6'){if(this[_0xc906('0x1c')][_0x3f9f44[_0xc906('0x3e')]['split']('-')[0x0]]){this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x37')]][_0xc906('0x62')]=this[_0xc906('0x1c')][_0x3f9f44[_0xc906('0x3e')]['split']('-')[0x0]]['id'];this[_0xc906('0x1b')][_0x3f9f44[_0xc906('0x37')]][_0xc906('0x63')]=this[_0xc906('0x1c')][_0x3f9f44[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]][_0xc906('0x64')];}}}}}}catch(_0xa0b9b3){logger[_0xc906('0x3c')]('[syncNewState][VoiceCallReport]',util['inspect'](_0xa0b9b3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')][_0xc906('0x65')]=function(_0x13e8be,_0x5a9cf1){if(this[_0xc906('0x1b')][_0x13e8be]){this[_0xc906('0x1b')][_0x13e8be][_0xc906('0x66')]=!![];if(_['endsWith'](_0x5a9cf1,_0xc906('0x67'))){_0x5a9cf1=_0x5a9cf1['replace'](_0xc906('0x67'),_0xc906('0x68'));}this['channels'][_0x13e8be][_0xc906('0x69')]=_0x5a9cf1;var _0x5451eb=_[_0xc906('0x6a')](this[_0xc906('0x1b')][_0x13e8be][_0xc906('0x6b')],{'filename':_0x5a9cf1});if(_[_0xc906('0x6c')](_0x5451eb)){this[_0xc906('0x1b')][_0x13e8be][_0xc906('0x6b')][_0xc906('0x6d')]({'filename':_0x5a9cf1,'createdAt':moment()[_0xc906('0x40')](_0xc906('0x41')),'mixmonitorid':'','status':_0xc906('0x6e')});}}};VoiceCallReport[_0xc906('0x33')][_0xc906('0x6f')]=function(_0x43cd28){try{if(this[_0xc906('0x34')](_0x43cd28)){if(this['channels'][_0x43cd28['uniqueid']]&&_0x43cd28[_0xc906('0x3e')]!=_0xc906('0x4b')){if(this[_0xc906('0x34')](_0x43cd28['variable'])){if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')][_0xc906('0x71')])){this['syncMixMonitorFilename'](_0x43cd28[_0xc906('0x37')],_0x43cd28['value']);}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')]['xmd-phone'])){this[_0xc906('0x1b')][_0x43cd28['uniqueid']]['calleridnum']=_0x43cd28[_0xc906('0x72')];}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')][_0xc906('0x73')])){this['channels'][_0x43cd28['uniqueid']][_0xc906('0x74')]=_0x43cd28['value'];}else if(this['isNotNull'](_0x43cd28[_0xc906('0x70')]['xmd-cdrtype'])){this[_0xc906('0x1b')][_0x43cd28[_0xc906('0x37')]][_0xc906('0x75')]=_0x43cd28[_0xc906('0x72')];}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')][_0xc906('0x76')])){this['channels'][_0x43cd28[_0xc906('0x37')]][_0xc906('0x56')]=_0x43cd28['value'][_0xc906('0x45')](',')[0x0];}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')][_0xc906('0x77')])){this[_0xc906('0x1b')][_0x43cd28[_0xc906('0x37')]][_0xc906('0x78')]=_0x43cd28[_0xc906('0x72')];}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')][_0xc906('0x79')])){this[_0xc906('0x1b')][_0x43cd28[_0xc906('0x37')]][_0xc906('0x7a')]=_0x43cd28[_0xc906('0x72')];}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')][_0xc906('0x7b')])){this['channels'][_0x43cd28[_0xc906('0x37')]][_0xc906('0x7c')]=_0x43cd28[_0xc906('0x72')];}else if(this['isNotNull'](_0x43cd28[_0xc906('0x70')][_0xc906('0x7d')])){this[_0xc906('0x1b')][_0x43cd28[_0xc906('0x37')]][_0xc906('0x56')]=_0x43cd28[_0xc906('0x72')];}else if(this[_0xc906('0x34')](_0x43cd28['variable'][_0xc906('0x7e')])){this['channels'][_0x43cd28[_0xc906('0x37')]][_0xc906('0x7f')]=_0x43cd28[_0xc906('0x72')];}}}else if(this[_0xc906('0x34')](_0x43cd28[_0xc906('0x70')]['mixmonitor_filename'])){if(_0x43cd28['value']){var _0x3a5911=path[_0xc906('0x80')](_0x43cd28['value'])['name'];this['syncMixMonitorFilename'](_0x3a5911,_0x43cd28[_0xc906('0x72')]);}}else if(this[_0xc906('0x1b')][_0x43cd28[_0xc906('0x38')]]){if(this[_0xc906('0x34')](_0x43cd28['variable'])){if(this['isNotNull'](_0x43cd28['variable'][_0xc906('0x7e')])){this[_0xc906('0x1b')][_0x43cd28[_0xc906('0x38')]]['sipcalllinkedid']=_0x43cd28[_0xc906('0x72')];}}}}}catch(_0x3906c1){logger['error'](_0xc906('0x81'),util[_0xc906('0x4a')](_0x3906c1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')][_0xc906('0x27')]=function(_0xff6af0){try{if(this[_0xc906('0x34')](_0xff6af0)){if(this['channels'][_0xff6af0[_0xc906('0x37')]]){var _0x49f0ae=moment();this[_0xc906('0x1b')][_0xff6af0[_0xc906('0x37')]][_0xc906('0x82')]=_0x49f0ae[_0xc906('0x40')](_0xc906('0x41'));this[_0xc906('0x1b')][_0xff6af0[_0xc906('0x37')]][_0xc906('0x50')]=_0x49f0ae[_0xc906('0x5a')](this[_0xc906('0x1b')][_0xff6af0[_0xc906('0x37')]][_0xc906('0x3f')],_0xc906('0x52'));if(this[_0xc906('0x1b')][_0xff6af0['uniqueid']][_0xc906('0x58')]){this[_0xc906('0x1b')][_0xff6af0[_0xc906('0x37')]][_0xc906('0x83')]=_0x49f0ae['diff'](this['channels'][_0xff6af0[_0xc906('0x37')]][_0xc906('0x59')],_0xc906('0x52'));this[_0xc906('0x1b')][_0xff6af0[_0xc906('0x37')]][_0xc906('0x84')]=this[_0xc906('0x1b')][_0xff6af0['uniqueid']]['duration']-this[_0xc906('0x1b')][_0xff6af0[_0xc906('0x37')]][_0xc906('0x83')];}if(_0xff6af0[_0xc906('0x43')]===_0xc906('0x44')){if(this[_0xc906('0x1c')][_0xff6af0['channel']['split']('-')[0x0]]){this[_0xc906('0x1c')][_0xff6af0[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]]=_[_0xc906('0x85')](this[_0xc906('0x1c')][_0xff6af0[_0xc906('0x3e')]['split']('-')[0x0]],['destconnectedlinenum']);this[_0xc906('0x36')](util[_0xc906('0x40')]('user:%s',this['agents'][_0xff6af0[_0xc906('0x3e')]['split']('-')[0x0]][_0xc906('0x64')]),'user:agentcomplete',{'destaccountcode':this[_0xc906('0x1c')][_0xff6af0[_0xc906('0x3e')][_0xc906('0x45')]('-')[0x0]][_0xc906('0x47')]});}}ami['emit']('custom:voiceCallReport',this[_0xc906('0x1b')][_0xff6af0['uniqueid']]);delete this[_0xc906('0x1b')][_0xff6af0['uniqueid']];}}}catch(_0x195612){logger[_0xc906('0x3c')](_0xc906('0x86'),util[_0xc906('0x4a')](_0x195612,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')][_0xc906('0x2a')]=function(_0x217c0b){try{if(this['isNotNull'](_0x217c0b)){if(this[_0xc906('0x1b')][_0x217c0b['transfereeuniqueid']]){this['channels'][_0x217c0b[_0xc906('0x87')]]['transfercalleridnum']=_0x217c0b['origtransferercalleridnum'];this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x87')]]['transferconnectedlinenum']=_0x217c0b['transfertargetcalleridnum'];if(this['channels'][_0x217c0b['secondtransfereruniqueid']]){var _0x389f41=this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x88')]];this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x88')]]=this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x87')]];this[_0xc906('0x1b')][_0x217c0b['transfereeuniqueid']]=_0x389f41;}}else if(this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x89')]]){this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x89')]][_0xc906('0x8a')]=_0x217c0b[_0xc906('0x8b')];this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x89')]]['transferconnectedlinenum']=_0x217c0b[_0xc906('0x8c')];if(this[_0xc906('0x1b')][_0x217c0b['origtransfereruniqueid']]){var _0x389f41=this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x8d')]];this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x8d')]]=this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x89')]];this[_0xc906('0x1b')][_0x217c0b[_0xc906('0x89')]]=_0x389f41;}}}}catch(_0xf8e2e1){logger[_0xc906('0x3c')]('[syncAttendedTransfer][VoiceCallReport]',util[_0xc906('0x4a')](_0xf8e2e1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')][_0xc906('0x2c')]=function(_0x49077b){try{if(this['isNotNull'](_0x49077b)){if(this[_0xc906('0x1b')][_0x49077b[_0xc906('0x87')]]){this[_0xc906('0x1b')][_0x49077b[_0xc906('0x87')]][_0xc906('0x8a')]=_0x49077b['transfereecalleridnum'];this[_0xc906('0x1b')][_0x49077b[_0xc906('0x87')]][_0xc906('0x8e')]=_0x49077b[_0xc906('0x8f')];this[_0xc906('0x27')]({'event':_0xc906('0x90'),'uniqueid':_0x49077b[_0xc906('0x87')],'context':_0x49077b[_0xc906('0x43')],'channel':_0x49077b[_0xc906('0x91')]});}}}catch(_0x2183b0){logger['error'](_0xc906('0x92'),util[_0xc906('0x4a')](_0x2183b0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')]['syncMusicOnHoldStart']=function(_0x2ae2a3){try{if(this[_0xc906('0x34')](_0x2ae2a3)){if(this[_0xc906('0x1b')][_0x2ae2a3[_0xc906('0x37')]]){if(!_[_0xc906('0x6c')](this['channels'][_0x2ae2a3[_0xc906('0x37')]][_0xc906('0x59')])){this['channels'][_0x2ae2a3[_0xc906('0x37')]]['mohstarttime']=moment()[_0xc906('0x40')](_0xc906('0x41'));}}}}catch(_0x5dc6d8){logger[_0xc906('0x3c')](_0xc906('0x93'),util[_0xc906('0x4a')](_0x5dc6d8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc906('0x33')][_0xc906('0x94')]=function(_0xfd55b6){try{if(this[_0xc906('0x34')](_0xfd55b6)){if(this[_0xc906('0x1b')][_0xfd55b6[_0xc906('0x37')]]){if(!_[_0xc906('0x6c')](this[_0xc906('0x1b')][_0xfd55b6['uniqueid']]['mohstarttime'])){this[_0xc906('0x1b')][_0xfd55b6['uniqueid']][_0xc906('0x95')]+=moment()[_0xc906('0x96')](0x0)[_0xc906('0x5a')](this[_0xc906('0x1b')][_0xfd55b6[_0xc906('0x37')]]['mohstarttime'],_0xc906('0x52'));delete this[_0xc906('0x1b')][_0xfd55b6[_0xc906('0x37')]][_0xc906('0x97')];}}}}catch(_0x325194){logger[_0xc906('0x3c')](_0xc906('0x98'),util[_0xc906('0x4a')](_0x325194,{'showHidden':![],'depth':null}));}};module[_0xc906('0x99')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 78bb8d9..13a47be 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 _0x130b=['billableseconds','sumHoldTime','sumDuration','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','emit','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','custom:dialconnect','voice:outbound','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','inspect','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','duration','seconds','complete','total','holdtime','diff','starttime'];(function(_0xf2bad3,_0x47da4f){var _0x174027=function(_0x360c45){while(--_0x360c45){_0xf2bad3['push'](_0xf2bad3['shift']());}};_0x174027(++_0x47da4f);}(_0x130b,0x1b6));var _0xb130=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x130b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb130('0x0'));var moment=require(_0xb130('0x1'));var util=require(_0xb130('0x2'));var Redis=require(_0xb130('0x3'));var config=require('../../../config/environment');var logger=require(_0xb130('0x4'))('ami');var ami=require(_0xb130('0x5'));config[_0xb130('0x6')]=_[_0xb130('0x7')](config[_0xb130('0x6')],{'host':_0xb130('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x162cf4){this[_0xb130('0x9')]=_0x162cf4[_0xb130('0xa')];this['outbound']=_0x162cf4[_0xb130('0xb')];this[_0xb130('0xc')]={};ami['on'](_0xb130('0xd'),this[_0xb130('0xe')][_0xb130('0xf')](this));ami['on'](_0xb130('0x10'),this['syncDialEnd'][_0xb130('0xf')](this));ami['on']('varset',this[_0xb130('0x11')][_0xb130('0xf')](this));ami['on'](_0xb130('0x12'),this[_0xb130('0x13')]['bind'](this));}VoiceDialReport['prototype'][_0xb130('0x14')]=function(_0x42d30a){return _0x42d30a!==null&&!_[_0xb130('0x15')](_0x42d30a);};VoiceDialReport[_0xb130('0x16')]['emit']=function(_0x119061,_0x5c395a,_0x789520){io['to'](_0x119061)['emit'](_0x5c395a,_0x789520);};VoiceDialReport[_0xb130('0x16')][_0xb130('0xe')]=function(_0xf712d2){try{if(this['isNotNull'](_0xf712d2)){if(this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]]){_[_0xb130('0x18')](this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]],{'starttime':moment()[_0xb130('0x19')](_0xb130('0x1a')),'lastevent':'called','interface':_0xf712d2[_0xb130('0x1b')][_0xb130('0x1c')](0x0,_0xf712d2[_0xb130('0x1b')][_0xb130('0x1d')]('-')),'membername':_0xf712d2['channel'][_0xb130('0x1c')](_0xf712d2[_0xb130('0x1b')][_0xb130('0x1d')]('/')+0x1,_0xf712d2[_0xb130('0x1b')]['lastIndexOf']('-'))},_[_0xb130('0x1e')](_0xf712d2,[_0xb130('0x1f'),_0xb130('0x20')]));this[_0xb130('0x21')]('voice:outbound','voice_outbound_channel:save',this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]]);ami[_0xb130('0x21')](_0xb130('0x22'),this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]]);}}}catch(_0x1a01c4){logger[_0xb130('0x23')](_0xb130('0x24'),util['inspect'](_0x1a01c4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb130('0x16')]['syncDialEnd']=function(_0x47f15e){try{if(this[_0xb130('0x14')](_0x47f15e)){if(this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]){this['channels'][_0x47f15e[_0xb130('0x17')]][_0xb130('0x25')]=_0x47f15e[_0xb130('0x25')];if(_0x47f15e[_0xb130('0x25')]===_0xb130('0x26')){this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]][_0xb130('0x27')]=_0x47f15e[_0xb130('0x27')];this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]['connectedlinename']=_0x47f15e[_0xb130('0x28')];this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]][_0xb130('0x29')]=moment()[_0xb130('0x19')](_0xb130('0x1a'));this[_0xb130('0x9')][_0x47f15e['uniqueid']]['lastevent']=_0xb130('0x2a');ami[_0xb130('0x21')](_0xb130('0x2b'),this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]);}this[_0xb130('0x21')](_0xb130('0x2c'),_0xb130('0x2d'),this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]);}}}catch(_0x3a35b9){logger[_0xb130('0x23')](_0xb130('0x2e'),util[_0xb130('0x2f')](_0x3a35b9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb130('0x16')][_0xb130('0x11')]=function(_0x10c77c){try{if(this[_0xb130('0x14')](_0x10c77c)){this[_0xb130('0x30')](_0x10c77c[_0xb130('0x17')],_[_0xb130('0x31')](_0x10c77c[_0xb130('0x32')])[0x0],_0x10c77c[_0xb130('0x33')]);if(this[_0xb130('0x14')](_0x10c77c[_0xb130('0x32')])&&this[_0xb130('0x14')](_0x10c77c[_0xb130('0x32')][_0xb130('0x34')])){if(_[_0xb130('0x15')](this['channels'][_0x10c77c['uniqueid']])){this[_0xb130('0x9')][_0x10c77c[_0xb130('0x17')]]={'routeId':_0x10c77c['value'],'variables':this['variables'][_0x10c77c[_0xb130('0x17')]]};this[_0xb130('0x21')](_0xb130('0x2c'),'voice_outbound_channel:save',this[_0xb130('0x9')][_0x10c77c[_0xb130('0x17')]]);}}}}catch(_0x2733b5){logger[_0xb130('0x23')](_0xb130('0x35'),util[_0xb130('0x2f')](_0x2733b5,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x2d85d6,_0x5090c0,_0x24f34d){var _0x154811=[_0xb130('0x36'),'rtpaudioqosbridged',_0xb130('0x37'),_0xb130('0x38'),_0xb130('0x39'),'rtpaudioqoslossbridged',_0xb130('0x3a'),_0xb130('0x3b'),_0xb130('0x3c'),_0xb130('0x3d'),'bridgepeer',_0xb130('0x3e'),_0xb130('0x3f'),_0xb130('0x40'),'memberinterface',_0xb130('0x41'),'membername',_0xb130('0x42'),_0xb130('0x43')];if(!_[_0xb130('0x44')](_0x5090c0)&&!_[_0xb130('0x45')](_0x154811,_0x5090c0)){if(_[_0xb130('0x15')](this[_0xb130('0xc')][_0x2d85d6])){this[_0xb130('0xc')][_0x2d85d6]={};}this['variables'][_0x2d85d6][_0x5090c0]=_0x24f34d;}};VoiceDialReport['prototype'][_0xb130('0x13')]=function(_0xce2229){try{if(this['isNotNull'](_0xce2229)){if(this['channels'][_0xce2229[_0xb130('0x17')]]){this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x46')]=moment()['format'](_0xb130('0x1a'));this['channels'][_0xce2229['uniqueid']][_0xb130('0x47')]=moment(this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x46')])['diff'](this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]]['starttime'],_0xb130('0x48'));this[_0xb130('0x9')][_0xce2229['uniqueid']]['lastevent']=_0xb130('0x49');this[_0xb130('0xb')][_0xb130('0x4a')]+=0x1;if(this['channels'][_0xce2229[_0xb130('0x17')]][_0xb130('0x29')]){this[_0xb130('0xb')]['answered']+=0x1;this['channels'][_0xce2229[_0xb130('0x17')]][_0xb130('0x4b')]=moment(this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x29')])[_0xb130('0x4c')](this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x4d')],'seconds');this[_0xb130('0x9')][_0xce2229['uniqueid']][_0xb130('0x4e')]=moment(this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x46')])['diff'](this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x29')],'seconds');this['outbound'][_0xb130('0x4f')]+=this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x4b')]||0x0;this[_0xb130('0xb')]['sumBillable']+=this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x4e')];}this['outbound'][_0xb130('0x50')]+=this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x47')];ami[_0xb130('0x21')]('custom:voiceDialReport',this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]]);ami[_0xb130('0x21')]('custom:dialend',this['channels'][_0xce2229[_0xb130('0x17')]]);this['emit'](_0xb130('0x2c'),_0xb130('0x51'),this['outbound']);logger[_0xb130('0x52')](_0xb130('0x53'),JSON[_0xb130('0x54')](this['channels'][_0xce2229['uniqueid']]));this[_0xb130('0x21')]('voice:outbound','voice_outbound_channel:remove',this['channels'][_0xce2229[_0xb130('0x17')]]);delete this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]];}if(this[_0xb130('0xc')][_0xce2229[_0xb130('0x17')]]){delete this['variables'][_0xce2229[_0xb130('0x17')]];}}}catch(_0x333eb0){logger[_0xb130('0x23')]('[syncHangup][VoiceDialReport]',util[_0xb130('0x2f')](_0x333eb0,{'showHidden':![],'depth':null}));}};module[_0xb130('0x55')]=VoiceDialReport; \ No newline at end of file +var _0x535f=['util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','isUndefined','prototype','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','isNotNull','dialstatus','ANSWER','connectedlinenum','answertime','connect','custom:dialconnect','syncVarSet','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','endtime','duration','starttime','lastevent','complete','total','answered','holdtime','diff','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports'];(function(_0x5c2c72,_0x22cf09){var _0x11c44c=function(_0x37bcca){while(--_0x37bcca){_0x5c2c72['push'](_0x5c2c72['shift']());}};_0x11c44c(++_0x22cf09);}(_0x535f,0x160));var _0xf535=function(_0x5cad29,_0x412fb6){_0x5cad29=_0x5cad29-0x0;var _0x45b1c1=_0x535f[_0x5cad29];return _0x45b1c1;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xf535('0x0'));var Redis=require(_0xf535('0x1'));var config=require(_0xf535('0x2'));var logger=require(_0xf535('0x3'))(_0xf535('0x4'));var ami=require(_0xf535('0x5'));config[_0xf535('0x6')]=_[_0xf535('0x7')](config[_0xf535('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf535('0x8'))(new Redis(config[_0xf535('0x6')]));function VoiceDialReport(_0x4fe14d){this[_0xf535('0x9')]=_0x4fe14d[_0xf535('0xa')];this[_0xf535('0xb')]=_0x4fe14d[_0xf535('0xb')];this[_0xf535('0xc')]={};ami['on'](_0xf535('0xd'),this[_0xf535('0xe')][_0xf535('0xf')](this));ami['on'](_0xf535('0x10'),this[_0xf535('0x11')][_0xf535('0xf')](this));ami['on'](_0xf535('0x12'),this['syncVarSet'][_0xf535('0xf')](this));ami['on'](_0xf535('0x13'),this[_0xf535('0x14')]['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x5f1969){return _0x5f1969!==null&&!_[_0xf535('0x15')](_0x5f1969);};VoiceDialReport[_0xf535('0x16')]['emit']=function(_0x11b39f,_0x142bda,_0x3d59aa){io['to'](_0x11b39f)[_0xf535('0x17')](_0x142bda,_0x3d59aa);};VoiceDialReport[_0xf535('0x16')][_0xf535('0xe')]=function(_0x497fb4){try{if(this['isNotNull'](_0x497fb4)){if(this[_0xf535('0x9')][_0x497fb4[_0xf535('0x18')]]){_[_0xf535('0x19')](this[_0xf535('0x9')][_0x497fb4['uniqueid']],{'starttime':moment()[_0xf535('0x1a')](_0xf535('0x1b')),'lastevent':'called','interface':_0x497fb4[_0xf535('0x1c')][_0xf535('0x1d')](0x0,_0x497fb4[_0xf535('0x1c')][_0xf535('0x1e')]('-')),'membername':_0x497fb4[_0xf535('0x1c')][_0xf535('0x1d')](_0x497fb4[_0xf535('0x1c')][_0xf535('0x1e')]('/')+0x1,_0x497fb4[_0xf535('0x1c')]['lastIndexOf']('-'))},_[_0xf535('0x1f')](_0x497fb4,['event',_0xf535('0x20')]));this[_0xf535('0x17')](_0xf535('0x21'),_0xf535('0x22'),this['channels'][_0x497fb4['uniqueid']]);ami['emit'](_0xf535('0x23'),this[_0xf535('0x9')][_0x497fb4[_0xf535('0x18')]]);}}}catch(_0x159a35){logger[_0xf535('0x24')](_0xf535('0x25'),util[_0xf535('0x26')](_0x159a35,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf535('0x16')]['syncDialEnd']=function(_0x126704){try{if(this[_0xf535('0x27')](_0x126704)){if(this[_0xf535('0x9')][_0x126704[_0xf535('0x18')]]){this['channels'][_0x126704[_0xf535('0x18')]][_0xf535('0x28')]=_0x126704['dialstatus'];if(_0x126704[_0xf535('0x28')]===_0xf535('0x29')){this[_0xf535('0x9')][_0x126704[_0xf535('0x18')]][_0xf535('0x2a')]=_0x126704[_0xf535('0x2a')];this[_0xf535('0x9')][_0x126704['uniqueid']]['connectedlinename']=_0x126704['connectedlinename'];this[_0xf535('0x9')][_0x126704['uniqueid']][_0xf535('0x2b')]=moment()[_0xf535('0x1a')](_0xf535('0x1b'));this[_0xf535('0x9')][_0x126704[_0xf535('0x18')]]['lastevent']=_0xf535('0x2c');ami[_0xf535('0x17')](_0xf535('0x2d'),this['channels'][_0x126704[_0xf535('0x18')]]);}this[_0xf535('0x17')](_0xf535('0x21'),'voice_outbound_channel:save',this[_0xf535('0x9')][_0x126704[_0xf535('0x18')]]);}}}catch(_0x165f2e){logger[_0xf535('0x24')]('[syncDialEnd][VoiceDialReport]',util[_0xf535('0x26')](_0x165f2e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf535('0x16')][_0xf535('0x2e')]=function(_0x4973e8){try{if(this[_0xf535('0x27')](_0x4973e8)){this[_0xf535('0x2f')](_0x4973e8[_0xf535('0x18')],_[_0xf535('0x30')](_0x4973e8[_0xf535('0x31')])[0x0],_0x4973e8[_0xf535('0x32')]);if(this[_0xf535('0x27')](_0x4973e8[_0xf535('0x31')])&&this[_0xf535('0x27')](_0x4973e8[_0xf535('0x31')][_0xf535('0x33')])){if(_[_0xf535('0x15')](this[_0xf535('0x9')][_0x4973e8[_0xf535('0x18')]])){this[_0xf535('0x9')][_0x4973e8['uniqueid']]={'routeId':_0x4973e8[_0xf535('0x32')],'variables':this[_0xf535('0xc')][_0x4973e8[_0xf535('0x18')]]};this[_0xf535('0x17')]('voice:outbound',_0xf535('0x22'),this[_0xf535('0x9')][_0x4973e8['uniqueid']]);}}}}catch(_0x16a1fd){logger[_0xf535('0x24')](_0xf535('0x34'),util['inspect'](_0x16a1fd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf535('0x16')]['addVariable']=function(_0x12082f,_0x39c597,_0xd596c3){var _0x2770a3=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xf535('0x35'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xf535('0x36'),_0xf535('0x37'),_0xf535('0x38'),_0xf535('0x39'),'bridgepvtcallid',_0xf535('0x3a'),'memberdynamic',_0xf535('0x3b'),_0xf535('0x3c'),_0xf535('0x3d'),_0xf535('0x3e'),_0xf535('0x3f')];if(!_['isNil'](_0x39c597)&&!_[_0xf535('0x40')](_0x2770a3,_0x39c597)){if(_['isUndefined'](this[_0xf535('0xc')][_0x12082f])){this[_0xf535('0xc')][_0x12082f]={};}this[_0xf535('0xc')][_0x12082f][_0x39c597]=_0xd596c3;}};VoiceDialReport[_0xf535('0x16')]['syncHangup']=function(_0x227eb0){try{if(this[_0xf535('0x27')](_0x227eb0)){if(this[_0xf535('0x9')][_0x227eb0['uniqueid']]){this['channels'][_0x227eb0[_0xf535('0x18')]][_0xf535('0x41')]=moment()['format'](_0xf535('0x1b'));this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]][_0xf535('0x42')]=moment(this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]]['endtime'])['diff'](this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]][_0xf535('0x43')],'seconds');this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]][_0xf535('0x44')]=_0xf535('0x45');this[_0xf535('0xb')][_0xf535('0x46')]+=0x1;if(this[_0xf535('0x9')][_0x227eb0['uniqueid']]['answertime']){this['outbound'][_0xf535('0x47')]+=0x1;this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]][_0xf535('0x48')]=moment(this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]]['answertime'])[_0xf535('0x49')](this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]][_0xf535('0x43')],_0xf535('0x4a'));this[_0xf535('0x9')][_0x227eb0['uniqueid']][_0xf535('0x4b')]=moment(this['channels'][_0x227eb0[_0xf535('0x18')]]['endtime'])[_0xf535('0x49')](this['channels'][_0x227eb0[_0xf535('0x18')]]['answertime'],_0xf535('0x4a'));this[_0xf535('0xb')][_0xf535('0x4c')]+=this[_0xf535('0x9')][_0x227eb0['uniqueid']][_0xf535('0x48')]||0x0;this[_0xf535('0xb')][_0xf535('0x4d')]+=this[_0xf535('0x9')][_0x227eb0['uniqueid']][_0xf535('0x4b')];}this['outbound'][_0xf535('0x4e')]+=this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]][_0xf535('0x42')];ami['emit'](_0xf535('0x4f'),this[_0xf535('0x9')][_0x227eb0['uniqueid']]);ami[_0xf535('0x17')](_0xf535('0x50'),this[_0xf535('0x9')][_0x227eb0['uniqueid']]);this['emit'](_0xf535('0x21'),_0xf535('0x51'),this[_0xf535('0xb')]);logger[_0xf535('0x52')](_0xf535('0x53'),JSON[_0xf535('0x54')](this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]]));this['emit'](_0xf535('0x21'),_0xf535('0x55'),this['channels'][_0x227eb0[_0xf535('0x18')]]);delete this[_0xf535('0x9')][_0x227eb0[_0xf535('0x18')]];}if(this[_0xf535('0xc')][_0x227eb0[_0xf535('0x18')]]){delete this[_0xf535('0xc')][_0x227eb0[_0xf535('0x18')]];}}}catch(_0x236797){logger[_0xf535('0x24')](_0xf535('0x56'),util[_0xf535('0x26')](_0x236797,{'showHidden':![],'depth':null}));}};module[_0xf535('0x57')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 0c5ea61..94e8cab 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 _0x16e3=['hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','clearZombieChannels','switch','isNil','status','channel','message','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','error','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','name','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','loggedIn','sumBillable','sumHoldTime','total','unmanaged','Trunk','active','callerid','Interval','md5','voice_queue:save','isNotNull','isUndefined','loopQueueShow','Action','queues','catch','[queues]','then','[queuesummary]','queue','countBy','toNumber','callers','loggedin','available','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','position','count','merge','keys','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','syncAgentConnect','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallerexit','transfer','reason','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','length','diff','sumDuration','milliseconds','queuecallercompleteAt','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','mohtime','exports','lodash','moment','bluebird','util','ioredis','ami','../model/queueReport','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16e3,0x9e));var _0x316e=function(_0x5dd8b3,_0x2a0375){_0x5dd8b3=_0x5dd8b3-0x0;var _0x5e2d76=_0x16e3[_0x5dd8b3];return _0x5e2d76;};'use strict';var _=require(_0x316e('0x0'));var moment=require(_0x316e('0x1'));var BPromise=require(_0x316e('0x2'));var util=require(_0x316e('0x3'));var md5=require('md5');var Redis=require(_0x316e('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x316e('0x5'));var ami=require('../ami');var QueueReport=require(_0x316e('0x6'));config[_0x316e('0x7')]=_['defaults'](config[_0x316e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x316e('0x8'))(new Redis(config[_0x316e('0x7')]));var Sequence=function(){};Sequence[_0x316e('0x9')][_0x316e('0xa')]=function(_0x4c1e13){this[_0x316e('0xb')]=this[_0x316e('0xb')]?this['tail'][_0x316e('0xc')](_0x4c1e13):_0x4c1e13();};function VoiceQueueReport(_0x1ceac4){this[_0x316e('0xd')]=new Sequence();this[_0x316e('0xe')]={};this['agents']=_0x1ceac4[_0x316e('0xf')];this[_0x316e('0x10')]=_0x1ceac4[_0x316e('0x11')];this[_0x316e('0x12')]=_0x1ceac4['voiceQueues'];this[_0x316e('0x13')]=!![];this[_0x316e('0x14')]=_0x1ceac4[_0x316e('0x14')];this[_0x316e('0x15')]={};ami['on'](_0x316e('0x16'),this[_0x316e('0x17')][_0x316e('0x18')](this));ami['on'](_0x316e('0x19'),this[_0x316e('0x1a')]['bind'](this));ami['on']('queuecallerjoin',this[_0x316e('0x1b')][_0x316e('0x18')](this));ami['on'](_0x316e('0x1c'),this[_0x316e('0x1d')][_0x316e('0x18')](this));ami['on'](_0x316e('0x1e'),this[_0x316e('0x1f')]['bind'](this));ami['on']('agentcomplete',this[_0x316e('0x20')][_0x316e('0x18')](this));ami['on'](_0x316e('0x21'),this['syncAgentConnect'][_0x316e('0x18')](this));ami['on']('varset',this[_0x316e('0x22')][_0x316e('0x18')](this));ami['on'](_0x316e('0x23'),this[_0x316e('0x24')]['bind'](this));ami['on'](_0x316e('0x25'),this[_0x316e('0x26')][_0x316e('0x18')](this));ami['on'](_0x316e('0x27'),this[_0x316e('0x28')][_0x316e('0x18')](this));ami['on'](_0x316e('0x29'),this[_0x316e('0x2a')][_0x316e('0x18')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x316e('0x18')](this));ami['on'](_0x316e('0x2b'),this[_0x316e('0x2c')]['bind'](this));this[_0x316e('0x2d')]();this['loopQueueShow']();}function isNotNull(_0x35775b){return _0x35775b!==null&&!_['isUndefined'](_0x35775b);}function clearChannels(_0x4e0d8e){if(!_[_0x316e('0x2e')](_0x4e0d8e)){for(var _0x2925d5 in _0x4e0d8e){if(_0x4e0d8e[_0x316e('0x2f')](_0x2925d5)){delete _0x4e0d8e[_0x2925d5];}}}}function clearCampaigns(_0x1df802){if(!_[_0x316e('0x2e')](_0x1df802)){for(var _0x43d315 in _0x1df802){if(_0x1df802[_0x316e('0x2f')](_0x43d315)){_0x1df802[_0x43d315][_0x316e('0x30')]=0x0;}}}}function clearVoiceQueues(_0xa8daf8){if(!_[_0x316e('0x2e')](_0xa8daf8)){for(var _0x7898a1 in _0xa8daf8){if(_0xa8daf8[_0x316e('0x2f')](_0x7898a1)){_0xa8daf8[_0x7898a1][_0x316e('0x30')]=0x0;_0xa8daf8[_0x7898a1][_0x316e('0x31')]=0x0;_0xa8daf8[_0x7898a1][_0x316e('0x32')]=0x0;_0xa8daf8[_0x7898a1][_0x316e('0x33')]=0x0;_0xa8daf8[_0x7898a1]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x599d8e){if(!_['isEmpty'](_0x599d8e)){for(var _0x1509d5 in _0x599d8e){if(_0x599d8e[_0x316e('0x2f')](_0x1509d5)){_0x599d8e[_0x1509d5][_0x316e('0x34')]=!![];}}}}VoiceQueueReport[_0x316e('0x9')][_0x316e('0x35')]=function(){var _0x147835=this;for(var _0x459f66 in this[_0x316e('0x10')]){if(this[_0x316e('0x10')][_0x316e('0x2f')](_0x459f66)&&!this[_0x316e('0x10')][_0x459f66][_0x316e('0x36')]){this[_0x316e('0xd')]['enqueue'](function(){if(!_[_0x316e('0x37')](_0x147835[_0x316e('0x10')][_0x459f66])){return ami['Action']({'action':_0x316e('0x38'),'channel':_0x147835[_0x316e('0x10')][_0x459f66][_0x316e('0x39')]})['catch'](function(_0x4f4dd0){if(_0x4f4dd0[_0x316e('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x147835[_0x316e('0x10')][_0x459f66]){delete _0x147835[_0x316e('0x10')][_0x459f66];logger['error']('[voiceQueueReport][checkChannel]',_0x459f66);}if(_0x147835[_0x316e('0xe')][_0x459f66]){delete _0x147835[_0x316e('0xe')][_0x459f66];logger['error'](_0x316e('0x3b'),_0x459f66);}if(_0x147835[_0x316e('0x15')][_0x459f66]){delete _0x147835['variables'][_0x459f66];logger['error'](_0x316e('0x3c'),_0x459f66);}},0x1f40);}});}});}}};VoiceQueueReport[_0x316e('0x9')]['syncFullyBooted']=function(){logger[_0x316e('0x3d')](_0x316e('0x3e'));clearChannels(this[_0x316e('0x10')]);this[_0x316e('0x3f')](this[_0x316e('0xe')]);clearAgentBooked(this[_0x316e('0xf')]);clearVoiceQueues(this[_0x316e('0x12')]);clearCampaigns(this[_0x316e('0x14')]);};VoiceQueueReport[_0x316e('0x9')]['clearQueueReport']=function(_0x875aa7){var _0x1d9473=this;if(!_[_0x316e('0x2e')](_0x875aa7)){for(var _0x50b8de in _0x875aa7){if(_0x875aa7[_0x316e('0x2f')](_0x50b8de)){_0x1d9473[_0x316e('0x40')](_0x875aa7[_0x50b8de]);delete _0x875aa7[_0x50b8de];}}}};function loggerCatch(_0x15cd46){return function(_0x3e82dd){logger[_0x316e('0x3d')](_0x15cd46,util[_0x316e('0x41')](_0x3e82dd,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x316e('0x9')][_0x316e('0x42')]=function(_0x22f5e0,_0x4c1c8f,_0x3277c7){io['to'](_0x22f5e0)[_0x316e('0x42')](_0x4c1c8f,_0x3277c7);};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x43')]=function(_0x4147fe){this[_0x316e('0x42')](util[_0x316e('0x44')]('voice:queue:%s',_0x4147fe[_0x316e('0x45')]),'voice_queue_channel:save',_0x4147fe);};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x40')]=function(_0x149cda){logger['info'](_0x316e('0x46'),JSON[_0x316e('0x47')](_0x149cda));this['emit'](util[_0x316e('0x44')](_0x316e('0x48'),_0x149cda[_0x316e('0x45')]),_0x316e('0x49'),_0x149cda);};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x4a')]=function(_0x1d4829){if(_0x1d4829[_0x316e('0x4b')]===_0x316e('0x4c')){var _0x1becdb={'id':_0x1d4829['id'],'name':_0x1d4829[_0x316e('0x45')],'strategy':_0x1d4829[_0x316e('0x4d')],'answered':_0x1d4829[_0x316e('0x4e')],'available':_0x1d4829['available'],'loggedIn':_0x1d4829[_0x316e('0x4f')],'pTalking':_0x1d4829[_0x316e('0x32')],'sumBillable':_0x1d4829[_0x316e('0x50')],'sumDuration':_0x1d4829['sumDuration'],'sumHoldTime':_0x1d4829[_0x316e('0x51')]||0x0,'talking':_0x1d4829[_0x316e('0x31')],'total':_0x1d4829[_0x316e('0x52')],'type':_0x1d4829[_0x316e('0x4b')],'unmanaged':_0x1d4829[_0x316e('0x53')],'abandoned':_0x1d4829['abandoned'],'waiting':_0x1d4829[_0x316e('0x33')]};if(_0x1d4829[_0x316e('0x54')]){_0x1becdb[_0x316e('0x54')]={'id':_0x1d4829[_0x316e('0x54')]['id'],'name':_0x1d4829['Trunk'][_0x316e('0x45')],'active':_0x1d4829[_0x316e('0x54')][_0x316e('0x55')],'callerid':_0x1d4829['Trunk'][_0x316e('0x56')]};}if(_0x1d4829[_0x316e('0x57')]){_0x1becdb['Interval']={'id':_0x1d4829[_0x316e('0x57')]['id'],'name':_0x1d4829[_0x316e('0x57')][_0x316e('0x45')]};}var _0x9befa2=md5(JSON['stringify'](_0x1becdb));if(_0x1d4829[_0x316e('0x58')]!==_0x9befa2){_0x1d4829[_0x316e('0x58')]=_0x9befa2;this['emit'](util['format'](_0x316e('0x48'),_0x1becdb[_0x316e('0x45')]),_0x316e('0x59'),_0x1becdb);}}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x5a')]=function(_0xee3a90){return _0xee3a90!==null&&!_[_0x316e('0x5b')](_0xee3a90);};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x5c')]=function(){var _0x5b5655=this;setInterval(function(){_0x5b5655['clearZombieChannels']();ami[_0x316e('0x5d')]({'action':_0x316e('0x5e')})[_0x316e('0x5f')](loggerCatch(_0x316e('0x60')));},0x2710);};VoiceQueueReport['prototype'][_0x316e('0x2d')]=function(){var _0x4ac1f6=this;setInterval(function(){if(_0x4ac1f6[_0x316e('0x13')]){return ami[_0x316e('0x5d')]({'action':_0x316e('0x16')})[_0x316e('0x61')](function(_0x47eaf5){_0x4ac1f6[_0x316e('0x13')]=![];})[_0x316e('0x5f')](loggerCatch(_0x316e('0x62')));}},0x3e8);};VoiceQueueReport[_0x316e('0x9')]['syncQueueSummary']=function(_0x15df52){try{if(this[_0x316e('0x5a')](_0x15df52)&&this[_0x316e('0x5a')](_0x15df52[_0x316e('0x63')])){if(this[_0x316e('0x12')][_0x15df52['queue']]){var _0x3244d5=_[_0x316e('0x64')](this[_0x316e('0x10')],_0x316e('0x63'))[_0x15df52[_0x316e('0x63')]]||0x0;var _0x531e66=_0x3244d5-_0x15df52['callers'];if(this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x33')]!==_[_0x316e('0x65')](_0x15df52[_0x316e('0x66')])||this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x4f')]!==_[_0x316e('0x65')](_0x15df52[_0x316e('0x67')])||this['voiceQueues'][_0x15df52[_0x316e('0x63')]][_0x316e('0x68')]!==_[_0x316e('0x65')](_0x15df52[_0x316e('0x68')])||this['voiceQueues'][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')]!==_0x531e66){this['voiceQueues'][_0x15df52[_0x316e('0x63')]]['waiting']=_[_0x316e('0x65')](_0x15df52[_0x316e('0x66')]);this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]]['loggedIn']=_[_0x316e('0x65')](_0x15df52[_0x316e('0x67')]);this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x68')]=_['toNumber'](_0x15df52[_0x316e('0x68')]);this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')]=_0x531e66>0x0?_0x531e66:0x0;this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')]=this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')]>_[_0x316e('0x65')](_0x15df52[_0x316e('0x67')])?_[_0x316e('0x65')](_0x15df52[_0x316e('0x67')]):this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')];this[_0x316e('0x4a')](this['voiceQueues'][_0x15df52['queue']]);}ami['emit'](_0x316e('0x69'),this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]]);}}}catch(_0x1a2932){logger[_0x316e('0x3d')](_0x316e('0x6a'),util[_0x316e('0x41')](_0x1a2932,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')]['syncQueueSummaryComplete']=function(_0x2a2823){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x6b')]=function(_0x5353a1){};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x1b')]=function(_0x4529fc){try{if(this[_0x316e('0x5a')](_0x4529fc)){if(_[_0x316e('0x5b')](this[_0x316e('0xe')][_0x4529fc[_0x316e('0x6c')]])){this[_0x316e('0xe')][_0x4529fc[_0x316e('0x6c')]]=[];this[_0x316e('0x10')][_0x4529fc[_0x316e('0x6c')]]={};}var _0xd81fec=new QueueReport();_0xd81fec[_0x316e('0x45')]=_0x4529fc[_0x316e('0x63')];_0xd81fec[_0x316e('0x4b')]=this[_0x316e('0x12')][_0xd81fec['name']]&&this[_0x316e('0x12')][_0xd81fec[_0x316e('0x45')]]['type']?this[_0x316e('0x12')][_0xd81fec[_0x316e('0x45')]][_0x316e('0x4b')]||'inbound':'inbound';_0xd81fec['queue']=_0x4529fc[_0x316e('0x63')];_0xd81fec['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd81fec[_0x316e('0x6d')]=_0x4529fc['position'];_0xd81fec['count']=_0x4529fc[_0x316e('0x6e')];_[_0x316e('0x6f')](_0xd81fec,_['pick'](_0x4529fc,_[_0x316e('0x70')](_0xd81fec)));this['queueReports'][_0x4529fc[_0x316e('0x6c')]]['push'](_0xd81fec);this['channels'][_0x4529fc[_0x316e('0x6c')]]=_0xd81fec;this[_0x316e('0x43')](_0xd81fec);}}catch(_0x3595be){logger[_0x316e('0x3d')](_0x316e('0x71'),util[_0x316e('0x41')](_0x3595be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x1d')]=function(_0x5ec548){try{if(this[_0x316e('0x5a')](_0x5ec548)){if(this[_0x316e('0xe')][_0x5ec548[_0x316e('0x6c')]]){var _0xf53a00=_[_0x316e('0x72')](this[_0x316e('0xe')][_0x5ec548['uniqueid']]);_0xf53a00[_0x316e('0x73')]=![];_0xf53a00['queuecallercompleteAt']=null;_0xf53a00[_0x316e('0x74')]=_0x5ec548[_0x316e('0x74')];_0xf53a00[_0x316e('0x75')]=_0x5ec548[_0x316e('0x75')];_0xf53a00[_0x316e('0x1c')]=!![];_0xf53a00[_0x316e('0x76')]=moment()[_0x316e('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0xf53a00[_0x316e('0x77')]='ABANDONED';_0xf53a00['lastAssignedTo']=null;this[_0x316e('0x10')][_0x5ec548['uniqueid']]=_0xf53a00;this[_0x316e('0x40')](_0xf53a00);}}}catch(_0x5ab1df){logger[_0x316e('0x3d')](_0x316e('0x78'),util[_0x316e('0x41')](_0x5ab1df,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x316e('0x1f')]=function(_0x41238a){try{if(this[_0x316e('0x5a')](_0x41238a)){if(this[_0x316e('0xe')][_0x41238a['uniqueid']]){var _0x33851b=_[_0x316e('0x72')](this['queueReports'][_0x41238a[_0x316e('0x6c')]]);_0x33851b[_0x316e('0x79')]=moment()[_0x316e('0x44')](_0x316e('0x7a'));_0x33851b['connectedlinenum']=_0x41238a[_0x316e('0x7b')];_0x33851b[_0x316e('0x7c')]=_0x41238a[_0x316e('0x7c')];this[_0x316e('0x10')][_0x41238a[_0x316e('0x6c')]]=_0x33851b;this[_0x316e('0x43')](_0x33851b);}}}catch(_0x14cdc2){logger[_0x316e('0x3d')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x316e('0x41')](_0x14cdc2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x7d')]=function(_0x22bbc2){try{if(this['isNotNull'](_0x22bbc2)){if(this[_0x316e('0xe')][_0x22bbc2[_0x316e('0x6c')]]){var _0x39c982=_[_0x316e('0x72')](this['queueReports'][_0x22bbc2['uniqueid']]);_0x39c982['queuecallercomplete']=!![];_0x39c982[_0x316e('0x77')]=_0x316e('0x7e');}}}catch(_0x151e96){logger[_0x316e('0x3d')](_0x316e('0x7f'),util[_0x316e('0x41')](_0x151e96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x20')]=function(_0x4fd513){try{if(this[_0x316e('0x5a')](_0x4fd513)){if(this['queueReports'][_0x4fd513[_0x316e('0x6c')]]){var _0x1b426e=_[_0x316e('0x72')](this['queueReports'][_0x4fd513[_0x316e('0x6c')]]);_0x1b426e['queuecallerabandon']=![];_0x1b426e['queuecallerabandonAt']=null;_0x1b426e[_0x316e('0x80')]=!![];_0x1b426e['lastAssignedTo']=_0x4fd513[_0x316e('0x81')];_0x1b426e[_0x316e('0x74')]=_0x4fd513[_0x316e('0x74')];_0x1b426e[_0x316e('0x73')]=!![];_0x1b426e[_0x316e('0x82')]=![];_0x1b426e['queuecallerexitAt']=null;if(!_0x1b426e[_0x316e('0x83')]){if(_0x4fd513[_0x316e('0x84')]==_0x316e('0x83')){_0x1b426e[_0x316e('0x77')]='COMPLETED';}else{if(_[_0x316e('0x85')](_0x4fd513[_0x316e('0x39')][_0x316e('0x86')](),_0x316e('0x87'))){if(this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]]){var _0x25aa51=_['last'](this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]]);_0x25aa51[_0x316e('0x73')]=![];_0x25aa51['queuecallerexit']=!![];_0x25aa51[_0x316e('0x89')]=moment(_0x1b426e[_0x316e('0x8a')])[_0x316e('0x8b')](_0x4fd513[_0x316e('0x74')],_0x316e('0x8c'))[_0x316e('0x44')](_0x316e('0x7a'));_0x25aa51[_0x316e('0x77')]=_0x316e('0x8d');_0x25aa51['transfer']=!![];_0x25aa51[_0x316e('0x8e')]=_0x316e('0x8f');_0x25aa51[_0x316e('0x90')]=_0x4fd513[_0x316e('0x91')];_0x25aa51[_0x316e('0x92')]=_0x4fd513[_0x316e('0x6c')];var _0x3d69af=this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]];this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]]=this[_0x316e('0xe')][_0x4fd513[_0x316e('0x6c')]];this[_0x316e('0xe')][_0x4fd513[_0x316e('0x6c')]]=_0x3d69af;}}else{_0x1b426e[_0x316e('0x77')]=_0x316e('0x93')+_0x4fd513[_0x316e('0x84')][_0x316e('0x94')]();}}}this['channels'][_0x4fd513['uniqueid']]=_0x1b426e;this[_0x316e('0x40')](_0x1b426e);}}}catch(_0x51963d){logger[_0x316e('0x3d')]('[syncAgentComplete][VoiceQueueReport]',util['inspect'](_0x51963d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x22')]=function(_0x59e20d){try{if(this[_0x316e('0x5a')](_0x59e20d)){this[_0x316e('0x95')](_0x59e20d[_0x316e('0x6c')],_['keys'](_0x59e20d[_0x316e('0x96')])[0x0],_0x59e20d[_0x316e('0x97')]);if(this[_0x316e('0xe')][_0x59e20d[_0x316e('0x6c')]]){var _0x2194a5=_['last'](this[_0x316e('0xe')][_0x59e20d[_0x316e('0x6c')]]);if(_0x2194a5){if(this[_0x316e('0x5a')](_0x59e20d['variable'])&&this['isNotNull'](_0x59e20d[_0x316e('0x96')][_0x316e('0x98')])){switch(_0x59e20d[_0x316e('0x97')]){case _0x316e('0x99'):_0x2194a5[_0x316e('0x82')]=![];_0x2194a5[_0x316e('0x89')]=null;break;case _0x316e('0x9a'):_0x2194a5[_0x316e('0x9b')]=_0x316e('0x9c');ami[_0x316e('0x42')](_0x316e('0x9d'),_0x2194a5);break;default:_0x2194a5[_0x316e('0x82')]=!![];_0x2194a5[_0x316e('0x89')]=moment()['format'](_0x316e('0x7a'));_0x2194a5['queuecallerleaveAt']=moment()[_0x316e('0x44')](_0x316e('0x7a'));}_0x2194a5[_0x316e('0x1c')]=![];_0x2194a5[_0x316e('0x76')]=null;_0x2194a5[_0x316e('0x77')]=_0x59e20d['value'];this['channels'][_0x59e20d[_0x316e('0x6c')]]=_0x2194a5;this[_0x316e('0x40')](_0x2194a5);}else if(this[_0x316e('0x5a')](_0x59e20d[_0x316e('0x96')])&&this[_0x316e('0x5a')](_0x59e20d['variable'][_0x316e('0x9e')])){if(!_0x2194a5[_0x316e('0x1c')]){_0x2194a5[_0x316e('0x82')]=!![];_0x2194a5['queuecallerexitAt']=moment()[_0x316e('0x44')](_0x316e('0x7a'));_0x2194a5['queuecallerexitreason']=_0x316e('0x9f');_0x2194a5[_0x316e('0x79')]=moment()[_0x316e('0x44')](_0x316e('0x7a'));this[_0x316e('0x10')][_0x59e20d['uniqueid']]=_0x2194a5;}}_0x2194a5[_0x316e('0x15')]=this[_0x316e('0x15')][_0x59e20d[_0x316e('0x6c')]];}}}}catch(_0xaf0440){logger[_0x316e('0x3d')](_0x316e('0xa0'),util[_0x316e('0x41')](_0xaf0440,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x95')]=function(_0x27659b,_0x2852e7,_0x6179a1){var _0x31864c=['rtpaudioqos','rtpaudioqosbridged',_0x316e('0xa1'),'rtpaudioqosjitterbridged',_0x316e('0xa2'),_0x316e('0xa3'),_0x316e('0xa4'),_0x316e('0xa5'),'sipcallid',_0x316e('0xa6'),_0x316e('0xa7'),_0x316e('0xa8'),_0x316e('0xa9'),_0x316e('0xaa'),_0x316e('0xab'),_0x316e('0xac'),_0x316e('0x81'),_0x316e('0xad'),'memberrealtime'];if(!_[_0x316e('0x37')](_0x2852e7)&&!_[_0x316e('0xae')](_0x31864c,_0x2852e7)){if(_['isUndefined'](this[_0x316e('0x15')][_0x27659b])){this[_0x316e('0x15')][_0x27659b]={};}this[_0x316e('0x15')][_0x27659b][_0x2852e7]=_0x6179a1;}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x24')]=function(_0x1cacc3){try{if(this['isNotNull'](_0x1cacc3)){if(this[_0x316e('0xe')][_0x1cacc3[_0x316e('0x6c')]]){for(var _0x449c1e=0x0,_0x5d225a={};_0x449c1e0x0?_0x17186c:0x0;this[_0x0189('0x15')][_0x48d447['queue']][_0x0189('0x32')]=this[_0x0189('0x15')][_0x48d447[_0x0189('0x61')]][_0x0189('0x32')]>_[_0x0189('0x65')](_0x48d447['loggedin'])?_[_0x0189('0x65')](_0x48d447['loggedin']):this[_0x0189('0x15')][_0x48d447[_0x0189('0x61')]]['talking'];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x48d447[_0x0189('0x61')]]);}ami[_0x0189('0x44')](_0x0189('0x66'),this['voiceQueues'][_0x48d447['queue']]);}}}catch(_0x506a08){logger[_0x0189('0x3c')](_0x0189('0x67'),util['inspect'](_0x506a08,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0189('0xc')][_0x0189('0x18')]=function(_0x5ebbc7){this[_0x0189('0x5c')]=!![];};VoiceQueueReport['prototype']['syncNewExten']=function(_0x4f50ba){};VoiceQueueReport['prototype'][_0x0189('0x1b')]=function(_0x55e811){try{if(this['isNotNull'](_0x55e811)){if(_['isUndefined'](this[_0x0189('0x11')][_0x55e811[_0x0189('0x68')]])){this['queueReports'][_0x55e811[_0x0189('0x68')]]=[];this[_0x0189('0x13')][_0x55e811[_0x0189('0x68')]]={};}var _0x5ca4f9=new QueueReport();_0x5ca4f9['name']=_0x55e811[_0x0189('0x61')];_0x5ca4f9[_0x0189('0x4b')]=this[_0x0189('0x15')][_0x5ca4f9[_0x0189('0x46')]]&&this[_0x0189('0x15')][_0x5ca4f9['name']][_0x0189('0x4b')]?this[_0x0189('0x15')][_0x5ca4f9[_0x0189('0x46')]]['type']||_0x0189('0x4c'):_0x0189('0x4c');_0x5ca4f9[_0x0189('0x61')]=_0x55e811[_0x0189('0x61')];_0x5ca4f9[_0x0189('0x69')]=moment()[_0x0189('0x4a')](_0x0189('0x6a'));_0x5ca4f9['position']=_0x55e811['position'];_0x5ca4f9[_0x0189('0x6b')]=_0x55e811[_0x0189('0x6b')];_[_0x0189('0x6c')](_0x5ca4f9,_[_0x0189('0x6d')](_0x55e811,_[_0x0189('0x6e')](_0x5ca4f9)));this['queueReports'][_0x55e811['uniqueid']][_0x0189('0x6f')](_0x5ca4f9);this[_0x0189('0x13')][_0x55e811[_0x0189('0x68')]]=_0x5ca4f9;this['emitVoiceQueueChannelSave'](_0x5ca4f9);}}catch(_0x51d51e){logger[_0x0189('0x3c')](_0x0189('0x70'),util[_0x0189('0x43')](_0x51d51e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0189('0xc')][_0x0189('0x1d')]=function(_0x385515){try{if(this['isNotNull'](_0x385515)){if(this[_0x0189('0x11')][_0x385515['uniqueid']]){var _0x292488=_[_0x0189('0x71')](this[_0x0189('0x11')][_0x385515['uniqueid']]);_0x292488['queuecallercomplete']=![];_0x292488[_0x0189('0x72')]=null;_0x292488[_0x0189('0x73')]=_0x385515['holdtime'];_0x292488['originalposition']=_0x385515[_0x0189('0x74')];_0x292488[_0x0189('0x1c')]=!![];_0x292488['queuecallerabandonAt']=moment()[_0x0189('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x292488[_0x0189('0x75')]=_0x0189('0x76');_0x292488[_0x0189('0x77')]=null;this[_0x0189('0x13')][_0x385515[_0x0189('0x68')]]=_0x292488;this[_0x0189('0x42')](_0x292488);}}}catch(_0x545905){logger[_0x0189('0x3c')](_0x0189('0x78'),util[_0x0189('0x43')](_0x545905,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0189('0xc')][_0x0189('0x1f')]=function(_0x210adb){try{if(this['isNotNull'](_0x210adb)){if(this['queueReports'][_0x210adb[_0x0189('0x68')]]){var _0x21a9a7=_[_0x0189('0x71')](this['queueReports'][_0x210adb['uniqueid']]);_0x21a9a7[_0x0189('0x79')]=moment()[_0x0189('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x21a9a7[_0x0189('0x7a')]=_0x210adb[_0x0189('0x7a')];_0x21a9a7[_0x0189('0x7b')]=_0x210adb[_0x0189('0x7b')];this['channels'][_0x210adb[_0x0189('0x68')]]=_0x21a9a7;this[_0x0189('0x7c')](_0x21a9a7);}}}catch(_0x12fcfc){logger['error']('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x0189('0x43')](_0x12fcfc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0189('0xc')][_0x0189('0x22')]=function(_0x42a52b){try{if(this[_0x0189('0x5a')](_0x42a52b)){if(this[_0x0189('0x11')][_0x42a52b[_0x0189('0x68')]]){var _0x5535b8=_[_0x0189('0x71')](this['queueReports'][_0x42a52b['uniqueid']]);_0x5535b8[_0x0189('0x7d')]=!![];_0x5535b8['queuecallerexitreason']=_0x0189('0x7e');}}}catch(_0x23efe1){logger[_0x0189('0x3c')](_0x0189('0x7f'),util[_0x0189('0x43')](_0x23efe1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x22d889){try{if(this[_0x0189('0x5a')](_0x22d889)){if(this[_0x0189('0x11')][_0x22d889[_0x0189('0x68')]]){var _0x4aaa48=_[_0x0189('0x71')](this[_0x0189('0x11')][_0x22d889[_0x0189('0x68')]]);_0x4aaa48[_0x0189('0x1c')]=![];_0x4aaa48[_0x0189('0x80')]=null;_0x4aaa48[_0x0189('0x81')]=!![];_0x4aaa48['lastAssignedTo']=_0x22d889[_0x0189('0x82')];_0x4aaa48['holdtime']=_0x22d889['holdtime'];_0x4aaa48[_0x0189('0x7d')]=!![];_0x4aaa48['queuecallerexit']=![];_0x4aaa48['queuecallerexitAt']=null;if(!_0x4aaa48[_0x0189('0x83')]){if(_0x22d889[_0x0189('0x84')]==_0x0189('0x83')){_0x4aaa48[_0x0189('0x75')]=_0x0189('0x85');}else{if(_[_0x0189('0x86')](_0x22d889[_0x0189('0x39')][_0x0189('0x87')](),_0x0189('0x88'))){if(this[_0x0189('0x11')][_0x22d889[_0x0189('0x89')]]){var _0x344912=_[_0x0189('0x71')](this[_0x0189('0x11')][_0x22d889[_0x0189('0x89')]]);_0x344912[_0x0189('0x7d')]=![];_0x344912['queuecallerexit']=!![];_0x344912[_0x0189('0x8a')]=moment(_0x4aaa48[_0x0189('0x69')])['add'](_0x22d889[_0x0189('0x73')],_0x0189('0x8b'))[_0x0189('0x4a')](_0x0189('0x6a'));_0x344912['queuecallerexitreason']=_0x0189('0x8c');_0x344912[_0x0189('0x83')]=!![];_0x344912[_0x0189('0x8d')]=_0x0189('0x8e');_0x344912[_0x0189('0x8f')]=_0x22d889['destexten'];_0x344912[_0x0189('0x90')]=_0x22d889[_0x0189('0x68')];var _0x499057=this[_0x0189('0x11')][_0x22d889[_0x0189('0x89')]];this[_0x0189('0x11')][_0x22d889[_0x0189('0x89')]]=this['queueReports'][_0x22d889['uniqueid']];this[_0x0189('0x11')][_0x22d889[_0x0189('0x68')]]=_0x499057;}}else{_0x4aaa48[_0x0189('0x75')]=_0x0189('0x91')+_0x22d889['reason'][_0x0189('0x92')]();}}}this[_0x0189('0x13')][_0x22d889['uniqueid']]=_0x4aaa48;this[_0x0189('0x42')](_0x4aaa48);}}}catch(_0x523a18){logger[_0x0189('0x3c')]('[syncAgentComplete][VoiceQueueReport]',util[_0x0189('0x43')](_0x523a18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0189('0xc')][_0x0189('0x24')]=function(_0x2c853f){try{if(this[_0x0189('0x5a')](_0x2c853f)){this[_0x0189('0x93')](_0x2c853f[_0x0189('0x68')],_[_0x0189('0x6e')](_0x2c853f[_0x0189('0x94')])[0x0],_0x2c853f[_0x0189('0x95')]);if(this['queueReports'][_0x2c853f[_0x0189('0x68')]]){var _0x42a4e2=_['last'](this[_0x0189('0x11')][_0x2c853f[_0x0189('0x68')]]);if(_0x42a4e2){if(this[_0x0189('0x5a')](_0x2c853f[_0x0189('0x94')])&&this['isNotNull'](_0x2c853f['variable']['queuestatus'])){switch(_0x2c853f[_0x0189('0x95')]){case _0x0189('0x96'):_0x42a4e2['queuecallerexit']=![];_0x42a4e2['queuecallerexitAt']=null;break;case _0x0189('0x97'):_0x42a4e2[_0x0189('0x98')]='timeout';ami[_0x0189('0x44')](_0x0189('0x99'),_0x42a4e2);break;default:_0x42a4e2[_0x0189('0x9a')]=!![];_0x42a4e2[_0x0189('0x8a')]=moment()[_0x0189('0x4a')](_0x0189('0x6a'));_0x42a4e2[_0x0189('0x79')]=moment()[_0x0189('0x4a')](_0x0189('0x6a'));}_0x42a4e2[_0x0189('0x1c')]=![];_0x42a4e2[_0x0189('0x80')]=null;_0x42a4e2[_0x0189('0x75')]=_0x2c853f[_0x0189('0x95')];this['channels'][_0x2c853f[_0x0189('0x68')]]=_0x42a4e2;this['emitVoiceQueueChannelRemove'](_0x42a4e2);}else if(this['isNotNull'](_0x2c853f[_0x0189('0x94')])&&this[_0x0189('0x5a')](_0x2c853f['variable']['queueposition'])){if(!_0x42a4e2[_0x0189('0x1c')]){_0x42a4e2[_0x0189('0x9a')]=!![];_0x42a4e2[_0x0189('0x8a')]=moment()[_0x0189('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x42a4e2[_0x0189('0x75')]=_0x0189('0x9b');_0x42a4e2[_0x0189('0x79')]=moment()[_0x0189('0x4a')](_0x0189('0x6a'));this['channels'][_0x2c853f['uniqueid']]=_0x42a4e2;}}_0x42a4e2['variables']=this[_0x0189('0x3f')][_0x2c853f[_0x0189('0x68')]];}}}}catch(_0x209b90){logger['error']('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x209b90,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0189('0x93')]=function(_0x373bcb,_0x1d8bdb,_0x11571e){var _0x8e81f=[_0x0189('0x9c'),'rtpaudioqosbridged',_0x0189('0x9d'),_0x0189('0x9e'),_0x0189('0x9f'),_0x0189('0xa0'),_0x0189('0xa1'),_0x0189('0xa2'),'sipcallid',_0x0189('0xa3'),'bridgepeer',_0x0189('0xa4'),_0x0189('0xa5'),_0x0189('0xa6'),_0x0189('0xa7'),_0x0189('0xa8'),_0x0189('0x82'),'memberpenalty',_0x0189('0xa9')];if(!_[_0x0189('0xaa')](_0x1d8bdb)&&!_[_0x0189('0xab')](_0x8e81f,_0x1d8bdb)){if(_[_0x0189('0x2e')](this[_0x0189('0x3f')][_0x373bcb])){this[_0x0189('0x3f')][_0x373bcb]={};}this[_0x0189('0x3f')][_0x373bcb][_0x1d8bdb]=_0x11571e;}};VoiceQueueReport[_0x0189('0xc')][_0x0189('0xac')]=function(_0x488d15){try{if(this[_0x0189('0x5a')](_0x488d15)){if(this[_0x0189('0x11')][_0x488d15[_0x0189('0x68')]]){for(var _0x49e303=0x0,_0x1edb3b={};_0x49e303=0x0?moment(_0x9de4d3['endtime'])['diff'](_0x9de4d3[_0x1a09('0x19')],'seconds'):null,'data1':_0x1a09('0x1b'),'data2':_0x9de4d3[_0x1a09('0x15')],'data3':_0x9de4d3['exten'],'data4':_0x9de4d3[_0x1a09('0x1c')]||null,'role':_0x1a09('0x14'),'internal':_0x9de4d3[_0x1a09('0x15')]?_[_0x1a09('0x16')](_0x9de4d3['accountcode']):undefined,'uniqueid':_0x9de4d3[_0x1a09('0x1d')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x62d1=['starttime','seconds','outbound','dialstring','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','format','interface','queuecallerleaveAt','diff','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','endtime'];(function(_0x3592c0,_0x285568){var _0x41465c=function(_0x3b493d){while(--_0x3b493d){_0x3592c0['push'](_0x3592c0['shift']());}};_0x41465c(++_0x285568);}(_0x62d1,0x1a8));var _0x162d=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0x62d1[_0x51b7c5];return _0x3355d7;};'use strict';var moment=require(_0x162d('0x0'));var _=require(_0x162d('0x1'));var util=require(_0x162d('0x2'));var client=require(_0x162d('0x3'));exports['voiceQueueReport']=function(_0x1c2ff5){var _0x513eef=_0x1c2ff5[_0x162d('0x4')]||_0x1c2ff5[_0x162d('0x5')];return client['Request'](_0x162d('0x6'),{'body':{'channel':_0x162d('0x7'),'membername':_0x1c2ff5[_0x162d('0x8')],'interface':_['isNil'](_0x1c2ff5['interface'])?util[_0x162d('0x9')]('SIP/%s',_0x1c2ff5[_0x162d('0x8')]):_0x1c2ff5[_0x162d('0xa')],'type':'TALKING','enterAt':_0x1c2ff5[_0x162d('0xb')],'exitAt':_0x513eef,'duration':moment(_0x513eef)[_0x162d('0xc')](_0x1c2ff5[_0x162d('0xb')],'seconds'),'data1':_0x162d('0xd'),'data2':_0x1c2ff5[_0x162d('0xe')],'data3':_0x1c2ff5[_0x162d('0xf')],'data4':null,'data5':_0x1c2ff5['queue'],'role':_0x162d('0x10'),'internal':_0x1c2ff5[_0x162d('0x11')]?_[_0x162d('0x12')](_0x1c2ff5[_0x162d('0x11')]):undefined,'uniqueid':_0x1c2ff5[_0x162d('0x13')]},'log':'CreateMemberReport'});};exports[_0x162d('0x14')]=function(_0x46407c){return client[_0x162d('0x15')]('CreateMemberReport',{'body':{'channel':_0x162d('0x7'),'membername':_0x46407c[_0x162d('0x16')],'interface':_0x46407c[_0x162d('0xa')],'type':'TALKING','enterAt':_0x46407c['starttime'],'exitAt':_0x46407c['endtime'],'duration':moment(_0x46407c[_0x162d('0x17')])[_0x162d('0xc')](_0x46407c[_0x162d('0x18')],'seconds')>=0x0?moment(_0x46407c[_0x162d('0x17')])[_0x162d('0xc')](_0x46407c[_0x162d('0x18')],_0x162d('0x19')):null,'data1':_0x162d('0x1a'),'data2':_0x46407c[_0x162d('0x11')],'data3':_0x46407c[_0x162d('0xf')],'data4':_0x46407c[_0x162d('0x1b')]||null,'role':_0x162d('0x10'),'internal':_0x46407c[_0x162d('0x11')]?_[_0x162d('0x12')](_0x46407c['accountcode']):undefined,'uniqueid':_0x46407c[_0x162d('0x13')]},'log':_0x162d('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9223fbb..50d54c6 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 _0x2bc6=['html','../client','getTemplates'];(function(_0x909dc1,_0x1a659b){var _0x111418=function(_0x1c15a1){while(--_0x1c15a1){_0x909dc1['push'](_0x909dc1['shift']());}};_0x111418(++_0x1a659b);}(_0x2bc6,0x163));var _0x62bc=function(_0x545663,_0x514ffb){_0x545663=_0x545663-0x0;var _0x26add7=_0x2bc6[_0x545663];return _0x26add7;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(_0x3b71d5){return function(_0x56939b){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x62bc('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xaf80=['getTemplates','html','GetTemplate','../client'];(function(_0x449549,_0xbfeeda){var _0x2eaf77=function(_0x381af8){while(--_0x381af8){_0x449549['push'](_0x449549['shift']());}};_0x2eaf77(++_0xbfeeda);}(_0xaf80,0x1ef));var _0x0af8=function(_0x23f11c,_0x3e4881){_0x23f11c=_0x23f11c-0x0;var _0xf776e=_0xaf80[_0x23f11c];return _0xf776e;};'use strict';var client=require(_0x0af8('0x0'));exports[_0x0af8('0x1')]=function(_0x440a0e){return function(_0x146357){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x0af8('0x2')]},'log':_0x0af8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4269533..97614f4 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 _0x14d5=['AnyConditions','Action','Actions','action','data3','data4','data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14d5,0x1f4));var _0x514d=function(_0x2ed1a0,_0x36acd9){_0x2ed1a0=_0x2ed1a0-0x0;var _0x3d272e=_0x14d5[_0x2ed1a0];return _0x3d272e;};'use strict';var client=require('../client');exports[_0x514d('0x0')]=function(_0xe3525d){return function(_0x2199e0){return client[_0x514d('0x1')](_0x514d('0x2'),{'options':{'raw':![],'attributes':['id',_0x514d('0x3'),_0x514d('0x4'),'status'],'include':[{'model':_0x514d('0x5'),'as':_0x514d('0x6'),'attributes':['id',_0x514d('0x7'),_0x514d('0x8'),_0x514d('0x9')]},{'model':'Condition','as':_0x514d('0xa'),'attributes':['id',_0x514d('0x7'),_0x514d('0x8'),_0x514d('0x9')]},{'model':_0x514d('0xb'),'as':_0x514d('0xc'),'attributes':['id',_0x514d('0xd'),'data1','data2',_0x514d('0xe'),_0x514d('0xf'),'data5','data6',_0x514d('0x10')]}]},'log':_0x514d('0x2')});};}; \ No newline at end of file +var _0x6a22=['action','data2','data3','data4','data5','data6','../client','getTriggers','GetTrigger','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions'];(function(_0x2bcc14,_0x4f860d){var _0x53f1e1=function(_0x548589){while(--_0x548589){_0x2bcc14['push'](_0x2bcc14['shift']());}};_0x53f1e1(++_0x4f860d);}(_0x6a22,0x114));var _0x26a2=function(_0x5b2a15,_0xd200ec){_0x5b2a15=_0x5b2a15-0x0;var _0x33038d=_0x6a22[_0x5b2a15];return _0x33038d;};'use strict';var client=require(_0x26a2('0x0'));exports[_0x26a2('0x1')]=function(_0x51c9b9){return function(_0x672eb4){return client['Request'](_0x26a2('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x26a2('0x3')],'include':[{'model':_0x26a2('0x4'),'as':_0x26a2('0x5'),'attributes':['id',_0x26a2('0x6'),_0x26a2('0x7'),_0x26a2('0x8')]},{'model':_0x26a2('0x4'),'as':_0x26a2('0x9'),'attributes':['id',_0x26a2('0x6'),_0x26a2('0x7'),_0x26a2('0x8')]},{'model':_0x26a2('0xa'),'as':_0x26a2('0xb'),'attributes':['id',_0x26a2('0xc'),'data1',_0x26a2('0xd'),_0x26a2('0xe'),_0x26a2('0xf'),_0x26a2('0x10'),_0x26a2('0x11'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6e374d5..41d9ae5 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 _0x8487=['../client','getTrunks','Request','GetTrunk','registry'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8487,0xb4));var _0x7848=function(_0x129bb8,_0x5eade6){_0x129bb8=_0x129bb8-0x0;var _0x275d29=_0x8487[_0x129bb8];return _0x275d29;};'use strict';var client=require(_0x7848('0x0'));exports[_0x7848('0x1')]=function(_0x1d730f){return function(_0x413dd1){return client[_0x7848('0x2')](_0x7848('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7848('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x2e87=['registry','GetTrunk','../client','getTrunks','Request','name'];(function(_0x204feb,_0x2722d8){var _0x386eae=function(_0x26a1bf){while(--_0x26a1bf){_0x204feb['push'](_0x204feb['shift']());}};_0x386eae(++_0x2722d8);}(_0x2e87,0x74));var _0x72e8=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x2e87[_0x4bfcbe];return _0x5b65e6;};'use strict';var client=require(_0x72e8('0x0'));exports[_0x72e8('0x1')]=function(_0x22c8f1){return function(_0x542272){return client[_0x72e8('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x72e8('0x3'),_0x72e8('0x4')]},'log':_0x72e8('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8210b18..fb61ae8 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 _0x0b48=['accountcode','fullname','online','lastLoginAt','lastPauseAt','phone','mobile','GetUser','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','agent','pauseType','voicePause','interface','getAgents','Request','name','email'];(function(_0x4513e8,_0x16f480){var _0x1e8758=function(_0x5c2038){while(--_0x5c2038){_0x4513e8['push'](_0x4513e8['shift']());}};_0x1e8758(++_0x16f480);}(_0x0b48,0x13e));var _0x80b4=function(_0x7bfd87,_0x72597a){_0x7bfd87=_0x7bfd87-0x0;var _0x1d9702=_0x0b48[_0x7bfd87];return _0x1d9702;};'use strict';var client=require('../client');exports[_0x80b4('0x0')]=function(){return function(){return client[_0x80b4('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x80b4('0x2'),_0x80b4('0x3'),_0x80b4('0x4'),_0x80b4('0x5'),_0x80b4('0x6'),_0x80b4('0x7'),'pauseType',_0x80b4('0x8'),'voicePause',_0x80b4('0x9'),_0x80b4('0xa'),'interface']},'log':_0x80b4('0x0')});};};exports['getTelephones']=function(){return function(){return client[_0x80b4('0x1')](_0x80b4('0xb'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x80b4('0x2'),_0x80b4('0x4'),_0x80b4('0xc')]},'log':_0x80b4('0xd')});};};exports[_0x80b4('0xe')]=function(_0x218be7,_0x41f76b,_0x3fae94){return client[_0x80b4('0x1')](_0x80b4('0xf'),{'body':{'type':_0x41f76b,'uniqueid':_0x3fae94},'options':{'where':{'id':_0x218be7['id']}},'log':_0x80b4('0xe')});};exports[_0x80b4('0x10')]=function(_0x2bdd06){return client[_0x80b4('0x1')](_0x80b4('0x11'),{'body':{},'options':{'where':{'id':_0x2bdd06['id']}},'log':'savePause'});};exports['getAgent']=function(_0x4e8da4){return client[_0x80b4('0x1')](_0x80b4('0x12'),{'options':{'raw':![],'where':{'role':_0x80b4('0x13'),'id':_0x4e8da4},'attributes':['id',_0x80b4('0x2'),_0x80b4('0x3'),_0x80b4('0x4'),'fullname',_0x80b4('0x6'),_0x80b4('0x7'),_0x80b4('0x14'),_0x80b4('0x8'),_0x80b4('0x15'),_0x80b4('0x16')]},'log':'getAgent'});}; \ No newline at end of file +var _0xc3a2=['getAgents','Request','GetUser','name','email','accountcode','online','lastPauseAt','voicePause','phone','mobile','interface','telephone','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','pauseType','../client'];(function(_0x5c2c19,_0x23c07b){var _0x23d31d=function(_0x1449a5){while(--_0x1449a5){_0x5c2c19['push'](_0x5c2c19['shift']());}};_0x23d31d(++_0x23c07b);}(_0xc3a2,0xd7));var _0x2c3a=function(_0x220cdb,_0x4e6034){_0x220cdb=_0x220cdb-0x0;var _0xe0aee5=_0xc3a2[_0x220cdb];return _0xe0aee5;};'use strict';var client=require(_0x2c3a('0x0'));exports[_0x2c3a('0x1')]=function(){return function(){return client[_0x2c3a('0x2')](_0x2c3a('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x2c3a('0x4'),_0x2c3a('0x5'),_0x2c3a('0x6'),'fullname',_0x2c3a('0x7'),'lastLoginAt','pauseType',_0x2c3a('0x8'),_0x2c3a('0x9'),_0x2c3a('0xa'),_0x2c3a('0xb'),_0x2c3a('0xc')]},'log':_0x2c3a('0x1')});};};exports['getTelephones']=function(){return function(){return client[_0x2c3a('0x2')](_0x2c3a('0x3'),{'options':{'raw':!![],'where':{'role':_0x2c3a('0xd')},'attributes':['id',_0x2c3a('0x4'),_0x2c3a('0x6'),_0x2c3a('0xe')]},'log':_0x2c3a('0xf')});};};exports[_0x2c3a('0x10')]=function(_0x3c5352,_0x192703,_0x4d62c9){return client['Request'](_0x2c3a('0x11'),{'body':{'type':_0x192703,'uniqueid':_0x4d62c9},'options':{'where':{'id':_0x3c5352['id']}},'log':_0x2c3a('0x10')});};exports[_0x2c3a('0x12')]=function(_0x49be62){return client[_0x2c3a('0x2')](_0x2c3a('0x13'),{'body':{},'options':{'where':{'id':_0x49be62['id']}},'log':_0x2c3a('0x10')});};exports[_0x2c3a('0x14')]=function(_0x522241){return client[_0x2c3a('0x2')](_0x2c3a('0x15'),{'options':{'raw':![],'where':{'role':_0x2c3a('0x16'),'id':_0x522241},'attributes':['id',_0x2c3a('0x4'),_0x2c3a('0x5'),_0x2c3a('0x6'),'fullname',_0x2c3a('0x7'),'lastLoginAt',_0x2c3a('0x17'),_0x2c3a('0x8'),_0x2c3a('0x9'),_0x2c3a('0xc')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index daac9f9..9b25814 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 _0xaa81=['CreateVoiceAgentReport','UpdateVoiceAgentReport','create','Request'];(function(_0x244817,_0x25d04d){var _0x427f1f=function(_0x57f802){while(--_0x57f802){_0x244817['push'](_0x244817['shift']());}};_0x427f1f(++_0x25d04d);}(_0xaa81,0x136));var _0x1aa8=function(_0x4bf206,_0x36aaf3){_0x4bf206=_0x4bf206-0x0;var _0xca4b25=_0xaa81[_0x4bf206];return _0xca4b25;};'use strict';var client=require('../client');exports[_0x1aa8('0x0')]=function(_0x2b2eec){return client[_0x1aa8('0x1')](_0x1aa8('0x2'),{'body':_0x2b2eec,'log':_0x1aa8('0x2')});};exports['update']=function(_0xb03b6b,_0x205b08,_0x413784){return client[_0x1aa8('0x1')](_0x1aa8('0x3'),{'body':_0xb03b6b,'options':{'where':{'uniqueid':_0x205b08,'interface':_0x413784,'agentcomplete':!![]}},'log':_0x1aa8('0x3')});}; \ No newline at end of file +var _0xccea=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xccea,0x198));var _0xacce=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xccea[_0x1b828b];return _0x98da1a;};'use strict';var client=require(_0xacce('0x0'));exports['create']=function(_0x21e566){return client[_0xacce('0x1')](_0xacce('0x2'),{'body':_0x21e566,'log':_0xacce('0x2')});};exports[_0xacce('0x3')]=function(_0x378c24,_0x31172d,_0x15f11b){return client[_0xacce('0x1')](_0xacce('0x4'),{'body':_0x378c24,'options':{'where':{'uniqueid':_0x31172d,'interface':_0x15f11b,'agentcomplete':!![]}},'log':_0xacce('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 81485cf..10bcac6 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 _0xc471=['GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xc471,0xd3));var _0x1c47=function(_0x1407af,_0x4b09e5){_0x1407af=_0x1407af-0x0;var _0xd7c4b4=_0xc471[_0x1407af];return _0xd7c4b4;};'use strict';var moment=require(_0x1c47('0x0'));var util=require(_0x1c47('0x1'));var _=require(_0x1c47('0x2'));var client=require(_0x1c47('0x3'));exports[_0x1c47('0x4')]=function(_0x374376){return client[_0x1c47('0x5')](_0x1c47('0x6'),{'body':_[_0x1c47('0x7')](_0x374376,{'source':_0x374376['calleridnum'],'destinationcontext':_0x374376[_0x1c47('0x8')],'callerid':_0x374376[_0x1c47('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x1c47('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x1c47('0xa'),{'options':{'where':{'type':[_0x1c47('0xb')],'createdAt':{'$between':[moment()[_0x1c47('0xc')](_0x1c47('0xd'))[_0x1c47('0xe')](_0x1c47('0xf')),moment()[_0x1c47('0x10')](_0x1c47('0xd'))[_0x1c47('0xe')](_0x1c47('0xf'))]}},'attributes':['type',_0x1c47('0x11'),_0x1c47('0x12'),_0x1c47('0x13')]},'log':_0x1c47('0x14')});};}; \ No newline at end of file +var _0xe7fb=['format','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','billableseconds','moment','util','lodash','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','startOf','day'];(function(_0xd6e28a,_0x34396f){var _0x13a821=function(_0x384793){while(--_0x384793){_0xd6e28a['push'](_0xd6e28a['shift']());}};_0x13a821(++_0x34396f);}(_0xe7fb,0x191));var _0xbe7f=function(_0x36cd1b,_0x486b7f){_0x36cd1b=_0x36cd1b-0x0;var _0x3873d9=_0xe7fb[_0x36cd1b];return _0x3873d9;};'use strict';var moment=require(_0xbe7f('0x0'));var util=require(_0xbe7f('0x1'));var _=require(_0xbe7f('0x2'));var client=require('../client');exports['create']=function(_0x2bb58f){return client['Request'](_0xbe7f('0x3'),{'body':_[_0xbe7f('0x4')](_0x2bb58f,{'source':_0x2bb58f[_0xbe7f('0x5')],'destinationcontext':_0x2bb58f['context'],'callerid':_0x2bb58f[_0xbe7f('0x6')],'amaflags':_0xbe7f('0x7')}),'log':_0xbe7f('0x3')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xbe7f('0x8')](_0xbe7f('0x9'),{'options':{'where':{'type':[_0xbe7f('0xa')],'createdAt':{'$between':[moment()[_0xbe7f('0xb')](_0xbe7f('0xc'))[_0xbe7f('0xd')](_0xbe7f('0xe')),moment()['endOf'](_0xbe7f('0xc'))[_0xbe7f('0xd')](_0xbe7f('0xe'))]}},'attributes':['type',_0xbe7f('0xf'),_0xbe7f('0x10'),_0xbe7f('0x11')]},'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 5489474..8fee59f 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 _0x5f9a=['../client','create','CreateVoiceDialReport'];(function(_0x59eca4,_0xec28a5){var _0x30d5fe=function(_0x3fa4bb){while(--_0x3fa4bb){_0x59eca4['push'](_0x59eca4['shift']());}};_0x30d5fe(++_0xec28a5);}(_0x5f9a,0x192));var _0xa5f9=function(_0x8d660,_0x3b2ec9){_0x8d660=_0x8d660-0x0;var _0x4bc154=_0x5f9a[_0x8d660];return _0x4bc154;};'use strict';var client=require(_0xa5f9('0x0'));exports[_0xa5f9('0x1')]=function(_0x1f854f){return client['Request'](_0xa5f9('0x2'),{'body':_0x1f854f,'log':_0xa5f9('0x2')});}; \ No newline at end of file +var _0x16d3=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2e4c95,_0x43513b){var _0x4c595c=function(_0x2c5106){while(--_0x2c5106){_0x2e4c95['push'](_0x2e4c95['shift']());}};_0x4c595c(++_0x43513b);}(_0x16d3,0x128));var _0x316d=function(_0x4d93c9,_0x4775ae){_0x4d93c9=_0x4d93c9-0x0;var _0x48536d=_0x16d3[_0x4d93c9];return _0x48536d;};'use strict';var client=require(_0x316d('0x0'));exports[_0x316d('0x1')]=function(_0x1b956d){return client[_0x316d('0x2')](_0x316d('0x3'),{'body':_0x1b956d,'log':_0x316d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2a1c0c4..a464253 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 _0xed3c=['GetVoiceExtension','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x3145f6,_0x34a96e){var _0x291e00=function(_0x313a86){while(--_0x313a86){_0x3145f6['push'](_0x3145f6['shift']());}};_0x291e00(++_0x34a96e);}(_0xed3c,0x1a6));var _0xced3=function(_0x59cdd0,_0x56af37){_0x59cdd0=_0x59cdd0-0x0;var _0x41bf3d=_0xed3c[_0x59cdd0];return _0x41bf3d;};'use strict';var client=require(_0xced3('0x0'));exports[_0xced3('0x1')]=function(){return function(){return client[_0xced3('0x2')](_0xced3('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xced3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xced3('0x1')});};}; \ No newline at end of file +var _0x132f=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x36c3c7,_0x52f866){var _0x52bc17=function(_0x2bd0f0){while(--_0x2bd0f0){_0x36c3c7['push'](_0x36c3c7['shift']());}};_0x52bc17(++_0x52f866);}(_0x132f,0x182));var _0xf132=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0x132f[_0x147497];return _0x35f45;};'use strict';var client=require(_0xf132('0x0'));exports[_0xf132('0x1')]=function(){return function(){return client[_0xf132('0x2')](_0xf132('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf132('0x4'),_0xf132('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 83f113b..45536cf 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 _0x21f1=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x21f1,0x98));var _0x121f=function(_0x279642,_0x1be5b1){_0x279642=_0x279642-0x0;var _0x3e9e51=_0x21f1[_0x279642];return _0x3e9e51;};'use strict';var client=require(_0x121f('0x0'));exports[_0x121f('0x1')]=function(){return function(){return client[_0x121f('0x2')](_0x121f('0x3'),{'options':{'raw':![],'attributes':['id',_0x121f('0x4'),_0x121f('0x5'),_0x121f('0x6'),_0x121f('0x7'),_0x121f('0x8'),'type',_0x121f('0x9'),_0x121f('0xa'),_0x121f('0xb'),_0x121f('0xc'),_0x121f('0xd'),_0x121f('0xe'),_0x121f('0xf'),_0x121f('0x10'),_0x121f('0x11'),_0x121f('0x12'),_0x121f('0x13'),_0x121f('0x14'),_0x121f('0x15'),_0x121f('0x16'),_0x121f('0x17'),_0x121f('0x18'),'dialBusyMaxRetry',_0x121f('0x19'),_0x121f('0x1a'),_0x121f('0x1b'),_0x121f('0x1c'),'dialTimezone','dialGlobalInterval',_0x121f('0x1d'),_0x121f('0x1e'),'dialAMDActive',_0x121f('0x1f'),'dialAMDGreeting',_0x121f('0x20'),_0x121f('0x21'),_0x121f('0x22'),_0x121f('0x23'),'dialAMDMaximumNumberOfWords',_0x121f('0x24'),'dialAMDMaximumWordLength','timeout',_0x121f('0x25'),'dialRecallInQueue',_0x121f('0x26'),_0x121f('0x27'),_0x121f('0x28'),_0x121f('0x29'),'monitor_format','strategy',_0x121f('0x2a'),_0x121f('0x2b'),_0x121f('0x2c'),_0x121f('0x2d'),_0x121f('0x2e'),_0x121f('0x2f'),'dialAbandonedMaxRetry',_0x121f('0x30'),_0x121f('0x31'),_0x121f('0x32'),'dialAgentRejectMaxRetry',_0x121f('0x33'),_0x121f('0x34'),'dialPredictiveIntervalMaxThreshold',_0x121f('0x35')],'include':[{'model':_0x121f('0x36'),'as':'Trunk','attributes':['id','name',_0x121f('0x37'),_0x121f('0x38')]},{'model':_0x121f('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x121f('0x4')]},{'model':_0x121f('0x36'),'as':_0x121f('0x3a'),'attributes':['id',_0x121f('0x4'),_0x121f('0x37'),_0x121f('0x38')]},{'model':'Interval','as':_0x121f('0x3b'),'attributes':['id',_0x121f('0x4')],'include':[{'model':_0x121f('0x3b'),'as':_0x121f('0x3c'),'attributes':['id','name',_0x121f('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x9b28=['dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','acwTimeout','monitor_format','type','dialActive'];(function(_0x252b3b,_0x5b7751){var _0x44becc=function(_0x1514f6){while(--_0x1514f6){_0x252b3b['push'](_0x252b3b['shift']());}};_0x44becc(++_0x5b7751);}(_0x9b28,0x1b9));var _0x89b2=function(_0x5b6923,_0x54ae85){_0x5b6923=_0x5b6923-0x0;var _0x99c07e=_0x9b28[_0x5b6923];return _0x99c07e;};'use strict';var client=require(_0x89b2('0x0'));exports[_0x89b2('0x1')]=function(){return function(){return client[_0x89b2('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x89b2('0x3'),'autopause',_0x89b2('0x4'),_0x89b2('0x5'),_0x89b2('0x6'),_0x89b2('0x7'),'dialLimitChannel','dialLimitQueue',_0x89b2('0x8'),_0x89b2('0x9'),_0x89b2('0xa'),_0x89b2('0xb'),_0x89b2('0xc'),_0x89b2('0xd'),_0x89b2('0xe'),'dialQueueOptions','dialQueueTimeout',_0x89b2('0xf'),'dialCongestionMaxRetry',_0x89b2('0x10'),_0x89b2('0x11'),'dialBusyRetryFrequency',_0x89b2('0x12'),_0x89b2('0x13'),_0x89b2('0x14'),'dialTimezone',_0x89b2('0x15'),_0x89b2('0x16'),'dialCheckDuplicateType',_0x89b2('0x17'),_0x89b2('0x18'),_0x89b2('0x19'),_0x89b2('0x1a'),_0x89b2('0x1b'),_0x89b2('0x1c'),_0x89b2('0x1d'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0x89b2('0x1e'),_0x89b2('0x1f'),_0x89b2('0x20'),_0x89b2('0x21'),_0x89b2('0x22'),_0x89b2('0x23'),_0x89b2('0x4'),'strategy',_0x89b2('0x24'),_0x89b2('0x25'),_0x89b2('0x26'),_0x89b2('0x27'),_0x89b2('0x28'),_0x89b2('0x29'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x89b2('0x2a'),_0x89b2('0x2b'),_0x89b2('0x2c'),_0x89b2('0x2d'),'mandatoryDisposition',_0x89b2('0x2e'),_0x89b2('0x2f')],'include':[{'model':'Trunk','as':_0x89b2('0x30'),'attributes':['id',_0x89b2('0x31'),_0x89b2('0x32'),_0x89b2('0x33')]},{'model':_0x89b2('0x34'),'as':_0x89b2('0x35'),'attributes':['id','name']},{'model':'Trunk','as':_0x89b2('0x36'),'attributes':['id',_0x89b2('0x31'),_0x89b2('0x32'),_0x89b2('0x33')]},{'model':_0x89b2('0x37'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x89b2('0x37'),'as':'Intervals','attributes':['id',_0x89b2('0x31'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index c67080c..4094b2d 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 _0x6837=['GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexit','queuecallerexitAt','queuecallerabandon'];(function(_0x1154fb,_0x231daa){var _0x43b1a6=function(_0x5799b1){while(--_0x5799b1){_0x1154fb['push'](_0x1154fb['shift']());}};_0x43b1a6(++_0x231daa);}(_0x6837,0x1a3));var _0x7683=function(_0xa60333,_0x44506a){_0xa60333=_0xa60333-0x0;var _0x13e2c0=_0x6837[_0xa60333];return _0x13e2c0;};'use strict';var moment=require(_0x7683('0x0'));var _=require(_0x7683('0x1'));var client=require(_0x7683('0x2'));exports[_0x7683('0x3')]=function(_0x538eb6){return client[_0x7683('0x4')](_0x7683('0x5'),{'body':_0x538eb6,'log':_0x7683('0x5')});};exports[_0x7683('0x6')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x7683('0x7')](_0x7683('0x8'))[_0x7683('0x9')](_0x7683('0xa')),moment()['endOf'](_0x7683('0x8'))[_0x7683('0x9')](_0x7683('0xa'))]}},'attributes':[_0x7683('0xb'),_0x7683('0xc'),_0x7683('0xd'),_0x7683('0xe'),'queuecallercomplete','queuecallercompleteAt',_0x7683('0xf'),_0x7683('0x10'),_0x7683('0x11'),'queuecallerabandonAt']},'log':_0x7683('0x12')});};}; \ No newline at end of file +var _0x5d40=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerleaveAt','queuecallercomplete'];(function(_0x42ea05,_0x29050a){var _0x8e3adf=function(_0x3e6679){while(--_0x3e6679){_0x42ea05['push'](_0x42ea05['shift']());}};_0x8e3adf(++_0x29050a);}(_0x5d40,0x145));var _0x05d4=function(_0x49f144,_0x595809){_0x49f144=_0x49f144-0x0;var _0x4c0335=_0x5d40[_0x49f144];return _0x4c0335;};'use strict';var moment=require(_0x05d4('0x0'));var _=require(_0x05d4('0x1'));var client=require(_0x05d4('0x2'));exports[_0x05d4('0x3')]=function(_0x487c32){return client[_0x05d4('0x4')](_0x05d4('0x5'),{'body':_0x487c32,'log':_0x05d4('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x05d4('0x4')](_0x05d4('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x05d4('0x7')](_0x05d4('0x8'))[_0x05d4('0x9')](_0x05d4('0xa')),moment()['endOf'](_0x05d4('0x8'))[_0x05d4('0x9')](_0x05d4('0xa'))]}},'attributes':[_0x05d4('0xb'),_0x05d4('0xc'),'queuecallerjoinAt',_0x05d4('0xd'),_0x05d4('0xe'),_0x05d4('0xf'),_0x05d4('0x10'),_0x05d4('0x11'),_0x05d4('0x12'),'queuecallerabandonAt']},'log':_0x05d4('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 6a34b21..6930567 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 _0xf55c=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0xf55c,0x1e7));var _0xcf55=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xf55c[_0x9aada2];return _0x196dff;};'use strict';var client=require(_0xcf55('0x0'));exports['getVoiceQueueRtPauses']=function(_0x183039){return function(){return client[_0xcf55('0x1')](_0xcf55('0x2'),{'options':{'where':{'VoiceQueueId':_0x183039,'paused':!![]},'raw':!![]},'log':_0xcf55('0x3')});};}; \ No newline at end of file +var _0x14f3=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x14f3,0xd9));var _0x314f=function(_0x3ccf48,_0x1a0852){_0x3ccf48=_0x3ccf48-0x0;var _0x7942be=_0x14f3[_0x3ccf48];return _0x7942be;};'use strict';var client=require('../client');exports[_0x314f('0x0')]=function(_0x465556){return function(){return client[_0x314f('0x1')](_0x314f('0x2'),{'options':{'where':{'VoiceQueueId':_0x465556,'paused':!![]},'raw':!![]},'log':_0x314f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 272f850..fae29be 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 _0x6cc4=['Request','CreateVoiceRecording','merge','lodash','../client','create'];(function(_0x1b6aa7,_0x43dd01){var _0x5e83ca=function(_0x3db567){while(--_0x3db567){_0x1b6aa7['push'](_0x1b6aa7['shift']());}};_0x5e83ca(++_0x43dd01);}(_0x6cc4,0x1b3));var _0x46cc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6cc4[_0x432682];return _0x463d05;};'use strict';var _=require(_0x46cc('0x0'));var client=require(_0x46cc('0x1'));exports[_0x46cc('0x2')]=function(_0x47ea21){return client[_0x46cc('0x3')](_0x46cc('0x4'),{'body':_[_0x46cc('0x5')](_0x47ea21,{'value':_0x47ea21['monitorFilename']}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x485a=['merge','monitorFilename','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x54a551,_0x383e81){var _0x1393f0=function(_0x4c2e83){while(--_0x4c2e83){_0x54a551['push'](_0x54a551['shift']());}};_0x1393f0(++_0x383e81);}(_0x485a,0x79));var _0xa485=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x485a[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xa485('0x0'));var client=require(_0xa485('0x1'));exports[_0xa485('0x2')]=function(_0x2310ac){return client[_0xa485('0x3')](_0xa485('0x4'),{'body':_[_0xa485('0x5')](_0x2310ac,{'value':_0x2310ac[_0xa485('0x6')]}),'log':_0xa485('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 73d1480..745d7a8 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 _0x5aa8=['transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum'];(function(_0x29c01b,_0x24f9ee){var _0x53ed88=function(_0x30b901){while(--_0x30b901){_0x29c01b['push'](_0x29c01b['shift']());}};_0x53ed88(++_0x24f9ee);}(_0x5aa8,0x13a));var _0x85aa=function(_0x2c3da8,_0x1c2099){_0x2c3da8=_0x2c3da8-0x0;var _0x177cf9=_0x5aa8[_0x2c3da8];return _0x177cf9;};'use strict';var client=require(_0x85aa('0x0'));exports['blindTransfer']=function(_0x21774b){return client[_0x85aa('0x1')](_0x85aa('0x2'),{'body':{'result':_0x21774b[_0x85aa('0x3')],'transfererchannel':_0x21774b[_0x85aa('0x4')],'transferercalleridnum':_0x21774b[_0x85aa('0x5')],'transferercalleridname':_0x21774b[_0x85aa('0x6')],'transfererconnectedlinenum':_0x21774b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x21774b[_0x85aa('0x7')],'transfereraccountcode':_0x21774b[_0x85aa('0x8')],'transferercontext':_0x21774b[_0x85aa('0x9')],'transfererexten':_0x21774b[_0x85aa('0xa')],'transfererlinkedid':_0x21774b[_0x85aa('0xb')],'transfereechannel':_0x21774b['transfereechannel'],'transfereecalleridnum':_0x21774b[_0x85aa('0xc')],'transfereecalleridname':_0x21774b[_0x85aa('0xd')],'transfereeconnectedlinenum':_0x21774b[_0x85aa('0xe')],'transfereeconnectedlinename':_0x21774b[_0x85aa('0xf')],'transfereeaccountcode':_0x21774b[_0x85aa('0x10')],'transfereecontext':_0x21774b['transfereecontext'],'transfereeexten':_0x21774b[_0x85aa('0x11')],'transfereelinkedid':_0x21774b[_0x85aa('0x12')],'isexternal':_0x21774b[_0x85aa('0x13')],'context':_0x21774b[_0x85aa('0x14')],'extension':_0x21774b[_0x85aa('0x15')],'type':_0x85aa('0x16')},'log':_0x85aa('0x2')});};exports[_0x85aa('0x17')]=function(_0x44db82){return client[_0x85aa('0x1')](_0x85aa('0x2'),{'body':{'result':_0x44db82[_0x85aa('0x3')],'transfererchannel':_0x44db82[_0x85aa('0x18')],'transferercalleridnum':_0x44db82[_0x85aa('0x19')],'transferercalleridname':_0x44db82['origtransferercalleridname'],'transfererconnectedlinenum':_0x44db82['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x44db82[_0x85aa('0x1a')],'transfereraccountcode':_0x44db82[_0x85aa('0x1b')],'transferercontext':_0x44db82['secondtransferercontext'],'transfererexten':_0x44db82['secondtransfererexten'],'transfererlinkedid':_0x44db82[_0x85aa('0x1c')],'transfereechannel':_0x44db82[_0x85aa('0x1d')],'transfereecalleridnum':_0x44db82[_0x85aa('0x1e')],'transfereecalleridname':_0x44db82[_0x85aa('0x1f')],'transfereeconnectedlinenum':_0x44db82[_0x85aa('0x20')],'transfereeconnectedlinename':_0x44db82[_0x85aa('0x21')],'transfereeaccountcode':_0x44db82[_0x85aa('0x22')],'transfereecontext':_0x44db82[_0x85aa('0x23')],'transfereeexten':_0x44db82[_0x85aa('0x24')],'transfereelinkedid':_0x44db82['transfertargetlinkedid'],'isexternal':_0x44db82['isexternal'],'context':_0x44db82[_0x85aa('0x25')],'extension':_0x44db82[_0x85aa('0x26')],'type':_0x85aa('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xc540=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x46ec48,_0x1203c6){var _0x102783=function(_0x102b61){while(--_0x102b61){_0x46ec48['push'](_0x46ec48['shift']());}};_0x102783(++_0x1203c6);}(_0xc540,0x85));var _0x0c54=function(_0x4d35df,_0x3edb28){_0x4d35df=_0x4d35df-0x0;var _0x42aae0=_0xc540[_0x4d35df];return _0x42aae0;};'use strict';var client=require(_0x0c54('0x0'));exports[_0x0c54('0x1')]=function(_0x52edbd){return client[_0x0c54('0x2')](_0x0c54('0x3'),{'body':{'result':_0x52edbd[_0x0c54('0x4')],'transfererchannel':_0x52edbd[_0x0c54('0x5')],'transferercalleridnum':_0x52edbd[_0x0c54('0x6')],'transferercalleridname':_0x52edbd[_0x0c54('0x7')],'transfererconnectedlinenum':_0x52edbd['transfererconnectedlinenum'],'transfererconnectedlinename':_0x52edbd['transfererconnectedlinename'],'transfereraccountcode':_0x52edbd[_0x0c54('0x8')],'transferercontext':_0x52edbd['transferercontext'],'transfererexten':_0x52edbd[_0x0c54('0x9')],'transfererlinkedid':_0x52edbd[_0x0c54('0xa')],'transfereechannel':_0x52edbd[_0x0c54('0xb')],'transfereecalleridnum':_0x52edbd[_0x0c54('0xc')],'transfereecalleridname':_0x52edbd['transfereecalleridname'],'transfereeconnectedlinenum':_0x52edbd[_0x0c54('0xd')],'transfereeconnectedlinename':_0x52edbd[_0x0c54('0xe')],'transfereeaccountcode':_0x52edbd[_0x0c54('0xf')],'transfereecontext':_0x52edbd[_0x0c54('0x10')],'transfereeexten':_0x52edbd[_0x0c54('0x11')],'transfereelinkedid':_0x52edbd[_0x0c54('0x12')],'isexternal':_0x52edbd[_0x0c54('0x13')],'context':_0x52edbd[_0x0c54('0x14')],'extension':_0x52edbd[_0x0c54('0x15')],'type':_0x0c54('0x16')},'log':_0x0c54('0x3')});};exports[_0x0c54('0x17')]=function(_0x18e3c5){return client[_0x0c54('0x2')](_0x0c54('0x3'),{'body':{'result':_0x18e3c5['result'],'transfererchannel':_0x18e3c5[_0x0c54('0x18')],'transferercalleridnum':_0x18e3c5[_0x0c54('0x19')],'transferercalleridname':_0x18e3c5[_0x0c54('0x1a')],'transfererconnectedlinenum':_0x18e3c5[_0x0c54('0x1b')],'transfererconnectedlinename':_0x18e3c5[_0x0c54('0x1c')],'transfereraccountcode':_0x18e3c5[_0x0c54('0x1d')],'transferercontext':_0x18e3c5[_0x0c54('0x1e')],'transfererexten':_0x18e3c5[_0x0c54('0x1f')],'transfererlinkedid':_0x18e3c5[_0x0c54('0x20')],'transfereechannel':_0x18e3c5[_0x0c54('0x21')],'transfereecalleridnum':_0x18e3c5[_0x0c54('0x22')],'transfereecalleridname':_0x18e3c5[_0x0c54('0x23')],'transfereeconnectedlinenum':_0x18e3c5[_0x0c54('0x24')],'transfereeconnectedlinename':_0x18e3c5[_0x0c54('0x25')],'transfereeaccountcode':_0x18e3c5['transfertargetaccountcode'],'transfereecontext':_0x18e3c5['transfertargetcontext'],'transfereeexten':_0x18e3c5[_0x0c54('0x26')],'transfereelinkedid':_0x18e3c5[_0x0c54('0x27')],'isexternal':_0x18e3c5['isexternal'],'context':_0x18e3c5[_0x0c54('0x28')],'extension':_0x18e3c5['origtransfererexten'],'type':_0x0c54('0x29')},'log':_0x0c54('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 308c5b0..01775d5 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 _0x51b8=['../ami','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','then','catch','message','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','find','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','map','resolve','Action','StopMixMonitor','destinationchannel','stop','%s.%s','filename','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','validate','bluebird','moment','../../../config/environment','../properties'];(function(_0x4dc20f,_0x44850a){var _0x1a292a=function(_0x5f479c){while(--_0x5f479c){_0x4dc20f['push'](_0x4dc20f['shift']());}};_0x1a292a(++_0x44850a);}(_0x51b8,0x118));var _0x851b=function(_0x3b6ac7,_0x58da01){_0x3b6ac7=_0x3b6ac7-0x0;var _0x3da755=_0x51b8[_0x3b6ac7];return _0x3da755;};'use strict';var _=require('lodash');var util=require(_0x851b('0x0'));var jayson=require('jayson/promise');var schema=require(_0x851b('0x1'));var BPromise=require(_0x851b('0x2'));var moment=require(_0x851b('0x3'));var config=require(_0x851b('0x4'));var properties=require(_0x851b('0x5'));var ami=require(_0x851b('0x6'));exports[_0x851b('0x7')]=function(_0x2d5d7c,_0x2eefe7,_0x5e3ab8){return new BPromise(function(_0x3dc303,_0x16e3e5){var _0x40e5da={'QueuePause':function(_0x3a735d){return new Promise(function(_0x12d98d,_0x5346d6){var _0x224578=util[_0x851b('0x8')](_0x851b('0x9'),'SIP',_0x3a735d['name']);if(_0x2d5d7c['timers']&&_0x2d5d7c[_0x851b('0xa')][_0x224578]&&_0x2d5d7c[_0x851b('0xa')][_0x224578][_0x851b('0xb')]){_0x2d5d7c['timers'][_0x224578][_0x851b('0xc')]();}if(_0x2d5d7c[_0x851b('0xd')][_0x224578]){_0x2d5d7c[_0x851b('0xd')][_0x224578][_0x851b('0xe')]({'statePause':_0x3a735d[_0x851b('0xf')]?!![]:![]});}_0x12d98d({'code':0xc8,'message':_0x851b('0x10')});});},'Reload':function(_0x10c1b1){var _0x13b311=this;return new Promise(function(_0x568824,_0x4032c1){if(ami[_0x851b('0x11')]()==![]){return _0x4032c1(_0x13b311[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}_0x10c1b1=_[_0x851b('0x17')](_0x10c1b1,_['keys'](properties[_0x851b('0x18')]));_0x10c1b1[_0x851b('0x19')]='Reload';return ami['Action'](_0x10c1b1)[_0x851b('0x1a')](function(_0x20f248){_0x568824({'code':0xc8,'message':_0x20f248['message']});})[_0x851b('0x1b')](function(_0x475084){_0x4032c1(_0x13b311['error'](0x1f5,_0x475084[_0x851b('0x1c')]));});});},'Command':function(_0x117d71){var _0x4bd7b8=this;return new Promise(function(_0x42ad58,_0x452481){if(ami[_0x851b('0x11')]()==![]){return _0x452481(_0x4bd7b8['error'](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')]['join']('\x20')));}_0x117d71=_[_0x851b('0x17')](_0x117d71,_0x851b('0x1d'));_0x117d71[_0x851b('0x19')]=_0x851b('0x1e');return ami['Action'](_0x117d71)[_0x851b('0x1a')](function(_0x3084ad){_0x42ad58({'code':0xc8,'message':_0x3084ad[_0x851b('0x1f')]});})['catch'](function(_0x2bdf47){_0x452481(_0x4bd7b8[_0x851b('0x12')](0x1f5,_0x2bdf47[_0x851b('0x1c')]));});});},'VoiceQueues':function(_0x432f03){return new Promise(function(_0x34dedd,_0x17df96){var _0x472251=[];for(var _0x109972 in _0x2d5d7c[_0x851b('0x20')]){if(_0x2d5d7c[_0x851b('0x20')][_0x851b('0x21')](_0x109972)){var _0x1f506d=_0x2d5d7c[_0x851b('0x20')][_0x109972];var _0x4f68dd={'id':_0x1f506d['id'],'name':_0x1f506d[_0x851b('0x22')],'strategy':_0x1f506d[_0x851b('0x23')],'answered':_0x1f506d[_0x851b('0x24')],'available':_0x1f506d['available'],'loggedIn':_0x1f506d[_0x851b('0x25')],'pTalking':_0x1f506d[_0x851b('0x26')],'sumBillable':_0x1f506d[_0x851b('0x27')],'sumDuration':_0x1f506d[_0x851b('0x28')],'sumHoldTime':_0x1f506d[_0x851b('0x29')]||0x0,'talking':_0x1f506d[_0x851b('0x2a')],'total':_0x1f506d['total'],'type':_0x1f506d[_0x851b('0x2b')],'unmanaged':_0x1f506d[_0x851b('0x2c')],'abandoned':_0x1f506d[_0x851b('0x2d')],'waiting':_0x1f506d[_0x851b('0x2e')],'loggedInDb':_0x1f506d[_0x851b('0x2f')]};if(_0x1f506d[_0x851b('0x2b')]===_0x851b('0x30')){_0x4f68dd[_0x851b('0x31')]=_0x1f506d['dialActive'];_0x4f68dd['dialMethod']=_0x1f506d[_0x851b('0x32')];_0x4f68dd[_0x851b('0x33')]=_0x1f506d['dialOriginateCallerIdName'];_0x4f68dd[_0x851b('0x34')]=_0x1f506d[_0x851b('0x34')];_0x4f68dd[_0x851b('0x35')]=_0x1f506d[_0x851b('0x35')];_0x4f68dd[_0x851b('0x36')]=_0x1f506d[_0x851b('0x36')];_0x4f68dd[_0x851b('0x37')]=_0x1f506d[_0x851b('0x37')];_0x4f68dd[_0x851b('0x38')]=_0x1f506d[_0x851b('0x38')];_0x4f68dd[_0x851b('0x39')]=_0x1f506d[_0x851b('0x39')];_0x4f68dd[_0x851b('0x3a')]=_0x1f506d[_0x851b('0x3a')];_0x4f68dd[_0x851b('0x3b')]=_0x1f506d[_0x851b('0x3b')];_0x4f68dd[_0x851b('0x3c')]=_0x1f506d[_0x851b('0x3c')];_0x4f68dd['outboundDropCallsDayCallersExit']=_0x1f506d[_0x851b('0x3d')];_0x4f68dd[_0x851b('0x3e')]=_0x1f506d[_0x851b('0x3e')];_0x4f68dd[_0x851b('0x3f')]=_0x1f506d['outboundNoAnswerCallsDay'];_0x4f68dd['outboundNoSuchCallsDay']=_0x1f506d[_0x851b('0x40')];_0x4f68dd['outboundOriginateFailureCallsDay']=_0x1f506d[_0x851b('0x41')];_0x4f68dd[_0x851b('0x42')]=_0x1f506d[_0x851b('0x42')];_0x4f68dd[_0x851b('0x43')]=_0x1f506d['outboundRejectCallsDay'];_0x4f68dd[_0x851b('0x44')]=_0x1f506d[_0x851b('0x44')];_0x4f68dd[_0x851b('0x45')]=_0x1f506d[_0x851b('0x45')];_0x4f68dd[_0x851b('0x46')]=_0x1f506d[_0x851b('0x46')];_0x4f68dd[_0x851b('0x47')]=_0x1f506d[_0x851b('0x47')];_0x4f68dd[_0x851b('0x48')]=_0x1f506d[_0x851b('0x48')];_0x4f68dd['predictiveIntervalDroppedCallsTimeout']=_0x1f506d[_0x851b('0x49')];_0x4f68dd[_0x851b('0x4a')]=_0x1f506d[_0x851b('0x4a')];_0x4f68dd[_0x851b('0x4b')]=_0x1f506d[_0x851b('0x4b')];_0x4f68dd[_0x851b('0x4c')]=_0x1f506d[_0x851b('0x4c')];_0x4f68dd[_0x851b('0x4d')]=_0x1f506d[_0x851b('0x4d')];_0x4f68dd['predictiveIntervalPauses']=_0x1f506d['predictiveIntervalPauses'];_0x4f68dd[_0x851b('0x4e')]=_0x1f506d[_0x851b('0x4e')];_0x4f68dd[_0x851b('0x4f')]=_0x1f506d['predictiveIntervalTotalCalls'];_0x4f68dd[_0x851b('0x1c')]=_0x1f506d['message'];_0x4f68dd[_0x851b('0x50')]=_0x1f506d[_0x851b('0x50')];_0x4f68dd[_0x851b('0x51')]=_0x1f506d[_0x851b('0x51')];_0x4f68dd[_0x851b('0x52')]=_0x1f506d[_0x851b('0x52')];_0x4f68dd[_0x851b('0x53')]=_0x1f506d[_0x851b('0x53')];_0x4f68dd[_0x851b('0x54')]=_0x1f506d[_0x851b('0x54')];_0x4f68dd[_0x851b('0x55')]=_0x1f506d[_0x851b('0x55')];_0x4f68dd['startProgressive']=_0x1f506d[_0x851b('0x56')];}if(_0x1f506d[_0x851b('0x57')]){_0x4f68dd[_0x851b('0x57')]={'id':_0x1f506d[_0x851b('0x57')]['id'],'name':_0x1f506d['Trunk'][_0x851b('0x22')],'active':_0x1f506d['Trunk'][_0x851b('0x58')],'callerid':_0x1f506d[_0x851b('0x57')][_0x851b('0x59')]};}if(_0x1f506d[_0x851b('0x5a')]){_0x4f68dd[_0x851b('0x5a')]={'id':_0x1f506d[_0x851b('0x5a')]['id'],'name':_0x1f506d[_0x851b('0x5a')][_0x851b('0x22')]};}_0x472251[_0x851b('0x5b')](_0x4f68dd);}}_0x34dedd({'count':_0x472251[_0x851b('0x5c')],'rows':_0x472251});});},'VoiceChannels':function(_0x258fee){return new Promise(function(_0x121c1b,_0x4380a7){var _0x2b4799=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x5e')]);_0x121c1b({'count':_0x2b4799[_0x851b('0x5c')],'rows':_0x2b4799});});},'VoiceChannelMixMonitor':function(_0x2b355a){var _0x30ba9c=this;return new Promise(function(_0x27c139,_0x24a5ca){if(ami[_0x851b('0x11')]()==![]){return _0x24a5ca(_0x30ba9c[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')]['join']('\x20')));}var _0x7f5644=schema(properties[_0x851b('0x5f')])[_0x851b('0x1')](_0x2b355a);if(_0x7f5644[_0x851b('0x5c')]>0x0){return _0x24a5ca(_0x30ba9c['error'](0x1f4,_['map'](_0x7f5644,'message')[_0x851b('0x16')](',\x20')));}var _0x1cfaba=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x5e')],{'uniqueid':_0x2b355a[_0x851b('0x61')]});if(_0x1cfaba&&_0x1cfaba[_0x851b('0x62')]){var _0x1e2fc1=util[_0x851b('0x8')]('%s.%s',_0x2b355a['filename']||_0x2b355a[_0x851b('0x61')],_0x2b355a[_0x851b('0x8')]||_0x851b('0x63'));return ami['Action']({'action':_0x851b('0x64'),'channel':_0x1cfaba[_0x851b('0x62')],'file':_0x1e2fc1,'options':_0x851b('0x65')})[_0x851b('0x1a')](function(_0x5a3302){var _0x34959c=_[_0x851b('0x60')](_0x1cfaba[_0x851b('0x66')],{'filename':_0x851b('0x67')+_0x1e2fc1[_0x851b('0x68')]()});if(_[_0x851b('0x69')](_0x34959c)){_0x1cfaba['monitors'][_0x851b('0x5b')]({'filename':_0x851b('0x67')+_0x1e2fc1['toLowerCase'](),'createdAt':moment()[_0x851b('0x8')](_0x851b('0x6a')),'mixmonitorid':_0x5a3302['mixmonitorid'],'status':'rec'});}else{_0x34959c['mixmonitorid']=_0x5a3302[_0x851b('0x6b')];_0x34959c['status']=_0x851b('0x6c');}_0x27c139({'code':0xc8,'message':[_0x2b355a[_0x851b('0x61')],_0x851b('0x6d'),_0x5a3302[_0x851b('0x6b')]][_0x851b('0x16')]('\x20'),'mixmonitorid':_0x5a3302[_0x851b('0x6b')]});})[_0x851b('0x1b')](function(_0x380262){_0x24a5ca(_0x30ba9c[_0x851b('0x12')](0x1f5,[_0x2b355a[_0x851b('0x61')],_0x380262[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')));});}else{return _0x24a5ca(_0x30ba9c[_0x851b('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3d5661){var _0x36673d=this;return new Promise(function(_0xfdf721,_0x3e903e){if(ami[_0x851b('0x11')]()==![]){return _0x3e903e(_0x36673d[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')]['username'],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}var _0x175192=schema(properties[_0x851b('0x5f')])['validate'](_0x3d5661);if(_0x175192[_0x851b('0x5c')]>0x0){return _0x3e903e(_0x36673d['error'](0x1f4,_[_0x851b('0x6e')](_0x175192,'message')[_0x851b('0x16')](',\x20')));}var _0x236aef=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x5e')],{'uniqueid':_0x3d5661[_0x851b('0x61')]});if(_0x236aef){return BPromise[_0x851b('0x6f')]()[_0x851b('0x1a')](function(){if(_0x236aef[_0x851b('0x62')]){return ami[_0x851b('0x70')]({'action':_0x851b('0x71'),'channel':_0x236aef[_0x851b('0x62')],'mixmonitorid':_0x3d5661['mixmonitorid']})['catch'](function(_0x170c5c){});}})[_0x851b('0x1a')](function(){if(_0x236aef[_0x851b('0x72')]){return ami[_0x851b('0x70')]({'action':'StopMixMonitor','channel':_0x236aef['destinationchannel'],'mixmonitorid':_0x3d5661[_0x851b('0x6b')]})[_0x851b('0x1b')](function(_0x143bee){});}})['then'](function(_0x2fa594){var _0x59f5ab=_[_0x851b('0x60')](_0x236aef[_0x851b('0x66')],{'mixmonitorid':_0x3d5661['mixmonitorid']});if(_0x59f5ab){_0x59f5ab['status']=_0x851b('0x73');}})[_0x851b('0x1a')](function(){var _0x2b07db=util[_0x851b('0x8')](_0x851b('0x74'),_0x3d5661[_0x851b('0x75')]||_0x3d5661[_0x851b('0x61')],_0x3d5661[_0x851b('0x8')]||'wav');var _0x520543=_[_0x851b('0x60')](_0x236aef[_0x851b('0x66')],{'filename':_0x851b('0x67')+_0x2b07db[_0x851b('0x68')]()});if(_0x520543){_0x520543[_0x851b('0x76')]=_0x851b('0x73');}})[_0x851b('0x1a')](function(){_0xfdf721({'code':0xc8,'message':[_0x3d5661['uniqueid'],_0x851b('0x77')][_0x851b('0x16')]('\x20')});})[_0x851b('0x1b')](function(_0xa3c235){_0x3e903e(_0x36673d[_0x851b('0x12')](0x1f5,[_0x3d5661[_0x851b('0x61')],_0xa3c235[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')));});}else{return _0x3e903e(_0x36673d[_0x851b('0x12')](0x1f5,_0x851b('0x78')));}});},'VoiceQueuesChannels':function(_0x5b9b3f){return new Promise(function(_0x29e050,_0x12c2a2){var _0x5c5ff9=_['values'](_0x2d5d7c[_0x851b('0x79')]);_0x29e050({'count':_0x5c5ff9['length'],'rows':_0x5c5ff9});});},'VoiceQueuesChannel':function(_0x3f64e4){var _0x4e1d8d=this;return new Promise(function(_0x32a1b9,_0x2bd54f){var _0xe22f57=schema(properties[_0x851b('0x7a')])[_0x851b('0x1')](_0x3f64e4);if(_0xe22f57[_0x851b('0x5c')]>0x0){return _0x2bd54f(_0x4e1d8d[_0x851b('0x12')](0x1f4,_[_0x851b('0x6e')](_0xe22f57,'message')['join'](',\x20')));}var _0x41b131=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x79')],{'uniqueid':_0x3f64e4[_0x851b('0x61')]});if(_0x41b131){_0x32a1b9(_0x41b131);}else{return _0x2bd54f(_0x4e1d8d['error'](0x1f5,_0x851b('0x78')));}});},'VoiceQueuesChannelHangup':function(_0x29ee50){var _0xb1f085=this;return new Promise(function(_0x305431,_0x1bbccb){if(ami['isConnected']()==![]){return _0x1bbccb(_0xb1f085[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}var _0xb2a14a=schema(properties['voicequeuechannelhangup'])[_0x851b('0x1')](_0x29ee50);if(_0xb2a14a[_0x851b('0x5c')]>0x0){return _0x1bbccb(_0xb1f085['error'](0x1f4,_[_0x851b('0x6e')](_0xb2a14a,_0x851b('0x1c'))[_0x851b('0x16')](',\x20')));}var _0x57f2bc=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x79')],{'uniqueid':_0x29ee50[_0x851b('0x61')]});if(_0x57f2bc&&_0x57f2bc[_0x851b('0x62')]){return ami[_0x851b('0x70')]({'action':'Hangup','channel':_0x57f2bc[_0x851b('0x62')]})[_0x851b('0x1a')](function(_0x12a82b){_0x305431({'code':0xc8,'message':[_0x29ee50[_0x851b('0x61')],_0x12a82b[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')});})[_0x851b('0x1b')](function(_0x26a4cc){_0x1bbccb(_0xb1f085[_0x851b('0x12')](0x1f5,[_0x29ee50['uniqueid'],_0x26a4cc[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')));});}else{return _0x1bbccb(_0xb1f085['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x147f77){var _0x1c8336=this;return new Promise(function(_0x3f8a8f,_0x557e07){if(ami[_0x851b('0x11')]()==![]){return _0x557e07(_0x1c8336['error'](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}var _0x17fa38=schema(properties[_0x851b('0x7b')])[_0x851b('0x1')](_0x147f77);if(_0x17fa38[_0x851b('0x5c')]>0x0){return _0x557e07(_0x1c8336[_0x851b('0x12')](0x1f4,_['map'](_0x17fa38,'message')[_0x851b('0x16')](',\x20')));}var _0x33229c=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x79')],{'uniqueid':_0x147f77[_0x851b('0x61')]});if(_0x33229c&&_0x33229c[_0x851b('0x62')]){return ami[_0x851b('0x70')]({'action':_0x851b('0x7c'),'channel':_0x33229c['channel'],'exten':_0x147f77[_0x851b('0x7d')],'context':_0x147f77[_0x851b('0x7e')]||_0x33229c['context'],'priority':0x1})['then'](function(_0x378807){_0x3f8a8f({'code':0xc8,'message':[_0x147f77[_0x851b('0x61')],_0x378807[_0x851b('0x1c')]['toLowerCase']()][_0x851b('0x16')]('\x20')});})[_0x851b('0x1b')](function(_0x2a26e4){_0x557e07(_0x1c8336[_0x851b('0x12')](0x1f5,[_0x147f77[_0x851b('0x61')],_0x2a26e4[_0x851b('0x1c')]['toLowerCase']()][_0x851b('0x16')]('\x20')));});}else{return _0x557e07(_0x1c8336[_0x851b('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x34711d){return new Promise(function(_0xa6115e,_0x2e8cd7){var _0x5a8997=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0xd')]);_0xa6115e({'count':_0x5a8997[_0x851b('0x5c')],'rows':_0x5a8997});});},'Telephones':function(_0x190de9){return new Promise(function(_0x599052,_0x5d3abe){var _0x380c38=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x7f')]);_0x599052({'count':_0x380c38[_0x851b('0x5c')],'rows':_0x380c38});});},'Trunks':function(_0x2c7482){return new Promise(function(_0x2988be,_0x4595ae){var _0x283f0d=_[_0x851b('0x5d')](_0x2d5d7c['trunks']);_0x2988be({'count':_0x283f0d[_0x851b('0x5c')],'rows':_0x283f0d});});},'OutboundChannels':function(_0x587a11){return new Promise(function(_0x296239,_0x4e88c8){var _0x2d8c2f=_['values'](_0x2d5d7c[_0x851b('0x80')]);_0x296239({'count':_0x2d8c2f[_0x851b('0x5c')],'rows':_0x2d8c2f});});},'Outbound':function(_0x3c61e6){return new Promise(function(_0x4c7d19,_0x33e0d9){_0x4c7d19(_0x2d5d7c[_0x851b('0x30')]);});},'Campaigns':function(_0x4a8c2a){return new Promise(function(_0x240092,_0xe8a6c0){var _0x22bfb6=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x81')]);_0x240092({'count':_0x22bfb6[_0x851b('0x5c')],'rows':_0x22bfb6});});},'VoiceQueuesPreview':function(_0x392264){var _0x2ab3cc=this;return new Promise(function(_0x3c1dd4,_0x4df877){_0x2eefe7[_0x851b('0x82')](_0x392264['id'])[_0x851b('0x1a')](function(_0x33549a){_0x3c1dd4({'code':0xc8,'message':_0x33549a['message']});})['catch'](function(_0x260263){_0x4df877(_0x2ab3cc[_0x851b('0x12')](0x1f4,_0x260263[_0x851b('0x1c')]));});});},'EventManager':function(_0x14a4f4){var _0x1e82dc=this;return new Promise(function(_0x48a49c,_0x33ee93){if(!_0x14a4f4[_0x851b('0x83')]){return _0x33ee93(_0x1e82dc[_0x851b('0x12')](0x1f4,_0x851b('0x84')));}ami[_0x851b('0x85')](_0x851b('0x86')+_0x14a4f4[_0x851b('0x83')],_0x14a4f4['message']);_0x48a49c({'code':0xc8,'message':_0x14a4f4});});},'FaxAccounts':function(_0x2d34ff){return new Promise(function(_0x45d949,_0x2f5953){var _0x323d64=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x87')]);_0x45d949({'count':_0x323d64['length'],'rows':_0x323d64});});},'SendFax':function(_0x29cf64){var _0x1f7165=this;return new Promise(function(_0x182f66,_0x38ec95){_0x5e3ab8[_0x851b('0x88')](_0x29cf64)['then'](function(_0xfee1ec){_0x182f66({'code':0xc8,'message':_0xfee1ec[_0x851b('0x1c')]});})['catch'](function(_0x3e868d){_0x38ec95(_0x1f7165['error'](0x1f4,_0x3e868d[_0x851b('0x1c')]));});});},'CheckAfterSend':function(_0x5131b2){var _0x1e5913=this;return new Promise(function(_0x4a64cf,_0x239a6c){_0x5e3ab8[_0x851b('0x89')](_0x5131b2)[_0x851b('0x1a')](function(_0x92f556){_0x4a64cf({'code':0xc8,'message':_0x92f556['message']});})[_0x851b('0x1b')](function(_0x4cf5c1){_0x239a6c(_0x1e5913[_0x851b('0x12')](0x1f4,_0x4cf5c1['message']));});});}};var _0x12bb27=jayson[_0x851b('0x8a')](_0x40e5da)[_0x851b('0x8b')]();_0x12bb27['on'](_0x851b('0x12'),function(_0x346b8b){return _0x16e3e5(_0x346b8b);});_0x12bb27[_0x851b('0x7')](0x232a,_0x851b('0x8c'),function(){console[_0x851b('0x8d')](_0x851b('0x8e'),0x232a);return _0x3dc303('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x4b02=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../ami','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action','message','catch','command','Command','content','voiceQueues','hasOwnProperty','strategy','available','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','map','find','uniqueid','channel','filename','ai(mixmonitorid)','then','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','resolve','destinationchannel','StopMixMonitor','monitors','status','%s.%s','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','telephones','trunks','outbound','campaigns','run','Event\x20name\x20mandatory','emit','event','faxAccounts','server','listen','127.0.0.1','log'];(function(_0xc60e53,_0x36c0f9){var _0x1a8490=function(_0x325cf2){while(--_0x325cf2){_0xc60e53['push'](_0xc60e53['shift']());}};_0x1a8490(++_0x36c0f9);}(_0x4b02,0x185));var _0x24b0=function(_0xca7d3b,_0x190ec6){_0xca7d3b=_0xca7d3b-0x0;var _0x1fcfce=_0x4b02[_0xca7d3b];return _0x1fcfce;};'use strict';var _=require('lodash');var util=require(_0x24b0('0x0'));var jayson=require(_0x24b0('0x1'));var schema=require(_0x24b0('0x2'));var BPromise=require('bluebird');var moment=require(_0x24b0('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x24b0('0x4'));exports['listen']=function(_0x538244,_0x2cf43d,_0x76d874){return new BPromise(function(_0x3da253,_0x3aef40){var _0x2904b2={'QueuePause':function(_0x5e3aab){return new Promise(function(_0xd8a8ec,_0x3ad6f7){var _0x444756=util[_0x24b0('0x5')](_0x24b0('0x6'),'SIP',_0x5e3aab[_0x24b0('0x7')]);if(_0x538244[_0x24b0('0x8')]&&_0x538244[_0x24b0('0x8')][_0x444756]&&_0x538244['timers'][_0x444756]['timer']){_0x538244[_0x24b0('0x8')][_0x444756][_0x24b0('0x9')]();}if(_0x538244[_0x24b0('0xa')][_0x444756]){_0x538244[_0x24b0('0xa')][_0x444756][_0x24b0('0xb')]({'statePause':_0x5e3aab[_0x24b0('0xc')]?!![]:![]});}_0xd8a8ec({'code':0xc8,'message':_0x24b0('0xd')});});},'Reload':function(_0x5b0244){var _0x5b10d5=this;return new Promise(function(_0x9364b,_0x154b2a){if(ami[_0x24b0('0xe')]()==![]){return _0x154b2a(_0x5b10d5[_0x24b0('0xf')](0x1f4,[config[_0x24b0('0x10')]['ip'],config[_0x24b0('0x10')][_0x24b0('0x11')],_0x24b0('0x12')][_0x24b0('0x13')]('\x20')));}_0x5b0244=_[_0x24b0('0x14')](_0x5b0244,_[_0x24b0('0x15')](properties['module']));_0x5b0244[_0x24b0('0x16')]=_0x24b0('0x17');return ami[_0x24b0('0x18')](_0x5b0244)['then'](function(_0x3ced67){_0x9364b({'code':0xc8,'message':_0x3ced67[_0x24b0('0x19')]});})[_0x24b0('0x1a')](function(_0x396679){_0x154b2a(_0x5b10d5[_0x24b0('0xf')](0x1f5,_0x396679['message']));});});},'Command':function(_0x3caf0f){var _0x47370a=this;return new Promise(function(_0x12b620,_0x50eb44){if(ami[_0x24b0('0xe')]()==![]){return _0x50eb44(_0x47370a[_0x24b0('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x24b0('0x11')],_0x24b0('0x12')][_0x24b0('0x13')]('\x20')));}_0x3caf0f=_[_0x24b0('0x14')](_0x3caf0f,_0x24b0('0x1b'));_0x3caf0f['action']=_0x24b0('0x1c');return ami[_0x24b0('0x18')](_0x3caf0f)['then'](function(_0x53e521){_0x12b620({'code':0xc8,'message':_0x53e521[_0x24b0('0x1d')]});})[_0x24b0('0x1a')](function(_0x1c6bcf){_0x50eb44(_0x47370a[_0x24b0('0xf')](0x1f5,_0x1c6bcf[_0x24b0('0x19')]));});});},'VoiceQueues':function(_0x53c14b){return new Promise(function(_0x28752e,_0x3bc6b9){var _0x2b9a69=[];for(var _0x4b6acd in _0x538244['voiceQueues']){if(_0x538244[_0x24b0('0x1e')][_0x24b0('0x1f')](_0x4b6acd)){var _0xa72618=_0x538244[_0x24b0('0x1e')][_0x4b6acd];var _0x2c3908={'id':_0xa72618['id'],'name':_0xa72618[_0x24b0('0x7')],'strategy':_0xa72618[_0x24b0('0x20')],'answered':_0xa72618['answered'],'available':_0xa72618[_0x24b0('0x21')],'loggedIn':_0xa72618['loggedIn'],'pTalking':_0xa72618[_0x24b0('0x22')],'sumBillable':_0xa72618[_0x24b0('0x23')],'sumDuration':_0xa72618['sumDuration'],'sumHoldTime':_0xa72618[_0x24b0('0x24')]||0x0,'talking':_0xa72618[_0x24b0('0x25')],'total':_0xa72618[_0x24b0('0x26')],'type':_0xa72618[_0x24b0('0x27')],'unmanaged':_0xa72618[_0x24b0('0x28')],'abandoned':_0xa72618[_0x24b0('0x29')],'waiting':_0xa72618[_0x24b0('0x2a')],'loggedInDb':_0xa72618[_0x24b0('0x2b')]};if(_0xa72618[_0x24b0('0x27')]==='outbound'){_0x2c3908['dialActive']=_0xa72618['dialActive'];_0x2c3908[_0x24b0('0x2c')]=_0xa72618[_0x24b0('0x2c')];_0x2c3908[_0x24b0('0x2d')]=_0xa72618[_0x24b0('0x2d')];_0x2c3908[_0x24b0('0x2e')]=_0xa72618[_0x24b0('0x2e')];_0x2c3908[_0x24b0('0x2f')]=_0xa72618['dialOriginateTimeout'];_0x2c3908[_0x24b0('0x30')]=_0xa72618[_0x24b0('0x30')];_0x2c3908[_0x24b0('0x31')]=_0xa72618[_0x24b0('0x31')];_0x2c3908['outboundAnswerCallsDay']=_0xa72618[_0x24b0('0x32')];_0x2c3908[_0x24b0('0x33')]=_0xa72618[_0x24b0('0x33')];_0x2c3908[_0x24b0('0x34')]=_0xa72618[_0x24b0('0x34')];_0x2c3908['outboundCongestionCallsDay']=_0xa72618['outboundCongestionCallsDay'];_0x2c3908[_0x24b0('0x35')]=_0xa72618[_0x24b0('0x35')];_0x2c3908[_0x24b0('0x36')]=_0xa72618[_0x24b0('0x36')];_0x2c3908[_0x24b0('0x37')]=_0xa72618['outboundDropCallsDayTimeout'];_0x2c3908['outboundNoAnswerCallsDay']=_0xa72618[_0x24b0('0x38')];_0x2c3908[_0x24b0('0x39')]=_0xa72618[_0x24b0('0x39')];_0x2c3908[_0x24b0('0x3a')]=_0xa72618[_0x24b0('0x3a')];_0x2c3908[_0x24b0('0x3b')]=_0xa72618['outboundReCallsDay'];_0x2c3908[_0x24b0('0x3c')]=_0xa72618[_0x24b0('0x3c')];_0x2c3908['outboundUnknownCallsDay']=_0xa72618['outboundUnknownCallsDay'];_0x2c3908[_0x24b0('0x3d')]=_0xa72618['predictiveIntervalAnsweredCalls'];_0x2c3908['predictiveIntervalAvgHoldtime']=_0xa72618[_0x24b0('0x3e')];_0x2c3908[_0x24b0('0x3f')]=_0xa72618['predictiveIntervalAvgTalktime'];_0x2c3908[_0x24b0('0x40')]=_0xa72618['predictiveIntervalDroppedCallsCallersExit'];_0x2c3908['predictiveIntervalDroppedCallsTimeout']=_0xa72618[_0x24b0('0x41')];_0x2c3908[_0x24b0('0x42')]=_0xa72618[_0x24b0('0x42')];_0x2c3908[_0x24b0('0x43')]=_0xa72618[_0x24b0('0x43')];_0x2c3908[_0x24b0('0x44')]=_0xa72618[_0x24b0('0x44')];_0x2c3908[_0x24b0('0x45')]=_0xa72618[_0x24b0('0x45')];_0x2c3908[_0x24b0('0x46')]=_0xa72618[_0x24b0('0x46')];_0x2c3908[_0x24b0('0x47')]=_0xa72618['predictiveIntervalAvailable'];_0x2c3908['predictiveIntervalTotalCalls']=_0xa72618['predictiveIntervalTotalCalls'];_0x2c3908['message']=_0xa72618[_0x24b0('0x19')];_0x2c3908[_0x24b0('0x48')]=_0xa72618[_0x24b0('0x48')];_0x2c3908[_0x24b0('0x49')]=_0xa72618[_0x24b0('0x49')];_0x2c3908[_0x24b0('0x4a')]=_0xa72618[_0x24b0('0x4a')];_0x2c3908[_0x24b0('0x4b')]=_0xa72618[_0x24b0('0x4b')];_0x2c3908['erlangBusyFactor']=_0xa72618['erlangBusyFactor'];_0x2c3908['startPredictive']=_0xa72618[_0x24b0('0x4c')];_0x2c3908[_0x24b0('0x4d')]=_0xa72618[_0x24b0('0x4d')];}if(_0xa72618[_0x24b0('0x4e')]){_0x2c3908[_0x24b0('0x4e')]={'id':_0xa72618[_0x24b0('0x4e')]['id'],'name':_0xa72618[_0x24b0('0x4e')]['name'],'active':_0xa72618[_0x24b0('0x4e')][_0x24b0('0x4f')],'callerid':_0xa72618[_0x24b0('0x4e')][_0x24b0('0x50')]};}if(_0xa72618[_0x24b0('0x51')]){_0x2c3908[_0x24b0('0x51')]={'id':_0xa72618[_0x24b0('0x51')]['id'],'name':_0xa72618['Interval']['name']};}_0x2b9a69[_0x24b0('0x52')](_0x2c3908);}}_0x28752e({'count':_0x2b9a69[_0x24b0('0x53')],'rows':_0x2b9a69});});},'VoiceChannels':function(_0x547aba){return new Promise(function(_0x578354,_0x8dc744){var _0x3d91cc=_[_0x24b0('0x54')](_0x538244[_0x24b0('0x55')]);_0x578354({'count':_0x3d91cc[_0x24b0('0x53')],'rows':_0x3d91cc});});},'VoiceChannelMixMonitor':function(_0x17c006){var _0x51d124=this;return new Promise(function(_0x27980f,_0x5ac56e){if(ami['isConnected']()==![]){return _0x5ac56e(_0x51d124['error'](0x1f4,[config[_0x24b0('0x10')]['ip'],config['asterisk'][_0x24b0('0x11')],'ami\x20disconnected'][_0x24b0('0x13')]('\x20')));}var _0x162978=schema(properties[_0x24b0('0x56')])[_0x24b0('0x2')](_0x17c006);if(_0x162978[_0x24b0('0x53')]>0x0){return _0x5ac56e(_0x51d124[_0x24b0('0xf')](0x1f4,_[_0x24b0('0x57')](_0x162978,'message')['join'](',\x20')));}var _0x24f17c=_[_0x24b0('0x58')](_0x538244['channels'],{'uniqueid':_0x17c006[_0x24b0('0x59')]});if(_0x24f17c&&_0x24f17c[_0x24b0('0x5a')]){var _0x42c064=util[_0x24b0('0x5')]('%s.%s',_0x17c006[_0x24b0('0x5b')]||_0x17c006[_0x24b0('0x59')],_0x17c006[_0x24b0('0x5')]||'wav');return ami[_0x24b0('0x18')]({'action':'MixMonitor','channel':_0x24f17c[_0x24b0('0x5a')],'file':_0x42c064,'options':_0x24b0('0x5c')})[_0x24b0('0x5d')](function(_0x32f7bb){var _0x2364cf=_[_0x24b0('0x58')](_0x24f17c['monitors'],{'filename':_0x24b0('0x5e')+_0x42c064[_0x24b0('0x5f')]()});if(_[_0x24b0('0x60')](_0x2364cf)){_0x24f17c['monitors'][_0x24b0('0x52')]({'filename':_0x24b0('0x5e')+_0x42c064[_0x24b0('0x5f')](),'createdAt':moment()[_0x24b0('0x5')](_0x24b0('0x61')),'mixmonitorid':_0x32f7bb[_0x24b0('0x62')],'status':'rec'});}else{_0x2364cf[_0x24b0('0x62')]=_0x32f7bb[_0x24b0('0x62')];_0x2364cf['status']=_0x24b0('0x63');}_0x27980f({'code':0xc8,'message':[_0x17c006[_0x24b0('0x59')],'MixMonitor\x20Success',_0x32f7bb[_0x24b0('0x62')]][_0x24b0('0x13')]('\x20'),'mixmonitorid':_0x32f7bb[_0x24b0('0x62')]});})[_0x24b0('0x1a')](function(_0x36762d){_0x5ac56e(_0x51d124['error'](0x1f5,[_0x17c006[_0x24b0('0x59')],_0x36762d[_0x24b0('0x19')][_0x24b0('0x5f')]()][_0x24b0('0x13')]('\x20')));});}else{return _0x5ac56e(_0x51d124[_0x24b0('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0xd3f8ed){var _0xb93ca=this;return new Promise(function(_0x2133cd,_0x495851){if(ami[_0x24b0('0xe')]()==![]){return _0x495851(_0xb93ca[_0x24b0('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x24b0('0x10')][_0x24b0('0x11')],'ami\x20disconnected'][_0x24b0('0x13')]('\x20')));}var _0x3014c3=schema(properties['voicechannel'])[_0x24b0('0x2')](_0xd3f8ed);if(_0x3014c3['length']>0x0){return _0x495851(_0xb93ca[_0x24b0('0xf')](0x1f4,_[_0x24b0('0x57')](_0x3014c3,'message')[_0x24b0('0x13')](',\x20')));}var _0x3e3eaa=_['find'](_0x538244[_0x24b0('0x55')],{'uniqueid':_0xd3f8ed['uniqueid']});if(_0x3e3eaa){return BPromise[_0x24b0('0x64')]()['then'](function(){if(_0x3e3eaa['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x3e3eaa[_0x24b0('0x5a')],'mixmonitorid':_0xd3f8ed[_0x24b0('0x62')]})[_0x24b0('0x1a')](function(_0x4c983b){});}})[_0x24b0('0x5d')](function(){if(_0x3e3eaa[_0x24b0('0x65')]){return ami['Action']({'action':_0x24b0('0x66'),'channel':_0x3e3eaa['destinationchannel'],'mixmonitorid':_0xd3f8ed[_0x24b0('0x62')]})['catch'](function(_0x4665eb){});}})['then'](function(_0x3ef399){var _0x484421=_['find'](_0x3e3eaa[_0x24b0('0x67')],{'mixmonitorid':_0xd3f8ed[_0x24b0('0x62')]});if(_0x484421){_0x484421[_0x24b0('0x68')]='stop';}})[_0x24b0('0x5d')](function(){var _0xd1349=util['format'](_0x24b0('0x69'),_0xd3f8ed[_0x24b0('0x5b')]||_0xd3f8ed[_0x24b0('0x59')],_0xd3f8ed[_0x24b0('0x5')]||'wav');var _0x3a1c27=_['find'](_0x3e3eaa[_0x24b0('0x67')],{'filename':_0x24b0('0x5e')+_0xd1349[_0x24b0('0x5f')]()});if(_0x3a1c27){_0x3a1c27[_0x24b0('0x68')]='stop';}})[_0x24b0('0x5d')](function(){_0x2133cd({'code':0xc8,'message':[_0xd3f8ed[_0x24b0('0x59')],_0x24b0('0x6a')]['join']('\x20')});})['catch'](function(_0x146774){_0x495851(_0xb93ca[_0x24b0('0xf')](0x1f5,[_0xd3f8ed[_0x24b0('0x59')],_0x146774[_0x24b0('0x19')][_0x24b0('0x5f')]()][_0x24b0('0x13')]('\x20')));});}else{return _0x495851(_0xb93ca[_0x24b0('0xf')](0x1f5,_0x24b0('0x6b')));}});},'VoiceQueuesChannels':function(_0x1063a1){return new Promise(function(_0x467615,_0x4faa58){var _0x492192=_[_0x24b0('0x54')](_0x538244[_0x24b0('0x6c')]);_0x467615({'count':_0x492192[_0x24b0('0x53')],'rows':_0x492192});});},'VoiceQueuesChannel':function(_0x23e548){var _0x2da245=this;return new Promise(function(_0x2e8371,_0x3ef4b5){var _0x3988b9=schema(properties[_0x24b0('0x6d')])[_0x24b0('0x2')](_0x23e548);if(_0x3988b9[_0x24b0('0x53')]>0x0){return _0x3ef4b5(_0x2da245[_0x24b0('0xf')](0x1f4,_['map'](_0x3988b9,_0x24b0('0x19'))[_0x24b0('0x13')](',\x20')));}var _0x44016a=_['find'](_0x538244[_0x24b0('0x6c')],{'uniqueid':_0x23e548[_0x24b0('0x59')]});if(_0x44016a){_0x2e8371(_0x44016a);}else{return _0x3ef4b5(_0x2da245['error'](0x1f5,_0x24b0('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x10d2e2){var _0x5fd6c4=this;return new Promise(function(_0xd77d43,_0x1a6011){if(ami[_0x24b0('0xe')]()==![]){return _0x1a6011(_0x5fd6c4[_0x24b0('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x24b0('0x13')]('\x20')));}var _0x501bee=schema(properties[_0x24b0('0x6e')])['validate'](_0x10d2e2);if(_0x501bee[_0x24b0('0x53')]>0x0){return _0x1a6011(_0x5fd6c4[_0x24b0('0xf')](0x1f4,_[_0x24b0('0x57')](_0x501bee,_0x24b0('0x19'))[_0x24b0('0x13')](',\x20')));}var _0x467645=_['find'](_0x538244[_0x24b0('0x6c')],{'uniqueid':_0x10d2e2['uniqueid']});if(_0x467645&&_0x467645[_0x24b0('0x5a')]){return ami['Action']({'action':'Hangup','channel':_0x467645[_0x24b0('0x5a')]})[_0x24b0('0x5d')](function(_0x5ada68){_0xd77d43({'code':0xc8,'message':[_0x10d2e2[_0x24b0('0x59')],_0x5ada68[_0x24b0('0x19')][_0x24b0('0x5f')]()]['join']('\x20')});})[_0x24b0('0x1a')](function(_0x500398){_0x1a6011(_0x5fd6c4['error'](0x1f5,[_0x10d2e2['uniqueid'],_0x500398[_0x24b0('0x19')][_0x24b0('0x5f')]()][_0x24b0('0x13')]('\x20')));});}else{return _0x1a6011(_0x5fd6c4[_0x24b0('0xf')](0x1f5,_0x24b0('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x350c5e){var _0x26ca7e=this;return new Promise(function(_0x332d31,_0x2a00c8){if(ami['isConnected']()==![]){return _0x2a00c8(_0x26ca7e[_0x24b0('0xf')](0x1f4,[config[_0x24b0('0x10')]['ip'],config[_0x24b0('0x10')][_0x24b0('0x11')],_0x24b0('0x12')]['join']('\x20')));}var _0x3a5f1f=schema(properties[_0x24b0('0x6f')])[_0x24b0('0x2')](_0x350c5e);if(_0x3a5f1f[_0x24b0('0x53')]>0x0){return _0x2a00c8(_0x26ca7e[_0x24b0('0xf')](0x1f4,_[_0x24b0('0x57')](_0x3a5f1f,'message')[_0x24b0('0x13')](',\x20')));}var _0x300226=_[_0x24b0('0x58')](_0x538244['queueChannels'],{'uniqueid':_0x350c5e['uniqueid']});if(_0x300226&&_0x300226['channel']){return ami['Action']({'action':'Redirect','channel':_0x300226[_0x24b0('0x5a')],'exten':_0x350c5e[_0x24b0('0x70')],'context':_0x350c5e[_0x24b0('0x71')]||_0x300226[_0x24b0('0x71')],'priority':0x1})[_0x24b0('0x5d')](function(_0x4b9e1b){_0x332d31({'code':0xc8,'message':[_0x350c5e[_0x24b0('0x59')],_0x4b9e1b[_0x24b0('0x19')]['toLowerCase']()]['join']('\x20')});})[_0x24b0('0x1a')](function(_0x4fb5e3){_0x2a00c8(_0x26ca7e[_0x24b0('0xf')](0x1f5,[_0x350c5e[_0x24b0('0x59')],_0x4fb5e3['message'][_0x24b0('0x5f')]()][_0x24b0('0x13')]('\x20')));});}else{return _0x2a00c8(_0x26ca7e['error'](0x1f5,_0x24b0('0x6b')));}});},'Agents':function(_0x557e9){return new Promise(function(_0x54246e,_0x378586){var _0x97e457=_[_0x24b0('0x54')](_0x538244[_0x24b0('0xa')]);_0x54246e({'count':_0x97e457[_0x24b0('0x53')],'rows':_0x97e457});});},'Telephones':function(_0x4fb8f0){return new Promise(function(_0x59c287,_0x208b8b){var _0x1ac102=_['values'](_0x538244[_0x24b0('0x72')]);_0x59c287({'count':_0x1ac102[_0x24b0('0x53')],'rows':_0x1ac102});});},'Trunks':function(_0x15ab8e){return new Promise(function(_0x1e2b60,_0xf6ec8c){var _0x203f8a=_[_0x24b0('0x54')](_0x538244[_0x24b0('0x73')]);_0x1e2b60({'count':_0x203f8a[_0x24b0('0x53')],'rows':_0x203f8a});});},'OutboundChannels':function(_0xae9c6a){return new Promise(function(_0x3bdf9b,_0x2b6e47){var _0x1eeb63=_['values'](_0x538244['outboundChannels']);_0x3bdf9b({'count':_0x1eeb63[_0x24b0('0x53')],'rows':_0x1eeb63});});},'Outbound':function(_0x292271){return new Promise(function(_0x2dd540,_0x5682a6){_0x2dd540(_0x538244[_0x24b0('0x74')]);});},'Campaigns':function(_0x289637){return new Promise(function(_0x577f28,_0x31bba5){var _0x2427af=_[_0x24b0('0x54')](_0x538244[_0x24b0('0x75')]);_0x577f28({'count':_0x2427af['length'],'rows':_0x2427af});});},'VoiceQueuesPreview':function(_0x3af976){var _0x3b1d27=this;return new Promise(function(_0x18a8fb,_0x5dd757){_0x2cf43d[_0x24b0('0x76')](_0x3af976['id'])[_0x24b0('0x5d')](function(_0x55b994){_0x18a8fb({'code':0xc8,'message':_0x55b994[_0x24b0('0x19')]});})[_0x24b0('0x1a')](function(_0xc00024){_0x5dd757(_0x3b1d27[_0x24b0('0xf')](0x1f4,_0xc00024[_0x24b0('0x19')]));});});},'EventManager':function(_0x484dc7){var _0x1020af=this;return new Promise(function(_0x4da6ff,_0x4a2ee5){if(!_0x484dc7['event']){return _0x4a2ee5(_0x1020af['error'](0x1f4,_0x24b0('0x77')));}ami[_0x24b0('0x78')]('custom:'+_0x484dc7[_0x24b0('0x79')],_0x484dc7[_0x24b0('0x19')]);_0x4da6ff({'code':0xc8,'message':_0x484dc7});});},'FaxAccounts':function(_0x367320){return new Promise(function(_0xe758a5,_0x1b94e3){var _0x5a49a9=_[_0x24b0('0x54')](_0x538244[_0x24b0('0x7a')]);_0xe758a5({'count':_0x5a49a9[_0x24b0('0x53')],'rows':_0x5a49a9});});},'SendFax':function(_0x29b34f){var _0x21652e=this;return new Promise(function(_0x4b1925,_0x378f55){_0x76d874['send'](_0x29b34f)['then'](function(_0x5a9347){_0x4b1925({'code':0xc8,'message':_0x5a9347[_0x24b0('0x19')]});})[_0x24b0('0x1a')](function(_0x3268f9){_0x378f55(_0x21652e[_0x24b0('0xf')](0x1f4,_0x3268f9[_0x24b0('0x19')]));});});},'CheckAfterSend':function(_0x2324fc){var _0x528c96=this;return new Promise(function(_0x5ef097,_0x207118){_0x76d874['checkAfterSend'](_0x2324fc)[_0x24b0('0x5d')](function(_0x25022c){_0x5ef097({'code':0xc8,'message':_0x25022c[_0x24b0('0x19')]});})[_0x24b0('0x1a')](function(_0x2c3ee2){_0x207118(_0x528c96['error'](0x1f4,_0x2c3ee2[_0x24b0('0x19')]));});});}};var _0x3a1275=jayson[_0x24b0('0x7b')](_0x2904b2)['http']();_0x3a1275['on'](_0x24b0('0xf'),function(_0x3fe4ac){return _0x3aef40(_0x3fe4ac);});_0x3a1275[_0x24b0('0x7c')](0x232a,_0x24b0('0x7d'),function(){console[_0x24b0('0x7e')](_0x24b0('0x7f'),0x232a);return _0x3da253(_0x24b0('0x80')+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 f7e7988..9d331d8 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 _0xe742=['user:%s','name','trigger:%s','action','merge','info','createContact','[%s][%s]\x20Contact\x20created:%s','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','toLowerCase','lodash','ioredis','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xe742,0x14d));var _0x2e74=function(_0x3f65b8,_0x2290e4){_0x3f65b8=_0x3f65b8-0x0;var _0x48567e=_0xe742[_0x3f65b8];return _0x48567e;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x2e74('0x0'));var Redis=require(_0x2e74('0x1'));var config=require('../../../../config/environment');var logger=require(_0x2e74('0x2'))('trigger');var cmContactRpc=require(_0x2e74('0x3'));config['redis']=_['defaults'](config[_0x2e74('0x4')],{'host':_0x2e74('0x5'),'port':0x18eb});var io=require(_0x2e74('0x6'))(new Redis(config[_0x2e74('0x4')]));function emit(_0x429140,_0x275bf2,_0x49e2e5,_0x2d20ea){logger['info'](_0x2e74('0x7'),_0x429140,'',_0x275bf2,_0x49e2e5,JSON[_0x2e74('0x8')](_0x2d20ea));io['to'](_0x275bf2)[_0x2e74('0x9')](_0x49e2e5,_0x2d20ea);}exports[_0x2e74('0xa')]=function(_0x59ec93,_0x574c84,_0x503ec0){_0x503ec0[_0x2e74('0xb')]=0x0;if(_0x574c84[_0x2e74('0xc')]&&parseInt(_0x574c84[_0x2e74('0xc')],0xa)){var _0x55b855={'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa),'phone':_0x503ec0['calleridnum']};if(_['isNil'](_0x503ec0['routeId'])){_0x55b855[_0x2e74('0xe')]=_0x503ec0[_0x2e74('0xf')]&&_0x503ec0[_0x2e74('0xf')]!==_0x2e74('0x10')?_0x503ec0[_0x2e74('0xf')]:_0x503ec0['calleridnum']||_0x503ec0[_0x2e74('0x11')];}else{_0x55b855['firstName']=_0x503ec0['destcalleridname']&&_0x503ec0['destcalleridname']!==''?_0x503ec0[_0x2e74('0x12')]:_0x503ec0[_0x2e74('0x13')]||_0x503ec0[_0x2e74('0x11')];_0x55b855[_0x2e74('0x14')]=_0x503ec0[_0x2e74('0x12')]&&_0x503ec0[_0x2e74('0x12')]!==''?_0x503ec0[_0x2e74('0x12')]:_0x503ec0[_0x2e74('0x13')]||_0x503ec0[_0x2e74('0x11')];}BPromise[_0x2e74('0x15')]()[_0x2e74('0x16')](cmContactRpc[_0x2e74('0x17')]({'where':_['omit'](_0x55b855,['firstName'])}))[_0x2e74('0x16')](function(_0x201e5b){if(_0x201e5b){logger['info'](_0x2e74('0x18'),_0x503ec0['uniqueid'],'',_0x201e5b['id']);if(_0x59ec93){_0x503ec0[_0x2e74('0x19')]=_0x201e5b['id'];emit(_0x503ec0[_0x2e74('0x11')],util[_0x2e74('0x1a')](_0x2e74('0x1b'),_0x59ec93[_0x2e74('0x1c')]),util[_0x2e74('0x1a')](_0x2e74('0x1d'),_0x574c84[_0x2e74('0x1e')]['toLowerCase']()),_[_0x2e74('0x1f')](_0x503ec0,{'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa)}));}return;}else{logger[_0x2e74('0x20')]('[%s][%s]\x20Contact\x20not\x20found',_0x503ec0[_0x2e74('0x11')],'');return BPromise['resolve']()[_0x2e74('0x16')](cmContactRpc[_0x2e74('0x21')](_0x55b855));}})[_0x2e74('0x16')](function(_0x12a377){if(_0x12a377){logger[_0x2e74('0x20')](_0x2e74('0x22'),_0x503ec0[_0x2e74('0x11')],'',_0x12a377['id']);if(_0x59ec93){_0x503ec0[_0x2e74('0x19')]=_0x12a377['id'];emit(_0x503ec0['uniqueid'],util[_0x2e74('0x1a')](_0x2e74('0x1b'),_0x59ec93[_0x2e74('0x1c')]),util[_0x2e74('0x1a')](_0x2e74('0x1d'),_0x574c84[_0x2e74('0x1e')]['toLowerCase']()),_[_0x2e74('0x1f')](_0x503ec0,{'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa)}));}}})[_0x2e74('0x23')](function(_0x210ab4){logger[_0x2e74('0x24')](_0x2e74('0x25'),_0x503ec0[_0x2e74('0x11')],'',JSON[_0x2e74('0x8')](_0x210ab4));});}else{if(_0x59ec93){logger[_0x2e74('0x20')](_0x2e74('0x26'),_0x503ec0[_0x2e74('0x11')],'');emit(_0x503ec0[_0x2e74('0x11')],util[_0x2e74('0x1a')](_0x2e74('0x1b'),_0x59ec93[_0x2e74('0x1c')]),util['format'](_0x2e74('0x1d'),_0x574c84[_0x2e74('0x1e')][_0x2e74('0x27')]()),_[_0x2e74('0x1f')]({'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa)},_0x503ec0));}}}; \ No newline at end of file +var _0xe2ab=['[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','catch','error','[%s][%s]\x20Error\x20creating\x20contact','stringify','[%s][%s]\x20Autocreate\x20disabled','action','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','emit','exec','autoCreate','data2','isNil','routeId','firstName','calleridname','calleridnum','uniqueid','destcalleridname','','destcalleridnum','phone','resolve','showContact','omit','[%s][%s]\x20Contact\x20found:%s','user:%s','name','format','trigger:%s','toLowerCase','merge','data1','[%s][%s]\x20Contact\x20not\x20found','then','createContact'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x46a9f2,_0x63d490){_0x46a9f2=_0x46a9f2-0x0;var _0x23117e=_0xe2ab[_0x46a9f2];return _0x23117e;};'use strict';var BPromise=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var _=require(_0xbe2a('0x2'));var Redis=require(_0xbe2a('0x3'));var config=require(_0xbe2a('0x4'));var logger=require(_0xbe2a('0x5'))('trigger');var cmContactRpc=require(_0xbe2a('0x6'));config[_0xbe2a('0x7')]=_[_0xbe2a('0x8')](config[_0xbe2a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xbe2a('0x9'))(new Redis(config['redis']));function emit(_0x2f504b,_0x58b8f1,_0x5a8a5d,_0xfccbff){logger[_0xbe2a('0xa')]('[%s][%s]',_0x2f504b,'',_0x58b8f1,_0x5a8a5d,JSON['stringify'](_0xfccbff));io['to'](_0x58b8f1)[_0xbe2a('0xb')](_0x5a8a5d,_0xfccbff);}exports[_0xbe2a('0xc')]=function(_0x5a3887,_0x21d1d9,_0x5be9f1){_0x5be9f1[_0xbe2a('0xd')]=0x0;if(_0x21d1d9[_0xbe2a('0xe')]&&parseInt(_0x21d1d9[_0xbe2a('0xe')],0xa)){var _0x51fc99={'ListId':parseInt(_0x21d1d9['data1'],0xa),'phone':_0x5be9f1['calleridnum']};if(_[_0xbe2a('0xf')](_0x5be9f1[_0xbe2a('0x10')])){_0x51fc99[_0xbe2a('0x11')]=_0x5be9f1[_0xbe2a('0x12')]&&_0x5be9f1[_0xbe2a('0x12')]!==''?_0x5be9f1[_0xbe2a('0x12')]:_0x5be9f1[_0xbe2a('0x13')]||_0x5be9f1[_0xbe2a('0x14')];}else{_0x51fc99['firstName']=_0x5be9f1[_0xbe2a('0x15')]&&_0x5be9f1[_0xbe2a('0x15')]!==_0xbe2a('0x16')?_0x5be9f1[_0xbe2a('0x15')]:_0x5be9f1[_0xbe2a('0x17')]||_0x5be9f1[_0xbe2a('0x14')];_0x51fc99[_0xbe2a('0x18')]=_0x5be9f1[_0xbe2a('0x15')]&&_0x5be9f1[_0xbe2a('0x15')]!==''?_0x5be9f1[_0xbe2a('0x15')]:_0x5be9f1[_0xbe2a('0x17')]||_0x5be9f1[_0xbe2a('0x14')];}BPromise[_0xbe2a('0x19')]()['then'](cmContactRpc[_0xbe2a('0x1a')]({'where':_[_0xbe2a('0x1b')](_0x51fc99,['firstName'])}))['then'](function(_0x8a6d25){if(_0x8a6d25){logger['info'](_0xbe2a('0x1c'),_0x5be9f1[_0xbe2a('0x14')],'',_0x8a6d25['id']);if(_0x5a3887){_0x5be9f1['xmd-contactid2']=_0x8a6d25['id'];emit(_0x5be9f1[_0xbe2a('0x14')],util['format'](_0xbe2a('0x1d'),_0x5a3887[_0xbe2a('0x1e')]),util[_0xbe2a('0x1f')](_0xbe2a('0x20'),_0x21d1d9['action'][_0xbe2a('0x21')]()),_[_0xbe2a('0x22')](_0x5be9f1,{'ListId':parseInt(_0x21d1d9[_0xbe2a('0x23')],0xa)}));}return;}else{logger['info'](_0xbe2a('0x24'),_0x5be9f1[_0xbe2a('0x14')],'');return BPromise[_0xbe2a('0x19')]()[_0xbe2a('0x25')](cmContactRpc[_0xbe2a('0x26')](_0x51fc99));}})['then'](function(_0x4e61dd){if(_0x4e61dd){logger[_0xbe2a('0xa')](_0xbe2a('0x27'),_0x5be9f1[_0xbe2a('0x14')],'',_0x4e61dd['id']);if(_0x5a3887){_0x5be9f1[_0xbe2a('0x28')]=_0x4e61dd['id'];emit(_0x5be9f1['uniqueid'],util[_0xbe2a('0x1f')]('user:%s',_0x5a3887[_0xbe2a('0x1e')]),util['format'](_0xbe2a('0x20'),_0x21d1d9['action'][_0xbe2a('0x21')]()),_[_0xbe2a('0x22')](_0x5be9f1,{'ListId':parseInt(_0x21d1d9[_0xbe2a('0x23')],0xa)}));}}})[_0xbe2a('0x29')](function(_0x8ea2be){logger[_0xbe2a('0x2a')](_0xbe2a('0x2b'),_0x5be9f1[_0xbe2a('0x14')],'',JSON[_0xbe2a('0x2c')](_0x8ea2be));});}else{if(_0x5a3887){logger['info'](_0xbe2a('0x2d'),_0x5be9f1['uniqueid'],'');emit(_0x5be9f1[_0xbe2a('0x14')],util[_0xbe2a('0x1f')](_0xbe2a('0x1d'),_0x5a3887[_0xbe2a('0x1e')]),util['format'](_0xbe2a('0x20'),_0x21d1d9[_0xbe2a('0x2e')][_0xbe2a('0x21')]()),_[_0xbe2a('0x22')]({'ListId':parseInt(_0x21d1d9[_0xbe2a('0x23')],0xa)},_0x5be9f1));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fc5db3d..24a8f3f 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 _0xb5e1=['uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','render','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','exec','voiceExtensions','urlforward','parse','query','replace','every','AllConditions','checkConditions','channel','AnyConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','routeId','exports','util','lodash','url','mustache','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','interface','checkTriggers','checkTrigger','merge','variables','Actions','action','toLowerCase','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0xb5e1,0x18f));var _0x1b5e=function(_0x2b4092,_0x198034){_0x2b4092=_0x2b4092-0x0;var _0x481aad=_0xb5e1[_0x2b4092];return _0x481aad;};'use strict';var util=require(_0x1b5e('0x0'));var _=require(_0x1b5e('0x1'));var url=require(_0x1b5e('0x2'));var Mustache=require(_0x1b5e('0x3'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x1b5e('0x4'));var cmContact=require(_0x1b5e('0x5'));var script=require(_0x1b5e('0x6'));var cmContactRpc=require(_0x1b5e('0x7'));var config=require(_0x1b5e('0x8'));var logger=require('../../../config/logger')(_0x1b5e('0x9'));var ami=require('../ami');config[_0x1b5e('0xa')]=_[_0x1b5e('0xb')](config[_0x1b5e('0xa')],{'host':_0x1b5e('0xc'),'port':0x18eb});var io=require(_0x1b5e('0xd'))(new Redis(config[_0x1b5e('0xa')]));var operators={'equals':function(_0x305c0d,_0x194074){return _0x305c0d==_0x194074;},'not_equals':function(_0x5d4ea5,_0x4b9b53){return _0x5d4ea5!=_0x4b9b53;}};var barAndWebActions=[_0x1b5e('0xe'),_0x1b5e('0x2'),'winapp'];function Trigger(_0x592ae4){this[_0x1b5e('0xf')]=_0x592ae4['triggers'];this[_0x1b5e('0x10')]=_0x592ae4[_0x1b5e('0x10')];this[_0x1b5e('0x11')]=_0x592ae4['voiceQueues'];this[_0x1b5e('0x12')]=_0x592ae4[_0x1b5e('0x12')];this['voiceExtensions']=_0x592ae4['voiceExtensions'];this[_0x1b5e('0x13')]=_0x592ae4[_0x1b5e('0x13')];this[_0x1b5e('0x14')]=_0x592ae4['freshdeskAccounts'];this['salesforceAccounts']=_0x592ae4[_0x1b5e('0x15')];this[_0x1b5e('0x16')]=_0x592ae4[_0x1b5e('0x16')];this[_0x1b5e('0x17')]=_0x592ae4['zohoAccounts'];this['deskAccounts']=_0x592ae4[_0x1b5e('0x18')];this[_0x1b5e('0x19')]=_0x592ae4[_0x1b5e('0x19')];this[_0x1b5e('0x1a')]=_0x592ae4[_0x1b5e('0x1a')];this['dynamics365Accounts']=_0x592ae4[_0x1b5e('0x1b')];this[_0x1b5e('0x1c')]=_0x592ae4[_0x1b5e('0x1c')];this[_0x1b5e('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x1b5e('0x14')],'sugarcrm':this[_0x1b5e('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x1b5e('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x1b5e('0x1c')],'servicenow':this[_0x1b5e('0x1a')]};ami['on']('custom:agentcalled',this[_0x1b5e('0x1e')]['bind'](this));ami['on'](_0x1b5e('0x1f'),this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x21'),this[_0x1b5e('0x1e')]['bind'](this));ami['on'](_0x1b5e('0x22'),this['syncCustomEvent'][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x23'),this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x24'),this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x25'),this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x26'),this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x27'),this[_0x1b5e('0x1e')]['bind'](this));ami['on'](_0x1b5e('0x28'),this[_0x1b5e('0x1e')]['bind'](this));ami['on'](_0x1b5e('0x29'),this[_0x1b5e('0x2a')][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x2b'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0x1b5e('0x2a')]['bind'](this));ami['on'](_0x1b5e('0x2c'),this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on']('custom:closedinteraction',this[_0x1b5e('0x1e')][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x2d'),this['syncCustomEvent'][_0x1b5e('0x20')](this));ami['on']('custom:outgoingmessage',this[_0x1b5e('0x1e')]['bind'](this));ami['on'](_0x1b5e('0x2e'),this['syncCustomEvent'][_0x1b5e('0x20')](this));ami['on'](_0x1b5e('0x2f'),this[_0x1b5e('0x1e')]['bind'](this));}Trigger[_0x1b5e('0x30')][_0x1b5e('0x31')]=function(_0x49e398,_0x29eda7,_0xd990a){logger[_0x1b5e('0x32')](_0x49e398,_0x29eda7,JSON[_0x1b5e('0x33')](_0xd990a));io['to'](_0x49e398)['emit'](_0x29eda7,_0xd990a);};Trigger['prototype']['syncCustomEvent']=function(_0x428c5c){var _0x1b9c50=_[_0x1b5e('0x34')](_0x428c5c);this['checkTriggers'](_0x1b9c50);};Trigger[_0x1b5e('0x30')][_0x1b5e('0x2a')]=function(_0x929553){if(this[_0x1b5e('0x10')][_0x929553[_0x1b5e('0x35')]]){this[_0x1b5e('0x1e')](_0x929553);}};Trigger['prototype'][_0x1b5e('0x36')]=function(_0x1cb0e5){var _0x260997;for(var _0x5be72d in this[_0x1b5e('0xf')]){if(this[_0x1b5e('0xf')]['hasOwnProperty'](_0x5be72d)){if(this[_0x1b5e('0xf')][_0x5be72d]['status']){_0x260997=this[_0x1b5e('0x37')](this['triggers'][_0x5be72d],_0x1cb0e5);if(_0x260997){_[_0x1b5e('0x38')](_0x1cb0e5,_0x1cb0e5[_0x1b5e('0x39')]);for(var _0x293172=0x0,_0x1c9e94,_0xfe1765,_0x2204c3;_0x2931720x0){_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(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 f8e44f8..52ab59b 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 _0x6288=['emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','request-promise','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','remoteUri','username','password','then','access_token','catch','error','toUpperCase','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s'];(function(_0x4d7e96,_0x2900c7){var _0x206646=function(_0x44be66){while(--_0x44be66){_0x4d7e96['push'](_0x4d7e96['shift']());}};_0x206646(++_0x2900c7);}(_0x6288,0x1dc));var _0x8628=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x6288[_0x48b5e0];return _0x4287ea;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x8628('0x0'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x8628('0x1'));var logger=require('../../../../config/logger')(_0x8628('0x2'));var config=require(_0x8628('0x3'));config[_0x8628('0x4')]=_[_0x8628('0x5')](config[_0x8628('0x4')],{'host':_0x8628('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x4566a5,_0x194926,_0x213cee){var _0x4d189b={'method':_0x8628('0x7'),'uri':_0x194926,'form':{'client_id':_0x4566a5['clientId'],'resource':_0x4566a5[_0x8628('0x8')],'username':_0x4566a5[_0x8628('0x9')],'password':_0x4566a5[_0x8628('0xa')],'grant_type':_0x8628('0xa'),'client_secret':_0x4566a5['clientSecret']},'json':!![]};return rp(_0x4d189b)[_0x8628('0xb')](function(_0x43a5a9){return _0x43a5a9[_0x8628('0xc')];})[_0x8628('0xd')](function(_0x1fe1b9){logger[_0x8628('0xe')]('['+[_0x213cee[_0x8628('0xf')]()]+']\x20Wrong\x20credentials!');return _0x1fe1b9['message'];});}function getUser(_0x7965b,_0x1ce4b4,_0x3bec81,_0x47e9ab,_0x4e4b19,_0x42ce89){return new BPromise(function(_0x150401,_0xa8d8d2){return getAuthToken(_0x1ce4b4,_0x47e9ab,_0x42ce89)['then'](function(_0x314603){var _0x4ede9b={'method':'GET','uri':_0x4e4b19+_0x8628('0x10'),'headers':{'Authorization':_0x8628('0x11')+_0x314603,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ede9b);})[_0x8628('0xb')](function(_0x21a4ae){var _0x16b1d7=_0x21a4ae[_0x8628('0x12')];var _0x2674d8=![];var _0x4061b8=null;if(!_[_0x8628('0x13')](_0x3bec81)){if(intUtil[_0x8628('0x14')](_0x3bec81[_0x8628('0x15')])){_0x7965b[_0x8628('0x16')]=_0x3bec81[_0x8628('0x15')];for(_0x4061b8=0x0;_0x4061b8<_0x16b1d7[_0x8628('0x17')];_0x4061b8++){if(_0x16b1d7[_0x4061b8][_0x8628('0x18')]===_0x3bec81[_0x8628('0x15')]&&!_0x16b1d7[_0x4061b8][_0x8628('0x19')]){_0x2674d8=!![];logger[_0x8628('0x1a')]('['+[_0x42ce89[_0x8628('0xf')]()]+_0x8628('0x1b')+_0x16b1d7[_0x4061b8][_0x8628('0x1c')]+'!');_0x7965b[_0x8628('0x1d')]=_0x16b1d7[_0x4061b8][_0x8628('0x1c')];}}}}if(!_0x2674d8){logger[_0x8628('0x1a')]('['+[_0x42ce89[_0x8628('0xf')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x7965b[_0x8628('0x16')]=_0x1ce4b4[_0x8628('0x9')];for(_0x4061b8=0x0;_0x4061b8<_0x16b1d7[_0x8628('0x17')];_0x4061b8++){if(_0x16b1d7[_0x4061b8]['internalemailaddress']===_0x1ce4b4['username']){_0x7965b[_0x8628('0x1d')]=_0x16b1d7[_0x4061b8][_0x8628('0x1c')];}}}_0x150401(_0x7965b);})['catch'](function(_0x1e09f9){_0xa8d8d2(_0x1e09f9[_0x8628('0x1e')]);});});}function createEndUser(_0x71445f,_0x598da6,_0x1cf661,_0x4fddeb,_0x5c7afa,_0x5aaebe){return new BPromise(function(_0x359f42,_0x1333d5){return getAuthToken(_0x598da6,_0x1cf661,_0x5aaebe)[_0x8628('0xb')](function(_0x5608f0){var _0x15cd54=_0x5aaebe[_0x8628('0x1f')]()===_0x8628('0x20')?_0x5c7afa[_0x8628('0x21')]:_0x5c7afa[_0x8628('0x22')];var _0x2cbae8={'method':_0x8628('0x7'),'uri':_0x4fddeb+_0x8628('0x23'),'body':{'telephone1':_0x15cd54,'fullname':_0x15cd54,'firstname':_0x15cd54,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8628('0x24')+_0x71445f[_0x8628('0x1d')]+')'},'headers':{'Authorization':_0x8628('0x11')+_0x5608f0,'OData-Version':_0x8628('0x25')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2cbae8);})[_0x8628('0xb')](function(_0x35ed81){var _0x564b91=_0x35ed81[_0x8628('0x26')][_0x8628('0x27')];var _0x555b53=_0x564b91[_0x8628('0x28')](_0x564b91[_0x8628('0x29')]('(')+0x1,_0x564b91['lastIndexOf'](')'));_0x71445f[_0x8628('0x2a')]=_0x555b53;_0x359f42(_0x71445f);})[_0x8628('0xd')](function(_0x527419){_0x1333d5(_0x527419[_0x8628('0x1e')]);});});}function getEndUser(_0x6516c9,_0x358133,_0x2242bc,_0x36c13f,_0x35bbab,_0x11d86e){return new BPromise(function(_0x30dd51,_0x55efd0){return getAuthToken(_0x358133,_0x2242bc,_0x11d86e)[_0x8628('0xb')](function(_0x3e665e){var _0x5ba6d4={'method':'GET','uri':_0x36c13f+_0x8628('0x2b'),'headers':{'Authorization':_0x8628('0x11')+_0x3e665e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ba6d4);})[_0x8628('0xb')](function(_0x4fe314){var _0xeede09=null;if(_0x4fe314){var _0x291629=_0x4fe314['value'];var _0x31db1e=![];for(_0xeede09=0x0;_0xeede09<_0x291629[_0x8628('0x17')];_0xeede09++){var _0x16e87d=_0x11d86e[_0x8628('0x1f')]()===_0x8628('0x20')?_0x35bbab['destcalleridnum']:_0x35bbab[_0x8628('0x22')];if(_0x291629[_0xeede09][_0x8628('0x2c')]===_0x16e87d){_0x31db1e=!![];_0x6516c9[_0x8628('0x2a')]=_0x291629[_0xeede09][_0x8628('0x2d')];}}if(_0x31db1e){_0x30dd51(_0x6516c9);}else{return createEndUser(_0x6516c9,_0x358133,_0x2242bc,_0x36c13f,_0x35bbab,_0x11d86e)['then'](function(_0x35a1e9){logger[_0x8628('0x1a')]('['+[_0x11d86e[_0x8628('0xf')]()]+']\x20Enduser\x20created!',_0x35a1e9[_0x8628('0x2a')]);_0x30dd51(_0x35a1e9);});}}else{return createEndUser(_0x6516c9,_0x358133,_0x2242bc,_0x36c13f,_0x35bbab,_0x11d86e)[_0x8628('0xb')](function(_0x367099){logger[_0x8628('0x1a')]('['+[_0x11d86e[_0x8628('0xf')]()]+']\x20Enduser\x20Created!',_0x367099[_0x8628('0x2a')]);_0x30dd51(_0x367099);});}});});}function getCustomFields(_0xe0a45a,_0x388d6d,_0x185f6e){var _0x238c3c={};if(_0xe0a45a['length']>0x0){_[_0x8628('0x2e')](_0xe0a45a,function(_0x1fe733){if(_0x1fe733[_0x8628('0x2f')]===_0x8628('0x30')&&_0x1fe733[_0x8628('0x31')]&&!_0x1fe733[_0x8628('0x32')]){var _0x2dc3f4=_0x1fe733[_0x8628('0x33')][_0x8628('0x1f')]();var _0x193316=_0x2dc3f4['substring'](0x0,_0x2dc3f4[_0x8628('0x34')]('_'));var _0x371fd1=_0x2dc3f4[_0x8628('0x28')](_0x2dc3f4[_0x8628('0x34')]('_')+0x1);if(_0x193316===_0x185f6e){_0x238c3c[_0x371fd1]=_0x1fe733[_0x8628('0x35')];}}});}return _0x238c3c;}function getTicket(_0x3723f9,_0x199a60,_0x250391,_0xeae93e,_0x40bdd2,_0x18cd0c,_0x24a8f9){return new BPromise(function(_0x55cb3a,_0x9bb77e){var _0x5659f4;return getAuthToken(_0x199a60,_0x250391,_0x24a8f9)[_0x8628('0xb')](function(_0x216b41){if(_0x18cd0c[_0x8628('0x36')]===_0x8628('0x37')){_0x5659f4={'method':'POST','uri':_0xeae93e+_0x8628('0x38'),'body':Object[_0x8628('0x39')]({},{'title':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3b')],_0x40bdd2,'\x20'),'description':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3c')],_0x40bdd2,'\x0a'),'customerid_contact@odata.bind':_0x8628('0x3d')+_0x3723f9[_0x8628('0x2a')]+')','ownerid@odata.bind':'/systemusers('+_0x3723f9[_0x8628('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x18cd0c[_0x8628('0x3e')],_0x40bdd2,_0x18cd0c['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x216b41,'OData-Version':_0x8628('0x25')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x18cd0c[_0x8628('0x36')]==='phonecall'){_0x5659f4={'method':_0x8628('0x7'),'uri':_0xeae93e+_0x8628('0x3f'),'body':Object[_0x8628('0x39')]({},{'subject':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3b')],_0x40bdd2,'\x20'),'phonenumber':String(_0x40bdd2[_0x8628('0x22')]),'description':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3c')],_0x40bdd2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8628('0x3d')+_0x3723f9[_0x8628('0x2a')]+')','ownerid@odata.bind':_0x8628('0x24')+_0x3723f9[_0x8628('0x1d')]+')','directioncode':_0x3723f9[_0x8628('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8628('0x24')+_0x3723f9[_0x8628('0x1d')]+')','participationtypemask':_0x3723f9[_0x8628('0x40')]===_0x8628('0x41')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3723f9[_0x8628('0x2a')]+')','participationtypemask':_0x3723f9[_0x8628('0x40')]===_0x8628('0x41')?0x1:0x2}]},getCustomFields(_0x18cd0c[_0x8628('0x3e')],_0x40bdd2,_0x18cd0c['ticketType'])),'headers':{'Authorization':_0x8628('0x11')+_0x216b41,'OData-Version':_0x8628('0x25')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5659f4);})[_0x8628('0xb')](function(_0x56085a){var _0x53b47e=_0x56085a[_0x8628('0x26')][_0x8628('0x27')];var _0x1beceb=_0x53b47e[_0x8628('0x28')](_0x53b47e[_0x8628('0x29')]('(')+0x1,_0x53b47e[_0x8628('0x29')](')'));_0x3723f9[_0x8628('0x42')]=_0x1beceb;_0x55cb3a(_0x3723f9);})[_0x8628('0xd')](function(_0x3d958a){_0x9bb77e(_0x3d958a[_0x8628('0x1e')]);});});}function emit(_0x28d6ee,_0x1daa3f,_0x30e6be,_0x564474){var _0x4892ee={'uri':util['format'](_0x8628('0x43'),_0x28d6ee,_0x30e6be,_0x564474)};io['to'](util[_0x8628('0x44')](_0x8628('0x45'),_0x1daa3f))[_0x8628('0x46')](_0x8628('0x47'),_0x4892ee);}exports['cs']=function(_0x33dfe0,_0x1019b5,_0x570975,_0x2b1c6a,_0x1eb33a,_0x53718b,_0x4b600a,_0x35e429){var _0x356e22={};_0x53718b[_0x8628('0x8')]=intUtil[_0x8628('0x48')](_0x53718b[_0x8628('0x8')]);_0x53718b[_0x8628('0x49')]=intUtil[_0x8628('0x48')](_0x53718b['serverUrl']);_0x356e22[_0x8628('0x40')]=_0x35e429==='queue'||_0x35e429===_0x8628('0x4a')?_0x8628('0x41'):_0x8628('0x20');var _0x4d4441=util['format']('%s/api/data/v9.0/',_0x53718b[_0x8628('0x8')]);var _0x567ec2=util[_0x8628('0x44')]('https://login.microsoftonline.com/%s/oauth2/token',_0x53718b[_0x8628('0x4b')]);var _0x5e0e5b=util['format'](_0x8628('0x4c'),_0x53718b[_0x8628('0x49')],_0x1019b5[_0x8628('0x4d')],md5(_0x1019b5[_0x8628('0x4d')]));if(_0x1eb33a&&_0x1eb33a['monitor_format']){logger[_0x8628('0x1a')](_0x8628('0x4e'),'Recording\x20is\x20enabled!');_0x1019b5[_0x8628('0x4f')]=_0x5e0e5b;}else if(_0x4b600a&&_0x4b600a[_0x8628('0x50')]&&_0x4b600a['recordingFormat']!==_0x8628('0x51')){logger[_0x8628('0x1a')](_0x8628('0x52'),_0x8628('0x53'));_0x1019b5[_0x8628('0x4f')]=_0x5e0e5b;}else{_0x1019b5['recordingURL']='';}return getUser(_0x356e22,_0x53718b,_0x2b1c6a,_0x567ec2,_0x4d4441,_0x35e429)[_0x8628('0xb')](function(_0x1476d1){logger['info']('['+_0x35e429[_0x8628('0xf')]()+_0x8628('0x54'),_0x1476d1['userId']);logger[_0x8628('0x1a')]('['+_0x35e429['toUpperCase']()+_0x8628('0x55'),_0x1476d1[_0x8628('0x16')]);return getEndUser(_0x1476d1,_0x53718b,_0x567ec2,_0x4d4441,_0x1019b5,_0x35e429);})[_0x8628('0xb')](function(_0x131d7e){logger['info']('['+_0x35e429[_0x8628('0xf')]()+_0x8628('0x56'),_0x131d7e[_0x8628('0x2a')]);logger['info']('['+_0x35e429[_0x8628('0xf')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1019b5[_0x8628('0x22')]);return getTicket(_0x131d7e,_0x53718b,_0x567ec2,_0x4d4441,_0x1019b5,_0x570975,_0x35e429);})[_0x8628('0xb')](function(_0x4e74a3){logger['info'](util[_0x8628('0x44')]('['+_0x35e429['toUpperCase']()+_0x8628('0x57'),_0x570975['ticketType'],_0x4e74a3[_0x8628('0x42')]));logger[_0x8628('0x1a')](util[_0x8628('0x44')]('['+_0x35e429[_0x8628('0xf')]()+_0x8628('0x58'),_0x35e429));if(_0x35e429!==_0x8628('0x4a')){logger[_0x8628('0x1a')]('['+_0x35e429[_0x8628('0xf')]()+']',_0x8628('0x59'));emit(_0x53718b['remoteUri'],_0x2b1c6a['name'],_0x570975[_0x8628('0x36')],_0x4e74a3[_0x8628('0x42')]);}})['catch'](function(_0x1ef4cc){logger[_0x8628('0xe')]('['+_0x35e429[_0x8628('0xf')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x8628('0x5a')](_0x1ef4cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8a4b=['internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','message','toLowerCase','destcalleridnum','Bearer\x20','4.0','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','outbound','calleridnum','enduserId','contactid',']\x20Enduser\x20created!','type','nameField','indexOf','content','ticketType','incident','incidents','assign','getString','/contacts(','/systemusers(','Fields','phonecall','Descriptions','callDirection','queue','headers','ticketId','emit','remoteUri','serverUrl','stripTrailingSlash','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\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','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','length'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x8a4b,0x1c7));var _0xb8a4=function(_0x384076,_0x491e1c){_0x384076=_0x384076-0x0;var _0x1d8f5d=_0x8a4b[_0x384076];return _0x1d8f5d;};'use strict';var _=require(_0xb8a4('0x0'));var BPromise=require(_0xb8a4('0x1'));var rp=require(_0xb8a4('0x2'));var util=require(_0xb8a4('0x3'));var intUtil=require(_0xb8a4('0x4'));var md5=require(_0xb8a4('0x5'));var Redis=require(_0xb8a4('0x6'));var logger=require(_0xb8a4('0x7'))(_0xb8a4('0x8'));var config=require(_0xb8a4('0x9'));config['redis']=_[_0xb8a4('0xa')](config[_0xb8a4('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xb8a4('0xc'))(new Redis(config[_0xb8a4('0xb')]));function getAuthToken(_0x19019e,_0x2835b8,_0x277ab9){var _0x1ff87c={'method':_0xb8a4('0xd'),'uri':_0x2835b8,'form':{'client_id':_0x19019e[_0xb8a4('0xe')],'resource':_0x19019e['remoteUri'],'username':_0x19019e['username'],'password':_0x19019e[_0xb8a4('0xf')],'grant_type':_0xb8a4('0xf'),'client_secret':_0x19019e[_0xb8a4('0x10')]},'json':!![]};return rp(_0x1ff87c)[_0xb8a4('0x11')](function(_0x759323){return _0x759323[_0xb8a4('0x12')];})[_0xb8a4('0x13')](function(_0x17c66c){logger[_0xb8a4('0x14')]('['+[_0x277ab9[_0xb8a4('0x15')]()]+_0xb8a4('0x16'));return _0x17c66c['message'];});}function getUser(_0x4605ab,_0x29479a,_0x2296ef,_0x21ee9e,_0x469b47,_0x34af56){return new BPromise(function(_0x178395,_0x309c60){return getAuthToken(_0x29479a,_0x21ee9e,_0x34af56)[_0xb8a4('0x11')](function(_0x41b3fd){var _0xaa8d78={'method':_0xb8a4('0x17'),'uri':_0x469b47+_0xb8a4('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x41b3fd,'OData-Version':'4.0'},'json':!![]};return rp(_0xaa8d78);})[_0xb8a4('0x11')](function(_0x2de2e1){var _0x36fd7f=_0x2de2e1[_0xb8a4('0x19')];var _0xe9fbad=![];var _0x161af1=null;if(!_[_0xb8a4('0x1a')](_0x2296ef)){if(intUtil[_0xb8a4('0x1b')](_0x2296ef[_0xb8a4('0x1c')])){_0x4605ab['userEmail']=_0x2296ef['email'];for(_0x161af1=0x0;_0x161af1<_0x36fd7f[_0xb8a4('0x1d')];_0x161af1++){if(_0x36fd7f[_0x161af1][_0xb8a4('0x1e')]===_0x2296ef[_0xb8a4('0x1c')]&&!_0x36fd7f[_0x161af1][_0xb8a4('0x1f')]){_0xe9fbad=!![];logger[_0xb8a4('0x20')]('['+[_0x34af56[_0xb8a4('0x15')]()]+']\x20Agent\x20found\x20'+_0x36fd7f[_0x161af1][_0xb8a4('0x21')]+'!');_0x4605ab['userId']=_0x36fd7f[_0x161af1][_0xb8a4('0x21')];}}}}if(!_0xe9fbad){logger['info']('['+[_0x34af56[_0xb8a4('0x15')]()]+_0xb8a4('0x22'));_0x4605ab[_0xb8a4('0x23')]=_0x29479a[_0xb8a4('0x24')];for(_0x161af1=0x0;_0x161af1<_0x36fd7f['length'];_0x161af1++){if(_0x36fd7f[_0x161af1][_0xb8a4('0x1e')]===_0x29479a['username']){_0x4605ab[_0xb8a4('0x25')]=_0x36fd7f[_0x161af1][_0xb8a4('0x21')];}}}_0x178395(_0x4605ab);})[_0xb8a4('0x13')](function(_0x440ca0){_0x309c60(_0x440ca0[_0xb8a4('0x26')]);});});}function createEndUser(_0x42314e,_0x56dcb7,_0x26a392,_0x3562b1,_0x2c2cd3,_0x12f401){return new BPromise(function(_0x59db34,_0x878186){return getAuthToken(_0x56dcb7,_0x26a392,_0x12f401)[_0xb8a4('0x11')](function(_0x73fd18){var _0x57ea82=_0x12f401[_0xb8a4('0x27')]()==='outbound'?_0x2c2cd3[_0xb8a4('0x28')]:_0x2c2cd3['calleridnum'];var _0x4f1366={'method':'POST','uri':_0x3562b1+'contacts','body':{'telephone1':_0x57ea82,'fullname':_0x57ea82,'firstname':_0x57ea82,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x42314e[_0xb8a4('0x25')]+')'},'headers':{'Authorization':_0xb8a4('0x29')+_0x73fd18,'OData-Version':_0xb8a4('0x2a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4f1366);})['then'](function(_0x23d2df){var _0x2cd475=_0x23d2df['headers'][_0xb8a4('0x2b')];var _0x2a1a0b=_0x2cd475[_0xb8a4('0x2c')](_0x2cd475[_0xb8a4('0x2d')]('(')+0x1,_0x2cd475[_0xb8a4('0x2d')](')'));_0x42314e['enduserId']=_0x2a1a0b;_0x59db34(_0x42314e);})[_0xb8a4('0x13')](function(_0x2ae911){_0x878186(_0x2ae911[_0xb8a4('0x26')]);});});}function getEndUser(_0x2196cd,_0x5bb695,_0x47ef36,_0x5b2a5c,_0x59f500,_0x382d91){return new BPromise(function(_0x22eccf,_0x3b588c){return getAuthToken(_0x5bb695,_0x47ef36,_0x382d91)[_0xb8a4('0x11')](function(_0x3bb7af){var _0x46d52e={'method':_0xb8a4('0x17'),'uri':_0x5b2a5c+_0xb8a4('0x2e'),'headers':{'Authorization':_0xb8a4('0x29')+_0x3bb7af,'If-None-Match':null,'OData-Version':_0xb8a4('0x2a')},'json':!![]};return rp(_0x46d52e);})['then'](function(_0x514657){var _0x50d394=null;if(_0x514657){var _0x2757ad=_0x514657[_0xb8a4('0x19')];var _0x57c635=![];for(_0x50d394=0x0;_0x50d394<_0x2757ad[_0xb8a4('0x1d')];_0x50d394++){var _0x14dddc=_0x382d91[_0xb8a4('0x27')]()===_0xb8a4('0x2f')?_0x59f500[_0xb8a4('0x28')]:_0x59f500[_0xb8a4('0x30')];if(_0x2757ad[_0x50d394]['telephone1']===_0x14dddc){_0x57c635=!![];_0x2196cd[_0xb8a4('0x31')]=_0x2757ad[_0x50d394][_0xb8a4('0x32')];}}if(_0x57c635){_0x22eccf(_0x2196cd);}else{return createEndUser(_0x2196cd,_0x5bb695,_0x47ef36,_0x5b2a5c,_0x59f500,_0x382d91)[_0xb8a4('0x11')](function(_0x2fe080){logger[_0xb8a4('0x20')]('['+[_0x382d91[_0xb8a4('0x15')]()]+_0xb8a4('0x33'),_0x2fe080[_0xb8a4('0x31')]);_0x22eccf(_0x2fe080);});}}else{return createEndUser(_0x2196cd,_0x5bb695,_0x47ef36,_0x5b2a5c,_0x59f500,_0x382d91)[_0xb8a4('0x11')](function(_0x450f89){logger[_0xb8a4('0x20')]('['+[_0x382d91['toUpperCase']()]+']\x20Enduser\x20Created!',_0x450f89[_0xb8a4('0x31')]);_0x22eccf(_0x450f89);});}});});}function getCustomFields(_0x4bdc8c,_0x19d703,_0x1ab730){var _0x85600d={};if(_0x4bdc8c['length']>0x0){_['forEach'](_0x4bdc8c,function(_0x2ce00b){if(_0x2ce00b[_0xb8a4('0x34')]==='string'&&_0x2ce00b[_0xb8a4('0x35')]&&!_0x2ce00b['customField']){var _0x36acf8=_0x2ce00b['idField']['toLowerCase']();var _0x4654c2=_0x36acf8['substring'](0x0,_0x36acf8[_0xb8a4('0x36')]('_'));var _0x26f4c8=_0x36acf8[_0xb8a4('0x2c')](_0x36acf8['indexOf']('_')+0x1);if(_0x4654c2===_0x1ab730){_0x85600d[_0x26f4c8]=_0x2ce00b[_0xb8a4('0x37')];}}});}return _0x85600d;}function getTicket(_0xe78bc7,_0x26ed3a,_0x38cfa6,_0x45b470,_0x282a9f,_0x1cc3d1,_0x47db22){return new BPromise(function(_0x19813f,_0x5fd320){var _0xd961a5;return getAuthToken(_0x26ed3a,_0x38cfa6,_0x47db22)[_0xb8a4('0x11')](function(_0x4475cf){if(_0x1cc3d1[_0xb8a4('0x38')]===_0xb8a4('0x39')){_0xd961a5={'method':_0xb8a4('0xd'),'uri':_0x45b470+_0xb8a4('0x3a'),'body':Object[_0xb8a4('0x3b')]({},{'title':intUtil[_0xb8a4('0x3c')](_0x1cc3d1['Subjects'],_0x282a9f,'\x20'),'description':intUtil[_0xb8a4('0x3c')](_0x1cc3d1['Descriptions'],_0x282a9f,'\x0a'),'customerid_contact@odata.bind':_0xb8a4('0x3d')+_0xe78bc7['enduserId']+')','ownerid@odata.bind':_0xb8a4('0x3e')+_0xe78bc7[_0xb8a4('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x1cc3d1[_0xb8a4('0x3f')],_0x282a9f,_0x1cc3d1[_0xb8a4('0x38')])),'headers':{'Authorization':_0xb8a4('0x29')+_0x4475cf,'OData-Version':_0xb8a4('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1cc3d1['ticketType']===_0xb8a4('0x40')){_0xd961a5={'method':_0xb8a4('0xd'),'uri':_0x45b470+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xb8a4('0x3c')](_0x1cc3d1['Subjects'],_0x282a9f,'\x20'),'phonenumber':String(_0x282a9f[_0xb8a4('0x30')]),'description':intUtil[_0xb8a4('0x3c')](_0x1cc3d1[_0xb8a4('0x41')],_0x282a9f,'\x0a'),'regardingobjectid_contact@odata.bind':_0xb8a4('0x3d')+_0xe78bc7[_0xb8a4('0x31')]+')','ownerid@odata.bind':_0xb8a4('0x3e')+_0xe78bc7['userId']+')','directioncode':_0xe78bc7[_0xb8a4('0x42')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xb8a4('0x3e')+_0xe78bc7[_0xb8a4('0x25')]+')','participationtypemask':_0xe78bc7[_0xb8a4('0x42')]===_0xb8a4('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0xb8a4('0x3d')+_0xe78bc7[_0xb8a4('0x31')]+')','participationtypemask':_0xe78bc7['callDirection']===_0xb8a4('0x43')?0x1:0x2}]},getCustomFields(_0x1cc3d1[_0xb8a4('0x3f')],_0x282a9f,_0x1cc3d1['ticketType'])),'headers':{'Authorization':_0xb8a4('0x29')+_0x4475cf,'OData-Version':_0xb8a4('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xd961a5);})[_0xb8a4('0x11')](function(_0x590281){var _0x48888f=_0x590281[_0xb8a4('0x44')][_0xb8a4('0x2b')];var _0x75cd1f=_0x48888f[_0xb8a4('0x2c')](_0x48888f[_0xb8a4('0x2d')]('(')+0x1,_0x48888f['lastIndexOf'](')'));_0xe78bc7[_0xb8a4('0x45')]=_0x75cd1f;_0x19813f(_0xe78bc7);})[_0xb8a4('0x13')](function(_0x443853){_0x5fd320(_0x443853[_0xb8a4('0x26')]);});});}function emit(_0x5c03fc,_0x2046cd,_0x2483ca,_0x2431b0){var _0x569314={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5c03fc,_0x2483ca,_0x2431b0)};io['to'](util['format']('user:%s',_0x2046cd))[_0xb8a4('0x46')]('trigger:browser:url',_0x569314);}exports['cs']=function(_0x1bc3d4,_0x5f87d8,_0x195873,_0x3f4915,_0x52aa42,_0x276847,_0x5ea44e,_0x1aa985){var _0x75976d={};_0x276847[_0xb8a4('0x47')]=intUtil['stripTrailingSlash'](_0x276847[_0xb8a4('0x47')]);_0x276847[_0xb8a4('0x48')]=intUtil[_0xb8a4('0x49')](_0x276847['serverUrl']);_0x75976d[_0xb8a4('0x42')]=_0x1aa985==='queue'||_0x1aa985===_0xb8a4('0x4a')?_0xb8a4('0x43'):_0xb8a4('0x2f');var _0x38bea5=util[_0xb8a4('0x4b')](_0xb8a4('0x4c'),_0x276847[_0xb8a4('0x47')]);var _0x7bc607=util[_0xb8a4('0x4b')](_0xb8a4('0x4d'),_0x276847[_0xb8a4('0x4e')]);var _0x1e9bda=util[_0xb8a4('0x4b')](_0xb8a4('0x4f'),_0x276847[_0xb8a4('0x48')],_0x5f87d8[_0xb8a4('0x50')],md5(_0x5f87d8[_0xb8a4('0x50')]));if(_0x52aa42&&_0x52aa42['monitor_format']){logger['info'](_0xb8a4('0x51'),'Recording\x20is\x20enabled!');_0x5f87d8['recordingURL']=_0x1e9bda;}else if(_0x5ea44e&&_0x5ea44e[_0xb8a4('0x52')]&&_0x5ea44e[_0xb8a4('0x52')]!==_0xb8a4('0x53')){logger['info'](_0xb8a4('0x54'),_0xb8a4('0x55'));_0x5f87d8[_0xb8a4('0x56')]=_0x1e9bda;}else{_0x5f87d8[_0xb8a4('0x56')]='';}return getUser(_0x75976d,_0x276847,_0x3f4915,_0x7bc607,_0x38bea5,_0x1aa985)[_0xb8a4('0x11')](function(_0x418286){logger[_0xb8a4('0x20')]('['+_0x1aa985[_0xb8a4('0x15')]()+_0xb8a4('0x57'),_0x418286[_0xb8a4('0x25')]);logger[_0xb8a4('0x20')]('['+_0x1aa985['toUpperCase']()+_0xb8a4('0x58'),_0x418286[_0xb8a4('0x23')]);return getEndUser(_0x418286,_0x276847,_0x7bc607,_0x38bea5,_0x5f87d8,_0x1aa985);})[_0xb8a4('0x11')](function(_0x261c5b){logger['info']('['+_0x1aa985[_0xb8a4('0x15')]()+_0xb8a4('0x59'),_0x261c5b[_0xb8a4('0x31')]);logger['info']('['+_0x1aa985[_0xb8a4('0x15')]()+_0xb8a4('0x5a'),_0x5f87d8['calleridnum']);return getTicket(_0x261c5b,_0x276847,_0x7bc607,_0x38bea5,_0x5f87d8,_0x195873,_0x1aa985);})['then'](function(_0x36c95b){logger['info'](util[_0xb8a4('0x4b')]('['+_0x1aa985[_0xb8a4('0x15')]()+_0xb8a4('0x5b'),_0x195873['ticketType'],_0x36c95b['ticketId']));logger['info'](util[_0xb8a4('0x4b')]('['+_0x1aa985[_0xb8a4('0x15')]()+_0xb8a4('0x5c'),_0x1aa985));if(_0x1aa985!==_0xb8a4('0x4a')){logger[_0xb8a4('0x20')]('['+_0x1aa985[_0xb8a4('0x15')]()+']',_0xb8a4('0x5d'));emit(_0x276847['remoteUri'],_0x3f4915[_0xb8a4('0x5e')],_0x195873[_0xb8a4('0x38')],_0x36c95b['ticketId']);}})[_0xb8a4('0x13')](function(_0x472c14){logger['error']('['+_0x1aa985[_0xb8a4('0x15')]()+_0xb8a4('0x5f'),util[_0xb8a4('0x60')](_0x472c14,{'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 c5242b8..cae14b3 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 _0x3a7b=['Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','GET','map','forEach','type','nameField','customField','toLowerCase','string','idField','push','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','monitor_format','lastevent','toUpperCase','lodash','md5','util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length'];(function(_0xa4793b,_0x1d330e){var _0x7e21f7=function(_0x442375){while(--_0x442375){_0xa4793b['push'](_0xa4793b['shift']());}};_0x7e21f7(++_0x1d330e);}(_0x3a7b,0x8c));var _0xb3a7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a7b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb3a7('0x0'));var rp=require('request-promise');var md5=require(_0xb3a7('0x1'));var util=require(_0xb3a7('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb3a7('0x3'))(_0xb3a7('0x4'));config[_0xb3a7('0x5')]=_[_0xb3a7('0x6')](config[_0xb3a7('0x5')],{'host':_0xb3a7('0x7'),'port':0x18eb});var io=require(_0xb3a7('0x8'))(new Redis(config[_0xb3a7('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xb3a7('0x9')};function emit(_0x1c5b1b,_0x4b7851,_0x264455){io['to'](_0x1c5b1b)[_0xb3a7('0xa')](_0x4b7851,_0x264455);}function getTicket(_0x6c23b5,_0x1612b4,_0x35b03c,_0x349376,_0xf3a80e){logger['info']('Creating\x20new\x20ticket...');var _0x2af734=_[_0xb3a7('0xb')]({'responder_id':_0x1612b4['id'],'requester_id':_0x35b03c['id'],'name':util[_0xb3a7('0xc')](_0xb3a7('0xd'),_0xf3a80e[_0xb3a7('0xe')]),'phone':_0xf3a80e[_0xb3a7('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb3a7('0x10')](_0x349376['Subjects'],_0xf3a80e,'\x20'),'description':intUtil[_0xb3a7('0x10')](_0x349376[_0xb3a7('0x11')],_0xf3a80e,_0xb3a7('0x12')),'tags':getTags(_0x349376['Tags'],_0xb3a7('0x13'))},getCustomFields(_0x349376[_0xb3a7('0x14')],_0xf3a80e));_0x2af734[_0xb3a7('0x15')]=_[_0xb3a7('0x16')](_[_0xb3a7('0x17')](_0x2af734[_0xb3a7('0x15')],'id'),'value');return request({'uri':util[_0xb3a7('0xc')](_0xb3a7('0x18'),_0x6c23b5[_0xb3a7('0x19')]),'method':'POST','body':_0x2af734})[_0xb3a7('0x1a')](function(_0x1380d2){logger[_0xb3a7('0x1b')](_0xb3a7('0x1c'));return _0x1380d2;});}function getUser(_0x3e9242,_0x326fd7){if(intUtil[_0xb3a7('0x1d')](_0x326fd7)){return request({'uri':util[_0xb3a7('0xc')](_0xb3a7('0x1e'),_0x3e9242[_0xb3a7('0x19')]),'qs':{'email':_0x326fd7}})['then'](function(_0x10b742){if(_0x10b742[_0xb3a7('0x1f')]){logger[_0xb3a7('0x1b')](_0xb3a7('0x20'));return _[_0xb3a7('0x21')](_0x10b742,function(_0x14d12a){return _0x14d12a[_0xb3a7('0x22')]['email']===_0x326fd7;});}else{logger[_0xb3a7('0x1b')](_0xb3a7('0x23'));return request({'uri':util[_0xb3a7('0xc')]('%s/api/v2/agents/me',_0x3e9242['remoteUri'])})['then'](function(_0xa2e4e7){logger[_0xb3a7('0x1b')](_0xb3a7('0x24'));return _0xa2e4e7;});}});}else{logger[_0xb3a7('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb3a7('0xc')](_0xb3a7('0x25'),_0x3e9242[_0xb3a7('0x19')])})[_0xb3a7('0x1a')](function(_0x15d40d){logger[_0xb3a7('0x1b')](_0xb3a7('0x24'));return _0x15d40d;});}}function getEndUser(_0x30b2f2,_0x51178c,_0x4b1f31){logger[_0xb3a7('0x1b')](_0xb3a7('0x26'),_0x4b1f31);return request({'uri':util['format'](_0xb3a7('0x27'),_0x30b2f2['remoteUri']),'qs':{'phone':_0x4b1f31}})['then'](function(_0x4f8bc1){if(_0x4f8bc1[_0xb3a7('0x1f')]){logger[_0xb3a7('0x1b')]('Enduser\x20found!');return _[_0xb3a7('0x21')](_0x4f8bc1,{'phone':_0x4b1f31});}else{logger['info'](_0xb3a7('0x28'));return request({'uri':util[_0xb3a7('0xc')]('%s/api/v2/contacts',_0x30b2f2[_0xb3a7('0x19')]),'method':'POST','body':{'name':_0x51178c,'phone':_0x4b1f31}})[_0xb3a7('0x1a')](function(_0x3b29ab){logger[_0xb3a7('0x1b')]('Enduser\x20created.');return _0x3b29ab;});}});}function getAuth(_0x5c3f5e){return util[_0xb3a7('0xc')](_0xb3a7('0x29'),new Buffer(_0x5c3f5e[_0xb3a7('0x2a')]+':X')[_0xb3a7('0x2b')]('base64'));}function request(_0x4f82ce){logger['debug']('[HTTP]',JSON['stringify'](_0x4f82ce));return rp(_[_0xb3a7('0x6')](_0x4f82ce,{'method':_0xb3a7('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0xae2b65,_0x11f953){var _0x34c867=[];if(_0xae2b65&&_0xae2b65[_0xb3a7('0x1f')]>0x0){_0x34c867=_[_0xb3a7('0x2d')](_0xae2b65,_0x11f953);}return _0x34c867;}function getCustomFields(_0x909c9d,_0x29e133){var _0x30f99d=[];var _0x45597f={'custom_fields':[]};if(_0x909c9d[_0xb3a7('0x1f')]>0x0){_[_0xb3a7('0x2e')](_0x909c9d,function(_0x555e00){if(_0x555e00[_0xb3a7('0x2f')]==='string'&&_0x555e00[_0xb3a7('0x30')]&&!_0x555e00[_0xb3a7('0x31')]){_0x45597f[_0x555e00[_0xb3a7('0x30')][_0xb3a7('0x32')]()]=_0x555e00['content'][_0xb3a7('0x2b')]();}else if(_0x555e00['type']===_0xb3a7('0x33')&&_0x555e00[_0xb3a7('0x34')]&&_0x555e00[_0xb3a7('0x31')]){_0x45597f['custom_fields'][_0xb3a7('0x35')]({'id':_0x555e00[_0xb3a7('0x34')],'value':_0x555e00[_0xb3a7('0x36')][_0xb3a7('0x2b')]()});}else if(_0x555e00[_0xb3a7('0x2f')]===_0xb3a7('0x37')&&_0x555e00[_0xb3a7('0x38')]&&_0x555e00[_0xb3a7('0x34')]&&_0x555e00['customField']){_0x29e133[_0x555e00[_0xb3a7('0x38')]]&&_0x45597f[_0xb3a7('0x15')][_0xb3a7('0x35')]({'id':_0x555e00[_0xb3a7('0x34')],'value':_0x29e133[_0x555e00[_0xb3a7('0x38')]]['toString']()});}else if(_0x555e00[_0xb3a7('0x2f')]==='customVariable'&&_0x555e00[_0xb3a7('0x39')]&&_0x555e00[_0xb3a7('0x39')]['name']&&_0x555e00[_0xb3a7('0x34')]&&_0x555e00[_0xb3a7('0x31')]){_0x29e133[_0x555e00[_0xb3a7('0x39')][_0xb3a7('0x13')][_0xb3a7('0x32')]()]&&_0x45597f[_0xb3a7('0x15')][_0xb3a7('0x35')]({'id':_0x555e00['idField'],'value':_0x29e133[_0x555e00[_0xb3a7('0x39')][_0xb3a7('0x13')]['toLowerCase']()][_0xb3a7('0x2b')]()});}});}return _0x45597f;}exports[_0xb3a7('0x3a')]=function(_0x2450e1,_0x41d680,_0x915ee8,_0x51517d,_0x5da013,_0x616671){var _0x27dc31,_0x29a3b8;_0x616671[_0xb3a7('0x19')]=intUtil[_0xb3a7('0x3b')](_0x616671['remoteUri']);_0x616671[_0xb3a7('0x3c')]=intUtil[_0xb3a7('0x3b')](_0x616671[_0xb3a7('0x3c')]);if(_0x5da013&&_0x5da013['monitor_format']){logger[_0xb3a7('0x1b')](_0xb3a7('0x3d'),_0xb3a7('0x3e'));_0x41d680['recordingURL']=util['format'](_0xb3a7('0x3f'),_0x616671[_0xb3a7('0x3c')],_0x41d680[_0xb3a7('0x40')],md5(_0x41d680[_0xb3a7('0x40')]));}else{_0x41d680[_0xb3a7('0x41')]='';}headers['Authorization']=getAuth(_0x616671);return getUser(_0x616671,_0x51517d['email'])[_0xb3a7('0x1a')](function(_0x169c64){_0x27dc31=_0x169c64;logger[_0xb3a7('0x1b')](_0xb3a7('0x42'),_0x27dc31['id']);return getEndUser(_0x616671,_0x41d680[_0xb3a7('0xe')],_0x41d680[_0xb3a7('0xf')]);})[_0xb3a7('0x1a')](function(_0x251a79){_0x29a3b8=_0x251a79;logger[_0xb3a7('0x1b')](_0xb3a7('0x43'),_0x29a3b8['id']);return getTicket(_0x616671,_0x27dc31,_0x29a3b8,_0x915ee8,_0x41d680);})['then'](function(_0x27b777){if(_0x27b777&&_0x27b777['id']){logger['info'](_0xb3a7('0x1c'));logger[_0xb3a7('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x27b777['id']);logger[_0xb3a7('0x1b')]('[QUEUE]',_0xb3a7('0x44'));emit(util['format'](_0xb3a7('0x45'),_0x51517d[_0xb3a7('0x13')]),_0xb3a7('0x46'),{'uri':util[_0xb3a7('0xc')](_0xb3a7('0x47'),_0x616671[_0xb3a7('0x19')],_0x27b777['id'])});}})[_0xb3a7('0x48')](function(_0x23ca97){logger[_0xb3a7('0x49')](_0xb3a7('0x3d'),JSON[_0xb3a7('0x4a')](_0x23ca97));});};exports[_0xb3a7('0x4b')]=function(_0x311c67,_0x168429,_0x40a4b0,_0x5ec59a,_0x15e1bd,_0xbe6ae6,_0xcec31c){var _0x1d2606,_0x1ba8ea;_0xbe6ae6[_0xb3a7('0x19')]=intUtil['stripTrailingSlash'](_0xbe6ae6[_0xb3a7('0x19')]);_0xbe6ae6[_0xb3a7('0x3c')]=intUtil[_0xb3a7('0x3b')](_0xbe6ae6['serverUrl']);if(_0xcec31c&&_0xcec31c[_0xb3a7('0x4c')]&&_0xcec31c[_0xb3a7('0x4c')]!==_0xb3a7('0x4d')){logger[_0xb3a7('0x1b')](_0xb3a7('0x4e'),_0xb3a7('0x3e'));_0x168429[_0xb3a7('0x41')]=util['format'](_0xb3a7('0x3f'),_0xbe6ae6['serverUrl'],_0x168429['uniqueid'],md5(_0x168429[_0xb3a7('0x40')]));}headers[_0xb3a7('0x4f')]=getAuth(_0xbe6ae6);return getUser(_0xbe6ae6,_0x5ec59a[_0xb3a7('0x50')])[_0xb3a7('0x1a')](function(_0x4e9e3e){_0x1d2606=_0x4e9e3e;logger[_0xb3a7('0x1b')](_0xb3a7('0x42'),_0x1d2606['id']);return getEndUser(_0xbe6ae6,_0x168429[_0xb3a7('0x51')],_0x168429[_0xb3a7('0x52')]);})[_0xb3a7('0x1a')](function(_0x2cd23e){_0x1ba8ea=_0x2cd23e;logger[_0xb3a7('0x1b')](_0xb3a7('0x43'),_0x1ba8ea['id']);return getTicket(_0xbe6ae6,_0x1d2606,_0x1ba8ea,_0x40a4b0,_0x168429);})[_0xb3a7('0x1a')](function(_0x4f7d91){if(_0x4f7d91&&_0x4f7d91['id']){logger[_0xb3a7('0x1b')]('Ticket\x20created!');logger[_0xb3a7('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x4f7d91['id']);logger[_0xb3a7('0x1b')](_0xb3a7('0x4e'),_0xb3a7('0x44'));emit(util[_0xb3a7('0xc')](_0xb3a7('0x45'),_0x5ec59a[_0xb3a7('0x13')]),_0xb3a7('0x46'),{'uri':util[_0xb3a7('0xc')]('%s/helpdesk/tickets/%d',_0xbe6ae6[_0xb3a7('0x19')],_0x4f7d91['id'])});}})[_0xb3a7('0x48')](function(_0x338c98){logger['error'](_0xb3a7('0x4e'),JSON[_0xb3a7('0x4a')](_0x338c98));});};exports['unmanaged']=function(_0x7a87bc,_0x4efcd8,_0x1f45f3,_0x20d61f,_0x58db89,_0xeb7f02){var _0x76a5ea,_0x5961f2;_0xeb7f02['remoteUri']=intUtil['stripTrailingSlash'](_0xeb7f02[_0xb3a7('0x19')]);_0xeb7f02[_0xb3a7('0x3c')]=intUtil[_0xb3a7('0x3b')](_0xeb7f02['serverUrl']);if(_0x58db89&&_0x58db89[_0xb3a7('0x53')]){logger['info']('['+_0x4efcd8[_0xb3a7('0x54')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4efcd8[_0xb3a7('0x41')]=util[_0xb3a7('0xc')](_0xb3a7('0x3f'),_0xeb7f02[_0xb3a7('0x3c')],_0x4efcd8[_0xb3a7('0x40')],md5(_0x4efcd8['uniqueid']));}else{_0x4efcd8[_0xb3a7('0x41')]='';}headers[_0xb3a7('0x4f')]=getAuth(_0xeb7f02);return getUser(_0xeb7f02,'')[_0xb3a7('0x1a')](function(_0x482e75){_0x76a5ea=_0x482e75;logger[_0xb3a7('0x1b')](_0xb3a7('0x42'),_0x76a5ea['id']);return getEndUser(_0xeb7f02,_0x4efcd8[_0xb3a7('0xe')],_0x4efcd8[_0xb3a7('0xf')]);})[_0xb3a7('0x1a')](function(_0x403de9){_0x5961f2=_0x403de9;logger[_0xb3a7('0x1b')](_0xb3a7('0x43'),_0x5961f2['id']);return getTicket(_0xeb7f02,_0x76a5ea,_0x5961f2,_0x1f45f3,_0x4efcd8);})[_0xb3a7('0x1a')](function(_0x214f11){if(_0x214f11){logger[_0xb3a7('0x1b')]('Ticket\x20created!');logger[_0xb3a7('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x214f11['id']);}})[_0xb3a7('0x48')](function(_0xdc9f3a){logger[_0xb3a7('0x49')]('['+_0x4efcd8[_0xb3a7('0x54')][_0xb3a7('0x55')]()+']',JSON[_0xb3a7('0x4a')](_0xdc9f3a));});}; \ No newline at end of file +var _0x3fdf=['Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','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!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','defaults','GET','map','forEach','type','string','nameField','idField','customField','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','./util','../../../../config/logger','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format'];(function(_0x835f74,_0x123452){var _0x46a4d6=function(_0x5b7adc){while(--_0x5b7adc){_0x835f74['push'](_0x835f74['shift']());}};_0x46a4d6(++_0x123452);}(_0x3fdf,0xb1));var _0xf3fd=function(_0x163ae2,_0x144901){_0x163ae2=_0x163ae2-0x0;var _0x593dc8=_0x3fdf[_0x163ae2];return _0x593dc8;};'use strict';var _=require(_0xf3fd('0x0'));var rp=require(_0xf3fd('0x1'));var md5=require(_0xf3fd('0x2'));var util=require(_0xf3fd('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf3fd('0x4'));var config=require('../../../../config/environment');var logger=require(_0xf3fd('0x5'))('freshdesk');config[_0xf3fd('0x6')]=_['defaults'](config[_0xf3fd('0x6')],{'host':_0xf3fd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xf3fd('0x8')};function emit(_0x4fcab0,_0x515e90,_0x547d90){io['to'](_0x4fcab0)[_0xf3fd('0x9')](_0x515e90,_0x547d90);}function getTicket(_0x99bc77,_0x1ade25,_0x330a83,_0x5b1a9b,_0x34b9d1){logger[_0xf3fd('0xa')](_0xf3fd('0xb'));var _0x15ed3e=_['merge']({'responder_id':_0x1ade25['id'],'requester_id':_0x330a83['id'],'name':util[_0xf3fd('0xc')](_0xf3fd('0xd'),_0x34b9d1['calleridname']),'phone':_0x34b9d1[_0xf3fd('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf3fd('0xf')](_0x5b1a9b[_0xf3fd('0x10')],_0x34b9d1,'\x20'),'description':intUtil[_0xf3fd('0xf')](_0x5b1a9b[_0xf3fd('0x11')],_0x34b9d1,_0xf3fd('0x12')),'tags':getTags(_0x5b1a9b['Tags'],_0xf3fd('0x13'))},getCustomFields(_0x5b1a9b[_0xf3fd('0x14')],_0x34b9d1));_0x15ed3e['custom_fields']=_[_0xf3fd('0x15')](_[_0xf3fd('0x16')](_0x15ed3e[_0xf3fd('0x17')],'id'),_0xf3fd('0x18'));return request({'uri':util[_0xf3fd('0xc')](_0xf3fd('0x19'),_0x99bc77[_0xf3fd('0x1a')]),'method':_0xf3fd('0x1b'),'body':_0x15ed3e})[_0xf3fd('0x1c')](function(_0x26571e){logger[_0xf3fd('0xa')](_0xf3fd('0x1d'));return _0x26571e;});}function getUser(_0x177e83,_0x708f51){if(intUtil[_0xf3fd('0x1e')](_0x708f51)){return request({'uri':util['format'](_0xf3fd('0x1f'),_0x177e83[_0xf3fd('0x1a')]),'qs':{'email':_0x708f51}})['then'](function(_0x2b7d3c){if(_0x2b7d3c[_0xf3fd('0x20')]){logger[_0xf3fd('0xa')](_0xf3fd('0x21'));return _['find'](_0x2b7d3c,function(_0x5df610){return _0x5df610[_0xf3fd('0x22')][_0xf3fd('0x23')]===_0x708f51;});}else{logger[_0xf3fd('0xa')](_0xf3fd('0x24'));return request({'uri':util[_0xf3fd('0xc')](_0xf3fd('0x25'),_0x177e83[_0xf3fd('0x1a')])})['then'](function(_0x31bed2){logger[_0xf3fd('0xa')](_0xf3fd('0x26'));return _0x31bed2;});}});}else{logger['info'](_0xf3fd('0x27'));return request({'uri':util[_0xf3fd('0xc')](_0xf3fd('0x25'),_0x177e83[_0xf3fd('0x1a')])})[_0xf3fd('0x1c')](function(_0x5b66ba){logger[_0xf3fd('0xa')]('Admin\x20account\x20selected.');return _0x5b66ba;});}}function getEndUser(_0x3c0c77,_0x4a0e1c,_0x45cb0d){logger[_0xf3fd('0xa')](_0xf3fd('0x28'),_0x45cb0d);return request({'uri':util[_0xf3fd('0xc')](_0xf3fd('0x29'),_0x3c0c77[_0xf3fd('0x1a')]),'qs':{'phone':_0x45cb0d}})[_0xf3fd('0x1c')](function(_0x38da9f){if(_0x38da9f['length']){logger[_0xf3fd('0xa')](_0xf3fd('0x2a'));return _[_0xf3fd('0x2b')](_0x38da9f,{'phone':_0x45cb0d});}else{logger[_0xf3fd('0xa')](_0xf3fd('0x2c'));return request({'uri':util[_0xf3fd('0xc')](_0xf3fd('0x29'),_0x3c0c77['remoteUri']),'method':_0xf3fd('0x1b'),'body':{'name':_0x4a0e1c,'phone':_0x45cb0d}})['then'](function(_0x577061){logger[_0xf3fd('0xa')](_0xf3fd('0x2d'));return _0x577061;});}});}function getAuth(_0x1c2c1e){return util[_0xf3fd('0xc')]('Basic\x20%s',new Buffer(_0x1c2c1e[_0xf3fd('0x2e')]+':X')[_0xf3fd('0x2f')](_0xf3fd('0x30')));}function request(_0x363fb7){logger['debug'](_0xf3fd('0x31'),JSON[_0xf3fd('0x32')](_0x363fb7));return rp(_[_0xf3fd('0x33')](_0x363fb7,{'method':_0xf3fd('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x55d7fd,_0x116f53){var _0x3d4d4d=[];if(_0x55d7fd&&_0x55d7fd[_0xf3fd('0x20')]>0x0){_0x3d4d4d=_[_0xf3fd('0x35')](_0x55d7fd,_0x116f53);}return _0x3d4d4d;}function getCustomFields(_0x4af3db,_0x408b7e){var _0x29ff4d=[];var _0x22bd80={'custom_fields':[]};if(_0x4af3db[_0xf3fd('0x20')]>0x0){_[_0xf3fd('0x36')](_0x4af3db,function(_0x6889a){if(_0x6889a[_0xf3fd('0x37')]===_0xf3fd('0x38')&&_0x6889a['nameField']&&!_0x6889a['customField']){_0x22bd80[_0x6889a[_0xf3fd('0x39')]['toLowerCase']()]=_0x6889a['content']['toString']();}else if(_0x6889a[_0xf3fd('0x37')]===_0xf3fd('0x38')&&_0x6889a[_0xf3fd('0x3a')]&&_0x6889a[_0xf3fd('0x3b')]){_0x22bd80[_0xf3fd('0x17')]['push']({'id':_0x6889a[_0xf3fd('0x3a')],'value':_0x6889a[_0xf3fd('0x3c')][_0xf3fd('0x2f')]()});}else if(_0x6889a['type']===_0xf3fd('0x3d')&&_0x6889a[_0xf3fd('0x3e')]&&_0x6889a[_0xf3fd('0x3a')]&&_0x6889a['customField']){_0x408b7e[_0x6889a[_0xf3fd('0x3e')]]&&_0x22bd80[_0xf3fd('0x17')][_0xf3fd('0x3f')]({'id':_0x6889a[_0xf3fd('0x3a')],'value':_0x408b7e[_0x6889a['variableName']][_0xf3fd('0x2f')]()});}else if(_0x6889a[_0xf3fd('0x37')]===_0xf3fd('0x40')&&_0x6889a['Variable']&&_0x6889a[_0xf3fd('0x41')][_0xf3fd('0x13')]&&_0x6889a['idField']&&_0x6889a[_0xf3fd('0x3b')]){_0x408b7e[_0x6889a[_0xf3fd('0x41')][_0xf3fd('0x13')][_0xf3fd('0x42')]()]&&_0x22bd80['custom_fields'][_0xf3fd('0x3f')]({'id':_0x6889a[_0xf3fd('0x3a')],'value':_0x408b7e[_0x6889a['Variable'][_0xf3fd('0x13')]['toLowerCase']()][_0xf3fd('0x2f')]()});}});}return _0x22bd80;}exports[_0xf3fd('0x43')]=function(_0x3a85d4,_0x3db138,_0x5bf347,_0x34dee8,_0x5899d3,_0x1ffbea){var _0x6f4053,_0x353cd8;_0x1ffbea[_0xf3fd('0x1a')]=intUtil[_0xf3fd('0x44')](_0x1ffbea[_0xf3fd('0x1a')]);_0x1ffbea[_0xf3fd('0x45')]=intUtil[_0xf3fd('0x44')](_0x1ffbea['serverUrl']);if(_0x5899d3&&_0x5899d3[_0xf3fd('0x46')]){logger['info'](_0xf3fd('0x47'),'Recording\x20is\x20enabled!');_0x3db138['recordingURL']=util[_0xf3fd('0xc')](_0xf3fd('0x48'),_0x1ffbea['serverUrl'],_0x3db138['uniqueid'],md5(_0x3db138[_0xf3fd('0x49')]));}else{_0x3db138[_0xf3fd('0x4a')]='';}headers[_0xf3fd('0x4b')]=getAuth(_0x1ffbea);return getUser(_0x1ffbea,_0x34dee8[_0xf3fd('0x23')])[_0xf3fd('0x1c')](function(_0x26a735){_0x6f4053=_0x26a735;logger[_0xf3fd('0xa')](_0xf3fd('0x4c'),_0x6f4053['id']);return getEndUser(_0x1ffbea,_0x3db138['calleridname'],_0x3db138[_0xf3fd('0xe')]);})['then'](function(_0x30ce6d){_0x353cd8=_0x30ce6d;logger[_0xf3fd('0xa')]('The\x20Enduser\x20ID\x20is:',_0x353cd8['id']);return getTicket(_0x1ffbea,_0x6f4053,_0x353cd8,_0x5bf347,_0x3db138);})[_0xf3fd('0x1c')](function(_0x4c8830){if(_0x4c8830&&_0x4c8830['id']){logger['info'](_0xf3fd('0x1d'));logger[_0xf3fd('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4c8830['id']);logger['info'](_0xf3fd('0x47'),_0xf3fd('0x4d'));emit(util[_0xf3fd('0xc')]('user:%s',_0x34dee8[_0xf3fd('0x13')]),_0xf3fd('0x4e'),{'uri':util[_0xf3fd('0xc')]('%s/helpdesk/tickets/%d',_0x1ffbea[_0xf3fd('0x1a')],_0x4c8830['id'])});}})[_0xf3fd('0x4f')](function(_0x49019a){logger[_0xf3fd('0x50')](_0xf3fd('0x47'),JSON[_0xf3fd('0x32')](_0x49019a));});};exports['outbound']=function(_0x14552c,_0x42c83c,_0x2ec9d6,_0x5de42c,_0xe8933f,_0x481020,_0x1ab931){var _0x1573f7,_0x2d2ea6;_0x481020[_0xf3fd('0x1a')]=intUtil[_0xf3fd('0x44')](_0x481020[_0xf3fd('0x1a')]);_0x481020[_0xf3fd('0x45')]=intUtil[_0xf3fd('0x44')](_0x481020[_0xf3fd('0x45')]);if(_0x1ab931&&_0x1ab931[_0xf3fd('0x51')]&&_0x1ab931[_0xf3fd('0x51')]!==_0xf3fd('0x52')){logger[_0xf3fd('0xa')](_0xf3fd('0x53'),_0xf3fd('0x54'));_0x42c83c[_0xf3fd('0x4a')]=util[_0xf3fd('0xc')](_0xf3fd('0x48'),_0x481020[_0xf3fd('0x45')],_0x42c83c[_0xf3fd('0x49')],md5(_0x42c83c[_0xf3fd('0x49')]));}headers[_0xf3fd('0x4b')]=getAuth(_0x481020);return getUser(_0x481020,_0x5de42c[_0xf3fd('0x23')])[_0xf3fd('0x1c')](function(_0x2c97a8){_0x1573f7=_0x2c97a8;logger[_0xf3fd('0xa')](_0xf3fd('0x4c'),_0x1573f7['id']);return getEndUser(_0x481020,_0x42c83c[_0xf3fd('0x55')],_0x42c83c[_0xf3fd('0x56')]);})[_0xf3fd('0x1c')](function(_0x929943){_0x2d2ea6=_0x929943;logger[_0xf3fd('0xa')](_0xf3fd('0x57'),_0x2d2ea6['id']);return getTicket(_0x481020,_0x1573f7,_0x2d2ea6,_0x2ec9d6,_0x42c83c);})[_0xf3fd('0x1c')](function(_0x503669){if(_0x503669&&_0x503669['id']){logger[_0xf3fd('0xa')](_0xf3fd('0x1d'));logger[_0xf3fd('0xa')](_0xf3fd('0x58'),_0x503669['id']);logger[_0xf3fd('0xa')](_0xf3fd('0x53'),_0xf3fd('0x4d'));emit(util['format'](_0xf3fd('0x59'),_0x5de42c[_0xf3fd('0x13')]),_0xf3fd('0x4e'),{'uri':util[_0xf3fd('0xc')](_0xf3fd('0x5a'),_0x481020[_0xf3fd('0x1a')],_0x503669['id'])});}})['catch'](function(_0x5693a4){logger['error']('[OUTBOUND]',JSON['stringify'](_0x5693a4));});};exports[_0xf3fd('0x5b')]=function(_0x5dde15,_0x18fa3c,_0xb97720,_0x5c5f6c,_0x494109,_0x4d6d0e){var _0x3ba435,_0x507a8b;_0x4d6d0e[_0xf3fd('0x1a')]=intUtil['stripTrailingSlash'](_0x4d6d0e['remoteUri']);_0x4d6d0e[_0xf3fd('0x45')]=intUtil[_0xf3fd('0x44')](_0x4d6d0e['serverUrl']);if(_0x494109&&_0x494109[_0xf3fd('0x46')]){logger['info']('['+_0x18fa3c[_0xf3fd('0x5c')][_0xf3fd('0x5d')]()+']','Recording\x20is\x20enabled!');_0x18fa3c['recordingURL']=util[_0xf3fd('0xc')](_0xf3fd('0x48'),_0x4d6d0e['serverUrl'],_0x18fa3c['uniqueid'],md5(_0x18fa3c[_0xf3fd('0x49')]));}else{_0x18fa3c[_0xf3fd('0x4a')]='';}headers[_0xf3fd('0x4b')]=getAuth(_0x4d6d0e);return getUser(_0x4d6d0e,'')['then'](function(_0x5caa8d){_0x3ba435=_0x5caa8d;logger[_0xf3fd('0xa')](_0xf3fd('0x4c'),_0x3ba435['id']);return getEndUser(_0x4d6d0e,_0x18fa3c[_0xf3fd('0x5e')],_0x18fa3c[_0xf3fd('0xe')]);})[_0xf3fd('0x1c')](function(_0x90d513){_0x507a8b=_0x90d513;logger[_0xf3fd('0xa')](_0xf3fd('0x57'),_0x507a8b['id']);return getTicket(_0x4d6d0e,_0x3ba435,_0x507a8b,_0xb97720,_0x18fa3c);})[_0xf3fd('0x1c')](function(_0x39b732){if(_0x39b732){logger['info']('Ticket\x20created!');logger[_0xf3fd('0xa')](_0xf3fd('0x58'),_0x39b732['id']);}})[_0xf3fd('0x4f')](function(_0x436d6a){logger[_0xf3fd('0x50')]('['+_0x18fa3c[_0xf3fd('0x5c')][_0xf3fd('0x5d')]()+']',JSON[_0xf3fd('0x32')](_0x436d6a));});}; \ 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 6054d99..8b6d67e 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 _0xa0f6=['lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminEmail','adminId','Admin\x20found:','catch','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','endUserId','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','format','YYYY-MM-DDTHH:mm:ss','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','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','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration'];(function(_0x2d850f,_0x228bf7){var _0xf2df20=function(_0x3a1c3a){while(--_0x3a1c3a){_0x2d850f['push'](_0x2d850f['shift']());}};_0xf2df20(++_0x228bf7);}(_0xa0f6,0x164));var _0x6a0f=function(_0x3bd23c,_0x32aeac){_0x3bd23c=_0x3bd23c-0x0;var _0x599e6f=_0xa0f6[_0x3bd23c];return _0x599e6f;};'use strict';var _=require(_0x6a0f('0x0'));var rp=require(_0x6a0f('0x1'));var md5=require('md5');var util=require(_0x6a0f('0x2'));var moment=require(_0x6a0f('0x3'));var Promise=require(_0x6a0f('0x4'));var Redis=require(_0x6a0f('0x5'));var intUtil=require(_0x6a0f('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6a0f('0x7'))('freshsales');config[_0x6a0f('0x8')]=_['defaults'](config['redis'],{'host':_0x6a0f('0x9'),'port':0x18eb});var io=require(_0x6a0f('0xa'))(new Redis(config[_0x6a0f('0x8')]));function getAdminId(_0x590b55,_0x39bbca,_0x24be4d,_0xbc76c9){return new Promise(function(_0x540e6f,_0x50e0e3){var _0x42e5ac=![];var _0x2a874e={'method':'GET','uri':_0xbc76c9+_0x6a0f('0xb'),'json':!![]};_0x2a874e[_0x6a0f('0xc')]=_0x24be4d;logger[_0x6a0f('0xd')](_0x6a0f('0xe'));return rp(_0x2a874e)[_0x6a0f('0xf')](function(_0x16f644){if(_0x16f644){var _0x3fd245=_0x16f644['users'];var _0x3e2ac5=null;for(_0x3e2ac5=0x0;_0x3e2ac5<_0x3fd245['length'];_0x3e2ac5++){if(_0x3fd245[_0x3e2ac5][_0x6a0f('0x10')]===_0x590b55[_0x6a0f('0x11')]){_0x590b55[_0x6a0f('0x12')]=_0x3fd245[_0x3e2ac5]['id'];_0x42e5ac=!![];}}if(_0x42e5ac){logger[_0x6a0f('0xd')](_0x6a0f('0x13'),_0x590b55[_0x6a0f('0x12')]);_0x540e6f(_0x590b55);}else{_0x50e0e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x50e0e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6a0f('0x14')](function(_0x1bb682){logger['error']('['+[_0x39bbca['toUpperCase']()]+']',_0x1bb682[_0x6a0f('0x15')]);_0x50e0e3(_0x1bb682);});});}function getUser(_0x34a793,_0x16e5c4,_0x5a7c01){return function(_0x162ae4){return new Promise(function(_0x291a35,_0x5bf4c9){var _0x2c638f={'method':_0x6a0f('0x16'),'uri':_0x5a7c01+'/api/selector/owners','json':!![]};_0x2c638f[_0x6a0f('0xc')]=_0x16e5c4;logger[_0x6a0f('0xd')](_0x6a0f('0x17'));return rp(_0x2c638f)['then'](function(_0x34e6ef){if(_0x34e6ef){var _0x580bde=_0x34e6ef['users'];var _0x45fc64=![];var _0x30c718=null;if(_0x162ae4[_0x6a0f('0x18')]!==null){logger[_0x6a0f('0xd')](_0x6a0f('0x19'),_0x162ae4['agentEmail']);_0x162ae4[_0x6a0f('0x1a')]=_0x162ae4[_0x6a0f('0x18')];for(_0x30c718=0x0;_0x30c718<_0x580bde[_0x6a0f('0x1b')];_0x30c718++){if(_0x580bde[_0x30c718][_0x6a0f('0x10')]===_0x162ae4['agentEmail']){_0x45fc64=!![];_0x162ae4[_0x6a0f('0x1c')]=_0x580bde[_0x30c718]['id'];logger[_0x6a0f('0xd')](_0x6a0f('0x1d'),_0x162ae4['userId']);}}}if(!_0x45fc64){logger['info'](_0x6a0f('0x1e'));_0x162ae4[_0x6a0f('0x1a')]=_0x162ae4['adminEmail'];_0x162ae4[_0x6a0f('0x1c')]=_0x162ae4[_0x6a0f('0x12')];_0x45fc64=!![];}if(_0x45fc64){_0x291a35(_0x162ae4);}else{_0x5bf4c9({'statusCode':0x194,'message':_0x6a0f('0x1f')});}}else{_0x5bf4c9({'statusCode':0x194,'message':_0x6a0f('0x1f')});}})[_0x6a0f('0x14')](function(_0x5bce42){logger[_0x6a0f('0x20')]('['+[_0x34a793[_0x6a0f('0x21')]()]+']',_0x5bce42[_0x6a0f('0x15')]);_0x5bf4c9(_0x5bce42);});});};}function getEndUser(_0x2049b4,_0x30819d,_0x53b07c){return function(_0x4e7118){return new Promise(function(_0x31ae10,_0x17e546){var _0x2ccea7=0x0;var _0x4788be={'method':_0x6a0f('0x16'),'uri':_0x53b07c+_0x6a0f('0x22'),'json':!![]};_0x4788be[_0x6a0f('0xc')]=_0x30819d;logger[_0x6a0f('0xd')](_0x6a0f('0x23'));return rp(_0x4788be)['then'](function(_0x57c5b3){_0x57c5b3[_0x6a0f('0x24')][_0x6a0f('0x25')](function(_0x5d91dd){if(_0x5d91dd[_0x6a0f('0x26')]===_0x6a0f('0x27')){_0x2ccea7=_0x5d91dd['id'];}});})[_0x6a0f('0xf')](function(){logger[_0x6a0f('0xd')](_0x6a0f('0x28'));var _0x136c11={'method':_0x6a0f('0x16'),'uri':_0x53b07c+_0x6a0f('0x29')+_0x2ccea7,'json':!![]};_0x136c11[_0x6a0f('0xc')]=_0x30819d;return rp(_0x136c11);})[_0x6a0f('0xf')](function(_0x4b53f8){logger['info'](_0x6a0f('0x2a'),_0x4e7118[_0x6a0f('0x2b')]);if(_0x4b53f8[_0x6a0f('0x2c')][_0x6a0f('0x1b')]>0x0){var _0x466c7a=_['find'](_0x4b53f8['contacts'],function(_0x11d27c){if(_0x11d27c['work_number']===_0x4e7118[_0x6a0f('0x2b')]||_0x11d27c['mobile_number']===_0x4e7118['contactNumber']){return _0x11d27c;}});if(_0x466c7a){_0x4e7118[_0x6a0f('0x2d')]=_0x466c7a['id'];logger[_0x6a0f('0xd')]('Contact\x20found:',_0x4e7118[_0x6a0f('0x2d')]);_0x31ae10(_0x4e7118);}else{return createEndUser(_0x4e7118,_0x2049b4,_0x30819d,_0x53b07c)[_0x6a0f('0xf')](function(_0x33209e){logger[_0x6a0f('0xd')](_0x6a0f('0x2e'),_0x4e7118[_0x6a0f('0x2d')]);_0x31ae10(_0x33209e);});}}else{return createEndUser(_0x4e7118,_0x2049b4,_0x30819d,_0x53b07c)['then'](function(_0xd560e4){logger['info'](_0x6a0f('0x2e'),_0x4e7118[_0x6a0f('0x2d')]);_0x31ae10(_0xd560e4);});}})['catch'](function(_0x298db1){throw new Error(_0x298db1[_0x6a0f('0x15')]);});});};}function createEndUser(_0x48b10d,_0x39f559,_0x4e6695,_0x663c9b){return new Promise(function(_0x14d321,_0x1705b7){var _0x553def=moment();var _0x527028={'method':_0x6a0f('0x2f'),'uri':_0x663c9b+_0x6a0f('0x30'),'body':{'contact':{'last_name':_0x48b10d[_0x6a0f('0x2b')],'work_number':_0x48b10d[_0x6a0f('0x2b')],'mobile_number':_0x48b10d[_0x6a0f('0x2b')],'owner_id':_0x48b10d['userId'],'created_at':_0x553def['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x527028[_0x6a0f('0xc')]=_0x4e6695;logger[_0x6a0f('0xd')](_0x6a0f('0x31'));return rp(_0x527028)['then'](function(_0x5c86f6){_0x48b10d[_0x6a0f('0x2d')]=_0x5c86f6[_0x6a0f('0x32')]['id'];_0x14d321(_0x48b10d);})[_0x6a0f('0x14')](function(_0x58694f){logger[_0x6a0f('0x20')]('['+[_0x39f559[_0x6a0f('0x21')]()]+']',_0x58694f[_0x6a0f('0x15')]);_0x1705b7(_0x58694f[_0x6a0f('0x15')]);});});}function getTicket(_0x374508,_0x415cbd,_0xc4671,_0x54a76e,_0x4d59f9){return function(_0x195ecd){logger[_0x6a0f('0xd')](_0x6a0f('0x33'));return new Promise(function(_0x251487,_0x4bee80){var _0x50c3fb=moment();var _0x33c0ea={'method':_0x6a0f('0x2f'),'uri':_0xc4671+_0x6a0f('0x34'),'body':{'title':intUtil[_0x6a0f('0x35')](_0x54a76e[_0x6a0f('0x36')],_0x4d59f9,'\x20'),'description':intUtil[_0x6a0f('0x35')](_0x54a76e[_0x6a0f('0x37')],_0x4d59f9,'\x0a'),'owner_id':_0x195ecd[_0x6a0f('0x1c')],'creater_id':_0x195ecd[_0x6a0f('0x12')],'targetable_id':_0x195ecd[_0x6a0f('0x2d')],'targetable_type':_0x6a0f('0x38'),'created_at':_0x50c3fb['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x50c3fb[_0x6a0f('0x39')](0x1e,'m')[_0x6a0f('0x3a')](_0x6a0f('0x3b'))},'json':!![]};_0x33c0ea[_0x6a0f('0xc')]=_0x415cbd;return rp(_0x33c0ea)[_0x6a0f('0xf')](function(_0x42af38){_0x195ecd[_0x6a0f('0x3c')]=_0x42af38['task']['id'];logger['info'](_0x6a0f('0x3d'),_0x195ecd[_0x6a0f('0x3c')]);_0x251487(_0x195ecd);})[_0x6a0f('0x14')](function(_0x5a821f){logger[_0x6a0f('0x20')]('['+[_0x374508[_0x6a0f('0x21')]()]+']',_0x5a821f[_0x6a0f('0x15')]);_0x4bee80(_0x5a821f[_0x6a0f('0x15')]);});});};}function emit(_0x2ab31b,_0x502e99,_0x1e490b){var _0x53fde5={'uri':_0x2ab31b+_0x6a0f('0x3e')+_0x1e490b};io['to'](util['format']('user:%s',_0x502e99))[_0x6a0f('0x3f')](_0x6a0f('0x40'),_0x53fde5);}exports['cs']=function(_0x3827b6,_0x3ec386,_0x1a2466,_0x5959a4,_0x1a6de8,_0x5e472a,_0x1e9e90,_0x59ae38){var _0x2cab99={};var _0x935a6e={'Authorization':_0x6a0f('0x41')+_0x5e472a[_0x6a0f('0x42')]};_0x5e472a['remoteUri']=intUtil[_0x6a0f('0x43')](_0x5e472a[_0x6a0f('0x44')]);_0x5e472a[_0x6a0f('0x45')]=intUtil[_0x6a0f('0x43')](_0x5e472a[_0x6a0f('0x45')]);var _0x46d8f7=_0x5e472a[_0x6a0f('0x44')];_0x2cab99['adminEmail']=_0x5e472a[_0x6a0f('0x46')];_0x2cab99[_0x6a0f('0x2b')]=_0x59ae38['toLowerCase']()===_0x6a0f('0x47')?_0x3ec386[_0x6a0f('0x48')]:_0x3ec386[_0x6a0f('0x49')];_0x2cab99[_0x6a0f('0x4a')]=_0x59ae38===_0x6a0f('0x4b')||_0x59ae38===_0x6a0f('0x4c')?_0x6a0f('0x4b'):'outbound';if(_0x5959a4){_0x2cab99[_0x6a0f('0x18')]=_0x5959a4[_0x6a0f('0x10')];}var _0x363285=util[_0x6a0f('0x3a')](_0x6a0f('0x4d'),_0x5e472a[_0x6a0f('0x45')],_0x3ec386[_0x6a0f('0x4e')],md5(_0x3ec386[_0x6a0f('0x4e')]));if(_0x1a6de8&&_0x1a6de8[_0x6a0f('0x4f')]){logger[_0x6a0f('0xd')](_0x6a0f('0x50'),_0x6a0f('0x51'));_0x3ec386[_0x6a0f('0x52')]=_0x363285;}else if(_0x1e9e90&&_0x1e9e90['recordingFormat']&&_0x1e9e90[_0x6a0f('0x53')]!==_0x6a0f('0x54')){logger['info'](_0x6a0f('0x55'),'Recording\x20is\x20enabled!');_0x3ec386['recordingURL']=_0x363285;}else{_0x3ec386[_0x6a0f('0x52')]='';}return getAdminId(_0x2cab99,_0x59ae38,_0x935a6e,_0x46d8f7)['then'](getUser(_0x59ae38,_0x935a6e,_0x46d8f7))[_0x6a0f('0xf')](getEndUser(_0x59ae38,_0x935a6e,_0x46d8f7))[_0x6a0f('0xf')](getTicket(_0x59ae38,_0x935a6e,_0x46d8f7,_0x1a2466,_0x3ec386))[_0x6a0f('0xf')](function(_0x352dc6){logger[_0x6a0f('0xd')](util[_0x6a0f('0x3a')](_0x6a0f('0x56'),_0x352dc6['ticketId']));if(_0x59ae38!==_0x6a0f('0x4c')){logger[_0x6a0f('0xd')]('['+[_0x59ae38[_0x6a0f('0x21')]()]+']',_0x6a0f('0x57'));emit(_0x46d8f7,_0x5959a4['name'],_0x352dc6[_0x6a0f('0x2d')]);}})['catch'](function(_0x136db5){logger[_0x6a0f('0x20')]('['+[_0x59ae38[_0x6a0f('0x21')]()]+_0x6a0f('0x58'),util['inspect'](_0x136db5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3a57=['POST','/api/tasks','getString','Subjects','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','then','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','Getting\x20user\x20list','users','agentEmail','userEmail','email','userId','User\x20found:','Admin\x20selected','catch','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','Searching\x20contact\x20with\x20phone','contactNumber','find','contacts','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task'];(function(_0xbe62f3,_0x4d34e1){var _0x55b795=function(_0x45dc6a){while(--_0x45dc6a){_0xbe62f3['push'](_0xbe62f3['shift']());}};_0x55b795(++_0x4d34e1);}(_0x3a57,0x172));var _0x73a5=function(_0x484a44,_0x55fcc0){_0x484a44=_0x484a44-0x0;var _0x424b3e=_0x3a57[_0x484a44];return _0x424b3e;};'use strict';var _=require('lodash');var rp=require(_0x73a5('0x0'));var md5=require(_0x73a5('0x1'));var util=require(_0x73a5('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x73a5('0x3'));var intUtil=require('./util');var config=require(_0x73a5('0x4'));var logger=require(_0x73a5('0x5'))('freshsales');config[_0x73a5('0x6')]=_[_0x73a5('0x7')](config[_0x73a5('0x6')],{'host':_0x73a5('0x8'),'port':0x18eb});var io=require(_0x73a5('0x9'))(new Redis(config[_0x73a5('0x6')]));function getAdminId(_0x1abe89,_0x546ce9,_0x55c7a5,_0x4a0a85){return new Promise(function(_0xd527fb,_0x2158c1){var _0x125309=![];var _0x40427b={'method':_0x73a5('0xa'),'uri':_0x4a0a85+_0x73a5('0xb'),'json':!![]};_0x40427b['headers']=_0x55c7a5;logger['info']('Getting\x20admin\x20information');return rp(_0x40427b)[_0x73a5('0xc')](function(_0x1f51f0){if(_0x1f51f0){var _0x27ce0c=_0x1f51f0['users'];var _0x214185=null;for(_0x214185=0x0;_0x214185<_0x27ce0c[_0x73a5('0xd')];_0x214185++){if(_0x27ce0c[_0x214185]['email']===_0x1abe89[_0x73a5('0xe')]){_0x1abe89[_0x73a5('0xf')]=_0x27ce0c[_0x214185]['id'];_0x125309=!![];}}if(_0x125309){logger[_0x73a5('0x10')](_0x73a5('0x11'),_0x1abe89[_0x73a5('0xf')]);_0xd527fb(_0x1abe89);}else{_0x2158c1({'statusCode':0x194,'message':_0x73a5('0x12')});}}else{_0x2158c1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x41d9d1){logger[_0x73a5('0x13')]('['+[_0x546ce9[_0x73a5('0x14')]()]+']',_0x41d9d1[_0x73a5('0x15')]);_0x2158c1(_0x41d9d1);});});}function getUser(_0x458b3e,_0x3a09b0,_0x483e5a){return function(_0x471686){return new Promise(function(_0x55221a,_0x5cb216){var _0x104dfb={'method':_0x73a5('0xa'),'uri':_0x483e5a+_0x73a5('0xb'),'json':!![]};_0x104dfb[_0x73a5('0x16')]=_0x3a09b0;logger[_0x73a5('0x10')](_0x73a5('0x17'));return rp(_0x104dfb)['then'](function(_0x82f7a2){if(_0x82f7a2){var _0x37151f=_0x82f7a2[_0x73a5('0x18')];var _0x2bf6d9=![];var _0x437cad=null;if(_0x471686[_0x73a5('0x19')]!==null){logger[_0x73a5('0x10')]('Getting\x20user\x20with\x20email',_0x471686[_0x73a5('0x19')]);_0x471686[_0x73a5('0x1a')]=_0x471686[_0x73a5('0x19')];for(_0x437cad=0x0;_0x437cad<_0x37151f[_0x73a5('0xd')];_0x437cad++){if(_0x37151f[_0x437cad][_0x73a5('0x1b')]===_0x471686[_0x73a5('0x19')]){_0x2bf6d9=!![];_0x471686[_0x73a5('0x1c')]=_0x37151f[_0x437cad]['id'];logger['info'](_0x73a5('0x1d'),_0x471686['userId']);}}}if(!_0x2bf6d9){logger[_0x73a5('0x10')](_0x73a5('0x1e'));_0x471686[_0x73a5('0x1a')]=_0x471686[_0x73a5('0xe')];_0x471686[_0x73a5('0x1c')]=_0x471686[_0x73a5('0xf')];_0x2bf6d9=!![];}if(_0x2bf6d9){_0x55221a(_0x471686);}else{_0x5cb216({'statusCode':0x194,'message':_0x73a5('0x12')});}}else{_0x5cb216({'statusCode':0x194,'message':_0x73a5('0x12')});}})[_0x73a5('0x1f')](function(_0xe9c65f){logger['error']('['+[_0x458b3e[_0x73a5('0x14')]()]+']',_0xe9c65f['message']);_0x5cb216(_0xe9c65f);});});};}function getEndUser(_0x359fd8,_0x2b0440,_0x1be4de){return function(_0x5a42da){return new Promise(function(_0x1d2050,_0x24431d){var _0x53228c=0x0;var _0x18ff90={'method':_0x73a5('0xa'),'uri':_0x1be4de+_0x73a5('0x20'),'json':!![]};_0x18ff90[_0x73a5('0x16')]=_0x2b0440;logger[_0x73a5('0x10')](_0x73a5('0x21'));return rp(_0x18ff90)[_0x73a5('0xc')](function(_0x4e938c){_0x4e938c[_0x73a5('0x22')]['forEach'](function(_0x2f16fc){if(_0x2f16fc[_0x73a5('0x23')]==='All\x20Contacts'){_0x53228c=_0x2f16fc['id'];}});})[_0x73a5('0xc')](function(){logger[_0x73a5('0x10')]('Getting\x20contact\x20list');var _0x11903d={'method':_0x73a5('0xa'),'uri':_0x1be4de+'/api/contacts/view/'+_0x53228c,'json':!![]};_0x11903d[_0x73a5('0x16')]=_0x2b0440;return rp(_0x11903d);})[_0x73a5('0xc')](function(_0x43093b){logger[_0x73a5('0x10')](_0x73a5('0x24'),_0x5a42da[_0x73a5('0x25')]);if(_0x43093b['contacts'][_0x73a5('0xd')]>0x0){var _0x5bdb42=_[_0x73a5('0x26')](_0x43093b[_0x73a5('0x27')],function(_0x119bd5){if(_0x119bd5['work_number']===_0x5a42da[_0x73a5('0x25')]||_0x119bd5[_0x73a5('0x28')]===_0x5a42da[_0x73a5('0x25')]){return _0x119bd5;}});if(_0x5bdb42){_0x5a42da[_0x73a5('0x29')]=_0x5bdb42['id'];logger[_0x73a5('0x10')](_0x73a5('0x2a'),_0x5a42da['endUserId']);_0x1d2050(_0x5a42da);}else{return createEndUser(_0x5a42da,_0x359fd8,_0x2b0440,_0x1be4de)[_0x73a5('0xc')](function(_0x36c69a){logger[_0x73a5('0x10')](_0x73a5('0x2b'),_0x5a42da[_0x73a5('0x29')]);_0x1d2050(_0x36c69a);});}}else{return createEndUser(_0x5a42da,_0x359fd8,_0x2b0440,_0x1be4de)['then'](function(_0x51b5c8){logger[_0x73a5('0x10')](_0x73a5('0x2b'),_0x5a42da[_0x73a5('0x29')]);_0x1d2050(_0x51b5c8);});}})[_0x73a5('0x1f')](function(_0x337ab9){throw new Error(_0x337ab9[_0x73a5('0x15')]);});});};}function createEndUser(_0x5f4bad,_0x1593f6,_0x4bb6af,_0x4fed29){return new Promise(function(_0x194b01,_0x2bb077){var _0x293e26=moment();var _0x4d650a={'method':'POST','uri':_0x4fed29+_0x73a5('0x2c'),'body':{'contact':{'last_name':_0x5f4bad[_0x73a5('0x25')],'work_number':_0x5f4bad['contactNumber'],'mobile_number':_0x5f4bad[_0x73a5('0x25')],'owner_id':_0x5f4bad[_0x73a5('0x1c')],'created_at':_0x293e26[_0x73a5('0x2d')](_0x73a5('0x2e'))}},'json':!![]};_0x4d650a['headers']=_0x4bb6af;logger['info'](_0x73a5('0x2f'));return rp(_0x4d650a)[_0x73a5('0xc')](function(_0x472500){_0x5f4bad[_0x73a5('0x29')]=_0x472500[_0x73a5('0x30')]['id'];_0x194b01(_0x5f4bad);})[_0x73a5('0x1f')](function(_0x348fa7){logger[_0x73a5('0x13')]('['+[_0x1593f6[_0x73a5('0x14')]()]+']',_0x348fa7['message']);_0x2bb077(_0x348fa7[_0x73a5('0x15')]);});});}function getTicket(_0x5ca293,_0x1b0d47,_0x136ae5,_0x41e6d0,_0x593b12){return function(_0x179c3d){logger[_0x73a5('0x10')](_0x73a5('0x31'));return new Promise(function(_0x257f8b,_0x522cf3){var _0x107cfd=moment();var _0x38f973={'method':_0x73a5('0x32'),'uri':_0x136ae5+_0x73a5('0x33'),'body':{'title':intUtil[_0x73a5('0x34')](_0x41e6d0[_0x73a5('0x35')],_0x593b12,'\x20'),'description':intUtil[_0x73a5('0x34')](_0x41e6d0['Descriptions'],_0x593b12,'\x0a'),'owner_id':_0x179c3d[_0x73a5('0x1c')],'creater_id':_0x179c3d[_0x73a5('0xf')],'targetable_id':_0x179c3d[_0x73a5('0x29')],'targetable_type':_0x73a5('0x36'),'created_at':_0x107cfd['format'](_0x73a5('0x2e')),'due_date':_0x107cfd[_0x73a5('0x37')](0x1e,'m')[_0x73a5('0x2d')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x38f973[_0x73a5('0x16')]=_0x1b0d47;return rp(_0x38f973)[_0x73a5('0xc')](function(_0x51f8c5){_0x179c3d[_0x73a5('0x38')]=_0x51f8c5['task']['id'];logger[_0x73a5('0x10')](_0x73a5('0x39'),_0x179c3d[_0x73a5('0x38')]);_0x257f8b(_0x179c3d);})['catch'](function(_0x4f07ed){logger[_0x73a5('0x13')]('['+[_0x5ca293[_0x73a5('0x14')]()]+']',_0x4f07ed[_0x73a5('0x15')]);_0x522cf3(_0x4f07ed[_0x73a5('0x15')]);});});};}function emit(_0x44c6a1,_0x53e433,_0x51c03e){var _0x1c7e7e={'uri':_0x44c6a1+_0x73a5('0x3a')+_0x51c03e};io['to'](util[_0x73a5('0x2d')](_0x73a5('0x3b'),_0x53e433))[_0x73a5('0x3c')](_0x73a5('0x3d'),_0x1c7e7e);}exports['cs']=function(_0x1f8888,_0xfd704d,_0x42b51c,_0x2ef4f2,_0x5e7bf7,_0x26d955,_0x4e10e5,_0x46ae03){var _0x266f88={};var _0x134f25={'Authorization':_0x73a5('0x3e')+_0x26d955[_0x73a5('0x3f')]};_0x26d955[_0x73a5('0x40')]=intUtil[_0x73a5('0x41')](_0x26d955[_0x73a5('0x40')]);_0x26d955['serverUrl']=intUtil[_0x73a5('0x41')](_0x26d955[_0x73a5('0x42')]);var _0x4f7f0e=_0x26d955[_0x73a5('0x40')];_0x266f88['adminEmail']=_0x26d955['username'];_0x266f88[_0x73a5('0x25')]=_0x46ae03[_0x73a5('0x43')]()===_0x73a5('0x44')?_0xfd704d[_0x73a5('0x45')]:_0xfd704d[_0x73a5('0x46')];_0x266f88[_0x73a5('0x47')]=_0x46ae03===_0x73a5('0x48')||_0x46ae03==='unmanaged'?_0x73a5('0x48'):_0x73a5('0x44');if(_0x2ef4f2){_0x266f88[_0x73a5('0x19')]=_0x2ef4f2[_0x73a5('0x1b')];}var _0x57b439=util[_0x73a5('0x2d')](_0x73a5('0x49'),_0x26d955[_0x73a5('0x42')],_0xfd704d[_0x73a5('0x4a')],md5(_0xfd704d[_0x73a5('0x4a')]));if(_0x5e7bf7&&_0x5e7bf7['monitor_format']){logger[_0x73a5('0x10')](_0x73a5('0x4b'),_0x73a5('0x4c'));_0xfd704d['recordingURL']=_0x57b439;}else if(_0x4e10e5&&_0x4e10e5[_0x73a5('0x4d')]&&_0x4e10e5[_0x73a5('0x4d')]!=='none'){logger[_0x73a5('0x10')](_0x73a5('0x4e'),_0x73a5('0x4c'));_0xfd704d[_0x73a5('0x4f')]=_0x57b439;}else{_0xfd704d['recordingURL']='';}return getAdminId(_0x266f88,_0x46ae03,_0x134f25,_0x4f7f0e)['then'](getUser(_0x46ae03,_0x134f25,_0x4f7f0e))[_0x73a5('0xc')](getEndUser(_0x46ae03,_0x134f25,_0x4f7f0e))[_0x73a5('0xc')](getTicket(_0x46ae03,_0x134f25,_0x4f7f0e,_0x42b51c,_0xfd704d))['then'](function(_0x22fb27){logger['info'](util[_0x73a5('0x2d')](_0x73a5('0x50'),_0x22fb27[_0x73a5('0x38')]));if(_0x46ae03!=='unmanaged'){logger[_0x73a5('0x10')]('['+[_0x46ae03[_0x73a5('0x14')]()]+']',_0x73a5('0x51'));emit(_0x4f7f0e,_0x2ef4f2[_0x73a5('0x23')],_0x22fb27['endUserId']);}})[_0x73a5('0x1f')](function(_0xe5927){logger[_0x73a5('0x13')]('['+[_0x46ae03[_0x73a5('0x14')]()]+_0x73a5('0x52'),util[_0x73a5('0x53')](_0xe5927,{'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 96fa42c..5cb743f 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 _0x5eb8=['data1','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','toLowerCase','vtiger','freshsales','log','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','error','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','servicenow','exec','includes'];(function(_0x18b50e,_0x147270){var _0x24446a=function(_0x58c585){while(--_0x58c585){_0x18b50e['push'](_0x18b50e['shift']());}};_0x24446a(++_0x147270);}(_0x5eb8,0xb0));var _0x85eb=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x5eb8[_0x100e36];return _0x1df0c9;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x85eb('0x0'));var salesforce=require(_0x85eb('0x1'));var sugarcrm=require(_0x85eb('0x2'));var freshdesk=require(_0x85eb('0x3'));var zoho=require(_0x85eb('0x4'));var desk=require(_0x85eb('0x5'));var vtiger=require(_0x85eb('0x6'));var servicenow=require(_0x85eb('0x7'));var dynamics365=require(_0x85eb('0x8'));var freshsales=require(_0x85eb('0x9'));var integrations=[_0x85eb('0xa'),_0x85eb('0xb'),'sugarcrm',_0x85eb('0xc'),_0x85eb('0xd'),_0x85eb('0xe'),'vtiger',_0x85eb('0xf'),'freshsales',_0x85eb('0x10')];exports[_0x85eb('0x11')]=function(_0x673228,_0x29030b,_0x1dacf2,_0x73e6d0,_0x2c7fd3,_0x50ef6f){if(_0x1dacf2){if(_[_0x85eb('0x12')](integrations,_0x673228[_0x85eb('0x13')]['toLowerCase']())){try{var _0x2af376=null;var _0x784583='';var _0x2f42ba=_0x1dacf2[_0x673228[_0x85eb('0x13')]['toLowerCase']()];if(_0x2f42ba){var _0x548628=_0x2f42ba[_0x673228[_0x85eb('0x14')]];if(_0x548628){var _0x5c760a=_[_0x85eb('0x15')](_0x548628[_0x85eb('0x16')],{'id':parseInt(_0x673228[_0x85eb('0x17')],0xa)});if(_0x5c760a){if(_0x73e6d0){if(_0x2c7fd3&&_0x29030b[_0x85eb('0x18')]){_0x784583=_0x85eb('0x18');}else if(_0x29030b['routeId']){_0x784583=_0x85eb('0x19');}else{console['log'](_0x85eb('0x1a'),_0x29030b);}}else{_0x784583=_0x85eb('0x1b');}switch(_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')]()){case'zendesk':zendesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'salesforce':salesforce[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'sugarcrm':sugarcrm[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xc'):freshdesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xd'):zoho[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xe'):desk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1d'):vtiger[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1e'):freshsales['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case _0x85eb('0x10'):servicenow['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case'dynamics365':dynamics365['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;default:console[_0x85eb('0x1f')](_0x85eb('0x20'));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error']('[EXEC]',util[_0x85eb('0x22')](_0x85eb('0x23'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x17')]));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error'](_0x85eb('0x24'),util[_0x85eb('0x22')](_0x85eb('0x25'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x14')]));}}else{}}catch(_0x5dfc96){console[_0x85eb('0x26')](_0x5dfc96);}}}}; \ No newline at end of file +var _0xefda=['./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0xefda,0x96));var _0xaefd=function(_0x188ac2,_0x27a61a){_0x188ac2=_0x188ac2-0x0;var _0x135c31=_0xefda[_0x188ac2];return _0x135c31;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xaefd('0x1'));var sugarcrm=require(_0xaefd('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xaefd('0x3'));var desk=require(_0xaefd('0x4'));var vtiger=require(_0xaefd('0x5'));var servicenow=require(_0xaefd('0x6'));var dynamics365=require(_0xaefd('0x7'));var freshsales=require(_0xaefd('0x8'));var integrations=['zendesk',_0xaefd('0x9'),_0xaefd('0xa'),_0xaefd('0xb'),_0xaefd('0xc'),'desk',_0xaefd('0xd'),_0xaefd('0xe'),_0xaefd('0xf'),'servicenow'];exports['exec']=function(_0x54a3b1,_0xa6239d,_0x16b36e,_0x20135c,_0x35eea5,_0x10272a){if(_0x16b36e){if(_[_0xaefd('0x10')](integrations,_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]())){try{var _0x27be0f=null;var _0x382983='';var _0x2a310c=_0x16b36e[_0x54a3b1['data1'][_0xaefd('0x12')]()];if(_0x2a310c){var _0x4ac467=_0x2a310c[_0x54a3b1[_0xaefd('0x13')]];if(_0x4ac467){var _0x1725af=_[_0xaefd('0x14')](_0x4ac467[_0xaefd('0x15')],{'id':parseInt(_0x54a3b1['data3'],0xa)});if(_0x1725af){if(_0x20135c){if(_0x35eea5&&_0xa6239d[_0xaefd('0x16')]){_0x382983=_0xaefd('0x16');}else if(_0xa6239d[_0xaefd('0x17')]){_0x382983=_0xaefd('0x18');}else{console[_0xaefd('0x19')](_0xaefd('0x1a'),_0xa6239d);}}else{_0x382983=_0xaefd('0x1b');}switch(_0x54a3b1[_0xaefd('0x11')]['toLowerCase']()){case _0xaefd('0x1c'):zendesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x9'):salesforce[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xa'):sugarcrm[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xb'):freshdesk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xc'):zoho[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0x1d'):desk[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case'vtiger':vtiger[_0x382983](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a);break;case _0xaefd('0xf'):freshsales['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0x1e'):servicenow['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;case _0xaefd('0xe'):dynamics365['cs'](_0x54a3b1,_0xa6239d,_0x1725af,_0x20135c,_0x35eea5,_0x4ac467,_0x10272a,_0x382983);break;default:console[_0xaefd('0x19')](_0xaefd('0x1f'));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1['data1'][_0xaefd('0x12')]());_0x27be0f[_0xaefd('0x21')](_0xaefd('0x22'),util[_0xaefd('0x23')](_0xaefd('0x24'),_0x54a3b1['data1']['toLowerCase'](),_0x54a3b1['data3']));}}else{_0x27be0f=require(_0xaefd('0x20'))(_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')]());_0x27be0f['error'](_0xaefd('0x22'),util['format'](_0xaefd('0x25'),_0x54a3b1[_0xaefd('0x11')][_0xaefd('0x12')](),_0x54a3b1['data2']));}}else{}}catch(_0x435413){console[_0xaefd('0x21')](_0x435413);}}}}; \ 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 5c367f2..f7e761f 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 _0x2e14=['Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','toString','type','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','clientSecret','login','username','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','stringify','recordingFormat','none','email','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','ticketType','Task','utc','getString','Descriptions','WhoId','assign','create','validateEmail','sobject','find','execute','then','Email','info','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length'];(function(_0x1b341a,_0x727338){var _0x411f06=function(_0x4eb8c8){while(--_0x4eb8c8){_0x1b341a['push'](_0x1b341a['shift']());}};_0x411f06(++_0x727338);}(_0x2e14,0xae));var _0x42e1=function(_0x323bf6,_0x19aed6){_0x323bf6=_0x323bf6-0x0;var _0x18da88=_0x2e14[_0x323bf6];return _0x18da88;};'use strict';var _=require(_0x42e1('0x0'));var rp=require(_0x42e1('0x1'));var moment=require('moment');var BPromise=require(_0x42e1('0x2'));var md5=require('md5');var jsforce=require(_0x42e1('0x3'));var util=require(_0x42e1('0x4'));var Redis=require(_0x42e1('0x5'));var intUtil=require(_0x42e1('0x6'));var config=require(_0x42e1('0x7'));var logger=require(_0x42e1('0x8'))('salesforce');config[_0x42e1('0x9')]=_[_0x42e1('0xa')](config[_0x42e1('0x9')],{'host':_0x42e1('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x42e1('0x9')]));function emit(_0x19d42b,_0x53839f,_0x526007){io['to'](_0x19d42b)[_0x42e1('0xc')](_0x53839f,_0x526007);}function getTicket(_0x5292ee,_0x478678,_0x580160,_0xf2d0b1,_0x30b49b,_0x36c0e3,_0x48c063,_0x45d6df){var _0x293fb3={};if(_0xf2d0b1[_0x42e1('0xd')]===_0x42e1('0xe')){_0x293fb3=Object['assign']({},{'OwnerId':_0x478678['id'],'ActivityDate':moment[_0x42e1('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x42e1('0x10')](_0xf2d0b1['Subjects'],_0x30b49b,'\x20'),'Description':intUtil['getString'](_0xf2d0b1[_0x42e1('0x11')],_0x30b49b,'\x0a')},getCustomFields(_0x36c0e3,_0x30b49b));if(_0x580160){_0x293fb3[_0x42e1('0x12')]=_0x580160['id'];}}else if(_0xf2d0b1[_0x42e1('0xd')]==='Case'){_0x293fb3=Object[_0x42e1('0x13')]({},{'OwnerId':_0x478678['id'],'Subject':intUtil[_0x42e1('0x10')](_0xf2d0b1['Subjects'],_0x30b49b,'\x20'),'Description':intUtil[_0x42e1('0x10')](_0xf2d0b1[_0x42e1('0x11')],_0x30b49b,'\x0a')},getCustomFields(_0x36c0e3,_0x30b49b));if(_0x580160){_0x293fb3['ContactId']=_0x580160['id'];}}return _0x48c063['sobject'](_0xf2d0b1[_0x42e1('0xd')])[_0x42e1('0x14')](_0x293fb3);}function getUser(_0x4264fd,_0x3a70ab,_0x8476ee){if(!_['isNil'](_0x3a70ab)&&intUtil[_0x42e1('0x15')](_0x3a70ab)){var _0x57e7cb={'Email':_0x3a70ab};var _0x2e35f4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x8476ee[_0x42e1('0x16')]('User')[_0x42e1('0x17')](_0x57e7cb,_0x2e35f4)[_0x42e1('0x18')]()[_0x42e1('0x19')](function(_0x115f6b){if(_0x115f6b['length']){var _0x4d3c3c=_[_0x42e1('0x17')](_0x115f6b,function(_0x1e8b6d){return _0x1e8b6d[_0x42e1('0x1a')]===_0x3a70ab;});if(_0x4d3c3c){logger[_0x42e1('0x1b')]('Agent\x20%s\x20found.',_0x3a70ab);return BPromise[_0x42e1('0x1c')]({'id':_0x4d3c3c['Id'],'name':_0x4d3c3c[_0x42e1('0x1d')]});}}else{logger[_0x42e1('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3a70ab);return _0x8476ee[_0x42e1('0x1e')]()['then'](function(_0x299d8b){return BPromise[_0x42e1('0x1c')]({'id':_0x299d8b[_0x42e1('0x1f')],'name':_0x299d8b[_0x42e1('0x20')]});});}});}else{logger[_0x42e1('0x1b')](_0x42e1('0x21'),_0x3a70ab);return _0x8476ee[_0x42e1('0x1e')]()['then'](function(_0x185c85){return BPromise[_0x42e1('0x1c')]({'id':_0x185c85[_0x42e1('0x1f')],'name':_0x185c85[_0x42e1('0x20')]});});}}function getEndUser(_0x9adc6d,_0x1e39c5,_0x507752,_0x4e2572,_0x329bb8){var _0x2b72ec={'Phone':_0x4e2572};var _0xa1422c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x42e1('0x19')](function(){if(_0x1e39c5['ticketType']===_0x42e1('0xe')){logger[_0x42e1('0x1b')](_0x42e1('0x22'),_0x4e2572,_0x1e39c5[_0x42e1('0x23')]);switch(_0x1e39c5['moduleSearch']){case _0x42e1('0x24'):return _0x329bb8[_0x42e1('0x16')]('Contact')[_0x42e1('0x17')](_0x2b72ec,_0xa1422c)['execute']()[_0x42e1('0x19')](function(_0x406e68){if(_0x406e68&&_0x406e68[_0x42e1('0x25')]){return _0x406e68;}else{return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x26'))['find'](_0x2b72ec,_0xa1422c);}});case _0x42e1('0x27'):return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x28'))[_0x42e1('0x17')](_0x2b72ec,_0xa1422c)['execute']();case _0x42e1('0x29'):return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x26'))[_0x42e1('0x17')](_0x2b72ec,_0xa1422c);default:return null;}}else if(_0x1e39c5[_0x42e1('0xd')]==='Case'){logger[_0x42e1('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4e2572,_0x42e1('0x27'));return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x28'))[_0x42e1('0x17')](_0x2b72ec,_0xa1422c)[_0x42e1('0x18')]();}})[_0x42e1('0x19')](function(_0xbe87b5){if(_0xbe87b5&&_0xbe87b5[_0x42e1('0x25')]){var _0x25d6de=_[_0x42e1('0x17')](_0xbe87b5,function(_0x2761b6){return _0x2761b6[_0x42e1('0x2a')]===_0x4e2572;});if(_0x25d6de){return BPromise[_0x42e1('0x1c')]({'id':_0x25d6de['Id'],'name':_0x25d6de[_0x42e1('0x1d')],'phone':_0x25d6de['Phone']});}}})[_0x42e1('0x19')](function(_0x207ead){if(_0x207ead){logger['info'](_0x42e1('0x2b'),_0x4e2572);return BPromise[_0x42e1('0x1c')](_0x207ead);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x4e2572);var _0x1ca02d={'LastName':_0x507752!==_0x42e1('0x2c')?_0x507752:util[_0x42e1('0x2d')](_0x42e1('0x2e'),_0x4e2572),'Phone':_0x4e2572};if(_0x1e39c5[_0x42e1('0x2f')]){if(_0x1e39c5['moduleCreate']==='contact'){logger[_0x42e1('0x1b')](_0x42e1('0x30'),_0x4e2572,_0x1e39c5[_0x42e1('0x2f')]);}else if(_0x1e39c5[_0x42e1('0x2f')]==='lead'&&_0x1e39c5[_0x42e1('0xd')]===_0x42e1('0xe')){logger[_0x42e1('0x1b')](_0x42e1('0x30'),_0x4e2572,_0x1e39c5[_0x42e1('0x2f')]);_0x1ca02d[_0x42e1('0x31')]=_0x42e1('0x32');}else{return null;}}return _0x329bb8[_0x42e1('0x16')](_[_0x42e1('0x33')](_0x1e39c5['moduleCreate']))[_0x42e1('0x14')](_0x1ca02d);}});}function getCustomFields(_0x2874f5,_0x3a95ae){var _0x5592b8={};if(_0x2874f5['length']>0x0){_[_0x42e1('0x34')](_0x2874f5,function(_0x309bbe){if(_0x309bbe['type']===_0x42e1('0x35')&&_0x309bbe[_0x42e1('0x36')]){_0x5592b8[_0x309bbe[_0x42e1('0x36')]]=_0x309bbe['content'][_0x42e1('0x37')]();}else if(_0x309bbe[_0x42e1('0x38')]==='variable'&&_0x309bbe['variableName']&&_0x309bbe[_0x42e1('0x36')]){_0x3a95ae[_0x309bbe['variableName']]&&(_0x5592b8[_0x309bbe[_0x42e1('0x36')]]=_0x3a95ae[_0x309bbe['variableName']]['toString']());}else if(_0x309bbe[_0x42e1('0x38')]==='customVariable'&&_0x309bbe[_0x42e1('0x39')]&&_0x309bbe[_0x42e1('0x39')][_0x42e1('0x3a')]&&_0x309bbe[_0x42e1('0x36')]){_0x3a95ae[_0x309bbe[_0x42e1('0x39')][_0x42e1('0x3a')]['toLowerCase']()]&&(_0x5592b8[_0x309bbe[_0x42e1('0x36')]]=_0x3a95ae[_0x309bbe[_0x42e1('0x39')][_0x42e1('0x3a')][_0x42e1('0x3b')]()]['toString']());}});}return _0x5592b8;}function getConnection(_0x52ff59){var _0x41b2ad=_0x52ff59['password'][_0x42e1('0x3c')](_0x52ff59[_0x42e1('0x3d')]);var _0x52ae9a=new jsforce[(_0x42e1('0x3e'))]({'oauth2':{'loginUrl':_0x52ff59[_0x42e1('0x3f')]||'https://login.salesforce.com','clientId':_0x52ff59['clientId'],'clientSecret':_0x52ff59[_0x42e1('0x40')]}});return _0x52ae9a[_0x42e1('0x41')](_0x52ff59[_0x42e1('0x42')],_0x41b2ad)[_0x42e1('0x19')](function(){logger[_0x42e1('0x1b')]('Connection\x20established.');return _0x52ae9a;});}exports['queue']=function(_0x8a0bf5,_0x125248,_0x3f8c77,_0x16b7c2,_0x3d4ae3,_0x2a4d88){var _0x4f228e,_0x3af466,_0x58f88b,_0x55dc02;_0x2a4d88[_0x42e1('0x43')]=intUtil[_0x42e1('0x44')](_0x2a4d88[_0x42e1('0x43')]);_0x2a4d88[_0x42e1('0x3f')]=intUtil[_0x42e1('0x44')](_0x2a4d88['remoteUri']);if(_0x3d4ae3&&_0x3d4ae3[_0x42e1('0x45')]){logger[_0x42e1('0x1b')]('[QUEUE]',_0x42e1('0x46'));_0x125248[_0x42e1('0x47')]=util[_0x42e1('0x2d')](_0x42e1('0x48'),_0x2a4d88[_0x42e1('0x43')],_0x125248[_0x42e1('0x49')],md5(_0x125248[_0x42e1('0x49')]));}else{_0x125248['recordingURL']='';}return getConnection(_0x2a4d88)[_0x42e1('0x19')](function(_0x3ad3e0){_0x55dc02=_0x3ad3e0;return getUser(_0x2a4d88,_0x16b7c2['email'],_0x55dc02);})[_0x42e1('0x19')](function(_0x1ac437){_0x4f228e=_0x1ac437;return getEndUser(_0x2a4d88,_0x3f8c77,_0x125248[_0x42e1('0x4a')],_0x125248[_0x42e1('0x4b')],_0x55dc02);})[_0x42e1('0x19')](function(_0x179584){_0x3af466=_0x179584;return getTicket(_0x2a4d88,_0x4f228e,_0x3af466,_0x3f8c77,_0x125248,_0x3f8c77[_0x42e1('0x4c')],_0x55dc02,_0x42e1('0x4d'));})[_0x42e1('0x19')](function(_0xf88570){_0x58f88b=_0xf88570;logger['info'](_0x42e1('0x4e'),_0x58f88b['id']);logger['info'](_0x42e1('0x4f'),_0x58f88b['id'],_0x16b7c2[_0x42e1('0x3a')],_0x2a4d88[_0x42e1('0x38')]);switch(_0x2a4d88[_0x42e1('0x38')]){case'integrationTab':emit(util[_0x42e1('0x2d')](_0x42e1('0x50'),_0x16b7c2[_0x42e1('0x3a')]),_0x42e1('0x51'),{'recordId':_0x58f88b['id']});break;case _0x42e1('0x52'):emit(util[_0x42e1('0x2d')]('user:%s',_0x16b7c2[_0x42e1('0x3a')]),'trigger:browser:url',{'uri':util[_0x42e1('0x2d')](_0x42e1('0x53'),_0x55dc02[_0x42e1('0x54')],_0x58f88b['id'])});break;default:logger['error'](_0x42e1('0x55'));}})[_0x42e1('0x56')](function(_0x946764){logger[_0x42e1('0x57')](_0x42e1('0x58'),JSON[_0x42e1('0x59')](_0x946764));});};exports['outbound']=function(_0x57b218,_0x511a56,_0x7a231a,_0x3cf893,_0x6c9a71,_0x5def34,_0x2d3987){var _0x5740fb,_0x2547d5,_0x2f4000,_0x47d56b;_0x5def34['serverUrl']=intUtil[_0x42e1('0x44')](_0x5def34[_0x42e1('0x43')]);_0x5def34['remoteUri']=intUtil[_0x42e1('0x44')](_0x5def34[_0x42e1('0x3f')]);if(_0x2d3987&&_0x2d3987[_0x42e1('0x5a')]&&_0x2d3987[_0x42e1('0x5a')]!==_0x42e1('0x5b')){logger[_0x42e1('0x1b')]('[OUTBOUND]',_0x42e1('0x46'));_0x511a56['recordingURL']=util[_0x42e1('0x2d')](_0x42e1('0x48'),_0x5def34[_0x42e1('0x43')],_0x511a56[_0x42e1('0x49')],md5(_0x511a56['uniqueid']));}return getConnection(_0x5def34)[_0x42e1('0x19')](function(_0x5bb94d){_0x47d56b=_0x5bb94d;return getUser(_0x5def34,_0x3cf893[_0x42e1('0x5c')],_0x47d56b);})[_0x42e1('0x19')](function(_0x36d32f){_0x5740fb=_0x36d32f;return getEndUser(_0x5def34,_0x7a231a,_0x511a56[_0x42e1('0x5d')],_0x511a56['destcalleridnum'],_0x47d56b);})[_0x42e1('0x19')](function(_0x582472){_0x2547d5=_0x582472;return getTicket(_0x5def34,_0x5740fb,_0x2547d5,_0x7a231a,_0x511a56,_0x7a231a['Fields'],_0x47d56b,_0x42e1('0x5e'));})[_0x42e1('0x19')](function(_0x4aa494){_0x2f4000=_0x4aa494;logger[_0x42e1('0x1b')](_0x42e1('0x5f'),_0x2f4000['id']);logger[_0x42e1('0x1b')](_0x42e1('0x60'),_0x2f4000['id'],_0x3cf893[_0x42e1('0x3a')],_0x5def34[_0x42e1('0x38')]);switch(_0x5def34['type']){case'integrationTab':emit(util['format']('user:%s',_0x3cf893[_0x42e1('0x3a')]),'trigger:salesforce:display',{'recordId':_0x2f4000['id']});break;case _0x42e1('0x52'):emit(util[_0x42e1('0x2d')]('user:%s',_0x3cf893[_0x42e1('0x3a')]),_0x42e1('0x61'),{'uri':util[_0x42e1('0x2d')](_0x42e1('0x53'),_0x47d56b[_0x42e1('0x54')],_0x2f4000['id'])});break;default:logger[_0x42e1('0x57')](_0x42e1('0x62'),_0x42e1('0x63'));}})[_0x42e1('0x56')](function(_0x54a26d){logger[_0x42e1('0x57')]('[OUTBOUND]',JSON[_0x42e1('0x59')](_0x54a26d));});};exports[_0x42e1('0x64')]=function(_0x218d35,_0x5c2847,_0x23b642,_0xf20911,_0x22cfc1,_0x515ef9){var _0x3b1536,_0x1016cc,_0x55e42b,_0xf16ec1;_0x515ef9[_0x42e1('0x43')]=intUtil[_0x42e1('0x44')](_0x515ef9['serverUrl']);_0x515ef9[_0x42e1('0x3f')]=intUtil['stripTrailingSlash'](_0x515ef9[_0x42e1('0x3f')]);if(_0x22cfc1&&_0x22cfc1[_0x42e1('0x45')]){logger[_0x42e1('0x1b')]('['+_0x5c2847[_0x42e1('0x65')][_0x42e1('0x66')]()+']',_0x42e1('0x46'));_0x5c2847[_0x42e1('0x47')]=util[_0x42e1('0x2d')](_0x42e1('0x48'),_0x515ef9['serverUrl'],_0x5c2847[_0x42e1('0x49')],md5(_0x5c2847[_0x42e1('0x49')]));}else{_0x5c2847[_0x42e1('0x47')]='';}return getConnection(_0x515ef9)[_0x42e1('0x19')](function(_0x46e9ae){_0xf16ec1=_0x46e9ae;if(!_[_0x42e1('0x67')](_0xf20911)){return getUser(_0x515ef9,_0xf20911[_0x42e1('0x3a')],_0xf16ec1);}else{return getUser(_0x515ef9,null,_0xf16ec1);}})[_0x42e1('0x19')](function(_0x433643){_0x3b1536=_0x433643;return getEndUser(_0x515ef9,_0x23b642,_0x5c2847[_0x42e1('0x4a')],_0x5c2847[_0x42e1('0x4b')],_0xf16ec1);})[_0x42e1('0x19')](function(_0x450a3a){_0x1016cc=_0x450a3a;return getTicket(_0x515ef9,_0x3b1536,_0x1016cc,_0x23b642,_0x5c2847,_0x23b642['Fields'],_0xf16ec1);})[_0x42e1('0x19')](function(_0xc8535b){_0x55e42b=_0xc8535b;logger[_0x42e1('0x1b')]('['+_0x5c2847[_0x42e1('0x65')]['toUpperCase']()+_0x42e1('0x68'),_0x55e42b['id']);logger[_0x42e1('0x1b')]('['+_0x5c2847[_0x42e1('0x65')]['toUpperCase']()+_0x42e1('0x69'),_0x515ef9[_0x42e1('0x38')]);})['catch'](function(_0x56743c){logger[_0x42e1('0x57')]('['+_0x5c2847['lastevent'][_0x42e1('0x66')]()+']',JSON[_0x42e1('0x59')](_0x56743c));});}; \ No newline at end of file +var _0xcc46=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','%s/%s/e','stringify','unmanaged','isNil','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','assign','utc','getString','Subjects','WhoId','Case','Descriptions','ContactId','sobject','create','User','find','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','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Task','Company','No\x20Company','upperFirst','forEach','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','password','concat','securityToken','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL'];(function(_0x12840e,_0xc5687d){var _0x4e321d=function(_0x169eef){while(--_0x169eef){_0x12840e['push'](_0x12840e['shift']());}};_0x4e321d(++_0xc5687d);}(_0xcc46,0x105));var _0x6cc4=function(_0xbc1840,_0x2db64a){_0xbc1840=_0xbc1840-0x0;var _0x1aef24=_0xcc46[_0xbc1840];return _0x1aef24;};'use strict';var _=require('lodash');var rp=require(_0x6cc4('0x0'));var moment=require(_0x6cc4('0x1'));var BPromise=require(_0x6cc4('0x2'));var md5=require(_0x6cc4('0x3'));var jsforce=require(_0x6cc4('0x4'));var util=require(_0x6cc4('0x5'));var Redis=require(_0x6cc4('0x6'));var intUtil=require(_0x6cc4('0x7'));var config=require(_0x6cc4('0x8'));var logger=require(_0x6cc4('0x9'))(_0x6cc4('0xa'));config[_0x6cc4('0xb')]=_[_0x6cc4('0xc')](config[_0x6cc4('0xb')],{'host':_0x6cc4('0xd'),'port':0x18eb});var io=require(_0x6cc4('0xe'))(new Redis(config['redis']));function emit(_0x1a4ef5,_0x274817,_0x417ecb){io['to'](_0x1a4ef5)[_0x6cc4('0xf')](_0x274817,_0x417ecb);}function getTicket(_0x382726,_0x313f8a,_0x2bc97f,_0x1a2b86,_0x304595,_0x2fc623,_0x40f7d1,_0x51be3b){var _0x407783={};if(_0x1a2b86[_0x6cc4('0x10')]==='Task'){_0x407783=Object[_0x6cc4('0x11')]({},{'OwnerId':_0x313f8a['id'],'ActivityDate':moment[_0x6cc4('0x12')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x6cc4('0x13')](_0x1a2b86[_0x6cc4('0x14')],_0x304595,'\x20'),'Description':intUtil[_0x6cc4('0x13')](_0x1a2b86['Descriptions'],_0x304595,'\x0a')},getCustomFields(_0x2fc623,_0x304595));if(_0x2bc97f){_0x407783[_0x6cc4('0x15')]=_0x2bc97f['id'];}}else if(_0x1a2b86[_0x6cc4('0x10')]===_0x6cc4('0x16')){_0x407783=Object[_0x6cc4('0x11')]({},{'OwnerId':_0x313f8a['id'],'Subject':intUtil[_0x6cc4('0x13')](_0x1a2b86[_0x6cc4('0x14')],_0x304595,'\x20'),'Description':intUtil[_0x6cc4('0x13')](_0x1a2b86[_0x6cc4('0x17')],_0x304595,'\x0a')},getCustomFields(_0x2fc623,_0x304595));if(_0x2bc97f){_0x407783[_0x6cc4('0x18')]=_0x2bc97f['id'];}}return _0x40f7d1[_0x6cc4('0x19')](_0x1a2b86['ticketType'])[_0x6cc4('0x1a')](_0x407783);}function getUser(_0x4f828e,_0x3cf75e,_0x441e65){if(!_['isNil'](_0x3cf75e)&&intUtil['validateEmail'](_0x3cf75e)){var _0x135f72={'Email':_0x3cf75e};var _0x55fb52={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x441e65[_0x6cc4('0x19')](_0x6cc4('0x1b'))[_0x6cc4('0x1c')](_0x135f72,_0x55fb52)['execute']()[_0x6cc4('0x1d')](function(_0x2cbdb3){if(_0x2cbdb3[_0x6cc4('0x1e')]){var _0x1a6b5a=_[_0x6cc4('0x1c')](_0x2cbdb3,function(_0x10f253){return _0x10f253[_0x6cc4('0x1f')]===_0x3cf75e;});if(_0x1a6b5a){logger[_0x6cc4('0x20')](_0x6cc4('0x21'),_0x3cf75e);return BPromise[_0x6cc4('0x22')]({'id':_0x1a6b5a['Id'],'name':_0x1a6b5a[_0x6cc4('0x23')]});}}else{logger[_0x6cc4('0x20')](_0x6cc4('0x24'),_0x3cf75e);return _0x441e65[_0x6cc4('0x25')]()[_0x6cc4('0x1d')](function(_0xb2d21e){return BPromise[_0x6cc4('0x22')]({'id':_0xb2d21e[_0x6cc4('0x26')],'name':_0xb2d21e[_0x6cc4('0x27')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3cf75e);return _0x441e65[_0x6cc4('0x25')]()[_0x6cc4('0x1d')](function(_0x3ebf15){return BPromise[_0x6cc4('0x22')]({'id':_0x3ebf15[_0x6cc4('0x26')],'name':_0x3ebf15[_0x6cc4('0x27')]});});}}function getEndUser(_0x15fdbf,_0x4de5c0,_0x14290c,_0x3f5aaa,_0x5ce847){var _0x3d39f9={'Phone':_0x3f5aaa};var _0x59d617={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6cc4('0x22')]()[_0x6cc4('0x1d')](function(){if(_0x4de5c0[_0x6cc4('0x10')]==='Task'){logger[_0x6cc4('0x20')](_0x6cc4('0x28'),_0x3f5aaa,_0x4de5c0[_0x6cc4('0x29')]);switch(_0x4de5c0[_0x6cc4('0x29')]){case _0x6cc4('0x2a'):return _0x5ce847['sobject'](_0x6cc4('0x2b'))[_0x6cc4('0x1c')](_0x3d39f9,_0x59d617)[_0x6cc4('0x2c')]()[_0x6cc4('0x1d')](function(_0xa88c9b){if(_0xa88c9b&&_0xa88c9b[_0x6cc4('0x1e')]){return _0xa88c9b;}else{return _0x5ce847[_0x6cc4('0x19')](_0x6cc4('0x2d'))['find'](_0x3d39f9,_0x59d617);}});case'contact':return _0x5ce847['sobject'](_0x6cc4('0x2b'))[_0x6cc4('0x1c')](_0x3d39f9,_0x59d617)[_0x6cc4('0x2c')]();case _0x6cc4('0x2e'):return _0x5ce847[_0x6cc4('0x19')](_0x6cc4('0x2d'))[_0x6cc4('0x1c')](_0x3d39f9,_0x59d617);default:return null;}}else if(_0x4de5c0[_0x6cc4('0x10')]==='Case'){logger[_0x6cc4('0x20')](_0x6cc4('0x28'),_0x3f5aaa,_0x6cc4('0x2f'));return _0x5ce847[_0x6cc4('0x19')](_0x6cc4('0x2b'))[_0x6cc4('0x1c')](_0x3d39f9,_0x59d617)[_0x6cc4('0x2c')]();}})[_0x6cc4('0x1d')](function(_0x3e5540){if(_0x3e5540&&_0x3e5540[_0x6cc4('0x1e')]){var _0x3052c5=_[_0x6cc4('0x1c')](_0x3e5540,function(_0x3e551e){return _0x3e551e[_0x6cc4('0x30')]===_0x3f5aaa;});if(_0x3052c5){return BPromise[_0x6cc4('0x22')]({'id':_0x3052c5['Id'],'name':_0x3052c5['Name'],'phone':_0x3052c5['Phone']});}}})['then'](function(_0x40ba83){if(_0x40ba83){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x3f5aaa);return BPromise[_0x6cc4('0x22')](_0x40ba83);}else{logger[_0x6cc4('0x20')](_0x6cc4('0x31'),_0x3f5aaa);var _0x3daef9={'LastName':_0x14290c!==_0x6cc4('0x32')?_0x14290c:util[_0x6cc4('0x33')](_0x6cc4('0x34'),_0x3f5aaa),'Phone':_0x3f5aaa};if(_0x4de5c0['moduleCreate']){if(_0x4de5c0[_0x6cc4('0x35')]===_0x6cc4('0x2f')){logger[_0x6cc4('0x20')](_0x6cc4('0x36'),_0x3f5aaa,_0x4de5c0[_0x6cc4('0x35')]);}else if(_0x4de5c0[_0x6cc4('0x35')]===_0x6cc4('0x2e')&&_0x4de5c0['ticketType']===_0x6cc4('0x37')){logger[_0x6cc4('0x20')](_0x6cc4('0x36'),_0x3f5aaa,_0x4de5c0[_0x6cc4('0x35')]);_0x3daef9[_0x6cc4('0x38')]=_0x6cc4('0x39');}else{return null;}}return _0x5ce847[_0x6cc4('0x19')](_[_0x6cc4('0x3a')](_0x4de5c0[_0x6cc4('0x35')]))['create'](_0x3daef9);}});}function getCustomFields(_0x1953c2,_0x25bff7){var _0x4293e1={};if(_0x1953c2[_0x6cc4('0x1e')]>0x0){_[_0x6cc4('0x3b')](_0x1953c2,function(_0x38521c){if(_0x38521c[_0x6cc4('0x3c')]==='string'&&_0x38521c[_0x6cc4('0x3d')]){_0x4293e1[_0x38521c[_0x6cc4('0x3d')]]=_0x38521c[_0x6cc4('0x3e')][_0x6cc4('0x3f')]();}else if(_0x38521c[_0x6cc4('0x3c')]===_0x6cc4('0x40')&&_0x38521c[_0x6cc4('0x41')]&&_0x38521c[_0x6cc4('0x3d')]){_0x25bff7[_0x38521c[_0x6cc4('0x41')]]&&(_0x4293e1[_0x38521c[_0x6cc4('0x3d')]]=_0x25bff7[_0x38521c[_0x6cc4('0x41')]][_0x6cc4('0x3f')]());}else if(_0x38521c[_0x6cc4('0x3c')]==='customVariable'&&_0x38521c[_0x6cc4('0x42')]&&_0x38521c[_0x6cc4('0x42')][_0x6cc4('0x43')]&&_0x38521c['idField']){_0x25bff7[_0x38521c[_0x6cc4('0x42')][_0x6cc4('0x43')][_0x6cc4('0x44')]()]&&(_0x4293e1[_0x38521c[_0x6cc4('0x3d')]]=_0x25bff7[_0x38521c[_0x6cc4('0x42')]['name'][_0x6cc4('0x44')]()][_0x6cc4('0x3f')]());}});}return _0x4293e1;}function getConnection(_0x508aa7){var _0x2dba24=_0x508aa7[_0x6cc4('0x45')][_0x6cc4('0x46')](_0x508aa7[_0x6cc4('0x47')]);var _0x137b27=new jsforce['Connection']({'oauth2':{'loginUrl':_0x508aa7['remoteUri']||_0x6cc4('0x48'),'clientId':_0x508aa7['clientId'],'clientSecret':_0x508aa7[_0x6cc4('0x49')]}});return _0x137b27[_0x6cc4('0x4a')](_0x508aa7[_0x6cc4('0x4b')],_0x2dba24)[_0x6cc4('0x1d')](function(){logger[_0x6cc4('0x20')](_0x6cc4('0x4c'));return _0x137b27;});}exports[_0x6cc4('0x4d')]=function(_0x4d1f27,_0x4b4b21,_0x230467,_0x4a5e72,_0x297b9f,_0x1b4ccb){var _0x3565ed,_0x27e7bd,_0xa8ea38,_0x206307;_0x1b4ccb[_0x6cc4('0x4e')]=intUtil[_0x6cc4('0x4f')](_0x1b4ccb[_0x6cc4('0x4e')]);_0x1b4ccb[_0x6cc4('0x50')]=intUtil[_0x6cc4('0x4f')](_0x1b4ccb['remoteUri']);if(_0x297b9f&&_0x297b9f[_0x6cc4('0x51')]){logger[_0x6cc4('0x20')](_0x6cc4('0x52'),'Recording\x20is\x20enabled!');_0x4b4b21[_0x6cc4('0x53')]=util[_0x6cc4('0x33')](_0x6cc4('0x54'),_0x1b4ccb[_0x6cc4('0x4e')],_0x4b4b21['uniqueid'],md5(_0x4b4b21['uniqueid']));}else{_0x4b4b21[_0x6cc4('0x53')]='';}return getConnection(_0x1b4ccb)[_0x6cc4('0x1d')](function(_0x113dbb){_0x206307=_0x113dbb;return getUser(_0x1b4ccb,_0x4a5e72[_0x6cc4('0x55')],_0x206307);})['then'](function(_0x2a0eba){_0x3565ed=_0x2a0eba;return getEndUser(_0x1b4ccb,_0x230467,_0x4b4b21[_0x6cc4('0x56')],_0x4b4b21[_0x6cc4('0x57')],_0x206307);})[_0x6cc4('0x1d')](function(_0x4efd55){_0x27e7bd=_0x4efd55;return getTicket(_0x1b4ccb,_0x3565ed,_0x27e7bd,_0x230467,_0x4b4b21,_0x230467[_0x6cc4('0x58')],_0x206307,_0x6cc4('0x4d'));})['then'](function(_0x412985){_0xa8ea38=_0x412985;logger[_0x6cc4('0x20')](_0x6cc4('0x59'),_0xa8ea38['id']);logger[_0x6cc4('0x20')](_0x6cc4('0x5a'),_0xa8ea38['id'],_0x4a5e72[_0x6cc4('0x43')],_0x1b4ccb[_0x6cc4('0x3c')]);switch(_0x1b4ccb[_0x6cc4('0x3c')]){case'integrationTab':emit(util['format'](_0x6cc4('0x5b'),_0x4a5e72['name']),'trigger:salesforce:display',{'recordId':_0xa8ea38['id']});break;case _0x6cc4('0x5c'):emit(util[_0x6cc4('0x33')](_0x6cc4('0x5b'),_0x4a5e72[_0x6cc4('0x43')]),_0x6cc4('0x5d'),{'uri':util['format']('%s/%s/e',_0x206307[_0x6cc4('0x5e')],_0xa8ea38['id'])});break;default:logger[_0x6cc4('0x5f')](_0x6cc4('0x60'));}})[_0x6cc4('0x61')](function(_0x20b890){logger[_0x6cc4('0x5f')](_0x6cc4('0x52'),JSON['stringify'](_0x20b890));});};exports['outbound']=function(_0x2bcafe,_0x168319,_0x93cdac,_0x399597,_0x56c961,_0x3ab417,_0xdfb2da){var _0x1996dc,_0x4c56f4,_0x162a40,_0x5b5a93;_0x3ab417['serverUrl']=intUtil[_0x6cc4('0x4f')](_0x3ab417[_0x6cc4('0x4e')]);_0x3ab417[_0x6cc4('0x50')]=intUtil['stripTrailingSlash'](_0x3ab417[_0x6cc4('0x50')]);if(_0xdfb2da&&_0xdfb2da[_0x6cc4('0x62')]&&_0xdfb2da[_0x6cc4('0x62')]!==_0x6cc4('0x63')){logger['info'](_0x6cc4('0x64'),_0x6cc4('0x65'));_0x168319['recordingURL']=util[_0x6cc4('0x33')](_0x6cc4('0x54'),_0x3ab417[_0x6cc4('0x4e')],_0x168319[_0x6cc4('0x66')],md5(_0x168319[_0x6cc4('0x66')]));}return getConnection(_0x3ab417)[_0x6cc4('0x1d')](function(_0x372e7e){_0x5b5a93=_0x372e7e;return getUser(_0x3ab417,_0x399597[_0x6cc4('0x55')],_0x5b5a93);})[_0x6cc4('0x1d')](function(_0x53b929){_0x1996dc=_0x53b929;return getEndUser(_0x3ab417,_0x93cdac,_0x168319[_0x6cc4('0x67')],_0x168319['destcalleridnum'],_0x5b5a93);})['then'](function(_0x26711c){_0x4c56f4=_0x26711c;return getTicket(_0x3ab417,_0x1996dc,_0x4c56f4,_0x93cdac,_0x168319,_0x93cdac['Fields'],_0x5b5a93,'outbound');})[_0x6cc4('0x1d')](function(_0x1d714f){_0x162a40=_0x1d714f;logger[_0x6cc4('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x162a40['id']);logger[_0x6cc4('0x20')](_0x6cc4('0x68'),_0x162a40['id'],_0x399597[_0x6cc4('0x43')],_0x3ab417[_0x6cc4('0x3c')]);switch(_0x3ab417[_0x6cc4('0x3c')]){case _0x6cc4('0x69'):emit(util[_0x6cc4('0x33')](_0x6cc4('0x5b'),_0x399597['name']),_0x6cc4('0x6a'),{'recordId':_0x162a40['id']});break;case _0x6cc4('0x5c'):emit(util['format'](_0x6cc4('0x5b'),_0x399597[_0x6cc4('0x43')]),_0x6cc4('0x5d'),{'uri':util['format'](_0x6cc4('0x6b'),_0x5b5a93[_0x6cc4('0x5e')],_0x162a40['id'])});break;default:logger['error'](_0x6cc4('0x64'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x6cc4('0x61')](function(_0x44cb0d){logger[_0x6cc4('0x5f')](_0x6cc4('0x64'),JSON[_0x6cc4('0x6c')](_0x44cb0d));});};exports[_0x6cc4('0x6d')]=function(_0x36bd15,_0x848be,_0x17a6db,_0x392f6a,_0x3e6b0c,_0x3d2984){var _0x572979,_0x2856a3,_0x95087b,_0x3f45c9;_0x3d2984[_0x6cc4('0x4e')]=intUtil['stripTrailingSlash'](_0x3d2984[_0x6cc4('0x4e')]);_0x3d2984[_0x6cc4('0x50')]=intUtil['stripTrailingSlash'](_0x3d2984[_0x6cc4('0x50')]);if(_0x3e6b0c&&_0x3e6b0c[_0x6cc4('0x51')]){logger['info']('['+_0x848be['lastevent']['toUpperCase']()+']',_0x6cc4('0x65'));_0x848be[_0x6cc4('0x53')]=util[_0x6cc4('0x33')](_0x6cc4('0x54'),_0x3d2984[_0x6cc4('0x4e')],_0x848be[_0x6cc4('0x66')],md5(_0x848be['uniqueid']));}else{_0x848be[_0x6cc4('0x53')]='';}return getConnection(_0x3d2984)[_0x6cc4('0x1d')](function(_0x26e250){_0x3f45c9=_0x26e250;if(!_[_0x6cc4('0x6e')](_0x392f6a)){return getUser(_0x3d2984,_0x392f6a['name'],_0x3f45c9);}else{return getUser(_0x3d2984,null,_0x3f45c9);}})[_0x6cc4('0x1d')](function(_0x4272ab){_0x572979=_0x4272ab;return getEndUser(_0x3d2984,_0x17a6db,_0x848be[_0x6cc4('0x56')],_0x848be[_0x6cc4('0x57')],_0x3f45c9);})[_0x6cc4('0x1d')](function(_0x369b12){_0x2856a3=_0x369b12;return getTicket(_0x3d2984,_0x572979,_0x2856a3,_0x17a6db,_0x848be,_0x17a6db[_0x6cc4('0x58')],_0x3f45c9);})[_0x6cc4('0x1d')](function(_0xf6f1ee){_0x95087b=_0xf6f1ee;logger[_0x6cc4('0x20')]('['+_0x848be[_0x6cc4('0x6f')][_0x6cc4('0x70')]()+_0x6cc4('0x71'),_0x95087b['id']);logger[_0x6cc4('0x20')]('['+_0x848be['lastevent'][_0x6cc4('0x70')]()+_0x6cc4('0x72'),_0x3d2984[_0x6cc4('0x3c')]);})[_0x6cc4('0x61')](function(_0x4a42d9){logger[_0x6cc4('0x5f')]('['+_0x848be[_0x6cc4('0x6f')]['toUpperCase']()+']',JSON[_0x6cc4('0x6c')](_0x4a42d9));});}; \ 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 9602896..280b6e5 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x494659,_0x1b8e75){var _0x36a11d=function(_0x1b4e77){while(--_0x1b4e77){_0x494659['push'](_0x494659['shift']());}};_0x36a11d(++_0x1b8e75);}(_0x326f,0xd1));var _0xf326=function(_0x5c3370,_0x35d85a){_0x5c3370=_0x5c3370-0x0;var _0x551e8c=_0x326f[_0x5c3370];return _0x551e8c;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%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','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x9fe5c3,_0x3d2377){var _0x46f68f=function(_0x180695){while(--_0x180695){_0x9fe5c3['push'](_0x9fe5c3['shift']());}};_0x46f68f(++_0x3d2377);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x5fc3[_0x5416db];return _0x243e35;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'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 e38a0ad..2f78103 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 _0xc599=['Calls','Basic\x20%s','toString','base64','get_server_info','isNil','info','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','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','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','contacts','charAt','monitor_format','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','direction','length','forEach','variableName','push','idField','JSON','stringify'];(function(_0x13a4a2,_0x41870a){var _0xf13bd8=function(_0x34a66b){while(--_0x34a66b){_0x13a4a2['push'](_0x13a4a2['shift']());}};_0xf13bd8(++_0x41870a);}(_0xc599,0x1b2));var _0x9c59=function(_0x2071cc,_0x5d728e){_0x2071cc=_0x2071cc-0x0;var _0x31aa5d=_0xc599[_0x2071cc];return _0x31aa5d;};'use strict';var _=require('lodash');var rp=require(_0x9c59('0x0'));var BPromise=require('bluebird');var md5=require(_0x9c59('0x1'));var util=require(_0x9c59('0x2'));var Redis=require(_0x9c59('0x3'));var intUtil=require('./util');var config=require(_0x9c59('0x4'));var logger=require(_0x9c59('0x5'))(_0x9c59('0x6'));config[_0x9c59('0x7')]=_[_0x9c59('0x8')](config[_0x9c59('0x7')],{'host':_0x9c59('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x9c59('0xa'),'json':!![]};function emit(_0x5ae4ab,_0x1220ad,_0x4b87f2){io['to'](_0x5ae4ab)[_0x9c59('0xb')](_0x1220ad,_0x4b87f2);}function getTicket(_0x458903,_0x881b58,_0x120151,_0x4c13fd,_0x5e5bd8,_0x22a8cb,_0x4b8b43,_0x3f7ce2){logger['info'](_0x9c59('0xc'));var _0x49e217=new Date();var _0x55f952=[{'name':_0x9c59('0xd'),'value':intUtil[_0x9c59('0xe')](_0x4c13fd['Subjects'],_0x5e5bd8,'\x20')},{'name':'assigned_user_id','value':_0x881b58['id']},{'name':'created_by','value':_0x881b58['id']},{'name':'description','value':intUtil['getString'](_0x4c13fd[_0x9c59('0xf')],_0x5e5bd8,'\x0a')},{'name':_0x9c59('0x10'),'value':_0x49e217[_0x9c59('0x11')]()[_0x9c59('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0x9c59('0x13'),'value':'0'},{'name':_0x9c59('0x14'),'value':'15'},{'name':_0x9c59('0x15'),'value':_0x120151['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x120151[_0x9c59('0xd')]},{'name':_0x9c59('0x16'),'value':_0x3f7ce2}];if(_0x22a8cb[_0x9c59('0x17')]){_[_0x9c59('0x18')](_0x22a8cb,function(_0x3faae5){if(_0x5e5bd8[_0x3faae5[_0x9c59('0x19')]]){_0x55f952[_0x9c59('0x1a')]({'name':_0x3faae5[_0x9c59('0x1b')],'value':_0x5e5bd8[_0x3faae5['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'session':_0x4b8b43['id'],'module_name':_0x9c59('0x1e'),'name_value_list':_0x55f952})}});}function getAuth(_0x1925a1){return util['format'](_0x9c59('0x1f'),new Buffer(_0x1925a1['apiKey']+':X')[_0x9c59('0x20')](_0x9c59('0x21')));}function getServerInfo(_0x4dcc88){return request({'form':{'method':_0x9c59('0x22'),'input_type':_0x9c59('0x1c'),'response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'session':_0x4dcc88['id']})}});}function getUser(_0x1e5853,_0x58dadf,_0x7ffcdd){if(!_[_0x9c59('0x23')](_0x58dadf)){logger[_0x9c59('0x24')]('Getting\x20agent\x20with\x20name',_0x58dadf);return request({'form':{'method':_0x9c59('0x25'),'input_type':_0x9c59('0x1c'),'response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'session':_0x7ffcdd['id'],'module_name':'Employees','query':util[_0x9c59('0x26')](_0x9c59('0x27'),_0x58dadf),'order_by':'','offset':'0','select_fields':['id',_0x9c59('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9c59('0x28')](function(_0x27e6b2){if(_0x27e6b2[_0x9c59('0x29')][_0x9c59('0x17')]){var _0x190793=_['find'](_0x27e6b2[_0x9c59('0x29')],function(_0x9e8833){return _0x9e8833['name_value_list']['user_name'][_0x9c59('0x2a')]===_0x58dadf;});if(_0x190793){logger[_0x9c59('0x24')](_0x9c59('0x2b'));return BPromise[_0x9c59('0x2c')]({'id':_0x190793['name_value_list']['id'][_0x9c59('0x2a')],'name':_0x190793[_0x9c59('0x2d')][_0x9c59('0xd')][_0x9c59('0x2a')]});}}logger['info'](_0x9c59('0x2e'));return BPromise[_0x9c59('0x2c')]({'id':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x2f')][_0x9c59('0x2a')],'name':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x30')][_0x9c59('0x2a')]});});}else{logger[_0x9c59('0x24')](_0x9c59('0x31'));return BPromise[_0x9c59('0x2c')]({'id':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x2f')]['value'],'name':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x30')]['value']});}}function getEndUser(_0x4f42f7,_0x2e26cc,_0x288f12,_0x2c4d54){logger[_0x9c59('0x24')]('Searching\x20enduser\x20with\x20phone',_0x288f12);return request({'form':{'method':_0x9c59('0x25'),'input_type':_0x9c59('0x1c'),'response_type':'JSON','rest_data':JSON[_0x9c59('0x1d')]({'session':_0x2c4d54['id'],'module_name':_0x9c59('0x32'),'query':util['format'](_0x9c59('0x33'),_0x288f12),'order_by':'','offset':'0','select_fields':['id','name',_0x9c59('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9c59('0x28')](function(_0x4b8eca){if(_0x4b8eca[_0x9c59('0x29')]['length']){var _0x5079be=_[_0x9c59('0x35')](_0x4b8eca['entry_list'],function(_0x293818){return _0x293818['name_value_list']['phone_home']['value']===_0x288f12;});if(_0x5079be){logger[_0x9c59('0x24')](_0x9c59('0x36'));return BPromise[_0x9c59('0x2c')]({'id':_0x5079be[_0x9c59('0x2d')]['id'][_0x9c59('0x2a')],'name':_0x5079be[_0x9c59('0x2d')]['name'][_0x9c59('0x2a')],'phone':_0x5079be['name_value_list'][_0x9c59('0x34')][_0x9c59('0x2a')]});}}else{logger[_0x9c59('0x24')](_0x9c59('0x37'));return request({'form':{'method':_0x9c59('0x38'),'input_type':_0x9c59('0x1c'),'response_type':'JSON','rest_data':JSON[_0x9c59('0x1d')]({'session':_0x2c4d54['id'],'module_name':_0x9c59('0x32'),'name_value_list':[{'name':_0x9c59('0x39'),'value':_0x2e26cc!==_0x9c59('0x3a')?_0x2e26cc:util[_0x9c59('0x26')](_0x9c59('0x3b'),_0x288f12)},{'name':'phone_home','value':_0x288f12}]})}})[_0x9c59('0x28')](function(_0x2933c0){logger[_0x9c59('0x24')]('Enduser\x20created.');return BPromise[_0x9c59('0x2c')]({'id':_0x2933c0['id'],'name':_0x2933c0[_0x9c59('0x29')][_0x9c59('0x39')][_0x9c59('0x2a')],'phone':_0x2933c0['entry_list'][_0x9c59('0x34')][_0x9c59('0x2a')]});});}});}function request(_0x767e10){logger[_0x9c59('0x3c')](_0x9c59('0x3d'),JSON[_0x9c59('0x1d')](_0x767e10));return rp(_['merge'](def,_0x767e10));}function getTags(_0x593ccf,_0x4cd587){var _0x54cfec=[];if(_0x593ccf&&_0x593ccf[_0x9c59('0x17')]>0x0){_0x54cfec=_[_0x9c59('0x3e')](_0x593ccf,_0x4cd587);}return _0x54cfec;}function getCustomFields(_0x424113,_0x470c5e){var _0x242351=[];var _0x4ccbfe={'custom_fields':[]};if(_0x424113['length']>0x0){_[_0x9c59('0x18')](_0x424113,function(_0x1fd06b){if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x40')&&_0x1fd06b[_0x9c59('0x41')]&&!_0x1fd06b[_0x9c59('0x42')]){_0x4ccbfe[_0x1fd06b[_0x9c59('0x41')][_0x9c59('0x43')]()]=_0x1fd06b[_0x9c59('0x44')][_0x9c59('0x20')]();}else if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x40')&&_0x1fd06b['idField']&&_0x1fd06b[_0x9c59('0x42')]){_0x4ccbfe[_0x9c59('0x45')]['push']({'id':_0x1fd06b[_0x9c59('0x1b')],'value':_0x1fd06b[_0x9c59('0x44')][_0x9c59('0x20')]()});}else if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x46')&&_0x1fd06b[_0x9c59('0x19')]&&_0x1fd06b[_0x9c59('0x1b')]&&_0x1fd06b[_0x9c59('0x42')]){_0x470c5e[_0x1fd06b['variableName']]&&_0x4ccbfe[_0x9c59('0x45')]['push']({'id':_0x1fd06b[_0x9c59('0x1b')],'value':_0x470c5e[_0x1fd06b[_0x9c59('0x19')]][_0x9c59('0x20')]()});}else if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x47')&&_0x1fd06b[_0x9c59('0x48')]&&_0x1fd06b[_0x9c59('0x48')][_0x9c59('0xd')]&&_0x1fd06b['idField']&&_0x1fd06b[_0x9c59('0x42')]){_0x470c5e[_0x1fd06b[_0x9c59('0x48')][_0x9c59('0xd')][_0x9c59('0x43')]()]&&_0x4ccbfe[_0x9c59('0x45')][_0x9c59('0x1a')]({'id':_0x1fd06b[_0x9c59('0x1b')],'value':_0x470c5e[_0x1fd06b[_0x9c59('0x48')][_0x9c59('0xd')]['toLowerCase']()][_0x9c59('0x20')]()});}});}return _0x4ccbfe;}function getConnection(_0x44fe69){return request({'method':_0x9c59('0xa'),'form':{'method':_0x9c59('0x49'),'input_type':'JSON','response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'user_auth':{'user_name':_0x44fe69['username'],'password':_0x44fe69[_0x9c59('0x4a')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x9c59('0x28')](function(_0x8e2b39){var _0x3ecc91=_0x8e2b39;if(_0x3ecc91['id']){def[_0x9c59('0x4b')]=_0x3ecc91['id'];return BPromise[_0x9c59('0x2c')](_0x3ecc91);}else{throw new Error(util['format'](_0x9c59('0x4c'),_0x44fe69['id']));}});}function setRelationship(_0x38cf23,_0x36f6ef,_0x173523,_0x422fb0){return request({'form':{'method':_0x9c59('0x4d'),'input_type':_0x9c59('0x1c'),'response_type':'JSON','rest_data':JSON[_0x9c59('0x1d')]({'session':_0x38cf23['id'],'module_name':_0x9c59('0x1e'),'module_id':_0x173523['id'],'link_field_name':_0x422fb0,'related_ids':[_0x36f6ef['id']]})}});}exports['queue']=function(_0x280300,_0x373712,_0x226db6,_0x3581ba,_0xed2fe6,_0x55f0d8){var _0xd91886,_0x19cd40,_0xf31c4,_0xbf6918;_0x55f0d8[_0x9c59('0x4e')]=intUtil[_0x9c59('0x4f')](_0x55f0d8[_0x9c59('0x4e')]);_0x55f0d8['serverUrl']=intUtil['stripTrailingSlash'](_0x55f0d8[_0x9c59('0x50')]);def[_0x9c59('0x51')]=util[_0x9c59('0x26')](_0x9c59('0x52'),_0x55f0d8[_0x9c59('0x4e')]);if(_0xed2fe6&&_0xed2fe6['monitor_format']){logger[_0x9c59('0x24')]('[QUEUE]',_0x9c59('0x53'));_0x373712['recordingURL']=util[_0x9c59('0x26')](_0x9c59('0x54'),_0x55f0d8[_0x9c59('0x50')],_0x373712[_0x9c59('0x55')],md5(_0x373712[_0x9c59('0x55')]));}else{_0x373712[_0x9c59('0x56')]='';}return getConnection(_0x55f0d8)['then'](function(_0x4ca570){_0xbf6918=_0x4ca570;return getUser(_0x55f0d8,_0x3581ba[_0x9c59('0xd')],_0xbf6918);})[_0x9c59('0x28')](function(_0x2d167d){_0xd91886=_0x2d167d;logger[_0x9c59('0x24')]('The\x20User\x20ID\x20is:',_0xd91886['id']);return getEndUser(_0x55f0d8,_0x373712[_0x9c59('0x57')],_0x373712[_0x9c59('0x58')],_0xbf6918);})['then'](function(_0x13aa5a){_0x19cd40=_0x13aa5a;logger[_0x9c59('0x24')](_0x9c59('0x59'),_0x19cd40['id']);return getTicket(_0x55f0d8,_0xd91886,_0x19cd40,_0x226db6,_0x373712,_0x226db6[_0x9c59('0x5a')],_0xbf6918,_0x9c59('0x5b'));})[_0x9c59('0x28')](function(_0xfe27b9){_0xf31c4=_0xfe27b9;logger[_0x9c59('0x24')](_0x9c59('0x5c'));logger[_0x9c59('0x24')](_0x9c59('0x5d'),_0xf31c4['id']);return setRelationship(_0xbf6918,_0xd91886,_0xf31c4,_0x9c59('0x5e'));})['then'](function(){return setRelationship(_0xbf6918,_0x19cd40,_0xf31c4,'contacts');})[_0x9c59('0x28')](function(){return getServerInfo(_0xbf6918);})['then'](function(_0x1cb7f1){var _0x2bb4c3=parseInt(_0x1cb7f1[_0x9c59('0x5f')]['charAt'](0x0));var _0x2d7984=util[_0x9c59('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x55f0d8[_0x9c59('0x4e')],_0xf31c4['id']);if(_0x2bb4c3>0x6){_0x2d7984=util[_0x9c59('0x26')](_0x9c59('0x60'),_0x55f0d8[_0x9c59('0x4e')],_0xf31c4['id']);}logger[_0x9c59('0x24')](_0x9c59('0x61'),_0x9c59('0x62'));emit(util['format'](_0x9c59('0x63'),_0x3581ba[_0x9c59('0xd')]),_0x9c59('0x64'),{'uri':_0x2d7984});})[_0x9c59('0x65')](function(_0x32e560){logger[_0x9c59('0x66')](_0x9c59('0x61'),JSON[_0x9c59('0x1d')](_0x32e560));});};exports[_0x9c59('0x67')]=function(_0x4bd723,_0x30dc57,_0x13d148,_0x143a81,_0x555843,_0x45747a,_0x483ac5){var _0x293d05,_0x110027,_0x877b0a,_0x574ad2;_0x45747a[_0x9c59('0x4e')]=intUtil[_0x9c59('0x4f')](_0x45747a[_0x9c59('0x4e')]);_0x45747a['serverUrl']=intUtil[_0x9c59('0x4f')](_0x45747a['serverUrl']);def[_0x9c59('0x51')]=util[_0x9c59('0x26')](_0x9c59('0x52'),_0x45747a[_0x9c59('0x4e')]);if(_0x483ac5&&_0x483ac5[_0x9c59('0x68')]&&_0x483ac5['recordingFormat']!==_0x9c59('0x69')){logger[_0x9c59('0x24')](_0x9c59('0x6a'),_0x9c59('0x53'));_0x30dc57['recordingURL']=util[_0x9c59('0x26')](_0x9c59('0x54'),_0x45747a[_0x9c59('0x50')],_0x30dc57[_0x9c59('0x55')],md5(_0x30dc57[_0x9c59('0x55')]));}return getConnection(_0x45747a)[_0x9c59('0x28')](function(_0x240b13){_0x574ad2=_0x240b13;return getUser(_0x45747a,_0x143a81[_0x9c59('0xd')],_0x574ad2);})['then'](function(_0x5a86b7){_0x293d05=_0x5a86b7;logger[_0x9c59('0x24')](_0x9c59('0x6b'),_0x293d05['id']);return getEndUser(_0x45747a,_0x30dc57[_0x9c59('0x6c')],_0x30dc57[_0x9c59('0x6d')],_0x574ad2);})[_0x9c59('0x28')](function(_0x4b5e26){_0x110027=_0x4b5e26;logger[_0x9c59('0x24')](_0x9c59('0x59'),_0x110027['id']);return getTicket(_0x45747a,_0x293d05,_0x110027,_0x13d148,_0x30dc57,_0x13d148[_0x9c59('0x5a')],_0x574ad2,_0x9c59('0x6e'));})[_0x9c59('0x28')](function(_0x3a920b){_0x877b0a=_0x3a920b;logger[_0x9c59('0x24')](_0x9c59('0x5c'));logger[_0x9c59('0x24')](_0x9c59('0x5d'),_0x877b0a['id']);return setRelationship(_0x574ad2,_0x293d05,_0x877b0a,'users');})[_0x9c59('0x28')](function(){return setRelationship(_0x574ad2,_0x110027,_0x877b0a,_0x9c59('0x6f'));})[_0x9c59('0x28')](function(){return getServerInfo(_0x574ad2);})['then'](function(_0xd598d5){var _0x2f16fa=parseInt(_0xd598d5[_0x9c59('0x5f')][_0x9c59('0x70')](0x0));var _0x5f4616=util[_0x9c59('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x45747a[_0x9c59('0x4e')],_0x877b0a['id']);if(_0x2f16fa>0x6){_0x5f4616=util[_0x9c59('0x26')](_0x9c59('0x60'),_0x45747a[_0x9c59('0x4e')],_0x877b0a['id']);}logger[_0x9c59('0x24')](_0x9c59('0x6a'),_0x9c59('0x62'));emit(util[_0x9c59('0x26')]('user:%s',_0x143a81['name']),'trigger:browser:url',{'uri':_0x5f4616});})[_0x9c59('0x65')](function(_0x17dc1a){logger[_0x9c59('0x66')](_0x9c59('0x6a'),JSON[_0x9c59('0x1d')](_0x17dc1a));});};exports['unmanaged']=function(_0xeb6cd3,_0x2ca6be,_0x47bee7,_0x38d0f7,_0x440ec4,_0x100e31){var _0x1ed660,_0x2acb79,_0x390dc1,_0x19e975;_0x100e31[_0x9c59('0x4e')]=intUtil[_0x9c59('0x4f')](_0x100e31[_0x9c59('0x4e')]);_0x100e31[_0x9c59('0x50')]=intUtil[_0x9c59('0x4f')](_0x100e31[_0x9c59('0x50')]);def[_0x9c59('0x51')]=util['format'](_0x9c59('0x52'),_0x100e31[_0x9c59('0x4e')]);if(_0x440ec4&&_0x440ec4[_0x9c59('0x71')]){logger[_0x9c59('0x24')]('['+_0x2ca6be[_0x9c59('0x72')][_0x9c59('0x73')]()+']','Recording\x20is\x20enabled!');_0x2ca6be['recordingURL']=util[_0x9c59('0x26')](_0x9c59('0x54'),_0x100e31[_0x9c59('0x50')],_0x2ca6be[_0x9c59('0x55')],md5(_0x2ca6be[_0x9c59('0x55')]));}else{_0x2ca6be[_0x9c59('0x56')]='';}return getConnection(_0x100e31)[_0x9c59('0x28')](function(_0x40a419){_0x19e975=_0x40a419;if(!_[_0x9c59('0x23')](_0x38d0f7)){return getUser(_0x100e31,_0x38d0f7[_0x9c59('0xd')],_0x19e975);}else{return getUser(_0x100e31,null,_0x19e975);}})[_0x9c59('0x28')](function(_0x49feea){_0x1ed660=_0x49feea;logger['info'](_0x9c59('0x6b'),_0x1ed660['id']);return getEndUser(_0x100e31,_0x2ca6be['calleridname'],_0x2ca6be[_0x9c59('0x58')],_0x19e975);})[_0x9c59('0x28')](function(_0x379d79){_0x2acb79=_0x379d79;logger[_0x9c59('0x24')](_0x9c59('0x59'),_0x2acb79['id']);return getTicket(_0x100e31,_0x1ed660,_0x2acb79,_0x47bee7,_0x2ca6be,_0x47bee7[_0x9c59('0x5a')],_0x19e975,_0x9c59('0x5b'));})['then'](function(_0x4cee27){_0x390dc1=_0x4cee27;logger['info'](_0x9c59('0x5c'));logger[_0x9c59('0x24')](_0x9c59('0x5d'),_0x390dc1['id']);return setRelationship(_0x19e975,_0x1ed660,_0x390dc1,'users');})[_0x9c59('0x28')](function(){return setRelationship(_0x19e975,_0x2acb79,_0x390dc1,_0x9c59('0x6f'));})[_0x9c59('0x28')](function(){return getServerInfo(_0x19e975);})[_0x9c59('0x65')](function(_0x26b7d1){logger[_0x9c59('0x66')]('['+_0x2ca6be[_0x9c59('0x72')]['toUpperCase']()+']',JSON[_0x9c59('0x1d')](_0x26b7d1));});}; \ No newline at end of file +var _0xaac4=['Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_type','Contacts','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','isNil','info','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','length','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','toString','variable','custom_fields','push','customVariable','Variable','POST','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','charAt','trigger:browser:url','catch','unmanaged','lastevent','Inbound','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x36dd5d,_0x2010ab){var _0x30c52d=function(_0x584844){while(--_0x584844){_0x36dd5d['push'](_0x36dd5d['shift']());}};_0x30c52d(++_0x2010ab);}(_0xaac4,0x6c));var _0x4aac=function(_0x189e47,_0x4fa398){_0x189e47=_0x189e47-0x0;var _0x5c375b=_0xaac4[_0x189e47];return _0x5c375b;};'use strict';var _=require(_0x4aac('0x0'));var rp=require(_0x4aac('0x1'));var BPromise=require('bluebird');var md5=require(_0x4aac('0x2'));var util=require(_0x4aac('0x3'));var Redis=require(_0x4aac('0x4'));var intUtil=require('./util');var config=require(_0x4aac('0x5'));var logger=require(_0x4aac('0x6'))(_0x4aac('0x7'));config[_0x4aac('0x8')]=_[_0x4aac('0x9')](config['redis'],{'host':_0x4aac('0xa'),'port':0x18eb});var io=require(_0x4aac('0xb'))(new Redis(config[_0x4aac('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x645ec6,_0x59735a,_0x3ba0ea){io['to'](_0x645ec6)[_0x4aac('0xc')](_0x59735a,_0x3ba0ea);}function getTicket(_0x239771,_0x3e3567,_0x33551f,_0x4c151a,_0xabb74,_0x9660af,_0x103818,_0x2b771b){logger['info'](_0x4aac('0xd'));var _0x3fa571=new Date();var _0x2dbd54=[{'name':_0x4aac('0xe'),'value':intUtil[_0x4aac('0xf')](_0x4c151a[_0x4aac('0x10')],_0xabb74,'\x20')},{'name':_0x4aac('0x11'),'value':_0x3e3567['id']},{'name':'created_by','value':_0x3e3567['id']},{'name':_0x4aac('0x12'),'value':intUtil['getString'](_0x4c151a[_0x4aac('0x13')],_0xabb74,'\x0a')},{'name':'date_start','value':_0x3fa571[_0x4aac('0x14')]()['slice'](0x0,0x13)[_0x4aac('0x15')]('T','\x20')},{'name':_0x4aac('0x16'),'value':'0'},{'name':_0x4aac('0x17'),'value':'15'},{'name':'parent_id','value':_0x33551f['id']},{'name':_0x4aac('0x18'),'value':_0x4aac('0x19')},{'name':'parent_name','value':_0x33551f['name']},{'name':'direction','value':_0x2b771b}];if(_0x9660af['length']){_[_0x4aac('0x1a')](_0x9660af,function(_0x20353f){if(_0xabb74[_0x20353f[_0x4aac('0x1b')]]){_0x2dbd54['push']({'name':_0x20353f[_0x4aac('0x1c')],'value':_0xabb74[_0x20353f[_0x4aac('0x1b')]]});}});}return request({'form':{'method':_0x4aac('0x1d'),'input_type':_0x4aac('0x1e'),'response_type':_0x4aac('0x1e'),'rest_data':JSON[_0x4aac('0x1f')]({'session':_0x103818['id'],'module_name':_0x4aac('0x20'),'name_value_list':_0x2dbd54})}});}function getAuth(_0x2c26cc){return util[_0x4aac('0x21')](_0x4aac('0x22'),new Buffer(_0x2c26cc[_0x4aac('0x23')]+':X')['toString'](_0x4aac('0x24')));}function getServerInfo(_0x16eef9){return request({'form':{'method':'get_server_info','input_type':_0x4aac('0x1e'),'response_type':'JSON','rest_data':JSON[_0x4aac('0x1f')]({'session':_0x16eef9['id']})}});}function getUser(_0x23fb33,_0x34a384,_0x3d4836){if(!_[_0x4aac('0x25')](_0x34a384)){logger[_0x4aac('0x26')](_0x4aac('0x27'),_0x34a384);return request({'form':{'method':'get_entry_list','input_type':_0x4aac('0x1e'),'response_type':_0x4aac('0x1e'),'rest_data':JSON[_0x4aac('0x1f')]({'session':_0x3d4836['id'],'module_name':'Employees','query':util[_0x4aac('0x21')](_0x4aac('0x28'),_0x34a384),'order_by':'','offset':'0','select_fields':['id',_0x4aac('0xe'),_0x4aac('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4aac('0x2a')](function(_0x4dede8){if(_0x4dede8[_0x4aac('0x2b')]['length']){var _0x517759=_[_0x4aac('0x2c')](_0x4dede8[_0x4aac('0x2b')],function(_0x459028){return _0x459028[_0x4aac('0x2d')][_0x4aac('0x29')]['value']===_0x34a384;});if(_0x517759){logger[_0x4aac('0x26')](_0x4aac('0x2e'));return BPromise['resolve']({'id':_0x517759[_0x4aac('0x2d')]['id'][_0x4aac('0x2f')],'name':_0x517759['name_value_list'][_0x4aac('0xe')]['value']});}}logger['info'](_0x4aac('0x30'));return BPromise[_0x4aac('0x31')]({'id':_0x3d4836[_0x4aac('0x2d')]['user_id'][_0x4aac('0x2f')],'name':_0x3d4836[_0x4aac('0x2d')][_0x4aac('0x29')][_0x4aac('0x2f')]});});}else{logger[_0x4aac('0x26')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4aac('0x31')]({'id':_0x3d4836[_0x4aac('0x2d')][_0x4aac('0x32')][_0x4aac('0x2f')],'name':_0x3d4836['name_value_list'][_0x4aac('0x29')][_0x4aac('0x2f')]});}}function getEndUser(_0x5f3987,_0x250e1f,_0x172f06,_0x4d491b){logger[_0x4aac('0x26')](_0x4aac('0x33'),_0x172f06);return request({'form':{'method':_0x4aac('0x34'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4aac('0x1f')]({'session':_0x4d491b['id'],'module_name':_0x4aac('0x19'),'query':util['format'](_0x4aac('0x35'),_0x172f06),'order_by':'','offset':'0','select_fields':['id',_0x4aac('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4aac('0x2a')](function(_0x43aa37){if(_0x43aa37[_0x4aac('0x2b')][_0x4aac('0x36')]){var _0x52032d=_[_0x4aac('0x2c')](_0x43aa37[_0x4aac('0x2b')],function(_0x2b30c5){return _0x2b30c5[_0x4aac('0x2d')]['phone_home'][_0x4aac('0x2f')]===_0x172f06;});if(_0x52032d){logger[_0x4aac('0x26')](_0x4aac('0x37'));return BPromise['resolve']({'id':_0x52032d[_0x4aac('0x2d')]['id'][_0x4aac('0x2f')],'name':_0x52032d[_0x4aac('0x2d')][_0x4aac('0xe')][_0x4aac('0x2f')],'phone':_0x52032d[_0x4aac('0x2d')][_0x4aac('0x38')][_0x4aac('0x2f')]});}}else{logger[_0x4aac('0x26')](_0x4aac('0x39'));return request({'form':{'method':_0x4aac('0x1d'),'input_type':'JSON','response_type':_0x4aac('0x1e'),'rest_data':JSON['stringify']({'session':_0x4d491b['id'],'module_name':_0x4aac('0x19'),'name_value_list':[{'name':_0x4aac('0x3a'),'value':_0x250e1f!==''?_0x250e1f:util[_0x4aac('0x21')]('Caller\x20-\x20%s',_0x172f06)},{'name':'phone_home','value':_0x172f06}]})}})[_0x4aac('0x2a')](function(_0x2c884d){logger[_0x4aac('0x26')](_0x4aac('0x3b'));return BPromise['resolve']({'id':_0x2c884d['id'],'name':_0x2c884d[_0x4aac('0x2b')][_0x4aac('0x3a')][_0x4aac('0x2f')],'phone':_0x2c884d[_0x4aac('0x2b')][_0x4aac('0x38')][_0x4aac('0x2f')]});});}});}function request(_0x5d09f6){logger[_0x4aac('0x3c')]('[HTTP]',JSON[_0x4aac('0x1f')](_0x5d09f6));return rp(_[_0x4aac('0x3d')](def,_0x5d09f6));}function getTags(_0xd7cb9f,_0x4efb08){var _0x2713ba=[];if(_0xd7cb9f&&_0xd7cb9f[_0x4aac('0x36')]>0x0){_0x2713ba=_[_0x4aac('0x3e')](_0xd7cb9f,_0x4efb08);}return _0x2713ba;}function getCustomFields(_0xda48c5,_0x45d37f){var _0x3487c0=[];var _0x5d1def={'custom_fields':[]};if(_0xda48c5['length']>0x0){_[_0x4aac('0x1a')](_0xda48c5,function(_0x4841b7){if(_0x4841b7[_0x4aac('0x3f')]===_0x4aac('0x40')&&_0x4841b7[_0x4aac('0x41')]&&!_0x4841b7[_0x4aac('0x42')]){_0x5d1def[_0x4841b7[_0x4aac('0x41')][_0x4aac('0x43')]()]=_0x4841b7[_0x4aac('0x44')][_0x4aac('0x45')]();}else if(_0x4841b7[_0x4aac('0x3f')]==='string'&&_0x4841b7[_0x4aac('0x1c')]&&_0x4841b7[_0x4aac('0x42')]){_0x5d1def['custom_fields']['push']({'id':_0x4841b7[_0x4aac('0x1c')],'value':_0x4841b7['content']['toString']()});}else if(_0x4841b7['type']===_0x4aac('0x46')&&_0x4841b7['variableName']&&_0x4841b7['idField']&&_0x4841b7[_0x4aac('0x42')]){_0x45d37f[_0x4841b7[_0x4aac('0x1b')]]&&_0x5d1def[_0x4aac('0x47')][_0x4aac('0x48')]({'id':_0x4841b7[_0x4aac('0x1c')],'value':_0x45d37f[_0x4841b7[_0x4aac('0x1b')]][_0x4aac('0x45')]()});}else if(_0x4841b7[_0x4aac('0x3f')]===_0x4aac('0x49')&&_0x4841b7[_0x4aac('0x4a')]&&_0x4841b7['Variable'][_0x4aac('0xe')]&&_0x4841b7[_0x4aac('0x1c')]&&_0x4841b7['customField']){_0x45d37f[_0x4841b7[_0x4aac('0x4a')][_0x4aac('0xe')][_0x4aac('0x43')]()]&&_0x5d1def[_0x4aac('0x47')][_0x4aac('0x48')]({'id':_0x4841b7[_0x4aac('0x1c')],'value':_0x45d37f[_0x4841b7[_0x4aac('0x4a')][_0x4aac('0xe')][_0x4aac('0x43')]()][_0x4aac('0x45')]()});}});}return _0x5d1def;}function getConnection(_0x3fc5ee){return request({'method':_0x4aac('0x4b'),'form':{'method':_0x4aac('0x4c'),'input_type':_0x4aac('0x1e'),'response_type':_0x4aac('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3fc5ee[_0x4aac('0x4d')],'password':_0x3fc5ee['password'],'encryption':_0x4aac('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4aac('0x2a')](function(_0x4f0479){var _0x29c005=_0x4f0479;if(_0x29c005['id']){def[_0x4aac('0x4f')]=_0x29c005['id'];return BPromise[_0x4aac('0x31')](_0x29c005);}else{throw new Error(util[_0x4aac('0x21')](_0x4aac('0x50'),_0x3fc5ee['id']));}});}function setRelationship(_0x5d198d,_0x57442e,_0x3c2813,_0x3a89a3){return request({'form':{'method':_0x4aac('0x51'),'input_type':_0x4aac('0x1e'),'response_type':_0x4aac('0x1e'),'rest_data':JSON[_0x4aac('0x1f')]({'session':_0x5d198d['id'],'module_name':'Calls','module_id':_0x3c2813['id'],'link_field_name':_0x3a89a3,'related_ids':[_0x57442e['id']]})}});}exports['queue']=function(_0x11fd97,_0x10d3b9,_0x5f004a,_0x4865e6,_0x4d7a6c,_0x3cd1e8){var _0x514521,_0x4ca90a,_0xc732b3,_0x2eb11b;_0x3cd1e8[_0x4aac('0x52')]=intUtil[_0x4aac('0x53')](_0x3cd1e8[_0x4aac('0x52')]);_0x3cd1e8[_0x4aac('0x54')]=intUtil[_0x4aac('0x53')](_0x3cd1e8[_0x4aac('0x54')]);def[_0x4aac('0x55')]=util[_0x4aac('0x21')](_0x4aac('0x56'),_0x3cd1e8[_0x4aac('0x52')]);if(_0x4d7a6c&&_0x4d7a6c[_0x4aac('0x57')]){logger[_0x4aac('0x26')](_0x4aac('0x58'),_0x4aac('0x59'));_0x10d3b9[_0x4aac('0x5a')]=util['format'](_0x4aac('0x5b'),_0x3cd1e8[_0x4aac('0x54')],_0x10d3b9[_0x4aac('0x5c')],md5(_0x10d3b9[_0x4aac('0x5c')]));}else{_0x10d3b9[_0x4aac('0x5a')]='';}return getConnection(_0x3cd1e8)[_0x4aac('0x2a')](function(_0x35db46){_0x2eb11b=_0x35db46;return getUser(_0x3cd1e8,_0x4865e6[_0x4aac('0xe')],_0x2eb11b);})[_0x4aac('0x2a')](function(_0x2e0171){_0x514521=_0x2e0171;logger['info'](_0x4aac('0x5d'),_0x514521['id']);return getEndUser(_0x3cd1e8,_0x10d3b9[_0x4aac('0x5e')],_0x10d3b9[_0x4aac('0x5f')],_0x2eb11b);})[_0x4aac('0x2a')](function(_0x165cb3){_0x4ca90a=_0x165cb3;logger[_0x4aac('0x26')](_0x4aac('0x60'),_0x4ca90a['id']);return getTicket(_0x3cd1e8,_0x514521,_0x4ca90a,_0x5f004a,_0x10d3b9,_0x5f004a['Fields'],_0x2eb11b,'Inbound');})[_0x4aac('0x2a')](function(_0xa75f3e){_0xc732b3=_0xa75f3e;logger['info'](_0x4aac('0x61'));logger[_0x4aac('0x26')]('The\x20Ticket\x20ID\x20is:',_0xc732b3['id']);return setRelationship(_0x2eb11b,_0x514521,_0xc732b3,'users');})[_0x4aac('0x2a')](function(){return setRelationship(_0x2eb11b,_0x4ca90a,_0xc732b3,_0x4aac('0x62'));})[_0x4aac('0x2a')](function(){return getServerInfo(_0x2eb11b);})[_0x4aac('0x2a')](function(_0x3568bd){var _0x11e70f=parseInt(_0x3568bd[_0x4aac('0x63')]['charAt'](0x0));var _0x1d8bed=util['format'](_0x4aac('0x64'),_0x3cd1e8[_0x4aac('0x52')],_0xc732b3['id']);if(_0x11e70f>0x6){_0x1d8bed=util['format'](_0x4aac('0x65'),_0x3cd1e8['remoteUri'],_0xc732b3['id']);}logger['info']('[QUEUE]',_0x4aac('0x66'));emit(util[_0x4aac('0x21')](_0x4aac('0x67'),_0x4865e6[_0x4aac('0xe')]),'trigger:browser:url',{'uri':_0x1d8bed});})['catch'](function(_0x2843cd){logger[_0x4aac('0x68')](_0x4aac('0x58'),JSON[_0x4aac('0x1f')](_0x2843cd));});};exports[_0x4aac('0x69')]=function(_0x59fdc5,_0x17b30d,_0x479678,_0x5a407e,_0x261e1a,_0x3886e9,_0x45115a){var _0x30d861,_0x26c2e4,_0x40b9f8,_0x404034;_0x3886e9[_0x4aac('0x52')]=intUtil[_0x4aac('0x53')](_0x3886e9['remoteUri']);_0x3886e9[_0x4aac('0x54')]=intUtil[_0x4aac('0x53')](_0x3886e9[_0x4aac('0x54')]);def[_0x4aac('0x55')]=util[_0x4aac('0x21')](_0x4aac('0x56'),_0x3886e9['remoteUri']);if(_0x45115a&&_0x45115a[_0x4aac('0x6a')]&&_0x45115a['recordingFormat']!==_0x4aac('0x6b')){logger[_0x4aac('0x26')](_0x4aac('0x6c'),_0x4aac('0x59'));_0x17b30d[_0x4aac('0x5a')]=util[_0x4aac('0x21')](_0x4aac('0x5b'),_0x3886e9[_0x4aac('0x54')],_0x17b30d[_0x4aac('0x5c')],md5(_0x17b30d[_0x4aac('0x5c')]));}return getConnection(_0x3886e9)['then'](function(_0x5a9b0a){_0x404034=_0x5a9b0a;return getUser(_0x3886e9,_0x5a407e[_0x4aac('0xe')],_0x404034);})['then'](function(_0x25718c){_0x30d861=_0x25718c;logger['info']('The\x20User\x20ID\x20is:',_0x30d861['id']);return getEndUser(_0x3886e9,_0x17b30d[_0x4aac('0x6d')],_0x17b30d[_0x4aac('0x6e')],_0x404034);})[_0x4aac('0x2a')](function(_0x13b59b){_0x26c2e4=_0x13b59b;logger[_0x4aac('0x26')](_0x4aac('0x60'),_0x26c2e4['id']);return getTicket(_0x3886e9,_0x30d861,_0x26c2e4,_0x479678,_0x17b30d,_0x479678[_0x4aac('0x6f')],_0x404034,_0x4aac('0x70'));})[_0x4aac('0x2a')](function(_0x2b9fce){_0x40b9f8=_0x2b9fce;logger[_0x4aac('0x26')]('Ticket\x20created!');logger[_0x4aac('0x26')](_0x4aac('0x71'),_0x40b9f8['id']);return setRelationship(_0x404034,_0x30d861,_0x40b9f8,'users');})[_0x4aac('0x2a')](function(){return setRelationship(_0x404034,_0x26c2e4,_0x40b9f8,'contacts');})['then'](function(){return getServerInfo(_0x404034);})[_0x4aac('0x2a')](function(_0x42fdae){var _0xe7d913=parseInt(_0x42fdae[_0x4aac('0x63')][_0x4aac('0x72')](0x0));var _0xf044c4=util[_0x4aac('0x21')](_0x4aac('0x64'),_0x3886e9['remoteUri'],_0x40b9f8['id']);if(_0xe7d913>0x6){_0xf044c4=util[_0x4aac('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3886e9[_0x4aac('0x52')],_0x40b9f8['id']);}logger[_0x4aac('0x26')](_0x4aac('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4aac('0x21')](_0x4aac('0x67'),_0x5a407e['name']),_0x4aac('0x73'),{'uri':_0xf044c4});})[_0x4aac('0x74')](function(_0xb4f2d2){logger[_0x4aac('0x68')](_0x4aac('0x6c'),JSON[_0x4aac('0x1f')](_0xb4f2d2));});};exports[_0x4aac('0x75')]=function(_0x1361fa,_0x500a22,_0x2722e8,_0x5b8930,_0x2a3575,_0x9994b0){var _0x3debf8,_0x1d3e05,_0x41f70e,_0x2003a4;_0x9994b0[_0x4aac('0x52')]=intUtil[_0x4aac('0x53')](_0x9994b0['remoteUri']);_0x9994b0[_0x4aac('0x54')]=intUtil['stripTrailingSlash'](_0x9994b0['serverUrl']);def[_0x4aac('0x55')]=util['format'](_0x4aac('0x56'),_0x9994b0[_0x4aac('0x52')]);if(_0x2a3575&&_0x2a3575[_0x4aac('0x57')]){logger[_0x4aac('0x26')]('['+_0x500a22[_0x4aac('0x76')]['toUpperCase']()+']',_0x4aac('0x59'));_0x500a22[_0x4aac('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9994b0[_0x4aac('0x54')],_0x500a22[_0x4aac('0x5c')],md5(_0x500a22[_0x4aac('0x5c')]));}else{_0x500a22[_0x4aac('0x5a')]='';}return getConnection(_0x9994b0)['then'](function(_0x5af238){_0x2003a4=_0x5af238;if(!_['isNil'](_0x5b8930)){return getUser(_0x9994b0,_0x5b8930[_0x4aac('0xe')],_0x2003a4);}else{return getUser(_0x9994b0,null,_0x2003a4);}})['then'](function(_0x9a4bb4){_0x3debf8=_0x9a4bb4;logger['info'](_0x4aac('0x5d'),_0x3debf8['id']);return getEndUser(_0x9994b0,_0x500a22['calleridname'],_0x500a22['calleridnum'],_0x2003a4);})[_0x4aac('0x2a')](function(_0x4b260e){_0x1d3e05=_0x4b260e;logger['info'](_0x4aac('0x60'),_0x1d3e05['id']);return getTicket(_0x9994b0,_0x3debf8,_0x1d3e05,_0x2722e8,_0x500a22,_0x2722e8[_0x4aac('0x6f')],_0x2003a4,_0x4aac('0x77'));})[_0x4aac('0x2a')](function(_0x5c7049){_0x41f70e=_0x5c7049;logger[_0x4aac('0x26')](_0x4aac('0x61'));logger[_0x4aac('0x26')](_0x4aac('0x71'),_0x41f70e['id']);return setRelationship(_0x2003a4,_0x3debf8,_0x41f70e,'users');})[_0x4aac('0x2a')](function(){return setRelationship(_0x2003a4,_0x1d3e05,_0x41f70e,_0x4aac('0x62'));})[_0x4aac('0x2a')](function(){return getServerInfo(_0x2003a4);})['catch'](function(_0x233448){logger[_0x4aac('0x68')]('['+_0x500a22[_0x4aac('0x76')][_0x4aac('0x78')]()+']',JSON[_0x4aac('0x1f')](_0x233448));});}; \ 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 72695fc..989269c 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 _0xd4c6=['isNil','test','lodash','util','getString','length','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','type','keyValue','keyType','keyContent','key','%s:\x20%s','slice','substring','validateEmail'];(function(_0x17d2bd,_0x3c6d60){var _0x1f377c=function(_0x166f21){while(--_0x166f21){_0x17d2bd['push'](_0x17d2bd['shift']());}};_0x1f377c(++_0x3c6d60);}(_0xd4c6,0x66));var _0x6d4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4c6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d4c('0x0'));var util=require(_0x6d4c('0x1'));exports[_0x6d4c('0x2')]=function(_0x5c4eb9,_0x269d44,_0x2e13bd){var _0x411b23=[];if(_0x5c4eb9[_0x6d4c('0x3')]>0x0){var _0x16ec5=_['sortBy'](_0x5c4eb9,['id']);for(var _0xdfce2b=0x0;_0xdfce2b<_0x16ec5[_0x6d4c('0x3')];_0xdfce2b++){var _0x5624ed=_0x16ec5[_0xdfce2b];if(_0x5624ed['type']===_0x6d4c('0x4')){_0x411b23['push'](_0x5624ed[_0x6d4c('0x5')]);}else if(_0x5624ed['type']===_0x6d4c('0x6')&&_0x5624ed[_0x6d4c('0x7')]){_0x269d44[_0x5624ed['variableName']]&&_0x411b23[_0x6d4c('0x8')](_0x269d44[_0x5624ed[_0x6d4c('0x7')]][_0x6d4c('0x9')]());}else if(_0x5624ed['type']===_0x6d4c('0xa')&&_0x5624ed[_0x6d4c('0xb')]&&_0x5624ed[_0x6d4c('0xb')]['name']){_0x269d44[_0x5624ed[_0x6d4c('0xb')][_0x6d4c('0xc')][_0x6d4c('0xd')]()]&&_0x411b23['push'](_0x269d44[_0x5624ed['Variable']['name'][_0x6d4c('0xd')]()][_0x6d4c('0x9')]());}else if(_0x5624ed[_0x6d4c('0xe')]===_0x6d4c('0xf')){if(_0x5624ed[_0x6d4c('0x10')]===_0x6d4c('0x4')&&_0x5624ed['key']){_0x411b23[_0x6d4c('0x8')](util['format']('%s:\x20%s',_0x5624ed['key'],_0x5624ed[_0x6d4c('0x11')]));}else if(_0x5624ed[_0x6d4c('0x10')]===_0x6d4c('0x6')&&_0x5624ed[_0x6d4c('0x7')]&&_0x5624ed[_0x6d4c('0x12')]){_0x269d44[_0x5624ed[_0x6d4c('0x7')]]&&_0x411b23[_0x6d4c('0x8')](util['format'](_0x6d4c('0x13'),_0x5624ed[_0x6d4c('0x12')],_0x269d44[_0x5624ed[_0x6d4c('0x7')]]));}else if(_0x5624ed['keyType']===_0x6d4c('0xa')&&_0x5624ed[_0x6d4c('0xb')]&&_0x5624ed['Variable'][_0x6d4c('0xc')]&&_0x5624ed[_0x6d4c('0x12')]){_0x269d44[_0x5624ed[_0x6d4c('0xb')][_0x6d4c('0xc')][_0x6d4c('0xd')]()]&&_0x411b23[_0x6d4c('0x8')](util['format'](_0x6d4c('0x13'),_0x5624ed['key'],_0x269d44[_0x5624ed[_0x6d4c('0xb')][_0x6d4c('0xc')][_0x6d4c('0xd')]()]));}}}}return _0x411b23['join'](_0x2e13bd);};exports['stripTrailingSlash']=function(_0x195959){var _0x1a8431=_0x195959[_0x6d4c('0x14')](-0x1);if(_0x1a8431==='/'){_0x195959=_0x195959[_0x6d4c('0x15')](0x0,_0x195959['lastIndexOf'](_0x1a8431));}return _0x195959;};exports[_0x6d4c('0x16')]=function(_0x5a4bf0){if(!_[_0x6d4c('0x17')](_0x5a4bf0)&&_0x5a4bf0!==''){var _0x3a73b8=/^(([^<>()\[\]\\.,;:\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 _0x3a73b8[_0x6d4c('0x18')](String(_0x5a4bf0)[_0x6d4c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xcab9=['keyType','key','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','validateEmail','lodash','sortBy','string','push','content','type','variable','variableName','name','Variable','toLowerCase','keyValue'];(function(_0x3fed74,_0x18b0e6){var _0x2c62e3=function(_0x3947a1){while(--_0x3947a1){_0x3fed74['push'](_0x3fed74['shift']());}};_0x2c62e3(++_0x18b0e6);}(_0xcab9,0x72));var _0x9cab=function(_0x4d2c7e,_0x5df3bc){_0x4d2c7e=_0x4d2c7e-0x0;var _0x1f837f=_0xcab9[_0x4d2c7e];return _0x1f837f;};'use strict';var _=require(_0x9cab('0x0'));var util=require('util');exports['getString']=function(_0x32b20c,_0x348050,_0x2704ba){var _0x30ec6e=[];if(_0x32b20c['length']>0x0){var _0x2a530f=_[_0x9cab('0x1')](_0x32b20c,['id']);for(var _0x59a266=0x0;_0x59a266<_0x2a530f['length'];_0x59a266++){var _0x1546b9=_0x2a530f[_0x59a266];if(_0x1546b9['type']===_0x9cab('0x2')){_0x30ec6e[_0x9cab('0x3')](_0x1546b9[_0x9cab('0x4')]);}else if(_0x1546b9[_0x9cab('0x5')]===_0x9cab('0x6')&&_0x1546b9[_0x9cab('0x7')]){_0x348050[_0x1546b9[_0x9cab('0x7')]]&&_0x30ec6e[_0x9cab('0x3')](_0x348050[_0x1546b9['variableName']]['toString']());}else if(_0x1546b9['type']==='customVariable'&&_0x1546b9['Variable']&&_0x1546b9['Variable'][_0x9cab('0x8')]){_0x348050[_0x1546b9[_0x9cab('0x9')][_0x9cab('0x8')]['toLowerCase']()]&&_0x30ec6e[_0x9cab('0x3')](_0x348050[_0x1546b9[_0x9cab('0x9')][_0x9cab('0x8')][_0x9cab('0xa')]()]['toString']());}else if(_0x1546b9['type']===_0x9cab('0xb')){if(_0x1546b9[_0x9cab('0xc')]==='string'&&_0x1546b9[_0x9cab('0xd')]){_0x30ec6e[_0x9cab('0x3')](util['format'](_0x9cab('0xe'),_0x1546b9['key'],_0x1546b9['keyContent']));}else if(_0x1546b9[_0x9cab('0xc')]===_0x9cab('0x6')&&_0x1546b9['variableName']&&_0x1546b9[_0x9cab('0xd')]){_0x348050[_0x1546b9[_0x9cab('0x7')]]&&_0x30ec6e[_0x9cab('0x3')](util['format'](_0x9cab('0xe'),_0x1546b9[_0x9cab('0xd')],_0x348050[_0x1546b9[_0x9cab('0x7')]]));}else if(_0x1546b9[_0x9cab('0xc')]===_0x9cab('0xf')&&_0x1546b9[_0x9cab('0x9')]&&_0x1546b9[_0x9cab('0x9')][_0x9cab('0x8')]&&_0x1546b9['key']){_0x348050[_0x1546b9[_0x9cab('0x9')][_0x9cab('0x8')][_0x9cab('0xa')]()]&&_0x30ec6e[_0x9cab('0x3')](util['format'](_0x9cab('0xe'),_0x1546b9[_0x9cab('0xd')],_0x348050[_0x1546b9[_0x9cab('0x9')][_0x9cab('0x8')][_0x9cab('0xa')]()]));}}}}return _0x30ec6e[_0x9cab('0x10')](_0x2704ba);};exports[_0x9cab('0x11')]=function(_0x4655d4){var _0x4e9ff8=_0x4655d4[_0x9cab('0x12')](-0x1);if(_0x4e9ff8==='/'){_0x4655d4=_0x4655d4[_0x9cab('0x13')](0x0,_0x4655d4['lastIndexOf'](_0x4e9ff8));}return _0x4655d4;};exports[_0x9cab('0x14')]=function(_0x5e777a){if(!_['isNil'](_0x5e777a)&&_0x5e777a!==''){var _0x1eab87=/^(([^<>()\[\]\\.,;:\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 _0x1eab87['test'](String(_0x5e777a)[_0x9cab('0xa')]());}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 2c263fa..11f30ee 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 _0xd94a=['Agent\x20found!','result','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','%s/webservice.php','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','accessKey','token','[HTTP]','queue','monitor_format','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Open','getString','Descriptions','POST','format','create','username','sessionName','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','createTicket','validateEmail','remoteUri','query'];(function(_0xc991af,_0x37b88f){var _0x272c77=function(_0x3f4664){while(--_0x3f4664){_0xc991af['push'](_0xc991af['shift']());}};_0x272c77(++_0x37b88f);}(_0xd94a,0xed));var _0xad94=function(_0x2cee15,_0x497a8b){_0x2cee15=_0x2cee15-0x0;var _0xd0c9f7=_0xd94a[_0x2cee15];return _0xd0c9f7;};'use strict';var _=require('lodash');var rp=require(_0xad94('0x0'));var BPromise=require('bluebird');var md5=require(_0xad94('0x1'));var util=require(_0xad94('0x2'));var Redis=require(_0xad94('0x3'));var intUtil=require('./util');var config=require(_0xad94('0x4'));var logger=require(_0xad94('0x5'))(_0xad94('0x6'));config[_0xad94('0x7')]=_[_0xad94('0x8')](config[_0xad94('0x7')],{'host':_0xad94('0x9'),'port':0x18eb});var io=require(_0xad94('0xa'))(new Redis(config[_0xad94('0x7')]));function emit(_0x13ea44,_0x37d085,_0xa37ed5){io['to'](_0x13ea44)['emit'](_0x37d085,_0xa37ed5);}function getCustomFields(_0x2ceee9,_0x27321b){var _0x227f48={};if(_0x2ceee9[_0xad94('0xb')]>0x0){_['forEach'](_0x2ceee9,function(_0x30bf57){if(_0x30bf57[_0xad94('0xc')]===_0xad94('0xd')&&_0x30bf57[_0xad94('0xe')]){_0x227f48[_0x30bf57[_0xad94('0xe')]]=_0x30bf57[_0xad94('0xf')]['toString']();}else if(_0x30bf57[_0xad94('0xc')]===_0xad94('0x10')&&_0x30bf57[_0xad94('0x11')]&&_0x30bf57[_0xad94('0xe')]&&_0x27321b[_0x30bf57['variableName']]){_0x227f48[_0x30bf57[_0xad94('0xe')]]=_0x27321b[_0x30bf57[_0xad94('0x11')]][_0xad94('0x12')]();}else if(_0x30bf57[_0xad94('0xc')]===_0xad94('0x13')&&_0x30bf57[_0xad94('0x14')]&&_0x30bf57[_0xad94('0x14')]['name']&&_0x30bf57[_0xad94('0xe')]&&_0x27321b[_0x30bf57[_0xad94('0x14')][_0xad94('0x15')]['toLowerCase']()]){_0x227f48[_0x30bf57[_0xad94('0xe')]]=_0x27321b[_0x30bf57[_0xad94('0x14')]['name'][_0xad94('0x16')]()][_0xad94('0x12')]();}});}return _0x227f48;}function createTicket(_0x116ef3,_0x30c537,_0x2e4393,_0xbe8608,_0x1afee0,_0x59f4ac,_0x4b478c){logger[_0xad94('0x17')](_0xad94('0x18'));var _0x14bac8=_['merge']({'parent_id':'','assigned_user_id':_0x30c537['id'],'ticketpriorities':'Normal','ticketstatus':_0xad94('0x19'),'ticket_title':intUtil[_0xad94('0x1a')](_0xbe8608['Subjects'],_0x1afee0,'\x20'),'description':intUtil[_0xad94('0x1a')](_0xbe8608[_0xad94('0x1b')],_0x1afee0,'\x0a'),'contact_id':_0x2e4393['id']},getCustomFields(_0x59f4ac,_0x1afee0));var _0x175a9b={'method':_0xad94('0x1c'),'uri':util[_0xad94('0x1d')]('%s/webservice.php',_0x116ef3['remoteUri']),'form':{'operation':_0xad94('0x1e'),'username':_0x116ef3[_0xad94('0x1f')],'sessionName':_0x4b478c[_0xad94('0x20')],'elementType':'HelpDesk','element':JSON[_0xad94('0x21')](_0x14bac8)},'json':!![]};return request(_0x175a9b)[_0xad94('0x22')](function(_0x18c34f){if(_0x18c34f[_0xad94('0x23')]){return BPromise[_0xad94('0x24')]({'id':_0x18c34f['result']['id']});}else{throw new Error(util['format'](_0xad94('0x25'),JSON[_0xad94('0x21')](_0x18c34f[_0xad94('0x26')])));}})[_0xad94('0x27')](function(_0x726d4e){var _0x1cbbc8=_0x726d4e[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xad94('0x29'),_0x1cbbc8,JSON[_0xad94('0x21')](_0x726d4e));});}function getUser(_0x37ea31,_0x36e9a1,_0x2aa051){if(intUtil[_0xad94('0x2a')](_0x36e9a1)){logger['info']('Getting\x20agent\x20with\x20email',_0x36e9a1);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x37ea31[_0xad94('0x2b')]),'qs':{'operation':_0xad94('0x2c'),'username':_0x37ea31[_0xad94('0x1f')],'sessionName':_0x2aa051['sessionName'],'query':util['format']('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x36e9a1)},'json':!![]})[_0xad94('0x22')](function(_0x4a2adb){if(_0x4a2adb[_0xad94('0x23')]&&_0x4a2adb['result'][_0xad94('0xb')]){logger[_0xad94('0x17')](_0xad94('0x2d'));return BPromise['resolve']({'id':_0x4a2adb[_0xad94('0x2e')][0x0]['id'],'email':_0x4a2adb[_0xad94('0x2e')][0x0][_0xad94('0x2f')],'name':_0x4a2adb[_0xad94('0x2e')][0x0][_0xad94('0x30')]+'\x20'+_0x4a2adb[_0xad94('0x2e')][_0xad94('0x31')]});}else{logger[_0xad94('0x17')](_0xad94('0x32'));return BPromise[_0xad94('0x24')]({'id':_0x2aa051[_0xad94('0x33')],'email':_0x37ea31[_0xad94('0x1f')],'name':_0xad94('0x34')});}})[_0xad94('0x27')](function(_0x33c3fc){var _0xa9265=_0x33c3fc[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')](_0xad94('0x35'),_0xad94('0x36'),_0xa9265,JSON[_0xad94('0x21')](_0x33c3fc));});}else{logger[_0xad94('0x17')](_0xad94('0x32'));return BPromise[_0xad94('0x24')]({'id':_0x2aa051[_0xad94('0x33')],'email':_0x37ea31[_0xad94('0x1f')],'name':_0xad94('0x34')})[_0xad94('0x27')](function(_0x58bad0){var _0xb1a24d=_0x58bad0[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')](_0xad94('0x35'),_0xad94('0x36'),_0xb1a24d,JSON['stringify'](_0x58bad0));});}}function getEndUser(_0x42078b,_0x3d33fd,_0x224d1a,_0x46931e){logger[_0xad94('0x17')](_0xad94('0x37'),_0x224d1a);return request({'method':'GET','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x42078b[_0xad94('0x2b')]),'qs':{'operation':_0xad94('0x2c'),'username':_0x42078b['username'],'sessionName':_0x46931e[_0xad94('0x20')],'query':util[_0xad94('0x1d')](_0xad94('0x39'),_0x224d1a,_0x224d1a,_0x224d1a,_0x224d1a,_0x224d1a)},'json':!![]})[_0xad94('0x22')](function(_0x3b9abe){if(_0x3b9abe[_0xad94('0x23')]&&_0x3b9abe[_0xad94('0x2e')][_0xad94('0xb')]){logger[_0xad94('0x17')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x3b9abe[_0xad94('0x2e')][0x0]['id'],'name':_0x3b9abe[_0xad94('0x2e')][0x0][_0xad94('0x3a')]+'\x20'+_0x3b9abe[_0xad94('0x2e')][0x0][_0xad94('0x3b')],'phone':_0x224d1a});}else{logger['info'](_0xad94('0x3c'));return request({'method':'POST','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x42078b[_0xad94('0x2b')]),'form':{'operation':_0xad94('0x1e'),'sessionName':_0x46931e[_0xad94('0x20')],'elementType':_0xad94('0x3d'),'element':JSON[_0xad94('0x21')]({'lastname':_0x3d33fd,'phone':_0x224d1a,'assigned_user_id':'\x20'})},'json':!![]})[_0xad94('0x22')](function(_0x1ef92f){logger['info']('Enduser\x20created.');return BPromise[_0xad94('0x24')]({'id':_0x1ef92f[_0xad94('0x2e')]['id'],'name':_0x1ef92f[_0xad94('0x2e')][_0xad94('0x3b')],'phone':_0x1ef92f[_0xad94('0x2e')][_0xad94('0x3e')]});})[_0xad94('0x27')](function(_0x5dd9e1){var _0x5aa68f=_0x5dd9e1[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x5aa68f,JSON[_0xad94('0x21')](_0x5dd9e1));});}});}function getConnection(_0x299d0c){var _0x32aaa1=_0x299d0c[_0xad94('0x1f')];var _0x1af06e=_0x299d0c[_0xad94('0x3f')];return request({'method':'GET','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x299d0c['remoteUri']),'qs':{'operation':'getchallenge','username':_0x32aaa1},'json':!![]})[_0xad94('0x22')](function(_0x23e696){if(_0x23e696[_0xad94('0x23')]){return request({'method':'POST','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x299d0c[_0xad94('0x2b')]),'form':{'operation':'login','username':_0x32aaa1,'accessKey':md5(_0x23e696[_0xad94('0x2e')][_0xad94('0x40')]+_0x1af06e)},'json':!![]});}})[_0xad94('0x22')](function(_0x2555ed){if(_0x2555ed[_0xad94('0x23')]){return BPromise['resolve'](_0x2555ed['result']);}else{throw new Error(util[_0xad94('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x299d0c['id']));}})[_0xad94('0x27')](function(_0x266478){var _0x12fab1=_0x266478['statusCode']||0x1f4;logger[_0xad94('0x26')](_0xad94('0x35'),'getConnection',_0x12fab1,JSON['stringify'](_0x266478));});}function request(_0x4346f1){logger[_0xad94('0x17')](_0xad94('0x41'),JSON[_0xad94('0x21')](_0x4346f1));return rp(_0x4346f1);}exports[_0xad94('0x42')]=function(_0x1c554d,_0x59bc6b,_0x1c0240,_0x30a4d8,_0x4b8d30,_0x25366f){var _0x2a72d6,_0x29a629,_0xb56cb8,_0x440c91;_0x25366f[_0xad94('0x2b')]=intUtil['stripTrailingSlash'](_0x25366f['remoteUri']);if(_0x4b8d30&&_0x4b8d30[_0xad94('0x43')]){logger[_0xad94('0x17')]('[QUEUE]','Recording\x20is\x20enabled!');_0x59bc6b[_0xad94('0x44')]=util[_0xad94('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25366f['serverUrl'],_0x59bc6b['uniqueid'],md5(_0x59bc6b[_0xad94('0x45')]));}else{_0x59bc6b['recordingURL']='';}return getConnection(_0x25366f)[_0xad94('0x22')](function(_0x1c91c1){_0x440c91=_0x1c91c1;return getUser(_0x25366f,_0x30a4d8['email'],_0x440c91);})['then'](function(_0x114854){_0x2a72d6=_0x114854;logger[_0xad94('0x17')](_0xad94('0x46'),_0x2a72d6['id']);return getEndUser(_0x25366f,_0x59bc6b[_0xad94('0x47')],_0x59bc6b['calleridnum'],_0x440c91);})['then'](function(_0x52fdd9){_0x29a629=_0x52fdd9;logger[_0xad94('0x17')](_0xad94('0x48'),_0x29a629['id']);return createTicket(_0x25366f,_0x2a72d6,_0x29a629,_0x1c0240,_0x59bc6b,_0x1c0240[_0xad94('0x49')],_0x440c91);})[_0xad94('0x22')](function(_0x3a75f2){_0xb56cb8=_0x3a75f2;logger[_0xad94('0x17')](_0xad94('0x4a'));logger[_0xad94('0x17')](_0xad94('0x4b'),_0xb56cb8['id']);var _0x40e73d=util[_0xad94('0x1d')](_0xad94('0x4c'),_0x25366f[_0xad94('0x2b')],_[_0xad94('0x4d')](_0xb56cb8['id'],'x')[0x1]);logger[_0xad94('0x17')](_0xad94('0x4e'),_0xad94('0x4f'));emit(util[_0xad94('0x1d')](_0xad94('0x50'),_0x30a4d8[_0xad94('0x15')]),_0xad94('0x51'),{'uri':_0x40e73d});})[_0xad94('0x27')](function(_0x46c4e1){logger['error'](_0xad94('0x4e'),JSON[_0xad94('0x21')](_0x46c4e1));});};exports['outbound']=function(_0x597974,_0x35240c,_0x3a61cf,_0x560e76,_0x3845d2,_0x99bcd1,_0x2268b0){var _0xb9d61c,_0x3d61ad,_0x5794db,_0x30e4ab;_0x99bcd1[_0xad94('0x2b')]=intUtil[_0xad94('0x52')](_0x99bcd1['remoteUri']);_0x99bcd1[_0xad94('0x53')]=intUtil[_0xad94('0x52')](_0x99bcd1[_0xad94('0x53')]);if(_0x2268b0&&_0x2268b0[_0xad94('0x54')]&&_0x2268b0[_0xad94('0x54')]!==_0xad94('0x55')){logger[_0xad94('0x17')]('[OUTBOUND]',_0xad94('0x56'));_0x35240c[_0xad94('0x44')]=util[_0xad94('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x99bcd1[_0xad94('0x53')],_0x35240c[_0xad94('0x45')],md5(_0x35240c[_0xad94('0x45')]));}return getConnection(_0x99bcd1)[_0xad94('0x22')](function(_0x406323){_0x30e4ab=_0x406323;return getUser(_0x99bcd1,_0x560e76['email'],_0x30e4ab);})[_0xad94('0x22')](function(_0x342a91){_0xb9d61c=_0x342a91;logger['info'](_0xad94('0x46'),_0xb9d61c['id']);return getEndUser(_0x99bcd1,_0x35240c[_0xad94('0x57')],_0x35240c[_0xad94('0x58')],_0x30e4ab);})[_0xad94('0x22')](function(_0x3ce081){_0x3d61ad=_0x3ce081;logger[_0xad94('0x17')](_0xad94('0x48'),_0x3d61ad['id']);return createTicket(_0x99bcd1,_0xb9d61c,_0x3d61ad,_0x3a61cf,_0x35240c,_0x3a61cf[_0xad94('0x49')],_0x30e4ab);})[_0xad94('0x22')](function(_0x3b24a5){_0x5794db=_0x3b24a5;logger['info'](_0xad94('0x4a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5794db['id']);var _0x4cd5bd=util['format'](_0xad94('0x4c'),_0x99bcd1[_0xad94('0x2b')],_[_0xad94('0x4d')](_0x5794db['id'],'x')[0x1]);logger[_0xad94('0x17')](_0xad94('0x59'),_0xad94('0x4f'));emit(util[_0xad94('0x1d')](_0xad94('0x50'),_0x560e76[_0xad94('0x15')]),_0xad94('0x51'),{'uri':_0x4cd5bd});})[_0xad94('0x27')](function(_0x4bdbff){logger['error'](_0xad94('0x59'),JSON[_0xad94('0x21')](_0x4bdbff));});};exports['unmanaged']=function(_0x1bd739,_0x5987cd,_0x5a6460,_0x5f0fc3,_0x5bb3bc,_0x2db661){var _0x5b544f,_0x33b37a,_0x51967d,_0x528196;_0x2db661[_0xad94('0x2b')]=intUtil[_0xad94('0x52')](_0x2db661[_0xad94('0x2b')]);_0x2db661[_0xad94('0x53')]=intUtil[_0xad94('0x52')](_0x2db661[_0xad94('0x53')]);if(_0x5bb3bc&&_0x5bb3bc[_0xad94('0x43')]){logger[_0xad94('0x17')]('['+_0x5987cd[_0xad94('0x5a')][_0xad94('0x5b')]()+']',_0xad94('0x56'));_0x5987cd['recordingURL']=util[_0xad94('0x1d')](_0xad94('0x5c'),_0x2db661['serverUrl'],_0x5987cd[_0xad94('0x45')],md5(_0x5987cd[_0xad94('0x45')]));}else{_0x5987cd[_0xad94('0x44')]='';}return getConnection(_0x2db661)[_0xad94('0x22')](function(_0x57cca4){_0x528196=_0x57cca4;return getUser(_0x2db661,'',_0x528196);})['then'](function(_0x515e64){_0x5b544f=_0x515e64;logger[_0xad94('0x17')](_0xad94('0x46'),_0x5b544f['id']);return getEndUser(_0x2db661,_0x5987cd[_0xad94('0x47')],_0x5987cd[_0xad94('0x5d')],_0x528196);})['then'](function(_0x4d941c){_0x33b37a=_0x4d941c;logger['info'](_0xad94('0x48'),_0x33b37a['id']);return createTicket(_0x2db661,_0x5b544f,_0x33b37a,_0x5a6460,_0x5987cd,_0x5a6460[_0xad94('0x49')],_0x528196);})['then'](function(_0x27b1fd){_0x51967d=_0x27b1fd;logger[_0xad94('0x17')](_0xad94('0x4a'));logger[_0xad94('0x17')](_0xad94('0x4b'),_0x51967d['id']);})[_0xad94('0x27')](function(_0x156aff){logger[_0xad94('0x26')]('['+_0x5987cd[_0xad94('0x5a')][_0xad94('0x5b')]()+']',JSON[_0xad94('0x21')](_0x156aff));});}; \ No newline at end of file +var _0x2fa8=['email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','GET','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','phone','getEndUser','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','type','string','idField','toString','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','username','sessionName','HelpDesk','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','stringify','validateEmail','Getting\x20agent\x20with\x20email','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3b8d79,_0x968003){var _0x87d67e=function(_0x508b6a){while(--_0x508b6a){_0x3b8d79['push'](_0x3b8d79['shift']());}};_0x87d67e(++_0x968003);}(_0x2fa8,0x90));var _0x82fa=function(_0xc2791a,_0x40048b){_0xc2791a=_0xc2791a-0x0;var _0x123db1=_0x2fa8[_0xc2791a];return _0x123db1;};'use strict';var _=require(_0x82fa('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x82fa('0x1'));var util=require('util');var Redis=require(_0x82fa('0x2'));var intUtil=require(_0x82fa('0x3'));var config=require(_0x82fa('0x4'));var logger=require(_0x82fa('0x5'))(_0x82fa('0x6'));config[_0x82fa('0x7')]=_[_0x82fa('0x8')](config[_0x82fa('0x7')],{'host':_0x82fa('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x82fa('0x7')]));function emit(_0x4551c2,_0x9855b1,_0x1e834e){io['to'](_0x4551c2)[_0x82fa('0xa')](_0x9855b1,_0x1e834e);}function getCustomFields(_0x4b9ab8,_0x4c5980){var _0x3e23c5={};if(_0x4b9ab8[_0x82fa('0xb')]>0x0){_[_0x82fa('0xc')](_0x4b9ab8,function(_0x311ef1){if(_0x311ef1[_0x82fa('0xd')]===_0x82fa('0xe')&&_0x311ef1['idField']){_0x3e23c5[_0x311ef1[_0x82fa('0xf')]]=_0x311ef1['content'][_0x82fa('0x10')]();}else if(_0x311ef1['type']===_0x82fa('0x11')&&_0x311ef1[_0x82fa('0x12')]&&_0x311ef1[_0x82fa('0xf')]&&_0x4c5980[_0x311ef1[_0x82fa('0x12')]]){_0x3e23c5[_0x311ef1[_0x82fa('0xf')]]=_0x4c5980[_0x311ef1[_0x82fa('0x12')]]['toString']();}else if(_0x311ef1[_0x82fa('0xd')]==='customVariable'&&_0x311ef1[_0x82fa('0x13')]&&_0x311ef1['Variable'][_0x82fa('0x14')]&&_0x311ef1[_0x82fa('0xf')]&&_0x4c5980[_0x311ef1['Variable'][_0x82fa('0x14')][_0x82fa('0x15')]()]){_0x3e23c5[_0x311ef1[_0x82fa('0xf')]]=_0x4c5980[_0x311ef1[_0x82fa('0x13')][_0x82fa('0x14')][_0x82fa('0x15')]()][_0x82fa('0x10')]();}});}return _0x3e23c5;}function createTicket(_0x5104fc,_0x3150ba,_0xa8b43d,_0x12e89a,_0x1fb89f,_0x289026,_0x5b9bbe){logger[_0x82fa('0x16')](_0x82fa('0x17'));var _0x208ec4=_['merge']({'parent_id':'','assigned_user_id':_0x3150ba['id'],'ticketpriorities':_0x82fa('0x18'),'ticketstatus':_0x82fa('0x19'),'ticket_title':intUtil[_0x82fa('0x1a')](_0x12e89a['Subjects'],_0x1fb89f,'\x20'),'description':intUtil['getString'](_0x12e89a[_0x82fa('0x1b')],_0x1fb89f,'\x0a'),'contact_id':_0xa8b43d['id']},getCustomFields(_0x289026,_0x1fb89f));var _0x5b630c={'method':_0x82fa('0x1c'),'uri':util[_0x82fa('0x1d')](_0x82fa('0x1e'),_0x5104fc[_0x82fa('0x1f')]),'form':{'operation':'create','username':_0x5104fc[_0x82fa('0x20')],'sessionName':_0x5b9bbe[_0x82fa('0x21')],'elementType':_0x82fa('0x22'),'element':JSON['stringify'](_0x208ec4)},'json':!![]};return request(_0x5b630c)[_0x82fa('0x23')](function(_0x441aca){if(_0x441aca[_0x82fa('0x24')]){return BPromise[_0x82fa('0x25')]({'id':_0x441aca[_0x82fa('0x26')]['id']});}else{throw new Error(util[_0x82fa('0x1d')](_0x82fa('0x27'),JSON['stringify'](_0x441aca[_0x82fa('0x28')])));}})[_0x82fa('0x29')](function(_0x5dbd7a){var _0x1bbe00=_0x5dbd7a[_0x82fa('0x2a')]||0x1f4;logger[_0x82fa('0x28')](_0x82fa('0x2b'),_0x82fa('0x2c'),_0x1bbe00,JSON[_0x82fa('0x2d')](_0x5dbd7a));});}function getUser(_0x4aae32,_0x530e33,_0x986141){if(intUtil[_0x82fa('0x2e')](_0x530e33)){logger['info'](_0x82fa('0x2f'),_0x530e33);return request({'method':'GET','uri':util['format'](_0x82fa('0x1e'),_0x4aae32[_0x82fa('0x1f')]),'qs':{'operation':_0x82fa('0x30'),'username':_0x4aae32[_0x82fa('0x20')],'sessionName':_0x986141['sessionName'],'query':util[_0x82fa('0x1d')](_0x82fa('0x31'),_0x530e33)},'json':!![]})['then'](function(_0x5b53cf){if(_0x5b53cf[_0x82fa('0x24')]&&_0x5b53cf[_0x82fa('0x26')][_0x82fa('0xb')]){logger['info']('Agent\x20found!');return BPromise[_0x82fa('0x25')]({'id':_0x5b53cf[_0x82fa('0x26')][0x0]['id'],'email':_0x5b53cf['result'][0x0][_0x82fa('0x32')],'name':_0x5b53cf[_0x82fa('0x26')][0x0][_0x82fa('0x33')]+'\x20'+_0x5b53cf[_0x82fa('0x26')][_0x82fa('0x34')]});}else{logger[_0x82fa('0x16')](_0x82fa('0x35'));return BPromise[_0x82fa('0x25')]({'id':_0x986141[_0x82fa('0x36')],'email':_0x4aae32[_0x82fa('0x20')],'name':_0x82fa('0x37')});}})[_0x82fa('0x29')](function(_0x5e6af9){var _0x557365=_0x5e6af9[_0x82fa('0x2a')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x82fa('0x38'),_0x557365,JSON[_0x82fa('0x2d')](_0x5e6af9));});}else{logger[_0x82fa('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x986141[_0x82fa('0x36')],'email':_0x4aae32[_0x82fa('0x20')],'name':_0x82fa('0x37')})[_0x82fa('0x29')](function(_0xe3445f){var _0x2de792=_0xe3445f[_0x82fa('0x2a')]||0x1f4;logger[_0x82fa('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x82fa('0x38'),_0x2de792,JSON[_0x82fa('0x2d')](_0xe3445f));});}}function getEndUser(_0x1abbfe,_0x2cdd12,_0x5df778,_0x170cb8){logger[_0x82fa('0x16')](_0x82fa('0x39'),_0x5df778);return request({'method':_0x82fa('0x3a'),'uri':util[_0x82fa('0x1d')]('%s/webservice.php',_0x1abbfe[_0x82fa('0x1f')]),'qs':{'operation':'query','username':_0x1abbfe['username'],'sessionName':_0x170cb8[_0x82fa('0x21')],'query':util['format'](_0x82fa('0x3b'),_0x5df778,_0x5df778,_0x5df778,_0x5df778,_0x5df778)},'json':!![]})[_0x82fa('0x23')](function(_0x71a05d){if(_0x71a05d[_0x82fa('0x24')]&&_0x71a05d[_0x82fa('0x26')][_0x82fa('0xb')]){logger[_0x82fa('0x16')](_0x82fa('0x3c'));return BPromise[_0x82fa('0x25')]({'id':_0x71a05d[_0x82fa('0x26')][0x0]['id'],'name':_0x71a05d[_0x82fa('0x26')][0x0][_0x82fa('0x3d')]+'\x20'+_0x71a05d[_0x82fa('0x26')][0x0][_0x82fa('0x3e')],'phone':_0x5df778});}else{logger[_0x82fa('0x16')](_0x82fa('0x3f'));return request({'method':'POST','uri':util[_0x82fa('0x1d')](_0x82fa('0x1e'),_0x1abbfe[_0x82fa('0x1f')]),'form':{'operation':_0x82fa('0x40'),'sessionName':_0x170cb8[_0x82fa('0x21')],'elementType':_0x82fa('0x41'),'element':JSON['stringify']({'lastname':_0x2cdd12,'phone':_0x5df778,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x39beaf){logger[_0x82fa('0x16')]('Enduser\x20created.');return BPromise[_0x82fa('0x25')]({'id':_0x39beaf[_0x82fa('0x26')]['id'],'name':_0x39beaf[_0x82fa('0x26')][_0x82fa('0x3e')],'phone':_0x39beaf[_0x82fa('0x26')][_0x82fa('0x42')]});})[_0x82fa('0x29')](function(_0x496837){var _0x4c2aba=_0x496837[_0x82fa('0x2a')]||0x1f4;logger[_0x82fa('0x28')](_0x82fa('0x2b'),_0x82fa('0x43'),_0x4c2aba,JSON[_0x82fa('0x2d')](_0x496837));});}});}function getConnection(_0x24a871){var _0x32de50=_0x24a871[_0x82fa('0x20')];var _0x3387aa=_0x24a871['accessKey'];return request({'method':_0x82fa('0x3a'),'uri':util['format'](_0x82fa('0x1e'),_0x24a871[_0x82fa('0x1f')]),'qs':{'operation':_0x82fa('0x44'),'username':_0x32de50},'json':!![]})['then'](function(_0x564d22){if(_0x564d22[_0x82fa('0x24')]){return request({'method':_0x82fa('0x1c'),'uri':util[_0x82fa('0x1d')]('%s/webservice.php',_0x24a871[_0x82fa('0x1f')]),'form':{'operation':_0x82fa('0x45'),'username':_0x32de50,'accessKey':md5(_0x564d22[_0x82fa('0x26')]['token']+_0x3387aa)},'json':!![]});}})[_0x82fa('0x23')](function(_0x44b058){if(_0x44b058[_0x82fa('0x24')]){return BPromise[_0x82fa('0x25')](_0x44b058['result']);}else{throw new Error(util[_0x82fa('0x1d')](_0x82fa('0x46'),_0x24a871['id']));}})[_0x82fa('0x29')](function(_0x37fd46){var _0x2d4796=_0x37fd46['statusCode']||0x1f4;logger[_0x82fa('0x28')](_0x82fa('0x2b'),'getConnection',_0x2d4796,JSON['stringify'](_0x37fd46));});}function request(_0x3df24d){logger[_0x82fa('0x16')]('[HTTP]',JSON[_0x82fa('0x2d')](_0x3df24d));return rp(_0x3df24d);}exports['queue']=function(_0xe21c38,_0x393a8d,_0x584d48,_0x12fbb2,_0x2f1d55,_0x474061){var _0x26ac50,_0x69c128,_0xb8ad9,_0x350890;_0x474061[_0x82fa('0x1f')]=intUtil[_0x82fa('0x47')](_0x474061['remoteUri']);if(_0x2f1d55&&_0x2f1d55['monitor_format']){logger['info'](_0x82fa('0x48'),_0x82fa('0x49'));_0x393a8d[_0x82fa('0x4a')]=util[_0x82fa('0x1d')](_0x82fa('0x4b'),_0x474061[_0x82fa('0x4c')],_0x393a8d[_0x82fa('0x4d')],md5(_0x393a8d[_0x82fa('0x4d')]));}else{_0x393a8d[_0x82fa('0x4a')]='';}return getConnection(_0x474061)[_0x82fa('0x23')](function(_0x2ce245){_0x350890=_0x2ce245;return getUser(_0x474061,_0x12fbb2[_0x82fa('0x4e')],_0x350890);})[_0x82fa('0x23')](function(_0x1ca1fc){_0x26ac50=_0x1ca1fc;logger['info']('The\x20User\x20ID\x20is:',_0x26ac50['id']);return getEndUser(_0x474061,_0x393a8d[_0x82fa('0x4f')],_0x393a8d[_0x82fa('0x50')],_0x350890);})['then'](function(_0x5d2d7b){_0x69c128=_0x5d2d7b;logger[_0x82fa('0x16')](_0x82fa('0x51'),_0x69c128['id']);return createTicket(_0x474061,_0x26ac50,_0x69c128,_0x584d48,_0x393a8d,_0x584d48['Fields'],_0x350890);})[_0x82fa('0x23')](function(_0x545063){_0xb8ad9=_0x545063;logger[_0x82fa('0x16')](_0x82fa('0x52'));logger[_0x82fa('0x16')](_0x82fa('0x53'),_0xb8ad9['id']);var _0x453268=util[_0x82fa('0x1d')](_0x82fa('0x54'),_0x474061[_0x82fa('0x1f')],_['split'](_0xb8ad9['id'],'x')[0x1]);logger[_0x82fa('0x16')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x82fa('0x1d')](_0x82fa('0x55'),_0x12fbb2[_0x82fa('0x14')]),_0x82fa('0x56'),{'uri':_0x453268});})[_0x82fa('0x29')](function(_0x213619){logger[_0x82fa('0x28')]('[QUEUE]',JSON['stringify'](_0x213619));});};exports['outbound']=function(_0x4c4fcd,_0x1b7000,_0x311f95,_0x2be6fb,_0x26a167,_0x5ed902,_0x253f0e){var _0x52af3a,_0x189c4c,_0x3a3c82,_0x514d87;_0x5ed902[_0x82fa('0x1f')]=intUtil[_0x82fa('0x47')](_0x5ed902[_0x82fa('0x1f')]);_0x5ed902['serverUrl']=intUtil[_0x82fa('0x47')](_0x5ed902[_0x82fa('0x4c')]);if(_0x253f0e&&_0x253f0e['recordingFormat']&&_0x253f0e[_0x82fa('0x57')]!==_0x82fa('0x58')){logger[_0x82fa('0x16')](_0x82fa('0x59'),'Recording\x20is\x20enabled!');_0x1b7000[_0x82fa('0x4a')]=util[_0x82fa('0x1d')](_0x82fa('0x4b'),_0x5ed902[_0x82fa('0x4c')],_0x1b7000[_0x82fa('0x4d')],md5(_0x1b7000[_0x82fa('0x4d')]));}return getConnection(_0x5ed902)[_0x82fa('0x23')](function(_0x234be8){_0x514d87=_0x234be8;return getUser(_0x5ed902,_0x2be6fb['email'],_0x514d87);})[_0x82fa('0x23')](function(_0x538e8a){_0x52af3a=_0x538e8a;logger['info'](_0x82fa('0x5a'),_0x52af3a['id']);return getEndUser(_0x5ed902,_0x1b7000['destcalleridname'],_0x1b7000[_0x82fa('0x5b')],_0x514d87);})['then'](function(_0xad1034){_0x189c4c=_0xad1034;logger[_0x82fa('0x16')](_0x82fa('0x51'),_0x189c4c['id']);return createTicket(_0x5ed902,_0x52af3a,_0x189c4c,_0x311f95,_0x1b7000,_0x311f95['Fields'],_0x514d87);})[_0x82fa('0x23')](function(_0xa0d9d8){_0x3a3c82=_0xa0d9d8;logger[_0x82fa('0x16')](_0x82fa('0x52'));logger[_0x82fa('0x16')](_0x82fa('0x53'),_0x3a3c82['id']);var _0x4cb7da=util[_0x82fa('0x1d')](_0x82fa('0x54'),_0x5ed902[_0x82fa('0x1f')],_[_0x82fa('0x5c')](_0x3a3c82['id'],'x')[0x1]);logger[_0x82fa('0x16')](_0x82fa('0x59'),_0x82fa('0x5d'));emit(util[_0x82fa('0x1d')]('user:%s',_0x2be6fb[_0x82fa('0x14')]),_0x82fa('0x56'),{'uri':_0x4cb7da});})[_0x82fa('0x29')](function(_0x3b42a3){logger[_0x82fa('0x28')]('[OUTBOUND]',JSON[_0x82fa('0x2d')](_0x3b42a3));});};exports[_0x82fa('0x5e')]=function(_0xc5407d,_0x3460b9,_0x5d77b9,_0x3f941a,_0x135eee,_0x499a94){var _0x3faaf0,_0x18c6d3,_0x16e275,_0x77c8c1;_0x499a94['remoteUri']=intUtil[_0x82fa('0x47')](_0x499a94[_0x82fa('0x1f')]);_0x499a94[_0x82fa('0x4c')]=intUtil['stripTrailingSlash'](_0x499a94['serverUrl']);if(_0x135eee&&_0x135eee['monitor_format']){logger[_0x82fa('0x16')]('['+_0x3460b9[_0x82fa('0x5f')][_0x82fa('0x60')]()+']',_0x82fa('0x49'));_0x3460b9[_0x82fa('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x499a94['serverUrl'],_0x3460b9[_0x82fa('0x4d')],md5(_0x3460b9[_0x82fa('0x4d')]));}else{_0x3460b9[_0x82fa('0x4a')]='';}return getConnection(_0x499a94)[_0x82fa('0x23')](function(_0x46994c){_0x77c8c1=_0x46994c;return getUser(_0x499a94,'',_0x77c8c1);})[_0x82fa('0x23')](function(_0x4db2eb){_0x3faaf0=_0x4db2eb;logger[_0x82fa('0x16')](_0x82fa('0x5a'),_0x3faaf0['id']);return getEndUser(_0x499a94,_0x3460b9['calleridname'],_0x3460b9[_0x82fa('0x50')],_0x77c8c1);})[_0x82fa('0x23')](function(_0x5e7213){_0x18c6d3=_0x5e7213;logger['info']('The\x20Enduser\x20ID\x20is:',_0x18c6d3['id']);return createTicket(_0x499a94,_0x3faaf0,_0x18c6d3,_0x5d77b9,_0x3460b9,_0x5d77b9['Fields'],_0x77c8c1);})[_0x82fa('0x23')](function(_0x55359f){_0x16e275=_0x55359f;logger['info']('Ticket\x20created!');logger[_0x82fa('0x16')]('The\x20Ticket\x20ID\x20is:',_0x16e275['id']);})['catch'](function(_0x24c4a6){logger[_0x82fa('0x28')]('['+_0x3460b9[_0x82fa('0x5f')][_0x82fa('0x60')]()+']',JSON[_0x82fa('0x2d')](_0x24c4a6));});}; \ 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 27df0c9..933ba65 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 _0x5ff3=['then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','authType','password','%s:%s','username','token','%s/token:%s','toString','debug','[HTTP]','stringify','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','catch','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','The\x20Ticket\x20ID\x20is:','integrationTab','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','format','merge','Tags','name','getString','Descriptions','Fields'];(function(_0x264f7e,_0x2a93cf){var _0xb78d85=function(_0x5c1141){while(--_0x5c1141){_0x264f7e['push'](_0x264f7e['shift']());}};_0xb78d85(++_0x2a93cf);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5771f1,_0x3474f5){_0x5771f1=_0x5771f1-0x0;var _0x365664=_0x5ff3[_0x5771f1];return _0x365664;};'use strict';var _=require('lodash');var rp=require(_0x35ff('0x0'));var md5=require('md5');var util=require(_0x35ff('0x1'));var Redis=require('ioredis');var intUtil=require(_0x35ff('0x2'));var config=require(_0x35ff('0x3'));var logger=require(_0x35ff('0x4'))(_0x35ff('0x5'));config['redis']=_[_0x35ff('0x6')](config[_0x35ff('0x7')],{'host':_0x35ff('0x8'),'port':0x18eb});var io=require(_0x35ff('0x9'))(new Redis(config[_0x35ff('0x7')]));function emit(_0x495c31,_0x92b403,_0x4c9fab){io['to'](_0x495c31)[_0x35ff('0xa')](_0x92b403,_0x4c9fab);}var headers={'Content-Type':_0x35ff('0xb'),'Accept':_0x35ff('0xb')};function getTicket(_0x51967a,_0x20647e,_0x59ec4f,_0x1cd2c6,_0x228fea){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x35ff('0xc')]('%s/tickets.json',_0x51967a['remoteUri']),'method':'POST','body':{'ticket':_[_0x35ff('0xd')]({'requester_id':_0x59ec4f['id'],'submitter_id':_0x20647e?_0x20647e['id']:undefined,'assignee_id':_0x20647e?_0x20647e['id']:undefined,'tags':getTags(_0x1cd2c6[_0x35ff('0xe')],_0x35ff('0xf')),'subject':intUtil[_0x35ff('0x10')](_0x1cd2c6['Subjects'],_0x228fea,'\x20'),'description':intUtil[_0x35ff('0x10')](_0x1cd2c6[_0x35ff('0x11')],_0x228fea,'\x0a'),'comment':{'public':![],'body':intUtil[_0x35ff('0x10')](_0x1cd2c6['Descriptions'],_0x228fea,'\x0a')}},getCustomFields(_0x1cd2c6[_0x35ff('0x12')],_0x228fea))}})[_0x35ff('0x13')](function(_0x254975){logger[_0x35ff('0x14')](_0x35ff('0x15'));return _0x254975[_0x35ff('0x16')];});}function getUser(_0x2d4a88,_0x28def2){if(intUtil[_0x35ff('0x17')](_0x28def2)){logger[_0x35ff('0x14')](_0x35ff('0x18'),_0x28def2);return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x19'),_0x2d4a88[_0x35ff('0x1a')]),'qs':{'query':util[_0x35ff('0xc')]('type:user\x20role:agent\x20email:%s',_0x28def2)}})[_0x35ff('0x13')](function(_0x1fc4b7){if(_0x1fc4b7[_0x35ff('0x1b')]){logger[_0x35ff('0x14')]('Agent\x20found!');return _['find'](_0x1fc4b7[_0x35ff('0x1c')],{'email':_0x28def2,'role':_0x35ff('0x1d')});}else{logger['info'](_0x35ff('0x1e'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x1f'),_0x2d4a88[_0x35ff('0x1a')])})['then'](function(_0x3d60b4){logger['info'](_0x35ff('0x20'));return _0x3d60b4[_0x35ff('0x21')];});}});}else{logger[_0x35ff('0x14')](_0x35ff('0x1e'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x1f'),_0x2d4a88[_0x35ff('0x1a')])})['then'](function(_0x284f39){logger[_0x35ff('0x14')]('Admin\x20account\x20selected.');return _0x284f39[_0x35ff('0x21')];});}}function getEndUser(_0x5ad0c6,_0x4c46b7,_0x186768){logger[_0x35ff('0x14')](_0x35ff('0x22'),_0x186768);return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x19'),_0x5ad0c6['remoteUri']),'qs':{'query':util[_0x35ff('0xc')](_0x35ff('0x23'),_0x186768)}})[_0x35ff('0x13')](function(_0x5e191b){var _0x3357a;if(_0x5e191b[_0x35ff('0x1c')][_0x35ff('0x24')]){_0x5e191b[_0x35ff('0x1c')]=_[_0x35ff('0x25')](_0x5e191b[_0x35ff('0x1c')],{'suspended':![],'role':_0x35ff('0x26')});if(_0x5e191b[_0x35ff('0x1c')][_0x35ff('0x24')]){_0x3357a=_['first'](_0x5e191b[_0x35ff('0x1c')]);}}if(_0x3357a){logger['info'](_0x35ff('0x27'));return _0x3357a;}else{logger[_0x35ff('0x14')](_0x35ff('0x28'));return request({'uri':util[_0x35ff('0xc')]('%s/users.json',_0x5ad0c6[_0x35ff('0x1a')]),'method':'POST','body':{'user':{'role':_0x35ff('0x26'),'name':util[_0x35ff('0xc')]('Caller\x20-\x20%s',_0x4c46b7||_0x186768),'phone':_0x186768}}})['then'](function(_0x3a39e5){logger[_0x35ff('0x14')]('Enduser\x20created.');return _0x3a39e5[_0x35ff('0x21')];});}});}function getAuth(_0x2fd48d){var _0x4d194c;if(_0x2fd48d[_0x35ff('0x29')]===_0x35ff('0x2a')){_0x4d194c=util[_0x35ff('0xc')](_0x35ff('0x2b'),_0x2fd48d[_0x35ff('0x2c')],_0x2fd48d[_0x35ff('0x2a')]);}else if(_0x2fd48d[_0x35ff('0x29')]===_0x35ff('0x2d')){_0x4d194c=util[_0x35ff('0xc')](_0x35ff('0x2e'),_0x2fd48d[_0x35ff('0x2c')],_0x2fd48d[_0x35ff('0x2d')]);}return util[_0x35ff('0xc')]('Basic\x20%s',new Buffer(_0x4d194c)[_0x35ff('0x2f')]('base64'));}function request(_0x173b64){logger[_0x35ff('0x30')](_0x35ff('0x31'),JSON[_0x35ff('0x32')](_0x173b64));return rp(_[_0x35ff('0x6')](_0x173b64,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x272ef5,_0x29a01a){var _0x309c0d=[];if(_0x272ef5&&_0x272ef5[_0x35ff('0x24')]>0x0){_0x309c0d=_[_0x35ff('0x33')](_0x272ef5,_0x29a01a);}return _0x309c0d;}function getCustomFields(_0x51d18d,_0x2d6add){var _0x36e104=[];var _0x1640b5={'custom_fields':[]};if(_0x51d18d['length']>0x0){_['forEach'](_0x51d18d,function(_0x471857){if(_0x471857[_0x35ff('0x34')]===_0x35ff('0x35')&&_0x471857[_0x35ff('0x36')]&&!_0x471857[_0x35ff('0x37')]){_0x1640b5[_0x471857[_0x35ff('0x36')][_0x35ff('0x38')]()]=_0x471857[_0x35ff('0x39')]['toString']();}else if(_0x471857['type']==='string'&&_0x471857[_0x35ff('0x3a')]&&_0x471857[_0x35ff('0x37')]){_0x1640b5[_0x35ff('0x3b')][_0x35ff('0x3c')]({'id':_0x471857[_0x35ff('0x3a')],'value':_0x471857['content'][_0x35ff('0x2f')]()});}else if(_0x471857[_0x35ff('0x34')]===_0x35ff('0x3d')&&_0x471857[_0x35ff('0x3e')]&&_0x471857[_0x35ff('0x3a')]&&_0x471857[_0x35ff('0x37')]){_0x2d6add[_0x471857['variableName']]&&_0x1640b5['custom_fields'][_0x35ff('0x3c')]({'id':_0x471857[_0x35ff('0x3a')],'value':_0x2d6add[_0x471857[_0x35ff('0x3e')]][_0x35ff('0x2f')]()});}else if(_0x471857['type']==='customVariable'&&_0x471857[_0x35ff('0x3f')]&&_0x471857[_0x35ff('0x3f')][_0x35ff('0xf')]&&_0x471857[_0x35ff('0x3a')]&&_0x471857[_0x35ff('0x37')]){_0x2d6add[_0x471857[_0x35ff('0x3f')][_0x35ff('0xf')]['toLowerCase']()]&&_0x1640b5['custom_fields'][_0x35ff('0x3c')]({'id':_0x471857[_0x35ff('0x3a')],'value':_0x2d6add[_0x471857[_0x35ff('0x3f')]['name'][_0x35ff('0x38')]()][_0x35ff('0x2f')]()});}});}return _0x1640b5;}exports['queue']=function(_0x4f3983,_0x14a44f,_0x4ab78e,_0x2d026b,_0x20806d,_0x5e95ad){var _0x2ecbb8,_0x4b1b86;_0x5e95ad['remoteUri']=intUtil[_0x35ff('0x40')](_0x5e95ad[_0x35ff('0x1a')]);_0x5e95ad[_0x35ff('0x41')]=intUtil[_0x35ff('0x40')](_0x5e95ad[_0x35ff('0x41')]);if(_0x20806d&&_0x20806d[_0x35ff('0x42')]){logger[_0x35ff('0x14')](_0x35ff('0x43'),_0x35ff('0x44'));_0x14a44f[_0x35ff('0x45')]=util[_0x35ff('0xc')](_0x35ff('0x46'),_0x5e95ad['serverUrl'],_0x14a44f[_0x35ff('0x47')],md5(_0x14a44f[_0x35ff('0x47')]));}else{_0x14a44f[_0x35ff('0x45')]='';}headers[_0x35ff('0x48')]=getAuth(_0x5e95ad);return getUser(_0x5e95ad,_0x2d026b['email'])['then'](function(_0x672938){_0x2ecbb8=_0x672938;logger['info'](_0x35ff('0x49'),_0x2ecbb8['id']);return getEndUser(_0x5e95ad,_0x14a44f[_0x35ff('0x4a')],_0x14a44f[_0x35ff('0x4b')]);})[_0x35ff('0x13')](function(_0x25854b){_0x4b1b86=_0x25854b;logger[_0x35ff('0x14')](_0x35ff('0x4c'),_0x4b1b86['id']);return getTicket(_0x5e95ad,_0x2ecbb8,_0x4b1b86,_0x4ab78e,_0x14a44f);})[_0x35ff('0x13')](function(_0x3be5fc){if(_0x3be5fc){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3be5fc['id']);switch(_0x5e95ad[_0x35ff('0x34')]){case'integrationTab':logger[_0x35ff('0x14')](_0x35ff('0x43'),_0x35ff('0x4d'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x4e'),_0x5e95ad[_0x35ff('0x1a')],_0x2ecbb8['id'],_0x3be5fc['id']),'method':_0x35ff('0x4f')});case _0x35ff('0x50'):logger[_0x35ff('0x14')]('[QUEUE]',_0x35ff('0x51'));emit(util[_0x35ff('0xc')](_0x35ff('0x52'),_0x2d026b[_0x35ff('0xf')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x5e95ad[_0x35ff('0x1a')],_0x3be5fc['id'])});break;default:logger[_0x35ff('0x53')](_0x35ff('0x43'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x35ff('0x54')](function(_0x5943fc){logger[_0x35ff('0x53')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x35ff('0x55')](_0x5943fc,{'showHidden':!![],'depth':null}));});};exports[_0x35ff('0x56')]=function(_0x681d2b,_0x3a7261,_0x50f820,_0x497b38,_0x2be86b,_0x52e0b7,_0x241263){var _0x3948cb,_0x52802a;_0x52e0b7[_0x35ff('0x1a')]=intUtil['stripTrailingSlash'](_0x52e0b7[_0x35ff('0x1a')]);_0x52e0b7[_0x35ff('0x41')]=intUtil[_0x35ff('0x40')](_0x52e0b7[_0x35ff('0x41')]);if(_0x241263&&_0x241263[_0x35ff('0x57')]&&_0x241263[_0x35ff('0x57')]!=='none'){logger['info'](_0x35ff('0x58'),_0x35ff('0x44'));_0x3a7261['recordingURL']=util[_0x35ff('0xc')](_0x35ff('0x46'),_0x52e0b7['serverUrl'],_0x3a7261[_0x35ff('0x47')],md5(_0x3a7261[_0x35ff('0x47')]));}headers[_0x35ff('0x48')]=getAuth(_0x52e0b7);return getUser(_0x52e0b7,_0x497b38[_0x35ff('0x59')])[_0x35ff('0x13')](function(_0x585941){_0x3948cb=_0x585941;logger['info']('The\x20User\x20ID\x20is:',_0x3948cb['id']);return getEndUser(_0x52e0b7,_0x3a7261[_0x35ff('0x5a')],_0x3a7261['destcalleridnum']);})[_0x35ff('0x13')](function(_0x55ff13){_0x52802a=_0x55ff13;logger[_0x35ff('0x14')](_0x35ff('0x4c'),_0x52802a['id']);return getTicket(_0x52e0b7,_0x3948cb,_0x52802a,_0x50f820,_0x3a7261);})[_0x35ff('0x13')](function(_0x5b282){if(_0x5b282){logger[_0x35ff('0x14')](_0x35ff('0x5b'),_0x5b282['id']);switch(_0x52e0b7['type']){case _0x35ff('0x5c'):logger[_0x35ff('0x14')]('[OUTBOUND]',_0x35ff('0x4d'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x4e'),_0x52e0b7[_0x35ff('0x1a')],_0x3948cb['id'],_0x5b282['id']),'method':_0x35ff('0x4f')});case _0x35ff('0x50'):logger[_0x35ff('0x14')](_0x35ff('0x58'),_0x35ff('0x51'));emit(util['format'](_0x35ff('0x52'),_0x497b38[_0x35ff('0xf')]),_0x35ff('0x5d'),{'uri':util[_0x35ff('0xc')](_0x35ff('0x5e'),_0x52e0b7[_0x35ff('0x1a')],_0x5b282['id'])});break;default:logger['error'](_0x35ff('0x58'),_0x35ff('0x5f'));}}})[_0x35ff('0x54')](function(_0x5a561a){logger[_0x35ff('0x53')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x5a561a,{'showHidden':!![],'depth':null}));});};exports[_0x35ff('0x60')]=function(_0x378b40,_0x4a8907,_0x42c1e3,_0x305f15,_0x36e334,_0x974edb){var _0x3a8026,_0x2b0064;_0x974edb[_0x35ff('0x1a')]=intUtil[_0x35ff('0x40')](_0x974edb[_0x35ff('0x1a')]);_0x974edb[_0x35ff('0x41')]=intUtil[_0x35ff('0x40')](_0x974edb[_0x35ff('0x41')]);if(_0x36e334&&_0x36e334[_0x35ff('0x42')]){logger[_0x35ff('0x14')]('['+_0x4a8907[_0x35ff('0x61')][_0x35ff('0x62')]()+']','Recording\x20is\x20enabled!');_0x4a8907[_0x35ff('0x45')]=util[_0x35ff('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x974edb[_0x35ff('0x41')],_0x4a8907[_0x35ff('0x47')],md5(_0x4a8907['uniqueid']));}else{_0x4a8907['recordingURL']='';}headers[_0x35ff('0x48')]=getAuth(_0x974edb);return getUser(_0x974edb)['then'](function(_0x3f87a6){_0x3a8026=_0x3f87a6;logger[_0x35ff('0x14')](_0x35ff('0x49'),_0x3a8026['id']);return getEndUser(_0x974edb,_0x4a8907[_0x35ff('0x4a')],_0x4a8907[_0x35ff('0x4b')]);})[_0x35ff('0x13')](function(_0x1f2f58){_0x2b0064=_0x1f2f58;logger[_0x35ff('0x14')](_0x35ff('0x4c'),_0x2b0064['id']);return getTicket(_0x974edb,_0x3a8026,_0x2b0064,_0x42c1e3,_0x4a8907);})['then'](function(_0x33d816){if(_0x33d816){logger['info'](_0x35ff('0x5b'),_0x33d816['id']);}})['catch'](function(_0x461c90){logger[_0x35ff('0x53')]('['+_0x4a8907[_0x35ff('0x61')][_0x35ff('0x62')]()+']'+_0x35ff('0x63'),util['inspect'](_0x461c90,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4ded=['%s/token:%s','toString','base64','[HTTP]','stringify','GET','forEach','type','nameField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','customField','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token'];(function(_0x571553,_0x492e57){var _0x3198cf=function(_0x415a36){while(--_0x415a36){_0x571553['push'](_0x571553['shift']());}};_0x3198cf(++_0x492e57);}(_0x4ded,0x116));var _0xd4de=function(_0xe29eb,_0x49c9ef){_0xe29eb=_0xe29eb-0x0;var _0x1e211e=_0x4ded[_0xe29eb];return _0x1e211e;};'use strict';var _=require(_0xd4de('0x0'));var rp=require(_0xd4de('0x1'));var md5=require(_0xd4de('0x2'));var util=require(_0xd4de('0x3'));var Redis=require(_0xd4de('0x4'));var intUtil=require(_0xd4de('0x5'));var config=require(_0xd4de('0x6'));var logger=require(_0xd4de('0x7'))(_0xd4de('0x8'));config[_0xd4de('0x9')]=_[_0xd4de('0xa')](config[_0xd4de('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xd4de('0xb'))(new Redis(config[_0xd4de('0x9')]));function emit(_0x15eb91,_0x2c56d5,_0x4453c2){io['to'](_0x15eb91)[_0xd4de('0xc')](_0x2c56d5,_0x4453c2);}var headers={'Content-Type':'application/json','Accept':_0xd4de('0xd')};function getTicket(_0x5ebcf3,_0x4ab822,_0x4b0876,_0x176b31,_0x459a46){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0xd4de('0xe'),_0x5ebcf3['remoteUri']),'method':_0xd4de('0xf'),'body':{'ticket':_[_0xd4de('0x10')]({'requester_id':_0x4b0876['id'],'submitter_id':_0x4ab822?_0x4ab822['id']:undefined,'assignee_id':_0x4ab822?_0x4ab822['id']:undefined,'tags':getTags(_0x176b31[_0xd4de('0x11')],_0xd4de('0x12')),'subject':intUtil[_0xd4de('0x13')](_0x176b31[_0xd4de('0x14')],_0x459a46,'\x20'),'description':intUtil[_0xd4de('0x13')](_0x176b31[_0xd4de('0x15')],_0x459a46,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd4de('0x13')](_0x176b31[_0xd4de('0x15')],_0x459a46,'\x0a')}},getCustomFields(_0x176b31[_0xd4de('0x16')],_0x459a46))}})[_0xd4de('0x17')](function(_0x164ca0){logger[_0xd4de('0x18')](_0xd4de('0x19'));return _0x164ca0[_0xd4de('0x1a')];});}function getUser(_0x325fba,_0x4b0a95){if(intUtil['validateEmail'](_0x4b0a95)){logger[_0xd4de('0x18')](_0xd4de('0x1b'),_0x4b0a95);return request({'uri':util[_0xd4de('0x1c')](_0xd4de('0x1d'),_0x325fba['remoteUri']),'qs':{'query':util['format'](_0xd4de('0x1e'),_0x4b0a95)}})['then'](function(_0xeaaefa){if(_0xeaaefa[_0xd4de('0x1f')]){logger['info'](_0xd4de('0x20'));return _['find'](_0xeaaefa[_0xd4de('0x21')],{'email':_0x4b0a95,'role':_0xd4de('0x22')});}else{logger[_0xd4de('0x18')](_0xd4de('0x23'));return request({'uri':util['format'](_0xd4de('0x24'),_0x325fba[_0xd4de('0x25')])})[_0xd4de('0x17')](function(_0xdb3fc){logger[_0xd4de('0x18')](_0xd4de('0x26'));return _0xdb3fc[_0xd4de('0x27')];});}});}else{logger[_0xd4de('0x18')](_0xd4de('0x23'));return request({'uri':util[_0xd4de('0x1c')]('%s/users/me.json',_0x325fba[_0xd4de('0x25')])})[_0xd4de('0x17')](function(_0x221f26){logger[_0xd4de('0x18')](_0xd4de('0x26'));return _0x221f26[_0xd4de('0x27')];});}}function getEndUser(_0xffe1cc,_0x36308c,_0x2aa82a){logger[_0xd4de('0x18')](_0xd4de('0x28'),_0x2aa82a);return request({'uri':util[_0xd4de('0x1c')]('%s/search.json',_0xffe1cc[_0xd4de('0x25')]),'qs':{'query':util[_0xd4de('0x1c')]('type:user\x20role:end-user\x20phone:%s',_0x2aa82a)}})[_0xd4de('0x17')](function(_0x59b3c5){var _0x44b710;if(_0x59b3c5[_0xd4de('0x21')][_0xd4de('0x29')]){_0x59b3c5['results']=_[_0xd4de('0x2a')](_0x59b3c5[_0xd4de('0x21')],{'suspended':![],'role':_0xd4de('0x2b')});if(_0x59b3c5['results'][_0xd4de('0x29')]){_0x44b710=_[_0xd4de('0x2c')](_0x59b3c5['results']);}}if(_0x44b710){logger['info']('Enduser\x20found!');return _0x44b710;}else{logger[_0xd4de('0x18')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd4de('0x1c')](_0xd4de('0x2d'),_0xffe1cc[_0xd4de('0x25')]),'method':_0xd4de('0xf'),'body':{'user':{'role':'end-user','name':util[_0xd4de('0x1c')](_0xd4de('0x2e'),_0x36308c||_0x2aa82a),'phone':_0x2aa82a}}})['then'](function(_0x133a43){logger[_0xd4de('0x18')]('Enduser\x20created.');return _0x133a43['user'];});}});}function getAuth(_0x16e7a9){var _0x40114b;if(_0x16e7a9[_0xd4de('0x2f')]===_0xd4de('0x30')){_0x40114b=util['format'](_0xd4de('0x31'),_0x16e7a9[_0xd4de('0x32')],_0x16e7a9['password']);}else if(_0x16e7a9[_0xd4de('0x2f')]===_0xd4de('0x33')){_0x40114b=util[_0xd4de('0x1c')](_0xd4de('0x34'),_0x16e7a9[_0xd4de('0x32')],_0x16e7a9[_0xd4de('0x33')]);}return util['format']('Basic\x20%s',new Buffer(_0x40114b)[_0xd4de('0x35')](_0xd4de('0x36')));}function request(_0x400450){logger['debug'](_0xd4de('0x37'),JSON[_0xd4de('0x38')](_0x400450));return rp(_['defaults'](_0x400450,{'method':_0xd4de('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x4724bd,_0x4626c7){var _0x1f60e8=[];if(_0x4724bd&&_0x4724bd['length']>0x0){_0x1f60e8=_['map'](_0x4724bd,_0x4626c7);}return _0x1f60e8;}function getCustomFields(_0x421efb,_0x541777){var _0x3e5e34=[];var _0x4de12c={'custom_fields':[]};if(_0x421efb[_0xd4de('0x29')]>0x0){_[_0xd4de('0x3a')](_0x421efb,function(_0x21cd77){if(_0x21cd77[_0xd4de('0x3b')]==='string'&&_0x21cd77[_0xd4de('0x3c')]&&!_0x21cd77['customField']){_0x4de12c[_0x21cd77[_0xd4de('0x3c')][_0xd4de('0x3d')]()]=_0x21cd77[_0xd4de('0x3e')][_0xd4de('0x35')]();}else if(_0x21cd77[_0xd4de('0x3b')]===_0xd4de('0x3f')&&_0x21cd77[_0xd4de('0x40')]&&_0x21cd77['customField']){_0x4de12c[_0xd4de('0x41')][_0xd4de('0x42')]({'id':_0x21cd77[_0xd4de('0x40')],'value':_0x21cd77[_0xd4de('0x3e')][_0xd4de('0x35')]()});}else if(_0x21cd77['type']===_0xd4de('0x43')&&_0x21cd77[_0xd4de('0x44')]&&_0x21cd77[_0xd4de('0x40')]&&_0x21cd77['customField']){_0x541777[_0x21cd77[_0xd4de('0x44')]]&&_0x4de12c[_0xd4de('0x41')][_0xd4de('0x42')]({'id':_0x21cd77['idField'],'value':_0x541777[_0x21cd77[_0xd4de('0x44')]][_0xd4de('0x35')]()});}else if(_0x21cd77[_0xd4de('0x3b')]===_0xd4de('0x45')&&_0x21cd77[_0xd4de('0x46')]&&_0x21cd77[_0xd4de('0x46')][_0xd4de('0x12')]&&_0x21cd77['idField']&&_0x21cd77[_0xd4de('0x47')]){_0x541777[_0x21cd77[_0xd4de('0x46')][_0xd4de('0x12')]['toLowerCase']()]&&_0x4de12c[_0xd4de('0x41')][_0xd4de('0x42')]({'id':_0x21cd77[_0xd4de('0x40')],'value':_0x541777[_0x21cd77['Variable']['name'][_0xd4de('0x3d')]()][_0xd4de('0x35')]()});}});}return _0x4de12c;}exports['queue']=function(_0x1ee047,_0x1f477b,_0x3a3c63,_0x13b317,_0x564a96,_0x27afac){var _0x72d025,_0x579700;_0x27afac[_0xd4de('0x25')]=intUtil[_0xd4de('0x48')](_0x27afac[_0xd4de('0x25')]);_0x27afac['serverUrl']=intUtil[_0xd4de('0x48')](_0x27afac[_0xd4de('0x49')]);if(_0x564a96&&_0x564a96[_0xd4de('0x4a')]){logger[_0xd4de('0x18')](_0xd4de('0x4b'),_0xd4de('0x4c'));_0x1f477b[_0xd4de('0x4d')]=util[_0xd4de('0x1c')](_0xd4de('0x4e'),_0x27afac[_0xd4de('0x49')],_0x1f477b['uniqueid'],md5(_0x1f477b[_0xd4de('0x4f')]));}else{_0x1f477b[_0xd4de('0x4d')]='';}headers[_0xd4de('0x50')]=getAuth(_0x27afac);return getUser(_0x27afac,_0x13b317['email'])[_0xd4de('0x17')](function(_0x199204){_0x72d025=_0x199204;logger[_0xd4de('0x18')](_0xd4de('0x51'),_0x72d025['id']);return getEndUser(_0x27afac,_0x1f477b[_0xd4de('0x52')],_0x1f477b[_0xd4de('0x53')]);})[_0xd4de('0x17')](function(_0x29cb16){_0x579700=_0x29cb16;logger[_0xd4de('0x18')](_0xd4de('0x54'),_0x579700['id']);return getTicket(_0x27afac,_0x72d025,_0x579700,_0x3a3c63,_0x1f477b);})['then'](function(_0x3e4c7f){if(_0x3e4c7f){logger[_0xd4de('0x18')](_0xd4de('0x55'),_0x3e4c7f['id']);switch(_0x27afac[_0xd4de('0x3b')]){case _0xd4de('0x56'):logger['info']('[QUEUE]',_0xd4de('0x57'));return request({'uri':util[_0xd4de('0x1c')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x27afac['remoteUri'],_0x72d025['id'],_0x3e4c7f['id']),'method':_0xd4de('0xf')});case _0xd4de('0x58'):logger[_0xd4de('0x18')](_0xd4de('0x4b'),_0xd4de('0x59'));emit(util[_0xd4de('0x1c')](_0xd4de('0x5a'),_0x13b317[_0xd4de('0x12')]),_0xd4de('0x5b'),{'uri':util[_0xd4de('0x1c')](_0xd4de('0x5c'),_0x27afac[_0xd4de('0x25')],_0x3e4c7f['id'])});break;default:logger['error'](_0xd4de('0x4b'),_0xd4de('0x5d'));}}})[_0xd4de('0x5e')](function(_0x1da822){logger[_0xd4de('0x5f')](_0xd4de('0x60'),util['inspect'](_0x1da822,{'showHidden':!![],'depth':null}));});};exports[_0xd4de('0x61')]=function(_0x5896c5,_0x48fe2a,_0xa0242e,_0xd79781,_0x2d1e45,_0x1fe52b,_0x4e533c){var _0xfc79e7,_0x3d62c2;_0x1fe52b[_0xd4de('0x25')]=intUtil[_0xd4de('0x48')](_0x1fe52b[_0xd4de('0x25')]);_0x1fe52b['serverUrl']=intUtil['stripTrailingSlash'](_0x1fe52b['serverUrl']);if(_0x4e533c&&_0x4e533c[_0xd4de('0x62')]&&_0x4e533c[_0xd4de('0x62')]!==_0xd4de('0x63')){logger[_0xd4de('0x18')]('[OUTBOUND]',_0xd4de('0x4c'));_0x48fe2a[_0xd4de('0x4d')]=util[_0xd4de('0x1c')](_0xd4de('0x4e'),_0x1fe52b['serverUrl'],_0x48fe2a[_0xd4de('0x4f')],md5(_0x48fe2a[_0xd4de('0x4f')]));}headers[_0xd4de('0x50')]=getAuth(_0x1fe52b);return getUser(_0x1fe52b,_0xd79781[_0xd4de('0x64')])['then'](function(_0x4fd7c2){_0xfc79e7=_0x4fd7c2;logger['info'](_0xd4de('0x51'),_0xfc79e7['id']);return getEndUser(_0x1fe52b,_0x48fe2a[_0xd4de('0x65')],_0x48fe2a[_0xd4de('0x66')]);})['then'](function(_0x18f2c3){_0x3d62c2=_0x18f2c3;logger[_0xd4de('0x18')](_0xd4de('0x54'),_0x3d62c2['id']);return getTicket(_0x1fe52b,_0xfc79e7,_0x3d62c2,_0xa0242e,_0x48fe2a);})['then'](function(_0x1758b3){if(_0x1758b3){logger['info'](_0xd4de('0x55'),_0x1758b3['id']);switch(_0x1fe52b[_0xd4de('0x3b')]){case _0xd4de('0x56'):logger[_0xd4de('0x18')](_0xd4de('0x67'),_0xd4de('0x57'));return request({'uri':util[_0xd4de('0x1c')](_0xd4de('0x68'),_0x1fe52b['remoteUri'],_0xfc79e7['id'],_0x1758b3['id']),'method':_0xd4de('0xf')});case'newTab':logger[_0xd4de('0x18')](_0xd4de('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4de('0x1c')](_0xd4de('0x5a'),_0xd79781[_0xd4de('0x12')]),_0xd4de('0x5b'),{'uri':util[_0xd4de('0x1c')](_0xd4de('0x5c'),_0x1fe52b[_0xd4de('0x25')],_0x1758b3['id'])});break;default:logger[_0xd4de('0x5f')](_0xd4de('0x67'),_0xd4de('0x5d'));}}})[_0xd4de('0x5e')](function(_0x37057c){logger[_0xd4de('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd4de('0x69')](_0x37057c,{'showHidden':!![],'depth':null}));});};exports[_0xd4de('0x6a')]=function(_0x216fd5,_0x331f08,_0x25628e,_0x2c9a38,_0x26bf55,_0x3fdd63){var _0x574939,_0xbe1141;_0x3fdd63['remoteUri']=intUtil['stripTrailingSlash'](_0x3fdd63['remoteUri']);_0x3fdd63[_0xd4de('0x49')]=intUtil[_0xd4de('0x48')](_0x3fdd63['serverUrl']);if(_0x26bf55&&_0x26bf55['monitor_format']){logger['info']('['+_0x331f08['lastevent'][_0xd4de('0x6b')]()+']','Recording\x20is\x20enabled!');_0x331f08[_0xd4de('0x4d')]=util['format'](_0xd4de('0x4e'),_0x3fdd63[_0xd4de('0x49')],_0x331f08['uniqueid'],md5(_0x331f08['uniqueid']));}else{_0x331f08['recordingURL']='';}headers['Authorization']=getAuth(_0x3fdd63);return getUser(_0x3fdd63)[_0xd4de('0x17')](function(_0x214e05){_0x574939=_0x214e05;logger[_0xd4de('0x18')](_0xd4de('0x51'),_0x574939['id']);return getEndUser(_0x3fdd63,_0x331f08[_0xd4de('0x52')],_0x331f08[_0xd4de('0x53')]);})['then'](function(_0x5c651b){_0xbe1141=_0x5c651b;logger['info'](_0xd4de('0x54'),_0xbe1141['id']);return getTicket(_0x3fdd63,_0x574939,_0xbe1141,_0x25628e,_0x331f08);})[_0xd4de('0x17')](function(_0x4c2343){if(_0x4c2343){logger[_0xd4de('0x18')]('The\x20Ticket\x20ID\x20is:',_0x4c2343['id']);}})[_0xd4de('0x5e')](function(_0x574973){logger[_0xd4de('0x5f')]('['+_0x331f08[_0xd4de('0x6c')]['toUpperCase']()+']'+_0xd4de('0x6d'),util['inspect'](_0x574973,{'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 fd50dce..9bf6c3e 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 _0xda2d=['stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','findIndex','Using\x20the\x20admin\x20account!','users','profile','Administrator','user','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','Contacts','then','Leads','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','calleridnum','toUpperCase','request-promise','md5','util','./util','moment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token'];(function(_0x1bc0b8,_0x5efc5e){var _0x4a2ae0=function(_0x5e8e50){while(--_0x5e8e50){_0x1bc0b8['push'](_0x1bc0b8['shift']());}};_0x4a2ae0(++_0x5efc5e);}(_0xda2d,0x102));var _0xdda2=function(_0xbc1ce5,_0x59c276){_0xbc1ce5=_0xbc1ce5-0x0;var _0x5a8449=_0xda2d[_0xbc1ce5];return _0x5a8449;};'use strict';var _=require('lodash');var rp=require(_0xdda2('0x0'));var md5=require(_0xdda2('0x1'));var util=require(_0xdda2('0x2'));var intUtil=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xdda2('0x5'))(_0xdda2('0x6'));config[_0xdda2('0x7')]=_[_0xdda2('0x8')](config[_0xdda2('0x7')],{'host':_0xdda2('0x9'),'port':0x18eb});var io=require(_0xdda2('0xa'))(new Redis(config[_0xdda2('0x7')]));function emit(_0x2e2523,_0x341c7b,_0x4a97f3){io['to'](_0x2e2523)[_0xdda2('0xb')](_0x341c7b,_0x4a97f3);}function request(_0x22c6e5){logger['debug'](_0xdda2('0xc'),JSON[_0xdda2('0xd')](_0x22c6e5));return rp(_0x22c6e5);}function getCustomFields(_0x42d990,_0x346119){var _0x171123={};if(_0x42d990[_0xdda2('0xe')]>0x0){_[_0xdda2('0xf')](_0x42d990,function(_0x1dac9a){if(_0x1dac9a['type']==='string'&&_0x1dac9a['idField']){_0x171123[_0x1dac9a[_0xdda2('0x10')]]=_0x1dac9a[_0xdda2('0x11')][_0xdda2('0x12')]();}else if(_0x1dac9a[_0xdda2('0x13')]===_0xdda2('0x14')&&_0x1dac9a[_0xdda2('0x15')]&&_0x1dac9a[_0xdda2('0x10')]&&_0x346119[_0x1dac9a['variableName']]){_0x171123[_0x1dac9a[_0xdda2('0x10')]]=_0x346119[_0x1dac9a['variableName']][_0xdda2('0x12')]();}else if(_0x1dac9a[_0xdda2('0x13')]===_0xdda2('0x16')&&_0x1dac9a[_0xdda2('0x17')]&&_0x1dac9a[_0xdda2('0x17')]['name']&&_0x1dac9a['idField']&&_0x346119[_0x1dac9a[_0xdda2('0x17')]['name'][_0xdda2('0x18')]()]){_0x171123[_0x1dac9a[_0xdda2('0x10')]]=_0x346119[_0x1dac9a[_0xdda2('0x17')][_0xdda2('0x19')][_0xdda2('0x18')]()][_0xdda2('0x12')]();}});}return _0x171123;}function getName(_0x3ca127){if(_0x3ca127[_0xdda2('0x1a')]('\x20')>0x0){var _0x3c02a4=_0x3ca127[_0xdda2('0x1b')](/ (.+)/);if(_0x3c02a4[0x1]){return _0x3c02a4;}}return[_0x3ca127,_0x3ca127];}var accountsTokens={};function getAccessToken(_0x312ef1){return new Promise(function(_0x6fdede,_0x4eed30){if(!_[_0xdda2('0x1c')](accountsTokens[_0x312ef1['id']])&&!_['isNil'](accountsTokens[_0x312ef1['id']][_0xdda2('0x1d')])){if(moment()[_0xdda2('0x1e')](accountsTokens[_0x312ef1['id']][_0xdda2('0x1f')])){_0x6fdede(accountsTokens[_0x312ef1['id']]['access_token']);}}var _0x347ee6;switch(_0x312ef1['zone']){case'US':_0x347ee6=_0xdda2('0x20');break;case'AU':_0x347ee6=_0xdda2('0x21');break;case'EU':_0x347ee6='https://accounts.zoho.eu';break;case'IN':_0x347ee6=_0xdda2('0x22');break;case'CN':_0x347ee6=_0xdda2('0x23');break;default:_0x347ee6=_0xdda2('0x24');break;}var _0x13b0f3={'method':_0xdda2('0x25'),'uri':_0x347ee6+'/oauth/v2/token','qs':{'refresh_token':_0x312ef1[_0xdda2('0x26')],'client_id':_0x312ef1[_0xdda2('0x27')],'client_secret':_0x312ef1[_0xdda2('0x28')],'grant_type':_0xdda2('0x29')},'json':!![]};return rp(_0x13b0f3)['then'](function(_0x4e97dc){accountsTokens[_0x312ef1['id']]={'access_token':_0x4e97dc[_0xdda2('0x1d')],'expires_in':moment()[_0xdda2('0x2a')](_0x4e97dc[_0xdda2('0x1f')],'seconds')};_0x6fdede(_0x4e97dc[_0xdda2('0x1d')]);})[_0xdda2('0x2b')](function(_0x2e755b){logger[_0xdda2('0x2c')](_0xdda2('0x2d'),_0x2e755b[_0xdda2('0x2e')]);_0x4eed30(_0x2e755b);});});}function getUser(_0x4bb8a4,_0x24c37d,_0x255bbc,_0x53acb5){logger[_0xdda2('0x2f')](_0xdda2('0x30'));return request({'method':_0xdda2('0x31'),'uri':util[_0xdda2('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x24c37d),'qs':{'type':_0xdda2('0x33')},'headers':{'Authorization':_0xdda2('0x34')+_0x4bb8a4},'json':!![]})['then'](function(_0x1ca9f3){if(_0x1ca9f3['users']){var _0x2b8cd6=-0x1;if(_['isArrayLikeObject'](_0x1ca9f3['users'])){if(!_['isNil'](_0x53acb5)){_0x2b8cd6=_[_0xdda2('0x35')](_0x1ca9f3['users'],function(_0x1b13f4){return _0x1b13f4['email']===_0x53acb5;});}if(_0x2b8cd6>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xdda2('0x2f')](_0xdda2('0x36'));_0x2b8cd6=_[_0xdda2('0x35')](_0x1ca9f3[_0xdda2('0x37')],function(_0x12e96d){return _0x12e96d[_0xdda2('0x38')][_0xdda2('0x19')]===_0xdda2('0x39');});}return _0x1ca9f3[_0xdda2('0x37')][_0x2b8cd6];}else{if(_0x1ca9f3[_0xdda2('0x3a')]['profile'][_0xdda2('0x19')]===_0xdda2('0x39')){logger[_0xdda2('0x2f')](_0xdda2('0x36'));user=_0x1ca9f3[_0xdda2('0x3a')];return user;}else{logger[_0xdda2('0x2c')](_0xdda2('0x3b'),JSON['stringify'](_0x1ca9f3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdda2('0xd')](_0x1ca9f3));}}}else{logger[_0xdda2('0x2c')](_0xdda2('0x3b'),JSON['stringify'](_0x1ca9f3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdda2('0xd')](_0x1ca9f3));}})[_0xdda2('0x2b')](function(_0x2d7a21){console[_0xdda2('0x2c')](_0x2d7a21);});}function getZohoUser(_0x246001,_0x5ab419){return new BPromise(function(_0x1e7b94,_0x21fc6d){request(_0x246001)['then'](function(_0x5bcf99){var _0x98bf47=null;if(_0x5bcf99){_0x98bf47=_0x5bcf99[_0xdda2('0x3c')][0x0];_0x98bf47[_0xdda2('0x3d')]=_0x5ab419;}_0x1e7b94(_0x98bf47);})[_0xdda2('0x2b')](function(_0x20969d){_0x21fc6d(_0x20969d);});});}function createEndUser(_0x585eba,_0x2e7847,_0x226de2,_0x7dac2c,_0x1a7262,_0x50c4ae){var _0x226de2=getName(_0x226de2);return request({'method':_0xdda2('0x25'),'uri':_0xdda2('0x3e')+_0x2e7847+_0xdda2('0x3f')+_['startCase'](_0x50c4ae[_0xdda2('0x40')])+'s','body':{'data':[{'Last_Name':_0x226de2[0x1],'First_Name':_0x226de2[0x0],'Phone':_0x7dac2c,'Owner':{'name':!_['isNil'](_0x1a7262[_0xdda2('0x41')]['name'])?_0x1a7262[_0xdda2('0x41')][_0xdda2('0x19')]:!_[_0xdda2('0x1c')](_0x1a7262[_0xdda2('0x42')])?_0x1a7262['first_name']+'\x20'+_0x1a7262[_0xdda2('0x43')]:_0x1a7262['last_name'],'id':_0x1a7262['id']}}]},'headers':{'Authorization':_0xdda2('0x34')+_0x585eba},'json':!![]})['then'](function(_0x1d1678){if(_0x1d1678&&_0x1d1678[_0xdda2('0x3c')][0x0][_0xdda2('0x44')]===_0xdda2('0x45')){var _0x38dc03=_0x1d1678['data'][0x0][_0xdda2('0x46')];_0x38dc03[_0xdda2('0x3d')]=_['startCase'](_0x50c4ae[_0xdda2('0x40')])+'s';return _0x38dc03;}logger['error'](_0xdda2('0x3b'),JSON[_0xdda2('0xd')](data));throw new Error(_0xdda2('0x47')+JSON[_0xdda2('0xd')](data));})[_0xdda2('0x2b')](function(_0x6718ea){console[_0xdda2('0x48')](_0xdda2('0x49'),_0x6718ea);});}function getEndUser(_0xff55,_0x104a60,_0x15a86c,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5){var _0x4fe8e8={'method':_0xdda2('0x31'),'uri':'','headers':{'Authorization':_0xdda2('0x34')+_0xff55},'json':!![]};switch(_0x5cb8b5['moduleSearch']){case _0xdda2('0x4a'):_0x4fe8e8[_0xdda2('0x4b')]=_0xdda2('0x3e')+_0x104a60+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4c'))[_0xdda2('0x4d')](function(_0x4eada0){if(_0x4eada0)return _0x4eada0;_0x4fe8e8['uri']=_0xdda2('0x3e')+_0x104a60+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4e'))['then'](function(_0x306596){if(_0x306596)return _0x306596;if(_0x5cb8b5[_0xdda2('0x40')]!='nothing'){return createEndUser(_0xff55,_0x104a60,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5);}else{return{};}});});break;case'contact':_0x4fe8e8[_0xdda2('0x4b')]=_0xdda2('0x3e')+_0x104a60+_0xdda2('0x4f')+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4c'))['then'](function(_0x1edbc6){if(_0x1edbc6)return _0x1edbc6;if(_0x5cb8b5[_0xdda2('0x40')]!=_0xdda2('0x50')){return createEndUser(_0xff55,_0x104a60,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5);}else{return{};}});break;case _0xdda2('0x51'):_0x4fe8e8[_0xdda2('0x4b')]='https://www.zohoapis.'+_0x104a60+_0xdda2('0x52')+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4e'))['then'](function(_0x3eb3c1){if(_0x3eb3c1)return _0x3eb3c1;if(_0x5cb8b5[_0xdda2('0x40')]!=_0xdda2('0x50')){return createEndUser(_0xff55,_0x104a60,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5);}else{return{};}});break;}}function getCall(_0x2c2a4a,_0x161d7b,_0x265169,_0x4b6519,_0x2c58c7,_0x4a9814,_0x361038,_0x4a70ff){logger[_0xdda2('0x2f')]('Creating\x20new\x20call...');var _0x3b5bbf={};_0x3b5bbf[_0xdda2('0x53')]={'name':!_[_0xdda2('0x1c')](_0x4b6519[_0xdda2('0x41')][_0xdda2('0x19')])&&!_[_0xdda2('0x1c')](_0x4b6519[_0xdda2('0x38')][_0xdda2('0x19')])&&_0x4b6519['profile'][_0xdda2('0x19')]===_0xdda2('0x54')?_0x4b6519[_0xdda2('0x41')]['name']:!_[_0xdda2('0x1c')](_0x4b6519[_0xdda2('0x42')])?_0x4b6519['first_name']+'\x20'+_0x4b6519[_0xdda2('0x43')]:_0x4b6519['last_name'],'id':_0x4b6519['id']};_0x3b5bbf[_0xdda2('0x55')]=intUtil[_0xdda2('0x56')](_0x4a9814[_0xdda2('0x57')],_0x361038,'\x20');_0x3b5bbf[_0xdda2('0x58')]=intUtil[_0xdda2('0x56')](_0x4a9814['Descriptions'],_0x361038,'\x0a');if(_0x2c58c7['enduserType']==='Contacts'){_0x3b5bbf[_0xdda2('0x59')]={'name':!_[_0xdda2('0x1c')](_0x2c58c7['Full_Name'])?_0x2c58c7[_0xdda2('0x5a')]:!_[_0xdda2('0x1c')](_0x2c58c7[_0xdda2('0x5b')])?_0x2c58c7['First_Name']+'\x20'+_0x2c58c7[_0xdda2('0x5c')]:_0x2c58c7[_0xdda2('0x5c')],'id':_0x2c58c7['id']};}if(_0x2c58c7[_0xdda2('0x3d')]==='Leads'){_0x3b5bbf[_0xdda2('0x5d')]={'name':!_[_0xdda2('0x1c')](_0x2c58c7[_0xdda2('0x5a')])?_0x2c58c7[_0xdda2('0x5a')]:!_['isNil'](_0x2c58c7[_0xdda2('0x5b')])?_0x2c58c7['First_Name']+'\x20'+_0x2c58c7['Last_Name']:_0x2c58c7['Last_Name'],'id':_0x2c58c7['id']};_0x3b5bbf[_0xdda2('0x5e')]=_[_0xdda2('0x5f')](_0x2c58c7[_0xdda2('0x3d')]);}if(_0x361038[_0xdda2('0x60')]){_0x3b5bbf[_0xdda2('0x61')]=moment[_0xdda2('0x62')](parseInt(_0x361038[_0xdda2('0x60')])*0x3e8)[_0xdda2('0x32')](_0xdda2('0x63'));}else if(_0x361038[_0xdda2('0x64')]&&_0x361038[_0xdda2('0x65')]){_0x3b5bbf['Call_Duration']=moment[_0xdda2('0x62')](moment(_0x361038[_0xdda2('0x65')],_0xdda2('0x66'))[_0xdda2('0x67')](moment(_0x361038[_0xdda2('0x68')],_0xdda2('0x66'))))[_0xdda2('0x32')]('mm:ss');}switch(_0x361038[_0xdda2('0x69')]){case _0xdda2('0x6a'):_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x6c');break;case _0xdda2('0x6d'):case'connect':_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x6e');break;case _0xdda2('0x6f'):_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x70');break;case'abandoned':_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x71');break;case _0xdda2('0x72'):_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x73');default:}_0x3b5bbf['Call_Start_Time']=(_0x4a70ff===_0xdda2('0x74')?moment(_0x361038[_0xdda2('0x68')])[_0xdda2('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x361038[_0xdda2('0x75')])['format'](_0xdda2('0x66')))||moment()[_0xdda2('0x32')](_0xdda2('0x66'));_0x3b5bbf['Call_Type']=_0x4a70ff||_0xdda2('0x76');_0x3b5bbf=_[_0xdda2('0x77')](_0x3b5bbf,getCustomFields(_0x4a9814['Fields'],_0x361038));return request({'method':_0xdda2('0x25'),'uri':'https://www.zohoapis.'+_0x161d7b+_0xdda2('0x78'),'headers':{'Authorization':_0xdda2('0x34')+_0x2c2a4a},'body':{'data':[_0x3b5bbf]},'json':!![]})[_0xdda2('0x4d')](function(_0x29cf1a){if(_0x29cf1a&&_0x29cf1a[_0xdda2('0x3c')][0x0]['code']==='SUCCESS'){logger[_0xdda2('0x2f')](_0xdda2('0x79'));return{'id':_0x29cf1a['data'][0x0]['details']['id']};}})[_0xdda2('0x2b')](function(_0x501336){logger[_0xdda2('0x2f')](_0xdda2('0x7a'),_0x501336['stack']);console[_0xdda2('0x48')](_0xdda2('0x7a'),_0x501336);});}exports[_0xdda2('0x7b')]=function(_0x4739c4,_0x694386,_0x37f5cd,_0x4eebb0,_0x7764df,_0x22de37){var _0x2dbaad,_0x533880,_0x27780e;_0x22de37[_0xdda2('0x7c')]=intUtil['stripTrailingSlash'](_0x22de37['host']);_0x22de37[_0xdda2('0x7d')]=intUtil[_0xdda2('0x7e')](_0x22de37[_0xdda2('0x7d')]);if(_0x7764df&&_0x7764df['monitor_format']){logger['info'](_0xdda2('0x7f'),'Recording\x20is\x20enabled!');_0x694386[_0xdda2('0x80')]=_0x22de37[_0xdda2('0x7d')]+_0xdda2('0x81')+_0x694386[_0xdda2('0x82')]+_0xdda2('0x83')+md5(_0x694386[_0xdda2('0x82')]);}else{_0x694386['recordingURL']='';}var _0x5170b7=_0x22de37[_0xdda2('0x7c')]==='zoho.eu'?'eu':_0xdda2('0x84');return getAccessToken(_0x22de37)[_0xdda2('0x4d')](function(_0x15f581){_0x27780e=_0x15f581;return getUser(_0x27780e,_0x5170b7,_0x22de37,_0x4eebb0[_0xdda2('0x85')]);})[_0xdda2('0x4d')](function(_0x104024){_0x2dbaad=_0x104024;logger[_0xdda2('0x2f')](_0xdda2('0x86'),_0x2dbaad['id']);return getEndUser(_0x27780e,_0x5170b7,_0x22de37,_0x694386[_0xdda2('0x87')],_0x694386['calleridnum'],_0x2dbaad,_0x37f5cd);})[_0xdda2('0x4d')](function(_0x40d931){_0x533880=_0x40d931;return getCall(_0x27780e,_0x5170b7,_0x22de37,_0x2dbaad,_0x533880,_0x37f5cd,_0x694386,_0xdda2('0x76'));})[_0xdda2('0x4d')](function(_0x4990fe){if(_0x4990fe){logger[_0xdda2('0x2f')](_0xdda2('0x88'),_0x4990fe['id']);logger[_0xdda2('0x2f')](_0xdda2('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xdda2('0x89'),_0x4eebb0[_0xdda2('0x19')]),_0xdda2('0x8a'),{'uri':_0xdda2('0x8b')+_0x22de37['host']+_0xdda2('0x8c')+_0x4990fe['id']});}})[_0xdda2('0x2b')](function(_0x17656d){logger[_0xdda2('0x2c')](_0xdda2('0x7f'),JSON[_0xdda2('0xd')](_0x17656d));});};exports[_0xdda2('0x74')]=function(_0x103e37,_0x333cec,_0x10bc49,_0x12ff97,_0x23a80a,_0x285cb2,_0x3ac576){var _0x2411e8,_0x4b9481,_0x221f72;_0x285cb2[_0xdda2('0x7c')]=intUtil['stripTrailingSlash'](_0x285cb2['host']);_0x285cb2[_0xdda2('0x7d')]=intUtil[_0xdda2('0x7e')](_0x285cb2[_0xdda2('0x7d')]);if(_0x3ac576&&_0x3ac576[_0xdda2('0x8d')]&&_0x3ac576[_0xdda2('0x8d')]!==_0xdda2('0x8e')){logger['info'](_0xdda2('0x8f'),_0xdda2('0x90'));_0x333cec[_0xdda2('0x80')]=_0x285cb2[_0xdda2('0x7d')]+'/api/voice/recordings/'+_0x333cec[_0xdda2('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x333cec[_0xdda2('0x82')]);}var _0x6b6dad=_0x285cb2['host']===_0xdda2('0x91')?'eu':_0xdda2('0x84');return getAccessToken(_0x285cb2)[_0xdda2('0x4d')](function(_0x1dfe6d){_0x221f72=_0x1dfe6d;return getUser(_0x221f72,_0x6b6dad,_0x285cb2,_0x12ff97[_0xdda2('0x85')]);})[_0xdda2('0x4d')](function(_0x1c6ef1){_0x2411e8=_0x1c6ef1;logger[_0xdda2('0x2f')](_0xdda2('0x86'),_0x2411e8['id']);return getEndUser(_0x221f72,_0x6b6dad,_0x285cb2,_0x333cec[_0xdda2('0x92')],_0x333cec[_0xdda2('0x93')],_0x2411e8,_0x10bc49);})['then'](function(_0x574680){_0x4b9481=_0x574680;return getCall(_0x221f72,_0x6b6dad,_0x285cb2,_0x2411e8,_0x4b9481,_0x10bc49,_0x333cec,_0xdda2('0x94'));})[_0xdda2('0x4d')](function(_0x3baaf8){if(_0x3baaf8){logger[_0xdda2('0x2f')]('The\x20Call\x20ID\x20is:',_0x3baaf8['id']);logger[_0xdda2('0x2f')](_0xdda2('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdda2('0x32')](_0xdda2('0x89'),_0x12ff97['name']),'trigger:browser:url',{'uri':_0xdda2('0x8b')+_0x285cb2[_0xdda2('0x7c')]+_0xdda2('0x8c')+_0x3baaf8['id']});}})[_0xdda2('0x2b')](function(_0x14d8fa){logger[_0xdda2('0x2c')]('[OUTBOUND]',JSON[_0xdda2('0xd')](_0x14d8fa));});};exports[_0xdda2('0x95')]=function(_0x5cca40,_0x4bd37d,_0x22deb9,_0x4b57df,_0x2da4a7,_0x3e1c69){var _0x159d54,_0x500333,_0xe6f37b;_0x3e1c69['host']=intUtil[_0xdda2('0x7e')](_0x3e1c69[_0xdda2('0x7c')]);_0x3e1c69[_0xdda2('0x7d')]=intUtil[_0xdda2('0x7e')](_0x3e1c69['serverUrl']);if(_0x2da4a7&&_0x2da4a7['monitor_format']){logger[_0xdda2('0x2f')]('['+_0x4bd37d[_0xdda2('0x69')]['toUpperCase']()+']',_0xdda2('0x90'));_0x4bd37d[_0xdda2('0x80')]=_0x3e1c69[_0xdda2('0x7d')]+_0xdda2('0x81')+_0x4bd37d[_0xdda2('0x82')]+_0xdda2('0x83')+md5(_0x4bd37d[_0xdda2('0x82')]);}else{_0x4bd37d[_0xdda2('0x80')]='';}var _0x3046c1=_0x3e1c69[_0xdda2('0x7c')]===_0xdda2('0x91')?'eu':_0xdda2('0x84');return getAccessToken(_0x3e1c69)['then'](function(_0x5a28b0){_0xe6f37b=_0x5a28b0;return getUser(_0xe6f37b,_0x3046c1,_0x3e1c69);})['then'](function(_0x3f265f){_0x159d54=_0x3f265f;logger['info'](_0xdda2('0x86'),_0x159d54['id']);return getEndUser(_0xe6f37b,_0x3046c1,_0x3e1c69,_0x4bd37d[_0xdda2('0x87')],_0x4bd37d[_0xdda2('0x96')],_0x159d54,_0x22deb9);})[_0xdda2('0x4d')](function(_0x558ab6){_0x500333=_0x558ab6;return getCall(_0xe6f37b,_0x3046c1,_0x3e1c69,_0x159d54,_0x500333,_0x22deb9,_0x4bd37d,_0xdda2('0x76'));})[_0xdda2('0x4d')](function(_0x403a68){if(_0x403a68){logger['info'](_0xdda2('0x88'),_0x403a68['id']);}})[_0xdda2('0x2b')](function(_0x2588f5){logger['error']('['+_0x4bd37d['lastevent'][_0xdda2('0x97')]()+']',JSON[_0xdda2('0xd')](_0x2588f5));});}; \ No newline at end of file +var _0xe330=['toUpperCase','request-promise','md5','util','ioredis','bluebird','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','access_token','isBefore','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isNil','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','startCase','role','first_name','last_name','data','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','talktime','Call_Duration','format','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','called','Call_Result','Called','complete','Answered','Rejected','abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','destcalleridname','Outbound','https://crm.'];(function(_0x2f14d8,_0x349411){var _0x8fce68=function(_0x387047){while(--_0x387047){_0x2f14d8['push'](_0x2f14d8['shift']());}};_0x8fce68(++_0x349411);}(_0xe330,0x96));var _0x0e33=function(_0x5bccf5,_0x3ac98b){_0x5bccf5=_0x5bccf5-0x0;var _0x35a840=_0xe330[_0x5bccf5];return _0x35a840;};'use strict';var _=require('lodash');var rp=require(_0x0e33('0x0'));var md5=require(_0x0e33('0x1'));var util=require(_0x0e33('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x0e33('0x3'));var BPromise=require(_0x0e33('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0e33('0x5'))(_0x0e33('0x6'));config['redis']=_[_0x0e33('0x7')](config[_0x0e33('0x8')],{'host':_0x0e33('0x9'),'port':0x18eb});var io=require(_0x0e33('0xa'))(new Redis(config[_0x0e33('0x8')]));function emit(_0x3e4028,_0x2350dd,_0x1edb09){io['to'](_0x3e4028)[_0x0e33('0xb')](_0x2350dd,_0x1edb09);}function request(_0x391713){logger[_0x0e33('0xc')](_0x0e33('0xd'),JSON['stringify'](_0x391713));return rp(_0x391713);}function getCustomFields(_0x21eeec,_0x18c287){var _0x31be37={};if(_0x21eeec[_0x0e33('0xe')]>0x0){_['forEach'](_0x21eeec,function(_0x4397c2){if(_0x4397c2[_0x0e33('0xf')]===_0x0e33('0x10')&&_0x4397c2[_0x0e33('0x11')]){_0x31be37[_0x4397c2['idField']]=_0x4397c2[_0x0e33('0x12')][_0x0e33('0x13')]();}else if(_0x4397c2['type']===_0x0e33('0x14')&&_0x4397c2[_0x0e33('0x15')]&&_0x4397c2[_0x0e33('0x11')]&&_0x18c287[_0x4397c2[_0x0e33('0x15')]]){_0x31be37[_0x4397c2[_0x0e33('0x11')]]=_0x18c287[_0x4397c2[_0x0e33('0x15')]][_0x0e33('0x13')]();}else if(_0x4397c2[_0x0e33('0xf')]===_0x0e33('0x16')&&_0x4397c2[_0x0e33('0x17')]&&_0x4397c2['Variable']['name']&&_0x4397c2[_0x0e33('0x11')]&&_0x18c287[_0x4397c2[_0x0e33('0x17')][_0x0e33('0x18')][_0x0e33('0x19')]()]){_0x31be37[_0x4397c2['idField']]=_0x18c287[_0x4397c2[_0x0e33('0x17')][_0x0e33('0x18')][_0x0e33('0x19')]()][_0x0e33('0x13')]();}});}return _0x31be37;}function getName(_0x6b095f){if(_0x6b095f[_0x0e33('0x1a')]('\x20')>0x0){var _0x3caba8=_0x6b095f[_0x0e33('0x1b')](/ (.+)/);if(_0x3caba8[0x1]){return _0x3caba8;}}return[_0x6b095f,_0x6b095f];}var accountsTokens={};function getAccessToken(_0x89181a){return new Promise(function(_0x333473,_0x651a94){if(!_['isNil'](accountsTokens[_0x89181a['id']])&&!_['isNil'](accountsTokens[_0x89181a['id']][_0x0e33('0x1c')])){if(moment()[_0x0e33('0x1d')](accountsTokens[_0x89181a['id']]['expires_in'])){_0x333473(accountsTokens[_0x89181a['id']]['access_token']);}}var _0x17c388;switch(_0x89181a['zone']){case'US':_0x17c388='https://accounts.zoho.com';break;case'AU':_0x17c388='https://accounts.zoho.com.au';break;case'EU':_0x17c388=_0x0e33('0x1e');break;case'IN':_0x17c388=_0x0e33('0x1f');break;case'CN':_0x17c388='https://accounts.zoho.com.cn';break;default:_0x17c388='https://accounts.zoho.eu';break;}var _0x48b55b={'method':_0x0e33('0x20'),'uri':_0x17c388+_0x0e33('0x21'),'qs':{'refresh_token':_0x89181a[_0x0e33('0x22')],'client_id':_0x89181a[_0x0e33('0x23')],'client_secret':_0x89181a[_0x0e33('0x24')],'grant_type':_0x0e33('0x25')},'json':!![]};return rp(_0x48b55b)[_0x0e33('0x26')](function(_0x15f179){accountsTokens[_0x89181a['id']]={'access_token':_0x15f179['access_token'],'expires_in':moment()[_0x0e33('0x27')](_0x15f179['expires_in'],_0x0e33('0x28'))};_0x333473(_0x15f179[_0x0e33('0x1c')]);})[_0x0e33('0x29')](function(_0x1a76e3){logger[_0x0e33('0x2a')](_0x0e33('0x2b'),_0x1a76e3[_0x0e33('0x2c')]);_0x651a94(_0x1a76e3);});});}function getUser(_0x4d2dfa,_0x4e66dd,_0xbceecd,_0x3c543c){logger['info'](_0x0e33('0x2d'));return request({'method':_0x0e33('0x2e'),'uri':util['format'](_0x0e33('0x2f'),_0x4e66dd),'qs':{'type':_0x0e33('0x30')},'headers':{'Authorization':_0x0e33('0x31')+_0x4d2dfa},'json':!![]})[_0x0e33('0x26')](function(_0x143241){if(_0x143241['users']){var _0x5842a4=-0x1;if(_['isArrayLikeObject'](_0x143241[_0x0e33('0x32')])){if(!_[_0x0e33('0x33')](_0x3c543c)){_0x5842a4=_[_0x0e33('0x34')](_0x143241['users'],function(_0x234ddc){return _0x234ddc[_0x0e33('0x35')]===_0x3c543c;});}if(_0x5842a4>=0x0){logger[_0x0e33('0x36')]('Agent\x20found!');}else{logger[_0x0e33('0x36')](_0x0e33('0x37'));_0x5842a4=_[_0x0e33('0x34')](_0x143241[_0x0e33('0x32')],function(_0x26bb78){return _0x26bb78[_0x0e33('0x38')][_0x0e33('0x18')]===_0x0e33('0x39');});}return _0x143241[_0x0e33('0x32')][_0x5842a4];}else{if(_0x143241[_0x0e33('0x3a')]['profile']['name']==='Administrator'){logger[_0x0e33('0x36')](_0x0e33('0x37'));user=_0x143241[_0x0e33('0x3a')];return user;}else{logger[_0x0e33('0x2a')]('The\x20failing\x20result\x20is',JSON[_0x0e33('0x3b')](_0x143241));throw new Error(_0x0e33('0x3c')+JSON['stringify'](_0x143241));}}}else{logger[_0x0e33('0x2a')](_0x0e33('0x3d'),JSON[_0x0e33('0x3b')](_0x143241));throw new Error(_0x0e33('0x3c')+JSON[_0x0e33('0x3b')](_0x143241));}})['catch'](function(_0x2155b8){console['error'](_0x2155b8);});}function getZohoUser(_0x2b1f7d,_0x1bafba){return new BPromise(function(_0x2b82b0,_0x55178d){request(_0x2b1f7d)[_0x0e33('0x26')](function(_0x3310dd){var _0x233b73=null;if(_0x3310dd){_0x233b73=_0x3310dd['data'][0x0];_0x233b73[_0x0e33('0x3e')]=_0x1bafba;}_0x2b82b0(_0x233b73);})[_0x0e33('0x29')](function(_0x3cf16f){_0x55178d(_0x3cf16f);});});}function createEndUser(_0x3137b6,_0xf8d0c7,_0x29347f,_0x52d6ab,_0x142b75,_0x5cc9b2){var _0x29347f=getName(_0x29347f);return request({'method':_0x0e33('0x20'),'uri':'https://www.zohoapis.'+_0xf8d0c7+'/crm/v2/'+_[_0x0e33('0x3f')](_0x5cc9b2['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x29347f[0x1],'First_Name':_0x29347f[0x0],'Phone':_0x52d6ab,'Owner':{'name':!_['isNil'](_0x142b75[_0x0e33('0x40')]['name'])?_0x142b75[_0x0e33('0x40')]['name']:!_['isNil'](_0x142b75[_0x0e33('0x41')])?_0x142b75['first_name']+'\x20'+_0x142b75[_0x0e33('0x42')]:_0x142b75[_0x0e33('0x42')],'id':_0x142b75['id']}}]},'headers':{'Authorization':_0x0e33('0x31')+_0x3137b6},'json':!![]})[_0x0e33('0x26')](function(_0x5c8a04){if(_0x5c8a04&&_0x5c8a04[_0x0e33('0x43')][0x0]['code']===_0x0e33('0x44')){var _0x36d9b7=_0x5c8a04[_0x0e33('0x43')][0x0][_0x0e33('0x45')];_0x36d9b7[_0x0e33('0x3e')]=_[_0x0e33('0x3f')](_0x5cc9b2[_0x0e33('0x46')])+'s';return _0x36d9b7;}logger[_0x0e33('0x2a')](_0x0e33('0x3d'),JSON[_0x0e33('0x3b')](data));throw new Error(_0x0e33('0x47')+JSON['stringify'](data));})[_0x0e33('0x29')](function(_0x49a863){console[_0x0e33('0x48')](_0x0e33('0x49'),_0x49a863);});}function getEndUser(_0x37baac,_0x44b47b,_0x4f8283,_0x309d20,_0x386656,_0x44c54d,_0x4158cc){var _0x2b7062={'method':_0x0e33('0x2e'),'uri':'','headers':{'Authorization':_0x0e33('0x31')+_0x37baac},'json':!![]};switch(_0x4158cc['moduleSearch']){case _0x0e33('0x4a'):_0x2b7062[_0x0e33('0x4b')]=_0x0e33('0x4c')+_0x44b47b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x386656+'))';return getZohoUser(_0x2b7062,'Contacts')[_0x0e33('0x26')](function(_0x226e85){if(_0x226e85)return _0x226e85;_0x2b7062[_0x0e33('0x4b')]='https://www.zohoapis.'+_0x44b47b+_0x0e33('0x4d')+_0x386656+'))';return getZohoUser(_0x2b7062,_0x0e33('0x4e'))[_0x0e33('0x26')](function(_0x194e51){if(_0x194e51)return _0x194e51;if(_0x4158cc['moduleCreate']!=_0x0e33('0x4f')){return createEndUser(_0x37baac,_0x44b47b,_0x309d20,_0x386656,_0x44c54d,_0x4158cc);}else{return{};}});});break;case'contact':_0x2b7062[_0x0e33('0x4b')]='https://www.zohoapis.'+_0x44b47b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x386656+'))';return getZohoUser(_0x2b7062,'Contacts')['then'](function(_0x3c26b9){if(_0x3c26b9)return _0x3c26b9;if(_0x4158cc[_0x0e33('0x46')]!=_0x0e33('0x4f')){return createEndUser(_0x37baac,_0x44b47b,_0x309d20,_0x386656,_0x44c54d,_0x4158cc);}else{return{};}});break;case _0x0e33('0x50'):_0x2b7062[_0x0e33('0x4b')]=_0x0e33('0x4c')+_0x44b47b+_0x0e33('0x4d')+_0x386656+'))';return getZohoUser(_0x2b7062,_0x0e33('0x4e'))['then'](function(_0x456437){if(_0x456437)return _0x456437;if(_0x4158cc[_0x0e33('0x46')]!='nothing'){return createEndUser(_0x37baac,_0x44b47b,_0x309d20,_0x386656,_0x44c54d,_0x4158cc);}else{return{};}});break;}}function getCall(_0x5669da,_0x54e69e,_0x276be2,_0x1e302b,_0x261752,_0x27bcf8,_0x58b57b,_0x356a64){logger[_0x0e33('0x36')](_0x0e33('0x51'));var _0x47281e={};_0x47281e[_0x0e33('0x52')]={'name':!_['isNil'](_0x1e302b['role'][_0x0e33('0x18')])&&!_[_0x0e33('0x33')](_0x1e302b[_0x0e33('0x38')][_0x0e33('0x18')])&&_0x1e302b['profile'][_0x0e33('0x18')]===_0x0e33('0x53')?_0x1e302b['role'][_0x0e33('0x18')]:!_[_0x0e33('0x33')](_0x1e302b[_0x0e33('0x41')])?_0x1e302b[_0x0e33('0x41')]+'\x20'+_0x1e302b['last_name']:_0x1e302b['last_name'],'id':_0x1e302b['id']};_0x47281e[_0x0e33('0x54')]=intUtil[_0x0e33('0x55')](_0x27bcf8[_0x0e33('0x56')],_0x58b57b,'\x20');_0x47281e[_0x0e33('0x57')]=intUtil[_0x0e33('0x55')](_0x27bcf8[_0x0e33('0x58')],_0x58b57b,'\x0a');if(_0x261752[_0x0e33('0x3e')]===_0x0e33('0x59')){_0x47281e[_0x0e33('0x5a')]={'name':!_[_0x0e33('0x33')](_0x261752[_0x0e33('0x5b')])?_0x261752[_0x0e33('0x5b')]:!_[_0x0e33('0x33')](_0x261752[_0x0e33('0x5c')])?_0x261752[_0x0e33('0x5c')]+'\x20'+_0x261752[_0x0e33('0x5d')]:_0x261752[_0x0e33('0x5d')],'id':_0x261752['id']};}if(_0x261752[_0x0e33('0x3e')]===_0x0e33('0x4e')){_0x47281e['What_Id']={'name':!_['isNil'](_0x261752['Full_Name'])?_0x261752[_0x0e33('0x5b')]:!_[_0x0e33('0x33')](_0x261752['First_Name'])?_0x261752[_0x0e33('0x5c')]+'\x20'+_0x261752[_0x0e33('0x5d')]:_0x261752[_0x0e33('0x5d')],'id':_0x261752['id']};_0x47281e['$se_module']=_[_0x0e33('0x3f')](_0x261752[_0x0e33('0x3e')]);}if(_0x58b57b[_0x0e33('0x5e')]){_0x47281e[_0x0e33('0x5f')]=moment['utc'](parseInt(_0x58b57b[_0x0e33('0x5e')])*0x3e8)[_0x0e33('0x60')]('mm:ss');}else if(_0x58b57b[_0x0e33('0x61')]&&_0x58b57b['endtime']){_0x47281e['Call_Duration']=moment[_0x0e33('0x62')](moment(_0x58b57b[_0x0e33('0x63')],_0x0e33('0x64'))[_0x0e33('0x65')](moment(_0x58b57b['starttime'],_0x0e33('0x64'))))[_0x0e33('0x60')](_0x0e33('0x66'));}switch(_0x58b57b[_0x0e33('0x67')]){case _0x0e33('0x68'):_0x47281e[_0x0e33('0x69')]=_0x0e33('0x6a');break;case _0x0e33('0x6b'):case'connect':_0x47281e[_0x0e33('0x69')]=_0x0e33('0x6c');break;case'rejected':_0x47281e[_0x0e33('0x69')]=_0x0e33('0x6d');break;case _0x0e33('0x6e'):_0x47281e[_0x0e33('0x69')]='Abandoned';break;case _0x0e33('0x6f'):_0x47281e['Call_Result']='Timeout';default:}_0x47281e[_0x0e33('0x70')]=(_0x356a64===_0x0e33('0x71')?moment(_0x58b57b[_0x0e33('0x72')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x58b57b[_0x0e33('0x73')])[_0x0e33('0x60')](_0x0e33('0x64')))||moment()['format'](_0x0e33('0x64'));_0x47281e['Call_Type']=_0x356a64||_0x0e33('0x74');_0x47281e=_['merge'](_0x47281e,getCustomFields(_0x27bcf8[_0x0e33('0x75')],_0x58b57b));return request({'method':_0x0e33('0x20'),'uri':_0x0e33('0x4c')+_0x54e69e+_0x0e33('0x76'),'headers':{'Authorization':_0x0e33('0x31')+_0x5669da},'body':{'data':[_0x47281e]},'json':!![]})[_0x0e33('0x26')](function(_0x3d254f){if(_0x3d254f&&_0x3d254f[_0x0e33('0x43')][0x0][_0x0e33('0x77')]==='SUCCESS'){logger[_0x0e33('0x36')](_0x0e33('0x78'));return{'id':_0x3d254f['data'][0x0][_0x0e33('0x45')]['id']};}})[_0x0e33('0x29')](function(_0x3322e0){logger[_0x0e33('0x36')](_0x0e33('0x79'),_0x3322e0['stack']);console[_0x0e33('0x48')](_0x0e33('0x79'),_0x3322e0);});}exports[_0x0e33('0x7a')]=function(_0x38dabe,_0x3739ae,_0x493a38,_0x292bb3,_0x593e90,_0x5dd448){var _0x364f9f,_0x3ddaf6,_0xa62283;_0x5dd448[_0x0e33('0x7b')]=intUtil[_0x0e33('0x7c')](_0x5dd448['host']);_0x5dd448[_0x0e33('0x7d')]=intUtil[_0x0e33('0x7c')](_0x5dd448[_0x0e33('0x7d')]);if(_0x593e90&&_0x593e90[_0x0e33('0x7e')]){logger[_0x0e33('0x36')](_0x0e33('0x7f'),_0x0e33('0x80'));_0x3739ae[_0x0e33('0x81')]=_0x5dd448[_0x0e33('0x7d')]+_0x0e33('0x82')+_0x3739ae[_0x0e33('0x83')]+_0x0e33('0x84')+md5(_0x3739ae[_0x0e33('0x83')]);}else{_0x3739ae[_0x0e33('0x81')]='';}var _0x4d5150=_0x5dd448['host']===_0x0e33('0x85')?'eu':_0x0e33('0x86');return getAccessToken(_0x5dd448)[_0x0e33('0x26')](function(_0x20134c){_0xa62283=_0x20134c;return getUser(_0xa62283,_0x4d5150,_0x5dd448,_0x292bb3[_0x0e33('0x35')]);})[_0x0e33('0x26')](function(_0x5378d0){_0x364f9f=_0x5378d0;logger['info'](_0x0e33('0x87'),_0x364f9f['id']);return getEndUser(_0xa62283,_0x4d5150,_0x5dd448,_0x3739ae[_0x0e33('0x88')],_0x3739ae[_0x0e33('0x89')],_0x364f9f,_0x493a38);})['then'](function(_0x5c3f74){_0x3ddaf6=_0x5c3f74;return getCall(_0xa62283,_0x4d5150,_0x5dd448,_0x364f9f,_0x3ddaf6,_0x493a38,_0x3739ae,_0x0e33('0x74'));})[_0x0e33('0x26')](function(_0x10e7e6){if(_0x10e7e6){logger[_0x0e33('0x36')](_0x0e33('0x8a'),_0x10e7e6['id']);logger['info'](_0x0e33('0x7f'),_0x0e33('0x8b'));emit(util['format'](_0x0e33('0x8c'),_0x292bb3[_0x0e33('0x18')]),_0x0e33('0x8d'),{'uri':'https://crm.'+_0x5dd448[_0x0e33('0x7b')]+_0x0e33('0x8e')+_0x10e7e6['id']});}})['catch'](function(_0x17e4f5){logger[_0x0e33('0x2a')](_0x0e33('0x7f'),JSON[_0x0e33('0x3b')](_0x17e4f5));});};exports[_0x0e33('0x71')]=function(_0x4c9aff,_0x5cc637,_0x263c2d,_0x5a673e,_0x4de0ba,_0x23c297,_0x158e39){var _0x456bdb,_0xa6478c,_0x2d2d59;_0x23c297[_0x0e33('0x7b')]=intUtil['stripTrailingSlash'](_0x23c297[_0x0e33('0x7b')]);_0x23c297['serverUrl']=intUtil[_0x0e33('0x7c')](_0x23c297[_0x0e33('0x7d')]);if(_0x158e39&&_0x158e39['recordingFormat']&&_0x158e39['recordingFormat']!==_0x0e33('0x8f')){logger['info'](_0x0e33('0x90'),'Recording\x20is\x20enabled!');_0x5cc637[_0x0e33('0x81')]=_0x23c297[_0x0e33('0x7d')]+_0x0e33('0x82')+_0x5cc637[_0x0e33('0x83')]+_0x0e33('0x84')+md5(_0x5cc637[_0x0e33('0x83')]);}var _0x3aa689=_0x23c297[_0x0e33('0x7b')]==='zoho.eu'?'eu':_0x0e33('0x86');return getAccessToken(_0x23c297)[_0x0e33('0x26')](function(_0x240bc2){_0x2d2d59=_0x240bc2;return getUser(_0x2d2d59,_0x3aa689,_0x23c297,_0x5a673e['email']);})[_0x0e33('0x26')](function(_0x1c277a){_0x456bdb=_0x1c277a;logger[_0x0e33('0x36')](_0x0e33('0x87'),_0x456bdb['id']);return getEndUser(_0x2d2d59,_0x3aa689,_0x23c297,_0x5cc637[_0x0e33('0x91')],_0x5cc637['destcalleridnum'],_0x456bdb,_0x263c2d);})[_0x0e33('0x26')](function(_0x37504a){_0xa6478c=_0x37504a;return getCall(_0x2d2d59,_0x3aa689,_0x23c297,_0x456bdb,_0xa6478c,_0x263c2d,_0x5cc637,_0x0e33('0x92'));})[_0x0e33('0x26')](function(_0x1e7c49){if(_0x1e7c49){logger['info'](_0x0e33('0x8a'),_0x1e7c49['id']);logger[_0x0e33('0x36')](_0x0e33('0x90'),_0x0e33('0x8b'));emit(util[_0x0e33('0x60')]('user:%s',_0x5a673e['name']),'trigger:browser:url',{'uri':_0x0e33('0x93')+_0x23c297[_0x0e33('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1e7c49['id']});}})[_0x0e33('0x29')](function(_0x40d8e){logger[_0x0e33('0x2a')]('[OUTBOUND]',JSON[_0x0e33('0x3b')](_0x40d8e));});};exports['unmanaged']=function(_0x223df2,_0x1168e4,_0x3da503,_0x4e919a,_0x44030f,_0x4321e6){var _0x4bb259,_0x4f4b01,_0x38e0bf;_0x4321e6[_0x0e33('0x7b')]=intUtil[_0x0e33('0x7c')](_0x4321e6[_0x0e33('0x7b')]);_0x4321e6[_0x0e33('0x7d')]=intUtil['stripTrailingSlash'](_0x4321e6[_0x0e33('0x7d')]);if(_0x44030f&&_0x44030f['monitor_format']){logger[_0x0e33('0x36')]('['+_0x1168e4[_0x0e33('0x67')]['toUpperCase']()+']',_0x0e33('0x80'));_0x1168e4[_0x0e33('0x81')]=_0x4321e6[_0x0e33('0x7d')]+_0x0e33('0x82')+_0x1168e4[_0x0e33('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1168e4['uniqueid']);}else{_0x1168e4[_0x0e33('0x81')]='';}var _0x4c4e3f=_0x4321e6[_0x0e33('0x7b')]===_0x0e33('0x85')?'eu':_0x0e33('0x86');return getAccessToken(_0x4321e6)[_0x0e33('0x26')](function(_0x1ffc79){_0x38e0bf=_0x1ffc79;return getUser(_0x38e0bf,_0x4c4e3f,_0x4321e6);})['then'](function(_0x10e259){_0x4bb259=_0x10e259;logger[_0x0e33('0x36')]('The\x20User\x20ID\x20is:',_0x4bb259['id']);return getEndUser(_0x38e0bf,_0x4c4e3f,_0x4321e6,_0x1168e4[_0x0e33('0x88')],_0x1168e4[_0x0e33('0x89')],_0x4bb259,_0x3da503);})[_0x0e33('0x26')](function(_0x24d1aa){_0x4f4b01=_0x24d1aa;return getCall(_0x38e0bf,_0x4c4e3f,_0x4321e6,_0x4bb259,_0x4f4b01,_0x3da503,_0x1168e4,_0x0e33('0x74'));})[_0x0e33('0x26')](function(_0x3afc94){if(_0x3afc94){logger[_0x0e33('0x36')](_0x0e33('0x8a'),_0x3afc94['id']);}})['catch'](function(_0x1e7a96){logger['error']('['+_0x1168e4[_0x0e33('0x67')][_0x0e33('0x94')]()+']',JSON[_0x0e33('0x3b')](_0x1e7a96));});}; \ 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 1c4676a..8140494 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(_0x868ef0,_0x32a82b){var _0x3a1bee=function(_0x1e69e3){while(--_0x1e69e3){_0x868ef0['push'](_0x868ef0['shift']());}};_0x3a1bee(++_0x32a82b);}(_0x7a54,0x106));var _0x47a5=function(_0x5f89c0,_0x25d67b){_0x5f89c0=_0x5f89c0-0x0;var _0x465253=_0x7a54[_0x5f89c0];return _0x465253;};'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(_0x1cfec8,_0x1b4e34){var _0x229bf5=function(_0x56f873){while(--_0x56f873){_0x1cfec8['push'](_0x1cfec8['shift']());}};_0x229bf5(++_0x1b4e34);}(_0x7a54,0x106));var _0x47a5=function(_0x487d07,_0x234f4f){_0x487d07=_0x487d07-0x0;var _0x30dbe4=_0x7a54[_0x487d07];return _0x30dbe4;};'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 8e128e2..34d6a45 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(_0x5b1bf6,_0x2c37cc){var _0x121006=function(_0x2333bc){while(--_0x2333bc){_0x5b1bf6['push'](_0x5b1bf6['shift']());}};_0x121006(++_0x2c37cc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ed7b6,_0x556ad4){_0x4ed7b6=_0x4ed7b6-0x0;var _0xbde562=_0x5f2f[_0x4ed7b6];return _0xbde562;};'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(_0x427b29,_0x44f1d6){var _0x1823ec=function(_0x4391ff){while(--_0x4391ff){_0x427b29['push'](_0x427b29['shift']());}};_0x1823ec(++_0x44f1d6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13978d,_0x49d461){_0x13978d=_0x13978d-0x0;var _0x2e4d4c=_0x5f2f[_0x13978d];return _0x2e4d4c;};'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 b115876..01f1f69 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 _0x6898=['client','http','Request','request','then','debug','rpc','error','result','catch','jayson/promise','../../config/logger','routing'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x6898,0x11b));var _0x8689=function(_0x5944c9,_0x4f48e9){_0x5944c9=_0x5944c9-0x0;var _0x398b09=_0x6898[_0x5944c9];return _0x398b09;};'use strict';var jayson=require(_0x8689('0x0'));var BPromise=require('bluebird');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var client=jayson[_0x8689('0x3')][_0x8689('0x4')]({'port':0x2329});client[_0x8689('0x5')]=function(_0x2ae629,_0x524f81){return new BPromise(function(_0x5038aa,_0x141989){return client[_0x8689('0x6')](_0x2ae629,_0x524f81)[_0x8689('0x7')](function(_0x4e776d){logger[_0x8689('0x8')](_0x8689('0x9'),_0x8689('0x2'),_0x2ae629,_0x524f81,_0x4e776d);if(_0x4e776d[_0x8689('0xa')]){logger[_0x8689('0xa')](_0x8689('0x9'),'routing',_0x2ae629,_0x4e776d['error']['message'],_0x524f81);return _0x141989(_0x4e776d[_0x8689('0xa')]['message']);}else{return _0x5038aa(_0x4e776d[_0x8689('0xb')]);}})[_0x8689('0xc')](function(_0x5b091c){logger['error'](_0x8689('0x9'),_0x8689('0x2'),_0x2ae629,_0x5b091c,_0x524f81);return _0x141989(_0x5b091c);});});};module['exports']=client; \ No newline at end of file +var _0xf53f=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','error','message','catch','rpc'];(function(_0x4fb3a0,_0x218d58){var _0x1a6ab2=function(_0x5584d5){while(--_0x5584d5){_0x4fb3a0['push'](_0x4fb3a0['shift']());}};_0x1a6ab2(++_0x218d58);}(_0xf53f,0x8d));var _0xff53=function(_0x53e15f,_0x2bc56a){_0x53e15f=_0x53e15f-0x0;var _0xf7d08f=_0xf53f[_0x53e15f];return _0xf7d08f;};'use strict';var jayson=require(_0xff53('0x0'));var BPromise=require(_0xff53('0x1'));var logger=require(_0xff53('0x2'))(_0xff53('0x3'));var client=jayson[_0xff53('0x4')][_0xff53('0x5')]({'port':0x2329});client[_0xff53('0x6')]=function(_0x32529d,_0x18b504){return new BPromise(function(_0x2077b9,_0x28dacf){return client[_0xff53('0x7')](_0x32529d,_0x18b504)['then'](function(_0x54e637){logger[_0xff53('0x8')]('rpc',_0xff53('0x3'),_0x32529d,_0x18b504,_0x54e637);if(_0x54e637[_0xff53('0x9')]){logger[_0xff53('0x9')]('rpc','routing',_0x32529d,_0x54e637[_0xff53('0x9')]['message'],_0x18b504);return _0x28dacf(_0x54e637[_0xff53('0x9')][_0xff53('0xa')]);}else{return _0x2077b9(_0x54e637['result']);}})[_0xff53('0xb')](function(_0x14f3ac){logger['error'](_0xff53('0xc'),_0xff53('0x3'),_0x32529d,_0x14f3ac,_0x18b504);return _0x28dacf(_0x14f3ac);});});};module[_0xff53('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2c2f6f4..b1a52fa 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 _0x7676=['catch','log','bluebird','./server','./realtime','./rpc/mailAccount','then','initMailAccounts','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x7f85a8,_0x2c426e){var _0x2c19f0=function(_0x2a3d76){while(--_0x2a3d76){_0x7f85a8['push'](_0x7f85a8['shift']());}};_0x2c19f0(++_0x2c426e);}(_0x7676,0xb8));var _0x6767=function(_0x19e07e,_0x30f809){_0x19e07e=_0x19e07e-0x0;var _0x181349=_0x7676[_0x19e07e];return _0x181349;};'use strict';var BPromise=require(_0x6767('0x0'));var server=require(_0x6767('0x1'));var Realtime=require(_0x6767('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x6767('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x6767('0x4')](mailAccount['getMailAccounts']())[_0x6767('0x4')](realtime[_0x6767('0x5')]())[_0x6767('0x4')](function(){email['refresh'](realtime[_0x6767('0x6')]);return realtime;});}function main(){return server[_0x6767('0x7')](realtime,email)[_0x6767('0x4')](function(_0x54d2c7){return initRealtime();})[_0x6767('0x4')](function(_0x31366b){return db[_0x6767('0x8')][_0x6767('0x9')]({'attributes':['id',_0x6767('0xa')],'raw':!![]});})[_0x6767('0x4')](function(_0x2d5260){return setInterval(initRealtime,_0x2d5260[_0x6767('0xa')]*0x3e8);})[_0x6767('0xb')](function(_0x10a98f){console[_0x6767('0xc')](_0x10a98f);});}main(); \ No newline at end of file +var _0x6363=['refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x3bccf3,_0x216a1){var _0xdcfec3=function(_0x5bdc82){while(--_0x5bdc82){_0x3bccf3['push'](_0x3bccf3['shift']());}};_0xdcfec3(++_0x216a1);}(_0x6363,0x13a));var _0x3636=function(_0x1cbd31,_0x4b8178){_0x1cbd31=_0x1cbd31-0x0;var _0x18d42c=_0x6363[_0x1cbd31];return _0x18d42c;};'use strict';var BPromise=require(_0x3636('0x0'));var server=require('./server');var Realtime=require(_0x3636('0x1'));var EmailChannel=require(_0x3636('0x2'));var mailAccount=require(_0x3636('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x3636('0x4'))['db'];function initRealtime(){return BPromise[_0x3636('0x5')]()[_0x3636('0x6')](mailAccount[_0x3636('0x7')]())[_0x3636('0x6')](realtime[_0x3636('0x8')]())[_0x3636('0x6')](function(){email[_0x3636('0x9')](realtime[_0x3636('0xa')]);return realtime;});}function main(){return server[_0x3636('0xb')](realtime,email)[_0x3636('0x6')](function(_0x583dec){return initRealtime();})[_0x3636('0x6')](function(_0x47f84e){return db[_0x3636('0xc')][_0x3636('0xd')]({'attributes':['id',_0x3636('0xe')],'raw':!![]});})[_0x3636('0x6')](function(_0x1a6c8d){return setInterval(initRealtime,_0x1a6c8d[_0x3636('0xe')]*0x3e8);})[_0x3636('0xf')](function(_0x2d9755){console[_0x3636('0x10')](_0x2d9755);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9a6549e..2192cc6 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 _0x39cc=['ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','hasOwnProperty','email','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','messages','lastName','notify','info','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','bluebird','md5'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x39cc,0x17d));var _0xc39c=function(_0x1378e0,_0x1e4934){_0x1378e0=_0x1378e0-0x0;var _0x57fa11=_0x39cc[_0x1378e0];return _0x57fa11;};'use strict';var _=require(_0xc39c('0x0'));var moment=require('moment');var BPromise=require(_0xc39c('0x1'));var md5=require(_0xc39c('0x2'));var Redis=require(_0xc39c('0x3'));var config=require(_0xc39c('0x4'));var logger=require(_0xc39c('0x5'))('email');config[_0xc39c('0x6')]=_[_0xc39c('0x7')](config[_0xc39c('0x6')],{'host':_0xc39c('0x8'),'port':0x18eb});var io=require(_0xc39c('0x9'))(new Redis(config[_0xc39c('0x6')]));var EmailImap=require(_0xc39c('0xa'));var EmailSmtp=require(_0xc39c('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x45950b){logger['info']('start\x20email\x20channel');this[_0xc39c('0xc')]=_0x45950b['mailAccounts'];this[_0xc39c('0xd')]={};this[_0xc39c('0xe')]=new EmailSmtp();}EmailChannel[_0xc39c('0xf')][_0xc39c('0x10')]=function(_0x56274a){var _0x5228e4=this['mailAccounts'][_0x56274a];var _0x3e2e1a={'id':_0x5228e4['id'],'name':_0x5228e4[_0xc39c('0x11')],'key':_0x5228e4[_0xc39c('0x12')],'active':_0x5228e4[_0xc39c('0x13')],'Imap':{'status':_0x5228e4['Imap'][_0xc39c('0x14')],'messageStatus':_0x5228e4[_0xc39c('0x15')][_0xc39c('0x16')],'total':_0x5228e4[_0xc39c('0x15')][_0xc39c('0x17')]}};if(_[_0xc39c('0x18')](md5Accounts[_0x56274a])){md5Accounts[_0x56274a]={};}var _0x330ac6=md5(JSON['stringify'](_0x3e2e1a));if(md5Accounts[_0x56274a][_0xc39c('0x2')]!==_0x330ac6){md5Accounts[_0x56274a][_0xc39c('0x2')]=_0x330ac6;io[_0xc39c('0x10')]('mailAccount:update',_0x3e2e1a);}};EmailChannel[_0xc39c('0xf')]['refresh']=function(_0x1d4a89){for(var _0x1dd047 in _0x1d4a89){if(_0x1d4a89['hasOwnProperty'](_0x1dd047)){if(_0x1d4a89[_0x1dd047][_0xc39c('0x15')]&&_0x1d4a89[_0x1dd047]['active']){var _0x42910e=_0x1d4a89[_0x1dd047][_0xc39c('0x15')];if(!this['imapAccounts'][_0xc39c('0x19')](_0x42910e['id'])){this['imapAccounts'][_0x42910e['id']]=new EmailImap(_0x42910e,_0x1d4a89[_0x1dd047][_0xc39c('0x1a')]);this[_0xc39c('0xd')][_0x42910e['id']]['on']('box',this['handleImapBox'][_0xc39c('0x1b')](this,_0x1dd047));this[_0xc39c('0xd')][_0x42910e['id']]['on'](_0xc39c('0x1a'),this[_0xc39c('0x1c')][_0xc39c('0x1b')](this,_0x1dd047));this[_0xc39c('0xd')][_0x42910e['id']]['on'](_0xc39c('0x1d'),this[_0xc39c('0x1e')]['bind'](this,_0x1dd047));this[_0xc39c('0xd')][_0x42910e['id']]['on'](_0xc39c('0x1f'),this[_0xc39c('0x20')][_0xc39c('0x1b')](this,_0x1dd047));}}else{if(_['isNil'](this[_0xc39c('0xc')][_0x1dd047]['Imap'])){this['mailAccounts'][_0x1dd047][_0xc39c('0x15')]={};}this[_0xc39c('0xc')][_0x1dd047][_0xc39c('0x15')][_0xc39c('0x14')]='disabled';this[_0xc39c('0xc')][_0x1dd047][_0xc39c('0x15')][_0xc39c('0x16')]='';this['emit'](_0x1dd047);}}}};EmailChannel[_0xc39c('0xf')]['handleImapBox']=function(_0x387693,_0x2bb4d9){if(this['mailAccounts'][_0x387693]){this['mailAccounts'][_0x387693][_0xc39c('0x15')][_0xc39c('0x14')]=_0xc39c('0x21');this[_0xc39c('0xc')][_0x387693]['Imap']['messageStatus']=_0x2bb4d9[_0xc39c('0x11')];if(_0x2bb4d9[_0xc39c('0x22')]){this[_0xc39c('0xc')][_0x387693][_0xc39c('0x15')][_0xc39c('0x17')]=_0x2bb4d9[_0xc39c('0x22')][_0xc39c('0x17')];}return this[_0xc39c('0x10')](_0x387693);}};EmailChannel[_0xc39c('0xf')][_0xc39c('0x1c')]=function(_0x5c643b,_0x250a07){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x250a07['firstName'],_0x250a07[_0xc39c('0x23')],_0x250a07['from'],_0x5c643b);if(this['mailAccounts'][_0x5c643b]){return mailAccount[_0xc39c('0x24')](_0x5c643b,_0x250a07)['then'](function(_0x4360fb){if(_0x4360fb){logger[_0xc39c('0x25')]('Mail\x20accepted\x20from\x20routing');}})[_0xc39c('0x26')](function(_0x4291be){logger[_0xc39c('0x1f')](_0xc39c('0x27'),JSON['stringify'](_0x4291be));});}};EmailChannel['prototype'][_0xc39c('0x1e')]=function(_0x56ef63){if(this[_0xc39c('0xc')][_0x56ef63]&&this[_0xc39c('0xc')][_0x56ef63][_0xc39c('0x15')]){if(this[_0xc39c('0xd')][this[_0xc39c('0xc')][_0x56ef63][_0xc39c('0x15')]['id']]){delete this[_0xc39c('0xd')][this[_0xc39c('0xc')][_0x56ef63][_0xc39c('0x15')]['id']];}this['mailAccounts'][_0x56ef63][_0xc39c('0x15')]['lastSync']=moment();this[_0xc39c('0x10')](_0x56ef63);}};EmailChannel[_0xc39c('0xf')][_0xc39c('0x20')]=function(_0x3ff6a4,_0x26eda8){if(this['mailAccounts'][_0x3ff6a4]){this[_0xc39c('0xc')][_0x3ff6a4][_0xc39c('0x15')][_0xc39c('0x14')]=_0xc39c('0x1f');this[_0xc39c('0xc')][_0x3ff6a4][_0xc39c('0x15')][_0xc39c('0x16')]=_0x26eda8;return this[_0xc39c('0x10')](_0x3ff6a4);}};EmailChannel[_0xc39c('0xf')][_0xc39c('0x28')]=function(_0x2d006a,_0x863c65){return this[_0xc39c('0xe')][_0xc39c('0x29')](_0x2d006a,_0x863c65);};EmailChannel[_0xc39c('0xf')][_0xc39c('0x2a')]=function(_0x2f018f){var _0x5089d7=this;if(this['mailAccounts'][_0x2f018f['id']]){if(_[_0xc39c('0x18')](this[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')])){this[_0xc39c('0xc')][_0x2f018f['id']]['Smtp']={};}this[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x2c')]=moment();return new BPromise(function(_0x3ecbc,_0xce230a){return _0x5089d7[_0xc39c('0xe')][_0xc39c('0x2d')](_0x2f018f)['then'](function(_0x16ff00){_0x5089d7[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x14')]=_0xc39c('0x2e');_0x5089d7['mailAccounts'][_0x2f018f['id']][_0xc39c('0x2b')]['messageStatus']='';_0x5089d7[_0xc39c('0x10')](_0x2f018f['id']);_0x3ecbc(_0x16ff00);})[_0xc39c('0x26')](function(_0x3a6a59){_0x5089d7[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x14')]=_0xc39c('0x1f');_0x5089d7[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x16')]=_0x3a6a59;_0x5089d7[_0xc39c('0x10')](_0x2f018f['id']);_0xce230a(_0x3a6a59);});});}return this['smtp']['verify'](_0x2f018f);};module[_0xc39c('0x2f')]=EmailChannel; \ No newline at end of file +var _0x33c8=['socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap','status','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','connected','messageStatus','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','Smtp','verify','verified','moment','bluebird','md5','ioredis','../../../config/logger','defaults','redis','localhost'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x33c8,0xd0));var _0x833c=function(_0x3cce6d,_0x19a3f6){_0x3cce6d=_0x3cce6d-0x0;var _0x44d6e2=_0x33c8[_0x3cce6d];return _0x44d6e2;};'use strict';var _=require('lodash');var moment=require(_0x833c('0x0'));var BPromise=require(_0x833c('0x1'));var md5=require(_0x833c('0x2'));var Redis=require(_0x833c('0x3'));var config=require('../../../config/environment');var logger=require(_0x833c('0x4'))('email');config['redis']=_[_0x833c('0x5')](config[_0x833c('0x6')],{'host':_0x833c('0x7'),'port':0x18eb});var io=require(_0x833c('0x8'))(new Redis(config[_0x833c('0x6')]));var EmailImap=require(_0x833c('0x9'));var EmailSmtp=require(_0x833c('0xa'));var mailAccount=require(_0x833c('0xb'));var md5Accounts={};function EmailChannel(_0x735d47){logger['info'](_0x833c('0xc'));this[_0x833c('0xd')]=_0x735d47[_0x833c('0xd')];this['imapAccounts']={};this[_0x833c('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x833c('0xf')]=function(_0x4fd160){var _0x13e827=this[_0x833c('0xd')][_0x4fd160];var _0x509f4d={'id':_0x13e827['id'],'name':_0x13e827[_0x833c('0x10')],'key':_0x13e827[_0x833c('0x11')],'active':_0x13e827[_0x833c('0x12')],'Imap':{'status':_0x13e827[_0x833c('0x13')][_0x833c('0x14')],'messageStatus':_0x13e827['Imap']['messageStatus'],'total':_0x13e827[_0x833c('0x13')]['total']}};if(_[_0x833c('0x15')](md5Accounts[_0x4fd160])){md5Accounts[_0x4fd160]={};}var _0x1410f9=md5(JSON[_0x833c('0x16')](_0x509f4d));if(md5Accounts[_0x4fd160][_0x833c('0x2')]!==_0x1410f9){md5Accounts[_0x4fd160][_0x833c('0x2')]=_0x1410f9;io[_0x833c('0xf')](_0x833c('0x17'),_0x509f4d);}};EmailChannel[_0x833c('0x18')][_0x833c('0x19')]=function(_0x13c6ab){for(var _0x46f18e in _0x13c6ab){if(_0x13c6ab[_0x833c('0x1a')](_0x46f18e)){if(_0x13c6ab[_0x46f18e][_0x833c('0x13')]&&_0x13c6ab[_0x46f18e][_0x833c('0x12')]){var _0x73c240=_0x13c6ab[_0x46f18e][_0x833c('0x13')];if(!this[_0x833c('0x1b')]['hasOwnProperty'](_0x73c240['id'])){this[_0x833c('0x1b')][_0x73c240['id']]=new EmailImap(_0x73c240,_0x13c6ab[_0x46f18e][_0x833c('0x1c')]);this[_0x833c('0x1b')][_0x73c240['id']]['on'](_0x833c('0x1d'),this[_0x833c('0x1e')][_0x833c('0x1f')](this,_0x46f18e));this['imapAccounts'][_0x73c240['id']]['on'](_0x833c('0x1c'),this[_0x833c('0x20')]['bind'](this,_0x46f18e));this['imapAccounts'][_0x73c240['id']]['on'](_0x833c('0x21'),this['handleImapEnd'][_0x833c('0x1f')](this,_0x46f18e));this[_0x833c('0x1b')][_0x73c240['id']]['on'](_0x833c('0x22'),this[_0x833c('0x23')][_0x833c('0x1f')](this,_0x46f18e));}}else{if(_[_0x833c('0x15')](this[_0x833c('0xd')][_0x46f18e][_0x833c('0x13')])){this[_0x833c('0xd')][_0x46f18e]['Imap']={};}this[_0x833c('0xd')][_0x46f18e][_0x833c('0x13')][_0x833c('0x14')]='disabled';this[_0x833c('0xd')][_0x46f18e]['Imap']['messageStatus']='';this['emit'](_0x46f18e);}}}};EmailChannel['prototype'][_0x833c('0x1e')]=function(_0x3958ad,_0x13e1a8){if(this[_0x833c('0xd')][_0x3958ad]){this[_0x833c('0xd')][_0x3958ad][_0x833c('0x13')]['status']=_0x833c('0x24');this[_0x833c('0xd')][_0x3958ad][_0x833c('0x13')][_0x833c('0x25')]=_0x13e1a8[_0x833c('0x10')];if(_0x13e1a8['messages']){this['mailAccounts'][_0x3958ad]['Imap'][_0x833c('0x26')]=_0x13e1a8[_0x833c('0x27')][_0x833c('0x26')];}return this[_0x833c('0xf')](_0x3958ad);}};EmailChannel[_0x833c('0x18')][_0x833c('0x20')]=function(_0x57d949,_0x13401c){logger['info'](_0x833c('0x28'),_0x13401c[_0x833c('0x29')],_0x13401c[_0x833c('0x2a')],_0x13401c[_0x833c('0x2b')],_0x57d949);if(this[_0x833c('0xd')][_0x57d949]){return mailAccount['notify'](_0x57d949,_0x13401c)[_0x833c('0x2c')](function(_0x4cc7ba){if(_0x4cc7ba){logger[_0x833c('0x2d')](_0x833c('0x2e'));}})[_0x833c('0x2f')](function(_0x573009){logger[_0x833c('0x22')](_0x833c('0x30'),JSON[_0x833c('0x16')](_0x573009));});}};EmailChannel[_0x833c('0x18')][_0x833c('0x31')]=function(_0x5ed90e){if(this[_0x833c('0xd')][_0x5ed90e]&&this[_0x833c('0xd')][_0x5ed90e][_0x833c('0x13')]){if(this[_0x833c('0x1b')][this[_0x833c('0xd')][_0x5ed90e][_0x833c('0x13')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x5ed90e][_0x833c('0x13')]['id']];}this[_0x833c('0xd')][_0x5ed90e][_0x833c('0x13')][_0x833c('0x32')]=moment();this['emit'](_0x5ed90e);}};EmailChannel[_0x833c('0x18')][_0x833c('0x23')]=function(_0x56e241,_0x5e1fed){if(this['mailAccounts'][_0x56e241]){this[_0x833c('0xd')][_0x56e241]['Imap'][_0x833c('0x14')]=_0x833c('0x22');this[_0x833c('0xd')][_0x56e241][_0x833c('0x13')][_0x833c('0x25')]=_0x5e1fed;return this[_0x833c('0xf')](_0x56e241);}};EmailChannel['prototype']['sendMail']=function(_0x4f9493,_0x27369){return this['smtp']['send'](_0x4f9493,_0x27369);};EmailChannel[_0x833c('0x18')]['verifySmtp']=function(_0xa42359){var _0x39ac0a=this;if(this[_0x833c('0xd')][_0xa42359['id']]){if(_[_0x833c('0x15')](this[_0x833c('0xd')][_0xa42359['id']][_0x833c('0x33')])){this['mailAccounts'][_0xa42359['id']]['Smtp']={};}this['mailAccounts'][_0xa42359['id']][_0x833c('0x33')][_0x833c('0x32')]=moment();return new BPromise(function(_0x1d390a,_0x5ed250){return _0x39ac0a['smtp'][_0x833c('0x34')](_0xa42359)['then'](function(_0x4cb75c){_0x39ac0a[_0x833c('0xd')][_0xa42359['id']][_0x833c('0x33')][_0x833c('0x14')]=_0x833c('0x35');_0x39ac0a[_0x833c('0xd')][_0xa42359['id']]['Smtp'][_0x833c('0x25')]='';_0x39ac0a[_0x833c('0xf')](_0xa42359['id']);_0x1d390a(_0x4cb75c);})[_0x833c('0x2f')](function(_0x50bf2b){_0x39ac0a[_0x833c('0xd')][_0xa42359['id']][_0x833c('0x33')]['status']=_0x833c('0x22');_0x39ac0a[_0x833c('0xd')][_0xa42359['id']][_0x833c('0x33')][_0x833c('0x25')]=_0x50bf2b;_0x39ac0a[_0x833c('0xf')](_0xa42359['id']);_0x5ed250(_0x50bf2b);});});}return this[_0x833c('0xe')][_0x833c('0x34')](_0xa42359);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index b45aebf..bb2f86f 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 _0x9d96=['../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d96,0x15a));var _0x69d9=function(_0x23e1e2,_0x4f4824){_0x23e1e2=_0x23e1e2-0x0;var _0x445645=_0x9d96[_0x23e1e2];return _0x445645;};'use strict';var fs=require('fs');var path=require(_0x69d9('0x0'));var util=require(_0x69d9('0x1'));var Imap=require(_0x69d9('0x2'));var _=require(_0x69d9('0x3'));var rs=require('randomstring');var simpleParser=require(_0x69d9('0x4'))[_0x69d9('0x5')];var Iconv=require(_0x69d9('0x6'))['Iconv'];var EventEmitter=require(_0x69d9('0x7'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x69d9('0x8'))(_0x69d9('0x9'));function EmailImap(_0x2bcdab,_0x593529){this[_0x69d9('0xa')]=_0x69d9('0xb');this['account']=this[_0x69d9('0xc')](_0x2bcdab,_0x593529);this[_0x69d9('0x2')]=new Imap(this[_0x69d9('0xd')]);this[_0x69d9('0x2')][_0x69d9('0xe')](_0x69d9('0xf'),this['handleReady'][_0x69d9('0x10')](this));this[_0x69d9('0x2')][_0x69d9('0xe')]('end',this[_0x69d9('0x11')][_0x69d9('0x10')](this));this[_0x69d9('0x2')]['on'](_0x69d9('0x12'),this[_0x69d9('0x13')][_0x69d9('0x10')](this));this[_0x69d9('0x2')]['connect']();}util[_0x69d9('0x14')](EmailImap,EventEmitter);EmailImap[_0x69d9('0x15')][_0x69d9('0xc')]=function(_0x40378d,_0x384913){var _0x2ddf0a={'connTimeout':_0x40378d[_0x69d9('0x16')]?_0x40378d[_0x69d9('0x16')]*0x3e8:0x2710,'authTimeout':_0x40378d[_0x69d9('0x17')]?_0x40378d[_0x69d9('0x17')]*0x3e8:0x1388};if(_[_0x69d9('0x18')](_0x40378d[_0x69d9('0x19')])){if(_0x40378d[_0x69d9('0x1a')]){_0x2ddf0a[_0x69d9('0x1b')]=_0x40378d[_0x69d9('0x1b')];_0x2ddf0a[_0x69d9('0x1c')]=_0x40378d['password'];}_0x2ddf0a[_0x69d9('0x1d')]=_0x40378d[_0x69d9('0x1d')];_0x2ddf0a['port']=_0x40378d[_0x69d9('0x1e')]||0x3e1;if(_0x40378d[_0x69d9('0x1f')]){_0x2ddf0a[_0x69d9('0x1f')]=!![];}else{_0x2ddf0a[_0x69d9('0x1f')]=![];_0x2ddf0a['autotls']='required';}}else{_0x2ddf0a[_0x69d9('0x1b')]=_0x40378d[_0x69d9('0x1b')];_0x2ddf0a[_0x69d9('0x1c')]=_0x40378d[_0x69d9('0x1c')];_0x2ddf0a[_0x69d9('0x1d')]=utils[_0x69d9('0x20')](_0x40378d['service']);_0x2ddf0a[_0x69d9('0x1e')]=0x3e1;_0x2ddf0a[_0x69d9('0x1f')]=!![];}_0x2ddf0a[_0x69d9('0x9')]=_0x384913||_0x40378d[_0x69d9('0x1b')]||_0x69d9('0x21');return _0x2ddf0a;};EmailImap[_0x69d9('0x15')][_0x69d9('0x22')]=function(){this[_0x69d9('0x2')][_0x69d9('0x23')](this['mailbox'],![],this[_0x69d9('0x24')][_0x69d9('0x10')](this));};EmailImap[_0x69d9('0x15')][_0x69d9('0x24')]=function(_0x26683e,_0xd37177){if(_0x26683e){this['handleError'](_0x26683e,!![]);}else{this[_0x69d9('0x25')](_0x69d9('0x26'),_0xd37177);this[_0x69d9('0x27')]();}};EmailImap[_0x69d9('0x15')][_0x69d9('0x28')]=function(_0x58d307){if(_0x58d307){this[_0x69d9('0x13')](_0x58d307,!![]);}else{this[_0x69d9('0x2')][_0x69d9('0x29')]();}};EmailImap[_0x69d9('0x15')][_0x69d9('0x27')]=function(){this[_0x69d9('0x2')][_0x69d9('0x2a')](['UNSEEN'],this[_0x69d9('0x2b')]['bind'](this));};EmailImap['prototype'][_0x69d9('0x2b')]=function(_0x4e2a1c,_0x418981){if(_0x4e2a1c){this[_0x69d9('0x13')](_0x4e2a1c,!![]);}else{if(_0x418981[_0x69d9('0x2c')]){try{var _0x55a4bb=this[_0x69d9('0x2')]['fetch'](_0x418981,{'bodies':'','markSeen':!![]});_0x55a4bb['on'](_0x69d9('0x2d'),this[_0x69d9('0x2e')]['bind'](this));_0x55a4bb['once']('error',this['handleFetchError'][_0x69d9('0x10')](this));_0x55a4bb[_0x69d9('0xe')]('end',this[_0x69d9('0x2f')][_0x69d9('0x10')](this));}catch(_0x4e5f16){logger[_0x69d9('0x12')](_0x4e5f16);}}else{this['imap'][_0x69d9('0x30')](!![],this[_0x69d9('0x28')][_0x69d9('0x10')](this));}}};EmailImap[_0x69d9('0x15')][_0x69d9('0x2e')]=function(_0x55f891,_0x992dcd){_0x55f891['on'](_0x69d9('0x31'),this[_0x69d9('0x32')][_0x69d9('0x10')](this));_0x55f891[_0x69d9('0xe')]('attributes',this[_0x69d9('0x33')][_0x69d9('0x10')](this));_0x55f891[_0x69d9('0xe')]('end',this[_0x69d9('0x34')][_0x69d9('0x10')](this));};EmailImap[_0x69d9('0x15')]['handleMessageBody']=function(_0x3ead4a,_0x20c56c){simpleParser(_0x3ead4a,{'Iconv':Iconv},this[_0x69d9('0x35')][_0x69d9('0x10')](this));};EmailImap[_0x69d9('0x15')][_0x69d9('0x33')]=function(_0x1a2b53){};EmailImap[_0x69d9('0x15')][_0x69d9('0x34')]=function(){};EmailImap['prototype'][_0x69d9('0x35')]=function(_0x523869,_0x4ea931){if(_0x523869){logger[_0x69d9('0x12')](_0x523869);}else{var _0x14bf29=this;utils[_0x69d9('0x36')](this[_0x69d9('0xd')],_0x4ea931,function(_0x513be7){_0x14bf29[_0x69d9('0x25')](_0x69d9('0x9'),_0x513be7);});}};EmailImap[_0x69d9('0x15')][_0x69d9('0x2f')]=function(){this[_0x69d9('0x2')][_0x69d9('0x30')](!![],this[_0x69d9('0x28')]['bind'](this));};EmailImap[_0x69d9('0x15')][_0x69d9('0x37')]=function(_0x7970f8){this[_0x69d9('0x13')](_0x7970f8);this[_0x69d9('0x2')][_0x69d9('0x30')](!![],this['handleCloseBox'][_0x69d9('0x10')](this));};EmailImap['prototype'][_0x69d9('0x11')]=function(){this[_0x69d9('0x25')](_0x69d9('0x29'));};EmailImap[_0x69d9('0x15')]['handleError']=function(_0x34d84d,_0x56a256){logger[_0x69d9('0x12')](_0x69d9('0x13'),this[_0x69d9('0xd')][_0x69d9('0x9')],JSON[_0x69d9('0x38')](_0x34d84d));var _0x21a48f='';if(_0x34d84d){if(_0x34d84d['textCode']){_0x21a48f=_0x34d84d[_0x69d9('0x39')];}else{for(var _0x5df883 in _0x34d84d){if(_0x34d84d['hasOwnProperty'](_0x5df883)){_0x21a48f+=_['upperFirst'](_0x5df883)+':\x20'+_0x34d84d[_0x5df883]+'\x0a';}}}}if(_0x56a256){this[_0x69d9('0x2')][_0x69d9('0x29')]();}else{this['emit'](_0x69d9('0x12'),_0x21a48f);this[_0x69d9('0x25')]('end');}};module[_0x69d9('0x3a')]=EmailImap; \ No newline at end of file +var _0x35b1=['length','fetch','handleFetchError','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','emit','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','lodash','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','once','ready','bind','end','handleEnd','error','connect','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','required','password','getHost','anonymous@xcally.com','prototype','handleReady','openBox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen'];(function(_0xfeb39,_0x1d20b7){var _0x167aa8=function(_0x54b506){while(--_0x54b506){_0xfeb39['push'](_0xfeb39['shift']());}};_0x167aa8(++_0x1d20b7);}(_0x35b1,0x111));var _0x135b=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x35b1[_0x2a67fe];return _0x57e726;};'use strict';var fs=require('fs');var path=require(_0x135b('0x0'));var util=require(_0x135b('0x1'));var Imap=require('imap');var _=require(_0x135b('0x2'));var rs=require(_0x135b('0x3'));var simpleParser=require('mailparser')[_0x135b('0x4')];var Iconv=require(_0x135b('0x5'))[_0x135b('0x6')];var EventEmitter=require(_0x135b('0x7'))[_0x135b('0x8')];var utils=require('./utils');var logger=require(_0x135b('0x9'))(_0x135b('0xa'));function EmailImap(_0x399e90,_0x1ad75d){this[_0x135b('0xb')]=_0x135b('0xc');this[_0x135b('0xd')]=this[_0x135b('0xe')](_0x399e90,_0x1ad75d);this[_0x135b('0xf')]=new Imap(this[_0x135b('0xd')]);this[_0x135b('0xf')][_0x135b('0x10')](_0x135b('0x11'),this['handleReady'][_0x135b('0x12')](this));this[_0x135b('0xf')][_0x135b('0x10')](_0x135b('0x13'),this[_0x135b('0x14')][_0x135b('0x12')](this));this['imap']['on'](_0x135b('0x15'),this['handleError'][_0x135b('0x12')](this));this[_0x135b('0xf')][_0x135b('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x4e36db,_0x3ae1cb){var _0x5b8bf4={'connTimeout':_0x4e36db[_0x135b('0x17')]?_0x4e36db[_0x135b('0x17')]*0x3e8:0x2710,'authTimeout':_0x4e36db[_0x135b('0x18')]?_0x4e36db['authTimeout']*0x3e8:0x1388};if(_[_0x135b('0x19')](_0x4e36db[_0x135b('0x1a')])){if(_0x4e36db[_0x135b('0x1b')]){_0x5b8bf4[_0x135b('0x1c')]=_0x4e36db[_0x135b('0x1c')];_0x5b8bf4['password']=_0x4e36db['password'];}_0x5b8bf4[_0x135b('0x1d')]=_0x4e36db[_0x135b('0x1d')];_0x5b8bf4[_0x135b('0x1e')]=_0x4e36db[_0x135b('0x1e')]||0x3e1;if(_0x4e36db['tls']){_0x5b8bf4[_0x135b('0x1f')]=!![];}else{_0x5b8bf4[_0x135b('0x1f')]=![];_0x5b8bf4['autotls']=_0x135b('0x20');}}else{_0x5b8bf4[_0x135b('0x1c')]=_0x4e36db['user'];_0x5b8bf4[_0x135b('0x21')]=_0x4e36db['password'];_0x5b8bf4['host']=utils[_0x135b('0x22')](_0x4e36db[_0x135b('0x1a')]);_0x5b8bf4[_0x135b('0x1e')]=0x3e1;_0x5b8bf4[_0x135b('0x1f')]=!![];}_0x5b8bf4[_0x135b('0xa')]=_0x3ae1cb||_0x4e36db[_0x135b('0x1c')]||_0x135b('0x23');return _0x5b8bf4;};EmailImap[_0x135b('0x24')][_0x135b('0x25')]=function(){this[_0x135b('0xf')][_0x135b('0x26')](this[_0x135b('0xb')],![],this[_0x135b('0x27')][_0x135b('0x12')](this));};EmailImap[_0x135b('0x24')][_0x135b('0x27')]=function(_0x58a7aa,_0x2a1464){if(_0x58a7aa){this[_0x135b('0x28')](_0x58a7aa,!![]);}else{this['emit'](_0x135b('0x29'),_0x2a1464);this[_0x135b('0x2a')]();}};EmailImap[_0x135b('0x24')][_0x135b('0x2b')]=function(_0x507c6e){if(_0x507c6e){this[_0x135b('0x28')](_0x507c6e,!![]);}else{this[_0x135b('0xf')][_0x135b('0x13')]();}};EmailImap[_0x135b('0x24')][_0x135b('0x2a')]=function(){this[_0x135b('0xf')][_0x135b('0x2c')]([_0x135b('0x2d')],this[_0x135b('0x2e')][_0x135b('0x12')](this));};EmailImap[_0x135b('0x24')][_0x135b('0x2e')]=function(_0x376433,_0x51cb6b){if(_0x376433){this[_0x135b('0x28')](_0x376433,!![]);}else{if(_0x51cb6b[_0x135b('0x2f')]){try{var _0x19d4c3=this[_0x135b('0xf')][_0x135b('0x30')](_0x51cb6b,{'bodies':'','markSeen':!![]});_0x19d4c3['on']('message',this['handleFetchMessage']['bind'](this));_0x19d4c3[_0x135b('0x10')](_0x135b('0x15'),this[_0x135b('0x31')][_0x135b('0x12')](this));_0x19d4c3[_0x135b('0x10')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x2ce8ed){logger['error'](_0x2ce8ed);}}else{this[_0x135b('0xf')][_0x135b('0x32')](!![],this['handleCloseBox'][_0x135b('0x12')](this));}}};EmailImap['prototype'][_0x135b('0x33')]=function(_0x579b83,_0xbb0d1c){_0x579b83['on']('body',this[_0x135b('0x34')][_0x135b('0x12')](this));_0x579b83[_0x135b('0x10')](_0x135b('0x35'),this[_0x135b('0x36')][_0x135b('0x12')](this));_0x579b83['once'](_0x135b('0x13'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x135b('0x24')][_0x135b('0x34')]=function(_0x1d5c45,_0x576668){simpleParser(_0x1d5c45,{'Iconv':Iconv},this[_0x135b('0x37')][_0x135b('0x12')](this));};EmailImap[_0x135b('0x24')]['handleMessageAttributes']=function(_0x119c1a){};EmailImap[_0x135b('0x24')]['handleMessageEnd']=function(){};EmailImap[_0x135b('0x24')][_0x135b('0x37')]=function(_0x59cdcb,_0x2c189a){if(_0x59cdcb){logger[_0x135b('0x15')](_0x59cdcb);}else{var _0x30cd25=this;utils[_0x135b('0x38')](this[_0x135b('0xd')],_0x2c189a,function(_0x4f18f1){_0x30cd25[_0x135b('0x39')]('email',_0x4f18f1);});}};EmailImap['prototype'][_0x135b('0x3a')]=function(){this['imap']['closeBox'](!![],this[_0x135b('0x2b')]['bind'](this));};EmailImap[_0x135b('0x24')][_0x135b('0x31')]=function(_0x4a0c1b){this[_0x135b('0x28')](_0x4a0c1b);this['imap'][_0x135b('0x32')](!![],this[_0x135b('0x2b')][_0x135b('0x12')](this));};EmailImap[_0x135b('0x24')]['handleEnd']=function(){this['emit'](_0x135b('0x13'));};EmailImap['prototype'][_0x135b('0x28')]=function(_0x411276,_0x5b2bc4){logger[_0x135b('0x15')](_0x135b('0x28'),this[_0x135b('0xd')][_0x135b('0xa')],JSON[_0x135b('0x3b')](_0x411276));var _0x38216f='';if(_0x411276){if(_0x411276[_0x135b('0x3c')]){_0x38216f=_0x411276[_0x135b('0x3c')];}else{for(var _0x575644 in _0x411276){if(_0x411276[_0x135b('0x3d')](_0x575644)){_0x38216f+=_[_0x135b('0x3e')](_0x575644)+':\x20'+_0x411276[_0x575644]+'\x0a';}}}}if(_0x5b2bc4){this[_0x135b('0xf')][_0x135b('0x13')]();}else{this[_0x135b('0x39')](_0x135b('0x15'),_0x38216f);this[_0x135b('0x39')]('end');}};module[_0x135b('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c49b6d2..37faf87 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 _0x346a=['nodemailer-plugin-inline-base64','prototype','send','use','compile','toString','verify','createTransport','Not\x20verifired','nodemailer','bluebird'];(function(_0x53cd58,_0x59853c){var _0x382047=function(_0x44a4ff){while(--_0x44a4ff){_0x53cd58['push'](_0x53cd58['shift']());}};_0x382047(++_0x59853c);}(_0x346a,0x1e2));var _0xa346=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x346a[_0xbd08b4];return _0x314f1e;};'use strict';var nodemailer=require(_0xa346('0x0'));var BPromise=require(_0xa346('0x1'));var inlineBase64=require(_0xa346('0x2'));function EmailSmtp(){}EmailSmtp[_0xa346('0x3')][_0xa346('0x4')]=function(_0x2d5cd1,_0x4b3204){return new BPromise(function(_0x4d1625,_0x101794){var _0x2ccfef=nodemailer['createTransport'](_0x2d5cd1);_0x2ccfef[_0xa346('0x5')](_0xa346('0x6'),inlineBase64());_0x2ccfef['sendMail'](_0x4b3204,function(_0x3f7a0c,_0x2ef14c){if(_0x3f7a0c){_0x101794(_0x3f7a0c[_0xa346('0x7')]());}else{_0x4d1625(_0x2ef14c);}});});};EmailSmtp[_0xa346('0x3')][_0xa346('0x8')]=function(_0x2c037b){return new BPromise(function(_0x111c21,_0x31c790){var _0x495cc8=nodemailer[_0xa346('0x9')](_0x2c037b);_0x495cc8[_0xa346('0x8')](function(_0x2d8521,_0x2863fe){if(_0x2d8521){_0x31c790(_0x2d8521[_0xa346('0x7')]());}else{if(_0x2863fe){_0x111c21(_0x2863fe);}else{_0x31c790(_0xa346('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x9535=['exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','toString','Not\x20verifired'];(function(_0x1b32b8,_0x5deccf){var _0x3745ea=function(_0x27f4e3){while(--_0x27f4e3){_0x1b32b8['push'](_0x1b32b8['shift']());}};_0x3745ea(++_0x5deccf);}(_0x9535,0x169));var _0x5953=function(_0x1dec6f,_0x4cd498){_0x1dec6f=_0x1dec6f-0x0;var _0x807139=_0x9535[_0x1dec6f];return _0x807139;};'use strict';var nodemailer=require(_0x5953('0x0'));var BPromise=require(_0x5953('0x1'));var inlineBase64=require(_0x5953('0x2'));function EmailSmtp(){}EmailSmtp[_0x5953('0x3')]['send']=function(_0x365056,_0x499dfa){return new BPromise(function(_0x5a4147,_0x8dcbe1){var _0x4f7ad9=nodemailer[_0x5953('0x4')](_0x365056);_0x4f7ad9[_0x5953('0x5')](_0x5953('0x6'),inlineBase64());_0x4f7ad9['sendMail'](_0x499dfa,function(_0x500bda,_0x3f9c27){if(_0x500bda){_0x8dcbe1(_0x500bda[_0x5953('0x7')]());}else{_0x5a4147(_0x3f9c27);}});});};EmailSmtp[_0x5953('0x3')]['verify']=function(_0x1a2795){return new BPromise(function(_0x323412,_0x1883bb){var _0x198073=nodemailer[_0x5953('0x4')](_0x1a2795);_0x198073['verify'](function(_0x2264c5,_0x64340b){if(_0x2264c5){_0x1883bb(_0x2264c5[_0x5953('0x7')]());}else{if(_0x64340b){_0x323412(_0x64340b);}else{_0x1883bb(_0x5953('0x8'));}}});});};module[_0x5953('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3eb4c16..f889785 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 _0xe1dd=['value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','pop','isEmpty','html','replace','body','textAsHtml','0x1?_0x4451db[_0xde1d('0x11')]():'';}return'';}function getMails(_0x1a65d6,_0xcba358){var _0x340e6e='';for(var _0x3a14b5=0x0;_0x3a14b5<_0xcba358[_0xde1d('0x7')][_0xde1d('0xe')];_0x3a14b5+=0x1){if(_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0x8')]!==_0x1a65d6){if(!_[_0xde1d('0x12')](_0x340e6e)){_0x340e6e+=',';}_0x340e6e+=_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0xc')]||_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0x8')]||'';_0x340e6e+='\x20<';_0x340e6e+=_0xcba358[_0xde1d('0x7')][_0x3a14b5]['address']?_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0x8')]:_0xde1d('0x9')+random[_0xde1d('0xa')](0x6)+_0xde1d('0xb');_0x340e6e+='>';}}return _0x340e6e;}function parseEmail(_0x28e049,_0x2bcdd4,_0x88c6fc){if(_0x2bcdd4[_0xde1d('0x13')]){var _0x50288c=/)<[^<]*)*<\/script>/gi;while(_0x50288c['test'](_0x2bcdd4['html'])){_0x2bcdd4[_0xde1d('0x13')]=_0x2bcdd4[_0xde1d('0x13')][_0xde1d('0x14')](_0x50288c,'');}_0x88c6fc[_0xde1d('0x15')]=_0x2bcdd4[_0xde1d('0x13')];}else{_0x88c6fc[_0xde1d('0x15')]=_0x2bcdd4[_0xde1d('0x16')];}if(_0x88c6fc[_0xde1d('0x15')]){_0x88c6fc[_0xde1d('0x15')]=_0x88c6fc[_0xde1d('0x15')][_0xde1d('0x14')](/Empty\x20message

';if(_0x51a164['Attachments']){for(var _0x990883=0x0;_0x990883<_0x51a164['Attachments'][_0xde1d('0xe')];_0x990883++){var _0x32c413=_0x51a164[_0xde1d('0x34')][_0x990883];_0x58d8d6[_0xde1d('0x18')][_0xde1d('0x1c')]['push']({'filename':_0x32c413[_0xde1d('0x35')],'content':new Buffer(_0x32c413[_0xde1d('0x36')])});}}}_0x51ca13(parseEmail(_0x30afb2,_0x2b9aae,_0x58d8d6));});}else{_0x2b9aae[_0xde1d('0x13')]='

Empty\x20message

';_0x51ca13(parseEmail(_0x30afb2,_0x2b9aae,_0x58d8d6));}}else{_0x51ca13(parseEmail(_0x30afb2,_0x2b9aae,_0x58d8d6));}};exports[_0xde1d('0x37')]=function(_0xdeb013){switch(_0xdeb013){case _0xde1d('0x38'):return _0xde1d('0x39');case _0xde1d('0x3a'):return _0xde1d('0x3b');case'hotmail':return _0xde1d('0x3c');case _0xde1d('0x3d'):return _0xde1d('0x3e');}return _0xde1d('0x3f');}; \ No newline at end of file +var _0x7447=['imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path','util','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','value','pop','isEmpty','test','html','body','textAsHtml','message','originTo','email','originCc','includes','attachments','attach','type','attachment','filename','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','parser','from','messageId','format','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail'];(function(_0x10f7c9,_0x53bbcc){var _0x1fe36f=function(_0x575f90){while(--_0x575f90){_0x10f7c9['push'](_0x10f7c9['shift']());}};_0x1fe36f(++_0x53bbcc);}(_0x7447,0x1b6));var _0x7744=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7447[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x7744('0x0'));var moment=require(_0x7744('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x7744('0x2'));var util=require(_0x7744('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require(_0x7744('0x4'));function getAddress(_0x47a110){var _0x79bb74=_[_0x7744('0x5')](_0x47a110['value']);return _0x79bb74&&_0x79bb74[_0x7744('0x6')]?_0x79bb74['address']:_0x7744('0x7')+random[_0x7744('0x8')](0x6)+_0x7744('0x9');}function getFirstName(_0x3b28aa){var _0x4c5d90=_[_0x7744('0x5')](_0x3b28aa['value']);if(_0x4c5d90&&_0x4c5d90['name']){var _0x489673=_0x4c5d90[_0x7744('0xa')][_0x7744('0xb')](/\s+/);return _0x489673[_0x7744('0xc')]?_0x489673[_0x7744('0xd')](0x0,-0x1)[_0x7744('0xe')]('\x20'):_0x4c5d90[_0x7744('0xa')];}return _0x7744('0xf');}function getLastName(_0x2a420f){var _0xec4892=_[_0x7744('0x5')](_0x2a420f[_0x7744('0x10')]);if(_0xec4892&&_0xec4892[_0x7744('0xa')]){var _0x460f43=_0xec4892[_0x7744('0xa')][_0x7744('0xb')](/\s+/);return _0x460f43[_0x7744('0xc')]>0x1?_0x460f43[_0x7744('0x11')]():'';}return'';}function getMails(_0x5b664b,_0x2a51d6){var _0x3b1224='';for(var _0x578ade=0x0;_0x578ade<_0x2a51d6[_0x7744('0x10')]['length'];_0x578ade+=0x1){if(_0x2a51d6[_0x7744('0x10')][_0x578ade][_0x7744('0x6')]!==_0x5b664b){if(!_[_0x7744('0x12')](_0x3b1224)){_0x3b1224+=',';}_0x3b1224+=_0x2a51d6[_0x7744('0x10')][_0x578ade][_0x7744('0xa')]||_0x2a51d6[_0x7744('0x10')][_0x578ade][_0x7744('0x6')]||'';_0x3b1224+='\x20<';_0x3b1224+=_0x2a51d6[_0x7744('0x10')][_0x578ade][_0x7744('0x6')]?_0x2a51d6[_0x7744('0x10')][_0x578ade]['address']:'anonymous'+random[_0x7744('0x8')](0x6)+_0x7744('0x9');_0x3b1224+='>';}}return _0x3b1224;}function parseEmail(_0xda4ff7,_0x320ed0,_0x1281b1){if(_0x320ed0['html']){var _0x1e765c=/)<[^<]*)*<\/script>/gi;while(_0x1e765c[_0x7744('0x13')](_0x320ed0[_0x7744('0x14')])){_0x320ed0[_0x7744('0x14')]=_0x320ed0[_0x7744('0x14')]['replace'](_0x1e765c,'');}_0x1281b1[_0x7744('0x15')]=_0x320ed0[_0x7744('0x14')];}else{_0x1281b1['body']=_0x320ed0[_0x7744('0x16')];}if(_0x1281b1[_0x7744('0x15')]){_0x1281b1[_0x7744('0x15')]=_0x1281b1[_0x7744('0x15')]['replace'](/0x0){if(this[_0x583110+'Capacity']>0x0&&this[_0x583110+_0xbb5f('0x26')]>=this[_0x583110+'Capacity']){return _0xbb5f('0x27');}else{return'working';}}else{return _0xbb5f('0x28');}};Agent[_0xbb5f('0x29')][_0xbb5f('0x24')]=function(){var _0x4d7233=[_0xbb5f('0x2a'),'chat','openchannel',_0xbb5f('0x2b'),_0xbb5f('0x2c'),_0xbb5f('0x2d')];for(var _0x39ab2=0x0;_0x39ab2<_0x4d7233[_0xbb5f('0x2e')];_0x39ab2+=0x1){var _0x3c65cd=this[_0xbb5f('0x25')](_0x4d7233[_0x39ab2]);if(this[_0x4d7233[_0x39ab2]+_0xbb5f('0x2f')]!==_0x3c65cd){this[_0x4d7233[_0x39ab2]+_0xbb5f('0x30')]=_[_0xbb5f('0x31')](moment()[_0xbb5f('0x32')]('x'));}this[_0x4d7233[_0x39ab2]+_0xbb5f('0x2f')]=_0x3c65cd;}var _0x187477={'id':this['id'],'name':this[_0xbb5f('0x9')],'online':this[_0xbb5f('0x33')],'voicePause':this[_0xbb5f('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xbb5f('0xd')],'faxPause':this[_0xbb5f('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xbb5f('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xbb5f('0x12')],'chatCurrentCapacity':this[_0xbb5f('0x13')],'mailStatus':this[_0xbb5f('0x34')],'mailStatusTime':this[_0xbb5f('0x14')],'mailCapacity':this[_0xbb5f('0x15')],'mailCurrentCapacity':this[_0xbb5f('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xbb5f('0x18')],'faxCapacity':this[_0xbb5f('0x19')],'faxCurrentCapacity':this[_0xbb5f('0x1a')],'smsStatus':this[_0xbb5f('0x35')],'smsStatusTime':this[_0xbb5f('0x1b')],'smsCapacity':this[_0xbb5f('0x1c')],'smsCurrentCapacity':this[_0xbb5f('0x1d')],'whatsappStatus':this[_0xbb5f('0x36')],'whatsappStatusTime':this[_0xbb5f('0x37')],'whatsappCapacity':this[_0xbb5f('0x1e')],'whatsappCurrentCapacity':this[_0xbb5f('0x1f')],'openchannelStatus':this[_0xbb5f('0x38')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xbb5f('0x21')],'openchannelCurrentCapacity':this[_0xbb5f('0x22')],'busy':this['busy'],'busyQueue':this[_0xbb5f('0x23')]};var _0x58130f=md5(JSON[_0xbb5f('0x39')](_0x187477));if(this['md5']!==_0x58130f){this['md5']=_0x58130f;io[_0xbb5f('0x3a')](_0xbb5f('0x3b'),_0x187477);}};module[_0xbb5f('0x3c')]=Agent; \ No newline at end of file +var _0x758a=['chat','fax','sms','whatsapp','length','getChannelStatus','Status','smsPause','chatStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','CurrentCapacity','Capacity','working','prototype'];(function(_0x1e2c73,_0x12cd55){var _0x46f8d5=function(_0xe5a2fd){while(--_0xe5a2fd){_0x1e2c73['push'](_0x1e2c73['shift']());}};_0x46f8d5(++_0x12cd55);}(_0x758a,0x1d1));var _0xa758=function(_0x57ae6a,_0x467aaa){_0x57ae6a=_0x57ae6a-0x0;var _0x2b58bf=_0x758a[_0x57ae6a];return _0x2b58bf;};'use strict';var _=require(_0xa758('0x0'));var moment=require(_0xa758('0x1'));var md5=require(_0xa758('0x2'));var Redis=require(_0xa758('0x3'));var config=require(_0xa758('0x4'));config[_0xa758('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa758('0x6'))(new Redis(config['redis']));function Agent(_0x198c92){this['id']=_0x198c92['id']||0x0;this[_0xa758('0x7')]=_0x198c92[_0xa758('0x7')]||'';this['online']=_0x198c92['online']||!![];this[_0xa758('0x8')]=_0x198c92[_0xa758('0x8')]||![];this[_0xa758('0x9')]=_0x198c92[_0xa758('0x9')]||![];this[_0xa758('0xa')]=_0x198c92[_0xa758('0xa')]||![];this['faxPause']=_0x198c92[_0xa758('0xb')]||![];this['smsPause']=_0x198c92['smsPause']||![];this[_0xa758('0xc')]=_0x198c92[_0xa758('0xc')]||![];this['chatStatus']=_0xa758('0xd');this[_0xa758('0xe')]=0x0;this[_0xa758('0xf')]=_0x198c92[_0xa758('0xf')]||0x0;this[_0xa758('0x10')]=0x0;this[_0xa758('0x11')]=_0xa758('0xd');this['mailStatusTime']=0x0;this['mailCapacity']=_0x198c92[_0xa758('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xa758('0xd');this[_0xa758('0x13')]=0x0;this[_0xa758('0x14')]=_0x198c92['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0xa758('0x15')]='unknown';this[_0xa758('0x16')]=0x0;this['smsCapacity']=_0x198c92[_0xa758('0x17')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xa758('0x18')]=_0xa758('0xd');this[_0xa758('0x19')]=0x0;this[_0xa758('0x1a')]=_0x198c92[_0xa758('0x1a')]||0x0;this[_0xa758('0x1b')]=0x0;this[_0xa758('0x1c')]='unknown';this[_0xa758('0x1d')]=0x0;this['openchannelCapacity']=_0x198c92[_0xa758('0x1e')]||0x0;this[_0xa758('0x1f')]=0x0;this[_0xa758('0x20')]=![];this[_0xa758('0x21')]=undefined;this['md5']='';this[_0xa758('0x22')]();}Agent['prototype']['getChannelStatus']=function(_0x8f311){if(this[_0x8f311+_0xa758('0x23')]>0x0){if(this[_0x8f311+_0xa758('0x24')]>0x0&&this[_0x8f311+'CurrentCapacity']>=this[_0x8f311+_0xa758('0x24')]){return'maxcapacity';}else{return _0xa758('0x25');}}else{return'idle';}};Agent[_0xa758('0x26')]['updateRealtime']=function(){var _0x3cf203=['mail',_0xa758('0x27'),'openchannel',_0xa758('0x28'),_0xa758('0x29'),_0xa758('0x2a')];for(var _0xd9dd6d=0x0;_0xd9dd6d<_0x3cf203[_0xa758('0x2b')];_0xd9dd6d+=0x1){var _0xef63d=this[_0xa758('0x2c')](_0x3cf203[_0xd9dd6d]);if(this[_0x3cf203[_0xd9dd6d]+_0xa758('0x2d')]!==_0xef63d){this[_0x3cf203[_0xd9dd6d]+'StatusTime']=_['toNumber'](moment()['format']('x'));}this[_0x3cf203[_0xd9dd6d]+'Status']=_0xef63d;}var _0x30b254={'id':this['id'],'name':this[_0xa758('0x7')],'online':this['online'],'voicePause':this[_0xa758('0x8')],'chatPause':this[_0xa758('0x9')],'mailPause':this[_0xa758('0xa')],'smsPause':this[_0xa758('0x2e')],'faxPause':this[_0xa758('0xb')],'openchannelPause':this[_0xa758('0xc')],'chatStatus':this[_0xa758('0x2f')],'chatStatusTime':this[_0xa758('0xe')],'chatCapacity':this[_0xa758('0xf')],'chatCurrentCapacity':this[_0xa758('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xa758('0x30')],'mailCapacity':this[_0xa758('0x12')],'mailCurrentCapacity':this[_0xa758('0x31')],'faxStatus':this[_0xa758('0x32')],'faxStatusTime':this[_0xa758('0x13')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xa758('0x33')],'smsStatus':this[_0xa758('0x15')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xa758('0x18')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xa758('0x1a')],'whatsappCurrentCapacity':this[_0xa758('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xa758('0x1d')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xa758('0x1f')],'busy':this[_0xa758('0x20')],'busyQueue':this[_0xa758('0x21')]};var _0x5ba0ad=md5(JSON[_0xa758('0x34')](_0x30b254));if(this[_0xa758('0x2')]!==_0x5ba0ad){this[_0xa758('0x2')]=_0x5ba0ad;io[_0xa758('0x35')](_0xa758('0x36'),_0x30b254);}};module[_0xa758('0x37')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a2b9c37..c1dd9b5 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 _0xab43=['stringify','format','chat:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','loggedIn','available'];(function(_0x468230,_0x487aef){var _0x509774=function(_0x4a9f56){while(--_0x4a9f56){_0x468230['push'](_0x468230['shift']());}};_0x509774(++_0x487aef);}(_0xab43,0xdd));var _0x3ab4=function(_0x1101aa,_0x20cfb3){_0x1101aa=_0x1101aa-0x0;var _0x8ffff1=_0xab43[_0x1101aa];return _0x8ffff1;};'use strict';var _=require('lodash');var md5=require(_0x3ab4('0x0'));var util=require(_0x3ab4('0x1'));var Redis=require(_0x3ab4('0x2'));var config=require(_0x3ab4('0x3'));config['redis']=_[_0x3ab4('0x4')](config[_0x3ab4('0x5')],{'host':_0x3ab4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3ab4('0x5')]));function ChatQueue(_0x28f639){this['id']=_0x28f639['id']||0x0;this[_0x3ab4('0x7')]=_0x28f639[_0x3ab4('0x7')]||'';this[_0x3ab4('0x8')]=_0x28f639[_0x3ab4('0x8')]||0xa;this[_0x3ab4('0x9')]=_0x28f639[_0x3ab4('0x9')]||_0x3ab4('0xa');this[_0x3ab4('0xb')]=_0x28f639[_0x3ab4('0xb')];this[_0x3ab4('0xc')]={};this[_0x3ab4('0xd')]=0x0;this['md5']='';this[_0x3ab4('0xe')]();this[_0x3ab4('0xf')]();}ChatQueue[_0x3ab4('0x10')][_0x3ab4('0xe')]=function(){var _0x436e4d=this['mapAgentsId']['_rr'];this[_0x3ab4('0xc')]=_['map'](this[_0x3ab4('0xb')],'id');this[_0x3ab4('0xc')][_0x3ab4('0x11')]=_0x436e4d;};ChatQueue['prototype'][_0x3ab4('0xf')]=function(){this['loggedIn']=0x0;this[_0x3ab4('0x12')]=0x0;for(var _0x35a636=0x0;_0x35a636=0x0?this[_0x3ab4('0x15')]:0x0;var _0x40de25={'id':this['id'],'available':this[_0x3ab4('0x15')],'loggedIn':this[_0x3ab4('0x14')],'name':this[_0x3ab4('0x7')],'paused':this[_0x3ab4('0x12')],'waiting':this[_0x3ab4('0xd')]};var _0x4f9034=md5(JSON[_0x3ab4('0x16')](_0x40de25));if(this['md5']!==_0x4f9034){this[_0x3ab4('0x0')]=_0x4f9034;io['to'](util[_0x3ab4('0x17')](_0x3ab4('0x18'),_0x40de25[_0x3ab4('0x7')]))[_0x3ab4('0x19')]('chat_queue:save',_0x40de25);}};module[_0x3ab4('0x1a')]=ChatQueue; \ No newline at end of file +var _0x4182=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x47c5f9,_0x6ce1fc){var _0x172038=function(_0x143b3f){while(--_0x143b3f){_0x47c5f9['push'](_0x47c5f9['shift']());}};_0x172038(++_0x6ce1fc);}(_0x4182,0x190));var _0x2418=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x4182[_0x58547b];return _0x1d3fd2;};'use strict';var _=require(_0x2418('0x0'));var md5=require(_0x2418('0x1'));var util=require('util');var Redis=require(_0x2418('0x2'));var config=require(_0x2418('0x3'));config[_0x2418('0x4')]=_[_0x2418('0x5')](config[_0x2418('0x4')],{'host':_0x2418('0x6'),'port':0x18eb});var io=require(_0x2418('0x7'))(new Redis(config[_0x2418('0x4')]));function ChatQueue(_0x148bc3){this['id']=_0x148bc3['id']||0x0;this['name']=_0x148bc3[_0x2418('0x8')]||'';this[_0x2418('0x9')]=_0x148bc3[_0x2418('0x9')]||0xa;this[_0x2418('0xa')]=_0x148bc3[_0x2418('0xa')]||_0x2418('0xb');this[_0x2418('0xc')]=_0x148bc3['Agents'];this[_0x2418('0xd')]={};this[_0x2418('0xe')]=0x0;this[_0x2418('0x1')]='';this[_0x2418('0xf')]();this[_0x2418('0x10')]();}ChatQueue[_0x2418('0x11')][_0x2418('0xf')]=function(){var _0x45c7b6=this[_0x2418('0xd')][_0x2418('0x12')];this[_0x2418('0xd')]=_[_0x2418('0x13')](this[_0x2418('0xc')],'id');this[_0x2418('0xd')][_0x2418('0x12')]=_0x45c7b6;};ChatQueue[_0x2418('0x11')][_0x2418('0x10')]=function(){this[_0x2418('0x14')]=0x0;this[_0x2418('0x15')]=0x0;for(var _0x247e25=0x0;_0x247e25=0x0?this[_0x2418('0x18')]:0x0;var _0x559982={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2418('0x14')],'name':this[_0x2418('0x8')],'paused':this[_0x2418('0x15')],'waiting':this[_0x2418('0xe')]};var _0x1ad4eb=md5(JSON['stringify'](_0x559982));if(this[_0x2418('0x1')]!==_0x1ad4eb){this[_0x2418('0x1')]=_0x1ad4eb;io['to'](util[_0x2418('0x19')]('chat:queue:%s',_0x559982['name']))[_0x2418('0x1a')](_0x2418('0x1b'),_0x559982);}};module[_0x2418('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 28a3819..51a3927 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(_0x1671c0,_0x5d885a){var _0x1d776c=function(_0x47a263){while(--_0x47a263){_0x1671c0['push'](_0x1671c0['shift']());}};_0x1d776c(++_0x5d885a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x4ed229,_0x20a53a){var _0x3bcaf4=function(_0x3c0d6b){while(--_0x3c0d6b){_0x4ed229['push'](_0x4ed229['shift']());}};_0x3bcaf4(++_0x20a53a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 e8306b5..bdc4276 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 _0xb071=['name','Intervals'];(function(_0x5ca544,_0x5a278){var _0x237ce4=function(_0x109b79){while(--_0x109b79){_0x5ca544['push'](_0x5ca544['shift']());}};_0x237ce4(++_0x5a278);}(_0xb071,0xea));var _0x1b07=function(_0x179170,_0x414a7a){_0x179170=_0x179170-0x0;var _0x2e0aac=_0xb071[_0x179170];return _0x2e0aac;};'use strict';function Interval(_0xca4af1){this['id']=_0xca4af1['id']||0x0;this[_0x1b07('0x0')]=_0xca4af1[_0x1b07('0x0')]||'';this[_0x1b07('0x1')]=_0xca4af1['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xf4a3=['exports','name','Intervals'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf4a3,0xb8));var _0x3f4a=function(_0x599f37,_0x4f6019){_0x599f37=_0x599f37-0x0;var _0x4f6bf9=_0xf4a3[_0x599f37];return _0x4f6bf9;};'use strict';function Interval(_0x304800){this['id']=_0x304800['id']||0x0;this[_0x3f4a('0x0')]=_0x304800['name']||'';this[_0x3f4a('0x1')]=_0x304800['Intervals']||{};}module[_0x3f4a('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 cca72da..691286b 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 _0xb9a7=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','available','stringify','format','mail:queue:%s','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x344a43,_0x34bead){var _0x41bfb7=function(_0x2ad561){while(--_0x2ad561){_0x344a43['push'](_0x344a43['shift']());}};_0x41bfb7(++_0x34bead);}(_0xb9a7,0x172));var _0x7b9a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb9a7[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x7b9a('0x0'));var md5=require('md5');var util=require(_0x7b9a('0x1'));var Redis=require(_0x7b9a('0x2'));var config=require(_0x7b9a('0x3'));config[_0x7b9a('0x4')]=_[_0x7b9a('0x5')](config[_0x7b9a('0x4')],{'host':_0x7b9a('0x6'),'port':0x18eb});var io=require(_0x7b9a('0x7'))(new Redis(config[_0x7b9a('0x4')]));function MailQueue(_0xca814b){this['id']=_0xca814b['id']||0x0;this[_0x7b9a('0x8')]=_0xca814b[_0x7b9a('0x8')]||'';this[_0x7b9a('0x9')]=_0xca814b[_0x7b9a('0x9')]||0xa;this[_0x7b9a('0xa')]=_0xca814b[_0x7b9a('0xa')]||'beepall';this[_0x7b9a('0xb')]=_0xca814b[_0x7b9a('0xb')];this[_0x7b9a('0xc')]={};this[_0x7b9a('0xd')]=0x0;this[_0x7b9a('0xe')]='';this[_0x7b9a('0xf')]();this[_0x7b9a('0x10')]();}MailQueue[_0x7b9a('0x11')][_0x7b9a('0xf')]=function(){var _0x59e46f=this[_0x7b9a('0xc')]['_rr'];this['mapAgentsId']=_[_0x7b9a('0x12')](this[_0x7b9a('0xb')],'id');this[_0x7b9a('0xc')][_0x7b9a('0x13')]=_0x59e46f;};MailQueue[_0x7b9a('0x11')][_0x7b9a('0x10')]=function(){this[_0x7b9a('0x14')]=0x0;this[_0x7b9a('0x15')]=0x0;for(var _0x4bf183=0x0;_0x4bf183=0x0?this[_0x7b9a('0x17')]:0x0;var _0x3c610d={'id':this['id'],'available':this[_0x7b9a('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7b9a('0x8')],'paused':this[_0x7b9a('0x15')],'waiting':this['waiting']};var _0x59b6d4=md5(JSON[_0x7b9a('0x18')](_0x3c610d));if(this[_0x7b9a('0xe')]!==_0x59b6d4){this[_0x7b9a('0xe')]=_0x59b6d4;io['to'](util[_0x7b9a('0x19')](_0x7b9a('0x1a'),_0x3c610d['name']))[_0x7b9a('0x1b')]('mail_queue:save',_0x3c610d);}};module[_0x7b9a('0x1c')]=MailQueue; \ No newline at end of file +var _0xa208=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment'];(function(_0x524277,_0x2b0cad){var _0x2b9d18=function(_0x432ead){while(--_0x432ead){_0x524277['push'](_0x524277['shift']());}};_0x2b9d18(++_0x2b0cad);}(_0xa208,0x18f));var _0x8a20=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xa208[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x8a20('0x0'));var md5=require(_0x8a20('0x1'));var util=require(_0x8a20('0x2'));var Redis=require('ioredis');var config=require(_0x8a20('0x3'));config[_0x8a20('0x4')]=_[_0x8a20('0x5')](config['redis'],{'host':_0x8a20('0x6'),'port':0x18eb});var io=require(_0x8a20('0x7'))(new Redis(config[_0x8a20('0x4')]));function MailQueue(_0xa40cfd){this['id']=_0xa40cfd['id']||0x0;this[_0x8a20('0x8')]=_0xa40cfd[_0x8a20('0x8')]||'';this[_0x8a20('0x9')]=_0xa40cfd[_0x8a20('0x9')]||0xa;this['strategy']=_0xa40cfd[_0x8a20('0xa')]||_0x8a20('0xb');this['Agents']=_0xa40cfd[_0x8a20('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8a20('0x1')]='';this[_0x8a20('0xd')]();this[_0x8a20('0xe')]();}MailQueue[_0x8a20('0xf')][_0x8a20('0xd')]=function(){var _0x2745c8=this[_0x8a20('0x10')][_0x8a20('0x11')];this[_0x8a20('0x10')]=_[_0x8a20('0x12')](this[_0x8a20('0xc')],'id');this[_0x8a20('0x10')]['_rr']=_0x2745c8;};MailQueue[_0x8a20('0xf')]['updateRealtime']=function(){this[_0x8a20('0x13')]=0x0;this[_0x8a20('0x14')]=0x0;for(var _0x52148e=0x0;_0x52148e=0x0?this[_0x8a20('0x17')]:0x0;var _0x551b14={'id':this['id'],'available':this[_0x8a20('0x17')],'loggedIn':this[_0x8a20('0x13')],'name':this['name'],'paused':this[_0x8a20('0x14')],'waiting':this[_0x8a20('0x18')]};var _0x40d8ca=md5(JSON[_0x8a20('0x19')](_0x551b14));if(this['md5']!==_0x40d8ca){this[_0x8a20('0x1')]=_0x40d8ca;io['to'](util[_0x8a20('0x1a')](_0x8a20('0x1b'),_0x551b14[_0x8a20('0x8')]))[_0x8a20('0x1c')](_0x8a20('0x1d'),_0x551b14);}};module[_0x8a20('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b8817e9..114f541 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 _0xedf7=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','redis'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xedf7,0x1bd));var _0x7edf=function(_0x5d2477,_0x3672cb){_0x5d2477=_0x5d2477-0x0;var _0x46f68a=_0xedf7[_0x5d2477];return _0x46f68a;};'use strict';var _=require(_0x7edf('0x0'));var md5=require('md5');var util=require(_0x7edf('0x1'));var Redis=require(_0x7edf('0x2'));var config=require(_0x7edf('0x3'));config[_0x7edf('0x4')]=_[_0x7edf('0x5')](config[_0x7edf('0x4')],{'host':_0x7edf('0x6'),'port':0x18eb});var io=require(_0x7edf('0x7'))(new Redis(config[_0x7edf('0x4')]));function OpenchannelQueue(_0x5b1adc){this['id']=_0x5b1adc['id']||0x0;this['name']=_0x5b1adc[_0x7edf('0x8')]||'';this['timeout']=_0x5b1adc[_0x7edf('0x9')]||0xa;this[_0x7edf('0xa')]=_0x5b1adc[_0x7edf('0xa')]||_0x7edf('0xb');this[_0x7edf('0xc')]=_0x5b1adc[_0x7edf('0xc')];this[_0x7edf('0xd')]={};this[_0x7edf('0xe')]=0x0;this[_0x7edf('0xf')]='';this[_0x7edf('0x10')]();this[_0x7edf('0x11')]();}OpenchannelQueue[_0x7edf('0x12')][_0x7edf('0x10')]=function(){var _0x403183=this['mapAgentsId'][_0x7edf('0x13')];this[_0x7edf('0xd')]=_[_0x7edf('0x14')](this[_0x7edf('0xc')],'id');this[_0x7edf('0xd')][_0x7edf('0x13')]=_0x403183;};OpenchannelQueue[_0x7edf('0x12')][_0x7edf('0x11')]=function(){this[_0x7edf('0x15')]=0x0;this[_0x7edf('0x16')]=0x0;for(var _0x3a135c=0x0;_0x3a135c=0x0?this['available']:0x0;var _0x54a605={'id':this['id'],'available':this[_0x7edf('0x1a')],'loggedIn':this[_0x7edf('0x15')],'name':this['name'],'paused':this[_0x7edf('0x16')],'waiting':this[_0x7edf('0xe')]};var _0x1818a7=md5(JSON[_0x7edf('0x1b')](_0x54a605));if(this[_0x7edf('0xf')]!==_0x1818a7){this[_0x7edf('0xf')]=_0x1818a7;io['to'](util['format']('openchannel:queue:%s',_0x54a605[_0x7edf('0x8')]))[_0x7edf('0x1c')](_0x7edf('0x1d'),_0x54a605);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xf397=['prototype','updateRealtime','loggedIn','paused','length','available','stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId'];(function(_0x2786d3,_0x31fcc3){var _0x5ccbda=function(_0x39ab92){while(--_0x39ab92){_0x2786d3['push'](_0x2786d3['shift']());}};_0x5ccbda(++_0x31fcc3);}(_0xf397,0x16a));var _0x7f39=function(_0x2d0abe,_0x42cfc9){_0x2d0abe=_0x2d0abe-0x0;var _0x5ee2b8=_0xf397[_0x2d0abe];return _0x5ee2b8;};'use strict';var _=require(_0x7f39('0x0'));var md5=require(_0x7f39('0x1'));var util=require(_0x7f39('0x2'));var Redis=require(_0x7f39('0x3'));var config=require(_0x7f39('0x4'));config[_0x7f39('0x5')]=_[_0x7f39('0x6')](config[_0x7f39('0x5')],{'host':_0x7f39('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7f39('0x5')]));function OpenchannelQueue(_0x2780d4){this['id']=_0x2780d4['id']||0x0;this['name']=_0x2780d4[_0x7f39('0x8')]||'';this[_0x7f39('0x9')]=_0x2780d4['timeout']||0xa;this['strategy']=_0x2780d4[_0x7f39('0xa')]||_0x7f39('0xb');this['Agents']=_0x2780d4[_0x7f39('0xc')];this['mapAgentsId']={};this[_0x7f39('0xd')]=0x0;this[_0x7f39('0x1')]='';this[_0x7f39('0xe')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x7f39('0xe')]=function(){var _0x3c4a6c=this[_0x7f39('0xf')]['_rr'];this[_0x7f39('0xf')]=_['map'](this[_0x7f39('0xc')],'id');this[_0x7f39('0xf')]['_rr']=_0x3c4a6c;};OpenchannelQueue[_0x7f39('0x10')][_0x7f39('0x11')]=function(){this[_0x7f39('0x12')]=0x0;this[_0x7f39('0x13')]=0x0;for(var _0x54a06b=0x0;_0x54a06b=0x0?this[_0x7f39('0x15')]:0x0;var _0x49d729={'id':this['id'],'available':this[_0x7f39('0x15')],'loggedIn':this[_0x7f39('0x12')],'name':this[_0x7f39('0x8')],'paused':this[_0x7f39('0x13')],'waiting':this[_0x7f39('0xd')]};var _0x1da052=md5(JSON[_0x7f39('0x16')](_0x49d729));if(this[_0x7f39('0x1')]!==_0x1da052){this[_0x7f39('0x1')]=_0x1da052;io['to'](util[_0x7f39('0x17')](_0x7f39('0x18'),_0x49d729['name']))['emit'](_0x7f39('0x19'),_0x49d729);}};module[_0x7f39('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2fd3a9a..3944afb 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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x336d6b,_0x2ce9b7){var _0x3ee6bf=function(_0xb55211){while(--_0xb55211){_0x336d6b['push'](_0x336d6b['shift']());}};_0x3ee6bf(++_0x2ce9b7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x757a,0xde));var _0xa757=function(_0x1252b0,_0x3a3d2e){_0x1252b0=_0x1252b0-0x0;var _0x12c2de=_0x757a[_0x1252b0];return _0x12c2de;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ff30e55..15eb1a9 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 _0x8270=['md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x1928dd,_0x4e4a6a){var _0x32de52=function(_0xe6aa91){while(--_0xe6aa91){_0x1928dd['push'](_0x1928dd['shift']());}};_0x32de52(++_0x4e4a6a);}(_0x8270,0x185));var _0x0827=function(_0xc6f2df,_0x222595){_0xc6f2df=_0xc6f2df-0x0;var _0x1c853b=_0x8270[_0xc6f2df];return _0x1c853b;};'use strict';var _=require(_0x0827('0x0'));var md5=require(_0x0827('0x1'));var util=require(_0x0827('0x2'));var Redis=require(_0x0827('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x0827('0x4')](config[_0x0827('0x5')],{'host':_0x0827('0x6'),'port':0x18eb});var io=require(_0x0827('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x36b275){this['id']=_0x36b275['id']||0x0;this[_0x0827('0x8')]=_0x36b275['name']||'';this[_0x0827('0x9')]=_0x36b275[_0x0827('0x9')]||0xa;this[_0x0827('0xa')]=_0x36b275[_0x0827('0xa')]||_0x0827('0xb');this[_0x0827('0xc')]=_0x36b275['Agents'];this[_0x0827('0xd')]={};this[_0x0827('0xe')]=0x0;this[_0x0827('0x1')]='';this[_0x0827('0xf')]();this[_0x0827('0x10')]();}WhatsappQueue[_0x0827('0x11')][_0x0827('0xf')]=function(){var _0x32285d=this[_0x0827('0xd')][_0x0827('0x12')];this[_0x0827('0xd')]=_['map'](this[_0x0827('0xc')],'id');this[_0x0827('0xd')][_0x0827('0x12')]=_0x32285d;};WhatsappQueue[_0x0827('0x11')][_0x0827('0x10')]=function(){this[_0x0827('0x13')]=0x0;this[_0x0827('0x14')]=0x0;for(var _0x2f61bf=0x0;_0x2f61bf=0x0?this[_0x0827('0x18')]:0x0;var _0x378fec={'id':this['id'],'available':this[_0x0827('0x18')],'loggedIn':this[_0x0827('0x13')],'name':this[_0x0827('0x8')],'paused':this['paused'],'waiting':this[_0x0827('0xe')]};var _0x225aa8=md5(JSON[_0x0827('0x19')](_0x378fec));if(this[_0x0827('0x1')]!==_0x225aa8){this['md5']=_0x225aa8;io['to'](util['format'](_0x0827('0x1a'),_0x378fec[_0x0827('0x8')]))[_0x0827('0x1b')](_0x0827('0x1c'),_0x378fec);}};module[_0x0827('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xd35e=['available','paused','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','whatsappPause'];(function(_0x27f7ff,_0x124a0a){var _0x211c7a=function(_0x23c8a4){while(--_0x23c8a4){_0x27f7ff['push'](_0x27f7ff['shift']());}};_0x211c7a(++_0x124a0a);}(_0xd35e,0x19c));var _0xed35=function(_0x2803ab,_0x1c33f2){_0x2803ab=_0x2803ab-0x0;var _0x3d6e8e=_0xd35e[_0x2803ab];return _0x3d6e8e;};'use strict';var _=require(_0xed35('0x0'));var md5=require(_0xed35('0x1'));var util=require(_0xed35('0x2'));var Redis=require(_0xed35('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xed35('0x4')](config[_0xed35('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x4ff012){this['id']=_0x4ff012['id']||0x0;this[_0xed35('0x6')]=_0x4ff012['name']||'';this[_0xed35('0x7')]=_0x4ff012[_0xed35('0x7')]||0xa;this['strategy']=_0x4ff012[_0xed35('0x8')]||_0xed35('0x9');this[_0xed35('0xa')]=_0x4ff012[_0xed35('0xa')];this[_0xed35('0xb')]={};this[_0xed35('0xc')]=0x0;this[_0xed35('0x1')]='';this[_0xed35('0xd')]();this[_0xed35('0xe')]();}WhatsappQueue[_0xed35('0xf')][_0xed35('0xd')]=function(){var _0x187a21=this[_0xed35('0xb')][_0xed35('0x10')];this[_0xed35('0xb')]=_['map'](this[_0xed35('0xa')],'id');this[_0xed35('0xb')][_0xed35('0x10')]=_0x187a21;};WhatsappQueue['prototype'][_0xed35('0xe')]=function(){this[_0xed35('0x11')]=0x0;this['paused']=0x0;for(var _0x49fa94=0x0;_0x49fa94=0x0?this['available']:0x0;var _0xd6bfd9={'id':this['id'],'available':this[_0xed35('0x14')],'loggedIn':this[_0xed35('0x11')],'name':this[_0xed35('0x6')],'paused':this[_0xed35('0x15')],'waiting':this[_0xed35('0xc')]};var _0x57d092=md5(JSON[_0xed35('0x16')](_0xd6bfd9));if(this[_0xed35('0x1')]!==_0x57d092){this[_0xed35('0x1')]=_0x57d092;io['to'](util[_0xed35('0x17')](_0xed35('0x18'),_0xd6bfd9[_0xed35('0x6')]))['emit'](_0xed35('0x19'),_0xd6bfd9);}};module[_0xed35('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index fa066f3..00d75d2 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7217[_0x56482c];return _0x5aae7a;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x15c4a1,_0x5b02dc){var _0x375746=function(_0x46d845){while(--_0x46d845){_0x15c4a1['push'](_0x15c4a1['shift']());}};_0x375746(++_0x5b02dc);}(_0x008c,0x188));var _0xc008=function(_0x30a6d6,_0x603c35){_0x30a6d6=_0x30a6d6-0x0;var _0x361ea1=_0x008c[_0x30a6d6];return _0x361ea1;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index c7ed2fe..7d9bc21 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 _0x1c6b=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x1c6b,0x76));var _0xb1c6=function(_0x5e38a4,_0x333514){_0x5e38a4=_0x5e38a4-0x0;var _0x401332=_0x1c6b[_0x5e38a4];return _0x401332;};'use strict';var client=require(_0xb1c6('0x0'));exports['update']=function(_0x5f4343,_0x583852){return client[_0xb1c6('0x1')](_0xb1c6('0x2'),{'body':_0x583852,'options':{'where':{'id':_0x5f4343}},'log':_0xb1c6('0x3')});};exports[_0xb1c6('0x4')]=function(_0x2aee32,_0x5cdf69){return client[_0xb1c6('0x1')](_0xb1c6('0x5'),{'body':_0x5cdf69,'options':{'where':{'id':_0x2aee32}},'log':_0xb1c6('0x6')});}; \ No newline at end of file +var _0xc979=['UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc979,0xab));var _0x9c97=function(_0x425dd1,_0x5c06ea){_0x425dd1=_0x425dd1-0x0;var _0x5af555=_0xc979[_0x425dd1];return _0x5af555;};'use strict';var client=require(_0x9c97('0x0'));exports[_0x9c97('0x1')]=function(_0x2249a6,_0x375542){return client[_0x9c97('0x2')](_0x9c97('0x3'),{'body':_0x375542,'options':{'where':{'id':_0x2249a6}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x5a24a5,_0x31e964){return client[_0x9c97('0x2')](_0x9c97('0x4'),{'body':_0x31e964,'options':{'where':{'id':_0x5a24a5}},'log':_0x9c97('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 080c54c..9ae7164 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 _0xcf84=['../client','CreateChatMessage','createChatMessage'];(function(_0x416840,_0x59a299){var _0x118276=function(_0x2cda8b){while(--_0x2cda8b){_0x416840['push'](_0x416840['shift']());}};_0x118276(++_0x59a299);}(_0xcf84,0x171));var _0x4cf8=function(_0x57c078,_0x3e1799){_0x57c078=_0x57c078-0x0;var _0x5f0e8e=_0xcf84[_0x57c078];return _0x5f0e8e;};'use strict';var client=require(_0x4cf8('0x0'));exports['create']=function(_0x27caea){return client['Request'](_0x4cf8('0x1'),{'body':_0x27caea,'log':_0x4cf8('0x2')});}; \ No newline at end of file +var _0xe83c=['Request','createChatMessage','../client','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe83c,0x76));var _0xce83=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0xe83c[_0x575057];return _0x49dbc8;};'use strict';var client=require(_0xce83('0x0'));exports[_0xce83('0x1')]=function(_0x2b38eb){return client[_0xce83('0x2')]('CreateChatMessage',{'body':_0x2b38eb,'log':_0xce83('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ca788a9..e2d01be 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 _0xd8cc=['GetChatQueue','name','timeout','strategy','Agents','chatPause','../client','getChatQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8cc,0xe6));var _0xcd8c=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xd8cc[_0x1f1e31];return _0x229b56;};'use strict';var client=require(_0xcd8c('0x0'));exports[_0xcd8c('0x1')]=function(){return function(){return client['Request'](_0xcd8c('0x2'),{'options':{'raw':![],'attributes':['id',_0xcd8c('0x3'),_0xcd8c('0x4'),_0xcd8c('0x5')],'include':[{'model':'User','as':_0xcd8c('0x6'),'attributes':['id',_0xcd8c('0x3'),'online',_0xcd8c('0x7')]}]},'log':_0xcd8c('0x1')});};}; \ No newline at end of file +var _0xf7a9=['name','online','../client','getChatQueues','Request','GetChatQueue','timeout','User','Agents'];(function(_0x3c6cdc,_0x4ae3a2){var _0x2214c1=function(_0x40a3b8){while(--_0x40a3b8){_0x3c6cdc['push'](_0x3c6cdc['shift']());}};_0x2214c1(++_0x4ae3a2);}(_0xf7a9,0x12b));var _0x9f7a=function(_0x4ba3ff,_0x1516c5){_0x4ba3ff=_0x4ba3ff-0x0;var _0x8bc3a8=_0xf7a9[_0x4ba3ff];return _0x8bc3a8;};'use strict';var client=require(_0x9f7a('0x0'));exports[_0x9f7a('0x1')]=function(){return function(){return client[_0x9f7a('0x2')](_0x9f7a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9f7a('0x4'),'strategy'],'include':[{'model':_0x9f7a('0x5'),'as':_0x9f7a('0x6'),'attributes':['id',_0x9f7a('0x7'),_0x9f7a('0x8'),'chatPause']}]},'log':_0x9f7a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7676f25..029ab1a 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 _0xf6c1=['update','UpdateChatQueueReport','DESC','Request','CreateChatQueueReport'];(function(_0x4103ba,_0x261f7d){var _0x25af60=function(_0x235419){while(--_0x235419){_0x4103ba['push'](_0x4103ba['shift']());}};_0x25af60(++_0x261f7d);}(_0xf6c1,0x99));var _0x1f6c=function(_0x292611,_0x5a7642){_0x292611=_0x292611-0x0;var _0x1c9388=_0xf6c1[_0x292611];return _0x1c9388;};'use strict';var client=require('../client');exports['create']=function(_0x14a784){return client[_0x1f6c('0x0')](_0x1f6c('0x1'),{'body':_0x14a784,'log':'CreateChatQueueReport'});};exports[_0x1f6c('0x2')]=function(_0x4f2a6f,_0x115493){return client[_0x1f6c('0x0')](_0x1f6c('0x3'),{'body':_0x115493,'options':{'where':{'uniqueid':_0x4f2a6f},'order':[['id',_0x1f6c('0x4')]],'limit':0x1},'log':_0x1f6c('0x3')});}; \ No newline at end of file +var _0x61df=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x61df,0xbd));var _0xf61d=function(_0x221f4f,_0x1060a1){_0x221f4f=_0x221f4f-0x0;var _0x4c4725=_0x61df[_0x221f4f];return _0x4c4725;};'use strict';var client=require('../client');exports['create']=function(_0x559316){return client[_0xf61d('0x0')](_0xf61d('0x1'),{'body':_0x559316,'log':'CreateChatQueueReport'});};exports[_0xf61d('0x2')]=function(_0x380f27,_0x485a55){return client[_0xf61d('0x0')](_0xf61d('0x3'),{'body':_0x485a55,'options':{'where':{'uniqueid':_0x380f27},'order':[['id',_0xf61d('0x4')]],'limit':0x1},'log':_0xf61d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 5c894ec..091c33b 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 _0x19ac=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client'];(function(_0x529dfc,_0x2a0033){var _0x1cf620=function(_0x5dceba){while(--_0x5dceba){_0x529dfc['push'](_0x529dfc['shift']());}};_0x1cf620(++_0x2a0033);}(_0x19ac,0x185));var _0xc19a=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x19ac[_0x1b6c6d];return _0x290d9d;};'use strict';var client=require(_0xc19a('0x0'));exports['update']=function(_0x6a457,_0x3a88a0){return client[_0xc19a('0x1')](_0xc19a('0x2'),{'body':_0x3a88a0,'options':{'where':{'id':_0x6a457}},'log':'updateFaxInteraction'});};exports[_0xc19a('0x3')]=function(_0x3befd2,_0x3b636e){return client[_0xc19a('0x1')](_0xc19a('0x4'),{'body':_0x3b636e,'options':{'where':{'id':_0x3befd2}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xeb13=['../client','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','addTagsToFaxInteraction'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0xeb13,0x84));var _0x3eb1=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0xeb13[_0x55d829];return _0x52163b;};'use strict';var client=require(_0x3eb1('0x0'));exports['update']=function(_0x28ac05,_0xe2b073){return client[_0x3eb1('0x1')](_0x3eb1('0x2'),{'body':_0xe2b073,'options':{'where':{'id':_0x28ac05}},'log':_0x3eb1('0x3')});};exports[_0x3eb1('0x4')]=function(_0x1bddbd,_0x374430){return client['Request']('AddTagsToFaxInteraction',{'body':_0x374430,'options':{'where':{'id':_0x1bddbd}},'log':_0x3eb1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 0b51607..1c0813a 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 _0x313d=['Request','../client'];(function(_0x182a0a,_0x204009){var _0x1d8309=function(_0x3b10c8){while(--_0x3b10c8){_0x182a0a['push'](_0x182a0a['shift']());}};_0x1d8309(++_0x204009);}(_0x313d,0xed));var _0xd313=function(_0xe22236,_0x3100e3){_0xe22236=_0xe22236-0x0;var _0x75f12c=_0x313d[_0xe22236];return _0x75f12c;};'use strict';var client=require(_0xd313('0x0'));exports['create']=function(_0x3629f3){return client[_0xd313('0x1')]('CreateFaxMessage',{'body':_0x3629f3,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xbc06=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x9369b3,_0xdb0875){var _0x13f9bb=function(_0x442447){while(--_0x442447){_0x9369b3['push'](_0x9369b3['shift']());}};_0x13f9bb(++_0xdb0875);}(_0xbc06,0x6b));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6bc0('0x0'));exports[_0x6bc0('0x1')]=function(_0x4ffdd4){return client[_0x6bc0('0x2')](_0x6bc0('0x3'),{'body':_0x4ffdd4,'log':_0x6bc0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9460f5e..066615e 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 _0xd3b9=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xd3b9,0x157));var _0x9d3b=function(_0x1ad02c,_0x30b041){_0x1ad02c=_0x1ad02c-0x0;var _0x15f833=_0xd3b9[_0x1ad02c];return _0x15f833;};'use strict';var client=require(_0x9d3b('0x0'));exports[_0x9d3b('0x1')]=function(){return function(){return client[_0x9d3b('0x2')](_0x9d3b('0x3'),{'options':{'raw':![],'attributes':['id',_0x9d3b('0x4'),_0x9d3b('0x5'),_0x9d3b('0x6')],'include':[{'model':_0x9d3b('0x7'),'as':_0x9d3b('0x8'),'attributes':['id',_0x9d3b('0x4'),_0x9d3b('0x9'),_0x9d3b('0xa')]}]},'log':_0x9d3b('0x1')});};}; \ No newline at end of file +var _0x960d=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x2bf35f,_0x49943f){var _0x54381=function(_0x435ae8){while(--_0x435ae8){_0x2bf35f['push'](_0x2bf35f['shift']());}};_0x54381(++_0x49943f);}(_0x960d,0x7d));var _0xd960=function(_0x47cb8c,_0xd2b94){_0x47cb8c=_0x47cb8c-0x0;var _0x1d0207=_0x960d[_0x47cb8c];return _0x1d0207;};'use strict';var client=require(_0xd960('0x0'));exports[_0xd960('0x1')]=function(){return function(){return client[_0xd960('0x2')](_0xd960('0x3'),{'options':{'raw':![],'attributes':['id',_0xd960('0x4'),'timeout',_0xd960('0x5')],'include':[{'model':_0xd960('0x6'),'as':_0xd960('0x7'),'attributes':['id','name',_0xd960('0x8'),_0xd960('0x9')]}]},'log':_0xd960('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 07cf4c6..6e55c23 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 _0x99a3=['DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x99a3,0x14b));var _0x399a=function(_0x3942da,_0x49b37b){_0x3942da=_0x3942da-0x0;var _0x4cfe1b=_0x99a3[_0x3942da];return _0x4cfe1b;};'use strict';var client=require(_0x399a('0x0'));exports[_0x399a('0x1')]=function(_0x37ac62){return client[_0x399a('0x2')]('CreateFaxQueueReport',{'body':_0x37ac62,'log':_0x399a('0x3')});};exports[_0x399a('0x4')]=function(_0x2e355f,_0x4bf134){return client[_0x399a('0x2')]('UpdateFaxQueueReport',{'body':_0x4bf134,'options':{'where':{'uniqueid':_0x2e355f},'order':[['id',_0x399a('0x5')]],'limit':0x1},'log':_0x399a('0x6')});}; \ No newline at end of file +var _0x4f6c=['create','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4f6c,0x176));var _0xc4f6=function(_0x402f69,_0x5a5652){_0x402f69=_0x402f69-0x0;var _0x1a0973=_0x4f6c[_0x402f69];return _0x1a0973;};'use strict';var client=require(_0xc4f6('0x0'));exports[_0xc4f6('0x1')]=function(_0xb73ad1){return client['Request'](_0xc4f6('0x2'),{'body':_0xb73ad1,'log':_0xc4f6('0x2')});};exports[_0xc4f6('0x3')]=function(_0x86bda5,_0x57d343){return client['Request'](_0xc4f6('0x4'),{'body':_0x57d343,'options':{'where':{'uniqueid':_0x86bda5},'order':[['id','DESC']],'limit':0x1},'log':_0xc4f6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6e1fefc..854741b 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 _0x02a7=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x02a7,0x1a6));var _0x702a=function(_0x2422df,_0x4cdac4){_0x2422df=_0x2422df-0x0;var _0x1695c6=_0x02a7[_0x2422df];return _0x1695c6;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x702a('0x3')],'include':[{'model':_0x702a('0x4'),'as':_0x702a('0x5'),'attributes':['id',_0x702a('0x3'),_0x702a('0x6')]}]},'log':_0x702a('0x0')});};}; \ No newline at end of file +var _0x236c=['name','Interval','Intervals','interval','getIntervals','../client','Request','GetInterval'];(function(_0x27461b,_0x2c9f29){var _0x4934da=function(_0x2ea2f4){while(--_0x2ea2f4){_0x27461b['push'](_0x27461b['shift']());}};_0x4934da(++_0x2c9f29);}(_0x236c,0x155));var _0xc236=function(_0x21185f,_0x272e12){_0x21185f=_0x21185f-0x0;var _0x12a3fe=_0x236c[_0x21185f];return _0x12a3fe;};'use strict';var client=require(_0xc236('0x0'));exports['getIntervals']=function(){return function(){return client[_0xc236('0x1')](_0xc236('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc236('0x3')],'include':[{'model':_0xc236('0x4'),'as':_0xc236('0x5'),'attributes':['id','name',_0xc236('0x6')]}]},'log':_0xc236('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 07ed8f9..2cd74dd 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 _0x4538=['addTags','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4538,0x134));var _0x8453=function(_0x1962f9,_0x3ebd65){_0x1962f9=_0x1962f9-0x0;var _0x129756=_0x4538[_0x1962f9];return _0x129756;};'use strict';var client=require('../client');exports[_0x8453('0x0')]=function(_0x262994,_0x539219){return client[_0x8453('0x1')](_0x8453('0x2'),{'body':_0x539219,'options':{'where':{'id':_0x262994}},'log':_0x8453('0x3')});};exports[_0x8453('0x4')]=function(_0x180401,_0x25f813){return client[_0x8453('0x1')]('AddTagsToMailInteraction',{'body':_0x25f813,'options':{'where':{'id':_0x180401}},'log':_0x8453('0x5')});}; \ No newline at end of file +var _0x1f90=['updateMailInteraction','Request','../client','UpdateMailInteraction'];(function(_0x51ddff,_0x18fb11){var _0xb53063=function(_0x5b2c33){while(--_0x5b2c33){_0x51ddff['push'](_0x51ddff['shift']());}};_0xb53063(++_0x18fb11);}(_0x1f90,0x192));var _0x01f9=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0x1f90[_0x212fcc];return _0x4d8190;};'use strict';var client=require(_0x01f9('0x0'));exports['update']=function(_0x5b634d,_0x4b8895){return client['Request'](_0x01f9('0x1'),{'body':_0x4b8895,'options':{'where':{'id':_0x5b634d}},'log':_0x01f9('0x2')});};exports['addTags']=function(_0x4eea59,_0x4e1974){return client[_0x01f9('0x3')]('AddTagsToMailInteraction',{'body':_0x4e1974,'options':{'where':{'id':_0x4eea59}},'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 43f7807..9f2e385 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 _0xa14a=['create','Request','createMailMessage','../client'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa14a,0x123));var _0xaa14=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa14a[_0x1beef3];return _0x5af964;};'use strict';var client=require(_0xaa14('0x0'));exports[_0xaa14('0x1')]=function(_0xf8fdc8){return client[_0xaa14('0x2')]('CreateMailMessage',{'body':_0xf8fdc8,'log':_0xaa14('0x3')});}; \ No newline at end of file +var _0x7411=['createMailMessage','../client','CreateMailMessage'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7411,0x9a));var _0x1741=function(_0x254959,_0x43c0a2){_0x254959=_0x254959-0x0;var _0x52d61d=_0x7411[_0x254959];return _0x52d61d;};'use strict';var client=require(_0x1741('0x0'));exports['create']=function(_0x1ab0de){return client['Request'](_0x1741('0x1'),{'body':_0x1ab0de,'log':_0x1741('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 830f511..275c1de 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 _0x04a1=['mailPause','getMailQueues','GetMailQueue','timeout','strategy','Agents','online'];(function(_0x45536b,_0x445dd1){var _0x20e63d=function(_0x420f79){while(--_0x420f79){_0x45536b['push'](_0x45536b['shift']());}};_0x20e63d(++_0x445dd1);}(_0x04a1,0x9b));var _0x104a=function(_0xd4fa7f,_0x141094){_0xd4fa7f=_0xd4fa7f-0x0;var _0x4c1cd3=_0x04a1[_0xd4fa7f];return _0x4c1cd3;};'use strict';var client=require('../client');exports[_0x104a('0x0')]=function(){return function(){return client['Request'](_0x104a('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x104a('0x2'),_0x104a('0x3')],'include':[{'model':'User','as':_0x104a('0x4'),'attributes':['id','name',_0x104a('0x5'),_0x104a('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x9c3a=['timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue','name'];(function(_0x22b6b4,_0x1f8e49){var _0x2ee634=function(_0x5c7f61){while(--_0x5c7f61){_0x22b6b4['push'](_0x22b6b4['shift']());}};_0x2ee634(++_0x1f8e49);}(_0x9c3a,0x178));var _0xa9c3=function(_0x73a72b,_0x4b36d1){_0x73a72b=_0x73a72b-0x0;var _0x24ca83=_0x9c3a[_0x73a72b];return _0x24ca83;};'use strict';var client=require(_0xa9c3('0x0'));exports[_0xa9c3('0x1')]=function(){return function(){return client['Request'](_0xa9c3('0x2'),{'options':{'raw':![],'attributes':['id',_0xa9c3('0x3'),_0xa9c3('0x4'),_0xa9c3('0x5')],'include':[{'model':_0xa9c3('0x6'),'as':_0xa9c3('0x7'),'attributes':['id',_0xa9c3('0x3'),_0xa9c3('0x8'),_0xa9c3('0x9')]}]},'log':_0xa9c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 413e3c9..ca8288d 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 _0x2905=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2905,0x108));var _0x5290=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2905[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x5290('0x0'));exports['create']=function(_0x536492){return client[_0x5290('0x1')](_0x5290('0x2'),{'body':_0x536492,'log':_0x5290('0x2')});};exports[_0x5290('0x3')]=function(_0x321fb0,_0x405a5b){return client[_0x5290('0x1')](_0x5290('0x4'),{'body':_0x405a5b,'options':{'where':{'uniqueid':_0x321fb0},'order':[['id','DESC']],'limit':0x1},'log':_0x5290('0x4')});}; \ No newline at end of file +var _0x245b=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x3ce73e,_0x40bf3c){var _0x446467=function(_0x1d2a74){while(--_0x1d2a74){_0x3ce73e['push'](_0x3ce73e['shift']());}};_0x446467(++_0x40bf3c);}(_0x245b,0x132));var _0xb245=function(_0x2e2389,_0x18c66c){_0x2e2389=_0x2e2389-0x0;var _0x463b52=_0x245b[_0x2e2389];return _0x463b52;};'use strict';var client=require(_0xb245('0x0'));exports[_0xb245('0x1')]=function(_0x1afbe6){return client[_0xb245('0x2')](_0xb245('0x3'),{'body':_0x1afbe6,'log':_0xb245('0x3')});};exports[_0xb245('0x4')]=function(_0x4d63b5,_0x1307c6){return client[_0xb245('0x2')](_0xb245('0x5'),{'body':_0x1307c6,'options':{'where':{'uniqueid':_0x4d63b5},'order':[['id',_0xb245('0x6')]],'limit':0x1},'log':_0xb245('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5b7a311..7d7dbca 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 _0xfff3=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x399d8b,_0x156706){var _0x30483d=function(_0x9262ba){while(--_0x9262ba){_0x399d8b['push'](_0x399d8b['shift']());}};_0x30483d(++_0x156706);}(_0xfff3,0xc1));var _0x3fff=function(_0x29b737,_0x4fa3d5){_0x29b737=_0x29b737-0x0;var _0x43e643=_0xfff3[_0x29b737];return _0x43e643;};'use strict';var client=require(_0x3fff('0x0'));exports[_0x3fff('0x1')]=function(_0x4c792d,_0xdfd9ef){return client['Request'](_0x3fff('0x2'),{'body':_0xdfd9ef,'options':{'where':{'id':_0x4c792d}},'log':_0x3fff('0x3')});};exports[_0x3fff('0x4')]=function(_0x25d72f,_0x9ae0fb){return client[_0x3fff('0x5')](_0x3fff('0x6'),{'body':_0x9ae0fb,'options':{'where':{'id':_0x25d72f}},'log':_0x3fff('0x7')});}; \ No newline at end of file +var _0x6f3e=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x3c7625,_0xbc82c){var _0x3be780=function(_0x3fa694){while(--_0x3fa694){_0x3c7625['push'](_0x3c7625['shift']());}};_0x3be780(++_0xbc82c);}(_0x6f3e,0xcf));var _0xe6f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f3e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe6f3('0x0'));exports[_0xe6f3('0x1')]=function(_0x29e0c0,_0x26725a){return client['Request'](_0xe6f3('0x2'),{'body':_0x26725a,'options':{'where':{'id':_0x29e0c0}},'log':_0xe6f3('0x3')});};exports[_0xe6f3('0x4')]=function(_0x5c5447,_0x34e531){return client[_0xe6f3('0x5')](_0xe6f3('0x6'),{'body':_0x34e531,'options':{'where':{'id':_0x5c5447}},'log':_0xe6f3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2d9d265..d756511 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 _0x0bb5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2717eb,_0x39ea39){var _0xc7342c=function(_0x251eb8){while(--_0x251eb8){_0x2717eb['push'](_0x2717eb['shift']());}};_0xc7342c(++_0x39ea39);}(_0x0bb5,0x148));var _0x50bb=function(_0xde73b3,_0x2c3aed){_0xde73b3=_0xde73b3-0x0;var _0xb05736=_0x0bb5[_0xde73b3];return _0xb05736;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(_0x5e61cf){return client['Request'](_0x50bb('0x2'),{'body':_0x5e61cf,'log':_0x50bb('0x3')});}; \ No newline at end of file +var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0x70e0,0x17b));var _0x070e=function(_0x5f520c,_0x5acf1a){_0x5f520c=_0x5f520c-0x0;var _0xe66556=_0x70e0[_0x5f520c];return _0xe66556;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 056066f..41ae117 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 _0x87c4=['strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x482381,_0x54aad7){var _0x43d707=function(_0x167b88){while(--_0x167b88){_0x482381['push'](_0x482381['shift']());}};_0x43d707(++_0x54aad7);}(_0x87c4,0x112));var _0x487c=function(_0xbc87a1,_0x136ac2){_0xbc87a1=_0xbc87a1-0x0;var _0x3f6208=_0x87c4[_0xbc87a1];return _0x3f6208;};'use strict';var client=require(_0x487c('0x0'));exports[_0x487c('0x1')]=function(){return function(){return client[_0x487c('0x2')](_0x487c('0x3'),{'options':{'raw':![],'attributes':['id',_0x487c('0x4'),_0x487c('0x5'),_0x487c('0x6')],'include':[{'model':'User','as':_0x487c('0x7'),'attributes':['id',_0x487c('0x4'),_0x487c('0x8'),_0x487c('0x9')]}]},'log':_0x487c('0x1')});};}; \ No newline at end of file +var _0xeafb=['User','name','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout'];(function(_0x475239,_0x480944){var _0x47034e=function(_0x1c2c00){while(--_0x1c2c00){_0x475239['push'](_0x475239['shift']());}};_0x47034e(++_0x480944);}(_0xeafb,0x10c));var _0xbeaf=function(_0x158a01,_0x50bcb8){_0x158a01=_0x158a01-0x0;var _0x94b215=_0xeafb[_0x158a01];return _0x94b215;};'use strict';var client=require(_0xbeaf('0x0'));exports[_0xbeaf('0x1')]=function(){return function(){return client['Request'](_0xbeaf('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbeaf('0x3'),'strategy'],'include':[{'model':_0xbeaf('0x4'),'as':'Agents','attributes':['id',_0xbeaf('0x5'),_0xbeaf('0x6'),_0xbeaf('0x7')]}]},'log':_0xbeaf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 453e429..6c890e1 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 _0x6685=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x4e6338,_0x362914){var _0x23393a=function(_0x38a68c){while(--_0x38a68c){_0x4e6338['push'](_0x4e6338['shift']());}};_0x23393a(++_0x362914);}(_0x6685,0x10a));var _0x5668=function(_0x44b138,_0x48d508){_0x44b138=_0x44b138-0x0;var _0x47094d=_0x6685[_0x44b138];return _0x47094d;};'use strict';var client=require(_0x5668('0x0'));exports[_0x5668('0x1')]=function(_0x9b2c6e){return client[_0x5668('0x2')](_0x5668('0x3'),{'body':_0x9b2c6e,'log':_0x5668('0x3')});};exports[_0x5668('0x4')]=function(_0x4ea3c4,_0x1e19fe){return client[_0x5668('0x2')](_0x5668('0x5'),{'body':_0x1e19fe,'options':{'where':{'uniqueid':_0x4ea3c4},'order':[['id',_0x5668('0x6')]],'limit':0x1},'log':_0x5668('0x5')});}; \ No newline at end of file +var _0xf57f=['DESC','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x55b99d,_0x264e3e){var _0x228c33=function(_0x5190d3){while(--_0x5190d3){_0x55b99d['push'](_0x55b99d['shift']());}};_0x228c33(++_0x264e3e);}(_0xf57f,0x103));var _0xff57=function(_0x18a577,_0x25560c){_0x18a577=_0x18a577-0x0;var _0x1cb0c7=_0xf57f[_0x18a577];return _0x1cb0c7;};'use strict';var client=require('../client');exports[_0xff57('0x0')]=function(_0x2316d9){return client[_0xff57('0x1')](_0xff57('0x2'),{'body':_0x2316d9,'log':_0xff57('0x2')});};exports[_0xff57('0x3')]=function(_0x45a1d5,_0x3ac543){return client[_0xff57('0x1')](_0xff57('0x4'),{'body':_0x3ac543,'options':{'where':{'uniqueid':_0x45a1d5},'order':[['id',_0xff57('0x5')]],'limit':0x1},'log':_0xff57('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index cf7c8ab..1ebdeb7 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 _0x1a44=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x1a44,0xc4));var _0x41a4=function(_0x26a558,_0x42580f){_0x26a558=_0x26a558-0x0;var _0x3a0220=_0x1a44[_0x26a558];return _0x3a0220;};'use strict';var client=require(_0x41a4('0x0'));exports['update']=function(_0x46c2e8,_0x4750b3){return client[_0x41a4('0x1')](_0x41a4('0x2'),{'body':_0x4750b3,'options':{'where':{'id':_0x46c2e8}},'log':_0x41a4('0x3')});};exports[_0x41a4('0x4')]=function(_0x397cb2,_0x529244){return client[_0x41a4('0x1')](_0x41a4('0x5'),{'body':_0x529244,'options':{'where':{'id':_0x397cb2}},'log':_0x41a4('0x6')});}; \ No newline at end of file +var _0xed63=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','UpdateSmsInteraction','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xed63,0x138));var _0x3ed6=function(_0x427ae7,_0x3ceb0e){_0x427ae7=_0x427ae7-0x0;var _0x42349f=_0xed63[_0x427ae7];return _0x42349f;};'use strict';var client=require(_0x3ed6('0x0'));exports['update']=function(_0x4fa32d,_0x7b80c9){return client['Request'](_0x3ed6('0x1'),{'body':_0x7b80c9,'options':{'where':{'id':_0x4fa32d}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x259e71,_0x5db0ee){return client[_0x3ed6('0x2')](_0x3ed6('0x3'),{'body':_0x5db0ee,'options':{'where':{'id':_0x259e71}},'log':_0x3ed6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 81d0bc9..2f30d76 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 _0xd625=['create','Request','CreateSmsMessage','../client'];(function(_0x584a03,_0x59e0c8){var _0x29d9c9=function(_0x27ea6f){while(--_0x27ea6f){_0x584a03['push'](_0x584a03['shift']());}};_0x29d9c9(++_0x59e0c8);}(_0xd625,0xbb));var _0x5d62=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd625[_0x376b45];return _0x2341b3;};'use strict';var client=require(_0x5d62('0x0'));exports[_0x5d62('0x1')]=function(_0x1257dd){return client[_0x5d62('0x2')](_0x5d62('0x3'),{'body':_0x1257dd,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x2c90=['CreateSmsMessage','../client'];(function(_0x3b19e6,_0x161a43){var _0x4537a2=function(_0x55cdc9){while(--_0x55cdc9){_0x3b19e6['push'](_0x3b19e6['shift']());}};_0x4537a2(++_0x161a43);}(_0x2c90,0xe5));var _0x02c9=function(_0x3b2639,_0x1bb334){_0x3b2639=_0x3b2639-0x0;var _0x82fb3f=_0x2c90[_0x3b2639];return _0x82fb3f;};'use strict';var client=require(_0x02c9('0x0'));exports['create']=function(_0x29cfba){return client['Request'](_0x02c9('0x1'),{'body':_0x29cfba,'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 d34af40..a23b2d4 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 _0x421f=['../client','getSmsQueues','Request','GetSmsQueue','name','timeout','online','smsPause'];(function(_0x245690,_0x3bf938){var _0x3fb9a4=function(_0x3354b3){while(--_0x3354b3){_0x245690['push'](_0x245690['shift']());}};_0x3fb9a4(++_0x3bf938);}(_0x421f,0x160));var _0xf421=function(_0x137d2f,_0x3b714c){_0x137d2f=_0x137d2f-0x0;var _0x21664a=_0x421f[_0x137d2f];return _0x21664a;};'use strict';var client=require(_0xf421('0x0'));exports[_0xf421('0x1')]=function(){return function(){return client[_0xf421('0x2')](_0xf421('0x3'),{'options':{'raw':![],'attributes':['id',_0xf421('0x4'),_0xf421('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf421('0x4'),_0xf421('0x6'),_0xf421('0x7')]}]},'log':_0xf421('0x1')});};}; \ No newline at end of file +var _0x8ece=['../client','getSmsQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x17d703,_0x2266eb){var _0x4fd652=function(_0x4147ad){while(--_0x4147ad){_0x17d703['push'](_0x17d703['shift']());}};_0x4fd652(++_0x2266eb);}(_0x8ece,0xbd));var _0xe8ec=function(_0x88beb7,_0x25c054){_0x88beb7=_0x88beb7-0x0;var _0x2ec8e8=_0x8ece[_0x88beb7];return _0x2ec8e8;};'use strict';var client=require(_0xe8ec('0x0'));exports[_0xe8ec('0x1')]=function(){return function(){return client[_0xe8ec('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xe8ec('0x3'),_0xe8ec('0x4'),_0xe8ec('0x5')],'include':[{'model':_0xe8ec('0x6'),'as':_0xe8ec('0x7'),'attributes':['id',_0xe8ec('0x3'),_0xe8ec('0x8'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7e90d05..85cacc9 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 _0x13be=['UpdateSmsQueueReport','create','CreateSmsQueueReport','update','Request','DESC'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x13be,0x175));var _0xe13b=function(_0x56aea5,_0x60ac09){_0x56aea5=_0x56aea5-0x0;var _0x320b38=_0x13be[_0x56aea5];return _0x320b38;};'use strict';var client=require('../client');exports[_0xe13b('0x0')]=function(_0x4d92d7){return client['Request'](_0xe13b('0x1'),{'body':_0x4d92d7,'log':_0xe13b('0x1')});};exports[_0xe13b('0x2')]=function(_0x45e71c,_0x443dac){return client[_0xe13b('0x3')]('UpdateSmsQueueReport',{'body':_0x443dac,'options':{'where':{'uniqueid':_0x45e71c},'order':[['id',_0xe13b('0x4')]],'limit':0x1},'log':_0xe13b('0x5')});}; \ No newline at end of file +var _0xf496=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1339d9,_0x3f91f2){var _0x154bdb=function(_0x31d495){while(--_0x31d495){_0x1339d9['push'](_0x1339d9['shift']());}};_0x154bdb(++_0x3f91f2);}(_0xf496,0x1c7));var _0x6f49=function(_0x508562,_0x127ed8){_0x508562=_0x508562-0x0;var _0x5a071b=_0xf496[_0x508562];return _0x5a071b;};'use strict';var client=require(_0x6f49('0x0'));exports[_0x6f49('0x1')]=function(_0x29eeda){return client[_0x6f49('0x2')](_0x6f49('0x3'),{'body':_0x29eeda,'log':'CreateSmsQueueReport'});};exports[_0x6f49('0x4')]=function(_0x25a384,_0x4fbce5){return client[_0x6f49('0x2')](_0x6f49('0x5'),{'body':_0x4fbce5,'options':{'where':{'uniqueid':_0x25a384},'order':[['id',_0x6f49('0x6')]],'limit':0x1},'log':_0x6f49('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4f0fdc8..3091e5e 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 _0x7d81=['online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d81,0x126));var _0x17d8=function(_0x148dff,_0x4d4a74){_0x148dff=_0x148dff-0x0;var _0x1019f5=_0x7d81[_0x148dff];return _0x1019f5;};'use strict';var client=require(_0x17d8('0x0'));exports[_0x17d8('0x1')]=function(){return function(){return client[_0x17d8('0x2')](_0x17d8('0x3'),{'options':{'raw':!![],'where':{'role':_0x17d8('0x4')},'attributes':['id',_0x17d8('0x5'),_0x17d8('0x6'),_0x17d8('0x7'),_0x17d8('0x8'),_0x17d8('0x9'),_0x17d8('0xa'),_0x17d8('0xb'),_0x17d8('0xc'),_0x17d8('0xd'),_0x17d8('0xe'),_0x17d8('0xf'),_0x17d8('0x10'),'mailCapacity',_0x17d8('0x11'),_0x17d8('0x12'),'whatsappCapacity',_0x17d8('0x13')]},'log':_0x17d8('0x1')});};}; \ No newline at end of file +var _0xb5bc=['mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','agent','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xb5bc,0xa2));var _0xcb5b=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xb5bc[_0x2e7f96];return _0x315277;};'use strict';var client=require(_0xcb5b('0x0'));exports[_0xcb5b('0x1')]=function(){return function(){return client[_0xcb5b('0x2')](_0xcb5b('0x3'),{'options':{'raw':!![],'where':{'role':_0xcb5b('0x4')},'attributes':['id','name','online',_0xcb5b('0x5'),_0xcb5b('0x6'),_0xcb5b('0x7'),_0xcb5b('0x8'),_0xcb5b('0x9'),_0xcb5b('0xa'),_0xcb5b('0xb'),_0xcb5b('0xc'),_0xcb5b('0xd'),_0xcb5b('0xe'),_0xcb5b('0xf'),_0xcb5b('0x10'),_0xcb5b('0x11'),_0xcb5b('0x12'),'openchannelCapacity']},'log':_0xcb5b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 364250c..8f65065 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 _0x3667=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags'];(function(_0x4dab58,_0x78bb16){var _0x552cec=function(_0x3f2611){while(--_0x3f2611){_0x4dab58['push'](_0x4dab58['shift']());}};_0x552cec(++_0x78bb16);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7366('0x0'));exports[_0x7366('0x1')]=function(_0x33dd4e,_0x1288c1){return client[_0x7366('0x2')]('UpdateWhatsappInteraction',{'body':_0x1288c1,'options':{'where':{'id':_0x33dd4e}},'log':_0x7366('0x3')});};exports[_0x7366('0x4')]=function(_0x4b32a7,_0x27726b){return client[_0x7366('0x2')](_0x7366('0x5'),{'body':_0x27726b,'options':{'where':{'id':_0x4b32a7}},'log':_0x7366('0x6')});}; \ No newline at end of file +var _0xfa2b=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x4c6e43,_0x5450fd){var _0xda9fe3=function(_0x115df5){while(--_0x115df5){_0x4c6e43['push'](_0x4c6e43['shift']());}};_0xda9fe3(++_0x5450fd);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x2c5fd1,_0x307b67){_0x2c5fd1=_0x2c5fd1-0x0;var _0x4f2274=_0xfa2b[_0x2c5fd1];return _0x4f2274;};'use strict';var client=require(_0xbfa2('0x0'));exports[_0xbfa2('0x1')]=function(_0x29f6cf,_0x9a9b55){return client[_0xbfa2('0x2')](_0xbfa2('0x3'),{'body':_0x9a9b55,'options':{'where':{'id':_0x29f6cf}},'log':_0xbfa2('0x4')});};exports[_0xbfa2('0x5')]=function(_0x116ab4,_0x43f8d9){return client[_0xbfa2('0x2')](_0xbfa2('0x6'),{'body':_0x43f8d9,'options':{'where':{'id':_0x116ab4}},'log':_0xbfa2('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 103c168..9b55327 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 _0x46a8=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x46a8,0x90));var _0x846a=function(_0x5e38e0,_0x1514b8){_0x5e38e0=_0x5e38e0-0x0;var _0x5b1c0b=_0x46a8[_0x5e38e0];return _0x5b1c0b;};'use strict';var client=require('../client');exports[_0x846a('0x0')]=function(_0xab0212){return client[_0x846a('0x1')](_0x846a('0x2'),{'body':_0xab0212,'log':_0x846a('0x3')});}; \ No newline at end of file +var _0x80e5=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x15fe66,_0x3622ea){var _0x52003e=function(_0x20257a){while(--_0x20257a){_0x15fe66['push'](_0x15fe66['shift']());}};_0x52003e(++_0x3622ea);}(_0x80e5,0xa1));var _0x580e=function(_0x349b5c,_0x55e5fa){_0x349b5c=_0x349b5c-0x0;var _0x3efcac=_0x80e5[_0x349b5c];return _0x3efcac;};'use strict';var client=require(_0x580e('0x0'));exports[_0x580e('0x1')]=function(_0xee145d){return client[_0x580e('0x2')](_0x580e('0x3'),{'body':_0xee145d,'log':_0x580e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 75b89d0..85a8e59 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 _0x93e6=['timeout','User','Agents','name','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue'];(function(_0x2f6cb4,_0xe0821){var _0x5b1b80=function(_0x32cc2a){while(--_0x32cc2a){_0x2f6cb4['push'](_0x2f6cb4['shift']());}};_0x5b1b80(++_0xe0821);}(_0x93e6,0x11e));var _0x693e=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x93e6[_0x2aecb2];return _0x3ebb80;};'use strict';var client=require(_0x693e('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x693e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x693e('0x2'),'strategy'],'include':[{'model':_0x693e('0x3'),'as':_0x693e('0x4'),'attributes':['id',_0x693e('0x5'),'online',_0x693e('0x6')]}]},'log':_0x693e('0x7')});};}; \ No newline at end of file +var _0x5ba3=['strategy','User','name','online','whatsappPause','../client','Request','GetWhatsappQueue','timeout'];(function(_0x4624b9,_0x19cfad){var _0x53d0fa=function(_0x148dc8){while(--_0x148dc8){_0x4624b9['push'](_0x4624b9['shift']());}};_0x53d0fa(++_0x19cfad);}(_0x5ba3,0x140));var _0x35ba=function(_0x48ecd3,_0x5e11f5){_0x48ecd3=_0x48ecd3-0x0;var _0x4643c9=_0x5ba3[_0x48ecd3];return _0x4643c9;};'use strict';var client=require(_0x35ba('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x35ba('0x1')](_0x35ba('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x35ba('0x3'),_0x35ba('0x4')],'include':[{'model':_0x35ba('0x5'),'as':'Agents','attributes':['id',_0x35ba('0x6'),_0x35ba('0x7'),_0x35ba('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index f4a6fe3..609dc43 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 _0x7bbd=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x4a311c,_0x5ea54b){var _0x3a4ef5=function(_0xd23bc9){while(--_0xd23bc9){_0x4a311c['push'](_0x4a311c['shift']());}};_0x3a4ef5(++_0x5ea54b);}(_0x7bbd,0x105));var _0xd7bb=function(_0x1aaa00,_0x448f7a){_0x1aaa00=_0x1aaa00-0x0;var _0x3b7cea=_0x7bbd[_0x1aaa00];return _0x3b7cea;};'use strict';var client=require(_0xd7bb('0x0'));exports['create']=function(_0x5f2343){return client[_0xd7bb('0x1')](_0xd7bb('0x2'),{'body':_0x5f2343,'log':_0xd7bb('0x2')});};exports[_0xd7bb('0x3')]=function(_0xdcb668,_0x3f4fcd){return client[_0xd7bb('0x1')](_0xd7bb('0x4'),{'body':_0x3f4fcd,'options':{'where':{'uniqueid':_0xdcb668},'order':[['id','DESC']],'limit':0x1},'log':_0xd7bb('0x4')});}; \ No newline at end of file +var _0x34ac=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x131dfc,_0x513ef2){var _0x4f56ff=function(_0x5d34aa){while(--_0x5d34aa){_0x131dfc['push'](_0x131dfc['shift']());}};_0x4f56ff(++_0x513ef2);}(_0x34ac,0xda));var _0xc34a=function(_0x33244e,_0x3d66cf){_0x33244e=_0x33244e-0x0;var _0x377ca5=_0x34ac[_0x33244e];return _0x377ca5;};'use strict';var client=require(_0xc34a('0x0'));exports[_0xc34a('0x1')]=function(_0x5b22b6){return client[_0xc34a('0x2')]('CreateWhatsappQueueReport',{'body':_0x5b22b6,'log':_0xc34a('0x3')});};exports[_0xc34a('0x4')]=function(_0xb23bd8,_0x2433cd){return client[_0xc34a('0x2')](_0xc34a('0x5'),{'body':_0x2433cd,'options':{'where':{'uniqueid':_0xb23bd8},'order':[['id',_0xc34a('0x6')]],'limit':0x1},'log':_0xc34a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 5063104..d30af09 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 _0x9db3=['[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','agent','error','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','length'];(function(_0x4cc47f,_0x4cb0b1){var _0xdd747e=function(_0x1a6e57){while(--_0x1a6e57){_0x4cc47f['push'](_0x4cc47f['shift']());}};_0xdd747e(++_0x4cb0b1);}(_0x9db3,0x194));var _0x39db=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9db3[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x39db('0x0'));var _=require(_0x39db('0x1'));var util=require(_0x39db('0x2'));var seqqueue=require(_0x39db('0x3'));var logger=require(_0x39db('0x4'))(_0x39db('0x5'));var strategy=require(_0x39db('0x6'));var queue=schema({'name':{'type':_0x39db('0x7'),'required':!![],'message':_0x39db('0x8')},'timeout':{'type':_0x39db('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x12e799,_0x324bcb,_0x178dd7){return logger[_0x39db('0xa')](util[_0x39db('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x12e799,_0x324bcb[_0x39db('0xc')],_0x178dd7));}function handleFindAgent(_0x34f5fa){return function(_0x1fc672){return _0x1fc672[_0x39db('0xc')][_0x39db('0xd')]()===_0x34f5fa[_0x39db('0xd')]();};}exports[_0x39db('0xe')]=function(_0x26ba81,_0x4da079,_0x2192d0,_0x3e8fc3){return function(_0x4af0cd){try{var _0x1a794c={'name':_0x4da079[0x0],'timeout':_0x4da079[0x1]};var _0x57f729=queue[_0x39db('0x0')](_0x1a794c,{'typecast':!![]});if(_0x57f729[_0x39db('0xf')]){logger['error'](_0x39db('0x10'),_0x26ba81,_[_0x39db('0x11')](_0x57f729,_0x39db('0x12'))['join'](',\x20'));_0x4af0cd[_0x39db('0x13')]();}else{var _0x31bb7e=_[_0x39db('0x14')](_0x2192d0[_0x39db('0x15')],handleFindAgent(_0x1a794c[_0x39db('0xc')]));if(_0x31bb7e){var _0x2ca75d=(_0x1a794c[_0x39db('0x16')]||0xa)*0x3e8;var _0x4a34f5,_0x2e3d98;var _0x471e2b=seqqueue['createQueue'](_0x2ca75d);_0x471e2b['id']=_0x26ba81;_0x471e2b[_0x39db('0x17')]=_0x2ca75d;_0x471e2b[_0x39db('0x18')]=_0x3e8fc3['channel'];writeLog(_0x26ba81,_0x31bb7e,util[_0x39db('0xb')]('START:%s',_0x2ca75d));_0x2192d0[_0x39db('0x19')][_0x26ba81]['on'](_0x39db('0x1a'),function(){logger['info'](_0x39db('0x1b'),_0x26ba81);clearTimeout(_0x2e3d98);_0x2e3d98=undefined;_0x471e2b['close']();if(_0x2192d0[_0x39db('0x19')][_0x26ba81]){delete _0x2192d0[_0x39db('0x19')][_0x26ba81];}_0x4af0cd['stop']();});_0x2192d0[_0x39db('0x19')][_0x26ba81]['on']('complete',function(){if(_0x2192d0['rules'][_0x26ba81]){delete _0x2192d0[_0x39db('0x19')][_0x26ba81];}});_0x2e3d98=setTimeout(function(){logger['info'](_0x39db('0x1c'),_0x26ba81);clearTimeout(_0x2e3d98);_0x471e2b[_0x39db('0x1d')]();_0x4af0cd['next']();},_0x2ca75d);strategy[_0x39db('0x1e')](_0x471e2b,_0x31bb7e,_0x2192d0,_0x3e8fc3);}else{logger[_0x39db('0x1f')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x26ba81,_0x1a794c['name']);_0x4af0cd[_0x39db('0x13')]();}}}catch(_0x23cc73){console[_0x39db('0x20')](_0x23cc73);logger[_0x39db('0x1f')](_0x39db('0x21'),_0x26ba81,_0x23cc73[_0x39db('0x22')]);_0x4af0cd[_0x39db('0x13')]();}};}; \ No newline at end of file +var _0xd1ce=['channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','./strategy','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0xd1ce,0x123));var _0xed1c=function(_0x36f3c1,_0x3e1bd6){_0x36f3c1=_0x36f3c1-0x0;var _0x14f86a=_0xd1ce[_0x36f3c1];return _0x14f86a;};'use strict';var schema=require(_0xed1c('0x0'));var _=require(_0xed1c('0x1'));var util=require(_0xed1c('0x2'));var seqqueue=require(_0xed1c('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xed1c('0x4'));var queue=schema({'name':{'type':_0xed1c('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xed1c('0x6')}});function writeLog(_0x378508,_0x254e94,_0x3f85c6){return logger[_0xed1c('0x7')](util[_0xed1c('0x8')](_0xed1c('0x9'),_0x378508,_0x254e94[_0xed1c('0xa')],_0x3f85c6));}function handleFindAgent(_0x399c5c){return function(_0x3283a1){return _0x3283a1[_0xed1c('0xa')][_0xed1c('0xb')]()===_0x399c5c[_0xed1c('0xb')]();};}exports['consequence']=function(_0x131d64,_0x3232ac,_0xd95d6d,_0x4e9d90){return function(_0x13873d){try{var _0x299d3a={'name':_0x3232ac[0x0],'timeout':_0x3232ac[0x1]};var _0x132116=queue[_0xed1c('0x0')](_0x299d3a,{'typecast':!![]});if(_0x132116[_0xed1c('0xc')]){logger[_0xed1c('0xd')](_0xed1c('0xe'),_0x131d64,_[_0xed1c('0xf')](_0x132116,_0xed1c('0x10'))[_0xed1c('0x11')](',\x20'));_0x13873d[_0xed1c('0x12')]();}else{var _0x54c5da=_[_0xed1c('0x13')](_0xd95d6d[_0xed1c('0x14')],handleFindAgent(_0x299d3a[_0xed1c('0xa')]));if(_0x54c5da){var _0x1ff621=(_0x299d3a[_0xed1c('0x15')]||0xa)*0x3e8;var _0x3a793d,_0xeab41a;var _0x11a0dd=seqqueue[_0xed1c('0x16')](_0x1ff621);_0x11a0dd['id']=_0x131d64;_0x11a0dd[_0xed1c('0x17')]=_0x1ff621;_0x11a0dd[_0xed1c('0x18')]=_0x4e9d90[_0xed1c('0x18')];writeLog(_0x131d64,_0x54c5da,util['format'](_0xed1c('0x19'),_0x1ff621));_0xd95d6d[_0xed1c('0x1a')][_0x131d64]['on'](_0xed1c('0x1b'),function(){logger['info'](_0xed1c('0x1c'),_0x131d64);clearTimeout(_0xeab41a);_0xeab41a=undefined;_0x11a0dd[_0xed1c('0x1d')]();if(_0xd95d6d['rules'][_0x131d64]){delete _0xd95d6d[_0xed1c('0x1a')][_0x131d64];}_0x13873d[_0xed1c('0x12')]();});_0xd95d6d['rules'][_0x131d64]['on'](_0xed1c('0x1e'),function(){if(_0xd95d6d[_0xed1c('0x1a')][_0x131d64]){delete _0xd95d6d[_0xed1c('0x1a')][_0x131d64];}});_0xeab41a=setTimeout(function(){logger[_0xed1c('0x7')](_0xed1c('0x1f'),_0x131d64);clearTimeout(_0xeab41a);_0x11a0dd['close']();_0x13873d['next']();},_0x1ff621);strategy['agent'](_0x11a0dd,_0x54c5da,_0xd95d6d,_0x4e9d90);}else{logger[_0xed1c('0xd')](_0xed1c('0x20'),_0x131d64,_0x299d3a[_0xed1c('0xa')]);_0x13873d[_0xed1c('0x12')]();}}}catch(_0x1104f9){console[_0xed1c('0x21')](_0x1104f9);logger[_0xed1c('0xd')](_0xed1c('0x22'),_0x131d64,_0x1104f9['stack']);_0x13873d[_0xed1c('0x12')]();}};}; \ 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 a8799ec..8d41941 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 _0x814b=['Message','create','then','stringify','stop','message','toString','postText','error','amazonlex','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender'];(function(_0x2ad63e,_0x471b18){var _0xbd8942=function(_0x4b312c){while(--_0x4b312c){_0x2ad63e['push'](_0x2ad63e['shift']());}};_0xbd8942(++_0x471b18);}(_0x814b,0x1a2));var _0xb814=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0x814b[_0x324e86];return _0x592846;};'use strict';var _=require(_0xb814('0x0'));var moment=require(_0xb814('0x1'));var AWS=require(_0xb814('0x2'));var utils=require(_0xb814('0x3'));var logger=require(_0xb814('0x4'))(_0xb814('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb814('0x6')),'mailMessage':require(_0xb814('0x7')),'smsMessage':require(_0xb814('0x8')),'faxMessage':require(_0xb814('0x9')),'whatsappMessage':require(_0xb814('0xa'))};exports[_0xb814('0xb')]=function(_0x53e507,_0x3b0829){return function(_0x2e6272){try{if(!_['isNil'](this[_0xb814('0xc')][_0xb814('0xd')])){logger[_0xb814('0xe')](_0xb814('0xf'),_0x53e507,_0xb814('0x10'));return _0x2e6272[_0xb814('0x11')]();}var _0x1086f8={'ContactId':this[_0xb814('0x12')]['id'],'sentAt':moment()[_0xb814('0x13')](_0xb814('0x14')),'direction':_0xb814('0x15')};var _0x4b5f14=this[_0xb814('0x16')];if(_0x4b5f14==='chat'){_0x1086f8[_0xb814('0x17')]=this[_0xb814('0x18')]['id'];}else{_0x1086f8[_[_0xb814('0x19')](_0x4b5f14)+_0xb814('0x1a')]=this[_0xb814('0x18')]['id'];}_0x1086f8[_[_0xb814('0x19')](_0x4b5f14)+_0xb814('0x1b')]=this[_0xb814('0xc')]['id'];if(this[_0xb814('0xc')][_0xb814('0x1c')]){var _0x3f4881=_0x3b0829[0x4];if(!_[_0xb814('0x1d')](_0x3f4881)){_0x1086f8[_0xb814('0x1e')]=utils[_0xb814('0x1f')](_0x3f4881,this);return rpc[_0x4b5f14+_0xb814('0x20')][_0xb814('0x21')](_0x1086f8)[_0xb814('0x22')](function(_0x265a83){logger[_0xb814('0xe')](_0xb814('0xf'),_0x53e507,_0x1086f8[_0xb814('0x1e')]);})['catch'](function(_0x168a48){logger['error'](_0xb814('0xf'),_0x53e507,JSON[_0xb814('0x23')](_0x168a48));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x53e507);_0x2e6272[_0xb814('0x24')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x53e507);_0x2e6272[_0xb814('0x24')]();}}else{var _0x24211d=this;var _0x25b6b6=new AWS['LexRuntime']({'accessKeyId':_0x3b0829[0x0],'secretAccessKey':_0x3b0829[0x1],'region':_0x3b0829[0x2]});var _0xf5b8aa={'botAlias':'$LATEST','botName':_0x3b0829[0x3],'inputText':this[_0xb814('0x25')][_0xb814('0x1e')],'userId':this[_0xb814('0x16')]+':'+this[_0xb814('0xc')]['id'][_0xb814('0x26')]()};_0x25b6b6[_0xb814('0x27')](_0xf5b8aa,function(_0x1f5d40,_0x594470){if(_0x1f5d40){logger[_0xb814('0x28')]('[%s][AMAZONLEX]\x20%s',_0x53e507,_0x1f5d40[_0xb814('0x25')]);_0x2e6272[_0xb814('0x11')]();}else if(_0x594470&&_0x594470[_0xb814('0x25')]){_0x24211d[_0xb814('0x1e')][_0xb814('0x29')]=_0x594470;_0x1086f8[_0xb814('0x1e')]=_0x594470[_0xb814('0x25')];return rpc[_0x4b5f14+'Message'][_0xb814('0x21')](_0x1086f8)[_0xb814('0x22')](function(_0x1c2625){logger[_0xb814('0xe')](_0xb814('0xf'),_0x53e507,_0x1086f8[_0xb814('0x1e')]);if(_0x594470[_0xb814('0x2a')]==_0xb814('0x2b')){_0x2e6272['next']();}else{_0x2e6272[_0xb814('0x24')]();}})[_0xb814('0x2c')](function(_0x52ed64){logger[_0xb814('0x28')](_0xb814('0xf'),_0x53e507,JSON[_0xb814('0x23')](_0x52ed64));_0x2e6272['next']();});}else{_0x2e6272[_0xb814('0x11')]();}});}}catch(_0x2051d0){logger['error'](_0xb814('0xf'),_0x53e507,JSON['stringify'](_0x2051d0));_0x2e6272[_0xb814('0x24')]();}};}; \ No newline at end of file +var _0xdc97=['lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','dialogState','Failed','next'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1c8284,_0x18401d){_0x1c8284=_0x1c8284-0x0;var _0x5764b9=_0xdc97[_0x1c8284];return _0x5764b9;};'use strict';var _=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var AWS=require(_0x7dc9('0x2'));var utils=require('./utils');var logger=require(_0x7dc9('0x3'))('routing');var rpc={'chatMessage':require(_0x7dc9('0x4')),'openchannelMessage':require(_0x7dc9('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7dc9('0x6')),'faxMessage':require(_0x7dc9('0x7')),'whatsappMessage':require(_0x7dc9('0x8'))};exports[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return function(_0x4f91c7){try{if(!_['isNil'](this[_0x7dc9('0xa')][_0x7dc9('0xb')])){logger[_0x7dc9('0xc')](_0x7dc9('0xd'),_0x589f02,_0x7dc9('0xe'));return _0x4f91c7['next']();}var _0xb2fa2a={'ContactId':this[_0x7dc9('0xf')]['id'],'sentAt':moment()[_0x7dc9('0x10')](_0x7dc9('0x11')),'direction':_0x7dc9('0x12')};var _0x3c2af5=this[_0x7dc9('0x13')];if(_0x3c2af5==='chat'){_0xb2fa2a['ChatWebsiteId']=this['account']['id'];}else{_0xb2fa2a[_['upperFirst'](_0x3c2af5)+_0x7dc9('0x14')]=this[_0x7dc9('0x15')]['id'];}_0xb2fa2a[_['upperFirst'](_0x3c2af5)+_0x7dc9('0x16')]=this[_0x7dc9('0xa')]['id'];if(this[_0x7dc9('0xa')][_0x7dc9('0x17')]){var _0x31d43d=_0x2636ef[0x4];if(!_[_0x7dc9('0x18')](_0x31d43d)){_0xb2fa2a['body']=utils[_0x7dc9('0x19')](_0x31d43d,this);return rpc[_0x3c2af5+_0x7dc9('0x1a')][_0x7dc9('0x1b')](_0xb2fa2a)[_0x7dc9('0x1c')](function(_0x11606f){logger[_0x7dc9('0xc')](_0x7dc9('0xd'),_0x589f02,_0xb2fa2a[_0x7dc9('0x1d')]);})[_0x7dc9('0x1e')](function(_0x5a6e04){logger[_0x7dc9('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x589f02,JSON[_0x7dc9('0x20')](_0x5a6e04));})[_0x7dc9('0x21')](function(){logger['info'](_0x7dc9('0x22'),_0x589f02);_0x4f91c7[_0x7dc9('0x23')]();});}else{logger[_0x7dc9('0xc')](_0x7dc9('0x24'),_0x589f02);_0x4f91c7[_0x7dc9('0x23')]();}}else{var _0x184bfd=this;var _0x2dad65=new AWS[(_0x7dc9('0x25'))]({'accessKeyId':_0x2636ef[0x0],'secretAccessKey':_0x2636ef[0x1],'region':_0x2636ef[0x2]});var _0x155cc4={'botAlias':_0x7dc9('0x26'),'botName':_0x2636ef[0x3],'inputText':this['message']['body'],'userId':this[_0x7dc9('0x13')]+':'+this[_0x7dc9('0xa')]['id']['toString']()};_0x2dad65[_0x7dc9('0x27')](_0x155cc4,function(_0x27f7fa,_0x5e9525){if(_0x27f7fa){logger[_0x7dc9('0x1f')](_0x7dc9('0xd'),_0x589f02,_0x27f7fa[_0x7dc9('0x28')]);_0x4f91c7['next']();}else if(_0x5e9525&&_0x5e9525[_0x7dc9('0x28')]){_0x184bfd[_0x7dc9('0x1d')][_0x7dc9('0x29')]=_0x5e9525;_0xb2fa2a['body']=_0x5e9525['message'];return rpc[_0x3c2af5+'Message'][_0x7dc9('0x1b')](_0xb2fa2a)[_0x7dc9('0x1c')](function(_0x5843bf){logger['info'](_0x7dc9('0xd'),_0x589f02,_0xb2fa2a['body']);if(_0x5e9525[_0x7dc9('0x2a')]==_0x7dc9('0x2b')){_0x4f91c7[_0x7dc9('0x2c')]();}else{_0x4f91c7[_0x7dc9('0x23')]();}})[_0x7dc9('0x1e')](function(_0x450124){logger[_0x7dc9('0x1f')](_0x7dc9('0xd'),_0x589f02,JSON[_0x7dc9('0x20')](_0x450124));_0x4f91c7[_0x7dc9('0x2c')]();});}else{_0x4f91c7[_0x7dc9('0x2c')]();}});}}catch(_0x2a456c){logger['error']('[%s][AMAZONLEX]\x20%s',_0x589f02,JSON['stringify'](_0x2a456c));_0x4f91c7['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 74bed64..a987d04 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 _0x99b1=['format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','','replace','';return mailRpc[_0x199b('0x32')](_0x346f79,_0x22faa4)['then'](function(_0x21bde1){logger[_0x199b('0xd')](_0x199b('0x33'),_0xa84792);_0x22faa4['messageId']=_0x21bde1['message']['messageId'];return rpc[_0x34b98f+_0x199b('0x22')][_0x199b('0x34')](_0x22faa4);})[_0x199b('0x35')](function(_0x556bdb){logger['info']('[%s][AUTOREPLY]\x20%s',_0xa84792,JSON[_0x199b('0x36')](_0x556bdb));})[_0x199b('0x37')](function(_0x21a193){logger[_0x199b('0x38')](_0x199b('0x39'),_0xa84792,JSON[_0x199b('0x36')](_0x21a193));})['finally'](function(){_0x37dc77[_0x199b('0x3a')]();});}else{return rpc[this[_0x199b('0xf')]+'Message']['create'](_0x22faa4)[_0x199b('0x35')](function(_0x67f72f){logger[_0x199b('0xd')](_0x199b('0x3b'),_0xa84792,_0x22faa4[_0x199b('0x3c')]);})['catch'](function(_0x448c61){logger['error'](_0x199b('0x3b'),_0xa84792,JSON[_0x199b('0x36')](_0x448c61));})[_0x199b('0x3d')](function(){_0x37dc77[_0x199b('0x3a')]();});}}}catch(_0xb0fb0){logger[_0x199b('0x38')](_0x199b('0x3b'),_0xa84792,JSON[_0x199b('0x36')](_0xb0fb0));_0x37dc77[_0x199b('0x3e')]();}};}; \ No newline at end of file +var _0x556c=['read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','InteractionId','mail','Smtp','service','host','secure','authentication','auth','pass','inReplyTo','messageId','html','','replace','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','create','body','error','[%s][AUTOREPLY]\x20%s','stop','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','next','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x556c,0x18d));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc556('0x0'));var moment=require(_0xc556('0x1'));var utils=require('./utils');var logger=require(_0xc556('0x2'))('routing');var rpc={'chatMessage':require(_0xc556('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc556('0x4')),'smsMessage':require(_0xc556('0x5')),'faxMessage':require(_0xc556('0x6')),'whatsappMessage':require(_0xc556('0x7'))};var mailRpc=require('../../mailRpc');exports[_0xc556('0x8')]=function(_0x3b713c,_0x3d6eac){return function(_0x5a9b4b){try{if(_0x3d6eac[0x0]==='1'&&(_[_0xc556('0x9')](this[_0xc556('0xa')][_0xc556('0xb')])||!this[_0xc556('0xa')]['created'])){logger[_0xc556('0xc')]('[%s][AUTOREPLY]\x20%s',_0x3b713c,'Autoreply\x20already\x20sent');return _0x5a9b4b[_0xc556('0xd')]();}var _0x4b72af=this[_0xc556('0xe')];var _0x352479={'body':utils[_0xc556('0xf')](_0x3d6eac[0x1],this),'ContactId':this[_0xc556('0x10')]['id'],'sentAt':moment()[_0xc556('0x11')](_0xc556('0x12')),'direction':_0xc556('0x13')};if(this[_0xc556('0x14')]){_0x352479['to']=this[_0xc556('0x14')]['from']||'';_0x352479['cc']=this[_0xc556('0x14')]['cc']||'';_0x352479[_0xc556('0x15')]=this['message']['to']||'';_0x352479[_0xc556('0x16')]=this[_0xc556('0x14')][_0xc556('0x16')]||'';_0x352479[_0xc556('0x17')]=!![];if(this[_0xc556('0x14')]['subject']){_0x352479[_0xc556('0x18')]='';_0x352479[_0xc556('0x18')]+=_[_0xc556('0x19')](this[_0xc556('0x14')][_0xc556('0x18')],_0xc556('0x1a'))?'':_0xc556('0x1b');_0x352479[_0xc556('0x18')]+=this[_0xc556('0x14')][_0xc556('0x18')];}}if(this[_0xc556('0xe')]===_0xc556('0x1c')){_0x352479['ChatWebsiteId']=this[_0xc556('0x1d')]['id'];}else{_0x352479[_[_0xc556('0x1e')](this['channel'])+'AccountId']=this['account']['id'];}_0x352479[_['upperFirst'](this[_0xc556('0xe')])+_0xc556('0x1f')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){if(this[_0xc556('0xe')]===_0xc556('0x20')){var _0x1f70c={'tls':{'rejectUnauthorized':![]}};if(this[_0xc556('0x1d')][_0xc556('0x21')][_0xc556('0x22')]){_0x1f70c['service']=this[_0xc556('0x1d')]['Smtp'][_0xc556('0x22')];}else{_0x1f70c[_0xc556('0x23')]=this['account'][_0xc556('0x21')][_0xc556('0x23')];_0x1f70c['port']=this[_0xc556('0x1d')][_0xc556('0x21')]['port'];_0x1f70c[_0xc556('0x24')]=this['account'][_0xc556('0x21')][_0xc556('0x24')];}if(this['account'][_0xc556('0x21')][_0xc556('0x25')]){_0x1f70c[_0xc556('0x26')]={'user':this[_0xc556('0x1d')][_0xc556('0x21')]['user'],'pass':this[_0xc556('0x1d')][_0xc556('0x21')][_0xc556('0x27')]};}_0x352479[_0xc556('0x28')]=this['message'][_0xc556('0x29')];_0x352479[_0xc556('0x2a')]=_0xc556('0x2b')+_[_0xc556('0x2c')](_0x352479['body'],']+(>|$)/g,''),'priorityTrue':_0x95fa40[0x1],'priorityFalse':_0x95fa40[0x2]};var _0x15da1a=gotoif[_0x0e68('0x0')](_0x49ad76,{'typecast':!![]});if(_0x15da1a['length']){logger[_0x0e68('0xc')](_0x0e68('0xd'),_0x3327b8,_[_0x0e68('0xe')](_0x15da1a,_0x0e68('0xf'))[_0x0e68('0x10')](',\x20'));_0x288db3[_0x0e68('0x11')]();}else{try{var _0x22c0d7=eval('('+_0x49ad76[_0x0e68('0x12')]+')');var _0x30152=_0x22c0d7?_0x49ad76[_0x0e68('0x13')]:_0x49ad76[_0x0e68('0x14')];logger[_0x0e68('0x15')](_0x0e68('0x16'),_0x3327b8,_0x49ad76[_0x0e68('0x12')],_0x22c0d7,_0x30152||_0x0e68('0x17'));if(_0x30152){var _0x1cbeb6=_[_0x0e68('0x18')](_0x288db3[_0x0e68('0x19')](),{'p':_0x30152});if(_0x1cbeb6>=0x0){logger['info'](_0x0e68('0x1a'),_0x3327b8,_0x30152||_0x0e68('0x17'),_0x1cbeb6);_0x288db3[_0x0e68('0x17')](_0x1cbeb6);}else{logger[_0x0e68('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3327b8,_0x30152||'next');_0x288db3[_0x0e68('0x11')]();}}else{_0x288db3[_0x0e68('0x17')]();}}catch(_0x582863){logger[_0x0e68('0xc')](_0x0e68('0x1b'),_0x3327b8,_0x582863[_0x0e68('0xf')]);_0x288db3['stop']();}}}catch(_0x571d53){logger[_0x0e68('0xc')]('[%s][GOTOIF]\x20%s',_0x3327b8,JSON['stringify'](_0x571d53));_0x288db3['stop']();}};}; \ No newline at end of file +var _0x1236=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x473c03,_0x19c7b1){var _0x4e3990=function(_0x240547){while(--_0x240547){_0x473c03['push'](_0x473c03['shift']());}};_0x4e3990(++_0x19c7b1);}(_0x1236,0xd4));var _0x6123=function(_0x4a6c7f,_0x5f1bc5){_0x4a6c7f=_0x4a6c7f-0x0;var _0x36362e=_0x1236[_0x4a6c7f];return _0x36362e;};'use strict';var schema=require(_0x6123('0x0'));var _=require(_0x6123('0x1'));var htmlToText=require(_0x6123('0x2'));var utils=require(_0x6123('0x3'));var logger=require('../../../../config/logger')(_0x6123('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x6123('0x5')},'priorityTrue':{'type':'number','message':_0x6123('0x6')},'priorityFalse':{'type':_0x6123('0x7'),'message':_0x6123('0x8')}});exports[_0x6123('0x9')]=function(_0x1fd71b,_0x660669){return function(_0x3d4f3a){try{var _0x44641e={'condition':htmlToText['fromString'](utils[_0x6123('0xa')](_0x660669[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x660669[0x1],'priorityFalse':_0x660669[0x2]};var _0x22267b=gotoif[_0x6123('0x0')](_0x44641e,{'typecast':!![]});if(_0x22267b[_0x6123('0xb')]){logger['error'](_0x6123('0xc'),_0x1fd71b,_['map'](_0x22267b,_0x6123('0xd'))[_0x6123('0xe')](',\x20'));_0x3d4f3a[_0x6123('0xf')]();}else{try{var _0x538237=eval('('+_0x44641e[_0x6123('0x10')]+')');var _0x598c48=_0x538237?_0x44641e['priorityTrue']:_0x44641e['priorityFalse'];logger[_0x6123('0x11')](_0x6123('0x12'),_0x1fd71b,_0x44641e['condition'],_0x538237,_0x598c48||_0x6123('0x13'));if(_0x598c48){var _0x4cc972=_[_0x6123('0x14')](_0x3d4f3a[_0x6123('0x15')](),{'p':_0x598c48});if(_0x4cc972>=0x0){logger[_0x6123('0x11')](_0x6123('0x16'),_0x1fd71b,_0x598c48||_0x6123('0x13'),_0x4cc972);_0x3d4f3a[_0x6123('0x13')](_0x4cc972);}else{logger[_0x6123('0x11')](_0x6123('0x17'),_0x1fd71b,_0x598c48||_0x6123('0x13'));_0x3d4f3a[_0x6123('0xf')]();}}else{_0x3d4f3a[_0x6123('0x13')]();}}catch(_0x30608c){logger[_0x6123('0x18')](_0x6123('0x19'),_0x1fd71b,_0x30608c[_0x6123('0xd')]);_0x3d4f3a['stop']();}}}catch(_0x55190c){logger[_0x6123('0x18')](_0x6123('0xc'),_0x1fd71b,JSON['stringify'](_0x55190c));_0x3d4f3a['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 9005bb0..f82425b 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 _0xed34=['rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex'];(function(_0x221fbe,_0x16bc47){var _0x51c3eb=function(_0x1dc3c3){while(--_0x1dc3c3){_0x221fbe['push'](_0x221fbe['shift']());}};_0x51c3eb(++_0x16bc47);}(_0xed34,0x100));var _0x4ed3=function(_0x209951,_0xb059cf){_0x209951=_0x209951-0x0;var _0x3ec869=_0xed34[_0x209951];return _0x3ec869;};'use strict';var schema=require(_0x4ed3('0x0'));var _=require(_0x4ed3('0x1'));var logger=require('../../../../config/logger')(_0x4ed3('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x4ed3('0x3')}});exports['consequence']=function(_0x2fbddb,_0x30588b){return function(_0x1de940){try{var _0x18fdfb={'priority':_0x30588b[0x0]};var _0x412446=gotop[_0x4ed3('0x0')](_0x18fdfb,{'typecast':!![]});if(_0x412446[_0x4ed3('0x4')]){logger[_0x4ed3('0x5')](_0x4ed3('0x6'),_0x2fbddb,_[_0x4ed3('0x7')](_0x412446,_0x4ed3('0x8'))[_0x4ed3('0x9')](',\x20'));_0x1de940[_0x4ed3('0xa')]();}else{logger[_0x4ed3('0xb')](_0x4ed3('0xc'),_0x2fbddb,_0x18fdfb['priority']);if(_0x18fdfb['priority']){var _0x404b21=_[_0x4ed3('0xd')](_0x1de940[_0x4ed3('0xe')](),{'p':_0x18fdfb[_0x4ed3('0xf')]});if(_0x404b21>=0x0){logger[_0x4ed3('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2fbddb,_0x18fdfb[_0x4ed3('0xf')]||_0x4ed3('0x10'),_0x404b21);_0x1de940[_0x4ed3('0x10')](_0x404b21);}else{logger['info'](_0x4ed3('0x11'),_0x2fbddb,_0x18fdfb[_0x4ed3('0xf')]||_0x4ed3('0x10'));_0x1de940[_0x4ed3('0xa')]();}}else{_0x1de940[_0x4ed3('0x10')]();}}}catch(_0x829fcc){logger[_0x4ed3('0x5')](_0x4ed3('0x6'),_0x2fbddb,JSON['stringify'](_0x829fcc));_0x1de940[_0x4ed3('0xa')]();}};}; \ No newline at end of file +var _0x88b3=['findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','validate','lodash','../../../../config/logger','routing','number','length','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x88b3,0x71));var _0x388b=function(_0x29579f,_0x2b98ea){_0x29579f=_0x29579f-0x0;var _0x36cb5a=_0x88b3[_0x29579f];return _0x36cb5a;};'use strict';var schema=require(_0x388b('0x0'));var _=require(_0x388b('0x1'));var logger=require(_0x388b('0x2'))(_0x388b('0x3'));var gotop=schema({'priority':{'type':_0x388b('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x7e48f7,_0x5e0858){return function(_0x3d4315){try{var _0x563573={'priority':_0x5e0858[0x0]};var _0x5305b1=gotop[_0x388b('0x0')](_0x563573,{'typecast':!![]});if(_0x5305b1[_0x388b('0x5')]){logger['error'](_0x388b('0x6'),_0x7e48f7,_['map'](_0x5305b1,_0x388b('0x7'))[_0x388b('0x8')](',\x20'));_0x3d4315[_0x388b('0x9')]();}else{logger[_0x388b('0xa')](_0x388b('0xb'),_0x7e48f7,_0x563573[_0x388b('0xc')]);if(_0x563573[_0x388b('0xc')]){var _0x106d7d=_[_0x388b('0xd')](_0x3d4315[_0x388b('0xe')](),{'p':_0x563573[_0x388b('0xc')]});if(_0x106d7d>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x7e48f7,_0x563573[_0x388b('0xc')]||_0x388b('0xf'),_0x106d7d);_0x3d4315[_0x388b('0xf')](_0x106d7d);}else{logger[_0x388b('0xa')](_0x388b('0x10'),_0x7e48f7,_0x563573[_0x388b('0xc')]||_0x388b('0xf'));_0x3d4315[_0x388b('0x9')]();}}else{_0x3d4315[_0x388b('0xf')]();}}}catch(_0x3880c4){logger[_0x388b('0x11')](_0x388b('0x6'),_0x7e48f7,JSON['stringify'](_0x3880c4));_0x3d4315['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index ae4c65c..82702f3 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 _0x902e=['AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst'];(function(_0xf3faf0,_0x5c54af){var _0x3578d9=function(_0x582d24){while(--_0x582d24){_0xf3faf0['push'](_0xf3faf0['shift']());}};_0x3578d9(++_0x5c54af);}(_0x902e,0xed));var _0xe902=function(_0x1098fd,_0x4fe58b){_0x1098fd=_0x1098fd-0x0;var _0x5aba3b=_0x902e[_0x1098fd];return _0x5aba3b;};'use strict';var _=require('lodash');var utils=require(_0xe902('0x0'));var logger=require(_0xe902('0x1'))(_0xe902('0x2'));var rpc={'chatMessage':require(_0xe902('0x3')),'openchannelMessage':require(_0xe902('0x4')),'mailMessage':require(_0xe902('0x5')),'smsMessage':require(_0xe902('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe902('0x7'))};exports[_0xe902('0x8')]=function(_0x27121f,_0x22dd7e){return function(_0x480d8d){try{var _0x2cd12a={'body':utils[_0xe902('0x9')](_0x22dd7e[0x0],this),'ContactId':this[_0xe902('0xa')]['id']};if(this[_0xe902('0xb')]===_0xe902('0xc')){_0x2cd12a[_0xe902('0xd')]=this['account']['id'];}else{_0x2cd12a[_[_0xe902('0xe')](this[_0xe902('0xb')])+_0xe902('0xf')]=this['account']['id'];}_0x2cd12a[_[_0xe902('0xe')](this[_0xe902('0xb')])+_0xe902('0x10')]=this[_0xe902('0x11')]['id'];if(rpc[this[_0xe902('0xb')]+_0xe902('0x12')]){return rpc[this[_0xe902('0xb')]+_0xe902('0x12')]['create'](_0x2cd12a)[_0xe902('0x13')](function(_0x2c3581){logger[_0xe902('0x14')](_0xe902('0x15'),_0x27121f,_0x2cd12a[_0xe902('0x16')]);_0x480d8d[_0xe902('0x17')]();})[_0xe902('0x18')](function(_0x56ea1d){logger[_0xe902('0x19')]('[%s][MESSAGE]\x20%s',_0x27121f,JSON['stringify'](_0x56ea1d));_0x480d8d[_0xe902('0x1a')]();});}}catch(_0x109c48){logger[_0xe902('0x19')](_0xe902('0x15'),_0x27121f,JSON[_0xe902('0x1b')](_0x109c48));_0x480d8d[_0xe902('0x1a')]();}};}; \ No newline at end of file +var _0x2f79=['create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','account','upperFirst','AccountId','channel','InteractionId','Message'];(function(_0x333fe0,_0x249c5d){var _0x99a383=function(_0x767086){while(--_0x767086){_0x333fe0['push'](_0x333fe0['shift']());}};_0x99a383(++_0x249c5d);}(_0x2f79,0x175));var _0x92f7=function(_0x5bc910,_0x1122bd){_0x5bc910=_0x5bc910-0x0;var _0x2b606c=_0x2f79[_0x5bc910];return _0x2b606c;};'use strict';var _=require(_0x92f7('0x0'));var utils=require(_0x92f7('0x1'));var logger=require('../../../../config/logger')(_0x92f7('0x2'));var rpc={'chatMessage':require(_0x92f7('0x3')),'openchannelMessage':require(_0x92f7('0x4')),'mailMessage':require(_0x92f7('0x5')),'smsMessage':require(_0x92f7('0x6')),'faxMessage':require(_0x92f7('0x7')),'whatsappMessage':require(_0x92f7('0x8'))};exports[_0x92f7('0x9')]=function(_0x532405,_0x157d0a){return function(_0x16e5c){try{var _0x2c73ba={'body':utils[_0x92f7('0xa')](_0x157d0a[0x0],this),'ContactId':this[_0x92f7('0xb')]['id']};if(this['channel']===_0x92f7('0xc')){_0x2c73ba['ChatWebsiteId']=this[_0x92f7('0xd')]['id'];}else{_0x2c73ba[_[_0x92f7('0xe')](this['channel'])+_0x92f7('0xf')]=this[_0x92f7('0xd')]['id'];}_0x2c73ba[_[_0x92f7('0xe')](this[_0x92f7('0x10')])+_0x92f7('0x11')]=this['interaction']['id'];if(rpc[this[_0x92f7('0x10')]+_0x92f7('0x12')]){return rpc[this[_0x92f7('0x10')]+_0x92f7('0x12')][_0x92f7('0x13')](_0x2c73ba)[_0x92f7('0x14')](function(_0x20c653){logger[_0x92f7('0x15')](_0x92f7('0x16'),_0x532405,_0x2c73ba[_0x92f7('0x17')]);_0x16e5c[_0x92f7('0x18')]();})[_0x92f7('0x19')](function(_0xdb32f0){logger[_0x92f7('0x1a')](_0x92f7('0x16'),_0x532405,JSON['stringify'](_0xdb32f0));_0x16e5c['stop']();});}}catch(_0x4636ba){logger['error'](_0x92f7('0x16'),_0x532405,JSON[_0x92f7('0x1b')](_0x4636ba));_0x16e5c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index bc5c82f..587e39d 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 _0x62c6=['getMustacheRender','next','error','stop','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s'];(function(_0x656c05,_0x1d4b18){var _0x28475a=function(_0x21ef6a){while(--_0x21ef6a){_0x656c05['push'](_0x656c05['shift']());}};_0x28475a(++_0x1d4b18);}(_0x62c6,0xe4));var _0x662c=function(_0x13203b,_0x5c28c9){_0x13203b=_0x13203b-0x0;var _0x33c1b0=_0x62c6[_0x13203b];return _0x33c1b0;};'use strict';var utils=require(_0x662c('0x0'));var logger=require(_0x662c('0x1'))('routing');exports['consequence']=function(_0x5c77ec,_0x37ff87){return function(_0x48a251){try{logger[_0x662c('0x2')](_0x662c('0x3'),_0x5c77ec,utils[_0x662c('0x4')](_0x37ff87[0x0],this));_0x48a251[_0x662c('0x5')]();}catch(_0x49b95c){logger[_0x662c('0x6')](_0x662c('0x3'),_0x5c77ec,JSON['stringify'](_0x49b95c));_0x48a251[_0x662c('0x7')]();}};}; \ No newline at end of file +var _0xc86f=['error','[%s][NOOP]\x20%s','stop','../../../../config/logger','routing','consequence','info','getMustacheRender'];(function(_0x2d76cb,_0x40bf84){var _0x2c2a32=function(_0x4429f4){while(--_0x4429f4){_0x2d76cb['push'](_0x2d76cb['shift']());}};_0x2c2a32(++_0x40bf84);}(_0xc86f,0xb3));var _0xfc86=function(_0x2c3f35,_0x57221b){_0x2c3f35=_0x2c3f35-0x0;var _0xf9105e=_0xc86f[_0x2c3f35];return _0xf9105e;};'use strict';var utils=require('./utils');var logger=require(_0xfc86('0x0'))(_0xfc86('0x1'));exports[_0xfc86('0x2')]=function(_0x1cb8af,_0x142c2e){return function(_0x5c599b){try{logger[_0xfc86('0x3')]('[%s][NOOP]\x20%s',_0x1cb8af,utils[_0xfc86('0x4')](_0x142c2e[0x0],this));_0x5c599b['next']();}catch(_0x3c00e2){logger[_0xfc86('0x5')](_0xfc86('0x6'),_0x1cb8af,JSON['stringify'](_0x3c00e2));_0x5c599b[_0xfc86('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 1fc4345..94cae26 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 _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3e74,0x175));var _0x43e7=function(_0x5b454f,_0xf2ae47){_0x5b454f=_0x5b454f-0x0;var _0x211398=_0x3e74[_0x5b454f];return _0x211398;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x17cbff,_0x1c3c0b){var _0x50f15b=function(_0x23f20e){while(--_0x23f20e){_0x17cbff['push'](_0x17cbff['shift']());}};_0x50f15b(++_0x1c3c0b);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ 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 1ca0f65..24c6d2a 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 _0xabdb=['channel','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','uuid','./util','../../../../../config/logger','notificationId','agent','realtime','routing','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','isNil','agents','forcedOwnership','isAgentAvailable'];(function(_0x3e6309,_0x1506da){var _0x22a3d8=function(_0x5d6327){while(--_0x5d6327){_0x3e6309['push'](_0x3e6309['shift']());}};_0x22a3d8(++_0x1506da);}(_0xabdb,0xbe));var _0xbabd=function(_0x44c284,_0x87ff00){_0x44c284=_0x44c284-0x0;var _0x4dc7b9=_0xabdb[_0x44c284];return _0x4dc7b9;};'use strict';var _=require('lodash');var uuid=require(_0xbabd('0x0'));var util=require(_0xbabd('0x1'));var logger=require(_0xbabd('0x2'))('routing');var Agent=function(_0xa63442,_0x33da77,_0x14b77c,_0x74d3ba){this[_0xbabd('0x3')]=uuid['v4']();this['squeue']=_0xa63442;this[_0xbabd('0x4')]=_0x33da77;this[_0xbabd('0x5')]=_0x14b77c;this[_0xbabd('0x6')]=_0x74d3ba;this[_0xbabd('0x7')][_0xbabd('0x8')](this[_0xbabd('0x9')][_0xbabd('0xa')](this),this['handleTimeout']['bind'](this));this[_0xbabd('0x7')]['on']('timeout',this[_0xbabd('0xb')][_0xbabd('0xa')](this));this[_0xbabd('0x7')]['on'](_0xbabd('0xc'),this[_0xbabd('0xd')]['bind'](this));};Agent[_0xbabd('0xe')][_0xbabd('0x8')]=function(){this[_0xbabd('0x7')][_0xbabd('0x8')](this[_0xbabd('0x9')][_0xbabd('0xa')](this),this[_0xbabd('0xb')][_0xbabd('0xa')](this));};Agent['prototype'][_0xbabd('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xbabd('0xe')][_0xbabd('0x9')]=function(_0x12e27c){logger[_0xbabd('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xbabd('0x7')]['id'],this[_0xbabd('0x4')]['id']);if(_[_0xbabd('0x10')](this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']])){logger[_0xbabd('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbabd('0x7')]['id'],this[_0xbabd('0x4')]['id']);setTimeout(this[_0xbabd('0x8')]['bind'](this),0x3e8);}else{if(this[_0xbabd('0x6')][_0xbabd('0x12')]||util[_0xbabd('0x13')](this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],this[_0xbabd('0x7')][_0xbabd('0x14')],![])){this['realtime'][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']]['busy']=!![];this['realtime']['agents'][this[_0xbabd('0x4')]['id']][_0xbabd('0x15')]=undefined;util[_0xbabd('0x16')](this[_0xbabd('0x3')],this[_0xbabd('0x7')]['id'],this['realtime'][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],null,this['routing']);util[_0xbabd('0x17')](this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],'RINGING'+(this['routing']['forcedOwnership']?_0xbabd('0x18'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xbabd('0x7')]['id'],this[_0xbabd('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xbabd('0xb')]=function(_0x2299f7){if(_[_0xbabd('0x10')](this[_0xbabd('0x5')]['agents'][this[_0xbabd('0x4')]['id']])){return logger[_0xbabd('0xf')](_0xbabd('0x19'),this[_0xbabd('0x7')]['id'],this['agent']['id']);}else{logger[_0xbabd('0xf')](_0xbabd('0x1a'),this['squeue']['id'],this[_0xbabd('0x4')]['id']);util[_0xbabd('0x1b')](this[_0xbabd('0x3')],this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')]['agents'][this[_0xbabd('0x4')]['id']],null,this[_0xbabd('0x6')]);this['realtime'][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']][_0xbabd('0x1c')]=![];this[_0xbabd('0x5')]['agents'][this['agent']['id']][_0xbabd('0x15')]=undefined;util['writeLog'](this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],_0x2299f7?'STOP':_0xbabd('0x1d'));}if(!_0x2299f7){setTimeout(this[_0xbabd('0x8')]['bind'](this),0x3e8);}};function agent(_0x35fdea,_0x2a8c2f,_0x3df7e5,_0x2f3451){return new Agent(_0x35fdea,_0x2a8c2f,_0x3df7e5,_0x2f3451);}module['exports']=agent; \ No newline at end of file +var _0xe1c6=['handleDrained','handleRun','prototype','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','push','isNil','hideNotification','busyQueue','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','bind','handleTimeout','timeout','drained'];(function(_0x50601d,_0x2f9ef9){var _0xa4b607=function(_0x3d195d){while(--_0x3d195d){_0x50601d['push'](_0x50601d['shift']());}};_0xa4b607(++_0x2f9ef9);}(_0xe1c6,0x1d4));var _0x6e1c=function(_0x9b24a5,_0x47c37a){_0x9b24a5=_0x9b24a5-0x0;var _0x3f4434=_0xe1c6[_0x9b24a5];return _0x3f4434;};'use strict';var _=require(_0x6e1c('0x0'));var uuid=require(_0x6e1c('0x1'));var util=require(_0x6e1c('0x2'));var logger=require(_0x6e1c('0x3'))(_0x6e1c('0x4'));var Agent=function(_0x443212,_0x2ecb7e,_0x5314cb,_0x546bb6){this['notificationId']=uuid['v4']();this[_0x6e1c('0x5')]=_0x443212;this[_0x6e1c('0x6')]=_0x2ecb7e;this[_0x6e1c('0x7')]=_0x5314cb;this['routing']=_0x546bb6;this[_0x6e1c('0x5')]['push'](this['handleRun'][_0x6e1c('0x8')](this),this[_0x6e1c('0x9')][_0x6e1c('0x8')](this));this[_0x6e1c('0x5')]['on'](_0x6e1c('0xa'),this[_0x6e1c('0x9')]['bind'](this));this[_0x6e1c('0x5')]['on'](_0x6e1c('0xb'),this[_0x6e1c('0xc')][_0x6e1c('0x8')](this));};Agent['prototype']['push']=function(){this[_0x6e1c('0x5')]['push'](this[_0x6e1c('0xd')]['bind'](this),this['handleTimeout'][_0x6e1c('0x8')](this));};Agent[_0x6e1c('0xe')][_0x6e1c('0xc')]=function(){this[_0x6e1c('0x9')](!![]);};Agent[_0x6e1c('0xe')]['handleRun']=function(_0x3a8a4d){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x6e1c('0x5')]['id'],this[_0x6e1c('0x6')]['id']);if(_['isNil'](this[_0x6e1c('0x7')]['agents'][this[_0x6e1c('0x6')]['id']])){logger[_0x6e1c('0xf')](_0x6e1c('0x10'),this['squeue']['id'],this[_0x6e1c('0x6')]['id']);setTimeout(this['push'][_0x6e1c('0x8')](this),0x3e8);}else{if(this['routing'][_0x6e1c('0x11')]||util['isAgentAvailable'](this[_0x6e1c('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],this[_0x6e1c('0x5')][_0x6e1c('0x12')],![])){this[_0x6e1c('0x7')][_0x6e1c('0x13')][this[_0x6e1c('0x6')]['id']]['busy']=!![];this['realtime'][_0x6e1c('0x13')][this[_0x6e1c('0x6')]['id']]['busyQueue']=undefined;util[_0x6e1c('0x14')](this[_0x6e1c('0x15')],this[_0x6e1c('0x5')]['id'],this['realtime'][_0x6e1c('0x13')][this[_0x6e1c('0x6')]['id']],null,this[_0x6e1c('0x4')]);util[_0x6e1c('0x16')](this[_0x6e1c('0x5')]['id'],this[_0x6e1c('0x7')][_0x6e1c('0x13')][this['agent']['id']],_0x6e1c('0x17')+(this[_0x6e1c('0x4')][_0x6e1c('0x11')]?_0x6e1c('0x18'):''));}else{logger[_0x6e1c('0xf')](_0x6e1c('0x19'),this[_0x6e1c('0x5')]['id'],this[_0x6e1c('0x6')]['id']);setTimeout(this[_0x6e1c('0x1a')][_0x6e1c('0x8')](this),0x3e8);}}};Agent[_0x6e1c('0xe')][_0x6e1c('0x9')]=function(_0x4a140e){if(_[_0x6e1c('0x1b')](this[_0x6e1c('0x7')][_0x6e1c('0x13')][this[_0x6e1c('0x6')]['id']])){return logger[_0x6e1c('0xf')](_0x6e1c('0x10'),this[_0x6e1c('0x5')]['id'],this[_0x6e1c('0x6')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x6e1c('0x5')]['id'],this[_0x6e1c('0x6')]['id']);util[_0x6e1c('0x1c')](this[_0x6e1c('0x15')],this[_0x6e1c('0x5')]['id'],this['realtime'][_0x6e1c('0x13')][this[_0x6e1c('0x6')]['id']],null,this[_0x6e1c('0x4')]);this[_0x6e1c('0x7')][_0x6e1c('0x13')][this[_0x6e1c('0x6')]['id']]['busy']=![];this[_0x6e1c('0x7')]['agents'][this[_0x6e1c('0x6')]['id']][_0x6e1c('0x1d')]=undefined;util['writeLog'](this[_0x6e1c('0x5')]['id'],this[_0x6e1c('0x7')][_0x6e1c('0x13')][this['agent']['id']],_0x4a140e?_0x6e1c('0x1e'):'TIMEOUT');}if(!_0x4a140e){setTimeout(this[_0x6e1c('0x1a')][_0x6e1c('0x8')](this),0x3e8);}};function agent(_0x128663,_0x203acd,_0x280491,_0x7cf0df){return new Agent(_0x128663,_0x203acd,_0x280491,_0x7cf0df);}module[_0x6e1c('0x1f')]=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 a57c0fa..0798a2b 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 _0xb9d5=['isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','routing','STOP','exports','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0xb9d5,0x136));var _0x5b9d=function(_0x37107d,_0xd5c88e){_0x37107d=_0x37107d-0x0;var _0x556d79=_0xb9d5[_0x37107d];return _0x556d79;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x5b9d('0x0'));var logger=require(_0x5b9d('0x1'))('routing');var Beepall=function(_0x4163ad,_0x5722ad,_0x43c2ef,_0x3aa8f6){this[_0x5b9d('0x2')]=uuid['v4']();this[_0x5b9d('0x3')]=_0x4163ad;this[_0x5b9d('0x4')]=_0x5722ad;this[_0x5b9d('0x5')]=_0x43c2ef;this['routing']=_0x3aa8f6;this['squeue'][_0x5b9d('0x6')](this[_0x5b9d('0x7')][_0x5b9d('0x8')](this),this[_0x5b9d('0x9')][_0x5b9d('0x8')](this));this[_0x5b9d('0x3')]['on'](_0x5b9d('0xa'),this[_0x5b9d('0x9')]['bind'](this));this[_0x5b9d('0x3')]['on'](_0x5b9d('0xb'),this[_0x5b9d('0xc')][_0x5b9d('0x8')](this));};Beepall[_0x5b9d('0xd')][_0x5b9d('0x6')]=function(){this[_0x5b9d('0x3')][_0x5b9d('0x6')](this[_0x5b9d('0x7')][_0x5b9d('0x8')](this),this[_0x5b9d('0x9')][_0x5b9d('0x8')](this));};Beepall[_0x5b9d('0xd')][_0x5b9d('0xc')]=function(_0x51ba81){this['handleTimeout'](!![]);};Beepall[_0x5b9d('0xd')]['handleRun']=function(_0x38df1b){var _0x4c3cd1=!![];if(!_[_0x5b9d('0xe')](this['queue'])&&!_[_0x5b9d('0xe')](this[_0x5b9d('0x4')][_0x5b9d('0xf')])&&this[_0x5b9d('0x4')]['Agents'][_0x5b9d('0x10')]>0x0){for(var _0x21c567=0x0,_0x52941e;_0x21c5670x0){for(var _0x18643f=0x0,_0x39e542;_0x18643f0x0&&_0x40a786[_0x3069d7+_0x9964('0x23')]>=_0x40a786[_0x3069d7+_0x9964('0x21')]){writeLog(_0x5c52af,_0x40a786,_0x3069d7[_0x9964('0x24')]()+_0x9964('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x524564,_0x194dc6,_0x2c1fad,_0x108c0a,_0x16ec83){return sendNotification(!![],_0x524564,_0x194dc6,_0x2c1fad,_0x108c0a,_0x16ec83);};exports['hideNotification']=function(_0x201656,_0x3a59df,_0x396054,_0x34d835,_0x178089){return sendNotification(![],_0x201656,_0x3a59df,_0x396054,_0x34d835,_0x178089);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x3670=['routing','defaults','redis','localhost','socket.io-emitter','emit','format','name','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','notificationTemplate','[%s][QUEUE]\x20%s','message','notification:%s','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','online','OFFLINE','Pause','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger'];(function(_0x4353f1,_0x3ae25b){var _0x4bc585=function(_0x124f53){while(--_0x124f53){_0x4353f1['push'](_0x4353f1['shift']());}};_0x4bc585(++_0x3ae25b);}(_0x3670,0x16c));var _0x0367=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3670[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0367('0x0'));var utils=require(_0x0367('0x1'));var Mustache=require(_0x0367('0x2'));var Redis=require(_0x0367('0x3'));var config=require(_0x0367('0x4'));var logger=require(_0x0367('0x5'))(_0x0367('0x6'));config['redis']=_[_0x0367('0x7')](config[_0x0367('0x8')],{'host':_0x0367('0x9'),'port':0x18eb});var io=require(_0x0367('0xa'))(new Redis(config[_0x0367('0x8')]));function emit(_0xfd4f41,_0x43b2e9,_0x55f08e){io['to'](_0xfd4f41)[_0x0367('0xb')](_0x43b2e9,_0x55f08e);}function sendNotification(_0x1e6351,_0x181c59,_0x2127df,_0x3eb81f,_0x27d570,_0x412c44){io['to'](util[_0x0367('0xc')]('user:%s',_0x3eb81f[_0x0367('0xd')]))['emit'](_0x0367('0xe'),_0x3eb81f);var _0x23f4c8=_0x412c44||{};var _0x3e6c8c=_0x2127df[_0x0367('0xf')]('.');var _0xbbcf61={'uniqueid':_0x181c59,'channel':_0x3e6c8c[0x0],'id':_0x3e6c8c[0x1],'title':_0x3e6c8c[0x0]+_0x0367('0x10'),'interactionId':_0x3e6c8c[0x2],'queue':_0x27d570?_0x27d570[_0x0367('0xd')]:null,'sound':_0x23f4c8[_0x0367('0x11')]['notificationSound'],'shake':_0x23f4c8[_0x0367('0x11')][_0x0367('0x12')]};try{if(!_0x23f4c8['body']){_0x23f4c8[_0x0367('0x13')]={};}if(_0x27d570){_0x23f4c8[_0x0367('0x13')][_0x0367('0x14')]=_0x27d570;}else if(_0x23f4c8['body'][_0x0367('0x14')]){delete _0x23f4c8[_0x0367('0x13')][_0x0367('0x14')];}_0xbbcf61[_0x0367('0x15')]=utils['getMustacheRender'](_0x23f4c8['account'][_0x0367('0x16')],_0x23f4c8);}catch(_0x3bcfd9){_0xbbcf61[_0x0367('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util[_0x0367('0xc')](_0x0367('0x17'),_0x181c59,_0x3bcfd9[_0x0367('0x18')]));}io['to'](util[_0x0367('0xc')]('user:%s',_0x3eb81f[_0x0367('0xd')]))[_0x0367('0xb')](util[_0x0367('0xc')](_0x0367('0x19'),_0x1e6351?'save':'remove'),_0xbbcf61);}function writeLog(_0xbed137,_0x28cb87,_0x4d79da){return logger['info'](util[_0x0367('0xc')](_0x0367('0x1a'),_0xbed137,_0x28cb87[_0x0367('0xd')],_0x4d79da));}exports[_0x0367('0x1b')]=function(_0x2315d7,_0x212281,_0x2681b3,_0x42e48e){if(_0x212281['busy']){writeLog(_0x2315d7,_0x212281,'BUSY');return![];}if(!_0x212281[_0x0367('0x1c')]){writeLog(_0x2315d7,_0x212281,_0x0367('0x1d'));return![];}if(_0x212281[_0x2681b3+_0x0367('0x1e')]){writeLog(_0x2315d7,_0x212281,'PAUSE');return![];}if(_0x42e48e&&_0x212281['hasOwnProperty'](_0x2681b3+_0x0367('0x1f'))&&_0x212281['hasOwnProperty'](_0x2681b3+_0x0367('0x20'))){if(_0x212281[_0x2681b3+_0x0367('0x1f')]>0x0&&_0x212281[_0x2681b3+_0x0367('0x20')]>=_0x212281[_0x2681b3+_0x0367('0x1f')]){writeLog(_0x2315d7,_0x212281,_0x2681b3[_0x0367('0x21')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x0367('0x22')]=function(_0x13d20f,_0x33d22e,_0x247793,_0x5933de,_0x2ed10e){return sendNotification(!![],_0x13d20f,_0x33d22e,_0x247793,_0x5933de,_0x2ed10e);};exports[_0x0367('0x23')]=function(_0x156038,_0x4f19a0,_0x46461f,_0x301106,_0x4c0925){return sendNotification(![],_0x156038,_0x4f19a0,_0x46461f,_0x301106,_0x4c0925);};exports[_0x0367('0x24')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 351aee9..c6a5476 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 _0xe416=['isNil','[%s][SYSTEM]\x20no\x20variable','body','next','error','[%s][SYSTEM]\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','join','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0xe416,0x18e));var _0x6e41=function(_0x19d694,_0x5d5329){_0x19d694=_0x19d694-0x0;var _0x82ba4d=_0xe416[_0x19d694];return _0x82ba4d;};'use strict';var schema=require(_0x6e41('0x0'));var sh=require(_0x6e41('0x1'));var _=require(_0x6e41('0x2'));var utils=require('./utils');var logger=require(_0x6e41('0x3'))(_0x6e41('0x4'));var system=schema({'command':{'type':_0x6e41('0x5'),'required':!![],'message':_0x6e41('0x6')}});exports[_0x6e41('0x7')]=function(_0x25c129,_0x5d8af5){return function(_0x2e2ef5){try{var _0x4dacde={'command':_0x5d8af5[0x0]};var _0xfdda0c=system['validate'](_0x4dacde,{'typecast':!![]});if(_0xfdda0c['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x25c129,_[_0x6e41('0x8')](_0xfdda0c,_0x6e41('0x9'))[_0x6e41('0xa')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x25c129);_0x2e2ef5['next']();}else{var _0x2031de=this;var _0x30fdd4=utils[_0x6e41('0xb')](_0x5d8af5[0x0],this);logger[_0x6e41('0xc')](_0x6e41('0xd'),_0x25c129,_0x30fdd4);sh[_0x6e41('0xe')](_[_0x6e41('0xf')](_0x30fdd4),function(_0x201784,_0x47a8e8){logger[_0x6e41('0xc')](_0x6e41('0x10'),_0x25c129,_0x201784);if(_0x201784==0x0){var _0x759667=_0x47a8e8[_0x6e41('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x6e41('0x12')](_0x5d8af5[0x1])||_['isEmpty'](_0x5d8af5[0x1])){logger['info'](_0x6e41('0x13'),_0x25c129);_0x2031de[_0x6e41('0x14')][_0x5d8af5[0x1]]=_0x759667;}else{logger[_0x6e41('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x25c129,_0x5d8af5[0x1],_0x759667);_0x2031de[_0x6e41('0x14')][_0x5d8af5[0x1]]=_0x759667;}}_0x2e2ef5[_0x6e41('0x15')]();});}}catch(_0x14ed63){logger[_0x6e41('0x16')](_0x6e41('0x17'),_0x25c129,_[_0x6e41('0x18')](_0x14ed63)?JSON['stringify'](_0x14ed63):_0x14ed63);logger[_0x6e41('0xc')](_0x6e41('0x19'),_0x25c129);_0x2e2ef5[_0x6e41('0x15')]();}};}; \ No newline at end of file +var _0x687a=['next','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x687a,0x69));var _0xa687=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x687a[_0x3ab51d];return _0x29a04e;};'use strict';var schema=require(_0xa687('0x0'));var sh=require(_0xa687('0x1'));var _=require(_0xa687('0x2'));var utils=require(_0xa687('0x3'));var logger=require(_0xa687('0x4'))('routing');var system=schema({'command':{'type':_0xa687('0x5'),'required':!![],'message':_0xa687('0x6')}});exports['consequence']=function(_0x260aad,_0xcead06){return function(_0x4623dd){try{var _0x4b6ffc={'command':_0xcead06[0x0]};var _0x404318=system[_0xa687('0x0')](_0x4b6ffc,{'typecast':!![]});if(_0x404318['length']){logger['error'](_0xa687('0x7'),_0x260aad,_[_0xa687('0x8')](_0x404318,_0xa687('0x9'))[_0xa687('0xa')](',\x20'));logger[_0xa687('0xb')](_0xa687('0xc'),_0x260aad);_0x4623dd['next']();}else{var _0x49fb1d=this;var _0x4cf875=utils[_0xa687('0xd')](_0xcead06[0x0],this);logger[_0xa687('0xb')](_0xa687('0xe'),_0x260aad,_0x4cf875);sh[_0xa687('0xf')](_[_0xa687('0x10')](_0x4cf875),function(_0x3f308a,_0xe004a3){logger['info'](_0xa687('0x11'),_0x260aad,_0x3f308a);if(_0x3f308a==0x0){var _0x13a97d=_0xe004a3['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa687('0x12')](_0xcead06[0x1])||_[_0xa687('0x13')](_0xcead06[0x1])){logger['info'](_0xa687('0x14'),_0x260aad);_0x49fb1d[_0xa687('0x15')][_0xcead06[0x1]]=_0x13a97d;}else{logger[_0xa687('0xb')](_0xa687('0x16'),_0x260aad,_0xcead06[0x1],_0x13a97d);_0x49fb1d[_0xa687('0x15')][_0xcead06[0x1]]=_0x13a97d;}}_0x4623dd['next']();});}}catch(_0x7fadf9){logger[_0xa687('0x17')](_0xa687('0x7'),_0x260aad,_['isObject'](_0x7fadf9)?JSON[_0xa687('0x18')](_0x7fadf9):_0x7fadf9);logger['info'](_0xa687('0xc'),_0x260aad);_0x4623dd[_0xa687('0x19')]();}};}; \ 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 5db12c9..d5c1e1e 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 _0x1660=['next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x13e550,_0x39340c){var _0xaa7027=function(_0x58f1bf){while(--_0x58f1bf){_0x13e550['push'](_0x13e550['shift']());}};_0xaa7027(++_0x39340c);}(_0x1660,0xac));var _0x0166=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1660[_0x178e48];return _0x440d7e;};'use strict';var schema=require(_0x0166('0x0'));var _=require(_0x0166('0x1'));var rpc={'chatInteraction':require(_0x0166('0x2')),'openchannelInteraction':require(_0x0166('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0166('0x4')),'whatsappInteraction':require(_0x0166('0x5'))};var logger=require(_0x0166('0x6'))(_0x0166('0x7'));var tag=schema({'tag':{'type':_0x0166('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0166('0x9')]=function(_0x325ac3,_0x1ca89b,_0x3eb520,_0x5a9cc5){return function(_0xd2ee3f){try{var _0xe8f5d4={'tag':_0x1ca89b[0x0]};var _0x347e87=tag['validate'](_0xe8f5d4,{'typecast':!![]});if(_0x347e87[_0x0166('0xa')]){logger[_0x0166('0xb')](_0x0166('0xc'),_0x325ac3,_[_0x0166('0xd')](_0x347e87,_0x0166('0xe'))['join'](',\x20'));logger[_0x0166('0xf')](_0x0166('0x10'),_0x325ac3);_0xd2ee3f[_0x0166('0x11')]();}else{var _0x147758={'ids':[_0x1ca89b[0x0]]};if(rpc[_0x5a9cc5[_0x0166('0x12')]+'Interaction']){rpc[_0x5a9cc5[_0x0166('0x12')]+_0x0166('0x13')][_0x0166('0x14')](_0x5a9cc5['interaction']['id'],_0x147758)[_0x0166('0x15')](function(_0x52567e){logger[_0x0166('0xf')](_0x0166('0x16'),_0x325ac3,_0x1ca89b[0x1],_0x5a9cc5[_0x0166('0x12')],_0x5a9cc5[_0x0166('0x17')]['id']);})['catch'](function(_0x47289c){logger[_0x0166('0xb')]('[%s][TAG]\x20%s',_0x325ac3,JSON['stringify'](_0x47289c));logger['info'](_0x0166('0x10'),_0x325ac3);})[_0x0166('0x18')](function(){_0xd2ee3f[_0x0166('0x11')]();});}}}catch(_0x48cbe4){logger[_0x0166('0xb')]('[%s][TAG]\x20%s',_0x325ac3,_[_0x0166('0x19')](_0x48cbe4)?JSON[_0x0166('0x1a')](_0x48cbe4):_0x48cbe4);logger['info'](_0x0166('0x10'),_0x325ac3);_0xd2ee3f[_0x0166('0x11')]();}};}; \ No newline at end of file +var _0xe231=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','info','catch','stringify','error','isObject','validate'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0xe231,0x1bf));var _0x1e23=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0xe231[_0x1b2255];return _0x33e57d;};'use strict';var schema=require(_0x1e23('0x0'));var _=require(_0x1e23('0x1'));var rpc={'chatInteraction':require(_0x1e23('0x2')),'openchannelInteraction':require(_0x1e23('0x3')),'smsInteraction':require(_0x1e23('0x4')),'mailInteraction':require(_0x1e23('0x5')),'faxInteraction':require(_0x1e23('0x6')),'whatsappInteraction':require(_0x1e23('0x7'))};var logger=require(_0x1e23('0x8'))(_0x1e23('0x9'));var tag=schema({'tag':{'type':_0x1e23('0xa'),'required':!![],'message':_0x1e23('0xb')}});exports[_0x1e23('0xc')]=function(_0x307390,_0x1237e1,_0x31f53c,_0x551388){return function(_0x392a83){try{var _0x21574a={'tag':_0x1237e1[0x0]};var _0x14a4e6=tag[_0x1e23('0x0')](_0x21574a,{'typecast':!![]});if(_0x14a4e6[_0x1e23('0xd')]){logger['error'](_0x1e23('0xe'),_0x307390,_['map'](_0x14a4e6,_0x1e23('0xf'))[_0x1e23('0x10')](',\x20'));logger['info'](_0x1e23('0x11'),_0x307390);_0x392a83[_0x1e23('0x12')]();}else{var _0x2ef27d={'ids':[_0x1237e1[0x0]]};if(rpc[_0x551388[_0x1e23('0x13')]+_0x1e23('0x14')]){rpc[_0x551388['channel']+_0x1e23('0x14')]['addTags'](_0x551388[_0x1e23('0x15')]['id'],_0x2ef27d)[_0x1e23('0x16')](function(_0xe1c6a){logger[_0x1e23('0x17')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x307390,_0x1237e1[0x1],_0x551388[_0x1e23('0x13')],_0x551388['interaction']['id']);})[_0x1e23('0x18')](function(_0x3fc543){logger['error'](_0x1e23('0xe'),_0x307390,JSON[_0x1e23('0x19')](_0x3fc543));logger[_0x1e23('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x307390);})['finally'](function(){_0x392a83[_0x1e23('0x12')]();});}}}catch(_0xe88ad4){logger[_0x1e23('0x1a')]('[%s][TAG]\x20%s',_0x307390,_[_0x1e23('0x1b')](_0xe88ad4)?JSON['stringify'](_0xe88ad4):_0xe88ad4);logger[_0x1e23('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x307390);_0x392a83['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 4a03f51..715dd52 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 _0x1061=['body','contact','message','account','interaction','mustache','render','merge'];(function(_0x4f5033,_0x289213){var _0x14a669=function(_0x42f50a){while(--_0x42f50a){_0x4f5033['push'](_0x4f5033['shift']());}};_0x14a669(++_0x289213);}(_0x1061,0x1b5));var _0x1106=function(_0x5d8c8f,_0xd1fbf7){_0x5d8c8f=_0x5d8c8f-0x0;var _0x1bc7bc=_0x1061[_0x5d8c8f];return _0x1bc7bc;};'use strict';var Mustache=require(_0x1106('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x592486,_0x986553){return Mustache[_0x1106('0x1')](_0x592486,_[_0x1106('0x2')](_0x986553[_0x1106('0x3')],{'contact':_0x986553[_0x1106('0x4')],'message':_0x986553[_0x1106('0x5')],'account':_0x986553[_0x1106('0x6')],'interaction':_0x986553[_0x1106('0x7')],'list':_0x986553['list']}))||'';}}; \ No newline at end of file +var _0xfa68=['message','account','interaction','list','mustache','lodash','exports','render','merge','contact'];(function(_0x1477ea,_0x320b91){var _0x15fcdc=function(_0x3c4155){while(--_0x3c4155){_0x1477ea['push'](_0x1477ea['shift']());}};_0x15fcdc(++_0x320b91);}(_0xfa68,0x86));var _0x8fa6=function(_0x5a99d0,_0x2dc3a6){_0x5a99d0=_0x5a99d0-0x0;var _0x7f073d=_0xfa68[_0x5a99d0];return _0x7f073d;};'use strict';var Mustache=require(_0x8fa6('0x0'));var _=require(_0x8fa6('0x1'));module[_0x8fa6('0x2')]={'getMustacheRender':function(_0x4d2bf8,_0x16029c){return Mustache[_0x8fa6('0x3')](_0x4d2bf8,_[_0x8fa6('0x4')](_0x16029c['body'],{'contact':_0x16029c[_0x8fa6('0x5')],'message':_0x16029c[_0x8fa6('0x6')],'account':_0x16029c[_0x8fa6('0x7')],'interaction':_0x16029c[_0x8fa6('0x8')],'list':_0x16029c[_0x8fa6('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 55cbaf5..387e049 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 _0xefc6=['update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','message','interaction','applications','length','existsSync','join','app','autoreply','appdata','split','push','slice','dialogflow','tag','TagId','format','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','end','channel','QueueReport'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xefc6,0x148));var _0x6efc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xefc6[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6efc('0x0'));var util=require(_0x6efc('0x1'));var path=require(_0x6efc('0x2'));var fs=require('fs');var jayson=require(_0x6efc('0x3'));var BPromise=require('bluebird');var uuid=require(_0x6efc('0x4'));var config=require(_0x6efc('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x6efc('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x6efc('0x7')),'smsQueueReport':require(_0x6efc('0x8')),'faxQueueReport':require(_0x6efc('0x9')),'whatsappQueueReport':require(_0x6efc('0xa'))};var RuleEngine=require(_0x6efc('0xb'));function getId(_0x53b03d,_0x6c37e6,_0x601a33){return util['format'](_0x6efc('0xc'),_0x53b03d,_0x6c37e6||0x0,_0x601a33||0x0);}function getIntervals(_0x34527f,_0x301886){var _0x389ebe=[];if(!_[_0x6efc('0xd')](_0x301886[_0x6efc('0xe')])&&!_[_0x6efc('0xd')](_0x34527f[_0x301886[_0x6efc('0xe')]])&&!_['isNil'](_0x34527f[_0x301886[_0x6efc('0xe')]]['Intervals'])){_0x389ebe=_[_0x6efc('0xf')](_0x34527f[_0x301886['IntervalId']][_0x6efc('0x10')],_0x6efc('0x11'));}else if(!_[_0x6efc('0xd')](_0x301886[_0x6efc('0x11')])){_0x389ebe=[_0x301886[_0x6efc('0x11')]];}return _0x389ebe;}exports[_0x6efc('0x12')]=function(_0x187d71){_0x187d71[_0x6efc('0x13')]={};return new BPromise(function(_0x21d4fd,_0x585580){var _0xadd1fd={'Start':function(_0x15d210){var _0x22badc=this;return new Promise(function(_0x434054,_0x3557a6){if(_0x15d210){try{var _0xc892e6=[];var _0xa668a7=getId(_0x15d210['channel'],_0x15d210[_0x6efc('0x14')]?_0x15d210[_0x6efc('0x14')]['id']:0x0,_0x15d210[_0x6efc('0x15')]?_0x15d210['interaction']['id']:0x0);if(_0x15d210[_0x6efc('0x16')]&&_['isArray'](_0x15d210[_0x6efc('0x16')])&&_0x15d210['applications']['length']){for(var _0x5428ea=0x0;_0x5428ea<_0x15d210[_0x6efc('0x16')][_0x6efc('0x17')];_0x5428ea+=0x1){var _0x51e089=_0x15d210[_0x6efc('0x16')][_0x5428ea];if(fs[_0x6efc('0x18')](path[_0x6efc('0x19')](__dirname,_0x6efc('0x16'),_0x51e089[_0x6efc('0x1a')]+'.js'))){var _0x5d682e=[];switch(_0x51e089[_0x6efc('0x1a')]['toLowerCase']()){case _0x6efc('0x1b'):var _0x14c60b=_0x51e089[_0x6efc('0x1c')][_0x6efc('0x1d')](',');_0x5d682e[_0x6efc('0x1e')](_0x14c60b[0x0]);_0x5d682e[_0x6efc('0x1e')](_0x14c60b[_0x6efc('0x1f')](0x1,_0x14c60b[_0x6efc('0x17')])[_0x6efc('0x19')](','));break;case _0x6efc('0x20'):var _0x3e2d39=_0x51e089[_0x6efc('0x1c')][_0x6efc('0x1d')](',');_0x5d682e[_0x6efc('0x1e')](_0x3e2d39[0x0]);_0x5d682e[_0x6efc('0x1e')](_0x3e2d39[0x1]);_0x5d682e[_0x6efc('0x1e')](_0x3e2d39[_0x6efc('0x1f')](0x2,_0x3e2d39['length'])[_0x6efc('0x19')](','));break;case'amazonlex':var _0x39434e=_0x51e089[_0x6efc('0x1c')][_0x6efc('0x1d')](',');_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x0]);_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x1]);_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x2]);_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x3]);_0x5d682e[_0x6efc('0x1e')](_0x39434e['slice'](0x4,_0x39434e[_0x6efc('0x17')])['join'](','));break;case'message':_0x5d682e['push'](_0x51e089[_0x6efc('0x1c')]);break;case _0x6efc('0x21'):_0x5d682e[_0x6efc('0x1e')](_0x51e089[_0x6efc('0x22')]);_0x5d682e[_0x6efc('0x1e')](_0x51e089['appdata']);break;default:_0x5d682e=_['isNil'](_0x51e089['appdata'])?[]:_0x51e089['appdata'][_0x6efc('0x1d')](',');}var _0x20f259={'id':util[_0x6efc('0x23')](_0x6efc('0x24'),_0xa668a7,_0x51e089['id'],_0x51e089[_0x6efc('0x1a')]),'condition':require(_0x6efc('0x25'))[_0x6efc('0x26')](_0xa668a7,getIntervals(_0x187d71['intervals'],_0x51e089),_0x187d71),'consequence':require('./applications/'+_0x51e089[_0x6efc('0x1a')])[_0x6efc('0x27')](_0xa668a7,_0x5d682e,_0x187d71,_0x15d210),'p':_0x51e089[_0x6efc('0x28')]||0x0};logger[_0x6efc('0x29')](_0x6efc('0x2a'),_0x20f259['id'],_0x6efc('0x2b'),getIntervals(_0x187d71[_0x6efc('0x2c')],_0x51e089)[_0x6efc('0x19')](_0x6efc('0x2d')));_0xc892e6[_0x6efc('0x1e')](_0x20f259);}else{logger['error'](_0x6efc('0x2e'),path[_0x6efc('0x19')](__dirname,_0x6efc('0x16'),_0x51e089[_0x6efc('0x1a')]+_0x6efc('0x2f')));}}_0x187d71[_0x6efc('0x13')][_0xa668a7]=new RuleEngine(_0xc892e6);_0x187d71[_0x6efc('0x13')][_0xa668a7][_0x6efc('0x30')](_0x15d210,function(_0x2bdb23){logger[_0x6efc('0x29')](_0x6efc('0x31'),JSON[_0x6efc('0x32')](_0x2bdb23[_0x6efc('0x33')]));if(_0x187d71[_0x6efc('0x13')][_0xa668a7]){_0x187d71[_0x6efc('0x13')][_0xa668a7][_0x6efc('0x34')](_0x6efc('0x35'));}});return _0x434054({'code':0xc8,'message':_0x15d210});}else{logger[_0x6efc('0x29')](_0x6efc('0x36'));return _0x434054({'code':0xc8,'message':_0x15d210});}}catch(_0x3719f3){logger[_0x6efc('0x37')](_0x3719f3['stack']);return _0x3557a6(_0x22badc['error'](0x1f4,_0x3719f3));}}return _0x3557a6(_0x6efc('0x38'));});},'AcceptMessage':function(_0x1503e8){var _0x3d5646=this;return new Promise(function(_0x1bc2ea,_0x37ef1f){if(_0x1503e8['message']&&_0x1503e8['message']['id']){try{var _0x77c2cc=getId(_0x1503e8['channel'],_0x1503e8[_0x6efc('0x14')]?_0x1503e8[_0x6efc('0x14')]['id']:0x0,_0x1503e8[_0x6efc('0x15')]?_0x1503e8['interaction']['id']:0x0);if(_0x187d71[_0x6efc('0x13')][_0x77c2cc]){_0x187d71[_0x6efc('0x13')][_0x77c2cc][_0x6efc('0x34')](_0x6efc('0x39'));if(rpc[_0x1503e8[_0x6efc('0x3a')]+'QueueReport']){rpc[_0x1503e8['channel']+_0x6efc('0x3b')][_0x6efc('0x3c')](_0x77c2cc,{'UserId':_0x1503e8[_0x6efc('0x14')][_0x6efc('0x3d')]})[_0x6efc('0x3e')](function(_0xde21c0){logger[_0x6efc('0x37')](_0x6efc('0x3f'));});}}return _0x1bc2ea({'code':0xc8,'message':_0x1503e8});}catch(_0x2930d4){logger[_0x6efc('0x37')](_0x2930d4[_0x6efc('0x40')]);return _0x37ef1f(_0x3d5646[_0x6efc('0x37')](0x1f4,_0x2930d4));}}logger[_0x6efc('0x37')](_0x6efc('0x41'));return _0x37ef1f(_0x3d5646[_0x6efc('0x37')](0x1f4,_0x6efc('0x41')));});},'RejectMessage':function(_0x4f142f){var _0x39e77a=this;return new Promise(function(_0x1e6d60,_0x58f193){if(_0x4f142f[_0x6efc('0x42')]&&_0x4f142f['agent']['id']){try{if(_0x187d71['agents'][_0x4f142f[_0x6efc('0x42')]['id']]){_0x187d71[_0x6efc('0x43')][_0x4f142f[_0x6efc('0x42')]['id']][_0x6efc('0x44')]=![];_0x187d71['agents'][_0x4f142f[_0x6efc('0x42')]['id']][_0x6efc('0x45')]=undefined;}return _0x1e6d60({'code':0xc8,'message':_0x4f142f});}catch(_0xd2aae6){logger[_0x6efc('0x37')](_0xd2aae6[_0x6efc('0x40')]);return _0x58f193(_0x39e77a[_0x6efc('0x37')](0x1f4,_0xd2aae6));}}logger[_0x6efc('0x37')](_0x6efc('0x41'));return _0x58f193(_0x39e77a[_0x6efc('0x37')](0x1f4,_0x6efc('0x41')));});},'AbandonInteraction':function(_0x600629){var _0xe27f1=this;return new Promise(function(_0x43c313,_0x3d72d7){if(_0x600629[_0x6efc('0x3a')]&&_0x600629[_0x6efc('0x15')]&&_0x600629[_0x6efc('0x15')]['id']){try{var _0x2f2f62=getId(_0x600629[_0x6efc('0x3a')],_0x600629['message']?_0x600629['message']['id']:0x0,_0x600629[_0x6efc('0x15')]?_0x600629['interaction']['id']:0x0);if(_0x187d71['rules'][_0x2f2f62]){_0x187d71[_0x6efc('0x13')][_0x2f2f62][_0x6efc('0x34')](_0x6efc('0x39'));}return _0x43c313({'code':0xc8,'message':_0x600629});}catch(_0x5022a5){logger[_0x6efc('0x37')](_0x5022a5[_0x6efc('0x40')]);return _0x3d72d7(_0xe27f1[_0x6efc('0x37')](0x1f4,_0x5022a5));}}logger['error']('message\x20is\x20empty');return _0x3d72d7(_0xe27f1[_0x6efc('0x37')](0x1f4,_0x6efc('0x41')));});},'AgentCapacity':function(_0x141ecb){var _0x100a23=this;return new Promise(function(_0x3d9be2,_0x51f211){if(_0x187d71[_0x6efc('0x43')][_0x6efc('0x46')](_0x141ecb['id'])){for(var _0x2d5955 in _0x141ecb[_0x6efc('0x47')]){if(_0x141ecb[_0x6efc('0x47')][_0x6efc('0x46')](_0x2d5955)){if(_0x187d71[_0x6efc('0x43')][_0x141ecb['id']][_0x6efc('0x46')](_0x2d5955+'CurrentCapacity')){_0x187d71[_0x6efc('0x43')][_0x141ecb['id']][_0x2d5955+_0x6efc('0x48')]=parseInt(_0x141ecb[_0x6efc('0x47')][_0x2d5955],0xa);}}}_0x187d71[_0x6efc('0x43')][_0x141ecb['id']][_0x6efc('0x49')]();return _0x3d9be2({'code':0xc8,'message':_0x187d71[_0x6efc('0x43')][_0x141ecb['id']]});}else{return _0x51f211(_0x100a23[_0x6efc('0x37')](0x1f4,_0x6efc('0x4a')));}});},'Agents':function(_0x21a210){return new Promise(function(_0x181b90,_0x3b5d65){var _0x44d3d4=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x43')]);_0x181b90({'count':_0x44d3d4['length'],'rows':_0x44d3d4});});},'ChatQueues':function(_0x3b8a9d){return new Promise(function(_0x2845ee,_0x50f639){var _0x54d1dc=[];for(var _0x5b4dfa in _0x187d71[_0x6efc('0x4c')]){if(_0x187d71['chatQueues']['hasOwnProperty'](_0x5b4dfa)){var _0x1f3a72=_0x187d71['chatQueues'][_0x5b4dfa];var _0x4b22a2={'id':_0x1f3a72['id'],'available':_0x1f3a72[_0x6efc('0x4d')],'loggedIn':_0x1f3a72[_0x6efc('0x4e')],'name':_0x1f3a72[_0x6efc('0x4f')],'paused':_0x1f3a72['paused'],'waiting':_0x1f3a72[_0x6efc('0x50')]};_0x54d1dc[_0x6efc('0x1e')](_0x4b22a2);}}_0x2845ee({'count':_0x54d1dc[_0x6efc('0x17')],'rows':_0x54d1dc});});},'MailQueues':function(_0x32e45a){return new Promise(function(_0x440f64,_0x4d4880){var _0xf80c9c=[];for(var _0x4a84ed in _0x187d71[_0x6efc('0x51')]){if(_0x187d71[_0x6efc('0x51')][_0x6efc('0x46')](_0x4a84ed)){var _0x2043d9=_0x187d71[_0x6efc('0x51')][_0x4a84ed];var _0x256014={'id':_0x2043d9['id'],'available':_0x2043d9[_0x6efc('0x4d')],'loggedIn':_0x2043d9['loggedIn'],'name':_0x2043d9[_0x6efc('0x4f')],'paused':_0x2043d9[_0x6efc('0x52')],'waiting':_0x2043d9[_0x6efc('0x50')]};_0xf80c9c[_0x6efc('0x1e')](_0x256014);}}_0x440f64({'count':_0xf80c9c[_0x6efc('0x17')],'rows':_0xf80c9c});});},'OpenchannelQueues':function(_0x4e84f6){return new Promise(function(_0x5b0226,_0x3855c2){var _0x30ae46=[];for(var _0x975843 in _0x187d71['openchannelQueues']){if(_0x187d71[_0x6efc('0x53')][_0x6efc('0x46')](_0x975843)){var _0x139e39=_0x187d71[_0x6efc('0x53')][_0x975843];var _0x3cd3f1={'id':_0x139e39['id'],'available':_0x139e39['available'],'loggedIn':_0x139e39[_0x6efc('0x4e')],'name':_0x139e39[_0x6efc('0x4f')],'paused':_0x139e39[_0x6efc('0x52')],'waiting':_0x139e39[_0x6efc('0x50')]};_0x30ae46['push'](_0x3cd3f1);}}_0x5b0226({'count':_0x30ae46[_0x6efc('0x17')],'rows':_0x30ae46});});},'SmsQueues':function(_0x3ad1eb){return new Promise(function(_0x40447c,_0x56f112){var _0x1594c3=[];for(var _0x7a73ed in _0x187d71[_0x6efc('0x54')]){if(_0x187d71['smsQueues'][_0x6efc('0x46')](_0x7a73ed)){var _0x4ff9ae=_0x187d71['smsQueues'][_0x7a73ed];var _0x1f08d8={'id':_0x4ff9ae['id'],'available':_0x4ff9ae[_0x6efc('0x4d')],'loggedIn':_0x4ff9ae[_0x6efc('0x4e')],'name':_0x4ff9ae[_0x6efc('0x4f')],'paused':_0x4ff9ae[_0x6efc('0x52')],'waiting':_0x4ff9ae['waiting']};_0x1594c3[_0x6efc('0x1e')](_0x1f08d8);}}_0x40447c({'count':_0x1594c3[_0x6efc('0x17')],'rows':_0x1594c3});});},'FaxQueues':function(_0x429eb2){return new Promise(function(_0x42b573,_0x23987e){var _0x11e87e=[];for(var _0x15c183 in _0x187d71[_0x6efc('0x55')]){if(_0x187d71[_0x6efc('0x55')][_0x6efc('0x46')](_0x15c183)){var _0x2767bf=_0x187d71['faxQueues'][_0x15c183];var _0x583269={'id':_0x2767bf['id'],'available':_0x2767bf['available'],'loggedIn':_0x2767bf[_0x6efc('0x4e')],'name':_0x2767bf[_0x6efc('0x4f')],'paused':_0x2767bf['paused'],'waiting':_0x2767bf[_0x6efc('0x50')]};_0x11e87e['push'](_0x583269);}}_0x42b573({'count':_0x11e87e[_0x6efc('0x17')],'rows':_0x11e87e});});},'WhatsappQueues':function(_0x4e79d2){return new Promise(function(_0x3ce6c0,_0x5b9c93){var _0xf3d478=[];for(var _0x4e805f in _0x187d71[_0x6efc('0x56')]){if(_0x187d71['whatsappQueues'][_0x6efc('0x46')](_0x4e805f)){var _0x530d12=_0x187d71[_0x6efc('0x56')][_0x4e805f];var _0x498756={'id':_0x530d12['id'],'available':_0x530d12[_0x6efc('0x4d')],'loggedIn':_0x530d12['loggedIn'],'name':_0x530d12['name'],'paused':_0x530d12[_0x6efc('0x52')],'waiting':_0x530d12[_0x6efc('0x50')]};_0xf3d478[_0x6efc('0x1e')](_0x498756);}}_0x3ce6c0({'count':_0xf3d478[_0x6efc('0x17')],'rows':_0xf3d478});});},'ChatQueuesWaitingInteractions':function(_0x33e5b7){return new Promise(function(_0x590304,_0x4b1ea1){var _0x2570ee=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x57')]);_0x590304({'count':_0x2570ee['length'],'rows':_0x2570ee});});},'MailQueuesWaitingInteractions':function(_0x158e86){return new Promise(function(_0x17fe27,_0x1eb46a){var _0x3a57cb=_['values'](_0x187d71[_0x6efc('0x58')]);_0x17fe27({'count':_0x3a57cb[_0x6efc('0x17')],'rows':_0x3a57cb});});},'OpenchannelQueuesWaitingInteractions':function(_0x397839){return new Promise(function(_0x4dde60,_0x5b0857){var _0xe20e62=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x59')]);_0x4dde60({'count':_0xe20e62[_0x6efc('0x17')],'rows':_0xe20e62});});},'SmsQueuesWaitingInteractions':function(_0x1df85a){return new Promise(function(_0xac0230,_0x3c484c){var _0x39dd76=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x5a')]);_0xac0230({'count':_0x39dd76[_0x6efc('0x17')],'rows':_0x39dd76});});},'FaxQueuesWaitingInteractions':function(_0x36c4c3){return new Promise(function(_0x5301a3,_0x2c110e){var _0x13a4ee=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x5b')]);_0x5301a3({'count':_0x13a4ee[_0x6efc('0x17')],'rows':_0x13a4ee});});},'WhatsappQueuesWaitingInteractions':function(_0x28a54f){return new Promise(function(_0xae0c1a,_0x5a9852){var _0x4c3a64=_[_0x6efc('0x4b')](_0x187d71['whatsappQueuesWaitingInteractions']);_0xae0c1a({'count':_0x4c3a64['length'],'rows':_0x4c3a64});});}};var _0x22950b=jayson[_0x6efc('0x5c')](_0xadd1fd)['http']();_0x22950b['on']('error',function(_0x539ed7){logger[_0x6efc('0x37')](JSON[_0x6efc('0x32')](_0x539ed7));return _0x585580(_0x539ed7);});_0x22950b[_0x6efc('0x12')](0x232c,_0x6efc('0x5d'),function(){console[_0x6efc('0x5e')](_0x6efc('0x5f'),0x232c);return _0x21d4fd(_0x6efc('0x60')+0x232c);});});}; \ No newline at end of file +var _0xd0b9=['mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','isArray','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','TagId','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','name','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0x24c135,_0xdb4450){var _0x290c66=function(_0x537cf8){while(--_0x537cf8){_0x24c135['push'](_0x24c135['shift']());}};_0x290c66(++_0xdb4450);}(_0xd0b9,0x1df));var _0x9d0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d0b('0x0'));var util=require(_0x9d0b('0x1'));var path=require(_0x9d0b('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x9d0b('0x3'));var uuid=require(_0x9d0b('0x4'));var config=require(_0x9d0b('0x5'));var logger=require(_0x9d0b('0x6'))(_0x9d0b('0x7'));var rpc={'openchannelQueueReport':require(_0x9d0b('0x8')),'mailQueueReport':require(_0x9d0b('0x9')),'chatQueueReport':require(_0x9d0b('0xa')),'smsQueueReport':require(_0x9d0b('0xb')),'faxQueueReport':require(_0x9d0b('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x9d0b('0xd'));function getId(_0x5e35d3,_0xa3031b,_0x314d25){return util[_0x9d0b('0xe')]('%s.%s.%s',_0x5e35d3,_0xa3031b||0x0,_0x314d25||0x0);}function getIntervals(_0x5b554f,_0x1b4fb4){var _0x4a0ef3=[];if(!_[_0x9d0b('0xf')](_0x1b4fb4[_0x9d0b('0x10')])&&!_[_0x9d0b('0xf')](_0x5b554f[_0x1b4fb4[_0x9d0b('0x10')]])&&!_[_0x9d0b('0xf')](_0x5b554f[_0x1b4fb4['IntervalId']][_0x9d0b('0x11')])){_0x4a0ef3=_[_0x9d0b('0x12')](_0x5b554f[_0x1b4fb4['IntervalId']][_0x9d0b('0x11')],'interval');}else if(!_[_0x9d0b('0xf')](_0x1b4fb4[_0x9d0b('0x13')])){_0x4a0ef3=[_0x1b4fb4[_0x9d0b('0x13')]];}return _0x4a0ef3;}exports[_0x9d0b('0x14')]=function(_0x2a651f){_0x2a651f['rules']={};return new BPromise(function(_0x3f0feb,_0x3c86bd){var _0x3b7dab={'Start':function(_0x5afa59){var _0x4f4a41=this;return new Promise(function(_0x1f1646,_0x122a93){if(_0x5afa59){try{var _0xe7c84f=[];var _0x9865f6=getId(_0x5afa59[_0x9d0b('0x15')],_0x5afa59[_0x9d0b('0x16')]?_0x5afa59[_0x9d0b('0x16')]['id']:0x0,_0x5afa59[_0x9d0b('0x17')]?_0x5afa59[_0x9d0b('0x17')]['id']:0x0);if(_0x5afa59['applications']&&_[_0x9d0b('0x18')](_0x5afa59[_0x9d0b('0x19')])&&_0x5afa59[_0x9d0b('0x19')][_0x9d0b('0x1a')]){for(var _0x5e2d18=0x0;_0x5e2d18<_0x5afa59[_0x9d0b('0x19')][_0x9d0b('0x1a')];_0x5e2d18+=0x1){var _0x3ffa11=_0x5afa59['applications'][_0x5e2d18];if(fs['existsSync'](path[_0x9d0b('0x1b')](__dirname,_0x9d0b('0x19'),_0x3ffa11[_0x9d0b('0x1c')]+_0x9d0b('0x1d')))){var _0x5cddea=[];switch(_0x3ffa11['app'][_0x9d0b('0x1e')]()){case _0x9d0b('0x1f'):var _0xfc081c=_0x3ffa11[_0x9d0b('0x20')][_0x9d0b('0x21')](',');_0x5cddea[_0x9d0b('0x22')](_0xfc081c[0x0]);_0x5cddea['push'](_0xfc081c[_0x9d0b('0x23')](0x1,_0xfc081c['length'])[_0x9d0b('0x1b')](','));break;case _0x9d0b('0x24'):var _0x2c0976=_0x3ffa11[_0x9d0b('0x20')]['split'](',');_0x5cddea['push'](_0x2c0976[0x0]);_0x5cddea[_0x9d0b('0x22')](_0x2c0976[0x1]);_0x5cddea[_0x9d0b('0x22')](_0x2c0976[_0x9d0b('0x23')](0x2,_0x2c0976[_0x9d0b('0x1a')])[_0x9d0b('0x1b')](','));break;case _0x9d0b('0x25'):var _0xe83591=_0x3ffa11[_0x9d0b('0x20')]['split'](',');_0x5cddea['push'](_0xe83591[0x0]);_0x5cddea[_0x9d0b('0x22')](_0xe83591[0x1]);_0x5cddea[_0x9d0b('0x22')](_0xe83591[0x2]);_0x5cddea[_0x9d0b('0x22')](_0xe83591[0x3]);_0x5cddea['push'](_0xe83591['slice'](0x4,_0xe83591[_0x9d0b('0x1a')])['join'](','));break;case'message':_0x5cddea[_0x9d0b('0x22')](_0x3ffa11[_0x9d0b('0x20')]);break;case'tag':_0x5cddea[_0x9d0b('0x22')](_0x3ffa11[_0x9d0b('0x26')]);_0x5cddea[_0x9d0b('0x22')](_0x3ffa11[_0x9d0b('0x20')]);break;default:_0x5cddea=_[_0x9d0b('0xf')](_0x3ffa11['appdata'])?[]:_0x3ffa11[_0x9d0b('0x20')][_0x9d0b('0x21')](',');}var _0x292c71={'id':util['format']('%s:%s:%s',_0x9865f6,_0x3ffa11['id'],_0x3ffa11[_0x9d0b('0x1c')]),'condition':require('./interval')[_0x9d0b('0x27')](_0x9865f6,getIntervals(_0x2a651f[_0x9d0b('0x28')],_0x3ffa11),_0x2a651f),'consequence':require(_0x9d0b('0x29')+_0x3ffa11['app'])[_0x9d0b('0x2a')](_0x9865f6,_0x5cddea,_0x2a651f,_0x5afa59),'p':_0x3ffa11[_0x9d0b('0x2b')]||0x0};logger[_0x9d0b('0x2c')]('Push\x20new\x20rule',_0x292c71['id'],_0x9d0b('0x2d'),getIntervals(_0x2a651f[_0x9d0b('0x28')],_0x3ffa11)[_0x9d0b('0x1b')]('\x20|\x20'));_0xe7c84f[_0x9d0b('0x22')](_0x292c71);}else{logger[_0x9d0b('0x2e')](_0x9d0b('0x2f'),path[_0x9d0b('0x1b')](__dirname,_0x9d0b('0x19'),_0x3ffa11[_0x9d0b('0x1c')]+'.js'));}}_0x2a651f['rules'][_0x9865f6]=new RuleEngine(_0xe7c84f);_0x2a651f[_0x9d0b('0x30')][_0x9865f6][_0x9d0b('0x31')](_0x5afa59,function(_0x27ca0f){logger['info'](_0x9d0b('0x32'),JSON[_0x9d0b('0x33')](_0x27ca0f[_0x9d0b('0x34')]));if(_0x2a651f[_0x9d0b('0x30')][_0x9865f6]){_0x2a651f[_0x9d0b('0x30')][_0x9865f6][_0x9d0b('0x35')](_0x9d0b('0x36'));}});return _0x1f1646({'code':0xc8,'message':_0x5afa59});}else{logger[_0x9d0b('0x2c')](_0x9d0b('0x37'));return _0x1f1646({'code':0xc8,'message':_0x5afa59});}}catch(_0x2f1c12){logger[_0x9d0b('0x2e')](_0x2f1c12['stack']);return _0x122a93(_0x4f4a41[_0x9d0b('0x2e')](0x1f4,_0x2f1c12));}}return _0x122a93(_0x9d0b('0x38'));});},'AcceptMessage':function(_0x2d4437){var _0x56c4e5=this;return new Promise(function(_0x5d2270,_0xe8eb3c){if(_0x2d4437[_0x9d0b('0x16')]&&_0x2d4437[_0x9d0b('0x16')]['id']){try{var _0x1b3ded=getId(_0x2d4437[_0x9d0b('0x15')],_0x2d4437[_0x9d0b('0x16')]?_0x2d4437[_0x9d0b('0x16')]['id']:0x0,_0x2d4437[_0x9d0b('0x17')]?_0x2d4437[_0x9d0b('0x17')]['id']:0x0);if(_0x2a651f[_0x9d0b('0x30')][_0x1b3ded]){_0x2a651f[_0x9d0b('0x30')][_0x1b3ded][_0x9d0b('0x35')](_0x9d0b('0x39'));if(rpc[_0x2d4437['channel']+_0x9d0b('0x3a')]){rpc[_0x2d4437[_0x9d0b('0x15')]+_0x9d0b('0x3a')]['update'](_0x1b3ded,{'UserId':_0x2d4437['message'][_0x9d0b('0x3b')]})[_0x9d0b('0x3c')](function(_0x22643a){logger[_0x9d0b('0x2e')](_0x9d0b('0x3d'));});}}return _0x5d2270({'code':0xc8,'message':_0x2d4437});}catch(_0x161d72){logger[_0x9d0b('0x2e')](_0x161d72[_0x9d0b('0x3e')]);return _0xe8eb3c(_0x56c4e5[_0x9d0b('0x2e')](0x1f4,_0x161d72));}}logger['error'](_0x9d0b('0x3f'));return _0xe8eb3c(_0x56c4e5[_0x9d0b('0x2e')](0x1f4,_0x9d0b('0x3f')));});},'RejectMessage':function(_0x141af0){var _0x71d22b=this;return new Promise(function(_0x26682c,_0x547cd4){if(_0x141af0[_0x9d0b('0x40')]&&_0x141af0['agent']['id']){try{if(_0x2a651f[_0x9d0b('0x41')][_0x141af0[_0x9d0b('0x40')]['id']]){_0x2a651f[_0x9d0b('0x41')][_0x141af0[_0x9d0b('0x40')]['id']][_0x9d0b('0x42')]=![];_0x2a651f[_0x9d0b('0x41')][_0x141af0[_0x9d0b('0x40')]['id']]['busyQueue']=undefined;}return _0x26682c({'code':0xc8,'message':_0x141af0});}catch(_0x18a1b5){logger['error'](_0x18a1b5[_0x9d0b('0x3e')]);return _0x547cd4(_0x71d22b['error'](0x1f4,_0x18a1b5));}}logger[_0x9d0b('0x2e')](_0x9d0b('0x3f'));return _0x547cd4(_0x71d22b['error'](0x1f4,_0x9d0b('0x3f')));});},'AbandonInteraction':function(_0x19d2ed){var _0x510830=this;return new Promise(function(_0x4e673e,_0x2f214b){if(_0x19d2ed[_0x9d0b('0x15')]&&_0x19d2ed[_0x9d0b('0x17')]&&_0x19d2ed['interaction']['id']){try{var _0x37e318=getId(_0x19d2ed['channel'],_0x19d2ed[_0x9d0b('0x16')]?_0x19d2ed['message']['id']:0x0,_0x19d2ed['interaction']?_0x19d2ed[_0x9d0b('0x17')]['id']:0x0);if(_0x2a651f[_0x9d0b('0x30')][_0x37e318]){_0x2a651f[_0x9d0b('0x30')][_0x37e318][_0x9d0b('0x35')]('end');}return _0x4e673e({'code':0xc8,'message':_0x19d2ed});}catch(_0x197734){logger[_0x9d0b('0x2e')](_0x197734['stack']);return _0x2f214b(_0x510830['error'](0x1f4,_0x197734));}}logger['error'](_0x9d0b('0x3f'));return _0x2f214b(_0x510830[_0x9d0b('0x2e')](0x1f4,_0x9d0b('0x3f')));});},'AgentCapacity':function(_0x5944b4){var _0x5e1a48=this;return new Promise(function(_0x1b8aec,_0x4dd0e2){if(_0x2a651f[_0x9d0b('0x41')][_0x9d0b('0x43')](_0x5944b4['id'])){for(var _0x1bd05f in _0x5944b4[_0x9d0b('0x44')]){if(_0x5944b4[_0x9d0b('0x44')][_0x9d0b('0x43')](_0x1bd05f)){if(_0x2a651f[_0x9d0b('0x41')][_0x5944b4['id']][_0x9d0b('0x43')](_0x1bd05f+'CurrentCapacity')){_0x2a651f[_0x9d0b('0x41')][_0x5944b4['id']][_0x1bd05f+_0x9d0b('0x45')]=parseInt(_0x5944b4['capacity'][_0x1bd05f],0xa);}}}_0x2a651f[_0x9d0b('0x41')][_0x5944b4['id']][_0x9d0b('0x46')]();return _0x1b8aec({'code':0xc8,'message':_0x2a651f[_0x9d0b('0x41')][_0x5944b4['id']]});}else{return _0x4dd0e2(_0x5e1a48[_0x9d0b('0x2e')](0x1f4,_0x9d0b('0x47')));}});},'Agents':function(_0x4534d3){return new Promise(function(_0x210b52,_0x4dc9a4){var _0x44f57f=_[_0x9d0b('0x48')](_0x2a651f[_0x9d0b('0x41')]);_0x210b52({'count':_0x44f57f[_0x9d0b('0x1a')],'rows':_0x44f57f});});},'ChatQueues':function(_0x1c3eb3){return new Promise(function(_0x5b9f15,_0x3b0a14){var _0x1ee298=[];for(var _0x3241d5 in _0x2a651f[_0x9d0b('0x49')]){if(_0x2a651f[_0x9d0b('0x49')][_0x9d0b('0x43')](_0x3241d5)){var _0x27f62d=_0x2a651f['chatQueues'][_0x3241d5];var _0x37db5d={'id':_0x27f62d['id'],'available':_0x27f62d[_0x9d0b('0x4a')],'loggedIn':_0x27f62d[_0x9d0b('0x4b')],'name':_0x27f62d['name'],'paused':_0x27f62d[_0x9d0b('0x4c')],'waiting':_0x27f62d['waiting']};_0x1ee298[_0x9d0b('0x22')](_0x37db5d);}}_0x5b9f15({'count':_0x1ee298[_0x9d0b('0x1a')],'rows':_0x1ee298});});},'MailQueues':function(_0x5ad837){return new Promise(function(_0x19ba68,_0x6ec22b){var _0x3132ea=[];for(var _0x4e4521 in _0x2a651f[_0x9d0b('0x4d')]){if(_0x2a651f['mailQueues'][_0x9d0b('0x43')](_0x4e4521)){var _0x431f49=_0x2a651f[_0x9d0b('0x4d')][_0x4e4521];var _0x5b68a8={'id':_0x431f49['id'],'available':_0x431f49[_0x9d0b('0x4a')],'loggedIn':_0x431f49[_0x9d0b('0x4b')],'name':_0x431f49['name'],'paused':_0x431f49[_0x9d0b('0x4c')],'waiting':_0x431f49[_0x9d0b('0x4e')]};_0x3132ea[_0x9d0b('0x22')](_0x5b68a8);}}_0x19ba68({'count':_0x3132ea['length'],'rows':_0x3132ea});});},'OpenchannelQueues':function(_0x44fb33){return new Promise(function(_0x464a05,_0x21c0c2){var _0x3e4426=[];for(var _0x5e33ca in _0x2a651f['openchannelQueues']){if(_0x2a651f[_0x9d0b('0x4f')]['hasOwnProperty'](_0x5e33ca)){var _0x1b93b6=_0x2a651f['openchannelQueues'][_0x5e33ca];var _0x556fe2={'id':_0x1b93b6['id'],'available':_0x1b93b6['available'],'loggedIn':_0x1b93b6[_0x9d0b('0x4b')],'name':_0x1b93b6['name'],'paused':_0x1b93b6[_0x9d0b('0x4c')],'waiting':_0x1b93b6['waiting']};_0x3e4426[_0x9d0b('0x22')](_0x556fe2);}}_0x464a05({'count':_0x3e4426[_0x9d0b('0x1a')],'rows':_0x3e4426});});},'SmsQueues':function(_0x1843a7){return new Promise(function(_0xfb8062,_0x3ba967){var _0x134f9a=[];for(var _0x2a7a8c in _0x2a651f['smsQueues']){if(_0x2a651f[_0x9d0b('0x50')][_0x9d0b('0x43')](_0x2a7a8c)){var _0x5b5e01=_0x2a651f[_0x9d0b('0x50')][_0x2a7a8c];var _0x4d03ee={'id':_0x5b5e01['id'],'available':_0x5b5e01[_0x9d0b('0x4a')],'loggedIn':_0x5b5e01[_0x9d0b('0x4b')],'name':_0x5b5e01['name'],'paused':_0x5b5e01[_0x9d0b('0x4c')],'waiting':_0x5b5e01[_0x9d0b('0x4e')]};_0x134f9a[_0x9d0b('0x22')](_0x4d03ee);}}_0xfb8062({'count':_0x134f9a[_0x9d0b('0x1a')],'rows':_0x134f9a});});},'FaxQueues':function(_0x52b8fd){return new Promise(function(_0x5f3c1c,_0x993dec){var _0x10dc4e=[];for(var _0x18bef6 in _0x2a651f[_0x9d0b('0x51')]){if(_0x2a651f['faxQueues'][_0x9d0b('0x43')](_0x18bef6)){var _0x565647=_0x2a651f[_0x9d0b('0x51')][_0x18bef6];var _0x3fd07e={'id':_0x565647['id'],'available':_0x565647[_0x9d0b('0x4a')],'loggedIn':_0x565647['loggedIn'],'name':_0x565647[_0x9d0b('0x52')],'paused':_0x565647[_0x9d0b('0x4c')],'waiting':_0x565647[_0x9d0b('0x4e')]};_0x10dc4e[_0x9d0b('0x22')](_0x3fd07e);}}_0x5f3c1c({'count':_0x10dc4e[_0x9d0b('0x1a')],'rows':_0x10dc4e});});},'WhatsappQueues':function(_0xc2b734){return new Promise(function(_0x234db0,_0x1bf189){var _0x1adc5c=[];for(var _0x141962 in _0x2a651f[_0x9d0b('0x53')]){if(_0x2a651f[_0x9d0b('0x53')][_0x9d0b('0x43')](_0x141962)){var _0x5ee2b3=_0x2a651f[_0x9d0b('0x53')][_0x141962];var _0x493cd9={'id':_0x5ee2b3['id'],'available':_0x5ee2b3[_0x9d0b('0x4a')],'loggedIn':_0x5ee2b3[_0x9d0b('0x4b')],'name':_0x5ee2b3[_0x9d0b('0x52')],'paused':_0x5ee2b3[_0x9d0b('0x4c')],'waiting':_0x5ee2b3[_0x9d0b('0x4e')]};_0x1adc5c[_0x9d0b('0x22')](_0x493cd9);}}_0x234db0({'count':_0x1adc5c[_0x9d0b('0x1a')],'rows':_0x1adc5c});});},'ChatQueuesWaitingInteractions':function(_0x44c0cc){return new Promise(function(_0x37af13,_0x105269){var _0x32c89e=_[_0x9d0b('0x48')](_0x2a651f[_0x9d0b('0x54')]);_0x37af13({'count':_0x32c89e['length'],'rows':_0x32c89e});});},'MailQueuesWaitingInteractions':function(_0x5a756b){return new Promise(function(_0x429475,_0x30ea69){var _0x477b74=_[_0x9d0b('0x48')](_0x2a651f[_0x9d0b('0x55')]);_0x429475({'count':_0x477b74['length'],'rows':_0x477b74});});},'OpenchannelQueuesWaitingInteractions':function(_0x30435d){return new Promise(function(_0x3d3972,_0x7b0039){var _0x1fa75f=_['values'](_0x2a651f['openchannelQueuesWaitingInteractions']);_0x3d3972({'count':_0x1fa75f['length'],'rows':_0x1fa75f});});},'SmsQueuesWaitingInteractions':function(_0x6bb981){return new Promise(function(_0x177ecd,_0x191445){var _0x869854=_['values'](_0x2a651f[_0x9d0b('0x56')]);_0x177ecd({'count':_0x869854[_0x9d0b('0x1a')],'rows':_0x869854});});},'FaxQueuesWaitingInteractions':function(_0x5c9153){return new Promise(function(_0x595181,_0x1ab734){var _0xf0a724=_[_0x9d0b('0x48')](_0x2a651f[_0x9d0b('0x57')]);_0x595181({'count':_0xf0a724[_0x9d0b('0x1a')],'rows':_0xf0a724});});},'WhatsappQueuesWaitingInteractions':function(_0xf338fb){return new Promise(function(_0x5a3149,_0x5ee0d4){var _0x5e0b51=_[_0x9d0b('0x48')](_0x2a651f[_0x9d0b('0x58')]);_0x5a3149({'count':_0x5e0b51[_0x9d0b('0x1a')],'rows':_0x5e0b51});});}};var _0x3e42fe=jayson[_0x9d0b('0x59')](_0x3b7dab)[_0x9d0b('0x5a')]();_0x3e42fe['on'](_0x9d0b('0x2e'),function(_0x4901c5){logger['error'](JSON[_0x9d0b('0x33')](_0x4901c5));return _0x3c86bd(_0x4901c5);});_0x3e42fe[_0x9d0b('0x14')](0x232c,_0x9d0b('0x5b'),function(){console[_0x9d0b('0x5c')](_0x9d0b('0x5d'),0x232c);return _0x3f0feb('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 72e05d2..749b4e2 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 _0x3be8=['then','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','when','log','stop','util','bluebird','jayson/promise','routing','client','http','request'];(function(_0x1b44cf,_0x4aaa5e){var _0x4620f9=function(_0x7e06e1){while(--_0x7e06e1){_0x1b44cf['push'](_0x1b44cf['shift']());}};_0x4620f9(++_0x4aaa5e);}(_0x3be8,0x1b9));var _0x83be=function(_0x5ea7e0,_0x2f46f2){_0x5ea7e0=_0x5ea7e0-0x0;var _0x1c49c7=_0x3be8[_0x5ea7e0];return _0x1c49c7;};'use strict';var util=require(_0x83be('0x0'));var BPromise=require(_0x83be('0x1'));var jayson=require(_0x83be('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x83be('0x3'));var client=jayson[_0x83be('0x4')][_0x83be('0x5')]({'port':0x232a});function request(_0x1252f5,_0x2f07f1){return new BPromise(function(_0x2cc38,_0x39b566){return client[_0x83be('0x6')](_0x1252f5,_0x2f07f1)[_0x83be('0x7')](function(_0x14ef0a){if(_0x14ef0a['error']){return _0x39b566(_0x14ef0a[_0x83be('0x8')]['message']);}else{return _0x2cc38(_0x14ef0a[_0x83be('0x9')]);}})[_0x83be('0xa')](function(_0x3e9357){return _0x39b566(_0x3e9357);});});}exports['condition']=function(_0x49fc27,_0x2bcc78,_0x11d452){return function(_0x4ce562){if(_0x11d452[_0x83be('0xb')]&&!_0x11d452[_0x83be('0xb')][_0x49fc27]){logger[_0x83be('0xc')](_0x83be('0xd'),_0x49fc27);return _0x4ce562['stop']();}var _0x49694f=[];for(var _0x50d6e9=0x0;_0x50d6e9<_0x2bcc78[_0x83be('0xe')];_0x50d6e9+=0x1){_0x49694f[_0x83be('0xf')](request(_0x83be('0x10'),{'command':util[_0x83be('0x11')](_0x83be('0x12'),_0x2bcc78[_0x50d6e9])})[_0x83be('0x7')](function(_0x35e02a){return _0x35e02a&&_0x35e02a[_0x83be('0x13')]&&_0x35e02a['message'][_0x83be('0x14')](_0x83be('0x15'))>=0x0?!![]:![];})[_0x83be('0xa')](function(_0x285da0){logger[_0x83be('0x8')](_0x83be('0x16'),_0x49fc27,_0x2bcc78[_0x50d6e9]);}));}BPromise['all'](_0x49694f)[_0x83be('0x7')](function(_0x5ba20a){var _0x2a17ca=_[_0x83be('0x17')](_0x5ba20a);logger[_0x83be('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x49fc27,_0x2bcc78['join'](_0x83be('0x18')),_0x2a17ca);_0x4ce562[_0x83be('0x19')](_0x2a17ca);})[_0x83be('0xa')](function(_0x5054d6){console[_0x83be('0x1a')](_0x5054d6);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x49fc27,_0x2bcc78['join']('\x20|\x20'),_0x5054d6['stack']);_0x4ce562[_0x83be('0x1b')]();});};}; \ No newline at end of file +var _0x3715=['catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','message','true'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3715,0x120));var _0x5371=function(_0x5711ea,_0x14511c){_0x5711ea=_0x5711ea-0x0;var _0xb94449=_0x3715[_0x5711ea];return _0xb94449;};'use strict';var util=require(_0x5371('0x0'));var BPromise=require(_0x5371('0x1'));var jayson=require(_0x5371('0x2'));var _=require(_0x5371('0x3'));var logger=require(_0x5371('0x4'))(_0x5371('0x5'));var client=jayson['client'][_0x5371('0x6')]({'port':0x232a});function request(_0x35a4de,_0x255324){return new BPromise(function(_0x13b266,_0x3f0cbe){return client[_0x5371('0x7')](_0x35a4de,_0x255324)[_0x5371('0x8')](function(_0x29f5a9){if(_0x29f5a9[_0x5371('0x9')]){return _0x3f0cbe(_0x29f5a9[_0x5371('0x9')]['message']);}else{return _0x13b266(_0x29f5a9['result']);}})['catch'](function(_0x28accf){return _0x3f0cbe(_0x28accf);});});}exports['condition']=function(_0x70c864,_0x5647a4,_0x5eadaf){return function(_0x4b0c44){if(_0x5eadaf[_0x5371('0xa')]&&!_0x5eadaf[_0x5371('0xa')][_0x70c864]){logger[_0x5371('0xb')](_0x5371('0xc'),_0x70c864);return _0x4b0c44[_0x5371('0xd')]();}var _0xf13889=[];for(var _0x2f3863=0x0;_0x2f3863<_0x5647a4[_0x5371('0xe')];_0x2f3863+=0x1){_0xf13889[_0x5371('0xf')](request(_0x5371('0x10'),{'command':util[_0x5371('0x11')]('iftime\x20%s',_0x5647a4[_0x2f3863])})[_0x5371('0x8')](function(_0x1105d2){return _0x1105d2&&_0x1105d2[_0x5371('0x12')]&&_0x1105d2[_0x5371('0x12')]['indexOf'](_0x5371('0x13'))>=0x0?!![]:![];})[_0x5371('0x14')](function(_0x292495){logger['error'](_0x5371('0x15'),_0x70c864,_0x5647a4[_0x2f3863]);}));}BPromise[_0x5371('0x16')](_0xf13889)[_0x5371('0x8')](function(_0x4922c8){var _0x421e64=_[_0x5371('0x17')](_0x4922c8);logger[_0x5371('0xb')](_0x5371('0x18'),_0x70c864,_0x5647a4[_0x5371('0x19')](_0x5371('0x1a')),_0x421e64);_0x4b0c44[_0x5371('0x1b')](_0x421e64);})[_0x5371('0x14')](function(_0x4b75fb){console['log'](_0x4b75fb);logger[_0x5371('0x9')](_0x5371('0x18'),_0x70c864,_0x5647a4[_0x5371('0x19')](_0x5371('0x1a')),_0x4b75fb['stack']);_0x4b0c44[_0x5371('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8057a8a..969d7d9 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 _0xce13=['origtransfereruniqueid','transfer','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','rejected','indexOf','splice','agent','lodash','util','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','membername','interface','calleridnum','connectedlinenum','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','agentcalled','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','push','queuecallerabandon','forIn','uniqueid','includes','abandoned','holdtime','talktime','agentconnectAt','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','blind','extension','transferuniqueid','attendedtransfer'];(function(_0x76e8a,_0x35dd32){var _0x37dd9c=function(_0x1d8a13){while(--_0x1d8a13){_0x76e8a['push'](_0x76e8a['shift']());}};_0x37dd9c(++_0x35dd32);}(_0xce13,0xe3));var _0x3ce1=function(_0x34f286,_0x175816){_0x34f286=_0x34f286-0x0;var _0xd7be31=_0xce13[_0x34f286];return _0xd7be31;};'use strict';var _=require(_0x3ce1('0x0'));var util=require(_0x3ce1('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x217b08,_0x73a969){utils[_0x3ce1('0x2')](util[_0x3ce1('0x3')](_0x3ce1('0x4'),_0x217b08['uniqueid'],_0x217b08[_0x3ce1('0x5')],_0x217b08['queue'],_0x217b08[_0x3ce1('0x6')],_0x217b08[_0x3ce1('0x7')],_0x217b08[_0x3ce1('0x8')],_0x217b08[_0x3ce1('0x9')],_0x217b08['lastevent']));if(_0x217b08[_0x3ce1('0xa')]){utils['getVoiceQueueByName'](_0x217b08[_0x3ce1('0xa')])[_0x3ce1('0xb')](function(_0x5e8fbf){if(_0x5e8fbf){_0x217b08[_0x3ce1('0xc')]=_0x5e8fbf[_0x3ce1('0xc')];_0x217b08[_0x3ce1('0xd')]=_0x217b08[_0x3ce1('0xe')]?_0x5e8fbf['acw']:![];_0x217b08[_0x3ce1('0xf')]=_0x217b08[_0x3ce1('0xd')]?_0x5e8fbf[_0x3ce1('0x10')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x217b08);});}else{utils[_0x3ce1('0x11')]('CreateVoiceAgentReport',_0x217b08);}if(_0x73a969){delete transfers[_0x217b08['uniqueid']];}else{delete agents[_0x217b08['destuniqueid']];}}exports[_0x3ce1('0x12')]=function(_0x4b5d38){try{agents[_0x4b5d38[_0x3ce1('0x13')]]=_0x4b5d38;agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x14')]=utils[_0x3ce1('0x15')]();agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x16')]='called';agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x9')]=null;agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x17')]=null;}catch(_0xcb2096){utils[_0x3ce1('0x18')](_0xcb2096[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x1a')]=function(_0x47b9b2){try{if(!_[_0x3ce1('0x1b')](agents[_0x47b9b2[_0x3ce1('0x13')]])){agents[_0x47b9b2['destuniqueid']][_0x3ce1('0x1a')]=!![];agents[_0x47b9b2['destuniqueid']][_0x3ce1('0x1c')]=utils[_0x3ce1('0x15')]();agents[_0x47b9b2[_0x3ce1('0x13')]][_0x3ce1('0x16')]=_0x3ce1('0x1d');agents[_0x47b9b2[_0x3ce1('0x13')]][_0x3ce1('0x1e')]='timeout';agents[_0x47b9b2['destuniqueid']]['holdtime']=_0x47b9b2['ringtime']?parseInt(_0x47b9b2['ringtime'])/0x3e8:0x0;agents[_0x47b9b2['destuniqueid']]['talktime']=0x0;unanswered[_0x3ce1('0x1f')](_0x47b9b2[_0x3ce1('0x13')]);}}catch(_0x2a36da){utils[_0x3ce1('0x18')](_0x2a36da[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x20')]=function(_0x237667){try{_[_0x3ce1('0x21')](agents,function(_0x478382,_0x37f6a8){if(_0x478382['uniqueid']==_0x237667[_0x3ce1('0x22')]&&!_[_0x3ce1('0x23')](unanswered,_0x478382['destuniqueid'])){_0x478382[_0x3ce1('0x1a')]=!![];_0x478382[_0x3ce1('0x1c')]=utils[_0x3ce1('0x15')]();_0x478382[_0x3ce1('0x16')]=_0x3ce1('0x24');_0x478382[_0x3ce1('0x1e')]='abandoned';_0x478382['holdtime']=_0x237667[_0x3ce1('0x25')];_0x478382[_0x3ce1('0x26')]=0x0;writeDB(_0x478382);}});}catch(_0x583eec){utils['error'](_0x583eec[_0x3ce1('0x19')]);}};exports['agentconnect']=function(_0x3e2dba){try{if(agents[_0x3e2dba[_0x3ce1('0x13')]]){agents[_0x3e2dba[_0x3ce1('0x13')]][_0x3ce1('0x27')]=utils['now']();agents[_0x3e2dba[_0x3ce1('0x13')]]['connectedlinenum']=_0x3e2dba[_0x3ce1('0x9')];agents[_0x3e2dba['destuniqueid']]['connectedlinename']=_0x3e2dba[_0x3ce1('0x17')];agents[_0x3e2dba[_0x3ce1('0x13')]][_0x3ce1('0x25')]=_0x3e2dba[_0x3ce1('0x28')];agents[_0x3e2dba['destuniqueid']]['lastevent']='connect';_[_0x3ce1('0x21')](agents,function(_0x2702e0,_0x2bf4e5){if(_0x2702e0['destuniqueid']!=_0x3e2dba[_0x3ce1('0x13')]&&_0x2702e0[_0x3ce1('0x22')]==_0x3e2dba[_0x3ce1('0x22')]){_0x2702e0[_0x3ce1('0x26')]=0x0;_0x2702e0[_0x3ce1('0x25')]=_0x3e2dba[_0x3ce1('0x28')];_0x2702e0[_0x3ce1('0x1a')]=!![];_0x2702e0[_0x3ce1('0x1c')]=utils[_0x3ce1('0x15')]();_0x2702e0['lastevent']='answered_elsewhere';_0x2702e0[_0x3ce1('0x1e')]=_0x3ce1('0x29');_0x2702e0[_0x3ce1('0x2a')]=_0x3e2dba[_0x3ce1('0x13')];_0x2702e0[_0x3ce1('0x2b')]=_0x3e2dba['membername'];writeDB(_0x2702e0);}});}}catch(_0x532ef7){utils[_0x3ce1('0x18')](_0x532ef7[_0x3ce1('0x19')]);}};exports[_0x3ce1('0xe')]=function(_0xb87344){try{if(!_[_0x3ce1('0x1b')](agents[_0xb87344[_0x3ce1('0x13')]])){agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0xe')]=!![];agents[_0xb87344['destuniqueid']]['agentcompleteAt']=utils[_0x3ce1('0x15')]();agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x26')]=utils[_0x3ce1('0x2c')](agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x2d')],agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x27')]);agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x1e')]=_0xb87344[_0x3ce1('0x1e')];agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x16')]=_0x3ce1('0x2e');writeDB(agents[_0xb87344[_0x3ce1('0x13')]]);}}catch(_0x37bf8a){utils[_0x3ce1('0x18')](_0x37bf8a[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x2f')]=function(_0x3c4815){try{if(!_[_0x3ce1('0x1b')](agents[_0x3c4815['transfereruniqueid']])){agents[_0x3c4815[_0x3ce1('0x30')]]['transfer']=!![];agents[_0x3c4815[_0x3ce1('0x30')]]['transfertype']=_0x3ce1('0x31');agents[_0x3c4815[_0x3ce1('0x30')]]['transferexten']=_0x3c4815[_0x3ce1('0x32')];agents[_0x3c4815[_0x3ce1('0x30')]][_0x3ce1('0x33')]=agents[_0x3c4815[_0x3ce1('0x30')]][_0x3ce1('0x22')];}}catch(_0x57035e){utils['error'](_0x57035e[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x34')]=function(_0x1ce4c7){try{if(_0x1ce4c7[_0x3ce1('0x35')]==_0x1ce4c7['origtransfererlinkedid']){if(!_['isNil'](agents[_0x1ce4c7['secondtransfereruniqueid']])){agents[_0x1ce4c7['secondtransfereruniqueid']][_0x3ce1('0x36')]=!![];agents[_0x1ce4c7[_0x3ce1('0x37')]][_0x3ce1('0x38')]='ATTENDED';agents[_0x1ce4c7[_0x3ce1('0x37')]]['transferexten']=_0x1ce4c7[_0x3ce1('0x39')];agents[_0x1ce4c7[_0x3ce1('0x37')]][_0x3ce1('0x33')]=_0x1ce4c7['origtransfereruniqueid'];}if(_0x1ce4c7['transfereeuniqueid']&&agents[_0x1ce4c7[_0x3ce1('0x3a')]]){agents[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x3b')]=0x1;transfers[_0x1ce4c7[_0x3ce1('0x3a')]]=_['clone'](agents[_0x1ce4c7[_0x3ce1('0x3a')]]);transfers[_0x1ce4c7['transfereeuniqueid']][_0x3ce1('0x8')]=agents[_0x1ce4c7['secondtransfereruniqueid']][_0x3ce1('0x8')];transfers[_0x1ce4c7[_0x3ce1('0x3a')]]['calleridname']=agents[_0x1ce4c7[_0x3ce1('0x37')]][_0x3ce1('0x3c')];transfers[_0x1ce4c7[_0x3ce1('0x3a')]]['agentcalledAt']=utils[_0x3ce1('0x15')]();transfers[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x27')]=utils[_0x3ce1('0x15')]();transfers[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x25')]=0x0;transfers[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x3b')]=0x2;}}else if(_0x1ce4c7['secondtransfereruniqueid']==_0x1ce4c7[_0x3ce1('0x3d')]){if(!_[_0x3ce1('0x1b')](agents[_0x1ce4c7[_0x3ce1('0x35')]])){agents[_0x1ce4c7[_0x3ce1('0x35')]][_0x3ce1('0x36')]=!![];agents[_0x1ce4c7['origtransfereruniqueid']]['transfertype']=_0x3ce1('0x3e');agents[_0x1ce4c7[_0x3ce1('0x35')]]['transferexten']=_0x1ce4c7[_0x3ce1('0x3f')];agents[_0x1ce4c7['origtransfereruniqueid']][_0x3ce1('0x33')]=_0x1ce4c7[_0x3ce1('0x37')];}if(_0x1ce4c7[_0x3ce1('0x40')]&&agents[_0x1ce4c7[_0x3ce1('0x40')]]){agents[_0x1ce4c7['transfertargetuniqueid']][_0x3ce1('0x3b')]=0x1;transfers[_0x1ce4c7[_0x3ce1('0x40')]]=_[_0x3ce1('0x41')](agents[_0x1ce4c7[_0x3ce1('0x40')]]);transfers[_0x1ce4c7['transfertargetuniqueid']][_0x3ce1('0x8')]=agents[_0x1ce4c7['origtransfereruniqueid']][_0x3ce1('0x8')];transfers[_0x1ce4c7['transfertargetuniqueid']][_0x3ce1('0x3c')]=agents[_0x1ce4c7[_0x3ce1('0x35')]][_0x3ce1('0x3c')];transfers[_0x1ce4c7['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x1ce4c7[_0x3ce1('0x40')]]['agentconnectAt']=utils[_0x3ce1('0x15')]();transfers[_0x1ce4c7[_0x3ce1('0x40')]]['holdtime']=0x0;transfers[_0x1ce4c7[_0x3ce1('0x40')]]['agententerreason']=0x2;}}}catch(_0xe998a7){utils[_0x3ce1('0x18')](_0xe998a7[_0x3ce1('0x19')]);}};exports['hangup']=function(_0x4b218d){try{if(agents[_0x4b218d[_0x3ce1('0x22')]]&&agents[_0x4b218d[_0x3ce1('0x22')]]['reason']===_0x3ce1('0x1d')){if(_0x4b218d['cause']==='21'){agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x1e')]=_0x3ce1('0x42');agents[_0x4b218d['uniqueid']][_0x3ce1('0x16')]=_0x3ce1('0x42');}writeDB(agents[_0x4b218d['uniqueid']]);var _0x47ac87=unanswered[_0x3ce1('0x43')](_0x4b218d['uniqueid']);if(_0x47ac87>-0x1)unanswered[_0x3ce1('0x44')](_0x47ac87,0x1);}if(transfers[_0x4b218d[_0x3ce1('0x22')]]){transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0xe')]=!![];transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x2d')]=utils['now']();transfers[_0x4b218d['uniqueid']][_0x3ce1('0x26')]=utils[_0x3ce1('0x2c')](transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x2d')],transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x27')]);transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x1e')]=_0x3ce1('0x45');transfers[_0x4b218d['uniqueid']][_0x3ce1('0x16')]=_0x3ce1('0x2e');writeDB(transfers[_0x4b218d[_0x3ce1('0x22')]],!![]);}if(agents[_0x4b218d['uniqueid']]&&agents[_0x4b218d['uniqueid']][_0x3ce1('0x27')]){agents[_0x4b218d['uniqueid']][_0x3ce1('0xe')]=!![];agents[_0x4b218d['uniqueid']]['agentcompleteAt']=utils[_0x3ce1('0x15')]();agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x26')]=utils['diffTime'](agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x2d')],agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x27')]);agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x1e')]=agents[_0x4b218d['uniqueid']]['transfer']?_0x3ce1('0x36'):'agent';agents[_0x4b218d['uniqueid']][_0x3ce1('0x16')]=_0x3ce1('0x2e');writeDB(agents[_0x4b218d[_0x3ce1('0x22')]]);}}catch(_0x21b4d0){utils['error'](_0x21b4d0[_0x3ce1('0x19')]);}}; \ No newline at end of file +var _0x0689=['calleridnum','calleridname','transfertargetuniqueid','clone','hangup','cause','rejected','indexOf','splice','agent','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','queue','membername','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','uniqueid','agentcalled','agentcalledAt','now','destuniqueid','called','connectedlinename','stack','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','push','error','includes','abandoned','reason','talktime','agentconnect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason'];(function(_0x11cb1c,_0x14aa7d){var _0x26bfae=function(_0x1258ba){while(--_0x1258ba){_0x11cb1c['push'](_0x11cb1c['shift']());}};_0x26bfae(++_0x14aa7d);}(_0x0689,0x9a));var _0x9068=function(_0x4b234f,_0x30d262){_0x4b234f=_0x4b234f-0x0;var _0x4d3db1=_0x0689[_0x4b234f];return _0x4d3db1;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9068('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x48ce,_0x331bba){utils[_0x9068('0x1')](util[_0x9068('0x2')](_0x9068('0x3'),_0x48ce['uniqueid'],_0x48ce[_0x9068('0x4')],_0x48ce[_0x9068('0x5')],_0x48ce[_0x9068('0x6')],_0x48ce['interface'],_0x48ce['calleridnum'],_0x48ce[_0x9068('0x7')],_0x48ce[_0x9068('0x8')]));if(_0x48ce['queue']){utils['getVoiceQueueByName'](_0x48ce[_0x9068('0x5')])[_0x9068('0x9')](function(_0x1ab5c2){if(_0x1ab5c2){_0x48ce[_0x9068('0xa')]=_0x1ab5c2[_0x9068('0xa')];_0x48ce[_0x9068('0xb')]=_0x48ce[_0x9068('0xc')]?_0x1ab5c2[_0x9068('0xd')]:![];_0x48ce[_0x9068('0xe')]=_0x48ce[_0x9068('0xb')]?_0x1ab5c2[_0x9068('0xf')]:0x0;}utils[_0x9068('0x10')]('CreateVoiceAgentReport',_0x48ce);});}else{utils[_0x9068('0x10')]('CreateVoiceAgentReport',_0x48ce);}if(_0x331bba){delete transfers[_0x48ce[_0x9068('0x11')]];}else{delete agents[_0x48ce['destuniqueid']];}}exports[_0x9068('0x12')]=function(_0x3aacd0){try{agents[_0x3aacd0['destuniqueid']]=_0x3aacd0;agents[_0x3aacd0['destuniqueid']][_0x9068('0x13')]=utils[_0x9068('0x14')]();agents[_0x3aacd0[_0x9068('0x15')]][_0x9068('0x8')]=_0x9068('0x16');agents[_0x3aacd0['destuniqueid']][_0x9068('0x7')]=null;agents[_0x3aacd0[_0x9068('0x15')]][_0x9068('0x17')]=null;}catch(_0x345050){utils['error'](_0x345050[_0x9068('0x18')]);}};exports[_0x9068('0x19')]=function(_0xe6bbc2){try{if(!_['isNil'](agents[_0xe6bbc2[_0x9068('0x15')]])){agents[_0xe6bbc2[_0x9068('0x15')]][_0x9068('0x19')]=!![];agents[_0xe6bbc2['destuniqueid']][_0x9068('0x1a')]=utils['now']();agents[_0xe6bbc2['destuniqueid']]['lastevent']=_0x9068('0x1b');agents[_0xe6bbc2[_0x9068('0x15')]]['reason']=_0x9068('0x1b');agents[_0xe6bbc2['destuniqueid']][_0x9068('0x1c')]=_0xe6bbc2['ringtime']?parseInt(_0xe6bbc2[_0x9068('0x1d')])/0x3e8:0x0;agents[_0xe6bbc2[_0x9068('0x15')]]['talktime']=0x0;unanswered[_0x9068('0x1e')](_0xe6bbc2['destuniqueid']);}}catch(_0x3aa26d){utils[_0x9068('0x1f')](_0x3aa26d[_0x9068('0x18')]);}};exports['queuecallerabandon']=function(_0x1ea26f){try{_['forIn'](agents,function(_0x4b3f25,_0xea7a8b){if(_0x4b3f25[_0x9068('0x11')]==_0x1ea26f[_0x9068('0x11')]&&!_[_0x9068('0x20')](unanswered,_0x4b3f25[_0x9068('0x15')])){_0x4b3f25[_0x9068('0x19')]=!![];_0x4b3f25[_0x9068('0x1a')]=utils[_0x9068('0x14')]();_0x4b3f25[_0x9068('0x8')]=_0x9068('0x21');_0x4b3f25[_0x9068('0x22')]=_0x9068('0x21');_0x4b3f25[_0x9068('0x1c')]=_0x1ea26f[_0x9068('0x1c')];_0x4b3f25[_0x9068('0x23')]=0x0;writeDB(_0x4b3f25);}});}catch(_0x25204f){utils[_0x9068('0x1f')](_0x25204f[_0x9068('0x18')]);}};exports[_0x9068('0x24')]=function(_0xd026f8){try{if(agents[_0xd026f8[_0x9068('0x15')]]){agents[_0xd026f8[_0x9068('0x15')]][_0x9068('0x25')]=utils['now']();agents[_0xd026f8[_0x9068('0x15')]]['connectedlinenum']=_0xd026f8[_0x9068('0x7')];agents[_0xd026f8['destuniqueid']][_0x9068('0x17')]=_0xd026f8[_0x9068('0x17')];agents[_0xd026f8[_0x9068('0x15')]]['holdtime']=_0xd026f8[_0x9068('0x1d')];agents[_0xd026f8['destuniqueid']][_0x9068('0x8')]=_0x9068('0x26');_[_0x9068('0x27')](agents,function(_0x594d2c,_0x522c3f){if(_0x594d2c[_0x9068('0x15')]!=_0xd026f8[_0x9068('0x15')]&&_0x594d2c['uniqueid']==_0xd026f8[_0x9068('0x11')]){_0x594d2c[_0x9068('0x23')]=0x0;_0x594d2c['holdtime']=_0xd026f8[_0x9068('0x1d')];_0x594d2c[_0x9068('0x19')]=!![];_0x594d2c[_0x9068('0x1a')]=utils[_0x9068('0x14')]();_0x594d2c['lastevent']=_0x9068('0x28');_0x594d2c[_0x9068('0x22')]=_0x9068('0x28');_0x594d2c[_0x9068('0x29')]=_0xd026f8['destuniqueid'];_0x594d2c[_0x9068('0x2a')]=_0xd026f8['membername'];writeDB(_0x594d2c);}});}}catch(_0x367fd5){utils[_0x9068('0x1f')](_0x367fd5['stack']);}};exports[_0x9068('0xc')]=function(_0x4889be){try{if(!_[_0x9068('0x2b')](agents[_0x4889be['destuniqueid']])){agents[_0x4889be[_0x9068('0x15')]][_0x9068('0xc')]=!![];agents[_0x4889be[_0x9068('0x15')]][_0x9068('0x2c')]=utils['now']();agents[_0x4889be[_0x9068('0x15')]]['talktime']=utils[_0x9068('0x2d')](agents[_0x4889be['destuniqueid']]['agentcompleteAt'],agents[_0x4889be['destuniqueid']][_0x9068('0x25')]);agents[_0x4889be[_0x9068('0x15')]][_0x9068('0x22')]=_0x4889be[_0x9068('0x22')];agents[_0x4889be[_0x9068('0x15')]][_0x9068('0x8')]=_0x9068('0x2e');writeDB(agents[_0x4889be[_0x9068('0x15')]]);}}catch(_0x32218f){utils[_0x9068('0x1f')](_0x32218f[_0x9068('0x18')]);}};exports[_0x9068('0x2f')]=function(_0x40eaf2){try{if(!_[_0x9068('0x2b')](agents[_0x40eaf2['transfereruniqueid']])){agents[_0x40eaf2[_0x9068('0x30')]][_0x9068('0x31')]=!![];agents[_0x40eaf2[_0x9068('0x30')]]['transfertype']=_0x9068('0x32');agents[_0x40eaf2[_0x9068('0x30')]][_0x9068('0x33')]=_0x40eaf2[_0x9068('0x34')];agents[_0x40eaf2[_0x9068('0x30')]][_0x9068('0x35')]=agents[_0x40eaf2['transfereruniqueid']]['uniqueid'];}}catch(_0x5f00fc){utils[_0x9068('0x1f')](_0x5f00fc['stack']);}};exports['attendedtransfer']=function(_0x322cad){try{if(_0x322cad[_0x9068('0x36')]==_0x322cad[_0x9068('0x37')]){if(!_['isNil'](agents[_0x322cad['secondtransfereruniqueid']])){agents[_0x322cad[_0x9068('0x38')]]['transfer']=!![];agents[_0x322cad[_0x9068('0x38')]][_0x9068('0x39')]=_0x9068('0x3a');agents[_0x322cad['secondtransfereruniqueid']][_0x9068('0x33')]=_0x322cad[_0x9068('0x3b')];agents[_0x322cad[_0x9068('0x38')]][_0x9068('0x35')]=_0x322cad[_0x9068('0x36')];}if(_0x322cad['transfereeuniqueid']&&agents[_0x322cad[_0x9068('0x3c')]]){agents[_0x322cad['transfereeuniqueid']][_0x9068('0x3d')]=0x1;transfers[_0x322cad[_0x9068('0x3c')]]=_['clone'](agents[_0x322cad[_0x9068('0x3c')]]);transfers[_0x322cad[_0x9068('0x3c')]]['calleridnum']=agents[_0x322cad[_0x9068('0x38')]][_0x9068('0x3e')];transfers[_0x322cad[_0x9068('0x3c')]][_0x9068('0x3f')]=agents[_0x322cad[_0x9068('0x38')]][_0x9068('0x3f')];transfers[_0x322cad[_0x9068('0x3c')]]['agentcalledAt']=utils[_0x9068('0x14')]();transfers[_0x322cad[_0x9068('0x3c')]][_0x9068('0x25')]=utils['now']();transfers[_0x322cad[_0x9068('0x3c')]][_0x9068('0x1c')]=0x0;transfers[_0x322cad[_0x9068('0x3c')]][_0x9068('0x3d')]=0x2;}}else if(_0x322cad[_0x9068('0x38')]==_0x322cad['secondtransfererlinkedid']){if(!_[_0x9068('0x2b')](agents[_0x322cad[_0x9068('0x36')]])){agents[_0x322cad[_0x9068('0x36')]][_0x9068('0x31')]=!![];agents[_0x322cad['origtransfereruniqueid']]['transfertype']=_0x9068('0x3a');agents[_0x322cad[_0x9068('0x36')]][_0x9068('0x33')]=_0x322cad['secondtransfererexten'];agents[_0x322cad[_0x9068('0x36')]][_0x9068('0x35')]=_0x322cad[_0x9068('0x38')];}if(_0x322cad[_0x9068('0x40')]&&agents[_0x322cad['transfertargetuniqueid']]){agents[_0x322cad[_0x9068('0x40')]][_0x9068('0x3d')]=0x1;transfers[_0x322cad[_0x9068('0x40')]]=_[_0x9068('0x41')](agents[_0x322cad[_0x9068('0x40')]]);transfers[_0x322cad[_0x9068('0x40')]][_0x9068('0x3e')]=agents[_0x322cad[_0x9068('0x36')]][_0x9068('0x3e')];transfers[_0x322cad[_0x9068('0x40')]]['calleridname']=agents[_0x322cad[_0x9068('0x36')]][_0x9068('0x3f')];transfers[_0x322cad['transfertargetuniqueid']]['agentcalledAt']=utils[_0x9068('0x14')]();transfers[_0x322cad['transfertargetuniqueid']][_0x9068('0x25')]=utils[_0x9068('0x14')]();transfers[_0x322cad[_0x9068('0x40')]][_0x9068('0x1c')]=0x0;transfers[_0x322cad[_0x9068('0x40')]]['agententerreason']=0x2;}}}catch(_0x90e914){utils[_0x9068('0x1f')](_0x90e914['stack']);}};exports[_0x9068('0x42')]=function(_0x21b3cf){try{if(agents[_0x21b3cf[_0x9068('0x11')]]&&agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x22')]===_0x9068('0x1b')){if(_0x21b3cf[_0x9068('0x43')]==='21'){agents[_0x21b3cf['uniqueid']]['reason']='rejected';agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x8')]=_0x9068('0x44');}writeDB(agents[_0x21b3cf[_0x9068('0x11')]]);var _0x2859fa=unanswered[_0x9068('0x45')](_0x21b3cf[_0x9068('0x11')]);if(_0x2859fa>-0x1)unanswered[_0x9068('0x46')](_0x2859fa,0x1);}if(transfers[_0x21b3cf['uniqueid']]){transfers[_0x21b3cf[_0x9068('0x11')]][_0x9068('0xc')]=!![];transfers[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x2c')]=utils[_0x9068('0x14')]();transfers[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x23')]=utils[_0x9068('0x2d')](transfers[_0x21b3cf[_0x9068('0x11')]]['agentcompleteAt'],transfers[_0x21b3cf[_0x9068('0x11')]]['agentconnectAt']);transfers[_0x21b3cf[_0x9068('0x11')]]['reason']=_0x9068('0x47');transfers[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x8')]='complete';writeDB(transfers[_0x21b3cf[_0x9068('0x11')]],!![]);}if(agents[_0x21b3cf[_0x9068('0x11')]]&&agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x25')]){agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0xc')]=!![];agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x2c')]=utils[_0x9068('0x14')]();agents[_0x21b3cf['uniqueid']][_0x9068('0x23')]=utils[_0x9068('0x2d')](agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x2c')],agents[_0x21b3cf[_0x9068('0x11')]]['agentconnectAt']);agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x22')]=agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x31')]?_0x9068('0x31'):_0x9068('0x47');agents[_0x21b3cf[_0x9068('0x11')]][_0x9068('0x8')]=_0x9068('0x2e');writeDB(agents[_0x21b3cf[_0x9068('0x11')]]);}}catch(_0x3ebe45){utils['error'](_0x3ebe45[_0x9068('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 835138d..3ebf3f6 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 _0x2b2c=['sipcallid','newexten','application','toLowerCase','startsWith','appdata','substring','lastIndexOf','includes','noop','set','gotoif','lastapplication','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','now','DOCUMENTATION','error','channelstate','systemanswertime','context','transfer','destinationchannel','isNil','answertime','toNumber','ANSWERED','stack','endtime','duration','diffTime','billableseconds','attendedtransfer','secondtransfererchannel','localtwolinkedid','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','variable','destination','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','Queue','lastdata','queue','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x2b2c,0x149));var _0xc2b2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b2c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xc2b2('0x0'));var util=require(_0xc2b2('0x1'));var utils=require(_0xc2b2('0x2'));var dispositions=['NO\x20ANSWER',_0xc2b2('0x3'),_0xc2b2('0x3'),_0xc2b2('0x4'),_0xc2b2('0x4'),_0xc2b2('0x4'),'ANSWERED',_0xc2b2('0x5'),_0xc2b2('0x3'),_0xc2b2('0x3'),'FAILED'];var channels={};function writeDB(_0x1740c2){utils[_0xc2b2('0x6')](util[_0xc2b2('0x7')](_0xc2b2('0x8'),_0x1740c2[_0xc2b2('0x9')],_0x1740c2[_0xc2b2('0xa')],_0x1740c2[_0xc2b2('0xb')],_0x1740c2[_0xc2b2('0xc')],_0x1740c2[_0xc2b2('0xd')],_0x1740c2['destination'],_0x1740c2[_0xc2b2('0xe')],_0x1740c2[_0xc2b2('0xf')]));if(_0x1740c2[_0xc2b2('0xc')]){utils[_0xc2b2('0x10')](_0x1740c2[_0xc2b2('0xc')])[_0xc2b2('0x11')](function(_0x10e140){if(_0x10e140){_0x1740c2[_0xc2b2('0x12')]=_0x10e140['id'];}utils[_0xc2b2('0x13')](_0xc2b2('0x14'),_0x1740c2);});}else{utils[_0xc2b2('0x13')](_0xc2b2('0x14'),_0x1740c2);}if(channels[_0x1740c2[_0xc2b2('0x9')]]){delete channels[_0x1740c2[_0xc2b2('0x9')]];}}exports['newchannel']=function(_0x4e2d66){try{if(_0x4e2d66[_0xc2b2('0x9')]==_0x4e2d66[_0xc2b2('0x15')]&&_0x4e2d66['channel']!=_0xc2b2('0x16')){channels[_0x4e2d66[_0xc2b2('0x9')]]={'uniqueid':_0x4e2d66[_0xc2b2('0x9')],'accountcode':_0x4e2d66[_0xc2b2('0xc')],'source':_0x4e2d66['calleridnum'],'destination':_0x4e2d66['exten'],'destinationcontext':_0x4e2d66['context'],'channel':_0x4e2d66[_0xc2b2('0xa')],'starttime':utils[_0xc2b2('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc2b2('0x4'),'amaflags':_0xc2b2('0x18')};}}catch(_0x3e97da){utils[_0xc2b2('0x19')](_0x3e97da['stack']);}};exports['newstate']=function(_0x54dfbd){try{if(!_['isNil'](channels[_0x54dfbd['uniqueid']])&&_0x54dfbd[_0xc2b2('0x1a')]==0x6){if(_['isNil'](channels[_0x54dfbd[_0xc2b2('0x9')]]['systemanswertime'])){channels[_0x54dfbd[_0xc2b2('0x9')]][_0xc2b2('0x1b')]=utils[_0xc2b2('0x17')]();}}else if(!_['isNil'](channels[_0x54dfbd['linkedid']])&&_0x54dfbd['channelstate']==0x6&&_0x54dfbd[_0xc2b2('0x1c')]!=_0xc2b2('0x1d')){channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0xc')]=_0x54dfbd[_0xc2b2('0xc')];channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0x1e')]=_0x54dfbd['channel'];if(_[_0xc2b2('0x1f')](channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0x20')])){channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0x20')]=utils[_0xc2b2('0x17')]();}channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0xf')]=dispositions[_[_0xc2b2('0x21')](_0x54dfbd[_0xc2b2('0x1a')])]||_0xc2b2('0x22');}}catch(_0x1ea913){utils[_0xc2b2('0x19')](_0x1ea913[_0xc2b2('0x23')]);}};exports['hangup']=function(_0x35ac44){try{if(!_[_0xc2b2('0x1f')](channels[_0x35ac44[_0xc2b2('0x9')]])){if(_[_0xc2b2('0x1f')](channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0xe')])){channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0xe')]=_0x35ac44['calleridname']+'\x20<'+_0x35ac44['calleridnum']+'>';}channels[_0x35ac44['uniqueid']][_0xc2b2('0x24')]=utils[_0xc2b2('0x17')]();channels[_0x35ac44['uniqueid']][_0xc2b2('0x25')]=utils[_0xc2b2('0x26')](channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0x24')],channels[_0x35ac44[_0xc2b2('0x9')]]['starttime']);channels[_0x35ac44['uniqueid']][_0xc2b2('0x27')]=channels[_0x35ac44['uniqueid']][_0xc2b2('0x20')]?utils[_0xc2b2('0x26')](channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0x24')],channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0x20')]):0x0;writeDB(channels[_0x35ac44[_0xc2b2('0x9')]]);}}catch(_0x5b5fbc){utils[_0xc2b2('0x19')](_0x5b5fbc[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x28')]=function(_0x4c949b){try{if(!_[_0xc2b2('0x1f')](channels[_0x4c949b['localtwolinkedid']])){if(channels[_0x4c949b['localtwolinkedid']][_0xc2b2('0xa')]==_0x4c949b['transfereechannel']){channels[_0x4c949b['localtwolinkedid']]['destinationchannel']=_0x4c949b[_0xc2b2('0x29')];channels[_0x4c949b[_0xc2b2('0x2a')]][_0xc2b2('0x2b')]=_0xc2b2('0x2c');}else if(channels[_0x4c949b[_0xc2b2('0x2a')]]['channel']=_0x4c949b[_0xc2b2('0x2d')]){channels[_0x4c949b[_0xc2b2('0x2a')]][_0xc2b2('0x1e')]=_0x4c949b[_0xc2b2('0x2e')];channels[_0x4c949b['localtwolinkedid']][_0xc2b2('0x2b')]=_0xc2b2('0x2c');}}}catch(_0x2b24cb){utils[_0xc2b2('0x19')](_0x2b24cb[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x2f')]=function(_0x4152cc){try{if(!_[_0xc2b2('0x1f')](channels[_0x4152cc['uniqueid']])){channels[_0x4152cc['uniqueid']][_0xc2b2('0x30')]=utils[_0xc2b2('0x17')]();}}catch(_0x24c843){utils[_0xc2b2('0x19')](_0x24c843[_0xc2b2('0x23')]);}};exports['musiconholdstop']=function(_0x542f77){try{if(!_['isNil'](channels[_0x542f77[_0xc2b2('0x9')]])){if(!_[_0xc2b2('0x1f')](channels[_0x542f77[_0xc2b2('0x9')]][_0xc2b2('0x30')])){channels[_0x542f77['uniqueid']][_0xc2b2('0x31')]+=utils['diffTime'](utils[_0xc2b2('0x17')](),channels[_0x542f77[_0xc2b2('0x9')]][_0xc2b2('0x30')]);delete channels[_0x542f77[_0xc2b2('0x9')]][_0xc2b2('0x30')];}}}catch(_0x144fd4){utils[_0xc2b2('0x19')](_0x144fd4[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x32')]=function(_0x3817e5){try{if(!_[_0xc2b2('0x1f')](channels[_0x3817e5[_0xc2b2('0x9')]])){if(!_[_0xc2b2('0x1f')](_0x3817e5['variable'][_0xc2b2('0x33')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0xd')]=_0x3817e5['value'];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')]['xmd-phone'])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x35')]=_0x3817e5[_0xc2b2('0x36')];channels[_0x3817e5['uniqueid']][_0xc2b2('0xe')]='\x22'+_0x3817e5[_0xc2b2('0x36')]+_0xc2b2('0x37')+_0x3817e5[_0xc2b2('0x36')]+'>';}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x38')])||!_['isNil'](_0x3817e5['variable'][_0xc2b2('0x39')])){channels[_0x3817e5['uniqueid']][_0xc2b2('0xe')]=_0x3817e5[_0xc2b2('0x36')];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x3a')])||!_[_0xc2b2('0x1f')](_0x3817e5['variable']['xmcs-queue'])){channels[_0x3817e5[_0xc2b2('0x9')]]['lastapplication']=_0xc2b2('0x3b');channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x3c')]=_0x3817e5[_0xc2b2('0x36')];channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x3d')]=!![];}if(!_[_0xc2b2('0x1f')](_0x3817e5['variable'][_0xc2b2('0x3e')])){channels[_0x3817e5[_0xc2b2('0x9')]]['ContactId']=_0x3817e5[_0xc2b2('0x36')];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x3f')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0xb')]=_0x3817e5[_0xc2b2('0x36')];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x40')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x41')]=_0x3817e5['value'];}if(!_['isNil'](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x42')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x42')]=_0x3817e5[_0xc2b2('0x36')];}}}catch(_0x25ad2d){utils[_0xc2b2('0x19')](_0x25ad2d[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x43')]=function(_0x3aadaa){try{if(!_[_0xc2b2('0x1f')](channels[_0x3aadaa['uniqueid']])){if(_0x3aadaa[_0xc2b2('0x44')][_0xc2b2('0x45')]()=='set'&&_[_0xc2b2('0x46')](_0x3aadaa[_0xc2b2('0x47')][_0xc2b2('0x45')](),'cdr')){var _0x3af11e=_0x3aadaa[_0xc2b2('0x47')]['split']('=');var _0x4a3206=_0x3af11e[0x0][_0xc2b2('0x48')](_0x3af11e[0x0][_0xc2b2('0x49')]('(')+0x1,_0x3af11e[0x0]['lastIndexOf'](')'));var _0x4fc502=_0x3af11e[0x1];channels[_0x3aadaa[_0xc2b2('0x9')]][_0x4a3206]=_0x4fc502;}if(!_[_0xc2b2('0x4a')](['hangup',_0xc2b2('0x4b'),'execif',_0xc2b2('0x4c'),_0xc2b2('0x4d')],_0x3aadaa[_0xc2b2('0x44')][_0xc2b2('0x45')]())){channels[_0x3aadaa[_0xc2b2('0x9')]][_0xc2b2('0x4e')]=_0x3aadaa[_0xc2b2('0x44')];channels[_0x3aadaa[_0xc2b2('0x9')]][_0xc2b2('0x3c')]=_0x3aadaa[_0xc2b2('0x47')];}}}catch(_0x1c4ff2){utils['error'](_0x1c4ff2[_0xc2b2('0x23')]);}}; \ No newline at end of file +var _0x5b85=['util','NO\x20ANSWER','FAILED','ANSWERED','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','source','destination','callerid','accountcode','then','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','error','stack','newstate','isNil','systemanswertime','channelstate','destinationchannel','answertime','disposition','toNumber','hangup','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','split','substring','includes','noop','execif','gotoif','lodash'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x5b85,0x1cd));var _0x55b8=function(_0x8a677e,_0xbfbf79){_0x8a677e=_0x8a677e-0x0;var _0x36f77f=_0x5b85[_0x8a677e];return _0x36f77f;};'use strict';var _=require(_0x55b8('0x0'));var util=require(_0x55b8('0x1'));var utils=require('./utils');var dispositions=[_0x55b8('0x2'),_0x55b8('0x3'),_0x55b8('0x3'),_0x55b8('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x55b8('0x4'),'BUSY',_0x55b8('0x3'),_0x55b8('0x3'),'FAILED'];var channels={};function writeDB(_0x503471){utils['info'](util['format'](_0x55b8('0x5'),_0x503471[_0x55b8('0x6')],_0x503471[_0x55b8('0x7')],_0x503471[_0x55b8('0x8')],_0x503471['accountcode'],_0x503471[_0x55b8('0x9')],_0x503471[_0x55b8('0xa')],_0x503471[_0x55b8('0xb')],_0x503471['disposition']));if(_0x503471['accountcode']){utils['getUserByInternal'](_0x503471[_0x55b8('0xc')])[_0x55b8('0xd')](function(_0x5aed4c){if(_0x5aed4c){_0x503471['UserId']=_0x5aed4c['id'];}utils[_0x55b8('0xe')](_0x55b8('0xf'),_0x503471);});}else{utils['request'](_0x55b8('0xf'),_0x503471);}if(channels[_0x503471[_0x55b8('0x6')]]){delete channels[_0x503471['uniqueid']];}}exports[_0x55b8('0x10')]=function(_0x3c944c){try{if(_0x3c944c[_0x55b8('0x6')]==_0x3c944c[_0x55b8('0x11')]&&_0x3c944c[_0x55b8('0x7')]!=_0x55b8('0x12')){channels[_0x3c944c[_0x55b8('0x6')]]={'uniqueid':_0x3c944c[_0x55b8('0x6')],'accountcode':_0x3c944c['accountcode'],'source':_0x3c944c[_0x55b8('0x13')],'destination':_0x3c944c['exten'],'destinationcontext':_0x3c944c[_0x55b8('0x14')],'channel':_0x3c944c[_0x55b8('0x7')],'starttime':utils[_0x55b8('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x55b8('0x2'),'amaflags':_0x55b8('0x16')};}}catch(_0xc94de5){utils[_0x55b8('0x17')](_0xc94de5[_0x55b8('0x18')]);}};exports[_0x55b8('0x19')]=function(_0x23ba59){try{if(!_['isNil'](channels[_0x23ba59[_0x55b8('0x6')]])&&_0x23ba59['channelstate']==0x6){if(_[_0x55b8('0x1a')](channels[_0x23ba59['uniqueid']][_0x55b8('0x1b')])){channels[_0x23ba59['uniqueid']][_0x55b8('0x1b')]=utils[_0x55b8('0x15')]();}}else if(!_[_0x55b8('0x1a')](channels[_0x23ba59[_0x55b8('0x11')]])&&_0x23ba59[_0x55b8('0x1c')]==0x6&&_0x23ba59['context']!='transfer'){channels[_0x23ba59[_0x55b8('0x11')]][_0x55b8('0xc')]=_0x23ba59[_0x55b8('0xc')];channels[_0x23ba59[_0x55b8('0x11')]][_0x55b8('0x1d')]=_0x23ba59[_0x55b8('0x7')];if(_[_0x55b8('0x1a')](channels[_0x23ba59['linkedid']][_0x55b8('0x1e')])){channels[_0x23ba59[_0x55b8('0x11')]][_0x55b8('0x1e')]=utils[_0x55b8('0x15')]();}channels[_0x23ba59[_0x55b8('0x11')]][_0x55b8('0x1f')]=dispositions[_[_0x55b8('0x20')](_0x23ba59[_0x55b8('0x1c')])]||_0x55b8('0x4');}}catch(_0xfa044a){utils['error'](_0xfa044a[_0x55b8('0x18')]);}};exports[_0x55b8('0x21')]=function(_0x225ca2){try{if(!_[_0x55b8('0x1a')](channels[_0x225ca2['uniqueid']])){if(_[_0x55b8('0x1a')](channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0xb')])){channels[_0x225ca2['uniqueid']][_0x55b8('0xb')]=_0x225ca2['calleridname']+'\x20<'+_0x225ca2[_0x55b8('0x13')]+'>';}channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0x22')]=utils[_0x55b8('0x15')]();channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0x23')]=utils[_0x55b8('0x24')](channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0x22')],channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0x25')]);channels[_0x225ca2[_0x55b8('0x6')]]['billableseconds']=channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0x1e')]?utils[_0x55b8('0x24')](channels[_0x225ca2[_0x55b8('0x6')]][_0x55b8('0x22')],channels[_0x225ca2[_0x55b8('0x6')]]['answertime']):0x0;writeDB(channels[_0x225ca2[_0x55b8('0x6')]]);}}catch(_0x15bc6a){utils[_0x55b8('0x17')](_0x15bc6a[_0x55b8('0x18')]);}};exports[_0x55b8('0x26')]=function(_0x1bf856){try{if(!_['isNil'](channels[_0x1bf856[_0x55b8('0x27')]])){if(channels[_0x1bf856[_0x55b8('0x27')]][_0x55b8('0x7')]==_0x1bf856['transfereechannel']){channels[_0x1bf856[_0x55b8('0x27')]][_0x55b8('0x1d')]=_0x1bf856['secondtransfererchannel'];channels[_0x1bf856['localtwolinkedid']][_0x55b8('0x28')]=_0x55b8('0x29');}else if(channels[_0x1bf856[_0x55b8('0x27')]][_0x55b8('0x7')]=_0x1bf856[_0x55b8('0x2a')]){channels[_0x1bf856[_0x55b8('0x27')]]['destinationchannel']=_0x1bf856[_0x55b8('0x2b')];channels[_0x1bf856[_0x55b8('0x27')]][_0x55b8('0x28')]='_attended';}}}catch(_0xea82f5){utils[_0x55b8('0x17')](_0xea82f5[_0x55b8('0x18')]);}};exports[_0x55b8('0x2c')]=function(_0x133e12){try{if(!_[_0x55b8('0x1a')](channels[_0x133e12['uniqueid']])){channels[_0x133e12[_0x55b8('0x6')]][_0x55b8('0x2d')]=utils['now']();}}catch(_0x28eebf){utils[_0x55b8('0x17')](_0x28eebf[_0x55b8('0x18')]);}};exports[_0x55b8('0x2e')]=function(_0x342aff){try{if(!_[_0x55b8('0x1a')](channels[_0x342aff[_0x55b8('0x6')]])){if(!_[_0x55b8('0x1a')](channels[_0x342aff[_0x55b8('0x6')]][_0x55b8('0x2d')])){channels[_0x342aff['uniqueid']]['mohtime']+=utils[_0x55b8('0x24')](utils[_0x55b8('0x15')](),channels[_0x342aff['uniqueid']][_0x55b8('0x2d')]);delete channels[_0x342aff[_0x55b8('0x6')]][_0x55b8('0x2d')];}}}catch(_0x313f27){utils['error'](_0x313f27[_0x55b8('0x18')]);}};exports[_0x55b8('0x2f')]=function(_0x2684fd){try{if(!_[_0x55b8('0x1a')](channels[_0x2684fd['uniqueid']])){if(!_['isNil'](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x31')])){channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0x9')]=_0x2684fd[_0x55b8('0x32')];}if(!_[_0x55b8('0x1a')](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x33')])){channels[_0x2684fd[_0x55b8('0x6')]]['destination']=_0x2684fd[_0x55b8('0x32')];channels[_0x2684fd[_0x55b8('0x6')]]['callerid']='\x22'+_0x2684fd[_0x55b8('0x32')]+'\x22\x20<'+_0x2684fd[_0x55b8('0x32')]+'>';}if(!_['isNil'](_0x2684fd['variable'][_0x55b8('0x34')])||!_[_0x55b8('0x1a')](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x35')])){channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0xb')]=_0x2684fd['value'];}if(!_[_0x55b8('0x1a')](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x36')])||!_[_0x55b8('0x1a')](_0x2684fd[_0x55b8('0x30')]['xmcs-queue'])){channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0x37')]=_0x55b8('0x38');channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0x39')]=_0x2684fd[_0x55b8('0x32')];channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0x3a')]=!![];}if(!_['isNil'](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x3b')])){channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0x3c')]=_0x2684fd['value'];}if(!_['isNil'](_0x2684fd['variable'][_0x55b8('0x3d')])){channels[_0x2684fd[_0x55b8('0x6')]][_0x55b8('0x8')]=_0x2684fd['value'];}if(!_['isNil'](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x3e')])){channels[_0x2684fd['uniqueid']][_0x55b8('0x3f')]=_0x2684fd[_0x55b8('0x32')];}if(!_['isNil'](_0x2684fd[_0x55b8('0x30')][_0x55b8('0x40')])){channels[_0x2684fd[_0x55b8('0x6')]]['sipcallid']=_0x2684fd[_0x55b8('0x32')];}}}catch(_0x303326){utils['error'](_0x303326[_0x55b8('0x18')]);}};exports[_0x55b8('0x41')]=function(_0x1d4775){try{if(!_['isNil'](channels[_0x1d4775[_0x55b8('0x6')]])){if(_0x1d4775[_0x55b8('0x42')][_0x55b8('0x43')]()==_0x55b8('0x44')&&_[_0x55b8('0x45')](_0x1d4775[_0x55b8('0x46')][_0x55b8('0x43')](),'cdr')){var _0xfd886f=_0x1d4775[_0x55b8('0x46')][_0x55b8('0x47')]('=');var _0x1aa818=_0xfd886f[0x0][_0x55b8('0x48')](_0xfd886f[0x0]['lastIndexOf']('(')+0x1,_0xfd886f[0x0]['lastIndexOf'](')'));var _0x2beb1a=_0xfd886f[0x1];channels[_0x1d4775[_0x55b8('0x6')]][_0x1aa818]=_0x2beb1a;}if(!_[_0x55b8('0x49')](['hangup',_0x55b8('0x4a'),_0x55b8('0x4b'),_0x55b8('0x44'),_0x55b8('0x4c')],_0x1d4775[_0x55b8('0x42')][_0x55b8('0x43')]())){channels[_0x1d4775['uniqueid']][_0x55b8('0x37')]=_0x1d4775['application'];channels[_0x1d4775[_0x55b8('0x6')]][_0x55b8('0x39')]=_0x1d4775[_0x55b8('0x46')];}}}catch(_0x6ae1dc){utils['error'](_0x6ae1dc['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6b8c3b0..e8a6901 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 _0xa6b0=['lodash','CONNECTED','shutdown','info','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x46b958,_0x1e77f6){_0x46b958=_0x46b958-0x0;var _0x2be5e6=_0xa6b0[_0x46b958];return _0x2be5e6;};'use strict';var utils=require(_0x0a6b('0x0'));var _=require(_0x0a6b('0x1'));exports['connect']=function(){utils['info'](_0x0a6b('0x2'));};exports[_0x0a6b('0x3')]=function(){utils[_0x0a6b('0x4')]('SHUTDOWN');};exports[_0x0a6b('0x5')]=function(){utils[_0x0a6b('0x4')](_0x0a6b('0x6'));};exports[_0x0a6b('0x7')]=function(_0x3dc2b0){utils[_0x0a6b('0x7')](_0x3dc2b0);};exports[_0x0a6b('0x8')]=function(){utils[_0x0a6b('0x4')](_0x0a6b('0x9'));};exports[_0x0a6b('0xa')]=function(_0x8e89f){}; \ No newline at end of file +var _0x01d9=['./utils','lodash','connect','info','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent'];(function(_0xe35241,_0x41e27b){var _0x9ef434=function(_0xd98456){while(--_0xd98456){_0xe35241['push'](_0xe35241['shift']());}};_0x9ef434(++_0x41e27b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x901d('0x0'));var _=require(_0x901d('0x1'));exports[_0x901d('0x2')]=function(){utils[_0x901d('0x3')]('CONNECTED');};exports[_0x901d('0x4')]=function(){utils[_0x901d('0x3')](_0x901d('0x5'));};exports[_0x901d('0x6')]=function(){utils[_0x901d('0x3')](_0x901d('0x7'));};exports[_0x901d('0x8')]=function(_0x4e7842){utils[_0x901d('0x8')](_0x4e7842);};exports[_0x901d('0x9')]=function(){utils[_0x901d('0x3')](_0x901d('0xa'));};exports[_0x901d('0xb')]=function(_0x39fc94){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b20cd05..3b44d4a 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 _0xf84a=['hangup','duration','diffTime','endtime','holdtime','billableseconds','answertime','./utils','info','format','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','newexten','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','error','stack','varset','isNil','variable','outboundrouteid','dialbegin','assign','starttime','now','lastevent','dialend','connect'];(function(_0x291ee6,_0x474ca5){var _0x2f1dc2=function(_0xb293e){while(--_0xb293e){_0x291ee6['push'](_0x291ee6['shift']());}};_0x2f1dc2(++_0x474ca5);}(_0xf84a,0x97));var _0xaf84=function(_0x51e1aa,_0x453383){_0x51e1aa=_0x51e1aa-0x0;var _0x2fd1c8=_0xf84a[_0x51e1aa];return _0x2fd1c8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xaf84('0x0'));var dials={};function writeDB(_0x205c20){utils[_0xaf84('0x1')](util[_0xaf84('0x2')]('DIAL|%s|%s|%s|%s|%s|%s',_0x205c20[_0xaf84('0x3')],_0x205c20[_0xaf84('0x4')],_0x205c20['dialstring'],_0x205c20[_0xaf84('0x5')],_0x205c20[_0xaf84('0x6')],_0x205c20[_0xaf84('0x7')]));utils[_0xaf84('0x8')]('CreateVoiceDialReport',_0x205c20);delete dials[_0x205c20[_0xaf84('0x3')]];}exports[_0xaf84('0x9')]=function(_0x30e31c){try{if(_0x30e31c[_0xaf84('0xa')]['toLowerCase']()==_0xaf84('0xb')&&_[_0xaf84('0xc')](_0x30e31c[_0xaf84('0xd')][_0xaf84('0xe')](),_0xaf84('0xf'))){var _0x222ccb=_0x30e31c['appdata']['split']('=');dials[_0x30e31c['uniqueid']]={'routeId':_0x222ccb[0x1]};}}catch(_0x5b654f){utils[_0xaf84('0x10')](_0x5b654f[_0xaf84('0x11')]);}};exports[_0xaf84('0x12')]=function(_0x4124c4){try{if(!_[_0xaf84('0x13')](_0x4124c4[_0xaf84('0x14')][_0xaf84('0x15')])){dials[_0x4124c4[_0xaf84('0x3')]]={'routeId':_0x4124c4['value']};}}catch(_0x26673f){utils[_0xaf84('0x10')](_0x26673f['stack']);}};exports[_0xaf84('0x16')]=function(_0x26200c){try{if(!_['isNil'](dials[_0x26200c[_0xaf84('0x3')]])){dials[_0x26200c[_0xaf84('0x3')]]=_[_0xaf84('0x17')](dials[_0x26200c[_0xaf84('0x3')]],_0x26200c);dials[_0x26200c[_0xaf84('0x3')]][_0xaf84('0x18')]=utils[_0xaf84('0x19')]();dials[_0x26200c[_0xaf84('0x3')]][_0xaf84('0x1a')]='called';}}catch(_0x2a11de){utils[_0xaf84('0x10')](_0x2a11de[_0xaf84('0x11')]);}};exports[_0xaf84('0x1b')]=function(_0x1e70e5){try{if(!_[_0xaf84('0x13')](dials[_0x1e70e5[_0xaf84('0x3')]])){dials[_0x1e70e5['uniqueid']]['dialstatus']=_0x1e70e5['dialstatus'];if(_0x1e70e5['dialstatus']=='ANSWER'){dials[_0x1e70e5['uniqueid']]=_[_0xaf84('0x17')](dials[_0x1e70e5[_0xaf84('0x3')]],_0x1e70e5);dials[_0x1e70e5[_0xaf84('0x3')]]['answertime']=utils[_0xaf84('0x19')]();dials[_0x1e70e5[_0xaf84('0x3')]]['lastevent']=_0xaf84('0x1c');}}}catch(_0x1c797c){utils[_0xaf84('0x10')](_0x1c797c[_0xaf84('0x11')]);}};exports[_0xaf84('0x1d')]=function(_0x577fb3){try{if(!_[_0xaf84('0x13')](dials[_0x577fb3[_0xaf84('0x3')]])){dials[_0x577fb3[_0xaf84('0x3')]]=_['assign'](dials[_0x577fb3[_0xaf84('0x3')]],{'endtime':utils[_0xaf84('0x19')](),'lastevent':'complete'});dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x1e')]=utils[_0xaf84('0x1f')](dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x20')],dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x18')]);dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x21')]=utils[_0xaf84('0x1f')](dials[_0x577fb3[_0xaf84('0x3')]]['answertime']||dials[_0x577fb3['uniqueid']][_0xaf84('0x20')],dials[_0x577fb3['uniqueid']][_0xaf84('0x18')]);dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x22')]=dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x23')]?utils[_0xaf84('0x1f')](dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x20')],dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x23')]):0x0;writeDB(dials[_0x577fb3['uniqueid']]);}}catch(_0x26beb1){utils[_0xaf84('0x10')](_0x26beb1[_0xaf84('0x11')]);}}; \ No newline at end of file +var _0x8aac=['CreateVoiceDialReport','uniqueid','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','stack','varset','isNil','outboundrouteid','error','dialbegin','starttime','now','called','dialstatus','ANSWER','assign','answertime','lastevent','connect','hangup','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','channel','dialstring','calleridnum','connectedlinenum'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x8aac,0x6f));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8aa('0x0'));var util=require(_0xc8aa('0x1'));var utils=require(_0xc8aa('0x2'));var dials={};function writeDB(_0x21f8aa){utils['info'](util[_0xc8aa('0x3')](_0xc8aa('0x4'),_0x21f8aa['uniqueid'],_0x21f8aa[_0xc8aa('0x5')],_0x21f8aa[_0xc8aa('0x6')],_0x21f8aa[_0xc8aa('0x7')],_0x21f8aa[_0xc8aa('0x8')],_0x21f8aa['dialstatus']));utils['request'](_0xc8aa('0x9'),_0x21f8aa);delete dials[_0x21f8aa[_0xc8aa('0xa')]];}exports[_0xc8aa('0xb')]=function(_0x33f5df){try{if(_0x33f5df[_0xc8aa('0xc')][_0xc8aa('0xd')]()==_0xc8aa('0xe')&&_[_0xc8aa('0xf')](_0x33f5df[_0xc8aa('0x10')]['toLowerCase'](),_0xc8aa('0x11'))){var _0x3fef6e=_0x33f5df[_0xc8aa('0x10')]['split']('=');dials[_0x33f5df[_0xc8aa('0xa')]]={'routeId':_0x3fef6e[0x1]};}}catch(_0x73f773){utils['error'](_0x73f773[_0xc8aa('0x12')]);}};exports[_0xc8aa('0x13')]=function(_0x21bea4){try{if(!_[_0xc8aa('0x14')](_0x21bea4['variable'][_0xc8aa('0x15')])){dials[_0x21bea4[_0xc8aa('0xa')]]={'routeId':_0x21bea4['value']};}}catch(_0x1affa0){utils[_0xc8aa('0x16')](_0x1affa0[_0xc8aa('0x12')]);}};exports[_0xc8aa('0x17')]=function(_0x598660){try{if(!_['isNil'](dials[_0x598660[_0xc8aa('0xa')]])){dials[_0x598660['uniqueid']]=_['assign'](dials[_0x598660['uniqueid']],_0x598660);dials[_0x598660['uniqueid']][_0xc8aa('0x18')]=utils[_0xc8aa('0x19')]();dials[_0x598660[_0xc8aa('0xa')]]['lastevent']=_0xc8aa('0x1a');}}catch(_0x389115){utils[_0xc8aa('0x16')](_0x389115['stack']);}};exports['dialend']=function(_0x747f04){try{if(!_[_0xc8aa('0x14')](dials[_0x747f04[_0xc8aa('0xa')]])){dials[_0x747f04['uniqueid']][_0xc8aa('0x1b')]=_0x747f04['dialstatus'];if(_0x747f04[_0xc8aa('0x1b')]==_0xc8aa('0x1c')){dials[_0x747f04[_0xc8aa('0xa')]]=_[_0xc8aa('0x1d')](dials[_0x747f04['uniqueid']],_0x747f04);dials[_0x747f04[_0xc8aa('0xa')]][_0xc8aa('0x1e')]=utils[_0xc8aa('0x19')]();dials[_0x747f04[_0xc8aa('0xa')]][_0xc8aa('0x1f')]=_0xc8aa('0x20');}}}catch(_0x5ba81d){utils[_0xc8aa('0x16')](_0x5ba81d[_0xc8aa('0x12')]);}};exports[_0xc8aa('0x21')]=function(_0x35fb05){try{if(!_[_0xc8aa('0x14')](dials[_0x35fb05[_0xc8aa('0xa')]])){dials[_0x35fb05[_0xc8aa('0xa')]]=_[_0xc8aa('0x1d')](dials[_0x35fb05[_0xc8aa('0xa')]],{'endtime':utils['now'](),'lastevent':_0xc8aa('0x22')});dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x23')]=utils['diffTime'](dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x24')],dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x18')]);dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x25')]=utils[_0xc8aa('0x26')](dials[_0x35fb05['uniqueid']][_0xc8aa('0x1e')]||dials[_0x35fb05['uniqueid']][_0xc8aa('0x24')],dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x18')]);dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x27')]=dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x1e')]?utils[_0xc8aa('0x26')](dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x24')],dials[_0x35fb05[_0xc8aa('0xa')]][_0xc8aa('0x1e')]):0x0;writeDB(dials[_0x35fb05[_0xc8aa('0xa')]]);}}catch(_0x594210){utils['error'](_0x594210[_0xc8aa('0x12')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 56daf86..8e48ec6 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 _0x22e8=['./dials.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','../../config/environment','./utils','asterisk','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller'];(function(_0x54bdce,_0x2d85b1){var _0x258e37=function(_0x5009bd){while(--_0x5009bd){_0x54bdce['push'](_0x54bdce['shift']());}};_0x258e37(++_0x2d85b1);}(_0x22e8,0x9e));var _0x822e=function(_0x174ccc,_0x3e4257){_0x174ccc=_0x174ccc-0x0;var _0x438b18=_0x22e8[_0x174ccc];return _0x438b18;};var AsteriskManager=require(_0x822e('0x0'));var config=require(_0x822e('0x1'));var utils=require(_0x822e('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x822e('0x3')]['ip'],config['asterisk']['username'],config[_0x822e('0x3')]['password'],!![]);ami[_0x822e('0x4')]();if(config[_0x822e('0x5')]&&config[_0x822e('0x5')][_0x822e('0x6')]){utils[_0x822e('0x7')](_0x822e('0x8'));}else{var agents=require(_0x822e('0x9'));var calls=require(_0x822e('0xa'));var queues=require(_0x822e('0xb'));var recordings=require(_0x822e('0xc'));var members=require(_0x822e('0xd'));var dials=require(_0x822e('0xe'));var transfers=require(_0x822e('0xf'));var core=require(_0x822e('0x10'));ami['on'](_0x822e('0x11'),core[_0x822e('0x11')]);ami['on'](_0x822e('0x12'),core[_0x822e('0x12')]);ami['on'](_0x822e('0x13'),core['fullybooted']);ami['on'](_0x822e('0x14'),core[_0x822e('0x14')]);ami['on'](_0x822e('0x15'),core[_0x822e('0x15')]);ami['on'](_0x822e('0x16'),core[_0x822e('0x16')]);ami['on'](_0x822e('0x17'),function(_0x4e0e17){try{members[_0x822e('0x17')](_0x4e0e17);}catch(_0x5b616b){utils[_0x822e('0x14')](_0x5b616b);}});ami['on'](_0x822e('0x18'),function(_0x389465){try{agents[_0x822e('0x18')](_0x389465);}catch(_0x5785ff){utils[_0x822e('0x14')](_0x5785ff);}});ami['on'](_0x822e('0x19'),function(_0x464d0b){try{agents[_0x822e('0x19')](_0x464d0b);}catch(_0x1fb429){utils[_0x822e('0x14')](_0x1fb429);}});ami['on'](_0x822e('0x1a'),function(_0x1cce18){try{agents[_0x822e('0x1a')](_0x1cce18);queues[_0x822e('0x1a')](_0x1cce18);}catch(_0x369371){utils[_0x822e('0x14')](_0x369371);}});ami['on'](_0x822e('0x1b'),function(_0xd19367){try{agents[_0x822e('0x1b')](_0xd19367);queues[_0x822e('0x1b')](_0xd19367);members[_0x822e('0x1b')](_0xd19367);}catch(_0x5f3fa1){utils[_0x822e('0x14')](_0x5f3fa1);}});ami['on'](_0x822e('0x1c'),function(_0x5c5ad5){try{agents[_0x822e('0x1c')](_0x5c5ad5);queues[_0x822e('0x1c')](_0x5c5ad5);}catch(_0xcff1d6){utils[_0x822e('0x14')](_0xcff1d6);}});ami['on'](_0x822e('0x1d'),function(_0x44e547){try{queues[_0x822e('0x1d')](_0x44e547);recordings[_0x822e('0x1d')](_0x44e547);}catch(_0x36db6b){utils[_0x822e('0x14')](_0x36db6b);}});ami['on']('queuecallerleave',function(_0x5af4d8){try{queues[_0x822e('0x1e')](_0x5af4d8);}catch(_0xd38fa5){utils[_0x822e('0x14')](_0xd38fa5);}});ami['on'](_0x822e('0x1f'),function(_0x49c198){try{queues['musiconholdstart'](_0x49c198);calls[_0x822e('0x1f')](_0x49c198);}catch(_0x242ad0){utils['error'](_0x242ad0);}});ami['on'](_0x822e('0x20'),function(_0x436e0b){try{queues[_0x822e('0x20')](_0x436e0b);calls[_0x822e('0x20')](_0x436e0b);}catch(_0x5a4ca5){utils[_0x822e('0x14')](_0x5a4ca5);}});ami['on'](_0x822e('0x21'),function(_0x398d76){try{calls[_0x822e('0x21')](_0x398d76);recordings[_0x822e('0x21')](_0x398d76);}catch(_0x4d93d8){utils[_0x822e('0x14')](_0x4d93d8);}});ami['on'](_0x822e('0x22'),function(_0x40a99c){try{calls[_0x822e('0x22')](_0x40a99c);recordings['hangup'](_0x40a99c);dials[_0x822e('0x22')](_0x40a99c);agents[_0x822e('0x22')](_0x40a99c);queues['hangup'](_0x40a99c);}catch(_0x176edc){utils[_0x822e('0x14')](_0x176edc);}});ami['on'](_0x822e('0x23'),function(_0x4cbf50){try{members[_0x822e('0x23')](_0x4cbf50);}catch(_0x20eb1d){utils[_0x822e('0x14')](_0x20eb1d);}});ami['on'](_0x822e('0x24'),function(_0xb112e3){try{queues['blindtransfer'](_0xb112e3);agents[_0x822e('0x24')](_0xb112e3);transfers[_0x822e('0x24')](_0xb112e3);}catch(_0x1f7a0e){utils[_0x822e('0x14')](_0x1f7a0e);}});ami['on'](_0x822e('0x25'),function(_0xcf0b76){try{queues[_0x822e('0x25')](_0xcf0b76);transfers['attendedtransfer'](_0xcf0b76);agents[_0x822e('0x25')](_0xcf0b76);calls[_0x822e('0x25')](_0xcf0b76);}catch(_0x1ce7b6){utils[_0x822e('0x14')](_0x1ce7b6);}});ami['on'](_0x822e('0x26'),function(_0x25de73){try{queues['varset'](_0x25de73);recordings[_0x822e('0x26')](_0x25de73);calls[_0x822e('0x26')](_0x25de73);dials['varset'](_0x25de73);}catch(_0x1bcd2b){utils[_0x822e('0x14')](_0x1bcd2b);}});ami['on'](_0x822e('0x27'),function(_0x1b89f5){try{calls[_0x822e('0x27')](_0x1b89f5);recordings[_0x822e('0x27')](_0x1b89f5);dials['newexten'](_0x1b89f5);}catch(_0x30686a){utils[_0x822e('0x14')](_0x30686a);}});ami['on'](_0x822e('0x28'),function(_0x3e9060){try{calls[_0x822e('0x28')](_0x3e9060);recordings[_0x822e('0x28')](_0x3e9060);}catch(_0x5535c7){utils[_0x822e('0x14')](_0x5535c7);}});ami['on'](_0x822e('0x29'),function(_0x860bd9){try{dials[_0x822e('0x29')](_0x860bd9);}catch(_0x5de2ac){utils['error'](_0x5de2ac);}});ami['on'](_0x822e('0x2a'),function(_0x3e3421){try{dials[_0x822e('0x2a')](_0x3e3421);}catch(_0x3fe31e){utils[_0x822e('0x14')](_0x3fe31e);}});} \ No newline at end of file +var _0x72cd=['agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','port','username','password','keepConnected','xdr','info','./calls.controller','./queues.controller','./recordings.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x4ec7d5,_0xb7a91d){var _0x21a5a2=function(_0x46f144){while(--_0x46f144){_0x4ec7d5['push'](_0x4ec7d5['shift']());}};_0x21a5a2(++_0xb7a91d);}(_0x72cd,0xd0));var _0xd72c=function(_0xad1c7a,_0x1613d8){_0xad1c7a=_0xad1c7a-0x0;var _0x56c45d=_0x72cd[_0xad1c7a];return _0x56c45d;};var AsteriskManager=require(_0xd72c('0x0'));var config=require('../../config/environment');var utils=require(_0xd72c('0x1'));var ami=new AsteriskManager(config[_0xd72c('0x2')][_0xd72c('0x3')],config[_0xd72c('0x2')]['ip'],config[_0xd72c('0x2')][_0xd72c('0x4')],config['asterisk'][_0xd72c('0x5')],!![]);ami[_0xd72c('0x6')]();if(config[_0xd72c('0x7')]&&config[_0xd72c('0x7')]['disabled']){utils[_0xd72c('0x8')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0xd72c('0x9'));var queues=require(_0xd72c('0xa'));var recordings=require(_0xd72c('0xb'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0xd72c('0xc'));ami['on'](_0xd72c('0xd'),core[_0xd72c('0xd')]);ami['on'](_0xd72c('0xe'),core[_0xd72c('0xe')]);ami['on'](_0xd72c('0xf'),core[_0xd72c('0xf')]);ami['on'](_0xd72c('0x10'),core[_0xd72c('0x10')]);ami['on'](_0xd72c('0x11'),core[_0xd72c('0x11')]);ami['on'](_0xd72c('0x12'),core['managerevent']);ami['on'](_0xd72c('0x13'),function(_0x6a6fed){try{members[_0xd72c('0x13')](_0x6a6fed);}catch(_0x2c89fe){utils[_0xd72c('0x10')](_0x2c89fe);}});ami['on'](_0xd72c('0x14'),function(_0x1ef6db){try{agents[_0xd72c('0x14')](_0x1ef6db);}catch(_0x430e98){utils['error'](_0x430e98);}});ami['on'](_0xd72c('0x15'),function(_0x1f227e){try{agents[_0xd72c('0x15')](_0x1f227e);}catch(_0x5a3fd3){utils['error'](_0x5a3fd3);}});ami['on']('agentconnect',function(_0x589c79){try{agents[_0xd72c('0x16')](_0x589c79);queues[_0xd72c('0x16')](_0x589c79);}catch(_0x5732cd){utils[_0xd72c('0x10')](_0x5732cd);}});ami['on'](_0xd72c('0x17'),function(_0x528b63){try{agents[_0xd72c('0x17')](_0x528b63);queues[_0xd72c('0x17')](_0x528b63);members[_0xd72c('0x17')](_0x528b63);}catch(_0x33559c){utils[_0xd72c('0x10')](_0x33559c);}});ami['on'](_0xd72c('0x18'),function(_0xa9d1c0){try{agents[_0xd72c('0x18')](_0xa9d1c0);queues['queuecallerabandon'](_0xa9d1c0);}catch(_0x323479){utils['error'](_0x323479);}});ami['on'](_0xd72c('0x19'),function(_0x41fabc){try{queues['queuecallerjoin'](_0x41fabc);recordings[_0xd72c('0x19')](_0x41fabc);}catch(_0x1cd01a){utils[_0xd72c('0x10')](_0x1cd01a);}});ami['on'](_0xd72c('0x1a'),function(_0x42f02a){try{queues[_0xd72c('0x1a')](_0x42f02a);}catch(_0x187596){utils[_0xd72c('0x10')](_0x187596);}});ami['on']('musiconholdstart',function(_0x46cb86){try{queues[_0xd72c('0x1b')](_0x46cb86);calls['musiconholdstart'](_0x46cb86);}catch(_0xc4f71d){utils[_0xd72c('0x10')](_0xc4f71d);}});ami['on']('musiconholdstop',function(_0x409ec0){try{queues[_0xd72c('0x1c')](_0x409ec0);calls[_0xd72c('0x1c')](_0x409ec0);}catch(_0x185cd6){utils[_0xd72c('0x10')](_0x185cd6);}});ami['on']('newstate',function(_0x150b7d){try{calls['newstate'](_0x150b7d);recordings['newstate'](_0x150b7d);}catch(_0x1740e5){utils[_0xd72c('0x10')](_0x1740e5);}});ami['on']('hangup',function(_0x28d7d1){try{calls['hangup'](_0x28d7d1);recordings[_0xd72c('0x1d')](_0x28d7d1);dials[_0xd72c('0x1d')](_0x28d7d1);agents[_0xd72c('0x1d')](_0x28d7d1);queues['hangup'](_0x28d7d1);}catch(_0x168697){utils[_0xd72c('0x10')](_0x168697);}});ami['on'](_0xd72c('0x1e'),function(_0x1badf7){try{members[_0xd72c('0x1e')](_0x1badf7);}catch(_0x1e9161){utils[_0xd72c('0x10')](_0x1e9161);}});ami['on'](_0xd72c('0x1f'),function(_0x288541){try{queues['blindtransfer'](_0x288541);agents[_0xd72c('0x1f')](_0x288541);transfers[_0xd72c('0x1f')](_0x288541);}catch(_0x5372d6){utils['error'](_0x5372d6);}});ami['on']('attendedtransfer',function(_0x256d7d){try{queues[_0xd72c('0x20')](_0x256d7d);transfers[_0xd72c('0x20')](_0x256d7d);agents[_0xd72c('0x20')](_0x256d7d);calls[_0xd72c('0x20')](_0x256d7d);}catch(_0x5e4042){utils['error'](_0x5e4042);}});ami['on']('varset',function(_0x318fcf){try{queues[_0xd72c('0x21')](_0x318fcf);recordings[_0xd72c('0x21')](_0x318fcf);calls['varset'](_0x318fcf);dials[_0xd72c('0x21')](_0x318fcf);}catch(_0xb06102){utils[_0xd72c('0x10')](_0xb06102);}});ami['on'](_0xd72c('0x22'),function(_0x57ed76){try{calls[_0xd72c('0x22')](_0x57ed76);recordings[_0xd72c('0x22')](_0x57ed76);dials[_0xd72c('0x22')](_0x57ed76);}catch(_0x1cf61c){utils[_0xd72c('0x10')](_0x1cf61c);}});ami['on']('newchannel',function(_0x522989){try{calls['newchannel'](_0x522989);recordings[_0xd72c('0x23')](_0x522989);}catch(_0x4e9925){utils['error'](_0x4e9925);}});ami['on'](_0xd72c('0x24'),function(_0x15409b){try{dials['dialbegin'](_0x15409b);}catch(_0x105f84){utils[_0xd72c('0x10')](_0x105f84);}});ami['on'](_0xd72c('0x25'),function(_0x549686){try{dials[_0xd72c('0x25')](_0x549686);}catch(_0x319aae){utils[_0xd72c('0x10')](_0x319aae);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b6a0cef..c2a6575 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 _0x69b9=['type','data3','destination','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','getUserByInterface','then','name','internal','request','split','CreateMemberReport','some','startsWith','devicestatechange','state','INUSE','BUSY','device','now','agent','NOT_INUSE','exitAt','diffTime','enterAt','agentcomplete','assign','queue','cdr','channel','isNil','data1'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x69b9,0xb1));var _0x969b=function(_0x49e8a8,_0x416645){_0x49e8a8=_0x49e8a8-0x0;var _0x55a0aa=_0x69b9[_0x49e8a8];return _0x55a0aa;};'use strict';var _=require(_0x969b('0x0'));var util=require('util');var utils=require(_0x969b('0x1'));var members={};var exclude=[_0x969b('0x2'),_0x969b('0x3')];function writeDB(_0x72d910){utils[_0x969b('0x4')](util[_0x969b('0x5')](_0x969b('0x6'),_0x72d910[_0x969b('0x7')],_0x72d910[_0x969b('0x8')],_0x72d910['channel'],_0x72d910[_0x969b('0x9')],_0x72d910[_0x969b('0xa')],_0x72d910['type']));if(_0x72d910[_0x969b('0x8')]){utils[_0x969b('0xb')](_0x72d910[_0x969b('0x8')])[_0x969b('0xc')](function(_0x60482){if(_0x60482){_0x72d910[_0x969b('0xa')]=_0x60482[_0x969b('0xd')];_0x72d910[_0x969b('0xe')]=_0x60482[_0x969b('0xe')];utils[_0x969b('0xf')]('CreateMemberReport',_0x72d910);}else{utils['getUserByName'](_0x72d910[_0x969b('0x8')][_0x969b('0x10')]('/')[0x1])[_0x969b('0xc')](function(_0x5d9e87){if(_0x5d9e87){_0x72d910[_0x969b('0xa')]=_0x5d9e87[_0x969b('0xd')];_0x72d910[_0x969b('0xe')]=_0x5d9e87[_0x969b('0xe')];utils[_0x969b('0xf')](_0x969b('0x11'),_0x72d910);}});}})['catch'](function(_0x1723fc){utils['error'](_0x1723fc);});}delete members[_0x72d910[_0x969b('0x8')]];}function startsWith(_0x4293da,_0x3e9585){return _[_0x969b('0x12')](_0x4293da,function(_0x5b6c3b){return _[_0x969b('0x13')](_0x3e9585,_0x5b6c3b);});}exports[_0x969b('0x14')]=function(_0x14cb99){switch(_0x14cb99[_0x969b('0x15')]){case _0x969b('0x16'):case _0x969b('0x17'):if(!startsWith(exclude,_0x14cb99[_0x969b('0x18')])){members[_0x14cb99[_0x969b('0x18')]]={'channel':'voice','interface':_0x14cb99[_0x969b('0x18')],'type':'TALKING','enterAt':utils[_0x969b('0x19')](),'role':_0x969b('0x1a')};}break;case _0x969b('0x1b'):if(!_['isNil'](members[_0x14cb99[_0x969b('0x18')]])){members[_0x14cb99['device']][_0x969b('0x1c')]=utils[_0x969b('0x19')]();members[_0x14cb99[_0x969b('0x18')]]['duration']=utils[_0x969b('0x1d')](members[_0x14cb99[_0x969b('0x18')]][_0x969b('0x1c')],members[_0x14cb99[_0x969b('0x18')]][_0x969b('0x1e')]);if(members[_0x14cb99[_0x969b('0x18')]][_0x969b('0x7')]){writeDB(members[_0x14cb99[_0x969b('0x18')]]);}}default:break;}};exports[_0x969b('0x1f')]=function(_0x205659){if(!_['isNil'](members[_0x205659['interface']])){members[_0x205659[_0x969b('0x8')]]=_[_0x969b('0x20')](members[_0x205659[_0x969b('0x8')]],{'data4':_0x205659[_0x969b('0x21')],'uniqueid':_0x205659[_0x969b('0x7')]});}};exports[_0x969b('0x22')]=function(_0x27c6ef){if(_0x27c6ef[_0x969b('0x23')]){var _0x1b8ca2=_0x27c6ef[_0x969b('0x23')][_0x969b('0x10')]('-')[0x0];if(!_[_0x969b('0x24')](members[_0x1b8ca2])){members[_0x1b8ca2]=_['assign'](members[_0x1b8ca2],{'data1':members[_0x1b8ca2][_0x969b('0x25')]||_0x27c6ef[_0x969b('0x26')],'data2':members[_0x1b8ca2][_0x969b('0x9')]||_0x27c6ef['source'],'data3':members[_0x1b8ca2][_0x969b('0x27')]||_0x27c6ef[_0x969b('0x28')],'uniqueid':members[_0x1b8ca2][_0x969b('0x7')]||_0x27c6ef[_0x969b('0x7')]});if(members[_0x1b8ca2][_0x969b('0x1c')]){writeDB(members[_0x1b8ca2]);}}}if(_0x27c6ef['destinationchannel']){var _0x4eb5fb=_0x27c6ef[_0x969b('0x29')][_0x969b('0x10')]('-')[0x0];if(!_[_0x969b('0x24')](members[_0x4eb5fb])){members[_0x4eb5fb]=_[_0x969b('0x20')](members[_0x4eb5fb],{'data1':members[_0x4eb5fb][_0x969b('0x25')]||_0x27c6ef[_0x969b('0x26')],'data2':members[_0x4eb5fb][_0x969b('0x9')]||_0x27c6ef[_0x969b('0x2a')],'data3':members[_0x4eb5fb]['data3']||_0x27c6ef['destination'],'uniqueid':members[_0x4eb5fb][_0x969b('0x7')]||_0x27c6ef[_0x969b('0x7')]});if(members[_0x4eb5fb][_0x969b('0x1c')]){writeDB(members[_0x4eb5fb]);}}}}; \ No newline at end of file +var _0x10c7=['CreateMemberReport','getUserByName','split','catch','startsWith','devicestatechange','state','INUSE','BUSY','device','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','queue','cdr','channel','assign','type','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','getUserByInterface','then','name','internal','request'];(function(_0x22fb11,_0x7919ef){var _0x126d26=function(_0x3499c8){while(--_0x3499c8){_0x22fb11['push'](_0x22fb11['shift']());}};_0x126d26(++_0x7919ef);}(_0x10c7,0x1c9));var _0x710c=function(_0x3522c8,_0x1e7c82){_0x3522c8=_0x3522c8-0x0;var _0x22f498=_0x10c7[_0x3522c8];return _0x22f498;};'use strict';var _=require(_0x710c('0x0'));var util=require(_0x710c('0x1'));var utils=require(_0x710c('0x2'));var members={};var exclude=[_0x710c('0x3'),_0x710c('0x4')];function writeDB(_0x501fc6){utils[_0x710c('0x5')](util['format'](_0x710c('0x6'),_0x501fc6[_0x710c('0x7')],_0x501fc6[_0x710c('0x8')],_0x501fc6['channel'],_0x501fc6[_0x710c('0x9')],_0x501fc6[_0x710c('0xa')],_0x501fc6['type']));if(_0x501fc6[_0x710c('0x8')]){utils[_0x710c('0xb')](_0x501fc6[_0x710c('0x8')])[_0x710c('0xc')](function(_0x36723e){if(_0x36723e){_0x501fc6[_0x710c('0xa')]=_0x36723e[_0x710c('0xd')];_0x501fc6[_0x710c('0xe')]=_0x36723e[_0x710c('0xe')];utils[_0x710c('0xf')](_0x710c('0x10'),_0x501fc6);}else{utils[_0x710c('0x11')](_0x501fc6['interface'][_0x710c('0x12')]('/')[0x1])[_0x710c('0xc')](function(_0x28432d){if(_0x28432d){_0x501fc6[_0x710c('0xa')]=_0x28432d[_0x710c('0xd')];_0x501fc6['internal']=_0x28432d[_0x710c('0xe')];utils['request']('CreateMemberReport',_0x501fc6);}});}})[_0x710c('0x13')](function(_0x4c8317){utils['error'](_0x4c8317);});}delete members[_0x501fc6[_0x710c('0x8')]];}function startsWith(_0x294af,_0x35fc51){return _['some'](_0x294af,function(_0x3ce4b4){return _[_0x710c('0x14')](_0x35fc51,_0x3ce4b4);});}exports[_0x710c('0x15')]=function(_0x3e7ab9){switch(_0x3e7ab9[_0x710c('0x16')]){case _0x710c('0x17'):case _0x710c('0x18'):if(!startsWith(exclude,_0x3e7ab9['device'])){members[_0x3e7ab9['device']]={'channel':'voice','interface':_0x3e7ab9[_0x710c('0x19')],'type':'TALKING','enterAt':utils[_0x710c('0x1a')](),'role':_0x710c('0x1b')};}break;case _0x710c('0x1c'):if(!_[_0x710c('0x1d')](members[_0x3e7ab9[_0x710c('0x19')]])){members[_0x3e7ab9['device']][_0x710c('0x1e')]=utils[_0x710c('0x1a')]();members[_0x3e7ab9[_0x710c('0x19')]]['duration']=utils[_0x710c('0x1f')](members[_0x3e7ab9['device']][_0x710c('0x1e')],members[_0x3e7ab9[_0x710c('0x19')]][_0x710c('0x20')]);if(members[_0x3e7ab9[_0x710c('0x19')]]['uniqueid']){writeDB(members[_0x3e7ab9['device']]);}}default:break;}};exports[_0x710c('0x21')]=function(_0x18536c){if(!_['isNil'](members[_0x18536c['interface']])){members[_0x18536c[_0x710c('0x8')]]=_['assign'](members[_0x18536c[_0x710c('0x8')]],{'data4':_0x18536c[_0x710c('0x22')],'uniqueid':_0x18536c['uniqueid']});}};exports[_0x710c('0x23')]=function(_0x36d646){if(_0x36d646['channel']){var _0x5303a0=_0x36d646[_0x710c('0x24')][_0x710c('0x12')]('-')[0x0];if(!_['isNil'](members[_0x5303a0])){members[_0x5303a0]=_[_0x710c('0x25')](members[_0x5303a0],{'data1':members[_0x5303a0]['data1']||_0x36d646[_0x710c('0x26')],'data2':members[_0x5303a0][_0x710c('0x9')]||_0x36d646[_0x710c('0x27')],'data3':members[_0x5303a0][_0x710c('0x28')]||_0x36d646[_0x710c('0x29')],'uniqueid':members[_0x5303a0][_0x710c('0x7')]||_0x36d646['uniqueid']});if(members[_0x5303a0]['exitAt']){writeDB(members[_0x5303a0]);}}}if(_0x36d646['destinationchannel']){var _0x1ced4f=_0x36d646[_0x710c('0x2a')][_0x710c('0x12')]('-')[0x0];if(!_[_0x710c('0x1d')](members[_0x1ced4f])){members[_0x1ced4f]=_[_0x710c('0x25')](members[_0x1ced4f],{'data1':members[_0x1ced4f]['data1']||_0x36d646[_0x710c('0x26')],'data2':members[_0x1ced4f][_0x710c('0x9')]||_0x36d646['source'],'data3':members[_0x1ced4f][_0x710c('0x28')]||_0x36d646[_0x710c('0x29')],'uniqueid':members[_0x1ced4f][_0x710c('0x7')]||_0x36d646['uniqueid']});if(members[_0x1ced4f][_0x710c('0x1e')]){writeDB(members[_0x1ced4f]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 1f69995..db28bd8 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 _0x6d31=['calleridnum','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','transfertype','secondtransfererexten','transfertargetlinkedid','error','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','assign','position','now','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','EXITWITHKEY','queuecallerabandonAt','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','count','connectedlinenum','connectedlinename','assigned','destaccountcode','lastAssignedTo','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid'];(function(_0x155506,_0x202f81){var _0x14b973=function(_0x560bd2){while(--_0x560bd2){_0x155506['push'](_0x155506['shift']());}};_0x14b973(++_0x202f81);}(_0x6d31,0x193));var _0x16d3=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x6d31[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x16d3('0x0'));var util=require('util');var utils=require(_0x16d3('0x1'));var queues={};function writeDB(_0x341f7d){utils[_0x16d3('0x2')](util[_0x16d3('0x3')](_0x16d3('0x4'),_0x341f7d[_0x16d3('0x5')],_0x341f7d[_0x16d3('0x6')],_0x341f7d['queue'],_0x341f7d['lastAssignedTo'],_0x341f7d['calleridnum'],_0x341f7d[_0x16d3('0x7')],_0x341f7d[_0x16d3('0x8')]));if(_0x341f7d[_0x16d3('0x9')]){utils[_0x16d3('0xa')](_0x341f7d[_0x16d3('0x9')])[_0x16d3('0xb')](function(_0x25f1bf){if(_0x25f1bf){_0x341f7d[_0x16d3('0xc')]=_0x25f1bf['type'];}utils['request'](_0x16d3('0xd'),_0x341f7d);});}else{utils['request'](_0x16d3('0xd'),_0x341f7d);}if(_0x341f7d[_0x16d3('0xe')]){delete queues[_0x341f7d[_0x16d3('0xe')]];}else{delete queues[_0x341f7d['uniqueid']];}}exports['queuecallerjoin']=function(_0x4761b5){queues[_0x4761b5[_0x16d3('0x5')]]=_[_0x16d3('0xf')](_0x4761b5,{'originalposition':_0x4761b5[_0x16d3('0x10')],'queuecallerjoinAt':utils[_0x16d3('0x11')](),'mohtime':0x0});};exports['hangup']=function(_0x3a96dc){if(!_[_0x16d3('0x12')](queues[_0x3a96dc['uniqueid']])){if(queues[_0x3a96dc[_0x16d3('0x5')]]['queuecallerleaveAt']){if(!queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x13')]&&!queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x14')]){queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x15')]=!![];queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x16')]=utils[_0x16d3('0x11')]();queues[_0x3a96dc[_0x16d3('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x3a96dc[_0x16d3('0x5')]]);}else{if(queues[_0x3a96dc['uniqueid']][_0x16d3('0xe')]){queues[queues[_0x3a96dc[_0x16d3('0x5')]]['transfereduniqueid']]=queues[_0x3a96dc[_0x16d3('0x5')]];queues[queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0xe')]][_0x16d3('0x17')]=0x2;delete queues[_0x3a96dc['uniqueid']];}}}};exports[_0x16d3('0x18')]=function(_0x5e6a82){if(!_['isNil'](_0x5e6a82[_0x16d3('0x19')][_0x16d3('0x1a')])&&_0x5e6a82[_0x16d3('0x1b')][_0x16d3('0x1c')]()!==_0x16d3('0x1d')){if(!_[_0x16d3('0x12')](queues[_0x5e6a82['uniqueid']])){queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x14')]=!![];queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x1e')]=utils[_0x16d3('0x11')]();queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x8')]=_0x5e6a82[_0x16d3('0x1b')][_0x16d3('0x1c')]();writeDB(queues[_0x5e6a82[_0x16d3('0x5')]]);}}else if(!_['isNil'](_0x5e6a82[_0x16d3('0x19')][_0x16d3('0x1f')])){if(!_['isNil'](queues[_0x5e6a82[_0x16d3('0x5')]])&&!queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandon']){queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandon']=![];queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x14')]=!![];queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x1e')]=utils[_0x16d3('0x11')]();queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerexitreason']=_0x16d3('0x20');}}};exports[_0x16d3('0x13')]=function(_0x4d080a){if(!_[_0x16d3('0x12')](queues[_0x4d080a[_0x16d3('0x5')]])){queues[_0x4d080a['uniqueid']]['queuecallerexit']=![];queues[_0x4d080a['uniqueid']][_0x16d3('0x1e')]=null;queues[_0x4d080a[_0x16d3('0x5')]][_0x16d3('0x13')]=!![];queues[_0x4d080a['uniqueid']][_0x16d3('0x21')]=utils[_0x16d3('0x11')]();queues[_0x4d080a[_0x16d3('0x5')]][_0x16d3('0x8')]=_0x16d3('0x22');}};exports[_0x16d3('0x23')]=function(_0x5d211c){if(!_[_0x16d3('0x12')](queues[_0x5d211c[_0x16d3('0x5')]])){queues[_0x5d211c[_0x16d3('0x5')]]['queuecallerleave']=!![];queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x24')]=utils[_0x16d3('0x11')]();queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x25')]=utils['diffTime'](queues[_0x5d211c[_0x16d3('0x5')]]['queuecallerleaveAt'],queues[_0x5d211c[_0x16d3('0x5')]]['queuecallerjoinAt']);queues[_0x5d211c[_0x16d3('0x5')]]['position']=_0x5d211c[_0x16d3('0x10')];queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x26')]=_0x5d211c[_0x16d3('0x26')];queues[_0x5d211c['uniqueid']][_0x16d3('0x27')]=_0x5d211c[_0x16d3('0x27')];queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x28')]=_0x5d211c['connectedlinename'];}};exports['agentconnect']=function(_0x2606e4){if(!_[_0x16d3('0x12')](queues[_0x2606e4[_0x16d3('0x5')]])){queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x2606e4[_0x16d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x14')]=![];queues[_0x2606e4['uniqueid']][_0x16d3('0x8')]=null;queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x1e')]=null;queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x29')]=!![];queues[_0x2606e4['uniqueid']][_0x16d3('0x7')]=_0x2606e4[_0x16d3('0x2a')];queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x2b')]=_0x2606e4['membername'];}};exports[_0x16d3('0x2c')]=function(_0x3a7f05){if(!_[_0x16d3('0x12')](queues[_0x3a7f05[_0x16d3('0x5')]])){if(queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x24')]){queues[_0x3a7f05['uniqueid']][_0x16d3('0x13')]=![];queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x21')]=null;queues[_0x3a7f05[_0x16d3('0x5')]]['queuecallerexit']=![];queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x1e')]=null;queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x29')]=!![];queues[_0x3a7f05[_0x16d3('0x5')]]['lastAssignedTo']=_0x3a7f05['membername'];queues[_0x3a7f05['uniqueid']][_0x16d3('0x15')]=!![];queues[_0x3a7f05['uniqueid']][_0x16d3('0x16')]=utils[_0x16d3('0x11')]();if(_0x3a7f05[_0x16d3('0x2d')]==_0x16d3('0x2e')){if(!queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x2e')]){queues[_0x3a7f05[_0x16d3('0x5')]]['queuecallerexitreason']=_0x16d3('0x2f');}}else{queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x8')]=_0x16d3('0x30')+_0x3a7f05[_0x16d3('0x2d')]['toUpperCase']();}writeDB(queues[_0x3a7f05[_0x16d3('0x5')]]);}}};exports['blindtransfer']=function(_0x6d6c9c){if(!_['isNil'](queues[_0x6d6c9c[_0x16d3('0x31')]])){queues[_0x6d6c9c[_0x16d3('0x31')]][_0x16d3('0x2e')]=!![];queues[_0x6d6c9c['transfereeuniqueid']]['transfertype']=_0x16d3('0x32');queues[_0x6d6c9c[_0x16d3('0x31')]][_0x16d3('0x33')]=_0x6d6c9c[_0x16d3('0x34')];queues[_0x6d6c9c[_0x16d3('0x31')]][_0x16d3('0x35')]=_0x6d6c9c[_0x16d3('0x31')];queues[_0x6d6c9c['transfereeuniqueid']][_0x16d3('0x8')]=_0x16d3('0x36');}};exports[_0x16d3('0x37')]=function(_0xd70ba5){try{if(_0xd70ba5[_0x16d3('0x38')]==_0xd70ba5[_0x16d3('0x39')]){if(!_[_0x16d3('0x12')](queues[_0xd70ba5['secondtransfererlinkedid']])){queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x2e')]=!![];queues[_0xd70ba5[_0x16d3('0x3a')]]['transfertype']=_0x16d3('0x3b');queues[_0xd70ba5['secondtransfererlinkedid']][_0x16d3('0x33')]=_0xd70ba5[_0x16d3('0x3c')];queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x35')]=_0xd70ba5[_0x16d3('0x38')];queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x8')]=_0x16d3('0x3d');}if(!_[_0x16d3('0x12')](queues[_0xd70ba5[_0x16d3('0x39')]])){if(_0xd70ba5['transfereelinkedid']&&queues[_0xd70ba5[_0x16d3('0x3e')]]){queues[_0xd70ba5[_0x16d3('0x3e')]][_0x16d3('0x17')]=0x1;queues[_0xd70ba5[_0x16d3('0x31')]]=_[_0x16d3('0x3f')](queues[_0xd70ba5[_0x16d3('0x3e')]]);queues[_0xd70ba5['transfereeuniqueid']]['transfereduniqueid']=_0xd70ba5[_0x16d3('0x40')];queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x17')]=0x2;queues[_0xd70ba5[_0x16d3('0x31')]]['calleridnum']=queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x41')];queues[_0xd70ba5['transfereeuniqueid']][_0x16d3('0x42')]=queues[_0xd70ba5['secondtransfererlinkedid']][_0x16d3('0x42')];queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x43')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5['transfereeuniqueid']][_0x16d3('0x24')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x25')]=0x0;queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x44')]=0x0;}else{queues[_0xd70ba5['origtransfererlinkedid']][_0x16d3('0xe')]=_0xd70ba5[_0x16d3('0x3a')];}}}else if(_0xd70ba5[_0x16d3('0x45')]==_0xd70ba5['secondtransfererlinkedid']){if(!_['isNil'](queues[_0xd70ba5[_0x16d3('0x39')]])){queues[_0xd70ba5['origtransfererlinkedid']][_0x16d3('0x2e')]=!![];queues[_0xd70ba5[_0x16d3('0x39')]][_0x16d3('0x46')]='ATTENDED';queues[_0xd70ba5[_0x16d3('0x39')]][_0x16d3('0x33')]=_0xd70ba5[_0x16d3('0x47')];queues[_0xd70ba5[_0x16d3('0x39')]][_0x16d3('0x35')]=_0xd70ba5['secondtransfereruniqueid'];queues[_0xd70ba5['origtransfererlinkedid']][_0x16d3('0x8')]=_0x16d3('0x3d');}if(!_[_0x16d3('0x12')](queues[_0xd70ba5[_0x16d3('0x3a')]])){if(_0xd70ba5['transfertargetlinkedid']&&queues[_0xd70ba5[_0x16d3('0x48')]]){queues[_0xd70ba5[_0x16d3('0x48')]][_0x16d3('0x17')]=0x1;queues[_0xd70ba5['transfertargetuniqueid']]=_[_0x16d3('0x3f')](queues[_0xd70ba5[_0x16d3('0x48')]]);queues[_0xd70ba5[_0x16d3('0x40')]]['transfereduniqueid']=_0xd70ba5['transfertargetuniqueid'];queues[_0xd70ba5['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0xd70ba5[_0x16d3('0x40')]][_0x16d3('0x41')]=queues[_0xd70ba5['origtransfererlinkedid']]['calleridnum'];queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x42')]=queues[_0xd70ba5[_0x16d3('0x39')]]['calleridname'];queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x43')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5[_0x16d3('0x40')]][_0x16d3('0x24')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x25')]=0x0;queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x44')]=0x0;}else{queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0xe')]=_0xd70ba5[_0x16d3('0x39')];}}}}catch(_0x545443){utils[_0x16d3('0x49')](_0x545443['stack']);}};exports[_0x16d3('0x4a')]=function(_0x30750d){if(!_[_0x16d3('0x12')](queues[_0x30750d[_0x16d3('0x5')]])){queues[_0x30750d[_0x16d3('0x5')]][_0x16d3('0x4b')]=utils[_0x16d3('0x11')]();}};exports[_0x16d3('0x4c')]=function(_0x5e8d5d){if(!_[_0x16d3('0x12')](queues[_0x5e8d5d['uniqueid']])){if(!_['isNil'](queues[_0x5e8d5d['uniqueid']][_0x16d3('0x4b')])){queues[_0x5e8d5d[_0x16d3('0x5')]][_0x16d3('0x44')]+=utils[_0x16d3('0x4d')](utils['now'](),queues[_0x5e8d5d[_0x16d3('0x5')]][_0x16d3('0x4b')]);delete queues[_0x5e8d5d[_0x16d3('0x5')]][_0x16d3('0x4b')];}}}; \ No newline at end of file +var _0x7a05=['getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','position','now','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','membername','agentcomplete','reason','blindtransfer','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','origtransfereruniqueid','transfereelinkedid','clone','queuecallerenterreason','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','calleridname','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason'];(function(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0x7a05,0x1cf));var _0x57a0=function(_0x4735fe,_0x227ea4){_0x4735fe=_0x4735fe-0x0;var _0x1c4be4=_0x7a05[_0x4735fe];return _0x1c4be4;};'use strict';var _=require(_0x57a0('0x0'));var util=require('util');var utils=require(_0x57a0('0x1'));var queues={};function writeDB(_0x2f072f){utils[_0x57a0('0x2')](util[_0x57a0('0x3')](_0x57a0('0x4'),_0x2f072f['uniqueid'],_0x2f072f[_0x57a0('0x5')],_0x2f072f[_0x57a0('0x6')],_0x2f072f[_0x57a0('0x7')],_0x2f072f[_0x57a0('0x8')],_0x2f072f[_0x57a0('0x9')],_0x2f072f[_0x57a0('0xa')]));if(_0x2f072f['queue']){utils[_0x57a0('0xb')](_0x2f072f['queue'])[_0x57a0('0xc')](function(_0x597f68){if(_0x597f68){_0x2f072f['type']=_0x597f68[_0x57a0('0xd')];}utils[_0x57a0('0xe')](_0x57a0('0xf'),_0x2f072f);});}else{utils[_0x57a0('0xe')](_0x57a0('0xf'),_0x2f072f);}if(_0x2f072f[_0x57a0('0x10')]){delete queues[_0x2f072f[_0x57a0('0x10')]];}else{delete queues[_0x2f072f[_0x57a0('0x11')]];}}exports[_0x57a0('0x12')]=function(_0x24da43){queues[_0x24da43[_0x57a0('0x11')]]=_['assign'](_0x24da43,{'originalposition':_0x24da43[_0x57a0('0x13')],'queuecallerjoinAt':utils[_0x57a0('0x14')](),'mohtime':0x0});};exports['hangup']=function(_0x11f880){if(!_[_0x57a0('0x15')](queues[_0x11f880['uniqueid']])){if(queues[_0x11f880[_0x57a0('0x11')]]['queuecallerleaveAt']){if(!queues[_0x11f880[_0x57a0('0x11')]][_0x57a0('0x16')]&&!queues[_0x11f880[_0x57a0('0x11')]][_0x57a0('0x17')]){queues[_0x11f880[_0x57a0('0x11')]][_0x57a0('0x18')]=!![];queues[_0x11f880['uniqueid']][_0x57a0('0x19')]=utils['now']();queues[_0x11f880[_0x57a0('0x11')]][_0x57a0('0xa')]=_0x57a0('0x1a');}writeDB(queues[_0x11f880['uniqueid']]);}else{if(queues[_0x11f880[_0x57a0('0x11')]][_0x57a0('0x10')]){queues[queues[_0x11f880[_0x57a0('0x11')]]['transfereduniqueid']]=queues[_0x11f880[_0x57a0('0x11')]];queues[queues[_0x11f880['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x11f880[_0x57a0('0x11')]];}}}};exports[_0x57a0('0x1b')]=function(_0x2937b2){if(!_[_0x57a0('0x15')](_0x2937b2[_0x57a0('0x1c')][_0x57a0('0x1d')])&&_0x2937b2['value'][_0x57a0('0x1e')]()!==_0x57a0('0x1f')){if(!_[_0x57a0('0x15')](queues[_0x2937b2[_0x57a0('0x11')]])){queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0x16')]=![];queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0x20')]=null;queues[_0x2937b2[_0x57a0('0x11')]]['queuecallerexit']=!![];queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0x21')]=utils[_0x57a0('0x14')]();queues[_0x2937b2[_0x57a0('0x11')]]['queuecallerexitreason']=_0x2937b2[_0x57a0('0x22')][_0x57a0('0x1e')]();writeDB(queues[_0x2937b2[_0x57a0('0x11')]]);}}else if(!_['isNil'](_0x2937b2['variable'][_0x57a0('0x23')])){if(!_[_0x57a0('0x15')](queues[_0x2937b2[_0x57a0('0x11')]])&&!queues[_0x2937b2['uniqueid']][_0x57a0('0x16')]){queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0x16')]=![];queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0x20')]=null;queues[_0x2937b2[_0x57a0('0x11')]]['queuecallerexit']=!![];queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0x21')]=utils[_0x57a0('0x14')]();queues[_0x2937b2[_0x57a0('0x11')]][_0x57a0('0xa')]=_0x57a0('0x24');}}};exports[_0x57a0('0x16')]=function(_0x1cee79){if(!_[_0x57a0('0x15')](queues[_0x1cee79['uniqueid']])){queues[_0x1cee79[_0x57a0('0x11')]][_0x57a0('0x17')]=![];queues[_0x1cee79['uniqueid']]['queuecallerexitAt']=null;queues[_0x1cee79[_0x57a0('0x11')]][_0x57a0('0x16')]=!![];queues[_0x1cee79['uniqueid']][_0x57a0('0x20')]=utils[_0x57a0('0x14')]();queues[_0x1cee79[_0x57a0('0x11')]]['queuecallerexitreason']=_0x57a0('0x25');}};exports[_0x57a0('0x26')]=function(_0x347113){if(!_[_0x57a0('0x15')](queues[_0x347113['uniqueid']])){queues[_0x347113[_0x57a0('0x11')]][_0x57a0('0x26')]=!![];queues[_0x347113[_0x57a0('0x11')]][_0x57a0('0x27')]=utils[_0x57a0('0x14')]();queues[_0x347113[_0x57a0('0x11')]][_0x57a0('0x28')]=utils[_0x57a0('0x29')](queues[_0x347113['uniqueid']]['queuecallerleaveAt'],queues[_0x347113[_0x57a0('0x11')]][_0x57a0('0x2a')]);queues[_0x347113['uniqueid']][_0x57a0('0x13')]=_0x347113[_0x57a0('0x13')];queues[_0x347113[_0x57a0('0x11')]][_0x57a0('0x2b')]=_0x347113[_0x57a0('0x2b')];queues[_0x347113[_0x57a0('0x11')]][_0x57a0('0x2c')]=_0x347113[_0x57a0('0x2c')];queues[_0x347113['uniqueid']][_0x57a0('0x2d')]=_0x347113[_0x57a0('0x2d')];}};exports['agentconnect']=function(_0x5333b0){if(!_[_0x57a0('0x15')](queues[_0x5333b0[_0x57a0('0x11')]])){queues[_0x5333b0['uniqueid']][_0x57a0('0x16')]=![];queues[_0x5333b0['uniqueid']][_0x57a0('0x16')]=![];queues[_0x5333b0[_0x57a0('0x11')]][_0x57a0('0x20')]=null;queues[_0x5333b0[_0x57a0('0x11')]][_0x57a0('0x17')]=![];queues[_0x5333b0[_0x57a0('0x11')]][_0x57a0('0xa')]=null;queues[_0x5333b0[_0x57a0('0x11')]][_0x57a0('0x21')]=null;queues[_0x5333b0['uniqueid']][_0x57a0('0x2e')]=!![];queues[_0x5333b0['uniqueid']][_0x57a0('0x9')]=_0x5333b0['destaccountcode'];queues[_0x5333b0[_0x57a0('0x11')]][_0x57a0('0x7')]=_0x5333b0[_0x57a0('0x2f')];}};exports[_0x57a0('0x30')]=function(_0x2077e2){if(!_[_0x57a0('0x15')](queues[_0x2077e2[_0x57a0('0x11')]])){if(queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x27')]){queues[_0x2077e2['uniqueid']][_0x57a0('0x16')]=![];queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x16')]=![];queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x20')]=null;queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x17')]=![];queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x21')]=null;queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x2e')]=!![];queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x7')]=_0x2077e2['membername'];queues[_0x2077e2[_0x57a0('0x11')]]['queuecallercomplete']=!![];queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0x19')]=utils['now']();if(_0x2077e2[_0x57a0('0x31')]=='transfer'){if(!queues[_0x2077e2['uniqueid']]['transfer']){queues[_0x2077e2[_0x57a0('0x11')]][_0x57a0('0xa')]='TRANSFER';}}else{queues[_0x2077e2['uniqueid']][_0x57a0('0xa')]='COMPLETEDBY'+_0x2077e2[_0x57a0('0x31')]['toUpperCase']();}writeDB(queues[_0x2077e2[_0x57a0('0x11')]]);}}};exports[_0x57a0('0x32')]=function(_0x216bd6){if(!_['isNil'](queues[_0x216bd6['transfereeuniqueid']])){queues[_0x216bd6[_0x57a0('0x33')]][_0x57a0('0x34')]=!![];queues[_0x216bd6['transfereeuniqueid']][_0x57a0('0x35')]=_0x57a0('0x36');queues[_0x216bd6[_0x57a0('0x33')]][_0x57a0('0x37')]=_0x216bd6[_0x57a0('0x38')];queues[_0x216bd6['transfereeuniqueid']]['transferuniqueid']=_0x216bd6[_0x57a0('0x33')];queues[_0x216bd6[_0x57a0('0x33')]][_0x57a0('0xa')]=_0x57a0('0x39');}};exports[_0x57a0('0x3a')]=function(_0x190484){try{if(_0x190484['origtransfereruniqueid']==_0x190484[_0x57a0('0x3b')]){if(!_[_0x57a0('0x15')](queues[_0x190484[_0x57a0('0x3c')]])){queues[_0x190484[_0x57a0('0x3c')]][_0x57a0('0x34')]=!![];queues[_0x190484['secondtransfererlinkedid']][_0x57a0('0x35')]=_0x57a0('0x3d');queues[_0x190484[_0x57a0('0x3c')]]['transferexten']=_0x190484[_0x57a0('0x3e')];queues[_0x190484[_0x57a0('0x3c')]][_0x57a0('0x3f')]=_0x190484[_0x57a0('0x40')];queues[_0x190484[_0x57a0('0x3c')]][_0x57a0('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x57a0('0x15')](queues[_0x190484[_0x57a0('0x3b')]])){if(_0x190484[_0x57a0('0x41')]&&queues[_0x190484[_0x57a0('0x41')]]){queues[_0x190484['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x190484[_0x57a0('0x33')]]=_[_0x57a0('0x42')](queues[_0x190484[_0x57a0('0x41')]]);queues[_0x190484[_0x57a0('0x33')]][_0x57a0('0x10')]=_0x190484['transfertargetuniqueid'];queues[_0x190484[_0x57a0('0x33')]][_0x57a0('0x43')]=0x2;queues[_0x190484[_0x57a0('0x33')]]['calleridnum']=queues[_0x190484[_0x57a0('0x3c')]][_0x57a0('0x8')];queues[_0x190484[_0x57a0('0x33')]]['calleridname']=queues[_0x190484[_0x57a0('0x3c')]]['calleridname'];queues[_0x190484[_0x57a0('0x33')]]['queuecallerjoinAt']=utils[_0x57a0('0x14')]();queues[_0x190484[_0x57a0('0x33')]][_0x57a0('0x27')]=utils[_0x57a0('0x14')]();queues[_0x190484[_0x57a0('0x33')]][_0x57a0('0x28')]=0x0;queues[_0x190484['transfereeuniqueid']][_0x57a0('0x44')]=0x0;}else{queues[_0x190484[_0x57a0('0x3b')]][_0x57a0('0x10')]=_0x190484[_0x57a0('0x3c')];}}}else if(_0x190484[_0x57a0('0x45')]==_0x190484[_0x57a0('0x3c')]){if(!_[_0x57a0('0x15')](queues[_0x190484['origtransfererlinkedid']])){queues[_0x190484[_0x57a0('0x3b')]]['transfer']=!![];queues[_0x190484[_0x57a0('0x3b')]]['transfertype']=_0x57a0('0x3d');queues[_0x190484[_0x57a0('0x3b')]][_0x57a0('0x37')]=_0x190484[_0x57a0('0x46')];queues[_0x190484[_0x57a0('0x3b')]][_0x57a0('0x3f')]=_0x190484[_0x57a0('0x45')];queues[_0x190484[_0x57a0('0x3b')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x57a0('0x15')](queues[_0x190484[_0x57a0('0x3c')]])){if(_0x190484[_0x57a0('0x47')]&&queues[_0x190484[_0x57a0('0x47')]]){queues[_0x190484[_0x57a0('0x47')]][_0x57a0('0x43')]=0x1;queues[_0x190484[_0x57a0('0x48')]]=_[_0x57a0('0x42')](queues[_0x190484[_0x57a0('0x47')]]);queues[_0x190484['transfertargetuniqueid']][_0x57a0('0x10')]=_0x190484[_0x57a0('0x48')];queues[_0x190484['transfertargetuniqueid']][_0x57a0('0x43')]=0x2;queues[_0x190484[_0x57a0('0x48')]][_0x57a0('0x8')]=queues[_0x190484[_0x57a0('0x3b')]][_0x57a0('0x8')];queues[_0x190484[_0x57a0('0x48')]][_0x57a0('0x49')]=queues[_0x190484[_0x57a0('0x3b')]][_0x57a0('0x49')];queues[_0x190484[_0x57a0('0x48')]][_0x57a0('0x2a')]=utils[_0x57a0('0x14')]();queues[_0x190484[_0x57a0('0x48')]][_0x57a0('0x27')]=utils[_0x57a0('0x14')]();queues[_0x190484[_0x57a0('0x48')]]['holdtime']=0x0;queues[_0x190484[_0x57a0('0x48')]][_0x57a0('0x44')]=0x0;}else{queues[_0x190484[_0x57a0('0x3c')]][_0x57a0('0x10')]=_0x190484[_0x57a0('0x3b')];}}}}catch(_0xd6284a){utils[_0x57a0('0x4a')](_0xd6284a[_0x57a0('0x4b')]);}};exports[_0x57a0('0x4c')]=function(_0xa7e723){if(!_['isNil'](queues[_0xa7e723[_0x57a0('0x11')]])){queues[_0xa7e723[_0x57a0('0x11')]][_0x57a0('0x4d')]=utils[_0x57a0('0x14')]();}};exports[_0x57a0('0x4e')]=function(_0x5f4614){if(!_[_0x57a0('0x15')](queues[_0x5f4614[_0x57a0('0x11')]])){if(!_[_0x57a0('0x15')](queues[_0x5f4614[_0x57a0('0x11')]]['musiconholdstartAt'])){queues[_0x5f4614[_0x57a0('0x11')]][_0x57a0('0x44')]+=utils[_0x57a0('0x29')](utils[_0x57a0('0x14')](),queues[_0x5f4614[_0x57a0('0x11')]]['musiconholdstartAt']);delete queues[_0x5f4614[_0x57a0('0x11')]][_0x57a0('0x4d')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index dcbc187..e02c196 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file +var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x49250f,_0x1b7ef7){var _0x11b7a6=function(_0x2e685a){while(--_0x2e685a){_0x49250f['push'](_0x49250f['shift']());}};_0x11b7a6(++_0x1b7ef7);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a10e3,_0x3cdb35){_0x3a10e3=_0x3a10e3-0x0;var _0xf067c8=_0xedd9[_0x3a10e3];return _0xf067c8;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f5daf97..18fd9f9 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 _0x8ebf=['info','format','type','request','CreateVoiceTransferReport','error','stack','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetlinkedid','lodash','util','./utils'];(function(_0x29b879,_0x1e899e){var _0x4b065c=function(_0x37e4dc){while(--_0x37e4dc){_0x29b879['push'](_0x29b879['shift']());}};_0x4b065c(++_0x1e899e);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x8ebf[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0xf8eb('0x0'));var util=require(_0xf8eb('0x1'));var utils=require(_0xf8eb('0x2'));function writeDB(_0x4e42d0){utils[_0xf8eb('0x3')](util[_0xf8eb('0x4')]('TRANSFER|%s',_0x4e42d0[_0xf8eb('0x5')]));utils[_0xf8eb('0x6')](_0xf8eb('0x7'),_0x4e42d0);}exports['blindtransfer']=function(_0xfce9b){try{_0xfce9b[_0xf8eb('0x5')]='blind';writeDB(_0xfce9b);}catch(_0x30c91c){utils[_0xf8eb('0x8')](_0x30c91c[_0xf8eb('0x9')]);}};exports['attendedtransfer']=function(_0x959b95){try{_0x959b95=_['assign'](_0x959b95,{'transfererchannel':_0x959b95[_0xf8eb('0xa')],'transferercalleridnum':_0x959b95['origtransferercalleridnum'],'transferercalleridname':_0x959b95[_0xf8eb('0xb')],'transfererconnectedlinenum':_0x959b95[_0xf8eb('0xc')],'transfererconnectedlinename':_0x959b95[_0xf8eb('0xd')],'transfereraccountcode':_0x959b95['origtransfereraccountcode'],'transferercontext':_0x959b95[_0xf8eb('0xe')],'transfererexten':_0x959b95[_0xf8eb('0xf')],'transfererlinkedid':_0x959b95[_0xf8eb('0x10')],'context':_0x959b95[_0xf8eb('0x11')],'extension':_0x959b95[_0xf8eb('0x12')],'type':_0xf8eb('0x13')});if(_[_0xf8eb('0x14')](_0x959b95[_0xf8eb('0x15')])){_0x959b95=_['assign'](_0x959b95,{'transfereechannel':_0x959b95[_0xf8eb('0x16')],'transfereecalleridnum':_0x959b95[_0xf8eb('0x17')],'transfereecalleridname':_0x959b95[_0xf8eb('0x18')],'transfereeconnectedlinenum':_0x959b95[_0xf8eb('0x19')],'transfereeconnectedlinename':_0x959b95['transfertargetconnectedlinename'],'transfereeaccountcode':_0x959b95['transfertargetaccountcode'],'transfereecontext':_0x959b95['transfertargetcontext'],'transfereeexten':_0x959b95['transfertargetexten'],'transfereelinkedid':_0x959b95[_0xf8eb('0x1a')]});}writeDB(_0x959b95);}catch(_0x22af2e){utils['error'](_0x22af2e[_0xf8eb('0x9')]);}}; \ No newline at end of file +var _0xf43e=['blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','request','type'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf43e,0x75));var _0xef43=function(_0x585dcd,_0x15f700){_0x585dcd=_0x585dcd-0x0;var _0x10aacb=_0xf43e[_0x585dcd];return _0x10aacb;};'use strict';var _=require(_0xef43('0x0'));var util=require(_0xef43('0x1'));var utils=require(_0xef43('0x2'));function writeDB(_0x25a8bb){utils[_0xef43('0x3')](util[_0xef43('0x4')]('TRANSFER|%s',_0x25a8bb['type']));utils[_0xef43('0x5')]('CreateVoiceTransferReport',_0x25a8bb);}exports['blindtransfer']=function(_0x550153){try{_0x550153[_0xef43('0x6')]=_0xef43('0x7');writeDB(_0x550153);}catch(_0x2e9ed6){utils['error'](_0x2e9ed6[_0xef43('0x8')]);}};exports[_0xef43('0x9')]=function(_0x2a0913){try{_0x2a0913=_[_0xef43('0xa')](_0x2a0913,{'transfererchannel':_0x2a0913[_0xef43('0xb')],'transferercalleridnum':_0x2a0913[_0xef43('0xc')],'transferercalleridname':_0x2a0913[_0xef43('0xd')],'transfererconnectedlinenum':_0x2a0913[_0xef43('0xe')],'transfererconnectedlinename':_0x2a0913[_0xef43('0xf')],'transfereraccountcode':_0x2a0913['origtransfereraccountcode'],'transferercontext':_0x2a0913[_0xef43('0x10')],'transfererexten':_0x2a0913[_0xef43('0x11')],'transfererlinkedid':_0x2a0913[_0xef43('0x12')],'context':_0x2a0913[_0xef43('0x13')],'extension':_0x2a0913['origtransfererexten'],'type':'attended'});if(_[_0xef43('0x14')](_0x2a0913[_0xef43('0x15')])){_0x2a0913=_[_0xef43('0xa')](_0x2a0913,{'transfereechannel':_0x2a0913[_0xef43('0x16')],'transfereecalleridnum':_0x2a0913[_0xef43('0x17')],'transfereecalleridname':_0x2a0913[_0xef43('0x18')],'transfereeconnectedlinenum':_0x2a0913[_0xef43('0x19')],'transfereeconnectedlinename':_0x2a0913['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2a0913[_0xef43('0x1a')],'transfereecontext':_0x2a0913[_0xef43('0x1b')],'transfereeexten':_0x2a0913[_0xef43('0x1c')],'transfereelinkedid':_0x2a0913[_0xef43('0x1d')]});}writeDB(_0x2a0913);}catch(_0x159730){utils[_0xef43('0x1e')](_0x159730[_0xef43('0x8')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9237a57..a8ccddf 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 _0x120f=['sumTime','now','isBefore','client','../../config/logger','xdr','info','debug','stringify','error','request','catch','stack','GetUser','internal','interface','then','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getVoiceQueueByName','name','acw','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x120f,0x12b));var _0xf120=function(_0xf382d,_0x185322){_0xf382d=_0xf382d-0x0;var _0x24d522=_0x120f[_0xf382d];return _0x24d522;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require('bluebird');var client=jayson[_0xf120('0x0')]['http']({'port':0x2329});var logger=require(_0xf120('0x1'))(_0xf120('0x2'));exports['info']=function(_0x5dd615){logger[_0xf120('0x3')](_0x5dd615);};exports[_0xf120('0x4')]=function(_0x1ec1c0){logger[_0xf120('0x4')](JSON[_0xf120('0x5')](_0x1ec1c0));};exports[_0xf120('0x6')]=function(_0x4da1e9){logger['error'](_0x4da1e9['stack']);};exports[_0xf120('0x7')]=function(_0x3fae7f,_0x1d87dc){return client[_0xf120('0x7')](_0x3fae7f,{'body':_0x1d87dc})['then'](function(_0x41bd63){logger[_0xf120('0x4')](JSON[_0xf120('0x5')](_0x41bd63));})[_0xf120('0x8')](function(_0x267b02){logger[_0xf120('0x6')](_0x267b02[_0xf120('0x9')]);});};function getUser(_0x80ce0){return client[_0xf120('0x7')](_0xf120('0xa'),{'options':{'raw':!![],'attributes':['id',_0xf120('0xb'),'name',_0xf120('0xc')],'where':_0x80ce0,'limit':0x1}})[_0xf120('0xd')](function(_0xa5c05b){logger[_0xf120('0x3')](_0xf120('0xe')+JSON[_0xf120('0x5')](_0x80ce0)+'|'+(_0xa5c05b[_0xf120('0xf')][_0xf120('0x10')]?_0xf120('0x11'):_0xf120('0x12')));return _0xa5c05b['result'][_0xf120('0x10')]?_0xa5c05b[_0xf120('0xf')][0x0]:null;});}exports[_0xf120('0x13')]=function(_0x2a29f7){return new BPromise(function(_0x15dadf,_0x28d81e){if(_0x2a29f7){return getUser({'internal':_0x2a29f7})['then'](function(_0x52ca36){return _0x15dadf(_0x52ca36);})['catch'](function(_0x46c6fa){logger[_0xf120('0x6')](_0x46c6fa[_0xf120('0x9')]);return _0x15dadf(null);});}else{return _0x15dadf(null);}});};exports[_0xf120('0x14')]=function(_0xea0760){return new BPromise(function(_0x269d4c,_0x58cc70){if(_0xea0760){return getUser({'interface':_0xea0760})[_0xf120('0xd')](function(_0x4e45a2){return _0x269d4c(_0x4e45a2);})[_0xf120('0x8')](function(_0x2b6a8a){logger[_0xf120('0x6')](_0x2b6a8a[_0xf120('0x9')]);return _0x269d4c(null);});}else{return _0x269d4c(null);}});};exports['getUserByName']=function(_0x55c7cc){return new BPromise(function(_0x2aff81,_0x273b99){if(_0x55c7cc){return getUser({'name':_0x55c7cc})[_0xf120('0xd')](function(_0x3840a8){return _0x2aff81(_0x3840a8);})[_0xf120('0x8')](function(_0x431b22){logger[_0xf120('0x6')](_0x431b22[_0xf120('0x9')]);return _0x2aff81(null);});}else{return _0x2aff81(null);}});};exports[_0xf120('0x15')]=function(_0x359156){return new BPromise(function(_0x138ac7,_0x5ee300){if(_0x359156){return client[_0xf120('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xf120('0x16'),'type',_0xf120('0x17'),_0xf120('0x18')],'where':{'name':_0x359156},'limit':0x1}})[_0xf120('0xd')](function(_0x50865e){logger['info'](_0xf120('0x19')+_0x359156+'|'+(_0x50865e['result']['length']?_0xf120('0x11'):_0xf120('0x12')));return _0x138ac7(_0x50865e[_0xf120('0xf')]['length']?_0x50865e[_0xf120('0xf')][0x0]:null);})[_0xf120('0x8')](function(_0x42f63b){logger['error'](_0x42f63b[_0xf120('0x9')]);return _0x138ac7(null);});}else{return _0x138ac7(null);}});};exports[_0xf120('0x1a')]=function(_0x4e507c,_0x26d787){return moment(_0x4e507c)['add'](_0x26d787,'seconds')[_0xf120('0x1b')](_0xf120('0x1c'));};exports[_0xf120('0x1d')]=function(_0x25d519,_0x11540b){return moment(_0x25d519)[_0xf120('0x1e')](_0x11540b,_0xf120('0x1f'))[_0xf120('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf120('0x20')]=function(_0xe7becb,_0x56dcc6){return moment(_0xe7becb)[_0xf120('0x21')](moment(_0x56dcc6),_0xf120('0x1f'));};exports[_0xf120('0x22')]=function(_0x880528,_0x326e9f){return parseInt(_0x880528,0xa)+parseInt(_0x326e9f,0xa);};exports[_0xf120('0x23')]=function(){return moment()['format'](_0xf120('0x1c'));};exports['isAfter']=function(_0x471265,_0x4a3def){if(_0x4a3def){return moment(_0x471265)['isAfter'](_0x4a3def);}else{return!![];}};exports[_0xf120('0x24')]=function(_0x62d94b,_0x198b04){if(_0x198b04){return moment(_0x62d94b)[_0xf120('0x24')](_0x198b04);}else if(_0x62d94b){return!![];}else{return![];}}; \ No newline at end of file +var _0x8430=['now','isAfter','isBefore','jayson/promise','bluebird','xdr','info','debug','stringify','request','then','catch','error','stack','GetUser','internal','name','interface','GETUSER|','result','NOTFOUND','getUserByInternal','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','length','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime'];(function(_0x3e6c96,_0x5b780b){var _0x43a176=function(_0x23c4f6){while(--_0x23c4f6){_0x3e6c96['push'](_0x3e6c96['shift']());}};_0x43a176(++_0x5b780b);}(_0x8430,0x97));var _0x0843=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x8430[_0x322522];return _0x293bcf;};'use strict';var jayson=require(_0x0843('0x0'));var moment=require('moment');var BPromise=require(_0x0843('0x1'));var client=jayson['client']['http']({'port':0x2329});var logger=require('../../config/logger')(_0x0843('0x2'));exports[_0x0843('0x3')]=function(_0xd94485){logger[_0x0843('0x3')](_0xd94485);};exports[_0x0843('0x4')]=function(_0x2bd131){logger[_0x0843('0x4')](JSON[_0x0843('0x5')](_0x2bd131));};exports['error']=function(_0x55e26a){logger['error'](_0x55e26a['stack']);};exports[_0x0843('0x6')]=function(_0x4ad5a7,_0x5b8bfc){return client[_0x0843('0x6')](_0x4ad5a7,{'body':_0x5b8bfc})[_0x0843('0x7')](function(_0x199bd7){logger[_0x0843('0x4')](JSON[_0x0843('0x5')](_0x199bd7));})[_0x0843('0x8')](function(_0xb27d1){logger[_0x0843('0x9')](_0xb27d1[_0x0843('0xa')]);});};function getUser(_0x31e6c6){return client[_0x0843('0x6')](_0x0843('0xb'),{'options':{'raw':!![],'attributes':['id',_0x0843('0xc'),_0x0843('0xd'),_0x0843('0xe')],'where':_0x31e6c6,'limit':0x1}})[_0x0843('0x7')](function(_0x231ddd){logger[_0x0843('0x3')](_0x0843('0xf')+JSON['stringify'](_0x31e6c6)+'|'+(_0x231ddd[_0x0843('0x10')]['length']?'FOUND':_0x0843('0x11')));return _0x231ddd[_0x0843('0x10')]['length']?_0x231ddd[_0x0843('0x10')][0x0]:null;});}exports[_0x0843('0x12')]=function(_0x392233){return new BPromise(function(_0xc844fe,_0x27dadc){if(_0x392233){return getUser({'internal':_0x392233})[_0x0843('0x7')](function(_0x658004){return _0xc844fe(_0x658004);})[_0x0843('0x8')](function(_0x5ed2c1){logger[_0x0843('0x9')](_0x5ed2c1[_0x0843('0xa')]);return _0xc844fe(null);});}else{return _0xc844fe(null);}});};exports['getUserByInterface']=function(_0x2da8c7){return new BPromise(function(_0x4f7c9b,_0x31329b){if(_0x2da8c7){return getUser({'interface':_0x2da8c7})[_0x0843('0x7')](function(_0x58c654){return _0x4f7c9b(_0x58c654);})[_0x0843('0x8')](function(_0x3db1c7){logger[_0x0843('0x9')](_0x3db1c7['stack']);return _0x4f7c9b(null);});}else{return _0x4f7c9b(null);}});};exports[_0x0843('0x13')]=function(_0x266d17){return new BPromise(function(_0x3beda9,_0x313ca5){if(_0x266d17){return getUser({'name':_0x266d17})['then'](function(_0x188261){return _0x3beda9(_0x188261);})['catch'](function(_0x118614){logger[_0x0843('0x9')](_0x118614['stack']);return _0x3beda9(null);});}else{return _0x3beda9(null);}});};exports[_0x0843('0x14')]=function(_0x5e19c3){return new BPromise(function(_0x12bc24,_0xd0956f){if(_0x5e19c3){return client['request'](_0x0843('0x15'),{'options':{'raw':!![],'attributes':['id',_0x0843('0xd'),_0x0843('0x16'),'acw',_0x0843('0x17')],'where':{'name':_0x5e19c3},'limit':0x1}})['then'](function(_0x2f9e28){logger[_0x0843('0x3')](_0x0843('0x18')+_0x5e19c3+'|'+(_0x2f9e28[_0x0843('0x10')]['length']?_0x0843('0x19'):_0x0843('0x11')));return _0x12bc24(_0x2f9e28[_0x0843('0x10')][_0x0843('0x1a')]?_0x2f9e28[_0x0843('0x10')][0x0]:null);})['catch'](function(_0x4a22be){logger[_0x0843('0x9')](_0x4a22be['stack']);return _0x12bc24(null);});}else{return _0x12bc24(null);}});};exports[_0x0843('0x1b')]=function(_0x124263,_0x5941a5){return moment(_0x124263)[_0x0843('0x1c')](_0x5941a5,'seconds')[_0x0843('0x1d')](_0x0843('0x1e'));};exports['subtractTime']=function(_0x3b0a13,_0x148bfd){return moment(_0x3b0a13)['subtract'](_0x148bfd,'seconds')[_0x0843('0x1d')](_0x0843('0x1e'));};exports[_0x0843('0x1f')]=function(_0x4d7c8b,_0x251c92){return moment(_0x4d7c8b)[_0x0843('0x20')](moment(_0x251c92),'seconds');};exports[_0x0843('0x21')]=function(_0x26dc97,_0x546f9c){return parseInt(_0x26dc97,0xa)+parseInt(_0x546f9c,0xa);};exports[_0x0843('0x22')]=function(){return moment()[_0x0843('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0843('0x23')]=function(_0x395362,_0x4c4d40){if(_0x4c4d40){return moment(_0x395362)[_0x0843('0x23')](_0x4c4d40);}else{return!![];}};exports[_0x0843('0x24')]=function(_0xad6225,_0x24a529){if(_0x24a529){return moment(_0xad6225)['isBefore'](_0x24a529);}else if(_0xad6225){return!![];}else{return![];}}; \ No newline at end of file